Re: [fpc-pascal] Compiler API specification
> Is it doable ? If you don't want to set any parameters ( in other words no compiler options dialogue) > I might try and implement a little dll myself in Delphi by simply using the > fpc.exe and parsing it's output. > > Somebody with advanced knowledge of the compiler sources, might be able to > make a better/more robust implementation in free pascal. Not really. Nobody uses Delphi like this. Maybe you should do a first attempt to see how far you can come, and then report your findings here when you really have something to report. It makes no sense to embark on an adventure to heavily change the FPC compiler for a project that doesn't exist yet. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Compiler API specification
On 14 Feb 2008, at 07:15, Skybuck Flying wrote: Here is my idea for a compiler application programming interface (api) / specification: The comphook unit in combination with the compiler unit already provides such an api. It is used by the text more IDE. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Compiler API specification
Hello, Here is my idea for a compiler application programming interface (api) / specification: type // informs which file was tried by compiler, if successfull error text should be nil, else it should contain some kind of error messages TcompilerFileTriedCallback = procedure( FullFilename : Pchar; ErrorText : Pchar ); // returns true on success, false on failure function SetSearchPath( SearchPath : Pchar ) : boolean; // returns true on success, false on failure function SetFileTriedCallback( Callback : TcompilerFileTriedCallback ) : boolean; // returns zero for successfull compile, or some value for number of errors function CompileFile( FullFilename : Pchar ) : integer; String/Pchar notes: all strings terminated with null terminator character. Path notes: FullFilename example: c:\delphi\units\somefile.pas SearchPath example: c:\delphi\units\somefolder1;c:\delphi\units\somefolder2 ; = seperator Error notes: ErrorText should not contain null terminators except at the end. Memory notes: User/Programmer provides memory for api calls/strings, unless otherwise mentioned. Compiler interface provides memory for callbacks/strings, unless otherwise mentioned. (API untested but looks ok) It works as follows: 1. Programmer loads the DLL or whatever. 2. Programmer sets the search path to be used. 3. Programmer sets the callback when feedback from compiler is wanted. 4. Programmer calls CompileFile to compile a file. 5. The compiler start compiling the file and all other files the file needs. 6. For each file the compiler compiles, the compiler performs a callback to let the programmer know that a file was tried/compiled or failed. Additionally the compiler returns error text, containing the errors for the tried file. 7. Finally the compiler returns zero for a successfull compile, or the number of errors. What you think of this specification ? Is it doable ? I might try and implement a little dll myself in Delphi by simply using the fpc.exe and parsing it's output. Somebody with advanced knowledge of the compiler sources, might be able to make a better/more robust implementation in free pascal. Bye, Skybuck. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Compiler API specification
> On 14 Feb 2008, at 07:15, Skybuck Flying wrote: > > > Here is my idea for a compiler application programming interface > > (api) / specification: > > The comphook unit in combination with the compiler unit already > provides such an api. It is used by the text more IDE. The comphook unit uses ansistrings, textfile record and exceptions in the interface. This is not suitable for interfacing a FPC compiler dll from Delphi as Skybuck (or e.g. CrossFPC) wants. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Compiler API specification
Marco van de Voort schrieb: >> On 14 Feb 2008, at 07:15, Skybuck Flying wrote: >> >>> Here is my idea for a compiler application programming interface >>> (api) / specification: >> The comphook unit in combination with the compiler unit already >> provides such an api. It is used by the text more IDE. > > The comphook unit uses ansistrings, textfile record and exceptions in the > interface. This is not suitable for interfacing a FPC compiler dll from > Delphi as Skybuck (or e.g. CrossFPC) wants. Yes, but one can build easily a wrapper around it which exports everything in a dll compatible way. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] syscalls and fpc
ik wrote: > Hi, > > I found that the Do_Syscalls are written in assembly and have only > limited number of parameters (up to 6). Is there a way to write it > using array of TSysParam instead of having 7 different functions ? Maybe but it wouldn't make the assembler easier to read :-). > Another question is, is there a way to use it witthout writing > assembly, like using it in libc or some other way ? Calling them doesn't require assembler, or what do you mean? You can try to extend the compiler to support inlining of assembly functions ;-). Micha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] syscalls and fpc
> > Another question is, is there a way to use it witthout writing > > assembly, like using it in libc or some other way ? > > Calling them doesn't require assembler, or what do you mean? You can try > to extend the compiler to support inlining of assembly functions ;-). Or custom calling conventions. That would work at least for the freebsd syscalls. It is like that in C. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] MySQL insert, load data
Along Joost's examples I managed to get connected, create a table, put a query, get the result, and insert a single row. But when I try to insert several rows at once, I get an EDatabaseError "near" to first char of second row. ... q.SQL.Clear; q.Add('insert into MYTABLE(c1, c2, ..) values '); q.Add('(r1v1, r1v2, ..),'); q.Add('(r2v1, r2v1, ..),'); .. q.Add(';'); What am I missing or is multiple insert not supported? Alternatively, MySQL provides the LOAD DATA [LOCAL] INFILE statement. So far I was not able to find a special sqldb wrapper for it. Is it done via ExecuteDirect? Wolfram ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] syscalls and fpc
On Thu, Feb 14, 2008 at 11:02 PM, Micha Nelissen <[EMAIL PROTECTED]> wrote: > ik wrote: > > Hi, > > > > I found that the Do_Syscalls are written in assembly and have only > > limited number of parameters (up to 6). Is there a way to write it > > using array of TSysParam instead of having 7 different functions ? > > Maybe but it wouldn't make the assembler easier to read :-). Actually the assembler is not that hard to understand :) My point is, that I don't like the idea of 7 or 20 or 100 amount of parameters to give answer to every need. I think we should find a better way to implement it, like var args in C or open array in pascal... > > > > Another question is, is there a way to use it witthout writing > > assembly, like using it in libc or some other way ? > > Calling them doesn't require assembler, or what do you mean? You can try > to extend the compiler to support inlining of assembly functions ;-). Well, I just don't like the idea of using assembler if there is a way to avoid it... So my question is, is there a way to avoid it ? > > Micha > Ido -- http://ik.homelinux.org/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal