Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for recent gcc and gforth #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion forth.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// A simple Reference implementation
// for the Raillisp Forth Specification.

#include <readline/readline.h>
#include <stdio.h>
#include <readline/readline.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
Expand Down
17 changes: 15 additions & 2 deletions raillisp.fth
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,21 @@ defer lisp-read-lisp
r> drop ( drop tail) r> ( return first)
then ;

: lisp-s>number? ( a u -- n o b )
\ s>number?, except that - is not considered a number
dup 1 = if
drop dup c@ [char] - = if
drop 0 0 0
else
1 s>number?
then
else
s>number?
then
;

: lisp-read-symbol ( e a -- e a lisp )
lisp-read-token 2dup s>number? if
lisp-read-token 2dup lisp-s>number? if
drop tag-num nip nip
else
2drop 2dup s" nil" compare 0= if
Expand Down Expand Up @@ -1511,7 +1524,7 @@ s" command-line-args" str-intern sym>value _command-line-args !
r> -rot r> cmove )

1 (defun str->int ( lisp - lisp )
symbol->string s>number? if drop tag-num else nil then )
symbol->string lisp-s>number? if drop tag-num else nil then )

1 (defun make-empty-vec ( n - )
\ Contains uninitialized lisp objects. Should ever be printed.
Expand Down