Adds -c|--emitcname flag to headerparse to always emit the C identifier
in `register` definitions (useful when the register will be in a
module).
Fixes a bug where the kebab case flag would not output C identifiers
making the emitted C identifiers not match with the ones in the headers.
Adds docs entry about headerparse in CInterop doc.
Makes headerparse emit `CChar` instead of `Char` when encountering a
signature containing `char`.
* fix: don't instantiate dummy fields for external types
For ANSI C compatibility reasons, we add a dummy field for memberless
types defined in Carp (see commit 59ef5bbf2b). When registering a type
with no fields, `(register-type A [])`, we'd also attempt to set our
dummy field in the Carp generated initializer for the type. However, the
registered type is totally opaque from the perspective of Carp, and we
can't assume it has a field corresponding to our dummy field.
This commit changes our handling of __dummy in initializers to avoid
setting it for registered types.
* feat: automatically implement str and prn for registered types
This commit makes the auto-generated str and prn functions for
registered types implement the str and prn interfaces, removing the need
for users to call implements on these functions explicitly.
It alters the signature of `autoDerive` in Primitives.hs slightly to
make it more flexible (since registered types have no delete or copy
functions that we can add to the implementation lists of these
interfaces).
* docs: add docs on register-type to CInterop.md
The new documentation clarifies the usage of `register-type` and accounts
for the changes in the prior two commits.
* fix: fix function signatures for generic memberless initers
Filter out dummy field arguments.
* docs: Add details about type name overrides to CInterop.md
* docs: clarify that users can implement delete for registered types
* refactor: Tiny cleanup before we begin
* refactor: Moved module finding to its own local function
* feat: save-docs-internal is now a binary command
* feat: This seems to work
* fix: Cleaned up the code, save-docs now emit one module per file listed
* fix: render submodules in html docs
* fix: also render deeply nested modules
* feat: no prefixes in nested submodule doc rendering
* fix: fix text alignment of module index for sdl
* feat: make submodules expandable
* docs: implemented python script to convert local documentation from .md files to .html files
* docs: filled index.md; reviewed all references in .md files
* docs: updated Embedded.md and resized carp_on_arduboy.jpg to sensible width
* docs: copy sub folders (./docs/core and ./docs/sdl) to ./docs-html/ and refer docu to it
* docs: phrased requirements more clearly
* docs: generate docs for Standard libraries before converting .md docs to .html
* docs: change index to markdown lists
* docs: index.md worked around limitation in md converter
* docs: removed modules count from Libraries.md
Co-authored-by: guberatsie <gunnar.bernhardt@siemens.com>
* chore: Abuse deftemplate to get rid of Address
* chore: Avoid semicolon at end of define
* fix: address should be useable as an argument to a HOF
* chore: adapt examples to new address signature
* fix: Remove Address from typeOf
* fix: Remove more uses of Address
* fix: Remove more mentions of address in the Haskell code
* fix: Remove test that ensure you can't take the address of non-symbols
* refactor: Moved `address` to Pointer.carp
* refactor: Move address into Pointer module
Co-authored-by: Jorge Acereda <jacereda@gmail.com>
* feat: add 'when' functions for Maybe and Result
These functions enable users to execute some side-effecting function
(one that returns unit and take no arguments) based on the contents of a
Maybe or Result.
`when-success`: Executes a side-effect when given a `Result.Success`
`when-error`: Executes a side-effect when given a `Result.Error`
`when-just`: Executes a side-effect when given a `Maybe.Just`
`when-nothing`: Executes a side-effect when given a `Maybe.Nothing`
* docs: add Control to core lib doc generation
* refactor: Groups Dynamic together in Macros.carp
* fix: Fixes doc for `hidden` referring to the wrong symbol
* feat: Adds defn- & def- macros
Adding these macros as a shortand for declaring a def or defn and making
them `hidden` and `private`, useful to keep things internal to a module.
* test: Adds expected error output tests for def- & defn-
* refactor: Changes position of Module and Interface section in LanguageGuide
Trying to introduce concepts in the same order they are referred to in
the examples: structs > modules > interfaces.
* docs: Adds private & hidden section in the LanguageGuide
* add sketch for drop
* add drop example
* correct drop ordering
* fix: simplify drop and add to deleter
* docs: add drop docs
* fix: use a sound lifetime var
* feat: quasiquotation
* test: add tests for quasiquotation
* fix: fix typo in call to doc
* fix: do not evaluate quasiquote too eagerly
* test: pull quasiquote test into macro
* docs: fix unquote example with better constant
* feat: add quasiquote literals
* refactor: simplify reader macros
* core: add derive
* fix: fix errors with set!
Notably, don't type check dynamic bindings (which can be set to
whatever) and eliminate a hang that resulted from not handling an error
at the end of the `set!` call. Also refactors some of the code in
efforts to make it a bit cleaner.
Also adds an error when `set!` can't find the variable one calls set!
on.
* feat: better derive
* test: add error test for derive
* document derive
* add derive to core documentation to generate
* core: add derive
* fix: fix errors with set!
Notably, don't type check dynamic bindings (which can be set to
whatever) and eliminate a hang that resulted from not handling an error
at the end of the `set!` call. Also refactors some of the code in
efforts to make it a bit cleaner.
Also adds an error when `set!` can't find the variable one calls set!
on.
* feat: better derive
* document derive
* feat: first completely working version of derive
* feat: make name of derivable customizable (thanks @scolsen)
* refactor: implement doc edits provided by @scolsen
* feat: change argument order for derive
* fix: change deriver error test
* test: add derive tests
* fix: change order of derive back
* docs: fix typo in derive document
Co-authored-by: scottolsen <scg.olsen@gmail.com>
* chore: moves git hook into own folder
This is is done in preparation of having other git hooks
* chore: Creates script to run formatter
* chore: Checks that ormolu is installed before running it
* chore: Adds pre-commit hook to format Haskell files
* chore: Ensures the ormolu instruction are outputted when running hook
* chore: Prints formatted files on newlines
* docs: Generates HTML docs for Function core module
* docs: Adds lifetime information in Function module
* docs: Adds callback section to C Interop
* docs: Corrects typos in Function docs
* docs: Cleaned up the "credits" section a fair bit
* docs: Unified list of maintainers
* Update README.md
Co-authored-by: Erik Svedang <erik@Eriks-iMac.local>
* docs: Remove a lot of duplicated information and refer to webpages instead
* fix: Remove line about (help), it does not make sense anymore
* fix: Add open-browser to nix config
Co-authored-by: Erik Svedang <erik@Eriks-iMac.local>
* Adds C Interop documentation for Strings
* Replaces usage of triple backticks with single when used in a paragraph
* Adds link to new C Interop docs in the Language Guide
* Small tweaks to wording in C Interop doc
* Adds Array section to C Interop doc
* Adds deftemplate examples in C interop doc
* Small copy change in C interop doc
* Adds identifiers section in C interop doc