Lolly 1.4.27
Loading...
Searching...
No Matches
Namespaces | Functions
lolly Namespace Reference

Namespaces

namespace  data
 
namespace  hash
 
namespace  io
 
namespace  system
 

Functions

void init_tbox ()
 
string win_get_username ()
 
string get_stacktrace (unsigned int max_frames)
 

Function Documentation

◆ init_tbox()

void lolly::init_tbox ( )
extern

Definition at line 169 of file sys_utils.cpp.

169 {
170 if (!tb_init (tb_null, tb_null)) exit (-1);
171 mem_init ();
172}
The list class represents a linked list.
Definition list.hpp:48
void mem_init()

◆ win_get_username()

string lolly::win_get_username ( )

Definition at line 141 of file win_sys_utils.cpp.

141 {
142 const int MAX_LEN= 100;
143 wchar_t buffer[MAX_LEN]; // it is in UTF-16
144 ULONG len;
145 GetUserNameExW (NameDisplay, buffer, &len);
146 if (len == 0) return string ("");
147 else {
148 return wchar_to_utf8 (buffer);
149 }
150}

◆ get_stacktrace()

string lolly::get_stacktrace ( unsigned int max_frames)

Definition at line 175 of file sys_utils.cpp.

175 {
176 string r;
177 r << "Backtrace of C++ stack:\n";
178
179 // storage array for stack trace address data. skip the first, it is the
180 // address of this function.
182
183 // retrieve current stack addresses
185
186 if (addrlen == 0) {
187 r << " <empty, possibly corrupt>\n";
189 return r;
190 }
191
192 // resolve addresses into strings by tbox, differs under various platforms.
193 // this array must be released
195
196 // allocate string which will be filled with the function name
197 char* funcname= tm_new_array<char> (1024);
198
199 // iterate over the returned symbol lines.
200 for (int i= 0; i < addrlen; i++) {
201 // print name of current stack frame
202 const char* curname=
204 if (curname == NULL) {
205 r << " null\n";
206 }
207 else {
208 r << " " << string (curname) << "\n";
209 }
210 }
211
215 return r;
216}
#define STACK_NEW_ARRAY(name, T, size)
Definition basic.hpp:43
#define STACK_DELETE_ARRAY(name)
Definition basic.hpp:44
void tm_delete_array(C *Ptr)