#308 closed defect (fixed)
Variable argument functions not SWIGable.
| Reported by: | Owned by: | eugene | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | PSLib SDRS | Version: | unspecified |
| Severity: | major | Keywords: | |
| Cc: |
Description
Functions like psMetadataAdd use variable argument lists (the '...' in the
prototype), but that C functionality is not supported by SWIG. This requires
creating SWIG-only functions to wrap these functions with the various types
supported, so I suggest that change is folded into psLib as well. For example
psMetadataAdd would be replaced by:
psMetadataAddBool(psMetadata* md, int location, const char* name, int format,
const char* comment, psBool data);
psMetadataAddS32(psMetadata* md, int location, const char* name, int format,
const char* comment, psS32 data);
psMetadataAddF32(psMetadata* md, int location, const char* name, int format,
const char* comment, psF32 data);
psMetadataAddF64(psMetadata* md, int location, const char* name, int format,
const char* comment, psF64 data);
psMetadataAddList(psMetadata* md, int location, const char* name, int format,
const char* comment, psList* data);
psMetadataAddMeta(psMetadata* md, int location, const char* name, int format,
const char* comment, psMetadata* data);
psMetadataAddStr(psMetadata* md, int location, const char* name, int format,
const char* comment, char* data);
psMetadataAddVector(psMetadata* md, int location, const char* name, int format,
const char* comment, psVector* data);
...
psMetadataAddOther(psMetadata* md, int location, const char* name, int format,
const char* comment, psPtr* data);
-rdd
Change History (8)
comment:1 by , 21 years ago
| Owner: | changed from to |
|---|
comment:2 by , 21 years ago
| Status: | new → assigned |
|---|
comment:3 by , 21 years ago
So, should the functions required for SWIG be exposed in the C API as well?
comment:4 by , 21 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
yes, fold these back into the C API
comment:5 by , 21 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
I don't think that the format parameter is sufficient to determine the specific
typing information, as PS_META_PRIMATIVE can be psS32, psF32, psF64, etc.
The same problem exists for other functions like psMetadataItemAlloc as well.
The solution that Ross implemented was to add an additional parameter for the
primitive type (pType), but that seems not very palettable to me.
I suggest replacing the PS_META_PRIMITIVE psMetadataType enum with PS_META_S32,
PS_META_F32, etc., so that psMetadataType definitively specifies the type.
-rdd
comment:6 by , 21 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
comment:8 by , 21 years ago
psMetadata has been updated for the latest SDRS. Reopen this bug if the problem
is not resolved there.

Yes, we've known about this for a while, and this is the solution, more-or-less,
that we had assumed for the SWIG interfaces. However, as a C-API, we would like
to keep the existence of the varargs version as well. I would expect the
underlying code to already make a switch and pass arguments to functions like
those listed above.
I think you can simplify things further. The type is still being passed via
format, so all pointer type entries can be passed as a pointer and the behavior
interpretted in the called function on the basis of the type part of the format.
need the F64 version. The same is true for ints, though you need a signed and
unsigned version (S64 and U64), I think.