diff options
| -rw-r--r-- | generic/tclBinary.c | 14 | ||||
| -rw-r--r-- | generic/tclCmdIL.c | 15 | ||||
| -rw-r--r-- | generic/tclIO.h | 107 | ||||
| -rw-r--r-- | generic/tclIOGT.c | 25 | ||||
| -rw-r--r-- | generic/tclIORTrans.c | 7 | ||||
| -rw-r--r-- | generic/tclLink.c | 25 | ||||
| -rw-r--r-- | generic/tclTest.c | 8 | ||||
| -rw-r--r-- | macosx/tclMacOSXFCmd.c | 8 | ||||
| -rw-r--r-- | unix/tclSelectNotfy.c | 19 | ||||
| -rw-r--r-- | unix/tclUnixSock.c | 24 |
10 files changed, 126 insertions, 126 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c index ad50d29..f72c38f 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -21,16 +21,18 @@ * The following constants are used by GetFormatSpec to indicate various * special conditions in the parsing of a format specifier. */ - -#define BINARY_ALL -1 /* Use all elements in the argument. */ -#define BINARY_NOCOUNT -2 /* No count was specified in format. */ +enum GetFormatSpecSpecialCounts { + BINARY_ALL = -1, /* Use all elements in the argument. */ + BINARY_NOCOUNT = -2 /* No count was specified in format. */ +}; /* * The following flags may be OR'ed together and returned by GetFormatSpec */ - -#define BINARY_SIGNED 0 /* Field to be read as signed data */ -#define BINARY_UNSIGNED 1 /* Field to be read as unsigned data */ +enum GetFormatSpecFlags { + BINARY_SIGNED = 0, /* Field to be read as signed data */ + BINARY_UNSIGNED = 1 /* Field to be read as unsigned data */ +}; /* * The following defines the maximum number of different (integer) numbers diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 10de1e3..ff897bb 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -88,13 +88,14 @@ typedef struct { * The "sortMode" field of the SortInfo structure can take on any of the * following values. */ - -#define SORTMODE_ASCII 0 -#define SORTMODE_INTEGER 1 -#define SORTMODE_REAL 2 -#define SORTMODE_COMMAND 3 -#define SORTMODE_DICTIONARY 4 -#define SORTMODE_ASCII_NC 8 +enum SortModes { + SORTMODE_ASCII = 0, + SORTMODE_INTEGER = 1, + SORTMODE_REAL = 2, + SORTMODE_COMMAND = 3, + SORTMODE_DICTIONARY = 4, + SORTMODE_ASCII_NC = 8 +}; /* * Definitions for [lseq] command diff --git a/generic/tclIO.h b/generic/tclIO.h index 7825516..7c7bc3b 100644 --- a/generic/tclIO.h +++ b/generic/tclIO.h @@ -227,63 +227,56 @@ typedef struct ChannelState { * options and state bits about the channel. In addition to the flags below, * the channel can also have TCL_READABLE (1<<1) and TCL_WRITABLE (1<<2) set. */ - -#define CHANNEL_NONBLOCKING (1<<6) /* Channel is currently in nonblocking - * mode. */ -#define BG_FLUSH_SCHEDULED (1<<7) /* A background flush of the queued - * output buffers has been - * scheduled. */ -#define CHANNEL_CLOSED (1<<8) /* Channel has been closed. No further - * Tcl-level IO on the channel is - * allowed. */ -#define CHANNEL_EOF (1<<9) /* EOF occurred on this channel. This - * bit is cleared before every input - * operation. */ -#define CHANNEL_STICKY_EOF (1<<10) /* EOF occurred on this channel - * because we saw the input - * eofChar. This bit prevents clearing - * of the EOF bit before every input - * operation. */ -#define CHANNEL_BLOCKED (1<<11) /* EWOULDBLOCK or EAGAIN occurred on - * this channel. This bit is cleared - * before every input or output - * operation. */ -#define INPUT_SAW_CR (1<<12) /* Channel is in CRLF eol input - * translation mode and the last byte - * seen was a "\r". */ -#define CHANNEL_DEAD (1<<13) /* The channel has been closed by the - * exit handler (on exit) but not - * deallocated. When any IO operation - * sees this flag on a channel, it - * does not call driver level - * functions to avoid referring to - * deallocated data. */ -#define CHANNEL_NEED_MORE_DATA (1<<14) /* The last input operation failed - * because there was not enough data - * to complete the operation. This - * flag is set when gets fails to get - * a complete line or when read fails - * to get a complete character. When - * set, file events will not be - * delivered for buffered data until - * the state of the channel - * changes. */ -#define CHANNEL_ENCODING_ERROR (1<<15) /* set if channel - * encountered an encoding error */ -#define CHANNEL_RAW_MODE (1<<16) /* When set, notes that the Raw API is - * being used. */ -#define CHANNEL_LINEBUFFERED (1<<17) /* Output to the channel must be - * flushed after every newline. */ -#define CHANNEL_UNBUFFERED (1<<18) /* Output to the channel must always - * be flushed immediately. */ -#define CHANNEL_INCLOSE (1<<19) /* Channel is currently being closed. - * Its structures are still live and - * usable, but it may not be closed - * again from within the close - * handler. */ -#define CHANNEL_CLOSEDWRITE (1<<21) /* Channel write side has been closed. - * No further Tcl-level write IO on - * the channel is allowed. */ +enum ChannelStateFlags { + CHANNEL_NONBLOCKING = 1<<6, /* Channel is currently in nonblocking mode. */ + BG_FLUSH_SCHEDULED = 1<<7, /* A background flush of the queued output + * buffers has been scheduled. */ + CHANNEL_CLOSED = 1<<8, /* Channel has been closed. No further + * Tcl-level IO on the channel is allowed. */ + CHANNEL_EOF = 1<<9, /* EOF occurred on this channel. This bit is + * cleared before every input operation. */ + CHANNEL_STICKY_EOF = 1<<10, /* EOF occurred on this channel because we saw + * the input eofChar. This bit prevents + * clearing of the EOF bit before every input + * operation. */ + CHANNEL_BLOCKED = 1<<11, /* EWOULDBLOCK or EAGAIN occurred on this + * channel. This bit is cleared before every + * input or output operation. */ + INPUT_SAW_CR = 1<<12, /* Channel is in CRLF eol input translation + * mode and the last byte seen was a "\r". */ + CHANNEL_DEAD = 1<<13, /* The channel has been closed by the exit + * handler (on exit) but not deallocated. When + * any IO operation sees this flag on a + * channel, it does not call driver level + * functions to avoid referring to + * deallocated data. */ + CHANNEL_NEED_MORE_DATA = 1<<14, + /* The last input operation failed because + * there was not enough data to complete the + * operation. This flag is set when gets fails + * to get a complete line or when read fails + * to get a complete character. When set, file + * events will not be delivered for buffered + * data until the state of the channel + * changes. */ + CHANNEL_ENCODING_ERROR = 1<<15, + /* Set if the channel encountered an + * encoding error. */ + CHANNEL_RAW_MODE = 1<<16, /* When set, notes that the Raw API is + * being used. */ + CHANNEL_LINEBUFFERED = 1<<17, + /* Output to the channel must be flushed + * after every newline. */ + CHANNEL_UNBUFFERED = 1<<18, /* Output to the channel must always be + * flushed immediately. */ + CHANNEL_INCLOSE = 1<<19, /* Channel is currently being closed. Its + * structures are still live and usable, but + * it may not be closed again from within the + * close handler. */ + CHANNEL_CLOSEDWRITE = 1<<21 /* Channel write side has been closed. No + * further Tcl-level write IO on the channel + * is allowed. */ +}; /* * The length of time to wait between synthetic timer events. Must be zero or diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index 15ee36c..52a0c97 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -63,19 +63,21 @@ static int ExecuteCallback(TransformChannelData *ctrl, * Action codes to give to 'ExecuteCallback' (argument 'transmit'), telling * the procedure what to do with the result of the script it calls. */ - -#define TRANSMIT_DONT 0 /* No transfer to do. */ -#define TRANSMIT_DOWN 1 /* Transfer to the underlying channel. */ -#define TRANSMIT_SELF 2 /* Transfer into our channel. */ -#define TRANSMIT_IBUF 3 /* Transfer to internal input buffer. */ -#define TRANSMIT_NUM 4 /* Transfer number to 'maxRead'. */ +enum ExecuteCallbackActionCodes { + TRANSMIT_DONT = 0, /* No transfer to do. */ + TRANSMIT_DOWN = 1, /* Transfer to the underlying channel. */ + TRANSMIT_SELF = 2, /* Transfer into our channel. */ + TRANSMIT_IBUF = 3, /* Transfer to internal input buffer. */ + TRANSMIT_NUM = 4 /* Transfer number to 'maxRead'. */ +}; /* * Codes for 'preserve' of 'ExecuteCallback'. */ - -#define P_PRESERVE 1 -#define P_NO_PRESERVE 0 +enum ExecuteCallbackPreserveFlag { + P_PRESERVE = 1, + P_NO_PRESERVE = 0 +}; /* * Strings for the action codes delivered to the script implementing a @@ -137,8 +139,9 @@ static const Tcl_ChannelType transformChannelType = { /* * Possible values for 'flags' field in control structure, see below. */ - -#define CHANNEL_ASYNC (1<<0) /* Non-blocking mode. */ +enum TransformChannelDataFlags { + CHANNEL_ASYNC = (1<<0) /* Non-blocking mode. */ +}; /* * Definition of the structure containing the information about the internal diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index eba5af5..2c2af69 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -466,9 +466,10 @@ static int TransformLimit(ReflectedTransform *rtPtr, /* * Operation codes for TransformFlush(). */ - -#define FLUSH_WRITE 1 -#define FLUSH_DISCARD 0 +enum TransformFlushOperations { + FLUSH_WRITE = 1, + FLUSH_DISCARD = 0 +}; /* * Main methods to plug into the 'chan' ensemble'. ================== diff --git a/generic/tclLink.c b/generic/tclLink.c index 57bad3c..b274e38 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -75,21 +75,18 @@ typedef struct { /* * Definitions for flag bits: - * LINK_READ_ONLY - 1 means errors should be generated if Tcl - * script attempts to write variable. - * LINK_BEING_UPDATED - 1 means that a call to Tcl_UpdateLinkedVar is - * in progress for this variable, so trace - * callbacks on the variable should be ignored. - * LINK_ALLOC_ADDR - 1 means linkPtr->addr was allocated on the - * heap. - * LINK_ALLOC_LAST - 1 means linkPtr->valueLast.p was allocated on - * the heap. */ - -#define LINK_READ_ONLY 1 -#define LINK_BEING_UPDATED 2 -#define LINK_ALLOC_ADDR 4 -#define LINK_ALLOC_LAST 8 +enum LinkFlags { + LINK_READ_ONLY = 1, /* Errors should be generated if Tcl script + * attempts to write variable. */ + LINK_BEING_UPDATED = 2, /* A call to Tcl_UpdateLinkedVar() is in + * progress for this variable, so trace + * callbacks on the variable should be + * ignored. */ + LINK_ALLOC_ADDR = 4, /* linkPtr->addr was allocated on the heap. */ + LINK_ALLOC_LAST = 8 /* linkPtr->valueLast.p was allocated on the + * heap. */ +}; /* * Forward references to functions defined later in this file: diff --git a/generic/tclTest.c b/generic/tclTest.c index dc610db..4472fe1 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -7056,9 +7056,11 @@ TestChannelEventCmd( *---------------------------------------------------------------------- */ -#define TCP_ASYNC_TEST_MODE (1<<8) /* Async testing activated. Do not - * automatically continue connection - * process. */ +enum TcpStateFlags { + TCP_ASYNC_TEST_MODE = 1<<8 /* Async testing activated. Do not + * automatically continue connection + * process. */ +}; static int TestSocketCmd( diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c index 68cc06b..c87e33e 100644 --- a/macosx/tclMacOSXFCmd.c +++ b/macosx/tclMacOSXFCmd.c @@ -25,9 +25,11 @@ #else /* HAVE_COPYFILE_H */ int copyfile(const char *from, const char *to, void *state, uint32_t flags); -#define COPYFILE_ACL (1<<0) -#define COPYFILE_XATTR (1<<2) -#define COPYFILE_NOFOLLOW_SRC (1<<18) +enum TclCopyfileFlags { + COPYFILE_ACL = (1<<0), + COPYFILE_XATTR = (1<<2), + COPYFILE_NOFOLLOW_SRC = (1<<18) +}; #endif /* HAVE_COPYFILE_H */ #endif /* HAVE_COPYFILE */ diff --git a/unix/tclSelectNotfy.c b/unix/tclSelectNotfy.c index c2020ca..1b96ecf 100644 --- a/unix/tclSelectNotfy.c +++ b/unix/tclSelectNotfy.c @@ -180,17 +180,16 @@ static pthread_cond_t notifierCV = PTHREAD_COND_INITIALIZER; /* * The pollState bits: - * - * POLL_WANT is set by each thread before it waits on its condition variable. - * It is checked by the notifier before it does select. - * - * POLL_DONE is set by the notifier if it goes into select after seeing - * POLL_WANT. The idea is to ensure it tries a select with the same bits - * the initial thread had set. */ - -#define POLL_WANT 0x1 -#define POLL_DONE 0x2 +enum SelectPollStateFlags { + POLL_WANT = 0x1, /* Set by each thread before it waits on its + * condition variable. Checked by the notifier + * before it does select(). */ + POLL_DONE = 0x2 /* Set by the notifier if it goes into select() + * after seeing POLL_WANT. The idea is to + * ensure it tries a select() with the same + * bits the initial thread had set. */ +}; /* * This is the thread ID of the notifier thread that does select. diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index eed898b..eacb05d 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -84,18 +84,18 @@ struct TcpState { * These bits may be OR'ed together into the "flags" field of a TcpState * structure. */ - -#define TCP_NONBLOCKING (1<<0) /* Socket with non-blocking I/O */ -#define TCP_ASYNC_CONNECT (1<<1) /* Async connect in progress. */ -#define TCP_ASYNC_PENDING (1<<4) /* TcpConnect was called to - * process an async connect. This - * flag indicates that reentry is - * still pending */ -#define TCP_ASYNC_FAILED (1<<5) /* An async connect finally failed */ - -#define TCP_ASYNC_TEST_MODE (1<<8) /* Async testing activated. Do not - * automatically continue connection - * process. */ +enum TcpStateFlags { + TCP_NONBLOCKING = 1<<0, /* Socket with non-blocking I/O */ + TCP_ASYNC_CONNECT = 1<<1, /* Async connect in progress. */ + TCP_ASYNC_PENDING = 1<<4, /* TcpConnect was called to process an async + * connect. This flag indicates that reentry + * is still pending */ + TCP_ASYNC_FAILED = 1<<5, /* An async connect finally failed. */ + + TCP_ASYNC_TEST_MODE = 1<<8 /* Async testing activated. Do not + * automatically continue connection + * process. */ +}; /* * The following defines the maximum length of the listen queue. This is the |
