[net.sources] Using identifiers with more than 7 chars. #$%@

ron@dsi1.UUCP (Ron Flax) (03/04/86)

Sorry  for posting here but where else does one post to readers of this
newsgroup?

[FLAME ON!]

I  wish  that the people that post sources to the net would try to keep
in mind that some of us have compilers that can't swollow  indentifiers
that are longer than seven (7) characters long.  Now I know that all of
you guys and gals in BSDLand like to make you programs look real pretty
with  all  those  nice  long  descriptive  names for your functions and
macros but some of your less fortunate  counterparts  don't  have  this
luxury and it's a real pain to go through an entire program full of

	system_call_seven (what_ever_cmd_five);
		. . .
	system_call_eight (what_ever_cmd_four);

you  get  my drift?  I realize that some programs are not going to port
to some machines, but when someone claims to the  net  that  a  program
will  be  "easy  to  port" or that "it should run on..."  they could at
least make an attempt to verify  this  fact.    Maybe  they  should  be
sentenced  to  work  on  a  machine  that  chokes  on  the    slightest
inconsistancy for a while.

[FLAME OFF now.]


--
Ron Flax  (ron@dsi1.UUCP)
ARPA:	dsi1!ron@seismo.arpa
UUCP:	..!{seismo, rlgvax, prometheus}!dsi1!ron

jpn@teddy.UUCP (03/04/86)

>[FLAME ON!]
>
>I  wish  that the people that post sources to the net would try to keep
>in mind that some of us have compilers that can't swollow  indentifiers
>that are longer than seven (7) characters long.

I cannot sympathize.  I have a program that was posted to the net some
time ago called "shortc" which takes all conflicting long identifiers in
a set of source files, and outputs #defines to differentiate them (which
you can either insert into each source file, or into a header included
by each file).  5 minutes work, and ANY program with long identifiers can
be made to run.

Of course, if the pre-processor you have is ALSO limited to 7 characters,
then you may STILL have a problem, since shortc assumes the preprocessor
can differentiate all identifiers in the program.  Of course, if this is
the case, I would throw away that compiler, and start over!

Of course, even with a bogus compiler, and a bogus preprocessor, you can
still take the output of shortc and apply the changes by hand yourself!  The
program will be less readable after this transformation, though.  No
doubt shortc could be modified to output awk scripts, or something, to
automate this process.

Is there enough interest to have this program re-posted to the net?


John P. Nelson (decvax!genrad!teddy!jpn seismo!harvard!talcott!panda!teddy!jpn)

steven@boring.uucp (Steven Pemberton) (03/05/86)

In article <526@dsi1.UUCP> ron@dsi1.UUCP (Ron Flax) writes:
> I  wish  that the people that post sources to the net would try to keep
> in mind that some of us have compilers that can't swollow  indentifiers
> that are longer than seven (7) characters long.

The problem is that the compilers don't have a switch to ask them to check
for such limits. Even if you're trying to write portable programs, it is all
too easy to use identifiers that don't differ over the right number of
characters.

Here then is a reposting of three little shell command files I wrote (only
tried under BSD: they use the nm(1) command, and depend on its output
format) to check different limits:

	8limit - all identifiers used in an object module differ over the
		 first 8 characters
	7limit - all external identifiers in a binary differ over the
		 first 7 characters
	6limit - all externals in a binary differ in the first 6 characters
		 case-insensitively (some people really have this limit!)

Note carefully that 8limit takes a list of *.o files, while 6/7limit take an
executable.

Steven Pemberton, CWI, Amsterdam; steven@mcvax.uucp

