[fpc-pascal] Re: MacMode More Info / which compatibility mode and object class type to use with Mac OS X, XCode and Carbon
Pierre Paré
pare.p at videotron.ca
Sat Apr 11 23:16:32 CEST 2009
Thank for you answers and the links
I did subscribe to the list but it seems I needed to complete the
process with a confirmation.
The FPC list and wiki servers are presently not responding ; my
confirmation is bouncing back.
I could read some answers with a news reader program but was not able
to reply.
This message comes from a email program.
With my XCode compiling configuration in MacPas mode
the "class" keyword doesn't compile but need the TStringList type
from Classes unit.
the "object" keyword must be used but doesn't accept TStringList type
from Objects unit .
it seem to use dynamic class model with the "object" type keyword
instead.
can't use class methods and class components ,
I wrongly assumed, since the installation into XCode had made it
MacMode by default
target build option FPC_COMMON_OPTIONS = -Mmacpas -Sgi
that it was necessary ;
I understand that ObjFPC has the most complete feature list, combining
those of FPC and Delphi compatibility modes.
I could remove -MMacPas from the FPC_COMMON_OPTIONS of the target
proprieties and remplace it with -Mobjfpc.
I still intend to use XCode since it's the prefered IDE to develop on
Mac and that enventualy I'll want to use Carbon (baby steps) and
eventualy Cocoa ; I'll probably need to learn ObjC to get there. I'm
getting myself acquaint with the environment, the framework and the
IDE first and get right to programming. I don't want to relearn C/C++/
OjbC on top of that but start with something I already know.
If you want to get up to speed on Carbon programming in FPC, I have
some very detailed tutorial/demo programs available from Pascal
Central or on my own Pascal References page.
These are strictly carbon and do not include any object or class
objects. It also requires macpas mode and the MacOSAll.p unit.
I will eventualy use the Carbon framework. Is the MacPas mode still a
choice or is mandatory to use the Carbon framework ?
---- the longer version of my thougth process at the end, for short,
here is the conclusion -------
Then to eventualy continue to program with Carbon framework, I will
need to
to interface smoothly with MacOSAll Carbon framework which is
compiled MacPas mode,
encapsulate the procedural nature of the Carbon library in FPC
objects or classes.
The question becomes then
Will an objFPC compiled program be able to use the MacPas compiled
MacOSAll unit ?
If it can, I guess I may choose to use either FPC objects or
classes. To which the answer seems yes.
But if the MacPas mode is necessary or better to interface with the
MacPas compiled Carbon framework
or if Carbon does contain objects to be compatible with,
or if I choose to stay in MacPas mode
the question remains : which one does the MacPas compatibility mode
uses :
static FPC object or dynamic FPC class ,
with base object framework objects Unit of Classes unit
so that my objects remains compatible with the Carbon framework ?
It seems to be implemented as a class type and compatible with units
that uses class type but uses the object type syntax.
thank you
P.S. Is it my Mail program who send the message in HTML ?
--------- more thougths ---------------------------------
Does the Carbon framework uses objects. If Carbon uses object type,
which one
static or stack allocatable, dynamicly created with NEW handle
(double) reference, explicitly dereferenced record object type
dynamicly created with "NEW" , implicitly (handle (double) or
single ?) reference, implicitly dereferenced class type
I did read the documentation but it is not organized by mode, the
information are vastly distributed in different manuals and web sites
and assume prior knowledge of how the different dialects implement
their objects which I don't have :
the user's manual has chapters on porting from TP or Delphi but not
from Mac ; I did find the wiki page on Porting to Mac
The programer's manual has some information on modes and MacPas mode
but
seems outdated : use Mac instead of MacPas
much on macros nothing on object model
The unit reference doesn't specify much which units to use on
differents platforms and/or modes but the user's manual does but not
for OS X
It did mention that macpas unit was automaticly used in macpas mode.
A wiki page did mention that the MacOSAll and universal interfaces
were available to use but I didn't find the unit. (oh yes there it is
in the Packages directory)
The language reference chapters on Objects and Classes insunuate
about the difference in static object vs dynamic class
but doesn't indicate which is used in different dialect and platform.
the MacMode wiki page only has the cryptic mention "Object Pascal Mac
style" which doesn't say much if I don't already know how Mac style
object is implemented.
I even try to read the RTL units sources but I do not know where to
look in this forest. I didn't find MacOSAll and Macpas has mostly
static definitions.
The only indice I found is
it uses objfpc compiling mode
Function Member (Instance : TObject; AClass : TClass) : boolean
which suggest that macpas mode uses
the dynamic class FPC model
with the base framework from Classes unit
Oh wait, there is MacOsAll in Packages directory.
It use MacPas compiling mode.
I could find any TObject or TClass nor object or class type ; it
seems not object-oriented at all but totaly structured procedural
style. But it uses the word "object" a lot.
I would assume that the pointer to record style used in the Carbon
MacOSAll unit
translate more easily into a FPC static object type.
To summarize what I could gather
for compatibilty mode TurboPascal
only System unit automaticaly used
use static object type with Objects unit
for compatibilty mode Delphi and ObjFPC
System, objpas units automaticaly used
use static object type with TObject and base framework in Objects unit
or use dynamic reference class type with TObject in System unit and
base framework in Classes unit
for compatibility with Macintosh OS X and/or Carbon framework
System, macpas units are automaticaly used (compiled in objfpc
compatibility mode)
use MacOSAll (compiled in macpas compatibility mode) for Carbon
framework (universal inteface libraries)
------- back to my conclusion ----------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20090411/9e2452dd/attachment.html>
More information about the fpc-pascal
mailing list