demake 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/demake +296 -26
- data/lib/apps/example/demake/auto_bits.rb +59 -0
- data/lib/apps/example/demake/auto_list.rb +60 -0
- data/lib/apps/example/src/Makefile +6 -0
- data/lib/apps/oreo/oreo_test.txt +0 -0
- data/lib/apps/oreo/src/Makefile +6 -0
- data/lib/data/libsrc/auto_bits.c +41 -0
- data/lib/data/libsrc/auto_bits.h +212 -4
- data/lib/data/libsrc/auto_bits.rb +9 -0
- data/lib/data/libsrc/auto_list.rb +9 -0
- data/lib/data/libsrc/auto_string.c +300 -0
- data/lib/data/libsrc/auto_string.h +1023 -0
- data/lib/data/libsrc/auto_string_clamp_test.c +52 -0
- data/lib/data/libsrc/defines.h +29 -3
- data/lib/data/libsrc/memory_arena.c +32 -0
- data/lib/data/libsrc/memory_arena.h +345 -0
- data/lib/data/libsrc/memory_arena_test.c +173 -0
- data/lib/data/libsrc/simple_linked_list.c +42 -22
- data/lib/data/libsrc/simple_linked_list.h +140 -56
- data/lib/data/libsrc/typedefs.h +5 -3
- data/lib/to_plural.rb +126 -0
- metadata +47 -15
- data/lib/data/libsrc/simple_linked_list +0 -0
- data/lib/data/libsrc/smart_alloc.h +0 -45
|
@@ -1,36 +1,56 @@
|
|
|
1
1
|
#include <stdio.h>
|
|
2
2
|
#include <stdlib.h>
|
|
3
3
|
|
|
4
|
-
#include "base.h"
|
|
5
4
|
#define SIMPLE_DOUBLE_LINKED_LIST
|
|
6
5
|
#define SIMPLE_LINKED_LIST_IMPLEMENTATION
|
|
7
6
|
#include "simple_linked_list.h"
|
|
8
7
|
|
|
9
8
|
i32 main(i32 argc, c8 *argv[])
|
|
10
9
|
{
|
|
11
|
-
struct
|
|
10
|
+
struct simple_linked_list_data *head = NULL, *tail = NULL;
|
|
11
|
+
struct simple_linked_list_data *s1 = NULL, *s2;
|
|
12
12
|
c8 *a = "a", *b = "b", *c = "c", *d = "d", *e = "e", *f = "f";
|
|
13
13
|
|
|
14
|
-
head =
|
|
15
|
-
simple_linked_list_init(
|
|
16
|
-
tail =
|
|
17
|
-
simple_linked_list_insert_after(head,
|
|
18
|
-
|
|
19
|
-
simple_linked_list_insert_after(tail,
|
|
20
|
-
tail =
|
|
21
|
-
|
|
22
|
-
simple_linked_list_insert_after(tail,
|
|
23
|
-
tail =
|
|
24
|
-
|
|
25
|
-
simple_linked_list_insert_before(tail,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
simple_linked_list_insert_before(tail, s, d);
|
|
14
|
+
head = s1 = calloc(1, sizeof(struct simple_linked_list_data));
|
|
15
|
+
simple_linked_list_init(s1, a);
|
|
16
|
+
tail = s1 = calloc(1, sizeof(struct simple_linked_list_data));
|
|
17
|
+
simple_linked_list_insert_after(head, s1, b);
|
|
18
|
+
s1 = calloc(1, sizeof(struct simple_linked_list_data));
|
|
19
|
+
simple_linked_list_insert_after(tail, s1, c);
|
|
20
|
+
tail = s1;
|
|
21
|
+
s1 = calloc(1, sizeof(struct simple_linked_list_data));
|
|
22
|
+
simple_linked_list_insert_after(tail, s1, f);
|
|
23
|
+
tail = s1;
|
|
24
|
+
s2 = calloc(1, sizeof(struct simple_linked_list_data));
|
|
25
|
+
simple_linked_list_insert_before(tail, s2, e);
|
|
26
|
+
s1 = calloc(1, sizeof(struct simple_linked_list_data));
|
|
27
|
+
simple_linked_list_insert_before(s2, s1, d);
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
printf("head to tail:");
|
|
30
|
+
s1 = head;
|
|
31
|
+
while(s1) {
|
|
32
|
+
if(s1 && s1->value && s1->value != NULL)
|
|
33
|
+
printf(" %s", (c8 *)s1->value);
|
|
34
|
+
s1 = s1->next;
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
printf("\ntail to head:");
|
|
38
|
+
s1 = tail;
|
|
39
|
+
while(s1) {
|
|
40
|
+
if(s1 && s1->value && s1->value != NULL)
|
|
41
|
+
printf(" %s", (c8 *)s1->value);
|
|
42
|
+
s1 = s1->previous;
|
|
43
|
+
}
|
|
44
|
+
printf("\n");
|
|
45
|
+
|
|
46
|
+
s1 = head;
|
|
47
|
+
while(s1) {
|
|
48
|
+
head = s1->next;
|
|
49
|
+
simple_linked_list_remove(s1);
|
|
50
|
+
free(s1);
|
|
51
|
+
s1 = head;
|
|
52
|
+
}
|
|
53
|
+
tail = head = s1 = s2 = NULL;
|
|
54
|
+
|
|
55
|
+
exit(0);
|
|
36
56
|
}
|
|
@@ -8,84 +8,168 @@
|
|
|
8
8
|
|
|
9
9
|
Public Functions:
|
|
10
10
|
|
|
11
|
+
static void simple_linked_list_init(struct simple_linked_list_data *s, void *value);
|
|
12
|
+
|
|
13
|
+
static void simple_linked_list_insert_after(struct simple_linked_list_data *position,
|
|
14
|
+
struct simple_linked_list_data *s, void *value);
|
|
15
|
+
static void simple_linked_list_insert_before(struct simple_linked_list_data *position,
|
|
16
|
+
struct simple_linked_list_data *s, void *value);
|
|
17
|
+
|
|
18
|
+
static void simple_linked_list_remove(struct simple_linked_list_data *s);
|
|
19
|
+
|
|
11
20
|
*/
|
|
12
21
|
|
|
13
22
|
#ifndef SIMPLE_LINKED_LIST_H_Minaswan /* Prevent multiple inclusions */
|
|
14
|
-
#define SIMPLE_LINKED_LIST_H_Minaswan
|
|
15
|
-
#ifndef TYPEDEFS_H_Minaswan
|
|
23
|
+
#define SIMPLE_LINKED_LIST_H_Minaswan
|
|
24
|
+
#ifndef TYPEDEFS_H_Minaswan /* Prevents multiple inclusions */
|
|
16
25
|
#define TYPEDEFS_H_Minaswan
|
|
26
|
+
#define TYPEDEFS_VERSION "0.1.0"
|
|
27
|
+
#include <stdint.h>
|
|
17
28
|
|
|
18
|
-
|
|
29
|
+
typedef uint8_t b8; /* Booleans */
|
|
30
|
+
typedef uint16_t b16;
|
|
31
|
+
typedef uint32_t b32;
|
|
32
|
+
typedef uint64_t b64;
|
|
19
33
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
#ifdef SIMPLE_DOUBLE_LINKED_LIST
|
|
23
|
-
struct simple_linked_list_s *previous;
|
|
24
|
-
#endif
|
|
25
|
-
void *value;
|
|
26
|
-
};
|
|
34
|
+
typedef char c8; /* Characters */
|
|
35
|
+
typedef unsigned char uc8;
|
|
27
36
|
|
|
28
|
-
|
|
37
|
+
typedef uint8_t u8; /* Unsigned Numbers */
|
|
38
|
+
typedef uint16_t u16;
|
|
39
|
+
typedef uint32_t u32;
|
|
40
|
+
typedef uint64_t u64;
|
|
29
41
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
s->previous = s->next = NULL;
|
|
35
|
-
#endif
|
|
36
|
-
s->value = value;
|
|
37
|
-
}
|
|
42
|
+
typedef int8_t i8; /* Signed Numbers */
|
|
43
|
+
typedef int16_t i16;
|
|
44
|
+
typedef int32_t i32;
|
|
45
|
+
typedef int64_t i64;
|
|
38
46
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
s->value = value;
|
|
43
|
-
s->next = position->next;
|
|
44
|
-
#ifdef SIMPLE_DOUBLE_LINKED_LIST
|
|
45
|
-
s->previous = position;
|
|
46
|
-
if(position->next != NULL)
|
|
47
|
-
position->next->previous = s;
|
|
48
|
-
#endif
|
|
49
|
-
position->next = s;
|
|
50
|
-
}
|
|
47
|
+
typedef float f32; /* Floating Point Numbers */
|
|
48
|
+
typedef double f64;
|
|
49
|
+
#endif /* TYPEDEFS_H_Minaswan */
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
s->value = value;
|
|
56
|
-
s->next = position;
|
|
51
|
+
struct simple_linked_list_data {
|
|
52
|
+
void *value;
|
|
53
|
+
struct simple_linked_list_data *next;
|
|
57
54
|
#ifdef SIMPLE_DOUBLE_LINKED_LIST
|
|
58
|
-
|
|
59
|
-
if(position->previous != NULL)
|
|
60
|
-
position->previous->next = s;
|
|
61
|
-
position->previous = s;
|
|
55
|
+
struct simple_linked_list_data *previous;
|
|
62
56
|
#endif
|
|
63
|
-
}
|
|
57
|
+
};
|
|
64
58
|
|
|
65
|
-
|
|
66
|
-
void
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
s->previous = s->next = NULL;
|
|
73
|
-
}
|
|
74
|
-
#endif
|
|
59
|
+
/* Public Functions */
|
|
60
|
+
static void simple_linked_list_init(struct simple_linked_list_data *s, void *value);
|
|
61
|
+
static void simple_linked_list_insert_after(struct simple_linked_list_data *position,
|
|
62
|
+
struct simple_linked_list_data *s, void *value);
|
|
63
|
+
static void simple_linked_list_insert_before(struct simple_linked_list_data *position,
|
|
64
|
+
struct simple_linked_list_data *s, void *value);
|
|
65
|
+
static void simple_linked_list_remove(struct simple_linked_list_data *s);
|
|
75
66
|
|
|
67
|
+
#ifdef SIMPLE_LINKED_LIST_IMPLEMENTATION
|
|
68
|
+
static void simple_linked_list_init(struct simple_linked_list_data *s, void *value)
|
|
69
|
+
{
|
|
70
|
+
#ifdef SIMPLE_DOUBLE_LINKED_LIST
|
|
71
|
+
s->previous = s->next = NULL;
|
|
72
|
+
#endif
|
|
73
|
+
s->value = value;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
static void simple_linked_list_insert_after(struct simple_linked_list_data *position,
|
|
77
|
+
struct simple_linked_list_data *s, void *value)
|
|
78
|
+
{
|
|
79
|
+
s->value = value;
|
|
80
|
+
s->next = position->next;
|
|
81
|
+
#ifdef SIMPLE_DOUBLE_LINKED_LIST
|
|
82
|
+
s->previous = position;
|
|
83
|
+
if(position->next != NULL)
|
|
84
|
+
position->next->previous = s;
|
|
85
|
+
#endif
|
|
86
|
+
position->next = s;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static void simple_linked_list_insert_before(struct simple_linked_list_data *position,
|
|
90
|
+
struct simple_linked_list_data *s, void *value)
|
|
91
|
+
{
|
|
92
|
+
s->value = value;
|
|
93
|
+
s->next = position;
|
|
94
|
+
#ifdef SIMPLE_DOUBLE_LINKED_LIST
|
|
95
|
+
s->previous = position->previous;
|
|
96
|
+
if(position->previous != NULL)
|
|
97
|
+
position->previous->next = s;
|
|
98
|
+
position->previous = s;
|
|
99
|
+
#endif
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
#ifdef SIMPLE_DOUBLE_LINKED_LIST
|
|
103
|
+
static void simple_linked_list_remove(struct simple_linked_list_data *s)
|
|
104
|
+
{
|
|
105
|
+
if(s->previous)
|
|
106
|
+
s->previous->next = s->next;
|
|
107
|
+
if(s->next)
|
|
108
|
+
s->next->previous = s->previous;
|
|
109
|
+
s->previous = s->next = NULL;
|
|
110
|
+
}
|
|
111
|
+
#endif
|
|
76
112
|
#endif /* SIMPLE_LINKED_LIST_IMPLEMENTATION */
|
|
77
113
|
#endif /* SIMPLE_LINKED_LIST_H_Minaswan */
|
|
78
114
|
|
|
79
115
|
/*
|
|
80
116
|
Example:
|
|
81
117
|
|
|
118
|
+
#include <stdio.h>
|
|
119
|
+
#include <stdlib.h>
|
|
120
|
+
|
|
121
|
+
#define SIMPLE_DOUBLE_LINKED_LIST
|
|
82
122
|
#define SIMPLE_LINKED_LIST_IMPLEMENTATION
|
|
83
123
|
#include "simple_linked_list.h"
|
|
84
124
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
125
|
+
i32 main(i32 argc, c8 *argv[])
|
|
126
|
+
{
|
|
127
|
+
struct simple_linked_list_data *head = NULL, *tail = NULL;
|
|
128
|
+
struct simple_linked_list_data *s1 = NULL, *s2;
|
|
129
|
+
c8 *a = "a", *b = "b", *c = "c", *d = "d", *e = "e", *f = "f";
|
|
130
|
+
|
|
131
|
+
head = s1 = calloc(1, sizeof(struct simple_linked_list_data));
|
|
132
|
+
simple_linked_list_init(s1, a);
|
|
133
|
+
tail = s1 = calloc(1, sizeof(struct simple_linked_list_data));
|
|
134
|
+
simple_linked_list_insert_after(head, s1, b);
|
|
135
|
+
s1 = calloc(1, sizeof(struct simple_linked_list_data));
|
|
136
|
+
simple_linked_list_insert_after(tail, s1, c);
|
|
137
|
+
tail = s1;
|
|
138
|
+
s1 = calloc(1, sizeof(struct simple_linked_list_data));
|
|
139
|
+
simple_linked_list_insert_after(tail, s1, f);
|
|
140
|
+
tail = s1;
|
|
141
|
+
s2 = calloc(1, sizeof(struct simple_linked_list_data));
|
|
142
|
+
simple_linked_list_insert_before(tail, s2, e);
|
|
143
|
+
s1 = calloc(1, sizeof(struct simple_linked_list_data));
|
|
144
|
+
simple_linked_list_insert_before(s2, s1, d);
|
|
145
|
+
|
|
146
|
+
printf("head to tail:");
|
|
147
|
+
s1 = head;
|
|
148
|
+
while(s1) {
|
|
149
|
+
if(s1 && s1->value && s1->value != NULL)
|
|
150
|
+
printf(" %s", (c8 *)s1->value);
|
|
151
|
+
s1 = s1->next;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
printf("\ntail to head:");
|
|
155
|
+
s1 = tail;
|
|
156
|
+
while(s1) {
|
|
157
|
+
if(s1 && s1->value && s1->value != NULL)
|
|
158
|
+
printf(" %s", (c8 *)s1->value);
|
|
159
|
+
s1 = s1->previous;
|
|
160
|
+
}
|
|
161
|
+
printf("\n");
|
|
162
|
+
|
|
163
|
+
s1 = head;
|
|
164
|
+
while(s1) {
|
|
165
|
+
head = s1->next;
|
|
166
|
+
simple_linked_list_remove(s1);
|
|
167
|
+
free(s1);
|
|
168
|
+
s1 = head;
|
|
169
|
+
}
|
|
170
|
+
tail = head = s1 = s2 = NULL;
|
|
171
|
+
|
|
172
|
+
exit(0);
|
|
173
|
+
}
|
|
90
174
|
|
|
91
175
|
*/
|
data/lib/data/libsrc/typedefs.h
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
#ifndef TYPEDEFS_H_Minaswan /* Prevents multiple inclusions */
|
|
14
14
|
#define TYPEDEFS_H_Minaswan
|
|
15
|
-
#define TYPEDEFS_VERSION "0.1.
|
|
15
|
+
#define TYPEDEFS_VERSION "0.1.1"
|
|
16
16
|
#include <stdint.h>
|
|
17
17
|
|
|
18
18
|
typedef uint8_t b8; /* Booleans */
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
typedef uint64_t b64;
|
|
22
22
|
|
|
23
23
|
typedef char c8; /* Characters */
|
|
24
|
+
typedef const char cc8;
|
|
24
25
|
typedef unsigned char uc8;
|
|
26
|
+
typedef char as8; /* Auto string */
|
|
25
27
|
|
|
26
28
|
typedef uint8_t u8; /* Unsigned Numbers */
|
|
27
29
|
typedef uint16_t u16;
|
|
@@ -47,14 +49,14 @@ vim.api.nvim_create_autocmd("FileType", {
|
|
|
47
49
|
group = "CustomCTypedefs",
|
|
48
50
|
pattern = { "c", "h", "cpp", "hpp" },
|
|
49
51
|
callback = function()
|
|
50
|
-
vim.cmd([[syntax match CustomTypedef /\<\(b8\|b16\|b32\|b64\|c8\|uc8\|i8\|i16\|i32\|i64\|u8\|u16\|u32\|u64\|f32\|f64\)\>/]])
|
|
52
|
+
vim.cmd([[syntax match CustomTypedef /\<\(b8\|b16\|b32\|b64\|c8\|cc8\|uc8\|as8\|i8\|i16\|i32\|i64\|u8\|u16\|u32\|u64\|f32\|f64\)\>/]])
|
|
51
53
|
vim.cmd([[highlight CustomTypedef guifg=green ctermfg=green]])
|
|
52
54
|
end,
|
|
53
55
|
})
|
|
54
56
|
|
|
55
57
|
For nano, add to /usr/share/nano/c.nanorc:
|
|
56
58
|
|
|
57
|
-
color green "\<(b8|b16|b32|b64|c8|uc8|i8|i16|i32|i64|u8|u16|u32|u64|f32|f64)\>"
|
|
59
|
+
color green "\<(b8|b16|b32|b64|c8|cc8|uc8|as8|i8|i16|i32|i64|u8|u16|u32|u64|f32|f64)\>"
|
|
58
60
|
|
|
59
61
|
For emacs, it would seem the magic is strong, because it just works. :)
|
|
60
62
|
|
data/lib/to_plural.rb
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
PLURALS_TABLE = {
|
|
2
|
+
"aircraft" => "aircraft",
|
|
3
|
+
"analysis" => "analyses",
|
|
4
|
+
"analytics" => "analytics",
|
|
5
|
+
"appendix" => "appendices",
|
|
6
|
+
"audio" => "audio",
|
|
7
|
+
"bacterium" => "bacteria",
|
|
8
|
+
"baggage" => "baggage",
|
|
9
|
+
"basis" => "bases",
|
|
10
|
+
"bison" => "bison",
|
|
11
|
+
"buffalo" => "buffalo",
|
|
12
|
+
"cactus" => "cacti",
|
|
13
|
+
"child" => "children",
|
|
14
|
+
"content" => "content",
|
|
15
|
+
"corpus" => "corpora",
|
|
16
|
+
"crisis" => "crises",
|
|
17
|
+
"criterion" => "criteria",
|
|
18
|
+
"currency" => "currency",
|
|
19
|
+
"curriculum" => "curricula",
|
|
20
|
+
"datum" => "data",
|
|
21
|
+
"deer" => "deer",
|
|
22
|
+
"diagnosis" => "diagnoses",
|
|
23
|
+
"die" => "dice",
|
|
24
|
+
"elk" => "elk",
|
|
25
|
+
"ellipsis" => "ellipses",
|
|
26
|
+
"equipment" => "equipment",
|
|
27
|
+
"feedback" => "feedback",
|
|
28
|
+
"firmware" => "firmware",
|
|
29
|
+
"fish" => "fish",
|
|
30
|
+
"focus" => "foci",
|
|
31
|
+
"foot" => "feet",
|
|
32
|
+
"fungus" => "fungi",
|
|
33
|
+
"furniture" => "furniture",
|
|
34
|
+
"garbage" => "garbage",
|
|
35
|
+
"genus" => "genera",
|
|
36
|
+
"goose" => "geese",
|
|
37
|
+
"hardware" => "hardware",
|
|
38
|
+
"hovercraft" => "hovercraft",
|
|
39
|
+
"hypothesis" => "hypotheses",
|
|
40
|
+
"index" => "indices",
|
|
41
|
+
"information" => "information",
|
|
42
|
+
"jeans" => "jeans",
|
|
43
|
+
"knowledge" => "knowledge",
|
|
44
|
+
"louse" => "lice",
|
|
45
|
+
"luggage" => "luggage",
|
|
46
|
+
"man" => "men",
|
|
47
|
+
"marketing" => "marketing",
|
|
48
|
+
"matrix" => "matrices",
|
|
49
|
+
"medium" => "media",
|
|
50
|
+
"memorandum" => "memoranda",
|
|
51
|
+
"metadata" => "metadata",
|
|
52
|
+
"middleware" => "middleware",
|
|
53
|
+
"money" => "money",
|
|
54
|
+
"moose" => "moose",
|
|
55
|
+
"mouse" => "mice",
|
|
56
|
+
"music" => "music",
|
|
57
|
+
"neurosis" => "neuroses",
|
|
58
|
+
"news" => "news",
|
|
59
|
+
"nucleus" => "nuclei",
|
|
60
|
+
"oasis" => "oases",
|
|
61
|
+
"octopus" => "octopi",
|
|
62
|
+
"offspring" => "offspring",
|
|
63
|
+
"ox" => "oxen",
|
|
64
|
+
"pants" => "pants",
|
|
65
|
+
"paralysis" => "paralyses",
|
|
66
|
+
"parenthesis" => "parentheses",
|
|
67
|
+
"person" => "people",
|
|
68
|
+
"phenomenon" => "phenomena",
|
|
69
|
+
"police" => "police",
|
|
70
|
+
"progress" => "progress",
|
|
71
|
+
"research" => "research",
|
|
72
|
+
"rice" => "rice",
|
|
73
|
+
"rubbish" => "rubbish",
|
|
74
|
+
"salmon" => "salmon",
|
|
75
|
+
"scissors" => "scissors",
|
|
76
|
+
"series" => "series",
|
|
77
|
+
"sheep" => "sheep",
|
|
78
|
+
"software" => "software",
|
|
79
|
+
"spacecraft" => "spacecraft",
|
|
80
|
+
"species" => "species",
|
|
81
|
+
"spokesman" => "spokesmen",
|
|
82
|
+
"spokeswoman" => "spokeswomen",
|
|
83
|
+
"squid" => "squid",
|
|
84
|
+
"staff" => "staff",
|
|
85
|
+
"stimulus" => "stimuli",
|
|
86
|
+
"stratum" => "strata",
|
|
87
|
+
"swine" => "swine",
|
|
88
|
+
"syllabus" => "syllabi",
|
|
89
|
+
"synopsis" => "synopses",
|
|
90
|
+
"thesis" => "theses",
|
|
91
|
+
"tooth" => "teeth",
|
|
92
|
+
"traffic" => "traffic",
|
|
93
|
+
"trousers" => "trousers",
|
|
94
|
+
"trout" => "trout",
|
|
95
|
+
"vortex" => "vortices",
|
|
96
|
+
"watercraft" => "watercraft",
|
|
97
|
+
"woman" => "women",
|
|
98
|
+
"zombie" => "zombies"
|
|
99
|
+
}.freeze
|
|
100
|
+
|
|
101
|
+
def pluralize(word)
|
|
102
|
+
if(word.empty?)
|
|
103
|
+
return word
|
|
104
|
+
end
|
|
105
|
+
word = word.to_s.dup
|
|
106
|
+
pattern_replacement = Array.new
|
|
107
|
+
pattern_replacement << [/([^aeiou])y$/i, '\1ies']
|
|
108
|
+
pattern_replacement << [/(ch|sh|x|s|z)$/i, '\1es']
|
|
109
|
+
pattern_replacement << [/fe$/i, 'ves']
|
|
110
|
+
pattern_replacement << [/([^f])f$/i, '\1ves']
|
|
111
|
+
pattern_replacement << [/$/, 's']
|
|
112
|
+
pattern_replacement.each do |pattern, replacement|
|
|
113
|
+
if(word.gsub!(pattern, replacement))
|
|
114
|
+
break
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
return word
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def to_plural(word)
|
|
121
|
+
key = word.to_s.downcase
|
|
122
|
+
if(PLURALS_TABLE.key?(key))
|
|
123
|
+
return PLURALS_TABLE[key]
|
|
124
|
+
end
|
|
125
|
+
return pluralize(word)
|
|
126
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: demake
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Minaswan Nakamoto
|
|
@@ -30,12 +30,35 @@ dependencies:
|
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
31
|
version: 0.1.3
|
|
32
32
|
description: |
|
|
33
|
-
== Develop, Decorate and manage Dependencies for C (GNU) Makefiles easily with
|
|
33
|
+
== Develop, Decorate and manage Dependencies for C (GNU) Makefiles easily with Ruby.
|
|
34
34
|
|
|
35
35
|
Install using the Ruby Gem:
|
|
36
36
|
|
|
37
37
|
> gem install demake
|
|
38
38
|
|
|
39
|
+
To see command syntax:
|
|
40
|
+
|
|
41
|
+
> demake ?
|
|
42
|
+
|
|
43
|
+
Command syntax:
|
|
44
|
+
|
|
45
|
+
demake - Create or update Makefile
|
|
46
|
+
demake ? - View this help information
|
|
47
|
+
demake new <name> - Create new application
|
|
48
|
+
demake example - Create an example application
|
|
49
|
+
demake oreo - Create a different sample application
|
|
50
|
+
|
|
51
|
+
To create a new application:
|
|
52
|
+
|
|
53
|
+
> demake new <name>
|
|
54
|
+
|
|
55
|
+
This will create a new directory and basic files for a new C application.
|
|
56
|
+
|
|
57
|
+
To create or update a GNU Makefile on an existing demake application,
|
|
58
|
+
execute without arguments:
|
|
59
|
+
|
|
60
|
+
> demake
|
|
61
|
+
|
|
39
62
|
To create an example with multiple sample applications:
|
|
40
63
|
|
|
41
64
|
> demake example
|
|
@@ -48,9 +71,10 @@ description: |
|
|
|
48
71
|
|
|
49
72
|
This will create a directory named oreo containing the example.
|
|
50
73
|
|
|
51
|
-
It requires a demake directory and application file containing the
|
|
52
|
-
names followed by depencencies separated by spaces and
|
|
53
|
-
a
|
|
74
|
+
It requires a demake directory and application file containing the
|
|
75
|
+
application names followed by depencencies separated by spaces and
|
|
76
|
+
with a new line to indicate a different application.
|
|
77
|
+
Something like (from the example):
|
|
54
78
|
|
|
55
79
|
> mkdir demake
|
|
56
80
|
> echo "hello string" > demake/applications
|
|
@@ -61,10 +85,6 @@ description: |
|
|
|
61
85
|
demake/settings.rb, demake/test-target.rb, demake/install-target.rb,
|
|
62
86
|
demake/license
|
|
63
87
|
|
|
64
|
-
The output of the command by itself is a (GNU style) file named Makefile:
|
|
65
|
-
|
|
66
|
-
> demake
|
|
67
|
-
|
|
68
88
|
You can also clone from git:
|
|
69
89
|
|
|
70
90
|
> git clone https://github.com/MinaswanNakamoto/demake.git
|
|
@@ -73,8 +93,8 @@ description: |
|
|
|
73
93
|
> bin/demake example
|
|
74
94
|
> cd example ; make ; make build ; make test
|
|
75
95
|
|
|
76
|
-
If you have an existing C application and you want to generate a Makefile
|
|
77
|
-
you might try the gen_application shell script.
|
|
96
|
+
If you have an existing C application and you want to generate a Makefile
|
|
97
|
+
for it, you might try the gen_application shell script.
|
|
78
98
|
|
|
79
99
|
> ./gen_application myapp
|
|
80
100
|
email: minaswan.nakamoto@onionmail.org
|
|
@@ -86,11 +106,14 @@ files:
|
|
|
86
106
|
- bin/demake
|
|
87
107
|
- lib/apps/example/Makefile
|
|
88
108
|
- lib/apps/example/demake/applications
|
|
109
|
+
- lib/apps/example/demake/auto_bits.rb
|
|
110
|
+
- lib/apps/example/demake/auto_list.rb
|
|
89
111
|
- lib/apps/example/demake/brief_description
|
|
90
112
|
- lib/apps/example/demake/license
|
|
91
113
|
- lib/apps/example/demake/settings.rb
|
|
92
114
|
- lib/apps/example/demake/suggestion
|
|
93
115
|
- lib/apps/example/demake/test-target.rb
|
|
116
|
+
- lib/apps/example/src/Makefile
|
|
94
117
|
- lib/apps/example/src/goodbye.c
|
|
95
118
|
- lib/apps/example/src/hello.c
|
|
96
119
|
- lib/apps/example/src/string/string.c
|
|
@@ -103,22 +126,30 @@ files:
|
|
|
103
126
|
- lib/apps/oreo/demake/suggestion
|
|
104
127
|
- lib/apps/oreo/demake/test-target.rb
|
|
105
128
|
- lib/apps/oreo/oreo_test.txt
|
|
129
|
+
- lib/apps/oreo/src/Makefile
|
|
106
130
|
- lib/apps/oreo/src/defines.h
|
|
107
131
|
- lib/apps/oreo/src/fast_read_file.h
|
|
108
132
|
- lib/apps/oreo/src/oreo.c
|
|
109
133
|
- lib/apps/oreo/src/typedefs.h
|
|
134
|
+
- lib/data/libsrc/auto_bits.c
|
|
110
135
|
- lib/data/libsrc/auto_bits.h
|
|
136
|
+
- lib/data/libsrc/auto_bits.rb
|
|
137
|
+
- lib/data/libsrc/auto_list.rb
|
|
138
|
+
- lib/data/libsrc/auto_string.c
|
|
139
|
+
- lib/data/libsrc/auto_string.h
|
|
140
|
+
- lib/data/libsrc/auto_string_clamp_test.c
|
|
111
141
|
- lib/data/libsrc/base.h
|
|
112
142
|
- lib/data/libsrc/cpu_mark_check.h
|
|
113
143
|
- lib/data/libsrc/defines.h
|
|
114
144
|
- lib/data/libsrc/fast_read_file.h
|
|
115
145
|
- lib/data/libsrc/fast_sha2.h
|
|
146
|
+
- lib/data/libsrc/memory_arena.c
|
|
147
|
+
- lib/data/libsrc/memory_arena.h
|
|
148
|
+
- lib/data/libsrc/memory_arena_test.c
|
|
116
149
|
- lib/data/libsrc/parse_arguments.h
|
|
117
150
|
- lib/data/libsrc/rb_library.c
|
|
118
|
-
- lib/data/libsrc/simple_linked_list
|
|
119
151
|
- lib/data/libsrc/simple_linked_list.c
|
|
120
152
|
- lib/data/libsrc/simple_linked_list.h
|
|
121
|
-
- lib/data/libsrc/smart_alloc.h
|
|
122
153
|
- lib/data/libsrc/typedefs.h
|
|
123
154
|
- lib/template/build_target.rb
|
|
124
155
|
- lib/template/clean_target.rb
|
|
@@ -134,6 +165,7 @@ files:
|
|
|
134
165
|
- lib/template/license_target.rb
|
|
135
166
|
- lib/template/link_library_target.rb
|
|
136
167
|
- lib/template/strip_build.rb
|
|
168
|
+
- lib/to_plural.rb
|
|
137
169
|
homepage: https://github.com/MinaswanNakamoto/demake
|
|
138
170
|
licenses:
|
|
139
171
|
- MIT
|
|
@@ -152,8 +184,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
152
184
|
- !ruby/object:Gem::Version
|
|
153
185
|
version: '0'
|
|
154
186
|
requirements: []
|
|
155
|
-
rubygems_version: 4.0.
|
|
187
|
+
rubygems_version: 4.0.15
|
|
156
188
|
specification_version: 4
|
|
157
189
|
summary: Develop, Decorate and manage Dependencies for C (GNU) Makefiles easily with
|
|
158
|
-
|
|
190
|
+
Ruby.
|
|
159
191
|
test_files: []
|
|
Binary file
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
3
|
-
smart_alloc.h -- *Full Library* Header File
|
|
4
|
-
|
|
5
|
-
For smart alloc
|
|
6
|
-
|
|
7
|
-
See the end of this file for an example.
|
|
8
|
-
|
|
9
|
-
Public Functions:
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
#ifndef SMART_ALLOC_H_Minaswan /* Prevent multiple inclusions */
|
|
14
|
-
#define SMART_ALLOC_H_Minaswan
|
|
15
|
-
#ifndef TYPEDEFS_H_Minaswan /* Header guard for typedefs.h */
|
|
16
|
-
#define TYPEDEFS_H_Minaswan
|
|
17
|
-
|
|
18
|
-
#endif /* TYPEDEFS_H_Minaswan */
|
|
19
|
-
|
|
20
|
-
struct smart_alloc_data_s {
|
|
21
|
-
struct smart_alloc_data_s *next;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
struct smart_alloc_s {
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/* Public Functions */
|
|
28
|
-
|
|
29
|
-
#ifdef SMART_ALLOC_IMPLEMENTATION
|
|
30
|
-
|
|
31
|
-
#endif /* SMART_ALLOC_IMPLEMENTATION */
|
|
32
|
-
#endif /* SMART_ALLOC_H_Minaswan */
|
|
33
|
-
|
|
34
|
-
/*
|
|
35
|
-
Example:
|
|
36
|
-
|
|
37
|
-
#define SMART_ALLOC_IMPLEMENTATION
|
|
38
|
-
#include "smart_alloc.h"
|
|
39
|
-
|
|
40
|
-
i32 arena = smart_alloc_create(0);
|
|
41
|
-
|
|
42
|
-
smart_alloc(arena, size, align)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
*/
|