Added an arg_list field to the pcb which contains all command-line

arguments except -b (if it was there).
This commit is contained in:
Abdulaziz Ghuloum 2006-12-01 09:52:12 -05:00
parent f73a8c2333
commit 4b060b685f
4 changed files with 21 additions and 9 deletions

Binary file not shown.

View File

@ -305,8 +305,9 @@ ik_collect(int req, ikpcb* pcb){
*/
scan_dirty_pages(&gc);
collect_stack(&gc, pcb->frame_pointer, pcb->frame_base - wordsize);
pcb->next_k = add_object(&gc, pcb->next_k, "main");
pcb->oblist = add_object(&gc, pcb->oblist, "main");
pcb->next_k = add_object(&gc, pcb->next_k, "next_k");
pcb->oblist = add_object(&gc, pcb->oblist, "oblist");
pcb->arg_list = add_object(&gc, pcb->arg_list, "args_list");
/* now we trace all live objects */
collect_loop(&gc);

View File

@ -54,12 +54,6 @@ int main(int argc, char** argv){
x = stpcpy(x, argv[0]);
x = stpcpy(x, ".boot");
}
if(argc != 1){
fprintf(stderr,
"Error ~s: unrecognized argument %s\n",
argv[0], argv[1]);
exit(-1);
}
if(sizeof(mp_limb_t) != sizeof(int)){
fprintf(stderr, "ERROR: limb size\n");
@ -68,6 +62,23 @@ int main(int argc, char** argv){
fprintf(stderr, "ERROR: bits_per_limb=%d\n", mp_bits_per_limb);
}
ikpcb* pcb = ik_make_pcb();
{ /* set up arg_list */
ikp arg_list = null_object;
int i = argc-1;
while(i > 0){
char* s = argv[i];
int n = strlen(s);
ikp str = ik_alloc(pcb, align(n+disp_string_data+1));
ref(str, disp_string_length) = fix(n);
strcpy((char*)str+disp_string_data, s);
ikp p = ik_alloc(pcb, pair_size);
ref(p, disp_car) = str + string_tag;
ref(p, disp_cdr) = arg_list;
arg_list = p+pair_tag;
i--;
}
pcb->arg_list = arg_list;
}
ik_fasl_load(pcb, boot_file);
/*
fprintf(stderr, "collect time: %d.%03d utime, %d.%03d stime (%d collections)\n",

View File

@ -85,7 +85,7 @@ typedef struct {
ikp next_k; /* offset = 20 */
void* system_stack; /* offset = 24 */
unsigned int* dirty_vector; /* offset = 28 */
ikp arg_list; /* offset = 32 */
/* the rest are not used by any scheme code */
/* they only support the runtime system (gc, etc.) */
unsigned int* segment_vector;