Skip to content

Commit e9b1603

Browse files
committed
COMMON: call graph_reset on run
1 parent eb7c175 commit e9b1603

File tree

6 files changed

+14
-68
lines changed

6 files changed

+14
-68
lines changed

src/common/blib_graph.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
//
88
// Copyright(C) 2000 Nicholas Christopoulos
99

10-
#include "common/sys.h"
11-
#include "common/str.h"
12-
#include "common/kw.h"
13-
#include "common/panic.h"
14-
#include "common/var.h"
15-
#include "common/blib.h"
1610
#include "common/pproc.h"
1711
#include "common/messages.h"
1812

@@ -22,7 +16,6 @@ int gra_y;
2216

2317
void graph_reset() {
2418
gra_x = gra_y = 0;
25-
dev_cls();
2619
}
2720

2821
void graph_get_xstep(var_t *r) {

src/common/brun.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,10 @@ void sysvar_getcwd(var_t *r) {
296296
*/
297297
void exec_setup_predefined_variables() {
298298
char homedir[OS_PATHNAME_SIZE + 1];
299+
homedir[0] = '\0';
299300

300301
// needed here (otherwise task will not updated)
301302
ctask->has_sysvars = 1;
302-
303303
setsysvar_str(SYSVAR_SBVER, SB_STR_VER);
304304
setsysvar_num(SYSVAR_PI, SB_PI);
305305
setsysvar_int(SYSVAR_TRUE, 1);
@@ -323,7 +323,6 @@ void exec_setup_predefined_variables() {
323323
homedir[l] = OS_DIRSEP;
324324
homedir[l + 1] = '\0';
325325
}
326-
setsysvar_str(SYSVAR_HOME, homedir);
327326
#elif defined(_Win32)
328327
if (dev_getenv("HOME")) {
329328
// this works on cygwin
@@ -334,7 +333,6 @@ void exec_setup_predefined_variables() {
334333
char *p = strrchr(homedir, '\\');
335334
*p = '\0';
336335
strcat(homedir, "\\");
337-
338336
if (OS_DIRSEP == '/') {
339337
p = homedir;
340338
while (*p) {
@@ -344,18 +342,8 @@ void exec_setup_predefined_variables() {
344342
}
345343
}
346344
}
347-
setsysvar_str(SYSVAR_HOME, homedir); // mingw32
348-
349-
{
350-
static char stupid_os_envsblog[1024]; // it must be static at
351-
// least by default on DOS
352-
// or Win32(BCB)
353-
sprintf(stupid_os_envsblog, "SBLOG=%s%csb.log", homedir, OS_DIRSEP);
354-
putenv(stupid_os_envsblog);
355-
}
356-
#else
357-
setsysvar_str(SYSVAR_HOME, "");
358345
#endif
346+
setsysvar_str(SYSVAR_HOME, homedir);
359347
}
360348

361349
/**
@@ -536,7 +524,7 @@ static inline void bc_loop_call_proc() {
536524
pcode_t pcode = code_getaddr();
537525
switch (pcode) {
538526
case kwCLS:
539-
graph_reset();
527+
dev_cls();
540528
break;
541529
case kwTHROW:
542530
cmd_throw();
@@ -1721,6 +1709,7 @@ void sbasic_exec_prepare(const char *filename) {
17211709
}
17221710
// reset system
17231711
cmd_play_reset();
1712+
graph_reset();
17241713
}
17251714

17261715
/*

src/common/device.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,7 @@ void log_printf(const char *format, ...) {
398398
buf[i--] = '\0';
399399
}
400400
strcat(buf, "\r\n");
401-
402-
#if defined(IMPL_LOG_WRITE)
403401
lwrite(buf);
404-
#else
405-
dev_print(buf);
406-
#endif
407402
free(buf);
408403
}
409404
}
@@ -420,3 +415,9 @@ void dev_trace_line(int lineNo) {
420415
dev_printf("<%d>", lineNo);
421416
}
422417
#endif
418+
419+
#ifndef IMPL_LOG_WRITE
420+
void lwrite(const char *buf) {
421+
fprintf(stderr, "%s\n", buf);
422+
}
423+
#endif

src/common/proc.c

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -200,45 +200,6 @@ void exec_usefunc3(var_t *var1, var_t *var2, var_t *var3, bcip_t ip) {
200200
free(old_z);
201201
}
202202

203-
#ifndef IMPL_LOG_WRITE
204-
205-
/**
206-
* Write to the log file
207-
*/
208-
void lwrite(const char *buf) {
209-
int log_dev; /* logfile file handle */
210-
char log_name[OS_PATHNAME_SIZE + 1]; /* LOGFILE filename */
211-
212-
// open
213-
#if defined(_Win32) || defined(__MINGW32__)
214-
if (getenv("SBLOG")) {
215-
strcpy(log_name, getenv("SBLOG"));
216-
}
217-
else {
218-
sprintf(log_name, "c:%csb.log", OS_DIRSEP);
219-
}
220-
#else
221-
sprintf(log_name, "%ctmp%csb.log", OS_DIRSEP, OS_DIRSEP);
222-
#endif
223-
224-
log_dev = open(log_name, O_RDWR, 0660);
225-
lseek(log_dev, 0, SEEK_END);
226-
if (log_dev == -1) {
227-
log_dev = open(log_name, O_CREAT | O_RDWR, 0660);
228-
}
229-
if (log_dev == -1) {
230-
panic("LOG: Error on creating log file");
231-
}
232-
233-
// write
234-
if (write(log_dev, buf, strlen(buf)) == -1) {
235-
panic("LOG: write failed");
236-
}
237-
238-
close(log_dev);
239-
}
240-
#endif // NOT IMPL_LOG_WRITE
241-
242203
/*
243204
* Write string to output device
244205
*/

src/common/screen.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "common/messages.h"
1414
#include "common/osd.h"
1515
#include "common/sberr.h"
16+
#include "common/blib.h"
1617

1718
#define W2X(x) (((((x) - dev_Wx1) * dev_Vdx) / dev_Wdx) + dev_Vx1)
1819
#define W2Y(y) (((((y) - dev_Wy1) * dev_Vdy) / dev_Wdy) + dev_Vy1)
@@ -155,6 +156,7 @@ void dev_print(const char *str) {
155156
* clears the screen
156157
*/
157158
void dev_cls() {
159+
graph_reset();
158160
osd_cls();
159161
}
160162

src/ui/textedit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ const int theme1[] = {
5252
};
5353

5454
const int theme2[] = {
55-
0xcccccc, 0x000077, 0x333333, 0xa7aebc, 0x0000aa, 0x008888,
55+
0xcccccc, 0x000077, 0x333333, 0x333333, 0x0000aa, 0x008888,
5656
0x010101, 0xeeeeee, 0x010101, 0xffff00, 0x00ff00, 0x010101,
57-
0x00ffff, 0xff00ff, 0xffffff, 0x00ffff, 0x007777
57+
0x00ffff, 0xff00ff, 0xffffff, 0x00ffff, 0x00aaff
5858
};
5959

6060
const int theme3[] = {

0 commit comments

Comments
 (0)