2017-04-25 14:41:48 +02:00
|
|
|
/*
|
|
|
|
|
* textioInt.h --
|
|
|
|
|
*
|
|
|
|
|
* INTERNAL definitions for the textio module
|
|
|
|
|
*
|
2020-05-23 23:13:14 +02:00
|
|
|
* *********************************************************************
|
|
|
|
|
* * Copyright (C) 1985, 1990 Regents of the University of California. *
|
|
|
|
|
* * Permission to use, copy, modify, and distribute this *
|
|
|
|
|
* * software and its documentation for any purpose and without *
|
|
|
|
|
* * fee is hereby granted, provided that the above copyright *
|
|
|
|
|
* * notice appear in all copies. The University of California *
|
|
|
|
|
* * makes no representations about the suitability of this *
|
|
|
|
|
* * software for any purpose. It is provided "as is" without *
|
|
|
|
|
* * express or implied warranty. Export of this software outside *
|
|
|
|
|
* * of the United States of America may require an export license. *
|
2017-04-25 14:41:48 +02:00
|
|
|
* *********************************************************************
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* rcsid $Header: /usr/cvsroot/magic-8.0/textio/textioInt.h,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $
|
|
|
|
|
*/
|
|
|
|
|
|
2024-10-16 08:38:41 +02:00
|
|
|
#ifndef _MAGIC__TEXTIO__TEXTIOINT_H
|
|
|
|
|
#define _MAGIC__TEXTIO__TEXTIOINT_H
|
2017-04-25 14:41:48 +02:00
|
|
|
|
2025-01-31 18:11:07 +01:00
|
|
|
#include "utils/magic.h"
|
2017-04-25 14:41:48 +02:00
|
|
|
#include "textio/textio.h"
|
|
|
|
|
#include "textio/txcommands.h"
|
|
|
|
|
|
|
|
|
|
extern bool txHavePrompt;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2020-05-23 23:13:14 +02:00
|
|
|
fd_set tx_fdmask; /* A mask of the file descriptors for this
|
2017-04-25 14:41:48 +02:00
|
|
|
* device.
|
|
|
|
|
*/
|
2025-01-31 18:29:41 +01:00
|
|
|
cb_textio_input_t tx_inputProc;
|
|
|
|
|
/* A procedure that fetches events and stores
|
2017-04-25 14:41:48 +02:00
|
|
|
* them in the input queue via TxAddEvent().
|
|
|
|
|
*/
|
|
|
|
|
ClientData tx_cdata; /* Data to be passed back to caller. */
|
|
|
|
|
} txInputDevRec;
|
|
|
|
|
|
|
|
|
|
#define TX_PROMPT '>'
|
|
|
|
|
#define TX_CMD_PROMPT ":"
|
|
|
|
|
|
|
|
|
|
/* all of the state associated with a tty terminal */
|
2023-07-11 17:31:37 +02:00
|
|
|
#if !defined(SYSV) && !defined(CYGWIN) && !defined(__OpenBSD__) && !defined(EMSCRIPTEN)
|
2025-07-17 21:57:25 +02:00
|
|
|
#if defined(HAVE_SYS_IOCTL_COMPAT_H) || defined(HAVE_SGTTY_H)
|
|
|
|
|
#if defined(HAVE_SYS_IOCTL_COMPAT_H)
|
|
|
|
|
#include <sys/ioctl_compat.h> /* replaced sgtty.h */
|
|
|
|
|
#elif defined(HAVE_SGTTY_H)
|
|
|
|
|
#include <sgtty.h>/* legacy - struct sgttyb{} defn */
|
|
|
|
|
#endif
|
2017-04-25 14:41:48 +02:00
|
|
|
typedef struct {
|
|
|
|
|
struct sgttyb tx_i_sgtty;
|
|
|
|
|
struct tchars tx_i_tchars;
|
|
|
|
|
} txTermState;
|
2025-07-17 21:57:25 +02:00
|
|
|
#endif /* HAVE_SYS_IOCTL_COMPAT_H || HAVE_SGTTY_H */
|
2017-04-25 14:41:48 +02:00
|
|
|
#endif /* SYSV */
|
|
|
|
|
|
2025-01-31 18:11:07 +01:00
|
|
|
extern bool TxGetInputEvent(bool block, bool returnOnSigWinch);
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
/* Routines with variable argument lists */
|
|
|
|
|
|
2025-01-31 18:11:07 +01:00
|
|
|
extern void txFprintfBasic(FILE *f, const char *fmt, ...) ATTR_FORMAT_PRINTF_2;
|
2017-04-25 14:41:48 +02:00
|
|
|
|
2022-10-10 11:50:15 +02:00
|
|
|
/* C99 compat */
|
2025-01-31 18:11:07 +01:00
|
|
|
extern void txCommandsInit(void);
|
|
|
|
|
extern int TranslateChar(int key);
|
2025-01-31 18:15:29 +01:00
|
|
|
extern char *TxGetLineWPrompt(char *dest, int maxChars, const char *prompt, const char *prefix);
|
2022-10-10 11:50:15 +02:00
|
|
|
|
2022-10-28 07:50:29 +02:00
|
|
|
#ifdef MAGIC_WRAPPER
|
2025-01-31 18:09:05 +01:00
|
|
|
/* tcltk/tclmagic.c has a function implementation prototype mimics vfprintf() mapping
|
|
|
|
|
* when ifndef MAGIC_WRAPPER
|
|
|
|
|
*/
|
|
|
|
|
extern int Tcl_printf(FILE *fp, const char *fmt, va_list ap);
|
2022-10-28 07:50:29 +02:00
|
|
|
#endif
|
|
|
|
|
|
2024-10-16 08:38:41 +02:00
|
|
|
#endif /* _MAGIC__TEXTIO__TEXTIOINT_H */
|