Compare commits

...

394 Commits

Author SHA1 Message Date
David Given
02870802f0 Back out erroneous change. 2012-12-14 11:56:21 +00:00
George Koehler
c8ebe9995a Prevent segfault when trying to print an error message.
Use <stdarg.h> to pass arguments correctly, as ack/util/util.c
already uses <stdarg.h> the same way.
2012-10-24 13:44:50 -04:00
David Given
d17d9e31a7 Change from using platform-specific types to stdint platform-independent types
when reading the structure header.
2012-09-27 11:32:40 +01:00
David Given
456d52f59f Change to use stdint's implementation independent types rather than short and
long (which vary depending on whether you're on a 64-bit system or not).
2012-09-27 10:54:41 +01:00
George Koehler
c40034452e Merge deletion of many undead files. 2012-09-23 15:31:16 -04:00
George Koehler
f1cdb32025 Allow pc86 bootloader to boot from more floppy drives.
When the bootloader probes the drive geometry, the BIOS can clobber the
es register.  If this happens, the bootloader loads the program to the
wrong address, and jumps off the code.  This happens with an emulated
floppy drive in Bochs or QEMU, but not with an emulated hard disk.
2012-09-23 14:43:22 -04:00
George Koehler
2dbbacfad9 Prevent division by zero in aslod.
rhead() and rsect() had assumed sizeof(long) == 4, but OpenBSD/amd64
has sizeof(long) == 8.  The problem revealed itself when sect->os_lign
became zero, and align() divided by zero.
2012-09-21 22:51:12 -04:00
George Koehler
e87791b38a Delete 689 undead files.
These files "magically reappeared" after the conversion from CVS to
Mercurial.  The old CVS repository deleted these files but did not
record *when* it deleted these files.  The conversion resurrected these
files because they have no history of deletion.  These files were
probably deleted before year 1995.  The CVS repository begins to record
deletions around 1995.

These files may still appear in older revisions of this Mercurial
repository, when they should already be deleted.  There is no way to fix
this, because the CVS repository provides no dates of deletion.

See http://sourceforge.net/mailarchive/message.php?msg_id=29823032
2012-09-20 22:26:32 -04:00
George Koehler
a44e18bb1e *Again* fix fit16i() for systems with 64-bit long.
I already did this in abebf1586c06, but I edited the wrong file.  Then
in edddc6b7cd17, I deleted that file.

By fixing fit16i(), I can now compile ACK for OpenBSD/amd64.
2012-09-19 23:39:51 -04:00
George Koehler
c56e850eca Delete old and unused files from modules/src/em_code 2012-09-17 16:04:55 -04:00
George Koehler
eff81b4687 Fix fit16i() for systems with 64-bit long.
(long)0xFFFF8000 had expanded to 0x00000000FFFF8000.
With (long)(-0x8000), the compiler now extends the negative sign.
2012-09-16 19:57:07 -04:00
George Koehler
0f8745dc8d Fix more functions in util/ack for 64-bit hosts.
This continues the fix from changeset aabde0589450.  We must use
va_list to forward the arguments, because some of the arguments might
be 64-bit pointers.  A pointer does not fit in an int.
2012-09-07 16:28:10 -04:00
George Koehler
ab55ecefee Fix cemcom.ansi for 64-bit hosts.
Hosts with sizeof(arith) == sizeof(long) == 8 need to set full_mask[1]
through full_mask[8].  Because MAXSIZE == 8, we only had full_mask[0]
through full_mask[7].  This fix declares arith full_mask[MAXSIZE + 1]
and prevents a fatal error: "array full_mask too small for this machine"
2012-09-07 15:53:13 -04:00
David Given
f07a93357c Fix a 64-bitness issue (removed some untyped K&R C code that assumed ints
and pointers were the same size).
2012-02-27 22:36:36 +00:00
Ceriel Jacobs
b9c194b210 Added atol() that ignores overflow, so that unsigned long constants are dealt with properly 2011-06-15 11:13:48 +02:00
Ceriel Jacobs
ff34b6bce7 Fixed CFU 2011-06-15 10:56:58 +02:00
cjhjacobs
67cda9e22f Fixed bug reported on tack-devel mailing list on 20-3-2011 2011-05-18 19:19:19 +02:00
David Given
cc4e74077c Removed file that the CVS conversion procedure left in (when it shouldn't have). 2011-03-20 20:47:10 +00:00
cvs2hg
210a4c9ce5 convert CVS tags 2011-02-11 00:51:45 +00:00
dtrg
16e42da0ed Replaced dis and new with modern implementations donated by erik@backerud.se. 2010-10-02 21:52:29 +00:00
dtrg
4bc87420d1 Call the correct kill() and getpid() syscalls rather than _kill() and _getpid(). 2010-10-02 21:51:40 +00:00
dtrg
72bc0db96a Now call creat() and open() instead of _creat() and _open(). 2010-09-27 20:47:32 +00:00
dtrg
4b494f90e2 Added support for remove() and unlink(). 2010-09-27 20:44:49 +00:00
dtrg
072e795aa3 Fixed very old bug where Streams.GetStreamPosition would return the wrong position --- thanks to Jan Verhoeven for finding this. 2010-09-01 19:55:15 +00:00
dtrg
d0ac75ea66 Fixed definitions of O_* flags. 2010-08-20 19:27:09 +00:00
dtrg
8efccf82c7 Remove references to using-machine-name-for-compiler, as we don't do that any more. 2010-08-09 22:47:33 +00:00
dtrg
5e831ec966 Changed to actually work. (On modern Linux systems the old version just
crashes. On old Linux systems it apparently only worked by accident.)
2010-08-06 17:06:31 +00:00
dtrg
3310ddcdac Flush stdout before prompting the user for input. 2010-08-06 17:02:16 +00:00
dtrg
dc9c6c8ca2 Flush output stream before waiting for user input. 2010-08-05 22:23:34 +00:00
cvs2hg
ec96baa6dc fixup commit for tag 'release-6-0-pre-4' 2010-08-04 18:04:08 +00:00
dtrg
9f641ff005 Forgot to update version number. 2010-08-04 18:04:07 +00:00
dtrg
742a6046e7 Updated for 6.0pre4. 2010-08-04 18:01:12 +00:00
dtrg
3ef5fe565b Fixed typo. 2010-08-04 17:59:40 +00:00
dtrg
bbdd256739 Prevent build failure on modern Bisons (which are more picky than the old yacc this was written for). 2010-08-01 10:36:01 +00:00
dtrg
9236d6e4aa Invoke genfiles explicitly with sh --- CVS doesn't store executable bits. 2010-08-01 10:35:33 +00:00
dtrg
8256a10133 Renamed 'switch' variable to avoid conflict with a keyword in modern awks. 2010-08-01 10:35:04 +00:00
dtrg
20f09f610e Renamed getline() to getln() to avoid conflict with glibc's version. 2010-08-01 10:34:27 +00:00
dtrg
b218202619 Added a very-nearly-noop peephole optimiser for Z80. 2008-03-20 23:20:08 +00:00
dtrg
594fb05c87 Properly handles files ending in a partial line. 2008-03-20 22:50:50 +00:00
dtrg
d06e0b1670 Archival checkin (semi-working code). 2007-11-02 18:56:58 +00:00
cvs2hg
debf852e0d fixup commit for tag 'release-6-0-pre-3' 2007-04-29 23:09:25 +00:00
dtrg
e9e9c8ac50 Configured distr system for the 6.0pre3 release. 2007-04-29 23:09:24 +00:00
dtrg
a45f7db24a Cleaned up a bit and made work with the new platform architecture. 2007-04-29 23:03:24 +00:00
dtrg
4c74889bc1 Now using more conservative optimisation due to random seg fault issues. 2007-04-29 23:02:23 +00:00
dtrg
1820152008 Added optimised rules for int<<8 and uint>>8 (which can be done with simple register shuffling rather than calling .sli). 2007-04-29 23:00:31 +00:00
dtrg
c90ee3021b Fixed the ego parameters to actually allow extended optimisation. 2007-04-29 21:25:09 +00:00
dtrg
5c12b869aa Use better optimisation options. 2007-04-29 21:24:17 +00:00
dtrg
a1c93cbbe6 Now runs descr files through the ANSI C preprocessor, rather than the K&R one (which no longer exists). 2007-04-29 21:23:55 +00:00
dtrg
f4e3111f50 Fixed the trap code to write out the error message correctly. 2007-04-29 20:47:48 +00:00
dtrg
ac72c550ba Disabled the code to throw signals on EM traps; this is the platform's job (and requires working signal support, which we may not have). 2007-04-29 20:46:48 +00:00
dtrg
7e624e2f1d Added suppot for BSS clearing and command line parsing. 2007-04-29 00:28:06 +00:00
dtrg
65e8bffed3 Documented floating-point status. 2007-04-28 22:34:47 +00:00
dtrg
1189d41aec Added the Mandelbrot generator. 2007-04-28 22:34:05 +00:00
dtrg
d6fc2d19f9 Added cpm platform. 2007-04-27 22:42:41 +00:00
dtrg
c710fde0d5 Added the stdint.h header file. 2007-04-27 22:42:02 +00:00
dtrg
9d8c776888 Cleaned up and enabled the support for conditionally emitting the floating-point stdio code. 2007-04-27 22:41:39 +00:00
dtrg
dcaec5dfa8 Removed a completely pointless 128-byte buffer. 2007-04-27 22:41:05 +00:00
dtrg
d1cf99c245 Fixed a bug where loc lol stf was getting the constant pushed onto the stack *after* stf had popped it off. 2007-04-27 22:15:31 +00:00
dtrg
e02179a9fe Updated for the 6.0pre2 release. 2007-04-24 20:45:58 +00:00
dtrg
13496800ab Removed bashish. 2007-04-24 19:48:41 +00:00
dtrg
15a318b4b1 Stripped down the library to something approaching the ANSI C minimum and replaced most of the header files, to provide a reasonably consistent base to work up from. 2007-04-24 19:42:24 +00:00
dtrg
de5dfda220 Fixed major typos in the signal declarations that was preventing anything that used signal() from compiling. 2007-04-24 19:34:34 +00:00
dtrg
4839ce3ec6 Updated use of headers to compile cleanly. 2007-04-24 19:33:53 +00:00
dtrg
5621f951a2 Ensured that _errno is always defined. Rejigged the pc86 boot code so it doesn't always waste 510 bytes of memory. 2007-04-24 19:25:00 +00:00
dtrg
116a3f49c9 Added support for the linux386 platform. Disabled building of the K&R C, Basic and Occam compilers. 2007-04-23 23:41:50 +00:00
dtrg
2b16e9f8dc Modified to run ncgg input files through the ANSI preprocessor rather than the K&R one. 2007-04-23 23:40:59 +00:00
dtrg
87ad9a6852 Added the aelflod tool for generating ELF executables. Added documentation for aelflod and ashow. Now installs the documentation when built. 2007-04-23 23:40:10 +00:00
dtrg
f2cfcba52e Modified to allow a space between the sign and the first digit of a constant. 2007-04-23 23:24:46 +00:00
dtrg
9731e1e349 Now fetches argc, argv, env correctly from the host OS. 2007-04-23 23:24:03 +00:00
dtrg
db4d300c33 Added the 'Star Trek' example game. 2007-04-21 23:20:11 +00:00
dtrg
d48c81664f Adapted to tell the user what language they were written in (because they're too similar!). Modified the Pascal implementation to work with our new syscall model. 2007-04-21 23:19:32 +00:00
dtrg
f33fd63590 Adapted for ANSI C and our pseudo-Posix syscall interface. 2007-04-21 23:18:14 +00:00
dtrg
078faadbf9 Fixed a bug where the preprocessor would occasionally lose whitespace at the beginning of lines immediately after a #endif, which was confusing the assembler. 2007-04-21 23:10:13 +00:00
dtrg
f5d41474da Disabled Terminal as it uses hard-coded ioctls and appears to be non-standard anyway. 2007-04-21 23:07:57 +00:00
dtrg
0e349f88a6 Changed to call the isatty() syscall directly, rather than fiddling around with non-portable ioctls. 2007-04-21 23:07:05 +00:00
dtrg
43857acb0b Disabled the K&R C compiler in favour of the ANSI one. 2007-04-21 23:03:35 +00:00
dtrg
3756b414de Added linux386 platform. 2007-04-21 23:02:11 +00:00
dtrg
42c2cdb985 Updated to work with the new libmon-less setup. 2007-04-21 22:59:42 +00:00
dtrg
1a19c3ffec Updated to work with the linux386 platform. 2007-04-21 22:57:51 +00:00
dtrg
cc57ec1e11 yacc source files are now run through the ANSI C preprocessor, not the K&R one. 2007-04-21 22:55:59 +00:00
dtrg
892a545b10 Everything is built in ANSI C now. 2007-04-21 22:55:04 +00:00
dtrg
a5c9e8b09c Renamed the language libraries and runtimes to have more
conventional names.
2007-02-26 22:36:56 +00:00
cvs2hg
fd5b9e1450 fixup commit for tag 'release-6-0-pre-1' 2007-02-25 22:49:23 +00:00
dtrg
173ca7d5d7 Removed a dynamically generated file from the distribution. 2007-02-25 22:49:22 +00:00
dtrg
e85ebeeab0 Added some OpenBSD-related comments. 2007-02-25 22:09:15 +00:00
dtrg
002c49ec2b Applied a patch to support OpenBSD. 2007-02-25 22:07:11 +00:00
dtrg
583c2df92a Replaced the call to posix.setenv() with the more portable
posix.putenv().
2007-02-25 20:59:21 +00:00
dtrg
f07522680d Removed some explicit (and wrong) redeclarations of system
functions.
2007-02-25 20:58:16 +00:00
dtrg
913bf332f3 Performed major renovations to make the script work on OpenBSD. 2007-02-25 20:56:41 +00:00
dtrg
2ac12e3015 em_table is now in /h; new_table is now in util/data. 2007-02-25 12:58:41 +00:00
dtrg
c74f9cc2e9 Updated for the new release. 2007-02-25 12:53:55 +00:00
dtrg
594e84da95 Added the ability to install a built ACK, and did some general
tidying.
2007-02-25 12:53:17 +00:00
dtrg
5da1922c4f Adjusted some of the default parameters and their names. 2007-02-25 12:52:32 +00:00
dtrg
c5e7c60c76 Updated .distr files for the new release. 2007-02-25 12:51:55 +00:00
dtrg
19df20b027 em_table is now in /h, not /etc. 2007-02-25 12:51:21 +00:00
dtrg
aacc645329 new_table is now in /util/data, not /etc. 2007-02-25 12:49:04 +00:00
dtrg
b48e18fbd9 Now installs the man page. 2007-02-25 12:48:06 +00:00
dtrg
6a00063b18 Remove non-standard .SB tags. 2007-02-25 12:47:50 +00:00
dtrg
2b20613b72 Added shell magic. 2007-02-25 12:46:11 +00:00
dtrg
81b31c3a1c Moved to /h. 2007-02-25 12:45:24 +00:00
dtrg
99c81620c7 Moved sys/timeb.h from include/_tail_mon. 2007-02-25 12:44:13 +00:00
dtrg
2a1b5444b2 Moved from /etc. 2007-02-25 12:42:04 +00:00
dtrg
96db4093b3 Updated to version 0.1.1 of Prime Mover. 2007-02-25 12:39:52 +00:00
dtrg
58ca908043 Added example programs. 2007-02-25 00:30:07 +00:00
dtrg
84aabce8f7 Removed some bashish; added comment support; removed the make
distr functionality, as nothing was using it any more and it was
causing problems.
2007-02-24 02:05:56 +00:00
dtrg
2ec25a4f86 Added pregenerated versions of the LLgen source files (to ease
bootstrapping issues).
2007-02-24 02:01:57 +00:00
dtrg
2c98eae913 Done a major overhaul of the way target include files are installed and
how platform libraries are built. The ARCH pm variable has now been
renamed PLATFORM (which is more accurate) and a different ARCH
variable added, which represents the CPU family rather than the
hardware platform.
2007-02-20 00:46:10 +00:00
dtrg
5d7360edf0 Added a definition of endrom. 2007-02-20 00:42:23 +00:00
dtrg
bb5ab180d3 Added some comments and a CVS header. 2007-02-20 00:41:26 +00:00
dtrg
b15186d574 Tweaked to allow _ as a leading character in identifier names (if
use of underscores in identifiers has been turned on).
2007-02-20 00:40:00 +00:00
dtrg
9b82e21f06 Added some missing #includes. 2007-02-20 00:38:49 +00:00
dtrg
84b35a215a Now uses fd 0 instead of trying to explicitly open /dev/tty. 2007-02-20 00:38:13 +00:00
dtrg
d0bff8b01c Changed to no longer include /usr/include by default. 2007-02-20 00:36:15 +00:00
dtrg
ca3c5d0d0c Fixed some reentrant comments. 2007-02-20 00:35:37 +00:00
dtrg
6d72be8b43 Changed the 'preprocess' rule to use the system C preprocessor. 2007-02-20 00:32:58 +00:00
dtrg
4aa396fdec Added some missing CVS headers and did a bit of cleaning up. 2007-02-20 00:31:54 +00:00
dtrg
7ce42ea371 Fixed a compilation error that was causing opt to not have its
peephole optimisation tables, which would make it generate
duff code.
2007-02-20 00:27:01 +00:00
dtrg
0f8115e3c9 Added 8086 PC bootable floppy support (pc86). 2007-02-20 00:25:12 +00:00
dtrg
8be57751c3 Fixed a bug in the maximum segment calculation. 2006-11-11 23:00:55 +00:00
dtrg
84e903586b Updated to work with the new version of pm. 2006-11-11 22:59:52 +00:00
dtrg
d925ad7c46 Now uses the version of LLgen included with the ACK instead of the standalone version. 2006-11-11 22:59:01 +00:00
dtrg
01e7d0c56d Added a pmfile to allow LLgen to be built as part of the ACK again. 2006-11-11 22:58:30 +00:00
dtrg
eba0b5023e Added support for anm, asize, ashow, astrip and the new aslod tool. 2006-10-16 23:25:56 +00:00
dtrg
d228deb16d Added new aslod tool for making memory dumps. 2006-10-16 23:25:27 +00:00
dtrg
4659f40b18 Sanitised the use of #include files to more properly conform to the standards. 2006-10-16 23:20:11 +00:00
dtrg
8601c6c5bf Updated to the version 0.1 of Prime Mover (which involves some syntax changes). 2006-10-15 00:28:12 +00:00
dtrg
df67dbcaeb ack expects the tail_ libraries not to have the .a extension. 2006-07-30 23:45:48 +00:00
dtrg
696b04e5ae Modified to install aal's manpage. 2006-07-30 23:45:35 +00:00
dtrg
322597e715 Added support for the ANSI C language runtime and preprocessor. 2006-07-30 23:45:18 +00:00
dtrg
1523514504 Added rules for building things with the ack itself. 2006-07-30 23:44:57 +00:00
dtrg
44daceddd2 Broke dependency on tool_cpp in order to speed up the build. 2006-07-30 23:41:16 +00:00
dtrg
8bcd8ede76 Rationalised use of #includes to be more standards-compliant. 2006-07-30 23:40:35 +00:00
dtrg
ce6de53e60 Adjusted to only check the module name against the leaf of the filename, to prevent unnecessary warnings if the source file isn't in the current directory. 2006-07-30 23:38:41 +00:00
dtrg
c308262eb6 Added the correct shell script magic. (Some platforms insist on this.) 2006-07-30 23:37:15 +00:00
dtrg
8348fa5474 Worked around a mysterious preprocessor oddness causing some
crucial whitespace to be removed.
2006-07-30 23:36:19 +00:00
dtrg
1ccc853b71 Updated to the latest version of pm. 2006-07-30 23:33:31 +00:00
dtrg
4eb2b4351b Added support for the K&R C language runtime. 2006-07-27 22:51:38 +00:00
dtrg
0e5a52c1c9 Added support for the Modula-2 language runtime. 2006-07-27 22:14:55 +00:00
dtrg
faff5b8361 Added support for the Pascal language runtime. 2006-07-27 22:07:38 +00:00
dtrg
2619a6aeb1 Added support for the Basic and Occam language runtimes. 2006-07-27 21:58:13 +00:00
dtrg
f35d231c1f Added support for the Basic compiler. 2006-07-26 23:08:09 +00:00
dtrg
46d9eff270 Rationalised use of #includes to be more standards-compliant. 2006-07-26 23:06:56 +00:00
dtrg
38276da8ea Adjusted to allow the path of the Lpars.h file to be given on the
command line.
2006-07-26 23:05:52 +00:00
dtrg
8364064fae Updated to the latest version of pm. 2006-07-26 18:24:16 +00:00
dtrg
98c0efeca4 Added support for the Occam compiler. 2006-07-26 18:23:32 +00:00
dtrg
bffe70f9ac Rationalised use of #includes to be more standards-compliant. 2006-07-26 18:22:02 +00:00
dtrg
b48e9d9550 Renamed em.h to occam-em.h to avoid a clash with an ACK module
header file.
2006-07-26 18:20:38 +00:00
dtrg
d73458fd52 Tweaked the CVS settings. 2006-07-26 18:19:15 +00:00
dtrg
b33fd563b7 Added support for the Modula-2 compiler. 2006-07-26 17:12:19 +00:00
dtrg
dd760329aa Rationalised use of #includes to be more standards-compliant. 2006-07-26 17:10:30 +00:00
dtrg
383677ff3e Changed to no longer build sys_lock() and sys_unlock(); they only work
on platforms that support hardlinks, and nobody uses them anyway.
2006-07-26 12:40:59 +00:00
dtrg
75d10944b8 Fixed to use rename() for renaming files, not link()/unlink(). 2006-07-26 12:40:25 +00:00
dtrg
d6bd2c86bd Now avoids piping shell scripts into a new instance of sh, instead
using a subshell.
2006-07-26 12:29:47 +00:00
dtrg
8952648ab5 Modified to include the appropriate header file rather than (badly)
prototyping syscalls itself.
2006-07-26 12:28:56 +00:00
dtrg
06ed8b1b8f Updated to the latest version of pm. 2006-07-26 12:27:01 +00:00
dtrg
6f46578879 Modified to not try to unlink directories when installing. 2006-07-25 23:29:12 +00:00
dtrg
4a8b62c862 Updated version number. 2006-07-25 23:24:39 +00:00
dtrg
1f78b7ff4e Modified to use rename() instead of link()/unlink() to rename files. 2006-07-25 23:24:20 +00:00
dtrg
2d5e79ec0a Updated to the latest version of pm which installs files with symlinks. 2006-07-25 23:22:58 +00:00
dtrg
58fad2b368 Updated to the latest version of pm. 2006-07-25 13:28:35 +00:00
dtrg
188f135e5e Updated to the latest version of pm. 2006-07-25 09:23:21 +00:00
dtrg
62a8851bc8 Added a workaround for an OSX compiler bug. 2006-07-23 20:33:26 +00:00
dtrg
46d504c483 Updated to the latest version of pm. 2006-07-23 20:07:19 +00:00
dtrg
9c722420dd Replaced calls to the custom strindex() and strrindex() functions with the
exactly equivalent and standard strchr() and strrchr() functions instead.
2006-07-23 20:01:02 +00:00
dtrg
80b4463439 Modified to no longer build unoptimised duplicates of all the standard
string functions (strcpy, strlen, etc).
2006-07-23 19:58:27 +00:00
dtrg
ac7b578128 Changed to call ranlib on ar archives. (Unnecessary on Linux and *BSD,
but needed on OSX and technically correct.)
2006-07-23 19:56:11 +00:00
dtrg
09f4845060 Removed a really unpleasant test for whether a pointer points at a string
constant or not by comparing it with 'end', which presumably points at
the top of the BSS. In fact, on Linux it evaluates to NULL, and on OSX it
doesn't exist at all, so it appears to be unnecessary.
2006-07-23 19:38:13 +00:00
dtrg
47d990fec8 Modified to avoid creating a zero-length iargs array, which some compilers
(OSX) do not create a symbol for.
2006-07-23 18:29:38 +00:00
dtrg
f3e9069ea0 cpp now gets installed in the right place. 2006-07-23 17:52:23 +00:00
dtrg
217062585d Really added support for the Pascal compiler. 2006-07-22 21:24:41 +00:00
dtrg
a9c5aa42fd Added support for the Pascal compiler. 2006-07-22 21:03:07 +00:00
dtrg
8b292e1a83 Rationalised use of #includes to be more standards-compliant. 2006-07-22 21:01:15 +00:00
dtrg
1465633090 Changed to export a header file so it can be correctly referred to. 2006-07-22 20:59:22 +00:00
dtrg
0bb9513457 cpp now gets installed in the right place. 2006-07-22 20:58:27 +00:00
dtrg
4473031ec4 led now gets installed into the right place. 2006-07-22 20:52:44 +00:00
dtrg
721ad3ba6c Added support for the esize object inspection tool. 2006-07-22 20:10:41 +00:00
dtrg
5f529d8ff1 Rationalised use of #includes to be more standards-compliant. 2006-07-22 20:08:08 +00:00
dtrg
bc943a92c2 Added support for the led link editor. 2006-07-22 20:04:41 +00:00
dtrg
c017d49dae Rationalised use of #includes to be more standards-compliant. 2006-07-22 17:58:49 +00:00
dtrg
e604ef3d4c Added support for the top target peephole optimiser. 2006-07-22 12:31:19 +00:00
dtrg
90844c1272 Updated to the latest version of pm. 2006-07-22 12:29:40 +00:00
dtrg
8e9303b238 Rationalised use of #includes to be more standards-compliant. 2006-07-22 12:28:20 +00:00
dtrg
aad716cd20 Removed a huge, ancient comment dating from the genmake days. 2006-07-22 12:27:31 +00:00
dtrg
fcecc66f2d Added support for the ego global optimisation suite. 2006-07-22 00:52:01 +00:00
dtrg
e05bc9c9b0 First version in CVS. 2006-07-22 00:49:48 +00:00
dtrg
6d37bf15b8 Changed so as to not compile the ACK with optimisation, to improve
debuggability.
2006-07-22 00:47:55 +00:00
dtrg
b29f55a533 Rationalised use of #includes to be more standards-compliant. 2006-07-22 00:46:16 +00:00
dtrg
62871bb5d7 Changed to declare symbols as extern rather than just mentioning
them without qualification.
2006-07-22 00:45:51 +00:00
dtrg
82a585f684 Added a concrete definition of nrglobals, because this was not always happening
otherwise.
2006-07-22 00:44:52 +00:00
dtrg
af73344cf0 Updated to the latest version of pm. 2006-07-21 13:13:47 +00:00
dtrg
2c16cb7244 Updated version number. 2006-07-21 11:25:05 +00:00
dtrg
eb1e26bbfa Now resolves symlinks when creating releases (which avoids including a symlink to pm in the distribution, and not pm itself). 2006-07-21 11:24:46 +00:00
dtrg
78dba844b2 Updated version number. Corrected some typos. 2006-07-21 11:19:42 +00:00
dtrg
5304588eea Removed duplicate (and incorrect) system function declarations. 2006-07-21 11:17:18 +00:00
dtrg
1c73ef8e61 Updated to the latest version of pm. 2006-07-21 11:15:14 +00:00
dtrg
1f824aa3e8 Removed a definition of 'struct label' as 'label_t', as it clashes with
a common Posix extension on BSD systems.
2006-07-21 10:35:34 +00:00
dtrg
1e72f2443d Rearranged the algorithm in get_text() to fix a memory overrun. 2006-07-21 09:28:36 +00:00
dtrg
a173f6a6c0 Fixed revision history. 2006-07-20 23:24:42 +00:00
dtrg
4593af6c11 First version in CVS. 2006-07-20 23:24:28 +00:00
dtrg
bb2b8fae64 Rationalised use of #includes to be more standards-compliant. 2006-07-20 23:17:25 +00:00
dtrg
7b80cd2db0 Fixed revision history. 2006-07-20 23:10:07 +00:00
dtrg
8a3e083fe1 First version in CVS. 2006-07-20 23:04:28 +00:00
dtrg
a7939a407b Rationalised use of #includes to be more standards-compliant. 2006-07-20 23:04:15 +00:00
dtrg
b2b88a89e1 Added the appropriate #! magic at the beginning of shell scripts. (Some modern shells don't like scripts to be without it.) 2006-07-20 23:02:37 +00:00
dtrg
8ec7e4667c Changed configuration to now use malloc()/free() rather than sbrk(). 2006-07-20 22:59:25 +00:00
dtrg
b9d98bd0ff First version in CVS. 2006-07-20 22:57:46 +00:00
dtrg
bce7648b99 Updated to point at the ncg code generator instead of the cg one. 2006-07-20 22:37:57 +00:00
dtrg
dd3c45ecf2 Added the appropriate #! magic at the beginning of shell scripts. (Some modern shells don't like scripts to be without it.) 2006-07-19 14:09:25 +00:00
dtrg
01314faaac Rationalised use of #includes to be more standards-compliant. 2006-07-19 14:09:05 +00:00
dtrg
9aacafbc5a Modified to no longer build LLgen, as it is now distributed separately. 2006-07-19 14:03:33 +00:00
dtrg
633780d9f0 Added the appropriate #! magic at the beginning of shell scripts. (Some modern shells don't like scripts to be without it.) 2006-07-19 10:30:26 +00:00
dtrg
f67d6d1491 Rationalised use of #includes to be more standards-compliant. 2006-07-19 10:28:43 +00:00
dtrg
54ea735407 Rationalised use of #includes to be more standards-compliant. 2006-07-18 18:05:47 +00:00
dtrg
44f229d88a Modified to no longer build LLgen, as it is now distributed seperately. 2006-07-18 17:34:30 +00:00
dtrg
fbe65f8a9a Added comment about the use of 'cc' rather than 'gcc'. 2006-07-18 17:21:34 +00:00
dtrg
3ee71dd844 Added the appropriate #! magic at the beginning of shell scripts. (Some modern shells don't like scripts to be without it.) 2006-07-18 17:20:46 +00:00
dtrg
a54dcb8e92 No longer generates zero bytes in the script's output file. 2006-07-18 17:20:05 +00:00
dtrg
c8f1fe9511 Worked around unput() not being strictly legal in the tail code section of a yacc input file. 2006-07-18 17:19:20 +00:00
dtrg
3620781344 Rationalised use of #includes to be more standards-compliant. 2006-07-18 17:18:42 +00:00
dtrg
3f2df9c88d Removed unnecessary commas seperating yacc tokens, to prevent warnings. 2006-07-18 17:17:14 +00:00
dtrg
84f3a18362 Rationalised use of #includes to be more standards-compliant. 2006-07-18 17:10:29 +00:00
dtrg
3a69ad76f4 Added the appropriate #! magic at the beginning of shell scripts. (Some modern shells don't like scripts to be without it.) 2006-07-18 17:10:18 +00:00
dtrg
8769a2b8bc Renamed the 'index' variable to 'offset', to prevent clashes with the libc index() function. 2006-07-18 17:00:30 +00:00
dtrg
8b27bc6170 Removed unnecessary commas seperating yacc tokens, to prevent warnings. 2006-07-18 16:59:11 +00:00
dtrg
71e0d85a11 Renamed the private 'atol()' function to 'our_atol()' to avoid clashes with the libc one. 2006-07-18 16:57:51 +00:00
dtrg
c5f106f53e Removed unnecessary commas seperating yacc tokens, to prevent warnings. 2006-07-18 16:52:08 +00:00
dtrg
309f5d5560 Renamed the 'index()' function to 'indexmode()', to prevent clashes with the libc index() function. 2006-07-18 16:50:22 +00:00
dtrg
f6d77b9061 Removed a #define that was also defined in cv.c. 2006-07-18 16:48:21 +00:00
dtrg
be7ec5cdd0 Added the appropriate #! magic at the beginning of shell scripts. (Some modern shells don't like scripts to be without it.) 2006-07-18 16:45:57 +00:00
cvs2hg
22d8b82972 fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
dtrg
84701a5c29 Split LLgen off to be self-contained, and not necessarily part of the ACK. Replaced its build system with one based on pm. Rewrote the README. Updated the license text to match the overriding license common to all the ACK. 2006-02-04 00:57:04 +00:00
dtrg
b034d8695b Moved LLgen documentation from the main ACK documentation directory into LLgen's own documentation directory. 2006-02-04 00:43:32 +00:00
dtrg
92c1b4a4c1 Modernised usage of system header files. 2006-02-04 00:37:19 +00:00
dtrg
51000eef76 Modernised usage of system header files. 2006-02-03 22:23:37 +00:00
dtrg
32762aad2b Modernised usage of system header files. Changed the patch buffer (which allowed the library path to be modified with a hex editor) to an environment variable instead. 2006-02-03 22:23:11 +00:00
dtrg
963a256f68 Modernised usage of system header files. 2006-01-24 22:29:19 +00:00
dtrg
852a474ee3 Converted to use termios, not sgtty. (pbetti@e-tech.net) 2005-08-10 22:48:40 +00:00
cjhjacobs
6da4811e19 Fix: did not deal with quotes in macro definitions properly 2005-06-30 16:54:15 +00:00
dtrg
9c81d2fe39 Removed duplicate and inconsistent function declarations. 2005-06-25 15:52:19 +00:00
dtrg
ed1ddc5baa Now includes stdlib.h to avoid implicit call declarations. 2005-06-25 15:50:40 +00:00
dtrg
bc2672d642 Added some prototyping to stop a compile error with gcc 4. 2005-06-25 13:49:06 +00:00
cvs2hg
0f5ae5305d fixup commit for tag 'release-5-6' 2005-06-24 23:20:42 +00:00
dtrg
cb09878a1f Added some new readmes at the top level. 2005-06-24 23:20:41 +00:00
dtrg
f7d14e649d Added LLgen_NCER.n to the distribution because the makefile seems to want it. 2005-06-24 23:19:55 +00:00
dtrg
dbc7cd6b19 Added new mkdist tool. 2005-06-24 23:19:24 +00:00
dtrg
38b87fe902 Created new tool to generate distributions. 2005-06-24 22:13:57 +00:00
dtrg
ee83cfcf9b Removed a call to _cleanup(), which appears to be a Minixism (and should be unnecessary). 2005-06-24 22:12:02 +00:00
dtrg
e2cf5fbce2 Cleaned up the struct sgtty workaround and made it more generic. 2005-06-24 22:11:27 +00:00
dtrg
5ef43bb829 Removed an assumption that 'stdin' is a constant, which it's not on Linux. (You can't use it as an initialiser when declaring a global variable.) 2005-06-24 22:10:24 +00:00
dtrg
04a887eee9 Replaced references to /usr/tmp with references to /tmp. 2005-06-24 22:08:47 +00:00
dtrg
9158d97c6f Applied interim patches to make the interpreter compile on Linux. (Linux doesn't support struct sgtty; all this code should probably be rewritten to use termios instead, if I've understood it correctly.) 2005-06-24 21:42:11 +00:00
dtrg
d5cc72efc2 Removed Versions, since that file doesn't actually exist. 2005-06-24 21:14:44 +00:00
ceriel
65ffc7f057 new copyright notice in repository 2005-05-26 06:47:43 +00:00
ceriel
dbf0723fdb Fix 2003-01-08 09:39:52 +00:00
ceriel
611e8b03fe Fix 2002-09-11 13:32:57 +00:00
ceriel
b2ffedbabd fix 2002-09-11 13:19:23 +00:00
ceriel
06df95dc13 Added missing files to .distr 2002-09-11 13:17:00 +00:00
ceriel
902ff02551 ... 2002-09-10 13:40:14 +00:00
ceriel
40db0f2abc minor mods 2002-09-10 13:30:06 +00:00
ceriel
42f568c0e0 Prevent double fclose 2002-08-26 14:27:15 +00:00
ceriel
9493d1cde9 ??? 2002-04-04 12:33:15 +00:00
ceriel
c432c83666 Fix for union initializers 2001-07-03 10:10:56 +00:00
ceriel
fed4e8aba5 Fix: parameter name same as function name not dealt with properly 2001-07-03 08:55:16 +00:00
ceriel
8f4ec7280c Updated copyright 1999-04-23 14:15:43 +00:00
ceriel
6fb0645cd6 Adapted copyright notice 1999-03-18 15:34:27 +00:00
ceriel
3db9a605e3 Fix: did not always produce error message 1998-11-10 14:26:06 +00:00
ceriel
8262bfb8f4 Fixed bug with 4-byte sets on 2-byte machines 1998-09-03 12:51:38 +00:00
ceriel
bf9e4d20d9 Replaced a couple of UnGetChar calls with ChPushBack calls. The
UnGetChar call is wrong after skipspaces().
1998-02-09 09:49:00 +00:00
ceriel
a2f0e7d65b Corrected Makefile 1997-09-04 15:49:46 +00:00
ceriel
f6f9b3fd82 Added LLgen_NCER.n 1997-07-10 07:58:30 +00:00
ceriel
6021fd93ff fixed typo 1997-07-10 07:58:19 +00:00
ceriel
6d5ee0158d Added LLgen_NCER.n 1997-07-10 07:55:35 +00:00
ceriel
47c63fb2e8 Only list readable directories 1997-07-01 12:05:54 +00:00
ceriel
0418600539 Bug fix: copied wrong size to destination in structure returns 1997-07-01 08:33:13 +00:00
ceriel
8b112a5f65 Removed superfluous ; 1997-06-16 13:07:37 +00:00
ceriel
6c797e83e3 Many modifications, mostly in comment 1997-05-15 12:03:05 +00:00
ceriel
df704932ab Prevent warning about unused labels 1997-04-02 10:42:06 +00:00
ceriel
65282761ed Link em_data.a as well (needed when producing readable EM 1997-04-01 13:58:58 +00:00
ceriel
30d31515c8 Fixed bug: flt_div should not touch e1 1997-03-13 18:38:24 +00:00
ceriel
dc55bdabcf Additions for non-correcting error recovery 1997-02-21 17:22:42 +00:00
ceriel
03de17911b Additions for non-correcting error recovery 1997-02-21 17:11:04 +00:00
ceriel
a60ff7fcea improved error reporting, added -DNON_CORRECTING 1997-02-21 15:44:44 +00:00
ceriel
81252befc9 some minor fixes 1997-02-21 15:44:10 +00:00
ceriel
0406eff439 Updated 1997-02-21 12:23:04 +00:00
ceriel
0ed5418bec Added non-correcting error recovery stuff 1997-02-21 11:27:57 +00:00
ceriel
8ffc86d8ec bug fix: code referred to token attribute of wrong token! 1997-02-17 15:14:55 +00:00
ceriel
793e393bb0 Bug fix: conversion is OK if arg = 0.0 1997-01-27 14:06:51 +00:00
ceriel
92033f240c troff flag -Tlpr is now changed to -Tlp 1996-12-04 14:03:12 +00:00
ceriel
03ce92b072 Fixed typo in catchsig.s 1996-11-26 15:05:10 +00:00
ceriel
87c475ff69 renamed _len to _length: conflict with name in minix lib 1996-11-26 15:02:36 +00:00
ceriel
06f158f980 Added -n flag 1996-11-21 10:14:26 +00:00
ceriel
044f3c9814 fixed a bug: STD/LDD was generated on odd-numbered reg 1996-11-19 13:28:41 +00:00
ceriel
dc65347504 Fixed a couple of minor bugs 1996-11-19 13:27:56 +00:00
ceriel
b4bda72e7f Some fixes 1996-11-19 09:12:36 +00:00
ceriel
fd2a479d52 Stupid confusion with fdtox and fxtod 1996-11-18 16:49:54 +00:00
ceriel
55f1a0f8e8 Fixed typo 1996-10-22 14:34:16 +00:00
ceriel
0f128c0bed Added LONGCARD as a local extension 1996-08-14 07:42:40 +00:00
ceriel
08b6918ed8 Moved TryToString call into ChkAssCompat 1996-06-06 07:47:00 +00:00
ceriel
9a0c40a6b5 Fix: compatibility check in RETURN statement 1996-06-06 07:37:02 +00:00
ceriel
1253529533 fix in cmpxchg instruction; i486 book is wrong 1996-04-25 08:38:05 +00:00
ceriel
f2d5520159 fix in flushbuf: make sure it does not return EOF when it actually succeeds 1996-04-24 13:06:00 +00:00
ceriel
aac653056b fixed bug with %[] in doscan.c 1996-04-01 09:08:59 +00:00
ceriel
bbdf73b85a Fix to fix in idf.c 1996-02-19 12:19:47 +00:00
ceriel
d516ce7b75 Fixed bug: crashed when parameter has same name as function 1995-12-20 09:58:56 +00:00
ceriel
ed95a6c170 Some improvements 1995-12-19 09:30:48 +00:00
ceriel
6e1aa1564b Removed unclear test 1995-12-18 11:02:18 +00:00
ceriel
ec4cf10bbf removed 1995-12-06 14:15:11 +00:00
ceriel
d99dfe6e0c removed 1995-12-06 14:04:51 +00:00
ceriel
339c8f06be removed 1995-12-06 13:28:04 +00:00
ceriel
5fd4671c8b removed MakeVersion 1995-12-06 13:26:54 +00:00
ceriel
c629ab32f9 removed Makefile 1995-12-06 13:26:03 +00:00
ceriel
26edba4590 removed Makefile, added README 1995-12-06 13:25:23 +00:00
ceriel
5289b6985e added file 1995-12-06 13:23:09 +00:00
ceriel
2d7f92d93a removed 1995-12-06 13:21:54 +00:00
ceriel
f4b9fd5b56 Added pascal compiler report 1995-12-06 13:17:50 +00:00
ceriel
e3ec5a31d6 removed 1995-12-06 13:08:44 +00:00
ceriel
0fbae249cc deleted 1995-12-06 13:04:25 +00:00
ceriel
e9bedfcbd2 Removed Version.c 1995-12-06 09:52:54 +00:00
ceriel
d92f198d58 Copied versions of dv[iu].s from ../../m68k2/libem. 1995-12-05 15:38:55 +00:00
ceriel
ba76ac9fed A couple of minor changes 1995-12-05 13:51:43 +00:00
ceriel
61e0f01e71 Improved the pow() function to give more exact results 1995-12-05 12:29:36 +00:00
ceriel
ca09a9b0e8 Fixed obscure bug in setvbuf 1995-12-04 17:11:54 +00:00
ceriel
42b693b1af Corrected nested function info 1995-12-04 16:42:11 +00:00
ceriel
989015a051 Fixed warnings, recognize -gdb 1995-12-04 15:29:42 +00:00
ceriel
a240c8014c Made to work; how did this get into the repository??? 1995-12-04 15:20:46 +00:00
ceriel
9ed6b40a86 Pass -gdb on to M2 compiler 1995-12-04 15:01:07 +00:00
ceriel
6bb01f61b7 Fixed a bug with local character arrays initialized with a string 1995-11-15 09:42:25 +00:00
ceriel
7a927fe2da Fix: wrong offsets for locals when < -32768, installation error for 'show' 1995-11-08 11:09:14 +00:00
ceriel
121acff9d8 Fix: wrong offsets for locals when < -32768 1995-11-08 11:08:09 +00:00
ceriel
624bb4e0d9 Fixed bug with labels 1995-11-07 10:37:59 +00:00
ceriel
71aea9f012 Get() parameter is optional 1995-11-01 16:54:17 +00:00
ceriel
c62de7632a Header file was included twice 1995-11-01 15:59:33 +00:00
ceriel
cd31b4fce6 Fix by Charles Lindsey 1995-09-25 08:09:55 +00:00
ceriel
ede92325cc Fixed some bugs with the setxx instructions 1995-09-12 12:09:08 +00:00
ceriel
32f4c842ba Fix: setxx instructions should only accept byte registers 1995-09-12 12:08:42 +00:00
ceriel
ca79ae568d Added libassert for when DEBUG is defined 1995-08-18 07:28:47 +00:00
ceriel
21d49ffece A68 rules from Charles Lindsey 1995-08-18 07:27:57 +00:00
ceriel
3046c82d45 lib --> lib.bin for a68 1995-08-18 07:26:46 +00:00
ceriel
efa0bfa27d use stdarg when compiling with ANSI C compiler 1995-08-18 07:26:18 +00:00
ceriel
5bfeacc519 Changed for sparc_solarisdescr 1995-08-18 07:24:18 +00:00
ceriel
b8dbfe39cb use stdarg when compiling with ANSI C compiler 1995-08-17 16:51:09 +00:00
ceriel
48fe3a11bf use stdarg when compiling with ANSI C compiler 1995-08-17 16:43:36 +00:00
ceriel
fc5a840f24 use stdarg when compiling with ANSI C compiler 1995-08-17 16:34:29 +00:00
ceriel
e3d9a68078 use stdarg when compiling with ANSI C compiler 1995-08-17 16:14:45 +00:00
ceriel
25a03c14a5 use stdarg when compiling with ANSI C compiler 1995-08-17 15:20:35 +00:00
ceriel
ad5b127ae9 use stdarg when compiling with ANSI C compiler 1995-08-17 15:01:56 +00:00
ceriel
bf2357624d use stdarg when compiling with ANSI C compiler 1995-08-17 14:36:05 +00:00
ceriel
07586a0fdd use stdarg when compiling with ANSI C compiler, and some other minor changes 1995-08-17 13:33:55 +00:00
ceriel
86412ca30d 'ed -' is no longer supported on some systems. replaced by 'ed -s' 1995-08-17 12:22:33 +00:00
ceriel
86218a5f3d Some minor changes 1995-08-17 10:03:43 +00:00
ceriel
81453a1f7f Re-ordered for incompatible Linux shell 1995-08-15 14:59:28 +00:00
ceriel
25cd851c6e Don't use SIGEMT; it is not portable 1995-08-15 09:10:39 +00:00
ceriel
44dd8a38e6 'ed -' is no longer supported by some systems. Use 'ed -s' 1995-08-15 08:43:10 +00:00
ceriel
0180e9da44 'ed -' is no longer supported by some systems. Use 'ed -s' 1995-08-14 15:09:59 +00:00
ceriel
6f0543c1a3 removed dependency on /usr/include/varargs.h 1995-08-14 15:08:46 +00:00
ceriel
6ecb9f3d76 create modules/h too, for varargs.h 1995-08-14 15:07:53 +00:00
ceriel
0103de87a4 'ed -' is no longer supported by some systems. Use 'ed -s' 1995-08-14 08:08:56 +00:00
ceriel
1e3cd3ce83 Fixed typo 1995-07-31 09:17:14 +00:00
ceriel
7efd46f437 Added copyright notice 1995-07-31 09:10:42 +00:00
ceriel
5d7b88affb Minor mod to Makefile 1995-07-27 07:14:54 +00:00
ceriel
16856562c6 declare errno in cerror.s 1995-07-26 08:55:56 +00:00
ceriel
bfed0ed0ea Use _end instead of $_end. $_end does not always indicate the right
position. This should be fixed as well, but how?
1995-07-26 08:52:03 +00:00
ceriel
f205e09b97 Fix by Charles Lindsey: still used reg vars, despite ms_gto 1995-07-26 08:44:35 +00:00
ceriel
3cfb4fd0e9 Fixed typo 1995-07-26 08:43:02 +00:00
ceriel
8490348a28 Some changes suggested by Charles Lindsey 1995-07-26 08:42:56 +00:00
ceriel
fdc6328400 Set B_busy 1995-07-25 16:49:15 +00:00
ceriel
3531d6e107 Several fixes from Charles Lindsey 1995-07-25 16:43:42 +00:00
ceriel
1da92a1e0d Fix: produced jgt instead of jg 1995-07-25 13:21:53 +00:00
ceriel
874ec87fce Fixes: some conditionals were evaluated wrong due to the overflow bit 1995-07-21 12:05:26 +00:00
ceriel
94d63a8d57 Added Posix names 1995-06-28 09:46:39 +00:00
ceriel
3ef8ae0b65 Some fixes 1995-06-12 14:28:36 +00:00
ceriel
b16b1c714e Fix: got into infinite loop 1995-05-02 12:23:28 +00:00
ceriel
3a1dc8fd59 Fix: opaque types my only be defined in the CORRESPONDING implementation 1995-04-26 13:54:56 +00:00
ceriel
661464ed0f Fix: had a semicolon too much (KJB) 1995-04-18 13:56:20 +00:00
ceriel
be42195a77 minor improvement 1995-03-29 11:57:27 +00:00
ceriel
1a85dc252e Reordered patterns 1995-03-28 11:22:34 +00:00
ceriel
74aa5c6e0c Added some patterns 1995-03-28 10:01:02 +00:00
ceriel
35d142194c Made arith_sign more portable 1995-03-28 09:10:31 +00:00
ceriel
a414a9c9c1 Fixed: % and / were interchanged 1995-03-27 11:46:47 +00:00
ceriel
0a972cd644 Fixed typo 1995-03-27 11:22:57 +00:00
ceriel
d66053e2f7 free WorkingDir only if including cpp 1995-03-24 13:56:20 +00:00
ceriel
3c6c7aa1d7 Fix: C_pt_ps and C_pt_op prototypes only valid when READABLE_EM is defined 1995-03-24 10:27:28 +00:00
ceriel
4e11ffc3ac Added Amake.srclist 1995-03-21 09:39:29 +00:00
ceriel
9c8a8e6083 Use TARGETHOME for manual page 1995-03-17 14:11:47 +00:00
ceriel
fe357ec048 Added filter for TARGETHOME, needed for man pages that include an include-file 1995-03-17 14:11:06 +00:00
ceriel
66d018dc88 Added -F option to indicate name of floating point hook 1995-03-17 12:37:06 +00:00
ceriel
6236e7f42e Fix: never replace LAR/SAR by AAR LOI/STI if descriptor is not in ROM 1995-03-17 12:32:47 +00:00
ceriel
df52f04600 Also create sparc_solarisdescr 1995-03-17 11:00:29 +00:00
ceriel
d828522f35 Added an option to strip the grammar from its actions 1995-02-24 12:10:44 +00:00
ceriel
decc4ce807 Fix: description of setxx should write arg 1995-02-24 11:53:43 +00:00
ceriel
6871c56487 Fix for membership test with constant LHS 1994-12-20 16:00:57 +00:00
ceriel
1aaab3dd69 do not allow ',' as separator in parameter declarations; this results in bad C-code 1994-12-20 12:47:48 +00:00
ceriel
94fde85384 Added more precise info about parameters 1994-12-20 12:40:21 +00:00
cvs2hg
d3bb7c1f56 fixup commit for tag 'oct-1' 1994-12-06 09:12:22 +00:00
2038 changed files with 41609 additions and 100633 deletions

74
.distr
View File

@ -1,21 +1,57 @@
Action
Copyright
NEW
README README
TakeAction CHANGES
bin Copyright
doc pm
emtest pmfile
etc config.pm
fast
fcc
first
h h
include modules/h
modules
lang first
lib util/data
mach util/LLgen
man
util modules/src/alloc
Versions modules/src/assert
modules/src/system
modules/src/string
modules/src/read_em
modules/src/em_code
modules/src/em_mes
modules/src/print
modules/src/object
modules/src/idf
modules/src/input
modules/src/flt_arith
util/amisc
util/cmisc
util/ack
lib/descr/fe
util/arch
#util/cpp
util/cgg
util/ncgg
util/misc
util/opt
util/ego
util/topgen
util/led
lang/cem
lang/pc
lang/m2
#lang/occam
#lang/basic
mach/proto
mach/i80
mach/i86
mach/i386
plat/cpm
plat/pc86
plat/linux386
examples

8
Action
View File

@ -30,10 +30,10 @@ name "Modules"
dir modules/src dir modules/src
indir indir
end end
name "LL(1) Parser generator" ! name "LL(1) Parser generator"
dir util/LLgen ! dir util/LLgen
action "make firstinstall && make clean" ! action "make firstinstall && make clean"
end ! end
name "C preprocessor" name "C preprocessor"
dir util/cpp dir util/cpp
end end

35
CHANGES Normal file
View File

@ -0,0 +1,35 @@
# $Source$
# $State$
# $Revision$
6.0pre4
Fixed some minor bit-rotting issues that were preventing compilation on
modern Linux systems.
6.0pre3
Added the cpm platform. Made some optimisations to the i80 code generator,
including getting topgen up and running and adding some peephole optimiser
rules. Fixed loads of bugs in ego so that it now works on platforms that
support it (pc86 and linux386). Made the floating point work on platforms
that support it (pc86 and linux386 again). Made stdint.h work. Lots and lots
of bugfixes and tweaks everywhere.
6.0pre2
Much simplified the syscall interface by disabling libmon and instead
calling the syscalls directly. Disabled the K&R C compiler and libc because
it doesn't actually gain us anything and has a high maintenance load --- the
ANSI C compiler works fine with K&R C. Adapted the rest of the system to
build with the ANSI C compiler. Rewrote the pc86 syscall interface and added
linux386 support, using the i386 code generator. Lots and lots of bugfixes
and tweaks everywhere.
6.0pre1
First working version of the 6.0 release stream. Working frontends: both C
compilers, Pascal, Modula-2, Basic and Occam. Working backends: i86. Working
platforms: pc86, the very noddy testbed setup that produces floppy disk
images.

View File

@ -1,17 +1,32 @@
/* Copyright (c) 1987, 1990, 1993, 2005 Vrije Universiteit, Amsterdam, The Netherlands.
* A M S T E R D A M C O M P I L E R K I T All rights reserved.
*
* Copyright (c) 1987, 1991, 1993 by the Vrije Universiteit, Amsterdam, Redistribution and use of the Amsterdam Compiler Kit in source and
* The Netherlands. binary forms, with or without modification, are permitted provided
* that the following conditions are met:
* Permission to use, sell, duplicate or disclose this software must be
* obtained in writing. Requests for such permissions may be sent to * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* Dr. Andrew S. Tanenbaum
* Wiskundig Seminarium * Redistributions in binary form must reproduce the above
* Vrije Universiteit copyright notice, this list of conditions and the following
* De Boelelaan 1081a disclaimer in the documentation and/or other materials provided
* 1081 HV Amsterdam with the distribution.
* The Netherlands
* * Neither the name of Vrije Universiteit nor the names of the
*/ software authors or contributors may be used to endorse or
promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND
CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL VRIJE UNIVERSITEIT OR ANY AUTHORS OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,3 +0,0 @@
p=/proj/em/Work
sh TakeAction 'make distr' $p/distr/Action
sh TakeAction 'make distr' $p/distr/Action1

View File

@ -1,35 +0,0 @@
cmp: # compile everything and compare
(cd etc ; make cmp )
(cd util ; make cmp )
(cd lang ; make cmp )
(cd mach ; make cmp )
install: # compile everything to machine code
(cd etc ; make install )
(cd util ; make install )
(cd lang/cem ; make install )
(cd mach ; make install )
(cd lang/pc ; make install )
clean: # remove all non-sources, except boot-files
(cd doc ; make clean )
(cd man ; make clean )
(cd h ; make clean )
(cd etc ; make clean )
(cd util ; make clean )
(cd lang ; make clean )
(cd mach ; make clean )
opr: # print all sources
make pr | opr
pr: # print all sources
@( pr Makefile ; \
(cd doc ; make pr ) ; \
(cd man ; make pr ) ; \
(cd h ; make pr ) ; \
(cd etc ; make pr ) ; \
(cd lang ; make pr ) ; \
(cd util ; make pr ) ; \
(cd mach ; make pr ) \
)

13
NEW
View File

@ -1,4 +1,15 @@
This is ACK distribution 5.2. This is ACK distribution 5.6.
This is a minor update of 5.5, the last public release from Vrije University.
Only minor changes have been made to make the system build on modern
platforms.
The NEW document from the previous release follows.
David Given
dg@cowlark.com 2005-06-24
-----------------------------------------------------------------------------
The only addition with respect to the 5th ACK distribution is the support The only addition with respect to the 5th ACK distribution is the support
for Solaris 2 on SPARCs. It also contains many bug fixes. for Solaris 2 on SPARCs. It also contains many bug fixes.

172
README
View File

@ -1,2 +1,170 @@
Before starting installation you should read THE AMSTERDAM COMPILER KIT V6.0pre4
the file doc/install.pr ===================================
© 1987-2005 Vrije Universiteit, Amsterdam
2010-08-08
INTRODUCTION
============
The Amsterdam Compiler Kit is a complete compiler toolchain consisting of
front end compilers for a number of different languages, code generators,
support libraries, and all the tools necessary to go from source code to
executable on any of the platforms it supports.
This is an early prerelease of the apocryphal version 6.0 release. Not a
lot is supported, the build mechanism needs work, and a lot of things are
probably broken. However, what's there should be sufficient to get things
done and to evaluate how the full 6.0 release should work.
SUPPORT
=======
Languages:
ANSI C, Pascal, Modula 2. K&R is supported via the ANSI C compiler.
Platforms:
pc86 produces bootable floppy disk images for 8086 PCs
linux386 produces ELF executables for PC Linux systems
cpm produces i80 CP/M .COM files
INSTALLATION
============
The version 6.0 build mechanism has been completely rewritten and is based
around the Prime Mover build tool (see http://primemover.sf.net for more
information). Installation ought to be fairly straightforward.
Requirements:
- an ANSI C compiler. Currently, I'm afraid, it's hard-coded to use gcc.
To change, try changing the variable definitions in first/c.pm. This also
needs to be available as 'cc' from the shell.
- about 20MB free in /tmp (or some other temporary directory).
- about 6MB in the target directory.
Instructions:
- edit config.pm. There's a small section at the top containing some editable
variables. Probably the only one you may want to edit is PREFIX, which
changes where the ACK installs to.
- Run:
./pm configure
...from the command line. This will write out a configuration file.
- Run:
./pm
...from the command line. This will actually do the build. This takes
about two minutes on my 1.6GHz Athlon Linux machine and about 30 on my
166MHz Pentium OpenBSD machine.
- Run:
./pm install
...from the command line (possibly with sudo). This will install the built
ACK into whatever directory you nominated in PREFIX.
The ACK should now be ready to use.
USAGE
=====
Currently I haven't sorted out all the documentation --- it's supplied in the
distribution, but not all of it gets installed yet --- so here is a quickstart
guide.
The main command to use is 'ack'. This invokes the compiler and the linker.
Some useful options include:
-m<platform> build for the specified platform
-o <file> specifies the output file
-c produce a .o file
-c.s produce a .s assembly file
-O enable optimisation
-ansi compile ANSI C (when using the C compiler)
<file> build file
ack figures out which language to use from the file extension:
.c C (ANSI or K&R)
.b Basic
.mod Modula-2
.ocm Occam 1
.p Pascal
.o object files
.s assembly files
For further information, see the man page (which actually does get
installed, but is rather out of date).
There are some (known working) example programs in the 'examples' directory.
A sample command line is:
ack -mlinux386 -O examples/paranoia.c
GOTCHAS
=======
There are some things you should be aware of.
- Look at plat/<PLATFORMNAME>/README for information about the two supported
platforms.
- The library support is fairly limited; for C, it's at roughly the ANSI C
level, and for the other languages it's similar.
- When compiling languages other than C, the ACK will usually look at the
first character of the file. If it's a #, then the file will be run through
the C preprocessor anyway.
- BSD systems may need to up the number of file descriptors (e.g.
'ulimit -n 200') before the ACK will compile.
- The ACK uses its own .o format. You won't be able to mix the ACK's object
files and another compiler's.
DISCLAIMER
==========
The ACK is mature, well-tested software, but the environment in which it was
developed for and tested under is rather different from that available on
today's machines. There will probably be little in the way of logical bugs,
but there may be many compilation and API bugs.
If you wish to use the ACK, *please* join the mailing list. We are interested
in any reports of success and particularly, failure. If it does fail for you,
we would love to know why, in as much detail as possible. Bug fixes are even
more welcome.
The ACK is licensed under a BSD-like license. Please see the 'Copyright' file
for the full text.
You can find the mailing list on the project's web site:
http://tack.sourceforge.net/
Please enjoy.
David Given (dtrg on Sourceforge)
dg@cowlark.com
2010-08-08
# $Source$
# $State$
# $Revision$

20
TODO Normal file
View File

@ -0,0 +1,20 @@
# $Source$
# $State$
This file contains things that I have noticed need fixing, but have not
yet been fixed. Everything here should be reasonably low priority. Some
bugs have been bodged around to make things work; these are all marked in
the source with FIXME tags.
* util/int needs to be rewritten to emulate sgtty with termios; look for
FIXMEs.
* mach/i80/dl/nascom.c needs to be rewritten to use termios, not sgtty.
# Revision history
# $Log$
# Revision 2.1 2005-06-24 23:20:41 dtrg
# Added some new readmes at the top level.
#

View File

@ -1,3 +1,5 @@
#!/bin/sh
case $# in case $# in
0) PAR='make install && make clean' ; CMD=Action ;; 0) PAR='make install && make clean' ; CMD=Action ;;
1) PAR="$1" ; CMD=Action ;; 1) PAR="$1" ; CMD=Action ;;

