A template parsing library and tool written in C.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

65 lines
1.2 KiB

#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include <stdlib.h>
#include <stdarg.h>
#include <tepal_pars.h>
#include <expValue.h>
#include <ident.h>
#include <tepal.h>
char * tepalErrMsg[] =
{
"[ERROR] using uninitialized variable: %s\n",
"[ERROR] using array identifier without index: %s\n",
"[ERROR] unknown string operator: %c\n",
"[ERROR] unknown float operator: %c\n"
};
void
exitError (int errNum, ...)
{
va_list ap;
va_start (ap, errNum);
switch (errNum)
{
case ERR_UNDEF_VAR:
fprintf (stderr, tepalErrMsg[errNum], va_arg(ap, char *));
break;
case ERR_NO_INDEX:
fprintf (stderr, tepalErrMsg[errNum], va_arg(ap, char *));
break;
case ERR_STRING_OPERATOR:
fprintf (stderr, tepalErrMsg[errNum], va_arg(ap, int));
break;
case ERR_FLOAT_OPERATOR:
fprintf (stderr, tepalErrMsg[errNum], va_arg(ap, int));
break;
}
va_end (ap);
exit (errNum);
}
void
printExpr (s_expVal * val)
{
switch (expValueGetType (val))
{
case EXP_TYP_INT: printf ("%d", expValueInt (val)); break;
case EXP_TYP_FLOAT: printf ("%f", expValueFloat (val)); break;
case EXP_TYP_STRING:
{
char * v = expValueString (val);
printf (v);
free (v);
}
}
}