Commit graph

117 commits

Author SHA1 Message Date
tkchia 3b1d440d5c Fix cpp.ansi crash when stringifying missing macro argument
Fixes https://github.com/davidgiven/ack/issues/238
2022-08-02 15:28:21 +00:00
David Given 25b6712e63 Rework all the ackbuilder scripts not to use wildcards, because we can't expand
them without luaposix, which isn't available (easily) on OSX or Windows.
2022-07-14 23:57:54 +02:00
David Given c59eae1429 Don't buffer overflow when trying to process source bytes with the high bit
set.
2019-03-11 13:50:30 +00:00
carl 5f9a199257 CPP ISO C90 compatibility and conversion. 2019-03-02 01:44:16 +08:00
carl 9ca8f42930 + Add missing files. 2019-02-20 00:32:19 +08:00
David Given 58698bed19 Removed a whole bunch of old strcpy() prototypes in favour of <string.h>. 2019-02-10 13:20:04 +01:00
David Given 24ffbe086a Install the cpp.ansi man page. #82. 2018-12-22 23:47:49 +01:00
David Given 6931ffa5a4 Disable the built-in preprocessor in cemcom.ansi; the external preprocessor is
always run. Fix a bug in block skipping in the preprocessor.
2018-09-02 12:39:00 +02:00
David Given f8fc5bc3d8 Implement single-line C++-style comments.
Fixes: #118
2018-09-02 12:14:59 +02:00
David Given 0e9736fdca Run through clang-format before editing. 2018-09-02 12:04:33 +02:00
David Given 274ed3cb6a Run through clang-format before editing. 2018-09-02 11:49:40 +02:00
David Given dd00b81080 Run files through clang-format before editing. 2018-09-02 11:36:15 +02:00
David Given 788f439a48 Run files through clang-format before editing. 2018-09-02 11:16:06 +02:00
George Koehler 87a2315037 strcmp, strncmp are in <string.h>
*Important:*  Do `make clean` to work around a problem and prevent
infinite rebuilds, https://github.com/davidgiven/ack/issues/68

I edit tokens.g in util/LLgen/src, so I regenerate tokens.c.  The
regeneration script bootstrap.sh can't find LLgen, but I can run the
same command by typing the path to llgen.
2017-11-14 17:35:35 -05:00
George Koehler ddf9de3f49 strcpy() is in <string.h> 2017-11-13 17:57:02 -05:00
George Koehler 3463f0c944 bts2str(), long2str() are in <ack_string.h> 2017-11-10 18:00:00 -05:00
George Koehler ca4bd38206 Delete old "assert.h" files; use libc <assert.h>.
Edit build.lua for programs losing their private assert.h, so they
depend on a list of .h files excluding assert.h.

Remove modules/src/assert; it would be a dependency of cpp.ansi but we
didn't build it, so cpp.ansi uses the libc assert.

I hope that libc <assert.h> can better report failed assertions.  Some
old "assert.h" files didn't report the expression.  Some reported a
literal "x", because traditional C expanded the macro parameter x in
"x", but ANSI C89 doesn't expand macro parameters in string literals.
2017-11-09 22:22:13 -05:00
George Koehler 59b3c10563 Use (arith) 1 << ... when getting the sign bit.
This prevents an overflow reported by @hexcoder- in
https://github.com/davidgiven/ack/issues/56

lang/cem/cpp.ansi/LLlex.c used a plain 1 << ... and caused an overflow
on machines where sizeof(int) < sizeof(long).  Using 1L << ... would
work for now but might fail later if arith became long long.

C doesn't specify whether negative integers use 2's complement or some
other format.  Therefore, (arith) 1 << ... has an undefined value.  It
should still work because the value is some integer where the sign bit
is set and all other bits are clear.

(unsigned arith) 1 << ... would also get the sign bit, but casting it
from unsigned back to signed would make the same undefined value.

(arith) -1 << ... would assume 2's complement.
2017-10-29 17:45:10 -04:00
George Koehler 1ab1306baa Always use unsigned long in lang/cem
Same reason as commit 649410b.
2017-10-29 17:01:29 -04:00
David Given 3e69d1185a Fix a whole lot more stray prototypes. 2016-11-24 21:47:40 +01:00
David Given 4d7c27391f Merge. 2016-11-10 22:06:08 +01:00
David Given fd91851005 Add enough return types to the K&R C that the ACK builds (on Linux) using clang
now.
2016-11-10 22:04:18 +01:00
David Given 57cb99ade1 Remove sys_time in favour of directly calling time(). 2016-11-09 21:52:04 +01: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 262c5fedcf Biggish refactor to break cycles; my build rules were full of them. cpm builds,
which requires top and topgen.
2016-08-14 01:39:40 +02:00
David Given b50dc4214a Add check for undefined variables. Find undefined variables. Fix undefined
variables.
2016-08-05 00:01:55 +02:00
David Given 5e84be70fd Massive ackbuilder refactor --- cleaner and more expressive. Lists
are automatically flattened (leading to better build files), and the
list and filename functions are vastly more orthogonal.
2016-08-04 23:51:19 +02:00
David Given b2bb4ce3b2 Builds libend (the simplest library). Becoming obvious I need to rework the way
ackbuilder deals with lists.
2016-07-30 00:39:22 +02:00
David Given 363d13cc2f C preprocessor; tabgen; now the pc86 boot.s builds using the ack
toolchain.
2016-07-29 00:22:49 +02:00
David Given 88bd7ce126 Remove defunct pmfiles.
--HG--
branch : default-branch
2016-06-03 13:56:50 +02:00
David Given 3d5e72e20b Newer versions of GNU Make have a new function which collides with a
variable we're using; change the name of the variable.
2015-03-22 12:09:46 +01:00
David Given 11377070fd Update distribution files.
--HG--
branch : dtrg-buildsystem
2013-05-15 23:46:15 +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 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
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 b611731ec3 Updated .distr files for the new release. 2007-02-25 12:51:55 +00:00
dtrg 611bc73043 Changed to no longer include /usr/include by default. 2007-02-20 00:36:15 +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 606012371e Added support for the ANSI C language runtime and preprocessor. 2006-07-30 23:45:18 +00:00
dtrg 45b4fef7d6 Rationalised use of #includes to be more standards-compliant. 2006-07-30 23:40:35 +00:00
dtrg 8558656665 Now avoids piping shell scripts into a new instance of sh, instead
using a subshell.
2006-07-26 12:29:47 +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 e859ef2491 Rationalised use of #includes to be more standards-compliant. 2006-07-19 10:28:43 +00:00
dtrg 454bdae81f Added the appropriate #! magic at the beginning of shell scripts. (Some modern shells don't like scripts to be without it.) 2006-07-18 16:45:57 +00:00
cvs2hg 5cb054f106 fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
ceriel 91cb060d10 Replaced a couple of UnGetChar calls with ChPushBack calls. The
UnGetChar call is wrong after skipspaces().
1998-02-09 09:49:00 +00:00
ceriel 7b207deeb7 use stdarg when compiling with ANSI C compiler 1995-08-17 16:43:36 +00:00
ceriel f069cba449 Made arith_sign more portable 1995-03-28 09:10:31 +00:00
ceriel 86cb2d66d7 Fixed: % and / were interchanged 1995-03-27 11:46:47 +00:00