]> git.lizzy.rs Git - dragonnet.git/blobdiff - gen_messages.c
Use dragontype numbers instead of stdint everywhere
[dragonnet.git] / gen_messages.c
index fce55a4baeb056948a269183c4ffd2f2d3b776cd..17dab39b0414acde29c4825fa8fe90d114c7a411 100644 (file)
@@ -1,4 +1,4 @@
-#include <stdint.h>
+#include <dragontype/number.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -18,7 +18,7 @@ static size_t split(char ***strs, char *s, const char *delim)
        return i;
 }
 
-int main(int argc, char **argv)
+int main(__attribute((unused)) int argc, __attribute((unused)) char **argv)
 {
        FILE *fp = fopen("messages.dnet", "r");
 
@@ -28,7 +28,7 @@ int main(int argc, char **argv)
 
        fclose(fp);
        fp = fopen("messages.h", "w");
-       fprintf(fp, "#include <stdint.h>\n\n");
+       fprintf(fp, "#include <dragontype/number.h>\n\n");
 
        char **msgs;
        size_t msgs_len = split(&msgs, data, "\n");
@@ -47,21 +47,21 @@ int main(int argc, char **argv)
 
                        char type[10];
                        if (strcmp(tokens[0], "\ts8") == 0)
-                               strcpy(type, "int8_t ");
+                               strcpy(type, "s8 ");
                        else if (strcmp(tokens[0], "\ts16") == 0)
-                               strcpy(type, "int16_t ");
+                               strcpy(type, "s16 ");
                        else if (strcmp(tokens[0], "\ts32") == 0)
-                               strcpy(type, "int32_t ");
+                               strcpy(type, "s32 ");
                        else if (strcmp(tokens[0], "\ts64") == 0)
-                               strcpy(type, "int64_t ");
+                               strcpy(type, "s64 ");
                        else if (strcmp(tokens[0], "\tu8") == 0)
-                               strcpy(type, "uint8_t ");
+                               strcpy(type, "u8 ");
                        else if (strcmp(tokens[0], "\tu16") == 0)
-                               strcpy(type, "uint16_t ");
+                               strcpy(type, "u16 ");
                        else if (strcmp(tokens[0], "\tu32") == 0)
-                               strcpy(type, "uint32_t ");
+                               strcpy(type, "u32 ");
                        else if (strcmp(tokens[0], "\tu64") == 0)
-                               strcpy(type, "uint64_t ");
+                               strcpy(type, "u64 ");
 
                        fprintf(fp, "\t%s%s;\n", type, tokens[1]);
                        free(tokens);