195 Commits

Author SHA1 Message Date
David Given
f07c6e4d6a Rename branch.
--HG--
branch : dtrg-videocore-branch-branch
2015-06-18 23:39:25 +02:00
David Given
171f16d7b8 Rename branch.
--HG--
branch : dtrg-videocore-branch
2015-06-18 23:38:50 +02:00
David Given
62cc636f10 Merge.
--HG--
branch : dtrg-videocore
2015-03-23 00:15:42 +01:00
David Given
e36d739fa4 Add (largely untested) float/int conversion.
--HG--
branch : dtrg-videocore
2013-07-01 13:05:36 +01:00
David Given
8b6951dac0 Fix incorrect offset encoding in lea (sp) instructions.
--HG--
branch : dtrg-videocore
2013-06-29 00:35:07 +01:00
David Given
edb174da8d Fix incorrect encoding of 'push lr' and 'pop pc'.
--HG--
branch : dtrg-videocore
2013-06-29 00:32:39 +01:00
David Given
29af6f1adb ISA change: clz has been renamed to log2.
--HG--
branch : dtrg-videocore
2013-06-27 11:25:50 +01:00
David Given
2b3f95de0b Fix jump range checking in the addcmpb family of instructions.
--HG--
branch : dtrg-videocore
2013-06-26 23:32:54 +01:00
David Given
c72eaef8ee Add routine to set the Raspberry Pi clock to 250MHz (loads faster than the default 19.2MHz).
--HG--
branch : dtrg-videocore
rename : plat/rpi/libsys/pi_user_to_phys.s => plat/rpi/libsys/pi_fast_mode.s
2013-06-24 23:57:27 +01:00
David Given
d94c1c8150 Updated distr files.
--HG--
branch : dtrg-videocore
rename : mach/i80/.distr => mach/vc4/.distr
rename : plat/cpm/.distr => plat/rpi/.distr
2013-06-21 23:38:21 +01:00
David Given
2be811bac2 Updated VC4 docs.
--HG--
branch : dtrg-videocore
2013-06-21 23:21:08 +01:00
David Given
fd2360be0f Ship assembler man pages.
--HG--
branch : dtrg-videocore
rename : man/8080_as.6 => man/i80_as.6
rename : man/m68k2_as.6 => man/m68020_as.6
2013-06-21 23:20:50 +01:00
David Given
55be35a68a Add a stub malloc.h.
--HG--
branch : dtrg-videocore
rename : lang/cem/libcc.ansi/headers/stdlib.h => lang/cem/libcc.ansi/headers/malloc.h
2013-06-20 00:15:14 +01:00
David Given
052dd9bfc0 Actually remember to set the stack pointer on startup. Reduce to stack from 16kB to a much more reasonable 1kB.
--HG--
branch : dtrg-videocore
2013-06-20 00:14:55 +01:00
David Given
eaf4339cd6 Implement a very crude busy-wait based select() mechanism for consol input.
--HG--
branch : dtrg-videocore
rename : plat/rpi/include/ack/config.h => plat/rpi/include/sys/select.h
rename : plat/rpi/libsys/time.c => plat/rpi/libsys/select.c
2013-06-09 22:16:30 +01:00
David Given
bbd4b46850 Fix stack corruption when adjusting SP. Be a bit more rigorous about clearing the pseudostack on branch/labels.
--HG--
branch : dtrg-videocore
2013-06-07 21:25:38 +01:00
David Given
ed6c4a85d1 Change the size of the SRAM area to 128kB (to reflect reality).
--HG--
branch : dtrg-videocore
2013-06-06 00:05:48 +01:00
David Given
3e0123ca03 Fix treatment of out-of-range values in switch csa.
--HG--
branch : dtrg-videocore
2013-06-05 23:57:23 +01:00
David Given
86c6fa2f1e Implement NOT...
--HG--
branch : dtrg-videocore
2013-05-30 23:50:19 +01:00
David Given
d5a112dbfd Some more termios compatibility options.
--HG--
branch : dtrg-videocore
2013-05-30 23:25:22 +01:00
David Given
2054618e75 Add basic termios to the rpi platform to allow echoing/newline translation to be controlled.
--HG--
branch : dtrg-videocore
rename : plat/rpi/include/unistd.h => plat/rpi/include/termios.h
rename : plat/rpi/libsys/write.c => plat/rpi/libsys/tcgetattr.c
rename : plat/rpi/libsys/write.c => plat/rpi/libsys/tcsetattr.c
2013-05-30 23:19:55 +01:00
David Given
074b42aa97 Add some missing libc functions: setenv, unsetenv, strdup.
--HG--
branch : dtrg-videocore
rename : lang/cem/libcc.ansi/stdlib/getenv.c => lang/cem/libcc.ansi/stdlib/setenv.c
rename : lang/cem/libcc.ansi/string/strlen.c => lang/cem/libcc.ansi/string/strdup.c
2013-05-29 21:41:58 +01:00
David Given
69953d016c Add support for snprintf and vsnprintf. Try and make the return value a bit
more standards-compliant.

--HG--
branch : dtrg-videocore
2013-05-29 17:10:58 +01:00
David Given
d3e3e72860 Update from trunk.
--HG--
branch : dtrg-videocore
2013-05-29 15:03:48 +01:00
David Given
6fff2d45fe Attempt to fix 64-bitness error in ashow. Deprecate the structure format macros in h/out.h because they make no sense on 64-bit platforms. 2013-05-29 14:48:51 +01:00
David Given
e0c121d6e6 Use relocation enumerations rather than hard-coded values for relocation types
(these were causing problems due to the enumeration values having changed).
2013-05-29 14:11:04 +01:00
David Given
1f36370d87 Implement nop (the C compiler sometimes generates this!).
--HG--
branch : dtrg-videocore
2013-05-26 22:54:53 +01:00
David Given
ae993b1eb2 Add a crude README.
--HG--
branch : dtrg-videocore
2013-05-26 19:54:22 +01:00
David Given
38e4726f5c Boot code now works properly in both kernel and bare-metal mode.
--HG--
branch : dtrg-videocore
2013-05-26 19:41:37 +01:00
David Given
ef25c53c9c Fix bug in ine/dee.
--HG--
branch : dtrg-videocore
2013-05-26 18:59:19 +01:00
David Given
e01f00e320 Allow reading from the mini UART. Add a check to not touch the UART unless it's been initialised (in case of accidents when running in kernel mode).
--HG--
branch : dtrg-videocore
2013-05-26 18:58:54 +01:00
David Given
366cd10194 Remainders are calculated correctly. printf now works.
--HG--
branch : dtrg-videocore
2013-05-26 13:13:58 +01:00
David Given
510888e6d5 .csb now works.
--HG--
branch : dtrg-videocore
rename : mach/vc4/libem/csa.s => mach/vc4/libem/csb.s
2013-05-26 13:06:25 +01:00
David Given
6284512b37 Fix erroneous section check (symbols may not have a defined section in pass 1).
--HG--
branch : dtrg-videocore
2013-05-26 00:35:15 +01:00
David Given
bd9497be77 Renamed the pi-specific functions to be a bit cleaner.
--HG--
branch : dtrg-videocore
rename : plat/rpi/libsys/phys_to_user.s => plat/rpi/libsys/pi_phys_to_user.s
rename : plat/rpi/libsys/uart.s => plat/rpi/libsys/pi_uart.s
rename : plat/rpi/libsys/user_to_phys.s => plat/rpi/libsys/pi_user_to_phys.s
2013-05-26 00:22:39 +01:00
David Given
308d41e083 Added triple-quad load and store (used by the signal stuff).
--HG--
branch : dtrg-videocore
2013-05-26 00:22:08 +01:00
David Given
e299cc3bcf stdio (output only) now works.
--HG--
branch : dtrg-videocore
2013-05-25 23:59:31 +01:00
David Given
8c21a2ef9b Stop fighting the terrible code and remove the regvar support --- it didn't help much and was a pain.
--HG--
branch : dtrg-videocore
2013-05-25 23:58:35 +01:00
David Given
6a672d5e96 Heap allocations now works.
--HG--
branch : dtrg-videocore
2013-05-25 23:28:47 +01:00
David Given
3b07fee160 Major bugfix where instructions weren't being shrunk correctly. (Turns out there's built-in support for doing this, which I hadn't found.)
--HG--
branch : dtrg-videocore
2013-05-25 23:26:10 +01:00
David Given
b6680a48cc Disable register variables. The code is a bit worse, but having two stackable registers makes things much easier to understand.
--HG--
branch : dtrg-videocore
2013-05-25 13:31:58 +01:00
David Given
d7efb0a32c Implement .csa.
--HG--
branch : dtrg-videocore
rename : mach/vc4/libem/dummy.s => mach/vc4/libem/csa.s
2013-05-25 13:31:27 +01:00
David Given
2ee79ab0b2 Encode comparing branch correctly.
--HG--
branch : dtrg-videocore
2013-05-25 13:31:01 +01:00
David Given
ec25fec145 Build binaries that will run bare metal. Add enough syscall library to init the uart and write text.
--HG--
branch : dtrg-videocore
rename : plat/rpi/libsys/libsys.h => plat/rpi/libsys/libsysasm.h
rename : plat/rpi/libsys/_sys_rawread.s => plat/rpi/libsys/phys_to_user.s
rename : plat/rpi/libsys/_sys_rawread.s => plat/rpi/libsys/uart.s
rename : plat/rpi/libsys/_sys_rawread.s => plat/rpi/libsys/user_to_phys.s
2013-05-25 00:35:29 +01:00
David Given
472f778342 Don't write out constant data as big-endian! Some other cleanups.
--HG--
branch : dtrg-videocore
2013-05-25 00:33:38 +01:00
David Given
98e745d04c Fix awful bug where uint32_t was sometimes defined as a short.
--HG--
branch : dtrg-videocore
2013-05-25 00:33:01 +01:00
David Given
98a51732ab Various codegen tweaks.
--HG--
branch : dtrg-videocore
2013-05-24 17:04:29 +01:00
David Given
2c7ee27206 Double-quads can be loaded and stored (more) correctly.
--HG--
branch : dtrg-videocore
2013-05-22 23:55:23 +01:00
David Given
6cbe6e1c4e Better treatment of sign extension.
--HG--
branch : dtrg-videocore
2013-05-22 23:12:48 +01:00
David Given
8f338f9b44 Now actually runs on real hardware.
--HG--
branch : dtrg-videocore
2013-05-22 22:46:10 +01:00
David Given
7537c85e0a Generate adds instructions when a shift-and-add is seen (useful for array indexing).
--HG--
branch : dtrg-videocore
2013-05-22 21:37:48 +01:00
David Given
b5e5df4a63 Allocate a user stack to run code in.
--HG--
branch : dtrg-videocore
2013-05-22 18:25:30 +01:00
David Given
cdce394b6c Generate ld rd, (rs) instructions properly.
--HG--
branch : dtrg-videocore
2013-05-22 11:02:46 +01:00
David Given
9e556d8b7b Optimise direct access to globals, and incrementing and decrementing locals.
--HG--
branch : dtrg-videocore
2013-05-22 10:55:13 +01:00
David Given
0068952bd1 Build the Raspberry Pi code.
--HG--
branch : dtrg-videocore
2013-05-22 09:47:22 +01:00
David Given
6b5316dcfa More typo fixes.
--HG--
branch : dtrg-videocore
2013-05-22 00:52:58 +01:00
David Given
08c4334224 Typo fixes.
--HG--
branch : dtrg-videocore
2013-05-22 00:44:04 +01:00
David Given
72542288cd Adjust bootstrap code to build kernels that work with the mailbox test app.
--HG--
branch : dtrg-videocore
2013-05-22 00:16:59 +01:00
David Given
f904465e9c Fix signedness problem that was showing up on ARM.
--HG--
branch : dtrg-videocore
2013-05-22 00:16:16 +01:00
David Given
5e9102955c Reworked VC4 relocations and some of the instruction encoding to be actually correct. Now generating what could be real code!
--HG--
branch : dtrg-videocore
2013-05-21 23:17:30 +01:00
David Given
1312fe298b Now compiles (incorrectly) the entire libc, libpc, libm2 and libbasic!
--HG--
branch : dtrg-videocore
2013-05-21 20:05:26 +01:00
David Given
92817a6ad7 Allow platforms to specify size of long double; seperate alignment from size.
--HG--
branch : dtrg-videocore
2013-05-21 19:18:11 +01:00
David Given
877e06ed89 Lots more opcodes including float support. Define float and double to be the
same thing (as the VC4 seems not to have double-precision float support).

--HG--
branch : dtrg-videocore
2013-05-21 18:16:30 +01:00
David Given
6cdea73e84 Add a lot more opcodes.
--HG--
branch : dtrg-videocore
2013-05-20 23:27:45 +01:00
David Given
d6565f4d5b Fix typo.
--HG--
branch : dtrg-videocore
2013-05-20 23:27:31 +01:00
David Given
e5341e4167 Remember to clear ackflags on reset.
--HG--
branch : dtrg-videocore
2013-05-20 22:41:27 +01:00
David Given
970f2bae62 Major revamp to simplify and use 2op instructions. Better code. Now looks like it may work one day.
--HG--
branch : dtrg-videocore
2013-05-20 22:35:12 +01:00
David Given
5082b2a5d7 Add lea instruction. Fix dependency issues.
--HG--
branch : dtrg-videocore
2013-05-20 19:56:33 +01:00
David Given
11890026db Push/pop are the right way round. Don't corrup short-form ALU instructions. Correct encoding of push/pop register ranges.
--HG--
branch : dtrg-videocore
2013-05-19 23:34:42 +01:00
David Given
76ba0bf6b3 First steps towards a code generator.
--HG--
branch : dtrg-videocore
2013-05-19 23:33:42 +01:00
David Given
61bff18082 Added skeleton bootstrap code.
--HG--
branch : dtrg-videocore
rename : plat/pc86/boot.s => plat/rpi/boot.s
2013-05-19 23:33:29 +01:00
David Given
80f85001fa Correctly emit constants in some ALU instructions.
--HG--
branch : dtrg-videocore
2013-05-19 23:19:10 +01:00
David Given
a46ee91859 Fix warning.
--HG--
branch : dtrg-videocore
2013-05-19 23:18:36 +01:00
David Given
4f15423d63 Add compare-and-branch instructions.
--HG--
branch : dtrg-videocore
2013-05-19 18:40:19 +01:00
David Given
80afe75c9b Added memory operations that work on fixed up addresses.
--HG--
branch : dtrg-videocore
2013-05-19 13:03:53 +01:00
David Given
febe8ca937 Add register offset and postincrement memory operations.
--HG--
branch : dtrg-videocore
2013-05-19 12:39:35 +01:00
David Given
fc2833d456 Add most vanilla memory load/store instructions.
--HG--
branch : dtrg-videocore
2013-05-19 00:56:56 +01:00
David Given
fc1b3672a3 Reapply bugfix to sbrk() which got dropped during the move from linx386/libsys
to liblinux. Set errno correctly.
2013-05-18 13:00:37 +01:00
David Given
c18a82ec40 Apply build system fixes for OpenBSD contributed by George Koehler. 2013-05-18 12:15:53 +01:00
David Given
26877d3c4f Add a whole bunch of VC4 opcodes.
--HG--
branch : dtrg-videocore
2013-05-17 23:30:49 +01:00
David Given
5378e3fe53 Add special relocation type for VC4 jump instructions.
--HG--
branch : dtrg-videocore
2013-05-17 22:40:50 +01:00
David Given
5b4aa07dee Merge fixes from trunk.
--HG--
branch : dtrg-videocore
2013-05-17 15:28:04 +01:00
David Given
9a513e8ef3 Fix warning. 2013-05-17 00:04:54 +01:00
David Given
e7c2029c9c Dependency fixes. 2013-05-17 00:04:37 +01:00
David Given
32ebc502c8 Skeleton of VideoCore IV support for the Raspberry Pi.
--HG--
branch : dtrg-videocore
rename : mach/powerpc/as/.distr => mach/vc4/as/.distr
rename : mach/powerpc/as/mach0.c => mach/vc4/as/mach0.c
rename : mach/powerpc/as/mach1.c => mach/vc4/as/mach1.c
rename : mach/powerpc/as/mach2.c => mach/vc4/as/mach2.c
rename : mach/powerpc/as/mach3.c => mach/vc4/as/mach3.c
rename : mach/powerpc/as/mach4.c => mach/vc4/as/mach4.c
rename : mach/powerpc/as/mach5.c => mach/vc4/as/mach5.c
rename : mach/i86/build.mk => mach/vc4/build.mk
rename : mach/powerpc/libem/powerpc.h => mach/vc4/libem/videocore.h
rename : mach/i86/libend/.distr => mach/vc4/libend/.distr
rename : mach/i86/libend/edata.s => mach/vc4/libend/edata.s
rename : mach/i86/libend/em_end.s => mach/vc4/libend/em_end.s
rename : mach/i86/libend/end.s => mach/vc4/libend/end.s
rename : mach/i86/libend/etext.s => mach/vc4/libend/etext.s
rename : mach/powerpc/ncg/.distr => mach/vc4/ncg/.distr
rename : mach/powerpc/ncg/mach.c => mach/vc4/ncg/mach.c
rename : mach/powerpc/ncg/mach.h => mach/vc4/ncg/mach.h
rename : mach/powerpc/ncg/table => mach/vc4/ncg/table
rename : plat/pc86/descr => plat/rpi/descr
2013-05-17 00:03:38 +01:00
David Given
e5f6d5acfa Fix buffer overrun looking up type information for op_lab pseudoops (as
they're not EM opcodes, we shouldn't look them up in em_flags!).
2013-05-16 22:02:59 +01:00
David Given
f70f78b6e4 Correctly generate dependency information. 2013-05-16 22:02:00 +01:00
David Given
84f81a442c Merge in build system changes. 2013-05-16 14:33:19 +01:00
David Given
24ef1627ec A few last build tweaks.
--HG--
branch : dtrg-buildsystem
2013-05-16 14:20:58 +01:00
David Given
11377070fd Update distribution files.
--HG--
branch : dtrg-buildsystem
2013-05-15 23:46:15 +01:00
David Given
8fbce949f5 Now describe the make-based build system in the README.
--HG--
branch : dtrg-buildsystem
2013-05-15 23:12:05 +01:00
David Given
aaa3f14a79 Fix build error in opt which was causing all code, everywhere, to be broken.
Remember to build opt2 too.

--HG--
branch : dtrg-buildsystem
2013-05-15 22:09:28 +01:00
David Given
e9233b4712 Build ego.
--HG--
branch : dtrg-buildsystem
rename : util/arch/build.mk => util/ego/build.mk
2013-05-15 21:14:06 +01:00
David Given
f6c43b95ef Modula-2 now works.
--HG--
branch : dtrg-buildsystem
rename : lang/pc/build.mk => lang/m2/build.mk
rename : lang/pc/libpc/build.mk => lang/m2/comp/build.mk
rename : lang/pc/libpc/build.mk => lang/m2/libm2/build.mk
2013-05-14 22:24:38 +01:00
David Given
66aebcdd91 Pascal compiler now runs.
--HG--
branch : dtrg-buildsystem
rename : lang/basic/build.mk => lang/pc/build.mk
rename : lang/cem/cemcom.ansi/build.mk => lang/pc/comp/build.mk
rename : lang/basic/lib/build.mk => lang/pc/libpc/build.mk
2013-05-14 20:47:04 +01:00
David Given
a6ebaeabd0 Basic compiler now runs.
--HG--
branch : dtrg-buildsystem
2013-05-14 18:01:38 +01:00
David Given
d5f0107746 Build the Basic run-time library (after some modernisation).
--HG--
branch : dtrg-buildsystem
2013-05-14 16:11:29 +01:00
David Given
a68b117e96 Add missing dependency.
--HG--
branch : dtrg-buildsystem
2013-05-14 14:55:29 +01:00
David Given
07453d184a Top, topgen, aelflod. Moved the libraries back into the platform-specific
directories --- wrangling descr files was too hard. C programs can be built
for cpm, pc86, linux386, linux68k!

--HG--
branch : dtrg-buildsystem
rename : util/ack/build.mk => util/led/build.mk
rename : util/LLgen/build.mk => util/topgen/build.mk
2013-05-13 23:26:15 +01:00
David Given
442306d557 Split off some of the platform-independent stuff (such as as and ncg).
--HG--
branch : dtrg-buildsystem
rename : plat/pc86/build.mk => mach/i386/build.mk
rename : plat/pc86/build.mk => mach/i80/build.mk
rename : plat/pc86/build.mk => mach/i86/build.mk
rename : plat/pc86/build.mk => mach/m68020/build.mk
rename : plat/pc86/build.mk => mach/powerpc/build.mk
2013-05-13 22:12:46 +01:00
David Given
81778b603f Merge updates from trunk.
--HG--
branch : dtrg-buildsystem
2013-05-13 12:37:27 +01:00
David Given
af0dedeb6e Fix typo.
--HG--
branch : dtrg-buildsystem
2013-05-13 11:14:10 +01:00
David Given
b0c238eb5d Made a start on building the runtimes for each platform and language; the
Linuxes all build.

--HG--
branch : dtrg-buildsystem
rename : modules/src/em_mes/build.mk => modules/src/read_em/build.mk
rename : plat/pc86/build.mk => plat/linux386/build.mk
rename : plat/pc86/build.mk => plat/linux68k/build.mk
rename : plat/pc86/build.mk => plat/linuxppc/build.mk
rename : util/ack/build.mk => util/misc/build.mk
2013-05-12 23:51:55 +01:00
David Given
c1aca7dae5 First milestone of replacing the build system.
--HG--
branch : dtrg-buildsystem
rename : lang/cem/cpp.ansi/Parameters => lang/cem/cpp.ansi/parameters.h
2013-05-12 20:45:55 +01:00
David Given
d89f172841 Change fatal() and error() to use varargs. 2013-05-10 12:04:21 +01:00
David Given
d91a1dc1a6 Merge changes from branch: linux68k platform, linuxppc platform (partially
working), and miscellaneous changes to support these.
2013-05-09 18:14:16 +01:00
David Given
b9b808e01a Apply George Koehler's aelflod fix for generating non-EM_386 binaries.
Adjust platforms to use it. Fix some bugs in the linux386 platform.

--HG--
branch : dtrg-experimental-powerpc
2013-05-09 15:54:23 +01:00
David Given
99d7f513f2 Properly error out if something goes wrong rather than ploughing ahead
anyway.

--HG--
branch : dtrg-experimental-powerpc
2013-05-09 11:20:36 +01:00
David Given
bcfb3d802f Add pmfile for m68020 libend.
--HG--
branch : dtrg-experimental-powerpc
2013-05-09 00:58:35 +01:00
David Given
8e2d027c49 Add pmfile for m68020 libem.
--HG--
branch : dtrg-experimental-powerpc
2013-05-09 00:57:47 +01:00
David Given
8d0261473d Add missing linux68k platform and liblinux support library.
--HG--
branch : dtrg-experimental-powerpc
2013-05-09 00:56:10 +01:00
David Given
c93cb69959 Check in incomplete Linux PowerPC and M68K work.
--HG--
branch : dtrg-experimental-powerpc
2013-05-08 00:48:48 +01:00
George Koehler
c8fdcff960 Some fixes for aelflod and aslod.
Copy rhead() and rsect() from aslod to aelflod, so aelflod can work
for machine with 64-bit long.

