Compare commits

...

113 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
486 changed files with 10087 additions and 6979 deletions

17
.distr
View File

@ -1,9 +1,7 @@
README
CHANGES
Copyright
pm
pmfile
config.pm
Makefile
h
modules/h
@ -13,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
@ -31,7 +29,7 @@ util/ack
lib/descr/fe
util/arch
#util/cpp
util/cgg
#util/cgg
util/ncgg
util/misc
util/opt
@ -43,15 +41,22 @@ lang/cem
lang/pc
lang/m2
#lang/occam
#lang/basic
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
man

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)

79
README
View File

@ -1,8 +1,8 @@
THE AMSTERDAM COMPILER KIT V6.0pre4
THE AMSTERDAM COMPILER KIT V6.0pre5
===================================
© 1987-2005 Vrije Universiteit, Amsterdam
2010-08-08
2013-05-15
INTRODUCTION
@ -24,59 +24,63 @@ SUPPORT
Languages:
ANSI C, Pascal, Modula 2. K&R is supported via the ANSI C compiler.
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.
@ -94,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:
@ -107,6 +112,7 @@ 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).
@ -117,12 +123,13 @@ A sample command line is:
ack -mlinux386 -O examples/paranoia.c
GOTCHAS
=======
There are some things you should be aware of.
- Look at plat/<PLATFORMNAME>/README for information about the two supported
- Look at plat/<PLATFORMNAME>/README for information about the supported
platforms.
- The library support is fairly limited; for C, it's at roughly the ANSI C
@ -163,8 +170,4 @@ Please enjoy.
David Given (dtrg on Sourceforge)
dg@cowlark.com
2010-08-08
# $Source$
# $State$
# $Revision$
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 --

View File

@ -143,7 +143,7 @@ echo ""
if [ -e $destdir ]; 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

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))

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

@ -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

@ -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,4 +1,4 @@
pmfile
build.mk
cemcom.ansi
cpp.ansi
libcc.ansi

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,17 +5,15 @@
/* $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"

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"

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

View File

@ -5,7 +5,7 @@
/* $Id$ */
/* PREPROCESSOR: INPUT SKIP FUNCTIONS */
#include "nopp.h"
#include "parameters.h"
#include "arith.h"
#include "LLlex.h"
#include "class.h"

View File

@ -9,7 +9,7 @@
/* $Id$ */
#include "dbsymtab.h"
#include "parameters.h"
#ifdef DBSYMTAB
@ -20,13 +20,13 @@
#include <flt_arith.h>
#include <stb.h>
#include "idf.h"
#include "LLlex.h"
#include "stack.h"
#include "def.h"
#include "type.h"
#include "struct.h"
#include "field.h"
#include "idf.h"
#include "Lpars.h"
#include "level.h"

View File

@ -5,21 +5,19 @@
/* $Id$ */
/* S T A C K / U N S T A C K R O U T I N E S */
#include "lint.h"
#include "parameters.h"
#include <system.h>
#ifndef LINT
#include <em.h>
#else
#include "l_em.h"
#endif /* LINT */
#include "debug.h"
#include "botch_free.h"
#include <alloc.h>
#include "idf.h"
#include "Lpars.h"
#include "arith.h"
#include "stack.h"
#include "type.h"
#include "idf.h"
#include "def.h"
#include "struct.h"
#include "level.h"

View File

@ -6,7 +6,7 @@
/* STATEMENT SYNTAX PARSER */
{
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>
#else
@ -14,15 +14,11 @@
#include "l_lint.h"
#endif /* LINT */
#include "debug.h"
#include "botch_free.h"
#include "dbsymtab.h"
#include <flt_arith.h>
#include "idf.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,13 +5,11 @@
/* $Id$ */
/* ADMINISTRATION OF STRUCT AND UNION DECLARATIONS */
#include "nobitfield.h"
#include "debug.h"
#include "botch_free.h"
#include "parameters.h"
#include <alloc.h>
#include "idf.h"
#include "arith.h"
#include "stack.h"
#include "idf.h"
#include "def.h"
#include "type.h"
#include "proto.h"

View File

@ -5,18 +5,14 @@
/* $Id$ */
/* S W I T C H - S T A T E M E N T A D M I N I S T R A T I O N */
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>
#else
#include "l_em.h"
#endif /* LINT */
#include "debug.h"
#include "botch_free.h"
#include <alloc.h>
#include "density.h"
#include "Lpars.h"
#include "idf.h"
#include "label.h"
#include <flt_arith.h>
#include "arith.h"

View File

@ -5,7 +5,8 @@
/* $Id$ */
/* TOKEN NAME DEFINITIONS */
#include "idf.h"
#include "parameters.h"
#include "idf.h"
#include "arith.h"
#include "LLlex.h"
#include "tokenname.h"

View File

@ -5,14 +5,12 @@
/* $Id$ */
/* T Y P E D E F I N I T I O N M E C H A N I S M */
#include "nobitfield.h"
#include "debug.h"
#include "botch_free.h"
#include "parameters.h"
#include <alloc.h>
#include "idf.h"
#include "Lpars.h"
#include "arith.h"
#include "type.h"
#include "idf.h"
#include "def.h"
#include "proto.h"
#include "sizes.h"

View File

@ -5,8 +5,7 @@
/* $Id$ */
/* TYPE DESCRIPTOR */
#include "nobitfield.h"
#include "dbsymtab.h"
#include "parameters.h"
struct type {
struct type *next; /* used for ARRAY and for qualifiers */

View File

@ -11,7 +11,7 @@
allowing re-use.
*/
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>
#else
@ -22,10 +22,7 @@
#include <alloc.h>
#include <em_mes.h>
#include "debug.h"
#include "util.h"
#include "use_tmp.h"
#include "regcount.h"
#include "sizes.h"
#include "align.h"
#include "stack.h"

View File

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

View File

@ -39,7 +39,7 @@ arith NewLocal(); /* util.c */
#define LocalPtrVar() NewLocal(pointer_size, pointer_align, reg_pointer, REGISTER)
/* 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

@ -70,7 +70,7 @@ replace(idef)
return 0;
}
if (++mac->mc_count > 100) {
/* 100 must be some number in Parameters */
/* 100 must be some number in parameters.h */
lexwarning("macro %s is assumed recursive",
idef->id_text);
return 0;

View File

@ -1,8 +1,8 @@
pmfile
build.mk
LLlex.c
LLlex.h
LLmessage.c
Parameters
parameters.h
arith.h
bits.h
ch3bin.c
@ -22,7 +22,6 @@ input.h
macro.str
main.c
make.allocd
make.hfiles
make.next
make.tokcase
make.tokfile

View File

@ -5,9 +5,7 @@
/* $Id$ */
/* L E X I C A L A N A L Y Z E R */
#include "idfsize.h"
#include "numsize.h"
#include "strsize.h"
#include "parameters.h"
#include <alloc.h>
#include "input.h"

View File

@ -3,7 +3,7 @@
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
#include "dobits.h"
#include "parameters.h"
#ifdef DOBITS
#define bit0 0x01
#define bit1 0x02

104
lang/cem/cpp.ansi/build.mk Normal file
View File

@ -0,0 +1,104 @@
D := lang/cem/cpp.ansi
define build-cpp-ansi-allocd-header
$1: $2 $D/make.allocd
@echo ALLOCD $1
@mkdir -p $(dir $1)
$(hide) $D/make.allocd < $2 > $1
$(eval CLEANABLES += $1)
endef
define build-cpp-ansi-tokfile
$(OBJDIR)/$D/tokenfile.g: $D/make.tokfile $D/tokenname.c
@echo TOKENFILE $$@
@mkdir -p $$(dir $$@)
$(hide) sh $D/make.tokfile < $D/tokenname.c > $$@
$(eval CLEANABLES += $(OBJDIR)/$D/tokenfile.g)
endef
define build-cpp-ansi-tokcase
$(OBJDIR)/$D/symbol2str.c: $D/make.tokcase $D/tokenname.c
@echo TOKCASE $$@
@mkdir -p $$(dir $$@)
$(hide) sh $D/make.tokcase < $D/tokenname.c > $$@
$(eval CLEANABLES += $(OBJDIR)/$D/symbol2str.c)
endef
define build-cpp-ansi-next
$(OBJDIR)/$D/next.c: $D/make.next $D/macro.str $D/replace.str
@echo NEXT $$@
@mkdir -p $$(dir $$@)
$(hide) sh $D/make.next $D/macro.str $D/replace.str > $$@
$(eval CLEANABLES += $(OBJDIR)/$D/next.c)
endef
define build-cpp-ansi-impl
$(eval $(call build-cpp-ansi-next))
$(eval $(call build-cpp-ansi-tokcase))
$(eval $(call build-cpp-ansi-tokfile))
$(eval $(call build-cpp-ansi-allocd-header, \
$(OBJDIR)/$D/macro.h, $D/macro.str \
))
$(eval $(call build-cpp-ansi-allocd-header, \
$(OBJDIR)/$D/replace.h, $D/replace.str \
))
$(call reset)
$(eval cflags += -I$(OBJDIR)/$D -I$D)
$(call cfile, $D/LLlex.c)
$(call cfile, $D/LLmessage.c)
$(call cfile, $D/ch3bin.c)
$(call cfile, $D/ch3mon.c)
$(call cfile, $D/domacro.c)
$(call cfile, $D/error.c)
$(call cfile, $D/idf.c)
$(call cfile, $D/init.c)
$(call cfile, $D/input.c)
$(call cfile, $D/main.c)
$(call cfile, $D/options.c)
$(call cfile, $D/preprocess.c)
$(call cfile, $D/replace.c)
$(call cfile, $D/skip.c)
$(call cfile, $D/tokenname.c)
$(call cfile, $D/expr.c)
$(call cfile, $(OBJDIR)/$D/symbol2str.c)
$(call cfile, $(OBJDIR)/$D/next.c)
$(call llgen, $(OBJDIR)/$D, $(OBJDIR)/$D/tokenfile.g $D/expression.g)
$(call file, $(LIBINPUT))
$(call file, $(LIBASSERT))
$(call file, $(LIBALLOC))
$(call file, $(LIBPRINT))
$(call file, $(LIBSYSTEM))
$(call file, $(LIBSTRING))
$(call tabgen, $D/char.tab)
$(eval $q: \
$(OBJDIR)/$D/macro.h \
$(OBJDIR)/$D/Lpars.h \
$(INCDIR)/alloc.h \
$(INCDIR)/inp_pkg.spec \
$(INCDIR)/idf_pkg.spec \
$(OBJDIR)/$D/replace.h \
$(INCDIR)/system.h \
$(INCDIR)/inp_pkg.body \
$(INCDIR)/inp_pkg.spec \
$(INCDIR)/idf_pkg.body)
$(call cprogram, $(BINDIR)/cpp.ansi)
$(call installto, $(PLATDEP)/cpp.ansi)
$(eval CPPANSI := $o)
$(call reset)
$(eval q := $D/ncpp.6)
$(call installto, $(INSDIR)/share/man/man6/cpp.ansi.6)
endef
$(eval $(build-cpp-ansi-impl))

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