Branch: Tag:

1998-11-22

1998-11-22 11:08:52 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

New module: Perl

Rev: src/ChangeLog:1.157
Rev: src/README:1.8
Rev: src/acconfig.h:1.35
Rev: src/array.c:1.42
Rev: src/array.h:1.14
Rev: src/backend.c:1.40
Rev: src/builtin_functions.c:1.140
Rev: src/callback.c:1.15
Rev: src/compilation.h:1.13
Rev: src/configure.in:1.254
Rev: src/cpp.c:1.30
Rev: src/docode.c:1.42
Rev: src/dynamic_buffer.c:1.9
Rev: src/encode.c:1.26
Rev: src/error.c:1.22
Rev: src/error.h:1.25
Rev: src/fd_control.c:1.22
Rev: src/fdlib.h:1.21
Rev: src/gc.c:1.39
Rev: src/gc.h:1.20
Rev: src/global.h:1.26
Rev: src/hashtable.c:1.5
Rev: src/interpret.c:1.111
Rev: src/interpret.h:1.24
Rev: src/language.yacc:1.108
Rev: src/las.c:1.71
Rev: src/las.h:1.17
Rev: src/lex.c:1.58
Rev: src/lex.h:1.12
Rev: src/main.c:1.60
Rev: src/mapping.c:1.37
Rev: src/modules/Odbc/odbc.c:1.12
Rev: src/modules/Perl/.cvsignore:1.1
Rev: src/modules/Perl/Makefile.in:1.1
Rev: src/modules/Perl/configure.in:1.1
Rev: src/modules/Perl/perlmod.c:1.1
Rev: src/modules/Perl/testsuite.in:1.1
Rev: src/modules/Postgres/postgres.c:1.10
Rev: src/modules/Regexp/pike_regexp.c:1.13
Rev: src/modules/call_out/call_out.c:1.23
Rev: src/modules/files/file.c:1.128
Rev: src/modules/files/socket.c:1.40
Rev: src/modules/spider/spider.c:1.76
Rev: src/modules/sprintf/sprintf.c:1.31
Rev: src/multiset.c:1.12
Rev: src/object.c:1.53
Rev: src/opcodes.c:1.32
Rev: src/operators.c:1.44
Rev: src/peep.c:1.25
Rev: src/pike_memory.c:1.28
Rev: src/pike_types.c:1.49
Rev: src/pike_types.h:1.16
Rev: src/port.c:1.18
Rev: src/port.h:1.20
Rev: src/program.c:1.105
Rev: src/program.h:1.46
Rev: src/signal_handler.c:1.89
Rev: src/stralloc.c:1.50
Rev: src/stralloc.h:1.26
Rev: src/svalue.c:1.39
Rev: src/svalue.h:1.19
Rev: src/threads.c:1.85
Rev: src/threads.h:1.60

19:   #include "gc.h"   #include "main.h"    - RCSID("$Id: array.c,v 1.41 1998/10/14 05:48:44 hubbe Exp $"); + RCSID("$Id: array.c,v 1.42 1998/11/22 11:02:31 hubbe Exp $");      struct array empty_array=   {
104:   void really_free_array(struct array *v)   {    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(v == & empty_array)    fatal("Tried to free the empty_array.\n");   #endif    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(v);   #endif   
129:    */   void array_index_no_free(struct svalue *s,struct array *v,INT32 index)   { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(index<0 || index>=v->size)    fatal("Illegal index in low level index routine.\n");   #endif
142:    */   void array_index(struct svalue *s,struct array *v,INT32 index)   { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(index<0 || index>=v->size)    fatal("Illegal index in low level index routine.\n");   #endif
190:    */   void array_free_index(struct array *v,INT32 index)   { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(index<0 || index>=v->size)    fatal("Illegal index in low level free index routine.\n");   #endif
203:    */   void array_set_index(struct array *v,INT32 index, struct svalue *s)   { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(index<0 || index>v->size)    fatal("Illegal index in low level array set routine.\n");   #endif
239:    */   struct array *array_insert(struct array *v,struct svalue *s,INT32 index)   { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(index<0 || index>v->size)    fatal("Illegal index in low level insert routine.\n");   #endif
284:    */   struct array *resize_array(struct array *a, INT32 size)   { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(a);   #endif   
327:   {    struct array *a;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(v->refs>2) /* Odd, but has to be two */    fatal("Array shrink on array with many references.\n");   
359:   {    struct array *a;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(v->refs>1)    fatal("Array remove on array with many references.\n");   
402:   INT32 array_search(struct array *v, struct svalue *s,INT32 start)   {    INT32 e; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(start<0)    fatal("Start of find_index is less than zero.\n");   #endif
410:    check_destructed(s);       /* Why search for something that is not there? */ - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(v);   #endif    if(v->type_field & (1 << s->type))
440:   {    struct array *a;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(start > end || end>v->size || start<0)    fatal("Illegal arguments to slice_array()\n");   
469:   {    struct array *a;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(start > end || end>v->size || start<0)    fatal("Illegal arguments to slice_array()\n");   
508:    INT16 types;       types = 0; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(v);   #endif    if(v->type_field & (BIT_OBJECT | BIT_FUNCTION))
543:   {    INT32 e;    TYPE_FIELD types; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(v);   #endif    if(v->type_field & (BIT_OBJECT | BIT_FUNCTION))
560:    }    v->type_field = types;    } - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(v);   #endif    return -1;
765:      INT32 set_lookup(struct array *a, struct svalue *s)   { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(a);   #endif    /* face it, it's not there */
782:   INT32 switch_lookup(struct array *a, struct svalue *s)   {    /* face it, it's not there */ - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(a);   #endif    if( (((2 << s->type) -1) & a->type_field) == 0)
838:       for(e=0; e<v->size; e++) t |= 1 << ITEM(v)[e].type;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(t & ~(v->type_field))    {    describe(v);
848:    v->type_field = t;   }    - #ifdef DEBUG + #ifdef PIKE_DEBUG   /* Maybe I should have a 'clean' flag for this computation */   void array_check_type_field(struct array *v)   {
927:    INT32 ap,bp,i,*ret,*ptr;       ap=bp=0; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1)    {    array_check_type_field(a);
939:    /* do smart optimizations */    switch(opcode)    { -  case OP_AND: +  case PIKE_ARRAY_OP_AND:    ret=(INT32 *)xalloc(sizeof(INT32));    *ret=0;    return ret;    -  case OP_SUB: +  case PIKE_ARRAY_OP_SUB:    ptr=ret=(INT32 *)xalloc(sizeof(INT32)*(a->size+1));    *(ptr++)=a->size;    for(i=0;i<a->size;i++) *(ptr++)=i;
965:    else    i=opcode >> 4;    -  if(i & OP_A) *(ptr++)=ap; -  if(i & OP_B) *(ptr++)=~bp; -  if(i & OP_SKIP_A) ap++; -  if(i & OP_SKIP_B) bp++; +  if(i & PIKE_ARRAY_OP_A) *(ptr++)=ap; +  if(i & PIKE_ARRAY_OP_B) *(ptr++)=~bp; +  if(i & PIKE_ARRAY_OP_SKIP_A) ap++; +  if(i & PIKE_ARRAY_OP_SKIP_B) bp++;    }    -  if((opcode >> 8) & OP_A) while(ap<a->size) *(ptr++)=ap++; -  if(opcode & OP_B) while(bp<b->size) *(ptr++)=~(bp++); +  if((opcode >> 8) & PIKE_ARRAY_OP_A) while(ap<a->size) *(ptr++)=ap++; +  if(opcode & PIKE_ARRAY_OP_B) while(bp<b->size) *(ptr++)=~(bp++);       *ret=(ptr-ret-1);   
1046:    if(a->size != b->size) return 0;    if(!a->size) return 1;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1)    {    array_check_type_field(a);
1169:   /* subtract an array from another */   struct array *subtract_arrays(struct array *a, struct array *b)   { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1)    {    array_check_type_field(b);
1179:       if(a->type_field & b->type_field)    { -  return merge_array_with_order(a, b, OP_SUB); +  return merge_array_with_order(a, b, PIKE_ARRAY_OP_SUB);    }else{    if(a->refs == 1)    {
1193:   /* and two arrays */   struct array *and_arrays(struct array *a, struct array *b)   { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1)    {    array_check_type_field(b);
1203:       if(a->type_field & b->type_field)    { -  return merge_array_without_order(a, b, OP_AND); +  return merge_array_without_order(a, b, PIKE_ARRAY_OP_AND);    }else{    return allocate_array_no_init(0,0);    }
1469:    struct processing doing;    struct array *ret;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(a);   #endif   
1536:    while((i=array_search(a,from,i+1)) >= 0) array_set_index(a,i,to);   }    - #ifdef DEBUG + #ifdef PIKE_DEBUG   void check_array(struct array *a)   {    INT32 e;
1573: Inside #if defined(DEBUG)
   fatal("Null pointer in array list.\n");    } while (a != & empty_array);   } - #endif /* DEBUG */ + #endif /* PIKE_DEBUG */         void gc_mark_array_as_referenced(struct array *a)
1589:    a=&empty_array;    do    { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(a);   #endif    if(a->type_field & BIT_COMPLEX)
1651:   }       - #ifdef DEBUG + #ifdef PIKE_DEBUG      void debug_dump_type_field(TYPE_FIELD t)   {
1690:    do    {    - #if defined(DEBUG) && defined(DEBUG_MALLOC) + #if defined(PIKE_DEBUG) && defined(DEBUG_MALLOC)    if(verbose_debug_exit && a!=&empty_array)    describe(a);   #endif
1798:    ITEM(a)[e].u.array->type_field);    size+=ITEM(a)[e].u.array->size;    } - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(size != ret->size)    fatal("Implode_array failed miserably\n");   #endif    return ret;   }