remove old types and
parent
f26e65a943
commit
f3f24b25bb
|
@ -1925,10 +1925,6 @@ fn (p mut Parser) factor() string {
|
||||||
switch tok {
|
switch tok {
|
||||||
case INT:
|
case INT:
|
||||||
typ = 'int'
|
typ = 'int'
|
||||||
// typ = 'number'
|
|
||||||
if p.lit.starts_with('u') {
|
|
||||||
typ = 'long'
|
|
||||||
}
|
|
||||||
if p.lit.contains('.') || p.lit.contains('e') {
|
if p.lit.contains('.') || p.lit.contains('e') {
|
||||||
typ = 'f32'
|
typ = 'f32'
|
||||||
// typ = 'f64' // TODO
|
// typ = 'f64' // TODO
|
||||||
|
@ -2087,14 +2083,13 @@ fn (p mut Parser) typ_to_fmt(typ string) string {
|
||||||
switch typ {
|
switch typ {
|
||||||
case 'string': return '%.*s'
|
case 'string': return '%.*s'
|
||||||
case 'ustring': return '%.*s'
|
case 'ustring': return '%.*s'
|
||||||
case 'long': return '%ld'
|
|
||||||
case 'byte': return '%d'
|
case 'byte': return '%d'
|
||||||
case 'int': return '%d'
|
case 'int': return '%d'
|
||||||
case 'char': return '%d'
|
case 'char': return '%d'
|
||||||
case 'byte': return '%d'
|
case 'byte': return '%d'
|
||||||
case 'bool': return '%d'
|
case 'bool': return '%d'
|
||||||
case 'u32': return '%d'
|
case 'u32': return '%d'
|
||||||
case 'double', 'f64', 'f32': return '%f'
|
case 'f64', 'f32': return '%f'
|
||||||
case 'i64': return '%lld'
|
case 'i64': return '%lld'
|
||||||
case 'byte*': return '%s'
|
case 'byte*': return '%s'
|
||||||
// case 'array_string': return '%s'
|
// case 'array_string': return '%s'
|
||||||
|
|
|
@ -85,7 +85,7 @@ fn (s mut Scanner) ident_number() string {
|
||||||
if c == `.` {
|
if c == `.` {
|
||||||
is_float = true
|
is_float = true
|
||||||
}
|
}
|
||||||
is_good_hex := is_hex && (c == `x` || c == `u` || (c >= `a` && c <= `f`))
|
is_good_hex := is_hex && (c == `x` || (c >= `a` && c <= `f`))
|
||||||
// 1e+3, 1e-3, 1e3
|
// 1e+3, 1e-3, 1e3
|
||||||
if !is_hex && c == `e` {
|
if !is_hex && c == `e` {
|
||||||
next := s.text[s.pos + 1]
|
next := s.text[s.pos + 1]
|
||||||
|
|
|
@ -97,8 +97,8 @@ fn (f Fn) str() string {
|
||||||
// fn (types array_Type) print_to_file(f string) {
|
// fn (types array_Type) print_to_file(f string) {
|
||||||
// }
|
// }
|
||||||
const (
|
const (
|
||||||
NUMBER_TYPES = ['number', 'int', 'i8', 'u8', 'i16', 'u16', 'i32', 'u32', 'byte', 'i64', 'u64', 'long', 'double', 'f32', 'f64']
|
NUMBER_TYPES = ['number', 'int', 'i8', 'u8', 'i16', 'u16', 'i32', 'u32', 'byte', 'i64', 'u64', 'f32', 'f64']
|
||||||
FLOAT_TYPES = ['double', 'f32', 'f64']
|
FLOAT_TYPES = ['f32', 'f64']
|
||||||
)
|
)
|
||||||
|
|
||||||
fn is_number_type(typ string) bool {
|
fn is_number_type(typ string) bool {
|
||||||
|
@ -126,10 +126,8 @@ fn new_table(obfuscate bool) *Table {
|
||||||
// t.register_type_with_parent('i64', 'int')
|
// t.register_type_with_parent('i64', 'int')
|
||||||
t.register_type('i64')
|
t.register_type('i64')
|
||||||
t.register_type_with_parent('u64', 'int')
|
t.register_type_with_parent('u64', 'int')
|
||||||
t.register_type('long')
|
|
||||||
t.register_type('byteptr')
|
t.register_type('byteptr')
|
||||||
t.register_type('intptr')
|
t.register_type('intptr')
|
||||||
t.register_type('double')// TODO remove
|
|
||||||
t.register_type('f32')
|
t.register_type('f32')
|
||||||
t.register_type('f64')
|
t.register_type('f64')
|
||||||
t.register_type('rune')
|
t.register_type('rune')
|
||||||
|
@ -433,7 +431,7 @@ fn (p mut Parser) _check_types(got, expected string, throw bool) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// Allow ints to be used as longs
|
// Allow ints to be used as longs
|
||||||
if got.eq('int') && expected.eq('long') {
|
if got=='int' && expected=='i64' {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if got == 'void*' && expected.starts_with('fn ') {
|
if got == 'void*' && expected.starts_with('fn ') {
|
||||||
|
|
4
gg/gg.v
4
gg/gg.v
|
@ -268,7 +268,7 @@ fn (ctx &GG) draw_rect2(x, y, w, h f32, c gx.Color) {
|
||||||
|
|
||||||
// jfn ft_load_char(face FT_Face, code FT_ULong) Character {
|
// jfn ft_load_char(face FT_Face, code FT_ULong) Character {
|
||||||
// fn ft_load_char(_face voidptr, _code voidptr) Character {
|
// fn ft_load_char(_face voidptr, _code voidptr) Character {
|
||||||
fn ft_load_char(_face Face, code long) Character {
|
fn ft_load_char(_face Face, code i64) Character {
|
||||||
// #FT_Face face = *(FT_Face*)(_face); FT_ULong code = *(FT_ULong*)(code);
|
// #FT_Face face = *(FT_Face*)(_face); FT_ULong code = *(FT_ULong*)(code);
|
||||||
# FT_Face face = *((FT_Face*)_face.cobj);
|
# FT_Face face = *((FT_Face*)_face.cobj);
|
||||||
# if (FT_Load_Char(face, code, FT_LOAD_RENDER))
|
# if (FT_Load_Char(face, code, FT_LOAD_RENDER))
|
||||||
|
@ -374,7 +374,7 @@ fn new_context_text(cfg Cfg, scale int) *GG {
|
||||||
// ch:=ft_load_char(face, c)
|
// ch:=ft_load_char(face, c)
|
||||||
// # ch =gg__ft_load_char(&face, &c);
|
// # ch =gg__ft_load_char(&face, &c);
|
||||||
// ////////////////////////////////
|
// ////////////////////////////////
|
||||||
mut ch := ft_load_char(f, long(c))
|
mut ch := ft_load_char(f, i64(c))
|
||||||
// s := utf32_to_str(uint(0x043f))
|
// s := utf32_to_str(uint(0x043f))
|
||||||
// s := 'п'
|
// s := 'п'
|
||||||
// ch = ft_load_char(f, s.utf32_code())
|
// ch = ft_load_char(f, s.utf32_code())
|
||||||
|
|
|
@ -136,7 +136,7 @@ fn init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// fn mouse_move(w * GLFWwindow, x, y double) {
|
// fn mouse_move(w * GLFWwindow, x, y double) {
|
||||||
fn mouse_move(w voidptr, x, y double) {
|
fn mouse_move(w voidptr, x, y f64) {
|
||||||
// #printf("%f : %f => %d \n", x,y);
|
// #printf("%f : %f => %d \n", x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ fn (w mut Window) onchar(cb voidptr) {
|
||||||
C.glfwSetCharModsCallback(w.data, cb)
|
C.glfwSetCharModsCallback(w.data, cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_time() double {
|
fn get_time() f64 {
|
||||||
return C.glfwGetTime()
|
return C.glfwGetTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,8 +266,8 @@ fn (w &Window) set_clipboard_text(s string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (w &Window) get_cursor_pos() Pos {
|
fn (w &Window) get_cursor_pos() Pos {
|
||||||
x := double(0)
|
x := f64(0)
|
||||||
y := double(0)
|
y := f64(0)
|
||||||
C.glfwGetCursorPos(w.data, &x, &y)
|
C.glfwGetCursorPos(w.data, &x, &y)
|
||||||
return Pos {
|
return Pos {
|
||||||
x: int(x)
|
x: int(x)
|
||||||
|
|
|
@ -9,14 +9,14 @@ module time
|
||||||
//#include <mach/mach_time.h>
|
//#include <mach/mach_time.h>
|
||||||
|
|
||||||
// in ms
|
// in ms
|
||||||
fn ticks() double {
|
fn ticks() f64 {
|
||||||
panic('not implemented')
|
panic('not implemented')
|
||||||
/*
|
/*
|
||||||
t := i64(C.mach_absolute_time())
|
t := i64(C.mach_absolute_time())
|
||||||
# Nanoseconds elapsedNano = AbsoluteToNanoseconds( *(AbsoluteTime *) &t );
|
# Nanoseconds elapsedNano = AbsoluteToNanoseconds( *(AbsoluteTime *) &t );
|
||||||
# return (double)(* (uint64_t *) &elapsedNano) / 1000000;
|
# return (double)(* (uint64_t *) &elapsedNano) / 1000000;
|
||||||
*/
|
*/
|
||||||
return double(0)
|
return f64(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sleep(seconds int) {
|
fn sleep(seconds int) {
|
||||||
|
|
Loading…
Reference in New Issue