🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: net.lang.pascal
5 messages
5 total messages Started by zben Tue, 09 Jul 1985 19:55
Request for Berkeley Pascal information
#188
Author: zben
Date: Tue, 09 Jul 1985 19:55
11 lines
1159 bytes
I am trying to convert an existing Pascal program to run under Ultrix, 
on a VAX, but do not have access to the internal documents for this
implementation.  The program makes extensive use of an "otherwise" clause
in its "case" statements.  I have blindly tried all variations I have seen
in other Pascal implementations, without success.  

Can anybody out there tell me whether there is, in fact, an extension for
a "none of the above" case, or that such an extension does not exist?

-- 
Ben Cranston  ...{seismo!umcp-cs,ihnp4!rlgvax}!cvl!umd5!zben  zben@umd2.ARPA
Re: Request for Berkeley Pascal information
#193
Author: Chris Torek
Date: Wed, 10 Jul 1985 05:02
11 lines
1044 bytes
Berkeley Pascal does not have an otherwise clause, so Ultrix
Berkeley Pascal probably doesn't either.  They won't unless
you can convince someone to put in the ~20 line source code
change to do it. . . .

(I put it in here for a while for TeX, but now we have Pastel,
so who needs pc?)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland
Re: Request for Berkeley Pascal information
#192
Author: trickey
Date: Fri, 12 Jul 1985 18:07
48 lines
2886 bytes
> I am trying to convert an existing Pascal program to run under Ultrix, 
> on a VAX, but do not have access to the internal documents for this
> implementation.  The program makes extensive use of an "otherwise" clause
> in its "case" statements.  I have blindly tried all variations I have seen
> in other Pascal implementations, without success.  
> 
> Can anybody out there tell me whether there is, in fact, an extension for
> a "none of the above" case, or that such an extension does not exist?
> 
> -- 
> Ben Cranston  ...{seismo!umcp-cs,ihnp4!rlgvax}!cvl!umd5!zben  zben@umd2.ARPA

Berkeley added a -O option to pxp sometime during 4.2.  If you do
	pxp -O prog.p > newprog.p
then prog.p can have a case labelled "others:", and pxp -O will create
a newprog.c where such case statements are changed to:
	if <case expr> in [<list of non-"others:" labels in case>] then
		case <case expr> of
			<non-"others:" cases>
		end
	else
		<statement for "others:" case>

If the range of the <case expr> isn't too big, the code generated is
a bit-vector membership test, which isn't too bad.  However, I
recently reduced the running time of a program by a factor of 8 by
noticing that large set membership tests get translated into a
push of all the members onto the stack, followed by a call to
a procedure to check each.  (The fix was to change that code manaully,
with a more efficient range test for the "others:" cases.)
So be warned.

When I and others ported TeX to UNIX, the "others:" problem had to be
solved.  We looked at pc's source, and found it was quite easy to add
an "others:" clause capability.  The compiler already generates code
to check for "none of the cases", since it has to produce a runtime
error for that.  We asked Berkeley if they would consider putting
the fix into pc, and they said no, because they didn't want to add
such a non-standard feature to the language (and also because more
programs than just pc would have to change to support a new language
feature).  Instead, they came up with the pxp -O solution, which
is the one used in TeX right now.  I don't think the large range
problem shows up there.

Sorry, but I don't have the changes to pc to add "others:" anymore.

			Howard Trickey
			...decwrl!Glacier!Shasta!trickey
Re: Request for Berkeley Pascal information
#194
Author: rusty c. wright
Date: Sat, 13 Jul 1985 21:29
18 lines
1176 bytes
Although the Berkeley Pascal compilers don't support the "others"
clause (or whatever it is called; run strings on pxp and see if
something pops up) pxp has a hack in it that will do what you want.
Just give pxp the -O flag and it will turn case statements that use
"others" into the appropriate

	if foo in [...] then
		case foo of
		...
	else
		...

Just do something like

	pxp -O myfile.p > mynewfile.p
-- 
	rusty c. wright
	{ucbvax,ihnp4,akgua,hplabs,sdcsvax}!sdcarl!rusty
Otherwise clause in pc
#196
Author: Bill Price
Date: Tue, 16 Jul 1985 21:48
17 lines
1413 bytes
In article <6830@Shasta.ARPA> trickey@Shasta.ARPA writes:
>When I and others ported TeX to UNIX, the "others:" problem had to be
>solved.  
>                 We asked Berkeley if they would consider putting
>the fix into pc, and they said no, because they didn't want to add
>such a non-standard feature to the language 
>			Howard Trickey
>			...decwrl!Glacier!Shasta!trickey

That's both good and bad:  bad because pc is non-standard, but good because
Berkeley refused to make it even more so.  In this respect, the standard
completer clause for the case statement is 
	"otherwise" statement-sequence
rather than "others" as a case-constant-list.
-- 
--Bill Price  uucp:  {Most Anybody}!sdcsvax!bmcg!bprice
              arpa:? sdcsvax!bmcg!bprice@nosc
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads