X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=stdio.asm;h=3f69cd3b1c42bcdef0a0dc294902a84b789851d5;hb=af617c57b198d0b1e55e77ed2e67c57365007f29;hp=658e42f1364f40f49a83e0de708bdc357fca9b2d;hpb=26055b00fd17f803cf80d1ebce450db6c2159af7;p=rrq%2Frrqforth.git diff --git a/stdio.asm b/stdio.asm index 658e42f..3f69cd3 100644 --- a/stdio.asm +++ b/stdio.asm @@ -11,7 +11,7 @@ push qword 0 ; address of mapping (suggestion) push rax ; length of mapping push qword 3 ; protection mode PROT_READ | PROT_WRITE - push qword 8226 ; flags PRIVATE | ANONYMOUS | LOCKED + push qword 34 ; flags PRIVATE | ANONYMOUS push qword -1 ; fd -1 push qword 0 ; offset jmp sys_mmap_asm ; exit via sys_mmap @@ -214,12 +214,14 @@ p_read_word_nomore: WORD p_double_quote,'"',fasm ;; " (fool emacs) ;; ( -- char* n ) - ;; Scan to double quote in stream buffer, putting the string on PAD + ;; Scan to double quote in stream buffer, putting the string + ;; on PAD, plus an extra NUL, then copy that into a new temp + ;; object, but exclude the NUL from the returned count, n. pushr rsi push p_pad_DFA push 0 p_double_quote_loop: - DOFORTH p_stdin, p_read_stream_char + DOFORTH p_input, p_get, p_read_stream_char pop rax cmp rax,0 jl p_double_quote_endstream @@ -232,6 +234,14 @@ p_double_quote_loop: jmp p_double_quote_loop p_double_quote_endquote: p_double_quote_endstream: + mov qword [rdi],0 + lea rdi,[p_pad_DFA] + add rdi,qword [rsp] + ;; copy PAD string into new temp object + inc qword [rsp] + DOFORTH p_str2temp + dec qword [rsp] + add qword [rsp+8],8 ; adjust pointer popr rsi next