summaryrefslogtreecommitdiff
path: root/src/DataTypes.pas
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2009-09-29 14:01:03 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2009-09-29 14:01:03 +0200
commit082e8e7f4c615d5a3fd65971f2f7106ff72396dc (patch)
treed58416618d187dcc3aaff1e4b17c039cf884943b /src/DataTypes.pas
parentfb46ad2f08fb9d2d1e0db9956547dfd1a5a06a68 (diff)
downloadfpGUI-082e8e7f4c615d5a3fd65971f2f7106ff72396dc.tar.xz
Ported some basic IPF units to Free Pascal.
Signed-off-by: Graeme Geldenhuys <graeme@mastermaths.co.za>
Diffstat (limited to 'src/DataTypes.pas')
-rw-r--r--src/DataTypes.pas58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/DataTypes.pas b/src/DataTypes.pas
new file mode 100644
index 00000000..be4de565
--- /dev/null
+++ b/src/DataTypes.pas
@@ -0,0 +1,58 @@
+Unit DataTypes;
+
+{$mode objfpc}{$H+}
+{$ASMMODE intel}
+
+// NewView - a new OS/2 Help Viewer
+// Copyright 2001 Aaron Lawrence (aaronl at consultant dot com)
+// This software is released under the Gnu Public License - see readme.txt
+
+Interface
+
+// Just defines various types useful in manipulating help files.
+
+type
+ int32 = longword;
+ int16 = word;
+ int8 = byte;
+ pInt16 = ^int16;
+ pInt32 = ^int32;
+ pInt8 = ^byte;
+
+ PCharArray = array[ 0..0 ] of PCHar;
+ Int32Array = array[ 0..0 ] of Int32;
+ Int16Array = array[ 0..0 ] of Int16;
+ Int8Array = array[ 0..0 ] of Int8;
+
+ PCharArrayPointer = ^PCharArray;
+ Int32ArrayPointer = ^Int32Array;
+ Int16ArrayPointer = ^Int16Array;
+ Int8ArrayPointer = ^Int8Array;
+
+ TBooleanArray = array[ 0..0 ] of boolean;
+ BooleanArrayPointer = ^TBooleanArray;
+
+procedure FillInt32Array( pArray: Int32ArrayPointer;
+ Size: longint;
+ Value: Int32 );
+
+Implementation
+
+// This is a nice fast implementation of filling an
+// array of dwords (Int32/longword)
+procedure FillInt32Array( pArray: Int32ArrayPointer;
+ Size: longint;
+ Value: Int32 );
+begin
+ assert( Size > 0 );
+ Asm
+ Mov EAX, Value
+ Mov EDI, pArray
+ Mov ECX, Size
+ CLD // direction = up
+ REP STOSD // store double word, until ECX = 0
+ End;
+end;
+
+Initialization
+End.