Mercurial > hg > index.cgi
comparison lwasm/pseudo.c @ 224:3864d96ee8c7
Make unicorns notice referenced files better
Fix bug related to includebin and also make unicorns notice all files opened
through the input subsystem when generating the resource list.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 15 Jul 2012 20:50:18 -0600 |
parents | afd50d6b4113 |
children | 823560a8c251 |
comparison
equal
deleted
inserted
replaced
223:211fc8038b8d | 224:3864d96ee8c7 |
---|---|
1314 { | 1314 { |
1315 char *fn, *p2; | 1315 char *fn, *p2; |
1316 int delim = 0; | 1316 int delim = 0; |
1317 FILE *fp; | 1317 FILE *fp; |
1318 long flen; | 1318 long flen; |
1319 char *rfn; | |
1319 | 1320 |
1320 if (!**p) | 1321 if (!**p) |
1321 { | 1322 { |
1322 lwasm_register_error(as, l, "Missing filename"); | 1323 lwasm_register_error(as, l, "Missing filename"); |
1323 return; | 1324 return; |
1339 fn = lw_strndup(*p, p2 - *p); | 1340 fn = lw_strndup(*p, p2 - *p); |
1340 *p = p2; | 1341 *p = p2; |
1341 if (delim && **p) | 1342 if (delim && **p) |
1342 (*p)++; | 1343 (*p)++; |
1343 | 1344 |
1344 fp = input_open_standalone(as, fn); | 1345 fp = input_open_standalone(as, fn, &rfn); |
1345 if (!fp) | 1346 if (!fp) |
1346 { | 1347 { |
1347 lwasm_register_error(as, l, "Cannot open file"); | 1348 lwasm_register_error(as, l, "Cannot open file"); |
1348 lw_free(fn); | 1349 lw_free(fn); |
1349 return; | 1350 return; |
1350 } | 1351 } |
1351 | 1352 |
1352 l -> lstr = fn; | 1353 l -> lstr = rfn; |
1353 | 1354 |
1354 fseek(fp, 0, SEEK_END); | 1355 fseek(fp, 0, SEEK_END); |
1355 flen = ftell(fp); | 1356 flen = ftell(fp); |
1356 fclose(fp); | 1357 fclose(fp); |
1357 | 1358 |
1361 EMITFUNC(pseudo_emit_includebin) | 1362 EMITFUNC(pseudo_emit_includebin) |
1362 { | 1363 { |
1363 FILE *fp; | 1364 FILE *fp; |
1364 int c; | 1365 int c; |
1365 | 1366 |
1366 fp = input_open_standalone(as, l -> lstr); | 1367 fp = fopen(l -> lstr, "r"); |
1367 if (!fp) | 1368 if (!fp) |
1368 { | 1369 { |
1369 lwasm_register_error(as, l, "Cannot open file (emit)!"); | 1370 lwasm_register_error(as, l, "Cannot open file (emit)!"); |
1370 return; | 1371 return; |
1371 } | 1372 } |