🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9623

CTRL(x)

#9623
From: Arthur David Olson
Date: Tue, 21 Oct 1986 03:59
31 lines
1280 bytes
Sorry if this has gone around before.

With the Reiser cpp, you can (and "/usr/include/sys/tty.h" does)
	#define	CTRL(c)	('c'&037)
so that a line such as
	CTRL(z)
turns into
	('z'&037)

With ANSI cpp, if you keep the define as above and have a line such as
	CTRL(z)
it turns into
	('c'&037)
which isn't what's wanted.

One possibility is to establish a new macro,
	#define Ctrl(c) ((c)&037)
and change all uses such as
	CTRL(z)
into uses such as
	Ctrl('z')

But. . .is there a way to write an ANSI cpp version of
	#define CTRL(c)
that will work like the old Reiser version?  If you know,
please mail me the answer.  Thanks.
--
ANSI may be an ANSI trademark.
--
	UUCP: ..decvax!seismo!elsie!ado   ARPA: elsie!ado@seismo.ARPA
	DEC, VAX, Elsie & Ado are Digital, Borden & Ampex trademarks.
Technical Details
Message-ID: <7111@elsie.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!elbereth!rutgers!seismo!elsie!ado

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!elbereth!rutgers!seismo!elsie!ado
From: ado@elsie.UUCP (Arthur David Olson)
Newsgroups: net.lang.c
Subject: CTRL(x)
Message-ID: <7111@elsie.UUCP>
Date: Mon, 20-Oct-86 23:59:16 EDT
Article-I.D.: elsie.7111
Posted: Mon Oct 20 23:59:16 1986
Date-Received: Wed, 22-Oct-86 04:41:14 EDT
Followup-To: poster
Organization: NIH-LEC, Bethesda, MD
Lines: 31
Keywords: cpp