View File

@ -1,3 +1,4 @@
#!/bin/sh
: '$Id$' : '$Id$'
: Compile and make dependencies. First argument is the file on which the : Compile and make dependencies. First argument is the file on which the

View File

@ -1,3 +1,4 @@
#!/bin/sh
: '$Id$' : '$Id$'
: Compile and make dependencies. First argument is the file on which the : Compile and make dependencies. First argument is the file on which the
@ -16,5 +17,5 @@ do
;; ;;
esac esac
done done
$UTIL_HOME/lib.bin/cpp -d -m $cpp_args > $n $UTIL_HOME/lib.bin/cpp -d -m $cpp_args > $n 2>/dev/null
exec $CC $* exec $CC $*

View File

@ -1,3 +1,4 @@
#!/bin/sh
: '$Id$' : '$Id$'
: Compile and make dependencies. First argument is the file on which the : Compile and make dependencies. First argument is the file on which the

View File

@ -1,3 +1,4 @@
#!/bin/sh
: '$Id$' : '$Id$'
: Produce dependencies for all argument files : Produce dependencies for all argument files

View File

@ -1,3 +1,4 @@
#!/bin/sh
: '$Id$' : '$Id$'
: Resolve name clashes in the files on the argument list. If these : Resolve name clashes in the files on the argument list. If these

View File

@ -1 +0,0 @@
exec /usr/em/doc/em/int/em /usr/em/doc/em/int/tables ${1-e.out} core

View File

@ -1,3 +1,4 @@
#!/bin/sh
: '$Id$' : '$Id$'
: Create a lint library file. The name of the library file is constructed : Create a lint library file. The name of the library file is constructed

View File

@ -1,3 +1,4 @@
#!/bin/sh
: '$Id$' : '$Id$'
: Create a lint library file. The name of the library file is constructed : Create a lint library file. The name of the library file is constructed

View File

@ -1,3 +1,5 @@
#!/bin/sh
num=`expr $1 : '.*\.\([1-8]\)'` num=`expr $1 : '.*\.\([1-8]\)'`
if [ -d $2/man ] ; then : ; else mkdir $2/man ; fi if [ -d $2/man ] ; then : ; else mkdir $2/man ; fi
@ -15,4 +17,4 @@ if [ -f $2/man/head ] ; then : ; else cat > $2/man/head <<'EOF'
EOF EOF
fi fi
if [ -d $2/man/man$num ] ; then : ; else mkdir $2/man/man$num ; fi if [ -d $2/man/man$num ] ; then : ; else mkdir $2/man/man$num ; fi
cat $2/man/head $1 > $2/man/man$num/`expr //$1 : '.*/\([^/]*\)'` cat $2/man/head $1 | sed "s!TARGETHOME!$2!" > $2/man/man$num/`expr //$1 : '.*/\([^/]*\)'`

View File

@ -1,3 +1,4 @@
#!/bin/sh
: $Id$ : $Id$
: remove dependencies from a makefile, write result on standard output. : remove dependencies from a makefile, write result on standard output.

71
config.pm Normal file
View File

@ -0,0 +1,71 @@
-- ======================================================================= --
-- ACK CONFIGURATION --
-- (Edit this before building) --
-- ======================================================================= --
-- What platform to build for by default?
DEFAULT_PLATFORM = "pc86"
-- Where should the ACK put its temporary files?
ACK_TEMP_DIR = "/tmp"
-- Where is the ACK going to be installed, eventually?
PREFIX = "/usr/local"
-- ======================================================================= --
-- BROKEN ACK CONFIGURATION --
-- (Currently not editable) --
-- ======================================================================= --
-- FIXME: the following two variables must be set to their Minix variants
-- due to hard-coded references in the descr files.
-- Name of the platform-independent library directory; 'share' on modern
-- systems, 'lib' on Minix-like systems.
PLATIND = "lib"
-- Name of the platform-dependent library directory; 'lib' on modern
-- systems, 'lib.bin' on Minix-like systems.
PLATDEP = "lib.bin"
-- ======================================================================= --
-- BUILD SYSTEM CONFIGURATION --
-- (Not user servicable) --
-- ======================================================================= --
-- Absolute path to the ACK source directory.
ROOTDIR = posix.getcwd().."/"
-- Temporary directory used during the build process.
TEMPDIR = "/tmp/ack-temp/"
-- Directory in which dynamically generated header files will go during
-- the build process.
HEADERDIR = TEMPDIR.."headers/"
-- Directory in which tools used by the build process but which not actually
-- deployed with the ACK will go.
TOOLDIR = TEMPDIR.."tools/"
-- Directory in which the libraries used to build the ACK tools but which are
-- not actually deployed with the ACK will go.
LIBDIR = TEMPDIR.."lib/"
-- Staging area where the installation will be built before actually copying
-- it.
BINDIR = TEMPDIR.."staging/"
-- Directory that the pm cache goes in.
pm.intermediate_cache_dir = TEMPDIR.."pmcache/"

View File

@ -1,3 +0,0 @@
name "EM tables"
dir etc
end

View File

@ -1,16 +0,0 @@
name "m68k2/cg bootstrap files"
dir mach/m68k2/cg
action "make EMHOME=/proj/em/Work distr"
end
name "vax4/cg bootstrap files"
dir mach/vax4/cg
action "make EMHOME=/proj/em/Work distr"
end
name "m68020/ncg bootstrap files"
dir mach/m68020/ncg
action "make EMHOME=/proj/em/Work distr"
end
name "m68k4/cg bootstrap files"
dir mach/m68k4/cg
action "make EMHOME=/proj/em/Work distr"
end

View File

@ -1,8 +1,6 @@
++ ./doc/proto.make made ++ ./doc/install.pr made
++ ./doc/int/.distr made ++ ./doc/int/.distr made
++ ./h/em_mnem.h not present ++ ./etc/new_table_done made
++ ./h/em_pseu.h not present
++ ./h/em_spec.h not present
++ ./lang/cem/cemcom.ansi/Version.c made ++ ./lang/cem/cemcom.ansi/Version.c made
++ ./lang/cem/libcc.ansi/stdlib/malloc.c made ++ ./lang/cem/libcc.ansi/stdlib/malloc.c made
++ ./lang/cem/cemcom/Version.c made ++ ./lang/cem/cemcom/Version.c made
@ -13,8 +11,5 @@
++ ./mach/sparc_solaris/libem/LIST made ++ ./mach/sparc_solaris/libem/LIST made
++ ./util/LLgen/src/LLgen.c.dist made ++ ./util/LLgen/src/LLgen.c.dist made
++ ./util/cpp/Version.c made ++ ./util/cpp/Version.c made
++ ./util/data/em_flag.c not present
++ ./util/data/em_mnem.c not present
++ ./util/data/em_pseu.c not present
++ ./util/ego/share/pop_push.h made ++ ./util/ego/share/pop_push.h made
++ ./util/grind/ops.c made ++ ./util/grind/ops.c made

View File

@ -1,3 +1,27 @@
How to make a distribution
--------------------------
I have written a new tool to generate the distributions that does not rely on
having a local CVS server --- distr/mkdist.
To use it, you need to specify your CVS work tree, the destination directory
that the distribution will be written to, plus flags. It should be self-
documenting; use:
mkdist --help
...to get documentation.
It uses .distr files in exactly the same way as the previous mechanism.
The documentation for the old distribution tools follows.
David Given
dg@cowlark.com
2005-06-25
-----------------------------------------------------------------------------
How to make a fresh distribution: How to make a fresh distribution:
For a distribution you need ".distr" files and RCS files. For a distribution you need ".distr" files and RCS files.
The EM home directory contains a file called ".distr". It contains The EM home directory contains a file called ".distr". It contains
@ -12,7 +36,8 @@ these files.
When all this is correct, use the shell script mktree the extract When all this is correct, use the shell script mktree the extract
the distribution from the EM tree. the distribution from the EM tree.
sh mktree destination_tree repository_tree > destination_tree/Versions 2>f.attf sh mktree destination_tree repository_tree <distrname> 2>f.attf
Use the "cvs rtag" command to give the distribution a name first!
Make sure that the destination tree exists and is empty! Make sure that the destination tree exists and is empty!
Failing to do that will almost certainly result in a welter of Failing to do that will almost certainly result in a welter of
error messages. error messages.
@ -42,8 +67,8 @@ Now, the tree contains all the files in the distribution, but it also contains
files that should not be in the distribution, especially the files created files that should not be in the distribution, especially the files created
by CVS. by CVS.
That is why we now give the command: That is why we now give the command:
dtar cdf distr5 . dtar cdf distr .
The file distr5 is the one you should put on tape! The file distr is the one you should put on tape!
But,.... before doing that: Try it out! But,.... before doing that: Try it out!
Repeat the process described in the installation manual. Repeat the process described in the installation manual.
Only if that succeeds you are sure that you included the files needed. Only if that succeeds you are sure that you included the files needed.

View File

@ -1,10 +1,6 @@
#!/bin/sh
: ${CDIR=.} : ${CDIR=.}
if [ $# = 1 ]
then
${DD-:} $CDIR $1
else
${DD-:} $CDIR
fi
${DF-:} $CDIR .distr ${DF-:} $CDIR .distr
if test ! -r $DESTDIR/$CDIR/.distr if test ! -r $DESTDIR/$CDIR/.distr
then then

View File

@ -1,26 +0,0 @@
-- ./doc/install.pr no RCS file
-- ./h/em_mnem.h no RCS file
-- ./h/em_pseu.h no RCS file
-- ./h/em_spec.h no RCS file
-- ./lang/basic/src/y.tab.c no RCS file
-- ./lang/basic/src/y.tab.h no RCS file
-- ./lang/pc/pem/pem22.m no RCS file
-- ./lang/pc/pem/pem24.m no RCS file
-- ./lang/pc/pem/pem44.m no RCS file
-- ./lib/LLgen/incl no RCS file
-- ./lib/LLgen/rec no RCS file
-- ./mach/m68k2/cg/tables1.c no RCS file
-- ./mach/m68k2/cg/tables1.h no RCS file
-- ./mach/m68020/ncg/tables1.c no RCS file
-- ./mach/m68020/ncg/tables1.h no RCS file
-- ./mach/vax4/cg/tables1.c no RCS file
-- ./mach/vax4/cg/tables1.h no RCS file
-- ./util/LLgen/src/parser no RCS file
-- ./util/LLgen/src/LLgen.c no RCS file
-- ./util/LLgen/src/Lpars.c no RCS file
-- ./util/LLgen/src/Lpars.h no RCS file
-- ./util/LLgen/src/tokens.c no RCS file
-- ./util/data/em_flag.c no RCS file
-- ./util/data/em_mnem.c no RCS file
-- ./util/data/em_pseu.c no RCS file
-- ./util/ego/share/pop_push.h no RCS file

View File

@ -1,3 +1,4 @@
#!/bin/sh
: Utility to make a tree of symbolic links to source tree. : Utility to make a tree of symbolic links to source tree.
: Mount the source tree read-only, use this script, and then try installation. : Mount the source tree read-only, use this script, and then try installation.
case $# in case $# in

View File

@ -1,3 +1,5 @@
#!/bin/sh
set -e set -e
for i in `tail +2 $DESTDIR/$1/LIST` for i in `tail +2 $DESTDIR/$1/LIST`
do do

View File

@ -1,27 +0,0 @@
case $1 in
.) ;;
*) mkdir $DESTDIR/$1
;;
esac
p=$REPDIR/$1
dir=$1
if [ $# = 2 ]
then
if [ -f $2 ]
then
set `fgrep "$dir " $2`
fi
fi
cd $DESTDIR/$dir
if [ $# = 2 ]
then
RV $p $2 > /dev/null 2>&1
echo "$dir $2"
else
if `CV $p > /dev/null 2>&1`
then
echo "$dir `RC -i`"
else
echo "-- $dir CV failed for some reason" 1>&2
fi
fi

177
distr/mkdist Executable file
View File

@ -0,0 +1,177 @@
#!/bin/sh
# $Source$
# $State$
# Set up default variables.
destdir=
srcdir=`pwd`
arch=/usr/local/bin/arch
delete=no
copy="ln"
# --- Options parsing -------------------------------------------------------
while [ "$1" != "" ]; do
case "$1" in
-s|--srcdir)
srcdir="$2"
shift
;;
-d|--destdir)
destdir="$2"
shift
;;
-x|--delete)
delete=yes
;;
-c|--copy)
copy="cp -Rp"
;;
-S|--symlink)
copy="ln -s"
;;
-a|--arch)
arch="$2"
shift
;;
-h|--help)
echo "mkdist [options]"
echo "Options are:"
echo " -s --srcdir <path> The CVS tree to read from. (default: CWD)"
echo " -d --destdir <path> The directory to create the distribution in."
echo " -x --delete Erase the destination directory first."
echo " -c --copy Make physical copies of the files. (default: hardlink)"
echo " -S --symlink Make symbolic links instead of copying or hardlinking."
echo " -a --arch <path> Where the ACK 'arch' tool is."
echo " -h --help Display this message."
exit 0
;;
*)
echo "Unrecognised option. Try --help for help."
exit 1
esac
shift
done
if [ "$destdir" = "" ]; then
echo "You must specify a destination directory. (Try --help for help.)"
exit 1
fi
# --- Main routines ---------------------------------------------------------
# These two routines do the work of traversing the source tree and building
# the distribution tree.
addfile() {
local f
f="${1##$srcdir/}"
mkdir -p $destdir/`dirname $f`
$copy "$1" "$destdir/$f"
}
process_dir() {
local path
local archivename
path=$1
cd $path
echo $PWD
# Look for a LIST file and cache the first line.
archivename=
if [ -f LIST ]; then
archivename=`head -1 LIST`
fi
for i in `cat $path/.distr`; do
case "$i" in
\#*) # Comment. Do nothing.
;;
*)
if [ -d $i ]; then
# This is a directory. Recurse into it.
( process_dir $path/$i )
elif [ -f $i ]; then
# This is a file.
addfile $path/$i
elif [ "$i" = "$archivename" ]; then
# Build the named archive.
$arch cDr `cat LIST`
addfile $path/$archivename
else
echo "Don't know what to do with $i, listed in $PWD/.distr."
exit 1
fi
;;
esac
done
}
# --- Main program ----------------------------------------------------------
# Test to make sure that $arch points to the right thing.
if !(strings $arch | grep archiver > /dev/null); then
echo "$arch does not seem to point at the ACK archiver tool."
echo "(Don't confuse this with the Linux tool for displaying your"
echo "architecture.)"
echo ""
echo "Press RETURN to go ahead anyway, or CTRL+C to abort."
read ignored
fi
# Actually do the work.
echo "Creating distribution from CVS tree: $srcdir"
echo " into destination tree: $destdir"
echo ""
if [ -e $destdir ]; then
if [ "$delete" = "yes" ]; then
echo "Press RETURN to erase $destdir and its contents, or CTRL+C to abort."
read
echo "Erasing..."
rm -rf "$destdir"
else
echo "$destdir exists. Aborting."
exit 1
fi
fi
echo "Working..."
mkdir -p $destdir
process_dir $srcdir
echo "Done."
# Revision history
# $Log$
# Revision 1.5 2007-04-24 19:48:41 dtrg
# Removed bashish.
#
# Revision 1.4 2007/02/25 20:56:41 dtrg
# Performed major renovations to make the script work on OpenBSD.
#
# Revision 1.3 2007/02/24 02:05:56 dtrg
# Removed some bashish; added comment support; removed the make
# distr functionality, as nothing was using it any more and it was
# causing problems.
#
# Revision 1.2 2005/06/24 23:19:23 dtrg
# Added new mkdist tool.
#
# Revision 1.1 2005/06/24 22:13:57 dtrg
# Created new tool to generate distributions.

View File

@ -1,3 +1,5 @@
#!/bin/sh
if [ -f $DESTDIR/$1/$2 ] if [ -f $DESTDIR/$1/$2 ]
then then
: :

View File

@ -1 +0,0 @@
cp .distr $DESTDIR/$1

View File

@ -16,12 +16,26 @@ case $2 in
/*) REPDIR=$2 ;; /*) REPDIR=$2 ;;
*) REPDIR=`pwd`/$2 ;; *) REPDIR=`pwd`/$2 ;;
esac esac
# DD=$DDIR/mkd
# export DD
mkdir -p $DESTDIR
CVSROOT=/usr/proj/em/Repositories
export CVSROOT
cd $DESTDIR
case $# in
3)
cvs checkout world -r $3
;;
2)
cvs checkout world
;;
esac
cd $REPDIR cd $REPDIR
DD=$DDIR/mkd
DF=$DDIR/mkf DF=$DDIR/mkf
DA=$DDIR/mka DA=$DDIR/mka
export DDIR DESTDIR DD DF DA REPDIR export DDIR DESTDIR DF DA REPDIR
$DDIR/dwalk $3
$DDIR/dwalk
cd $DESTDIR cd $DESTDIR
find . -type d -print | xargs chmod "uog+rx" find . -type d -print | xargs chmod "uog+rx"

View File

@ -16,7 +16,6 @@ regadd.doc
toolkit.doc toolkit.doc
v7bugs.doc v7bugs.doc
val.doc val.doc
LLgen
6500.doc 6500.doc
i80.doc i80.doc
z80.doc z80.doc
@ -30,3 +29,4 @@ int
ceg ceg
sparc sparc
lint lint
pascal

View File

@ -1,3 +1,4 @@
LLgen.n LLgen.n
LLgen_NCER.n
LLgen.refs LLgen.refs
proto.make proto.make

View File

@ -338,7 +338,12 @@ grammar rule.
.PP .PP
In order to facilitate communication between the actions and In order to facilitate communication between the actions and
\fILLparse\fR, \fILLparse\fR,
the parsing routines can be given C-like parameters. So, for example the parsing routines can be given C-like parameters.
Each parameter must be declared separately, and each of these declarations must
end with a semicolon.
For the last parameter, the semicolon is optional.
.PP
So, for example
.nf .nf
.ft CW .ft CW
.sp 1 .sp 1
@ -921,7 +926,7 @@ stat { int ident, val; } :
| '\en' | '\en'
; ;
expr(int level, int *val;) { int expr; } : expr(int level; int *val;) { int expr; } :
factor(val) factor(val)
[ %while (prio(tok.t_tokno) >= level) [ %while (prio(tok.t_tokno) >= level)
/* Swallow operators as long as their priority is /* Swallow operators as long as their priority is

2712
doc/LLgen/LLgen_NCER.n Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,15 @@
# $Id$ # $Id$
GRAP=grap
PIC=pic
EQN=eqn EQN=eqn
REFER=refer REFER=refer
TBL=tbl TBL=tbl
TARGET=-Tlp
all: ../LLgen.doc ../LLgen_NCER.doc
../LLgen.doc: LLgen.n LLgen.refs ../LLgen.doc: LLgen.n LLgen.refs
$(REFER) -sA+T -p LLgen.refs LLgen.n | $(EQN) $(TARGET) | $(TBL) > $@ $(REFER) -sA+T -p LLgen.refs LLgen.n | $(EQN) | $(TBL) > $@
../LLgen_NCER.doc: LLgen_NCER.n
$(GRAP) LLgen_NCER.n | pic | eqn > $@

View File

@ -4,9 +4,17 @@
SRC_DIR = $(SRC_HOME)/doc/LLgen SRC_DIR = $(SRC_HOME)/doc/LLgen
GRAP=grap
PIC=pic
EQN=eqn EQN=eqn
REFER=refer REFER=refer
TBL=tbl TBL=tbl
all: $(TARGET_HOME)/doc/LLgen.doc $(TARGET_HOME)/doc/LLgen_NCER.doc
$(TARGET_HOME)/doc/LLgen.doc: $(SRC_DIR)/LLgen.n $(SRC_DIR)/LLgen.refs $(TARGET_HOME)/doc/LLgen.doc: $(SRC_DIR)/LLgen.n $(SRC_DIR)/LLgen.refs
$(REFER) -sA+T -p $(SRC_DIR)/LLgen.refs $(SRC_DIR)/LLgen.n | $(EQN) | $(TBL) > $@ $(REFER) -sA+T -p $(SRC_DIR)/LLgen.refs $(SRC_DIR)/LLgen.n | $(EQN) | $(TBL) > $@
$(TARGET_HOME)/doc/LLgen_NCER.doc: $(SRC_DIR)/LLgen_NCER.n
$(GRAP) $(SRC_DIR)/LLgen_NCER.n | pic | eqn > $@

View File

@ -12,7 +12,8 @@ OPR=dip
RESFILES= \ RESFILES= \
toolkit.$(SUF) install.$(SUF) em.$(SUF) ack.$(SUF) v7bugs.$(SUF) \ toolkit.$(SUF) install.$(SUF) em.$(SUF) ack.$(SUF) v7bugs.$(SUF) \
peep.$(SUF) cg.$(SUF) ncg.$(SUF) regadd.$(SUF) LLgen.$(SUF) \ peep.$(SUF) cg.$(SUF) ncg.$(SUF) regadd.$(SUF) LLgen.$(SUF) \
basic.$(SUF) crefman.$(SUF) pcref.$(SUF) val.$(SUF) ansi_C.$(SUF) \ basic.$(SUF) crefman.$(SUF) pascal.$(SUF) pcref.$(SUF) val.$(SUF) \
ansi_C.$(SUF) \
6500.$(SUF) i80.$(SUF) z80.$(SUF) top.$(SUF) ego.$(SUF) \ 6500.$(SUF) i80.$(SUF) z80.$(SUF) top.$(SUF) ego.$(SUF) \
m68020.$(SUF) occam.$(SUF) m2ref.$(SUF) ceg.$(SUF) nopt.$(SUF) \ m68020.$(SUF) occam.$(SUF) m2ref.$(SUF) ceg.$(SUF) nopt.$(SUF) \
sparc.$(SUF) int.$(SUF) lint.$(SUF) sparc.$(SUF) int.$(SUF) lint.$(SUF)
@ -78,4 +79,4 @@ clean:
# It makes a version of the installation manual, suitable for a simple # It makes a version of the installation manual, suitable for a simple
# line printer. # line printer.
distr: install.doc distr: install.doc
tbl install.doc | nroff -Tlpr $(MS) >install.pr tbl install.doc | nroff -Tlp $(MS) >install.pr

View File

@ -1,6 +0,0 @@
PIC=pic
TBL=tbl
REFER=refer
../ceg.doc: ceg.tr ceg.ref
$(PIC) ceg.tr | $(REFER) -e -p ceg.ref | $(TBL) > $@

View File

@ -1,284 +0,0 @@
.TL
Code Expander
.br
(proposal)
.SH
Introduction
.LP
The \fBcode expander\fR, \fBce\fR, is a program that translates EM-code to
objectcode. The main goal is to translate very fast. \fBce\fR is an instance
of the EM_CODE(3L)-interface. During execution of \fBce\fR, \fBce\fR will build
in core a machine independent objectfile ( NEW A.OUT(5L)). With \fBcv\fR or
with routines supplied by the user the machine independent objectcode will
be converted to a machine dependent object code. \fBce\fR needs
information about the targetmachine (e.g. the opcode's). We divide the
information into two parts:
.IP
- The description in assembly instructions of EM-code instructions.
.IP
- The description in objectcode of assembly instructions.
.LP
With these two tables we can make a \fBcode expander generator\fR which
generates a \fBce\fR. It is possible to put the information in one table
but that will probably introduce (propable) more bugs in the table. So we
divide and conquer. With this approach it is also possible to generate
assembly code ( rather yhan objectcode), wich is useful for debugging.
There is of course a link between the two tables, the link
consist of a restriction on the assembly format. Every assembly
instruction must have the following format:
.sp
INSTR ::= LABEL : MNEMONIC [ OPERAND ( "," OPERAND)* ]
.sp
.LP
\fBCeg\fR uses the following algorithm:
.IP \0\0a)
The assembly table will be converted to a (C-)routine assemble().
assemble() gets as argument a string, the assembler instruction,
and can use the MNEMONIC to execute the corresponding action in the
assembly table.
.IP \0\0b)
The routine assemble() can now be used to convert the EM-code table to
a set of C-routines, wich together form an instance of the
EM_CODE(3L).
.SH
The EM-instruction table
.LP
We use the following grammar:
.sp
.TS
center box ;
l.
TABLE ::= (ROW)*
ROW ::= C_instr ( SPECIAL | SIMPLE)
SPECIAL ::= ( CONDITION SIMPLE)+ 'default' SIMPLE
SIMPLE ::= '==>' ACTIONLIST | '::=' ACTIONLIST
ACTIONLIST ::= [ ACTION ( ';' ACTION)* ] '.'
ACTION ::= function-call | assembly-instruction
.TE
.LP
An example for the 8086:
.LP
.DS
C_lxl
$arg1 == 0 ==> "push bp".
$arg1 == 1 ==> "push EM_BSIZE(bp)".
default ==> "mov cx, $arg1";
"mov si, bp";
"1: mov si, EM_BSIZE(si);
"loop 1b"
"push si".
.DE
.sp
Some remarks:
.sp
* The C_instr is a function indentifier in the EM_CODE(3L)-interface.
.LP
* CONDITION is a "boolean" C-expression.
.LP
* The arguments of an EM-instruction can be used in CONDITION and in assembly
instructions. They are referred by $arg\fIi\fR. \fBceg\fR modifies the
arguments as follows:
.IP \0\0-
For local variables at positive offsets it increases this offset by EM_BSIZE
.IP \0\0-
It makes names en labels unique. The user must supply the formats (see mach.h).
.LP
* function-call is allowed to implement e.g. push/pop optimization.
For example:
.LP
.DS
C_adi
$arg1 == 2 ==> combine( "pop ax");
combine( "pop bx");
"add ax, bx";
save( "push ax").
default ==> arg_error( "C_adi", $arg1).
.DE
.LP
* The C-functions called in the EM-instructions table have to use the routine
assemble()/gen?(). "assembler-instr" is in fact assemble( "assembler-instr").
.LP
* \fBceg\fR takes care not only about the conversions of arguments but also
about
changes between segments. There are situation when one doesn't want
conversion of arguments. This can be done by using ::= in stead of ==>.
This is usefull when two C_instr are equivalent. For example:
.IP
C_slu ::= C_sli( $arg1)
.LP
* There are EM-CODE instructions wich are machine independent (e.g. C_open()).
For these EM_CODE instructions \fBceg\fR will generate \fIdefault\fR-
instructions. There is one exception: in the case of C_pro() the tablewriter
has to supply a function prolog().
.LP
* Also the EM-pseudoinstructions C_bss_\fIcstp\fR(), C_hol_\fIcstp\fR(),
C_con_\fIcstp\fR() and C_rom_\fIcstp\fR can be translated automaticly.
\fBceg\fR only has to know how to interpretate string-constants:
.DS
\&..icon $arg2 == 1 ==> gen1( (char) atoi( $arg1))
$arg2 == 2 ==> gen2( atoi( $arg1))
$arg2 == 4 ==> gen4( atol( $arg1))
\&..ucon $arg2 == 1 ==> gen1( (char) atoi( $arg1))
$arg2 == 2 ==> gen2( atoi( $arg1))
$arg2 == 4 ==> gen4( atol( $arg1))
\&..fcon ::= not_implemented( "..fcon")
.DE
.LP
* Still, life can be made easier for the tablewriter; For the routines wich
he/she didn't implement \fBceg\fR will generate a default instruction wich
generates an error-message. \fBceg\fR seems to generate :
.IP
C_xxx ::= not_implemented( "C_xxx")
.SH
The assembly table
.LP
How to map assembly on objectcode.
.LP
Each row in the table consists of two fields, one field for the assembly
instruction, the other field for the corresponding objectcode. The tablewriter
can use the following primitives to generate code for the machine
instructions :
.IP "\0\0gen1( b)\0\0:" 17
generates one byte in de machine independent objectfile.
.IP "\0\0gen2( w)\0\0:" 17
generates one word ( = two bytes), the table writer can change the byte
order by setting the flag BYTES_REVERSED.
.IP "\0\0gen4( l)\0\0:" 17
generates two words ( = four bytes), the table writer can change the word
order by setting the flag WORDS_REVERSED.
.IP "\0\0reloc( n, o, r)\0\0:" 17
generates relocation information for a label ( = name + offset +
relocationtype).
.LP
Besides these primitives the table writer may use his self written
C-functions. This allows the table writer e.g. to write functions to set
bitfields within a byte.
.LP
There are more or less two methods to encode the assembly instructions:
.IP \0\0a)
MNEMONIC and OPERAND('s) are encoded independently of each other. This can be
done when the target machine has an orthogonal instruction set (e.g. pdp-11).
.IP \0\0b)
MNEMONIC and OPERAND('s) together determine the opcode. In this case the
assembler often uses overloading: one MNEMONIC is used for several
different machine-instructions. For example : (8086)
.br
mov ax, bx
.br
mov ax, variable
.br
These instructions have different opcodes.
.LP
As the transformation MNEMONIC-OPCODE is not one to
one the table writer must be allowed to put restrictions on the operands.
This can be done with type declarations. For example:
.LP
.DS
mov dst:REG, src:MEM ==>
gen1( 0x8b);
modRM( op2.reg, op1);
.DE
.DS
mov dst:REG, src:REG ==>
gen1( 0x89);
modRM( op2.reg, op1);
.DE
.LP
modRM() is a function written by the tablewriter and is used to encode
the operands. This frees the table writer of endless typing.
.LP
The table writer has to do the "typechecking" by himself. But typechecking
is almost the same as operand decoding. So it's more efficient to do this
in one function. We now have all the tools to describe the function
assemble().
.IP
assemble() first calls the function
decode_operand() ( by the table writer written), with two arguments: a
string ( the operand) and a
pointer to a struct. The struct is declared by the table writer and must
consist of at least a field called type. ( the other fields in the struct can
be used to remember information about the decoded operand.) Now assemble()
fires a row wich is selected by mapping the MNEMONIC and the type of the
operands.
.br
In the second field of a row there may be references to other
fields in the struct (e.g. op2.reg in the example above).
.LP
We ignored one problem. It's possible when the operands are encoded, that
not everything is known. For example $arg\fIi\fR arguments in the
EM-instruction table get their value at runtime. This problem is solved by
introducing a function eval(). eval() has a string as argument and returns
an arith. The string consists of constants and/or $arg\fIi\fR's and the value
returned by eval() is the value of the string. To encode the $arg\fIi\fR's
in as few bytes as possible the table writer can use the statements %if,
%else and %endif. They can be used in the same manner as #if, #else and
#endif in C and result in a runtime test. An example :
.LP
.DS
-- Some rows of the assembly table
mov dst:REG, src:DATA ==>
%if sfit( eval( src), 8) /* does the immediate-data fit in 1 byte? */
R53( 0x16 , op1.reg);
gen1( eval( src));
%else
R53( 0x17 , op1.reg);
gen2( eval( src));
%endif
.LD
mov dst:REG, src:REG ==>
gen1( 0x8b);
modRM( op1.reg, op2);
.DE
.DS
-- The corresponding part in the function assemble() :
case MNEM_mov :
decode_operand( arg1, &op1);
decode_operand( arg2, &op2);
if ( REG( op1.type) && DATA( op2.type)) {
printf( "if ( sfit( %s, 8)) {\\\\n", eval( src));
R53( 0x16 , op1.reg);
printf( "gen1( %s)\\\\n", eval( arg2));
printf( "}\\\\nelse {\\\\n");
R53( 0x17 , op1.reg);
printf( "gen2( %s)\\\\n", eval( arg2));
printf( "}\\\\n");
}
else if ( REG( op1.type) && REG( op2.type)) {
gen1( 0x8b);
modRM( op1.reg, op2);
}
.DE
.DS
-- Some rows of the right part of the EM-instruction table are translated
-- in the following C-functions.
"mov ax, $arg1" ==>
if ( sfit( w, 8)) { /* w is the actual argument of C_xxx( w) */
gen1( 176); /* R53() */
gen1( w);
}
else {
gen1( 184);
gen2( w);
}
.LD
"mov ax, bx" ==>
gen1( 138);
gen1( 99); /* modRM() */
.DE
.SH
Restrictions
.LP
.IP \0\01)
The EM-instructions C_exc() is not implemented.
.IP \0\03)
All messages are ignored.

