TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Thomas Seeling
from: Timo Sirainen
date: 1996-03-27 16:15:00
subject: Speed Pascal

TS>> of course my code is full of these System.xxx variables. It's hard to
 TS>> try to convert these to work with SP.

TS> Don't you use an editor with global search/replace?

Yes, but it's hard to convert all variables right. For example, the Val
function, how should I use it? Virtual Pascal code:

=== Cut ===
{$ifdef os2} uses use32; {$endif}

var str: string;
    num,err: integer;

    f: file;
    readed: word;

begin
  str:='5';
  val(str,num,err);

  assign(f,'myfile');
  reset(f);
  blockread(f,str,256,readed);
  close(f);
end.
=== Cut ===

Works fine compiled with Borland Pascal. Works fine compiled with Virtual
Pascal. If I wanted to make that with Speed Pascal, I would have to do it
like this:

=== Cut ===
var str: string;
    num,err: integer;

    f: file;
    {$ifdef os2}
    readed: longint;
    {$else}
    readed: word;
    {$endif}

begin
  str:='5';
  val(str,num,err);

  assign(f,'myfile');
  reset(f);
  blockread(f,str,256,readed);
  close(f);
end.
=== Cut ===

That {$ifdef} for all blockread and blockwrite variables, awful. Or if I make 
Use32 unit like in VP (contains 'type word = longint'), SP complains in 'Val' 
commands... So, two main reasons what are better in VP: system.xxx works, and 
Val command uses form val(string, number, longint). Very easy to use same
code in BP and VP.

 - Timo/2 (Using SkyReader/2)

--- Concord/BW POO1C3 (Eval.)
* Origin: // Skyliner // 955-176242 // 24h // v32b // (2:227/33)
SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 227/33 0 220/841 201/2104 109/347 18 13/25 396/1 270/101 712/515
@PATH: 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.