1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

more windows fixes + bring back windows ci

This commit is contained in:
Alexander Medvednikov 2020-04-02 13:44:46 +02:00
parent 1178bfa578
commit 5b835d294c
6 changed files with 28 additions and 30 deletions

View File

@ -257,10 +257,10 @@ jobs:
run: |
git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries.git thirdparty/freetype/
.\.github\workflows\windows-install-sdl.bat
# - name: Build
# run: |
# gcc --version
# .\make.bat -gcc
- name: Build
run: |
gcc --version
.\make.bat -gcc
# - name: Test
# run: |
# .\v.exe -silent test-compiler

View File

@ -52,7 +52,8 @@ fn find_windows_kit_internal(key RegKey, versions []string) ?string {
if value[length - 1] != u16(0) {
value[length] = u16(0)
}
return string_from_wide(value)
res := string_from_wide(value)
return res
}
}
}

View File

@ -2,7 +2,7 @@ module os
// Ref - winnt.h
const (
SUCCESS = 0 // ERROR_SUCCESS
success = 0 // ERROR_SUCCESS
ERROR_INSUFFICIENT_BUFFER = 130
)
@ -77,7 +77,7 @@ const (
ENABLE_INSERT_MODE = 0x0020
ENABLE_LINE_INPUT = 0x0002
ENABLE_MOUSE_INPUT = 0x0010
ENABLE_PROCESSED_INPUT = 0x0001
ENABLE_PROCESSED_INPUT = 0x0001
ENABLE_QUICK_EDIT_MODE = 0x0040
ENABLE_WINDOW_INPUT = 0x0008
ENABLE_VIRTUAL_TERMINAL_INPUT = 0x0200

View File

@ -198,14 +198,13 @@ pub fn get_file_handle(path string) HANDLE {
// get_module_filename retrieves the fully qualified path for the file that contains the specified module.
// The module must have been loaded by the current process.
pub fn get_module_filename(handle HANDLE) ?string {
success := C.SUCCESS
unsafe {
mut sz := 4096 // Optimized length
mut buf := &u16(malloc(4096))
for {
status := int(C.GetModuleFileNameW(handle, voidptr(&buf), sz))
match status {
success {
os.success {
_filename := string_from_wide2(buf, sz)
return _filename
}

View File

@ -7,7 +7,6 @@ import (
v.depgraph
v.token
v.pref
v.util
term
)
@ -99,13 +98,7 @@ pub fn cgen(files []ast.File, table &table.Table, pref &pref.Preferences) string
if g.is_test {
g.write_tests_main()
}
return g.hashes() + g.typedefs.str() + g.definitions.str() + g.out.str()
}
pub fn (g &Gen) hashes() string {
mut res := c_commit_hash_default.replace('@@@', util.vhash() )
res += c_current_commit_hash_default.replace('@@@', util.githash( g.pref.building_v ) )
return res
return c_commit_hash_default + g.typedefs.str() + g.definitions.str() + g.out.str()
}
pub fn (g mut Gen) init() {
@ -1103,8 +1096,12 @@ fn (g mut Gen) expr(node ast.Expr) {
*/
ast.SizeOf {
styp := g.typ(it.typ)
g.write('sizeof($styp)')
if it.type_name != '' {
g.write('sizeof($it.type_name)')
} else {
styp := g.typ(it.typ)
g.write('sizeof($styp)')
}
}
ast.StringLiteral {
if it.is_raw {

View File

@ -776,21 +776,22 @@ pub fn (p mut Parser) expr(precedence int) ast.Expr {
.key_sizeof {
p.next() // sizeof
p.check(.lpar)
if p.tok.lit == 'C' {
p.next()
p.check(.dot)
}
if p.tok.kind == .amp {
p.next()
}
// type_name := p.check_name()
sizeof_type := p.parse_type()
p.check(.rpar)
node = ast.SizeOf{
typ: sizeof_type
// type_name: type_name
if p.tok.lit == 'C' {
p.next()
p.check(.dot)
node = ast.SizeOf{
type_name: p.check_name()
}
} else {
sizeof_type := p.parse_type()
node = ast.SizeOf{
typ: sizeof_type
}
}
p.check(.rpar)
}
.key_typeof {
p.next()