From: Eric Mullins Date: Sat, 10 Oct 2009 20:19:30 +0000 (-0600) Subject: added ics_printf() and ics_update_width() and utility functions X-Git-Tag: v4.4.1.20091019~37 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=7374a58a95b38c103fe899d3cd06edc3e03647d4;p=xboard.git added ics_printf() and ics_update_width() and utility functions --- diff --git a/backend.c b/backend.c index 5579115..39e48a7 100644 --- a/backend.c +++ b/backend.c @@ -147,6 +147,7 @@ void read_from_player P((InputSourceRef isr, VOIDSTAR closure, char *buf, int count, int error)); void read_from_ics P((InputSourceRef isr, VOIDSTAR closure, char *buf, int count, int error)); +void ics_printf P((char *format, ...)); void SendToICS P((char *s)); void SendToICSDelayed P((char *s, long msdelay)); void SendMoveToICS P((ChessMove moveType, int fromX, int fromY, @@ -229,6 +230,7 @@ char *GetInfoFromComment( int, char * ); // [HGM] PV time: returns stripped comm void InitEngineUCI( const char * iniDir, ChessProgramState * cps ); // [HGM] moved here from winboard.c char *ProbeBook P((int moveNr, char *book)); // [HGM] book: returns a book move char *SendMoveToBookUser P((int nr, ChessProgramState *cps, int initial)); // [HGM] book +void ics_update_width P((int new_width)); extern char installDir[MSG_SIZ]; extern int tinyLayout, smallLayout; @@ -1418,6 +1420,17 @@ KeepAlive() if(appData.keepAlive) ScheduleDelayedEvent(KeepAlive, appData.keepAlive*60*1000); } +/* added routine for printf style output to ics */ +void ics_printf(char *format, ...) +{ + char buffer[MSG_SIZ], *args; + + args = (char *)&format + sizeof(format); + vsnprintf(buffer, sizeof(buffer), format, args); + buffer[sizeof(buffer)-1] = '\0'; + SendToICS(buffer); +} + void SendToICS(s) char *s; @@ -3930,6 +3943,12 @@ AnalysisPeriodicEvent(force) programStats.ok_to_send = 0; } +void ics_update_width(new_width) + int new_width; +{ + ics_printf("set width %d\n", new_width); +} + void SendMoveToProgram(moveNum, cps) int moveNum; diff --git a/backend.h b/backend.h index 4cc8646..7b6c08e 100644 --- a/backend.h +++ b/backend.h @@ -258,7 +258,7 @@ char * GameListLineFull P(( int, GameInfo *)); extern char* StripHighlight P((char *)); /* returns static data */ extern char* StripHighlightAndTitle P((char *)); /* returns static data */ - +extern void ics_update_width P((int new_width)); typedef enum { CheckBox, ComboBox, TextBox, Button, Spin, ResetButton, SaveButton, FileName, PathName, Slider, Message } Control; diff --git a/backendz.h b/backendz.h index eb8df7d..51d4780 100644 --- a/backendz.h +++ b/backendz.h @@ -64,6 +64,7 @@ extern ProcRef firstProgramPR; extern int startedFromSetupPosition; extern int firstMove; extern GameInfo gameInfo; +extern void ics_printf P((char *format, ...)); extern void SendToICS P((char *s)); extern int looking_at P((char *, int *, char *)); extern void SendToProgram P((char *message, ChessProgramState *cps));