mirror of
https://github.com/false-schemers/skint.git
synced 2024-11-16 07:47:54 +01:00
command-line; minor fixes
This commit is contained in:
parent
7e783ec786
commit
b57b54f12a
4 changed files with 30 additions and 6 deletions
9
i.c
9
i.c
|
@ -3534,6 +3534,15 @@ define_instruction(fren) {
|
|||
gonexti();
|
||||
}
|
||||
|
||||
define_instruction(argvref) {
|
||||
int i; char *s; ckk(ac);
|
||||
i = get_fixnum(ac); /* todo: range-check */
|
||||
s = cxg_argv[i];
|
||||
if (s) ac = string_obj(newstring(s));
|
||||
else ac = bool_obj(0);
|
||||
gonexti();
|
||||
}
|
||||
|
||||
define_instruction(getenv) {
|
||||
char *v; cks(ac);
|
||||
v = getenv(stringchars(ac));
|
||||
|
|
1
i.h
1
i.h
|
@ -497,6 +497,7 @@ declare_instruction(wriw, "W8\0P11", 0, "write-simple",
|
|||
declare_instruction(fexis, "F0", 0, "file-exists?", '1', AUTOGL)
|
||||
declare_instruction(frem, "F1", 0, "delete-file", '1', AUTOGL)
|
||||
declare_instruction(fren, "F2", 0, "rename-file", '2', AUTOGL)
|
||||
declare_instruction(argvref, "Z0", 0, "%argv-ref", '1', AUTOGL)
|
||||
declare_instruction(getenv, "Z1", 0, "get-environment-variable", '1', AUTOGL)
|
||||
declare_instruction(clock, "Z3", 0, "current-jiffy", '0', AUTOGL)
|
||||
declare_instruction(clops, "Z4", 0, "jiffies-per-second", '0', AUTOGL)
|
||||
|
|
3
s.c
3
s.c
|
@ -745,5 +745,8 @@ char *s_code[] = {
|
|||
"(y19:write-subbytevector)[34}%x,&0{%2.1,.1W3]2}%x,&0{%1P11,.1W3]1}%x,&"
|
||||
"4{|10|21|32|43%%}@!(y16:write-bytevector)",
|
||||
|
||||
"P", "command-line",
|
||||
"%0'0,n,,#0.0,&1{%2.1Z0,.0?{'1,.3I+,.2,.2c,:0^[32}.1A9]3}.!0.0^_1[02",
|
||||
|
||||
0, 0, 0
|
||||
};
|
||||
|
|
23
src/s.scm
23
src/s.scm
|
@ -650,6 +650,9 @@
|
|||
; (string-ci>? s1 s2 s ...)
|
||||
; (string-ci<=? s1 s2 s ...)
|
||||
; (string-ci>=? s1 s2 s ...)
|
||||
; (string-upcase s)
|
||||
; (string-downcase s)
|
||||
; (string-foldcase s)
|
||||
|
||||
(define (substring->list str start end)
|
||||
(let loop ([i (fx- end 1)] [l '()])
|
||||
|
@ -736,10 +739,6 @@
|
|||
[(_ . r) (%string-append . r)]
|
||||
[_ %string-append]))
|
||||
|
||||
;string-upcase
|
||||
;string-downcase
|
||||
;string-foldcase
|
||||
|
||||
|
||||
;---------------------------------------------------------------------------------------------
|
||||
; Vectors
|
||||
|
@ -859,7 +858,7 @@
|
|||
; (bytevector-u8-ref b i)
|
||||
; (bytevector-u8-set! b i u8)
|
||||
; (list->bytevector l)
|
||||
; (subbytevector b from to)
|
||||
; (subbytevector b from to) +
|
||||
; (bytevector=? b1 b2 b ...)
|
||||
|
||||
(define (subbytevector->list bvec start end)
|
||||
|
@ -1606,13 +1605,25 @@
|
|||
; (file-exists? s)
|
||||
; (delete-file s)
|
||||
; (rename-file sold snew) +
|
||||
;command-line
|
||||
; (%argv-ref i) +
|
||||
|
||||
(define (command-line)
|
||||
(let loop ([r '()] [i 0])
|
||||
(let ([arg (%argv-ref i)])
|
||||
(if arg
|
||||
(loop (cons arg r) (fx+ i 1))
|
||||
(reverse! r)))))
|
||||
|
||||
;exit
|
||||
;emergency-exit
|
||||
|
||||
;(get-environment-variable s)
|
||||
;get-environment-variables
|
||||
|
||||
; (current-second)
|
||||
; (current-jiffy)
|
||||
; (jiffies-per-second)
|
||||
|
||||
;features
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue