Пример #1
0
void
wmCreate()
{
    /* ShowWindow(pfcHMainWnd(), SW_SHOWMINNOACTIVE);	*/ /* Show as icon */
    tmpDir = osGetEnv("TMP");
    if (tmpDir == NULL)
            tmpDir = osGetEnv("TEMP");

    if (tmpDir == NULL)
            pfcFatalError("You need to set TMP or TEMP environment variable");
            
#if 1 /* WINAXL_DEBUG*/
    pfcMessageBox("Using debug version");  
    PostMessage(pfcHMainWnd(), wm_Compiler_Start, 0, (LPARAM)pfcHMainWnd());
#endif /* WINAXL_DEBUG */   
}
Пример #2
0
void init_interpreter(int argc, char** argv) {
    /*Bool echo;*/

    osInit();
    osObtainLicense();

    // /*echo =*/ cmdSubsumeResponseFiles(1, &argc, &argv);

    if (cmdHasRootOption(argc, argv))
        compRootDir = cmdOptionArg;
    if (!compRootDir)
        compRootDir = strCopyIf(osGetEnv("ALDORROOT"));
    //if (!compRootDir)
    //    compRootDir = compRootFromCmdLine(osCurDirName(), argv[0]);

    if (cmdHasCfgFileOption(argc, argv))
        compCfgSetConfigFile(cmdOptionArg);
    if (cmdHasCfgNameOption(argc, argv))
        compCfgSetSysName(cmdOptionArg);

    if (cmdHasDebugOption(argc, argv))
        compIsDebug = true;

    fintMode = FINT_LOOP;
    emitSetInterp(false);
    emitSetRun(false);
    comsgSetInteractiveOption();

    compGLoopInit(argc, argv, osStdout, &fn, &finfo);
}
Пример #3
0
static void
subsumeImplicitArgs(int oargc, char **oargv, int *pargc, char ***pargv)
{
	char **largv, **argv;
	char *env_args;
	char **targv;
	int largc, argc;
	int i;
	largc = 0;
	largv = NULL;

	env_args = osGetEnv("UNICL");
	
	if (env_args) {
		cstrParseUnquoted(env_args, &largc, &largv);
	}
	
	targv = largv;
	argc = largc + oargc;
	argv = (char **) stoAlloc(OB_Other, argc * sizeof(char *));
	argv[0] = oargv[0];
	for (i=0; i<largc; i++) argv[i+1] = targv[i];
	for (i=1; i<oargc; i++) argv[i + largc] = oargv[i];

	*pargc = argc;	
	*pargv = argv;
}
Пример #4
0
String
osTmpDirName (void)
{
	String td;

	/*
	 * Don't need to copy td, since ON THIS PLATFORM the result of
	 * osGetEnv is non-volatile.
	 */
	td = osGetEnv("TEMP");
	if (td) return td;

	td = osGetEnv("TMP");
	if (td) return td;

	td = osGetEnv("TMPDIR");
	if (td) return td;

	return osCurDirName();
}
Пример #5
0
/*
 * Select and call one of the compXxxxLoop entry points below.
 */
