130 Commits

Author SHA1 Message Date
daf3e82896 genbindings: subclass override functions need to use goMethodName 2025-02-01 14:35:54 +13:00
Jacek Sieka
187c0a02ec Move go name mangling to emitgo
This change helps keep rules for each language separate by moving `go`
rules to `emitgo` while the C bindings stay closer to the original Qt
naming (that already is mostly C-safe).

Although it doesn't practically matter for go, it makes it slightly
easier to reuse the generated code in other languages which have
different keywords and naming conventions.

The cabi generator also gains a few helpers to help keep names
consistent across files which hopefully aids reading the generator code
- it did for me at least;)

The rule that converts under_score to CamelCase is left for another day
since moving it turns out to be more invasive due to name collision
handling - when underscores are kept, there are fewer name conflicts
which ends up causing name changes in  the public go api when done
naively.
2025-02-01 13:44:32 +13:00
c80c0ff441 genbindings: fix indexing of zero-length byte arrays 2025-01-24 18:52:12 +13:00
5cce6739f5 genbindings: remove last use of isSubclass variable 2025-01-18 17:57:25 +13:00
3697849067 genbindings: use dynamic_cast's return value to verify override is safe 2025-01-18 17:57:16 +13:00
Jacek Sieka
929e4e630a Simplify delete
The subclassing structure in `miqt` is such that nothing ever inherits
from `MiqtVirtual` - also, for `MiqtVirtual` to work correctly when Qt
deletes an instance part of a tree of widgets, the technique can only be
used with types that already have a virtual destructor.

Therefore:
* make `MiqtVirtual` final to ensure nothing inherits from it by
accident
* remove `virtual` inheritance of its base class - since there is no MI
invonved and no further inheritance, there can also not be any diamond
inheritance structures - removing `virtual` makes inheritance a bit
cheaper
* remove `isSubclass` from `delete` function - C++ already calls the
most inherited destructor
* mark destructor `override` to verify said assumption
2025-01-18 17:46:50 +13:00
Jacek Sieka
a0c6344ecd Avoid dependency on exported go header
The expected type of the callback is already known from the AST - this
change reduces dependency on cgo specifics and makes the generated C ABI
entirely cgo-independent - in particular, there is no need to include
`_cgo_export.h` any more.
2025-01-07 12:55:40 +01:00
dba031643c genbindings: move all large int constants to a 64-bit only build file 2024-12-31 16:48:28 +13:00
5a7a46e28f genbindings: use separate virtbase helper to get base pointers 2024-12-07 17:44:27 +13:00
1baf7342e5 genbindings: merge codepaths for go return value construction 2024-12-07 15:00:03 +13:00
5271f8d4a1 genbindings: panic when trying to override methods on non-subclass 2024-12-07 14:18:47 +13:00
9d587fdadf genbindings/go: avoid name collisions between enums and enum entries 2024-11-27 18:12:40 +13:00
a5dafbf132 genbindings: fix trying to add super parameters for pure virtual methods 2024-11-23 19:34:22 +13:00
c36d14c540 genbindings: allow some classes to inherit from QList<> 2024-11-23 19:32:09 +13:00
90de7178f2 genbindings: fix some cases of missing :: escaping 2024-11-19 19:59:55 +13:00
40abeecd54 genbindings/subclassing: accurate pointer type management for subclasses 2024-11-19 19:28:30 +13:00
6fa97722c5 genbindings: delete either subclass or direct class 2024-11-19 19:28:00 +13:00
fb56258334 genbindings: constructors return every subclass pointer 2024-11-19 19:27:19 +13:00
eca87471ee genbindings/types: pointer and return type fixes 2024-11-19 19:25:48 +13:00
8d1c871de3 genbindings/inherits: direct vs indirect inheritance 2024-11-19 19:24:50 +13:00
943ccf7b3a genbindings: subclass support for all virtual methods (3/3) 2024-11-19 19:17:37 +13:00
58f212303e genbindings: subclass support for all virtual methods (2/3) 2024-11-19 19:17:37 +13:00
fe6e9ce30b genbindings/qapplication: use LockOSThread() to bind Qt main thread 2024-11-18 19:28:36 +13:00
58ec6e1821 genbindings: add QPair<> support 2024-11-17 19:17:31 +13:00
dc39b7ca65 genbindings/containers: fixes for special characters in container names 2024-11-17 19:17:22 +13:00
caee076af8 genbindings/go: implement cabi type roundtrips for pointer types 2024-11-17 19:17:03 +13:00
5a3c3556a1 genbindings/intermediate: add Void() helper method 2024-11-17 19:16:51 +13:00
Rick Calixte
a067210548
genbindings: Lint cleanup 2024-11-13 08:33:51 -05:00
a009008525 genbindings: add qmap/qhash support 2024-11-04 21:33:45 +13:00
b53707c7cf genbindings: pass miqt_array in CABI by value 2024-11-04 20:18:11 +13:00
c4607aa5b8 genbindings: move cgo mallocSize into helper function 2024-11-04 18:38:17 +13:00
301fa27e83 genbindings/main: uniform handling for package subdirectories 2024-10-21 19:10:31 +13:00
9e7349d4e3 genbindings/qstringlist: need a larger malloc for qstring now 2024-10-19 16:09:42 +13:00
bb0132e0d5 genbindings/qbytearray: project as []byte 2024-10-19 13:06:53 +13:00
434c45273a miqt: pass all miqt_string by value, not by pointer 2024-10-19 13:06:53 +13:00
a78ba20f15 genbindings/go: add more detailed error message for unknown AST nodes 2024-10-19 13:06:53 +13:00
3547aa3103 genbindings/enums: prevent enum-class clashes, allow some more short enums 2024-10-19 13:06:53 +13:00
896f150f35 genbindings/go: normalize handling for void* return types 2024-10-19 13:06:53 +13:00
c66203d984 genbindings/go: return C char* as string 2024-10-19 13:06:53 +13:00
88ef4e922c genbindings: multi-package support 2024-10-16 18:07:05 +13:00
562590fa96 libmiqt: move binding helpers to standalone package, support const_char 2024-10-16 18:05:07 +13:00
0154e3507b genbindings: marshal cgo.Handle via intptr_t instead of void* 2024-10-13 19:05:52 +13:00
bcfdb4ea15 genbindings/integers: properly treat char as signed int8, not byte 2024-10-11 18:40:32 +13:00
60600530c6 genbindings/ints: ssize_t support 2024-10-11 18:40:06 +13:00
fc7aeecabf genbindings/go: fix for classes inheriting namespaced/inner classes 2024-10-11 18:40:06 +13:00
aadc37eb2d genbindings: allow void* as unsafe.Pointer 2024-09-21 11:32:59 +12:00
a6dab929e6 genbindings: add collision detection for short enum names 2024-09-21 10:43:18 +12:00
6a958309b0 genbindings/go: simpler enum naming 2024-09-20 19:13:15 +12:00
869e316715 genbindings/qflags: emit qflags as inner type 2024-09-20 18:41:22 +12:00
f6d1ef8ade genbindings/go: fix missing type cast calling go->cabi 2024-09-18 13:33:50 +12:00