K&R textio: conversion to ANSI

K&R obsolete syntax removal for C23 compatibility series
This commit is contained in:
Darryl L. Miles 2025-01-31 17:11:07 +00:00 committed by Tim Edwards
parent 6c6e48a9a3
commit 8cce1bdb7e
3 changed files with 52 additions and 49 deletions

View File

@ -26,6 +26,7 @@
#define _TEXTIO_H
#include "utils/magic.h"
#include "utils/dqueue.h" /* DQueue */
#ifdef MAGIC_WRAPPER
extern char *TxBuffer;
@ -58,13 +59,13 @@ extern int TxCurButtons;
#endif /* MAGIC_WRAPPER */
/* printing procedures */
extern bool TxPrintOn(); /* enables TxPrintf output */
extern bool TxPrintOff(); /* disables TxPrintf output */
extern void TxFlush();
extern void TxFlushOut();
extern void TxFlushErr();
extern void TxUseMore();
extern void TxStopMore();
extern bool TxPrintOn(void); /* enables TxPrintf output */
extern bool TxPrintOff(void); /* disables TxPrintf output */
extern void TxFlush(void);
extern void TxFlushOut(void);
extern void TxFlushErr(void);
extern void TxUseMore(void);
extern void TxStopMore(void);
/* printing procedures with variable arguments lists */
extern void TxError(const char *, ...) ATTR_FORMAT_PRINTF_1;
@ -73,30 +74,30 @@ extern void TxPrintf(const char *, ...) ATTR_FORMAT_PRINTF_1;
extern char *TxPrintString(const char *, ...) ATTR_FORMAT_PRINTF_1;
/* input procedures */
extern char *TxGetLinePrompt();
extern char *TxGetLine();
extern int TxGetChar();
extern int TxDialog();
extern char *TxGetLinePrompt(char *dest, int maxChars, char *prompt);
extern char *TxGetLine(char *line, int len);
extern int TxGetChar(void);
extern int TxDialog(char *prompt, char *(responses[]), int defresp);
/* prompting procedures */
extern void TxSetPrompt();
extern void TxPrompt();
extern void TxUnPrompt();
extern void TxRestorePrompt();
extern void TxReprint();
extern void TxSetPrompt(char ch);
extern void TxPrompt(void);
extern void TxUnPrompt(void);
extern void TxRestorePrompt(void);
extern void TxReprint(void);
/* terminal-state procedures */
extern void TxSetTerminal();
extern void TxSetTerminal(void);
extern void TxResetTerminal(bool force);
extern char TxEOFChar; /* The current EOF character */
extern char TxInterruptChar; /* The current interrupt character */
/* command procedures */
extern void TxDispatch();
extern void TxDispatch(FILE *f);
/* C99 compat */
extern void TxMore();
extern void txGetFileCommand();
extern void TxMore(char *mesg);
extern void txGetFileCommand(FILE *f, DQueue *queue);
/* variables that tell if stdin and stdout are to a terminal */
extern bool TxStdinIsatty;
@ -104,9 +105,9 @@ extern bool TxStdoutIsatty;
#define TxInteractive (TxStdinIsatty && TxStdoutIsatty)
/* Misc procs */
void TxInit();
extern void TxInit(void);
#ifdef USE_READLINE
void TxInitReadline();
extern void TxInitReadline(void);
#endif
#define TX_MAX_OPEN_FILES 20

View File

@ -22,6 +22,7 @@
#ifndef _TEXTIOINT_H
#define _TEXTIOINT_H
#include "utils/magic.h"
#include "textio/textio.h"
#include "textio/txcommands.h"
@ -48,16 +49,16 @@ typedef struct {
} txTermState;
#endif /* SYSV */
extern bool TxGetInputEvent();
extern bool TxGetInputEvent(bool block, bool returnOnSigWinch);
/* Routines with variable argument lists */
extern void txFprintfBasic(FILE *, const char *fmt, ...) ATTR_FORMAT_PRINTF_2;
extern void txFprintfBasic(FILE *f, const char *fmt, ...) ATTR_FORMAT_PRINTF_2;
/* C99 compat */
void txCommandsInit();
int TranslateChar();
char *TxGetLineWPrompt();
extern void txCommandsInit(void);
extern int TranslateChar(int key);
extern char *TxGetLineWPrompt(char *dest, int maxChars, char *prompt, char *prefix);
#ifdef MAGIC_WRAPPER
/* tcltk/tclmagic.c has a function implementation prototype mimics vfprintf() mapping

View File

@ -23,6 +23,7 @@
#include "utils/magic.h"
#include "utils/geometry.h"
#include "windows/windows.h" /* MagWindow */
/* Structure of one Magic command. All commands are in the same format.
* Commands are tagged with the point and window at which the command was
@ -117,24 +118,24 @@ extern TxCommand TxCurCommand;
/* procedures to help in making device command routines */
extern void TxAddInputDevice(const fd_set *fdmask, void (*inputProc)(), ClientData cdata); /* Can read multiple file desc. */
extern void TxAdd1InputDevice(); /* Can read only 1 file desc. */
extern void TxAdd1InputDevice(int fd, void (*inputProc)(), ClientData cdata); /* Can read only 1 file desc. */
extern void TxDeleteInputDevice(const fd_set *fdmask);
extern void TxDelete1InputDevice();
extern void TxDelete1InputDevice(int fd);
/* Routines to manipulate the current point. Only really used for command
* scripts.
*/
extern void TxSetPoint();
extern int TxGetPoint();
extern void TxClearPoint();
extern void TxSetPoint(int x, int y, int wid);
extern int TxGetPoint(Point *tx_p);
extern void TxClearPoint(void);
/* Routines to handle command logging.
*/
extern void TxLogStart();
extern void TxLogStop();
extern void TxLogUpdate();
extern void TxLogSuspend();
extern void TxLogResume();
extern void TxLogStart(char *fileName, MagWindow *mw);
extern void TxLogStop(void);
extern void TxLogUpdate(void);
extern void TxLogSuspend(void);
extern void TxLogResume(void);
/* Routines for handling input events. A typical device driver in the
@ -142,25 +143,25 @@ extern void TxLogResume();
* then put them in the input queue via TxAddEvent().
*/
extern TxInputEvent *TxNewEvent();
extern void TxAddEvent();
extern void TxPrintEvent();
extern void TxFreeEvent();
extern void TxReleaseButton();
extern TxInputEvent *TxNewEvent(void);
extern void TxAddEvent(TxInputEvent *event);
extern void TxPrintEvent(TxInputEvent *event);
extern void TxFreeEvent(TxInputEvent *event);
extern void TxReleaseButton(int but);
/* Routines for dealing with commands. Usually only used within this
* module, although they may be used elsewhere.
*/
extern void TxPrintCommand();
extern TxCommand *TxNewCommand();
extern void TxFreeCommand();
extern void TxParseString();
extern void TxDispatch();
extern void TxRebuildCommand();
extern void TxPrintCommand(TxCommand *cmd);
extern TxCommand *TxNewCommand(void);
extern void TxFreeCommand(TxCommand *command);
extern void TxParseString(char *str, void *q, void *event);
extern void TxDispatch(FILE *f);
extern void TxRebuildCommand(TxCommand *cmd);
extern int TxCommandNumber; /* Serial number of current command. */
#ifdef MAGIC_WRAPPER
extern int TxTclDispatch();
extern int TxTclDispatch(ClientData clientData, int argc, char *argv[], bool quiet);
#endif
#endif /* _TXCOMMANDS_H */