Commit graph

556 commits

Author SHA1 Message Date
George Koehler e5e96d5226 Convert 1 to 1.0, not 0.0, for machines with 64-bit long.
This fixes flt_arith2flt() when sizeof(arith) != 4, where arith is
long.  When cemcom.ansi sees an expression like d + 1 (where d is some
double), it calls flt_arith2flt() to convert 1 to floating-point.  On
machines where sizeof(arith) != 4, the code did n >>= 1 when n should
not have been changed.  If n was 1, then n == 0 became true.  This
caused the code to convert 1 or -1 to 0.0.

My fix assumes sizeof(arith) >= 8, so I can use n >> 32.  Machines
with sizeof(arith) of 5 to 7 would need to do (uarith)n >> 32, where
uarith must be an unsigned integer type of same size as arith.

In startrek.c, the Enterprise can now dock with a starbase.  The
compiler no longer translates s1 - 1 to s1 - 0.0 and s1 + 1 to s1 +
0.0, so the game now looks for starbases next to the Enterprise.
2016-11-06 19:34:51 -05:00
George Koehler daeeb5aca3 Simplify flt_arith now that mantissa uses uint32_t.
It seems that someone wanted to build flt_arith with a compiler that
had long but not unsigned long.  This required extra code to
accomplish unsigned right shift, unsigned division, and unsigned
comparison using the signed operations.  Now that we use uint32_t, we
can simply use the unsigned operations and remove the ucmp() function.
We have similar code in mach/proto/fp/ and in
lang/cem/libcc.ansi/stdlib/ext_comp.c where we use the unsigned
operations.

Some long variables become uint32_t, and some masks with 0xFFFFFFFF
disappear because uint32_t has only 32 bits.

Update flt_arith.3 to show that mantissa uses uint32_t.

Provide a target to install modules/src/flt_arith/test.c as flt_test
so I can run the tests.
2016-11-05 21:51:53 -04:00
George Koehler 3bb41d3910 Switch flt_mantissa fields from long to uint32_t.
This seems to fix an error when flt_arith converts a literal
double-precision float to IEEE format.  For example, 0.5 and 0.75 got
converted to slightly below their correct values.

My host gcc for amd64 has 64-bit long, but flt_arith needs only 32
bits.  The code (at least flt_add.c) can make 32-bit overflows.  Such
overflows would set the higher bits of a 64-bit long, which might
cause problems later.

I need to use uint32_t and not int32_t because the code still uses
long, and the sign extension from int32_t to long would cause
problems.  The mantissa represents a value in [0, 2) that can't be
negative, so unsigned type is better.  Also, signed overflow is
undefined behavior in C, so flt_add.c better make overflows with
uint32_t and not int32_t.

This commit doesn't touch lang/cem/libcc.ansi/stdlib/ext_fmt.h which
continues to use unsigned long for its mantissa fields.
2016-11-05 17:00:24 -04:00
George Koehler 5c62ec2d8f Assume ANSI C in modules/src/flt_arith
Remove the #include "ansi.h" and always use the prototypes.
2016-11-05 16:24:18 -04:00
David Given 4ba409eb74 Ensure the modules properly depend on their headers. 2016-11-05 11:52:54 +01:00
David Given fee47b25c3 Merge from default. 2016-11-05 11:47:53 +01:00
David Given 7f64fe96c7 Properly declare the library headers as dependencies. 2016-11-05 11:47:36 +01:00
David Given ff58a6100f Add pmap_remove(). 2016-10-09 22:03:44 +02:00
David Given 4261744537 Replace pmap_get() with pmap_findleft() and pmap_findright(), to allow lookups
in both directions.
2016-10-08 23:32:13 +02:00
David Given b7af003dbb Add array_{appendall,removeall,appendallu}. 2016-10-08 00:20:26 +02:00
David Given b11f96e8fe Add array push/pop; fix ghastly memory overrun bug. 2016-10-02 17:24:31 +02:00
David Given a3cfe6047f More rigorous dealing of IR groups; no need for is_generated and is_root any
more (but now passes are required to set IR roots properly when changing
instructions).
2016-10-01 22:58:29 +02:00
David Given 4a3a9a98dc It doesn't really make a lot of sense to have BURG nonterminal names different
to register classes, so combine them. Refactor the map code.
2016-10-01 12:17:14 +02:00
David Given 3a973a19f3 Move fatal(), warning() and aprintf() into the new data module (because they're
really useful).
2016-09-30 19:10:30 +02:00
David Given ba1a3656a1 You can tell whether an item already exists in the array when calling
array_appendu() now.
2016-09-28 23:39:00 +02:00
David Given f552c9c7c6 Move map into the data module. 2016-09-26 23:03:04 +02:00
David Given c4b8e00ae2 Revamp the array module not to use nasty macros any more. Slightly more verbose
to use, but definitely cleaner.
2016-09-26 22:48:58 +02:00
David Given 3671892c34 Move the array library into the data module. 2016-09-26 22:24:49 +02:00
David Given bcc74ba18d Stupid stringlist is stupid. Use a proper data structure, properly abstracted
out (so other things can use it).
2016-09-25 12:18:39 +02:00
David Given f992eb28ac ANSIise to fix warnings. 2016-09-18 00:23:42 +02:00
David Given 24380e2a93 Abstract out the EM reader; skeleton of the tree builder. 2016-09-18 00:02:16 +02:00
David Given f67c98e239 Distributions are a pain --- let's not bother any more. Instead, we just tag
the repository and download a complete snapshot, old and ancient stuff and all.
2016-09-02 23:00:38 +02:00
David Given 612e38f1c6 Remove the old make-based build system, plus some big chunks of horribly
obsolete protomake build system.
2016-09-02 22:17:51 +02:00
David Given 2dab95eced Move the em_code headers into the em_code module. 2016-08-14 14:17:35 +02:00
David Given 4d24666432 Move util/data into modules/src/em_data, for consistency with the other
modules.
2016-08-14 14:09:38 +02:00
David Given 0d77cb8279 We can build our first C file. 2016-08-07 21:56:53 +02:00
David Given f9c77fca03 Replace the hacky cflags variable with an equally hacky but vastly
more useful magic vars variable.
2016-07-27 00:10:15 +02:00
David Given 2770a83837 More programs, more libraries. src/modules build files are now saner. 2016-07-23 00:30:31 +02:00
David Given 1fdc69fb97 cemcom.ansi now builds. 2016-07-19 23:43:14 +02:00
David Given bcf3408e36 More stuff builds; almost the C compiler now. 2016-07-14 23:54:13 +02:00
David Given d805052205 All the amisc binaries now build. 2016-06-19 09:32:45 +02:00
David Given 09554cb324 installable works, although it's a bit kludgy. Change the : separator to +
because : is special in make and non of the others I could think of would work.
2016-06-14 07:34:14 +02:00
David Given 015804afce cprogram works. 2016-06-09 07:14:41 +02:00
David Given f47bb49c1f Multiple build files work. Use deps intelligently. clibraries. 2016-06-09 06:55:44 +02:00
David Given 88bd7ce126 Remove defunct pmfiles.
--HG--
branch : default-branch
2016-06-03 13:56:50 +02:00
David Given ef8e6e25e0 Fix a whole pile of issues related to the failed attempt to increase
the number of types of relocation possible in the object file. (Now,
hopefully, working.)

Also change the object serialiser/deserialiser to never try to read or
write raw structures; it's way safer this way and we don't need the
performance boost any more.

--HG--
branch : default-branch
2016-03-18 21:46:55 +01:00
David Given 11377070fd Update distribution files.
--HG--
branch : dtrg-buildsystem
2013-05-15 23:46:15 +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 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
George Koehler 7ef9b79c11 Merge deletion of many undead files. 2012-09-23 15:31:16 -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
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 b611731ec3 Updated .distr files for the new release. 2007-02-25 12:51:55 +00:00
dtrg 6d58210806 em_table is now in /h, not /etc. 2007-02-25 12:51:21 +00:00
dtrg 6e509e22dd Added shell magic. 2007-02-25 12:46:11 +00:00
dtrg dbe10d2c19 Updated to the version 0.1 of Prime Mover (which involves some syntax changes). 2006-10-15 00:28:12 +00:00
dtrg 45b4fef7d6 Rationalised use of #includes to be more standards-compliant. 2006-07-30 23:40:35 +00:00
dtrg 30e34f493f Rationalised use of #includes to be more standards-compliant. 2006-07-26 18:22:02 +00:00
dtrg bbd94dc2dc Changed to no longer build sys_lock() and sys_unlock(); they only work
on platforms that support hardlinks, and nobody uses them anyway.
2006-07-26 12:40:59 +00:00
dtrg 3494ffb302 Fixed to use rename() for renaming files, not link()/unlink(). 2006-07-26 12:40:25 +00:00
dtrg 014be56fb0 Replaced calls to the custom strindex() and strrindex() functions with the
exactly equivalent and standard strchr() and strrchr() functions instead.
2006-07-23 20:01:02 +00:00
dtrg babe9eafad Modified to no longer build unoptimised duplicates of all the standard
string functions (strcpy, strlen, etc).
2006-07-23 19:58:27 +00:00
dtrg e6ddd5be27 Changed to export a header file so it can be correctly referred to. 2006-07-22 20:59:22 +00:00
dtrg 34ae7c4634 Removed duplicate (and incorrect) system function declarations. 2006-07-21 11:17:18 +00:00
dtrg 097c640a6c First version in CVS. 2006-07-20 23:24:28 +00:00
dtrg ea8f3fe1ff Rationalised use of #includes to be more standards-compliant. 2006-07-20 23:17:25 +00:00
dtrg 6073ee934e Rationalised use of #includes to be more standards-compliant. 2006-07-19 14:09:05 +00:00
dtrg 4c0a0e6119 Rationalised use of #includes to be more standards-compliant. 2006-07-18 17:10:29 +00:00
dtrg 8ea67498ed Added the appropriate #! magic at the beginning of shell scripts. (Some modern shells don't like scripts to be without it.) 2006-07-18 17:10:18 +00:00
dtrg 35bd1df1aa Now includes stdlib.h to avoid implicit call declarations. 2005-06-25 15:50:40 +00:00
ceriel 2c66222509 Fixed bug: flt_div should not touch e1 1997-03-13 18:38:24 +00:00
ceriel 65cd309c08 'ed -' is no longer supported by some systems. Use 'ed -s' 1995-08-15 08:43:10 +00:00
ceriel f8d6337862 'ed -' is no longer supported by some systems. Use 'ed -s' 1995-08-14 15:09:59 +00:00
ceriel 7b6d8fbe56 Added copyright notice 1995-07-31 09:10:42 +00:00
ceriel e4fd4fce8e Fix: C_pt_ps and C_pt_op prototypes only valid when READABLE_EM is defined 1995-03-24 10:27:28 +00:00
ceriel b71c0ca9a3 Added Amake.srclist 1995-03-21 09:39:29 +00:00
ceriel 7b996be765 void LoadChar 1994-10-20 11:52:15 +00:00
ceriel 5c83e7dbb5 Header --> Id 1994-06-24 11:31:16 +00:00
ceriel 5a99c436b6 minor change: commented __ANSI_H__INCLUDED after #endif 1993-12-15 09:55:35 +00:00
ceriel 501da70526 Restored em_codeO.h; it is also needed when em_opt is not installed 1993-11-12 13:40:17 +00:00
ceriel 4deafdc9de Changed modules mechanism 1993-11-10 12:33:15 +00:00
ceriel d7b6b9a5ce Added prototyping stuff 1993-11-10 12:32:42 +00:00
ceriel 103cbb4319 Added prototyping stuff 1993-11-10 12:09:49 +00:00
ceriel 62f978c40f Added prototyping stuff 1993-11-10 11:49:49 +00:00
ceriel 73adc0f645 Added prototyping stuff 1993-11-10 11:40:41 +00:00
ceriel d848beec72 Changed modules mechanism 1993-11-10 11:38:42 +00:00
ceriel 11d4fdf6e0 Added prototyping stuff 1993-11-10 11:14:28 +00:00
ceriel abf052244b Added prototyping stuff 1993-11-10 10:26:07 +00:00
ceriel 31752a4617 Changed modules mechanism 1993-11-10 10:13:04 +00:00
ceriel 1da6506ba7 Added prototypes 1993-11-05 15:02:57 +00:00
ceriel cee6ab37e7 Compilers should recognize void by now 1993-10-26 16:26:36 +00:00
ceriel 32760d492a Added prototype 1993-10-22 14:09:28 +00:00
ceriel 4ec65def3f Modified to conform to ANSI C 1993-10-22 14:05:24 +00:00
ceriel 799f0600ef Added prototypes 1993-10-22 13:49:04 +00:00
ceriel ab8dcfa134 ANSI C fixes 1993-10-21 12:50:58 +00:00
ceriel eaea6c1c59 Fix: Makefile used cc instead of $(UCC) 1993-09-03 11:02:02 +00:00
ceriel eb375db4d6 repositioned lint comments, so that they work better 1993-03-18 13:09:55 +00:00
ceriel 3b80847a9d found a small error with Purify 1993-01-18 15:30:54 +00:00
ceriel bcff9862e7 found some small leaks with Purify 1993-01-18 15:29:54 +00:00
ceriel f8232e51a3 Several changes for ANSI C 1992-12-04 09:36:54 +00:00
ceriel dc73ec5cbf declared loadbuf 1992-10-26 11:07:55 +00:00
ceriel 92a6e5c426 Added declaration for st_alloc() 1992-06-25 11:32:30 +00:00
ceriel 8005ef1672 improved assert macro 1992-03-20 13:43:10 +00:00
ceriel a0acff4f4c minor change: give anonymous struct a name 1992-02-26 15:46:44 +00:00
ceriel df1ed9426d Do not use '#endif/#else xxx'; it is not allowed for ANSI C 1991-12-17 15:28:58 +00:00
ceriel 53c4951b29 Do not use '#endif/#else xxx'; it is not allowed for ANSI C 1991-12-17 15:05:43 +00:00
ceriel f4ecd50601 made more acceptable for ANSI C 1991-11-26 14:48:27 +00:00
ceriel 89887ef6b0 made more acceptable for ANSI C 1991-11-26 14:39:52 +00:00
ceriel 0d6ddc094b lib/em_data.a --> lib.bin/em_data.a 1991-11-25 09:49:27 +00:00
ceriel 3db2add75c Changed action names to reflect action taken 1991-11-22 13:55:56 +00:00
ceriel 2b6f5b9b8d Avoid use of 'you' 1991-11-22 13:18:57 +00:00
ceriel 4e99d889ff Changed manual page installation mechanism 1991-11-05 15:31:14 +00:00
ceriel 46b0f8ea19 Fixed Email addresses 1991-10-30 18:21:52 +00:00
ceriel aab21f875e Only install machine-independent part when required 1991-10-25 11:44:18 +00:00
ceriel 5dd19fa6e7 Added Action.lint 1991-10-16 13:36:15 +00:00
ceriel 68b728a4e3 fixed lintlib entry 1991-10-16 11:42:25 +00:00
ceriel e98e8717be Return values 1991-10-16 11:41:33 +00:00
ceriel 6debaf0e5c Removed some files that are no longer needed 1991-10-14 15:17:40 +00:00
ceriel 18897487a9 do not do lintlib installation on 'make install', also make sure
that every proto.make has a lintlib entry
1991-10-09 19:02:55 +00:00
ceriel 182c7ebd70 Fixed flt_ar2flt.c 1991-10-02 15:20:22 +00:00
ceriel 7551b8e83a Changes to manual page 1991-10-01 12:18:39 +00:00
ceriel a329780d73 small change to manual page 1991-10-01 11:14:24 +00:00
ceriel 3a0c239091 Fixed some errors 1991-09-18 09:48:15 +00:00
ceriel 86e38c87fb Fixed typo 1991-09-12 16:41:15 +00:00
ceriel 0ae5c1e43e Fixed: Added -I. 1991-09-12 16:39:50 +00:00
ceriel a82fde69c3 Fixed 1991-09-12 14:19:28 +00:00
ceriel da188bbb4d New installation mechanism, changed byte order mechanism 1991-08-26 16:57:47 +00:00
ceriel 73177ad913 New installation mechanism 1991-08-26 16:50:25 +00:00
ceriel dd478032e6 New installation mechanism 1991-08-26 16:21:27 +00:00
ceriel 4d682ab1e2 Changed mechanism for defining size_type 1991-07-12 10:16:11 +00:00
ceriel ea9332362d correction 1991-06-26 17:26:59 +00:00
ceriel f3d21dc6cc made alloc.h acceptable for ANSI C compiler 1991-06-26 17:26:03 +00:00
ceriel 55d8020292 some more statistics 1991-06-24 16:35:08 +00:00
ceriel eecdf96b0b Rearranged a bit 1991-03-22 15:17:16 +00:00
ceriel adab058c34 Fixed typo 1991-03-14 13:46:53 +00:00
ceriel d8771e87f9 minor mods 1991-03-14 13:43:45 +00:00
ceriel 977e1ac25e Removed unused variable 1991-03-11 14:38:28 +00:00
ceriel 52d4c7ff70 Added VARARGS 1991-03-11 14:33:13 +00:00
ceriel ee02bfcd82 minor mods 1991-02-26 15:46:18 +00:00
ceriel 8de1b855ab delinted 1991-02-19 16:25:21 +00:00
ceriel 9a294d4821 Changed name of include file 1991-02-19 13:53:04 +00:00
ceriel 3660ea15c5 One less significant digit: 20 was too much 1991-02-18 11:43:44 +00:00
ceriel af7686cd66 delinted 1991-02-18 10:58:49 +00:00
ceriel 8322e2d5d3 Made to work if BYTES_REVERSED and/or WORDS_REVERSED are not defined 1991-01-18 09:54:56 +00:00
ceriel 57f2827832 Modified manual page so that STDOUT and STDERR are mentioned 1991-01-17 13:24:28 +00:00
ceriel 4b40bae467 made acceptable for flex (no yyless() callable from other source file) 1991-01-11 14:36:37 +00:00
ceriel d9815cadcd fixed bug with APPEND in sys_open() 1991-01-11 13:19:36 +00:00
ceriel 159d8ec57d Fixed for OUTSEEK (by C. Verstoep) 1990-12-11 10:38:22 +00:00
ceriel 24a8b613ae Added test program 1990-12-04 16:40:21 +00:00
ceriel 8468609eda improved for numbers that can be represented exactly 1990-12-04 11:33:01 +00:00
ceriel 96d5009bef speeded up std_alloc() 1990-11-12 13:56:38 +00:00
ceriel 1bab6dbcaf Several fixes 1990-11-01 09:33:51 +00:00
ceriel 1aef1c5921 Added high-speed clear loops and changed behaviour of Realloc 1990-11-01 09:32:21 +00:00
eck e3a247ad23 added em_mesX.h to .distr 1990-09-20 17:03:05 +00:00
ceriel e0ff37aa6e support for long strings 1990-08-01 14:30:45 +00:00
ceriel f4e1a15dfb Added support for debugger messages 1990-07-30 16:05:27 +00:00