Commit Graph

230 Commits

Author SHA1 Message Date
William S Fulton 98641c78a2 Correct some docs about javapackage
Closes issue #2776

[ci-skip]
2025-06-28 16:09:06 +01:00
William S Fulton 1fa70fb4a7 Java docs enhancement for handling deleted objects
[skip-ci]
2025-06-27 18:36:04 +01:00
Olly Betts 43cc74f85d Clarify Java docs
In fact "javagetcptr" and "javaptrconstructormodifiers" were completely
removed, not just deprecated.
2025-06-17 14:14:14 +12:00
William S Fulton dcca453b45 More %interface docs
Improvements given comments in issue #3100.
2025-01-27 20:35:26 +00:00
William S Fulton e1b2d20f61 Destructor declaration correction in docs 2025-01-24 19:20:34 +00:00
William S Fulton 3769110139 Java docs code style corrections 2024-10-23 18:35:36 +01:00
William S Fulton 7635b40331 Improve C# Java docs for memory handling and member variable accessors 2024-10-23 18:35:36 +01:00
William S Fulton a9784d98ec C chapter added, HTML corrections
Added C to experimental target languages section
Usual html fixes and heading updates after running make
2024-09-16 19:51:37 +01:00
William S Fulton cbff768feb Add the %interface_additional macro
New macro added to the family of %interface macros. This new macro
is for adding additional interfaces for the generated interface to
extend/derive from.

Closes #1188
2024-09-11 20:05:30 +01:00
William S Fulton 8611d1f435 Document solutions for mismatch in C++ access specifiers and Java access modifiers
Closes #2991
2024-08-23 21:57:36 +01:00
William S Fulton 51b281eff0 Add the Java constantsmodifiers pragma 2024-08-09 19:27:42 +01:00
Olly Betts e5b968f67e Suggest -fPIC instead of -fpic
On platforms where they're different -fpic can fail so -fPIC is a
better option to direct users to.
2024-07-26 08:34:02 +12:00
William S Fulton ba9b0a35ab Merge branch 'char_binary_java_fix-tidyup'
* char_binary_java_fix-tidyup:
  Move SWIGStringWithLengthHelper to csharphead.swg
  cdata whitespace/cosmetic fixups
  cdata doc updates
  Rename `typemaps/cdata_struct.swg` to `typemaps/cdata_begin.swg`. And `typemaps/cdata.swg` to `typemaps/cdata.swg`. Move `cdata_apply.swg` content to `typemaps/cdata.swg`.
  Group the C# marshalling of STRING-LENGTH typemap  into C# class named SWIGStringWithLengthHelper.
  Leave Length & string reverse order typemap in typemaps/strings.swg
  Support old C# as "LPUTF8Str" was add in 2017.
  Improve documentation. Follow @wsfulton reviews.
  Use a dummy for MzScheme and untested OCaml cdate. To prevent compilation error.
  Further fixing follow reviews.
  Reorganise raw data typemap,  so typemaps folder contain only common part. Improve document.
  Inline SWIG_string_to_utf8_bytes SWIG_utf8_bytes_to_string code
  Fixes of STRING/BYTES LENGTH typemaps.

 Conflicts:
	CHANGES.current
2024-06-13 10:53:19 +01:00
William S Fulton ea2380d52a cdata doc updates
The cdata.i docs in C#, Java, D, Go had a confusing mix of target language
and C declarations. Improve the main cdata documentation in Library.html instead.
2024-06-07 08:27:15 +01:00
William S Fulton 71e639bd13 Add docs for %nspacemove 2024-06-01 13:41:51 +01:00
Erez Geva 53a6c691c7 Improve documentation.
Follow @wsfulton reviews.

Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
2024-03-10 00:17:22 +01:00
Erez Geva 1bf59e0bbc Fixes of STRING/BYTES LENGTH typemaps.
Fix Java STRING LENGTH typemap.
Use string type in static typed languages (Java, C#, D and Go).

Add BYTES LENGTH typemap and apply it for binary data.
Use byte type in static typed languages.

Add li_cdata_cpp, li_cdata and char_binary
 tests for most of languages(apart from R and experimental).

Fix the director_binary_string test and add it to C#, D, Go,
 Perl, PHP, Python, Ruby and octave.

Update documents.

Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
2024-02-29 02:09:09 +01:00
William S Fulton 3cfaae48ef Add csbegin, dbegin, javabegin for %module
[C#] Support nullable reference types. A generic C# option to the
%module directive allows one to add in any code at the beginning of every
C# file. This can add the #nullable enable preprocessor directive at the beginning
of every C# file in order to enable nullable reference types as follows:

  %module(csbegin="#nullable enable\n") mymodule

Closes #2681

[D, Java] Add the dbegin option to the %module directive for generating code at
the beginning of every D file. Similarly javabegin for Java. This enables one
to add a common comment at the start of each D/Java file.
2023-11-06 19:12:35 +00:00
William S Fulton ecaa052f3d carrays.i library modified to use size_t instead of int
in the %array_functions and %array_class macros.

Affects C#, D, Go, Guile, Java, Javascript, Lua, Ocaml, R, Racket.
Closes #1680

If the old types are required for backwards compatibility, use %apply to
restore the old types as follows:

  %include "carrays.i"
  %apply int { size_t nelements, size_t index }
  ... %array_functions and %array_class ...
  %clear size_t nelements, size_t index; # To be safe in case used elsewhere
2023-10-11 08:23:16 +01:00
William S Fulton 280b3a908e Java STL changes to use Java int, support 64-bit size_t
std::vector::capacity and std::vector::reserve signature changes.

Java api changes from:
  public long capacity() { ... }
  public void reserve(long n) { ... }
to:
  public int capacity() { ... }
  public void reserve(int n) { ... }
to fit in with the usual Java convention of using int for container
indexing and sizing.

The original api for std::vector::reserve can be also be made available via
%extend to add in an overloaded method as follows:

  %include <std_vector.i>
  %extend std::vector {
    void reserve(jlong n) throw (std::length_error, std::out_of_range) {
      if (n < 0)
        throw std::out_of_range("vector reserve size must be positive");
      self->reserve(n);
    }
  }

This change is partially driven by the need to seamlessly support the full
64-bit range for size_t generically, apart from the customisations for the
STL containers, by using:

  %apply unsigned long long { size_t };
  %apply const unsigned long long & { const size_t & };

Similarly for std::array::size.

Also enhance docs for applying unsigned long long typemaps for 64-bit
size_t.
2023-10-06 19:42:39 +01:00
William S Fulton 7bba06b03e Java - SWIGWORDSIZE64 for long type
Defining SWIGWORDSIZE64 now applies the (unsigned) long long
typemaps to (unsigned) long for a better match on systems
where long is 64-bits.

Although size_t typemaps are now applied from the int typemaps instead
of the long typemaps, identical code is generated and the mapping is
still to the Java signed long type.

Closes #646
Closes #649

Running the test-suite as follows on a 64-bit long system:

  env SWIG_FEATURES=-DSWIGWORDSIZE64 make check-java-test-suite

passes, except for a few tests which fail where they expect the
default Java type to be int or long instead of long or BigInteger
respectively.

Also arrays_java.i results in:
  invalid conversion from ‘long int*’ to ‘long long int*’ [-fpermissive]
  invalid conversion from ‘long int**’ to ‘long long int**’ [-fpermissive]
2023-10-05 21:30:30 +01:00
Olly Betts 0681e6f603 Eliminate reference to old SWIG doc system 2023-06-15 15:05:16 +12:00
William S Fulton c10a84c775 Cosmetic stray semi-colon removal after %typemap using quotes 2022-08-31 19:40:13 +01:00
William S Fulton 34c219b5f7 Merge branch 'imfunc'
* imfunc:
  Add special variable imfuncname expansion for C# and D
  Test and document imfuncname special variable expansion
  Update docs.
  Also expose  in proxyClassFunctionHandler
  Expose  to javaout typemaps.

Conflicts:
	CHANGES.current
2022-05-30 19:45:28 +01:00
William S Fulton 62e0685df6 Test and document imfuncname special variable expansion 2022-05-30 19:00:04 +01:00
William S Fulton 598736a6b2 %interface family of macros no longer add variable wrappers
The getter/setter methods used for wrapping methods are no longer
added to the interface class.

Closes #1524

Also add in testcase for enums.
2022-03-12 23:04:24 +00:00
William S Fulton b6ece11fc1 Fixes for the family of %interface macros for overloaded methods
When C++ methods are not able to be overloaded in a derived class,
such as when they differ by just const, or the target language
parameters types are identical even when the C++ parameter types
are different, SWIG will ignore one of the overloaded methods with
a warning. A %ignore is required to explicitly ignore one of the
overloaded methods to avoid the warning message. Methods added
in the derived classes due to one of the %interface macros are now
similarly ignored/not added to the derived class.

The adding of additional methods into the parse tree is now more
robust and complete resulting in support for %feature and %rename
for the added methods.

Closes #1277
2022-03-12 23:04:24 +00:00
Olly Betts b127e11f1e Fix typos in docs and comments 2022-02-27 18:15:46 +13:00
LindleyF e25911b846
Merge branch 'swig:master' into imfunc 2022-02-02 16:15:17 -08:00
Lindley French e10da8a9a1 Update docs. 2022-02-02 15:34:19 -08:00
Olly Betts eb13261950 [Java] Note use of %ignore with %native
This is needed if you're wanting to effectively replace the generated
JNI wrapper for a C/C++ function.

Fixes https://sourceforge.net/p/swig/bugs/368/
2022-02-01 16:38:16 +13:00
Dimitris Apostolou f586d920f7
Fix typos 2021-11-17 07:07:02 +02:00
William S Fulton c3c4ec1e88 html link corrections 2021-02-24 22:07:36 +00:00
William S Fulton c1b004f4fa Add access modifier support for interface feature
Add ability to change the modifiers for the C# and Java
interface generated when using the %interface macros.

For C# use the 'csinterfacemodifiers' typemap.
For Java use the 'javainterfacemodifiers' typemap.

For example:

  %typemap(csinterfacemodifiers) X "internal interface"

Closes #1874
2020-09-25 18:54:25 +01:00
William S Fulton b7bcb338cf Add C++20 documentation chapter 2020-06-08 20:56:40 +01:00
William S Fulton 7070320335 Revert "Add C++20 documentation chapter"
This reverts commit 36e8d521de.

Conflicts:
	Doc/Manual/R.html
2020-06-08 20:06:55 +01:00
William S Fulton 36e8d521de Add C++20 documentation chapter
[skip-ci]
2020-01-28 20:31:53 +00:00
William S Fulton fb0adb14c3 Documentation: terminology consistency for command line options plus Doxygen tweaks. 2019-04-24 08:04:15 +01:00
William S Fulton bc615e8a6e Correct out of date html links 2019-04-15 19:01:52 +01:00
William S Fulton 831fae3c69 Add the parameters typemap attribute to D and Java destructor wrapper typemaps
Added to the javadestruct, javadestruct_derived, ddispose, ddispose_derived
typemaps to mirror enhanced flexibility in the csdisposing and
csdisposing_derived (C#) typemaps. If provided the contents are generated
as the delete/dispose method's parameters declaration.
2019-04-08 19:20:50 +01:00
William S Fulton 34108deec7 Documentation for directors and virtual final methods 2019-03-03 14:52:57 +00:00
William S Fulton be9d736597 Add back-reference to changes file 2019-02-18 19:28:35 +00:00
William S Fulton d16d145787 Documentation section numbering update
[skip ci]
2019-02-11 19:02:03 +00:00
William S Fulton 940e32477d Update section numbering 2019-02-10 01:03:06 +00:00
William S Fulton 33921666a1 Merge branch 'vadz-doxygen'
This is the Doxygen work begun in Google Summer of Code projects 2008
and 2012 and subsequently improved by numerous contributors.

* vadz-doxygen: (314 commits)
  Add changes entry for Doxygen support
  Add some missing doctype tyemaps
  Doxygen warnings cleanup
  Move doxygen warning numbers
  Add Python doxygen example
  Doxygen example
  Add Doxygen to include paths
  Doxygen source rename
  More merge fixes from doxygen branches
  Correct python example headers
  Correct source code headers
  Another merge fix from doxygen branches
  Java enums output format fixes
  Add omitted doxygen_parsing_enums testcase
  PEP8 conformance for comment verifier module
  Clean up merge problem
  Doxygen html tweaks
  Update html chapter numbering for added Doxygen chapter
  Fixes to makechap.py to detect ill-formed headers
  html fixes for Doxygen
  Add missing CPlusPlus17.html file
  Format files to unix format
  Doxygen testcase tweak to match that in the html docs
  Doxygen html documentation updates and corrections
  Remove doxygen Examples subdirectory
  Beautify doxygen source code
  Code formatting fixes in doxygen code
  Remove unused doxygen code
  new_node refactor
  Various merge fixes in doxygen branches
  Unused variable warning fix
  Fix wrongly resetting indent after formulae in Doxygen comments
  Add support for doxygen:alias feature
  Get rid of meaningless return type of DoxygenParser methods
  Return enum, not untyped int, when classifying Doxygen commands
  Get rid of unnecessary "typedef enum" in C++ code
  Use slash, not backslash, in "C/C++" in the documentation
  Replace literal "<" with "&lt;" in HTML documentation
  Fix broken link to java.sun.com in Doxygen documentation
  Fix using com.sun.tools.javadoc package under macOS
  Fix error reporting for special characters in Doxygen parsing code
  Switch Python Doxygen unit tests to use inspect.getdoc()
  Use correct separator in Java class path under Windows.
  Remove executable permission from appveyor.yml.
  Use JAVA_HOME value in configure to detect Java.
  Display JAVA_HOME value in "make java_version".
  Fix harmless MSVC warning in DoxygenTranslator code.
  Reset "_last" for all but first enum elements.
  Don't duplicate Javadoc from global enum Doxygen comments twice.
  Move Doxygen comments concatenation from the parser to the lexer.
  Fix shift/reduce conflicts in Doxygen pre/post comment parsing.
  Rewrote part of the grammar dealing with Doxygen comments for enums.
  No changes, just remove spurious white space only differences.
  Move Doxygen comment mangling from the parser to the lexer.
  Merge "-builtin" autodoc bugs workarounds from master into test.
  Quote JAVA_HOME variable value in Java test suite makefile.
  Remove unused C_COMMENT_STRING terminal from the grammar.
  Fix missing returns in the Doxygen test suite code.
  Fix trimming whitespace from Doxygen comments.
  Remove code not doing anything from PyDocConverter.
  Remove unused <sstream> header.
  Remove unreferenced struct declaration.
  Remove unused Swig_warn() function.
  Remove any whitespace before ignored Doxygen commands.
  Remove trailing space from one of Doxygen tests.
  Fix autodoc strings generated in Python builtin case and the test.
  Fix Doxygen unit test in Python "-builtin" case.
  Use class docstrings in "-builtin" Python case.
  Don't indent Doxygen doc strings in generated Python code.
  Add a possibility to flexibly ignore custom Doxygen tags.
  Stop completely ignoring many Doxygen comments.
  Fix structural Doxygen comment recognition in the parser.
  No changes, just make checking for Doxygen structural tags more sane.
  Use "//", not "#", for comments in SWIG input.
  Allow upper case letters and digits in Doxygen words.
  Pass the node the Doxygen comment is attached to to DoxygenParser.
  Get rid of findCommand() which duplicaed commandBelongs().
  Recognize unknown Doxygen tags correctly.
  No real changes, just pass original command to commandBelongs().
  Describe Doxygen-specific %features in a single place.
  Give warnings for unknown Doxygen commands in Doxygen parser.
  Document the return type when translating Doxygen @return to Python.
  Fix translated Doxygen comments for overloaded functions in Python.
  Also merge Doxygen comments for overloaded constructors in Python.
  Allow using enum elements as default values for Python functions.
  Don't always use "*args" for all Python wrapper functions.
  No real changes, just make PYTHON::check_kwargs() const.
  Refactor: move makeParameterName() to common Language base class.
  Remove long line wrapping from Python parameter list generation code.
  Simplify and make more efficient building Python docstrings.
  Translate Doxygen code blocks to Sphinx code blocks.
  Add a simple test of multiple parameters to Doxygen test suite.
  Make Python parameters types hyperlinks in the doc strings.
  Make Language::classLookup() and enumLookup() static.
  Fix arguments of @param, @return etc translations to Python.
  Remove unused method from PyDocConverter.
  No real changes, just remove an unnecessary variable.
  Preserve relative indentation when parsing Doxygen comments.
  Use Sphinx-friendly formatting for overloaded functions documentation.
  Add poor man trailing white space detection to Doxygen Python tests.
  ...
2018-06-07 08:13:10 +01:00
William S Fulton 4cdca98709 Update html chapter numbering for added Doxygen chapter 2018-05-25 07:56:44 +01:00
luz.paz 6f69830321 follow-up typos 2018-05-17 10:26:00 -04:00
luz.paz 60dfa31a67 Misc. typos
found via `codespell` and `grep`
2018-05-17 10:04:23 -04:00
William S Fulton 066c396ad6 Add C++17 documentation chapter 2018-05-14 21:29:46 +01:00
William S Fulton ee17f8d04f C#, D, Java methodmodifiers on destructors
Add support so that the %csmethodmodifiers, %dmethodmodifiers,
%javamethodmodifiers can modify the method modifiers for the destructor wrappers
in the proxy class: dispose, Dispose, delete. With this feature, it is now possible
to make a C# proxy class sealed, eg when wrapping a class X, the virtual method modifiers
can be removed using:

  %typemap(csclassmodifiers) X "public sealed class"
  %csmethodmodifiers X::~X "public /*virtual*/";
2018-05-11 18:09:51 +01:00