mirror of
https://github.com/nineties/planckforth
synced 2024-12-25 21:58:22 +01:00
rename implementation to version
This commit is contained in:
parent
226d6d33f3
commit
419d0d2cb9
5 changed files with 12 additions and 12 deletions
|
@ -85,4 +85,4 @@ $ ./planck < bootstrap.fs example/fib.fs
|
|||
| } | shr | ( a b -- c ) | c = a >> b (logical) |
|
||||
| ) | sar | ( a b -- c ) | c = a >> b (arithmetic) |
|
||||
| v | argv | ( -- a-addr u ) | argv and argc |
|
||||
| V | impl | ( -- c-addr ) | Implementation String |
|
||||
| V | version | ( -- c-addr ) | Version String |
|
||||
|
|
|
@ -458,7 +458,7 @@ alias-builtin and &
|
|||
alias-builtin or |
|
||||
alias-builtin xor ^
|
||||
alias-builtin u< u
|
||||
alias-builtin implementation V
|
||||
alias-builtin version V
|
||||
|
||||
\ Rename existing FORTH words
|
||||
: >cfa G ;
|
||||
|
@ -2070,7 +2070,7 @@ v argc ! argv !
|
|||
|
||||
( === Environment-Dependent Code === )
|
||||
|
||||
implementation s" hand-written i386-linux" streq [if]
|
||||
version s" hand-written i386-linux" streq [if]
|
||||
|
||||
%000 constant eax immediate
|
||||
%001 constant ecx immediate
|
||||
|
@ -2401,7 +2401,7 @@ need-defined (read)
|
|||
|
||||
words id. name>string name>link
|
||||
include included source >in
|
||||
next-arg shift-args arg argv argc implementation
|
||||
next-arg shift-args arg argv argc version
|
||||
|
||||
[if] [unless] [else] [then] defined?
|
||||
open-file close-file write-file flush-file
|
||||
|
@ -2457,7 +2457,7 @@ need-defined (read)
|
|||
next-arg dup argv @ !
|
||||
included
|
||||
else
|
||||
." PlanckForth (implementation: " implementation type ." )" cr
|
||||
." PlanckForth (" version type ." )" cr
|
||||
." Ready." cr
|
||||
s" /dev/tty" included
|
||||
then
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define IMPLEMENTATION "C"
|
||||
#define VERSION "C"
|
||||
|
||||
typedef uintptr_t cell;
|
||||
typedef void (**cfa)();
|
||||
|
@ -143,7 +143,7 @@ defcode("t", type) { putchar(pop()); next(); }
|
|||
defcode("x", exec) { (*(ip = (cfa) pop()))(); }
|
||||
defcode("f", find_) { push((cell) find(pop())); next(); }
|
||||
defcode("v", argv_) { push((cell) saved_argv); push(saved_argc); next(); }
|
||||
defcode("V", impl) { push((cell) IMPLEMENTATION); next(); }
|
||||
defcode("V", impl) { push((cell) VERSION); next(); }
|
||||
defcode("/", divmod) {
|
||||
intptr_t b = pop();
|
||||
intptr_t a = pop();
|
||||
|
|
|
@ -9,7 +9,7 @@ import operator
|
|||
import array
|
||||
import ctypes
|
||||
|
||||
IMPLEMENTATION = "Python 3.x"
|
||||
VERSION = "Python 3.x"
|
||||
MEMORY_SIZE = 0x10000
|
||||
|
||||
memory = array.array('i', [0]*MEMORY_SIZE)
|
||||
|
@ -169,8 +169,8 @@ for addr in argv_addrs:
|
|||
comma(addr)
|
||||
|
||||
# Version String
|
||||
IMPLEMENTATION_ADDR = read(HERE_CELL)
|
||||
comma_string(IMPLEMENTATION)
|
||||
VERSION_ADDR = read(HERE_CELL)
|
||||
comma_string(VERSION)
|
||||
align()
|
||||
|
||||
def docol(ip, np):
|
||||
|
@ -239,7 +239,7 @@ def argv():
|
|||
push(ARGV_ADDR)
|
||||
push(len(sys.argv))
|
||||
add_simple_operator('v', argv)
|
||||
add_simple_operator('V', lambda: push(IMPLEMENTATION_ADDR))
|
||||
add_simple_operator('V', lambda: push(VERSION_ADDR))
|
||||
|
||||
SUCCESS = 0
|
||||
ALLOCATE_ERROR = -59
|
||||
|
|
|
@ -168,7 +168,7 @@
|
|||
000003b8: 0408 89c3 83c3 0453 movl %eax,%ebx; addl $4,%ebx; pushl %ebx
|
||||
000003c0: ff30 adff 2000 0000 pushl (%eax); next;
|
||||
|
||||
000003c8: a883 0408 0156 0000 V: implementation
|
||||
000003c8: a883 0408 0156 0000 V: version
|
||||
000003d0: d483 0408 68dc 8304 pushl $version
|
||||
000003d8: 08ad ff20 6861 6e64 next; <version>hand
|
||||
000003e0: 2d77 7269 7474 656e -written
|
||||
|
|
Loading…
Reference in a new issue