add json parsing of lists and maps
This commit is contained in:
parent
7471093f67
commit
025c8125fa
16 changed files with 210 additions and 20 deletions
10
planarbot.c
10
planarbot.c
|
@ -104,14 +104,16 @@ Gamestate *read_gamestate() {
|
|||
}
|
||||
|
||||
void free_gamestate(Gamestate *this) {
|
||||
fold_list(this->planets, NULL, free_listitem);
|
||||
free_list(this->planets);
|
||||
fold_list(this->expeditions, NULL, free_listitem);
|
||||
free_list(this->expeditions);
|
||||
free(this);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
Json * json = json_parse(stdin);
|
||||
Gamestate *gamestate;
|
||||
/*Gamestate *gamestate;
|
||||
SortedMap *test;
|
||||
|
||||
gamestate = read_gamestate();
|
||||
|
@ -124,7 +126,11 @@ int main(int argc, char **argv) {
|
|||
test = put_map(test, "awer", "qwer");
|
||||
printf("%s\n", (char *) get_map(test, "awer"));
|
||||
print_map(test);
|
||||
free_map(test);
|
||||
free_map(test); */
|
||||
json_print(json, stdout);
|
||||
json_free(json);
|
||||
|
||||
json = json_parse(stdin);
|
||||
json_print(json, stdout);
|
||||
json_free(json);
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue