Commit 4b646401 authored by rswindell's avatar rswindell

Get rid of the macros: GOTOXY, ANSI_SAVE, and ANSI_RESTORE and replace usage

with ansi_gotoxy(), ansi_save(), and ansi_restore() functions.
parent 7ab46d7a
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -636,26 +636,34 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen)
return("\r\n");
if(!strcmp(sp,"PUSHXY")) {
ANSI_SAVE();
ansi_save();
return(nulstr);
}
if(!strcmp(sp,"POPXY")) {
ANSI_RESTORE();
ansi_restore();
return(nulstr);
}
if(!strcmp(sp,"UP"))
return("\x1b[A");
if(!strcmp(sp,"UP")) {
cursor_up();
return(nulstr);
}
if(!strcmp(sp,"DOWN"))
return("\x1b[B");
if(!strcmp(sp,"DOWN")) {
cursor_down();
return(nulstr);
}
if(!strcmp(sp,"RIGHT"))
return("\x1b[C");
if(!strcmp(sp,"RIGHT")) {
cursor_right();
return(nulstr);
}
if(!strcmp(sp,"LEFT"))
return("\x1b[D");
if(!strcmp(sp,"LEFT")) {
cursor_left();
return(nulstr);
}
if(!strncmp(sp,"UP:",3)) {
safe_snprintf(str,maxlen,"\x1b[%dA",atoi(sp+3));
......@@ -681,7 +689,7 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen)
tp=strchr(sp,',');
if(tp!=NULL) {
tp++;
GOTOXY(atoi(sp+7),atoi(tp));
ansi_gotoxy(atoi(sp+7),atoi(tp));
}
return(nulstr);
}
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -881,12 +881,12 @@ void sbbs_t::privchat(bool local)
if(sys_status&SS_SPLITP) {
lncntr=0;
CLS;
ANSI_SAVE();
ansi_save();
#if 0
if(local)
bprintf(text[SysopIsHere],cfg.sys_op);
#endif
GOTOXY(1,13);
ansi_gotoxy(1,13);
remote_y=1;
bprintf(local ? local_sep : sep
,thisnode.misc&NODE_MSGW ? 'T':' '
......@@ -933,8 +933,8 @@ void sbbs_t::privchat(bool local)
}
remote_y=1+remoteline;
bputs("\1i_\1n"); /* Fake cursor */
ANSI_SAVE();
GOTOXY(1,13);
ansi_save();
ansi_gotoxy(1,13);
bprintf(local ? local_sep : sep
,thisnode.misc&NODE_MSGW ? 'T':' '
,sectostr(timeleft,tmp)
......@@ -963,7 +963,7 @@ void sbbs_t::privchat(bool local)
localchar=0;
if(sys_status&SS_SPLITP && local_y==24) {
GOTOXY(1,13);
ansi_gotoxy(1,13);
bprintf(local ? local_sep : sep
,thisnode.misc&NODE_MSGW ? 'T':' '
,sectostr(timeleft,tmp)
......@@ -973,7 +973,7 @@ void sbbs_t::privchat(bool local)
rprintf("\x1b[%d;1H\x1b[K",x+1);
if(y<=localline)
bprintf("%s\r\n",localbuf[y]); }
GOTOXY(1,local_y=(15+localline));
ansi_gotoxy(1,local_y=(15+localline));
localline=0; }
else {
if(localline>=4)
......@@ -1021,7 +1021,7 @@ void sbbs_t::privchat(bool local)
activity=1;
if(sys_status&SS_SPLITP && !remote_activity) {
ansi_getxy(&x,&y);
ANSI_RESTORE();
ansi_restore();
}
attr(cfg.color[clr_chatremote]);
if(sys_status&SS_SPLITP && !remote_activity)
......@@ -1061,7 +1061,7 @@ void sbbs_t::privchat(bool local)
if(i<=remoteline)
bprintf("%s\r\n",remotebuf[i]); }
remoteline=0;
GOTOXY(1, remote_y=6); }
ansi_gotoxy(1, remote_y=6); }
else {
if(remoteline>=4)
for(i=0;i<4;i++)
......@@ -1086,8 +1086,8 @@ void sbbs_t::privchat(bool local)
if(sys_status&SS_SPLITP && remote_activity) {
bputs("\1i_\1n"); /* Fake cursor */
ANSI_SAVE();
GOTOXY(x,y);
ansi_save();
ansi_gotoxy(x,y);
}
now=time(NULL);
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -636,8 +636,8 @@ long sbbs_t::getnum(ulong max, ulong dflt)
void sbbs_t::insert_indicator(void)
{
ANSI_SAVE();
GOTOXY(cols,1);
ansi_save();
ansi_gotoxy(cols,1);
uchar z=curatr; /* and go to EOL */
if(console&CON_INSERT) {
attr(BLINK|BLACK|(LIGHTGRAY<<4));
......@@ -647,5 +647,5 @@ void sbbs_t::insert_indicator(void)
outchar(' ');
}
attr(z);
ANSI_RESTORE();
ansi_restore();
}
......@@ -831,9 +831,6 @@ enum { /* Values of mode for userlist function */
nodesync(); }
#define ASYNC { getnodedat(cfg.node_num,&thisnode,0); \
nodesync(); }
#define ANSI_SAVE() rputs("\x1b[s")
#define ANSI_RESTORE() rputs("\x1b[u")
#define GOTOXY(x,y) rprintf("\x1b[%d;%dH",y,x);
#define TM_YEAR(yy) ((yy)%100)
#define sbbs_beep(f,d) BEEP(f,d)
#define mswait(x) SLEEP(x)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment