Re: [fpc-pascal] Mode Delphi and functions as parameters.
On 03/21/2015 11:04 AM, Constantine Yannakopoulos wrote: So no ambiguity, As - other than in C - calling a function without empty parentheses is allowed (and rather common, FWIW), this _is_ an ambiguity. -Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Portable coroutines
On 03/20/2015 11:09 PM, Mark Morgan Lloyd wrote: Efficient implementation of coroutines requires CPU-specific code in the RTL and possibly the compiler. However http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html suggests a way that coroutines can be implemented in a portable fashion in C, how can this be done in Object Pascal? Lazarus seems to supports a similar concept by using events and "Application.ProcessMessages". it might not be especially efficient, though. -Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Portable coroutines
Michael Schnell wrote: On 03/20/2015 11:09 PM, Mark Morgan Lloyd wrote: Efficient implementation of coroutines requires CPU-specific code in the RTL and possibly the compiler. However http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html suggests a way that coroutines can be implemented in a portable fashion in C, how can this be done in Object Pascal? Lazarus seems to supports a similar concept by using events and "Application.ProcessMessages". it might not be especially efficient, though. My tentative solution simplifies to the excerpt below, which I think is reasonably efficient. .. // Check that we're not trying to jump into exception blocks etc. Valid // line numbers are known to be > 0, the assertion is CPU-specific. if state.line > 0 then begin SetJmp(sanity); Assert(PtrUInt(state.env.sp) shr 1 xor PtrUInt(state.env.bp) = PtrUInt(sanity.sp) shr 1 xor PtrUInt(sanity.bp), 'Bad stack frame at xfer to line ' + IntToStr(state.line - 1)); LongJmp(state.env, state.line) end; if SetJmp(state.env) = 0 then begin state.line := StrToInt( (*$I %LINE% *) ); exit('A') end; if SetJmp(state.env) = 0 then begin .. Pity about the StrToInt(), which in principle could be resolved at compilation time. -- 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/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Mode Delphi and functions as parameters.
On 18 March 2015 at 14:49, vfclists . wrote: > > I have recently compiled projects which were converted from Delphi and it > seems to me that the passing a function as a parameter does not require the > '@' symbol. I suspect syntax errors came because I wasn't compiling from > the command line. > > e.g > > function AFunction() > begin > > end; > > CallFunctionWithFunctionParameter (AFunction) instead of > CallFunctionWithFunctionParameter (@AFunction) > > Is passing a function as parameter without the '@' symbol accepted in > Delphi? > > -- > Frank Church > > === > http://devblog.brahmancreations.com > More questions on Mode Delphi. 1. Does Mode Delphi simply allow Delphi syntax to be compiled, or does it also affect the code generation, like data structures, pointer handling, parameter handling / calling conventions, stack frames etc? 2. When Mode Delphi is applied to a project, ie the .dpr, does it affect the whole project, or does each project require its own mode delphi statement? 3. Can it be switched on and off within the same unit, ie some procedures and data structures use it, some don't? -- Frank Church === http://devblog.brahmancreations.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Mode Delphi and functions as parameters.
On Mon, 23 Mar 2015 10:13:54 + "vfclists ." wrote: >[...] > More questions on Mode Delphi. > > 1. Does Mode Delphi simply allow Delphi syntax to be compiled, or does it > also affect the code generation, like data structures, pointer handling, > parameter handling / calling conventions, stack frames etc? Compared to mode objfpc: no. Other modes might have other aligns and calling conventions. But you can change that with compiler directives, so basically a mode is just a nice set of start switches. > 2. When Mode Delphi is applied to a project, ie the .dpr, does it affect > the whole project, or does each project require its own mode delphi > statement? The command line parameters are applied to the whole project, the compiler directives only to the unit. > 3. Can it be switched on and off within the same unit, ie some procedures > and data structures use it, some don't? See compiler directives. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Helpers for objects (not classes)
Hi, Do the new class helpers support objects? If this is not implemented how much work (1-10) is it to do? Thanks, Andrew ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Helpers for objects (not classes)
On 23.03.2015 21:39, Andrew Haines wrote: Hi, Do the new class helpers support objects? If this is not implemented how much work (1-10) is it to do? No, it's currently not supported, but it wouldn't be that hard to add. In fact that's somewhere on my ToDo list as well as helpers for interfaces. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal