File indexing completed on 2026-04-09 07:49:48
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #pragma once
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 #include <cstddef>
0034 #include <string>
0035 #include <vector>
0036 #include "plog/Severity.h"
0037
0038 struct float3 ;
0039 struct float4 ;
0040
0041 #include "SYSRAP_API_EXPORT.hh"
0042
0043 class SYSRAP_API SSys {
0044 public:
0045
0046 static const plog::Severity LEVEL ;
0047 static const char* OS ;
0048 static const unsigned SIGNBIT32 ;
0049 static const unsigned OTHERBIT32 ;
0050
0051 static bool IsNegativeZero(float f);
0052 static void DumpEnv(const char* pfx="OPTICKS" );
0053
0054 static const char* fmt(const char* tmpl="hello%u.npy", unsigned val=0);
0055 static int run(const char* cmd);
0056 static int exec(const char* exe, const char* arg1, const char* arg2=NULL);
0057 static std::string Which(const char* script);
0058 static std::string POpen(const char* cmd, bool chomp, int& rc);
0059 static std::string POpen(const char* cmda, const char* cmdb, bool chomp, int& rc);
0060
0061
0062 static int npdump(const char* path="$TMP/torchstep.npy", const char* nptype="np.int32", const char* postview=NULL, const char* printoptions=NULL);
0063 static void xxdump(char* buf, int num_bytes, int width=16, char non_printable='.' );
0064 static std::string xxd(char* buf, int num_bytes, int width=16, char non_printable='.' );
0065 static std::string hexlify(const void* obj, size_t size, bool reverse=true ) ;
0066
0067 static void WaitForInput(const char* msg="Enter any key to continue...\n");
0068 static int getenvint( const char* envkey, int fallback=-1 );
0069 static char getenvchar( const char* envkey, char fallback='?' );
0070
0071 static unsigned getenvunsigned_fallback_max( const char* envkey) ;
0072 static unsigned getenvunsigned( const char* envkey, unsigned fallback=~0u );
0073
0074
0075 static float getenvfloat( const char* envkey, float fallback=-1.f );
0076 static double getenvdouble( const char* envkey, double fallback=-1.f );
0077 static bool getenvbool( const char* envkey );
0078
0079 static std::vector<float>* getenvfloatvec(const char* envkey, const char* fallback="0,0,0", char delim=',' );
0080 static int getenvfloatvec( const char* envkey, std::vector<float>& fvec, const char* fallback="0,0,0", char delim=',' );
0081
0082 static float3 getenvfloat3( const char* envkey, const char* fallback="0,0,1", char delim=',' );
0083 static float3 getenvfloat3norm( const char* envkey, const char* fallback="0,0,1", char delim=',' );
0084 static float4 getenvfloat4( const char* envkey, const char* fallback="0,0,0,0", char delim=',' );
0085
0086
0087 static std::string Desc(const std::vector<int>* ivec);
0088
0089 static std::vector<int>* getenvintvec(const char* envkey, char delim=',');
0090 static int getenvintvec( const char* envkey, std::vector<int>& ivec, char delim=',', const char* fallback="0,0,0");
0091 static std::string Desc(const std::vector<float>* fvec);
0092
0093 static int atoi_( const char* a );
0094 static float atof_( const char* a );
0095 static double atod_( const char* a );
0096
0097 static void split(std::vector<std::string>& elem, const char* str, char delim );
0098
0099 static bool hasenvvar( const char* ekey );
0100 static const char* getenvvar( const char* envkey, const char* fallback );
0101 static const char* getenvvar( const char* envkey );
0102 static const char* username();
0103 static const char* hostname();
0104
0105 static int unsetenv( const char* ekey );
0106 static int setenvvar( const char* ekey, const char* value, bool overwrite=true, char special_empty_token='\0' );
0107 static bool IsRemoteSession();
0108 static bool IsVERBOSE();
0109 static bool IsHARIKARI();
0110 static bool IsENVVAR(const char* envvar);
0111 static int GetInteractivityLevel();
0112 static bool IsCTestRunning();
0113
0114 static unsigned COUNT ;
0115 static void Dump_(const char* msg);
0116 static void Dump(const char* msg);
0117
0118 static const char* ResolveExecutable(const char* envvar_key, const char* default_executable);
0119 static const char* ResolvePython();
0120 static int RunPythonScript(const char* script);
0121 static const char* RunPythonScript_NOTES ;
0122
0123 static int RunPythonCode(const char* code);
0124 static void Exit(int rc=0) ;
0125
0126 };