1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Copyright 2004-2008 Jean Privat <jean@pryen.org>
4 # Copyright 2006-2008 Floréal Morandat <morandat@lirmm.fr>
6 # This file is free software, which comes along with NIT. This software is
7 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9 # PARTICULAR PURPOSE. You can modify it is you want, provided this header
10 # is kept unaltered, and a notification of the changes is added.
11 # You are allowed to redistribute it and sell it, alone or is a part of
14 # Basic manipulations of strings of characters
18 intrude import collection
# FIXME should be collection::array
24 ###############################################################################
26 ###############################################################################
28 # Common subclass for String and Buffer
29 abstract class AbstractString
30 super AbstractArrayRead[Char]
32 readable private var _items
: NativeString
34 fun chars
: StringCharView is abstract
36 # Access a character at `index` in the string.
38 # assert "abcd"[2] == 'c'
39 redef fun [](index
) do return _items
[index
]
43 # assert "abcd".substring(1, 2) == "bc"
44 # assert "abcd".substring(-1, 2) == "a"
45 # assert "abcd".substring(1, 0) == ""
46 # assert "abcd".substring(2, 5) == "cd"
48 # A `from` index < 0 will be replaced by 0.
49 # Unless a `count` value is > 0 at the same time.
50 # In this case, `from += count` and `count -= from`.
51 fun substring
(from
: Int, count
: Int): String
55 if from
< 0 then from
= 0
56 if count
> length
then count
= length
58 var r
= new Buffer.with_capacity
(count
- from
)
60 r
.chars
.push
(_items
[from
])
69 # Create a substring from `self` beginning at the `from` position
71 # assert "abcd".substring_from(1) == "bcd"
72 # assert "abcd".substring_from(-1) == "abcd"
73 # assert "abcd".substring_from(2) == "cd"
75 # As with substring, a `from` index < 0 will be replaced by 0
76 fun substring_from
(from
: Int): String
79 return substring
(from
, length
- from
)
82 # Does self have a substring `str` starting from position `pos`?
84 # assert "abcd".has_substring("bc",1) == true
85 # assert "abcd".has_substring("bc",2) == false
86 fun has_substring
(str
: String, pos
: Int): Bool
88 var itsindex
= str
.length
- 1
89 var myindex
= pos
+ itsindex
91 var itsitems
= str
._items
92 if myindex
> length
or itsindex
> myindex
then return false
93 var its_index_from
= str
._index_from
94 itsindex
+= its_index_from
95 while itsindex
>= its_index_from
do
96 if myitems
[myindex
] != itsitems
[itsindex
] then return false
103 # Is this string prefixed by `prefix`?
105 # assert "abcd".has_prefix("ab") == true
106 # assert "abcbc".has_prefix("bc") == false
107 # assert "ab".has_prefix("abcd") == false
108 fun has_prefix
(prefix
: String): Bool do return has_substring
(prefix
,0)
110 # Is this string suffixed by `suffix`?
112 # assert "abcd".has_suffix("abc") == false
113 # assert "abcd".has_suffix("bcd") == true
114 fun has_suffix
(suffix
: String): Bool do return has_substring
(suffix
, length
- suffix
.length
)
116 # If `self` contains only digits, return the corresponding integer
118 # assert "123".to_i == 123
119 # assert "-1".to_i == -1
123 return to_s
.to_cstring
.atoi
126 # If `self` contains a float, return the corresponding float
128 # assert "123".to_f == 123.0
129 # assert "-1".to_f == -1.0
130 # assert "-1.2e-3".to_f == -0.0012
134 return to_s
.to_cstring
.atof
137 # If `self` contains only digits and alpha <= 'f', return the corresponding integer.
138 fun to_hex
: Int do return a_to
(16)
140 # If `self` contains only digits and letters, return the corresponding integer in a given base
142 # assert "120".a_to(3) == 15
143 fun a_to
(base
: Int) : Int
170 # Returns `true` if the string contains only Numeric values (and one "," or one "." character)
172 # assert "123".is_numeric == true
173 # assert "1.2".is_numeric == true
174 # assert "1,2".is_numeric == true
175 # assert "1..2".is_numeric == false
178 var has_point_or_comma
= false
183 if (i
== '.' or i
== ',') and not has_point_or_comma
185 has_point_or_comma
= true
194 # A upper case version of `self`
196 # assert "Hello World!".to_upper == "HELLO WORLD!"
199 var s
= new Buffer.with_capacity
(length
)
200 for i
in self.chars
do s
.add
(i
.to_upper
)
204 # A lower case version of `self`
206 # assert "Hello World!".to_lower == "hello world!"
207 fun to_lower
: String
209 var s
= new Buffer.with_capacity
(length
)
210 for i
in self.chars
do s
.add
(i
.to_lower
)
214 # Trims trailing and preceding white spaces
215 # A whitespace is defined as any character which ascii value is less than or equal to 32
217 # assert " Hello World ! ".trim == "Hello World !"
218 # assert "\na\nb\tc\t".trim == "a\nb\tc"
221 if self.length
== 0 then return self.to_s
222 # find position of the first non white space char (ascii < 32) from the start of the string
224 while self.chars
[start_pos
].ascii
<= 32 do
226 if start_pos
== length
then return ""
228 # find position of the first non white space char from the end of the string
229 var end_pos
= length
- 1
230 while self.chars
[end_pos
].ascii
<= 32 do
232 if end_pos
== start_pos
then return self.chars
[start_pos
].to_s
234 return self.substring
(start_pos
, end_pos
- start_pos
+ 1)
246 # Mangle a string to be a unique string only made of alphanumeric characters
247 fun to_cmangle
: String
250 var underscore
= false
251 for c
in self.chars
do
252 if (c
>= 'a' and c
<= 'z') or (c
>='A' and c
<= 'Z') then
258 res
.append
('_'.ascii
.to_s
)
261 if c
>= '0' and c
<= '9' then
264 else if c
== '_' then
269 res
.append
(c
.ascii
.to_s
)
277 # Escape " \ ' and non printable characters using the rules of literal C strings and characters
279 # assert "abAB12<>&".escape_to_c == "abAB12<>&"
280 # assert "\n\"'\\".escape_to_c == "\\n\\\"\\'\\\\"
281 fun escape_to_c
: String
284 for c
in self.chars
do
287 else if c
== '\0' then
289 else if c
== '"' then
291 else if c == '\'' then
293 else if c == '\\
' then
295 else if c.ascii < 32 then
296 b.append("\\{c.ascii.to_base(8, false)}")
304 # Escape additionnal characters
305 # The result might no be legal in C but be used in other languages
307 # assert "ab|\{\}".escape_more_to_c("|\{\}") == "ab\\|\\\{\\\}"
308 fun escape_more_to_c(chars: String): String
311 for c in escape_to_c do
320 # Escape to c plus braces
322 # assert "\n\"'\\\
{\}".escape_to_nit == "\\n\\\
"\\'\\\\\\\{\\\}"
323 fun escape_to_nit
: String do return escape_more_to_c
("\{\}")
325 # Return a string where Nit escape sequences are transformed.
329 # assert s.length == 2
330 # var u = s.unescape_nit
331 # assert u.length == 1
332 # assert u[0].ascii == 10 # (the ASCII value of the "new line" character)
333 fun unescape_nit
: String
335 var res
= new Buffer.with_capacity
(self.length
)
336 var was_slash
= false
338 if not was_slash
then
349 else if c
== 'r' then
351 else if c
== 't' then
353 else if c
== '0' then
363 # Abstract class for the SequenceRead compatible
364 # views on String and Buffer objects
365 abstract class StringCharView
366 super SequenceRead[Char]
368 type SELFTYPE: AbstractString
370 private var target
: SELFTYPE
372 private init(tgt
: SELFTYPE)
377 redef fun is_empty
do return target
.is_empty
379 redef fun length
do return target
.length
381 redef fun iterator
: IndexedIterator[Char] do return self.iterator_from
(0)
383 fun iterator_from
(pos
: Int): IndexedIterator[Char] is abstract
385 redef fun has
(c
: Char): Bool
388 if i
== c
then return true
395 # View on Buffer objects, extends Sequence
396 # for mutation operations
397 abstract class BufferCharView
401 redef type SELFTYPE: Buffer
405 # Immutable strings of characters.
411 redef type OTHER: String
413 # Index in _items of the start of the string
414 readable var _index_from
: Int
416 # Indes in _items of the last item of the string
417 readable var _index_to
: Int
419 redef var chars
: StringCharView = new FlatStringCharView(self)
421 ################################################
422 # AbstractString specific methods #
423 ################################################
425 redef fun [](index
) do
427 # Check that the index (+ index_from) is not larger than indexTo
428 # In other terms, if the index is valid
429 assert (index
+ _index_from
) <= _index_to
430 return _items
[index
+ _index_from
]
433 redef fun substring
(from
: Int, count
: Int): String
439 if count
< 0 then count
= 0
443 var realFrom
= _index_from
+ from
445 if (realFrom
+ count
) > _index_to
then return new String.with_infos
(_items
, _index_to
- realFrom
+ 1, realFrom
, _index_to
)
447 if count
== 0 then return ""
449 var to
= realFrom
+ count
- 1
451 return new String.with_infos
(_items
, to
- realFrom
+ 1, realFrom
, to
)
454 redef fun substring_from
(from
: Int): String
456 if from
> _length
then return ""
457 if from
< 0 then from
= 0
458 return substring
(from
, _length
)
461 redef fun has_substring
(str
: String, pos
: Int): Bool
463 var itsindex
= str
._length
- 1
465 var myindex
= pos
+ itsindex
468 var itsitems
= str
._items
470 if myindex
> _length
or itsindex
> myindex
then return false
472 var itsindexfrom
= str
.index_from
473 itsindex
+= itsindexfrom
474 myindex
+= index_from
476 while itsindex
>= itsindexfrom
do
477 if myitems
[myindex
] != itsitems
[itsindex
] then return false
485 redef fun to_upper
: String
487 var outstr
= calloc_string
(self._length
+ 1)
490 var myitems
= self._items
491 var index_from
= self._index_from
492 var max
= self._index_to
494 while index_from
<= max
do
495 outstr
[out_index
] = myitems
[index_from
].to_upper
500 outstr
[self.length
] = '\0'
502 return outstr
.to_s_with_length
(self._length
)
505 redef fun to_lower
: String
507 var outstr
= calloc_string
(self._length
+ 1)
510 var myitems
= self._items
511 var index_from
= self._index_from
512 var max
= self._index_to
514 while index_from
<= max
do
515 outstr
[out_index
] = myitems
[index_from
].to_lower
520 outstr
[self.length
] = '\0'
522 return outstr
.to_s_with_length
(self._length
)
525 redef fun trim
: String
527 if self._length
== 0 then return self
528 # find position of the first non white space char (ascii < 32) from the start of the string
529 var start_pos
= self._index_from
530 while _items
[start_pos
].ascii
<= 32 do
532 if start_pos
== _index_to
+ 1 then return ""
534 # find position of the first non white space char from the end of the string
535 var end_pos
= _index_to
536 while _items
[end_pos
].ascii
<= 32 do
538 if end_pos
== start_pos
then return _items
[start_pos
].to_s
540 start_pos
-= index_from
541 end_pos
-= index_from
542 return self.substring
(start_pos
, end_pos
- start_pos
+ 1)
547 var i
= self._index_from
548 var imax
= self._index_to
555 ##################################################
556 # String Specific Methods #
557 ##################################################
559 private init with_infos
(items
: NativeString, len
: Int, from
: Int, to
: Int)
567 # Return a null terminated char *
568 fun to_cstring
: NativeString
570 if _index_from
> 0 or _index_to
!= items
.cstring_length
- 1 then
571 var newItems
= calloc_string
(_length
+ 1)
572 self.items
.copy_to
(newItems
, _length
, _index_from
, 0)
573 newItems
[length
] = '\0'
581 if not other
isa String then return false
583 if self.object_id
== other
.object_id
then return true
585 var my_length
= _length
587 if other
._length
!= my_length
then return false
589 var my_index
= _index_from
590 var its_index
= other
._index_from
592 var last_iteration
= my_index
+ my_length
594 var itsitems
= other
._items
595 var myitems
= self._items
597 while my_index
< last_iteration
do
598 if myitems
[my_index
] != itsitems
[its_index
] then return false
606 # The comparison between two strings is done on a lexicographical basis
608 # assert ("aa" < "b") == true
611 if self.object_id
== other
.object_id
then return false
613 var my_curr_char
: Char
614 var its_curr_char
: Char
616 var curr_id_self
= self._index_from
617 var curr_id_other
= other
._index_from
619 var my_items
= self._items
620 var its_items
= other
._items
622 var my_length
= self._length
623 var its_length
= other
._length
625 var max_iterations
= curr_id_self
+ my_length
627 while curr_id_self
< max_iterations
do
628 my_curr_char
= my_items
[curr_id_self
]
629 its_curr_char
= its_items
[curr_id_other
]
631 if my_curr_char
!= its_curr_char
then
632 if my_curr_char
< its_curr_char
then return true
640 return my_length
< its_length
643 # The concatenation of `self` with `s`
645 # assert "hello " + "world!" == "hello world!"
646 fun +(s
: String): String
648 var my_length
= self._length
649 var its_length
= s
._length
651 var total_length
= my_length
+ its_length
653 var target_string
= calloc_string
(my_length
+ its_length
+ 1)
655 self._items
.copy_to
(target_string
, my_length
, _index_from
, 0)
656 s
._items
.copy_to
(target_string
, its_length
, s
._index_from
, my_length
)
658 target_string
[total_length
] = '\0'
660 return target_string
.to_s_with_length
(total_length
)
663 # `i` repetitions of `self`
665 # assert "abc"*3 == "abcabcabc"
666 # assert "abc"*1 == "abc"
667 # assert "abc"*0 == ""
668 fun *(i
: Int): String
672 var my_length
= self._length
674 var final_length
= my_length
* i
676 var my_items
= self._items
678 var target_string
= calloc_string
((final_length
) + 1)
680 target_string
[final_length
] = '\0'
684 for iteration
in [1 .. i
] do
685 my_items
.copy_to
(target_string
, my_length
, 0, current_last
)
686 current_last
+= my_length
689 return target_string
.to_s_with_length
(final_length
)
692 redef fun to_s
do return self
696 # djb2 hash algorythm
701 var strStart
= _index_from
705 while i
>= strStart
do
706 h
= (h
* 32) + h
+ self._items
[i
].ascii
714 private class FlatStringIterator
715 super IndexedIterator[Char]
719 var target_items
: NativeString
723 init with_pos
(tgt
: String, pos
: Int)
726 target_items
= tgt
.items
727 curr_pos
= pos
+ target
.index_from
730 redef fun is_ok
do return curr_pos
<= target
.index_to
732 redef fun item
do return target_items
[curr_pos
]
734 redef fun next
do curr_pos
+= 1
736 redef fun index
do return curr_pos
- target
.index_from
740 private class FlatStringCharView
743 redef type SELFTYPE: String
747 # Check that the index (+ index_from) is not larger than indexTo
748 # In other terms, if the index is valid
750 assert (index
+ target
._index_from
) <= target
._index_to
751 return target
._items
[index
+ target
._index_from
]
754 redef fun iterator_from
(start
) do return new FlatStringIterator.with_pos
(target
, start
)
758 # Mutable strings of characters.
763 super AbstractArray[Char]
765 redef type OTHER: String
767 redef var chars
: BufferCharView = new FlatBufferCharView(self)
769 redef fun []=(index
, item
)
771 if index
== length
then
775 assert index
>= 0 and index
< length
781 if _capacity
<= length
then enlarge
(length
+ 5)
786 redef fun enlarge
(cap
)
789 if cap
<= c
then return
790 while c
<= cap
do c
= c
* 2 + 2
791 var a
= calloc_string
(c
+1)
792 _items
.copy_to
(a
, length
, 0, 0)
801 if _capacity
< _length
+ sl
then enlarge
(_length
+ sl
)
802 s
.items
.copy_to
(_items
, sl
, s
._index_from
, _length
)
809 redef fun to_s
: String
812 var a
= calloc_string
(l
+1)
813 _items
.copy_to
(a
, l
, 0, 0)
815 # Ensure the afterlast byte is '\0' to nul-terminated char *
818 return a
.to_s_with_length
(length
)
826 while i
< l1
and i
< l2
do
827 var c1
= self.chars
[i
].ascii
828 var c2
= s
.chars
[i
].ascii
843 # Create a new empty string.
851 _capacity
= s
.length
+ 1
853 _items
= calloc_string
(_capacity
)
854 s
.items
.copy_to
(_items
, _length
, s
._index_from
, 0)
857 # Create a new empty string with a given capacity.
858 init with_capacity
(cap
: Int)
861 # _items = new NativeString.calloc(cap)
862 _items
= calloc_string
(cap
+1)
869 if not o
isa Buffer then return false
871 if o
.length
!= l
then return false
876 if it
[i
] != oit
[i
] then return false
882 readable private var _capacity
: Int
885 private class FlatBufferCharView
889 redef type SELFTYPE: Buffer
891 redef fun [](index
) do return target
._items
[index
]
893 redef fun []=(index
, item
)
895 assert index
>= 0 and index
<= length
896 if index
== length
then
900 target
._items
[index
] = item
913 fun enlarge
(cap
: Int)
920 var my_items
= target
.items
921 var s_length
= s
.length
922 if target
.capacity
< s
.length
then enlarge
(s_length
+ target
.length
)
925 redef fun iterator_from
(pos
) do return new FlatBufferIterator.with_pos
(target
, pos
)
929 private class FlatBufferIterator
930 super IndexedIterator[Char]
934 var target_items
: NativeString
938 init with_pos
(tgt
: Buffer, pos
: Int)
941 target_items
= tgt
.items
945 redef fun index
do return curr_pos
947 redef fun is_ok
do return curr_pos
< target
.length
949 redef fun item
do return target_items
[curr_pos
]
951 redef fun next
do curr_pos
+= 1
955 ###############################################################################
957 ###############################################################################
960 # User readable representation of `self`.
961 fun to_s
: String do return inspect
963 # The class name of the object in NativeString format.
964 private fun native_class_name
: NativeString is intern
966 # The class name of the object.
968 # assert 5.class_name == "Int"
969 fun class_name
: String do return native_class_name
.to_s
971 # Developer readable representation of `self`.
972 # Usually, it uses the form "<CLASSNAME:#OBJECTID bla bla bla>"
975 return "<{inspect_head}>"
978 # Return "CLASSNAME:#OBJECTID".
979 # This function is mainly used with the redefinition of the inspect method
980 protected fun inspect_head
: String
982 return "{class_name}:#{object_id.to_hex}"
985 protected fun args
: Sequence[String]
992 # assert true.to_s == "true"
993 # assert false.to_s == "false"
1005 # Fill `s` with the digits in base `base` of `self` (and with the '-' sign if 'signed' and negative).
1006 # assume < to_c max const of char
1007 fun fill_buffer
(s
: Buffer, base
: Int, signed
: Bool)
1014 else if self == 0 then
1021 var pos
= digit_count
(base
) - 1
1022 while pos
>= 0 and n
> 0 do
1023 s
.chars
[pos
] = (n
% base
).to_c
1029 # C function to convert an nit Int to a NativeString (char*)
1030 private fun native_int_to_s
(len
: Int): NativeString is extern "native_int_to_s"
1032 # return displayable int in base 10 and signed
1034 # assert 1.to_s == "1"
1035 # assert (-123).to_s == "-123"
1037 var len
= digit_count
(10)
1038 return native_int_to_s
(len
).to_s_with_length
(len
)
1041 # return displayable int in hexadecimal (unsigned (not now))
1042 fun to_hex
: String do return to_base
(16,false)
1044 # return displayable int in base base and signed
1045 fun to_base
(base
: Int, signed
: Bool): String
1047 var l
= digit_count
(base
)
1048 var s
= new Buffer.from
(" " * l
)
1049 fill_buffer
(s
, base
, signed
)
1055 # Pretty print self, print needoed decimals up to a max of 3.
1057 var str
= to_precision
( 3 )
1058 if is_inf
!= 0 or is_nan
then return str
1059 var len
= str
.length
1060 for i
in [0..len-1
] do
1062 var c
= str
.chars
[j
]
1065 else if c
== '.' then
1066 return str
.substring
( 0, j
+2 )
1068 return str
.substring
( 0, j
+1 )
1074 # `self` representation with `nb` digits after the '.'.
1075 fun to_precision
(nb
: Int): String
1077 if is_nan
then return "nan"
1079 var isinf
= self.is_inf
1082 else if isinf
== -1 then
1086 if nb
== 0 then return self.to_i
.to_s
1088 for i
in [0..nb
[ do f
= f
* 10.0
1095 if i
== 0 then return "0.0"
1099 var p1
= s
.substring
(0, s
.length-nb
)
1100 var p2
= s
.substring
(s
.length-nb
, nb
)
1101 return p1
+ "." + p2
1103 return "0." + ("0"*(nb-sl
)) + s
1107 fun to_precision_native
(nb
: Int): String import NativeString.to_s
`{
1111 size = snprintf(NULL, 0, "%.*f", (int)nb, recv);
1112 str = malloc(size + 1);
1113 sprintf(str, "%.*f", (int)nb, recv );
1115 return NativeString_to_s( str );
1120 # assert 'x'.to_s == "x"
1123 var s
= new Buffer.with_capacity
(1)
1128 # Returns true if the char is a numerical digit
1129 fun is_numeric
: Bool
1131 if self >= '0' and self <= '9'
1138 # Returns true if the char is an alpha digit
1141 if (self >= 'a' and self <= 'z') or (self >= 'A' and self <= 'Z') then return true
1145 # Returns true if the char is an alpha or a numeric digit
1146 fun is_alphanumeric
: Bool
1148 if self.is_numeric
or self.is_alpha
then return true
1153 redef class Collection[E
]
1154 # Concatenate elements.
1158 for e
in self do if e
!= null then s
.append
(e
.to_s
)
1162 # Concatenate and separate each elements with `sep`.
1164 # assert [1, 2, 3].join(":") == "1:2:3"
1165 # assert [1..3].join(":") == "1:2:3"
1166 fun join
(sep
: String): String
1168 if is_empty
then return ""
1170 var s
= new Buffer # Result
1175 if e
!= null then s
.append
(e
.to_s
)
1177 # Concat other items
1182 if e
!= null then s
.append
(e
.to_s
)
1189 redef class Array[E
]
1190 # Fast implementation
1198 if e
!= null then s
.append
(e
.to_s
)
1205 redef class Map[K
,V
]
1206 # Concatenate couple of 'key value'.
1207 # key and value are separated by `couple_sep`.
1208 # each couple is separated each couple with `sep`.
1210 # var m = new ArrayMap[Int, String]
1213 # assert m.join("; ", "=") == "1=one; 10=ten"
1214 fun join
(sep
: String, couple_sep
: String): String
1216 if is_empty
then return ""
1218 var s
= new Buffer # Result
1224 s
.append
("{k}{couple_sep}{e or else "<null>"}")
1226 # Concat other items
1232 s
.append
("{k}{couple_sep}{e or else "<null>"}")
1239 ###############################################################################
1241 ###############################################################################
1243 # Native strings are simple C char *
1247 fun [](index
: Int): Char is intern
1248 fun []=(index
: Int, item
: Char) is intern
1249 fun copy_to
(dest
: NativeString, length
: Int, from
: Int, to
: Int) is intern
1251 # Position of the first nul character.
1252 fun cstring_length
: Int
1255 while self[l
] != '\0' do l
+= 1
1258 fun atoi
: Int is intern
1259 fun atof
: Float is extern "atof"
1263 return to_s_with_length
(cstring_length
)
1266 fun to_s_with_length
(length
: Int): String
1269 return new String.with_infos
(self, length
, 0, length
- 1)
1272 fun to_s_with_copy
: String
1274 var length
= cstring_length
1275 var new_self
= calloc_string
(length
+ 1)
1276 copy_to
(new_self
, length
, 0, 0)
1277 return new String.with_infos
(new_self
, length
, 0, length
- 1)
1282 # StringCapable objects can create native strings
1283 interface StringCapable
1284 protected fun calloc_string
(size
: Int): NativeString is intern
1288 var _args_cache
: nullable Sequence[String]
1290 redef fun args
: Sequence[String]
1292 if _args_cache
== null then init_args
1293 return _args_cache
.as(not null)
1296 # The name of the program as given by the OS
1297 fun program_name
: String
1299 return native_argv
(0).to_s
1302 # Initialize `args` with the contents of `native_argc` and `native_argv`.
1303 private fun init_args
1305 var argc
= native_argc
1306 var args
= new Array[String].with_capacity
(0)
1309 args
[i-1
] = native_argv
(i
).to_s
1315 # First argument of the main C function.
1316 private fun native_argc
: Int is intern
1318 # Second argument of the main C function.
1319 private fun native_argv
(i
: Int): NativeString is intern