Commit 1cec9b7f authored by pazsan's avatar pazsan

Minor fixes for SHARC

KEY returns now EOF (-1) when at end of file (non-standard?)
parent 6d9de8d5
......@@ -171,6 +171,7 @@ EC_SRC = \
GFORTH_FI_SRC = \
assert.fs \
backtrace.fs \
blocked.fb \
blocks.fs \
bufio.fs \
......@@ -427,6 +428,7 @@ binonlydist: Makedist FORCE
install: gforth$(EXE) $(FORTH_SRC) $(kernel_fi) gforth.fi gforthmi doc/gforth.1 prim install.TAGS installdirs
touch $(siteforthdir)/siteinit.fs
-$(RM) $(bindir)/gforth$(EXE) $(bindir)/gforth-$(VERSION)$(EXE) $(bindir)/gforthmi
-$(RM) $(bindir)/gforth-fast$(EXE) $(bindir)/gforth-fast-$(VERSION)$(EXE) $(bindir)/gforthmi
$(INSTALL_PROGRAM) -s gforth$(EXE) $(bindir)/gforth-$(VERSION)$(EXE)
$(LN_S) $(bindir)/gforth-$(VERSION)$(EXE) $(bindir)/gforth$(EXE)
$(INSTALL_PROGRAM) -s gforth-fast$(EXE) $(bindir)/gforth-fast-$(VERSION)$(EXE)
......
......@@ -1252,7 +1252,7 @@ Cond: ['] T ' H alit, ;Cond
: (lit,) ( n -- ) compile lit T , H ; ' (lit,) IS lit,
: (alit,) ( n -- ) lit, T here cell - H relon ; ' (alit,) IS alit,
: (alit,) ( n -- ) compile lit T a, H ; ' (alit,) IS alit,
: (fini,) compile ;s ; ' (fini,) IS fini,
......@@ -1804,7 +1804,7 @@ Cond: S" restrict? compile (S") T ," H ;Cond
Cond: ABORT" restrict? compile (ABORT") T ," H ;Cond
Cond: IS T ' >body H compile ALiteral compile ! ;Cond
: IS T ' >body ! H ;
: IS T >address ' >body ! H ;
Cond: TO T ' >body H compile ALiteral compile ! ;Cond
: TO T ' >body ! H ;
......
......@@ -666,7 +666,7 @@ long key_avail (FILE * stream)
/* When compiling and running in the `Posix' environment, Ultrix does
not restart system calls, so this needs to do it. */
unsigned char getkey(FILE * stream)
unsigned getkey(FILE * stream)
{
int result;
unsigned char c;
......@@ -683,7 +683,7 @@ unsigned char getkey(FILE * stream)
/* If zero characters are returned, then the file that we are
reading from is empty! Return EOF in that case. */
if (result == 0)
return CTRL('D');
return (EOF);
/* If the error that we received was SIGINT, then try again,
this is simply an interrupted system call to read ().
......
......@@ -31,7 +31,7 @@ extern jmp_buf throw_jmp_buf;
# define key(stdin) getch()
# define key_query(stdin) FLAG(kbhit())
#else
unsigned char getkey(FILE *);
unsigned getkey(FILE *);
long key_avail(FILE *);
void prep_terminal(void);
void deprep_terminal(void);
......
......@@ -73,9 +73,12 @@ int die_on_signal=0;
#ifndef INCLUDE_IMAGE
static int clear_dictionary=0;
static size_t pagesize=0;
char *progname;
#else
char *progname = "gforth";
int optind = 1;
#endif
static int debug=0;
char *progname;
/* image file format:
* "#! binary-path -i\n" (e.g., "#! /usr/local/bin/gforth-0.4.0 -i\n")
......@@ -165,6 +168,7 @@ void relocate(Cell *image, const char *bitstring, int size, Label symbols[])
image[i]+=(Cell)image;
}
}
((ImageHeader*)(image))->base = image;
}
UCell checksum(Label symbols[])
......@@ -685,7 +689,9 @@ int main(int argc, char **argv, char **env)
#ifdef INCLUDE_IMAGE
set_stack_sizes((ImageHeader *)image);
relocate(image, reloc_bits, ((ImageHeader*)&image)->image_size, (Label*)engine(0, 0, 0, 0, 0));
if(((ImageHeader *)image)->base != image)
relocate(image, reloc_bits, ((ImageHeader *)image)->image_size,
(Label*)engine(0, 0, 0, 0, 0));
alloc_stacks((ImageHeader *)image);
#else
image_file = open_image_file(imagename, path);
......
......@@ -40,7 +40,7 @@ defer everychar
: decode ( max span addr pos1 key -- max span addr pos2 flag )
everychar
dup #del = IF drop #bs THEN \ del is rubout
dup bl < IF cells ctrlkeys + perform EXIT THEN
dup bl u< IF cells ctrlkeys + perform EXIT THEN
>r 2over = IF rdrop bell 0 EXIT THEN
r> insert-char 0 ;
......
......@@ -632,7 +632,7 @@ Variable init8
[ has? os [IF] ]
r0 @ forthstart 6 cells + @ -
[ [ELSE] ]
sp@ $40 +
sp@ $10 cells +
[ [THEN] ]
[ [THEN] ]
dup >tib ! tibstack ! #tib off >in off ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment