Kryptostack
Functions
helper.cpp File Reference

Implementation of miscellaneous definitionen und functions. More...

#include <iostream>
#include <string>
#include <map>
#include <charconv>
#include <quadmath.h>
#include "so.h"
#include "helper.h"
#include "context.h"
#include "interpreter.h"
Include dependency graph for helper.cpp:

Functions

std::string to_string (__int128 p_z)
 We need a dedicated function, because __int128 isn't supported by to_string(). More...
 
std::string to_string (__float128 r_)
 We need a dedicated function, because __float128 isn't supported by to_string(). More...
 
__int128 stoint128 (const std::string &p_s)
 We need a dedicated function, because __float128 isn't supported by the standard library. More...
 
__float128 stofloat128 (const std::string &p_s)
 We need a dedicated function, because __float128 isn't supported by the standard library. More...
 
void opErrExit (const OpError p_err, const std::string &p_details)
 Operator Error Message to cout and exit(1).
 
void inErrExit (InError p_err, const std::string &p_details)
 Interpreter Error Message to cout and exit(1).
 
std::string strescape (const std::string &p_s)
 Substitutes double backslashes by single backslashes and sequences backslash + 'n' by the ASCII CR code.
 
void statistics ()
 Dumps statistics data. More...
 
void snap ()
 Snapshot of system state to cout.
 

Detailed Description

Implementation of miscellaneous definitionen und functions.

Function Documentation

◆ statistics()

void statistics ( )

Dumps statistics data.

Dumps it only if there are open memory allocations.

Note
IDEA: a parameter "forcestatistics" and a command line option for ks to set it

◆ stofloat128()

__float128 stofloat128 ( const std::string &  p_s)

We need a dedicated function, because __float128 isn't supported by the standard library.

Implemented with GNU quadmath.

Note
IDEA: detailed description
Returns
__float128 the IEEE float

◆ stoint128()

__int128 stoint128 ( const std::string &  p_s)

We need a dedicated function, because __float128 isn't supported by the standard library.

Has no syntax check. A leading '+' is not allowed. No overflow check

Note
IDEA: define prerequisites.
Returns
__int128 ... the parsed integer

◆ to_string() [1/2]

std::string to_string ( __float128  r_)

We need a dedicated function, because __float128 isn't supported by to_string().

Implementation with GNU quadmath

Returns
std::string ... the string-representation of p_z

◆ to_string() [2/2]

std::string to_string ( __int128  p_z)

We need a dedicated function, because __int128 isn't supported by to_string().

Returns
std::string ... the string-representation of p_z
Parameters
[in]p_zwe need a representation for this number