Ejemplo n.º 1
0
void be_init()
/* Main routine for Interpreter back end */
{
	char *p;

	EuConsole = (getenv("EUCONS") != NULL && atoi(getenv("EUCONS")) == 1);
	clocks_per_sec = CLOCKS_PER_SEC;
#ifdef CLK_TCK
	clk_tck = CLK_TCK;
#else
	clk_tck = sysconf(_SC_CLK_TCK);
#endif

#define TempErrName_len (30)
	TempErrName = (char *)EMalloc(TempErrName_len);
	copy_string(TempErrName, "ex.err", TempErrName_len); // can change
	
	eudir = getenv("EUDIR");
	if (eudir == NULL) {
#ifdef EUNIX
		// should check search PATH for euphoria/bin ?
		eudir = getenv("HOME");
		if (eudir == NULL) {
			eudir = "euphoria";  
		}
		else {
			int p_size = strlen(eudir) + 12;
			p = (char *)EMalloc(p_size + 1);
			snprintf(p, p_size+1, "%s/euphoria", eudir);
			p[p_size] = 0; // ensure NULL
			eudir = p;
		}
#else // EUNIX
		eudir = "\\EUPHORIA";
#endif // EUNIX
	}
	
#if defined(EUNIX) || defined(EMINGW)
	copy_string(main_path, file_name[1], PATH_MAX); // FOR NOW!
#else
	(void)_fullpath(main_path, file_name[1], PATH_MAX+1); 
#endif
	for (p = main_path+strlen(main_path)-1; 
		 *p != '\\' && *p != '/' && p >= main_path; 
		 p--)
		;
	*(p+1) = '\0'; /* keep the path, truncate off the final name */    

	InitExecute();
	InitDebug();
	InitTraceWindow();
}
Ejemplo n.º 2
0
void be_init()
/* Main routine for Interpreter back end */
{
    char *p;
    int i;
    long c;
    char *temp;

    clocks_per_sec = CLOCKS_PER_SEC;
#ifdef ELCC
    clk_tck = CLOCKS_PER_SEC;
#else
#ifdef CLK_TCK
    clk_tck = CLK_TCK;
#else
    clk_tck = sysconf(_SC_CLK_TCK);
#endif
#endif

#ifdef EWINDOWS

#ifdef EBORLAND
    _control87(MCW_EM,MCW_EM);
#endif
#endif
    TempErrName = (char *)malloc(8); // uses malloc, not EMalloc
    strcpy(TempErrName, "ex.err"); // can change

    eudir = getenv("EUDIR");
    if (eudir == NULL) {
#ifdef ELINUX
	// should check search PATH for euphoria/bin ?
	eudir = getenv("HOME");
	if (eudir == NULL) {
	    eudir = "euphoria";
	}
	else {
	    p = (char *)malloc(strlen(eudir)+12);
	    strcpy(p, eudir);
	    strcat(p, "/euphoria");
	    eudir = p;
	}
#else
	eudir = "\\EUPHORIA";
#endif
    }

#if defined(ELINUX) || defined(EDJGPP)
    strcpy(main_path, file_name[1]); // FOR NOW!
#else
    (void)_fullpath(main_path, file_name[1], PATH_MAX+1);
#endif
    for (p = main_path+strlen(main_path)-1;
	 *p != '\\' && *p != '/' && p >= main_path;
	 p--)
	;
    *(p+1) = '\0'; /* keep the path, truncate off the final name */

#ifdef EBORLAND
    PatchCallc();  // ? translator init does this
#endif

    InitExecute();
    InitDebug();
    InitTraceWindow();
}