[fpc-pascal] Memcached interface for FPC available already?
Hi, Is somebody aware of an fpc interface for the memcached protocol? (See http://memcached.org/) As there seem to be some projects using fpc to provide web content and memcached seems to be one of the more important techniques used on bigger websites there may already be someone who wrote some interface for fpc. I did give it a try myself implementing the plain text protocol using the LNet TLTcp class which seems to work fine. I already implemented the main protocol functions. Also gave the binary protocol a try, but there I'm having trouble with sending the variable length body data. As LNet seems to be a 'web' project itself it may be a nice idea to add a MemcachedClient unit. Before offering this project my amateuristic attempt I'd like to know if and how others did the job. Mark ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Fwd: Delphi incompatible conditionals?
Hi, I'm trying to add following conditional code to the top of a unit that should compile in fpc and in delphi: {$IFDEF FPC} {$IFNDEF ver1} {$IF (fpc_version>2) or (fpc_version=2) and (fpc_release>3)} {$info FPC version >= 2.4.0 : Should work} {$ELSE} {$warning FPC versions below 2.4 are not supported. However : give it a try, you never know.} {$IFEND} {$ELSE} {$fatal FPC version 1 isn't supported at all} {$ENDIF} {$ENDIF} This seems to work well in fpc, however the delphi (7 and 2009) compiler complains on the {$IF ...} line. [DCC Error] Zeos.inc(49): E2026 Constant expression expected Replacing the {$IF ...} line by {$IF Defined(fpc_version) and ((fpc_version>2) or (fpc_version=2) and (fpc_release>3))} seems to solve the previous problem, however then the compiler outputs this warning 4 times for every occurence of this code: [DCC Warning] Zeos.inc(49): W1023 Comparing signed and unsigned types - widened both operands Because I want to use this code in an include file for every unit in the project this becomes very messy. And it's a weird behaviour, because it's all within an {$IFDEF FPC} construct. Why does delphi even try to interprete it? Somebody knows how to avoid the problem? Mark ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: Delphi incompatible conditionals?
> From: "Juha Manninen (gmail)" > To: "FPC-Pascal users discussions" > Date: Fri, 1 Oct 2010 20:04:18 +0300 > Subject: Re: [fpc-pascal] Fwd: Delphi incompatible conditionals? > On Friday 01 October 2010 19:33:48 Mark Daems wrote: >> ... >> And it's a weird behaviour, because it's all within an {$IFDEF FPC} >> construct. Why does delphi even try to interprete it? >> >> Somebody knows how to avoid the problem? > > Try this instead: > > {$IFNDEF FPC} > // Can be empty > {$ELSE} > ... > {$ENDIF} > > I got feedback for the Delphi converter in Lazarus about this same problem. > Now the converter always adds IFNDEF instead of IFDEF to the code. > > Juha Sorry Juha, This doesn't help at all. Delphi keeps trying to interprete all {$IF ...} conditions in the file, even if it doesn't make sense because of surrounding conditions. > From: mar...@stack.nl (Marco van de Voort) > To: FPC-Pascal users discussions > Date: Fri, 1 Oct 2010 19:52:36 +0200 (CEST) > Subject: Re: [fpc-pascal] Fwd: Delphi incompatible conditionals? > In our previous episode, Mark Daems said: ... > Try longint(3) and longint(2). > How should I do that? The place where the file containing the conditions is included doesn't allow for defining constants as it's the very first line in the unit code. Even before the uses clause in the interface section. Actually the problem is Delphi doesn't find the constant definitions, so it's guessing the data type of fpc_version and fpc_release. > Still, it might be worth a report, otherwise stuff never gets fixed. And > that goes both for FPC and Delphi :-) This isn't an FPC bug at all. FPC handles this exactly as expected. Unless they invent some new FPC only version checking directive allowing for syntax like {$IFVERSION < 2.4}...{$ENDIFVERSION}, {$IFVERSION 2.4}...{$ENDIFVERSION} and {$IFVERSION 2}...{$ENDIFVERSION} That would solve the Delphi problem completely as no {$IF} with constants is involved anymore. Provided you can make sure all old fpc versions get this behaviour as well. Which brings us back to ... impossible to solve. Thanks for trying to resolve this issue, but I think I'll add the checks to the top of the fpc packages files. In that case only Lazarus will see them, but people using the units directly in fpc will not get the message... Mark ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: Delphi incompatible conditionals?
> -- Doorgestuurd bericht -- > From: Martin > if you can put it after the uses clause (so you can have a const section, the > following worked for me: > {$IFNDEF FPC} > const fpc_version=1; fpc_release=1; > {$ENDIF} > // your code below > {$IFDEF FPC} > {$IFNDEF ver1} > {$IF (fpc_version>2) or (fpc_version=2) and (fpc_release>3)} > {$info FPC version >= 2.4.0 : Should work} > {$ELSE} > {$warning FPC versions below 2.4 are not supported. However : > give it a try, you never know.} > {$IFEND} > {$ELSE} > {$fatal FPC version 1 isn't supported at all} > {$ENDIF} > {$ENDIF} > Not an option : uses clauses may depend on the defines in the file. > > {$IF Defined(fpc_version) and ((fpc_version>word(2)) or > (fpc_version=word(2)) and (fpc_release>word(3)))} > > gets rid of the warnings Works great on Delphi, but doesn't compile in fpc with following message: Zeos.inc(49,9) Error: Compile time expression: Wanted INTEGER but got STRING at "2 > word" Also tried Marcov's Longint(2) instead of word(2). Same error. Mark ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal