-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStringf.hxx
1230 lines (1114 loc) · 34.2 KB
/
Stringf.hxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright Kabuki Starship™ <kabukistarship.com>.
#include "Stringf.hpp"
#include "Binary.hpp"
namespace _ {
const CHA* STAPrintCharsHeader() {
return "\n|0 8 16 24 32 40 48 56 |"
" Begin address:";
}
const CHA* STAPrintCharsBorder() {
return "\n|+-------+-------+-------+-------+-------+-------+-------+-------|"
" ";
}
const CHA* STAPrintHexHeader() {
return "\n|0 8 16 24 "
"| Begin address:";
}
const CHA* STAPrintHexBorder() {
return "\n|+---------------+---------------+---------------+---------------|"
" ";
}
const CHA* STAATypesPOD() {
static const CHA Strings[64][4] = {
{'N', 'I', 'L', NIL}, //< 00
{'I', 'U', 'A', NIL}, //< 01
{'I', 'S', 'A', NIL}, //< 02
{'C', 'H', 'A', NIL}, //< 03
{'F', 'P', 'B', NIL}, //< 04
{'I', 'U', 'B', NIL}, //< 05
{'I', 'S', 'B', NIL}, //< 06
{'C', 'H', 'B', NIL}, //< 07
{'F', 'P', 'C', NIL}, //< 08
{'I', 'U', 'C', NIL}, //< 09
{'I', 'S', 'C', NIL}, //< 10
{'C', 'H', 'C', NIL}, //< 11
{'F', 'P', 'D', NIL}, //< 12
{'I', 'U', 'D', NIL}, //< 13
{'I', 'S', 'D', NIL}, //< 14
{'T', 'M', 'E', NIL}, //< 15
{'F', 'P', 'E', NIL}, //< 16
{'I', 'U', 'E', NIL}, //< 17
{'I', 'S', 'E', NIL}, //< 18
{'B', 'O', 'L', NIL}, //< 19
{'D', 'T', 'A', NIL}, //< 20
{'D', 'T', 'B', NIL}, //< 21
{'D', 'T', 'C', NIL}, //< 22
{'D', 'T', 'D', NIL}, //< 23
{'D', 'T', 'E', NIL}, //< 24
{'D', 'T', 'F', NIL}, //< 25
{'D', 'T', 'G', NIL}, //< 26
{'D', 'T', 'H', NIL}, //< 27
{'D', 'T', 'I', NIL}, //< 28
{'D', 'T', 'J', NIL}, //< 29
{'D', 'T', 'K', NIL}, //< 30
{'D', 'T', 'L', NIL}, //< 31
{'I', 'N', 'V', NIL}, //< 32
};
return &Strings[0][0];
}
const CHA* STAATypesPOD(ISA type) {
return TSTAATypesPOD<ISA>(type);
}
const CHA* STAATypesPOD(ISB type) {
return TSTAATypesPOD<ISB>(type);
}
const CHA* STAATypesPOD(ISC type) {
return TSTAATypesPOD<ISC>(type);
}
const CHA* STAATypesPOD(ISD type) {
return TSTAATypesPOD<ISD>(type);
}
const CHA* STRATypesVector() {
static const CHA Strings[17][4] = {
{'V', 'H', 'A', NIL}, //< 0
{'A', 'R', 'A', NIL}, //< 0
{'S', 'C', 'A', NIL}, //< 0
{'M', 'A', 'A', NIL}, //< 0
{'V', 'H', 'B', NIL}, //< 0
{'A', 'R', 'B', NIL}, //< 0
{'S', 'C', 'B', NIL}, //< 0
{'M', 'A', 'B', NIL}, //< 0
{'V', 'H', 'C', NIL}, //< 0
{'A', 'R', 'C', NIL}, //< 0
{'S', 'C', 'C', NIL}, //< 0
{'M', 'A', 'C', NIL}, //< 0
{'V', 'H', 'D', NIL}, //< 0
{'A', 'R', 'D', NIL}, //< 0
{'S', 'C', 'D', NIL}, //< 0
{'M', 'A', 'D', NIL}, //< 0
};
return &Strings[0][0];
}
const CHA* STRATypesVector(ISA type) {
return TSTRATypesVector<ISA>(type);
}
const CHA* STRATypesVector(ISB type) {
return TSTRATypesVector<ISB>(type);
}
const CHA* STRATypesVector(ISC type) {
return TSTRATypesVector<ISC>(type);
}
const CHA* STRATypesVector(ISD type) {
return TSTRATypesVector<ISD>(type);
}
const CHA* STRATypesVectorClass() {
static const CHA Strings[5][4] = {
{'V', 'H', 'T', NIL}, //< 00
{'A', 'R', 'Y', NIL}, //< 01
{'S', 'C', 'K', NIL}, //< 02
{'M', 'T', 'X', NIL}, //< 03
{'I', 'N', 'V', NIL}, //< 04
};
return &Strings[0][0];
}
const CHA* STRATypesVectorClass(ISA type) {
return TSTRATypesVectorClass<ISA>(type);
}
const CHA* STRATypesVectorClass(ISB type) {
return TSTRATypesVectorClass<ISB>(type);
}
const CHA* STRATypesVectorClass(ISC type) {
return TSTRATypesVectorClass<ISC>(type);
}
const CHA* STRATypesVectorClass(ISD type) {
return TSTRATypesVectorClass<ISD>(type);
}
const CHA* STRATypesModifier() {
static const CHA Strings[5][4] = {
{'P', 'O', 'D', NIL}, //< 00
{'P', 'T', 'R', NIL}, //< 01
{'C', 'N', 'S', NIL}, //< 02
{'P', 'T', 'C', NIL}, //< 03
{'I', 'N', 'V', NIL}, //< 04
};
return &Strings[0][0];
}
const CHA* STRATypesModifier(ISA type) {
return TSTRATypesModifier<ISA>(type);
}
const CHA* STRATypesModifier(ISB type) {
return TSTRATypesModifier<ISB>(type);
}
const CHA* STRATypesModifier(ISC type) {
return TSTRATypesModifier<ISC>(type);
}
const CHA* STRATypesModifier(ISD type) {
return TSTRATypesModifier<ISD>(type);
}
const CHA* STRAATypesMap() {
static const CHA Strings[5][4] = {
{'M', 'A', 'A', NIL}, //< 00
{'M', 'A', 'B', NIL}, //< 01
{'M', 'A', 'C', NIL}, //< 02
{'M', 'A', 'D', NIL}, //< 03
{'I', 'N', 'V', NIL}, //< 04
};
return &Strings[0][0];
}
const CHA* STRAATypesMap(ISA type) {
return STAATypeMap(type);
}
const CHA* STRAATypesMap(ISB type) {
return STAATypeMap(type);
}
const CHA* STRAATypesMap(ISC type) {
return STAATypeMap(type);
}
const CHA* STRAATypesMap(ISD type) {
return STAATypeMap(type);
}
const CHA* STRATypesString() {
static const CHA Strings[5][4] = {
{'P', 'O', 'D', NIL}, //< 00
{'P', 'T', 'R', NIL}, //< 01
{'C', 'N', 'S', NIL}, //< 02
{'P', 'T', 'C', NIL}, //< 03
{'I', 'N', 'V', NIL}, //< 04
};
return &Strings[0][0];
}
const CHA* STRATypesString(ISA type) {
return TSTRATypesString<ISA>(type);
}
const CHA* STRATypesString(ISB type) {
return TSTRATypesString<ISB>(type);
}
const CHA* STRATypesString(ISC type) {
return TSTRATypesString<ISC>(type);
}
const CHA* STRATypesString(ISD type) {
return TSTRATypesString<ISD>(type);
}
#if USING_UTF8 == YES_0
const CHA* STATrue() { return "true"; }
#endif
#if USING_UTF16 == YES_0
const CHB* STBTrue() {
static const CHB dez_nutz[] = { 't', 'r', 'u', 'e', '\0' };
return dez_nutz;
}
#endif
#if USING_UTF32 == YES_0
const CHC* STCTrue() {
static const CHC dez_nutz[] = {'t', 'r', 'u', 'e', '\0'};
return dez_nutz;
}
#endif
// String that reads "false".
#if USING_UTF8 == YES_0
const CHA* STAFalse() { return "false"; }
#endif
#if USING_UTF16 == YES_0
const CHB* STBFalse() {
static const CHB dez_nutz[] = { 'f', 'a', 'l', 's', 'e', '\0' };
return dez_nutz;
}
#endif
#if USING_UTF32 == YES_0
const CHC* STCFalse() {
static const CHC dez_nutz[] = { 'f', 'a', 'l', 's', 'e', '\0' };
return dez_nutz;
}
#endif
// Returns the string "true" or "false".
#if USING_UTF8 == YES_0
const CHA* STATF(BOL value) { return value ? STATrue() : STAFalse(); }
#endif
#if USING_UTF16 == YES_0
const CHB* STBTF(BOL value) { return value ? STBTrue() : STBFalse(); }
#endif
#if USING_UTF32 == YES_0
const CHC* STCTF(BOL value) { return value ? STCTrue() : STCFalse(); }
#endif
} //< namespace _
#if SEAM >= SCRIPT2_COUT
#if SEAM == SCRIPT2_COUT
#include "_Debug.hxx"
#else
#include "_Release.hxx"
#endif
namespace _ {
CHA* SPrint(CHA* string, CHA* stop, CHC item) {
// | Byte 1 | Byte 2 | Byte 3 | Byte 4 | UTF-32 Result |
// |:--------:|:--------:|:--------:|:--------:|:---------------------:|
// | 0aaaaaaa | | | | 00000000000000aaaaaaa |
// | 110aaaaa | 10bbbbbb | | | 0000000000aaaaabbbbbb |
// | 1110aaaa | 10bbbbbb | 10cccccc | | 00000aaaabbbbbbcccccc |
// | 11110aaa | 10bbbbbb | 10cccccc | 10dddddd | aaabbbbbbccccccdddddd |
if (!string) return nullptr;
D_COUT("\n\n" << IUC(item) << ".) Printed:0x");
if (!(item >> 7)) { // 1 ASCII CHA.
if (string + 1 > stop) return nullptr;
*string++ = CHA(item);
D_COUT(Hexf(*(string - 1)) << " ");
} else {
CHB lsb_mask = 0x3f, msb_mask = 0x80;
if ((item >> 11) == 0) {
if (string + 2 >= stop) return nullptr;
*string++ = CHA(0xC0 | (item >> 6));
*string++ = CHA(msb_mask | (item & lsb_mask));
D_COUT(Hexf(*(string - 2)) << '_' << Hexf(*(string - 1)) << " ");
} else if ((item >> 16) == 0) {
if (string + 3 >= stop) return nullptr;
*string++ = CHA(0xE0 | (item >> 12));
*string++ = CHA(msb_mask | ((item >> 6) & lsb_mask));
*string++ = CHA(msb_mask | (item & lsb_mask));
D_COUT(Hexf(*(string - 3)) << '_' << Hexf(*(string - 2)) << '_'
<< Hexf(*(string - 1)) << " ");
} else if ((item >> 21) == 0) {
if (string + 4 >= stop) return nullptr;
*string++ = CHA(0xF0 | (item >> 18));
*string++ = CHA(msb_mask | ((item >> 12) & lsb_mask));
*string++ = CHA(msb_mask | ((item >> 6) & lsb_mask));
*string++ = CHA(msb_mask | (item & lsb_mask));
D_COUT(Hexf(*(string - 4))
<< '_' << Hexf(*(string - 3)) << '_' << Hexf(*(string - 2)) << '_'
<< Hexf(*(string - 1)) << " ");
} else {
D_COUT("\n\nUTF8 print Error: CHC is out of range!");
return nullptr;
}
}
*string = 0;
return string;
}
const CHA* SScan(const CHA* string, CHC& item) {
if (!string) return nullptr;
CHA c = CHC(*string++);
CHC lsb_mask = 0x3f, msb = 0x80, result = 0;
D_COUT("SScan:" << Hexf(c));
if (!(c >> 7)) {
result = CHC(c);
} else if ((IUA(c) >> 5) == 6) {
result = (c & 31) << 6;
c = CHC(*string++);
D_COUT(Hexf(c));
if (!(c & msb)) return nullptr;
result |= c & CHC(63);
D_COUT(Hexf(*(string - 1)));
} else if ((IUA(c) >> 4) == 0xE) {
result = CHC(c & 15) << 12;
c = CHC(*string++);
if (!(c & msb)) return nullptr;
result |= (c & 63) << 6;
c = CHC(*string++);
if (!(c & msb)) return nullptr;
result |= c & lsb_mask;
D_COUT('_' << Hexf(*(string - 2)) << '_' << Hexf(*(string - 1)));
} else if ((IUA(c) >> 3) == 0x1E) {
result = CHC(c & 7) << 18;
c = CHC(*string++);
if (!(c & msb)) return nullptr;
result |= (c & lsb_mask) << 12;
c = CHC(*string++);
if (!(c & msb)) return nullptr;
result |= (c & lsb_mask) << 6;
c = CHC(*string++);
if (!(c & msb)) return nullptr;
result |= c & lsb_mask;
D_COUT('_' << Hexf(*(string - 3)) << '_' << Hexf(*(string - 2)) << '_'
<< Hexf(*(string - 1)));
} else {
D_COUT(" error:0x" << Hexf(c) << '_' << Hexf(*string++) << '_'
<< Hexf(*string++) << '_' << Hexf(*string++) << '\n');
return nullptr;
}
item = result;
return string;
}
CHA* SPrint(CHA* start, CHA* stop, CHB item) {
// | Byte 1 | Byte 2 | Byte 3 | UTF-32 Result |
// |:--------:|:--------:|:--------:|:----------------:|
// | 0aaaaaaa | | | 000000000aaaaaaa |
// | 110aaaaa | 10bbbbbb | | 00000aaaaabbbbbb |
// | 1110aaaa | 10bbbbbb | 10cccccc | aaaabbbbbbcccccc |
#if USING_UTF32 == YES_0
return SPrint(start, stop, CHC(item));
#else
enum { c2ByteMSbMask = 0xC0, c3ByteMSbMask = 0xE0, c4ByteMSbMask = 0xF0 };
if (!start || start >= stop) return nullptr;
if (!(item >> 7)) { // 1 byte.
if (start + 1 > stop) return nullptr;
*start++ = CHA(item);
*start = 0;
return start;
}
CHB lsb_mask = 0x3f, msb_mask = 0x80;
if (!(item >> 12)) { // 2 bytes.
if (start + 2 >= stop) return nullptr;
*start++ = (CHA)(0xC0 | item >> 6);
*start++ = (CHA)(msb_mask | ((item >> 6) & lsb_mask));
*start = 0;
return start;
} // else 3 bytes.
if (start + 3 >= stop) return nullptr;
*start++ = (CHA)(0xE0 | item >> 12);
*start++ = (CHA)(msb_mask | ((item >> 6) & lsb_mask));
*start++ = (CHA)(msb_mask | ((item >> 12) & lsb_mask));
*start = 0;
return start;
#endif
}
#if USING_UTF16 == YES_0
CHB* SPrint(CHB* start, CHB* stop, CHC item) {
// | Bytes {4N, 4N+ 1} | Bytes {4N + 2, 4N+ 3} | UTF-32 Result |
// |:-----------------:|:---------------------:|:--------------------:|
// | 000000aaaaaaaaaa | | 0000000000aaaaaaaaaa |
// | 110110yyyyyyyyyy | 110111xxxxxxxxxx | yyyyyyyyyyxxxxxxxxxx |
// | 0xD800 | 0xDC00 | |
if (!start || start + 1 >= stop) return nullptr;
CHC lsb_mask = 0x3f, lsb = item & lsb_mask, msb = item >> 10;
if (!msb) {
if (start + 1 > stop) return nullptr;
*start++ = CHB(item);
D_COUT("\nPrinting 1:" << (Hexf(CHB(item))));
*start = 0;
return start;
} else {
CHC msb_mask = 0xDC00;
if (msb >> 10) return nullptr; // Non-Unicode value.
if (start + 2 >= stop) return nullptr;
CHB nibble = (CHB)(lsb & msb_mask);
D_COUT("\nPrinting 2:" << Hexf(CHB(nibble)));
*start++ = nibble;
nibble = (CHB)(msb & msb_mask);
D_COUT(Hexf(CHB(nibble)));
*start++ = nibble;
*start = 0;
return start;
}
}
const CHB* SScan(const CHB* string, CHC& item) {
// | Bytes {4N, 4N+ 1} | Bytes {4N + 2, 4N+ 3} | UTF-32 Result |
// |:-----------------:|:---------------------:|:--------------------:|
// | 000000aaaaaaaaaa | | 0000000000aaaaaaaaaa |
// | 110110aaaaaaaaaa | 110111bbbbbbbbbb | aaaaaaaaaabbbbbbbbbb |
CHB c = *string++;
CHB lsb_mask = (1 << 10) - 1;
if (c <= lsb_mask) {
D_COUT(" Scanning 1:" << Hexf(c));
item = CHC(c);
} else if ((c >> 10) == 30) {
D_COUT(" Scanning 1:" << Hexf(c));
CHC r = (CHC(c)) & lsb_mask;
c = *string++;
if (c >> 10 != 55) return nullptr;
r |= ((CHC)(c & lsb_mask)) << 10;
} else {
D_COUT(" SScan error:" << Hexf(c));
return nullptr;
}
return string;
}
#endif
ATypef::ATypef(DTB type, Sizef count) : count(count.size), type(type) {}
ATypef::ATypef(DTC type, Sizef count) : count(count.size), type(type) {}
ATypef::ATypef(DTD type, Sizef count) : count(count.size), type(type) {}
ATypef::ATypef(DTB pod, DTB vt, Sizef count) :
count(count.size),
type(ATypePack(pod, vt))
{}
ATypef::ATypef(DTB pod, DTB vt, DTB sw, Sizef count) :
count(count.size),
type(ATypePack(pod, vt, sw))
{}
ATypef::ATypef(DTB pod, DTB vt, DTB sw, DTB map, Sizef count) :
count(count.size),
type(ATypePack(pod, vt, sw, map))
{}
ATypef::ATypef(DTB pod, DTB vt, DTB sw, DTB map, DTB mod, Sizef count) :
count(count.size),
type(ATypePack(pod, vt, sw, map, mod))
{}
Centerf ATypef::Center(ISW count) {
Centerf result;
return result;
}
Rightf ATypef::Right(ISW count) {
Rightf result;
return result;
}
Valuef::Valuef() : count(0), value() {}
Valuef::Valuef(void* item, ISW count) : count(count), value(item) {}
Valuef::Valuef(const void* item, ISW count) : count(count), value(item) {}
#if USING_UTF8 == YES_0
Valuef::Valuef(CHA item, ISW count) : count(count), value(item) {}
Valuef::Valuef(const CHA* item, ISW count) : count(count), value(item) {}
#endif
#if USING_UTF16 == YES_0
Valuef::Valuef(CHB item, ISW count) : count(count), value(item) {}
Valuef::Valuef(const CHB* item, ISW count) : count(count), value(item) {}
#endif
#if USING_UTF32 == YES_0
Valuef::Valuef(CHC item, ISW count) : count(count), value(item) {}
Valuef::Valuef(const CHC* item, ISW count) : count(count), value(item) {}
#endif
Valuef::Valuef(ISA item, ISW count) : count(count), value(item) {}
Valuef::Valuef(IUA item, ISW count) : count(count), value(item) {}
Valuef::Valuef(ISB item, ISW count) : count(count), value(item) {}
Valuef::Valuef(IUB item, ISW count) : count(count), value(item) {}
Valuef::Valuef(ISC item, ISW count) : count(count), value(item) {}
Valuef::Valuef(IUC item, ISW count) : count(count), value(item) {}
Valuef::Valuef(ISD item, ISW count) : count(count), value(item) {}
Valuef::Valuef(IUD item, ISW count) : count(count), value(item) {}
#if USING_FPC == YES_0
Valuef::Valuef(FPC item, ISW count) : count(count), value(item) {}
#endif
#if USING_FPD == YES_0
Valuef::Valuef(FPD item, ISW count) : count(count), value(item) {}
#endif
ISW Valuef::Type() { return value.Type(); }
ISW Valuef::Count() { return count; }
void* Valuef::Value() { return value.WordPTR(); }
void* Valuef::ToPtr() { return value.ToPTR(); }
CHA* Valuef::ToSTA() { return value.ToSTA(); }
CHB* Valuef::ToSTB() { return value.ToSTB(); }
CHC* Valuef::ToSTC() { return value.ToSTC(); }
IUW Valuef::ToWord() { return value.Word(); }
Hexf::Hexf(const void* origin, ISW size) : element(origin, size) {}
#if CPU_ENDIAN == CPU_ENDIAN_LITTLE
Hexf::Hexf(const void* item) : element(IUW(item), -ISW(sizeof(const void*))) {}
Hexf::Hexf(CHA item) : element(item, -ISW(sizeof(ISA))) {}
Hexf::Hexf(ISA item) : element(item, -ISW(sizeof(ISA))) {}
Hexf::Hexf(IUA item) : element(item, -ISW(sizeof(IUA))) {}
Hexf::Hexf(CHB item) : element(item, -ISW(sizeof(CHB))) {}
Hexf::Hexf(ISB item) : element(item, -ISW(sizeof(ISB))) {}
Hexf::Hexf(IUB item) : element(item, -ISW(sizeof(IUB))) {}
Hexf::Hexf(CHC item) : element(item, -ISW(sizeof(CHC))) {}
Hexf::Hexf(ISC item) : element(item, -ISW(sizeof(ISC))) {}
Hexf::Hexf(IUC item) : element(item, -ISW(sizeof(IUC))) {}
Hexf::Hexf(ISD item) : element(item, -ISW(sizeof(ISD))) {}
Hexf::Hexf(IUD item) : element(item, -ISW(sizeof(IUD))) {}
#if USING_FPC == YES_0
Hexf::Hexf(FPC item) : element(item, -ISW(sizeof(FPC))) {}
#endif
#if USING_FPD == YES_0
Hexf::Hexf(FPD item) : element(item, -ISW(sizeof(FPD))) {}
#endif
Binaryf::Binaryf(const void* origin, ISW size) : element(origin, size) {}
Binaryf::Binaryf(const void* item)
: element(IUW(item), -ISW(sizeof(const void*))) {}
Binaryf::Binaryf(ISA item) : element(item, -ISW(sizeof(ISA))) {}
Binaryf::Binaryf(IUA item) : element(item, -ISW(sizeof(IUA))) {}
Binaryf::Binaryf(ISB item) : element(item, -ISW(sizeof(ISB))) {}
Binaryf::Binaryf(IUB item) : element(item, -ISW(sizeof(IUB))) {}
Binaryf::Binaryf(ISC item) : element(item, -ISW(sizeof(ISC))) {}
Binaryf::Binaryf(IUC item) : element(item, -ISW(sizeof(IUC))) {}
Binaryf::Binaryf(ISD item) : element(item, -ISW(sizeof(ISD))) {}
Binaryf::Binaryf(IUD item) : element(item, -ISW(sizeof(IUD))) {}
#if USING_FPC == YES_0
Binaryf::Binaryf(FPC item) : element(item, -ISW(sizeof(FPC))) {}
#endif
#if USING_FPD == YES_0
Binaryf::Binaryf(FPD item) : element(item, -ISW(sizeof(FPD))) {}
#endif
#else
Hexf::Hexf(const void* item) : valuef(item, sizeof(const void*)) {}
Hexf::Hexf(ISA item) : valuef(item, sizeof(ISA)) {}
Hexf::Hexf(IUA item) : valuef(item, sizeof(IUA)) {}
Hexf::Hexf(ISB item) : valuef(item, sizeof(ISB)) {}
Hexf::Hexf(IUB item) : valuef(item, sizeof(IUB)) {}
Hexf::Hexf(ISC item) : valuef(item, sizeof(ISC)) {}
Hexf::Hexf(IUC item) : valuef(item, sizeof(IUC)) {}
Hexf::Hexf(ISD item) : valuef(item, sizeof(ISD)) {}
Hexf::Hexf(IUD item) : valuef(item, sizeof(IUD)) {}
#if USING_FPD == YES_0
Hexf::Hexf(FPC item) : valuef(item, sizeof(FPC)) {}
#endif
#if USING_FPD == YES_0
Hexf::Hexf(FPD item) : valuef(item, sizeof(FPD)) {}
#endif
Binaryf::Binaryf(const void* origin, ISW size) : valuef(origin, size) {}
Binaryf::Binaryf(const void* origin) : valuef(origin, sizeof(const void*)) {}
Binaryf::Binaryf(ISA item) : valuef(item, sizeof(ISA)) {}
Binaryf::Binaryf(IUA item) : valuef(item, sizeof(IUA)) {}
Binaryf::Binaryf(ISB item) : valuef(item, sizeof(ISB)) {}
Binaryf::Binaryf(IUB item) : valuef(item, sizeof(IUB)) {}
Binaryf::Binaryf(ISC item) : valuef(item, sizeof(ISC)) {}
Binaryf::Binaryf(IUC item) : valuef(item, sizeof(IUC)) {}
Binaryf::Binaryf(ISD item) : valuef(item, sizeof(ISD)) {}
Binaryf::Binaryf(IUD item) : valuef(item, sizeof(IUD)) {}
#if USING_FPD == YES_0
Binaryf::Binaryf(FPC item) : valuef(item, sizeof(FPC)) {}
#endif
#if USING_FPD == YES_0
Binaryf::Binaryf(FPD item) : valuef(item, sizeof(FPD)) {}
#endif
#endif
// Stringf::Stringf () {}
Stringf::Stringf() : type_(_NIL), count_(0), boofer_() {
string_ = &boofer_[0];
*boofer_ = 0;
}
//< Visual C++ is complaining about unitialized members. I think it's a bug.
Stringf::Stringf(const CHA* item) : string_(item), count_(0) { Print(item); }
#if USING_UTF16 == YES_0
Stringf::Stringf(const CHB* item) : string_(item), count_(0) { Print(item); }
#endif
#if USING_UTF32 == YES_0
Stringf::Stringf(const CHC* item) : string_(item), count_(0) { Print(item); }
#endif
Stringf::Stringf(CHA item) : string_(boofer_), count_(0) { Print(item); }
Stringf::Stringf(CHB item) : string_(boofer_), count_(0) { Print(item); }
Stringf::Stringf(CHC item) : string_(boofer_), count_(0) { Print(item); }
Stringf::Stringf(ISC item) : string_(boofer_), count_(0) { Print(item); }
Stringf::Stringf(IUC item) : string_(boofer_), count_(0) { Print(item); }
Stringf::Stringf(ISD item) : string_(boofer_), count_(0) { Print(item); }
Stringf::Stringf(IUD item) : string_(boofer_), count_(0) { Print(item); }
#if USING_FPC == YES_0
Stringf::Stringf(FPC item) : string_(boofer_), count_(0) { Print(item); }
#endif
#if USING_FPD == YES_0
Stringf::Stringf(FPD item) : string_(boofer_), count_(0) { Print(item); }
#endif
Stringf::Stringf(const CHA* item, ISW count) : string_(item), count_(count) {
Print(item);
}
#if USING_UTF16 == YES_0
Stringf::Stringf(const CHB* item, ISW count) : string_(item), count_(count) {
Print(item);
}
#endif
#if USING_UTF32 == YES_0
Stringf::Stringf(const CHC* item, ISW count) : string_(item), count_(count) {
Print(item);
}
#endif
Stringf::Stringf(CHA item, ISW count) : string_(boofer_), count_(count) {
Print(item);
}
Stringf::Stringf(CHB item, ISW count) : string_(boofer_), count_(count) {
Print(item);
}
Stringf::Stringf(CHC item, ISW count) : string_(boofer_), count_(count) {
Print(item);
}
Stringf::Stringf(ISC item, ISW count) : string_(boofer_), count_(count) {
Print(item);
}
Stringf::Stringf(IUC item, ISW count) : string_(boofer_), count_(count) {
Print(item);
}
Stringf::Stringf(ISD item, ISW count) : string_(boofer_), count_(count) {
Print(item);
}
Stringf::Stringf(IUD item, ISW count) : string_(boofer_), count_(count) {
Print(item);
}
#if USING_FPC == YES_0
Stringf::Stringf(FPC item, ISW count) : string_(boofer_), count_(count) {
Print(item);
}
#endif
#if USING_FPD == YES_0
Stringf::Stringf(FPD item, ISW count) : string_(boofer_), count_(count) {
Print(item);
}
#endif
IUW Stringf::Word() { return boofer_[0]; }
void* Stringf::Value() { return boofer_; }
void* Stringf::Ptr() { return TPtr<void>(boofer_[0]); }
const CHA* Stringf::STA() { return TPtr<const CHA>(string_); }
const CHB* Stringf::STB() { return TPtr<const CHB>(string_); }
const CHC* Stringf::STC() { return TPtr<const CHC>(string_); }
ISW Stringf::Type() { return type_; }
ISW Stringf::Count() { return count_; }
void Stringf::Print(const CHA* item) {
type_ = _STA;
string_ = item;
}
#if USING_UTF16 == YES_0
void Stringf::Print(const CHB* item) {
type_ = _STB;
string_ = item;
}
#endif
#if USING_UTF32 == YES_0
void Stringf::Print(const CHC* item) {
type_ = _STC;
string_ = item;
}
#endif
void Stringf::Print(CHA item) {
CHA* boofer = TPtr<CHA>(boofer_);
::_::SPrint(boofer, boofer + LengthMax, item);
type_ = _STA;
string_ = boofer_;
}
#if USING_UTF16 == YES_0
void Stringf::Print(CHB item) {
CHA* boofer = TPtr<CHA>(boofer_);
::_::SPrint(boofer, boofer + LengthMax, item);
type_ = _STA;
string_ = boofer_;
}
#endif
#if USING_UTF32 == YES_0
void Stringf::Print(CHC item) {
CHA* boofer = TPtr<CHA>(boofer_);
::_::SPrint(boofer, boofer + LengthMax, item);
type_ = _STA;
string_ = boofer;
}
#endif
void Stringf::Print(ISC item) {
CHA* boofer = TPtr<CHA>(boofer_);
#if SEAM >= SCRIPT2_ITOS
::_::TSPrint<CHA>(boofer, boofer + LengthMax, item);
#endif
type_ = _STA;
string_ = boofer;
}
void Stringf::Print(IUC item) {
CHA* boofer = TPtr<CHA>(boofer_);
#if SEAM >= SCRIPT2_ITOS
::_::TSPrint<CHA>(boofer, boofer + LengthMax, item);
#endif
type_ = _STA;
string_ = boofer;
}
void Stringf::Print(ISD item) {
CHA* boofer = TPtr<CHA>(boofer_);
#if SEAM >= SCRIPT2_ITOS
::_::TSPrint<CHA>(boofer, boofer + LengthMax, item);
#endif
type_ = _STA;
string_ = boofer;
}
void Stringf::Print(IUD item) {
CHA* boofer = TPtr<CHA>(boofer_);
#if SEAM >= SCRIPT2_ITOS
::_::TSPrint<CHA>(boofer, boofer + LengthMax, item);
#endif
type_ = _STA;
string_ = boofer;
}
#if USING_FPC == YES_0
void Stringf::Print(FPC item) {
CHA* boofer = TPtr<CHA>(boofer_);
::_::TSPrint<CHA>(boofer, boofer + LengthMax, item);
type_ = _STA;
string_ = boofer;
}
#endif
#if USING_FPD == YES_0
void Stringf::Print(FPD item) {
CHA* boofer = TPtr<CHA>(boofer_);
::_::TSPrint<CHA>(boofer, boofer + LengthMax, item);
type_ = _STA;
string_ = boofer;
}
#endif
/*
void Stringf::PrintTMC(TMC item) {}
void Stringf::PrintTME(TMC item, IUC subsecond_tick) {}
void Stringf::PrintTMD(TMD item) {}
void Stringf::Print(ATypef item) {
CHA* boofer = TPtr<CHA>(boofer_);
#if SEAM >= SCRIPT2_ITOS
::_::TSPrint<CHA>(boofer, boofer + LengthMax, item);
#endif
type_ = item.type;
string_ = boofer;
}
void Stringf::Print(TypeValue item) {
DTW type = item.Type();
type_ = type;
static const CHA NotSupported[] = "Not supported\0";
DTW pod_type = type & ATypePODMask;
if (type != pod_type) { // It's not a POD type.
}
switch (type) {
case _NIL:
// CHC c = 2205; // Empty-set Unicode character.
return;
case _CHA:
Print(CHA(item.ToIUA()));
return;
case _ISA:
Print(ISA(item.ToIUA()));
return;
case _IUA:
Print((item.ToIUA()));
return;
case _CHB:
Print(CHB(item.ToIUB()));
return;
case _ISB:
Print(ISB(item.ToIUB()));
return;
case _IUB:
Print(item.ToIUB());
return;
case _FPB:
Print(item.ToIUB());
return;
case _CHC:
Print(CHC(item.ToIUC()));
return;
case _ISC:
Print(ISC(item.ToIUC()));
return;
case _IUC:
Print(IUC(item.ToIUC()));
return;
case _FPC:
#if USING_FPC == YES_0
Print(ToFloat(item.ToIUC()));
#endif
return;
case _TME:
PrintTME(ISC(item.Word()), IUC(item.Word2()));
case _ISD:
Print(ISD(item.ToUID()));
return;
case _IUD:
Print(item.ToUID());
return;
case _FPD:
#if USING_FPD == YES_0
Print(ToFloat(item.ToUID()));
#endif
return;
}
string_ = NotSupported;
}
Stringf::Stringf(ATypef item, ISW count) : string_(boofer_), count_(count) {
Print(item);
}
Stringf::Stringf(TypeValue item, ISW count) : string_(boofer_), count_(count) {
Print(item);
}*/
void Stringf::Hex(CHA item, ISW count) {
*TPtr<CHA>(boofer_) = item;
type_ = _CHA;
count_ = -count;
}
#if USING_UTF16 == YES_0
void Stringf::Hex(CHB item, ISW count) {
*TPtr<CHB>(boofer_) = item;
type_ = _CHB;
count_ = -count;
}
#endif
#if USING_UTF32 == YES_0
void Stringf::Hex(CHC item, ISW count) {
*TPtr<CHC>(boofer_) = item;
type_ = _CHC;
count_ = -count;
}
#endif
void Stringf::Hex(ISA item, ISW count) {
*TPtr<ISA>(boofer_) = item;
type_ = _ISA;
count_ = -count;
}
void Stringf::Hex(IUA item, ISW count) {
*TPtr<IUA>(boofer_) = item;
type_ = _IUA;
count_ = -count;
}
void Stringf::Hex(ISB item, ISW count) {
*TPtr<ISB>(boofer_) = item;
type_ = _ISB;
count_ = -count;
}
void Stringf::Hex(IUB item, ISW count) {
*TPtr<IUB>(boofer_) = item;
type_ = _IUB;
count_ = -count;
}
void Stringf::Hex(ISC item, ISW count) {
*TPtr<ISC>(boofer_) = item;
type_ = _ISC;
count_ = -count;
}
void Stringf::Hex(IUC item, ISW count) {
*TPtr<IUC>(boofer_) = item;
type_ = _IUC;
count_ = -count;
}
void Stringf::Hex(ISD item, ISW count) {
*TPtr<ISD>(boofer_) = item;
type_ = _ISD;
count_ = -count;
}
void Stringf::Hex(IUD item, ISW count) {
*TPtr<IUD>(boofer_) = item;
type_ = _IUD;
count_ = -count;
}
#if USING_FPC == YES_0
void Stringf::Hex(FPC item, ISW count) {
*TPtr<FPC>(boofer_) = item;
type_ = _FPC;
count_ = -count;
}
#endif
#if USING_FPD == YES_0
void Stringf::Hex(FPD item, ISW count) {
*TPtr<FPD>(boofer_) = item;
type_ = _FPD;
count_ = -count;
}
#endif
Centerf::Centerf() {}
#if USING_UTF8 == YES_0
Centerf::Centerf(CHA item, ISW count) : element(item, count) {}
Centerf::Centerf(const CHA* item, ISW count) : element(item, count) {}
#endif
#if USING_UTF16 == YES_0
Centerf::Centerf(CHB item, ISW count) : element(item, count) {}
Centerf::Centerf(const CHB* item, ISW count) : element(item, count) {}
#endif
#if USING_UTF32 == YES_0
Centerf::Centerf(CHC item, ISW count) : element(item, count) {}
Centerf::Centerf(const CHC* item, ISW count) : element(item, count) {}
#endif
Centerf::Centerf(ISC item, ISW count) : element(item, count) {}
Centerf::Centerf(IUC item, ISW count) : element(item, count) {}
Centerf::Centerf(ISD item, ISW count) : element(item, count) {}
#if USING_FPC == YES_0
Centerf::Centerf(FPC item, ISW count) : element(item, count) {}
#endif
#if USING_FPD == YES_0
Centerf::Centerf(FPD item, ISW count) : element(item, count) {}
#endif
Centerf::Centerf(IUD item, ISW count) : element(item, count) {}
//Centerf::Centerf(ATypef item, ISW count) : element(item, count) {}
Centerf& Centerf::Hex(CHA item, ISW count) {
element.Hex(item, count);
return *this;
}
#if USING_UTF16 == YES_0
Centerf& Centerf::Hex(CHB item, ISW count) {
element.Hex(item, count);
return *this;
}
#endif
#if USING_UTF32 == YES_0
Centerf& Centerf::Hex(CHC item, ISW count) {