Commit Graph

27 Commits

Author SHA1 Message Date
Colin Walters
70a1394652 girepository: Consistently prefix internal functions with _
This should better avoid them being exported.  Rename
girepository-parser.la to girepository-internals.la for clarity.
2024-01-15 22:44:41 -08:00
Johan Dahlin
35c46e2e2e [GIRepository] Rename GTypelib to GITypelib
Keep a typedef for backwards compatibility, until
the major bindings has moved over.
2024-01-15 22:44:41 -08:00
Colin Walters
45a04358b6 [gircompiler] Clean up parsing
We never actually include multiple modules in the compiler,
so just nuke that.  Also rather than passing around GIrModule
consistently pass around a GIrTypelibBuild structure which
has various things.

This lets us maintain a stack there which we can walk for
better error messages.

Also, fix up the node lookup in giroffsets.c; previously
it didn't really handle includes correctly.  We really need to
switch to always using Foo.Bar (i.e. GIName) names internally...
2024-01-15 22:44:41 -08:00
Colin Walters
b2df59c315 compiler: Remove --code argument
It can't really work right now because we rely on dumping data at runtime,
which requires the library.  If in the future we support static scanning,
we can reinvestigate embedded typelibs.
2024-01-15 22:44:41 -08:00
Colin Walters
75cdddb576 [girepository] Actually verify header of loaded typelibs in g_irepository_require
Take a GError * for typelib loading code, validate the header.  This
fixes bizarre errors from gjs where g_irepository_require would happily
load old typelibs.
2024-01-15 22:44:41 -08:00
Johan Dahlin
f414299339 [gtypelib.ch] Rename to gitypelib.ch
Rename gtypelib.h -> gitypelib-internal.h and rename
gtypelib.c to gitypelib.c
2024-01-15 22:44:41 -08:00
C. Scott Ananian
2ed6e7573f Bug 585584: Fix warnings in girparser backtrace functionality and compiler.c 2024-01-15 22:44:41 -08:00
Colin Walters
7f4477c610 Bug 577534 - Use rename to write new typelibs, instead of in-place overwrite
This avoids having processes with the typelibs currently open exploding
immediately.
2024-01-15 22:44:41 -08:00
Johan Dahlin
f3d30afed7 Handle the return value to fwrite properly 2024-01-15 22:44:41 -08:00
Dan Winship
4dd500c22a Misc warning fixes
* giscanner/scannerparser.y: Fix the "Ignoring non-UTF-8 constant
	string" error to print the right value.

	* tests/scanner/annotation.c (backslash_parsing_tester)
	(backslash_parsing_tester_2): make these non-static to avoid a
	warning.
	(annotation_object_string_out)
	(annotation_string_zero_terminated): fix return values

	* tests/scanner/annotation.h (annotation_object_with_voidp):
	prototype this

	* tests/scanner/gtkfrob.c:
	* tests/scanner/gtkfrob.h (gtk_frob_language_manager_get_default):
	fix prototype. (s/()/(void)/).

	* tools/compiler.c (format_output): fix signed/unsigned warning.
	Output a prototype for register_typelib() to avoid warnings later.

svn path=/trunk/; revision=1071
2024-01-15 22:44:41 -08:00
Owen Taylor
582a675584 Add a GirParser object to hold the state of a compilation
Add a toplevel GirParser object to hold state that is global across
a compilation. Currently just holds the include path, but will
eventually also keep a cached list of parsed modules.

svn path=/trunk/; revision=901
2024-01-15 22:44:41 -08:00
Tommi Komulainen
4043597a94 Bug 556543 – reduce compiler warnings
2008-10-16  Tommi Komulainen  <tommi.komulainen@iki.fi>

	Bug 556543 – reduce compiler warnings

	* girepository/ginfo.c:
	* girepository/girepository.c (register_internal,
	count_interfaces, find_interface, find_namespace_version,
	parse_version, g_irepository_require):
	* girepository/girmodule.c (g_ir_module_build_typelib):
	* girepository/girnode.c (init_stats, dump_stats,
	_g_irnode_init_stats, _g_irnode_dump_stats,
	g_ir_node_can_have_member):
	* girepository/girparser.c (firstpass_end_element_handler,
	locate_gir, parse_basic, parse_type_internal, resolve_aliases,
	start_alias, start_type, end_type_top, parse_include, cleanup,
	post_filter):
	* girepository/gtypelib.c (validate_function_blob, validate_enum_blob):
	* giscanner/giscannermodule.c (directive_get_options,
	type_get_child_list):
	* giscanner/scannerlexer.l (parse_gtkdoc):
	* giscanner/scannerparser.y (ctype_free):
	* giscanner/sourcescanner.c:
	* giscanner/sourcescanner.h (gi_source_scanner_parse_macros):
	* tests/types/gitesttypes.c:
	* tools/compiler.c (main):
	* tools/generate.c (write_repository): Remove unused variables
	and code, add missing includes, declarations and case
	statements.

svn path=/trunk/; revision=730
2024-01-15 22:44:41 -08:00
Colin Walters
6114478cf8 Remove g_irepository_unregister, add GIRepositoryLoadFlags
svn path=/trunk/; revision=543
2024-01-15 22:44:41 -08:00
Colin Walters
91dcce4159 Put dependencies in typelibs, resolve them when loading
* gir/Makefile.am: Dep on Makefile
	* girepository/ginfo.c: Print out a nicer error
	message if we failed to load something.
	* girepository/girepository.c: Clean up
	default typelib handling; remove global
	default_typelib variable.  Ensure we handle
	NULL repository in more places.
	Support dependency resolution.
	* tests/Makefile.am: Kill off gobject.gir,
	it conflicts with the real one.
	* tests/Object.gir: Depend on GObject.
	* tools/generate.c: Take --includedir
	argument to say which directories to search
	for typelibs.  Print out dependencies.

svn path=/trunk/; revision=541
2024-01-15 22:44:41 -08:00
Colin Walters
8dd1802d1f Fix --includedir handling
* tests/scanner/Makefile.am: Pass the right
	--includedir args.  Add a Makefile dep.
	* tools/compiler.c: Pass includedirs down.
	* girepository/girparser.c: Actually put
	includedirs in context, pass down.  Fix
	locate_gir.

svn path=/trunk/; revision=514
2024-01-15 22:44:41 -08:00
Colin Walters
85bdf52b87 Expand aliases when generating typelibs
* gir/Makefile.am: Use --includedir
	* girepository/girparser.c: Recursively parse
	includes to pull in aliases and expand them.
	We need this to	avoid putting unknown names in
	the typelibs.
	* tools/compiler.c: Add --includedir option.

svn path=/trunk/; revision=512
2024-01-15 22:44:41 -08:00
Tor Lillqvist
b8f6c2b388 Use binary mode for output file on Windows.
2008-08-28  Tor Lillqvist  <tml@novell.com>

	* tools/compiler.c (write_out_typelib): Use binary mode for output
	file on Windows.

	* girepository/girnode.c: Don't print NULL strings.

	* tests/invoke/Makefile.am
	* tests/scanner/Makefile.am: Use -no-undefined on Windows to
	convince libtool to build shared libraries.

	* tests/invoke/invoke.c: Don't needlessly include <dlfcn.h>. Use
	g_assert() instead of printing out expected errors.


svn path=/trunk/; revision=509
2024-01-15 22:44:41 -08:00
Colin Walters
6f791d89cf Default to --raw. Update.
2008-08-22  Colin Walters  <walters@verbum.org>

	* tools/generate.c, tools/compiler.c: Default
	to --raw.
	* all Makefile.am: Update.

svn path=/trunk/; revision=462
2024-01-15 22:44:41 -08:00
Johan Dahlin
b1039a6dc9 Rename metadata to typelib in variable names, comments and apis.
2008-08-09  Johan Dahlin  <johan@gnome.org>

    * *.[ch]:
    Rename metadata to typelib in variable names,
    comments and apis.


