sod
3 years agolib/sod-hosted.c (sod_makev): Use two statements rather than tricky expression. master
Mark Wooding [Sat, 20 Feb 2021 22:48:56 +0000 (22:48 +0000)]
lib/sod-hosted.c (sod_makev): Use two statements rather than tricky expression.

Comes out shorter too.

3 years agolib/sod.h (sod_sublassp): Fix function description.
Mark Wooding [Sat, 20 Feb 2021 22:48:01 +0000 (22:48 +0000)]
lib/sod.h (sod_sublassp): Fix function description.

The corresponding comment in the implementation file is already correct.

3 years agosrc/parser/floc-proto.lisp: Use correct function for constructing conditions.
Mark Wooding [Sat, 20 Feb 2021 22:47:33 +0000 (22:47 +0000)]
src/parser/floc-proto.lisp: Use correct function for constructing conditions.

4 years agoconfigure.ac: Complicate ASDF version-number generation.
Mark Wooding [Mon, 7 Oct 2019 00:33:10 +0000 (01:33 +0100)]
configure.ac: Complicate ASDF version-number generation.

I've started prefixing a future-version-~ to development version
numbers, rather than maintenance pre-releases.  Adjust the ASDF version
synthesis to cope with this.

4 years agodebian/: Ship `symbols' file for better downstream dependency versioning.
Mark Wooding [Mon, 7 Oct 2019 00:13:57 +0000 (01:13 +0100)]
debian/: Ship `symbols' file for better downstream dependency versioning.

4 years agodebian/changelog: Prepare for next version.
Mark Wooding [Mon, 7 Oct 2019 00:06:25 +0000 (01:06 +0100)]
debian/changelog: Prepare for next version.

4 years agodebian/: Bump to Debhelper 10.
Mark Wooding [Mon, 7 Oct 2019 00:04:51 +0000 (01:04 +0100)]
debian/: Bump to Debhelper 10.

For some reason, the `compat' level and the `Build-Depends' bound were
inconsistent.  Oops.

4 years agoStatic instance support.
Mark Wooding [Sun, 6 Oct 2019 22:03:42 +0000 (23:03 +0100)]
Static instance support.

4 years agosrc/class-output.lisp: Leave `*instance-class*' unbound at top-level.
Mark Wooding [Sun, 6 Oct 2019 21:52:37 +0000 (22:52 +0100)]
src/class-output.lisp: Leave `*instance-class*' unbound at top-level.

4 years agosrc/class-make-{proto,impl}.lisp: Don't always add initializers to classes.
Mark Wooding [Sun, 6 Oct 2019 21:50:42 +0000 (22:50 +0100)]
src/class-make-{proto,impl}.lisp: Don't always add initializers to classes.

Add a switch `:add-to-class' to inhibit adding the new initializer
object to its class.

(The class is still necessary because it's in control of initializer
construction: otherwise I'd do this by passing a `nil' class.)

4 years agosrc/method-impl.lisp, etc.: Add a `readonly' message property.
Mark Wooding [Sun, 6 Oct 2019 21:41:42 +0000 (22:41 +0100)]
src/method-impl.lisp, etc.: Add a `readonly' message property.

If you have a `const' instance, it's useful to be able to send it
messages, so add a facility for marking messages as not modifying their
receivers.

4 years agosrc/method-{proto,impl}.lisp: Abstract out the receiver type.
Mark Wooding [Sun, 6 Oct 2019 21:35:47 +0000 (22:35 +0100)]
src/method-{proto,impl}.lisp: Abstract out the receiver type.

The code used to just assume that receiver (`me') arguments had type
`CLASS *'.  This is about to change...

4 years agoc-types-proto.lisp (canonify-qualifiers): Delete `nil' entries.
Mark Wooding [Sun, 6 Oct 2019 21:26:27 +0000 (22:26 +0100)]
c-types-proto.lisp (canonify-qualifiers): Delete `nil' entries.

Now you can decide whether to include a qualifier by saying `(and COND
:const)' or similar, and the `nil' if COND is false will be swept under
the rug.

4 years agodoc/list-exports: Use `documentation' to find more categories.
Mark Wooding [Sun, 6 Oct 2019 21:24:58 +0000 (22:24 +0100)]
doc/list-exports: Use `documentation' to find more categories.

4 years agodoc/check-docs (scansyms): Stop trying to parse at `Leaked slot names'.
Mark Wooding [Sun, 6 Oct 2019 21:24:13 +0000 (22:24 +0100)]
doc/check-docs (scansyms): Stop trying to parse at `Leaked slot names'.

