r600g: add POW instruction
[mesa.git] / src / mesa / slang / slang_utility.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.5.3
4 *
5 * Copyright (C) 2005-2007 Brian Paul All Rights Reserved.
6 *
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:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
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.
23 */
24
25 #ifndef SLANG_UTILITY_H
26 #define SLANG_UTILITY_H
27
28
29 #include "main/glheader.h"
30
31 /* Compile-time assertions. If the expression is zero, try to declare an
32 * array of size [-1] to cause compilation error.
33 */
34 #define static_assert(expr) do { int _array[(expr) ? 1 : -1]; (void) _array[0]; } while (0)
35
36
37 #define slang_string_compare(str1, str2) strcmp (str1, str2)
38 #define slang_string_copy(dst, src) strcpy (dst, src)
39 #define slang_string_length(str) strlen (str)
40
41 char *slang_string_concat (char *, const char *);
42
43 /* slang_string */
44
45 typedef struct
46 {
47 char *data;
48 GLuint length;
49 GLuint capacity;
50 GLboolean fail;
51 } slang_string;
52
53 GLvoid
54 slang_string_init (slang_string *);
55
56 GLvoid
57 slang_string_free (slang_string *);
58
59 GLvoid
60 slang_string_reset (slang_string *);
61
62 GLvoid
63 slang_string_push (slang_string *, const slang_string *);
64
65 GLvoid
66 slang_string_pushc (slang_string *, const char);
67
68 GLvoid
69 slang_string_pushs (slang_string *, const char *, GLuint);
70
71 GLvoid
72 slang_string_pushi (slang_string *, GLint);
73
74 const char *
75 slang_string_cstr (slang_string *);
76
77 /* slang_atom */
78
79 typedef GLvoid *slang_atom;
80
81 #define SLANG_ATOM_NULL ((slang_atom) 0)
82
83 typedef struct slang_atom_entry_
84 {
85 char *id;
86 struct slang_atom_entry_ *next;
87 } slang_atom_entry;
88
89 #define SLANG_ATOM_POOL_SIZE 1023
90
91 typedef struct slang_atom_pool_
92 {
93 slang_atom_entry *entries[SLANG_ATOM_POOL_SIZE];
94 } slang_atom_pool;
95
96 GLvoid slang_atom_pool_construct (slang_atom_pool *);
97 GLvoid slang_atom_pool_destruct (slang_atom_pool *);
98 slang_atom slang_atom_pool_atom (slang_atom_pool *, const char *);
99 const char *slang_atom_pool_id (slang_atom_pool *, slang_atom);
100
101
102 #endif