~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/rtl/macos/macutils.pp

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
    This file is part of the Free Pascal run time library.
 
3
    Copyright (c) 2004 by Olle Raab
 
4
 
 
5
    Some utilities specific for Mac OS
 
6
    Modified portions from Peter N. Lewis (PNL Libraries). Thanks !
 
7
 
 
8
    See the file COPYING.FPC, included in this distribution,
 
9
    for details about the copyright.
 
10
 
 
11
    This program is distributed in the hope that it will be useful,
 
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
14
 
 
15
 **********************************************************************}
 
16
 
 
17
unit macutils;
 
18
 
 
19
interface
 
20
 
 
21
uses
 
22
  macostp;
 
23
 
 
24
function FourCharCodeToLongword(fourcharcode: Shortstring): Longword;
 
25
 
 
26
function BitIsSet(arg: Longint; bitnr: Integer): Boolean;
 
27
 
 
28
{ Converts MacOS specific error codes to the correct FPC error code.
 
29
  All non zero MacOS errors corresponds to a nonzero FPC error.}
 
30
function MacOSErr2RTEerr(err: OSErr): Integer;
 
31
 
 
32
 
 
33
{Translates a unix or dos path to a mac path. Even a mac path can be input, }
 
34
{then it is returned as is. A trailing directory separator in input}
 
35
{will result in a trailing mac directory separator. For absolute paths, the }
 
36
{parameter mpw affects how the root volume is denoted. If mpw is true, }
 
37
{the path is intended for use in MPW, and the environment variable Boot is}
 
38
{prepended. Otherwise the actual boot volume name is appended.}
 
39
{All kinds of paths are attempted to be translated, except relative path on}
 
40
{a certain drive, like: C:xxx\yyy }
 
41
 
 
42
function TranslatePathToMac (const path: string; mpw: Boolean): string;
 
43
 
 
44
 
 
45
{Concats the relative or full path1 to the relative path2.}
 
46
function ConcatMacPath (path1, path2: string): string;
 
47
 
 
48
 
 
49
function IsMacFullPath (const path: string): Boolean;
 
50
 
 
51
 
 
52
function IsDirectory (var spec: FSSpec): Boolean;
 
53
 
 
54
function PathArgToFSSpec(s: string; var spec: FSSpec): Integer;
 
55
 
 
56
function PathArgToFullPath(s: string; var fullpath: AnsiString): Integer;
 
57
 
 
58
{Gives the volume name (with appended colon) for a given volume reference number.}
 
59
function GetVolumeName(vRefNum: Integer; var volName: String): OSErr;
 
60
 
 
61
function GetWorkingDirectoryVRefNum: Integer;
 
62
 
 
63
{Find an application with the given creator, in any of the mounted volumes.}
 
64
function FindApplication (creator: OSType; var fs: FSSpec): OSErr;
 
65
 
 
66
{Launch the application given by applicationFileSpec. If toFront is true
 
67
 it will be brought to the foreground when launched.}
 
68
function LaunchFSSpec (tofront: Boolean; const applicationFileSpec: FSSpec): OSErr;
 
69
 
 
70
implementation
 
71
 
 
72
{Actually defined in system.pp. Declared here to be used in macutils.inc: }
 
73
var
 
74
  {emulated working directory}
 
75
  workingDirectorySpec: FSSpec; cvar; external;
 
76
 
 
77
{$I macutils.inc}
 
78
 
 
79
end.