mesa: Move src/mesa/glapi/dispatch.h to mesa.
[mesa.git] / src / mesa / shader / program_lexer.l
index e8dae7bc2675b4acca5fe8bf66afd8aec8e3f064..83bc5089d9e157e5ffcd77a6570cdb3d4f4df605 100644 (file)
  */
 #include "main/glheader.h"
 #include "main/imports.h"
-#include "prog_instruction.h"
-#include "prog_statevars.h"
+#include "shader/prog_instruction.h"
+#include "shader/prog_statevars.h"
 
-#include "symbol_table.h"
-#include "program_parser.h"
-#include "program_parse.tab.h"
+#include "shader/symbol_table.h"
+#include "shader/program_parser.h"
+#include "shader/program_parse.tab.h"
 
 #define require_ARB_vp (yyextra->mode == ARB_vertex)
 #define require_ARB_fp (yyextra->mode == ARB_fragment)
 #define SWIZZLE_INVAL  MAKE_SWIZZLE4(SWIZZLE_NIL, SWIZZLE_NIL, \
                                     SWIZZLE_NIL, SWIZZLE_NIL)
 
-/**
- * Send a string to the parser using asm_parser_state::string_dumpster
- *
- * Sends a string to the parser using asm_parser_state::string_dumpster as a
- * temporary storage buffer.  Data previously stored in
- * asm_parser_state::string_dumpster will be lost.  If
- * asm_parser_state::string_dumpster is not large enough to hold the new
- * string, the buffer size will be increased.  The buffer size is \b never
- * decreased.
- *
- * \param state   Assembler parser state tracking
- * \param str     String to be passed to the parser
- *
- * \return
- * A pointer to asm_parser_state::string_dumpster on success or \c NULL on
- * failure.  Currently the only failure case is \c ENOMEM.
- */
-static char *
-return_string(struct asm_parser_state *state, const char *str)
-{
-   const size_t len = strlen(str);
-
-   if (len >= state->dumpster_size) {
-      char *const dumpster = _mesa_realloc(state->string_dumpster,
-                                          state->dumpster_size,
-                                          len + 1);
-      if (dumpster == NULL) {
-        return NULL;
-      }
-
-      state->string_dumpster = dumpster;
-      state->dumpster_size = len + 1;
-   }
-
-   memcpy(state->string_dumpster, str, len + 1);
-   return state->string_dumpster;
-}
-
-
 static unsigned
 mask_from_char(char c)
 {
@@ -161,7 +122,7 @@ swiz_from_char(char c)
 static int
 handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval)
 {
-   lval->string = return_string(state, text);
+   lval->string = strdup(text);
 
    return (_mesa_symbol_table_find_symbol(state->st, 0, text) == NULL)
       ? IDENTIFIER : USED_IDENTIFIER;