Re: [fpc-pascal] Syntax changes suggestions
Am 16.07.2018 um 13:40 schrieb Santiago A.: > for var i:integer:=1 to 100 do > begin > <...> > end; What is the benefit? Poorer readability? g Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Read comments via fcl-passrc
Am 23.04.2018 um 13:39 schrieb Michael Van Canneyt: >> Can I save the comments in the DocComment property of every element or >> is this used somewhere else? > > It's normally not used; The idea is to use this in a pasdoc->fpdoc > converter. Great, then I will capture it for my project. Thanks. Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Read comments via fcl-passrc
Am 23.04.2018 um 12:43 schrieb Mattias Gaertner: >> I found TPasTreeContainer.NeedComments but it does nothing. > > Set that to true. Then create the parser. Ok, so I can not use the function ParseSource from unit PParser anymore and have to write my own one? > Read Parser.SavedComments on every CreateElement. Can I save the comments in the DocComment property of every element or is this used somewhere else? thanks Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Read comments via fcl-passrc
Hi, while working with fcl-passrc I search for a possibility to get the comments of a source file in the parsed tree. I found TPasTreeContainer.NeedComments but it does nothing. Am I missing something or is this not a feature of fcl-passrc? thanks Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-passrc: in which line a TPasElement ends?
Am 03.11.2017 um 15:31 schrieb Michael Van Canneyt: > In this case, you can probably simply use > TPasTreeContainer.FinishScope > to record the end of the method. Great, this is easy. I have created (and attached) a patch to add a SourceEndLinenummer for all elements. Maybe it is useful for others or even for the trunk. Thanks for the help. Michael Index: packages/fcl-passrc/src/pastree.pp === --- packages/fcl-passrc/src/pastree.pp (Revision 37557) +++ packages/fcl-passrc/src/pastree.pp (Arbeitskopie) @@ -136,6 +136,7 @@ public SourceFilename: string; SourceLinenumber: Integer; +SourceEndLinenumber: Integer; Visibility: TPasMemberVisibility; public constructor Create(const AName: string; AParent: TPasElement); virtual; Index: packages/fcl-passrc/src/pparser.pp === --- packages/fcl-passrc/src/pparser.pp (Revision 37557) +++ packages/fcl-passrc/src/pparser.pp (Arbeitskopie) @@ -447,7 +447,7 @@ function ParseSource(AEngine: TPasTreeContainer; const FPCCommandLine, OSTarget, CPUTarget: String; Options : TParseSourceOptions): TPasModule; - + Function IsHintToken(T : String; Out AHint : TPasMemberHint) : boolean; Function IsProcModifier(S : String; Out PM : TProcedureModifier) : Boolean; Function IsCallingConvention(S : String; out CC : TCallingConvention) : Boolean; @@ -755,7 +755,7 @@ El: TPasElement); begin if ScopeType=stModule then ; - if El=nil then ; + if El=nil then else El.SourceEndLinenumber := CurrentParser.CurSourcePos.Row; end; function TPasTreeContainer.FindModule(const AName: String): TPasModule; @@ -2116,7 +2116,7 @@ Result:=Last; func:=Last; - + if Last.Kind<>pekSet then NextToken; if not (Last.Kind in [pekNumber,pekString,pekSet,pekIdent,pekSelf,pekNil]) then exit; ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-passrc: in which line a TPasElement ends?
Sorry, some message were not sent to list, my fault: Am 03.11.2017 um 14:132 schrieb Michael Van Canneyt: >> Are there plans for a support in future? Or can you give me some >> advices how I can implement this by myself? I'm afraid I am an >> absolutly newbie in this part of of the FCL.> > There are no plans to support this. I can't even imagine what you > would need this for ? I try to write a small tool for code analysis. I need for example to discover the line length of methods. > To implement this, you would need to heavily modify one of procedure > TPasParser.ParseDeclarations(Declarations: TPasDeclarations); or > function ParseType(Parent: TPasElement; const NamePos: > TPasSourcePos; const TypeName: String = ''; Full: Boolean = false; > GenericArgs: TFPList = nil): TPasType; > > depending on what you need g Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] fcl-passrc: in which line a TPasElement ends?
Hi, a question to TPasElement of fcl-passrc: To get the line in which the element starts I use the public SourceLinenumber field. But how do I get the last line of this element? g Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] German lazarus forum down
[Short English version below] Hallo allerseits, wie ihr vielleicht schon gemerkt habe, ist das deutschsprachige Lazarusforum schon wieder nicht erreichbar. Leider kann ich noch keine Prognose abgeben, wann wir wieder online sind. In der Zwischenzeit habe ich die Notfallseite https://www.lazarus-forum.de/ eingerichtet die zumindest eine Anlaufstelle für alle bieten soll, die nach dem Forum suchen und wissen wollen wie der aktuelle Status ist. Über diese Seite könnt ihr auch bei Fragen Kontakt mit mir und weiteren Forumsmitgliedern aufnehmen. [english version] The German lazarus forum is inaccessible. I have set up an emergency page (https://www.lazarus-forum.de/), which shows the actual state of our downtime. A contact possibility is also available. Greetings m.fuchs (mod of lazarusforum.de) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Google Code closing down
Am 14.03.2015 um 13:21 schrieb Michael Van Canneyt: >>Now I've got to >> start looking for an acceptable alternative- preferably one that >> operates by European rules rather than American ones. > > What do you mean by this ? How would these rules differ ? > I wasn't aware that rules existed ? :) See the example of Sourceforge: "In its terms of use, SourceForge states that its services are not available to users in countries on the sanction list of the U.S. Office of Foreign Assets Control (including Cuba, Iran, North Korea, Sudan and Syria). Since 2008, access to the secure server (used for making contributions to the site) has been blocked for people from those countries. As of January 2010, all access including downloads was blocked for those users. This meant that all people whose IP addresses appear to belong to those countries were prevented from using the site. A month later, the restrictions were relaxed so that individual projects could indicate whether or not their software should be blocked. Crimea has been blocked since 1 Feb 2015." http://en.wikipedia.org/wiki/SourceForge#Country_restrictions ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Google Code closing down
Am 14.03.2015 um 13:21 schrieb Michael Van Canneyt: >> Now I've got to >> start looking for an acceptable alternative- preferably one that >> operates by European rules rather than American ones. > > What do you mean by this ? How would these rules differ ? > I wasn't aware that rules existed ? See the example of Sourceforge: "In its terms of use, SourceForge states that its services are not available to users in countries on the sanction list of the U.S. Office of Foreign Assets Control (including Cuba, Iran, North Korea, Sudan and Syria). Since 2008, access to the secure server (used for making contributions to the site) has been blocked for people from those countries. As of January 2010, all access including downloads was blocked for those users. This meant that all people whose IP addresses appear to belong to those countries were prevented from using the site. A month later, the restrictions were relaxed so that individual projects could indicate whether or not their software should be blocked. Crimea has been blocked since 1 Feb 2015." http://en.wikipedia.org/wiki/SourceForge#Country_restrictions ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] High() and Low() for empty dynamic arrays
Am 09.02.2014 13:05, schrieb Fred van Stappen: > if length(MyArray) > 0 then > for x := 0 to high(MyArray) do > MyArray[x].Free; > > But, if i use : > > setlength(MyArray, 0) ; > > would it do the same job ? No. Your array contains only references to the objects. The references where deleted, but the objects remain in memory without any destructor call. g Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Overloading properties
Hello, I try to define classes with properties an additional fluent setters. Unfortunally the compiler does not allow the fluent methods have the same names as the properties. project1.lpr(18,24) Error: overloaded identifier "MyString" isn't a function Of course I could rename these methods and add a prefix like Set..., but I want to know why this limitation is. And if it is possible to get rid of it and allow the overloading of properties with methods. Thanks Michael And please take a look to the example program: --->8-->8-->8-->8-->8-->8-->8--- program OverloadingTest; {$mode objfpc}{$H+} uses Classes, SysUtils; type TMyObject = class(TObject) private FMyBoolean: Boolean; FMyInteger: Integer; FMyString: String; public property MyString: String read FMyString write FMyString; property MyBoolean: Boolean read FMyBoolean write FMyBoolean; property MyInteger: Integer read FMyInteger write FMyInteger; public function MyString(Value: String): TMyObject; function MyBoolean(Value: Boolean): TMyObject; function MyInteger(Value: Integer): TMyObject; end; function TMyObject.MyString(Value: String): TMyObject; begin FMyString := Value; Result := Self; end; function TMyObject.MyBoolean(Value: Boolean): TMyObject; begin FMyBoolean := Value; Result := Self; end; function TMyObject.MyInteger(Value: Integer): TMyObject; begin FMyInteger := Value; Result := Self; end; var o: TMyObject; begin o := TMyObject.Create.MyString('Test').MyBoolean(True).MyInteger(42); end. --->8-->8-->8-->8-->8-->8-->8--- ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Memoryleak in SQLite3db.TSqlite?
Am 11.03.2013 16:27, schrieb Michael Van Canneyt: Can anybody apply this patch to the trunk? Done. Thank you. Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Memoryleak in SQLite3db.TSqlite?
Am 31.10.2012 10:54, schrieb Michael Fuchs: It works, but the heap trace shows a bunch of memory leaks. ... Is this a bug or am I doing something wrong? For information: I created an entry in the bug tracker for this problem: http://bugs.freepascal.org/view.php?id=23247 Hello, I found no possibility to contact a person via Mantis. Can anybody apply this patch to the trunk? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Does FPC 2.8.0 can actually still be called Pascal ?
Am 28.02.2013 10:56, schrieb Sven Barth: [...] Features like type inference, duck typing, aspect oriented programming and traits. By implementing them we can attract developers which got used to such features and swear that they can simplyfy work. But there should be a line that nobody will cross. Otherwise someday someone try to attract PHP developers with removing the type safety from Free Pascal. *shudder* Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Use of abstract classes
Am 08.01.2013 23:43, schrieb Paul Ishenin: What is the best way for a discussion on this? Should I create a feature request in bugtracker? First create a desired implementation with a patch. I would do it, if I only know where to start. Unfortunately are my experiences in compiler programming equal to zero. Is there a document how to start? Maybe a architecture diagram? BTW: How long does it normally take, until a patch is integrated (or declined)? Two month ago I submitted a patch for a bug in SQLite3db. Is it better to wait or to inquire? Sorry for the dumb questions, this is new territory for me. Michael [1] - http://bugs.freepascal.org/view.php?id=23247 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Use of abstract classes
Am 08.01.2013 17:33, schrieb Graeme Geldenhuys: +1 The current behaviour (even if Delphi compatible) seems just wrong - totally defeats the point of "abstract" in object design! What is the best way for a discussion on this? Should I create a feature request in bugtracker? Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Use of abstract classes
Am 08.01.2013 13:29, schrieb Paul Ishenin: Abstract class feature is implemented the same way as it is done in delphi. In delphi it does not raise any error, so it works in FPC. The only limitation is that you can't both set sealed and abstract for the same class. Maybe later delphi will come with some extra checks for abstract classes and then FPC will follow. Hm, and how about a pioneer solution? For example a compiler error in {$MODE ObjFpc} and the actual behaviour in {$MODE Delphi}. That would not break compatibility, but gets a nice feature for FPC. Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Use of abstract classes
Am 08.01.2013 13:06, schrieb Howard Page-Clark: TAbstractClass = class abstract(TObject) > 'Casting' a class as abstract is curious syntax. What led you to think of that? But obviously the compiler knows it. This is no casting, it is the new abstract class syntax coming from delphi. As soon as you add an abstract method the compiler will give a warning. Yes, this behaviour I know. But I would prefer an error for abstract classes. I was hoping, that the class abstract keyword led to this error. Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Use of abstract classes
Hello, I have the following test program: program AbstractTest; {$MODE ObjFpc}{$H+} uses Classes; type TAbstractClass = class abstract(TObject) end; var MyAbstractClass: TAbstractClass = nil; begin MyAbstractClass := TAbstractClass.Create; MyAbstractClass.Free; end. I thougt this would cause a compiler error, while creating a abstract class. Surprisingly it compiles, even without a warning. Do I have to use any compiler switches or is there no sense in using the abstract keyword for a class? Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Changing variable in conditional
Am 08.01.2013 09:44, schrieb Krzysztof: I like when Free Pascal trying to implement best practices from other languages. That was with increment variable using assign operator: i += 1. Anyway, few days ago I analyzed C++ code and I liked one syntax: if ( ( i = GetSomeValue ) >= 10 ) { // variable "i" already has value returned by GetSomeValue } I wonder if FPC has equivalent for this. I hope not. Why do you use Pascal if you want this ugly C-crap-style? Even the i += 1 is a sin. *shudder* Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] adding additional libraries
Am 09.11.2012 20:53, schrieb waldo kitty: when you add additional libraries to your FPC and/or Lazarus installation, how do you normally do it? where do you normally place them? i'm thinking of libraries like synapse, fpGUI, tiOPF and similar... It depends. If the libraries contains GUI elements (which requires an installation in lazaurus), I put them under lazarus/3rdparty/$PACKAGENAME Non-visual units like synapse, I put under a /libs directory in the specific project. So every project could have an other version of the library. project1/libs/synapse <- contains version 39 of synapse project1/libs/tidypas <- last version of tidy pascal wrapper project2/libs/synapse <- contains version 40 of synapse In this case, I also have the libs in my subversion repository. Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Memoryleak in SQLite3db.TSqlite?
Am 16.10.2012 12:59, schrieb Michael Fuchs: ... It works, but the heap trace shows a bunch of memory leaks. ... Is this a bug or am I doing something wrong? For information: I created an entry in the bug tracker for this problem: http://bugs.freepascal.org/view.php?id=23247 Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Memoryleak in SQLite3db.TSqlite?
Hello, I wrote a simple test program with SQLite3db program SqliteMemoryLeak; {$mode objfpc}{$H+} uses HeapTrc, {$IFDEF UNIX}{$IFDEF UseCThreads}CThreads,{$ENDIF}{$ENDIF} Classes, SysUtils, SQLite3db; var X: TSQLite; S: TStringList; begin try S := TStringList.Create; X := TSqlite.Create('test.sqlite'); X.Query('SELECT * FROM FIRM', S); finally FreeAndNil(X); FreeAndNil(S); end; end. It works, but the heap trace shows a bunch of memory leaks. The trace could be found under: http://michael-fuchs.net/newsgroups/fpc-pascal/sqlitememoryleak.trc Even this produces an unfreed memory message: begin try X := TSqlite.Create('test.sqlite'); finally FreeAndNil(X); end; end. Is this a bug or am I doing something wrong? Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Forward declarations
Am 22.12.2011 21:37, schrieb Rainer Stratmann: > procedure fwproc; forward; > > procedure myprocedure; > begin > fwproc; > end; > > procedure fwproc; > begin > > end; Bad example, in this case there is no need for implementing fwproc after myprocedure. g Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal
Am 19.10.2011 20:30, schrieb Florian Klämpfl: > I still don't see why this cannot be done by procedure variables: one > can easily pass a procedure reference to a compare function to any sort > library call. It is maybe easier to write a anonymous function inline than declaring a function and passing it with a reference to this function. Sometimes I miss them in FPC, but I am also not sure if this feature destroys the beauty of Pascal. Not easy. Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal
Am 19.10.2011 10:16, schrieb Sven Barth: I would prefer a style like myfunc := @function(x, y: Integer): Integer Result := x + y; And how would you create more complex functions? In Pascal code blocks are started with "begin" and ended with "end". I don't see a reason why anonymous methods should differ here. Allow both, like it is already allowed in Pascal: if True then DoSomething; if True then begin DoSomething; DoSomethingMore; Etc; end; If a function only contains one statement it is not a codeblock. Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal
Am 18.10.2011 21:42, schrieb Sven Barth: For anonymous functions you can take a look at Embarcadero's Delphi help here: http://docwiki.embarcadero.com/RADStudio/en/Anonymous_Methods_in_Delphi The Embarcadero style of anonymous functions does not satify me. myFunc := function(x, y: Integer): Integer begin Result := x + y; end; This is not easier than writing: function Bla(x, y: Integer): Integer begin Result := x + y; end; myfunc := @Bla; I would prefer a style like myfunc := @function(x, y: Integer): Integer Result := x + y; But this makes it hard to read. Of course it would be nice to have anonymous functions or even lambdas (think about integrated languages like LinQ). But maybe Pascals strength of easy readable code gets lost. Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Division by Zero
Am 23.08.2011 09:16, schrieb Andreas Schneider: This code prints on the screen "+Inf", but I think it should be "NaN". Is this a bug or a special case in computer arithmetic? http://en.wikipedia.org/wiki/Division_by_zero#In_computer_arithmetic Oh, thank you. I should not read only the german part of wikipedia. Shame on me. Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Division by Zero
Hello, WriteLn(FloatToStr(100 / 0)); This code prints on the screen "+Inf", but I think it should be "NaN". Is this a bug or a special case in computer arithmetic? thx Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Examine methods with TypeInfo
Am 26.05.2011 12:03, schrieb Jonas Maebe: I know how to find published properties with TypeInfo, but how can I find methods? This test checks that functionality: http://svn.freepascal.org/svn/fpc/trunk/tests/webtbs/tw12038.pp Sorry, maybe I am to stupid, but if I understand this test it only finds method properties. So, in my example I have to add three properties which points to the methods. But I want to direct find the published methods. Or do I need the trunk version of FPC? I use 2.4.2 on my machine. thx Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Examine methods with TypeInfo
Hello, I know how to find published properties with TypeInfo, but how can I find methods? type MyClass = class(TObject) published function Function1(APara: String): LongInt; function Function2(APara: String): Boolean; function Function2(APara: Integer): LongInt; end; I need the method names, the parameter types and the return type. Thx Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Using properties in interfaces
Hello, if I understand the documentation correct, this is the only way using a property in an interface: IMyInterface = interface function GetTag: Integer; procedure SetTag(AValue: Integer); property Tag: Integer read GetTag write SetTag; end; Or exists a possibilty to define the interface like that: IMyInterface = interface property Tag: Integer; end; And the programmer who implement this interface could decides how to implement the property? regards Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Standard exceptions
Am 28.02.2011 18:28, schrieb Jonas Maebe: There are no generic equivalents to ArgumentException and ArgumentNullException (when asking such questions in the future, you may also want to include a reference to a web page that describes what they mean, it makes it easier for people to answer you). Sorry, bad mistake. A simple description of this exceptions or better of their possible FPC equivalents: EArgument Base exception for argument related exceptions. Contains a property ParamName which helds the parameter causing the error. EArgumentNil (inherits from EArgument): Thrown if a given parameter to a method is nil and should not. EArgumentRange (inherits from EArgument): Thrown if a given parameter to a method is out of range. ENotImplemented Thrown if a method implementation is not ready. Nice for test-driven-development. Maybe IDEs which generates class implementations could start with a "raise ENotImplemted.Create;" in method body. regards Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Standard exceptions
Am 28.02.2011 14:17, schrieb Sven Barth: As far as I'm aware of: There are none. There is ERangeError though (in SysUtils), but that's not an equivalent for ArgumentOutOfRangeException (I suppose that inherits from ArgumentException?). Yes,and all Argument..Exceptions have a property ParamName:String containing the parameter which causes the error. I also miss a NotImplementedException (or ENotImplemented in FPC style), very handy for test driven development. :) And by the way: how about a InnerException for the SysUtils.Exception class? This would be nice if you want to wrap an exception around another. Are there any chances for implement this? regards Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Standard exceptions
Hello, while porting software from .NET to FreePascal I am looking for some exceptions for recurrent errors. For example: ArgumentException, ArgumentNullException, ArgumentOutOfRangeException Is there a unit which defines those exceptions? regards Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How do you test for set membership?
Frank Church schrieb: > if [dbgRemoteLinks] in dbgActiveOptions then > mmoURLPageContent.Lines.AddStrings(procList); Try if dbgRemoteLinks in dbgActiveOptions then WriteLn('Yes'); htht Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Status of fpc on Nokia n810
Graeme Geldenhuys schrieb: >> Is someone using fpc to develop in such devices? > > If it runs the Symbian S60 OS, then the answer is no. I have the Nokia > 5800XM and also wanted to write software for it using FPC, but I can't. Maybe while waiting for a Symbian compiler you can try MIDlet Pascal, which generates Java bytecode that runs on any J2ME device. http://en.wikipedia.org/wiki/MIDletPascal The publisher site http://www.midletpascal.com/ is down at this moment, but you can download it on http://www.brothersoft.com/midlet-pascal-download-31767.html hth Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Generating code form xmi files
Graeme Geldenhuys schrieb: > I currently use "Dia Diagram editor" to design UML diagrams, but as > far as I know it does generate any code. :-( Try http://www.uni-ulm.de/~s_mgerla/dia2pas.html mfg Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Lazarus: graphical interface using code only?
Ryan Mann schrieb: [..] Instead of using the IDE to design graphical interfaces, is it possible to write a graphical interface using Pascal code? Of course, you can create all components dynamicly and give them their positions by code. It is like programming with Turbo Vision/Free Vision. g Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Exe size
Paul schrieb: I've read that, but isn't it suppose to work within the ide instead of always start the cmd prompt and type in this ? (or use a batch) Project -> Compilersettings -> [Last Tab] -> Execute after (I hope this is right, i've only the german version here). Will this work for WinCE also, cause this what I actually want to do? Don't know. hth Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Exe size
Michael Fuchs schrieb: >> I'm testing with FPC/Lazrus on Windows now, but a simple program results in 11.5 MB size. >> I have enabled -Xs, -CX, -Og, -O2 in the project->compiler options (Lazarus), but the size is still the same. >> Anything else I should do? > > Use > strip --strip-all $PROGRAMNAME.exe > after the compiling. And if you want to shrink it more, try UPX. http://upx.sourceforge.net/ mfg Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Exe size
Michael Fuchs schrieb: I'm testing with FPC/Lazrus on Windows now, but a simple program results in 11.5 MB size. I have enabled -Xs, -CX, -Og, -O2 in the project->compiler options (Lazarus), but the size is still the same. Anything else I should do? Use strip --strip-all $PROGRAMNAME.exe after the compiling. And if you want to shrink it more, try UPX. http://upx.sourceforge.net/ mfg Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Exe size
Paul schrieb: I'm testing with FPC/Lazrus on Windows now, but a simple program results in 11.5 MB size. I have enabled -Xs, -CX, -Og, -O2 in the project->compiler options (Lazarus), but the size is still the same. Anything else I should do? Use strip --strip-all $PROGRAMNAME.exe after the compiling. mfg Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC version 2.2.2 is very silent
Marco van de Voort schrieb: Now with 2.2.2 I need -vi to get these infos. Without the parameter the console stays blank. Is this intended? -vi is always needed. Usually, for a release, there is -viwh in your fpc.cfg. Could you check if this is the case for 2.2.2 ? Surprisingly, I don't found a fpc.cfg on my harddisk. I had uninstalled the previous 2.2.0 an installed the 2.2.2 from sourceforge. But no config was generated. mfg Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] FPC version 2.2.2 is very silent
Hi, if I compile a pas file with 2.2.0, fpc send some information to console. D:\>fpc xarray.pas Target OS: Win32 for i386 Compiling xarray.pas Linking xarray.exe 39 lines compiled, 0.1 sec , 35120 bytes code, 1656 bytes data Now with 2.2.2 I need -vi to get these infos. Without the parameter the console stays blank. Is this intended? greetings Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Meeting in Nürnberg
Rainer Stratmann schrieb: May be it has nothing to do with this list, but was there a meeting in Nürnberg/Germany? I read this somewhere. Hi Rainer, it was a meeting of the Lazarusforum, from 1.-3. August. More infos: http://www.lazarusforum.de/viewtopic.php?t=1701 hth Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Best way to use lists
Hello, I try to implement some lists, so I can use them like the "List(of X)" in VB.NET. What is the best way to do this? 1.) Make some new classes, derived from TFPObjectList and overwrite the Add/Extract/Remove/... -functions? 2.) Make a new class with a private TFPObjectList and hand over the Add/Extract/Remove/...-functions with typecasting? 3.) Or make a new generic class, derived from TFPObjectList and uses this? Generics are stable in 2.2.0? thx Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Best way to use lists
Hello, I try to implement some lists, so I can use them like the "List(of X)" in VB.NET. What is the best way to do this? 1.) Make some new classes, derived from TFPObjectList and overwrite the Add/Extract/Remove/... -functions? 2.) Make a new class with a private TFPObjectList and hand over the Add/Extract/Remove/...-functions with typecasting? 3.) Or make a new generic class, derived from TFPObjectList and uses this? Generics are stable in 2.2.0? thx Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] dot within unit file name
Marco van de Voort schrieb: As far as I can see this is no real advantage, except allowing dots in unitnames. That is what I want. :-) Ok, the better way are child units, but the dots would be a nice feature. g Micha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] dot within unit file name
Matt Emson schrieb: Turning it on its head - file names should have nothing to do with unit names. The unit lives in a namespace, The namespace directive gives the path to the unit. so it would be: unit Blah; namespace MyAPI and uses MyAPI.Blah; But how can fpc find the unit which contains this namespace? I think better is: Namespace = unit name = file name It is easier to allow a dot in the unit name than writing code, which search all units for the right naemspace. g Micha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] dot within unit file name
Michael Van Canneyt schrieb: unit Blah; Namespace MyAPI.Blah; And how will you know which namespace is in what unit (or file) ? You then need a second structure mapping namespaces on filenames, making it slower, bulkier and error prone. The cure is worse than the disease, IMHO. You are right. The better way is "unit MyAPI.Blah;". The Namespace is the unit name. g Micha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] dot within unit file name
Vinzent Hoefler schrieb: I think more interesting are dots in unit name for making better namespaces. Actually, I'm thinking "child units". You mean like in Ada? Yes, this would be great. Are there any plans to implement this in future versions? Micha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] dot within unit file name
Bee schrieb: Why cant FPC use unit that has (some) dot(s) within the file name? Can FPC support it in the next release (2.2.2)? I think more interesting are dots in unit name for making better namespaces. If I have a class called TSpecialButton, I want a unit name like "Michael.GUI.Buttons.TSpecialButton". Or is there an other way to make namespaces like this? Micha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal