int main(int argc, char **argv) { /* * The following #if block allows you to change the AppInit function by * using a #define of TCL_LOCAL_APPINIT instead of rewriting this entire * file. The #if checks for that #define and uses Tcl_AppInit if it * doesn't exist. */ #ifndef TK_LOCAL_APPINIT #define TK_LOCAL_APPINIT Tcl_AppInit #endif extern int TK_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp)); /* * The following #if block allows you to change how Tcl finds the startup * script, prime the library or encoding paths, fiddle with the argv, * etc., without needing to rewrite Tk_Main() */ #ifdef TK_LOCAL_MAIN_HOOK extern int TK_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv)); TK_LOCAL_MAIN_HOOK(&argc, &argv); #endif #ifdef BWISH Tk_Main(argc, argv, TK_LOCAL_APPINIT); #else Tcl_Main(argc, argv, TK_LOCAL_APPINIT); #endif return 0; /* Needed only to prevent compiler warning. */ }
int main(int argc, char **argv) { #ifdef EFENCE extern int EF_ALLOW_MALLOC_0; EF_ALLOW_MALLOC_0 = 1; #endif mpi_init(&argc, &argv); /* register handler for SIGINT */ signal(SIGINT, sigint_handler); if (this_node == 0) { /* master node */ #ifdef FORCE_CORE /* core should be the last exit handler (process dies) */ atexit(core); #endif atexit(mpi_stop); #ifdef TK Tk_Main(argc, argv, appinit); #else Tcl_Main(argc, argv, appinit); #endif } else { /* slave node */ on_program_start(0); mpi_loop(); } return 0; }
int main( int argc, char *argv[]) { char *p; /* * Set up the default locale to be standard "C" locale so parsing is * performed correctly. */ setlocale(LC_ALL, "C"); /* * Forward slashes substituted for backslashes. */ for (p = argv[0]; *p != '\0'; p++) { if (*p == '\\') { *p = '/'; } } #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ }
int main( int argc, /* Number of command-line arguments. */ char *argv[]) /* Values of command-line arguments. */ { Tcl_Main(argc, argv, Tcl_AppInit); return 0; /* Needed only to prevent compiler warning. */ }
int TCLSH_MAIN(int argc, char **argv){ #ifndef TCL_THREADS Tcl_Interp *interp; Tcl_FindExecutable(argv[0]); interp = Tcl_CreateInterp(); Libsqlite_Init(interp); if( argc>=2 ){ int i; Tcl_SetVar(interp,"argv0",argv[1],TCL_GLOBAL_ONLY); Tcl_SetVar(interp,"argv", "", TCL_GLOBAL_ONLY); for(i=2; i<argc; i++){ Tcl_SetVar(interp, "argv", argv[i], TCL_GLOBAL_ONLY | TCL_LIST_ELEMENT | TCL_APPEND_VALUE); } if( Tcl_EvalFile(interp, argv[1])!=TCL_OK ){ const char *zInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY); if( zInfo==0 ) zInfo = interp->result; fprintf(stderr,"%s: %s\n", *argv, zInfo); return TCL_ERROR; } }else{ Tcl_GlobalEval(interp, zMainloop); } return 0; #else Tcl_Main(argc, argv, Libsqlite_Init); #endif /* TCL_THREADS */ return 0; }
/* * NAME: main() * DESCRIPTION: program entry */ int main(int argc, char *argv[]) { suid_init(); Tcl_Main(argc, argv, Tcl_AppInit); return 0; /* not reached */ }
int main( int argc, char *argv[]) { /* * The following #if block allows you to change the AppInit function by * using a #define of TCL_LOCAL_APPINIT instead of rewriting this entire * file. The #if checks for that #define and uses Tcl_AppInit if it * doesn't exist. */ #ifndef TCL_LOCAL_APPINIT #define TCL_LOCAL_APPINIT Tcl_AppInit #endif extern int TCL_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp)); /* * The following #if block allows you to change how Tcl finds the startup * script, prime the library or encoding paths, fiddle with the argv, * etc., without needing to rewrite Tcl_Main() */ #ifdef TCL_LOCAL_MAIN_HOOK extern int TCL_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv)); #endif char *p; /* * Set up the default locale to be standard "C" locale so parsing is * performed correctly. */ #if defined(__GNUC__) setargv( &argc, &argv ); #endif setlocale(LC_ALL, "C"); /* * Forward slashes substituted for backslashes. */ for (p = argv[0]; *p != '\0'; p++) { if (*p == '\\') { *p = '/'; } } #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ }
int main(int argc, char *argv[]) { Tcl_Interp *tcl; Tcl_FindExecutable(argv[0]); tcl = Tcl_CreateInterp(); if(TCL_OK != Tcl_Init(tcl)) { std::cerr << "error: " << "Could not initialize TCL interpreter." << std::endl; exit(EXIT_FAILURE); } Tcl_Main(argc, argv, Tcl_AppInit); return EXIT_SUCCESS; }
void main( int argc, /* Number of arguments. */ char **argv) /* Array of argument strings. */ { char *newArgv[2]; if (MacintoshInit() != TCL_OK) { Tcl_Exit(1); } argc = 1; newArgv[0] = "tclsh"; newArgv[1] = NULL; Tcl_Main(argc, newArgv, Tcl_AppInit); }
int main( int argc, /* Number of command-line arguments. */ char **argv) /* Values of command-line arguments. */ { #ifdef TCL_XT_TEST XtToolkitInitialize(); #endif #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ }
int main( int argc, char *dummy[]) { TCHAR **argv; #else int _tmain( int argc, TCHAR *argv[]) { #endif TCHAR *p; /* * Set up the default locale to be standard "C" locale so parsing is * performed correctly. */ setlocale(LC_ALL, "C"); #ifdef TCL_BROKEN_MAINARGS /* * Get our args from the c-runtime. Ignore lpszCmdLine. */ setargv(&argc, &argv); #endif /* * Forward slashes substituted for backslashes. */ for (p = argv[0]; *p != TEXT('\0'); p++) { if (*p == TEXT('\\')) { *p = TEXT('/'); } } #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ }
int main( int argc, /* Number of command-line arguments. */ char *dummy[]) /* Not used. */ { TCHAR **argv; #else int _tmain( int argc, /* Number of command-line arguments. */ TCHAR *argv[]) /* Values of command-line arguments. */ { #endif TCHAR *p; /* * Set up the default locale to be standard "C" locale so parsing is * performed correctly. */ setlocale(LC_ALL, "C"); #ifdef TCL_BROKEN_MAINARGS /* * Get our args from the c-runtime. Ignore command line. */ setargv(&argc, &argv); #endif /* * Forward slashes substituted for backslashes. */ for (p = argv[0]; *p != '\0'; p++) { if (*p == '\\') { *p = '/'; } } #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ }
_tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszCmdLine, int nCmdShow) #endif { TCHAR **argv; int argc; TCHAR *p; /* * Set up the default locale to be standard "C" locale so parsing is * performed correctly. */ setlocale(LC_ALL, "C"); /* * Get our args from the c-runtime. Ignore lpszCmdLine. */ #if defined(TCL_BROKEN_MAINARGS) setargv(&argc, &argv); #else argc = __argc; argv = __targv; #endif /* * Forward slashes substituted for backslashes. */ for (p = argv[0]; *p != '\0'; p++) { if (*p == '\\') { *p = '/'; } } Tcl_FindExecutable(argv[0]); Tcl_SetStartupScript(Tcl_NewStringObj("/zvfs/main.tcl",-1),NULL); Tcl_Main(argc, argv, Toadkit_AppInit); return 0; /* Needed only to prevent compiler warning. */ }
extern "C" void tclmn_(char *arg1) { char cmdline[256]; char *argv[2]; int idx; strcpy(cmdline, "hqpmin"); cmdline[6] = ' '; idx = 0; while (arg1[idx] != ' ' && idx < 248) { cmdline[7 + idx] = arg1[idx]; idx++; } cmdline[7 + idx] = '\0'; argv[0] = cmdline; argv[1] = cmdline + 7; Tcl_Main(2, argv, Tcl_AppInit); }
int main( int argc, /* Number of command-line arguments. */ char **argv) /* Values of command-line arguments. */ { /* * The following #if block allows you to change the AppInit function by * using a #define of TCL_LOCAL_APPINIT instead of rewriting this entire * file. The #if checks for that #define and uses Tcl_AppInit if it does * not exist. */ #ifndef TCL_LOCAL_APPINIT #define TCL_LOCAL_APPINIT Tcl_AppInit #endif extern int TCL_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp)); /* * The following #if block allows you to change how Tcl finds the startup * script, prime the library or encoding paths, fiddle with the argv, * etc., without needing to rewrite Tcl_Main() */ #ifdef TCL_LOCAL_MAIN_HOOK extern int TCL_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv)); #endif #ifdef TCL_XT_TEST XtToolkitInitialize(); #endif #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ }
int pbsTcl_Init( Tcl_Interp *interp) /* Interpreter for application. */ { if (Tcl_Init(interp) == TCL_ERROR) return TCL_ERROR; #if TCLX #if TCL_MINOR_VERSION < 5 && TCL_MAJOR_VERSION < 8 if (TclX_Init(interp) == TCL_ERROR) { #else if (Tclx_Init(interp) == TCL_ERROR) { #endif return TCL_ERROR; } #endif /* TCLX */ #ifndef __cplusplus fullresp(0); #endif add_cmds(interp); Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY); return TCL_OK; } int main(int argc, char *argv[]) { chk_file_sec_stderr = 1; Tcl_Main(argc, argv, pbsTcl_Init); return 0; } /* END main() */
int main(int argc, char **argv) { /* first thing to do: fire up MPI */ mpi_init(&argc, &argv); on_program_start(); if (this_node == 0) { /* master node */ #ifdef TK Tk_Main(argc, argv, tcl_appinit); #else Tcl_Main(argc, argv, tcl_appinit); #endif } else { /* slave node */ mpi_loop(); } return 0; }
int main(int argc, char *argv[]) { Tcl_Main(argc, argv, Psfgen_Init); return 0; }
void realmain(int argc, char **argv) { char b[256]; struct stat statbuf; /* vars from oldmain */ buffer *buf = NULL; char path[1024]; int i; setlocale(LC_NUMERIC, "C"); common_init("Egon Animator %s. No Warranty"); sprintf(b, "%s/%ld", siag_basedir, (long)getpid()); mkdir(b, 0700); sprintf(b, "%s/egon.scm", siag_basedir); egonrc = MwStrdup(b); init_interpreters(); siod_interpreter = init_parser(argc, argv); init_python_parser(); init_guile_parser(); init_ruby_parser(); waitforchild(0); init_position(); init_cmds(); buf = new_buffer("noname.egon", "noname.egon"); sprintf(path, "%s/egon/egon.scm", datadir); if (stat(path, &statbuf)) { fprintf(stderr, "Can't find the runtime library (egon.scm).\n"); fprintf(stderr, "Expected it in %s\n", path); fprintf(stderr, "SIAGHOME (if set) is '%s'\n", datadir); fprintf(stderr, "Please read installation instructions.\n"); exit(EXIT_FAILURE); } setvar(cintern("libdir"), strcons(-1, libdir), NIL); setvar(cintern("datadir"), strcons(-1, datadir), NIL); setvar(cintern("docdir"), strcons(-1, docdir), NIL); /* load runtime library */ sprintf(b, "(load \"%s/egon/egon.scm\")", datadir); execute(b); init_windows(buf, &argc, argv); setlocale(LC_NUMERIC, "C"); /* possibly hosed by X */ /* load user customizations, if any */ if (!stat(egonrc, &statbuf)) { sprintf(b, "(load \"%s\")", egonrc); execute(b); } execute("(init-windows)"); execute("(create-menus)"); fileio_init(); for (i = 1; i < argc; i++) { if (argv[i][0] != '-') { strcpy(path, argv[i]); free_buffer(w_list->buf); buf = new_buffer(buffer_name(argv[i]), path); loadmatrix(path, buf, guess_file_format(path)); buf->change = FALSE; w_list->buf = buf; } } pr_scr_flag = TRUE; execute("(popup-editor)"); /* this works, for reasons beyond my comprehension */ execute("(print-version)"); execute("(print-version)"); activate_window(w_list); #ifdef HAVE_LIBTCL Tcl_Main(argc, argv, Tcl_AppInit); #else mainloop(); #endif }
/** * @brief * main - the entry point in pbsTclInit.c * * @param[in] argc - argument count. * @param[in] argv - argument variables. * * @return int * @retval 0 : success */ int main(int argc, char *argv[]) { char tcl_libpath[MAXPATHLEN+13]; /* 13 for "TCL_LIBRARY=" + \0 */ int rc; /*the real deal or just pbs_version and exit?*/ execution_mode(argc, argv); if(set_msgdaemonname("pbs_tclsh")) { fprintf(stderr, "Out of memory\n"); return 1; } set_logfile(stderr); #ifdef WIN32 winsock_init(); Tcl_FindExecutable(argv[0]); #endif /* load the pbs conf file */ if (pbs_loadconf(0) == 0) { fprintf(stderr, "%s: Configuration error\n", argv[0]); return (1); } if (!getenv("TCL_LIBRARY")) { if (pbs_conf.pbs_exec_path) { sprintf((char *)tcl_libpath, #ifdef WIN32 "TCL_LIBRARY=%s/lib/tcl%s", #else "TCL_LIBRARY=%s/tcltk/lib/tcl%s", #endif pbs_conf.pbs_exec_path, TCL_VERSION); putenv(tcl_libpath); } } if (pbs_conf.pbs_use_tcp == 1) { char *nodename; struct tpp_config tpp_conf; char my_hostname[PBS_MAXHOSTNAME+1]; fd_set selset; struct timeval tv; if (pbs_conf.pbs_leaf_name) nodename = pbs_conf.pbs_leaf_name; else { if (gethostname(my_hostname, (sizeof(my_hostname) - 1)) < 0) { fprintf(stderr, "Failed to get hostname\n"); return -1; } nodename = my_hostname; } /* We don't want to show logs related to connecting pbs_comm on console * this set this flag to ignore it */ log_mask = SHOW_NONE; /* set tpp function pointers */ set_tpp_funcs(log_tppmsg); /* call tpp_init */ rc = 0; #ifndef WIN32 if (pbs_conf.auth_method == AUTH_MUNGE) rc = set_tpp_config(&pbs_conf, &tpp_conf, nodename, -1, pbs_conf.pbs_leaf_routers, pbs_conf.pbs_use_compression, TPP_AUTH_EXTERNAL, get_ext_auth_data, validate_ext_auth_data); else #endif rc = set_tpp_config(&pbs_conf, &tpp_conf, nodename, -1, pbs_conf.pbs_leaf_routers, pbs_conf.pbs_use_compression, TPP_AUTH_RESV_PORT, NULL, NULL); if (rc == -1) { fprintf(stderr, "Error setting TPP config\n"); return -1; } if ((rpp_fd = tpp_init(&tpp_conf)) == -1) { fprintf(stderr, "rpp_init failed\n"); return -1; } /* * Wait for net to get restored, ie, app to connect to routers */ FD_ZERO(&selset); FD_SET(rpp_fd, &selset); tv.tv_sec = 5; tv.tv_usec = 0; select(FD_SETSIZE, &selset, (fd_set *) 0, (fd_set *) 0, &tv); rpp_poll(); /* to clear off the read notification */ /* Once the connection is established we can unset log_mask */ log_mask &= ~SHOW_NONE; } else { /* set rpp function pointers */ set_rpp_funcs(log_rppfail); } Tcl_Main(argc, argv, pbsTcl_Init); return 0; }
int main(int argc, char **argv){ Tcl_Main(argc, argv, Tcl_AppInit); return 0; }
int main(int argc, char** argv) { char ecosynth_tcl_path[_POSIX_PATH_MAX]; char** new_argv; int i; parent_pid = getppid(); // The various core Tcl scripts are installed in the same // directory as ecosynth. The Tcl script itself will check whether // there is a newer version of itself in the source tree and // switch to that instead. assert((strlen(LIBEXECDIR) + strlen(PACKAGE_INSTALL) + 20) < _POSIX_PATH_MAX); strcpy(ecosynth_tcl_path, LIBEXECDIR); strcat(ecosynth_tcl_path, "/ecos/"); strcat(ecosynth_tcl_path, PACKAGE_INSTALL); strcat(ecosynth_tcl_path, "/ecosynth.tcl"); // Installation sanity checks. if (0 != access(ecosynth_tcl_path, F_OK)) { fprintf(stderr, PROGNAME ": error, a required Tcl script has not been installed.\n"); fprintf(stderr, " The script is \"%s\"\n", ecosynth_tcl_path); exit(EXIT_FAILURE); } if (0 != access(ecosynth_tcl_path, R_OK)) { fprintf(stderr, PROGNAME ": error, no read access to a required Tcl script.\n"); fprintf(stderr, " The script is \"%s\"\n", ecosynth_tcl_path); exit(EXIT_FAILURE); } // Look for options -nw and -w. This information is needed by the appinit() routine. no_windows = 0; for (i = 1; i < argc; i++) { if ((0 == strcmp("-nw", argv[i])) || (0 == strcmp("--nw", argv[i])) || (0 == strcmp("-no-windows", argv[i])) || (0 == strcmp("--no-windows", argv[i]))) { no_windows = 1; } else if ((0 == strcmp("-w", argv[i])) || (0 == strcmp("--w", argv[i])) || (0 == strcmp("-windows", argv[i])) || (0 == strcmp("--windows", argv[i]))) { no_windows = 0; } } new_argv = malloc((argc+2) * sizeof(char*)); if (NULL == new_argv) { fprintf(stderr, PROGNAME ": internal error, out of memory.\n"); exit(EXIT_FAILURE); } new_argv[0] = argv[0]; new_argv[1] = ecosynth_tcl_path; for (i = 1; i < argc; i++) { new_argv[i+1] = argv[i]; } new_argv[i+1] = NULL; // Ignore SIGINT requests. Those can happen if e.g. the application is // ctrl-C'd or if a gdb session is interrupted because this process is // a child of the eCos application. Instead the normal code for handling // application termination needs to run. signal(SIGINT, SIG_IGN); // Similarly ignore SIGTSTP if running in graphical mode, it would // be inappropriate for the GUI to freeze if the eCos application is // suspended. If running in text mode then it is better for both // the application and the I/O auxiliary to freeze, halting any further // output. if (!no_windows) { signal(SIGTSTP, SIG_IGN); } Tcl_Main(argc+1, new_argv, &ecosynth_appinit); return EXIT_SUCCESS; }
int main(int argc, char *argv[]) { Tcl_Main(argc,argv,AppInit); //Tk_Main(argc,argv,AppInit); return 0; }