Mercurial > hg-old > index.cgi
comparison lwasm/pseudo.c @ 386:af5f2c51db76
Bugfixing on includes
author | lost@starbug |
---|---|
date | Sun, 16 May 2010 13:03:17 -0600 |
parents | eacdae8a1575 |
children | a741d2e4869f |
comparison
equal
deleted
inserted
replaced
385:cf8c92d70eb1 | 386:af5f2c51db76 |
---|---|
910 | 910 |
911 for (i = 0; (*p)[i] && !isspace((*p)[i]); i++) | 911 for (i = 0; (*p)[i] && !isspace((*p)[i]); i++) |
912 /* do nothing */ ; | 912 /* do nothing */ ; |
913 | 913 |
914 sym = lw_strndup(*p, i); | 914 sym = lw_strndup(*p, i); |
915 (*p) += i; | |
915 | 916 |
916 s = lookup_symbol(as, l, sym); | 917 s = lookup_symbol(as, l, sym); |
917 | 918 |
918 lw_free(sym); | 919 lw_free(sym); |
919 | 920 |
1003 } | 1004 } |
1004 | 1005 |
1005 PARSEFUNC(pseudo_parse_include) | 1006 PARSEFUNC(pseudo_parse_include) |
1006 { | 1007 { |
1007 char *fn, *p2; | 1008 char *fn, *p2; |
1009 char *p3; | |
1008 int delim = 0; | 1010 int delim = 0; |
1009 | 1011 |
1010 if (!**p) | 1012 if (!**p) |
1011 { | 1013 { |
1012 lwasm_register_error(as, l, "Missing filename"); | 1014 lwasm_register_error(as, l, "Missing filename"); |
1025 { | 1027 { |
1026 for (p2 = *p; *p2 && !isspace(*p2); p2++) | 1028 for (p2 = *p; *p2 && !isspace(*p2); p2++) |
1027 /* do nothing */ ; | 1029 /* do nothing */ ; |
1028 } | 1030 } |
1029 fn = lw_strndup(*p, p2 - *p); | 1031 fn = lw_strndup(*p, p2 - *p); |
1030 | 1032 (*p) = p2; |
1031 if (delim && **p) | 1033 if (delim && **p) |
1032 (*p)++; | 1034 (*p)++; |
1033 | 1035 |
1034 input_open(as, fn); | 1036 0 == asprintf(&p3, "include:%s", fn); |
1037 input_open(as, p3); | |
1038 lw_free(p3); | |
1035 | 1039 |
1036 l -> len = 0; | 1040 l -> len = 0; |
1037 } | 1041 } |
1038 | 1042 |
1039 PARSEFUNC(pseudo_parse_align) | 1043 PARSEFUNC(pseudo_parse_align) |