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: builtin_functions.c,v 1.139 1998/11/17 06:39:50 grubba Exp $"); + RCSID("$Id: builtin_functions.c,v 1.140 1998/11/22 11:02:35 hubbe Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"
69:   void f_aggregate(INT32 args)   {    struct array *a; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(args < 0) fatal("Negative args to f_aggregate()\n");   #endif   
412:    }   #endif    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(!cwd)    fatal("No cwd in combine_path!\n");   #endif
623:    /* FIXME: Should we check for 0xfffe & 0xffff here too? */    len = in->len * 2;    out = begin_shared_string(len); - #if (BYTEORDER == 4321) + #if (PIKE_BYTEORDER == 4321)    /* Big endian -- We don't need to do much...    *    * FIXME: Future optimization: Check if refcount is == 1,
689:    out->str[j + 1] = c & 0xff;    out->str[j] = c >> 8;    } - #ifdef DEBUG + #ifdef PIKE_DEBUG    if (j) {    fatal("string_to_unicode(): Indexing error: len:%d, j:%d.\n", len, j);    } - #endif /* DEBUG */ + #endif /* PIKE_DEBUG */    out = end_shared_string(out);    }    break;
722:    len = in->len / 2;       out = begin_wide_shared_string(len, 1); - #if (BYTEORDER == 4321) + #if (PIKE_BYTEORDER == 4321)    /* Big endian    *    * FIXME: Future optimization: Perform sufficient magic
740:    ((unsigned char *)in->str)[i*2 + 1];    }    } - #endif /* BYTEORDER == 4321 */ + #endif /* PIKE_BYTEORDER == 4321 */    out = end_shared_string(out);    pop_n_elems(args);    push_string(out);
852:    out->str[j++] = 0x80 | (c & 0x3f);    }    } - #ifdef DEBUG + #ifdef PIKE_DEBUG    if (len != j) {    fatal("string_to_utf8(): Calculated and actual lengths differ: %d != %d\n",    len, j);    } - #endif /* DEBUG */ + #endif /* PIKE_DEBUG */    out = end_shared_string(out);    pop_n_elems(args);    push_string(out);
993:    }    low_set_index(out, j++, c);    } - #ifdef DEBUG + #ifdef PIKE_DEBUG    if (j != len) {    fatal("utf8_to_string(): Calculated and actual lengths differ: %d != %d\n",    len, j);    } - #endif /* DEBUG */ + #endif /* PIKE_DEBUG */    out = end_shared_string(out);    pop_n_elems(args);    push_string(out);
1898:    }   }    - #ifdef DEBUG + #ifdef PIKE_DEBUG   void f__verify_internals(INT32 args)   {    INT32 tmp=d_flag;
2216:    INT32 e;    struct keypair *k;    INT_TYPE low = 0x7fffffff; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if (ITEM(arr)[i].type != T_MAPPING) {    error("interleave_array(): Element %d is not a mapping!\n", i);    } - #endif /* DEBUG */ + #endif /* PIKE_DEBUG */    m = ITEM(arr)[i].u.mapping;    MAPPING_LOOP(m) {    if (k->ind.type != T_INT) {
2694: Inside #if defined(DIFF_DEBUG)
  #ifdef DIFF_DEBUG    fprintf(stderr, "DIFF: j=%d, x=%d\n", j, x);   #endif /* DIFF_DEBUG */ - #ifdef DEBUG + #ifdef PIKE_DEBUG    if (x >= blen) {    fatal("diff_longest_sequence(): x:%d >= blen:%d\n", x, blen);    } else if (x < 0) {    fatal("diff_longest_sequence(): x:%d < 0\n", x);    } - #endif /* DEBUG */ + #endif /* PIKE_DEBUG */    if (!marks[x]) {    int pos;   
2737: Inside #if defined(DIFF_DEBUG)
  #ifdef DIFF_DEBUG    fprintf(stderr, "DIFF: New j=%d, x=%d\n", j, x);   #endif /* DIFF_DEBUG */ - #ifdef DEBUG + #ifdef PIKE_DEBUG    if (x >= blen) {    fatal("diff_longest_sequence(): x:%d >= blen:%d\n", x, blen);    } else if (x < 0) {    fatal("diff_longest_sequence(): x:%d < 0\n", x);    } - #endif /* DEBUG */ + #endif /* PIKE_DEBUG */       /* Put x on the stack. */    marks[x] = 1;
2987:       i = 0;    while(dml) { - #ifdef DEBUG + #ifdef PIKE_DEBUG    if (i >= sz) {    fatal("Consistency error in diff_dyn_longest_sequence()\n");    } - #endif /* DEBUG */ + #endif /* PIKE_DEBUG */   #ifdef DIFF_DEBUG    fprintf(stderr, " %02d: %d\n", i, dml->x);   #endif /* DIFF_DEBUG */
3001:    dml = dml->prev;    i++;    } - #ifdef DEBUG + #ifdef PIKE_DEBUG    if (i != sz) {    fatal("Consistency error in diff_dyn_longest_sequence()\n");    } - #endif /* DEBUG */ + #endif /* PIKE_DEBUG */       dml_free_pools(dml_pool);    return(res);
3446:    INT32 size=0x7fffffff;    INT32 i,j,k;    - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(args < 0) fatal("Negative args to f_splice()\n");   #endif   
3483:    struct array *a;    struct array *ina;    INT32 size=0; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(args < 0) fatal("Negative args to f_everynth()\n");   #endif   
3523:    INT32 inner=0;    INT32 j,i;    TYPE_FIELD type=0; - #ifdef DEBUG + #ifdef PIKE_DEBUG    if(args < 0) fatal("Negative args to f_transpose()\n");   #endif   
3592:   }   #endif    - #ifdef DEBUG + #ifdef PIKE_DEBUG   void f__locate_references(INT32 args)   {    if(args)
3727:    add_efun("mktime",f_mktime,"function(int,int,int,int,int,int,int,void|int:int)|function(object|mapping:int)",OPT_TRY_OPTIMIZE);   #endif    - #ifdef DEBUG + #ifdef PIKE_DEBUG    add_efun("_verify_internals",f__verify_internals,"function(:void)",OPT_SIDE_EFFECT|OPT_EXTERNAL_DEPEND);    add_efun("_debug",f__debug,"function(int:int)",OPT_SIDE_EFFECT|OPT_EXTERNAL_DEPEND);   #ifdef YYDEBUG
3753: Inside #if defined(DEBUG_MALLOC)
  #ifdef DEBUG_MALLOC    add_efun("_reset_dmalloc",f__reset_dmalloc,"function(void:void)",OPT_SIDE_EFFECT);   #endif - #ifdef DEBUG + #ifdef PIKE_DEBUG    add_efun("_locate_references",f__locate_references,"function(1=mixed:1)",OPT_SIDE_EFFECT);   #endif   }