The interpreter pass 1 in a single flex file.
More...
#include <stdio.h>
#include <string.h>
#include <libgen.h>
#include <errno.h>
#include <quadmath.h>
#include <stdbool.h>
#include <sys/stat.h>
#include <unistd.h>
#include "determinations.h"
#include "dry.h"
|
| static void | unbackslash (char *p_str) |
| | String Cleaning 1.
|
| |
| static char * | endofline (char *p_str) |
| | String Cleaning 2.
|
| |
| static char * | norm_check_int (char *p_str) |
| | Normalization and range check for a string representation of an 128 bit integer.
|
| |
| static char * | norm_check_rational (char *p_str) |
| | Normalization and range check for a string representation of a Leonardus rational number.
|
| |
| static int | check_real (char *p_str) |
| | Range check for a string representation of an 128 bit float.
|
| |
| static bool | is_directory (const char *p_path) |
| | Check if the given path is valid and readable.
|
| |
|
int | yylex (void) |
| | The generated scanner.
|
| |
| static enum ExitCode | commandline (int argc, char **argv) |
| | Command line parsing.
|
| |
| int | main (int argc, char *argv[]) |
| | The parser main().
|
| |
| int | yywrap (void) |
| | yywrap().
|
| |
|
|
static int | g_verbose = 0 |
| | Global option "verbose".
|
| |
|
static int | g_suppressaec = 0 |
| | Global option suppress ANSI escape codes.
|
| |
|
static int | g_linebuffer = 0 |
| | Global option "line buffering".
|
| |
|
static int | g_helpprinted = 0 |
| | Global status help printed
|
| |
|
static char * | g_basename = NULL |
| | My program file name.
|
| |
|
static char * | g_dirname = NULL |
| | My program path name.
|
| |
| static char * | g_vocdir1 = NULL |
| | The path to the vocabularies.
|
| |
| static char * | g_vocdir2 = NULL |
| | The path to the vocabularies.
|
| |
|
static YY_BUFFER_STATE | g_buffer_stack [16] |
| | A stack of buffers for the vocabulary nesting.
|
| |
|
static FILE * | g_file_stack [16] |
| | A stack of FILE * for the vocabulary nesting.
|
| |
|
static int | g_buffer_stack_top = -1 |
| | Index into the stacks of buffers and FILE * for the vocabulary nesting.
|
| |
The interpreter pass 1 in a single flex file.
- Copyright
Leonardus, a minimalist stack-based programming system.
Copyright (C) 2025 Andreas Muckenschnabel
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program.
If not, see https://www.gnu.org/licenses/.
◆ check_real()
| static int check_real |
( |
char * |
p_str | ) |
|
|
static |
Range check for a string representation of an 128 bit float.
- Parameters
-
- Returns
- int ... 0 for a valid string
-
ERANGE for overflows, underflows and general errors.
◆ commandline()
| static enum ExitCode commandline |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
|
static |
Command line parsing.
- Parameters
-
- Returns
- enum ExitCode ... The defined program execution exit codes from dry.h.
< EC_SUCCESS string literal waiting for C++26.
< EC_INTERPRETER string literal waiting for C++26.
< EC_CMDLINE string literal waiting for C++26.
◆ endofline()
| static char * endofline |
( |
char * |
p_str | ) |
|
|
static |
String Cleaning 2.
Substitutes all x0a characters by a "\n" sequence. The resulting string is returned in a new allocated storage, which has to be freed by the caller.
- Parameters
-
| [in,out] | p_str | The string to be cleaned. |
- Returns
- char * ... The resulting string.
◆ is_directory()
| static bool is_directory |
( |
const char * |
p_path | ) |
|
|
static |
Check if the given path is valid and readable.
- Parameters
-
| [in] | p_path | The path to check. |
- Returns
- bool ... true if the path is valid, oherwise false.
◆ main()
| int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
The parser main().
- Parameters
-
| [in] | argc | Usual argc. |
| [in] | argv | Usual argv. |
- Returns
- enum ExitCode ... The defined program execution exit codes from dry.h.
◆ norm_check_int()
| static char * norm_check_int |
( |
char * |
p_str | ) |
|
|
static |
Normalization and range check for a string representation of an 128 bit integer.
Format of p_str is: [-]?[0-9]+
- Parameters
-
- Returns
- char * ... Points somewhere into the normalized p_str buffer.
-
Is NULL if the range check fails.
◆ norm_check_rational()
| static char * norm_check_rational |
( |
char * |
p_str | ) |
|
|
static |
Normalization and range check for a string representation of a Leonardus rational number.
Format of p_str is: {RATIONAL}
- Parameters
-
- Returns
- char * ... Points somewhere into the normalized p_str buffer.
-
Is NULL if the range check fails.
◆ unbackslash()
| static void unbackslash |
( |
char * |
p_str | ) |
|
|
static |
String Cleaning 1.
Removes all single backslashes from the string p_str, preserving double backslashes (\) and newline sequences (\n).
These are the only escape sequences recognized in the leon-format format.
- Parameters
-
| [in,out] | p_str | The string to be cleaned. |
◆ yywrap()
yywrap().
- Returns
- int ... It returns 1 for true, then the scanner terminates, returning 0 to its caller.
◆ g_vocdir1
The path to the vocabularies.
Version 1.
◆ g_vocdir2
The path to the vocabularies.
Version 2.