fixed a bug where too long filenames would not be printed in errors

and the porgam would jsut essentially print spaced forever
This commit is contained in:
FelixBrendel
2019-10-24 00:11:57 +02:00
parent 6260359a83
commit 814cceaf3d
5 changed files with 51 additions and 33 deletions
+23 -21
View File
@@ -1,15 +1,17 @@
#define concat_( a, b) a##b
#define label(prefix, lnum) concat_(prefix,lnum)
#define log_location() \
do { \
if (Globals::log_level == Log_Level::Debug) { \
printf("in"); \
for (int i = 0; i < 30-strlen(__FILE__);++i) \
printf(" "); \
printf("%s (%d) ", __FILE__, __LINE__); \
printf("-> %s\n",__FUNCTION__); \
} \
#define log_location() \
do { \
if (Globals::log_level == Log_Level::Debug) { \
printf("in"); \
int spacing = 30-(int)strlen(__FILE__); \
if (spacing < 1) spacing = 1; \
for (int i = 0; i < spacing;++i) \
printf(" "); \
printf("%s (%d) ", __FILE__, __LINE__); \
printf("-> %s\n",__FUNCTION__); \
} \
} while(0)
#define if_error_log_location_and_return() \
@@ -21,18 +23,18 @@
} while(0)
#define try_or_else_return(val) \
if (1) \
goto label(body,__LINE__); \
else \
while (1) \
if (1) { \
if (Globals::error) { \
log_location(); \
return val; \
} \
break; \
} \
#define try_or_else_return(val) \
if (1) \
goto label(body,__LINE__); \
else \
while (1) \
if (1) { \
if (Globals::error) { \
log_location(); \
return val; \
} \
break; \
} \
else label(body,__LINE__):
;
+5
View File
@@ -149,6 +149,8 @@ namespace Slime {
String* message;
};
const wchar_t* char_to_wchar(const char* c);
char* read_entire_file(char* filename);
void add_to_load_path(const char*);
bool lisp_object_equal(Lisp_Object*,Lisp_Object*);
Lisp_Object* built_in_load(String*);
@@ -182,6 +184,9 @@ namespace Slime {
void generate_docs(String* path);
namespace Memory {
extern Lisp_Object* nil;
extern Lisp_Object* t;
Environment* create_built_ins_environment();
Lisp_Object* create_lisp_object_cfunction(bool is_special);
Lisp_Object* get_or_create_lisp_object_keyword(const char* identifier);