[Wisp-cvs] wisp/src/native strings.nasm,1.53,1.54 sys.s,1.9,1.10 sys.wth,1.10,1.11 wrap.nasm,1.60,1.
Status: Alpha
Brought to you by:
digg
From: <di...@us...> - 2002-09-18 21:01:06
|
Update of /cvsroot/wisp/wisp/src/native In directory usw-pr-cvs1:/tmp/cvs-serv27827/src/native Modified Files: strings.nasm sys.s sys.wth wrap.nasm wstrings.s wstrings.wth Log Message: Converted sys.c to Worth code. Index: strings.nasm =================================================================== RCS file: /cvsroot/wisp/wisp/src/native/strings.nasm,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- strings.nasm 18 Sep 2002 21:00:08 -0000 1.53 +++ strings.nasm 18 Sep 2002 21:01:03 -0000 1.54 @@ -16,23 +16,6 @@ %define c16string#length(x) dword [(x) + c16string.length] -; {{{ |string?| -native string_huh, 1 - pop eax - test al, 3 - jnz .f - test eax, eax - jz .f - cmp type(eax), NC_C8STRING - jz .t - cmp type(eax), RT_c16string - jnz .f -.t: mov eax, TRUE - ret -.f: mov eax, FALSE - ret -; }}} - ; {{{ |c8string-ref| global N_c8string_ref native c8string_ref, any Index: sys.s =================================================================== RCS file: /cvsroot/wisp/wisp/src/native/sys.s,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- sys.s 18 Sep 2002 20:58:07 -0000 1.9 +++ sys.s 18 Sep 2002 21:01:03 -0000 1.10 @@ -1,13 +1,121 @@ .section .text .align 16 +N_sys_ns_for_dir_entries: +.byte 144,81,131,249,2,15,132,8,0,0,0,88,137,193,233 +.long N_signal_argcount - (.+4) +.byte 88,88,104 +.long N_sys_ns_for_dir_entries.L1 +.byte 80,233 +.long decui$1 - (.+4) +.byte 91,129,236,24,2,0,0,137,225,83,80,81,88,91,83,80,186,24,2,0,0,137 +.byte 193,184,141,0,0,0,205,128,80,133,192,15,142,108,0,0,0,88,91,83,80 +.byte 83,88,91,83,80,133,219,15,132,84,0,0,0,88,137,195,131,195,10,80,83 +.byte 232 +.long zt2ws - (.+4) +.byte 91,91,137,217,131,193,0,139,9,83,80,104 +.long N_sys_ns_for_dir_entries.L6 +.byte 81,233 +.long encui$1 - (.+4) +.byte 91,104 +.long N_sys_ns_for_dir_entries.L7 +.byte 83,80,106,2,184,8,0,0,0,139,28,132,137,216,91,137,217,233 +.long funcall - (.+4) +.byte 88,137,195,131,195,8,15,183,27,1,216,89,41,217,81,80,233,160,255 +.byte 255,255,88,88,233,121,255,255,255,88,91,91,91,129,196,24,2,0,0,80 +.byte 233 +.long encsi$1 - (.+4) +.global N_sys_ns_for_dir_entries,NN_sys_ns_for_dir_entries,N_sys_ns_for_dir_entries.L1,N_sys_ns_for_dir_entries.L6,N_sys_ns_for_dir_entries.L7 +.equiv NN_sys_ns_for_dir_entries, N_sys_ns_for_dir_entries + 1 +.equiv N_sys_ns_for_dir_entries.L1, N_sys_ns_for_dir_entries + 32 +.equiv N_sys_ns_for_dir_entries.L6, N_sys_ns_for_dir_entries + 123 +.equiv N_sys_ns_for_dir_entries.L7, N_sys_ns_for_dir_entries + 151 +.section .text +.align 16 +N_sys_ns_select: +.byte 144,81,131,249,6,15,132,8,0,0,0,88,137,193,233 +.long N_signal_argcount - (.+4) +.byte 88,184,5,0,0,0,139,28,132,83,104,0,4,0,0,104 +.long N_sys_ns_select.L1 +.byte 83,233 +.long decui$1 - (.+4) +.byte 91,80,57,216,15,140,13,0,0,0,88,88,104 +.long WB_range +.byte 80,233 +.long raise$2 - (.+4) +.byte 88,91,187,5,0,0,0,137,4,156,184,4,0,0,0,139,28,132,83,131,251,19 +.byte 15,132,133,0,0,0,88,137,195,131,227,3,80,80,133,219,15,132,8,0,0,0 +.byte 88,106,19,233,22,0,0,0,88,80,133,192,15,133,8,0,0,0,88,106,19,233 +.byte 4,0,0,0,88,139,0,80,88,61,9,0,0,0,15,132,12,0,0,0,88,104 +.long WB_c8string_huh +.byte 80,233 +.long raise$2 - (.+4) +.byte 88,137,195,131,195,4,139,27,80,184,128,0,0,0,57,216,15,132,12,0,0 +.byte 0,88,104 +.long WB_range +.byte 80,233 +.long raise$2 - (.+4) +.byte 88,137,195,131,195,8,139,0,83,61,9,0,0,0,15,133,4,0,0,0,88,139,0 +.byte 80,233,3,0,0,0,88,106,0,88,187,4,0,0,0,137,4,156,184,3,0,0,0,139 +.byte 28,132,83,131,251,19,15,132,133,0,0,0,88,137,195,131,227,3,80,80 +.byte 133,219,15,132,8,0,0,0,88,106,19,233,22,0,0,0,88,80,133,192,15,133 +.byte 8,0,0,0,88,106,19,233,4,0,0,0,88,139,0,80,88,61,9,0,0,0,15,132,12 +.byte 0,0,0,88,104 +.long WB_c8string_huh +.byte 80,233 +.long raise$2 - (.+4) +.byte 88,137,195,131,195,4,139,27,80,184,128,0,0,0,57,216,15,132,12,0,0 +.byte 0,88,104 +.long WB_range +.byte 80,233 +.long raise$2 - (.+4) +.byte 88,137,195,131,195,8,139,0,83,61,9,0,0,0,15,133,4,0,0,0,88,139,0 +.byte 80,233,3,0,0,0,88,106,0,88,187,3,0,0,0,137,4,156,184,2,0,0,0,139 +.byte 28,132,83,131,251,19,15,132,133,0,0,0,88,137,195,131,227,3,80,80 +.byte 133,219,15,132,8,0,0,0,88,106,19,233,22,0,0,0,88,80,133,192,15,133 +.byte 8,0,0,0,88,106,19,233,4,0,0,0,88,139,0,80,88,61,9,0,0,0,15,132,12 +.byte 0,0,0,88,104 +.long WB_c8string_huh +.byte 80,233 +.long raise$2 - (.+4) +.byte 88,137,195,131,195,4,139,27,80,184,128,0,0,0,57,216,15,132,12,0,0 +.byte 0,88,104 +.long WB_range +.byte 80,233 +.long raise$2 - (.+4) +.byte 88,137,195,131,195,8,139,0,83,61,9,0,0,0,15,133,4,0,0,0,88,139,0 +.byte 80,233,3,0,0,0,88,106,0,88,187,2,0,0,0,137,4,156,88,91,89,95,90,94 +.byte 131,236,8,86,137,230,82,87,81,86,83,80,131,251,19,15,132,82,0,0,0 +.byte 88,91,80,104 +.long N_sys_ns_select.L31 +.byte 83,233 +.long decui$1 - (.+4) +.byte 91,80,83,104,64,66,15,0,104 +.long N_sys_ns_select.L32 +.byte 83,233 +.long decui$1 - (.+4) +.byte 91,80,57,216,15,140,13,0,0,0,88,88,104 +.long WB_range +.byte 80,233 +.long raise$2 - (.+4) +.byte 88,91,91,89,137,207,131,199,4,137,7,137,200,5,0,0,0,0,137,24,81 +.byte 233,5,0,0,0,88,88,88,106,0,88,137,199,88,137,198,88,137,194,88,137 +.byte 193,88,137,195,184,142,0,0,0,205,128,131,196,8,80,233 +.long encsi$1 - (.+4) +.global N_sys_ns_select,NN_sys_ns_select,N_sys_ns_select.L1,N_sys_ns_select.L31,N_sys_ns_select.L32 +.equiv NN_sys_ns_select, N_sys_ns_select + 1 +.equiv N_sys_ns_select.L1, N_sys_ns_select + 45 +.equiv N_sys_ns_select.L31, N_sys_ns_select + 608 +.equiv N_sys_ns_select.L32, N_sys_ns_select + 627 +.section .text +.align 16 N_sys_fd_isset: .byte 144,81,131,249,2,15,132,8,0,0,0,88,137,193,233 .long N_signal_argcount - (.+4) -.byte 88,88,91,80,83,104 +.byte 88,88,91,80,83,104,0,4,0,0,104 .long N_sys_fd_isset.L1 .byte 83,233 .long decui$1 - (.+4) -.byte 80,61,0,4,0,0,15,140,13,0,0,0,88,88,104 +.byte 91,80,57,216,15,140,13,0,0,0,88,88,104 .long WB_range .byte 80,233 .long raise$2 - (.+4) @@ -28,17 +136,17 @@ .byte 0,0,106,19,88,195 .global N_sys_fd_isset,NN_sys_fd_isset,N_sys_fd_isset.L1 .equiv NN_sys_fd_isset, N_sys_fd_isset + 1 -.equiv N_sys_fd_isset.L1, N_sys_fd_isset + 35 +.equiv N_sys_fd_isset.L1, N_sys_fd_isset + 40 .section .text .align 16 N_sys_fd_clr: .byte 144,81,131,249,2,15,132,8,0,0,0,88,137,193,233 .long N_signal_argcount - (.+4) -.byte 88,88,91,80,83,104 +.byte 88,88,91,80,83,104,0,4,0,0,104 .long N_sys_fd_clr.L1 .byte 83,233 .long decui$1 - (.+4) -.byte 80,61,0,4,0,0,15,140,13,0,0,0,88,88,104 +.byte 91,80,57,216,15,140,13,0,0,0,88,88,104 .long WB_range .byte 80,233 .long raise$2 - (.+4) @@ -58,17 +166,17 @@ .byte 27,0,0,0,195 .global N_sys_fd_clr,NN_sys_fd_clr,N_sys_fd_clr.L1 .equiv NN_sys_fd_clr, N_sys_fd_clr + 1 -.equiv N_sys_fd_clr.L1, N_sys_fd_clr + 35 +.equiv N_sys_fd_clr.L1, N_sys_fd_clr + 40 .section .text .align 16 N_sys_fd_set: .byte 144,81,131,249,2,15,132,8,0,0,0,88,137,193,233 .long N_signal_argcount - (.+4) -.byte 88,88,91,80,83,104 +.byte 88,88,91,80,83,104,0,4,0,0,104 .long N_sys_fd_set.L1 .byte 83,233 .long decui$1 - (.+4) -.byte 80,61,0,4,0,0,15,140,13,0,0,0,88,88,104 +.byte 91,80,57,216,15,140,13,0,0,0,88,88,104 .long WB_range .byte 80,233 .long raise$2 - (.+4) @@ -88,7 +196,7 @@ .byte 27,0,0,0,195 .global N_sys_fd_set,NN_sys_fd_set,N_sys_fd_set.L1 .equiv NN_sys_fd_set, N_sys_fd_set + 1 -.equiv N_sys_fd_set.L1, N_sys_fd_set + 35 +.equiv N_sys_fd_set.L1, N_sys_fd_set + 40 .section .text .align 16 N_sys_fd_zero: @@ -1029,3 +1137,20 @@ .long encsi$1 - (.+4) .global N_unix_time,NN_unix_time .equiv NN_unix_time, N_unix_time + 1 +.section .text +.align 16 +dhexprint: +.byte 88,91,89,80,81,83,232 +.long hexprint - (.+4) +.byte 232 +.long hexprint - (.+4) +.byte 195 +.global dhexprint +.section .text +.align 16 +hexprint: +.byte 88,91,80,106,8,83,88,193,192,4,137,195,131,227,15,80,83,131,251,10 +.byte 15,140,7,0,0,0,88,5,7,0,0,0,80,88,5,48,0,0,0,106,1,80,89,91,186,1 +.byte 0,0,0,81,137,225,184,4,0,0,0,205,128,131,196,4,88,91,75,83,80,133 +.byte 219,117,191,88,88,195 +.global hexprint Index: sys.wth =================================================================== RCS file: /cvsroot/wisp/wisp/src/native/sys.wth,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- sys.wth 18 Sep 2002 20:58:07 -0000 1.10 +++ sys.wth 18 Sep 2002 21:01:03 -0000 1.11 @@ -6,6 +6,8 @@ ;; ;;;; @(#) $Id$ +(include io) + (include linux) (include wisptyp) @@ -25,8 +27,10 @@ (extern decui$1) (extern encsi$1) (extern encui$1) +(extern funcall) (extern salloc$1) (extern ws2zt) +(extern zt2ws) (macro decsi <: swap (flush) 'decsi$1 jump :>) (macro decui <: swap (flush) 'decui$1 jump :>) @@ -34,6 +38,7 @@ (macro encui <: swap (flush) 'encui$1 jump :>) (macro salloc <: swap (flush) 'salloc$1 jump :>) (macro ws->zt (flush) ws2zt (believe %eax) nip) +(macro zt->ws (flush) zt2ws (believe %eax) nip) (macro cons <: -rot (flush) 'cons$2 jump :>) @@ -299,30 +304,73 @@ sizeof.struct-termios require-string-length string-data sys.ioctl (flush) 'encsi$1 jump) +; Will return a pointer into the string. Modifying the result will +; modify the string. +(macro wstring->fdset + require-c8string + sizeof.fd_set require-string-length + string-data) + (native sys_fd_zero dup 0 = if drop sizeof.fd_set tag-fixnum else dup 1 = argc drop - require-c8string - sizeof.fd_set require-string-length - string-data FD_ZERO + wstring->fdset + FD_ZERO VOID then) +(macro rdecui ; ( node limit ) + over decui swap over swap + >= if drop 'WB_range swap go-raise then nip) + (native sys_fd_set dup 2 = argc drop - swap dup decui dup FD_SETSIZE >= if drop 'WB_range swap go-raise then - nip swap require-c8string sizeof.fd_set require-string-length - string-data FD_SET VOID) + swap FD_SETSIZE rdecui swap wstring->fdset FD_SET VOID) (native sys_fd_clr dup 2 = argc drop - swap dup decui dup FD_SETSIZE >= if drop 'WB_range swap go-raise then - nip swap require-c8string sizeof.fd_set require-string-length - string-data FD_CLR VOID) + swap FD_SETSIZE rdecui swap wstring->fdset FD_CLR VOID) (native sys_fd_isset dup 2 = argc drop - swap dup decui dup FD_SETSIZE >= if drop 'WB_range swap go-raise then - nip swap require-c8string sizeof.fd_set require-string-length - string-data FD_ISSET ->wisp-bool) + swap FD_SETSIZE rdecui swap wstring->fdset FD_ISSET ->wisp-bool) + +(native sys_ns_select dup 6 = argc drop + ; ( n readfds writefds exceptfds sec usec ) + 5 dig FD_SETSIZE rdecui 5 bury + 4 dig dup FALSE <> if wstring->fdset else drop 0 then 4 bury + 3 dig dup FALSE <> if wstring->fdset else drop 0 then 3 bury + 2 dig dup FALSE <> if wstring->fdset else drop 0 then 2 bury + sizeof.struct-timeval.aligned 6 allocate + -rot over FALSE <> if + swap decui swap 1000000 rdecui + rot swap over timeval.usec! + swap over timeval.sec! + else + drop drop drop 0 + then + sys.select + sizeof.struct-timeval.aligned 1 deallocate + (flush) 'encsi$1 jump) + +(macro sfde-bufsize + sizeof.struct-dirent.aligned 2 *) + +(native sys_ns_for_dir_entries dup 2 = argc drop + decui sfde-bufsize 2 allocate + ; ( proc fd de ) + begin 2dup sfde-bufsize sys.getdents dup 0 > while + over + ; ( proc fd de res dirp ) + begin over while + dup dirent.name zt->ws + over dirent.ino@ encui + <: -rot 2 8 dig (conform %ecx %eax) ,(jmp funcall) :> (believe %eax) + drop dup dirent.reclen@ swap over + -rot - swap + repeat + drop drop + repeat + nip nip nip + sfde-bufsize 1 deallocate + (flush) 'encsi$1 jump) ; vim: ft=worth Index: wrap.nasm =================================================================== RCS file: /cvsroot/wisp/wisp/src/native/wrap.nasm,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- wrap.nasm 7 Sep 2002 22:03:56 -0000 1.60 +++ wrap.nasm 18 Sep 2002 21:01:03 -0000 1.61 @@ -78,13 +78,10 @@ native_wrapper prstring2symbol, 1, node native_wrapper prsymbol2string, 1, node ; CAUTION! native_wrapper rat2cons, 1, node -native_wrapper realloc, GC_realloc, 2, node ;; VERY DANGEROUS! native_wrapper remainder, 2, node native_wrapper rvec_set, 2, void native_wrapper salloc, GC_malloc_atomic, 1, node ;; VERY DANGEROUS! native_wrapper strcomp, 2, node -native_wrapper sys_for_dir_entries, 2, node -native_wrapper sys_select, 6, node native_wrapper truncate, trunc, 1, node native_wrapper unsigned_get_bit, 2, node native_wrapper ws2zt, 1, node Index: wstrings.s =================================================================== RCS file: /cvsroot/wisp/wisp/src/native/wstrings.s,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- wstrings.s 18 Sep 2002 21:00:08 -0000 1.2 +++ wstrings.s 18 Sep 2002 21:01:03 -0000 1.3 @@ -7,6 +7,18 @@ .equiv NN_c8string_huh, N_c8string_huh + 1 .section .text .align 16 +N_string_huh: +.byte 144,81,131,249,1,15,132,8,0,0,0,88,137,193,233 +.long N_signal_argcount - (.+4) +.byte 88,88,137,195,131,227,3,80,133,219,15,132,8,0,0,0,88,106,19,233,22 +.byte 0,0,0,88,80,133,192,15,133,8,0,0,0,88,106,19,233,4,0,0,0,88,139,0 +.byte 80,88,80,61,9,0,0,0,15,133,8,0,0,0,88,106,11,233,24,0,0,0,88,80,61 +.long RT_c16string +.byte 15,133,8,0,0,0,88,106,11,233,3,0,0,0,88,106,19,88,195 +.global N_string_huh,NN_string_huh +.equiv NN_string_huh, N_string_huh + 1 +.section .text +.align 16 N_c16string_huh: .byte 144,186 .long RT_c16string Index: wstrings.wth =================================================================== RCS file: /cvsroot/wisp/wisp/src/native/wstrings.wth,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- wstrings.wth 18 Sep 2002 21:00:08 -0000 1.2 +++ wstrings.wth 18 Sep 2002 21:01:03 -0000 1.3 @@ -27,6 +27,17 @@ (native c16string_huh 'RT_c16string go-discriminate) +(native string_huh dup 1 = argc drop + get-type dup NC_C8STRING = if + drop TRUE + else + dup 'RT_c16string = if + drop TRUE + else + drop FALSE + then + then) + (macro decsi <: swap (flush) 'decsi$1 jump :>) (macro decui <: swap (flush) 'decui$1 jump :>) (macro encsi <: swap (flush) 'encsi$1 jump :>) |