cc: add support for tcc backend on windows-i386 (#6297)
parent
1c5b9db63f
commit
90128ed4ee
vlib
|
@ -1209,7 +1209,7 @@ fn (mut re RE) impl_compile(in_txt string) (int,int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// init the state stack
|
// init the state stack
|
||||||
re.state_stack = [StateDotObj{}].repeat(tmp_count+1)
|
re.state_stack = []StateDotObj{len: tmp_count+1, init: StateDotObj{}}
|
||||||
|
|
||||||
// OR branch
|
// OR branch
|
||||||
// a|b|cd
|
// a|b|cd
|
||||||
|
|
|
@ -94,7 +94,13 @@ fn test_inttypes_string_interpolation() {
|
||||||
i := -1622999040
|
i := -1622999040
|
||||||
ui := u32(3421958087)
|
ui := u32(3421958087)
|
||||||
vp := voidptr(ui)
|
vp := voidptr(ui)
|
||||||
bp := byteptr(15541149836)
|
mut bp := byteptr(0)
|
||||||
|
$if x64 {
|
||||||
|
bp = byteptr(15541149836)
|
||||||
|
}
|
||||||
|
$else {
|
||||||
|
bp = byteptr(3541149836)
|
||||||
|
}
|
||||||
l := i64(-7694555558525237396)
|
l := i64(-7694555558525237396)
|
||||||
ul := u64(17234006112912956370)
|
ul := u64(17234006112912956370)
|
||||||
assert '$s $us' == '-23456 54321'
|
assert '$s $us' == '-23456 54321'
|
||||||
|
@ -109,10 +115,17 @@ fn test_inttypes_string_interpolation() {
|
||||||
assert '${l:x}:${ul:X}' == '9537727cad98876c:EF2B7D4001165BD2'
|
assert '${l:x}:${ul:X}' == '9537727cad98876c:EF2B7D4001165BD2'
|
||||||
// default pointer format is platform dependent, so try a few
|
// default pointer format is platform dependent, so try a few
|
||||||
eprintln("platform pointer format: '${vp:p}:$bp'")
|
eprintln("platform pointer format: '${vp:p}:$bp'")
|
||||||
assert '${vp:p}:$bp' == '0xcbf6efc7:0x39e53208c' ||
|
$if x64 {
|
||||||
'${vp:p}:$bp' == 'CBF6EFC7:39E53208C' ||
|
assert '${vp:p}:$bp' == '0xcbf6efc7:0x39e53208c' ||
|
||||||
'${vp:p}:$bp' == 'cbf6efc7:39e53208c' ||
|
'${vp:p}:$bp' == 'CBF6EFC7:39E53208C' ||
|
||||||
'${vp:p}:$bp' == '00000000CBF6EFC7:000000039E53208C'
|
'${vp:p}:$bp' == 'cbf6efc7:39e53208c' ||
|
||||||
|
'${vp:p}:$bp' == '00000000CBF6EFC7:000000039E53208C'
|
||||||
|
}
|
||||||
|
$else {
|
||||||
|
assert '${vp:p}:$bp' == 'CBF6EFC7:D311A88C' ||
|
||||||
|
'${vp:p}:$bp' == 'cbf6efc7:d311a88c' ||
|
||||||
|
'${vp:p}:$bp' == '0xcbf6efc7:0xd311a88c'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_utf8_string_interpolation() {
|
fn test_utf8_string_interpolation() {
|
||||||
|
|
|
@ -77,6 +77,8 @@ fn C.ntohs() int
|
||||||
|
|
||||||
fn C.inet_ntop() int
|
fn C.inet_ntop() int
|
||||||
|
|
||||||
|
fn C.WSAStringToAddress() int
|
||||||
|
|
||||||
fn C.getsockname() int
|
fn C.getsockname() int
|
||||||
|
|
||||||
// defined in builtin
|
// defined in builtin
|
||||||
|
|
|
@ -23,7 +23,7 @@ fn new_addr(addr C.sockaddr, _saddr string, _port int) ?Addr {
|
||||||
// Convert to string representation
|
// Convert to string representation
|
||||||
buf := []byte{ len: max_ipv4_addr_len, init: 0 }
|
buf := []byte{ len: max_ipv4_addr_len, init: 0 }
|
||||||
$if windows {
|
$if windows {
|
||||||
res := C.inet_ntop(SocketFamily.inet, &addr, buf.data, buf.len)
|
res := C.WSAStringToAddress(&addr, SocketFamily.inet, C.NULL, &buf.data, &buf.len)
|
||||||
if res == 0 {
|
if res == 0 {
|
||||||
socket_error(-1)?
|
socket_error(-1)?
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue