comparison lwasm/input.c @ 384:38b50ce6967a

Made --list and --depend work
author lost@starbug
date Sat, 15 May 2010 20:46:04 -0600
parents 7166254491ed
children af5f2c51db76
comparison
equal deleted inserted replaced
383:848d3cca8078 384:38b50ce6967a
65 struct input_stack *t; 65 struct input_stack *t;
66 66
67 if (as -> file_dir) 67 if (as -> file_dir)
68 lw_stack_destroy(as -> file_dir); 68 lw_stack_destroy(as -> file_dir);
69 as -> file_dir = lw_stack_create(lw_free); 69 as -> file_dir = lw_stack_create(lw_free);
70 as -> includelist = lw_stack_create(lw_free);
70 lw_stringlist_reset(as -> input_files); 71 lw_stringlist_reset(as -> input_files);
71 while (IS) 72 while (IS)
72 { 73 {
73 t = IS; 74 t = IS;
74 as -> input_data = IS -> next; 75 as -> input_data = IS -> next;
78 79
79 void input_pushpath(asmstate_t *as, char *fn) 80 void input_pushpath(asmstate_t *as, char *fn)
80 { 81 {
81 /* take apart fn into path and filename then push the path */ 82 /* take apart fn into path and filename then push the path */
82 /* onto the current file path stack */ 83 /* onto the current file path stack */
84
85 /* also add it to the list of files included */
83 char *dn, *dp; 86 char *dn, *dp;
84 int o; 87 int o;
85 88
89 dn = lw_strdup(fn);
90 lw_stack_push(as -> includelist, dn);
91
86 dn = lw_strdup(fn); 92 dn = lw_strdup(fn);
87 dp = dn + strlen(dn); 93 dp = dn + strlen(dn);
88 94
89 while (--dp != dn) 95 while (--dp != dn)
90 { 96 {