pike.git / src / docode.c

version» Context lines:

pike.git/src/docode.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: docode.c,v 1.163 2003/02/24 21:00:44 mast Exp $ + || $Id: docode.c,v 1.164 2003/04/02 19:22:42 mast Exp $   */      #include "global.h" - RCSID("$Id: docode.c,v 1.163 2003/02/24 21:00:44 mast Exp $"); + RCSID("$Id: docode.c,v 1.164 2003/04/02 19:22:42 mast Exp $");   #include "las.h"   #include "program.h"   #include "pike_types.h"   #include "stralloc.h"   #include "interpret.h"   #include "constants.h"   #include "array.h"   #include "pike_macros.h"   #include "pike_error.h"   #include "pike_memory.h"
pike.git/src/docode.c:23:   #include "peep.h"   #include "docode.h"   #include "operators.h"   #include "object.h"   #include "opcodes.h"   #include "language.h"   #include "lex.h"   #include "mapping.h"   #include "multiset.h"    - static int do_docode2(node *n, INT16 flags); + static int do_docode2(node *n, int flags);      typedef void (*cleanup_func)(void *);      struct cleanup_frame   {    struct cleanup_frame *prev;    cleanup_func cleanup;    void *cleanup_arg;    int stack_depth;   };
pike.git/src/docode.c:277:    emit0(F_CLEANUP_SYNCH_MARK);   }      void do_escape_catch(void)   {    emit0(F_ESCAPE_CATCH);   }      #define DO_CODE_BLOCK(X) do_pop(do_docode((X),DO_NOT_COPY | DO_POP ))    - int do_docode(node *n, INT16 flags) + int do_docode(node *n, int flags)   {    int i;    int stack_depth_save = current_stack_depth;    int save_current_line=lex.current_line;    if(!n) return 0;    lex.current_line=n->line_number;   #ifdef PIKE_DEBUG    if (current_stack_depth == -4711) Pike_fatal("do_docode() used outside docode().\n");   #endif    i=do_docode2(check_node_hash(n), flags);
pike.git/src/docode.c:301:    return i;   }      static int is_efun(node *n, c_fun fun)   {    return n && n->token == F_CONSTANT &&    n->u.sval.subtype == FUNCTION_BUILTIN &&    n->u.sval.u.efun->function == fun;   }    - static void code_expression(node *n, INT16 flags, char *err) + static void code_expression(node *n, int flags, char *err)   { -  switch(do_docode(check_node_hash(n), (INT16)(flags & ~DO_POP))) +  switch(do_docode(check_node_hash(n), flags & ~DO_POP))    {    case 0: my_yyerror("Void expression for %s",err);    case 1: return;    case 2:    Pike_fatal("Internal compiler error (%s), line %ld, file %s\n",    err,    (long)lex.current_line,    lex.current_file?lex.current_file->str:"Unknown");    }   }
pike.git/src/docode.c:355:       case F_APPLY:    if(!is_efun(CAR(n), f_not)) break;       case F_NOT:    if(!(flags & DO_POP)) break;    do_cond_jump(CDR(n), label , !iftrue, flags | DO_NOT_COPY);    return;    }    -  code_expression(n, (INT16)(flags | DO_NOT_COPY), "condition"); +  code_expression(n, flags | DO_NOT_COPY, "condition");       if(flags & DO_POP)    {    if(iftrue)    do_jump(F_BRANCH_WHEN_NON_ZERO, label);    else    do_jump(F_BRANCH_WHEN_ZERO, label);    current_stack_depth--;    }else{    if(iftrue)
pike.git/src/docode.c:530:    emit1(F_APPLY, DO_NOT_WARN((INT32)tmp1));    break;       default:    my_yyerror("docode: Failed to make call to %s",func);    }    free_node(n);   }      static int do_encode_automap_arg_list(node *n, -  INT16 flags) +  int flags)   {    int stack_depth_save = current_stack_depth;    if(!n) return 0;    switch(n->token)    {    default:    return do_docode(n, flags);       case F_ARG_LIST:    {
pike.git/src/docode.c:589:    n->name);    emit1(F_CONSTANT, DO_NOT_WARN((INT32)tmp1));    break;       default:    my_yyerror("docode: Failed to make svalue for builtin %s",func);    }    free_node(n);   }    - static int do_docode2(node *n, INT16 flags) + static int do_docode2(node *n, int flags)   {    ptrdiff_t tmp1,tmp2,tmp3;       if(!n) return 0;       if(flags & DO_LVALUE)    {    switch(n->token)    {    default:
pike.git/src/docode.c:1562:    n->parent = NULL;    tmp1 = 0;    next_car:    while (CAR(n) &&    ((CAR(n)->token == F_ARG_LIST) ||    (CAR(n)->token == F_COMMA_EXPR))) {    CAR(n)->parent = n;    n = CAR(n);    }    /* CAR(n) is not F_ARG_LIST or F_COMMA_EXPR */ -  tmp1 += do_docode(CAR(n), (INT16)(flags & ~WANT_LVALUE)); +  tmp1 += do_docode(CAR(n), flags & ~WANT_LVALUE);       do {    if (CDR(n)) {    if ((CDR(n)->token == F_ARG_LIST) ||    (CDR(n)->token == F_COMMA_EXPR)) {    /* Note: Parent points to the closest preceding CAR node    * on the way to the root.    */    CDR(n)->parent = n->parent;    n = CDR(n);    goto next_car;    }    /* CDR(n) is not F_ARG_LIST or F_COMMA_EXPR */    if (n->parent) { -  tmp1 += do_docode(CDR(n), (INT16)(flags & ~WANT_LVALUE)); +  tmp1 += do_docode(CDR(n), flags & ~WANT_LVALUE);    } else {    tmp1 += do_docode(CDR(n), flags);    }    }    /* Retrace */    /* Note: n->parent is always a visited CAR node on the    * way to the root.    */    n = n->parent;    } while (n);
pike.git/src/docode.c:1996:    emit0(F_COPY_VALUE);    }    }    return DO_NOT_WARN((INT32)tmp1);       case F_INDEX:    if(flags & WANT_LVALUE)    {    int mklval=CAR(n) && match_types(CAR(n)->type, string_type_string);    tmp1 = do_docode(CAR(n), -  (INT16)(mklval ? DO_LVALUE_IF_POSSIBLE : 0)); +  mklval ? DO_LVALUE_IF_POSSIBLE : 0);    if(tmp1==2)    {   #ifdef PIKE_DEBUG    if(!mklval)    Pike_fatal("Unwanted lvalue!\n");   #endif    emit0(F_INDIRECT);    }       if(do_docode(CDR(n),0) != 1)
pike.git/src/docode.c:2219:    return 2;    }else{    emit1(F_GLOBAL,n->u.id.number);    }    }    return 1;    }       case F_VAL_LVAL:    return do_docode(CAR(n),flags) + -  do_docode(CDR(n), (INT16)(flags | DO_LVALUE)); +  do_docode(CDR(n), flags | DO_LVALUE);       case F_AUTO_MAP:    emit0(F_MARK);    code_expression(CAR(n), 0, "automap function");    do_encode_automap_arg_list(CDR(n),0);    emit_apply_builtin("__automap__");    return 1;       case F_AUTO_MAP_MARKER:    yyerror("[*] not supported here.\n");