Quellcode durchsuchen

Add "const" for the sprite data in the sprite function prototypes.

git-svn-id: file:///var/svn/tigccpp/trunk@268 9552661e-59e3-4036-b4f2-dbe53926924f
kevinkofler vor 19 Jahren
Ursprung
Commit
36fe284d11

+ 3 - 2
tigcc/doc/System/Include/sprites.h/Sprite16.hsf

@@ -3,7 +3,8 @@ Name=Sprite16
 Type=Function
 Subtype=tigcc.a
 Header Files=sprites.h
-Definition=void Sprite16 (short x, short y, short height, unsigned short *sprite, void *vm_addr, short mode);
+Definition=void Sprite16 (short x, short y, short height, const unsigned short *sprite, void *vm_addr, short mode);
+Real Definition=extern void Sprite16(short,short,short,__cpushort,void*,short)__ATTR_LIB_C__;
 
 [Description]
 Draws a sprite with a width of 16 pixels or less on the screen.
@@ -12,6 +13,6 @@ Draws a sprite with a width of 16 pixels or less on the screen.
 Sprite16 works exactly like <A HREF="$$LINK(Sprite8)">Sprite8</A>, but it takes sprites with a width of 16 pixels.
 <I>sprite</I> is now a pointer to the array of unsigned short integers which defines the sprite.
 So, to define a sprite (or sprite mask), use something like
-<PRE>static unsigned short sprite[] = {...};
+<PRE>static const unsigned short sprite[] = {...};
 </PRE>
 See <A HREF="$$LINK(Sprite8)">Sprite8</A> for more info about sprites.

+ 3 - 2
tigcc/doc/System/Include/sprites.h/Sprite32.hsf

@@ -3,7 +3,8 @@ Name=Sprite32
 Type=Function
 Subtype=tigcc.a
 Header Files=sprites.h
-Definition=void Sprite32 (short x, short y, short height, unsigned long *sprite, void *vm_addr, short mode);
+Definition=void Sprite32 (short x, short y, short height, const unsigned long *sprite, void *vm_addr, short mode);
+Real Definition=extern void Sprite32(short,short,short,__cpulong,void*,short)__ATTR_LIB_C__;
 
 [Description]
 Draws a sprite with a width of 32 pixels or less on the screen.
@@ -12,7 +13,7 @@ Draws a sprite with a width of 32 pixels or less on the screen.
 Sprite32 works exactly like <A HREF="$$LINK(Sprite8)">Sprite8</A>, but it takes sprites with a width of 32 pixels.
 <I>sprite</I> is now a pointer to the array of unsigned long integers which defines the sprite.
 So, to define a sprite (or sprite mask), use something like
-<PRE>static unsigned long sprite[] = {...};
+<PRE>static const unsigned long sprite[] = {...};
 </PRE>
 <B>Note:</B> If you define a sprite mask and invert it with the '~' operator, you need to take
 care of the possibility of the first two bytes being zero in one constant. In this case, the constant will

+ 5 - 5
tigcc/doc/System/Include/sprites.h/Sprite8.hsf

@@ -3,7 +3,7 @@ Name=Sprite8
 Type=Function
 Subtype=tigcc.a
 Header Files=sprites.h
-Definition=void Sprite8 (short x, short y, short height, unsigned char *sprite, void *vm_addr, short mode);
+Definition=void Sprite8 (short x, short y, short height, const unsigned char *sprite, void *vm_addr, short mode);
 
 [Description]
 Draws a sprite with a width of 8 pixels or less on the screen.
@@ -72,12 +72,12 @@ if you add the <B>'L'</B> suffix (see the respective info about <A HREF="$$LINK(
 Without this notation, you must use 0x00 in Sprite8, but 0xFF00 in <A HREF="$$LINK(Sprite16)">Sprite16</A>, and
 0xFFFFFF00 in <A HREF="$$LINK(Sprite32)">Sprite32</A>. This is why a notation like ~0xFF is more universal.
 <BR><BR>
-Starting from TIGCC v0.91, you can use binary numbers to define your sprites. On the one hand, this is clearly
-<B>not recommended</B> since it makes the program incompatible with other C dialects
-as well as previous versions of TIGCC. On the other hand, it makes designing a sprite much easier
+Starting from TIGCC v0.91, you can use binary numbers to define your sprites. On the one hand,
+it makes the program incompatible with other C dialects as well as previous (ancient) versions of
+TIGCC. On the other hand, it makes designing a sprite much easier
 and also allows for editing the sprite at a later time without having to reconvert it.
 The binary representation of the sprite presented above would look like this:
-<PRE>static unsigned char sprite[]={
+<PRE>static const unsigned char sprite[]={
 0b11111111,
 0b10000001,
 0b10000001,

+ 2 - 2
tigcc/examples/Masked Sprite.c

@@ -13,8 +13,8 @@
 // Main Function
 void _main(void)
 {
-  static unsigned char sprite[] = {0xFF,0x81,0x81,0x81,0x81,0x81,0x81,0xFF};
-  static unsigned char imask[] = {(unsigned char)~0xFF,(unsigned char)~0xFF,
+  static const unsigned char sprite[] = {0xFF,0x81,0x81,0x81,0x81,0x81,0x81,0xFF};
+  static const unsigned char imask[] = {(unsigned char)~0xFF,(unsigned char)~0xFF,
     (unsigned char)~0xFF,(unsigned char)~0xFF,(unsigned char)~0xFF,
     (unsigned char)~0xFF,(unsigned char)~0xFF,(unsigned char)~0xFF};
   int i;

+ 43 - 0
tigcc/examples/Masked Sprite.tpr

@@ -12,7 +12,50 @@ Debug Info=0
 Standard Library=1
 Command Line=
 Post-Build Process=
+Flash OS=0
+Fargo=0
+Use Data Variable=0
+Data Variable=
+Copy Data Variable=1
+Copy Data Variable if Archived=1
+Initialize BSS=1
+Optimize NOPs=1
+Optimize Returns=1
+Optimize Branches=1
+Optimize Moves=1
+Optimize Tests=1
+Optimize Calculations=1
+Remove Unused Sections=1
+Cut Unused Ranges=1
+Reorder Sections=1
+Merge Constants=1
+Binary Output=0
+
+[Library Options]
+Use TI-89=0
+Use TI-92 Plus=0
+Use V200=0
+Optimize Calc Consts=0
+Use Kernel=0
+Use PreOS=0
+Minimum AMS Version Defined=0
+Minimum AMS Version=1.00
+Unofficial OS Support=0
+Reloc Format=Unknown
+ROM Call Format=Unknown
+BSS Ref Format=Unknown
+Data Ref Format=Unknown
+Use F-Line Jumps=0
+Use 4-Byte F-Line Jumps=0
+Optimize ROM Calls=0
+Use Internal F-Line Emulator=0
+Use Return Value=0
+Enable Error Return=0
+Save Screen=0
 
 [Included Files]
 C File 1=Masked Sprite.c
 
+[File Editing]
+Open File=E:\TI-89\tigcccvs\examples\Masked Sprite.c
+

BIN
tigcc/include/C/Completion/error.ccf


BIN
tigcc/include/C/Completion/sprites.ccf


BIN
tigcc/include/C/Completion/version.ccf


+ 46 - 0
tigcc/include/C/default.h

@@ -329,6 +329,29 @@ typedef union
 typedef long *__plong;
 typedef unsigned long *__pulong;
 
+typedef union
+  {
+    const short *__sp;
+    const int *__ip;
+#ifndef STRICT_POINTERS
+    const unsigned short *__usp;
+    const unsigned int *__uip;
+#endif
+  } __cpshort __attribute__((__transparent_union__));
+
+typedef union
+  {
+    const unsigned short *__sp;
+    const unsigned int *__ip;
+#ifndef STRICT_POINTERS
+    const short *__ssp;
+    const int *__sip;
+#endif
+  } __cpushort __attribute__((__transparent_union__));
+
+typedef const long *__cplong;
+typedef const unsigned long *__cpulong;
+
 #else
 
 typedef short *__pshort;
@@ -354,6 +377,29 @@ typedef union
 #endif
   } __pulong __attribute__((__transparent_union__));
 
+typedef const short *__cpshort;
+typedef const unsigned short *__cpushort;
+
+typedef union
+  {
+    const long *__lp;
+    const int *__ip;
+#ifndef STRICT_POINTERS
+    const unsigned long *__ulp;
+    const unsigned int *__uip;
+#endif
+  } __cplong __attribute__((__transparent_union__));
+
+typedef union
+  {
+    const unsigned long *__lp;
+    const unsigned int *__ip;
+#ifndef STRICT_POINTERS
+    const long *__slp;
+    const int *__sip;
+#endif
+  } __cpulong __attribute__((__transparent_union__));
+
 #endif
 
 #endif

+ 3 - 3
tigcc/include/C/sprites.h

@@ -5,9 +5,9 @@
 
 /* Begin Auto-Generated Part */
 enum SprtModes{SPRT_XOR,SPRT_OR,SPRT_AND};
-extern void Sprite8(short,short,short,unsigned char*,void*,short)__ATTR_LIB_C__;
-extern void Sprite16(short,short,short,__pushort,void*,short)__ATTR_LIB_C__;
-extern void Sprite32(short,short,short,__pulong,void*,short)__ATTR_LIB_C__;
+extern void Sprite8(short,short,short,const unsigned char*,void*,short)__ATTR_LIB_C__;
+extern void Sprite16(short,short,short,__cpushort,void*,short)__ATTR_LIB_C__;
+extern void Sprite32(short,short,short,__cpulong,void*,short)__ATTR_LIB_C__;
 /* End Auto-Generated Part */
 
 #endif