Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 23b1912a authored by rswindell's avatar rswindell

Buld SyncTERM/VT4xx style output rate limiting into the BBS:

- new @-code BPS:x (where x is 0/unlimited, 300, 600, 1200, 2400, ... 115200)
- new JS property: console.output_rate
So you can have mutliple output rate changes in a single file by using multiple
BPS @-codes.
Hopefully this doesn't do weird things with non-compliant terminals.
parent 2cb099b3
......@@ -479,6 +479,11 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen, long* pmode)
return str;
}
if(strncmp(sp, "BPS:", 4) == 0) {
set_output_rate((enum output_rate)atoi(sp + 4));
return nulstr;
}
/* NOSTOP */
/* STOP */
......
......@@ -915,6 +915,20 @@ void sbbs_t::cleartoeos(void)
rputs("\x1b[J");
}
void sbbs_t::set_output_rate(enum output_rate speed)
{
if(term_supports(ANSI)) {
unsigned int num = 0;
unsigned int val = speed;
while(val >= 300) {
num++;
val >>= 1;
}
rprintf("\x1b[;%u*r", num);
cur_output_rate = speed;
}
}
/****************************************************************************/
/* performs the correct attribute modifications for the Ctrl-A code */
/****************************************************************************/
......
......@@ -74,6 +74,8 @@ enum {
,CON_PROP_INBUF_SPACE
,CON_PROP_OUTBUF_LEVEL
,CON_PROP_OUTBUF_SPACE
,CON_PROP_OUTPUT_RATE
};
extern JSClass js_console_class;
......@@ -190,6 +192,9 @@ static JSBool js_console_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
case CON_PROP_OUTBUF_SPACE:
val=RingBufFree(&sbbs->outbuf);
break;
case CON_PROP_OUTPUT_RATE:
val = sbbs->cur_output_rate;
break;
default:
return(JS_TRUE);
......@@ -322,6 +327,9 @@ static JSBool js_console_set(JSContext *cx, JSObject *obj, jsid id, JSBool stric
}
sbbs->cfg.ctrlkey_passthru=val;
break;
case CON_PROP_OUTPUT_RATE:
sbbs->set_output_rate((enum sbbs_t::output_rate)val);
break;
default:
return(JS_TRUE);
......@@ -364,6 +372,7 @@ static jsSyncPropertySpec js_console_properties[] = {
{ "input_buffer_space",CON_PROP_INBUF_SPACE ,JSPROP_ENUMERATE|JSPROP_READONLY, 312},
{ "output_buffer_level",CON_PROP_OUTBUF_LEVEL ,JSPROP_ENUMERATE|JSPROP_READONLY, 312},
{ "output_buffer_space",CON_PROP_OUTBUF_SPACE ,JSPROP_ENUMERATE|JSPROP_READONLY, 312},
{ "output_rate" ,CON_PROP_OUTPUT_RATE ,JSPROP_ENUMERATE, 31702},
{0}
};
......@@ -407,6 +416,7 @@ static const char* con_prop_desc[] = {
,"number of bytes available in the input buffer - <small>READ ONLY</small>"
,"number of bytes currently in the output buffer (from the local server) - <small>READ ONLY</small>"
,"number of bytes available in the output buffer - <small>READ ONLY</small>"
,"emulated serial data output rate, in bits-per-second (0 = unlimited)"
,NULL
};
#endif
......
......@@ -4339,6 +4339,7 @@ void sbbs_t::reset_logon_vars(void)
cur_cps=3000;
cur_rate=30000;
dte_rate=38400;
cur_output_rate = output_rate_unlimited;
main_cmds=xfer_cmds=posts_read=0;
lastnodemsg=0;
lastnodemsguser[0]=0;
......
......@@ -392,6 +392,8 @@ char sbbs_t::putmsg(const char *buf, long mode, long org_cols)
console=orgcon;
attr(tmpatr);
}
if(cur_output_rate != output_rate_unlimited && !(mode&P_NOATCODES))
set_output_rate(output_rate_unlimited);
attr_sp=0; /* clear any saved attributes */
......
......@@ -755,6 +755,21 @@ public:
int attr(int); /* Change text color/attributes */
void ctrl_a(char); /* Performs Ctrl-Ax attribute changes */
char* auto_utf8(const char*, long* mode);
enum output_rate {
output_rate_unlimited,
output_rate_300 = 300,
output_rate_600 = 600,
output_rate_1200 = 1200,
output_rate_2400 = 2400,
output_rate_4800 = 4800,
output_rate_9600 = 9600,
output_rate_19200 = 19200,
output_rate_38400 = 38400,
output_rate_57600 = 57600,
output_rate_76800 = 76800,
output_rate_115200 = 115200,
} cur_output_rate;
void set_output_rate(enum output_rate);
/* getstr.cpp */
size_t getstr_offset;
......
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