Skip to content

Commit

Permalink
all: remove used_import hacks fixed in upstream V
Browse files Browse the repository at this point in the history
  • Loading branch information
larpon committed Apr 2, 2024
1 parent a622bc5 commit 20aba9d
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 31 deletions.
4 changes: 4 additions & 0 deletions lib/audio.b.v
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ mut:
decoders map[u16]&ma.Decoder // sound decoders for sounds loaded from memory
}

pub fn (ae AudioEngine) str() string {
return 'AudioEngine{}' // TODO to allow compiling with `$dbg`
}

pub fn (mut e AudioEngine) shutdown() ! {
for _, sound in e.sounds {
if !isnil(sound) {
Expand Down
4 changes: 4 additions & 0 deletions lib/script.wren.v
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ mut:
fn_ptr ?wren.ForeignMethodFn
}

pub fn (wc WrenClass) str() string {
return 'WrenClass{}' // TODO to allow compiling with `$dbg`
}

fn (w WrenVM) on_frame(dt f64) {
for wren_class in w.classes {
if frame_fn_handle := wren_class.methods['frame'] {
Expand Down
2 changes: 0 additions & 2 deletions wraps/fontstash/fontstash.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ $if windows {
pub type Context = C.FONScontext

//#flag -lfreetype
// TODO: fontstash.used_import is used to keep v from warning about unused imports
pub const used_import = 1
pub const invalid = C.FONS_INVALID // -1

// create_internal returns a fontstash Context allocated on the heap.
Expand Down
2 changes: 0 additions & 2 deletions wraps/miniaudio/c/miniaudio.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
// is licensed under the unlicense and, are thus, in the public domain.
module c

pub const used_import = 1

#flag -I @VMODROOT/miniaudio
$if linux {
#flag -lpthread -lm -ldl
Expand Down
12 changes: 9 additions & 3 deletions wraps/miniaudio/miniaudio.auto.c.v
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// NOTE this file is auto-generated by chew
module miniaudio

import miniaudio.c

pub const used_import = c.used_import
import miniaudio.c as _

//
// miniaudio.h
Expand Down Expand Up @@ -10398,6 +10396,10 @@ pub mut:
_pHeap voidptr
}

pub fn (en C.ma_engine_node) str() string {
return 'C.ma_engine_node'
}

pub type EngineNode = C.ma_engine_node

// C: `MA_API ma_result ma_engine_node_get_heap_size(const ma_engine_node_config* pConfig, size_t* pHeapSizeInBytes)`
Expand Down Expand Up @@ -10475,6 +10477,10 @@ pub mut:
// TODO MA_NO_RESOURCE_MANAGER C.#ifndef // ma_resource_manager_data_source*
}

pub fn (s C.ma_sound) str() string {
return 'C.ma_sound{}'
}

pub type Sound = C.ma_sound

@[typedef]
Expand Down
2 changes: 0 additions & 2 deletions wraps/sokol/app/app.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ $if !no_sokol_app ? {
#include "sokol_app.h"
}

pub const used_import = gfx.used_import

pub fn create_desc() gfx.Desc {
metal_desc := gfx.MetalContextDesc{
device: metal_get_device()
Expand Down
2 changes: 0 additions & 2 deletions wraps/sokol/c/sokol.c.v
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright(C) 2022 Lars Pontoppidan. All rights reserved.
module c

pub const used_import = 1 // TODO

#flag -I @VMODROOT/thirdparty/sokol
#flag -I @VMODROOT/thirdparty/sokol/util

Expand Down
6 changes: 2 additions & 4 deletions wraps/sokol/f/f.c.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
module f

import shy.wraps.fontstash
import shy.wraps.sokol.gfx

pub const used_import = fontstash.used_import + gfx.used_import
import shy.wraps.fontstash as _
import shy.wraps.sokol.gfx as _
4 changes: 1 addition & 3 deletions wraps/sokol/gfx/sokol_gfx.auto.c.v
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// NOTE this file is auto-generated by chew
module gfx

import shy.wraps.sokol.c
import shy.wraps.sokol.c as _

pub const version = 1

pub const used_import = c.used_import

//
// sokol_gfx.h
//
Expand Down
4 changes: 0 additions & 4 deletions wraps/sokol/sfons/sfons.c.v
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module sfons

import shy.wraps.fontstash
import shy.wraps.sokol.f
import shy.wraps.sokol.memory

@[markused]
Expand Down Expand Up @@ -50,9 +49,6 @@ fn C.sfons_destroy(ctx &fontstash.Context)
fn C.sfons_rgba(r u8, g u8, b u8, a u8) u32
fn C.sfons_flush(ctx &fontstash.Context)

// keep v from warning about unused imports
const used_import = f.used_import + fontstash.used_import + 1

@[inline]
pub fn create(const_desc &Desc) &fontstash.Context {
return C.sfons_create(const_desc)
Expand Down
6 changes: 2 additions & 4 deletions wraps/sokol/sokol.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
module sokol

import shy.wraps.sokol.c
import shy.wraps.sokol.f

pub const used_import = c.used_import + f.used_import
import shy.wraps.sokol.c as _
import shy.wraps.sokol.f as _
2 changes: 0 additions & 2 deletions wraps/wren/c/c.c.v
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright(C) 2022 Lars Pontoppidan. All rights reserved.
module c

pub const used_import = 1 // TODO

#flag -I @VMODROOT/c/wren/src/include
#flag -I @VMODROOT/c/wren/src/vm
#flag -I @VMODROOT/c/wren/src/optional
Expand Down
4 changes: 1 addition & 3 deletions wraps/wren/wren.auto.c.v
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// NOTE this file is auto-generated by chew
module wren

import wren.c

pub const used_import = c.used_import
import wren.c as _

//
// wren.h
Expand Down

0 comments on commit 20aba9d

Please sign in to comment.