* Moved (from: gpc) by Berend de Boer using timEd 1.10.b3+.
Peter Gerwinski wrote in a message to Berend de Boer:
PG> I tried to use Extended Pascal "binding" to assign a file
PG> variable to an external -- existing -- file. I just copied
PG> the "Assign" pro- cedure by Berend as published in
PG> borland2ep.doc. It does not always work: I often get a
PG> runtime error saying that the file did not exist.
If you can repeat it, compile with another Extended Pascal compiler, for …
[View More]example Prospero's one. If that fails too, there is really something wrong with the code. But I suspect gpc. You're using which OS?
Groetjes,
Berend (-:
fido: 2:281/527.23
email: berend(a)beard.nest.nl
[View Less]
Hello,
perhaps somebody can help to clarify the following two questions:
1) Is the comparision with `=' or `<>' of structured variables okay in
ISO Pascal? ISO 10206 6.8.3.5 only says that the types to be compared
must be compatible.
If not, this might be a reasonable extension (already offered by
some compilers, *not* including Borland Pascal;).
2) In GPC strings, the schema discriminant "Capacity" is accessible
as a "record field" of the string. Is this okay by ISO …
[View More]10206,
and should it be done for other schemata this way, too? And how to
tread the "length" field of a string? ISO 10206 6.4.3.3 does not
say anything about that. I could imagine the string schema type to
be something similar to
Type
String ( Capacity: Integer ) = record
length: Integer;
String: packed array [ 1..Capacity ] of Char;
end (* String *);
except that the "String" field is automatically dereferenced.
Thanks for your help,
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
peter.gerwinski(a)uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201]
maintainer GNU Pascal [970420] - http://home.pages.de/~gnu-pascal/ [970125]
[View Less]
Is Exit not included in GPC? i.e.
program test;
procedure t1(a:integer);
begin
writeln('hello1');
if a = 1 then exit;
writeln('hello2');
end;
begin
writeln('hello');
t1(1);
t1(0);
writeln('hello3');
end.
should produce:
hello
hello1
hello1
hello2
hello3
but I get Undefined Indentifier 'Exit'
I tried using return; and that works.
I posted this question to the comp.lang.pascal NG and had someone from
Borland tell me that Exit should do the trick (I didn't say I wasn't using
TP tho).
…
[View More]Is exit a Borland thing?
-SC
[View Less]
According to Christian Wendt:
> :-) I do the work and get common to the RTS C source (which is very vell
> readable!) - and then learn all the work has been done...
Oh - sorry! Since an improved BPcompat package for DOS (DJGPP) will
be released soon, what about facing Linux instead? Sven's BGI2GRX
(Graph) Unit runs under Linux, but we have no CRT yet ...
> PG>available in the `contrib' subdirectory of the GPC distribution.
> BPCompat.pas is in my contrib subdirectory... but …
[View More]only "highlevel"
> functions...
The same stuff as in Borland's CRT, isn't it?
> not "impossible"- you only got to reinvent the wheel and write to
> $b80000... _big_ loss in portability & comfort (no easy to call writeln.
Nevertheless this will remain my preferred method in BO5. The fastest
thing you can imagine on the DOS platform.
> BTW - is there a way to make a procedure to have a variable count of
> parameters? (as writeln) - e.g. would it be possible to define to "C"
> printf procedure within pascal ?)
Yes and no: You can define a "Procedure Foo ( a, b: Integer; ... );"
with a triple dot indicating a variable number of subsequent arguments,
but I have not yet found out how to access them ...
> But i think that even there it would be quite more comfortable to use
> Textcolor instead of write(chr(27)+'[5;33m'); or such...
Of course. But a CRT Unit could use these sequences to access the
terminal in a portable way.
> exactly what I had in mind... don't kill it from the alphas :-)
Don't worry. If things develop as I hope, we will enter beta stage
soon ...
Greetings,
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
peter.gerwinski(a)uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201]
maintainer GNU Pascal [970420] - http://home.pages.de/~gnu-pascal/ [970125]
[View Less]
A.Eckleder(a)chateau.cl.sub.de / oh no,some e-mail ... by ME!!!
To: GPC(a)HUT.FI (Gpc)
----------------------------------------------------------------------
...i've got some problem with the library file of the actual (?!?)
alphaversion of gnu-pascal...
obviousely there's some problem in string-management (gpc2.0 libs do well)
here's some sample code:
type normstr=string[255]; {also tested with different string lengths}
function strng(z:real):normStr; {convert number to string}
var …
[View More]s:normstr;
k:byte;
neg:boolean;
begin
k:=0;
while (z<>int(z)) and (k<5) do
begin
z:=z*10;
inc (k);
end;
s:='';if z<0 then neg:=true else neg:=false;
z:=int(abs(z));
if z=0 then s:='0';
while z>0 do
begin
s:=chr(trunc(z-int(z/10)*10)+48)+s;
z:=int(z/10);
end;
if k>0 then s:=copy(s,1,length(s)-k)+'.'+copy(s,length(s)-k+1,k);
if neg then s:='-'+s;
strng:=s;
end;
as far as i could analyse the problem,the error occurs within the
s:=chr(trunc(z-int(z/10)*10)+48)+s; expression.
i know that this is not very optimized code,but it normally works fine
though.
the other problem i realized with this alpha-version is that i couldn't
manage to use the inline assembler.
i only only got a message telling me function asm() not beeing existent.
because of this strong behavior i use the gpc2.0 compiler with the alpha-
libraries...perhaps THIS is the reason why the function above doesn't
work,
but i am not quite sure about that...
andy
/------------------- A.ECKLEDER(a)CHATEAU.CL.SUB.DE --------------------\
Who is 'General Failure' - And why is he reading my harddisk ?
\------------------ Andreas Eckleder@2:2480/816.32 -------------------/
## CrossPoint v3.1 ##
[View Less]
Peter Gerwinski wrote:
>Not too difficult: Integer arrays can be treated by a simple byte
>compare; for string arrays the compiler must generate a loop.
I thought that was a lot of work, but it seems I was wrong :-)
>> Certainly: see the examples in 6.8.4
>
>Thanks a lot! I didn't find that. Why wasn't there a single word
>about
>this in 6.4.7, 6.4.8???
No idea. Just like a lot of other topics treatment is fairly sparse. We
need to have everything in one place. …
[View More]Maybe I should write an Extended
Pascal programmers book :-)
>What about the following:
>
> * Default mode (and Extended Pascal mode): The length field cannot
> be accessed (except with "length ( MyStr )".)
>
> * With extended syntax (*$X+*): The length field can be read- and
> write-accessed.
I don't care, because I don't see the need for accessing the length field
directory, as long as it is not available in Extended Pascal mode :-)
Groetjes,
Berend.
[View Less]
According to Stephen Lindholm:
> [`ShortStr' or `ShortString'?]
> How about supporting both?
Since PEP and Delphi agree that this is called `ShortString',
I conclude that we should use that, too.
However it will take some time until it will be implemented:
All string types must be compatible with each other in
assignments, comparisions, etc., and all string routines will
have to accept all sorts of strings. (Well ... at least
some of them will accept all sorts; others might be okay to
…
[View More]support EP's long strings only.)
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
Reply e-mail to "uni-essen" http://home.pages.de/~peter.gerwinski/ [970201]
instead of "NO-SPAM-PLEASE". maintainer GNU Pascal [970412] kampi.hut.fi/gpc
Sorry for the inconvenience. http://home.pages.de/~gnu-pascal/ [970125]
[View Less]
According to Berend de Boer:
> If you want something 'difficult' to do , implement integer and string
> value arrays :-)
Not too difficult: Integer arrays can be treated by a simple byte
compare; for string arrays the compiler must generate a loop. This can be
done for records, too: The compiler can do a loop through the fields of
the record. (User programs cannot do that. :-P)
> Certainly: see the examples in 6.8.4
Thanks a lot! I didn't find that. Why wasn't there a single …
[View More]word about
this in 6.4.7, 6.4.8???
> I think one implements it as:
>
> Type
> String ( Capacity: Integer ) = record
> length: Integer;
> String: packed array [ 1..Capacity+SizeOf(Char) ] of Char;
> end (* String *);
It's "1..Capacity + 1". (Increasing the index by one adds one char.)
(And it's still an exception since you write "MyStr [ i ]", not
"MyStr.String [ i ]".)
> However length is not specified in the standard, so it should not be
> accessible with Extended Pascal. You can always use length(MyStr) to
> achieve the same functionality.
What about the following:
* Default mode (and Extended Pascal mode): The length field cannot
be accessed (except with "length ( MyStr )".)
* With extended syntax (*$X+*): The length field can be read- and
write-accessed.
Okay like that? Or perhaps better to have it in default mode, too,
and to switch it OFF in Extended Pascal mode? I think it's best as
above because you should assign a new length to a string only if you
know exactly what you are doing.
Greetings,
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
peter.gerwinski(a)uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201]
maintainer GNU Pascal [970420] - http://home.pages.de/~gnu-pascal/ [970125]
[View Less]
According to Frank Heckenbach:
>
> Hmmm... well, I could not see the effect. I wrote the following test program:
> [...]
> I compiled it with "-O3 -S". The resulting code contained two calls to
> _memcpy. [...]
Ah - I was wrong, sorry. The string addition is optimized, but it is
done on a temporary variable, and the assignment to that guy is *not*
optimized.
Maybe this can be changed ... I will have a look at that. (But not now.)
(* By the way: Good news for all friends of …
[View More]schemata! They might be
finished (except, of course, bugs) this week ... *)
Greetings,
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
peter.gerwinski(a)uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201]
maintainer GNU Pascal [970420] - http://home.pages.de/~gnu-pascal/ [970125]
[View Less]
On Wed, 30 Apr 1997 00:41:07 +0200 (MET DST) Peter Gerwinski
<peter(a)agnes.dida.physik.uni-essen.de> wrote:
>According to The African Chief:
>> According to Frank Heckenbach:
>> >255 chars max length are sometimes not enough.
>> But you can use normal GPC strings for that.
>
>Just my point: For applications where you need looooong strings, GPC's
><=2GB strings with 8 bytes of overhead are perfect. In those cases
>where you must save space, 255 …
[View More]characters are fine - and they are
>compatible to UCSD and Borland Pascal.
>
>Should it be `ShortString' or `ShortStr'? In analogy to `LongInt'
>instead of `LongInteger' I would vote for `ShortStr'; OTOH, Prospero's
>Extended Pascal compiler (PEP) has `ShortString' for this ...
Delphi also has "ShortString" - so perhaps we should use that.
Best regards, The Chief
Dr Abimbola A. Olowofoyeku (The African Chief, and the Great Elephant)
Author of: Chief's Installer Pro v3.12 for Win16 and Win32.
Homepage: http://ourworld.compuserve.com/homepages/African_Chief/
E-mail: laa12(a)cc.keele.ac.uk
[View Less]