: ---------------------- CUT HERE -------------------------------
: This is a shar archive. Extract with sh, not csh.
: The rest of this file will extract:
: 6limit 7limit 8limit
echo x - 6limit
sed -e 's/^X//' <<'Bye-Bye' >6limit
X: Check externals differ case-insensitively over first 6 chars
Xcase $# in
X1) ;;
X*) echo Usage: $0 executable-file ; exit 1;;
Xesac
X
Xtrap 'rm -f /tmp/lim1.$$ /tmp/lim2.$$; exit 1' 1 2 15
Xnm -g $1 | sed "s/^............//" >/tmp/lim1.$$
Xsed "s/^\(......\).*/\1/" </tmp/lim1.$$ | tr A-Z a-z | sort | uniq -d | sed "s/.*/grep -i \"^&\" \/tmp\/lim1.$$/" > /tmp/lim2.$$
Xif test -s /tmp/lim2.$$
Xthen
X	echo The following externals don\'t differ in the first 6 characters:
X	sh /tmp/lim2.$$
Xelse
X	echo All externals differ in the first 6 characters
Xfi
Xrm -f /tmp/lim1.$$ /tmp/lim2.$$
Bye-Bye
echo x - 7limit
sed -e 's/^X//' <<'Bye-Bye' >7limit
X: Check externals differ over first 7 chars
Xcase $# in
X1) ;;
X*) echo Usage: $0 executable-file ; exit 1;;
Xesac
X
Xtrap 'rm -f /tmp/lim1.$$ /tmp/lim2.$$; exit 1' 1 2 15
Xnm -g $1 | sed "s/^............//" >/tmp/lim1.$$
Xsed "s/^\(.......\).*/\1/" </tmp/lim1.$$ | uniq -d | sed "s/.*/grep \"^&\" \/tmp\/lim1.$$/" > /tmp/lim2.$$
Xif test -s /tmp/lim2.$$
Xthen
X	echo The following externals don\'t differ in the first 7 characters:
X	sh /tmp/lim2.$$
Xelse
X	echo All externals differ in the first 7 characters
Xfi
Xrm -f /tmp/lim1.$$ /tmp/lim2.$$
Bye-Bye
echo x - 8limit
sed -e 's/^X//' <<'Bye-Bye' >8limit
X: Check names differ over first 8 chars
Xcase $# in
X0) echo Usage: $0 object-files ... ; exit 1;;
X*) ;;
Xesac
X
Xtrap 'rm -f /tmp/lim1.$$ /tmp/lim2.$$; exit 1' 1 2 15
Xfor f
Xdo
X   echo $f:
X   nm $f | sed "s/^...........//" | grep "^_" | sed "s/^_//" >/tmp/lim1.$$
X   sed "s/^\(........\).*/\1/" </tmp/lim1.$$ | uniq -d | sed "s/.*/grep \"^&\" \/tmp\/lim1.$$/" >/tmp/lim2.$$
X   if test -s /tmp/lim2.$$
X   then
X	echo In $f the following don\'t differ in the first 8 characters:
X	sh /tmp/lim2.$$
X   fi
Xdone
Xrm -f /tmp/lim1.$$ /tmp/lim2.$$
Bye-Bye
exit 0

jpn@teddy.UUCP (03/06/86)

Due to the interest generated by my previous posting (about a program that
can fix C programs with long identifiers using the preprocessor),  I have
posted a copy of the program to mod.sources

If you don't get mod.sources:  why not?  Please fix your software!
       Slightly more helpful:  Send mail, I will mail out copies.


John P. Nelson, Moderator, mod.sources
(decvax!genrad!panda!jpn  seismo!harvard!wjh12!panda!jpn)
Send source code to panda!sources, requests to panda!sources-request

derrell@lipman.UUCP (derrell) (03/07/86)

John P. Nelson writes:
>                       I have a program that was posted to the net some
> time ago called "shortc" which takes all conflicting long identifiers in
> a set of source files, and outputs #defines to differentiate them (which
> you can either insert into each source file, or into a header included
> by each file).
> ... 
> Is there enough interest to have this program re-posted to the net?


YES!  Please re-post this for us poor souls with seven char limits!
-- 

   =====================================================================

   "The pioneers of a warless world are those young men, and women,
    who refuse military service."
				      -- Albert Einstein



   Derrell Lipman
   Lipman Enterprises -- Windowing for Unix on standard ASCII terminals

   {ucbvax,ihnp4}!trwrb!ttidca!lipman!derrell

henry@utzoo.UUCP (Henry Spencer) (03/08/86)

> I cannot sympathize.  I have a program that was posted to the net some
> time ago called "shortc" which takes all conflicting long identifiers in
> a set of source files, and outputs #defines to differentiate them...

Most people with 7-character compilers have 7-character preprocessors
to match.

> ...Of course, if this is the case, I would throw away that compiler,
> and start over!

Personally, I do not have time to re-implement my C compiler.

> Of course, even with a bogus compiler, and a bogus preprocessor, you can
> still take the output of shortc and apply the changes by hand yourself!...

You forgot to add ":-)".  This sort of thing has to be re-done every time
a patch for the program comes in.  Try it some time; you'll quickly find
out why it's considered impractical.

> Is there enough interest to have this program re-posted to the net?

If it includes a long-identifier preprocessor, sure.  Otherwise, don't bother.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry

mts@utai.UUCP (Martin Stanley) (03/09/86)

>> 
>> > I cannot sympathize.  I have a program that was posted to the net some
>> > time ago called "shortc" which takes all conflicting long identifiers in
>> > a set of source files, and outputs #defines to differentiate them...
>> 
>> Most people with 7-character compilers have 7-character preprocessors
>> to match.
I have a UniPlus+ port of System Vr1 on a 68k box, and my c compiler 
recognizes only seven characters. My preprocessor, however, recognizes
16 characters.

>> > Of course, even with a bogus compiler, and a bogus preprocessor, you can
>> > still take the output of shortc and apply the changes by hand yourself!...
>> 
>> You forgot to add ":-)".  This sort of thing has to be re-done every time
>> a patch for the program comes in.  Try it some time; you'll quickly find
>> out why it's considered impractical.
>> 
>> > Is there enough interest to have this program re-posted to the net?
>> 
>> If it includes a long-identifier preprocessor, sure.  Otherwise, don't bother.

I disagree. I think shortc can be a useful program for people with
compilers and preprocessors similar to mine.

-- 
Martin Stanley
Department of Computer Science
University of Toronto
Toronto, ON
M5S 1A4

USENET:		{decvax,ihnp4,linus,uw-beaver}!utcsri!utai!ms!mts
CSNET:		mts@toronto
ARPANET:	mts.toronto@csnet-relay

richard@islenet.UUCP (Richard Foulk) (03/09/86)

I sure hope this sad exchange doesn't cause anyone to decide
not to post their software just because it doesn't cater
to the lowest common denominator!

I have to deal with the 7 character limitation too, but I'm
certainly not going to complain when someone GIVES me something!

[It really shouldn't be too difficult to make shortc work with
the more limited (7 char) pre-processors anyway.]
-- 
Richard Foulk		...{dual,vortex,ihnp4}!islenet!richard
Honolulu, Hawaii	or ...!islenet!bigtuna!richard

jpn@teddy.UUCP (03/10/86)

>> I cannot sympathize.  I have a program that was posted to the net some
>> time ago called "shortc" which takes all conflicting long identifiers in
>> a set of source files, and outputs #defines to differentiate them...
>
>Most people with 7-character compilers have 7-character preprocessors
>to match.
>
>> Is there enough interest to have this program re-posted to the net?
>
>If it includes a long-identifier preprocessor, sure.  Otherwise, don't bother.

If you REALLY have a 7-character preprocessor, I would like to remind you
about the DECUS C preprocessor, which is available from mod.sources.  It
supports arbitrary preprocessor symbol lengths, as well as supporting the
new ANSI C preprocessor features (well, at least those that were proposed
at the time it was written), though the "new" preprocessor features can
be disabled (in fact, that's the way the makefile is set up by default.)

Please, I will not be able to respond to a million requests for this.  Please
check the latest mod.sources Index (it should still be on your systems, it is
not slated to expire until the 17 of March), and find out how to access the
archive from the nearest archive site.  (The entry is volume1/cpp).


John P. Nelson, Moderator, mod.sources
(decvax!genrad!panda!jpn  seismo!harvard!wjh12!panda!jpn)
Send source code to panda!sources, requests to panda!sources-request

Wax.OsbuSouth@Xerox.COM (03/11/86)

I would be interested in the ShortC program.

Allan Wax
ARPA: Wax.OsbuSouth@Xerox.COM