HDTenEightyP/NetNews huggingface dataset:
From: jboor@mote.cs.umb.edu (Joan Boorstein)
Newsgroups: comp.lang.pascal
Subject: Re: behavior of typed constants in subroutines
Date: 13 Oct 92 05:54:40 GMT
Article-I.D.: cs.1992Oct13.055440.24615
Organization: University of Massachusetts at Boston, Dept of Math and CS

In article <Bw0o2C.9qn@news.cso.uiuc.edu> amead@s.psych.uiuc.edu (Alan Mead) writes:
>Wow, I've never had a formal Pascal education, but I thought I knew
>all the important things.  I always thought that if you wanted a
>variable's value to persist from subroutine call to subroutine call
>(like a C static) that you had to declare it global...  I never knew
>that a typed constant would do the same thing:
>
>program test;
>
>  procedure fgj;
>    const
>      x : longint = 1;
>    begin
>      x := x + 1;
>      write( x:10 );
>    end;
>
>begin
>  fgj;
>  fgj;
>  fgj;
>  fgj;
>end.
>
>Is there any way I can get burned?  Is this slower or faster than
>declareing the structure globally?  I really prefer keeping the scope
>to the routine that needs to use it.

I'd first like to ask if you tried compiling your code.  I'd doubt it
would -- it didn't for me, using a VAX-11 Pascal compiler -- as I expected
it wouldn't, but I wanted to check.  If you had done so, it would have
probably answered your question.

First, there is no output declared in the program header, so you can't
use write -- that is a minor matter and eaily fixed.

The real problem I see here is that you declare x to be a constant, but
then change its value.  The Pascal compiler will complain when you try
to change the value of identifier which is declared to be a consant.  You
can't use a constant identifier on the left-hand-side of an assignment
statement.  If you want to change an identifier's value, it must be declared 
as a variable, giving it a appropriate type.  I am also not familiar with a
compiler allowing you to declare the type of the constant -- didn't think
this was standard (but I don't have the appropriate document to check here).

If you had merely declared x to be a variable local to rjg and given it
the initial value 1, you would always have that initial value whenever
you entered rjg.  However, making x a global, every call to rjg would
change its value.  I'm not quite sure what it is you want to do? 
Can you explain a bit further what it is you want?
Newsgroups: comp.lang.pascal
From: dmurdoch@mast.queensu.ca (Duncan Murdoch)
Subject: Re: Undocumented Feature?  Was: behavior of typed constants in subroutines
Organization: Queen's University
Date: Wed, 14 Oct 1992 14:00:35 GMT

In article <thompson.718989896@daphne.socsci.umn.edu> thompson@atlas.socsci.umn.edu (T. Scott Thompson) writes:
>
>This shows that (a) the value of x is not reinitialized on each entry
>to fgj; (b) even though x is _local_ to fgj, and _not_ a VAR
>parameter, a fresh copy is not made upon entrance to fgj.  Thus x does
>not behave like other locally decalared variables in recursive calls.
>
>This seems like an inconsistency (bug?) in TP.  According to the TP
>5.0 User's Guide, p. 143, (I don't have my 6.0 manuals at work)
>
>   "Each time a function is called recursively, it creates a new set
>    of local variables and pass-by-value (non-var) parameters."
>
>Evidently locally declared typed constants are an exception since
>local copies are not created on entry.

I don't know if it's in the 5.0 manuals, but the behaviour is clearly 
described in the TP 6 programmer's reference, chapter 5 "Typed Constants", 
p. 57.  It's by design, not a bug.

>Is this behavior documented?  Are programs that rely on the apparently
>static nature of locally declared typed constants likely to break in
>future releases of TP?  

Lots of people (even me :-) have called for a change to this.  The consensus 
seems to be that typed constants should really be constant; any assignment 
to them should be a syntax error.  To get the functionality that they 
currently have, Borland should introduce initialized variables, with 
the same declaration syntax but appearing in a Var block.  For example:

  const
     c : integer = 1;
  var
     v : integer = 1;

In this example, both c and v would appear to act as integers when 
referenced, but only v could have its value changed.  

>IMHO the best way (in TP) to implement "static" variables is to make
>them global.  If you want to hide them from code outside your
>procedure, then put them in the implementation section of a unit
>defining the procedure.

I think the advantages of local scope sometimes override this, and I use 
typed constants in those situations.  When I'm careful, I comment the 
declaration to say that it's really an initialized variable.

Duncan Murdoch
dmurdoch@mast.queensu.ca
From: muzzle@cs.uq.oz.au (Murray Chapman)
Newsgroups: comp.lang.pascal
Subject: Problems with TP SetRGBPalette
Date: 16 Oct 92 05:48:35 GMT
Reply-To: muzzle@cs.uq.oz.au

Hi there

I am experiencing problems with SetRGBPalette in TP6.0...

A program fragment such as:

	{ Convert Palette to shades of blue }
	for i := 0 to MaxColors do
	    SetRGBPalette(i, 0, 0, i*2);

	for i := 1 to MaxColors do
	  begin
	    SetColor(i);
	    OutTextXY(0, i *10, 'This is a test');
	  end;

seems to only alter the first six colors...

Anybody?

Thanks,
Murray
--
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
  Murray Chapman                           muzzle@cs.uq.oz.au
  University of Queensland                 How many lightbulb jokes does it
  Brisbane, Australia                      take to change the subject?
From: bdixon@cowpas.waffle.atl.ga.us (Brad Dixon)
Newsgroups: comp.lang.pascal
Subject: Tcollection Load-ing
Date: 9 Oct 92 20:18:52 GMT
Organization: COW Pastures

I have a tcollection object which stores objects (which are used as a 
database). The tcollection stores fine, but when I try to load the 
tcollection I get error 208, which is an overlay driver not installed -- 
even though I am not using an overlay in my program. I built all units 
with the /$O- state, so what
's the problem? Any ideas.....
From: samlb@optilink.UUCP (Sam Bassett)
Newsgroups: comp.lang.pascal,comp.lang.modula2
Subject: Re: UCSD Availability
Keywords: UCSD Pascal USUS
Date: 12 Oct 92 18:33:32 GMT
Organization: DSC/Optilink Access Products

In article <1992Oct12.051456.19779@psg.com> randy@psg.com (Randy Bush) writes:
>Now please explain to me and the others here why we
>should contribute to Compu$erve's profits?  Why not just put it up for
>FTP, which I am willing to do iff the Regents would approve?

	No particular reason, except that most of the people that I am
aware of that are still using the p-System are on Compu$erve . . .   :-)

	An ftp site for this information would indeed be a good idea, if
the (minimal) licensing requirements of the UCSD license can be met . . .


-- 
Sam'l Bassett -- System Administrator 	      (among other silly things)
Work: DSC/Optilink, 1310-C Redwood Wy, Petaluma CA 94954; 1-707-792-7253
Internet: samlb@optilink.com 		      UUCP: uunet!optilink!samlb
From: zlsiida@fs1.mcc.ac.uk (dave budd)
Newsgroups: comp.lang.pascal
Subject: TP6 RegisterBGIdriver more than 3 times ???
Date: 13 Oct 92 09:41:40 GMT
Organization: Manchester Computing Centre

One of my users wants to install more than 3 user-supplied BGIs but gets a 
driver table overflow error on the 4th call.

Can he dump RegisterBGIdriver and just use InstallUserDriver?
Can the table size be increased?
Some other way round?
Something he's overlooked?


              Have another day    [Armageddon, the musical] 
  Dave Budd, MCC, Oxford Rd, Manchester, England   (44|0)61-275-6033
From: amead@s.psych.uiuc.edu (Alan Mead)
Newsgroups: comp.lang.pascal
Subject: behavior of typed constants in subroutines
Date: 12 Oct 92 16:20:36 GMT
Article-I.D.: news.Bw0o2C.9qn
Organization: UIUC Department of Psychology

Wow, I've never had a formal Pascal education, but I thought I knew
all the important things.  I always thought that if you wanted a
variable's value to persist from subroutine call to subroutine call
(like a C static) that you had to declare it global...  I never knew
that a typed constant would do the same thing:

program test;

  procedure fgj;
    const
      x : longint = 1;
    begin
      x := x + 1;
      write( x:10 );
    end;

begin
  fgj;
  fgj;
  fgj;
  fgj;
end.

Is there any way I can get burned?  Is this slower or faster than
declareing the structure globally?  I really prefer keeping the scope
to the routine that needs to use it.

-alan mead
Newsgroups: comp.lang.pascal
From: samodena@csemail.cropsci.ncsu.edu (S. A. Modena)
Subject: Re: tp 6.0 or 5.5 killed
Organization: Crop Science Dept., NCSU, Raleigh, NC 27695-7620
Distribution: comp
Date: Wed, 14 Oct 1992 00:33:39 GMT

In article <199213.548.799@ALMAC> mike.dickson@almac.co.uk writes:
>
>The chances of some 'stray code' just happening to nuke your entire hard
>disk are astronomical. It wasn't TP that caused your problem, I'll bet.
>

The only time I can remember nuking a hard drive was when I was programming
in Assembler under OS9 and used the feature that let's one open the hard
drive itself as a file.  So let's see: DOS has some BIOS calls that
allow direct access to any logical/physical sector on the disk,
irrespective of file structure or the FAT.  I might suppose the
errant code involved calls like that.  I guess, if one had a loop and
were writing directly to sectors, one might be in real trouble if
the code were buggy.


---
+------------------------------------------------------------------+
|     In person:  Steve Modena     AB4EL                           |
|     On phone:   (919) 515-5328                                   |
|     At e-mail:  nmodena@unity.ncsu.edu                           | 
|                 samodena@csemail.cropsci.ncsu.edu                |
|                 [ either email address is read each day ]        |
|     By snail:   Crop Sci Dept, Box 7620, NCSU, Raleigh, NC 27695 |
+------------------------------------------------------------------+
         Lighten UP!  It's just a computer doing that to you.
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
         
Xref: sparky comp.lang.pascal:5949 comp.lang.ada:2939 comp.sys.apple:36
From: samlb@optilink.UUCP (Sam Bassett)
Newsgroups: comp.lang.pascal,comp.lang.ada,comp.sys.apple
Subject: Re: USUS P-System license
Date: 12 Oct 92 23:23:31 GMT
Organization: DSC/Optilink Access Products

In article <Bvzovz.KKL@wimsey.bc.ca> lharris@wimsey.bc.ca (Lawrence Harris) writes:
}The meeting was called following the recent landmark granting to USUS of a
}license to the UCSD p-System, a portable programming environment originally
}released in 1977 as UCSD Pascal. Under this license USUS is free to
}distribute source and object code to its membership subject to payment of
}a one-time license fee.

	Does  this also mean the sources to _Apple_ Pascal will become
available throught USUS?


-- 
Sam'l Bassett -- System Administrator 	      (among other silly things)
Work: DSC/Optilink, 1310-C Redwood Wy, Petaluma CA 94954; 1-707-792-7253
Internet: samlb@optilink.com 		      UUCP: uunet!optilink!samlb
Newsgroups: comp.lang.pascal
From: dmurdoch@mast.queensu.ca (Duncan Murdoch)
Subject: Re: Undocumented Feature?  Was: behavior of typed constants in subroutines
Organization: Queen's University
Date: Thu, 15 Oct 1992 13:24:54 GMT

In article <1992Oct15.005720.22360@rulway.LeidenUniv.nl> jeroenp@rulfc1.LeidenUniv.nl (Jeroen W. Pluimers) writes:
>
>The key problem is that typed constants are in fact initialized variables.
>Maybe Borland will change it's mind about this when lot's of people ask,
>but I doubt, as it will break a lot of existing code (including mine).

I think if they made the change I suggested (assignments to a constant are 
illegal) then it would be a pretty easy adjustment to make:  your old 
programs would fail to compile, but you could fix them by changing the 
keyword "const" to "var" where necessary.

Duncan Murdoch
Newsgroups: comp.lang.pascal
From: julian@sun-1.cs.uct.ac.za (Julian Hansen)
Subject: Pascal to C compiler
Summary: Good pascal to C compiler needed.
Organization: Computer Science Department, University of Cape Town
Date: Fri, 9 Oct 1992 05:23:51 GMT

Hi world

Anyone there have or know of a good shareware / public domain / freeware
pascal to C compiler. I know they exist - I just do not know where.

thanks world

julian


----------------------------------------------------------------------------
                                                   VVVVVVV
                                                  /       \
Julian Hansen                                    / _     _ \   I'm Back
University of Cape Town                          |/_\   /_\|  /
South Africa                              ____   ||o|   |o|| / ____
email: julian@sun-3.cs.uct.ac.za   -------VVVV---|---\ /---|---VVVV------
                                                      U 
----------------------------------------------------------------------------
From: wilson@mailhost.aa.cad.slb.com (David Wilson)
Newsgroups: comp.lang.pascal
Subject: Book on Turbo Vision?
Date: 8 Oct 92 13:26:57 GMT
Article-I.D.: aa.1992Oct8.132657.11202
Organization: Schlumberger CAD/CAM; Ann Arbor, Michigan (USA)


Does anyone out there know of a book about Turbo Vision?  I've heard
about the series of articles in Dr. Dobb's about TV, but I've yet to
see an explicit reference to a book on the subject.  If you know of
one, please give me some information so I can buy a copy.  I don't
care if it's specific to Pascal, or to C++.

Dave Wilson
Newsgroups: comp.lang.pascal
From: joet@dcatlas.dot.gov (Joe Trott)
Subject: Re: Testing File Name Validity...
Organization: U.S Dept. of Transportation
Date: Tue, 13 Oct 1992 18:21:27 GMT


Create a function that:
A) parses the file name and tests each char for membership in the set
   of allowable file name characters (see your DOS manual)
B) tests for existence of the file
C) deals with optional/default extensions

I wrote a function to do these things.
Get_Filename(exist : boolean; ext : str3) : str40;

Exist determines whether the file should or should not already exist
(an overwrite warning is shown and the file may be used anyway if you say
it shouldn't exist but it does), and unless you end your file name with a
'.', or there is one in it, the Ext will be tacked on as an extension.
The return is the file name, possibly including drive/path.  I limited mine
to length 40, but you can obviously increase this.

-JTT
From: holland@matt.ksu.ksu.edu (Rich Holland)
Newsgroups: comp.lang.pascal
Subject: Re: Turbo Pascal --> Turbo C translator
Date: 8 Oct 1992 17:42:21 -0500
Organization: Kansas State University
NNTP-Posting-Host: matt.ksu.ksu.edu

dan@lamar.ColoState.EDU (Danilo Silva) writes:

>Personally, I think that this C trend is absurd (it's like going backwards
>into the path of developing in higher level languages).

...Yeah!  I saw a good quote in an oldish issue of DDJ where a Pascal and
C programmer was discussing both languages.  I'll paraphrase it, as it's
fitting here:  C is great because you can program at the machine's level,
and you can hand optimize the code to be really fast...Or at least, that's
what C programmers tell you.  If the code needs optimizing, let the computer
do it.  If you want to program at the machine level, use assembler.  The
reason for having a high level language is to have the ability to write
LEGIBLE code.  

 :-)
-- 
Rich Holland              | INTERNET: holland@matt.ksu.ksu.edu
100 Jardine Terr, Apt A7  | BITNET  : holland@ksuvm
Manhattan, KS  66502-3357 | UUCP    : ...!rutgers!matt.ksu.ksu.edu!holland
char*p="char*p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
From: jeroenp@rulfc1.LeidenUniv.nl (Jeroen W. Pluimers)
Newsgroups: comp.lang.pascal
Subject: Re: Two bugs in TPW 1.5????
Date: 16 Oct 92 21:29:58 GMT
Organization: Dept. FMC, Gorlaeus Labs, Leiden University, The Netherlands

In article <920916.213446.achristo@nutri1> achristo@pons.uio.no (Alf Christophersen) writes:
>
>Some days ago I asked here about transfer records in tDialog for
>pListBoxes. I found later that if I did an Insert(a), where a is
>a pChar, to the pStrCollection in the Init of the dialog, the
>listbox showed the pChar-string. But if I sent a message directly
>to the listbox, that string was not added to the pStrCOllection.
>What did work was then to manually add the new string to the
>pStrCollection and then do a TransferData(sf_setdata) to make the
>string visible in the Listbox.

That is because the Transfer for listboxes is a one-way operation.
You only will set the data, as the user can't type new data into
the listbox and OWL is a shell around the Windows API and you are not
supposed to change the contents of the listbox by working around OWL
(OWL will loose track then).

>The other possible bug I may have seen is the following scene:
>
>VAR
>  d: Boolean;
>Procedure a;
>Var
>  b: Boolean;
>Procedure ab; far;
>Var
>  c : Boolean;
>  BEGIN
>    c:= b;
>    {Here follows some code to be executed, dependent on b (c)}
>END;
>BEGIN
>  b := False;
>  MyCollection.ForEach(@aB);
>  b:=True;
>  MyCollection.ForEach(@aB);
>END;

The declaration of procedure ab is wrong. It should be:

procedure ab (Data: Pointer); far;

I think because of this your stack-frame got mangled and c:=b gave
strange results.

--
    o _   _  _   _   _             voice: +31-2522-20908 (19:00-24:00 UTC)
   / (_' |  (_) (_' | |            snail: P.S.O.
__/                                       attn. Jeroen W. Pluimers
                                          P.O. Box 266
jeroenp@rulfc1.LeidenUniv.nl              2170 AG Sassenheim
jeroen_pluimers@f256.n281.z2.fidonet.org  The Netherlands
Newsgroups: comp.lang.pascal
From: jbm@hal.trl.OZ.AU (Jacques Guy)
Subject: Re: TP 6.0 or 5.5 Killed my HD
Organization: Telecom Research Labs, Melbourne, Australia
Date: Tue, 13 Oct 1992 01:24:38 GMT

runefr@ifi.uio.no (Rune Fr|ysa) writes:


>fatal was when I pressed F2. The PC kept writing for about 2
>minutes before I rebooted. Then, my HD was gone! The fat and
>other parts of the HD had been wiped out! 1.8 MB of source code
>was lost!!! (I had thankfully a 2 weeks old backup).

And Duncan Murdoch, who's shown himself to know a lot, doubt
this is possible. Something similar has happened to me twice.
I was developing a program that made extensive use of Move's
and @'s and other "naughty" stuff, when, upon running it,
... nothing happened. Uh, oh, I said to myself, you got 
yourself into an infinite loop, did you? Then, I saw the
hard disk light busily flicking, wondered for a second
or two whether I could be reading the same file over and
over again, and alarm bells started ringing in my mind.
I pressed the panic button, and, upon rebooting did a
dir *.*. I had 18K of free space left on my hard disk,
down from 32M. A chkdsk revealed 32M in I forgot how
many lost clusters. Luckily, I lost nothing. I had
been writing to a random address in memory thanks to
unassigned pointers. It happened once again a month
or two later, without dire effects, either. But I suppose
that I might have overwritten part of my FAT, if I'd
been unlucky.

      
No, I assure you I am not making this up. It did happen.
I was writing plaintext strings and screen attributes 
to records referenced by pointers, nothing to do
with DOS calls, and certainly not trying to write a
virus.



Newsgroups: comp.lang.pascal
From: samodena@csemail.cropsci.ncsu.edu (S. A. Modena)
Subject: Re: Tcollection Load-ing
Organization: Crop Science Dept., NCSU, Raleigh, NC 27695-7620
Date: Fri, 9 Oct 1992 23:10:28 GMT

In article <6X9DsB1w165w@cowpas.waffle.atl.ga.us> bdixon@cowpas.waffle.atl.ga.us (Brad Dixon) writes:
>I have a tcollection object which stores objects (which are used as a 
>database). The tcollection stores fine, but when I try to load the 
>tcollection I get error 208, which is an overlay driver not installed -- 
>even though I am not using an overlay in my program. I built all units 
>with the /$O- state, so what
>'s the problem? Any ideas.....

This one is easy to answer (having seen it happen more than a few times
when I FIRST BEGAN using TV).

You have at least one bug in your code that is causing an IP jump
such that it looks like a call to the overlay controller code.

In other words: clean up your STORE/LOAD and INIT/DONE code, which is
inaccurate or buggy.  (ALso the PutItem GetItem, FreeItem code).

Put another way: LOOSE POINTER (like LOOSE CANNON ON A PITCHING DECK).

I'd recommend using the debugger to step through your LOAD/STORE
routines, both of the collection and of the dynamic objects in the
collection, with MEMAVAIL in the Watch Window....and with paper and
pencil, keep track of allocation/deallocation arithmetic.

Have a nice weekend debugging.  :^)

Steve
---
+------------------------------------------------------------------+
|     In person:  Steve Modena     AB4EL                           |
|     On phone:   (919) 515-5328                                   |
|     At e-mail:  nmodena@unity.ncsu.edu                           | 
|                 samodena@csemail.cropsci.ncsu.edu                |
|                 [ either email address is read each day ]        |
|     By snail:   Crop Sci Dept, Box 7620, NCSU, Raleigh, NC 27695 |
+------------------------------------------------------------------+
         Lighten UP!  It's just a computer doing that to you.
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
From: cs90rwr@brunel.ac.uk (Richard W Rackham)
Newsgroups: comp.lang.pascal
Subject: Re: Turbo Pascal for Windows
Date: 9 Oct 92 17:29:45 GMT
Organization: Brunel University, Uxbridge, UK
X-Newsreader: TIN [version 1.1 PL6]

Teo Boon Cheang (bteo@tartarus.uwa.edu.au) wrote:
: I have just started some trival programming with TPW 1.0 
: Anyhow, I need to find out a couple of things :
: (2) How do I launch another window application from within TPW?
:     eg.  Selecting an option in the application can launch the windows 
:          calculator, or another TPW program (sort of like TSR?)

Try using the Windows API command WinExec.  Details of the command are in the
manual and on the help text.

To run CALC.EXE, you would enter the line :

WinExec('CALC.EXE',sw_normal);

Hope this is of use

---
Richard Rackham (cs90rwr@brunel.ac.uk)

-- 
+-----------------------------------------------------------------------------+
| Richard W Rackham (aka Fac 51 The Hacienda) EMail ID : cs90rwr@brunel.ac.uk |
+-----------------------------------------------------------------------------+
|       Uxbridge, Yiewsley, Hillingdon, Hayes, Ealing, West Drayton           |
|    Hammersmith, Harrow, Housnlow, Kew, Cowley, Chiswick, Clapham, Slough    |
|     Fulham, Finchley, Finsbury Park, Romford, Ruislip, Richmond, Barnes     |
From: jm59@prism.gatech.EDU (MILLS,JOHN M.)
Newsgroups: comp.lang.pascal
Subject: Re: How to map/store character grid
Date: 15 Oct 92 13:39:19 GMT
Organization: Georgia Institute of Technology

In article <33039@adm.brl.mil> spoulsen@mcs213k.cs.umr.edu (Steven P Poulsen) writes:
>In an earlier message, 'Alan Turner' had written:
>>Hope this pascal question is not too blaise'.
                                       ^^^^^^^
Thanks, I needed that: I got to the mail after a long, boring day.

Remember, a sense of humor will be held against you.

Regards --jmm--

-- 
John M. Mills, SRE; Georgia Tech/GTRI/TSDL, Atlanta, GA 30332
uucp: ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!jm59
Internet: jm59@prism.gatech.edu
 "f U cn rd dis, U mst uz Unix!!!"  ...jaw
Newsgroups: comp.lang.pascal