marrub
/
LoveToken
Archived
1
0
Fork 0

various changes, getting ready for merge

master
Marrub 2015-06-06 08:12:58 -04:00
parent 8f637feac8
commit 44db7d5460
2 changed files with 18 additions and 2 deletions

View File

@ -53,6 +53,11 @@ char *LT_TkNames[] = {
"TOK_Identi", "TOK_EOF", "TOK_ChrSeq" "TOK_Identi", "TOK_EOF", "TOK_ChrSeq"
}; };
static const char *errors[] = {
"LT_Error: Syntax error",
"LT_Error: Unknown operation"
};
/* /*
* Functions * Functions
*/ */
@ -135,6 +140,12 @@ bool LT_Assert(bool assertion, const char *str)
return assertion; return assertion;
} }
void LT_Error(int type)
{
fprintf(stderr, "%s", errors[type]);
exit(1);
}
LT_AssertInfo LT_CheckAssert() LT_AssertInfo LT_CheckAssert()
{ {
LT_AssertInfo ltAssertion; LT_AssertInfo ltAssertion;

View File

@ -31,8 +31,6 @@ THE SOFTWARE.
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <iconv.h>
/* /*
* Definitions * Definitions
*/ */
@ -57,6 +55,12 @@ enum
TOK_Number, TOK_Identi, TOK_EOF, TOK_ChrSeq TOK_Number, TOK_Identi, TOK_EOF, TOK_ChrSeq
}; };
enum
{
LTERR_SYNTAX,
LTERR_UNKNOWN_OPERATION
};
/* /*
* Types * Types
*/ */
@ -97,6 +101,7 @@ void LT_EXPORT LT_Init(LT_InitInfo initInfo);
void LT_EXPORT LT_Quit(); void LT_EXPORT LT_Quit();
bool LT_EXPORT LT_Assert(bool assertion, const char *str); bool LT_EXPORT LT_Assert(bool assertion, const char *str);
LT_AssertInfo LT_EXPORT LT_CheckAssert(); LT_AssertInfo LT_EXPORT LT_CheckAssert();
void LT_EXPORT LT_Error(int type); // [marrub] C use ONLY
bool LT_EXPORT LT_OpenFile(const char *filePath); bool LT_EXPORT LT_OpenFile(const char *filePath);
void LT_EXPORT LT_CloseFile(); void LT_EXPORT LT_CloseFile();