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

all: unify const names to snake_case

This commit is contained in:
yuyi
2020-05-22 23:36:09 +08:00
committed by GitHub
parent aef751861d
commit dda875a9c8
58 changed files with 543 additions and 540 deletions

View File

@@ -1,8 +1,3 @@
const (
q = [1, 2, 3]
A = 8
)
fn test_pointer() {
mut arr := []&int{}
a := 1
@@ -295,11 +290,11 @@ fn test_reverse() {
}
const (
N = 5
c_n = 5
)
struct Foooj {
a [5]int // N
a [5]int // c_n
}
fn test_fixed() {
@@ -312,8 +307,8 @@ fn test_fixed() {
assert nums[3] == 0
nums[1] = 7
assert nums[1] == 7
nums2 := [5]int // N
assert nums2[N - 1] == 0
nums2 := [5]int // c_n
assert nums2[c_n - 1] == 0
}
fn modify(numbers mut []int) {

View File

@@ -50,18 +50,18 @@ fn C.SymGetLineFromAddr64(h_process voidptr, address u64, p_displacement voidptr
// Ref - https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsetoptions
const (
SYMOPT_UNDNAME = 0x00000002
SYMOPT_DEFERRED_LOADS = 0x00000004
SYMOPT_NO_CPP = 0x00000008
SYMOPT_LOAD_LINES = 0x00000010
SYMOPT_INCLUDE_32BIT_MODULES = 0x00002000
SYMOPT_ALLOW_ZERO_ADDRESS = 0x01000000
SYMOPT_DEBUG = 0x80000000
symopt_undname = 0x00000002
symopt_deferred_loads = 0x00000004
symopt_no_cpp = 0x00000008
symopt_load_lines = 0x00000010
symopt_include_32bit_modules = 0x00002000
symopt_allow_zero_address = 0x01000000
symopt_debug = 0x80000000
)
fn builtin_init() {
if is_atty(1) > 0 {
C.SetConsoleMode(C.GetStdHandle(C.STD_OUTPUT_HANDLE), C.ENABLE_PROCESSED_OUTPUT | 0x0004) // ENABLE_VIRTUAL_TERMINAL_PROCESSING
C.SetConsoleMode(C.GetStdHandle(C.STD_OUTPUT_HANDLE), C.ENABLE_PROCESSED_OUTPUT | 0x0004) // enable_virtual_terminal_processing
C.setbuf(C.stdout, 0)
}
}
@@ -92,7 +92,7 @@ $if msvc {
handle := C.GetCurrentProcess()
defer { C.SymCleanup(handle) }
C.SymSetOptions(SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_UNDNAME)
C.SymSetOptions(symopt_debug | symopt_load_lines | symopt_undname)
syminitok := C.SymInitialize( handle, 0, 1)
if syminitok != 1 {

View File

@@ -109,15 +109,15 @@ pub fn (_rune string) utf32_code() int {
}
const (
CP_UTF8 = 65001
cp_utf8 = 65001
)
pub fn (_str string) to_wide() &u16 {
$if windows {
num_chars := (C.MultiByteToWideChar(CP_UTF8, 0, _str.str, _str.len, 0, 0))
num_chars := (C.MultiByteToWideChar(cp_utf8, 0, _str.str, _str.len, 0, 0))
mut wstr := &u16(malloc((num_chars + 1) * 2)) // sizeof(wchar_t)
if wstr != 0 {
C.MultiByteToWideChar(CP_UTF8, 0, _str.str, _str.len, wstr, num_chars)
C.MultiByteToWideChar(cp_utf8, 0, _str.str, _str.len, wstr, num_chars)
C.memset(&byte(wstr) + num_chars * 2, 0, 2)
}
return wstr
@@ -137,10 +137,10 @@ pub fn string_from_wide(_wstr &u16) string {
pub fn string_from_wide2(_wstr &u16, len int) string {
$if windows {
num_chars := C.WideCharToMultiByte(CP_UTF8, 0, _wstr, len, 0, 0, 0, 0)
num_chars := C.WideCharToMultiByte(cp_utf8, 0, _wstr, len, 0, 0, 0, 0)
mut str_to := malloc(num_chars + 1)
if str_to != 0 {
C.WideCharToMultiByte(CP_UTF8, 0, _wstr, len, str_to, num_chars, 0, 0)
C.WideCharToMultiByte(cp_utf8, 0, _wstr, len, str_to, num_chars, 0, 0)
C.memset(str_to + num_chars, 0, 1)
}
return tos2(str_to)
@@ -255,4 +255,3 @@ pub fn utf8_getchar() int {
return uc
}
}