Re: [fpc-pascal] Arrays in debugger; No range errors on arrays

2005-05-25 Thread L505

| I guess this is a pascal list here and no ada advertisement list?
|

no, n'ada ada ada-vertisement list
(sorry, could n'ada resisted.)

I was looking into ada the other day on some wikis, though. Have to check 
deeper into
its origins.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] cdecl calling and const parameters - was SizeOf(File) <> SizeOf(FileRec)

2005-05-25 Thread Søren Ager

Tomas Hajny wrote:

I believe the C const construct (const declaration in a call marked 
as cdecl) is wrongly used in so32dll.connect (the meaning of this 
construct in C is different from the Pascal "const" modifier).


I am programming in Pascal so I can't see what C has to do with it ;-) 
I am only interested in changing the caling convention - not the meaning 
of the const which should be the same as var - with the exception that 
you are not allowed to change the parameter. So you are saying there is 
no way to make it behave like that? :-(



If address of the record should be passed, use either "var" modifier


That works - but it is not optimal as I have to double buffer all calls 
in the standard units from const to var. Sockets.pas:


Function Connect(Sock:Longint;const Addr; Addrlen:Longint):Boolean;
var
  sa : so32dll.SockAddr;
begin
  sa:=so32dll.SockAddr(Addr);
  Connect:=so32dll.Connect(Sock,sa,AddrLen)=0;
  if not Connect then
SocketError:=so32dll.sock_errno
  else
SocketError:=0;
end;

And it gets worse when I have an untyped buffer (as send does) - then I 
will have to allocate memory - copy the contents - call the dll - 
deallocate...


depend on used compiler options, so it's probably better to add 
explicit {$PACKRECORDS 1} to so32dll.pas.


Done

Take care,
   Soren


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] cdecl calling and const parameters - was SizeOf(File) <> SizeOf(FileRec)

2005-05-25 Thread Jonas Maebe


On 25 mei 2005, at 09:29, Søren Ager wrote:

I am programming in Pascal so I can't see what C has to do with it ;-) 
I am only interested in changing the caling convention - not the 
meaning of the const which should be the same as var - with the 
exception that you are not allowed to change the parameter


No, const does not mean the same as var. For example, a "const a: 
longint" parameter is passed by value.



Jonas


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] cdecl calling and const parameters - was SizeOf(File) <> SizeOf(FileRec)

2005-05-25 Thread Tomas Hajny
Date sent:  Wed, 25 May 2005 09:29:00 +0200
From:   Søren Ager <[EMAIL PROTECTED]>
To: FPC-Pascal users discussions 

Subject:[fpc-pascal] cdecl calling and const parameters - was 
SizeOf(File)
<> SizeOf(FileRec)
Send reply to:  FPC-Pascal users discussions 





> > I believe the C const construct (const declaration in a call marked
> > as cdecl) is wrongly used in so32dll.connect (the meaning of this
> > construct in C is different from the Pascal "const" modifier).
>
> I am programming in Pascal so I can't see what C has to do with it ;-)

You expect them to behave the same way as you're used to from Pascal,
but ask FPC to call the function in a way compatible to C by using a
cdecl modifier. ;-) Yes, the meaning of a cdecl modifier is somewhat
different in FPC from some other Pascal compilers - but it's designed
so for better compatibility with those C compilers?


> I am only interested in changing the caling convention - not the
> meaning of the const which should be the same as var - with the
> exception that you are not allowed to change the parameter. So you are
> saying there is no way to make it behave like that? :-(
>
> > If address of the record should be passed, use either "var" modifier
>
> That works - but it is not optimal as I have to double buffer all
> calls in the standard units from const to var. Sockets.pas:
>
> Function Connect(Sock:Longint;const Addr; Addrlen:Longint):Boolean;
> var
>sa : so32dll.SockAddr;
> begin
>sa:=so32dll.SockAddr(Addr);
>Connect:=so32dll.Connect(Sock,sa,AddrLen)=0;
>if not Connect then
>  SocketError:=so32dll.sock_errno
>else
>  SocketError:=0;
> end;

My suggestion would be:

1) Provide the (relevant) library calls in so32dll.pas with two
(overloaded) versions, one with the more C-like approach using
pointers, the other more pascallish with var pointers.

2) Use the pointer version in sockets.pas - that's perfectly
compatible to the const parameters and is by the way the same what's
done for the Unix implementations using C library -
/rtl/inc/stdsock.inc (Unix implementations using kernel syscalls have
different calling convention).


