Re: [fpc-pascal] Best way to transfer data between applications?

2012-10-30 Thread Jorge Aldo G. de F. Junior
2012/10/30 印場 乃亜 :
> Hi,
>
> Wow, Class Factories - I am having nightmarish flashbacks to my college C++ 
> classes.
>
> Okay, Thank you for all of the suggestions.  I will try to compare the 
> suggestions, and see what I can come up with for my situation.
> Just for further information:
> 1. I wasn't really planning on using the network, so using something that has 
> to pack/unpack the data from FPC to other
formats might be overkill.

For the data delivery part, you can use TSimpleIPCServer/TSimpleIPCClient

> 2. I am happy to pass records, Objects aren't really necessary.  (If you pass 
> an object in binary, the internal pointers would be referencing the old copy 
> anyway).
>

The problem with records is that the data sending/receiving function
must know the record structure in advance, or use a very inflexible
record strucuture (one size fits all), or use a much more complex
protocol with multiple entry points selected by a prefix byte or
something similar.

in the end of the day, classes tends to be simpler to pass around.

Think about this :

Class TA has a property named pname, another property named pvalue.

Instance A is an instance of TA.
Instance B is an instance of TA.

Instance A has the property pname set to 'somename'
Instance A has the property pvalue set to 10

Instance B has the property pname set to 'somename'
Instance B has the property pvalue set to 10

Is A=B ?

If you simply look at the pointer (classes are internally pointers to
data structures in memory), then no, they are different.

But if you look at the values, then they are the same.

What i want to mean ?

If you can, using some IPC/whatever, make a new instance on the other
application, of the same class, with the same values, then (for a very
wide interpretation of the meaning of transporting) you transported
the class from one application to another...even if they are not
exactly the same instance...

that means that you dont need shared memory nor any fancy trick, just
a simple protocol like

   ... 

where classname is used as an index on a class factory and
property1values are used to set the class properties

will do the trick.

(There are some languages that can LITERALLY transfer an instance
between two applications, but Pascal cant due to being statically
typed).

> I was actually considering using the GUI messaging system like exists in 
> Windows, but:
> 1. It doesn't really exists on non-windows systems (I read some about one 
> being created for Lazarus on Linux)

TSimpleIPCServer/TSimpleIPCClient is portable across all FPC targets.

> 2. I seem to recall that it only allowed passing relatively simple messages.  
> I thought perhaps I could use shared memory and then send a message telling 
> the client application to read the record.

Shared memory is usefull when you need to transfer large blocks of
data fast between two instances. I believe pipes are simpler for
simpler tasks (And thats what TSimpleIPCServer/TSimpleIPCClient use).

TSimpleIPCServer/Client are standard components being part of the FCL.
(Freepascal component library). At least they come standard with the
compiler.

>
> Maybe once I examine all the options, I will make a FAQ ;)
>
> Thank you,
>Noah Silva
>
> On 2012/10/30, at 13:37, "Jorge Aldo G. de F. Junior"  
> wrote:
>
>> Ah, and you will need a class factory to register the tpersistent
>> class creators...
>>
>> And i said my unit is neater ?
>>
>> here it is :
>>
>> http://code.google.com/p/pascal-actor-model/source/browse/trunk/rttiobjects.pas
>>
>> I use it on a lot of things...
>>
>> All you need is to declare published properties that you want streamed
>> and use TRTTIObject.SaveRTTIToStream.
>>
>> It will save on a binary format where the first string is the class
>> name. You should have a class factory on the other side that registers
>> all classes that can be exchanged between applications.
>>
>> Pascal being statically typed (and binary creating instead of bytecode
>> creating) means that you cannot "slurp" an object from one application
>> to another (IE.: Stream an unknown object around).
>>
>> Each class should be know in advance by both applications.
>>
>> 2012/10/30 Jorge Aldo G. de F. Junior :
>>> Simple solution :
>>>
>>> Use TSimpleIPC components + my own RTTIObjects unit.
>>>
>>> All messages must be descendants of TRTTIObject. (You can use
>>> TPersistent, but i believe my unit is neater for this specific task).
>>>
>>> Well, using only standard components i believe you should use
>>> TSimpleIPC components + TPersistent classes
>>>
>>> All you need is a way to stream the TPersistent into a string or
>>> stream then pass that resulting string/stream to the simple ipc
>>> components.
>>>
>>> That will do what you are asking, without much fuss...
>>>
>>> 2012/10/30 印場 乃亜 :
 Hi,

 I read about MSGPACK before, but it seems to be a binary version of JSON, 
 right?
 I actually don't care about the protocol much (and since it's local, 
 Binary v

Re: [fpc-pascal] Using flag field in Getopts

2012-10-30 Thread Henry Vermaak
On 30/10/12 10:05, luciano de souza wrote:
> Hello listers,
> Getopts offers very good features to process commandline arguments. As
> far as I could understand, I used it successfully. But it remains one
> unknown aspect for me. What is the field "flag"" of TOption record?
> How to use it?
> 
>   TOption = Record
> Name: String;
> Has_arg : Integer;
> Flag: PChar;
> Value   : Char;
>   end;

I think the man page for getopt explains best how this is supposed to work:

flag specifies how results are returned for a long option.  If flag is
NULL, then getopt_long() returns val.  (For example, the calling program
may set val to the equivalent short option character.)  Otherwise,
getopt_long() returns 0, and flag points to a variable which is set to
val if the option is found, but left unchanged if the option is not found.

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


[fpc-pascal] Two and one compliment converting functions

2012-10-30 Thread ik
Hello,

Does FPC contain any functions to convert between One Compliment
(http://en.wikipedia.org/wiki/Ones%27_complement)
to Two Compliment (http://en.wikipedia.org/wiki/Two%27s_complement)
and vice versa ?

I ask this before I'll implement it on my own :)

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


Re: [fpc-pascal] OT: Creating a site to contain Pascal units, libraries etc

2012-10-30 Thread ik
On Tue, Oct 30, 2012 at 2:29 AM, Jeppe Græsdal Johansen
 wrote:
> Den 30-10-2012 01:04, ik skrev:
>>
>> Hello,
>>
>> There are many places such as GitHub, Google Code, Sourceforge etc,
>> that hosts a lot of open source projects, libraries etc for
>> FPC/Pascal.
>> On the other hand we have fppkg that can have repositories and able to
>> allow us remote download and install of code.
>>
>> Ruby has the following web site that allow you to find and have a
>> single place to install such things:
>> https://rubygems.org/
>>
>> I think that web site like this, with the ability to add fppkg sources
>> that other can look for and install will benefit everyone, reduce
>> duplicate work, and
>> help us find Pascal tools :)
>>
>> What do you think ?
>>
>> Ido
>>
>> * I sent it originally for FPC-Others, but it does not appear there
>> even in the archive
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
> I like the idea, but who can make such a site?
>
> There are many different more or less dormant or noisy pages around the net
> sometimes with sourcecode, but much of the time dead links. And when you
> finally end up those places things are locked into broad categories with
> 1000's of entries to wade through. And there's no way to measure how good
> the stuff actually is except for downloading it and looking at it, finding
> out when it was last updated, licenses, supportt, etc.
>
> Some ideas:
> - Allow limited hosting of open-source text source files(they compress well
> so it doesn't take up much hosting space).
> - Allow projects to be tagged with arbitrary tags instead of having
> categories, and let users vote tags up or down.
> - Require basic information which can be easily presented: Source license,
> tested+supported platforms, external requirements, contact information, etc.
> - If the project dies then allow users to specify new locations that
> eventual forked source can be found at.
>

My idea is more about finding tools then to host them.
fppkg allow us to create packages to be installed from remote, and
also look for such things.
So why not harness it to the point that we can find libraries and
tools at one place, regardless of the place the code actually hosts ?

> Regards,
> Jeppe
>
> ___
> 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] OT: Creating a site to contain Pascal units, libraries etc

2012-10-30 Thread Tomas Hajny
On Tue, October 30, 2012 12:49, ik wrote:
> On Tue, Oct 30, 2012 at 2:29 AM, Jeppe GrĂŚsdal Johansen
>  wrote:
>> Den 30-10-2012 01:04, ik skrev:
>>>
>>> Hello,
>>>
>>> There are many places such as GitHub, Google Code, Sourceforge etc,
>>> that hosts a lot of open source projects, libraries etc for
>>> FPC/Pascal.
>>> On the other hand we have fppkg that can have repositories and able to
>>> allow us remote download and install of code.
>>>
>>> Ruby has the following web site that allow you to find and have a
>>> single place to install such things:
>>> https://rubygems.org/
>>>
>>> I think that web site like this, with the ability to add fppkg sources
>>> that other can look for and install will benefit everyone, reduce
>>> duplicate work, and
>>> help us find Pascal tools :)
>>>
>>> What do you think ?
>>>
>>> Ido
>>>
>>> * I sent it originally for FPC-Others, but it does not appear there
>>> even in the archive
>>> ___
>>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>> I like the idea, but who can make such a site?
>>
>> There are many different more or less dormant or noisy pages around the
>> net
>> sometimes with sourcecode, but much of the time dead links. And when you
>> finally end up those places things are locked into broad categories with
>> 1000's of entries to wade through. And there's no way to measure how
>> good
>> the stuff actually is except for downloading it and looking at it,
>> finding
>> out when it was last updated, licenses, supportt, etc.
>>
>> Some ideas:
>> - Allow limited hosting of open-source text source files(they compress
>> well
>> so it doesn't take up much hosting space).
>> - Allow projects to be tagged with arbitrary tags instead of having
>> categories, and let users vote tags up or down.
>> - Require basic information which can be easily presented: Source
>> license,
>> tested+supported platforms, external requirements, contact information,
>> etc.
>> - If the project dies then allow users to specify new locations that
>> eventual forked source can be found at.
>>
>
> My idea is more about finding tools then to host them.
> fppkg allow us to create packages to be installed from remote, and
> also look for such things.
> So why not harness it to the point that we can find libraries and
> tools at one place, regardless of the place the code actually hosts ?

In my experience, one should first thing about how it should work and only
then about tools which may help rather than vice versa. In this case, the
important point is management of the content (e.g. references to the
external repositories and associated metadata providing information about
the referenced content).

Tomas


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


Re: [fpc-pascal] Best way to transfer data between applications?

2012-10-30 Thread 印場 乃亜
Hi,

Wow I am surprised this is continuing so long - I take it other people have 
interest in the subject too.

On 2012/10/30, at 17:08, "Jorge Aldo G. de F. Junior"  wrote:

> 2012/10/30 印場 乃亜 :
>> Hi,
>> 
>> Wow, Class Factories - I am having nightmarish flashbacks to my college C++ 
>> classes.
>> 
>> Okay, Thank you for all of the suggestions.  I will try to compare the 
>> suggestions, and see what I can come up with for my situation.
>> Just for further information:
>> 1. I wasn't really planning on using the network, so using something that 
>> has to pack/unpack the data from FPC to other
> formats might be overkill.
> 
> For the data delivery part, you can use TSimpleIPCServer/TSimpleIPCClient

Which is what I have been doing so far - though I had to look into the 
implementation and use lower level calls in some cases to stop the app from 
blocking on reading - at least on OS X.  (It would sometimes think there was 
data waiting, and try to read it, which would freeze the app).  Also I have 
mainly been using CSV.  It doesn't seem easily possible to have multiple 
clients hook to a single server either - though maybe I am missing something.
> 
>> 2. I am happy to pass records, Objects aren't really necessary.  (If you 
>> pass an object in binary, the internal pointers would be referencing the old 
>> copy anyway).
>> 
> 
> The problem with records is that the data sending/receiving function
> must know the record structure in advance, or use a very inflexible
> record strucuture (one size fits all), or use a much more complex
> protocol with multiple entry points selected by a prefix byte or
> something similar.
> 
I think that last one if what the debug server protocol does.

> in the end of the day, classes tends to be simpler to pass around.
> 
wow... but if you pass a class, then the VMT, etc. needs to be re-done somehow. 
 (i.e. the new copy needs to be actually instantiated, the constructor re-run, 
etc.).

> Think about this :
> 
> Class TA has a property named pname, another property named pvalue.
> 
> Instance A is an instance of TA.
> Instance B is an instance of TA.
> 
> Instance A has the property pname set to 'somename'
> Instance A has the property pvalue set to 10
> 
> Instance B has the property pname set to 'somename'
> Instance B has the property pvalue set to 10
> 
> Is A=B ?

By my definition, yes, but not by pointer logic.  (Unless the language does 
some fancy COW stuff).
> 
> If you simply look at the pointer (classes are internally pointers to
> data structures in memory), then no, they are different.
> 
> But if you look at the values, then they are the same.
> 
> What i want to mean ?
> 
> If you can, using some IPC/whatever, make a new instance on the other
> application, of the same class, with the same values, then (for a very
> wide interpretation of the meaning of transporting) you transported
> the class from one application to another...even if they are not
> exactly the same instance...
> 

Right, if you can easily do this.

> that means that you dont need shared memory nor any fancy trick, just
> a simple protocol like
> 
>... 
> 
> where classname is used as an index on a class factory and
> property1values are used to set the class properties
> 
> will do the trick.
> 
> (There are some languages that can LITERALLY transfer an instance
> between two applications, but Pascal cant due to being statically
> typed).
> 

Well, it could with some compiler magic I think, if both sides had access to 
the same type.  Actually, I suppose it would be more RTL magic than compiler 
magic, I suppose.  The types are known at compile time (plus there is RTTI), so 
if the applications shared a common type library, it should seemingly be 
possible.  Of course this approach would be relatively brittle since if 
anything changed about the type in one place, everything would have to be 
recompiled with the same change.  Not much different from linking, I suppose.

>> I was actually considering using the GUI messaging system like exists in 
>> Windows, but:
>> 1. It doesn't really exists on non-windows systems (I read some about one 
>> being created for Lazarus on Linux)
> 
> TSimpleIPCServer/TSimpleIPCClient is portable across all FPC targets.

Supposedly, but see above.  
> 
>> 2. I seem to recall that it only allowed passing relatively simple messages. 
>>  I thought perhaps I could use shared memory and then send a message telling 
>> the client application to read the record.
> 
> Shared memory is usefull when you need to transfer large blocks of
> data fast between two instances. I believe pipes are simpler for
> simpler tasks (And thats what TSimpleIPCServer/TSimpleIPCClient use).

Right, and I am talking about relatively small amounts of data, not movies or 
something.  The reason I thought of SHM is that there would be no need to 
decode the structure into a string and re-encode it, etc.  Instead, the 
application could somehow pass a message and a pointer.  The rece

Re: [fpc-pascal] Re: problems compiling FPC

2012-10-30 Thread Jonas Maebe


On 17 Oct 2012, at 16:52, Marco van de Voort wrote:


New text:

D:\repo\fpc>make all
makefile:2717: *** The only supported starting compiler version is  
2.6.0.
You are trying to build with 2.7.1. If you are absolutely sure that  
the current
compiler is built from the exact same version/revision, you can try  
to use

OVERRIDEVERSIONCHECK=1 to override .  Stop.


And as the core developers saw today, even that is not clear enough  
apparently: http://bugs.freepascal.org/view.php?id=23245 (that person  
even manually edited the makefile and replaced the 2.6.0 with 2.7.1  
trying to get around the check).



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

Re: [fpc-pascal] Re: problems compiling FPC

2012-10-30 Thread Mattias Gaertner

Jonas Maebe  hat am 30. Oktober 2012 um 14:44
geschrieben:

>  On 17 Oct 2012, at 16:52, Marco van de Voort wrote:
>
>
>  > > New text:
> >
> >  D:\repo\fpc>make all
> >  makefile:2717: *** The only supported starting compiler version is
> > 2.6.0.
> >  You are trying to build with 2.7.1. If you are absolutely sure that the
> > current
> >  compiler is built from the exact same version/revision, you can try to
> > use
> >  OVERRIDEVERSIONCHECK=1 to override .  Stop.
> >
> >  >
>  And as the core developers saw today, even that is not clear enough
> apparently:  http://bugs.freepascal.org/view.php?id=23245
>  (that person even manually
> edited the makefile and replaced the 2.6.0 with 2.7.1 trying to get around the
> check).


Rich Cook
"Programming today is a race between software engineers striving to build bigger
and better idiot-proof programs, and the Universe trying to produce bigger and
better idiots. So far, the Universe is winning."


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


[fpc-pascal] Range check error while evaluating constants

2012-10-30 Thread ik
Hello,

I have the following function:

function OneToTwoComplement(AValue: QWord): QWord;
begin
  Result := (AValue xor $) + 1;
end;

What am I missing here that makes the compiler complain about "Range
check error while evaluating constants" ?
Why doesn't it complain on :

function OneToTwoComplement(AValue: Int64): Int64;
begin
  Result := (Abs(AValue) xor $) + 1;
end;


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


Re: [fpc-pascal] Re: problems compiling FPC

2012-10-30 Thread Henry Vermaak
On 30/10/12 14:04, Mattias Gaertner wrote:
> Rich Cook
> "Programming today is a race between software engineers striving to build 
> bigger
> and better idiot-proof programs, and the Universe trying to produce bigger and
> better idiots. So far, the Universe is winning."

Ah, you beat me to it :)

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


Re: [fpc-pascal] Re: problems compiling FPC

2012-10-30 Thread Graeme Geldenhuys
On 2012-10-30 14:04, Mattias Gaertner wrote:
>>  (that person even manually
>> edited the makefile and replaced the 2.6.0 with 2.7.1 trying to get around 
>> the
>> check).


Oh my f#*k!


> "Programming today is a race between software engineers striving to build 
> bigger
> and better idiot-proof programs, and the Universe trying to produce bigger and
> better idiots. So far, the Universe is winning."

+1000


G.


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


Re: [fpc-pascal] Re: problems compiling FPC

2012-10-30 Thread Mark Morgan Lloyd

Mattias Gaertner wrote:

Jonas Maebe  hat am 30. Oktober 2012 um 14:44
geschrieben:


 On 17 Oct 2012, at 16:52, Marco van de Voort wrote:


 > > New text:

 D:\repo\fpc>make all
 makefile:2717: *** The only supported starting compiler version is
2.6.0.
 You are trying to build with 2.7.1. If you are absolutely sure that the
current
 compiler is built from the exact same version/revision, you can try to
use
 OVERRIDEVERSIONCHECK=1 to override .  Stop.

 >

 And as the core developers saw today, even that is not clear enough
apparently:  http://bugs.freepascal.org/view.php?id=23245
 (that person even manually
edited the makefile and replaced the 2.6.0 with 2.7.1 trying to get around the
check).


I really don't like making this comment, but looking at the bug report 
(and checking the current Makefile)


> You try to build with 2.6.1.

That could very easily be misread as "You should try to build with 
2.6.1", correct idiomatic English would be "You are trying to build with 
2.6.1.", or to rub their nose in it "You are trying to build with 2.6.1, 
which is not supported.".


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: Range check error while evaluating constants

2012-10-30 Thread ik
On Tue, Oct 30, 2012 at 4:26 PM, ik  wrote:
> Hello,
>
> I have the following function:
>
> function OneToTwoComplement(AValue: QWord): QWord;
> begin
>   Result := (AValue xor $) + 1;
> end;
>
> What am I missing here that makes the compiler complain about "Range
> check error while evaluating constants" ?
> Why doesn't it complain on :
>
> function OneToTwoComplement(AValue: Int64): Int64;
> begin
>   Result := (Abs(AValue) xor $) + 1;
> end;
>
>
> Thanks,
> Ido

How I love to be completely ignored
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Best way to transfer data between applications?

2012-10-30 Thread Ewald
On 10/30/2012 02:34 PM, $B0u>l(B $BG50!(B wrote:
> Right, and I am talking about relatively small amounts of data, not movies or 
> something.  The reason I thought of SHM is that there would be no need to 
> decode the structure into a string and re-encode it, etc.  Instead, the 
> application could somehow pass a message and a pointer.  The receiving 
> application then takes over management of that record (or whatever), and the 
> sending application forgets about it (and allocates a new one next time it 
> needs to send something).  
This wouldn't work. You cannot pass a pointer to process A that
references memory of process B. You would receive signal 11 (SIGSEGV).
You could of course copy the block of memory (the object you're trying
to transfer) into shared memory, which you then can access from both
programs, but then I do not see the use of a message with a pointer
(just start the object at offset 0 in the shared memory block).

Either way, this approach wouldn't be `safe`, as any pointer contained
into the object/record/ also needs te be
re-allocated in the shared memory block. Thus strings and dynamic arrays
would provide for quite a royal pain in the arse to `share` them.

Encoding the object solves this problem. This does not mean that the
data cannot be in binary form however (-> no need for IntToStr and vice
versa!). All integers/floats can still be stored in identical the same
way (i.e. 1/2/4/8 bytes fixed length), and need not be encoded/decoded
in any way, they just need to be copied over from the buffer to the
appropriate location. Strings can easlly be stored as an integer (the
length field), followed by the data of the string itself; just as
dynamic arrays.

Thus if you have a class which contains a number and a string, you would
encode it something like this (think as if you're saving to a file, but
do not optimize for size):


The type field is obviously needed for constructing the right class.
Note that this type cannot be a `class of ` type, as this is in
essence also a pointer (to the VMT if I recall correctly). Then, as
Jorge mentioned you only need to provide a neat little factory that
`converts` these buffers to classes with which you can just continue in
the usual OOP way.

Hope this helps.

-- 
Ewald

Events don't necessarily happen in chronological order; yet somehow they do 
persist to happen. Sometime.

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


Re: [fpc-pascal] Re: Range check error while evaluating constants

2012-10-30 Thread geneb

On Tue, 30 Oct 2012, ik wrote:


On Tue, Oct 30, 2012 at 4:26 PM, ik  wrote:

Hello,

I have the following function:

function OneToTwoComplement(AValue: QWord): QWord;
begin
  Result := (AValue xor $) + 1;
end;

What am I missing here that makes the compiler complain about "Range
check error while evaluating constants" ?
Why doesn't it complain on :

function OneToTwoComplement(AValue: Int64): Int64;
begin
  Result := (Abs(AValue) xor $) + 1;
end;


Thanks,
Ido


How I love to be completely ignored


That's good, because we love ignoring you.

g.
--
Proud owner of F-15C 80-0007
http://www.f15sim.com - The only one of its kind.
http://www.diy-cockpits.org/coll - Go Collimated or Go Home.
Some people collect things for a hobby.  Geeks collect hobbies.

ScarletDME - The red hot Data Management Environment
A Multi-Value database for the masses, not the classes.
http://www.scarletdme.org - Get it _today_!
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error while evaluating constants

2012-10-30 Thread Peter

On 30/10/12 14:26, ik wrote:

Hello,

I have the following function:

function OneToTwoComplement(AValue: QWord): QWord;
begin
   Result := (AValue xor $) + 1;
end;

What am I missing here that makes the compiler complain about "Range
check error while evaluating constants" ?
Why doesn't it complain on :

function OneToTwoComplement(AValue: Int64): Int64;
begin
   Result := (Abs(AValue) xor $) + 1;
end;


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



See http://mantis.freepascal.org/view.php?id=21284

You need something like

function OneToTwoComplement(AValue: QWord): QWord;
begin
  Result := (AValue xor Qword($)) + 1;
end;




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

Re: [fpc-pascal] Best way to transfer data between applications?

2012-10-30 Thread Alberto Narduzzi

I am familiar with the basic underlying methods available for transferring data 
between processes on Windows and Unix, i.e. Pipes, Shared memory, and TCP/IP - 
but what I am not familiar with is any higher level functionality that may be 
available on FPC.


If I'd do something in this scope, I'd adopt either a D-BUS technique - 
no worries about maintaining -, or go the easy way with shared memory - 
again no worries, you'll be the maintainer... ;-).


Just my 2c on it.

Cheers, A.

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


Re: [fpc-pascal] Range check error while evaluating constants

2012-10-30 Thread Mark Morgan Lloyd

ik wrote:

Hello,

I have the following function:

function OneToTwoComplement(AValue: QWord): QWord;
begin
  Result := (AValue xor $) + 1;
end;

What am I missing here that makes the compiler complain about "Range
check error while evaluating constants" ?
Why doesn't it complain on :

function OneToTwoComplement(AValue: Int64): Int64;
begin
  Result := (Abs(AValue) xor $) + 1;
end;


What happens in the first case if you cast that constant to a QWord?

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: problems compiling FPC

2012-10-30 Thread Sven Barth

On 30.10.2012 16:00, Mark Morgan Lloyd wrote:

Mattias Gaertner wrote:

Jonas Maebe  hat am 30. Oktober 2012 um 14:44
geschrieben:


 On 17 Oct 2012, at 16:52, Marco van de Voort wrote:


 > > New text:

 D:\repo\fpc>make all
 makefile:2717: *** The only supported starting compiler version is
2.6.0.
 You are trying to build with 2.7.1. If you are absolutely sure
that the
current
 compiler is built from the exact same version/revision, you can
try to
use
 OVERRIDEVERSIONCHECK=1 to override .  Stop.

 >

 And as the core developers saw today, even that is not clear enough
apparently:  http://bugs.freepascal.org/view.php?id=23245
 (that person even
manually
edited the makefile and replaced the 2.6.0 with 2.7.1 trying to get
around the
check).


I really don't like making this comment, but looking at the bug report
(and checking the current Makefile)

 > You try to build with 2.6.1.

That could very easily be misread as "You should try to build with
2.6.1", correct idiomatic English would be "You are trying to build with
2.6.1.", or to rub their nose in it "You are trying to build with 2.6.1,
which is not supported.".



The whole purpose of the check was to "rub their nose in it"... but if 
people try to circumvent the check by editing the Makefile (and not even 
reading the message correctly to know how to circumvent it correctly) 
and THEN even raising a bug report about this then what can help?!


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


Re: [fpc-pascal] Range check error while evaluating constants

2012-10-30 Thread ik
On Tue, Oct 30, 2012 at 10:10 PM, Mark Morgan Lloyd
 wrote:
> ik wrote:
>>
>> Hello,
>>
>> I have the following function:
>>
>> function OneToTwoComplement(AValue: QWord): QWord;
>> begin
>>   Result := (AValue xor $) + 1;
>> end;
>>
>> What am I missing here that makes the compiler complain about "Range
>> check error while evaluating constants" ?
>> Why doesn't it complain on :
>>
>> function OneToTwoComplement(AValue: Int64): Int64;
>> begin
>>   Result := (Abs(AValue) xor $) + 1;
>> end;
>
>
> What happens in the first case if you cast that constant to a QWord?

The compiler stop reporting warnings

>
> --
> Mark Morgan Lloyd
> markMLl .AT. telemetry.co .DOT. uk
>
> [Opinions above are the author's, not those of his employers or colleagues]
>
> ___
> 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] OT: Creating a site to contain Pascal units, libraries etc

2012-10-30 Thread waldo kitty

On 10/29/2012 20:04, ik wrote:

* I sent it originally for FPC-Others, but it does not appear there
even in the archive


FWIW: it showed up here in fpc-other when you first posted it...
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal