Browse Source

Move jimp.c to examples

rexim 1 tháng trước cách đây
mục cha
commit
dd5236bb04
12 tập tin đã thay đổi với 11 bổ sung88 xóa
  1. 1 4
      Makefile
  2. 2 0
      README.md
  3. 0 1
      empty.json
  4. 1 0
      examples/.gitignore
  5. 2 2
      examples/03_parsing_database.c
  6. 5 2
      examples/Makefile
  7. 0 0
      examples/database.json
  8. 0 1
      numbers.json
  9. 0 8
      one.json
  10. 0 8
      profile.json
  11. 0 62
      profiles.json
  12. 0 0
      thirdparty/nob.h

+ 1 - 4
Makefile

@@ -1,14 +1,11 @@
 CFLAGS=-Wall -Wextra -Wswitch-enum -ggdb
 
 .PHONY: all
-all: examples test jimp
+all: examples test
 
 test: test.c jim.h
 	$(CC) $(CFLAGS) -o test test.c 
 
-jimp: jimp.c nob.h
-	$(CC) $(CFLAGS) -o jimp jimp.c
-
 .PHONY: examples
 examples: 
 	$(MAKE) -C examples/

+ 2 - 0
README.md

@@ -114,3 +114,5 @@ $ ./test record
 
 1. Does not depends on libc. Could be theoretically used in embedded, but I know nothing about embedded, so maybe not.
 2. `jim_float()` is quite likely very stupid and imprecise
+
+<!-- TODO: document jimp.h here -->

+ 0 - 1
empty.json

@@ -1 +0,0 @@
-[]

+ 1 - 0
examples/.gitignore

@@ -1,2 +1,3 @@
 01_from_readme
 02_binary_tree
+03_parsing_database

+ 2 - 2
jimp.c → examples/03_parsing_database.c

@@ -2,9 +2,9 @@
 #include <stdbool.h>
 #define NOB_IMPLEMENTATION
 #define NOB_STRIP_PREFIX
-#include "nob.h"
+#include "../thirdparty/nob.h"
 #define JIMP_IMPLEMENTATION
-#include "jimp.h"
+#include "../jimp.h"
 
 typedef struct {
     const char *name;

+ 5 - 2
examples/Makefile

@@ -1,10 +1,13 @@
-CFLAGS=-Wall -Wextra -Wswitch-enum -std=c99 -pedantic -ggdb
+CFLAGS=-Wall -Wextra -Wswitch-enum -ggdb
 
 .PHONY: all
-all: 01_from_readme 02_binary_tree
+all: 01_from_readme 02_binary_tree 03_parsing_database
 
 01_from_readme: 01_from_readme.c ../jim.h
 	$(CC) $(CFLAGS) -o 01_from_readme 01_from_readme.c
 
 02_binary_tree: 02_binary_tree.c fruits.h ../jim.h
 	$(CC) $(CFLAGS) -o 02_binary_tree 02_binary_tree.c
+
+03_parsing_database: 03_parsing_database.c ../jimp.h ../thirdparty/nob.h
+	$(CC) $(CFLAGS) -o 03_parsing_database 03_parsing_database.c

+ 0 - 0
database.json → examples/database.json


+ 0 - 1
numbers.json

@@ -1 +0,0 @@
-[69, 420, 1337, 80085]

+ 0 - 8
one.json

@@ -1,8 +0,0 @@
-[
-    {
-        "name": "Alice Smith",
-        "age": 34,
-        "location": "Wonderland",
-        "body_count": 150
-    }
-]

+ 0 - 8
profile.json

@@ -1,8 +0,0 @@
-{
-    "name": "John Dough",
-    "age": 69,
-    "location": "urmom",
-    "location": "foo",
-    "location": "bar",
-    "body_count": 420
-}

+ 0 - 62
profiles.json

@@ -1,62 +0,0 @@
-[
-    {
-        "name": "Alice Smith",
-        "age": 34,
-        "location": "Wonderland",
-        "body_count": 150
-    },
-    {
-        "name": "Bob Johnson",
-        "age": 45,
-        "location": "Atlantis",
-        "body_count": 300
-    },
-    {
-        "name": "Charlie Brown",
-        "age": 28,
-        "location": "Chocolate Factory",
-        "body_count": 200
-    },
-    {
-        "name": "Diana Prince",
-        "age": 32,
-        "location": "Themyscira",
-        "body_count": 250
-    },
-    {
-        "name": "Ethan Hunt",
-        "age": 40,
-        "location": "Mission HQ",
-        "body_count": 350
-    },
-    {
-        "name": "Fiona Apple",
-        "age": 37,
-        "location": "Music City",
-        "body_count": 180
-    },
-    {
-        "name": "George Lucas",
-        "age": 75,
-        "location": "Galaxy Far Far Away",
-        "body_count": 500
-    },
-    {
-        "name": "Hannah Montana",
-        "age": 25,
-        "location": "Nashville",
-        "body_count": 100
-    },
-    {
-        "name": "Ian Malcolm",
-        "age": 60,
-        "location": "Jurassic Park",
-        "body_count": 400
-    },
-    {
-        "name": "Jessica Rabbit",
-        "age": 30,
-        "location": "Toontown",
-        "body_count": 220
-    }
-]

+ 0 - 0
nob.h → thirdparty/nob.h