Difference between Standard and Turbo Pascal 
Author Message
 Difference between Standard and Turbo Pascal

        I recently attended the UIL Comptuter Science contest which
has a written test based on Standard Pascal.  I've only used Turbo
Pascal and I assumed that they were basicly the same and there
wouldn't be a problem.  However, I think there were several problems I
missed because of the difference.  To prepare for the regional meet I
want to study the differences between Standard and Turbo.  I thought
there would be a FAQ that contained the information but I haven't been
able to find one.  Does any one know where I could find a list of the
differences?  Or mabe someone could list them for me?  Also, where can
I get a Standard Pascal compiler?

                                        Thanks,
                                        Stuart Johnston



Wed, 18 Jun 1902 08:00:00 GMT  
 Difference between Standard and Turbo Pascal
Hi Stuart.Johnston and everybody else!

SJ>  I recently attended the UIL Comptuter Science contest which
SJ> has a written test based on Standard Pascal.  I've only used Turbo
SJ> Pascal and I assumed that they were basicly the same and there

...

SJ> differences?  Or mabe someone could list them for me?  Also, where can
SJ> I get a Standard Pascal compiler?

So what the fuss is _Standard_ Pascal?

My Turbo Pascal Reference Guide has an "Appendix A: Comparing Turbo Pascal  
4.0 with ANSI Pascal" including Exceptions to ANSI Pascal Requirements,  
Implementaion-Dependent Features and Treatment of Errors.

I don't know why it's for Version 4.0, maybe it has never been updated,  
maybe because it's an inofficial Hongkong print or whatsoever. Not too  
much, but 6 pages.

Because it's a printed copy I don't know how to forward it bey e-mail.

cu,        Clemens

* * * * * * * * * * *  on the net since tuesday  * * * * * * * * * * * * *
_P.S._ Answer and/or comment _please_ (also) as follow-up-to: poster



Wed, 18 Jun 1902 08:00:00 GMT  
 Difference between Standard and Turbo Pascal

Quote:

>    I recently attended the UIL Comptuter Science contest which
>has a written test based on Standard Pascal.  I've only used Turbo
>Pascal and I assumed that they were basicly the same and there
>wouldn't be a problem.  However, I think there were several problems I
>missed because of the difference.  To prepare for the regional meet I
>want to study the differences between Standard and Turbo.  I thought
>there would be a FAQ that contained the information but I haven't been
>able to find one.  Does any one know where I could find a list of the
>differences?  Or mabe someone could list them for me?  Also, where can
>I get a Standard Pascal compiler?

I'm posting this as well as sending email to the sender so that if any
reader sees an important omission they can correct this posting.
Obviously there are omissions in the interest of brevity.

Although it has been a while since I wrote "standard" Pascal (if it
ever
existed) for a mainframe computer, here are some things that differ in
modern versions of Pascal, including Turbo. However, I know I ran
standard
Pascal using a Turbo compiler without crashing. I hope that has not
changed.

The input and output files (if used) had to be declared--such as:

Program OldStuff (input, output, other filenames used);

Unlike Turbo, the sequence of declarations must be in a specific
order:

Program Title (as above)
Const
Type (Including simple, pointer, array, record, file, sets and packed)
     (There was no built in type string. This could be declared as:
      Var
          Name : Packed array[1..18] of Char;
     or
      Type
      String18 = Array[1..18] of Char;

      Var
      Name:String18;

Var
Procedures and/or Functions (prior to use)
Begin (main program body just as today.)
End.

Although purists pretended GoTo did not exist, the original Jenson and

Wirth version included it. The label jumped to, however, could only be
an integer, up to 4 digits, and had to be declared prior to use (as it
still does) in the program block where used.

The built in data types were Boolean, integer, real and char. Today's
increased precision integer and real types were not provided.

Integer operations were *, div, mod, +, -, abs(x), sqr(x), trunc(x),
round(x), succ(x), pred(x) and all the Boolean comparisons. Inc(x)
and Dec(x) came later, even though some regard them as "standard."
The x of trunc and round are real.

Real operations were *, /, +, -, abs(x), sqr(x), sqrt(x), sin(x),
cos(x)
arctan(x), ln(x) and exp(x). The formatting for the decimal point came
a little later, and again, some say that is "standard" also.

UCSD Pascal brought a lot of convenient things such as Random,
Randomize,
GotoXY and a new data TYPE--String. This included the Length function,

insertion, deletion, copying, fill and so on--none of which is in
standard Pascal.

In Turbo, two of the more popular USES declarations are:
USES CRT, PRINTER;

Standard Pascal contains none of these UNITS. There is no ClrScr, no
GotoXY, WhereX, WhereY etc. There is no predeclared printer variable,
Lst. In order to get the printer output, you declared the port for the

printer and a variable as a type text and then wrote to it exactly as
if you were writing to a sequential disk textfile.

Branching, looping, file operations of reset, rewrite, close, eof
etc.,
linked lists (including the With statement) are all still the same, in

general, although some versions do have special operations for typed
files versus textfiles.

Since different definitions exist for "standard" Pascal, perhaps you
could request your examiner's to cite a reference they consider
standard.

As some suggested references, here are 4 quite good ones (in my
opinion):

(1) Pascal User Manual and Report; Jensen and Wirth, 1978.
(2) Programming in PASCAL; Peter Grogono, 1979.
(3) Pascal at Work and Play; Richard S. Forsyth, 1982.
(4) Pascal Programming, A Spiral Approach; Brainerd, Goldberg and
Gross,
    1982.

Regards,

Quote:
>                                    Thanks,
>                                    Stuart Johnston



Wed, 18 Jun 1902 08:00:00 GMT  
 Difference between Standard and Turbo Pascal

Quote:

>    I recently attended the UIL Comptuter Science contest which
> has a written test based on Standard Pascal.  I've only used Turbo
> Pascal and I assumed that they were basicly the same and there
> wouldn't be a problem.

*Big* mistake! :-)

Quote:
> However, I think there were several problems I
> missed because of the difference.  To prepare for the regional meet I
> want to study the differences between Standard and Turbo.  I thought
> there would be a FAQ that contained the information but I haven't been
> able to find one.  Does any one know where I could find a list of the
> differences?  Or mabe someone could list them for me?

Off the top of my head, the biggest differenes are:

*       No string type
*       File I/O

The File I/O is the real killer. Especially the "Get" function. It's
possible to examine data in the input "buffer" *without* "reading" it.
This make some things a lot easier to write. You can write stuff that
goes (forgive the ugly pseudocode):

   If (next byte is a numeral) then
     read(file,(numeric variable)
   else
     read(file,(array of characters))
   end

Try doing *that* in TP!

Quote:
> Also, where can I get a Standard Pascal compiler?

Good question. I don't think there *is* one for the PC. But if there
is, it will no doubt be much like fortran and COBOL compilers.
*Expensive*.

Leonard Erickson (aka Shadow)




Wed, 18 Jun 1902 08:00:00 GMT  
 Difference between Standard and Turbo Pascal

: The File I/O is the real killer. Especially the "Get" function. It's
: possible to examine data in the input "buffer" *without* "reading" it.
: This make some things a lot easier to write. You can write stuff that
: goes (forgive the ugly pseudocode):

:    If (next byte is a numeral) then
:      read(file,(numeric variable)
:    else
:      read(file,(array of characters))
:    end

: Try doing *that* in TP!

But how do you know that the "next byte is a numeral"?   Bytes and chars
look the same when they're in binary.



Wed, 18 Jun 1902 08:00:00 GMT  
 Difference between Standard and Turbo Pascal


    : The File I/O is the real killer. Especially the "Get" function. It's
    : possible to examine data in the input "buffer" *without* "reading" it.
    : This make some things a lot easier to write. You can write stuff that
    : goes (forgive the ugly pseudocode):

    :    If (next byte is a numeral) then
    :      read(file,(numeric variable)
    :    else
    :      read(file,(array of characters))
    :    end

    : Try doing *that* in TP!

    But how do you know that the "next byte is a numeral"?   Bytes and chars
    look the same when they're in binary.

Leonard is essentially correct. The file in this example
is a textfile. Standard Pascal allows one to "look ahead"  
at the next component of a sequential file without actually
reading it.  This is often very convenient.  

However, the approach can be emulated in Turbo Pascal;
the programmer simple manages the "lookahead" variable him/herself.  
See "Pascal and Beyond" by Steve Fisher and Stuart Reges, Wiley 1992,
ISBN 0-471-50261-8, pages 25-44.

Bob T.



Wed, 18 Jun 1902 08:00:00 GMT  
 Difference between Standard and Turbo Pascal
:    
:     :    If (next byte is a numeral) then
:     :      read(file,(numeric variable)
:     :    else
:     :      read(file,(array of characters))
:     :    end
:    
:     : Try doing *that* in TP!
:    
:     But how do you know that the "next byte is a numeral"?   Bytes and chars
:     look the same when they're in binary.

: Leonard is essentially correct. The file in this example
: is a textfile. Standard Pascal allows one to "look ahead"  
: at the next component of a sequential file without actually
: reading it.  This is often very convenient.  

I'm not questioning the ability of reading ahead -- my question is
about the ability to know the type of the element in the buffer.

What if the file contains the following:  "3-D modeling".  
Are you going to read '3' as a numeral and the rest as an
array of chars, perchance?

I'm not sure how standard pascal's file I/O work, but with TP
the type of the file should be well defined even before opening
the file.    So I can only read one 'thing' from the file, but
I'm free to convert it any way I wish.



Wed, 18 Jun 1902 08:00:00 GMT  
 Difference between Standard and Turbo Pascal

Quote:

>    I recently attended the UIL Comptuter Science contest which
>has a written test based on Standard Pascal.  I've only used Turbo
>Pascal and I assumed that they were basicly the same and there
>wouldn't be a problem.  However, I think there were several problems I
>missed because of the difference.  To prepare for the regional meet I
>want to study the differences between Standard and Turbo.  I thought
>there would be a FAQ that contained the information but I haven't been
>able to find one.  Does any one know where I could find a list of the
>differences?  Or mabe someone could list them for me?  Also, where can
>I get a Standard Pascal compiler?

>                                    Thanks,
>                                    Stuart Johnston

There's a bit of a question as to even what's meant by "standard" in
this context.  Does that mean the original Wirth/Jensen spec.?  Or some
later mainframe flavor (like UCSD)? Or one of the later attempts at
standardization (like ANSI)?

Assuming the original; off the top of my head, the biggest areas you'll
find that are different (assuming you aren't trying to get into graphics
programming or Windows or something):

1) the PROGRAM statement means something (it's basically ignored by
Turbo), and can take parameters, usually referring to outside files; the
standard one you'll likely see is:

program MyProg ( input, output ) ;

which opens input and output as text "channels" for reading and writing.
Turbo under DOS does this automatically.  Some dialects allow passing
command line parameters via this mechanism as well.

2) more limited basic data types, typically only integer, real, char,
and boolean.  There is the "packed" directive which was supposed to make
the compiler store the data in the least space possible (and had some
funny stuff associated with it for character arrays in certain
dialects).  Packed is legal in Turbo but is ignored.  Standard Pascal
allows for variant records but not the "overlaying" of different types
for typecasting purposes that you can do in Turbo.

3) File handling is different. While the syntax is superficially
similar, conceptually, the standard Pascal type "file" is rather
different from how they're handled in Turbo. Standard Pascal does not
include the Assign() function.  All the files (i/o channels really) that
were EXTERNALLY available were supposed to be passed in via the program
statement as mentioned above, any file variable declared within the
program was sort of meant only to be used by the program.

4) Standard Pascal only allowed for one declaration section of each type
within a program or subprogram; and they HAD to be in the order: label,
const, type, var.

5) There was no bitwise arithmetic as such, and/or/xor/not were strictly
for boolean operations.

6) There was NO support for external modules or separate compilation
(i.e. Units; that was an enhancement from UCSD Pascal).

A lot of this arises from the fact that Wirth wasn't thinking of any
particular hardware platform when he designed Pascal (in fact he wanted
it to be platform independent).

HTH

-* Stephen *-
Stephen Posey
University of New Orleans

WWW    : http://www.uno.edu/~slp



Wed, 18 Jun 1902 08:00:00 GMT  
 Difference between Standard and Turbo Pascal

Quote:


>>        I recently attended the UIL Comptuter Science contest which
>> has a written test based on Standard Pascal.  I've only used Turbo
>> Pascal and I assumed that they were basicly the same and there
>> wouldn't be a problem.
>*Big* mistake! :-)
>> However, I think there were several problems I
>> missed because of the difference.  To prepare for the regional meet I
>> want to study the differences between Standard and Turbo.  I thought
>> there would be a FAQ that contained the information but I haven't been
>> able to find one.  Does any one know where I could find a list of the
>> differences?  Or mabe someone could list them for me?
>Off the top of my head, the biggest differenes are:
>*   No string type
>*   File I/O
>The File I/O is the real killer. Especially the "Get" function. It's
>possible to examine data in the input "buffer" *without* "reading" it.

[stuff snipped]

I once read in Turbo documentation that this feature (examining next
item in input buffer) was left out because it was "confusing".
What a crock!

Another significant difference (unless Turbo has changed in the years
since I've used it) from the language purists standpoint is in the
passing of functions and procedures as parameters.  Real Pascal
implements this via closures -- the passed function or procedure can
access the environment of it's declaration when called.



Wed, 18 Jun 1902 08:00:00 GMT  
 Difference between Standard and Turbo Pascal

Quote:


>:    
>:     :    If (next byte is a numeral) then
>:     :      read(file,(numeric variable)
>:     :    else
>:     :      read(file,(array of characters))
>:     :    end
>:    
>:     : Try doing *that* in TP!
>:    
>:     But how do you know that the "next byte is a numeral"?   Bytes and chars
>:     look the same when they're in binary.
>: Leonard is essentially correct. The file in this example
>: is a textfile. Standard Pascal allows one to "look ahead"  
>: at the next component of a sequential file without actually
>: reading it.  This is often very convenient.  
>I'm not questioning the ability of reading ahead -- my question is
>about the ability to know the type of the element in the buffer.
>What if the file contains the following:  "3-D modeling".  
>Are you going to read '3' as a numeral and the rest as an
>array of chars, perchance?
>I'm not sure how standard pascal's file I/O work, but with TP
>the type of the file should be well defined even before opening
>the file.    So I can only read one 'thing' from the file, but
>I'm free to convert it any way I wish.

Integers or reals an be read from text files by Pascal's 'read',
provided the next piece text (skipping any blanks) is a valid
representation of an integer or real.  This saves you the trouble of
converting -- 'read' does it for you.


Wed, 18 Jun 1902 08:00:00 GMT  
 Difference between Standard and Turbo Pascal


Wed, 18 Jun 1902 08:00:00 GMT  
 Difference between Standard and Turbo Pascal

Quote:

>ok, i have a problem doing something in Turbo Pascal.
>Ok, i have a scrolling message, i can get that scroolling message to
>go anywhere already, thats no problem.  BUt I have a main menu, and i'd
>like that scrolling message to come on the bottom but not effect my
>main menu and my choice of an option in the main menu.  How do
>i get it to work that way? anyone please help me.  I think i use
>interrupt commands but i don't know how to use em.  WRite me email
>on how to do it. i'd great appreciate it!.

I just posted a message in a similar thread (title was something like "A
Perplexing Pascal Problem") that explains how to do this.  If you can't find
the article, let me know, and I'll forward it to you.

--
Scott F. Earnest           | We now return you to our regularly scheduled



Wed, 18 Jun 1902 08:00:00 GMT  
 Difference between Standard and Turbo Pascal
ok, i have a problem doing something in Turbo Pascal.

Ok, i have a scrolling message, i can get that scroolling message to

go anywhere already, thats no problem.  BUt I have a main menu, and i'd

like that scrolling message to come on the bottom but not effect my

main menu and my choice of an option in the main menu.  How do

i get it to work that way? anyone please help me.  I think i use

interrupt commands but i don't know how to use em.  WRite me email

on how to do it. i'd great appreciate it!.



Wed, 18 Jun 1902 08:00:00 GMT  
 Difference between Standard and Turbo Pascal


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 22 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Difference between Standard and Turbo Pascal

2. difference between TURBO PASCAL & BORLAND PASCAL

3. difference between TURBO PASCAL & BORLAND PASCAL

4. I would like to know the difference between Borland Pascal 7.0 and Turbo Pascal 7.0

5. Difference between THINKpascal and Turbo Pascal?

6. forward object in standard turbo pascal

7. differences between Turbo Pascal 7.0 and Turbo Pascal 7.01?

8. TPX.EXE AND TURBO.EXE {difference between}

9. Standard vs. Turbo

10. Pascal Standards FAQ at Pascal Central

11. Official Pascal Standards now at Pascal Central

12. Pascal Standards FAQ at Pascal Central

 

 
Powered by phpBB® Forum Software