-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.2.0 - Changed config format to include...
mediatype. No major features added besides this
- Loading branch information
Showing
14 changed files
with
379 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
typedef struct{ | ||
char* townname; | ||
unsigned char mediatype_val; | ||
} conftok_t; | ||
|
||
int conf_parse(const char* data, conftok_t* token); | ||
int conf_gen(char** data, conftok_t* token); //data must be a pointer! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
void run_tests(); | ||
|
||
void conf_parse_test(); | ||
void text_test(); | ||
void simple_gfx_test(); | ||
void gfx_test(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <ctype.h> | ||
#include <string.h> | ||
|
||
#include "common.h" | ||
#include "gfx.h" | ||
#include "conf.h" | ||
|
||
//tokens must be array or pre-allocated pointer | ||
int conf_parse(const char* data, conftok_t* token){ | ||
int len; | ||
|
||
len = data[0]; | ||
token->townname = calloc(len+1, 1); //1 = '\0' | ||
sprintf(token->townname, "%.*s", len, &data[1]); | ||
token->mediatype_val = data[1+len]; | ||
|
||
return 0; | ||
} | ||
|
||
//data must not be a pointer to an array | ||
int conf_gen(char** data, conftok_t* token){ | ||
//str format: (length of townname (1 bytes))townname(mediatype_val (1 byte)) | ||
*data = calloc(1+strlen(token->townname+1+1), 1); | ||
sprintf(*data, "%c%s%c", strlen(token->townname), token->townname, token->mediatype_val); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.