1 /* 2 * textio.h -- 3 * 4 * Routines in the textio module 5 * 6 * ********************************************************************* 7 * * Copyright (C) 1985, 1990 Regents of the University of California. * 8 * * Permission to use, copy, modify, and distribute this * 9 * * software and its documentation for any purpose and without * 10 * * fee is hereby granted, provided that the above copyright * 11 * * notice appear in all copies. The University of California * 12 * * makes no representations about the suitability of this * 13 * * software for any purpose. It is provided "as is" without * 14 * * express or implied warranty. Export of this software outside * 15 * * of the United States of America may require an export license. * 16 * ********************************************************************* 17 * 18 * Needs: 19 * stdio.h 20 * magic.h 21 * 22 * rcsid $Header: /usr/cvsroot/magic-8.0/textio/textio.h,v 1.2 2008/02/18 01:01:35 tim Exp $ 23 */ 24 25 #ifndef _TEXTIO_H 26 #define _TEXTIO_H 27 28 #include "utils/magic.h" 29 30 #ifdef MAGIC_WRAPPER 31 extern char *TxBuffer; 32 extern unsigned char TxInputRedirect; 33 34 #define TX_INPUT_NORMAL 0 /* keys translated as macros */ 35 #define TX_INPUT_REDIRECTED 1 /* keys redirected to terminal */ 36 #define TX_INPUT_PROCESSING 2 /* executing a command via redirection */ 37 #define TX_INPUT_PENDING_RESET 3 /* about to switch back to state 0 */ 38 39 #endif 40 41 extern int TxCurButtons; 42 43 /* These should really be defined by the application, not hard-coded */ 44 #define TX_LONG_CMD ':' /* Way of invoking a long command. */ 45 #define TX_LONG_CMD2 ';' /* Alternate way of invoking a long command. */ 46 47 /* 48 * Procedure to print text on stdout and stderr. 49 */ 50 51 #ifdef MAGIC_WRAPPER 52 #define Vfprintf Tcl_printf 53 #else 54 #define Vfprintf vfprintf 55 #endif /* MAGIC_WRAPPER */ 56 57 /* printing procedures */ 58 extern bool TxPrintOn(); /* enables TxPrintf output */ 59 extern bool TxPrintOff(); /* disables TxPrintf output */ 60 extern void TxFlush(); 61 extern void TxFlushOut(); 62 extern void TxFlushErr(); 63 extern void TxVisChar(); 64 extern void TxUseMore(); 65 extern void TxStopMore(); 66 67 /* printing procedures with variable arguments lists */ 68 extern void TxError(char *, ...); 69 extern void TxPrintf(char *, ...); 70 extern char *TxPrintString(char *, ...); 71 72 /* input procedures */ 73 extern char *TxGetLinePrompt(); 74 extern char *TxGetLine(); 75 extern int TxGetChar(); 76 extern int TxDialog(); 77 78 /* prompting procedures */ 79 extern void TxSetPrompt(); 80 extern void TxPrompt(); 81 extern void TxPromptOnNewLine(); 82 extern void TxUnPrompt(); 83 extern void TxRestorePrompt(); 84 extern void TxReprint(); 85 86 /* terminal-state procedures */ 87 extern void TxSetTerminal(); 88 extern void TxResetTerminal(); 89 extern char TxEOFChar; /* The current EOF character */ 90 extern char TxInterruptChar; /* The current interrupt character */ 91 92 /* command procedures */ 93 extern void TxDispatch(); 94 95 /* variables that tell if stdin and stdout are to a terminal */ 96 extern bool TxStdinIsatty; 97 extern bool TxStdoutIsatty; 98 #define TxInteractive (TxStdinIsatty && TxStdoutIsatty) 99 100 /* Misc procs */ 101 void TxInit(); 102 #ifdef USE_READLINE 103 void TxInitReadline(); 104 #endif 105 106 #define TX_MAX_OPEN_FILES 20 107 108 #endif /* _TEXTIO_H */ 109