demake 0.2.1 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dc09a132635560049c925c2abcdff0afc64a4e60b03de5f26da26ada3f2e084
4
- data.tar.gz: 5742dfdd893a1fefc6e7d559b68227bc4f8009d11aa512f80872b3591043a3f0
3
+ metadata.gz: 5c2a824e423f1590b984cd455c1cc798423b7739d2f2d6136c8cd5d2027e5504
4
+ data.tar.gz: a45262cbd164127e71c834a185dc133298de0c5b5916cac8a266d80df8d0786e
5
5
  SHA512:
6
- metadata.gz: 8ecb2ab96a2e9e486d090e9f1e47ec16de7c91ad4b0f5ae4238b82c951d7a0cfe749fa61f03a0e6c03e5ac9711579d92e29788dfe06411eaba6cf054603c7e6b
7
- data.tar.gz: 3d8264dae828999e98a93b6816dd9b16ebbbc466bb67fc91ca2d3d61e044ab1df4aa44cb5dec584e59d98361579828ca8c452d2353ef63fee1d398f8739433e6
6
+ metadata.gz: 9428832c08f525f34bb06e1a050311ddbf9a5188da8bc7d383b5c95728c9650a4babe3bb45d2aaf59c9a552485dd30c77882b103a5ecac756c5c268306d6664d
7
+ data.tar.gz: f8de83f44ec206fb9d6cec6e3735c36c7e10337a945e13f7be5266b986a052f8e8989e5147fefea33adc852caeba24236e74d2cc11dc63110a221ac631196383
data/bin/demake CHANGED
@@ -6,7 +6,7 @@
6
6
  require 'rbconfig' # Needed by older versions of Ruby
7
7
  require 'pipetext'
8
8
 
9
- demake_version = "0.2.1"
9
+ demake_version = "0.2.3"
10
10
 
11
11
  @silent = false
12
12
  @compiler = "gcc"
@@ -30,8 +30,10 @@ SHORT_WIDTH = BOX_WIDTH - 8
30
30
  # Contains code, does not get touched
31
31
  @source_directory = "src"
32
32
 
33
- # These get completely blown away with make clean
33
+ # These can get completely blown away with make clean
34
+ @clean_includes_binary_directory = false
34
35
  @binary_directory = "bin"
36
+ @clean_includes_library_directory = false
35
37
  @library_directory = "lib"
36
38
  @object_directory = "obj"
37
39
 
@@ -121,7 +123,6 @@ end
121
123
  @lib_apps = File.join(File.expand_path("../..", __FILE__), "lib", "apps")
122
124
  @lib_dir = File.join(File.expand_path("../..", __FILE__), "lib")
123
125
  @available_apps = Array.new
124
-
125
126
  Dir.entries(@lib_apps).each do |e|
126
127
  if(e != '.' && e != '..')
127
128
  @available_apps << e
@@ -149,7 +150,7 @@ def file_open_read_close(filename, notify_warning=true)
149
150
  notify("|YWARNING|n: #{$!.to_s.sub(/@ rb_[a-zA-Z_]* /, '')}")
150
151
  end
151
152
  end
152
- return(data)
153
+ return data
153
154
  end
154
155
 
155
156
  def copy_template(filename)
@@ -173,32 +174,102 @@ def copy_template(filename)
173
174
  exit!
174
175
  end
175
176
  else
