nomen-lang 0.0.19 → 0.2.0

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 (62) hide show
  1. package/NOMEN_AGENTS.md +57 -12
  2. package/core/System/Array.nm +11 -11
  3. package/core/System/Buffer.nm +2 -2
  4. package/core/System/Channel.nm +146 -12
  5. package/core/System/ClassBuffer.nm +2 -2
  6. package/core/System/Console.nm +28 -17
  7. package/core/System/Controls/Button.nm +96 -8
  8. package/core/System/Controls/CheckBox.nm +117 -12
  9. package/core/System/Controls/Container.nm +114 -8
  10. package/core/System/Controls/Text.nm +98 -8
  11. package/core/System/Controls/TextBox.nm +120 -10
  12. package/core/System/Controls/Window.nm +231 -23
  13. package/core/System/Graph.nm +1 -1
  14. package/core/System/Init.nm +4 -8
  15. package/core/System/LinkedList.nm +1 -1
  16. package/core/System/List.nm +3 -3
  17. package/core/System/Map.nm +5 -5
  18. package/core/System/Math.nm +10 -32
  19. package/core/System/Result.nm +1 -1
  20. package/core/System/Set.nm +4 -4
  21. package/core/System/Stream/Directory.nm +189 -63
  22. package/core/System/Stream/DirectoryError.nm +21 -0
  23. package/core/System/Stream/File.nm +339 -141
  24. package/core/System/Stream/FileError.nm +21 -0
  25. package/core/System/Stream/Http.nm +109 -44
  26. package/core/System/Stream/HttpError.nm +20 -0
  27. package/core/System/String.nm +83 -69
  28. package/core/System/StringBuilder.nm +11 -13
  29. package/core/System/Task.nm +46 -12
  30. package/core/System/Test.nm +1 -1
  31. package/core/System/Text/Json.nm +5 -3
  32. package/core/System/Text/JsonTree.nm +23 -14
  33. package/core/System/Text/Regex.nm +124 -64
  34. package/core/System/Tree.nm +1 -1
  35. package/core/System/bool.nm +4 -9
  36. package/core/System/char.nm +3 -9
  37. package/core/System/float.nm +2 -1
  38. package/core/System/float32.nm +44 -0
  39. package/core/System/float64.nm +44 -0
  40. package/core/System/int.nm +3 -9
  41. package/core/System/int16.nm +47 -0
  42. package/core/System/int32.nm +47 -0
  43. package/core/System/int64.nm +3 -9
  44. package/core/System/int8.nm +3 -9
  45. package/core/System/ufloat.nm +44 -0
  46. package/core/System/ufloat32.nm +44 -0
  47. package/core/System/ufloat64.nm +44 -0
  48. package/core/System/uint.nm +3 -9
  49. package/core/System/uint16.nm +47 -0
  50. package/core/System/uint32.nm +47 -0
  51. package/core/System/uint64.nm +3 -9
  52. package/core/System/uint8.nm +3 -9
  53. package/core/docs/System/Channel.md +2 -0
  54. package/core/docs/System/Result.md +5 -1
  55. package/core/docs/System/Task.md +1 -1
  56. package/dist/index.mjs +38794 -21299
  57. package/package.json +38 -34
  58. package/src/args.ts +11 -0
  59. package/src/index.ts +21 -3
  60. package/src/init.ts +1 -1
  61. package/src/test.ts +48 -4
  62. package/src/types/Config.ts +2 -0
@@ -7,7 +7,7 @@ pub class Text: Control {
7
7
 
8
8
  pub func #init = (self, Window window) {
9
9
  ```
10
- #arch: c, aarch64_use_c
10
+ #arch: c
11
11
  #platform: macos
12
12
  id label = ((id(*)(id, SEL, CGRect))objc_msgSend)(
13
13
  ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSTextField"), sel_registerName("alloc")),
@@ -28,7 +28,49 @@ pub class Text: Control {
28
28
  self->handle = (uint64_t)label;
29
29
  ```
30
30
  ```
31
- #arch: c, aarch64_use_c
31
+ #arch: aarch64_use_c
32
+ #platform: macos
33
+ id label = ((id(*)(id, SEL, CGRect))objc_msgSend)(
34
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSTextField"), sel_registerName("alloc")),
35
+ sel_registerName("initWithFrame:"),
36
+ ((CGRect(*)(double, double, double, double))CGRectMake)(10, 10, 200, 30));
37
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
38
+ label, sel_registerName("setEditable:"), 0);
39
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
40
+ label, sel_registerName("setSelectable:"), 0);
41
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
42
+ label, sel_registerName("setBordered:"), 0);
43
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
44
+ label, sel_registerName("setDrawsBackground:"), 0);
45
+ id contentView = ((id(*)(id, SEL))objc_msgSend)(
46
+ (id)window->handle, sel_registerName("contentView"));
47
+ ((void(*)(id, SEL, id))objc_msgSend)(
48
+ contentView, sel_registerName("addSubview:"), label);
49
+ self->handle = (uint64_t)label;
50
+ ```
51
+ ```
52
+ #arch: c
53
+ #platform: ios
54
+ id label = ((id(*)(id, SEL, CGRect))objc_msgSend)(
55
+ ((id(*)(id, SEL))objc_msgSend)(objc_getClass("UILabel"), sel_registerName("alloc")),
56
+ sel_registerName("initWithFrame:"),
57
+ ((CGRect(*)(double, double, double, double))CGRectMake)(10, 10, 200, 30));
58
+ ((void(*)(id, SEL, id))objc_msgSend)(
59
+ label, sel_registerName("setText:"),
60
+ ((id(*)(id, SEL, const char*))objc_msgSend)(
61
+ (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), ""));
62
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
63
+ label, sel_registerName("setUserInteractionEnabled:"), 0);
64
+ id parentView = ((id(*)(id, SEL))objc_msgSend)(
65
+ ((id(*)(id, SEL))objc_msgSend)(
66
+ (id)window->handle, sel_registerName("rootViewController")),
67
+ sel_registerName("view"));
68
+ ((void(*)(id, SEL, id))objc_msgSend)(
69
+ parentView, sel_registerName("addSubview:"), label);
70
+ self->handle = (uint64_t)label;
71
+ ```
72
+ ```
73
+ #arch: aarch64_use_c
32
74
  #platform: ios
33
75
  id label = ((id(*)(id, SEL, CGRect))objc_msgSend)(
34
76
  ((id(*)(id, SEL))objc_msgSend)(objc_getClass("UILabel"), sel_registerName("alloc")),
@@ -53,7 +95,7 @@ pub class Text: Control {
53
95
  pub func set_text = (ref self, string text) {
54
96
  self.text = text
55
97
  ```
56
- #arch: c, aarch64_use_c
98
+ #arch: c
57
99
  #platform: macos
58
100
  ((void(*)(id, SEL, id))objc_msgSend)(
59
101
  (id)self->handle, sel_registerName("setStringValue:"),
@@ -61,13 +103,29 @@ pub class Text: Control {
61
103
  (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), text));
62
104
  ```
63
105
  ```
64
- #arch: c, aarch64_use_c
106
+ #arch: aarch64_use_c
107
+ #platform: macos
108
+ ((void(*)(id, SEL, id))objc_msgSend)(
109
+ (id)self->handle, sel_registerName("setStringValue:"),
110
+ ((id(*)(id, SEL, const char*))objc_msgSend)(
111
+ (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), text.ptr));
112
+ ```
113
+ ```
114
+ #arch: c
65
115
  #platform: ios
66
116
  ((void(*)(id, SEL, id))objc_msgSend)(
67
117
  (id)self->handle, sel_registerName("setText:"),
68
118
  ((id(*)(id, SEL, const char*))objc_msgSend)(
69
119
  (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), text));
70
120
  ```
121
+ ```
122
+ #arch: aarch64_use_c
123
+ #platform: ios
124
+ ((void(*)(id, SEL, id))objc_msgSend)(
125
+ (id)self->handle, sel_registerName("setText:"),
126
+ ((id(*)(id, SEL, const char*))objc_msgSend)(
127
+ (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), text.ptr));
128
+ ```
71
129
  }
72
130
 
73
131
  // ── Control trait conformance ──
@@ -91,14 +149,28 @@ pub class Text: Control {
91
149
 
92
150
  pub func set_frame = (ref self, int x, int y, int width, int height) {
93
151
  ```
94
- #arch: c, aarch64_use_c
152
+ #arch: c
153
+ #platform: macos
154
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
155
+ (id)self->handle, sel_registerName("setFrame:"),
156
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
157
+ ```
158
+ ```
159
+ #arch: aarch64_use_c
95
160
  #platform: macos
96
161
  ((void(*)(id, SEL, CGRect))objc_msgSend)(
97
162
  (id)self->handle, sel_registerName("setFrame:"),
98
163
  ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
99
164
  ```
100
165
  ```
101
- #arch: c, aarch64_use_c
166
+ #arch: c
167
+ #platform: ios
168
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
169
+ (id)self->handle, sel_registerName("setFrame:"),
170
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
171
+ ```
172
+ ```
173
+ #arch: aarch64_use_c
102
174
  #platform: ios
103
175
  ((void(*)(id, SEL, CGRect))objc_msgSend)(
104
176
  (id)self->handle, sel_registerName("setFrame:"),
@@ -108,7 +180,16 @@ pub class Text: Control {
108
180
 
109
181
  func #destroy = () {
110
182
  ```
111
- #arch: c, aarch64_use_c
183
+ #arch: c
184
+ #platform: macos
185
+ if (self->handle) {
186
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
187
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
188
+ self->handle = 0;
189
+ }
190
+ ```
191
+ ```
192
+ #arch: aarch64_use_c
112
193
  #platform: macos
113
194
  if (self->handle) {
114
195
  ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
@@ -117,7 +198,16 @@ pub class Text: Control {
117
198
  }
118
199
  ```
119
200
  ```
120
- #arch: c, aarch64_use_c
201
+ #arch: c
202
+ #platform: ios
203
+ if (self->handle) {
204
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
205
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
206
+ self->handle = 0;
207
+ }
208
+ ```
209
+ ```
210
+ #arch: aarch64_use_c
121
211
  #platform: ios
122
212
  if (self->handle) {
123
213
  ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
@@ -6,7 +6,7 @@ pub class TextBox : Control {
6
6
 
7
7
  pub func #init = (self, Window window) {
8
8
  ```
9
- #arch: c, aarch64_use_c
9
+ #arch: c
10
10
  #platform: macos
11
11
  id field = ((id(*)(id, SEL, CGRect))objc_msgSend)(
12
12
  ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSTextField"), sel_registerName("alloc")),
@@ -33,7 +33,51 @@ pub class TextBox : Control {
33
33
  self->handle = (uint64_t)field;
34
34
  ```
35
35
  ```
36
- #arch: c, aarch64_use_c
36
+ #arch: aarch64_use_c
37
+ #platform: macos
38
+ id field = ((id(*)(id, SEL, CGRect))objc_msgSend)(
39
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("NSTextField"), sel_registerName("alloc")),
40
+ sel_registerName("initWithFrame:"),
41
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 200, 24));
42
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
43
+ field, sel_registerName("setEditable:"), 1);
44
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
45
+ field, sel_registerName("setSelectable:"), 1);
46
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
47
+ field, sel_registerName("setBordered:"), 1);
48
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
49
+ field, sel_registerName("setBezeled:"), 1);
50
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
51
+ field, sel_registerName("setDrawsBackground:"), 1);
52
+ ((void(*)(id, SEL, id))objc_msgSend)(
53
+ field, sel_registerName("setStringValue:"),
54
+ ((id(*)(id, SEL, const char*))objc_msgSend)(
55
+ (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), ""));
56
+ id contentView = ((id(*)(id, SEL))objc_msgSend)(
57
+ (id)window->handle, sel_registerName("contentView"));
58
+ ((void(*)(id, SEL, id))objc_msgSend)(
59
+ contentView, sel_registerName("addSubview:"), field);
60
+ self->handle = (uint64_t)field;
61
+ ```
62
+ ```
63
+ #arch: c
64
+ #platform: ios
65
+ id field = ((id(*)(id, SEL, CGRect))objc_msgSend)(
66
+ ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("UITextField"), sel_registerName("alloc")),
67
+ sel_registerName("initWithFrame:"),
68
+ ((CGRect(*)(double, double, double, double))CGRectMake)(0, 0, 200, 30));
69
+ ((void(*)(id, SEL, BOOL))objc_msgSend)(
70
+ field, sel_registerName("setBorderStyle:"), 1); // UITextBorderStyleRoundedRect = 1
71
+ id parentView = ((id(*)(id, SEL))objc_msgSend)(
72
+ ((id(*)(id, SEL))objc_msgSend)(
73
+ (id)window->handle, sel_registerName("rootViewController")),
74
+ sel_registerName("view"));
75
+ ((void(*)(id, SEL, id))objc_msgSend)(
76
+ parentView, sel_registerName("addSubview:"), field);
77
+ self->handle = (uint64_t)field;
78
+ ```
79
+ ```
80
+ #arch: aarch64_use_c
37
81
  #platform: ios
38
82
  id field = ((id(*)(id, SEL, CGRect))objc_msgSend)(
39
83
  ((id(*)(id, SEL))objc_msgSend)((id)objc_getClass("UITextField"), sel_registerName("alloc")),
@@ -53,14 +97,28 @@ pub class TextBox : Control {
53
97
 
54
98
  pub func set_frame = (ref self, int x, int y, int width, int height) {
55
99
  ```
56
- #arch: c, aarch64_use_c
100
+ #arch: c
101
+ #platform: macos
102
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
103
+ (id)self->handle, sel_registerName("setFrame:"),
104
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
105
+ ```
106
+ ```
107
+ #arch: aarch64_use_c
57
108
  #platform: macos
58
109
  ((void(*)(id, SEL, CGRect))objc_msgSend)(
59
110
  (id)self->handle, sel_registerName("setFrame:"),
60
111
  ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
61
112
  ```
62
113
  ```
63
- #arch: c, aarch64_use_c
114
+ #arch: c
115
+ #platform: ios
116
+ ((void(*)(id, SEL, CGRect))objc_msgSend)(
117
+ (id)self->handle, sel_registerName("setFrame:"),
118
+ ((CGRect(*)(double, double, double, double))CGRectMake)((double)x, (double)y, (double)width, (double)height));
119
+ ```
120
+ ```
121
+ #arch: aarch64_use_c
64
122
  #platform: ios
65
123
  ((void(*)(id, SEL, CGRect))objc_msgSend)(
66
124
  (id)self->handle, sel_registerName("setFrame:"),
@@ -70,7 +128,7 @@ pub class TextBox : Control {
70
128
 
71
129
  pub func set_text = (self, string text) {
72
130
  ```
73
- #arch: c, aarch64_use_c
131
+ #arch: c
74
132
  #platform: macos
75
133
  ((void(*)(id, SEL, id))objc_msgSend)(
76
134
  (id)self->handle, sel_registerName("setStringValue:"),
@@ -78,18 +136,43 @@ pub class TextBox : Control {
78
136
  (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), text));
79
137
  ```
80
138
  ```
81
- #arch: c, aarch64_use_c
139
+ #arch: aarch64_use_c
140
+ #platform: macos
141
+ ((void(*)(id, SEL, id))objc_msgSend)(
142
+ (id)self->handle, sel_registerName("setStringValue:"),
143
+ ((id(*)(id, SEL, const char*))objc_msgSend)(
144
+ (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), text.ptr));
145
+ ```
146
+ ```
147
+ #arch: c
82
148
  #platform: ios
83
149
  ((void(*)(id, SEL, id))objc_msgSend)(
84
150
  (id)self->handle, sel_registerName("setText:"),
85
151
  ((id(*)(id, SEL, const char*))objc_msgSend)(
86
152
  (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), text));
87
153
  ```
154
+ ```
155
+ #arch: aarch64_use_c
156
+ #platform: ios
157
+ ((void(*)(id, SEL, id))objc_msgSend)(
158
+ (id)self->handle, sel_registerName("setText:"),
159
+ ((id(*)(id, SEL, const char*))objc_msgSend)(
160
+ (id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), text.ptr));
161
+ ```
88
162
  }
89
163
 
90
164
  pub func get_text = (self, out string) {
91
165
  ```
92
- #arch: c, aarch64_use_c
166
+ #arch: c
167
+ #platform: macos
168
+ id str = ((id(*)(id, SEL))objc_msgSend)(
169
+ (id)self->handle, sel_registerName("stringValue"));
170
+ const char *cstr = ((const char*(*)(id, SEL))objc_msgSend)(
171
+ str, sel_registerName("UTF8String"));
172
+ return strdup(cstr);
173
+ ```
174
+ ```
175
+ #arch: aarch64_use_c
93
176
  #platform: macos
94
177
  id str = ((id(*)(id, SEL))objc_msgSend)(
95
178
  (id)self->handle, sel_registerName("stringValue"));
@@ -98,7 +181,7 @@ pub class TextBox : Control {
98
181
  return strdup(cstr);
99
182
  ```
100
183
  ```
101
- #arch: c, aarch64_use_c
184
+ #arch: c
102
185
  #platform: ios
103
186
  id str = ((id(*)(id, SEL))objc_msgSend)(
104
187
  (id)self->handle, sel_registerName("text"));
@@ -106,6 +189,15 @@ pub class TextBox : Control {
106
189
  str, sel_registerName("UTF8String"));
107
190
  return strdup(cstr);
108
191
  ```
192
+ ```
193
+ #arch: aarch64_use_c
194
+ #platform: ios
195
+ id str = ((id(*)(id, SEL))objc_msgSend)(
196
+ (id)self->handle, sel_registerName("text.ptr"));
197
+ const char *cstr = ((const char*(*)(id, SEL))objc_msgSend)(
198
+ str, sel_registerName("UTF8String"));
199
+ return strdup(cstr);
200
+ ```
109
201
  }
110
202
 
111
203
  // ── Control trait conformance ──
@@ -136,7 +228,16 @@ pub class TextBox : Control {
136
228
 
137
229
  func #destroy = () {
138
230
  ```
139
- #arch: c, aarch64_use_c
231
+ #arch: c
232
+ #platform: macos
233
+ if (self->handle) {
234
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
235
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
236
+ self->handle = 0;
237
+ }
238
+ ```
239
+ ```
240
+ #arch: aarch64_use_c
140
241
  #platform: macos
141
242
  if (self->handle) {
142
243
  ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
@@ -145,7 +246,16 @@ pub class TextBox : Control {
145
246
  }
146
247
  ```
147
248
  ```
148
- #arch: c, aarch64_use_c
249
+ #arch: c
250
+ #platform: ios
251
+ if (self->handle) {
252
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));
253
+ ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("release"));
254
+ self->handle = 0;
255
+ }
256
+ ```
257
+ ```
258
+ #arch: aarch64_use_c
149
259
  #platform: ios
150
260
  if (self->handle) {
151
261
  ((void(*)(id, SEL))objc_msgSend)((id)self->handle, sel_registerName("removeFromSuperview"));