pike.git / src / main.c

version» Context lines:

pike.git/src/main.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: main.c,v 1.220 2005/01/01 13:42:16 grubba Exp $ + || $Id: main.c,v 1.221 2005/01/01 14:35:45 grubba Exp $   */      #include "global.h"   #include "fdlib.h"   #include "backend.h"   #include "module.h"   #include "object.h"   #include "lex.h"   #include "pike_types.h"   #include "builtin_functions.h"
pike.git/src/main.c:255:      PMOD_EXPORT struct callback *add_post_master_callback(callback_func call,    void *arg,    callback_func free_func)   {    return add_to_callback(&post_master_callbacks, call, arg, free_func);   }          - #ifdef __amigaos4__ - #define timeval timeval_amigaos - #include <exec/types.h> - #include <utility/hooks.h> - #include <dos/dosextens.h> - #include <proto/dos.h> +     - static SAVEDS LONG scan_amigaos_environment_func(struct Hook *REG(a0,hook), -  APTR REG(a2,userdata), -  struct ScanVarsMsg *REG(a1,msg)) - { -  if(msg->sv_GDir[0] == '\0' || -  !strcmp(msg->sv_GDir, "ENV:")) { -  push_text(msg->sv_Name); -  push_constant_text("="); -  push_string(make_shared_binary_string(msg->sv_Var, msg->sv_VarLen)); -  f_add(3); -  } -  -  return 0; - } -  - static struct Hook scan_amigaos_environment_hook = { -  { NULL, NULL }, -  (ULONG (*)())scan_amigaos_environment_func, -  NULL, NULL - }; - #endif /* __amigsos4__ */ -  +    int main(int argc, char **argv)   {    JMP_BUF back;    int e, num;    char *p;    struct array *a; - #ifdef DECLARE_ENVIRON -  extern char **environ; - #endif +        TRACE((stderr, "Init master...\n"));       find_lib_dir(argc, argv);      #ifdef LIBPIKE    if (!dlinit()) {    fprintf(stderr, "dlinit failed.\n");    exit(1);    }
pike.git/src/main.c:551:    default:    p+=strlen(p);    }    }    }else{    break;    }    }      #ifndef PIKE_MUTEX_ERRORCHECK -  if (debug_options & ERRORCHECK_MUTEXES) +  if (set_pike_debug_options(0,0) & ERRORCHECK_MUTEXES)    fputs ("Warning: -dT (error checking mutexes) not supported on this system.\n",    stderr);   #endif -  if (d_flag) debug_options |= ERRORCHECK_MUTEXES; +  if (d_flag) +  set_pike_debug_options(ERRORCHECK_MUTEXES, ERRORCHECK_MUTEXES);       init_pike_runtime(exit);       /* NOTE: Reuse master_location here to avoid duplicates of    * the MASTER_COOKIE string in the binary.    */    add_pike_string_constant("__master_cookie",    master_location, CONSTANT_STRLEN(MASTER_COOKIE));       if(SETJMP(back))
pike.git/src/main.c:613:    back.severity=THROW_EXIT;       TRACE((stderr, "Init master...\n"));       master();    call_callback(& post_master_callbacks, 0);    free_callback_list(& post_master_callbacks);       TRACE((stderr, "Call master->_main()...\n"));    -  a=allocate_array_no_init(argc,0); -  for(num=0;num<argc;num++) -  { -  ITEM(a)[num].u.string=make_shared_string(argv[num]); -  ITEM(a)[num].type=T_STRING; -  } -  a->type_field = BIT_STRING; -  push_array(a); +  pike_push_argv(argc, argv);    - #ifdef __amigaos__ - #ifdef __amigaos4__ -  if(DOSBase->lib_Version >= 50) { -  struct svalue *mark = Pike_sp; -  IDOS->ScanVars(&scan_amigaos_environment_hook, -  GVF_BINARY_VAR|GVF_DONT_NULL_TERM, -  NULL); -  f_aggregate(Pike_sp-mark); -  } else - #endif -  push_array(allocate_array_no_init(0,0)); - #else -  for(num=0;environ[num];num++); -  a=allocate_array_no_init(num,0); -  for(num=0;environ[num];num++) -  { -  ITEM(a)[num].u.string=make_shared_string(environ[num]); -  ITEM(a)[num].type=T_STRING; -  } -  a->type_field = BIT_STRING; -  push_array(a); - #endif +  pike_push_env();       apply(master(),"_main",2);    pop_stack();    num=0;    }    UNSETJMP(back);       TRACE((stderr, "Exit %d...\n", num));       pike_do_exit(num);    return num; /* avoid warning */   }