176
- data = file_open_read_close(filename)
177
+ # data = file_open_read_close(filename)
177
178
  new_name = filename.sub(/^#{@lib_apps}./, '')
178
179
  file_open_write_close(new_name, file_open_read_close(filename))
179
180
  notify("#{@emoji_success} Created file: |y#{new_name}|n |[page facing up]\n")
180
181
  end
181
182
  end
182
183
 
183
- @found_application = nil
184
- @suggestion = String.new
185
- @available_apps.sort.each do |app|
186
- if(ARGV[0] =~ /^#{app}$/)
187
- if(File.directory?(app) == true)
188
- notify("\n#{@emoji_fail}|RError|n: |Ydirectory #{app} |Ralready exists, aborting creation|n\n\n" +
189
- "Delete the directory and try again if you wish to recreate it.\n\n")
190
- exit!
184
+ def create_new_application(new_name)
185
+ begin
186
+ if(File.directory?(new_name) != true)
187
+ Dir.mkdir(new_name)
188
+ notify("#{@emoji_success} Created directory: |g#{new_name}|n |[open file folder]\n")
189
+ end
190
+ if(File.directory?(new_name + "/demake") != true)
191
+ Dir.mkdir(new_name + "/demake")
192
+ notify("#{@emoji_success} Created directory: |g#{new_name}/demake|n |[open file folder]\n")
193
+ end
194
+ begin
195
+ File.open("#{new_name}/demake/applications", 'w') do |f|
196
+ f.write("#{new_name}\n")
197
+ end
198
+ notify("#{@emoji_success} Created file: |y#{new_name}/demake/applications|n |[page facing up]\n")
199
+ rescue
200
+ notify("|RError|n: #{$!}")
191
201
  end
192
- @found_application = app
193
- copy_template(File.join(@lib_apps, app))
202
+ file_open_write_close(new_name + "/demake/settings.rb", file_open_read_close(@lib_apps + "/example/demake/settings.rb"))
203
+ notify("#{@emoji_success} Created file: |y#{new_name}/demake/settings.rb|n |[page facing up]\n")
204
+ file_open_write_close(new_name + "/demake/license", file_open_read_close(@lib_apps + "/example/demake/license"))
205
+ notify("#{@emoji_success} Created file: |y#{new_name}/demake/license|n |[page facing up]\n")
194
206
  begin
195
- File.open(File.join(@lib_apps, app, 'demake', 'suggestion'), 'r') do |f|
196
- @suggestion = f.read.chomp
207
+ File.open("#{new_name}/demake/test-target.rb", 'w') do |f|
208
+ f.write("test_targets = <<-END_OF_STRING\n")
209
+ f.write("\t@echo\n\t@echo \"|YTesting command:|n\"\n\tbin/#{new_name}\n")
210
+ f.write("END_OF_STRING\n")
211
+ f.write("test_target << test_targets\n")
197
212
  end
213
+ notify("#{@emoji_success} Created file: |y#{new_name}/demake/test-target.rb|n |[page facing up]\n")
198
214
  rescue
215
+ notify("|RError|n: #{$!}")
216
+ end
217
+ if(File.directory?(new_name + "/src") != true)
218
+ Dir.mkdir(new_name + "/src")
219
+ notify("#{@emoji_success} Created directory: |g#{new_name}/src|n |[open file folder]\n")
220
+ end
221
+ file_open_write_close(new_name + "/src/typedefs.h", file_open_read_close(@lib_data + "/libsrc/typedefs.h"))
222
+ file_open_write_close(new_name + "/src/defines.h", file_open_read_close(@lib_data + "/libsrc/defines.h"))
223
+ file_open_write_close(new_name + "/src/base.h", file_open_read_close(@lib_data + "/libsrc/base.h"))
224
+ begin
225
+ File.open("#{new_name}/src/#{new_name}.c", 'w') do |f|
226
+ f.write("/*\n\n #{new_name}.c - #{new_name} main application entry point\n\n*/\n\n" +
227
+ "#include <stdio.h>\n\n#include \"base.h\"\n\n" +
228
+ "i32 main(i32 argc, c8 *argv[]) {\n printf(\"Hello, world!\\n\");\n return 0;\n}\n")
229
+ end
230
+ notify("#{@emoji_success} Created file: |y#{new_name}/src/#{new_name}.c|n |[page facing up]\n")
231
+ rescue
232
+ notify("|RError|n: #{$!}")
233
+ end
234
+ rescue Errno::EACCES
235
+ notify("|RError|n: #{$!.to_s.sub(/@ dir_s_mkdir /, '')}")
236
+ exit!
237
+ rescue
238
+ notify("|RError|n: #{$!}")
239
+ end
240
+ end
241
+
242
+ @found_application = nil
243
+ @suggestion = String.new
244
+
245
+ if(ARGV[0] =~ /^new/)
246
+ if(ARGV[1] == nil || ARGV[1] == "")
247
+ notify("\n#{@emoji_fail}|RError|n: |Ynew application name |Rrequired|n.\n\n");
248
+ exit!
249
+ end
250
+ @found_application = "new"
251
+ create_new_application(ARGV[1])
252
+ Dir.chdir(ARGV[1])
253
+ @working_directory = Dir.pwd
254
+ else
255
+ @available_apps.sort.each do |app|
256
+ if(ARGV[0] =~ /^#{app}$/)
257
+ if(File.directory?(app) == true)
258
+ notify("\n#{@emoji_fail}|RError|n: |Ydirectory #{app} |Ralready exists, aborting creation|n\n\n" +
259
+ "Delete the directory and try again if you wish to recreate it.\n\n")
260
+ exit!
261
+ end
262
+ @found_application = app
263
+ copy_template(File.join(@lib_apps, app))
264
+ begin
265
+ File.open(File.join(@lib_apps, app, 'demake', 'suggestion'), 'r') do |f|
266
+ @suggestion = f.read.chomp
267
+ end
268
+ rescue
269
+ end
270
+ Dir.chdir(app)
271
+ @working_directory = Dir.pwd
199
272
  end
200
- Dir.chdir(app)
201
- @working_directory = Dir.pwd
202
273
  end
203
274
  end
204
275
 
@@ -215,6 +286,8 @@ if(need_help == true)
215
286
  program = File.basename($0)
216
287
  COLUMN_WIDTH = 20
217
288
  syntax = "|]#{COLUMN_WIDTH}Command syntax:\n\n" + "|y#{program}|n|; - Create or update Makefile\n"
289
+ syntax << "|y#{program} ?|n|; - View this help information\n"
290
+ syntax << "|y#{program} new <name>|n|; - Create new application\n"
218
291
  @available_apps.sort.each do |app|
219
292
  data = String.new
220
293
  begin
@@ -229,6 +302,7 @@ if(need_help == true)
229
302
  syntax << "|y#{program} #{app}|n\n"
230
303
  end
231
304
  end
305
+ syntax << "\nVersion: |c#{demake_version}|n\n"
232
306
  notify(syntax + "\n")
233
307
  exit!
234
308
  end
@@ -963,9 +1037,14 @@ end
963
1037
 
964
1038
  if(@found_application != nil)
965
1039
  File.open('Makefile', 'w').write(@output)
966
- notify("#{@emoji_success} Created file: |y#{@found_application}/Makefile|n |[page facing up]\n\n")
967
- if(@suggestion != "")
968
- notify("Suggestion: |C#{@suggestion}|n\n")
1040
+ if(@found_application == "new")
1041
+ notify("#{@emoji_success} Created file: |y#{ARGV[1]}/Makefile|n |[page facing up]\n\n")
1042
+ notify("Suggestion: |Ccd #{ARGV[1]} ; make ; make build ; make test|n\n")
1043
+ else
1044
+ notify("#{@emoji_success} Created file: |y#{@found_application}/Makefile|n |[page facing up]\n\n")
1045
+ if(@suggestion != "")
1046
+ notify("Suggestion: |C#{@suggestion}|n\n")
1047
+ end
969
1048
  end
970
1049
  Dir.chdir('..')
971
1050
  else
@@ -1,5 +1,5 @@
1
1
  #
2
- # Makefile automatically generated by Ruby Gem - demake 0.2.0
2
+ # Makefile automatically generated by Ruby Gem - demake 0.2.2
3
3
  #
4
4
  MAKE += -j 8
5
5
  CC = gcc
@@ -146,8 +146,8 @@ menu : LICENSE
146
146
  @echo "║ Build Executable: bin/hello ║"
147
147
  @echo "║ Build Executable: bin/goodbye ║"
148
148
  @echo "╠═════════════════════════════════════════════════════════════════════════╣"
149
- @echo "║ Debug Executable: bin/hello_debug ║"
150
- @echo "║ Debug Executable: bin/goodbye_debug ║"
149
+ @echo "║ Debug Executable: bin/hello_debug ║"
150
+ @echo "║ Debug Executable: bin/goodbye_debug ║"
151
151
  @echo "╠═════════════════════════════════════════════════════════════════════════╣"
152
152
  @echo "║ Install Binary Directory: /usr/local/bin/ ║"
153
153
  @echo "║ Install Library Directory: /usr/local/lib/ ║"
@@ -192,7 +192,7 @@ else
192
192
  endif
193
193
  $(CC) $(BUILD_FLAGS) $(LIBS) -c $(SOURCE)/string/string.c -o $(OBJECT)/string/string.o
194
194
  # Dependencies for debug
195
- #$(OBJECT)/string/string_debug.o : BUILD_FLAGS := $(DEBUG_FLAGS) $(CFLAGS)
195
+ # $(OBJECT)/string/string_debug.o : BUILD_FLAGS := $(DEBUG_FLAGS) $(CFLAGS)
196
196
  #
197
197
  $(OBJECT)/string/string_debug.o : $(SOURCE)/string/string.c \
198
198
  $(SOURCE)/string/string.h
@@ -205,50 +205,50 @@ endif
205
205
  $(CC) $(BUILD_FLAGS) $(LIBS) -c $(SOURCE)/string/string.c -o $(OBJECT)/string/string_debug.o
206
206
 
207
207
  # Dependencies
208
- $(OBJECT)/hello.o : $(SOURCE)/hello.c \
208
+ $(OBJECT)/goodbye.o : $(SOURCE)/goodbye.c \
209
209
  $(SOURCE)/string/string.h
210
- @echo "║ 🛠 Compiling... $(OBJECT)/hello.o"
210
+ @echo "║ 🛠 Compiling... $(OBJECT)/goodbye.o"
211
211
  ifeq '$(OS)' 'Windows_NT'
212
212
  @test -d $(OBJECT)/ || mkdir $(OBJECT)/
213
213
  else
214
214
  @mkdir -p $(OBJECT)/
215
215
  endif
216
- $(CC) $(BUILD_FLAGS) $(LIBS) -c $(SOURCE)/hello.c -o $(OBJECT)/hello.o
216
+ $(CC) $(BUILD_FLAGS) $(LIBS) -c $(SOURCE)/goodbye.c -o $(OBJECT)/goodbye.o
217
217
  # Dependencies for debug
218
- #$(OBJECT)/hello_debug.o : BUILD_FLAGS := $(DEBUG_FLAGS) $(CFLAGS)
218
+ # $(OBJECT)/goodbye_debug.o : BUILD_FLAGS := $(DEBUG_FLAGS) $(CFLAGS)
219
219
  #
220
- $(OBJECT)/hello_debug.o : $(SOURCE)/hello.c \
220
+ $(OBJECT)/goodbye_debug.o : $(SOURCE)/goodbye.c \
221
221
  $(SOURCE)/string/string.h
222
- @echo "║ 🐛 🛠 Compiling... $(OBJECT)/hello_debug.o"
222
+ @echo "║ 🐛 🛠 Compiling... $(OBJECT)/goodbye_debug.o"
223
223
  ifeq '$(OS)' 'Windows_NT'
224
224
  @test -d $(OBJECT)/ || mkdir $(OBJECT)/
225
225
  else
226
226
  @mkdir -p $(OBJECT)/
227
227
  endif
228
- $(CC) $(BUILD_FLAGS) $(LIBS) -c $(SOURCE)/hello.c -o $(OBJECT)/hello_debug.o
228
+ $(CC) $(BUILD_FLAGS) $(LIBS) -c $(SOURCE)/goodbye.c -o $(OBJECT)/goodbye_debug.o
229
229
 
230
230
  # Dependencies
231
- $(OBJECT)/goodbye.o : $(SOURCE)/goodbye.c \
231
+ $(OBJECT)/hello.o : $(SOURCE)/hello.c \
232
232
  $(SOURCE)/string/string.h
233
- @echo "║ 🛠 Compiling... $(OBJECT)/goodbye.o"
233
+ @echo "║ 🛠 Compiling... $(OBJECT)/hello.o"
234
234
  ifeq '$(OS)' 'Windows_NT'
235
235
  @test -d $(OBJECT)/ || mkdir $(OBJECT)/
236
236
  else
237
237
  @mkdir -p $(OBJECT)/
238
238
  endif
239
- $(CC) $(BUILD_FLAGS) $(LIBS) -c $(SOURCE)/goodbye.c -o $(OBJECT)/goodbye.o
239
+ $(CC) $(BUILD_FLAGS) $(LIBS) -c $(SOURCE)/hello.c -o $(OBJECT)/hello.o
240
240
  # Dependencies for debug
241
- #$(OBJECT)/goodbye_debug.o : BUILD_FLAGS := $(DEBUG_FLAGS) $(CFLAGS)
241
+ # $(OBJECT)/hello_debug.o : BUILD_FLAGS := $(DEBUG_FLAGS) $(CFLAGS)
242
242
  #
243
- $(OBJECT)/goodbye_debug.o : $(SOURCE)/goodbye.c \
243
+ $(OBJECT)/hello_debug.o : $(SOURCE)/hello.c \
244
244
  $(SOURCE)/string/string.h
245
- @echo "║ 🐛 🛠 Compiling... $(OBJECT)/goodbye_debug.o"
245
+ @echo "║ 🐛 🛠 Compiling... $(OBJECT)/hello_debug.o"
246
246
  ifeq '$(OS)' 'Windows_NT'
247
247
  @test -d $(OBJECT)/ || mkdir $(OBJECT)/
248
248
  else
249
249
  @mkdir -p $(OBJECT)/
250
250
  endif
251
- $(CC) $(BUILD_FLAGS) $(LIBS) -c $(SOURCE)/goodbye.c -o $(OBJECT)/goodbye_debug.o
251
+ $(CC) $(BUILD_FLAGS) $(LIBS) -c $(SOURCE)/hello.c -o $(OBJECT)/hello_debug.o
252
252
 
253
253
  $(BINARY)/hello : BUILD_FLAGS := $(OFLAGS) $(CFLAGS) $(LDFLAGS)
254
254
 
@@ -280,7 +280,7 @@ $(BINARY)/hello_debug : BUILD_FLAGS := $(DEBUG_FLAGS) $(CFLAGS) $(LDFLAGS)
280
280
 
281
281
  $(BINARY)/hello_debug : LICENSE $(DOL1)
282
282
  @echo "╔═════════════════════════════════════════════════════════════════════════╗"
283
- @echo "║ 🐛 🔗 Linking Files... bin/hello_debug ║"
283
+ @echo "║ 🐛 🔗 Linking Files... bin/hello_debug ║"
284
284
  @echo "╚═════════════════════════════════════════════════════════════════════════╝"
285
285
  ifeq '$(OS)' 'Windows_NT'
286
286
  @test -d $(BINARY) || mkdir $(BINARY)
@@ -293,7 +293,7 @@ $(BINARY)/goodbye_debug : BUILD_FLAGS := $(DEBUG_FLAGS) $(CFLAGS) $(LDFLAGS)
293
293
 
294
294
  $(BINARY)/goodbye_debug : LICENSE $(DOL2)
295
295
  @echo "╔═════════════════════════════════════════════════════════════════════════╗"
296
- @echo "║ 🐛 🔗 Linking Files... bin/goodbye_debug ║"
296
+ @echo "║ 🐛 🔗 Linking Files... bin/goodbye_debug ║"
297
297
  @echo "╚═════════════════════════════════════════════════════════════════════════╝"
298
298
  ifeq '$(OS)' 'Windows_NT'
299
299
  @test -d $(BINARY) || mkdir $(BINARY)
@@ -314,7 +314,7 @@ else
314
314
  endif
315
315
  $(CC) $(BUILD_FLAGS) $(LIBS) -c $< -o $@
316
316
  # General Auto-Dependencies for debug
317
- #$(OBJECT)/%_debug.o : BUILD_FLAGS := $(DEBUG_FLAGS) $(CFLAGS)
317
+ # $(OBJECT)/%_debug.o : BUILD_FLAGS := $(DEBUG_FLAGS) $(CFLAGS)
318
318
  #
319
319
  $(OBJECT)/%_debug.o : $(SOURCE)/%.c
320
320
  @echo "║ 🐛 🛠 Compiling... $(@)"
@@ -329,17 +329,17 @@ endif
329
329
 
330
330
  .PHONY : clean
331
331
  clean :
332
- @echo "🔥 Removed everything from $(OBJECT), $(BINARY), and $(LIBRARY) directories"
333
- @rm -rf $(OBJECT) $(BINARY) $(LIBRARY)
332
+ @echo "🔥 Removed everything from $(OBJECT) directory"
333
+ @rm -rf $(OBJECT)
334
334
 
335
335
  .PHONY : debug
336
336
  debug : LICENSE
337
337
  @echo "╔═════════════════════════════════════════════════════════════════════════╗"
338
- @echo "║ 🐛 🚧 Building executable: bin/hello_debug ║"
338
+ @echo "║ 🐛 🚧 Building executable: bin/hello_debug ║"
339
339
  @echo "╚═════════════════════════════════════════════════════════════════════════╝"
340
340
  @$(MAKE) $(BINARY)/hello_debug
341
341
  @echo "╔═════════════════════════════════════════════════════════════════════════╗"
342
- @echo "║ 🐛 🚧 Building executable: bin/goodbye_debug ║"
342
+ @echo "║ 🐛 🚧 Building executable: bin/goodbye_debug ║"
343
343
  @echo "╚═════════════════════════════════════════════════════════════════════════╝"
344
344
  @$(MAKE) $(BINARY)/goodbye_debug
345
345
 
@@ -12,10 +12,13 @@
12
12
  #
13
13
  #@source_directory = "source" # "src"
14
14
  #
15
- # ** make clean deletes all files in these directories **
15
+ # ** make clean can delete all files in these directories **
16
16
  #
17
+ #@clean_includes_binary_directory = false
17
18
  #@binary_directory = "binary" # "bin"
19
+ #@clean_includes_library_directory = false
18
20
  #@library_directory = "library" # "lib"
21
+ # By default only object is cleaned
19
22
  #@object_directory = "object" # "obj"
20
23
  #
21
24
  #@emojis = false # true
@@ -1,5 +1,5 @@
1
1
  #
2
- # Makefile automatically generated by Ruby Gem - demake 0.2.0
2
+ # Makefile automatically generated by Ruby Gem - demake 0.2.2
3
3
  #
4
4
  MAKE += -j 8
5
5
  CC = gcc
@@ -222,8 +222,8 @@ endif
222
222
 
223
223
  .PHONY : clean
224
224
  clean :
225
- @echo "🔥 Removed everything from $(OBJECT), $(BINARY), and $(LIBRARY) directories"
226
- @rm -rf $(OBJECT) $(BINARY) $(LIBRARY)
225
+ @echo "🔥 Removed everything from $(OBJECT) directory"
226
+ @rm -rf $(OBJECT)
227
227
 
228
228
  .PHONY : debug
229
229
  debug : LICENSE
@@ -12,11 +12,14 @@
12
12
  #
13
13
  #@source_directory = "source" # "src"
14
14
  #
15
- # ** make clean deletes all files in these directories **
15
+ # ** make clean can delete all files in these directories **
16
16
  #
17
- #@binary_directory = "binary" # "bin"
18
- #@library_directory = "library" # "lib"
19
- #@object_directory = "object" # "obj"
17
+ #@clean_includes_binary_directory = false
18
+ #@binary_directory = "binary" # "bin"
19
+ #@clean_includes_library_directory = false
20
+ #@library_directory = "library" # "lib"
21
+ # By default only object is cleaned
22
+ #@object_directory = "object" # "obj"
20
23
  #
21
24
  #@emojis = false # true
22
25
  #@replace_with = "|b*|n" # "|mo|n"
File without changes
Binary file
@@ -0,0 +1,36 @@
1
+ #include <stdio.h>
2
+ #include <stdlib.h>
3
+
4
+ #include "base.h"
5
+ #define SIMPLE_DOUBLE_LINKED_LIST
6
+ #define SIMPLE_LINKED_LIST_IMPLEMENTATION
7
+ #include "simple_linked_list.h"
8
+
9
+ i32 main(i32 argc, c8 *argv[])
10
+ {
11
+ struct simple_linked_list_s *head = NULL, *tail = NULL, *s = NULL;
12
+ c8 *a = "a", *b = "b", *c = "c", *d = "d", *e = "e", *f = "f";
13
+
14
+ head = s = calloc(1, sizeof(struct simple_linked_list_s));
15
+ simple_linked_list_init(s, a);
16
+ tail = s = calloc(1, sizeof(struct simple_linked_list_s));
17
+ simple_linked_list_insert_after(head, s, b);
18
+ s = calloc(1, sizeof(struct simple_linked_list_s));
19
+ simple_linked_list_insert_after(tail, s, c);
20
+ tail = s;
21
+ s = calloc(1, sizeof(struct simple_linked_list_s));
22
+ simple_linked_list_insert_after(tail, s, f);
23
+ tail = s;
24
+ s = calloc(1, sizeof(struct simple_linked_list_s));
25
+ simple_linked_list_insert_before(tail, s, e);
26
+ tail = s;
27
+ s = calloc(1, sizeof(struct simple_linked_list_s));
28
+ simple_linked_list_insert_before(tail, s, d);
29
+
30
+ s = head;
31
+ while(s) {
32
+ if(s && s->value && s->value != NULL)
33
+ printf("%s\n", (u8 *)s->value);
34
+ s = s->next;
35
+ }
36
+ }
@@ -0,0 +1,91 @@
1
+ /*
2
+
3
+ simple_linked_list.h -- *Full Library* Header File
4
+
5
+ Used to create simple linked lists
6
+
7
+ See the end of this file for an example.
8
+
9
+ Public Functions:
10
+
11
+ */
12
+
13
+ #ifndef SIMPLE_LINKED_LIST_H_Minaswan /* Prevent multiple inclusions */
14
+ #define SIMPLE_LINKED_LIST_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 simple_linked_list_s {
21
+ struct simple_linked_list_s *next;
22
+ #ifdef SIMPLE_DOUBLE_LINKED_LIST
23
+ struct simple_linked_list_s *previous;
24
+ #endif
25
+ void *value;
26
+ };
27
+
28
+ /* Public Functions */
29
+
30
+ #ifdef SIMPLE_LINKED_LIST_IMPLEMENTATION
31
+ void simple_linked_list_init(struct simple_linked_list_s *s, void *value)
32
+ {
33
+ #ifdef SIMPLE_DOUBLE_LINKED_LIST
34
+ s->previous = s->next = NULL;
35
+ #endif
36
+ s->value = value;
37
+ }
38
+
39
+ void simple_linked_list_insert_after(struct simple_linked_list_s *position,
40
+ struct simple_linked_list_s *s, void *value)
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
+ }
51
+
52
+ void simple_linked_list_insert_before(struct simple_linked_list_s *position,
53
+ struct simple_linked_list_s *s, void *value)
54
+ {
55
+ s->value = value;
56
+ s->next = position;
57
+ #ifdef SIMPLE_DOUBLE_LINKED_LIST
58
+ s->previous = position->previous;
59
+ if(position->previous != NULL)
60
+ position->previous->next = s;
61
+ position->previous = s;
62
+ #endif
63
+ }
64
+
65
+ #ifdef SIMPLE_DOUBLE_LINKED_LIST
66
+ void simple_linked_list_remove(struct simple_linked_list_s *s)
67
+ {
68
+ if(s->previous)
69
+ s->previous->next = s->next;
70
+ if(s->next)
71
+ s->next->previous = s->previous;
72
+ s->previous = s->next = NULL;
73
+ }
74
+ #endif
75
+
76
+ #endif /* SIMPLE_LINKED_LIST_IMPLEMENTATION */
77
+ #endif /* SIMPLE_LINKED_LIST_H_Minaswan */
78
+
79
+ /*
80
+ Example:
81
+
82
+ #define SIMPLE_LINKED_LIST_IMPLEMENTATION
83
+ #include "simple_linked_list.h"
84
+
85
+ struct simple_linked_list_s s;
86
+ c8 *a = "a", *b = "b", *c = "c";
87
+
88
+ simple_linked_list_init(&s, a);
89
+
90
+
91
+ */
@@ -0,0 +1,45 @@
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
+ */
@@ -1,6 +1,30 @@
1
- @clean_target = <<-END_OF_STRING
1
+ # defaults to only removing the object directory
2
+ if(@clean_includes_binary_directory == true && @clean_includes_library_directory == true)
3
+ @clean_target = <<-END_OF_STRING
2
4
  .PHONY : clean
3
5
  clean :
4
6
  \t@echo "#{@emoji_clean} Removed |Yeverything|n from |R$(OBJECT)|n, |R$(BINARY)|n, and |R$(LIBRARY)|n directories"
5
7
  \t@rm -rf $(OBJECT) $(BINARY) $(LIBRARY)
6
8
  END_OF_STRING
9
+ elsif(@clean_includes_binary_directory == true)
10
+ @clean_target = <<-END_OF_STRING
11
+ .PHONY : clean
12
+ clean :
13
+ \t@echo "#{@emoji_clean} Removed |Yeverything|n from |R$(OBJECT)|n and |R$(BINARY)|n directories"
14
+ \t@rm -rf $(OBJECT) $(BINARY) $(LIBRARY)
15
+ END_OF_STRING
16
+ elsif(@clean_includes_library_directory == true)
17
+ @clean_target = <<-END_OF_STRING
18
+ .PHONY : clean
19
+ clean :
20
+ \t@echo "#{@emoji_clean} Removed |Yeverything|n from |R$(OBJECT)|n and |R$(LIBRARY)|n directories"
21
+ \t@rm -rf $(OBJECT) $(BINARY) $(LIBRARY)
22
+ END_OF_STRING
23
+ else
24
+ @clean_target = <<-END_OF_STRING
25
+ .PHONY : clean
26
+ clean :
27
+ \t@echo "#{@emoji_clean} Removed |Yeverything|n from |R$(OBJECT)|n directory"
28
+ \t@rm -rf $(OBJECT)
29
+ END_OF_STRING
30
+ 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.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minaswan Nakamoto
@@ -36,6 +36,31 @@ description: |
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
+ Version: 0.2.3
52
+
53
+ To create a new application:
54
+
55
+ > demake new <name>
56
+
57
+ This will create a new directory and basic files for a new C application.
58
+
59
+ To create or update a GNU Makefile on an existing demake application,
60
+ execute without arguments:
61
+
62
+ > demake
63
+
39
64
  To create an example with multiple sample applications:
40
65
 
41
66
  > demake example
@@ -61,10 +86,6 @@ description: |
61
86
  demake/settings.rb, demake/test-target.rb, demake/install-target.rb,
62
87
  demake/license
63
88
 
64
- The output of the command by itself is a (GNU style) file named Makefile:
65
-
66
- > demake
67
-
68
89
  You can also clone from git:
69
90
 
70
91
  > git clone https://github.com/MinaswanNakamoto/demake.git
@@ -115,6 +136,10 @@ files:
115
136
  - lib/data/libsrc/fast_sha2.h
116
137
  - lib/data/libsrc/parse_arguments.h
117
138
  - lib/data/libsrc/rb_library.c
139
+ - lib/data/libsrc/simple_linked_list
140
+ - lib/data/libsrc/simple_linked_list.c
141
+ - lib/data/libsrc/simple_linked_list.h
142
+ - lib/data/libsrc/smart_alloc.h
118
143
  - lib/data/libsrc/typedefs.h
119
144
  - lib/template/build_target.rb
120
145
  - lib/template/clean_target.rb
@@ -148,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
173
  - !ruby/object:Gem::Version
149
174
  version: '0'
150
175
  requirements: []
151
- rubygems_version: 4.0.6
176
+ rubygems_version: 4.0.10
152
177
  specification_version: 4
153
178
  summary: Develop, Decorate and manage Dependencies for C (GNU) Makefiles easily with
154
179
  a Ruby script.