Beispiel #1
0
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] = "Wish";
    newArgv[1] = NULL;
    
    /* Tk_Main is actually #defined to 
     *     Tk_MainEx(argc, argv, Tcl_AppInit, Tcl_CreateInterp())
     * Unfortunately, you also HAVE to call Tcl_FindExecutable
     * BEFORE creating the first interp, or the tcl_library will not
     * get set properly.  So we call it by hand here...
     */
    
    Tcl_FindExecutable(newArgv[0]);
    Tk_Main(argc, newArgv, Tcl_AppInit);
}
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;
}
Beispiel #4
0
void Tk_MainThread ( int argc, char **argv )
{
    char *p;
    Tcl_SetPanicProc(WishPanic);

    /*
     * 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 TK_LOCAL_MAIN_HOOK
    TK_LOCAL_MAIN_HOOK(&argc, &argv);
#endif
    Tk_Main(argc, argv, Tcl_AppInit);
}
Beispiel #5
0
int
main(
    int argc,			/* Number of command-line arguments. */
    char **argv)		/* Values of command-line arguments. */
{
#ifdef TK_LOCAL_MAIN_HOOK
    TK_LOCAL_MAIN_HOOK(&argc, &argv);
#endif

    Tk_Main(argc, argv, TK_LOCAL_APPINIT);
    return 0;			/* Needed only to prevent compiler warning. */
}
Beispiel #6
0
int APIENTRY
WinMain(HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPSTR lpszCmdLine,
	int nCmdShow)
{
    char **argv;
    int argc;
    char *p;

    Tcl_SetPanicProc(BwishPanic);

    /*
     * Create the console channels and install them as the standard channels.
     * All I/O will be discarded until Tk_CreateConsoleWindow is called to
     * attach the console to a text widget.
     */

    consoleRequired = TRUE;

    /*
     * 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.
     */

    argc = __argc;
    argv = __argv;

    /*
     * Forward slashes substituted for backslashes.
     */

    for (p = argv[0]; *p != '\0'; p++) {
	if (*p == '\\') {
	    *p = '/';
	}
    }

    bu_setprogname(argv[0]);

#ifdef TK_LOCAL_MAIN_HOOK
    TK_LOCAL_MAIN_HOOK(&argc, &argv);
#endif

    Tk_Main(argc, argv, TK_LOCAL_APPINIT);
    return 1;
}
Beispiel #7
0
// InitTclTk:
//	     does Tcl/Tk setup,
//	     hands over	control	to a TK	Mainloop,
//	    
void animTcl::InitTclTk(int argc, char	**argv)
{

	if (FALSE)
	{
		UsingTk	= FALSE	;
		Tcl_Main _ANSI_ARGS_(argc, argv, Tcl_AppInit);
	}
	else
	{
		UsingTk	= TRUE ;
		Tk_Main (argc, argv, (Tcl_AppInitProc*) Tcl_AppInit);
	}

}
Beispiel #8
0
void
main( int argc, char **argv)
{
    char *newArgv[2];
	
    if (MacintoshInit()  != TCL_OK) {
    Tcl_Exit(1);
    }

    argc = 1;
    newArgv[0] = "TclKit";
    newArgv[1] = NULL;
    
    Tcl_FindExecutable(newArgv[0]);
	
    Tk_Main(argc, newArgv, TclKit_AppInit);
}
Beispiel #9
0
int main(int argc, char *argv[])
{
    ATerm bottomOfStack;

    ATBinit(argc, argv, &bottomOfStack);

    handle_args(argc, argv);

#ifdef USE_TIDE
    init_tide_support(argc, argv);
#endif

    signals_set();

    Tk_Main(argc, argv, Tcl_AppInit);
    return 0;	/* Prevent compiler warning */
}
Beispiel #10
0
static void start_panel(void)
{
	char *argv[128];
	int argc;

	argc = 0;
	argv[argc++] = "-f";
	argv[argc++] = TKPROGPATH;

	if (ctl.trace_playing) {
		argv[argc++] = "-mode";
		argv[argc++] = "trace";
	}

	/* call Tk main routine */
	Tk_Main(argc, argv, AppInit);

	exit(0);
}
Beispiel #11
0
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;
}
Beispiel #12
0
int
main(
    int argc,
    char **argv)
{
    Tcl_SetPanicProc(WishPanic);

    /*
     * Set up the default locale to be standard "C" locale so parsing is
     * performed correctly.
     */

    setlocale(LC_ALL, "C");

    /*
     * Console emulation widget not required as this entry is from the
     * console subsystem, thus stdin,out,err already have end-points.
     */

    consoleRequired = FALSE;

    Tk_Main(argc, argv, Tcl_AppInit);
    return 0;
}
Beispiel #13
0
/* 
 * sim_main - main simulator routine. This function is called from the
 * main() routine in the HCL file.
 */
int sim_main(int argc, char **argv)
{
    int i;
    char c;
    char *myargv[MAXARGS];

    
    /* Parse the command line arguments */
    while ((c = getopt(argc, argv, "htgl:v:")) != -1) {
	switch(c) {
	case 'h':
	    usage(argv[0]);
	    break;
	case 'l':
	    instr_limit = atoi(optarg);
	    break;
	case 'v':
	    verbosity = atoi(optarg);
	    if (verbosity < 0 || verbosity > 2) {
		printf("Invalid verbosity %d\n", verbosity);
		usage(argv[0]);
	    }
	    break;
	case 't':
	    do_check = TRUE;
	    break;
	case 'g':
	    gui_mode = TRUE;
	    break;
	default:
	    printf("Invalid option '%c'\n", c);
	    usage(argv[0]);
	    break;
	}
    }


    /* Do we have too many arguments? */
    if (optind < argc - 1) {
	printf("Too many command line arguments:");
	for (i = optind; i < argc; i++)
	    printf(" %s", argv[i]);
	printf("\n");
	usage(argv[0]);
    }


    /* The single unflagged argument should be the object file name */
    object_filename = NULL;
    object_file = NULL;
    if (optind < argc) {
	object_filename = argv[optind];
	object_file = fopen(object_filename, "r");
	if (!object_file) {
	    fprintf(stderr, "Couldn't open object file %s\n", object_filename);
	    exit(1);
	}
    }


    /* Run the simulator in GUI mode (-g flag) */
    if (gui_mode) {

#ifndef HAS_GUI
	printf("To run in GUI mode, you must recompile with the HAS_GUI constant defined.\n");
	exit(1);
#endif// HAS_GUI

	/* In GUI mode, we must specify the object file on command line */ 
	if (!object_file) {
	    printf("Missing object file argument in GUI mode\n");
	    usage(argv[0]);
	}

	/* Build the command line for the GUI simulator */
	for (i = 0; i < TKARGS; i++) {
	    if ((myargv[i] = malloc(MAXBUF*sizeof(char))) == NULL) {
		perror("malloc error");
		exit(1);
	    }
	}
	strcpy(myargv[0], argv[0]);
	if (plusmode == 0) /* SEQ */
	    strcpy(myargv[1], "seq.tcl");
	else
	    strcpy(myargv[1], "seq+.tcl");
	strcpy(myargv[2], object_filename);
	myargv[3] = NULL;

	/* Start the GUI simulator */
#ifdef HAS_GUI
	Tk_Main(TKARGS, myargv, Tcl_AppInit);
#endif// HAS_GUI
	exit(0);
    }

    /* Otherwise, run the simulator in TTY mode (no -g flag) */
    run_tty_sim();

    exit(0);
}
Beispiel #14
0
int main( int argc, char *argv[] )
{
   Tk_Main( argc, argv, my_init );
   return 0;
}