command line arguments are now interpreted as utf8 strings.

This commit is contained in:
Abdulaziz Ghuloum 2008-08-10 11:33:10 -07:00
parent 2ad6d9bddf
commit fdca9ed33f
6 changed files with 15 additions and 14 deletions

Binary file not shown.

Binary file not shown.

View File

@ -22,10 +22,16 @@
(define (command-line) (command-line-arguments))
(define command-line-arguments
(make-parameter ($arg-list)
(make-parameter
(map (lambda (x)
(cond
[(string? x) x]
[(bytevector? x) (utf8->string x)]
[else (die 'command-line "invalid" x)]))
($arg-list))
(lambda (x)
(if (and (list? x) (andmap string? x))
x
(die 'command-list
"invalid command-line-arguments ~s\n" x))))))
"invalid command-line-arguments" x))))))

View File

@ -1 +1 @@
1581
1582

View File

@ -74,7 +74,6 @@
"ikarus.numerics.ss"
"ikarus.conditions.ss"
"ikarus.guardians.ss"
"ikarus.command-line.ss"
"ikarus.codecs.ss"
"ikarus.bytevectors.ss"
"ikarus.posix.ss"
@ -104,6 +103,7 @@
"ikarus.sort.ss"
"ikarus.promises.ss"
"ikarus.enumerations.ss"
"ikarus.command-line.ss"
"ikarus.not-yet-implemented.ss"
"ikarus.main.ss"
))

View File

@ -70,17 +70,12 @@ int ikarus_main(int argc, char** argv, char* boot_file){
while(i > 0){
char* s = argv[i];
int n = strlen(s);
ikptr str = ik_unsafe_alloc(pcb, align(n*string_char_size+disp_string_data+1))
+ string_tag;
ref(str, off_string_length) = fix(n);
{
int i;
for(i=0; i<n; i++){
string_set(str, i, integer_to_char(s[i]));
}
}
ikptr bv = ik_unsafe_alloc(pcb, align(disp_bytevector_data+n+1))
+ bytevector_tag;
ref(bv, off_bytevector_length) = fix(n);
memcpy((char*)(bv+off_bytevector_data), s, n+1);
ikptr p = ik_unsafe_alloc(pcb, pair_size);
ref(p, disp_car) = str;
ref(p, disp_car) = bv;
ref(p, disp_cdr) = arg_list;
arg_list = p+pair_tag;
i--;