Beginning the long process of name changes
This commit is contained in:
parent
5ef2791e0e
commit
4b933231f7
@ -48,16 +48,16 @@
|
||||
*************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
* Name: wld_FatalError
|
||||
* Name: wld_fatal_error
|
||||
************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
* Name: wld_FatalError
|
||||
* Description: A dummy version of wld_FatalError that will be used if
|
||||
* Name: wld_fatal_error
|
||||
* Description: A dummy version of wld_fatal_error that will be used if
|
||||
* the application does not provide a better one.
|
||||
************************************************************************/
|
||||
|
||||
void wld_FatalError(char *message, ...)
|
||||
void wld_fatal_error(char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
|
@ -48,13 +48,13 @@
|
||||
*************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
* Name: wld_FindPlane
|
||||
* Name: wld_find_plane
|
||||
* Description:
|
||||
* This function finds the plane at the specified point in the world plane
|
||||
* list
|
||||
************************************************************************/
|
||||
|
||||
rectListType *wld_FindPlane(coord_t h, coord_t v, coord_t plane,
|
||||
rectListType *wld_find_plane(coord_t h, coord_t v, coord_t plane,
|
||||
rectHeadType *list)
|
||||
{
|
||||
rectListType *rect;
|
||||
|
@ -56,7 +56,7 @@ void wld_Free(void *addr)
|
||||
{
|
||||
if (addr == NULL)
|
||||
{
|
||||
wld_FatalError("freeing NULL");
|
||||
wld_fatal_error("freeing NULL");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -236,20 +236,20 @@ GraphicFileType *wld_LoadGIF(FILE *fp, char *fname)
|
||||
fseek(fp, 0L, 0);
|
||||
|
||||
if (!(ptr = RawGIF = (uint8_t *) malloc(filesize)))
|
||||
wld_FatalError("not enough memory to read gif file");
|
||||
wld_fatal_error("not enough memory to read gif file");
|
||||
|
||||
if (!(Rwld_er = (uint8_t *) malloc(filesize)))
|
||||
{
|
||||
free(ptr);
|
||||
wld_FatalError("not enough memory to read gif file");
|
||||
wld_fatal_error("not enough memory to read gif file");
|
||||
}
|
||||
|
||||
if (fread(ptr, filesize, 1, fp) != 1)
|
||||
wld_FatalError("GIF data read failed");
|
||||
wld_fatal_error("GIF data read failed");
|
||||
|
||||
if (strncmp(ptr, id87, 6))
|
||||
if (strncmp(ptr, id89, 6))
|
||||
wld_FatalError("not a GIF file");
|
||||
wld_fatal_error("not a GIF file");
|
||||
|
||||
ptr += 6;
|
||||
|
||||
@ -273,7 +273,7 @@ GraphicFileType *wld_LoadGIF(FILE *fp, char *fname)
|
||||
Background = NEXTBYTE; /* background color... not used. */
|
||||
|
||||
if (NEXTBYTE) /* supposed to be NULL */
|
||||
wld_FatalError("corrupt GIF file (bad screen descriptor)");
|
||||
wld_fatal_error("corrupt GIF file (bad screen descriptor)");
|
||||
|
||||
/* Read in global colormap. */
|
||||
|
||||
@ -301,7 +301,7 @@ GraphicFileType *wld_LoadGIF(FILE *fp, char *fname)
|
||||
i = ch;
|
||||
fprintf(stderr, "EXTENSION CHARACTER: %x\n", i);
|
||||
if (ch != START_EXTENSION)
|
||||
wld_FatalError("corrupt GIF89a file");
|
||||
wld_fatal_error("corrupt GIF89a file");
|
||||
|
||||
/* Handle image extensions */
|
||||
|
||||
@ -323,7 +323,7 @@ GraphicFileType *wld_LoadGIF(FILE *fp, char *fname)
|
||||
case COMMENT_EXT:
|
||||
break;
|
||||
default:
|
||||
wld_FatalError("invalid GIF89 extension");
|
||||
wld_fatal_error("invalid GIF89 extension");
|
||||
}
|
||||
|
||||
while ((ch = NEXTBYTE))
|
||||
@ -397,7 +397,7 @@ GraphicFileType *wld_LoadGIF(FILE *fp, char *fname)
|
||||
ch = ch1 = NEXTBYTE;
|
||||
while (ch--) *ptr1++ = NEXTBYTE;
|
||||
if ((ptr1 - Rwld_er) > filesize)
|
||||
wld_FatalError("corrupt GIF file (unblock)");
|
||||
wld_fatal_error("corrupt GIF file (unblock)");
|
||||
}
|
||||
while(ch1);
|
||||
|
||||
|
@ -106,25 +106,25 @@ GraphicFileType *wld_LoadPPM(FILE *fp, char *filename)
|
||||
skip_cruft(fp);
|
||||
if (getc(fp) != 'P' || getc(fp) != '6')
|
||||
{
|
||||
wld_FatalError("%s is not a ppm file.", filename);
|
||||
wld_fatal_error("%s is not a ppm file.", filename);
|
||||
}
|
||||
|
||||
skip_cruft(fp);
|
||||
if (fscanf(fp, "%d", &width) != 1)
|
||||
{
|
||||
wld_FatalError("%s: bad ppm file.", filename);
|
||||
wld_fatal_error("%s: bad ppm file.", filename);
|
||||
}
|
||||
|
||||
skip_cruft(fp);
|
||||
if (fscanf(fp, "%d", &height) != 1)
|
||||
{
|
||||
wld_FatalError("%s: bad ppm file.", filename);
|
||||
wld_fatal_error("%s: bad ppm file.", filename);
|
||||
}
|
||||
|
||||
skip_cruft(fp);
|
||||
if (fscanf(fp, "%d\n", &unknown) != 1)
|
||||
{
|
||||
wld_FatalError("%s: bad ppm file.", filename);
|
||||
wld_fatal_error("%s: bad ppm file.", filename);
|
||||
}
|
||||
|
||||
gfile = wld_NewGraphicFile();
|
||||
@ -136,7 +136,7 @@ GraphicFileType *wld_LoadPPM(FILE *fp, char *filename)
|
||||
|
||||
if (fread(gfile->bitmap, height * width * 3, 1, fp) != 1)
|
||||
{
|
||||
wld_FatalError("%s: incomplete data", filename);
|
||||
wld_fatal_error("%s: incomplete data", filename);
|
||||
}
|
||||
|
||||
return gfile;
|
||||
|
@ -59,7 +59,7 @@ void *wld_Malloc(size_t size)
|
||||
new = malloc(size);
|
||||
if (new == NULL)
|
||||
{
|
||||
wld_FatalError("out of memory (wld_Malloc %x bytes)", size);
|
||||
wld_fatal_error("out of memory (wld_Malloc %x bytes)", size);
|
||||
}
|
||||
return new;
|
||||
}
|
||||
|
@ -48,13 +48,13 @@
|
||||
*************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
* Name: wld_MovePlane
|
||||
* Name: wld_move_plane
|
||||
* Description:
|
||||
* This function removes the specified plane from the world plane srcList
|
||||
* then adds it to the world plane destList
|
||||
************************************************************************/
|
||||
|
||||
void wld_MovePlane(rectListType *rect, rectHeadType *destList,
|
||||
void wld_move_plane(rectListType *rect, rectHeadType *destList,
|
||||
rectHeadType *srcList)
|
||||
{
|
||||
/* Un-hook the backward link to the rect */
|
||||
|
@ -176,12 +176,12 @@ extern void wld_AddPlane(rectListType *rect,
|
||||
rectHeadType *list);
|
||||
extern void wld_MergePlaneLists(rectHeadType *outList,
|
||||
rectHeadType *inList);
|
||||
extern void wld_RemovePlane(rectListType *rect,
|
||||
extern void wld_remove_plane(rectListType *rect,
|
||||
rectHeadType *list);
|
||||
extern void wld_MovePlane(rectListType *rect,
|
||||
extern void wld_move_plane(rectListType *rect,
|
||||
rectHeadType *destList,
|
||||
rectHeadType *srcList);
|
||||
extern rectListType *wld_FindPlane(coord_t h, coord_t v, coord_t plane,
|
||||
extern rectListType *wld_find_plane(coord_t h, coord_t v, coord_t plane,
|
||||
rectHeadType *list);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -71,7 +71,7 @@ static GraphicFileFormatType wld_CheckFormat(FILE *fp, char *filename)
|
||||
|
||||
if (fread(magic, 1, MAGIC_LENGTH, fp) != MAGIC_LENGTH)
|
||||
{
|
||||
wld_FatalError("Error reading texture %s.", filename);
|
||||
wld_fatal_error("Error reading texture %s.", filename);
|
||||
}
|
||||
|
||||
if (strncmp(magic, PPM_MAGIC, sizeof(PPM_MAGIC) - 1) == 0)
|
||||
@ -138,7 +138,7 @@ GraphicFileType *wld_ReadGraphicFile(char *filename)
|
||||
|
||||
if ((fp = fopen(filename, "rb")) == NULL)
|
||||
{
|
||||
wld_FatalError("Could not open texture %s", filename);
|
||||
wld_fatal_error("Could not open texture %s", filename);
|
||||
}
|
||||
|
||||
format = wld_CheckFormat(fp, filename);
|
||||
@ -160,17 +160,17 @@ GraphicFileType *wld_ReadGraphicFile(char *filename)
|
||||
break;
|
||||
|
||||
case formatUnknown:
|
||||
wld_FatalError("Unknown graphic file format.\n");
|
||||
wld_fatal_error("Unknown graphic file format.\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
wld_FatalError("The graphic file reading code is really broken.\n");
|
||||
wld_fatal_error("The graphic file reading code is really broken.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (gfile == NULL)
|
||||
{
|
||||
wld_FatalError("Error reading texture %s\n");
|
||||
wld_fatal_error("Error reading texture %s\n");
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
@ -73,7 +73,7 @@ static bitmapType *wld_NewTexture(uint16_t width, uint16_t height)
|
||||
bitmapType *t;
|
||||
|
||||
if (height <= 0 || width <= 0)
|
||||
wld_FatalError("wld_NewTexture: bad texture dimensions");
|
||||
wld_fatal_error("wld_NewTexture: bad texture dimensions");
|
||||
|
||||
t = (bitmapType*)wld_Malloc(sizeof(bitmapType));
|
||||
t->bm = (trv_pixel_t*)wld_Malloc(height * width * sizeof(trv_pixel_t));
|
||||
@ -147,14 +147,14 @@ bitmapType *wld_ReadTextureFile(char *filename)
|
||||
|
||||
gFile = wld_ReadGraphicFile(filename);
|
||||
if (gFile == NULL)
|
||||
wld_FatalError("Error reading texture %s.", filename);
|
||||
wld_fatal_error("Error reading texture %s.", filename);
|
||||
|
||||
/* The height and width should be powers of two for efficient
|
||||
* texture mapping. Here, we enforce this.
|
||||
*/
|
||||
|
||||
if (wld_Log2(gFile->width) == -1 || wld_Log2(gFile->height) == -1)
|
||||
wld_FatalError("Dimensions texture %s are not powers of two.",
|
||||
wld_fatal_error("Dimensions texture %s are not powers of two.",
|
||||
filename);
|
||||
|
||||
t = wld_NewTexture(gFile->width, gFile->height);
|
||||
|
@ -59,7 +59,7 @@ void *wld_Realloc(void *addr, size_t size)
|
||||
new = realloc(addr, size);
|
||||
if (new == NULL)
|
||||
{
|
||||
wld_FatalError("out of memory (wtrealloc %x bytes)", size);
|
||||
wld_fatal_error("out of memory (wtrealloc %x bytes)", size);
|
||||
}
|
||||
return new;
|
||||
}
|
||||
|
@ -48,13 +48,13 @@
|
||||
*************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
* Name: wld_RemovePlane
|
||||
* Name: wld_remove_plane
|
||||
* Description:
|
||||
* This function removes the specified plane from the world plane list
|
||||
* and "deallocates" it by saving it on the free list
|
||||
************************************************************************/
|
||||
|
||||
void wld_RemovePlane(rectListType *rect, rectHeadType *list)
|
||||
void wld_remove_plane(rectListType *rect, rectHeadType *list)
|
||||
{
|
||||
/* Un-hook the backward link to the rect */
|
||||
|
||||
|
@ -48,6 +48,6 @@
|
||||
*************************************************************************/
|
||||
|
||||
int16_t wld_ReadDecimal(FILE *fp);
|
||||
void wld_FatalError(char *message, ...);
|
||||
void wld_fatal_error(char *message, ...);
|
||||
|
||||
#endif /* __APPS_GRAPHICS_TRAVELER_TOOSL_LIBWLD_WLD_UTILS_H */
|
||||
|
@ -173,7 +173,7 @@ static int astSetEditMode(ClientData clientData,
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
astFatalError("%s: Unexpected number of arguments: %d\n",
|
||||
wld_fatal_error("%s: Unexpected number of arguments: %d\n",
|
||||
__FUNCTION__, argc);
|
||||
}
|
||||
else if (strcmp(argv[1], "POS") == 0)
|
||||
@ -219,14 +219,14 @@ static int astSetEditMode(ClientData clientData,
|
||||
}
|
||||
else
|
||||
{
|
||||
astFatalError("%s: Unrecognized NEW plane: %s\n",
|
||||
wld_fatal_error("%s: Unrecognized NEW plane: %s\n",
|
||||
__FUNCTION__, argv[2]);
|
||||
}
|
||||
astUpdateNEWModeDisplay();
|
||||
}
|
||||
else
|
||||
{
|
||||
astFatalError("%s: Unrecognized mode: %s\n",
|
||||
wld_fatal_error("%s: Unrecognized mode: %s\n",
|
||||
__FUNCTION__, argv[1]);
|
||||
}
|
||||
return TCL_OK;
|
||||
@ -242,7 +242,7 @@ static int astNewPosition(ClientData clientData,
|
||||
|
||||
if (argc != 4)
|
||||
{
|
||||
astFatalError("%s: Unexpected number of arguments: %d\n",
|
||||
wld_fatal_error("%s: Unexpected number of arguments: %d\n",
|
||||
__FUNCTION__, argc);
|
||||
}
|
||||
|
||||
@ -267,7 +267,7 @@ static int astNewZoom(ClientData clientData,
|
||||
|
||||
if (argc != 5)
|
||||
{
|
||||
astFatalError("%s: Unexpected number of arguments: %d\n",
|
||||
wld_fatal_error("%s: Unexpected number of arguments: %d\n",
|
||||
__FUNCTION__, argc);
|
||||
}
|
||||
|
||||
@ -342,7 +342,7 @@ static int astNewEdit(ClientData clientData,
|
||||
|
||||
if (argc != 4)
|
||||
{
|
||||
astFatalError("%s: Unexpected number of arguments: %d\n",
|
||||
wld_fatal_error("%s: Unexpected number of arguments: %d\n",
|
||||
__FUNCTION__, argc);
|
||||
}
|
||||
|
||||
@ -380,7 +380,7 @@ static int astNewEdit(ClientData clientData,
|
||||
}
|
||||
else
|
||||
{
|
||||
astFatalError("%s: Unrecognized EDITX plane: %s\n",
|
||||
wld_fatal_error("%s: Unrecognized EDITX plane: %s\n",
|
||||
__FUNCTION__, argv[1]);
|
||||
}
|
||||
break;
|
||||
@ -405,7 +405,7 @@ static int astNewEdit(ClientData clientData,
|
||||
}
|
||||
else
|
||||
{
|
||||
astFatalError("%s: Unrecognized EDITY plane: %s\n",
|
||||
wld_fatal_error("%s: Unrecognized EDITY plane: %s\n",
|
||||
__FUNCTION__, argv[1]);
|
||||
}
|
||||
break;
|
||||
@ -430,7 +430,7 @@ static int astNewEdit(ClientData clientData,
|
||||
}
|
||||
else
|
||||
{
|
||||
astFatalError("%s: Unrecognized EDITZ plane: %s\n",
|
||||
wld_fatal_error("%s: Unrecognized EDITZ plane: %s\n",
|
||||
__FUNCTION__, argv[1]);
|
||||
}
|
||||
break;
|
||||
@ -456,14 +456,14 @@ static int astNewAttributes(ClientData clientData,
|
||||
|
||||
if (argc != 4)
|
||||
{
|
||||
astFatalError("%s: Unexpected number of arguments: %d\n",
|
||||
wld_fatal_error("%s: Unexpected number of arguments: %d\n",
|
||||
__FUNCTION__, argc);
|
||||
}
|
||||
|
||||
attributes = argv[1];
|
||||
if (strlen(attributes) != 3)
|
||||
{
|
||||
astFatalError("%s: Unexpected attribute string length: %s\n",
|
||||
wld_fatal_error("%s: Unexpected attribute string length: %s\n",
|
||||
__FUNCTION__, argv[1]);
|
||||
}
|
||||
|
||||
@ -535,7 +535,7 @@ static int astAddRectangle(ClientData clientData,
|
||||
|
||||
if (argc != 1)
|
||||
{
|
||||
astFatalError("%s: Unexpected number of arguments: %d\n",
|
||||
wld_fatal_error("%s: Unexpected number of arguments: %d\n",
|
||||
__FUNCTION__, argc);
|
||||
}
|
||||
|
||||
@ -545,7 +545,7 @@ static int astAddRectangle(ClientData clientData,
|
||||
{
|
||||
/* Get a new container for the rectangle information */
|
||||
|
||||
rectListType *rect = astNewPlane();
|
||||
rectListType *rect = wld_new_plane();
|
||||
|
||||
/* Copy the rectangle data into the container */
|
||||
|
||||
@ -556,15 +556,15 @@ static int astAddRectangle(ClientData clientData,
|
||||
switch (editPlane)
|
||||
{
|
||||
case EDITPLANE_X:
|
||||
astAddPlane(rect, &xPlane);
|
||||
wld_add_plane(rect, &xPlane);
|
||||
break;
|
||||
|
||||
case EDITPLANE_Y:
|
||||
astAddPlane(rect, &yPlane);
|
||||
wld_add_plane(rect, &yPlane);
|
||||
break;
|
||||
|
||||
case EDITPLANE_Z:
|
||||
astAddPlane(rect, &zPlane);
|
||||
wld_add_plane(rect, &zPlane);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -582,11 +582,11 @@ static int astSaveRectangles(ClientData clientData,
|
||||
|
||||
if (argc != 1)
|
||||
{
|
||||
astFatalError("%s: Unexpected number of arguments: %d\n",
|
||||
wld_fatal_error("%s: Unexpected number of arguments: %d\n",
|
||||
__FUNCTION__, argc);
|
||||
}
|
||||
|
||||
astSavePlanes(astOutFileName);
|
||||
wld_save_planes(astOutFileName);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@ -638,7 +638,7 @@ int main(int argc, char **argv, char **envp)
|
||||
* a valid plaine file.
|
||||
*/
|
||||
|
||||
if (astLoadPlaneFile(astInFileName) != PLANE_SUCCESS)
|
||||
if (wld_load_planefile(astInFileName) != PLANE_SUCCESS)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
@ -721,7 +721,7 @@ int Tcl_AppInit(Tcl_Interp *interp)
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
void astFatalError(char *message, ...)
|
||||
void wld_fatal_error(char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
|
@ -114,7 +114,7 @@ void x11_InitGraphics(tcl_window_t *w)
|
||||
printf("Pixel depth is %d bits\n", windowAttributes.depth);
|
||||
if (windowAttributes.depth != 24)
|
||||
{
|
||||
x11_FatalError("Unsupported pixel depth: %d", windowAttributes.depth);
|
||||
wld_fatal_error("Unsupported pixel depth: %d", windowAttributes.depth);
|
||||
}
|
||||
|
||||
x11_LoadPalette(w);
|
||||
@ -147,7 +147,7 @@ static void x11_CreateWindow(tcl_window_t *w)
|
||||
|
||||
w->display = XOpenDisplay(NULL);
|
||||
if (w->display == NULL)
|
||||
x11_FatalError("Unable to open display.\n");
|
||||
wld_fatal_error("Unable to open display.\n");
|
||||
|
||||
w->screen = DefaultScreen(w->display);
|
||||
|
||||
@ -199,7 +199,7 @@ static void x11_LoadPalette(tcl_window_t *w)
|
||||
if (!astAllocateColors(w, cMap))
|
||||
{
|
||||
printf("failed\n");
|
||||
x11_FatalError("Unable to allocate enough color cells.");
|
||||
wld_fatal_error("Unable to allocate enough color cells.");
|
||||
}
|
||||
XSetWindowColormap(w->display, w->win, cMap);
|
||||
}
|
||||
@ -335,7 +335,7 @@ static void x11_MapSharedMemory(tcl_window_t *w, int depth)
|
||||
|
||||
if (!w->image)
|
||||
{
|
||||
x11_FatalError("Unable to create image.");
|
||||
wld_fatal_error("Unable to create image.");
|
||||
}
|
||||
shmCheckPoint++;
|
||||
|
||||
@ -393,7 +393,7 @@ static void x11_MapSharedMemory(tcl_window_t *w, int depth)
|
||||
|
||||
if (w->image == NULL)
|
||||
{
|
||||
x11_FatalError("Unable to create image.");
|
||||
wld_fatal_error("Unable to create image.");
|
||||
}
|
||||
shmCheckPoint++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user