Commit graph

1882 commits

Author SHA1 Message Date
George Koehler b00a2c906d Build fdopen(), hypot(), putenv() in libc.
These functions are in POSIX; hypot() is in C99.  Also build cabs()
because it rides with hypot(), but don't declare cabs() in any header
file, because our compiler can't parse C99 "double complex" type.

Touch build.lua so it sees that .c files moved.
2017-10-28 13:33:57 -04:00
David Given 60e7d06d82 Ansification and warning fixes. 2017-08-06 11:58:36 +02:00
David Given a1043bc5fe Attempt to correct file system case sensitivity. 2017-08-06 11:15:53 +02:00
David Given fd10cf7ac2 Merge from trunk. 2017-08-06 10:42:16 +02:00
David Given a9f19a2a31 Merge. 2017-08-05 21:47:40 +02:00
David Given 064fd52d52 Update man page not to mention the filename length restriction removed in
893471a42e.
2017-08-02 00:07:51 +02:00
David Given f2e3d7b38c Don't define functions called itoa(), because this causes problems on platforms
that define itoa() in their libcs.
2017-07-23 21:19:07 +02:00
George Koehler f91bc2804d Tune the installed manual pages.
This commit slightly improves the formatting of the manuals.  My
OpenBSD machine uses mandoc(1) to format manuals.  I check the manuals
with `mandoc -T lint` and fix most of the warnings.  I also make
other changes where mandoc didn't warn me.

roff(7) says, "Each sentence should terminate at the end of an input
line," but we often forgot this rule.  I insert some newlines after
sentences that had ended mid-line.

roff(7) also says that blank lines "are only permitted within literal
contexts."  I delete blank lines.  This removes some extra blank lines
from mandoc's output.  If I do want a blank line in the output, I call
".sp 1" to make it in man(7).  If I want a blank line in the source,
but not the output, I put a plain dot "." so roff ignores it.

Hyphens used for command-line options, like \-a, should be escaped by
a backslash.  I insert a few missing backslashes.

mandoc warns if the date in .TH doesn't look like a date.  Our manuals
had a missing date or the RCS keyword "$Revision$".  Git doesn't
expand RCS keywords.  I put in today's date, 2017-01-18.

Some manuals used tab characters in filled mode.  That doesn't work.
I use .nf to turn off filled mode, or I use .IP in man(7) to make the
indentation without a tab character.

ack(1) defined a macro .SB but never used it, so I delete the
definition.  I also remove a call to the missing macro .RF.

mandoc warns about empty paragraphs.  I deleted them.  mandoc also
warned about these macro pairs in anm(1):

    .SM
    .B text

The .SM did nothing because the .B text is on a different line.  I
changed each pair to .SB for small bold text.

I make a few other small changes.
2017-01-18 23:02:30 -05:00
David Given b32be06881 Allow the full 8-bit byte range when reading program source. 2017-01-15 22:41:11 +01:00
David Given 5ff983ad9b Increase the number of items in a char set from 128 to 256, to cover all
possible bytes (7-bit bytes are so 70s).
2017-01-15 22:30:25 +01:00
David Given fd83b09c58 Fix typo. 2017-01-08 18:53:59 +01:00
David Given 612e14b4b4 Improve confusing error message when calling function procedures from a
top-level statement.

Fixes: #30
2017-01-08 11:25:57 +01:00
David Given ee5ef73dfb Run through clang-format. 2017-01-08 11:23:56 +01:00
David Given 893471a42e No longer truncate module names at 10 characters when constructing paths;
rename some library modules to their full names.
2017-01-07 23:00:52 +01:00
David Given d50a6f99de Run through clang-format. 2017-01-07 22:56:00 +01:00
David Given 9945b019d2 Add a B man page. 2017-01-07 22:35:02 +01:00
David Given 5a38ce2a69 Pre-and-post-modification operators now work substantially better (i.e.,
working).
2017-01-07 18:46:03 +01:00
David Given 77fc62285d Extern variables can now be written to. 2017-01-06 23:24:05 +01:00
David Given 62bc2ab97a Jump tables for switch now go in ROM (required by the EM spec). Forward gotos
now work.
2017-01-01 23:28:41 +00:00
David Given 8b8910595a Add proper support for negative constants in external initialisers. 2017-01-01 17:56:53 +00:00
David Given 049aff9f33 Remove the negative-constant code from the compiler; I think it's going to
break a=-1 (with no spaces). Backed out changeset dead3363ac7d.
2017-01-01 17:44:55 +00:00
David Given 374e7a1c57 Add support for the ~ operator. 2017-01-01 17:40:06 +00:00
David Given b1576e2c77 Add support for negative constants in external initialisers. 2016-12-31 19:43:03 +00:00
David Given a01523a893 Allow programs to override binit() (so they can register their own modules). 2016-12-31 17:39:51 +00:00
David Given 803b81e3f4 Add support for the xor operator. 2016-12-31 17:36:12 +00:00
David Given c3e1ef1064 B patch table names shouldn't be in the B symbol namespace. 2016-12-31 00:14:28 +00:00
David Given fa02a855e8 Fix issue where !x was actually calculating !!x. 2016-12-31 00:14:04 +00:00
David Given ebd424e7f1 First draft of the B module code; a module name can now be specified as a
compiler flag, which is used to set the name of the patch table. The compiler
now understands C preprocessor line directives. Extend the standard library
somewhat.
2016-12-29 17:10:21 +00:00
David Given e50f4be710 Merge from default. 2016-12-26 19:44:48 +00:00
David Given c569ca15d8 Clean up how the language libraries refer to plat headers; they should be using
the +pkg forms of the rules and getting the headers via the paths in descr,
rather than depending on the +headers version.
2016-12-05 21:05:24 +01:00
David Given bbcc08a6b6 Fix putchar() return value. 2016-11-28 21:38:46 +01:00
David Given 9f34262f95 Implement enough libb to make 'Hello, world!' work. 2016-11-27 22:05:15 +01:00
David Given b9665c7c99 Fix some basic showstopping bugs; compilation now works up to failing to find
the libb standard library.
2016-11-27 21:08:14 +01:00
David Given 4485d89b23 Hook the B compiler up to the compiler driver. 2016-11-27 20:48:07 +01:00
David Given 5bce5fc4da Change the extension used by Basic files for .b to .bas, to avoid conflicts
with B.
2016-11-27 20:38:33 +01:00
David Given 707585b67d Perform initial (i.e. feature complete and compiling, but not necessarily
working) port of the B compiler to EM.
2016-11-27 20:28:19 +01:00
David Given cfc723250f Initial EM-ification; start threading word size stuff through the code. 2016-11-27 11:58:59 +01:00
David Given a69045c0e4 Import aap@github's B compiler. 2016-11-27 11:37:25 +01:00
David Given 3e69d1185a Fix a whole lot more stray prototypes. 2016-11-24 21:47:40 +01:00
David Given b8a2935f2b Fix more invalid prototypes of stdlib functions; build dependency fix. 2016-11-24 21:26:05 +01:00
David Given c084f9f224 Remove the Mark() and Release() procedures from the Pascal compiler and
standard library, because they never worked and come from an achingly old
version of the Pascal specification. Fix the implementations of New() and
Dispose() to use the standard C memory allocator rather than rolling their own
(also in C). Write test!
2016-11-24 20:35:26 +01:00
David Given 9481487e3d Implement calloc() (accidentally got dropped with the malloc rewrite). 2016-11-23 22:16:25 +01:00
David Given 745eb8f17b Now _errsym and _erlsym are defined in the standard library, don't define them
in the program.
2016-11-16 21:13:00 +01:00
David Given e9fe1d70a6 Fix (or at least, work around) an issue with library order. Make sure the Basic
error symbols are actually defined.
2016-11-13 13:28:09 +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
George Koehler 08f9869a63 Remove unused defines from lang/cem/libcc.ansi/math/localmath.h
This undoes part of bfeb736, and returns to using DBL_MAX_EXP and
DBL_MIN_EXP from float.h.

Add a dependency on math/localmath.h and other local header files so
libc is rebuilt when those headers change.
2016-11-06 15:49:47 -05:00
George Koehler 19ca28e22f Undo commit bfeb736 for lang/cem/libcc.ansi/headers/float.h
This restores the correct values of DBL_MAX, DBL_MIN_EXP, and related
constants.  This fixes some range checks within libc, causing
atof("-36e90") and atof("1.44e-288") to return the correct values.
2016-11-06 15:01:25 -05: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