In aelflod, fix ELF header so file(1) no longer reports "corrupted
section header size".
2013-04-24 19:57:23 -04:00
David Given
dccecc5d45 Back out erroneous change. 2012-12-14 11:56:21 +00:00
George Koehler
0fc7fd5d33 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
4349d702fa 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
2beb3646a7 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
7ef9b79c11 Merge deletion of many undead files. 2012-09-23 15:31:16 -04:00
George Koehler
3dcc3bd1cf 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
e7c79415b5 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
0131ca4d46 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
be234ea759 *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
8bf34937f1 Delete old and unused files from modules/src/em_code 2012-09-17 16:04:55 -04:00
George Koehler
99eb12a282 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
96ea0a5903 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
800d4ae032 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
6ea172d0d9 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
1072a8797e Added atol() that ignores overflow, so that unsigned long constants are dealt with properly 2011-06-15 11:13:48 +02:00
Ceriel Jacobs
2483e5723d Fixed CFU 2011-06-15 10:56:58 +02:00
cjhjacobs
58613009f8 Fixed bug reported on tack-devel mailing list on 20-3-2011 2011-05-18 19:19:19 +02:00
David Given
b6dfaefeff Removed file that the CVS conversion procedure left in (when it shouldn't have). 2011-03-20 20:47:10 +00:00
cvs2hg
eb0b730607 convert CVS tags 2011-02-11 00:51:45 +00:00
dtrg
45ee287136 Replaced dis and new with modern implementations donated by erik@backerud.se. 2010-10-02 21:52:29 +00:00
dtrg
075cb488a3 Call the correct kill() and getpid() syscalls rather than _kill() and _getpid(). 2010-10-02 21:51:40 +00:00
dtrg
a33473e0a5 Now call creat() and open() instead of _creat() and _open(). 2010-09-27 20:47:32 +00:00
dtrg
7292b538bc Added support for remove() and unlink(). 2010-09-27 20:44:49 +00:00
dtrg
a8ecb11013 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
085f346f8c Fixed definitions of O_* flags. 2010-08-20 19:27:09 +00:00
dtrg
c326f3c6a3 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
a0c67da261 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
293f34fa9b Flush stdout before prompting the user for input. 2010-08-06 17:02:16 +00:00
dtrg
da6111328d Flush output stream before waiting for user input. 2010-08-05 22:23:34 +00:00
cvs2hg
7273130b4c fixup commit for tag 'release-6-0-pre-4' 2010-08-04 18:04:08 +00:00
dtrg
9d2d5606ea Forgot to update version number. 2010-08-04 18:04:07 +00:00
dtrg
5147166810 Updated for 6.0pre4. 2010-08-04 18:01:12 +00:00
dtrg
e537bcc321 Fixed typo. 2010-08-04 17:59:40 +00:00
dtrg
5a872eed38 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
51b41f72f8 Invoke genfiles explicitly with sh --- CVS doesn't store executable bits. 2010-08-01 10:35:33 +00:00
dtrg
ee72886e54 Renamed 'switch' variable to avoid conflict with a keyword in modern awks. 2010-08-01 10:35:04 +00:00
dtrg
2c54f8c742 Renamed getline() to getln() to avoid conflict with glibc's version. 2010-08-01 10:34:27 +00:00
dtrg
481bcd8a8b Added a very-nearly-noop peephole optimiser for Z80. 2008-03-20 23:20:08 +00:00
dtrg
fc44fe2185 Properly handles files ending in a partial line. 2008-03-20 22:50:50 +00:00
dtrg
4dd1ff6d80 Archival checkin (semi-working code). 2007-11-02 18:56:58 +00:00
cvs2hg
58e5e12ead fixup commit for tag 'release-6-0-pre-3' 2007-04-29 23:09:25 +00:00
dtrg
54ce3f451b Configured distr system for the 6.0pre3 release. 2007-04-29 23:09:24 +00:00
dtrg
663f4f2fb5 Cleaned up a bit and made work with the new platform architecture. 2007-04-29 23:03:24 +00:00
dtrg
78777e802b Now using more conservative optimisation due to random seg fault issues. 2007-04-29 23:02:23 +00:00
dtrg
df088c184b 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
868b8c5075 Fixed the ego parameters to actually allow extended optimisation. 2007-04-29 21:25:09 +00:00
dtrg
eb4ea1e761 Use better optimisation options. 2007-04-29 21:24:17 +00:00
dtrg
494d9a3e4a 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
6127ddf024 Fixed the trap code to write out the error message correctly. 2007-04-29 20:47:48 +00:00
dtrg
9d0f0a8fdd 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
c9d7f7ef23 Added suppot for BSS clearing and command line parsing. 2007-04-29 00:28:06 +00:00
dtrg
a7323e1a8b Documented floating-point status. 2007-04-28 22:34:47 +00:00
dtrg
3a4147a37d Added the Mandelbrot generator. 2007-04-28 22:34:05 +00:00
dtrg
be8baf3da6 Added cpm platform. 2007-04-27 22:42:41 +00:00
dtrg
013f58f94e Added the stdint.h header file. 2007-04-27 22:42:02 +00:00
dtrg
0d8578410c Cleaned up and enabled the support for conditionally emitting the floating-point stdio code. 2007-04-27 22:41:39 +00:00
dtrg
7f266d6b4e Removed a completely pointless 128-byte buffer. 2007-04-27 22:41:05 +00:00
dtrg
440d6faadd 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
24ea8aee3d Updated for the 6.0pre2 release. 2007-04-24 20:45:58 +00:00
dtrg
bc5ccee8d5 Removed bashish. 2007-04-24 19:48:41 +00:00
dtrg
bfeb736c35 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
740940c9fc 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
f6085fb234 Updated use of headers to compile cleanly. 2007-04-24 19:33:53 +00:00
dtrg
b8e1348f2a 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
413880c52d 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
ae9ac25f45 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
f471d2e618 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
67c4f3de87 Modified to allow a space between the sign and the first digit of a constant. 2007-04-23 23:24:46 +00:00
dtrg
9b920e59cb Now fetches argc, argv, env correctly from the host OS. 2007-04-23 23:24:03 +00:00
dtrg
9710c14c93 Added the 'Star Trek' example game. 2007-04-21 23:20:11 +00:00
dtrg
921c55968c 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
1c83baa702 Adapted for ANSI C and our pseudo-Posix syscall interface. 2007-04-21 23:18:14 +00:00
dtrg
b66d66b597 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
2a367fa192 Disabled Terminal as it uses hard-coded ioctls and appears to be non-standard anyway. 2007-04-21 23:07:57 +00:00
dtrg
f4e37e1319 Changed to call the isatty() syscall directly, rather than fiddling around with non-portable ioctls. 2007-04-21 23:07:05 +00:00
dtrg
400c475c03 Disabled the K&R C compiler in favour of the ANSI one. 2007-04-21 23:03:35 +00:00
dtrg
b500b1a7b7 Added linux386 platform. 2007-04-21 23:02:11 +00:00
dtrg
201c66879d Updated to work with the new libmon-less setup. 2007-04-21 22:59:42 +00:00
dtrg
04860c08a8 Updated to work with the linux386 platform. 2007-04-21 22:57:51 +00:00
dtrg
daee8da3c4 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
4428647786 Everything is built in ANSI C now. 2007-04-21 22:55:04 +00:00
dtrg
d77b4ce97c Renamed the language libraries and runtimes to have more
conventional names.
2007-02-26 22:36:56 +00:00
726 changed files with 20811 additions and 31825 deletions

45
.distr
View File

@@ -1,8 +1,7 @@
README
CHANGES
Copyright
pm
pmfile
config.pm
Makefile
h
modules/h
@@ -12,7 +11,7 @@ util/data
util/LLgen
modules/src/alloc
modules/src/assert
#modules/src/assert
modules/src/system
modules/src/string
modules/src/read_em
@@ -29,8 +28,8 @@ util/cmisc
util/ack
lib/descr/fe
util/arch
util/cpp
util/cgg
#util/cpp
#util/cgg
util/ncgg
util/misc
util/opt
@@ -41,33 +40,23 @@ util/led
lang/cem
lang/pc
lang/m2
lang/occam
#lang/occam
lang/basic
mach/proto
mach/i80
mach/i86
mach/i386
mach/m68020
mach/vc4
plat
plat/cpm
plat/pc86
plat/linux
plat/linux386
plat/linux68k
plat/rpi
examples
#Action
#NEW
#README
#TODO
#TakeAction
#bin
#doc
#emtest
#etc
#fast
#fcc
#first
#h
#include
#modules
#lang
#lib
#mach
#man
#util
man

9
.hgtags Normal file
View File

@@ -0,0 +1,9 @@
5a0daa6017c4aa5ae23b870e97eb7431021762bc distr2
15b742c4c278c27029eca0e41f16463bc076de6e distr3
a0686e2ca8d6780ce37b8267b865f60e9317a340 llgen-1-0
d96cd06672c368e8aaa584fead379ce1d343acad oct-1
bf69b3579e8545ecfc03f5e2550586e3c479270d release-6-0-pre-4
e880082b57f12a7df1c33a2da2c7424d6368f185 dist2
fe535e3e8bc859d4a4e4a186f42670f9e588a5aa release-5-6
90102c21c4480102634c6a482d0dd55f2d9ca00f release-6-0-pre-3
ddc0de0e5e7d91b1dcd7c05602c9c2a6adf8d312 release-6-0-pre-1

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.

146
Makefile Normal file
View File

@@ -0,0 +1,146 @@
# ======================================================================= #
# 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
# Where do you want to put the object files used when building?
BUILDDIR = $(ACK_TEMP_DIR)/ack-build
# What build flags do you want to use?
CFLAGS = -g
LDFLAGS = -s
# ======================================================================= #
# END OF CONFIGURATION #
# ======================================================================= #
#
# You shouldn't need to change anything below this point unless you are
# actually developing ACK.
OBJDIR = $(BUILDDIR)/obj
BINDIR = $(BUILDDIR)/bin
LIBDIR = $(BUILDDIR)/lib
INCDIR = $(BUILDDIR)/include
INSDIR = $(BUILDDIR)/staging
PLATIND = $(INSDIR)/share/ack
PLATDEP = $(INSDIR)/lib/ack
CC = gcc
AR = ar
RM = rm -f
CP = cp
hide = @
CFLAGS += \
-I$(INCDIR) \
-Imodules/h \
-Ih
LDFLAGS +=
ACKFLAGS = -Ih
all: installables
.DELETE_ON_ERROR:
include first/core.mk
include modules/src/object/build.mk
include modules/src/alloc/build.mk
include modules/src/input/build.mk
include modules/src/idf/build.mk
include modules/src/system/build.mk
include modules/src/string/build.mk
include modules/src/print/build.mk
include modules/src/flt_arith/build.mk
include modules/src/em_code/build.mk
include modules/src/em_mes/build.mk
include modules/src/read_em/build.mk
include util/amisc/build.mk
include util/cmisc/build.mk
include util/ack/build.mk
include util/LLgen/build.mk
include util/data/build.mk
include util/opt/build.mk
include util/ncgg/build.mk
include util/arch/build.mk
include util/misc/build.mk
include util/led/build.mk
include util/topgen/build.mk
include util/ego/build.mk
include lang/cem/build.mk
include lang/basic/build.mk
include lang/pc/build.mk
include lang/m2/build.mk
include mach/proto/as/build.mk
include mach/proto/ncg/build.mk
include mach/proto/top/build.mk
include plat/linux/liblinux/build.mk
include mach/i80/build.mk
include mach/i386/build.mk
include mach/i86/build.mk
include mach/m68020/build.mk
# include mach/powerpc/build.mk
include mach/vc4/build.mk
include plat/build.mk
include plat/pc86/build.mk
include plat/cpm/build.mk
include plat/linux386/build.mk
include plat/linux68k/build.mk
# include plat/linuxppc/build.mk
include plat/rpi/build.mk
.PHONY: installables
installables: $(INSTALLABLES)
@echo ""
@echo "Build completed successfully."
.PHONY: install
install: installables
@echo INSTALLING into $(PREFIX)
$(hide) tar cf - -C $(INSDIR) . | tar xvf - -C $(PREFIX)
.PHONY: clean
clean:
@echo CLEAN
$(hide) $(RM) $(CLEANABLES)
$(INCDIR)/local.h:
@echo LOCAL
@mkdir -p $(dir $@)
$(hide) echo '#define VERSION 3' > $@
$(hide) echo '#define ACKM "$(DEFAULT_PLATFORM)"' >> $@
$(hide) echo '#define BIGMACHINE 1' >> $@
$(hide) echo '#define SYS_5' >> $@
$(INCDIR)/em_path.h:
@echo EM_PATH
@mkdir -p $(dir $@)
$(hide) echo '#define TMP_DIR "$(ACK_TEMP_DIR)"' > $@
$(hide) echo '#define EM_DIR "$(PREFIX)"' >> $@
$(hide) echo '#define ACK_PATH "share/ack/descr"' >> $@
-include $(DEPENDS)

97
README
View File

@@ -1,12 +1,8 @@
# $Source$
# $State$
# $Revision$
THE AMSTERDAM COMPILER KIT V6.0pre1
THE AMSTERDAM COMPILER KIT V6.0pre5
===================================
© 1987-2005 Vrije Universiteit, Amsterdam
2007-02-25
2013-05-15
INTRODUCTION
@@ -17,7 +13,7 @@ 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 upcoming version 6.0 release. Not a
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.
@@ -28,57 +24,63 @@ SUPPORT
Languages:
ANSI C, K&R C, Pascal, Modula 2, Occam 1, and a Basic variant.
ANSI C, Pascal, Modula 2, Basic. 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
linux68k produces ELF executables for m68020 Linux systems
cpm produces i80 CP/M .COM files
rpi produces Raspberry Pi GPU binaries
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.
The version 5.0 build mechanism has been completely rewritten. 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).
- an ANSI C compiler. This defaults to gcc. You can change this by setting
the CC make variable.
- flex and yacc.
- GNU make.
- about 40MB 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.
- edit the Makefile. There's a small section at the top where you can change
the configuration. 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.
make # or gmake
...from the command line. This will do the build.
The make system is fully parallelisable. If you have a multicore system,
you probably want to do:
make -j8 # or gmake -j8
...instead (substituting the right number of cores, of course). You can
also shave a few seconds of the build time by using the -r flag.
- 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:
sudo make install
...from the command line. This will install the ACK in your PREFIX
directory (by default, /usr/local).
./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.
@@ -96,8 +98,9 @@ Some useful options include:
-o <file> specifies the output file
-c produce a .o file
-c.s produce a .s assembly file
-O enable optimisation
-O enable optimisation (optimisation levels go up to 6)
-ansi compile ANSI C (when using the C compiler)
-v be more verbose (repeatable)
<file> build file
ack figures out which language to use from the file extension:
@@ -109,11 +112,16 @@ ack figures out which language to use from the file extension:
.p Pascal
.o object files
.s assembly files
.e ACK intermediate code 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
@@ -121,16 +129,11 @@ GOTCHAS
There are some things you should be aware of.
- The only platform supported so far is pc86, which generates 8086 tiny mode
executables that will work as floppy disk boot images. So, to run, simply dd
the output file (pc86.img by default) onto a floppy disk and boot from it.
Be aware that very little functionality is supported and that the entire
program, heap and stack and code and all, must fit within 64kB. See
plat/pc86/README for more information.
- Look at plat/<PLATFORMNAME>/README for information about the supported
platforms.
- By default, the ack tool will compile K&R C. Practically all C source these
days is ANSI C --- use the -ansi switch to enable ANSI mode. No, the ACK is
not C99 compatible.
- 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
@@ -167,4 +170,4 @@ Please enjoy.
David Given (dtrg on Sourceforge)
dg@cowlark.com
2007-02-25
2013-05-13

