demake 0.2.0 → 0.2.1

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/bin/demake +163 -176
  3. data/lib/apps/example/Makefile +374 -0
  4. data/lib/{data → apps}/example/demake/applications +1 -1
  5. data/lib/apps/example/demake/brief_description +1 -0
  6. data/lib/{data → apps}/example/demake/license +0 -0
  7. data/lib/{data → apps}/example/demake/settings.rb +14 -14
  8. data/lib/apps/example/demake/suggestion +1 -0
  9. data/lib/{data → apps}/example/demake/test-target.rb +0 -0
  10. data/lib/{data → apps}/example/src/goodbye.c +0 -0
  11. data/lib/{data → apps}/example/src/hello.c +0 -0
  12. data/lib/{data → apps}/example/src/string/string.c +0 -0
  13. data/lib/{data → apps}/example/src/string/string.h +0 -0
  14. data/lib/apps/oreo/Makefile +260 -0
  15. data/lib/{data → apps}/oreo/demake/applications +0 -0
  16. data/lib/apps/oreo/demake/brief_description +1 -0
  17. data/lib/{data → apps}/oreo/demake/license +0 -0
  18. data/lib/{data → apps}/oreo/demake/settings.rb +13 -13
  19. data/lib/apps/oreo/demake/suggestion +1 -0
  20. data/lib/{data → apps}/oreo/demake/test-target.rb +0 -0
  21. data/lib/apps/oreo/src/defines.h +29 -0
  22. data/lib/{data → apps}/oreo/src/fast_read_file.h +18 -18
  23. data/lib/{data → apps}/oreo/src/oreo.c +4 -4
  24. data/lib/{data → apps}/oreo/src/typedefs.h +8 -8
  25. data/lib/data/libsrc/auto_bits.h +33 -0
  26. data/lib/data/libsrc/base.h +10 -0
  27. data/lib/data/libsrc/cpu_mark_check.h +267 -0
  28. data/lib/data/libsrc/defines.h +29 -0
  29. data/lib/data/libsrc/fast_read_file.h +259 -0
  30. data/lib/data/libsrc/fast_sha2.h +1840 -0
  31. data/lib/data/libsrc/parse_arguments.h +0 -0
  32. data/lib/data/libsrc/rb_library.c +140 -0
  33. data/lib/data/libsrc/typedefs.h +61 -0
  34. data/lib/template/build_target.rb +0 -0
  35. data/lib/template/clean_target.rb +0 -0
  36. data/lib/template/debug_executable_target.rb +0 -0
  37. data/lib/template/debug_library_target.rb +0 -0
  38. data/lib/template/debug_target.rb +0 -0
  39. data/lib/template/dependency_targets.rb +0 -0
  40. data/lib/template/executable_debug_target.rb +0 -0
  41. data/lib/template/executable_target.rb +0 -0
  42. data/lib/template/generic_dependency_targets.rb +0 -0
  43. data/lib/template/library_debug_target.rb +0 -0
  44. data/lib/template/library_target.rb +0 -0
  45. data/lib/template/license_target.rb +0 -0
  46. data/lib/template/link_library_target.rb +0 -0
  47. data/lib/template/strip_build.rb +0 -0
  48. metadata +35 -20
  49. data/lib/data/oreo/src/defines.h +0 -29
  50. /data/lib/{data → apps}/oreo/oreo_test.txt +0 -0
Binary file
@@ -0,0 +1,140 @@
1
+ #include <ruby.h>
2
+
3
+ /* b8 */
4
+
5
+ static VALUE rb_b8(VALUE self, VALUE rb_value) {
6
+ b8 c_value = FALSE;
7
+ /* Ruby value to C */
8
+ b8 rb_b8 = RTEST(rb_value);
9
+
10
+ /* Gets rid of compiler warning */
11
+ if(!self)
12
+ return Qnil;
13
+
14
+ /* C value to Ruby */
15
+ return(c_value ? Qtrue : Qfalse);
16
+ }
17
+
18
+ /* i32 */
19
+
20
+ static VALUE rb_i32(VALUE self, VALUE rb_value) {
21
+ i32 c_value = 0;
22
+ /* Ruby value to C */
23
+ i32 rb_i32 = (i32)NUM2LONG(rb_value);
24
+
25
+ /* Gets rid of compiler warning */
26
+ if(!self)
27
+ return Qnil;
28
+
29
+ /* C value to Ruby */
30
+ return(INT2NUM(c_value));
31
+ }
32
+
33
+ /* u32 */
34
+
35
+ static VALUE rb_u32(VALUE self, VALUE rb_value) {
36
+ u32 c_value = 0;
37
+ /* Ruby value to C */
38
+ u32 rb_u32 = (u32)NUM2ULONG(rb_value);
39
+
40
+ /* Gets rid of compiler warning */
41
+ if(!self)
42
+ return Qnil;
43
+
44
+ /* C value to Ruby */
45
+ return(ULONG2NUM(c_value));
46
+ }
47
+
48
+ /* i64 */
49
+
50
+ static VALUE rb_i64(VALUE self, VALUE rb_value) {
51
+ i64 c_value = 0;
52
+ /* Ruby value to C */
53
+ i64 rb_i64 = (i64)NUM2LL(rb_value);
54
+
55
+ /* Gets rid of compiler warning */
56
+ if(!self)
57
+ return Qnil;
58
+
59
+ /* C value to Ruby */
60
+ return(LL2NUM(c_value));
61
+ }
62
+
63
+ /* u64 */
64
+
65
+ static VALUE rb_u64(VALUE self, VALUE rb_value) {
66
+ u64 c_value = 0;
67
+ /* Ruby value to C */
68
+ u64 rb_u64 = (u64)NUM2ULL(rb_value);
69
+
70
+ /* Gets rid of compiler warning */
71
+ if(!self)
72
+ return Qnil;
73
+
74
+ /* C value to Ruby */
75
+ return(ULL2NUM(c_value));
76
+ }
77
+
78
+ static VALUE rb_string(VALUE self, VALUE rb_message) {
79
+ const c8 c_value = "string";
80
+ /* Ruby value to C */
81
+ uc8 *rb_string = (uc8 *)RSTRING_PTR(rb_message);
82
+
83
+ /* Gets rid of compiler warning */
84
+ if(!self)
85
+ return Qnil;
86
+
87
+ /* C value to Ruby */
88
+ return(rb_str_new2((const c8 *)c_value));
89
+ }
90
+
91
+ static VALUE rb_c_function0(VALUE self) {
92
+ b8 c_value = FALSE;
93
+
94
+ if(!self)
95
+ return Qnil;
96
+
97
+ return(c_value ? Qtrue : Qfalse);
98
+ }
99
+
100
+ static VALUE rb_c_function1(VALUE self, VALUE rb_value1) {
101
+ b8 rb_b8 = RTEST(rb_value1);
102
+ b8 c_value = FALSE;
103
+
104
+ if(!self)
105
+ return Qnil;
106
+
107
+ return(c_value ? Qtrue : Qfalse);
108
+ }
109
+
110
+ static VALUE rb_c_function2(VALUE self, VALUE rb_value1, VALUE rb_value2) {
111
+ b8 c_value = FALSE;
112
+ b8 rb_b8 = RTEST(rb_value1);
113
+ u32 rb_u32 = (u32)NUM2ULONG(rb_value2);
114
+
115
+ if(!self)
116
+ return Qnil;
117
+
118
+ return(c_value ? Qtrue : Qfalse);
119
+ }
120
+
121
+ /* Different main entry point for debugging library, otherwise, everything is the same */
122
+ #ifdef library_DEBUG
123
+ void Init_library_debug(void) {
124
+ #else
125
+ void Init_library(void) {
126
+ #endif
127
+ VALUE library_module = rb_define_module("RB_MODULE_NAME");
128
+ VALUE helpers = rb_define_class_under(library_module, "RB_CLASS_NAME", rb_cObject);
129
+
130
+ /* RB_MODULE_NAME.ruby_method */
131
+ rb_define_method(library_module, "ruby_method0", rb_c_function0(), 0);
132
+
133
+ /* RB_MODULE_NAME::RB_CLASS_NAME.ruby_method */
134
+ /* No argument */
135
+ rb_define_singleton_method(helpers, "ruby_method0", rb_c_function0(), 0);
136
+ /* 1 object argument */
137
+ rb_define_singleton_method(helpers, "ruby_method1", rb_c_function1(), 1);
138
+ /* 2 object arguments */
139
+ rb_define_singleton_method(helpers, "ruby_method2", rb_c_function2(), 2);
140
+ }
@@ -0,0 +1,61 @@
1
+ /*
2
+
3
+ typedefs.h -- Include and typedefs for basic C types
4
+
5
+ These typedefs appear in all full library header files.
6
+
7
+ You can override all of them by including this file first and making your changes here.
8
+
9
+ To add text editor color highlight support for these typedefs see below.
10
+
11
+ */
12
+
13
+ #ifndef TYPEDEFS_H_Minaswan /* Prevents multiple inclusions */
14
+ #define TYPEDEFS_H_Minaswan
15
+ #define TYPEDEFS_VERSION "0.1.0"
16
+ #include <stdint.h>
17
+
18
+ typedef uint8_t b8; /* Booleans */
19
+ typedef uint16_t b16;
20
+ typedef uint32_t b32;
21
+ typedef uint64_t b64;
22
+
23
+ typedef char c8; /* Characters */
24
+ typedef unsigned char uc8;
25
+
26
+ typedef uint8_t u8; /* Unsigned Numbers */
27
+ typedef uint16_t u16;
28
+ typedef uint32_t u32;
29
+ typedef uint64_t u64;
30
+
31
+ typedef int8_t i8; /* Signed Numbers */
32
+ typedef int16_t i16;
33
+ typedef int32_t i32;
34
+ typedef int64_t i64;
35
+
36
+ typedef float f32; /* Floating Point Numbers */
37
+ typedef double f64;
38
+ #endif /* TYPEDEFS_H_Minaswan */
39
+
40
+ /*
41
+
42
+ For nvim, add to ~/.config/nvim/init.lua:
43
+
44
+ vim.cmd("syntax on")
45
+ vim.api.nvim_create_augroup("CustomCTypedefs", { clear = true })
46
+ vim.api.nvim_create_autocmd("FileType", {
47
+ group = "CustomCTypedefs",
48
+ pattern = { "c", "h", "cpp", "hpp" },
49
+ callback = function()
50
+ vim.cmd([[syntax match CustomTypedef /\<\(b8\|b16\|b32\|b64\|c8\|uc8\|i8\|i16\|i32\|i64\|u8\|u16\|u32\|u64\|f32\|f64\)\>/]])
51
+ vim.cmd([[highlight CustomTypedef guifg=green ctermfg=green]])
52
+ end,
53
+ })
54
+
55
+ For nano, add to /usr/share/nano/c.nanorc:
56
+
57
+ color green "\<(b8|b16|b32|b64|c8|uc8|i8|i16|i32|i64|u8|u16|u32|u64|f32|f64)\>"
58
+
59
+ For emacs, it would seem the magic is strong, because it just works. :)
60
+
61
+ */
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
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.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minaswan Nakamoto
@@ -65,7 +65,7 @@ description: |
65
65
 
66
66
  > demake
67
67
 
68
- You can also clone from git for a more complete example:
68
+ You can also clone from git:
69
69
 
70
70
  > git clone https://github.com/MinaswanNakamoto/demake.git
71
71
  > chmod +x demake/bin/demake
@@ -84,23 +84,38 @@ extensions: []
84
84
  extra_rdoc_files: []
85
85
  files:
86
86
  - bin/demake
87
- - lib/data/example/demake/applications
88
- - lib/data/example/demake/license
89
- - lib/data/example/demake/settings.rb
90
- - lib/data/example/demake/test-target.rb
91
- - lib/data/example/src/goodbye.c
92
- - lib/data/example/src/hello.c
93
- - lib/data/example/src/string/string.c
94
- - lib/data/example/src/string/string.h
95
- - lib/data/oreo/demake/applications
96
- - lib/data/oreo/demake/license
97
- - lib/data/oreo/demake/settings.rb
98
- - lib/data/oreo/demake/test-target.rb
99
- - lib/data/oreo/oreo_test.txt
100
- - lib/data/oreo/src/defines.h
101
- - lib/data/oreo/src/fast_read_file.h
102
- - lib/data/oreo/src/oreo.c
103
- - lib/data/oreo/src/typedefs.h
87
+ - lib/apps/example/Makefile
88
+ - lib/apps/example/demake/applications
89
+ - lib/apps/example/demake/brief_description
90
+ - lib/apps/example/demake/license
91
+ - lib/apps/example/demake/settings.rb
92
+ - lib/apps/example/demake/suggestion
93
+ - lib/apps/example/demake/test-target.rb
94
+ - lib/apps/example/src/goodbye.c
95
+ - lib/apps/example/src/hello.c
96
+ - lib/apps/example/src/string/string.c
97
+ - lib/apps/example/src/string/string.h
98
+ - lib/apps/oreo/Makefile
99
+ - lib/apps/oreo/demake/applications
100
+ - lib/apps/oreo/demake/brief_description
101
+ - lib/apps/oreo/demake/license
102
+ - lib/apps/oreo/demake/settings.rb
103
+ - lib/apps/oreo/demake/suggestion
104
+ - lib/apps/oreo/demake/test-target.rb
105
+ - lib/apps/oreo/oreo_test.txt
106
+ - lib/apps/oreo/src/defines.h
107
+ - lib/apps/oreo/src/fast_read_file.h
108
+ - lib/apps/oreo/src/oreo.c
109
+ - lib/apps/oreo/src/typedefs.h
110
+ - lib/data/libsrc/auto_bits.h
111
+ - lib/data/libsrc/base.h
112
+ - lib/data/libsrc/cpu_mark_check.h
113
+ - lib/data/libsrc/defines.h
114
+ - lib/data/libsrc/fast_read_file.h
115
+ - lib/data/libsrc/fast_sha2.h
116
+ - lib/data/libsrc/parse_arguments.h
117
+ - lib/data/libsrc/rb_library.c
118
+ - lib/data/libsrc/typedefs.h
104
119
  - lib/template/build_target.rb
105
120
  - lib/template/clean_target.rb
106
121
  - lib/template/debug_executable_target.rb
@@ -133,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
148
  - !ruby/object:Gem::Version
134
149
  version: '0'
135
150
  requirements: []
136
- rubygems_version: 3.6.9
151
+ rubygems_version: 4.0.6
137
152
  specification_version: 4
138
153
  summary: Develop, Decorate and manage Dependencies for C (GNU) Makefiles easily with
139
154
  a Ruby script.
@@ -1,29 +0,0 @@
1
- /*
2
- defines.h -- Basic C preprocessor macro definitions
3
- */
4
-
5
- #ifndef DEFINES_H_Minaswan /* Header guard to prevent multiple inclusions */
6
- #define DEFINES_H_Minaswan
7
- #define DEFINES_VERSION "0.1.0"
8
- #ifndef NULL
9
- #define NULL ((void *) 0)
10
- #endif
11
- #ifndef FALSE
12
- #define FALSE 0
13
- #endif
14
- #ifndef TRUE
15
- #define TRUE 1
16
- #endif
17
- #ifndef NO
18
- #define NO 0
19
- #endif
20
- #ifndef YES
21
- #define YES 1
22
- #endif
23
- #ifndef OFF
24
- #define OFF 0
25
- #endif
26
- #ifndef ON
27
- #define ON 1
28
- #endif
29
- #endif /* DEFINES_H_Minaswan */
File without changes