@gtkx/ffi 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cairo/cairo.js +1 -1
- package/dist/codegen/ffi-generator.js +37 -12
- package/dist/generated/adw/index.d.ts +0 -1
- package/dist/generated/adw/index.js +0 -1
- package/dist/generated/adw/preferences-group.d.ts +0 -11
- package/dist/generated/adw/preferences-group.js +0 -36
- package/dist/generated/atspi/device.d.ts +0 -15
- package/dist/generated/atspi/device.js +0 -65
- package/dist/generated/atspi/functions.d.ts +4 -14
- package/dist/generated/atspi/functions.js +0 -48
- package/dist/generated/atspi/index.d.ts +0 -2
- package/dist/generated/atspi/index.js +0 -2
- package/dist/generated/gdk/cursor.d.ts +1 -12
- package/dist/generated/gdk/cursor.js +22 -55
- package/dist/generated/gdk/functions.d.ts +0 -26
- package/dist/generated/gdk/functions.js +0 -74
- package/dist/generated/gdk/texture.d.ts +0 -10
- package/dist/generated/gdk/texture.js +0 -36
- package/dist/generated/gdkpixbuf/pixbuf.d.ts +0 -49
- package/dist/generated/gdkpixbuf/pixbuf.js +0 -166
- package/dist/generated/gio/app-info.d.ts +0 -15
- package/dist/generated/gio/app-info.js +0 -50
- package/dist/generated/gio/async-initable.d.ts +0 -44
- package/dist/generated/gio/async-initable.js +0 -69
- package/dist/generated/gio/buffered-input-stream.d.ts +0 -14
- package/dist/generated/gio/buffered-input-stream.js +0 -44
- package/dist/generated/gio/bytes-icon.d.ts +0 -10
- package/dist/generated/gio/bytes-icon.js +0 -36
- package/dist/generated/gio/cancellable.d.ts +0 -41
- package/dist/generated/gio/cancellable.js +0 -62
- package/dist/generated/gio/data-input-stream.d.ts +0 -59
- package/dist/generated/gio/data-input-stream.js +0 -149
- package/dist/generated/gio/dbus-connection.d.ts +1 -374
- package/dist/generated/gio/dbus-connection.js +0 -761
- package/dist/generated/gio/dbus-object-manager-client.d.ts +1 -120
- package/dist/generated/gio/dbus-object-manager-client.js +0 -354
- package/dist/generated/gio/dbus-proxy.d.ts +0 -163
- package/dist/generated/gio/dbus-proxy.js +0 -379
- package/dist/generated/gio/drive.d.ts +1 -62
- package/dist/generated/gio/drive.js +0 -200
- package/dist/generated/gio/dtls-connection.d.ts +0 -29
- package/dist/generated/gio/dtls-connection.js +0 -115
- package/dist/generated/gio/file-enumerator.d.ts +0 -85
- package/dist/generated/gio/file-enumerator.js +0 -141
- package/dist/generated/gio/file-icon.d.ts +0 -10
- package/dist/generated/gio/file-icon.js +0 -36
- package/dist/generated/gio/file-input-stream.d.ts +0 -19
- package/dist/generated/gio/file-input-stream.js +0 -49
- package/dist/generated/gio/file-iostream.d.ts +0 -14
- package/dist/generated/gio/file-iostream.js +0 -44
- package/dist/generated/gio/file-output-stream.d.ts +0 -14
- package/dist/generated/gio/file-output-stream.js +0 -44
- package/dist/generated/gio/file.d.ts +1 -661
- package/dist/generated/gio/file.js +58 -1899
- package/dist/generated/gio/functions.d.ts +0 -261
- package/dist/generated/gio/functions.js +0 -666
- package/dist/generated/gio/index.d.ts +0 -2
- package/dist/generated/gio/index.js +0 -2
- package/dist/generated/gio/input-stream.d.ts +0 -127
- package/dist/generated/gio/input-stream.js +0 -293
- package/dist/generated/gio/iostream.d.ts +0 -34
- package/dist/generated/gio/iostream.js +0 -93
- package/dist/generated/gio/list-store.d.ts +0 -46
- package/dist/generated/gio/list-store.js +0 -139
- package/dist/generated/gio/loadable-icon.d.ts +0 -10
- package/dist/generated/gio/loadable-icon.js +0 -36
- package/dist/generated/gio/mount.d.ts +0 -74
- package/dist/generated/gio/mount.js +0 -243
- package/dist/generated/gio/network-monitor.d.ts +0 -16
- package/dist/generated/gio/network-monitor.js +0 -42
- package/dist/generated/gio/output-stream.d.ts +0 -200
- package/dist/generated/gio/output-stream.js +0 -469
- package/dist/generated/gio/permission.d.ts +0 -20
- package/dist/generated/gio/permission.js +0 -64
- package/dist/generated/gio/proxy-resolver.d.ts +0 -9
- package/dist/generated/gio/proxy-resolver.js +0 -35
- package/dist/generated/gio/proxy.d.ts +0 -9
- package/dist/generated/gio/proxy.js +0 -39
- package/dist/generated/gio/resolver.d.ts +0 -59
- package/dist/generated/gio/resolver.js +0 -205
- package/dist/generated/gio/settings.d.ts +0 -33
- package/dist/generated/gio/settings.js +0 -53
- package/dist/generated/gio/simple-proxy-resolver.d.ts +0 -9
- package/dist/generated/gio/simple-proxy-resolver.js +0 -35
- package/dist/generated/gio/socket-address-enumerator.d.ts +0 -10
- package/dist/generated/gio/socket-address-enumerator.js +0 -32
- package/dist/generated/gio/socket-client.d.ts +0 -57
- package/dist/generated/gio/socket-client.js +0 -173
- package/dist/generated/gio/socket-connection.d.ts +0 -17
- package/dist/generated/gio/socket-connection.js +0 -43
- package/dist/generated/gio/socket-listener.d.ts +0 -22
- package/dist/generated/gio/socket-listener.js +0 -66
- package/dist/generated/gio/subprocess.d.ts +0 -36
- package/dist/generated/gio/subprocess.js +0 -139
- package/dist/generated/gio/tls-connection.d.ts +0 -9
- package/dist/generated/gio/tls-connection.js +0 -35
- package/dist/generated/gio/tls-database.d.ts +0 -51
- package/dist/generated/gio/tls-database.js +0 -205
- package/dist/generated/gio/tls-interaction.d.ts +0 -38
- package/dist/generated/gio/tls-interaction.js +0 -94
- package/dist/generated/gio/unix-connection.d.ts +0 -26
- package/dist/generated/gio/unix-connection.js +0 -70
- package/dist/generated/gio/vfs.d.ts +0 -30
- package/dist/generated/gio/vfs.js +0 -71
- package/dist/generated/gio/volume.d.ts +0 -32
- package/dist/generated/gio/volume.js +0 -117
- package/dist/generated/giounix/desktop-app-info.d.ts +0 -58
- package/dist/generated/giounix/desktop-app-info.js +0 -226
- package/dist/generated/glib/byte-array.d.ts +0 -23
- package/dist/generated/glib/byte-array.js +0 -62
- package/dist/generated/glib/error.d.ts +0 -36
- package/dist/generated/glib/error.js +0 -82
- package/dist/generated/glib/functions.d.ts +1 -811
- package/dist/generated/glib/functions.js +55 -1787
- package/dist/generated/glib/hash-table.d.ts +0 -64
- package/dist/generated/glib/hash-table.js +0 -148
- package/dist/generated/glib/main-context.d.ts +0 -17
- package/dist/generated/glib/main-context.js +0 -37
- package/dist/generated/glib/option-group.d.ts +0 -12
- package/dist/generated/glib/option-group.js +0 -39
- package/dist/generated/glib/regex.d.ts +0 -54
- package/dist/generated/glib/regex.js +0 -107
- package/dist/generated/glib/source.d.ts +0 -27
- package/dist/generated/glib/source.js +0 -43
- package/dist/generated/glib/thread.d.ts +2 -46
- package/dist/generated/glib/thread.js +5 -50
- package/dist/generated/glib/tree.d.ts +2 -74
- package/dist/generated/glib/tree.js +4 -192
- package/dist/generated/glibunix/functions.d.ts +0 -2
- package/dist/generated/glibunix/functions.js +0 -45
- package/dist/generated/gobject/binding-group.d.ts +0 -17
- package/dist/generated/gobject/binding-group.js +0 -59
- package/dist/generated/gobject/functions.d.ts +0 -40
- package/dist/generated/gobject/functions.js +0 -95
- package/dist/generated/gobject/object.d.ts +0 -33
- package/dist/generated/gobject/object.js +0 -77
- package/dist/generated/gobject/signal-group.d.ts +0 -23
- package/dist/generated/gobject/signal-group.js +0 -70
- package/dist/generated/gobject/value-array.d.ts +0 -19
- package/dist/generated/gobject/value-array.js +0 -70
- package/dist/generated/gsk/path.d.ts +1 -41
- package/dist/generated/gsk/path.js +0 -96
- package/dist/generated/gsk/render-node.d.ts +0 -9
- package/dist/generated/gsk/render-node.js +0 -32
- package/dist/generated/gst/buffer-list.d.ts +0 -10
- package/dist/generated/gst/buffer-list.js +0 -31
- package/dist/generated/gst/buffer.d.ts +0 -10
- package/dist/generated/gst/buffer.js +0 -31
- package/dist/generated/gst/bus.d.ts +0 -43
- package/dist/generated/gst/bus.js +0 -88
- package/dist/generated/gst/caps.d.ts +0 -26
- package/dist/generated/gst/caps.js +0 -89
- package/dist/generated/gst/clock.d.ts +0 -15
- package/dist/generated/gst/clock.js +0 -35
- package/dist/generated/gst/element.d.ts +0 -49
- package/dist/generated/gst/element.js +0 -117
- package/dist/generated/gst/functions.d.ts +1 -80
- package/dist/generated/gst/functions.js +0 -234
- package/dist/generated/gst/index.d.ts +0 -1
- package/dist/generated/gst/index.js +0 -1
- package/dist/generated/gst/iterator.d.ts +0 -56
- package/dist/generated/gst/iterator.js +0 -168
- package/dist/generated/gst/pad.d.ts +1 -145
- package/dist/generated/gst/pad.js +0 -440
- package/dist/generated/gst/plugin.d.ts +0 -41
- package/dist/generated/gst/plugin.js +0 -132
- package/dist/generated/gst/promise.d.ts +0 -9
- package/dist/generated/gst/promise.js +1 -27
- package/dist/generated/gst/registry.d.ts +0 -21
- package/dist/generated/gst/registry.js +0 -73
- package/dist/generated/gst/structure.d.ts +0 -52
- package/dist/generated/gst/structure.js +0 -178
- package/dist/generated/gst/tag-list.d.ts +0 -7
- package/dist/generated/gst/tag-list.js +0 -28
- package/dist/generated/gst/task-pool.d.ts +0 -6
- package/dist/generated/gst/task-pool.js +0 -38
- package/dist/generated/gst/type-find.d.ts +0 -15
- package/dist/generated/gst/type-find.js +0 -58
- package/dist/generated/gstbase/collect-pads.d.ts +0 -108
- package/dist/generated/gstbase/collect-pads.js +0 -243
- package/dist/generated/gstbase/functions.d.ts +0 -45
- package/dist/generated/gstbase/functions.js +0 -132
- package/dist/generated/gtk/assistant.d.ts +0 -13
- package/dist/generated/gtk/assistant.js +0 -34
- package/dist/generated/gtk/builder-cscope.d.ts +0 -13
- package/dist/generated/gtk/builder-cscope.js +0 -28
- package/dist/generated/gtk/cell-area.d.ts +0 -31
- package/dist/generated/gtk/cell-area.js +0 -114
- package/dist/generated/gtk/cell-layout.d.ts +0 -14
- package/dist/generated/gtk/cell-layout.js +0 -39
- package/dist/generated/gtk/cell-view.d.ts +0 -14
- package/dist/generated/gtk/cell-view.js +0 -39
- package/dist/generated/gtk/combo-box.d.ts +0 -25
- package/dist/generated/gtk/combo-box.js +0 -72
- package/dist/generated/gtk/drawing-area.d.ts +2 -1
- package/dist/generated/gtk/drawing-area.js +6 -1
- package/dist/generated/gtk/entry-completion.d.ts +0 -24
- package/dist/generated/gtk/entry-completion.js +0 -69
- package/dist/generated/gtk/expression.d.ts +0 -14
- package/dist/generated/gtk/expression.js +0 -45
- package/dist/generated/gtk/flow-box.d.ts +0 -68
- package/dist/generated/gtk/flow-box.js +0 -150
- package/dist/generated/gtk/font-button.d.ts +0 -8
- package/dist/generated/gtk/font-button.js +0 -29
- package/dist/generated/gtk/font-chooser-dialog.d.ts +0 -8
- package/dist/generated/gtk/font-chooser-dialog.js +0 -29
- package/dist/generated/gtk/font-chooser-widget.d.ts +0 -8
- package/dist/generated/gtk/font-chooser-widget.js +0 -29
- package/dist/generated/gtk/font-chooser.d.ts +0 -8
- package/dist/generated/gtk/font-chooser.js +0 -29
- package/dist/generated/gtk/functions.d.ts +0 -23
- package/dist/generated/gtk/functions.js +0 -69
- package/dist/generated/gtk/icon-view.d.ts +0 -21
- package/dist/generated/gtk/icon-view.js +0 -62
- package/dist/generated/gtk/index.d.ts +0 -7
- package/dist/generated/gtk/index.js +0 -7
- package/dist/generated/gtk/list-box.d.ts +0 -99
- package/dist/generated/gtk/list-box.js +0 -203
- package/dist/generated/gtk/list-store.d.ts +0 -33
- package/dist/generated/gtk/list-store.js +0 -95
- package/dist/generated/gtk/menu-button.d.ts +0 -18
- package/dist/generated/gtk/menu-button.js +0 -40
- package/dist/generated/gtk/print-job.d.ts +0 -7
- package/dist/generated/gtk/print-job.js +0 -27
- package/dist/generated/gtk/print-settings.d.ts +0 -6
- package/dist/generated/gtk/print-settings.js +0 -22
- package/dist/generated/gtk/scale.d.ts +0 -14
- package/dist/generated/gtk/scale.js +0 -36
- package/dist/generated/gtk/text-buffer.d.ts +0 -19
- package/dist/generated/gtk/text-buffer.js +0 -42
- package/dist/generated/gtk/text-iter.d.ts +0 -19
- package/dist/generated/gtk/text-iter.js +0 -81
- package/dist/generated/gtk/text-tag-table.d.ts +0 -9
- package/dist/generated/gtk/text-tag-table.js +0 -25
- package/dist/generated/gtk/tree-model-filter.d.ts +0 -68
- package/dist/generated/gtk/tree-model-filter.js +0 -137
- package/dist/generated/gtk/tree-model-sort.d.ts +0 -33
- package/dist/generated/gtk/tree-model-sort.js +0 -95
- package/dist/generated/gtk/tree-model.d.ts +0 -9
- package/dist/generated/gtk/tree-model.js +0 -25
- package/dist/generated/gtk/tree-selection.d.ts +0 -20
- package/dist/generated/gtk/tree-selection.js +0 -57
- package/dist/generated/gtk/tree-sortable.d.ts +0 -24
- package/dist/generated/gtk/tree-sortable.js +0 -70
- package/dist/generated/gtk/tree-store.d.ts +0 -33
- package/dist/generated/gtk/tree-store.js +0 -95
- package/dist/generated/gtk/tree-view-column.d.ts +0 -14
- package/dist/generated/gtk/tree-view-column.js +0 -39
- package/dist/generated/gtk/tree-view.d.ts +0 -54
- package/dist/generated/gtk/tree-view.js +0 -167
- package/dist/generated/gtk/widget.d.ts +0 -32
- package/dist/generated/gtk/widget.js +0 -50
- package/dist/generated/gtksource/functions.d.ts +0 -21
- package/dist/generated/gtksource/functions.js +0 -49
- package/dist/generated/harfbuzz/functions.d.ts +0 -448
- package/dist/generated/harfbuzz/functions.js +3736 -5611
- package/dist/generated/javascriptcore/class.d.ts +0 -94
- package/dist/generated/javascriptcore/class.js +0 -272
- package/dist/generated/javascriptcore/context.d.ts +0 -13
- package/dist/generated/javascriptcore/context.js +0 -34
- package/dist/generated/javascriptcore/functions.d.ts +0 -7
- package/dist/generated/javascriptcore/functions.js +0 -19
- package/dist/generated/javascriptcore/value.d.ts +0 -72
- package/dist/generated/javascriptcore/value.js +0 -202
- package/dist/generated/json/array.d.ts +0 -11
- package/dist/generated/json/array.js +0 -32
- package/dist/generated/json/object.d.ts +0 -14
- package/dist/generated/json/object.js +0 -35
- package/dist/generated/pango/attr-list.d.ts +0 -8
- package/dist/generated/pango/attr-list.js +0 -37
- package/dist/generated/pango/fontset.d.ts +0 -9
- package/dist/generated/pango/fontset.js +0 -25
- package/dist/generated/pango/functions.d.ts +0 -13
- package/dist/generated/pango/functions.js +0 -55
- package/dist/generated/pangocairo/functions.d.ts +0 -11
- package/dist/generated/pangocairo/functions.js +0 -33
- package/dist/generated/soup/auth-domain-basic.d.ts +0 -17
- package/dist/generated/soup/auth-domain-basic.js +0 -37
- package/dist/generated/soup/auth-domain-digest.d.ts +0 -17
- package/dist/generated/soup/auth-domain-digest.js +0 -37
- package/dist/generated/soup/auth-domain.d.ts +0 -44
- package/dist/generated/soup/auth-domain.js +0 -84
- package/dist/generated/soup/logger.d.ts +0 -32
- package/dist/generated/soup/logger.js +0 -92
- package/dist/generated/soup/message-headers.d.ts +0 -17
- package/dist/generated/soup/message-headers.js +0 -38
- package/dist/generated/soup/server.d.ts +0 -99
- package/dist/generated/soup/server.js +0 -184
- package/dist/generated/vte/terminal.d.ts +0 -168
- package/dist/generated/vte/terminal.js +0 -483
- package/dist/generated/webkit/web-context.d.ts +0 -44
- package/dist/generated/webkit/web-context.js +0 -68
- package/package.json +3 -3
- package/dist/generated/adw/callback-animation-target.d.ts +0 -19
- package/dist/generated/adw/callback-animation-target.js +0 -64
- package/dist/generated/atspi/device-listener.d.ts +0 -26
- package/dist/generated/atspi/device-listener.js +0 -104
- package/dist/generated/atspi/event-listener.d.ts +0 -155
- package/dist/generated/atspi/event-listener.js +0 -496
- package/dist/generated/gio/simple-async-result.d.ts +0 -328
- package/dist/generated/gio/simple-async-result.js +0 -588
- package/dist/generated/gio/task.d.ts +0 -936
- package/dist/generated/gio/task.js +0 -1460
- package/dist/generated/gst/task.d.ts +0 -128
- package/dist/generated/gst/task.js +0 -363
- package/dist/generated/gtk/callback-action.d.ts +0 -16
- package/dist/generated/gtk/callback-action.js +0 -61
- package/dist/generated/gtk/cclosure-expression.d.ts +0 -20
- package/dist/generated/gtk/cclosure-expression.js +0 -68
- package/dist/generated/gtk/custom-filter.d.ts +0 -35
- package/dist/generated/gtk/custom-filter.js +0 -119
- package/dist/generated/gtk/custom-layout.d.ts +0 -26
- package/dist/generated/gtk/custom-layout.js +0 -71
- package/dist/generated/gtk/custom-sorter.d.ts +0 -34
- package/dist/generated/gtk/custom-sorter.js +0 -114
- package/dist/generated/gtk/map-list-model.d.ts +0 -173
- package/dist/generated/gtk/map-list-model.js +0 -361
- package/dist/generated/gtk/tree-list-model.d.ts +0 -145
- package/dist/generated/gtk/tree-list-model.js +0 -310
|
@@ -879,47 +879,6 @@ export const asyncQueueNewFull = (itemFreeFunc) => {
|
|
|
879
879
|
},
|
|
880
880
|
], { type: "int", size: 64, unsigned: true });
|
|
881
881
|
};
|
|
882
|
-
/**
|
|
883
|
-
* Specifies a function to be called at normal program termination.
|
|
884
|
-
*
|
|
885
|
-
* Since GLib 2.8.2, on Windows g_atexit() actually is a preprocessor
|
|
886
|
-
* macro that maps to a call to the atexit() function in the C
|
|
887
|
-
* library. This means that in case the code that calls g_atexit(),
|
|
888
|
-
* i.e. atexit(), is in a DLL, the function will be called when the
|
|
889
|
-
* DLL is detached from the program. This typically makes more sense
|
|
890
|
-
* than that the function is called when the GLib DLL is detached,
|
|
891
|
-
* which happened earlier when g_atexit() was a function in the GLib
|
|
892
|
-
* DLL.
|
|
893
|
-
*
|
|
894
|
-
* The behaviour of atexit() in the context of dynamically loaded
|
|
895
|
-
* modules is not formally specified and varies wildly.
|
|
896
|
-
*
|
|
897
|
-
* On POSIX systems, calling g_atexit() (or atexit()) in a dynamically
|
|
898
|
-
* loaded module which is unloaded before the program terminates might
|
|
899
|
-
* well cause a crash at program exit.
|
|
900
|
-
*
|
|
901
|
-
* Some POSIX systems implement atexit() like Windows, and have each
|
|
902
|
-
* dynamically loaded module maintain an own atexit chain that is
|
|
903
|
-
* called when the module is unloaded.
|
|
904
|
-
*
|
|
905
|
-
* On other POSIX systems, before a dynamically loaded module is
|
|
906
|
-
* unloaded, the registered atexit functions (if any) residing in that
|
|
907
|
-
* module are called, regardless where the code that registered them
|
|
908
|
-
* resided. This is presumably the most robust approach.
|
|
909
|
-
*
|
|
910
|
-
* As can be seen from the above, for portability it's best to avoid
|
|
911
|
-
* calling g_atexit() (or atexit()) except in the main executable of a
|
|
912
|
-
* program.
|
|
913
|
-
* @param func - the function to call on normal program termination.
|
|
914
|
-
*/
|
|
915
|
-
export const atexit = (func) => {
|
|
916
|
-
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_atexit", [
|
|
917
|
-
{
|
|
918
|
-
type: { type: "callback" },
|
|
919
|
-
value: func,
|
|
920
|
-
},
|
|
921
|
-
], { type: "undefined" });
|
|
922
|
-
};
|
|
923
882
|
/**
|
|
924
883
|
* Atomically adds `val` to the value of @atomic.
|
|
925
884
|
*
|
|
@@ -2474,68 +2433,6 @@ export const byteArraySizedNew = (reservedSize) => {
|
|
|
2474
2433
|
});
|
|
2475
2434
|
return getBoxed(ptr, ByteArray);
|
|
2476
2435
|
};
|
|
2477
|
-
/**
|
|
2478
|
-
* Sorts a byte array, using `compare_func` which should be a
|
|
2479
|
-
* `qsort()`-style comparison function (returns less than zero for first
|
|
2480
|
-
* arg is less than second arg, zero for equal, greater than zero if
|
|
2481
|
-
* first arg is greater than second arg).
|
|
2482
|
-
*
|
|
2483
|
-
* If two array elements compare equal, their order in the sorted array
|
|
2484
|
-
* is undefined. If you want equal elements to keep their order (i.e.
|
|
2485
|
-
* you want a stable sort) you can write a comparison function that,
|
|
2486
|
-
* if two elements would otherwise compare equal, compares them by
|
|
2487
|
-
* their addresses.
|
|
2488
|
-
* @param array - a byte array
|
|
2489
|
-
* @param compareFunc - the comparison function
|
|
2490
|
-
*/
|
|
2491
|
-
export const byteArraySort = (array, compareFunc) => {
|
|
2492
|
-
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_byte_array_sort", [
|
|
2493
|
-
{
|
|
2494
|
-
type: {
|
|
2495
|
-
type: "boxed",
|
|
2496
|
-
borrowed: true,
|
|
2497
|
-
innerType: "GByteArray",
|
|
2498
|
-
lib: "libgobject-2.0.so.0,libglib-2.0.so.0",
|
|
2499
|
-
},
|
|
2500
|
-
value: array?.id ?? array,
|
|
2501
|
-
},
|
|
2502
|
-
{
|
|
2503
|
-
type: { type: "callback" },
|
|
2504
|
-
value: compareFunc,
|
|
2505
|
-
},
|
|
2506
|
-
], { type: "undefined" });
|
|
2507
|
-
};
|
|
2508
|
-
/**
|
|
2509
|
-
* Like [func@GLib.ByteArray.sort], but the comparison function takes an extra
|
|
2510
|
-
* user data argument.
|
|
2511
|
-
* @param array - a byte array
|
|
2512
|
-
* @param compareFunc - the comparison function
|
|
2513
|
-
* @param userData - the data to pass to @compare_func
|
|
2514
|
-
*/
|
|
2515
|
-
export const byteArraySortWithData = (array, compareFunc) => {
|
|
2516
|
-
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_byte_array_sort_with_data", [
|
|
2517
|
-
{
|
|
2518
|
-
type: {
|
|
2519
|
-
type: "boxed",
|
|
2520
|
-
borrowed: true,
|
|
2521
|
-
innerType: "GByteArray",
|
|
2522
|
-
lib: "libgobject-2.0.so.0,libglib-2.0.so.0",
|
|
2523
|
-
},
|
|
2524
|
-
value: array?.id ?? array,
|
|
2525
|
-
},
|
|
2526
|
-
{
|
|
2527
|
-
type: {
|
|
2528
|
-
type: "callback",
|
|
2529
|
-
trampoline: "compareDataFunc",
|
|
2530
|
-
argTypes: [
|
|
2531
|
-
{ type: "gobject", borrowed: true },
|
|
2532
|
-
{ type: "gobject", borrowed: true },
|
|
2533
|
-
],
|
|
2534
|
-
},
|
|
2535
|
-
value: compareFunc,
|
|
2536
|
-
},
|
|
2537
|
-
], { type: "undefined" });
|
|
2538
|
-
};
|
|
2539
2436
|
/**
|
|
2540
2437
|
* Frees the data in the array and resets the size to zero, while
|
|
2541
2438
|
* the underlying array is preserved for use elsewhere and returned
|
|
@@ -2676,63 +2573,6 @@ export const checksumTypeGetLength = (checksumType) => {
|
|
|
2676
2573
|
},
|
|
2677
2574
|
], { type: "int", size: 64, unsigned: false });
|
|
2678
2575
|
};
|
|
2679
|
-
/**
|
|
2680
|
-
* Sets a function to be called when the child indicated by `pid` exits, at the priority @priority.
|
|
2681
|
-
*
|
|
2682
|
-
* If you obtain `pid` from [func@GLib.spawn_async] or
|
|
2683
|
-
* [func@GLib.spawn_async_with_pipes] you will need to pass
|
|
2684
|
-
* [flags@GLib.SpawnFlags.DO_NOT_REAP_CHILD] as a flag to the spawn function for
|
|
2685
|
-
* the child watching to work.
|
|
2686
|
-
*
|
|
2687
|
-
* In many programs, you will want to call [func@GLib.spawn_check_wait_status]
|
|
2688
|
-
* in the callback to determine whether or not the child exited
|
|
2689
|
-
* successfully.
|
|
2690
|
-
*
|
|
2691
|
-
* Also, note that on platforms where [type@GLib.Pid] must be explicitly closed
|
|
2692
|
-
* (see [func@GLib.spawn_close_pid]) `pid` must not be closed while the source
|
|
2693
|
-
* is still active. Typically, you should invoke [func@GLib.spawn_close_pid]
|
|
2694
|
-
* in the callback function for the source.
|
|
2695
|
-
*
|
|
2696
|
-
* GLib supports only a single callback per process ID.
|
|
2697
|
-
* On POSIX platforms, the same restrictions mentioned for
|
|
2698
|
-
* [func@GLib.child_watch_source_new] apply to this function.
|
|
2699
|
-
*
|
|
2700
|
-
* This internally creates a main loop source using
|
|
2701
|
-
* [func@GLib.child_watch_source_new] and attaches it to the main loop context
|
|
2702
|
-
* using [method@GLib.Source.attach]. You can do these steps manually if you
|
|
2703
|
-
* need greater control.
|
|
2704
|
-
* @param priority - the priority of the idle source; typically this will be in the
|
|
2705
|
-
* @param pid - process to watch — on POSIX systems, this is the positive PID of a
|
|
2706
|
-
* @param _function - function to call
|
|
2707
|
-
* @param data - data to pass to @function
|
|
2708
|
-
* @param notify - function to call when the idle is removed
|
|
2709
|
-
*/
|
|
2710
|
-
export const childWatchAddFull = (priority, pid, _function, data, notify) => {
|
|
2711
|
-
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_child_watch_add_full", [
|
|
2712
|
-
{
|
|
2713
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
2714
|
-
value: priority,
|
|
2715
|
-
},
|
|
2716
|
-
{
|
|
2717
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
2718
|
-
value: pid,
|
|
2719
|
-
},
|
|
2720
|
-
{
|
|
2721
|
-
type: { type: "callback" },
|
|
2722
|
-
value: _function,
|
|
2723
|
-
},
|
|
2724
|
-
{
|
|
2725
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
2726
|
-
value: data,
|
|
2727
|
-
optional: true,
|
|
2728
|
-
},
|
|
2729
|
-
{
|
|
2730
|
-
type: { type: "callback", trampoline: "destroy" },
|
|
2731
|
-
value: notify,
|
|
2732
|
-
optional: true,
|
|
2733
|
-
},
|
|
2734
|
-
], { type: "int", size: 32, unsigned: true });
|
|
2735
|
-
};
|
|
2736
2576
|
/**
|
|
2737
2577
|
* Creates a new child watch source.
|
|
2738
2578
|
*
|
|
@@ -3301,38 +3141,6 @@ export const creat = (filename, mode) => {
|
|
|
3301
3141
|
},
|
|
3302
3142
|
], { type: "int", size: 32, unsigned: false });
|
|
3303
3143
|
};
|
|
3304
|
-
/**
|
|
3305
|
-
* Calls the given function for each data element of the datalist. The
|
|
3306
|
-
* function is called with each data element's #GQuark id and data,
|
|
3307
|
-
* together with the given `user_data` parameter. Note that this
|
|
3308
|
-
* function is NOT thread-safe. So unless `datalist` can be protected
|
|
3309
|
-
* from any modifications during invocation of this function, it should
|
|
3310
|
-
* not be called.
|
|
3311
|
-
*
|
|
3312
|
-
* `func` can make changes to @datalist, but the iteration will not
|
|
3313
|
-
* reflect changes made during the g_datalist_foreach() call, other
|
|
3314
|
-
* than skipping over elements that are removed.
|
|
3315
|
-
* @param datalist - a datalist.
|
|
3316
|
-
* @param func - the function to call for each data element.
|
|
3317
|
-
* @param userData - user data to pass to the function.
|
|
3318
|
-
*/
|
|
3319
|
-
export const datalistForeach = (datalist, func, userData) => {
|
|
3320
|
-
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_datalist_foreach", [
|
|
3321
|
-
{
|
|
3322
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
3323
|
-
value: datalist,
|
|
3324
|
-
},
|
|
3325
|
-
{
|
|
3326
|
-
type: { type: "callback" },
|
|
3327
|
-
value: func,
|
|
3328
|
-
},
|
|
3329
|
-
{
|
|
3330
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
3331
|
-
value: userData,
|
|
3332
|
-
optional: true,
|
|
3333
|
-
},
|
|
3334
|
-
], { type: "undefined" });
|
|
3335
|
-
};
|
|
3336
3144
|
/**
|
|
3337
3145
|
* Gets a data element, using its string identifier. This is slower than
|
|
3338
3146
|
* g_datalist_id_get_data() because it compares strings.
|
|
@@ -3464,36 +3272,6 @@ export const datasetDestroy = (datasetLocation) => {
|
|
|
3464
3272
|
},
|
|
3465
3273
|
], { type: "undefined" });
|
|
3466
3274
|
};
|
|
3467
|
-
/**
|
|
3468
|
-
* Calls the given function for each data element which is associated
|
|
3469
|
-
* with the given location. Note that this function is NOT thread-safe.
|
|
3470
|
-
* So unless `dataset_location` can be protected from any modifications
|
|
3471
|
-
* during invocation of this function, it should not be called.
|
|
3472
|
-
*
|
|
3473
|
-
* `func` can make changes to the dataset, but the iteration will not
|
|
3474
|
-
* reflect changes made during the g_dataset_foreach() call, other
|
|
3475
|
-
* than skipping over elements that are removed.
|
|
3476
|
-
* @param datasetLocation - the location identifying the dataset.
|
|
3477
|
-
* @param func - the function to call for each data element.
|
|
3478
|
-
* @param userData - user data to pass to the function.
|
|
3479
|
-
*/
|
|
3480
|
-
export const datasetForeach = (datasetLocation, func, userData) => {
|
|
3481
|
-
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_dataset_foreach", [
|
|
3482
|
-
{
|
|
3483
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
3484
|
-
value: datasetLocation,
|
|
3485
|
-
},
|
|
3486
|
-
{
|
|
3487
|
-
type: { type: "callback" },
|
|
3488
|
-
value: func,
|
|
3489
|
-
},
|
|
3490
|
-
{
|
|
3491
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
3492
|
-
value: userData,
|
|
3493
|
-
optional: true,
|
|
3494
|
-
},
|
|
3495
|
-
], { type: "undefined" });
|
|
3496
|
-
};
|
|
3497
3275
|
/**
|
|
3498
3276
|
* Gets the data element corresponding to a #GQuark.
|
|
3499
3277
|
* @param datasetLocation - the location identifying the dataset.
|
|
@@ -4099,88 +3877,6 @@ export const environUnsetenv = (variable, envp) => {
|
|
|
4099
3877
|
},
|
|
4100
3878
|
], { type: "array", itemType: { type: "string" } });
|
|
4101
3879
|
};
|
|
4102
|
-
/**
|
|
4103
|
-
* This function registers an extended #GError domain.
|
|
4104
|
-
* `error_type_name` will be duplicated. Otherwise does the same as
|
|
4105
|
-
* g_error_domain_register_static().
|
|
4106
|
-
* @param errorTypeName - string to create a #GQuark from
|
|
4107
|
-
* @param errorTypePrivateSize - size of the private error data in bytes
|
|
4108
|
-
* @param errorTypeInit - function initializing fields of the private error data
|
|
4109
|
-
* @param errorTypeCopy - function copying fields of the private error data
|
|
4110
|
-
* @param errorTypeClear - function freeing fields of the private error data
|
|
4111
|
-
*/
|
|
4112
|
-
export const errorDomainRegister = (errorTypeName, errorTypePrivateSize, errorTypeInit, errorTypeCopy, errorTypeClear) => {
|
|
4113
|
-
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_error_domain_register", [
|
|
4114
|
-
{
|
|
4115
|
-
type: { type: "string" },
|
|
4116
|
-
value: errorTypeName,
|
|
4117
|
-
},
|
|
4118
|
-
{
|
|
4119
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
4120
|
-
value: errorTypePrivateSize,
|
|
4121
|
-
},
|
|
4122
|
-
{
|
|
4123
|
-
type: { type: "callback" },
|
|
4124
|
-
value: errorTypeInit,
|
|
4125
|
-
},
|
|
4126
|
-
{
|
|
4127
|
-
type: { type: "callback" },
|
|
4128
|
-
value: errorTypeCopy,
|
|
4129
|
-
},
|
|
4130
|
-
{
|
|
4131
|
-
type: { type: "callback" },
|
|
4132
|
-
value: errorTypeClear,
|
|
4133
|
-
},
|
|
4134
|
-
], { type: "int", size: 32, unsigned: true });
|
|
4135
|
-
};
|
|
4136
|
-
/**
|
|
4137
|
-
* This function registers an extended #GError domain.
|
|
4138
|
-
*
|
|
4139
|
-
* `error_type_name` should not be freed. `error_type_private_size` must
|
|
4140
|
-
* be greater than 0.
|
|
4141
|
-
*
|
|
4142
|
-
* `error_type_init` receives an initialized #GError and should then initialize
|
|
4143
|
-
* the private data.
|
|
4144
|
-
*
|
|
4145
|
-
* `error_type_copy` is a function that receives both original and a copy
|
|
4146
|
-
* #GError and should copy the fields of the private error data. The standard
|
|
4147
|
-
* #GError fields are already handled.
|
|
4148
|
-
*
|
|
4149
|
-
* `error_type_clear` receives the pointer to the error, and it should free the
|
|
4150
|
-
* fields of the private error data. It should not free the struct itself though.
|
|
4151
|
-
*
|
|
4152
|
-
* Normally, it is better to use G_DEFINE_EXTENDED_ERROR(), as it
|
|
4153
|
-
* already takes care of passing valid information to this function.
|
|
4154
|
-
* @param errorTypeName - static string to create a #GQuark from
|
|
4155
|
-
* @param errorTypePrivateSize - size of the private error data in bytes
|
|
4156
|
-
* @param errorTypeInit - function initializing fields of the private error data
|
|
4157
|
-
* @param errorTypeCopy - function copying fields of the private error data
|
|
4158
|
-
* @param errorTypeClear - function freeing fields of the private error data
|
|
4159
|
-
*/
|
|
4160
|
-
export const errorDomainRegisterStatic = (errorTypeName, errorTypePrivateSize, errorTypeInit, errorTypeCopy, errorTypeClear) => {
|
|
4161
|
-
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_error_domain_register_static", [
|
|
4162
|
-
{
|
|
4163
|
-
type: { type: "string" },
|
|
4164
|
-
value: errorTypeName,
|
|
4165
|
-
},
|
|
4166
|
-
{
|
|
4167
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
4168
|
-
value: errorTypePrivateSize,
|
|
4169
|
-
},
|
|
4170
|
-
{
|
|
4171
|
-
type: { type: "callback" },
|
|
4172
|
-
value: errorTypeInit,
|
|
4173
|
-
},
|
|
4174
|
-
{
|
|
4175
|
-
type: { type: "callback" },
|
|
4176
|
-
value: errorTypeCopy,
|
|
4177
|
-
},
|
|
4178
|
-
{
|
|
4179
|
-
type: { type: "callback" },
|
|
4180
|
-
value: errorTypeClear,
|
|
4181
|
-
},
|
|
4182
|
-
], { type: "int", size: 32, unsigned: true });
|
|
4183
|
-
};
|
|
4184
3880
|
/**
|
|
4185
3881
|
* Mark every file descriptor equal to or greater than `lowfd` to be closed
|
|
4186
3882
|
* at the next `execve()` or similar, as if via the `FD_CLOEXEC` flag.
|
|
@@ -5785,154 +5481,6 @@ export const hashTableDestroy = (hashTable) => {
|
|
|
5785
5481
|
},
|
|
5786
5482
|
], { type: "undefined" });
|
|
5787
5483
|
};
|
|
5788
|
-
/**
|
|
5789
|
-
* Calls the given function for key/value pairs in the #GHashTable
|
|
5790
|
-
* until `predicate` returns %TRUE. The function is passed the key
|
|
5791
|
-
* and value of each pair, and the given `user_data` parameter. The
|
|
5792
|
-
* hash table may not be modified while iterating over it (you can't
|
|
5793
|
-
* add/remove items).
|
|
5794
|
-
*
|
|
5795
|
-
* Note, that hash tables are really only optimized for forward
|
|
5796
|
-
* lookups, i.e. g_hash_table_lookup(). So code that frequently issues
|
|
5797
|
-
* g_hash_table_find() or g_hash_table_foreach() (e.g. in the order of
|
|
5798
|
-
* once per every entry in a hash table) should probably be reworked
|
|
5799
|
-
* to use additional or different data structures for reverse lookups
|
|
5800
|
-
* (keep in mind that an O(n) find/foreach operation issued for all n
|
|
5801
|
-
* values in a hash table ends up needing O(n*n) operations).
|
|
5802
|
-
* @param hashTable - a #GHashTable
|
|
5803
|
-
* @param predicate - function to test the key/value pairs for a certain property
|
|
5804
|
-
* @param userData - user data to pass to the function
|
|
5805
|
-
*/
|
|
5806
|
-
export const hashTableFind = (hashTable, predicate, userData) => {
|
|
5807
|
-
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_hash_table_find", [
|
|
5808
|
-
{
|
|
5809
|
-
type: {
|
|
5810
|
-
type: "boxed",
|
|
5811
|
-
borrowed: true,
|
|
5812
|
-
innerType: "GHashTable",
|
|
5813
|
-
lib: "libgobject-2.0.so.0,libglib-2.0.so.0",
|
|
5814
|
-
},
|
|
5815
|
-
value: hashTable?.id ?? hashTable,
|
|
5816
|
-
},
|
|
5817
|
-
{
|
|
5818
|
-
type: { type: "callback" },
|
|
5819
|
-
value: predicate,
|
|
5820
|
-
},
|
|
5821
|
-
{
|
|
5822
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
5823
|
-
value: userData,
|
|
5824
|
-
optional: true,
|
|
5825
|
-
},
|
|
5826
|
-
], { type: "int", size: 64, unsigned: true });
|
|
5827
|
-
};
|
|
5828
|
-
/**
|
|
5829
|
-
* Calls the given function for each of the key/value pairs in the
|
|
5830
|
-
* #GHashTable. The function is passed the key and value of each
|
|
5831
|
-
* pair, and the given `user_data` parameter. The hash table may not
|
|
5832
|
-
* be modified while iterating over it (you can't add/remove
|
|
5833
|
-
* items). To remove all items matching a predicate, use
|
|
5834
|
-
* g_hash_table_foreach_remove().
|
|
5835
|
-
*
|
|
5836
|
-
* The order in which g_hash_table_foreach() iterates over the keys/values in
|
|
5837
|
-
* the hash table is not defined.
|
|
5838
|
-
*
|
|
5839
|
-
* See g_hash_table_find() for performance caveats for linear
|
|
5840
|
-
* order searches in contrast to g_hash_table_lookup().
|
|
5841
|
-
* @param hashTable - a #GHashTable
|
|
5842
|
-
* @param func - the function to call for each key/value pair
|
|
5843
|
-
* @param userData - user data to pass to the function
|
|
5844
|
-
*/
|
|
5845
|
-
export const hashTableForeach = (hashTable, func, userData) => {
|
|
5846
|
-
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_hash_table_foreach", [
|
|
5847
|
-
{
|
|
5848
|
-
type: {
|
|
5849
|
-
type: "boxed",
|
|
5850
|
-
borrowed: true,
|
|
5851
|
-
innerType: "GHashTable",
|
|
5852
|
-
lib: "libgobject-2.0.so.0,libglib-2.0.so.0",
|
|
5853
|
-
},
|
|
5854
|
-
value: hashTable?.id ?? hashTable,
|
|
5855
|
-
},
|
|
5856
|
-
{
|
|
5857
|
-
type: { type: "callback" },
|
|
5858
|
-
value: func,
|
|
5859
|
-
},
|
|
5860
|
-
{
|
|
5861
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
5862
|
-
value: userData,
|
|
5863
|
-
optional: true,
|
|
5864
|
-
},
|
|
5865
|
-
], { type: "undefined" });
|
|
5866
|
-
};
|
|
5867
|
-
/**
|
|
5868
|
-
* Calls the given function for each key/value pair in the
|
|
5869
|
-
* #GHashTable. If the function returns %TRUE, then the key/value
|
|
5870
|
-
* pair is removed from the #GHashTable. If you supplied key or
|
|
5871
|
-
* value destroy functions when creating the #GHashTable, they are
|
|
5872
|
-
* used to free the memory allocated for the removed keys and values.
|
|
5873
|
-
*
|
|
5874
|
-
* See #GHashTableIter for an alternative way to loop over the
|
|
5875
|
-
* key/value pairs in the hash table.
|
|
5876
|
-
* @param hashTable - a #GHashTable
|
|
5877
|
-
* @param func - the function to call for each key/value pair
|
|
5878
|
-
* @param userData - user data to pass to the function
|
|
5879
|
-
*/
|
|
5880
|
-
export const hashTableForeachRemove = (hashTable, func, userData) => {
|
|
5881
|
-
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_hash_table_foreach_remove", [
|
|
5882
|
-
{
|
|
5883
|
-
type: {
|
|
5884
|
-
type: "boxed",
|
|
5885
|
-
borrowed: true,
|
|
5886
|
-
innerType: "GHashTable",
|
|
5887
|
-
lib: "libgobject-2.0.so.0,libglib-2.0.so.0",
|
|
5888
|
-
},
|
|
5889
|
-
value: hashTable?.id ?? hashTable,
|
|
5890
|
-
},
|
|
5891
|
-
{
|
|
5892
|
-
type: { type: "callback" },
|
|
5893
|
-
value: func,
|
|
5894
|
-
},
|
|
5895
|
-
{
|
|
5896
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
5897
|
-
value: userData,
|
|
5898
|
-
optional: true,
|
|
5899
|
-
},
|
|
5900
|
-
], { type: "int", size: 32, unsigned: true });
|
|
5901
|
-
};
|
|
5902
|
-
/**
|
|
5903
|
-
* Calls the given function for each key/value pair in the
|
|
5904
|
-
* #GHashTable. If the function returns %TRUE, then the key/value
|
|
5905
|
-
* pair is removed from the #GHashTable, but no key or value
|
|
5906
|
-
* destroy functions are called.
|
|
5907
|
-
*
|
|
5908
|
-
* See #GHashTableIter for an alternative way to loop over the
|
|
5909
|
-
* key/value pairs in the hash table.
|
|
5910
|
-
* @param hashTable - a #GHashTable
|
|
5911
|
-
* @param func - the function to call for each key/value pair
|
|
5912
|
-
* @param userData - user data to pass to the function
|
|
5913
|
-
*/
|
|
5914
|
-
export const hashTableForeachSteal = (hashTable, func, userData) => {
|
|
5915
|
-
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_hash_table_foreach_steal", [
|
|
5916
|
-
{
|
|
5917
|
-
type: {
|
|
5918
|
-
type: "boxed",
|
|
5919
|
-
borrowed: true,
|
|
5920
|
-
innerType: "GHashTable",
|
|
5921
|
-
lib: "libgobject-2.0.so.0,libglib-2.0.so.0",
|
|
5922
|
-
},
|
|
5923
|
-
value: hashTable?.id ?? hashTable,
|
|
5924
|
-
},
|
|
5925
|
-
{
|
|
5926
|
-
type: { type: "callback" },
|
|
5927
|
-
value: func,
|
|
5928
|
-
},
|
|
5929
|
-
{
|
|
5930
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
5931
|
-
value: userData,
|
|
5932
|
-
optional: true,
|
|
5933
|
-
},
|
|
5934
|
-
], { type: "int", size: 32, unsigned: true });
|
|
5935
|
-
};
|
|
5936
5484
|
/**
|
|
5937
5485
|
* Inserts a new key and value into a #GHashTable.
|
|
5938
5486
|
*
|
|
@@ -6401,28 +5949,6 @@ export const hookInsertBefore = (hookList, hook, sibling) => {
|
|
|
6401
5949
|
},
|
|
6402
5950
|
], { type: "undefined" });
|
|
6403
5951
|
};
|
|
6404
|
-
/**
|
|
6405
|
-
* Inserts a #GHook into a #GHookList, sorted by the given function.
|
|
6406
|
-
* @param hookList - a #GHookList
|
|
6407
|
-
* @param hook - the #GHook to insert
|
|
6408
|
-
* @param func - the comparison function used to sort the #GHook elements
|
|
6409
|
-
*/
|
|
6410
|
-
export const hookInsertSorted = (hookList, hook, func) => {
|
|
6411
|
-
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_hook_insert_sorted", [
|
|
6412
|
-
{
|
|
6413
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
6414
|
-
value: hookList,
|
|
6415
|
-
},
|
|
6416
|
-
{
|
|
6417
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
6418
|
-
value: hook,
|
|
6419
|
-
},
|
|
6420
|
-
{
|
|
6421
|
-
type: { type: "callback" },
|
|
6422
|
-
value: func,
|
|
6423
|
-
},
|
|
6424
|
-
], { type: "undefined" });
|
|
6425
|
-
};
|
|
6426
5952
|
/**
|
|
6427
5953
|
* Prepends a #GHook on the start of a #GHookList.
|
|
6428
5954
|
* @param hookList - a #GHookList
|
|
@@ -6544,40 +6070,8 @@ export const hostnameToUnicode = (hostname) => {
|
|
|
6544
6070
|
], { type: "string" });
|
|
6545
6071
|
};
|
|
6546
6072
|
/**
|
|
6547
|
-
*
|
|
6548
|
-
*
|
|
6549
|
-
*
|
|
6550
|
-
* If the function returns [const@GLib.SOURCE_REMOVE] it is automatically
|
|
6551
|
-
* removed from the list of event sources and will not be called again.
|
|
6552
|
-
*
|
|
6553
|
-
* See main loop memory management for details
|
|
6554
|
-
* on how to handle the return value and memory management of @data.
|
|
6555
|
-
*
|
|
6556
|
-
* This internally creates a main loop source using [func@GLib.idle_source_new]
|
|
6557
|
-
* and attaches it to the global [struct@GLib.MainContext] using
|
|
6558
|
-
* [method@GLib.Source.attach], so the callback will be invoked in whichever
|
|
6559
|
-
* thread is running that main context. You can do these steps manually if you
|
|
6560
|
-
* need greater control or to use a custom main context.
|
|
6561
|
-
* @param priority - the priority of the idle source; typically this will be in the
|
|
6562
|
-
* @param _function - function to call
|
|
6563
|
-
* @param data - data to pass to @function
|
|
6564
|
-
* @param notify - function to call when the idle is removed
|
|
6565
|
-
*/
|
|
6566
|
-
export const idleAddFull = (priority, _function) => {
|
|
6567
|
-
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_idle_add_full", [
|
|
6568
|
-
{
|
|
6569
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
6570
|
-
value: priority,
|
|
6571
|
-
},
|
|
6572
|
-
{
|
|
6573
|
-
type: { type: "callback", trampoline: "sourceFunc" },
|
|
6574
|
-
value: _function,
|
|
6575
|
-
},
|
|
6576
|
-
], { type: "int", size: 32, unsigned: true });
|
|
6577
|
-
};
|
|
6578
|
-
/**
|
|
6579
|
-
* Removes the idle function with the given data.
|
|
6580
|
-
* @param data - the data for the idle source’s callback.
|
|
6073
|
+
* Removes the idle function with the given data.
|
|
6074
|
+
* @param data - the data for the idle source’s callback.
|
|
6581
6075
|
*/
|
|
6582
6076
|
export const idleRemoveByData = (data) => {
|
|
6583
6077
|
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_idle_remove_by_data", [
|
|
@@ -6724,54 +6218,6 @@ export const internString = (string) => {
|
|
|
6724
6218
|
},
|
|
6725
6219
|
], { type: "string", borrowed: true });
|
|
6726
6220
|
};
|
|
6727
|
-
/**
|
|
6728
|
-
* Adds the #GIOChannel into the default main loop context
|
|
6729
|
-
* with the given priority.
|
|
6730
|
-
*
|
|
6731
|
-
* This internally creates a main loop source using g_io_create_watch()
|
|
6732
|
-
* and attaches it to the main loop context with g_source_attach().
|
|
6733
|
-
* You can do these steps manually if you need greater control.
|
|
6734
|
-
* @param channel - a #GIOChannel
|
|
6735
|
-
* @param priority - the priority of the #GIOChannel source
|
|
6736
|
-
* @param condition - the condition to watch for
|
|
6737
|
-
* @param func - the function to call when the condition is satisfied
|
|
6738
|
-
* @param userData - user data to pass to @func
|
|
6739
|
-
* @param notify - the function to call when the source is removed
|
|
6740
|
-
*/
|
|
6741
|
-
export const ioAddWatchFull = (channel, priority, condition, func, notify, userData) => {
|
|
6742
|
-
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_io_add_watch_full", [
|
|
6743
|
-
{
|
|
6744
|
-
type: {
|
|
6745
|
-
type: "boxed",
|
|
6746
|
-
borrowed: true,
|
|
6747
|
-
innerType: "GIOChannel",
|
|
6748
|
-
lib: "libgobject-2.0.so.0,libglib-2.0.so.0",
|
|
6749
|
-
},
|
|
6750
|
-
value: channel?.id ?? channel,
|
|
6751
|
-
},
|
|
6752
|
-
{
|
|
6753
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
6754
|
-
value: priority,
|
|
6755
|
-
},
|
|
6756
|
-
{
|
|
6757
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
6758
|
-
value: condition,
|
|
6759
|
-
},
|
|
6760
|
-
{
|
|
6761
|
-
type: { type: "callback" },
|
|
6762
|
-
value: func,
|
|
6763
|
-
},
|
|
6764
|
-
{
|
|
6765
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
6766
|
-
value: userData,
|
|
6767
|
-
optional: true,
|
|
6768
|
-
},
|
|
6769
|
-
{
|
|
6770
|
-
type: { type: "callback", trampoline: "destroy" },
|
|
6771
|
-
value: notify,
|
|
6772
|
-
},
|
|
6773
|
-
], { type: "int", size: 32, unsigned: true });
|
|
6774
|
-
};
|
|
6775
6221
|
/**
|
|
6776
6222
|
* Converts an `errno` error number to a #GIOChannelError.
|
|
6777
6223
|
* @param en - an `errno` error number, e.g. `EINVAL`
|
|
@@ -7186,79 +6632,6 @@ export const logSetFatalMask = (logDomain, fatalMask) => {
|
|
|
7186
6632
|
},
|
|
7187
6633
|
], { type: "int", size: 32, unsigned: false });
|
|
7188
6634
|
};
|
|
7189
|
-
/**
|
|
7190
|
-
* Like [func@GLib.log_set_handler], but takes a destroy notify for the @user_data.
|
|
7191
|
-
*
|
|
7192
|
-
* This has no effect if structured logging is enabled; see
|
|
7193
|
-
* Using Structured Logging.
|
|
7194
|
-
*
|
|
7195
|
-
* The `log_domain` parameter can be set to `NULL` or an empty string to use the default
|
|
7196
|
-
* application domain.
|
|
7197
|
-
* @param logDomain - the log domain
|
|
7198
|
-
* @param logLevels - the log levels to apply the log handler for.
|
|
7199
|
-
* @param logFunc - the log handler function
|
|
7200
|
-
* @param userData - data passed to the log handler
|
|
7201
|
-
* @param destroy - destroy notify for @user_data, or `NULL`
|
|
7202
|
-
*/
|
|
7203
|
-
export const logSetHandlerFull = (logLevels, logFunc, destroy, logDomain, userData) => {
|
|
7204
|
-
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_log_set_handler_full", [
|
|
7205
|
-
{
|
|
7206
|
-
type: { type: "string" },
|
|
7207
|
-
value: logDomain,
|
|
7208
|
-
optional: true,
|
|
7209
|
-
},
|
|
7210
|
-
{
|
|
7211
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
7212
|
-
value: logLevels,
|
|
7213
|
-
},
|
|
7214
|
-
{
|
|
7215
|
-
type: { type: "callback" },
|
|
7216
|
-
value: logFunc,
|
|
7217
|
-
},
|
|
7218
|
-
{
|
|
7219
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
7220
|
-
value: userData,
|
|
7221
|
-
optional: true,
|
|
7222
|
-
},
|
|
7223
|
-
{
|
|
7224
|
-
type: { type: "callback", trampoline: "destroy" },
|
|
7225
|
-
value: destroy,
|
|
7226
|
-
},
|
|
7227
|
-
], { type: "int", size: 32, unsigned: true });
|
|
7228
|
-
};
|
|
7229
|
-
/**
|
|
7230
|
-
* Set a writer function which will be called to format and write out each log
|
|
7231
|
-
* message.
|
|
7232
|
-
*
|
|
7233
|
-
* Each program should set a writer function, or the default writer
|
|
7234
|
-
* ([func@GLib.log_writer_default]) will be used.
|
|
7235
|
-
*
|
|
7236
|
-
* Libraries **must not** call this function — only programs are allowed to
|
|
7237
|
-
* install a writer function, as there must be a single, central point where
|
|
7238
|
-
* log messages are formatted and outputted.
|
|
7239
|
-
*
|
|
7240
|
-
* There can only be one writer function. It is an error to set more than one.
|
|
7241
|
-
* @param func - log writer function, which must not be `NULL`
|
|
7242
|
-
* @param userData - user data to pass to @func
|
|
7243
|
-
* @param userDataFree - function to free `user_data` once it’s
|
|
7244
|
-
*/
|
|
7245
|
-
export const logSetWriterFunc = (func, userDataFree, userData) => {
|
|
7246
|
-
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_log_set_writer_func", [
|
|
7247
|
-
{
|
|
7248
|
-
type: { type: "callback" },
|
|
7249
|
-
value: func,
|
|
7250
|
-
},
|
|
7251
|
-
{
|
|
7252
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
7253
|
-
value: userData,
|
|
7254
|
-
optional: true,
|
|
7255
|
-
},
|
|
7256
|
-
{
|
|
7257
|
-
type: { type: "callback", trampoline: "destroy" },
|
|
7258
|
-
value: userDataFree,
|
|
7259
|
-
},
|
|
7260
|
-
], { type: "undefined" });
|
|
7261
|
-
};
|
|
7262
6635
|
/**
|
|
7263
6636
|
* Log a message with structured data.
|
|
7264
6637
|
*
|
|
@@ -8839,45 +8212,6 @@ export const propagateError = (src, dest) => {
|
|
|
8839
8212
|
if (dest)
|
|
8840
8213
|
dest.value = getBoxed(dest.value, GError);
|
|
8841
8214
|
};
|
|
8842
|
-
/**
|
|
8843
|
-
* This is just like the standard C [`qsort()`](man:qsort(3)) function, but
|
|
8844
|
-
* the comparison routine accepts a user data argument
|
|
8845
|
-
* (like [`qsort_r()`](man:qsort_r(3))).
|
|
8846
|
-
*
|
|
8847
|
-
* Unlike `qsort()`, this is guaranteed to be a stable sort (since GLib 2.32).
|
|
8848
|
-
* @param pbase - start of array to sort
|
|
8849
|
-
* @param totalElems - elements in the array
|
|
8850
|
-
* @param size - size of each element
|
|
8851
|
-
* @param compareFunc - function to compare elements
|
|
8852
|
-
* @param userData - data to pass to @compare_func
|
|
8853
|
-
*/
|
|
8854
|
-
export const qsortWithData = (pbase, totalElems, size, compareFunc) => {
|
|
8855
|
-
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_qsort_with_data", [
|
|
8856
|
-
{
|
|
8857
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
8858
|
-
value: pbase,
|
|
8859
|
-
},
|
|
8860
|
-
{
|
|
8861
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
8862
|
-
value: totalElems,
|
|
8863
|
-
},
|
|
8864
|
-
{
|
|
8865
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
8866
|
-
value: size,
|
|
8867
|
-
},
|
|
8868
|
-
{
|
|
8869
|
-
type: {
|
|
8870
|
-
type: "callback",
|
|
8871
|
-
trampoline: "compareDataFunc",
|
|
8872
|
-
argTypes: [
|
|
8873
|
-
{ type: "gobject", borrowed: true },
|
|
8874
|
-
{ type: "gobject", borrowed: true },
|
|
8875
|
-
],
|
|
8876
|
-
},
|
|
8877
|
-
value: compareFunc,
|
|
8878
|
-
},
|
|
8879
|
-
], { type: "undefined" });
|
|
8880
|
-
};
|
|
8881
8215
|
/**
|
|
8882
8216
|
* Gets the #GQuark identifying the given (static) string. If the
|
|
8883
8217
|
* string does not currently have an associated #GQuark, a new #GQuark
|
|
@@ -9622,36 +8956,6 @@ export const rmdir = (filename) => {
|
|
|
9622
8956
|
},
|
|
9623
8957
|
], { type: "int", size: 32, unsigned: false });
|
|
9624
8958
|
};
|
|
9625
|
-
/**
|
|
9626
|
-
* Calls `func` for each item in the range (@begin, @end) passing
|
|
9627
|
-
* `user_data` to the function. `func` must not modify the sequence
|
|
9628
|
-
* itself.
|
|
9629
|
-
* @param begin - a #GSequenceIter
|
|
9630
|
-
* @param end - a #GSequenceIter
|
|
9631
|
-
* @param func - a #GFunc
|
|
9632
|
-
* @param userData - user data passed to @func
|
|
9633
|
-
*/
|
|
9634
|
-
export const sequenceForeachRange = (begin, end, func, userData) => {
|
|
9635
|
-
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_sequence_foreach_range", [
|
|
9636
|
-
{
|
|
9637
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
9638
|
-
value: begin,
|
|
9639
|
-
},
|
|
9640
|
-
{
|
|
9641
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
9642
|
-
value: end,
|
|
9643
|
-
},
|
|
9644
|
-
{
|
|
9645
|
-
type: { type: "callback" },
|
|
9646
|
-
value: func,
|
|
9647
|
-
},
|
|
9648
|
-
{
|
|
9649
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
9650
|
-
value: userData,
|
|
9651
|
-
optional: true,
|
|
9652
|
-
},
|
|
9653
|
-
], { type: "undefined" });
|
|
9654
|
-
};
|
|
9655
8959
|
/**
|
|
9656
8960
|
* Returns the data that `iter` points to.
|
|
9657
8961
|
* @param iter - a #GSequenceIter
|
|
@@ -9809,70 +9113,6 @@ export const sequenceSet = (iter, data) => {
|
|
|
9809
9113
|
},
|
|
9810
9114
|
], { type: "undefined" });
|
|
9811
9115
|
};
|
|
9812
|
-
/**
|
|
9813
|
-
* Moves the data pointed to by `iter` to a new position as indicated by
|
|
9814
|
-
* @cmp_func. This
|
|
9815
|
-
* function should be called for items in a sequence already sorted according
|
|
9816
|
-
* to `cmp_func` whenever some aspect of an item changes so that `cmp_func` may return different values for that item.
|
|
9817
|
-
*
|
|
9818
|
-
* `cmp_func` is called with two items of the @seq, and @cmp_data.
|
|
9819
|
-
* It should return 0 if the items are equal, a negative value if
|
|
9820
|
-
* the first item comes before the second, and a positive value if
|
|
9821
|
-
* the second item comes before the first.
|
|
9822
|
-
* @param iter - A #GSequenceIter
|
|
9823
|
-
* @param cmpFunc - the function used to compare items in the sequence
|
|
9824
|
-
* @param cmpData - user data passed to @cmp_func.
|
|
9825
|
-
*/
|
|
9826
|
-
export const sequenceSortChanged = (iter, cmpFunc) => {
|
|
9827
|
-
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_sequence_sort_changed", [
|
|
9828
|
-
{
|
|
9829
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
9830
|
-
value: iter,
|
|
9831
|
-
},
|
|
9832
|
-
{
|
|
9833
|
-
type: {
|
|
9834
|
-
type: "callback",
|
|
9835
|
-
trampoline: "compareDataFunc",
|
|
9836
|
-
argTypes: [
|
|
9837
|
-
{ type: "gobject", borrowed: true },
|
|
9838
|
-
{ type: "gobject", borrowed: true },
|
|
9839
|
-
],
|
|
9840
|
-
},
|
|
9841
|
-
value: cmpFunc,
|
|
9842
|
-
},
|
|
9843
|
-
], { type: "undefined" });
|
|
9844
|
-
};
|
|
9845
|
-
/**
|
|
9846
|
-
* Like g_sequence_sort_changed(), but uses
|
|
9847
|
-
* a #GSequenceIterCompareFunc instead of a #GCompareDataFunc as
|
|
9848
|
-
* the compare function.
|
|
9849
|
-
*
|
|
9850
|
-
* `iter_cmp` is called with two iterators pointing into the #GSequence that
|
|
9851
|
-
* `iter` points into. It should
|
|
9852
|
-
* return 0 if the iterators are equal, a negative value if the first
|
|
9853
|
-
* iterator comes before the second, and a positive value if the second
|
|
9854
|
-
* iterator comes before the first.
|
|
9855
|
-
* @param iter - a #GSequenceIter
|
|
9856
|
-
* @param iterCmp - the function used to compare iterators in the sequence
|
|
9857
|
-
* @param cmpData - user data passed to @cmp_func
|
|
9858
|
-
*/
|
|
9859
|
-
export const sequenceSortChangedIter = (iter, iterCmp, cmpData) => {
|
|
9860
|
-
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_sequence_sort_changed_iter", [
|
|
9861
|
-
{
|
|
9862
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
9863
|
-
value: iter,
|
|
9864
|
-
},
|
|
9865
|
-
{
|
|
9866
|
-
type: { type: "callback" },
|
|
9867
|
-
value: iterCmp,
|
|
9868
|
-
},
|
|
9869
|
-
{
|
|
9870
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
9871
|
-
value: cmpData,
|
|
9872
|
-
optional: true,
|
|
9873
|
-
},
|
|
9874
|
-
], { type: "undefined" });
|
|
9875
|
-
};
|
|
9876
9116
|
/**
|
|
9877
9117
|
* Swaps the items pointed to by `a` and @b. It is allowed for `a` and `b` to point into difference sequences.
|
|
9878
9118
|
* @param a - a #GSequenceIter
|
|
@@ -10465,69 +9705,22 @@ export const spacedPrimesClosest = (num) => {
|
|
|
10465
9705
|
], { type: "int", size: 32, unsigned: true });
|
|
10466
9706
|
};
|
|
10467
9707
|
/**
|
|
10468
|
-
*
|
|
10469
|
-
*
|
|
10470
|
-
* See g_spawn_async_with_pipes_and_fds() for a full description; this function
|
|
10471
|
-
* simply calls the g_spawn_async_with_pipes() without any pipes, which in turn
|
|
10472
|
-
* calls g_spawn_async_with_pipes_and_fds().
|
|
10473
|
-
*
|
|
10474
|
-
* You should call g_spawn_close_pid() on the returned child process
|
|
10475
|
-
* reference when you don't need it any more.
|
|
10476
|
-
*
|
|
10477
|
-
* If you are writing a GTK application, and the program you are spawning is a
|
|
10478
|
-
* graphical application too, then to ensure that the spawned program opens its
|
|
10479
|
-
* windows on the right screen, you may want to use #GdkAppLaunchContext,
|
|
10480
|
-
* #GAppLaunchContext, or set the %DISPLAY environment variable.
|
|
9708
|
+
* An old name for g_spawn_check_wait_status(), deprecated because its
|
|
9709
|
+
* name is misleading.
|
|
10481
9710
|
*
|
|
10482
|
-
*
|
|
10483
|
-
*
|
|
10484
|
-
*
|
|
10485
|
-
*
|
|
10486
|
-
*
|
|
10487
|
-
* @param
|
|
10488
|
-
* @param flags - flags from #GSpawnFlags
|
|
10489
|
-
* @param childSetup - function to run
|
|
10490
|
-
* @param userData - user data for @child_setup
|
|
10491
|
-
* @param childPid - return location for child process reference, or %NULL
|
|
9711
|
+
* Despite the name of the function, `wait_status` must be the wait status
|
|
9712
|
+
* as returned by g_spawn_sync(), g_subprocess_get_status(), `waitpid()`,
|
|
9713
|
+
* etc. On Unix platforms, it is incorrect for it to be the exit status
|
|
9714
|
+
* as passed to `exit()` or returned by g_subprocess_get_exit_status() or
|
|
9715
|
+
* `WEXITSTATUS()`.
|
|
9716
|
+
* @param waitStatus - A status as returned from g_spawn_sync()
|
|
10492
9717
|
*/
|
|
10493
|
-
export const
|
|
9718
|
+
export const spawnCheckExitStatus = (waitStatus) => {
|
|
10494
9719
|
const error = { value: null };
|
|
10495
|
-
const result = call("libgobject-2.0.so.0,libglib-2.0.so.0", "
|
|
10496
|
-
{
|
|
10497
|
-
type: { type: "string" },
|
|
10498
|
-
value: workingDirectory,
|
|
10499
|
-
optional: true,
|
|
10500
|
-
},
|
|
10501
|
-
{
|
|
10502
|
-
type: { type: "array", itemType: { type: "string" } },
|
|
10503
|
-
value: argv,
|
|
10504
|
-
},
|
|
10505
|
-
{
|
|
10506
|
-
type: { type: "array", itemType: { type: "string" } },
|
|
10507
|
-
value: envp,
|
|
10508
|
-
optional: true,
|
|
10509
|
-
},
|
|
9720
|
+
const result = call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_spawn_check_exit_status", [
|
|
10510
9721
|
{
|
|
10511
9722
|
type: { type: "int", size: 32, unsigned: false },
|
|
10512
|
-
value:
|
|
10513
|
-
},
|
|
10514
|
-
{
|
|
10515
|
-
type: { type: "callback" },
|
|
10516
|
-
value: childSetup,
|
|
10517
|
-
optional: true,
|
|
10518
|
-
},
|
|
10519
|
-
{
|
|
10520
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
10521
|
-
value: userData,
|
|
10522
|
-
optional: true,
|
|
10523
|
-
},
|
|
10524
|
-
{
|
|
10525
|
-
type: {
|
|
10526
|
-
type: "ref",
|
|
10527
|
-
innerType: { type: "int", size: 32, unsigned: false },
|
|
10528
|
-
},
|
|
10529
|
-
value: childPid,
|
|
10530
|
-
optional: true,
|
|
9723
|
+
value: waitStatus,
|
|
10531
9724
|
},
|
|
10532
9725
|
{
|
|
10533
9726
|
type: {
|
|
@@ -10547,587 +9740,53 @@ export const spawnAsync = (argv, flags, workingDirectory, envp, childSetup, user
|
|
|
10547
9740
|
return result;
|
|
10548
9741
|
};
|
|
10549
9742
|
/**
|
|
10550
|
-
*
|
|
9743
|
+
* Set `error` if `wait_status` indicates the child exited abnormally
|
|
9744
|
+
* (e.g. with a nonzero exit code, or via a fatal signal).
|
|
9745
|
+
*
|
|
9746
|
+
* The g_spawn_sync() and g_child_watch_add() family of APIs return the
|
|
9747
|
+
* status of subprocesses encoded in a platform-specific way.
|
|
9748
|
+
* On Unix, this is guaranteed to be in the same format waitpid() returns,
|
|
9749
|
+
* and on Windows it is guaranteed to be the result of GetExitCodeProcess().
|
|
9750
|
+
*
|
|
9751
|
+
* Prior to the introduction of this function in GLib 2.34, interpreting
|
|
9752
|
+
* `wait_status` required use of platform-specific APIs, which is problematic
|
|
9753
|
+
* for software using GLib as a cross-platform layer.
|
|
9754
|
+
*
|
|
9755
|
+
* Additionally, many programs simply want to determine whether or not
|
|
9756
|
+
* the child exited successfully, and either propagate a #GError or
|
|
9757
|
+
* print a message to standard error. In that common case, this function
|
|
9758
|
+
* can be used. Note that the error message in `error` will contain
|
|
9759
|
+
* human-readable information about the wait status.
|
|
9760
|
+
*
|
|
9761
|
+
* The `domain` and `code` of `error` have special semantics in the case
|
|
9762
|
+
* where the process has an "exit code", as opposed to being killed by
|
|
9763
|
+
* a signal. On Unix, this happens if WIFEXITED() would be true of
|
|
9764
|
+
* @wait_status. On Windows, it is always the case.
|
|
9765
|
+
*
|
|
9766
|
+
* The special semantics are that the actual exit code will be the
|
|
9767
|
+
* code set in @error, and the domain will be %G_SPAWN_EXIT_ERROR.
|
|
9768
|
+
* This allows you to differentiate between different exit codes.
|
|
9769
|
+
*
|
|
9770
|
+
* If the process was terminated by some means other than an exit
|
|
9771
|
+
* status (for example if it was killed by a signal), the domain will be
|
|
9772
|
+
* %G_SPAWN_ERROR and the code will be %G_SPAWN_ERROR_FAILED.
|
|
9773
|
+
*
|
|
9774
|
+
* This function just offers convenience; you can of course also check
|
|
9775
|
+
* the available platform via a macro such as %G_OS_UNIX, and use
|
|
9776
|
+
* WIFEXITED() and WEXITSTATUS() on `wait_status` directly. Do not attempt
|
|
9777
|
+
* to scan or parse the error message string; it may be translated and/or
|
|
9778
|
+
* change in future versions of GLib.
|
|
10551
9779
|
*
|
|
10552
|
-
*
|
|
10553
|
-
*
|
|
10554
|
-
* @param
|
|
10555
|
-
* @param argv - child's argument vector, in the GLib file name encoding;
|
|
10556
|
-
* @param envp - child's environment, or %NULL to inherit parent's, in the GLib file name encoding
|
|
10557
|
-
* @param flags - flags from #GSpawnFlags
|
|
10558
|
-
* @param childSetup - function to run
|
|
10559
|
-
* @param userData - user data for @child_setup
|
|
10560
|
-
* @param childPid - return location for child process ID, or %NULL
|
|
10561
|
-
* @param stdinFd - file descriptor to use for child's stdin, or `-1`
|
|
10562
|
-
* @param stdoutFd - file descriptor to use for child's stdout, or `-1`
|
|
10563
|
-
* @param stderrFd - file descriptor to use for child's stderr, or `-1`
|
|
9780
|
+
* Prior to version 2.70, g_spawn_check_exit_status() provides the same
|
|
9781
|
+
* functionality, although under a misleading name.
|
|
9782
|
+
* @param waitStatus - A platform-specific wait status as returned from g_spawn_sync()
|
|
10564
9783
|
*/
|
|
10565
|
-
export const
|
|
9784
|
+
export const spawnCheckWaitStatus = (waitStatus) => {
|
|
10566
9785
|
const error = { value: null };
|
|
10567
|
-
const result = call("libgobject-2.0.so.0,libglib-2.0.so.0", "
|
|
10568
|
-
{
|
|
10569
|
-
type: { type: "string" },
|
|
10570
|
-
value: workingDirectory,
|
|
10571
|
-
optional: true,
|
|
10572
|
-
},
|
|
10573
|
-
{
|
|
10574
|
-
type: { type: "array", itemType: { type: "string" } },
|
|
10575
|
-
value: argv,
|
|
10576
|
-
},
|
|
10577
|
-
{
|
|
10578
|
-
type: { type: "array", itemType: { type: "string" } },
|
|
10579
|
-
value: envp,
|
|
10580
|
-
optional: true,
|
|
10581
|
-
},
|
|
9786
|
+
const result = call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_spawn_check_wait_status", [
|
|
10582
9787
|
{
|
|
10583
9788
|
type: { type: "int", size: 32, unsigned: false },
|
|
10584
|
-
value:
|
|
10585
|
-
},
|
|
10586
|
-
{
|
|
10587
|
-
type: { type: "callback" },
|
|
10588
|
-
value: childSetup,
|
|
10589
|
-
optional: true,
|
|
10590
|
-
},
|
|
10591
|
-
{
|
|
10592
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
10593
|
-
value: userData,
|
|
10594
|
-
optional: true,
|
|
10595
|
-
},
|
|
10596
|
-
{
|
|
10597
|
-
type: {
|
|
10598
|
-
type: "ref",
|
|
10599
|
-
innerType: { type: "int", size: 32, unsigned: false },
|
|
10600
|
-
},
|
|
10601
|
-
value: childPid,
|
|
10602
|
-
optional: true,
|
|
10603
|
-
},
|
|
10604
|
-
{
|
|
10605
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
10606
|
-
value: stdinFd,
|
|
10607
|
-
},
|
|
10608
|
-
{
|
|
10609
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
10610
|
-
value: stdoutFd,
|
|
10611
|
-
},
|
|
10612
|
-
{
|
|
10613
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
10614
|
-
value: stderrFd,
|
|
10615
|
-
},
|
|
10616
|
-
{
|
|
10617
|
-
type: {
|
|
10618
|
-
type: "ref",
|
|
10619
|
-
innerType: {
|
|
10620
|
-
type: "boxed",
|
|
10621
|
-
innerType: "GError",
|
|
10622
|
-
lib: "libglib-2.0.so.0",
|
|
10623
|
-
},
|
|
10624
|
-
},
|
|
10625
|
-
value: error,
|
|
10626
|
-
},
|
|
10627
|
-
], { type: "boolean" });
|
|
10628
|
-
if (error.value !== null) {
|
|
10629
|
-
throw new NativeError(error.value);
|
|
10630
|
-
}
|
|
10631
|
-
return result;
|
|
10632
|
-
};
|
|
10633
|
-
/**
|
|
10634
|
-
* Identical to g_spawn_async_with_pipes_and_fds() but with `n_fds` set to zero,
|
|
10635
|
-
* so no FD assignments are used.
|
|
10636
|
-
* @param workingDirectory - child's current working
|
|
10637
|
-
* @param argv - child's argument
|
|
10638
|
-
* @param envp - child's environment, or %NULL to inherit parent's, in the GLib file
|
|
10639
|
-
* @param flags - flags from #GSpawnFlags
|
|
10640
|
-
* @param childSetup - function to run
|
|
10641
|
-
* @param userData - user data for @child_setup
|
|
10642
|
-
* @param childPid - return location for child process ID, or %NULL
|
|
10643
|
-
* @param standardInput - return location for file descriptor to write to child's stdin, or %NULL
|
|
10644
|
-
* @param standardOutput - return location for file descriptor to read child's stdout, or %NULL
|
|
10645
|
-
* @param standardError - return location for file descriptor to read child's stderr, or %NULL
|
|
10646
|
-
*/
|
|
10647
|
-
export const spawnAsyncWithPipes = (argv, flags, workingDirectory, envp, childSetup, userData, childPid, standardInput, standardOutput, standardError) => {
|
|
10648
|
-
const error = { value: null };
|
|
10649
|
-
const result = call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_spawn_async_with_pipes", [
|
|
10650
|
-
{
|
|
10651
|
-
type: { type: "string" },
|
|
10652
|
-
value: workingDirectory,
|
|
10653
|
-
optional: true,
|
|
10654
|
-
},
|
|
10655
|
-
{
|
|
10656
|
-
type: { type: "array", itemType: { type: "string" } },
|
|
10657
|
-
value: argv,
|
|
10658
|
-
},
|
|
10659
|
-
{
|
|
10660
|
-
type: { type: "array", itemType: { type: "string" } },
|
|
10661
|
-
value: envp,
|
|
10662
|
-
optional: true,
|
|
10663
|
-
},
|
|
10664
|
-
{
|
|
10665
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
10666
|
-
value: flags,
|
|
10667
|
-
},
|
|
10668
|
-
{
|
|
10669
|
-
type: { type: "callback" },
|
|
10670
|
-
value: childSetup,
|
|
10671
|
-
optional: true,
|
|
10672
|
-
},
|
|
10673
|
-
{
|
|
10674
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
10675
|
-
value: userData,
|
|
10676
|
-
optional: true,
|
|
10677
|
-
},
|
|
10678
|
-
{
|
|
10679
|
-
type: {
|
|
10680
|
-
type: "ref",
|
|
10681
|
-
innerType: { type: "int", size: 32, unsigned: false },
|
|
10682
|
-
},
|
|
10683
|
-
value: childPid,
|
|
10684
|
-
optional: true,
|
|
10685
|
-
},
|
|
10686
|
-
{
|
|
10687
|
-
type: {
|
|
10688
|
-
type: "ref",
|
|
10689
|
-
innerType: { type: "int", size: 32, unsigned: false },
|
|
10690
|
-
},
|
|
10691
|
-
value: standardInput,
|
|
10692
|
-
optional: true,
|
|
10693
|
-
},
|
|
10694
|
-
{
|
|
10695
|
-
type: {
|
|
10696
|
-
type: "ref",
|
|
10697
|
-
innerType: { type: "int", size: 32, unsigned: false },
|
|
10698
|
-
},
|
|
10699
|
-
value: standardOutput,
|
|
10700
|
-
optional: true,
|
|
10701
|
-
},
|
|
10702
|
-
{
|
|
10703
|
-
type: {
|
|
10704
|
-
type: "ref",
|
|
10705
|
-
innerType: { type: "int", size: 32, unsigned: false },
|
|
10706
|
-
},
|
|
10707
|
-
value: standardError,
|
|
10708
|
-
optional: true,
|
|
10709
|
-
},
|
|
10710
|
-
{
|
|
10711
|
-
type: {
|
|
10712
|
-
type: "ref",
|
|
10713
|
-
innerType: {
|
|
10714
|
-
type: "boxed",
|
|
10715
|
-
innerType: "GError",
|
|
10716
|
-
lib: "libglib-2.0.so.0",
|
|
10717
|
-
},
|
|
10718
|
-
},
|
|
10719
|
-
value: error,
|
|
10720
|
-
},
|
|
10721
|
-
], { type: "boolean" });
|
|
10722
|
-
if (error.value !== null) {
|
|
10723
|
-
throw new NativeError(error.value);
|
|
10724
|
-
}
|
|
10725
|
-
return result;
|
|
10726
|
-
};
|
|
10727
|
-
/**
|
|
10728
|
-
* Executes a child program asynchronously (your program will not
|
|
10729
|
-
* block waiting for the child to exit).
|
|
10730
|
-
*
|
|
10731
|
-
* The child program is specified by the only argument that must be
|
|
10732
|
-
* provided, @argv. `argv` should be a %NULL-terminated array of strings,
|
|
10733
|
-
* to be passed as the argument vector for the child. The first string
|
|
10734
|
-
* in `argv` is of course the name of the program to execute. By default,
|
|
10735
|
-
* the name of the program must be a full path. If `flags` contains the
|
|
10736
|
-
* %G_SPAWN_SEARCH_PATH flag, the `PATH` environment variable is used to
|
|
10737
|
-
* search for the executable. If `flags` contains the
|
|
10738
|
-
* %G_SPAWN_SEARCH_PATH_FROM_ENVP flag, the `PATH` variable from `envp` is used to search for the executable. If both the
|
|
10739
|
-
* %G_SPAWN_SEARCH_PATH and %G_SPAWN_SEARCH_PATH_FROM_ENVP flags are
|
|
10740
|
-
* set, the `PATH` variable from `envp` takes precedence over the
|
|
10741
|
-
* environment variable.
|
|
10742
|
-
*
|
|
10743
|
-
* If the program name is not a full path and %G_SPAWN_SEARCH_PATH flag
|
|
10744
|
-
* is not used, then the program will be run from the current directory
|
|
10745
|
-
* (or @working_directory, if specified); this might be unexpected or even
|
|
10746
|
-
* dangerous in some cases when the current directory is world-writable.
|
|
10747
|
-
*
|
|
10748
|
-
* On Windows, note that all the string or string vector arguments to
|
|
10749
|
-
* this function and the other `g_spawn*()` functions are in UTF-8, the
|
|
10750
|
-
* GLib file name encoding. Unicode characters that are not part of
|
|
10751
|
-
* the system codepage passed in these arguments will be correctly
|
|
10752
|
-
* available in the spawned program only if it uses wide character API
|
|
10753
|
-
* to retrieve its command line. For C programs built with Microsoft's
|
|
10754
|
-
* tools it is enough to make the program have a `wmain()` instead of
|
|
10755
|
-
* `main()`. `wmain()` has a wide character argument vector as parameter.
|
|
10756
|
-
*
|
|
10757
|
-
* At least currently, mingw doesn't support `wmain()`, so if you use
|
|
10758
|
-
* mingw to develop the spawned program, it should call
|
|
10759
|
-
* g_win32_get_command_line() to get arguments in UTF-8.
|
|
10760
|
-
*
|
|
10761
|
-
* On Windows the low-level child process creation API `CreateProcess()`
|
|
10762
|
-
* doesn't use argument vectors, but a command line. The C runtime
|
|
10763
|
-
* library's `spawn*()` family of functions (which g_spawn_async_with_pipes()
|
|
10764
|
-
* eventually calls) paste the argument vector elements together into
|
|
10765
|
-
* a command line, and the C runtime startup code does a corresponding
|
|
10766
|
-
* reconstruction of an argument vector from the command line, to be
|
|
10767
|
-
* passed to `main()`. Complications arise when you have argument vector
|
|
10768
|
-
* elements that contain spaces or double quotes. The `spawn*()` functions
|
|
10769
|
-
* don't do any quoting or escaping, but on the other hand the startup
|
|
10770
|
-
* code does do unquoting and unescaping in order to enable receiving
|
|
10771
|
-
* arguments with embedded spaces or double quotes. To work around this
|
|
10772
|
-
* asymmetry, g_spawn_async_with_pipes() will do quoting and escaping on
|
|
10773
|
-
* argument vector elements that need it before calling the C runtime
|
|
10774
|
-
* `spawn()` function.
|
|
10775
|
-
*
|
|
10776
|
-
* The returned `child_pid` on Windows is a handle to the child
|
|
10777
|
-
* process, not its identifier. Process handles and process
|
|
10778
|
-
* identifiers are different concepts on Windows.
|
|
10779
|
-
*
|
|
10780
|
-
* `envp` is a %NULL-terminated array of strings, where each string
|
|
10781
|
-
* has the form `KEY=VALUE`. This will become the child's environment.
|
|
10782
|
-
* If `envp` is %NULL, the child inherits its parent's environment.
|
|
10783
|
-
*
|
|
10784
|
-
* `flags` should be the bitwise OR of any flags you want to affect the
|
|
10785
|
-
* function's behaviour. The %G_SPAWN_DO_NOT_REAP_CHILD means that the
|
|
10786
|
-
* child will not automatically be reaped; you must use a child watch
|
|
10787
|
-
* (g_child_watch_add()) to be notified about the death of the child process,
|
|
10788
|
-
* otherwise it will stay around as a zombie process until this process exits.
|
|
10789
|
-
* Eventually you must call g_spawn_close_pid() on the @child_pid, in order to
|
|
10790
|
-
* free resources which may be associated with the child process. (On Unix,
|
|
10791
|
-
* using a child watch is equivalent to calling waitpid() or handling
|
|
10792
|
-
* the `SIGCHLD` signal manually. On Windows, calling g_spawn_close_pid()
|
|
10793
|
-
* is equivalent to calling `CloseHandle()` on the process handle returned
|
|
10794
|
-
* in @child_pid). See g_child_watch_add().
|
|
10795
|
-
*
|
|
10796
|
-
* Open UNIX file descriptors marked as `FD_CLOEXEC` will be automatically
|
|
10797
|
-
* closed in the child process. %G_SPAWN_LEAVE_DESCRIPTORS_OPEN means that
|
|
10798
|
-
* other open file descriptors will be inherited by the child; otherwise all
|
|
10799
|
-
* descriptors except stdin/stdout/stderr will be closed before calling `exec()`
|
|
10800
|
-
* in the child. %G_SPAWN_SEARCH_PATH means that @argv[0] need not be an
|
|
10801
|
-
* absolute path, it will be looked for in the `PATH` environment
|
|
10802
|
-
* variable. %G_SPAWN_SEARCH_PATH_FROM_ENVP means need not be an
|
|
10803
|
-
* absolute path, it will be looked for in the `PATH` variable from
|
|
10804
|
-
* @envp. If both %G_SPAWN_SEARCH_PATH and %G_SPAWN_SEARCH_PATH_FROM_ENVP
|
|
10805
|
-
* are used, the value from `envp` takes precedence over the environment.
|
|
10806
|
-
*
|
|
10807
|
-
* %G_SPAWN_CHILD_INHERITS_STDIN means that the child will inherit the parent's
|
|
10808
|
-
* standard input (by default, the child's standard input is attached to
|
|
10809
|
-
* `/dev/null`). %G_SPAWN_STDIN_FROM_DEV_NULL explicitly imposes the default
|
|
10810
|
-
* behavior. Both flags cannot be enabled at the same time and, in both cases,
|
|
10811
|
-
* the `stdin_pipe_out` argument is ignored.
|
|
10812
|
-
*
|
|
10813
|
-
* %G_SPAWN_STDOUT_TO_DEV_NULL means that the child's standard output
|
|
10814
|
-
* will be discarded (by default, it goes to the same location as the parent's
|
|
10815
|
-
* standard output). %G_SPAWN_CHILD_INHERITS_STDOUT explicitly imposes the
|
|
10816
|
-
* default behavior. Both flags cannot be enabled at the same time and, in
|
|
10817
|
-
* both cases, the `stdout_pipe_out` argument is ignored.
|
|
10818
|
-
*
|
|
10819
|
-
* %G_SPAWN_STDERR_TO_DEV_NULL means that the child's standard error
|
|
10820
|
-
* will be discarded (by default, it goes to the same location as the parent's
|
|
10821
|
-
* standard error). %G_SPAWN_CHILD_INHERITS_STDERR explicitly imposes the
|
|
10822
|
-
* default behavior. Both flags cannot be enabled at the same time and, in
|
|
10823
|
-
* both cases, the `stderr_pipe_out` argument is ignored.
|
|
10824
|
-
*
|
|
10825
|
-
* It is valid to pass the same FD in multiple parameters (e.g. you can pass
|
|
10826
|
-
* a single FD for both `stdout_fd` and @stderr_fd, and include it in
|
|
10827
|
-
* `source_fds` too).
|
|
10828
|
-
*
|
|
10829
|
-
* `source_fds` and `target_fds` allow zero or more FDs from this process to be
|
|
10830
|
-
* remapped to different FDs in the spawned process. If `n_fds` is greater than
|
|
10831
|
-
* zero, `source_fds` and `target_fds` must both be non-%NULL and the same length.
|
|
10832
|
-
* Each FD in `source_fds` is remapped to the FD number at the same index in
|
|
10833
|
-
* @target_fds. The source and target FD may be equal to simply propagate an FD
|
|
10834
|
-
* to the spawned process. FD remappings are processed after standard FDs, so
|
|
10835
|
-
* any target FDs which equal @stdin_fd, `stdout_fd` or `stderr_fd` will overwrite
|
|
10836
|
-
* them in the spawned process.
|
|
10837
|
-
*
|
|
10838
|
-
* `source_fds` is supported on Windows since 2.72.
|
|
10839
|
-
*
|
|
10840
|
-
* %G_SPAWN_FILE_AND_ARGV_ZERO means that the first element of `argv` is
|
|
10841
|
-
* the file to execute, while the remaining elements are the actual
|
|
10842
|
-
* argument vector to pass to the file. Normally g_spawn_async_with_pipes()
|
|
10843
|
-
* uses @argv[0] as the file to execute, and passes all of `argv` to the child.
|
|
10844
|
-
*
|
|
10845
|
-
* `child_setup` and `user_data` are a function and user data. On POSIX
|
|
10846
|
-
* platforms, the function is called in the child after GLib has
|
|
10847
|
-
* performed all the setup it plans to perform (including creating
|
|
10848
|
-
* pipes, closing file descriptors, etc.) but before calling `exec()`.
|
|
10849
|
-
* That is, `child_setup` is called just before calling `exec()` in the
|
|
10850
|
-
* child. Obviously actions taken in this function will only affect
|
|
10851
|
-
* the child, not the parent.
|
|
10852
|
-
*
|
|
10853
|
-
* On Windows, there is no separate `fork()` and `exec()` functionality.
|
|
10854
|
-
* Child processes are created and run with a single API call,
|
|
10855
|
-
* `CreateProcess()`. There is no sensible thing `child_setup` could be used for on Windows so it is ignored and not called.
|
|
10856
|
-
*
|
|
10857
|
-
* If non-%NULL, `child_pid` will on Unix be filled with the child's
|
|
10858
|
-
* process ID. You can use the process ID to send signals to the child,
|
|
10859
|
-
* or to use g_child_watch_add() (or `waitpid()`) if you specified the
|
|
10860
|
-
* %G_SPAWN_DO_NOT_REAP_CHILD flag. On Windows, `child_pid` will be
|
|
10861
|
-
* filled with a handle to the child process only if you specified the
|
|
10862
|
-
* %G_SPAWN_DO_NOT_REAP_CHILD flag. You can then access the child
|
|
10863
|
-
* process using the Win32 API, for example wait for its termination
|
|
10864
|
-
* with the `WaitFor*()` functions, or examine its exit code with
|
|
10865
|
-
* `GetExitCodeProcess()`. You should close the handle with `CloseHandle()`
|
|
10866
|
-
* or g_spawn_close_pid() when you no longer need it.
|
|
10867
|
-
*
|
|
10868
|
-
* If non-%NULL, the @stdin_pipe_out, @stdout_pipe_out, `stderr_pipe_out` locations will be filled with file descriptors for writing to the child's
|
|
10869
|
-
* standard input or reading from its standard output or standard error.
|
|
10870
|
-
* The caller of g_spawn_async_with_pipes() must close these file descriptors
|
|
10871
|
-
* when they are no longer in use. If these parameters are %NULL, the
|
|
10872
|
-
* corresponding pipe won't be created.
|
|
10873
|
-
*
|
|
10874
|
-
* If `stdin_pipe_out` is %NULL, the child's standard input is attached to
|
|
10875
|
-
* `/dev/null` unless %G_SPAWN_CHILD_INHERITS_STDIN is set.
|
|
10876
|
-
*
|
|
10877
|
-
* If `stderr_pipe_out` is NULL, the child's standard error goes to the same
|
|
10878
|
-
* location as the parent's standard error unless %G_SPAWN_STDERR_TO_DEV_NULL
|
|
10879
|
-
* is set.
|
|
10880
|
-
*
|
|
10881
|
-
* If `stdout_pipe_out` is NULL, the child's standard output goes to the same
|
|
10882
|
-
* location as the parent's standard output unless %G_SPAWN_STDOUT_TO_DEV_NULL
|
|
10883
|
-
* is set.
|
|
10884
|
-
*
|
|
10885
|
-
* `error` can be %NULL to ignore errors, or non-%NULL to report errors.
|
|
10886
|
-
* If an error is set, the function returns %FALSE. Errors are reported
|
|
10887
|
-
* even if they occur in the child (for example if the executable in
|
|
10888
|
-
* `@argv[0]` is not found). Typically the `message` field of returned
|
|
10889
|
-
* errors should be displayed to users. Possible errors are those from
|
|
10890
|
-
* the %G_SPAWN_ERROR domain.
|
|
10891
|
-
*
|
|
10892
|
-
* If an error occurs, @child_pid, @stdin_pipe_out, @stdout_pipe_out,
|
|
10893
|
-
* and `stderr_pipe_out` will not be filled with valid values.
|
|
10894
|
-
*
|
|
10895
|
-
* If `child_pid` is not %NULL and an error does not occur then the returned
|
|
10896
|
-
* process reference must be closed using g_spawn_close_pid().
|
|
10897
|
-
*
|
|
10898
|
-
* On modern UNIX platforms, GLib can use an efficient process launching
|
|
10899
|
-
* codepath driven internally by `posix_spawn()`. This has the advantage of
|
|
10900
|
-
* avoiding the fork-time performance costs of cloning the parent process
|
|
10901
|
-
* address space, and avoiding associated memory overcommit checks that are
|
|
10902
|
-
* not relevant in the context of immediately executing a distinct process.
|
|
10903
|
-
* This optimized codepath will be used provided that the following conditions
|
|
10904
|
-
* are met:
|
|
10905
|
-
*
|
|
10906
|
-
* 1. %G_SPAWN_DO_NOT_REAP_CHILD is set
|
|
10907
|
-
* 2. %G_SPAWN_LEAVE_DESCRIPTORS_OPEN is set
|
|
10908
|
-
* 3. %G_SPAWN_SEARCH_PATH_FROM_ENVP is not set
|
|
10909
|
-
* 4. `working_directory` is %NULL
|
|
10910
|
-
* 5. `child_setup` is %NULL
|
|
10911
|
-
* 6. The program is of a recognised binary format, or has a shebang.
|
|
10912
|
-
* Otherwise, GLib will have to execute the program through the
|
|
10913
|
-
* shell, which is not done using the optimized codepath.
|
|
10914
|
-
*
|
|
10915
|
-
* If you are writing a GTK application, and the program you are spawning is a
|
|
10916
|
-
* graphical application too, then to ensure that the spawned program opens its
|
|
10917
|
-
* windows on the right screen, you may want to use #GdkAppLaunchContext,
|
|
10918
|
-
* #GAppLaunchContext, or set the `DISPLAY` environment variable.
|
|
10919
|
-
* @param workingDirectory - child's current working
|
|
10920
|
-
* @param argv - child's argument
|
|
10921
|
-
* @param envp - child's environment, or %NULL to inherit parent's, in the GLib file
|
|
10922
|
-
* @param flags - flags from #GSpawnFlags
|
|
10923
|
-
* @param childSetup - function to run
|
|
10924
|
-
* @param userData - user data for @child_setup
|
|
10925
|
-
* @param stdinFd - file descriptor to use for child's stdin, or `-1`
|
|
10926
|
-
* @param stdoutFd - file descriptor to use for child's stdout, or `-1`
|
|
10927
|
-
* @param stderrFd - file descriptor to use for child's stderr, or `-1`
|
|
10928
|
-
* @param sourceFds - array of FDs from the parent
|
|
10929
|
-
* @param targetFds - array of FDs to remap
|
|
10930
|
-
* @param nFds - number of FDs in `source_fds` and @target_fds
|
|
10931
|
-
* @param childPidOut - return location for child process ID, or %NULL
|
|
10932
|
-
* @param stdinPipeOut - return location for file descriptor to write to child's stdin, or %NULL
|
|
10933
|
-
* @param stdoutPipeOut - return location for file descriptor to read child's stdout, or %NULL
|
|
10934
|
-
* @param stderrPipeOut - return location for file descriptor to read child's stderr, or %NULL
|
|
10935
|
-
*/
|
|
10936
|
-
export const spawnAsyncWithPipesAndFds = (argv, flags, stdinFd, stdoutFd, stderrFd, nFds, workingDirectory, envp, childSetup, userData, sourceFds, targetFds, childPidOut, stdinPipeOut, stdoutPipeOut, stderrPipeOut) => {
|
|
10937
|
-
const error = { value: null };
|
|
10938
|
-
const result = call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_spawn_async_with_pipes_and_fds", [
|
|
10939
|
-
{
|
|
10940
|
-
type: { type: "string" },
|
|
10941
|
-
value: workingDirectory,
|
|
10942
|
-
optional: true,
|
|
10943
|
-
},
|
|
10944
|
-
{
|
|
10945
|
-
type: { type: "array", itemType: { type: "string" } },
|
|
10946
|
-
value: argv,
|
|
10947
|
-
},
|
|
10948
|
-
{
|
|
10949
|
-
type: { type: "array", itemType: { type: "string" } },
|
|
10950
|
-
value: envp,
|
|
10951
|
-
optional: true,
|
|
10952
|
-
},
|
|
10953
|
-
{
|
|
10954
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
10955
|
-
value: flags,
|
|
10956
|
-
},
|
|
10957
|
-
{
|
|
10958
|
-
type: { type: "callback" },
|
|
10959
|
-
value: childSetup,
|
|
10960
|
-
optional: true,
|
|
10961
|
-
},
|
|
10962
|
-
{
|
|
10963
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
10964
|
-
value: userData,
|
|
10965
|
-
optional: true,
|
|
10966
|
-
},
|
|
10967
|
-
{
|
|
10968
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
10969
|
-
value: stdinFd,
|
|
10970
|
-
},
|
|
10971
|
-
{
|
|
10972
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
10973
|
-
value: stdoutFd,
|
|
10974
|
-
},
|
|
10975
|
-
{
|
|
10976
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
10977
|
-
value: stderrFd,
|
|
10978
|
-
},
|
|
10979
|
-
{
|
|
10980
|
-
type: {
|
|
10981
|
-
type: "array",
|
|
10982
|
-
itemType: { type: "int", size: 32, unsigned: false },
|
|
10983
|
-
},
|
|
10984
|
-
value: sourceFds,
|
|
10985
|
-
optional: true,
|
|
10986
|
-
},
|
|
10987
|
-
{
|
|
10988
|
-
type: {
|
|
10989
|
-
type: "array",
|
|
10990
|
-
itemType: { type: "int", size: 32, unsigned: false },
|
|
10991
|
-
},
|
|
10992
|
-
value: targetFds,
|
|
10993
|
-
optional: true,
|
|
10994
|
-
},
|
|
10995
|
-
{
|
|
10996
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
10997
|
-
value: nFds,
|
|
10998
|
-
},
|
|
10999
|
-
{
|
|
11000
|
-
type: {
|
|
11001
|
-
type: "ref",
|
|
11002
|
-
innerType: { type: "int", size: 32, unsigned: false },
|
|
11003
|
-
},
|
|
11004
|
-
value: childPidOut,
|
|
11005
|
-
optional: true,
|
|
11006
|
-
},
|
|
11007
|
-
{
|
|
11008
|
-
type: {
|
|
11009
|
-
type: "ref",
|
|
11010
|
-
innerType: { type: "int", size: 32, unsigned: false },
|
|
11011
|
-
},
|
|
11012
|
-
value: stdinPipeOut,
|
|
11013
|
-
optional: true,
|
|
11014
|
-
},
|
|
11015
|
-
{
|
|
11016
|
-
type: {
|
|
11017
|
-
type: "ref",
|
|
11018
|
-
innerType: { type: "int", size: 32, unsigned: false },
|
|
11019
|
-
},
|
|
11020
|
-
value: stdoutPipeOut,
|
|
11021
|
-
optional: true,
|
|
11022
|
-
},
|
|
11023
|
-
{
|
|
11024
|
-
type: {
|
|
11025
|
-
type: "ref",
|
|
11026
|
-
innerType: { type: "int", size: 32, unsigned: false },
|
|
11027
|
-
},
|
|
11028
|
-
value: stderrPipeOut,
|
|
11029
|
-
optional: true,
|
|
11030
|
-
},
|
|
11031
|
-
{
|
|
11032
|
-
type: {
|
|
11033
|
-
type: "ref",
|
|
11034
|
-
innerType: {
|
|
11035
|
-
type: "boxed",
|
|
11036
|
-
innerType: "GError",
|
|
11037
|
-
lib: "libglib-2.0.so.0",
|
|
11038
|
-
},
|
|
11039
|
-
},
|
|
11040
|
-
value: error,
|
|
11041
|
-
},
|
|
11042
|
-
], { type: "boolean" });
|
|
11043
|
-
if (error.value !== null) {
|
|
11044
|
-
throw new NativeError(error.value);
|
|
11045
|
-
}
|
|
11046
|
-
return result;
|
|
11047
|
-
};
|
|
11048
|
-
/**
|
|
11049
|
-
* An old name for g_spawn_check_wait_status(), deprecated because its
|
|
11050
|
-
* name is misleading.
|
|
11051
|
-
*
|
|
11052
|
-
* Despite the name of the function, `wait_status` must be the wait status
|
|
11053
|
-
* as returned by g_spawn_sync(), g_subprocess_get_status(), `waitpid()`,
|
|
11054
|
-
* etc. On Unix platforms, it is incorrect for it to be the exit status
|
|
11055
|
-
* as passed to `exit()` or returned by g_subprocess_get_exit_status() or
|
|
11056
|
-
* `WEXITSTATUS()`.
|
|
11057
|
-
* @param waitStatus - A status as returned from g_spawn_sync()
|
|
11058
|
-
*/
|
|
11059
|
-
export const spawnCheckExitStatus = (waitStatus) => {
|
|
11060
|
-
const error = { value: null };
|
|
11061
|
-
const result = call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_spawn_check_exit_status", [
|
|
11062
|
-
{
|
|
11063
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
11064
|
-
value: waitStatus,
|
|
11065
|
-
},
|
|
11066
|
-
{
|
|
11067
|
-
type: {
|
|
11068
|
-
type: "ref",
|
|
11069
|
-
innerType: {
|
|
11070
|
-
type: "boxed",
|
|
11071
|
-
innerType: "GError",
|
|
11072
|
-
lib: "libglib-2.0.so.0",
|
|
11073
|
-
},
|
|
11074
|
-
},
|
|
11075
|
-
value: error,
|
|
11076
|
-
},
|
|
11077
|
-
], { type: "boolean" });
|
|
11078
|
-
if (error.value !== null) {
|
|
11079
|
-
throw new NativeError(error.value);
|
|
11080
|
-
}
|
|
11081
|
-
return result;
|
|
11082
|
-
};
|
|
11083
|
-
/**
|
|
11084
|
-
* Set `error` if `wait_status` indicates the child exited abnormally
|
|
11085
|
-
* (e.g. with a nonzero exit code, or via a fatal signal).
|
|
11086
|
-
*
|
|
11087
|
-
* The g_spawn_sync() and g_child_watch_add() family of APIs return the
|
|
11088
|
-
* status of subprocesses encoded in a platform-specific way.
|
|
11089
|
-
* On Unix, this is guaranteed to be in the same format waitpid() returns,
|
|
11090
|
-
* and on Windows it is guaranteed to be the result of GetExitCodeProcess().
|
|
11091
|
-
*
|
|
11092
|
-
* Prior to the introduction of this function in GLib 2.34, interpreting
|
|
11093
|
-
* `wait_status` required use of platform-specific APIs, which is problematic
|
|
11094
|
-
* for software using GLib as a cross-platform layer.
|
|
11095
|
-
*
|
|
11096
|
-
* Additionally, many programs simply want to determine whether or not
|
|
11097
|
-
* the child exited successfully, and either propagate a #GError or
|
|
11098
|
-
* print a message to standard error. In that common case, this function
|
|
11099
|
-
* can be used. Note that the error message in `error` will contain
|
|
11100
|
-
* human-readable information about the wait status.
|
|
11101
|
-
*
|
|
11102
|
-
* The `domain` and `code` of `error` have special semantics in the case
|
|
11103
|
-
* where the process has an "exit code", as opposed to being killed by
|
|
11104
|
-
* a signal. On Unix, this happens if WIFEXITED() would be true of
|
|
11105
|
-
* @wait_status. On Windows, it is always the case.
|
|
11106
|
-
*
|
|
11107
|
-
* The special semantics are that the actual exit code will be the
|
|
11108
|
-
* code set in @error, and the domain will be %G_SPAWN_EXIT_ERROR.
|
|
11109
|
-
* This allows you to differentiate between different exit codes.
|
|
11110
|
-
*
|
|
11111
|
-
* If the process was terminated by some means other than an exit
|
|
11112
|
-
* status (for example if it was killed by a signal), the domain will be
|
|
11113
|
-
* %G_SPAWN_ERROR and the code will be %G_SPAWN_ERROR_FAILED.
|
|
11114
|
-
*
|
|
11115
|
-
* This function just offers convenience; you can of course also check
|
|
11116
|
-
* the available platform via a macro such as %G_OS_UNIX, and use
|
|
11117
|
-
* WIFEXITED() and WEXITSTATUS() on `wait_status` directly. Do not attempt
|
|
11118
|
-
* to scan or parse the error message string; it may be translated and/or
|
|
11119
|
-
* change in future versions of GLib.
|
|
11120
|
-
*
|
|
11121
|
-
* Prior to version 2.70, g_spawn_check_exit_status() provides the same
|
|
11122
|
-
* functionality, although under a misleading name.
|
|
11123
|
-
* @param waitStatus - A platform-specific wait status as returned from g_spawn_sync()
|
|
11124
|
-
*/
|
|
11125
|
-
export const spawnCheckWaitStatus = (waitStatus) => {
|
|
11126
|
-
const error = { value: null };
|
|
11127
|
-
const result = call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_spawn_check_wait_status", [
|
|
11128
|
-
{
|
|
11129
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
11130
|
-
value: waitStatus,
|
|
9789
|
+
value: waitStatus,
|
|
11131
9790
|
},
|
|
11132
9791
|
{
|
|
11133
9792
|
type: {
|
|
@@ -11293,118 +9952,6 @@ export const spawnErrorQuark = () => {
|
|
|
11293
9952
|
export const spawnExitErrorQuark = () => {
|
|
11294
9953
|
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_spawn_exit_error_quark", [], { type: "int", size: 32, unsigned: true });
|
|
11295
9954
|
};
|
|
11296
|
-
/**
|
|
11297
|
-
* Executes a child synchronously (waits for the child to exit before returning).
|
|
11298
|
-
*
|
|
11299
|
-
* All output from the child is stored in `standard_output` and @standard_error,
|
|
11300
|
-
* if those parameters are non-%NULL. Note that you must set the
|
|
11301
|
-
* %G_SPAWN_STDOUT_TO_DEV_NULL and %G_SPAWN_STDERR_TO_DEV_NULL flags when
|
|
11302
|
-
* passing %NULL for `standard_output` and @standard_error.
|
|
11303
|
-
*
|
|
11304
|
-
* If `wait_status` is non-%NULL, the platform-specific status of
|
|
11305
|
-
* the child is stored there; see the documentation of
|
|
11306
|
-
* g_spawn_check_wait_status() for how to use and interpret this.
|
|
11307
|
-
* On Unix platforms, note that it is usually not equal
|
|
11308
|
-
* to the integer passed to `exit()` or returned from `main()`.
|
|
11309
|
-
*
|
|
11310
|
-
* Note that it is invalid to pass %G_SPAWN_DO_NOT_REAP_CHILD in
|
|
11311
|
-
* @flags, and on POSIX platforms, the same restrictions as for
|
|
11312
|
-
* g_child_watch_source_new() apply.
|
|
11313
|
-
*
|
|
11314
|
-
* If an error occurs, no data is returned in @standard_output,
|
|
11315
|
-
* @standard_error, or @wait_status.
|
|
11316
|
-
*
|
|
11317
|
-
* This function calls g_spawn_async_with_pipes() internally; see that
|
|
11318
|
-
* function for full details on the other parameters and details on
|
|
11319
|
-
* how these functions work on Windows.
|
|
11320
|
-
* @param workingDirectory - child's current working
|
|
11321
|
-
* @param argv - child's argument vector, which must be non-empty and %NULL-terminated
|
|
11322
|
-
* @param envp - child's environment, or %NULL to inherit parent's
|
|
11323
|
-
* @param flags - flags from #GSpawnFlags
|
|
11324
|
-
* @param childSetup - function to run
|
|
11325
|
-
* @param userData - user data for @child_setup
|
|
11326
|
-
* @param standardOutput - return location for child output, or %NULL
|
|
11327
|
-
* @param standardError - return location for child error messages, or %NULL
|
|
11328
|
-
* @param waitStatus - return location for child wait status, as returned by waitpid(), or %NULL
|
|
11329
|
-
*/
|
|
11330
|
-
export const spawnSync = (argv, flags, workingDirectory, envp, childSetup, userData, standardOutput, standardError, waitStatus) => {
|
|
11331
|
-
const error = { value: null };
|
|
11332
|
-
const result = call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_spawn_sync", [
|
|
11333
|
-
{
|
|
11334
|
-
type: { type: "string" },
|
|
11335
|
-
value: workingDirectory,
|
|
11336
|
-
optional: true,
|
|
11337
|
-
},
|
|
11338
|
-
{
|
|
11339
|
-
type: { type: "array", itemType: { type: "string" } },
|
|
11340
|
-
value: argv,
|
|
11341
|
-
},
|
|
11342
|
-
{
|
|
11343
|
-
type: { type: "array", itemType: { type: "string" } },
|
|
11344
|
-
value: envp,
|
|
11345
|
-
optional: true,
|
|
11346
|
-
},
|
|
11347
|
-
{
|
|
11348
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
11349
|
-
value: flags,
|
|
11350
|
-
},
|
|
11351
|
-
{
|
|
11352
|
-
type: { type: "callback" },
|
|
11353
|
-
value: childSetup,
|
|
11354
|
-
optional: true,
|
|
11355
|
-
},
|
|
11356
|
-
{
|
|
11357
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
11358
|
-
value: userData,
|
|
11359
|
-
optional: true,
|
|
11360
|
-
},
|
|
11361
|
-
{
|
|
11362
|
-
type: {
|
|
11363
|
-
type: "ref",
|
|
11364
|
-
innerType: {
|
|
11365
|
-
type: "array",
|
|
11366
|
-
itemType: { type: "int", size: 8, unsigned: true },
|
|
11367
|
-
},
|
|
11368
|
-
},
|
|
11369
|
-
value: standardOutput,
|
|
11370
|
-
optional: true,
|
|
11371
|
-
},
|
|
11372
|
-
{
|
|
11373
|
-
type: {
|
|
11374
|
-
type: "ref",
|
|
11375
|
-
innerType: {
|
|
11376
|
-
type: "array",
|
|
11377
|
-
itemType: { type: "int", size: 8, unsigned: true },
|
|
11378
|
-
},
|
|
11379
|
-
},
|
|
11380
|
-
value: standardError,
|
|
11381
|
-
optional: true,
|
|
11382
|
-
},
|
|
11383
|
-
{
|
|
11384
|
-
type: {
|
|
11385
|
-
type: "ref",
|
|
11386
|
-
innerType: { type: "int", size: 32, unsigned: false },
|
|
11387
|
-
},
|
|
11388
|
-
value: waitStatus,
|
|
11389
|
-
optional: true,
|
|
11390
|
-
},
|
|
11391
|
-
{
|
|
11392
|
-
type: {
|
|
11393
|
-
type: "ref",
|
|
11394
|
-
innerType: {
|
|
11395
|
-
type: "boxed",
|
|
11396
|
-
innerType: "GError",
|
|
11397
|
-
lib: "libglib-2.0.so.0",
|
|
11398
|
-
},
|
|
11399
|
-
},
|
|
11400
|
-
value: error,
|
|
11401
|
-
},
|
|
11402
|
-
], { type: "boolean" });
|
|
11403
|
-
if (error.value !== null) {
|
|
11404
|
-
throw new NativeError(error.value);
|
|
11405
|
-
}
|
|
11406
|
-
return result;
|
|
11407
|
-
};
|
|
11408
9955
|
/**
|
|
11409
9956
|
* A wrapper for the POSIX stat() function. The stat() function
|
|
11410
9957
|
* returns information about a file. On Windows the stat() function in
|
|
@@ -12443,103 +10990,6 @@ export const strvLength = (strArray) => {
|
|
|
12443
10990
|
},
|
|
12444
10991
|
], { type: "int", size: 32, unsigned: true });
|
|
12445
10992
|
};
|
|
12446
|
-
/**
|
|
12447
|
-
* Creates a new test case.
|
|
12448
|
-
*
|
|
12449
|
-
* This function is similar to [func@GLib.test_create_case].
|
|
12450
|
-
* However the test is assumed to use no fixture, and test suites are
|
|
12451
|
-
* automatically created on the fly and added to the root fixture,
|
|
12452
|
-
* based on the /-separated portions of @testpath. The `test_data` argument will be passed as first argument to @test_func.
|
|
12453
|
-
*
|
|
12454
|
-
* If `testpath` includes the component "subprocess" anywhere in it,
|
|
12455
|
-
* the test will be skipped by default, and only run if explicitly
|
|
12456
|
-
* required via the `-p` command-line option or [func@GLib.test_trap_subprocess].
|
|
12457
|
-
*
|
|
12458
|
-
* No component of `testpath` may start with a dot (`.`) if the
|
|
12459
|
-
* [const@GLib.TEST_OPTION_ISOLATE_DIRS] option is being used;
|
|
12460
|
-
* and it is recommended to do so even if it isn’t.
|
|
12461
|
-
* @param testpath - a /-separated name for the test
|
|
12462
|
-
* @param testData - data for the @test_func
|
|
12463
|
-
* @param testFunc - the test function to invoke for this test
|
|
12464
|
-
*/
|
|
12465
|
-
export const testAddDataFunc = (testpath, testFunc, testData) => {
|
|
12466
|
-
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_test_add_data_func", [
|
|
12467
|
-
{
|
|
12468
|
-
type: { type: "string" },
|
|
12469
|
-
value: testpath,
|
|
12470
|
-
},
|
|
12471
|
-
{
|
|
12472
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
12473
|
-
value: testData,
|
|
12474
|
-
optional: true,
|
|
12475
|
-
},
|
|
12476
|
-
{
|
|
12477
|
-
type: { type: "callback" },
|
|
12478
|
-
value: testFunc,
|
|
12479
|
-
},
|
|
12480
|
-
], { type: "undefined" });
|
|
12481
|
-
};
|
|
12482
|
-
/**
|
|
12483
|
-
* Creates a new test case.
|
|
12484
|
-
*
|
|
12485
|
-
* In contrast to [func@GLib.test_add_data_func], this function
|
|
12486
|
-
* is freeing `test_data` after the test run is complete.
|
|
12487
|
-
* @param testpath - a /-separated name for the test
|
|
12488
|
-
* @param testData - data for @test_func
|
|
12489
|
-
* @param testFunc - the test function to invoke for this test
|
|
12490
|
-
* @param dataFreeFunc - #GDestroyNotify for @test_data
|
|
12491
|
-
*/
|
|
12492
|
-
export const testAddDataFuncFull = (testpath, testFunc, dataFreeFunc, testData) => {
|
|
12493
|
-
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_test_add_data_func_full", [
|
|
12494
|
-
{
|
|
12495
|
-
type: { type: "string" },
|
|
12496
|
-
value: testpath,
|
|
12497
|
-
},
|
|
12498
|
-
{
|
|
12499
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
12500
|
-
value: testData,
|
|
12501
|
-
optional: true,
|
|
12502
|
-
},
|
|
12503
|
-
{
|
|
12504
|
-
type: { type: "callback" },
|
|
12505
|
-
value: testFunc,
|
|
12506
|
-
},
|
|
12507
|
-
{
|
|
12508
|
-
type: { type: "callback", trampoline: "destroy" },
|
|
12509
|
-
value: dataFreeFunc,
|
|
12510
|
-
},
|
|
12511
|
-
], { type: "undefined" });
|
|
12512
|
-
};
|
|
12513
|
-
/**
|
|
12514
|
-
* Creates a new test case.
|
|
12515
|
-
*
|
|
12516
|
-
* This function is similar to [func@GLib.test_create_case].
|
|
12517
|
-
* However the test is assumed to use no fixture, and test suites are
|
|
12518
|
-
* automatically created on the fly and added to the root fixture,
|
|
12519
|
-
* based on the /-separated portions of @testpath.
|
|
12520
|
-
*
|
|
12521
|
-
* If `testpath` includes the component "subprocess" anywhere in it,
|
|
12522
|
-
* the test will be skipped by default, and only run if explicitly
|
|
12523
|
-
* required via the `-p` command-line option or [func@GLib.test_trap_subprocess].
|
|
12524
|
-
*
|
|
12525
|
-
* No component of `testpath` may start with a dot (`.`) if the
|
|
12526
|
-
* [const@GLib.TEST_OPTION_ISOLATE_DIRS] option is being used; and
|
|
12527
|
-
* it is recommended to do so even if it isn’t.
|
|
12528
|
-
* @param testpath - a /-separated name for the test
|
|
12529
|
-
* @param testFunc - the test function to invoke for this test
|
|
12530
|
-
*/
|
|
12531
|
-
export const testAddFunc = (testpath, testFunc) => {
|
|
12532
|
-
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_test_add_func", [
|
|
12533
|
-
{
|
|
12534
|
-
type: { type: "string" },
|
|
12535
|
-
value: testpath,
|
|
12536
|
-
},
|
|
12537
|
-
{
|
|
12538
|
-
type: { type: "callback" },
|
|
12539
|
-
value: testFunc,
|
|
12540
|
-
},
|
|
12541
|
-
], { type: "undefined" });
|
|
12542
|
-
};
|
|
12543
10993
|
export const testAssertExpectedMessagesInternal = (domain, file, line, func) => {
|
|
12544
10994
|
call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_test_assert_expected_messages_internal", [
|
|
12545
10995
|
{
|
|
@@ -13450,119 +11900,6 @@ export const timeValFromIso8601 = (isoDate, time_) => {
|
|
|
13450
11900
|
},
|
|
13451
11901
|
], { type: "boolean" });
|
|
13452
11902
|
};
|
|
13453
|
-
/**
|
|
13454
|
-
* Sets a function to be called at regular intervals, with the given
|
|
13455
|
-
* priority.
|
|
13456
|
-
*
|
|
13457
|
-
* The function is called repeatedly until it returns
|
|
13458
|
-
* [const@GLib.SOURCE_REMOVE], at which point the timeout is automatically
|
|
13459
|
-
* destroyed and
|
|
13460
|
-
* the function will not be called again. The `notify` function is
|
|
13461
|
-
* called when the timeout is destroyed. The first call to the
|
|
13462
|
-
* function will be at the end of the first @interval.
|
|
13463
|
-
*
|
|
13464
|
-
* Note that timeout functions may be delayed, due to the processing of other
|
|
13465
|
-
* event sources. Thus they should not be relied on for precise timing.
|
|
13466
|
-
* After each call to the timeout function, the time of the next
|
|
13467
|
-
* timeout is recalculated based on the current time and the given interval
|
|
13468
|
-
* (it does not try to ‘catch up’ time lost in delays).
|
|
13469
|
-
*
|
|
13470
|
-
* See main loop memory management for details
|
|
13471
|
-
* on how to handle the return value and memory management of @data.
|
|
13472
|
-
*
|
|
13473
|
-
* This internally creates a main loop source using
|
|
13474
|
-
* [func@GLib.timeout_source_new] and attaches it to the global
|
|
13475
|
-
* [struct@GLib.MainContext] using [method@GLib.Source.attach], so the callback
|
|
13476
|
-
* will be invoked in whichever thread is running that main context. You can do
|
|
13477
|
-
* these steps manually if you need greater control or to use a custom main
|
|
13478
|
-
* context.
|
|
13479
|
-
*
|
|
13480
|
-
* The interval given is in terms of monotonic time, not wall clock time.
|
|
13481
|
-
* See [func@GLib.get_monotonic_time].
|
|
13482
|
-
* @param priority - the priority of the timeout source; typically this will be in
|
|
13483
|
-
* @param interval - the time between calls to the function, in milliseconds
|
|
13484
|
-
* @param _function - function to call
|
|
13485
|
-
* @param data - data to pass to @function
|
|
13486
|
-
* @param notify - function to call when the timeout is removed
|
|
13487
|
-
*/
|
|
13488
|
-
export const timeoutAddFull = (priority, interval, _function) => {
|
|
13489
|
-
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_timeout_add_full", [
|
|
13490
|
-
{
|
|
13491
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
13492
|
-
value: priority,
|
|
13493
|
-
},
|
|
13494
|
-
{
|
|
13495
|
-
type: { type: "int", size: 32, unsigned: true },
|
|
13496
|
-
value: interval,
|
|
13497
|
-
},
|
|
13498
|
-
{
|
|
13499
|
-
type: { type: "callback", trampoline: "sourceFunc" },
|
|
13500
|
-
value: _function,
|
|
13501
|
-
},
|
|
13502
|
-
], { type: "int", size: 32, unsigned: true });
|
|
13503
|
-
};
|
|
13504
|
-
/**
|
|
13505
|
-
* Sets a function to be called at regular intervals, with @priority.
|
|
13506
|
-
*
|
|
13507
|
-
* The function is called repeatedly until it returns [const@GLib.SOURCE_REMOVE],
|
|
13508
|
-
* at which point the timeout is automatically destroyed and
|
|
13509
|
-
* the function will not be called again.
|
|
13510
|
-
*
|
|
13511
|
-
* Unlike [func@GLib.timeout_add], this function operates at whole second
|
|
13512
|
-
* granularity. The initial starting point of the timer is determined by the
|
|
13513
|
-
* implementation and the implementation is expected to group multiple timers
|
|
13514
|
-
* together so that they fire all at the same time. To allow this grouping,
|
|
13515
|
-
* the `interval` to the first timer is rounded and can deviate up to one second
|
|
13516
|
-
* from the specified interval. Subsequent timer iterations will generally run
|
|
13517
|
-
* at the specified interval.
|
|
13518
|
-
*
|
|
13519
|
-
* Note that timeout functions may be delayed, due to the processing of other
|
|
13520
|
-
* event sources. Thus they should not be relied on for precise timing.
|
|
13521
|
-
* After each call to the timeout function, the time of the next
|
|
13522
|
-
* timeout is recalculated based on the current time and the given `interval`
|
|
13523
|
-
* See main loop memory management for details
|
|
13524
|
-
* on how to handle the return value and memory management of @data.
|
|
13525
|
-
*
|
|
13526
|
-
* If you want timing more precise than whole seconds, use
|
|
13527
|
-
* [func@GLib.timeout_add] instead.
|
|
13528
|
-
*
|
|
13529
|
-
* The grouping of timers to fire at the same time results in a more power
|
|
13530
|
-
* and CPU efficient behavior so if your timer is in multiples of seconds
|
|
13531
|
-
* and you don’t require the first timer exactly one second from now, the
|
|
13532
|
-
* use of [func@GLib.timeout_add_seconds] is preferred over
|
|
13533
|
-
* [func@GLib.timeout_add].
|
|
13534
|
-
*
|
|
13535
|
-
* This internally creates a main loop source using
|
|
13536
|
-
* [func@GLib.timeout_source_new_seconds] and attaches it to the main loop
|
|
13537
|
-
* context using [method@GLib.Source.attach]. You can do these steps manually
|
|
13538
|
-
* if you need greater control.
|
|
13539
|
-
*
|
|
13540
|
-
* It is safe to call this function from any thread.
|
|
13541
|
-
*
|
|
13542
|
-
* The interval given is in terms of monotonic time, not wall clock
|
|
13543
|
-
* time. See [func@GLib.get_monotonic_time].
|
|
13544
|
-
* @param priority - the priority of the timeout source; typically this will be in
|
|
13545
|
-
* @param interval - the time between calls to the function, in seconds
|
|
13546
|
-
* @param _function - function to call
|
|
13547
|
-
* @param data - data to pass to @function
|
|
13548
|
-
* @param notify - function to call when the timeout is removed
|
|
13549
|
-
*/
|
|
13550
|
-
export const timeoutAddSecondsFull = (priority, interval, _function) => {
|
|
13551
|
-
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_timeout_add_seconds_full", [
|
|
13552
|
-
{
|
|
13553
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
13554
|
-
value: priority,
|
|
13555
|
-
},
|
|
13556
|
-
{
|
|
13557
|
-
type: { type: "int", size: 32, unsigned: true },
|
|
13558
|
-
value: interval,
|
|
13559
|
-
},
|
|
13560
|
-
{
|
|
13561
|
-
type: { type: "callback", trampoline: "sourceFunc" },
|
|
13562
|
-
value: _function,
|
|
13563
|
-
},
|
|
13564
|
-
], { type: "int", size: 32, unsigned: true });
|
|
13565
|
-
};
|
|
13566
11903
|
/**
|
|
13567
11904
|
* Creates a new timeout source.
|
|
13568
11905
|
*
|
|
@@ -14559,49 +12896,6 @@ export const unicodeScriptToIso15924 = (script) => {
|
|
|
14559
12896
|
export const unixErrorQuark = () => {
|
|
14560
12897
|
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_unix_error_quark", [], { type: "int", size: 32, unsigned: true });
|
|
14561
12898
|
};
|
|
14562
|
-
/**
|
|
14563
|
-
* Sets a function to be called when the IO condition, as specified by
|
|
14564
|
-
* `condition` becomes true for @fd.
|
|
14565
|
-
*
|
|
14566
|
-
* This is the same as g_unix_fd_add(), except that it allows you to
|
|
14567
|
-
* specify a non-default priority and a provide a #GDestroyNotify for
|
|
14568
|
-
* @user_data.
|
|
14569
|
-
* @param priority - the priority of the source
|
|
14570
|
-
* @param fd - a file descriptor
|
|
14571
|
-
* @param condition - IO conditions to watch for on @fd
|
|
14572
|
-
* @param _function - a #GUnixFDSourceFunc
|
|
14573
|
-
* @param userData - data to pass to @function
|
|
14574
|
-
* @param notify - function to call when the idle is removed, or %NULL
|
|
14575
|
-
*/
|
|
14576
|
-
export const unixFdAddFull = (priority, fd, condition, _function, notify, userData) => {
|
|
14577
|
-
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_unix_fd_add_full", [
|
|
14578
|
-
{
|
|
14579
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
14580
|
-
value: priority,
|
|
14581
|
-
},
|
|
14582
|
-
{
|
|
14583
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
14584
|
-
value: fd,
|
|
14585
|
-
},
|
|
14586
|
-
{
|
|
14587
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
14588
|
-
value: condition,
|
|
14589
|
-
},
|
|
14590
|
-
{
|
|
14591
|
-
type: { type: "callback" },
|
|
14592
|
-
value: _function,
|
|
14593
|
-
},
|
|
14594
|
-
{
|
|
14595
|
-
type: { type: "int", size: 64, unsigned: true },
|
|
14596
|
-
value: userData,
|
|
14597
|
-
optional: true,
|
|
14598
|
-
},
|
|
14599
|
-
{
|
|
14600
|
-
type: { type: "callback", trampoline: "destroy" },
|
|
14601
|
-
value: notify,
|
|
14602
|
-
},
|
|
14603
|
-
], { type: "int", size: 32, unsigned: true });
|
|
14604
|
-
};
|
|
14605
12899
|
/**
|
|
14606
12900
|
* Creates a #GSource to watch for a particular I/O condition on a file
|
|
14607
12901
|
* descriptor.
|
|
@@ -14758,32 +13052,6 @@ export const unixSetFdNonblocking = (fd, nonblock) => {
|
|
|
14758
13052
|
}
|
|
14759
13053
|
return result;
|
|
14760
13054
|
};
|
|
14761
|
-
/**
|
|
14762
|
-
* A convenience function for g_unix_signal_source_new(), which
|
|
14763
|
-
* attaches to the default #GMainContext. You can remove the watch
|
|
14764
|
-
* using g_source_remove().
|
|
14765
|
-
* @param priority - the priority of the signal source. Typically this will be in
|
|
14766
|
-
* @param signum - Signal number
|
|
14767
|
-
* @param handler - Callback
|
|
14768
|
-
* @param userData - Data for @handler
|
|
14769
|
-
* @param notify - #GDestroyNotify for @handler
|
|
14770
|
-
*/
|
|
14771
|
-
export const unixSignalAddFull = (priority, signum, handler) => {
|
|
14772
|
-
return call("libgobject-2.0.so.0,libglib-2.0.so.0", "g_unix_signal_add_full", [
|
|
14773
|
-
{
|
|
14774
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
14775
|
-
value: priority,
|
|
14776
|
-
},
|
|
14777
|
-
{
|
|
14778
|
-
type: { type: "int", size: 32, unsigned: false },
|
|
14779
|
-
value: signum,
|
|
14780
|
-
},
|
|
14781
|
-
{
|
|
14782
|
-
type: { type: "callback", trampoline: "sourceFunc" },
|
|
14783
|
-
value: handler,
|
|
14784
|
-
},
|
|
14785
|
-
], { type: "int", size: 32, unsigned: true });
|
|
14786
|
-
};
|
|
14787
13055
|
/**
|
|
14788
13056
|
* Create a #GSource that will be dispatched upon delivery of the UNIX
|
|
14789
13057
|
* signal @signum. In GLib versions before 2.36, only `SIGHUP`, `SIGINT`,
|