Mercurial > hg > index.cgi
comparison lwasm/pseudo.c @ 41:c6b8b455d67f
Fix line number sequence after including a file
author | lost@l-w.ca |
---|---|
date | Sat, 02 Apr 2011 22:33:39 -0600 |
parents | 7e92484cfbc3 |
children | bad2ee25acdd |
comparison
equal
deleted
inserted
replaced
40:d96037ea0b80 | 41:c6b8b455d67f |
---|---|
1042 { | 1042 { |
1043 char *fn, *p2; | 1043 char *fn, *p2; |
1044 char *p3; | 1044 char *p3; |
1045 int delim = 0; | 1045 int delim = 0; |
1046 int len; | 1046 int len; |
1047 | 1047 char buf[110]; |
1048 | |
1048 if (!**p) | 1049 if (!**p) |
1049 { | 1050 { |
1050 lwasm_register_error(as, l, "Missing filename"); | 1051 lwasm_register_error(as, l, "Missing filename"); |
1051 return; | 1052 return; |
1052 } | 1053 } |
1066 } | 1067 } |
1067 fn = lw_strndup(*p, p2 - *p); | 1068 fn = lw_strndup(*p, p2 - *p); |
1068 (*p) = p2; | 1069 (*p) = p2; |
1069 if (delim && **p) | 1070 if (delim && **p) |
1070 (*p)++; | 1071 (*p)++; |
1072 | |
1073 /* add a book-keeping entry for line numbers */ | |
1074 snprintf(buf, 100, "\001\001SETLINENO %d\n", l -> lineno + 1); | |
1075 input_openstring(as, "INTERNAL", buf); | |
1071 | 1076 |
1072 len = strlen(fn) + 8; | 1077 len = strlen(fn) + 8; |
1073 p3 = lw_alloc(len + 1); | 1078 p3 = lw_alloc(len + 1); |
1074 sprintf(p3, "include:%s", fn); | 1079 sprintf(p3, "include:%s", fn); |
1075 input_open(as, p3); | 1080 input_open(as, p3); |