Commit graph

1803 commits

Author SHA1 Message Date
carl 16f89747b1 ANSI C conversion. 2019-05-11 01:14:54 +08:00
carl fa2859df79 ANSI C conversion. 2019-05-11 01:14:01 +08:00
carl dfefbcae86 ANSI C conversion. 2019-05-11 01:13:43 +08:00
carl f9916fb680 Fix call to fwrite with proper parameters. 2019-05-11 01:12:48 +08:00
carl 2330d35ade * Fix compilation warning. 2019-05-11 00:49:10 +08:00
carl 715717a4f6 Read beyond buffer bugfix. 2019-03-31 00:53:09 +08:00
carl 496795f0cf Fix memory overflow error. 2019-03-26 00:59:16 +08:00
carl 415ec163a7 Fix tabs. 2019-03-26 00:58:36 +08:00
carl 5ec9de401d * More ANSI C portability fixes. 2019-03-24 23:53:13 +08:00
carl f7e4fac687 Revert "* Adapt to more ANSI C"
This reverts commit da0e0ac257.
2019-03-24 23:39:04 +08:00
carl a58ad2bc31 * Adapt to more ANSI C 2019-03-24 23:36:52 +08:00
carl da0e0ac257 * Adapt to more ANSI C 2019-03-24 23:35:59 +08:00
carl 56e64a1fd0 Merge remote-tracking branch 'upstream/default' into carl-ansi-part1
# Conflicts:
#	util/arch/archiver.c
#	util/led/finish.c
#	util/led/output.c
2019-03-24 21:42:56 +08:00
carl 9b6e1774ea ANSI C version
More portability fixes.
2019-03-24 17:37:49 +08:00
carl 7063301f8c Add additional defines for compilation. 2019-03-24 17:09:29 +08:00
carl 086a2ac9ab Add additional defines for compilation. 2019-03-24 17:09:12 +08:00
carl c5f5bace63 Add additional defines for compilation. 2019-03-24 17:08:45 +08:00
George Koehler bec236c108 Include more headers to declare functions.
This causes clang to give fewer warnings of implicit declarations of
functions.

In mach/pdp/cv/cv.c, rename wr_int2() to cv_int2() because it
conflicts with wr_int2() in <object.h>.

In util/ack, rename F_OK to F_TRANSFORM because it conflicts with F_OK
for access() in <unistd.h>.
2019-03-22 15:59:35 -04:00
George Koehler dd328215d8 Use %zu to print size_t count
This silences a compiler warning.
2019-03-22 14:09:50 -04:00
carl b3814af1ba * Bugfix of "rename" across volumes, now simply copies the file instead. 2019-03-17 23:19:16 +08:00
carl 8b525f59c3 + ANSI C conversion 2019-03-17 22:46:32 +08:00
carl 3ac4504a5a + ANSI C conversion 2019-03-17 22:46:32 +08:00
carl 5a18b85b3f + ANSI C conversion 2019-03-17 22:46:32 +08:00
carl 75909230c9 + ANSI C conversion 2019-03-17 22:46:32 +08:00
carl f7ba3eec50 Remove CMake changes and generic sed scripts so they are move to a separate branch. 2019-02-21 00:43:04 +08:00
carl d825e962ed Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
2019-02-19 00:54:24 +08:00
carl cc27fd471d Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
.
2019-02-19 00:54:23 +08:00
carl e70690c510 + Addition of scripts to generate compiler include files. 2019-02-19 00:54:23 +08:00
carl 910643ccbb Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
2019-02-19 00:54:23 +08:00
carl 10717cc791 Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
- Remove support for generating K&R code.
- Remove mkstemp and replace by tmpnam (more portable but less safe)
2019-02-19 00:54:23 +08:00
carl 42bbdec82d Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
2019-02-19 00:54:23 +08:00
carl f49a5a24f7 * Initial support of CMake 2019-02-19 00:54:23 +08:00
carl 58d0c33784 * Initial support of CMake 2019-02-19 00:54:23 +08:00
David Given 245478a030 Fix memory corruption when using -R; the values being stored in the list
weren't freeable when they should have been.
2019-02-15 23:40:42 +01:00
David Given e976e10708 Reformat before editing. 2019-02-15 23:24:10 +01:00
David Given 813595358c More common symbol removal. 2019-02-10 14:09:52 +01:00
David Given d37749750d More common symbol fixing. 2019-02-10 14:03:55 +01: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 c8c48221b3 Second try at removing common symbols. 2019-02-10 13:11:03 +01:00
David Given 8a7077d5a9 Change the way external symbols are defined to avoid COMMON symbols, which
don't work on OSX very well.
2019-02-10 12:57:22 +01:00
David Given 020e910560 Remember that we need to update the generated file in LLgen, as it's not
self-bootstrapping...
2019-02-10 12:38:33 +01:00
David Given 65e544c35a Don't prototype strcpy as it makes OSX sad. 2019-02-10 12:28:42 +01:00
David Given 9e2d45b301 Rename all files called 'aux.*' to something else; Windows can't handle them. 2019-02-09 00:02:41 +01:00
David Given 80bfbd17b7 Add missing file. 2019-02-07 23:01:10 +01:00
David Given 7473601172 Add the cpm emulator from Cowgol, modified to work with an 8080 emulator rather
than libz80ex; enable tests for cpm.
2019-02-07 22:39:57 +01:00
George Koehler 33c0573598 Remove code to calculate memory usage with sbrk().
In many systems, malloc() can allocate outside the brk area.  The
calculation with sbrk() misses those allocations.  When LLgen or ncgg
reported the memory usage, the value was probably too low.
2018-11-14 16:13:54 -05:00
George Koehler 1c8434e33a Switch led to malloc() and realloc().
Add USEMALLOC and enable it by default.  You can switch back to brk()
by removing `#define USEMALLOC` in memory.c.

USEMALLOC tells the allocator to use malloc() and realloc(), not
brk().  This might help systems where brk() doesn't work, or where
malloc() can allocate outside the brk area.

My build shows no changes in share/ack/examples (except hilo_bas.*).
2018-11-14 15:15:45 -05:00
George Koehler 4fdfa3177e Fix em_led -u name when memory allocator moves ALLOMODL.
Option -u was passing an offset from modulptr(0) in ALLOMODL to the
string in argv.  If entername() would move ALLOMODL to make room in
ALLOGCHR, then the offset would become invalid, so the string would
get lost.  This fix copies the string into ALLOMODL.

This was often not a problem because the initial size of ALLOGCHR in
mach.h is probably large enough for -u.  This became a problem when I
caused the initial allocations to fail, and then only because the B
runtime uses -u.
2018-11-14 12:35:38 -05:00
George Koehler f09f14cd4d Switch from long to size_t when allocating memory.
Also move the declarations of `incore` and `core_alloc` to "memory.h".
Also correct SYMDEBUG to SYMDBUG.  (I don't know if SYMDBUG works
because our build system never defines it.)

ind_t becomes an alias of size_t.  ind_t becomes unsigned, so I edit
some code that was using negative ind_t.  Some casts disappear, like
(long)sizeof(...) because the size is already a size_t.  There are
changes to overflow checks.  Callers with a size too big for size_t
must check it before calling the memory allocator.  An overflow check
of BASE + incr in memory.c sbreak() now happens on all platforms, not
only when a pointer is smaller than a long.

My build shows no changes in share/ack/examples (except hilo_bas.*
changing with every build).
2018-11-14 12:33:25 -05:00
George Koehler df855248a0 Move int to $(INSDIR)/bin/int
If $(INSDIR)/bin is in PATH, then the user can run both ack(1) and
int(1), like

    $ ack -mem22 -o prog prog.c
    $ int prog
2018-11-05 15:14:29 -05:00