Commit graph

1786 commits

Author SHA1 Message Date
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
David Given
bbb708717a Add the OPTIONS clause to the mcgg grammar; add an optional pass which converts
sequences of PUSHes to a single STACKADJUST followed by STOREs. This should
dramatically improve code on stack-unfriendly architectures like MIPS.
2018-09-22 11:19:00 +02:00
David Given
ba0849c87c Remove la; turns out that the assembler gets upset if you ask it to
generate more than one fixup per instruction (I think).
2018-09-14 11:30:15 +02:00
David Given
ac33bdd031 Clang-format before editing. 2018-09-14 09:28:35 +02:00
David Given
5264db860d Values are more useful shown in hex. 2018-09-11 23:17:09 +02:00
David Given
ee328a0572 Merge from default. 2018-09-09 18:58:07 +02:00
David Given
ec46643124 Allow the ELF processor flags to be set. Generate MIPS ELF executables, not
PowerPC ones.
2018-09-09 14:29:34 +02:00
David Given
5dfef6f180 Rework relocations again: add RELO2HI and RELO2HISAD for the high two bytes of
a word.
2018-09-09 14:11:11 +02:00
David Given
b3b7c684c6 Simplify MIPS relocations. Add RELS2 (for generic high-word relocations). Add
support for MIPS branch-and-jump relocations.
2018-09-09 12:23:59 +02:00
David Given
83cf1be6a8 mcgg now checks that registers have at most one type attribute set. 2018-09-03 22:03:57 +02:00
David Given
a023fd8591 Better error reporting for unterminated strings. 2018-09-02 18:55:44 +02:00
David Given
5f83fd85dc Don't try to use acct() on cygwin (which doesn't support it). Fixes: #111 2018-09-01 10:41:31 +02:00
David Given
205c8d0a35 Run through clang-format. 2018-06-23 23:46:44 +02:00
David Given
a0c6fea32c Replace fake-varargs, which doesn't work on 64-bit machines, with real varargs. 2018-06-22 22:29:52 +02:00
David Given
60b7d8de6e
Merge pull request #96 from kernigh/kernigh-emu-1
Fixes to build emulators, ass, int on OpenBSD
2018-06-20 22:30:01 +02:00
David Given
6ae38887a7 It appears that the parameter to lol technically has to be word aligned; having
a non-word aligned parameter is illegal (but most of the toolchain accepts it).
So, word align data structures for em22.
2018-06-12 20:54:15 +09:00
George Koehler
a000c62808 Get moncalls.c to compile on OpenBSD.
Remove some declarations (not all correct) and #include <errno.h>,
<time.h>, and <unistd.h> to get the correct declarations.

Disable mount(2), umount(2), and stime(2) because BSD (around
4.3BSD-Reno) lost compatibility with these Unix v7 functions.
2018-06-10 19:05:42 -04:00
George Koehler
250777d1ca Rename setmode() to set_mode() to avoid BSD prototype.
4.4BSD added a non-standard function setmode() to <unistd.h>; its
prototype is not compatible.
2018-06-10 19:04:51 -04:00