[fpc-pascal] arbitrary number of parameters in procedure

Pianoman pianoman at centrum.sk
Wed Aug 31 16:56:23 CEST 2005


Hi, I have not well understood the docs concerning tvarrecs. How can I
create procedure which will accept arbitrary number of parameters?
To demonstrate what I want:
procedure addnums(a,b,c,xxxx of any types var result:sometype);
or writetoscreen(any number of parameters of given type. something like
write or readln procedures.
Thanx for help
Pianoman
----- Original Message -----
From: <fpc-pascal-request at lists.freepascal.org>
To: <fpc-pascal at lists.freepascal.org>
Sent: Wednesday, August 31, 2005 12:00 PM
Subject: fpc-pascal Digest, Vol 12, Issue 28


Send fpc-pascal mailing list submissions to
fpc-pascal at lists.freepascal.org

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
or, via email, send a message with subject or body 'help' to
fpc-pascal-request at lists.freepascal.org

You can reach the person managing the list at
fpc-pascal-owner at lists.freepascal.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of fpc-pascal digest..."


Today's Topics:

   1. Re:  set envirom variable with pascal in linux (Alain Vitry)
   2. Re:  set envirom variable with pascal in linux
      (Michael Van Canneyt)
   3. Re:  set envirom variable with pascal in linux (Marc Santhoff)
   4.  BMP support improved, feedback welcome. (Michael Van Canneyt)
   5. Re:  set envirom variable with pascal in linux (mondrillo)
   6. Re:  set envirom variable with pascal in linux (mondrillo)
   7.  Re: set envirom variable with pascal in linux (mondrillo)


----------------------------------------------------------------------

Message: 1
Date: Tue, 30 Aug 2005 12:16:29 +0200
From: Alain Vitry <alain.vitry at gmail.com>
Subject: Re: [fpc-pascal] set envirom variable with pascal in linux
To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
Message-ID: <17c59ec255a4a703610a74d28cc440e3 at gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

FYI, see
http://alain.vitry.free.fr/en/devel/devel-pascal.php

Le 30 août 05, à 08:47, mondrillo a écrit :

> Hello list,
>
> In Bach, Perl, can do set SDL_VER=`sdl-config --version`
> and in enviroment has the variable SDL_VER=1.2.3 for example.
> echo $SDL_VER
> 1.2.3
> But in Pascal non have the setenv() procedure as in C :(
>
> Actualy I resolve this problem with sending the output to a file, and
> then reading the file. But, can I pass from C this function?, or call
> a libc (thinks is this lib that has setenv() ) from Pascal to execute
> setenv().
>
> Thank's and regards.
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>




------------------------------

Message: 2
Date: Tue, 30 Aug 2005 11:13:30 +0200 (Romance Daylight Time)
From: Michael Van Canneyt <michael at freepascal.org>
Subject: Re: [fpc-pascal] set envirom variable with pascal in linux
To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
Message-ID: <Pine.WNT.4.58.0508301110390.1216 at home-office>
Content-Type: TEXT/PLAIN; charset=US-ASCII



On Tue, 30 Aug 2005, mondrillo wrote:

> Hello list,
>
> In Bach, Perl, can do set SDL_VER=`sdl-config --version`
> and in enviroment has the variable SDL_VER=1.2.3 for example.
> echo $SDL_VER
> 1.2.3
> But in Pascal non have the setenv() procedure as in C :(
>
> Actualy I resolve this problem with sending the output to a file, and
> then reading the file. But, can I pass from C this function?, or call
> a libc (thinks is this lib that has setenv() ) from Pascal to execute
> setenv().

That will not work.

FPC has a copy of the environment, which it received on startup.
It makes little or no sense to add strings to this, since it is
for internal use only.

If you want to execute another program with a different set of
environment strings, you must use the execve call to specify a
different set of environment variables.

The TProcess component allows you to easily specify the
environment as a TStringList.

Michael.



------------------------------

Message: 3
Date: Tue, 30 Aug 2005 14:53:43 +0200
From: Marc Santhoff <M.Santhoff at t-online.de>
Subject: Re: [fpc-pascal] set envirom variable with pascal in linux
To: fpc-pascal at lists.freepascal.org
Message-ID: <1125406423.286.2.camel at localhost.das.netz>
Content-Type: text/plain

Am Dienstag, den 30.08.2005, 08:47 +0200 schrieb mondrillo:
> Hello list,
>
> In Bach, Perl, can do set SDL_VER=`sdl-config --version`
> and in enviroment has the variable SDL_VER=1.2.3 for example.
> echo $SDL_VER
> 1.2.3
> But in Pascal non have the setenv() procedure as in C :(
>
> Actualy I resolve this problem with sending the output to a file, and
> then reading the file. But, can I pass from C this function?, or call
> a libc (thinks is this lib that has setenv() ) from Pascal to execute
> setenv().
>

If you're using a command line to execute a foreign program you can
always tell the shell:

csh: "setenv VAR value; your-foreign-program"
sh:  "VAR=value; your-foreign-program"

Not portable, ugly workaround, but it does do the job.

HTH,
Marc





------------------------------

Message: 4
Date: Tue, 30 Aug 2005 21:45:21 +0200 (CEST)
From: Michael Van Canneyt <michael at freepascal.org>
Subject: [fpc-pascal] BMP support improved, feedback welcome.
To: lazarus at miraclec.com, FPC mailing list
<fpc-pascal at lists.freepascal.org>
Message-ID: <Pine.LNX.4.61.0508302140180.17976 at home.wisa.be>
Content-Type: TEXT/PLAIN; charset=US-ASCII

Hi,

Thanks to some excellent work from Giulio Berna, the support for BMP images
in the FCL has been greatly improved (and as such should impact Lazarus)

- BMP Reader enhanced to full Microsoft specs:
  + support for 15,16 bit bitmaps.
  + support for strange color masks at 16, 32 bpp
  + rle4 and rle8 decoding
  + top-down stored bitmaps.
  + Palette behaviour changed: use palette at 1,4,8 bits.
  + Support for OnProgress event.

- BMP Writer support:
  + BitsPerPixel property.
  + Writing at all color depths.
  + RLE8 and RLE4 compression.

I have applied his patches, but am not in the possibility to test all
these changes. If there are people out there which use a lot of images,
I would welcome some feedback.

More changes (dithering, quantizing) of images have also been implemented
by Giulio, and will be committed soon.

Kudos to Giulio Berna,

Enjoy,

Michael.



------------------------------

Message: 5
Date: Tue, 30 Aug 2005 22:37:13 +0200
From: mondrillo <mondrillo at terra.es>
Subject: Re: [fpc-pascal] set envirom variable with pascal in linux
To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
Message-ID: <1125434233.7988.1.camel at localhost.localdomain>
Content-Type: text/plain; charset=ISO-8859-1

Thanks, is the only think that I probe and runs ok!!!

****
program shell2;

uses baseunix, sysutils;
begin
    writeln('glx-config Version:',fpGetenv('SDL_VER'));
end.
****

export SDL_VER=`sdl-config --version`; ./shell2
glx-config Version:1.2.8

Note. I have put the clause EXPORT because I'm using bash.

I don't probe tu use the other method that other person has posted than
use a call to glibc, perhaps it's the largest walk.

Another one, has mentioned than FreePascal(FP) gives an enviroment in
read-only, I have read that the environ is an array of list of var's
with values, and I'dont know why FP (I love it) cannot write in this
array, perhaps do not implement yet.

Thank's eveybody, and regards.



El mar, 30-08-2005 a las 14:53 +0200, Marc Santhoff escribió:
> Am Dienstag, den 30.08.2005, 08:47 +0200 schrieb mondrillo:
> > Hello list,
> >
> > In Bach, Perl, can do set SDL_VER=`sdl-config --version`
> > and in enviroment has the variable SDL_VER=1.2.3 for example.
> > echo $SDL_VER
> > 1.2.3
> > But in Pascal non have the setenv() procedure as in C :(
> >
> > Actualy I resolve this problem with sending the output to a file, and
> > then reading the file. But, can I pass from C this function?, or call
> > a libc (thinks is this lib that has setenv() ) from Pascal to execute
> > setenv().
> >
>
> If you're using a command line to execute a foreign program you can
> always tell the shell:
>
> csh: "setenv VAR value; your-foreign-program"
> sh:  "VAR=value; your-foreign-program"
>
> Not portable, ugly workaround, but it does do the job.
>
> HTH,
> Marc
>
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal



------------------------------

Message: 6
Date: Wed, 31 Aug 2005 08:26:40 +0200
From: mondrillo <mondrillo at terra.es>
Subject: Re: [fpc-pascal] set envirom variable with pascal in linux
To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
Message-ID: <1125469600.7988.2.camel at localhost.localdomain>
Content-Type: text/plain; charset=ISO-8859-1

Thank's for the page

El mar, 30-08-2005 a las 12:16 +0200, Alain Vitry escribió:
> FYI, see
> http://alain.vitry.free.fr/en/devel/devel-pascal.php
>
> Le 30 août 05, à 08:47, mondrillo a écrit :
>
> > Hello list,
> >
> > In Bach, Perl, can do set SDL_VER=`sdl-config --version`
> > and in enviroment has the variable SDL_VER=1.2.3 for example.
> > echo $SDL_VER
> > 1.2.3
> > But in Pascal non have the setenv() procedure as in C :(
> >
> > Actualy I resolve this problem with sending the output to a file, and
> > then reading the file. But, can I pass from C this function?, or call
> > a libc (thinks is this lib that has setenv() ) from Pascal to execute
> > setenv().
> >
> > Thank's and regards.
> >
> >
> > _______________________________________________
> > fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> >
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal



------------------------------

Message: 7
Date: Wed, 31 Aug 2005 08:34:42 +0200
From: mondrillo <mondrillo at terra.es>
Subject: [fpc-pascal] Re: set envirom variable with pascal in linux
To: Jeff Pohlmeyer <yetanothergeek at gmail.com>
Cc: fpc-pascal at lists.freepascal.org
Message-ID: <1125470082.7988.7.camel at localhost.localdomain>
Content-Type: text/plain; charset=ISO-8859-1

Thank's for the response, perhaps it's my arch ( amd64 ) and compiler
2.0.0, but when I  execute this code say :

./sdlver
1.5426178.-248

if I execute `$sdl-config --version` output is not the same :(
1.2.8


El mar, 30-08-2005 a las 08:23 -0500, Jeff Pohlmeyer escribió:
>
> > In Bach, Perl, can do set SDL_VER=`sdl-config --version`
> > But in Pascal non have the setenv() procedure as in C :(
> > ...
> > Actualy I resolve this problem with sending the output to a file,
> and
> > then reading the file.
>
> It sounds to me like you just want a global
> variable, not an environment variable.
>
> Maybe something like this?
>
> (************************************)
> program sdlver;
>
> uses libc;
>
> type
>   SDL_version = record
>     major : byte;
>     minor : byte;
>     patch : byte;
>   end;
>   pSDL_version = ^SDL_version;
>
> function SDL_Linked_Version:pSDL_version; cdecl; external 'SDL';
>
> var
>   SDL_VER:array[0..15] of char;
>
> begin
>   with SDL_Linked_Version^ do sprintf(SDL_VER, '%d.%d.%d', [major,
> minor, patch]);
>   WriteLn(SDL_VER);
> end.
> (************************************)
>
>
> Regards,
>  - Jeff
>



------------------------------

_______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


End of fpc-pascal Digest, Vol 12, Issue 28
******************************************


__________ Informacia od NOD32 1.1205 (20050830) __________

Tato sprava bola preverena antivirusovym systemom NOD32.
http://www.eset.sk






More information about the fpc-pascal mailing list