Re: [fpc-pascal] fpc has trouble with array types

2011-10-18 Thread Felipe Monteiro de Carvalho
On Tue, Oct 18, 2011 at 5:47 AM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: function XlatPrime () : array of byte; begin XlatPrime := ( $64, $73, $66, $64, $3b, $6b, $66, $6f, I think that a syntax similar to this is available only for constant initialization. Actually I remember it

Re: [fpc-pascal] How can I implement thrice in Free Pascal?

2011-10-18 Thread Vladimir Zhirov
Andrew Pennebaker wrote: thrice :: a - [a] thrice x = [x, x, x] I know the answer involves generics, but the docs don't offer examples using Free Pascal's built-in generic types. The solution would require generic functions, these are implemented in FPC trunk only. In the latest release

Re: [fpc-pascal] Delphi's anonymous functions in Free Pascal

2011-10-18 Thread Sven Barth
Am 17.10.2011 22:53, schrieb Andrew Pennebaker: Does Free Pascal have anonymous functions that you can pass around, e.g. to a sort(compare : function, arr : array) function? If not, does anyone know any hacks to accomplish this? No, FPC does not support this currently and I know no one who

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-18 Thread Lukasz Sokol
On 17/10/2011 21:53, Andrew Pennebaker wrote: Does Free Pascal have anonymous functions that you can pass around, e.g. to a sort(compare : function, arr : array) function? If not, does anyone know any hacks to accomplish this? Cheers, Andrew Pennebaker www.yellosoft.us

Re: [fpc-pascal] fpc has trouble with array types

2011-10-18 Thread Sven Barth
Am 18.10.2011 05:47, schrieb Andrew Pennebaker: But, but, the docs imply that this is the syntax for a function that returns an array of bytes. [snip] function XlatPrime () : array of byte; begin XlatPrime := ( $64, $73, $66, $64, $3b, $6b, $66, $6f, $41, $2c, $2e, $69, $79, $65, $77, $72,

Re: [fpc-pascal] How can I implement thrice in Free Pascal?

2011-10-18 Thread Sven Barth
Am 18.10.2011 10:52, schrieb Vladimir Zhirov: The solution would require generic functions, these are implemented in FPC trunk only. Generic functions are NOT implemented in trunk (at least as far as I know...). Regards, Sven ___ fpc-pascal

Re: [fpc-pascal] fpc has trouble with array types

2011-10-18 Thread Sven Barth
Am 18.10.2011 11:12, schrieb Sven Barth: type TByteArray = array of Byte; function XlatPrime(): TByteArray; begin XlatPrime := TByteArray.Create( $64, $73, $66, $64, $3b, $6b, $66, $6f, $41, $2c, $2e, $69, $79, $65, $77, $72, $6b, $6c, $64, $4a, $4b, $44, $48, $53, $55, $42, $73, $67, $76, $63,

Re: [fpc-pascal] fpc has trouble with array types

2011-10-18 Thread Vincent Snijders
2011/10/18 Sven Barth pascaldra...@googlemail.com: Am 18.10.2011 11:12, schrieb Sven Barth: type TByteArray = array of Byte; function XlatPrime(): TByteArray; begin XlatPrime := TByteArray.Create( $64, $73, $66, $64, $3b, $6b, $66, $6f, $41, $2c, $2e, $69, $79, $65, $77, $72, $6b, $6c,

Re: [fpc-pascal] How can I implement thrice in Free Pascal?

2011-10-18 Thread Vladimir Zhirov
Sven Barth wrote: Generic functions are NOT implemented in trunk (at least as far as I know...). Ouch, sorry. I read about generic procedural types at New features trunk wiki page and thought it was what OP need. Andrew, I apologize for misinformation and thanks Sven for correcting me.

[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-18 Thread Lukasz Sokol
[...] (facepalm) I did not try 'anonymous' function as you asked, oh. Need to learn to read ;) L. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fpc has trouble with array types

2011-10-18 Thread Sven Barth
Am 18.10.2011 11:19, schrieb Vincent Snijders: 2011/10/18 Sven Barthpascaldra...@googlemail.com: Am 18.10.2011 11:12, schrieb Sven Barth: type TByteArray = array of Byte; function XlatPrime(): TByteArray; begin XlatPrime := TByteArray.Create( $64, $73, $66, $64, $3b, $6b, $66, $6f, $41, $2c,

[fpc-pascal] Re: fpweb and reading the contents of a request

2011-10-18 Thread herux
Try using Indy or Synapse as HttpClient to send data content using HTTP POST with the parameters as you mean. my FPWeb success to do it using PHP via CURL. I guess this is not a limitation of HTTP, just not the standard for web scripting - - -- View this message in context:

Re: [fpc-pascal] fpc has trouble with array types

2011-10-18 Thread Sven Barth
Am 18.10.2011 11:33, schrieb Sven Barth: Am 18.10.2011 11:19, schrieb Vincent Snijders: 2011/10/18 Sven Barthpascaldra...@googlemail.com: Am 18.10.2011 11:12, schrieb Sven Barth: type TByteArray = array of Byte; function XlatPrime(): TByteArray; begin XlatPrime := TByteArray.Create( $64,

Re: [fpc-pascal] Re: fpweb and reading the contents of a request

2011-10-18 Thread Sven Barth
Am 18.10.2011 11:35, schrieb herux: Try using Indy or Synapse as HttpClient to send data content using HTTP POST with the parameters as you mean. my FPWeb success to do it using PHP via CURL. I guess this is not a limitation of HTTP, just not the standard for web scripting One should at

Re: [fpc-pascal] Re: fpweb and reading the contents of a request

2011-10-18 Thread Felipe Monteiro de Carvalho
On Tue, Oct 18, 2011 at 11:35 AM, herux her...@gmail.com wrote: Try using Indy or Synapse as HttpClient to send data content  using HTTP POST with the parameters as you mean. my FPWeb success to do it using PHP via CURL. !? My problem was sending data from JavaScript to FPWeb, I fail to see

[fpc-pascal] CGI under Freepascal

2011-10-18 Thread Luciano de Souza
Hello listers, I am trying to use CGI with Pascal. I don't have background in web development, but principles of CGI seems to be simple. The first way could be FPWeb. However, I prefer another solution even if it is the best bet. It requires complex compilations and configurations since

Re: [fpc-pascal] CGI under Freepascal

2011-10-18 Thread Felipe Monteiro de Carvalho
I think that fpweb is the best option, since most people seam to be using it. But the wiki has an example about how to do a more simple CGI app: http://wiki.lazarus.freepascal.org/CGI_Web_Programming The provided minimal example teaches all the basics. -- Felipe Monteiro de Carvalho

Re: [fpc-pascal] CGI under Freepascal

2011-10-18 Thread Michael Van Canneyt
On Tue, 18 Oct 2011, Luciano de Souza wrote: Hello listers, I am trying to use CGI with Pascal. I don't have background in web development, but principles of CGI seems to be simple. [snip] The variety of projects under Freepascal is so big that I will be not surprised with other

[fpc-pascal] Getting Hardware information in Linux

2011-10-18 Thread ik
Hello list, I'm trying to figure out how to get hardware information about the machine i'm running at in Linux OS. For example: hard-drive size, manufacture etc... BIOS information, screen information (regardless of X, that is the hardware itself), cards that are assigned and the whole

Re: [fpc-pascal] fpc has trouble with array types

2011-10-18 Thread Andrew Pennebaker
RRUZhttp://stackoverflow.com/questions/7802319/whats-the-syntax-for-literal-arrays-in-free-pascalhas the answer: const XLAT_SIZE = 53; xlat : Array[0..XLAT_SIZE-1] of Integer = ( $64, $73, $66, $64, $3b, $6b, $66, $6f, $41, $2c, $2e, $69, $79, $65, $77, $72, $6b, $6c, $64, $4a, $4b, $44,

Re: [fpc-pascal] How can I implement thrice in Free Pascal?

2011-10-18 Thread Andrew Pennebaker
Thrice is designed to work for *any* array type, e.g. arrays of arrays of arrays of bytes. Even if I hardcoded several thousand possible types, Thrice wouldn't work for custom user types. If you do find a way to make this work, please let me know. Cheers, Andrew Pennebaker www.yellosoft.us On

Re: [fpc-pascal] How can I implement thrice in Free Pascal?

2011-10-18 Thread Andrew Pennebaker
In particular, if anyone knows a way to implement a general concatenation function Concat(Arr1, Arr2), let me know. Cheers, Andrew Pennebaker www.yellosoft.us On Tue, Oct 18, 2011 at 1:59 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: Thrice is designed to work for *any* array

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-18 Thread Andrew Pennebaker
Sokol, I'm writing a function GenArray(generator) that returns a random array populated by calling the generator function. So the return type of GenArray matches array of the return type of the generator function, for any generator function. E.g., GenArray(GenChar) would return a random string.

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-18 Thread Roland Schäfer
On 10/18/2011 8:10 PM, Andrew Pennebaker wrote: Sokol, I'm writing a function GenArray(generator) that returns a random array populated by calling the generator function. So the return type of GenArray matches array of the return type of the generator function, for any generator function.

Re: [fpc-pascal] How can I implement thrice in Free Pascal?

2011-10-18 Thread Jonas Maebe
On 18 Oct 2011, at 20:03, Andrew Pennebaker wrote: In particular, if anyone knows a way to implement a general concatenation function Concat(Arr1, Arr2), let me know. I'm under the impression that you are trying to program in a statically typed language the same way as you'd use a

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-18 Thread Alberto Narduzzi
anonimous types, thrice, generic array concatenation, interpreting Pascal, anonymous functions... I'm guessing what language you come from. Then, the second question arises: why Pascal, now. Anyway, I think that immersing yourself in some classes and pointer logic could help you find some

Re: [fpc-pascal] Getting Hardware information in Linux

2011-10-18 Thread Michael Van Canneyt
On Tue, 18 Oct 2011, ik wrote: Hello list, I'm trying to figure out how to get hardware information about the machine i'm running at in Linux OS. For example: hard-drive size, manufacture etc... BIOS information, screen information (regardless of X, that is the hardware itself), cards that

Re: [fpc-pascal] Getting Hardware information in Linux

2011-10-18 Thread ik
On Tue, Oct 18, 2011 at 21:44, Michael Van Canneyt mich...@freepascal.orgwrote: On Tue, 18 Oct 2011, ik wrote: Hello list, I'm trying to figure out how to get hardware information about the machine i'm running at in Linux OS. For example: hard-drive size, manufacture etc... BIOS

Re: [fpc-pascal] How can I implement thrice in Free Pascal?

2011-10-18 Thread Sven Barth
On 18.10.2011 21:30, Jonas Maebe wrote: On 18 Oct 2011, at 20:03, Andrew Pennebaker wrote: In particular, if anyone knows a way to implement a general concatenation function Concat(Arr1, Arr2), let me know. I'm under the impression that you are trying to program in a statically typed

Re: [fpc-pascal] Getting Hardware information in Linux

2011-10-18 Thread Sven Barth
On 18.10.2011 21:50, ik wrote: On Tue, Oct 18, 2011 at 21:44, Michael Van Canneyt mich...@freepascal.org mailto:mich...@freepascal.org wrote: On Tue, 18 Oct 2011, ik wrote: Hello list, I'm trying to figure out how to get hardware information about the machine i'm

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-10-18 Thread Andrew Pennebaker
Schäfer, thanks, that's a lot of practical information. Have you used Haskell QuickCheckhttp://www.haskell.org/haskellwiki/Introduction_to_QuickCheck? It's amazing that such a strictly typed language can do these sorts of things. Yes, pointers are probably the only way I can implement this, for

Re: [fpc-pascal] How can I implement thrice in Free Pascal?

2011-10-18 Thread Andrew Pennebaker
Barth, something's not quite right. I've compiled and installed the trunk version of fpc, but it won't recognize this syntax. paycheck.pas: unit Paycheck; interface type TArrayT = array of T; ... Trace: fpc example.pas Compiling example.pas Compiling paycheck.pas paycheck.pas(4,8) Fatal:

Re: [fpc-pascal] Getting Hardware information in Linux

2011-10-18 Thread Den Jean
On Tuesday 18 October 2011 19:36:48 ik wrote: Does anyone know or can point me on how to do it ? read the output of lshw or read its source on how to do it yourself. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Getting Hardware information in Linux

2011-10-18 Thread Jorge Aldo G. de F. Junior
I think all this info can be found on /proc directory... 2011/10/18 ik ido...@gmail.com: Hello list, I'm trying to figure out how to get hardware information about the machine i'm running at in Linux OS. For example: hard-drive size, manufacture etc... BIOS information, screen information