> And it gets worse when I have an untyped buffer (as send does) - then
> I will have to allocate memory - copy the contents - call the dll -
> deallocate...

Actually, it gets better there. ;-) Parameters cannot be passed on
stack if they are untyped, so they are passed by reference as
expected by you. That's another potential solution to your issue,
although I wouldn't recommend discarding the types in declarations in
cases these are known (e.g. in Connect), because that would remove
the advantage of Pascal type checking.

Tomas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] cdecl calling and const parameters - was SizeOf(File) <> SizeOf(FileRec)

2005-05-25 Thread Søren Ager

Tomas Hajny wrote:


My suggestion would be:


I copied what the win32 socket does: connect calls fpconnect calls 
so32dll.connect. That takes care of my problems and should make the os/2 
socket unit 100% compatible with other fp units.


So how/who do I submit the source to?


Take care,

  Soren

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] cdecl calling and const parameters - was SizeOf(File) <> SizeOf(FileRec)

2005-05-25 Thread Tomas Hajny
Date sent:  Wed, 25 May 2005 11:40:12 +0200
From:   Søren Ager <[EMAIL PROTECTED]>
To: FPC-Pascal users discussions 

Subject:Re: [fpc-pascal] cdecl calling and const parameters - 
was   SizeOf(File)
<> SizeOf(FileRec)
Send reply to:  FPC-Pascal users discussions 





> Tomas Hajny wrote:
>
> > My suggestion would be:
>
> I copied what the win32 socket does: connect calls fpconnect calls
> so32dll.connect. That takes care of my problems and should make the
> os/2 socket unit 100% compatible with other fp units.

Yes, that's probably the best.


> So how/who do I submit the source to?

Send it to my address. I guess that in this case it's probably better
to send the whole file(s) and not just diffs. I'll modify the
Makefiles accordingly (unless you did that too) and commit it to SVN.

Tomas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] records - really a bug?

2005-05-25 Thread chromdildo
Hello everybody.

I discovered a very strange bug/issue and I don't know how to describe
it best as a bug-report.
(or am I doing something wrong?)
I try: a variable declared within a record, AccessViolates when set
later in code,
if declared at the "wong" place..?..

(environment: linux/i686 - fpc 2.0.0)
look at this small snipplet: (attached full testing.pas source for
reproduction):

//<-snip->
type Teumex_memory = record
 pin  : Tchange_string;
 // amtsbelegung : Tchange_bool;// <-- leave it here, everything
is ok.
 msn  : array [0..9] of Tchange_string;
 port : array [0..9] of Tchange_string;
 amtsbelegung : Tchange_bool;// <-- put it there: Access
violation when amtsbelegung is set
end;
//<-snip->


Best regards
./chrom
program bugtest;

{$mode objfpc}{$H+}

uses classes, sysutils;



type Tchange_string = record
 value: string;
 changed : boolean;
end;

type Tchange_int= record
 value: integer;
 changed : boolean;
end;

type Tchange_bool= record
 value: boolean;
 changed : boolean;
end;

//The internal memory of the eumex (sample)
type Teumex_memory = record
 pin  : Tchange_string;
 
 // amtsbelegung : Tchange_bool;// <-- leave it here, everything is ok.

 msn  : array [0..9] of Tchange_string;
 port : array [0..9] of Tchange_string;

 amtsbelegung : Tchange_bool;	// <-- put it there: Access violation when setting
end;



TEumex = class			
private
FMemory : Teumex_memory;
public
   property  Memory  : Teumex_memory read FMemory write FMemory;
end;


var Eumex1  : TEumex;
ic  : integer;


begin
  Eumex1 := TEumex.create;

  writeln ('setting PIN:');
  Eumex1.Memory.pin.value := '1234';
  Eumex1.Memory.pin.changed := true;

  writeln ('setting amtsbelgegung');
  Eumex1.Memory.amtsbelegung.value := true;   // <-- Access violation, if declared like above
  Eumex1.Memory.amtsbelegung.changed := true;

  for ic:= 1 to 10 do begin
  Eumex1.Memory.msn[ic].value := '';
  Eumex1.Memory.msn[ic].changed := false;
  Eumex1.Memory.port[ic].value := '0';
  Eumex1.Memory.port[ic].changed := false;
  end;


end.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] records - really a bug?

2005-05-25 Thread Florian Klaempfl
chromdildo wrote:

Well, in your program :) Compile with range checking ot see it.

> Hello everybody.
> 
> I discovered a very strange bug/issue and I don't know how to describe
> it best as a bug-report.
> (or am I doing something wrong?)
> I try: a variable declared within a record, AccessViolates when set
> later in code,
> if declared at the "wong" place..?..
> 
> (environment: linux/i686 - fpc 2.0.0)
> look at this small snipplet: (attached full testing.pas source for
> reproduction):
> 
> //<-snip->
> type Teumex_memory = record
>  pin  : Tchange_string;
>  // amtsbelegung : Tchange_bool;// <-- leave it here, everything
> is ok.
>  msn  : array [0..9] of Tchange_string;
>  port : array [0..9] of Tchange_string;
>  amtsbelegung : Tchange_bool;// <-- put it there: Access
> violation when amtsbelegung is set
> end;
> //<-snip->
> 
> 
> Best regards
> ./chrom
> 
> 
> 
> 
> program bugtest;
> 
> {$mode objfpc}{$H+}
> 
> uses classes, sysutils;
> 
> 
> 
> type Tchange_string = record
>  value: string;
>  changed : boolean;
> end;
> 
> type Tchange_int= record
>  value: integer;
>  changed : boolean;
> end;
> 
> type Tchange_bool= record
>  value: boolean;
>  changed : boolean;
> end;
> 
> //The internal memory of the eumex (sample)
> type Teumex_memory = record
>  pin  : Tchange_string;
>  
>  // amtsbelegung : Tchange_bool;// <-- leave it here, everything is 
> ok.
> 
>  msn  : array [0..9] of Tchange_string;
>  port : array [0..9] of Tchange_string;
> 
>  amtsbelegung : Tchange_bool; // <-- put it there: Access violation 
> when setting
> end;
> 
> 
> 
> TEumex = class
> private
> FMemory : Teumex_memory;
> public
>property  Memory  : Teumex_memory read FMemory write FMemory;
> end;
> 
> 
> var Eumex1  : TEumex;
> ic  : integer;
> 
> 
> begin
>   Eumex1 := TEumex.create;
> 
>   writeln ('setting PIN:');
>   Eumex1.Memory.pin.value := '1234';
>   Eumex1.Memory.pin.changed := true;
> 
>   writeln ('setting amtsbelgegung');
>   Eumex1.Memory.amtsbelegung.value := true;   // <-- Access violation, if 
> declared like above
>   Eumex1.Memory.amtsbelegung.changed := true;
> 
>   for ic:= 1 to 10 do begin
>   Eumex1.Memory.msn[ic].value := '';
>   Eumex1.Memory.msn[ic].changed := false;
>   Eumex1.Memory.port[ic].value := '0';
>   Eumex1.Memory.port[ic].changed := false;
>   end;
> 
> 
> end.
> 
> 
> 
> 
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] records - really a bug?

2005-05-25 Thread Jonas Maebe


On 25 mei 2005, at 12:06, chromdildo wrote:


 msn  : array [0..9] of Tchange_string;
 port : array [0..9] of Tchange_string;


This array goes from 0 till 9


  for ic:= 1 to 10 do begin
  Eumex1.Memory.msn[ic].value := '';
  Eumex1.Memory.msn[ic].changed := false;
  Eumex1.Memory.port[ic].value := '0';
  Eumex1.Memory.port[ic].changed := false;
  end;


And here you go from 1 to 10. The reason it doesn't crash in one case 
and that it does crash in another case, is due to alignment differences 
(in the "crash case", your record is bigger, so there is more chance 
you will write beyond the boundary of allocated memory).



Jonas


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] records - really a bug?

2005-05-25 Thread chromdildo
Thanks for the quick reply.
...I see, stupid me. :)

But when the position of "amtsbelegung : Tchange_bool;" is changed, no
AV occurs ..?
Reproducable?
Something about Memory Acces  I think I got it.

Best regards
./chrom



Florian Klaempfl wrote:

>chromdildo wrote:
>
>Well, in your program :) Compile with range checking ot see it.
>
>  
>
>>Hello everybody.
>>
>>I discovered a very strange bug/issue and I don't know how to describe
>>it best as a bug-report.
>>(or am I doing something wrong?)
>>I try: a variable declared within a record, AccessViolates when set
>>later in code,
>>if declared at the "wong" place..?..
>>
>>(environment: linux/i686 - fpc 2.0.0)
>>look at this small snipplet: (attached full testing.pas source for
>>reproduction):
>>
>>//<-snip->
>>type Teumex_memory = record
>> pin  : Tchange_string;
>> // amtsbelegung : Tchange_bool;// <-- leave it here, everything
>>is ok.
>> msn  : array [0..9] of Tchange_string;
>> port : array [0..9] of Tchange_string;
>> amtsbelegung : Tchange_bool;// <-- put it there: Access
>>violation when amtsbelegung is set
>>end;
>>//<-snip->
>>
>>
>>Best regards
>>./chrom
>>
>>
>>
>>
>>program bugtest;
>>
>>{$mode objfpc}{$H+}
>>
>>uses classes, sysutils;
>>
>>
>>
>>type Tchange_string = record
>> value: string;
>> changed : boolean;
>>end;
>>
>>type Tchange_int= record
>> value: integer;
>> changed : boolean;
>>end;
>>
>>type Tchange_bool= record
>> value: boolean;
>> changed : boolean;
>>end;
>>
>>//The internal memory of the eumex (sample)
>>type Teumex_memory = record
>> pin  : Tchange_string;
>> 
>> // amtsbelegung : Tchange_bool;// <-- leave it here, everything is 
>> ok.
>>
>> msn  : array [0..9] of Tchange_string;
>> port : array [0..9] of Tchange_string;
>>
>> amtsbelegung : Tchange_bool; // <-- put it there: Access violation 
>> when setting
>>end;
>>
>>
>>
>>TEumex = class
>>private
>>FMemory : Teumex_memory;
>>public
>>   property  Memory  : Teumex_memory read FMemory write FMemory;
>>end;
>>
>>
>>var Eumex1  : TEumex;
>>ic  : integer;
>>
>>
>>begin
>>  Eumex1 := TEumex.create;
>>
>>  writeln ('setting PIN:');
>>  Eumex1.Memory.pin.value := '1234';
>>  Eumex1.Memory.pin.changed := true;
>>
>>  writeln ('setting amtsbelgegung');
>>  Eumex1.Memory.amtsbelegung.value := true;   // <-- Access violation, if 
>> declared like above
>>  Eumex1.Memory.amtsbelegung.changed := true;
>>
>>  for ic:= 1 to 10 do begin
>>  Eumex1.Memory.msn[ic].value := '';
>>  Eumex1.Memory.msn[ic].changed := false;
>>  Eumex1.Memory.port[ic].value := '0';
>>  Eumex1.Memory.port[ic].changed := false;
>>  end;
>>
>>
>>end.
>>
>>
>>
>>
>>___
>>fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>>http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>>
>
>
>___
>fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>  
>


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] sending Emails from within freepascal

2005-05-25 Thread Rudolf Harney
Hi,

We need a program, running under Linux and windows, that is able to send
Emails. With Linux I can call sendmail. Is there an easy way for sending
Emails from within freepascal under Windows, also?

Thank You,

Rudolf


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] sending Emails from within freepascal

2005-05-25 Thread Marco van de Voort
> We need a program, running under Linux and windows, that is able to send
> Emails. With Linux I can call sendmail. Is there an easy way for sending
> Emails from within freepascal under Windows, also?

I've used ICS/win32 from www.overbyte.be. It compiled directly using
FPC/win32 1.9.8, and theer is a consmtp demo that sends a mail. All in
one exe, no external files needed.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] sending Emails from within freepascal

2005-05-25 Thread Vinzent Hoefler
On Wednesday 25 May 2005 14:07, Rudolf Harney wrote:

> We need a program, running under Linux and windows, that is able to
> send Emails. With Linux I can call sendmail. Is there an easy way for
> sending Emails from within freepascal under Windows, also?

You can try Synapse (http://www.ararat.cz/synapse/>). I can't tell 
about the SMTP module, but if it does as well as the HTTP module here 
does on both Linux and Windows, it certainly rocks. ;-)


Vinzent.

-- 
public key: http://www.t-domaingrabbing.ch/publickey.asc


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] darwin -> linux

2005-05-25 Thread Artur Kornilowicz
Hi,

I work on PPC with Darwin.
I am trying to build binaries for Linux.
Calling

fpc -Tlinux a.pas

I get:

