2
* Mesa 3-D graphics library
5
* Copyright (C) 2005-2007 Brian Paul All Rights Reserved.
7
* Permission is hereby granted, free of charge, to any person obtaining a
8
* copy of this software and associated documentation files (the "Software"),
9
* to deal in the Software without restriction, including without limitation
10
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
* and/or sell copies of the Software, and to permit persons to whom the
12
* Software is furnished to do so, subject to the following conditions:
14
* The above copyright notice and this permission notice shall be included
15
* in all copies or substantial portions of the Software.
17
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
#ifndef SLANG_UTILITY_H
26
#define SLANG_UTILITY_H
29
/* Compile-time assertions. If the expression is zero, try to declare an
30
* array of size [-1] to cause compilation error.
32
#define static_assert(expr) do { int _array[(expr) ? 1 : -1]; (void) _array[0]; } while (0)
35
#define slang_string_compare(str1, str2) _mesa_strcmp (str1, str2)
36
#define slang_string_copy(dst, src) _mesa_strcpy (dst, src)
37
#define slang_string_length(str) _mesa_strlen (str)
39
char *slang_string_concat (char *, const char *);
52
slang_string_init (slang_string *);
55
slang_string_free (slang_string *);
58
slang_string_reset (slang_string *);
61
slang_string_push (slang_string *, const slang_string *);
64
slang_string_pushc (slang_string *, const char);
67
slang_string_pushs (slang_string *, const char *, GLuint);
70
slang_string_pushi (slang_string *, GLint);
73
slang_string_cstr (slang_string *);
77
typedef GLvoid *slang_atom;
79
#define SLANG_ATOM_NULL ((slang_atom) 0)
81
typedef struct slang_atom_entry_
84
struct slang_atom_entry_ *next;
87
#define SLANG_ATOM_POOL_SIZE 1023
89
typedef struct slang_atom_pool_
91
slang_atom_entry *entries[SLANG_ATOM_POOL_SIZE];
94
GLvoid slang_atom_pool_construct (slang_atom_pool *);
95
GLvoid slang_atom_pool_destruct (slang_atom_pool *);
96
slang_atom slang_atom_pool_atom (slang_atom_pool *, const char *);
97
const char *slang_atom_pool_id (slang_atom_pool *, slang_atom);