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

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: mapping.c,v 1.36 1998/08/05 22:48:36 hubbe Exp $"); + RCSID("$Id: mapping.c,v 1.37 1998/11/22 11:03:02 hubbe Exp $");   #include "main.h"   #include "object.h"   #include "mapping.h"
27:   struct mapping *first_mapping;       - #ifdef DEBUG + #ifdef PIKE_DEBUG   /* This function checks that the type field isn't lacking any bits.    * It is used for debugging purposes only.    */
64:    INT32 e;    INT32 hashsize,hashspace;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(size < 0) fatal("init_mapping with negative value.\n");   #endif    if(size)
125:   {    INT32 e;    struct keypair *k; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(m->refs)    fatal("really free mapping on mapping with nonzero refs.\n");   #endif
179:    */   static struct mapping *rehash(struct mapping *m, int new_size)   { - #ifdef DEBUG + #ifdef PIKE_DEBUG    INT32 tmp=m->size;   #endif    INT32 e,hashsize;
198:    free((char *)hash);    }    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(m->size != tmp)    fatal("Rehash failed, size not same any more.\n");   #endif    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif   
228:    ind_types |= 1 << k->ind.type;    }    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(val_types & ~(m->val_types))    fatal("Mapping value types out of order!\n");   
254:    {    h=h2 % m->hashsize;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif    if(m->ind_types & (1 << key->type))
270:    m->val_types |= 1 << val->type;    assign_svalue(& k->val, val);    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif    return;
297:    assign_svalue_no_free(& k->val, val);    m->size++;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif   }
315:    {    h=h2 % m->hashsize;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif   
329:       if(k->val.type == t) return & ( k->val.u );    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif   
360:       if(t != T_INT) return 0;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif   
391:    if(m->size < (m->hashsize + 1) * MIN_LINK_LENGTH)    rehash(m, MAP_SLOTS(m->size));    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif    return;
405:    struct keypair *k, **prev;    TYPE_FIELD ind_types, val_types;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif   
442:       m->val_types = val_types;    m->ind_types = ind_types; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif    }
454:    unsigned INT32 h;    struct keypair *k, **prev;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif    if(!m->size) return 0;
540:       a->type_field = m->ind_types;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif   
561:       a->type_field = m->val_types;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif   
601:       m->val_types |= 1 << to->type;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif   
613:    struct svalue *i,*v;    INT32 e;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(ind->size != val->size)    fatal("mkmapping on different sized arrays.\n");   #endif
932:   }       - #ifdef DEBUG + #ifdef PIKE_DEBUG      void check_mapping(struct mapping *m)   {
1045:    m->val_types |= debug_gc_check_svalues(&k->val, 1, T_MAPPING, m);    }    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif   
1104:    }   }    - #ifdef DEBUG + #ifdef PIKE_DEBUG      void simple_describe_mapping(struct mapping *m)   {
1145:    {    add_ref(m);    - #if defined(DEBUG) && defined(DEBUG_MALLOC) + #if defined(PIKE_DEBUG) && defined(DEBUG_MALLOC)    if(verbose_debug_exit)    debug_dump_mapping(m);   #endif