int
compCmd(int argc, char **argv)
{
	Bool	echo;

	osInit();
	osObtainLicense();

	echo = cmdSubsumeResponseFiles(1, &argc, &argv);

	/* Display the version string in all its glory */
	if (cmdHasVerboseOption(argc, argv)) {
		fprintf(osStdout, "%s version %d.%d.%d",
			verName,
			verMajorVersion,
			verMinorVersion,
			verMinorFreeze);
		if (*verPatchLevel)
			fprintf(osStdout, "(%s)", verPatchLevel);
		fprintf(osStdout, " for %s %s\n", CONFIG, DEBUG_CONFIG);
		if (echo) cmdEcho(osStdout, argc, argv);
	}

	/*
	 * Record desire for garbage collection.
	 */
	/* Don't set compDoGcVerbose if -V seen */
	compDoGcFile    = cmdHasGcFileOption(argc, argv) ||
			  cmdHasInteractiveOption(argc, argv); 


	/* Garbage collection is now on by default */
	if (cmdHasNoGcOption(argc, argv))
	{
		/* Can't have -Wgc and -Wno-gc */
		if (cmdHasGcOption(argc, argv))
		{
			(void)fprintf(osStdout,
				"You may not specify both `%s' and `%s': %s.\n",
				"-Wgc", "-no-gc", "ignoring -Wno-gc");
		}
		else
			compDoGc = false;
	}


	/*
	 * Find the root for the system library.
	 */
	if (cmdHasRootOption(argc, argv))
		compRootDir = cmdOptionArg;
	/* $ALDORROOT overrides $AXIOMXLROOT */
	if (!compRootDir)
		compRootDir = strCopyIf(osGetEnv("ALDORROOT"));
	if (!compRootDir)
		compRootDir = strCopyIf(osGetEnv("AXIOMXLROOT"));
	if (!compRootDir)
		compRootDir = compRootFromCmdLine(osCurDirName(), argv[0]);

	if (cmdHasCfgFileOption(argc, argv))
		compCfgSetConfigFile(cmdOptionArg);
	if (cmdHasCfgNameOption(argc, argv))
		compCfgSetSysName(cmdOptionArg);

#ifdef OS_MAC_SYS7
        if (!compRootDir)
		/*!!FIX! Parent of Directory in which binary was found */
		compRootDir = "::";
#endif

	/*
	 * Decide on the entry point.
	 */
	if (cmdHasHelpOption(argc, argv)) {
		compInit();
		cmdArguments(1, argc, argv);
		compFini();
		return 0;
	}

	if (cmdHasDebugOption(argc, argv))
		compIsDebug = true;

	if (cmdHasSEvalOption(argc, argv))
		return compSEvalLoop(osStdin,osStdout);

	if (cmdHasSExprOption(argc, argv))
		return compSExprLoop(osStdin,osStdout);

	if (cmdHasInteractiveOption(argc, argv))
	{
		if (osIsGUI())
			return 0;  /* gloop must be handled in event-driven style */
		else
			return compGLoop(argc, argv, osStdin, osStdout);
	}

	return compFilesLoop(argc, argv);
}
Пример #6
0
/*
 * Subsume options in response file into argument vector.
 * Only the slots 'argi0..*pargc-1 are treated as arguments.
 */
Bool
cmdSubsumeResponseFiles(int argi0, int *pargc, String **pargv)
{
	int 	nresps = 0, i;
	String 	*argv;
	String 	envopts;

	assert(*pargc >= 1);

	/* Copy the original args into a new r/w vector.
	 * The extra slot is potentially used in handling AXIOMXLARGS.
	 */
	argv = (String *) stoAlloc(OB_Other, (*pargc+1) * sizeof(String *));
	for (i = 0; i < *pargc; i++)
		argv[i] = strCopy((*pargv)[i]);
	*pargv  = argv;
 
	/* Check for ALDORARGS/AXIOMXLARGS environment variable. */
	envopts = osGetEnv("ALDORARGS");
	if (!envopts) envopts = osGetEnv("AXIOMXLARGS");
	if (envopts) {
		envopts = strCopy(envopts);
		for (i = *pargc - 1; i >= argi0; i--)
			(*pargv)[i+1] = (*pargv)[i];
		(*pargv)[argi0] = strCopy("-aFake");
		(*pargc)++;
		cmdOneResponse(pargc, pargv, envopts, argi0, argi0+1);
		nresps++;
		strFree(envopts);
	}

	while (cmdHasOption('a', NULL, *pargc, *pargv)) {
		String	 fileName = 0, fileText;
		FileName fn;
		int	 opt = 0, nextArg, startArg, j;
 
		for (nextArg = argi0, j = 0; ; ) {
			startArg = nextArg;
			opt = cmdGetOption(*pargc,*pargv,
					   &nextArg,&j,&fileName);

			/* Have response file option by itself. */
			if (optIs(opt, 'a'))
				break;
 
			/* Next option is response file option. Must be last */
			else if (j > 0 && optIs((*pargv)[startArg][j], 'a')) {
				int oldStartArg = startArg, oldJ = j;
				startArg = nextArg;
				opt = cmdGetOption(*pargc,*pargv,
						   &nextArg,&j,&fileName);
				(*pargv)[oldStartArg][oldJ] = '\0';
				++startArg;
				break;
			}
		}
 
		if (! fileName || ! fileName[0])
			/* Can't use cmdUseError here - no msg db! */
			comsgFatal(NULL,ALDOR_F_CmdBadOption,"-a",cmdName);
 
		fn = fnameParse(fileName);
		if (! fileIsReadable(fn))
			comsgFatal(NULL, ALDOR_F_CantOpen, fileName);
 
		/* We now have an existing response file */
		fileText = fileContentsString(fn);
		cmdOneResponse(pargc, pargv, fileText, startArg, nextArg);
		fileFreeContentsString(fileText);

		nresps++;
	}
 
	return nresps > 0;
}