Why all this fuss about CTRL(X) ??
Hall
marcus at ihlpl.UUCP
Tue Dec 16 05:09:33 AEST 1986
In article <184 at devon.UUCP> paul at devon.UUCP (Paul Sutcliffe Jr.) writes:
>In article <1955 at watdragon.UUCP>, jmsellens at watdragon.UUCP (John M. Sellens) writes:
>> Make a file called ctrl.h with lines like
>> #define CTRLA '\001'
>> in it (should take mere seconds). Put #include "ctrl.h" in your
>> C source files and use CTRLA. No fuss, no muss. Easy to understand.
>> Portable. And it even works.
>
>That's fine if you know ahead of time what control characters you
>want to play with. However, if I want to find the ``control'' value
>of a variable, as in:
> ..[example]..
>then your method, although good for what it was intended, won't do.
But then, neither did the initial definition for CTRL(X) that started
this whole mess.
Recall the initial definition:
#define CTRL(X) ('X' ^ 0100)
or something very similar that works only for the Reiser cpp (& similar).
John Sellens' idea for cntrl.h leads to yet another possibility that maybe
would implement CTRL for either cpp (Reiser or ANSI) in a way that would
be compatible with the original definition (i.e. no 's required).
Suppose that you have a file ctrl.h that contains:
#define __CTRLA '\001'
#define __CTRLB '\002'
...
#define __CTRLZ '\003'
#define CTRL(X) __CTRL/**/X /* Reiser cpp */
#define CTRL(X) __CTRL//**/**/X /* (May need to be this, to preserve X */
#define CTRL(X) __CTRL # X /* ANSI cpp */
This would still have some problems with things like CTRL(@) and CTRL(?),
but it comes close..
Marcus Hall
..!ihnp4!ihlpl!marcus
More information about the Comp.lang.c
mailing list