Re: [Lazarus] Large program size - 1.8 MB for empty GUI project
Hello, when is dynamic linking in mainstream Lazarus scheduled? we could spread the size of the LCL over a set of DLLs. Small utilities would all share the same DLLs, and have in their EXE file only a couple of hundred Ko. In any case, manual dynamic linking is possible. Best regards, Thierry Igor Tkachenko wrote: > Hello everyone! > > As stated in this article http://wiki.freepascal.org/Size_Matters > "Lazarus apps on Windows are about 500k, but quickly grow to 1.5 MB" > however I cannot made Lazarus to build empty application less than 1.8 > MB. I've enabled option "Link Smart" at "Linking" tab of compiler > options as well as "Strip Symbols From Executable" and disabled > "Display line numbers in runtime..", however nothing helps to make > empty application less. > > Does this mean that 1.8 MB is the size of empty Lazarus application > now? Or I do something wrong? > > > > > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Valladolid Programming Contest simple test fails at compile?
Hello, I've passed successfully passed both tests 3N+1 and 101 Blocks. 3N+1 is similar to VIncent's solution. 101 Blocks solution is attached here. Mode ObjFPC is accepted which means we can use our modern pascal dialects. I was afraid it wouldn't be possible. Thanks. Thierry Vincent Snijders wrote: Thierry Coq schreef: Thank you guys, Has somebody here delivered a successful pascal program to the UVa online judge: http://icpcres.ecs.baylor.edu/onlinejudge/index.php ? Test problem 100: http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=36 I just succesfully submitted and passed this test problem. See attachment for source code. Vincent ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus //== program test101_16_asobj(input, output); //== // Submission n° 7034612 // result is right answer. Speed is OK: 0.000 s {$MODE OBJFPC} uses SysUtils; type TBlock = class number: integer; stack: integer; above: TBlock; //the one higher on the pile. nil if nobody after below: TBlock; //the one below on the pile, nil if nobody before public procedure RemoveStackFromStack; procedure ResetBlocksAbove; procedure PutStackOnStack(aStack:integer); end; const MaxBlocks = 25; var WaitingForCommands: Boolean; aCommand: String; N : Integer; // blocksize table: array[0..MaxBlocks] of TBlock; tablelast: array[0..MaxBlocks] of TBlock; blocks: array[0..MaxBlocks] of TBlock; //== //creates a block for each position on the table procedure InitializeState; //== var iBlock: integer; ablock: TBlock; begin for iBlock := 0 to MaxBlocks do begin aBlock := TBlock.Create; aBlock.number := iBlock; aBlock.stack := iBlock; aBlock.above := nil; aBlock.below := nil; blocks[iBlock] := aBlock; table[iBlock] := aBlock; tableLast[iBlock] := aBlock; end; end; //== //prints the status of the table procedure PrintState; //== var iStack: integer; aBlock: TBlock; begin for iStack := 0 to N-1 do begin write(iStack,':'); aBlock := table[iStack]; while (aBlock<>nil) do begin write(' ', aBlock.number); aBlock := aBlock.above; end; writeln; end; end; //== function IsIllegalMove(block1, block2: integer): Boolean; //== begin //a move is illegal, if block1 = block2, or // if block1 and block2 are in the same pile... IsIllegalMove := false; // a = b if block1=block2 then begin IsIllegalMove := true; end else begin // a and b in same stack if (block1>=N) or (block2>=N) then begin IsIllegalMove := true; end else begin if blocks[block1].stack = blocks[block2].stack then IsIllegalMove := true; end; end; end; //== // removes the stack starting with aBlock from the current stack. procedure TBlock.RemoveStackFromStack; //== var oldStack : integer; previous : TBlock; begin //removing the block from the current stack... oldStack := Self.stack; //unchaining the block; previous := Self.below; // reknitting forward chain if previous = nil then table[oldStack] := nil else previous.above := nil; //reknitting backwards chain Self.below := nil; tableLast[oldStack] := previous; end; //== // puts the block on top of the stack.. procedure TBlock.PutStackOnStack(aStack:integer); //== var lastBlock: TBlock; nextBlock: TBlock; begin if aStack<0 then exit; lastBlock := tableLast[ aStack]; Self.RemoveStackFromStack; // don't add the block if it is already on the stack if assigned(lastBlock) then if lastBlock.Number = Self.Number then exit; //knitting forward chain... if not assigned(lastBlock) then table[aStack] := Self else lastBlock.above := Self; nex
Re: [Lazarus] Share a port through lazarus-ccr
I would be interested in the port of Log4delphi, too. Best regards, Thierry Carlos German Tejero wrote: > Hi to all!! > I want share a port off log4delphi > (http://log4delphi.sourceforge.net/) through lazarus-ccr. > how can I do? > > -- > Carlos Germán Tejero > > > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Valladolid Programming Contest simple test fails at compile?
Thank you guys, The code works perfectly with the keyboard (it won't stop which is normal) or when I feed it an input file (it stops fine after a few milliseconds of work). Eof or Eoln doesn't seem to be the issue. I've tried another problem where the input finishes by the "quit" word, and I have the same issue. FYI, I've attached the two tests for problem 100 (test3) and problem 101 (test4). Has somebody here delivered a successful pascal program to the UVa online judge: http://icpcres.ecs.baylor.edu/onlinejudge/index.php ? Test problem 100: http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=36 Test problem 101: http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=37 Best regards, Thierry, Mehmet Erol Sanliturk wrote: On Friday 27 March 2009 08:08:20 pm JoshyFun wrote: Hello Thierry, TC>Is there another way recommended for TC> these contests? I have none experience on the contest scene, but eof in the stdin looks nonsense for me when you input data using the keyboard, 'cos after the first line (readln) the eof is a fact ;) "eof or empty line" seems to be more logical to me. You should check how the program works if you feed stdin from a file: test.exe < file.txt Additionally : Between _readln _ and _until eof_ statements , there should be an if statement such as if not eof then begin { statements between readln and until eof ... } end ; because when EOF is seen those stements should not be executed because there is no valid input at that state . Thank you very much . Mehmet Erol Sanliturk ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus program Test3 (input, output); // This is a copy from a known solution to check the online judge... var i, j: integer; function getCL(N: integer): integer; var k: integer; begin k := 1; while N <> 1 do begin if odd(N) then N := 3*N + 1 else N := N div 2; k := k + 1; end; getCL := k; end; function getMaxCL(i, j: integer): integer; var k: integer; max, curCL: integer; begin max := 0; for k:=i to j do begin curCL := getCL(k); if curCL > max then max := curCL; end; getMaxCL := max; end; begin while not eof(input) do begin readln(i, j); write(i, ' ', j, ' '); if i < j then writeln(getMaxCL(i, j)) else writeln(getMaxCL(j, i)); end; end. program Test4(input, output); (*$MODE OBJFPC*) uses SysUtils; type TBlock = class number: integer; stack: integer; above: TBlock; end; var WaitingForCommands: Boolean; aCommand: String; N : Integer; // blocksize table: array[0..25] of TBlock; blocks: array[0..25] of TBlock; //creates a block for each position on the table procedure InitializeState; var iBlock: integer; aBlock: TBlock; begin for iBlock := 0 to N-1 do begin aBlock := TBlock.Create; aBlock.number := iBlock; aBlock.stack := iBlock; table[iBlock] := aBlock; blocks[iBlock] := aBlock; end; end; //prints the status of the table procedure PrintState; var iStack: integer; aBlock: TBlock; begin for iStack := 0 to N-1 do begin write(iStack,':'); aBlock := table[iStack]; while assigned(aBlock) do begin write(' ', aBlock.number); aBlock := aBlock.above; end; writeln; end; end; function IsIllegalMove(block1, block2: integer): Boolean; begin //a move is illegal, if block1 = block2, or // if block1 and block2 are in the same pile... result := false; // a = b if block1=block2 then begin result := true; exit; end; // a and b in same stack if (block1>N) or (block2>N) then result := true; if result then Exit; if blocks[block1].stack = blocks[block2].stack then result := true; end; procedure RemoveFromStack(aBlock:TBlock); var oldStack : integer; lastBlock: TBlock; begin //removing the block from the current stack... oldStack := aBlock.Stack; lastBlock := table[oldStack]; if lastBlock = aBlock then table[oldStack] := nil else begin while lastBlock.above <> aBlock do lastBlock := lastBlock.above; lastBlock.above := nil; end; aBlock.stack := -1; end; // puts the block on top of the stack.. procedure PutOnStack(aBlock:TBlock; aStack:integer); var lastBlock: TBlock; begin //putting the block on the new stack lastBlock := table[ aStack]; if not assigned(lastBlock) then table[aStack] := aBlock else begin while assigned(lastBlock.above) do lastBlock := lastBlock.above; lastBlock.above := aBlock; end; aBlock.stack := aStack; end; procedure ResetBlocksAbove(aBlock: integer); var firstBlock: TBlock; nextBlock: TBlock; begin firstBlock := blocks[aBlock].above; while assigned( firstBlock) do begin nextBl
Re: [Lazarus] Valladolid Programming Contest simple test fails at compile?
yes, it does read from standard input and output file. So there's no need to create textfiles. (It is possible to mention the input and output files in the program declaration such as : program test1(input, output). Adding {$MODE OBJFPC}on Joshyfun's suggestion solved the compiler error. Now I have an time exceeded issue, which doesn't seem too likely as I implemented a rather standard solution. I wonder if the "repeat until eof" or "while eof do" is not the issue...the program would be waiting endlessly for another input which isn't coming. Usually one checks the input file is empty by using eof. Is there another way recommended for these contests? Thanks all of you for the help! Thierry Vincent Snijders wrote: > waldo kitty schreef: > >> Mehmet Erol Sanliturk wrote: >> >>> On Thursday 26 March 2009 05:16:32 pm Thierry Coq wrote: >>> >>>> >> TEST PROGRAM >>>> >>>> program Test1; >>>> >> [CHOMP] >> >>>> until eof; >>>> end. >>>> >>>> << END OF TEST PROGRAM >>>> ___ >>>> >>>> >>> At until eof , there should be a file variable name as eof ( FN ) >>> where FN may be >>> >>> var FN : Text ; >>> or >>> var FN : File ... ; >>> >> not only that, there's nothing that names and opens that file, either... >> >> > > So, it must read from stdin, which seems a reasonable thing in contests. > > Vincent > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > > > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Valladolid Programming Contest simple test fails at compile?
Hello, I've tried entering the valladolid programming contest, just to see if pascal programs were still accepted. See here: http://icpcres.ecs.baylor.edu/onlinejudge/index.php And I find my simple program doesn't compile. Has anyone tried this before and knows how to deliver a workable piece of code. I'm using Lazarus and FPC 2.2.2 under Ubuntu of course, but there shouldn't be any significant changes with FPC 2.0.4. See the program test (for the 3N+1 test) I sent at the end of this post: If anyone can find what is wrong, and what should be done to correct it, thank you for your help, Thierry. >> TEST PROGRAM program Test1; var i, j : integer; //input data k, l : integer; //interval m: integer; //index maxCycles : integer; //max number of cycles for the interval Cycles: integer; // This function computes the number of cycles for the 3N+1 algorithm. function FindCycles(const value: integer):integer; begin result := 1; if value > 1 then begin if (value mod 2) > 0 then result := 1+FindCycles(3*value+1) else result := 1+FindCycles(value div 2); end; end; // main program begin repeat // get the input interval readln(i,j); k := i; l := j; if j maxCycles then maxCycles := Cycles; end; //write the results writeln(i,' ',j,' ', maxCycles); until eof; end. << END OF TEST PROGRAM ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Interact with M$ Word
I agree with Phil. Automation is completely independent of the language. There are currently three solutions to do what you want, in FPC/Lazarus. a - wait for the next full version of FPC. Automation is scheduled to be included. COM is already available. b - based on the COM layer, build a Word Interface unit to insert your data into the word tables. c - use Excel as an intermediate. Generate your tables there, and ask your user or do a little VB code to load the Excel tables into the Word document. As a help, I am doing a port of Excel Automation of which a preliminary version is available here: http://tcoq.free.fr/composants.html. It uses the COM layer to provide an easier access to Excel Automation, from FPC/Lazarus. You can use it either as an example to do the b) option, or as a means to do c) option. Good luck, Thierry Mac Programmer wrote: > Automation has nothing to do with VBA. That's the whole point of > Automation, that it's language independent. > > As Felipe rightly points out, many Laz users could profit from a > library for creating office documents. Ideally it would have 3 notable > characteristics: > > (1) Can create any type of office document programmatically without a > particular office app or version being present. For word processing > documents, RTF is perfect since it's a text format that is well > supported by all word processors. FPC includes a unit for working with > RTF documents. I created a thin wrapper for it that allows you to > create RTF documents: > > http://wiki.lazarus.freepascal.org/XDev_Toolkit > > (2) Can manipulate the resulting RTF file with the office app. On > Windows, Automation works great for that purpose. Your only real > challenges here are: (a) Figuring out a way to mark the place in the > document where the table should be inserted. You can do this in a > number of ways, for example if your app or your users create documents > based on a template that you provide, you could insert a hidden > bookmark in the template and look for this in the document's Fields > collection via Automation. (b) FPC 2.2.2 does not fully support > Automation yet, it appears. > > You can insert text into a Word document from the clipboard via > Automation with something like this: > > worddoc.ActiveWindow.Selection.Paste; > > To insert an RTF file into the document: > > worddoc.ActiveWindow.Selection.InsertFile(rtffilename, > ConfirmConversions:=False); > > (3) Can do (2) across a variety of word processors in a > cross-platform, cross-app way. This includes Word, OO and Apple's > Pages. On Windows you can use Automation to manipulate both Word and > OO. On OS X you can use AppleScript to manipulate word processors that > include a dictionary of classes: > > http://wiki.lazarus.freepascal.org/Multiplatform_Programming_Guide#Making_do_without_Windows_COM_Automation > > Thanks. > > -Phil > > > > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Free Open Source Diagram Components for Lazarus?
Yes, I know about StarUML, it's a good tool, but it's dead: little work has been done since 2005. And the code base is so huge, it seems daunting to port the code base to Lazarus as is. What license is it delivered with? BR Thierry Alex Kovacic wrote: > - > > try StarULM (made with delphi?) > > http://staruml.sourceforge.net/en/ > > > > At 02:12 AM 26/01/2009 -0200, you wrote: > >> On Sun, Jan 25, 2009 at 7:41 PM, Thierry Coq wrote: >> >>> I'm looking for a diagramming components for Lazarus, to draw circles, >>> rectangles, and connectors between them that are resized or moved when >>> the components are moved. This would be used to create graph editors, >>> for example for designing dynamic models. >>> >>> Do you have ideas about a component I could use for this purpose? >>> I've been thinking about using GLScene as a 2D layer, but it seems to be >>> overkill for my purpose (although 3D diagrams... hum.) >>> >>> Best regards, >>> Thierry >>> >> If GPL is an option, ESS-Model may be of some use: >> http://essmodel.sourceforge.net/ >> >> Best regards, >> Flávio >> >> ___ >> Lazarus mailing list >> Lazarus@lazarus.freepascal.org >> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus >> >> > Alex Kovacic(PTC,HPTC,MHGSA,BSc,MSc) > SENIOR SCIENTICT, > FISH Lab > CYTOGENETICS UNIT, > SEALS,Level 4, Campus Centre, > Prince Of Wales Hospital, > RANDWICK, NSW, 2031, > AUSTRALIA, > Tel: (61) (02) 9382 9168 > Fax: (61) (02) 9382 9157 > email1:a.kova...@unsw.edu.au > email2:kovac...@sesahs.nsw.gov.au > > > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > > > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Free Open Source Diagram Components for Lazarus?
Both SimpleGraph and DiagramDesigner look promising! - SimpleGraph seems easier to understand, and the license is very simple: the original author is not responsible, please mail him the sources changes, and keep his name as original author, - DiagramDesigner has another license: no responsible, but also no changes allowed. So we must ask permission for any changes. I suggest the next step is to ask both authors if they are willing to port these tools to Lazarus, first as a Windows port, then as a multi-OS port, or willing to let US do the porting, and if they are willing to use a recognized license scheme such as Lazarus'. Best regards, Thierry Lee Jenkins wrote: > Lee Jenkins wrote: > >> ik wrote: >> >>> There is the following components (for Delphi, but I think it can be >>> converted): >>> http://angusj.com/delphi/ >>> >>> It's freeware with source, so maybe we shoudl contact the developer if >>> it will be converted to lazarus. >>> >>> Ido >>> >>> >> This one too is freeware and might make a good candidate to port assuming >> you >> could get permission from the author. Great component btw. >> >> -- >> Warm Regards, >> >> Lee >> >> > > Forgot the link: > > http://www.delphiarea.com/products/delphi-components/simplegraph/ > > -- > Warm Regards, > > Lee > > > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > > > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Free Open Source Diagram Components for Lazarus?
Hello Flàvio, I would hope to have rather a Lazarus-compatible license such as LGPL or Mozilla. Pure GPL for a component is, in my case, somewhat of an issue. I would happily give the work to improve the drawing component, but not necessarily the science that the component represents. Thanks for the link in any case. Essmodel is, indeed, very interesting. Thierry Flávio Etrusco wrote: > On Sun, Jan 25, 2009 at 7:41 PM, Thierry Coq wrote: > >> I'm looking for a diagramming components for Lazarus, to draw circles, >> rectangles, and connectors between them that are resized or moved when >> the components are moved. This would be used to create graph editors, >> for example for designing dynamic models. >> >> Do you have ideas about a component I could use for this purpose? >> I've been thinking about using GLScene as a 2D layer, but it seems to be >> overkill for my purpose (although 3D diagrams... hum.) >> >> Best regards, >> Thierry >> > > > If GPL is an option, ESS-Model may be of some use: > http://essmodel.sourceforge.net/ > > Best regards, > Flávio > > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > > > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Free Open Source Diagram Components for Lazarus?
I'm looking for a diagramming components for Lazarus, to draw circles, rectangles, and connectors between them that are resized or moved when the components are moved. This would be used to create graph editors, for example for designing dynamic models. Do you have ideas about a component I could use for this purpose? I've been thinking about using GLScene as a 2D layer, but it seems to be overkill for my purpose (although 3D diagrams... hum.) Best regards, Thierry ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Saving user created component structure to LFM file
Dear Martin, In Delphi, I frequently used the mecanism you described, but I had to use the root "WriteComponentRes" procedure, not the WriteComponent one, which is only available for subcomponents. I did not use TCollection, which is capable of writing components (too complex for my usage). What I did do, was create container classes with TComponent as Parent. By default, TComponent stores all children. The root component must also give a name to each component, or the storage will not work. The end result is the capability to store a hierarchy of objects in a consistent manner. You should look for WriteComponentResFile in classes.inc and see how this work, with a few tries. Hope this helps, Thierry Martin Friebe wrote: > Hi, I have a problem saving a certain component struicture to an LFM > (lazarus) file and read it back. > > since a good amount of code is in FPC, I am not sure which list to go to? > > There is classes/writer.inc with has TBinaryObjectWriter. This is where > things go first. > Then, later this gets translated into text. This translation seems to be > stricter in terms of what can be nested. > > > Anyway the problem is, that if I want to save a component (that can be > of different class/classes) then I can use WriteComponent. But only if I > am in a Component that is itself written with WriteComponent. > > In the final LFM it seems a Component can only be nested in an other > component. It does not seem to be possible to put it in: > - Not in a subcomponent (because a subcomponent does not write it's > class, but just the properties that are visible for the class given by > the property > property Foo: TPanel read .. write ... > writes > Foo.Name = 'abc' > Foo.Top = 1 > ... > - Not in a TCollection, or at least I havent managed. Also again a > TCollection is restricted to one classs for all Items > - Not Using DefineProperties > All propwerties with define property are of the kind > Name = Value > I can add a list, but even inside the list I can not write a component > > > What I want to archive is theFollowing. I have > > TMainComponent = class (foo) >property Options : TPersitentBar read x write x; > end > > If It has to be it can be a TComponent, with SubComponent in > TComponentStyle. > Problem 1) Options is always created in the constructor, it can not be > stored as a nested Component in the LFM. If it was, it would exist twice > (once created in the constructor, and once loaded from the lfm) > > TPersitentBar should have a list of components, variable number, and > different subclasses (could inherit from TPersistent, only Component if > it makes it easier) > > How can I get this list saved into the lfm? Each item has a diff class, > and diff properties, so they must saved via WriteComponent. (Which does > not work for DefineProerties) > > And of course a default list of items is created in the constructor, so > I need to detect if they are loaded, and remove the defaults. > > Any Idea? > > Example of the final structure (if only it was valid) > > object MainComp1 : TMainComponent > Options.AllowFoo = 1 > Options.AllowABC = 2 > object Options.SubOptionsForCars : TCarOptions > MAxCar = 4 > end > object Options.SubOptionsForTrains : TTrainOptions > MAxTrain = 1 > end > end > > > Best Regards > Martin > > > > > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > > > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Making components "interpreted"?
Marco van de Voort wrote: > On Fri, Dec 05, 2008 at 11:35:26PM +0100, Thierry Coq wrote: > >> The research could be sped up quite fast by looking at how Kylix >> implemented package loading some time ago. I think it had dynamic >> loading on Unix. >> > > Maybe, but there are both license issues, and also the chance that Kylix > solution is a Linux hack looming over htat. > One just needs to look at which APIs Kylix used in Linux: there is no chance of a breach of licence there. I'm not suggesting to copy/paste code. After all, I have independtly reimplemented the library loading code in Windows, so it should be possible to do the same kind of "trick" in Linux. > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > > > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Making components "interpreted"?
The research could be sped up quite fast by looking at how Kylix implemented package loading some time ago. I think it had dynamic loading on Unix. Best regards, Thierry Marco van de Voort wrote: > On Fri, Dec 05, 2008 at 02:36:48PM +0200, Reenen Laurie wrote: > >>> I think simply implementing packages would be easier, and also serves other >>> purposes. (it's not just a plugin system for Lazarus, but at the same time >>> for the generated apps) >>> >> Is this in the short / mid term pipeline? >> > > Nobody is currently working on it. There is even a trajectory of research > before it. (to come up with the best approach to implement them on *nix) > > http://wiki.freepascal.org/packages > > >> Because I guess that's all I actually wanted, but thought that perhaps an >> interpreter would be a shortcut. >> > > I think the interpreter wouldn't be that much more easy to get workable, its > is not just the IDE, but you need to define script->binary interfaces > anywhere. > > But more importantly, it would break compatibility (with delphi, with the > current situation) horribly, AND make packages dual language, dual-tool > (pascalscript and native pascal). Despite being static, at least the > packages system now is both versatile and Delphi pkgs can be ported > reasonably fast. > > IMHO the solution is worse than the problem here. > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > > > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Making components "interpreted"?
It's probably not very far away from a technical point of view. Some time ago, I wrote a piece of code to dynamically load FPC code. So the basic mechanics are available. check this page for an example http://tcoq.free.fr/Lazarus.html Best regards, Thierry Reenen Laurie wrote: > Hi, > > I am totally just throwing an idea into the bush here (and don't > understand the underlying difficulties)... At the moment Lazarus has > to be recompiled if we want to add a new component. I tried that on > an old laptop, and Lazarus is not a joke to recompile on older > hardware (especially memory wise). > > Can't we make components "interpreted" (ala Python) using Pascal > Script? That'll make it a lot easier to add and play around with > components. > > Would it be doable? > > Regards, > -Reenen > > > > -- > o__ > ,_.>/ _ > (_)_\(_)___ > ...speed is good > ___ > I believe five out of four people have a problem with fractions. > > > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] New Excel Interface Component
Link should be fixed now. Luiz Americo Pereira Camara wrote: > Thierry Coq escreveu: > >> Yes, definitively, >> >> I've checked, this code seems to be currently geared to use DISPID >> interfaces. This works in Delphi, but not in FPC for the time being. >> >> For example, the following code: >>fDocument := fDesktop.loadComponentFromURL('file:///'+ >> StringReplace(FileName, '\', '/', [rfIgnoreCase, rfReplaceAll]) , >> '_blank', 0, wProperties); >> >> declares fDocument as an OleVariant. The author hopefully expects FPC to >> understand how to go and fetch "loadComponentFromURL". It ain't gonna >> work ;-). >> >> It should be done this way: >>var fDocument : IDispatch; >>... >>fDocument.InvokeDispatch( DISPID_LOADCOMPONENTFROMURL, ...); >> >> Thierry Coq >> >> > > I tried to download your component to see the implementation but i'm > getting "Page not found" message for both packages (binary and src) > Can you take a look at it? > > Luiz > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > > > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] New Excel Interface Component
Yes, definitively, I've checked, this code seems to be currently geared to use DISPID interfaces. This works in Delphi, but not in FPC for the time being. For example, the following code: fDocument := fDesktop.loadComponentFromURL('file:///'+ StringReplace(FileName, '\', '/', [rfIgnoreCase, rfReplaceAll]) , '_blank', 0, wProperties); declares fDocument as an OleVariant. The author hopefully expects FPC to understand how to go and fetch "loadComponentFromURL". It ain't gonna work ;-). It should be done this way: var fDocument : IDispatch; ... fDocument.InvokeDispatch( DISPID_LOADCOMPONENTFROMURL, ...); Thierry Coq Luiz Americo Pereira Camara wrote: > Henrique Faria escreveu: >> Very good. What about something to OpenOffice? >> > > It seems fpc OLE support is not good enough to work with OO. > > Attached are a Lazarus project and a Delphi project that converts a OO > document to pdf. Both shares the same unit (OOPdf) and have the same > logic. > > Delphi version works OK. Lazarus one crashes. > > Using: > Lazarus 0.9.27 + fpc 222 > TurboDelphi > > Luiz > > > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] New Excel Interface Component
It may be the same problem I encountered on the Excel translation: Delphi understands DISPID interfaces, while FPC doesn't entirely, for the moment. Using the manner in which ExcelInterface manages DISPID could be a good way to do the same thing for OOO. I'll give it a thought. Thierry Coq Luiz Americo Pereira Camara wrote: > Henrique Faria escreveu: >> Very good. What about something to OpenOffice? >> > > It seems fpc OLE support is not good enough to work with OO. > > Attached are a Lazarus project and a Delphi project that converts a OO > document to pdf. Both shares the same unit (OOPdf) and have the same > logic. > > Delphi version works OK. Lazarus one crashes. > > Using: > Lazarus 0.9.27 + fpc 222 > TurboDelphi > > Luiz > > > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] New Excel Interface Component
using the DISPID features of FPC and the Lazarus environment, I have started to write an Excel Interface component. Excel workbooks and sheets can be created, opened and saved. Cell values can be read and updated. Cell color can be modified. For performance DISPID identifiers are used, reducing overhead. Not all properties and operations have been implemented yet. All complicated calls to Dispatch.Invoke have been encapsulated to make it easy to use. See the test program (made with FPCUnit) to see how easy. It can be downloaded here: http://tcoq.free.fr/composants.html a direct link to the source code : http://www.tcoq.free.fr/ExcelInterface-Sources%20V0.1.tar.gz All comments and improvements are welcome. Enjoy! Thierry Coq ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Issue with IDispatch.Invoke: Can't set Word.Application.Visible to false?
Hello, I've trying to connect to a Word or Excel application with Lazarus 0.9.26. The IDispatch does not work, I've tried going to the "Invoke" API, and it still doesn't work. I'm able to create a Word.Application objet, I'm even able to get the pointer to the "Visible" property. I just can't set the Visible property to true: I get the error message: // -2147352572 = DISP_E_PARAMNOTFOUND: parameter not found Please see attached code. Does somebody know how to call "Invoke" on IDispatch or better still, how to call directly methods and properties of Word or Excel objects in Lazarus? BR Thierry object Form1: TForm1 Left = 332 Height = 300 Top = 158 Width = 400 Caption = 'Form1' ClientHeight = 300 ClientWidth = 400 ParentFont = False LCLVersion = '0.9.26' object Button1: TButton Left = 96 Height = 25 Top = 70 Width = 75 Caption = 'Test' OnClick = Button1Click TabOrder = 0 end object Memo1: TMemo Left = 24 Height = 141 Top = 121 Width = 272 Lines.Strings = ( 'Memo1' ) TabOrder = 1 end end { Ceci est un fichier ressource généré automatiquement par Lazarus } LazarusResources.Add('TForm1','FORMDATA',[ 'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'L'#1#6'Height'#3','#1#3'Top'#3#158#0#5'Wi' +'dth'#3#144#1#7'Caption'#6#5'Form1'#12'ClientHeight'#3','#1#11'ClientWidth'#3 +#144#1#10'ParentFont'#8#10'LCLVersion'#6#6'0.9.26'#0#7'TButton'#7'Button1'#4 +'Left'#2'`'#6'Height'#2#25#3'Top'#2'F'#5'Width'#2'K'#7'Caption'#6#4'Test'#7 +'OnClick'#7#12'Button1Click'#8'TabOrder'#2#0#0#0#5'TMemo'#5'Memo1'#4'Left'#2 +#24#6'Height'#3#141#0#3'Top'#2'y'#5'Width'#3#16#1#13'Lines.Strings'#1#6#5'Me' +'mo1'#0#8'TabOrder'#2#1#0#0#0 ]); unit FMainTestWord; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls; type { TForm1 } TForm1 = class(TForm) Button1: TButton; Memo1: TMemo; procedure Button1Click(Sender: TObject); private { private declarations } public { public declarations } end; var Form1: TForm1; implementation uses Windows, Variants, ComObj, ActiveX; { TForm1 } procedure TForm1.Button1Click(Sender: TObject); const ServerName = 'Word.Application'; var Server : OleVariant; Id : TCLSID; GuID : TGUID; aServer : IDispatch; aResult: HRESULT; Member: WideString; lDispID: Integer; Params: TDispParams; ExceptInfo : TExcepInfo; VarResult: OleVariant; ArgErr : DWord; LocalVariantArg : array[0..3] of TPROPVARIANT; dispidNamed : DISPID; begin if Assigned(InitProc) then TProcedure(InitProc); aServer := nil; Id := ProgIDToClassID(ServerName); GuID := ProgIDToClassID(ServerName); dispidNamed := DISPATCH_PROPERTYPUT; Member := 'Visible'; ldispID := 0; FillChar(ExceptInfo, SizeOf(ExcepInfo),0); FillChar(Params, SizeOf(DispParams),0); FillChar(LocalVariantArg,SizeOf(LocalVariantArg),0); Params.rgvarg := @LocalVariantArg; Memo1.Lines.Clear; try //Server := CreateOleObject(ServerName); //Server := CreateComObject(GuiD); aResult := CoCreateInstance(GuiD,nil,CLSCTX_INPROC_SERVER or CLSCTX_LOCAL_SERVER, IDispatch, aServer); Memo1.Lines.Add('CoCreateInstance Result =' +IntToStr(aResult)); //aServer.QueryInterface(IDispatch,Server) //Server := aServer; except Memo1.Lines.Add('Unable to start Word.'); Exit; end; //Server.Visible := True; {Make Word visible} aResult := aServer.GetIDsOfNames(GUID_NULL, @Member, 1, LOCALE_USER_DEFAULT, @lDispID); Memo1.Lines.Add('GetIDsOfNames on Visible Result =' +IntToStr(aResult)); (* Params.rgvarg[0].VT := varError; Params.rgvarg[0].scode := DISP_E_PARAMNOTFOUND; Params.rgvarg[1].VT := varError; Params.rgvarg[1].scode := DISP_E_PARAMNOTFOUND;*) // the first parameter is a bool LocalVariantArg[0].VT := VT_BOOL; LocalVariantArg[0].boolVal := True; Params.cArgs := 1; Params.cNamedArgs := 1; Params.rgdispidNamedArgs:= @dispidNamed; aResult := aServer.Invoke( lDispID, GUID_NULL, 0, DISPATCH_PROPERTYPUT, Params, @VarResult, @ExceptInfo, @ArgErr); Memo1.Lines.Add('Invoke on Visible Result =' +IntToStr(aResult)); // -2147024809 = COR_E_ARGUMENT: wrong parameters // -2147352572 = DISP_E_PARAMNOTFOUND: parameter not found {Open existing document} //Substitute your path and doc //Server.Documents.Open('c:\Test.doc'); end; initialization {$I FMainTestWord.lrs} end. ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] 0.9.26 released
Thank you all, Lazarus Team, and congratulations! Thierry Mattias Gaertner wrote: > The Lazarus team is glad to announce the 0.9.26 release. This release > is based on fpc 2.2.2. > > This release can be downloaded from the sourceforge download page: > http://sourceforge.net/project/showfiles.php?group_id=89339 > > Highlights / Major changes: > - The LCL now uses Unicode strings UTF-8 encoded on all platforms. > There are docs, tools and functions to help converting old code. > - The LCL internal graphic system was rewritten for more consistency, > more flexibility, better Delphi compatibility, icon support, native > image lists. > - Lazarus now runs native under Mac OS X using the 'carbon' widgetset. > - The IDE designer now allows to connect form components, like > databases on TDataModule. > > This time there were more than 3900 improvements and bug fixes in 11 months. > For comparison: 0.9.24 was about half the changes in 8 months. > > The list of changes can be found here: > http://wiki.lazarus.freepascal.org/Lazarus_0.9.26_release_notes > > And several thousand fixes and minor improvements. > > Mattias > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > > > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] [OT] - Small PC Suggestions?
Lee Jenkins wrote: > Hi all, > > I'm wondering if anyone can suggestion a small pc for running a simple gtk > lazarus app with synapse on? Basically, I need to mount the small PC onto or > close to a 15" flat LCD monitor. > > It's for a bump bar system. Like you see in fast food restaurants that > display > customer orders for the kitchen staff to prepare. > > I've tested lazarus on eeePC and it works. I don't know about alternatives. The screen is only 480 pixels high, so that might be an issue. Depends on what you want to do. Thierry ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Installing Lazarus on eeePC, it works.
See the screen shots on my web site here : http://tcoq.free.fr/ Thierry Coq a écrit : > Dear All, > > I've tried installing the lazarus ide and the FPC on the eeePC and ... > it works. > I've tried compiling the typical "button-turns-the-panel-red" demo and > it also works. > Have fun. Thierry ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Installing Lazarus on eeePC, it works.
Dear All, I've tried installing the lazarus ide and the FPC on the eeePC and ... it works. I've tried compiling the typical "button-turns-the-panel-red" demo and it also works. (Sorry, no screenshots, too big for this forum :-(, you'll have to test by yourself.) It's a minimal installation using only the standard Xandros from Asus, in order to minimize changes to the configuration (and get easy buy-in from the kids!). Basically, installing lazarus 0.94 involves downloading the latest debians, and through dpkg installing them. Once done, using aptitude, resolve all package dependency issues, while preventing the tool from trying to remove Lazarus. libglib, and many other librairies will get installed. Once all librairies are up and running, just open a terminal (Ctr-Alt-t) and start lazarus (lazarus-ide &), and it's done. A few minor quirks are still present, the biggest nuisance is the large height of the dialogs (compiler options, for one), compared to what is available. It would be nice if the dialogs could be reduced somewhat, maybe in Lazarus' future education version ,-). Anyway it's only a minor irritation, since using the alt key and dragging the dialog around, one can get to the whole dialog anyway. Have fun. Thierry ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] lazarus for education
Rainer Hamann a écrit : > I developed a teaching / learning edition for pascal based on Delphi and > RemObjects Pascal Script. > > ... > > I would like to know, if there is interest in such a tool. > Yes, I'm interested, also having it in several languages. I can contribute the french bindings if necessary. > Rainer Hamann > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > > > Thierry ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Installing Lazarus + FPC on eeePC
Vincent Snijders a écrit : > Thierry Coq schreef: > >> Hi all, >> I've just bought a new eeePC and I've trying to install FPC and Lazarus >> on it. No success up to now. >> I've tried installing libglib1.2, etc. but I still get a segmentation >> fault on FPC, can't even do a "make clean". I've tried both FPC 2.0.0.4 >> and 2.2.0-1 but no success. >> >> Has anyone seen a clear installation procedure on eeePC anywhere? >> >> > > Did you read: > http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&t=4833 > > Of course, that's where I got the libglib ideas, and also the ideas on how to get more packages in the debian list, than what is provided by Asus as a standard. You'll note it's about installing Lazarus applications. I'm trying to install the full environment. I believe the distrib used by Asus is a Xandros, but I'm trying to change it as little as possible, for the time being. > Vincent > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > > > In any case, thank you for your help, Thierry ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Installing Lazarus + FPC on eeePC
Hi all, I've just bought a new eeePC and I've trying to install FPC and Lazarus on it. No success up to now. I've tried installing libglib1.2, etc. but I still get a segmentation fault on FPC, can't even do a "make clean". I've tried both FPC 2.0.0.4 and 2.2.0-1 but no success. Has anyone seen a clear installation procedure on eeePC anywhere? BR Thierry PS. This is a message repeat to have this message in a separate discussion thread. ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Installing Lazarus on eeePC?
Hello, I've just bought a new eeePC and I've trying to install FPC and Lazarus on it. No success up to now. I've tried installing libglib1.2, etc. but I still get a segmentation fault on FPC, can't even do a "make clean". I've tried both FPC 2.0.0.4 and 2.2.0-1 but no success. Has anyone seen a clear installation procedure on eeePC anywhere? BR Thierry ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] FYI: Shared Libraries support
Hello, I don't understand the issue. As Razvan writes, isn't it an OS issue? For example, please find attached a small but complete example I've scratched together this morning to show how one can use DLLs in Windows. Obviously, a minor variation of the code could easily be done for the various linuxes. FPC and Lazarus therefore do have the capacity for dynamic loading of DLLs. It may be the compiler could add some syntactic glue, but nothing a competent programmer cannot do on his own with minor work, or encapsulate within a component. See the example. I guess GLScene is doing it already. Or is there something I have missed here? Best regards, Thierry Coq Razvan Adrian Bogdan a écrit : > On Linux they used the OS abilities and naming rules to prevent a dll > hell, since a typical Linux system contains at least twice (usually > much more) the number of libraries and applications than your windows > machine, if you have a 64 bit Linux you will see how nice libs are > placed and with simple symlinks and version in .so names, there are > absolutely no naming conflicts, still with all binaries in one place > it manages to avoid the dll hell and make everyone happy. > I assume OSX also played it smart but OSX had more planning in the first > place. > The only platform with dll hell is windows, because it didn't support > any type of links until NTFS hard links that few know about or use, on > windows Borland was smart enough to include versions in their .bpl > files for each Delphi version, maybe M$ should have folowed the > example instead of inventing a squared iron wheel covered in rubber > named an "assembly" that tricks your app into dynamically loading > whatever dll the user wants you to load, can't we implement such > mechanism ourselvs. > I like the way Zeos Components make use of such dynamic loading and > use different dlls and could even have multiple versions of the same > dll loaded at once and change between those at runtime, it is a simple > as creating a record structure holding the dlls functions and making > instances of this record and dynamically loading every version of the > dll, it is even more advanced than the assembly concept because you > can chose from the application what dll to load and even use more than > one version of it. I think FPC could make dynamic dll loading using > the current static dll loading syntax or very similar syntax if you > are too lazy to write a dynamic loader but then again how much use > would it have to have almost the same syntax, maybe it would help > automatic converters. > > Razvan > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > > > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus