| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| | |
giscanner: always define PY_SSIZE_T_CLEAN
See merge request GNOME/gobject-introspection!244
|
| |
| |
| |
| | |
This is required for Python 3.10 and always a good idea anyway.
|
|/
|
|
|
|
|
| |
It got changed to a function in Python 3.10. Use the Py_SET_TYPE macro
suggested at https://docs.python.org/3.10/whatsnew/3.10.html instead.
Fixes #358
|
|
|
|
| |
Reduce total number of memory allocations and increase data locality.
|
|
|
|
|
|
|
|
|
|
|
| |
It just printed errors to stderr and always returns success even if parsing
fails. This prevents us to write any tests for it.
As a first step collect all lexing/parsing error messages and print them to stderr after
the scanner is done. This allows us to add some regression tests for !78.
In the future we probably want to raise an exception with those errors if parsing
fails.
|
|
|
|
|
|
| |
This allows us to get rid of the msvc hacks which are needed in case Python
is built with a different msvc than g-i. By passing a filename the FILE struct never
passes over library boundaries.
|
|
|
|
|
|
|
|
| |
Unfortunately, this is still needed for Visual Studio versions that do
not have an official CPython release that uses the CRT which the
compiler targets to, such as Visual Studio 2012 and 2013
This reverts commit a6a479af1bbe7c0d17766f1408c9fcb720df78dc.
|
|
|
|
|
|
|
|
|
|
|
| |
We need those includes and defines as we need to revert the commit that
revert the hacks on Windows, as they are still necessary in the cases
where we are using a Python installation that is not linked to the CRT
that the currently used compiler targets to, such as on Visual Studio
2012 and 2013, where no official Python release is linked to their
respective CRTs.
This reverts commit e36350e3fdcb18a21089256b63298d6e3a49212b.
|
|
|
|
|
|
|
|
| |
Where it's easy add dummy args to match the cast; where the target is a subset just
prevent the warning with a cast to void*.
Provide a real copy function for the boxed type code in regress_foo.
This code is never executed afaics, but why not.
|
| |
|
|
|
|
| |
It was never defined because G_OS_WIN32 was used before the glib include.
|
|
|
|
|
|
|
|
|
| |
From what I understand this was to support a g-i built with mingw
using a different msvcrt to work with the official CPython built with
msvc.
Now that we can build with meson there is no need for this anymore as far
as I can see. Just remove the code. Please file a bug if this affects you.
|
|
|
|
|
|
|
|
|
| |
This reverts f345916405d94829696985 and related. The commit states that
both versions are about the same in performance, but the C version is more code and
harder to maintain. It also states that the behaviour re invalid control
characters is better with the C version which produces entities. But those
make any Python xml parser fail, which given that most of our tooling is Python,
doesn't seem better to me, see #135.
|
|
|
|
|
|
|
|
|
|
| |
When using the NEW_CLASS macro, we're also declaring a static constant
that we might end up using later.
GCC will complain if we're not using the declared variable, so we should
annotate it with G_GNUC_UNUSED. If we end up using the variable, the
compiler will ignore the annotation; if we don't, we won't be getting a
compiler warning when we don't use it.
|
|
|
|
|
|
|
|
| |
Remove the existing TODO and avoid playing games with the linker. We
already have a mechanism in place for controlling he visibility of our
symbols.
Signed-off-by: Nirbheek Chauhan <nirbheek@centricular.com>
|
| |
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=733535
|
|
|
|
|
|
|
|
|
|
|
|
| |
Python 3.5+ is now built with Visual Studio 2015, which now has a
refactored set of CRT DLLs where CRT functions are placed in, so we need
to acquire the _get_osfhandle() from the correct CRT DLL so that we can
pass around file descriptors correctly between different CRT versions.
This patch will enable Windows builds of introspection files using Python
3.5+ to work correctly.
https://bugzilla.gnome.org/show_bug.cgi?id=759531
|
|
|
|
|
|
|
|
|
| |
Define portable macros for use between Python 2 and 3.
Replace usage of PyString related functions with PyBytes.
Update pygi_source_scanner_parse_macros to support both
PyBytes and PyUnicode.
https://bugzilla.gnome.org/show_bug.cgi?id=679438
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add unicode_literals future import which turns any string literal
into a unicode string. Return unicode strings from the Python C extension
module. Force writing of annotations (g-ir-annotation-tool) to output utf8
encoded data to stdout.
This is an initial pass at following the "unicode sandwich"
model of programming (http://nedbatchelder.com/text/unipain.html)
needed for supporting Python 3.
https://bugzilla.gnome.org/show_bug.cgi?id=679438
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use g_slist_copy prior to returning the lists run through g_slist_reverse.
This preserves the source scanners internally held lists where previously
they would only point to a single element after a call, leaking memory and
breaking subsequent calls. Note the functions as (transfer container) and
use g_slist_free after calls in the Python bindings.
Add new unittest file: test_sourcescanner.py for isolated unittesting of the
SourceScanner.
https://bugzilla.gnome.org/show_bug.cgi?id=581525
|
|
|
|
|
|
|
|
| |
Aliasing TRUE or FALSE is not very common, but done occasionally
for extra clarity. Namely G_SOURCE_REMOVE / G_SOURCE_CONTINUE are
self-explanatory, unlike the "raw" booleans.
https://bugzilla.gnome.org/show_bug.cgi?id=719566
|
|
|
|
|
|
|
|
|
|
|
| |
giscannermodule expects file names to be canonicalized and
symlinks to be resolved (most likely to support users of
symlinked /usr/local). Instead of computing absolute and real
paths all over the place, we can do this once on entry
in SourceScanner().parse_files() and SourceScanner().parse_macros()
and clean the rest a bit...
https://bugzilla.gnome.org/show_bug.cgi?id=710320
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Was looking around a bit and noticed about 2/3 of
g-ir-scanner time is spent in SourceScanner().parse_files().
Some profiling quickly shows most of that 2/3 is used
by gi_source_scanner_add_symbol() where it creates a whole
bunch of GFile instances just to compare paths and throw
them away again. With this a scanner instance now maintains
a hash table of GFile instances instead of a list of file
names, so comparing those paths can be reduced to a fast
g_hash_table_contains() call.
This makes "g-ir-scanner <whole_bunch_of_options> --output Gtk-3.0.gir"
complete in about 10 seconds on my box instead of about
30 seconds (both best of 3 runs).
https://bugzilla.gnome.org/show_bug.cgi?id=710320
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The scanner has some logic to compare the filenames specified
on the command line against files it will parse. For the latter,
it uses g_realpath(). With this patch, we also use g_realpath()
on the command line arguments.
This fixes g-i when used inside jhbuild in a gnome-ostree VM,
which has a symbolic link /home -> /sysroot/home. This caused
a realpath mismatch, and then we'd ignore the input source files.
It'd be best to get out of the realpath business entirely...but
a patch to do that seems more likely to break.
https://bugzilla.gnome.org/show_bug.cgi?id=704864
|
|
|
|
| |
Spotted by Coverity
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In C, positive integer constants are by default unsigned. This means
an expression like 0x8000000000000000 will be "unsigned long long".
In the actual scanner code, we were parsing them as "gint64", and
storing them as gint64. This was incorrect; we need to parse them
as guint64, and store the bits we get from that. This gives us
an equivalent result to what the C compiler does.
However, when we actually return the value as a Python "long"
(arbitrary length integer), we need to treat the value as unsigned if
the result indicated it was.
https://bugzilla.gnome.org/show_bug.cgi?id=685022
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-Incorporate and extend Dieter's patch regarding possible different CRTs
used in Windows Python (msvcrt71.dll for Python 2.5, msvcrt90.dll for
Python 2.6- 3.2, and msvcrt100.dll for Python 3.3+) vs. the CRT used to
build g-i (msvcrt.dll for MinGW/WinDDK, msvcrt90.dll for stock MSVC 2008
and msvcrt100.dll for stock MSVC 2010)
-Avoid C99ism for NEW_CLASS as we are having an array without a
pre-determined length. There might be better ways to get around this
though.
https://bugzilla.gnome.org/show_bug.cgi?id=681820
|
|
|
|
| |
And bump our GLib requirement.
|
|
|
|
|
|
| |
Makes it work on case-sensitive file systems such as HFS+.
https://bugzilla.gnome.org/show_bug.cgi?id=667405
|
|
|
|
|
| |
Decrement reference to temporary string object only after last use of its
value.
|
|
|
|
|
|
| |
grealpath.h defines GetFullPathNameA() as windows.h is
not imported, but for gitscanner.c, windows.h is imported and the compiler
throws an error.
|
|
|
|
|
|
|
|
| |
PyUnicode_FromString is 2.6 only, we can use PyUnicode_DecodeUTF8
easily enough though.
Also, fix memory leaks in this function; we leaked the buffer
on success, and also in most failure paths.
|
|
|
|
|
|
| |
The assumption is that the only allowed source encoding
is utf-8. Always strings as unicode and fix up the transformer
and xml writer to properly output utf-8.
|
|
|
|
|
| |
This is cleaner and faster, and prepares us better for an incoming
import of CMPH.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The C compiler will pick an enumeration type that accomodates the specified
values for the enumeration, so ignoring 64-bit enumerations, we can
have enumeration values from MININT32 to MAXUINT32. To handle this properly:
- Use gint64 for holding eumeration values when scanning
- Add a 'unsigned_value' bit to ValueBlob so we can distinguish the
int32 vs. uint32 cases in the typelib
- Change the return value of g_value_info_get_value() to gint64.
https://bugzilla.gnome.org/show_bug.cgi?id=629704
|
| |
|
|
|
|
|
| |
There's no need to increase the reference count to
items passed into PyList_SetItem, it already steals a reference.
|
|
|
|
| |
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=594125
|
| |
|
|
|
|
|
| |
Add line numbers to symbols, which can be useful
in later stages of the scanner.
|
|
|
|
| |
This avoids pyconfig.h:1028:1: warning: "_POSIX_C_SOURCE" redefined
|
|
|
|
|
|
|
|
| |
When building the list of valid filenames for the scanner, resolve symlinks in
the filenames; the lexer does this when including files, so otherwise we'll get
filename mismatches if the path to the files being scanned includes a symlink.
Signed-off-by: Colin Walters <walters@verbum.org>
|
|
|
|
|
|
| |
Previously we just supported int and string, add double to this.
Technically we should probably differentiate between float and
double, but it's not likely to be very useful in practice to do so.
|
|
|
|
|
| |
We keep track of the source filename for every symbol. This enables
us to later filter symbols based on that name.
|
|
|
|
| |
This gives us nice stack traces.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2009-01-12 Johan Dahlin <jdahlin@async.com.br>
Bug 563591 – Flags not recognized when there is no introspection data
* giscanner/ast.py:
* giscanner/girwriter.py:
* giscanner/giscannermodule.c (type_get_is_bitfield):
* giscanner/glibast.py:
* giscanner/glibtransformer.py:
* giscanner/scannerparser.y:
* giscanner/sourcescanner.c (gi_source_type_copy):
* giscanner/sourcescanner.h:
* giscanner/sourcescanner.py:
* giscanner/transformer.py:
* tests/scanner/foo-1.0-expected.gir:
* tests/scanner/foo-1.0-expected.tgir:
* tests/scanner/foo.h:
Large parts of this patch was done by Jürg Billeter.
svn path=/trunk/; revision=1025
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2009-01-12 Johan Dahlin <jdahlin@async.com.br>
Bug 563794 - Redo annotation parsing & applying
Thanks to Colin for helping out considerably in landing this.
* giscanner/Makefile.am:
* giscanner/ast.py:
* giscanner/dumper.py:
* giscanner/girparser.py:
* giscanner/giscannermodule.c (pygi_source_scanner_get_comments),
(calc_attrs_length), (pygi_collect_attributes), (init_giscanner):
* giscanner/glibtransformer.py:
* giscanner/scannerlexer.l:
* giscanner/sourcescanner.c (gi_source_symbol_unref),
(gi_source_scanner_new), (gi_source_scanner_free),
(gi_source_scanner_get_comments):
* giscanner/sourcescanner.h:
* giscanner/sourcescanner.py:
* giscanner/transformer.py:
* giscanner/xmlwriter.py:
* tests/scanner/annotation-1.0-expected.gir:
* tests/scanner/annotation-1.0-expected.tgir:
* tests/scanner/annotation.c:
* tests/scanner/annotation.h:
* tests/scanner/foo-1.0-expected.gir:
* tests/scanner/foo-1.0-expected.tgir:
* tests/scanner/foo.h:
* tools/g-ir-scanner:
This commit merges the annotation parser rewrite branch.
It'll change the annotation parsing to be done completely in python
code which will make it easier to do further annotation parsing
easier.
svn path=/trunk/; revision=1017
|