Commit 2471d02e authored by rswindell's avatar rswindell
Browse files

Create new ARS keywords (booleans) for terminal charset:

- ASCII
- UTF8
- CP437

And these, along with the pre-existing PETSCII keyword, are mutually exclusive
(only one will be set/true).
parent 49eef9c4
......@@ -368,6 +368,18 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg)
artype=AR_PETSCII;
i+=6;
}
else if(!strnicmp(str+i,"ASCII",5)) {
artype=AR_ASCII;
i+=4;
}
else if(!strnicmp(str+i,"UTF8",4)) {
artype=AR_UTF8;
i+=3;
}
else if(!strnicmp(str+i,"CP437",5)) {
artype=AR_CP437;
i+=4;
}
else if(!strnicmp(str+i,"TERM",4)) {
artype=AR_TERM;
i+=3;
......@@ -505,6 +517,9 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg)
case AR_WIP:
case AR_ANSI:
case AR_PETSCII:
case AR_ASCII:
case AR_UTF8:
case AR_CP437:
case AR_DOS:
case AR_OS2:
case AR_UNIX:
......
......@@ -128,6 +128,9 @@ enum { /* Access requirement binaries */
,AR_COLS
,AR_ROWS
,AR_PETSCII
,AR_ASCII
,AR_UTF8
,AR_CP437
};
#endif /* Don't add anything after this line */
......@@ -89,6 +89,9 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client)
switch(artype) {
case AR_ANSI: /* No arguments */
case AR_PETSCII:
case AR_ASCII:
case AR_UTF8:
case AR_CP437:
case AR_RIP:
case AR_WIP:
case AR_LOCAL:
......@@ -156,7 +159,7 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client)
}
break;
case AR_PETSCII:
if(!term_supports(PETSCII))
if((term_supports()&CHARSET_FLAGS) != CHARSET_PETSCII)
result=_not;
else result=!_not;
if(!result) {
......@@ -164,6 +167,33 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client)
noaccess_val=PETSCII;
}
break;
case AR_ASCII:
if((term_supports()&CHARSET_FLAGS) != CHARSET_ASCII)
result=_not;
else result=!_not;
if(!result) {
noaccess_str=text[NoAccessTerminal];
noaccess_val=NO_EXASCII;
}
break;
case AR_UTF8:
if((term_supports()&CHARSET_FLAGS) != CHARSET_UTF8)
result=_not;
else result=!_not;
if(!result) {
noaccess_str=text[NoAccessTerminal];
noaccess_val=UTF8;
}
break;
case AR_CP437:
if((term_supports()&CHARSET_FLAGS) != CHARSET_CP437)
result=_not;
else result=!_not;
if(!result) {
noaccess_str=text[NoAccessTerminal];
noaccess_val=0;
}
break;
case AR_RIP:
if(!term_supports(RIP))
result=_not;
......
......@@ -662,7 +662,12 @@ typedef enum { /* Values for xtrn_t.event */
#define ICE_COLOR (1L<<28) /* Bright background color support */
#define UTF8 (1L<<29) /* UTF-8 terminal */
#define TERM_FLAGS (ANSI|COLOR|NO_EXASCII|RIP|WIP|HTML|PETSCII|SWAP_DELETE|ICE_COLOR|UTF8)
#define TERM_FLAGS (ANSI|COLOR|NO_EXASCII|RIP|WIP|HTML|PETSCII|SWAP_DELETE|ICE_COLOR|UTF8)
#define CHARSET_FLAGS (NO_EXASCII|PETSCII|UTF8)
#define CHARSET_ASCII NO_EXASCII // US-ASCII
#define CHARSET_PETSCII PETSCII // CBM-ASCII
#define CHARSET_UTF8 UTF8
#define CHARSET_CP437 0
/* Special terminal key mappings */
#define TERM_KEY_HOME CTRL_B
......
......@@ -1532,6 +1532,9 @@ static BOOL ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user, client_t* client)
switch(artype) {
case AR_ANSI: /* No arguments */
case AR_PETSCII:
case AR_ASCII:
case AR_UTF8:
case AR_CP437:
case AR_RIP:
case AR_WIP:
case AR_LOCAL:
......@@ -1586,7 +1589,22 @@ static BOOL ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user, client_t* client)
else result=!not;
break;
case AR_PETSCII:
if(user==NULL || !(user->misc&PETSCII))
if(user==NULL || (user->misc&CHARSET_FLAGS) != CHARSET_PETSCII)
result=not;
else result=!not;
break;
case AR_ASCII:
if(user==NULL || (user->misc&CHARSET_FLAGS) != CHARSET_ASCII)
result=not;
else result=!not;
break;
case AR_UTF8:
if(user==NULL || (user->misc&CHARSET_FLAGS) != CHARSET_UTF8)
result=not;
else result=!not;
break;
case AR_CP437:
if(user==NULL || (user->misc&CHARSET_FLAGS) != CHARSET_CP437)
result=not;
else result=!not;
break;
......
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