52 void SetSharePath(std::string spath) { SHARE = spath; };
54 std::string GetLibPath(
void) {
return libpath; };
55 void SetLibPath(std::string lpath) { libpath = lpath; };
57 std::string GetHomePath(
void) {
return HOME; };
58 void SetHomePath(std::string home) { HOME = home; };
60 std::string GetPath(
void) {
return PATH; };
61 void SetPath(std::string path) { PATH = path; };
63 std::string GetFNAME(
void) {
return FNAME; };
64 void SetFNAME(std::string fname) { FNAME = fname; };
66 std::string GetOldPath(
void) {
return OldPath; };
67 void SetOldPath(std::string op) { OldPath = op; };
69 std::string GetPWVscodePath(
void) {
return pw_vscode_path; };
70 void SetPWVscodePath(std::string path) { pw_vscode_path = path; };
72 std::string GetPWMplabxPath(
void) {
return pw_mplabx_path; };
73 void SetPWMplabxPath(std::string path) { pw_mplabx_path = path; };
75 std::string GetProcessorName(
void) {
return proc_; };
76 void SetProcessorName(std::string pn) { proc_ = pn; };
78 long int GetNSTEP(
void) {
return NSTEP; };
79 void SetNSTEP(
long int ns) { NSTEP = ns; };
85 void SetNSTEPJ(
long int nsj) { NSTEPJ = nsj; };
91 void SetJUMPSTEPS(
int js);
97 void SetBoard(
board* b) { pboard = b; };
98 void DeleteBoard(
void);
110 int GetMcuDbg(
void) {
return mcudbg; };
118 SetCpuState(CPU_RUNNING);
120 SetCpuState(CPU_POWER_OFF);
123 void SetCpuState(
const PICSimlabCPUState cs);
130 char GetCpuState(
void) {
return cpustate; };
132 void Set_mcudbg(
int pd);
134 void SetMcuRun(
int mr) { mcurun = mr; };
135 int GetMcuRun(
void) {
return mcurun; };
182 void SetClock(
const float clk,
const int update = 1);
183 float GetClock(
void);
198 void SavePrefs(std::string name, std::string value);
200 void PrefsClear(
void) { prefs.clear(); };
201 int PrefsSaveToFile(std::string fname) {
return SaveToFile(prefs, fname.c_str()); };
202 int PrefsLoadFromFile(std::string fname) {
return LoadFromFile(prefs, fname.c_str()); };
203 unsigned int PrefsGetLinesCount(
void) {
return prefs.size(); };
204 std::string PrefsGetLine(
int ln) {
return prefs.at(ln); };
206 void OpenLoadHexFileDialog(
void);
208 void SetNeedReboot(
int nr = 1);
209 int GetNeedReboot(
void) {
return NeedReboot; };
211 void RegisterError(
const std::string module,
const std::string error);
212 int GetErrorCount(
void) {
return Errors.size(); };
214 std::string GetError(
int en) {
return Errors.at(en); };
216 void DeleteError(
int en) { Errors.erase(Errors.begin() + en); };
218 void EndSimulation(
int saveold = 0,
const char* newpath = NULL);
220 std::string GetWorkspaceFileName(
void) {
return Workspacefn; };
222 void SetWorkspaceFileName(
const std::string fname) { Workspacefn = fname; };
224 std::string GetLastWorkspaceFileName(
void) {
return LastWorkspacefn; };
226 void SetLastWorkspaceFileName(
const std::string fname) { LastWorkspacefn = fname; };
228 void SetLabs(
const int lb,
const int lb_) {
233 int GetLab(
void) {
return lab; };
234 int GetLab_(
void) {
return lab_; };
236 int LoadHexFile(std::string fname,
const int saveold = 0);
238 void LoadWorkspace(std::string fnpzw,
const int show_readme = 1);
239 int SaveWorkspace(std::string fnpzw);
241 void SetSimulationRun(
int run);
242 int GetSimulationRun(
void);
244 double GetScale(
void) {
return scale; };
245 void SetScale(
double s) { scale = ((int)(100 * s)) / 100.0; };
247 int GetNeedResize(
void) {
return need_resize; };
248 void SetNeedResize(
int nr) { need_resize = nr; };
250 void Configure(
const char* home,
int use_default_board = 0,
int create = 0,
const char* lfile = NULL,
251 const int disable_debug = 0);
253 void SetplWidth(
int pw) { plWidth = pw; };
255 void SetplHeight(
int ph) { plHeight = ph; };
257 double GetIdleMs(
void);
258 void SetIdleMs(
double im);
260 int GetUseDSRReset(
void) {
return use_dsr_reset; };
261 void SetUseDSRReset(
int udsr) { use_dsr_reset = udsr; };
263 void SetToDestroy(
int reason = RC_EXIT);
264 int GetToDestroy(
void) {
return settodestroy; };
266 void SetSync(
unsigned char s) { sync = s; };
267 unsigned char GetSync(
void) {
return sync; };
269 char* GetPzwTmpdir(
void) {
return pzwtmpdir; };
271 char* GetLastPzwTmpdir(
void) {
return lastpzwtmpdir; };
273 std::string GetSupportedBoards(
void);
275 void UpdateStatus(
const PICSimlabStatus field,
const std::string msg);
277 void* UpdateGUI(
const int id,
const PICSimlabGUIType type,
const PICSimlabGUIAction action,
const void* arg);
279 void ConfigMenuGUI(
const PICSimlabGUIMenu type);
281 static int CanvasCmd(
const CanvasCmd_t cmd);
283 static int WindowCmd(
const int id,
const char* ControlName,
const PICSimLabWindowAction action,
const char* Value,
284 void* ReturnBuff = NULL);
286 static int SystemCmd(
const PICSimLabSystemCmd cmd,
const char* Arg,
void* ReturnBuff = NULL);
288 std::atomic<unsigned short int> status;
290 std::atomic<int> tgo;
296 void (*OnUpdateStatus)(
const int field,
const std::string msg);
297 void (*OnConfigure)(void);
298 void (*OnClockSet)(
const float clk,
const int update);
299 void (*OnReadPreferences)(
const char* name,
const char* value,
const int create);
300 void (*OnSavePrefs)(void);
301 void (*OnLoadHexFile)(
const std::string fname);
302 void (*OnOpenLoadHexFileDialog)(void);
303 void (*OnEndSimulation)(void);
304 void* (*OnUpdateGUI)(
const int id,
const PICSimlabGUIType type,
const PICSimlabGUIAction action,
const void* arg);
305 void (*OnConfigMenuGUI)(
const PICSimlabGUIMenu type);
307 int (*OnCanvasCmd)(
const CanvasCmd_t cmd);
308 int (*OnWindowCmd)(
const int id,
const char* ControlName,
const PICSimLabWindowAction action,
const char* Value,
310 int (*OnSystemCmd)(
const PICSimLabSystemCmd cmd,
const char* Arg,
void* ReturnBuff);
313 void StartRControl(
void);
326 PICSimlabCPUState cpustate;
327 unsigned short debug_port;
328 unsigned short remotec_port;
339 std::vector<std::string> prefs;
341 std::vector<std::string> Errors;
342 std::string Workspacefn;
343 std::string LastWorkspacefn;
348 char pzwtmpdir[1024];
349 char lastpzwtmpdir[1024];
351 std::string pw_vscode_path;
352 std::string pw_mplabx_path;
353 std::string pzw_creation_date;