git » fp-git.git » commit a3b5b8e

renamed functions to make the code look better

author ecalot
2006-06-24 03:26:23 UTC
committer ecalot
2006-06-24 03:26:23 UTC
parent 667f2a9e479a3afa19748dc135044cbbd367f5ec

renamed functions to make the code look better

PR/src/include/disk.h +8 -8
PR/src/include/object.h +1 -1
PR/src/include/palette.h +6 -6
PR/src/include/sound.h +4 -10
PR/src/lib/actions/export.c +2 -2
PR/src/lib/layers/pallist.c +5 -5
PR/src/lib/object/image/image16.c +3 -3
PR/src/lib/object/image/image2.c +1 -1
PR/src/lib/object/image/image256.c +5 -5
PR/src/lib/object/image/image_common.c +3 -3
PR/src/lib/object/object.c +5 -5
PR/src/lib/object/palette/pop1_16c.c +2 -2
PR/src/lib/object/palette/pop2_256c.c +4 -4
PR/src/ports/winfiles/pr.dev +1 -1

diff --git a/PR/src/include/disk.h b/PR/src/include/disk.h
index 45b1114..254a886 100644
--- a/PR/src/include/disk.h
+++ b/PR/src/include/disk.h
@@ -51,22 +51,22 @@ disk.h: Princed Resources : Disk Access & File handling prototypes
 #ifndef WIN32
 #define DIR_SEPARATOR           '/'
 #else
-	#define DIR_SEPARATOR           '\\'
+#define DIR_SEPARATOR           '\\'
 #endif
 
 #include "binary.h"
 
-typedef enum {eFile,eDirectory,eNotFound}whatIs;
+typedef enum {eFile,eDirectory,eNotFound} whatIs;
 
 #define charToUpper(a) ((a)&0xDF)
 #define isDirSep(a,i) ((a[i]=='\\')||(a[i]=='/'))
 
 #define writeCloseOk(a,b,c) writeClose(a,0,b,c)
-int  writeData     (const unsigned char* data, int ignoreChars, const char* vFileext, int size, int optionflag,const char* backupExtension);
-int  writeOpen     (const char* vFileext, FILE* *fp, int optionflag);
-int  writeClose    (FILE* fp,int dontSave,int optionflag,const char* backupExtension);
-tBinary  mLoadFileArray(const char* vFile);
-int  makebase      (const char* p);
+int     writeData        (const unsigned char* data, int ignoreChars, const char* vFileext, int size, int optionflag,const char* backupExtension);
+int     writeOpen        (const char* vFileext, FILE* *fp, int optionflag);
+int     writeClose       (FILE* fp,int dontSave,int optionflag,const char* backupExtension);
+tBinary mLoadFileArray   (const char* vFile);
+int     makebase         (const char* p);
 const char* repairFolders(const char* a);
 const char* getFileNameFromPath(const char* path);
 whatIs isDir(const char *nombre);
@@ -75,7 +75,7 @@ whatIs isDir(const char *nombre);
 int recurseDirectory(const char* path,int recursive, void* pass, void (*function)(const char*,void*));
 #endif
 
-/* array2vars*/
+/* array2vars */
 
 #define array2short(a) (((*(a)))|((*((a)+1))<<8))
 #define array2long(a)  (((*(a)))|((*((a)+1))<<8)|((*((a)+2))<<16)|((*((a)+3))<<24))
diff --git a/PR/src/include/object.h b/PR/src/include/object.h
index cf3f735..2a2e143 100644
--- a/PR/src/include/object.h
+++ b/PR/src/include/object.h
@@ -42,6 +42,6 @@ int objectWrite(tObject o, const char* file, int optionflag, const char* backupE
 tObject objectRead(const char* file,tResource* newRes,int *result);
 void objectSet(tObject o,int *result,tResource* res);
 
-int objectGetColors(tObject obj);
+int objectGetColorCount(tObject obj);
 
 #endif
diff --git a/PR/src/include/palette.h b/PR/src/include/palette.h
index 6d34a40..5ae392e 100644
--- a/PR/src/include/palette.h
+++ b/PR/src/include/palette.h
@@ -66,8 +66,8 @@ int objectPalettePop2_NColorsWrite(void* o, const char* file, int optionflag, co
 void* objPop2PaletteNColorsRead(const char* file,int *result);
 int objPop2PaletteNColorsSet(void* o,tResource* res);
 
-tColor* objectPalettePop1_16GetColors(void* o);
-tColor* objectPalettePop2_NColorsGetColors(void* o);
+tColor* objectPalettePop1_16GetColorArray(void* o);
+tColor* objectPalettePop2_NColorsGetColorArray(void* o);
 
 /* middle layer */
 #define to8bits_A(a) (((a)<<2)|((a)>>4))
@@ -78,13 +78,13 @@ tColor* objectPalettePop2_NColorsGetColors(void* o);
 
 /* Hooks */
 
-#define PAL_COLORS_eResTypePalettePop2_NColors getColorsByPop2PaletteObject(object.obj)
+#define PAL_COLORS_eResTypePalettePop2_NColors objectPalettePop2_NColorsGetColorCount(object.obj)
 #define PAL_COLORS_eResTypePalettePop1_16      16
 #define PAL_COLORS_eResTypePalettePop1_Mono    2
 
-int getColorsByPop2PaletteObject(void* o); /* TODO: rename by objectPalettePop2_NColorsGetColors */
-int objectPaletteGetBits(tObject pal);
-tColor* objectGetColorsArray(tObject pal); /* TODO: rename by objectPaletteGetColorsArray */
+int objectPalettePop2_NColorsGetColorCount(void* o);
+int objectPaletteGetBitRate(tObject pal);
+tColor* objectPaletteGetColorArray(tObject pal);
 
 #endif
 
diff --git a/PR/src/include/sound.h b/PR/src/include/sound.h
index 73ea623..4b199d2 100644
--- a/PR/src/include/sound.h
+++ b/PR/src/include/sound.h
@@ -19,7 +19,7 @@
 */
 
 /*
-sound.h: Princed Resources :
+sound.h: Princed Resources : Common sound objects interfaces
 \xaf\xaf\xaf\xaf\xaf\xaf\xaf
  Copyright 2006 Princed Development Team
   Created: 19 Feb 2006
@@ -39,19 +39,13 @@ sound.h: Princed Resources :
 #include "mid.h"
 #include "wav.h"
 
-/*int objSoundWrite(void* o, const char* file, int write(const char* file,tBinary* data,int optionflag, const char* backupExtension), int optionflag, const char* backupExtension);*/
-
-void* objSoundCreate(tBinary c, int *error);
-
 int objectSoundWaveWrite(void* o, const char* file, int optionflag, const char* backupExtension);
 
-#define objectSoundWaveCreate(a,b) objSoundCreate(a,b)
-#define objectSoundMidiCreate(a,b) objSoundCreate(a,b)
+void* objSoundCreate(tBinary c, int *error);
+#define objectSoundWaveCreate(a,b)      objSoundCreate(a,b)
+#define objectSoundMidiCreate(a,b)      objSoundCreate(a,b)
 #define objectSoundPcspeakerCreate(a,b) objSoundCreate(a,b)
 
-/*#define objectSoundWaveRead(a,b,c,d,e) objSoundRead(a,readWav,b,c,d,e)*/
-/*void* objSoundRead(const char* file, int read(const char* file, tBinary* c, int *pchannels, long *psamplerate, long *pbps), int *result);*/
-
 void* objectSoundWaveRead(const char* file, int *result);
 #define objectSoundMidiRead(a,b) objectOtherBinaryRead(a,b)
 #define objectSoundPcspeakerRead(a,b) objectOtherBinaryRead(a,b)
diff --git a/PR/src/lib/actions/export.c b/PR/src/lib/actions/export.c
index 6b6340a..311c39d 100644
--- a/PR/src/lib/actions/export.c
+++ b/PR/src/lib/actions/export.c
@@ -137,9 +137,9 @@ showobj(o);
 							}
 						}
 						o=objectCreate(&res,&ok);
-printf("getting the palette for the %d colours object ",objectGetColors(o));
+printf("getting the palette for the %d colours object ",objectGetColorCount(o));
 showobj(o);
-						pal=pl_get(&palettes,&priorityRight,objectGetColors(o));
+						pal=pl_get(&palettes,&priorityRight,objectGetColorCount(o));
 printf("palette ");
 showobj(pal);
 						applyPalette(o,pal);
diff --git a/PR/src/lib/layers/pallist.c b/PR/src/lib/layers/pallist.c
index b8245ab..70d8282 100644
--- a/PR/src/lib/layers/pallist.c
+++ b/PR/src/lib/layers/pallist.c
@@ -41,7 +41,7 @@ pallist.c: Princed Resources : Palette list layer implementation
 
 #ifndef DEBUG_TEST_PALLST
 void showobj(tObject o) {
-	printf("object type=%d colors=%d\n",o.type,objectGetColors(o));
+	printf("object type=%d colors=%d\n",o.type,objectGetColorCount(o));
 }
 #endif
 
@@ -83,11 +83,11 @@ showobj(o);
 	} else {
 		/* low priority insertion */
 		tPL_Node* insertNode=malloc(sizeof(tPL_Node));
-		int colors=objectGetColors(o);
+		int colors=objectGetColorCount(o);
 printf("adding with low priority:\n");
 showobj(o);
 
-		while (pl->list_first && colors>=objectGetColors(pl->list_first->object)) {
+		while (pl->list_first && colors>=objectGetColorCount(pl->list_first->object)) {
 			printf("deleting: ");
 			showobj(pl->list_first->object);
 			pl->list_first=pl->list_first->next; /* Delete */
@@ -109,7 +109,7 @@ printf("getting PL\n");
 
 	*priorityRight=1;
 	if (pl->priority_field.enabled) {
-		if (colors<=objectGetColors(pl->priority_field.object)) {
+		if (colors<=objectGetColorCount(pl->priority_field.object)) {
 showobj(pl->priority_field.object);
 			return pl->priority_field.object;
 		} else {
@@ -121,7 +121,7 @@ showobj(pl->priority_field.object);
 printf("first=%p with ",(void*)pl->list_first);
 showobj(pl->list_first->object);
 
-	while (node && colors>objectGetColors(node->object))
+	while (node && colors>objectGetColorCount(node->object))
 	{		node=node->next; printf("next %p\n",(void*)node); }
 
 	return node?node->object:objectCreate(NULL,&junk);
diff --git a/PR/src/lib/object/image/image16.c b/PR/src/lib/object/image/image16.c
index 654c6b0..4098f21 100644
--- a/PR/src/lib/object/image/image16.c
+++ b/PR/src/lib/object/image/image16.c
@@ -375,7 +375,7 @@ void* objectImage16Create(tBinary cont, int *error) { /* use get like main.c */
 	}
 /*
 	image->pal=palette;
-	bits=objectPaletteGetBits(image->pal);
+	bits=objectPaletteGetBitRate(image->pal);
 	if (bits && bits!=getCarry(image->type)) printf("error, palette mismatch (pal=%d bits=%d)\n",bits,getCarry(image->type));
 	image->bits=getCarry(image->type);*/
 
@@ -388,7 +388,7 @@ int objectImage16Write(void* img,const char* file,int optionflag,const char* bac
 	tImage* i=img;
 	tColor* colorArray;
 
-	colorArray=(i->pal.type!=eResTypeNone)?objectGetColorsArray(i->pal):objPalette_16();
+	colorArray=(i->pal.type!=eResTypeNone)?objectPaletteGetColorArray(i->pal):objPalette_16();
 
 	/* Write bitmap */
 	return mWriteBmp(file,i->pix,i->width,i->height,4,16,colorArray,i->widthInBytes,optionflag,backupExtension);
@@ -417,7 +417,7 @@ void* objectImage16Read(const char* file,tObject palette, int *result) {
 	/* check the palette information */
 
 	image->pal=palette;
-	bits=objectPaletteGetBits(image->pal);
+	bits=objectPaletteGetBitRate(image->pal);
 	if (bits && bits!=image->bits) { /* bits=0 means all palettes allowed or ignore palette check */
 		*result=PR_RESULT_ERR_BMP_BITRATE_DIFFERS;
 		free(image->pix);
diff --git a/PR/src/lib/object/image/image2.c b/PR/src/lib/object/image/image2.c
index 3912803..19576e3 100644
--- a/PR/src/lib/object/image/image2.c
+++ b/PR/src/lib/object/image/image2.c
@@ -153,7 +153,7 @@ void* objectImage2Read(const char* file,tObject palette, int *result) {
 
 	/* check the palette information */
 
-	bits=objectPaletteGetBits(image->pal);
+	bits=objectPaletteGetBitRate(image->pal);
 	if (image->bits!=1) {
 		*result=PR_RESULT_ERR_BMP_BITRATE_DIFFERS;
 		free(image->pix);
diff --git a/PR/src/lib/object/image/image256.c b/PR/src/lib/object/image/image256.c
index d2db51a..b14552d 100644
--- a/PR/src/lib/object/image/image256.c
+++ b/PR/src/lib/object/image/image256.c
@@ -328,7 +328,7 @@ void* objectImage256Create(tBinary cont, int *error) { /* use get like main.c */
 	}
 	/*
 	image->pal=palette;
-	bits=objectPaletteGetBits(image->pal);
+	bits=objectPaletteGetBitRate(image->pal);
 	if (bits && bits!=getCarry(image->type)) printf("error, palette mismatch (pal=%d bits=%d)\n",bits,getCarry(image->type));*/
 	image->bits=getCarry(image->type);
 
@@ -354,9 +354,9 @@ int objectImage256Write(void* img,const char* file,int optionflag,const char* ba
 	tColor* colorArray;
 
 	if (i->pal.type!=eResTypeNone) {
-		bits=objectPaletteGetBits(i->pal);
-		colors=i->colorCount; /*objectGetColors(i->pal);*/
-		colorArray=objectGetColorsArray(i->pal);
+		bits=objectPaletteGetBitRate(i->pal);
+		colors=i->colorCount; /*objectGetColorCount(i->pal);*/
+		colorArray=objectPaletteGetColorArray(i->pal);
 	} else {
 		bits=8; /*getCarry(i->type);*/
 		colors=256; /*1<<bits;*/
@@ -390,7 +390,7 @@ void* objectImage256Read(const char* file,tObject palette, int *result) {
 	/* check the palette information */
 
 	image->pal=palette;
-	bits=objectPaletteGetBits(image->pal);
+	bits=objectPaletteGetBitRate(image->pal);
 	if (bits && bits!=image->bits) { /* bits=0 means all palettes allowed or ignore palette check */
 		*result=PR_RESULT_ERR_BMP_BITRATE_DIFFERS;
 		free(image->pix);
diff --git a/PR/src/lib/object/image/image_common.c b/PR/src/lib/object/image/image_common.c
index 654c6b0..4098f21 100644
--- a/PR/src/lib/object/image/image_common.c
+++ b/PR/src/lib/object/image/image_common.c
@@ -375,7 +375,7 @@ void* objectImage16Create(tBinary cont, int *error) { /* use get like main.c */
 	}
 /*
 	image->pal=palette;
-	bits=objectPaletteGetBits(image->pal);
+	bits=objectPaletteGetBitRate(image->pal);
 	if (bits && bits!=getCarry(image->type)) printf("error, palette mismatch (pal=%d bits=%d)\n",bits,getCarry(image->type));
 	image->bits=getCarry(image->type);*/
 
@@ -388,7 +388,7 @@ int objectImage16Write(void* img,const char* file,int optionflag,const char* bac
 	tImage* i=img;
 	tColor* colorArray;
 
-	colorArray=(i->pal.type!=eResTypeNone)?objectGetColorsArray(i->pal):objPalette_16();
+	colorArray=(i->pal.type!=eResTypeNone)?objectPaletteGetColorArray(i->pal):objPalette_16();
 
 	/* Write bitmap */
 	return mWriteBmp(file,i->pix,i->width,i->height,4,16,colorArray,i->widthInBytes,optionflag,backupExtension);
@@ -417,7 +417,7 @@ void* objectImage16Read(const char* file,tObject palette, int *result) {
 	/* check the palette information */
 
 	image->pal=palette;
-	bits=objectPaletteGetBits(image->pal);
+	bits=objectPaletteGetBitRate(image->pal);
 	if (bits && bits!=image->bits) { /* bits=0 means all palettes allowed or ignore palette check */
 		*result=PR_RESULT_ERR_BMP_BITRATE_DIFFERS;
 		free(image->pix);
diff --git a/PR/src/lib/object/object.c b/PR/src/lib/object/object.c
index b1f7d6a..4f5aeb0 100644
--- a/PR/src/lib/object/object.c
+++ b/PR/src/lib/object/object.c
@@ -145,7 +145,7 @@ fprintf(stderr,"Exception: Couldn't write unhooked type %d\n",o.type);
 
 /* Palette class methods */
 
-int objectPaletteGetBits(tObject pal) {
+int objectPaletteGetBitRate(tObject pal) {
 	switch (pal.type) {
 	case eResTypePalettePop2_NColors:
 		return 8;
@@ -158,7 +158,7 @@ int objectPaletteGetBits(tObject pal) {
 	}
 }
 
-int objectGetColors(tObject object) {
+int objectGetColorCount(tObject object) {
 	switch (object.type) {
 	case eResTypePalettePop2_NColors:
 		return PAL_COLORS_eResTypePalettePop2_NColors;
@@ -177,12 +177,12 @@ int objectGetColors(tObject object) {
 	}
 }
 
-tColor* objectGetColorsArray(tObject pal) {
+tColor* objectPaletteGetColorArray(tObject pal) {
 	switch (pal.type) {
 	case eResTypePalettePop1_16: /* save and remember palette file */
-		return objectPalettePop1_16GetColors(pal.obj);
+		return objectPalettePop1_16GetColorArray(pal.obj);
 	case eResTypePalettePop2_NColors:
-		return objectPalettePop2_NColorsGetColors(pal.obj);
+		return objectPalettePop2_NColorsGetColorArray(pal.obj);
 	default:
 		return NULL;
 	}
diff --git a/PR/src/lib/object/palette/pop1_16c.c b/PR/src/lib/object/palette/pop1_16c.c
index 8851196..b6e5f9b 100644
--- a/PR/src/lib/object/palette/pop1_16c.c
+++ b/PR/src/lib/object/palette/pop1_16c.c
@@ -93,12 +93,12 @@ int objectPalettePop1_16Write(void* o, const char* file, int optionflag, const c
 	return writePal(file,16,pal->c,optionflag,backupExtension);
 }
 
-tColor* objectPalettePop1_16GetColors(void* o) {
+tColor* objectPalettePop1_16GetColorArray(void* o) {
 	tPalettePop1_16c* pal=o;
 	return pal->c;
 }
 
-tColor* objectGetColorsArrayForColors(int colors) {
+tColor* objectPaletteGetColorArrayForColors(int colors) {
 	static tColor p1[2];
 	static tColor p4[2];
 	static tColor p8[2];
diff --git a/PR/src/lib/object/palette/pop2_256c.c b/PR/src/lib/object/palette/pop2_256c.c
index 1057a4b..dd4fc29 100644
--- a/PR/src/lib/object/palette/pop2_256c.c
+++ b/PR/src/lib/object/palette/pop2_256c.c
@@ -76,20 +76,20 @@ printf("created a palette with %d colors. cs=%ld\n",j,cont.size);
 	return (void*)r;
 }
 
-tColor* objectPalettePop2_NColorsGetColors(void* o) {
+tColor* objectPalettePop2_NColorsGetColorArray(void* o) {
 	tGenericPalette* pal=o;
 	return pal->colorArray;
 }
 
 
-int getColorsByPop2PaletteObject(void* o) {
+int objectPalettePop2_NColorsGetColorCount(void* o) {
 	tGenericPalette* pal=o;
 	return pal->size;
 }
 
 int objectPalettePop2_NColorsWrite(void* o, const char* file, int optionflag, const char* backupExtension) {
-	tGenericPalette* p=o;
-	return writePal(file,p->size,p->colorArray,optionflag,backupExtension);
+	tGenericPalette* pal=o;
+	return writePal(file,pal->size,pal->colorArray,optionflag,backupExtension);
 }
 
 void* objPop2PaletteNColorsRead(const char* file,int *result) {
diff --git a/PR/src/ports/winfiles/pr.dev b/PR/src/ports/winfiles/pr.dev
index b5d9138..dfa182c 100644
--- a/PR/src/ports/winfiles/pr.dev
+++ b/PR/src/ports/winfiles/pr.dev
@@ -933,7 +933,7 @@ BuildCmd=
 Major=1
 Minor=3
 Release=0
-Build=51
+Build=57
 LanguageID=2057
 CharsetID=1252
 CompanyName=Princed development team