浏览代码

Merged revisions 7057,7068-7069,7075-7079,7087,7094,7098-7099,7101,7103,7109,7115-7119,7128,7136-7137,7139,7150,7157,7160-7162,7175,7178-7179,7190-7195,7198,7202,7205-7206,7208-7217,7220-7222,7225-7228,7230,7233,7239-7241,7244,7246,7263,7275,7277,7279-7281,7285,7288-7289,7291-7293,7296,7300,7303,7310,7318,7340-7341,7343,7345,7349,7372-7373,7375-7376,7379,7381,7383-7388,7391-7392,7400,7404-7406,7411,7422,7425,7436,7441-7442,7444-7445,7450,7456,7463,7467,7475,7479,7486,7504,7506-7509,7522,7527,7534-7536,7558-7559,7563-7565,7567,7570-7571,7573-7576,7586,7589,7592-7594,7607,7612,7615,7619-7620,7622-7623,7626,7628,7631,7633,7646,7663,7677,7681-7683,7689,7697,7704-7712,7725,7736,7738,7740,7744-7746,7751,7753,7764,7767,7769-7770,7776-7777,7788,7830,7836-7839,7846,7849,7862,7864-7865,7869,7872,7877,7882,7927-7929,7953,7958,7961,7967-7969,7971,7986-7987,7990-7994,7998-8000,8003 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

........
r7057 | florian | 2007-04-03 17:46:43 +0200 (Tue, 03 Apr 2007) | 1 line

+ more symbian stuff from Felipe Monteiro de Carvalho
........
r7157 | sekelsenmat | 2007-04-23 07:33:02 +0200 (Mon, 23 Apr 2007) | 1 line

Improved Symbian OS support. Added c bindings. Simple softwares for the emulator now work
........
r7178 | sekelsenmat | 2007-04-28 07:56:29 +0200 (Sat, 28 Apr 2007) | 1 line

Improved symbian bindings and rtl. Now you can pass your string to the InfoPrint function, and the exit code is controled by the pascal software.
........
r7349 | sekelsenmat | 2007-05-15 20:39:29 +0200 (Tue, 15 May 2007) | 1 line

Improved Symbian RTL. Separated os include files from SDK include files and added more bindings
........
r7958 | sekelsenmat | 2007-07-05 17:19:38 +0200 (Thu, 05 Jul 2007) | 1 line

Added Symbian build tool
........
r7968 | sekelsenmat | 2007-07-06 13:04:55 +0200 (Fri, 06 Jul 2007) | 1 line

Improved mksymbian
........
r7969 | sekelsenmat | 2007-07-06 13:22:08 +0200 (Fri, 06 Jul 2007) | 1 line

Removed winlikewidestrings from symbian
........
r8003 | sekelsenmat | 2007-07-10 00:24:09 +0200 (Tue, 10 Jul 2007) | 1 line

Improved mksymbian
........

git-svn-id: branches/fixes_2_2@8480 -

peter 18 年之前
父节点
当前提交
261566e315

+ 20 - 0
.gitattributes

@@ -5312,12 +5312,23 @@ rtl/sparc/strings.inc svneol=native#text/plain
 rtl/sparc/stringss.inc svneol=native#text/plain
 rtl/symbian/Makefile svneol=native#text/plain
 rtl/symbian/Makefile.fpc svneol=native#text/plain
+rtl/symbian/bindings/pbeexe.cpp -text
+rtl/symbian/buildrtl.pp svneol=native#text/plain
+rtl/symbian/symbian.pas svneol=native#text/plain
+rtl/symbian/symbianinc/e32def.inc -text
+rtl/symbian/symbianinc/e32err.inc -text
+rtl/symbian/symbianinc/e32std.inc -text
 rtl/symbian/sysdir.inc svneol=native#text/plain
 rtl/symbian/sysfile.inc svneol=native#text/plain
 rtl/symbian/sysheap.inc svneol=native#text/plain
 rtl/symbian/sysos.inc svneol=native#text/plain
+rtl/symbian/sysosh.inc svneol=native#text/plain
 rtl/symbian/system.pp svneol=native#text/plain
 rtl/symbian/systhrd.inc svneol=native#text/plain
+rtl/symbian/uiq.pas svneol=native#text/plain
+rtl/symbian/uiqclasses.pas svneol=native#text/plain
+rtl/symbian/uiqinc/qikapplication.inc -text
+rtl/symbian/uiqinc/qikapplicationoo.inc -text
 rtl/ucmaps/8859-1.txt svneol=native#text/plain
 rtl/ucmaps/8859-10.txt svneol=native#text/plain
 rtl/ucmaps/8859-13.txt svneol=native#text/plain
@@ -8571,6 +8582,15 @@ utils/h2pas/yyparse.cod -text
 utils/kalyptus/kalyptus -text
 utils/kalyptus/kalyptusCxxToPas.pm -text
 utils/kalyptus/kalyptusDataDict.pm -text
+utils/mksymbian/Makefile.fpc -text
+utils/mksymbian/cfgfile.pas -text
+utils/mksymbian/cmdline.pas -text
+utils/mksymbian/compiler.pas -text
+utils/mksymbian/constants.pas -text
+utils/mksymbian/mksymbian.lpi -text
+utils/mksymbian/mksymbian.pas -text
+utils/mksymbian/projectparser.pas -text
+utils/mksymbian/sdkutil.pas -text
 utils/postw32.pp svneol=native#text/plain
 utils/ppdep.pp svneol=native#text/plain
 utils/ptop.pp svneol=native#text/plain

+ 7 - 6
compiler/systems/i_symbian.pas

@@ -1,7 +1,8 @@
 {
-    Copyright (c) 1998-2002 by Peter Vreman
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by contributors of the Free Pascal Compiler
 
-    This unit implements support information structures for win32
+    This unit implements support information structures for symbian os
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -32,11 +33,11 @@ unit i_symbian;
             system       : system_i386_SYMBIAN;
             name         : 'Symbian OS for i386';
             shortname    : 'Symbian';
-            flags        : [tf_files_case_aware,tf_has_dllscanner,tf_use_function_relative_addresses
-                            ,tf_smartlink_sections{,tf_section_threadvars}{,tf_needs_dwarf_cfi},tf_winlikewidestring];
+            flags        : [tf_files_case_aware, tf_has_dllscanner,
+                            tf_use_function_relative_addresses];
             cpu          : cpu_i386;
             unit_env     : 'SYMBIANUNITS';
-            extradefines : 'UNIX;SYMBIAN';
+            extradefines : 'SYMBIAN';
             exeext       : '.exe';
             defext       : '.def';
             scriptext    : '.bat';
@@ -58,7 +59,7 @@ unit i_symbian;
             Cprefix      : '_';
             newline      : #13#10;
             dirsep       : '\';
-            assem        : as_i386_pecoff;
+            assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
             linkextern   : nil;

+ 6 - 6
compiler/systems/t_symbian.pas

@@ -1,8 +1,9 @@
 {
-    Copyright (c) 1998-2002 by Peter Vreman
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by contributors of the Free Pascal Compiler
 
     This unit implements support import,export,link routines
-    for the (i386) Win32 target
+    for the Symbian OS target
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -31,7 +32,7 @@ interface
        symconst,symdef,symsym,
        script,gendef,
        cpubase,
-       import,export,link,cgobj,t_win, i_symbian;
+       import,export,link,cgobj, i_symbian;
 
     type
 	  TInternalLinkerSymbian = class(TInternalLinker)
@@ -46,7 +47,7 @@ implementation
     SysUtils,
     cfileutils,
     cpuinfo,cgutils,dbgbase,
-    owar,ogbase,ogcoff;
+    owar,ogbase,ogcoff, t_win;
 
 {****************************************************************************
                             TInternalLinkerSymbian
@@ -187,8 +188,7 @@ implementation
 
 initialization
 {$ifdef i386}
-  RegisterExternalLinker(system_i386_symbian_info,TExternalLinkerWin);
-  RegisterInternalLinker(system_i386_symbian_info,TInternalLinkerSymbian);
+  RegisterInternalLinker(system_i386_symbian_info,TExternalLinkerWin);
   RegisterImport(system_i386_symbian,TImportLibWin);
   RegisterExport(system_i386_symbian,TExportLibWin);
   RegisterDLLScanner(system_i386_symbian,TDLLScannerWin);

+ 229 - 54
rtl/symbian/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2007/08/29]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2007/09/13]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-embedded
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
@@ -237,160 +237,321 @@ RTL=..
 INC=$(RTL)/inc
 COMMON=$(RTL)/common
 PROCINC=$(RTL)/$(CPU_TARGET)
-OBJPASDIR=$(RTL)/objpas
+SYMBIANINC=./symbianinc
+UIQINC=./uiqinc
 UNITPREFIX=rtl
+OBJPASDIR=$(RTL)/objpas
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_UNITS+=system objpas macpas buildrtl
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_UNITS+=system
+override TARGET_UNITS+=system objpas macpas buildrtl
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override TARGET_IMPLICITUNITS+=ctypes strings symbian
 endif
 override INSTALL_FPCPACKAGE=y
 ifeq ($(FULL_TARGET),i386-linux)
@@ -543,6 +704,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC)
 endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC)
+endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC)
 endif
@@ -696,6 +860,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(COMMON)
 endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(COMMON)
+endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(COMMON)
 endif
@@ -1958,3 +2125,11 @@ SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
 SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
 system$(PPUEXT) : system.pp $(SYSDEPS)
 	$(COMPILER) -Us -Sg system.pp
+system$(PPUEXT) : system.pp $(SYSDEPS)
+	$(COMPILER) -Us -Sg system.pp -Fi../win
+objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc system$(PPUEXT)
+	$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
+macpas$(PPUEXT) : $(INC)/macpas.pp system$(PPUEXT)
+	$(COMPILER) $(INC)/macpas.pp $(REDIR)
+buildrtl$(PPUEXT): buildrtl.pp system$(PPUEXT) objpas$(PPUEXT) macpas$(PPUEXT)
+	$(COMPILER) -Fi$(OBJPASDIR)/sysutils -Fi$(OBJPASDIR)/classes -Fu$(PROCINC) -I$(OBJPASDIR) -I$(INC) -I$(SYMBIANINC) -I$(UIQINC) -Fu$(INC) -Fu$(OBJPASDIR) buildrtl

+ 24 - 2
rtl/symbian/Makefile.fpc

@@ -6,7 +6,9 @@
 main=rtl
 
 [target]
-units=system
+units=system objpas macpas buildrtl
+implicitunits=ctypes strings \
+      symbian
 
 [require]
 nortl=y
@@ -28,9 +30,13 @@ RTL=..
 INC=$(RTL)/inc
 COMMON=$(RTL)/common
 PROCINC=$(RTL)/$(CPU_TARGET)
-OBJPASDIR=$(RTL)/objpas
+SYMBIANINC=./symbianinc
+UIQINC=./uiqinc
+
 UNITPREFIX=rtl
 
+OBJPASDIR=$(RTL)/objpas
+
 [rules]
 .NOTPARALLEL:
 SYSTEMPPU=$(addsuffix $(PPUEXT),system)
@@ -56,3 +62,19 @@ SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
 
 system$(PPUEXT) : system.pp $(SYSDEPS)
         $(COMPILER) -Us -Sg system.pp
+
+#
+# Unit specific rules
+#
+
+system$(PPUEXT) : system.pp $(SYSDEPS)
+        $(COMPILER) -Us -Sg system.pp -Fi../win
+
+objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc system$(PPUEXT)
+        $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
+
+macpas$(PPUEXT) : $(INC)/macpas.pp system$(PPUEXT)
+        $(COMPILER) $(INC)/macpas.pp $(REDIR)
+
+buildrtl$(PPUEXT): buildrtl.pp system$(PPUEXT) objpas$(PPUEXT) macpas$(PPUEXT)
+        $(COMPILER) -Fi$(OBJPASDIR)/sysutils -Fi$(OBJPASDIR)/classes -Fu$(PROCINC) -I$(OBJPASDIR) -I$(INC) -I$(SYMBIANINC) -I$(UIQINC) -Fu$(INC) -Fu$(OBJPASDIR) buildrtl

+ 59 - 0
rtl/symbian/bindings/pbeexe.cpp

@@ -0,0 +1,59 @@
+/*
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by contributors of the Free Pascal Compiler
+
+    pbeexe.cpp
+
+    This file is part of the Pascal interface for the c++ API on Symbian OS
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************/
+#include <e32std.h>
+#include <e32base.h>
+
+extern "C"
+{
+
+/* Pascal Entry point declaration */
+long int Pascal_E32Main();
+
+/*******************************************************************
+*  File e32std.h
+*******************************************************************/
+
+/*******************************************************************
+*  Class User
+*******************************************************************/
+
+/*******************************************************************
+*  User::InfoPrint
+*******************************************************************/
+TInt User_InfoPrint(const char* aString)
+{
+    TPtrC8 pStr(reinterpret_cast<const TUint8*>(aString));
+    HBufC* buf = HBufC::New(pStr.Length());
+    if (buf == NULL)
+   	{
+    	return KErrNoMemory;
+    }
+    buf->Des().Copy(pStr);
+    User::InfoPrint(*buf);
+    return KErrNone;
+}
+
+
+} /* extern "C" */
+
+/*******************************************************************
+*  Symbian OS Entry Point
+*******************************************************************/
+TInt E32Main()
+{
+     return Pascal_E32Main();
+}

+ 11 - 0
rtl/symbian/buildrtl.pp

@@ -0,0 +1,11 @@
+unit buildrtl;
+
+  interface
+
+    uses
+      ctypes, strings,
+      symbian, uiq, uiqclasses;
+
+  implementation
+
+end.

+ 39 - 0
rtl/symbian/symbian.pas

@@ -0,0 +1,39 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by contributors of the Free Pascal Compiler
+
+    Symbian OS unit that adds common types, constants and functions
+    for the Symbian API
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit symbian;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses ctypes;
+
+{$include e32def.inc}
+{$include e32err.inc}
+{.$include e32const.inc}
+{.$include e32cmn.inc}
+{.$include e32std.inc}
+
+{ e32std.h header file }
+
+{ User class }
+
+function User_InfoPrint(aString: PChar): TInt; cdecl; external;
+
+implementation
+
+end.
+

+ 2865 - 0
rtl/symbian/symbianinc/e32def.inc

@@ -0,0 +1,2865 @@
+{%MainUnit ../symbian.pas}
+
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by contributors of the Free Pascal Compiler
+
+    This file is a pascal translation of the Symbian OS headers
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{ e32\include\e32def.h
+ *
+ * Copyright (c) Symbian Software Ltd 1994-2005. All rights reserved.
+ *
+ * NOTE: THIS FILE SHOULD BE ACCEPTABLE TO A C COMPILER
+ }
+
+{
+ * __LEAVE_EQUALS_THROW__ requires the compiler to support C++ exceptions
+ }
+{#ifndef __SUPPORT_CPP_EXCEPTIONS__
+#undef __LEAVE_EQUALS_THROW__
+#endif}
+
+
+
+
+
+{#ifdef __PROFILING__
+
+/**
+@publishedPartner
+@removed
+*/
+#define __PROFILE_START(aBin) RDebug::ProfileStart(aBin)
+
+/**
+@publishedPartner
+@removed
+*/
+#define __PROFILE_END(aBin)   RDebug::ProfileEnd(aBin)
+
+/**
+@publishedPartner
+@removed
+*/
+#define __PROFILE_RESET(aNumberOfBins) RDebug::ProfileReset(0,aNumberOfBins)
+
+/**
+@publishedPartner
+@removed
+*/
+#define __PROFILE_DISPLAY(aNumberOfBins) \
+			begin	TFixedArray<TProfile, aNumberOfBins> result; \
+				RDebug::ProfileResult(result.Begin(), 0, aNumberOfBins); \
+				for (TInt i=0; i<aNumberOfBins; i++)   \
+				RDebug::Print(_L("Profile bin %d:  Calls: %d, Clock ticks: %d\n" ),i,res[i].iCount,result[i].iTime);  \
+                        end
+#else /* __PROFILING__ */
+#define __PROFILE_START(aBin)
+#define __PROFILE_END(aBin)
+#define __PROFILE_RESET(aNumberOfBins)
+#define __PROFILE_DISPLAY(aNumberOfBins)
+#endif}
+
+
+
+{#if defined(__VC32__)
+/**
+@publishedAll
+@released
+*/
+#define __NO_CLASS_CONSTS__
+#if (_MSC_VER >= 1200)
+/**
+@publishedAll
+@released
+*/
+#define __NORETURN__ __declspec(noreturn)
+#else
+#define __NORETURN__
+#endif
+/**
+@publishedAll
+@released
+*/
+#define __NORETURN_TERMINATOR()
+/**
+@publishedAll
+@released
+*/
+#define IMPORT_C __declspec(dllexport)
+/**
+@publishedAll
+@released
+*/
+#define EXPORT_C __declspec(dllexport)
+/**
+@publishedAll
+@released
+*/
+#define NONSHARABLE_CLASS(x) class x
+/**
+@publishedAll
+@released
+*/
+#define NONSHARABLE_STRUCT(x) struct x
+/**
+@publishedAll
+@released
+*/
+#define __NO_THROW throw()
+/**
+@publishedAll
+@released
+*/
+#define __THROW(t) throw(t)
+#pragma warning( disable : 4355 )	/* 'this' used in base member initializer list */
+#pragma warning( disable : 4511 )	/* copy constructor could not be generated */
+#pragma warning( disable : 4512 )	/* assignment operator could not be generated */
+#pragma warning( disable : 4514 )	/* unreferenced inline function has been removed */
+#pragma warning( disable : 4699 )	/* Note: Using precompiled header %s */
+#pragma warning( disable : 4710 )	/* function not inlined */
+#pragma warning( disable : 4121 )	/* alignment sensitive to packing */
+#pragma warning( disable : 4273 )
+#pragma warning( disable : 4097 )	/* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */
+#pragma warning( disable : 4291 )	/* 'TAny *CBase::operator new(TUint,TLeave)' : no matching operator delete found; memory will not be freed if initialization throws an exception */
+
+#if _MSC_VER  >= 1100
+/**
+@publishedAll
+@released
+*/
+#define TEMPLATE_SPECIALIZATION template<>
+#else
+#define TEMPLATE_SPECIALIZATION
+#endif
+#endif}
+
+
+
+{#if defined(__CW32__)
+#undef __embedded_cplusplus
+/** @internalTechnology */
+#define __embedded_cplusplus	1
+#define __NO_CLASS_CONSTS__
+#define __NORETURN__
+#define __NORETURN_TERMINATOR()
+#define IMPORT_C __declspec(dllexport)
+#define EXPORT_C __declspec(dllexport)
+#define NONSHARABLE_CLASS(x) class x
+#define NONSHARABLE_STRUCT(x) struct x
+#define __NO_THROW throw()
+#define __THROW(t) throw(t)
+
+#define TEMPLATE_SPECIALIZATION template<>
+/**
+@publishedAll
+@released
+*/
+#define _asm	asm
+#ifndef __int64
+#pragma longlong on
+/** @internalTechnology */
+#define __int64  long long
+#endif
+#ifndef __SUPPORT_CPP_EXCEPTIONS__
+#pragma exceptions off    /* no support for C++ exception handling */
+#pragma RTTI off          /* no support for C++ runtime type information */
+#endif
+#if __MWERKS__ >= 0x3200
+#pragma warning off (10480)	/* deleteing void pointer is undefined */
+#pragma warning off (10350) /* N pad byte(s) inserted after data member */
+#endif
+#endif}
+
+
+
+{#if defined(__GCC32__)
+#define __NO_CLASS_CONSTS__
+#define __NORETURN__  __attribute__ ((noreturn))
+#ifdef __GCCV3__
+#define __NORETURN_TERMINATOR()
+#else
+#define __NORETURN_TERMINATOR()		abort()
+#endif
+#define IMPORT_C
+#if !defined __WINS__ && defined _WIN32 /* VC++ Browser Hack */
+#define EXPORT_C
+/** @internalTechnology */
+#define asm(x)
+#else
+#define EXPORT_C __declspec(dllexport)
+#endif
+#define NONSHARABLE_CLASS(x) class x
+#define NONSHARABLE_STRUCT(x) struct x
+#define __NO_THROW
+#define __THROW(t)
+#ifdef __EABI__
+#define TEMPLATE_SPECIALIZATION template<>
+#else
+#define TEMPLATE_SPECIALIZATION
+#endif
+#endif}
+
+
+
+{#ifdef __GCC32__
+/**
+@publishedAll
+@released
+*/
+#define __DOUBLE_WORDS_SWAPPED__
+#endif}
+
+
+
+{ @internalTechnology }
+{#define __NO_MUTABLE_KEYWORD
+#if defined(__NO_MUTABLE_KEYWORD)
+/**
+@publishedAll
+@deprecated
+*/
+#define __MUTABLE
+#else
+#define __MUTABLE mutable
+#endif}
+
+
+
+{/**
+@publishedAll
+@deprecated
+*/
+#define CONST_CAST(type,exp) (const_cast<type>(exp))
+
+/**
+@publishedAll
+@deprecated
+*/
+#define STATIC_CAST(type,exp) (static_cast<type>(exp))
+
+/**
+@publishedAll
+@deprecated
+*/
+#define REINTERPRET_CAST(type,exp) (reinterpret_cast<type>(exp))
+
+#if defined(__NO_MUTABLE_KEYWORD)
+/**
+@publishedAll
+@deprecated
+*/
+#define MUTABLE_CAST(type,exp) (const_cast<type>(exp))
+#else
+#define MUTABLE_CAST(type,exp) (exp)
+#endif
+
+/**
+@publishedAll
+@deprecated
+*/
+#define GLREF_D extern
+/**
+@publishedAll
+@deprecated
+*/
+#define GLDEF_D
+/**
+@publishedAll
+@deprecated
+*/
+#define LOCAL_D static
+/**
+@publishedAll
+@deprecated
+*/
+#define GLREF_C extern
+/**
+@publishedAll
+@deprecated
+*/
+#define GLDEF_C
+/**
+@publishedAll
+@deprecated
+*/
+#define LOCAL_C static
+/**
+@publishedAll
+@deprecated
+*/
+#define FOREVER for(;;)}
+
+
+
+
+{/**
+@publishedAll
+@released
+
+Symbolic definition for a true value.
+*/
+#define TRUE 1}
+
+
+
+
+{/**
+@publishedAll
+@released
+
+Symbolic definition for a false value.
+*/
+#define FALSE 0
+#ifndef NULL}
+
+
+
+
+{/**
+@publishedAll
+@released
+
+Symbolic definition for a NULL value.
+*/
+#define NULL 0
+#endif}
+
+
+
+
+{#ifndef VA_START
+/**
+@publishedAll
+@released
+
+A macro used by Symbian OS code for handling a variable argument list
+in a function call.
+
+Sets a pointer to point to the first of the variable arguments.
+
+Typical usage:
+
+@code
+Foo(CAbcdef aAbcdef,...)
+   {
+   VA_LIST list;
+   VA_START(list, aAbcdef);
+   // other code
+   }
+@endcode
+
+@param ap   A pointer used to hold the address of an argument in
+            the variable argument list. After execution of the code generated
+            by this macro, the pointer points to the first argument in
+            the variable argument list.
+            This symbol is usually declared as a VA_LIST type.
+
+@param pn   The argument that immediately precedes the variable argument list.
+
+@see VA_LIST
+@see VA_ARG
+*/
+#define VA_START(ap,pn) ((ap)[0]=(TInt8 *)&pn+((sizeof(pn)+sizeof(TInt)-1)&~(sizeof(TInt)-1)),(void)0)
+#endif}
+
+
+
+
+{#ifndef VA_ARG
+/**
+@publishedAll
+@released
+
+A macro used by Symbian OS code for handling a variable argument list
+in a function call.
+
+Increments a pointer to a variable argument list to point to the next argument
+in the list. The current argument is assumed to be of a type defined by
+the second parameter to this macro.
+
+Typical usage:
+
+@code
+Foo(CAbcdef aAbcdef,...)
+   {
+   VA_LIST list;
+   VA_START(list, aAbcdef);
+   ...
+   TInt x = VA_ARG(list,TInt);
+   ...
+   const TDesC *pS=VA_ARG(aList,const TDesC*);
+   ...
+   etc
+   }
+@endcode
+
+@param ap   A pointer used to hold the address of an argument in
+            the variable argument list. It is assumed to point to the current
+            argument in the variable argument list. After execution of the code
+            generated by this macro, the pointer points to the next argument in
+            the list. This symbol is usually declared as a VA_LIST type.
+
+@param type The type of the current argument.
+            This can be any valid type, for example, TInt, const TDesC*, etc.
+
+@see VA_LIST
+@see VA_START
+*/
+#define VA_ARG(ap,type) ((ap)[0]+=((sizeof(type)+sizeof(TInt)-1)&~(sizeof(TInt)-1)),(*(type *)((ap)[0]-((sizeof(type)+sizeof(TInt)-1)&~(sizeof(TInt)-1)))))
+#endif }
+
+
+
+
+{#ifndef VA_END
+/**
+@publishedAll
+@released
+
+A macro used by Symbian OS code for handling a variable argument list
+in a function call.
+
+Sets a pointer to zero.
+
+@param ap   A pointer used to hold the address of an argument in
+            the variable argument list. After execution of the code generated
+            by this macro, the pointer is reset to 0.
+            This symbol is usually declared as a VA_LIST type.
+
+@see VA_LIST
+@see VA_START
+@see VA_ARG
+*/
+#define VA_END(ap) ((ap)[0]=0,(void)0)
+#endif}
+
+
+
+{/**
+@publishedAll
+@released
+
+Calculates the offset of member f within class c.
+
+This is used in the TSglQue and TDblQue constructors to set the offset of
+the link object from the start of a list element.
+
+@param c The name of the class.
+@param f The name of the member within the specified class.
+
+@see TSglQue
+@see TDblQue
+*/
+#define _FOFF(c,f)			(((TInt)&(((c *)0x1000)->f))-0x1000)
+
+
+
+/**
+@internalTechnology
+@released
+*/
+#define _ALIGN_DOWN(x,a)	((x)&~((a)-1))
+/**
+@internalTechnology
+@released
+*/
+#define _ALIGN_UP(x,a)		_ALIGN_DOWN((x)+(a)-1, a)
+
+
+}
+
+{
+@publishedAll
+@released
+
+Pointer to any type.
+
+TAny* is equivalent to void* in standard C or C++. TAny* is used in preference
+to void* because it is more suggestive of the actual meaning,
+e.g. TAny* foo();.
+
+TAny is not used where it really means "nothing", as in the declaration of
+functions which do not return a value; void is used instead, e.g. void Foo();.
+}
+type TAny = Pointer;
+
+
+
+
+{
+@publishedAll
+@released
+
+8-bit signed integer type, used in Symbian OS to mean an 8-bit
+unsigned integer, independent of the implementation.
+}
+type TInt8 = Byte;
+
+
+
+
+{
+@publishedAll
+@released
+
+8-bit unsigned integer type; used in Symbian OS to mean an 8-bit
+unsigned integer, independent of the implementation.
+}
+type TUint8 = Char;
+
+
+
+
+{
+@publishedAll
+@released
+
+16-bit signed integer type, used in Symbian OS to mean a 16-bit
+unsigned integer, independent of the implementation.
+}
+type TInt16 = ShortInt;
+
+
+
+
+{
+@publishedAll
+@released
+
+16-bit unsigned integer type. used in Symbian OS to mean a 16-bit
+unsigned integer, independent of the implementation.
+}
+type TUint16 = Word;
+
+
+
+
+{
+@publishedAll
+@released
+
+32-bit signed integer type, used in Symbian OS to mean a 32-bit
+unsigned integer, independent of the implementation.
+}
+type TInt32 = Integer;
+
+
+
+
+{
+@publishedAll
+@released
+
+32-bit unsigned integer type; used in Symbian OS to mean a 32-bit
+unsigned integer, independent of the implementation.
+}
+type TUint32 = Cardinal;
+
+
+
+
+{
+@publishedAll
+@released
+
+Signed integer type of the natural machine word length.
+
+This is as defined by the C++ implementation's int type. In all
+implementations, this is guaranteed to be at least 32 bits.
+
+A TInt should be used in preference to a sized integer (TInt32, TInt16) for
+all general use. Sized integers should only be used when packing is essential.
+C++'s type conversion rules imply that all sized integers smaller than the
+natural machine word are in any case broadened to the natural machine word
+size when passed as function parameters.
+
+A TInt should be used in preference to an unsigned integer (TUint) for all
+general use. Unsigned integers should only be used for flags (which use Boolean
+operations but not arithmetic) and, in very rare cases, for numbers whose
+range exceeds that available from signed integers. Although it is natural
+to attempt to use unsigned integers for quantities which cannot by nature
+be negative, the C++ language does not provide the support necessary to enforce
+the "expected" behaviour in these circumstances, and experience has shown
+that it is better to use signed integers unless there is good reason not to.
+
+@see TUint
+@see TInt32
+@see TInt16
+}
+type TInt = cint;
+
+
+
+
+{
+@publishedAll
+@released
+
+Unsigned integer type of the natural machine word length.
+
+This is guaranteed to be at least 32 bits in all implementations.
+
+In almost all circumstances, a TInt should be used in preference to a TUint.
+The main exception is in flags bytes.
+
+@see TInt
+}
+type TUint = cuint;
+
+
+
+
+{
+@publishedAll
+@released
+
+32-bit floating point number, providing IEEE754 single precision on all Symbian
+OS implementations.
+
+TReal should normally be used in preference to TReal32.
+
+Use of floating-point numbers should generally be avoided unless a natural
+part of the problem specification. Most Symbian OS implementations do not
+have a hardware floating point unit: as a result, their floating-point performance
+is hundreds of times slower than integer performance.
+}
+//type float TReal32;
+
+
+
+
+{
+@publishedAll
+@released
+
+64-bit floating point number, providing IEEE754 double precision on all Symbian
+OS implementations.
+
+Use of floating-point numbers should generally be avoided unless a natural
+part of the problem specification. Most Symbian OS implementations do not
+have a hardware floating point unit: as a result, their floating-point performance
+is hundreds of times slower than integer performance.
+
+This type is identical to TReal.
+
+@see TReal
+}
+//type double TReal64;
+
+
+
+
+{
+@publishedAll
+@released
+
+64-bit floating point number; identical to TReal64.
+
+Use of floating-point numbers should generally be avoided unless a natural
+part of the problem specification. Most Symbian OS implementations do not
+have a hardware floating point unit: as a result, their floating-point performance
+is hundreds of times slower than integer performance.
+
+Most serious floating-point calculations require double-precision. All standard
+math functions (see Math class) take double-precision arguments. Single-precision
+should only be used where space and performance are at a premium, and when
+their limited precision is acceptable.
+
+@see TReal64
+@see Math
+}
+//type double TReal;
+
+
+
+
+{
+@publishedAll
+@released
+
+8-bit unsigned character.
+
+Use instead of C++ built-in char type because it is guaranteed to be unsigned.
+Use instead of TInt8 where the application is really for text rather than
+8-bit arithmetic or binary quantities.
+
+For most purposes, you should use TText rather than TText8. TText is mapped
+onto either TText8 or TText16 depending on whether a non-Unicode or Unicode
+variant is being built. Use TText8 only when you are dealing explicitly with
+8-bit text, regardless of build.
+
+@see TText }
+type TText8 = Char;
+
+
+
+
+{
+@publishedAll
+@released
+
+16-bit unsigned character.
+
+Use instead of C++ wchar_t type because it is guaranteed to be unsigned. Use
+instead of TInt16 where the application is really for text rather than 8-bit
+arithmetic or binary quantities.
+
+For most purposes, you should use TText rather than TText16. TText is mapped
+onto either TText8 or TText16 depending on whether a non-Unicode or Unicode
+variant is being built. Use TText16 only when you are dealing explicitly with
+16-bit text, regardless of build.
+
+@see TText
+}
+type TText16 = Word;
+
+
+
+
+{
+@publishedAll
+@released
+
+Boolean type which takes the value either ETrue or EFalse.
+
+Although only a single bit would theoretically be necessary to represent a
+Boolean, a machine word is used instead, so that these quantities can be easily
+passed. Also, TBool must map onto int because of C++'s interpretation of
+operands in conditional expressions.
+
+On implementations of Symbian OS in which the compiler supports the ANSI-recommended
+bool type, TBool will be type'ed to bool instead of int.
+}
+//type int TBool;
+
+
+
+
+{
+@publishedPartner
+@released
+
+Defines a linear (virtual) address type.
+}
+type TLinAddr = TUint32;
+
+{
+@internalTechnology
+
+A sorted list of all the code segments in ROM that contain an Exception Descriptor.
+
+}
+type
+  TRomExceptionSearchTable = record
+        {
+	The number of entries in the following table.
+        }
+	iNumEntries: TInt32;
+
+        {
+	Address of the code segment of each TRomImageHeader that has an Exception Descriptor.
+        }
+	iEntries: array[0..0] of TLinAddr;
+  end;
+
+{
+@internalComponent
+}
+{type
+ TExceptionDescriptor = record
+	TLinAddr iExIdxBase;
+	TLinAddr iExIdxLimit;
+	TLinAddr iROSegmentBase;
+	TLinAddr iROSegmentLimit;
+  end;}
+
+
+{$if defined(__GCC32__)}
+
+
+
+
+{
+@publishedAll
+@released
+
+Defines a 64-bit signed integer type.
+}
+//type Int64;
+
+
+
+
+{
+@publishedAll
+@released
+
+Defines a 64-bit unsigned integer type.
+}
+//type unsigned long long Uint64;
+
+
+
+
+{
+@publishedAll
+@released
+}
+#define	I64LIT(x)	x##LL
+{
+@publishedAll
+@released
+}
+#define	UI64LIT(x)	x##ULL
+
+#elif defined(__VC32__)
+type __int64 Int64;
+type unsigned __int64 Uint64;
+#define	I64LIT(x)	(__int64)##x
+#define	UI64LIT(x)	(unsigned __int64)##x
+
+#elif defined(__CW32__)
+#pragma longlong on
+type long long Int64;
+type unsigned long long Uint64;
+#define	I64LIT(x)	x##LL
+#define	UI64LIT(x)	x##ULL
+{$endif}
+
+
+
+
+{
+@publishedAll
+@released
+
+Defines a 64-bit signed integer type.
+
+NOTE: For those migrating from versions of Symbian OS before 8.1b (i.e. 8.1a, 7.0s etc)
+TInt64 is now defined as a built-in type instead of as a class type. This means
+that the member functions of the old TInt64 class are no longer exported
+from EUSER.LIB, and represents a compatibility break.
+
+To ease migration of source code, a number of macros are provided. Similar
+macros have also been defined in Symbian OS versions 7.0s and 8.1a, but
+implemented in terms of the old TInt64 class. This is important for code that
+is common to : one or both of these Symbian OS versions, and to 8.1b and
+subsequent versions.
+
+The following list shows the new macros and the functions that they replace.
+It also shows some alternative techniques.
+In this list: x, v and r are declared as TInt64, c is declared as TInt, High
+and Low are declared as TUint.
+
+@code
+OLD USAGE						REPLACEMENT
+
+TInt64(High,Low);				MAKE_TINT64(High,Low);
+x.Set(High,Low);				MAKE_TINT64(High,Low);
+x.Low();						I64LOW(x);
+x.High();						I64HIGH(x);
+x.GetTInt();					I64INT(x);
+x.GetTReal();					I64REAL(x);
+x.Lsr(c);						I64LSR(x,c);
+x.Mul10();						x*=10;
+x.MulTop(a);					I64MULTOP(x,a);
+x.DivMod(v,r);					r=x%v; x/=v;
+@endcode
+}
+type	TInt64 = Int64;
+
+
+
+
+{
+@publishedAll
+@released
+
+Defines a 64-bit unsigned integer type.
+}
+//type	Uint64	TUint64;
+
+
+
+
+{ @internalComponent }
+//#define _MAKE_TINT64_ZX(x)	((TInt64)((TUint32)(x)))
+
+{ @internalComponent }
+//#define _MAKE_TUINT64_ZX(x)	((TUint64)((TUint32)(x)))
+
+
+
+
+{
+@publishedAll
+@released
+}
+//#define MAKE_TINT64(h,l)	( (_MAKE_TINT64_ZX(h)<<32) | _MAKE_TINT64_ZX(l) )
+
+
+
+
+{
+@publishedAll
+@released
+}
+//#define MAKE_TUINT64(h,l)	( (_MAKE_TUINT64_ZX(h)<<32) | _MAKE_TUINT64_ZX(l) )
+
+
+
+
+{
+@publishedAll
+@released
+
+Generates code to access the high order 32 bits of a 64 bit number.
+}
+//#define	I64HIGH(x)			( (TUint32)((x)>>32) )
+
+
+
+
+{
+@publishedAll
+@released
+
+Generates code to access the low order 32 bits of a 64 bit number.
+}
+//#define	I64LOW(x)			( (TUint32)(x) )
+
+
+
+
+{
+@publishedAll
+@released
+
+Generates code to cast a 64 bit value as an signed integer.
+}
+//#define	I64INT(x)			( (TInt)(x) )
+
+
+
+
+{
+@publishedAll
+@released
+
+Generates code to cast a 64 bit value as a TReal type.
+}
+//#define	I64REAL(x)			( (TReal)(x) )
+
+
+
+
+{
+@publishedAll
+@released
+
+Generates code to logically shift a 64 bit integer right.
+}
+//#define	I64LSR(x, shift)	( *reinterpret_cast<TUint64*>(&(x)) >>= (shift) )
+
+
+
+{
+@publishedAll
+@released
+
+Generates code to multiply a 64 bit integer by 10.
+}
+//#define	I64MUL10(x)			( (x) *= 10 )
+
+
+
+{
+@publishedAll
+@released
+
+Generates code to divide a 64 bit integer by another and find the remainder.
+}
+//#define	I64DIVMOD(x, divisor, remainder)	( ((remainder) = (x) % (divisor), (x) /= (divisor)) )
+
+
+
+
+{
+@publishedAll
+@released
+
+Generates code to cast a double to a 64 bit integer.
+}
+//#define	I64DOUBLECAST(x)	( static_cast<TInt64>(x) )
+
+
+
+
+{
+@publishedAll
+@deprecated Use _LIT8 instead.
+
+8-bit literal.
+
+The macro defines an explicit 8-bit constant literal which is suitable
+for non-Unicode literal text, regardless of the build.
+
+@see _L
+@see _LIT8
+@see _LIT
+}
+//#define _L8(a) (TPtrC8((const TText8 *)(a)))
+
+
+
+
+{
+@publishedAll
+@released
+
+Defines an explicit 8-bit string which is suitable when non-Unicode text
+is required, regardless of the build.
+
+This is used by the deprecated literal descriptor _L8.
+}
+//#define _S8(a) ((const TText8 *)a)
+
+
+
+
+{
+@publishedAll
+@released
+
+Constructs a constant literal descriptor of type TLitC8<TInt> with
+the specified name and text.
+
+The 8-bit build variant is generated for both non-Unicode and Unicode builds.
+
+@param name The name of the C++ variable to be generated.
+@param s    The literal text enclosed within a pair of double quotes.
+
+@see _LIT
+}
+//#define _LIT8(name,s) const static TLitC8<sizeof(s)> name={sizeof(s)-1,s}
+
+
+
+
+{
+@publishedAll
+@deprecated Use _LIT16 instead.
+
+16-bit literal.
+
+The macro defines an explicit 16-bit constant literal which is suitable
+for Unicode literal text, regardless of the build.
+
+@see _L
+@see _LIT16
+@see _LIT
+}
+//#define _L16(a) (TPtrC16((const TText16 *)L ## a))
+
+
+
+{
+@publishedAll
+@released
+
+Defines an explicit 16-bit string which is suitable when Unicode text
+is required, regardless of the build.
+
+This is used by the deprecated literal descriptor _L16.
+}
+//#define _S16(a) ((const TText16 *)L ## a)
+
+
+
+
+{
+@publishedAll
+@released
+
+Constructs a constant literal descriptor of type TLitC16<TInt> with
+the specified name and text.
+
+The 16-bit build variant is generated for both non-Unicode and Unicode builds.
+
+@param name The name of the C++ variable to be generated.
+@param s    The literal text enclosed within a pair of double quotes.
+
+@see _LIT
+}
+//#define _LIT16(name,s) const static TLitC16<sizeof(L##s)/2> name={sizeof(L##s)/2-1,L##s}
+
+
+
+
+{$if defined(_UNICODE) and not defined(__KERNEL_MODE__)}
+{
+@publishedAll
+@released
+
+Build independent general text character.
+
+In non-Unicode builds, this is mapped to TText8. In Unicode builds, this is
+mapped to TText16. Use the classes with explicit width only when you wish
+the width to be independent of the build variant.
+
+Use this class rather than TChar for general use.
+}
+type TText16 TText;
+
+
+
+{
+@publishedAll
+@deprecated Use _LIT instead.
+
+Build independent literal.
+
+The macro defines either an 8-bit constant literal (for non-Unicode text),
+or a 16-bit constant literal (for Unicode text) depending on the build.
+
+@see _LIT
+@see _L16
+@see _L8
+}
+#define _L(a) (TPtrC((const TText *)L ## a))
+
+
+
+
+{
+@publishedAll
+@released
+
+Defines either an 8-bit string (for non-Unicode text),
+or a 16-bit string (for Unicode text) depending on the build.
+
+This is used by the deprecated build independent literal _L.
+}
+#define _S(a) ((const TText *)L ## a)
+
+
+
+
+{
+@publishedAll
+@released
+
+Constructs a build independent constant literal descriptor of type TLitC<TInt>
+with the specified name and text.
+
+An 8-bit build variant is generated for a non-Unicode build;
+A 16-bit build variant is generated for a Unicode build.
+
+@param name The name of the C++ variable to be generated.
+@param s    The literal text enclosed within a pair of double quotes.
+
+@see _LIT16
+@see _LIT8
+}
+#define _LIT(name,s) const static TLitC<sizeof(L##s)/2> name={sizeof(L##s)/2-1,L##s}
+
+
+
+
+{$else}
+{
+@publishedAll
+@released
+
+Build independent general text character.
+
+In non-Unicode builds, this is mapped to TText8. In Unicode builds, this is
+mapped to TText16. Use the classes with explicit width only when you wish
+the width to be independent of the build variant.
+
+Use this class rather than TChar for general use.
+}
+type TText = TText8;
+
+
+
+{
+@publishedAll
+@released
+
+@deprecated Use _LIT instead.
+
+Build independent literal.
+
+The macro defines either an 8-bit constant literal (for non-Unicode text),
+or a 16-bit constant literal (for Unicode text) depending on the build.
+
+@see _LIT
+@see _L16
+@see _L8
+}
+//#define _L(a) (TPtrC((const TText *)(a)))
+
+
+
+
+{
+@publishedAll
+@released
+
+Defines either an 8-bit string (for non-Unicode text),
+or a 16-bit string (for Unicode text) depending on the build.
+
+This is used by the deprecated build independent literal _L.
+}
+//#define _S(a) ((const TText *)a)
+
+
+
+
+{
+@publishedAll
+@released
+
+Constructs a build independent constant literal descriptor of type TLitC<TInt>
+with the specified name and text.
+
+An 8-bit build variant is generated for a non-Unicode build;
+A 16-bit build variant is generated for a Unicode build.
+
+@param name The name of the C++ variable to be generated.
+@param s    The literal text enclosed within a pair of double quotes.
+
+@see _LIT16
+@see _LIT8
+}
+//#define _LIT(name,s) const static TLitC<sizeof(s)> name={sizeof(s)-1,s}
+{$endif}
+
+
+
+
+{$ifndef __VA_LIST_defined}
+{
+@publishedAll
+@released
+
+Defines a 'C' style array of pointers to TInt8 types.
+
+The type is most commonly used by code that needs to deal with a variable
+number of arguments passed to a function.
+
+@see TInt8
+}
+//type TInt8 *VA_LIST[1];
+{$endif}
+
+{
+@publishedAll
+@released
+
+Asserts that a condition is true.
+
+Code is generated for all builds.
+
+This macro is used as a C++ statement to assert the truth of some condition,
+and to take appropriate action if the condition is false. Unlike __ASSERT_DEBUG
+it is defined in both release and debug builds.
+
+The most common use for this macro is to check that the external environment of
+a function or class is behaving as expected; for example, that parameters
+passed to a function are credible, or that called functions are behaving as
+expected; the macro is commonly placed at the beginning of a function.
+
+The effect of the macro is to generate code which tests
+the conditional expression c; if the expression is false, then
+function p is called. In the majority of cases, the function p is one that
+raises a panic.
+
+Note that the macro definition is, in effect, equivalent to:
+
+@code
+if !(c)p;
+@endcode
+
+@param c a conditional expression which results in true or false.
+@param p a function which is called if the conditional expression c is false.
+
+@see __ASSERT_DEBUG
+}
+//#define __ASSERT_ALWAYS(c,p) (void)((c)||(p,0))
+
+
+
+//#ifdef __WINS__
+//#ifdef __CW32__
+{
+@internalAll
+@released
+}
+//#define __BREAKPOINT()			\
+//	{							\
+//	__asm { byte 0xcc };		\
+//	}
+//#else //!__CW32__
+{
+@internalAll
+@released
+}
+//#define __BREAKPOINT()			\
+//	{							\
+//	__asm { int 3 };			\
+//	}
+//#endif //__CW32__
+//#else
+{
+@internalAll
+@released
+}
+//#define __BREAKPOINT()
+//#endif
+
+//#if defined(_DEBUG)
+
+{
+@internalComponent
+@deprecated
+}
+//#define __ASSERT_DEBUG_MB(aCond,aPanicNo) (void)((aCond)||(PanicMB(aPanicNo,_L(#aPanicNo),_L(#aCond)),0))
+
+
+
+
+{
+@publishedAll
+@released
+
+Asserts that a condition is true.
+
+Code is generated for debug builds only.
+
+This macro is used as a C++ statement to assert the truth of some condition,
+and to take appropriate action if the condition is false. It is used in
+the same way as __ASSERT_ALWAYS, except that it is only defined for debug builds.
+
+The macro may be used to insert extra checks at various points in source code
+as desired; the code will only be generated in debug builds and not in release
+builds.
+
+@param c A conditional expression which results in true or false.
+@param p A function which is called if the conditional expression c is false.
+
+@see __ASSERT_ALWAYS
+}
+//#define __ASSERT_DEBUG(c,p) (void)((c)||(p,0))
+
+
+
+{
+@internalAll
+@removed
+}
+//#define __DECLARE_NAME(t)
+
+
+
+
+{
+@publishedAll
+@released
+
+Calls the function for testing object invariance.
+
+Classes can define a standard member function __DbgTestInvariant(),
+which checks that the object is in a valid state, and panics if it is not.
+In debug builds, this macro simply expands to call that function. For details on how
+to define __DbgTestInvariant(), and an example of its use, see __DECLARE_TEST.
+
+The macro is typically invoked at the beginning of all the member functions of
+the class. For non-const functions (those which can change the object’s state),
+you can ensure that the object has been left in a stable state by invoking
+the macro at the end of the function.
+
+In release builds, no code is generated for the macro.
+}
+//#define __TEST_INVARIANT __DbgTestInvariant()
+
+
+
+
+{
+@publishedAll
+@released
+
+Marks the start of checking the current thread's heap.
+
+This macro is defined only for debug builds.
+
+This macro must be matched by a corresponding call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
+
+Calls to this macro can be nested but each call must be matched by corresponding
+call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
+
+@see User::__DbgMarkStart()
+@see __UHEAP_MARKEND
+@see __UHEAP_MARKENDC
+}
+//#define __UHEAP_MARK User::__DbgMarkStart(FALSE)
+
+
+
+
+{
+@publishedAll
+@released
+
+Checks that the number of allocated cells at the current nested level on the
+current thread's heap is the same as the specified value.
+
+This macro is defined only for debug builds.
+
+The macro also takes the name of the file containing this source code statement
+and the line number of this source code statement; they are displayed as part
+of the panic category, if the checks fail.
+
+The macro assumes that:
+
+1. the heap being checked is a user heap
+
+2. checking is being done for the number of allocated cells at the current nested
+   level; i.e. that aCountAll is set to false
+
+3. the line number is the line number of this source code statement.
+
+4. the file name is the full path name of the file containing this source statement
+
+@param aCount The number of heap cells expected to be allocated at
+              the current nest level.
+
+@see User::__DbgMarkCheck()
+@see __KHEAP_CHECK
+}
+//#define __UHEAP_CHECK(aCount) User::__DbgMarkCheck(FALSE,FALSE,aCount,(TText8*)__FILE__,__LINE__)
+
+
+
+
+{
+@publishedAll
+@released
+
+Checks that the total number of allocated cells on the current thread's heap
+is the same as the specified value.
+
+This macro is defined only for debug builds.
+
+The macro also takes the name of the file containing this source code statement
+and the line number of this source code statement; they are displayed as part
+of the panic category, if the checks fail.
+
+@param aCount The total number of heap cells expected to be allocated.
+
+@see User::__DbgMarkCheck()
+@see __KHEAP_CHECKALL
+}
+//#define __UHEAP_CHECKALL(aCount) User::__DbgMarkCheck(FALSE,TRUE,aCount,(TText8*)__FILE__,__LINE__)
+
+
+
+
+{
+@publishedAll
+@released
+
+Marks the end of checking the current thread's heap.
+
+The macro expects zero heap cells to remain allocated at the current nest
+level. This macro is defined only for debug builds.
+
+This macro must match an earlier call to __UHEAP_MARK.
+
+@see User::__DbgMarkEnd()
+@see __UHEAP_MARK
+}
+//#define __UHEAP_MARKEND User::__DbgMarkEnd(FALSE,0)
+
+
+
+
+{
+@publishedAll
+@released
+
+Marks the end of checking the current thread's heap.
+
+The macro expects aCount heap cells to remain allocated at the current nest
+level.
+
+This macro must match an earlier call to __UHEAP_MARK.
+
+@param aCount The number of heap cells expected to remain allocated at
+              the current nest level.
+
+@see User::__DbgMarkEnd()
+@see __UHEAP_MARK
+}
+//#define __UHEAP_MARKENDC(aCount) User::__DbgMarkEnd(FALSE,aCount)
+
+
+
+
+{
+@publishedAll
+@released
+
+Simulates heap allocation failure for the current thread's heap.
+
+The failure occurs on the next call to new or any of the functions which
+allocate memory from the heap. This macro is defined only for debug builds.
+
+@param aCount Determines when the allocation will fail.
+              Heap allocation fails on attempt number aCount - later
+              allocations will succeed.
+              For example, if aCount is 3, then heap allocation fails
+              on the 3rd attempt, but all subsequent allocations succeed.
+
+@see User::__DbgSetAllocFail()
+}
+//#define __UHEAP_FAILNEXT(aCount) User::__DbgSetAllocFail(FALSE,RAllocator::EFailNext,aCount)
+
+
+
+
+{
+@publishedAll
+@released
+
+Simulates heap allocation failure for the current thread's heap.
+
+The failure occurs on subsequent calls to new or any of the functions which
+allocate memory from the heap. This macro is defined only for debug builds.
+
+@param aType  The type of failure to be simulated.
+@param aValue The failure rate.
+
+@see User::__DbgSetAllocFail()
+}
+//#define __UHEAP_SETFAIL(aType,aValue) User::__DbgSetAllocFail(FALSE,aType,aValue)
+
+
+
+
+{
+@publishedAll
+@released
+
+Cancels simulated heap allocation failure for the current thread's heap.
+
+This macro is defined only for debug builds.
+
+@see User::__DbgSetAllocFail()
+}
+//#define __UHEAP_RESET User::__DbgSetAllocFail(FALSE,RAllocator::ENone,1)
+
+
+{
+@publishedAll
+@released
+
+Cancels simulated heap allocation failure for the current thread's heap.
+It walks the the heap and sets the nesting level for all allocated
+cells to zero.
+
+This macro is defined only for debug builds.
+}
+//#define __UHEAP_TOTAL_RESET User::__DbgSetAllocFail(FALSE,RAllocator::EReset,1)
+
+
+
+{
+@publishedPartner
+@released
+
+Marks the start of Kernel heap checking.
+
+Checking the Kernel heap is only useful when developing Kernel side code such
+as device drivers and media drivers.
+
+This macro is defined only for debug builds.
+
+This macro must be matched by a corresponding call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
+Calls to this macro can be nested but each call must be matched by corresponding
+call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
+
+@see User::__DbgMarkStart()
+@see __KHEAP_MARKEND
+@see __KHEAP_MARKENDC
+}
+//#define __KHEAP_MARK User::__DbgMarkStart(TRUE)
+
+
+
+
+{
+@publishedPartner
+@released
+
+Checks that the number of allocated cells at the current nested level of the
+Kernel heap is the same as the specified value. This macro is defined only
+for debug builds. Checking the Kernel heap is only useful when developing
+Kernel side code such as device drivers and media drivers.
+
+The macro also takes the name of the file containing this source code statement
+and the line number of this source code statement; they are displayed as part
+of the panic category, if the checks fail.
+
+@param aCount The number of heap cells expected to be allocated at
+              the current nest level.
+
+@see User::__DbgMarkCheck()
+@see __UHEAP_CHECK
+}
+//#define __KHEAP_CHECK(aCount) User::__DbgMarkCheck(TRUE,FALSE,aCount,(TText8*)__FILE__,__LINE__)
+
+
+
+
+{
+@publishedPartner
+@released
+
+Checks that the total number of allocated cells on the Kernel heap is the same
+as the specified value.
+
+It is only useful when developing Kernel side code such as device drivers
+and media drivers.
+
+The macro also takes the name of the file containing this source code statement
+and the line number of this source code statement; they are displayed as part
+of the panic category, if the checks fail.
+
+This macro is defined only for debug builds.
+
+@param aCount The total number of heap cells expected to be allocated
+
+@see User::__DbgMarkCheck()
+@see __UHEAP_CHECKALL
+}
+//#define __KHEAP_CHECKALL(aCount) User::__DbgMarkCheck(TRUE,TRUE,aCount,(TText8*)__FILE__,__LINE__)
+
+
+
+
+{
+@publishedPartner
+@released
+
+Marks the end of Kernel heap checking. The macro expects zero heap cells to
+remain allocated at the current nest level.
+
+This macro is defined only for debug builds. Checking the Kernel heap is only
+useful when developing Kernel side code such as device drivers and media drivers.
+
+This macro must match an earlier call to __KHEAP_MARK.
+
+@see User::__DbgMarkEnd()
+@see __KHEAP_MARK
+}
+//#define __KHEAP_MARKEND User::__DbgMarkEnd(TRUE,0)
+
+
+
+
+{
+@publishedPartner
+@released
+
+Marks the end of Kernel heap checking. The macro expects aCount heap cells
+to remain allocated at the current nest level.
+
+This macro is defined only for debug builds.
+
+This macro must match an earlier call to __KHEAP_MARK.
+
+@param aCount The number of heap cells expected to remain allocated at
+              the current nest level.
+
+@see User::__DbgMarkEnd()
+@see __KHEAP_MARK
+}
+//#define __KHEAP_MARKENDC(aCount) User::__DbgMarkEnd(TRUE,aCount)
+
+
+
+
+{
+@publishedPartner
+@released
+
+Simulates Kernel heap allocation failure. The failure occurs on the next call
+to new or any of the functions which allocate memory from the heap. This macro
+is defined only for debug builds.
+
+Checking the Kernel heap is only useful when developing Kernel side code such
+as device drivers and media drivers.
+
+@param aCount The rate of failure - heap allocation fails every aCount attempt.
+
+@see User::__DbgSetAllocFail()
+}
+//#define __KHEAP_FAILNEXT(aCount) User::__DbgSetAllocFail(TRUE,RAllocator::EFailNext,aCount)
+
+
+
+
+{
+@publishedPartner
+@released
+
+Simulates Kernel heap allocation failure.
+
+The failure occurs on subsequent calls to new or any of the functions which
+allocate memory from this heap.
+
+This macro is defined only for debug builds.
+
+@param aType  The type of failure to be simulated.
+@param aValue The failure rate.
+
+@see User::__DbgSetAllocFail()
+}
+//#define __KHEAP_SETFAIL(aType,aValue) User::__DbgSetAllocFail(TRUE,aType,aValue)
+
+
+
+
+{
+@publishedPartner
+@released
+
+Cancels simulated Kernel heap allocation failure.
+
+Checking the Kernel heap is only useful when developing Kernel side code such
+as device drivers and media drivers.
+
+This macro is defined only for debug builds.
+
+@see User::__DbgSetAllocFail()
+}
+//#define __KHEAP_RESET User::__DbgSetAllocFail(TRUE,RAllocator::ENone,1)
+
+
+
+
+{
+@publishedPartner
+@released
+
+Cancels simulated kernel heap allocation failure.
+It walks the the heap and sets the nesting level for all allocated
+cells to zero.
+
+Checking the kernel heap is only useful when developing kernel side code such
+as device drivers and media drivers.
+
+This macro is defined only for debug builds.
+}
+//#define __KHEAP_TOTAL_RESET User::__DbgSetAllocFail(TRUE,RAllocator::EReset,1)
+
+
+
+
+{
+@publishedAll
+@released
+
+Marks the start of heap checking for the specific heap.
+
+This macro is defined only for debug builds.
+
+This macro must be matched by a corresponding call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
+
+Calls to this macro can be nested but each call must be matched by corresponding
+call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
+
+@param aHeap A pointer to the specific RHeap
+
+@see RHeap
+@see RAllocator::__DbgMarkStart()
+@see __RHEAP_MARKEND
+@see __RHEAP_MARKENDC
+}
+//#define __RHEAP_MARK(aHeap) (aHeap)->__DbgMarkStart()
+
+
+
+
+{
+@publishedAll
+@released
+
+Checks that the number of allocated cells at the current nested level on the
+specified heap is the same as the specified value.
+
+The macro also takes the name of the file containing this source code statement
+and the line number of this source code statement; they are displayed as part
+of the panic category, if the checks fail.
+
+This macro is defined only for debug builds.
+
+@param aHeap  A pointer to the specific RHeap.
+@param aCount The number of heap cells expected to be allocated at
+              the current nest level.
+
+@see RAllocator::__DbgMarkCheck()
+}
+//#define __RHEAP_CHECK(aHeap,aCount) (aHeap)->__DbgMarkCheck(FALSE,aCount,(TText8*)__FILE__,__LINE__)
+
+
+
+
+{
+@publishedAll
+@released
+
+Checks that the total number of allocated cells on the specified heap is the
+same as the specified value.
+
+The macro also takes the name of the file containing this source code statement
+and the line number of this source code statement; they are displayed as part
+of the panic category, if the checks fail.
+
+This macro is defined only for debug builds.
+
+@param aHeap  A pointer to the specific RHeap.
+@param aCount The total number of heap cells expected to be allocated.
+
+@see RAllocator::__DbgMarkCheck()
+}
+//#define __RHEAP_CHECKALL(aHeap,aCount) (aHeap)->__DbgMarkCheck(TRUE,aCount,(TText8*)__FILE__,__LINE__)
+
+
+
+
+{
+@publishedAll
+@released
+
+Marks the end of heap checking for the specific heap.
+
+The macro expects zero heap cells to remain allocated at the current nest
+level. This macro is defined only for debug builds.
+
+This macro must match an earlier call to __RHEAP_MARK.
+
+@param aHeap A pointer to the specific RHeap.
+
+@see RAllocator::__DbgMarkEnd()
+@see __RHEAP_MARK
+}
+//#define __RHEAP_MARKEND(aHeap) (aHeap)->__DbgMarkEnd(0)
+
+
+
+
+{
+@publishedAll
+@released
+
+Marks the end of heap checking for the specific heap.
+
+The macro expects aCount heap cells to remain allocated at the current nest
+level. This macro is defined only for debug builds.
+
+This macro must match an earlier call to __RHEAP_MARK.
+
+@param aHeap  A pointer to the specific RHeap.
+@param aCount The number of heap cells expected to remain allocated at
+              the current nest level
+
+@see RAllocator::__DbgMarkEnd()
+@see __RHEAP_MARK
+}
+//#define __RHEAP_MARKENDC(aHeap,aCount) (aHeap)->__DbgMarkEnd(aCount)
+
+
+
+
+{
+@publishedAll
+@released
+
+Simulates an allocation failure for the specific heap.
+
+The failure occurs on the next call to new or any of the functions which allocate
+memory from the heap. This macro is defined only for debug builds.
+
+@param aHeap  A pointer to the specific RHeap.
+@param aCount The rate of failure - heap allocation fails every aCount attempt.
+
+@see RAllocator::__DbgSetAllocFail()
+}
+//#define __RHEAP_FAILNEXT(aHeap,aCount) (aHeap)->__DbgSetAllocFail(RAllocator::EFailNext,aCount)
+
+
+
+
+{
+@publishedAll
+@released
+
+Simulates an allocation failure for the specific heap.
+
+The failure occurs on subsequent calls to new or any of the functions which
+allocate memory from the heap. This macro is defined only for debug builds.
+
+@param aHeap  A pointer to the specific RHeap.
+@param aType  The type of failure to be simulated.
+@param aValue The failure rate.
+
+@see RAllocator::__DbgSetAllocFail()
+}
+//#define __RHEAP_SETFAIL(aHeap,aType,aValue) (aHeap)->__DbgSetAllocFail(aType,aValue)
+
+
+
+
+{
+@publishedAll
+@released
+
+Cancels simulated allocation failure for the specific heap.
+
+This macro is defined only for debug builds.
+
+@param aHeap A pointer to the specific RHeap.
+
+@see RAllocator::__DbgSetAllocFail()
+}
+//#define __RHEAP_RESET(aHeap) (aHeap)->__DbgSetAllocFail(RAllocator::ENone,1)
+
+
+
+{
+@publishedAll
+@released
+
+Cancels simulated allocation failure for the specific heap.
+It walks the the heap and sets the nesting level for all allocated
+cells to zero.
+
+This macro is defined only for debug builds.
+
+@param aHeap A pointer to the specific RHeap.
+
+@see RAllocator::__DbgSetAllocFail()
+}
+//#define __RHEAP_TOTAL_RESET(aHeap) (aHeap)->__DbgSetAllocFail(RAllocator::EReset,1)
+
+
+
+
+//#if defined (__WINS__)
+
+{
+@publishedAll
+@released
+}
+//#define __DEBUGGER() {if (User::JustInTime()) __BREAKPOINT()}
+
+//#else
+//#define __DEBUGGER()
+//#endif
+
+
+//#if defined(__DLL__)
+{
+@publishedAll
+@released
+
+Declares a function for testing object invariance.
+
+For complex classes, it is often useful to provide a function that can
+be called to check that the object is in a valid state.
+The __DECLARE_TEST macro supplies a standard prototype for such a function
+named __DbgTestInvariant(). A companion macro __TEST_INVARIANT is provided
+to call the function.
+
+For DLLs, as opposed to EXEs, __DbgTestInvariant() is exported,
+i.e. the macro expands to:
+
+@code
+public: IMPORT_C void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
+@endcode
+
+This macro should placed as the last item in a class declaration (as it
+switches back to public access). Note that a terminating semi-colon must be used.
+
+You should define the __DbgTestInvariant() function to check that the object
+is in a healthy state. If it finds an error, it should call User::Invariant(),
+which will cause a panic.
+
+If a class is derived from a base class, then the base class __DbgTestInvariant()
+should be called first, and then any further checking done.
+
+The second function declared, __DbgTest(), is intended to allow test code a way
+of directly accessing non-public members of a class. The function is
+implemented by any test code that requires it, rather than in the class’s own
+source code. The function is therefore not exported.
+
+__DECLARE_TEST is defined for both debug and release builds. This point is
+particularly important for DLLs, as otherwise the exported interfaces would
+differ between the build versions, giving potential binary compatibility
+problems. To avoid using memory unnecessarily in release builds, you can,
+however, use preprocessor directives to define the code within
+__DbgTestInvariant() only for debug builds. __DbgTestInvariant() is never
+called in release builds.
+
+@see __TEST_INVARIANT
+}
+{#define __DECLARE_TEST public: IMPORT_C void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
+#else
+#define __DECLARE_TEST public: void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
+#endif
+
+#else
+#define __ASSERT_DEBUG(c,p)
+#define __DECLARE_NAME(t)
+#define __TEST_INVARIANT
+#if defined(__DLL__)
+#define __DECLARE_TEST public: IMPORT_C void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
+#else
+#define __DECLARE_TEST public: void __DbgTestInvariant() const; void __DbgTest(TAny *aPtr) const
+#endif}
+
+
+
+
+{
+@publishedAll
+@released
+
+Marks the start of checking the current thread's heap.
+
+This macro is defined only for debug builds.
+
+This macro must be matched by a corresponding call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
+
+Calls to this macro can be nested but each call must be matched by corresponding
+call to __UHEAP_MARKEND or __UHEAP_MARKENDC.
+
+@see User::__DbgMarkStart()
+@see __UHEAP_MARKEND
+@see __UHEAP_MARKENDC
+}
+//#define __UHEAP_MARK
+
+
+
+
+{
+@publishedAll
+@released
+
+Checks that the number of allocated cells at the current nested level on the
+current thread's heap is the same as the specified value.
+
+This macro is defined only for debug builds.
+
+The macro also takes the name of the file containing this source code statement
+and the line number of this source code statement; they are displayed as part
+of the panic category, if the checks fail.
+
+The macro assumes that:
+
+1. the heap being checked is a user heap
+
+2. checking is being done for the number of allocated cells at the current nested
+   level; i.e. that aCountAll is set to false
+
+3. the line number is the line number of this source code statement.
+
+4. the file name is the full path name of the file containing this source statement
+
+@param aCount The number of heap cells expected to be allocated at
+              the current nest level.
+
+@see User::__DbgMarkCheck()
+@see __KHEAP_CHECK
+}
+//#define __UHEAP_CHECK(aCount)
+
+
+
+
+{
+@publishedAll
+@released
+
+Checks that the total number of allocated cells on the current thread's heap
+is the same as the specified value.
+
+This macro is defined only for debug builds.
+
+The macro also takes the name of the file containing this source code statement
+and the line number of this source code statement; they are displayed as part
+of the panic category, if the checks fail.
+
+@param aCount The total number of heap cells expected to be allocated.
+
+@see User::__DbgMarkCheck()
+@see __KHEAP_CHECKALL
+}
+//#define __UHEAP_CHECKALL(aCount)
+
+
+
+
+{
+@publishedAll
+@released
+
+Marks the end of checking the current thread's heap.
+
+The macro expects zero heap cells to remain allocated at the current nest
+level. This macro is defined only for debug builds.
+
+This macro must match an earlier call to __UHEAP_MARK.
+
+@see User::__DbgMarkEnd()
+@see __UHEAP_MARK
+}
+//#define __UHEAP_MARKEND
+
+
+
+
+{
+@publishedAll
+@released
+
+Marks the end of checking the current thread's heap.
+
+The macro expects aCount heap cells to remain allocated at the current nest
+level.
+
+This macro must match an earlier call to __UHEAP_MARK.
+
+@param aCount The number of heap cells expected to remain allocated at
+              the current nest level.
+
+@see User::__DbgMarkEnd()
+@see __UHEAP_MARK
+}
+//#define __UHEAP_MARKENDC(aCount)
+
+
+
+
+{
+@publishedAll
+@released
+
+Simulates heap allocation failure for the current thread's heap.
+
+The failure occurs on the next call to new or any of the functions which
+allocate memory from the heap. This macro is defined only for debug builds.
+
+@param aCount Determines when the allocation will fail.
+              Heap allocation fails on attempt number aCount - later
+              allocations will succeed.
+              For example, if aCount is 3, then heap allocation fails
+              on the 3rd attempt, but all subsequent allocations succeed.
+
+@see User::__DbgSetAllocFail()
+}
+//#define __UHEAP_FAILNEXT(aCount)
+
+
+
+
+{
+@publishedAll
+@released
+
+Simulates heap allocation failure for the current thread's heap.
+
+The failure occurs on subsequent calls to new or any of the functions which
+allocate memory from the heap. This macro is defined only for debug builds.
+
+@param aType  The type of failure to be simulated.
+@param aValue The failure rate.
+
+@see User::__DbgSetAllocFail()
+}
+//#define __UHEAP_SETFAIL(aType,aValue)
+
+
+
+
+{
+@publishedAll
+@released
+
+Cancels simulated heap allocation failure for the current thread's heap.
+
+This macro is defined only for debug builds.
+
+@see User::__DbgSetAllocFail()
+}
+//#define __UHEAP_RESET
+
+
+
+{
+@publishedAll
+@released
+
+Cancels simulated heap allocation failure for the current thread's heap.
+It walks the the heap and sets the nesting level for all allocated
+cells to zero.
+
+This macro is defined only for debug builds.
+}
+//#define __UHEAP_TOTAL_RESET
+
+
+
+{
+@publishedPartner
+@released
+
+Marks the start of Kernel heap checking.
+
+Checking the Kernel heap is only useful when developing Kernel side code such
+as device drivers and media drivers.
+
+This macro is defined only for debug builds.
+
+This macro must be matched by a corresponding call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
+Calls to this macro can be nested but each call must be matched by corresponding
+call to __KHEAP_MARKEND or __KHEAP_MARKENDC.
+
+@see User::__DbgMarkStart()
+@see __KHEAP_MARKEND
+@see __KHEAP_MARKENDC
+}
+//#define __KHEAP_MARK
+
+
+
+
+{
+@publishedPartner
+@released
+
+Checks that the number of allocated cells at the current nested level of the
+Kernel heap is the same as the specified value. This macro is defined only
+for debug builds. Checking the Kernel heap is only useful when developing
+Kernel side code such as device drivers and media drivers.
+
+The macro also takes the name of the file containing this source code statement
+and the line number of this source code statement; they are displayed as part
+of the panic category, if the checks fail.
+
+@param aCount The number of heap cells expected to be allocated at
+              the current nest level.
+
+@see User::__DbgMarkCheck()
+@see __UHEAP_CHECK
+}
+//#define __KHEAP_CHECK(aCount)
+
+
+
+
+{
+@publishedPartner
+@released
+
+Checks that the total number of allocated cells on the Kernel heap is the same
+as the specified value.
+
+It is only useful when developing Kernel side code such as device drivers
+and media drivers.
+
+The macro also takes the name of the file containing this source code statement
+and the line number of this source code statement; they are displayed as part
+of the panic category, if the checks fail.
+
+This macro is defined only for debug builds.
+
+@param aCount The total number of heap cells expected to be allocated
+
+@see User::__DbgMarkCheck()
+@see __UHEAP_CHECKALL
+}
+//#define __KHEAP_CHECKALL(aCount)
+
+
+
+
+{
+@publishedPartner
+@released
+
+Marks the end of Kernel heap checking. The macro expects zero heap cells to
+remain allocated at the current nest level.
+
+This macro is defined only for debug builds. Checking the Kernel heap is only
+useful when developing Kernel side code such as device drivers and media drivers.
+
+This macro must match an earlier call to __KHEAP_MARK.
+
+@see User::__DbgMarkEnd()
+@see __KHEAP_MARK
+}
+//#define __KHEAP_MARKEND
+
+
+
+
+{
+@publishedPartner
+@released
+
+Marks the end of Kernel heap checking. The macro expects aCount heap cells
+to remain allocated at the current nest level.
+
+This macro is defined only for debug builds.
+
+This macro must match an earlier call to __KHEAP_MARK.
+
+@param aCount The number of heap cells expected to remain allocated at
+              the current nest level.
+
+@see User::__DbgMarkEnd()
+@see __KHEAP_MARK
+}
+//#define __KHEAP_MARKENDC(aCount)
+
+
+
+
+{
+@publishedPartner
+@released
+
+Simulates Kernel heap allocation failure. The failure occurs on the next call
+to new or any of the functions which allocate memory from the heap. This macro
+is defined only for debug builds.
+
+Checking the Kernel heap is only useful when developing Kernel side code such
+as device drivers and media drivers.
+
+@param aCount The rate of failure - heap allocation fails every aCount attempt.
+
+@see User::__DbgSetAllocFail()
+}
+//#define __KHEAP_FAILNEXT(aCount)
+
+
+
+
+{
+@publishedPartner
+@released
+
+Simulates Kernel heap allocation failure.
+
+The failure occurs on subsequent calls to new or any of the functions which
+allocate memory from this heap.
+
+This macro is defined only for debug builds.
+
+@param aType  The type of failure to be simulated.
+@param aValue The failure rate.
+
+@see User::__DbgSetAllocFail()
+}
+//#define __KHEAP_SETFAIL(aType,aValue)
+
+
+
+
+{
+@publishedPartner
+@released
+
+Cancels simulated Kernel heap allocation failure.
+
+Checking the Kernel heap is only useful when developing Kernel side code such
+as device drivers and media drivers.
+
+This macro is defined only for debug builds.
+
+@see User::__DbgSetAllocFail()
+}
+//#define __KHEAP_RESET
+
+
+
+{
+@publishedPartner
+@released
+
+Cancels simulated kernel heap allocation failure.
+It walks the the heap and sets the nesting level for all allocated
+cells to zero.
+
+Checking the kernel heap is only useful when developing kernel side code such
+as device drivers and media drivers.
+
+This macro is defined only for debug builds.
+}
+//#define __KHEAP_TOTAL_RESET
+
+
+
+{
+@publishedAll
+@released
+
+Marks the start of heap checking for the specific heap.
+
+This macro is defined only for debug builds.
+
+This macro must be matched by a corresponding call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
+
+Calls to this macro can be nested but each call must be matched by corresponding
+call to __RHEAP_MARKEND or __RHEAP_MARKENDC.
+
+@param aHeap A pointer to the specific RHeap
+
+@see RHeap
+@see RAllocator::__DbgMarkStart()
+@see __RHEAP_MARKEND
+@see __RHEAP_MARKENDC
+}
+//#define __RHEAP_MARK(aHeap)
+
+
+
+
+{
+@publishedAll
+@released
+
+Checks that the number of allocated cells at the current nested level on the
+specified heap is the same as the specified value.
+
+The macro also takes the name of the file containing this source code statement
+and the line number of this source code statement; they are displayed as part
+of the panic category, if the checks fail.
+
+This macro is defined only for debug builds.
+
+@param aHeap  A pointer to the specific RHeap.
+@param aCount The number of heap cells expected to be allocated at
+              the current nest level.
+
+@see RAllocator::__DbgMarkCheck()
+}
+//#define __RHEAP_CHECK(aHeap,aCount)
+
+
+
+
+{
+@publishedAll
+@released
+
+Checks that the total number of allocated cells on the specified heap is the
+same as the specified value.
+
+The macro also takes the name of the file containing this source code statement
+and the line number of this source code statement; they are displayed as part
+of the panic category, if the checks fail.
+
+This macro is defined only for debug builds.
+
+@param aHeap  A pointer to the specific RHeap.
+@param aCount The total number of heap cells expected to be allocated.
+
+@see RAllocator::__DbgMarkCheck()
+}
+//#define __RHEAP_CHECKALL(aHeap,aCount)
+
+
+
+
+{
+@publishedAll
+@released
+
+Marks the end of heap checking for the specific heap.
+
+The macro expects zero heap cells to remain allocated at the current nest
+level. This macro is defined only for debug builds.
+
+This macro must match an earlier call to __RHEAP_MARK.
+
+@param aHeap A pointer to the specific RHeap.
+
+@see RAllocator::__DbgMarkEnd()
+@see __RHEAP_MARK
+}
+//#define __RHEAP_MARKEND(aHeap)
+
+
+
+
+{
+@publishedAll
+@released
+
+Marks the end of heap checking for the specific heap.
+
+The macro expects aCount heap cells to remain allocated at the current nest
+level. This macro is defined only for debug builds.
+
+This macro must match an earlier call to __RHEAP_MARK.
+
+@param aHeap  A pointer to the specific RHeap.
+@param aCount The number of heap cells expected to remain allocated at
+              the current nest level
+
+@see RAllocator::__DbgMarkEnd()
+@see __RHEAP_MARK
+}
+//#define __RHEAP_MARKENDC(aHeap,aCount)
+
+
+
+
+{
+@publishedAll
+@released
+
+Simulates an allocation failure for the specific heap.
+
+The failure occurs on the next call to new or any of the functions which allocate
+memory from the heap. This macro is defined only for debug builds.
+
+@param aHeap  A pointer to the specific RHeap.
+@param aCount The rate of failure - heap allocation fails every aCount attempt.
+
+@see RAllocator::__DbgSetAllocFail()
+}
+//#define __RHEAP_FAILNEXT(aHeap,aCount)
+
+
+
+
+{
+@publishedAll
+@released
+
+Simulates an allocation failure for the specific heap.
+
+The failure occurs on subsequent calls to new or any of the functions which
+allocate memory from the heap. This macro is defined only for debug builds.
+
+@param aHeap  A pointer to the specific RHeap.
+@param aType  The type of failure to be simulated.
+@param aValue The failure rate.
+
+@see RAllocator::__DbgSetAllocFail()
+}
+//#define __RHEAP_SETFAIL(aHeap,aType,aValue)
+
+
+
+
+{
+@publishedAll
+@released
+
+Cancels simulated allocation failure for the specific heap.
+
+This macro is defined only for debug builds.
+
+@param aHeap A pointer to the specific RHeap.
+
+@see RAllocator::__DbgSetAllocFail()
+}
+//#define __RHEAP_RESET(aHeap)
+
+
+
+{
+@publishedAll
+@released
+
+Cancels simulated allocation failure for the specific heap.
+It walks the the heap and sets the nesting level for all allocated
+cells to zero.
+
+This macro is defined only for debug builds.
+
+@param aHeap A pointer to the specific RHeap.
+
+@see RAllocator::__DbgSetAllocFail()
+}
+//#define __RHEAP_TOTAL_RESET(aHeap)
+
+
+
+{#define __DEBUGGER()
+#endif
+
+#if defined (__WINS__)}
+{ @internalTechnology }
+//#define __EMULATOR_IMAGE_HEADER2(aUid0,aUid1,aUid2,aPriority,aCap0,aCap1,aSid,aVid,aVer,aFlags)	TEmulatorImageHeader uid={{aUid0,aUid1,aUid2},aPriority,{aSid,aVid,{aCap0,aCap1}},0,0,aVer,aFlags};
+{ @internalTechnology }
+{#define __EMULATOR_IMAGE_HEADER(aUid0,aUid1,aUid2,aPriority,aCap,aFlags)					TEmulatorImageHeader uid={{aUid0,aUid1,aUid2},aPriority,{aUid2,0,{aCap,0}},0,0,0x00010000u,aFlags};
+#else
+#define __EMULATOR_IMAGE_HEADER2(aUid0,aUid1,aUid2,aPriority,aCap0,aCap1,aSid,aVer,aFlags)
+#define __EMULATOR_IMAGE_HEADER(aUid0,aUid1,aUid2,aPriority,aCap,aFlags)
+#endif
+
+#if defined(__OPT__)}
+{
+@internalComponent
+@deprecated
+}
+{#define __ASSERT_OPT(c,p) (void)((c)||(p,0))
+#else
+#define __ASSERT_OPT(c,p)
+#endif
+
+#if defined(_UNICODE)
+#if !defined(UNICODE) }
+{
+@publishedAll
+@deprecated
+}
+{#define UNICODE
+#endif
+#endif     }
+
+//#if defined(_DEBUG)
+{
+@internalComponent
+@deprecated
+}
+{#define __DECLARE_TEST_DEBUG __DECLARE_TEST
+#else
+#define __DECLARE_TEST_DEBUG
+#endif
+
+
+
+
+#if !defined(ASSERT) }
+{
+@publishedAll
+@released
+
+Generates _ASSERT_DEBUG code that calls User::Invariant() if the specified
+condition is not true.
+
+@param x A conditional expression which results in true or false.
+}
+{#define ASSERT(x) __ASSERT_DEBUG(x,User::Invariant())
+#endif
+
+
+
+
+#ifndef __VALUE_IN_REGS__ }
+{
+@publishedPartner
+@released
+}
+{#define __VALUE_IN_REGS__
+#endif
+
+
+
+
+#if defined(_DEBUG)   }
+{
+@publishedAll
+@released
+}
+{#define __DEBUG_ONLY(x) x
+#else
+#define __DEBUG_ONLY(x)
+#endif      }
+
+
+
+
+{$ifdef __KERNEL_MODE__}
+
+{ @internalComponent }
+#define	KIMPORT_C	IMPORT_C
+
+{ @internalComponent }
+#define	KEXPORT_C	EXPORT_C
+
+{ @internalComponent }
+#define	UIMPORT_C
+
+{ @internalComponent }
+#define	UEXPORT_C
+#else
+#define	KIMPORT_C
+#define	KEXPORT_C
+#define	UIMPORT_C	IMPORT_C
+#define	UEXPORT_C	EXPORT_C
+{$endif}
+
+
+
+
+{
+@publishedAll
+@released
+
+Asserts that a condition is true at compilation time.
+
+@param x Condition to assert
+}
+//#define __ASSERT_COMPILE(x)		void __compile_time_assert(int __check[(x)?1:-1])
+
+//#ifdef __REMOVE_PLATSEC_DIAGNOSTICS__
+{
+@publishedPartner
+@released
+}
+//#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
+//#define __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
+//#endif /*__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__}
+//#endif /*__REMOVE_PLATSEC_DIAGNOSTICS__}
+
+{
+@internalComponent
+}
+//static const char* const KSuppressPlatSecDiagnosticMagicValue = (const char*)1;
+
+//#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
+{
+@internalComponent
+}
+//#define __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER(l) #l
+{
+@internalComponent
+}
+//#define __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER2(f,l) f "(" __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER(l) ")"
+{
+@publishedPartner
+@released
+}
+//#define __PLATSEC_DIAGNOSTIC_FILE_AND_LINE __PLATSEC_DIAGNOSTIC_FILE_AND_LINE_HELPER2(__FILE__,__LINE__)
+
+{
+@publishedPartner
+@released
+
+A macro that should be used to enclose a platform security diagnostic
+'C' style string that can be passed to a capability checking function such
+as RThread::HasCapability() and Kern::CurrentThreadHasCapability().
+
+The content of the string is emitted if the capability test finds that
+the capability is not present.
+
+The macro provides a convenient mechanism that allows the strings to
+be removed from future versions of Symbian OS.
+
+For example:
+
+@code
+if(!Kern::CurrentThreadHasCapability(ECapabilityPowerMgmt,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetState")))
+    {
+    return KErrPermissionDenied;
+    }
+@endcode
+
+In this example, the string:
+
+@code
+Checked by Hal function EDisplayHalSetState
+@endcode
+
+is emitted if the calling process does not have the ECapabilityPowerMgmt capability.
+
+@param s A C-style string.
+
+@see RProcess::HasCapability()
+@see RThread::HasCapability()
+@see RMessagePtr2::HasCapability()
+@see User::CreatorHasCapability()
+}
+//#define __PLATSEC_DIAGNOSTIC_STRING(s) s
+
+{
+When this value is used in Platform Security APIs as the value for the aDiagnosticText
+argument, these APIs will not emit any form of diagnostic message.
+@publishedPartner
+@released
+}
+//static const char* const KSuppressPlatSecDiagnostic = KSuppressPlatSecDiagnosticMagicValue;
+
+//#else /* __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ }
+
+//#define __PLATSEC_DIAGNOSTIC_STRING(s) NULL
+
+{$ifndef __KERNEL_MODE__}
+//#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
+{
+When this value is used in Platform Security APIs as the value for the aDiagnostic
+argument, these APIs will not emit any form of diagnostic message.
+@publishedPartner
+@released
+}
+//#define KSuppressPlatSecDiagnostic		NULL, NULL
+
+{.$else} { __REMOVE_PLATSEC_DIAGNOSTICS__ }
+
+{
+When this value is used in Platform Security APIs as the value for the aDiagnostic
+argument, these APIs will not emit any form of diagnostic message.
+@publishedPartner
+@release
+}
+//#define KSuppressPlatSecDiagnostic		NULL
+
+//#endif { !__REMOVE_PLATSEC_DIAGNOSTICS__ }
+{$endif} { !__KERNEL_MODE__ }
+//#endif /* !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ }
+
+{
+ * MSVC operator new and operator new[] header guards
+ }
+{#ifdef __PLACEMENT_NEW
+#define __PLACEMENT_NEW_INLINE
+#endif} { __PLACEMENT_NEW }
+
+{#if defined(__VC32__) && (_MSC_VER < 1300)
+#define __PLACEMENT_VEC_NEW_INLINE
+#endif} { version of MSVC that doesn't support overloaded operator new[] }
+
+{
+Calling convention qualifier for functions involving floating point
+variables passed or returned by value.
+@publishedAll
+@released
+}
+{#ifndef __SOFTFP
+#define __SOFTFP
+#endif /* __SOFTFP }
+
+

+ 621 - 0
rtl/symbian/symbianinc/e32err.inc

@@ -0,0 +1,621 @@
+{%MainUnit ../symbian.pas}
+
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by contributors of the Free Pascal Compiler
+
+    This file is a pascal translation of the Symbian OS headers
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{ e32\include\e32err.h
+
+  Copyright (c) 1994-2001 Symbian Ltd. All rights reserved.
+ }
+
+
+//#include <e32def.h>
+
+
+
+
+{
+System wide error code - no error.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrNone=0;
+
+
+
+
+{
+System wide error code - item not found.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrNotFound=(-1); // Must remain set to -1
+
+
+
+
+{
+System wide error code - an error that has no specific categorisation.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrGeneral=(-2);
+
+
+
+
+{
+System wide error code - indicates an operation that has been cancelled.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrCancel=(-3);
+
+
+
+
+{
+System wide error code - an attempt to allocate memory has failed.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrNoMemory=(-4);
+
+
+
+
+{
+System wide error code - some functionality is not supported in a given context.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+
+There may be many reasons for this; for example, a device may not support
+some specific behaviour.
+}
+const KErrNotSupported=(-5);
+
+
+
+
+{
+System wide error code - an argument is out of range.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrArgument=(-6);
+
+
+
+
+{
+System wide error code - a calculation has lost precision.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+
+This error arises when converting from an internal 96-bit real representation
+to a TReal32; the exponent of the internal representation is so small
+that the 32-bit real cannot contain it.
+}
+const KErrTotalLossOfPrecision=(-7);
+
+
+
+
+{
+System wide error code - an invalid handle has been passed.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+
+A function involving a resource owned by a server or the kernel has
+specified an invalid handle.
+}
+const KErrBadHandle=(-8);
+
+
+
+
+{
+System wide error code - indicates an overflow in some operation.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+
+In the context of mathematical or time/date functions, indicates a calculation
+that has produced arithmetic overflow exceeding the bounds allowed by
+the representation.
+
+In the context of data transfer, indicates that a buffer has over-filled
+without being emptied soon enough.
+}
+const KErrOverflow=(-9);
+
+
+
+
+{
+System wide error code - indicates an underflow in some operation.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+
+In the context of mathematical or time/date functions, indicates a calculation
+that has produced a result smaller than the smallest magnitude of
+a finite number allowed by the representation.
+
+In the context of data transfer, indicates that a buffer was under-filled
+when data was required.
+}
+const KErrUnderflow=(-10);
+
+
+
+
+{
+System wide error code - an object already exists.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+
+An object of some name/type is to be created, but an object of
+that name/type already exists.
+}
+const KErrAlreadyExists=(-11);
+
+
+
+
+{
+System wide error code - in the context of file operations, a path
+was not found.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrPathNotFound=(-12);
+
+
+
+
+{
+System wide error code - a handle refers to a thread that has died.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrDied=(-13);
+
+
+
+
+{
+System wide error code - a requested resource is already in exclusive use.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrInUse=(-14);
+
+
+
+
+{
+System wide error code - a client/server send/receive operation cannot run,
+because the server has terminated.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrServerTerminated=(-15);
+
+
+
+
+{
+System wide error code - a client/server send/receive operation cannot run,
+because the server is busy handling another request.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrServerBusy=(-16);
+
+
+
+
+{
+System wide error code - indicates that an operation is complete,
+successfully or otherwise.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+
+This code may be used to indicate that some follow on operation can take place.
+It does not necessarily indicate an error condition.
+}
+const KErrCompletion=(-17);
+
+
+
+
+{
+System wide error code - indicates that a device required by an i/o operation
+is not ready to start operations.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+
+A common reason for returning this code is because a device has not been
+initialised, or has no power.
+}
+const KErrNotReady=(-18);
+
+
+
+
+{
+System wide error code - a device is of unknown type.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrUnknown=(-19);
+
+
+
+
+{
+System wide error code - indicates that some media is not formatted properly,
+or links between sections of it have been corrupted.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrCorrupt=(-20);
+
+
+
+
+{
+System wide error code - access to a file is denied, because the permissions on
+the file do not allow the requested operation to be performed.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrAccessDenied=(-21);
+
+
+
+
+{
+System wide error code - an operation cannot be performed, because the part
+of the file to be read or written is locked.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrLocked=(-22);
+
+
+
+
+{
+System wide error code - during a file write operation, not all the data
+could be written.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrWrite=(-23);
+
+
+
+
+{
+System wide error code - a volume which was to be used for a file system
+operation has been dismounted.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrDisMounted=(-24);
+
+
+
+
+{
+System wide error code - indicates that end of file has been reached.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+
+Note that RFile::Read() is a higher-level interface. When the end of
+the file is reached, it returns zero bytes in the destination descriptor, and
+a KErrNone return value. KErrEof is not used for this purpose; other error
+conditions are returned only if some other error condition was indicated on
+the file.
+}
+const KErrEof=(-25);
+
+
+
+
+{
+System wide error code - a write operation cannot complete, because the disk
+is full.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrDiskFull=(-26);
+
+
+
+
+{
+System wide error code - a driver DLL is of the wrong type.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrBadDriver=(-27);
+
+
+
+
+{
+System wide error code - a file name or other object name does not conform to
+the required syntax.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrBadName=(-28);
+
+
+
+
+{
+System wide error code - a communication line has failed.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrCommsLineFail=(-29);
+
+
+
+
+{
+System wide error code - a frame error has occurred in
+a communications operation.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrCommsFrame=(-30);
+
+
+
+
+{
+System wide error code - an overrun has been detected by
+a communications driver.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrCommsOverrun=(-31);
+
+
+
+
+{
+System wide error code - a parity error has occurred in communications.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrCommsParity=(-32);
+
+
+
+
+{
+System wide error code - an operation has timed out.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrTimedOut=(-33);
+
+
+
+
+{
+System wide error code - a session could not connect.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrCouldNotConnect=(-34);
+
+
+
+
+{
+System wide error code - a session could not disconnect.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrCouldNotDisconnect=(-35);
+
+
+
+
+{
+System wide error code - a function could not be executed because the required
+session was disconnected.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrDisconnected=(-36);
+
+
+
+
+{
+System wide error code - a library entry point was not of the required type.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrBadLibraryEntryPoint=(-37);
+
+
+
+
+{
+System wide error code - a non-descriptor parameter was passed by
+a client interface, when a server expected a descriptor.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrBadDescriptor=(-38);
+
+
+
+
+{
+System wide error code - an operation has been aborted.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrAbort=(-39);
+
+
+
+
+{
+System wide error code - a number was too big.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrTooBig=(-40);
+
+
+
+
+{
+System wide error code - a divide-by-zero operation has been attempted.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrDivideByZero=(-41);		// Added by AnnW
+
+
+
+
+{
+System wide error code - insufficient power was available to
+complete an operation.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrBadPower=(-42);
+
+
+
+
+{
+System wide error code - an operation on a directory has failed.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrDirFull=(-43);
+
+
+
+
+{
+System wide error code - an operation cannot be performed because
+the necessary hardware is not available.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrHardwareNotAvailable=(-44);
+
+
+
+
+{
+System wide error code - the completion status when an outstanding
+client/server message is completed because a shared session has been closed.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrSessionClosed=(-45);
+
+
+
+
+{
+System wide error code - an operation cannot be performed due to
+a potential security violation.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrPermissionDenied=(-46);
+
+
+
+{
+System wide error code - a requested extension function is not
+supported by the object concerned.
+
+}
+const KErrExtensionNotSupported=(-47);
+
+
+
+{
+System wide error code - a break has occurred in
+a communications operation.
+
+A system wide error code indicates an error in the environment, or in
+user input from which a program may recover.
+}
+const KErrCommsBreak=(-48);
+

+ 8 - 0
rtl/symbian/symbianinc/e32std.inc

@@ -0,0 +1,8 @@
+{%MainUnit ../symbian.pas}
+
+{ e32std.h header file }
+
+{ User class }
+
+function User_InfoPrint(aString: PChar): TInt; cdecl; external;
+

+ 34 - 0
rtl/symbian/sysosh.inc

@@ -0,0 +1,34 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by contributors of the Free Pascal Compiler
+
+    This file implements all the base types and limits required
+    for a minimal POSIX compliant subset required to port the compiler
+    to a new OS.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{Platform specific information}
+type
+  THandle = Longint;
+  TThreadID = THandle;
+
+  { pthread_mutex_t }
+  PRTLCriticalSection = ^TRTLCriticalSection;
+  TRTLCriticalSection = record
+    __m_reserved: longint;
+    __m_count: longint;
+    __m_owner: pointer;
+    __m_kind:  longint;
+    __m_lock:  record
+       __status: sizeint;
+      __spinlock: longint;
+    end;
+  end;

+ 35 - 11
rtl/symbian/system.pp

@@ -113,6 +113,11 @@ var
 { include system independent routines }
 {$I system.inc}
 
+{*****************************************************************************
+                              Minimum Symbian API declarations
+*****************************************************************************}
+const KErrNone=0;
+
 {*****************************************************************************
                               Parameter Handling
 *****************************************************************************}
@@ -152,30 +157,43 @@ begin
 end;
 
 {*****************************************************************************
-                         Exit code and Entry Point
+                         System Dependent Exit code
 *****************************************************************************}
 
-procedure PascalMain; stdcall; external name 'PASCALMAIN';
-procedure fpc_do_exit; stdcall; external name 'FPC_DO_EXIT';
+//procedure PascalMain; stdcall; external name 'PASCALMAIN';
+//procedure fpc_do_exit; stdcall; external name 'FPC_DO_EXIT';
 
-procedure SysInitStdIO;
+Procedure system_exit;
 begin
 
 end;
 
-procedure _E32Startup; stdcall; public name '_E32Startup';
+var
+  { value of the stack segment
+    to check if the call stack can be written on exceptions }
+  _SS : Cardinal;
+
+procedure pascalmain; external name 'PASCALMAIN';
+
+{ Entry point for the pascal code }
+function Pascal_E32Main: Integer; cdecl; [public, alias: '_Pascal_E32Main'];
+var
+  ST : pointer;
 begin
-  IsLibrary:=false;
-  
+  IsLibrary := false;
+
   PascalMain;
 
   { if we pass here there was no error }
-  fpc_do_exit;
+  system_exit;
+  
+  Result := KErrNone;
 end;
 
-{*****************************************************************************
-                         Process routines
-*****************************************************************************}
+procedure SysInitStdIO;
+begin
+
+end;
 
 (* ProcessID cached to avoid repeated calls to GetCurrentProcess. *)
 
@@ -192,5 +210,11 @@ begin
   result := stklen;
 end;
 
+{
+const
+   Exe_entry_code : pointer = @Exe_entry;
+   Dll_entry_code : pointer = @Dll_entry;
+}
+
 begin
 end.

+ 34 - 0
rtl/symbian/uiq.pas

@@ -0,0 +1,34 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by contributors of the Free Pascal Compiler
+
+    Symbian OS unit that adds common types, constants and functions
+    for the UIQ API
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit uiq;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses ctypes;
+
+{$include e32def.inc}
+{$include e32err.inc}
+{.$include e32const.inc}
+{.$include e32cmn.inc}
+{$include e32std.inc}
+
+
+implementation
+
+end.
+

+ 39 - 0
rtl/symbian/uiqclasses.pas

@@ -0,0 +1,39 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by contributors of the Free Pascal Compiler
+
+    Symbian OS unit that adds common types, constants and functions
+    for the Symbian API
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit uiqclasses;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses ctypes;
+
+{$include e32def.inc}
+{$include e32err.inc}
+{.$include e32const.inc}
+{.$include e32cmn.inc}
+{.$include e32std.inc}
+
+{ e32std.h header file }
+
+{ User class }
+
+function User_InfoPrint(aString: PChar): TInt; cdecl; external;
+
+implementation
+
+end.
+

+ 39 - 0
rtl/symbian/uiqinc/qikapplication.inc

@@ -0,0 +1,39 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by contributors of the Free Pascal Compiler
+
+    Symbian OS unit that adds common types, constants and functions
+    for the Symbian API
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit symbian;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses ctypes;
+
+{$include e32def.inc}
+{$include e32err.inc}
+{.$include e32const.inc}
+{.$include e32cmn.inc}
+{.$include e32std.inc}
+
+{ e32std.h header file }
+
+{ User class }
+
+function User_InfoPrint(aString: PChar): TInt; cdecl; external;
+
+implementation
+
+end.
+

+ 39 - 0
rtl/symbian/uiqinc/qikapplicationoo.inc

@@ -0,0 +1,39 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by contributors of the Free Pascal Compiler
+
+    Symbian OS unit that adds common types, constants and functions
+    for the Symbian API
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit symbian;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses ctypes;
+
+{$include e32def.inc}
+{$include e32err.inc}
+{.$include e32const.inc}
+{.$include e32cmn.inc}
+{.$include e32std.inc}
+
+{ e32std.h header file }
+
+{ User class }
+
+function User_InfoPrint(aString: PChar): TInt; cdecl; external;
+
+implementation
+
+end.
+

+ 24 - 0
utils/mksymbian/Makefile.fpc

@@ -0,0 +1,24 @@
+#
+#   Makefile.fpc for Free Pascal Symbian Build Tool
+#
+
+[target]
+programs=mksymbian
+
+[clean]
+units=cfgfile cmdline compiler constants projectparser sdkutil
+
+[require]
+packages=
+
+[compiler]
+
+[install]
+fpcpackage=y
+
+[default]
+fpcdir=../..
+
+[rules]
+.NOTPARALLEL:
+mksymbian$(EXEEXT): mksymbian.pas

+ 37 - 0
utils/mksymbian/cfgfile.pas

@@ -0,0 +1,37 @@
+{
+cfgfile.pas
+
+Config file methods
+
+Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
+
+This file is part of MkSymbian build tool.
+
+MkSymbian is free software;
+you can redistribute it and/or modify it under the
+terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+
+MkSymbian is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+Please note that the General Public License version 2 does not permit
+incorporating MkSymbian into proprietary programs.
+}
+unit cfgfile;
+
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+
+interface
+
+uses
+  Classes, SysUtils; 
+
+implementation
+
+end.
+

+ 138 - 0
utils/mksymbian/cmdline.pas

@@ -0,0 +1,138 @@
+{
+cmdline.pas
+
+Command line parsing methods
+
+Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
+
+This file is part of MkSymbian build tool.
+
+MkSymbian is free software;
+you can redistribute it and/or modify it under the
+terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+
+MkSymbian is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+Please note that the General Public License version 2 does not permit
+incorporating MkSymbian into proprietary programs.
+}
+unit cmdline;
+
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+
+interface
+
+uses
+  Classes, SysUtils,
+  constants;
+
+type
+
+  { TCmdLine }
+
+  TCmdLine = class(TObject)
+  public
+    procedure Usage;
+    procedure ShowPath;
+    procedure ParseCmdLineOptions(var opts: TMkSymbianOptions);
+  end;
+  
+var
+  vCmdLine: TCmdLine;
+
+implementation
+
+uses sdkutil, projectparser;
+
+{ TCmdLine }
+
+{*******************************************************************
+*  TCmdLine.Usage ()
+*
+*  DESCRIPTION:    Shows a usage message for the tool
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCmdLine.Usage;
+begin
+  WriteLn('mksymbian - Build tool for Free Pascal for SymbianOS');
+  WriteLn('');
+  WriteLn('The parameters you specifyed are wrong.');
+  WriteLn('');
+  WriteLn('Usage: mksymbian [command] [project file]');
+  WriteLn('');
+  WriteLn('Possible commands: ');
+  WriteLn('');
+  WriteLn('build    - Builds a application');
+  WriteLn('bindings - Builds the c++ bindings for pascal');
+  WriteLn('showpath - Show the paths the tool is using');
+  WriteLn('');
+end;
+
+{*******************************************************************
+*  TCmdLine.ShowPath ()
+*
+*  DESCRIPTION:    Shows in which paths (sdk, fpc, etc) mksymbian is using
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCmdLine.ShowPath;
+begin
+  WriteLn('mksymbian - Build tool for Free Pascal for SymbianOS');
+  WriteLn('');
+  WriteLn('Location of UIQ 3 SDK: ' + vSDKUtil.SDKFolder);
+  WriteLn('Location of Free Pascal Compiler: ' + vProject.CompilerPath);
+  WriteLn('');
+end;
+
+{*******************************************************************
+*  TCmdLine.ParseCmdLineOptions ()
+*
+*  DESCRIPTION:    Parses the command line options utilized to call mksymbian
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCmdLine.ParseCmdLineOptions(var opts: TMkSymbianOptions);
+begin
+  FillChar(opts, SizeOf(TMkSymbianOptions), #0);
+
+  if (ParamCount = 0) then
+  begin
+    Usage;
+    Exit;
+  end;
+
+  opts.ProjectFile := ParamStr(2);
+
+  if CompareText(ParamStr(1), paramBuild) = 0 then opts.task := stBuildApp
+  else if CompareText(ParamStr(1), paramBindings) = 0 then opts.task := stBuildBindings
+  else if CompareText(ParamStr(1), paramShowPath) = 0 then
+  begin
+    opts.task := stNothing;
+    vProject.ParseFile;
+    ShowPath;
+  end
+  else
+  begin
+    opts.task := stNothing;
+    Usage;
+  end;
+end;
+
+end.
+

+ 520 - 0
utils/mksymbian/compiler.pas

@@ -0,0 +1,520 @@
+{
+compiler.pas
+
+Compiling, Linking and Registering in Emulator methods
+
+Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
+
+This file is part of MkSymbian build tool.
+
+MkSymbian is free software;
+you can redistribute it and/or modify it under the
+terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+
+MkSymbian is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+Please note that the General Public License version 2 does not permit
+incorporating MkSymbian into proprietary programs.
+}
+unit compiler;
+
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+
+interface
+
+uses
+  Classes, SysUtils, Process,
+  constants;
+
+type
+
+  { TCompiler }
+
+  TCompiler = class(TObject)
+  private
+    AProcess: TProcess;
+    CurrentDirectory: string;
+    MakeFolder, MakePartialFolder, BindingsUnitsFolder: string;
+  public
+    opts: TMkSymbianOptions;
+    constructor Create;
+    destructor Destroy; override;
+    procedure FileCopy(source, dest: string);
+    procedure MakeBuildPascal;
+    procedure MakeBuildCpp;
+    procedure MakeBuildBindings;
+    procedure BuildUIDFile;
+    procedure BuildResource(AFileName: string);
+    procedure InstallResource(AFileName: string);
+    procedure RegisterInEmulator;
+  end;
+
+var
+  vCompiler: TCompiler;
+
+implementation
+
+uses sdkutil, projectparser;
+
+{ TCompiler }
+
+{*******************************************************************
+*  TCompiler.Create ()
+*
+*  DESCRIPTION:    Initializes the compiler controlling object
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+constructor TCompiler.Create;
+begin
+  inherited Create;
+
+  AProcess := TProcess.Create(nil);
+
+  CurrentDirectory := ExtractFilePath(ParamStr(0));
+  MakePartialFolder := Copy(CurrentDirectory, 3, Length(CurrentDirectory) - 2);
+  MakeFolder := IncludeTrailingBackslash(CurrentDirectory);
+  
+  { When compiling the bindings we use a relative directory to get the output dir }
+  BindingsUnitsFolder := MakeFolder + '../../units/i386-symbian/';
+
+  AProcess.Options := AProcess.Options + [poWaitOnExit];
+end;
+
+{*******************************************************************
+*  TCompiler.Destroy ()
+*
+*  DESCRIPTION:    Finalizes the compiler controlling object
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+destructor TCompiler.Destroy;
+begin
+  AProcess.Free;
+
+  inherited Destroy;
+end;
+
+{*******************************************************************
+*  TCompiler.FileCopy ()
+*
+*  DESCRIPTION:    Copyes a file from source to dest
+*
+*  PARAMETERS:     source  - Source file
+*                  dest    - Destination file
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.FileCopy(source, dest: string);
+var
+  SourceStream, DestStream: TFileStream;
+begin
+  WriteLn('');
+  WriteLn('Copying file: ', source);
+  WriteLn('To: ', dest);
+  WriteLn('');
+
+  SourceStream := TFileStream.Create(source, fmOpenRead);
+  try
+    DestStream := TFileStream.Create(dest, fmCreate);
+    try
+      DestStream.CopyFrom(SourceStream, 0);
+    finally
+      DestStream.Free;
+    end;
+  finally
+    SourceStream.Free;
+  end;
+end;
+
+{*******************************************************************
+*  TCompiler.MakeBuildPascal ()
+*
+*  DESCRIPTION:    Builds and links a Object Pascal project
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.MakeBuildPascal;
+var
+  STR_LINK_FLAGSUDEB, STR_EPOCBLDUDEB, STR_LINK_OBJSUDEB: string;
+  STR_FPC_RTL_OBJECTS: string;
+  i: Integer;
+begin
+
+  WriteLn('');
+  WriteLn('Preparations for compiling');
+  WriteLn('');
+
+  // First command
+
+{  AProcess.CommandLine := 'perl -S makmake.pl  -D ' + MakePartialFolder + 'QHELLOWORLD WINSCW';
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;}
+
+  { Creation of directories }
+
+  ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\DATA\Z\private\10003a3f\apps');
+
+  ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\RELEASE\WINSCW\UDEB\Z\private\10003a3f\apps');
+
+  ForceDirectories(MakeFolder + 'WINSCW\UDEB');
+
+  { Compilation }
+
+  WriteLn('');
+  WriteLn('Compiling file ' + vProject.MainSource);
+  WriteLn('');
+  
+  AProcess.CommandLine := vProject.CompilerPath + ' -a -s -Fu' + vProject.RTLUnitsDir +
+    ' -Tsymbian QPasHello.pas';
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+
+  WriteLn('');
+  WriteLn('Assembling file QPasHello.s');
+  WriteLn('');
+
+  AProcess.CommandLine := vProject.AssemblerPath + ' QPasHello.s -o QPasHello.o';
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+
+  { UID File }
+
+  BuildUIDFile;
+
+  { Linking }
+
+  STR_LINK_FLAGSUDEB := '-msgstyle gcc -stdlib "' +
+    vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EEXE.LIB" -m' +
+    ' "?_E32Bootstrap@@YGXXZ" -subsystem windows -g ' +
+    vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EUSER.LIB ' +
+    '-o "' + MakeFolder + 'QPasHello.exe" -noimplib';
+  STR_EPOCBLDUDEB := MakeFolder + 'WINSCW\UDEB';
+
+  STR_LINK_OBJSUDEB :=
+    ' ' + MakeFolder + UID_OBJECT_FILENAME;
+
+  for i := 0 to vProject.ObjectFiles.Count - 1 do
+   STR_LINK_OBJSUDEB := STR_LINK_OBJSUDEB +
+    ' ' + MakeFolder + vProject.ObjectFiles.Strings[i];
+
+  STR_FPC_RTL_OBJECTS :=
+    ' ' + vProject.RTLUnitsDir + 'system.o' +
+    ' ' + vProject.RTLUnitsDir + 'symbian.o' +
+    ' ' + vProject.RTLUnitsDir + 'ctypes.o' +
+    ' ' + vProject.RTLUnitsDir + 'objpas.o' +
+    ' ' + vProject.RTLUnitsDir + 'pbeexe.o';
+
+  WriteLn('');
+  WriteLn('Linking stage');
+  WriteLn('');
+
+  AProcess.CommandLine := vSDKUtil.SDKFolder + Str_Path_CWTools +
+    'mwldsym2.exe ' + STR_LINK_FLAGSUDEB +
+    ' -l ' + MakeFolder +
+    ' -search ' + STR_LINK_OBJSUDEB + STR_FPC_RTL_OBJECTS;
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+
+  FileCopy(MakeFolder + 'QPasHello.exe',
+   vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\' + 'QPasHello.exe');
+end;
+
+{*******************************************************************
+*  TCompiler.MakeBuildCpp ()
+*
+*  DESCRIPTION:    Builds and links a C++ project
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.MakeBuildCpp;
+var
+  STR_LINK_FLAGSUDEB, STR_EPOCBLDUDEB, STR_LINK_OBJSUDEB,
+  STR_CWUFLAGS, STR_CWDEFS, STR_INCDIR, STR_CWUDEB: string;
+begin
+
+  WriteLn('');
+  WriteLn('Preparations for compiling');
+  WriteLn('');
+  
+  // First command
+
+  AProcess.CommandLine := 'perl -S makmake.pl  -D ' + MakePartialFolder + 'QHELLOWORLD WINSCW';
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+
+  { Creation of directories }
+
+  ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\DATA\Z\private\10003a3f\apps');
+
+  ForceDirectories(vSDKUtil.SDKFolder + 'EPOC32\RELEASE\WINSCW\UDEB\Z\private\10003a3f\apps');
+
+  ForceDirectories(MakeFolder + 'WINSCW\UDEB');
+
+//  TODO: Check if this can be safely removed
+//  ForceDirectories(MakeFolder + 'QHelloWorld\WINSCW');
+
+  { Compilation }
+
+  STR_CWUFLAGS := '-wchar_t off -align 4 -warnings on ' +
+    '-w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on  -nostdinc';
+  STR_CWDEFS := '-d "__SYMBIAN32__" -d "__CW32__" -d "__WINS__" -d "__WINSCW__" -d "__EXE__" -d "__SUPPORT_CPP_EXCEPTIONS__" ';
+  STR_INCDIR := '-cwd source -i- ' +
+    '-i "' + vSDKUtil.SDKPartialFolder + 'EPOC32\include" ' +
+    '-i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant" ' +
+    '-i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant\ " ' +
+    '-include "UIQ_3.0.hrh"';
+  STR_CWUDEB := 'mwccsym2.exe -g -O0 -inline off ' + STR_CWUFLAGS + ' -d _DEBUG -d _UNICODE ' + STR_CWDEFS + STR_INCDIR;
+
+  WriteLn('');
+  WriteLn('Compiling file ' + vProject.MainSource);
+  WriteLn('');
+
+  AProcess.CommandLine := STR_CWUDEB +
+    ' -o "' + MakeFolder + 'WINSCW\UDEB\' + vProject.MainSourceNoExt + '.o"' +
+    ' -c "' + MakeFolder + 'src\' + vProject.MainSource + '"';
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+
+  { UID File }
+
+  BuildUIDFile;
+
+  { Linking }
+
+  STR_LINK_FLAGSUDEB := '-msgstyle gcc' +
+    ' -stdlib "' + vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EEXE.LIB"' +
+    ' -m "?_E32Bootstrap@@YGXXZ" -subsystem windows' +
+    ' -g ' + vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\EUSER.LIB' +
+    ' -o "' + vSDKUtil.SDKPartialFolder + 'EPOC32\RELEASE\WINSCW\UDEB\' + vProject.MainSourceNoExt + '.exe"' +
+    ' -noimplib';
+  STR_EPOCBLDUDEB := MakeFolder + 'WINSCW\UDEB';
+  STR_LINK_OBJSUDEB := vProject.MainSourceNoExt + '.o ' + UID_OBJECT_FILENAME;
+
+  WriteLn('');
+  WriteLn('Linking stage');
+  WriteLn('');
+
+  AProcess.CommandLine := 'mwldsym2.exe ' + STR_LINK_FLAGSUDEB +
+    ' -l ' + STR_EPOCBLDUDEB +
+    ' -search ' + STR_LINK_OBJSUDEB;
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+end;
+
+{*******************************************************************
+*  TCompiler.MakeBuildBindings ()
+*
+*  DESCRIPTION:    Builds and links the C interface for the symbian libraries
+*
+*                  Note the we use a output directory relative to the current directory
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.MakeBuildBindings;
+var
+  STR_CWUFLAGS, STR_CWDEFS, STR_INCDIR, STR_CWUDEB, STR_CWCOMPILER: string;
+begin
+  { Makes sure that the output directory exists }
+
+  SysUtils.ForceDirectories(BindingsUnitsFolder);
+  
+  { Compilation }
+
+  STR_CWUFLAGS := '-wchar_t off -align 4 -warnings on ' +
+    '-w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on  -nostdinc';
+  STR_CWDEFS := '-d "__SYMBIAN32__" -d "__CW32__" -d "__WINS__" -d "__WINSCW__" -d "__EXE__" -d "__SUPPORT_CPP_EXCEPTIONS__" ';
+  STR_INCDIR := '-cwd source -i-' +
+    ' -i "' + vSDKUtil.SDKPartialFolder + 'EPOC32\include"' +
+    ' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant"' +
+    ' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant\ "' +
+    ' -include "UIQ_3.0.hrh"';
+  STR_CWCOMPILER := vSDKUtil.SDKFolder + Str_Path_CWTools + 'mwccsym2.exe';
+  STR_CWUDEB := STR_CWCOMPILER + ' -g -O0 -inline off ' + STR_CWUFLAGS + ' -d _DEBUG -d _UNICODE ' + STR_CWDEFS + STR_INCDIR;
+
+  WriteLn('');
+  WriteLn('Compiling file pbeexe.cpp');
+  WriteLn('');
+
+  AProcess.CommandLine := STR_CWUDEB +
+    ' -o "' + BindingsUnitsFolder + 'pbeexe.o" ' +
+    '-c "' + MakePartialFolder + 'pbeexe.cpp"';
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+end;
+
+{*******************************************************************
+*  TCompiler.BuildUIDFile ()
+*
+*  DESCRIPTION:    Generates and compiles a UID file
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.BuildUIDFile;
+var
+  Str_UIDFile: string;
+  UIDFile: TFileStream;
+  STR_CWUFLAGS, STR_CWDEFS, STR_INCDIR, STR_CWUDEB, STR_CWCOMPILER: string;
+begin
+  { First creates the UID file }
+
+  WriteLn('');
+  WriteLn('Creating UID file');
+  WriteLn('');
+
+  Str_UIDFile :=
+    '// mksymbian-generated uid source file' + LineEnding +
+    '#include <e32cmn.h>' + LineEnding +
+    '#pragma data_seg(".SYMBIAN")' + LineEnding +
+    '__EMULATOR_IMAGE_HEADER2(0x1000007a,' + vProject.UID2 + ',' + vProject.UID3 +
+   ',EPriorityForeground,0x00000000u,0x00000000u,0x01000001,0,0x00010000,0)' + LineEnding +
+    '#pragma data_seg()' + LineEnding;
+
+  UIDFile := TFileStream.Create(UID_SOURCE_FILENAME, fmCreate);
+  try
+    UIDFile.Write(Pointer(Str_UIDFile)^, Length(Str_UIDFile));
+  finally
+    UIDFile.Free;
+  end;
+  
+  { Compilation }
+
+  STR_CWUFLAGS := '-wchar_t off -align 4 -warnings on ' +
+    '-w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on  -nostdinc';
+  STR_CWDEFS := '-d "__SYMBIAN32__" -d "__CW32__" -d "__WINS__" -d "__WINSCW__" -d "__EXE__" -d "__SUPPORT_CPP_EXCEPTIONS__" ';
+  STR_INCDIR := '-cwd source -i- ' +
+    ' -i "' + vSDKUtil.SDKPartialFolder + 'EPOC32\include" ' +
+    ' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant" ' +
+    ' -i "' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant\ "' +
+    ' -include "UIQ_3.0.hrh"';
+  STR_CWCOMPILER := vSDKUtil.SDKFolder + Str_Path_CWTools + 'mwccsym2.exe';
+  STR_CWUDEB := STR_CWCOMPILER + ' -g -O0 -inline off ' + STR_CWUFLAGS + ' -d _DEBUG -d _UNICODE ' + STR_CWDEFS + STR_INCDIR;
+
+  WriteLn('');
+  WriteLn('Compiling file ' + UID_SOURCE_FILENAME);
+  WriteLn('');
+
+  AProcess.CommandLine := STR_CWUDEB +
+    ' -o "' + MakeFolder + UID_OBJECT_FILENAME + '"' +
+    ' -c "' + MakeFolder + UID_SOURCE_FILENAME + '"';
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+end;
+
+{*******************************************************************
+*  TCompiler.BuildResource ()
+*
+*  DESCRIPTION:    Builds a resource file
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.BuildResource(AFileName: string);
+begin
+  WriteLn('');
+  WriteLn('Preprocessing resource file: ' + AFileName);
+  WriteLn('');
+
+  AProcess.CommandLine := vSDKUtil.SDKFolder + Str_Path_Cpp +
+    ' -lang-c++' +
+    ' -I ' + vSDKUtil.SDKPartialFolder + 'EPOC32\include' +
+    ' -I ' + vSDKUtil.SDKPartialFolder + 'epoc32\include\variant' +
+    ' ' + MakeFolder + AFileName +
+    ' ' + MakeFolder + ChangeFileExt(AFileName, STR_RESOURCE_TMP_EXT);
+  WriteLn(AProcess.CommandLine);
+  AProcess.Execute;
+
+  WriteLn('');
+  WriteLn('Building resource file: ' + AFileName);
+  WriteLn('');
+
+  AProcess.CommandLine := vSDKUtil.SDKFolder + Str_Path_RComp +
+    ' -v -u' +
+    ' -o"' + MakeFolder + ChangeFileExt(AFileName, STR_RESOURCE_EXT) + '"' +
+    ' -s"' + MakeFolder + ChangeFileExt(AFileName, STR_RESOURCE_TMP_EXT) + '"';
+  WriteLn(AProcess.CommandLine);
+  WriteLn('');
+  System.Flush(System.StdOut);
+  AProcess.Execute;
+end;
+
+{*******************************************************************
+*  TCompiler.InstallResource ()
+*
+*  DESCRIPTION:    Install a resource file
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.InstallResource(AFileName: string);
+var
+  StrFrom, StrTo: string;
+begin
+  WriteLn('');
+  WriteLn('Installing resource file: ', AFileName);
+  WriteLn('');
+
+  StrFrom := MakeFolder + ChangeFileExt(vProject.MainResource, STR_RESOURCE_EXT);
+  StrTo := vSDKUtil.SDKFolder + Str_Path_Resource_Files +
+   ChangeFileExt(vProject.MainResource, STR_RESOURCE_EXT);
+
+  FileCopy(StrFrom, StrTo);
+end;
+
+{*******************************************************************
+*  TCompiler.RegisterInEmulator ()
+*
+*  DESCRIPTION:    Registers a software in the emulator
+*                  At this point the resource file must already be compiled
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TCompiler.RegisterInEmulator;
+var
+  StrFrom, StrTo: string;
+begin
+  WriteLn('');
+  WriteLn('Registering the software on the emulator');
+  WriteLn('');
+
+  StrFrom := MakeFolder + ChangeFileExt(vProject.MainResource, STR_RESOURCE_EXT);
+  StrTo := vSDKUtil.SDKFolder + Str_Path_Emulator_Registration +
+   ChangeFileExt(vProject.MainResource, STR_RESOURCE_EXT);
+
+  FileCopy(StrFrom, StrTo);
+end;
+
+end.
+

+ 108 - 0
utils/mksymbian/constants.pas

@@ -0,0 +1,108 @@
+{
+constants.pas
+
+Constants
+
+Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
+
+This file is part of MkSymbian build tool.
+
+MkSymbian is free software;
+you can redistribute it and/or modify it under the
+terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+
+MkSymbian is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+Please note that the General Public License version 2 does not permit
+incorporating MkSymbian into proprietary programs.
+}
+unit constants;
+
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+
+interface
+
+uses
+  Classes, SysUtils; 
+
+type
+
+  { Options from the command line }
+
+  TMkSymbianTask = (stNothing, stBuildApp, stBuildBindings);
+
+  TMkSymbianOptions = record
+    Task: TMkSymbianTask;
+    ProjectFile: string;
+  end;
+
+{ Commands }
+
+const
+  paramBuild = 'build';
+  paramBindings = 'bindings';
+  paramShowPath = 'showpath';
+
+{ Paths on the SDK }
+const
+  Str_Path_CWTools = 'epoc32\tools\nokia_compiler\Symbian_Tools\Command_Line_Tools\';
+  Str_Path_RComp = 'epoc32\tools\rcomp.exe';
+  Str_Path_Cpp = 'epoc32\tools\scpp.exe';
+  Str_Path_Resource_Files = 'epoc32\release\winscw\udeb\Z\resource\apps\';
+  Str_Path_Emulator_Registration = 'epoc32\release\winscw\udeb\Z\private\10003a3f\apps\';
+
+{ Other constants }
+const
+  UID_SOURCE_FILENAME = 'QUID.cpp';
+  UID_OBJECT_FILENAME = 'QUID.o';
+  
+  STR_RESOURCE_TMP_EXT = '.pprsc';
+  STR_RESOURCE_EXT = '.rsc';
+  
+{ Strings from the project file }
+const
+  { Sections }
+  STR_PRJ_Main = 'Main';
+  STR_PRJ_FPC = 'FPC';
+  STR_PRJ_UIDs = 'UIDs';
+  STR_PRJ_Files = 'Files';
+  STR_PRJ_Objects = 'Objects';
+  STR_PRJ_RTLObjects = 'RTLObjects';
+
+  { Identifiers }
+  STR_PRJ_EXEName = 'EXEName';
+  STR_PRJ_Language = 'Language';
+  STR_PRJ_CompilerDir = 'CompilerDir';
+  STR_PRJ_ProjectType = 'ProjectType';
+  STR_PRJ_SDK = 'SDK';
+  STR_PRJ_SDKVersion = 'SDKVersion';
+  STR_PRJ_Emulator = 'Emulator';
+
+  STR_PRJ_CompilerPath = 'CompilerPath';
+  STR_PRJ_AssemblerPath = 'AssemblerPath';
+  STR_PRJ_RTLUnitsDir = 'RTLUnitsDir';
+
+  STR_PRJ_UID2 = 'UID2';
+  STR_PRJ_UID3 = 'UID3';
+
+  STR_PRJ_MainSource = 'mainsource';
+  STR_PRJ_MainResource = 'mainresource';
+  STR_PRJ_RegResource = 'regresource';
+
+  STR_PRJ_File = 'file';
+
+  { Options }
+  
+  STR_OPT_Cpp = 'C++';
+  STR_OPT_Pascal = 'Pascal';
+
+implementation
+
+end.
+

+ 79 - 0
utils/mksymbian/mksymbian.lpi

@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<CONFIG>
+  <ProjectOptions>
+    <PathDelim Value="\"/>
+    <Version Value="5"/>
+    <General>
+      <Flags>
+        <MainUnitHasUsesSectionForAllUnits Value="False"/>
+        <MainUnitHasCreateFormStatements Value="False"/>
+        <MainUnitHasTitleStatement Value="False"/>
+      </Flags>
+      <SessionStorage Value="InProjectDir"/>
+      <MainUnit Value="0"/>
+      <IconPath Value="./"/>
+      <TargetFileExt Value=".exe"/>
+    </General>
+    <VersionInfo>
+      <ProjectVersion Value=""/>
+    </VersionInfo>
+    <PublishOptions>
+      <Version Value="2"/>
+      <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+      <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
+    </PublishOptions>
+    <RunParams>
+      <local>
+        <FormatVersion Value="1"/>
+        <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+      </local>
+    </RunParams>
+    <Units Count="7">
+      <Unit0>
+        <Filename Value="mksymbian.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="mksymbian"/>
+      </Unit0>
+      <Unit1>
+        <Filename Value="cmdline.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="cmdline"/>
+      </Unit1>
+      <Unit2>
+        <Filename Value="constants.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="constants"/>
+      </Unit2>
+      <Unit3>
+        <Filename Value="cfgfile.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="cfgfile"/>
+      </Unit3>
+      <Unit4>
+        <Filename Value="sdkutil.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="sdkutil"/>
+      </Unit4>
+      <Unit5>
+        <Filename Value="compiler.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="compiler"/>
+      </Unit5>
+      <Unit6>
+        <Filename Value="projectparser.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="projectparser"/>
+      </Unit6>
+    </Units>
+  </ProjectOptions>
+  <CompilerOptions>
+    <Version Value="5"/>
+    <PathDelim Value="\"/>
+    <CodeGeneration>
+      <Generate Value="Faster"/>
+    </CodeGeneration>
+    <Other>
+      <CompilerPath Value="$(CompPath)"/>
+    </Other>
+  </CompilerOptions>
+</CONFIG>

+ 93 - 0
utils/mksymbian/mksymbian.pas

@@ -0,0 +1,93 @@
+{
+mksymbian.pas
+
+Main program file
+
+Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
+
+This file is part of MkSymbian build tool.
+
+MkSymbian is free software;
+you can redistribute it and/or modify it under the
+terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+
+MkSymbian is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+Please note that the General Public License version 2 does not permit
+incorporating MkSymbian into proprietary programs.
+}
+program mksymbian;
+
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+
+{$apptype console}
+
+uses
+  Classes, SysUtils,
+  cmdline, constants, cfgfile, sdkutil, compiler, projectparser;
+
+var
+  opts: TMkSymbianOptions;
+begin
+
+  vSDKUtil := TSDKUtil.Create;
+  vCmdLine := TCmdLine.Create;
+  vCompiler := TCompiler.Create;
+  vProject := TProject.Create;
+
+  try
+    vCmdLine.ParseCmdLineOptions(opts);
+    
+    vCompiler.opts := opts;
+    vProject.opts := opts;
+
+    case opts.task of
+
+      stBuildApp:
+      begin
+        vProject.ParseFile;
+        
+        { compilation }
+        if CompareText(vProject.Language, STR_OPT_Cpp) = 0 then
+         vCompiler.MakeBuildCpp
+        else
+         vCompiler.MakeBuildPascal;
+
+        { Main resource file }
+        
+        vCompiler.BuildResource(vProject.MainResource);
+
+        vCompiler.InstallResource(vProject.MainResource);
+
+        { Registration resource file }
+        
+        vCompiler.BuildResource(vProject.RegResource);
+
+        vCompiler.RegisterInEmulator;
+      end;
+
+      stBuildBindings:
+      begin
+        vProject.ParseFile;
+
+        vCompiler.MakeBuildBindings;
+      end;
+      
+    end;
+    
+  finally
+    vCmdLine.Free;
+    vSDKUtil.Free;
+    vCompiler.Free;
+    vProject.Free;
+
+  end;
+  
+end.
+

+ 117 - 0
utils/mksymbian/projectparser.pas

@@ -0,0 +1,117 @@
+{
+projectparser.pas
+
+Parses the project file
+
+Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
+
+This file is part of MkSymbian build tool.
+
+MkSymbian is free software;
+you can redistribute it and/or modify it under the
+terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+
+MkSymbian is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+Please note that the General Public License version 2 does not permit
+incorporating MkSymbian into proprietary programs.
+}
+unit projectparser;
+
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+
+interface
+
+uses
+  Classes, SysUtils, IniFiles,
+  constants;
+
+type
+
+  { TProject }
+
+  TProject = class(TObject)
+  public
+    opts: TMkSymbianOptions;
+    { Main section }
+    ExeName, Language: string;
+    { FPC section }
+    CompilerPath, AssemblerPath, RTLUnitsDir: string;
+    { UIDs section }
+    UID2, UID3: string;
+    { Files section }
+    MainSource, MainSourceNoExt, MainResource, RegResource: string;
+    { Objects section }
+    ObjectFiles: TStringList;
+  public
+    constructor Create;
+    destructor Destroy; override;
+    procedure ParseFile;
+  end;
+
+var
+  vProject: TProject;
+
+implementation
+
+{ TProject }
+
+constructor TProject.Create;
+begin
+  inherited Create;
+  
+  ObjectFiles := TStringList.Create;
+end;
+
+destructor TProject.Destroy;
+begin
+  ObjectFiles.Free;
+
+  inherited Destroy;
+end;
+
+{*******************************************************************
+*  TProject.ParseFile ()
+*
+*  DESCRIPTION:    Parses the project file
+*
+*  PARAMETERS:     None
+*
+*  RETURNS:        Nothing
+*
+*******************************************************************}
+procedure TProject.ParseFile;
+var
+  IniFile: TIniFile;
+begin
+  IniFile := TIniFile.Create(opts.ProjectFile);
+  try
+    ExeName := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_ExeName, 'default.exe');
+    Language := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_Language, 'Pascal');
+
+    CompilerPath := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_CompilerPath, 'C:\Programas\fpc21\compiler\ppc386.exe');
+    AssemblerPath := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_AssemblerPath, 'C:\Programas\lazarus20\fpc\2.1.5\bin\i386-win32\as.exe');
+    RTLUnitsDir := IniFile.ReadString(STR_PRJ_FPC, STR_PRJ_RTLUnitsDir, 'C:\Programas\fpc21\rtl\units\i386-symbian\');
+
+    UID2 := IniFile.ReadString(STR_PRJ_UIDs, STR_PRJ_UID2, '0x100039CE');
+    UID3 := IniFile.ReadString(STR_PRJ_UIDs, STR_PRJ_UID3, '0xE1000002');
+
+    MainSource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainSource, 'default.pas');
+    MainSourceNoExt := ExtractFileExt(MainSource);
+    MainResource := IniFile.ReadString(STR_PRJ_Files, STR_PRJ_MainResource, 'default.rss');
+    RegResource :=  IniFile.ReadString(STR_PRJ_Files, STR_PRJ_RegResource, 'default_reg.rss');
+    
+    IniFile.ReadSection(STR_PRJ_Objects, ObjectFiles);
+  finally
+    IniFile.Free;
+  end;
+end;
+
+end.
+

+ 88 - 0
utils/mksymbian/sdkutil.pas

@@ -0,0 +1,88 @@
+{
+sdkutil.pas
+
+SDK utility methods
+
+Copyright (C) 2006-2007 Felipe Monteiro de Carvalho
+
+This file is part of MkSymbian build tool.
+
+MkSymbian is free software;
+you can redistribute it and/or modify it under the
+terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+
+MkSymbian is distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+Please note that the General Public License version 2 does not permit
+incorporating MkSymbian into proprietary programs.
+}
+unit sdkutil;
+
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+
+interface
+
+uses
+  Classes, SysUtils, registry;
+
+type
+
+  { TSDKUtil }
+
+  TSDKUtil = class(TObject)
+  private
+    vSDKFolder, vSDKPartialFolder: string;
+  public
+    constructor Create;
+    procedure LocateSDK;
+
+    property SDKFolder: string read vSDKFolder;
+    property SDKPartialFolder: string read vSDKPartialFolder;
+  end;
+
+var
+  vSDKUtil: TSDKUtil;
+
+implementation
+
+{ TSDKUtil }
+
+procedure TSDKUtil.LocateSDK;
+var
+  Reg: TRegistry;
+  BufferStr: string;
+begin
+  Reg := TRegistry.Create;
+ 
+  try
+    Reg.RootKey := HKEY_LOCAL_MACHINE;
+    if Reg.OpenKey('\SOFTWARE\Symbian\UIQ\SDK\UIQ3SDK', False) then
+    begin
+      BufferStr := Reg.ReadString('InstallPath');
+      vSDKFolder := IncludeTrailingBackslash(BufferStr);
+      vSDKPartialFolder := Copy(vSDKFolder, 3, Length(vSDKFolder) - 2);
+    end
+    else
+    begin
+      WriteLn('  ERROR: Could not locate the SDK, using default values');
+      vSDKPartialFolder := '\Symbian\UIQ3SDK\';
+      vSDKFolder := 'C:' + vSDKPartialFolder;
+    end;
+  finally
+    Reg.Free;
+  end;
+end;
+
+constructor TSDKUtil.Create;
+begin
+  LocateSDK;
+end;
+
+end.
+