From 1f159338ae285680863150605167fea32aa74aca Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Wed, 10 Oct 2012 06:52:54 -0600 Subject: [PATCH] Imported Upstream version 0.2.0+beta --- LICENSE | 16 ++++++++++++ Makefile | 12 ++++----- README | 36 +++++++++---------------- block.c | 20 ++++++++++---- block.h | 20 ++++++++++---- blocke.c | 20 ++++++++++---- blocke.h | 20 ++++++++++---- config.h | 51 +++++++++++++++++++++++++++--------- core.c | 20 ++++++++++---- core.h | 20 ++++++++++---- coree.c | 25 +++++++++++++----- coree.h | 21 +++++++++++---- division.c | 28 +++++++++++++++++++- double.c | 20 ++++++++++---- double.h | 20 ++++++++++---- doublee.c | 20 ++++++++++---- doublee.h | 20 ++++++++++---- errors.h | 20 ++++++++++---- exceptio.c | 20 ++++++++++---- exceptio.h | 20 ++++++++++---- facility.c | 20 ++++++++++---- facility.h | 20 ++++++++++---- file.c | 22 +++++++++++----- file.h | 20 ++++++++++---- filee.c | 20 ++++++++++---- filee.h | 20 ++++++++++---- float.c | 20 ++++++++++---- float.h | 20 ++++++++++---- floate.c | 20 ++++++++++---- floate.h | 20 ++++++++++---- hello.yf | 5 ++++ locals.c | 20 ++++++++++---- locals.h | 20 ++++++++++---- localse.c | 20 ++++++++++---- localse.h | 20 ++++++++++---- memall.c | 20 ++++++++++---- memall.h | 20 ++++++++++---- search.c | 20 ++++++++++---- search.h | 20 ++++++++++---- searche.c | 20 ++++++++++---- searche.h | 20 ++++++++++---- string.c | 20 ++++++++++---- string.h | 20 ++++++++++---- tools.c | 20 ++++++++++---- tools.h | 20 ++++++++++---- toolse.c | 20 ++++++++++---- toolse.h | 20 ++++++++++---- udio.c | 77 +++++++++++++++++++----------------------------------- udio.h | 20 ++++++++++---- ver.h | 24 ++++++++++++----- vm.c | 20 ++++++++++---- ycore.c | 20 ++++++++++---- ycore.h | 20 ++++++++++---- yfinit.c | 20 ++++++++++---- yforth.1 | 17 ++++++++++++ yforth.c | 30 ++++++++++++++------- yforth.h | 24 ++++++++++++----- yfvinit.c | 20 ++++++++++---- 58 files changed, 913 insertions(+), 355 deletions(-) create mode 100644 LICENSE create mode 100644 hello.yf create mode 100644 yforth.1 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..de4d48e --- /dev/null +++ b/LICENSE @@ -0,0 +1,16 @@ +yForth? - A Forth interpreter written in ANSI C +Copyright (C) 2012 Luca Padovani + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + diff --git a/Makefile b/Makefile index f5d2108..5e0fddb 100644 --- a/Makefile +++ b/Makefile @@ -12,16 +12,14 @@ INCLUDES = block.h blocke.h config.h core.h coree.h defaults.h double.h \ floate.h locals.h localse.h macro.h memall.h search.h searche.h \ string.h tools.h toolse.h udio.h ver.h ycore.h yforth.h -all: - make div - make yforth - -yforth: $(OBJECTS) - $(CC) $(MATHLIB) -o yforth $(OBJECTS) +yforth: div.h $(OBJECTS) + $(CC) -o yforth $(OBJECTS) $(MATHLIB) +div.h: div + ./div + div: division.c $(CC) -o div division.c - div > div.h .c.o: $(CC) -c -o $@ $(OPTIMIZE) $< diff --git a/README b/README index 95d5713..1ec1bde 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -yForth? v0.1beta - READ THIS (AND ONLY THIS) TO GET yForth? RUNNING. +yForth? v0.2+beta - READ THIS (AND ONLY THIS) TO GET yForth? RUNNING. 0) Hello world! Here's a little file which will help you having yForth? running in few @@ -23,11 +23,6 @@ In fact, you'll find that all the device dependent routines are grouped together in the file "udio.c". If you're using Turbo C, Borland C, or any compiler which supplies the "conio.h", you can define HAVE_CONIO in your "config.h" file and go. -Note that even if in file "udio.c" you'll see some lines telling you: -#ifdef HAVE_CURSES -or similar, yForth? actually doesn't support CURSES library. I've decided to -stop my work as soon as something machine depended that was too messy has -came around. 2) Where does the name yForth? came from? I've been charmed by Forth since the first time I "played" with it, but @@ -58,17 +53,15 @@ type which allows having 32bit Cells. Using Turbo C that's not possible. Below data definition you'll have to change the maximum values of your system. See "limits.h". - terminal -Finally, define HAVE_CONIO if you're using Turbo C, Borland C or GCC for DOS. -You'll have some nice words such as "page"... +Finally, define HAVE_CONIO to 1 if you're using Turbo C, Borland C or GCC +for DOS. You'll have some nice words such as "page"... - special functions "asinh", "acosh", "atanh" aren't provided by all the libraries, if you don't -have them delete the definitions at the end of "config.h". +have them reset the definitions at the end of "config.h". -The second thing to do now is configuring the "Makefile". I know, it's rude, -but yForth? is drifting on my system for too long, I want to finish it -within 1996. -At the moment "Makefile" is ready for GCC (under Linux), it's simple and -you won't find any problem modifying it. +The second thing to do now is configuring the "Makefile". At the moment +"Makefile" is ready for GCC (under Linux), it's simple and you won't find any +problem modifying it. Third, type "make all". Yes, that's all. @@ -94,10 +87,6 @@ Don't forget: - yForth? is a "beta" release, I think it has bugs, but, most important, I'm afraid that some words don't behave as the standard says they have to. - - yForth? comes with no warranty, I don't make any warranty about it. - - yForth? is completely free. You can use, modify, doing anything - you want with it. If you're going to use it in any project, - I would be grateful if you cite me, but you're no obliged. - yForth? is NOT a complete ANS Forth. - yForth? is written in ANSI C. Ok, you could see some warning while compiling it, and I've to check it with lint, but it @@ -119,12 +108,11 @@ I'll be very happy if you report me some bug. Obviously I'll be happy even more if you tell me how fo fix it, but I can't pretend so much, even 'cause my C is not very readable (few comments...). -8) Who am I? -Luca Padovani -v. Cormons, 12 -48100 Ravenna (RA) -Italy - email: lpadovan@cs.unibo.it Enjoy yForth? + +********************************************************************** + CONTRIBUTORS +********************************************************************** + diff --git a/block.c b/block.c index 1d98967..ab807fd 100644 --- a/block.c +++ b/block.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: block.c * Abstract: Block word set implementation diff --git a/block.h b/block.h index fbf507b..9580087 100644 --- a/block.h +++ b/block.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: block.h * Abstract: Block word set header file diff --git a/blocke.c b/blocke.c index 71c9cbc..3a60287 100644 --- a/blocke.c +++ b/blocke.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: blocke.c * Abstract: Block extension word set diff --git a/blocke.h b/blocke.h index 8751091..c10b405 100644 --- a/blocke.h +++ b/blocke.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: blocke.h * Abstract: Block extension include file diff --git a/config.h b/config.h index 9bae024..22e6b1b 100644 --- a/config.h +++ b/config.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: config.h * Abstract: configuration file. Before any compilation please check @@ -15,6 +25,8 @@ * excluded word lists may be linked to final code if used by other words. */ +#include + #define COREE_DEF 1L #define DOUBLE_DEF 1L #define DOUBLEE_DEF 1L @@ -62,7 +74,11 @@ * Note that some compilers have LITTLE_ENDIAN yet defined. */ #ifndef LITTLE_ENDIAN +# if __BYTE_ORDER == __LITTLE_ENDIAN # define LITTLE_ENDIAN +# else +# undef LITTLE_ENDIAN +# endif #endif /* When DCELL_MEM is defined, double cell transfer is realized by memory @@ -77,9 +93,15 @@ * Under Linux, Cell may be "int" and DCell "long long". */ -#define Cell int +/* this might work for other 64 bit architectures, too? */ +#if defined(__alpha__) +# define Cell long +#else +# define Cell int +#endif /* __alpha__ */ + #define Char char -#define Real long double +#define Real float #define UCell unsigned Cell #define DCell long long @@ -102,8 +124,13 @@ #define MAX_F 0.0 /* Some compilers doesn't provide some functions in the standard library. - * If you don't have, undefine them - */ -#define HAVE_ACOSH -#define HAVE_ASINH -#define HAVE_ATANH + * If you don't have, turn 1s into 0s + */ +#define HAVE_ACOSH 1 +#define HAVE_ASINH 1 +#define HAVE_ATANH 1 + +/* Set following define to 1 if you're compiling under Turbo C, Borland C, + * or GCC for DOS. + */ +#define HAVE_CONIO 0 diff --git a/core.c b/core.c index 38a9d8a..1cdc2d9 100644 --- a/core.c +++ b/core.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: core.c * Abstract: Core word set diff --git a/core.h b/core.h index 86994de..3c0082c 100644 --- a/core.h +++ b/core.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: core.h * Abstract: include file for "core" word set diff --git a/coree.c b/coree.c index 8acd708..cf7eef6 100644 --- a/coree.c +++ b/coree.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: coree.c * Abstract: Core extension word set @@ -159,15 +169,16 @@ void _nip() { } void _parse() { - register Char delim = (Char) *sp; + register Char delim = (Char) *sp; register Char *orig = &_input_buffer[_to_in]; register int i = 0; while (_to_in < _in_input_buffer && _input_buffer[_to_in] != delim) { _to_in++; i++; } - *sp = (Cell) orig; + *sp = (Cell)orig; *--sp = i; + if (_to_in < _in_input_buffer) _to_in++; } diff --git a/coree.h b/coree.h index c43a185..0f17df6 100644 --- a/coree.h +++ b/coree.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: coree.h * Abstract: Include file for "core-extension" word set @@ -67,6 +77,7 @@ code(u_greater_than, "u>", 0) code(unused, "unused", 0) code(within, "within", 0) code(backslash, "\\", IMMEDIATE) +code(backslash, "#!", IMMEDIATE) code(bracket_compile, "[compile]", COMP_ONLY) code(value, "value", 0) code(to, "to", IMMEDIATE) diff --git a/division.c b/division.c index 2a40498..cff3160 100644 --- a/division.c +++ b/division.c @@ -1,2 +1,28 @@ +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include -main() { printf("#define FLOORED_DIVISION %d\n", (-10 % 7) > 0 ? 1 : 0); } +#include +#include + +main() { + FILE *f = fopen("div.h", "wt"); + assert(f != NULL); + fprintf(f, "#define FLOORED_DIVISION %d\n", (-10 % 7) > 0 ? 1 : 0); + fclose(f); + return 0; +} diff --git a/double.c b/double.c index 631417d..9a35d99 100644 --- a/double.c +++ b/double.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: double.c * Abstract: double-number word set diff --git a/double.h b/double.h index 57e663b..79f7bd8 100644 --- a/double.h +++ b/double.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: double.h * Abstract: include file for "double-numbers" word set diff --git a/doublee.c b/doublee.c index a6de708..fe33ad0 100644 --- a/doublee.c +++ b/doublee.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: doublee.c * Abstract: double-extension word set diff --git a/doublee.h b/doublee.h index 81845c6..4c5f6d3 100644 --- a/doublee.h +++ b/doublee.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: doublee.h * Abstract: include file for "double-number extension" word set diff --git a/errors.h b/errors.h index 4df4e47..d3d080f 100644 --- a/errors.h +++ b/errors.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: errors.h * Abstract: definitions for system error codes diff --git a/exceptio.c b/exceptio.c index 5acaa57..0400340 100644 --- a/exceptio.c +++ b/exceptio.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: exceptio.c * Abstract: exception word set diff --git a/exceptio.h b/exceptio.h index 219dcd5..25280a4 100644 --- a/exceptio.h +++ b/exceptio.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: exceptio.h * Abstract: include file for "exception" word set diff --git a/facility.c b/facility.c index dd8aed9..30fd075 100644 --- a/facility.c +++ b/facility.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: facility.c * Abstract: facility word set diff --git a/facility.h b/facility.h index d121150..3b97e56 100644 --- a/facility.h +++ b/facility.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: facility.h * Abstract: include file for "facility" word set diff --git a/file.c b/file.c index ec01a2d..bb1b504 100644 --- a/file.c +++ b/file.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: file.c * Abstract: File word set @@ -208,7 +218,7 @@ void _write_line() { /**************************************************************************/ Cell truncate_file(FILE *f, UDCell cur, UDCell ud) { - if (cur == cur && fseek(f, ud, SEEK_SET)) return (errno); + if (fseek(f, ud, SEEK_SET)) return (errno); else return (0); } diff --git a/file.h b/file.h index 3f05c47..d2a315a 100644 --- a/file.h +++ b/file.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: file.h * Abstract: File word-set include file diff --git a/filee.c b/filee.c index 60e151d..bd3c665 100644 --- a/filee.c +++ b/filee.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: filee.c * Abstract: File extension word set diff --git a/filee.h b/filee.h index f3523a8..274e1aa 100644 --- a/filee.h +++ b/filee.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: filee.h * Abstract: Include file for "File extension" word set diff --git a/float.c b/float.c index cb93112..7311f53 100644 --- a/float.c +++ b/float.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: float.c * Abstract: floating word set diff --git a/float.h b/float.h index c192ece..1e924f2 100644 --- a/float.h +++ b/float.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: float.h * Abstract: include file for "floating" word set diff --git a/floate.c b/floate.c index 2e110c1..39739d2 100644 --- a/floate.c +++ b/floate.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: floate.c * Abstract: floating-extension word set diff --git a/floate.h b/floate.h index 1352314..e97cf7e 100644 --- a/floate.h +++ b/floate.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: floate.h * Abstract: include file for "floating-extension" word set diff --git a/hello.yf b/hello.yf new file mode 100644 index 0000000..9211feb --- /dev/null +++ b/hello.yf @@ -0,0 +1,5 @@ +#! /usr/bin/yforth +\ +\ a simple example of a yforth script +\ +.( Hello World!) cr bye diff --git a/locals.c b/locals.c index 94d9e56..1fe9bdb 100644 --- a/locals.c +++ b/locals.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: locals.c * Abstract: locals word set diff --git a/locals.h b/locals.h index d007b14..e8080bd 100644 --- a/locals.h +++ b/locals.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: locals.h * Abstract: include file for "locals" word set diff --git a/localse.c b/localse.c index 7e3b821..06b92ac 100644 --- a/localse.c +++ b/localse.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: localse.c * Abstract: locals-extension word set diff --git a/localse.h b/localse.h index f55ea78..1d4e7a8 100644 --- a/localse.h +++ b/localse.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: localse.h * Abstract: include file for "locals-extension" word set diff --git a/memall.c b/memall.c index 2ede4fc..1aee1b6 100644 --- a/memall.c +++ b/memall.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: memall.c * Abstract: Memory allocation word set diff --git a/memall.h b/memall.h index bd4bb92..d50ca62 100644 --- a/memall.h +++ b/memall.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: memall.h * Abstract: Include file for "Memory Allocation" word set diff --git a/search.c b/search.c index 04d17ee..a09dad1 100644 --- a/search.c +++ b/search.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: * Abstract: diff --git a/search.h b/search.h index 3c8ff4d..7fe616f 100644 --- a/search.h +++ b/search.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: * Abstract: diff --git a/searche.c b/searche.c index 7bb57ed..943c3ad 100644 --- a/searche.c +++ b/searche.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: * Abstract: diff --git a/searche.h b/searche.h index 9f186a8..f4b1004 100644 --- a/searche.h +++ b/searche.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: * Abstract: diff --git a/string.c b/string.c index 6979a40..a1ef85b 100644 --- a/string.c +++ b/string.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: * Abstract: diff --git a/string.h b/string.h index 7d600b1..40554fd 100644 --- a/string.h +++ b/string.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: * Abstract: diff --git a/tools.c b/tools.c index 2a5d110..fb28edd 100644 --- a/tools.c +++ b/tools.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: tools.c * Abstract: Programming Tools word set diff --git a/tools.h b/tools.h index f6f5048..2217fd8 100644 --- a/tools.h +++ b/tools.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: tools.h * Abstract: Include file for "Programming Tools" word set diff --git a/toolse.c b/toolse.c index 2ea7098..b0893a8 100644 --- a/toolse.c +++ b/toolse.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: toolse.c * Abstract: Programming Tools extension word set diff --git a/toolse.h b/toolse.h index 4c2b060..54b72f3 100644 --- a/toolse.h +++ b/toolse.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: toolse.h * Abstract: Include file for "Programming Tools extension" word set diff --git a/udio.c b/udio.c index d3873a2..4029995 100644 --- a/udio.c +++ b/udio.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: udio.c * Abstract: User Device Input/Output functions. Here are enclosed all @@ -10,77 +20,59 @@ */ #include "yforth.h" -#ifdef HAVE_CONIO +#if HAVE_CONIO # include -#elifdef HAVE_CURSES -# include #endif #include "udio.h" /* d_clrscr: clear the screen */ void d_clrscr() { -#ifdef HAVE_CONIO +#if HAVE_CONIO clrscr(); -#elifdef HAVE_CURSES - clear(); #endif } /* d_clreol: clear to end of line */ void d_clreol() { -#ifdef HAVE_CONIO +#if HAVE_CONIO clreol(); -#elifdef HAVE_CURSES - clrtoeol(); #endif } /* d_setattr: set default attributes */ void d_setaddr(Cell attr) { -#ifdef HAVE_CONIO +#if HAVE_CONIO textattr(attr); -#elifdef HAVE_CURSES #endif } /* d_getattr: get default attributes */ Cell d_getattr() { -#ifdef HAVE_CONIO +#if HAVE_CONIO struct text_info ti; gettextinfo(&ti); return (ti.attribute); -#elifdef HAVE_CURSES #endif } /* d_gotoxy: move the cursor to the location (x, y) of the screen */ void d_gotoxy(Cell x, Cell y) { -#ifdef HAVE_CONIO +#if HAVE_CONIO gotoxy(x, y); -#elifdef HAVE_CURSES - move(y, x); #endif } /* d_wherex: current column position of the cursor */ Cell d_wherex() { -#ifdef HAVE_CONIO +#if HAVE_CONIO return (wherex()); -#elifdef HAVE_CURSES - int x, y; - getyx(stdscr, y, x); - return ((Cell) x); #endif } /* d_wherey: current row position of the cursor */ Cell d_wherey() { -#ifdef HAVE_CONIO +#if HAVE_CONIO return (wherey()); -#elifdef HAVE_CURSES - int x, y; - getyx(stdscr, y, x); - return ((Cell) y); #endif } @@ -89,39 +81,24 @@ Cell d_wherey() { * Return */ Char d_getch() { -#ifdef HAVE_CONIO - return (getch()); -#elifdef HAVE_CURSES +#if HAVE_CONIO return (getch()); #endif } /* d_kbhit: return True if a character is available */ Cell d_kbhit() { -#ifdef HAVE_CONIO +#if HAVE_CONIO return (kbhit()); -#elifdef HAVE_CURSES - return (1); -#endif +#endif } /* d_open: Initialize the Input/Output device */ void d_open() { -#ifdef HAVE_CURSES - initscr(); - cbreak(); - noecho(); - nonl(); - /* intrflush(stdscr, FALSE); */ - /* keypad(stdscr, TRUE); */ -#endif -} +} /* d_close: make some work when program finish to restore Input/Output device */ void d_close() { -#ifdef HAVE_CURSES - endwin(); -#endif } diff --git a/udio.h b/udio.h index 6f150bb..e4098aa 100644 --- a/udio.h +++ b/udio.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: udio.h * Abstract: User device Input/Output functions. diff --git a/ver.h b/ver.h index 14fa71b..3782906 100644 --- a/ver.h +++ b/ver.h @@ -1,14 +1,24 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: ver.h * Abstract: yForth? version definition */ #define VER_HI 0 -#define VER_LO 1 -#define VER_TEST "beta" +#define VER_LO 2 +#define VER_TEST "+beta" diff --git a/vm.c b/vm.c index 97ec591..11e7b74 100644 --- a/vm.c +++ b/vm.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: vm.c * Abstract: The Virtual Machine on which is based the whole diff --git a/ycore.c b/ycore.c index 4e37d5e..d3acd6d 100644 --- a/ycore.c +++ b/ycore.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: ycore.c * Abstract: Words defined for this particular implementation of diff --git a/ycore.h b/ycore.h index 340b122..e458f35 100644 --- a/ycore.h +++ b/ycore.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: ycore.h * Abstract: YCore word set (non-standard words specific to yForth?. Don't diff --git a/yfinit.c b/yfinit.c index b652801..0b81e56 100644 --- a/yfinit.c +++ b/yfinit.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: yfinit.c * Abstract: Allocate memory for the main structures of the diff --git a/yforth.1 b/yforth.1 new file mode 100644 index 0000000..79fbdd9 --- /dev/null +++ b/yforth.1 @@ -0,0 +1,17 @@ +.TH YFORTH 1 +.SH NAME +yforth \- a small, free Forth implementation +.SH SYNOPSIS +.B yforth +.SH DESCRIPTION +This is a small implementation of the Forth programming language, somewhat +easier to read than larger Forth implementations like Gforth. + +It is not being actively developed or maintained. If you find it useful, +great. If not, don't expect much help. The www.forth.org site is a good +place to get more general information on Forth. + +Serious Forth authors would be advised to use Gforth instead of this package. + +.SH AUTHOR +This man page was cobbled up for the Debian distribution by Bdale Garbee. diff --git a/yforth.c b/yforth.c index 7ea1513..9eec173 100644 --- a/yforth.c +++ b/yforth.c @@ -1,9 +1,19 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. - * ------------------------------------------------------------------------ +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +* ------------------------------------------------------------------------ * Module name: yforth.c * Abstract: Main program */ @@ -40,9 +50,11 @@ static int silent, static struct image_header hd; void print_version() { - printf("yForth? v%d.%d%s - Written by Luca Padovani (C) 1996.\n\ -This software is Freeware, use it at your own risk.\n", - VER_HI, VER_LO, VER_TEST); + printf("yForth? v%d.%d%s Copyright (C) 2012 Luca Padovani\n\ +This program comes with ABSOLUTELY NO WARRANTY.\n\ +This is free software, and you are welcome to redistribute it\n\ +under certain conditions; see LICENSE for details.\n", + VER_HI, VER_LO, VER_TEST); } void print_help(void) { diff --git a/yforth.h b/yforth.h index abdef54..e5e5ac0 100644 --- a/yforth.h +++ b/yforth.h @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: yforth.h * Abstract: definition of constants, data types, prototypes, and so on. @@ -126,8 +136,8 @@ void put_dcell(Cell *ptr, DCell d); # define GET_DCELL(ptr) get_dcell((Cell *) ptr) # define PUT_DCELL(ptr, d) put_dcell((Cell *) ptr, (DCell) d) # else -# define GET_DCELL(ptr) *((DCell *) ptr) -# define PUT_DCELL(ptr, d) *((DCell *) ptr) = d +# define GET_DCELL(ptr) *((DCell *) (ptr)) +# define PUT_DCELL(ptr, d) *((DCell *) (ptr)) = d # endif #else # ifdef LITTLE_ENDIAN diff --git a/yfvinit.c b/yfvinit.c index 67dc8ad..b652ed7 100644 --- a/yfvinit.c +++ b/yfvinit.c @@ -1,8 +1,18 @@ -/* yForth? - Written by Luca Padovani (C) 1996/97 - * ------------------------------------------------------------------------ - * This software is FreeWare as long as it comes with this header in each - * source file, anyway you can use it or any part of it whatever - * you want. It comes without any warranty, so use it at your own risk. +/* yForth? - A Forth interpreter written in ANSI C + * Copyright (C) 2012 Luca Padovani + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * ------------------------------------------------------------------------ * Module name: yfvinit.c * Abstract: Initialize the vocabulary. -- 2.30.2