Kryptostack
helper.h
Go to the documentation of this file.
1
5#pragma once
6
7#include <string>
8
14#define public_accessor
15#define public_virtual
16#define public_other
22using OTCode = char;
23
27using KSNCode = char;
28
31enum OpError {
32 invalidexit,
33 rangecheck,
34 stackunderflow,
35 typecheck,
36 unmatchedmark,
37 dictstackunderflow,
38 undefinedresult,
39 undefined
40};
41
44enum InError {
45 unknownoption,
46 parsererror,
47 helptext,
48 quit,
49 internal,
50 other
51};
52
56std::string to_string(
57 __int128 p_z
58 );
59
64std::string to_string( __float128 );
65
73__int128 stoint128(const std::string& p_s);
74
80__float128 stofloat128( const std::string & p_s );
81
84void opErrExit( const OpError p_err, const std::string& p_details = "" );
85
88void inErrExit( const InError p_err, const std::string& p_details = "" );
89
92std::string strescape( const std::string& p_s );
93
98void statistics();
99
102void snap();
std::string to_string(__int128 p_z)
We need a dedicated function, because __int128 isn't supported by to_string().
Definition: helper.cpp:18
void statistics()
Dumps statistics data.
Definition: helper.cpp:116
OpError
Operator error code enum.
Definition: helper.h:31
__int128 stoint128(const std::string &p_s)
We need a dedicated function, because __float128 isn't supported by the standard library.
Definition: helper.cpp:52
std::string strescape(const std::string &p_s)
Substitutes double backslashes by single backslashes and sequences backslash + 'n' by the ASCII CR co...
Definition: helper.cpp:94
char OTCode
OTCode - the Object Type Code.
Definition: helper.h:22
__float128 stofloat128(const std::string &p_s)
We need a dedicated function, because __float128 isn't supported by the standard library.
Definition: helper.cpp:59
void inErrExit(const InError p_err, const std::string &p_details="")
Interpreter Error Message to cout and exit(1).
Definition: helper.cpp:81
void opErrExit(const OpError p_err, const std::string &p_details="")
Operator Error Message to cout and exit(1).
Definition: helper.cpp:64
void snap()
Snapshot of system state to cout.
Definition: helper.cpp:130
InError
Interpreter error code enum.
Definition: helper.h:44
char KSNCode
KSNCode - the KryptoStack Normalized Code.
Definition: helper.h:27