4 years agodoc/output.tex: Add a missing member reference in vtable initializer.
Mark Wooding [Sun, 6 Oct 2019 23:17:59 +0000 (00:17 +0100)]
doc/output.tex: Add a missing member reference in vtable initializer.

4 years agodoc/: Switch to a manually maintained bibliography database.
Mark Wooding [Sat, 24 Aug 2019 23:12:46 +0000 (00:12 +0100)]
doc/: Switch to a manually maintained bibliography database.

Actually, the database is maintained mostly by Emacs's BibTeX mode.  In
particular, I (mostly) allow it to choose the citation keys, rather than
using Beebe's somewhat annoying key format, so hack up the document to
match.

4 years agoconfigure.ac, doc/Makefile.am: Ship the bibliography style.
Mark Wooding [Sat, 24 Aug 2019 23:41:27 +0000 (00:41 +0100)]
configure.ac, doc/Makefile.am: Ship the bibliography style.

Well, the machinery to generate one, anyway.

4 years agodebian/: Fix build-dependencies for building the manual.
Mark Wooding [Sat, 24 Aug 2019 20:58:59 +0000 (21:58 +0100)]
debian/: Fix build-dependencies for building the manual.

4 years agoconfigure.ac, doc/Makefile.am: Overhaul LaTeX building.
Mark Wooding [Sat, 24 Aug 2019 20:54:08 +0000 (21:54 +0100)]
configure.ac, doc/Makefile.am: Overhaul LaTeX building.

Check to see whether all of the things we need are available: don't try
to build the manual unless we have them.

4 years agodoc/sod.tex: Print the build version in the inside header.
Mark Wooding [Sat, 24 Aug 2019 16:18:18 +0000 (17:18 +0100)]
doc/sod.tex: Print the build version in the inside header.

4 years agodoc/...: Fix `\textbar' properly, and use plain `|'.
Mark Wooding [Sat, 24 Aug 2019 16:14:51 +0000 (17:14 +0100)]
doc/...: Fix `\textbar' properly, and use plain `|'.

The `\grammar' command wasn't the right place to hack this, since
`\syntax' also needs fixing.  Instead, patch `\syn@shorts' to do the
right thing.

Once this is done, use `|' rather than `@|' in syntax displays (not the
Lisp ones!).  Also, use text rather than maths spacing consistently, by
replacing `$| \cdots |$' with `| $\cdots$ |' throughout.

4 years agodoc/sod.sty: Don't convert `_' to `-' in `\descref' text.
Mark Wooding [Sat, 24 Aug 2019 16:11:34 +0000 (17:11 +0100)]
doc/sod.sty: Don't convert `_' to `-' in `\descref' text.

The conversion is necessary in the label, but not the text.

4 years agodoc/output.tex: Replace the old output-item comments with big tables.
Mark Wooding [Fri, 23 Aug 2019 12:01:41 +0000 (13:01 +0100)]
doc/output.tex: Replace the old output-item comments with big tables.

Now the output structure is actually documented (somewhat) properly.
All I have to do is keep the tables up-to-date somehow.

4 years agodoc/output.tex: Fix synopsis for `sequence-output' macro.
Mark Wooding [Sat, 24 Aug 2019 10:07:21 +0000 (11:07 +0100)]
doc/output.tex: Fix synopsis for `sequence-output' macro.

4 years agodoc/sod.sty: Reintroduce toplevel `\kill' into `prog' environment.
Mark Wooding [Fri, 23 Aug 2019 12:00:49 +0000 (13:00 +0100)]
doc/sod.sty: Reintroduce toplevel `\kill' into `prog' environment.

Annoyingly, `longtable' steals `\kill' for its own purposes.  Put it
back when we want it.

4 years agodoc/sod.sty: Reformat `\@prog' so that we can add more stuff.
Mark Wooding [Fri, 23 Aug 2019 12:00:27 +0000 (13:00 +0100)]
doc/sod.sty: Reformat `\@prog' so that we can add more stuff.

4 years agodoc/sod.tex: Include `longtable'.
Mark Wooding [Fri, 23 Aug 2019 11:59:25 +0000 (12:59 +0100)]
doc/sod.tex: Include `longtable'.

We're going to need it.

4 years agodoc/sod.tex: Leave a space for an `\includeonly' directive.
Mark Wooding [Fri, 23 Aug 2019 11:58:54 +0000 (12:58 +0100)]
doc/sod.tex: Leave a space for an `\includeonly' directive.

4 years agodoc/sod.tex: Cope if `\pkgversion' isn't defined.
Mark Wooding [Fri, 23 Aug 2019 11:57:45 +0000 (12:57 +0100)]
doc/sod.tex: Cope if `\pkgversion' isn't defined.

4 years agosrc/method-proto.lisp: Reflow a docstring paragraph.
Mark Wooding [Thu, 22 Aug 2019 23:42:06 +0000 (00:42 +0100)]
src/method-proto.lisp: Reflow a docstring paragraph.

4 years agosrc/class-output.lisp: Add docstrings to the `hook-output' methods.
Mark Wooding [Thu, 22 Aug 2019 23:39:07 +0000 (00:39 +0100)]
src/class-output.lisp: Add docstrings to the `hook-output' methods.

4 years agosrc/class-output.lisp: Split up `hook-output' on `sod-class' and `:h'.
Mark Wooding [Thu, 22 Aug 2019 22:44:07 +0000 (23:44 +0100)]
src/class-output.lisp: Split up `hook-output' on `sod-class' and `:h'.

Introduce five new generic functions to carry most of the load.  The
remaining `hook-output' functions all seem simple enough to be replaced
as necessary.

4 years agosrc/class-output.lisp: Replace `Classes' with a more helpful title.
Mark Wooding [Thu, 22 Aug 2019 21:49:10 +0000 (22:49 +0100)]
src/class-output.lisp: Replace `Classes' with a more helpful title.

4 years agosrc/output-proto.lisp, etc. (hook-output): Use standard combination.
Mark Wooding [Thu, 22 Aug 2019 12:05:00 +0000 (13:05 +0100)]
src/output-proto.lisp, etc. (hook-output): Use standard combination.

This will let subclasses selectively override portions of the basic
output machinery.

The existing implicit traversal is now done via `:after' methods.
Existing hook methods which engaged custom traversal have been split out
into separate `:after' methods so that they don't get overridden by
accident.

The main output-class-to-header method (i.e., `hook-output' specialized
on `sod-class' and `(eql :h)') is huge and could usefully be split into
smaller pieces which can be overridden separately.

4 years agosrc/module-parse.lisp (code): Allow setting constraints without a fragment.
Mark Wooding [Thu, 22 Aug 2019 12:03:52 +0000 (13:03 +0100)]
src/module-parse.lisp (code): Allow setting constraints without a fragment.

Add new syntax for adding constraints to the output sequencer without
actually producing any output at all.

4 years agosrc/module-parse.lisp (code): Prepare for an additional variant.
Mark Wooding [Thu, 22 Aug 2019 12:00:18 +0000 (13:00 +0100)]
src/module-parse.lisp (code): Prepare for an additional variant.

Some more minor refactoring: pull NAME [CONSTRAINTS] `{' FRAGMENT
`}' into an `or' subitem.

4 years agosrc/module-parse.lisp (code): Hoist complex sub-items out of main parser.
Mark Wooding [Thu, 22 Aug 2019 11:58:53 +0000 (12:58 +0100)]
src/module-parse.lisp (code): Hoist complex sub-items out of main parser.

4 years agodoc/syntax.tex: Give the REASON in a `code' definition a name.
Mark Wooding [Thu, 22 Aug 2019 11:54:50 +0000 (12:54 +0100)]
doc/syntax.tex: Give the REASON in a `code' definition a name.

4 years agodebian/control: Replace ancient `${Source-Version}' substitution.
Mark Wooding [Tue, 20 Aug 2019 19:52:07 +0000 (20:52 +0100)]
debian/control: Replace ancient `${Source-Version}' substitution.

4 years agoMakefile.am, test/Makefile.am: Add missing cleaning.
Mark Wooding [Tue, 20 Aug 2019 19:48:16 +0000 (20:48 +0100)]
Makefile.am, test/Makefile.am: Add missing cleaning.

4 years agotest/Makefile.am: Make the stanzas more consistent.
Mark Wooding [Tue, 20 Aug 2019 19:39:18 +0000 (20:39 +0100)]
test/Makefile.am: Make the stanzas more consistent.

We now have

  * TESTS
  * check_PROGRAMS
  * EXTRA_DIST
  * nodist_mumble_SOURCES
  * BUILT_SOURCES
  * mumble.out
  * check-local
  * -include
  * CLEANFILES

in that order.

4 years agotest/Makefile.am: Disentangle `test' from `bad', and `rat' from `kwbench'.
Mark Wooding [Tue, 20 Aug 2019 19:37:41 +0000 (20:37 +0100)]
test/Makefile.am: Disentangle `test' from `bad', and `rat' from `kwbench'.

Ugh!

4 years agotest/Makefile.am: Distribute `bad.sod' and `bad.ref'.
Mark Wooding [Tue, 20 Aug 2019 19:27:05 +0000 (20:27 +0100)]
test/Makefile.am: Distribute `bad.sod' and `bad.ref'.

Oops.

4 years agoReorganize some of the more random files.
Mark Wooding [Wed, 21 Aug 2019 13:41:27 +0000 (14:41 +0100)]
Reorganize some of the more random files.

  * Move `sod.m4' and `sod.pc' into `lib/', because they're concerned
    with the C library.

  * Move `asdf-hack.lisp' and `emacs-hacks.el' into `src/', because
    they're concerned with Lisp.

4 years agosod.m4: The ACTION-IF-LIBRARY-FOUND should replace the default.
Mark Wooding [Wed, 21 Aug 2019 13:36:01 +0000 (14:36 +0100)]
sod.m4: The ACTION-IF-LIBRARY-FOUND should replace the default.

This is the behaviour I documented, but I failed to update the code to
match.

4 years agosod.m4: Provide an Autoconf snippet for dependent packages.
Mark Wooding [Tue, 20 Aug 2019 18:35:08 +0000 (19:35 +0100)]
sod.m4: Provide an Autoconf snippet for dependent packages.

4 years agovars.am: Add missing `-M' in suffix-rules command.
Mark Wooding [Tue, 20 Aug 2019 16:05:50 +0000 (17:05 +0100)]
vars.am: Add missing `-M' in suffix-rules command.

4 years agosrc/parser/parser-proto.lisp: Fix bogus indentation.
Mark Wooding [Tue, 20 Aug 2019 14:03:58 +0000 (15:03 +0100)]
src/parser/parser-proto.lisp: Fix bogus indentation.

4 years agosrc/lexer-{proto,impl}.lisp, src/pset-parse.lisp: Other C operators.
Mark Wooding [Tue, 20 Aug 2019 01:34:14 +0000 (02:34 +0100)]
src/lexer-{proto,impl}.lisp, src/pset-parse.lisp: Other C operators.

Add almost all of the familiar C operators.  Some of these need their
own tokens added.  There's a lexical gotcha now, since `x << y' and
`x < < y ...' mean different things: the former parses as `x shift-
left-by y', while the latter parses as `x is-less-than some-type-
beginning-with-y'.

4 years agodoc/syntax.tex: Reformat the various grammar fragments.
Mark Wooding [Tue, 20 Aug 2019 10:30:52 +0000 (11:30 +0100)]
doc/syntax.tex: Reformat the various grammar fragments.

  * Move the prose descriptions to the final case (e.g., for
    <string-literal-char> and <char-literal-char>).

  * Present alternatives on a single line where possible.

  * Use centre-level dots consistently to denote elisions of
    alternatives.

  * Space alternatives consistently.

4 years agodoc/refintro.tex: Explain what parentheses mean in production rules.
Mark Wooding [Tue, 20 Aug 2019 11:27:30 +0000 (12:27 +0100)]
doc/refintro.tex: Explain what parentheses mean in production rules.

They're used in the actual grammar, so this is probably a good idea.

4 years agodoc/refintro.tex: Split the syntax notation into subsections.
Mark Wooding [Tue, 20 Aug 2019 11:26:50 +0000 (12:26 +0100)]
doc/refintro.tex: Split the syntax notation into subsections.

I'd be happier if these were subsubsections, honestly.

4 years agodoc/refintro.tex: Fix indexed-nonterminal argument abbreviation.
Mark Wooding [Tue, 20 Aug 2019 11:24:32 +0000 (12:24 +0100)]
doc/refintro.tex: Fix indexed-nonterminal argument abbreviation.

The thing with the unfinished ellipsis causes a very unpleasant effect
where dots at different heights are separated only by a comma.
Reluctantly, I fix this by replacing the nearly approachable `\$alpha |
\beta | ...' notation with numeric superscripts.

4 years agodoc/refintro.tex: Hoist $\epsilon$ to the top of the metasyntax section.
Mark Wooding [Tue, 20 Aug 2019 11:23:17 +0000 (12:23 +0100)]
doc/refintro.tex: Hoist $\epsilon$ to the top of the metasyntax section.

It's important, and liable to be lost otherwise.

4 years agodoc/Makefile.am: Add missing entry for `refintro.tex'.
Mark Wooding [Tue, 20 Aug 2019 11:28:01 +0000 (12:28 +0100)]
doc/Makefile.am: Add missing entry for `refintro.tex'.

4 years agosrc/pset-parse.lisp: Replace `dispatch' by some more elementary functions.
Mark Wooding [Tue, 20 Aug 2019 01:31:25 +0000 (02:31 +0100)]
src/pset-parse.lisp: Replace `dispatch' by some more elementary functions.

This turns out to be an overall saving in terms of lines of code, as
well as being more versatile.  The price is that we've lost the specific
per-operator type mismatch error, but I think that's worth paying.

Somewhat sneakily, I've also fiddled with the operator precedence
numbers, so as to leave more space for other operators, though the
relative precedences are unchanged.

4 years agosrc/pset-parse.lisp: Add a little vertical space and commentary.
Mark Wooding [Tue, 20 Aug 2019 01:26:17 +0000 (02:26 +0100)]
src/pset-parse.lisp: Add a little vertical space and commentary.

4 years agosrc/pset-parse.lisp: Parse and evaluate expressions in two separate steps.
Mark Wooding [Tue, 20 Aug 2019 01:04:16 +0000 (02:04 +0100)]
src/pset-parse.lisp: Parse and evaluate expressions in two separate steps.

Previously, we'd parse and evaluate expressions in an interleaved
fashion: the items on the parser's value stack were (TYPE . VALUE)
pairs, fully evaluated.

This causes a couple of problems.

  * Firstly, and most obviously, it means that we can't have operators
    which perform short-circuit evaluation -- sometimes failing to
    evaluate their operands.  This doesn't seem like such a big deal:
    after all, we don't have any assignment operators.  But we /do/ have
    an escape to Lisp's `eval' function via the `?' SEXP primary, and
    evaluating Lisp can have arbitrary side-effects.

  * Secondly, it makes error handling more annoying.  There's logic
    throughout for reporting continuable errors and then returning a
    `:invalid' marker.  This logic is currently concentrated in the
    internal `dispatch' function, but continuing to maintain this
    convention if and when we crack open `dispatch' to implement more
    complex operators would be messy.  (I know: I've tried it.)

Deferring evaluation to a second pass solves both problems.  Control-
flow operators can just decide not to evaluate operands they're not
interested in.  And errors can be caught and turned into an immediate
return from the `parse-expression' toplevel.  (The `:invalid' convention
is still part of the external interface, for good reason, but it we can
just use Lisp's non-local control flow forms inside.)

The way this works is unsurprising.  The `value' stack now holds thunks
which will calculate and return their values when invoked.  Operators
close over the thunks for their operands and produce a new thunk which
will call the operand thunks as required to calculate their result.  The
handling of `:invalid' in `dispatch' can be eliminated in favour of a
`restart-case' form around invoking the final value thunk.

The only remaining clever footwork is in `?' SEXP: if there's a read-
time error then we yields a thunk which immediately escapes and returns
`:invalid' from the toplevel.  (We do this using `continue' on the
grounds that the read error has already been reported -- along,
probably, with a lot of knock-on parse errors while we try to
resynchronize with the source.)

4 years agosrc/pset-parse.lisp: Remove the pointless `flet' function.
Mark Wooding [Mon, 19 Aug 2019 19:48:41 +0000 (20:48 +0100)]
src/pset-parse.lisp: Remove the pointless `flet' function.

It's only used once and doesn't achieve very much of use.

4 years agosrc/pset-parse.lisp: Bring `dispatch' within `parse-expression'.
Mark Wooding [Mon, 19 Aug 2019 19:44:32 +0000 (20:44 +0100)]
src/pset-parse.lisp: Bring `dispatch' within `parse-expression'.

There's nothing to be gained from keeping it outside: the `expr' parser
caching works on entry to the parser, rather than once only.

4 years agosrc/parser/parser-expr-proto.lisp: Get `expr' to cache operators.
Mark Wooding [Tue, 13 Aug 2019 09:56:14 +0000 (10:56 +0100)]
src/parser/parser-expr-proto.lisp: Get `expr' to cache operators.

Add a new feature to `expr': if you write the operator parsers in a
special way, it will cache the operator objects around the whole
parser.  Use this in the property-set expression parser.  (Admittedly,
it previously cached the operators at load time, but there's an upcoming
change which will prevent this anyway.)

4 years agosrc/pset-proto.lisp: Print type names in lowercase in error messages.
Mark Wooding [Mon, 12 Aug 2019 10:14:43 +0000 (11:14 +0100)]
src/pset-proto.lisp: Print type names in lowercase in error messages.

4 years agosrc/pset-impl.lisp: Accept `yup' and `nope' as booleans.
Mark Wooding [Mon, 12 Aug 2019 10:14:01 +0000 (11:14 +0100)]
src/pset-impl.lisp: Accept `yup' and `nope' as booleans.

I may draw the line at `yarp' and `narp'.

4 years agosrc/pset-impl.lisp: Convert strings to booleans using a hash-table.
Mark Wooding [Mon, 12 Aug 2019 10:12:55 +0000 (11:12 +0100)]
src/pset-impl.lisp: Convert strings to booleans using a hash-table.

4 years agosrc/: Use gender-neutral language in commentary.
Mark Wooding [Mon, 12 Aug 2019 10:10:32 +0000 (11:10 +0100)]
src/: Use gender-neutral language in commentary.

4 years agosrc/frontend.lisp: Remove unnecessary `:shadowing-import-from'.
Mark Wooding [Mon, 12 Aug 2019 10:09:03 +0000 (11:09 +0100)]
src/frontend.lisp: Remove unnecessary `:shadowing-import-from'.

When I unified the two `int' symbols, I forgot that this would have been
necessary.

4 years agodoc/syntax.tex: Clarify the term `root class'.
Mark Wooding [Mon, 12 Aug 2019 10:08:23 +0000 (11:08 +0100)]
doc/syntax.tex: Clarify the term `root class'.

4 years agodoc/syntax.tex: Fix source formatting.
Mark Wooding [Mon, 12 Aug 2019 10:07:58 +0000 (11:07 +0100)]
doc/syntax.tex: Fix source formatting.

4 years agodoc/clang.tex: Remove redundant `\textbf{...}' inside `\thd'.
Mark Wooding [Sat, 10 Aug 2019 23:07:26 +0000 (00:07 +0100)]
doc/clang.tex: Remove redundant `\textbf{...}' inside `\thd'.

I noticed that I have a rather unpleasantly clone-and-hacked `\thd'
macro which already sets its argument in boldface; so there's no point
in emboldening it further.

4 years agoRecognize the <stdint.h> integer types.
Mark Wooding [Sat, 10 Aug 2019 21:40:17 +0000 (22:40 +0100)]
Recognize the <stdint.h> integer types.

There's a lot of these, and writing the whole lot out by hand is really
much less rewarding than writing a variety of Cartesian-product-
expanding programs.  The really fun part was the TeX version...

4 years agodoc/clang.tex: Squish the `\desclabel' mess for simple C types.
Mark Wooding [Sat, 10 Aug 2019 21:39:13 +0000 (22:39 +0100)]
doc/clang.tex: Squish the `\desclabel' mess for simple C types.

No idea why I tolerated all of the `c-type-MUMBLE' repetition the first
time.

4 years agotest/kwbench.c, etc.: Tidy up and publish the keyword benchmark I used.
Mark Wooding [Sat, 10 Aug 2019 16:28:58 +0000 (17:28 +0100)]
test/kwbench.c, etc.: Tidy up and publish the keyword benchmark I used.

4 years agosrc/module-impl.lisp, src/module-parse.lisp: Set module environment better.
Mark Wooding [Sat, 10 Aug 2019 13:46:32 +0000 (14:46 +0100)]
src/module-impl.lisp, src/module-parse.lisp: Set module environment better.

Previously, `read-module' halfheartedly set `*package*' and
`*readtable*'.  Do better, by setting lots of influential variables as
module variables with appropriate initial values.

4 years agosrc/utilities.lisp, doc/misc.tex: Fix up `find-duplicates'.
Mark Wooding [Sat, 10 Aug 2019 02:11:21 +0000 (03:11 +0100)]
src/utilities.lisp, doc/misc.tex: Fix up `find-duplicates'.

  * Fix the inconsistent ordering behaviour which was the cause of a
    recent bug.  The implementation for lists is rather ugly, but it
    works without consing, which is a bonus.

  * Document the ordering behaviour.  And warn users away from non-
    hash-table-friendly `:test' functions more firmly, especially on
    lists.

4 years agosrc/class-finalize-impl.lisp: Check for duplicates with the right `:test'.
Mark Wooding [Sat, 10 Aug 2019 00:17:00 +0000 (01:17 +0100)]
src/class-finalize-impl.lisp: Check for duplicates with the right `:test'.

I noticed that Sod failed to diagnose a class containing duplicate slot
names.  Thinking that this was a stupid omission, I kludged a check into
`make-sod-slot' (and a matching check into `make-sod-message'), thinking
that it seemed rather difficult to provide a proper location of the
existing definition.  Then I tripped over this code, and wondered why it
wasn't working.  Of course, the problem was that it tries to compare
strings using `eql'.  Fix this.

Use `equal' here rather than the more specific `string=' because (a)
`find-duplicates' uses a hashtable if the :test function is suitable,
and (b) it reports the duplicates in the right order in that
codepath.  (That the other codepaths don't work the same way is, of
course, a bug which should be fixed.)

4 years agosrc/parser/parser-proto.lisp: Muffle a `&optional ... &key ...' warning.
Mark Wooding [Sat, 10 Aug 2019 00:16:13 +0000 (01:16 +0100)]
src/parser/parser-proto.lisp: Muffle a `&optional ... &key ...' warning.

Somehow I missed this one.

4 years agosrc/package.lisp, etc.: Muffle warnings about exported symbols etc.
Mark Wooding [Sat, 10 Aug 2019 00:15:03 +0000 (01:15 +0100)]
src/package.lisp, etc.: Muffle warnings about exported symbols etc.

SBCL gives big warnings if you re-evaluate a `defpackage' form and it
doesn't cover all of the exports and package uses.  I simply don't care.

4 years agosrc/method-proto.lisp: Maybe ignore the layout pointer in trampolines.
Mark Wooding [Fri, 9 Aug 2019 19:39:07 +0000 (20:39 +0100)]
src/method-proto.lisp: Maybe ignore the layout pointer in trampolines.

If the last trampoline is meant to invoke the delegation kernel, and the
kernel is for an aggregating message with no methods, then it probably
won't care about the layout pointer when it synthesizes its behaviour.
This results in an annoying compiler warning, which we can placate.

I originally considered doing this in `invoke-delegation-chain',
precisely in the case where the kernel is being included, but it's not
like we're being especially precise about other uses of `SOD__IGNORE',
so I've done the simpler thing instead.

4 years agosrc/method-proto.lisp: Collect arguments in vanilla delegation trampolines.
Mark Wooding [Fri, 9 Aug 2019 19:36:42 +0000 (20:36 +0100)]
src/method-proto.lisp: Collect arguments in vanilla delegation trampolines.

In the keyword-arguments overhaul, somehow the case in `make-trampoline'
for trivially `augmenting' the argument list for a vanilla message, as
opposed to hairy varargs or keyword messages, got lost, with the result
that they ended up with no arguments at all.  Needless to say, the C
compiler is unhappy about this.

4 years agotest/bad.sod: Test error reporting and recovery.
Mark Wooding [Sat, 10 Aug 2019 13:48:07 +0000 (14:48 +0100)]
test/bad.sod: Test error reporting and recovery.

Huh, what do you know?  That `demo' item has come back again.

4 years agosrc/module-parse.lisp: Eliminate the old `demo' module item.
Mark Wooding [Sat, 10 Aug 2019 13:43:39 +0000 (14:43 +0100)]
src/module-parse.lisp: Eliminate the old `demo' module item.

It was only there for early testing, and we don't need it any more.

4 years agotest/test.sod: Add a test for the class-pointer type bug.
Mark Wooding [Sat, 10 Aug 2019 10:50:08 +0000 (11:50 +0100)]
test/test.sod: Add a test for the class-pointer type bug.

4 years agosrc/class-layout-impl.lisp: Fix class pointers in secondary chains.
Mark Wooding [Thu, 8 Aug 2019 19:07:48 +0000 (20:07 +0100)]
src/class-layout-impl.lisp: Fix class pointers in secondary chains.

Consider:

[link = SodClass] class MyClass: SodClass { }
[metaclass = MyClass] class Foo: SodObject { }

GCC reports:

/tmp/mdw/t.c:258:33: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
   /*                _class = */ &Foo__classobj.obj.myclass,
                                 ^
/tmp/mdw/t.c:258:33: note: (near initialization for ‘Foo__vtable_obj.obj._class’)

What's going on here is that it's writing the wrong metaclass pointer
into the `_class' pointer on `Foo''s secondary `obj' chain.

Fix this by choosing, for each class pointer, the most specific
superclass of the overall metaclass that is (a) on the correct chain of
the metaclass, and (b) is a superclass of the metaclass of the most
specific class in the chain whose vtable we're writing.  Whew!

4 years agosrc/class-finalize-impl.lisp: Fix bungled format string.
Mark Wooding [Thu, 8 Aug 2019 19:07:23 +0000 (20:07 +0100)]
src/class-finalize-impl.lisp: Fix bungled format string.

4 years agosrc/optparse.lisp: Muffle warnings about `&optional ... &key ...'.
Mark Wooding [Thu, 8 Aug 2019 19:06:51 +0000 (20:06 +0100)]
src/optparse.lisp: Muffle warnings about `&optional ... &key ...'.

4 years agodoc/check-docs: Return nonzero if discrepancies are found.
Mark Wooding [Thu, 8 Aug 2019 14:57:45 +0000 (15:57 +0100)]
doc/check-docs: Return nonzero if discrepancies are found.

4 years agosrc/: Write dependency-tracking Makefile fragments.
Mark Wooding [Thu, 8 Aug 2019 11:58:07 +0000 (12:58 +0100)]
src/: Write dependency-tracking Makefile fragments.

And deploy them in the Makefile!

4 years agosrc/module-output.lisp: Introduce `module-output-file'.
Mark Wooding [Thu, 8 Aug 2019 11:44:55 +0000 (12:44 +0100)]
src/module-output.lisp: Introduce `module-output-file'.

This is the code from `frontend.lisp', which has been modified to use
it.

4 years agosrc/parser/parse-expr-{proto,impl}.lisp: Fully hide the parser state.
Mark Wooding [Thu, 8 Aug 2019 10:17:14 +0000 (11:17 +0100)]
src/parser/parse-expr-{proto,impl}.lisp: Fully hide the parser state.

We didn't publish the ability to pop things, so external implementers
are rather limited in their options.  Withdraw this entirely.

The `push-operator' and `apply-operator' generic functions are now
internal.  The `push-value' function is gone entirely: the only caller
was `parse-expression', and that now simply pushes the value onto the
stack directly.

4 years agovars.am: Add GNU Make pattern rules for Sod output files.
Mark Wooding [Thu, 8 Aug 2019 10:15:17 +0000 (11:15 +0100)]
vars.am: Add GNU Make pattern rules for Sod output files.

Additional dependencies in suffix rules don't work, apparently.  Non-GNU
make(1) should just see bizarre filenames which nobody cares about, so
this is a safe thing to do.

4 years agodoc/list-exports: Use the same output directory as the main `Makefile'.
Mark Wooding [Thu, 8 Aug 2019 10:13:14 +0000 (11:13 +0100)]
doc/list-exports: Use the same output directory as the main `Makefile'.

This way we (a) don't have to rebuild the project separately for
analysing the symbols, and (b) we won't clobber the ordinary ASDF-
maintained FASLs, which I typically build with different optimization
settings (turning on debugging, specifically).

4 years agosrc/module-impl.lisp: Indent the first line of a C fragment on output.
Mark Wooding [Thu, 8 Aug 2019 00:49:41 +0000 (01:49 +0100)]
src/module-impl.lisp: Indent the first line of a C fragment on output.

If we make the text appear in the right column, then GCC (at least) will
print out the correct line of the original Sod module and underline the
right pieces of it in error messages.  Which is pretty awesome,
actually.

4 years agodoc/concepts.tex, src/optparse.lisp: Rephrasing respectively.
Mark Wooding [Thu, 8 Aug 2019 00:25:56 +0000 (01:25 +0100)]
doc/concepts.tex, src/optparse.lisp: Rephrasing respectively.

4 years agodoc/concepts.tex, doc/syntax.tex: Replace `\textsf{...}' by `@|...|'.
Mark Wooding [Thu, 8 Aug 2019 00:17:15 +0000 (01:17 +0100)]
doc/concepts.tex, doc/syntax.tex: Replace `\textsf{...}' by `@|...|'.

Also, replace an enterprising combination of the `quote' environment
with `\textsf' by `prog'.

These were all very old.

4 years agodoc/*.tex: Add stubs for `file-location' reader methods.
Mark Wooding [Wed, 7 Aug 2019 17:26:29 +0000 (18:26 +0100)]
doc/*.tex: Add stubs for `file-location' reader methods.

4 years agodoc/check-docs: Add a program to check that the right things are documented.
Mark Wooding [Wed, 7 Aug 2019 17:25:21 +0000 (18:25 +0100)]
doc/check-docs: Add a program to check that the right things are documented.

How do you think I managed to find all of the problems I just fixed? ;-)

4 years agodoc/*.tex: Add, remove, and/or fix stubs to match reality.
Mark Wooding [Wed, 7 Aug 2019 17:24:00 +0000 (18:24 +0100)]
doc/*.tex: Add, remove, and/or fix stubs to match reality.

Many stubs were missing.  A few were wrongly spelled, or had the wrong
category.  Some were spurious.  Fixfixfix.

4 years agodoc/meta.tex: Rearrange the initargs stubs.
Mark Wooding [Wed, 7 Aug 2019 17:19:02 +0000 (18:19 +0100)]
doc/meta.tex: Rearrange the initargs stubs.

Gather the classes and accessors; gather `make-sod-slot-initarg' and
`make-sod-slot-initarg-using-slot'.  Gently reorder things.

4 years agodoc/meta.tex: Add missing return values for `make-sod-MUMBLE-initarg'.
Mark Wooding [Wed, 7 Aug 2019 17:13:55 +0000 (18:13 +0100)]
doc/meta.tex: Add missing return values for `make-sod-MUMBLE-initarg'.