hackerbase/README.md

212 lines
5.9 KiB
Markdown

BrmBuro
=======
Brmlab Bureacratic system.
License
-------
ISC License
Copyright 2023 Brmlab, z.s.
Dominik Pantůček <dominik.pantucek@trustica.cz>
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Features
--------
* members base management
* member files parsing and validation
* member ids validation
* generating new member id
* per-month statistics of active, suspended, destroyed and student
members
* detailed member information
* querying members by id or nick
Requirements
------------
There are no runtime requirements, it is possible to build binary that
requires only libc.
Build requirements:
* Chicken Scheme 5
* make (tested with GNU make)
Building static binary:
make brmsaptool-static
It is possible to run the main tool as script with Chicken Scheme
interpreter and POSIX-compatible shell for the purpose of development.
Development requirements:
* POSIX shell
Functional Modules
------------------
### Configuration
### Member File
### Member Record
### Member Base
### Month
### Period
### Primes
Support Modules
---------------
### ANSI
### Command Line parsing
### Dictionary
### Listing
### Progress
Provides syntax forms and procedures for showing progress of a
process.
(with-progress echo? pre post body ...)
* ```echo?``` - flag enabling progress output
* ```pre``` - string to be printed at start
* ```post``` - string to be printed after finish
* ```body ...``` - expressions of the process tracked
Displays process progress starting with the ```pre``` string, adding
arbitrary string to the output using the ```progress-advance``` during
each and every step. If the process reaches its finish, the output
line is finished with the ```post``` string and cursor is moved to new
line.
During the steps, the whole line is always refreshed when the progress
gets updated.
If ```echo?``` is ```#f``` (false), nothing is output.
(progress-advance [str])
* ```str``` - string to add to progress, defaults to "."
Adds given string to current progress and refreshes the progress
line. Must be evaluated within ```with-progress``` expression.
(progress-break body ...)
* ```body ...``` - arbitrary expressions to be evaluated
Evaluates the ```body ...``` expressions. Hides current progress line
before the evaluation and redisplays it when finished.
### Testing
This module provides simple syntax forms for (unit) testing of other
modules.
(run-tests name body ...)
* ```name``` - identifier describing the module being tested
* ```body ...``` - test expressions
Runs all tests specified on the ```body ...```. Firstly it prints
"[test] name " at the beginning of the line. Secondly it runs all
tests, printing "." for each test successfully passed. If all tests
pass, prints " ok." and moves the cursor to the next line.
In case any of the tests fails, exception is raised and program
terminates.
(test-eq? name expression expected-result)
* ```name``` - identifier representing the name of the test
* ```expression``` - expression to be evaluated
* ```expected-result``` - expected result of the test expression
Evaluates the test ```expression``` and compares the result with
```expected-result``` using ```eq?```. If the comparison fails, an
exception is raised with the ```name``` of the test added to the
exception. If the test passes, prints "." like all tests from this
module do.
(test-equal? name expression expected-result)
* ```name``` - identifier representing the name of the test
* ```expression``` - expression to be evaluated
* ```expected-result``` - expected result of the test expression
Evaluates the test ```expression``` and compares the result with
```expected-result``` using ```equal?```. If the comparison fails, an
exception is raised with the ```name``` of the test added to the
exception. If the test passes, prints "." like all tests from this
module do.
(test-true name expression)
* ```name``` - identifier representing the name of the test
* ```expression``` - expression to be evaluated
Evaluates the test ```expression``` and checks whether the result is
```#t``` (true). An exception is raised if it is not with the
```name``` of the test added to the exception. If the test passes,
prints "." like all tests from this module do.
(test-false name expression)
* ```name``` - identifier representing the name of the test
* ```expression``` - expression to be evaluated
Evaluates the test ```expression``` and checks whether the result is
```#f``` (false). An exception is raised if it is not with the
```name``` of the test added to the exception. If the test passes,
prints "." like all tests from this module do.
(test-exn name expression)
* ```name``` - identifier representing the name of the test
* ```expression``` - expression to be evaluated
Evaluates the test ```expression``` and checks whether it raised an
exception. An exception is raised if no exception was raised during
the evaluation. If the test passes, prints "." like all tests from
this module do.
### Utils
To ensure there are no external dependencies (including chicken eggs),
this module re-implements any basic procedures which are required for
any algorithms used.
(filter pred? lst)
* ```pred?``` - procedure accepting any value and returning #t or #f
* ```lst``` - list to be filtered
Returns a list containing only elements matching given ```pred?```
predicate.