mirror of
https://github.com/tauri-apps/gir-files.git
synced 2026-01-31 00:45:15 +01:00
fix,reformat: Do not unnecessarily preserve whitespace
[ from https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/676/diffs?commit_id=27ff7b74eb95bda7cdfe769ea34c9689e005135d ] When deleting elements -P/--pf preserves whitespace in front of the elements, creating tons of unnecessary trailing whitespace on otherwise-empty lines.
This commit is contained in:
36
fix.sh
36
fix.sh
@@ -2,37 +2,37 @@
|
||||
set -x -e
|
||||
|
||||
# Remove Int32 alias because it misses c:type, it not like anyone actually cares about it.
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-d '///_:alias[@name="Int32"]' \
|
||||
freetype2-2.0.gir
|
||||
|
||||
# gir uses error domain to find quark function corresponding to given error enum,
|
||||
# but in this case it happens to be named differently, i.e., as g_option_error_quark.
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-u '//*[@glib:error-domain="g-option-context-error-quark"]/@glib:error-domain' -v g-option-error-quark \
|
||||
GLib-2.0.gir
|
||||
|
||||
# GtkEntry icon signals incorrect assume GdkEventButton when other variants may be passed
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-u '//_:class[@name="Entry"]/glib:signal[@name="icon-press"]//_:parameter[@name="event"]/_:type[@name="Gdk.EventButton"]/@name' -v "Gdk.Event" \
|
||||
-u '//_:class[@name="Entry"]/glib:signal[@name="icon-release"]//_:parameter[@name="event"]/_:type[@name="Gdk.EventButton"]/@name' -v "Gdk.Event" \
|
||||
Gtk-3.0.gir
|
||||
|
||||
# GtkIconSize usage
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-u '//_:type[@c:type="GtkIconSize"]/@name' -v "IconSize" \
|
||||
-u '//_:type[@c:type="GtkIconSize*"]/@name' -v "IconSize" \
|
||||
Gtk-3.0.gir
|
||||
|
||||
# incorrect GIR due to gobject-introspection GitLab issue #189
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-u '//_:class[@name="IconTheme"]/_:method//_:parameter[@name="icon_names"]/_:array/@c:type' -v "const gchar**" \
|
||||
-u '//_:class[@name="IconTheme"]/_:method[@name="get_search_path"]//_:parameter[@name="path"]/_:array/@c:type' -v "gchar***" \
|
||||
-u '//_:class[@name="IconTheme"]/_:method[@name="set_search_path"]//_:parameter[@name="path"]/_:array/@c:type' -v "const gchar**" \
|
||||
Gtk-3.0.gir
|
||||
|
||||
# incorrect GIR due to gobject-introspection GitLab issue #189
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-u '//_:record[@name="KeyFile"]/_:method[@name="set_boolean_list"]//_:parameter[@name="list"]/_:array/@c:type' -v "gboolean*" \
|
||||
-u '//_:record[@name="KeyFile"]/_:method[@name="set_double_list"]//_:parameter[@name="list"]/_:array/@c:type' -v "gdouble*" \
|
||||
-u '//_:record[@name="KeyFile"]/_:method[@name="set_integer_list"]//_:parameter[@name="list"]/_:array/@c:type' -v "gint*" \
|
||||
@@ -41,7 +41,7 @@ xmlstarlet ed -P -L \
|
||||
GLib-2.0.gir
|
||||
|
||||
# incorrect GIR due to gobject-introspection GitLab issue #189
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-u '//_:class[@name="Object"]/_:method[@name="getv"]//_:parameter[@name="names"]/_:array/@c:type' -v "const gchar**" \
|
||||
-u '//_:class[@name="Object"]/_:method[@name="getv"]//_:parameter[@name="values"]/_:array/@c:type' -v "GValue*" \
|
||||
-u '//_:class[@name="Object"]/_:method[@name="setv"]//_:parameter[@name="names"]/_:array/@c:type' -v "const gchar**" \
|
||||
@@ -51,30 +51,30 @@ xmlstarlet ed -P -L \
|
||||
GObject-2.0.gir
|
||||
|
||||
# fix wrong "full" transfer ownership
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-u '//_:method[@c:identifier="gdk_frame_clock_get_current_timings"]/_:return-value/@transfer-ownership' -v "none" \
|
||||
-u '//_:method[@c:identifier="gdk_frame_clock_get_timings"]/_:return-value/@transfer-ownership' -v "none" \
|
||||
Gdk-3.0.gir
|
||||
|
||||
# replace gmodule with gpointer
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-u '//_:record[@name="PixbufModule"]/_:field[@name="module"]/_:type/@name' -v "gpointer" \
|
||||
-u '//_:record[@name="PixbufModule"]/_:field[@name="module"]/_:type/@c:type' -v "gpointer" \
|
||||
GdkPixbuf-2.0.gir
|
||||
|
||||
# replace "gint" response_id parameters with "ResponseType"
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-u '//_:parameter[@name="response_id"]/_:type[@name="gint"]/@c:type' -v "GtkResponseType" \
|
||||
-u '//_:parameter[@name="response_id"]/_:type[@name="gint"]/@name' -v "ResponseType" \
|
||||
Gtk-3.0.gir Gtk-4.0.gir
|
||||
|
||||
# fix wrong "full" transfer ownership
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-u '//_:constructor[@c:identifier="gtk_shortcut_label_new"]/_:return-value/@transfer-ownership' -v "none" \
|
||||
Gtk-3.0.gir Gtk-4.0.gir
|
||||
|
||||
# add out annotation for functions returning GValue
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-a '//_:method[@c:identifier="gtk_style_context_get_style_property"]//_:parameter[@name="value" and not(@direction)]' -type attr -n "direction" -v "out" \
|
||||
-a '//_:method[@c:identifier="gtk_style_context_get_style_property"]//_:parameter[@name="value" and not(@caller-allocates)]' -type attr -n "caller-allocates" -v "1" \
|
||||
-a '//_:method[@c:identifier="gtk_cell_area_cell_get_property"]//_:parameter[@name="value" and not(@direction)]' -type attr -n "direction" -v "out" \
|
||||
@@ -89,19 +89,19 @@ xmlstarlet tr JavaScriptCore-4.0.xsl JavaScriptCore-4.0.gir | xmlstarlet fo > Ja
|
||||
mv JavaScriptCore-4.0.gir.tmp JavaScriptCore-4.0.gir
|
||||
|
||||
# fill in types from JavaScriptCore
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-i '///_:type[not(@name) and @c:type="JSGlobalContextRef"]' -t 'attr' -n 'name' -v "JavaScriptCore.GlobalContextRef" \
|
||||
-i '///_:type[not(@name) and @c:type="JSValueRef"]' -t 'attr' -n 'name' -v "JavaScriptCore.ValueRef" \
|
||||
WebKit2WebExtension-4.0.gir WebKit2-4.0.gir
|
||||
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-u '//_:constant[@name="DOM_NODE_FILTER_SHOW_ALL"]/_:type/@name' -v "guint" \
|
||||
-u '//_:constant[@name="DOM_NODE_FILTER_SHOW_ALL"]/_:type/@c:type' -v "guint" \
|
||||
WebKit2WebExtension-4.0.gir
|
||||
|
||||
|
||||
# remove freetype and graphite methods; GitHub issue #2557
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-d '///_:function[@c:identifier="hb_graphite2_face_get_gr_face"]' \
|
||||
-d '///_:function[@c:identifier="hb_graphite2_font_get_gr_font"]' \
|
||||
-d '///_:function[@c:identifier="hb_ft_face_create"]' \
|
||||
@@ -115,7 +115,7 @@ xmlstarlet ed -P -L \
|
||||
HarfBuzz-0.0.gir
|
||||
|
||||
# fix harfbuzz types on Pango
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-i '///_:type[not(@name) and @c:type="hb_font_t*"]' -t 'attr' -n 'name' -v "gconstpointer" \
|
||||
-u '//_:type[@c:type="hb_font_t*"]/@c:type' -v "gconstpointer" \
|
||||
-i '///_:array[not(@name) and @c:type="hb_feature_t*"]' -t 'attr' -n 'name' -v "gconstpointer" \
|
||||
@@ -127,12 +127,12 @@ xmlstarlet ed -P -L \
|
||||
Pango-1.0.gir
|
||||
|
||||
# Remove unstable method from focal release
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-d '///_:method[@c:identifier="atk_plug_set_child"]' \
|
||||
Atk-1.0.gir
|
||||
|
||||
# fix non-existant c-types
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-u '//_:class[@name="WaylandDevice"]/_:method[@name="get_wl_keyboard"]//_:type[@name="gpointer"]/@c:type' -v "gpointer" \
|
||||
-u '//_:class[@name="WaylandDevice"]/_:method[@name="get_wl_pointer"]//_:type[@name="gpointer"]/@c:type' -v "gpointer" \
|
||||
-u '//_:class[@name="WaylandDevice"]/_:method[@name="get_wl_seat"]//_:type[@name="gpointer"]/@c:type' -v "gpointer" \
|
||||
|
||||
@@ -3,7 +3,7 @@ set -x -e
|
||||
|
||||
# `///` used as `//` not works in Windows in this case
|
||||
for file in *.gir; do
|
||||
xmlstarlet ed -P -L \
|
||||
xmlstarlet ed -L \
|
||||
-d '//_:doc/@line' \
|
||||
-d '//_:doc/@filename' \
|
||||
-d '///_:source-position' \
|
||||
|
||||
Reference in New Issue
Block a user