def printRealHeader(self):
+ print('#include <stdio.h>')
print('#include "main/glheader.h"')
print('#include "main/enums.h"')
print('#include "util/imports.h"')
}
else {
/* this is not re-entrant safe, no big deal here */
- _mesa_snprintf(token_tmp, sizeof(token_tmp) - 1, "0x%x", nr);
+ snprintf(token_tmp, sizeof(token_tmp) - 1, "0x%x", nr);
token_tmp[sizeof(token_tmp) - 1] = '\\0';
return token_tmp;
}
texTarget = "RECT";
else
texTarget = "2D";
- _mesa_snprintf(program2, sizeof(program2), program, texTarget);
+ snprintf(program2, sizeof(program2), program, texTarget);
_mesa_GenProgramsARB(1, &drawpix->StencilFP);
_mesa_BindProgramARB(GL_FRAGMENT_PROGRAM_ARB, drawpix->StencilFP);
texTarget = "RECT";
else
texTarget = "2D";
- _mesa_snprintf(program2, sizeof(program2), program, texTarget);
+ snprintf(program2, sizeof(program2), program, texTarget);
_mesa_GenProgramsARB(1, &drawpix->DepthFP);
_mesa_BindProgramARB(GL_FRAGMENT_PROGRAM_ARB, drawpix->DepthFP);
GL_RGBA, GL_UNSIGNED_BYTE, buffer, img);
/* make filename */
- _mesa_snprintf(s, sizeof(s), "/tmp/tex%u.l%u.f%u.ppm", texObj->Name, level, face);
+ snprintf(s, sizeof(s), "/tmp/tex%u.l%u.f%u.ppm", texObj->Name, level, face);
printf(" Writing image level %u to %s\n", level, s);
write_ppm(s, buffer, img->Width, img->Height, 4, 0, 1, 2, GL_FALSE);
format, type, &ctx->DefaultPacking, buffer);
/* make filename */
- _mesa_snprintf(s, sizeof(s), "/tmp/renderbuffer%u.ppm", rb->Name);
- _mesa_snprintf(s, sizeof(s), "C:\\renderbuffer%u.ppm", rb->Name);
+ snprintf(s, sizeof(s), "/tmp/renderbuffer%u.ppm", rb->Name);
+ snprintf(s, sizeof(s), "C:\\renderbuffer%u.ppm", rb->Name);
printf(" Writing renderbuffer image to %s\n", s);
default:
{
char msg[1000];
- _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
+ snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
(int) opcode);
_mesa_problem(ctx, "%s", msg);
}
* visible, so communicate with the debugger instead */
{
char buf[4096];
- _mesa_snprintf(buf, sizeof(buf), "%s: %s%s", prefixString, outputString, newline ? "\n" : "");
+ snprintf(buf, sizeof(buf), "%s: %s%s", prefixString, outputString, newline ? "\n" : "");
OutputDebugStringA(buf);
}
#endif
char s[MAX_DEBUG_MESSAGE_LENGTH];
if (ctx->ErrorDebugCount) {
- _mesa_snprintf(s, MAX_DEBUG_MESSAGE_LENGTH, "%d similar %s errors",
+ snprintf(s, MAX_DEBUG_MESSAGE_LENGTH, "%d similar %s errors",
ctx->ErrorDebugCount,
_mesa_enum_to_string(ctx->ErrorValue));
char str[MAX_DEBUG_MESSAGE_LENGTH];
va_list args;
va_start( args, fmtString );
- (void) _mesa_vsnprintf( str, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args );
+ (void) vsnprintf( str, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args );
va_end( args );
if (ctx)
numCalls++;
va_start( args, fmtString );
- _mesa_vsnprintf( str, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args );
+ vsnprintf( str, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args );
va_end( args );
fprintf(stderr, "Mesa " PACKAGE_VERSION " implementation error: %s\n",
str);
_mesa_debug_get_id(id);
- len = _mesa_vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args);
+ len = vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args);
if (len >= MAX_DEBUG_MESSAGE_LENGTH)
/* message was truncated */
len = MAX_DEBUG_MESSAGE_LENGTH - 1;
va_list args;
va_start(args, fmtString);
- len = _mesa_vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args);
+ len = vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args);
va_end(args);
if (len >= MAX_DEBUG_MESSAGE_LENGTH) {
return;
}
- len = _mesa_snprintf(s2, MAX_DEBUG_MESSAGE_LENGTH, "%s in %s",
+ len = snprintf(s2, MAX_DEBUG_MESSAGE_LENGTH, "%s in %s",
_mesa_enum_to_string(error), s);
if (len >= MAX_DEBUG_MESSAGE_LENGTH) {
/* Same as above. */
char s[MAX_DEBUG_MESSAGE_LENGTH];
va_list args;
va_start(args, fmtString);
- _mesa_vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args);
+ vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args);
va_end(args);
output_if_debug("Mesa", s, GL_FALSE);
#endif /* DEBUG */
char s[MAX_DEBUG_MESSAGE_LENGTH];
va_list args;
va_start(args, fmtString);
- _mesa_vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args);
+ vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args);
va_end(args);
output_if_debug("", s, GL_FALSE);
}
/* Stringify */
#define STRINGIFY(x) #x
+/*
+ * For GL_ARB_vertex_buffer_object we need to treat vertex array pointers
+ * as offsets into buffer stores. Since the vertex array pointer and
+ * buffer store pointer are both pointers and we need to add them, we use
+ * this macro.
+ * Both pointers/offsets are expressed in bytes.
+ */
+#define ADD_POINTERS(A, B) ( (GLubyte *) (A) + (uintptr_t) (B) )
+
#endif
#include "bufferobj.h"
#include "glformats.h"
#include "image.h"
-#include "util/imports.h"
#include "mtypes.h"
+#include "macros.h"
#include "pbo.h"
#include "util/crc32.h"
#include "util/os_file.h"
#include "util/simple_list.h"
+#include "util/u_string.h"
/**
* Return mask of GLSL_x flags by examining the MESA_GLSL env var.
* requires GL_OES_texture_float) are filtered elsewhere.
*/
char bufCallerName[20];
- _mesa_snprintf(bufCallerName, 20, "glTexImage%dD", dimensions);
+ snprintf(bufCallerName, 20, "glTexImage%dD", dimensions);
if (_mesa_is_gles(ctx) &&
texture_format_error_check_gles(ctx, format, type,
internalFormat, bufCallerName)) {
if (type != GL_UNSIGNED_SHORT_8_8_MESA &&
type != GL_UNSIGNED_SHORT_8_8_REV_MESA) {
char message[100];
- _mesa_snprintf(message, sizeof(message),
+ snprintf(message, sizeof(message),
"glTexImage%dD(format/type YCBCR mismatch)",
dimensions);
_mesa_error(ctx, GL_INVALID_ENUM, "%s", message);
}
if (border != 0) {
char message[100];
- _mesa_snprintf(message, sizeof(message),
+ snprintf(message, sizeof(message),
"glTexImage%dD(format=GL_YCBCR_MESA and border=%d)",
dimensions, border);
_mesa_error(ctx, GL_INVALID_VALUE, "%s", message);
return true;
if (!shProg->SamplersValidated) {
- _mesa_snprintf(errMsg, errMsgLength,
+ snprintf(errMsg, errMsgLength,
"active samplers with a different type "
"refer to the same texture image unit");
return false;
ctx->VersionString = malloc(max);
if (ctx->VersionString) {
- _mesa_snprintf(ctx->VersionString, max,
+ snprintf(ctx->VersionString, max,
"%s%u.%u%s Mesa " PACKAGE_VERSION MESA_GIT_SHA1,
prefix,
ctx->Version / 10, ctx->Version % 10,
return InstInfo[opcode].Name;
else {
static char s[20];
- _mesa_snprintf(s, sizeof(s), "OP%u", opcode);
+ snprintf(s, sizeof(s), "OP%u", opcode);
return s;
}
}
default:
{
static char s[20];
- _mesa_snprintf(s, sizeof(s), "FILE%u", f);
+ snprintf(s, sizeof(s), "FILE%u", f);
return s;
}
}
break;
}
- _mesa_snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type);
+ snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type);
f = fopen(filename, "w");
if (!f) {
fprintf(stderr, "Unable to open %s for writing\n", filename);
else
type = "vert";
- _mesa_snprintf(filename, sizeof(filename), "shader.%s", type);
+ snprintf(filename, sizeof(filename), "shader.%s", type);
f = fopen(filename, "a"); /* append */
if (!f) {
fprintf(stderr, "Unable to open %s for appending\n", filename);
{
if (($1 < 0) || ($1 > (state->limits->MaxAddressOffset - 1))) {
char s[100];
- _mesa_snprintf(s, sizeof(s),
+ snprintf(s, sizeof(s),
"relative address offset too large (%d)", $1);
yyerror(& @1, state, s);
YYERROR;
{
if (($1 < 0) || ($1 > state->limits->MaxAddressOffset)) {
char s[100];
- _mesa_snprintf(s, sizeof(s),
+ snprintf(s, sizeof(s),
"relative address offset too large (%d)", $1);
yyerror(& @1, state, s);
YYERROR;
{
if (($1 < 1) || ((unsigned) $1 > state->limits->MaxParameters)) {
char msg[100];
- _mesa_snprintf(msg, sizeof(msg),
+ snprintf(msg, sizeof(msg),
"invalid parameter array size (size=%d max=%u)",
$1, state->limits->MaxParameters);
yyerror(& @1, state, msg);
if (exist != NULL) {
char m[1000];
- _mesa_snprintf(m, sizeof(m), "redeclared identifier: %s", $2);
+ snprintf(m, sizeof(m), "redeclared identifier: %s", $2);
free($2);
yyerror(& @2, state, m);
YYERROR;
#include "main/bufferobj.h"
#include "main/errors.h"
#include "main/glheader.h"
-#include "util/imports.h"
+#include "main/macros.h"
#include "main/mtypes.h"
#include "vbo/vbo.h"
#include "vbo/vbo_exec.h"
#include "vbo/vbo_save.h"
#include "main/varray.h"
+#include "main/macros.h"
struct _glapi_table;
/**
* \file imports.c
* Standard C library function wrappers.
- *
+ *
* Imports are services which the device driver or window system or
* operating system provides to the core renderer. The core renderer (Mesa)
* will call these functions in order to do memory allocation, simple I/O,
#elif defined(__IBMC__) || defined(__IBMCPP__)
extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg);
#endif
-
-
-/** Needed due to #ifdef's, above. */
-int
-_mesa_vsnprintf(char *str, size_t size, const char *fmt, va_list args)
-{
- return vsnprintf( str, size, fmt, args);
-}
-
-/** Wrapper around vsnprintf() */
-int
-_mesa_snprintf( char *str, size_t size, const char *fmt, ... )
-{
- int r;
- va_list args;
- va_start( args, fmt );
- r = vsnprintf( str, size, fmt, args );
- va_end( args );
- return r;
-}
-
-
extern "C" {
#endif
-/*
- * For GL_ARB_vertex_buffer_object we need to treat vertex array pointers
- * as offsets into buffer stores. Since the vertex array pointer and
- * buffer store pointer are both pointers and we need to add them, we use
- * this macro.
- * Both pointers/offsets are expressed in bytes.
- */
-#define ADD_POINTERS(A, B) ( (uint8_t *) (A) + (uintptr_t) (B) )
-
/**
* Sometimes we treat floats as ints. On x86 systems, moving a float
typedef union { float f; int i; unsigned u; } fi_type;
-
-/*@}*/
-
-
-/**********************************************************************
- * Functions
- */
-
-extern int
-_mesa_snprintf( char *str, size_t size, const char *fmt, ... ) PRINTFLIKE(3, 4);
-
-extern int
-_mesa_vsnprintf(char *str, size_t size, const char *fmt, va_list arg);
-
-
#ifdef __cplusplus
}
#endif