ack.git
5 years agoMerge pull request #183 from kernigh/kernigh-include default
David Given [Sat, 23 Mar 2019 11:31:32 +0000 (12:31 +0100)]
Merge pull request #183 from kernigh/kernigh-include

Include headers to declare functions

5 years agoInclude more headers to declare functions.
George Koehler [Fri, 22 Mar 2019 19:15:40 +0000 (15:15 -0400)]
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>.

5 years agoRaise _XOPEN_SOURCE from 500 to 700
George Koehler [Fri, 22 Mar 2019 18:35:07 +0000 (14:35 -0400)]
Raise _XOPEN_SOURCE from 500 to 700

In OpenBSD, _XOPEN_SOURCE 500 forces _POSIX_C_SOURCE down to 199506,
which hides the declarations of openat() and fdopendir() and causes
compiler warnings.

Don't set _POSIX_C_SOURCE, because _XOPEN_SOURCE may set
_POSIX_C_SOURCE to a different value.

5 years agoInclude <fcntl.h> or <unistd.h>
George Koehler [Fri, 22 Mar 2019 18:19:02 +0000 (14:19 -0400)]
Include <fcntl.h> or <unistd.h>

This silences some clang warnings of implicit declarations of
functions.  The `register int` silences a warning of implicit int.

5 years agoUse %zu to print size_t count
George Koehler [Fri, 22 Mar 2019 18:09:50 +0000 (14:09 -0400)]
Use %zu to print size_t count

This silences a compiler warning.

5 years agoInclude <unistd.h> for lseek()
George Koehler [Fri, 22 Mar 2019 17:18:07 +0000 (13:18 -0400)]
Include <unistd.h> for lseek()

This unbreaks my build in OpenBSD.  The old `long lseek()` conflicts
with `off_t lseek()` in OpenBSD headers, because long and off_t are
different types.  Commit b4df26e caused "system.h" to include some
headers where OpenBSD declares lseek().

Manuals for lseek() say to #include <unistd.h>.  Do so to be portable
to systems where other headers don't declare lseek().

5 years agoMerge pull request #181 from ccodere/carl-ansi-part1
David Given [Wed, 20 Mar 2019 14:53:22 +0000 (15:53 +0100)]
Merge pull request #181 from ccodere/carl-ansi-part1

More ANSI C conversion

5 years ago* Bugfix of "rename" across volumes, now simply copies the file instead.
carl [Sun, 17 Mar 2019 15:19:16 +0000 (23:19 +0800)]
* Bugfix of "rename" across volumes, now simply copies the file instead.

5 years agoTry to update frontend driver.
carl [Sun, 17 Mar 2019 14:42:58 +0000 (22:42 +0800)]
Try to update frontend driver.

5 years ago+ ANSI C conversion
carl [Sun, 17 Mar 2019 14:42:20 +0000 (22:42 +0800)]
+ ANSI C conversion

5 years ago+ ANSI C conversion
carl [Sun, 17 Mar 2019 14:42:10 +0000 (22:42 +0800)]
+ ANSI C conversion

5 years ago+ ANSI C conversion
carl [Sun, 17 Mar 2019 14:42:00 +0000 (22:42 +0800)]
+ ANSI C conversion

5 years ago+ ANSI C conversion
carl [Sun, 17 Mar 2019 14:41:25 +0000 (22:41 +0800)]
+ ANSI C conversion

5 years ago+ Make it build with troff
carl [Sun, 17 Mar 2019 14:25:47 +0000 (22:25 +0800)]
+ Make it build with troff

5 years ago+ Have the DEBUG version compile
carl [Sun, 17 Mar 2019 14:24:54 +0000 (22:24 +0800)]
+ Have the DEBUG version compile

5 years ago+ Add sys_tmpnam() and sys_basename()
carl [Sun, 17 Mar 2019 14:23:56 +0000 (22:23 +0800)]
+ Add sys_tmpnam() and sys_basename()

5 years agoAddition of tmpnam system function.
carl [Sun, 17 Mar 2019 14:23:18 +0000 (22:23 +0800)]
Addition of tmpnam system function.

5 years ago+ Have the DEBUG version compile
carl [Sun, 17 Mar 2019 14:22:29 +0000 (22:22 +0800)]
+ Have the DEBUG version compile

5 years agoBetter type checking on function callback.
carl [Sun, 17 Mar 2019 14:22:19 +0000 (22:22 +0800)]
Better type checking on function callback.

