Imported Debian patch 0.1beta-15 debian/0.1beta-15
authorBdale Garbee <bdale@gag.com>
Wed, 9 Jun 2004 19:23:55 +0000 (13:23 -0600)
committerBdale Garbee <bdale@gag.com>
Thu, 5 Jun 2008 23:41:07 +0000 (17:41 -0600)
19 files changed:
Makefile
README
config.h
coree.c
coree.h
debian/README.debian [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/dirs [new file with mode: 0644]
debian/examples [new file with mode: 0644]
debian/rules [new file with mode: 0755]
division.c
file.c
hello.yf [new file with mode: 0644]
udio.c
ver.h
yforth.1 [new file with mode: 0644]
yforth.h

index f5d210829fe1d61c25ba2d989b8eef76b6413b58..cd86be7203be060f04e2cbb09b63102bf0a02d0c 100644 (file)
--- 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)
+yforth: div.h $(OBJECTS)
        $(CC) $(MATHLIB) -o yforth $(OBJECTS)
 
+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 95d5713794c56356831ce1f8c09278dd6150aa11..9c904565e930f31c1d4c58bb7c58fa0431d1be99 100644 (file)
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-yForth? v0.1beta - READ THIS (AND ONLY THIS) TO GET yForth? RUNNING.
+yForth? v0.1+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.
 
@@ -128,3 +121,8 @@ Italy
 email: lpadovan@cs.unibo.it
 
 Enjoy yForth?
+
+**********************************************************************
+                             CONTRIBUTORS 
+**********************************************************************
+
index 9bae024ed635253f62dc3820fef582d99ba43c1a..571924713bff44e99419d59e0affb31d791be5a2 100644 (file)
--- a/config.h
+++ b/config.h
@@ -15,6 +15,8 @@
  * excluded word lists may be linked to final code if used by other words.
  */
 
+#include <endian.h>
+
 #define COREE_DEF           1L
 #define DOUBLE_DEF          1L
 #define DOUBLEE_DEF         1L
  * it if your machine is big-endian (e.g. Motorola, Sparc...)
  * 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
 
 /* When DCELL_MEM is defined, double cell transfer is realized by memory
  * 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
 #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/coree.c b/coree.c
index 8acd70811d667963a5f1b50b44bb2bdc30800e06..5d160e0fa5a3741c77581774a245f62a525a44a5 100644 (file)
--- a/coree.c
+++ b/coree.c
@@ -159,15 +159,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 c43a185c2d2270e37204100893da41a915447996..8f1ad502843b605736d16556e8d592b2a7975bb5 100644 (file)
--- a/coree.h
+++ b/coree.h
@@ -67,6 +67,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/debian/README.debian b/debian/README.debian
new file mode 100644 (file)
index 0000000..98d3047
--- /dev/null
@@ -0,0 +1,14 @@
+yforth for DEBIAN
+----------------------
+
+This is a small implementation of the better part of the ANS Forth core
+standard.  It is less appropriate for hacking Forth scripts under Linux than,
+say, gforth... but it has great promise, and I'm sufficiently interested in
+playing with it for embedded environments that I've decided to go ahead and
+package it.
+
+The author says it's "freeware", and you can do anything you want with it,
+unencumbered even by the GPL.  Enjoy.
+
+
+Bdale Garbee <bdale@gag.com>, Sat, 1 Feb 1997 20:18:18 -0700
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..dbc46ed
--- /dev/null
@@ -0,0 +1,103 @@
+yforth (0.1beta-15) unstable; urgency=low
+
+  * add amd64 to control file, closes: #252783
+
+ -- Bdale Garbee <bdale@gag.com>  Wed,  9 Jun 2004 13:23:55 -0600
+
+yforth (0.1beta-14) unstable; urgency=low
+
+  * patch from David N. Welton to make things work on big-endian machines
+    like powerpc, closes: #96207
+  * a few cleanups to make lintian happier
+
+ -- Bdale Garbee <bdale@gag.com>  Mon,  7 May 2001 10:45:21 -0600
+
+yforth (0.1beta-13) unstable; urgency=low
+
+  * patch from Chris Chimelis to work on alpha architecture, closes: #65407
+
+ -- Bdale Garbee <bdale@gag.com>  Sun, 18 Jun 2000 21:57:21 -0600
+
+yforth (0.1beta-12) unstable; urgency=low
+
+  * lose the dh_du call, closes: #51484
+  * update to latest policy
+
+ -- Bdale Garbee <bdale@gag.com>  Sun,  5 Dec 1999 09:55:40 -0700
+
+yforth (0.1beta-11) frozen unstable; urgency=low
+
+  * Hartmut reminds me that yforth compiles and runs on powerpc as well.
+
+ -- Bdale Garbee <bdale@gag.com>  Tue, 26 Jan 1999 21:02:28 -0700
+
+yforth (0.1beta-10) frozen unstable; urgency=low
+
+  * update control file to account for yforth not working on 64 bit machines.
+    Instead of 'any', specify i386/m68k/sparc/arm.  I *think* all of those
+    should work.  Update documentation to include my best contact info for 
+    the upstream author, and acknowledge that there is no longer an upstream 
+    site for this package.  Closes 32413.
+
+ -- Bdale Garbee <bdale@gag.com>  Tue, 26 Jan 1999 09:18:24 -0700
+
+yforth (0.1beta-9) frozen unstable; urgency=low
+
+  * return 0 on successful completion of main() in division.c, closes 32217
+
+ -- Bdale Garbee <bdale@gag.com>  Fri, 22 Jan 1999 10:34:14 -0700
+
+yforth (0.1beta-8) frozen unstable; urgency=low
+
+  * fix a problem in the Makefile, closes 30065.
+
+ -- Bdale Garbee <bdale@gag.com>  Tue, 15 Dec 1998 00:18:52 -0700
+
+yforth (0.1beta-7) frozen unstable; urgency=low
+
+  * patch to Makefile from James Troup so '.' doesn't need to be in PATH,
+    closes 20990
+
+ -- Bdale Garbee <bdale@gag.com>  Sat, 11 Apr 1998 12:37:39 -0600
+
+yforth (0.1beta-6) frozen unstable; urgency=low
+
+  * fix typos in description, closes 19007.
+
+ -- Bdale Garbee <bdale@gag.com>  Fri,  3 Apr 1998 22:20:45 -0700
+
+yforth (0.1beta-5) unstable; urgency=low
+
+  * change from debmake to debhelper
+  * fix errors and warnings from lintian
+
+ -- Bdale Garbee <bdale@gag.com>  Mon,  9 Feb 1998 22:17:38 -0700
+
+yforth (0.1beta-4) unstable; urgency=low
+
+  * libc6
+
+ -- Bdale Garbee <bdale@gag.com>  Thu,  4 Sep 1997 03:19:14 -0600
+
+yforth (0.1beta-3) unstable; urgency=low
+
+  * Luca accepted my patch, and sent me back some other tweaks...
+
+ -- Bdale Garbee <bdale@gag.com>  Wed, 5 Feb 1997 08:08:58 -0700
+
+yforth (0.1beta-2) unstable; urgency=low
+
+  * Hack in "#!" as an alias for "\" to allow yforth to be used as a script
+    interpreter.
+
+ -- Bdale Garbee <bdale@gag.com>  Sun, 2 Feb 1997 12:07:13 -0700
+
+yforth (0.1beta-1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Bdale Garbee <bdale@gag.com>  Sat, 1 Feb 1997 20:18:18 -0700
+
+Local variables:
+mode: debian-changelog
+End:
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..78cc3f6
--- /dev/null
@@ -0,0 +1,30 @@
+Source: yforth
+Section: interpreters
+Priority: extra
+Maintainer: Bdale Garbee <bdale@gag.com>
+Build-Depends: debhelper
+Standards-Version: 3.6.1.0
+
+Package: yforth
+Architecture: alpha amd64 arm i386 m68k powerpc sparc
+Depends: ${shlibs:Depends}
+Description: A small freeware Forth environment in ANSI C
+ yForth? is an interestingly small implementation of Forth for Linux.  It
+ suffers several deficiencies.  For general Forth programming or learning 
+ under Linux, yForth? is not the best choice.
+ .
+ From the author's README:
+ .
+ yForth? is a Forth environment written entirely in ANSI C, making it 
+ extremely portable. The first thing I want to tell you about yForth? is
+ that it seems a joke compared to other systems such as gForth or PFE.
+ .
+ Nevertheless, you could find yForth? nice, in which case you're invited to 
+ explore yForth?
+ .
+ It's yours, you can make anything you want with it. If you want an explanation
+ of the words provided by yForth? please refer to the draft of ANS Forth or
+ something equivalent.  The Net will help you.
+ .
+ Do not expect the prompt "ok" to come up when you run yForth?, the standard
+ says that "ok" shall be printed AFTER every successful command execution...
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..85581e1
--- /dev/null
@@ -0,0 +1,26 @@
+This package was debianized by Bdale Garbee bdale@gag.com on
+Sat, 1 Feb 1997 20:18:18 -0700.
+
+The sources were retrieved from http://www.cs.unibo.it/~lpadovan/.  
+
+It is not clear that Luca still maintains or develops yforth, as his web page 
+now just points to the Debian distribution for those interested in yforth.  
+
+Written by 
+
+       Luca Padovani
+       v. Cormons, 12
+       48100 Ravenna (RA)
+       Italy
+
+       email: lpadovan@cs.unibo.it
+
+Copyright:
+
+/* 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.
+ * ------------------------------------------------------------------------
+ */
diff --git a/debian/dirs b/debian/dirs
new file mode 100644 (file)
index 0000000..e772481
--- /dev/null
@@ -0,0 +1 @@
+usr/bin
diff --git a/debian/examples b/debian/examples
new file mode 100644 (file)
index 0000000..01fc080
--- /dev/null
@@ -0,0 +1 @@
+hello.yf
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..f1beb4e
--- /dev/null
@@ -0,0 +1,58 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
+
+#      WARNING - the makefile for this package is not SMP-safe!  Don't try
+#              to build this package with 'make -j'
+
+# Uncomment this to turn on verbose mode.
+export DH_VERBOSE=1
+
+build: build-stamp
+build-stamp:
+       dh_testdir
+       $(MAKE)
+       touch build-stamp
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp
+       -$(MAKE) clean
+       dh_clean
+
+# Build architecture-independent files here.
+binary-indep: build
+
+# Build architecture-dependent files here.
+binary-arch: build
+#      dh_testversion
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+       install -g root -m 755 -o root yforth debian/tmp/usr/bin/yforth
+
+       dh_installdocs
+       dh_installexamples
+       dh_installmenu
+#      dh_installinit
+       dh_installcron
+       dh_installmanpages
+#      dh_undocumented
+       dh_installchangelogs
+       dh_strip
+       dh_compress
+       dh_fixperms
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+#      dh_makeshlibs
+       dh_md5sums
+       dh_builddeb
+
+source diff:                                                                  
+       @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary
index 2a404985bde03a7a87eb049a1b9dd8cb0e538e77..3e7e9165a8c374f24dd3432ca06681f983590759 100644 (file)
@@ -1,2 +1,11 @@
 #include <stdio.h>
-main() { printf("#define FLOORED_DIVISION %d\n", (-10 % 7) > 0 ? 1 : 0); }
+#include <math.h>
+#include <assert.h>
+
+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/file.c b/file.c
index ec01a2d08e8ce04b588342e2426427db787fb5d2..7e53a41d90be6b737467aff3f2221205b08b7d91 100644 (file)
--- a/file.c
+++ b/file.c
@@ -208,7 +208,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/hello.yf b/hello.yf
new file mode 100644 (file)
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/udio.c b/udio.c
index d3873a244873f337374599cb1203309990d15c2b..817391da6972c3e59f1575cba41be7021b68a876 100644 (file)
--- a/udio.c
+++ b/udio.c
  */
 
 #include "yforth.h"
-#ifdef HAVE_CONIO
+#if HAVE_CONIO
 #      include <conio.h>
-#elifdef HAVE_CURSES
-#      include <curses.h>
 #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 +71,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/ver.h b/ver.h
index 14fa71bca1fe9c8a6e6d0d2eb1774fdb2b64204e..4fce7bea641afa74f5cf2b8602f960487f41581d 100644 (file)
--- a/ver.h
+++ b/ver.h
@@ -10,5 +10,5 @@
 
 #define VER_HI                 0
 #define        VER_LO                  1
-#define VER_TEST               "beta"
+#define VER_TEST               "+beta"
 
diff --git a/yforth.1 b/yforth.1
new file mode 100644 (file)
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.
index abdef546c1faaf2584f4aaacc4797d1e78037b60..00d77bee23df1c9ae75c40e34d3d2e994b2f3787 100644 (file)
--- a/yforth.h
+++ b/yforth.h
@@ -126,8 +126,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