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

fmt: id []typ

This commit is contained in:
Zaoqi 2019-06-30 11:06:46 +00:00 committed by Alexander Medvednikov
parent 8d13880cab
commit 437b32fe78
7 changed files with 17 additions and 18 deletions

View File

@ -696,7 +696,7 @@ fn (c &V) log(s string) {
println(s)
}
fn new_v(args[]string) *V {
fn new_v(args []string) *V {
mut dir := args.last()
if args.contains('run') {
dir = args[2]

View File

@ -254,7 +254,7 @@ fn (t Token) is_assign() bool {
return t in AssignTokens
}
fn (t[]Token) contains(val Token) bool {
fn (t []Token) contains(val Token) bool {
for tt in t {
if tt == val {
return true

View File

@ -1,6 +1,6 @@
import time
fn print_field(field[]array_int) {
fn print_field(field []array_int) {
for line in field {
mut s := ' '
for j, cell in line {

View File

@ -188,7 +188,7 @@ pub fn (arr mut array) _push_many(val voidptr, size int) {
arr.len += size
}
pub fn (a[]int) str() string {
pub fn (a []int) str() string {
mut res := '['
for i := 0; i < a.len; i++ {
val := a[i]
@ -201,14 +201,13 @@ pub fn (a[]int) str() string {
return res
}
pub fn (a[]int) free() {
// println('array free')
pub fn (a []int) free() {
C.free(a.data)
}
// TODO generic
// "[ 'a', 'b', 'c' ]"
pub fn (a[]string) str() string {
pub fn (a []string) str() string {
mut res := '['
for i := 0; i < a.len; i++ {
val := a[i]

View File

@ -136,7 +136,7 @@ pub fn (n i64) hex() string {
return tos(hex, s.len + 3)
}
pub fn (a[]byte) contains(val byte) bool {
pub fn (a []byte) contains(val byte) bool {
for aa in a {
if aa == val {
return true

View File

@ -477,7 +477,7 @@ pub fn (s string) find_between(start, end string) string {
}
// TODO generic
pub fn (ar[]string) contains(val string) bool {
pub fn (ar []string) contains(val string) bool {
for s in ar {
if s == val {
return true
@ -487,7 +487,7 @@ pub fn (ar[]string) contains(val string) bool {
}
// TODO generic
pub fn (ar[]int) contains(val int) bool {
pub fn (ar []int) contains(val int) bool {
for i, s in ar {
if s == val {
return true
@ -497,7 +497,7 @@ pub fn (ar[]int) contains(val int) bool {
}
/*
pub fn (a[]string) to_c() voidptr {
pub fn (a []string) to_c() voidptr {
char ** res = malloc(sizeof(char*) * a.len);
for i := 0; i < a.len; i++ {
val := a[i]
@ -704,7 +704,7 @@ pub fn (s string) free() {
C.free(s.str)
}
fn (arr[]string) free() {
fn (arr []string) free() {
for s in arr {
s.free()
}
@ -739,7 +739,7 @@ pub fn (s string) all_after(dot string) string {
// fn (s []string) substr(a, b int) string {
// return join_strings(s.slice_fast(a, b))
// }
pub fn (a[]string) join(del string) string {
pub fn (a []string) join(del string) string {
if a.len == 0 {
return ''
}
@ -772,7 +772,7 @@ pub fn (a[]string) join(del string) string {
return res
}
pub fn (s[]string) join_lines() string {
pub fn (s []string) join_lines() string {
return s.join('\n')
}

View File

@ -129,22 +129,22 @@ pub fn buffer_data(typ, size int, arr voidptr, draw_typ int) {
C.glBufferData(typ, size, arr, draw_typ)
}
pub fn buffer_data_int(typ int, vertices[]int, draw_typ int) {
pub fn buffer_data_int(typ int, vertices []int, draw_typ int) {
size := sizeof(int) * vertices.len
C.glBufferData(typ, size, vertices.data, draw_typ)
}
pub fn buffer_data_f32(typ int, vertices[]f32, draw_typ int) {
pub fn buffer_data_f32(typ int, vertices []f32, draw_typ int) {
size := sizeof(f32) * vertices.len
C.glBufferData(typ, size, vertices.data, draw_typ)
}
pub fn set_vbo(vbo u32, vertices[]f32, draw_typ int) {
pub fn set_vbo(vbo u32, vertices []f32, draw_typ int) {
gl.bind_buffer(GL_ARRAY_BUFFER, vbo)
gl.buffer_data_f32(GL_ARRAY_BUFFER, vertices, draw_typ)
}
pub fn set_ebo(ebo u32, indices[]int, draw_typ int) {
pub fn set_ebo(ebo u32, indices []int, draw_typ int) {
gl.bind_buffer(GL_ELEMENT_ARRAY_BUFFER, ebo)
// gl.buffer_data_int(GL_ELEMENT_ARRAY_BUFFER, indices, draw_typ)
gl.buffer_data_int(GL_ELEMENT_ARRAY_BUFFER, indices, draw_typ)