clipboard: make compile on linux

pull/4758/head
Alexander Medvednikov 2020-05-06 12:00:50 +00:00
parent a4f931ef65
commit 8d2a4d2436
2 changed files with 22 additions and 6 deletions

View File

@ -41,6 +41,9 @@ fn C.BlackPixel() voidptr
fn C.WhitePixel() voidptr fn C.WhitePixel() voidptr
fn C.XFree() fn C.XFree()
fn todo_del(){}
[typedef]
struct C.XSelectionRequestEvent{ struct C.XSelectionRequestEvent{
mut: mut:
selection C.Atom selection C.Atom
@ -71,6 +74,7 @@ struct C.XSelectionClearEvent{
selection C.Atom selection C.Atom
} }
[typedef]
struct C.XDestroyWindowEvent { struct C.XDestroyWindowEvent {
mut: mut:
window C.Window window C.Window

View File

@ -300,6 +300,11 @@ fn (mut g Gen) typ(t table.Type) string {
g.optionals << styp g.optionals << styp
} }
} }
/*
if styp.starts_with('C__') {
return styp[3..]
}
*/
return styp return styp
} }
@ -1175,12 +1180,16 @@ fn (mut g Gen) expr(node ast.Expr) {
g.is_amp = false g.is_amp = false
} }
ast.SizeOf { ast.SizeOf {
if it.type_name != '' { mut styp := it.type_name
g.write('sizeof($it.type_name)') if it.type_name == '' {
} else { styp = g.typ(it.typ)
styp := g.typ(it.typ)
g.write('sizeof(/*typ*/$styp)')
} }
/*
if styp.starts_with('C__') {
styp = styp[3..]
}
*/
g.write('sizeof($styp)')
} }
ast.StringLiteral { ast.StringLiteral {
if it.is_raw { if it.is_raw {
@ -2851,7 +2860,10 @@ fn (g Gen) type_default(typ table.Type) string {
sym := g.table.get_type_symbol(typ) sym := g.table.get_type_symbol(typ)
if sym.kind == .array { if sym.kind == .array {
elem_sym := g.table.get_type_symbol(sym.array_info().elem_type) elem_sym := g.table.get_type_symbol(sym.array_info().elem_type)
elem_type_str := elem_sym.name.replace('.', '__') mut elem_type_str := elem_sym.name.replace('.', '__')
if elem_type_str.starts_with('C__') {
elem_type_str = elem_type_str[3..]
}
return '__new_array(0, 1, sizeof($elem_type_str))' return '__new_array(0, 1, sizeof($elem_type_str))'
} }
if sym.kind == .map { if sym.kind == .map {