[fpc-devel] fpc modifiers
First i will note that what i state is not an error or bug in free pascal, but it is somehow unclean implemented. The decision for modifiers like cvar or cdecl to be an identifier token or an modifier token relies on context information. But what is that context? An example: type name=procedure; cdecl=integer; results in an error, but type cdecl=integer; name=procedure; is correct. The procedure type declaration consumes the cdecl token regardless of the following token. There is no need for this. The = token can be used as context switch, but you´ll need a look ahead of 2 tokens. And that conflicts with the LL1 base structure of pascal. What a pity. For some other modifiers you have the same situation var name:typ; cvar:integer; is an error, but var cvar:integer; name:typ; is correct. You may say in most circumstances the required ; token right before the modifier token is the problem. For example for the absolute directive this kind of problem does not arise. The forward directive is another example, would´nt it be better to have forward be an keyword? I think if the compiler allows one construct he should not reject the other. But, i am not the first programmer who complains about that, so put it in the garbage. (Or start discussion) Sorry for my bad English, with best regards Jörg Schülke ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] __LINE__ and __FILE__ macros
Best regards to all developers, is it somehow possible to access the line number and file information during the compilation? This would be nice for debugging purposes. I do not write about the compiled in debug information for gdb. ASSERT can - i read it in the documentation - access this information. Is it without to much work possible to make this information accessible as macro? Are there any plans to extend macro support (parameters?)? Best regards again Jörg Schülke ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fpc modifiers
In our previous episode, Joerg Schuelke said: [ Charset UTF-8 unsupported, converting... ] First i will note that what i state is not an error or bug in free pascal, but it is somehow unclean implemented. The decision for modifiers like cvar or cdecl to be an identifier token or an modifier token relies on context information. But what is that context? An example: type name=procedure; cdecl =integer; The compiler looks for modifier in certain spaces, like after a procedure declaraction. IOW the compiler reads it like above. results in an error, but type cdecl=integer; name=procedure; is correct. The procedure type declaration consumes the cdecl token regardless of the following token. There is no need for this. The = token can be used as context switch, but you?ll need a look ahead of 2 tokens. And that conflicts with the LL1 base structure of pascal. What a pity. No, since modifiers can be in any order, it could be a lot more than two tokens. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] __LINE__ and __FILE__ macros
In our previous episode, Joerg Schuelke said: Best regards to all developers, is it somehow possible to access the line number and file information during the compilation? This would be nice for debugging purposes. Look in the manual under preprocessor $i (include) ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] __LINE__ and __FILE__ macros
Am Thu, 28 Apr 2011 18:23:10 +0200 (CEST) schrieb mar...@stack.nl (Marco van de Voort): Look in the manual under preprocessor $i (include) thx, hard to find there. I thought i did read them all, but ... ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fpc modifiers
Am Thu, 28 Apr 2011 18:22:38 +0200 (CEST) schrieb mar...@stack.nl (Marco van de Voort): In our previous episode, Marco van de Voort said: No, since modifiers can be in any order, it could be a lot more than two tokens. I think if the compiler reeds the cdecl token he needs a lookup of only one token to decide: is used as a modifier or a identifier token. Jörg ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] __LINE__ and __FILE__ macros
Am Thu, 28 Apr 2011 18:23:10 +0200 (CEST) schrieb mar...@stack.nl (Marco van de Voort): Look in the manual under preprocessor $i (include) Thats better then nothing, but if you want to include this information in debugging information, and you won't write it again and again you will need an expression which is usable inside an macro. Jörg ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] __LINE__ and __FILE__ macros
Am Thu, 28 Apr 2011 20:09:59 +0200 schrieb Joerg Schuelke joerg.schue...@gmx.de: No further explanation needed. Nested comments do it. I did not know that {$define mx:= ... (*$%LINE%*)} works. Best regards to Marco Jörg ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fpc modifiers
Joerg Schuelke schrieb: First i will note that what i state is not an error or bug in free pascal, but it is somehow unclean implemented. The bug resides in the dirty Delphi OPL definition. DoDi ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] fpc modifiers
Am Thu, 28 Apr 2011 23:39:35 +0200 schrieb Hans-Peter Diettrich drdiettri...@aol.com: The bug resides in the dirty Delphi OPL definition. Is it a bug or unspecified behavior? I think it is implemented in the hope it works good enough. If you consume a modifier token as modifier or identifier in respect of the right context of one token, you get rid of this strange behavior and you will get a real superset of the former language. So, why not doing it? Jörg ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] {$I %LINE%} and friends
There is one problem with {$I %LINE%} and his friends, which restricts the use of these directives. They are expanded even inside a macro immediately, so, if you define a macro for debugging purposes, you get the line and file info for the place of the definition and not for the place of the expansion. I am playing around with the compiler for some weeks, maybe i will send a patch ( in a couple of weeks, the code is somehow complicated ) if desired. But what is the cleaner way? To defer the expansion of {$I %xxx%} inside macros, or to define c-like macros __LINE__ and __FILE__, maybe with nicer names? Best regards Jörg ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel