Ejemplo n.º 1
0
/*
 * Prepare for pass #2
 */
void 
sym_PrepPass2(void)
{
	SLONG i;

	for (i = 0; i < HASHSIZE; i += 1) {
		struct sSymbol **ppSym = &(tHashedSymbols[i]);

		while (*ppSym) {
			if ((*ppSym)->
			    nType & (SYMF_SET | SYMF_STRING | SYMF_EQU)) {
				struct sSymbol *pTemp;

				pTemp = (*ppSym)->pNext;
				free(*ppSym);
				*ppSym = pTemp;
			} else
				ppSym = &((*ppSym)->pNext);
		}
	}
	pScope = NULL;
	pPCSymbol->nValue = 0;

	sym_AddString("__TIME__", SavedTIME);
	sym_AddString("__DATE__", SavedDATE);
	sym_AddSet("_RS", 0);

	sym_AddEqu("_NARG", 0);
	p_NARGSymbol = findsymbol("_NARG", NULL);
	p_NARGSymbol->Callback = Callback_NARG;
	
	math_DefinePI();
}
Ejemplo n.º 2
0
/*
 * Initialize the symboltable
 */
void 
sym_Init(void)
{
	SLONG i;
	time_t tod;

	for (i = 0; i < MAXMACROARGS; i += 1) {
		currentmacroargs[i] = NULL;
		newmacroargs[i] = NULL;
	}

	for (i = 0; i < HASHSIZE; i += 1)
		tHashedSymbols[i] = NULL;

	sym_AddReloc("@");
	pPCSymbol = findsymbol("@", NULL);
	sym_AddEqu("_NARG", 0);
	p_NARGSymbol = findsymbol("_NARG", NULL);
	p_NARGSymbol->Callback = Callback_NARG;

	sym_AddSet("_RS", 0);

	if (time(&tod) != -1) {
		struct tm *tptr;

		tptr = localtime(&tod);
		strftime(SavedTIME, sizeof(SavedTIME), "%H:%M:%S", tptr);
		strftime(SavedDATE, sizeof(SavedDATE), "%d %B %Y", tptr);
		sym_AddString("__TIME__", SavedTIME);
		sym_AddString("__DATE__", SavedDATE);
	}
	pScope = NULL;

	math_DefinePI();

}
void    math_DefinePI (void)
{
    sym_AddEqu ("_PI", double2fix (PI));
}