-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhaxe.py
More file actions
6784 lines (6021 loc) · 252 KB
/
haxe.py
File metadata and controls
6784 lines (6021 loc) · 252 KB
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
from _hx_AnonObject import _hx_AnonObject
import sys
import _hx_AnonObject as anon
import globalClasses
import sys
from classes_hscript import _Xml_XmlType_Impl_, StringBuf, StringTools, Xml
from classes_hscript import Enum
from classes_hscript import EReg
from classes_hscript import HxOverrides
from classes_hscript import HxString
from classes_hscript import Std
from classes_hscript import Type
from io import StringIO as python_lib_io_StringIO
import functools as python_lib_Functools
from classes_hscript import HxString
import math as Math
import math as python_lib_Math
import re as python_lib_Re
from classes_hscript import Reflect
import sys as python_lib_Sys
import traceback as python_lib_Traceback
class haxe_Exception(Exception):
_hx_class_name = "haxe.Exception"
__slots__ = ("_hx___exceptionStack", "_hx___nativeStack", "_hx___skipStack", "_hx___nativeException", "_hx___previousException")
_hx_fields = ["__exceptionStack", "__nativeStack", "__skipStack", "__nativeException", "__previousException"]
_hx_methods = ["unwrap", "toString", "details", "__shiftStack", "get_message", "get_previous", "get_native", "get_stack"]
_hx_statics = ["caught", "thrown"]
_hx_interfaces = []
_hx_super = Exception
def __init__(self,message,previous = None,native = None):
self._hx___previousException = None
self._hx___nativeException = None
self._hx___nativeStack = None
self._hx___exceptionStack = None
self._hx___skipStack = 0
super().__init__(message)
self._hx___previousException = previous
if ((native is not None) and Std.isOfType(native,BaseException)):
self._hx___nativeException = native
self._hx___nativeStack = haxe_NativeStackTrace.exceptionStack()
else:
self._hx___nativeException = self
infos = python_lib_Traceback.extract_stack()
if (len(infos) != 0):
infos.pop()
infos.reverse()
self._hx___nativeStack = infos
def unwrap(self):
return self._hx___nativeException
def toString(self):
return self.get_message()
def details(self):
if (self.get_previous() is None):
tmp = ("Exception: " + HxOverrides.stringOrNull(self.toString()))
tmp1 = self.get_stack()
return (("null" if tmp is None else tmp) + HxOverrides.stringOrNull((("null" if ((tmp1 is None)) else haxe__CallStack_CallStack_Impl_.toString(tmp1)))))
else:
result = ""
e = self
prev = None
while (e is not None):
if (prev is None):
result1 = ("Exception: " + HxOverrides.stringOrNull(e.get_message()))
tmp = e.get_stack()
result = ((("null" if result1 is None else result1) + HxOverrides.stringOrNull((("null" if ((tmp is None)) else haxe__CallStack_CallStack_Impl_.toString(tmp))))) + ("null" if result is None else result))
else:
prevStack = haxe__CallStack_CallStack_Impl_.subtract(e.get_stack(),prev.get_stack())
result = (((("Exception: " + HxOverrides.stringOrNull(e.get_message())) + HxOverrides.stringOrNull((("null" if ((prevStack is None)) else haxe__CallStack_CallStack_Impl_.toString(prevStack))))) + "\n\nNext ") + ("null" if result is None else result))
prev = e
e = e.get_previous()
return result
def _hx___shiftStack(self):
_hx_local_0 = self
_hx_local_1 = _hx_local_0._hx___skipStack
_hx_local_0._hx___skipStack = (_hx_local_1 + 1)
_hx_local_1
def get_message(self):
return str(self)
def get_previous(self):
return self._hx___previousException
def get_native(self):
return self._hx___nativeException
def get_stack(self):
_g = self._hx___exceptionStack
if (_g is None):
def _hx_local_1():
def _hx_local_0():
self._hx___exceptionStack = haxe_NativeStackTrace.toHaxe(self._hx___nativeStack,self._hx___skipStack)
return self._hx___exceptionStack
return _hx_local_0()
return _hx_local_1()
else:
s = _g
return s
@staticmethod
def caught(value):
if Std.isOfType(value,haxe_Exception):
return value
elif Std.isOfType(value,BaseException):
return haxe_Exception(str(value),None,value)
else:
return haxe_ValueException(value,None,value)
@staticmethod
def thrown(value):
if Std.isOfType(value,haxe_Exception):
return value.get_native()
elif Std.isOfType(value,BaseException):
return value
else:
e = haxe_ValueException(value)
e._hx___skipStack = (e._hx___skipStack + 1)
return e
@staticmethod
def _hx_empty_init(_hx_o):
_hx_o._hx___exceptionStack = None
_hx_o._hx___nativeStack = None
_hx_o._hx___skipStack = None
_hx_o._hx___nativeException = None
_hx_o._hx___previousException = None
haxe_Exception._hx_class = haxe_Exception
globalClasses._hx_classes["haxe.Exception"] = haxe_Exception
class haxe_IMap:
_hx_class_name = "haxe.IMap"
__slots__ = ()
_hx_methods = ["get", "set", "exists", "remove", "keys", "iterator", "keyValueIterator", "copy", "toString", "clear"]
haxe_IMap._hx_class = haxe_IMap
globalClasses._hx_classes["haxe.IMap"] = haxe_IMap
class haxe_Int64Helper:
_hx_class_name = "haxe.Int64Helper"
__slots__ = ()
_hx_statics = ["parseString", "fromFloat"]
@staticmethod
def parseString(sParam):
base_high = 0
base_low = 10
this1 = haxe__Int64____Int64(0,0)
current = this1
this1 = haxe__Int64____Int64(0,1)
multiplier = this1
sIsNegative = False
s = StringTools.trim(sParam)
if ((("" if ((0 >= len(s))) else s[0])) == "-"):
sIsNegative = True
s = HxString.substring(s,1,len(s))
_hx_len = len(s)
_g = 0
_g1 = _hx_len
while (_g < _g1):
i = _g
_g = (_g + 1)
digitInt = (HxString.charCodeAt(s,((_hx_len - 1) - i)) - 48)
if ((digitInt < 0) or ((digitInt > 9))):
raise haxe_Exception.thrown("NumberFormatError")
if (digitInt != 0):
digit_high = (digitInt >> 31)
digit_low = digitInt
if sIsNegative:
mask = 65535
al = (multiplier.low & mask)
ah = HxOverrides.rshift(multiplier.low, 16)
bl = (digit_low & mask)
bh = HxOverrides.rshift(digit_low, 16)
p00 = haxe__Int32_Int32_Impl_.mul(al,bl)
p10 = haxe__Int32_Int32_Impl_.mul(ah,bl)
p01 = haxe__Int32_Int32_Impl_.mul(al,bh)
p11 = haxe__Int32_Int32_Impl_.mul(ah,bh)
low = p00
high = ((((((p11 + (HxOverrides.rshift(p01, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + (HxOverrides.rshift(p10, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
p01 = ((((p01 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
low = (((low + p01) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
if (haxe__Int32_Int32_Impl_.ucompare(low,p01) < 0):
ret = high
high = (high + 1)
high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31))
p10 = ((((p10 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
low = (((low + p10) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
if (haxe__Int32_Int32_Impl_.ucompare(low,p10) < 0):
ret1 = high
high = (high + 1)
high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31))
high = (((high + ((((haxe__Int32_Int32_Impl_.mul(multiplier.low,digit_high) + haxe__Int32_Int32_Impl_.mul(multiplier.high,digit_low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
b_high = high
b_low = low
high1 = (((current.high - b_high) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
low1 = (((current.low - b_low) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
if (haxe__Int32_Int32_Impl_.ucompare(current.low,b_low) < 0):
ret2 = high1
high1 = (high1 - 1)
high1 = ((high1 + (2 ** 31)) % (2 ** 32) - (2 ** 31))
this1 = haxe__Int64____Int64(high1,low1)
current = this1
if (not ((current.high < 0))):
raise haxe_Exception.thrown("NumberFormatError: Underflow")
else:
mask1 = 65535
al1 = (multiplier.low & mask1)
ah1 = HxOverrides.rshift(multiplier.low, 16)
bl1 = (digit_low & mask1)
bh1 = HxOverrides.rshift(digit_low, 16)
p001 = haxe__Int32_Int32_Impl_.mul(al1,bl1)
p101 = haxe__Int32_Int32_Impl_.mul(ah1,bl1)
p011 = haxe__Int32_Int32_Impl_.mul(al1,bh1)
p111 = haxe__Int32_Int32_Impl_.mul(ah1,bh1)
low2 = p001
high2 = ((((((p111 + (HxOverrides.rshift(p011, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + (HxOverrides.rshift(p101, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
p011 = ((((p011 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
low2 = (((low2 + p011) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
if (haxe__Int32_Int32_Impl_.ucompare(low2,p011) < 0):
ret3 = high2
high2 = (high2 + 1)
high2 = ((high2 + (2 ** 31)) % (2 ** 32) - (2 ** 31))
p101 = ((((p101 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
low2 = (((low2 + p101) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
if (haxe__Int32_Int32_Impl_.ucompare(low2,p101) < 0):
ret4 = high2
high2 = (high2 + 1)
high2 = ((high2 + (2 ** 31)) % (2 ** 32) - (2 ** 31))
high2 = (((high2 + ((((haxe__Int32_Int32_Impl_.mul(multiplier.low,digit_high) + haxe__Int32_Int32_Impl_.mul(multiplier.high,digit_low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
b_high1 = high2
b_low1 = low2
high3 = (((current.high + b_high1) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
low3 = (((current.low + b_low1) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
if (haxe__Int32_Int32_Impl_.ucompare(low3,current.low) < 0):
ret5 = high3
high3 = (high3 + 1)
high3 = ((high3 + (2 ** 31)) % (2 ** 32) - (2 ** 31))
this2 = haxe__Int64____Int64(high3,low3)
current = this2
if (current.high < 0):
raise haxe_Exception.thrown("NumberFormatError: Overflow")
mask2 = 65535
al2 = (multiplier.low & mask2)
ah2 = HxOverrides.rshift(multiplier.low, 16)
bl2 = (base_low & mask2)
bh2 = HxOverrides.rshift(base_low, 16)
p002 = haxe__Int32_Int32_Impl_.mul(al2,bl2)
p102 = haxe__Int32_Int32_Impl_.mul(ah2,bl2)
p012 = haxe__Int32_Int32_Impl_.mul(al2,bh2)
p112 = haxe__Int32_Int32_Impl_.mul(ah2,bh2)
low4 = p002
high4 = ((((((p112 + (HxOverrides.rshift(p012, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + (HxOverrides.rshift(p102, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
p012 = ((((p012 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
low4 = (((low4 + p012) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
if (haxe__Int32_Int32_Impl_.ucompare(low4,p012) < 0):
ret6 = high4
high4 = (high4 + 1)
high4 = ((high4 + (2 ** 31)) % (2 ** 32) - (2 ** 31))
p102 = ((((p102 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
low4 = (((low4 + p102) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
if (haxe__Int32_Int32_Impl_.ucompare(low4,p102) < 0):
ret7 = high4
high4 = (high4 + 1)
high4 = ((high4 + (2 ** 31)) % (2 ** 32) - (2 ** 31))
high4 = (((high4 + ((((haxe__Int32_Int32_Impl_.mul(multiplier.low,base_high) + haxe__Int32_Int32_Impl_.mul(multiplier.high,base_low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
this3 = haxe__Int64____Int64(high4,low4)
multiplier = this3
return current
@staticmethod
def fromFloat(f):
if (python_lib_Math.isnan(f) or (not ((((f != Math.POSITIVE_INFINITY) and ((f != Math.NEGATIVE_INFINITY))) and (not python_lib_Math.isnan(f)))))):
raise haxe_Exception.thrown("Number is NaN or Infinite")
noFractions = (f - (HxOverrides.modf(f, 1)))
if (noFractions > 9007199254740991):
raise haxe_Exception.thrown("Conversion overflow")
if (noFractions < -9007199254740991):
raise haxe_Exception.thrown("Conversion underflow")
this1 = haxe__Int64____Int64(0,0)
result = this1
neg = (noFractions < 0)
rest = (-noFractions if neg else noFractions)
i = 0
while (rest >= 1):
curr = HxOverrides.modf(rest, 2)
rest = (rest / 2)
if (curr >= 1):
a_high = 0
a_low = 1
b = i
b = (b & 63)
b1 = None
if (b == 0):
this1 = haxe__Int64____Int64(a_high,a_low)
b1 = this1
elif (b < 32):
this2 = haxe__Int64____Int64(((((((((a_high << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(a_low, ((32 - b))))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((a_low << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))
b1 = this2
else:
this3 = haxe__Int64____Int64(((((a_low << ((b - 32)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),0)
b1 = this3
high = (((result.high + b1.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
low = (((result.low + b1.low) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
if (haxe__Int32_Int32_Impl_.ucompare(low,result.low) < 0):
ret = high
high = (high + 1)
high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31))
this4 = haxe__Int64____Int64(high,low)
result = this4
i = (i + 1)
if neg:
high = ((~result.high + (2 ** 31)) % (2 ** 32) - (2 ** 31))
low = (((~result.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
if (low == 0):
ret = high
high = (high + 1)
high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31))
this1 = haxe__Int64____Int64(high,low)
result = this1
return result
haxe_Int64Helper._hx_class = haxe_Int64Helper
globalClasses._hx_classes["haxe.Int64Helper"] = haxe_Int64Helper
class haxe_Log:
_hx_class_name = "haxe.Log"
__slots__ = ()
_hx_statics = ["formatOutput", "trace"]
@staticmethod
def formatOutput(v,infos):
_hx_str = Std.string(v)
if (infos is None):
return _hx_str
pstr = ((HxOverrides.stringOrNull(infos.fileName) + ":") + Std.string(infos.lineNumber))
if (Reflect.field(infos,"customParams") is not None):
_g = 0
_g1 = Reflect.field(infos,"customParams")
while (_g < len(_g1)):
v = (_g1[_g] if _g >= 0 and _g < len(_g1) else None)
_g = (_g + 1)
_hx_str = (("null" if _hx_str is None else _hx_str) + ((", " + Std.string(v))))
return ((("null" if pstr is None else pstr) + ": ") + ("null" if _hx_str is None else _hx_str))
@staticmethod
def trace(v,infos = None):
from python import python_Lib
_hx_str = haxe_Log.formatOutput(v,infos)
str1 = Std.string(_hx_str)
python_Lib.printString((("" + ("null" if str1 is None else str1)) + HxOverrides.stringOrNull(python_Lib.lineEnd)))
haxe_Log._hx_class = haxe_Log
globalClasses._hx_classes["haxe.Log"] = haxe_Log
class haxe_NativeStackTrace:
_hx_class_name = "haxe.NativeStackTrace"
__slots__ = ()
_hx_statics = ["saveStack", "callStack", "exceptionStack", "toHaxe"]
@staticmethod
def saveStack(exception):
pass
@staticmethod
def callStack():
infos = python_lib_Traceback.extract_stack()
if (len(infos) != 0):
infos.pop()
infos.reverse()
return infos
@staticmethod
def exceptionStack():
exc = python_lib_Sys.exc_info()
if (exc[2] is not None):
infos = python_lib_Traceback.extract_tb(exc[2])
infos.reverse()
return infos
else:
return []
@staticmethod
def toHaxe(native,skip = None):
if (skip is None):
skip = 0
stack = []
_g = 0
_g1 = len(native)
while (_g < _g1):
i = _g
_g = (_g + 1)
if (skip > i):
continue
elem = (native[i] if i >= 0 and i < len(native) else None)
x = haxe_StackItem.FilePos(haxe_StackItem.Method(None,elem[2]),elem[0],elem[1])
stack.append(x)
return stack
haxe_NativeStackTrace._hx_class = haxe_NativeStackTrace
globalClasses._hx_classes["haxe.NativeStackTrace"] = haxe_NativeStackTrace
class haxe_StackItem(Enum):
__slots__ = ()
_hx_class_name = "haxe.StackItem"
_hx_constructs = ["CFunction", "Module", "FilePos", "Method", "LocalFunction"]
@staticmethod
def Module(m):
return haxe_StackItem("Module", 1, (m,))
@staticmethod
def FilePos(s,file,line,column = None):
return haxe_StackItem("FilePos", 2, (s,file,line,column))
@staticmethod
def Method(classname,method):
return haxe_StackItem("Method", 3, (classname,method))
@staticmethod
def LocalFunction(v = None):
return haxe_StackItem("LocalFunction", 4, (v,))
haxe_StackItem.CFunction = haxe_StackItem("CFunction", 0, ())
haxe_StackItem._hx_class = haxe_StackItem
globalClasses._hx_classes["haxe.StackItem"] = haxe_StackItem
class haxe_SysTools:
_hx_class_name = "haxe.SysTools"
__slots__ = ()
_hx_statics = ["winMetaCharacters", "quoteUnixArg", "quoteWinArg"]
@staticmethod
def quoteUnixArg(argument):
if (argument == ""):
return "''"
_this = EReg("[^a-zA-Z0-9_@%+=:,./-]","")
_this.matchObj = python_lib_Re.search(_this.pattern,argument)
if (_this.matchObj is None):
return argument
return (("'" + HxOverrides.stringOrNull(StringTools.replace(argument,"'","'\"'\"'"))) + "'")
@staticmethod
def quoteWinArg(argument,escapeMetaCharacters):
_this = EReg("^[^ \t\\\\\"]+$","")
_this.matchObj = python_lib_Re.search(_this.pattern,argument)
if (_this.matchObj is None):
result_b = python_lib_io_StringIO()
needquote = None
startIndex = None
if (((argument.find(" ") if ((startIndex is None)) else HxString.indexOfImpl(argument," ",startIndex))) == -1):
startIndex = None
needquote = (((argument.find("\t") if ((startIndex is None)) else HxString.indexOfImpl(argument,"\t",startIndex))) != -1)
else:
needquote = True
needquote1 = (needquote or ((argument == "")))
if needquote1:
result_b.write("\"")
bs_buf = StringBuf()
_g = 0
_g1 = len(argument)
while (_g < _g1):
i = _g
_g = (_g + 1)
_g2 = HxString.charCodeAt(argument,i)
if (_g2 is None):
c = _g2
if (bs_buf.get_length() > 0):
result_b.write(Std.string(bs_buf.b.getvalue()))
bs_buf = StringBuf()
result_b.write("".join(map(chr,[c])))
else:
_g3 = _g2
if (_g3 == 34):
bs = bs_buf.b.getvalue()
result_b.write(Std.string(bs))
result_b.write(Std.string(bs))
bs_buf = StringBuf()
result_b.write("\\\"")
elif (_g3 == 92):
bs_buf.b.write("\\")
else:
c1 = _g2
if (bs_buf.get_length() > 0):
result_b.write(Std.string(bs_buf.b.getvalue()))
bs_buf = StringBuf()
result_b.write("".join(map(chr,[c1])))
result_b.write(Std.string(bs_buf.b.getvalue()))
if needquote1:
result_b.write(Std.string(bs_buf.b.getvalue()))
result_b.write("\"")
argument = result_b.getvalue()
if escapeMetaCharacters:
from python import python_internal_ArrayImpl
result_b = python_lib_io_StringIO()
_g = 0
_g1 = len(argument)
while (_g < _g1):
i = _g
_g = (_g + 1)
c = HxString.charCodeAt(argument,i)
if (python_internal_ArrayImpl.indexOf(haxe_SysTools.winMetaCharacters,c,None) >= 0):
result_b.write("".join(map(chr,[94])))
result_b.write("".join(map(chr,[c])))
return result_b.getvalue()
else:
return argument
haxe_SysTools._hx_class = haxe_SysTools
globalClasses._hx_classes["haxe.SysTools"] = haxe_SysTools
class haxe_ValueException(haxe_Exception):
_hx_class_name = "haxe.ValueException"
__slots__ = ("value",)
_hx_fields = ["value"]
_hx_methods = ["unwrap"]
_hx_statics = []
_hx_interfaces = []
_hx_super = haxe_Exception
def __init__(self,value,previous = None,native = None):
self.value = None
super().__init__(Std.string(value),previous,native)
self.value = value
_hx_local_0 = self
_hx_local_1 = _hx_local_0._hx___skipStack
_hx_local_0._hx___skipStack = (_hx_local_1 + 1)
_hx_local_1
def unwrap(self):
return self.value
@staticmethod
def _hx_empty_init(_hx_o):
_hx_o.value = None
haxe_ValueException._hx_class = haxe_ValueException
globalClasses._hx_classes["haxe.ValueException"] = haxe_ValueException
class haxe__CallStack_CallStack_Impl_:
_hx_class_name = "haxe._CallStack.CallStack_Impl_"
__slots__ = ()
_hx_statics = ["get_length", "callStack", "exceptionStack", "toString", "subtract", "copy", "get", "asArray", "equalItems", "exceptionToString", "itemToString"]
length = None
@staticmethod
def get_length(this1):
return len(this1)
@staticmethod
def callStack():
infos = python_lib_Traceback.extract_stack()
if (len(infos) != 0):
infos.pop()
infos.reverse()
return haxe_NativeStackTrace.toHaxe(infos)
@staticmethod
def exceptionStack(fullStack = None):
if (fullStack is None):
fullStack = False
eStack = haxe_NativeStackTrace.toHaxe(haxe_NativeStackTrace.exceptionStack())
return (eStack if fullStack else haxe__CallStack_CallStack_Impl_.subtract(eStack,haxe__CallStack_CallStack_Impl_.callStack()))
@staticmethod
def toString(stack):
b = StringBuf()
_g = 0
_g1 = stack
while (_g < len(_g1)):
s = (_g1[_g] if _g >= 0 and _g < len(_g1) else None)
_g = (_g + 1)
b.b.write("\nCalled from ")
haxe__CallStack_CallStack_Impl_.itemToString(b,s)
return b.b.getvalue()
@staticmethod
def subtract(this1,stack):
from python import python_internal_ArrayImpl
startIndex = -1
i = -1
while True:
i = (i + 1)
tmp = i
if (not ((tmp < len(this1)))):
break
_g = 0
_g1 = len(stack)
while (_g < _g1):
j = _g
_g = (_g + 1)
if haxe__CallStack_CallStack_Impl_.equalItems((this1[i] if i >= 0 and i < len(this1) else None),python_internal_ArrayImpl._get(stack, j)):
if (startIndex < 0):
startIndex = i
i = (i + 1)
if (i >= len(this1)):
break
else:
startIndex = -1
if (startIndex >= 0):
break
if (startIndex >= 0):
return this1[0:startIndex]
else:
return this1
@staticmethod
def copy(this1):
return list(this1)
@staticmethod
def get(this1,index):
return (this1[index] if index >= 0 and index < len(this1) else None)
@staticmethod
def asArray(this1):
return this1
@staticmethod
def equalItems(item1,item2):
if (item1 is None):
if (item2 is None):
return True
else:
return False
else:
tmp = item1.index
if (tmp == 0):
if (item2 is None):
return False
elif (item2.index == 0):
return True
else:
return False
elif (tmp == 1):
if (item2 is None):
return False
elif (item2.index == 1):
m2 = item2.params[0]
m1 = item1.params[0]
return (m1 == m2)
else:
return False
elif (tmp == 2):
if (item2 is None):
return False
elif (item2.index == 2):
item21 = item2.params[0]
file2 = item2.params[1]
line2 = item2.params[2]
col2 = item2.params[3]
col1 = item1.params[3]
line1 = item1.params[2]
file1 = item1.params[1]
item11 = item1.params[0]
if (((file1 == file2) and ((line1 == line2))) and ((col1 == col2))):
return haxe__CallStack_CallStack_Impl_.equalItems(item11,item21)
else:
return False
else:
return False
elif (tmp == 3):
if (item2 is None):
return False
elif (item2.index == 3):
class2 = item2.params[0]
method2 = item2.params[1]
method1 = item1.params[1]
class1 = item1.params[0]
if (class1 == class2):
return (method1 == method2)
else:
return False
else:
return False
elif (tmp == 4):
if (item2 is None):
return False
elif (item2.index == 4):
v2 = item2.params[0]
v1 = item1.params[0]
return (v1 == v2)
else:
return False
else:
pass
@staticmethod
def exceptionToString(e):
if (e.get_previous() is None):
tmp = ("Exception: " + HxOverrides.stringOrNull(e.toString()))
tmp1 = e.get_stack()
return (("null" if tmp is None else tmp) + HxOverrides.stringOrNull((("null" if ((tmp1 is None)) else haxe__CallStack_CallStack_Impl_.toString(tmp1)))))
result = ""
e1 = e
prev = None
while (e1 is not None):
if (prev is None):
result1 = ("Exception: " + HxOverrides.stringOrNull(e1.get_message()))
tmp = e1.get_stack()
result = ((("null" if result1 is None else result1) + HxOverrides.stringOrNull((("null" if ((tmp is None)) else haxe__CallStack_CallStack_Impl_.toString(tmp))))) + ("null" if result is None else result))
else:
prevStack = haxe__CallStack_CallStack_Impl_.subtract(e1.get_stack(),prev.get_stack())
result = (((("Exception: " + HxOverrides.stringOrNull(e1.get_message())) + HxOverrides.stringOrNull((("null" if ((prevStack is None)) else haxe__CallStack_CallStack_Impl_.toString(prevStack))))) + "\n\nNext ") + ("null" if result is None else result))
prev = e1
e1 = e1.get_previous()
return result
@staticmethod
def itemToString(b,s):
tmp = s.index
if (tmp == 0):
b.b.write("a C function")
elif (tmp == 1):
m = s.params[0]
b.b.write("module ")
s1 = Std.string(m)
b.b.write(s1)
elif (tmp == 2):
s1 = s.params[0]
file = s.params[1]
line = s.params[2]
col = s.params[3]
if (s1 is not None):
haxe__CallStack_CallStack_Impl_.itemToString(b,s1)
b.b.write(" (")
s2 = Std.string(file)
b.b.write(s2)
b.b.write(" line ")
s2 = Std.string(line)
b.b.write(s2)
if (col is not None):
b.b.write(" column ")
s2 = Std.string(col)
b.b.write(s2)
if (s1 is not None):
b.b.write(")")
elif (tmp == 3):
cname = s.params[0]
meth = s.params[1]
s1 = Std.string(("<unknown>" if ((cname is None)) else cname))
b.b.write(s1)
b.b.write(".")
s1 = Std.string(meth)
b.b.write(s1)
elif (tmp == 4):
n = s.params[0]
b.b.write("local function #")
s = Std.string(n)
b.b.write(s)
else:
pass
haxe__CallStack_CallStack_Impl_._hx_class = haxe__CallStack_CallStack_Impl_
globalClasses._hx_classes["haxe._CallStack.CallStack_Impl_"] = haxe__CallStack_CallStack_Impl_
class haxe__Int32_Int32_Impl_:
_hx_class_name = "haxe._Int32.Int32_Impl_"
__slots__ = ()
_hx_statics = ["negate", "preIncrement", "postIncrement", "preDecrement", "postDecrement", "add", "addInt", "sub", "subInt", "intSub", "mul", "mulInt", "complement", "or", "orInt", "xor", "xorInt", "shr", "shrInt", "intShr", "shl", "shlInt", "intShl", "toFloat", "ucompare", "clamp"]
@staticmethod
def negate(this1):
return (((~this1 + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def preIncrement(this1):
this1 = (this1 + 1)
x = this1
this1 = ((x + (2 ** 31)) % (2 ** 32) - (2 ** 31))
return this1
@staticmethod
def postIncrement(this1):
ret = this1
this1 = (this1 + 1)
this1 = ((this1 + (2 ** 31)) % (2 ** 32) - (2 ** 31))
return ret
@staticmethod
def preDecrement(this1):
this1 = (this1 - 1)
x = this1
this1 = ((x + (2 ** 31)) % (2 ** 32) - (2 ** 31))
return this1
@staticmethod
def postDecrement(this1):
ret = this1
this1 = (this1 - 1)
this1 = ((this1 + (2 ** 31)) % (2 ** 32) - (2 ** 31))
return ret
@staticmethod
def add(a,b):
return (((a + b) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def addInt(a,b):
return (((a + b) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def sub(a,b):
return (((a - b) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def subInt(a,b):
return (((a - b) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def intSub(a,b):
return (((a - b) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def mul(a,b):
return ((((a * ((b & 65535))) + ((((((a * (HxOverrides.rshift(b, 16))) << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def mulInt(a,b):
return haxe__Int32_Int32_Impl_.mul(a,b)
@staticmethod
def complement(a):
return ((~a + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def _hx_or(a,b):
return ((((a | b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def orInt(a,b):
return ((((a | b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def xor(a,b):
return ((((a ^ b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def xorInt(a,b):
return ((((a ^ b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def shr(a,b):
return ((((a >> b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def shrInt(a,b):
return ((((a >> b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def intShr(a,b):
return ((((a >> b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def shl(a,b):
return ((((a << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def shlInt(a,b):
return ((((a << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def intShl(a,b):
return ((((a << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def toFloat(this1):
return this1
@staticmethod
def ucompare(a,b):
if (a < 0):
if (b < 0):
return (((((~b + (2 ** 31)) % (2 ** 32) - (2 ** 31)) - (((~a + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
else:
return 1
if (b < 0):
return -1
else:
return (((a - b) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
@staticmethod
def clamp(x):
return ((x + (2 ** 31)) % (2 ** 32) - (2 ** 31))
haxe__Int32_Int32_Impl_._hx_class = haxe__Int32_Int32_Impl_
globalClasses._hx_classes["haxe._Int32.Int32_Impl_"] = haxe__Int32_Int32_Impl_
class haxe__Int64_Int64_Impl_:
_hx_class_name = "haxe._Int64.Int64_Impl_"
__slots__ = ()
_hx_statics = ["_new", "copy", "make", "ofInt", "toInt", "is", "isInt64", "getHigh", "getLow", "isNeg", "isZero", "compare", "ucompare", "toStr", "toString", "parseString", "fromFloat", "divMod", "neg", "preIncrement", "postIncrement", "preDecrement", "postDecrement", "add", "addInt", "sub", "subInt", "intSub", "mul", "mulInt", "div", "divInt", "intDiv", "mod", "modInt", "intMod", "eq", "eqInt", "neq", "neqInt", "lt", "ltInt", "intLt", "lte", "lteInt", "intLte", "gt", "gtInt", "intGt", "gte", "gteInt", "intGte", "complement", "and", "or", "xor", "shl", "shr", "ushr", "get_high", "set_high", "get_low", "set_low"]
high = None
low = None
@staticmethod
def _new(x):
this1 = x
return this1
@staticmethod
def copy(this1):
this2 = haxe__Int64____Int64(this1.high,this1.low)
return this2
@staticmethod
def make(high,low):
this1 = haxe__Int64____Int64(high,low)
return this1
@staticmethod
def ofInt(x):
this1 = haxe__Int64____Int64((x >> 31),x)
return this1
@staticmethod
def toInt(x):
if (x.high != ((((x.low >> 31)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))):
raise haxe_Exception.thrown("Overflow")
return x.low
@staticmethod
def _hx_is(val):
return Std.isOfType(val,haxe__Int64____Int64)
@staticmethod
def isInt64(val):
return Std.isOfType(val,haxe__Int64____Int64)
@staticmethod
def getHigh(x):
return x.high
@staticmethod
def getLow(x):
return x.low
@staticmethod
def isNeg(x):
return (x.high < 0)
@staticmethod
def isZero(x):
b_high = 0
b_low = 0
if (x.high == b_high):
return (x.low == b_low)
else:
return False
@staticmethod
def compare(a,b):
v = (((a.high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31))
if (v == 0):
v = haxe__Int32_Int32_Impl_.ucompare(a.low,b.low)
if (a.high < 0):
if (b.high < 0):
return v
else:
return -1
elif (b.high >= 0):
return v
else:
return 1
@staticmethod
def ucompare(a,b):
v = haxe__Int32_Int32_Impl_.ucompare(a.high,b.high)
if (v != 0):
return v
else:
return haxe__Int32_Int32_Impl_.ucompare(a.low,b.low)
@staticmethod
def toStr(x):
return haxe__Int64_Int64_Impl_.toString(x)
@staticmethod
def toString(this1):
i = this1
b_high = 0
b_low = 0
if ((i.high == b_high) and ((i.low == b_low))):
return "0"
_hx_str = ""
neg = False
if (i.high < 0):
neg = True