Commit Graph

10 Commits

Author SHA1 Message Date
Abou Al Montacir
ed310974db gir2pas: Enabled passing max version CLO multiple times.
This allows to constraint each library separately, as for example:
```sh
gir2pas -e Set -i /usr/share/gir-1.0/Gtk-3.0.gir -o gtk3-test \
        -M atk-2.36 \
        -M pango-1.16 \
        -M pangocairo-1.46 \
        -M glib-2.66 \
        -M gtk-3.24
```
2023-06-18 14:30:11 +00:00
Abou Al Montacir
d94e263cdc gir2pas: Fixed generation of enumeration types other than bit fields.
When enum types is set as `goEnumAsSet` by user, we need to add
`goEnumAsEnum` also in order to correctly handle non bit fields enums.

This should be done at the very beginning, upon CLO handling, otherwise
some enums are generated as integer constants.
2023-06-17 21:57:38 +02:00
Abou Al Montacir
050dfa3884 gir2pascal: Small code improvements.
These changes are:
 1. Added line break to last line of generated files.
 2. Removed unused field `FEnumImpl` from `TGirConsoleConverter`.
 3. Moved command line from .lpi to .lps as this depends on the path
    of the user debugging the program.
2023-05-27 15:53:56 +00:00
Abou Al Montacir
d1f64050ea gir2pascal: Generate C enums based pascal type selected by CLO, issue #39988.
Added a new command line option (CLO) `-e/--declare-enums-as` that
selects the way how to define C enums and bit fields.

Added support for 4 options and a 5th to be implemented later.
 1. `IntConst`: No type, just use integer non typed constants. This was
    already implemented, but not easily selected at CLI.
 2. `TypedIntConst`: Use non strict type aliases and typed constants.
    This was already implemented, selected by default in the code.
 3. `IntAliasConst`: Use strict type aliases and non typed constants.
    This was newly added.
 4. `Enum`: Use Pascal enumeration type for both C enums and bit fields.
    This was newly added.
 5. `Set`: Use Pascal enumeration type for both C enums and Pascal sets
    for bit fields. This is not yet added.
2023-05-18 10:44:10 +02:00
Abou Al Montacir
7920db790b Issue #39988: Forbid duplicate paths in directories search list.
As the directories search list is not sorted, FPC implementation of
`TStringList` ignores the `dupIgnore` option and thus leads to having
the same entry multiple times in the list.

We forbid this manually in order to avoid searching multiple times for
the same file in the very same directory.

We also add more default search paths (Debian based).
2023-05-12 21:44:21 +00:00
Abou Al Montacir
9c5b942b66 Issue #39988: Use system path separator instead in folders search list.
This is more consistent with other tools and allows passing drives on
MS Windows systems.
2023-05-12 21:44:21 +00:00
Abou Al Montacir
5c34ab0510 Issue #39988: Try to create output directory if it does not exist.
This is more convenient for users and when included in a script.
2023-05-12 21:44:21 +00:00
Abou Al Montacir
f64c1307f9 Issue #39988: Changed order of folders where to search for included files.
The order of folders where to search for included files should be
related to user preference as follows:
 1. directory where the input is located,
 2. directories supplied by user at command line in the order they were
    passed,
 3. default system directories, where distributions used to put them.

 This way, user can easily override files in the default system
 directories without the need to have write access to such folder, as in
 most Unix systems this will require root access.

 Also, one expects, that if copy of an included file is placed in the
 same directory as the input one, then this copy should be used.
 This makes sens, because people generally work on the same directory,
 and will consider their local work copy the preferred one to be used.
2023-05-11 15:46:44 +00:00
Abou Al Montacir
8a7116f248 Issue #39988: Added support for .typelib files.
Debian ships .gir files in a compressed binary format with .typelib
extension. We use `g-it-generate`to decompress them on the fly.
2023-05-10 22:00:29 +00:00
Maxim Ganetsky
697d41437c Tools: initial import of gir2pascal sources from https://github.com/n1tehawk/gir2pascal 2022-07-19 01:01:00 +03:00