View File

@ -1,276 +0,0 @@
.TL
A prototype Code expander
.NH
Introduction
.PP
A program to be compiled with ACK is first fed into the preprocessor.
The output of the preprocessor goes into the appropiate front end,
whose job it is to produce EM. The EM code generated is
fed into the peephole optimizer, wich scans it with a window of few
instructions, replacing certain inefficient code sequences by better
ones. Following the peephole optimizer follows a backend wich produces
good assembly code. The assembly code goes into the assembler and the objectcode
then goes into the loader/linker, the final component in the pipeline.
.PP
For various applications this scheme is too slow. For example for testing
programs; In this case the program has to be translated fast and the
runtime of the objectcode may be slower. A solution is to build a code
expander ( \fBce\fR) wich translates EM code to objectcode. Of course this
has to
be done automaticly by a code expander generator, but to get some feeling
for the problem we started out to build prototypes.
We built two types of ce's. One wich tranlated EM to assembly, one
wich translated EM to objectcode.
.NH
EM to assembly
.PP
We made one for the 8086 and one for the vax4. These ce's are instances of the
EM_CODE(3L)-interface and produce for a single EM instruction a set
of assembly instruction wich are semantic equivalent.
We implemented in the 8086-ce push/pop-optimalization.
.NH
EM to objectcode
.PP
Instead of producing assembly code we tried to produce vax4-objectcode.
During execution of ce, ce builds in core a machine independent
objectfile ( NEW A.OUT(5L)) and just before dumping the tables this
objectfile is converted to a Berkly 4.2BSD a.out-file. We build two versions;
One with static memory allocation and one with dynamic memory allocation.
If the first one runs out of memory it will give an error message and stop,
the second one will allocate more memory and proceed with producing
objectcode.
.PP
The C-frontend calls the EM_CODE-interface. So after linking the frontend
and the ce we have a pipeline in a program saving a lot of i/o.
It is interesting to compare this C-compiler ( called fcemcom) with "cc -c".
fcemcom1 (the dynamic variant of fcemcom) is tuned in such a way, that
alloc() won't be called.
.NH 2
Compile time
.PP
fac.c is a small program that produces n! ( see below). foo.c is small program
that loops a lot.
.TS
center, box, tab(:);
c | c | c | c | c | c
c | c | n | n | n | n.
compiler : program : real : user : sys : object size
=
fcemcom : sort.c : 31.0 : 17.5 : 1.8 : 23824
fcemcom1 : : 59.0 : 21.2 : 3.3 :
cc -c : : 50.0 : 38.0 : 3.5 : 6788
_
fcemcom : ed.c : 37.0 : 23.6 : 2.3 : 41744
fcemcom1 : : 1.16.0 : 28.3 : 4.6 :
cc -c : : 1.19.0 : 54.8 : 4.3 : 11108
_
fcemcom : cp.c : 4.0 : 2.4 : 0.8 : 4652
fcemcom1 : : 9.0 : 3.0 : 1.0 :
cc -c : : 8.0 : 5.2 : 1.6 : 1048
_
fcemcom : uniq.c : 5.0 : 2.5 : 0.8 : 5568
fcemcom1 : : 9.0 : 2.9 : 0.8 :
cc -c : : 13.0 : 5.4 : 2.0 : 3008
_
fcemcom : btlgrep.c : 24.0 : 7.2 : 1.4 : 12968
fcemcom1 : : 23.0 : 8.1 : 1.2 :
cc -c : : 1.20.0 : 15.3 : 3.8 : 2392
_
fcemcom : fac.c : 1.0 : 0.1 : 0.5 : 216
fecmcom1 : : 2.0 : 0.2 : 0.5 :
cc -c : : 3.0 : 0.7 : 1.3 : 92
_
fcemcom : foo.c : 4.0 : 0.2 : 0.5 : 272
fcemcom1 : : 11.0 : 0.3 : 0.5 :
cc -c : : 7.0 : 0.8 : 1.6 : 108
.TE
.NH 2
Run time
.LP
Is the runtime very bad?
.TS
tab(:), box, center;
c | c | c | c | c
c | c | n | n | n.
compiler : program : real : user : system
=
fcem : sort.c : 22.0 : 17.5 : 1.5
cc : : 5.0 : 2.4 : 1.1
_
fcem : btlgrep.c : 1.58.0 : 27.2 : 4.2
cc : : 12.0 : 3.6 : 1.1
_
fcem : foo.c : 1.0 : 0.7 : 0.1
cc : : 1.0 : 0.4 : 0.1
_
fcem : uniq.c : 2.0 : 0.5 : 0.3
cc : : 1.0 : 0.1 : 0.2
.TE
.NH 2
quality object code
.LP
The runtime is very bad so its interesting to have look at the code which is
produced by fcemcom and by cc -c. I took a program which computes recursively
n!.
.DS
long fac();
main()
{
int n;
scanf( "%D", &n);
printf( "fac is %D\\\\n", fac( n));
}
long fac( n)
int n;
{
if ( n == 0)
return( 1);
else
return( n * fac( n-1));
}
.DE
.br
.br
.br
.br
.LP
"cc -c fac.c" produces :
.DS
fac: tstl 4(ap)
bnequ 7f
movl $1, r0
ret
7f: subl3 $1, 4(ap), r0
pushl r0
call $1, fac
movl r0, -4(fp)
mull3 -4(fp), 4(ap), r0
ret
.DE
.br
.br
.LP
"fcem fac.c fac.o" produces :
.DS
_fac: 0
42: jmp be
48: pushl 4(ap)
4e: pushl $0
54: subl2 (sp)+,(sp)
57: tstl (sp)+
59: bnequ 61
5b: jmp 67
61: jmp 79
67: pushl $1
6d: jmp ba
73: jmp b9
79: pushl 4(ap)
7f: pushl $1
85: subl2 (sp)+,(sp)
88: calls $0,_fac
8f: addl2 $4,sp
96: pushl r0
98: pushl 4(ap)
9e: pushl $4
a4: pushl $4
aa: jsb .cii
b0: mull2 (sp)+,(sp)
b3: jmp ba
b9: ret
ba: movl (sp)+,r0
bd: ret
be: jmp 48
.DE
.NH 1
Conclusions
.PP
comparing "cc -c" with "fcemcom"
.LP
.TS
center, box, tab(:);
c | c s | c | c s
^ | c s | ^ | c s
^ | c | c | ^ | c | c
l | n | n | n | n | n.
program : compile time : object size : runtime
:_::_
: user : sys :: user : sys
=
sort.c : 0.47 : 0.5 : 3.5 : 7.3 : 1.4
_
ed.c : 0.46 : 0.5 : 3.8 : : :
_
cp.c : 0.46 : 0.5 : 4.4 : : :
_
uniq.c : 0.46 : 0.4 : 1.8 : : :
_
btlgrep.c : 0.47 : 0.3 : 5.4 : 7.5 : 3.8
_
fac.c : 0.14 : 0.4 : 2.3 : 1.8 : 1.0
_
foo.c : 0.25 : 0.3 : 2.5 : 5.0 : 1.5
.TE
.PP
The results for fcemcom1 are almost identical; The only thing that changes
is that fcemcom1 is 1.2 slower than fcemcom. ( compile time) This is due to
to an another datastructure . In the static version we use huge array's for
the text- and
data-segment, the relocation information, the symboltable and stringarea.
In the dynamic version we use linked lists, wich makes it expensive to get
and to put a byte on a abritrary memory location. So it is probably better
to use realloc(), because in the most cases there will be enough memory.
.PP
The quality of the objectcode is very bad. The reason is that the frontend
generates bad code and expects the peephole-optimizer to improve the code.
This is also one of the main reasons that the runtime is very bad.
(e.g. the expensive "cii" with arguments 4 and 4 could be deleted.)
So its seems a good
idea to put a new peephole-optimizer between the frontend and the ce.
.PP
Using the peephole optimizer the ce would produce :
.DS
_fac: 0
pushl 4(ap)
tstl (sp)+
beqlu 1f
jmp 3f
1 : pushl $1
jmp 2f
3 : pushl 4(ap)
decl (sp)
calls $0,_fac
addl2 $4,sp
pushl r0
pushl 4(ap)
mull2 (sp)+,(sp)
movl (sp)+,r0
2 : ret
.DE
.PP
Bruce McKenzy already implemented it and made some improvements in the
source code of the ce. The compile-time is two to two and a half times better
and the
size of the objectcode is two to three times bigger.(comparing with "cc -c")
Still we could do better.
.PP
Using peephole- and push/pop-optimization ce could produce :
.DS
_fac: 0
tstl 4(ap)
beqlu 1f
jmp 2f
1 : pushl $1
jmp 3f
2 : decl 4(ap)
calls $0,_fac
addl2 $4,sp
mull3 4(ap), r0, -(sp)
movl (sp)+, r0
3 : ret
.DE
.PP
prof doesn't cooperate, so no profile information.
.PP

View File

@ -1,323 +0,0 @@
.\" $Header$
.nr ID 4
.de hd
'sp 2
'tl ''-%-''
'sp 3
..
.de fo
'bp
..
.tr ~
. TITLE
.de TL
.sp 15
.ce
\\fB\\$1\\fR
..
. AUTHOR
.de AU
.sp 15
.ce
by
.sp 2
.ce
\\$1
..
. DATE
.de DA
.sp 3
.ce
( Dated \\$1 )
..
. INSTITUTE
.de VU
.sp 3
.ce 4
Wiskundig Seminarium
Vrije Universteit
De Boelelaan 1081
Amsterdam
..
. PARAGRAPH
.de PP
.sp
.ti +\n(ID
..
.nr CH 0 1
. CHAPTER
.de CH
.nr SH 0 1
.bp
.in 0
\\fB\\n+(CH.~\\$1\\fR
.PP
..
. SUBCHAPTER
.de SH
.sp 3
.in 0
\\fB\\n(CH.\\n+(SH.~\\$1\\fR
.PP
..
. INDENT START
.de IS
.sp
.in +\n(ID
..
. INDENT END
.de IE
.in -\n(ID
.sp
..
.de PT
.ti -\n(ID
.ta \n(ID
.fc " @
"\\$1@"\c
.fc
..
. DOUBLE INDENT START
.de DS
.sp
.in +\n(ID
.ll -\n(ID
..
. DOUBLE INDENT END
.de DE
.ll +\n(ID
.in -\n(ID
.sp
..
. EQUATION START
.de EQ
.sp
.nf
..
. EQUATION END
.de EN
.fi
.sp
..
. ITEM
.de IT
.sp
.in 0
\\fB~\\$1\\fR
.ti +5
..
.de CS
.br
~-~\\
..
.br
.fi
.TL "Ack-C reference manual"
.AU "Ed Keizer"
.DA "September 12, 1983"
.VU
.wh 0 hd
.wh 60 fo
.CH "Introduction"
The C frontend included in the Amsterdam Compiler Kit
translates UNIX-V7 C into compact EM code [1].
The language accepted is described in [2] and [3].
This document describes which implementation dependent choices were
made in the Ack-C frontend and
some restrictions and additions.
.CH "The language"
.PP
Under the same heading as used in [2] we describe the
properties of the Ack-C frontend.
.IT "2.2 Identifiers"
External identifiers are unique up to 7 characters and allow
both upper and lower case.
.IT "2.3 Keywords"
The word \fBvoid\fP is also reserved as a keyword.
.IT "2.4.3 Character constants"
The ASCII-mapping is used when a character is converted to an
integer.
.IT "2.4.4 Floating constants"
To prevent loss of precision the compiler does not perform
floating point constant folding.
.IT "2.6 Hardware characteristics"
The size of objects of the several arithmetic types and
pointers depend on the EM-implementation used.
The ranges of the arithmetic types depend on the size used,
the C-frontend assumes two's complement representation for the
integral types.
All sizes are multiples of bytes.
The calling program \fIack\fP[4] passes information about the
size of the types to the compiler proper.
.br
However, a few general remarks must be made:
.sp 1
.IS
.PT (a)
The size of pointers is a multiple of
(or equal to) the size of an \fIint\fP.
.PT (b)
The following relations exist for the sizes of the types
mentioned:
.br
.ti +5
\fIchar<=short<=int<=long\fP
.PT (c)
Objects of type \fIchar\fP use one 8-bit byte of storage,
although several bytes are allocated sometimes.
.PT (d)
All sizes are in multiples of bytes.
.PT (e)
Most EM implementations use 4 bytes for floats and 8 bytes
for doubles, but exceptions to this rule occur.
.IE
.IT "4 What's in a name"
The type \fIvoid\fP is added.
Objects of type void do not exist.
Functions declared as returning void, do not return a value at all.
.IT "6.1 Characters and integers"
Objects of type \fIchar\fP are unsigned and do not cause
sign-extension when converted to \fIint\fP.
The range of characters values is from 0 to 255.
.IT "6.3 Floating and integral"
Floating point numbers are truncated towards zero when
converted to the integral types.
.IT "6.4 Pointers and integers"
When a \fIlong\fP is added to or subtracted from a pointer and
longs are larger then pointers the \fIlong\fP is converted to an
\fIint\fP before the operation is performed.
.IT "7.2 Unary operators"
It is allowed to cast any expression to the type \fIvoid\fP.
.IT "8.2 Type specifiers"
One type is added to the type-specifiers:
.br
.IS
void
.IE
.IT "8.5 Structure and union declarations"
The only type allowed for fields is \fIint\fP.
Fields with exactly the size of \fIint\fP are signed,
all other fields are unsigned.
.br
The size of any single structure must be less then 4096 bytes.
.IT "8.6 Initialization"
Initialization of structures containing bit fields is not
allowed.
There is one restriction when using an 'address expression' to initialize
an integral variable.
The integral variable must have the same size as a pointer.
Conversions altering the size of the address expression are not allowed.
.IT "9.10 Return statement"
Return statements of the form:
.IS
return ;
.IE
are the only form of return statement allowed in a function of type
function returning void.
.IT "10.1 External function definitions"
The total amount for storage used for parameters
in any function must be less then 4096 bytes.
The same holds for the total amount of storage occupied by the
automatic variables declared inside any function.
.sp
Using formal parameters whose size is smaller the the size of an int
is less efficient on several machines.
At procedure entry these parameters are converted from integer to the
declared type, because the compiler doesn't know where the least
significant bytes are stored in the int.
.IT "11.2 Scope of externals"
Most C compilers are rather lax in enforcing the restriction
that only one external definition without the keyword
\fIextern\fP is allowed in a program.
The Ack-C frontend is very strict in this.
The only exception is that declarations of arrays with a
missing first array bounds expression are regarded to have an
explicit keyword \fIextern\fP.
.IT "14.4 Explicit pointer conversions"
Pointers may be larger the ints, thus assigning a pointer to an
int and back will not always result in the same pointer.
The process mentioned above works with integrals
of the same size or larger as pointers in all EM implementations
having such integrals.
When converting pointers to an integral type or vice-versa,
the pointers is seen as an unsigned int.
.br
EM guarantees that any object can be placed at a word boundary,
this allows the C-programs to use \fIint\fP pointers
as pointers to objects of any type not smaller than an \fIint\fP.
.CH "Frontend options"
The C-frontend has a few options, these are controlled
by flags:
.IS
.PT -V
This flag is followed by a sequence of letters each followed by
positive integers. Each letter indicates a
certain type, the integer following it specifies the size of
objects of that type. One letter indicates the wordsize used.
.IS
.sp 1
.TS
center tab(:);
l l16 l l.
letter:type:letter:type
w:wordsize:i:int
s:short:l:long
f:float:d:double
p:pointer::
.TE
.sp 1
All existing implementations use an integer size equal to the
wordsize.
.IE
The calling program \fIack\fP[4] provides the frontend with
this flag, with values depending on the machine used.
.sp 1
.PT -l
The frontend normally generates code to keep track of the line
number and source file name at runtime for debugging purposes.
Currently a pointer to a
string containing the filename is stored at a fixed place in
memory at each function
entry and the line number at the start of every expression.
At the return from a function these memory locations are not reset to
the values they had before the call.
Most library routines do not use this feature and thus do not
ruin the current line number and filename when called.
However, you are really unlucky when your program crashes due
to a bug in such a library function, because the line number
and filename do not indicate that something went wrong inside
the library function.
.br
Providing the flag -l to the frontend tells it not to generate
the code updating line number and file name.
This is, for example, used when translating the stdio library.
.br
When the \fIack\fP[4] is called with the -L flag it provides
the frontend with this flag.
.sp 1
.PT -Xp
When this flag is present the frontend generates a call to
the function \fBprocentry\fP at each function entry and a
call to \fBprocexit\fP at each function exit.
Both functions are provided with one parameter,
a pointer to a string containing the function name.
.br
When \fIack\fP is called with the -p flag it provides the
frontend with this flag.
.IE
.CH References
.IS
.PT [1]
A.S. Tanenbaum, Hans van Staveren, Ed Keizer and Johan
Stevenson \fIDescription of a machine architecture for use with
block structured languages\fP Informatica report IR-81.
.sp 1
.PT [2]
B.W. Kernighan and D.M. Ritchie, \fIThe C Programming
language\fP, Prentice-Hall, 1978
.PT [3]
D.M. Ritchie, \fIC Reference Manual\fP
.sp
.PT [4]
UNIX manual ack(I).

View File

@ -1,55 +0,0 @@
REFS=-p refs.opt -p refs.stat -p refs.gen
INTRO=intro/intro?
OV=ov/ov?
IC=ic/ic?
CF=cf/cf?
IL=il/il?
SR=sr/sr?
CS=cs/cs?
SP=sp/sp?
UD=ud/ud?
LV=lv/lv?
CJ=cj/cj?
BO=bo/bo?
RA=ra/ra?
CA=ca/ca?
EGO=$(INTRO) $(OV) $(IC) $(CF) $(IL) $(SR) $(CS) $(SP) $(CJ) $(BO) \
$(UD) $(LV) $(RA) $(CA)
REFER=refer
TROFF=troff
TBL=tbl
TARGET=-Tlp
../ego.doc: refs.opt refs.stat refs.gen intro/head intro/tail $(EGO)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(EGO) intro/tail | $(TBL) > ../ego.doc
ego.f: refs.opt refs.stat refs.gen intro/head intro/tail $(EGO)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(EGO) intro/tail | $(TBL) | $(TROFF) $(TARGET) -ms > ego.f
intro.f: refs.opt refs.stat refs.gen intro/head intro/tail $(INTRO)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(INTRO) intro/tail | $(TBL) | $(TROFF) $(TARGET) -ms > intro.f
ov.f: refs.opt refs.stat refs.gen intro/head intro/tail $(OV)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(OV) intro/tail | $(TBL) | $(TROFF) $(TARGET) -ms > ov.f
ic.f: refs.opt refs.stat refs.gen intro/head intro/tail $(IC)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(IC) intro/tail | $(TBL) | $(TROFF) $(TARGET) -ms > ic.f
cf.f: refs.opt refs.stat refs.gen intro/head intro/tail $(CF)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(CF) intro/tail | $(TBL) | $(TROFF) $(TARGET) -ms > cf.f
il.f: refs.opt refs.stat refs.gen intro/head intro/tail $(IL)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(IL) intro/tail | $(TBL) | $(TROFF) $(TARGET) -ms > il.f
sr.f: refs.opt refs.stat refs.gen intro/head intro/tail $(SR)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(SR) intro/tail | $(TBL) | $(TROFF) $(TARGET) -ms > sr.f
cs.f: refs.opt refs.stat refs.gen intro/head intro/tail $(CS)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(CS) intro/tail | $(TBL) | $(TROFF) $(TARGET) -ms > cs.f
sp.f: refs.opt refs.stat refs.gen intro/head intro/tail $(SP)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(SP) intro/tail | $(TBL) | $(TROFF) $(TARGET) -ms > sp.f
cj.f: refs.opt refs.stat refs.gen intro/head intro/tail $(CJ)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(CJ) intro/tail | $(TBL) | $(TROFF) $(TARGET) -ms > cj.f
bo.f: refs.opt refs.stat refs.gen intro/head intro/tail $(BO)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(BO) intro/tail | $(TBL) | $(TROFF) $(TARGET) -ms > bo.f
ud.f: refs.opt refs.stat refs.gen intro/head intro/tail $(UD)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(UD) intro/tail | $(TBL) | $(TROFF) $(TARGET) -ms > ud.f
lv.f: refs.opt refs.stat refs.gen intro/head intro/tail $(LV)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(LV) intro/tail | $(TBL) | $(TROFF) $(TARGET) -ms > lv.f
ra.f: refs.opt refs.stat refs.gen intro/head intro/tail $(RA)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(RA) intro/tail | $(TBL) | $(TROFF) $(TARGET) -ms > ra.f
ca.f: refs.opt refs.stat refs.gen intro/head intro/tail $(CA)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(CA) intro/tail | $(TBL) | $(TROFF) $(TARGET) -ms > ca.f

View File

@ -1,37 +0,0 @@
HOME=../..
TBL=tbl
NROFF=nroff
SUF=pr
TARGET=-Tlp
head: ../em.$(SUF)
FILES = macr.nr title.nr intro.nr mem.nr ispace.nr dspace.nr mapping.nr \
types.nr descr.nr env.nr traps.nr mach.nr assem.nr \
app.int.nr app.codes.nr app.exam.nr cont.nr
IOP=$(HOME)/etc/ip_spec.t# # to construct itables from
../em.$(SUF): $(FILES) itables dispatdummy em.i Makefile
$(TBL) $(FILES) | $(NROFF) -mkun $(TARGET) > ../em.$(SUF)
app.codes.pr: app.codes.nr itables dispatdummy
itables: $(IOP) ip.awk
awk -f ip.awk $(IOP) | sed 's/-/\\-/g' | $(TBL) >itables
dispatdummy: $(IOP) mkdispatch
mkdispatch < $(IOP) > dispatdummy
sed -f dispat1.sed < dispatdummy | $(TBL) > dispat1
sed -f dispat2.sed < dispatdummy | $(TBL) > dispat2
sed -f dispat3.sed < dispatdummy | $(TBL) > dispat3
mkdispatch: mkdispatch.c
$(CC) -I$(HOME)/h -o mkdispatch mkdispatch.c $(HOME)/lib.bin/em_data.a
.SUFFIXES : .pr .nr
.nr.pr: ; $(TBL) macr.nr $*.nr | $(NROFF) -mkun >$@
clean:
rm -f *.pr itables *.out dispatdummy dispat? *.o mkdispatch

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +0,0 @@
.BP
.AP "EM INTERPRETER"
.nf
.ft CW
.lg 0
.nr x \w' '
.ta \nxu +\nxu +\nxu +\nxu +\nxu +\nxu +\nxu +\nxu +\nxu +\nxu
.so em.i
.ft P
.lg 1
.fi

View File

@ -1,488 +0,0 @@
.BP
.AP "EM INTERPRETER"
.nf
.ta 8 16 24 32 40 48 56 64 72 80
.so em.i
.fi
.BP
.AP "EM CODE TABLES"
The following table is used by the assembler for EM machine
language.
It specifies the opcodes used for each instruction and
how arguments are mapped to machine language arguments.
The table is presented in three columns,
each line in each column contains three or four fields.
Each line describes a range of interpreter opcodes by
specifying for which instruction the range is used, the type of the
opcodes (mini, shortie, etc..) and range for the instruction
argument.
.A
The first field on each line gives the EM instruction mnemonic,
the second field gives some flags.
If the opcodes are minis or shorties the third field specifies
how many minis/shorties are used.
The last field gives the number of the (first) interpreter
opcode.
.N 1
Flags :
.IS 3
.N 1
Opcode type, only one of the following may be specified.
.PS - 5 " "
.PT -
opcode without argument
.PT m
mini
.PT s
shortie
.PT 2
opcode with 2-byte signed argument
.PT 4
opcode with 4-byte signed argument
.PT 8
opcode with 8-byte signed argument
.PE
Secondary (escaped) opcodes.
.PS - 5 " "
.PT e
The opcode thus marked is in the secondary opcode group instead
of the primary
.PE
restrictions on arguments
.PS - 5 " "
.PT N
Negative arguments only
.PT P
Positive and zero arguments only
.PE
mapping of arguments
.PS - 5 " "
.PT w
argument must be divisible by the wordsize and is divided by the
wordsize before use as opcode argument.
.PT o
argument ( possibly after division ) must be >= 1 and is
decremented before use as opcode argument
.PE
.IE
If the opcode type is 2,4 or 8 the resulting argument is used as
opcode argument (least significant byte first).
.N
If the opcode type is mini, the argument is added
to the first opcode - if in range - .
If the argument is negative, the absolute value minus one is
used in the algorithm above.
.N
For shorties with positive arguments the first opcode is used
for arguments in the range 0..255, the second for the range
256..511, etc..
For shorties with negative arguments the first opcode is used
for arguments in the range -1..-256, the second for the range
-257..-512, etc..
The byte following the opcode contains the least significant
byte of the argument.
First some examples of these specifications.
.PS - 5
.PT "aar mwPo 1 34"
Indicates that opcode 34 is used as a mini for Positive
instruction arguments only.
The w and o indicate division and decrementing of the
instruction argument.
Because the resulting argument must be zero ( only opcode 34 may be used
), this mini can only be used for instruction argument 2.
Conclusion: opcode 34 is for "AAR 2".
.PT "adp sP 1 41"
Opcode 41 is used as shortie for ADP with arguments in the range
0..255.
.PT "bra sN 2 60"
Opcode 60 is used as shortie for BRA with arguments -1..-256,
61 is used for arguments -257..-512.
.PT "zer e- 145"
Escaped opcode 145 is used for ZER.
.PE
The interpreter opcode table:
.N 1
.IS 3
.DS B
.so itables
.DE 0
.IE
.P
The table above results in the following dispatch tables.
Dispatch tables are used by interpreters to jump to the
routines implementing the EM instructions, indexed by the next opcode.
Each line of the dispatch tables gives the routine names
of eight consecutive opcodes, preceded by the first opcode number
on that line.
Routine names consist of an EM mnemonic followed by a suffix.
The suffices show the encoding used for each opcode.
.N
The following suffices exist:
.N 1
.VS 1 0
.IS 4
.PS - 11
.PT .z
no arguments
.PT .l
16-bit argument
.PT .lw
16-bit argument divided by the wordsize
.PT .p
positive 16-bit argument
.PT .pw
positive 16-bit argument divided by the wordsize
.PT .n
negative 16-bit argument
.PT .nw
negative 16-bit argument divided by the wordsize
.PT .s<num>
shortie with <num> as high order argument byte
.PT .sw<num>
shortie with argument divided by the wordsize
.PT .<num>
mini with <num> as argument
.PT .<num>W
mini with <num>*wordsize as argument
.PE 3
<num> is a possibly negative integer.
.VS 1 1
.IE
The dispatch table for the 256 primary opcodes:
.DS B
0 loc.0 loc.1 loc.2 loc.3 loc.4 loc.5 loc.6 loc.7
8 loc.8 loc.9 loc.10 loc.11 loc.12 loc.13 loc.14 loc.15
16 loc.16 loc.17 loc.18 loc.19 loc.20 loc.21 loc.22 loc.23
24 loc.24 loc.25 loc.26 loc.27 loc.28 loc.29 loc.30 loc.31
32 loc.32 loc.33 aar.1W adf.s0 adi.1W adi.2W adp.l adp.1
40 adp.2 adp.s0 adp.s-1 ads.1W and.1W asp.1W asp.2W asp.3W
48 asp.4W asp.5W asp.w0 beq.l beq.s0 bge.s0 bgt.s0 ble.s0
56 blm.s0 blt.s0 bne.s0 bra.l bra.s-1 bra.s-2 bra.s0 bra.s1
64 cal.1 cal.2 cal.3 cal.4 cal.5 cal.6 cal.7 cal.8
72 cal.9 cal.10 cal.11 cal.12 cal.13 cal.14 cal.15 cal.16
80 cal.17 cal.18 cal.19 cal.20 cal.21 cal.22 cal.23 cal.24
88 cal.25 cal.26 cal.27 cal.28 cal.s0 cff.z cif.z cii.z
96 cmf.s0 cmi.1W cmi.2W cmp.z cms.s0 csa.1W csb.1W dec.z
104 dee.w0 del.w-1 dup.1W dvf.s0 dvi.1W fil.l inc.z ine.lw
112 ine.w0 inl.-1W inl.-2W inl.-3W inl.w-1 inn.s0 ior.1W ior.s0
120 lae.l lae.w0 lae.w1 lae.w2 lae.w3 lae.w4 lae.w5 lae.w6
128 lal.p lal.n lal.0 lal.-1 lal.w0 lal.w-1 lal.w-2 lar.W
136 ldc.0 lde.lw lde.w0 ldl.0 ldl.w-1 lfr.1W lfr.2W lfr.s0
144 lil.w-1 lil.w0 lil.0 lil.1W lin.l lin.s0 lni.z loc.l
152 loc.-1 loc.s0 loc.s-1 loe.lw loe.w0 loe.w1 loe.w2 loe.w3
160 loe.w4 lof.l lof.1W lof.2W lof.3W lof.4W lof.s0 loi.l
168 loi.1 loi.1W loi.2W loi.3W loi.4W loi.s0 lol.pw lol.nw
176 lol.0 lol.1W lol.2W lol.3W lol.-1W lol.-2W lol.-3W lol.-4W
184 lol.-5W lol.-6W lol.-7W lol.-8W lol.w0 lol.w-1 lxa.1 lxl.1
192 lxl.2 mlf.s0 mli.1W mli.2W rck.1W ret.0 ret.1W ret.s0
200 rmi.1W sar.1W sbf.s0 sbi.1W sbi.2W sdl.w-1 set.s0 sil.w-1
208 sil.w0 sli.1W ste.lw ste.w0 ste.w1 ste.w2 stf.l stf.W
216 stf.2W stf.s0 sti.1 sti.1W sti.2W sti.3W sti.4W sti.s0
224 stl.pw stl.nw stl.0 stl.1W stl.-1W stl.-2W stl.-3W stl.-4W
232 stl.-5W stl.w-1 teq.z tgt.z tlt.z tne.z zeq.l zeq.s0
240 zeq.s1 zer.s0 zge.s0 zgt.s0 zle.s0 zlt.s0 zne.s0 zne.s-1
248 zre.lw zre.w0 zrl.-1W zrl.-2W zrl.w-1 zrl.nw escape1 escape2
.DE 2
The list of secondary opcodes (escape1):
.N 1
.DS B
0 aar.l aar.z adf.l adf.z adi.l adi.z ads.l ads.z
8 adu.l adu.z and.l and.z asp.lw ass.l ass.z bge.l
16 bgt.l ble.l blm.l bls.l bls.z blt.l bne.l cai.z
24 cal.l cfi.z cfu.z ciu.z cmf.l cmf.z cmi.l cmi.z
32 cms.l cms.z cmu.l cmu.z com.l com.z csa.l csa.z
40 csb.l csb.z cuf.z cui.z cuu.z dee.lw del.pw del.nw
48 dup.l dus.l dus.z dvf.l dvf.z dvi.l dvi.z dvu.l
56 dvu.z fef.l fef.z fif.l fif.z inl.pw inl.nw inn.l
64 inn.z ior.l ior.z lar.l lar.z ldc.l ldf.l ldl.pw
72 ldl.nw lfr.l lil.pw lil.nw lim.z los.l los.z lor.s0
80 lpi.l lxa.l lxl.l mlf.l mlf.z mli.l mli.z mlu.l
88 mlu.z mon.z ngf.l ngf.z ngi.l ngi.z nop.z rck.l
96 rck.z ret.l rmi.l rmi.z rmu.l rmu.z rol.l rol.z
104 ror.l ror.z rtt.z sar.l sar.z sbf.l sbf.z sbi.l
112 sbi.z sbs.l sbs.z sbu.l sbu.z sde.l sdf.l sdl.pw
120 sdl.nw set.l set.z sig.z sil.pw sil.nw sim.z sli.l
128 sli.z slu.l slu.z sri.l sri.z sru.l sru.z sti.l
136 sts.l sts.z str.s0 tge.z tle.z trp.z xor.l xor.z
144 zer.l zer.z zge.l zgt.l zle.l zlt.l zne.l zrf.l
152 zrf.z zrl.pw dch.z exg.s0 exg.l exg.z lpb.z gto.l
.DE 2
Finally, the list of opcodes with four byte arguments (escape2).
.DS
0 loc
.DE 0
.BP
.AP "AN EXAMPLE PROGRAM"
.DS B
1 program example(output);
2 {This program just demonstrates typical EM code.}
3 type rec = record r1: integer; r2:real; r3: boolean end;
4 var mi: integer; mx:real; r:rec;
5
6 function sum(a,b:integer):integer;
7 begin
8 sum := a + b
9 end;
10
11 procedure test(var r: rec);
12 label 1;
13 var i,j: integer;
14 x,y: real;
15 b: boolean;
16 c: char;
17 a: array[1..100] of integer;
18
19 begin
20 j := 1;
21 i := 3 * j + 6;
22 x := 4.8;
23 y := x/0.5;
24 b := true;
25 c := 'z';
26 for i:= 1 to 100 do a[i] := i * i;
27 r.r1 := j+27;
28 r.r3 := b;
29 r.r2 := x+y;
30 i := sum(r.r1, a[j]);
31 while i > 0 do begin j := j + r.r1; i := i - 1 end;
32 with r do begin r3 := b; r2 := x+y; r1 := 0 end;
33 goto 1;
34 1: writeln(j, i:6, x:9:3, b)
35 end; {test}
36 begin {main program}
37 mx := 15.96;
38 mi := 99;
39 test(r)
40 end.
.DE 0
.BP
The EM code as produced by the Pascal-VU compiler is given below. Comments
have been added manually. Note that this code has already been optimized.
.DS B
mes 2,2,2 ; wordsize 2, pointersize 2
.1
rom 't.p\e000' ; the name of the source file
hol 552,-32768,0 ; externals and buf occupy 552 bytes
exp $sum ; sum can be called from other modules
pro $sum,2 ; procedure sum; 2 bytes local storage
lin 8 ; code from source line 8
ldl 0 ; load two locals ( a and b )
adi 2 ; add them
ret 2 ; return the result
end 2 ; end of procedure ( still two bytes local storage )
.2
rom 1,99,2 ; descriptor of array a[]
exp $test ; the compiler exports all level 0 procedures
pro $test,226 ; procedure test, 226 bytes local storage
.3
rom 4.8F8 ; assemble Floating point 4.8 (8 bytes) in
.4 ; global storage
rom 0.5F8 ; same for 0.5
mes 3,-226,2,2 ; compiler temporary not referenced by address
mes 3,-24,2,0 ; the same is true for i, j, b and c in test
mes 3,-22,2,0
mes 3,-4,2,0
mes 3,-2,2,0
mes 3,-20,8,0 ; and for x and y
mes 3,-12,8,0
lin 20 ; maintain source line number
loc 1
stl -4 ; j := 1
lni ; lin 21 prior to optimization
lol -4
loc 3
mli 2
loc 6
adi 2
stl -2 ; i := 3 * j + 6
lni ; lin 22 prior to optimization
lae .3
loi 8
lal -12
sti 8 ; x := 4.8
lni ; lin 23 prior to optimization
lal -12
loi 8
lae .4
loi 8
dvf 8
lal -20
sti 8 ; y := x / 0.5
lni ; lin 24 prior to optimization
loc 1
stl -22 ; b := true
lni ; lin 25 prior to optimization
loc 122
stl -24 ; c := 'z'
lni ; lin 26 prior to optimization
loc 1
stl -2 ; for i:= 1
2
lol -2
dup 2
mli 2 ; i*i
lal -224
lol -2
lae .2
sar 2 ; a[i] :=
lol -2
loc 100
beq *3 ; to 100 do
inl -2 ; increment i and loop
bra *2
3
lin 27
lol -4
loc 27
adi 2 ; j + 27
sil 0 ; r.r1 :=
lni ; lin 28 prior to optimization
lol -22 ; b
lol 0
stf 10 ; r.r3 :=
lni ; lin 29 prior to optimization
lal -20
loi 16
adf 8 ; x + y
lol 0
adp 2
sti 8 ; r.r2 :=
lni ; lin 23 prior to optimization
lal -224
lol -4
lae .2
lar 2 ; a[j]
lil 0 ; r.r1
cal $sum ; call now
asp 4 ; remove parameters from stack
lfr 2 ; get function result
stl -2 ; i :=
4
lin 31
lol -2
zle *5 ; while i > 0 do
lol -4
lil 0
adi 2
stl -4 ; j := j + r.r1
del -2 ; i := i - 1
bra *4 ; loop
5
lin 32
lol 0
stl -226 ; make copy of address of r
lol -22
lol -226
stf 10 ; r3 := b
lal -20
loi 16
adf 8
lol -226
adp 2
sti 8 ; r2 := x + y
loc 0
sil -226 ; r1 := 0
lin 34 ; note the abscence of the unnecesary jump
lae 22 ; address of output structure
lol -4
cal $_wri ; write integer with default width
asp 4 ; pop parameters
lae 22
lol -2
loc 6
cal $_wsi ; write integer width 6
asp 6
lae 22
lal -12
loi 8
loc 9
loc 3
cal $_wrf ; write fixed format real, width 9, precision 3
asp 14
lae 22
lol -22
cal $_wrb ; write boolean, default width
asp 4
lae 22
cal $_wln ; writeln
asp 2
ret 0 ; return, no result
end 226
exp $_main
pro $_main,0 ; main program
.6
con 2,-1,22 ; description of external files
.5
rom 15.96F8
fil .1 ; maintain source file name
lae .6 ; description of external files
lae 0 ; base of hol area to relocate buffer addresses
cal $_ini ; initialize files, etc...
asp 4
lin 37
lae .5
loi 8
lae 2
sti 8 ; mx := 15.96
lni ; lin 38 prior to optimization
loc 99
ste 0 ; mi := 99
lni ; lin 39 prior to optimization
lae 10 ; address of r
cal $test
asp 2
loc 0 ; normal exit
cal $_hlt ; cleanup and finish
asp 2
end 0
mes 5 ; reals were used
.DE 0
The compact code corresponding to the above program is listed below.
Read it horizontally, line by line, not column by column.
Each number represents a byte of compact code, printed in decimal.
The first two bytes form the magic word.
.N 1
.IS 3
.DS B
173 0 159 122 122 122 255 242 1 161 250 124 116 46 112 0
255 156 245 40 2 245 0 128 120 155 249 123 115 117 109 160
249 123 115 117 109 122 67 128 63 120 3 122 88 122 152 122
242 2 161 121 219 122 255 155 249 124 116 101 115 116 160 249
124 116 101 115 116 245 226 0 242 3 161 253 128 123 52 46
56 255 242 4 161 253 128 123 48 46 53 255 159 123 245 30
255 122 122 255 159 123 96 122 120 255 159 123 98 122 120 255
159 123 116 122 120 255 159 123 118 122 120 255 159 123 100 128
120 255 159 123 108 128 120 255 67 140 69 121 113 116 68 73
116 69 123 81 122 69 126 3 122 113 118 68 57 242 3 72
128 58 108 112 128 68 58 108 72 128 57 242 4 72 128 44
128 58 100 112 128 68 69 121 113 98 68 69 245 122 0 113
96 68 69 121 113 118 182 73 118 42 122 81 122 58 245 32
255 73 118 57 242 2 94 122 73 118 69 220 10 123 54 118
18 122 183 67 147 73 116 69 147 3 122 104 120 68 73 98
73 120 111 130 68 58 100 72 136 2 128 73 120 4 122 112
128 68 58 245 32 255 73 116 57 242 2 59 122 65 120 20
249 123 115 117 109 8 124 64 122 113 118 184 67 151 73 118
128 125 73 116 65 120 3 122 113 116 41 118 18 124 185 67
152 73 120 113 245 30 255 73 98 73 245 30 255 111 130 58
100 72 136 2 128 73 245 30 255 4 122 112 128 69 120 104
245 30 255 67 154 57 142 73 116 20 249 124 95 119 114 105
8 124 57 142 73 118 69 126 20 249 124 95 119 115 105 8
126 57 142 58 108 72 128 69 129 69 123 20 249 124 95 119
114 102 8 134 57 142 73 98 20 249 124 95 119 114 98 8
124 57 142 20 249 124 95 119 108 110 8 122 88 120 152 245
226 0 155 249 125 95 109 97 105 110 160 249 125 95 109 97
105 110 120 242 6 151 122 119 142 255 242 5 161 253 128 125
49 53 46 57 54 255 50 242 1 57 242 6 57 120 20 249
124 95 105 110 105 8 124 67 157 57 242 5 72 128 57 122
112 128 68 69 219 110 120 68 57 130 20 249 124 116 101 115
116 8 122 69 120 20 249 124 95 104 108 116 8 122 152 120
159 124 160 255 159 125 255
.DE 0
.IE
.MS T A 0
.ME
.BP
.MS B A 0
.ME
.CT

View File

@ -1,32 +0,0 @@
CFLAGS=-O
HOME=../../..
install \
all: em emdmp tables
tables: mktables $(HOME)/etc/ip_spec.t
mktables $(HOME)/etc/ip_spec.t tables
mktables: mktables.c $(HOME)/h/em_spec.h $(HOME)/h/em_flag.h \
$(HOME)/lib.bin/em_data.a $(HOME)/h/ip_spec.h
$(CC) -I$(HOME)/h -O -o mktables mktables.c $(HOME)/lib.bin/em_data.a
em.out: em.p
apc -mint -O em.p >emerrs ; mv e.out em.out
em: em.p
apc -O -i em.p >emerrs ; mv a.out em
nem.p: em.p
sed -e '/maxadr = t16/s//maxadr =t15/' -e '/maxdata = 8191; /s//maxdata = 14335;/' -e '/ adr=.*long/s// adr= 0..maxadr/' <em.p >nem.p
nem: nem.p
apc -O -i nem.p >emerrs ; mv a.out nem
emdmp: emdmp.c
$(CC) -I$(HOME)/h -I$(HOME)/config -o emdmp -O emdmp.c
cmp:
pr:
@pr em.p mktables.c emdmp.c

View File

@ -10,10 +10,10 @@ all: em emdmp tables
tables: mktables $(SRC_HOME)/etc/ip_spec.t tables: mktables $(SRC_HOME)/etc/ip_spec.t
mktables $(SRC_HOME)/etc/ip_spec.t tables mktables $(SRC_HOME)/etc/ip_spec.t tables
mktables: mktables.c $(TARGET_HOME)/h/em_spec.h \ mktables: $(SRC_DIR)/mktables.c $(TARGET_HOME)/h/em_spec.h \
$(TARGET_HOME)/h/em_flag.h \ $(TARGET_HOME)/h/em_flag.h \
$(TARGET_HOME)/lib.bin/em_data.$(LIBSUF) $(TARGET_HOME)/h/ip_spec.h $(TARGET_HOME)/lib.bin/em_data.$(LIBSUF) $(TARGET_HOME)/h/ip_spec.h
$(CC) -I$(TARGET_HOME)/h -O -o mktables mktables.c $(TARGET_HOME)/lib.bin/em_data.$(LIBSUF) $(CC) -I$(TARGET_HOME)/h -O -o mktables $(SRC_DIR)/mktables.c $(TARGET_HOME)/lib.bin/em_data.$(LIBSUF)
em: $(SRC_DIR)/em.p em: $(SRC_DIR)/em.p
apc -O $(SRC_DIR)/em.p >emerrs ; mv a.out em apc -O $(SRC_DIR)/em.p >emerrs ; mv a.out em

View File

@ -1,376 +0,0 @@
.SN 8
.VS 1 0
.BP
.S1 "ENVIRONMENT INTERACTIONS"
EM programs can interact with their environment in three ways.
Two, starting/stopping and monitor calls, are dealt with in this chapter.
The remaining way to interact, interrupts, will be treated
together with traps in chapter 9.
.S2 "Program starting and stopping"
EM user programs start with a call to a procedure called
m_a_i_n.
The assembler and backends look for the definition of a procedure
with this name in their input.
The call passes three parameters to the procedure.
The parameters are similar to the parameters supplied by the
UNIX
.FS
UNIX is a Trademark of Bell Laboratories.
.FE
operating system to C programs.
These parameters are often called
.BW argc ,
.B argv
and
.BW envp .
Argc is the parameter nearest to LB and is a wordsized integer.
The other two are pointers to the first element of an array of
string pointers.
.N
The
.B argv
array contains
.B argc
strings, the first of which contains the program call name.
The other strings in the
.B argv
array are the program parameters.
.P
The
.B envp
array contains strings in the form "name=string", where 'name'
is the name of an environment variable and string its value.
The
.B envp
is terminated by a zero pointer.
.P
An EM user program stops if the program returns from the first
invocation of m_a_i_n.
The contents of the function return area are used to procure a
wordsized program return code.
EM programs also stop when traps and interrupts occur that are
not caught and when the exit monitor call is executed.
.S2 "Input/Output and other monitor calls"
EM differs from most conventional machines in that it has high level i/o
instructions.
Typical instructions are OPEN FILE and READ FROM FILE instead
of low level instructions such as setting and clearing
bits in device registers.
By providing such high level i/o primitives, the task of implementing
EM on various non EM machines is made considerably easier.
.P
I/O is initiated by the MON instruction, which expects an iocode on top
of the stack.
Often there are also parameters which are pushed on the
stack in reverse order, that is: last
parameter first.
Some i/o functions also provide results, which are returned on the stack.
In the list of monitor calls we use several types of parameters and results,
these types consist of integers and unsigneds of varying sizes, but never
smaller than the wordsize, and the two pointer types.
.N 1
The names of the types used are:
.IS 4
.PS - 10
.PT int
an integer of wordsize
.PT int2
an integer whose size is the maximum of the wordsize and 2
bytes
.PT int4
an integer whose size is the maximum of the wordsize and 4
bytes
.PT intp
an integer with the size of a pointer
.PT uns2
an unsigned integer whose size is the maximum of the wordsize and 2
.PT unsp
an unsigned integer with the size of a pointer
.PT ptr
a pointer into data space
.PE 1
.IE 0
The table below lists the i/o codes with their results and
parameters.
This list is similar to the system calls of the UNIX Version 7
operating system.
.BP
.A
To execute a monitor call, proceed as follows:
.IS 2
.N 1
.PS a 4 "" )
.PT
Stack the parameters, in reverse order, last parameter first.
.PT
Push the monitor call number (iocode) onto the stack.
.PT
Execute the MON instruction.
.PE 1
.IE
An error code is present on the top of the stack after
execution of most monitor calls.
If this error code is zero, the call performed the action
requested and the results are available on top of the stack.
Non-zero error codes indicate a failure, in this case no
results are available and the error code has been pushed twice.
This construction enables programs to test for failure with a
single instruction (~TEQ or TNE~) and still find out the cause of
the failure.
The result name 'e' is reserved for the error code.
.N 1
List of monitor calls.
.DS B
number name parameters results function
1 Exit status:int Terminate this process
2 Fork e,flag,pid:int Spawn new process
3 Read fildes:int;buf:ptr;nbytes:unsp
e:int;rbytes:unsp Read from file
4 Write fildes:int;buf:ptr;nbytes:unsp
e:int;wbytes:unsp Write on a file
5 Open string:ptr;flag:int
e,fildes:int Open file for read and/or write
6 Close fildes:int e:int Close a file
7 Wait e:int;status,pid:int2
Wait for child
8 Creat string:ptr;mode:int
e,fildes:int Create a new file
9 Link string1,string2:ptr
e:int Link to a file
10 Unlink string:ptr e:int Remove directory entry
12 Chdir string:ptr e:int Change default directory
14 Mknod string:ptr;mode,addr:int2
e:int Make a special file
15 Chmod string:ptr;mode:int2
e:int Change mode of file
16 Chown string:ptr;owner,group:int2
e:int Change owner/group of a file
18 Stat string,statbuf:ptr
e:int Get file status
19 Lseek fildes:int;off:int4;whence:int
e:int;oldoff:int4 Move read/write pointer
20 Getpid pid:int2 Get process identification
21 Mount special,string:ptr;rwflag:int
e:int Mount file system
22 Umount special:ptr e:int Unmount file system
23 Setuid userid:int2 e:int Set user ID
24 Getuid e_uid,r_uid:int2 Get user ID
25 Stime time:int4 e:int Set time and date
26 Ptrace request:int;pid:int2;addr:ptr;data:int
e,value:int Process trace
27 Alarm seconds:uns2 previous:uns2 Schedule signal
28 Fstat fildes:int;statbuf:ptr
e:int Get file status
29 Pause Stop until signal
30 Utime string,timep:ptr
e:int Set file times
33 Access string,mode:int e:int Determine file accessibility
34 Nice incr:int Set program priority
35 Ftime bufp:ptr e:int Get date and time
36 Sync Update filesystem
37 Kill pid:int2;sig:int
e:int Send signal to a process
41 Dup fildes,newfildes:int
e,fildes:int Duplicate a file descriptor
42 Pipe e,w_des,r_des:int Create a pipe
43 Times buffer:ptr Get process times
44 Profil buff:ptr;bufsiz,offset,scale:intp Execution time profile
46 Setgid gid:int2 e:int Set group ID
47 Getgid e_gid,r_gid:int Get group ID
48 Sigtrp trapno,signo:int
e,prevtrap:int See below
51 Acct file:ptr e:int Turn accounting on or off
53 Lock flag:int e:int Lock a process
54 Ioctl fildes,request:int;argp:ptr
e:int Control device
56 Mpxcall cmd:int;vec:ptr e:int Multiplexed file handling
59 Exece name,argv,envp:ptr
e:int Execute a file
60 Umask complmode:int2 oldmask:int2 Set file creation mode mask
61 Chroot string:ptr e:int Change root directory
.DE 1
Codes 0, 11, 13, 17, 31, 32, 38, 39, 40, 45, 49, 50, 52,
55, 57, 58, 62, and 63 are
not used.
.P
All monitor calls, except fork and sigtrp
are the same as the UNIX version 7 system calls.
.P
The sigtrp entry maps UNIX signals onto EM interrupts.
Normally, trapno is in the range 0 to 252.
In that case it requests that signal signo
will cause trap trapno to occur.
When given trap number -2, default signal handling is reset, and when given
trap number -3, the signal is ignored.
.P
The flag returned by fork is 1 in the child process and 0 in
the parent.
The pid returned is the process-id of the other process.
.BP
.S1 "TRAPS AND INTERRUPTS"
EM provides a means for the user program to catch all traps
generated by the program itself, the hardware, or external conditions.
This mechanism uses five instructions: LIM, SIM, SIG, TRP and RTT.
This section of the manual may be omitted on the first reading since it
presupposes knowledge of the EM instruction set.
.P
The action taken when a trap occures is determined by the value
of an internal EM trap register.
This register contains a pointer to a procedure.
Initially the pointer used is zero and all traps halt the
program with, hopefully, a useful message to the outside world.
The SIG instruction can be used to alter the trap register,
it pops a procedure pointer from the
stack into the trap register.
When a trap occurs after storing a nonzero value in the trap
register, the procedure pointed to by the trap register
is called with the trap number
as the only parameter (see below).
SIG returns the previous value of the trap register on the
stack.
Two consecutive SIGs are a no-op.
When a trap occurs, the trap register is reset to its initial
condition, to prevent recursive traps from hanging the machine up,
e.g. stack overflow in the stack overflow handling procedure.
.P
The runtime systems for some languages need to ignore some EM
traps.
EM offers a feature called the ignore mask.
It contains one bit for each of the lowest 16 trap numbers.
The bits are numbered 0 to 15, with the least significant bit
having number 0.
If a certain bit is 1 the corresponding trap never
occurs and processing simply continues.
The actions performed by the offending instruction are
described by the Pascal program in appendix A.
.N
If the bit is 0, traps are not ignored.
The instructions LIM and SIM allow copying and replacement of
the ignore mask.~
.P
The TRP instruction generates a trap, the trap number being found on the
stack.
This is, among other things,
useful for library procedures and runtime systems.
It can also be used by a low level trap procedure to pass the trap to a
higher level one (see example below).
.P
The RTT instruction returns from the trap procedure and continues after the
trap.
In the list below all traps marked with an asterisk ('*') are
considered to be fatal and it is explicitly undefined what happens if
you try to restart after the trap.
.P
The way a trap procedure is called is completely compatible
with normal calling conventions. The only way a trap procedure
differs from normal procedures is the return. It has to use RTT instead
of RET. This is necessary because the complete runtime status is saved on the
stack before calling the procedure and all this status has to be reloaded.
Error numbers are in the range 0 to 252.
The trap numbers are divided into three categories:
.IS 4
.N 1
.PS - 10
.PT ~~0-~63
EM machine errors, e.g. illegal instruction.
.PS - 8
.PT ~0-15
maskable
.PT 16-63
not maskable
.PE
.PT ~64-127
Reserved for use by compilers, run time systems, etc.
.PT 128-252
Available for user programs.
.PE 1
.IE
EM machine errors are numbered as follows:
.DS I 5
.TS
tab(@);
n l l.
0@EARRAY@Array bound error
1@ERANGE@Range bound error
2@ESET@Set bound error
3@EIOVFL@Integer overflow
4@EFOVFL@Floating overflow
5@EFUNFL@Floating underflow
6@EIDIVZ@Divide by 0
7@EFDIVZ@Divide by 0.0
8@EIUND@Undefined integer
9@EFUND@Undefined float
10@ECONV@Conversion error
16*@ESTACK@Stack overflow
17*@EHEAP@Heap overflow
18*@EILLINS@Illegal instruction
19*@EODDZ@Illegal size argument
20*@ECASE@Case error
21*@EMEMFLT@Addressing non existent memory
22*@EBADPTR@Bad pointer used
23*@EBADPC@Program counter out of range
24@EBADLAE@Bad argument of LAE
25@EBADMON@Bad monitor call
26@EBADLIN@Argument of LIN too high
27@EBADGTO@GTO descriptor error
.TE
.DE 0
.P
As an example,
suppose a subprocedure has to be written to do a numeric
calculation.
When an overflow occurs the computation has to be stopped and
the higher level procedure must be resumed.
This can be programmed as follows using the mechanism described above:
.DS B
mes 2,2,2 ; set sizes
ersave
bss 2,0,0 ; Room to save previous value of trap procedure
msave
bss 2,0,0 ; Room to save previous value of trap mask
pro calcule,0 ; entry point
lxl 0 ; fill in non-local goto descriptor with LB
ste jmpbuf+4
lor 1 ; and SP
ste jmpbuf+2
lim ; get current ignore mask
ste msave ; save it
lim
loc 16 ; bit for EFOVFL
ior 2 ; set in mask
sim ; ignore EFOVFL from now on
lpi $catch ; load procedure identifier
sig ; catch wil get all traps now
ste ersave ; save previous trap procedure identifier
; perform calculation now, possibly generating overflow
1 ; label jumped to by catch procedure
loe ersave ; get old trap procedure
sig ; refer all following trap to old procedure
asp 2 ; remove result of sig
loe msave ; restore previous mask
sim ; done now
; load result of calculation
ret 2 ; return result
jmpbuf
con *1,0,0
end
.DE 0
.VS 1 1
.DS
Example of catch procedure
pro catch,0 ; Local procedure that must catch the overflow trap
lol 2 ; Load trap number
loc 4 ; check for overflow
bne *1 ; if other trap, call higher trap procedure
gto jmpbuf ; return to procedure calcule
1 ; other trap has occurred
loe ersave ; previous trap procedure
sig ; other procedure will get the traps now
asp 2 ; remove the result of sig
lol 2 ; stack trap number
trp ; call other trap procedure
rtt ; if other procedure returns, do the same
end
.DE

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +0,0 @@
case $# in
1) make "$1".t ; ntlp "$1".t^lpr ;;
*) echo $0 heeft een argument nodig ;;
esac

View File

@ -1,4 +0,0 @@
case $# in
1) make $1.t ; ntout $1.t ;;
*) echo $0 heeft een argument nodig ;;
esac

View File

@ -1084,7 +1084,7 @@ directory "first".
Em_path.h also specifies which directory should be used for Em_path.h also specifies which directory should be used for
temporary files. temporary files.
Most programs from the Kit do indeed use that directory Most programs from the Kit do indeed use that directory
although some remain stubborn and use /tmp or /usr/tmp. although some remain stubborn and use /tmp.
.LP .LP
The shape of the tree should not be altered lightly because The shape of the tree should not be altered lightly because
most Makefiles and the most Makefiles and the

View File

@ -1,9 +0,0 @@
# $Header$
FP = frontpage
DOC = abstract contents chap1 chap2 chap3 chap4 chap5 chap6 chap7\
chap8 chap9 appendix_A appendix_B
../lint.doc: $(FP) $(DOC)
cat $(FP) $(DOC) > ../lint.doc

View File

@ -1,18 +0,0 @@
EMHOME=../..
FILES= p0 p1 p2 p3 p4 p5 p6 p7 p8 p9
PIC=pic
EQN=eqn
TBL=tbl
TARGET=-Tlp
../occam.doc: p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 channel.h.t channel.c.t
soelim $(FILES) | $(PIC) $(TARGET) | $(TBL) | $(EQN) $(TARGET) > $@
channel.h.t: $(EMHOME)/h/ocm_chan.h
ctot <$(EMHOME)/h/ocm_chan.h >channel.h.t
channel.c.t: channel.c
ctot <channel.c >channel.c.t
channel.c: $(EMHOME)/lang/occam/lib/tail_ocm.a
arch x $(EMHOME)/lang/occam/lib/tail_ocm.a channel.c

20
doc/pascal/.distr Normal file
View File

@ -0,0 +1,20 @@
ab+intro.doc
compar.doc
conf.doc
contents.doc
deviations.doc
example.doc
extensions.doc
hints.doc
his.doc
improv.doc
internal.doc
options.doc
proto.make
reference.doc
rtl.doc
syntax.doc
test.doc
titlepg.doc
transpem.doc
vrk.doc

28
doc/pascal/proto.make Normal file
View File

@ -0,0 +1,28 @@
# $Id$
#PARAMS do not remove this line!
SRC_DIR = $(SRC_HOME)/doc/pascal
PIC = pic
SRC = \
$(SRC_DIR)/ab+intro.doc \
$(SRC_DIR)/internal.doc \
$(SRC_DIR)/transpem.doc \
$(SRC_DIR)/conf.doc \
$(SRC_DIR)/options.doc \
$(SRC_DIR)/extensions.doc \
$(SRC_DIR)/deviations.doc \
$(SRC_DIR)/hints.doc \
$(SRC_DIR)/test.doc \
$(SRC_DIR)/compar.doc \
$(SRC_DIR)/improv.doc \
$(SRC_DIR)/his.doc \
$(SRC_DIR)/reference.doc \
$(SRC_DIR)/syntax.doc \
$(SRC_DIR)/rtl.doc \
$(SRC_DIR)/example.doc
$(TARGET_HOME)/doc/pascal.doc: $(SRC)
$(PIC) $(SRC) > $@

View File

@ -6,6 +6,7 @@ TBL=tbl
EQN=eqn EQN=eqn
PIC=pic PIC=pic
REFER=refer REFER=refer
GRAP=grap
RESFILES= \ RESFILES= \
$(TARGET_HOME)/doc/toolkit.doc \ $(TARGET_HOME)/doc/toolkit.doc \
@ -18,6 +19,8 @@ RESFILES= \
$(TARGET_HOME)/doc/ncg.doc \ $(TARGET_HOME)/doc/ncg.doc \
$(TARGET_HOME)/doc/regadd.doc \ $(TARGET_HOME)/doc/regadd.doc \
$(TARGET_HOME)/doc/LLgen.doc \ $(TARGET_HOME)/doc/LLgen.doc \
$(TARGET_HOME)/doc/LLgen_NCER.doc \
$(TARGET_HOME)/doc/pascal.doc \
$(TARGET_HOME)/doc/basic.doc \ $(TARGET_HOME)/doc/basic.doc \
$(TARGET_HOME)/doc/crefman.doc \ $(TARGET_HOME)/doc/crefman.doc \
$(TARGET_HOME)/doc/ansi_C.doc \ $(TARGET_HOME)/doc/ansi_C.doc \
@ -72,7 +75,11 @@ $(TARGET_HOME)/doc/regadd.doc: $(SRC_HOME)/doc/regadd.doc
$(TARGET_HOME)/doc/LLgen.doc: LLgen.X $(TARGET_HOME)/doc/LLgen.doc: LLgen.X
LLgen.X: LLgen.X:
cd LLgen; make "EQN="$(EQN) "TBL="$(TBL) "REFER="$(REFER) cd LLgen; make "EQN="$(EQN) "TBL="$(TBL) "REFER="$(REFER) "GRAP="$(GRAP)
$(TARGET_HOME)/doc/LLgen_NCER.doc: LLgen_NCER.X
LLgen_NCER.X:
cd LLgen; make "EQN="$(EQN) "TBL="$(TBL) "REFER="$(REFER) "GRAP="$(GRAP)
$(TARGET_HOME)/doc/basic.doc: $(SRC_HOME)/doc/basic.doc $(TARGET_HOME)/doc/basic.doc: $(SRC_HOME)/doc/basic.doc
cat $(SRC_HOME)/doc/basic.doc >$@ cat $(SRC_HOME)/doc/basic.doc >$@
@ -105,6 +112,10 @@ $(TARGET_HOME)/doc/sparc.doc: sparc.X
sparc.X: sparc.X:
cd sparc; make "PIC="$(PIC) "TBL="$(TBL) cd sparc; make "PIC="$(PIC) "TBL="$(TBL)
$(TARGET_HOME)/doc/pascal.doc: pascal.X
pascal.X:
cd pascal; make "PIC="$(PIC)
$(TARGET_HOME)/doc/top.doc: top.X $(TARGET_HOME)/doc/top.doc: top.X
top.X: top.X:
cd top; make "EQN="$(EQN) "TBL="$(TBL) "REFER="$(REFER) cd top; make "EQN="$(EQN) "TBL="$(TBL) "REFER="$(REFER)

View File

@ -1,10 +0,0 @@
# $Header$
REFER=refer
TBL=tbl
TARGET=-Tlp
PIC=pic
GRAP=grap
../sparc.doc: refs title intro 1 2 3 4 5 A B init
$(REFER) -sA+T '-l\", ' -p refs title intro 1 2 3 4 5 A B | $(GRAP) | $(PIC) | $(TBL) | soelim > $@

View File

@ -1,8 +0,0 @@
# $Header$
REFER=refer
TBL=tbl
TARGET=-Tlp
../top.doc: top.n refs.top
$(REFER) -sA+T -l4,2 -p refs.top top.n | $(TBL) > $@

View File

@ -1 +0,0 @@
0

View File

@ -32,9 +32,9 @@ int high = 999;
FILE *file1; FILE *file1;
FILE *file2; FILE *file2;
FILE *file3; FILE *file3;
char name1[] = "/usr/tmp/f1XXXXXX"; char name1[] = "/tmp/f1XXXXXX";
char name2[] = "/usr/tmp/f2XXXXXX"; char name2[] = "/tmp/f2XXXXXX";
char name3[] = "/usr/tmp/f3XXXXXX"; char name3[] = "/tmp/f3XXXXXX";
char *to3dig(); char *to3dig();

View File

@ -1,28 +0,0 @@
#define WS EM_WSIZE
#define PS EM_PSIZE
#include "test.h"
mes 2,WS,PS
mes 1
mes 4,300
.000
con "tst000"
exp $m_a_i_n
pro $m_a_i_n,0
loc 123
loc -98
; TEST 000: empty
fil .000
loc -98
bne *1
loc 123
bne *1
lin 0
nop
loc 0
ret WS
1
lin 1
nop
loc 1
ret WS
end

View File

@ -1,289 +0,0 @@
non-standard feature used
identifier '%s' declared twice
end of file encountered
bad line directive
unsigned real: digit of fraction expected
unsigned real: digit of exponent expected
unsigned real: too many digits (>72)
unsigned integer: too many digits (>72)
unsigned integer: overflow (>32767)
string constant: must not exceed one line
string constant: at least one character expected
string constant: double quotes not allowed (see c option)
string constant: too long (>72 chars)
bad character
identifier '%s' not declared
location counter overflow: arrays too big
location counter overflow: arrays too big
arraysize too big
variable '%s' never used
variable '%s' never assigned
the files contained in '%s' are not closed automatically
constant expected
constant: only integers and reals may be signed
constant: out of bounds
simple type expected
enumerated type: element identifier expected
enumerated type: ',' or ')' expected
enumerated type: ',' expected
enumerated type: ')' expected
subrange type: type must be scalar, but not real
subrange type: '..' expected
subrange type: type of lower and upper bound incompatible
subrange type: lower bound exceeds upper bound
array type: '[' expected
conformant array: low bound identifier expected
conformant array: '..' expected
conformant array: high bound identifier expected
conformant array: ':' expected
conformant array: index type identifier expected
array type: index type not bounded
array type: index separator or ']' expected
array type: index separator expected
array type: ']' expected
array type: 'of' expected
record variant part: tag type identifier expected
record variant part: tag type identifier expected
record variant part: type must be bounded
record variant part: 'of' expected
record variant: type of case label and tag incompatible
record variant: multiple defined case label
record variant: ',' or ':' expected
record variant: ',' expected
record variant: ':' expected
record variant: '(' expected
record variant: ')' expected
record variant part: ';' or end of variant list expected
record variant part: ';' expected
record variant part: end of variant list expected
record variant part: there must be a variant for each tag value
field list: record section expected
record section: field identifier expected
record section: ',' or ':' expected
record section: ',' expected
record section: ':' expected
field list: ';' or end of record section list expected
field list: ';' expected
field list: end of record section list expected
type expected
type: simple and pointer type may not be packed
pointer type: type identifier expected
pointer type: type identifier expected
record type: 'end' expected
set type: 'of' expected
set type: too many elements in set
set type: bad subrange of integer
set of integer: the i option dictates the number of bits (default 16)
set type: base type not bounded
file type: 'of' expected
file type: files within files not allowed
var parameter: type identifier or conformant array expected
var parameter: type identifier expected
label declaration: unsigned integer expected
label declaration: label '%i' multiple declared
label declaration: ',' or ';' expected
label declaration: ',' expected
label declaration: ';' expected
const declaration: constant identifier expected
const declaration: '=' expected
const declaration: ';' expected
const declaration: constant identifier or 'type', 'var', 'procedure', 'function' or 'begin' expected
type declaration: type identifier expected
type declaration: '=' expected
type declaration: ';' expected
type declaration: type identifier or 'var', 'procedure', 'function' or 'begin' expected
var declaration: var identifier expected
var declaration: ',' or ':' expected
var declaration: ',' expected
var declaration: ':' expected
var declaration: ';' expected
var declaration: var identifier or 'procedure', 'function' or 'begin' expected
parameter list: 'var','procedure','function' or identifier expected
parameter list: parameter identifier expected
parameter list: ',' or ':' expected
parameter list: ',' expected
parameter list: ':' expected
parameter list: type identifier expected
parameter list: ';' or ')' expected
parameter list: ';' expected
proc/func declaration: proc/func identifier expected
proc/func declaration: previous declaration of '%s' was not forward
proc/func declaration: parameter list expected
parameterlist: ')' expected
func declaration: ':' expected
func declaration: result type identifier expected
func declaration: result type must be scalar, subrange or pointer
proc/func declaration: ';' expected
proc/func declaration: block or directive expected
proc/func declaration: '%s' unknown directive
proc/func declaration: '%s' again forward declared
proc/func declaration: ';' expected
indexed variable: '[' only allowed following array variables
indexed variable: index type not compatible with declaration
indexed variable: ',' or ']' expected
indexed variable: ',' expected
assignment: standard function not allowed as destination
assignment: cannot store the function result
assignment: formal parameter function not allowed as destination
assignment: function identifier may not be de-referenced
variable: '[', '.', '^' or end of variable expected
indexed variable: ']' expected
field designator: field identifier expected
field designator: '.' only allowed following record variables
field designator: no field '%s' in this record
referenced variable: '^' not allowed following zero-terminated strings
referenced variable: '^' only allowed following pointer or file variables
variable: var or field identifier expected
call: too many actual parameters supplied
call: proc/func identifier expected
call: standard proc/func may not be used as parameter
call: parameter lists of actual and formal proc/func incompatible
call: type of actual and formal value parameter not compatible
call: array parameter not conformable
call: type of actual and formal variable parameter not similar
call: packed elements not allowed as variable parameter
call: ',' or ')' expected
call: too few actual parameters supplied
read(ln): type must be integer, char or real
write(ln): type must be integer, char, real, string or boolean
write(ln): ':', ',' or ')' expected
write(ln): field width must be integer
write(ln): ':', ',' or ')' expected
write(ln): precision must be integer
write(ln): precision may only be specified for reals
read/write: too few actual parameters supplied
read/write: standard input/output not mentioned in program heading
read/write: ',' or ')' expected
read/write: type of parameter not the same as that of the file elements
read/write: parameter list expected
readln/writeln: standard input/output not mentioned in program heading
readln/writeln: only allowed on text files
new/dispose: C-type strings not allowed here
new/dispose: ',' or ')' expected
new/dispose: too many actual parameters supplied
new/dispose: type of tagfield value is incompatible with declaration
call: '(' or end of call expected
standard proc/func: parameter list expected
standard input/output not mentioned in program heading
file variable expected
pointer variable expected
pack: ',' expected
pack: ',' expected
unpack: ',' expected
unpack: ',' expected
standard proc/func: parameter type incompatible with specification
eoln/page: text file variable expected
pack/unpack: array types are incompatible
pack/unpack: only for arrays
abs: integer or real expected
sqr: integer or real expected
ord: type must be scalar or subrange, but not real
pred/succ: type must be scalar or subrange, but not real
trunc/round: real argument required
call: ')' expected
expression: left and right operand are incompatible
set: incompatible elements
set: base type must be bounded or of type integer
set: base type upper bound exceeds maximum set element number
set: element out of range
set: ']' or element list expected
set: '..', ',' or ']' expected
set: ',' or ']' expected
set: ',' expected
factor expected
factor: ')' expected
factor: type of factor must be boolean
set: ']' expected
term: multiplying operator or end of term expected
term: '*' only defined for integers, reals and sets
term: '/' only defined for integers and reals
term: 'div' only defined for integers
term: 'mod' only defined for integers
term: 'and' only defined for booleans
simple expression: only integers and reals may be signed
simple expression: adding operator or end of simple expression expected
simple expression: '+' only defined for integers, reals and sets
simple expression: '-' only defined for integers, reals and sets
simple expression: 'or' only defined for booleans
expression: relational operator or end of expression expected
expression: set expected
expression: left operand of 'in' not compatible with base type of right operand
expression: only '=' and '<>' allowed on pointers
expression: '<' and '>' not allowed on sets
expression: comparison of arrays only allowed for strings
expression: comparison of records not allowed
expression: comparison of files not allowed
assignment: ':=' expected
assignment: left and right hand side incompatible
goto statement: unsigned integer expected
goto statement: label '%i' not declared
if statement: type of expression must be boolean
if statement: 'then' expected
if statement: 'else' or end of if statement expected
case statement: type must be scalar or subrange, but not real
case statement: 'of' expected
case statement: incompatible case label
case statement: multiple defined case label
case statement: ',' or ':' expected
case statement: ',' expected
case statement: ':' expected
case statement: ';' or 'end' expected
case statement: ';' expected
case statement: 'end' expected
repeat statement: ';' or 'until' expected
repeat statement: ';' expected
repeat statement: 'until' expected
repeat statement: type of expression must be boolean
while statement: type of expression must be boolean
while statement: 'do' expected
for statement: type of bound and control variable incompatible
for statement: control variable expected
for statement: control variable must be local
for statement: type must be scalar or subrange, but not real
for statement: ':=' expected
for statement: 'to' or 'downto' expected
for statement: upper bound not assignment compatible
for statement: 'do' expected
with statement: record variable expected
with statement: ',' or 'do' expected
with statement: ',' expected
with statement: 'do' expected
assertion: type of expression must be boolean
statement expected
label '%i' not declared
label '%i' multiple defined
statement: ':' expected
unlabeled statement expected
compound statement: ';' or 'end' expected
compound statement: ';' expected
compound statement: 'end' expected
case statement: 'end' expected
body: ';' or 'end' expected
body: ';' expected
body: label '%i' declared, but never defined
program parameter '%s' not declared
function '%s' never assigned
block: declaration or body expected
block: 'const', 'type', 'var', 'procedure', 'function' or 'begin' expected
block: 'type', 'var', 'procedure', 'function' or 'begin' expected
block: 'var', 'procedure', 'function' or 'begin' expected
block: 'procedure', 'function' or 'begin' expected
block: unsatisfied forward proc/func declaration(s)
block: 'begin' expected
block: 'end' expected
program heading: 'program' expected
program heading: program identifier expected
program heading: file identifier list expected
program heading: file identifier expected
program heading: ',' or ')' expected
program heading: ',' expected
program heading: maximum number of file arguments exceeded (12)
program heading: ')' expected
program heading: ';' expected
program: '.' expected
'program' expected
module: 'const', 'type', 'var', 'procedure' or 'function' expected
module: 'type', 'var', 'procedure' or 'function' expected
module: 'var', 'procedure' or 'function' expected
module: 'procedure' or 'function' expected
garbage at end of program

View File

@ -1,107 +0,0 @@
array bound error
range bound error
set bound error
integer overflow
real overflow
real underflow
divide by 0
divide by 0.0
undefined integer
real undefined
conversion error
error 11
error 12
error 13
error 14
error 15
stack overflow
heap error
illegal instruction
odd or zero byte count
case error
memory fault
bad pointer
bad program counter
bad external address
bad monitor call
bad line number
error 27
error 28
error 29
error 30
error 31
error 32
error 33
error 34
error 35
error 36
error 37
error 38
error 39
error 40
error 41
error 42
error 43
error 44
error 45
error 46
error 47
error 48
error 49
error 50
error 51
error 52
error 53
error 54
error 55
error 56
error 57
error 58
error 59
error 60
error 61
error 62
error 63
more args expected
error in exp
error in ln
error in sqrt
assertion failed
array bound error in pack
array bound error in unpack
only positive j in 'i mod j'
file not yet open
dispose error
error 74
error 75
error 76
error 77
error 78
error 79
error 80
error 81
error 82
error 83
error 84
error 85
error 86
error 87
error 88
error 89
error 90
error 91
error 92
error 93
error 94
error 95
not writable
not readable
end of file
truncated
reset error
rewrite error
close error
read error
write error
digit expected
non-ASCII char read

10
examples/.distr Normal file
View File

@ -0,0 +1,10 @@
hilo.b
hilo.c
hilo.mod
hilo.ocm
hilo.p
mandelbrot.c
paranoia.c
startrek.c
startrek.doc
README

33
examples/README Normal file
View File

@ -0,0 +1,33 @@
# $Source$
# $State$
# $Revision$
A few notes on the examples
---------------------------
This directory contains a handful of working example programs that can be
built with the ACK. They're intended as a convenient source of test code
and as a starting point when writing your own programs.
They consist of:
hilo.c ANSI C version of the Hi/Lo game
hilo.b Basic version of the Hi/Lo game
hilo.mod Modula-2 version of the Hi/Lo game
hilo.ocm Occam 1 version of the Hi/Lo game
hilo.p Pascal version of the Hi/Lo game
mandelbrot.c A simple Mandelbrot generator, using floating-point maths
paranoia.c An ancient public domain K&R C adventure game
startrek.c An even more ancient public domain ANSI C game
(uses the FPU for distance calculation)
startrek.doc Manual for above (plus in current directory when running)
Enjoy.
(startrek.c was written by David Ahl and converted to C by Chris Nystrom. See
http://www.cactus.org/%7Enystrom/startrek.html for more info.)
David Given
dg@cowlark.com
2007-02-25

39
examples/hilo.b Normal file
View File

@ -0,0 +1,39 @@
1 ' $Source$
2 ' $State$
3 ' $Revision$
10 print "Hi there! I'm written in Basic. Before we start, what is your name?"
20 input "> ", PlayerName$
30 print
40 print "Hello, "; PlayerName$; "!"
100 gosub 1000
110 print
120 print "Would you like another go?"
130 input "> ", s$
140 s$ = left$(s$, 1)
150 if s$ = "n" or s$ = "N" then goto 200
160 print
170 print "Excellent! ";
180 goto 100
200 print
210 print "Thanks for playing --- goodbye!"
220 end
1000 print "See if you can guess my number."
1010 Number% = rnd(1) mod 100
1020 Attempts% = 1
1030 print
1040 input "> ", guess%
1050 if guess% < Number% then print: print "Try a bit higher."
1060 if guess% > Number% then print: print "Try a bit lower."
1070 if guess% = Number% then goto 1100
1080 Attempts% = Attempts% + 1
1090 goto 1030
1100 print
1110 print "You got it right in only"; Attempts%;
1120 if Attempts% = 1 then print "go"; else print "goes";
1130 print "!"
1140 return

83
examples/hilo.c Normal file
View File

@ -0,0 +1,83 @@
/* $Source$
* $State$
* $Revision$
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char buffer[32];
char PlayerName[32];
int Number;
int Attempts;
void reads(void)
{
char* p;
printf("> ");
fflush(stdout);
fgets(buffer, sizeof(buffer), stdin);
p = strchr(buffer, '\n');
if (p != NULL)
*p = '\0';
}
void game(void)
{
printf("See if you can guess my number.\n");
Number = rand() % 100;
Attempts = 1;
for (;;)
{
int guess;
printf("\n");
reads();
guess = atoi(buffer);
if (guess == Number)
{
printf("\nYou got it right in only %d %s!\n", Attempts,
(Attempts == 1) ? "go" : "goes");
return;
}
if (guess < Number)
printf("\nTry a bit higher.\n");
if (guess > Number)
printf("\nTry a bit lower.\n");
Attempts++;
}
}
int main(int argc, char* argv[])
{
printf("\nHi there! I'm written in C. Before we start, what is your name?\n");
reads();
strcpy(PlayerName, buffer);
printf("\nHello, %s! ", PlayerName);
for (;;)
{
game();
printf("\nWould you like another go?\n");
reads();
if ((buffer[0] == 'n') || (buffer[0] == 'N'))
{
printf("\nThanks for playing --- goodbye!\n");
exit(0);
}
printf("\nExcellent! ");
}
return 0;
}

104
examples/hilo.mod Normal file
View File

@ -0,0 +1,104 @@
(* $Source$
* $State$
* $Revision$
*)
MODULE HiLo;
FROM InOut IMPORT WriteInt, WriteLn, WriteString, ReadString, ReadInt;
FROM random IMPORT Uniform;
FROM Streams IMPORT FlushStream, OutputStream, StreamResult;
VAR
buffer : ARRAY [0..32] OF CHAR;
PROCEDURE flush;
VAR
strus : StreamResult;
BEGIN
FlushStream(OutputStream, strus);
END flush;
PROCEDURE reads;
BEGIN
WriteString("> ");
flush;
ReadString(buffer);
END reads;
PROCEDURE game;
VAR
Number : INTEGER;
Attempts : INTEGER;
guess : INTEGER;
finished : BOOLEAN;
BEGIN
WriteString("See if you can guess my number.");
WriteLn;
Number := Uniform(0, 99);
Attempts := 1;
finished := FALSE;
WHILE NOT finished DO
WriteString("> ");
flush;
ReadInt(guess);
IF guess = Number THEN
WriteLn;
WriteString("You got it right in only ");
WriteInt(Attempts, 0);
WriteString(" ");
IF Attempts = 1 THEN
WriteString("go");
ELSE
WriteString("goes");
END;
WriteString("!");
WriteLn;
finished := TRUE;
ELSIF guess < Number THEN
WriteLn;
WriteString("Try a bit higher.");
WriteLn;
ELSIF guess > Number THEN
WriteLn;
WriteString("Try a bit lower.");
WriteLn;
END;
Attempts := Attempts + 1;
END;
END game;
VAR
finished : BOOLEAN;
BEGIN
WriteLn;
WriteString("Hi there! I'm written in Modula-2. Before we start, what is your name?");
WriteLn;
reads;
WriteLn;
WriteString("Hello, ");
WriteString(buffer);
WriteString("! ");
finished := FALSE;
WHILE NOT finished DO
game;
WriteLn;
WriteString("Would you like another go?");
WriteLn;
reads;
IF (buffer[0] = 'n') OR (buffer[0] = 'N') THEN
finished := TRUE;
WriteLn;
WriteString("Thanks for playing --- goodbye!");
WriteLn;
ELSE
WriteLn;
WriteString("Excellent! ");
END;
END;
END HiLo.

131
examples/hilo.ocm Normal file
View File

@ -0,0 +1,131 @@
#
-- $Source$
-- $State$
-- $Revision$
#include "dec.ocm"
-- General utilities: read and write strings.
proc puts(value s[]) =
seq i = [1 for s[byte 0]]
output ! s[byte i]
:
proc gets(var s[]) =
var length, finished, c:
seq
finished := false
length := 0
while not finished
seq
input ? c
if
c = 10
finished := true
true
seq
length := length + 1
s[byte length] := c
s[byte 0] := length
:
-- Our random number generator.
var seed:
proc randomise(value s) =
seq
seed := s
:
proc random(value range, var result) =
seq
seed := (20077 * seed) + 12345
if
seed < 0
seed := -seed
true
skip
result := seed \ range
:
-- Does the reading-in-the-name thing.
proc getname =
var seed, buffer[128]:
seq
puts("*nHi there! I'm written in Occam. Before we start, what is your name?*n")
puts("> ")
gets(buffer)
seed := 0
seq i = [1 for buffer[byte 0]]
seed := seed + buffer[byte i]
randomise(seed)
puts("*nHello, ")
puts(buffer)
puts("! ")
:
-- Plays a single game.
proc game =
var Number, Attempts, finished, guess:
seq
puts("See if you can guess my number.*n")
random(100, Number)
Attempts := 1
finished := false
while not finished
seq
puts("*n> ")
var c:
seq
c := '*s'
decin(input, guess, c)
if
guess = Number
seq
puts("*nYou got it right in only ")
decout(output, Attempts, 0)
puts(" ")
if
Attempts = 1
puts("go")
true
puts("goes")
puts("!*n")
finished := true
guess < Number
puts("*nTry a bit higher.*n")
guess > Number
puts("*nTry a bit lower.*n")
Attempts := Attempts + 1
:
var finished, buffer[128]:
seq
output ! TEXT
getname
finished := false
while not finished
seq
game
puts("*nWould you like another go?*n")
puts("> ")
gets(buffer)
if
(buffer[byte 1] = 'n') or (buffer[byte 1] = 'N')
seq
finished := true
puts("*nThanks for playing --- goodbye!*n")
true
puts("*nExcellent! ")

169
examples/hilo.p Normal file
View File

@ -0,0 +1,169 @@
(* $Source$
* $State$
* $Revision$
*)
(*$U+ --- enables underscores in identifiers *)
program hilo(input, output);
type
string = array [0..255] of char;
var
playing : Boolean;
seed : integer;
{ This version of Pascal seems to have no random number generator I can find,
so we have to implement our own here. This is a hacked up and probably
broken version of the C library generator. }
procedure randomise(s : integer);
begin
seed := s;
end;
function random(range : integer) : integer;
begin
seed := (20077 * seed + 12345);
random := seed mod range;
end;
{ Pascal doesn't provide string input, so we interface to the read() syscall
and do it manually. But... we can't interface to read() directly because
that conflicts with a Pascal keyword. Luckily there's a private function
uread() in the ACK Pascal library that we can use instead. }
function uread(fd : integer; var buffer : char; count : integer) : integer;
extern;
function readchar : char;
var
c : char;
dummy : integer;
begin
c := chr(0);
dummy := uread(0, c, 1);
readchar := c;
end;
procedure readstring(var buffer : string; var length : integer);
var
finished : Boolean;
c : char;
begin
write('> ');
length := 0;
finished := FALSE;
seed := 0;
while not finished do
begin
c := readchar;
if (ord(c) = 10) then
finished := true
else
begin
buffer[length] := c;
length := length + 1;
end
end;
end;
procedure getname;
var
name : string;
namelen : integer;
i : integer;
seed : integer;
begin
writeln;
writeln('Hi there! I''m written in Pascal. Before we start, what is your name?');
writeln;
readstring(name, namelen);
writeln;
write('Hello, ');
seed := 0;
for i := 0 to (namelen-1) do
begin
write(name[i]);
seed := seed + ord(name[i]);
end;
randomise(seed);
write('! ');
end;
procedure game;
var
Number : integer;
Attempts : integer;
guess : integer;
begin
writeln('See if you can guess my number.');
Number := random(100);
Attempts := 0;
guess := -1;
while guess <> Number do
begin
Attempts := Attempts + 1;
write('> ');
readln(guess);
if guess < Number then
begin
writeln;
writeln('Try a bit higher.');
end;
if guess > Number then
begin
writeln;
writeln('Try a bit lower.');
end;
end;
writeln;
write('You got it right in only ', Attempts:0, ' ');
if Attempts = 1 then
write('go')
else
write('goes');
writeln('!');
end;
function question: Boolean;
var
response: char;
begin
write('> ');
readln(response);
question := not ((response = 'n') or (response = 'N'));
end;
begin
getname;
playing := TRUE;
while playing do
begin
game;
writeln;
writeln('Would you like another go?');
playing := question;
writeln;
if playing then
write('Excellent! ')
else
writeln('Thanks for playing --- goodbye!');
end;
end.

73
examples/mandelbrot.c Normal file
View File

@ -0,0 +1,73 @@
/* $Source$
* $State$
* $Revision$
*/
/* Adapted from code by Chris Losinger. (This is the non-obfuscated
* version...
*
* http://www.codeproject.com/cpp/mandelbrot_obfuscation.asp
*/
#include <stdlib.h>
#include <unistd.h>
enum
{
ROWS = 40,
COLUMNS = 60,
MAX_ITERATIONS = 255
};
void nl(void)
{
write(1, "\n", 1);
}
void out(int n)
{
const char* chars = "****++++++---- ";
write(1, chars + (n/16), 1);
}
int main(int argc, const char* argv[])
{
/* Size and position of the visible area. */
double view_r = -2.3, view_i = -1.0;
double zoom = 0.05;
int x, y, n;
for (y=0; y < ROWS; y++)
{
double c_i = view_i + y * zoom;
for (x=0; x < COLUMNS; x++)
{
double c_r = view_r + x*zoom;
double z_r = c_r;
double z_i = c_i;
for (n=0; n < MAX_ITERATIONS; n++)
{
double z_r2 = z_r * z_r;
double z_i2 = z_i * z_i;
/* Have we escaped? */
if (z_r2 + z_i2 > 4)
break;
/* z = z^2 + c */
z_i = 2 * z_r * z_i + c_i;
z_r = z_r2 - z_i2 + c_r;
}
out(n);
}
nl();
}
return 0;
}

1047
examples/paranoia.c Normal file

File diff suppressed because it is too large Load Diff

1962
examples/startrek.c Normal file

File diff suppressed because it is too large Load Diff

105
examples/startrek.doc Normal file
View File

@ -0,0 +1,105 @@
1. When you see _Command?_ printed, enter one of the legal commands
(nav, srs, lrs, pha, tor, she, dam, com, or xxx).
2. If you should type in an illegal command, you'll get a short list of
the legal commands printed out.
3. Some commands require you to enter data (for example, the 'nav' command
comes back with 'Course(1-9) ?'.) If you type in illegal data (like
negative numbers), that command will be aborted.
The galaxy is divided into an 8 X 8 quadrant grid, and each quadrant
is further divided into an 8 x 8 sector grid.
You will be assigned a starting point somewhere in the galaxy to begin
a tour of duty as commander of the starship _Enterprise_; your mission:
to seek out and destroy the fleet of Klingon warships which are menacing
the United Federation of Planets.
You have the following commands available to you as Captain of the Starship
Enterprise:
\nav\ Command = Warp Engine Control --
Course is in a circular numerical vector 4 3 2
arrangement as shown. Integer and real . . .
values may be used. (Thus course 1.5 is ...
half-way between 1 and 2. 5 ---*--- 1
...
Values may approach 9.0, which itself is . . .
equivalent to 1.0. 6 7 8
One warp factor is the size of one quadrant. COURSE
Therefore, to get from quadrant 6,5 to 5,5
you would use course 3, warp factor 1.
\srs\ Command = Short Range Sensor Scan
Shows you a scan of your present quadrant.
Symbology on your sensor screen is as follows:
<*> = Your starship's position
+K+ = Klingon battlecruiser
>!< = Federation starbase (Refuel/Repair/Re-Arm here)
* = Star
A condensed 'Status Report' will also be presented.
\lrs\ Command = Long Range Sensor Scan
Shows conditions in space for one quadrant on each side of the Enterprise
(which is in the middle of the scan). The scan is coded in the form \###\
where the units digit is the number of stars, the tens digit is the number
of starbases, and the hundreds digit is the number of Klingons.
Example - 207 = 2 Klingons, No Starbases, & 7 stars.
\pha\ Command = Phaser Control.
Allows you to destroy the Klingon Battle Cruisers by zapping them with
suitably large units of energy to deplete their shield power. (Remember,
Klingons have phasers, too!)
\tor\ Command = Photon Torpedo Control
Torpedo course is the same as used in warp engine control. If you hit
the Klingon vessel, he is destroyed and cannot fire back at you. If you
miss, you are subject to the phaser fire of all other Klingons in the
quadrant.
The Library-Computer (\com\ command) has an option to compute torpedo
trajectory for you (option 2).
\she\ Command = Shield Control
Defines the number of energy units to be assigned to the shields. Energy
is taken from total ship's energy. Note that the status display total
energy includes shield energy.
\dam\ Command = Damage Control report
Gives the state of repair of all devices. Where a negative 'State of Repair'
shows that the device is temporarily damaged.
\com\ Command = Library-Computer
The Library-Computer contains six options:
Option 0 = Cumulative Galactic Record
This option shows computer memory of the results of all previous
short and long range sensor scans.
Option 1 = Status Report
This option shows the number of Klingons, stardates, and starbases
remaining in the game.
Option 2 = Photon Torpedo Data
Which gives directions and distance from Enterprise to all Klingons
in your quadrant.
Option 3 = Starbase Nav Data
This option gives direction and distance to any starbase in your
quadrant.
Option 4 = Direction/Distance Calculator
This option allows you to enter coordinates for direction/distance
calculations.
Option 5 = Galactic /Region Name/ Map
This option prints the names of the sixteen major galactic regions
referred to in the game.

View File

@ -31,9 +31,13 @@ Something wrong here! Only one of FM2, FPC, or FCC must be defined
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#include <varargs.h>
#include <stdio.h> #include <stdio.h>
#include <em_path.h> #include <em_path.h>
#if __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
/* /*
Version producing ACK .o files in one pass. Version producing ACK .o files in one pass.
@ -178,7 +182,11 @@ int v_flag = 0;
int O_flag = 0; int O_flag = 0;
int ansi_c = 0; int ansi_c = 0;
#if __STDC__
char *mkstr(char *, ...);
#else
char *mkstr(); char *mkstr();
#endif
char *malloc(); char *malloc();
char *alloc(); char *alloc();
char *extension(); char *extension();
@ -669,7 +677,32 @@ concat(al1, al2)
*p++ = *q++; *p++ = *q++;
} }
} }
#if __STDC__
/*VARARGS*/
char *
mkstr(char *dst, ...)
{
va_list ap;
va_start(ap, dst);
{
register char *p;
register char *q;
q = dst;
p = va_arg(ap, char *);
while (p) {
while (*q++ = *p++);
q--;
p = va_arg(ap, char *);
}
}
va_end(ap);
return dst;
}
#else
/*VARARGS*/ /*VARARGS*/
char * char *
mkstr(va_alist) mkstr(va_alist)
@ -696,7 +729,7 @@ mkstr(va_alist)
return dst; return dst;
} }
#endif
basename(str, dst) basename(str, dst)
char *str; char *str;
register char *dst; register char *dst;

View File

@ -1,6 +0,0 @@
man
INSTALL
INSTALL_A
READ_ME.n
driver.c
str_change.c

View File

@ -1,182 +0,0 @@
#!/bin/sh
# installation of fast ACK compilers fcc, fm2, and fpc
# is the call correct?
case $# in
1)
if [ -d $1 ]
then
:
else
echo $0: $1 is not a directory >&2
exit 1
fi
;;
*)
echo $0: Call is $0 \<bin directory\> >&2
exit 1
;;
esac
# investigate machine: either vax or sun(3)
echo $0: determining type of machine ...
cat > t.c <<'EOF'
main() {
#ifdef sun
printf("sun\n");
#endif
#ifdef vax
printf("vax\n");
#endif
}
EOF
if cc t.c
then
:
else
$0: compilation failed >&2
exit 1
fi
m=`./a.out`
rm -f a.out t.[co]
case $m in
sun|vax)
echo $0: Starting installation for a $m ...
;;
*)
echo $0: machine must be sun or vax >&2
exit 1
;;
esac
# make links to proper bin and lib directories
echo $0: creating bin and lib directories ...
rm -f bin lib
ln -s bin.$m bin
ln -s lib.$m lib
# edit manual page
sed s@CHANGE_ME@`pwd`/def@ < man/fm2.1.src > man/fm2.1
# now compile the driver program
echo $0: compiling driver program ...
rm -f fcc fm2 fpc
SunOs4=
if [ -f /usr/lib/ld.so ]
then
# different options for the loader on SunOs 4.0
SunOs4=-DSunOs4
fi
if cc -O -DFASTDIR=\"`pwd`\" $SunOs4 -DFCC -o fcc driver.c &&
cc -O -DFASTDIR=\"`pwd`\" $SunOs4 -DFM2 -o fm2 driver.c &&
cc -O -DFASTDIR=\"`pwd`\" $SunOs4 -DFPC -o fpc driver.c
then
:
else
echo $0: compilation of driver program failed >&2
exit 1
fi
if cc -o str_change str_change.c
then
case $m in
vax)
./str_change CHANGE_ME `pwd` < bin.vax/m2mm > fm2mm
;;
sun)
./str_change CHANGE_ME `pwd` < bin.sun/m2mm > fm2mm
;;
esac
rm -f str_change.o str_change
chmod +x fm2mm
else
echo "$0: compilation of string patching program failed; cannot create fm2mm" >&2
fi
#now run simple tests
echo $0: run some simple tests
failed=false
cat > test.mod <<'EOF'
MODULE test;
FROM InOut IMPORT WriteString, WriteLn;
BEGIN
WriteString("Hello World");
WriteLn
END test.
EOF
if ./fm2 test.mod 2>/dev/null
then
case `a.out` in
"Hello World")
;;
*)
echo $0: fm2 test failed >&2
failed=true
;;
esac
else
echo $0: fm2 compilation failed >&2
failed=true
fi
cat > test.c <<'EOF'
main() { printf("Hello World\n"); }
EOF
if ./fcc test.c 2>/dev/null
then
case `a.out` in
"Hello World")
;;
*)
echo $0: fcc test failed >&2
failed=true
;;
esac
else
echo $0: fcc compilation failed >&2
failed=true
fi
cat > test.p <<'EOF'
program p(output); begin writeln('Hello World') end.
EOF
if ./fpc test.p 2>/dev/null
then
case `a.out` in
"Hello World")
;;
*)
echo $0: fpc test failed >&2
failed=true
;;
esac
else
echo $0: fpc compilation failed >&2
failed=true
fi
rm -f test.* a.out
case $failed in
true)
echo $0: some tests failed, installation aborted >&2
exit 1
;;
false)
rm -f $1/fm2 $1/fcc $1/fpc
cp fm2 fcc fpc $1
if [ -f fm2mm ]
then
rm -f $1/fm2mm
cp fm2mm $1/fm2mm
fi
rm -f fm2 fpc fcc fm2mm
echo $0: Installation completed
exit 0
;;
esac

View File

@ -1,166 +0,0 @@
#!/bin/sh
# installation of fast ACK compilers afcc, afm2
# is the call correct?
case $# in
1)
if [ -d $1 ]
then
:
else
echo $0: $1 is not a directory >&2
exit 1
fi
;;
*)
echo $0: Call is $0 \<ACK home directory\> >&2
exit 1
;;
esac
# investigate machine: either vax or sun(3)
echo $0: determining type of machine ...
cat > t.c <<'EOF'
main() {
#ifdef sun
printf("sun\n");
#endif
#ifdef vax
printf("vax\n");
#endif
}
EOF
if cc t.c
then
:
else
echo $0: compilation failed >&2
exit 1
fi
m=`./a.out`
rm -f a.out t.[co]
case $m in
sun|vax)
echo $0: Starting installation for a $m ...
;;
*)
echo $0: machine must be sun or vax >&2
exit 1
;;
esac
# edit manual page
sed s@CHANGE_ME@$1/lib/m2@ < man/afm2.1.src > man/afm2.1
# install the compiler binaries
echo $0: copying compiler binaries ...
case $m in
sun)
cp ack.sun/cemcom* ack.sun/m2* $1/lib/m68020
;;
vax)
cp ack.vax/cemcom* ack.vax/m2* $1/lib/vax4
;;
esac
# now compile the driver program
echo $0: compiling driver program ...
rm -f afcc afm2
if cc -O -DACK_BIN -I$1/h -DFCC -o afcc driver.c &&
cc -O -DACK_BIN -I$1/h -DFM2 -o afm2 driver.c
then
:
else
echo $0: compilation of driver program failed >&2
exit 1
fi
( cd $1/lang/m2/libm2
echo 'killbss() { }' > killbss.c
../../../bin/acc -L -c -LIB killbss.c
cp LIST LIST.old
echo 'killbss.c' >> LIST
../../../bin/arch r tail_m2.a killbss.c
) > /dev/null 2>&1
case $m in
sun)
( cd $1/lib/sun3
cp tail_m2 tail_m2.orig
../../bin/aal r tail_m2 ../../lang/m2/libm2/killbss.o
)
;;
vax)
( cd $1/lib/vax4
cp tail_m2 tail_m2.orig
ar r tail_m2 ../../lang/m2/libm2/killbss.o
ranlib tail_m2
)
;;
esac > /dev/null 2>&1
#now run simple tests
echo $0: run some simple tests
failed=false
cat > test.mod <<'EOF'
MODULE test;
FROM InOut IMPORT WriteString, WriteLn;
BEGIN
WriteString("Hello World");
WriteLn
END test.
EOF
if ./afm2 test.mod 2>/dev/null
then
case `a.out` in
"Hello World")
;;
*)
echo $0: afm2 test failed >&2
failed=true
;;
esac
else
echo $0: afm2 compilation failed >&2
failed=true
fi
cat > test.c <<'EOF'
main() { printf("Hello World\n"); }
EOF
if ./afcc test.c 2>/dev/null
then
case `a.out` in
"Hello World")
;;
*)
echo $0: afcc test failed >&2
failed=true
;;
esac
else
echo $0: afcc compilation failed >&2
failed=true
fi
rm -f test.* a.out
case $failed in
true)
echo $0: some tests failed, installation aborted >&2
exit 1
;;
false)
rm -f $1/bin/afm2 $1/bin/afcc
cp afm2 afcc $1/bin
rm -f afm2 afcc
cp man/afcc.1 man/afm2.1 $1/man
echo $0: Installation completed
exit 0
;;
esac

View File

@ -1,80 +0,0 @@
.ND
.SH
Installing the fast ACK compilers
.LP
This is the first distribution of the fast ACK compilers, in
binary form, for either a DEC VAX running Berkeley Unix BSD 4.2 or BSD 4.3,
or a SUN-3 MC68020 work-station running SunOS 3.2-3.5, or SunOS 4.0.
The distribution contains a C-, a Modula-2-, and a Pascal-compiler producing object
code that is compatible with cc-produced object code. There are also
versions for C and Modula-2 producing object code that is compatible
with ACK, 4th distribution.
The distribution also contains a Modula-2 makefile generator.
.LP
The tape contains the following files and directories:
.IP "lib.vax and bin.vax"
.br
binaries and libraries for the VAX.
.IP "lib.sun and bin.sun"
.br
binaries and libraries for the SUN-3.
.IP def
directory containing definition modules of the Modula-2 run-time system.
.IP man
directory containing manual pages.
.IP doc
directory containing some documents describing the languages implemented.
.IP "ack.sun and ack.vax"
.br
binaries for ACK compatible fast compilers.
.IP "driver.c"
.br
sources of the compiler driver.
.IP "READ_ME"
.br
the file you are reading now.
.IP "INSTALL" and "INSTALL_A"
.br
shell-scripts taking care of the installation.
.LP
Installation makes the following commands available:
.IP fm2
fast Modula-2 compiler.
.IP fcc
fast C compiler.
.IP fpc
fast Pascal compiler.
.IP fm2mm
.br
makefile generator for fast Modula-2 compiler.
.LP
To install these commands, proceed as follows:
.IP 1.
Create a directory for the compilers, f.i. /usr/local/lib/fastc.
You will need about 3 megabyte to extract the tape.
.IP 2.
Go to this directory and extract the tape (which is in 1600 bpi tar-format).
.IP 3.
Execute the INSTALL shell-script with one argument: the directory in
which the fm2, fcc, fpc, and fm2mm binaries must be installed, f.i.
/usr/local/bin.
This will take care of the installation of the cc(1) compatible
versions of the fast ACK compilers.
The INSTALL script will also run some small tests.
.IP 4.
The man-subdirectory contains manual pages. When you have satisfied
yourself that fm2, fcc, and fpc work properly, install the
fm2, fm2mm, fcc, and fpc manual pages
in a public man-directory, and announce the availability of
fm2, fm2mm, fcc, and fpc.
.IP 5.
The tape also contains ACK-compatible fast ACK compilers for C and Modula-2.
If you have the 4th ACK distribution (became available in august 1988),
you can use the INSTALL_A shell-script to install these in the ACK tree.
Call INSTALL_A with the ACK home directory as argument.
This will make afm2 and afcc available in the ACK bin-directory.
.IP 6.
After the installation, some directories are no longer needed. The ack.sun
and ack.vax directories can be removed; when on a SUN, the bin.vax and
lib.vax directories can be removed; when on a VAX, the bin.sun and lib.sun
directories can be removed.

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +0,0 @@
afcc.1
afm2.1.src
fcc.1
fm2.1.src
fpc.1

View File

@ -1,157 +0,0 @@
.TH AFCC 1
.SH NAME
afcc \- fast ACK compatible C compiler
.SH SYNOPSIS
.B afcc
[
.B \-c
]
[
.B \-O
]
[
.B \-v
]
[
.B \-vn
]
[ \fB\-D\fIname\fR ]
[ \fB\-D\fIname\fB=\fIdef\fR ]
[
.BI \-I pathname
]
[
.B \-w
]
[
.B \-o
.I outfile
]
[
.B \-R
]
[
.BI \-U name
]
[
.BI -M compiler
]
.I sourcefile ...
.SH DESCRIPTION
.LP
.I Afcc
is a fast
.B C
compiler. It translates
.B C
programs
into ack(1ACK)-compatible relocatable object modules, and does so in one pass.
Then, if the \fB\-c\fP flag is not given,
.I afcc
offers the object modules to a link-editor,
to create an executable binary.
.LP
.I Afcc
accepts several types of filename arguments. Files with
names ending in
.B .c
are taken to be
.B C
source programs.
They are compiled, and the resulting object module is placed in the current
directory.
The object module is named after its source file, the suffix
.B .o
replacing
.BR .c
in the name of the object.
.LP
Other arguments refer to loader options,
object modules, or object libraries.
Unless the
.B \-c
flag is given, these modules and libraries, together with the results of any
specified compilations, are passed (in the order given) to the
link-editor to produce
an output file named
.IR a.out .
You can specify a name for the executable by using the
.B \-o
option.
.SH OPTIONS
.LP
The \fB\-l\fIlib\fR, \fB\-d\fP, \fB\-n\fP, \fB\-N\fP,
\fB\-r\fP, \fB\-s\fP, \fB\-S\fP, \fB\-i\fP, and \fB\-u\fP options are
passed to the link-editor program.
The \fB\-u\fP option takes an extra argument.
.IP \fB\-c\fP
.br
Suppress the loading phase of the compilation, and force an object module to
be produced, even if only one program is compiled.
A single object module can be named explicitly using the
.B \-o
option.
.IP \fB\-D\fIname\fR\fB=\fIdef\fR
Define a symbol
.I name
to the
preprocessor, as if by "#define".
.IP \fB\-D\fIname\fR
.br
same as \fB\-D\fIname\fB=1\fR.
.IP \fB\-I\fIpathname\fR
.br
Add
.I pathname
to the list of directories in which to search for
.B #include
files with filenames not beginning with slash.
The compiler first searches for
.B #include
files in the directory containing
.I sourcefile,
then in directories in
.B \-I
options, then in the ACK include directory,
and finally, in
.I /usr/include.
.IP "\fB\-o \fIoutput\fR"
Name the final output file
.I output.
.IP \fB\-O\fP
.br
Use a version of the compiler that is just a bit slower, but produces
better code.
.IP \fB\-U\fIname\fR
.br
Remove any initial definition of
.I name.
.IP \fB\-v\fP
.br
Verbose. Print the commands as they are executed.
.IP \fB\-vn\fP
.br
Verbose, no execute. Only print the commands, do not execute them.
.IP \fB\-w\fP
suppress warning messages.
.IP \fB\-R\fP
.br
test for more compatibility with Kernighan & Ritchie C [1].
.IP \fB\-M\fIcompiler\fR
.br
use \fIcompiler\fR as C-2 compiler instead of the default.
.LP
Object modules produced by ack(1ACK) and
.I afcc
can be freely mixed.
.SH "SEE ALSO"
.IP [1]
B.W. Kernighan, D. Ritchie, "\fIThe C programming Language\fP", Prentice-Hall Inc., 1978
.IP [2]
E.H. Baalbergen, "\fIThe ACK CEM compiler\fP".
.IP [3]
ack(1ACK) manual page.
.SH DIAGNOSTICS
Diagnostics are intended to be self-explanatory.
.SH REMARKS
You need the 4th ACK distribution to be able to use this program.

View File

@ -1,214 +0,0 @@
.TH FM2 1
.SH NAME
afm2 \- fast ACK compatible Modula-2 compiler
.SH SYNOPSIS
.B afm2
[
.B \-c
]
[
.B \-O
]
[
.B \-v
]
[
.B \-vn
]
[ \fB\-D\fIname\fR ]
[ \fB\-D\fIname\fB=\fIdef\fR ]
[
.BI \-I pathname
]
[
.BI \-w classes
]
[
.BI \-W classes
]
[
.B \-L
]
[
.B \-o
.I outfile
]
[
.B \-R
]
[
.B \-A
]
[
.B \-3
]
[
.B \-_
]
[
.BI \-U name
]
[
.BI -M compiler
]
.I sourcefile ...
.SH DESCRIPTION
.LP
.I afm2
is a fast
.B Modula-2
compiler. It translates
.B Modula-2
programs
into ack(1ACK)-compatible relocatable object modules, and does so in one pass.
Then, if the \fB\-c\fP flag is not given,
.I afm2
offers the object modules to a link-editor,
to create an executable binary.
.LP
.I Afm2
accepts several types of filename arguments. Files with
names ending in
.B .mod
are taken to be
.B Modula-2
source programs.
They are compiled, and the resulting object module is placed in the current
directory.
The object module is named after its source file, the suffix
.B .o
replacing
.BR .mod
in the name of the object.
A file with suffix
.B .mod
is passed through the C preprocessor if it begins with a '#'.
.PP
Definition modules are not separately compiled. The compiler reads them when
it needs them.
Definition modules are expected to reside in files with names ending
in
.BR .def .
The name of the file in which a definition module is stored must be the same as
the module-name, apart from the extension.
Also, in most Unix systems filenames are only 14 characters long.
So, given an IMPORT declaration for a module called "LongModulName",
the compiler will try to open a file called "LongModulN.def".
The requirement does not hold for implementation or program modules,
but is certainly recommended.
.LP
Other arguments refer to loader options,
object modules, or object libraries.
Unless the
.B \-c
flag is given, these modules and libraries, together with the results of any
specified compilations, are passed (in the order given) to the
link-editor to produce
an output file named
.IR a.out .
You can specify a name for the executable by using the
.B \-o
option.
.SH OPTIONS
.LP
The \fB\-l\fIlib\fR, \fB\-d\fP, \fB\-n\fP, \fB\-N\fP,
\fB\-r\fP, \fB\-s\fP, \fB\-S\fP, \fB\-i\fP, and \fB\-u\fP options are
passed to the link-editor program.
The \fB\-u\fP option takes an extra argument.
.IP \fB\-c\fP
.br
Suppress the loading phase of the compilation, and force an object module to
be produced, even if only one program is compiled.
A single object module can be named explicitly using the
.B \-o
option.
.IP \fB\-D\fIname\fR\fB=\fIdef\fR
Define a symbol
.I name
to the
preprocessor, as if by "#define".
.IP \fB\-D\fIname\fR
.br
same as \fB\-D\fIname\fB=1\fR.
.IP \fB\-I\fIpathname\fR
.br
Add
.I pathname
to the list of directories in which to search for
.B #include
files with filenames not beginning with slash.
The preprocessor first searches for
.B #include
files in the directory containing
.I sourcefile,
then in directories in
.B \-I
options, then in the ACK include directory,
and finally, in
.I /usr/include.
This flag is also passed to the compiler. When the compiler needs a definition
module, it is first searched for in the current directory, then in the
directories given to it by the \fB\-I\fP flag, and then in a default directory,
.I CHANGE_ME.
.I afm2
This default directory contains all definition modules of
the runtime system.
.IP "\fB\-o \fIoutput\fR"
Name the final output file
.I output.
.IP \fB\-O\fP
.br
Use a version of the compiler that is just a bit slower, but produces
better code.
.IP \fB\-U\fIname\fR
.br
Remove any initial definition of
.I name.
.IP \fB\-v\fP
.br
Verbose. Print the commands as they are executed.
.IP \fB\-vn\fP
.br
Verbose, no execute. Only print the commands, do not execute them.
.IP \fB\-L\fR
do not generate code to keep track of
the current location in the source code.
.IP \fB\-w\fR\fIclasses\fR
suppress warning messages whose class is a member of \fIclasses\fR.
Currently, there are three classes: \fBO\fR, indicating old-flashioned use,
\fBW\fR, indicating "ordinary" warnings, and \fBR\fR, indicating
restricted Modula-2.
If no \fIclasses\fR are given, all warnings are suppressed.
By default, warnings in class \fBO\fR and \fBW\fR are given.
.IP \fB\-W\fR\fIclasses\fR
allow for warning messages whose class is a member of \fIclasses\fR.
.IP \fB\-R\fP
.br
disable all range-checks.
.IP \fB\-A\fP
.br
enable extra array bound checks. Unfortunately, the back-end used for this
compiler is a bit sloppy, so extra array bound checks are needed if you want
detection of array bound errors.
.IP \fB\-3\fP
.br
Only accept Modula-2 programs that strictly conform to the 3rd Edition of
[1].
.IP \fB\-_\fP
.br
allow for underscores within identifiers. Identifiers may not start or end
with an underscore, even if this flag is given.
.IP \fB\-M\fIcompiler\fR
.br
use \fIcompiler\fR as Modula-2 compiler instead of the default.
.SH "SEE ALSO"
.IP [1]
N. Wirth, \fIProgramming in Modula-2\fP, 3rd edition, Springer Verlag.
.IP [2]
C.J.H. Jacobs, \fIThe ACK Modula-2 Compiler\fP.
.IP [3]
ack(1ACK) unix manual page.
.SH DIAGNOSTICS
Diagnostics are intended to be self-explanatory.
.SH REMARKS
You need the 4th ACK distribution to be able to use this program.

View File

@ -1,160 +0,0 @@
.TH FCC 1
.SH NAME
fcc \- fast CC-compatible C compiler
.SH SYNOPSIS
.B fcc
[
.B \-c
]
[
.B \-O
]
[
.B \-v
]
[
.B \-vn
]
[ \fB\-D\fIname\fR ]
[ \fB\-D\fIname\fB=\fIdef\fR ]
[
.BI \-I pathname
]
[
.B \-w
]
[
.B \-o
.I outfile
]
[
.B \-R
]
[
.BI \-U name
]
[
.BI -M compiler
]
.I sourcefile ...
.SH DESCRIPTION
.LP
.I Fcc
is a fast
.B C
compiler. It translates
.B C
programs
into cc(1)-compatible relocatable object modules, and does so in one pass.
Then, if the \fB\-c\fP flag is not given,
.I fcc
offers the object modules to a link-editor,
to create an executable binary.
.LP
.I Fcc
accepts several types of filename arguments. Files with
names ending in
.B .c
are taken to be
.B C
source programs.
They are compiled, and the resulting object module is placed in the current
directory.
The object module is named after its source file, the suffix
.B .o
replacing
.BR .c
in the name of the object.
.LP
Other arguments refer to loader options,
object modules, or object libraries.
Unless the
.B \-c
flag is given, these modules and libraries, together with the results of any
specified compilations, are passed (in the order given) to the
link-editor to produce
an output file named
.IR a.out .
You can specify a name for the executable by using the
.B \-o
option.
.LP
If a single
.B C
program is compiled and loaded all at once, the object module
file is deleted.
.SH OPTIONS
.LP
The \fB\-l\fIlib\fR, \fB\-d\fP, \fB\-n\fP, \fB\-N\fP,
\fB\-r\fP, \fB\-s\fP, \fB\-S\fP, \fB\-i\fP, and \fB\-u\fP options are
passed to the link-editor program.
The \fB\-u\fP option takes an extra argument.
.IP \fB\-c\fP
.br
Suppress the loading phase of the compilation, and force an object module to
be produced, even if only one program is compiled.
A single object module can be named explicitly using the
.B \-o
option.
.IP \fB\-D\fIname\fR\fB=\fIdef\fR
Define a symbol
.I name
to the
preprocessor, as if by "#define".
.IP \fB\-D\fIname\fR
.br
same as \fB\-D\fIname\fB=1\fR.
.IP \fB\-I\fIpathname\fR
.br
Add
.I pathname
to the list of directories in which to search for
.B #include
files with filenames not beginning with slash.
The compiler first searches for
.B #include
files in the directory containing
.I sourcefile,
then in directories in
.B \-I
options, and finally, in
.I /usr/include.
.IP "\fB\-o \fIoutput\fR"
Name the final output file
.I output.
.IP \fB\-O\fP
.br
Use a version of the compiler that is just a bit slower, but produces
better code.
.IP \fB\-U\fIname\fR
.br
Remove any initial definition of
.I name.
.IP \fB\-v\fP
.br
Verbose. Print the commands as they are executed.
.IP \fB\-vn\fP
.br
Verbose, no execute. Only print the commands, do not execute them.
.IP \fB\-w\fP
suppress warning messages.
.IP \fB\-R\fP
.br
test for more compatibility with Kernighan & Ritchie C [1].
.IP \fB\-M\fIcompiler\fR
.br
use \fIcompiler\fR as C-2 compiler instead of the default.
.LP
Object modules produced by cc(1) and
.I fcc
can be freely mixed, as long as the link-editor is called through
.I fcc.
.SH "SEE ALSO"
.IP [1]
B.W. Kernighan, D. Ritchie, "\fIThe C programming Language\fP", Prentice-Hall Inc., 1978
.IP [2]
E.H. Baalbergen, "\fIThe ACK CEM compiler\fP".
.IP [3]
cc(1) unix manual page.
.SH DIAGNOSTICS
Diagnostics are intended to be self-explanatory.

View File

@ -1,230 +0,0 @@
.TH FM2 1
.SH NAME
fm2 \- fast CC compatible Modula-2 compiler
.SH SYNOPSIS
.B fm2
[
.B \-c
]
[
.B \-O
]
[
.B \-v
]
[
.B \-vn
]
[ \fB\-D\fIname\fR ]
[ \fB\-D\fIname\fB=\fIdef\fR ]
[
.BI \-I pathname
]
[
.BI \-w classes
]
[
.BI \-W classes
]
[
.B \-L
]
[
.B \-o
.I outfile
]
[
.B \-R
]
[
.B \-A
]
[
.B \-3
]
[
.B \-U
]
[
.B \-e
]
[
.BI \-U name
]
[
.BI -M compiler
]
.I sourcefile ...
.SH DESCRIPTION
.LP
.I fm2
is a fast
.B Modula-2
compiler. It translates
.B Modula-2
programs
into cc(1)-compatible relocatable object modules, and does so in one pass.
Then, if the \fB\-c\fP flag is not given,
.I fm2
offers the object modules to a link-editor,
to create an executable binary.
.LP
.I Fm2
accepts several types of filename arguments. Files with
names ending in
.B .mod
are taken to be
.B Modula-2
source programs.
They are compiled, and the resulting object module is placed in the current
directory.
The object module is named after its source file, the suffix
.B .o
replacing
.BR .mod
in the name of the object.
A file with suffix
.B .mod
is passed through the C preprocessor if it begins with a '#'.
.PP
Definition modules are not separately compiled. The compiler reads them when
it needs them.
Definition modules are expected to reside in files with names ending
in
.BR .def .
The name of the file in which a definition module is stored must be the same as
the module-name, apart from the extension.
Also, in most Unix systems filenames are only 14 characters long.
So, given an IMPORT declaration for a module called "LongModulName",
the compiler will try to open a file called "LongModulN.def".
The requirement does not hold for implementation or program modules,
but is certainly recommended.
.LP
Other arguments refer to loader options,
object modules, or object libraries.
Unless the
.B \-c
flag is given, these modules and libraries, together with the results of any
specified compilations, are passed (in the order given) to the
link-editor to produce
an output file named
.IR a.out .
You can specify a name for the executable by using the
.B \-o
option.
.LP
If a single
.B Modula-2
program is compiled and loaded all at once, the object module
file is deleted.
.SH OPTIONS
.LP
The \fB\-l\fIlib\fR, \fB\-d\fP, \fB\-n\fP, \fB\-N\fP,
\fB\-r\fP, \fB\-s\fP, \fB\-S\fP, \fB\-i\fP, and \fB\-u\fP options are
passed to the link-editor program.
The \fB\-u\fP option takes an extra argument.
.IP \fB\-c\fP
.br
Suppress the loading phase of the compilation, and force an object module to
be produced, even if only one program is compiled.
A single object module can be named explicitly using the
.B \-o
option.
.IP \fB\-D\fIname\fR\fB=\fIdef\fR
Define a symbol
.I name
to the
preprocessor, as if by "#define".
.IP \fB\-D\fIname\fR
.br
same as \fB\-D\fIname\fB=1\fR.
.IP \fB\-I\fIpathname\fR
.br
Add
.I pathname
to the list of directories in which to search for
.B #include
files with filenames not beginning with slash.
The preprocessor first searches for
.B #include
files in the directory containing
.I sourcefile,
then in directories in
.B \-I
options, and finally, in
.I /usr/include.
This flag is also passed to the compiler. When the compiler needs a definition
module, it is first searched for in the current directory, then in the
directories given to it by the \fB\-I\fP flag, and then in a default directory,
.I CHANGE_ME.
.I fm2
This default directory contains all definition modules of
the runtime system.
.IP "\fB\-o \fIoutput\fR"
Name the final output file
.I output.
.IP \fB\-O\fP
.br
Use a version of the compiler that is just a bit slower, but produces
better code.
.IP \fB\-U\fIname\fR
.br
Remove any initial definition of
.I name.
.IP \fB\-v\fP
.br
Verbose. Print the commands as they are executed.
.IP \fB\-vn\fP
.br
Verbose, no execute. Only print the commands, do not execute them.
.IP \fB\-L\fR
do not generate code to keep track of
the current location in the source code.
.IP \fB\-w\fR\fIclasses\fR
suppress warning messages whose class is a member of \fIclasses\fR.
Currently, there are three classes: \fBO\fR, indicating old-flashioned use,
\fBW\fR, indicating "ordinary" warnings, and \fBR\fR, indicating
restricted Modula-2.
If no \fIclasses\fR are given, all warnings are suppressed.
By default, warnings in class \fBO\fR and \fBW\fR are given.
.IP \fB\-W\fR\fIclasses\fR
allow for warning messages whose class is a member of \fIclasses\fR.
.IP \fB\-R\fP
.br
disable all range-checks.
.IP \fB\-A\fP
.br
enable extra array bound checks. Unfortunately, the back-end used for this
compiler is a bit sloppy, so extra array bound checks are needed if you want
detection of array bound errors.
.IP \fB\-3\fP
.br
Only accept Modula-2 programs that strictly conform to the 3rd Edition of
[1].
.IP \fB\-U\fP
.br
allow for underscores within identifiers. Identifiers may not start or end
with an underscore, even if this flag is given.
.IP \fB\-e\fP
.br
allow for local extensions. Currently, the only local extensions are
procedure constants.
.IP \fB\-M\fIcompiler\fR
.br
use \fIcompiler\fR as Modula-2 compiler instead of the default.
.PP
The compiler does not do any version-control. Instead, a makefile
generator,
.IR m2mm ,
is included.
.SH "SEE ALSO"
.IP [1]
N. Wirth, \fIProgramming in Modula-2\fP, 3rd edition, Springer Verlag.
.IP [2]
C.J.H. Jacobs, \fIThe ACK Modula-2 Compiler\fP.
.IP [3]
cc(1) unix manual page.
.IP [4]
m2mm(1) manual page.
.SH DIAGNOSTICS
Diagnostics are intended to be self-explanatory.

View File

@ -1,230 +0,0 @@
.TH FM2 1
.SH NAME
fpc \- fast CC compatible Modula-2 compiler
.SH SYNOPSIS
.B fpc
[
.B \-c
]
[
.B \-O
]
[
.B \-v
]
[
.B \-vn
]
[ \fB\-D\fIname\fR ]
[ \fB\-D\fIname\fB=\fIdef\fR ]
[
.BI \-I pathname
]
[
.B \-w
]
[
.B \-L
]
[
.B \-o
.I outfile
]
[
.B \-R
]
[
.B \-A
]
[
.B \-a
]
[
.B \-d
]
[
.BI \-i num
]
[
.B \-t
]
[
.B \-C
]
[
.B \-U+
]
[
.B \-u+
]
[
.B \-s+
]
[
.B \-c+
]
[
.BI \-U name
]
[
.BI -M compiler
]
.I sourcefile ...
.SH DESCRIPTION
.LP
.I fpc
is a fast
.B Pascal
compiler. It translates
.B Pascal
programs
into cc(1)-compatible relocatable object modules, and does so in one pass.
Then, if the \fB\-c\fP flag is not given,
.I fpc
offers the object modules to a link-editor,
to create an executable binary.
.LP
.I Fpc
accepts several types of filename arguments. Files with
names ending in
.B .p
are taken to be
.B Pascal
source programs.
They are compiled, and the resulting object module is placed in the current
directory.
The object module is named after its source file, the suffix
.B .o
replacing
.BR .p
in the name of the object.
A file with suffix
.B .p
is passed through the C preprocessor if it begins with a '#'.
.LP
Other arguments refer to loader options,
object modules, or object libraries.
Unless the
.B \-c
flag is given, these modules and libraries, together with the results of any
specified compilations, are passed (in the order given) to the
link-editor to produce
an output file named
.IR a.out .
You can specify a name for the executable by using the
.B \-o
option.
.LP
If a single
.B Pascal
program is compiled and loaded all at once, the object module
file is deleted.
.SH OPTIONS
.LP
The \fB\-l\fIlib\fR, \fB\-d\fP, \fB\-n\fP, \fB\-N\fP,
\fB\-r\fP, \fB\-s\fP, \fB\-S\fP, \fB\-i\fP, and \fB\-u\fP options are
passed to the link-editor program.
The \fB\-u\fP option takes an extra argument.
.IP \fB\-c\fP
.br
Suppress the loading phase of the compilation, and force an object module to
be produced, even if only one program is compiled.
A single object module can be named explicitly using the
.B \-o
option.
.IP \fB\-D\fIname\fR\fB=\fIdef\fR
Define a symbol
.I name
to the
preprocessor, as if by "#define".
.IP \fB\-D\fIname\fR
.br
same as \fB\-D\fIname\fB=1\fR.
.IP \fB\-I\fIpathname\fR
.br
Add
.I pathname
to the list of directories in which to search for
.B #include
files with filenames not beginning with slash.
The preprocessor first searches for
.B #include
files in the directory containing
.I sourcefile,
then in directories in
.B \-I
options, and finally, in
.I /usr/include.
.IP "\fB\-o \fIoutput\fR"
Name the final output file
.I output.
.IP \fB\-O\fP
.br
Use a version of the compiler that is just a bit slower, but produces
better code.
.IP \fB\-U\fIname\fR
.br
Remove any initial definition of
.I name.
.IP \fB\-v\fP
.br
Verbose. Print the commands as they are executed.
.IP \fB\-vn\fP
.br
Verbose, no execute. Only print the commands, do not execute them.
.IP \fB\-L\fP
.br
do not generate code to keep track of
the current location in the source code.
.IP \fB\-w\fP
.br
suppress warning messages.
.IP \fB\-d\fP
.br
allow for "long"s.
.IP \fB\-i\fInum\fR
.br
set size for integer sets. By default, the set size is the word size.
.IP \fB\-C\fP
.br
distinguish between lower case and upper case. Normally, upper case letters
are considered equal to their lower case counterpart.
.IP \fB\-t\fP
.br
trace calls and exits of procedures and functions.
.IP \fB\-R\fP
.br
disable all range-checks.
.IP \fB\-A\fP
.br
enable extra array bound checks. Unfortunately, the back-end used for this
compiler is a bit sloppy, so extra array bound checks are needed if you want
detection of array bound errors.
.IP \fB\-a\fP
.br
disable assertions. Assertions are skipped instead of evaluated.
.IP "\fB\-U+\fP, \fB\-u+\fP"
.br
allow for underscores within identifiers. Identifiers may not start
with an underscore, even if this flag is given.
.IP \fB-s+\fP
.br
allow only standard
.BR Pascal .
This disables the \fB\-c+\fP, \fB\-d\fR, \fB\-u+\fR,
\fB\-U+\fR and \fB\-C\fR options.
Furthermore, assertions are not recognized at all.
.IP \fB-c+\fP
.br
allow C-like strings. This option is mainly intended for usage with
C-functions. This option will cause the type 'string' to be known.
.IP \fB\-M\fIcompiler\fR
.br
use \fIcompiler\fR as Modula-2 compiler instead of the default.
.SH "SEE ALSO"
.IP [1]
J.W. Stevenson, H. v. Eck, \fIAmsterdam Compiler Kit-Pascal reference manual\fP.
.IP [2]
cc(1) unix manual page.
.SH DIAGNOSTICS
Diagnostics are intended to be self-explanatory.

View File

@ -1,95 +0,0 @@
/* Utility to change strings in binary files.
Reads from standard input, writes on standard output.
Only replaces one occurrence if the -s flag is given.
*/
#include <stdio.h>
main(argc, argv)
char *argv[];
{
register char *psrc;
register int ch;
int srclen;
int sflag = 0;
char *progname = argv[0];
while (argc > 1 && argv[1][0] == '-') {
switch(argv[1][1]) {
case 's':
sflag = 1;
break;
default:
fprintf(stderr,
"Usage: %s [-s] <originalstring> <replacementstring>\n",
progname);
exit(1);
}
argc--;
argv++;
}
if (argc != 3) {
fprintf(stderr,
"Usage: %s [-s] <originalstring> <replacementstring>\n",
progname);
exit(1);
}
psrc = argv[1];
srclen = strlen(psrc);
if (srclen == 0) {
fprintf(stderr,
"%s: originalstring must have length > 0\n",
progname);
exit(1);
}
for (;;) {
ch = getchar();
if (ch == EOF) exit(0);
if (ch != (*psrc & 0377)) {
putchar(ch);
continue;
}
do {
psrc++;
ch = getchar();
} while (ch && ch == (*psrc & 0377));
if (ch != EOF) ungetc(ch, stdin);
if (*psrc == '\0') {
/* we have a match */
register int i;
register char *prepl = argv[2];
for (i = srclen; i; i--) {
if (*prepl) {
putchar(*prepl);
prepl++;
}
else putchar('\0');
}
while (*prepl) {
putchar(*prepl);
prepl++;
if (ch != EOF) ch = getchar();
}
if (sflag) {
break;
}
}
else {
register char *p = argv[1];
while (p < psrc) {
putchar(*p);
p++;
}
if (ch == EOF) exit(0);
}
psrc = argv[1];
}
if (ch == EOF) exit(0);
while ((ch = getchar()) != EOF) {
putchar(ch);
}
exit(0);
}

View File

@ -21,9 +21,14 @@
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#include <varargs.h>
#include <stdio.h> #include <stdio.h>
#include <em_path.h> #include <em_path.h>
#if __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
/* /*
Version producing cc-compatible .o files in one pass. Version producing cc-compatible .o files in one pass.
@ -117,7 +122,11 @@ int c_flag = 0;
int v_flag = 0; int v_flag = 0;
int O_flag = 0; int O_flag = 0;
#if __STDC__
char *mkstr(char *, ...);
#else
char *mkstr(); char *mkstr();
#endif
char *malloc(); char *malloc();
char *alloc(); char *alloc();
char *extension(); char *extension();
@ -483,6 +492,32 @@ concat(al1, al2)
} }
} }
#if __STDC__
/*VARARGS*/
char *
mkstr(char *dst, ...)
{
va_list ap;
va_start(ap, dst);
{
register char *p;
register char *q;
q = dst;
p = va_arg(ap, char *);
while (p) {
while (*q++ = *p++);
q--;
p = va_arg(ap, char *);
}
}
va_end(ap);
return dst;
}
#else
/*VARARGS*/ /*VARARGS*/
char * char *
mkstr(va_alist) mkstr(va_alist)
@ -509,6 +544,7 @@ mkstr(va_alist)
return dst; return dst;
} }
#endif
basename(str, dst) basename(str, dst)
char *str; char *str;

View File

@ -1,18 +1,24 @@
create_dir ack.pm
cp_dir ack-custom.pm
em_path.h.src c.pm
first llgen.pm
get_answer yacc.pm
get_makepars
get_sys #create_dir
get_sysvax #cp_dir
install_tail #em_path.h.src
limit_enquire #first
limit_impl #get_answer
lint_params #get_makepars
local.h.src #get_sys
mk_config #get_sysvax
mk_makefile #install_tail
mk_target #limit_enquire
target_comp #limit_impl
util_comp #lint_params
#local.h.src
#mk_config
#mk_makefile
#mk_target
#target_comp
#util_comp

21
first/ack-custom.pm Normal file
View File

@ -0,0 +1,21 @@
-- $Source$
-- $State$
-- Custom rules used by the ACK build process.
preprocess = simple {
class = "preprocess",
outputs = {"%U%-%I%"},
command = {
"cpp -I%HEADERDIR% %in% > %out[1]%"
}
}
-- Revision history
-- $Log$
-- Revision 1.2 2007-02-20 00:32:58 dtrg
-- Changed the 'preprocess' rule to use the system C preprocessor.
--
-- Revision 1.1 2006/07/22 00:49:48 dtrg
-- First version in CVS.
--

33
first/ack.pm Normal file
View File

@ -0,0 +1,33 @@
-- $Source$
-- $State$
-- Provides rules for building things with the half-built ACK itself.
ACKBUILDFLAGS = {"-m%PLATFORM%", "%OPTIMISATION%"}
ACKDEFINES = EMPTY
ACKINCLUDES = EMPTY
ackfile = simple_with_clike_dependencies {
class = "ackfile",
CINCLUDES = {REDIRECT, "ACKINCLUDES"},
command = {
"%BINDIR%bin/ack %ACKBUILDFLAGS% %ACKINCLUDES:cincludes% %ACKDEFINES:cdefines% -c -o %out% %in%"
},
outputs = {"%U%-%I%.o"},
}
ackprogram = simple {
class = "ackprogram",
command = {
"%BINDIR%bin/ack %ACKBUILDFLAGS% -o %out% %in%"
},
outputs = {"%U%-%I%"},
}
acklibrary = simple {
class = "acklibrary",
command = {
"%RM% %out% && %BINDIR%bin/aal cr %out% %in%"
},
outputs = {"%U%-%I%.a"},
}

238
first/c.pm Normal file
View File

@ -0,0 +1,238 @@
-- $Id$
-- $HeadURL: https://primemover.svn.sf.net/svnroot/primemover/pm/lib/c.pm $
-- $LastChangedDate: 2007-02-24 01:37:06 +0000 (Sat, 24 Feb 2007) $
-- pm includefile to compile *host* C programs.
-- Standard Lua boilerplate.
local io_open = io.open
local string_gsub = string.gsub
local string_gfind = string.gfind
local string_find = string.find
local table_insert = table.insert
local table_getn = table.getn
local filetime = pm.filetime
-- Define some variables.
CCOMPILER = "gcc"
CXXCOMPILER = "g++"
CC = "%CCOMPILER% %CBUILDFLAGS% %CDYNINCLUDES:cincludes% %CINCLUDES:cincludes% %CDEFINES:cdefines% %CEXTRAFLAGS% -c -o %out% %in%"
CXX = "%CXXCOMPILER% %CBUILDFLAGS% %CDYNINCLUDES:cincludes% %CINCLUDES:cincludes% %CDEFINES:cdefines% %CEXTRAFLAGS% -c -o %out% %in%"
CPROGRAM = "%CCOMPILER% %CBUILDFLAGS% %CLINKFLAGS% %CEXTRAFLAGS% -o %out% %in% %CLIBRARIES:clibraries%"
CXXPROGRAM = "%CXXCOMPILER% %CBUILDFLAGS% %CLINKFLAGS% %CEXTRAFLAGS% -o %out% %in% %CLIBRARIES:clibraries%"
CLIBRARY = "rm -f %out% && ar cr %out% %in% && ranlib %out%"
CBUILDFLAGS = {"-g"}
CINCLUDES = EMPTY
CDEFINES = EMPTY
CEXTRAFLAGS = EMPTY
CLINKFLAGS = EMPTY
CDYNINCLUDES = EMPTY
CLIBRARIES = EMPTY
--- Custom string modifiers -------------------------------------------------
local function prepend(rule, arg, prefix)
if (arg == EMPTY) then
return EMPTY
end
local t = {}
for i, j in ipairs(arg) do
t[i] = prefix..j
end
return t
end
function pm.stringmodifier.cincludes(rule, arg)
return prepend(rule, arg, "-I")
end
function pm.stringmodifier.cdefines(rule, arg)
return prepend(rule, arg, "-D")
end
function pm.stringmodifier.clibraries(rule, arg)
if (arg == EMPTY) then
return EMPTY
end
local t = {}
for i, j in ipairs(arg) do
if string_find(j, "%.a$") then
t[i] = j
else
t[i] = "-l"..j
end
end
return t
end
--- Manage C file dependencies ----------------------------------------------
local dependency_cache = {}
local function calculate_dependencies(filename, includes)
-- Cache values, so we don't recalculate dependencies needlessly.
local o = dependency_cache[filename]
if o then
return o
end
local deps = {}
deps[filename] = true
local calcdeps = 0
calcdeps = function(filename, file)
file = file or io_open(filename)
if not file then
return
end
local localincludes = string_gsub(filename, "/[^/]*$", "")
if localincludes then
localincludes = {localincludes, unpack(includes)}
else
localincludes = includes
end
for line in file:lines() do
local _, _, f = string_find(line, '^[ \t]*#[ \t]*include[ \t]*["<]([^"]+)[">]')
if f then
for _, path in ipairs(localincludes) do
local subfilename = path.."/"..f
local subfile = io_open(subfilename)
if subfile then
if not deps[subfilename] then
deps[subfilename] = true
calcdeps(subfilename, subfile)
end
break
end
end
end
end
-- Explicit close to avoid having to wait for the garbage collector
-- to free up the underlying fd.
file:close()
end
calcdeps(filename)
o = {}
for i, _ in pairs(deps) do
table_insert(o, i)
end
dependency_cache[filename] = o
return o
end
-- This clause specialises 'simple' to add support for smart dependencies of C
-- files.
simple_with_clike_dependencies = simple {
class = "simple_with_clike_dependencies",
makedepends = {"%CDEPENDS%"},
__init = function(self, p)
simple.__init(self, p)
-- If we're a class, don't verify.
if ((type(p) == "table") and p.class) then
return
end
-- If dynamicheaders is an object, turn it into a singleton list.
if self.dynamicheaders then
if (type(self.dynamicheaders) ~= "table") then
self:__error("doesn't know what to do with dynamicheaders, which ",
"should be a list or an object but was a ", type(self.dynamicheaders))
end
if self.dynamicheaders.class then
self.dynamicheaders = {self.dynamicheaders}
end
end
end,
__dependencies = function(self, inputs, outputs)
local cincludes = self:__index("CINCLUDES")
if (type(cincludes) == "string") then
cincludes = {cincludes}
end
local includes = {}
for _, i in ipairs(cincludes) do
table_insert(includes, self:__expand(i))
end
local input = self:__expand(inputs[1])
local depends = calculate_dependencies(input, includes)
if not depends then
self:__error("could not determine the dependencies for ",
pm.rendertable({input}))
end
if pm.verbose then
pm.message('"', input, '" appears to depend on ',
pm.rendertable(depends))
end
return depends
end,
__buildadditionalchildren = function(self)
self.CDYNINCLUDES = {}
if self.dynamicheaders then
for _, i in ipairs(self.dynamicheaders) do
local o = i:__build()
if o[1] then
table_insert(self.CDYNINCLUDES, (string_gsub(o[1], "/[^/]*$", "")))
end
end
end
-- If no paths on the list, replace the list with EMPTY so it doesn't
-- expand to anything.
if (table_getn(self.CDYNINCLUDES) == 0) then
self.CDYNINCLUDES = EMPTY
end
end
}
-- These are the publically useful clauses.
cfile = simple_with_clike_dependencies {
class = "cfile",
command = {"%CC%"},
outputs = {"%U%-%I%.o"},
}
cxxfile = simple_with_clike_dependencies {
class = "cxxfile",
command = {"%CXX%"},
outputs = {"%U%-%I%.o"},
}
cprogram = simple {
class = "cprogram",
command = {"%CPROGRAM%"},
outputs = {"%U%-%I%"},
}
cxxprogram = simple {
class = "cxxprogram",
command = {"%CXXPROGRAM%"},
outputs = {"%U%-%I%"},
}
clibrary = simple {
class = "clibrary",
command = {
"%CLIBRARY%"
},
outputs = {"%U%-%I%.a"},
}

View File

@ -1,70 +0,0 @@
trap "rm -f x$$.c" 0 1 2 3 15
EMHOME=/usr/em
CFLAG=0
TARGET=a.out
while :
do
case $# in
0) break;;
esac
case $1 in
-I*|-D*|-U*)
PREP=$PREP" "$1
;;
-c) CFLAG=1
;;
-o) shift
TARGET=$1
;;
-F) shift
LFLAG="-F $1"
;;
-*) FLAGS=$FLAGS" "$1
;;
*) ARG=$ARG" "$1
;;
esac
shift
done
for i in $ARG
do
case $i in
*.c)
nm=`basename $i .c`
if [ -x $EMHOME/lib/cpp ]
then
cpp=$EMHOME/lib/cpp
cppf=-P
else
cpp=/bin/cc
cppf=-E
fi
if $cpp $cppf $PREP $i > x$$.c && /bin/cc $FLAGS -c x$$.c
then
mv x$$.o $nm.o
LDARG=$LDARG" "$nm.o
else
rm -f x$$.c
exit 1
fi
rm -f x$$.c
;;
*.s)
if /bin/cc $FLAGS -c $i
then
LDARG=$LDARG" "`basename $i .s`.o
else exit 1
fi
;;
*) LDARG=$LDARG" "$i
;;
esac
done
case $CFLAG in
1) ;;
*) if /bin/cc $FLAGS $LFLAG $LDARG -o $TARGET
then :
else exit 1
fi
;;
esac

View File

@ -1,67 +0,0 @@
rm -f ../bin/x_tpath x_tpath
echo 'Checking out your $PATH; . and $ACK/bin should be in front ...'
echo "echo $$" >../bin/x_tpath
rm -f x_tpath
chmod +x ../bin/x_tpath
case x`(x_tpath) 2>/dev/null`
in
x$$)
STAT=0 ;;
x)
(cd ../bin ; echo Sorry, `pwd` is not in your shell PATH" ($PATH)")
STAT=1 ;;
*)
echo "Sorry, there is something wrong with your PATH ($PATH)" ;;
esac
echo "echo t_$$" > X_Y_Z_
chmod +x X_Y_Z_
case x`X_Y_Z_`
in
xt_$$)
;;
x)
(cd ../bin ; echo Sorry, . is not in your shell PATH" ($PATH)")
STAT=2 ;;
*)
echo "Sorry, there is something wrong with your PATH ($PATH)" ;;
esac
rm -f X_Y_Z_
case $STAT
in
2)
;;
*)
hash -r ;;
esac
echo "echo l_$$" >x_tpath
chmod +x x_tpath
case x`(x_tpath) 2>/dev/null`
in
xl_$$)
;;
x)
(cd ../bin ; echo Sorry, . is not in your shell PATH" ($PATH)")
STAT=2 ;;
x$$)
echo Sorry, . is not in your PATH" ($PATH)" or after the ACK bin directory
STAT=3 ;;
*)
echo "Sorry, there is something wrong with your PATH ($PATH)"
STAT=4 ;;
esac
rm -f ../bin/x_tpath x_tpath
echo "echo 93" > ../bin/cat
chmod +x ../bin/cat
hash -r
case x`cat < /dev/null 2>/dev/null`
in
x93)
rm -f ../bin/cat
;;
*)
rm -f ../bin/cat
(cd ../bin ; echo Sorry, `pwd` comes too late in your PATH" ($PATH)" )
STAT=13
;;
esac
exit $STAT

Some files were not shown because too many files have changed in this diff Show More