[fpc-pascal] THREADVARLIST_FVCOMMON & THREADVARLIST_MEMORY undefined symbols while linking

2006-10-06 Thread Ken G. Brown
Downloaded fpc 2.0.4 yesterday and I am trying to compile a legacy CW Pro 2 app 
on Mac 10.4.8 with Xcode 2.4.
I am getting undefined symbols THREADVARLIST_FVCOMMON &
THREADVARLIST_MEMORY when trying to link, and I have no clue how to get past 
this problem. I searched my hard drive and found them showing up in 
/myDevelopment/PrtTstfpc/build/PrtTstfpc.build/DerivedSources/ppc/program.s
but do not know what this means or what to do.
Any help would be appreciated.
Thx
Ken
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: fpc-pascal Digest, Vol 26, Issue 20

2006-10-09 Thread Ken G. Brown
That was it, I had a Uses Memory, and I renamed it to MacMemory and bingo, no 
errors.
Thank you Sir!

Ken

At 12:00 PM +0200 10/8/06, [EMAIL PROTECTED] wrote:
>Date: Sun, 8 Oct 2006 11:16:32 +0200
>From: Jonas Maebe <[EMAIL PROTECTED]>
>Subject: Re: [fpc-pascal] THREADVARLIST_FVCOMMON &
>   THREADVARLIST_MEMORYundefined symbols while linking
>To: FPC-Pascal users discussions 
>Message-ID: <[EMAIL PROTECTED]>
>Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
>
>On 06 Oct 2006, at 18:26, Ken G. Brown wrote:
>
>> Downloaded fpc 2.0.4 yesterday and I am trying to compile a legacy 
>> CW Pro 2 app on Mac 10.4.8 with Xcode 2.4.
>> I am getting undefined symbols THREADVARLIST_FVCOMMON &
>> THREADVARLIST_MEMORY when trying to link, and I have no clue how to 
>> get past this problem. I searched my hard drive and found them 
>> showing up in /myDevelopment/PrtTstfpc/build/PrtTstfpc.build/
>> DerivedSources/ppc/program.s
>> but do not know what this means or what to do.
>> Any help would be appreciated.
>
>Do you have a unit called "memory" in your program? If so, try 
>renaming it to something else, because it may conflict with a 
>standard FPC unit (although it shouldn't).
>
>Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] mixing C and Pascal and function pointers

2006-10-20 Thread Ken G. Brown
I've been experimenting with calling C routines in a library from Pascal. This 
seems to work:

In the Pascal source do

Procedure croutine; cdecl; alias : '_croutine'; External;

If there is trouble finding the routines when building, you can give the 
location of the routines in the Pascal source file with:

{$L libcroutines.a}

When compiling, the 'lib' is automatically added to the front of the file name 
for the library source.

So far I have passed an SInt32 to the C routines so maybe you could pass the 
appropriately sized variable.

Good luck.
Ken

>Date: Thu, 19 Oct 2006 07:44:30 -0700 (PDT)
>From: "Leonardo M. RamÈ" <[EMAIL PROTECTED]>
>Subject: Re: [fpc-pascal] mixing C and Pascal and function pointers
>To: FPC-Pascal users discussions 
>Message-ID: <[EMAIL PROTECTED]>
>Content-Type: text/plain; charset=iso-8859-1
>
>The C routines are inside a shared library?. Can you post the "C" code to call 
>these routines?
>
>--- Armando Navarro V·zquez <[EMAIL PROTECTED]> wrote:
>
>>
>> Dear members:
>> I am not familiar with Pascal, but I would like to call some C routines 
>> inside
>> the main Pascal program, is there any way, to pass function pointers from
>> Pascal to the C subroutines?
>> Thanks in Advance
>> Armando
>> --
>> Dr. Armando Navarro-V·zquez
>> RIAIDT. Univdade de Resonancia Magnetica
>> Universidade de Santiago de Compostela
>> http://desoft03.usc.es/armando/index.html
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>
>
>Leonardo M. RamÈ
>http://leonardorame.blogspot.com
>
>__

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] PROJECT_DERIVED_FILE_DIR

2006-11-02 Thread Ken G. Brown
With fpc, in trying to compile an example brought in from CW, and using XCode 
2.4.1 on a Dual 2.0 G5 10.4.8, I have started with a Carbon template. In the 
target rules for processing pascal source files, I see a custom script 
indicated to use output files $(PROJECT_DERIVED_FILE_DIR)/$(INPUT_FILE_BASE).s

How do you look at the value that PROJECT_DERIVED_FILE_DIR is set to? And where 
would you change the setting? I cannot find it in any documentation. Is the 
custom script necessary?

I am getting a compile error saying:
powerpc-apple-darwin8-gcc-4.0.1: no input files while looking for .s file in 
the Build/projectname.build/DerivedSources directory.

Is a .s always created from Pascal Sources during compiles?

I see a program.s file in Build/projectname.build/DerivedSources/PPC/ directory 
but am not sure why it cannot be found or what to do about it.

Any tips will be appreciated.
Thx
Ken
 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] PROJECT_DERIVED_FILE_DIR

2006-11-03 Thread Ken G. Brown
Thank you very much, that has helped a lot.
The project files readme has a good description of how XCode's build system 
works, which also has helped. Erling's template specifies fpc 2.1.1 but the 
only one I can find for PowerPC is 2.0.4. Is there a later one for PowerPC 
somewhere?
Thx,
Ken

>Date: Thu, 2 Nov 2006 19:19:43 +0100
>From: Jonas Maebe <[EMAIL PROTECTED]>
>Subject: Re: [fpc-pascal] PROJECT_DERIVED_FILE_DIR
>To: FPC-Pascal users discussions 

>You may also want to try Erling Johanssen's alternate Xcode project 
>files, available from
>   http://www.fabfilter.com/frederik/fpc-app-templates-20060921-ejo.zip
>
>They are written for Xcode 2.3 or later and therefore need far less 
>workarounds for Xcode bugs and limitations (and hence are less prone 
>to hard to find bugs). They also solve a few issues with the project 
>files we distribute (the main one is that it puts the compilation 
>script in a different target to avoid a race condition).
>
>
>Jonas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Calling C functions from FPC

2009-01-25 Thread Ken G. Brown
On MacOS X 10.5.6 Intel targeting 10.3.9 PPC:

What are the gotchas with respect to calling C functions from FPC?

For example if I wanted to be able to make use some of Apple's Serial example 
code <http://developer.apple.com/samplecode/SerialPortSample/index.html> but 
don't want to go to all the trouble of converting all to Pascal.

Is there better examples somewhere?

Are there Xcode options that need to be set so that Pascal to C calling 
conventions match or does it all just work?

Is there good reading available for this somewhere?

What other issues might I have to watch out for?

Thx for any tips,
Ken G. Brown
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Calling C functions from FPC

2009-01-26 Thread Ken G. Brown
Thank you, that helps.
And I have found documentation in the FPC 2.2.2 download that talks about the 
Xcode integration templates that handle initial project setup.
I was wondering about that as well.

Ken G. Brown

At 8:53 AM +0100 1/26/09, fpc-pascal-requ...@lists.freepascal.org apparently 
wrote:
>Date: Mon, 26 Jan 2009 09:20:29 +0200
>From: Jonas Maebe 
>Subject: Re: [fpc-pascal] Calling C functions from FPC
>To: FPC-Pascal users discussions 
>Message-ID: 
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>
>On 26 Jan 2009, at 01:24, Ken G. Brown wrote:
>
>> On MacOS X 10.5.6 Intel targeting 10.3.9 PPC:
>>
>> What are the gotchas with respect to calling C functions from FPC?
>
>Mark the external C functions you import in your Pascal code as 
>"cdecl", e.g.
>
>procedure cTest; cdecl; external;
>
>> What other issues might I have to watch out for?
>
>Make sure that the types in your Pascal and C code match. The easiest 
>is to use the ctypes unit. Then you can use the common C-types by 
>prefixing them with "c" (e.g., cint, clong, clonglong, cuint, culong, 
>culonglong, cfloat, ...). And don't try to free pointers allocated in 
>the C code in Pascal code and vice versa.
>
>Jonas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Xcode access to fpc documentation

2009-01-26 Thread Ken G. Brown
Is there a way to add the fpc documentation so that Xcode help can access it 
like the docsets?

In the MacOS fpc 2.2.2 download, in the MainUnit.pas of the 
FPC-C-C++CarbonApplication template for new projects, there is a typo causing 
it to not compile.
The ) after $endif should be }.

{$if not defined(VER2_2_0) and not defined(VER2_0_4)}
MacOSAll,
{$else}
  FPCMacOSAll,
{$endif)
CSupport;

As well, the way the code is commented out causes both MacOSAll and FPCMacOSAll 
to be used. Are they both necessary?

Where are MacOSAll and FPCMacOSAll supposed to be located? At the moment 
Spotlight does not find them for me.

Thx for any tips,
Ken G. Brown
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Xcode access to fpc documentation

2009-01-27 Thread Ken G. Brown
Aha! That's why the unix find of FPCMacOSAll did not find anything either! It's 
not there anymore.
That clears up a couple mysteries for me.
Thx,
   Ken G. Brown

At 9:05 AM +0100 1/27/09, fpc-pascal-requ...@lists.freepascal.org apparently 
wrote:
>Date: Tue, 27 Jan 2009 09:42:00 +0200
>From: Jonas Maebe 
>Subject: Re: [fpc-pascal] Xcode access to fpc documentation
>To: FPC-Pascal users discussions 
>Message-ID: <963ac7c8-1313-46ac-a81f-f2ecbfb7d...@elis.ugent.be>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>
>On 27 Jan 2009, at 00:55, Ken G. Brown wrote:
>
>> Is there a way to add the fpc documentation so that Xcode help can 
>> access it like the docsets?
>
>Not that I know.
>
>> In the MacOS fpc 2.2.2 download, in the MainUnit.pas of the FPC-C-C+
>> +CarbonApplication template for new projects, there is a typo 
>> causing it to not compile.
>> The ) after $endif should be }.
>
>Thanks for reporting this, I'm not sure how I missed that. It's still 
>there in 2.2.4rc1, I'll fix it for the final 2.2.4 release.
>
>> As well, the way the code is commented out causes both MacOSAll and 
>> FPCMacOSAll to be used. Are they both necessary?
>
>No, only MacOSAll is. See 
>http://wiki.freepascal.org/User_Changes_2.2.2#FPCMacOSAll_unit
>  for more information.
>
>> Where are MacOSAll and FPCMacOSAll supposed to be located? At the 
>> moment Spotlight does not find them for me.
>
>The unit is located at /usr/local/lib/fpc/2.2.2/units/i386-darwin/
>univint/MacOSAll.ppu (or powerpc-darwin in case you're on ppc). The 
>reason that you didn't find it with Spotlight, is that it does not 
>show files under /usr by default (because you seldom want to find 
>files there, as only command line applications put things there). You 
>can either use the command line interface to spotlight (mdfind 
>MacOSAll), or change the settings of the GUI one to also include 
>"system files").
>
>That said, this unit (just like all others) is only distributed in 
>compiled form with the installer, so it's not going to be very useful 
>to you. If you want the sources, you can download them here: 
>http://www.freepascal.org/down/source/sources.var
>
>Jonas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Breakpoints in certain procedure don't get hit.

2009-01-28 Thread Ken G. Brown
MacOS X 10.5.6, fpc 2.2.2

In Xcode 3.1.2 I'm having trouble getting breakpoints to get hit in a certain 
procedure. Breaks in other procedures in the same file work. I can break before 
entering the procedure but 'step into' just executes the procedure that 
apparently has breakpoints correctly set but they don't get hit.  Tried 
complete clean and rebuild.
Tried changing the procedure name to all caps.

I'm able to normally hit breaks in external C functions called from immediately 
before and after the procedure in question. C functions were compiled into a 
library in a separate project, then linked into the pascal project.

I'm running out of ideas. Anyone have some new things to try?

Thx for any tips.

Ken G. Brown
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Breakpoints in certain procedure don't get hit.

2009-01-29 Thread Ken G. Brown
Yay! That seems to have worked.
THANKS!
Ken

At 10:17 AM +0100 1/29/09, fpc-pascal-requ...@lists.freepascal.org apparently 
wrote:
>Date: Thu, 29 Jan 2009 08:45:31 +0200
>From: Jonas Maebe 
>Subject: Re: [fpc-pascal] Breakpoints in certain procedure don't get
>   hit.
>To: FPC-Pascal users discussions 
>Message-ID: <83ce8c91-7c3b-4b16-8ada-f46b0352b...@elis.ugent.be>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>
>On 29 Jan 2009, at 06:47, Ken G. Brown wrote:
>
>> In Xcode 3.1.2 I'm having trouble getting breakpoints to get hit in 
>> a certain procedure. Breaks in other procedures in the same file 
>> work. I can break before entering the procedure but 'step into' just 
>> executes the procedure that apparently has breakpoints correctly set 
>> but they don't get hit.  Tried complete clean and rebuild.
>
>
>Try changing the debug info from stabs into dwarf:
>
>In the project settings, under the Build tab, select the Debug 
>configuration, then the "All Settings" collection, filter on "fpc", 
>and add "-gw2" at the end of the FPC_SPECIFIC_OPTIONS settings. This 
>will switch the compiler from stabs to dwarf. Then clean and rebuild.
>
>Jonas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: building universal binary

2009-02-03 Thread Ken G. Brown
Further:
it appears that lipo cannot handle app bundles, so if I run it on the 
executable itself, it says it is ok, has both i386 and ppc. So I guess I'm 
missing something that tells Finder it is a universal binary, but what?

Thx,
Ken G. Brown

At 12:21 PM -0700 2/3/09, Ken G. Brown apparently wrote:
>Mac OS X 10.5.6, fpc 2.2.2, Xcode 3.1.2
>
>Have a Pascal program calling some C code from a static library I build in a 
>separate project so I can use the debugger.
>
>I've set Xcode to use gcc 4.0 targeting 10.4 for intel, and gcc 3.3 targetting 
>10.3.9 for PowerPC in both projects.
>
>So far I am basically using the fpc user defined options that came with the 
>template for building for calling C functions.
>
>Do I need to add some fpc options in order to properly compile for a universal 
>binary?
>
>I looked at my App using lipo -info fromTerminal and get the following error:
>lipo: Can't map input file: .../myapp/build/Release/myapp.app ((os/kern) 
>invalid argument)
>
>As well, in Finder Get Info for my app, the 'open using Rosetta checkbox is 
>greyed out and I cannot select it. Activity Monitor of course shows an intel 
>program but i need to deploy to PowerPC running 10.3.9.
>
>If I look at my 'C' library project product with lipo, I get Architectures in 
>the fat file: ./libkbCarbonLib.a are: i386 ppc 
>
>What else do I need to do in order to generate a universal binary? Do I need 
>to run the fpc ppc version somehow for the ppc side of tings? I suspect so but 
>cannot find what to do.
>
>Any tips appreciated.
>
>Thx,
>Ken G. Brown

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: building universal binary

2009-02-03 Thread Ken G. Brown
> > Have a Pascal program calling some C code from a static library I 
> > build in a separate project so I can use the debugger.
>
>You can also build it in a separate target of the same project and 
>then change the target-specific flags for that C library (as in the 
>"FPC-C-C++ Carbon Application 2.2.0" template).

Does this method still allow running gdb on the C code?

> > I looked at my App using lipo -info fromTerminal and get the 
> > following error:
> > lipo: Can't map input file: .../myapp/build/Release/myapp.app ((os/
> > kern) invalid argument)
>
>myapp.app is a folder (or more specifically, a bundle). The actual 
>program is .../myapp/build/Release/myapp.app/Contents/MacOS/myapp

Yep, finally figured that out.

> > As well, in Finder Get Info for my app, the 'open using Rosetta 
> > checkbox is greyed out and I cannot select it. Activity Monitor of 
> > course shows an intel program but i need to deploy to PowerPC 
> > running 10.3.9.

Now my latest build appears to allow running under Rosetta, but incorrectly.

> > If I look at my 'C' library project product with lipo, I get 
> > Architectures in the fat file: ./libkbCarbonLib.a are: i386 ppc
> >
> > What else do I need to do in order to generate a universal binary? 
> > Do I need to run the fpc ppc version somehow for the ppc side of 
> > tings? I suspect so but cannot find what to do.
>
>You have to go to the project's build settings for the configuration 
>that you are building (presumably "release"), and then set the 
>"Architectures" setting (the second from the top) to "Standard (32-bit 
>Universal)". This works at least for me with the "FPC-C-C++ Carbon 
>Application 2.2.0" template.
>

Yes is working now for me too, not sure what i did at this point to make it 
happen.

Thx

>Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] building universal binary

2009-02-03 Thread Ken G. Brown
Mac OS X 10.5.6, fpc 2.2.2, Xcode 3.1.2

Have a Pascal program calling some C code from a static library I build in a 
separate project so I can use the debugger.

I've set Xcode to use gcc 4.0 targeting 10.4 for intel, and gcc 3.3 targetting 
10.3.9 for PowerPC in both projects.

So far I am basically using the fpc user defined options that came with the 
template for building for calling C functions.

Do I need to add some fpc options in order to properly compile for a universal 
binary?

I looked at my App using lipo -info fromTerminal and get the following error:
lipo: Can't map input file: .../myapp/build/Release/myapp.app ((os/kern) 
invalid argument)

As well, in Finder Get Info for my app, the 'open using Rosetta checkbox is 
greyed out and I cannot select it. Activity Monitor of course shows an intel 
program but i need to deploy to PowerPC running 10.3.9.

If I look at my 'C' library project product with lipo, I get Architectures in 
the fat file: ./libkbCarbonLib.a are: i386 ppc  

What else do I need to do in order to generate a universal binary? Do I need to 
run the fpc ppc version somehow for the ppc side of tings? I suspect so but 
cannot find what to do.

Any tips appreciated.

Thx,
Ken G. Brown
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: building universal binary

2009-02-04 Thread Ken G. Brown
At 12:00 PM +0100 2/4/09, fpc-pascal-requ...@lists.freepascal.org apparently 
wrote:
>Date: Wed, 4 Feb 2009 10:50:17 +0100
>From: Jonas Maebe 
>Subject: Re: [fpc-pascal] Re: building universal binary
>To: FPC-Pascal users discussions 
>Message-ID: <00e64550-ae30-4db1-8882-e4b26e09c...@elis.ugent.be>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>
>On 03 Feb 2009, at 23:33, Ken G. Brown wrote:
>
>>>> Have a Pascal program calling some C code from a static library I
>>>> build in a separate project so I can use the debugger.
>>>
>>> You can also build it in a separate target of the same project and
>>> then change the target-specific flags for that C library (as in the
>>> "FPC-C-C++ Carbon Application 2.2.0" template).
>>
>> Does this method still allow running gdb on the C code?
>
>Yes. When you have separate targets, you can set separate options for 
>the different targets (so you can turn on gcc debugging info for the 
>library target and disable it for the FPC target).
>
>
>Jonas

So far I'm still in two projects but I'll try this method later, it will be 
easier I think. Don't want to change too many things right now.

Now everything seems pretty good, have universal bninary, building both debug 
and release versions, both run as desired under Xcode control.

Program formats output and sends directly to a serial port to a tractor feed 
printer.

However, when I try running from Finder, I get a short few characters out the 
serial port then the program dies. This is whether or not the 'run under 
Rosetta' box is checked in Get Info. Intel or PowerPC shows properly in 
Activity Monitor. I've tried inserting printf in the 'C' code just before the 
write statement but cannot find any output. Also tried fprintf's to stdout and 
stderr. I've tried running the program from Terminal to see if that helped. How 
and where should I be able to see output? Where should a write(var); go from 
the pascal side?

Debug print stuff shows up to the console when running under Xcode.

What should I look for that would cause it to work fine from Xcode but die from 
Finder?

MacOS 10.5.6, fpc 2.2.2, Xcode 3.1.2

Info.plist looks like:


http://www.apple.com/DTDs/PropertyList-1.0.dtd";>


CFBundleDevelopmentRegion
English
CFBundleExecutable
PrintSmallOSX
CFBundleIconFile

CFBundleIdentifier
com.yourcompany.PrintSmallOSX
CFBundleInfoDictionaryVersion
6.0
CFBundleName
PrintSmallOSX
CFBundlePackageType
        APPL
CFBundleSignature

CFBundleVersion
1.0
CSResourcesFileMapped

CFBundleShortVersionString
1.0.0



Thx for any tips,
Ken G. Brown
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] what needs changed to compile going from Carbon to Cocoa

2009-02-04 Thread Ken G. Brown
I've started my project from the FPC-C-C++ Carbon Application 2.2.0 template, 
have it compiling nicely now even tho it does not yet run from Finder. Now i 
would like to change it to a Cocoa app.

What settings do I need to change to accomplish this?

MacOS X 10.5.6, fpc 2.2.2, Xcode 3.1.2

Thx for any tips,
Ken G. Brown
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: building universal binary

2009-02-04 Thread Ken G. Brown
At 10:30 PM +0100 2/4/09, Jonas Maebe apparently wrote:
>On 04 Feb 2009, at 18:48, Ken G. Brown wrote:
>
>>However, when I try running from Finder, I get a short few characters out the 
>>serial port then the program dies. This is whether or not the 'run under 
>>Rosetta' box is checked in Get Info. Intel or PowerPC shows properly in 
>>Activity Monitor. I've tried inserting printf in the 'C' code just before the 
>>write statement but cannot find any output. Also tried fprintf's to stdout 
>>and stderr. I've tried running the program from Terminal to see if that 
>>helped. How and where should I be able to see output? Where should a 
>>write(var); go from the pascal side?
>
>For GUI apps, it will go to the console. Open 
>/Applications/Utilities/Console.app to see it.

Wasn't having any luck seeing it there either. I'm bring some legacy code 
forward, perhaps I'm missing some sort of startup code.

Thx,
Ken

>
>Jonas
>___
>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


[fpc-pascal] specifying the relative path to a file that is located in the same folder as the application bundle?

2009-02-04 Thread Ken G. Brown
MacOS X, 10.5.6, fpc 2.2.2

How can I find the directory path to the executable of the currently executing 
program from within the program?

Or alternately, how can I specify the relative path to a file that is located 
in the same folder as the application bundle for my currently executing program?

Using ./filename does not appear to work for me.

Are there file and directory type utilities available? Where can I read up on 
them?

Thx for any tips,
Ken G. Brown
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] specifying the relative path to a file that is located in the same folder as the application bundle?

2009-02-05 Thread Ken G. Brown
Thx for the quick response!
I think I'm almost there. I seem to have a bundlePath : CFURLRef; but I don't 
quite know what to do with it. How do I convert it to something I can use in a 
Reset() to open a file?

Thx,
Ken G. Brown

At 10:29 AM +0100 2/5/09, Jonas Maebe apparently wrote:
>On 05 Feb 2009, at 08:54, Ken G. Brown wrote:
>
>>How can I find the directory path to the executable of the currently 
>>executing program from within the program?
>>
>>Or alternately, how can I specify the relative path to a file that is located 
>>in the same folder as the application bundle for my currently executing 
>>program?
>>
>>Using ./filename does not appear to work for me.
>>
>>Are there file and directory type utilities available? Where can I read up on 
>>them?
>
>http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/CFBundles.html
>
>E.g., 
>http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/Tasks/locating.html#//apple_ref/doc/uid/20001123-123785
>
>
>Jonas
>___
>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


Re: [fpc-pascal] specifying the relative path to a file that is located in the same folder as the application bundle?

2009-02-05 Thread Ken G. Brown
Whew! Thx!
I was part way through all that but wasn't sure what I could pass to reset();
Digging through it now. I haven't dealt with this stuff before.

Ken

At 6:24 PM +0100 2/5/09, Jonas Maebe apparently wrote:
>On 05 Feb 2009, at 17:03, Ken G. Brown wrote:
>
>>Thx for the quick response!
>>I think I'm almost there. I seem to have a bundlePath : CFURLRef; but I don't 
>>quite know what to do with it. How do I convert it to something I can use in 
>>a Reset() to open a file?
>
>If you enter CFURLRef in the search box at the top right point of the page, 
>the first link in the search results is 
>http://developer.apple.com/documentation/CoreFoundation/Reference/CFBundleRef/Reference/reference.html
>
>The Overview section notes:
>
>***
>You can also obtain locations of subdirectories in a bundle represented as 
>CFURL objects. The CFBundleCopyExecutableURL function returns the location of 
>the application's executable. The functions CFBundleCopyResourceURL, 
>CFBundleCopySharedFrameworksURL, 
>CFBundleCopyPrivateFrameworksURL,CFBundleCopySharedSupportURL, and 
>CFBundleCopyBuiltInPlugInsURL return the location of a bundle's subdirectory 
>containing resources, shared frameworks, private frameworks, shared support 
>files, and plug-ins
>***
>
>Clicking on CFURLRef in the declarations of these functions redirects to 
>http://developer.apple.com/documentation/CoreFoundation/Reference/CFURLRef/Reference/reference.html#//apple_ref/doc/c_ref/CFURLRef
>
>On that page, under "Functions by Task" and then "Accessing the Parts of a 
>URL", there is a function called CFURLCopyFileSystemPath. This function can 
>return a POSIX path (kCFURLPOSIXPathStyle) in a CFStringRef.
>
>Clicking on CFStringRef redirects to 
>http://developer.apple.com/documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html#//apple_ref/doc/c_ref/CFStringRef
>
>There, under "Functions by Task" and then "String File System 
>Representations", there is a function called 
>CFStringGetFileSystemRepresentation, which in combination with 
>CFStringGetMaximumSizeOfFileSystemRepresentation can be used to obtain a 
>null-terminated string containing a path that can be passed to reset etc.
>
>
>Jonas
>___
>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


Re: [fpc-pascal] specifying the relative path to a file that is located in the same folder as the application bundle?

2009-02-05 Thread Ken G. Brown
So far I have the following external definitions:

Function CFStringGetFileSystemRepresentation(myPathString : CFStringRef; buffer 
: ppchar; maxBufLen : CFIndex) : Boolean; cdecl; External;
Function _CFStringGetFileSystemRepresentation(myPathString : CFStringRef; 
buffer : ppchar; maxBufLen : CFIndex) : Boolean; C; External;
 
Function CFStringGetMaximumSizeOfFileSystemRepresentation(myPathStr2 : 
CFStringRef) : CFIndex; cdecl; External;
Function _CFStringGetMaximumSizeOfFileSystemRepresentation(myPathStr2 : 
CFStringRef) : CFIndex; C; External;

Function CFBundleGetMainBundle() : CFBundleRef; cdecl; External;
Function _CFBundleGetMainBundle() : CFBundleRef; C; External;


and the following snippet

var
success : boolean = false;
mainBundle : CFBundleRef;
bundlePath : CFURLRef;
bundlePathStr : CFStringRef;
myBundlePathStr : ppchar;
begin

 
// Get the main bundle for the app
mainBundle := CFBundleGetMainBundle();
bundlePath := CFBundleCopyBundleURL(mainBundle);

bundlePathStr := CFURLCopyFileSystemPath (bundlePath, 
kCFURLPOSIXPathStyle);


success := CFStringGetFileSystemRepresentation (bundlePathStr, myBundlePathStr, 
CFStringGetMaximumSizeOfFileSystemRepresentation(bundlePathStr));

I'm not quite sure if I am doing the 2nd arg correctly, it's supposed to be 
char *buffer.

Does this look alright? If not, what should I be using for the 
myBundlePathString type?

And I notice that CFStringGetFileSystemRepresentation is only available for 
10.4 and newer. What do i need to do instead if wanting to deploy to 10.3.9?

Thx again for all the help, sooo close!
Ken  G. Brown


At 6:24 PM +0100 2/5/09, Jonas Maebe apparently wrote:
>On 05 Feb 2009, at 17:03, Ken G. Brown wrote:
>
>>Thx for the quick response!
>>I think I'm almost there. I seem to have a bundlePath : CFURLRef; but I don't 
>>quite know what to do with it. How do I convert it to something I can use in 
>>a Reset() to open a file?
>
>If you enter CFURLRef in the search box at the top right point of the page, 
>the first link in the search results is 
>http://developer.apple.com/documentation/CoreFoundation/Reference/CFBundleRef/Reference/reference.html
>
>The Overview section notes:
>
>***
>You can also obtain locations of subdirectories in a bundle represented as 
>CFURL objects. The CFBundleCopyExecutableURL function returns the location of 
>the application's executable. The functions CFBundleCopyResourceURL, 
>CFBundleCopySharedFrameworksURL, 
>CFBundleCopyPrivateFrameworksURL,CFBundleCopySharedSupportURL, and 
>CFBundleCopyBuiltInPlugInsURL return the location of a bundle's subdirectory 
>containing resources, shared frameworks, private frameworks, shared support 
>files, and plug-ins
>***
>
>Clicking on CFURLRef in the declarations of these functions redirects to 
>http://developer.apple.com/documentation/CoreFoundation/Reference/CFURLRef/Reference/reference.html#//apple_ref/doc/c_ref/CFURLRef
>
>On that page, under "Functions by Task" and then "Accessing the Parts of a 
>URL", there is a function called CFURLCopyFileSystemPath. This function can 
>return a POSIX path (kCFURLPOSIXPathStyle) in a CFStringRef.
>
>Clicking on CFStringRef redirects to 
>http://developer.apple.com/documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html#//apple_ref/doc/c_ref/CFStringRef
>
>There, under "Functions by Task" and then "String File System 
>Representations", there is a function called 
>CFStringGetFileSystemRepresentation, which in combination with 
>CFStringGetMaximumSizeOfFileSystemRepresentation can be used to obtain a 
>null-terminated string containing a path that can be passed to reset etc.
>
>
>Jonas
>___
>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


Re: [fpc-pascal] specifying the relative path to a file that is located in the same folder as the application bundle?

2009-02-05 Thread Ken G. Brown
At 9:51 PM +0100 2/5/09, Jonas Maebe apparently wrote:
>On 05 Feb 2009, at 21:29, Ken G. Brown wrote:
>
>>So far I have the following external definitions:
>
>All external definitions you need are already in the MacOSAll unit shipped 
>with FPC.
>
>>Function CFStringGetFileSystemRepresentation(myPathString : CFStringRef; 
>>buffer : ppchar; maxBufLen : CFIndex) : Boolean; cdecl; External;
>>Function _CFStringGetFileSystemRepresentation(myPathString : CFStringRef; 
>>buffer : ppchar; maxBufLen : CFIndex) : Boolean; C; External;
>>
>>Function CFStringGetMaximumSizeOfFileSystemRepresentation(myPathStr2 : 
>>CFStringRef) : CFIndex; cdecl; External;
>>Function _CFStringGetMaximumSizeOfFileSystemRepresentation(myPathStr2 : 
>>CFStringRef) : CFIndex; C; External;  
>>
>>Function CFBundleGetMainBundle() : CFBundleRef; cdecl; External;
>>Function _CFBundleGetMainBundle() : CFBundleRef; C; External;
>
>The ones with the extra underscore don't exist.
>
>>and the following snippet
>>
>>var
>>  success : boolean = false;
>>  mainBundle : CFBundleRef;
>>  bundlePath : CFURLRef;
>>  bundlePathStr : CFStringRef;
>>  myBundlePathStr : ppchar;
>
>myBundlePathStr has to be a pchar;
>
>>begin
>>
>>
>>// Get the main bundle for the app
>>  mainBundle := CFBundleGetMainBundle();
>>  bundlePath := CFBundleCopyBundleURL(mainBundle);
>>  
>>  bundlePathStr := CFURLCopyFileSystemPath (bundlePath, 
>> kCFURLPOSIXPathStyle);
>>  
>>  
>>success := CFStringGetFileSystemRepresentation (bundlePathStr, 
>>myBundlePathStr, 
>>CFStringGetMaximumSizeOfFileSystemRepresentation(bundlePathStr));
>>  
>>I'm not quite sure if I am doing the 2nd arg correctly, it's supposed to be 
>>char *buffer.
>>
>>Does this look alright? If not, what should I be using for the 
>>myBundlePathString type?
>
>You have to allocate memory for it. Something like
>
>myBundlePathStr:=getmem(CFStringGetMaximumSizeOfFileSystemRepresentation(bundlePathStr));
>success := CFStringGetFileSystemRepresentation (bundlePathStr, 
>myBundlePathStr, 
>CFStringGetMaximumSizeOfFileSystemRepresentation(bundlePathStr));

Ah! Sweet! I'm getting the path! Now all that's left is to get the path without 
the app name and add my filename! :)

Thank you Sir!

Ken

>When interfacing with C routines, you have to do the same things as if you 
>were using C.
>
>>And I notice that CFStringGetFileSystemRepresentation is only available for 
>>10.4 and newer. What do i need to do instead if wanting to deploy to 10.3.9?
>
>Call CFStringGetCStringPtr and/or CFStringGetCStringPtr and tell it to convert 
>to utf-8 (kCFStringEncodingUTF8).
>
>
>Jonas
>___
>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


Re: [fpc-pascal] specifying the relative path to a file that is located in the same folder as the application bundle?

2009-02-05 Thread Ken G. Brown
Thanks a bunch for all the help!
My legacy OS 9 app is now upgraded to OS X and working!
It put up a hell of a fight but with all your help, the obstacles have been 
overcome.
Awesome!

Ken G. Brown

At 9:51 PM +0100 2/5/09, Jonas Maebe apparently wrote:
><>
>You have to allocate memory for it. Something like
>
>myBundlePathStr:=getmem(CFStringGetMaximumSizeOfFileSystemRepresentation(bundlePathStr));
>success := CFStringGetFileSystemRepresentation (bundlePathStr, 
>myBundlePathStr, 
>CFStringGetMaximumSizeOfFileSystemRepresentation(bundlePathStr));
>
>When interfacing with C routines, you have to do the same things as if you 
>were using C.
>
>>And I notice that CFStringGetFileSystemRepresentation is only available for 
>>10.4 and newer. What do i need to do instead if wanting to deploy to 10.3.9?
>
>Call CFStringGetCStringPtr and/or CFStringGetCStringPtr and tell it to convert 
>to utf-8 (kCFStringEncodingUTF8).
>
>
>Jonas
>___
>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


Re: [fpc-pascal] specifying the relative path to a file that is located in the same folder as the application bundle?

2009-02-06 Thread Ken G. Brown
Basically from point of sale system running on Macintosh, I needed to pick up a 
file with a known name located in the same folder as the application bundle, 
and process it for printing in a custom format. This way it does not need the 
file path hard coded in case it is different on the different computers. All 
that is required os for the Prin.app to be located in the same folder as the 
file. There are certainly other options.
Here is what I ended up with that is working, I'm open to suggestions for 
improvement:
--
var
indexOfBundleNameStart : SInt32 = 0;
success : boolean = false;
mainBundle : CFBundleRef;
bundlePath : CFURLRef;
bundlePathStr : CFStringRef;
myBundlePathStr : pchar;
pathToPrintApp : Str255 = '';
const
printAppName : Str255 = 'Print.app';

begin
 
// Get the main bundle for the app
mainBundle := CFBundleGetMainBundle();
bundlePath := CFBundleCopyBundleURL(mainBundle);

bundlePathStr := CFURLCopyFileSystemPath (bundlePath, 
kCFURLPOSIXPathStyle);

myBundlePathStr := 
getmem(CFStringGetMaximumSizeOfFileSystemRepresentation(bundlePathStr));

success := CFStringGetFileSystemRepresentation (bundlePathStr, 
myBundlePathStr,

 CFStringGetMaximumSizeOfFileSystemRepresentation(bundlePathStr));

if (success = true) then {get rid of 'Print.app' at the end of the path}
   begin
   pathToPrintApp := copy(myBundlePathStr, 1, Length(myBundlePathStr));

   indexOfBundleNameStart := Pos(printAppName, pathToPrintApp);
   delete(pathToPrintApp, indexOFBundleNameStart, Length(printAppName));
 end;

//  Writeln(stdout, myBundlePathStr);
//  Writeln(stdout, 'Path to the app folder = ' + pathToPrintApp);
--  
You would do something similar to pick up the paths to the other files of 
interest within the app bundle package using whatever other routines necessary 
as Jonas indicated.

Ken G. Brown


At 7:25 AM -0600 2/6/09, Travis Siegel apparently wrote:
>So, as someone who only uses terminal apps written in fpc ( since ibuilder 
>isn't really that usable and writing interface generating code is still beyond 
>me despit trying for 4 years) Could you please post a copy of a code segment 
>that shows how you performed this little marvel of finding files inside the 
>app bundle? I've been trying (unsuccessfully) to imitate compiled programs by 
>running interpreters on files located inside an app bundle.  Thus far, I've 
>had little success, but if you've gotten this working, then it's exactly what 
>I was trying to do, and I sure could use your hard work. :-).
>
>
>On Feb 5, 2009, at 9:05 PM, Ken G. Brown wrote:
>
>>Thanks a bunch for all the help!
>>My legacy OS 9 app is now upgraded to OS X and working!
>>It put up a hell of a fight but with all your help, the obstacles have been 
>>overcome.
>>Awesome!
>>
>>Ken G. Brown
>>
>>At 9:51 PM +0100 2/5/09, Jonas Maebe apparently wrote:
>>><>
>>>You have to allocate memory for it. Something like
>>>
>>>myBundlePathStr:=getmem(CFStringGetMaximumSizeOfFileSystemRepresentation(bundlePathStr));
>>>success := CFStringGetFileSystemRepresentation (bundlePathStr, 
>>>myBundlePathStr, 
>>>CFStringGetMaximumSizeOfFileSystemRepresentation(bundlePathStr));
>>>
>>>When interfacing with C routines, you have to do the same things as if you 
>>>were using C.
>>>
>>>>And I notice that CFStringGetFileSystemRepresentation is only available for 
>>>>10.4 and newer. What do i need to do instead if wanting to deploy to 10.3.9?
>>>
>>>Call CFStringGetCStringPtr and/or CFStringGetCStringPtr and tell it to 
>>>convert to utf-8 (kCFStringEncodingUTF8).
>>>
>>>
>>>Jonas
>>>___
>>>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
>
>___
>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


Re: [fpc-pascal] specifying the relative path to a file that is located in the same folder as the application bundle?

2009-02-06 Thread Ken G. Brown
At 4:05 PM + 2/6/09, Frank Peelo apparently wrote:
>Ken G. Brown wrote:
>>Basically from point of sale system running on Macintosh, I needed
>>to pick up a file with a known name located in the same folder as
>>the application bundle, and process it for printing in a custom
>>format. This way it does not need the file path hard coded in case
>>it is different on the different computers.
>
>But, does what Jonas said not apply here? Is the Mac a multi-user machine now? 
>Even Windows has different users, hence c:\Documents and Settings\
>
>If the Mac has different users, maybe the file to be printed/processed should 
>go in the user's home directory? If the machine is to be used as a single POS 
>terminal, then a standard location for the file might be appropriate (does the 
>Mac have an equivalent to the Filesystem Hierarchy Standard in Linux?)

The POS computer is always automatically booted into a single user that is 
always the same but not necessarily the same user on a different terminal.
The information from the POS software for a custom invoice print format is 
presented in a file in the current folder of the POS software, I don't think 
there is a setting to control that but I'll look. So easiest for me right now 
is to put the custom print format output program there too, then the program 
works wherever the POS software is.

Thx,
Ken

>I don't know the Mac, or your app, so this is probably all wrong, or 
>inappropriate for you -- but I thought it worth mentioning because when I 
>started using Linux it was not at all obvious to me that what Jonas described 
>(the Unixy way of doing things) could work instead of the Windows way of 
>putting files in the same directory as the .exe file. But, surprisingly, it 
>does work quite well :)
>
>Frank
>
>___
>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


[fpc-pascal] troubles adding a second target

2009-02-07 Thread Ken G. Brown
MacOS X 10.5.6, fpc 2.2.2, Xcode 3.1.2

I have a working project started from the fpc supplied template.

I've tried to add a second target for testing which is more or less a copy of 
the first, although the source code has been duplicated and renamed and located 
in a subfolder of the project folder.

I added a carbon application  target since there was no Pascal option in the 
Add Target function.

I made sure that the membership checkboxes were only including the new source 
files in the new target.

At first I got errors that there was no build rule for the new source. So I 
added a rule for Pascal Source Files with custom script by analogy from the 
working target.
There was nothing to be seen in the custom script text box in the rule from the 
working target, and I added a copy of what was in the 'with output files:' text 
box
$(DERIVED_SOURCES_DIR)-$(CURRENT_VARIANT)/$(CURRENT_ARCH)/$(INPUT_FILE_BASE).s

Now when I try to build the new target, I get the following error:
/bin/sh -c
/bin/sh: -c: option requires an argument

Where does the custom script have to be set up? How does this work?

Or is there a better way to create a good new target?

Thx for any tips,
Ken G. Brown
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] troubles adding a second target

2009-02-07 Thread Ken G. Brown
At 11:19 AM +0100 2/7/09, Jonas Maebe apparently wrote:
>On 07 Feb 2009, at 09:20, Ken G. Brown wrote:
>
>>MacOS X 10.5.6, fpc 2.2.2, Xcode 3.1.2
>>
>>I have a working project started from the fpc supplied template.
>>
>>I've tried to add a second target for testing which is more or less a copy of 
>>the first, although the source code has been duplicated and renamed and 
>>located in a subfolder of the project folder.
>>
>>I added a carbon application  target since there was no Pascal option in the 
>>Add Target function.
>
>That's correct. The only way to compile Pascal code in Xcode is by setting up 
>everything manually. I don't know what you want to build in this extra target, 
>so I cannot say whether "application" is appropriate or not.
>
>>I made sure that the membership checkboxes were only including the new source 
>>files in the new target.
>>
>>At first I got errors that there was no build rule for the new source. So I 
>>added a rule for Pascal Source Files with custom script by analogy from the 
>>working target.
>>There was nothing to be seen in the custom script text box in the rule from 
>>the working target, and I added a copy of what was in the 'with output 
>>files:' text box
>>$(DERIVED_SOURCES_DIR)-$(CURRENT_VARIANT)/$(CURRENT_ARCH)/$(INPUT_FILE_BASE).s
>>
>>Now when I try to build the new target, I get the following error:
>>   /bin/sh -c
>>/bin/sh: -c: option requires an argument
>>
>>Where does the custom script have to be set up? How does this work?
>
>It is not trivial. The way it works with a single program target is that the 
>"fpc" target compiles all Pascal code to assembler code. It knows which source 
>file to compile because there is a Project setting called "FPC_MAIN_FILE" that 
>points to the main Pascal program file. The "fpc" target points the compiler 
>to this file, and the compiler then automatically compiles this file and all 
>units used by it.
>
>The program target is dependent on this fpc target (this is done by dragging 
>the "fpc" target on top of the program target), so the fpc target is executed 
>first by Xcode. The program target itself then assembles the generated 
>assembler files (the .../$(INPUT_FILE_BASE).s files mentioned above) into 
>object code. Together with the libfpc.a library, also generated by the fpc 
>target and added to the "Link Binary with Libraries" phase of the program 
>target, the Pascal code is linked into the program by Xcode.
>
>If you add a new target which should compile different Pascal sources, the 
>problem is you either have to
>a) add a duplicate fpc target which uses FPC_MAIN_FILE2 or so (requires 
>changing the "Compile Pascal Sources" script phase of that target, replacing 
>all occurrences of FPC_MAIN_FILE with FPC_MAIN_FILE2), add an FPC_MAIN_FILE2 
>setting to your project settings pointing to the main file for this new 
>program, and make your new program target dependent on this duplicated fpc 
>target
>b) make the new program target dependent on the original "fpc" target, but 
>change the project's FPC_MAIN_FILE setting every time you switch targets.
>
>All in all, it's probably easier to simply use separate projects (unless there 
>is a more convenient option I didn't think of).

Yes, it sounds like the new project is the way to go. Didn't think it would be 
so complicated.
Application is what I want so I can just do a new project easy enough.

Thx for your trouble explaining this.
Ken G. Brown

>
>Jonas
>___
>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


Re: [fpc-pascal] Origin of FPC features

2009-02-10 Thread Ken G. Brown
From:
<http://faculty.frostburg.edu/cosc/htracy/COSC450/MODULES/PasM2Ada.htm>
re: Pascal
It was originally designed, by one man, Nicholas Wirth, for teaching structured 
programming.

Ken G. Brown

At 8:56 PM -0800 2/9/09, leledumbo apparently wrote:
>I'm writing a paper about FPC and I need references where each language 
>feature comes from. So far, these are my what I know (some are guessing 
>though):
>
>Feature Original Dialect Additional Information Separate compilation UCSD 
>Pascal Unit based, not module (like Extended Pascal) Primitive OOP Turbo 
>Pascal C++ like Modern OOP (including exceptions) Delphi Java like, though FPC 
>was born before Java ;-) Assembler integration UCSD? Turbo? AT&T and Intel 
>External references UCSD? Turbo? - Operator overloading Pascal-XSC - Function 
>/ Procedure overloading Delphi - Dynamic arrays Delphi - Variants Delphi - 
>Arrays as parameter enhancements Delphi Open arrays, partial arrays Bitpacked 
>Structures Native FPC - Generics Native FPC - Thread Programming Native FPC? 
>Delphi? Bringing threads to language level
>
>In case I miss something that you know, please add. Note that these features 
>are related with language construct, not technical one (i.e. compiling speed, 
>makefiles).
>
>View this message in context: 
><http://www.nabble.com/Origin-of-FPC-features-tp21927731p21927731.html>Origin 
>of FPC features
>Sent from the <http://www.nabble.com/Free-Pascal---General-f683.html>Free 
>Pascal - General mailing list archive at Nabble.com.
>
>___
>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


[fpc-pascal] documentation for file handling, reset, rewrite, errors?

2009-02-10 Thread Ken G. Brown
I cannot seem to find the good docs for the file handling routines assign, 
rewrite and reset in the pdf's that came with fpc-2.2.2. Where might the best 
ones be?
I have:
User's Manual.pdf
Units Reference Guide.pdf
Programmer's Manual.pdf
Language Reference Guide.pdf
Free Component Library.pdf
Compiler Switches.pdf
Code Documented.pdf

I would like to find good descriptions of how they work, along with error 
handling and examples of how to how to best use them.

eg. can an internal memory based file be set to be written and read at the same 
time? Is the file read position independent of the write position?

If the internal file has been written to the end and the write operation is 
finished but the file is still open for writing, what needs to be done in order 
to start reading the file from the beginning?

Are streams available for reading and writing and are they preferable to while 
not eof (inFi) read(inFi) then write(outFi)?

Are exceptions useful?

Examples?

My goal is to create an internal file then dump it to a system usb printer.

I've found an example of writing to a pipe using assignlst (f,'|/usr/bin/lpr 
-m'); that seems to sorta work,
from here: <http://ubuntuforums.org/showthread.php?t=656110>, 2nd message.
Is that a good way to do output to a printer?

Thx again for any pointers.
Ken G. Brown
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] documentation for file handling, reset, rewrite, errors?

2009-02-11 Thread Ken G. Brown
Thx!

At 9:37 AM +0100 2/11/09, Michael Van Canneyt apparently wrote:
>On Tue, 10 Feb 2009, Ken G. Brown wrote:
>
>> I cannot seem to find the good docs for the file handling routines assign, 
>> rewrite and reset in the pdf's that came with fpc-2.2.2. Where might the 
>> best ones be?
>> I have:
>> User's Manual.pdf
>> Units Reference Guide.pdf
>
>Normally, the routines are documented here.

Ah, ok, I was searching for Reset and in the Units Reference Guide it oddly 
comes up #23 in the list. I didn't happen to catch it that far down.
This is what I was looking for.

Ken G. Brown

> > Programmer's Manual.pdf
>> Language Reference Guide.pdf
>> Free Component Library.pdf
>> Compiler Switches.pdf
> > Code Documented.pdf



> > I've found an example of writing to a pipe using assignlst 
> > (f,'|/usr/bin/lpr -m'); that seems to sorta work,
>> from here: <http://ubuntuforums.org/showthread.php?t=656110>, 2nd message.
>> Is that a good way to do output to a printer?
>
>On linux/unix there is no other reliable way.
>
>Michael.
>___
>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