5 years agoMerge pull request #177 from davidgiven/dtrg-8080
David Given [Mon, 11 Mar 2019 16:00:12 +0000 (17:00 +0100)]
Merge pull request #177 from davidgiven/dtrg-8080

i80: Better peephole optimiser rules

5 years agoDon't buffer overflow when trying to process source bytes with the high bit
David Given [Mon, 11 Mar 2019 13:50:30 +0000 (13:50 +0000)]
Don't buffer overflow when trying to process source bytes with the high bit
set.

5 years agoAdd a 'kill' pseudoinstruction to the 8080 assembler, which marks when the code
David Given [Fri, 8 Mar 2019 22:06:34 +0000 (23:06 +0100)]
Add a 'kill' pseudoinstruction to the 8080 assembler, which marks when the code
generator is finished with a register; use this to create some more effective
peephole optimiser rules.

5 years agoMerge pull request #174 from ccodere/carl-ansi-part1
David Given [Thu, 7 Mar 2019 19:51:08 +0000 (20:51 +0100)]
Merge pull request #174 from ccodere/carl-ansi-part1

Carl ansi part1

5 years ago+ Better type checking in function tables.
carl [Fri, 1 Mar 2019 17:41:01 +0000 (01:41 +0800)]
+ Better type checking in function tables.

5 years ago+ M2 Compiler ISO C90 compatibility
carl [Fri, 1 Mar 2019 17:39:25 +0000 (01:39 +0800)]
+ M2 Compiler ISO C90 compatibility
* Fixing of potential crash issue with function tables in compiler.
+ SYSTEM.h is now renamed to SYSTEMM2.h to avoid conflicts on non case sensitive filesystems.

5 years agoCPP ISO C90 compatibility and conversion.
carl [Fri, 1 Mar 2019 17:36:11 +0000 (01:36 +0800)]
CPP ISO C90 compatibility and conversion.

5 years agoBasic compiler is now ISO C90 compliant.
carl [Fri, 1 Mar 2019 17:35:09 +0000 (01:35 +0800)]
Basic compiler is now ISO C90 compliant.

5 years agoMerge pull request #173 from ccodere/carl-ansi-part1
David Given [Mon, 25 Feb 2019 22:23:04 +0000 (23:23 +0100)]
Merge pull request #173 from ccodere/carl-ansi-part1

Carl ansi part1

5 years agoFix issue again with wrong macro on error.
carl [Mon, 25 Feb 2019 16:46:10 +0000 (00:46 +0800)]
Fix issue again with wrong macro on error.

5 years ago* Fix more tabs.
carl [Mon, 25 Feb 2019 16:44:52 +0000 (00:44 +0800)]
* Fix more tabs.

5 years ago* Convert spaces -> tabs to keep consistency with existing code.
carl [Sat, 23 Feb 2019 17:15:23 +0000 (01:15 +0800)]
* Convert spaces -> tabs to keep consistency with existing code.

5 years ago* Remove some more compiler warnings.
carl [Sat, 23 Feb 2019 16:46:05 +0000 (00:46 +0800)]
* Remove some more compiler warnings.

5 years agoBugfix of fprint using correct output redirection (fix from last commit).
carl [Sat, 23 Feb 2019 16:45:35 +0000 (00:45 +0800)]
Bugfix of fprint using correct output redirection (fix from last commit).

5 years agoPascal compiler better type checking and function declarations (Better ISO C compatib...
carl [Sat, 23 Feb 2019 16:44:50 +0000 (00:44 +0800)]
Pascal compiler better type checking and function declarations (Better ISO C compatibility)

5 years agoMerge pull request #172 from ccodere/carl-ansi-part1
David Given [Wed, 20 Feb 2019 18:36:49 +0000 (19:36 +0100)]
Merge pull request #172 from ccodere/carl-ansi-part1

Carl ansi part1

5 years agoRemove unused variable.
carl [Wed, 20 Feb 2019 16:43:49 +0000 (00:43 +0800)]
Remove unused variable.

5 years agoRemove CMake changes and generic sed scripts so they are move to a separate branch.
carl [Wed, 20 Feb 2019 16:43:04 +0000 (00:43 +0800)]
Remove CMake changes and generic sed scripts so they are move to a separate branch.

5 years ago* Was trying to use the new system API which is not ready causing stack issues.
carl [Tue, 19 Feb 2019 16:44:32 +0000 (00:44 +0800)]
* Was trying to use the new system API which is not ready causing stack issues.

5 years ago+ Add missing files.
carl [Tue, 19 Feb 2019 16:32:19 +0000 (00:32 +0800)]
+ Add missing files.

5 years ago+ Add topgen
carl [Mon, 18 Feb 2019 16:48:21 +0000 (00:48 +0800)]
+ Add topgen

5 years agoBetter ANSI C compatibility and portability:
carl [Mon, 18 Feb 2019 16:44:39 +0000 (00:44 +0800)]
Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
+ Initial support for CMake

5 years agoBetter ANSI C compatibility and portability:
carl [Mon, 18 Feb 2019 16:44:19 +0000 (00:44 +0800)]
Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
.

5 years agoBetter ANSI C compatibility and portability:
carl [Mon, 18 Feb 2019 16:42:15 +0000 (00:42 +0800)]
Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
+ Scripts to generate compiler header is now sed based.

5 years ago+ Addition of scripts to generate compiler include files.
carl [Mon, 18 Feb 2019 16:40:51 +0000 (00:40 +0800)]
+ Addition of scripts to generate compiler include files.

5 years agoBetter ANSI C compatibility and portability:
carl [Mon, 18 Feb 2019 16:39:39 +0000 (00:39 +0800)]
Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
+ Initial support for CMake

5 years agoBetter ANSI C compatibility and portability:
carl [Mon, 18 Feb 2019 16:39:05 +0000 (00:39 +0800)]
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)

5 years agoBetter ANSI C compatibility and portability - part 1:
carl [Mon, 18 Feb 2019 16:37:52 +0000 (00:37 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.

5 years ago* Initial support of CMake
carl [Mon, 18 Feb 2019 16:37:26 +0000 (00:37 +0800)]
* Initial support of CMake

5 years ago* Initial support of CMake
carl [Mon, 18 Feb 2019 16:37:11 +0000 (00:37 +0800)]
* Initial support of CMake

5 years agoBetter ANSI C compatibility and portability - part 1:
carl [Mon, 18 Feb 2019 16:36:48 +0000 (00:36 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
+ Added support for sys_tmpdir for better portability.

5 years ago* Initial support of CMake
carl [Mon, 18 Feb 2019 16:35:32 +0000 (00:35 +0800)]
* Initial support of CMake

5 years agoBetter ANSI C compatibility and portability - part 1:
carl [Mon, 18 Feb 2019 16:35:24 +0000 (00:35 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.

5 years ago* Add missing header file.
carl [Mon, 18 Feb 2019 16:35:01 +0000 (00:35 +0800)]
* Add missing header file.

5 years ago* Initial support of CMake
carl [Mon, 18 Feb 2019 16:34:44 +0000 (00:34 +0800)]
* Initial support of CMake

5 years ago* Adapt to new sys_filesize prototype.
carl [Mon, 18 Feb 2019 16:34:24 +0000 (00:34 +0800)]
* Adapt to new sys_filesize prototype.

5 years ago* Initial support of CMake
carl [Mon, 18 Feb 2019 16:34:03 +0000 (00:34 +0800)]
* Initial support of CMake

5 years agoBetter ANSI C compatibility and portability - part 1:
carl [Mon, 18 Feb 2019 16:33:54 +0000 (00:33 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h (TMPDIR is no longer hard coded)

5 years ago* Initial support of CMake
carl [Mon, 18 Feb 2019 16:33:21 +0000 (00:33 +0800)]
* Initial support of CMake
+ Generation of header files is now made through a C program to make it more portable.

5 years agoBetter ANSI C compatibility and portability - part 1:
carl [Mon, 18 Feb 2019 16:32:48 +0000 (00:32 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h

5 years ago* Initial support of CMake
carl [Mon, 18 Feb 2019 16:32:17 +0000 (00:32 +0800)]
* Initial support of CMake

5 years agoBetter ANSI C compatibility and portability - part 1:
carl [Mon, 18 Feb 2019 16:31:58 +0000 (00:31 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h

5 years agoBetter ANSI C compatibility and portability - part 1:
carl [Mon, 18 Feb 2019 16:31:29 +0000 (00:31 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h

5 years agoBetter ANSI C compatibility and portability - part 1:
carl [Mon, 18 Feb 2019 16:30:47 +0000 (00:30 +0800)]
Better ANSI C compatibility and portability - part 1:
* Adapt to new sys_filesize prototype.

5 years agoBetter ANSI C compatibility and portability - part 1:
carl [Mon, 18 Feb 2019 16:30:35 +0000 (00:30 +0800)]
Better ANSI C compatibility and portability - part 1:
* Adapt to new sys_filesize prototype.

5 years agoBetter ANSI C compatibility and portability - part 1:
carl [Mon, 18 Feb 2019 16:30:01 +0000 (00:30 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h

5 years agoBetter ANSI C compatibility and portability - part 1:
carl [Mon, 18 Feb 2019 16:29:42 +0000 (00:29 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h

5 years agoFix typo.
David Given [Mon, 18 Feb 2019 10:04:23 +0000 (11:04 +0100)]
Fix typo.

5 years agoMinor improvements to the way types are expanded (should avoid embarassing ands
David Given [Sun, 17 Feb 2019 09:09:22 +0000 (10:09 +0100)]
Minor improvements to the way types are expanded (should avoid embarassing ands
with 0xff).

5 years agoMerge pull request #171 from davidgiven/dtrg-comparisons
David Given [Sat, 16 Feb 2019 00:23:27 +0000 (01:23 +0100)]
Merge pull request #171 from davidgiven/dtrg-comparisons

i80: a few more minor fixes

5 years agoAdd a few minor top optimisations.
David Given [Sat, 16 Feb 2019 00:18:31 +0000 (01:18 +0100)]
Add a few minor top optimisations.

5 years agoFix typo where I was confusing sbi and sui, with hilarious results.
David Given [Sat, 16 Feb 2019 00:18:21 +0000 (01:18 +0100)]
Fix typo where I was confusing sbi and sui, with hilarious results.

5 years agoMerge pull request #170 from davidgiven/dtrg-i169
David Given [Fri, 15 Feb 2019 22:56:00 +0000 (23:56 +0100)]
Merge pull request #170 from davidgiven/dtrg-i169

Fix driver crash when using -R

5 years agoFix memory corruption when using -R; the values being stored in the list
David Given [Fri, 15 Feb 2019 22:40:42 +0000 (23:40 +0100)]
Fix memory corruption when using -R; the values being stored in the list
weren't freeable when they should have been.

5 years agoReformat before editing.
David Given [Fri, 15 Feb 2019 22:24:10 +0000 (23:24 +0100)]
Reformat before editing.

5 years agoMerge pull request #168 from davidgiven/dtrg-i167
David Given [Fri, 15 Feb 2019 22:12:12 +0000 (23:12 +0100)]
Merge pull request #168 from davidgiven/dtrg-i167

i80: fix large stack frames

5 years agoLoading large constants now computes the stack offset correctly.
David Given [Fri, 15 Feb 2019 22:03:01 +0000 (23:03 +0100)]
Loading large constants now computes the stack offset correctly.

5 years agoGenerate the proper function prologues for big stack frames.
David Given [Fri, 15 Feb 2019 22:01:33 +0000 (23:01 +0100)]
Generate the proper function prologues for big stack frames.

5 years agoMerge pull request #166 from davidgiven/dtrg-comparisons
David Given [Fri, 15 Feb 2019 21:54:13 +0000 (22:54 +0100)]
Merge pull request #166 from davidgiven/dtrg-comparisons

i80: grabbag of optimisations

5 years agoCleanup.
David Given [Fri, 15 Feb 2019 21:26:14 +0000 (22:26 +0100)]
Cleanup.

5 years agoAdd rules for converting smallnconst2 and smallpconst2 to registers, to stop
David Given [Fri, 15 Feb 2019 21:20:07 +0000 (22:20 +0100)]
Add rules for converting smallnconst2 and smallpconst2 to registers, to stop
the conversion from happening via the stack. Star Trek goes from 39450 to 39384
bytes.

5 years agoUsing regpair instead of hl_or_de is not, in fact, safe until we've stopped
David Given [Fri, 15 Feb 2019 20:38:17 +0000 (21:38 +0100)]
Using regpair instead of hl_or_de is not, in fact, safe until we've stopped
using bc.

5 years agoFix nearly all the comparisons, a lot of which were broken. Using a rst for
David Given [Fri, 15 Feb 2019 20:30:27 +0000 (21:30 +0100)]
Fix nearly all the comparisons, a lot of which were broken. Using a rst for
unsigned comparisons is surprisingly not that useful due to marshalling
overhead; it's only four bytes to do inline (plus jc), or six for a constant.
Also add some useful top optimisations.  Star Trek goes from 39890 to 39450
bytes.

5 years agoCall cmps rather than cmpu for bge... make cmps and cmpu rsts. Apply various
David Given [Thu, 14 Feb 2019 23:38:39 +0000 (00:38 +0100)]
Call cmps rather than cmpu for bge... make cmps and cmpu rsts. Apply various
other tiny optimisations.

5 years agoUse nicely optimised helper tools to do signed comparisons of words. Star Trek
David Given [Thu, 14 Feb 2019 22:57:55 +0000 (23:57 +0100)]
Use nicely optimised helper tools to do signed comparisons of words. Star Trek
goes from 40452 to 39890 bytes.

5 years agoMerge pull request #165 from davidgiven/dtrg-b164
David Given [Thu, 14 Feb 2019 22:29:41 +0000 (23:29 +0100)]
Merge pull request #165 from davidgiven/dtrg-b164

i80: fix bad code in inl using faddrn

5 years agoFix bad helper tool invocation for inl with faddrn.
David Given [Thu, 14 Feb 2019 22:21:47 +0000 (23:21 +0100)]
Fix bad helper tool invocation for inl with faddrn.

5 years agoAdd failing test case.
David Given [Thu, 14 Feb 2019 22:19:11 +0000 (23:19 +0100)]
Add failing test case.

5 years agoMerge pull request #163 from davidgiven/dtrg-regmoves
David Given [Wed, 13 Feb 2019 23:13:41 +0000 (00:13 +0100)]
Merge pull request #163 from davidgiven/dtrg-regmoves

i80: fix pathological behaviour in asp

5 years agoTurns out that every time the compiler tried to do a stack retraction with asp,
David Given [Wed, 13 Feb 2019 23:05:08 +0000 (00:05 +0100)]
Turns out that every time the compiler tried to do a stack retraction with asp,
it would flush registers onto the stack. This stops it doing this. Star Trek
goes from 40779 to 40452 bytes.

5 years agoMerge pull request #161 from davidgiven/dtrg-faststack
David Given [Wed, 13 Feb 2019 21:56:18 +0000 (22:56 +0100)]
Merge pull request #161 from davidgiven/dtrg-faststack

i80: use helper functions for stack access

5 years agoMerge from default.
David Given [Wed, 13 Feb 2019 21:46:00 +0000 (22:46 +0100)]
Merge from default.

5 years agoInstead of using parameterised rsts for stack access, add a huge swathe of
David Given [Wed, 13 Feb 2019 21:45:22 +0000 (22:45 +0100)]
Instead of using parameterised rsts for stack access, add a huge swathe of
automatically built helper tools. Star Trek goes up from 40243 to 40779 bytes,
but should be a lot faster.

5 years agoDon't do weird things if files starting with a hyphen exist in the build
David Given [Wed, 13 Feb 2019 21:42:05 +0000 (22:42 +0100)]
Don't do weird things if files starting with a hyphen exist in the build
directory.

5 years agoMerge pull request #160 from davidgiven/dtrg-b159
David Given [Wed, 13 Feb 2019 20:16:06 +0000 (21:16 +0100)]
Merge pull request #160 from davidgiven/dtrg-b159

i80, powerpc, mips: fix issue with logical operations and signed small constants

5 years agoFix issue with logical operations and small signed constants which turned out
David Given [Wed, 13 Feb 2019 19:56:10 +0000 (20:56 +0100)]
Fix issue with logical operations and small signed constants which turned out
to affect multiple platforms.

5 years agoUpdate test case to provoke bug.
David Given [Wed, 13 Feb 2019 19:10:38 +0000 (20:10 +0100)]
Update test case to provoke bug.

5 years agoMerge pull request #158 from davidgiven/dtrg-b157
David Given [Tue, 12 Feb 2019 21:29:01 +0000 (22:29 +0100)]
Merge pull request #158 from davidgiven/dtrg-b157

i80: fix bad code in comparisons

5 years agoFix bad code generation due to not correctly flushing the stack before
David Given [Tue, 12 Feb 2019 21:19:07 +0000 (22:19 +0100)]
Fix bad code generation due to not correctly flushing the stack before
comparisons.

5 years agoAdded a test case for #157.
David Given [Tue, 12 Feb 2019 21:08:08 +0000 (22:08 +0100)]
Added a test case for #157.

5 years agoMerge pull request #154 from ccodere/buildfix
David Given [Tue, 12 Feb 2019 20:51:46 +0000 (21:51 +0100)]
Merge pull request #154 from ccodere/buildfix

Bugfix of compilation on gcc 4.8