]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - intrin.h
Use the _t consistency naming scheme. Also various cleanups.
[xonotic/gmqcc.git] / intrin.h
index 4b4c9478afa3cb760b1c7ed216ebe86377a3d22f..00464aaa5da1a64fb6be63bd318a16959c1c619d 100644 (file)
--- a/intrin.h
+++ b/intrin.h
@@ -36,7 +36,7 @@ typedef struct {
     const char       *alias;
 } intrin_t;
 
-ht intrin_intrinsics() {
+static ht intrin_intrinsics(void) {
     static ht intrinsics = NULL;
     if (!intrinsics)
         intrinsics = util_htnew(PARSER_HT_SIZE);
@@ -69,12 +69,10 @@ ht intrin_intrinsics() {
         vec_push(parser->globals,   (ast_expression*)(VALUE));        \
     } while (0)
 
-
-ast_expression *intrin_func (parser_t *parser, const char *name);
-
 #define QC_M_E 2.71828182845905
 
-ast_expression *intrin_pow(parser_t *parser) {
+static ast_expression *intrin_func(parser_t *parser, const char *name);
+static ast_expression *intrin_pow (parser_t *parser) {
     /*
      * float pow(float x, float y) {
      *   float local = 1.0f;
@@ -221,7 +219,7 @@ ast_expression *intrin_pow(parser_t *parser) {
     return (ast_expression*)value;
 }
 
-ast_expression *intrin_mod(parser_t *parser) {
+static ast_expression *intrin_mod(parser_t *parser) {
     /*
      * float mod(float x, float y) {
      *   return x - y * floor(x / y);
@@ -276,7 +274,7 @@ ast_expression *intrin_mod(parser_t *parser) {
     return (ast_expression*)value;
 }
 
-ast_expression *intrin_exp(parser_t *parser) {
+static ast_expression *intrin_exp(parser_t *parser) {
     /*
      * float exp(float x) {
      *     return pow(QC_M_E, x);
@@ -314,7 +312,7 @@ ast_expression *intrin_exp(parser_t *parser) {
     return (ast_expression*)value;
 }
 
-ast_expression *intrin_isnan(parser_t *parser) {
+static ast_expression *intrin_isnan(parser_t *parser) {
     /*
      * float isnan(float x) {
      *   float local;
@@ -383,7 +381,7 @@ void intrin_intrinsics_destroy(parser_t *parser) {
 }
 
 
-ast_expression *intrin_func(parser_t *parser, const char *name) {
+static ast_expression *intrin_func(parser_t *parser, const char *name) {
     static bool  init = false;
     size_t       i    = 0;
     void        *find;
@@ -404,7 +402,7 @@ ast_expression *intrin_func(parser_t *parser, const char *name) {
     if ((find = (void*)parser_find_global(parser, name)) && ((ast_value*)find)->expression.vtype == TYPE_FUNCTION)
         for (i = 0; i < vec_size(parser->functions); ++i)
             if (((ast_value*)find)->name && !strcmp(parser->functions[i]->name, ((ast_value*)find)->name) && parser->functions[i]->builtin < 0)
-                return find;
+                return (ast_expression*)find;
 
     if ((find = util_htget(intrin_intrinsics(), name))) {
         /* intrinsic is in table. This will "generate the function" so