[fpc-pascal] What library would be recommended for creating pdf file (print invoices)
Hello guys , I'm wondering which is the best library available for freepascal that i could use to generate printable invoices? Most likely a lot of people need this kind of functionality in their applications, so ... perhaps there is some obvious choice that someone could point to me immediately ;) Some background information: i'm adapting an existing application for a new customer. Previously, the invoices were simple text files that were sent directly to a matrix printer (using pre-printed paper that contained the company logo, the labels, the lines/boxes). But now i have to find a solution to draw the entire invoice on blank paper. An important remark: the invoice generator has to be a console program, because it will be part of a bigger application that has a text-interface (running on linux). So far i am aware of : - lazreport. To me it's unclear whether this one can be used in a console application. - powerpdf , a library for creating pdf files - libharu, a c-library that can be used from pascal (mentioned on this list in an older thread) - fpgui has a component that would allow pdf creation Probably there are several other libraries available. Which one would you recommend to me (taking into account the API cleanliness) ? Cheers, Adrian M ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Problems with broken (or unclear) download urls for fpc-solaris
On Wed, Mar 28, 2012 at 10:45, Mark Morgan Lloyd markmll.fpc-pas...@telemetry.co.uk wrote: Adrian Maier wrote: Hello, I wanted to download the latest freepascal for Sparc Solaris . Issue 1: Opened the http://www.freepascal.org/download.var , clicked on the SPARC Solaris link. It opened the page for selecting the mirror. Clicked on Sourceforge , which lead to : http://sourceforge.net/projects/freepascal/files/ The problem here is that this page doesn't seem to contain any Solaris stuff . Issue 2: I went back to the mirror selection, and clicked on ftp.freepascal.org . This link is ok , but it contains the 2.4.2 sparc solaris FPC . This is not consistent with the main download page (http://www.freepascal.org/download.var) , which implies that 2.6.0 is available for the entire list of platforms and operating systems (which includes the SPARC solaris ... ). Perhaps it's worth taking a look at the download page , so that it presents in a clearer way which FPC version is available for each platform ? For example create a separate section for the less-supported platforms. The way it is now, it implies that 2.6 is available for all the platforms - which is unfortunately false. I currently have ssh access to some Sparc Solaris servers. Does it involve a lot of work to create the solaris builds ? I don't know to what extent anybody is routinely producing Solaris/SPARC releases. I try to test the compiler on v10 (and to a limited extent on v8) on a fairly regular basis, but I started off with [checks] 2.4.2, had to do a bit of hacking to get it installed (see http://mantis.freepascal.org/view.php?id=18271) and then compiled newer versions from there. The server is a SunOS 5.10 . Uname -a : SunOS bebrxsu005 5.10 Generic_147440-07 sun4u sparc SUNW,SPARC-Enterprise Solaris I'll try to find some time for installing the 2.4.2 and building the 2.6. Thanks for the link : the comments will be useful in case i encounter problems . In practical terms, you might need to be on 2.7 since there are a couple of code generation bugs that weren't backported to 2.6- this affects both Solaris and Linux. Lazarus 0.9.30-fixed should compile and run on v10 now that some alignment patches have been incorporated. I am hoping that 2.6 would be enough (not targetting lazarus) . Compiling a development version would be painful because there is no way to directly access the svn server ... In all cases, you need the freeware gas, gld, gmake and probably gtar etc., and need to be careful with your paths. The server has the GNU make and tar . But the as and ld are not GNU. And i have no admin rights : so i can install software only in the home dir. -- Adrian M ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Looking for a suitable graphics library/component
Hello, I am seeking for some advice regarding what graphics library to use for a new project. I am aware that the application can be done by drawing lines, points and text within a canvas. But I am hoping to find out about the existence of some already existing libraries that would ease the development ... The application will be a railway route viewer (it's a tool that will be useful for me at work). I'll try to explain next what does it involve. - the description of a train station tracknet is read from an xml file (the tracknet is like a spider web) - a route is a concrete path of a train ; it's a set of connected track segments - within the application i intend to represent the route as a long horizontal line - on the route i need to represent elements (signals, points, balises). At a given location there can be more than one element. - i need zooming and horizontal scrolling - i need to be able to click on an element (and display information about it) - there are many kinds of areas that also need to be marked visually (for example the max speed areas) - in future I might also want to add a moving train - i'll need a configurable annotation system (enable/disable areas, enable/disable labels) - did i already mention zooming and scrolling ? ;) My feeling is that it would be tedious to develop such a GUI application using only lines, points and rectangles. So, does anyone happen to have suggestion regarding what would be the most suitable widget set or library for building such an application ? Thanks, Adrian ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Looking for a suitable graphics library/component
On Tue, Mar 22, 2011 at 17:18, Anthony Walter sys...@gmail.com wrote: For drawing lines, shapes, fills, on Linux I'd recommend using cairo. On Windows I'd say you should use GDI or GDI+. You can find pascal files importing the functions for those libraries using google. Some of them may come with FPC. For widgets, if you are using Lazarus, it comes with a widget toolkit. Then there is also the free pascal gui tookit located here: http://fpgui.sourceforge.net/ Finally, for handling scrolling, what you need to do is determine the max bounds of your area, compare that to screen area and your drawing scale (your zoom factor). Use that to recalculate both the horizontal and vertical scroll bar information (page size, scroll size) when the draw area is resized and update the scroll bars accordingly. When you receive a scroll position change notification (the user drags the scroll bar) you call some api to scroll the drawing (such as ScrollWindowEx), which will invalidate a dirty rectangle in your window. When you receive a paint notification (either when the user scrolls or a window is dragged over your window), you should also retrieve the dirty rectangle. Then you need to find the rectangles of your drawn objects that intersect the dirty rectangle. Redraw objects that intersect the dirty rectangle. If the user zooms in or out, invalidate the entire area. It's all pretty standard stuff ... http://imagebot.org/snapshops/phun-gears-builder.jpg Thanks Anthony for your answers. I will keep in mind these suggestions if I fail to find a higher-level component. (for example, the TAChart is a higher-level component for drawing charts that is much more convenient to use compared to drawing the chart from scratch). Ideally, I am hoping that already exists some kind of svg canvas that can be used in fpgui or Lazarus applications. For example: if I draw a rectangle in the canvas I want to be able to later : - change color - modify size/position - associate it with a mouse click event I didn't mention that I will need to handle in parallel multiple coordinates systems: - number of meters - position withing each track segment (each segment has a starting km and an ending km). And it's possible that a segment ends at km=35.4 and the next one begins at km=38.2 . It is even possible that the next segment has coordinates in reverse order. - position relative to balises So the problem itself is relatively mind-twisting . It would be really nice to find a component that allows me to add and manipulate the graphical objects in a scalar-graphics way , that takes care of drawing on-screen without forcing me to go into the details . -- Adrian ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Looking for a suitable graphics library/component
On Tue, Mar 22, 2011 at 18:13, Horacio Jamilis hjami...@pymesoft.com.ar wrote: You could take a look to AggPas. I'll look , thanks . -- Adrian ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: FCL-DB/SQLDB docs started
On Jan 23, 2008 5:01 PM, Joost van der Sluis [EMAIL PROTECTED] wrote: Op woensdag 23-01-2008 om 12:35 uur [tijdzone +], schreef Chris Kirkpatrick: I have been given commit access to the /docs/xml/lcl/ directory in the lazarus SVN tree. At present the SQLDb and fcl-db documentation files would not appear in that pathway, and we would need to find some way of sharing our work on the files - perhaps we need to find a branch of SVN to which some or all of us gain access. As fcl-db and sqldb are parts of fpc, the documenatation should be in the fpc-docs-repository. I have full write access there so at first I can commit any changes. I have an (almost empty) framework ready. I you want I can commit that, so you guys have something to start with. What's the URL of the fpc-docs-repository ? -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: FCL-DB/SQLDB docs started
On Dec 4, 2007 10:41 AM, Adrian Maier [EMAIL PROTECTED] wrote: On Dec 3, 2007 2:07 PM, Leonardo M. Ramé [EMAIL PROTECTED] wrote: I like the idea, can you start by creating the section's skeleton? Here is a possible structure of the page.I'm not familiar yet to working with this lufdoc , that's why i'm putting the skeleton here on the mailing list for the moment. Sqldb guide 1. Introduction - what is FCL-db - what is Sqldb ; the supported databases - the current document concentrates on the sql databases 2. Concepts - the diagram shown here http://wiki.lazarus.freepascal.org/SQLdb_Programming_Reference - explanations about each of the classes 3. Connecting to a database - how to instatiate a TsqlConnection for each of the supported databases - checking that the connection succeeded - closing the connection - frequently used methods of the TSqlConnection class - maybe : link to another doc Setting up the database for the sqldb guide examples , so that the specific instructions for creating the db doesn't clutter this guide 4. Transactions - how to instantiate a TsqlTransaction and link it to the connection object - frequently used methods of the TSqlTransaction class : StartTransaction, Commit, CommitRetaining, Rollback. 5. Executing SQL commands 5.1 The TSqlQuery class - how to instante and link the query to the transaction and connection. - frequently used methods 5.2 Executing simple sql queries (which don't return tuples) - cfilltable.pp 5.3 Executing a sql query and traversing the records - example for accessing the fields by name - dshowtable.pp - example for accessing the fields by position - using filters - gfiltertable.pp 5.4 Editing the records - fedittable.pp 5.5 Queries with parameters - efilltableparams.pp 5.6 Executing sql commands with connection.ExecuteDirect - example for using ExecuteDirect - bcreatetable.pp - advantages/disavantages compared to using a TSqlQUery 5.7 Other stuff - getting the list of tables - alisttables.pp - other functionality that i'm not aware of 6. Developing FCL-DB and SqlDb 6.1 Structure of the FCL-DB directory in the FPC sources 6.2 Implementing a new kind of TSqlConnection 7. Resources - links to the reference pages of the classes used - links to tutorials, wiki pages, etc. Hello, Unfortuately , L's initiative to start writing a guide for fcl-db and sqldb has stalled completely : http://z505.com/cgi-bin/powtils/docs/1.6/idx.cgi?file=fcldbnotes At that time I've tried to contribute with a possible structure of the guide. After that, nothing else happened. GIven that the few information on the subject is spread in tiny places (the only comprehensive source of information being the source code...) it's hard for me to understand how some people can actually build applications that need to access sql databases. Probably their Delphi experience helps them a lot , because the docs surely don't . Are there any people still interested in making it possible to have some real docs for sqldb and fcl-db ? If so, let's organize ourselves and see what needs to be done . I am very interested in the subject but I can't do it myself alone : if I knew enough about sqldb I wouldn't be so unhappy about the lack of documentation . Best wishes, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] copy(), length(), and setlength() is not mentioned in fpc docs?
On Dec 5, 2007 5:18 AM, Tom Verhoeff [EMAIL PROTECTED] wrote: On Wed, Dec 05, 2007 at 09:12:00AM +0100, Daniël Mantione wrote: Op Wed, 5 Dec 2007, schreef Bee: Is it just me or above methods are indeed not mentioned within fpc's doc 2.2.0? Any texts that are supposed to be a link to above methods is not formed as a link. http://www.freepascal.org/docs-html/rtl/system/stringfunctions.html These functions are not only for strings, but (more generally) for dynamic arrays (as well). I haven't checked to see if they are documented there, but one would expect/hope so. Can someone confirm this? The fact that SetLength is usable for dynamic arrays is mentioned here : http://www.freepascal.org/docs-html/ref/refsu14.html#x36-390003.3.1 But I couldn't find anywhere the list of functions that can be used to perform operations on dynamic arrays . It is not intuitive nor logical to guess that the string functions are valid for dynamic arrays as well , therefore it looks like the dynamic array functions are in need of being explained better. Cheers, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: FCL-DB/SQLDB docs started
On Dec 3, 2007 2:07 PM, Leonardo M. Ramé [EMAIL PROTECTED] wrote: I like the idea, can you start by creating the section's skeleton? Here is a possible structure of the page.I'm not familiar yet to working with this lufdoc , that's why i'm putting the skeleton here on the mailing list for the moment. Sqldb guide 1. Introduction - what is FCL-db - what is Sqldb ; the supported databases - the current document concentrates on the sql databases 2. Concepts - the diagram shown here http://wiki.lazarus.freepascal.org/SQLdb_Programming_Reference - explanations about each of the classes 3. Connecting to a database - how to instatiate a TsqlConnection for each of the supported databases - checking that the connection succeeded - closing the connection - frequently used methods of the TSqlConnection class - maybe : link to another doc Setting up the database for the sqldb guide examples , so that the specific instructions for creating the db doesn't clutter this guide 4. Transactions - how to instantiate a TsqlTransaction and link it to the connection object - frequently used methods of the TSqlTransaction class : StartTransaction, Commit, CommitRetaining, Rollback. 5. Executing SQL commands 5.1 The TSqlQuery class - how to instante and link the query to the transaction and connection. - frequently used methods 5.2 Executing simple sql queries (which don't return tuples) - cfilltable.pp 5.3 Executing a sql query and traversing the records - example for accessing the fields by name - dshowtable.pp - example for accessing the fields by position - using filters - gfiltertable.pp 5.4 Editing the records - fedittable.pp 5.5 Queries with parameters - efilltableparams.pp 5.6 Executing sql commands with connection.ExecuteDirect - example for using ExecuteDirect - bcreatetable.pp - advantages/disavantages compared to using a TSqlQUery 5.7 Other stuff - getting the list of tables - alisttables.pp - other functionality that i'm not aware of 6. Developing FCL-DB and SqlDb 6.1 Structure of the FCL-DB directory in the FPC sources 6.2 Implementing a new kind of TSqlConnection 7. Resources - links to the reference pages of the classes used - links to tutorials, wiki pages, etc. -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: FCL-DB/SQLDB docs started
On Dec 3, 2007 11:57 AM, Adrian Maier [EMAIL PROTECTED] wrote: For instance : - I'd move the Step-by-step section before the box about FCL-DB , or even in a separate page because it seems to contain information for people who want to add connectivity for new database vendors . So it's not information for the typical developer. Ooops, sorry. What i meant to say was : it's worth considering to move the FCL-DB box at the bottom of the page of in a separate page because it seems to contain information about implementing new connection classes and has therefore a more limited audience . -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: FCL-DB/SQLDB docs started
On Nov 28, 2007 1:46 AM, L [EMAIL PROTECTED] wrote: Help the help, help our help! Hello, Thank you guys for starting to write documentation about sqldb and database access in general ! It's painful to rely on those few examples and using the code-completion feature of Lazarus for guessing the methods each time when needing to work with databases ... Which is the right place for discussing about the new sqldb guide ? Since I'm a sqldb beginner I'm not sure how much documentation text can I contribute with. But at least i can come up with ideas since I know what kind of information would I expect to find in a Working with databases guide. For instance : - I'd move the Step-by-step section before the box about FCL-DB , or even in a separate page because it seems to contain information for people who want to add connectivity for new database vendors . So it's not information for the typical developer. - I think that the guide should contain easily identifiable sub-sections : Connecting to a database (with links to another page that presents the specifics for connecting to the various db engines) , Reading the contents of a table , Executing SQL commands , Using parameters , Calling a stored procedure , Getting metadata information from the database , etc.A long, complete tutorial is hard to follow if it doesn't have sub-sections . - The guide should avoid ending up like this one : http://wiki.lazarus.freepascal.org/Lazarus_Database_Tutorial which contains 6 tutorials , each having its own, unique structure. Some tutorials are verbose, others are shorter . Creating a connection is different for each database type, but afterwards the handling of the data is supposed to be the same regardless of the database being used. The mentioned wiki page fails to present the common elements involved in working with databases. Cheers, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] can we have fpc's doc in chm format?
On Dec 2, 2007 6:25 PM, Michael Van Canneyt [EMAIL PROTECTED] wrote: On Sun, 2 Dec 2007, Bisma Jayadi wrote: Can we have fpc's doc in chm format? It's easier to navigate and search compare to other formats. :) The reference material: If you complete the chm backend of fpdoc, yes. The manuals: definitely out. But I don't see how CHM is better than PDF. PDF offers all that CHM offers, plus well-formatted printed output. PDFs are great for printing , but when reading them on-screen the page-oriented-ness is a little awkward . Probably the people who are asking for CHM docs are hoping to experience better search capabilities , although the CHM format itself might not guarantee it . Also , it would be nice to be able to copy-paste procedure names and source code examples from the docs . The truly painful experience with the fpc docs is finding a class/procedure that is performing a certain function and that you haven't used before and that you are not even sure it exists . The functionality is fragmented into units and the navigation links requires an advanced understanding about one can expect to find in each unit : before reaching the reference page of a procedure you need to know its exact name or at least the unit is belongs to . For instance : some string-related procedures are in the System unit, some in StrUtils , and God knows where else. I am sure that there is some logic (and/or heritage) in separating them that way, but it's difficult to hunt down all those procedures and functions throughout the RTL reference manual without proper search and browsing capabilities . Cheers, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] can we have fpc's doc in chm format?
On Dec 3, 2007 1:04 PM, Michael Van Canneyt [EMAIL PROTECTED] wrote: On Mon, 3 Dec 2007, Adrian Maier wrote: Also , it would be nice to be able to copy-paste procedure names and source code examples from the docs . This can be done with PDF as well. What pdf viewer are you using? I can't do it on Linux with xpdf or kghostview. The truly painful experience with the fpc docs is finding a class/procedure that is performing a certain function and that you haven't used before and that you are not even sure it exists . The functionality is fragmented into units and the navigation links requires an advanced understanding about one can expect to find in each unit : before reaching the reference page of a procedure you need to know its exact name or at least the unit is belongs to . In the next release, I hope to have a search engine included in the docs. I found one, written in FPC, so that is perfect ! (ioda or something) Great news ! Any chances to have better navigation in the online HTML docs ? I mean : a better presentation of what the units contain , without being forced to click N times until getting to the list of Procedures or Classes . As i was explaining : finding items is painful unless you already know the unit . It could help if it were possible to search for keywords only in the procedure/function/class descriptions ( mailing list results are usually overwhelming and make me prefer trying to google and ask on the mailing list ) . -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] can we have fpc's doc in chm format?
On Dec 3, 2007 1:41 PM, Graeme Geldenhuys [EMAIL PROTECTED] wrote: On 03/12/2007, Adrian Maier [EMAIL PROTECTED] wrote: What pdf viewer are you using? I can't do it on Linux with xpdf or kghostview. I use 'evince' which is the standard PDF viewer with Ubuntu. I can copy any text I want. As far as I remember 'xpdf' also allows coping text, but it uses the old 'middle mouse button' to paste the text. Some older X11 apps don't support the usual KDE or Gnome copy and paste style. Simple highlight the text with the mouse, open gEdit and Middle click (mouse wheel click) in gEdit. I'm still unable to to copy text in xpdf. But I've just installed evince and copying text works . Thanks for telling me about it , Graeme ! -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: FCL-DB/SQLDB docs started
On Dec 3, 2007 1:44 PM, Vincent Snijders [EMAIL PROTECTED] wrote: Adrian Maier schreef: - The guide should avoid ending up like this one : http://wiki.lazarus.freepascal.org/Lazarus_Database_Tutorial which contains 6 tutorials , each having its own, unique structure. Some tutorials are verbose, others are shorter . Creating a connection is different for each database type, but afterwards the handling of the data is supposed to be the same regardless of the database being used. The mentioned wiki page fails to present the common elements involved in working with databases. Feel free to refactor and improve. Help the help, help your help! Vincent Point taken ;) -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: FCL-DB/SQLDB docs started
On Dec 3, 2007 2:07 PM, Leonardo M. Ramé [EMAIL PROTECTED] wrote: I like the idea, can you start by creating the section's skeleton? --- Adrian Maier [EMAIL PROTECTED] wrote: - I think that the guide should contain easily identifiable sub-sections : Connecting to a database (with links to another page that presents the specifics for connecting to the various db engines) , Reading the contents of a table , Executing SQL commands , Using parameters , Calling a stored procedure , Getting metadata information from the database , etc.A long, complete tutorial is hard to follow if it doesn't have sub-sections . I can give it a try. Where should i put the skeleton once I think about it ? here on the mailing list , or you are suggesting me to modify the online page ? -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Arrays of objects
Hello, I'm seeking for advice about which is the best way to hold an array of class instances I need to access the elements using its position (like a regular array) , and also i'd like the structure to grow when I add more elements. Fpc has 'dynamic arrays' , and also there several classes like TFPList, TList in RTL.Classes . Also, the FCL has the contrns unit which also contains some classes that can be used for storing objects into memory. At this point there are already too many options, and I am unsure what to use. The 'dynamic arrays' are very close to what i'm looking for, except that I couldn't find the documentation page of the SetLength procedure. In particular : what happens if i call this procedure again for the same array : an does it re-allocate memory for the array , or resizes its memory ? Cheers, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Arrays of objects
On 10/31/07, Matt Emson [EMAIL PROTECTED] wrote: Adrian Maier wrote: Hello, I'm seeking for advice about which is the best way to hold an array of class instances I need to access the elements using its position (like a regular array) , and also i'd like the structure to grow when I add more elements TObjectList I am aware that TObjectList is one of the possible ways. But I was hoping to get a better understanding about the purpose of these various classes or types of array , and more importantly what are the drawbacks . Is there really no wiki page , tutorial, anything that provides an overview of the collections and types of arrays that FPC has ? -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Arrays of objects
On 10/31/07, Joao Morais [EMAIL PROTECTED] wrote: Adrian Maier wrote: On 10/31/07, Matt Emson [EMAIL PROTECTED] wrote: Adrian Maier wrote: Hello, I'm seeking for advice about which is the best way to hold an array of class instances I need to access the elements using its position (like a regular array) , and also i'd like the structure to grow when I add more elements TObjectList I am aware that TObjectList is one of the possible ways. But I was hoping to get a better understanding about the purpose of these various classes or types of array , and more importantly what are the drawbacks . Is there really no wiki page , tutorial, anything that provides an overview of the collections and types of arrays that FPC has ? You can use dynamic arrays, they work like an ansi string: var VArray: array of TSomeClass; begin SetLength(VArray, 10); // now you have VArray[0] .. VArray[9]; SetLength(VArray, 20); // now you have [0] .. [19]; // Length(VArray) = 20 // for I := 0 to Pred(Length(VArray)) is a valid statement They are reference counted, just like ansi strings, ie don't worry about memory leakages. The detail that is not crystal clear to me is : after the first SetLength and i set the first 3 elements , is it *guaranteed* that the second SetLength leaves those first 3 elements untouched ? That's what i meant by resize as opposed to reallocate . Reallocation could occur in some other place in memory , leading to loosing the original contents.I have actually tested it with a small program, but since i've been able to access indexes way beyond the allocated number of elements before getting the program killed i want to be sure that i understand the proper use of dynamic arrays. Thanks Joao ! -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Arrays of objects
On 10/31/07, Marco van de Voort [EMAIL PROTECTED] wrote: On 10/31/07, Joao Morais [EMAIL PROTECTED] wrote: They are reference counted, just like ansi strings, ie don't worry about memory leakages. The detail that is not crystal clear to me is : after the first SetLength and i set the first 3 elements , is it *guaranteed* that the second SetLength leaves those first 3 elements untouched ? Yes. But they can be copied, so address to them might be invalid. That's what i meant by resize as opposed to reallocate . Reallocation could occur in some other place in memory , leading to loosing the original contents. It does resize if possible, reallocate (and copy the original data as far as it fits) else. Thanks for the info! -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] The SetLength procedure (which sets the size of dynamic arrays)
Hello, I have found out about the SetLength procedure in the Free Pascal : Reference guide , chapter 3.3.1 Arrays . But I am unable to find the complete description of this function. What unit does SetLength belong to ? In the System unit i've found DynArraySetLength procedure, but there it's written that It should never be necessary to call this function directly, the standard SetLength function should be used instead. In this case, where is the standard SetLength function documented ?! Searching with the site's Search and locally with grep though the fpc-html-docs didn't give me meaningful results. Thanks, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Reading text from images
On 12/9/06, Darius Blaszijk [EMAIL PROTECTED] wrote: This technique is called OCR. No idea if there is a pascal implementation, but it should not be too hard to make one. It's based on neural networks that learn to recognize any character from any font. Hi, There is little use in reinventing the wheel and implement ocr from scratch. I think the best way is to use an existing software from fpc , for example GOCR: http://jocr.sourceforge.net/ GOCR is based on a shared library, which means that it shouldn't be difficult to call the functions from freepascal. Cheers, Adrian Maier Darius - Original Message - From: Antal [EMAIL PROTECTED] To: fpc-pascal@lists.freepascal.org Sent: Saturday, December 09, 2006 3:09 PM Subject: [fpc-pascal] Reading text from images Does anybody have an idea about how to read text from an image, using freepascal? There are lots of fonts, and so on, but it would be rather interesting to make able fpc to read from jpegs or gifs, since on the net there is so much information stored in images. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Reading text from images
On 12/13/06, Marco van de Voort [EMAIL PROTECTED] wrote: On 12/9/06, Darius Blaszijk [EMAIL PROTECTED] wrote: This technique is called OCR. No idea if there is a pascal implementation, but it should not be too hard to make one. It's based on neural networks that learn to recognize any character from any font. Hi, There is little use in reinventing the wheel and implement ocr from scratch. I think the best way is to use an existing software from fpc , for example GOCR: http://jocr.sourceforge.net/ GOCR is based on a shared library, which means that it shouldn't be difficult to call the functions from freepascal. If it is C. If it is C++, it is a different story. I know that. But it seems to be C (even though it's not explicitly specified in the software description on their site). http://jocr.sourceforge.net/api/dox/globals.html -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Executing python code from a pascal program
On 11/14/06, Tiziano_mk [EMAIL PROTECTED] wrote: Adrian Maier ha scritto: Hello, I am trying to write a program that is embedding the python interpreter in order to execute python code. I don't need to transfer values between pascal and python. you welcome! If you are using Lazarus on Windows, I can send you the core units of Python for Delphi adapted in order to be compiled with Lazarus (not yet usable under Free Pascal only). I'm on Linux . Thanks anyway ! references: http://membres.lycos.fr/marat/delphi/python.htm If you need using pure Free Pascal (RTL+FCL), or are on Linux or MacOS, this has to be done in other ways, but the P4D library is the model to follow. There is another idea to explore: With Python 2.5 there is a module named ctypes that allows calling DLL functions from Python. And we know how to build a DLL with FPC, true?. I (on windows) and my friend (on Linux) are actually working in order to make some experiment and documentation about this matter. If you could partecipate and help... It's good to know about this. But this is a solution for the opposite problem: calling pascal code from python. Cheers, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Executing python code from a pascal program
Hello, I am trying to write a program that is embedding the python interpreter in order to execute python code. I don't need to transfer values between pascal and python. More specifically, I'm trying to convert to pascal the following: #include Python.h int main(int argc, char *argv[]) { Py_Initialize(); PyRun_SimpleString(from time import time,ctime\n print 'Today is',ctime(time())\n); Py_Finalize(); return 0; } I have a minimal unit which includes the needed functions (h2pas wasn't able to convert the Python.h , and i only need those 3 functions anyway ) : unit Python; interface uses Strings; {$LinkLib python2.4} {$IFDEF FPC} {$PACKRECORDS C} {$ENDIF} procedure Py_Initialize;external name 'Py_Initialize'; procedure Py_Finalize;external name 'Py_Finalize'; function PyRun_SimpleString(_para1:Pchar):longint; external name 'PyRun_SimpleString'; implementation end. The pascal program is : var cmd: PChar; begin cmd:=StrAlloc(256); Py_Initialize(); StrPCopy(cmd, 'print Hello'); PyRun_SimpleString(cmd); { --- the program crashes here : runtime error 216 } Py_Finalize(); end. The problem is that the program crashes at execution with Runtime error 216 at a_memory_address . The backtrace is : (gdb) backtrace #0 0xb7e6c3fa in PyOS_Readline () from /usr/lib/libpython2.4.so.1.0 #1 0xb7e6ca7b in PyTokenizer_FromFile () from /usr/lib/libpython2.4.so.1.0 #2 0xb7e6cf5d in PyTokenizer_FromString () from /usr/lib/libpython2.4.so.1.0 #3 0xb7e69fb3 in PyParser_ParseStringFlagsFilename () from /usr/lib/libpython2.4.so.1.0 #4 0xb7e6a091 in PyParser_ParseStringFlags () from /usr/lib/libpython2.4.so.1.0 #5 0xb7eeb408 in PyParser_SimpleParseStringFlags () from /usr/lib/libpython2.4.so.1.0 #6 0xb7eeb8a1 in PyRun_StringFlags () from /usr/lib/libpython2.4.so.1.0 #7 0xb7eecba3 in PyRun_SimpleStringFlags () from /usr/lib/libpython2.4.so.1.0 #8 0xb7eecc21 in PyRun_SimpleString () from /usr/lib/libpython2.4.so.1.0 #9 0x08048324 in main () at runpy.pas:16 What am i doing wrong ? Any idea ? Thank you, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Executing python code from a pascal program
On 11/13/06, Leonardo M. Ramé [EMAIL PROTECTED] wrote: I created a Python.pas unit this way using Delphi and it works correctly (note the cdecl directive before external): unit python; interface procedure Py_Initialize; cdecl; external 'python24.dll'; procedure Py_Finalize; cdecl; external 'python24.dll'; function PyRun_SimpleString(_para1:Pchar):longint; cdecl; external 'python24.dll'; implementation end. Thanks Leonardo ! The trick was to add cdecl _before_ external : function PyRun_SimpleString(_para1:Pchar):longint; cdecl; external name 'PyRun_SimpleString'; I had initially added cdecl _after_ the 'external' clause , but this generated an error ( directive CDECL has conflicts with other directives ) which confused me into thinking that cdecl was not needed. Thanks, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Unistalling FPC (and reinstalling from svn)
On 10/6/06, Jochem Berndsen [EMAIL PROTECTED] wrote: On Friday 06 October 2006 10:49, Adrian Maier wrote: I have a silly question : which is the best way to uninstall FPC ? I don't know. Also, after compiling FPC with 'make build' , if i execute 'make install' will it copy everyting in /usr/local by default ? Is the destination directory configurable somehow? Yes. You can choose the installation directory using make install INSTALL_PREFIX=/path/to/install (For example, make install INSTALL_PREFIX=/usr/local This will create bin/ and lib/ and other directories if they do not exist already.) Indeed, make install INSTALL_PREFIX=/usr/local worked like a charm. I did not delete anything , because apparently the 'make install' target needs to have the previous fpc still installed (i haven't verified this assumption well, but after deleting the old fpc : 'make install' gave some errors and i had to re-install the old fpc). The newly compiled freepascal is the same version as the old one, so I assume that it simply replaced the files. Perhaps it would be nice to have in the sources directory a README file describing how to compile and install from sources? Many opensource projects have such a files included with the source files . Thanks ! Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Unistalling FPC (and reinstalling from svn)
Hello, I have a silly question : which is the best way to uninstall FPC ? I have used the 2.0.4 tarball (Linux) and the install script included within. I chose to install it in /usr/local. Now, I need to compile from sources (so debug some problems with sqldb) and i want to make sure that there are no files left from the initial FPC. Unfortunately, there is no uninstall script and I need to delete individual files manually ; which is not extremely difficult but i can't be sure that i haven't missed some files (for example the man pages and the executables in /usr/local/bin ). Also, after compiling FPC with 'make build' , if i execute 'make install' will it copy everyting in /usr/local by default ? Is the destination directory configurable somehow? -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] connecting to firebird with sqldb
Hello, I'm trying to run one of the sqldb examples against a firebird database (by accessing the database file directly, with no server). What should I write in database.ini so that the programs can connect ? type=interbase name=/tmp/db_faf.fdb user= password= hostname= It says unable to complete network request to host localhost. I am able to connect to that database with: isql /tmp/db_faf.fdb Cheers, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] How to debug when accessing database with sqldb
Hello, I'm using Sqldb to access a PostgreSQL database. Is it possible to find out what sql commands is sqldb generating and trying to execute ? I have a Lazarus form that contains a DBgrid which is associated to a table. After updating a row and executing query.ApplyUpdates , the program generates an exception : An error occurred while applying the updates in a query: preparation of query failed. (PostgreSQL: ERROR: syntax error at end of input at character 132). Enabling the statement logging in postgres doesn't help in this case, because the sql command is not recognised at all, and therefore it doesn't show up in the log. Another problem is that deleting rows also doesn't work. I click delete on the TdbNavigator, it asks for confirmation, but the row is still there. Cheers, Adrian Maier -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TProcess questions
On 10/3/06, Adrian Maier [EMAIL PROTECTED] wrote: On 10/3/06, Michael Van Canneyt [EMAIL PROTECTED] wrote: On Tue, 3 Oct 2006, Adrian Maier wrote: On 10/3/06, Michael Van Canneyt [EMAIL PROTECTED] wrote: Any idea how should i quote the arguments so that they would be properly treated by TProcess? You can't. The following lines (line 107 of unix/process.inc) Result:=StringReplace(Result,'','',[rfReplaceAll]); Result:=StringReplace(Result,,'',[rfReplaceAll]); Will strip all quotes inside a quoted string. Obviously, this is a bug. It's a painful one. I was hoping to switch to TProcess instead of shell ( which isn't cross-platform ) ... The bug won't occur on windows :) I will see about fixing it. Could you please post a bug report so it won't be forgotten. Hello guys, Luckily I have discovered a workaround . It is possible to add the simple quotes later, inside the sql script. So, it is ok to run something like : psql -f abc.sql -v DATE1=1-jan-2006 if I add at the beginning of the script: \set DATE1 '\'':DATE1'\'' Chers ! Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] TProcess questions
Hello, I have several questions about executing external programs with TProcess 1. I need to execute the following command : psql -q -f /home/am/src/gfaf/hlemit_d.sql -v D1='1-apr-06' -v D2='1-jun-06' (it might not be obvious at first sight that there are both and ' enclosing those dates , because the argument must contain the ' ) . This command works fine when executed from the bash shell. However, it no longer works when executed from my pascal program (with TProcess). Any idea how should i quote the arguments so that they would be properly treated by TProcess? 2. Where is the TProcess documented on the freepascal website? I had found a FCL.pdf some time ago , but I am unable to find that doc on the freepascal website. 3. The code returned by the called program can be got with TProcess.ExitCode , right ? I have a situation in which a program 1 , but TProcess.ExitCode is 0. Therefore it's impossible to detect the failure. Cheers, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TProcess questions
On 10/3/06, Michael Van Canneyt [EMAIL PROTECTED] wrote: Any idea how should i quote the arguments so that they would be properly treated by TProcess? You can't. The following lines (line 107 of unix/process.inc) Result:=StringReplace(Result,'','',[rfReplaceAll]); Result:=StringReplace(Result,,'',[rfReplaceAll]); Will strip all quotes inside a quoted string. Obviously, this is a bug. It's a painful one. I was hoping to switch to TProcess instead of shell ( which isn't cross-platform ) ... 2. Where is the TProcess documented on the freepascal website? Michael, Vincent , Thanks for the links for TProcess docs . :-) 3. The code returned by the called program can be got with TProcess.ExitCode , right ? I have a situation in which a program 1 , but TProcess.ExitCode is 0. Therefore it's impossible to detect the failure. That can be if the program exited because of a signal. I'm not sure if this was the case - I'll have to investigate. Anyway, is it possible to detect this situation ? Cheers, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TProcess questions
On 10/3/06, Michael Van Canneyt [EMAIL PROTECTED] wrote: On Tue, 3 Oct 2006, Adrian Maier wrote: On 10/3/06, Michael Van Canneyt [EMAIL PROTECTED] wrote: Any idea how should i quote the arguments so that they would be properly treated by TProcess? You can't. The following lines (line 107 of unix/process.inc) Result:=StringReplace(Result,'','',[rfReplaceAll]); Result:=StringReplace(Result,,'',[rfReplaceAll]); Will strip all quotes inside a quoted string. Obviously, this is a bug. It's a painful one. I was hoping to switch to TProcess instead of shell ( which isn't cross-platform ) ... The bug won't occur on windows :) I will see about fixing it. Could you please post a bug report so it won't be forgotten. Ok. 3. The code returned by the called program can be got with TProcess.ExitCode , right ? I have a situation in which a program 1 , but TProcess.ExitCode is 0. Therefore it's impossible to detect the failure. That can be if the program exited because of a signal. I'm not sure if this was the case - I'll have to investigate. Anyway, is it possible to detect this situation ? Well, first of all you should do a 'IsRunning' (or running) before checking the exitcode. I'm using the poWaitOnExit option, so my program doesn't waits until the external process ends. All I need is to know if the external process ended successfully or not . Only after that you can check the exit code. About the signalling, we'd need to extend TProcess for that. I understand. Cheers, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TProcess questions
On 10/3/06, Michael Van Canneyt [EMAIL PROTECTED] wrote: I will see about fixing it. Could you please post a bug report so it won't be forgotten. Mantis issue 7534 added . Is it likely for the fix to go into fpc 2.0.4? Or just in the HEAD ? Cheers, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TProcess questions
On 10/3/06, Adrian Maier [EMAIL PROTECTED] wrote: Well, first of all you should do a 'IsRunning' (or running) before checking the exitcode. I'm using the poWaitOnExit option, so my program doesn't waits until the external process ends. All I need is to know if the external process ended successfully or not . Sorry for the spelling mistakes. I meant: I'm using the poWaitOnExit option, so my program waits for the external process to end. In this case the process is surely not running anymore when I get the exitcode. All I need is to know if the external process ended successfully or not . Only after that you can check the exit code. About the signalling, we'd need to extend TProcess for that. I understand. Cheers, Adrian Maier -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TProcess questions
On 10/3/06, Marco van de Voort [EMAIL PROTECTED] wrote: On Tue, 3 Oct 2006, Adrian Maier wrote: It's a painful one. I was hoping to switch to TProcess instead of shell ( which isn't cross-platform ) ... The bug won't occur on windows :) I will see about fixing it. Could you please post a bug report so it won't be forgotten. Wouldn't it be better to also have a way to set the parameters using an indexed property one by one instead of a cmdline? Because this kind of interpretation issues will continue forever, since shell handling is not portable. This was pretty much the reason for the change to array of string in ExecuteProcess and friends. In such case, there is always a safe fall back. It seems nice to have a way of specifying parameters like that (in which case I assume that strings given will be passed as-they-are). There is one more thing about TProcess that i've been surprised to see that after: proc.Environment.Append('PGDATABASE=db1'); all the variables inherited from the parent process are no longer passed to the external program by TProcess. The behaviour is documented : Environment contains the environment for the new process; it's a list of Name=Value pairs, one per line. If it is empty, the environment of the current process is passed on to the new process. So, initially the Environment is empty and the program inherits the variables. When I append the first variable, it will no longer inherit the variables. I find the behaviour counterintuitive: the first append causes the Environment to be initialised. I haven't discovered yet how could the programmer preserve the inherited environment and only add some variables ? Don't you think that by default the Environment list should be filled with the current environment? This way append would mean indeed append. It would also be easy to clear the Environment if needed. -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] .NET FAQ
On 9/29/06, Bisma Jayadi [EMAIL PROTECTED] wrote: I know writing FPC port for .Net is far from easy. But the difficulty should be on compiler code side only. On the user/app code, it shouldn't cause significant changes. Since Delphi and FPC has same language root, object pascal, I wonder why existing FPC apps can't be simply recompile on FPC/.Net? Of course, I never meant it'd work for EVERY kind of apps and codes, but it should work for most common apps. Hello, My understanding is that enhancing the compiler to generate code for .Net would be only the first step. Next, every single unit included with FPC will have to be re-implemented in .Net . The effort is huge, and the maintainance could be a nightmare. Maybe this is doable, with some substantial sponsorship to support a team of full-time developers. But it's not clear at all that the benefits would cover the resources spent ... not_serious_suggestion By the way : why dotnet and not java ? At least java has been around for a longer time, and there are compatible jdk's for more platforms ... So we wouldn't have to deal with differences like those between Mono and the .Net platform. /not_serious_suggestion Cheers, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Hardware
On 22/08/06, Fabrício F. Kammer [EMAIL PROTECTED] wrote: Thanks A.J. Do you know where can I get some example of how to do this? Is it possible to have a conditional compile to do this? You can achieve conditiional compiling with {$ifdef } : {$ifdef Win32} { . windows specific stuff } {$endif} {$ifdef linux} { . linux specific stuff } {$endif} -- Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] exiting a program more friendly way
On 23/06/06, Michael Van Canneyt [EMAIL PROTECTED] wrote: On Fri, 23 Jun 2006, Pianoman wrote: Hi, I'd like to ask whether is it possible to exit program in case of runtime error 202 for example more nicely than with message runtime error 202 at a1d456d5621blablabla For example: writeln('starting to divide:'); writeln(2/0); and I don't want mi program to stop with runtime error but I 'd like to write to screen something like: writeln('program has atempted to divide by zero enter another expression.'); old tp had a special procedure exitproc which allowed to set which code should be executed before terminating in case of run-time error. I mean code which will close opened files or something like that or it could write to logfile the reason of error. FPC has the same exitproc. See the manuals. Or, you could use exceptions : program A; uses sysutils; var x:integer; begin x:=0; try writeln('attempting to divide by zero:'); writeln(2/x); writeln('this line will not be displayed'); except on E : Exception do writeln('Friendly error message : ',e.message); end; writeln(' End of program. '); end. This way, the program will in fact not crash at all. If anything nasty happens between 'try' and 'except', it will execute the code written in the except clause. Then, the program continues normally. Cheers, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC on NetBSD (i386)
On 4/25/06, Jonas Maebe [EMAIL PROTECTED] wrote: $ gmake --version GNU Make 3.80 One more thing:when compiling rtl/inc/ctypes.pp , it was unable to find the unit UNIXTYPE. And i had to add to fpc.conf: -Fu/data/fpc/2.0.0/release_2_0_0/rtl/unix So, it seems to me that it is not finding automagically all the newly compiled units. That is not good. Can you post the output of a make clean all? (without this -Fu/data/fpc/2.0.0/release_2_0_0/rtl/unix added to your config file) Sure: http://www.newsoftcontrol.ro/~am/gmake_clean_all.txt Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC on NetBSD (i386)
On 4/25/06, Jonas Maebe [EMAIL PROTECTED] wrote: On 25 apr 2006, at 10:17, Adrian Maier wrote: That is not good. Can you post the output of a make clean all? (without this -Fu/data/fpc/2.0.0/release_2_0_0/rtl/unix added to your config file) Sure: http://www.newsoftcontrol.ro/~am/gmake_clean_all.txt Please try make clean all OPT=-vtu That should make it clear why it doesn't want to use the new unixtype (or why it wants to recompile it). It is searching for UNIXTYPE only in rtl/inc , while in fact unixtype is in rtl/unix : http://www.newsoftcontrol.ro/~am/gmake_clean_all_vtu.txt Where could i add that directory so that the build system becomes aware of it ? Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC on NetBSD (i386)
On 4/25/06, Jonas Maebe [EMAIL PROTECTED] wrote: The quoted code above adds -FE. to the compiler command line. For some reason this doesn't seem to work in your Makefile, which results in the compiled units being put in the directory where their source is located. Consequently, they cannot be found later on. I added in Makefile.fpc (section [compiler] ): targetdir=. And now the -FE. option is properly added . Thanks for the explanations Jonas ! Adrian ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC on NetBSD (i386)
On 4/23/06, Jonas Maebe [EMAIL PROTECTED] wrote: On 22 Apr 2006, at 21:23, Adrian Maier wrote: Yes. the compiler is 1.0.10 Does make info also show this? Yes, it does. I've included the full output of 'gmake info' at the end of the email. Why do you suspect that the compiler version is not well detected? (the only compiler i have is 1.0.10 anyway ... ) When compiling the unit - Strings , the error says that SIZEINT is not defined. - BaseUnix , the error says that TSTATFS is not defined. I've determined that SizeInt is defined in rtl/inc/systemh.inc , which is included in rtl/unix/sysunixh.inc. And sysunixh.inc is included in bsd/system.pp . I'm not sure what can be done to compile the Strings unit ? ( maybe I should somehow tell the compiler to use the newly compiled sysbsd.ppu , So now it is properly compiling sysbsd and not system? Yes, it's compiling the sysbsd unit now that I've replaced the netbsd Makefile and Makefile.fpc with those copied from freebsd. and not the system unit that came with fpc 1.0.10 ? ) If you just run gmake in the netbsd directory, the compiler should automatically use the newly compiled system unit. But there seems to be something fishy with your gmake, given that it's omitting command line parameters and not detecting the compiler version number correctly. Which version of gmake is it? Maybe using the -d or -p options of gmake may shed some light on what it's detecting and doing. $ gmake --version GNU Make 3.80 One more thing:when compiling rtl/inc/ctypes.pp , it was unable to find the unit UNIXTYPE. And i had to add to fpc.conf: -Fu/data/fpc/2.0.0/release_2_0_0/rtl/unix So, it seems to me that it is not finding automagically all the newly compiled units. gmake -d and -p generate a lot of output. I'm not sure what to look for. Adrian Maier -- gmake info output: == Package info == Package Name. rtl Package Version.. 2.0.0 == Configuration info == FPC.. /usr/local/bin/ppc386 FPC Version.. 1.0.10 Source CPU... i386 Target CPU... i386 Source OS netbsd Target OS netbsd Full Source.. i386-netbsd Full Target.. i386-netbsd == Directory info == Required pkgs... rtl Basedir. /data/fpc/2.0.0/release_2_0_0/rtl FPCDir.. .. CrossBinDir. UnitsDir PackagesDir. .. ../packages/base ../packages/extra GCC library. Other library... == Tools info == As as Ld ld Ar ar Rc rc Mv /bin/mv Cp /bin/cp Rm /bin/rm GInstall.. /usr/bin/install Echo.. /bin/echo Shell. /bin/sh Date.. /bin/date FPCMake... /usr/local/bin/fpcmake PPUMove... /usr/local/bin/ppumove Upx... Zip... /usr/pkg/bin/zip == Object info == Target Loaders Target Units.. Target Implicit Units. Target Programs... Target Dirs... netbsd Target Examples... Target ExampleDirs Clean Units. Clean Files. Install Units... Install Files... == Install info == DateStr.. 20060423 ZipPrefix ZipSuffix netbsd Install FPC Package.. y Install base dir. /usr/local/lib/fpc/1.0.10 Install binary dir... /usr/local/bin Install library dir.. /usr/local/lib Install units dir /usr/local/lib/fpc/1.0.10/units/netbsd/rtl Install source dir... /usr/local/src/fpc-1.0.10/rtl Install doc dir.. /usr/local/doc/fpc-1.0.10/rtl Install example dir.. /usr/local/doc/fpc-1.0.10/examples/rtl Install data dir. /usr/local/lib/fpc/1.0.10 Dist destination dir. /data/fpc/2.0.0/release_2_0_0/rtl Dist zip name ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC on NetBSD (i386)
On 4/19/06, Jonas Maebe [EMAIL PROTECTED] wrote: It depends. If you get 2.0 running, there's probably not that much you have to change to your patches to get 2.0.2 and 2.1.1 running as wel. The downside is that you have to download the 2.0 sources. The upside is that you don't have to mess with cross binutils etc. Ok. I'll try to get 2.0.0 working, but i'll certainly need some guidance at the beginning. I downloaded the release_2_0_0 from svn , and i am now trying to compile rtl using the fpc 1.0.10 . 1. cd rtl/netbsd 2. gmake [...] /usr/local/bin/ppc386 -dUNIX -Fi../inc -Fi../i386 -Fi../unix -Fi../bsd -Fi../bsd/i386 -Fi../netbsd/i386 -FE. -FU../../rtl/units/i386-netbsd -di386 ../bsd/system.pp Compiling ../bsd/system.pp system.pp(24,21) Error: Illegal unit name: SYSBSD system.pp(24,21) Warning: Compiling the system unit requires the -Us switch 3. I've modified in bsd/system.pp the line : Unit {$ifdef VER1_0}SysBSD{$else}System{$endif}; to : Unit System; Is this correct ? Then I ran ppc386 manually (and added the -Us switch) : /usr/local/bin/ppc386 -dUNIX -Fi../inc -Fi../i386 -Fi../unix -Fi../bsd -Fi../bsd/i386 -Fi../netbsd/i386 -FE. -FU../../rtl/units/i386-netbsd -di386 -Us ../bsd/system.pp 4. Ran gmake again , but when building the baseunix unit it is missing some files: $(BSDINC)/bunxtype.inc $(BSDINC)/ctypes.inc $(BSDINC)/bunxmain.inc $(BSDINC)/bunxfunc.inc $(BSDINC)/ossysch.inc $(BSDINC)/bunxmacr.inc I have noticed that in freebsd/Makefile these files are not referred . This is the progress so far. Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC on NetBSD (i386)
( i'm re-posting. My answer got rejected bacause gmail's smtp is blacklisted as spam *again* . very annoying ) On 4/19/06, Jonas Maebe [EMAIL PROTECTED] wrote: It depends. If you get 2.0 running, there's probably not that much you have to change to your patches to get 2.0.2 and 2.1.1 running as wel. The downside is that you have to download the 2.0 sources. The upside is that you don't have to mess with cross binutils etc. Ok. I'll try to get 2.0.0 working, but i'll certainly need some guidance at the beginning. I downloaded the release_2_0_0 from svn , and i am now trying to compile rtl using the fpc 1.0.10 . 1. cd rtl/netbsd 2. gmake [...] /usr/local/bin/ppc386 -dUNIX -Fi../inc -Fi../i386 -Fi../unix -Fi../bsd -Fi../bsd/i386 -Fi../netbsd/i386 -FE. -FU../../rtl/units/i386-netbsd -di386 ../bsd/system.pp Compiling ../bsd/system.pp system.pp(24,21) Error: Illegal unit name: SYSBSD system.pp(24,21) Warning: Compiling the system unit requires the -Us switch 3. I've modified in bsd/system.pp the line : Unit {$ifdef VER1_0}SysBSD{$else}System{$endif}; to : Unit System; Is this correct ? Then I ran ppc386 manually (and added the -Us switch) : /usr/local/bin/ppc386 -dUNIX -Fi../inc -Fi../i386 -Fi../unix -Fi../bsd -Fi../bsd/i386 -Fi../netbsd/i386 -FE. -FU../../rtl/units/i386-netbsd -di386 -Us ../bsd/system.pp 4. Ran gmake again , but when building the baseunix unit it is missing some files: $(BSDINC)/bunxtype.inc $(BSDINC)/ctypes.inc $(BSDINC)/bunxmain.inc $(BSDINC)/bunxfunc.inc $(BSDINC)/ossysch.inc $(BSDINC)/bunxmacr.inc I have noticed that in freebsd/Makefile these files are not referred . This is the progress so far. Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] FPC on NetBSD (i386)
Hello , NetBSD is not on fpc's list of supported operating systems, although there is an older version available (1.0.10) which works fine, at least for my purposes. I've tried to compile the latest sources (svn), but : system.pp(23,6) Error: Illegal unit name: SYSTEM systemh.inc(26,4) Fatal: User defined: You need at least FPC 2.0.0 My questions are: - is there interest in having a fpc binary package for NetBSD ? I would be glad to dig in this direction. - could someone give me some hints about how to compile freepascal ? I am assuming that i should build some intermediary versions of fpc (step by step from one version to a newer one) . Which is the newset fpc that can be compiled by fpc 1.0.10? (or should i better consider cross compiling it from linux ?) Cheers, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] TProcess and EProcess
Hello, I am trying to catch the possible exceptions that may ocur when executing processes with TProcess (such as cases when the program doesn't exist or is not in the path). try p := TProcess.Create(nil); p.CommandLine := 'psql'; p.Options := p.Options + [poStderrToOutPut,poNewConsole,poWaitOnExit]; p.Execute; except on EProcess do ShowMessage('EProcess !'); else ShowMessage('Mysterious exception, other than EProcess ...' ); end; The compiler tells me that it doesn't recognize EProcess. What am I doing wrong? Thanks, Adrian Maier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal