command line arguments are now interpreted as utf8 strings.
This commit is contained in:
parent
2ad6d9bddf
commit
fdca9ed33f
Binary file not shown.
Binary file not shown.
|
@ -22,10 +22,16 @@
|
||||||
|
|
||||||
(define (command-line) (command-line-arguments))
|
(define (command-line) (command-line-arguments))
|
||||||
(define 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)
|
(lambda (x)
|
||||||
(if (and (list? x) (andmap string? x))
|
(if (and (list? x) (andmap string? x))
|
||||||
x
|
x
|
||||||
(die 'command-list
|
(die 'command-list
|
||||||
"invalid command-line-arguments ~s\n" x))))))
|
"invalid command-line-arguments" x))))))
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1581
|
1582
|
||||||
|
|
|
@ -74,7 +74,6 @@
|
||||||
"ikarus.numerics.ss"
|
"ikarus.numerics.ss"
|
||||||
"ikarus.conditions.ss"
|
"ikarus.conditions.ss"
|
||||||
"ikarus.guardians.ss"
|
"ikarus.guardians.ss"
|
||||||
"ikarus.command-line.ss"
|
|
||||||
"ikarus.codecs.ss"
|
"ikarus.codecs.ss"
|
||||||
"ikarus.bytevectors.ss"
|
"ikarus.bytevectors.ss"
|
||||||
"ikarus.posix.ss"
|
"ikarus.posix.ss"
|
||||||
|
@ -104,6 +103,7 @@
|
||||||
"ikarus.sort.ss"
|
"ikarus.sort.ss"
|
||||||
"ikarus.promises.ss"
|
"ikarus.promises.ss"
|
||||||
"ikarus.enumerations.ss"
|
"ikarus.enumerations.ss"
|
||||||
|
"ikarus.command-line.ss"
|
||||||
"ikarus.not-yet-implemented.ss"
|
"ikarus.not-yet-implemented.ss"
|
||||||
"ikarus.main.ss"
|
"ikarus.main.ss"
|
||||||
))
|
))
|
||||||
|
|
|
@ -70,17 +70,12 @@ int ikarus_main(int argc, char** argv, char* boot_file){
|
||||||
while(i > 0){
|
while(i > 0){
|
||||||
char* s = argv[i];
|
char* s = argv[i];
|
||||||
int n = strlen(s);
|
int n = strlen(s);
|
||||||
ikptr str = ik_unsafe_alloc(pcb, align(n*string_char_size+disp_string_data+1))
|
ikptr bv = ik_unsafe_alloc(pcb, align(disp_bytevector_data+n+1))
|
||||||
+ string_tag;
|
+ bytevector_tag;
|
||||||
ref(str, off_string_length) = fix(n);
|
ref(bv, off_bytevector_length) = fix(n);
|
||||||
{
|
memcpy((char*)(bv+off_bytevector_data), s, n+1);
|
||||||
int i;
|
|
||||||
for(i=0; i<n; i++){
|
|
||||||
string_set(str, i, integer_to_char(s[i]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ikptr p = ik_unsafe_alloc(pcb, pair_size);
|
ikptr p = ik_unsafe_alloc(pcb, pair_size);
|
||||||
ref(p, disp_car) = str;
|
ref(p, disp_car) = bv;
|
||||||
ref(p, disp_cdr) = arg_list;
|
ref(p, disp_cdr) = arg_list;
|
||||||
arg_list = p+pair_tag;
|
arg_list = p+pair_tag;
|
||||||
i--;
|
i--;
|
||||||
|
|
Loading…
Reference in New Issue