File: cs_wrap.doc

package info (click to toggle)
crystalspace 0.94-20020412-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 62,276 kB
  • ctags: 52,843
  • sloc: cpp: 274,783; ansic: 6,608; perl: 6,276; objc: 3,952; asm: 2,942; python: 2,354; php: 542; pascal: 530; sh: 430; makefile: 370; awk: 193
file content (700 lines) | stat: -rw-r--r-- 13,696 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
plugins/cscript/cspython/cs_pyth.cpp

[ Python Module : cspace ]


1.  Pointer Handling Library
============================

%include pointer.i

The pointer.i library provides run-time support for managing and 
manipulating a variety of C/C++ pointer values.  In particular,
you can create various kinds of objects and dereference common
pointer types.  This is done through a common set of functions:

    ptrcast      - Casts a pointer to a new type
    ptrvalue     - Dereferences a pointer 
    ptrset       - Set the value of an object referenced by 
                   a pointer.
    ptrcreate    - Create a new object and return a pointer.
    ptrfree      - Free the memory allocated by ptrcreate.
    ptradd       - Increment/decrement a pointer value.
    ptrmap       - Make two datatypes equivalent to each other.
                   (Is a runtime equivalent of typedef).

When creating, dereferencing, or setting the value of pointer
variable, only the common C datatypes of int, short, long, float,
double, char, and char * are currently supported.   Other
datatypes may generate an error.

One of the more interesting aspects of this library is that
it operates with a wide range of datatypes.  For example,
the "ptrvalue" function can dereference "double *", "int *",
"long *", "char *", and other datatypes. Since SWIG encodes
pointers with type information, this can be done transparently
and in most cases, you can dereference a pointer without
ever knowing what type it actually is.

This library is primarily designed for utility, not high 
performance (the dynamic determination of pointer types takes
more work than most normal wrapper functions).  As a result,
you may achieve better performance by writing customized
"helper" functions if you're making lots of calls to these
functions in inner loops or other intensive operations.

ptrcast(ptr,type)
        Casts a pointer ptr to a new datatype given by the string type.
        type may be either the SWIG generated representation of a datatype
        or the C representation.  For example :
        
           ptrcast(ptr,"double_p");   # Python representation
           ptrcast(ptr,"double *");    # C representation
        
        A new pointer value is returned.   ptr may also be an integer
        value in which case the value will be used to set the pointer
        value.  For example :
        
           a = ptrcast(0,"Vector_p");
        
        Will create a NULL pointer of type "Vector_p"
        
        The casting operation is sensitive to formatting.  As a result,
        "double *" is different than "double*".  As a result of thumb,
        there should always be exactly one space between the C datatype
        and any pointer specifiers (*).
        
ptrvalue(ptr,index,type)
        Returns the value that a pointer is pointing to (ie. dereferencing).
        The type is automatically inferred by the pointer type--thus, an
        integer pointer will return an integer, a double will return a double,
        and so on.   The index and type fields are optional parameters.  When
        an index is specified, this function returns the value of ptr[index].
        This allows array access.   When a type is specified, it overrides
        the given pointer type.   Examples :
        
           ptrvalue(a)             #  Returns the value *a
           ptrvalue(a,10)          #  Returns the value a[10]
           ptrvalue(a,10,"double") #  Returns a[10] assuming a is a double *
        
ptrset(ptr,value,index,type)
        Sets the value pointed to by a pointer.  The type is automatically
        inferred from the pointer type so this function will work for
        integers, floats, doubles, etc...  The index and type fields are
        optional.  When an index is given, it provides array access.  When
        type is specified, it overrides the given pointer type.  Examples :
        
          ptrset(a,3)            # Sets the value *a = 3
          ptrset(a,3,10)         # Sets a[10] = 3
          ptrset(a,3,10,"int")   # Sets a[10] = 3 assuming a is a int *
        
ptrcreate(type,value,nitems)
        Creates a new object and returns a pointer to it.  This function 
        can be used to create various kinds of objects for use in C functions.
        type specifies the basic C datatype to create and value is an
        optional parameter that can be used to set the initial value of the
        object.  nitems is an optional parameter that can be used to create
        an array.  This function results in a memory allocation using
        malloc().  Examples :
        
          a = ptrcreate("double")     # Create a new double, return pointer
          a = ptrcreate("int",7)      # Create an integer, set value to 7
          a = ptrcreate("int",0,1000) # Create an integer array with initial
                                      # values all set to zero
        
        This function only recognizes a few common C datatypes as listed below :
        
               int, short, long, float, double, char, char *, void
        
        All other datatypes will result in an error.  However, other
        datatypes can be created by using the ptrcast function.  For
        example:
        
         a = ptrcast(ptrcreate("int",0,100),"unsigned int *")
        
ptrfree(ptr)
        Destroys the memory pointed to by ptr.  This function calls free()
        and should only be used with objects created by ptrcreate().  Since
        this function calls free, it may work with other objects, but this
        is generally discouraged unless you absolutely know what you're
        doing.
        
ptradd(ptr,offset)
        Adds a value to the current pointer value.  For the C datatypes of
        int, short, long, float, double, and char, the offset value is the
        number of objects and works in exactly the same manner as in C.  For
        example, the following code steps through the elements of an array
        
         a = ptrcreate("double",0,100);    # Create an array double a[100]
         b = a;
         for i in range(0,100):
             ptrset(b,0.0025*i);           # set *b = 0.0025*i
             b = ptradd(b,1);              # b++ (go to next double)
        
        In this case, adding one to b goes to the next double.
        
        For all other datatypes (including all complex datatypes), the
        offset corresponds to bytes.  This function does not perform any
        bounds checking and negative offsets are perfectly legal.  
        
ptrmap(type1,type2)
        This is a rarely used function that performs essentially the same
        operation as a C typedef.  To manage datatypes at run-time, SWIG
        modules manage an internal symbol table of type mappings.  This
        table keeps track of which types are equivalent to each other.  The
        ptrmap() function provides a mechanism for scripts to add symbols
        to this table.  For example :
        
           ptrmap("double_p","Real_p");
        
        would make the types "doublePtr" and "RealPtr" equivalent to each
        other.  Pointers of either type could now be used interchangably.
        
        Normally this function is not needed, but it can be used to
        circumvent SWIG's normal type-checking behavior or to work around
        weird type-handling problems.
        
1.1.  class iBase
-----------------

DecRef()

1.2.  class iSCF
----------------

CreateInstance(iClassID,iInterfaceID,iVersion)

----------

MakeVersion(version0,version1,version2)

1.3.  class csVector3
---------------------

self.x

self.y

self.z

csVector3(x,y,z)

del this

1.4.  class csRGBpixel
----------------------

self.red

self.green

self.blue

self.alpha

1.5.  class csPixelFormat
-------------------------

self.RedMask

self.GreenMask

self.BlueMask

self.RedShift

self.GreenShift

self.BlueShift

self.RedBits

self.GreenBits

self.BlueBits

self.PalEntries

self.PixelBytes

1.6.  class csGraphics3DCaps
----------------------------

self.CanClip

self.minTexHeight

self.minTexWidth

self.maxTexHeight

self.maxTexWidth

self.fog

self.NeedsPO2Maps

self.MaxAspectRatio

1.7.  class csImageArea
-----------------------

self.x

self.y

self.w

self.h

self.data

csImageArea(sx,sy,sw,sh)

1.8.  class iComponent
----------------------

Initialize(object_reg)

1.9.  class iEventHandler
-------------------------

HandleEvent(iEvent *)

1.10.  class iTextureWrapper
----------------------------

1.11.  class iTextureHandle
---------------------------

GetMipMapDimensions(mipmap,mw,mh)

GetMeanColor(red,green,blue)

GetCacheData()

SetCacheData(d)

GetPrivateObject()

1.12.  class iMaterialHandle
----------------------------

GetTexture()

GetFlatColor(oColor)

GetReflection(oDiffuse,oAmbient,oReflection)

Prepare()

1.13.  class iMaterialWrapper
-----------------------------

GetMaterialHandle()

1.14.  class iFont
------------------

SetSize(iSize)

GetSize()

GetMaxSize(oW,oH)

GetGlyphSize(c,oW,oH)

GetGlyphBitmap(c,oW,oH)

GetDimensions(text,oW,oH)

GetLength(text,maxwidth)

1.15.  class iFontServer
------------------------

LoadFont(filename)

GetFontCount()

GetFont(iIndex)

1.16.  class iGraphics2D
------------------------

Open()

Close()

GetWidth()

GetHeight()

GetFullScreen()

GetPage()

DoubleBuffer(Enable)

GetDoubleBufferState()

GetPixelFormat()

GetPixelBytes()

GetPalEntryCount()

GetPalette()

SetRGB(i,r,g,b)

SetClipRect(nMinX,nMinY,nMaxX,nMaxY)

GetClipRect(nMinX,nMinY,nMaxX,nMaxY)

BeginDraw()

FinishDraw()

Print(pArea)

Clear(color)

ClearAll(color)

DrawLine(x1,y1,x2,y2,color)

DrawBox(x,y,w,h,color)

ClipLine(x1,y1,x2,y2,xmin,ymin,xmax,ymax)

DrawPixel(x,y,color)

GetPixelAt(x,y)

GetPixel(x,y,oR,oG,oB)

SaveArea(x,y,w,h)

RestoreArea(Area,Free)

FreeArea(Area)

Write(font,x,y,fg,bg,str)

GetFontServer()

SetMousePosition(x,y)

SetMouseCursor(iShape)
         virtual bool PerformExtension (char const* command, ...) = 0;
         virtual bool PerformExtensionV (char const* command, va_list) = 0;
        
ScreenShot()

CreateOffScreenCanvas(width,height,buffer,alone_hint,ipfmt,palette,pal_size)

AllowResize(iAllow)

1.17.  class iHalo
------------------

GetWidth()

GetHeight()

SetColor(iR,iG,iB)

GetColor(oR,oG,oB)

Draw(x,y,w,h,iIntensity,iVertices,iVertCount)

1.18.  class iGraphics3D
------------------------

Open()

Close()

SetDimensions(width,height)

BeginDraw(DrawFlags)

FinishDraw()

Print(area)

DrawPolygon(poly)

DrawPolygonDebug(poly)

DrawLine(v1,v2,fov,color)
        oid DrawPolygonFX (G3DPolygonDPFX& poly);
        
DrawTriangleMesh(mesh)

DrawPolygonMesh(mesh)

OpenFogObject(id,fog)

DrawFogPolygon(id,poly,fogtype)

CloseFogObject(id)
        ool SetRenderState (G3D_RENDERSTATEOPTION op, long val);
        ong GetRenderState (G3D_RENDERSTATEOPTION op);
        
GetCaps()

GetZBuffAt(x,y)

GetZBuffValue(x,y)

DumpCache()

ClearCache()

RemoveFromCache(poly_texture)

GetWidth()

GetHeight()

SetPerspectiveCenter(x,y)

SetPerspectiveAspect(aspect)

SetObjectToCamera(o2c)

GetDriver2D()

GetTextureManager()

CreateHalo(iR,iG,iB,iAlpha,iWidth,iHeight)

DrawPixmap(hTex,sx,sy,sw,sh,tx,ty,tw,th)

1.19.  class iCamera
--------------------

GetFOV()

GetInvFOV()

1.20.  class iSector
--------------------

1.21.  class iThingState
------------------------

CreatePolygon(name)

1.22.  class iMeshObject
------------------------

Query_iThingState()

1.23.  class iMeshWrapper
-------------------------

GetMeshObject()

1.24.  class iLightMap
----------------------

GetMapData()

GetWidth()

GetHeight()

GetRealWidth()

GetRealHeight()

GetCacheData()

SetCacheData(d)

GetMeanLighting(r,g,b)

GetSize()

1.25.  class iPolygon3D
-----------------------

GetLightMap()

GetMaterialHandle()

SetMaterial(material)
        PolygonTexture *GetTexture ();
        TextureHandle *GetTextureHandle ();
        
GetVertexCount()

GetVertex(idx)

GetVertexW(idx)

GetVertexC(idx)

CreateVertexByIndex(idx)

CreateVertex(iVertex)

GetAlpha()

SetAlpha(iAlpha)

CreatePlane(iOrigin,iMatrix)

SetPlane(iName)

SetTextureSpace(v_orig,v1,len1)

1.26.  class iImage
-------------------

GetImageData()

GetWidth()

GetHeight()

GetSize()

Rescale(NewWidth,NewHeight)

MipMap(step,transp)

SetName(iName)

GetName()

GetFormat()

GetPalette()

GetAlpha()

SetFormat(iFormat)

Clone()

Crop(x,y,width,height)

1.27.  class iTextureManager
----------------------------

RegisterTexture(image,flags)

PrepareTextures()

FreeImages()

ResetPalette()

ReserveColor(r,g,b)

FindRGB(r,g,b)

SetPalette()

SetVerbose(vb)

GetTextureFormat()

1.28.  class iPolygonTexture
----------------------------

GetMaterialHandle()
        TextureHandle *GetTextureHandle ();
        
GetFDU()

GetFDV()

GetWidth()

GetHeight()

GetShiftU()

GetIMinU()

GetIMinV()

GetTextureBox(fMinU,fMinV,fMaxU,fMaxV)

GetOriginalWidth()

GetPolygon()

DynamicLightsDirty()

RecalculateDynamicLights()

GetLightMap()

GetLightCellSize()

GetLightCellShift()

GetCacheData(idx)

SetCacheData(idx,d)

1.29.  class iCameraPosition
----------------------------

1.30.  class iSectorList
------------------------

GetCount()

Get(idx)

Add(sec)

Remove(sec)

FindByName(name)

1.31.  class iMaterialList
--------------------------

FindByName(name)

1.32.  class iTextureList
-------------------------

FindByName(name)

1.33.  class iEngine
--------------------

GetTextureFormat()

DeleteAll()

CreateTexture(iName,iFileName,iTransp,iFlags)

CreateSector(iName)

CreateSectorWallsMesh(sector,name)

GetSectors()

GetMaterialList()

GetTextureList()

1.34.  class iObjectRegistry
----------------------------

Query_iEngine()

Query_iGraphics3D()

Print(mode,format)