svn path=/trunk/; revision=339
2024-01-15 22:44:41 -08:00
Johan Dahlin
04a5cdf05d Merge in the gir-compiler branch. Thanks to Philip and Colin for their
2008-08-08  Johan Dahlin  <johan@gnome.org>

    * girepository/gtypelib.c (validate_header):
    * girepository/gtypelib.h:
    * giscanner/ast.py:
    * giscanner/girwriter.py:
    * giscanner/sourcescanner.c (gi_source_symbol_ref),
    (gi_source_symbol_unref):
    * tests/array.test:
    * tests/boxed.test:
    * tests/constant.test:
    * tests/enum.test:
    * tests/errors.test:
    * tests/function.test:
    * tests/gobject.test:
    * tests/interface.test:
    * tests/invoke/Makefile.am:
    * tests/invoke/testfns.xml:
    * tests/object.test:
    * tests/parser/Makefile.am:
    * tests/roundtrips.sh:
    * tests/struct.test:
    * tests/types.test:
    * tests/union.test:
    * tests/xref1.test:
    * tests/xref2.test:
    * tools/Makefile.am:
    * tools/compiler.c (main):
    * tools/generate.c (write_callable_info), (write_function_info),
    (write_repository):
    * tools/gidlmodule.c:
    * tools/gidlmodule.h:
    * tools/gidlnode.c:
    * tools/gidlnode.h:
    * tools/gidlparser.c:
    * tools/gidlparser.h:
    * tools/gidlwriter.c:
    * tools/gidlwriter.h:
    * tools/scanner.c (create_node_from_gtype),
    (create_node_from_ctype), (g_igenerator_process_properties),
    (g_igenerator_process_signals), (g_igenerator_create_object),
    (g_igenerator_create_interface), (g_igenerator_create_boxed),
    (g_igenerator_create_enum), (g_igenerator_create_flags),
    (g_igenerator_process_function_symbol),
    (g_igenerator_process_unregistered_struct_typedef),
    (g_igenerator_process_struct_typedef),
    (g_igenerator_process_union_typedef),
    (g_igenerator_process_enum_typedef),
    (g_igenerator_process_function_typedef),
    (g_igenerator_process_constant), (g_igenerator_process_symbols),
    (g_igenerator_add_module), (g_igenerator_add_include_idl):
    Merge in the gir-compiler branch.
    Thanks to Philip and Colin for their help.


svn path=/trunk/; revision=325
2024-01-15 22:44:41 -08:00
Philip Van Hoof
397d16145c tools/gidlnode.c
2008-06-08  Philip Van Hoof  <pvanhoof@gnome.org>

        * girepository/girepository.c:
        * girepository/gtypelib.c:
        * girepository/ginfo.c:
        * girepository/ginvoke.c:
        * girepository/girepository.h:
        * girepository/gtypelib.h:
        * girepository/gmetadata.c:
        * girepository/Makefile.am:
        * girepository/gmetadata.h:
        * tools/compiler.c:
        * tools/gidlmodule.c:
        * tools/gidlnode.c
        * tools/generate.c:
        * tools/gidlmodule.h:
        * tools/gidlparser.c:

        Renamed GMetadata to GTypelib


svn path=/trunk/; revision=288
2024-01-15 22:44:41 -08:00
Johan Dahlin
c0b53bde4d Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22  Johan Dahlin  <johan@gnome.org>

    * girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
    (g_type_info_is_pointer), (g_type_info_get_tag),
    (g_type_info_get_param_type), (g_type_info_get_interface),
    (g_type_info_get_array_length), (g_type_info_is_zero_terminated),
    (g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
    (g_error_domain_info_get_codes), (g_enum_info_get_value),
    (g_object_info_get_interface), (g_object_info_get_field),
    (g_interface_info_get_prerequisite),
    (g_signal_info_get_class_closure), (g_constant_info_get_value):
    * girepository/ginvoke.c (get_ffi_type):
    * girepository/girepository.h:
    * girepository/gmetadata.c (g_metadata_get_dir_entry),
    (g_metadata_check_sanity), (validate_header),
    (validate_array_type_blob), (validate_iface_type_blob),
    (validate_param_type_blob), (validate_error_type_blob),
    (validate_type_blob), (validate_constant_blob),
    (validate_struct_blob), (validate_enum_blob):
    * girepository/gmetadata.h:
    * tests/Makefile.am:
    * tests/invoke/Makefile.am:
    * tests/invoke/invoke.c (main):
    * tests/roundtrips.sh:
    * tools/Makefile.am:
    * tools/compiler.c (format_output), (write_out_metadata), (main):
    * tools/generate.c (write_type_name), (write_type_info),
    (write_constant_value), (write_enum_info), (load_metadata), (main):
    * tools/gidlcompilercontext.c:
    * tools/gidlcompilercontext.h:
    * tools/gidlcompilerentrynode.c:
    * tools/gidlcompilerentrynode.h:
    * tools/gidlcompilertypenode.c:
    * tools/gidlcompilertypenode.h:
    * tools/gidlmodule.c (g_idl_module_build_metadata):
    * tools/gidlmodule.h:
    * tools/gidlnode.c (init_stats), (dump_stats),
    (g_idl_node_get_size), (g_idl_node_get_full_size),
    (g_idl_node_cmp), (g_idl_node_can_have_member),
    (g_idl_node_add_member), (g_idl_node_param_direction_string),
    (parse_int_value), (parse_uint_value), (parse_float_value),
    (parse_boolean_value), (find_entry_node), (find_entry),
    (serialize_type), (g_idl_node_build_metadata), (write_string):
    * tools/gidlnode.h:
    * tools/gidlparser.c (parse_type_internal):
    * tools/quote-file.sh:
    Revert revisions 157,149-148,136-129 and 120.
    Move back to using g-idl-generate to generate the metadata and
    avoids dependency on a c compiler.


svn path=/trunk/; revision=214
2024-01-15 22:44:41 -08:00
Johan Dahlin
3c6a7cd907 Remove most global variables
2008-03-11  Johan Dahlin  <johan@gnome.org>

        * tools/compiler.c:
        * tools/generate.c:
        Remove most global variables


svn path=/trunk/; revision=153
2024-01-15 22:44:41 -08:00
Johan Dahlin
1f233b5915 Remove unused imports
svn path=/trunk/; revision=152
2024-01-15 22:44:41 -08:00
Johan Dahlin
f9f1d8e4c8 Coding style fixes
2008-03-11  Johan Dahlin  <johan@gnome.org>

	* tools/compiler.c (main): Coding style fixes


svn path=/trunk/; revision=144
2024-01-15 22:44:41 -08:00
Mark Doffman
048debb50b tools/quote-file.sh tools/compiler.c tools/generate.c
2008-02-22  Mark Doffman  <mark.doffman@codethink.co.uk>

    * tools/quote-file.sh
    * tools/compiler.c
    * tools/generate.c

      Move to using the 'C' struct compiler code.

WARNING: This commit does not compile. It is a partial change.

svn path=/trunk/; revision=135
2024-01-15 22:44:41 -08:00
Rob Taylor
125fa5e786 Added: Added: Renamed to tools/Makefile.am: Renamed to tools/compiler.c:
2008-02-08  Rob Taylor  <rob.taylor@codethink.co.uk>

	* Makefile.am:
	* configure.ac:
	* gidl/Makefile.am: Added:
	* girepository/Makefile.am: Added:
	* src/Makefile.am: Renamed to tools/Makefile.am:
	* src/compiler.c: Renamed to tools/compiler.c:
	* src/g-idl-offsets.pl: Renamed to tools/g-idl-offsets.pl:
	* src/generate.c: Renamed to tools/generate.c:
	* src/gidlmodule.c: Renamed to tools/gidlmodule.c:
	* src/gidlmodule.h: Renamed to tools/gidlmodule.h:
	* src/gidlnode.c: Renamed to tools/gidlnode.c:
	* src/gidlnode.h: Renamed to tools/gidlnode.h:
	* src/gidlparser.c: Renamed to tools/gidlparser.c:
	* src/gidlparser.h: Renamed to tools/gidlparser.h:
	* src/gidlwriter.c: Renamed to tools/gidlwriter.c:
	* src/gidlwriter.h: Renamed to tools/gidlwriter.h:
	* src/ginfo.c: Renamed to girepository/ginfo.c:
	* src/ginvoke.c: Renamed to girepository/ginvoke.c:
	* src/girepository.c: Renamed to girepository/girepository.c:
	* src/girepository.h: Renamed to girepository/girepository.h:
	* src/gmetadata.c: Renamed to girepository/gmetadata.c:
	* src/gmetadata.h: Renamed to girepository/gmetadata.h:
	* src/scanner.c: Renamed to tools/scanner.c:
	* src/scanner.h: Renamed to tools/scanner.h:
	* src/scannerlexer.l: Renamed to tools/scannerlexer.l:
	* src/scannerparser.y: Renamed to tools/scannerparser.y:
	* tests/invoke/Makefile.am:
	Split src/ into girepository/ and tools/

	* Makefile.am:
	* configure.ac:
	* girepository/Makefile.am:
	* tests/Makefile.am:
	* tests/invoke/Makefile.am:
	* tests/parser/Makefile.am:
	* tests/roundtrips.sh:
	* tools/Makefile.am:
	Make distcheck work.

svn path=/trunk/; revision=104
2024-01-15 22:44:41 -08:00