View File

@@ -13,7 +13,7 @@ ACK_TEMP_DIR = "/tmp"
-- Where is the ACK going to be installed, eventually?
PREFIX = "/usr/local"
PREFIX = "/tmp/ack-temp/staging"
-- ======================================================================= --
-- BROKEN ACK CONFIGURATION --
@@ -21,7 +21,7 @@ PREFIX = "/usr/local"
-- ======================================================================= --
-- FIXME: the following two variables must be set to their Minix variants
-- due to hard-coded references in the descr files. Don't c
-- 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.

View File

@@ -61,7 +61,7 @@ while [ "$1" != "" ]; do
shift
done
if [ "$destdir" == "" ]; then
if [ "$destdir" = "" ]; then
echo "You must specify a destination directory. (Try --help for help.)"
exit 1
fi
@@ -131,7 +131,7 @@ if !(strings $arch | grep archiver > /dev/null); then
echo "architecture.)"
echo ""
echo "Press RETURN to go ahead anyway, or CTRL+C to abort."
read
read ignored
fi
# Actually do the work.
@@ -141,9 +141,9 @@ echo " into destination tree: $destdir"
echo ""
if [ -e $destdir ]; then
if [ "$delete" == "yes" ]; then
if [ "$delete" = "yes" ]; then
echo "Press RETURN to erase $destdir and its contents, or CTRL+C to abort."
read
read _ _
echo "Erasing..."
rm -rf "$destdir"
else
@@ -159,7 +159,10 @@ echo "Done."
# Revision history
# $Log$
# Revision 1.4 2007-02-25 20:56:41 dtrg
# 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

View File

@@ -3,5 +3,8 @@ hilo.c
hilo.mod
hilo.ocm
hilo.p
mandelbrot.c
paranoia.c
startrek.c
startrek.doc
README

View File

@@ -6,7 +6,7 @@ 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 convention source of test code
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:
@@ -17,10 +17,17 @@ 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

View File

@@ -2,7 +2,7 @@
2 ' $State$
3 ' $Revision$
10 print "Hi there! Before we start, what is your name?"
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$; "!"

View File

@@ -59,7 +59,7 @@ void game(void)
int main(int argc, char* argv[])
{
printf("\nHi there! Before we start, what is your name?\n");
printf("\nHi there! I'm written in C. Before we start, what is your name?\n");
reads();
strcpy(PlayerName, buffer);
printf("\nHello, %s! ", PlayerName);

View File

@@ -6,13 +6,22 @@
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;
@@ -31,8 +40,8 @@ BEGIN
finished := FALSE;
WHILE NOT finished DO
WriteLn;
WriteString("> ");
flush;
ReadInt(guess);
IF guess = Number THEN
@@ -66,7 +75,7 @@ VAR
finished : BOOLEAN;
BEGIN
WriteLn;
WriteString("Hi there! Before we start, what is your name?");
WriteString("Hi there! I'm written in Modula-2. Before we start, what is your name?");
WriteLn;
reads;
WriteLn;

View File

@@ -56,7 +56,7 @@ proc random(value range, var result) =
proc getname =
var seed, buffer[128]:
seq
puts("*nHi there! Before we start, what is your name?*n")
puts("*nHi there! I'm written in Occam. Before we start, what is your name?*n")
puts("> ")
gets(buffer)

View File

@@ -29,10 +29,12 @@ function random(range : integer) : integer;
random := seed mod range;
end;
{ Pascal doesn't provide string input, so we interface to the _read() syscall
and do it manually. }
{ 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 _read(fd : integer; var buffer : char; count : integer) : integer;
function uread(fd : integer; var buffer : char; count : integer) : integer;
extern;
function readchar : char;
@@ -42,7 +44,7 @@ function readchar : char;
begin
c := chr(0);
dummy := _read(0, c, 1);
dummy := uread(0, c, 1);
readchar := c;
end;
@@ -79,7 +81,7 @@ procedure getname;
begin
writeln;
writeln('Hi there! Before we start, what is your name?');
writeln('Hi there! I''m written in Pascal. Before we start, what is your name?');
writeln;
readstring(name, namelen);
writeln;

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;
}

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

@@ -1,9 +1,4 @@
ack.pm
ack-custom.pm
c.pm
llgen.pm
yacc.pm
core.mk
#create_dir
#cp_dir
#em_path.h.src

199
first/core.mk Normal file
View File

@@ -0,0 +1,199 @@
define reset
$(eval q :=)
$(eval o :=)
$(eval s :=)
$(eval cflags :=)
$(eval ackflags :=)
$(eval ldflags :=)
$(eval objdir :=)
endef
# --- Host compiler
define cfile-rule
$o: $s
@echo CC $o
@mkdir -p $(dir $o)
@$(CC) $(CFLAGS) $(cflags) -MM -MQ $o -o $d $s
$(hide) $(CC) $(CFLAGS) $(cflags) -c -o $o $s
endef
define cfile
$(eval s := $1)
$(eval o := $(OBJDIR)/$(objdir)/$(1:.c=.o))
$(eval d := $(OBJDIR)/$(objdir)/$(1:.c=.d))
$(eval DEPENDS += $d)
$(eval CLEANABLES += $o $d)
$(eval q += $o)
$(eval $(cfile-rule))
endef
# --- ACK compiler
define ackfile-rule
$o: $s $(ACK) \
$(CCOMPILER) \
$(PLATFORM_$(PLATFORM)) \
$(ACK_CORE_TOOLS)
@echo ACK $o
@mkdir -p $(dir $o)
$(hide) ACKDIR=$(INSDIR) $(ACK) $(ACKFLAGS) $(ackflags) -m$(PLATFORM) -c -o $o $s
endef
define ackfile
$(eval s := $1)
$(eval o := $(OBJDIR)/$(objdir)/$(basename $1).o)
$(eval d := $(OBJDIR)/$(objdir)/$(basename $1).d)
$(eval DEPENDS += $d)
$(eval CLEANABLES += $o $d)
$(eval q += $o)
$(eval $(ackfile-rule))
endef
# --- Add a raw to the queue
define file
$(eval q += $1)
endef
# --- Host compiler linking
define cprogram-rule
$o: $s
@echo CPROGRAM $o
@mkdir -p $(dir $o)
$(hide) $(CC) $(CFLAGS) $(cflags) $(LDFLAGS) $(ldflags) -o $o $s
endef
define cprogram
$(eval o := $1)
$(eval s := $q)
$(eval CLEANABLES += $o)
$(eval q := $o)
$(eval $(cprogram-rule))
endef
# --- Host library linking
define clibrary-rule
$o: $s
@echo CLIBRARY $o
@mkdir -p $(dir $o)
@$(RM) $o
$(hide) $(AR) qsc $o $s
endef
define clibrary
$(eval o := $1)
$(eval s := $q)
$(eval CLEANABLES += $o)
$(eval q := $o)
$(eval $(clibrary-rule))
endef
# --- ACK library linking
define acklibrary-rule
$o: $s $(AAL)
@echo ACKLIBRARY $o
@mkdir -p $(dir $o)
@$(RM) $o
$(hide) $(AAL) q $o $s
endef
define acklibrary
$(eval o := $1)
$(eval s := $q)
$(eval CLEANABLES += $o)
$(eval q := $o)
$(eval $(acklibrary-rule))
endef
# --- Copies a file.
define copyto-rule
$o: $s
@echo CP $o
@mkdir -p $(dir $o)
$(hide) $(CP) $s $o
endef
define copyto
$(eval o := $1)
$(eval s := $q)
$(eval CLEANABLES += $o)
$(eval q := $o)
$(eval $(copyto-rule))
endef
# --- Installs a file (copies it and adds it to INSTALLABLES).
define installto-rule
$o: $s
@echo INSTALL $o
@mkdir -p $(dir $o)
$(hide) $(CP) $s $o
endef
define installto
$(eval o := $1)
$(eval s := $q)
$(eval CLEANABLES += $o)
$(eval INSTALLABLES += $o)
$(eval q := $o)
$(eval $(installto-rule))
endef
# --- Adds a dependency for the last object file
define dependson
$(eval $o: $1)
endef
# --- Runs yacc.
# $1: directory to put output files
# $2: input files
#
# Output files are compiled via cfile and queued.
define yacc-impl
$(eval o := $1/y.tab.c)
$(eval CLEANABLES += $o $1/y.tab.h)
$o: $2
@echo YACC $o
@mkdir -p $(dir $o)
$(hide) yacc -t -b $1/y -d $2
$(call cfile, $o)
$1/y.tab.h: $o
endef
yacc = $(eval $(call yacc-impl,$1,$2))
# --- Runs flex.
# $1: directory to put output files
# $2: input files
#
# Output files are compiled via cfile and queued.
define flex-impl
$(eval o := $1/lex.yy.c)
$(eval CLEANABLES += $o)
$o: $2
@echo FLEX $o
@mkdir -p $(dir $o)
$(hide) flex -s -t $2 > $o
$(call cfile, $o)
endef
flex = $(eval $(call flex-impl,$1,$2))

View File

@@ -6,6 +6,12 @@
#define LINO_AD 0
#define FILN_AD 4
/* ERANGE conflicts with a symbol in the ANSI C library. */
#ifdef ERANGE
#undef ERANGE
#endif
#define LINO (*(int *)(_hol0()+LINO_AD))
#define FILN (*(char **)(_hol0()+FILN_AD))

14
h/out.h
View File

@@ -61,7 +61,11 @@ struct outname {
#define RELSZ 0x07 /* relocation length */
#define RELO1 1 /* 1 byte */
#define RELO2 2 /* 2 bytes */
#define RELO4 4 /* 4 bytes */
#define RELO4 3 /* 4 bytes */
#define RELOPPC 4 /* PowerPC 26-bit address */
#define RELOH2 5 /* write top 2 bytes of 4 byte word */
#define RELOVC4 6 /* VideoCore IV address in 32-bit instruction */
#define RELPC 0x08 /* pc relative */
#define RELBR 0x10 /* High order byte lowest address. */
#define RELWR 0x20 /* High order word lowest address. */
@@ -97,13 +101,19 @@ struct outname {
/*
* structure format strings
*/
#if 0
/* The following strings only make sense on 32-bit platforms, so we're going
* to try and deprecate them. */
#define SF_HEAD "22222244"
#define SF_SECT "44444"
#define SF_RELO "1124"
#define SF_NAME "4224"
#endif
/*
* structure sizes (bytes in file; add digits in SF_*)
* structure sizes on disk (bytes in file; add digits in SF_*)
* Note! These are NOT the sizes in memory (64-bit architectures will have
* a different layout).
*/
#define SZ_HEAD 20
#define SZ_SECT 20

View File

@@ -3,6 +3,13 @@
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* EBADF conflicts with the ANSI C definition. */
#ifdef EBADF
#undef EBADF
#endif
#define EARGC 64
#define EEXP 65
#define ELOG 66

View File

@@ -1,79 +0,0 @@
/* $Id$ */
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/*
* Basic system types and major/minor device constructing/busting macros.
*/
#if !defined(_SYS_TYPES_H)
#define _SYS_TYPES_H
#ifdef __STDC__
#if !defined(_SIZE_T)
#define _SIZE_T
typedef unsigned int size_t; /* type returned by sizeof */
#endif /* _SIZE_T */
#if !defined(_TIME_T)
#define _TIME_T
typedef unsigned long time_t;
#endif /* TIME_T */
#endif
#if !defined(_POSIX_SOURCE)
/* major part of a device */
#define major(x) ((int)(((unsigned)(x)>>8)&0377))
/* minor part of a device */
#define minor(x) ((int)((x)&0377))
/* make a device number */
#define makedev(x,y) ((dev_t)(((x)<<8) | (y)))
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef struct _physadr { int r[1]; } *physadr;
typedef long daddr_t;
typedef char * caddr_t;
#if defined(__BSD4_2)
typedef u_long ino_t;
#else
typedef u_short ino_t;
#endif
typedef long swblk_t;
#include <sys/stdtypes.h>
typedef long label_t[14];
typedef short dev_t;
typedef long off_t;
/* system V compatibility: */
typedef unsigned int uint;
typedef unsigned short ushort;
typedef unsigned char uchar_t;
typedef short cnt_t;
typedef long paddr_t;
typedef long key_t;
#else /* _POSIX_SOURCE */
#if defined(_MINIX)
typedef unsigned short dev_t; /* hold (major|minor) device pair */
typedef unsigned char gid_t; /* group id */
typedef unsigned short ino_t; /* i-node number */
typedef unsigned short mode_t; /* mode number within an i-node */
typedef unsigned char nlink_t; /* number-of-links field within an i-node */
typedef long off_t; /* offsets within a file */
typedef int pid_t; /* type for pids (must be signed) */
typedef unsigned short uid_t; /* user id */
#endif /* _MINIX */
#endif /* _POSIX_SOURCE */
#endif /* _SYS_TYPES_H */

View File

@@ -1,79 +0,0 @@
/* $Id$ */
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/*
* Basic system types and major/minor device constructing/busting macros.
*/
#if !defined(_SYS_TYPES_H)
#define _SYS_TYPES_H
#ifdef __STDC__
#if !defined(_SIZE_T)
#define _SIZE_T
typedef unsigned int size_t; /* type returned by sizeof */
#endif /* _SIZE_T */
#if !defined(_TIME_T)
#define _TIME_T
typedef unsigned long time_t;
#endif /* TIME_T */
#endif
#if !defined(_POSIX_SOURCE)
/* major part of a device */
#define major(x) ((int)(((unsigned)(x)>>8)&0377))
/* minor part of a device */
#define minor(x) ((int)((x)&0377))
/* make a device number */
#define makedev(x,y) ((dev_t)(((x)<<8) | (y)))
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef struct _physadr { int r[1]; } *physadr;
typedef long daddr_t;
typedef char * caddr_t;
#if defined(__BSD4_2)
typedef u_long ino_t;
#else
typedef u_short ino_t;
#endif
typedef long swblk_t;
#include <sys/stdtypes.h>
typedef long label_t[14];
typedef short dev_t;
typedef long off_t;
/* system V compatibility: */
typedef unsigned int uint;
typedef unsigned short ushort;
typedef unsigned char uchar_t;
typedef short cnt_t;
typedef long paddr_t;
typedef long key_t;
#else /* _POSIX_SOURCE */
#if defined(_MINIX)
typedef unsigned short dev_t; /* hold (major|minor) device pair */
typedef unsigned char gid_t; /* group id */
typedef unsigned short ino_t; /* i-node number */
typedef unsigned short mode_t; /* mode number within an i-node */
typedef unsigned char nlink_t; /* number-of-links field within an i-node */
typedef long off_t; /* offsets within a file */
typedef int pid_t; /* type for pids (must be signed) */
typedef unsigned short uid_t; /* user id */
#endif /* _MINIX */
#endif /* _POSIX_SOURCE */
#endif /* _SYS_TYPES_H */

View File

@@ -1,3 +1,3 @@
pmfile
build.mk
src
lib

3
lang/basic/build.mk Normal file
View File

@@ -0,0 +1,3 @@
include lang/basic/lib/build.mk
include lang/basic/src/build.mk

View File

@@ -1,4 +1,4 @@
pmfile
build.mk
abs.c
asc.c
asrt.c

View File

@@ -7,62 +7,7 @@
/* $Id$ */
#define __NO_DEFS
#include <math.h>
double
_atn(x)
double x;
{
/* Algorithm and coefficients from:
"Software manual for the elementary functions"
by W.J. Cody and W. Waite, Prentice-Hall, 1980
*/
double _atn(double x) { return atan(x); }
static double p[] = {
-0.13688768894191926929e+2,
-0.20505855195861651981e+2,
-0.84946240351320683534e+1,
-0.83758299368150059274e+0
};
static double q[] = {
0.41066306682575781263e+2,
0.86157349597130242515e+2,
0.59578436142597344465e+2,
0.15024001160028576121e+2,
1.0
};
static double a[] = {
0.0,
0.52359877559829887307710723554658381, /* pi/6 */
M_PI_2,
1.04719755119659774615421446109316763 /* pi/3 */
};
int neg = x < 0;
int n;
double g;
if (neg) {
x = -x;
}
if (x > 1.0) {
x = 1.0/x;
n = 2;
}
else n = 0;
if (x > 0.26794919243112270647) { /* 2-sqtr(3) */
n = n + 1;
x = (((0.73205080756887729353*x-0.5)-0.5)+x)/
(1.73205080756887729353+x);
}
/* ??? avoid underflow ??? */
g = x * x;
x += x * g * POLYNOM3(g, p) / POLYNOM4(g, q);
if (n > 1) x = -x;
x += a[n];
return neg ? -x : x;
}

48
lang/basic/lib/build.mk Normal file
View File

@@ -0,0 +1,48 @@
define build-runtime-libbasic-impl
$(call reset)
$(eval objdir := $(PLATFORM))
$(call ackfile, lang/basic/lib/fif.e)
$(call ackfile, lang/basic/lib/fef.e)
$(call ackfile, lang/basic/lib/setline.e)
$(call ackfile, lang/basic/lib/abs.c)
$(call ackfile, lang/basic/lib/asc.c)
$(call ackfile, lang/basic/lib/asrt.c)
$(call ackfile, lang/basic/lib/atn.c)
$(call ackfile, lang/basic/lib/chr.c)
$(call ackfile, lang/basic/lib/conversion.c)
$(call ackfile, lang/basic/lib/error.c)
$(call ackfile, lang/basic/lib/exp.c)
$(call ackfile, lang/basic/lib/file.c)
$(call ackfile, lang/basic/lib/hlt.c)
$(call ackfile, lang/basic/lib/io.c)
$(call ackfile, lang/basic/lib/log.c)
$(call ackfile, lang/basic/lib/mki.c)
$(call ackfile, lang/basic/lib/oct.c)
$(call ackfile, lang/basic/lib/peek.c)
$(call ackfile, lang/basic/lib/power.c)
$(call ackfile, lang/basic/lib/print.c)
$(call ackfile, lang/basic/lib/random.c)
$(call ackfile, lang/basic/lib/read.c)
$(call ackfile, lang/basic/lib/return.c)
$(call ackfile, lang/basic/lib/salloc.c)
$(call ackfile, lang/basic/lib/sgn.c)
$(call ackfile, lang/basic/lib/sin.c)
$(call ackfile, lang/basic/lib/sqt.c)
$(call ackfile, lang/basic/lib/stop.c)
$(call ackfile, lang/basic/lib/string.c)
$(call ackfile, lang/basic/lib/swap.c)
$(call ackfile, lang/basic/lib/trace.c)
$(call ackfile, lang/basic/lib/trap.c)
$(call ackfile, lang/basic/lib/write.c)
$(call acklibrary, $(LIBDIR)/$(PLATFORM)/libbasic.a)
$(call installto, $(PLATIND)/$(PLATFORM)/libbasic.a)
endef
build-runtime-libbasic = $(eval $(build-runtime-libbasic-impl))
$(eval RUNTIMES += libbasic)

View File

@@ -1,4 +1,5 @@
/* $Id$ */
#include <stdlib.h>
#include <stdio.h>
/* error takes an error value in the range of 0-255 */
/* and generates a trap */

View File

@@ -10,88 +10,7 @@
#define __NO_DEFS
#include <math.h>
static double
ldexp(fl,exp)
double fl;
int exp;
double _exp(double x)
{
extern double _fef();
int sign = 1;
int currexp;
if (fl<0) {
fl = -fl;
sign = -1;
}
fl = _fef(fl,&currexp);
exp += currexp;
if (exp > 0) {
while (exp>30) {
fl *= (double) (1L << 30);
exp -= 30;
}
fl *= (double) (1L << exp);
}
else {
while (exp<-30) {
fl /= (double) (1L << 30);
exp += 30;
}
fl /= (double) (1L << -exp);
}
return sign * fl;
}
double
_exp(x)
double x;
{
/* Algorithm and coefficients from:
"Software manual for the elementary functions"
by W.J. Cody and W. Waite, Prentice-Hall, 1980
*/
static double p[] = {
0.25000000000000000000e+0,
0.75753180159422776666e-2,
0.31555192765684646356e-4
};
static double q[] = {
0.50000000000000000000e+0,
0.56817302698551221787e-1,
0.63121894374398503557e-3,
0.75104028399870046114e-6
};
double xn, g;
int n;
int negative = x < 0;
if (x <= M_LN_MIN_D) {
return M_MIN_D;
}
if (x >= M_LN_MAX_D) {
if (x > M_LN_MAX_D) error(3);
return M_MAX_D;
}
if (negative) x = -x;
/* ??? avoid underflow ??? */
n = x * M_LOG2E + 0.5; /* 1/ln(2) = log2(e), 0.5 added for rounding */
xn = n;
{
double x1 = (long) x;
double x2 = x - x1;
g = ((x1-xn*0.693359375)+x2) - xn*(-2.1219444005469058277e-4);
}
if (negative) {
g = -g;
n = -n;
}
xn = g * g;
x = g * POLYNOM2(xn, p);
n += 1;
return (ldexp(0.5 + x/(POLYNOM3(xn, q) - x), n));
return exp(x);
}

View File

@@ -1,4 +1,4 @@
/* $Id$ */
#include <stdlib.h>
_hlt(nr)
int nr;

View File

@@ -1,9 +1,8 @@
#include "bc_io.h"
#include <sgtty.h>
/* $Id$ */
struct sgttyb _ttydef;
/* dtrg --- this originally used sgtty.h to do clever tty manipulation.
* Strictly this should be converted to use termios, but for simplicity
* we're going to stick with plain stdio for now. */
/* BASIC has some nasty io characteristics */
@@ -65,9 +64,6 @@ char *buf;
if( _chann == -1)
{
pos= _pos;
gtty(0,_ttydef);
_ttydef.sg_flags &= ~ECHO;
stty(0,_ttydef);
}else pos= _fdtable[_chann].pos;
c= buf;
while( (holder = fgetc(_chanrd)) != EOF && holder != '\n'){
@@ -79,8 +75,6 @@ char *buf;
if( _chann== -1)
{
_pos=pos;
_ttydef.sg_flags |= ECHO;
stty(0,_ttydef);
} else _fdtable[_chann].pos= pos;
}
_tab(x)

View File

@@ -10,48 +10,7 @@
#define __NO_DEFS
#include <math.h>
double
_log(x)
double x;
double _log(double x)
{
/* Algorithm and coefficients from:
"Software manual for the elementary functions"
by W.J. Cody and W. Waite, Prentice-Hall, 1980
*/
static double a[] = {
-0.64124943423745581147e2,
0.16383943563021534222e2,
-0.78956112887491257267e0
};
static double b[] = {
-0.76949932108494879777e3,
0.31203222091924532844e3,
-0.35667977739034646171e2,
1.0
};
extern double _fef();
double znum, zden, z, w;
int exponent;
if (x <= 0) {
error(3);
return -HUGE;
}
x = _fef(x, &exponent);
if (x > M_1_SQRT2) {
znum = (x - 0.5) - 0.5;
zden = x * 0.5 + 0.5;
}
else {
znum = x - 0.5;
zden = znum * 0.5 + 0.5;
exponent--;
}
z = znum/zden; w = z * z;
x = z + z * w * (POLYNOM2(w,a)/POLYNOM3(w,b));
z = exponent;
x += z * (-2.121944400546905827679e-4);
return x + z * 0.693359375;
return log(x);
}

View File

@@ -1,3 +1,5 @@
#include <stdlib.h>
#include <stdio.h>
#include "bc_string.h"
/* $Id$ */

View File

@@ -41,5 +41,5 @@ lang_basic_runtime = acklibrary {
ackfile (d.."trap.c"),
ackfile (d.."write.c"),
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/tail_bc")
install = pm.install("%BINDIR%%PLATIND%/%PLATFORM%/libbasic.a")
}

View File

@@ -1,32 +1,4 @@
/* $Id$ */
#include <math.h>
/*
computes a^b.
uses log and exp
*/
double _power(double x, double y) { return pow(x, y); }
double _log(), _exp();
double
_power(base,pownr)
double pownr, base;
{
double temp;
long l;
if(pownr <= 0.0) {
if(pownr == 0.0) {
if(base <= 0.0)
error(3);
return(0.0);
}
l = base;
if(l != base)
error(3);
temp = _exp(base * _log(-pownr));
if(l & 1)
temp = -temp;
return(temp);
}
return(_exp(base * _log(pownr)));
}

View File

@@ -1,3 +1,5 @@
#include <stdlib.h>
#include <stdio.h>
#include "bc_string.h"
#include "bc_io.h"

View File

@@ -1,4 +1,5 @@
/* $Id$ */
#include <stdlib.h>
#include <stdio.h>
#if !defined(EM_WSIZE)
#define EM_WSIZE _EM_WSIZE

View File

@@ -1,6 +1,4 @@
/* $Id$ */
extern char *malloc() ;
#include <stdlib.h>
char * salloc(length)
unsigned length;

View File

@@ -10,96 +10,7 @@
#define __NO_DEFS
#include <math.h>
static double
sinus(x, cos_flag)
double x;
{
/* Algorithm and coefficients from:
"Software manual for the elementary functions"
by W.J. Cody and W. Waite, Prentice-Hall, 1980
*/
double _sin(double x) { return sin(x); }
double _cos(double x) { return cos(x); }
double _tan(double x) { return tan(x); }
static double r[] = {
-0.16666666666666665052e+0,
0.83333333333331650314e-2,
-0.19841269841201840457e-3,
0.27557319210152756119e-5,
-0.25052106798274584544e-7,
0.16058936490371589114e-9,
-0.76429178068910467734e-12,
0.27204790957888846175e-14
};
double xsqr;
double y;
int neg = 0;
if (x < 0) {
x = -x;
neg = 1;
}
if (cos_flag) {
neg = 0;
y = M_PI_2 + x;
}
else y = x;
/* ??? avoid loss of significance, if y is too large, error ??? */
y = y * M_1_PI + 0.5;
/* Use extended precision to calculate reduced argument.
Here we used 12 bits of the mantissa for a1.
Also split x in integer part x1 and fraction part x2.
*/
#define A1 3.1416015625
#define A2 -8.908910206761537356617e-6
{
double x1, x2;
extern double _fif();
_fif(y, 1.0, &y);
if (_fif(y, 0.5, &x1)) neg = !neg;
if (cos_flag) y -= 0.5;
x2 = _fif(x, 1.0, &x1);
x = x1 - y * A1;
x += x2;
x -= y * A2;
#undef A1
#undef A2
}
if (x < 0) {
neg = !neg;
x = -x;
}
/* ??? avoid underflow ??? */
y = x * x;
x += x * y * POLYNOM7(y, r);
return neg ? -x : x;
}
double
_sin(x)
double x;
{
return sinus(x, 0);
}
double
_cos(x)
double x;
{
if (x < 0) x = -x;
return sinus(x, 1);
}
/* EXTENSION */
double
_tan(x)
double x;
{
return _sin(x)/_cos(x);
}

View File

@@ -10,62 +10,5 @@
#define __NO_DEFS
#include <math.h>
#define NITER 5
double _sqt(double x) { return sqrt(x); }
static double
ldexp(fl,exp)
double fl;
int exp;
{
extern double _fef();
int sign = 1;
int currexp;
if (fl<0) {
fl = -fl;
sign = -1;
}
fl = _fef(fl,&currexp);
exp += currexp;
if (exp > 0) {
while (exp>30) {
fl *= (double) (1L << 30);
exp -= 30;
}
fl *= (double) (1L << exp);
}
else {
while (exp<-30) {
fl /= (double) (1L << 30);
exp += 30;
}
fl /= (double) (1L << -exp);
}
return sign * fl;
}
double
_sqt(x)
double x;
{
extern double _fef();
int exponent;
double val;
if (x <= 0) {
if (x < 0) error(3);
return 0;
}
val = _fef(x, &exponent);
if (exponent & 1) {
exponent--;
val *= 2;
}
val = ldexp(val + 1.0, exponent/2 - 1);
/* was: val = (val + 1.0)/2.0; val = ldexp(val, exponent/2); */
for (exponent = NITER - 1; exponent >= 0; exponent--) {
val = (val + x / val) / 2.0;
}
return val;
}

View File

@@ -1,4 +1,5 @@
/* $Id$ */
#include <stdlib.h>
#include <stdio.h>
_stop()
{

View File

@@ -1,3 +1,5 @@
#include <stdlib.h>
#include <string.h>
#include "bc_string.h"
/* $Id$ */

View File

@@ -1,3 +1,5 @@
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <setjmp.h>

View File

@@ -1,4 +1,4 @@
pmfile
build.mk
basic.g
basic.lex
bem.c

View File

@@ -237,7 +237,7 @@ File *stream;
extern char *strchr();
getline()
getinputline()
{
/* get next input line */

44
lang/basic/src/build.mk Normal file
View File

@@ -0,0 +1,44 @@
D := lang/basic/src
define build-bem-impl
$(call reset)
$(eval cflags += -I$(OBJDIR)/$D -I$D)
$(call cfile, $D/bem.c)
$(call cfile, $D/symbols.c)
$(call cfile, $D/initialize.c)
$(call cfile, $D/compile.c)
$(call cfile, $D/parsepar.c)
$(call cfile, $D/gencode.c)
$(call cfile, $D/util.c)
$(call cfile, $D/graph.c)
$(call cfile, $D/eval.c)
$(call cfile, $D/func.c)
$(call llgen, $(OBJDIR)/$D, $D/basic.g)
$(eval g := $(OBJDIR)/$D/tokentab.h)
$(eval $q: $g)
$(eval CLEANABLES += $g)
$g: $D/maketokentab $(OBJDIR)/$D/Lpars.h
@echo TOKENTAB $$@
@mkdir -p $$(dir $$@)
$(hide) cd $(OBJDIR)/$D && $(abspath $$^)
$(eval $q: $(OBJDIR)/$D/Lpars.h)
$(eval $q: $(INCDIR)/print.h)
$(call file, $(LIBEM_MES))
$(call file, $(LIBEMK))
$(call file, $(LIBEM_DATA))
$(call file, $(LIBALLOC))
$(call file, $(LIBPRINT))
$(call file, $(LIBSTRING))
$(call file, $(LIBSYSTEM))
$(call cprogram, $(BINDIR)/em_bem)
$(call installto, $(PLATDEP)/em_bem)
endef
$(eval $(build-bem-impl))

View File

@@ -23,7 +23,7 @@ compileprogram()
prolog2(); /* Some statements are moved from prolog2 to
epilogcode in the new version of the compiler */
while( basicline = 0, getline())
while( basicline = 0, getinputline())
(void) LLparse();
epilogcode();
sys_close(yyin);

View File

@@ -644,7 +644,7 @@ prolog2()
C_loi((arith) BEMPTRSIZE);
C_exa_dnam("trpbuf");
C_lae_dnam("trpbuf",(arith)0);
C_cal("setjmp");
C_cal("__setjmp");
C_df_ilb(l);
C_asp((arith)(BEMPTRSIZE+BEMPTRSIZE));
C_lfr((arith)BEMINTSIZE);

View File

@@ -1,6 +1,6 @@
pmfile
build.mk
cemcom.ansi
cpp.ansi
libcc.ansi
cemcom
libcc
#cemcom
#libcc

6
lang/cem/build.mk Normal file
View File

@@ -0,0 +1,6 @@
include lang/cem/cpp.ansi/build.mk
include lang/cem/cemcom.ansi/build.mk
include lang/cem/libcc.ansi/build.mk
$(eval CCOMPILER := $(CPPANSI) $(CEMCOMANSI) $(LIBCCANSIHEADERS))

View File

@@ -1,4 +1,4 @@
pmfile
build.mk
LLlex.c
LLlex.h
LLmessage.c

View File

@@ -5,13 +5,8 @@
/* $Id$ */
/* L E X I C A L A N A L Y Z E R */
#include "debug.h"
#include "lint.h"
#include <alloc.h>
#include "idfsize.h"
#include "numsize.h"
#include "strsize.h"
#include "nopp.h"
#include "parameters.h"
#include "input.h"
#include "arith.h"
#include "def.h"

View File

@@ -11,7 +11,6 @@
*/
#include "file_info.h"
#include "nopp.h"
/* the structure of a token: */
struct token {

View File

@@ -5,8 +5,7 @@
/* $Id$ */
/* A L I G N M E N T D E F I N I T I O N S */
#include "nocross.h"
#include "trgt_sizes.h"
#include "parameters.h"
#ifndef NOCROSS
extern int

View File

@@ -11,11 +11,8 @@
semantics of C is a mess.
*/
#include "parameters.h"
#include <alloc.h>
#include "debug.h"
#include "lint.h"
#include "nobitfield.h"
#include "idf.h"
#include <flt_arith.h>
#include "arith.h"
#include "sizes.h"

View File

@@ -13,7 +13,7 @@
be handy.
*/
#include "spec_arith.h"
#include "parameters.h"
#ifndef SPECIAL_ARITHMETICS

View File

@@ -1,5 +1,6 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
@@ -10,7 +11,8 @@
there is no reasonable method to prove that a program is 100%
correct, these assertions are needed in some places.
*/
#include "debug.h" /* UF */
#include "parameters.h"
#ifdef DEBUG
/* Note: this macro uses parameter substitution inside strings */

View File

@@ -5,7 +5,7 @@
/* $Id$ */
/* B L O C K S T O R I N G A N D L O A D I N G */
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>

View File

@@ -0,0 +1,156 @@
D := lang/cem/cemcom.ansi
define build-cemcom-ansi-allocd-header
$(eval g := $(OBJDIR)/$D/$(strip $1).h)
$g: $D/$(strip $1).str $D/make.allocd
@echo ALLOCD $$@
@mkdir -p $$(dir $$@)
$(hide) $D/make.allocd < $$^ > $$@
$(eval CLEANABLES += $g)
$(eval $q: $g)
endef
define build-cemcom-ansi-next
$(eval CLEANABLES += $(OBJDIR)/$D/next.c)
$(OBJDIR)/$D/next.c: $D/make.next $1
@echo NEXT $$@
@mkdir -p $$(dir $$@)
$(hide) $$^ > $$@
$(call cfile, $(OBJDIR)/$D/next.c)
$(foreach f, $1, $(call build-cemcom-ansi-allocd-header, \
$(basename $(notdir $f))))
endef
define build-cemcom-ansi-impl
$(call reset)
$(eval cflags += -I$(OBJDIR)/$D -I$D)
$(call cfile, $D/arith.c)
$(call dependson, $(INCDIR)/flt_arith.h)
$(call cfile, $D/blocks.c)
$(call dependson, $(INCDIR)/em_codeEK.h)
$(call cfile, $D/LLlex.c)
$(call cfile, $D/LLmessage.c)
$(call cfile, $D/ch3.c)
$(call cfile, $D/ch3bin.c)
$(call cfile, $D/ch3mon.c)
$(call cfile, $D/code.c)
$(call cfile, $D/conversion.c)
$(call cfile, $D/cstoper.c)
$(call cfile, $D/dataflow.c)
$(call cfile, $D/declarator.c)
$(call cfile, $D/decspecs.c)
$(call cfile, $D/domacro.c)
$(call cfile, $D/dumpidf.c)
$(call cfile, $D/error.c)
$(call cfile, $D/eval.c)
$(call cfile, $D/expr.c)
$(call cfile, $D/field.c)
$(call cfile, $D/fltcstoper.c)
$(call cfile, $D/idf.c)
$(call cfile, $D/init.c)
$(call cfile, $D/input.c)
$(call cfile, $D/l_comment.c)
$(call cfile, $D/l_ev_ord.c)
$(call cfile, $D/l_lint.c)
$(call cfile, $D/l_misc.c)
$(call cfile, $D/l_outdef.c)
$(call cfile, $D/l_states.c)
$(call cfile, $D/label.c)
$(call cfile, $D/main.c)
$(call cfile, $D/options.c)
$(call cfile, $D/pragma.c)
$(call cfile, $D/proto.c)
$(call cfile, $D/replace.c)
$(call cfile, $D/skip.c)
$(call cfile, $D/stab.c)
$(call cfile, $D/stack.c)
$(call cfile, $D/struct.c)
$(call cfile, $D/switch.c)
$(call cfile, $D/tokenname.c)
$(call cfile, $D/type.c)
$(call cfile, $D/util.c)
$(call llgen, $(OBJDIR)/$D, \
$(OBJDIR)/$D/tokenfile.g \
$D/program.g \
$D/declar.g \
$D/expression.g \
$D/statement.g \
$D/ival.g)
$(eval CLEANABLES += $(OBJDIR)/$D/tokenfile.g)
$(OBJDIR)/$D/tokenfile.g: $D/make.tokfile $D/tokenname.c
@echo TOKENFILE $$@
@mkdir -p $$(dir $$@)
$(hide) sh $D/make.tokfile < $D/tokenname.c > $$@
$(call tabgen, $D/char.tab)
$(eval $q: $(OBJDIR)/$D/parameters.h)
$(eval CLEANABLES += $(OBJDIR)/$D/parameters.h)
$(OBJDIR)/$D/parameters.h: $D/BigPars
@echo PARAMETERS $$@
@mkdir -p $$(dir $$@)
$(hide) echo '#ifndef PARAMETERS_H' > $$@
$(hide) echo '#define PARAMETERS_H' >> $$@
$(hide) grep -v '^!' < $D/BigPars >> $$@
$(hide) echo '#endif' >> $$@
$(eval CLEANABLES += $(OBJDIR)/$D/symbol2str.c)
$(OBJDIR)/$D/symbol2str.c: $D/make.tokcase $D/tokenname.c
@echo TOKCASE $$@
@mkdir -p $$(dir $$@)
$(hide) $D/make.tokcase < $D/tokenname.c > $$@
$(call cfile, $(OBJDIR)/$D/symbol2str.c)
$(call build-cemcom-ansi-next, \
$D/code.str \
$D/declar.str \
$D/def.str \
$D/expr.str \
$D/field.str \
$D/estack.str \
$D/util.str \
$D/proto.str \
$D/replace.str \
$D/idf.str \
$D/macro.str \
$D/stack.str \
$D/stmt.str \
$D/struct.str \
$D/switch.str \
$D/type.str \
$D/l_brace.str \
$D/l_state.str \
$D/l_outdef.str)
$(eval $q: $(OBJDIR)/$D/Lpars.h)
$(call file, $(LIBEM_MES))
$(call file, $(LIBEMK))
$(call file, $(LIBEM_DATA))
$(call file, $(LIBINPUT))
$(call file, $(LIBASSERT))
$(call file, $(LIBALLOC))
$(call file, $(LIBFLT_ARITH))
$(call file, $(LIBPRINT))
$(call file, $(LIBSYSTEM))
$(call file, $(LIBSTRING))
$(call cprogram, $(BINDIR)/cemcom.ansi)
$(call installto, $(PLATDEP)/em_cemcom.ansi)
$(eval CEMCOMANSI := $o)
$(call reset)
$(eval q := $D/cemcom.ansi.1)
$(call installto, $(INSDIR)/share/man/man1/cemcom.6)
endef
$(eval $(build-cemcom-ansi-impl))

View File

@@ -5,12 +5,10 @@
/* $Id$ */
/* S E M A N T I C A N A L Y S I S -- C H A P T E R 3.3 */
#include "debug.h"
#include "lint.h"
#include "nobitfield.h"
#include "idf.h"
#include "parameters.h"
#include <flt_arith.h>
#include "arith.h"
#include "idf.h"
#include "proto.h"
#include "type.h"
#include "struct.h"

View File

@@ -5,11 +5,8 @@
/* $Id$ */
/* SEMANTIC ANALYSIS (CHAPTER 3.3) -- BINARY OPERATORS */
#include "botch_free.h"
#include "debug.h"
#include "parameters.h"
#include <alloc.h>
#include "lint.h"
#include "idf.h"
#include <flt_arith.h>
#include "arith.h"
#include "type.h"

View File

@@ -5,22 +5,20 @@
/* $Id$ */
/* SEMANTIC ANALYSIS (CHAPTER 3.3) -- MONADIC OPERATORS */
#include "botch_free.h"
#include "debug.h"
#include "parameters.h"
#include <alloc.h>
#include "nobitfield.h"
#include "Lpars.h"
#include <flt_arith.h>
#include "idf.h"
#include "arith.h"
#include "type.h"
#include "label.h"
#include "expr.h"
#include "idf.h"
#include "def.h"
#include "sizes.h"
extern char options[];
extern arith full_mask[/*MAXSIZE*/]; /* cstoper.c */
extern arith full_mask[/*MAXSIZE + 1*/]; /* cstoper.c */
char *symbol2str();
ch3mon(oper, expp)

View File

@@ -7,23 +7,18 @@
#include <stdlib.h>
#include <string.h>
#include "lint.h"
#include "debug.h"
#include "dbsymtab.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>
#else
#include "l_em.h"
#include "l_lint.h"
#endif /* LINT */
#include "botch_free.h"
#include <alloc.h>
#include "dataflow.h"
#include "use_tmp.h"
#include <flt_arith.h>
#include "idf.h"
#include "arith.h"
#include "type.h"
#include "idf.h"
#include "label.h"
#include "code.h"
#include "stmt.h"

View File

@@ -5,7 +5,7 @@
/* $Id$ */
/* C O N V E R S I O N - C O D E G E N E R A T O R */
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>

View File

@@ -5,8 +5,7 @@
/* $Id$ */
/* C O N S T A N T E X P R E S S I O N H A N D L I N G */
#include "trgt_sizes.h"
#include "idf.h"
#include "parameters.h"
#include <flt_arith.h>
#include "arith.h"
#include "type.h"
@@ -16,7 +15,8 @@
#include "Lpars.h"
#include "assert.h"
arith full_mask[MAXSIZE];/* full_mask[1] == 0XFF, full_mask[2] == 0XFFFF, .. */
/* full_mask[1] == 0XFF, full_mask[2] == 0XFFFF, .. */
arith full_mask[MAXSIZE + 1];
#ifndef NOCROSS
arith max_int; /* maximum integer on target machine */
arith max_unsigned; /* maximum unsigned on target machine */
@@ -247,7 +247,7 @@ init_cst()
while (!(bt < 0)) {
bt = (bt << 8) + 0377, i++;
if (i == MAXSIZE)
if (i > MAXSIZE)
fatal("array full_mask too small for this machine");
full_mask[i] = bt;
}

View File

@@ -9,7 +9,7 @@
Use the compiler option --d.
*/
#include "dataflow.h" /* UF */
#include "parameters.h" /* UF */
#ifdef DATAFLOW
char *CurrentFunction = 0;

View File

@@ -6,17 +6,14 @@
/* DECLARATION SYNTAX PARSER */
{
#include "lint.h"
#include "dbsymtab.h"
#include "parameters.h"
#include <alloc.h>
#include "nobitfield.h"
#include "debug.h"
#include <flt_arith.h>
#include "idf.h"
#include "arith.h"
#include "LLlex.h"
#include "label.h"
#include "code.h"
#include "idf.h"
#include "type.h"
#include "proto.h"
#include "struct.h"

View File

@@ -5,8 +5,7 @@
/* $Id$ */
/* D E C L A R A T O R M A N I P U L A T I O N */
#include "debug.h"
#include "botch_free.h"
#include "parameters.h"
#include <alloc.h>
#include <flt_arith.h>
#include "arith.h"
@@ -15,7 +14,6 @@
#include "Lpars.h"
#include "declar.h"
#include "def.h"
#include "idf.h"
#include "label.h"
#include "expr.h"
#include "sizes.h"

View File

@@ -5,7 +5,7 @@
/* $Id$ */
/* IDENTIFIER DEFINITION DESCRIPTOR */
#include "lint.h"
#include "parameters.h"
struct def { /* for ordinary tags */
struct def *next;

View File

@@ -5,29 +5,20 @@
/* $Id$ */
/* PREPROCESSOR: CONTROLLINE INTERPRETER */
#include "debug.h"
#include <stdlib.h>
#include "parameters.h"
#include "idf.h"
#include "arith.h"
#include "LLlex.h"
#include "Lpars.h"
#include "idf.h"
#include "input.h"
#include "nopp.h"
#include "lint.h"
#include "replace.h"
#ifndef NOPP
#include "ifdepth.h"
#include "botch_free.h"
#include "nparams.h"
#include "parbufsize.h"
#include "textsize.h"
#include "idfsize.h"
#include "assert.h"
#include <alloc.h>
#include "class.h"
#include "macro.h"
#include "macbuf.h"
#include "replace.h"
#include "dbsymtab.h"
#ifdef DBSYMTAB
#include <stb.h>
#include <em.h>

View File

@@ -5,16 +5,13 @@
/* $Id$ */
/* DUMP ROUTINES */
#include "debug.h"
#ifdef DEBUG
#include "parameters.h"
#include <alloc.h>
#include "nopp.h"
#include "nobitfield.h"
#include <flt_arith.h>
#include "arith.h"
#include "stack.h"
#include "idf.h"
#include "def.h"
#include "type.h"
#include "proto.h"

View File

@@ -5,7 +5,7 @@
/* $Id$ */
/* E R R O R A N D D I A G N O S T I C R O U T I N E S */
#include "lint.h"
#include "parameters.h"
#if __STDC__
#include <stdarg.h>
#else
@@ -18,11 +18,6 @@
#include "l_em.h"
#endif /* LINT */
#include "debug.h"
#include "lint.h"
#include "nopp.h"
#include "errout.h"
#include "tokenname.h"
#include <flt_arith.h>
#include "arith.h"

View File

@@ -5,19 +5,16 @@
/* $Id$ */
/* EXPRESSION-CODE GENERATOR */
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>
#include <em_reg.h>
#include <alloc.h>
#include "debug.h"
#include "nobitfield.h"
#include "dataflow.h"
#include <flt_arith.h>
#include "idf.h"
#include "arith.h"
#include "type.h"
#include "idf.h"
#include "label.h"
#include "code.h"
#include "assert.h"
@@ -41,7 +38,7 @@ arith NewLocal(); /* util.c */
extern int err_occurred; /* error.c */
/* EVAL() is the main expression-tree evaluator, which turns
any legal expression tree into EM code. Parameters:
any legal expression tree into EM code. parameters.h:
struct expr *expr
pointer to root of the expression tree to be evaluated

View File

@@ -5,13 +5,12 @@
/* $Id$ */
/* EXPRESSION TREE HANDLING */
#include "lint.h"
#include "debug.h"
#include <stdlib.h>
#include "parameters.h"
#include "assert.h"
#include "botch_free.h"
#include <alloc.h>
#include "idf.h"
#include <flt_arith.h>
#include "idf.h"
#include "arith.h"
#include "def.h"
#include "type.h"
@@ -23,7 +22,6 @@
#include "declar.h"
#include "sizes.h"
#include "level.h"
#include "use_tmp.h"
extern char *symbol2str();
extern char options[];

View File

@@ -7,13 +7,11 @@
{
#include <alloc.h>
#include "lint.h"
#include "debug.h"
#include "parameters.h"
#include <flt_arith.h>
#include "arith.h"
#include "LLlex.h"
#include "type.h"
#include "idf.h"
#include "label.h"
#include "expr.h"
#include "code.h"

View File

@@ -5,19 +5,16 @@
/* $Id$ */
/* BITFIELD EXPRESSION EVALUATOR */
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include "nobitfield.h"
#ifndef NOBITFIELD
#include <em.h>
#include <em_reg.h>
#include "debug.h"
#include <flt_arith.h>
#include "arith.h"
#include "type.h"
#include "idf.h"
#include "label.h"
#include "code.h"
#include "assert.h"

View File

@@ -6,11 +6,9 @@
/* C O N S T A N T E X P R E S S I O N H A N D L I N G */
/* F O R F L O A T I N G P O I N T N U M B E R S */
#include "debug.h"
#include "parameters.h"
#include "assert.h"
#include <alloc.h>
#include "trgt_sizes.h"
#include "idf.h"
#include <flt_arith.h>
#include "arith.h"
#include "type.h"

View File

@@ -7,20 +7,15 @@
#include <stdlib.h>
#include <string.h>
#include "lint.h"
#include "parameters.h"
#include <em_reg.h>
#include "debug.h"
#include "idfsize.h"
#include "botch_free.h"
#include "nopp.h"
#include "nparams.h"
#include <alloc.h>
#include "idf.h"
#include "arith.h"
#include "align.h"
#include "LLlex.h"
#include "level.h"
#include "stack.h"
#include "idf.h"
#include "label.h"
#include "def.h"
#include "type.h"

View File

@@ -5,7 +5,7 @@
/* $Id$ */
/* IDENTIFIER DESCRIPTOR */
#include "nopp.h"
#include "parameters.h"
struct id_u {
#ifndef NOPP

View File

@@ -7,15 +7,15 @@
#include <stdlib.h>
#include <string.h>
#include "nopp.h"
#include "parameters.h"
#ifndef NOPP
#include <system.h>
#include <alloc.h>
#include <time.h>
#include "idf.h"
#include "class.h"
#include "macro.h"
#include "idf.h"
extern char *sprint();

View File

@@ -4,10 +4,10 @@
*/
/* $Id$ */
#include "parameters.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "inputtype.h"
#include "file_info.h"
#include "input.h"
@@ -15,12 +15,9 @@
#define INP_TYPE struct file_info
#define INP_VAR finfo
struct file_info finfo;
#include "nopp.h"
#include <inp_pkg.body>
#include <alloc.h>
#include "dbsymtab.h"
#include "lint.h"
#ifndef NOPP
#ifdef DBSYMTAB
#include <stb.h>

View File

@@ -6,18 +6,18 @@
/* CODE FOR THE INITIALISATION OF GLOBAL VARIABLES */
{
#include "lint.h"
#include <stdlib.h>
#include "parameters.h"
#ifndef LINT
#include <em.h>
#else
#include "l_em.h"
#include "l_lint.h"
#endif /* LINT */
#include "debug.h"
#include <alloc.h>
#include <assert.h>
#include "nobitfield.h"
#include <flt_arith.h>
#include "idf.h"
#include "arith.h"
#include "label.h"
#include "expr.h"
@@ -29,11 +29,11 @@
#include "Lpars.h"
#include "sizes.h"
#include "align.h"
#include "idf.h"
#include "level.h"
#include "def.h"
#include "LLlex.h"
#include "estack.h"
#include "stack.h"
#define con_nullbyte() C_con_ucon("0", (arith)1)
#define aggregate_type(tp) ((tp)->tp_fund == ARRAY || (tp)->tp_fund == STRUCT)

View File

@@ -5,10 +5,9 @@
/* $Id$ */
/* Lint-specific comment handling */
#include "parameters.h"
#include <ctype.h>
#include "lint.h"
#ifdef LINT
#include <alloc.h>

View File

@@ -5,7 +5,7 @@
/* $Id$ */
/* Lint evaluation order checking */
#include "lint.h"
#include "parameters.h"
#ifdef LINT
@@ -18,7 +18,6 @@
#include "arith.h" /* definition arith */
#include "label.h" /* definition label */
#include "expr.h"
#include "idf.h"
#include "def.h"
#include "code.h" /* RVAL etc */
#include "LLlex.h"

View File

@@ -5,12 +5,11 @@
/* $Id$ */
/* Lint main routines */
#include "lint.h"
#include "parameters.h"
#ifdef LINT
#include <alloc.h> /* for st_free */
#include "debug.h"
#include "interface.h"
#include "assert.h"
#ifdef ANSI
@@ -19,7 +18,6 @@
#include "arith.h" /* definition arith */
#include "label.h" /* definition label */
#include "expr.h"
#include "idf.h"
#include "def.h"
#include "code.h" /* RVAL etc */
#include "LLlex.h"

View File

@@ -5,7 +5,7 @@
/* $Id$ */
/* Lint miscellaneous routines */
#include "lint.h"
#include "parameters.h"
#ifdef LINT
@@ -17,7 +17,6 @@
#include "arith.h" /* definition arith */
#include "label.h" /* definition label */
#include "expr.h"
#include "idf.h"
#include "def.h"
#include "code.h" /* RVAL etc */
#include "LLlex.h"

View File

@@ -5,7 +5,7 @@
/* $Id$ */
/* Lint outdef construction */
#include "lint.h"
#include "parameters.h"
#ifdef LINT
@@ -26,7 +26,6 @@
#include "def.h"
#include "struct.h"
#include "field.h"
#include "idf.h"
#include "level.h"
#include "label.h"
#include "code.h"

View File

@@ -5,21 +5,19 @@
/* $Id$ */
/* Lint status checking */
#include "lint.h"
#include "parameters.h"
#ifdef LINT
#include <alloc.h> /* for st_free */
#include "interface.h"
#include "assert.h"
#include "debug.h"
#ifdef ANSI
#include <flt_arith.h>
#endif /* ANSI */
#include "arith.h"
#include "label.h"
#include "expr.h"
#include "idf.h"
#include "def.h"
#include "code.h" /* RVAL etc */
#include "LLlex.h"

View File

@@ -5,9 +5,10 @@
/* $Id$ */
/* L A B E L H A N D L I N G */
#include "parameters.h"
#include "idf.h"
#include "Lpars.h"
#include "level.h"
#include "idf.h"
#include "label.h"
#include "arith.h"
#include "def.h"

View File

@@ -5,7 +5,7 @@
/* $Id$ */
/* PREPROCESSOR: DEFINITION OF MACRO DESCRIPTOR */
#include "nopp.h"
#include "parameters.h"
#ifndef NOPP
/* The flags of the mc_flag field of the macro structure. Note that

View File

@@ -5,16 +5,11 @@
/* $Id$ */
/* MAIN PROGRAM */
#include "lint.h"
#include "parameters.h"
#include <system.h>
#include "debug.h"
#include "nopp.h"
#include "trgt_sizes.h"
#include "use_tmp.h"
#include "inputtype.h"
#include "idf.h"
#include "input.h"
#include "level.h"
#include "idf.h"
#include "arith.h"
#include "type.h"
#include "proto.h"
@@ -24,7 +19,6 @@
#include "LLlex.h"
#include <alloc.h>
#include "specials.h"
#include "nocross.h"
#include "sizes.h"
#include "align.h"
#include "macro.h"

View File

@@ -1,6 +1,6 @@
#!/bin/sh
echo '#include "debug.h"'
echo '#include "parameters.h"'
sed -n '
s:^.*ALLOCDEF.*"\(.*\)".*$:struct \1 *h_\1 = 0;\
#ifdef DEBUG\

View File

@@ -5,23 +5,16 @@
/* $Id$ */
/* U S E R O P T I O N - H A N D L I N G */
#include "parameters.h"
#include <stdlib.h>
#include <string.h>
#include "lint.h"
#include "botch_free.h"
#include <alloc.h>
#include "nopp.h"
#include "idfsize.h"
#include "nobitfield.h"
#include "class.h"
#include "macro.h"
#include "idf.h"
#include "arith.h"
#include "sizes.h"
#include "align.h"
#include "use_tmp.h"
#include "dataflow.h"
#include "dbsymtab.h"
#ifndef NOPP
extern char **inctable;

View File

@@ -5,8 +5,7 @@
/* $Id$ */
/* PREPROCESSOR: PRAGMA INTERPRETER */
#include "debug.h"
#include "idf.h"
#include "parameters.h"
#define P_UNKNOWN 0
#define NR_PRAGMAS 0

View File

@@ -45,13 +45,10 @@
%start If_expr, control_if_expression;
{
#include "lint.h"
#include "nopp.h"
#include "debug.h"
#include "parameters.h"
#include <flt_arith.h>
#include "arith.h"
#include "LLlex.h"
#include "idf.h"
#include "label.h"
#include "type.h"
#include "declar.h"
@@ -59,6 +56,7 @@
#include "code.h"
#include "expr.h"
#include "def.h"
#include "stack.h"
#ifdef LINT
#include "l_lint.h"
#endif /* LINT */

View File

@@ -5,19 +5,15 @@
/* $Id$ */
/* P R O T O T Y P E F I D D L I N G */
#include "lint.h"
#include "debug.h"
#include "idfsize.h"
#include "nparams.h"
#include "botch_free.h"
#include "parameters.h"
#include <alloc.h>
#include "idf.h"
#include "Lpars.h"
#include "level.h"
#include <flt_arith.h>
#include "arith.h"
#include "align.h"
#include "stack.h"
#include "idf.h"
#include "def.h"
#include "type.h"
#include "struct.h"

View File

@@ -7,26 +7,18 @@
#include <stdlib.h>
#include <string.h>
#include "nopp.h"
#include "parameters.h"
#ifndef NOPP
#include "debug.h"
#include "pathlength.h"
#include "strsize.h"
#include "nparams.h"
#include "idfsize.h"
#include "numsize.h"
#include <alloc.h>
#include "idf.h"
#include "idf.h"
#include "input.h"
#include "macro.h"
#include "arith.h"
#include "LLlex.h"
#include "class.h"
#include "assert.h"
#include "static.h"
#include "macbuf.h"
#include "replace.h"
extern struct idf *GetIdentifier();

View File

@@ -5,8 +5,7 @@
/* $Id$ */
/* VARIOUS TARGET MACHINE SIZE DESCRIPTORS */
#include "nocross.h"
#include "trgt_sizes.h"
#include "parameters.h"
#ifndef NOCROSS
extern arith

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