Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!lll-crg!ames!ucbcad!ucbvax!cbatt!ihnp4!ihlpl!marcus
From: marcus@ihlpl.UUCP (Hall)
Newsgroups: comp.lang.c
Subject: Re: Why all this fuss about CTRL(X) ??
Message-ID: <1581@ihlpl.UUCP>
Date: Mon, 15-Dec-86 14:09:33 EST
Article-I.D.: ihlpl.1581
Posted: Mon Dec 15 14:09:33 1986
Date-Received: Wed, 17-Dec-86 02:46:55 EST
References: <1955@watdragon.UUCP> <184@devon.UUCP>
Reply-To: marcus@ihlpl.UUCP (Marcus Hall)
Organization: AT&T Information Systems, Indian Hill West, Illinois
Lines: 44

In article <184@devon.UUCP> paul@devon.UUCP (Paul Sutcliffe Jr.) writes:
>In article <1955@watdragon.UUCP>, jmsellens@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