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

« back to all changes in this revision

Viewing changes to packages/extra/os2units/mmtk/dive.pas

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

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
{****************************************************************************
2
 
 
3
 
    $Id: dive.pas,v 1.3 2003/02/15 18:44:55 hajny Exp $
4
 
 
5
 
                             DIVE interface unit
6
 
                     FPC Pascal Runtime Library for OS/2
7
 
             Copyright (c) 1999-2000 by Karoly Balogh (aka Charlie/INQ)
8
 
 
9
 
 The FPC Pascal runtime library is distributed under the Library GNU Public
10
 
 License v2. So is this unit. The Library GNU Public License requires you to
11
 
 distribute the source code of this unit with any product that uses it.
12
 
 Because the EMX library isn't under the LGPL, we grant you an exception to
13
 
 this, and that is, when you compile a program with the Free Pascal Compiler,
14
 
 you do not need to ship source code with that program, AS LONG AS YOU ARE
15
 
 USING UNMODIFIED CODE! If you modify this code, you MUST change the next
16
 
 line:
17
 
 
18
 
 <This an official, unmodified Free Pascal source code file.>
19
 
 
20
 
 Send us your modified files, we can work together if you want!
21
 
 
22
 
 Free Pascal is distributed in the hope that it will be useful,
23
 
 but WITHOUT ANY WARRANTY; without even the implied warranty of
24
 
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
 
 Library GNU General Public License for more details.
26
 
 
27
 
 You should have received a copy of the Library GNU General Public License
28
 
 along with Free Pascal; see the file COPYING.LIB.  If not, write to
29
 
 the Free Software Foundation, 59 Temple Place - Suite 330,
30
 
 Boston, MA 02111-1307, USA.
31
 
 
32
 
****************************************************************************}
33
 
 
34
 
Unit DIVE;
35
 
 
36
 
{Warning: This code is alfa. Future versions of this unit will propably
37
 
 not be compatible.}
38
 
 
39
 
Interface
40
 
 
41
 
Uses OS2Def, PMWin, MMBase;
42
 
 
43
 
Const Max_Dive_Instances = 64;
44
 
 
45
 
      DIVE_Success                       = $00000000;
46
 
      DIVE_Err_Invalid_Instance          = $00001000;
47
 
      DIVE_Err_Source_Format             = $00001001;
48
 
      DIVE_Err_Destination_Format        = $00001002;
49
 
      DIVE_Err_Blitter_Not_Setup         = $00001003;
50
 
      DIVE_Err_Insufficient_Length       = $00001004;
51
 
      DIVE_Err_Too_Many_Instances        = $00001005;
52
 
      DIVE_Err_No_Direct_Access          = $00001006;
53
 
      DIVE_Err_Not_Bank_Switched         = $00001007;
54
 
      DIVE_Err_Invalid_Bank_Number       = $00001008;
55
 
      DIVE_Err_FB_Not_Acquired           = $00001009;
56
 
      DIVE_Err_FB_Already_Acquired       = $0000100A;
57
 
      DIVE_Err_Acquire_Failed            = $0000100B;
58
 
      DIVE_Err_Bank_Switch_Failed        = $0000100C;
59
 
      DIVE_Err_Deacquire_Failed          = $0000100D;
60
 
      DIVE_Err_Invalid_Palette           = $0000100E;
61
 
      DIVE_Err_Invalid_Destination_RECTL = $0000100F;
62
 
      DIVE_Err_Invalid_Buffer_Number     = $00001010;
63
 
      DIVE_Err_SSMDD_Not_Installed       = $00001011;
64
 
      DIVE_Err_Buffer_Already_Accessed   = $00001012;
65
 
      DIVE_Err_Buffer_Not_Accessed       = $00001013;
66
 
      DIVE_Err_Too_Many_Bufffers         = $00001014;
67
 
      DIVE_Err_Allocation_Error          = $00001015;
68
 
      DIVE_Err_Invalid_Linesize          = $00001016;
69
 
      DIVE_Err_Fatal_Exception           = $00001017;
70
 
      DIVE_Err_Invalid_Conversion        = $00001018;
71
 
      DIVE_Err_VSD_Error                 = $00001019;
72
 
      DIVE_Err_Color_Support             = $0000101A;
73
 
      DIVE_Err_Out_Of_Range              = $0000101B;
74
 
      DIVE_Warn_No_Size                  = $00001100;
75
 
 
76
 
      DIVE_Buffer_Screen                 = $00000000;
77
 
      DIVE_Buffer_Graphics_Plane         = $00000001;
78
 
      DIVE_Buffer_Alternate_Plane        = $00000002;
79
 
 
80
 
      DIVE_Fully_Visible                 = $FFFFFFFF;
81
 
 
82
 
      { * Use either of the two defines as the bRGB2Entries pointer to have DIVE  * }
83
 
      { * query and set the physical or default palette as source or destination. * }
84
 
 
85
 
      DIVE_Palette_Physical = $00000000;
86
 
      DIVE_Palette_Default  = $FFFFFFFF;
87
 
 
88
 
Type  HDIVE  = cardinal;
89
 
 
90
 
      { * Blitter setup structures * }
91
 
      TSetup_Blitter = Record
92
 
        ulStructLen : cardinal; { * ulStructLen tells how much of the structure is used.     * }
93
 
                             { * Comments here show appropriate values, so don't count ;) * }
94
 
 
95
 
        fInvert     : cardinal; { * Image is inverted on blit * }
96
 
                             { * fInvert use: * }
97
 
                             { * %0001 = 01 = $01 horizontal flip * }
98
 
                             { * %0010 = 02 = $02 vertical flip   * }
99
 
 
100
 
        { * This is the mark for 8 bytes * }
101
 
 
102
 
        fccSrcColorFormat : FourCC;   { * Source data format * }
103
 
        ulSrcWidth        : cardinal;    { * Width in pels  * }
104
 
        ulSrcHeight       : cardinal;    { * Height in pels * }
105
 
                                      { * The following are for displaying a sub-portion of the image. * }
106
 
        ulSrcPosX         : cardinal;    { * X Position of source data * }
107
 
        ulSrcPosY         : cardinal;    { * Y Position of source data * }
108
 
 
109
 
        { * This is the mark for 28 bytes * }
110
 
 
111
 
        ulDitherType      : cardinal;    { * Dither type * }
112
 
 
113
 
        { * 32 byte mark * }
114
 
 
115
 
        fccDstColorFormat : FourCC;   { * Destination color format   * }
116
 
        ulDstWidth        : cardinal;    { * Destination width in pels  * }
117
 
        ulDstHeight       : cardinal;    { * Destination height in pels * }
118
 
        lDstPosX          : LongInt;
119
 
        lDstPosY          : LongInt;
120
 
 
121
 
        { * 52 byte mark * }
122
 
 
123
 
        lScreenPosX       : LongInt;
124
 
        lScreenPosY       : LongInt;
125
 
 
126
 
        { * 60 byte mark * }
127
 
 
128
 
        ulNumDstRects     : cardinal;
129
 
        pVisDstRects      : PRectl; { * This is a pointer to an array of visible rectangles. * }
130
 
 
131
 
        { * 68 bytes = fully used * }
132
 
       End;
133
 
 
134
 
      PSetup_Blitter = ^TSetup_Blitter;
135
 
 
136
 
      { * Stuff for DiveQueryCaps() * }
137
 
      TDIVE_CAPS = Record
138
 
        ulStructLen   : cardinal;  { * SizeOf(TDIVE_CAPS)       * }
139
 
        ulPlaneCount  : cardinal;  { * Number of defined planes * }
140
 
 
141
 
        { * Following info applies to ulPlaneID * }
142
 
        fScreenDirect : Boolean;  { * Direct screen access (was type BOOL in C) * }
143
 
        fBankSwitched : Boolean;  { * VRAM bank-switched? (was type BOOL in C) * }
144
 
        ulDepth       : cardinal;  { * Number of bits per pixel * }
145
 
        ulHorizontalResolution : cardinal;
146
 
        ulVerticalResolution   : cardinal;
147
 
        ulScanLineBytes        : cardinal;
148
 
        fccColorEncoding       : FourCC;
149
 
        ulApertureSize         : cardinal;
150
 
 
151
 
        ulInputFormats   : cardinal;   { * Number of input color formats * }
152
 
        ulOutputFormats  : cardinal;
153
 
        ulFormatLength   : cardinal;   { * Length of format buffer * }
154
 
        pFormatData      : Pointer; { * Pointer to format buffer of FOURCC's * }
155
 
       End;
156
 
 
157
 
      PDIVE_CAPS = ^TDIVE_CAPS;
158
 
 
159
 
Function DiveQueryCaps(DiveCaps: PDIVE_CAPS; ulPlaneBufNum : cardinal) : cardinal; cdecl;
160
 
 
161
 
Function DiveOpen(Var phDiveInst : cardinal; fNonScreenInstance : cardinal;
162
 
                  Var ppFrameBuffer : Pointer) : cardinal; cdecl;
163
 
Function DiveClose(hDiveInst : cardinal) : cardinal; cdecl;
164
 
 
165
 
Function DiveSetupBlitter(hDiveInst : cardinal; pSetupBlitter : PSetup_Blitter) : cardinal; cdecl;
166
 
Function DiveBlitImage(hDiveInst : cardinal; ulSrcBufNumber : cardinal; ulDstBufNumber : cardinal) : cardinal; cdecl;
167
 
 
168
 
Function DiveAcquireFrameBuffer(hDiveInst : cardinal; prectlDst : PRectl) : cardinal; cdecl;
169
 
Function DiveDeacquireFrameBuffer(hDiveInst : cardinal) : cardinal; cdecl;
170
 
Function DiveCalcFrameBufferAddress(hDiveInst           : cardinal;
171
 
                                    prectlDest          : PRectl;
172
 
                                Var pDestinationAddress : Pointer;
173
 
                                Var ulBankNumber        : cardinal;
174
 
                                Var ulRemLinesInBank    : cardinal) : cardinal; cdecl;
175
 
Function DiveSwitchBank(hDiveInst : cardinal; ulBankNumber : cardinal) : cardinal; cdecl;
176
 
 
177
 
{ Notes on DiveAllocImageBuffer:
178
 
  If pbImageBuffer is not NULL, the buffer is associated rather than
179
 
  allocated.  If pbImageBuffer is not NULL and the buffer number
180
 
  pointed to by pulBufferNumber is non-zero, a new buffer pointer is
181
 
  associated with the buffer number.  Even though no memory is
182
 
  allocated by DiveAllocImageBuffer when user-allocated buffers are
183
 
  associated, DiveFreeImageBuffer should be called to release the
184
 
  buffer association to avoid using up available buffer indexes.
185
 
  The specified line size will be used if a buffer is allocated in
186
 
  system memory, or if a user buffer is associated.  If the
187
 
  specified line size is zero, the allocated line size is rounded up
188
 
  to the nearest DWORD boundry. }
189
 
 
190
 
Function DiveAllocImageBuffer(hDiveInst       : cardinal;
191
 
                          Var ulBufferNumber  : cardinal;
192
 
                              fccColorSpace   : FourCC;
193
 
                              ulWidth         : cardinal;
194
 
                              ulHeight        : cardinal;
195
 
                              ulLineSizeBytes : cardinal;
196
 
                          Var bImageBuffer    : Pointer) : cardinal; cdecl;
197
 
Function DiveFreeImageBuffer(hDiveInst : cardinal; ulBufferNumber : cardinal) : cardinal; cdecl;
198
 
 
199
 
Function DiveBeginImageBufferAccess(hDiveInst              : cardinal;
200
 
                                    ulBufferNumber         : cardinal;
201
 
                                Var pbImageBuffer          : Pointer;
202
 
                                Var ulBufferScanLineBytes  : cardinal;
203
 
                                Var ulBufferScanLines      : cardinal) : cardinal; cdecl;
204
 
Function DiveEndImageBufferAccess(hDiveInst : cardinal; ulBufferNumber : cardinal) : cardinal; cdecl;
205
 
 
206
 
 
207
 
{/* Notes on palettes:
208
 
      Neither DiveSetSourcePalette nor DiveSetDestinationPalette API's will set
209
 
      the physical palette.  If your application MUST set the PHYSICAL palette,
210
 
      try using no more than 236 entries (the middle 236: 10-245, thus leaving
211
 
      the top and bottom 10 entries for the Workplace Shell).  If your
212
 
      application MUST use ALL 256 entries, it must do so as a full-screen
213
 
      (i.e. maximized) application.  Remember, No WM_REALIZEPALETTE message
214
 
      will be sent to other running applications, meaning they will not redraw
215
 
      and their colors will be all wrong.  It is not recommended that a
216
 
      developer use these commands:
217
 
 
218
 
   To set physical palette, do the following:
219
 
            hps = WinGetPS ( HWND_DESKTOP );
220
 
            hdc = GpiQueryDevice ( hps );
221
 
            GpiCreateLogColorTable ( hps, LCOL_PURECOLOR | LCOL_REALIZABLE,
222
 
                           LCOLF_CONSECRGB, 0, 256, (PLONG)plRGB2Entries );
223
 
            Gre32EntrY3 ( hdc, 0L, 0x000060C6L );
224
 
            WinInvalidateRect ( HWND_DESKTOP, (PRECTL)NULL, TRUE );
225
 
            WinReleasePS ( hps );
226
 
 
227
 
   To reset physical palette, do the following:
228
 
            hps = WinGetPS ( HWND_DESKTOP );
229
 
            hdc = GpiQueryDevice ( hps );
230
 
            Gre32EntrY3 ( hdc, 0L, 0x000060C7L );
231
 
            WinInvalidateRect ( HWND_DESKTOP, (PRECTL)NULL, TRUE );
232
 
            WinReleasePS ( hps );
233
 
*/}
234
 
 
235
 
Function DiveSetDestinationPalette(hDiveInst    : cardinal;
236
 
                                   ulStartIndex : cardinal;
237
 
                                   ulNumEntries : cardinal;
238
 
                               Var bRGB2Entries : Pointer) : cardinal; cdecl;
239
 
 
240
 
Function DiveSetSourcePalette(hDiveInst    : cardinal;
241
 
                              ulStartIndex : cardinal;
242
 
                              ulNumEntries : cardinal;
243
 
                          Var bRGB2Entries : Pointer) : cardinal; cdecl;
244
 
 
245
 
Function DiveSetTransparentBlitMode(hDiveInst    : cardinal;
246
 
                                    ulStartIndex : cardinal;
247
 
                                    ulValue1     : cardinal;
248
 
                                    ulValue2     : cardinal) : cardinal; cdecl;
249
 
 
250
 
Implementation
251
 
 
252
 
Function DiveQueryCaps(DiveCaps : PDIVE_CAPS; ulPlaneBufNum : cardinal) : cardinal; cdecl;
253
 
External 'DIVE' Index 1;
254
 
 
255
 
Function DiveOpen(Var phDiveInst : cardinal; fNonScreenInstance : cardinal; Var ppFrameBuffer : Pointer) : cardinal; cdecl;
256
 
External 'DIVE' Index 2;
257
 
 
258
 
Function DiveClose(hDiveInst : cardinal) : cardinal; cdecl;
259
 
External 'DIVE' Index 3;
260
 
 
261
 
Function DiveSetupBlitter(hDiveInst : cardinal; pSetupBlitter : PSetup_Blitter) : cardinal; cdecl;
262
 
External 'DIVE' Index 4;
263
 
 
264
 
Function DiveBlitImage(hDiveInst : cardinal; ulSrcBufNumber : cardinal; ulDstBufNumber : cardinal) : cardinal; cdecl;
265
 
External 'DIVE' Index 5;
266
 
 
267
 
Function DiveAcquireFrameBuffer(hDiveInst : cardinal; prectlDst : PRectl) : cardinal; cdecl;
268
 
External 'DIVE' Index 6;
269
 
 
270
 
Function DiveDeacquireFrameBuffer(hDiveInst : cardinal) : cardinal; cdecl;
271
 
External 'DIVE' Index 8;
272
 
 
273
 
Function DiveCalcFrameBufferAddress(hDiveInst           : cardinal;
274
 
                                    prectlDest          : PRectl;
275
 
                                Var pDestinationAddress : Pointer;
276
 
                                Var ulBankNumber        : cardinal;
277
 
                                Var ulRemLinesInBank    : cardinal) : cardinal; cdecl;
278
 
External 'DIVE' Index 11;
279
 
 
280
 
Function DiveSwitchBank(hDiveInst : cardinal; ulBankNumber : cardinal) : cardinal; cdecl;
281
 
External 'DIVE' Index 7;
282
 
 
283
 
 
284
 
Function DiveAllocImageBuffer(hDiveInst       : cardinal;
285
 
                          Var ulBufferNumber  : cardinal;
286
 
                              fccColorSpace   : FourCC;
287
 
                              ulWidth         : cardinal;
288
 
                              ulHeight        : cardinal;
289
 
                              ulLineSizeBytes : cardinal;
290
 
                          Var bImageBuffer    : Pointer) : cardinal; cdecl;
291
 
External 'DIVE' Index 12;
292
 
 
293
 
Function DiveFreeImageBuffer(hDiveInst      : cardinal;
294
 
                             ulBufferNumber : cardinal) : cardinal; cdecl;
295
 
External 'DIVE' Index 13;
296
 
 
297
 
Function DiveBeginImageBufferAccess(hDiveInst              : cardinal;
298
 
                                    ulBufferNumber         : cardinal;
299
 
                                Var pbImageBuffer          : Pointer;
300
 
                                Var ulBufferScanLineBytes  : cardinal;
301
 
                                Var ulBufferScanLines      : cardinal) : cardinal; cdecl;
302
 
External 'DIVE' Index 14;
303
 
 
304
 
Function DiveEndImageBufferAccess(hDiveInst : cardinal; ulBufferNumber : cardinal) : cardinal; cdecl;
305
 
External 'DIVE' Index 15;
306
 
 
307
 
Function DiveSetDestinationPalette(hDiveInst    : cardinal;
308
 
                                   ulStartIndex : cardinal;
309
 
                                   ulNumEntries : cardinal;
310
 
                               Var bRGB2Entries : Pointer) : cardinal; cdecl;
311
 
External 'DIVE' Index 9;
312
 
 
313
 
Function DiveSetSourcePalette(hDiveInst    : cardinal;
314
 
                              ulStartIndex : cardinal;
315
 
                              ulNumEntries : cardinal;
316
 
                          Var bRGB2Entries : Pointer) : cardinal; cdecl;
317
 
External 'DIVE' Index 10;
318
 
 
319
 
Function DiveSetTransparentBlitMode(hDiveInst    : cardinal;
320
 
                                    ulStartIndex : cardinal;
321
 
                                    ulValue1     : cardinal;
322
 
                                    ulValue2     : cardinal) : cardinal; cdecl;
323
 
External 'DIVE' Index 18;
324
 
 
325
 
End.
326
 
 
327
 
{
328
 
  $Log: dive.pas,v $
329
 
  Revision 1.3  2003/02/15 18:44:55  hajny
330
 
    * mmtk directory corrected to lowercase
331
 
 
332
 
  Revision 1.1  2003/02/15 16:59:09  hajny
333
 
    * mmtk directory corrected to lowercase
334
 
 
335
 
  Revision 1.1  2003/02/09 13:49:06  hajny
336
 
    + mmtk added
337
 
 
338
 
}