]> Lady’s Gitweb - CGirls/log
CGirls
13 days agoAdd basic Les·M·L documentation generation
Lady [Thu, 20 Mar 2025 03:58:21 +0000 (23:58 -0400)]
Add basic Les·M·L documentation generation

13 days agoImprove handling of strings
Lady [Wed, 19 Mar 2025 01:06:31 +0000 (21:06 -0400)]
Improve handling of strings

• String constants are now defined with `constexpr´. Because these are
(associated at runtime with) `char const*const´ values, they can be
compared more‐or‐less like the old enum values used to be; because
those pointers point to actual strings, the code for processing them
and serializing them is simplified quite a bit. A few arrays give the
list of available strings; these are ⹐not⹑ (cannot be) `constexpr´s
because while the strings themselves are known at compile time, the
pointers which point to them cannot be. Instead, they are
`static const*const´ arrays; the `static´ keyword keeps their
visibility internal.

⋯ Exceptionally, `cgirls_mtype_any´ is defined as `nullptr´ rather
  than a string of zero length; handling this should always be a
  special case.

• Most of the verbs have been commented out to reduce the amount of
  code needed for an initial working implementation.

• The path·info parsing code has been refactored a bit, making use of a
  new function, `cgirls_gobblepath´ to encapsulate the task of reading
  up thru the next slash. The serialization code has also been
  refactored here and there for tidiness.

• Some comments in `request.c´ used spaces instead of tabs. Whoops!

Note that Clang only supports `constexpr´ in version 19 and later.

13 days agoAdd request parsing and related tests
Lady [Tue, 18 Mar 2025 04:31:32 +0000 (00:31 -0400)]
Add request parsing and related tests

This commit adds a function for processing a “path info” string, for
example one received through C·G·I (as the `PATH_INFO´ environment
variable), into a structure which represents its semantics,
`cgirls_req´. It also adds a function for reserializing this structure
into a canonical form. The program `cgirls-test-pathinfo´ is used with
the existing test infrastructure to ensure that strings are processed
correctly.

There is a flaw in this design (which I realized after making the
original commit, but before writing this updated message), in that an
empty identifier string is represented as `..´, which in a URL already
has a different, and very normative, meaning of “parent directory”.
This flaw will need to be fixed in a later commit.

Probably some more tests could be added here; in particular only a few
verbs and extensions are being tested right now and ideally they all
would be.

13 days agoBuild testing infrastructure
Lady [Tue, 18 Mar 2025 04:01:20 +0000 (00:01 -0400)]
Build testing infrastructure

For the actual testing script, see `sh/test.sh´, but note the following
details :—

• The file `cgirls.h´ has been renamed `aa.h´ because it will be needed
in test binaries as well.

• Source files are now automatically found rather than needing to list
them explicitly in `make/cgirls.mak´.

• Support for a `make/config.mak´ configuration file was added, for
modifying the build. A sample is provided which offers the sort of
optimizations one might want in a production environment.

• Tests consist of comparing result of running a program with the input
in `test/´ against an expected output in `expect/´. Lines which start
with a `#´ are ignored in both. This is to enable REUSE‐conformance
(all of these files are `CC0-1.0´) and hopefully will not cause
problems down the road.

13 days agoInitial commit
Lady [Sun, 16 Mar 2025 16:56:35 +0000 (12:56 -0400)]
Initial commit

The `make´ infrastructure is largely borrowed from C·Git and is
partially attributed to its authors accordingly.

This page took 0.026657 seconds and 4 git commands to generate.