Free Pascal Compiler version 2.0.0 [2005/05/13] for powerpc
Copyright (c) 1993-2005 by Florian Klaempfl
Target OS: Linux for PowerPC
Compiling a.pas
Fatal: Can't find unit System
Error: Compilation aborted
Error: /usr/local/bin/ppcppc returned an error exitcode (normal if you did
not specifiy a source file to be compiled)


How can I fix it?

Regards
Artur


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] darwin -> linux

2005-05-25 Thread Jonas Maebe


On 25 mei 2005, at 16:54, Artur Kornilowicz wrote:


I work on PPC with Darwin.
I am trying to build binaries for Linux.
Calling

fpc -Tlinux a.pas


The Mac OS X version does not include Linux units by default, so you 
have to compile and install the compiled Linux RTL. For this, and also 
to generate programs afterwards, you need a Darwin-to-Linux 
cross-assembler and cross-linker (the Darwin assembler and linker 
cannot generate Linux/ELF object files). You will probably have to 
compile these yourself, at least a quick google search did not turn up 
anything.



Jonas


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] darwin -> linux

2005-05-25 Thread Adriaan van Os

Jonas Maebe wrote:


Artur Kornilowicz wrote:


I work on PPC with Darwin.
I am trying to build binaries for Linux.
Calling

fpc -Tlinux a.pas


The Mac OS X version does not include Linux units by default, so you 
have to compile and install the compiled Linux RTL. For this, and also 
to generate programs afterwards, you need a Darwin-to-Linux 
cross-assembler and cross-linker (the Darwin assembler and linker 
cannot generate Linux/ELF object files). You will probably have to 
compile these yourself, at least a quick google search did not turn up 
anything.


There is, check out 
.


Regards,

Adriaan van Os


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] darwin -> linux

2005-05-25 Thread Jonas Maebe


On 25 mei 2005, at 17:30, Adriaan van Os wrote:

The Mac OS X version does not include Linux units by default, so you 
have to compile and install the compiled Linux RTL. For this, and 
also to generate programs afterwards, you need a Darwin-to-Linux 
cross-assembler and cross-linker (the Darwin assembler and linker 
cannot generate Linux/ELF object files). You will probably have to 
compile these yourself, at least a quick google search did not turn 
up anything.


There is, check out 
.


That's the other way round, this person wants to compile Linux binaries 
under Darwin/Mac OS X.



Jonas


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] sending Emails from within freepascal

2005-05-25 Thread Lukas Gebauer
> You can try Synapse (http://www.ararat.cz/synapse/>). I can't tell
> about the SMTP module, but if it does as well as the HTTP module here does
> on both Linux and Windows, it certainly rocks. ;-)

Sure!

And simple mails can be sended by one function call. ;-) However when you 
wish to use MIME encoded mails (include attachments, charset encoding, 
etc.), then you can do it by Synapse too!

--
Lukas Gebauer.

E-mail: [EMAIL PROTECTED]
WEB: http://www.ararat.cz/synapse - Synapse Delphi and Kylix TCP/IP 
Library



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] exit ?

2005-05-25 Thread Tony Pelton
hi all,

new pascal guy, but not a new programmer.

i'm used to being able to use the "return" reserved word in Java and
'C' to be able to short circuit the execution of a function/method.

over and above any philisophical judgments on my programming
technique, I see Free Pascal has a reserved word 'exit' that mimics
"return" ?

Is some analogy to "return" not supported in the official pascal dialect ?

is 'exit' the only way to do this, and obviously, not portable to
other compilers ?

is there another token that i could/should use ?

i do know that there is goto/label, but i would prefer not to use
that, as that construct has been beat into my head over the years as
being very bad.

tia,
Tony

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] exit ?

2005-05-25 Thread Jonas Maebe


On 25 mei 2005, at 18:20, Tony Pelton wrote:


over and above any philisophical judgments on my programming
technique, I see Free Pascal has a reserved word 'exit' that mimics
"return" ?


Yes.

Is some analogy to "return" not supported in the official pascal 
dialect ?


exit with a parameter is not supported in other compilers afaik (e.g. 
exit(5), equivalent to "return 5"). It may exist in Delphi (I've never 
used Delphi), but it definitely does not exist in Turbo Pascal.



is 'exit' the only way to do this, and obviously, not portable to
other compilers ?


Exit without a parameter is supported in Turbo Pascal and Delphi.


is there another token that i could/should use ?


Not that I can think of.


Jonas


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] exit ?

2005-05-25 Thread Adriaan van Os

Jonas Maebe wrote:

Is some analogy to "return" not supported in the official pascal 
dialect ?


exit with a parameter is not supported in other compilers afaik (e.g. 
exit(5), equivalent to "return 5").


UCSD Pascal has

EXIT( procedurename)
EXIT( programname)
EXIT( PROGRAM)

Macintosh Pascal compilers support EXIT( procedurename) and EXIT( 
PROGRAM). EXIT( procedurename) has been implemented in GNU Pascal 
recently.



is 'exit' the only way to do this, and obviously, not portable to
other compilers ?


Exit without a parameter is supported in Turbo Pascal and Delphi.


Delphi has the built-in "Result" variable and GNU Pascal (also) has 
"Return".


Regards,

Adriaan van Os


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] exit ?

2005-05-25 Thread Paul Davidson

Perhaps combinations of RESULT and EXIT may help?
  if TimeToLeave then begin
Result := 5;
Exit;
  end else 

On May 25, 2005, at 12:33, Jonas Maebe wrote:



On 25 mei 2005, at 18:20, Tony Pelton wrote:


over and above any philisophical judgments on my programming
technique, I see Free Pascal has a reserved word 'exit' that mimics
"return" ?


Yes.

Is some analogy to "return" not supported in the official pascal 
dialect ?


exit with a parameter is not supported in other compilers afaik (e.g. 
exit(5), equivalent to "return 5"). It may exist in Delphi (I've never 
used Delphi), but it definitely does not exist in Turbo Pascal.



is 'exit' the only way to do this, and obviously, not portable to
other compilers ?


Exit without a parameter is supported in Turbo Pascal and Delphi.


is there another token that i could/should use ?


Not that I can think of.


Jonas


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal



P Davidson
Corax Networks Inc.
http://CoraxNetworks.com

IMPORTANT NOTICE:  This message is intended only for the use of the 
individual or entity to which it is addressed. The message may contain 
information that is privileged, confidential and exempt from disclosure 
under applicable law.  If the reader of this message is not the 
intended recipient, or the employee or agent responsible for delivering 
the message to the intended recipient, you are notified that any 
dissemination, distribution or copying of this communication is 
strictly prohibited.  If you have received this communication in error, 
please notify Corax Networks immediately by email at 
[EMAIL PROTECTED]  Thank you.



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] exit ?

2005-05-25 Thread L505
One could wonder whether return really exits or not. I guess exit is more 
obvious.
ReturnAndExit is a bit verbose I suppose.

Another thing to do is go

result:=5; Exit; 

on the same line

Lars
- Original Message - 
From: "Paul Davidson" <[EMAIL PROTECTED]>
To: "FPC-Pascal users discussions" 
Sent: Wednesday, May 25, 2005 9:39 AM
Subject: Re: [fpc-pascal] exit ?


| Perhaps combinations of RESULT and EXIT may help?
|if TimeToLeave then begin
|  Result := 5;
|  Exit;
|end else 
| 
| On May 25, 2005, at 12:33, Jonas Maebe wrote:
| 
| >
| > On 25 mei 2005, at 18:20, Tony Pelton wrote:
| >
| >> over and above any philisophical judgments on my programming
| >> technique, I see Free Pascal has a reserved word 'exit' that mimics
| >> "return" ?
| >
| > Yes.
| >
| >> Is some analogy to "return" not supported in the official pascal 
| >> dialect ?
| >
| > exit with a parameter is not supported in other compilers afaik (e.g. 
| > exit(5), equivalent to "return 5"). It may exist in Delphi (I've never 
| > used Delphi), but it definitely does not exist in Turbo Pascal.
| >
| >> is 'exit' the only way to do this, and obviously, not portable to
| >> other compilers ?
| >
| > Exit without a parameter is supported in Turbo Pascal and Delphi.
| >
| >> is there another token that i could/should use ?
| >
| > Not that I can think of.
| >
| >
| > Jonas
| >
| >
| > ___
| > fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
| > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
| >
| >
| P Davidson
| Corax Networks Inc.
| http://CoraxNetworks.com
| 
| IMPORTANT NOTICE:  This message is intended only for the use of the 
| individual or entity to which it is addressed. The message may contain 
| information that is privileged, confidential and exempt from disclosure 
| under applicable law.  If the reader of this message is not the 
| intended recipient, or the employee or agent responsible for delivering 
| the message to the intended recipient, you are notified that any 
| dissemination, distribution or copying of this communication is 
| strictly prohibited.  If you have received this communication in error, 
| please notify Corax Networks immediately by email at 
| [EMAIL PROTECTED]  Thank you.
| 
| 
| ___
| fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
| http://lists.freepascal.org/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] sending Emails from within freepascal

2005-05-25 Thread Jeff Miller
> We need a program, running under Linux and windows, that is able to send
> Emails. With Linux I can call sendmail. Is there an easy way for sending
> Emails from within freepascal under Windows, also?
You can call "blat", very much like calling sendmail.
Free version available at www.blat.net

Jeff

[EMAIL PROTECTED]



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] string in variant array is cropped?

2005-05-25 Thread Bisma Jayadi
Hi all,

I never playing around with variant using FPC before, until last night. :D 
Currently I'm using FPC 2.0.0 (downloaded from SF) on Pentium III with WinXP SP 
2.

I found a strange behavior of string in FPC variant array. Unfortunately, I 
hardly can find good enough informations about variant in FPC docs. There's no 
chapter about it in the RTL doc, though the Variants unit does exist. So, I 
assume FPC variant is just like Delphi variant. :)

Here is the code...

-

 1: program VarTest;
 2:
 3: {$APPTYPE CONSOLE}
 4:
 5: uses
 6:   Variants;
 7:
 8: var
 9:   v: Variant;
10:
11: begin
12:   // this works fine
13:   v := 'abcdefghijklmnopqrstuvwxyz';
14:   Writeln(v);
15:
16:   // this variant array works but all
17:   // the strings content are cropped
18:   v := VarArrayCreate([0,6], varVariant);
19:   v[0] := 1;
20:   v[1] := 123.4;
21:   v[2] := 'abcdefghijklmnopqrstuvwxyz';
22:   v[3] := true;
23:   v[4] := vararrayof([1,2,3,4]);
24:   v[5] := 'abcdefghijklmnopqrstuvwxyz';
25:   v[6] := 'abcdefghijklmnopqrstuvwxyz';
26:   writeln(v[0]);
27:   writeln(v[1]);
28:   writeln(v[2]);
29:   writeln(v[3]);
30:   writeln(v[4][2]);
31:   writeln(v[5]);
32:   writeln(v[6]);
33: end.

-

And the program output is...

-

¦ Free Pascal IDE Version 1.0.4 [2005/05/08]
¦ Compiler Version 2.0.0
¦ GBD Version GDB 6.2.1
¦ Cygwin "C:\Programs\FreePascal\bin\i386-win32\cygwin1.dll" version 
1005.12.0.0
Running "c:\trash\vartest.exe "
 1: abcdefghijklmnopqrstuvwxyz
 2: 1
 3: 123,41
 4: abcdefghijklm
 5: True
 6: 3
 7: abcdefghijklm
 8: abcdefghijklm

-

while the same code compiled using Delphi 7 generates output like this...

-

C:\Trash>vartest.exe
 1: abcdefghijklmnopqrstuvwxyz
 2: 1
 3: 123,4
 4: abcdefghijklmnopqrstuvwxyz
 5: True
 6: 3
 7: abcdefghijklmnopqrstuvwxyz
 8: abcdefghijklmnopqrstuvwxyz

-

See what I meant? They're on output line number 4, 7, and 8. And also on number 
3 (floating number). While the code is compiled using FPC, switching 
compilation 
mode to FPC, or OBJFPC, or Delphi, will have same output result.

So... is there any explanation about this? Thanks.

-Bee-

has Bee.ography at:
http://beeography.modblog.com



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] generated exe file size

2005-05-25 Thread Bisma Jayadi
And one more thing...

The code is compiled using FPC with faster code optimization, generate exe file 
with size 435 KB. While it is compiled using Delphi with optimization, generate 
exe file with size (only) 83 KB. Why FPC generate that so big exe file? I only 
use Variants unit explicitely.

-Bee-

has Bee.ography at:
http://beeography.modblog.com


- Original Message - 
From: "Bisma Jayadi" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, 26 May 2005 10:27
Subject: [fpc-pascal] string in variant array is cropped?


> Hi all,
>
> I never playing around with variant using FPC before, until last night. :D 
> Currently I'm using FPC 2.0.0 (downloaded from SF) on Pentium III with WinXP 
> SP 2.
>
> ->8-deleted->8-
>
> So... is there any explanation about this? Thanks.
>
> -Bee-
>
> has Bee.ography at:
> http://beeography.modblog.com



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal