SDMPas

SDMPas is a library that provides extra batteries and utility functions for FreePascal. It is essentially Remilia's personal standard library, and is similar in nature (and design) to her cl-sdm library for Common Lisp.

Wanna support Remilia? Buy me a coffee on Ko-Fi, or support me through Liberapay.

Buy Me a Coffee at ko-fi.com Donate using Liberapay

Documentation

TODO

Version Control

SDMPas sources are managed using Fossil, a distributed version control system. The Fossil repository contains the urtext, tickets, and wiki. If you are reading this at https://fossil.cyberia9.org/sdmpas/, then you are looking at the repository itself.

Usage

Optional Compile-Time Defines

  • sdmPasDebug: Disables some inlinining, adds additional checks.
  • sdmInlineInt24: Inline Int24-related methods/functions. This may cause some warnings to be displayed about range checks.
  • zmq_draft_api: Enable the draft API in the sdmzmq unit. Your copy of libzmq also needs to have the draft API enabled.

Building

SDMPas uses a Rakefile for everything. It does not, and will not ever, use Lazarus or fpcmake.

Build the examples and tests by running rake. You can run rake -T to see a list of all possible targets. You can pass additional options to FPC like this:

$ FPC_OPTS="-g -gl -Sa" rake

A few units need extra stuff generated ahead of time before they're usable. Just run rake bindings to build all of these, and there are also specific targets for specific bindings. Building the examples/tests will build the bindings automatically.

Stuff Included

  • SDMPas - Core unit, has some hashing functions for THashMap, various utility functions and types, a Quicksort implementation for dynamic arrays, a "subseq" function that is more like you find in Common Lisp (because I missed it), a "butlast" utility (like in Common Lisp), equivalents to Common Lisp's CAR and CDR for dynamic arrays (just for accessing, not setting), and slicing utilities for dynamic arrays.
  • SDMTypes - Various basic type definitions/aliases.
  • SDMArgParser - Command line argument parsing and "command" processing.
  • SDMArrayPool - Create buffers of a desired, and then "rent" them out so that you don't keep allocating/deallocating the memory over and over.
  • SDMConfig - My usual Quake-style "base directory" system for handling configuration files and data files, usually with $XDG_*_HOME directories (but it also supports Haiku and Windows).
  • SDMio - I/O utility classes and nicer stream functionality.
  • SDMJson - JSON parsing and generation.
  • SDMLog - A logging facility. Includes a logger specifically for use across multiple threads as well.
  • SDMPathname - Some pathname handling routines.
  • SDMPunycode - Punycode encoding/decoding and IDN handling.
  • SDMQrCode - QR Code generation.
  • SDMRandom - Better random number generation. Includes a PCG32 implementation.
  • SDMRSConf - RSConf parsing and generation.
  • SDMSLang - Bindings for the S-Lang library. Just the terminal stuff at the moment.
  • SDMSqlite3 - Nicer SQLite3 handling. Builds on what FPC provides.
  • SDMStrings - Additional string functionality and better UTF-8 handling so that you don't need Lazarus. Because I refuse to use Lazarus units (or Lazarus itself).
  • SDMTerm - ANSI terminal stuff, like colored outputs, controlling the cursor, etc.
  • SDMTerminology - Basic extended terminal functionality for the Terminology terminal.
  • SDMUri - Really fast URI parsing and handling.
  • SDMZmq - ZeroMQ bindings with a nice high-level API.
  • SDMZstd - ZStandard bindings with a nice high-level SDMio API.

Also included are incomplete C bindings for this library.

How do I contribute?

  1. Go to https://fossil.cyberia9.org/sdmpas/ and clone the Fossil repository.
  2. Create a new branch for your feature.
  3. Push locally to the new branch.
  4. Create a bundle with Fossil that contains your changes.
  5. Get in contact with me.
  6. Contact me to set up a merge.

  7. Remilia Scarlet - creator and maintainer

SDMPas is mostly under the GNU Affero General Public License version 3, except for the following components:

  • PCG32 - Apache License version 2.0

See the licenses directory for individual licenses, as well as the NOTICE.md file.