Quellcode durchsuchen

glsl/pp: Do purification and tokenisation in a single step.

tags/7.8-rc1
Michal Krol vor 16 Jahren
Ursprung
Commit
abe1f33298

+ 7
- 0
src/glsl/pp/sl_pp_context.c Datei anzeigen

@@ -46,6 +46,12 @@ sl_pp_context_create(void)
return NULL;
}

context->getc_buf = malloc(64 * sizeof(char));
if (!context->getc_buf) {
sl_pp_context_destroy(context);
return NULL;
}

context->macro_tail = &context->macro;
context->if_ptr = SL_PP_MAX_IF_NESTING;
context->if_value = 1;
@@ -62,6 +68,7 @@ sl_pp_context_destroy(struct sl_pp_context *context)
if (context) {
free(context->cstr_pool);
sl_pp_macro_free(context->macro);
free(context->getc_buf);
free(context);
}
}

+ 7
- 4
src/glsl/pp/sl_pp_context.h Datei anzeigen

@@ -30,6 +30,7 @@

#include "sl_pp_dict.h"
#include "sl_pp_macro.h"
#include "sl_pp_purify.h"


#define SL_PP_MAX_IF_NESTING 64
@@ -53,10 +54,12 @@ struct sl_pp_context {

unsigned int line;
unsigned int file;
};

int
sl_pp_context_add_unique_str(struct sl_pp_context *context,
const char *str);
struct sl_pp_purify_state pure;

char *getc_buf;
unsigned int getc_buf_size;
unsigned int getc_buf_capacity;
};

#endif /* SL_PP_CONTEXT_H */

+ 1
- 0
src/glsl/pp/sl_pp_dict.c Datei anzeigen

@@ -25,6 +25,7 @@
*
**************************************************************************/

#include "sl_pp_public.h"
#include "sl_pp_context.h"
#include "sl_pp_dict.h"


+ 4
- 0
src/glsl/pp/sl_pp_public.h Datei anzeigen

@@ -45,6 +45,10 @@ sl_pp_context_destroy(struct sl_pp_context *context);
const char *
sl_pp_context_error_message(const struct sl_pp_context *context);

int
sl_pp_context_add_unique_str(struct sl_pp_context *context,
const char *str);

const char *
sl_pp_context_cstr(const struct sl_pp_context *context,
int offset);

+ 541
- 303
src/glsl/pp/sl_pp_token.c
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 1
- 0
src/glsl/pp/sl_pp_token.h Datei anzeigen

@@ -123,6 +123,7 @@ struct sl_pp_token_info {
int
sl_pp_tokenise(struct sl_pp_context *context,
const char *input,
const struct sl_pp_purify_options *options,
struct sl_pp_token_info **output);

#endif /* SL_PP_TOKEN_H */

Laden…
Abbrechen
Speichern