From 78c857c572cb63f0f4c9dac51589c04f8cadac79 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Wed, 17 Jul 2024 16:03:52 -0700 Subject: [PATCH 01/13] Added PDFUAConformance & PDFUAOptions --- PDFNetPHP/PDFNetPHP.i | 6 ++++++ PDFNetPython/PDFNetPython.i | 6 ++++++ PDFNetRuby/PDFNetRuby.i | 8 +++++++- PDFTronGo/pdftron.i | 6 ++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/PDFNetPHP/PDFNetPHP.i b/PDFNetPHP/PDFNetPHP.i index 2239b9d3..4fb9f9ab 100644 --- a/PDFNetPHP/PDFNetPHP.i +++ b/PDFNetPHP/PDFNetPHP.i @@ -123,6 +123,10 @@ // header files in /PDFNetC/Headers/PDF/PDFA #include "PDF/PDFA/PDFACompliance.h" #include "PDF/PDFA/PDFAOptions.h" + + // header files in /PDFNetC/Headers/PDF/PDFUA + #include "PDF/PDFUA/PDFUAConformance.h" + #include "PDF/PDFUA/PDFUAOptions.h" // header files in /PDFNetC/Headers/PDF/Struct #include "PDF/Struct/AttrObj.h" @@ -1018,6 +1022,8 @@ namespace pdftron { %include "PDF/OCG/OCMD.h" %include "PDF/PDFA/PDFAOptions.h" %include "PDF/PDFA/PDFACompliance.h" +%include "PDF/PDFUA/PDFUAOptions.h" +%include "PDF/PDFUA/PDFUAConformance.h" %include "PDF/Struct/AttrObj.h" %include "PDF/Struct/ClassMap.h" %include "PDF/Struct/ContentItem.h" diff --git a/PDFNetPython/PDFNetPython.i b/PDFNetPython/PDFNetPython.i index 63a89f38..d31de88a 100644 --- a/PDFNetPython/PDFNetPython.i +++ b/PDFNetPython/PDFNetPython.i @@ -116,6 +116,10 @@ // header files in /PDFNetC/Headers/PDF/PDFA #include "PDF/PDFA/PDFACompliance.h" #include "PDF/PDFA/PDFAOptions.h" + + // header files in /PDFNetC/Headers/PDF/PDFUA + #include "PDF/PDFUA/PDFUAConformance.h" + #include "PDF/PDFUA/PDFUAOptions.h" // header files in /PDFNetC/Headers/PDF/Struct #include "PDF/Struct/AttrObj.h" @@ -867,6 +871,8 @@ namespace pdftron { %include "PDF/OCG/OCMD.h" %include "PDF/PDFA/PDFAOptions.h" %include "PDF/PDFA/PDFACompliance.h" +%include "PDF/PDFUA/PDFUAOptions.h" +%include "PDF/PDFUA/PDFUAConformance.h" %include "PDF/Struct/AttrObj.h" %include "PDF/Struct/ClassMap.h" %include "PDF/Struct/ContentItem.h" diff --git a/PDFNetRuby/PDFNetRuby.i b/PDFNetRuby/PDFNetRuby.i index b1c53668..cc69d1e1 100644 --- a/PDFNetRuby/PDFNetRuby.i +++ b/PDFNetRuby/PDFNetRuby.i @@ -104,9 +104,13 @@ #include "PDF/OCG/Group.h" #include "PDF/OCG/OCMD.h" - // header files in /PDFNetC/Headers/PDF/PDfA + // header files in /PDFNetC/Headers/PDF/PDFA #include "PDF/PDFA/PDFACompliance.h" #include "PDF/PDFA/PDFAOptions.h" + + // header files in /PDFNetC/Headers/PDF/PDFUA + #include "PDF/PDFUA/PDFUAConformance.h" + #include "PDF/PDFUA/PDFUAOptions.h" // header files in /PDFNetC/Headers/PDF/Struct #include "PDF/Struct/AttrObj.h" @@ -802,6 +806,8 @@ namespace pdftron { %include "PDF/OCG/OCMD.h" %include "PDF/PDFA/PDFAOptions.h" %include "PDF/PDFA/PDFACompliance.h" +%include "PDF/PDFUA/PDFUAOptions.h" +%include "PDF/PDFUA/PDFUAConformance.h" %include "PDF/Struct/AttrObj.h" %include "PDF/Struct/ClassMap.h" %include "PDF/Struct/ContentItem.h" diff --git a/PDFTronGo/pdftron.i b/PDFTronGo/pdftron.i index 1c0c8352..b6b192cf 100644 --- a/PDFTronGo/pdftron.i +++ b/PDFTronGo/pdftron.i @@ -79,6 +79,10 @@ // header files in /PDFNetC/Headers/PDF/PDFA #include "PDF/PDFA/PDFACompliance.h" #include "PDF/PDFA/PDFAOptions.h" + + // header files in /PDFNetC/Headers/PDF/PDFUA + #include "PDF/PDFUA/PDFUAConformance.h" + #include "PDF/PDFUA/PDFUAOptions.h" // header files in /PDFNetC/Headers/PDF/Struct #include "PDF/Struct/AttrObj.h" @@ -430,6 +434,8 @@ namespace pdftron { %include "PDF/OCG/OCMD.h" %include "PDF/PDFA/PDFAOptions.h" %include "PDF/PDFA/PDFACompliance.h" +%include "PDF/PDFUA/PDFUAOptions.h" +%include "PDF/PDFUA/PDFUAConformance.h" %include "PDF/Struct/AttrObj.h" %include "PDF/Struct/ClassMap.h" %include "PDF/Struct/ContentItem.h" From ad5ca848ef885fcfad536c0aabefb93db6f91876 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Fri, 19 Jul 2024 12:14:31 -0700 Subject: [PATCH 02/13] Experimental (cur Python only): change order of PDFUA %include --- PDFNetPython/PDFNetPython.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PDFNetPython/PDFNetPython.i b/PDFNetPython/PDFNetPython.i index d31de88a..765eeb7e 100644 --- a/PDFNetPython/PDFNetPython.i +++ b/PDFNetPython/PDFNetPython.i @@ -871,8 +871,8 @@ namespace pdftron { %include "PDF/OCG/OCMD.h" %include "PDF/PDFA/PDFAOptions.h" %include "PDF/PDFA/PDFACompliance.h" -%include "PDF/PDFUA/PDFUAOptions.h" %include "PDF/PDFUA/PDFUAConformance.h" +%include "PDF/PDFUA/PDFUAOptions.h" %include "PDF/Struct/AttrObj.h" %include "PDF/Struct/ClassMap.h" %include "PDF/Struct/ContentItem.h" From 6a26e19196f3516f7d60a5d327a2cb775f7a620f Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Fri, 19 Jul 2024 15:14:19 -0700 Subject: [PATCH 03/13] Change order of PDFUA %include for PHP, Ruby, GO --- PDFNetPHP/PDFNetPHP.i | 2 +- PDFNetRuby/PDFNetRuby.i | 2 +- PDFTronGo/pdftron.i | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PDFNetPHP/PDFNetPHP.i b/PDFNetPHP/PDFNetPHP.i index 4fb9f9ab..8cc5904b 100644 --- a/PDFNetPHP/PDFNetPHP.i +++ b/PDFNetPHP/PDFNetPHP.i @@ -1022,8 +1022,8 @@ namespace pdftron { %include "PDF/OCG/OCMD.h" %include "PDF/PDFA/PDFAOptions.h" %include "PDF/PDFA/PDFACompliance.h" -%include "PDF/PDFUA/PDFUAOptions.h" %include "PDF/PDFUA/PDFUAConformance.h" +%include "PDF/PDFUA/PDFUAOptions.h" %include "PDF/Struct/AttrObj.h" %include "PDF/Struct/ClassMap.h" %include "PDF/Struct/ContentItem.h" diff --git a/PDFNetRuby/PDFNetRuby.i b/PDFNetRuby/PDFNetRuby.i index cc69d1e1..7365846f 100644 --- a/PDFNetRuby/PDFNetRuby.i +++ b/PDFNetRuby/PDFNetRuby.i @@ -806,8 +806,8 @@ namespace pdftron { %include "PDF/OCG/OCMD.h" %include "PDF/PDFA/PDFAOptions.h" %include "PDF/PDFA/PDFACompliance.h" -%include "PDF/PDFUA/PDFUAOptions.h" %include "PDF/PDFUA/PDFUAConformance.h" +%include "PDF/PDFUA/PDFUAOptions.h" %include "PDF/Struct/AttrObj.h" %include "PDF/Struct/ClassMap.h" %include "PDF/Struct/ContentItem.h" diff --git a/PDFTronGo/pdftron.i b/PDFTronGo/pdftron.i index b6b192cf..278c3d04 100644 --- a/PDFTronGo/pdftron.i +++ b/PDFTronGo/pdftron.i @@ -434,8 +434,8 @@ namespace pdftron { %include "PDF/OCG/OCMD.h" %include "PDF/PDFA/PDFAOptions.h" %include "PDF/PDFA/PDFACompliance.h" -%include "PDF/PDFUA/PDFUAOptions.h" %include "PDF/PDFUA/PDFUAConformance.h" +%include "PDF/PDFUA/PDFUAOptions.h" %include "PDF/Struct/AttrObj.h" %include "PDF/Struct/ClassMap.h" %include "PDF/Struct/ContentItem.h" From 0b89e2e133641b37a88c3b052fd52f0fdbbdb520 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Mon, 22 Jul 2024 13:48:39 -0700 Subject: [PATCH 04/13] Temp remove buggy cron call to avoid jenkins auto-building --- jenkinsfiles/build_win_go.groovy | 2 -- 1 file changed, 2 deletions(-) diff --git a/jenkinsfiles/build_win_go.groovy b/jenkinsfiles/build_win_go.groovy index 45559c05..c32d5fc8 100644 --- a/jenkinsfiles/build_win_go.groovy +++ b/jenkinsfiles/build_win_go.groovy @@ -14,8 +14,6 @@ pipeline { GOCACHE = "/tmp/.cache" } - triggers { cron(cron_string) } - parameters { string(name: "FORCE_BRANCH_VERSION", defaultValue: "" , description: "Set to a version if you wish to change the core SDK version used.") From 58c51682498af8041981b10efbb414c9c27c535c Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Tue, 23 Jul 2024 13:43:09 -0700 Subject: [PATCH 05/13] Experimental: adding VectorValidationError, test on Python only for now --- PDFNetPython/PDFNetPython.i | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PDFNetPython/PDFNetPython.i b/PDFNetPython/PDFNetPython.i index 765eeb7e..15ad0aef 100644 --- a/PDFNetPython/PDFNetPython.i +++ b/PDFNetPython/PDFNetPython.i @@ -277,6 +277,9 @@ namespace std { %template(VectorX501AttributeTypeAndValue) vector; %template(VectorByteRange) vector; %template(VectorVectorX509Certificate) vector >; + + specialize_std_vector(pdftron::PDF::PDFUA::PDFUAConformance::ValidationError, PyInt_Check, PyInt_AsLong, PyInt_FromLong); + %template(VectorValidationError) vector; }; /** From 962b4cd0f8240615be2c2bce4fd3a6060af3985a Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Tue, 23 Jul 2024 14:43:49 -0700 Subject: [PATCH 06/13] Try removing specialize_std_vector --- PDFNetPython/PDFNetPython.i | 1 - 1 file changed, 1 deletion(-) diff --git a/PDFNetPython/PDFNetPython.i b/PDFNetPython/PDFNetPython.i index 15ad0aef..099bfbe4 100644 --- a/PDFNetPython/PDFNetPython.i +++ b/PDFNetPython/PDFNetPython.i @@ -278,7 +278,6 @@ namespace std { %template(VectorByteRange) vector; %template(VectorVectorX509Certificate) vector >; - specialize_std_vector(pdftron::PDF::PDFUA::PDFUAConformance::ValidationError, PyInt_Check, PyInt_AsLong, PyInt_FromLong); %template(VectorValidationError) vector; }; From 266116f88bfb541846203055228adb7cab55f662 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Tue, 23 Jul 2024 17:32:18 -0700 Subject: [PATCH 07/13] Try adding typemaps for PDFUAConformance::ValidationError --- PDFNetPython/PDFNetPython.i | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/PDFNetPython/PDFNetPython.i b/PDFNetPython/PDFNetPython.i index 099bfbe4..56be7b42 100644 --- a/PDFNetPython/PDFNetPython.i +++ b/PDFNetPython/PDFNetPython.i @@ -280,6 +280,7 @@ namespace std { %template(VectorValidationError) vector; }; +//%template(VectorValidationError) std::vector; /** * Forward declaration of some classes which helps solve circular dependency @@ -401,6 +402,33 @@ namespace pdftron { $1 = PyInt_Check($input) ? 1 : 0; } +//---------------------------------------------------------------------------------------------- + +/** + * Typemapping for enums + * Python can takes in an integer which is then converted to an enum + * in the wrapper. The following mapping is needed because ErrorCode is + * passed in as a pointer + */ +namespace pdftrong { namespace PDF { namespace PDFUA { + + /* Convert from Python --> C */ + %typemap(in) PDFUAConformance::ValidationError + { + $1 = PyInt_AsLong($input); + } + + /* Convert from C --> Python */ + %typemap(out) PDFUAConformance::ValidationError { + $result = static_cast(PyInt_FromLong($1)); + } + + %typemap(typecheck) PDFUAConformance::ValidationError { + $1 = PyInt_Check($input) ? 1 : 0; + } + +}}}; + //---------------------------------------------------------------------------------------------- /** * Ignoring one of the overloaded methods From 204a3c975b3495da42f0c4e8b5d100f61077c523 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Tue, 23 Jul 2024 17:52:13 -0700 Subject: [PATCH 08/13] Fix casting for typemap for PDFUAConformance::Validation --- PDFNetPython/PDFNetPython.i | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/PDFNetPython/PDFNetPython.i b/PDFNetPython/PDFNetPython.i index 56be7b42..24125a05 100644 --- a/PDFNetPython/PDFNetPython.i +++ b/PDFNetPython/PDFNetPython.i @@ -410,24 +410,20 @@ namespace pdftron { * in the wrapper. The following mapping is needed because ErrorCode is * passed in as a pointer */ -namespace pdftrong { namespace PDF { namespace PDFUA { - - /* Convert from Python --> C */ - %typemap(in) PDFUAConformance::ValidationError - { - $1 = PyInt_AsLong($input); - } - - /* Convert from C --> Python */ - %typemap(out) PDFUAConformance::ValidationError { - $result = static_cast(PyInt_FromLong($1)); - } +/* Convert from Python --> C */ +%typemap(in) pdftron::PDF::PDFUA::PDFUAConformance::ValidationError +{ + $1 = static_cast(PyInt_AsLong($input)); +} - %typemap(typecheck) PDFUAConformance::ValidationError { - $1 = PyInt_Check($input) ? 1 : 0; - } +/* Convert from C --> Python */ +%typemap(out) pdftron::PDF::PDFUA::PDFUAConformance::ValidationError { + $result = PyInt_FromLong($1); +} -}}}; +%typemap(typecheck) pdftron::PDF::PDFUA::PDFUAConformance::ValidationError { + $1 = PyInt_Check($input) ? 1 : 0; +} //---------------------------------------------------------------------------------------------- /** From 8777956c06949a86a388ca3029e93206da8e76ca Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Tue, 23 Jul 2024 18:32:42 -0700 Subject: [PATCH 09/13] Try specialize_std_vector_again --- PDFNetPython/PDFNetPython.i | 45 ++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/PDFNetPython/PDFNetPython.i b/PDFNetPython/PDFNetPython.i index 24125a05..f77b941b 100644 --- a/PDFNetPython/PDFNetPython.i +++ b/PDFNetPython/PDFNetPython.i @@ -278,9 +278,11 @@ namespace std { %template(VectorByteRange) vector; %template(VectorVectorX509Certificate) vector >; + // note that the c-style cast is pretty hax, only works because the lexigraphical replacement works out, + // I'm not actually sure what the best way is to do more complex logic, declare a function? + specialize_std_vector(pdftron::PDF::PDFUA::PDFUAConformance::ValidationError, PyInt_Check, (pdftron::PDF::PDFUA::PDFUAConformance::ValidationError)PyInt_AsLong, PyInt_FromLong); %template(VectorValidationError) vector; }; -//%template(VectorValidationError) std::vector; /** * Forward declaration of some classes which helps solve circular dependency @@ -404,26 +406,27 @@ namespace pdftron { //---------------------------------------------------------------------------------------------- -/** - * Typemapping for enums - * Python can takes in an integer which is then converted to an enum - * in the wrapper. The following mapping is needed because ErrorCode is - * passed in as a pointer - */ -/* Convert from Python --> C */ -%typemap(in) pdftron::PDF::PDFUA::PDFUAConformance::ValidationError -{ - $1 = static_cast(PyInt_AsLong($input)); -} - -/* Convert from C --> Python */ -%typemap(out) pdftron::PDF::PDFUA::PDFUAConformance::ValidationError { - $result = PyInt_FromLong($1); -} - -%typemap(typecheck) pdftron::PDF::PDFUA::PDFUAConformance::ValidationError { - $1 = PyInt_Check($input) ? 1 : 0; -} +//// Not needed after all? +///** +// * Typemapping for enums +// * Python can takes in an integer which is then converted to an enum +// * in the wrapper. The following mapping is needed because ErrorCode is +// * passed in as a pointer +// */ +///* Convert from Python --> C */ +//%typemap(in) pdftron::PDF::PDFUA::PDFUAConformance::ValidationError +//{ +// $1 = static_cast(PyInt_AsLong($input)); +//} +// +///* Convert from C --> Python */ +//%typemap(out) pdftron::PDF::PDFUA::PDFUAConformance::ValidationError { +// $result = PyInt_FromLong($1); +//} +// +//%typemap(typecheck) pdftron::PDF::PDFUA::PDFUAConformance::ValidationError { +// $1 = PyInt_Check($input) ? 1 : 0; +//} //---------------------------------------------------------------------------------------------- /** From 2725d85537eeb0f3a85848c75bd86758954c9a38 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Wed, 7 Aug 2024 10:26:43 -0700 Subject: [PATCH 10/13] add %template(VectorUInt) to python wrappers --- PDFNetPython/PDFNetPython.i | 1 + 1 file changed, 1 insertion(+) diff --git a/PDFNetPython/PDFNetPython.i b/PDFNetPython/PDFNetPython.i index f77b941b..2748ccf1 100644 --- a/PDFNetPython/PDFNetPython.i +++ b/PDFNetPython/PDFNetPython.i @@ -266,6 +266,7 @@ namespace std { %template(VectorUChar) vector; %template(VectorChar) vector; %template(VectorInt) vector; + %template(VectorUInt) vector; %template(VectorString) vector; %template(VectorRedaction) vector; %template(VectorQuadPoint) vector; From 72cdd465028a7fc4430d2e48316c0636d7ef4e7c Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Wed, 7 Aug 2024 14:00:14 -0700 Subject: [PATCH 11/13] Add vector %template calls to other wrappers - %template(VectorValidationError) - %template(VectorUInt) -- note: assuming UInt32 == unsigned int --- PDFNetPHP/PDFNetPHP.i | 7 +++++++ PDFNetPython/PDFNetPython.i | 3 ++- PDFNetRuby/PDFNetRuby.i | 7 +++++++ PDFTronGo/pdftron.i | 7 +++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/PDFNetPHP/PDFNetPHP.i b/PDFNetPHP/PDFNetPHP.i index 8cc5904b..ea1da486 100644 --- a/PDFNetPHP/PDFNetPHP.i +++ b/PDFNetPHP/PDFNetPHP.i @@ -270,6 +270,7 @@ namespace std { %template(VectorUChar) vector; %template(VectorChar) vector; %template(VectorInt) vector; + %template(VectorUInt) vector; //%template(VectorString) vector; %template(VectorRedaction) vector; %template(VectorQuadPoint) vector; @@ -281,6 +282,12 @@ namespace std { %template(VectorX509Certificate) vector; %template(VectorByteRange) vector; %template(VectorVectorX509Certificate) vector >; + + // note that the c-style cast (to ValidationError) is pretty hax, + // only works because the lexicographical replacement works out in SWIG's generator impl. + // I'm not actually sure what the best way is to do more complex logic, declare a function? + specialize_std_vector(pdftron::PDF::PDFUA::PDFUAConformance::ValidationError, PyInt_Check, (pdftron::PDF::PDFUA::PDFUAConformance::ValidationError)PyInt_AsLong, PyInt_FromLong); + %template(VectorValidationError) vector; }; /** diff --git a/PDFNetPython/PDFNetPython.i b/PDFNetPython/PDFNetPython.i index 2748ccf1..c90c19fe 100644 --- a/PDFNetPython/PDFNetPython.i +++ b/PDFNetPython/PDFNetPython.i @@ -279,7 +279,8 @@ namespace std { %template(VectorByteRange) vector; %template(VectorVectorX509Certificate) vector >; - // note that the c-style cast is pretty hax, only works because the lexigraphical replacement works out, + // note that the c-style cast (to ValidationError) is pretty hax, + // only works because the lexicographical replacement works out in SWIG's generator impl. // I'm not actually sure what the best way is to do more complex logic, declare a function? specialize_std_vector(pdftron::PDF::PDFUA::PDFUAConformance::ValidationError, PyInt_Check, (pdftron::PDF::PDFUA::PDFUAConformance::ValidationError)PyInt_AsLong, PyInt_FromLong); %template(VectorValidationError) vector; diff --git a/PDFNetRuby/PDFNetRuby.i b/PDFNetRuby/PDFNetRuby.i index 7365846f..018429c3 100644 --- a/PDFNetRuby/PDFNetRuby.i +++ b/PDFNetRuby/PDFNetRuby.i @@ -252,6 +252,7 @@ namespace std { %template(VectorUChar) vector; %template(VectorChar) vector; %template(VectorInt) vector; + %template(VectorUInt) vector; %template(VectorString) vector; %template(VectorRedaction) vector; %template(VectorQuadPoint) vector; @@ -263,6 +264,12 @@ namespace std { %template(VectorX509Certificate) vector; %template(VectorByteRange) vector; %template(VectorVectorX509Certificate) vector >; + + // note that the c-style cast (to ValidationError) is pretty hax, + // only works because the lexicographical replacement works out in SWIG's generator impl. + // I'm not actually sure what the best way is to do more complex logic, declare a function? + specialize_std_vector(pdftron::PDF::PDFUA::PDFUAConformance::ValidationError, PyInt_Check, (pdftron::PDF::PDFUA::PDFUAConformance::ValidationError)PyInt_AsLong, PyInt_FromLong); + %template(VectorValidationError) vector; }; /** diff --git a/PDFTronGo/pdftron.i b/PDFTronGo/pdftron.i index 278c3d04..7b8a70ee 100644 --- a/PDFTronGo/pdftron.i +++ b/PDFTronGo/pdftron.i @@ -240,6 +240,7 @@ namespace std { %template(VectorUChar) vector; %template(VectorChar) vector; %template(VectorInt) vector; + %template(VectorUInt) vector; %template(VectorString) vector; %template(VectorRedaction) vector; %template(VectorQuadPoint) vector; @@ -251,6 +252,12 @@ namespace std { %template(VectorX501AttributeTypeAndValue) vector; %template(VectorByteRange) vector; %template(VectorVectorX509Certificate) vector >; + + // note that the c-style cast (to ValidationError) is pretty hax, + // only works because the lexicographical replacement works out in SWIG's generator impl. + // I'm not actually sure what the best way is to do more complex logic, declare a function? + specialize_std_vector(pdftron::PDF::PDFUA::PDFUAConformance::ValidationError, PyInt_Check, (pdftron::PDF::PDFUA::PDFUAConformance::ValidationError)PyInt_AsLong, PyInt_FromLong); + %template(VectorValidationError) vector; }; /** From 8c2aac26e54a4598f8ceab3adfc07f4b22d075c1 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Wed, 7 Aug 2024 14:23:27 -0700 Subject: [PATCH 12/13] Removed uneeded (experimental) typemaps --- PDFNetPython/PDFNetPython.i | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/PDFNetPython/PDFNetPython.i b/PDFNetPython/PDFNetPython.i index c90c19fe..a0b3ace8 100644 --- a/PDFNetPython/PDFNetPython.i +++ b/PDFNetPython/PDFNetPython.i @@ -406,30 +406,6 @@ namespace pdftron { $1 = PyInt_Check($input) ? 1 : 0; } -//---------------------------------------------------------------------------------------------- - -//// Not needed after all? -///** -// * Typemapping for enums -// * Python can takes in an integer which is then converted to an enum -// * in the wrapper. The following mapping is needed because ErrorCode is -// * passed in as a pointer -// */ -///* Convert from Python --> C */ -//%typemap(in) pdftron::PDF::PDFUA::PDFUAConformance::ValidationError -//{ -// $1 = static_cast(PyInt_AsLong($input)); -//} -// -///* Convert from C --> Python */ -//%typemap(out) pdftron::PDF::PDFUA::PDFUAConformance::ValidationError { -// $result = PyInt_FromLong($1); -//} -// -//%typemap(typecheck) pdftron::PDF::PDFUA::PDFUAConformance::ValidationError { -// $1 = PyInt_Check($input) ? 1 : 0; -//} - //---------------------------------------------------------------------------------------------- /** * Ignoring one of the overloaded methods From e9593316ed1172fa8922258b44d895f340af7be8 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Wed, 7 Aug 2024 14:52:12 -0700 Subject: [PATCH 13/13] Commented specialize_std_vector in non-Python for now, until replacement convert fns found - TODO: find language specific replacements for python convert functions --- PDFNetPHP/PDFNetPHP.i | 9 +++++---- PDFNetRuby/PDFNetRuby.i | 9 +++++---- PDFTronGo/pdftron.i | 9 +++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/PDFNetPHP/PDFNetPHP.i b/PDFNetPHP/PDFNetPHP.i index ea1da486..920ac79f 100644 --- a/PDFNetPHP/PDFNetPHP.i +++ b/PDFNetPHP/PDFNetPHP.i @@ -283,10 +283,11 @@ namespace std { %template(VectorByteRange) vector; %template(VectorVectorX509Certificate) vector >; - // note that the c-style cast (to ValidationError) is pretty hax, - // only works because the lexicographical replacement works out in SWIG's generator impl. - // I'm not actually sure what the best way is to do more complex logic, declare a function? - specialize_std_vector(pdftron::PDF::PDFUA::PDFUAConformance::ValidationError, PyInt_Check, (pdftron::PDF::PDFUA::PDFUAConformance::ValidationError)PyInt_AsLong, PyInt_FromLong); +// Update: we obviously can't use PyInt_Check etc functions. TODO: find/write replacements in each language +// // note that the c-style cast (to ValidationError) is pretty hax, +// // only works because the lexicographical replacement works out in SWIG's generator impl. +// // I'm not actually sure what the best way is to do more complex logic, declare a function? +// specialize_std_vector(pdftron::PDF::PDFUA::PDFUAConformance::ValidationError, PyInt_Check, (pdftron::PDF::PDFUA::PDFUAConformance::ValidationError)PyInt_AsLong, PyInt_FromLong); %template(VectorValidationError) vector; }; diff --git a/PDFNetRuby/PDFNetRuby.i b/PDFNetRuby/PDFNetRuby.i index 018429c3..c228eef4 100644 --- a/PDFNetRuby/PDFNetRuby.i +++ b/PDFNetRuby/PDFNetRuby.i @@ -265,10 +265,11 @@ namespace std { %template(VectorByteRange) vector; %template(VectorVectorX509Certificate) vector >; - // note that the c-style cast (to ValidationError) is pretty hax, - // only works because the lexicographical replacement works out in SWIG's generator impl. - // I'm not actually sure what the best way is to do more complex logic, declare a function? - specialize_std_vector(pdftron::PDF::PDFUA::PDFUAConformance::ValidationError, PyInt_Check, (pdftron::PDF::PDFUA::PDFUAConformance::ValidationError)PyInt_AsLong, PyInt_FromLong); +// Update: we obviously can't use PyInt_Check etc functions. TODO: find/write replacements in each language +// // note that the c-style cast (to ValidationError) is pretty hax, +// // only works because the lexicographical replacement works out in SWIG's generator impl. +// // I'm not actually sure what the best way is to do more complex logic, declare a function? +// specialize_std_vector(pdftron::PDF::PDFUA::PDFUAConformance::ValidationError, PyInt_Check, (pdftron::PDF::PDFUA::PDFUAConformance::ValidationError)PyInt_AsLong, PyInt_FromLong); %template(VectorValidationError) vector; }; diff --git a/PDFTronGo/pdftron.i b/PDFTronGo/pdftron.i index 7b8a70ee..7815ce85 100644 --- a/PDFTronGo/pdftron.i +++ b/PDFTronGo/pdftron.i @@ -253,10 +253,11 @@ namespace std { %template(VectorByteRange) vector; %template(VectorVectorX509Certificate) vector >; - // note that the c-style cast (to ValidationError) is pretty hax, - // only works because the lexicographical replacement works out in SWIG's generator impl. - // I'm not actually sure what the best way is to do more complex logic, declare a function? - specialize_std_vector(pdftron::PDF::PDFUA::PDFUAConformance::ValidationError, PyInt_Check, (pdftron::PDF::PDFUA::PDFUAConformance::ValidationError)PyInt_AsLong, PyInt_FromLong); +// Update: we obviously can't use PyInt_Check etc functions. TODO: find/write replacements in each language +// // note that the c-style cast (to ValidationError) is pretty hax, +// // only works because the lexicographical replacement works out in SWIG's generator impl. +// // I'm not actually sure what the best way is to do more complex logic, declare a function? +// specialize_std_vector(pdftron::PDF::PDFUA::PDFUAConformance::ValidationError, PyInt_Check, (pdftron::PDF::PDFUA::PDFUAConformance::ValidationError)PyInt_AsLong, PyInt_FromLong); %template(VectorValidationError) vector; };