Skip to content

Latest commit

 

History

History
76 lines (58 loc) · 2.74 KB

ARCHITECTURE.org

File metadata and controls

76 lines (58 loc) · 2.74 KB

Guile-DSV Architecture

Copyright (C) Artyom V. Poptsov <[email protected]>

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.

Architecture

The main goal of this project is to provide a GNU Guile (Scheme) interface to parse RFC4180 and more general DSV format. In addition to that the project provides a console tool named dsv which uses Guile-DSV facilities to handle DSV data in a terminal

Code Map

Overview

All the GNU Guile modules are in modules directory. dsv program source code can be found in utils directory.

Main Module

For the common tasks there’s a (dsv) module that provides basic procedures to read/write DSV data.

Finite State Machine (FSM) Modules

All the files required to build and run the parser FSM are placed in (dsv fsm) modules. The FSM code is compiled from PlantUML diagrams by Guile-SMC.

Command Line Interface Modules

The code required for the dsv tool is in the (dsv cli) modules.

Parser Modules

The parser for each format is in its own module:

  • (dsv unix): DSV (Unix) parser
  • (dsv rfc4180): RFC 4180 parser.

DSV Tables

(dsv table) contains the code to handle DSV tables.

(dsv table-preset) contains the code to draw pseudo-graphic tables in the terminal.

Table Presets

Table presets are stored in presets directory and installed along with Guile-DSV. The goal is to make the tables easily configurable. The configuration can be done with a set of table options that control how each part of a table is rendered in a terminal.

For example, option called border-top-left controls which symbol is used for the top left corner of a table; the option can be shortened to btl to make it easier to specify this parameter in a command line.

Table configuration file is but a Scheme file that contains an associative list of options like follows:

((name                    . "graphic")
 (description             . "Pseudo-graphic table.")
 ;; Table border style.
 (border-top              . "─")
 (border-top-left         . "┌")
 (border-top-right        . "┐")
 ;; ...
  (header-column-separator . "┃"))

In configuration files it is recommended to use full-length option names (e.g. border-top-left) instead of shortened versions (e.g. btl) to make the code easier to read.

Tests

Tests are in tests directory. They are written using SRFI-61.

When a new functionality is being added a new test case (or several test cases) should be written for it.