diff options
author | Philippe Houdoin <phoudoin@freedesktop.org> | 2004-08-14 10:37:03 +0000 |
---|---|---|
committer | Philippe Houdoin <phoudoin@freedesktop.org> | 2004-08-14 10:37:03 +0000 |
commit | bba512b75bdc3bc27cecb17b7664030c66652996 (patch) | |
tree | 7960a495be8c53126a9e7432b970fe3b2fc63451 /src/glut/beos/glut_util.c | |
parent | a041e62418a72f0fd379e50263e1c9d2e6c6bb55 (diff) |
Replaced the .cpp-ized (for build issue) common GLUT source files by their
standard .c version.
Remove outdated Makefile.orig.
Diffstat (limited to 'src/glut/beos/glut_util.c')
-rw-r--r-- | src/glut/beos/glut_util.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/glut/beos/glut_util.c b/src/glut/beos/glut_util.c new file mode 100644 index 0000000000..29e79513a3 --- /dev/null +++ b/src/glut/beos/glut_util.c @@ -0,0 +1,81 @@ + +/* Copyright (c) Mark J. Kilgard, 1994. */ + +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or + implied. This program is -not- in the public domain. */ + +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <stdio.h> + +#include "glutint.h" + +/* strdup is actually not a standard ANSI C or POSIX routine + so implement a private one for GLUT. OpenVMS does not have a + strdup; Linux's standard libc doesn't declare strdup by default + (unless BSD or SVID interfaces are requested). */ +char * +__glutStrdup(const char *string) +{ + char *copy; + + copy = (char*) malloc(strlen(string) + 1); + if (copy == NULL) + return NULL; + strcpy(copy, string); + return copy; +} + +void +__glutWarning(char *format,...) +{ + va_list args; + + va_start(args, format); + fprintf(stderr, "GLUT: Warning in %s: ", + __glutProgramName ? __glutProgramName : "(unamed)"); + vfprintf(stderr, format, args); + va_end(args); + putc('\n', stderr); +} + +/* CENTRY */ +void APIENTRY +glutReportErrors(void) +{ + GLenum error; + + while ((error = glGetError()) != GL_NO_ERROR) + __glutWarning("GL error: %s", gluErrorString(error)); +} +/* ENDCENTRY */ + +void +__glutFatalError(char *format,...) +{ + va_list args; + + va_start(args, format); + fprintf(stderr, "GLUT: Fatal Error in %s: ", + __glutProgramName ? __glutProgramName : "(unamed)"); + vfprintf(stderr, format, args); + va_end(args); + putc('\n', stderr); + exit(1); +} + +void +__glutFatalUsage(char *format,...) +{ + va_list args; + + va_start(args, format); + fprintf(stderr, "GLUT: Fatal API Usage in %s: ", + __glutProgramName ? __glutProgramName : "(unamed)"); + vfprintf(stderr, format, args); + va_end(args); + putc('\n', stderr); + abort(); +} |