From c05e4efbe9b4e7d1ff078b7a392621f2ca7572e6 Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Tue, 1 Dec 2020 14:40:30 +0100 Subject: renamed examples/ to utils/ --- utils/README.md | 54 ++ utils/afl_frida/GNUmakefile | 23 + utils/afl_frida/Makefile | 2 + utils/afl_frida/README.md | 34 ++ utils/afl_frida/afl-frida.c | 542 +++++++++++++++++ utils/afl_frida/afl-frida.h | 53 ++ utils/afl_frida/libtestinstr.c | 35 ++ utils/afl_network_proxy/GNUmakefile | 43 ++ utils/afl_network_proxy/Makefile | 2 + utils/afl_network_proxy/README.md | 61 ++ utils/afl_network_proxy/afl-network-client.c | 415 +++++++++++++ utils/afl_network_proxy/afl-network-server.c | 720 +++++++++++++++++++++++ utils/afl_proxy/Makefile | 7 + utils/afl_proxy/README.md | 9 + utils/afl_proxy/afl-proxy.c | 238 ++++++++ utils/afl_untracer/Makefile | 16 + utils/afl_untracer/README.md | 60 ++ utils/afl_untracer/TODO | 2 + utils/afl_untracer/afl-untracer.c | 768 +++++++++++++++++++++++++ utils/afl_untracer/ghidra_get_patchpoints.java | 84 +++ utils/afl_untracer/ida_get_patchpoints.py | 62 ++ utils/afl_untracer/libtestinstr.c | 35 ++ utils/afl_untracer/patches.txt | 34 ++ utils/aflpp_driver/GNUmakefile | 46 ++ utils/aflpp_driver/Makefile | 2 + utils/aflpp_driver/aflpp_driver.c | 326 +++++++++++ utils/aflpp_driver/aflpp_driver_test.c | 32 ++ utils/aflpp_driver/aflpp_qemu_driver.c | 38 ++ utils/aflpp_driver/aflpp_qemu_driver_hook.c | 22 + utils/analysis_scripts/queue2csv.sh | 122 ++++ utils/argv_fuzzing/Makefile | 58 ++ utils/argv_fuzzing/README.md | 16 + utils/argv_fuzzing/argv-fuzz-inl.h | 90 +++ utils/argv_fuzzing/argvfuzz.c | 49 ++ utils/asan_cgroups/limit_memory.sh | 157 +++++ utils/bash_shellshock/shellshock-fuzz.diff | 59 ++ utils/canvas_harness/canvas_harness.html | 170 ++++++ utils/clang_asm_normalize/as | 75 +++ utils/crash_triage/triage_crashes.sh | 115 ++++ utils/custom_mutators/Makefile | 7 + utils/custom_mutators/README.md | 35 ++ utils/custom_mutators/XmlMutatorMin.py | 332 +++++++++++ utils/custom_mutators/common.py | 40 ++ utils/custom_mutators/custom_mutator_helpers.h | 342 +++++++++++ utils/custom_mutators/example.c | 376 ++++++++++++ utils/custom_mutators/example.py | 186 ++++++ utils/custom_mutators/post_library_gif.so.c | 165 ++++++ utils/custom_mutators/post_library_png.so.c | 163 ++++++ utils/custom_mutators/simple-chunk-replace.py | 64 +++ utils/custom_mutators/simple_example.c | 74 +++ utils/custom_mutators/wrapper_afl_min.py | 118 ++++ utils/defork/Makefile | 64 +++ utils/defork/README.md | 11 + utils/defork/defork.c | 50 ++ utils/defork/forking_target.c | 49 ++ utils/distributed_fuzzing/sync_script.sh | 97 ++++ utils/libpng_no_checksum/libpng-nocrc.patch | 15 + utils/persistent_mode/Makefile | 10 + utils/persistent_mode/persistent_demo.c | 112 ++++ utils/persistent_mode/persistent_demo_new.c | 117 ++++ utils/persistent_mode/test-instr.c | 69 +++ utils/qemu_persistent_hook/Makefile | 6 + utils/qemu_persistent_hook/README.md | 19 + utils/qemu_persistent_hook/read_into_rdi.c | 34 ++ utils/qemu_persistent_hook/test.c | 35 ++ utils/socket_fuzzing/Makefile | 61 ++ utils/socket_fuzzing/README.md | 11 + utils/socket_fuzzing/socketfuzz.c | 110 ++++ 68 files changed, 7448 insertions(+) create mode 100644 utils/README.md create mode 100644 utils/afl_frida/GNUmakefile create mode 100644 utils/afl_frida/Makefile create mode 100644 utils/afl_frida/README.md create mode 100644 utils/afl_frida/afl-frida.c create mode 100644 utils/afl_frida/afl-frida.h create mode 100644 utils/afl_frida/libtestinstr.c create mode 100644 utils/afl_network_proxy/GNUmakefile create mode 100644 utils/afl_network_proxy/Makefile create mode 100644 utils/afl_network_proxy/README.md create mode 100644 utils/afl_network_proxy/afl-network-client.c create mode 100644 utils/afl_network_proxy/afl-network-server.c create mode 100644 utils/afl_proxy/Makefile create mode 100644 utils/afl_proxy/README.md create mode 100644 utils/afl_proxy/afl-proxy.c create mode 100644 utils/afl_untracer/Makefile create mode 100644 utils/afl_untracer/README.md create mode 100644 utils/afl_untracer/TODO create mode 100644 utils/afl_untracer/afl-untracer.c create mode 100644 utils/afl_untracer/ghidra_get_patchpoints.java create mode 100644 utils/afl_untracer/ida_get_patchpoints.py create mode 100644 utils/afl_untracer/libtestinstr.c create mode 100644 utils/afl_untracer/patches.txt create mode 100644 utils/aflpp_driver/GNUmakefile create mode 100644 utils/aflpp_driver/Makefile create mode 100644 utils/aflpp_driver/aflpp_driver.c create mode 100644 utils/aflpp_driver/aflpp_driver_test.c create mode 100644 utils/aflpp_driver/aflpp_qemu_driver.c create mode 100644 utils/aflpp_driver/aflpp_qemu_driver_hook.c create mode 100755 utils/analysis_scripts/queue2csv.sh create mode 100644 utils/argv_fuzzing/Makefile create mode 100644 utils/argv_fuzzing/README.md create mode 100644 utils/argv_fuzzing/argv-fuzz-inl.h create mode 100644 utils/argv_fuzzing/argvfuzz.c create mode 100755 utils/asan_cgroups/limit_memory.sh create mode 100644 utils/bash_shellshock/shellshock-fuzz.diff create mode 100644 utils/canvas_harness/canvas_harness.html create mode 100755 utils/clang_asm_normalize/as create mode 100755 utils/crash_triage/triage_crashes.sh create mode 100644 utils/custom_mutators/Makefile create mode 100644 utils/custom_mutators/README.md create mode 100644 utils/custom_mutators/XmlMutatorMin.py create mode 100644 utils/custom_mutators/common.py create mode 100644 utils/custom_mutators/custom_mutator_helpers.h create mode 100644 utils/custom_mutators/example.c create mode 100644 utils/custom_mutators/example.py create mode 100644 utils/custom_mutators/post_library_gif.so.c create mode 100644 utils/custom_mutators/post_library_png.so.c create mode 100644 utils/custom_mutators/simple-chunk-replace.py create mode 100644 utils/custom_mutators/simple_example.c create mode 100644 utils/custom_mutators/wrapper_afl_min.py create mode 100644 utils/defork/Makefile create mode 100644 utils/defork/README.md create mode 100644 utils/defork/defork.c create mode 100644 utils/defork/forking_target.c create mode 100755 utils/distributed_fuzzing/sync_script.sh create mode 100644 utils/libpng_no_checksum/libpng-nocrc.patch create mode 100644 utils/persistent_mode/Makefile create mode 100644 utils/persistent_mode/persistent_demo.c create mode 100644 utils/persistent_mode/persistent_demo_new.c create mode 100644 utils/persistent_mode/test-instr.c create mode 100644 utils/qemu_persistent_hook/Makefile create mode 100644 utils/qemu_persistent_hook/README.md create mode 100644 utils/qemu_persistent_hook/read_into_rdi.c create mode 100644 utils/qemu_persistent_hook/test.c create mode 100644 utils/socket_fuzzing/Makefile create mode 100644 utils/socket_fuzzing/README.md create mode 100644 utils/socket_fuzzing/socketfuzz.c (limited to 'utils') diff --git a/utils/README.md b/utils/README.md new file mode 100644 index 00000000..336b6b6c --- /dev/null +++ b/utils/README.md @@ -0,0 +1,54 @@ +# AFL++ Examples + +Here's a quick overview of the stuff you can find in this directory: + + - afl_network_proxy - fuzz a target over the network: afl-fuzz on + a host, target on an embedded system. + + - afl_proxy - skeleton file example to show how to fuzz + something where you gather coverage data via + different means, e.g. hw debugger + + - afl_untracer - fuzz binary-only libraries much faster but with + less coverage than qemu_mode + + - argv_fuzzing - a simple wrapper to allow cmdline to be fuzzed + (e.g., to test setuid programs). + + - asan_cgroups - a contributed script to simplify fuzzing ASAN + binaries with robust memory limits on Linux. + + - bash_shellshock - a simple hack used to find a bunch of + post-Shellshock bugs in bash. + + - canvas_harness - a test harness used to find browser bugs with a + corpus generated using simple image parsing + binaries & afl-fuzz. + + - clang_asm_normalize - a script that makes it easy to instrument + hand-written assembly, provided that you have clang. + + - crash_triage - a very rudimentary example of how to annotate crashes + with additional gdb metadata. + + - custom_mutators - examples for the afl++ custom mutator interface in + C and Python + + - distributed_fuzzing - a sample script for synchronizing fuzzer instances + across multiple machines (see parallel_fuzzing.md). + + - libpng_no_checksum - a sample patch for removing CRC checks in libpng. + + - persistent_mode - an example of how to use the LLVM persistent process + mode to speed up certain fuzzing jobs. + + - socket_fuzzing - a LD_PRELOAD library 'redirects' a socket to stdin + for fuzzing access with afl++ + +Note that the minimize_corpus.sh tool has graduated from the utils/ +directory and is now available as ../afl-cmin. The LLVM mode has likewise +graduated to ../instrumentation/*. + +Most of the tools in this directory are meant chiefly as examples that need to +be tweaked for your specific needs. They come with some basic documentation, +but are not necessarily production-grade. diff --git a/utils/afl_frida/GNUmakefile b/utils/afl_frida/GNUmakefile new file mode 100644 index 00000000..c154f3a4 --- /dev/null +++ b/utils/afl_frida/GNUmakefile @@ -0,0 +1,23 @@ +ifdef DEBUG + OPT=-O0 -D_DEBUG=\"1\" +else + OPT=-O3 -funroll-loops +endif + +all: afl-frida libtestinstr.so + +libfrida-gum.a: + @echo Download and extract frida-gum-devkit-VERSION-PLATFORM.tar.xz for your platform from https://github.com/frida/frida/releases/latest + @exit 1 + +afl-frida: afl-frida.c libfrida-gum.a + $(CC) -g $(OPT) -o afl-frida -Wno-format -Wno-pointer-sign -I. -fpermissive -fPIC afl-frida.c ../../afl-llvm-rt.o libfrida-gum.a -ldl -lresolv -pthread + +libtestinstr.so: libtestinstr.c + $(CC) -g -O0 -fPIC -o libtestinstr.so -shared libtestinstr.c + +clean: + rm -f afl-frida *~ core *.o libtestinstr.so + +deepclean: clean + rm -f libfrida-gum.a frida-gum* diff --git a/utils/afl_frida/Makefile b/utils/afl_frida/Makefile new file mode 100644 index 00000000..0b306dde --- /dev/null +++ b/utils/afl_frida/Makefile @@ -0,0 +1,2 @@ +all: + @echo please use GNU make, thanks! diff --git a/utils/afl_frida/README.md b/utils/afl_frida/README.md new file mode 100644 index 00000000..7743479b --- /dev/null +++ b/utils/afl_frida/README.md @@ -0,0 +1,34 @@ +# afl-frida - faster fuzzing of binary-only libraries + +## Introduction + +afl-frida is an example skeleton file which can easily be used to fuzz +a closed source library. + +It requires less memory and is x5-10 faster than qemu_mode but does not +provide interesting features like compcov or cmplog. + +## How-to + +### Modify afl-frida.c + +Read and modify afl-frida.c then `make`. +To adapt afl-frida.c to your needs, read the header of the file and then +search and edit the `STEP 1`, `STEP 2` and `STEP 3` locations. + +### Fuzzing + +Example (after modifying afl-frida.c to your needs and compile it): +``` +LD_LIBRARY_PATH=/path/to/the/target/library afl-fuzz -i in -o out -- ./afl-frida +``` +(or even remote via afl-network-proxy). + +# Speed and stability + +The speed is very good, about x12 of fork() qemu_mode. +However the stability is low. Reason is currently unknown. + +# Background + +This code is copied for a larger part from https://github.com/meme/hotwax diff --git a/utils/afl_frida/afl-frida.c b/utils/afl_frida/afl-frida.c new file mode 100644 index 00000000..31bf8f25 --- /dev/null +++ b/utils/afl_frida/afl-frida.c @@ -0,0 +1,542 @@ +/* + american fuzzy lop++ - afl-frida skeleton example + ------------------------------------------------- + + Copyright 2020 AFLplusplus Project. All rights reserved. + + Written mostly by meme -> https://github.com/meme/hotwax + + Modifications by Marc Heuse + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + HOW-TO + ====== + + You only need to change the following: + + 1. set the defines and function call parameters. + 2. dl load the library you want to fuzz, lookup the functions you need + and setup the calls to these. + 3. in the while loop you call the functions in the necessary order - + incl the cleanup. the cleanup is important! + + Just look these steps up in the code, look for "// STEP x:" + +*/ + +#include +#include +#include +#include +#include +#include +#include + +#ifndef __APPLE__ + #include + #include +#endif + +int debug = 0; + +// STEP 1: + +// The presets are for the example libtestinstr.so: + +/* What is the name of the library to fuzz */ +#define TARGET_LIBRARY "libtestinstr.so" + +/* What is the name of the function to fuzz */ +#define TARGET_FUNCTION "testinstr" + +/* here you need to specify the parameter for the target function */ +static void *(*o_function)(uint8_t *, int); + +// END STEP 1 + +#include "frida-gum.h" + +G_BEGIN_DECLS + +#define GUM_TYPE_FAKE_EVENT_SINK (gum_fake_event_sink_get_type()) +G_DECLARE_FINAL_TYPE(GumFakeEventSink, gum_fake_event_sink, GUM, + FAKE_EVENT_SINK, GObject) + +struct _GumFakeEventSink { + + GObject parent; + GumEventType mask; + +}; + +GumEventSink *gum_fake_event_sink_new(void); +void gum_fake_event_sink_reset(GumFakeEventSink *self); + +G_END_DECLS + +static void gum_fake_event_sink_iface_init(gpointer g_iface, + gpointer iface_data); +static void gum_fake_event_sink_finalize(GObject *obj); +static GumEventType gum_fake_event_sink_query_mask(GumEventSink *sink); +static void gum_fake_event_sink_process(GumEventSink *sink, const GumEvent *ev); +void instr_basic_block(GumStalkerIterator *iterator, GumStalkerOutput *output, + gpointer user_data); +void afl_setup(void); +void afl_start_forkserver(void); +int __afl_persistent_loop(unsigned int max_cnt); + +static void gum_fake_event_sink_class_init(GumFakeEventSinkClass *klass) { + + GObjectClass *object_class = G_OBJECT_CLASS(klass); + object_class->finalize = gum_fake_event_sink_finalize; + +} + +static void gum_fake_event_sink_iface_init(gpointer g_iface, + gpointer iface_data) { + + GumEventSinkInterface *iface = (GumEventSinkInterface *)g_iface; + iface->query_mask = gum_fake_event_sink_query_mask; + iface->process = gum_fake_event_sink_process; + +} + +G_DEFINE_TYPE_EXTENDED(GumFakeEventSink, gum_fake_event_sink, G_TYPE_OBJECT, 0, + G_IMPLEMENT_INTERFACE(GUM_TYPE_EVENT_SINK, + gum_fake_event_sink_iface_init)) + +#include "../../config.h" + +// Shared memory fuzzing. +int __afl_sharedmem_fuzzing = 1; +extern unsigned int * __afl_fuzz_len; +extern unsigned char *__afl_fuzz_ptr; + +// Notify AFL about persistent mode. +static volatile char AFL_PERSISTENT[] = "##SIG_AFL_PERSISTENT##"; +int __afl_persistent_loop(unsigned int); + +// Notify AFL about deferred forkserver. +static volatile char AFL_DEFER_FORKSVR[] = "##SIG_AFL_DEFER_FORKSRV##"; +void __afl_manual_init(); + +// Because we do our own logging. +extern uint8_t * __afl_area_ptr; +static __thread guint64 previous_pc; + +// Frida stuff below. +typedef struct { + + GumAddress base_address; + guint64 code_start, code_end; + +} range_t; + +inline static void afl_maybe_log(guint64 current_pc) { + + // fprintf(stderr, "PC: %p ^ %p\n", current_pc, previous_pc); + + current_pc = (current_pc >> 4) ^ (current_pc << 8); + current_pc &= MAP_SIZE - 1; + + __afl_area_ptr[current_pc ^ previous_pc]++; + previous_pc = current_pc >> 1; + +} + +static void on_basic_block(GumCpuContext *context, gpointer user_data) { + + afl_maybe_log((guint64)user_data); + +} + +void instr_basic_block(GumStalkerIterator *iterator, GumStalkerOutput *output, + gpointer user_data) { + + range_t *range = (range_t *)user_data; + + const cs_insn *instr; + gboolean begin = TRUE; + while (gum_stalker_iterator_next(iterator, &instr)) { + + if (begin) { + + if (instr->address >= range->code_start && + instr->address <= range->code_end) { + + gum_stalker_iterator_put_callout(iterator, on_basic_block, + (gpointer)instr->address, NULL); + begin = FALSE; + + } + + } + + gum_stalker_iterator_keep(iterator); + + } + +} + +static void gum_fake_event_sink_init(GumFakeEventSink *self) { + +} + +static void gum_fake_event_sink_finalize(GObject *obj) { + + G_OBJECT_CLASS(gum_fake_event_sink_parent_class)->finalize(obj); + +} + +GumEventSink *gum_fake_event_sink_new(void) { + + GumFakeEventSink *sink; + sink = (GumFakeEventSink *)g_object_new(GUM_TYPE_FAKE_EVENT_SINK, NULL); + return GUM_EVENT_SINK(sink); + +} + +void gum_fake_event_sink_reset(GumFakeEventSink *self) { + +} + +static GumEventType gum_fake_event_sink_query_mask(GumEventSink *sink) { + + return 0; + +} + +typedef struct library_list { + + uint8_t *name; + uint64_t addr_start, addr_end; + +} library_list_t; + +#define MAX_LIB_COUNT 256 +static library_list_t liblist[MAX_LIB_COUNT]; +static u32 liblist_cnt; + +void read_library_information() { + +#if defined(__linux__) + FILE *f; + u8 buf[1024], *b, *m, *e, *n; + + if ((f = fopen("/proc/self/maps", "r")) == NULL) { + + fprintf(stderr, "Error: cannot open /proc/self/maps\n"); + exit(-1); + + } + + if (debug) fprintf(stderr, "Library list:\n"); + while (fgets(buf, sizeof(buf), f)) { + + if (strstr(buf, " r-x")) { + + if (liblist_cnt >= MAX_LIB_COUNT) { + + fprintf( + stderr, + "Warning: too many libraries to old, maximum count of %d reached\n", + liblist_cnt); + return; + + } + + b = buf; + m = index(buf, '-'); + e = index(buf, ' '); + if ((n = rindex(buf, '/')) == NULL) n = rindex(buf, ' '); + if (n && + ((*n >= '0' && *n <= '9') || *n == '[' || *n == '{' || *n == '(')) + n = NULL; + else + n++; + if (b && m && e && n && *n) { + + *m++ = 0; + *e = 0; + if (n[strlen(n) - 1] == '\n') n[strlen(n) - 1] = 0; + + if (rindex(n, '/') != NULL) { + + n = rindex(n, '/'); + n++; + + } + + liblist[liblist_cnt].name = strdup(n); + liblist[liblist_cnt].addr_start = strtoull(b, NULL, 16); + liblist[liblist_cnt].addr_end = strtoull(m, NULL, 16); + if (debug) + fprintf( + stderr, "%s:%llx (%llx-%llx)\n", liblist[liblist_cnt].name, + liblist[liblist_cnt].addr_end - liblist[liblist_cnt].addr_start, + liblist[liblist_cnt].addr_start, + liblist[liblist_cnt].addr_end - 1); + liblist_cnt++; + + } + + } + + } + + if (debug) fprintf(stderr, "\n"); + +#elif defined(__FreeBSD__) + int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid()}; + char * buf, *start, *end; + size_t miblen = sizeof(mib) / sizeof(mib[0]); + size_t len; + + if (debug) fprintf(stderr, "Library list:\n"); + if (sysctl(mib, miblen, NULL, &len, NULL, 0) == -1) { return; } + + len = len * 4 / 3; + + buf = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); + if (buf == MAP_FAILED) { return; } + if (sysctl(mib, miblen, buf, &len, NULL, 0) == -1) { + + munmap(buf, len); + return; + + } + + start = buf; + end = buf + len; + + while (start < end) { + + struct kinfo_vmentry *region = (struct kinfo_vmentry *)start; + size_t size = region->kve_structsize; + + if (size == 0) { break; } + + if ((region->kve_protection & KVME_PROT_READ) && + !(region->kve_protection & KVME_PROT_EXEC)) { + + liblist[liblist_cnt].name = + region->kve_path[0] != '\0' ? strdup(region->kve_path) : 0; + liblist[liblist_cnt].addr_start = region->kve_start; + liblist[liblist_cnt].addr_end = region->kve_end; + + if (debug) { + + fprintf(stderr, "%s:%x (%lx-%lx)\n", liblist[liblist_cnt].name, + liblist[liblist_cnt].addr_end - liblist[liblist_cnt].addr_start, + liblist[liblist_cnt].addr_start, + liblist[liblist_cnt].addr_end - 1); + + } + + liblist_cnt++; + + } + + start += size; + + } + +#endif + +} + +library_list_t *find_library(char *name) { + + char *filename = rindex(name, '/'); + + if (filename) + filename++; + else + filename = name; + +#if defined(__linux__) + u32 i; + for (i = 0; i < liblist_cnt; i++) + if (strcmp(liblist[i].name, filename) == 0) return &liblist[i]; +#elif defined(__APPLE__) && defined(__LP64__) + kern_return_t err; + static library_list_t lib; + + // get the list of all loaded modules from dyld + // the task_info mach API will get the address of the dyld all_image_info + // struct for the given task from which we can get the names and load + // addresses of all modules + task_dyld_info_data_t task_dyld_info; + mach_msg_type_number_t count = TASK_DYLD_INFO_COUNT; + err = task_info(mach_task_self(), TASK_DYLD_INFO, + (task_info_t)&task_dyld_info, &count); + + const struct dyld_all_image_infos *all_image_infos = + (const struct dyld_all_image_infos *)task_dyld_info.all_image_info_addr; + const struct dyld_image_info *image_infos = all_image_infos->infoArray; + + for (size_t i = 0; i < all_image_infos->infoArrayCount; i++) { + + const char * image_name = image_infos[i].imageFilePath; + mach_vm_address_t image_load_address = + (mach_vm_address_t)image_infos[i].imageLoadAddress; + if (strstr(image_name, name)) { + + lib.name = name; + lib.addr_start = (u64)image_load_address; + lib.addr_end = 0; + return &lib; + + } + + } + +#endif + + return NULL; + +} + +static void gum_fake_event_sink_process(GumEventSink * sink, + const GumEvent *ev) { + +} + +/* Because this CAN be called more than once, it will return the LAST range */ +static int enumerate_ranges(const GumRangeDetails *details, + gpointer user_data) { + + GumMemoryRange *code_range = (GumMemoryRange *)user_data; + memcpy(code_range, details->range, sizeof(*code_range)); + return 0; + +} + +int main() { + +#ifndef __APPLE__ + (void)personality(ADDR_NO_RANDOMIZE); // disable ASLR +#endif + + // STEP 2: load the library you want to fuzz and lookup the functions, + // inclusive of the cleanup functions. + // If there is just one function, then there is nothing to change + // or add here. + + void *dl = dlopen(TARGET_LIBRARY, RTLD_LAZY); + if (!dl) { + + fprintf(stderr, "Could not load %s\n", TARGET_LIBRARY); + exit(-1); + + } + + if (!(o_function = dlsym(dl, TARGET_FUNCTION))) { + + fprintf(stderr, "Could not find function %s\n", TARGET_FUNCTION); + exit(-1); + + } + + // END STEP 2 + + read_library_information(); + library_list_t *lib = find_library(TARGET_LIBRARY); + + if (lib == NULL) { + + fprintf(stderr, "Could not find target library\n"); + exit(-1); + + } + + gum_init_embedded(); + if (!gum_stalker_is_supported()) { + + gum_deinit_embedded(); + return 1; + + } + + GumStalker *stalker = gum_stalker_new(); + + /* + This does not work here as we load a shared library. pretty sure this + would also be easily solvable with frida gum, but I already have all the + code I need from afl-untracer + + GumAddress base_address = gum_module_find_base_address(TARGET_LIBRARY); + GumMemoryRange code_range; + gum_module_enumerate_ranges(TARGET_LIBRARY, GUM_PAGE_RX, enumerate_ranges, + &code_range); + guint64 code_start = code_range.base_address - base_address; + guint64 code_end = (code_range.base_address + code_range.size) - base_address; + range_t instr_range = {base_address, code_start, code_end}; + */ + range_t instr_range = {0, lib->addr_start, lib->addr_end}; + + GumStalkerTransformer *transformer = + gum_stalker_transformer_make_from_callback(instr_basic_block, + &instr_range, NULL); + + GumEventSink *event_sink = gum_fake_event_sink_new(); + + // to ensure that the signatures are not optimized out + memcpy(__afl_area_ptr, (void *)AFL_PERSISTENT, sizeof(AFL_PERSISTENT) + 1); + memcpy(__afl_area_ptr + 32, (void *)AFL_DEFER_FORKSVR, + sizeof(AFL_DEFER_FORKSVR) + 1); + __afl_manual_init(); + + // + // any expensive target library initialization that has to be done just once + // - put that here + // + + gum_stalker_follow_me(stalker, transformer, event_sink); + + while (__afl_persistent_loop(UINT32_MAX) != 0) { + + previous_pc = 0; // Required! + +#ifdef _DEBUG + fprintf(stderr, "CLIENT crc: %016llx len: %u\n", + hash64(__afl_fuzz_ptr, *__afl_fuzz_len), *__afl_fuzz_len); + fprintf(stderr, "RECV:"); + for (int i = 0; i < *__afl_fuzz_len; i++) + fprintf(stderr, "%02x", __afl_fuzz_ptr[i]); + fprintf(stderr, "\n"); +#endif + + // STEP 3: ensure the minimum length is present and setup the target + // function to fuzz. + + if (*__afl_fuzz_len > 0) { + + __afl_fuzz_ptr[*__afl_fuzz_len] = 0; // if you need to null terminate + (*o_function)(__afl_fuzz_ptr, *__afl_fuzz_len); + + } + + // END STEP 3 + + } + + gum_stalker_unfollow_me(stalker); + + while (gum_stalker_garbage_collect(stalker)) + g_usleep(10000); + + g_object_unref(stalker); + g_object_unref(transformer); + g_object_unref(event_sink); + gum_deinit_embedded(); + + return 0; + +} + diff --git a/utils/afl_frida/afl-frida.h b/utils/afl_frida/afl-frida.h new file mode 100644 index 00000000..efa3440f --- /dev/null +++ b/utils/afl_frida/afl-frida.h @@ -0,0 +1,53 @@ +extern int is_persistent; + +G_BEGIN_DECLS + +#define GUM_TYPE_FAKE_EVENT_SINK (gum_fake_event_sink_get_type()) + +G_DECLARE_FINAL_TYPE(GumFakeEventSink, gum_fake_event_sink, GUM, + FAKE_EVENT_SINK, GObject) + +struct _GumFakeEventSink { + + GObject parent; + GumEventType mask; + +}; + +GumEventSink *gum_fake_event_sink_new(void); +void gum_fake_event_sink_reset(GumFakeEventSink *self); + +G_END_DECLS + +typedef struct { + + GumAddress base_address; + guint64 code_start, code_end; + +} range_t; + +void instr_basic_block(GumStalkerIterator *iterator, GumStalkerOutput *output, + gpointer user_data); +#pragma once + +void afl_setup(void); +void afl_start_forkserver(void); +int __afl_persistent_loop(unsigned int max_cnt); + +inline static inline void afl_maybe_log(guint64 current_pc) { + + extern unsigned int afl_instr_rms; + extern uint8_t * afl_area_ptr; + + static __thread guint64 previous_pc; + + current_pc = (current_pc >> 4) ^ (current_pc << 8); + current_pc &= MAP_SIZE - 1; + + if (current_pc >= afl_instr_rms) return; + + afl_area_ptr[current_pc ^ previous_pc]++; + previous_pc = current_pc >> 1; + +} + diff --git a/utils/afl_frida/libtestinstr.c b/utils/afl_frida/libtestinstr.c new file mode 100644 index 00000000..96b1cf21 --- /dev/null +++ b/utils/afl_frida/libtestinstr.c @@ -0,0 +1,35 @@ +/* + american fuzzy lop++ - a trivial program to test the build + -------------------------------------------------------- + Originally written by Michal Zalewski + Copyright 2014 Google Inc. All rights reserved. + Copyright 2019-2020 AFLplusplus Project. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + http://www.apache.org/licenses/LICENSE-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include + +void testinstr(char *buf, int len) { + + if (len < 1) return; + buf[len] = 0; + + // we support three input cases + if (buf[0] == '0') + printf("Looks like a zero to me!\n"); + else if (buf[0] == '1') + printf("Pretty sure that is a one!\n"); + else + printf("Neither one or zero? How quaint!\n"); + +} + diff --git a/utils/afl_network_proxy/GNUmakefile b/utils/afl_network_proxy/GNUmakefile new file mode 100644 index 00000000..25a3df82 --- /dev/null +++ b/utils/afl_network_proxy/GNUmakefile @@ -0,0 +1,43 @@ +PREFIX ?= /usr/local +BIN_PATH = $(PREFIX)/bin +DOC_PATH = $(PREFIX)/share/doc/afl + +PROGRAMS = afl-network-client afl-network-server + +HASH=\# + +CFLAGS += -Wno-pointer-sign + +ifdef STATIC + CFLAGS += -static +endif + +ifeq "$(shell echo '$(HASH)include @int main() { struct libdeflate_compressor *d = libdeflate_alloc_compressor(1); return 0;}' | tr @ '\n' | $(CC) $(CFLAGS) -x c - -o .test2 -ldeflate 2>/dev/null && echo 1 || echo 0 ; rm -f .test2 )" "1" + CFLAGS += -DUSE_DEFLATE=1 + LDFLAGS += -ldeflate + $(info libdeflate-dev was detected, using compression) +else + $(warn did not find libdeflate-dev, cannot use compression) +endif + +all: $(PROGRAMS) + +help: + @echo make options: + @echo STATIC - build as static binaries + @echo COMPRESS_TESTCASES - compress test cases + +afl-network-client: afl-network-client.c + $(CC) $(CFLAGS) -I../../include -o afl-network-client afl-network-client.c $(LDFLAGS) + +afl-network-server: afl-network-server.c + $(CC) $(CFLAGS) -I../../include -o afl-network-server afl-network-server.c ../../src/afl-forkserver.c ../../src/afl-sharedmem.c ../../src/afl-common.c -DBIN_PATH=\"$(BIN_PATH)\" $(LDFLAGS) + +clean: + rm -f $(PROGRAMS) *~ core + +install: all + install -d -m 755 $${DESTDIR}$(BIN_PATH) $${DESTDIR}$(DOC_PATH) + install -m 755 $(PROGRAMS) $${DESTDIR}$(BIN_PATH) + install -T -m 644 README.md $${DESTDIR}$(DOC_PATH)/README.network_proxy.md + diff --git a/utils/afl_network_proxy/Makefile b/utils/afl_network_proxy/Makefile new file mode 100644 index 00000000..0b306dde --- /dev/null +++ b/utils/afl_network_proxy/Makefile @@ -0,0 +1,2 @@ +all: + @echo please use GNU make, thanks! diff --git a/utils/afl_network_proxy/README.md b/utils/afl_network_proxy/README.md new file mode 100644 index 00000000..a5ac3578 --- /dev/null +++ b/utils/afl_network_proxy/README.md @@ -0,0 +1,61 @@ +# afl-network-proxy + +If you want to run afl-fuzz over the network than this is what you need :) +Note that the impact on fuzzing speed will be huge, expect a loss of 90%. + +## When to use this + +1. when you have to fuzz a target that has to run on a system that cannot + contain the fuzzing output (e.g. /tmp too small and file system is read-only) +2. when the target instantly reboots on crashes +3. ... any other reason you would need this + +## how to get it running + +### Compiling + +Just type `make` and let the autodetection do everything for you. + +Note that you will get a 40-50% performance increase if you have libdeflate-dev +installed. The GNUmakefile will autodetect it if present. + +If your target has large test cases (10+kb) that are ascii only or large chunks +of zero blocks then set `CFLAGS=-DCOMPRESS_TESTCASES=1` to compress them. +For most targets this hurts performance though so it is disabled by default. + +### on the target + +Run `afl-network-server` with your target with the -m and -t values you need. +Important is the -i parameter which is the TCP port to listen on. +e.g.: +``` +afl-network-server -i 1111 -m 25M -t 1000 -- /bin/target -f @@ +``` + +### on the (afl-fuzz) master + +Just run afl-fuzz with your normal options, however the target should be +`afl-network-client` with the IP and PORT of the `afl-network-server` and +increase the -t value: +``` +afl-fuzz -i in -o out -t 2000+ -- afl-network-client TARGET-IP 1111 +``` +Note the '+' on the -t parameter value. The afl-network-server will take +care of proper timeouts hence afl-fuzz should not. The '+' increases the +timeout and the value itself should be 500-1000 higher than the one on +afl-network-server. + +### networking + +The TARGET can be an IPv4 or IPv6 address, or a host name that resolves to +either. Note that also the outgoing interface can be specified with a '%' for +`afl-network-client`, e.g. `fe80::1234%eth0`. + +Also make sure your default TCP window size is larger than your MAP_SIZE +(130kb is a good value). +On Linux that is the middle value of `/proc/sys/net/ipv4/tcp_rmem` + +## how to compile and install + +`make && sudo make install` + diff --git a/utils/afl_network_proxy/afl-network-client.c b/utils/afl_network_proxy/afl-network-client.c new file mode 100644 index 00000000..a2451fdc --- /dev/null +++ b/utils/afl_network_proxy/afl-network-client.c @@ -0,0 +1,415 @@ +/* + american fuzzy lop++ - afl-network-client + --------------------------------------- + + Written by Marc Heuse + + Copyright 2019-2020 AFLplusplus Project. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + +*/ + +#ifdef __ANDROID__ + #include "android-ashmem.h" +#endif +#include "config.h" +#include "types.h" +#include "debug.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#ifndef USEMMAP + #include +#endif +#include +#include +#include +#include +#include + +#ifdef USE_DEFLATE + #include +#endif + +u8 *__afl_area_ptr; + +#ifdef __ANDROID__ +u32 __afl_map_size = MAP_SIZE; +#else +__thread u32 __afl_map_size = MAP_SIZE; +#endif + +/* Error reporting to forkserver controller */ + +void send_forkserver_error(int error) { + + u32 status; + if (!error || error > 0xffff) return; + status = (FS_OPT_ERROR | FS_OPT_SET_ERROR(error)); + if (write(FORKSRV_FD + 1, (char *)&status, 4) != 4) return; + +} + +/* SHM setup. */ + +static void __afl_map_shm(void) { + + char *id_str = getenv(SHM_ENV_VAR); + char *ptr; + + if ((ptr = getenv("AFL_MAP_SIZE")) != NULL) { + + u32 val = atoi(ptr); + if (val > 0) __afl_map_size = val; + + } + + if (__afl_map_size > MAP_SIZE) { + + if (__afl_map_size > FS_OPT_MAX_MAPSIZE) { + + fprintf(stderr, + "Error: AFL++ tools *require* to set AFL_MAP_SIZE to %u to " + "be able to run this instrumented program!\n", + __afl_map_size); + if (id_str) { + + send_forkserver_error(FS_ERROR_MAP_SIZE); + exit(-1); + + } + + } else { + + fprintf(stderr, + "Warning: AFL++ tools will need to set AFL_MAP_SIZE to %u to " + "be able to run this instrumented program!\n", + __afl_map_size); + + } + + } + + if (id_str) { + +#ifdef USEMMAP + const char * shm_file_path = id_str; + int shm_fd = -1; + unsigned char *shm_base = NULL; + + /* create the shared memory segment as if it was a file */ + shm_fd = shm_open(shm_file_path, O_RDWR, 0600); + if (shm_fd == -1) { + + fprintf(stderr, "shm_open() failed\n"); + send_forkserver_error(FS_ERROR_SHM_OPEN); + exit(1); + + } + + /* map the shared memory segment to the address space of the process */ + shm_base = + mmap(0, __afl_map_size, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0); + + if (shm_base == MAP_FAILED) { + + close(shm_fd); + shm_fd = -1; + + fprintf(stderr, "mmap() failed\n"); + send_forkserver_error(FS_ERROR_MMAP); + exit(2); + + } + + __afl_area_ptr = shm_base; +#else + u32 shm_id = atoi(id_str); + + __afl_area_ptr = shmat(shm_id, 0, 0); + +#endif + + if (__afl_area_ptr == (void *)-1) { + + send_forkserver_error(FS_ERROR_SHMAT); + exit(1); + + } + + /* Write something into the bitmap so that the parent doesn't give up */ + + __afl_area_ptr[0] = 1; + + } + +} + +/* Fork server logic. */ + +static void __afl_start_forkserver(void) { + + u8 tmp[4] = {0, 0, 0, 0}; + u32 status = 0; + + if (__afl_map_size <= FS_OPT_MAX_MAPSIZE) + status |= (FS_OPT_SET_MAPSIZE(__afl_map_size) | FS_OPT_MAPSIZE); + if (status) status |= (FS_OPT_ENABLED); + memcpy(tmp, &status, 4); + + /* Phone home and tell the parent that we're OK. */ + + if (write(FORKSRV_FD + 1, tmp, 4) != 4) return; + +} + +static u32 __afl_next_testcase(u8 *buf, u32 max_len) { + + s32 status, res = 0x0fffffff; // res is a dummy pid + + /* Wait for parent by reading from the pipe. Abort if read fails. */ + if (read(FORKSRV_FD, &status, 4) != 4) return 0; + + /* we have a testcase - read it */ + status = read(0, buf, max_len); + + /* report that we are starting the target */ + if (write(FORKSRV_FD + 1, &res, 4) != 4) return 0; + + if (status < 1) + return 0; + else + return status; + +} + +static void __afl_end_testcase(int status) { + + if (write(FORKSRV_FD + 1, &status, 4) != 4) exit(1); + +} + +/* you just need to modify the while() loop in this main() */ + +int main(int argc, char *argv[]) { + + u8 * interface, *buf, *ptr; + s32 s = -1; + struct addrinfo hints, *hres, *aip; + u32 * lenptr, max_len = 65536; +#ifdef USE_DEFLATE + u8 * buf2; + u32 * lenptr1, *lenptr2, buf2_len, compress_len; + size_t decompress_len; +#endif + + if (argc < 3 || argc > 4) { + + printf("Syntax: %s host port [max-input-size]\n\n", argv[0]); + printf("Requires host and port of the remote afl-proxy-server instance.\n"); + printf( + "IPv4 and IPv6 are supported, also binding to an interface with " + "\"%%\"\n"); + printf("The max-input-size default is %u.\n", max_len); + printf( + "The default map size is %u and can be changed with setting " + "AFL_MAP_SIZE.\n", + __afl_map_size); + exit(-1); + + } + + if ((interface = strchr(argv[1], '%')) != NULL) *interface++ = 0; + + if (argc > 3) + if ((max_len = atoi(argv[3])) < 0) + FATAL("max-input-size may not be negative or larger than 2GB: %s", + argv[3]); + + if ((ptr = getenv("AFL_MAP_SIZE")) != NULL) + if ((__afl_map_size = atoi(ptr)) < 8) + FATAL("illegal map size, may not be < 8 or >= 2^30: %s", ptr); + + if ((buf = malloc(max_len + 4)) == NULL) + PFATAL("can not allocate %u memory", max_len + 4); + lenptr = (u32 *)buf; + +#ifdef USE_DEFLATE + buf2_len = (max_len > __afl_map_size ? max_len : __afl_map_size); + if ((buf2 = malloc(buf2_len + 8)) == NULL) + PFATAL("can not allocate %u memory", buf2_len + 8); + lenptr1 = (u32 *)buf2; + lenptr2 = (u32 *)(buf2 + 4); +#endif + + memset(&hints, 0, sizeof(hints)); + hints.ai_socktype = SOCK_STREAM; + hints.ai_family = PF_UNSPEC; + + if (getaddrinfo(argv[1], argv[2], &hints, &hres) != 0) + PFATAL("could not resolve target %s", argv[1]); + + for (aip = hres; aip != NULL && s == -1; aip = aip->ai_next) { + + if ((s = socket(aip->ai_family, aip->ai_socktype, aip->ai_protocol)) >= 0) { + +#ifdef SO_BINDTODEVICE + if (interface != NULL) + if (setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, interface, + strlen(interface) + 1) < 0) + fprintf(stderr, "Warning: could not bind to device %s\n", interface); +#else + fprintf(stderr, + "Warning: binding to interface is not supported for your OS\n"); +#endif + +#ifdef SO_PRIORITY + int priority = 7; + if (setsockopt(s, SOL_SOCKET, SO_PRIORITY, &priority, sizeof(priority)) < + 0) { + + priority = 6; + if (setsockopt(s, SOL_SOCKET, SO_PRIORITY, &priority, + sizeof(priority)) < 0) + WARNF("could not set priority on socket"); + + } + +#endif + + if (connect(s, aip->ai_addr, aip->ai_addrlen) == -1) s = -1; + + } + + } + +#ifdef USE_DEFLATE + struct libdeflate_compressor *compressor; + compressor = libdeflate_alloc_compressor(1); + struct libdeflate_decompressor *decompressor; + decompressor = libdeflate_alloc_decompressor(); + fprintf(stderr, "Compiled with compression support\n"); +#endif + + if (s == -1) + FATAL("could not connect to target tcp://%s:%s", argv[1], argv[2]); + else + fprintf(stderr, "Connected to target tcp://%s:%s\n", argv[1], argv[2]); + + /* we initialize the shared memory map and start the forkserver */ + __afl_map_shm(); + __afl_start_forkserver(); + + int i = 1, j, status, ret, received; + + // fprintf(stderr, "Waiting for first testcase\n"); + while ((*lenptr = __afl_next_testcase(buf + 4, max_len)) > 0) { + + // fprintf(stderr, "Sending testcase with len %u\n", *lenptr); +#ifdef USE_DEFLATE + #ifdef COMPRESS_TESTCASES + // we only compress the testcase if it does not fit in the TCP packet + if (*lenptr > 1500 - 20 - 32 - 4) { + + // set highest byte to signify compression + *lenptr1 = (*lenptr | 0xff000000); + *lenptr2 = (u32)libdeflate_deflate_compress(compressor, buf + 4, *lenptr, + buf2 + 8, buf2_len); + if (send(s, buf2, *lenptr2 + 8, 0) != *lenptr2 + 8) + PFATAL("sending test data failed"); + // fprintf(stderr, "COMPRESS (%u->%u):\n", *lenptr, *lenptr2); + // for (u32 i = 0; i < *lenptr; i++) + // fprintf(stderr, "%02x", buf[i + 4]); + // fprintf(stderr, "\n"); + // for (u32 i = 0; i < *lenptr2; i++) + // fprintf(stderr, "%02x", buf2[i + 8]); + // fprintf(stderr, "\n"); + + } else { + + #endif +#endif + if (send(s, buf, *lenptr + 4, 0) != *lenptr + 4) + PFATAL("sending test data failed"); +#ifdef USE_DEFLATE + #ifdef COMPRESS_TESTCASES + // fprintf(stderr, "unCOMPRESS (%u)\n", *lenptr); + + } + + #endif +#endif + + received = 0; + while (received < 4 && + (ret = recv(s, &status + received, 4 - received, 0)) > 0) + received += ret; + if (received != 4) + FATAL("did not receive waitpid data (%d, %d)", received, ret); + // fprintf(stderr, "Received status\n"); + + received = 0; +#ifdef USE_DEFLATE + while (received < 4 && + (ret = recv(s, &compress_len + received, 4 - received, 0)) > 0) + received += ret; + if (received != 4) + FATAL("did not receive compress_len (%d, %d)", received, ret); + // fprintf(stderr, "Received status\n"); + + received = 0; + while (received < compress_len && + (ret = recv(s, buf2 + received, buf2_len - received, 0)) > 0) + received += ret; + if (received != compress_len) + FATAL("did not receive coverage data (%d, %d)", received, ret); + + if (libdeflate_deflate_decompress(decompressor, buf2, compress_len, + __afl_area_ptr, __afl_map_size, + &decompress_len) != LIBDEFLATE_SUCCESS || + decompress_len != __afl_map_size) + FATAL("decompression failed"); + // fprintf(stderr, "DECOMPRESS (%u->%u): ", compress_len, decompress_len); + // for (u32 i = 0; i < __afl_map_size; i++) fprintf(stderr, "%02x", + // __afl_area_ptr[i]); fprintf(stderr, "\n"); +#else + while (received < __afl_map_size && + (ret = recv(s, __afl_area_ptr + received, __afl_map_size - received, + 0)) > 0) + received += ret; + if (received != __afl_map_size) + FATAL("did not receive coverage data (%d, %d)", received, ret); +#endif + // fprintf(stderr, "Received coverage\n"); + + /* report the test case is done and wait for the next */ + __afl_end_testcase(status); + // fprintf(stderr, "Waiting for next testcase %d\n", ++i); + + } + +#ifdef USE_DEFLATE + libdeflate_free_compressor(compressor); + libdeflate_free_decompressor(decompressor); +#endif + + return 0; + +} + diff --git a/utils/afl_network_proxy/afl-network-server.c b/utils/afl_network_proxy/afl-network-server.c new file mode 100644 index 00000000..513dc8f2 --- /dev/null +++ b/utils/afl_network_proxy/afl-network-server.c @@ -0,0 +1,720 @@ +/* + american fuzzy lop++ - network proxy server + ------------------------------------------- + + Originally written by Michal Zalewski + + Forkserver design by Jann Horn + + Now maintained by Marc Heuse , + Heiko Eißfeldt and + Andrea Fioraldi and + Dominik Maier + + Copyright 2016, 2017 Google Inc. All rights reserved. + Copyright 2019-2020 AFLplusplus Project. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + */ + +#define AFL_MAIN + +#ifdef __ANDROID__ + #include "android-ashmem.h" +#endif + +#include "config.h" +#include "types.h" +#include "debug.h" +#include "alloc-inl.h" +#include "hash.h" +#include "forkserver.h" +#include "sharedmem.h" +#include "common.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef USE_DEFLATE + #include +struct libdeflate_compressor * compressor; +struct libdeflate_decompressor *decompressor; +#endif + +static u8 *in_file, /* Minimizer input test case */ + *out_file; + +static u8 *in_data; /* Input data for trimming */ +static u8 *buf2; + +static s32 in_len; +static s32 buf2_len; +static u32 map_size = MAP_SIZE; + +static volatile u8 stop_soon; /* Ctrl-C pressed? */ + +/* See if any bytes are set in the bitmap. */ + +static inline u8 anything_set(afl_forkserver_t *fsrv) { + + u32 *ptr = (u32 *)fsrv->trace_bits; + u32 i = (map_size >> 2); + + while (i--) { + + if (*(ptr++)) { return 1; } + + } + + return 0; + +} + +static void at_exit_handler(void) { + + afl_fsrv_killall(); + +} + +/* Write output file. */ + +static s32 write_to_file(u8 *path, u8 *mem, u32 len) { + + s32 ret; + + unlink(path); /* Ignore errors */ + + ret = open(path, O_RDWR | O_CREAT | O_EXCL, 0600); + + if (ret < 0) { PFATAL("Unable to create '%s'", path); } + + ck_write(ret, mem, len, path); + + lseek(ret, 0, SEEK_SET); + + return ret; + +} + +/* Execute target application. Returns 0 if the changes are a dud, or + 1 if they should be kept. */ + +static u8 run_target(afl_forkserver_t *fsrv, char **argv, u8 *mem, u32 len, + u8 first_run) { + + afl_fsrv_write_to_testcase(fsrv, mem, len); + + fsrv_run_result_t ret = + afl_fsrv_run_target(fsrv, fsrv->exec_tmout, &stop_soon); + + if (ret == FSRV_RUN_ERROR) { FATAL("Couldn't run child"); } + + if (stop_soon) { + + SAYF(cRST cLRD "\n+++ aborted by user +++\n" cRST); + exit(1); + + } + + return ret; + +} + +/* Handle Ctrl-C and the like. */ + +static void handle_stop_sig(int sig) { + + stop_soon = 1; + afl_fsrv_killall(); + +} + +/* Do basic preparations - persistent fds, filenames, etc. */ + +static void set_up_environment(afl_forkserver_t *fsrv) { + + u8 *x; + + fsrv->dev_null_fd = open("/dev/null", O_RDWR); + if (fsrv->dev_null_fd < 0) { PFATAL("Unable to open /dev/null"); } + + if (!out_file) { + + u8 *use_dir = "."; + + if (access(use_dir, R_OK | W_OK | X_OK)) { + + use_dir = get_afl_env("TMPDIR"); + if (!use_dir) { use_dir = "/tmp"; } + + } + + out_file = alloc_printf("%s/.afl-input-temp-%u", use_dir, getpid()); + + } + + unlink(out_file); + + fsrv->out_fd = open(out_file, O_RDWR | O_CREAT | O_EXCL, 0600); + + if (fsrv->out_fd < 0) { PFATAL("Unable to create '%s'", out_file); } + + /* Set sane defaults... */ + + x = get_afl_env("ASAN_OPTIONS"); + + if (x) { + + if (!strstr(x, "abort_on_error=1")) { + + FATAL("Custom ASAN_OPTIONS set without abort_on_error=1 - please fix!"); + + } + + if (!strstr(x, "symbolize=0")) { + + FATAL("Custom ASAN_OPTIONS set without symbolize=0 - please fix!"); + + } + + } + + x = get_afl_env("MSAN_OPTIONS"); + + if (x) { + + if (!strstr(x, "exit_code=" STRINGIFY(MSAN_ERROR))) { + + FATAL("Custom MSAN_OPTIONS set without exit_code=" STRINGIFY( + MSAN_ERROR) " - please fix!"); + + } + + if (!strstr(x, "symbolize=0")) { + + FATAL("Custom MSAN_OPTIONS set without symbolize=0 - please fix!"); + + } + + } + + setenv("ASAN_OPTIONS", + "abort_on_error=1:" + "detect_leaks=0:" + "symbolize=0:" + "allocator_may_return_null=1", + 0); + + setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":" + "symbolize=0:" + "abort_on_error=1:" + "allocator_may_return_null=1:" + "msan_track_origins=0", 0); + + if (get_afl_env("AFL_PRELOAD")) { + + if (fsrv->qemu_mode) { + + u8 *qemu_preload = getenv("QEMU_SET_ENV"); + u8 *afl_preload = getenv("AFL_PRELOAD"); + u8 *buf; + + s32 i, afl_preload_size = strlen(afl_preload); + for (i = 0; i < afl_preload_size; ++i) { + + if (afl_preload[i] == ',') { + + PFATAL( + "Comma (',') is not allowed in AFL_PRELOAD when -Q is " + "specified!"); + + } + + } + + if (qemu_preload) { + + buf = alloc_printf("%s,LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", + qemu_preload, afl_preload, afl_preload); + + } else { + + buf = alloc_printf("LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", + afl_preload, afl_preload); + + } + + setenv("QEMU_SET_ENV", buf, 1); + + afl_free(buf); + + } else { + + setenv("LD_PRELOAD", getenv("AFL_PRELOAD"), 1); + setenv("DYLD_INSERT_LIBRARIES", getenv("AFL_PRELOAD"), 1); + + } + + } + +} + +/* Setup signal handlers, duh. */ + +static void setup_signal_handlers(void) { + + struct sigaction sa; + + sa.sa_handler = NULL; + sa.sa_flags = SA_RESTART; + sa.sa_sigaction = NULL; + + sigemptyset(&sa.sa_mask); + + /* Various ways of saying "stop". */ + + sa.sa_handler = handle_stop_sig; + sigaction(SIGHUP, &sa, NULL); + sigaction(SIGINT, &sa, NULL); + sigaction(SIGTERM, &sa, NULL); + +} + +/* Display usage hints. */ + +static void usage(u8 *argv0) { + + SAYF( + "\n%s [ options ] -- /path/to/target_app [ ... ]\n\n" + + "Required parameters:\n" + + " -i port - the port to listen for the client to connect to\n\n" + + "Execution control settings:\n" + + " -f file - input file read by the tested program (stdin)\n" + " -t msec - timeout for each run (%d ms)\n" + " -m megs - memory limit for child process (%d MB)\n" + " -Q - use binary-only instrumentation (QEMU mode)\n" + " -U - use unicorn-based instrumentation (Unicorn mode)\n" + " -W - use qemu-based instrumentation with Wine (Wine " + "mode)\n\n" + + "Environment variables used:\n" + "TMPDIR: directory to use for temporary input files\n" + "ASAN_OPTIONS: custom settings for ASAN\n" + " (must contain abort_on_error=1 and symbolize=0)\n" + "MSAN_OPTIONS: custom settings for MSAN\n" + " (must contain exitcode="STRINGIFY(MSAN_ERROR)" and symbolize=0)\n" + "AFL_MAP_SIZE: the shared memory size for that target. must be >= the size\n" + " the target was compiled for\n" + "AFL_PRELOAD: LD_PRELOAD / DYLD_INSERT_LIBRARIES settings for target\n" + + , argv0, EXEC_TIMEOUT, MEM_LIMIT); + + exit(1); + +} + +int recv_testcase(int s, void **buf) { + + u32 size; + s32 ret; + size_t received; + + received = 0; + while (received < 4 && (ret = recv(s, &size + received, 4 - received, 0)) > 0) + received += ret; + if (received != 4) FATAL("did not receive size information"); + if (size == 0) FATAL("did not receive valid size information"); + // fprintf(stderr, "received size information of %d\n", size); + + if ((size & 0xff000000) != 0xff000000) { + + *buf = afl_realloc(buf, size); + if (unlikely(!*buf)) { PFATAL("Alloc"); } + received = 0; + // fprintf(stderr, "unCOMPRESS (%u)\n", size); + while (received < size && + (ret = recv(s, ((char *)*buf) + received, size - received, 0)) > 0) + received += ret; + + } else { + +#ifdef USE_DEFLATE + u32 clen; + size -= 0xff000000; + *buf = afl_realloc(buf, size); + if (unlikely(!*buf)) { PFATAL("Alloc"); } + received = 0; + while (received < 4 && + (ret = recv(s, &clen + received, 4 - received, 0)) > 0) + received += ret; + if (received != 4) FATAL("did not receive clen1 information"); + // fprintf(stderr, "received clen information of %d\n", clen); + if (clen < 1) + FATAL("did not receive valid compressed len information: %u", clen); + buf2 = afl_realloc((void **)&buf2, clen); + buf2_len = clen; + if (unlikely(!buf2)) { PFATAL("Alloc"); } + received = 0; + while (received < clen && + (ret = recv(s, buf2 + received, clen - received, 0)) > 0) + received += ret; + if (received != clen) FATAL("did not receive compressed information"); + if (libdeflate_deflate_decompress(decompressor, buf2, clen, (char *)*buf, + size, &received) != LIBDEFLATE_SUCCESS) + FATAL("decompression failed"); + // fprintf(stderr, "DECOMPRESS (%u->%u):\n", clen, received); + // for (u32 i = 0; i < clen; i++) fprintf(stderr, "%02x", buf2[i]); + // fprintf(stderr, "\n"); + // for (u32 i = 0; i < received; i++) fprintf(stderr, "%02x", + // ((u8*)(*buf))[i]); fprintf(stderr, "\n"); +#else + FATAL("Received compressed data but not compiled with compression support"); +#endif + + } + + // fprintf(stderr, "receiving testcase %p %p max %u\n", buf, *buf, *max_len); + if (received != size) + FATAL("did not receive testcase data %lu != %u, %d", received, size, ret); + // fprintf(stderr, "received testcase\n"); + return size; + +} + +/* Main entry point */ + +int main(int argc, char **argv_orig, char **envp) { + + s32 opt, s, sock, on = 1, port = -1; + u8 mem_limit_given = 0, timeout_given = 0, unicorn_mode = 0, use_wine = 0; + char **use_argv; + struct sockaddr_in6 serveraddr, clientaddr; + int addrlen = sizeof(clientaddr); + char str[INET6_ADDRSTRLEN]; + char ** argv = argv_cpy_dup(argc, argv_orig); + u8 * send_buf; +#ifdef USE_DEFLATE + u32 *lenptr; +#endif + + afl_forkserver_t fsrv_var = {0}; + afl_forkserver_t *fsrv = &fsrv_var; + afl_fsrv_init(fsrv); + map_size = get_map_size(); + fsrv->map_size = map_size; + + if ((send_buf = malloc(map_size + 4)) == NULL) PFATAL("malloc"); + + while ((opt = getopt(argc, argv, "+i:f:m:t:QUWh")) > 0) { + + switch (opt) { + + case 'i': + + if (port > 0) { FATAL("Multiple -i options not supported"); } + port = atoi(optarg); + if (port < 1 || port > 65535) + FATAL("invalid port definition, must be between 1-65535: %s", optarg); + break; + + case 'f': + + if (out_file) { FATAL("Multiple -f options not supported"); } + fsrv->use_stdin = 0; + out_file = optarg; + break; + + case 'm': { + + u8 suffix = 'M'; + + if (mem_limit_given) { FATAL("Multiple -m options not supported"); } + mem_limit_given = 1; + + if (!optarg) { FATAL("Wrong usage of -m"); } + + if (!strcmp(optarg, "none")) { + + fsrv->mem_limit = 0; + break; + + } + + if (sscanf(optarg, "%llu%c", &fsrv->mem_limit, &suffix) < 1 || + optarg[0] == '-') { + + FATAL("Bad syntax used for -m"); + + } + + switch (suffix) { + + case 'T': + fsrv->mem_limit *= 1024 * 1024; + break; + case 'G': + fsrv->mem_limit *= 1024; + break; + case 'k': + fsrv->mem_limit /= 1024; + break; + case 'M': + break; + + default: + FATAL("Unsupported suffix or bad syntax for -m"); + + } + + if (fsrv->mem_limit < 5) { FATAL("Dangerously low value of -m"); } + + if (sizeof(rlim_t) == 4 && fsrv->mem_limit > 2000) { + + FATAL("Value of -m out of range on 32-bit systems"); + + } + + } + + break; + + case 't': + + if (timeout_given) { FATAL("Multiple -t options not supported"); } + timeout_given = 1; + + if (!optarg) { FATAL("Wrong usage of -t"); } + + fsrv->exec_tmout = atoi(optarg); + + if (fsrv->exec_tmout < 10 || optarg[0] == '-') { + + FATAL("Dangerously low value of -t"); + + } + + break; + + case 'Q': + + if (fsrv->qemu_mode) { FATAL("Multiple -Q options not supported"); } + if (!mem_limit_given) { fsrv->mem_limit = MEM_LIMIT_QEMU; } + + fsrv->qemu_mode = 1; + break; + + case 'U': + + if (unicorn_mode) { FATAL("Multiple -Q options not supported"); } + if (!mem_limit_given) { fsrv->mem_limit = MEM_LIMIT_UNICORN; } + + unicorn_mode = 1; + break; + + case 'W': /* Wine+QEMU mode */ + + if (use_wine) { FATAL("Multiple -W options not supported"); } + fsrv->qemu_mode = 1; + use_wine = 1; + + if (!mem_limit_given) { fsrv->mem_limit = 0; } + + break; + + case 'h': + usage(argv[0]); + return -1; + break; + + default: + usage(argv[0]); + + } + + } + + if (optind == argc || port < 1) { usage(argv[0]); } + + check_environment_vars(envp); + + sharedmem_t shm = {0}; + fsrv->trace_bits = afl_shm_init(&shm, map_size, 0); + + in_data = afl_realloc((void **)&in_data, 65536); + if (unlikely(!in_data)) { PFATAL("Alloc"); } + + atexit(at_exit_handler); + setup_signal_handlers(); + + set_up_environment(fsrv); + + fsrv->target_path = find_binary(argv[optind]); + detect_file_args(argv + optind, out_file, &fsrv->use_stdin); + + if (fsrv->qemu_mode) { + + if (use_wine) { + + use_argv = get_wine_argv(argv[0], &fsrv->target_path, argc - optind, + argv + optind); + + } else { + + use_argv = get_qemu_argv(argv[0], &fsrv->target_path, argc - optind, + argv + optind); + + } + + } else { + + use_argv = argv + optind; + + } + + if ((sock = socket(AF_INET6, SOCK_STREAM, 0)) < 0) PFATAL("socket() failed"); + +#ifdef SO_REUSEADDR + if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0) { + + WARNF("setsockopt(SO_REUSEADDR) failed"); + + } + +#endif + +#ifdef SO_PRIORITY + int priority = 7; + if (setsockopt(sock, SOL_SOCKET, SO_PRIORITY, &priority, sizeof(priority)) < + 0) { + + priority = 6; + if (setsockopt(sock, SOL_SOCKET, SO_PRIORITY, &priority, sizeof(priority)) < + 0) + WARNF("could not set priority on socket"); + + } + +#endif + + memset(&serveraddr, 0, sizeof(serveraddr)); + serveraddr.sin6_family = AF_INET6; + serveraddr.sin6_port = htons(port); + serveraddr.sin6_addr = in6addr_any; + + if (bind(sock, (struct sockaddr *)&serveraddr, sizeof(serveraddr)) < 0) + PFATAL("bind() failed"); + + if (listen(sock, 1) < 0) { PFATAL("listen() failed"); } + + afl_fsrv_start( + fsrv, use_argv, &stop_soon, + (get_afl_env("AFL_DEBUG_CHILD") || get_afl_env("AFL_DEBUG_CHILD_OUTPUT")) + ? 1 + : 0); + +#ifdef USE_DEFLATE + compressor = libdeflate_alloc_compressor(1); + decompressor = libdeflate_alloc_decompressor(); + buf2 = afl_realloc((void **)&buf2, map_size + 16); + buf2_len = map_size + 16; + if (unlikely(!buf2)) { PFATAL("alloc"); } + lenptr = (u32 *)(buf2 + 4); + fprintf(stderr, "Compiled with compression support\n"); +#endif + + fprintf(stderr, + "Waiting for incoming connection from afl-network-client on port %d " + "...\n", + port); + + if ((s = accept(sock, NULL, NULL)) < 0) { PFATAL("accept() failed"); } + fprintf(stderr, "Received connection, starting ...\n"); + +#ifdef SO_PRIORITY + priority = 7; + if (setsockopt(s, SOL_SOCKET, SO_PRIORITY, &priority, sizeof(priority)) < 0) { + + priority = 6; + if (setsockopt(s, SOL_SOCKET, SO_PRIORITY, &priority, sizeof(priority)) < 0) + WARNF("could not set priority on socket"); + + } + +#endif + + while ((in_len = recv_testcase(s, (void **)&in_data)) > 0) { + + // fprintf(stderr, "received %u\n", in_len); + (void)run_target(fsrv, use_argv, in_data, in_len, 1); + + memcpy(send_buf + 4, fsrv->trace_bits, fsrv->map_size); + +#ifdef USE_DEFLATE + memcpy(buf2, &fsrv->child_status, 4); + *lenptr = (u32)libdeflate_deflate_compress( + compressor, send_buf + 4, fsrv->map_size, buf2 + 8, buf2_len - 8); + // fprintf(stderr, "COMPRESS (%u->%u): ", fsrv->map_size, *lenptr); + // for (u32 i = 0; i < fsrv->map_size; i++) fprintf(stderr, "%02x", + // fsrv->trace_bits[i]); fprintf(stderr, "\n"); + if (send(s, buf2, *lenptr + 8, 0) != 8 + *lenptr) + FATAL("could not send data"); +#else + memcpy(send_buf, &fsrv->child_status, 4); + if (send(s, send_buf, fsrv->map_size + 4, 0) != 4 + fsrv->map_size) + FATAL("could not send data"); +#endif + + // fprintf(stderr, "sent result\n"); + + } + + unlink(out_file); + if (out_file) { ck_free(out_file); } + out_file = NULL; + + afl_shm_deinit(&shm); + afl_fsrv_deinit(fsrv); + if (fsrv->target_path) { ck_free(fsrv->target_path); } + afl_free(in_data); +#if USE_DEFLATE + afl_free(buf2); + libdeflate_free_compressor(compressor); + libdeflate_free_decompressor(decompressor); +#endif + + argv_cpy_free(argv); + + exit(0); + +} + diff --git a/utils/afl_proxy/Makefile b/utils/afl_proxy/Makefile new file mode 100644 index 00000000..4b368f8d --- /dev/null +++ b/utils/afl_proxy/Makefile @@ -0,0 +1,7 @@ +all: afl-proxy + +afl-proxy: afl-proxy.c + $(CC) -I../../include -o afl-proxy afl-proxy.c + +clean: + rm -f afl-proxy *~ core diff --git a/utils/afl_proxy/README.md b/utils/afl_proxy/README.md new file mode 100644 index 00000000..3c768a19 --- /dev/null +++ b/utils/afl_proxy/README.md @@ -0,0 +1,9 @@ +# afl-proxy + +afl-proxy is an example skeleton file which can easily be used to fuzz +and instrument non-standard things. + +You only need to change the while() loop of the main() to send the +data of buf[] with length len to the target and write the coverage +information to __afl_area_ptr[__afl_map_size] + diff --git a/utils/afl_proxy/afl-proxy.c b/utils/afl_proxy/afl-proxy.c new file mode 100644 index 00000000..f2dfeac1 --- /dev/null +++ b/utils/afl_proxy/afl-proxy.c @@ -0,0 +1,238 @@ +/* + american fuzzy lop++ - afl-proxy skeleton example + --------------------------------------------------- + + Written by Marc Heuse + + Copyright 2019-2020 AFLplusplus Project. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + + HOW-TO + ====== + + You only need to change the while() loop of the main() to send the + data of buf[] with length len to the target and write the coverage + information to __afl_area_ptr[__afl_map_size] + + +*/ + +#ifdef __ANDROID__ + #include "android-ashmem.h" +#endif +#include "config.h" +#include "types.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +u8 *__afl_area_ptr; + +#ifdef __ANDROID__ +u32 __afl_map_size = MAP_SIZE; +#else +__thread u32 __afl_map_size = MAP_SIZE; +#endif + +/* Error reporting to forkserver controller */ + +void send_forkserver_error(int error) { + + u32 status; + if (!error || error > 0xffff) return; + status = (FS_OPT_ERROR | FS_OPT_SET_ERROR(error)); + if (write(FORKSRV_FD + 1, (char *)&status, 4) != 4) return; + +} + +/* SHM setup. */ + +static void __afl_map_shm(void) { + + char *id_str = getenv(SHM_ENV_VAR); + char *ptr; + + if ((ptr = getenv("AFL_MAP_SIZE")) != NULL) { + + u32 val = atoi(ptr); + if (val > 0) __afl_map_size = val; + + } + + if (__afl_map_size > MAP_SIZE) { + + if (__afl_map_size > FS_OPT_MAX_MAPSIZE) { + + fprintf(stderr, + "Error: AFL++ tools *require* to set AFL_MAP_SIZE to %u to " + "be able to run this instrumented program!\n", + __afl_map_size); + if (id_str) { + + send_forkserver_error(FS_ERROR_MAP_SIZE); + exit(-1); + + } + + } else { + + fprintf(stderr, + "Warning: AFL++ tools will need to set AFL_MAP_SIZE to %u to " + "be able to run this instrumented program!\n", + __afl_map_size); + + } + + } + + if (id_str) { + +#ifdef USEMMAP + const char * shm_file_path = id_str; + int shm_fd = -1; + unsigned char *shm_base = NULL; + + /* create the shared memory segment as if it was a file */ + shm_fd = shm_open(shm_file_path, O_RDWR, 0600); + if (shm_fd == -1) { + + fprintf(stderr, "shm_open() failed\n"); + send_forkserver_error(FS_ERROR_SHM_OPEN); + exit(1); + + } + + /* map the shared memory segment to the address space of the process */ + shm_base = + mmap(0, __afl_map_size, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0); + + if (shm_base == MAP_FAILED) { + + close(shm_fd); + shm_fd = -1; + + fprintf(stderr, "mmap() failed\n"); + send_forkserver_error(FS_ERROR_MMAP); + exit(2); + + } + + __afl_area_ptr = shm_base; +#else + u32 shm_id = atoi(id_str); + + __afl_area_ptr = shmat(shm_id, 0, 0); + +#endif + + if (__afl_area_ptr == (void *)-1) { + + send_forkserver_error(FS_ERROR_SHMAT); + exit(1); + + } + + /* Write something into the bitmap so that the parent doesn't give up */ + + __afl_area_ptr[0] = 1; + + } + +} + +/* Fork server logic. */ + +static void __afl_start_forkserver(void) { + + u8 tmp[4] = {0, 0, 0, 0}; + u32 status = 0; + + if (__afl_map_size <= FS_OPT_MAX_MAPSIZE) + status |= (FS_OPT_SET_MAPSIZE(__afl_map_size) | FS_OPT_MAPSIZE); + if (status) status |= (FS_OPT_ENABLED); + memcpy(tmp, &status, 4); + + /* Phone home and tell the parent that we're OK. */ + + if (write(FORKSRV_FD + 1, tmp, 4) != 4) return; + +} + +static u32 __afl_next_testcase(u8 *buf, u32 max_len) { + + s32 status, res = 0xffffff; + + /* Wait for parent by reading from the pipe. Abort if read fails. */ + if (read(FORKSRV_FD, &status, 4) != 4) return 0; + + /* we have a testcase - read it */ + status = read(0, buf, max_len); + + /* report that we are starting the target */ + if (write(FORKSRV_FD + 1, &res, 4) != 4) return 0; + + if (status < 1) + return 0; + else + return status; + +} + +static void __afl_end_testcase(void) { + + int status = 0xffffff; + + if (write(FORKSRV_FD + 1, &status, 4) != 4) exit(1); + +} + +/* you just need to modify the while() loop in this main() */ + +int main(int argc, char *argv[]) { + + /* This is were the testcase data is written into */ + u8 buf[1024]; // this is the maximum size for a test case! set it! + u32 len; + + /* here you specify the map size you need that you are reporting to + afl-fuzz. */ + __afl_map_size = MAP_SIZE; // default is 65536 + + /* then we initialize the shared memory map and start the forkserver */ + __afl_map_shm(); + __afl_start_forkserver(); + + while ((len = __afl_next_testcase(buf, sizeof(buf))) > 0) { + + /* here you have to create the magic that feeds the buf/len to the + target and write the coverage to __afl_area_ptr */ + + // ... the magic ... + + /* report the test case is done and wait for the next */ + __afl_end_testcase(); + + } + + return 0; + +} + diff --git a/utils/afl_untracer/Makefile b/utils/afl_untracer/Makefile new file mode 100644 index 00000000..14a09b41 --- /dev/null +++ b/utils/afl_untracer/Makefile @@ -0,0 +1,16 @@ +ifdef DEBUG + OPT=-O0 +else + OPT=-O3 +endif + +all: afl-untracer libtestinstr.so + +afl-untracer: afl-untracer.c + $(CC) $(OPT) -I../../include -g -o afl-untracer afl-untracer.c -ldl + +libtestinstr.so: libtestinstr.c + $(CC) -g -O0 -fPIC -o libtestinstr.so -shared libtestinstr.c + +clean: + rm -f afl-untracer libtestinstr.so *~ core diff --git a/utils/afl_untracer/README.md b/utils/afl_untracer/README.md new file mode 100644 index 00000000..ada0c916 --- /dev/null +++ b/utils/afl_untracer/README.md @@ -0,0 +1,60 @@ +# afl-untracer - fast fuzzing of binary-only libraries + +## Introduction + +afl-untracer is an example skeleton file which can easily be used to fuzz +a closed source library. + +It requires less memory and is x3-5 faster than qemu_mode however it is way +more course grained and does not provide interesting features like compcov +or cmplog. + +Supported is so far Intel (i386/x86_64) and AARCH64. + +## How-to + +### Modify afl-untracer.c + +Read and modify afl-untracer.c then `make`. +To adapt afl-untracer.c to your needs, read the header of the file and then +search and edit the `STEP 1`, `STEP 2` and `STEP 3` locations. + +### Generate patches.txt file + +To generate the `patches.txt` file for your target library use the +`ida_get_patchpoints.py` script for IDA Pro or +`ghidra_get_patchpoints.java` for Ghidra. + +The patches.txt file has to be pointed to by `AFL_UNTRACER_FILE`. + +To easily run the scripts without needing to run the GUI with Ghidra: +``` +/opt/ghidra/support/analyzeHeadless /tmp/ tmp$$ -import libtestinstr.so -postscript ./ghidra_get_patchpoints.java +rm -rf /tmp/tmp$$ +``` +The file is created at `~/Desktop/patches.txt` + +### Fuzzing + +Example (after modifying afl-untracer.c to your needs, compiling and creating +patches.txt): +``` +LD_LIBRARY_PATH=/path/to/target/library AFL_UNTRACER_FILE=./patches.txt afl-fuzz -i in -o out -- ./afl-untracer +``` +(or even remote via afl-network-proxy). + +### Testing and debugging + +For testing/debugging you can try: +``` +make DEBUG=1 +AFL_UNTRACER_FILE=./patches.txt AFL_DEBUG=1 gdb ./afl-untracer +``` +and then you can easily set breakpoints to "breakpoint" and "fuzz". + +# Background + +This idea is based on [UnTracer](https://github.com/FoRTE-Research/UnTracer-AFL) +and modified by [Trapfuzz](https://github.com/googleprojectzero/p0tools/tree/master/TrapFuzz). +This implementation is slower because the traps are not patched out with each +run, but on the other hand gives much better coverage information. diff --git a/utils/afl_untracer/TODO b/utils/afl_untracer/TODO new file mode 100644 index 00000000..fffffacf --- /dev/null +++ b/utils/afl_untracer/TODO @@ -0,0 +1,2 @@ + * add shmem fuzzing + * add snapshot feature? diff --git a/utils/afl_untracer/afl-untracer.c b/utils/afl_untracer/afl-untracer.c new file mode 100644 index 00000000..cb6f948c --- /dev/null +++ b/utils/afl_untracer/afl-untracer.c @@ -0,0 +1,768 @@ +/* + american fuzzy lop++ - afl-untracer skeleton example + --------------------------------------------------- + + Written by Marc Heuse + + Copyright 2019-2020 AFLplusplus Project. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + + HOW-TO + ====== + + You only need to change the following: + + 1. decide if you want to receive data from stdin [DEFAULT] or file(name) + -> use_stdin = 0 if via file, and what the maximum input size is + 2. dl load the library you want to fuzz, lookup the functions you need + and setup the calls to these + 3. in the while loop you call the functions in the necessary order - + incl the cleanup. the cleanup is important! + + Just look these steps up in the code, look for "// STEP x:" + + +*/ + +#define __USE_GNU +#define _GNU_SOURCE + +#ifdef __ANDROID__ + #include "android-ashmem.h" +#endif +#include "config.h" +#include "types.h" +#include "debug.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if defined(__linux__) + #include +#elif defined(__APPLE__) && defined(__LP64__) + #include +#elif defined(__FreeBSD__) + #include + #include +#else + #error "Unsupported platform" +#endif + +#define MEMORY_MAP_DECREMENT 0x200000000000 +#define MAX_LIB_COUNT 128 + +// STEP 1: + +/* here you need to specify the parameter for the target function */ +static void *(*o_function)(u8 *buf, int len); + +/* use stdin (1) or a file on the commandline (0) */ +static u32 use_stdin = 1; + +/* This is were the testcase data is written into */ +static u8 buf[10000]; // this is the maximum size for a test case! set it! + +/* If you want to have debug output set this to 1, can also be set with + AFL_DEBUG */ +static u32 debug = 0; + +// END STEP 1 + +typedef struct library_list { + + u8 *name; + u64 addr_start, addr_end; + +} library_list_t; + +#ifdef __ANDROID__ +u32 __afl_map_size = MAP_SIZE; +u32 do_exit; +#else +__thread u32 __afl_map_size = MAP_SIZE; +__thread u32 do_exit; +#endif + +static pid_t pid = 65537; +static pthread_t __afl_thread; +static u8 __afl_dummy[MAP_SIZE]; +static u8 * __afl_area_ptr = __afl_dummy; +static u8 * inputfile; // this will point to argv[1] +static u32 len; + +static library_list_t liblist[MAX_LIB_COUNT]; +static u32 liblist_cnt; + +static void sigtrap_handler(int signum, siginfo_t *si, void *context); +static void fuzz(void); + +/* read the library information */ +void read_library_information(void) { + +#if defined(__linux__) + FILE *f; + u8 buf[1024], *b, *m, *e, *n; + + if ((f = fopen("/proc/self/maps", "r")) == NULL) + FATAL("cannot open /proc/self/maps"); + + if (debug) fprintf(stderr, "Library list:\n"); + while (fgets(buf, sizeof(buf), f)) { + + if (strstr(buf, " r-x")) { + + if (liblist_cnt >= MAX_LIB_COUNT) { + + WARNF("too many libraries to old, maximum count of %d reached", + liblist_cnt); + return; + + } + + b = buf; + m = index(buf, '-'); + e = index(buf, ' '); + if ((n = rindex(buf, '/')) == NULL) n = rindex(buf, ' '); + if (n && + ((*n >= '0' && *n <= '9') || *n == '[' || *n == '{' || *n == '(')) + n = NULL; + else + n++; + if (b && m && e && n && *n) { + + *m++ = 0; + *e = 0; + if (n[strlen(n) - 1] == '\n') n[strlen(n) - 1] = 0; + + liblist[liblist_cnt].name = strdup(n); + liblist[liblist_cnt].addr_start = strtoull(b, NULL, 16); + liblist[liblist_cnt].addr_end = strtoull(m, NULL, 16); + if (debug) + fprintf( + stderr, "%s:%llx (%llx-%llx)\n", liblist[liblist_cnt].name, + liblist[liblist_cnt].addr_end - liblist[liblist_cnt].addr_start, + liblist[liblist_cnt].addr_start, + liblist[liblist_cnt].addr_end - 1); + liblist_cnt++; + + } + + } + + } + + if (debug) fprintf(stderr, "\n"); + +#elif defined(__FreeBSD__) + int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid()}; + char * buf, *start, *end; + size_t miblen = sizeof(mib) / sizeof(mib[0]); + size_t len; + + if (debug) fprintf(stderr, "Library list:\n"); + if (sysctl(mib, miblen, NULL, &len, NULL, 0) == -1) { return; } + + len = len * 4 / 3; + + buf = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); + if (buf == MAP_FAILED) { return; } + + if (sysctl(mib, miblen, buf, &len, NULL, 0) == -1) { + + munmap(buf, len); + return; + + } + + start = buf; + end = buf + len; + + while (start < end) { + + struct kinfo_vmentry *region = (struct kinfo_vmentry *)start; + size_t size = region->kve_structsize; + + if (size == 0) { break; } + + if ((region->kve_protection & KVME_PROT_READ) && + !(region->kve_protection & KVME_PROT_EXEC)) { + + liblist[liblist_cnt].name = + region->kve_path[0] != '\0' ? strdup(region->kve_path) : 0; + liblist[liblist_cnt].addr_start = region->kve_start; + liblist[liblist_cnt].addr_end = region->kve_end; + + if (debug) { + + fprintf(stderr, "%s:%x (%lx-%lx)\n", liblist[liblist_cnt].name, + liblist[liblist_cnt].addr_end - liblist[liblist_cnt].addr_start, + liblist[liblist_cnt].addr_start, + liblist[liblist_cnt].addr_end - 1); + + } + + liblist_cnt++; + + } + + start += size; + + } + +#endif + +} + +library_list_t *find_library(char *name) { + +#if defined(__linux__) + u32 i; + + for (i = 0; i < liblist_cnt; i++) + if (strncmp(liblist[i].name, name, strlen(name)) == 0) return &liblist[i]; +#elif defined(__APPLE__) && defined(__LP64__) + kern_return_t err; + static library_list_t lib; + + // get the list of all loaded modules from dyld + // the task_info mach API will get the address of the dyld all_image_info + // struct for the given task from which we can get the names and load + // addresses of all modules + task_dyld_info_data_t task_dyld_info; + mach_msg_type_number_t count = TASK_DYLD_INFO_COUNT; + err = task_info(mach_task_self(), TASK_DYLD_INFO, + (task_info_t)&task_dyld_info, &count); + + const struct dyld_all_image_infos *all_image_infos = + (const struct dyld_all_image_infos *)task_dyld_info.all_image_info_addr; + const struct dyld_image_info *image_infos = all_image_infos->infoArray; + + for (size_t i = 0; i < all_image_infos->infoArrayCount; i++) { + + const char * image_name = image_infos[i].imageFilePath; + mach_vm_address_t image_load_address = + (mach_vm_address_t)image_infos[i].imageLoadAddress; + if (strstr(image_name, name)) { + + lib.name = name; + lib.addr_start = (u64)image_load_address; + lib.addr_end = 0; + return &lib; + + } + + } + +#endif + + return NULL; + +} + +/* for having an easy breakpoint location after loading the shared library */ +// this seems to work for clang too. nice :) requires gcc 4.4+ +#pragma GCC push_options +#pragma GCC optimize("O0") +void breakpoint(void) { + + if (debug) fprintf(stderr, "Breakpoint function \"breakpoint\" reached.\n"); + +} + +#pragma GCC pop_options + +/* Error reporting to forkserver controller */ + +void send_forkserver_error(int error) { + + u32 status; + if (!error || error > 0xffff) return; + status = (FS_OPT_ERROR | FS_OPT_SET_ERROR(error)); + if (write(FORKSRV_FD + 1, (char *)&status, 4) != 4) return; + +} + +/* SHM setup. */ + +static void __afl_map_shm(void) { + + char *id_str = getenv(SHM_ENV_VAR); + char *ptr; + + if ((ptr = getenv("AFL_MAP_SIZE")) != NULL) { + + u32 val = atoi(ptr); + if (val > 0) __afl_map_size = val; + + } + + if (__afl_map_size > MAP_SIZE) { + + if (__afl_map_size > FS_OPT_MAX_MAPSIZE) { + + fprintf(stderr, + "Error: AFL++ tools *require* to set AFL_MAP_SIZE to %u to " + "be able to run this instrumented program!\n", + __afl_map_size); + if (id_str) { + + send_forkserver_error(FS_ERROR_MAP_SIZE); + exit(-1); + + } + + } else { + + fprintf(stderr, + "Warning: AFL++ tools will need to set AFL_MAP_SIZE to %u to " + "be able to run this instrumented program!\n", + __afl_map_size); + + } + + } + + if (id_str) { + +#ifdef USEMMAP + const char * shm_file_path = id_str; + int shm_fd = -1; + unsigned char *shm_base = NULL; + + /* create the shared memory segment as if it was a file */ + shm_fd = shm_open(shm_file_path, O_RDWR, 0600); + if (shm_fd == -1) { + + fprintf(stderr, "shm_open() failed\n"); + send_forkserver_error(FS_ERROR_SHM_OPEN); + exit(1); + + } + + /* map the shared memory segment to the address space of the process */ + shm_base = + mmap(0, __afl_map_size, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0); + + if (shm_base == MAP_FAILED) { + + close(shm_fd); + shm_fd = -1; + + fprintf(stderr, "mmap() failed\n"); + send_forkserver_error(FS_ERROR_MMAP); + exit(2); + + } + + __afl_area_ptr = shm_base; +#else + u32 shm_id = atoi(id_str); + + __afl_area_ptr = shmat(shm_id, 0, 0); + +#endif + + if (__afl_area_ptr == (void *)-1) { + + send_forkserver_error(FS_ERROR_SHMAT); + exit(1); + + } + + /* Write something into the bitmap so that the parent doesn't give up */ + + __afl_area_ptr[0] = 1; + + } + +} + +/* Fork server logic. */ +inline static void __afl_start_forkserver(void) { + + u8 tmp[4] = {0, 0, 0, 0}; + u32 status = 0; + + if (__afl_map_size <= FS_OPT_MAX_MAPSIZE) + status |= (FS_OPT_SET_MAPSIZE(__afl_map_size) | FS_OPT_MAPSIZE); + if (status) status |= (FS_OPT_ENABLED); + memcpy(tmp, &status, 4); + + /* Phone home and tell the parent that we're OK. */ + if (write(FORKSRV_FD + 1, tmp, 4) != 4) do_exit = 1; + // fprintf(stderr, "write0 %d\n", do_exit); + +} + +inline static u32 __afl_next_testcase(u8 *buf, u32 max_len) { + + s32 status; + + /* Wait for parent by reading from the pipe. Abort if read fails. */ + if (read(FORKSRV_FD, &status, 4) != 4) do_exit = 1; + // fprintf(stderr, "read %d\n", do_exit); + + /* we have a testcase - read it if we read from stdin */ + if (use_stdin) { + + if ((status = read(0, buf, max_len)) <= 0) exit(-1); + + } else + + status = 1; + // fprintf(stderr, "stdin: %d %d\n", use_stdin, status); + + /* report that we are starting the target */ + if (write(FORKSRV_FD + 1, &pid, 4) != 4) do_exit = 1; + // fprintf(stderr, "write1 %d\n", do_exit); + + __afl_area_ptr[0] = 1; // put something in the map + + return status; + +} + +inline static void __afl_end_testcase(int status) { + + if (write(FORKSRV_FD + 1, &status, 4) != 4) do_exit = 1; + // fprintf(stderr, "write2 %d\n", do_exit); + if (do_exit) exit(0); + +} + +#ifdef __aarch64__ + #define SHADOW(addr) \ + ((uint64_t *)(((uintptr_t)addr & 0xfffffffffffffff8) - \ + MEMORY_MAP_DECREMENT - \ + ((uintptr_t)addr & 0x7) * 0x10000000000)) +#else + #define SHADOW(addr) \ + ((uint32_t *)(((uintptr_t)addr & 0xfffffffffffffffc) - \ + MEMORY_MAP_DECREMENT - \ + ((uintptr_t)addr & 0x3) * 0x10000000000)) +#endif + +void setup_trap_instrumentation(void) { + + library_list_t *lib_base = NULL; + size_t lib_size = 0; + u8 * lib_addr; + char * line = NULL; + size_t nread, len = 0; + char * filename = getenv("AFL_UNTRACER_FILE"); + if (!filename) filename = getenv("TRAPFUZZ_FILE"); + if (!filename) FATAL("AFL_UNTRACER_FILE environment variable not set"); + + FILE *patches = fopen(filename, "r"); + if (!patches) FATAL("Couldn't open AFL_UNTRACER_FILE file %s", filename); + + // Index into the coverage bitmap for the current trap instruction. +#ifdef __aarch64__ + uint64_t bitmap_index = 0; +#else + uint32_t bitmap_index = 0; +#endif + + while ((nread = getline(&line, &len, patches)) != -1) { + + char *end = line + len; + + char *col = strchr(line, ':'); + if (col) { + + // It's a library:size pair + *col++ = 0; + + lib_base = find_library(line); + if (!lib_base) FATAL("Library %s does not appear to be loaded", line); + + // we ignore the defined lib_size + lib_size = strtoul(col, NULL, 16); +#if (__linux__) + if (lib_size < lib_base->addr_end - lib_base->addr_start) + lib_size = lib_base->addr_end - lib_base->addr_start; +#endif + if (lib_size % 0x1000 != 0) + WARNF("Invalid library size 0x%zx. Must be multiple of 0x1000", + lib_size); + + lib_addr = (u8 *)lib_base->addr_start; + + // Make library code writable. + if (mprotect((void *)lib_addr, lib_size, + PROT_READ | PROT_WRITE | PROT_EXEC) != 0) + FATAL("Failed to mprotect library %s writable", line); + + // Create shadow memory. +#ifdef __aarch64__ + for (int i = 0; i < 8; i++) { + +#else + for (int i = 0; i < 4; i++) { + +#endif + + void *shadow_addr = SHADOW(lib_addr + i); + void *shadow = mmap(shadow_addr, lib_size, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANON | MAP_FIXED, 0, 0); + if (debug) + fprintf(stderr, "Shadow: %s %d = %p-%p for %p\n", line, i, shadow, + shadow + lib_size - 1, lib_addr); + if (shadow == MAP_FAILED) FATAL("Failed to mmap shadow memory"); + + } + + // Done, continue with next line. + continue; + + } + + // It's an offset, parse it and do the patching. + unsigned long offset = strtoul(line, NULL, 16); + + if (offset > lib_size) + FATAL("Invalid offset: 0x%lx. Current library is 0x%zx bytes large", + offset, lib_size); + + if (bitmap_index >= __afl_map_size) + FATAL("Too many basic blocks to instrument"); + +#ifdef __arch64__ + uint64_t +#else + uint32_t +#endif + *shadow = SHADOW(lib_addr + offset); + if (*shadow != 0) continue; // skip duplicates + + // Make lookup entry in shadow memory. + +#if ((defined(__APPLE__) && defined(__LP64__)) || defined(__x86_64__) || \ + defined(__i386__)) + + // this is for Intel x64 + + uint8_t orig_byte = lib_addr[offset]; + *shadow = (bitmap_index << 8) | orig_byte; + lib_addr[offset] = 0xcc; // replace instruction with debug trap + if (debug) + fprintf(stderr, + "Patch entry: %p[%x] = %p = %02x -> SHADOW(%p) #%d -> %08x\n", + lib_addr, offset, lib_addr + offset, orig_byte, shadow, + bitmap_index, *shadow); + +#elif defined(__aarch64__) + + // this is for aarch64 + + uint32_t *patch_bytes = (uint32_t *)(lib_addr + offset); + uint32_t orig_bytes = *patch_bytes; + *shadow = (bitmap_index << 32) | orig_bytes; + *patch_bytes = 0xd4200000; // replace instruction with debug trap + if (debug) + fprintf(stderr, + "Patch entry: %p[%x] = %p = %02x -> SHADOW(%p) #%d -> %016x\n", + lib_addr, offset, lib_addr + offset, orig_bytes, shadow, + bitmap_index, *shadow); + +#else + // this will be ARM and AARCH64 + // for ARM we will need to identify if the code is in thumb or ARM + #error "non x86_64/aarch64 not supported yet" + //__arm__: + // linux thumb: 0xde01 + // linux arm: 0xe7f001f0 + //__aarch64__: + // linux aarch64: 0xd4200000 +#endif + + bitmap_index++; + + } + + free(line); + fclose(patches); + + // Install signal handler for SIGTRAP. + struct sigaction s; + s.sa_flags = SA_SIGINFO; + s.sa_sigaction = sigtrap_handler; + sigemptyset(&s.sa_mask); + sigaction(SIGTRAP, &s, 0); + + if (debug) fprintf(stderr, "Patched %u locations.\n", bitmap_index); + __afl_map_size = bitmap_index; + if (__afl_map_size % 8) __afl_map_size = (((__afl_map_size + 7) >> 3) << 3); + +} + +/* the signal handler for the traps / debugging interrupts + No debug output here because this would cost speed */ +static void sigtrap_handler(int signum, siginfo_t *si, void *context) { + + uint64_t addr; + // Must re-execute the instruction, so decrement PC by one instruction. + ucontext_t *ctx = (ucontext_t *)context; +#if defined(__APPLE__) && defined(__LP64__) + ctx->uc_mcontext->__ss.__rip -= 1; + addr = ctx->uc_mcontext->__ss.__rip; +#elif defined(__linux__) + #if defined(__x86_64__) || defined(__i386__) + ctx->uc_mcontext.gregs[REG_RIP] -= 1; + addr = ctx->uc_mcontext.gregs[REG_RIP]; + #elif defined(__aarch64__) + ctx->uc_mcontext.pc -= 4; + addr = ctx->uc_mcontext.pc; + #else + #error "Unsupported processor" + #endif +#elif defined(__FreeBSD__) && defined(__LP64__) + ctx->uc_mcontext.mc_rip -= 1; + addr = ctx->uc_mcontext.mc_rip; +#else + #error "Unsupported platform" +#endif + + // fprintf(stderr, "TRAP at context addr = %lx, fault addr = %lx\n", addr, + // si->si_addr); + + // If the trap didn't come from our instrumentation, then we probably will + // just segfault here + uint8_t *faultaddr; + if (unlikely(si->si_addr)) + faultaddr = (u8 *)si->si_addr - 1; + else + faultaddr = (u8 *)addr; + // if (debug) fprintf(stderr, "Shadow location: %p\n", SHADOW(faultaddr)); + uint32_t shadow = *SHADOW(faultaddr); + uint8_t orig_byte = shadow & 0xff; + uint32_t index = shadow >> 8; + + // if (debug) fprintf(stderr, "shadow data: %x, orig_byte %02x, index %d\n", + // shadow, orig_byte, index); + + // Index zero is invalid so that it is still possible to catch actual trap + // instructions in instrumented libraries. + if (unlikely(index == 0)) abort(); + + // Restore original instruction + *faultaddr = orig_byte; + + __afl_area_ptr[index] = 128; + +} + +/* the MAIN function */ +int main(int argc, char *argv[]) { + + (void)personality(ADDR_NO_RANDOMIZE); // disable ASLR + + pid = getpid(); + if (getenv("AFL_DEBUG")) debug = 1; + + /* by default we use stdin, but also a filename can be passed, in this + case the input is argv[1] and we have to disable stdin */ + if (argc > 1) { + + use_stdin = 0; + inputfile = argv[1]; + + } + + // STEP 2: load the library you want to fuzz and lookup the functions, + // inclusive of the cleanup functions + // NOTE: above the main() you have to define the functions! + + void *dl = dlopen("./libtestinstr.so", RTLD_LAZY); + if (!dl) FATAL("could not find target library"); + o_function = dlsym(dl, "testinstr"); + if (!o_function) FATAL("could not resolve target function from library"); + if (debug) fprintf(stderr, "Function address: %p\n", o_function); + + // END STEP 2 + + /* setup instrumentation, shared memory and forkserver */ + breakpoint(); + read_library_information(); + setup_trap_instrumentation(); + __afl_map_shm(); + __afl_start_forkserver(); + + while (1) { + + // instead of fork() we could also use the snapshot lkm or do our own mini + // snapshot feature like in https://github.com/marcinguy/fuzzer + // -> snapshot.c + if ((pid = fork()) == -1) PFATAL("fork failed"); + + if (pid) { + + u32 status; + if (waitpid(pid, &status, 0) < 0) exit(1); + /* report the test case is done and wait for the next */ + __afl_end_testcase(status); + + } else { + + pid = getpid(); + while ((len = __afl_next_testcase(buf, sizeof(buf))) > 0) { + + // in this function the fuzz magic happens, this is STEP 3 + fuzz(); + + // we can use _exit which is faster because our target library + // was loaded via dlopen and therefore cannot have deconstructors + // registered. + _exit(0); + + } + + } + + } + + return 0; + +} + +#ifndef _DEBUG +inline +#endif + static void + fuzz(void) { + + // STEP 3: call the function to fuzz, also the functions you might + // need to call to prepare the function and - important! - + // to clean everything up + + // in this example we use the input file, not stdin! + (*o_function)(buf, len); + + // normally you also need to cleanup + //(*o_LibFree)(foo); + + // END STEP 3 + +} + diff --git a/utils/afl_untracer/ghidra_get_patchpoints.java b/utils/afl_untracer/ghidra_get_patchpoints.java new file mode 100644 index 00000000..2a93642b --- /dev/null +++ b/utils/afl_untracer/ghidra_get_patchpoints.java @@ -0,0 +1,84 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Find patch points for untracer tools (e.g. afl++ utils/afl_untracer) +// +// Copy to ..../Ghidra/Features/Search/ghidra_scripts/ +// Writes the results to ~/Desktop/patches.txt +// +// This is my very first Ghidra script. I am sure this could be done better. +// +//@category Search + +import ghidra.app.script.GhidraScript; +import ghidra.program.model.address.*; +import ghidra.program.model.block.*; +import ghidra.program.model.listing.*; +import ghidra.program.model.symbol.*; +import ghidra.program.model.mem.*; + +import java.io.*; + +public class ghidra_get_patchpoints extends GhidraScript { + + @Override + public void run() throws Exception { + + long segment_start = 0; + Memory memory = currentProgram.getMemory(); + MultEntSubModel model = new MultEntSubModel(currentProgram); + CodeBlockIterator subIter = model.getCodeBlocks(monitor); + BufferedWriter out = new BufferedWriter(new FileWriter(System.getProperty("user.home") + File.separator + "Desktop" + File.separator + "patches.txt")); + + while (subIter.hasNext()) { + + CodeBlock multiEntryBlock = subIter.next(); + SimpleBlockModel basicBlockModel = new SimpleBlockModel(currentProgram); + CodeBlockIterator bbIter = basicBlockModel.getCodeBlocksContaining(multiEntryBlock, monitor); + + while (bbIter.hasNext()) { + + CodeBlock basicBlock = bbIter.next(); + + if (segment_start == 0) { + + Address firstAddr = basicBlock.getFirstStartAddress(); + long firstBlockAddr = firstAddr.getAddressableWordOffset(); + MemoryBlock mb = memory.getBlock(firstAddr); + Address startAddr = mb.getStart(); + Address endAddr = mb.getEnd(); + segment_start = startAddr.getAddressableWordOffset(); + if ((firstBlockAddr - segment_start) >= 0x1000) + segment_start += 0x1000; + long segment_end = endAddr.getAddressableWordOffset(); + long segment_size = segment_end - segment_start; + if ((segment_size % 0x1000) > 0) + segment_size = (((segment_size / 0x1000) + 1) * 0x1000); + out.write(currentProgram.getName() + ":0x" + Long.toHexString(segment_size) + "\n"); + //println("Start: " + Long.toHexString(segment_start)); + //println("End: " + Long.toHexString(segment_end)); + + } + + if (basicBlock.getFirstStartAddress().getAddressableWordOffset() - segment_start > 0) + out.write("0x" + Long.toHexString(basicBlock.getFirstStartAddress().getAddressableWordOffset() - segment_start) + "\n"); + + } + } + + out.close(); + + } +} diff --git a/utils/afl_untracer/ida_get_patchpoints.py b/utils/afl_untracer/ida_get_patchpoints.py new file mode 100644 index 00000000..43cf6d89 --- /dev/null +++ b/utils/afl_untracer/ida_get_patchpoints.py @@ -0,0 +1,62 @@ +# +# IDAPython script for IDA Pro +# Slightly modified from https://github.com/googleprojectzero/p0tools/blob/master/TrapFuzz/findPatchPoints.py +# + +import idautils +import idaapi +import ida_nalt +import idc + +# See https://www.hex-rays.com/products/ida/support/ida74_idapython_no_bc695_porting_guide.shtml + +from os.path import expanduser +home = expanduser("~") + +patchpoints = set() + +max_offset = 0 +for seg_ea in idautils.Segments(): + name = idc.get_segm_name(seg_ea) + #print("Segment: " + name) + if name != "__text" and name != ".text": + continue + + start = idc.get_segm_start(seg_ea) + end = idc.get_segm_end(seg_ea) + first = 0 + subtract_addr = 0 + #print("Start: " + hex(start) + " End: " + hex(end)) + for func_ea in idautils.Functions(start, end): + f = idaapi.get_func(func_ea) + if not f: + continue + for block in idaapi.FlowChart(f): + if start <= block.start_ea < end: + if first == 0: + if block.start_ea >= 0x1000: + subtract_addr = 0x1000 + first = 1 + + max_offset = max(max_offset, block.start_ea) + patchpoints.add(block.start_ea - subtract_addr) + #else: + # print("Warning: broken CFG?") + +# Round up max_offset to page size +size = max_offset +rem = size % 0x1000 +if rem != 0: + size += 0x1000 - rem + +print("Writing to " + home + "/Desktop/patches.txt") + +with open(home + "/Desktop/patches.txt", "w") as f: + f.write(ida_nalt.get_root_filename() + ':' + hex(size) + '\n') + f.write('\n'.join(map(hex, sorted(patchpoints)))) + f.write('\n') + +print("Done, found {} patchpoints".format(len(patchpoints))) + +# For headless script running remove the comment from the next line +#ida_pro.qexit() diff --git a/utils/afl_untracer/libtestinstr.c b/utils/afl_untracer/libtestinstr.c new file mode 100644 index 00000000..96b1cf21 --- /dev/null +++ b/utils/afl_untracer/libtestinstr.c @@ -0,0 +1,35 @@ +/* + american fuzzy lop++ - a trivial program to test the build + -------------------------------------------------------- + Originally written by Michal Zalewski + Copyright 2014 Google Inc. All rights reserved. + Copyright 2019-2020 AFLplusplus Project. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + http://www.apache.org/licenses/LICENSE-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include + +void testinstr(char *buf, int len) { + + if (len < 1) return; + buf[len] = 0; + + // we support three input cases + if (buf[0] == '0') + printf("Looks like a zero to me!\n"); + else if (buf[0] == '1') + printf("Pretty sure that is a one!\n"); + else + printf("Neither one or zero? How quaint!\n"); + +} + diff --git a/utils/afl_untracer/patches.txt b/utils/afl_untracer/patches.txt new file mode 100644 index 00000000..7e964249 --- /dev/null +++ b/utils/afl_untracer/patches.txt @@ -0,0 +1,34 @@ +libtestinstr.so:0x1000 +0x10 +0x12 +0x20 +0x36 +0x30 +0x40 +0x50 +0x63 +0x6f +0x78 +0x80 +0xa4 +0xb0 +0xb8 +0x100 +0xc0 +0xc9 +0xd7 +0xe3 +0xe8 +0xf8 +0x105 +0x11a +0x135 +0x141 +0x143 +0x14e +0x15a +0x15c +0x168 +0x16a +0x16b +0x170 diff --git a/utils/aflpp_driver/GNUmakefile b/utils/aflpp_driver/GNUmakefile new file mode 100644 index 00000000..c1a087d7 --- /dev/null +++ b/utils/aflpp_driver/GNUmakefile @@ -0,0 +1,46 @@ +ifeq "" "$(LLVM_CONFIG)" + LLVM_CONFIG=llvm-config +endif + +LLVM_BINDIR = $(shell $(LLVM_CONFIG) --bindir 2>/dev/null) +ifneq "" "$(LLVM_BINDIR)" + LLVM_BINDIR := $(LLVM_BINDIR)/ +endif + +CFLAGS := -O3 -funroll-loops -g + +all: libAFLDriver.a libAFLQemuDriver.a aflpp_qemu_driver_hook.so + +aflpp_driver.o: aflpp_driver.c + -$(LLVM_BINDIR)clang -I. -I../../include $(CFLAGS) -c aflpp_driver.c + +libAFLDriver.a: aflpp_driver.o + ar ru libAFLDriver.a aflpp_driver.o + cp -vf libAFLDriver.a ../../ + +debug: + $(LLVM_BINDIR)clang -Wno-deprecated -I../../include $(CFLAGS) -D_DEBUG=\"1\" -c -o afl-performance.o ../../src/afl-performance.c + $(LLVM_BINDIR)clang -I../../include -D_DEBUG=\"1\" -g -funroll-loops -c aflpp_driver.c + #$(LLVM_BINDIR)clang -S -emit-llvm -Wno-deprecated -I../../include $(CFLAGS) -D_DEBUG=\"1\" -c -o afl-performance.ll ../../src/afl-performance.c + #$(LLVM_BINDIR)clang -S -emit-llvm -I../../include -D_DEBUG=\"1\" -g -funroll-loops -c aflpp_driver.c + ar ru libAFLDriver.a afl-performance.o aflpp_driver.o + +aflpp_qemu_driver.o: aflpp_qemu_driver.c + $(LLVM_BINDIR)clang $(CFLAGS) -O0 -funroll-loops -c aflpp_qemu_driver.c + +libAFLQemuDriver.a: aflpp_qemu_driver.o + ar ru libAFLQemuDriver.a aflpp_qemu_driver.o + cp -vf libAFLQemuDriver.a ../../ + +aflpp_qemu_driver_hook.so: aflpp_qemu_driver_hook.o + $(LLVM_BINDIR)clang -shared aflpp_qemu_driver_hook.o -o aflpp_qemu_driver_hook.so + +aflpp_qemu_driver_hook.o: aflpp_qemu_driver_hook.c + $(LLVM_BINDIR)clang -fPIC $(CFLAGS) -funroll-loops -c aflpp_qemu_driver_hook.c + +test: debug + #clang -S -emit-llvm -D_DEBUG=\"1\" -I../../include -Wl,--allow-multiple-definition -funroll-loops -o aflpp_driver_test.ll aflpp_driver_test.c + afl-clang-fast -D_DEBUG=\"1\" -I../../include -Wl,--allow-multiple-definition -funroll-loops -o aflpp_driver_test aflpp_driver_test.c libAFLDriver.a afl-performance.o + +clean: + rm -f *.o libAFLDriver*.a libAFLQemuDriver.a aflpp_qemu_driver_hook.so *~ core aflpp_driver_test diff --git a/utils/aflpp_driver/Makefile b/utils/aflpp_driver/Makefile new file mode 100644 index 00000000..3666a74d --- /dev/null +++ b/utils/aflpp_driver/Makefile @@ -0,0 +1,2 @@ +all: + @gmake all || echo please install GNUmake diff --git a/utils/aflpp_driver/aflpp_driver.c b/utils/aflpp_driver/aflpp_driver.c new file mode 100644 index 00000000..017aa72b --- /dev/null +++ b/utils/aflpp_driver/aflpp_driver.c @@ -0,0 +1,326 @@ +//===- afl_driver.cpp - a glue between AFL and libFuzzer --------*- C++ -* ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +//===----------------------------------------------------------------------===// + +/* This file allows to fuzz libFuzzer-style target functions + (LLVMFuzzerTestOneInput) with AFL using AFL's persistent (in-process) mode. + +Usage: +################################################################################ +cat << EOF > test_fuzzer.cc +#include +#include +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + + if (size > 0 && data[0] == 'H') + if (size > 1 && data[1] == 'I') + if (size > 2 && data[2] == '!') + __builtin_trap(); + return 0; + +} + +EOF +# Build your target with -fsanitize-coverage=trace-pc-guard using fresh clang. +clang -g -fsanitize-coverage=trace-pc-guard test_fuzzer.cc -c +# Build afl-llvm-rt.o.c from the AFL distribution. +clang -c -w $AFL_HOME/instrumentation/afl-llvm-rt.o.c +# Build this file, link it with afl-llvm-rt.o.o and the target code. +clang++ afl_driver.cpp test_fuzzer.o afl-llvm-rt.o.o +# Run AFL: +rm -rf IN OUT; mkdir IN OUT; echo z > IN/z; +$AFL_HOME/afl-fuzz -i IN -o OUT ./a.out +################################################################################ +AFL_DRIVER_STDERR_DUPLICATE_FILENAME: Setting this *appends* stderr to the file +specified. If the file does not exist, it is created. This is useful for getting +stack traces (when using ASAN for example) or original error messages on hard +to reproduce bugs. Note that any content written to stderr will be written to +this file instead of stderr's usual location. + +AFL_DRIVER_CLOSE_FD_MASK: Similar to libFuzzer's -close_fd_mask behavior option. +If 1, close stdout at startup. If 2 close stderr; if 3 close both. + +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "config.h" +#include "cmplog.h" + +#ifdef _DEBUG + #include "hash.h" +#endif + +#ifndef MAP_FIXED_NOREPLACE + #define MAP_FIXED_NOREPLACE 0x100000 +#endif + +#define MAX_DUMMY_SIZE 256000 + +// Platform detection. Copied from FuzzerInternal.h +#ifdef __linux__ + #define LIBFUZZER_LINUX 1 + #define LIBFUZZER_APPLE 0 + #define LIBFUZZER_NETBSD 0 + #define LIBFUZZER_FREEBSD 0 + #define LIBFUZZER_OPENBSD 0 +#elif __APPLE__ + #define LIBFUZZER_LINUX 0 + #define LIBFUZZER_APPLE 1 + #define LIBFUZZER_NETBSD 0 + #define LIBFUZZER_FREEBSD 0 + #define LIBFUZZER_OPENBSD 0 +#elif __NetBSD__ + #define LIBFUZZER_LINUX 0 + #define LIBFUZZER_APPLE 0 + #define LIBFUZZER_NETBSD 1 + #define LIBFUZZER_FREEBSD 0 + #define LIBFUZZER_OPENBSD 0 +#elif __FreeBSD__ + #define LIBFUZZER_LINUX 0 + #define LIBFUZZER_APPLE 0 + #define LIBFUZZER_NETBSD 0 + #define LIBFUZZER_FREEBSD 1 + #define LIBFUZZER_OPENBSD 0 +#elif __OpenBSD__ + #define LIBFUZZER_LINUX 0 + #define LIBFUZZER_APPLE 0 + #define LIBFUZZER_NETBSD 0 + #define LIBFUZZER_FREEBSD 0 + #define LIBFUZZER_OPENBSD 1 +#else + #error "Support for your platform has not been implemented" +#endif + +int __afl_sharedmem_fuzzing = 1; +extern unsigned int * __afl_fuzz_len; +extern unsigned char *__afl_fuzz_ptr; + +// libFuzzer interface is thin, so we don't include any libFuzzer headers. +int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); +__attribute__((weak)) int LLVMFuzzerInitialize(int *argc, char ***argv); + +// Notify AFL about persistent mode. +static volatile char AFL_PERSISTENT[] = "##SIG_AFL_PERSISTENT##"; +int __afl_persistent_loop(unsigned int); + +// Notify AFL about deferred forkserver. +static volatile char AFL_DEFER_FORKSVR[] = "##SIG_AFL_DEFER_FORKSRV##"; +void __afl_manual_init(); + +// Use this optionally defined function to output sanitizer messages even if +// user asks to close stderr. +__attribute__((weak)) void __sanitizer_set_report_fd(void *); + +// Keep track of where stderr content is being written to, so that +// dup_and_close_stderr can use the correct one. +static FILE *output_file; + +// Experimental feature to use afl_driver without AFL's deferred mode. +// Needs to run before __afl_auto_init. +__attribute__((constructor(0))) static void __decide_deferred_forkserver(void) { + + if (getenv("AFL_DRIVER_DONT_DEFER")) { + + if (unsetenv("__AFL_DEFER_FORKSRV")) { + + perror("Failed to unset __AFL_DEFER_FORKSRV"); + abort(); + + } + + } + +} + +// If the user asks us to duplicate stderr, then do it. +static void maybe_duplicate_stderr() { + + char *stderr_duplicate_filename = + getenv("AFL_DRIVER_STDERR_DUPLICATE_FILENAME"); + + if (!stderr_duplicate_filename) return; + + FILE *stderr_duplicate_stream = + freopen(stderr_duplicate_filename, "a+", stderr); + + if (!stderr_duplicate_stream) { + + fprintf( + stderr, + "Failed to duplicate stderr to AFL_DRIVER_STDERR_DUPLICATE_FILENAME"); + abort(); + + } + + output_file = stderr_duplicate_stream; + +} + +// Most of these I/O functions were inspired by/copied from libFuzzer's code. +static void discard_output(int fd) { + + FILE *temp = fopen("/dev/null", "w"); + if (!temp) abort(); + dup2(fileno(temp), fd); + fclose(temp); + +} + +static void close_stdout() { + + discard_output(STDOUT_FILENO); + +} + +// Prevent the targeted code from writing to "stderr" but allow sanitizers and +// this driver to do so. +static void dup_and_close_stderr() { + + int output_fileno = fileno(output_file); + int output_fd = dup(output_fileno); + if (output_fd <= 0) abort(); + FILE *new_output_file = fdopen(output_fd, "w"); + if (!new_output_file) abort(); + if (!__sanitizer_set_report_fd) return; + __sanitizer_set_report_fd((void *)(long int)output_fd); + discard_output(output_fileno); + +} + +// Close stdout and/or stderr if user asks for it. +static void maybe_close_fd_mask() { + + char *fd_mask_str = getenv("AFL_DRIVER_CLOSE_FD_MASK"); + if (!fd_mask_str) return; + int fd_mask = atoi(fd_mask_str); + if (fd_mask & 2) dup_and_close_stderr(); + if (fd_mask & 1) close_stdout(); + +} + +// Define LLVMFuzzerMutate to avoid link failures for targets that use it +// with libFuzzer's LLVMFuzzerCustomMutator. +size_t LLVMFuzzerMutate(uint8_t *Data, size_t Size, size_t MaxSize) { + + // assert(false && "LLVMFuzzerMutate should not be called from afl_driver"); + return 0; + +} + +// Execute any files provided as parameters. +static int ExecuteFilesOnyByOne(int argc, char **argv) { + + unsigned char *buf = malloc(MAX_FILE); + for (int i = 1; i < argc; i++) { + + int fd = open(argv[i], O_RDONLY); + if (fd == -1) continue; + ssize_t length = read(fd, buf, MAX_FILE); + if (length > 0) { + + printf("Reading %zu bytes from %s\n", length, argv[i]); + LLVMFuzzerTestOneInput(buf, length); + printf("Execution successful.\n"); + + } + + } + + free(buf); + return 0; + +} + +int main(int argc, char **argv) { + + printf( + "======================= INFO =========================\n" + "This binary is built for afl++.\n" + "To run the target function on individual input(s) execute this:\n" + " %s INPUT_FILE1 [INPUT_FILE2 ... ]\n" + "To fuzz with afl-fuzz execute this:\n" + " afl-fuzz [afl-flags] -- %s [-N]\n" + "afl-fuzz will run N iterations before re-spawning the process (default: " + "1000)\n" + "======================================================\n", + argv[0], argv[0]); + + output_file = stderr; + maybe_duplicate_stderr(); + maybe_close_fd_mask(); + if (LLVMFuzzerInitialize) { + + fprintf(stderr, "Running LLVMFuzzerInitialize ...\n"); + LLVMFuzzerInitialize(&argc, &argv); + fprintf(stderr, "continue...\n"); + + } + + // Do any other expensive one-time initialization here. + + uint8_t dummy_input[64] = {0}; + memcpy(dummy_input, (void *)AFL_PERSISTENT, sizeof(AFL_PERSISTENT)); + memcpy(dummy_input + 32, (void *)AFL_DEFER_FORKSVR, + sizeof(AFL_DEFER_FORKSVR)); + int N = INT_MAX; + if (argc == 2 && argv[1][0] == '-') + N = atoi(argv[1] + 1); + else if (argc == 2 && (N = atoi(argv[1])) > 0) + printf("WARNING: using the deprecated call style `%s %d`\n", argv[0], N); + else if (argc > 1) { + + __afl_sharedmem_fuzzing = 0; + __afl_manual_init(); + return ExecuteFilesOnyByOne(argc, argv); + + } + + assert(N > 0); + + // if (!getenv("AFL_DRIVER_DONT_DEFER")) + __afl_manual_init(); + + // Call LLVMFuzzerTestOneInput here so that coverage caused by initialization + // on the first execution of LLVMFuzzerTestOneInput is ignored. + LLVMFuzzerTestOneInput(dummy_input, 1); + + int num_runs = 0; + while (__afl_persistent_loop(N)) { + +#ifdef _DEBUG + fprintf(stderr, "CLIENT crc: %016llx len: %u\n", + hash64(__afl_fuzz_ptr, *__afl_fuzz_len, 0xa5b35705), + *__afl_fuzz_len); + fprintf(stderr, "RECV:"); + for (int i = 0; i < *__afl_fuzz_len; i++) + fprintf(stderr, "%02x", __afl_fuzz_ptr[i]); + fprintf(stderr, "\n"); +#endif + if (*__afl_fuzz_len) { + + num_runs++; + LLVMFuzzerTestOneInput(__afl_fuzz_ptr, *__afl_fuzz_len); + + } + + } + + printf("%s: successfully executed %d input(s)\n", argv[0], num_runs); + +} + diff --git a/utils/aflpp_driver/aflpp_driver_test.c b/utils/aflpp_driver/aflpp_driver_test.c new file mode 100644 index 00000000..b4ff6bc6 --- /dev/null +++ b/utils/aflpp_driver/aflpp_driver_test.c @@ -0,0 +1,32 @@ +#include +#include +#include + +#include "hash.h" + +void __attribute__((noinline)) crashme(const uint8_t *Data, size_t Size) { + + if (Size < 5) return; + + if (Data[0] == 'F') + if (Data[1] == 'A') + if (Data[2] == '$') + if (Data[3] == '$') + if (Data[4] == '$') abort(); + +} + +int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { + + if (Size) + fprintf(stderr, "FUNC crc: %016llx len: %lu\n", + hash64((u8 *)Data, (unsigned int)Size, + (unsigned long long int)0xa5b35705), + Size); + + crashme(Data, Size); + + return 0; + +} + diff --git a/utils/aflpp_driver/aflpp_qemu_driver.c b/utils/aflpp_driver/aflpp_qemu_driver.c new file mode 100644 index 00000000..4f3e5f71 --- /dev/null +++ b/utils/aflpp_driver/aflpp_qemu_driver.c @@ -0,0 +1,38 @@ +#include +#include +#include + +// libFuzzer interface is thin, so we don't include any libFuzzer headers. +int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); +__attribute__((weak)) int LLVMFuzzerInitialize(int *argc, char ***argv); + +static const size_t kMaxAflInputSize = 1 * 1024 * 1024; +static uint8_t AflInputBuf[kMaxAflInputSize]; + +void __attribute__((noinline)) afl_qemu_driver_stdin_input(void) { + + size_t l = read(0, AflInputBuf, kMaxAflInputSize); + LLVMFuzzerTestOneInput(AflInputBuf, l); + +} + +int main(int argc, char **argv) { + + if (LLVMFuzzerInitialize) LLVMFuzzerInitialize(&argc, &argv); + // Do any other expensive one-time initialization here. + + if (getenv("AFL_QEMU_DRIVER_NO_HOOK")) { + + afl_qemu_driver_stdin_input(); + + } else { + + uint8_t dummy_input[1024000] = {0}; + LLVMFuzzerTestOneInput(dummy_input, 1); + + } + + return 0; + +} + diff --git a/utils/aflpp_driver/aflpp_qemu_driver_hook.c b/utils/aflpp_driver/aflpp_qemu_driver_hook.c new file mode 100644 index 00000000..823cc42d --- /dev/null +++ b/utils/aflpp_driver/aflpp_qemu_driver_hook.c @@ -0,0 +1,22 @@ +#include +#include + +#define g2h(x) ((void *)((unsigned long)(x) + guest_base)) + +#define REGS_RDI 7 +#define REGS_RSI 6 + +void afl_persistent_hook(uint64_t *regs, uint64_t guest_base, + uint8_t *input_buf, uint32_t input_len) { + + memcpy(g2h(regs[REGS_RDI]), input_buf, input_len); + regs[REGS_RSI] = input_len; + +} + +int afl_persistent_hook_init(void) { + + return 1; + +} + diff --git a/utils/analysis_scripts/queue2csv.sh b/utils/analysis_scripts/queue2csv.sh new file mode 100755 index 00000000..2528b438 --- /dev/null +++ b/utils/analysis_scripts/queue2csv.sh @@ -0,0 +1,122 @@ +#!/bin/bash + +test -z "$1" -o -z "$2" -o "$1" = "-h" -o "$1" = "-hh" -o "$1" = "--help" -o '!' -d "$1" && { + echo "Syntax: [-n] $0 out-directory file.csv [\"tools/target --opt @@\"]" + echo Option -n will suppress the CSV header. + echo If the target execution command is supplied then also edge coverage is gathered. + exit 1 +} + +function getval() { + VAL="" + if [ "$file" != "${file/$1/}" ]; then + TMP="${file/*$1:/}" + VAL="${TMP/,*/}" + fi +} + +SKIP= +if [ "$1" = "-n" ]; then + SKIP=1 + shift +fi + +test -n "$4" && { echo "Error: too many commandline options. Target command and options including @@ have to be passed within \"\"!"; exit 1; } + +test -d "$1"/queue && OUT="$1/queue" || OUT="$1" + +OK=`ls $OUT/id:000000,time:0,orig:* 2> /dev/null` +if [ -n "$OK" ]; then + LISTCMD="ls $OUT/id:"* +else + LISTCMD="ls -tr $OUT/" +fi + +ID=;SRC=;TIME=;OP=;POS=;REP=;EDGES=;EDGES_TOTAL=; +DIR="$OUT/../stats" +rm -rf "$DIR" +> "$2" || exit 1 +mkdir "$DIR" || exit 1 +> "$DIR/../edges.txt" || exit 1 + +{ + + if [ -z "$SKIP" ]; then + echo "time;\"filename\";id;src;new_cov;edges;total_edges;\"op\";pos;rep;unique_edges" + fi + + $LISTCMD | grep -v ,sync: | sed 's/.*id:/id:/g' | while read file; do + + if [ -n "$3" ]; then + + TMP=${3/@@/$OUT/$file} + + if [ "$TMP" = "$3" ]; then + + cat "$OUT/$file" | afl-showmap -o "$DIR/$file" -q -- $3 >/dev/null 2>&1 + + else + + afl-showmap -o "$DIR/$file" -q -- $TMP >/dev/null 2>&1 + + fi + + { cat "$DIR/$file" | sed 's/:.*//' ; cat "$DIR/../edges.txt" ; } | sort -nu > $DIR/../edges.txt.tmp + mv $DIR/../edges.txt.tmp $DIR/../edges.txt + EDGES=$(cat "$DIR/$file" | wc -l) + EDGES_TOTAL=$(cat "$DIR/../edges.txt" | wc -l) + + fi + + getval id; ID="$VAL" + getval src; SRC="$VAL" + getval time; TIME="$VAL" + getval op; OP="$VAL" + getval pos; POS="$VAL" + getval rep; REP="$VAL" + if [ "$file" != "${file/+cov/}" ]; then + COV=1 + else + COV="" + fi + + if [ -n "$3" -a -s "$DIR/../edges.txt" ]; then + echo "$TIME;\"$file\";$ID;$SRC;$COV;$EDGES;$EDGES_TOTAL;\"$OP\";$POS;$REP;UNIQUE$file" + else + echo "$TIME;\"$file\";$ID;$SRC;$COV;;;\"$OP\";$POS;$REP;" + fi + + done + +} | tee "$DIR/../queue.csv" > "$2" || exit 1 + +if [ -n "$3" -a -s "$DIR/../edges.txt" ]; then + + cat "$DIR/"* | sed 's/:.*//' | sort -n | uniq -c | egrep '^[ \t]*1 ' | awk '{print$2}' > $DIR/../unique.txt + + if [ -s "$DIR/../unique.txt" ]; then + + ls "$DIR/id:"* | grep -v ",sync:" |sed 's/.*\/id:/id:/g' | while read file; do + + CNT=$(sed 's/:.*//' "$DIR/$file" | tee "$DIR/../tmp.txt" | wc -l) + DIFF=$(diff -u "$DIR/../tmp.txt" "$DIR/../unique.txt" | egrep '^-[0-9]' | wc -l) + UNIQUE=$(($CNT - $DIFF)) + sed -i "s/;UNIQUE$file/;$UNIQUE/" "$DIR/../queue.csv" "$2" + + done + + rm -f "$DIR/../tmp.txt" + + else + + sed -i 's/;UNIQUE.*/;/' "$DIR/../queue.csv" "$2" + + fi + +fi + +mv "$DIR/../queue.csv" "$DIR/queue.csv" +if [ -e "$DIR/../edges.txt" ]; then mv "$DIR/../edges.txt" "$DIR/edges.txt"; fi +if [ -e "$DIR/../unique.txt" ]; then mv "$DIR/../unique.txt" "$DIR/unique.txt"; fi + +echo "Created $2" diff --git a/utils/argv_fuzzing/Makefile b/utils/argv_fuzzing/Makefile new file mode 100644 index 00000000..5a0ac6e6 --- /dev/null +++ b/utils/argv_fuzzing/Makefile @@ -0,0 +1,58 @@ +# +# american fuzzy lop++ - argvfuzz +# -------------------------------- +# +# Copyright 2019-2020 Kjell Braden +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# + +.PHONY: all install clean + +PREFIX ?= /usr/local +BIN_PATH = $(PREFIX)/bin +HELPER_PATH = $(PREFIX)/lib/afl + +CFLAGS = -fPIC -Wall -Wextra +LDFLAGS = -shared + +UNAME_SAYS_LINUX=$(shell uname | grep -E '^Linux|^GNU' >/dev/null; echo $$?) +UNAME_SAYS_LINUX:sh=uname | grep -E '^Linux|^GNU' >/dev/null; echo $$? + +_LDFLAGS_ADD=$(UNAME_SAYS_LINUX:1=) +LDFLAGS_ADD=$(_LDFLAGS_ADD:0=-ldl) +LDFLAGS += $(LDFLAGS_ADD) + +# on gcc for arm there is no -m32, but -mbe32 +M32FLAG = -m32 +M64FLAG = -m64 + +CC_IS_GCC=$(shell $(CC) --version 2>/dev/null | grep -q gcc; echo $$?) +CC_IS_GCC:sh=$(CC) --version 2>/dev/null | grep -q gcc; echo $$? +CC_IS_ARMCOMPILER=$(shell $(CC) -v 2>&1 >/dev/null | grep -q arm; echo $$?) +CC_IS_ARMCOMPILER:sh=$(CC) -v 2>&1 >/dev/null | grep -q arm; echo $$? + +_M32FLAG=$(CC_IS_GCC)$(CC_IS_ARMCOMPILER) +__M32FLAG=$(_M32FLAG:00=-mbe32) +___M32FLAG=$(__M32FLAG:$(CC_IS_GCC)$(CC_IS_ARMCOMPILER)=-m32) +M32FLAG=$(___M32FLAG) + +all: argvfuzz32.so argvfuzz64.so + +argvfuzz32.so: argvfuzz.c + -@$(CC) $(M32FLAG) $(CFLAGS) $^ $(LDFLAGS) -o $@ 2>/dev/null || echo "argvfuzz32 build failure (that's fine)" + +argvfuzz64.so: argvfuzz.c + -@$(CC) $(M64FLAG) $(CFLAGS) $^ $(LDFLAGS) -o $@ 2>/dev/null || echo "argvfuzz64 build failure (that's fine)" + +install: argvfuzz32.so argvfuzz64.so + install -d -m 755 $(DESTDIR)$(HELPER_PATH)/ + if [ -f argvfuzz32.so ]; then set -e; install -m 755 argvfuzz32.so $(DESTDIR)$(HELPER_PATH)/; fi + if [ -f argvfuzz64.so ]; then set -e; install -m 755 argvfuzz64.so $(DESTDIR)$(HELPER_PATH)/; fi + +clean: + rm -f argvfuzz32.so argvfuzz64.so diff --git a/utils/argv_fuzzing/README.md b/utils/argv_fuzzing/README.md new file mode 100644 index 00000000..fa8cad80 --- /dev/null +++ b/utils/argv_fuzzing/README.md @@ -0,0 +1,16 @@ +# argvfuzz + +afl supports fuzzing file inputs or stdin. When source is available, +`argv-fuzz-inl.h` can be used to change `main()` to build argv from stdin. + +`argvfuzz` tries to provide the same functionality for binaries. When loaded +using `LD_PRELOAD`, it will hook the call to `__libc_start_main` and replace +argv using the same logic of `argv-fuzz-inl.h`. + +A few conditions need to be fulfilled for this mechanism to work correctly: + +1. As it relies on hooking the loader, it cannot work on static binaries. +2. If the target binary does not use the default libc's `_start` implementation + (crt1.o), the hook may not run. +3. The hook will replace argv with pointers to `.data` of `argvfuzz.so`. If the + target binary expects argv to be living on the stack, things may go wrong. diff --git a/utils/argv_fuzzing/argv-fuzz-inl.h b/utils/argv_fuzzing/argv-fuzz-inl.h new file mode 100644 index 00000000..c15c0271 --- /dev/null +++ b/utils/argv_fuzzing/argv-fuzz-inl.h @@ -0,0 +1,90 @@ +/* + american fuzzy lop++ - sample argv fuzzing wrapper + ------------------------------------------------ + + Originally written by Michal Zalewski + + Copyright 2015 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + This file shows a simple way to fuzz command-line parameters with stock + afl-fuzz. To use, add: + + #include "/path/to/argv-fuzz-inl.h" + + ...to the file containing main(), ideally placing it after all the + standard includes. Next, put AFL_INIT_ARGV(); near the very beginning of + main(). + + This will cause the program to read NUL-delimited input from stdin and + put it in argv[]. Two subsequent NULs terminate the array. Empty + params are encoded as a lone 0x02. Lone 0x02 can't be generated, but + that shouldn't matter in real life. + + If you would like to always preserve argv[0], use this instead: + AFL_INIT_SET0("prog_name"); + +*/ + +#ifndef _HAVE_ARGV_FUZZ_INL +#define _HAVE_ARGV_FUZZ_INL + +#include + +#define AFL_INIT_ARGV() \ + do { \ + \ + argv = afl_init_argv(&argc); \ + \ + } while (0) + +#define AFL_INIT_SET0(_p) \ + do { \ + \ + argv = afl_init_argv(&argc); \ + argv[0] = (_p); \ + if (!argc) argc = 1; \ + \ + } while (0) + +#define MAX_CMDLINE_LEN 100000 +#define MAX_CMDLINE_PAR 50000 + +static char **afl_init_argv(int *argc) { + + static char in_buf[MAX_CMDLINE_LEN]; + static char *ret[MAX_CMDLINE_PAR]; + + char *ptr = in_buf; + int rc = 0; + + if (read(0, in_buf, MAX_CMDLINE_LEN - 2) < 0) {} + + while (*ptr && rc < MAX_CMDLINE_PAR) { + + ret[rc] = ptr; + if (ret[rc][0] == 0x02 && !ret[rc][1]) ret[rc]++; + rc++; + + while (*ptr) + ptr++; + ptr++; + + } + + *argc = rc; + + return ret; + +} + +#undef MAX_CMDLINE_LEN +#undef MAX_CMDLINE_PAR + +#endif /* !_HAVE_ARGV_FUZZ_INL */ + diff --git a/utils/argv_fuzzing/argvfuzz.c b/utils/argv_fuzzing/argvfuzz.c new file mode 100644 index 00000000..4251ca4c --- /dev/null +++ b/utils/argv_fuzzing/argvfuzz.c @@ -0,0 +1,49 @@ +/* + american fuzzy lop++ - LD_PRELOAD for fuzzing argv in binaries + ------------------------------------------------------------ + + Copyright 2019-2020 Kjell Braden + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + */ + +#define _GNU_SOURCE /* for RTLD_NEXT */ +#include +#include +#include +#include +#include "argv-fuzz-inl.h" + +int __libc_start_main(int (*main)(int, char **, char **), int argc, char **argv, + void (*init)(void), void (*fini)(void), + void (*rtld_fini)(void), void *stack_end) { + + int (*orig)(int (*main)(int, char **, char **), int argc, char **argv, + void (*init)(void), void (*fini)(void), void (*rtld_fini)(void), + void *stack_end); + int sub_argc; + char **sub_argv; + + (void)argc; + (void)argv; + + orig = dlsym(RTLD_NEXT, __func__); + + if (!orig) { + + fprintf(stderr, "hook did not find original %s: %s\n", __func__, dlerror()); + exit(EXIT_FAILURE); + + } + + sub_argv = afl_init_argv(&sub_argc); + + return orig(main, sub_argc, sub_argv, init, fini, rtld_fini, stack_end); + +} + diff --git a/utils/asan_cgroups/limit_memory.sh b/utils/asan_cgroups/limit_memory.sh new file mode 100755 index 00000000..1f0f04ad --- /dev/null +++ b/utils/asan_cgroups/limit_memory.sh @@ -0,0 +1,157 @@ +#!/usr/bin/env bash +# +# american fuzzy lop++ - limit memory using cgroups +# ----------------------------------------------- +# +# Written by Samir Khakimov and +# David A. Wheeler +# +# Edits to bring the script in line with afl-cmin and other companion scripts +# by Michal Zalewski. All bugs are my fault. +# +# Copyright 2015 Institute for Defense Analyses. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# This tool allows the amount of actual memory allocated to a program +# to be limited on Linux systems using cgroups, instead of the traditional +# setrlimit() API. This helps avoid the address space problems discussed in +# docs/notes_for_asan.md. +# +# Important: the limit covers *both* afl-fuzz and the fuzzed binary. In some +# hopefully rare circumstances, afl-fuzz could be killed before the fuzzed +# task. +# + +echo "cgroup tool for afl-fuzz by and " +echo + +unset NEW_USER +MEM_LIMIT="50" + +while getopts "+u:m:" opt; do + + case "$opt" in + + "u") + NEW_USER="$OPTARG" + ;; + + "m") + MEM_LIMIT="$[OPTARG]" + ;; + + "?") + exit 1 + ;; + + esac + +done + +if [ "$MEM_LIMIT" -lt "5" ]; then + echo "[-] Error: malformed or dangerously low value of -m." 1>&2 + exit 1 +fi + +shift $((OPTIND-1)) + +TARGET_BIN="$1" + +if [ "$TARGET_BIN" = "" -o "$NEW_USER" = "" ]; then + + cat 1>&2 <<_EOF_ +Usage: $0 [ options ] -- /path/to/afl-fuzz [ ...afl options... ] + +Required parameters: + + -u user - run the fuzzer as a specific user after setting up limits + +Optional parameters: + + -m megs - set memory limit to a specified value ($MEM_LIMIT MB) + +This tool configures cgroups-based memory limits for a fuzzing job to simplify +the task of fuzzing ASAN or MSAN binaries. You would normally want to use it in +conjunction with '-m none' passed to the afl-fuzz binary itself, say: + + $0 -u joe ./afl-fuzz -i input -o output -m none /path/to/target + +_EOF_ + + exit 1 + +fi + +# Basic sanity checks + +if [ ! "`uname -s`" = "Linux" ]; then + echo "[-] Error: this tool does not support non-Linux systems." 1>&2 + exit 1 +fi + +if [ ! "`id -u`" = "0" ]; then + echo "[-] Error: you need to run this script as root (sorry!)." 1>&2 + exit 1 +fi + +if ! type cgcreate 2>/dev/null 1>&2; then + + echo "[-] Error: you need to install cgroup tools first." 1>&2 + + if type apt-get 2>/dev/null 1>&2; then + echo " (Perhaps 'apt-get install cgroup-bin' will work.)" 1>&2 + elif type yum 2>/dev/null 1>&2; then + echo " (Perhaps 'yum install libcgroup-tools' will work.)" 1>&2 + fi + + exit 1 + +fi + +if ! id -u "$NEW_USER" 2>/dev/null 1>&2; then + echo "[-] Error: user '$NEW_USER' does not seem to exist." 1>&2 + exit 1 +fi + +# Create a new cgroup path if necessary... We used PID-keyed groups to keep +# parallel afl-fuzz tasks separate from each other. + +CID="afl-$NEW_USER-$$" + +CPATH="/sys/fs/cgroup/memory/$CID" + +if [ ! -d "$CPATH" ]; then + + cgcreate -a "$NEW_USER" -g memory:"$CID" || exit 1 + +fi + +# Set the appropriate limit... + +if [ -f "$CPATH/memory.memsw.limit_in_bytes" ]; then + + echo "${MEM_LIMIT}M" > "$CPATH/memory.limit_in_bytes" 2>/dev/null + echo "${MEM_LIMIT}M" > "$CPATH/memory.memsw.limit_in_bytes" || exit 1 + echo "${MEM_LIMIT}M" > "$CPATH/memory.limit_in_bytes" || exit 1 + +elif grep -qE 'partition|file' /proc/swaps; then + + echo "[-] Error: your system requires swap to be disabled first (swapoff -a)." 1>&2 + exit 1 + +else + + echo "${MEM_LIMIT}M" > "$CPATH/memory.limit_in_bytes" || exit 1 + +fi + +# All right. At this point, we can just run the command. + +cgexec -g "memory:$CID" su -c "$*" "$NEW_USER" + +cgdelete -g "memory:$CID" diff --git a/utils/bash_shellshock/shellshock-fuzz.diff b/utils/bash_shellshock/shellshock-fuzz.diff new file mode 100644 index 00000000..3fa05bf8 --- /dev/null +++ b/utils/bash_shellshock/shellshock-fuzz.diff @@ -0,0 +1,59 @@ +This patch shows a very simple way to find post-Shellshock bugs in bash, as +discussed here: + + http://lcamtuf.blogspot.com/2014/10/bash-bug-how-we-finally-cracked.html + +In essence, it shows a way to fuzz environmental variables. Instructions: + +1) Download bash 4.3, apply this patch, compile with: + + CC=/path/to/afl-gcc ./configure + make clean all + + Note that the harness puts the fuzzed output in $TEST_VARIABLE. With + Florian's Shellshock patch (bash43-028), this is no longer passed down + to the parser. + +2) Create and cd to an empty directory, put the compiled bash binary in + there, and run these commands: + + mkdir in_dir + echo -n '() { a() { a; }; : >b; }' >in_dir/script.txt + +3) Run the fuzzer with: + + /path/to/afl-fuzz -d -i in_dir -o out_dir ./bash -c : + + The -d parameter is advisable only if the tested shell is fairly slow + or if you are in a hurry; will cover more ground faster, but + less systematically. + +4) Watch for crashes in out_dir/crashes/. Also watch for any new files + created in cwd if you're interested in non-crash RCEs (files will be + created whenever the shell executes "foo>bar" or something like + that). You can correlate their creation date with new entries in + out_dir/queue/. + + You can also modify the bash binary to directly check for more subtle + fault conditions, or use the synthesized entries in out_dir/queue/ + as a seed for other, possibly slower or more involved testing regimes. + + Expect several hours to get decent coverage. + +--- bash-4.3/shell.c.orig 2014-01-14 14:04:32.000000000 +0100 ++++ bash-4.3/shell.c 2015-04-30 05:56:46.000000000 +0200 +@@ -371,6 +371,14 @@ + env = environ; + #endif /* __OPENNT */ + ++ { ++ ++ static char val[1024 * 16]; ++ read(0, val, sizeof(val) - 1); ++ setenv("TEST_VARIABLE", val, 1); ++ ++ } ++ + USE_VAR(argc); + USE_VAR(argv); + USE_VAR(env); diff --git a/utils/canvas_harness/canvas_harness.html b/utils/canvas_harness/canvas_harness.html new file mode 100644 index 00000000..a37b6937 --- /dev/null +++ b/utils/canvas_harness/canvas_harness.html @@ -0,0 +1,170 @@ + + + + + +
+ +
+ + + +

Results

+ +
    + + + + diff --git a/utils/clang_asm_normalize/as b/utils/clang_asm_normalize/as new file mode 100755 index 00000000..45537cae --- /dev/null +++ b/utils/clang_asm_normalize/as @@ -0,0 +1,75 @@ +#!/bin/sh +# +# american fuzzy lop++ - clang assembly normalizer +# ---------------------------------------------- +# +# Originally written by Michal Zalewski +# The idea for this wrapper comes from Ryan Govostes. +# +# Copyright 2013, 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# This 'as' wrapper should allow you to instrument unruly, hand-written +# assembly with afl-as. +# +# Usage: +# +# export AFL_REAL_PATH=/path/to/directory/with/afl-as/ +# AFL_PATH=/path/to/this/directory/ make clean all + +if [ "$#" -lt "2" ]; then + echo "[-] Error: this utility can't be called directly." 1>&2 + exit 1 +fi + +if [ "$AFL_REAL_PATH" = "" ]; then + echo "[-] Error: AFL_REAL_PATH not set!" 1>&2 + exit 1 +fi + +if [ ! -x "$AFL_REAL_PATH/afl-as" ]; then + echo "[-] Error: AFL_REAL_PATH does not contain the 'afl-as' binary." 1>&2 + exit 1 +fi + +unset __AFL_AS_CMDLINE __AFL_FNAME + +while [ ! "$#" = "0" ]; do + + if [ "$#" = "1" ]; then + __AFL_FNAME="$1" + else + __AFL_AS_CMDLINE="${__AFL_AS_CMDLINE} $1" + fi + + shift + +done + +test "$TMPDIR" = "" && TMPDIR=/tmp + +TMPFILE=`mktemp $TMPDIR/.afl-XXXXXXXXXX.s` + +test "$TMPFILE" = "" && exit 1 + +clang -cc1as -filetype asm -output-asm-variant 0 "${__AFL_FNAME}" >"$TMPFILE" + +ERR="$?" + +if [ ! "$ERR" = "0" ]; then + rm -f "$TMPFILE" + exit $ERR +fi + +"$AFL_REAL_PATH/afl-as" ${__AFL_AS_CMDLINE} "$TMPFILE" + +ERR="$?" + +rm -f "$TMPFILE" + +exit "$ERR" diff --git a/utils/crash_triage/triage_crashes.sh b/utils/crash_triage/triage_crashes.sh new file mode 100755 index 00000000..bf763cba --- /dev/null +++ b/utils/crash_triage/triage_crashes.sh @@ -0,0 +1,115 @@ +#!/bin/sh +# +# american fuzzy lop++ - crash triage utility +# ----------------------------------------- +# +# Originally written by Michal Zalewski +# +# Copyright 2013, 2014, 2017 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Note that this assumes that the targeted application reads from stdin +# and requires no other cmdline parameters. Modify as needed if this is +# not the case. +# +# Note that on OpenBSD, you may need to install a newer version of gdb +# (e.g., from ports). You can set GDB=/some/path to point to it if +# necessary. +# + +echo "crash triage utility for afl-fuzz by Michal Zalewski" +echo + +ulimit -v 100000 2>/dev/null +ulimit -d 100000 2>/dev/null + +if [ "$#" -lt "2" ]; then + echo "Usage: $0 /path/to/afl_output_dir /path/to/tested_binary [...target params...]" 1>&2 + echo 1>&2 + exit 1 +fi + +DIR="$1" +BIN="$2" +shift +shift + +if [ "$AFL_ALLOW_TMP" = "" ]; then + + echo "$DIR" | grep -qE '^(/var)?/tmp/' + T1="$?" + + echo "$BIN" | grep -qE '^(/var)?/tmp/' + T2="$?" + + if [ "$T1" = "0" -o "$T2" = "0" ]; then + echo "[-] Error: do not use shared /tmp or /var/tmp directories with this script." 1>&2 + exit 1 + fi + +fi + +if + [ "$GDB" = "" ]; then + GDB=gdb +fi + +if [ ! -f "$BIN" -o ! -x "$BIN" ]; then + echo "[-] Error: binary '$2' not found or is not executable." 1>&2 + exit 1 +fi + +if [ ! -d "$DIR/queue" ]; then + echo "[-] Error: directory '$1' not found or not created by afl-fuzz." 1>&2 + exit 1 +fi + +CCOUNT=$((`ls -- "$DIR/crashes" 2>/dev/null | wc -l`)) + +if [ "$CCOUNT" = "0" ]; then + echo "No crashes recorded in the target directory - nothing to be done." + exit 0 +fi + +echo + +for crash in $DIR/crashes/id:*; do + + id=`basename -- "$crash" | cut -d, -f1 | cut -d: -f2` + sig=`basename -- "$crash" | cut -d, -f2 | cut -d: -f2` + + # Grab the args, converting @@ to $crash + + use_args="" + use_stdio=1 + + for a in $@; do + + if [ "$a" = "@@" ] ; then + use_args="$use_args $crash" + unset use_stdio + else + use_args="$use_args $a" + fi + + done + + # Strip the trailing space + use_args="${use_args# }" + + echo "+++ ID $id, SIGNAL $sig +++" + echo + + if [ "$use_stdio" = "1" ]; then + $GDB --batch -q --ex "r $use_args <$crash" --ex 'back' --ex 'disass $pc, $pc+16' --ex 'info reg' --ex 'quit' "$BIN" 0 + +#define INITIAL_GROWTH_SIZE (64) + +#define RAND_BELOW(limit) (rand() % (limit)) + +/* Use in a struct: creates a name_buf and a name_size variable. */ +#define BUF_VAR(type, name) \ + type * name##_buf; \ + size_t name##_size; +/* this fills in `&structptr->something_buf, &structptr->something_size`. */ +#define BUF_PARAMS(struct, name) \ + (void **)&struct->name##_buf, &struct->name##_size + +typedef struct { + +} afl_t; + +static void surgical_havoc_mutate(u8 *out_buf, s32 begin, s32 end) { + + static s8 interesting_8[] = {INTERESTING_8}; + static s16 interesting_16[] = {INTERESTING_8, INTERESTING_16}; + static s32 interesting_32[] = {INTERESTING_8, INTERESTING_16, INTERESTING_32}; + + switch (RAND_BELOW(12)) { + + case 0: { + + /* Flip a single bit somewhere. Spooky! */ + + s32 bit_idx = ((RAND_BELOW(end - begin) + begin) << 3) + RAND_BELOW(8); + + out_buf[bit_idx >> 3] ^= 128 >> (bit_idx & 7); + + break; + + } + + case 1: { + + /* Set byte to interesting value. */ + + u8 val = interesting_8[RAND_BELOW(sizeof(interesting_8))]; + out_buf[(RAND_BELOW(end - begin) + begin)] = val; + + break; + + } + + case 2: { + + /* Set word to interesting value, randomly choosing endian. */ + + if (end - begin < 2) break; + + s32 byte_idx = (RAND_BELOW(end - begin) + begin); + + if (byte_idx >= end - 1) break; + + switch (RAND_BELOW(2)) { + + case 0: + *(u16 *)(out_buf + byte_idx) = + interesting_16[RAND_BELOW(sizeof(interesting_16) >> 1)]; + break; + case 1: + *(u16 *)(out_buf + byte_idx) = + SWAP16(interesting_16[RAND_BELOW(sizeof(interesting_16) >> 1)]); + break; + + } + + break; + + } + + case 3: { + + /* Set dword to interesting value, randomly choosing endian. */ + + if (end - begin < 4) break; + + s32 byte_idx = (RAND_BELOW(end - begin) + begin); + + if (byte_idx >= end - 3) break; + + switch (RAND_BELOW(2)) { + + case 0: + *(u32 *)(out_buf + byte_idx) = + interesting_32[RAND_BELOW(sizeof(interesting_32) >> 2)]; + break; + case 1: + *(u32 *)(out_buf + byte_idx) = + SWAP32(interesting_32[RAND_BELOW(sizeof(interesting_32) >> 2)]); + break; + + } + + break; + + } + + case 4: { + + /* Set qword to interesting value, randomly choosing endian. */ + + if (end - begin < 8) break; + + s32 byte_idx = (RAND_BELOW(end - begin) + begin); + + if (byte_idx >= end - 7) break; + + switch (RAND_BELOW(2)) { + + case 0: + *(u64 *)(out_buf + byte_idx) = + (s64)interesting_32[RAND_BELOW(sizeof(interesting_32) >> 2)]; + break; + case 1: + *(u64 *)(out_buf + byte_idx) = SWAP64( + (s64)interesting_32[RAND_BELOW(sizeof(interesting_32) >> 2)]); + break; + + } + + break; + + } + + case 5: { + + /* Randomly subtract from byte. */ + + out_buf[(RAND_BELOW(end - begin) + begin)] -= 1 + RAND_BELOW(ARITH_MAX); + + break; + + } + + case 6: { + + /* Randomly add to byte. */ + + out_buf[(RAND_BELOW(end - begin) + begin)] += 1 + RAND_BELOW(ARITH_MAX); + + break; + + } + + case 7: { + + /* Randomly subtract from word, random endian. */ + + if (end - begin < 2) break; + + s32 byte_idx = (RAND_BELOW(end - begin) + begin); + + if (byte_idx >= end - 1) break; + + if (RAND_BELOW(2)) { + + *(u16 *)(out_buf + byte_idx) -= 1 + RAND_BELOW(ARITH_MAX); + + } else { + + u16 num = 1 + RAND_BELOW(ARITH_MAX); + + *(u16 *)(out_buf + byte_idx) = + SWAP16(SWAP16(*(u16 *)(out_buf + byte_idx)) - num); + + } + + break; + + } + + case 8: { + + /* Randomly add to word, random endian. */ + + if (end - begin < 2) break; + + s32 byte_idx = (RAND_BELOW(end - begin) + begin); + + if (byte_idx >= end - 1) break; + + if (RAND_BELOW(2)) { + + *(u16 *)(out_buf + byte_idx) += 1 + RAND_BELOW(ARITH_MAX); + + } else { + + u16 num = 1 + RAND_BELOW(ARITH_MAX); + + *(u16 *)(out_buf + byte_idx) = + SWAP16(SWAP16(*(u16 *)(out_buf + byte_idx)) + num); + + } + + break; + + } + + case 9: { + + /* Randomly subtract from dword, random endian. */ + + if (end - begin < 4) break; + + s32 byte_idx = (RAND_BELOW(end - begin) + begin); + + if (byte_idx >= end - 3) break; + + if (RAND_BELOW(2)) { + + *(u32 *)(out_buf + byte_idx) -= 1 + RAND_BELOW(ARITH_MAX); + + } else { + + u32 num = 1 + RAND_BELOW(ARITH_MAX); + + *(u32 *)(out_buf + byte_idx) = + SWAP32(SWAP32(*(u32 *)(out_buf + byte_idx)) - num); + + } + + break; + + } + + case 10: { + + /* Randomly add to dword, random endian. */ + + if (end - begin < 4) break; + + s32 byte_idx = (RAND_BELOW(end - begin) + begin); + + if (byte_idx >= end - 3) break; + + if (RAND_BELOW(2)) { + + *(u32 *)(out_buf + byte_idx) += 1 + RAND_BELOW(ARITH_MAX); + + } else { + + u32 num = 1 + RAND_BELOW(ARITH_MAX); + + *(u32 *)(out_buf + byte_idx) = + SWAP32(SWAP32(*(u32 *)(out_buf + byte_idx)) + num); + + } + + break; + + } + + case 11: { + + /* Just set a random byte to a random value. Because, + why not. We use XOR with 1-255 to eliminate the + possibility of a no-op. */ + + out_buf[(RAND_BELOW(end - begin) + begin)] ^= 1 + RAND_BELOW(255); + + break; + + } + + } + +} + +/* This function calculates the next power of 2 greater or equal its argument. + @return The rounded up power of 2 (if no overflow) or 0 on overflow. +*/ +static inline size_t next_pow2(size_t in) { + + if (in == 0 || in > (size_t)-1) + return 0; /* avoid undefined behaviour under-/overflow */ + size_t out = in - 1; + out |= out >> 1; + out |= out >> 2; + out |= out >> 4; + out |= out >> 8; + out |= out >> 16; + return out + 1; + +} + +/* This function makes sure *size is > size_needed after call. + It will realloc *buf otherwise. + *size will grow exponentially as per: + https://blog.mozilla.org/nnethercote/2014/11/04/please-grow-your-buffers-exponentially/ + Will return NULL and free *buf if size_needed is <1 or realloc failed. + @return For convenience, this function returns *buf. + */ +static inline void *maybe_grow(void **buf, size_t *size, size_t size_needed) { + + /* No need to realloc */ + if (likely(size_needed && *size >= size_needed)) return *buf; + + /* No initial size was set */ + if (size_needed < INITIAL_GROWTH_SIZE) size_needed = INITIAL_GROWTH_SIZE; + + /* grow exponentially */ + size_t next_size = next_pow2(size_needed); + + /* handle overflow */ + if (!next_size) { next_size = size_needed; } + + /* alloc */ + *buf = realloc(*buf, next_size); + *size = *buf ? next_size : 0; + + return *buf; + +} + +/* Swaps buf1 ptr and buf2 ptr, as well as their sizes */ +static inline void afl_swap_bufs(void **buf1, size_t *size1, void **buf2, + size_t *size2) { + + void * scratch_buf = *buf1; + size_t scratch_size = *size1; + *buf1 = *buf2; + *size1 = *size2; + *buf2 = scratch_buf; + *size2 = scratch_size; + +} + +#undef INITIAL_GROWTH_SIZE + +#endif + diff --git a/utils/custom_mutators/example.c b/utils/custom_mutators/example.c new file mode 100644 index 00000000..23add128 --- /dev/null +++ b/utils/custom_mutators/example.c @@ -0,0 +1,376 @@ +/* + New Custom Mutator for AFL++ + Written by Khaled Yakdan + Andrea Fioraldi + Shengtuo Hu + Dominik Maier +*/ + +// You need to use -I /path/to/AFLplusplus/include +#include "custom_mutator_helpers.h" + +#include +#include +#include +#include + +#define DATA_SIZE (100) + +static const char *commands[] = { + + "GET", + "PUT", + "DEL", + +}; + +typedef struct my_mutator { + + afl_t *afl; + + // any additional data here! + size_t trim_size_current; + int trimmming_steps; + int cur_step; + + // Reused buffers: + BUF_VAR(u8, fuzz); + BUF_VAR(u8, data); + BUF_VAR(u8, havoc); + BUF_VAR(u8, trim); + BUF_VAR(u8, post_process); + +} my_mutator_t; + +/** + * Initialize this custom mutator + * + * @param[in] afl a pointer to the internal state object. Can be ignored for + * now. + * @param[in] seed A seed for this mutator - the same seed should always mutate + * in the same way. + * @return Pointer to the data object this custom mutator instance should use. + * There may be multiple instances of this mutator in one afl-fuzz run! + * Return NULL on error. + */ +my_mutator_t *afl_custom_init(afl_t *afl, unsigned int seed) { + + srand(seed); // needed also by surgical_havoc_mutate() + + my_mutator_t *data = calloc(1, sizeof(my_mutator_t)); + if (!data) { + + perror("afl_custom_init alloc"); + return NULL; + + } + + data->afl = afl; + + return data; + +} + +/** + * Perform custom mutations on a given input + * + * (Optional for now. Required in the future) + * + * @param[in] data pointer returned in afl_custom_init for this fuzz case + * @param[in] buf Pointer to input data to be mutated + * @param[in] buf_size Size of input data + * @param[out] out_buf the buffer we will work on. we can reuse *buf. NULL on + * error. + * @param[in] add_buf Buffer containing the additional test case + * @param[in] add_buf_size Size of the additional test case + * @param[in] max_size Maximum size of the mutated output. The mutation must not + * produce data larger than max_size. + * @return Size of the mutated output. + */ +size_t afl_custom_fuzz(my_mutator_t *data, uint8_t *buf, size_t buf_size, + u8 **out_buf, uint8_t *add_buf, + size_t add_buf_size, // add_buf can be NULL + size_t max_size) { + + // Make sure that the packet size does not exceed the maximum size expected by + // the fuzzer + size_t mutated_size = DATA_SIZE <= max_size ? DATA_SIZE : max_size; + + // maybe_grow is optimized to be quick for reused buffers. + u8 *mutated_out = maybe_grow(BUF_PARAMS(data, fuzz), mutated_size); + if (!mutated_out) { + + *out_buf = NULL; + perror("custom mutator allocation (maybe_grow)"); + return 0; /* afl-fuzz will very likely error out after this. */ + + } + + // Randomly select a command string to add as a header to the packet + memcpy(mutated_out, commands[rand() % 3], 3); + + // Mutate the payload of the packet + int i; + for (i = 0; i < 8; ++i) { + + // Randomly perform one of the (no len modification) havoc mutations + surgical_havoc_mutate(mutated_out, 3, mutated_size); + + } + + *out_buf = mutated_out; + return mutated_size; + +} + +/** + * A post-processing function to use right before AFL writes the test case to + * disk in order to execute the target. + * + * (Optional) If this functionality is not needed, simply don't define this + * function. + * + * @param[in] data pointer returned in afl_custom_init for this fuzz case + * @param[in] buf Buffer containing the test case to be executed + * @param[in] buf_size Size of the test case + * @param[out] out_buf Pointer to the buffer containing the test case after + * processing. External library should allocate memory for out_buf. + * The buf pointer may be reused (up to the given buf_size); + * @return Size of the output buffer after processing or the needed amount. + * A return of 0 indicates an error. + */ +size_t afl_custom_post_process(my_mutator_t *data, uint8_t *buf, + size_t buf_size, uint8_t **out_buf) { + + uint8_t *post_process_buf = + maybe_grow(BUF_PARAMS(data, post_process), buf_size + 5); + if (!post_process_buf) { + + perror("custom mutator realloc failed."); + *out_buf = NULL; + return 0; + + } + + memcpy(post_process_buf + 5, buf, buf_size); + post_process_buf[0] = 'A'; + post_process_buf[1] = 'F'; + post_process_buf[2] = 'L'; + post_process_buf[3] = '+'; + post_process_buf[4] = '+'; + + *out_buf = post_process_buf; + + return buf_size + 5; + +} + +/** + * This method is called at the start of each trimming operation and receives + * the initial buffer. It should return the amount of iteration steps possible + * on this input (e.g. if your input has n elements and you want to remove + * them one by one, return n, if you do a binary search, return log(n), + * and so on...). + * + * If your trimming algorithm doesn't allow you to determine the amount of + * (remaining) steps easily (esp. while running), then you can alternatively + * return 1 here and always return 0 in post_trim until you are finished and + * no steps remain. In that case, returning 1 in post_trim will end the + * trimming routine. The whole current index/max iterations stuff is only used + * to show progress. + * + * (Optional) + * + * @param data pointer returned in afl_custom_init for this fuzz case + * @param buf Buffer containing the test case + * @param buf_size Size of the test case + * @return The amount of possible iteration steps to trim the input. + * negative on error. + */ +int32_t afl_custom_init_trim(my_mutator_t *data, uint8_t *buf, + size_t buf_size) { + + // We simply trim once + data->trimmming_steps = 1; + + data->cur_step = 0; + + if (!maybe_grow(BUF_PARAMS(data, trim), buf_size)) { + + perror("init_trim grow"); + return -1; + + } + + memcpy(data->trim_buf, buf, buf_size); + + data->trim_size_current = buf_size; + + return data->trimmming_steps; + +} + +/** + * This method is called for each trimming operation. It doesn't have any + * arguments because we already have the initial buffer from init_trim and we + * can memorize the current state in *data. This can also save + * reparsing steps for each iteration. It should return the trimmed input + * buffer, where the returned data must not exceed the initial input data in + * length. Returning anything that is larger than the original data (passed + * to init_trim) will result in a fatal abort of AFLFuzz. + * + * (Optional) + * + * @param[in] data pointer returned in afl_custom_init for this fuzz case + * @param[out] out_buf Pointer to the buffer containing the trimmed test case. + * External library should allocate memory for out_buf. + * AFL++ will not release the memory after saving the test case. + * Keep a ref in *data. + * *out_buf = NULL is treated as error. + * @return Pointer to the size of the trimmed test case + */ +size_t afl_custom_trim(my_mutator_t *data, uint8_t **out_buf) { + + *out_buf = data->trim_buf; + + // Remove the last byte of the trimming input + return data->trim_size_current - 1; + +} + +/** + * This method is called after each trim operation to inform you if your + * trimming step was successful or not (in terms of coverage). If you receive + * a failure here, you should reset your input to the last known good state. + * + * (Optional) + * + * @param[in] data pointer returned in afl_custom_init for this fuzz case + * @param success Indicates if the last trim operation was successful. + * @return The next trim iteration index (from 0 to the maximum amount of + * steps returned in init_trim). negative ret on failure. + */ +int32_t afl_custom_post_trim(my_mutator_t *data, int success) { + + if (success) { + + ++data->cur_step; + return data->cur_step; + + } + + return data->trimmming_steps; + +} + +/** + * Perform a single custom mutation on a given input. + * This mutation is stacked with the other muatations in havoc. + * + * (Optional) + * + * @param[in] data pointer returned in afl_custom_init for this fuzz case + * @param[in] buf Pointer to the input data to be mutated and the mutated + * output + * @param[in] buf_size Size of input data + * @param[out] out_buf The output buffer. buf can be reused, if the content + * fits. *out_buf = NULL is treated as error. + * @param[in] max_size Maximum size of the mutated output. The mutation must + * not produce data larger than max_size. + * @return Size of the mutated output. + */ +size_t afl_custom_havoc_mutation(my_mutator_t *data, u8 *buf, size_t buf_size, + u8 **out_buf, size_t max_size) { + + if (buf_size == 0) { + + *out_buf = maybe_grow(BUF_PARAMS(data, havoc), 1); + if (!*out_buf) { + + perror("custom havoc: maybe_grow"); + return 0; + + } + + **out_buf = rand() % 256; + buf_size = 1; + + } else { + + // We reuse buf here. It's legal and faster. + *out_buf = buf; + + } + + size_t victim = rand() % buf_size; + (*out_buf)[victim] += rand() % 10; + + return buf_size; + +} + +/** + * Return the probability (in percentage) that afl_custom_havoc_mutation + * is called in havoc. By default it is 6 %. + * + * (Optional) + * + * @param[in] data pointer returned in afl_custom_init for this fuzz case + * @return The probability (0-100). + */ +uint8_t afl_custom_havoc_mutation_probability(my_mutator_t *data) { + + return 5; // 5 % + +} + +/** + * Determine whether the fuzzer should fuzz the queue entry or not. + * + * (Optional) + * + * @param[in] data pointer returned in afl_custom_init for this fuzz case + * @param filename File name of the test case in the queue entry + * @return Return True(1) if the fuzzer will fuzz the queue entry, and + * False(0) otherwise. + */ +uint8_t afl_custom_queue_get(my_mutator_t *data, const uint8_t *filename) { + + return 1; + +} + +/** + * Allow for additional analysis (e.g. calling a different tool that does a + * different kind of coverage and saves this for the custom mutator). + * + * (Optional) + * + * @param data pointer returned in afl_custom_init for this fuzz case + * @param filename_new_queue File name of the new queue entry + * @param filename_orig_queue File name of the original queue entry + */ +void afl_custom_queue_new_entry(my_mutator_t * data, + const uint8_t *filename_new_queue, + const uint8_t *filename_orig_queue) { + + /* Additional analysis on the original or new test case */ + +} + +/** + * Deinitialize everything + * + * @param data The data ptr from afl_custom_init + */ +void afl_custom_deinit(my_mutator_t *data) { + + free(data->post_process_buf); + free(data->havoc_buf); + free(data->data_buf); + free(data->fuzz_buf); + free(data->trim_buf); + free(data); + +} + diff --git a/utils/custom_mutators/example.py b/utils/custom_mutators/example.py new file mode 100644 index 00000000..cf659e5a --- /dev/null +++ b/utils/custom_mutators/example.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python +# encoding: utf-8 +''' +Example Python Module for AFLFuzz + +@author: Christian Holler (:decoder) + +@license: + +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +@contact: choller@mozilla.com +''' + +import random + + +COMMANDS = [ + b"GET", + b"PUT", + b"DEL", + b"AAAAAAAAAAAAAAAAA", +] + + +def init(seed): + ''' + Called once when AFLFuzz starts up. Used to seed our RNG. + + @type seed: int + @param seed: A 32-bit random value + ''' + random.seed(seed) + + +def deinit(): + pass + + +def fuzz(buf, add_buf, max_size): + ''' + Called per fuzzing iteration. + + @type buf: bytearray + @param buf: The buffer that should be mutated. + + @type add_buf: bytearray + @param add_buf: A second buffer that can be used as mutation source. + + @type max_size: int + @param max_size: Maximum size of the mutated output. The mutation must not + produce data larger than max_size. + + @rtype: bytearray + @return: A new bytearray containing the mutated data + ''' + ret = bytearray(100) + + ret[:3] = random.choice(COMMANDS) + + return ret + +# Uncomment and implement the following methods if you want to use a custom +# trimming algorithm. See also the documentation for a better API description. + +# def init_trim(buf): +# ''' +# Called per trimming iteration. +# +# @type buf: bytearray +# @param buf: The buffer that should be trimmed. +# +# @rtype: int +# @return: The maximum number of trimming steps. +# ''' +# global ... +# +# # Initialize global variables +# +# # Figure out how many trimming steps are possible. +# # If this is not possible for your trimming, you can +# # return 1 instead and always return 0 in post_trim +# # until you are done (then you return 1). +# +# return steps +# +# def trim(): +# ''' +# Called per trimming iteration. +# +# @rtype: bytearray +# @return: A new bytearray containing the trimmed data. +# ''' +# global ... +# +# # Implement the actual trimming here +# +# return bytearray(...) +# +# def post_trim(success): +# ''' +# Called after each trimming operation. +# +# @type success: bool +# @param success: Indicates if the last trim operation was successful. +# +# @rtype: int +# @return: The next trim index (0 to max number of steps) where max +# number of steps indicates the trimming is done. +# ''' +# global ... +# +# if not success: +# # Restore last known successful input, determine next index +# else: +# # Just determine the next index, based on what was successfully +# # removed in the last step +# +# return next_index +# +# def post_process(buf): +# ''' +# Called just before the execution to write the test case in the format +# expected by the target +# +# @type buf: bytearray +# @param buf: The buffer containing the test case to be executed +# +# @rtype: bytearray +# @return: The buffer containing the test case after +# ''' +# return buf +# +# def havoc_mutation(buf, max_size): +# ''' +# Perform a single custom mutation on a given input. +# +# @type buf: bytearray +# @param buf: The buffer that should be mutated. +# +# @type max_size: int +# @param max_size: Maximum size of the mutated output. The mutation must not +# produce data larger than max_size. +# +# @rtype: bytearray +# @return: A new bytearray containing the mutated data +# ''' +# return mutated_buf +# +# def havoc_mutation_probability(): +# ''' +# Called for each `havoc_mutation`. Return the probability (in percentage) +# that `havoc_mutation` is called in havoc. Be default it is 6%. +# +# @rtype: int +# @return: The probability (0-100) +# ''' +# return prob +# +# def queue_get(filename): +# ''' +# Called at the beginning of each fuzz iteration to determine whether the +# test case should be fuzzed +# +# @type filename: str +# @param filename: File name of the test case in the current queue entry +# +# @rtype: bool +# @return: Return True if the custom mutator decides to fuzz the test case, +# and False otherwise +# ''' +# return True +# +# def queue_new_entry(filename_new_queue, filename_orig_queue): +# ''' +# Called after adding a new test case to the queue +# +# @type filename_new_queue: str +# @param filename_new_queue: File name of the new queue entry +# +# @type filename_orig_queue: str +# @param filename_orig_queue: File name of the original queue entry +# ''' +# pass diff --git a/utils/custom_mutators/post_library_gif.so.c b/utils/custom_mutators/post_library_gif.so.c new file mode 100644 index 00000000..ac10f409 --- /dev/null +++ b/utils/custom_mutators/post_library_gif.so.c @@ -0,0 +1,165 @@ +/* + american fuzzy lop++ - postprocessor library example + -------------------------------------------------- + + Originally written by Michal Zalewski + Edited by Dominik Maier, 2020 + + Copyright 2015 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Postprocessor libraries can be passed to afl-fuzz to perform final cleanup + of any mutated test cases - for example, to fix up checksums in PNG files. + + Please heed the following warnings: + + 1) In almost all cases, it is more productive to comment out checksum logic + in the targeted binary (as shown in ../libpng_no_checksum/). One possible + exception is the process of fuzzing binary-only software in QEMU mode. + + 2) The use of postprocessors for anything other than checksums is + questionable and may cause more harm than good. AFL is normally pretty good + about dealing with length fields, magic values, etc. + + 3) Postprocessors that do anything non-trivial must be extremely robust to + gracefully handle malformed data and other error conditions - otherwise, + they will crash and take afl-fuzz down with them. Be wary of reading past + *len and of integer overflows when calculating file offsets. + + In other words, THIS IS PROBABLY NOT WHAT YOU WANT - unless you really, + honestly know what you're doing =) + + With that out of the way: the postprocessor library is passed to afl-fuzz + via AFL_POST_LIBRARY. The library must be compiled with: + + gcc -shared -Wall -O3 post_library.so.c -o post_library.so + + AFL will call the afl_custom_post_process() function for every mutated output + buffer. From there, you have three choices: + + 1) If you don't want to modify the test case, simply set `*out_buf = in_buf` + and return the original `len`. + + 2) If you want to skip this test case altogether and have AFL generate a + new one, return 0 or set `*out_buf = NULL`. + Use this sparingly - it's faster than running the target program + with patently useless inputs, but still wastes CPU time. + + 3) If you want to modify the test case, allocate an appropriately-sized + buffer, move the data into that buffer, make the necessary changes, and + then return the new pointer as out_buf. Return an appropriate len + afterwards. + + Note that the buffer will *not* be freed for you. To avoid memory leaks, + you need to free it or reuse it on subsequent calls (as shown below). + + *** Feel free to reuse the original 'in_buf' BUFFER and return it. *** + + Aight. The example below shows a simple postprocessor that tries to make + sure that all input files start with "GIF89a". + + PS. If you don't like C, you can try out the unix-based wrapper from + Ben Nagy instead: https://github.com/bnagy/aflfix + + */ + +#include +#include +#include + +/* Header that must be present at the beginning of every test case: */ + +#define HEADER "GIF89a" + +typedef struct post_state { + + unsigned char *buf; + size_t size; + +} post_state_t; + +void *afl_custom_init(void *afl) { + + post_state_t *state = malloc(sizeof(post_state_t)); + if (!state) { + + perror("malloc"); + return NULL; + + } + + state->buf = calloc(sizeof(unsigned char), 4096); + if (!state->buf) { + + free(state); + perror("calloc"); + return NULL; + + } + + return state; + +} + +/* The actual postprocessor routine called by afl-fuzz: */ + +size_t afl_custom_post_process(post_state_t *data, unsigned char *in_buf, + unsigned int len, unsigned char **out_buf) { + + /* Skip execution altogether for buffers shorter than 6 bytes (just to + show how it's done). We can trust len to be sane. */ + + if (len < strlen(HEADER)) return 0; + + /* Do nothing for buffers that already start with the expected header. */ + + if (!memcmp(in_buf, HEADER, strlen(HEADER))) { + + *out_buf = in_buf; + return len; + + } + + /* Allocate memory for new buffer, reusing previous allocation if + possible. */ + + *out_buf = realloc(data->buf, len); + + /* If we're out of memory, the most graceful thing to do is to return the + original buffer and give up on modifying it. Let AFL handle OOM on its + own later on. */ + + if (!*out_buf) { + + *out_buf = in_buf; + return len; + + } + + /* Copy the original data to the new location. */ + + memcpy(*out_buf, in_buf, len); + + /* Insert the new header. */ + + memcpy(*out_buf, HEADER, strlen(HEADER)); + + /* Return the new len. It hasn't changed, so it's just len. */ + + return len; + +} + +/* Gets called afterwards */ +void afl_custom_deinit(post_state_t *data) { + + free(data->buf); + free(data); + +} + diff --git a/utils/custom_mutators/post_library_png.so.c b/utils/custom_mutators/post_library_png.so.c new file mode 100644 index 00000000..941f7e55 --- /dev/null +++ b/utils/custom_mutators/post_library_png.so.c @@ -0,0 +1,163 @@ +/* + american fuzzy lop++ - postprocessor for PNG + ------------------------------------------ + + Originally written by Michal Zalewski + + Copyright 2015 Google Inc. All rights reserved. + Adapted to the new API, 2020 by Dominik Maier + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + See post_library.so.c for a general discussion of how to implement + postprocessors. This specific postprocessor attempts to fix up PNG + checksums, providing a slightly more complicated example than found + in post_library.so.c. + + Compile with: + + gcc -shared -Wall -O3 post_library_png.so.c -o post_library_png.so -lz + + */ + +#include +#include +#include +#include +#include + +#include + +/* A macro to round an integer up to 4 kB. */ + +#define UP4K(_i) ((((_i) >> 12) + 1) << 12) + +typedef struct post_state { + + unsigned char *buf; + size_t size; + +} post_state_t; + +void *afl_custom_init(void *afl) { + + post_state_t *state = malloc(sizeof(post_state_t)); + if (!state) { + + perror("malloc"); + return NULL; + + } + + state->buf = calloc(sizeof(unsigned char), 4096); + if (!state->buf) { + + free(state); + perror("calloc"); + return NULL; + + } + + return state; + +} + +size_t afl_custom_post_process(post_state_t *data, const unsigned char *in_buf, + unsigned int len, + const unsigned char **out_buf) { + + unsigned char *new_buf = (unsigned char *)in_buf; + unsigned int pos = 8; + + /* Don't do anything if there's not enough room for the PNG header + (8 bytes). */ + + if (len < 8) { + + *out_buf = in_buf; + return len; + + } + + /* Minimum size of a zero-length PNG chunk is 12 bytes; if we + don't have that, we can bail out. */ + + while (pos + 12 <= len) { + + unsigned int chunk_len, real_cksum, file_cksum; + + /* Chunk length is the first big-endian dword in the chunk. */ + + chunk_len = ntohl(*(uint32_t *)(in_buf + pos)); + + /* Bail out if chunk size is too big or goes past EOF. */ + + if (chunk_len > 1024 * 1024 || pos + 12 + chunk_len > len) break; + + /* Chunk checksum is calculated for chunk ID (dword) and the actual + payload. */ + + real_cksum = htonl(crc32(0, in_buf + pos + 4, chunk_len + 4)); + + /* The in-file checksum is the last dword past the chunk data. */ + + file_cksum = *(uint32_t *)(in_buf + pos + 8 + chunk_len); + + /* If the checksums do not match, we need to fix the file. */ + + if (real_cksum != file_cksum) { + + /* First modification? Make a copy of the input buffer. Round size + up to 4 kB to minimize the number of reallocs needed. */ + + if (new_buf == in_buf) { + + if (len <= data->size) { + + new_buf = data->buf; + + } else { + + new_buf = realloc(data->buf, UP4K(len)); + if (!new_buf) { + + *out_buf = in_buf; + return len; + + } + + data->buf = new_buf; + data->size = UP4K(len); + memcpy(new_buf, in_buf, len); + + } + + } + + *(uint32_t *)(new_buf + pos + 8 + chunk_len) = real_cksum; + + } + + /* Skip the entire chunk and move to the next one. */ + + pos += 12 + chunk_len; + + } + + *out_buf = new_buf; + return len; + +} + +/* Gets called afterwards */ +void afl_custom_deinit(post_state_t *data) { + + free(data->buf); + free(data); + +} + diff --git a/utils/custom_mutators/simple-chunk-replace.py b/utils/custom_mutators/simple-chunk-replace.py new file mode 100644 index 00000000..df2f4ca7 --- /dev/null +++ b/utils/custom_mutators/simple-chunk-replace.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# encoding: utf-8 +''' +Simple Chunk Cross-Over Replacement Module for AFLFuzz + +@author: Christian Holler (:decoder) + +@license: + +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +@contact: choller@mozilla.com +''' + +import random + + +def init(seed): + ''' + Called once when AFLFuzz starts up. Used to seed our RNG. + + @type seed: int + @param seed: A 32-bit random value + ''' + # Seed our RNG + random.seed(seed) + + +def fuzz(buf, add_buf, max_size): + ''' + Called per fuzzing iteration. + + @type buf: bytearray + @param buf: The buffer that should be mutated. + + @type add_buf: bytearray + @param add_buf: A second buffer that can be used as mutation source. + + @type max_size: int + @param max_size: Maximum size of the mutated output. The mutation must not + produce data larger than max_size. + + @rtype: bytearray + @return: A new bytearray containing the mutated data + ''' + # Make a copy of our input buffer for returning + ret = bytearray(buf) + + # Take a random fragment length between 2 and 32 (or less if add_buf is shorter) + fragment_len = random.randint(1, min(len(add_buf), 32)) + + # Determine a random source index where to take the data chunk from + rand_src_idx = random.randint(0, len(add_buf) - fragment_len) + + # Determine a random destination index where to put the data chunk + rand_dst_idx = random.randint(0, len(buf)) + + # Make the chunk replacement + ret[rand_dst_idx:rand_dst_idx + fragment_len] = add_buf[rand_src_idx:rand_src_idx + fragment_len] + + # Return data + return ret diff --git a/utils/custom_mutators/simple_example.c b/utils/custom_mutators/simple_example.c new file mode 100644 index 00000000..d888ec1f --- /dev/null +++ b/utils/custom_mutators/simple_example.c @@ -0,0 +1,74 @@ +// This simple example just creates random buffer <= 100 filled with 'A' +// needs -I /path/to/AFLplusplus/include +#include "custom_mutator_helpers.h" + +#include +#include +#include +#include + +#ifndef _FIXED_CHAR + #define _FIXED_CHAR 0x41 +#endif + +typedef struct my_mutator { + + afl_t *afl; + + // Reused buffers: + BUF_VAR(u8, fuzz); + +} my_mutator_t; + +my_mutator_t *afl_custom_init(afl_t *afl, unsigned int seed) { + + srand(seed); + my_mutator_t *data = calloc(1, sizeof(my_mutator_t)); + if (!data) { + + perror("afl_custom_init alloc"); + return NULL; + + } + + data->afl = afl; + + return data; + +} + +size_t afl_custom_fuzz(my_mutator_t *data, uint8_t *buf, size_t buf_size, + u8 **out_buf, uint8_t *add_buf, + size_t add_buf_size, // add_buf can be NULL + size_t max_size) { + + int size = (rand() % 100) + 1; + if (size > max_size) size = max_size; + u8 *mutated_out = maybe_grow(BUF_PARAMS(data, fuzz), size); + if (!mutated_out) { + + *out_buf = NULL; + perror("custom mutator allocation (maybe_grow)"); + return 0; /* afl-fuzz will very likely error out after this. */ + + } + + memset(mutated_out, _FIXED_CHAR, size); + + *out_buf = mutated_out; + return size; + +} + +/** + * Deinitialize everything + * + * @param data The data ptr from afl_custom_init + */ +void afl_custom_deinit(my_mutator_t *data) { + + free(data->fuzz_buf); + free(data); + +} + diff --git a/utils/custom_mutators/wrapper_afl_min.py b/utils/custom_mutators/wrapper_afl_min.py new file mode 100644 index 00000000..ecb03b55 --- /dev/null +++ b/utils/custom_mutators/wrapper_afl_min.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python + +from XmlMutatorMin import XmlMutatorMin + +# Default settings (production mode) + +__mutator__ = None +__seed__ = "RANDOM" +__log__ = False +__log_file__ = "wrapper.log" + + +# AFL functions +def log(text): + """ + Logger + """ + + global __seed__ + global __log__ + global __log_file__ + + if __log__: + with open(__log_file__, "a") as logf: + logf.write("[%s] %s\n" % (__seed__, text)) + + +def init(seed): + """ + Called once when AFL starts up. Seed is used to identify the AFL instance in log files + """ + + global __mutator__ + global __seed__ + + # Get the seed + __seed__ = seed + + # Create a global mutation class + try: + __mutator__ = XmlMutatorMin(__seed__, verbose=__log__) + log("init(): Mutator created") + except RuntimeError as e: + log("init(): Can't create mutator: %s" % e.message) + + +def fuzz(buf, add_buf, max_size): + """ + Called for each fuzzing iteration. + """ + + global __mutator__ + + # Do we have a working mutator object? + if __mutator__ is None: + log("fuzz(): Can't fuzz, no mutator available") + return buf + + # Try to use the AFL buffer + via_buffer = True + + # Interpret the AFL buffer (an array of bytes) as a string + if via_buffer: + try: + buf_str = str(buf) + log("fuzz(): AFL buffer converted to a string") + except Exception: + via_buffer = False + log("fuzz(): Can't convert AFL buffer to a string") + + # Load XML from the AFL string + if via_buffer: + try: + __mutator__.init_from_string(buf_str) + log("fuzz(): Mutator successfully initialized with AFL buffer (%d bytes)" % len(buf_str)) + except Exception: + via_buffer = False + log("fuzz(): Can't initialize mutator with AFL buffer") + + # If init from AFL buffer wasn't succesful + if not via_buffer: + log("fuzz(): Returning unmodified AFL buffer") + return buf + + # Sucessful initialization -> mutate + try: + __mutator__.mutate(max=5) + log("fuzz(): Input mutated") + except Exception: + log("fuzz(): Can't mutate input => returning buf") + return buf + + # Convert mutated data to a array of bytes + try: + data = bytearray(__mutator__.save_to_string()) + log("fuzz(): Mutated data converted as bytes") + except Exception: + log("fuzz(): Can't convert mutated data to bytes => returning buf") + return buf + + # Everything went fine, returning mutated content + log("fuzz(): Returning %d bytes" % len(data)) + return data + + +# Main (for debug) +if __name__ == '__main__': + + __log__ = True + __log_file__ = "/dev/stdout" + __seed__ = "RANDOM" + + init(__seed__) + + in_1 = bytearray("ffffzzzzzzzzzzzz") + in_2 = bytearray("") + out = fuzz(in_1, in_2) + print(out) diff --git a/utils/defork/Makefile b/utils/defork/Makefile new file mode 100644 index 00000000..e8240dba --- /dev/null +++ b/utils/defork/Makefile @@ -0,0 +1,64 @@ +# +# american fuzzy lop++ - defork +# ---------------------------------- +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# + +.PHONY: all install clean + +PREFIX ?= /usr/local +BIN_PATH = $(PREFIX)/bin +HELPER_PATH = $(PREFIX)/lib/afl + +CFLAGS = -fPIC -Wall -Wextra +LDFLAGS = -shared + +UNAME_SAYS_LINUX=$(shell uname | grep -E '^Linux|^GNU' >/dev/null; echo $$?) +UNAME_SAYS_LINUX:sh=uname | grep -E '^Linux|^GNU' >/dev/null; echo $$? + +_LDFLAGS_ADD=$(UNAME_SAYS_LINUX:1=) +LDFLAGS_ADD=$(_LDFLAGS_ADD:0=-ldl) +LDFLAGS += $(LDFLAGS_ADD) + +# on gcc for arm there is no -m32, but -mbe32 +M32FLAG = -m32 +M64FLAG = -m64 + +CC_IS_GCC=$(shell $(CC) --version 2>/dev/null | grep -q gcc; echo $$?) +CC_IS_GCC:sh=$(CC) --version 2>/dev/null | grep -q gcc; echo $$? +CC_IS_ARMCOMPILER=$(shell $(CC) -v 2>&1 >/dev/null | grep -q arm; echo $$?) +CC_IS_ARMCOMPILER:sh=$(CC) -v 2>&1 >/dev/null | grep -q arm; echo $$? + +_M32FLAG=$(CC_IS_GCC)$(CC_IS_ARMCOMPILER) +__M32FLAG=$(_M32FLAG:00=-mbe32) +___M32FLAG=$(__M32FLAG:$(CC_IS_GCC)$(CC_IS_ARMCOMPILER)=-m32) +M32FLAG=$(___M32FLAG) +#ifeq "$(findstring clang, $(shell $(CC) --version 2>/dev/null))" "" +# ifneq (,$(findstring arm, "$(shell $(CC) -v 2>&1 >/dev/null)")) +# M32FLAG = -mbe32 +# endif +#endif + +all: defork32.so defork64.so + +defork32.so: defork.c + -@$(CC) $(M32FLAG) $(CFLAGS) $^ $(LDFLAGS) -o $@ 2>/dev/null || echo "defork32 build failure (that's fine)" + +defork64.so: defork.c + -@$(CC) $(M64FLAG) $(CFLAGS) $^ $(LDFLAGS) -o $@ 2>/dev/null || echo "defork64 build failure (that's fine)" + +install: defork32.so defork64.so + install -d -m 755 $(DESTDIR)$(HELPER_PATH)/ + if [ -f defork32.so ]; then set -e; install -m 755 defork32.so $(DESTDIR)$(HELPER_PATH)/; fi + if [ -f defork64.so ]; then set -e; install -m 755 defork64.so $(DESTDIR)$(HELPER_PATH)/; fi + +target: + ../../afl-clang forking_target.c -o forking_target -Wall -Wextra -Werror + +clean: + rm -f defork32.so defork64.so forking_target diff --git a/utils/defork/README.md b/utils/defork/README.md new file mode 100644 index 00000000..7e950323 --- /dev/null +++ b/utils/defork/README.md @@ -0,0 +1,11 @@ +# defork + +when the target forks, this breaks all normal fuzzing runs. +Sometimes, though, it is enough to just run the child process. +If this is the case, then this LD_PRELOAD library will always return 0 on fork, +the target will belive it is running as the child, post-fork. + +This is defork.c from the amazing preeny project +https://github.com/zardus/preeny + +It is altered for afl++ to work with its fork-server: the initial fork will go through, the second fork will be blocked. diff --git a/utils/defork/defork.c b/utils/defork/defork.c new file mode 100644 index 00000000..f71d1124 --- /dev/null +++ b/utils/defork/defork.c @@ -0,0 +1,50 @@ +#define __GNU_SOURCE +#include +#include +#include +#include + +#include "../../include/config.h" + +/* we want to fork once (for the afl++ forkserver), + then immediately return as child on subsequent forks. */ +static bool forked = 0; + +pid_t (*original_fork)(void); + +/* In case we are not running in afl, we use a dummy original_fork */ +static pid_t nop(void) { + + return 0; + +} + +__attribute__((constructor)) void preeny_fork_orig() { + + if (getenv(SHM_ENV_VAR)) { + + printf("defork: running in AFL++. Allowing forkserver.\n"); + original_fork = dlsym(RTLD_NEXT, "socket"); + + } else { + + printf("defork: no AFL++ detected. Disabling fork from the start.\n"); + original_fork = &nop; + + } + +} + +pid_t fork(void) { + + /* If we forked before, or if we're in the child (pid==0), + we don't want to fork anymore, else, we are still in the forkserver. + The forkserver parent needs to fork infinite times, each child should never + fork again. This can be written without branches and I hate myself for it. + */ + pid_t ret = !forked && original_fork(); + forked = !ret; + return ret; + +} + diff --git a/utils/defork/forking_target.c b/utils/defork/forking_target.c new file mode 100644 index 00000000..628d23c9 --- /dev/null +++ b/utils/defork/forking_target.c @@ -0,0 +1,49 @@ +#include +#include +#include +#include + +/* This is an example target for defork.c - fuzz using +``` +mkdir in; echo a > ./in/a +AFL_PRELOAD=./defork64.so ../../afl-fuzz -i in -o out -- ./forking_target @@ +``` +*/ + +int main(int argc, char **argv) { + + if (argc < 2) { + + printf("Example tool to test defork.\nUsage ./forking_target \n"); + return -1; + + } + + pid_t pid = fork(); + if (pid == 0) { + + printf("We're in the child.\n"); + FILE *f = fopen(argv[1], "r"); + char buf[4096]; + fread(buf, 1, 4096, f); + fclose(f); + uint32_t offset = buf[100] + (buf[101] << 8); + char test_val = buf[offset]; + return test_val < 100; + + } else if (pid < 0) { + + perror("fork"); + return -1; + + } else { + + printf("We are in the parent - defork didn't work! :( (pid=%d)\n", + (int)pid); + + } + + return 0; + +} + diff --git a/utils/distributed_fuzzing/sync_script.sh b/utils/distributed_fuzzing/sync_script.sh new file mode 100755 index 00000000..b28ff6cd --- /dev/null +++ b/utils/distributed_fuzzing/sync_script.sh @@ -0,0 +1,97 @@ +#!/bin/sh +# +# american fuzzy lop++ - fuzzer synchronization tool +# -------------------------------------------------- +# +# Originally written by Michal Zalewski +# +# Copyright 2014 Google Inc. All rights reserved. +# Copyright 2019-2020 AFLplusplus Project. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# To make this script work: +# +# - Edit FUZZ_HOSTS, FUZZ_DOMAIN, FUZZ_USER, and SYNC_DIR to reflect your +# environment. +# +# - Make sure that the system you are running this on can log into FUZZ_HOSTS +# without a password (authorized_keys or otherwise). +# +# - Make sure that every fuzzer is running with -o pointing to SYNC_DIR and -S +# that consists of its local host name, followed by an underscore, and then +# by some host-local fuzzer ID. +# + +# Hosts to synchronize the data across. +FUZZ_HOSTS='host1 host2 host3 host4' + +# Domain for all hosts +FUZZ_DOMAIN='example.com' + +# Remote user for SSH +FUZZ_USER=bob + +# Directory to synchronize +SYNC_DIR='/home/bob/sync_dir' + +# We only capture -M main nodes, set the name to your chosen naming scheme +MAIN_NAME='main' + +# Interval (seconds) between sync attempts (eg one hour) +SYNC_INTERVAL=$((60 * 60)) + +if [ "$AFL_ALLOW_TMP" = "" ]; then + + if [ "$PWD" = "/tmp" -o "$PWD" = "/var/tmp" ]; then + echo "[-] Error: do not use shared /tmp or /var/tmp directories with this script." 1>&2 + exit 1 + fi + +fi + +rm -rf .sync_tmp 2>/dev/null +mkdir .sync_tmp || exit 1 + +while :; do + + # Pull data in... + + for host in $FUZZ_HOSTS; do + + echo "[*] Retrieving data from ${host}.${FUZZ_DOMAIN}..." + + ssh -o 'passwordauthentication no' ${FUZZ_USER}@${host}.$FUZZ_DOMAIN \ + "cd '$SYNC_DIR' && tar -czf - ${host}_${MAIN_NAME}*/" > ".sync_tmp/${host}.tgz" + + done + + # Distribute data. For large fleets, see tips in the docs/ directory. + + for dst_host in $FUZZ_HOSTS; do + + echo "[*] Distributing data to ${dst_host}.${FUZZ_DOMAIN}..." + + for src_host in $FUZZ_HOSTS; do + + test "$src_host" = "$dst_host" && continue + + echo " Sending fuzzer data from ${src_host}.${FUZZ_DOMAIN}..." + + ssh -o 'passwordauthentication no' ${FUZZ_USER}@$dst_host \ + "cd '$SYNC_DIR' && tar -xkzf - " < ".sync_tmp/${src_host}.tgz" + + done + + done + + echo "[+] Done. Sleeping for $SYNC_INTERVAL seconds (Ctrl-C to quit)." + + sleep $SYNC_INTERVAL + +done + diff --git a/utils/libpng_no_checksum/libpng-nocrc.patch b/utils/libpng_no_checksum/libpng-nocrc.patch new file mode 100644 index 00000000..0a3793a0 --- /dev/null +++ b/utils/libpng_no_checksum/libpng-nocrc.patch @@ -0,0 +1,15 @@ +--- pngrutil.c.orig 2014-06-12 03:35:16.000000000 +0200 ++++ pngrutil.c 2014-07-01 05:08:31.000000000 +0200 +@@ -268,7 +268,11 @@ + if (need_crc != 0) + { + crc = png_get_uint_32(crc_bytes); +- return ((int)(crc != png_ptr->crc)); ++ ++ if (crc != png_ptr->crc) ++ fprintf(stderr, "NOTE: CRC in the file is 0x%08x, change to 0x%08x\n", crc, png_ptr->crc); ++ ++ return ((int)(1 != 1)); + } + + else diff --git a/utils/persistent_mode/Makefile b/utils/persistent_mode/Makefile new file mode 100644 index 00000000..6fa1c30e --- /dev/null +++ b/utils/persistent_mode/Makefile @@ -0,0 +1,10 @@ +all: + afl-clang-fast -o persistent_demo persistent_demo.c + afl-clang-fast -o persistent_demo_new persistent_demo_new.c + AFL_DONT_OPTIMIZE=1 afl-clang-fast -o test-instr test-instr.c + +document: + AFL_DONT_OPTIMIZE=1 afl-clang-fast -D_AFL_DOCUMENT_MUTATIONS -o test-instr test-instr.c + +clean: + rm -f persistent_demo persistent_demo_new test-instr diff --git a/utils/persistent_mode/persistent_demo.c b/utils/persistent_mode/persistent_demo.c new file mode 100644 index 00000000..4cedc32c --- /dev/null +++ b/utils/persistent_mode/persistent_demo.c @@ -0,0 +1,112 @@ +/* + american fuzzy lop++ - persistent mode example + -------------------------------------------- + + Originally written by Michal Zalewski + + Copyright 2015 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + This file demonstrates the high-performance "persistent mode" that may be + suitable for fuzzing certain fast and well-behaved libraries, provided that + they are stateless or that their internal state can be easily reset + across runs. + + To make this work, the library and this shim need to be compiled in LLVM + mode using afl-clang-fast (other compiler wrappers will *not* work). + + */ + +#include +#include +#include +#include +#include + +/* Main entry point. */ + +int main(int argc, char **argv) { + + ssize_t len; /* how much input did we read? */ + char buf[100]; /* Example-only buffer, you'd replace it with other global or + local variables appropriate for your use case. */ + + /* The number passed to __AFL_LOOP() controls the maximum number of + iterations before the loop exits and the program is allowed to + terminate normally. This limits the impact of accidental memory leaks + and similar hiccups. */ + + __AFL_INIT(); + while (__AFL_LOOP(1000)) { + + /*** PLACEHOLDER CODE ***/ + + /* STEP 1: Fully re-initialize all critical variables. In our example, this + involves zeroing buf[], our input buffer. */ + + memset(buf, 0, 100); + + /* STEP 2: Read input data. When reading from stdin, no special preparation + is required. When reading from a named file, you need to close + the old descriptor and reopen the file first! + + Beware of reading from buffered FILE* objects such as stdin. Use + raw file descriptors or call fopen() / fdopen() in every pass. */ + + len = read(0, buf, 100); + + /* STEP 3: This is where we'd call the tested library on the read data. + We just have some trivial inline code that faults on 'foo!'. */ + + /* do we have enough data? */ + if (len < 8) continue; + + if (buf[0] == 'f') { + + printf("one\n"); + if (buf[1] == 'o') { + + printf("two\n"); + if (buf[2] == 'o') { + + printf("three\n"); + if (buf[3] == '!') { + + printf("four\n"); + if (buf[4] == '!') { + + printf("five\n"); + if (buf[5] == '!') { + + printf("six\n"); + abort(); + + } + + } + + } + + } + + } + + } + + /*** END PLACEHOLDER CODE ***/ + + } + + /* Once the loop is exited, terminate normally - AFL will restart the process + when this happens, with a clean slate when it comes to allocated memory, + leftover file descriptors, etc. */ + + return 0; + +} + diff --git a/utils/persistent_mode/persistent_demo_new.c b/utils/persistent_mode/persistent_demo_new.c new file mode 100644 index 00000000..a29792ff --- /dev/null +++ b/utils/persistent_mode/persistent_demo_new.c @@ -0,0 +1,117 @@ +/* + american fuzzy lop++ - persistent mode example + -------------------------------------------- + + Originally written by Michal Zalewski + + Copyright 2015 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + This file demonstrates the high-performance "persistent mode" that may be + suitable for fuzzing certain fast and well-behaved libraries, provided that + they are stateless or that their internal state can be easily reset + across runs. + + To make this work, the library and this shim need to be compiled in LLVM + mode using afl-clang-fast (other compiler wrappers will *not* work). + + */ + +#include +#include +#include +#include +#include + +/* this lets the source compile without afl-clang-fast/lto */ +#ifndef __AFL_FUZZ_TESTCASE_LEN + +ssize_t fuzz_len; +unsigned char fuzz_buf[1024000]; + + #define __AFL_FUZZ_TESTCASE_LEN fuzz_len + #define __AFL_FUZZ_TESTCASE_BUF fuzz_buf + #define __AFL_FUZZ_INIT() void sync(void); + #define __AFL_LOOP(x) \ + ((fuzz_len = read(0, fuzz_buf, sizeof(fuzz_buf))) > 0 ? 1 : 0) + #define __AFL_INIT() sync() + +#endif + +__AFL_FUZZ_INIT(); + +/* Main entry point. */ + +int main(int argc, char **argv) { + + ssize_t len; /* how much input did we read? */ + unsigned char *buf; /* test case buffer pointer */ + + /* The number passed to __AFL_LOOP() controls the maximum number of + iterations before the loop exits and the program is allowed to + terminate normally. This limits the impact of accidental memory leaks + and similar hiccups. */ + + __AFL_INIT(); + buf = __AFL_FUZZ_TESTCASE_BUF; // this must be assigned before __AFL_LOOP! + + while (__AFL_LOOP(1000)) { // increase if you have good stability + + len = __AFL_FUZZ_TESTCASE_LEN; // do not use the macro directly in a call! + + fprintf(stderr, "input: %zd \"%s\"\n", len, buf); + + /* do we have enough data? */ + if (len < 8) continue; + + if (strcmp((char *)buf, "thisisateststring") == 0) printf("teststring\n"); + + if (buf[0] == 'f') { + + printf("one\n"); + if (buf[1] == 'o') { + + printf("two\n"); + if (buf[2] == 'o') { + + printf("three\n"); + if (buf[3] == '!') { + + printf("four\n"); + if (buf[4] == '!') { + + printf("five\n"); + if (buf[6] == '!') { + + printf("six\n"); + abort(); + + } + + } + + } + + } + + } + + } + + /*** END PLACEHOLDER CODE ***/ + + } + + /* Once the loop is exited, terminate normally - AFL will restart the process + when this happens, with a clean slate when it comes to allocated memory, + leftover file descriptors, etc. */ + + return 0; + +} + diff --git a/utils/persistent_mode/test-instr.c b/utils/persistent_mode/test-instr.c new file mode 100644 index 00000000..a6188b22 --- /dev/null +++ b/utils/persistent_mode/test-instr.c @@ -0,0 +1,69 @@ +/* + american fuzzy lop++ - a trivial program to test the build + -------------------------------------------------------- + Originally written by Michal Zalewski + Copyright 2014 Google Inc. All rights reserved. + Copyright 2019-2020 AFLplusplus Project. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + http://www.apache.org/licenses/LICENSE-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include + +__AFL_FUZZ_INIT(); + +int main(int argc, char **argv) { + + __AFL_INIT(); + unsigned char *buf = __AFL_FUZZ_TESTCASE_BUF; + + while (__AFL_LOOP(2147483647)) { // MAX_INT if you have 100% stability + + unsigned int len = __AFL_FUZZ_TESTCASE_LEN; + +#ifdef _AFL_DOCUMENT_MUTATIONS + static unsigned int counter = 0; + char fn[32]; + sprintf(fn, "%09u:test-instr", counter); + int fd_doc = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0600); + if (fd_doc >= 0) { + + if (write(fd_doc, buf, len) != __afl_fuzz_len) { + + fprintf(stderr, "write of mutation file failed: %s\n", fn); + unlink(fn); + + } + + close(fd_doc); + + } + + counter++; +#endif + + // fprintf(stderr, "len: %u\n", len); + + if (!len) continue; + + if (buf[0] == '0') + printf("Looks like a zero to me!\n"); + else if (buf[0] == '1') + printf("Pretty sure that is a one!\n"); + else + printf("Neither one or zero? How quaint!\n"); + + } + + return 0; + +} + diff --git a/utils/qemu_persistent_hook/Makefile b/utils/qemu_persistent_hook/Makefile new file mode 100644 index 00000000..85db1b46 --- /dev/null +++ b/utils/qemu_persistent_hook/Makefile @@ -0,0 +1,6 @@ +all: + $(CC) -no-pie test.c -o test + $(CC) -fPIC -shared read_into_rdi.c -o read_into_rdi.so + +clean: + rm -rf in out test read_into_rdi.so diff --git a/utils/qemu_persistent_hook/README.md b/utils/qemu_persistent_hook/README.md new file mode 100644 index 00000000..3f908c22 --- /dev/null +++ b/utils/qemu_persistent_hook/README.md @@ -0,0 +1,19 @@ +# QEMU persistent hook example + +Compile the test binary and the library: + +``` +make +``` + +Fuzz with: + +``` +export AFL_QEMU_PERSISTENT_ADDR=0x$(nm test | grep "T target_func" | awk '{print $1}') +export AFL_QEMU_PERSISTENT_HOOK=./read_into_rdi.so + +mkdir in +echo 0000 > in/in + +../../afl-fuzz -Q -i in -o out -- ./test +``` diff --git a/utils/qemu_persistent_hook/read_into_rdi.c b/utils/qemu_persistent_hook/read_into_rdi.c new file mode 100644 index 00000000..f4a8ae59 --- /dev/null +++ b/utils/qemu_persistent_hook/read_into_rdi.c @@ -0,0 +1,34 @@ +#include "../../qemu_mode/qemuafl/qemuafl/api.h" + +#include +#include + +void afl_persistent_hook(struct x86_64_regs *regs, uint64_t guest_base, + uint8_t *input_buf, uint32_t input_buf_len) { +\ +#define g2h(x) ((void *)((unsigned long)(x) + guest_base)) +#define h2g(x) ((uint64_t)(x)-guest_base) + + // In this example the register RDI is pointing to the memory location + // of the target buffer, and the length of the input is in RSI. + // This can be seen with a debugger, e.g. gdb (and "disass main") + + printf("Placing input into 0x%lx\n", regs->rdi); + + if (input_buf_len > 1024) input_buf_len = 1024; + memcpy(g2h(regs->rdi), input_buf, input_buf_len); + regs->rsi = input_buf_len; + +#undef g2h +#undef h2g + +} + +int afl_persistent_hook_init(void) { + + // 1 for shared memory input (faster), 0 for normal input (you have to use + // read(), input_buf will be NULL) + return 1; + +} + diff --git a/utils/qemu_persistent_hook/test.c b/utils/qemu_persistent_hook/test.c new file mode 100644 index 00000000..afeff202 --- /dev/null +++ b/utils/qemu_persistent_hook/test.c @@ -0,0 +1,35 @@ +#include + +int target_func(unsigned char *buf, int size) { + + printf("buffer:%p, size:%p\n", buf, size); + switch (buf[0]) { + + case 1: + if (buf[1] == '\x44') { puts("a"); } + break; + case 0xff: + if (buf[2] == '\xff') { + + if (buf[1] == '\x44') { puts("b"); } + + } + + break; + default: + break; + + } + + return 1; + +} + +char data[1024]; + +int main() { + + target_func(data, 1024); + +} + diff --git a/utils/socket_fuzzing/Makefile b/utils/socket_fuzzing/Makefile new file mode 100644 index 00000000..9476e2d5 --- /dev/null +++ b/utils/socket_fuzzing/Makefile @@ -0,0 +1,61 @@ +# +# american fuzzy lop++ - socket_fuzz +# ---------------------------------- +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# + +.PHONY: all install clean + +PREFIX ?= /usr/local +BIN_PATH = $(PREFIX)/bin +HELPER_PATH = $(PREFIX)/lib/afl + +CFLAGS = -fPIC -Wall -Wextra +LDFLAGS = -shared + +UNAME_SAYS_LINUX=$(shell uname | grep -E '^Linux|^GNU' >/dev/null; echo $$?) +UNAME_SAYS_LINUX:sh=uname | grep -E '^Linux|^GNU' >/dev/null; echo $$? + +_LDFLAGS_ADD=$(UNAME_SAYS_LINUX:1=) +LDFLAGS_ADD=$(_LDFLAGS_ADD:0=-ldl) +LDFLAGS += $(LDFLAGS_ADD) + +# on gcc for arm there is no -m32, but -mbe32 +M32FLAG = -m32 +M64FLAG = -m64 + +CC_IS_GCC=$(shell $(CC) --version 2>/dev/null | grep -q gcc; echo $$?) +CC_IS_GCC:sh=$(CC) --version 2>/dev/null | grep -q gcc; echo $$? +CC_IS_ARMCOMPILER=$(shell $(CC) -v 2>&1 >/dev/null | grep -q arm; echo $$?) +CC_IS_ARMCOMPILER:sh=$(CC) -v 2>&1 >/dev/null | grep -q arm; echo $$? + +_M32FLAG=$(CC_IS_GCC)$(CC_IS_ARMCOMPILER) +__M32FLAG=$(_M32FLAG:00=-mbe32) +___M32FLAG=$(__M32FLAG:$(CC_IS_GCC)$(CC_IS_ARMCOMPILER)=-m32) +M32FLAG=$(___M32FLAG) +#ifeq "$(findstring clang, $(shell $(CC) --version 2>/dev/null))" "" +# ifneq (,$(findstring arm, "$(shell $(CC) -v 2>&1 >/dev/null)")) +# M32FLAG = -mbe32 +# endif +#endif + +all: socketfuzz32.so socketfuzz64.so + +socketfuzz32.so: socketfuzz.c + -@$(CC) $(M32FLAG) $(CFLAGS) $^ $(LDFLAGS) -o $@ 2>/dev/null || echo "socketfuzz32 build failure (that's fine)" + +socketfuzz64.so: socketfuzz.c + -@$(CC) $(M64FLAG) $(CFLAGS) $^ $(LDFLAGS) -o $@ 2>/dev/null || echo "socketfuzz64 build failure (that's fine)" + +install: socketfuzz32.so socketfuzz64.so + install -d -m 755 $(DESTDIR)$(HELPER_PATH)/ + if [ -f socketfuzz32.so ]; then set -e; install -m 755 socketfuzz32.so $(DESTDIR)$(HELPER_PATH)/; fi + if [ -f socketfuzz64.so ]; then set -e; install -m 755 socketfuzz64.so $(DESTDIR)$(HELPER_PATH)/; fi + +clean: + rm -f socketfuzz32.so socketfuzz64.so diff --git a/utils/socket_fuzzing/README.md b/utils/socket_fuzzing/README.md new file mode 100644 index 00000000..79f28bea --- /dev/null +++ b/utils/socket_fuzzing/README.md @@ -0,0 +1,11 @@ +# socketfuzz + +when you want to fuzz a network service and you can not/do not want to modify +the source (or just have a binary), then this LD_PRELOAD library will allow +for sending input to stdin which the target binary will think is coming from +a network socket. + +This is desock_dup.c from the amazing preeny project +https://github.com/zardus/preeny + +It is packaged in afl++ to have it at hand if needed diff --git a/utils/socket_fuzzing/socketfuzz.c b/utils/socket_fuzzing/socketfuzz.c new file mode 100644 index 00000000..3ec8383b --- /dev/null +++ b/utils/socket_fuzzing/socketfuzz.c @@ -0,0 +1,110 @@ +/* + * This is desock_dup.c from the amazing preeny project + * https://github.com/zardus/preeny + * + * It is packaged in afl++ to have it at hand if needed + * + */ + +#define _GNU_SOURCE + +#include +#include +#include +#include +#include // +#include // +#include // +#include // +#include +#include +#include +#include +#include +#include +#include +//#include "logging.h" // switche from preeny_info() to fprintf(stderr, "Info: " + +// +// originals +// +int (*original_close)(int); +int (*original_dup2)(int, int); +__attribute__((constructor)) void preeny_desock_dup_orig() { + + original_close = dlsym(RTLD_NEXT, "close"); + original_dup2 = dlsym(RTLD_NEXT, "dup2"); + +} + +int close(int sockfd) { + + if (sockfd <= 2) { + + fprintf(stderr, "Info: Disabling close on %d\n", sockfd); + return 0; + + } else { + + return original_close(sockfd); + + } + +} + +int dup2(int old, int new) { + + if (new <= 2) { + + fprintf(stderr, "Info: Disabling dup from %d to %d\n", old, new); + return 0; + + } else { + + return original_dup2(old, new); + + } + +} + +int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) { + + (void)sockfd; + (void)addr; + (void)addrlen; + fprintf(stderr, "Info: Emulating accept on %d\n", sockfd); + return 0; + +} + +int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen) { + + (void)sockfd; + (void)addr; + (void)addrlen; + fprintf(stderr, "Info: Emulating bind on port %d\n", + ntohs(((struct sockaddr_in *)addr)->sin_port)); + return 0; + +} + +int listen(int sockfd, int backlog) { + + (void)sockfd; + (void)backlog; + return 0; + +} + +int setsockopt(int sockfd, int level, int optid, const void *optdata, + socklen_t optdatalen) { + + (void)sockfd; + (void)level; + (void)optid; + (void)optdata; + (void)optdatalen; + return 0; + +} + -- cgit 1.4.1 From e707a8d7388cde38354162e783a2a71fe57fddf0 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Tue, 8 Dec 2020 10:15:09 +0100 Subject: fix warning --- utils/aflpp_driver/aflpp_qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils') diff --git a/utils/aflpp_driver/aflpp_qemu_driver.c b/utils/aflpp_driver/aflpp_qemu_driver.c index 4f3e5f71..cb3b86d0 100644 --- a/utils/aflpp_driver/aflpp_qemu_driver.c +++ b/utils/aflpp_driver/aflpp_qemu_driver.c @@ -6,7 +6,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); __attribute__((weak)) int LLVMFuzzerInitialize(int *argc, char ***argv); -static const size_t kMaxAflInputSize = 1 * 1024 * 1024; +#define kMaxAflInputSize (1 * 1024 * 1024); static uint8_t AflInputBuf[kMaxAflInputSize]; void __attribute__((noinline)) afl_qemu_driver_stdin_input(void) { -- cgit 1.4.1 From 46156957bd120dc8d8bcd9da72f83574902c654f Mon Sep 17 00:00:00 2001 From: van Hauser Date: Tue, 8 Dec 2020 11:07:11 +0100 Subject: fix aflfast changes --- include/afl-fuzz.h | 2 +- src/afl-fuzz-one.c | 11 +++-- src/afl-fuzz-queue.c | 73 ++++++++++++++++++++++++---------- utils/aflpp_driver/aflpp_qemu_driver.c | 2 +- 4 files changed, 61 insertions(+), 27 deletions(-) (limited to 'utils') diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h index 6ce032df..2f2d31d3 100644 --- a/include/afl-fuzz.h +++ b/include/afl-fuzz.h @@ -169,7 +169,7 @@ struct queue_entry { u32 tc_ref; /* Trace bytes ref count */ double perf_score, /* performance score */ - weight; + weight; u8 *testcase_buf; /* The testcase buffer, if loaded. */ diff --git a/src/afl-fuzz-one.c b/src/afl-fuzz-one.c index a48afffb..e6fa6064 100644 --- a/src/afl-fuzz-one.c +++ b/src/afl-fuzz-one.c @@ -445,10 +445,13 @@ u8 fuzz_one_original(afl_state_t *afl) { if (unlikely(afl->not_on_tty)) { - ACTF("Fuzzing test case #%u (%u total, %llu uniq crashes found, perf_score=%0.0f, exec_us=%llu, hits=%u, map=%u)...", - afl->current_entry, afl->queued_paths, afl->unique_crashes, - afl->queue_cur->perf_score, afl->queue_cur->exec_us, - afl->n_fuzz[afl->queue_cur->n_fuzz_entry], afl->queue_cur->bitmap_size); + ACTF( + "Fuzzing test case #%u (%u total, %llu uniq crashes found, " + "perf_score=%0.0f, exec_us=%llu, hits=%u, map=%u)...", + afl->current_entry, afl->queued_paths, afl->unique_crashes, + afl->queue_cur->perf_score, afl->queue_cur->exec_us, + likely(afl->n_fuzz) ? afl->n_fuzz[afl->queue_cur->n_fuzz_entry] : 0, + afl->queue_cur->bitmap_size); fflush(stdout); } diff --git a/src/afl-fuzz-queue.c b/src/afl-fuzz-queue.c index 1e997c55..071e4a4c 100644 --- a/src/afl-fuzz-queue.c +++ b/src/afl-fuzz-queue.c @@ -42,7 +42,8 @@ inline u32 select_next_queue_entry(afl_state_t *afl) { } -double compute_weight(afl_state_t *afl, struct queue_entry *q, double avg_exec_us, double avg_bitmap_size) { +double compute_weight(afl_state_t *afl, struct queue_entry *q, + double avg_exec_us, double avg_bitmap_size) { u32 hits = afl->n_fuzz[q->n_fuzz_entry]; if (hits == 0) hits = 1; @@ -55,13 +56,15 @@ double compute_weight(afl_state_t *afl, struct queue_entry *q, double avg_exec_u if (q->favored) weight *= 5; return weight; + } /* create the alias table that allows weighted random selection - expensive */ void create_alias_table(afl_state_t *afl) { - u32 n = afl->queued_paths, i = 0, a, g; + u32 n = afl->queued_paths, i = 0, a, g; + double sum = 0; afl->alias_table = (u32 *)afl_realloc((void **)&afl->alias_table, n * sizeof(u32)); @@ -80,34 +83,62 @@ void create_alias_table(afl_state_t *afl) { memset((void *)afl->alias_table, 0, n * sizeof(u32)); memset((void *)afl->alias_probability, 0, n * sizeof(double)); - double avg_exec_us = 0.0; - double avg_bitmap_size = 0.0; - for (i = 0; i < n; i++) { + if (likely(afl->schedule >= FAST && afl->schedule <= RARE)) { - struct queue_entry *q = afl->queue_buf[i]; - avg_exec_us += q->exec_us; - avg_bitmap_size += log(q->bitmap_size); + double avg_exec_us = 0.0; + double avg_bitmap_size = 0.0; + for (i = 0; i < n; i++) { - } - avg_exec_us /= afl->queued_paths; - avg_bitmap_size /= afl->queued_paths; + struct queue_entry *q = afl->queue_buf[i]; + avg_exec_us += q->exec_us; + avg_bitmap_size += log(q->bitmap_size); - double sum = 0; - for (i = 0; i < n; i++) { + } + + avg_exec_us /= afl->queued_paths; + avg_bitmap_size /= afl->queued_paths; + + for (i = 0; i < n; i++) { - struct queue_entry *q = afl->queue_buf[i]; + struct queue_entry *q = afl->queue_buf[i]; + + if (!q->disabled) { + + q->weight = compute_weight(afl, q, avg_exec_us, avg_bitmap_size); + q->perf_score = calculate_score(afl, q); + + } + + sum += q->weight; - if (!q->disabled) { - q->weight = compute_weight(afl, q, avg_exec_us, avg_bitmap_size); - q->perf_score = calculate_score(afl, q); } - sum += q->weight; + for (i = 0; i < n; i++) { - } + P[i] = (afl->queue_buf[i]->weight * n) / sum; + + } + + } else { + + for (i = 0; i < n; i++) { + + struct queue_entry *q = afl->queue_buf[i]; + + if (!q->disabled) { q->perf_score = calculate_score(afl, q); } + + sum += q->perf_score; - for (i = 0; i < n; i++) - P[i] = (afl->queue_buf[i]->weight * n) / sum; + } + + for (i = 0; i < n; i++) { + + struct queue_entry *q = afl->queue_buf[i]; + P[i] = (q->perf_score * n) / sum; + + } + + } int nS = 0, nL = 0, s; for (s = (s32)n - 1; s >= 0; --s) { diff --git a/utils/aflpp_driver/aflpp_qemu_driver.c b/utils/aflpp_driver/aflpp_qemu_driver.c index cb3b86d0..a0c02833 100644 --- a/utils/aflpp_driver/aflpp_qemu_driver.c +++ b/utils/aflpp_driver/aflpp_qemu_driver.c @@ -7,7 +7,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); __attribute__((weak)) int LLVMFuzzerInitialize(int *argc, char ***argv); #define kMaxAflInputSize (1 * 1024 * 1024); -static uint8_t AflInputBuf[kMaxAflInputSize]; +static uint8_t AflInputBuf[kMaxAflInputSize]; void __attribute__((noinline)) afl_qemu_driver_stdin_input(void) { -- cgit 1.4.1 From da6cddab904e363775f157ceafa932f3cdaf6121 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Tue, 8 Dec 2020 11:30:05 +0100 Subject: fix asserts --- src/afl-fuzz-bitmap.c | 7 ++++--- utils/aflpp_driver/aflpp_qemu_driver.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'utils') diff --git a/src/afl-fuzz-bitmap.c b/src/afl-fuzz-bitmap.c index f920efa4..f1ca7400 100644 --- a/src/afl-fuzz-bitmap.c +++ b/src/afl-fuzz-bitmap.c @@ -457,8 +457,8 @@ u8 *describe_op(afl_state_t *afl, u8 new_bits, size_t max_description_len) { ret[len_current++] = ','; ret[len_current] = '\0'; - size_t size_left = real_max_len - len_current - strlen(",+cov") - 2; - assert(size_left > 0); + ssize_t size_left = real_max_len - len_current - strlen(",+cov") - 2; + if (unlikely(size_left <= 0)) FATAL("filename got too long"); const char *custom_description = afl->current_custom_fuzz->afl_custom_describe( @@ -505,7 +505,8 @@ u8 *describe_op(afl_state_t *afl, u8 new_bits, size_t max_description_len) { if (new_bits == 2) { strcat(ret, ",+cov"); } - assert(strlen(ret) <= max_description_len); + if (unlikely(strlen(ret) >= max_description_len)) + FATAL("describe string is too long"); return ret; diff --git a/utils/aflpp_driver/aflpp_qemu_driver.c b/utils/aflpp_driver/aflpp_qemu_driver.c index a0c02833..79de5af6 100644 --- a/utils/aflpp_driver/aflpp_qemu_driver.c +++ b/utils/aflpp_driver/aflpp_qemu_driver.c @@ -6,7 +6,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); __attribute__((weak)) int LLVMFuzzerInitialize(int *argc, char ***argv); -#define kMaxAflInputSize (1 * 1024 * 1024); +#define kMaxAflInputSize (1 * 1024 * 1024) static uint8_t AflInputBuf[kMaxAflInputSize]; void __attribute__((noinline)) afl_qemu_driver_stdin_input(void) { -- cgit 1.4.1 From 6e61b2345cc35f101bac7594089dc57999f33b89 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Tue, 8 Dec 2020 20:33:41 +0100 Subject: more reporting on errors --- instrumentation/afl-compiler-rt.o.c | 25 +++++++++++++++++++++++-- src/afl-forkserver.c | 7 +++++++ utils/persistent_mode/persistent_demo_new.c | 2 +- 3 files changed, 31 insertions(+), 3 deletions(-) (limited to 'utils') diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c index b07aeb83..e29c4483 100644 --- a/instrumentation/afl-compiler-rt.o.c +++ b/instrumentation/afl-compiler-rt.o.c @@ -163,6 +163,12 @@ static void __afl_map_shm_fuzz() { char *id_str = getenv(SHM_FUZZ_ENV_VAR); + if (getenv("AFL_DEBUG")) { + + fprintf(stderr, "DEBUG: fuzzcase shmem %s\n", id_str ? id_str : "none"); + + } + if (id_str) { u8 *map = NULL; @@ -196,6 +202,7 @@ static void __afl_map_shm_fuzz() { if (!map || map == (void *)-1) { perror("Could not access fuzzing shared memory"); + send_forkserver_error(FS_ERROR_SHM_OPEN); exit(1); } @@ -212,6 +219,7 @@ static void __afl_map_shm_fuzz() { } else { fprintf(stderr, "Error: variable for fuzzing shared memory is not set\n"); + send_forkserver_error(FS_ERROR_SHM_OPEN); exit(1); } @@ -335,6 +343,8 @@ static void __afl_map_shm(void) { send_forkserver_error(FS_ERROR_MAP_ADDR); else send_forkserver_error(FS_ERROR_MMAP); + perror("shmat for map"); + exit(2); } @@ -349,12 +359,14 @@ static void __afl_map_shm(void) { /* Whooooops. */ - if (__afl_area_ptr == (void *)-1) { + if (!__afl_area_ptr || __afl_area_ptr == (void *)-1) { if (__afl_map_addr) send_forkserver_error(FS_ERROR_MAP_ADDR); else send_forkserver_error(FS_ERROR_SHMAT); + + perror("shmat for map"); _exit(1); } @@ -376,6 +388,7 @@ static void __afl_map_shm(void) { fprintf(stderr, "can not acquire mmap for address %p\n", (void *)__afl_map_addr); + send_forkserver_error(FS_ERROR_SHM_OPEN); exit(1); } @@ -411,6 +424,7 @@ static void __afl_map_shm(void) { if (shm_fd == -1) { fprintf(stderr, "shm_open() failed\n"); + send_forkserver_error(FS_ERROR_SHM_OPEN); exit(1); } @@ -424,6 +438,7 @@ static void __afl_map_shm(void) { shm_fd = -1; fprintf(stderr, "mmap() failed\n"); + send_forkserver_error(FS_ERROR_SHM_OPEN); exit(2); } @@ -435,7 +450,13 @@ static void __afl_map_shm(void) { __afl_cmp_map = shmat(shm_id, NULL, 0); #endif - if (__afl_cmp_map == (void *)-1) _exit(1); + if (!__afl_cmp_map || __afl_cmp_map == (void *)-1) { + + perror("shmat for cmplog"); + send_forkserver_error(FS_ERROR_SHM_OPEN); + _exit(1); + + } } diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c index 20117c1d..b1c29ba6 100644 --- a/src/afl-forkserver.c +++ b/src/afl-forkserver.c @@ -1069,6 +1069,13 @@ fsrv_run_result_t afl_fsrv_run_target(afl_forkserver_t *fsrv, u32 timeout, if (fsrv->child_pid <= 0) { if (*stop_soon_p) { return 0; } + + if ((fsrv->child_pid & FS_OPT_ERROR) && + FS_OPT_GET_ERROR(fsrv->child_pid) == FS_ERROR_SHM_OPEN) + FATAL( + "Target reported shared memory access failed (perhaps increase " + "shared memory available)."); + FATAL("Fork server is misbehaving (OOM?)"); } diff --git a/utils/persistent_mode/persistent_demo_new.c b/utils/persistent_mode/persistent_demo_new.c index a29792ff..0d24a51e 100644 --- a/utils/persistent_mode/persistent_demo_new.c +++ b/utils/persistent_mode/persistent_demo_new.c @@ -86,7 +86,7 @@ int main(int argc, char **argv) { if (buf[4] == '!') { printf("five\n"); - if (buf[6] == '!') { + if (buf[5] == '!') { printf("six\n"); abort(); -- cgit 1.4.1 From 39a4fac941177387578ec856aacea2187588fc13 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Wed, 9 Dec 2020 11:07:14 +0100 Subject: better examples --- instrumentation/afl-compiler-rt.o.c | 8 ++++---- src/afl-sharedmem.c | 8 ++++---- utils/persistent_mode/persistent_demo.c | 8 +++++++- utils/persistent_mode/persistent_demo_new.c | 8 +++++++- utils/persistent_mode/test-instr.c | 8 +++++++- 5 files changed, 29 insertions(+), 11 deletions(-) (limited to 'utils') diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c index c29861e6..99dcbb67 100644 --- a/instrumentation/afl-compiler-rt.o.c +++ b/instrumentation/afl-compiler-rt.o.c @@ -174,8 +174,8 @@ static void __afl_map_shm_fuzz() { u8 *map = NULL; #ifdef USEMMAP - const char * shm_file_path = id_str; - int shm_fd = -1; + const char *shm_file_path = id_str; + int shm_fd = -1; /* create the shared memory segment as if it was a file */ shm_fd = shm_open(shm_file_path, O_RDWR, 0600); @@ -414,8 +414,8 @@ static void __afl_map_shm(void) { if (id_str) { #ifdef USEMMAP - const char * shm_file_path = id_str; - int shm_fd = -1; + const char * shm_file_path = id_str; + int shm_fd = -1; struct cmp_map *shm_base = NULL; /* create the shared memory segment as if it was a file */ diff --git a/src/afl-sharedmem.c b/src/afl-sharedmem.c index cef908e0..3e671df5 100644 --- a/src/afl-sharedmem.c +++ b/src/afl-sharedmem.c @@ -252,10 +252,10 @@ u8 *afl_shm_init(sharedmem_t *shm, size_t map_size, shm_str = alloc_printf("%d", shm->shm_id); - /* If somebody is asking us to fuzz instrumented binaries in non-instrumented - mode, we don't want them to detect instrumentation, since we won't be - sending fork server commands. This should be replaced with better - auto-detection later on, perhaps? */ + /* If somebody is asking us to fuzz instrumented binaries in + non-instrumented mode, we don't want them to detect instrumentation, + since we won't be sending fork server commands. This should be replaced + with better auto-detection later on, perhaps? */ setenv(SHM_ENV_VAR, shm_str, 1); diff --git a/utils/persistent_mode/persistent_demo.c b/utils/persistent_mode/persistent_demo.c index 4cedc32c..f5e43728 100644 --- a/utils/persistent_mode/persistent_demo.c +++ b/utils/persistent_mode/persistent_demo.c @@ -27,9 +27,15 @@ #include #include #include +#include /* Main entry point. */ +/* To ensure checks are not optimized out it is recommended to disable + code optimization for the fuzzer harness main() */ +#pragma clang optimize off +#pragma GCC optimize("O0") + int main(int argc, char **argv) { ssize_t len; /* how much input did we read? */ @@ -42,7 +48,7 @@ int main(int argc, char **argv) { and similar hiccups. */ __AFL_INIT(); - while (__AFL_LOOP(1000)) { + while (__AFL_LOOP(UINT_MAX)) { /*** PLACEHOLDER CODE ***/ diff --git a/utils/persistent_mode/persistent_demo_new.c b/utils/persistent_mode/persistent_demo_new.c index 0d24a51e..7e694696 100644 --- a/utils/persistent_mode/persistent_demo_new.c +++ b/utils/persistent_mode/persistent_demo_new.c @@ -27,6 +27,7 @@ #include #include #include +#include /* this lets the source compile without afl-clang-fast/lto */ #ifndef __AFL_FUZZ_TESTCASE_LEN @@ -47,6 +48,11 @@ __AFL_FUZZ_INIT(); /* Main entry point. */ +/* To ensure checks are not optimized out it is recommended to disable + code optimization for the fuzzer harness main() */ +#pragma clang optimize off +#pragma GCC optimize("O0") + int main(int argc, char **argv) { ssize_t len; /* how much input did we read? */ @@ -60,7 +66,7 @@ int main(int argc, char **argv) { __AFL_INIT(); buf = __AFL_FUZZ_TESTCASE_BUF; // this must be assigned before __AFL_LOOP! - while (__AFL_LOOP(1000)) { // increase if you have good stability + while (__AFL_LOOP(UINT_MAX)) { // increase if you have good stability len = __AFL_FUZZ_TESTCASE_LEN; // do not use the macro directly in a call! diff --git a/utils/persistent_mode/test-instr.c b/utils/persistent_mode/test-instr.c index a6188b22..6da511de 100644 --- a/utils/persistent_mode/test-instr.c +++ b/utils/persistent_mode/test-instr.c @@ -17,15 +17,21 @@ #include #include #include +#include __AFL_FUZZ_INIT(); +/* To ensure checks are not optimized out it is recommended to disable + code optimization for the fuzzer harness main() */ +#pragma clang optimize off +#pragma GCC optimize("O0") + int main(int argc, char **argv) { __AFL_INIT(); unsigned char *buf = __AFL_FUZZ_TESTCASE_BUF; - while (__AFL_LOOP(2147483647)) { // MAX_INT if you have 100% stability + while (__AFL_LOOP(UINT_MAX)) { // if you have 100% stability unsigned int len = __AFL_FUZZ_TESTCASE_LEN; -- cgit 1.4.1 From a8e568f248628c39e0bc34173470988034723627 Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Wed, 9 Dec 2020 11:30:04 +0100 Subject: move libdislocator, libtokencap and qbdi_mode to utils/ --- GNUmakefile | 18 +- README.md | 3 +- docs/Changelog.md | 1 + docs/life_pro_tips.md | 2 +- docs/notes_for_asan.md | 2 +- libdislocator/Makefile | 43 -- libdislocator/README.md | 68 --- libdislocator/libdislocator.so.c | 544 ---------------------- libtokencap/Makefile | 94 ---- libtokencap/README.md | 64 --- libtokencap/libtokencap.so.c | 794 --------------------------------- qbdi_mode/README.md | 199 --------- qbdi_mode/assets/screen1.png | Bin 88333 -> 0 bytes qbdi_mode/build.sh | 57 --- qbdi_mode/demo-so.c | 41 -- qbdi_mode/template.cpp | 251 ----------- utils/libdislocator/Makefile | 43 ++ utils/libdislocator/README.md | 68 +++ utils/libdislocator/libdislocator.so.c | 544 ++++++++++++++++++++++ utils/libtokencap/Makefile | 94 ++++ utils/libtokencap/README.md | 64 +++ utils/libtokencap/libtokencap.so.c | 794 +++++++++++++++++++++++++++++++++ utils/qbdi_mode/README.md | 199 +++++++++ utils/qbdi_mode/assets/screen1.png | Bin 0 -> 88333 bytes utils/qbdi_mode/build.sh | 57 +++ utils/qbdi_mode/demo-so.c | 41 ++ utils/qbdi_mode/template.cpp | 251 +++++++++++ 27 files changed, 2168 insertions(+), 2168 deletions(-) delete mode 100644 libdislocator/Makefile delete mode 100644 libdislocator/README.md delete mode 100644 libdislocator/libdislocator.so.c delete mode 100644 libtokencap/Makefile delete mode 100644 libtokencap/README.md delete mode 100644 libtokencap/libtokencap.so.c delete mode 100755 qbdi_mode/README.md delete mode 100644 qbdi_mode/assets/screen1.png delete mode 100755 qbdi_mode/build.sh delete mode 100755 qbdi_mode/demo-so.c delete mode 100755 qbdi_mode/template.cpp create mode 100644 utils/libdislocator/Makefile create mode 100644 utils/libdislocator/README.md create mode 100644 utils/libdislocator/libdislocator.so.c create mode 100644 utils/libtokencap/Makefile create mode 100644 utils/libtokencap/README.md create mode 100644 utils/libtokencap/libtokencap.so.c create mode 100755 utils/qbdi_mode/README.md create mode 100644 utils/qbdi_mode/assets/screen1.png create mode 100755 utils/qbdi_mode/build.sh create mode 100755 utils/qbdi_mode/demo-so.c create mode 100755 utils/qbdi_mode/template.cpp (limited to 'utils') diff --git a/GNUmakefile b/GNUmakefile index 309a7d4c..de398ed7 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -493,8 +493,6 @@ endif code-format: ./.custom-format.py -i src/*.c ./.custom-format.py -i include/*.h - ./.custom-format.py -i libdislocator/*.c - ./.custom-format.py -i libtokencap/*.c ./.custom-format.py -i instrumentation/*.h ./.custom-format.py -i instrumentation/*.cc ./.custom-format.py -i instrumentation/*.c @@ -545,8 +543,8 @@ clean: rm -f $(PROGS) libradamsa.so afl-fuzz-document afl-as as afl-g++ afl-clang afl-clang++ *.o src/*.o *~ a.out core core.[1-9][0-9]* *.stackdump .test .test1 .test2 test-instr .test-instr0 .test-instr1 afl-qemu-trace afl-gcc-fast afl-gcc-pass.so afl-g++-fast ld *.so *.8 test/unittests/*.o test/unittests/unit_maybe_alloc test/unittests/preallocable .afl-* afl-gcc afl-g++ afl-clang afl-clang++ test/unittests/unit_hash test/unittests/unit_rand -$(MAKE) -f GNUmakefile.llvm clean -$(MAKE) -f GNUmakefile.gcc_plugin clean - $(MAKE) -C libdislocator clean - $(MAKE) -C libtokencap clean + $(MAKE) -C utils/libdislocator clean + $(MAKE) -C utils/libtokencap clean $(MAKE) -C utils/afl_network_proxy clean $(MAKE) -C utils/socket_fuzzing clean $(MAKE) -C utils/argv_fuzzing clean @@ -570,8 +568,8 @@ deepclean: clean distrib: all -$(MAKE) -f GNUmakefile.llvm -$(MAKE) -f GNUmakefile.gcc_plugin - $(MAKE) -C libdislocator - $(MAKE) -C libtokencap + $(MAKE) -C utils/libdislocator + $(MAKE) -C utils/libtokencap $(MAKE) -C utils/aflpp_driver $(MAKE) -C utils/afl_network_proxy $(MAKE) -C utils/socket_fuzzing @@ -581,8 +579,8 @@ distrib: all .PHONY: binary-only binary-only: all - $(MAKE) -C libdislocator - $(MAKE) -C libtokencap + $(MAKE) -C utils/libdislocator + $(MAKE) -C utils/libtokencap $(MAKE) -C utils/afl_network_proxy $(MAKE) -C utils/socket_fuzzing $(MAKE) -C utils/argv_fuzzing @@ -593,8 +591,8 @@ binary-only: all source-only: all -$(MAKE) -f GNUmakefile.llvm -$(MAKE) -f GNUmakefile.gcc_plugin - $(MAKE) -C libdislocator - $(MAKE) -C libtokencap + $(MAKE) -C utils/libdislocator + $(MAKE) -C utils/libtokencap $(MAKE) -C utils/aflpp_driver %.8: % diff --git a/README.md b/README.md index 94d5008e..16c85e26 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ behaviours and defaults: editing config.h for TESTCASE_CACHE or by specifying the env variable `AFL_TESTCACHE_SIZE` (in MB). Good values are between 50-500 (default: 50). * examples/ got renamed to utils/ + * libtokencap/ libdislocator/ and qdbi_mode/ were moved to utils/ ## Contents @@ -547,7 +548,7 @@ something is already included for your data format, and tell afl-fuzz to load that dictionary by adding `-x dictionaries/FORMAT.dict`. With afl-clang-lto you have an autodictionary generation for which you need to do nothing except to use afl-clang-lto as the compiler. You also have the option to generate -a dictionary yourself, see [libtokencap/README.md](libtokencap/README.md). +a dictionary yourself, see [utils/libtokencap/README.md](utils/libtokencap/README.md). afl-fuzz has a variety of options that help to workaround target quirks like specific locations for the input file (`-f`), not performing deterministic diff --git a/docs/Changelog.md b/docs/Changelog.md index 5201eb8b..1a47d18f 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -12,6 +12,7 @@ sending a mail to . ### Version ++3.00a (develop) - llvm_mode/ and gcc_plugin/ moved to instrumentation/ - examples/ renamed to utils/ + - moved libdislocator, libtokencap and qdbi_mode to utils/ - all compilers combined to afl-cc which emulates the previous ones - afl-llvm/gcc-rt.o merged into afl-compiler-rt.o - afl-fuzz diff --git a/docs/life_pro_tips.md b/docs/life_pro_tips.md index 77845c63..50ad75d4 100644 --- a/docs/life_pro_tips.md +++ b/docs/life_pro_tips.md @@ -13,7 +13,7 @@ See [parallel_fuzzing.md](parallel_fuzzing.md) for step-by-step tips. ## Improve the odds of spotting memory corruption bugs with libdislocator.so! -It's easy. Consult [libdislocator/README.md](../libdislocator/README.md) for usage tips. +It's easy. Consult [utils/libdislocator/README.md](../utils/libdislocator/README.md) for usage tips. ## Want to understand how your target parses a particular input file? diff --git a/docs/notes_for_asan.md b/docs/notes_for_asan.md index f08ae3fb..2b3bc028 100644 --- a/docs/notes_for_asan.md +++ b/docs/notes_for_asan.md @@ -35,7 +35,7 @@ no sanitizers compiled in. There is also the option of generating a corpus using a non-ASAN binary, and then feeding it to an ASAN-instrumented one to check for bugs. This is faster, and can give you somewhat comparable results. You can also try using -libdislocator (see libdislocator/README.dislocator.md in the parent directory) as a +libdislocator (see [utils/libdislocator/README.dislocator.md](../utils/libdislocator/README.dislocator.md) in the parent directory) as a lightweight and hassle-free (but less thorough) alternative. ## 2) Long version diff --git a/libdislocator/Makefile b/libdislocator/Makefile deleted file mode 100644 index 1c2fcaa7..00000000 --- a/libdislocator/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# -# american fuzzy lop++ - libdislocator -# ---------------------------------- -# -# Originally written by Michal Zalewski -# -# Copyright 2016 Google Inc. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# - -PREFIX ?= /usr/local -HELPER_PATH = $(PREFIX)/lib/afl - -VERSION = $(shell grep '^\#define VERSION ' ../config.h | cut -d '"' -f2) - -CFLAGS ?= -O3 -funroll-loops -D_FORTIFY_SOURCE=2 -CFLAGS += -I ../include/ -Wall -g -Wno-pointer-sign - -CFLAGS_ADD=$(USEHUGEPAGE:1=-DUSEHUGEPAGE) -CFLAGS += $(CFLAGS_ADD) - -all: libdislocator.so - -VPATH = .. -libdislocator.so: libdislocator.so.c ../config.h - $(CC) $(CFLAGS) $(CPPFLAGS) -shared -fPIC libdislocator.so.c -o ../$@ $(LDFLAGS) - -.NOTPARALLEL: clean - -clean: - rm -f *.o *.so *~ a.out core core.[1-9][0-9]* - rm -f ../libdislocator.so - -install: all - install -m 755 -d $${DESTDIR}$(HELPER_PATH) - install -m 755 ../libdislocator.so $${DESTDIR}$(HELPER_PATH) - install -m 644 -T README.md $${DESTDIR}$(HELPER_PATH)/README.dislocator.md - diff --git a/libdislocator/README.md b/libdislocator/README.md deleted file mode 100644 index 1785463e..00000000 --- a/libdislocator/README.md +++ /dev/null @@ -1,68 +0,0 @@ -# libdislocator, an abusive allocator - - (See ../README.md for the general instruction manual.) - -This is a companion library that can be used as a drop-in replacement for the -libc allocator in the fuzzed binaries. It improves the odds of bumping into -heap-related security bugs in several ways: - - - It allocates all buffers so that they are immediately adjacent to a - subsequent PROT_NONE page, causing most off-by-one reads and writes to - immediately segfault, - - - It adds a canary immediately below the allocated buffer, to catch writes - to negative offsets (won't catch reads, though), - - - It sets the memory returned by malloc() to garbage values, improving the - odds of crashing when the target accesses uninitialized data, - - - It sets freed memory to PROT_NONE and does not actually reuse it, causing - most use-after-free bugs to segfault right away, - - - It forces all realloc() calls to return a new address - and sets - PROT_NONE on the original block. This catches use-after-realloc bugs, - - - It checks for calloc() overflows and can cause soft or hard failures - of alloc requests past a configurable memory limit (AFL_LD_LIMIT_MB, - AFL_LD_HARD_FAIL). - - - Optionally, in platforms supporting it, huge pages can be used by passing - USEHUGEPAGE=1 to make. - - - Size alignment to `max_align_t` can be enforced with AFL_ALIGNED_ALLOC=1. - In this case, a tail canary is inserted in the padding bytes at the end - of the allocated zone. This reduce the ability of libdislocator to detect - off-by-one bugs but also it make slibdislocator compliant to the C standard. - -Basically, it is inspired by some of the non-default options available for the -OpenBSD allocator - see malloc.conf(5) on that platform for reference. It is -also somewhat similar to several other debugging libraries, such as gmalloc -and DUMA - but is simple, plug-and-play, and designed specifically for fuzzing -jobs. - -Note that it does nothing for stack-based memory handling errors. The --fstack-protector-all setting for GCC / clang, enabled when using AFL_HARDEN, -can catch some subset of that. - -The allocator is slow and memory-intensive (even the tiniest allocation uses up -4 kB of physical memory and 8 kB of virtual mem), making it completely unsuitable -for "production" uses; but it can be faster and more hassle-free than ASAN / MSAN -when fuzzing small, self-contained binaries. - -To use this library, run AFL like so: - -``` -AFL_PRELOAD=/path/to/libdislocator.so ./afl-fuzz [...other params...] -``` - -You *have* to specify path, even if it's just ./libdislocator.so or -$PWD/libdislocator.so. - -Similarly to afl-tmin, the library is not "proprietary" and can be used with -other fuzzers or testing tools without the need for any code tweaks. It does not -require AFL-instrumented binaries to work. - -Note that the AFL_PRELOAD approach (which AFL internally maps to LD_PRELOAD or -DYLD_INSERT_LIBRARIES, depending on the OS) works only if the target binary is -dynamically linked. Otherwise, attempting to use the library will have no -effect. diff --git a/libdislocator/libdislocator.so.c b/libdislocator/libdislocator.so.c deleted file mode 100644 index 2324e390..00000000 --- a/libdislocator/libdislocator.so.c +++ /dev/null @@ -1,544 +0,0 @@ -/* - - american fuzzy lop++ - dislocator, an abusive allocator - ----------------------------------------------------- - - Originally written by Michal Zalewski - - Copyright 2016 Google Inc. All rights reserved. - Copyright 2019-2020 AFLplusplus Project. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at: - - http://www.apache.org/licenses/LICENSE-2.0 - - This is a companion library that can be used as a drop-in replacement - for the libc allocator in the fuzzed binaries. See README.dislocator.md for - more info. - - */ - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include - -#ifdef __APPLE__ - #include -#endif - -#ifdef __FreeBSD__ - #include -#endif - -#if (defined(__linux__) && !defined(__ANDROID__)) || defined(__HAIKU__) - #include - #ifdef __linux__ - #include - #include - #endif - #ifdef __NR_getrandom - #define arc4random_buf(p, l) \ - do { \ - \ - ssize_t rd = syscall(__NR_getrandom, p, l, 0); \ - if (rd != l) DEBUGF("getrandom failed"); \ - \ - } while (0) - - #else - #include - #define arc4random_buf(p, l) \ - do { \ - \ - srand(time(NULL)); \ - u32 i; \ - u8 *ptr = (u8 *)p; \ - for (i = 0; i < l; i++) \ - ptr[i] = rand() % INT_MAX; \ - \ - } while (0) - - #endif -#endif - -#include "config.h" -#include "types.h" - -#if __STDC_VERSION__ < 201112L || \ - (defined(__FreeBSD__) && __FreeBSD_version < 1200000) -// use this hack if not C11 -typedef struct { - - long long __ll; - long double __ld; - -} max_align_t; - -#endif - -#define ALLOC_ALIGN_SIZE (_Alignof(max_align_t)) - -#ifndef PAGE_SIZE - #define PAGE_SIZE 4096 -#endif /* !PAGE_SIZE */ - -#ifndef MAP_ANONYMOUS - #define MAP_ANONYMOUS MAP_ANON -#endif /* !MAP_ANONYMOUS */ - -#define SUPER_PAGE_SIZE 1 << 21 - -/* Error / message handling: */ - -#define DEBUGF(_x...) \ - do { \ - \ - if (alloc_verbose) { \ - \ - if (++call_depth == 1) { \ - \ - fprintf(stderr, "[AFL] " _x); \ - fprintf(stderr, "\n"); \ - \ - } \ - call_depth--; \ - \ - } \ - \ - } while (0) - -#define FATAL(_x...) \ - do { \ - \ - if (++call_depth == 1) { \ - \ - fprintf(stderr, "*** [AFL] " _x); \ - fprintf(stderr, " ***\n"); \ - abort(); \ - \ - } \ - call_depth--; \ - \ - } while (0) - -/* Macro to count the number of pages needed to store a buffer: */ - -#define PG_COUNT(_l) (((_l) + (PAGE_SIZE - 1)) / PAGE_SIZE) - -/* Canary & clobber bytes: */ - -#define ALLOC_CANARY 0xAACCAACC -#define ALLOC_CLOBBER 0xCC - -#define TAIL_ALLOC_CANARY 0xAC - -#define PTR_C(_p) (((u32 *)(_p))[-1]) -#define PTR_L(_p) (((u32 *)(_p))[-2]) - -/* Configurable stuff (use AFL_LD_* to set): */ - -static u32 max_mem = MAX_ALLOC; /* Max heap usage to permit */ -static u8 alloc_verbose, /* Additional debug messages */ - hard_fail, /* abort() when max_mem exceeded? */ - no_calloc_over, /* abort() on calloc() overflows? */ - align_allocations; /* Force alignment to sizeof(void*) */ - -#if defined __OpenBSD__ || defined __APPLE__ - #define __thread - #warning no thread support available -#endif -static __thread size_t total_mem; /* Currently allocated mem */ - -static __thread u32 call_depth; /* To avoid recursion via fprintf() */ -static u32 alloc_canary; - -/* This is the main alloc function. It allocates one page more than necessary, - sets that tailing page to PROT_NONE, and then increments the return address - so that it is right-aligned to that boundary. Since it always uses mmap(), - the returned memory will be zeroed. */ - -static void *__dislocator_alloc(size_t len) { - - u8 * ret, *base; - size_t tlen; - int flags, fd, sp; - - if (total_mem + len > max_mem || total_mem + len < total_mem) { - - if (hard_fail) FATAL("total allocs exceed %u MB", max_mem / 1024 / 1024); - - DEBUGF("total allocs exceed %u MB, returning NULL", max_mem / 1024 / 1024); - - return NULL; - - } - - size_t rlen; - if (align_allocations && (len & (ALLOC_ALIGN_SIZE - 1))) - rlen = (len & ~(ALLOC_ALIGN_SIZE - 1)) + ALLOC_ALIGN_SIZE; - else - rlen = len; - - /* We will also store buffer length and a canary below the actual buffer, so - let's add 8 bytes for that. */ - - base = NULL; - tlen = (1 + PG_COUNT(rlen + 8)) * PAGE_SIZE; - flags = MAP_PRIVATE | MAP_ANONYMOUS; - fd = -1; -#if defined(USEHUGEPAGE) - sp = (rlen >= SUPER_PAGE_SIZE && !(rlen % SUPER_PAGE_SIZE)); - - #if defined(__APPLE__) - if (sp) fd = VM_FLAGS_SUPERPAGE_SIZE_2MB; - #elif defined(__linux__) - if (sp) flags |= MAP_HUGETLB; - #elif defined(__FreeBSD__) - if (sp) flags |= MAP_ALIGNED_SUPER; - #elif defined(__sun) - if (sp) { - - base = (void *)(caddr_t)(1 << 21); - flags |= MAP_ALIGN; - - } - - #endif -#else - (void)sp; -#endif - - ret = (u8 *)mmap(base, tlen, PROT_READ | PROT_WRITE, flags, fd, 0); -#if defined(USEHUGEPAGE) - /* We try one more time with regular call */ - if (ret == MAP_FAILED) { - - #if defined(__APPLE__) - fd = -1; - #elif defined(__linux__) - flags &= -MAP_HUGETLB; - #elif defined(__FreeBSD__) - flags &= -MAP_ALIGNED_SUPER; - #elif defined(__sun) - flags &= -MAP_ALIGN; - #endif - ret = (u8 *)mmap(NULL, tlen, PROT_READ | PROT_WRITE, flags, fd, 0); - - } - -#endif - - if (ret == MAP_FAILED) { - - if (hard_fail) FATAL("mmap() failed on alloc (OOM?)"); - - DEBUGF("mmap() failed on alloc (OOM?)"); - - return NULL; - - } - - /* Set PROT_NONE on the last page. */ - - if (mprotect(ret + PG_COUNT(rlen + 8) * PAGE_SIZE, PAGE_SIZE, PROT_NONE)) - FATAL("mprotect() failed when allocating memory"); - - /* Offset the return pointer so that it's right-aligned to the page - boundary. */ - - ret += PAGE_SIZE * PG_COUNT(rlen + 8) - rlen - 8; - - /* Store allocation metadata. */ - - ret += 8; - - PTR_L(ret) = len; - PTR_C(ret) = alloc_canary; - - total_mem += len; - - if (rlen != len) { - - size_t i; - for (i = len; i < rlen; ++i) - ret[i] = TAIL_ALLOC_CANARY; - - } - - return ret; - -} - -/* The "user-facing" wrapper for calloc(). This just checks for overflows and - displays debug messages if requested. */ - -void *calloc(size_t elem_len, size_t elem_cnt) { - - void *ret; - - size_t len = elem_len * elem_cnt; - - /* Perform some sanity checks to detect obvious issues... */ - - if (elem_cnt && len / elem_cnt != elem_len) { - - if (no_calloc_over) { - - DEBUGF("calloc(%zu, %zu) would overflow, returning NULL", elem_len, - elem_cnt); - return NULL; - - } - - FATAL("calloc(%zu, %zu) would overflow", elem_len, elem_cnt); - - } - - ret = __dislocator_alloc(len); - - DEBUGF("calloc(%zu, %zu) = %p [%zu total]", elem_len, elem_cnt, ret, - total_mem); - - return ret; - -} - -/* The wrapper for malloc(). Roughly the same, also clobbers the returned - memory (unlike calloc(), malloc() is not guaranteed to return zeroed - memory). */ - -void *malloc(size_t len) { - - void *ret; - - ret = __dislocator_alloc(len); - - DEBUGF("malloc(%zu) = %p [%zu total]", len, ret, total_mem); - - if (ret && len) memset(ret, ALLOC_CLOBBER, len); - - return ret; - -} - -/* The wrapper for free(). This simply marks the entire region as PROT_NONE. - If the region is already freed, the code will segfault during the attempt to - read the canary. Not very graceful, but works, right? */ - -void free(void *ptr) { - - u32 len; - - DEBUGF("free(%p)", ptr); - - if (!ptr) return; - - if (PTR_C(ptr) != alloc_canary) FATAL("bad allocator canary on free()"); - - len = PTR_L(ptr); - - total_mem -= len; - - if (align_allocations && (len & (ALLOC_ALIGN_SIZE - 1))) { - - u8 * ptr_ = ptr; - size_t rlen = (len & ~(ALLOC_ALIGN_SIZE - 1)) + ALLOC_ALIGN_SIZE; - for (; len < rlen; ++len) - if (ptr_[len] != TAIL_ALLOC_CANARY) - FATAL("bad tail allocator canary on free()"); - - } - - /* Protect everything. Note that the extra page at the end is already - set as PROT_NONE, so we don't need to touch that. */ - - ptr -= PAGE_SIZE * PG_COUNT(len + 8) - len - 8; - - if (mprotect(ptr - 8, PG_COUNT(len + 8) * PAGE_SIZE, PROT_NONE)) - FATAL("mprotect() failed when freeing memory"); - - /* Keep the mapping; this is wasteful, but prevents ptr reuse. */ - -} - -/* Realloc is pretty straightforward, too. We forcibly reallocate the buffer, - move data, and then free (aka mprotect()) the original one. */ - -void *realloc(void *ptr, size_t len) { - - void *ret; - - ret = malloc(len); - - if (ret && ptr) { - - if (PTR_C(ptr) != alloc_canary) FATAL("bad allocator canary on realloc()"); - // Here the tail canary check is delayed to free() - - memcpy(ret, ptr, MIN(len, PTR_L(ptr))); - free(ptr); - - } - - DEBUGF("realloc(%p, %zu) = %p [%zu total]", ptr, len, ret, total_mem); - - return ret; - -} - -/* posix_memalign we mainly check the proper alignment argument - if the requested size fits within the alignment we do - a normal request */ - -int posix_memalign(void **ptr, size_t align, size_t len) { - - // if (*ptr == NULL) return EINVAL; // (andrea) Why? I comment it out for now - if ((align % 2) || (align % sizeof(void *))) return EINVAL; - if (len == 0) { - - *ptr = NULL; - return 0; - - } - - size_t rem = len % align; - if (rem) len += align - rem; - - *ptr = __dislocator_alloc(len); - - if (*ptr && len) memset(*ptr, ALLOC_CLOBBER, len); - - DEBUGF("posix_memalign(%p %zu, %zu) [*ptr = %p]", ptr, align, len, *ptr); - - return 0; - -} - -/* just the non-posix fashion */ - -void *memalign(size_t align, size_t len) { - - void *ret = NULL; - - if (posix_memalign(&ret, align, len)) { - - DEBUGF("memalign(%zu, %zu) failed", align, len); - - } - - return ret; - -} - -/* sort of C11 alias of memalign only more severe, alignment-wise */ - -void *aligned_alloc(size_t align, size_t len) { - - void *ret = NULL; - - if ((len % align)) return NULL; - - if (posix_memalign(&ret, align, len)) { - - DEBUGF("aligned_alloc(%zu, %zu) failed", align, len); - - } - - return ret; - -} - -/* specific BSD api mainly checking possible overflow for the size */ - -void *reallocarray(void *ptr, size_t elem_len, size_t elem_cnt) { - - const size_t elem_lim = 1UL << (sizeof(size_t) * 4); - const size_t elem_tot = elem_len * elem_cnt; - void * ret = NULL; - - if ((elem_len >= elem_lim || elem_cnt >= elem_lim) && elem_len > 0 && - elem_cnt > (SIZE_MAX / elem_len)) { - - DEBUGF("reallocarray size overflow (%zu)", elem_tot); - - } else { - - ret = realloc(ptr, elem_tot); - - } - - return ret; - -} - -#if !defined(__ANDROID__) -size_t malloc_usable_size(void *ptr) { - -#else -size_t malloc_usable_size(const void *ptr) { - -#endif - - return ptr ? PTR_L(ptr) : 0; - -} - -__attribute__((constructor)) void __dislocator_init(void) { - - u8 *tmp = (u8 *)getenv("AFL_LD_LIMIT_MB"); - - if (tmp) { - - u8 *tok; - s32 mmem = (s32)strtol((char *)tmp, (char **)&tok, 10); - if (*tok != '\0' || errno == ERANGE) FATAL("Bad value for AFL_LD_LIMIT_MB"); - max_mem = mmem * 1024 * 1024; - - } - - alloc_canary = ALLOC_CANARY; - tmp = (u8 *)getenv("AFL_RANDOM_ALLOC_CANARY"); - - if (tmp) arc4random_buf(&alloc_canary, sizeof(alloc_canary)); - - alloc_verbose = !!getenv("AFL_LD_VERBOSE"); - hard_fail = !!getenv("AFL_LD_HARD_FAIL"); - no_calloc_over = !!getenv("AFL_LD_NO_CALLOC_OVER"); - align_allocations = !!getenv("AFL_ALIGNED_ALLOC"); - -} - -/* NetBSD fault handler specific api subset */ - -void (*esetfunc(void (*fn)(int, const char *, ...)))(int, const char *, ...) { - - /* Might not be meaningful to implement; upper calls already report errors */ - return NULL; - -} - -void *emalloc(size_t len) { - - return malloc(len); - -} - -void *ecalloc(size_t elem_len, size_t elem_cnt) { - - return calloc(elem_len, elem_cnt); - -} - -void *erealloc(void *ptr, size_t len) { - - return realloc(ptr, len); - -} - diff --git a/libtokencap/Makefile b/libtokencap/Makefile deleted file mode 100644 index 2343125f..00000000 --- a/libtokencap/Makefile +++ /dev/null @@ -1,94 +0,0 @@ -# -# american fuzzy lop++ - libtokencap -# -------------------------------- -# -# Originally written by Michal Zalewski -# -# Copyright 2016 Google Inc. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# - -PREFIX ?= /usr/local -HELPER_PATH = $(PREFIX)/lib/afl -DOC_PATH ?= $(PREFIX)/share/doc/afl -MAN_PATH ?= $(PREFIX)/share/man/man8 - -VERSION = $(shell grep '^\#define VERSION ' ../config.h | cut -d '"' -f2) - -CFLAGS ?= -O3 -funroll-loops -D_FORTIFY_SOURCE=2 -CFLAGS += -I ../include/ -Wall -g -Wno-pointer-sign - - -UNAME_S =$(shell uname -s)# GNU make -UNAME_S:sh=uname -s # BSD make -_UNIQ=_QINU_ - - _OS_DL = $(_UNIQ)$(UNAME_S) - __OS_DL = $(_OS_DL:$(_UNIQ)Linux=$(_UNIQ)) - ___OS_DL = $(__OS_DL:$(_UNIQ)Darwin=$(_UNIQ)) - ____OS_DL = $(___OS_DL:$(_UNIQ)$(UNAME_S)=) -_____OS_DL = $(____OS_DL:$(_UNIQ)="-ldl") - - _OS_TARGET = $(___OS_DL:$(_UNIQ)FreeBSD=$(_UNIQ)) - __OS_TARGET = $(_OS_TARGET:$(_UNIQ)OpenBSD=$(_UNIQ)) - ___OS_TARGET = $(__OS_TARGET:$(_UNIQ)NetBSD=$(_UNIQ)) - ____OS_TARGET = $(___OS_TARGET:$(_UNIQ)Haiku=$(_UNIQ)) - _____OS_TARGET = $(____OS_TARGET:$(_UNIQ)SunOS=$(_UNIQ)) -______OS_TARGET = $(_____OS_TARGET:$(_UNIQ)$(UNAME_S)=) - -TARGETS = $(______OS_TARGET:$(_UNIQ)=libtokencap.so) - -LDFLAGS += $(_____OS_DL) - -#ifeq "$(shell uname)" "Linux" -# TARGETS = libtokencap.so -# LDFLAGS += -ldl -#endif -#ifeq "$(shell uname)" "Darwin" -# TARGETS = libtokencap.so -# LDFLAGS += -ldl -#endif -#ifeq "$(shell uname)" "FreeBSD" -# TARGETS = libtokencap.so -#endif -#ifeq "$(shell uname)" "OpenBSD" -# TARGETS = libtokencap.so -#endif -#ifeq "$(shell uname)" "NetBSD" -# TARGETS = libtokencap.so -#endif -#ifeq "$(shell uname)" "DragonFly" -# TARGETS = libtokencap.so -# LDFLAGS += -ldl -#endif -all: $(TARGETS) - -VPATH = .. -libtokencap.so: libtokencap.so.c ../config.h - $(CC) $(CFLAGS) $(CPPFLAGS) -shared -fPIC $< -o ../$@ $(LDFLAGS) - -.NOTPARALLEL: clean - -debug: - @echo $(UNAME_S)$(_UNIQ) | hexdump -C - @echo from $(____OS_DL) : $(_UNIQ)$(UNAME_S) = -\> $(_____OS_DL) - @echo from $(_____OS_DL) : $(_UNIQ) = -ldl -\> $(______OS_DL) - @echo from $(____OS_DL) : $(_UNIQ)FreeBSD = $(_UNIQ) -\> $(_OS_TARGET) - @echo from $(_OS_TARGET) : $(_UNIQ)OpenBSD = $(_UNIQ) -\> $(__OS_TARGET) - @echo from $(__OS_TARGET) : $(_UNIQ)NetBSD = $(_UNIQ) -\> $(___OS_TARGET) - @echo from $(___OS_TARGET) : $(_UNIQ)$(_UNIQ) = -\> $(____OS_TARGET) - @echo from $(____OS_TARGET) : $(_UNIQ) = libtokencap.so -\> $(TARGETS) - -clean: - rm -f *.o *.so *~ a.out core core.[1-9][0-9]* - rm -f ../libtokencap.so - -install: all - install -m 755 -d $${DESTDIR}$(HELPER_PATH) - install -m 755 ../libtokencap.so $${DESTDIR}$(HELPER_PATH) - install -m 644 -T README.md $${DESTDIR}$(DOC_PATH)/README.tokencap.md diff --git a/libtokencap/README.md b/libtokencap/README.md deleted file mode 100644 index 13a440da..00000000 --- a/libtokencap/README.md +++ /dev/null @@ -1,64 +0,0 @@ -# strcmp() / memcmp() token capture library - - (See ../README.md for the general instruction manual.) - -This companion library allows you to instrument `strcmp()`, `memcmp()`, -and related functions to automatically extract syntax tokens passed to any of -these libcalls. The resulting list of tokens may be then given as a starting -dictionary to afl-fuzz (the -x option) to improve coverage on subsequent -fuzzing runs. - -This may help improving coverage in some targets, and do precisely nothing in -others. In some cases, it may even make things worse: if libtokencap picks up -syntax tokens that are not used to process the input data, but that are a part -of - say - parsing a config file... well, you're going to end up wasting a lot -of CPU time on trying them out in the input stream. In other words, use this -feature with care. Manually screening the resulting dictionary is almost -always a necessity. - -As for the actual operation: the library stores tokens, without any deduping, -by appending them to a file specified via AFL_TOKEN_FILE. If the variable is not -set, the tool uses stderr (which is probably not what you want). - -Similarly to afl-tmin, the library is not "proprietary" and can be used with -other fuzzers or testing tools without the need for any code tweaks. It does not -require AFL-instrumented binaries to work. - -To use the library, you *need* to make sure that your fuzzing target is compiled -with -fno-builtin and is linked dynamically. If you wish to automate the first -part without mucking with CFLAGS in Makefiles, you can set AFL_NO_BUILTIN=1 -when using afl-gcc. This setting specifically adds the following flags: - -``` - -fno-builtin-strcmp -fno-builtin-strncmp -fno-builtin-strcasecmp - -fno-builtin-strcasencmp -fno-builtin-memcmp -fno-builtin-strstr - -fno-builtin-strcasestr -``` - -The next step is simply loading this library via LD_PRELOAD. The optimal usage -pattern is to allow afl-fuzz to fuzz normally for a while and build up a corpus, -and then fire off the target binary, with libtokencap.so loaded, on every file -found by AFL in that earlier run. This demonstrates the basic principle: - -``` - export AFL_TOKEN_FILE=$PWD/temp_output.txt - - for i in /queue/id*; do - LD_PRELOAD=/path/to/libtokencap.so \ - /path/to/target/program [...params, including $i...] - done - - sort -u temp_output.txt >afl_dictionary.txt -``` - -If you don't get any results, the target library is probably not using strcmp() -and memcmp() to parse input; or you haven't compiled it with -fno-builtin; or -the whole thing isn't dynamically linked, and LD_PRELOAD is having no effect. - -Portability hints: There is probably no particularly portable and non-invasive -way to distinguish between read-only and read-write memory mappings. -The `__tokencap_load_mappings()` function is the only thing that would -need to be changed for other OSes. - -Current supported OSes are: Linux, Darwin, FreeBSD (thanks to @devnexen) - diff --git a/libtokencap/libtokencap.so.c b/libtokencap/libtokencap.so.c deleted file mode 100644 index 3629e804..00000000 --- a/libtokencap/libtokencap.so.c +++ /dev/null @@ -1,794 +0,0 @@ -/* - - american fuzzy lop++ - extract tokens passed to strcmp / memcmp - ------------------------------------------------------------- - - Originally written by Michal Zalewski - - Copyright 2016 Google Inc. All rights reserved. - Copyright 2019-2020 AFLplusplus Project. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at: - - http://www.apache.org/licenses/LICENSE-2.0 - - This Linux-only companion library allows you to instrument strcmp(), - memcmp(), and related functions to automatically extract tokens. - See README.tokencap.md for more info. - - */ - -#ifndef _GNU_SOURCE - #define _GNU_SOURCE -#endif -#include -#include -#include -#include -#include -#include - -#include "../types.h" -#include "../config.h" - -#if !defined __linux__ && !defined __APPLE__ && !defined __FreeBSD__ && \ - !defined __OpenBSD__ && !defined __NetBSD__ && !defined __DragonFly__ && \ - !defined(__HAIKU__) && !defined(__sun) - #error "Sorry, this library is unsupported in this platform for now!" -#endif /* !__linux__ && !__APPLE__ && ! __FreeBSD__ && ! __OpenBSD__ && \ - !__NetBSD__*/ - -#if defined __APPLE__ - #include - #include -#elif defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ - #include - #include - #if !defined __NetBSD__ - #include - #endif - #include -#elif defined __HAIKU__ - #include -#elif defined __sun - /* For map addresses the old struct is enough */ - #include - #include -#endif - -#include - -#ifdef RTLD_NEXT -/* The libc functions are a magnitude faster than our replacements. - Use them when RTLD_NEXT is available. */ -int (*__libc_strcmp)(const char *str1, const char *str2); -int (*__libc_strncmp)(const char *str1, const char *str2, size_t len); -int (*__libc_strcasecmp)(const char *str1, const char *str2); -int (*__libc_strncasecmp)(const char *str1, const char *str2, size_t len); -int (*__libc_memcmp)(const void *mem1, const void *mem2, size_t len); -int (*__libc_bcmp)(const void *mem1, const void *mem2, size_t len); -char *(*__libc_strstr)(const char *haystack, const char *needle); -char *(*__libc_strcasestr)(const char *haystack, const char *needle); -void *(*__libc_memmem)(const void *haystack, size_t haystack_len, - const void *needle, size_t needle_len); -#endif - -/* Mapping data and such */ - -#define MAX_MAPPINGS 1024 - -static struct mapping { void *st, *en; } __tokencap_ro[MAX_MAPPINGS]; - -static u32 __tokencap_ro_cnt; -static u8 __tokencap_ro_loaded; -static int __tokencap_out_file = -1; -static pid_t __tokencap_pid = -1; - -/* Identify read-only regions in memory. Only parameters that fall into these - ranges are worth dumping when passed to strcmp() and so on. Read-write - regions are far more likely to contain user input instead. */ - -static void __tokencap_load_mappings(void) { - -#if defined __linux__ - - u8 buf[MAX_LINE]; - FILE *f = fopen("/proc/self/maps", "r"); - - __tokencap_ro_loaded = 1; - - if (!f) return; - - while (fgets(buf, MAX_LINE, f)) { - - u8 rf, wf; - void *st, *en; - - if (sscanf(buf, "%p-%p %c%c", &st, &en, &rf, &wf) != 4) continue; - if (wf == 'w' || rf != 'r') continue; - - __tokencap_ro[__tokencap_ro_cnt].st = (void *)st; - __tokencap_ro[__tokencap_ro_cnt].en = (void *)en; - - if (++__tokencap_ro_cnt == MAX_MAPPINGS) break; - - } - - fclose(f); - -#elif defined __APPLE__ - - struct vm_region_submap_info_64 region; - mach_msg_type_number_t cnt = VM_REGION_SUBMAP_INFO_COUNT_64; - vm_address_t base = 0; - vm_size_t size = 0; - natural_t depth = 0; - - __tokencap_ro_loaded = 1; - - while (1) { - - if (vm_region_recurse_64(mach_task_self(), &base, &size, &depth, - (vm_region_info_64_t)®ion, - &cnt) != KERN_SUCCESS) - break; - - if (region.is_submap) { - - depth++; - - } else { - - /* We only care of main map addresses and the read only kinds */ - if ((region.protection & VM_PROT_READ) && - !(region.protection & VM_PROT_WRITE)) { - - __tokencap_ro[__tokencap_ro_cnt].st = (void *)base; - __tokencap_ro[__tokencap_ro_cnt].en = (void *)(base + size); - - if (++__tokencap_ro_cnt == MAX_MAPPINGS) break; - - } - - base += size; - size = 0; - - } - - } - -#elif defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ - - #if defined __FreeBSD__ - int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, __tokencap_pid}; - #elif defined __OpenBSD__ - int mib[] = {CTL_KERN, KERN_PROC_VMMAP, __tokencap_pid}; - #elif defined __NetBSD__ - int mib[] = {CTL_VM, VM_PROC, VM_PROC_MAP, __tokencap_pid, - sizeof(struct kinfo_vmentry)}; - #endif - char * buf, *low, *high; - size_t miblen = sizeof(mib) / sizeof(mib[0]); - size_t len; - - if (sysctl(mib, miblen, NULL, &len, NULL, 0) == -1) return; - - #if defined __FreeBSD__ || defined __NetBSD__ - len = len * 4 / 3; - #elif defined __OpenBSD__ - len -= len % sizeof(struct kinfo_vmentry); - #endif - - buf = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); - if (buf == MAP_FAILED) return; - - if (sysctl(mib, miblen, buf, &len, NULL, 0) == -1) { - - munmap(buf, len); - return; - - } - - low = buf; - high = low + len; - - __tokencap_ro_loaded = 1; - - while (low < high) { - - struct kinfo_vmentry *region = (struct kinfo_vmentry *)low; - - #if defined __FreeBSD__ || defined __NetBSD__ - - #if defined __FreeBSD__ - size_t size = region->kve_structsize; - - if (size == 0) break; - #elif defined __NetBSD__ - size_t size = sizeof(*region); - #endif - - /* We go through the whole mapping of the process and track read-only - * addresses */ - if ((region->kve_protection & KVME_PROT_READ) && - !(region->kve_protection & KVME_PROT_WRITE)) { - - #elif defined __OpenBSD__ - - size_t size = sizeof(*region); - - /* We go through the whole mapping of the process and track read-only - * addresses */ - if ((region->kve_protection & KVE_PROT_READ) && - !(region->kve_protection & KVE_PROT_WRITE)) { - - #endif - __tokencap_ro[__tokencap_ro_cnt].st = (void *)region->kve_start; - __tokencap_ro[__tokencap_ro_cnt].en = (void *)region->kve_end; - - if (++__tokencap_ro_cnt == MAX_MAPPINGS) break; - - } - - low += size; - - } - - munmap(buf, len); -#elif defined __HAIKU__ - image_info ii; - int32_t group = 0; - - __tokencap_ro_loaded = 1; - - while (get_next_image_info(0, &group, &ii) == B_OK) { - - __tokencap_ro[__tokencap_ro_cnt].st = ii.text; - __tokencap_ro[__tokencap_ro_cnt].en = ((char *)ii.text) + ii.text_size; - - if (++__tokencap_ro_cnt == MAX_MAPPINGS) break; - - } - -#elif defined __sun - prmap_t *c, *map; - char path[PATH_MAX]; - ssize_t r; - size_t hint; - int fd; - - snprintf(path, sizeof(path), "/proc/%ld/map", getpid()); - fd = open(path, O_RDONLY); - hint = (1 << 20); - map = malloc(hint); - - __tokencap_ro_loaded = 1; - - for (; (r = pread(fd, map, hint, 0)) == hint;) { - - hint <<= 1; - map = realloc(map, hint); - - } - - for (c = map; r > 0; c++, r -= sizeof(prmap_t)) { - - __tokencap_ro[__tokencap_ro_cnt].st = (void *)c->pr_vaddr; - __tokencap_ro[__tokencap_ro_cnt].en = (void *)(c->pr_vaddr + c->pr_size); - - if (++__tokencap_ro_cnt == MAX_MAPPINGS) break; - - } - - free(map); - close(fd); -#endif - -} - -/* Check an address against the list of read-only mappings. */ - -static u8 __tokencap_is_ro(const void *ptr) { - - u32 i; - - if (!__tokencap_ro_loaded) __tokencap_load_mappings(); - - for (i = 0; i < __tokencap_ro_cnt; i++) - if (ptr >= __tokencap_ro[i].st && ptr <= __tokencap_ro[i].en) return 1; - - return 0; - -} - -/* Dump an interesting token to output file, quoting and escaping it - properly. */ - -static void __tokencap_dump(const u8 *ptr, size_t len, u8 is_text) { - - u8 buf[MAX_AUTO_EXTRA * 4 + 1]; - u32 i; - u32 pos = 0; - - if (len < MIN_AUTO_EXTRA || len > MAX_AUTO_EXTRA || __tokencap_out_file == -1) - return; - - for (i = 0; i < len; i++) { - - if (is_text && !ptr[i]) break; - - switch (ptr[i]) { - - case 0 ... 31: - case 127 ... 255: - case '\"': - case '\\': - - sprintf(buf + pos, "\\x%02x", ptr[i]); - pos += 4; - break; - - default: - buf[pos++] = ptr[i]; - - } - - } - - buf[pos] = 0; - - int wrt_ok = (1 == write(__tokencap_out_file, "\"", 1)); - wrt_ok &= (pos == write(__tokencap_out_file, buf, pos)); - wrt_ok &= (2 == write(__tokencap_out_file, "\"\n", 2)); - -} - -/* Replacements for strcmp(), memcmp(), and so on. Note that these will be used - only if the target is compiled with -fno-builtins and linked dynamically. */ - -#undef strcmp - -int strcmp(const char *str1, const char *str2) { - - if (__tokencap_is_ro(str1)) __tokencap_dump(str1, strlen(str1), 1); - if (__tokencap_is_ro(str2)) __tokencap_dump(str2, strlen(str2), 1); - -#ifdef RTLD_NEXT - if (__libc_strcmp) return __libc_strcmp(str1, str2); -#endif - - while (1) { - - const unsigned char c1 = *str1, c2 = *str2; - - if (c1 != c2) return (c1 > c2) ? 1 : -1; - if (!c1) return 0; - str1++; - str2++; - - } - -} - -#undef strncmp - -int strncmp(const char *str1, const char *str2, size_t len) { - - if (__tokencap_is_ro(str1)) __tokencap_dump(str1, len, 1); - if (__tokencap_is_ro(str2)) __tokencap_dump(str2, len, 1); - -#ifdef RTLD_NEXT - if (__libc_strncmp) return __libc_strncmp(str1, str2, len); -#endif - - while (len--) { - - unsigned char c1 = *str1, c2 = *str2; - - if (c1 != c2) return (c1 > c2) ? 1 : -1; - if (!c1) return 0; - str1++; - str2++; - - } - - return 0; - -} - -#undef strcasecmp - -int strcasecmp(const char *str1, const char *str2) { - - if (__tokencap_is_ro(str1)) __tokencap_dump(str1, strlen(str1), 1); - if (__tokencap_is_ro(str2)) __tokencap_dump(str2, strlen(str2), 1); - -#ifdef RTLD_NEXT - if (__libc_strcasecmp) return __libc_strcasecmp(str1, str2); -#endif - - while (1) { - - const unsigned char c1 = tolower((int)*str1), c2 = tolower((int)*str2); - - if (c1 != c2) return (c1 > c2) ? 1 : -1; - if (!c1) return 0; - str1++; - str2++; - - } - -} - -#undef strncasecmp - -int strncasecmp(const char *str1, const char *str2, size_t len) { - - if (__tokencap_is_ro(str1)) __tokencap_dump(str1, len, 1); - if (__tokencap_is_ro(str2)) __tokencap_dump(str2, len, 1); - -#ifdef RTLD_NEXT - if (__libc_strncasecmp) return __libc_strncasecmp(str1, str2, len); -#endif - - while (len--) { - - const unsigned char c1 = tolower((int)*str1), c2 = tolower((int)*str2); - - if (c1 != c2) return (c1 > c2) ? 1 : -1; - if (!c1) return 0; - str1++; - str2++; - - } - - return 0; - -} - -#undef memcmp - -int memcmp(const void *mem1, const void *mem2, size_t len) { - - if (__tokencap_is_ro(mem1)) __tokencap_dump(mem1, len, 0); - if (__tokencap_is_ro(mem2)) __tokencap_dump(mem2, len, 0); - -#ifdef RTLD_NEXT - if (__libc_memcmp) return __libc_memcmp(mem1, mem2, len); -#endif - - const char *strmem1 = (const char *)mem1; - const char *strmem2 = (const char *)mem2; - - while (len--) { - - const unsigned char c1 = *strmem1, c2 = *strmem2; - if (c1 != c2) return (c1 > c2) ? 1 : -1; - strmem1++; - strmem2++; - - } - - return 0; - -} - -#undef bcmp - -int bcmp(const void *mem1, const void *mem2, size_t len) { - - if (__tokencap_is_ro(mem1)) __tokencap_dump(mem1, len, 0); - if (__tokencap_is_ro(mem2)) __tokencap_dump(mem2, len, 0); - -#ifdef RTLD_NEXT - if (__libc_bcmp) return __libc_bcmp(mem1, mem2, len); -#endif - - const char *strmem1 = (const char *)mem1; - const char *strmem2 = (const char *)mem2; - - while (len--) { - - int diff = *strmem1 ^ *strmem2; - if (diff != 0) return 1; - strmem1++; - strmem2++; - - } - - return 0; - -} - -#undef strstr - -char *strstr(const char *haystack, const char *needle) { - - if (__tokencap_is_ro(haystack)) - __tokencap_dump(haystack, strlen(haystack), 1); - - if (__tokencap_is_ro(needle)) __tokencap_dump(needle, strlen(needle), 1); - -#ifdef RTLD_NEXT - if (__libc_strstr) return __libc_strstr(haystack, needle); -#endif - - do { - - const char *n = needle; - const char *h = haystack; - - while (*n && *h && *n == *h) - n++, h++; - - if (!*n) return (char *)haystack; - - } while (*(haystack++)); - - return 0; - -} - -#undef strcasestr - -char *strcasestr(const char *haystack, const char *needle) { - - if (__tokencap_is_ro(haystack)) - __tokencap_dump(haystack, strlen(haystack), 1); - - if (__tokencap_is_ro(needle)) __tokencap_dump(needle, strlen(needle), 1); - -#ifdef RTLD_NEXT - if (__libc_strcasestr) return __libc_strcasestr(haystack, needle); -#endif - - do { - - const char *n = needle; - const char *h = haystack; - - while (*n && *h && tolower((int)*n) == tolower((int)*h)) - n++, h++; - - if (!*n) return (char *)haystack; - - } while (*(haystack++)); - - return 0; - -} - -#undef memmem - -void *memmem(const void *haystack, size_t haystack_len, const void *needle, - size_t needle_len) { - - if (__tokencap_is_ro(haystack)) __tokencap_dump(haystack, haystack_len, 1); - - if (__tokencap_is_ro(needle)) __tokencap_dump(needle, needle_len, 1); - -#ifdef RTLD_NEXT - if (__libc_memmem) - return __libc_memmem(haystack, haystack_len, needle, needle_len); -#endif - - const char *n = (const char *)needle; - const char *h = (const char *)haystack; - if (haystack_len < needle_len) return 0; - if (needle_len == 0) return (void *)haystack; - if (needle_len == 1) return memchr(haystack, *n, haystack_len); - - const char *end = h + (haystack_len - needle_len); - - do { - - if (*h == *n) { - - if (memcmp(h, n, needle_len) == 0) return (void *)h; - - } - - } while (h++ <= end); - - return 0; - -} - -/* Common libraries wrappers (from honggfuzz) */ - -/* - * Apache's httpd wrappers - */ -int ap_cstr_casecmp(const char *s1, const char *s2) { - - return strcasecmp(s1, s2); - -} - -int ap_cstr_casecmpn(const char *s1, const char *s2, size_t n) { - - return strncasecmp(s1, s2, n); - -} - -const char *ap_strcasestr(const char *s1, const char *s2) { - - return strcasestr(s1, s2); - -} - -int apr_cstr_casecmp(const char *s1, const char *s2) { - - return strcasecmp(s1, s2); - -} - -int apr_cstr_casecmpn(const char *s1, const char *s2, size_t n) { - - return strncasecmp(s1, s2, n); - -} - -/* - * *SSL wrappers - */ -int CRYPTO_memcmp(const void *m1, const void *m2, size_t len) { - - return memcmp(m1, m2, len); - -} - -int OPENSSL_memcmp(const void *m1, const void *m2, size_t len) { - - return memcmp(m1, m2, len); - -} - -int OPENSSL_strcasecmp(const char *s1, const char *s2) { - - return strcasecmp(s1, s2); - -} - -int OPENSSL_strncasecmp(const char *s1, const char *s2, size_t len) { - - return strncasecmp(s1, s2, len); - -} - -int32_t memcmpct(const void *s1, const void *s2, size_t len) { - - return memcmp(s1, s2, len); - -} - -/* - * libXML wrappers - */ -int xmlStrncmp(const char *s1, const char *s2, int len) { - - if (len <= 0) { return 0; } - if (s1 == s2) { return 0; } - if (s1 == NULL) { return -1; } - if (s2 == NULL) { return 1; } - return strncmp(s1, s2, (size_t)len); - -} - -int xmlStrcmp(const char *s1, const char *s2) { - - if (s1 == s2) { return 0; } - if (s1 == NULL) { return -1; } - if (s2 == NULL) { return 1; } - return strcmp(s1, s2); - -} - -int xmlStrEqual(const char *s1, const char *s2) { - - if (s1 == s2) { return 1; } - if (s1 == NULL) { return 0; } - if (s2 == NULL) { return 0; } - if (strcmp(s1, s2) == 0) { return 1; } - return 0; - -} - -int xmlStrcasecmp(const char *s1, const char *s2) { - - if (s1 == s2) { return 0; } - if (s1 == NULL) { return -1; } - if (s2 == NULL) { return 1; } - return strcasecmp(s1, s2); - -} - -int xmlStrncasecmp(const char *s1, const char *s2, int len) { - - if (len <= 0) { return 0; } - if (s1 == s2) { return 0; } - if (s1 == NULL) { return -1; } - if (s2 == NULL) { return 1; } - return strncasecmp(s1, s2, (size_t)len); - -} - -const char *xmlStrstr(const char *haystack, const char *needle) { - - if (haystack == NULL) { return NULL; } - if (needle == NULL) { return NULL; } - return strstr(haystack, needle); - -} - -const char *xmlStrcasestr(const char *haystack, const char *needle) { - - if (haystack == NULL) { return NULL; } - if (needle == NULL) { return NULL; } - return strcasestr(haystack, needle); - -} - -/* - * Samba wrappers - */ -int memcmp_const_time(const void *s1, const void *s2, size_t n) { - - return memcmp(s1, s2, n); - -} - -bool strcsequal(const void *s1, const void *s2) { - - if (s1 == s2) { return true; } - if (!s1 || !s2) { return false; } - return (strcmp(s1, s2) == 0); - -} - -/* bcmp/memcmp BSD flavors, similar to CRYPTO_memcmp */ - -int timingsafe_bcmp(const void *mem1, const void *mem2, size_t len) { - - return bcmp(mem1, mem2, len); - -} - -int timingsafe_memcmp(const void *mem1, const void *mem2, size_t len) { - - return memcmp(mem1, mem2, len); - -} - -/* Init code to open the output file (or default to stderr). */ - -__attribute__((constructor)) void __tokencap_init(void) { - - u8 *fn = getenv("AFL_TOKEN_FILE"); - if (fn) __tokencap_out_file = open(fn, O_RDWR | O_CREAT | O_APPEND, 0655); - if (__tokencap_out_file == -1) __tokencap_out_file = STDERR_FILENO; - __tokencap_pid = getpid(); - -#ifdef RTLD_NEXT - __libc_strcmp = dlsym(RTLD_NEXT, "strcmp"); - __libc_strncmp = dlsym(RTLD_NEXT, "strncmp"); - __libc_strcasecmp = dlsym(RTLD_NEXT, "strcasecmp"); - __libc_strncasecmp = dlsym(RTLD_NEXT, "strncasecmp"); - __libc_memcmp = dlsym(RTLD_NEXT, "memcmp"); - __libc_bcmp = dlsym(RTLD_NEXT, "bcmp"); - __libc_strstr = dlsym(RTLD_NEXT, "strstr"); - __libc_strcasestr = dlsym(RTLD_NEXT, "strcasestr"); - __libc_memmem = dlsym(RTLD_NEXT, "memmem"); -#endif - -} - -/* closing as best as we can the tokens file */ -__attribute__((destructor)) void __tokencap_shutdown(void) { - - if (__tokencap_out_file != STDERR_FILENO) close(__tokencap_out_file); - -} - diff --git a/qbdi_mode/README.md b/qbdi_mode/README.md deleted file mode 100755 index 641a6e85..00000000 --- a/qbdi_mode/README.md +++ /dev/null @@ -1,199 +0,0 @@ -# qbdi-based binary-only instrumentation for afl-fuzz - -## 1) Introduction - -The code in ./qbdi_mode allows you to build a standalone feature that -using the QBDI framework to fuzz android native library. - - -## 2) Build - -First download the Android NDK - -``` -https://developer.android.com/ndk/downloads -https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip -``` - -Then unzip it and build the standalone-toolchain -For x86_64 standalone-toolchain - -``` -unzip android-ndk-r20-linux-x86_64.zip -cd android-ndk-r20/ -./build/tools/make_standalone_toolchain.py --arch x86_64 --api 21 --install-dir ../android-standalone-toolchain-x86_64 -``` - -For x86 standalone-toolchain - -``` -./build/tools/make_standalone_toolchain.py --arch x86 --api 21 --install-dir ../android-standalone-toolchain-x86 -``` - -In alternative you can also use the prebuilt toolchain, in that case make sure to set the proper CC and CXX env variables because there are many different compilers for each API version in the prebuilt toolchain. - -For example: - -``` -export STANDALONE_TOOLCHAIN_PATH=~/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/ -export CC=x86_64-linux-android21-clang -export CXX=x86_64-linux-android21-clang++ -``` - -Then download the QBDI SDK from website - -``` -https://qbdi.quarkslab.com/ -``` - -For Android x86_64 -``` -https://github.com/QBDI/QBDI/releases/download/v0.7.0/QBDI-0.7.0-android-X86_64.tar.gz -``` - -Then decompress the sdk - -``` -mkdir android-qbdi-sdk-x86_64 -cp QBDI-0.7.0-android-X86_64.tar.gz android-qbdi-sdk-x86_64/ -cd android-qbdi-sdk-x86_64/ -tar xvf QBDI-0.7.0-android-X86_64.tar.gz -``` - -Now set the `STANDALONE_TOOLCHAIN_PATH` to the path of standalone-toolchain - -``` -export STANDALONE_TOOLCHAIN_PATH=/home/hac425/workspace/android-standalone-toolchain-x86_64 -``` - -set the `QBDI_SDK_PATH` to the path of QBDI SDK - -``` -export QBDI_SDK_PATH=/home/hac425/workspace/AFLplusplus/qbdi_mode/android-qbdi-sdk-x86_64/ -``` - -Then run the build.sh - -``` -./build.sh x86_64 -``` - -this could build the afl-fuzz and also the qbdi template for android x86_64 - - -### Example - -The demo-so.c is an vulnerable library, it has a function for test - -```c -int target_func(char *buf, int size) { - - printf("buffer:%p, size:%p\n", buf, size); - switch (buf[0]) { - - case 1: - puts("222"); - if (buf[1] == '\x44') { - - puts("null ptr deference"); - *(char *)(0) = 1; - - } - - break; - case 0xff: - if (buf[2] == '\xff') { - - if (buf[1] == '\x44') { - - puts("crash...."); - *(char *)(0xdeadbeef) = 1; - - } - - } - - break; - default: puts("default action"); break; - - } - - return 1; - -} -``` - -This could be build to `libdemo.so`. - -Then we should load the library in template.cpp and find the `target` function address. -```c - void *handle = dlopen(lib_path, RTLD_LAZY); - .......................................... - .......................................... - .......................................... - p_target_func = (target_func)dlsym(handle, "target_func"); -``` - -then we read the data from file and call the function in `fuzz_func` - -```c -QBDI_NOINLINE int fuzz_func() { - - if (afl_setup()) { afl_forkserver(); } - - /* Read the input from file */ - unsigned long len = 0; - char * data = read_file(input_pathname, &len); - - /* Call the target function with the input data */ - p_target_func(data, len); - return 1; - -} -``` - -Just compile it -``` -./build.sh x86_64 -``` - -Then push the `afl-fuzz`, `loader`, `libdemo.so`, the `libQBDI.so` from the QBDI SDK and the `libc++_shared.so` from android-standalone-toolchain to android device - -``` -adb push afl-fuzz /data/local/tmp -adb push libdemo.so /data/local/tmp -adb push loader /data/local/tmp -adb push android-qbdi-sdk-x86_64/usr/local/lib/libQBDI.so /data/local/tmp -adb push ../../android-standalone-toolchain-x86_64/sysroot/usr/lib/x86_64-linux-android/libc++_shared.so -/data/local/tmp -``` - -In android adb shell, run the loader to test if it runs -``` -cd /data/local/tmp -export LD_LIBRARY_PATH=/data/local/tmp -mkdir in -echo 0000 > in/1 -./loader libdemo.so in/1 -p_target_func:0x716d96a98600 - offset:0x600 - offset:0x580 -buffer:0x716d96609050, size:0x5 - offset:0x628 - offset:0x646 - offset:0x64b - offset:0x65c - offset:0x6df - offset:0x590 -default action - offset:0x6eb -``` - -Now run `afl-fuzz` to fuzz the demo library - -``` -./afl-fuzz -i in -o out -- ./loader /data/local/tmp/libdemo.so @@ -``` - -![screen1](assets/screen1.png) - diff --git a/qbdi_mode/assets/screen1.png b/qbdi_mode/assets/screen1.png deleted file mode 100644 index 3cf1cb76..00000000 Binary files a/qbdi_mode/assets/screen1.png and /dev/null differ diff --git a/qbdi_mode/build.sh b/qbdi_mode/build.sh deleted file mode 100755 index b10971d9..00000000 --- a/qbdi_mode/build.sh +++ /dev/null @@ -1,57 +0,0 @@ - -if [ -z ${STANDALONE_TOOLCHAIN_PATH} ]; then - echo "please set the android-standalone-toolchain path in STANDALONE_TOOLCHAIN_PATH environmental variable" - echo "for example: " - echo " export STANDALONE_TOOLCHAIN_PATH=/home/android-standalone-toolchain-21/" - exit -fi - -if [ -z ${QBDI_SDK_PATH} ]; then - echo "please set the qbdi sdk path in QBDI_SDK_PATH environmental variable" - echo "for example: " - echo " export QBDI_SDK_PATH=/home/QBDI-Android/" - exit -fi - - - -if [ "$1" = "x86" ]; then - echo "build x86 qbdi" - compiler_prefix="${STANDALONE_TOOLCHAIN_PATH}/bin/" - if [ -z ${CC} ]; then - export CC=i686-linux-android-gcc - fi - if [ -z ${CXX} ]; then - export CXX=i686-linux-android-g++ - fi -elif [ "$1" = "x86_64" ]; then - echo "build x86_64 qbdi" - compiler_prefix="${STANDALONE_TOOLCHAIN_PATH}/bin/" - if [ -z ${CC} ]; then - export CC=x86_64-linux-android-gcc - fi - if [ -z ${CXX} ]; then - export CXX=x86_64-linux-android-g++ - fi -else - echo "usage: ./build.sh arch[x86, x86_64]" - exit -fi - - -CFLAGS="-I${QBDI_SDK_PATH}/usr/local/include/ -L${QBDI_SDK_PATH}/usr/local/lib/" - -echo "[+] Building the QBDI template" -# build the qbdi template -${compiler_prefix}${CXX} -o loader template.cpp -lQBDI -ldl -w -g ${CFLAGS} - -echo "[+] Building the demo library" -# build the demo share library -${compiler_prefix}${CC} -shared -o libdemo.so demo-so.c -w -g - -echo "[+] Building afl-fuzz for Android" -# build afl-fuzz -cd .. -${compiler_prefix}${CC} -DANDROID_DISABLE_FANCY=1 -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -Wno-unused-function src/afl-fuzz-*.c src/afl-fuzz.c src/afl-common.c src/afl-sharedmem.c src/afl-forkserver.c -o qbdi_mode/afl-fuzz -ldl -w - -echo "[+] All done. Enjoy!" diff --git a/qbdi_mode/demo-so.c b/qbdi_mode/demo-so.c deleted file mode 100755 index dd367036..00000000 --- a/qbdi_mode/demo-so.c +++ /dev/null @@ -1,41 +0,0 @@ -#include - -// gcc -shared -o libdemo.so demo-so.c -w -int target_func(char *buf, int size) { - - printf("buffer:%p, size:%p\n", buf, size); - switch (buf[0]) { - - case 1: - puts("222"); - if (buf[1] == '\x44') { - - puts("null ptr deference"); - *(char *)(0) = 1; - - } - - break; - case 0xff: - if (buf[2] == '\xff') { - - if (buf[1] == '\x44') { - - puts("crash...."); - *(char *)(0xdeadbeef) = 1; - - } - - } - - break; - default: - puts("default action"); - break; - - } - - return 1; - -} - diff --git a/qbdi_mode/template.cpp b/qbdi_mode/template.cpp deleted file mode 100755 index b2066cc8..00000000 --- a/qbdi_mode/template.cpp +++ /dev/null @@ -1,251 +0,0 @@ -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __ANDROID__ - #include "../include/android-ashmem.h" -#endif - -#include -#include -#include "../config.h" - -#include - -/* NeverZero */ - -#if (defined(__x86_64__) || defined(__i386__)) && defined(AFL_QEMU_NOT_ZERO) - #define INC_AFL_AREA(loc) \ - asm volatile( \ - "incb (%0, %1, 1)\n" \ - "adcb $0, (%0, %1, 1)\n" \ - : /* no out */ \ - : "r"(afl_area_ptr), "r"(loc) \ - : "memory", "eax") -#else - #define INC_AFL_AREA(loc) afl_area_ptr[loc]++ -#endif - -using namespace QBDI; - -typedef int (*target_func)(char *buf, int size); - -static const size_t STACK_SIZE = 0x100000; // 1MB -static const QBDI::rword FAKE_RET_ADDR = 0x40000; -target_func p_target_func = NULL; -rword module_base = 0; -rword module_end = 0; -static unsigned char - dummy[MAP_SIZE]; /* costs MAP_SIZE but saves a few instructions */ -unsigned char *afl_area_ptr = NULL; /* Exported for afl_gen_trace */ - -unsigned long afl_prev_loc = 0; - -char input_pathname[PATH_MAX]; - -/* Set up SHM region and initialize other stuff. */ - -int afl_setup(void) { - - char *id_str = getenv(SHM_ENV_VAR); - int shm_id; - if (id_str) { - - shm_id = atoi(id_str); - afl_area_ptr = (unsigned char *)shmat(shm_id, NULL, 0); - if (afl_area_ptr == (void *)-1) return 0; - memset(afl_area_ptr, 0, MAP_SIZE); - - } - - return 1; - -} - -/* Fork server logic, invoked once we hit _start. */ -static void afl_forkserver() { - - static unsigned char tmp[4]; - pid_t child_pid; - - if (write(FORKSRV_FD + 1, tmp, 4) != 4) return; - - while (1) { - - int status; - u32 was_killed; - // wait for afl-fuzz - if (read(FORKSRV_FD, &was_killed, 4) != 4) exit(2); - - child_pid = fork(); - if (child_pid < 0) exit(4); - - if (!child_pid) { - - // child return to execute code - close(FORKSRV_FD); - close(FORKSRV_FD + 1); - return; - - } - - // write child pid to afl-fuzz - if (write(FORKSRV_FD + 1, &child_pid, 4) != 4) exit(5); - - // wait child stop - if (waitpid(child_pid, &status, 0) < 0) exit(6); - - // send child stop status to afl-fuzz - if (write(FORKSRV_FD + 1, &status, 4) != 4) exit(7); - - } - -} - -void afl_maybe_log(unsigned long cur_loc) { - - if (afl_area_ptr == NULL) { return; } - unsigned long afl_idx = cur_loc ^ afl_prev_loc; - afl_idx &= MAP_SIZE - 1; - INC_AFL_AREA(afl_idx); - afl_prev_loc = cur_loc >> 1; - -} - -char *read_file(char *path, unsigned long *length) { - - unsigned long len; - char * buf; - - FILE *fp = fopen(path, "rb"); - fseek(fp, 0, SEEK_END); - len = ftell(fp); - buf = (char *)malloc(len); - rewind(fp); - fread(buf, 1, len, fp); - fclose(fp); - *length = len; - return buf; - -} - -QBDI_NOINLINE int fuzz_func() { - - if (afl_setup()) { afl_forkserver(); } - - unsigned long len = 0; - char * data = read_file(input_pathname, &len); - - // printf("In fuzz_func\n"); - p_target_func(data, len); - return 1; - -} - -static QBDI::VMAction bbcallback(QBDI::VMInstanceRef vm, - const QBDI::VMState *state, - QBDI::GPRState * gprState, - QBDI::FPRState *fprState, void *data) { - - // errno = SAVED_ERRNO; - -#ifdef __x86_64__ - unsigned long pc = gprState->rip; -#elif defined(i386) - unsigned long pc = gprState->eip; -#elif defined(__arm__) - unsigned long pc = gprState->pc; -#endif - - // just log the module path - if (pc >= module_base && pc <= module_end) { - - unsigned long offset = pc - module_base; - printf("\toffset:%p\n", offset); - afl_maybe_log(offset); - - } - - return QBDI::VMAction::CONTINUE; - -} - -int main(int argc, char **argv) { - - if (argc < 3) { - - puts("usage: ./loader library_path input_file_path"); - exit(0); - - } - - const char *lib_path; - lib_path = argv[1]; - strcpy(input_pathname, argv[2]); - void *handle = dlopen(lib_path, RTLD_LAZY); - - if (handle == nullptr) { - - perror("Cannot load library"); - exit(EXIT_FAILURE); - - } - - const char *lib_name = lib_path; - if (strrchr(lib_name, '/') != nullptr) lib_name = strrchr(lib_name, '/') + 1; - - // printf("library name:%s\n", lib_name); - // load library module address for log path - for (MemoryMap &map : getCurrentProcessMaps()) { - - // printf("module:%s\n", map.name.c_str()); - if ((map.permission & PF_EXEC) && - strstr(map.name.c_str(), lib_name) != NULL) { - - module_base = map.range.start; - module_end = map.range.end; - - } - - } - - if (module_base == 0) { - - std::cerr << "Fail to find base address" << std::endl; - return -1; - - } - - // printf("module base:%p, module end:%p\n", module_base, module_end); - p_target_func = (target_func)dlsym(handle, "target_func"); - // p_target_func = (target_func)(module_base + 0x61a); - printf("p_target_func:%p\n", p_target_func); - - VM vm; - uint8_t *fakestack = nullptr; - - GPRState *state = vm.getGPRState(); - allocateVirtualStack(state, STACK_SIZE, &fakestack); - vm.addInstrumentedModuleFromAddr(module_base); - vm.addInstrumentedModuleFromAddr((rword)&main); - - vm.addVMEventCB(BASIC_BLOCK_ENTRY, bbcallback, nullptr); - - // QBDI::simulateCall(state, FAKE_RET_ADDR); - // vm.run((rword)&fuzz_func, (rword)FAKE_RET_ADDR); - - rword ret; - vm.call(&ret, (rword)&fuzz_func, {}); - - return 0; - -} - diff --git a/utils/libdislocator/Makefile b/utils/libdislocator/Makefile new file mode 100644 index 00000000..2942c3c3 --- /dev/null +++ b/utils/libdislocator/Makefile @@ -0,0 +1,43 @@ +# +# american fuzzy lop++ - libdislocator +# ---------------------------------- +# +# Originally written by Michal Zalewski +# +# Copyright 2016 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# + +PREFIX ?= /usr/local +HELPER_PATH = $(PREFIX)/lib/afl + +VERSION = $(shell grep '^\#define VERSION ' ../../config.h | cut -d '"' -f2) + +CFLAGS ?= -O3 -funroll-loops -D_FORTIFY_SOURCE=2 +CFLAGS += -I ../../include/ -Wall -g -Wno-pointer-sign + +CFLAGS_ADD=$(USEHUGEPAGE:1=-DUSEHUGEPAGE) +CFLAGS += $(CFLAGS_ADD) + +all: libdislocator.so + +libdislocator.so: libdislocator.so.c ../../config.h + $(CC) $(CFLAGS) $(CPPFLAGS) -shared -fPIC libdislocator.so.c -o $@ $(LDFLAGS) + cp -fv libdislocator.so ../../ + +.NOTPARALLEL: clean + +clean: + rm -f *.o *.so *~ a.out core core.[1-9][0-9]* + rm -f ../../libdislocator.so + +install: all + install -m 755 -d $${DESTDIR}$(HELPER_PATH) + install -m 755 ../../libdislocator.so $${DESTDIR}$(HELPER_PATH) + install -m 644 -T README.md $${DESTDIR}$(HELPER_PATH)/README.dislocator.md + diff --git a/utils/libdislocator/README.md b/utils/libdislocator/README.md new file mode 100644 index 00000000..1785463e --- /dev/null +++ b/utils/libdislocator/README.md @@ -0,0 +1,68 @@ +# libdislocator, an abusive allocator + + (See ../README.md for the general instruction manual.) + +This is a companion library that can be used as a drop-in replacement for the +libc allocator in the fuzzed binaries. It improves the odds of bumping into +heap-related security bugs in several ways: + + - It allocates all buffers so that they are immediately adjacent to a + subsequent PROT_NONE page, causing most off-by-one reads and writes to + immediately segfault, + + - It adds a canary immediately below the allocated buffer, to catch writes + to negative offsets (won't catch reads, though), + + - It sets the memory returned by malloc() to garbage values, improving the + odds of crashing when the target accesses uninitialized data, + + - It sets freed memory to PROT_NONE and does not actually reuse it, causing + most use-after-free bugs to segfault right away, + + - It forces all realloc() calls to return a new address - and sets + PROT_NONE on the original block. This catches use-after-realloc bugs, + + - It checks for calloc() overflows and can cause soft or hard failures + of alloc requests past a configurable memory limit (AFL_LD_LIMIT_MB, + AFL_LD_HARD_FAIL). + + - Optionally, in platforms supporting it, huge pages can be used by passing + USEHUGEPAGE=1 to make. + + - Size alignment to `max_align_t` can be enforced with AFL_ALIGNED_ALLOC=1. + In this case, a tail canary is inserted in the padding bytes at the end + of the allocated zone. This reduce the ability of libdislocator to detect + off-by-one bugs but also it make slibdislocator compliant to the C standard. + +Basically, it is inspired by some of the non-default options available for the +OpenBSD allocator - see malloc.conf(5) on that platform for reference. It is +also somewhat similar to several other debugging libraries, such as gmalloc +and DUMA - but is simple, plug-and-play, and designed specifically for fuzzing +jobs. + +Note that it does nothing for stack-based memory handling errors. The +-fstack-protector-all setting for GCC / clang, enabled when using AFL_HARDEN, +can catch some subset of that. + +The allocator is slow and memory-intensive (even the tiniest allocation uses up +4 kB of physical memory and 8 kB of virtual mem), making it completely unsuitable +for "production" uses; but it can be faster and more hassle-free than ASAN / MSAN +when fuzzing small, self-contained binaries. + +To use this library, run AFL like so: + +``` +AFL_PRELOAD=/path/to/libdislocator.so ./afl-fuzz [...other params...] +``` + +You *have* to specify path, even if it's just ./libdislocator.so or +$PWD/libdislocator.so. + +Similarly to afl-tmin, the library is not "proprietary" and can be used with +other fuzzers or testing tools without the need for any code tweaks. It does not +require AFL-instrumented binaries to work. + +Note that the AFL_PRELOAD approach (which AFL internally maps to LD_PRELOAD or +DYLD_INSERT_LIBRARIES, depending on the OS) works only if the target binary is +dynamically linked. Otherwise, attempting to use the library will have no +effect. diff --git a/utils/libdislocator/libdislocator.so.c b/utils/libdislocator/libdislocator.so.c new file mode 100644 index 00000000..2324e390 --- /dev/null +++ b/utils/libdislocator/libdislocator.so.c @@ -0,0 +1,544 @@ +/* + + american fuzzy lop++ - dislocator, an abusive allocator + ----------------------------------------------------- + + Originally written by Michal Zalewski + + Copyright 2016 Google Inc. All rights reserved. + Copyright 2019-2020 AFLplusplus Project. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + This is a companion library that can be used as a drop-in replacement + for the libc allocator in the fuzzed binaries. See README.dislocator.md for + more info. + + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include + +#ifdef __APPLE__ + #include +#endif + +#ifdef __FreeBSD__ + #include +#endif + +#if (defined(__linux__) && !defined(__ANDROID__)) || defined(__HAIKU__) + #include + #ifdef __linux__ + #include + #include + #endif + #ifdef __NR_getrandom + #define arc4random_buf(p, l) \ + do { \ + \ + ssize_t rd = syscall(__NR_getrandom, p, l, 0); \ + if (rd != l) DEBUGF("getrandom failed"); \ + \ + } while (0) + + #else + #include + #define arc4random_buf(p, l) \ + do { \ + \ + srand(time(NULL)); \ + u32 i; \ + u8 *ptr = (u8 *)p; \ + for (i = 0; i < l; i++) \ + ptr[i] = rand() % INT_MAX; \ + \ + } while (0) + + #endif +#endif + +#include "config.h" +#include "types.h" + +#if __STDC_VERSION__ < 201112L || \ + (defined(__FreeBSD__) && __FreeBSD_version < 1200000) +// use this hack if not C11 +typedef struct { + + long long __ll; + long double __ld; + +} max_align_t; + +#endif + +#define ALLOC_ALIGN_SIZE (_Alignof(max_align_t)) + +#ifndef PAGE_SIZE + #define PAGE_SIZE 4096 +#endif /* !PAGE_SIZE */ + +#ifndef MAP_ANONYMOUS + #define MAP_ANONYMOUS MAP_ANON +#endif /* !MAP_ANONYMOUS */ + +#define SUPER_PAGE_SIZE 1 << 21 + +/* Error / message handling: */ + +#define DEBUGF(_x...) \ + do { \ + \ + if (alloc_verbose) { \ + \ + if (++call_depth == 1) { \ + \ + fprintf(stderr, "[AFL] " _x); \ + fprintf(stderr, "\n"); \ + \ + } \ + call_depth--; \ + \ + } \ + \ + } while (0) + +#define FATAL(_x...) \ + do { \ + \ + if (++call_depth == 1) { \ + \ + fprintf(stderr, "*** [AFL] " _x); \ + fprintf(stderr, " ***\n"); \ + abort(); \ + \ + } \ + call_depth--; \ + \ + } while (0) + +/* Macro to count the number of pages needed to store a buffer: */ + +#define PG_COUNT(_l) (((_l) + (PAGE_SIZE - 1)) / PAGE_SIZE) + +/* Canary & clobber bytes: */ + +#define ALLOC_CANARY 0xAACCAACC +#define ALLOC_CLOBBER 0xCC + +#define TAIL_ALLOC_CANARY 0xAC + +#define PTR_C(_p) (((u32 *)(_p))[-1]) +#define PTR_L(_p) (((u32 *)(_p))[-2]) + +/* Configurable stuff (use AFL_LD_* to set): */ + +static u32 max_mem = MAX_ALLOC; /* Max heap usage to permit */ +static u8 alloc_verbose, /* Additional debug messages */ + hard_fail, /* abort() when max_mem exceeded? */ + no_calloc_over, /* abort() on calloc() overflows? */ + align_allocations; /* Force alignment to sizeof(void*) */ + +#if defined __OpenBSD__ || defined __APPLE__ + #define __thread + #warning no thread support available +#endif +static __thread size_t total_mem; /* Currently allocated mem */ + +static __thread u32 call_depth; /* To avoid recursion via fprintf() */ +static u32 alloc_canary; + +/* This is the main alloc function. It allocates one page more than necessary, + sets that tailing page to PROT_NONE, and then increments the return address + so that it is right-aligned to that boundary. Since it always uses mmap(), + the returned memory will be zeroed. */ + +static void *__dislocator_alloc(size_t len) { + + u8 * ret, *base; + size_t tlen; + int flags, fd, sp; + + if (total_mem + len > max_mem || total_mem + len < total_mem) { + + if (hard_fail) FATAL("total allocs exceed %u MB", max_mem / 1024 / 1024); + + DEBUGF("total allocs exceed %u MB, returning NULL", max_mem / 1024 / 1024); + + return NULL; + + } + + size_t rlen; + if (align_allocations && (len & (ALLOC_ALIGN_SIZE - 1))) + rlen = (len & ~(ALLOC_ALIGN_SIZE - 1)) + ALLOC_ALIGN_SIZE; + else + rlen = len; + + /* We will also store buffer length and a canary below the actual buffer, so + let's add 8 bytes for that. */ + + base = NULL; + tlen = (1 + PG_COUNT(rlen + 8)) * PAGE_SIZE; + flags = MAP_PRIVATE | MAP_ANONYMOUS; + fd = -1; +#if defined(USEHUGEPAGE) + sp = (rlen >= SUPER_PAGE_SIZE && !(rlen % SUPER_PAGE_SIZE)); + + #if defined(__APPLE__) + if (sp) fd = VM_FLAGS_SUPERPAGE_SIZE_2MB; + #elif defined(__linux__) + if (sp) flags |= MAP_HUGETLB; + #elif defined(__FreeBSD__) + if (sp) flags |= MAP_ALIGNED_SUPER; + #elif defined(__sun) + if (sp) { + + base = (void *)(caddr_t)(1 << 21); + flags |= MAP_ALIGN; + + } + + #endif +#else + (void)sp; +#endif + + ret = (u8 *)mmap(base, tlen, PROT_READ | PROT_WRITE, flags, fd, 0); +#if defined(USEHUGEPAGE) + /* We try one more time with regular call */ + if (ret == MAP_FAILED) { + + #if defined(__APPLE__) + fd = -1; + #elif defined(__linux__) + flags &= -MAP_HUGETLB; + #elif defined(__FreeBSD__) + flags &= -MAP_ALIGNED_SUPER; + #elif defined(__sun) + flags &= -MAP_ALIGN; + #endif + ret = (u8 *)mmap(NULL, tlen, PROT_READ | PROT_WRITE, flags, fd, 0); + + } + +#endif + + if (ret == MAP_FAILED) { + + if (hard_fail) FATAL("mmap() failed on alloc (OOM?)"); + + DEBUGF("mmap() failed on alloc (OOM?)"); + + return NULL; + + } + + /* Set PROT_NONE on the last page. */ + + if (mprotect(ret + PG_COUNT(rlen + 8) * PAGE_SIZE, PAGE_SIZE, PROT_NONE)) + FATAL("mprotect() failed when allocating memory"); + + /* Offset the return pointer so that it's right-aligned to the page + boundary. */ + + ret += PAGE_SIZE * PG_COUNT(rlen + 8) - rlen - 8; + + /* Store allocation metadata. */ + + ret += 8; + + PTR_L(ret) = len; + PTR_C(ret) = alloc_canary; + + total_mem += len; + + if (rlen != len) { + + size_t i; + for (i = len; i < rlen; ++i) + ret[i] = TAIL_ALLOC_CANARY; + + } + + return ret; + +} + +/* The "user-facing" wrapper for calloc(). This just checks for overflows and + displays debug messages if requested. */ + +void *calloc(size_t elem_len, size_t elem_cnt) { + + void *ret; + + size_t len = elem_len * elem_cnt; + + /* Perform some sanity checks to detect obvious issues... */ + + if (elem_cnt && len / elem_cnt != elem_len) { + + if (no_calloc_over) { + + DEBUGF("calloc(%zu, %zu) would overflow, returning NULL", elem_len, + elem_cnt); + return NULL; + + } + + FATAL("calloc(%zu, %zu) would overflow", elem_len, elem_cnt); + + } + + ret = __dislocator_alloc(len); + + DEBUGF("calloc(%zu, %zu) = %p [%zu total]", elem_len, elem_cnt, ret, + total_mem); + + return ret; + +} + +/* The wrapper for malloc(). Roughly the same, also clobbers the returned + memory (unlike calloc(), malloc() is not guaranteed to return zeroed + memory). */ + +void *malloc(size_t len) { + + void *ret; + + ret = __dislocator_alloc(len); + + DEBUGF("malloc(%zu) = %p [%zu total]", len, ret, total_mem); + + if (ret && len) memset(ret, ALLOC_CLOBBER, len); + + return ret; + +} + +/* The wrapper for free(). This simply marks the entire region as PROT_NONE. + If the region is already freed, the code will segfault during the attempt to + read the canary. Not very graceful, but works, right? */ + +void free(void *ptr) { + + u32 len; + + DEBUGF("free(%p)", ptr); + + if (!ptr) return; + + if (PTR_C(ptr) != alloc_canary) FATAL("bad allocator canary on free()"); + + len = PTR_L(ptr); + + total_mem -= len; + + if (align_allocations && (len & (ALLOC_ALIGN_SIZE - 1))) { + + u8 * ptr_ = ptr; + size_t rlen = (len & ~(ALLOC_ALIGN_SIZE - 1)) + ALLOC_ALIGN_SIZE; + for (; len < rlen; ++len) + if (ptr_[len] != TAIL_ALLOC_CANARY) + FATAL("bad tail allocator canary on free()"); + + } + + /* Protect everything. Note that the extra page at the end is already + set as PROT_NONE, so we don't need to touch that. */ + + ptr -= PAGE_SIZE * PG_COUNT(len + 8) - len - 8; + + if (mprotect(ptr - 8, PG_COUNT(len + 8) * PAGE_SIZE, PROT_NONE)) + FATAL("mprotect() failed when freeing memory"); + + /* Keep the mapping; this is wasteful, but prevents ptr reuse. */ + +} + +/* Realloc is pretty straightforward, too. We forcibly reallocate the buffer, + move data, and then free (aka mprotect()) the original one. */ + +void *realloc(void *ptr, size_t len) { + + void *ret; + + ret = malloc(len); + + if (ret && ptr) { + + if (PTR_C(ptr) != alloc_canary) FATAL("bad allocator canary on realloc()"); + // Here the tail canary check is delayed to free() + + memcpy(ret, ptr, MIN(len, PTR_L(ptr))); + free(ptr); + + } + + DEBUGF("realloc(%p, %zu) = %p [%zu total]", ptr, len, ret, total_mem); + + return ret; + +} + +/* posix_memalign we mainly check the proper alignment argument + if the requested size fits within the alignment we do + a normal request */ + +int posix_memalign(void **ptr, size_t align, size_t len) { + + // if (*ptr == NULL) return EINVAL; // (andrea) Why? I comment it out for now + if ((align % 2) || (align % sizeof(void *))) return EINVAL; + if (len == 0) { + + *ptr = NULL; + return 0; + + } + + size_t rem = len % align; + if (rem) len += align - rem; + + *ptr = __dislocator_alloc(len); + + if (*ptr && len) memset(*ptr, ALLOC_CLOBBER, len); + + DEBUGF("posix_memalign(%p %zu, %zu) [*ptr = %p]", ptr, align, len, *ptr); + + return 0; + +} + +/* just the non-posix fashion */ + +void *memalign(size_t align, size_t len) { + + void *ret = NULL; + + if (posix_memalign(&ret, align, len)) { + + DEBUGF("memalign(%zu, %zu) failed", align, len); + + } + + return ret; + +} + +/* sort of C11 alias of memalign only more severe, alignment-wise */ + +void *aligned_alloc(size_t align, size_t len) { + + void *ret = NULL; + + if ((len % align)) return NULL; + + if (posix_memalign(&ret, align, len)) { + + DEBUGF("aligned_alloc(%zu, %zu) failed", align, len); + + } + + return ret; + +} + +/* specific BSD api mainly checking possible overflow for the size */ + +void *reallocarray(void *ptr, size_t elem_len, size_t elem_cnt) { + + const size_t elem_lim = 1UL << (sizeof(size_t) * 4); + const size_t elem_tot = elem_len * elem_cnt; + void * ret = NULL; + + if ((elem_len >= elem_lim || elem_cnt >= elem_lim) && elem_len > 0 && + elem_cnt > (SIZE_MAX / elem_len)) { + + DEBUGF("reallocarray size overflow (%zu)", elem_tot); + + } else { + + ret = realloc(ptr, elem_tot); + + } + + return ret; + +} + +#if !defined(__ANDROID__) +size_t malloc_usable_size(void *ptr) { + +#else +size_t malloc_usable_size(const void *ptr) { + +#endif + + return ptr ? PTR_L(ptr) : 0; + +} + +__attribute__((constructor)) void __dislocator_init(void) { + + u8 *tmp = (u8 *)getenv("AFL_LD_LIMIT_MB"); + + if (tmp) { + + u8 *tok; + s32 mmem = (s32)strtol((char *)tmp, (char **)&tok, 10); + if (*tok != '\0' || errno == ERANGE) FATAL("Bad value for AFL_LD_LIMIT_MB"); + max_mem = mmem * 1024 * 1024; + + } + + alloc_canary = ALLOC_CANARY; + tmp = (u8 *)getenv("AFL_RANDOM_ALLOC_CANARY"); + + if (tmp) arc4random_buf(&alloc_canary, sizeof(alloc_canary)); + + alloc_verbose = !!getenv("AFL_LD_VERBOSE"); + hard_fail = !!getenv("AFL_LD_HARD_FAIL"); + no_calloc_over = !!getenv("AFL_LD_NO_CALLOC_OVER"); + align_allocations = !!getenv("AFL_ALIGNED_ALLOC"); + +} + +/* NetBSD fault handler specific api subset */ + +void (*esetfunc(void (*fn)(int, const char *, ...)))(int, const char *, ...) { + + /* Might not be meaningful to implement; upper calls already report errors */ + return NULL; + +} + +void *emalloc(size_t len) { + + return malloc(len); + +} + +void *ecalloc(size_t elem_len, size_t elem_cnt) { + + return calloc(elem_len, elem_cnt); + +} + +void *erealloc(void *ptr, size_t len) { + + return realloc(ptr, len); + +} + diff --git a/utils/libtokencap/Makefile b/utils/libtokencap/Makefile new file mode 100644 index 00000000..8bbdc259 --- /dev/null +++ b/utils/libtokencap/Makefile @@ -0,0 +1,94 @@ +# +# american fuzzy lop++ - libtokencap +# -------------------------------- +# +# Originally written by Michal Zalewski +# +# Copyright 2016 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# + +PREFIX ?= /usr/local +HELPER_PATH = $(PREFIX)/lib/afl +DOC_PATH ?= $(PREFIX)/share/doc/afl +MAN_PATH ?= $(PREFIX)/share/man/man8 + +VERSION = $(shell grep '^\#define VERSION ' ../../config.h | cut -d '"' -f2) + +CFLAGS ?= -O3 -funroll-loops -D_FORTIFY_SOURCE=2 +CFLAGS += -I ../../include/ -Wall -g -Wno-pointer-sign + + +UNAME_S =$(shell uname -s)# GNU make +UNAME_S:sh=uname -s # BSD make +_UNIQ=_QINU_ + + _OS_DL = $(_UNIQ)$(UNAME_S) + __OS_DL = $(_OS_DL:$(_UNIQ)Linux=$(_UNIQ)) + ___OS_DL = $(__OS_DL:$(_UNIQ)Darwin=$(_UNIQ)) + ____OS_DL = $(___OS_DL:$(_UNIQ)$(UNAME_S)=) +_____OS_DL = $(____OS_DL:$(_UNIQ)="-ldl") + + _OS_TARGET = $(___OS_DL:$(_UNIQ)FreeBSD=$(_UNIQ)) + __OS_TARGET = $(_OS_TARGET:$(_UNIQ)OpenBSD=$(_UNIQ)) + ___OS_TARGET = $(__OS_TARGET:$(_UNIQ)NetBSD=$(_UNIQ)) + ____OS_TARGET = $(___OS_TARGET:$(_UNIQ)Haiku=$(_UNIQ)) + _____OS_TARGET = $(____OS_TARGET:$(_UNIQ)SunOS=$(_UNIQ)) +______OS_TARGET = $(_____OS_TARGET:$(_UNIQ)$(UNAME_S)=) + +TARGETS = $(______OS_TARGET:$(_UNIQ)=libtokencap.so) + +LDFLAGS += $(_____OS_DL) + +#ifeq "$(shell uname)" "Linux" +# TARGETS = libtokencap.so +# LDFLAGS += -ldl +#endif +#ifeq "$(shell uname)" "Darwin" +# TARGETS = libtokencap.so +# LDFLAGS += -ldl +#endif +#ifeq "$(shell uname)" "FreeBSD" +# TARGETS = libtokencap.so +#endif +#ifeq "$(shell uname)" "OpenBSD" +# TARGETS = libtokencap.so +#endif +#ifeq "$(shell uname)" "NetBSD" +# TARGETS = libtokencap.so +#endif +#ifeq "$(shell uname)" "DragonFly" +# TARGETS = libtokencap.so +# LDFLAGS += -ldl +#endif +all: $(TARGETS) + +libtokencap.so: libtokencap.so.c ../../config.h + $(CC) $(CFLAGS) $(CPPFLAGS) -shared -fPIC $< -o $@ $(LDFLAGS) + cp -f libtokencap.so ../../ + +.NOTPARALLEL: clean + +debug: + @echo $(UNAME_S)$(_UNIQ) | hexdump -C + @echo from $(____OS_DL) : $(_UNIQ)$(UNAME_S) = -\> $(_____OS_DL) + @echo from $(_____OS_DL) : $(_UNIQ) = -ldl -\> $(______OS_DL) + @echo from $(____OS_DL) : $(_UNIQ)FreeBSD = $(_UNIQ) -\> $(_OS_TARGET) + @echo from $(_OS_TARGET) : $(_UNIQ)OpenBSD = $(_UNIQ) -\> $(__OS_TARGET) + @echo from $(__OS_TARGET) : $(_UNIQ)NetBSD = $(_UNIQ) -\> $(___OS_TARGET) + @echo from $(___OS_TARGET) : $(_UNIQ)$(_UNIQ) = -\> $(____OS_TARGET) + @echo from $(____OS_TARGET) : $(_UNIQ) = libtokencap.so -\> $(TARGETS) + +clean: + rm -f *.o *.so *~ a.out core core.[1-9][0-9]* + rm -fv ../../libtokencap.so + +install: all + install -m 755 -d $${DESTDIR}$(HELPER_PATH) + install -m 755 ../../libtokencap.so $${DESTDIR}$(HELPER_PATH) + install -m 644 -T README.md $${DESTDIR}$(DOC_PATH)/README.tokencap.md diff --git a/utils/libtokencap/README.md b/utils/libtokencap/README.md new file mode 100644 index 00000000..13a440da --- /dev/null +++ b/utils/libtokencap/README.md @@ -0,0 +1,64 @@ +# strcmp() / memcmp() token capture library + + (See ../README.md for the general instruction manual.) + +This companion library allows you to instrument `strcmp()`, `memcmp()`, +and related functions to automatically extract syntax tokens passed to any of +these libcalls. The resulting list of tokens may be then given as a starting +dictionary to afl-fuzz (the -x option) to improve coverage on subsequent +fuzzing runs. + +This may help improving coverage in some targets, and do precisely nothing in +others. In some cases, it may even make things worse: if libtokencap picks up +syntax tokens that are not used to process the input data, but that are a part +of - say - parsing a config file... well, you're going to end up wasting a lot +of CPU time on trying them out in the input stream. In other words, use this +feature with care. Manually screening the resulting dictionary is almost +always a necessity. + +As for the actual operation: the library stores tokens, without any deduping, +by appending them to a file specified via AFL_TOKEN_FILE. If the variable is not +set, the tool uses stderr (which is probably not what you want). + +Similarly to afl-tmin, the library is not "proprietary" and can be used with +other fuzzers or testing tools without the need for any code tweaks. It does not +require AFL-instrumented binaries to work. + +To use the library, you *need* to make sure that your fuzzing target is compiled +with -fno-builtin and is linked dynamically. If you wish to automate the first +part without mucking with CFLAGS in Makefiles, you can set AFL_NO_BUILTIN=1 +when using afl-gcc. This setting specifically adds the following flags: + +``` + -fno-builtin-strcmp -fno-builtin-strncmp -fno-builtin-strcasecmp + -fno-builtin-strcasencmp -fno-builtin-memcmp -fno-builtin-strstr + -fno-builtin-strcasestr +``` + +The next step is simply loading this library via LD_PRELOAD. The optimal usage +pattern is to allow afl-fuzz to fuzz normally for a while and build up a corpus, +and then fire off the target binary, with libtokencap.so loaded, on every file +found by AFL in that earlier run. This demonstrates the basic principle: + +``` + export AFL_TOKEN_FILE=$PWD/temp_output.txt + + for i in /queue/id*; do + LD_PRELOAD=/path/to/libtokencap.so \ + /path/to/target/program [...params, including $i...] + done + + sort -u temp_output.txt >afl_dictionary.txt +``` + +If you don't get any results, the target library is probably not using strcmp() +and memcmp() to parse input; or you haven't compiled it with -fno-builtin; or +the whole thing isn't dynamically linked, and LD_PRELOAD is having no effect. + +Portability hints: There is probably no particularly portable and non-invasive +way to distinguish between read-only and read-write memory mappings. +The `__tokencap_load_mappings()` function is the only thing that would +need to be changed for other OSes. + +Current supported OSes are: Linux, Darwin, FreeBSD (thanks to @devnexen) + diff --git a/utils/libtokencap/libtokencap.so.c b/utils/libtokencap/libtokencap.so.c new file mode 100644 index 00000000..3629e804 --- /dev/null +++ b/utils/libtokencap/libtokencap.so.c @@ -0,0 +1,794 @@ +/* + + american fuzzy lop++ - extract tokens passed to strcmp / memcmp + ------------------------------------------------------------- + + Originally written by Michal Zalewski + + Copyright 2016 Google Inc. All rights reserved. + Copyright 2019-2020 AFLplusplus Project. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + This Linux-only companion library allows you to instrument strcmp(), + memcmp(), and related functions to automatically extract tokens. + See README.tokencap.md for more info. + + */ + +#ifndef _GNU_SOURCE + #define _GNU_SOURCE +#endif +#include +#include +#include +#include +#include +#include + +#include "../types.h" +#include "../config.h" + +#if !defined __linux__ && !defined __APPLE__ && !defined __FreeBSD__ && \ + !defined __OpenBSD__ && !defined __NetBSD__ && !defined __DragonFly__ && \ + !defined(__HAIKU__) && !defined(__sun) + #error "Sorry, this library is unsupported in this platform for now!" +#endif /* !__linux__ && !__APPLE__ && ! __FreeBSD__ && ! __OpenBSD__ && \ + !__NetBSD__*/ + +#if defined __APPLE__ + #include + #include +#elif defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ + #include + #include + #if !defined __NetBSD__ + #include + #endif + #include +#elif defined __HAIKU__ + #include +#elif defined __sun + /* For map addresses the old struct is enough */ + #include + #include +#endif + +#include + +#ifdef RTLD_NEXT +/* The libc functions are a magnitude faster than our replacements. + Use them when RTLD_NEXT is available. */ +int (*__libc_strcmp)(const char *str1, const char *str2); +int (*__libc_strncmp)(const char *str1, const char *str2, size_t len); +int (*__libc_strcasecmp)(const char *str1, const char *str2); +int (*__libc_strncasecmp)(const char *str1, const char *str2, size_t len); +int (*__libc_memcmp)(const void *mem1, const void *mem2, size_t len); +int (*__libc_bcmp)(const void *mem1, const void *mem2, size_t len); +char *(*__libc_strstr)(const char *haystack, const char *needle); +char *(*__libc_strcasestr)(const char *haystack, const char *needle); +void *(*__libc_memmem)(const void *haystack, size_t haystack_len, + const void *needle, size_t needle_len); +#endif + +/* Mapping data and such */ + +#define MAX_MAPPINGS 1024 + +static struct mapping { void *st, *en; } __tokencap_ro[MAX_MAPPINGS]; + +static u32 __tokencap_ro_cnt; +static u8 __tokencap_ro_loaded; +static int __tokencap_out_file = -1; +static pid_t __tokencap_pid = -1; + +/* Identify read-only regions in memory. Only parameters that fall into these + ranges are worth dumping when passed to strcmp() and so on. Read-write + regions are far more likely to contain user input instead. */ + +static void __tokencap_load_mappings(void) { + +#if defined __linux__ + + u8 buf[MAX_LINE]; + FILE *f = fopen("/proc/self/maps", "r"); + + __tokencap_ro_loaded = 1; + + if (!f) return; + + while (fgets(buf, MAX_LINE, f)) { + + u8 rf, wf; + void *st, *en; + + if (sscanf(buf, "%p-%p %c%c", &st, &en, &rf, &wf) != 4) continue; + if (wf == 'w' || rf != 'r') continue; + + __tokencap_ro[__tokencap_ro_cnt].st = (void *)st; + __tokencap_ro[__tokencap_ro_cnt].en = (void *)en; + + if (++__tokencap_ro_cnt == MAX_MAPPINGS) break; + + } + + fclose(f); + +#elif defined __APPLE__ + + struct vm_region_submap_info_64 region; + mach_msg_type_number_t cnt = VM_REGION_SUBMAP_INFO_COUNT_64; + vm_address_t base = 0; + vm_size_t size = 0; + natural_t depth = 0; + + __tokencap_ro_loaded = 1; + + while (1) { + + if (vm_region_recurse_64(mach_task_self(), &base, &size, &depth, + (vm_region_info_64_t)®ion, + &cnt) != KERN_SUCCESS) + break; + + if (region.is_submap) { + + depth++; + + } else { + + /* We only care of main map addresses and the read only kinds */ + if ((region.protection & VM_PROT_READ) && + !(region.protection & VM_PROT_WRITE)) { + + __tokencap_ro[__tokencap_ro_cnt].st = (void *)base; + __tokencap_ro[__tokencap_ro_cnt].en = (void *)(base + size); + + if (++__tokencap_ro_cnt == MAX_MAPPINGS) break; + + } + + base += size; + size = 0; + + } + + } + +#elif defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ + + #if defined __FreeBSD__ + int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, __tokencap_pid}; + #elif defined __OpenBSD__ + int mib[] = {CTL_KERN, KERN_PROC_VMMAP, __tokencap_pid}; + #elif defined __NetBSD__ + int mib[] = {CTL_VM, VM_PROC, VM_PROC_MAP, __tokencap_pid, + sizeof(struct kinfo_vmentry)}; + #endif + char * buf, *low, *high; + size_t miblen = sizeof(mib) / sizeof(mib[0]); + size_t len; + + if (sysctl(mib, miblen, NULL, &len, NULL, 0) == -1) return; + + #if defined __FreeBSD__ || defined __NetBSD__ + len = len * 4 / 3; + #elif defined __OpenBSD__ + len -= len % sizeof(struct kinfo_vmentry); + #endif + + buf = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); + if (buf == MAP_FAILED) return; + + if (sysctl(mib, miblen, buf, &len, NULL, 0) == -1) { + + munmap(buf, len); + return; + + } + + low = buf; + high = low + len; + + __tokencap_ro_loaded = 1; + + while (low < high) { + + struct kinfo_vmentry *region = (struct kinfo_vmentry *)low; + + #if defined __FreeBSD__ || defined __NetBSD__ + + #if defined __FreeBSD__ + size_t size = region->kve_structsize; + + if (size == 0) break; + #elif defined __NetBSD__ + size_t size = sizeof(*region); + #endif + + /* We go through the whole mapping of the process and track read-only + * addresses */ + if ((region->kve_protection & KVME_PROT_READ) && + !(region->kve_protection & KVME_PROT_WRITE)) { + + #elif defined __OpenBSD__ + + size_t size = sizeof(*region); + + /* We go through the whole mapping of the process and track read-only + * addresses */ + if ((region->kve_protection & KVE_PROT_READ) && + !(region->kve_protection & KVE_PROT_WRITE)) { + + #endif + __tokencap_ro[__tokencap_ro_cnt].st = (void *)region->kve_start; + __tokencap_ro[__tokencap_ro_cnt].en = (void *)region->kve_end; + + if (++__tokencap_ro_cnt == MAX_MAPPINGS) break; + + } + + low += size; + + } + + munmap(buf, len); +#elif defined __HAIKU__ + image_info ii; + int32_t group = 0; + + __tokencap_ro_loaded = 1; + + while (get_next_image_info(0, &group, &ii) == B_OK) { + + __tokencap_ro[__tokencap_ro_cnt].st = ii.text; + __tokencap_ro[__tokencap_ro_cnt].en = ((char *)ii.text) + ii.text_size; + + if (++__tokencap_ro_cnt == MAX_MAPPINGS) break; + + } + +#elif defined __sun + prmap_t *c, *map; + char path[PATH_MAX]; + ssize_t r; + size_t hint; + int fd; + + snprintf(path, sizeof(path), "/proc/%ld/map", getpid()); + fd = open(path, O_RDONLY); + hint = (1 << 20); + map = malloc(hint); + + __tokencap_ro_loaded = 1; + + for (; (r = pread(fd, map, hint, 0)) == hint;) { + + hint <<= 1; + map = realloc(map, hint); + + } + + for (c = map; r > 0; c++, r -= sizeof(prmap_t)) { + + __tokencap_ro[__tokencap_ro_cnt].st = (void *)c->pr_vaddr; + __tokencap_ro[__tokencap_ro_cnt].en = (void *)(c->pr_vaddr + c->pr_size); + + if (++__tokencap_ro_cnt == MAX_MAPPINGS) break; + + } + + free(map); + close(fd); +#endif + +} + +/* Check an address against the list of read-only mappings. */ + +static u8 __tokencap_is_ro(const void *ptr) { + + u32 i; + + if (!__tokencap_ro_loaded) __tokencap_load_mappings(); + + for (i = 0; i < __tokencap_ro_cnt; i++) + if (ptr >= __tokencap_ro[i].st && ptr <= __tokencap_ro[i].en) return 1; + + return 0; + +} + +/* Dump an interesting token to output file, quoting and escaping it + properly. */ + +static void __tokencap_dump(const u8 *ptr, size_t len, u8 is_text) { + + u8 buf[MAX_AUTO_EXTRA * 4 + 1]; + u32 i; + u32 pos = 0; + + if (len < MIN_AUTO_EXTRA || len > MAX_AUTO_EXTRA || __tokencap_out_file == -1) + return; + + for (i = 0; i < len; i++) { + + if (is_text && !ptr[i]) break; + + switch (ptr[i]) { + + case 0 ... 31: + case 127 ... 255: + case '\"': + case '\\': + + sprintf(buf + pos, "\\x%02x", ptr[i]); + pos += 4; + break; + + default: + buf[pos++] = ptr[i]; + + } + + } + + buf[pos] = 0; + + int wrt_ok = (1 == write(__tokencap_out_file, "\"", 1)); + wrt_ok &= (pos == write(__tokencap_out_file, buf, pos)); + wrt_ok &= (2 == write(__tokencap_out_file, "\"\n", 2)); + +} + +/* Replacements for strcmp(), memcmp(), and so on. Note that these will be used + only if the target is compiled with -fno-builtins and linked dynamically. */ + +#undef strcmp + +int strcmp(const char *str1, const char *str2) { + + if (__tokencap_is_ro(str1)) __tokencap_dump(str1, strlen(str1), 1); + if (__tokencap_is_ro(str2)) __tokencap_dump(str2, strlen(str2), 1); + +#ifdef RTLD_NEXT + if (__libc_strcmp) return __libc_strcmp(str1, str2); +#endif + + while (1) { + + const unsigned char c1 = *str1, c2 = *str2; + + if (c1 != c2) return (c1 > c2) ? 1 : -1; + if (!c1) return 0; + str1++; + str2++; + + } + +} + +#undef strncmp + +int strncmp(const char *str1, const char *str2, size_t len) { + + if (__tokencap_is_ro(str1)) __tokencap_dump(str1, len, 1); + if (__tokencap_is_ro(str2)) __tokencap_dump(str2, len, 1); + +#ifdef RTLD_NEXT + if (__libc_strncmp) return __libc_strncmp(str1, str2, len); +#endif + + while (len--) { + + unsigned char c1 = *str1, c2 = *str2; + + if (c1 != c2) return (c1 > c2) ? 1 : -1; + if (!c1) return 0; + str1++; + str2++; + + } + + return 0; + +} + +#undef strcasecmp + +int strcasecmp(const char *str1, const char *str2) { + + if (__tokencap_is_ro(str1)) __tokencap_dump(str1, strlen(str1), 1); + if (__tokencap_is_ro(str2)) __tokencap_dump(str2, strlen(str2), 1); + +#ifdef RTLD_NEXT + if (__libc_strcasecmp) return __libc_strcasecmp(str1, str2); +#endif + + while (1) { + + const unsigned char c1 = tolower((int)*str1), c2 = tolower((int)*str2); + + if (c1 != c2) return (c1 > c2) ? 1 : -1; + if (!c1) return 0; + str1++; + str2++; + + } + +} + +#undef strncasecmp + +int strncasecmp(const char *str1, const char *str2, size_t len) { + + if (__tokencap_is_ro(str1)) __tokencap_dump(str1, len, 1); + if (__tokencap_is_ro(str2)) __tokencap_dump(str2, len, 1); + +#ifdef RTLD_NEXT + if (__libc_strncasecmp) return __libc_strncasecmp(str1, str2, len); +#endif + + while (len--) { + + const unsigned char c1 = tolower((int)*str1), c2 = tolower((int)*str2); + + if (c1 != c2) return (c1 > c2) ? 1 : -1; + if (!c1) return 0; + str1++; + str2++; + + } + + return 0; + +} + +#undef memcmp + +int memcmp(const void *mem1, const void *mem2, size_t len) { + + if (__tokencap_is_ro(mem1)) __tokencap_dump(mem1, len, 0); + if (__tokencap_is_ro(mem2)) __tokencap_dump(mem2, len, 0); + +#ifdef RTLD_NEXT + if (__libc_memcmp) return __libc_memcmp(mem1, mem2, len); +#endif + + const char *strmem1 = (const char *)mem1; + const char *strmem2 = (const char *)mem2; + + while (len--) { + + const unsigned char c1 = *strmem1, c2 = *strmem2; + if (c1 != c2) return (c1 > c2) ? 1 : -1; + strmem1++; + strmem2++; + + } + + return 0; + +} + +#undef bcmp + +int bcmp(const void *mem1, const void *mem2, size_t len) { + + if (__tokencap_is_ro(mem1)) __tokencap_dump(mem1, len, 0); + if (__tokencap_is_ro(mem2)) __tokencap_dump(mem2, len, 0); + +#ifdef RTLD_NEXT + if (__libc_bcmp) return __libc_bcmp(mem1, mem2, len); +#endif + + const char *strmem1 = (const char *)mem1; + const char *strmem2 = (const char *)mem2; + + while (len--) { + + int diff = *strmem1 ^ *strmem2; + if (diff != 0) return 1; + strmem1++; + strmem2++; + + } + + return 0; + +} + +#undef strstr + +char *strstr(const char *haystack, const char *needle) { + + if (__tokencap_is_ro(haystack)) + __tokencap_dump(haystack, strlen(haystack), 1); + + if (__tokencap_is_ro(needle)) __tokencap_dump(needle, strlen(needle), 1); + +#ifdef RTLD_NEXT + if (__libc_strstr) return __libc_strstr(haystack, needle); +#endif + + do { + + const char *n = needle; + const char *h = haystack; + + while (*n && *h && *n == *h) + n++, h++; + + if (!*n) return (char *)haystack; + + } while (*(haystack++)); + + return 0; + +} + +#undef strcasestr + +char *strcasestr(const char *haystack, const char *needle) { + + if (__tokencap_is_ro(haystack)) + __tokencap_dump(haystack, strlen(haystack), 1); + + if (__tokencap_is_ro(needle)) __tokencap_dump(needle, strlen(needle), 1); + +#ifdef RTLD_NEXT + if (__libc_strcasestr) return __libc_strcasestr(haystack, needle); +#endif + + do { + + const char *n = needle; + const char *h = haystack; + + while (*n && *h && tolower((int)*n) == tolower((int)*h)) + n++, h++; + + if (!*n) return (char *)haystack; + + } while (*(haystack++)); + + return 0; + +} + +#undef memmem + +void *memmem(const void *haystack, size_t haystack_len, const void *needle, + size_t needle_len) { + + if (__tokencap_is_ro(haystack)) __tokencap_dump(haystack, haystack_len, 1); + + if (__tokencap_is_ro(needle)) __tokencap_dump(needle, needle_len, 1); + +#ifdef RTLD_NEXT + if (__libc_memmem) + return __libc_memmem(haystack, haystack_len, needle, needle_len); +#endif + + const char *n = (const char *)needle; + const char *h = (const char *)haystack; + if (haystack_len < needle_len) return 0; + if (needle_len == 0) return (void *)haystack; + if (needle_len == 1) return memchr(haystack, *n, haystack_len); + + const char *end = h + (haystack_len - needle_len); + + do { + + if (*h == *n) { + + if (memcmp(h, n, needle_len) == 0) return (void *)h; + + } + + } while (h++ <= end); + + return 0; + +} + +/* Common libraries wrappers (from honggfuzz) */ + +/* + * Apache's httpd wrappers + */ +int ap_cstr_casecmp(const char *s1, const char *s2) { + + return strcasecmp(s1, s2); + +} + +int ap_cstr_casecmpn(const char *s1, const char *s2, size_t n) { + + return strncasecmp(s1, s2, n); + +} + +const char *ap_strcasestr(const char *s1, const char *s2) { + + return strcasestr(s1, s2); + +} + +int apr_cstr_casecmp(const char *s1, const char *s2) { + + return strcasecmp(s1, s2); + +} + +int apr_cstr_casecmpn(const char *s1, const char *s2, size_t n) { + + return strncasecmp(s1, s2, n); + +} + +/* + * *SSL wrappers + */ +int CRYPTO_memcmp(const void *m1, const void *m2, size_t len) { + + return memcmp(m1, m2, len); + +} + +int OPENSSL_memcmp(const void *m1, const void *m2, size_t len) { + + return memcmp(m1, m2, len); + +} + +int OPENSSL_strcasecmp(const char *s1, const char *s2) { + + return strcasecmp(s1, s2); + +} + +int OPENSSL_strncasecmp(const char *s1, const char *s2, size_t len) { + + return strncasecmp(s1, s2, len); + +} + +int32_t memcmpct(const void *s1, const void *s2, size_t len) { + + return memcmp(s1, s2, len); + +} + +/* + * libXML wrappers + */ +int xmlStrncmp(const char *s1, const char *s2, int len) { + + if (len <= 0) { return 0; } + if (s1 == s2) { return 0; } + if (s1 == NULL) { return -1; } + if (s2 == NULL) { return 1; } + return strncmp(s1, s2, (size_t)len); + +} + +int xmlStrcmp(const char *s1, const char *s2) { + + if (s1 == s2) { return 0; } + if (s1 == NULL) { return -1; } + if (s2 == NULL) { return 1; } + return strcmp(s1, s2); + +} + +int xmlStrEqual(const char *s1, const char *s2) { + + if (s1 == s2) { return 1; } + if (s1 == NULL) { return 0; } + if (s2 == NULL) { return 0; } + if (strcmp(s1, s2) == 0) { return 1; } + return 0; + +} + +int xmlStrcasecmp(const char *s1, const char *s2) { + + if (s1 == s2) { return 0; } + if (s1 == NULL) { return -1; } + if (s2 == NULL) { return 1; } + return strcasecmp(s1, s2); + +} + +int xmlStrncasecmp(const char *s1, const char *s2, int len) { + + if (len <= 0) { return 0; } + if (s1 == s2) { return 0; } + if (s1 == NULL) { return -1; } + if (s2 == NULL) { return 1; } + return strncasecmp(s1, s2, (size_t)len); + +} + +const char *xmlStrstr(const char *haystack, const char *needle) { + + if (haystack == NULL) { return NULL; } + if (needle == NULL) { return NULL; } + return strstr(haystack, needle); + +} + +const char *xmlStrcasestr(const char *haystack, const char *needle) { + + if (haystack == NULL) { return NULL; } + if (needle == NULL) { return NULL; } + return strcasestr(haystack, needle); + +} + +/* + * Samba wrappers + */ +int memcmp_const_time(const void *s1, const void *s2, size_t n) { + + return memcmp(s1, s2, n); + +} + +bool strcsequal(const void *s1, const void *s2) { + + if (s1 == s2) { return true; } + if (!s1 || !s2) { return false; } + return (strcmp(s1, s2) == 0); + +} + +/* bcmp/memcmp BSD flavors, similar to CRYPTO_memcmp */ + +int timingsafe_bcmp(const void *mem1, const void *mem2, size_t len) { + + return bcmp(mem1, mem2, len); + +} + +int timingsafe_memcmp(const void *mem1, const void *mem2, size_t len) { + + return memcmp(mem1, mem2, len); + +} + +/* Init code to open the output file (or default to stderr). */ + +__attribute__((constructor)) void __tokencap_init(void) { + + u8 *fn = getenv("AFL_TOKEN_FILE"); + if (fn) __tokencap_out_file = open(fn, O_RDWR | O_CREAT | O_APPEND, 0655); + if (__tokencap_out_file == -1) __tokencap_out_file = STDERR_FILENO; + __tokencap_pid = getpid(); + +#ifdef RTLD_NEXT + __libc_strcmp = dlsym(RTLD_NEXT, "strcmp"); + __libc_strncmp = dlsym(RTLD_NEXT, "strncmp"); + __libc_strcasecmp = dlsym(RTLD_NEXT, "strcasecmp"); + __libc_strncasecmp = dlsym(RTLD_NEXT, "strncasecmp"); + __libc_memcmp = dlsym(RTLD_NEXT, "memcmp"); + __libc_bcmp = dlsym(RTLD_NEXT, "bcmp"); + __libc_strstr = dlsym(RTLD_NEXT, "strstr"); + __libc_strcasestr = dlsym(RTLD_NEXT, "strcasestr"); + __libc_memmem = dlsym(RTLD_NEXT, "memmem"); +#endif + +} + +/* closing as best as we can the tokens file */ +__attribute__((destructor)) void __tokencap_shutdown(void) { + + if (__tokencap_out_file != STDERR_FILENO) close(__tokencap_out_file); + +} + diff --git a/utils/qbdi_mode/README.md b/utils/qbdi_mode/README.md new file mode 100755 index 00000000..641a6e85 --- /dev/null +++ b/utils/qbdi_mode/README.md @@ -0,0 +1,199 @@ +# qbdi-based binary-only instrumentation for afl-fuzz + +## 1) Introduction + +The code in ./qbdi_mode allows you to build a standalone feature that +using the QBDI framework to fuzz android native library. + + +## 2) Build + +First download the Android NDK + +``` +https://developer.android.com/ndk/downloads +https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip +``` + +Then unzip it and build the standalone-toolchain +For x86_64 standalone-toolchain + +``` +unzip android-ndk-r20-linux-x86_64.zip +cd android-ndk-r20/ +./build/tools/make_standalone_toolchain.py --arch x86_64 --api 21 --install-dir ../android-standalone-toolchain-x86_64 +``` + +For x86 standalone-toolchain + +``` +./build/tools/make_standalone_toolchain.py --arch x86 --api 21 --install-dir ../android-standalone-toolchain-x86 +``` + +In alternative you can also use the prebuilt toolchain, in that case make sure to set the proper CC and CXX env variables because there are many different compilers for each API version in the prebuilt toolchain. + +For example: + +``` +export STANDALONE_TOOLCHAIN_PATH=~/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/ +export CC=x86_64-linux-android21-clang +export CXX=x86_64-linux-android21-clang++ +``` + +Then download the QBDI SDK from website + +``` +https://qbdi.quarkslab.com/ +``` + +For Android x86_64 +``` +https://github.com/QBDI/QBDI/releases/download/v0.7.0/QBDI-0.7.0-android-X86_64.tar.gz +``` + +Then decompress the sdk + +``` +mkdir android-qbdi-sdk-x86_64 +cp QBDI-0.7.0-android-X86_64.tar.gz android-qbdi-sdk-x86_64/ +cd android-qbdi-sdk-x86_64/ +tar xvf QBDI-0.7.0-android-X86_64.tar.gz +``` + +Now set the `STANDALONE_TOOLCHAIN_PATH` to the path of standalone-toolchain + +``` +export STANDALONE_TOOLCHAIN_PATH=/home/hac425/workspace/android-standalone-toolchain-x86_64 +``` + +set the `QBDI_SDK_PATH` to the path of QBDI SDK + +``` +export QBDI_SDK_PATH=/home/hac425/workspace/AFLplusplus/qbdi_mode/android-qbdi-sdk-x86_64/ +``` + +Then run the build.sh + +``` +./build.sh x86_64 +``` + +this could build the afl-fuzz and also the qbdi template for android x86_64 + + +### Example + +The demo-so.c is an vulnerable library, it has a function for test + +```c +int target_func(char *buf, int size) { + + printf("buffer:%p, size:%p\n", buf, size); + switch (buf[0]) { + + case 1: + puts("222"); + if (buf[1] == '\x44') { + + puts("null ptr deference"); + *(char *)(0) = 1; + + } + + break; + case 0xff: + if (buf[2] == '\xff') { + + if (buf[1] == '\x44') { + + puts("crash...."); + *(char *)(0xdeadbeef) = 1; + + } + + } + + break; + default: puts("default action"); break; + + } + + return 1; + +} +``` + +This could be build to `libdemo.so`. + +Then we should load the library in template.cpp and find the `target` function address. +```c + void *handle = dlopen(lib_path, RTLD_LAZY); + .......................................... + .......................................... + .......................................... + p_target_func = (target_func)dlsym(handle, "target_func"); +``` + +then we read the data from file and call the function in `fuzz_func` + +```c +QBDI_NOINLINE int fuzz_func() { + + if (afl_setup()) { afl_forkserver(); } + + /* Read the input from file */ + unsigned long len = 0; + char * data = read_file(input_pathname, &len); + + /* Call the target function with the input data */ + p_target_func(data, len); + return 1; + +} +``` + +Just compile it +``` +./build.sh x86_64 +``` + +Then push the `afl-fuzz`, `loader`, `libdemo.so`, the `libQBDI.so` from the QBDI SDK and the `libc++_shared.so` from android-standalone-toolchain to android device + +``` +adb push afl-fuzz /data/local/tmp +adb push libdemo.so /data/local/tmp +adb push loader /data/local/tmp +adb push android-qbdi-sdk-x86_64/usr/local/lib/libQBDI.so /data/local/tmp +adb push ../../android-standalone-toolchain-x86_64/sysroot/usr/lib/x86_64-linux-android/libc++_shared.so +/data/local/tmp +``` + +In android adb shell, run the loader to test if it runs +``` +cd /data/local/tmp +export LD_LIBRARY_PATH=/data/local/tmp +mkdir in +echo 0000 > in/1 +./loader libdemo.so in/1 +p_target_func:0x716d96a98600 + offset:0x600 + offset:0x580 +buffer:0x716d96609050, size:0x5 + offset:0x628 + offset:0x646 + offset:0x64b + offset:0x65c + offset:0x6df + offset:0x590 +default action + offset:0x6eb +``` + +Now run `afl-fuzz` to fuzz the demo library + +``` +./afl-fuzz -i in -o out -- ./loader /data/local/tmp/libdemo.so @@ +``` + +![screen1](assets/screen1.png) + diff --git a/utils/qbdi_mode/assets/screen1.png b/utils/qbdi_mode/assets/screen1.png new file mode 100644 index 00000000..3cf1cb76 Binary files /dev/null and b/utils/qbdi_mode/assets/screen1.png differ diff --git a/utils/qbdi_mode/build.sh b/utils/qbdi_mode/build.sh new file mode 100755 index 00000000..2527bd26 --- /dev/null +++ b/utils/qbdi_mode/build.sh @@ -0,0 +1,57 @@ + +if [ -z ${STANDALONE_TOOLCHAIN_PATH} ]; then + echo "please set the android-standalone-toolchain path in STANDALONE_TOOLCHAIN_PATH environmental variable" + echo "for example: " + echo " export STANDALONE_TOOLCHAIN_PATH=/home/android-standalone-toolchain-21/" + exit +fi + +if [ -z ${QBDI_SDK_PATH} ]; then + echo "please set the qbdi sdk path in QBDI_SDK_PATH environmental variable" + echo "for example: " + echo " export QBDI_SDK_PATH=/home/QBDI-Android/" + exit +fi + + + +if [ "$1" = "x86" ]; then + echo "build x86 qbdi" + compiler_prefix="${STANDALONE_TOOLCHAIN_PATH}/bin/" + if [ -z ${CC} ]; then + export CC=i686-linux-android-gcc + fi + if [ -z ${CXX} ]; then + export CXX=i686-linux-android-g++ + fi +elif [ "$1" = "x86_64" ]; then + echo "build x86_64 qbdi" + compiler_prefix="${STANDALONE_TOOLCHAIN_PATH}/bin/" + if [ -z ${CC} ]; then + export CC=x86_64-linux-android-gcc + fi + if [ -z ${CXX} ]; then + export CXX=x86_64-linux-android-g++ + fi +else + echo "usage: ./build.sh arch[x86, x86_64]" + exit +fi + + +CFLAGS="-I${QBDI_SDK_PATH}/usr/local/include/ -L${QBDI_SDK_PATH}/usr/local/lib/" + +echo "[+] Building the QBDI template" +# build the qbdi template +${compiler_prefix}${CXX} -o loader template.cpp -lQBDI -ldl -w -g ${CFLAGS} + +echo "[+] Building the demo library" +# build the demo share library +${compiler_prefix}${CC} -shared -o libdemo.so demo-so.c -w -g + +echo "[+] Building afl-fuzz for Android" +# build afl-fuzz +cd ../.. +${compiler_prefix}${CC} -DANDROID_DISABLE_FANCY=1 -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -Wno-unused-function src/afl-fuzz-*.c src/afl-fuzz.c src/afl-common.c src/afl-sharedmem.c src/afl-forkserver.c -o utils/qbdi_mode/afl-fuzz -ldl -w + +echo "[+] All done. Enjoy!" diff --git a/utils/qbdi_mode/demo-so.c b/utils/qbdi_mode/demo-so.c new file mode 100755 index 00000000..dd367036 --- /dev/null +++ b/utils/qbdi_mode/demo-so.c @@ -0,0 +1,41 @@ +#include + +// gcc -shared -o libdemo.so demo-so.c -w +int target_func(char *buf, int size) { + + printf("buffer:%p, size:%p\n", buf, size); + switch (buf[0]) { + + case 1: + puts("222"); + if (buf[1] == '\x44') { + + puts("null ptr deference"); + *(char *)(0) = 1; + + } + + break; + case 0xff: + if (buf[2] == '\xff') { + + if (buf[1] == '\x44') { + + puts("crash...."); + *(char *)(0xdeadbeef) = 1; + + } + + } + + break; + default: + puts("default action"); + break; + + } + + return 1; + +} + diff --git a/utils/qbdi_mode/template.cpp b/utils/qbdi_mode/template.cpp new file mode 100755 index 00000000..b2066cc8 --- /dev/null +++ b/utils/qbdi_mode/template.cpp @@ -0,0 +1,251 @@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __ANDROID__ + #include "../include/android-ashmem.h" +#endif + +#include +#include +#include "../config.h" + +#include + +/* NeverZero */ + +#if (defined(__x86_64__) || defined(__i386__)) && defined(AFL_QEMU_NOT_ZERO) + #define INC_AFL_AREA(loc) \ + asm volatile( \ + "incb (%0, %1, 1)\n" \ + "adcb $0, (%0, %1, 1)\n" \ + : /* no out */ \ + : "r"(afl_area_ptr), "r"(loc) \ + : "memory", "eax") +#else + #define INC_AFL_AREA(loc) afl_area_ptr[loc]++ +#endif + +using namespace QBDI; + +typedef int (*target_func)(char *buf, int size); + +static const size_t STACK_SIZE = 0x100000; // 1MB +static const QBDI::rword FAKE_RET_ADDR = 0x40000; +target_func p_target_func = NULL; +rword module_base = 0; +rword module_end = 0; +static unsigned char + dummy[MAP_SIZE]; /* costs MAP_SIZE but saves a few instructions */ +unsigned char *afl_area_ptr = NULL; /* Exported for afl_gen_trace */ + +unsigned long afl_prev_loc = 0; + +char input_pathname[PATH_MAX]; + +/* Set up SHM region and initialize other stuff. */ + +int afl_setup(void) { + + char *id_str = getenv(SHM_ENV_VAR); + int shm_id; + if (id_str) { + + shm_id = atoi(id_str); + afl_area_ptr = (unsigned char *)shmat(shm_id, NULL, 0); + if (afl_area_ptr == (void *)-1) return 0; + memset(afl_area_ptr, 0, MAP_SIZE); + + } + + return 1; + +} + +/* Fork server logic, invoked once we hit _start. */ +static void afl_forkserver() { + + static unsigned char tmp[4]; + pid_t child_pid; + + if (write(FORKSRV_FD + 1, tmp, 4) != 4) return; + + while (1) { + + int status; + u32 was_killed; + // wait for afl-fuzz + if (read(FORKSRV_FD, &was_killed, 4) != 4) exit(2); + + child_pid = fork(); + if (child_pid < 0) exit(4); + + if (!child_pid) { + + // child return to execute code + close(FORKSRV_FD); + close(FORKSRV_FD + 1); + return; + + } + + // write child pid to afl-fuzz + if (write(FORKSRV_FD + 1, &child_pid, 4) != 4) exit(5); + + // wait child stop + if (waitpid(child_pid, &status, 0) < 0) exit(6); + + // send child stop status to afl-fuzz + if (write(FORKSRV_FD + 1, &status, 4) != 4) exit(7); + + } + +} + +void afl_maybe_log(unsigned long cur_loc) { + + if (afl_area_ptr == NULL) { return; } + unsigned long afl_idx = cur_loc ^ afl_prev_loc; + afl_idx &= MAP_SIZE - 1; + INC_AFL_AREA(afl_idx); + afl_prev_loc = cur_loc >> 1; + +} + +char *read_file(char *path, unsigned long *length) { + + unsigned long len; + char * buf; + + FILE *fp = fopen(path, "rb"); + fseek(fp, 0, SEEK_END); + len = ftell(fp); + buf = (char *)malloc(len); + rewind(fp); + fread(buf, 1, len, fp); + fclose(fp); + *length = len; + return buf; + +} + +QBDI_NOINLINE int fuzz_func() { + + if (afl_setup()) { afl_forkserver(); } + + unsigned long len = 0; + char * data = read_file(input_pathname, &len); + + // printf("In fuzz_func\n"); + p_target_func(data, len); + return 1; + +} + +static QBDI::VMAction bbcallback(QBDI::VMInstanceRef vm, + const QBDI::VMState *state, + QBDI::GPRState * gprState, + QBDI::FPRState *fprState, void *data) { + + // errno = SAVED_ERRNO; + +#ifdef __x86_64__ + unsigned long pc = gprState->rip; +#elif defined(i386) + unsigned long pc = gprState->eip; +#elif defined(__arm__) + unsigned long pc = gprState->pc; +#endif + + // just log the module path + if (pc >= module_base && pc <= module_end) { + + unsigned long offset = pc - module_base; + printf("\toffset:%p\n", offset); + afl_maybe_log(offset); + + } + + return QBDI::VMAction::CONTINUE; + +} + +int main(int argc, char **argv) { + + if (argc < 3) { + + puts("usage: ./loader library_path input_file_path"); + exit(0); + + } + + const char *lib_path; + lib_path = argv[1]; + strcpy(input_pathname, argv[2]); + void *handle = dlopen(lib_path, RTLD_LAZY); + + if (handle == nullptr) { + + perror("Cannot load library"); + exit(EXIT_FAILURE); + + } + + const char *lib_name = lib_path; + if (strrchr(lib_name, '/') != nullptr) lib_name = strrchr(lib_name, '/') + 1; + + // printf("library name:%s\n", lib_name); + // load library module address for log path + for (MemoryMap &map : getCurrentProcessMaps()) { + + // printf("module:%s\n", map.name.c_str()); + if ((map.permission & PF_EXEC) && + strstr(map.name.c_str(), lib_name) != NULL) { + + module_base = map.range.start; + module_end = map.range.end; + + } + + } + + if (module_base == 0) { + + std::cerr << "Fail to find base address" << std::endl; + return -1; + + } + + // printf("module base:%p, module end:%p\n", module_base, module_end); + p_target_func = (target_func)dlsym(handle, "target_func"); + // p_target_func = (target_func)(module_base + 0x61a); + printf("p_target_func:%p\n", p_target_func); + + VM vm; + uint8_t *fakestack = nullptr; + + GPRState *state = vm.getGPRState(); + allocateVirtualStack(state, STACK_SIZE, &fakestack); + vm.addInstrumentedModuleFromAddr(module_base); + vm.addInstrumentedModuleFromAddr((rword)&main); + + vm.addVMEventCB(BASIC_BLOCK_ENTRY, bbcallback, nullptr); + + // QBDI::simulateCall(state, FAKE_RET_ADDR); + // vm.run((rword)&fuzz_func, (rword)FAKE_RET_ADDR); + + rword ret; + vm.call(&ret, (rword)&fuzz_func, {}); + + return 0; + +} + -- cgit 1.4.1 From 76117b04716c812cd7f4cd543ae1f0d85f194c50 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Sun, 13 Dec 2020 11:23:56 +0100 Subject: fix afl-clang tests --- test/test-basic.sh | 26 +++++++++++++++++++++----- utils/aflpp_driver/aflpp_driver_test.c | 4 ---- 2 files changed, 21 insertions(+), 9 deletions(-) (limited to 'utils') diff --git a/test/test-basic.sh b/test/test-basic.sh index 0e7b8858..24aa30a4 100755 --- a/test/test-basic.sh +++ b/test/test-basic.sh @@ -25,8 +25,8 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc CODE=1 } rm -f test-instr.plain.0 test-instr.plain.1 - TUPLES=`echo 0|../afl-showmap -m ${MEM_LIMIT} -o /dev/null -- ./test-instr.plain 2>&1 | grep Captur | awk '{print$3}'` - test "$TUPLES" -gt 3 -a "$TUPLES" -lt 11 && { + TUPLES=`echo 1|../afl-showmap -m ${MEM_LIMIT} -o /dev/null -- ./test-instr.plain 2>&1 | grep Captur | awk '{print$3}'` + test "$TUPLES" -gt 4 -a "$TUPLES" -lt 11 && { $ECHO "$GREEN[+] ${AFL_GCC} run reported $TUPLES instrumented locations which is fine" } || { $ECHO "$RED[!] ${AFL_GCC} instrumentation produces weird numbers: $TUPLES" @@ -140,8 +140,8 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc CODE=1 } rm -f test-instr.plain.0 test-instr.plain.1 - TUPLES=`echo 0|../afl-showmap -m ${MEM_LIMIT} -o /dev/null -- ./test-instr.plain 2>&1 | grep Captur | awk '{print$3}'` - test "$TUPLES" -gt 3 -a "$TUPLES" -lt 11 && { + TUPLES=`echo 1|../afl-showmap -m ${MEM_LIMIT} -o /dev/null -- ./test-instr.plain 2>&1 | grep Captur | awk '{print$3}'` + test "$TUPLES" -gt 4 -a "$TUPLES" -lt 11 && { $ECHO "$GREEN[+] ${AFL_GCC} run reported $TUPLES instrumented locations which is fine" } || { $ECHO "$RED[!] ${AFL_GCC} instrumentation produces weird numbers: $TUPLES" @@ -194,12 +194,20 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc CODE=1 } echo 000000000000000000000000 > in/in2 - echo 111 > in/in3 + echo AAA > in/in3 mkdir -p in2 ../afl-cmin -m ${MEM_LIMIT} -i in -o in2 -- ./test-instr.plain >/dev/null 2>&1 # why is afl-forkserver writing to stderr? CNT=`ls in2/* 2>/dev/null | wc -l` case "$CNT" in *2) $ECHO "$GREEN[+] afl-cmin correctly minimized the number of testcases" ;; + 1) { + test -s in2/* && $ECHO "$YELLOW[?] afl-cmin did minimize to one testcase. This can be a bug or due compiler optimization." + test -s in2/* || { + $ECHO "$RED[!] afl-cmin did not correctly minimize the number of testcases ($CNT)" + CODE=1 + } + } + ;; *) $ECHO "$RED[!] afl-cmin did not correctly minimize the number of testcases ($CNT)" CODE=1 ;; @@ -211,6 +219,14 @@ test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc CNT=`ls in2/* 2>/dev/null | wc -l` case "$CNT" in *2) $ECHO "$GREEN[+] afl-cmin.bash correctly minimized the number of testcases" ;; + 1) { + test -s in2/* && $ECHO "$YELLOW[?] afl-cmin did minimize to one testcase. This can be a bug or due compiler optimization." + test -s in2/* || { + $ECHO "$RED[!] afl-cmin did not correctly minimize the number of testcases ($CNT)" + CODE=1 + } + } + ;; *) $ECHO "$RED[!] afl-cmin.bash did not correctly minimize the number of testcases ($CNT)" CODE=1 ;; diff --git a/utils/aflpp_driver/aflpp_driver_test.c b/utils/aflpp_driver/aflpp_driver_test.c index b4ff6bc6..043dfaf6 100644 --- a/utils/aflpp_driver/aflpp_driver_test.c +++ b/utils/aflpp_driver/aflpp_driver_test.c @@ -19,10 +19,6 @@ void __attribute__((noinline)) crashme(const uint8_t *Data, size_t Size) { int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { if (Size) - fprintf(stderr, "FUNC crc: %016llx len: %lu\n", - hash64((u8 *)Data, (unsigned int)Size, - (unsigned long long int)0xa5b35705), - Size); crashme(Data, Size); -- cgit 1.4.1 From df7c72fd66be0840469c7dba62a21bfb3c228a68 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Sun, 13 Dec 2020 11:24:49 +0100 Subject: code format --- utils/aflpp_driver/aflpp_driver_test.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'utils') diff --git a/utils/aflpp_driver/aflpp_driver_test.c b/utils/aflpp_driver/aflpp_driver_test.c index 043dfaf6..fe05b4f8 100644 --- a/utils/aflpp_driver/aflpp_driver_test.c +++ b/utils/aflpp_driver/aflpp_driver_test.c @@ -18,9 +18,7 @@ void __attribute__((noinline)) crashme(const uint8_t *Data, size_t Size) { int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { - if (Size) - - crashme(Data, Size); + if (Size) crashme(Data, Size); return 0; -- cgit 1.4.1 From 79c98731c9864d457df06cfb4e1c15137e0cf832 Mon Sep 17 00:00:00 2001 From: hexcoder- Date: Fri, 18 Dec 2020 09:22:58 +0100 Subject: small improvements: dump output on error in test-llvm, fix compiler warnings --- test/test-llvm.sh | 1 + utils/afl_untracer/afl-untracer.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'utils') diff --git a/test/test-llvm.sh b/test/test-llvm.sh index 4fcaf367..d9b26763 100755 --- a/test/test-llvm.sh +++ b/test/test-llvm.sh @@ -133,6 +133,7 @@ test -e ../afl-clang-fast -a -e ../split-switches-pass.so && { } rm -f test-instr.instrim test.out } || { + cat test.out $ECHO "$RED[!] llvm_mode InsTrim compilation failed" CODE=1 } diff --git a/utils/afl_untracer/afl-untracer.c b/utils/afl_untracer/afl-untracer.c index cb6f948c..695f8dd1 100644 --- a/utils/afl_untracer/afl-untracer.c +++ b/utils/afl_untracer/afl-untracer.c @@ -568,7 +568,7 @@ void setup_trap_instrumentation(void) { lib_addr[offset] = 0xcc; // replace instruction with debug trap if (debug) fprintf(stderr, - "Patch entry: %p[%x] = %p = %02x -> SHADOW(%p) #%d -> %08x\n", + "Patch entry: %p[%lx] = %p = %02x -> SHADOW(%p) #%d -> %08x\n", lib_addr, offset, lib_addr + offset, orig_byte, shadow, bitmap_index, *shadow); @@ -582,7 +582,7 @@ void setup_trap_instrumentation(void) { *patch_bytes = 0xd4200000; // replace instruction with debug trap if (debug) fprintf(stderr, - "Patch entry: %p[%x] = %p = %02x -> SHADOW(%p) #%d -> %016x\n", + "Patch entry: %p[%lx] = %p = %02x -> SHADOW(%p) #%d -> %016x\n", lib_addr, offset, lib_addr + offset, orig_bytes, shadow, bitmap_index, *shadow); -- cgit 1.4.1 From 73dd6d86abc16c2ceb5529f3a261724be8b7896a Mon Sep 17 00:00:00 2001 From: van Hauser Date: Fri, 18 Dec 2020 16:38:24 +0100 Subject: dont fail with ASAN_BUILD --- GNUmakefile | 4 ++-- GNUmakefile.gcc_plugin | 2 +- GNUmakefile.llvm | 2 +- utils/afl_proxy/afl-proxy.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'utils') diff --git a/GNUmakefile b/GNUmakefile index 5c82279b..172dd741 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -512,7 +512,7 @@ code-format: ifndef AFL_NO_X86 test_build: afl-cc afl-gcc afl-as afl-showmap @echo "[*] Testing the CC wrapper afl-cc and its instrumentation output..." - @unset AFL_MAP_SIZE AFL_USE_UBSAN AFL_USE_CFISAN AFL_USE_ASAN AFL_USE_MSAN AFL_CC; AFL_INST_RATIO=100 AFL_PATH=. ./afl-cc test-instr.c -o test-instr 2>&1 || (echo "Oops, afl-cc failed"; exit 1 ) + @unset AFL_MAP_SIZE AFL_USE_UBSAN AFL_USE_CFISAN AFL_USE_ASAN AFL_USE_MSAN AFL_CC; ASAN_OPTIONS=detect_leaks=0 AFL_INST_RATIO=100 AFL_PATH=. ./afl-cc test-instr.c -o test-instr 2>&1 || (echo "Oops, afl-cc failed"; exit 1 ) ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr @rm -f test-instr @@ -520,7 +520,7 @@ test_build: afl-cc afl-gcc afl-as afl-showmap @echo @echo "[+] All right, the instrumentation of afl-cc seems to be working!" @echo "[*] Testing the CC wrapper afl-gcc and its instrumentation output..." - @unset AFL_MAP_SIZE AFL_USE_UBSAN AFL_USE_CFISAN AFL_USE_ASAN AFL_USE_MSAN AFL_CC; AFL_INST_RATIO=100 AFL_PATH=. ./afl-gcc test-instr.c -o test-instr 2>&1 || (echo "Oops, afl-gcc failed"; exit 1 ) + @unset AFL_MAP_SIZE AFL_USE_UBSAN AFL_USE_CFISAN AFL_USE_ASAN AFL_USE_MSAN AFL_CC; ASAN_OPTIONS=detect_leaks=0 AFL_INST_RATIO=100 AFL_PATH=. ./afl-gcc test-instr.c -o test-instr 2>&1 || (echo "Oops, afl-gcc failed"; exit 1 ) ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr @rm -f test-instr diff --git a/GNUmakefile.gcc_plugin b/GNUmakefile.gcc_plugin index ee211c24..aa93c688 100644 --- a/GNUmakefile.gcc_plugin +++ b/GNUmakefile.gcc_plugin @@ -138,7 +138,7 @@ afl-common.o: ./src/afl-common.c .PHONY: test_build test_build: $(PROGS) @echo "[*] Testing the CC wrapper and instrumentation output..." - unset AFL_USE_ASAN AFL_USE_MSAN; AFL_QUIET=1 AFL_INST_RATIO=100 AFL_PATH=. AFL_CC=$(CC) ./afl-gcc-fast $(CFLAGS) $(CPPFLAGS) ./test-instr.c -o test-instr $(LDFLAGS) + unset AFL_USE_ASAN AFL_USE_MSAN; ASAN_OPTIONS=detect_leaks=0 AFL_QUIET=1 AFL_INST_RATIO=100 AFL_PATH=. AFL_CC=$(CC) ./afl-gcc-fast $(CFLAGS) $(CPPFLAGS) ./test-instr.c -o test-instr $(LDFLAGS) ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr Date: Mon, 21 Dec 2020 17:04:58 +0100 Subject: temporary fix for unusual builds where CC is set --- GNUmakefile | 22 +++++++++++----------- utils/afl_proxy/afl-proxy.c | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'utils') diff --git a/GNUmakefile b/GNUmakefile index 71b41227..a1af1fd5 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -517,23 +517,23 @@ code-format: ifndef AFL_NO_X86 test_build: afl-cc afl-gcc afl-as afl-showmap @echo "[*] Testing the CC wrapper afl-cc and its instrumentation output..." - @unset AFL_MAP_SIZE AFL_USE_UBSAN AFL_USE_CFISAN AFL_USE_ASAN AFL_USE_MSAN; AFL_CC=$(CC) ASAN_OPTIONS=detect_leaks=0 AFL_INST_RATIO=100 AFL_PATH=. ./afl-gcc test-instr.c -o test-instr 2>&1 || (echo "Oops, afl-cc failed"; exit 1 ) + @unset AFL_MAP_SIZE AFL_USE_UBSAN AFL_USE_CFISAN AFL_USE_ASAN AFL_USE_MSAN AFL_CC; ASAN_OPTIONS=detect_leaks=0 AFL_INST_RATIO=100 AFL_PATH=. ./afl-cc test-instr.c -o test-instr 2>&1 || (echo "Oops, afl-cc failed"; exit 1 ) ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr @rm -f test-instr @cmp -s .test-instr0 .test-instr1; DR="$$?"; rm -f .test-instr0 .test-instr1; if [ "$$DR" = "0" ]; then echo; echo "Oops, the instrumentation of afl-cc does not seem to be behaving correctly!"; echo; echo "Please post to https://github.com/AFLplusplus/AFLplusplus/issues to troubleshoot the issue."; echo; exit 1; fi @echo @echo "[+] All right, the instrumentation of afl-cc seems to be working!" - @echo "[*] Testing the CC wrapper afl-gcc and its instrumentation output..." - @unset AFL_MAP_SIZE AFL_USE_UBSAN AFL_USE_CFISAN AFL_USE_ASAN AFL_USE_MSAN; AFL_CC=$(CC) ASAN_OPTIONS=detect_leaks=0 AFL_INST_RATIO=100 AFL_PATH=. ./afl-gcc test-instr.c -o test-instr 2>&1 || (echo "Oops, afl-gcc failed"; exit 1 ) - ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null - echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr - @rm -f test-instr - @cmp -s .test-instr0 .test-instr1; DR="$$?"; rm -f .test-instr0 .test-instr1; if [ "$$DR" = "0" ]; then echo; echo "Oops, the instrumentation of afl-gcc does not seem to be behaving correctly!"; \ - gcc -v 2>&1 | grep -q -- --with-as= && ( echo; echo "Gcc is configured not to use an external assembler with the -B option."; echo "See docs/INSTALL.md section 5 how to build a -B enabled gcc." ) || \ - ( echo; echo "Please post to https://github.com/AFLplusplus/AFLplusplus/issues to troubleshoot the issue." ); echo; exit 0; fi - @echo - @echo "[+] All right, the instrumentation of afl-gcc seems to be working!" +# @echo "[*] Testing the CC wrapper afl-gcc and its instrumentation output..." +# @unset AFL_MAP_SIZE AFL_USE_UBSAN AFL_USE_CFISAN AFL_USE_ASAN AFL_USE_MSAN; AFL_CC=$(CC) ASAN_OPTIONS=detect_leaks=0 AFL_INST_RATIO=100 AFL_PATH=. ./afl-gcc test-instr.c -o test-instr 2>&1 || (echo "Oops, afl-gcc failed"; exit 1 ) +# ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null +# echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr +# @rm -f test-instr +# @cmp -s .test-instr0 .test-instr1; DR="$$?"; rm -f .test-instr0 .test-instr1; if [ "$$DR" = "0" ]; then echo; echo "Oops, the instrumentation of afl-gcc does not seem to be behaving correctly!"; \ +# gcc -v 2>&1 | grep -q -- --with-as= && ( echo; echo "Gcc is configured not to use an external assembler with the -B option."; echo "See docs/INSTALL.md section 5 how to build a -B enabled gcc." ) || \ +# ( echo; echo "Please post to https://github.com/AFLplusplus/AFLplusplus/issues to troubleshoot the issue." ); echo; exit 0; fi +# @echo +# @echo "[+] All right, the instrumentation of afl-gcc seems to be working!" else test_build: afl-cc afl-as afl-showmap @echo "[!] Note: skipping build tests (you may need to use LLVM or QEMU mode)." diff --git a/utils/afl_proxy/afl-proxy.c b/utils/afl_proxy/afl-proxy.c index 352e78e4..aa7a361a 100644 --- a/utils/afl_proxy/afl-proxy.c +++ b/utils/afl_proxy/afl-proxy.c @@ -213,7 +213,7 @@ int main(int argc, char *argv[]) { u32 len; /* here you specify the map size you need that you are reporting to - afl-fuzz. Any value is fine as long as it can be divided by 8. */ + afl-fuzz. Any value is fine as long as it can be divided by 32. */ __afl_map_size = MAP_SIZE; // default is 65536 /* then we initialize the shared memory map and start the forkserver */ -- cgit 1.4.1 From 159707f74ca094029651ab2ef3292ac17f3a7269 Mon Sep 17 00:00:00 2001 From: David Manouchehri Date: Sat, 26 Dec 2020 15:15:24 -0500 Subject: Include Apple headers. --- utils/afl_frida/afl-frida.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'utils') diff --git a/utils/afl_frida/afl-frida.c b/utils/afl_frida/afl-frida.c index 31bf8f25..09ce00ad 100644 --- a/utils/afl_frida/afl-frida.c +++ b/utils/afl_frida/afl-frida.c @@ -37,7 +37,10 @@ #include #include -#ifndef __APPLE__ +#ifdef __APPLE__ + #include + #include +#else #include #include #endif -- cgit 1.4.1 From fe0dca9d96283c363d726025d67ee49aa7da883e Mon Sep 17 00:00:00 2001 From: van Hauser Date: Sat, 26 Dec 2020 21:33:54 +0100 Subject: fixed a few forgotten old afl-llvm-rt references --- utils/afl_frida/GNUmakefile | 2 +- utils/aflpp_driver/aflpp_driver.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'utils') diff --git a/utils/afl_frida/GNUmakefile b/utils/afl_frida/GNUmakefile index c154f3a4..8b56415b 100644 --- a/utils/afl_frida/GNUmakefile +++ b/utils/afl_frida/GNUmakefile @@ -11,7 +11,7 @@ libfrida-gum.a: @exit 1 afl-frida: afl-frida.c libfrida-gum.a - $(CC) -g $(OPT) -o afl-frida -Wno-format -Wno-pointer-sign -I. -fpermissive -fPIC afl-frida.c ../../afl-llvm-rt.o libfrida-gum.a -ldl -lresolv -pthread + $(CC) -g $(OPT) -o afl-frida -Wno-format -Wno-pointer-sign -I. -fpermissive -fPIC afl-frida.c ../../afl-compiler-rt.o libfrida-gum.a -ldl -lresolv -pthread libtestinstr.so: libtestinstr.c $(CC) -g -O0 -fPIC -o libtestinstr.so -shared libtestinstr.c diff --git a/utils/aflpp_driver/aflpp_driver.c b/utils/aflpp_driver/aflpp_driver.c index 017aa72b..c6f5a76c 100644 --- a/utils/aflpp_driver/aflpp_driver.c +++ b/utils/aflpp_driver/aflpp_driver.c @@ -26,10 +26,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { EOF # Build your target with -fsanitize-coverage=trace-pc-guard using fresh clang. clang -g -fsanitize-coverage=trace-pc-guard test_fuzzer.cc -c -# Build afl-llvm-rt.o.c from the AFL distribution. -clang -c -w $AFL_HOME/instrumentation/afl-llvm-rt.o.c -# Build this file, link it with afl-llvm-rt.o.o and the target code. -clang++ afl_driver.cpp test_fuzzer.o afl-llvm-rt.o.o +# Build afl-compiler-rt.o.c from the AFL distribution. +clang -c -w $AFL_HOME/instrumentation/afl-compiler-rt.o.c +# Build this file, link it with afl-compiler-rt.o.o and the target code. +clang++ afl_driver.cpp test_fuzzer.o afl-compiler-rt.o.o # Run AFL: rm -rf IN OUT; mkdir IN OUT; echo z > IN/z; $AFL_HOME/afl-fuzz -i IN -o OUT ./a.out -- cgit 1.4.1 From 2c4b51b437b6b75abc9fde1963daf4f1eea25e5f Mon Sep 17 00:00:00 2001 From: van Hauser Date: Sat, 26 Dec 2020 22:01:49 +0100 Subject: utils/afl_frida is not 5% faster --- docs/Changelog.md | 1 + utils/afl_frida/afl-frida.c | 81 +-------------------------------------------- 2 files changed, 2 insertions(+), 80 deletions(-) (limited to 'utils') diff --git a/docs/Changelog.md b/docs/Changelog.md index c1cd2d5a..a8b8f0af 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -26,6 +26,7 @@ sending a mail to . - LLVM mode is now compiled with -j4, unicorn with all cores. qemu was already building with all cores, the gcc plugin needs only one. - added dummy Makefile to instrumentation/ + - Updated utils/afl_frida to be 5% faster ### Version ++3.00c (release) diff --git a/utils/afl_frida/afl-frida.c b/utils/afl_frida/afl-frida.c index 31bf8f25..e4d442a9 100644 --- a/utils/afl_frida/afl-frida.c +++ b/utils/afl_frida/afl-frida.c @@ -61,55 +61,12 @@ static void *(*o_function)(uint8_t *, int); #include "frida-gum.h" -G_BEGIN_DECLS - -#define GUM_TYPE_FAKE_EVENT_SINK (gum_fake_event_sink_get_type()) -G_DECLARE_FINAL_TYPE(GumFakeEventSink, gum_fake_event_sink, GUM, - FAKE_EVENT_SINK, GObject) - -struct _GumFakeEventSink { - - GObject parent; - GumEventType mask; - -}; - -GumEventSink *gum_fake_event_sink_new(void); -void gum_fake_event_sink_reset(GumFakeEventSink *self); - -G_END_DECLS - -static void gum_fake_event_sink_iface_init(gpointer g_iface, - gpointer iface_data); -static void gum_fake_event_sink_finalize(GObject *obj); -static GumEventType gum_fake_event_sink_query_mask(GumEventSink *sink); -static void gum_fake_event_sink_process(GumEventSink *sink, const GumEvent *ev); void instr_basic_block(GumStalkerIterator *iterator, GumStalkerOutput *output, gpointer user_data); void afl_setup(void); void afl_start_forkserver(void); int __afl_persistent_loop(unsigned int max_cnt); -static void gum_fake_event_sink_class_init(GumFakeEventSinkClass *klass) { - - GObjectClass *object_class = G_OBJECT_CLASS(klass); - object_class->finalize = gum_fake_event_sink_finalize; - -} - -static void gum_fake_event_sink_iface_init(gpointer g_iface, - gpointer iface_data) { - - GumEventSinkInterface *iface = (GumEventSinkInterface *)g_iface; - iface->query_mask = gum_fake_event_sink_query_mask; - iface->process = gum_fake_event_sink_process; - -} - -G_DEFINE_TYPE_EXTENDED(GumFakeEventSink, gum_fake_event_sink, G_TYPE_OBJECT, 0, - G_IMPLEMENT_INTERFACE(GUM_TYPE_EVENT_SINK, - gum_fake_event_sink_iface_init)) - #include "../../config.h" // Shared memory fuzzing. @@ -183,34 +140,6 @@ void instr_basic_block(GumStalkerIterator *iterator, GumStalkerOutput *output, } -static void gum_fake_event_sink_init(GumFakeEventSink *self) { - -} - -static void gum_fake_event_sink_finalize(GObject *obj) { - - G_OBJECT_CLASS(gum_fake_event_sink_parent_class)->finalize(obj); - -} - -GumEventSink *gum_fake_event_sink_new(void) { - - GumFakeEventSink *sink; - sink = (GumFakeEventSink *)g_object_new(GUM_TYPE_FAKE_EVENT_SINK, NULL); - return GUM_EVENT_SINK(sink); - -} - -void gum_fake_event_sink_reset(GumFakeEventSink *self) { - -} - -static GumEventType gum_fake_event_sink_query_mask(GumEventSink *sink) { - - return 0; - -} - typedef struct library_list { uint8_t *name; @@ -402,11 +331,6 @@ library_list_t *find_library(char *name) { } -static void gum_fake_event_sink_process(GumEventSink * sink, - const GumEvent *ev) { - -} - /* Because this CAN be called more than once, it will return the LAST range */ static int enumerate_ranges(const GumRangeDetails *details, gpointer user_data) { @@ -484,8 +408,6 @@ int main() { gum_stalker_transformer_make_from_callback(instr_basic_block, &instr_range, NULL); - GumEventSink *event_sink = gum_fake_event_sink_new(); - // to ensure that the signatures are not optimized out memcpy(__afl_area_ptr, (void *)AFL_PERSISTENT, sizeof(AFL_PERSISTENT) + 1); memcpy(__afl_area_ptr + 32, (void *)AFL_DEFER_FORKSVR, @@ -497,7 +419,7 @@ int main() { // - put that here // - gum_stalker_follow_me(stalker, transformer, event_sink); + gum_stalker_follow_me(stalker, transformer, NULL); while (__afl_persistent_loop(UINT32_MAX) != 0) { @@ -533,7 +455,6 @@ int main() { g_object_unref(stalker); g_object_unref(transformer); - g_object_unref(event_sink); gum_deinit_embedded(); return 0; -- cgit 1.4.1 From 8e2b59ffcab0102e3bebe0c4ed64cb9d36de5559 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Sat, 26 Dec 2020 23:04:21 +0100 Subject: more flexible system support for afl-frida --- src/afl-ld-lto.c | 2 +- utils/afl_frida/afl-frida.c | 227 +++----------------------------------------- 2 files changed, 16 insertions(+), 213 deletions(-) (limited to 'utils') diff --git a/src/afl-ld-lto.c b/src/afl-ld-lto.c index 19491036..fccdb1a5 100644 --- a/src/afl-ld-lto.c +++ b/src/afl-ld-lto.c @@ -46,7 +46,7 @@ #include #ifdef __APPLE__ -#include + #include #endif #define MAX_PARAM_COUNT 4096 diff --git a/utils/afl_frida/afl-frida.c b/utils/afl_frida/afl-frida.c index c8ea656b..b5b8196d 100644 --- a/utils/afl_frida/afl-frida.c +++ b/utils/afl_frida/afl-frida.c @@ -143,197 +143,6 @@ void instr_basic_block(GumStalkerIterator *iterator, GumStalkerOutput *output, } -typedef struct library_list { - - uint8_t *name; - uint64_t addr_start, addr_end; - -} library_list_t; - -#define MAX_LIB_COUNT 256 -static library_list_t liblist[MAX_LIB_COUNT]; -static u32 liblist_cnt; - -void read_library_information() { - -#if defined(__linux__) - FILE *f; - u8 buf[1024], *b, *m, *e, *n; - - if ((f = fopen("/proc/self/maps", "r")) == NULL) { - - fprintf(stderr, "Error: cannot open /proc/self/maps\n"); - exit(-1); - - } - - if (debug) fprintf(stderr, "Library list:\n"); - while (fgets(buf, sizeof(buf), f)) { - - if (strstr(buf, " r-x")) { - - if (liblist_cnt >= MAX_LIB_COUNT) { - - fprintf( - stderr, - "Warning: too many libraries to old, maximum count of %d reached\n", - liblist_cnt); - return; - - } - - b = buf; - m = index(buf, '-'); - e = index(buf, ' '); - if ((n = rindex(buf, '/')) == NULL) n = rindex(buf, ' '); - if (n && - ((*n >= '0' && *n <= '9') || *n == '[' || *n == '{' || *n == '(')) - n = NULL; - else - n++; - if (b && m && e && n && *n) { - - *m++ = 0; - *e = 0; - if (n[strlen(n) - 1] == '\n') n[strlen(n) - 1] = 0; - - if (rindex(n, '/') != NULL) { - - n = rindex(n, '/'); - n++; - - } - - liblist[liblist_cnt].name = strdup(n); - liblist[liblist_cnt].addr_start = strtoull(b, NULL, 16); - liblist[liblist_cnt].addr_end = strtoull(m, NULL, 16); - if (debug) - fprintf( - stderr, "%s:%llx (%llx-%llx)\n", liblist[liblist_cnt].name, - liblist[liblist_cnt].addr_end - liblist[liblist_cnt].addr_start, - liblist[liblist_cnt].addr_start, - liblist[liblist_cnt].addr_end - 1); - liblist_cnt++; - - } - - } - - } - - if (debug) fprintf(stderr, "\n"); - -#elif defined(__FreeBSD__) - int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid()}; - char * buf, *start, *end; - size_t miblen = sizeof(mib) / sizeof(mib[0]); - size_t len; - - if (debug) fprintf(stderr, "Library list:\n"); - if (sysctl(mib, miblen, NULL, &len, NULL, 0) == -1) { return; } - - len = len * 4 / 3; - - buf = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); - if (buf == MAP_FAILED) { return; } - if (sysctl(mib, miblen, buf, &len, NULL, 0) == -1) { - - munmap(buf, len); - return; - - } - - start = buf; - end = buf + len; - - while (start < end) { - - struct kinfo_vmentry *region = (struct kinfo_vmentry *)start; - size_t size = region->kve_structsize; - - if (size == 0) { break; } - - if ((region->kve_protection & KVME_PROT_READ) && - !(region->kve_protection & KVME_PROT_EXEC)) { - - liblist[liblist_cnt].name = - region->kve_path[0] != '\0' ? strdup(region->kve_path) : 0; - liblist[liblist_cnt].addr_start = region->kve_start; - liblist[liblist_cnt].addr_end = region->kve_end; - - if (debug) { - - fprintf(stderr, "%s:%x (%lx-%lx)\n", liblist[liblist_cnt].name, - liblist[liblist_cnt].addr_end - liblist[liblist_cnt].addr_start, - liblist[liblist_cnt].addr_start, - liblist[liblist_cnt].addr_end - 1); - - } - - liblist_cnt++; - - } - - start += size; - - } - -#endif - -} - -library_list_t *find_library(char *name) { - - char *filename = rindex(name, '/'); - - if (filename) - filename++; - else - filename = name; - -#if defined(__linux__) - u32 i; - for (i = 0; i < liblist_cnt; i++) - if (strcmp(liblist[i].name, filename) == 0) return &liblist[i]; -#elif defined(__APPLE__) && defined(__LP64__) - kern_return_t err; - static library_list_t lib; - - // get the list of all loaded modules from dyld - // the task_info mach API will get the address of the dyld all_image_info - // struct for the given task from which we can get the names and load - // addresses of all modules - task_dyld_info_data_t task_dyld_info; - mach_msg_type_number_t count = TASK_DYLD_INFO_COUNT; - err = task_info(mach_task_self(), TASK_DYLD_INFO, - (task_info_t)&task_dyld_info, &count); - - const struct dyld_all_image_infos *all_image_infos = - (const struct dyld_all_image_infos *)task_dyld_info.all_image_info_addr; - const struct dyld_image_info *image_infos = all_image_infos->infoArray; - - for (size_t i = 0; i < all_image_infos->infoArrayCount; i++) { - - const char * image_name = image_infos[i].imageFilePath; - mach_vm_address_t image_load_address = - (mach_vm_address_t)image_infos[i].imageLoadAddress; - if (strstr(image_name, name)) { - - lib.name = name; - lib.addr_start = (u64)image_load_address; - lib.addr_end = 0; - return &lib; - - } - - } - -#endif - - return NULL; - -} - /* Because this CAN be called more than once, it will return the LAST range */ static int enumerate_ranges(const GumRangeDetails *details, gpointer user_data) { @@ -372,16 +181,6 @@ int main() { // END STEP 2 - read_library_information(); - library_list_t *lib = find_library(TARGET_LIBRARY); - - if (lib == NULL) { - - fprintf(stderr, "Could not find target library\n"); - exit(-1); - - } - gum_init_embedded(); if (!gum_stalker_is_supported()) { @@ -392,20 +191,24 @@ int main() { GumStalker *stalker = gum_stalker_new(); - /* - This does not work here as we load a shared library. pretty sure this - would also be easily solvable with frida gum, but I already have all the - code I need from afl-untracer - - GumAddress base_address = gum_module_find_base_address(TARGET_LIBRARY); + GumAddress base_address = gum_module_find_base_address(TARGET_LIBRARY); GumMemoryRange code_range; gum_module_enumerate_ranges(TARGET_LIBRARY, GUM_PAGE_RX, enumerate_ranges, &code_range); - guint64 code_start = code_range.base_address - base_address; - guint64 code_end = (code_range.base_address + code_range.size) - base_address; - range_t instr_range = {base_address, code_start, code_end}; - */ - range_t instr_range = {0, lib->addr_start, lib->addr_end}; + + guint64 code_start = code_range.base_address; + guint64 code_end = code_range.base_address + code_range.size; + range_t instr_range = {0, code_start, code_end}; + + printf("Frida instrumentation: base=0x%lx instrumenting=0x%lx-%lx\n", + base_address, code_start, code_end); + if (!code_start || !code_end) { + + fprintf(stderr, "Error: no valid memory address found for %s\n", + TARGET_LIBRARY); + exit(-1); + + } GumStalkerTransformer *transformer = gum_stalker_transformer_make_from_callback(instr_basic_block, -- cgit 1.4.1 From 108e28ff10c86b81e8f280ac4aa5c5b7269c451a Mon Sep 17 00:00:00 2001 From: van Hauser Date: Mon, 28 Dec 2020 13:53:11 +0100 Subject: fix CFLAGS for extra libs --- utils/libdislocator/Makefile | 2 +- utils/libtokencap/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'utils') diff --git a/utils/libdislocator/Makefile b/utils/libdislocator/Makefile index 2942c3c3..f0b4bb72 100644 --- a/utils/libdislocator/Makefile +++ b/utils/libdislocator/Makefile @@ -19,7 +19,7 @@ HELPER_PATH = $(PREFIX)/lib/afl VERSION = $(shell grep '^\#define VERSION ' ../../config.h | cut -d '"' -f2) CFLAGS ?= -O3 -funroll-loops -D_FORTIFY_SOURCE=2 -CFLAGS += -I ../../include/ -Wall -g -Wno-pointer-sign +override CFLAGS += -I ../../include/ -Wall -g -Wno-pointer-sign CFLAGS_ADD=$(USEHUGEPAGE:1=-DUSEHUGEPAGE) CFLAGS += $(CFLAGS_ADD) diff --git a/utils/libtokencap/Makefile b/utils/libtokencap/Makefile index 8bbdc259..b81e1729 100644 --- a/utils/libtokencap/Makefile +++ b/utils/libtokencap/Makefile @@ -21,7 +21,7 @@ MAN_PATH ?= $(PREFIX)/share/man/man8 VERSION = $(shell grep '^\#define VERSION ' ../../config.h | cut -d '"' -f2) CFLAGS ?= -O3 -funroll-loops -D_FORTIFY_SOURCE=2 -CFLAGS += -I ../../include/ -Wall -g -Wno-pointer-sign +override CFLAGS += -I ../../include/ -Wall -g -Wno-pointer-sign UNAME_S =$(shell uname -s)# GNU make -- cgit 1.4.1 From 935724557f1c9ee59141c7fc4b27c3831ad52435 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Thu, 31 Dec 2020 11:35:32 +0000 Subject: libdislocator, ptr algo warning fix on clang/Xcode (m1). --- utils/libdislocator/libdislocator.so.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'utils') diff --git a/utils/libdislocator/libdislocator.so.c b/utils/libdislocator/libdislocator.so.c index 2324e390..c2b200cb 100644 --- a/utils/libdislocator/libdislocator.so.c +++ b/utils/libdislocator/libdislocator.so.c @@ -345,10 +345,10 @@ void free(void *ptr) { len = PTR_L(ptr); total_mem -= len; + u8 * ptr_ = ptr; if (align_allocations && (len & (ALLOC_ALIGN_SIZE - 1))) { - u8 * ptr_ = ptr; size_t rlen = (len & ~(ALLOC_ALIGN_SIZE - 1)) + ALLOC_ALIGN_SIZE; for (; len < rlen; ++len) if (ptr_[len] != TAIL_ALLOC_CANARY) @@ -359,11 +359,13 @@ void free(void *ptr) { /* Protect everything. Note that the extra page at the end is already set as PROT_NONE, so we don't need to touch that. */ - ptr -= PAGE_SIZE * PG_COUNT(len + 8) - len - 8; + ptr_ -= PAGE_SIZE * PG_COUNT(len + 8) - len - 8; - if (mprotect(ptr - 8, PG_COUNT(len + 8) * PAGE_SIZE, PROT_NONE)) + if (mprotect(ptr_ - 8, PG_COUNT(len + 8) * PAGE_SIZE, PROT_NONE)) FATAL("mprotect() failed when freeing memory"); + ptr = ptr_; + /* Keep the mapping; this is wasteful, but prevents ptr reuse. */ } -- cgit 1.4.1 From 16d2bd31778600dedd3f8ca10f19bce62f14ccb8 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Fri, 1 Jan 2021 13:34:24 +0100 Subject: doc update --- utils/libdislocator/README.md | 2 +- utils/libtokencap/README.md | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'utils') diff --git a/utils/libdislocator/README.md b/utils/libdislocator/README.md index 1785463e..d0340af0 100644 --- a/utils/libdislocator/README.md +++ b/utils/libdislocator/README.md @@ -1,6 +1,6 @@ # libdislocator, an abusive allocator - (See ../README.md for the general instruction manual.) + (See ../../README.md for the general instruction manual.) This is a companion library that can be used as a drop-in replacement for the libc allocator in the fuzzed binaries. It improves the odds of bumping into diff --git a/utils/libtokencap/README.md b/utils/libtokencap/README.md index 13a440da..a39ed3a5 100644 --- a/utils/libtokencap/README.md +++ b/utils/libtokencap/README.md @@ -1,6 +1,11 @@ # strcmp() / memcmp() token capture library - (See ../README.md for the general instruction manual.) + NOTE: libtokencap is only recommended for binary-only targets or targets that + do not compile with afl-clang-fast/afl-clang-lto. + The afl-clang-fast AFL_LLVM_DICT2FILE feature is much better, afl-clang-lto + has that feature automatically integrated. + + (See ../../README.md for the general instruction manual.) This companion library allows you to instrument `strcmp()`, `memcmp()`, and related functions to automatically extract syntax tokens passed to any of -- cgit 1.4.1 From 1857df8d06c48b7d0bf99eee5dea2de595cdf4c5 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Sun, 3 Jan 2021 00:37:56 +0100 Subject: cleanup --- src/afl-fuzz-redqueen.c | 4 +-- utils/aflpp_driver/aflpp_driver.c | 65 ++++----------------------------------- 2 files changed, 8 insertions(+), 61 deletions(-) (limited to 'utils') diff --git a/src/afl-fuzz-redqueen.c b/src/afl-fuzz-redqueen.c index 37d66aef..df215e9c 100644 --- a/src/afl-fuzz-redqueen.c +++ b/src/afl-fuzz-redqueen.c @@ -802,13 +802,13 @@ u8 input_to_state_stage(afl_state_t *afl, u8 *orig_buf, u8 *buf, u32 len, u64 exec_cksum) { u8 r = 1; - if (afl->orig_cmp_map == NULL) { + if (unlikely(!afl->orig_cmp_map)) { afl->orig_cmp_map = ck_alloc_nozero(sizeof(struct cmp_map)); } - if (afl->pass_stats == NULL) { + if (unlikely(!afl->pass_stats)) { afl->pass_stats = ck_alloc(sizeof(struct afl_pass_stat) * CMP_MAP_W); diff --git a/utils/aflpp_driver/aflpp_driver.c b/utils/aflpp_driver/aflpp_driver.c index c6f5a76c..30e6ebb9 100644 --- a/utils/aflpp_driver/aflpp_driver.c +++ b/utils/aflpp_driver/aflpp_driver.c @@ -1,12 +1,8 @@ -//===- afl_driver.cpp - a glue between AFL and libFuzzer --------*- C++ -* ===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +//===- afl_driver.cpp - a glue between AFL++ and libFuzzer ------*- C++ -* ===// //===----------------------------------------------------------------------===// /* This file allows to fuzz libFuzzer-style target functions - (LLVMFuzzerTestOneInput) with AFL using AFL's persistent (in-process) mode. + (LLVMFuzzerTestOneInput) with AFL++ using persistent in-memory fuzzing. Usage: ################################################################################ @@ -25,25 +21,17 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { EOF # Build your target with -fsanitize-coverage=trace-pc-guard using fresh clang. -clang -g -fsanitize-coverage=trace-pc-guard test_fuzzer.cc -c +clang -c aflpp_driver.c # Build afl-compiler-rt.o.c from the AFL distribution. -clang -c -w $AFL_HOME/instrumentation/afl-compiler-rt.o.c +clang -c $AFL_HOME/instrumentation/afl-compiler-rt.o.c # Build this file, link it with afl-compiler-rt.o.o and the target code. -clang++ afl_driver.cpp test_fuzzer.o afl-compiler-rt.o.o +afl-clang-fast -o test_fuzzer test_fuzzer.cc afl-compiler-rt.o aflpp_driver.o # Run AFL: rm -rf IN OUT; mkdir IN OUT; echo z > IN/z; $AFL_HOME/afl-fuzz -i IN -o OUT ./a.out ################################################################################ -AFL_DRIVER_STDERR_DUPLICATE_FILENAME: Setting this *appends* stderr to the file -specified. If the file does not exist, it is created. This is useful for getting -stack traces (when using ASAN for example) or original error messages on hard -to reproduce bugs. Note that any content written to stderr will be written to -this file instead of stderr's usual location. - -AFL_DRIVER_CLOSE_FD_MASK: Similar to libFuzzer's -close_fd_mask behavior option. -If 1, close stdout at startup. If 2 close stderr; if 3 close both. - */ + #include #include #include @@ -65,47 +53,6 @@ If 1, close stdout at startup. If 2 close stderr; if 3 close both. #include "hash.h" #endif -#ifndef MAP_FIXED_NOREPLACE - #define MAP_FIXED_NOREPLACE 0x100000 -#endif - -#define MAX_DUMMY_SIZE 256000 - -// Platform detection. Copied from FuzzerInternal.h -#ifdef __linux__ - #define LIBFUZZER_LINUX 1 - #define LIBFUZZER_APPLE 0 - #define LIBFUZZER_NETBSD 0 - #define LIBFUZZER_FREEBSD 0 - #define LIBFUZZER_OPENBSD 0 -#elif __APPLE__ - #define LIBFUZZER_LINUX 0 - #define LIBFUZZER_APPLE 1 - #define LIBFUZZER_NETBSD 0 - #define LIBFUZZER_FREEBSD 0 - #define LIBFUZZER_OPENBSD 0 -#elif __NetBSD__ - #define LIBFUZZER_LINUX 0 - #define LIBFUZZER_APPLE 0 - #define LIBFUZZER_NETBSD 1 - #define LIBFUZZER_FREEBSD 0 - #define LIBFUZZER_OPENBSD 0 -#elif __FreeBSD__ - #define LIBFUZZER_LINUX 0 - #define LIBFUZZER_APPLE 0 - #define LIBFUZZER_NETBSD 0 - #define LIBFUZZER_FREEBSD 1 - #define LIBFUZZER_OPENBSD 0 -#elif __OpenBSD__ - #define LIBFUZZER_LINUX 0 - #define LIBFUZZER_APPLE 0 - #define LIBFUZZER_NETBSD 0 - #define LIBFUZZER_FREEBSD 0 - #define LIBFUZZER_OPENBSD 1 -#else - #error "Support for your platform has not been implemented" -#endif - int __afl_sharedmem_fuzzing = 1; extern unsigned int * __afl_fuzz_len; extern unsigned char *__afl_fuzz_ptr; -- cgit 1.4.1 From 880513651d271db538eeb3f04d046cf9ce6021f8 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Sun, 3 Jan 2021 10:13:55 +0100 Subject: cmplog cleanup --- include/afl-fuzz.h | 4 ++-- src/afl-fuzz-redqueen.c | 40 +++------------------------------- utils/libdislocator/libdislocator.so.c | 2 +- 3 files changed, 6 insertions(+), 40 deletions(-) (limited to 'utils') diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h index a99e4991..d6a322cc 100644 --- a/include/afl-fuzz.h +++ b/include/afl-fuzz.h @@ -590,9 +590,9 @@ typedef struct afl_state { u32 rand_cnt; /* Random number counter */ -/* unsigned long rand_seed[3]; would also work */ + /* unsigned long rand_seed[3]; would also work */ AFL_RAND_RETURN rand_seed[3]; - s64 init_seed; + s64 init_seed; u64 total_cal_us, /* Total calibration time (us) */ total_cal_cycles; /* Total calibration cycles */ diff --git a/src/afl-fuzz-redqueen.c b/src/afl-fuzz-redqueen.c index df215e9c..bbd47ab2 100644 --- a/src/afl-fuzz-redqueen.c +++ b/src/afl-fuzz-redqueen.c @@ -99,12 +99,12 @@ static u8 get_exec_checksum(afl_state_t *afl, u8 *buf, u32 len, u64 *cksum) { } -static void rand_replace(afl_state_t *afl, u8 *buf, u32 len) { +static void xor_replace(u8 *buf, u32 len) { u32 i; for (i = 0; i < len; ++i) { - buf[i] = rand_below(afl, 256); + buf[i] ^= 0xff; } @@ -115,8 +115,6 @@ static u8 colorization(afl_state_t *afl, u8 *buf, u32 len, u64 exec_cksum) { struct range *ranges = add_range(NULL, 0, len); u8 * backup = ck_alloc_nozero(len); - u8 needs_write = 0; - u64 orig_hit_cnt, new_hit_cnt; orig_hit_cnt = afl->queued_paths + afl->unique_crashes; @@ -136,7 +134,7 @@ static u8 colorization(afl_state_t *afl, u8 *buf, u32 len, u64 exec_cksum) { /* Range not empty */ memcpy(backup, buf + rng->start, s); - rand_replace(afl, buf + rng->start, s); + xor_replace(buf + rng->start, s); u64 cksum; u64 start_us = get_cur_time_us(); @@ -158,10 +156,6 @@ static u8 colorization(afl_state_t *afl, u8 *buf, u32 len, u64 exec_cksum) { ranges = add_range(ranges, rng->start + s / 2 + 1, rng->end); memcpy(buf + rng->start, backup, s); - } else { - - needs_write = 1; - } } @@ -191,32 +185,6 @@ static u8 colorization(afl_state_t *afl, u8 *buf, u32 len, u64 exec_cksum) { } - // save the input with the high entropy - - if (needs_write) { - - s32 fd; - - if (afl->no_unlink) { - - fd = open(afl->queue_cur->fname, O_WRONLY | O_CREAT | O_TRUNC, 0600); - - } else { - - unlink(afl->queue_cur->fname); /* ignore errors */ - fd = open(afl->queue_cur->fname, O_WRONLY | O_CREAT | O_EXCL, 0600); - - } - - if (fd < 0) { PFATAL("Unable to create '%s'", afl->queue_cur->fname); } - - ck_write(fd, buf, len, afl->queue_cur->fname); - afl->queue_cur->len = len; // no-op, just to be 100% safe - - close(fd); - - } - return 0; checksum_fail: @@ -232,8 +200,6 @@ checksum_fail: } - // TODO: clang notices a _potential_ leak of mem pointed to by rng - return 1; } diff --git a/utils/libdislocator/libdislocator.so.c b/utils/libdislocator/libdislocator.so.c index c2b200cb..c041fec6 100644 --- a/utils/libdislocator/libdislocator.so.c +++ b/utils/libdislocator/libdislocator.so.c @@ -345,7 +345,7 @@ void free(void *ptr) { len = PTR_L(ptr); total_mem -= len; - u8 * ptr_ = ptr; + u8 *ptr_ = ptr; if (align_allocations && (len & (ALLOC_ALIGN_SIZE - 1))) { -- cgit 1.4.1 From 33a7d6f1688856c050b0ac71ac1df4018e4d531c Mon Sep 17 00:00:00 2001 From: hexcoder- Date: Mon, 4 Jan 2021 15:14:20 +0100 Subject: code cleanups (from cppcheck) --- custom_mutators/honggfuzz/mangle.c | 2 +- custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp | 10 +++++----- custom_mutators/libfuzzer/FuzzerDefs.h | 2 +- custom_mutators/libfuzzer/FuzzerDictionary.h | 4 ++-- custom_mutators/libfuzzer/FuzzerRandom.h | 2 +- custom_mutators/libfuzzer/FuzzerTracePC.h | 8 ++++---- include/debug.h | 6 +++--- unicorn_mode/unicornafl | 2 +- utils/defork/defork.c | 2 +- utils/persistent_mode/Makefile | 8 ++++---- utils/qemu_persistent_hook/test.c | 2 +- 11 files changed, 24 insertions(+), 24 deletions(-) (limited to 'utils') diff --git a/custom_mutators/honggfuzz/mangle.c b/custom_mutators/honggfuzz/mangle.c index c2988319..9c3d1ed4 100644 --- a/custom_mutators/honggfuzz/mangle.c +++ b/custom_mutators/honggfuzz/mangle.c @@ -995,7 +995,7 @@ void mangle_mangleContent(run_t *run, int speed_factor) { } - uint64_t changesCnt = run->global->mutate.mutationsPerRun; + uint64_t changesCnt; if (speed_factor < 5) { diff --git a/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp b/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp index 797a52a7..489665f7 100644 --- a/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp +++ b/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp @@ -246,7 +246,7 @@ bool DataFlowTrace::Init(const std::string &DirPath, std::string *FocusFunction, } - if (!NumFunctions || FocusFuncIdx == SIZE_MAX || Files.size() <= 1) + if (FocusFuncIdx == SIZE_MAX || Files.size() <= 1) return false; // Read traces. @@ -259,8 +259,8 @@ bool DataFlowTrace::Init(const std::string &DirPath, std::string *FocusFunction, if (!CorporaHashes.count(Name)) continue; // not in the corpus. NumTraceFiles++; // Printf("=== %s\n", Name.c_str()); - std::ifstream IF(SF.File); - while (std::getline(IF, L, '\n')) { + std::ifstream IF2(SF.File); + while (std::getline(IF2, L, '\n')) { size_t FunctionNum = 0; std::string DFTString; @@ -314,8 +314,8 @@ int CollectDataFlow(const std::string &DFTBinary, const std::string &DirPath, // we then request tags in [0,Size/2) and [Size/2, Size), and so on. // Function number => DFT. auto OutPath = DirPlusFile(DirPath, Hash(FileToVector(F.File))); - std::unordered_map> DFTMap; - std::unordered_set Cov; +// std::unordered_map> DFTMap; +// std::unordered_set Cov; Command Cmd; Cmd.addArgument(DFTBinary); Cmd.addArgument(F.File); diff --git a/custom_mutators/libfuzzer/FuzzerDefs.h b/custom_mutators/libfuzzer/FuzzerDefs.h index 1a2752af..3952ac51 100644 --- a/custom_mutators/libfuzzer/FuzzerDefs.h +++ b/custom_mutators/libfuzzer/FuzzerDefs.h @@ -46,7 +46,7 @@ template fuzzer_allocator() = default; template - fuzzer_allocator(const fuzzer_allocator&) {} + explicit fuzzer_allocator(const fuzzer_allocator&) {} template struct rebind { typedef fuzzer_allocator other; }; diff --git a/custom_mutators/libfuzzer/FuzzerDictionary.h b/custom_mutators/libfuzzer/FuzzerDictionary.h index 301c5d9a..ddd2d2f1 100644 --- a/custom_mutators/libfuzzer/FuzzerDictionary.h +++ b/custom_mutators/libfuzzer/FuzzerDictionary.h @@ -49,7 +49,7 @@ typedef FixedWord<64> Word; class DictionaryEntry { public: DictionaryEntry() {} - DictionaryEntry(Word W) : W(W) {} + explicit DictionaryEntry(Word W) : W(W) {} DictionaryEntry(Word W, size_t PositionHint) : W(W), PositionHint(PositionHint) {} const Word &GetW() const { return W; } @@ -92,7 +92,7 @@ class Dictionary { assert(Idx < Size); return DE[Idx]; } - void push_back(DictionaryEntry DE) { + void push_back(const DictionaryEntry &DE) { if (Size < kMaxDictSize) this->DE[Size++] = DE; } diff --git a/custom_mutators/libfuzzer/FuzzerRandom.h b/custom_mutators/libfuzzer/FuzzerRandom.h index 659283ee..7b1e1b1d 100644 --- a/custom_mutators/libfuzzer/FuzzerRandom.h +++ b/custom_mutators/libfuzzer/FuzzerRandom.h @@ -16,7 +16,7 @@ namespace fuzzer { class Random : public std::minstd_rand { public: - Random(unsigned int seed) : std::minstd_rand(seed) {} + explicit Random(unsigned int seed) : std::minstd_rand(seed) {} result_type operator()() { return this->std::minstd_rand::operator()(); } size_t Rand() { return this->operator()(); } size_t RandBool() { return Rand() % 2; } diff --git a/custom_mutators/libfuzzer/FuzzerTracePC.h b/custom_mutators/libfuzzer/FuzzerTracePC.h index 4601300c..a58fdf8d 100644 --- a/custom_mutators/libfuzzer/FuzzerTracePC.h +++ b/custom_mutators/libfuzzer/FuzzerTracePC.h @@ -145,10 +145,10 @@ private: }; Region *Regions; size_t NumRegions; - uint8_t *Start() { return Regions[0].Start; } - uint8_t *Stop() { return Regions[NumRegions - 1].Stop; } - size_t Size() { return Stop() - Start(); } - size_t Idx(uint8_t *P) { + uint8_t *Start() const { return Regions[0].Start; } + uint8_t *Stop() const { return Regions[NumRegions - 1].Stop; } + size_t Size() const { return Stop() - Start(); } + size_t Idx(uint8_t *P) const { assert(P >= Start() && P < Stop()); return P - Start(); } diff --git a/include/debug.h b/include/debug.h index 7f4a6be1..ef5b195b 100644 --- a/include/debug.h +++ b/include/debug.h @@ -295,7 +295,7 @@ static inline const char *colorfilter(const char *x) { \ SAYF(bSTOP RESET_G1 CURSOR_SHOW cRST cLRD \ "\n[-] PROGRAM ABORT : " cRST x); \ - SAYF(cLRD "\n Location : " cRST "%s(), %s:%u\n\n", __func__, \ + SAYF(cLRD "\n Location : " cRST "%s(), %s:%d\n\n", __func__, \ __FILE__, __LINE__); \ exit(1); \ \ @@ -308,7 +308,7 @@ static inline const char *colorfilter(const char *x) { \ SAYF(bSTOP RESET_G1 CURSOR_SHOW cRST cLRD \ "\n[-] PROGRAM ABORT : " cRST x); \ - SAYF(cLRD "\n Stop location : " cRST "%s(), %s:%u\n\n", __func__, \ + SAYF(cLRD "\n Stop location : " cRST "%s(), %s:%d\n\n", __func__, \ __FILE__, __LINE__); \ abort(); \ \ @@ -322,7 +322,7 @@ static inline const char *colorfilter(const char *x) { fflush(stdout); \ SAYF(bSTOP RESET_G1 CURSOR_SHOW cRST cLRD \ "\n[-] SYSTEM ERROR : " cRST x); \ - SAYF(cLRD "\n Stop location : " cRST "%s(), %s:%u\n", __func__, \ + SAYF(cLRD "\n Stop location : " cRST "%s(), %s:%d\n", __func__, \ __FILE__, __LINE__); \ SAYF(cLRD " OS message : " cRST "%s\n", strerror(errno)); \ exit(1); \ diff --git a/unicorn_mode/unicornafl b/unicorn_mode/unicornafl index 8cca4801..768e6bb2 160000 --- a/unicorn_mode/unicornafl +++ b/unicorn_mode/unicornafl @@ -1 +1 @@ -Subproject commit 8cca4801adb767dce7cf72202d7d25bdb420cf7d +Subproject commit 768e6bb29b7cb98bb2b9c4526ae3d234db5c1615 diff --git a/utils/defork/defork.c b/utils/defork/defork.c index f71d1124..f50b9a4b 100644 --- a/utils/defork/defork.c +++ b/utils/defork/defork.c @@ -1,4 +1,4 @@ -#define __GNU_SOURCE +#define _GNU_SOURCE #include #include #include diff --git a/utils/persistent_mode/Makefile b/utils/persistent_mode/Makefile index 6fa1c30e..e348c46c 100644 --- a/utils/persistent_mode/Makefile +++ b/utils/persistent_mode/Makefile @@ -1,10 +1,10 @@ all: - afl-clang-fast -o persistent_demo persistent_demo.c - afl-clang-fast -o persistent_demo_new persistent_demo_new.c - AFL_DONT_OPTIMIZE=1 afl-clang-fast -o test-instr test-instr.c + ../../afl-clang-fast -o persistent_demo persistent_demo.c + ../../afl-clang-fast -o persistent_demo_new persistent_demo_new.c + AFL_DONT_OPTIMIZE=1 ../../afl-clang-fast -o test-instr test-instr.c document: - AFL_DONT_OPTIMIZE=1 afl-clang-fast -D_AFL_DOCUMENT_MUTATIONS -o test-instr test-instr.c + AFL_DONT_OPTIMIZE=1 ../../afl-clang-fast -D_AFL_DOCUMENT_MUTATIONS -o test-instr test-instr.c clean: rm -f persistent_demo persistent_demo_new test-instr diff --git a/utils/qemu_persistent_hook/test.c b/utils/qemu_persistent_hook/test.c index afeff202..a0e815dc 100644 --- a/utils/qemu_persistent_hook/test.c +++ b/utils/qemu_persistent_hook/test.c @@ -2,7 +2,7 @@ int target_func(unsigned char *buf, int size) { - printf("buffer:%p, size:%p\n", buf, size); + printf("buffer:%p, size:%d\n", buf, size); switch (buf[0]) { case 1: -- cgit 1.4.1 From 5cdbfeef4a84b9dc2e5f8e88ee018c6c6e72fa44 Mon Sep 17 00:00:00 2001 From: hexcoder- Date: Mon, 4 Jan 2021 15:17:39 +0100 Subject: Revert "code cleanups (from cppcheck)" This reverts commit 33a7d6f1688856c050b0ac71ac1df4018e4d531c. --- custom_mutators/honggfuzz/mangle.c | 2 +- custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp | 10 +++++----- custom_mutators/libfuzzer/FuzzerDefs.h | 2 +- custom_mutators/libfuzzer/FuzzerDictionary.h | 4 ++-- custom_mutators/libfuzzer/FuzzerRandom.h | 2 +- custom_mutators/libfuzzer/FuzzerTracePC.h | 8 ++++---- include/debug.h | 6 +++--- unicorn_mode/unicornafl | 2 +- utils/defork/defork.c | 2 +- utils/persistent_mode/Makefile | 8 ++++---- utils/qemu_persistent_hook/test.c | 2 +- 11 files changed, 24 insertions(+), 24 deletions(-) (limited to 'utils') diff --git a/custom_mutators/honggfuzz/mangle.c b/custom_mutators/honggfuzz/mangle.c index 9c3d1ed4..c2988319 100644 --- a/custom_mutators/honggfuzz/mangle.c +++ b/custom_mutators/honggfuzz/mangle.c @@ -995,7 +995,7 @@ void mangle_mangleContent(run_t *run, int speed_factor) { } - uint64_t changesCnt; + uint64_t changesCnt = run->global->mutate.mutationsPerRun; if (speed_factor < 5) { diff --git a/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp b/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp index 489665f7..797a52a7 100644 --- a/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp +++ b/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp @@ -246,7 +246,7 @@ bool DataFlowTrace::Init(const std::string &DirPath, std::string *FocusFunction, } - if (FocusFuncIdx == SIZE_MAX || Files.size() <= 1) + if (!NumFunctions || FocusFuncIdx == SIZE_MAX || Files.size() <= 1) return false; // Read traces. @@ -259,8 +259,8 @@ bool DataFlowTrace::Init(const std::string &DirPath, std::string *FocusFunction, if (!CorporaHashes.count(Name)) continue; // not in the corpus. NumTraceFiles++; // Printf("=== %s\n", Name.c_str()); - std::ifstream IF2(SF.File); - while (std::getline(IF2, L, '\n')) { + std::ifstream IF(SF.File); + while (std::getline(IF, L, '\n')) { size_t FunctionNum = 0; std::string DFTString; @@ -314,8 +314,8 @@ int CollectDataFlow(const std::string &DFTBinary, const std::string &DirPath, // we then request tags in [0,Size/2) and [Size/2, Size), and so on. // Function number => DFT. auto OutPath = DirPlusFile(DirPath, Hash(FileToVector(F.File))); -// std::unordered_map> DFTMap; -// std::unordered_set Cov; + std::unordered_map> DFTMap; + std::unordered_set Cov; Command Cmd; Cmd.addArgument(DFTBinary); Cmd.addArgument(F.File); diff --git a/custom_mutators/libfuzzer/FuzzerDefs.h b/custom_mutators/libfuzzer/FuzzerDefs.h index 3952ac51..1a2752af 100644 --- a/custom_mutators/libfuzzer/FuzzerDefs.h +++ b/custom_mutators/libfuzzer/FuzzerDefs.h @@ -46,7 +46,7 @@ template fuzzer_allocator() = default; template - explicit fuzzer_allocator(const fuzzer_allocator&) {} + fuzzer_allocator(const fuzzer_allocator&) {} template struct rebind { typedef fuzzer_allocator other; }; diff --git a/custom_mutators/libfuzzer/FuzzerDictionary.h b/custom_mutators/libfuzzer/FuzzerDictionary.h index ddd2d2f1..301c5d9a 100644 --- a/custom_mutators/libfuzzer/FuzzerDictionary.h +++ b/custom_mutators/libfuzzer/FuzzerDictionary.h @@ -49,7 +49,7 @@ typedef FixedWord<64> Word; class DictionaryEntry { public: DictionaryEntry() {} - explicit DictionaryEntry(Word W) : W(W) {} + DictionaryEntry(Word W) : W(W) {} DictionaryEntry(Word W, size_t PositionHint) : W(W), PositionHint(PositionHint) {} const Word &GetW() const { return W; } @@ -92,7 +92,7 @@ class Dictionary { assert(Idx < Size); return DE[Idx]; } - void push_back(const DictionaryEntry &DE) { + void push_back(DictionaryEntry DE) { if (Size < kMaxDictSize) this->DE[Size++] = DE; } diff --git a/custom_mutators/libfuzzer/FuzzerRandom.h b/custom_mutators/libfuzzer/FuzzerRandom.h index 7b1e1b1d..659283ee 100644 --- a/custom_mutators/libfuzzer/FuzzerRandom.h +++ b/custom_mutators/libfuzzer/FuzzerRandom.h @@ -16,7 +16,7 @@ namespace fuzzer { class Random : public std::minstd_rand { public: - explicit Random(unsigned int seed) : std::minstd_rand(seed) {} + Random(unsigned int seed) : std::minstd_rand(seed) {} result_type operator()() { return this->std::minstd_rand::operator()(); } size_t Rand() { return this->operator()(); } size_t RandBool() { return Rand() % 2; } diff --git a/custom_mutators/libfuzzer/FuzzerTracePC.h b/custom_mutators/libfuzzer/FuzzerTracePC.h index a58fdf8d..4601300c 100644 --- a/custom_mutators/libfuzzer/FuzzerTracePC.h +++ b/custom_mutators/libfuzzer/FuzzerTracePC.h @@ -145,10 +145,10 @@ private: }; Region *Regions; size_t NumRegions; - uint8_t *Start() const { return Regions[0].Start; } - uint8_t *Stop() const { return Regions[NumRegions - 1].Stop; } - size_t Size() const { return Stop() - Start(); } - size_t Idx(uint8_t *P) const { + uint8_t *Start() { return Regions[0].Start; } + uint8_t *Stop() { return Regions[NumRegions - 1].Stop; } + size_t Size() { return Stop() - Start(); } + size_t Idx(uint8_t *P) { assert(P >= Start() && P < Stop()); return P - Start(); } diff --git a/include/debug.h b/include/debug.h index ef5b195b..7f4a6be1 100644 --- a/include/debug.h +++ b/include/debug.h @@ -295,7 +295,7 @@ static inline const char *colorfilter(const char *x) { \ SAYF(bSTOP RESET_G1 CURSOR_SHOW cRST cLRD \ "\n[-] PROGRAM ABORT : " cRST x); \ - SAYF(cLRD "\n Location : " cRST "%s(), %s:%d\n\n", __func__, \ + SAYF(cLRD "\n Location : " cRST "%s(), %s:%u\n\n", __func__, \ __FILE__, __LINE__); \ exit(1); \ \ @@ -308,7 +308,7 @@ static inline const char *colorfilter(const char *x) { \ SAYF(bSTOP RESET_G1 CURSOR_SHOW cRST cLRD \ "\n[-] PROGRAM ABORT : " cRST x); \ - SAYF(cLRD "\n Stop location : " cRST "%s(), %s:%d\n\n", __func__, \ + SAYF(cLRD "\n Stop location : " cRST "%s(), %s:%u\n\n", __func__, \ __FILE__, __LINE__); \ abort(); \ \ @@ -322,7 +322,7 @@ static inline const char *colorfilter(const char *x) { fflush(stdout); \ SAYF(bSTOP RESET_G1 CURSOR_SHOW cRST cLRD \ "\n[-] SYSTEM ERROR : " cRST x); \ - SAYF(cLRD "\n Stop location : " cRST "%s(), %s:%d\n", __func__, \ + SAYF(cLRD "\n Stop location : " cRST "%s(), %s:%u\n", __func__, \ __FILE__, __LINE__); \ SAYF(cLRD " OS message : " cRST "%s\n", strerror(errno)); \ exit(1); \ diff --git a/unicorn_mode/unicornafl b/unicorn_mode/unicornafl index 768e6bb2..8cca4801 160000 --- a/unicorn_mode/unicornafl +++ b/unicorn_mode/unicornafl @@ -1 +1 @@ -Subproject commit 768e6bb29b7cb98bb2b9c4526ae3d234db5c1615 +Subproject commit 8cca4801adb767dce7cf72202d7d25bdb420cf7d diff --git a/utils/defork/defork.c b/utils/defork/defork.c index f50b9a4b..f71d1124 100644 --- a/utils/defork/defork.c +++ b/utils/defork/defork.c @@ -1,4 +1,4 @@ -#define _GNU_SOURCE +#define __GNU_SOURCE #include #include #include diff --git a/utils/persistent_mode/Makefile b/utils/persistent_mode/Makefile index e348c46c..6fa1c30e 100644 --- a/utils/persistent_mode/Makefile +++ b/utils/persistent_mode/Makefile @@ -1,10 +1,10 @@ all: - ../../afl-clang-fast -o persistent_demo persistent_demo.c - ../../afl-clang-fast -o persistent_demo_new persistent_demo_new.c - AFL_DONT_OPTIMIZE=1 ../../afl-clang-fast -o test-instr test-instr.c + afl-clang-fast -o persistent_demo persistent_demo.c + afl-clang-fast -o persistent_demo_new persistent_demo_new.c + AFL_DONT_OPTIMIZE=1 afl-clang-fast -o test-instr test-instr.c document: - AFL_DONT_OPTIMIZE=1 ../../afl-clang-fast -D_AFL_DOCUMENT_MUTATIONS -o test-instr test-instr.c + AFL_DONT_OPTIMIZE=1 afl-clang-fast -D_AFL_DOCUMENT_MUTATIONS -o test-instr test-instr.c clean: rm -f persistent_demo persistent_demo_new test-instr diff --git a/utils/qemu_persistent_hook/test.c b/utils/qemu_persistent_hook/test.c index a0e815dc..afeff202 100644 --- a/utils/qemu_persistent_hook/test.c +++ b/utils/qemu_persistent_hook/test.c @@ -2,7 +2,7 @@ int target_func(unsigned char *buf, int size) { - printf("buffer:%p, size:%d\n", buf, size); + printf("buffer:%p, size:%p\n", buf, size); switch (buf[0]) { case 1: -- cgit 1.4.1 From b7af98e94561ebe44ea37304a357b00499d1104d Mon Sep 17 00:00:00 2001 From: hexcoder- Date: Mon, 4 Jan 2021 15:32:22 +0100 Subject: code cleanups (from cppcheck mostly) --- custom_mutators/honggfuzz/mangle.c | 2 +- custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp | 10 +++++----- custom_mutators/libfuzzer/FuzzerDefs.h | 2 +- custom_mutators/libfuzzer/FuzzerDictionary.h | 4 ++-- custom_mutators/libfuzzer/FuzzerRandom.h | 2 +- custom_mutators/libfuzzer/FuzzerTracePC.h | 8 ++++---- include/debug.h | 6 +++--- utils/defork/defork.c | 2 +- utils/persistent_mode/Makefile | 8 ++++---- utils/qemu_persistent_hook/test.c | 2 +- 10 files changed, 23 insertions(+), 23 deletions(-) (limited to 'utils') diff --git a/custom_mutators/honggfuzz/mangle.c b/custom_mutators/honggfuzz/mangle.c index c2988319..9c3d1ed4 100644 --- a/custom_mutators/honggfuzz/mangle.c +++ b/custom_mutators/honggfuzz/mangle.c @@ -995,7 +995,7 @@ void mangle_mangleContent(run_t *run, int speed_factor) { } - uint64_t changesCnt = run->global->mutate.mutationsPerRun; + uint64_t changesCnt; if (speed_factor < 5) { diff --git a/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp b/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp index 797a52a7..489665f7 100644 --- a/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp +++ b/custom_mutators/libfuzzer/FuzzerDataFlowTrace.cpp @@ -246,7 +246,7 @@ bool DataFlowTrace::Init(const std::string &DirPath, std::string *FocusFunction, } - if (!NumFunctions || FocusFuncIdx == SIZE_MAX || Files.size() <= 1) + if (FocusFuncIdx == SIZE_MAX || Files.size() <= 1) return false; // Read traces. @@ -259,8 +259,8 @@ bool DataFlowTrace::Init(const std::string &DirPath, std::string *FocusFunction, if (!CorporaHashes.count(Name)) continue; // not in the corpus. NumTraceFiles++; // Printf("=== %s\n", Name.c_str()); - std::ifstream IF(SF.File); - while (std::getline(IF, L, '\n')) { + std::ifstream IF2(SF.File); + while (std::getline(IF2, L, '\n')) { size_t FunctionNum = 0; std::string DFTString; @@ -314,8 +314,8 @@ int CollectDataFlow(const std::string &DFTBinary, const std::string &DirPath, // we then request tags in [0,Size/2) and [Size/2, Size), and so on. // Function number => DFT. auto OutPath = DirPlusFile(DirPath, Hash(FileToVector(F.File))); - std::unordered_map> DFTMap; - std::unordered_set Cov; +// std::unordered_map> DFTMap; +// std::unordered_set Cov; Command Cmd; Cmd.addArgument(DFTBinary); Cmd.addArgument(F.File); diff --git a/custom_mutators/libfuzzer/FuzzerDefs.h b/custom_mutators/libfuzzer/FuzzerDefs.h index 1a2752af..3952ac51 100644 --- a/custom_mutators/libfuzzer/FuzzerDefs.h +++ b/custom_mutators/libfuzzer/FuzzerDefs.h @@ -46,7 +46,7 @@ template fuzzer_allocator() = default; template - fuzzer_allocator(const fuzzer_allocator&) {} + explicit fuzzer_allocator(const fuzzer_allocator&) {} template struct rebind { typedef fuzzer_allocator other; }; diff --git a/custom_mutators/libfuzzer/FuzzerDictionary.h b/custom_mutators/libfuzzer/FuzzerDictionary.h index 301c5d9a..ddd2d2f1 100644 --- a/custom_mutators/libfuzzer/FuzzerDictionary.h +++ b/custom_mutators/libfuzzer/FuzzerDictionary.h @@ -49,7 +49,7 @@ typedef FixedWord<64> Word; class DictionaryEntry { public: DictionaryEntry() {} - DictionaryEntry(Word W) : W(W) {} + explicit DictionaryEntry(Word W) : W(W) {} DictionaryEntry(Word W, size_t PositionHint) : W(W), PositionHint(PositionHint) {} const Word &GetW() const { return W; } @@ -92,7 +92,7 @@ class Dictionary { assert(Idx < Size); return DE[Idx]; } - void push_back(DictionaryEntry DE) { + void push_back(const DictionaryEntry &DE) { if (Size < kMaxDictSize) this->DE[Size++] = DE; } diff --git a/custom_mutators/libfuzzer/FuzzerRandom.h b/custom_mutators/libfuzzer/FuzzerRandom.h index 659283ee..7b1e1b1d 100644 --- a/custom_mutators/libfuzzer/FuzzerRandom.h +++ b/custom_mutators/libfuzzer/FuzzerRandom.h @@ -16,7 +16,7 @@ namespace fuzzer { class Random : public std::minstd_rand { public: - Random(unsigned int seed) : std::minstd_rand(seed) {} + explicit Random(unsigned int seed) : std::minstd_rand(seed) {} result_type operator()() { return this->std::minstd_rand::operator()(); } size_t Rand() { return this->operator()(); } size_t RandBool() { return Rand() % 2; } diff --git a/custom_mutators/libfuzzer/FuzzerTracePC.h b/custom_mutators/libfuzzer/FuzzerTracePC.h index 4601300c..a58fdf8d 100644 --- a/custom_mutators/libfuzzer/FuzzerTracePC.h +++ b/custom_mutators/libfuzzer/FuzzerTracePC.h @@ -145,10 +145,10 @@ private: }; Region *Regions; size_t NumRegions; - uint8_t *Start() { return Regions[0].Start; } - uint8_t *Stop() { return Regions[NumRegions - 1].Stop; } - size_t Size() { return Stop() - Start(); } - size_t Idx(uint8_t *P) { + uint8_t *Start() const { return Regions[0].Start; } + uint8_t *Stop() const { return Regions[NumRegions - 1].Stop; } + size_t Size() const { return Stop() - Start(); } + size_t Idx(uint8_t *P) const { assert(P >= Start() && P < Stop()); return P - Start(); } diff --git a/include/debug.h b/include/debug.h index 7f4a6be1..ef5b195b 100644 --- a/include/debug.h +++ b/include/debug.h @@ -295,7 +295,7 @@ static inline const char *colorfilter(const char *x) { \ SAYF(bSTOP RESET_G1 CURSOR_SHOW cRST cLRD \ "\n[-] PROGRAM ABORT : " cRST x); \ - SAYF(cLRD "\n Location : " cRST "%s(), %s:%u\n\n", __func__, \ + SAYF(cLRD "\n Location : " cRST "%s(), %s:%d\n\n", __func__, \ __FILE__, __LINE__); \ exit(1); \ \ @@ -308,7 +308,7 @@ static inline const char *colorfilter(const char *x) { \ SAYF(bSTOP RESET_G1 CURSOR_SHOW cRST cLRD \ "\n[-] PROGRAM ABORT : " cRST x); \ - SAYF(cLRD "\n Stop location : " cRST "%s(), %s:%u\n\n", __func__, \ + SAYF(cLRD "\n Stop location : " cRST "%s(), %s:%d\n\n", __func__, \ __FILE__, __LINE__); \ abort(); \ \ @@ -322,7 +322,7 @@ static inline const char *colorfilter(const char *x) { fflush(stdout); \ SAYF(bSTOP RESET_G1 CURSOR_SHOW cRST cLRD \ "\n[-] SYSTEM ERROR : " cRST x); \ - SAYF(cLRD "\n Stop location : " cRST "%s(), %s:%u\n", __func__, \ + SAYF(cLRD "\n Stop location : " cRST "%s(), %s:%d\n", __func__, \ __FILE__, __LINE__); \ SAYF(cLRD " OS message : " cRST "%s\n", strerror(errno)); \ exit(1); \ diff --git a/utils/defork/defork.c b/utils/defork/defork.c index f71d1124..f50b9a4b 100644 --- a/utils/defork/defork.c +++ b/utils/defork/defork.c @@ -1,4 +1,4 @@ -#define __GNU_SOURCE +#define _GNU_SOURCE #include #include #include diff --git a/utils/persistent_mode/Makefile b/utils/persistent_mode/Makefile index 6fa1c30e..e348c46c 100644 --- a/utils/persistent_mode/Makefile +++ b/utils/persistent_mode/Makefile @@ -1,10 +1,10 @@ all: - afl-clang-fast -o persistent_demo persistent_demo.c - afl-clang-fast -o persistent_demo_new persistent_demo_new.c - AFL_DONT_OPTIMIZE=1 afl-clang-fast -o test-instr test-instr.c + ../../afl-clang-fast -o persistent_demo persistent_demo.c + ../../afl-clang-fast -o persistent_demo_new persistent_demo_new.c + AFL_DONT_OPTIMIZE=1 ../../afl-clang-fast -o test-instr test-instr.c document: - AFL_DONT_OPTIMIZE=1 afl-clang-fast -D_AFL_DOCUMENT_MUTATIONS -o test-instr test-instr.c + AFL_DONT_OPTIMIZE=1 ../../afl-clang-fast -D_AFL_DOCUMENT_MUTATIONS -o test-instr test-instr.c clean: rm -f persistent_demo persistent_demo_new test-instr diff --git a/utils/qemu_persistent_hook/test.c b/utils/qemu_persistent_hook/test.c index afeff202..a0e815dc 100644 --- a/utils/qemu_persistent_hook/test.c +++ b/utils/qemu_persistent_hook/test.c @@ -2,7 +2,7 @@ int target_func(unsigned char *buf, int size) { - printf("buffer:%p, size:%p\n", buf, size); + printf("buffer:%p, size:%d\n", buf, size); switch (buf[0]) { case 1: -- cgit 1.4.1 From ca1eb32552636240acbb85f0b52668e23e4429e4 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Tue, 19 Jan 2021 10:16:12 +0100 Subject: fix compiles --- utils/aflpp_driver/aflpp_driver.c | 1 + utils/defork/defork.c | 1 + 2 files changed, 2 insertions(+) (limited to 'utils') diff --git a/utils/aflpp_driver/aflpp_driver.c b/utils/aflpp_driver/aflpp_driver.c index 30e6ebb9..7bb929b2 100644 --- a/utils/aflpp_driver/aflpp_driver.c +++ b/utils/aflpp_driver/aflpp_driver.c @@ -47,6 +47,7 @@ $AFL_HOME/afl-fuzz -i IN -o OUT ./a.out #include #include "config.h" +#include "types.h" #include "cmplog.h" #ifdef _DEBUG diff --git a/utils/defork/defork.c b/utils/defork/defork.c index f50b9a4b..c9be3283 100644 --- a/utils/defork/defork.c +++ b/utils/defork/defork.c @@ -5,6 +5,7 @@ #include #include "../../include/config.h" +#include "../../include/types.h" /* we want to fork once (for the afl++ forkserver), then immediately return as child on subsequent forks. */ -- cgit 1.4.1 From 0306261fec4c9ebc2b1361da1d0fbbe9bade8847 Mon Sep 17 00:00:00 2001 From: Joey Jiao Date: Wed, 13 Jan 2021 12:32:36 +0800 Subject: Fix build error for Android - LTO not work yet --- Android.bp | 304 +++++++++++++++++++++++++-- Android.mk | 1 - include/afl-fuzz.h | 4 - include/android-ashmem.h | 113 ++++------ src/afl-analyze.c | 3 - src/afl-fuzz-stats.c | 4 + src/afl-gotcpu.c | 3 - src/afl-showmap.c | 3 - src/afl-tmin.c | 4 - utils/afl_network_proxy/afl-network-server.c | 4 - 10 files changed, 332 insertions(+), 111 deletions(-) delete mode 120000 Android.mk (limited to 'utils') diff --git a/Android.bp b/Android.bp index 2c2114b2..549577db 100644 --- a/Android.bp +++ b/Android.bp @@ -1,5 +1,13 @@ cc_defaults { name: "afl-defaults", + sanitize: { + never: true, + }, + + local_include_dirs: [ + "include", + "instrumentation", + ], cflags: [ "-funroll-loops", @@ -14,12 +22,17 @@ cc_defaults { "-DBIN_PATH=\"out/host/linux-x86/bin\"", "-DDOC_PATH=\"out/host/linux-x86/shared/doc/afl\"", "-D__USE_GNU", + "-D__aarch64__", + "-DDEBUG_BUILD", + "-U_FORTIFY_SOURCE", + "-g", + "-O0", + "-fno-omit-frame-pointer", ], } cc_binary { name: "afl-fuzz", - static_executable: true, host_supported: true, defaults: [ @@ -27,7 +40,11 @@ cc_binary { ], srcs: [ - "afl-fuzz.c", + "src/afl-fuzz*.c", + "src/afl-common.c", + "src/afl-sharedmem.c", + "src/afl-forkserver.c", + "src/afl-performance.c", ], } @@ -41,7 +58,10 @@ cc_binary { ], srcs: [ - "afl-showmap.c", + "src/afl-showmap.c", + "src/afl-common.c", + "src/afl-sharedmem.c", + "src/afl-forkserver.c", ], } @@ -55,7 +75,11 @@ cc_binary { ], srcs: [ - "afl-tmin.c", + "src/afl-tmin.c", + "src/afl-common.c", + "src/afl-sharedmem.c", + "src/afl-forkserver.c", + "src/afl-performance.c", ], } @@ -69,7 +93,10 @@ cc_binary { ], srcs: [ - "afl-analyze.c", + "src/afl-analyze.c", + "src/afl-common.c", + "src/afl-sharedmem.c", + "src/afl-performance.c", ], } @@ -83,12 +110,13 @@ cc_binary { ], srcs: [ - "afl-gotcpu.c", + "src/afl-gotcpu.c", + "src/afl-common.c", ], } cc_binary_host { - name: "afl-clang-fast", + name: "afl-cc", static_executable: true, defaults: [ @@ -98,44 +126,286 @@ cc_binary_host { cflags: [ "-D__ANDROID__", "-DAFL_PATH=\"out/host/linux-x86/lib64\"", + "-DAFL_CLANG_FLTO=\"-flto=full\"", + "-DUSE_BINDIR=1", + "-DLLVM_BINDIR=\"prebuilts/clang/host/linux-x86/clang-r383902b/bin\"", + "-DLLVM_LIBDIR=\"prebuilts/clang/host/linux-x86/clang-r383902b/lib64\"", + "-DCLANGPP_BIN=\"prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang++\"", + "-DAFL_REAL_LD=\"prebuilts/clang/host/linux-x86/clang-r383902b/bin/ld.lld\"", + "-DLLVM_LTO=1", ], srcs: [ "src/afl-cc.c", + "src/afl-common.c", + ], + + symlinks: [ + "afl-clang-fast", + "afl-clang-fast++", + "afl-clang-lto", + "afl-clang-lto++", ], } -cc_binary_host { - name: "afl-clang-fast++", - static_executable: true, +cc_library_static { + name: "afl-llvm-rt", + compile_multilib: "both", + vendor_available: true, + host_supported: true, + recovery_available: true, + sdk_version: "9", + + apex_available: [ + "com.android.adbd", + "com.android.appsearch", + "com.android.art", + "com.android.bluetooth.updatable", + "com.android.cellbroadcast", + "com.android.conscrypt", + "com.android.extservices", + "com.android.cronet", + "com.android.neuralnetworks", + "com.android.media", + "com.android.media.swcodec", + "com.android.mediaprovider", + "com.android.permission", + "com.android.runtime", + "com.android.resolv", + "com.android.tethering", + "com.android.wifi", + "com.android.sdkext", + "com.android.os.statsd", + "//any", + ], defaults: [ "afl-defaults", ], - cflags: [ - "-D__ANDROID__", - "-DAFL_PATH=\"out/host/linux-x86/lib64\"", + srcs: [ + "instrumentation/afl-compiler-rt.o.c", ], +} - srcs: [ - "src/afl-cc.c", +cc_defaults { + name: "afl-defaults-lto", + + include_dirs: [ + "prebuilts/clang/host/linux-x86/clang-r383902b/include", ], } +/*cc_library_host_shared { + name: "afl-llvm-lto-instrumentlist", + + defaults: [ + "afl-defaults", + "afl-defaults-lto", + ], + + srcs: [ + "instrumentation/afl-llvm-lto-instrumentlist.so.cc", + "instrumentation/afl-llvm-common.cc", + ], +}*/ + +/*cc_library_host_shared { + name: "afl-llvm-dict2file", + + defaults: [ + "afl-defaults", + "afl-defaults-lto", + ], + + srcs: [ + "instrumentation/afl-llvm-dict2file.so.cc", + "instrumentation/afl-llvm-common.cc", + ], + + shared_libs: [ + "libLLVM-11git", + ], +}*/ + +/*cc_library_host_shared { + name: "cmplog-routines-pass", + + defaults: [ + "afl-defaults", + "afl-defaults-lto", + ], + + srcs: [ + "instrumentation/cmplog-routines-pass.cc", + "instrumentation/afl-llvm-common.cc", + ], +}*/ + +/*cc_library_host_shared { + name: "cmplog-instructions-pass", + + defaults: [ + "afl-defaults", + "afl-defaults-lto", + ], + + srcs: [ + "instrumentation/cmplog-instructions-pass.cc", + "instrumentation/afl-llvm-common.cc", + ], +}*/ + +/*cc_library_host_shared { + name: "split-switches-pass", + + defaults: [ + "afl-defaults", + "afl-defaults-lto", + ], + + srcs: [ + "instrumentation/split-switches-pass.so.cc", + "instrumentation/afl-llvm-common.cc", + ], +}*/ + +/*cc_library_host_shared { + name: "compare-transform-pass", + + defaults: [ + "afl-defaults", + "afl-defaults-lto", + ], + + srcs: [ + "instrumentation/compare-transform-pass.so.cc", + "instrumentation/afl-llvm-common.cc", + ], +}*/ + +/*cc_library_host_shared { + name: "split-compares-pass", + + defaults: [ + "afl-defaults", + "afl-defaults-lto", + ], + + srcs: [ + "instrumentation/split-compares-pass.so.cc", + "instrumentation/afl-llvm-common.cc", + ], +}*/ + +/*cc_library_host_shared { + name: "libLLVMInsTrim", + + defaults: [ + "afl-defaults", + "afl-defaults-lto", + ], + + srcs: [ + "instrumentation/LLVMInsTrim.so.cc", + "instrumentation/MarkNodes.cc", + "instrumentation/afl-llvm-common.cc", + ], +}*/ + +/*cc_library_host_shared { + name: "afl-llvm-pass", + + defaults: [ + "afl-defaults", + "afl-defaults-lto", + ], + + srcs: [ + "instrumentation/afl-llvm-pass.so.cc", + "instrumentation/afl-llvm-common.cc", + ], +}*/ + +/*cc_library_host_shared { + name: "SanitizerCoveragePCGUARD", + + defaults: [ + "afl-defaults", + "afl-defaults-lto", + ], + + srcs: [ + "instrumentation/SanitizerCoveragePCGUARD.so.cc", + "instrumentation/afl-llvm-common.cc", + ], +}*/ + +/*cc_library_host_shared { + name: "SanitizerCoverageLTO", + + defaults: [ + "afl-defaults", + "afl-defaults-lto", + ], + + srcs: [ + "instrumentation/SanitizerCoverageLTO.so.cc", + "instrumentation/afl-llvm-common.cc", + ], +}*/ + +/*cc_library_host_shared { + name: "afl-llvm-lto-instrumentation", + + defaults: [ + "afl-defaults", + "afl-defaults-lto", + ], + + srcs: [ + "instrumentation/afl-llvm-lto-instrumentation.so.cc", + "instrumentation/afl-llvm-common.cc", + ], +}*/ + cc_library_static { - name: "afl-llvm-rt", + name: "afl-llvm-rt-lto", compile_multilib: "both", vendor_available: true, host_supported: true, recovery_available: true, sdk_version: "9", + apex_available: [ + "com.android.adbd", + "com.android.appsearch", + "com.android.art", + "com.android.bluetooth.updatable", + "com.android.cellbroadcast", + "com.android.conscrypt", + "com.android.extservices", + "com.android.cronet", + "com.android.neuralnetworks", + "com.android.media", + "com.android.media.swcodec", + "com.android.mediaprovider", + "com.android.permission", + "com.android.runtime", + "com.android.resolv", + "com.android.tethering", + "com.android.wifi", + "com.android.sdkext", + "com.android.os.statsd", + "//any", + ], + defaults: [ "afl-defaults", + "afl-defaults-lto", ], srcs: [ - "instrumentation/afl-llvm-rt.o.c", + "instrumentation/afl-llvm-rt-lto.o.c", ], } diff --git a/Android.mk b/Android.mk deleted file mode 120000 index 33ceb8f0..00000000 --- a/Android.mk +++ /dev/null @@ -1 +0,0 @@ -Makefile \ No newline at end of file diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h index 988a907d..6342c8b6 100644 --- a/include/afl-fuzz.h +++ b/include/afl-fuzz.h @@ -37,10 +37,6 @@ #define _FILE_OFFSET_BITS 64 #endif -#ifdef __ANDROID__ - #include "android-ashmem.h" -#endif - #include "config.h" #include "types.h" #include "debug.h" diff --git a/include/android-ashmem.h b/include/android-ashmem.h index 41d4d2da..6939e06d 100644 --- a/include/android-ashmem.h +++ b/include/android-ashmem.h @@ -1,112 +1,81 @@ -/* - american fuzzy lop++ - android shared memory compatibility layer - ---------------------------------------------------------------- - - Originally written by Michal Zalewski - - Now maintained by Marc Heuse , - Heiko Eißfeldt , - Andrea Fioraldi , - Dominik Maier - - Copyright 2016, 2017 Google Inc. All rights reserved. - Copyright 2019-2020 AFLplusplus Project. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at: - - http://www.apache.org/licenses/LICENSE-2.0 - - This header re-defines the shared memory routines used by AFL++ - using the Andoid API. - - */ - +#ifdef __ANDROID__ #ifndef _ANDROID_ASHMEM_H #define _ANDROID_ASHMEM_H -#ifdef __ANDROID__ - - #include - #include - #include - #include - #include - - #if __ANDROID_API__ >= 26 - #define shmat bionic_shmat - #define shmctl bionic_shmctl - #define shmdt bionic_shmdt - #define shmget bionic_shmget - #endif - - #include - #undef shmat - #undef shmctl - #undef shmdt - #undef shmget - #include +#include +#include +#include +#include - #define ASHMEM_DEVICE "/dev/ashmem" +#if __ANDROID_API__ >= 26 +#define shmat bionic_shmat +#define shmctl bionic_shmctl +#define shmdt bionic_shmdt +#define shmget bionic_shmget +#endif +#include +#undef shmat +#undef shmctl +#undef shmdt +#undef shmget +#include -static inline int shmctl(int __shmid, int __cmd, struct shmid_ds *__buf) { +#define ASHMEM_DEVICE "/dev/ashmem" +int shmctl(int __shmid, int __cmd, struct shmid_ds *__buf) { int ret = 0; if (__cmd == IPC_RMID) { - - int length = ioctl(__shmid, ASHMEM_GET_SIZE, NULL); - struct ashmem_pin pin = {0, (unsigned int)length}; + int length = ioctl(__shmid, ASHMEM_GET_SIZE, NULL); + struct ashmem_pin pin = {0, length}; ret = ioctl(__shmid, ASHMEM_UNPIN, &pin); close(__shmid); - } return ret; - } -static inline int shmget(key_t __key, size_t __size, int __shmflg) { - - (void)__shmflg; - int fd, ret; +int shmget(key_t __key, size_t __size, int __shmflg) { + (void) __shmflg; + int fd, ret; char ourkey[11]; fd = open(ASHMEM_DEVICE, O_RDWR); - if (fd < 0) return fd; + if (fd < 0) + return fd; sprintf(ourkey, "%d", __key); ret = ioctl(fd, ASHMEM_SET_NAME, ourkey); - if (ret < 0) goto error; + if (ret < 0) + goto error; ret = ioctl(fd, ASHMEM_SET_SIZE, __size); - if (ret < 0) goto error; + if (ret < 0) + goto error; return fd; error: close(fd); return ret; - } -static inline void *shmat(int __shmid, const void *__shmaddr, int __shmflg) { - - (void)__shmflg; - int size; +void *shmat(int __shmid, const void *__shmaddr, int __shmflg) { + (void) __shmflg; + int size; void *ptr; size = ioctl(__shmid, ASHMEM_GET_SIZE, NULL); - if (size < 0) { return NULL; } + if (size < 0) { + return NULL; + } ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, __shmid, 0); - if (ptr == MAP_FAILED) { return NULL; } + if (ptr == MAP_FAILED) { + return NULL; + } return ptr; - } -#endif /* __ANDROID__ */ - -#endif - +#endif /* !_ANDROID_ASHMEM_H */ +#endif /* !__ANDROID__ */ diff --git a/src/afl-analyze.c b/src/afl-analyze.c index 8fc4434a..0af489fe 100644 --- a/src/afl-analyze.c +++ b/src/afl-analyze.c @@ -26,9 +26,6 @@ #define AFL_MAIN -#ifdef __ANDROID__ - #include "android-ashmem.h" -#endif #include "config.h" #include "types.h" #include "debug.h" diff --git a/src/afl-fuzz-stats.c b/src/afl-fuzz-stats.c index e86f2aeb..e67bace9 100644 --- a/src/afl-fuzz-stats.c +++ b/src/afl-fuzz-stats.c @@ -58,7 +58,11 @@ void write_setup_file(afl_state_t *afl, u32 argc, char **argv) { for (i = 0; i < argc; ++i) { if (i) fprintf(f, " "); +#ifdef __ANDROID__ + if (memchr(argv[i], '\'', sizeof(argv[i]))) { +#else if (index(argv[i], '\'')) { +#endif fprintf(f, "'"); for (j = 0; j < strlen(argv[i]); j++) diff --git a/src/afl-gotcpu.c b/src/afl-gotcpu.c index 1aea3e40..ac002a93 100644 --- a/src/afl-gotcpu.c +++ b/src/afl-gotcpu.c @@ -35,9 +35,6 @@ #define _GNU_SOURCE #endif -#ifdef __ANDROID__ - #include "android-ashmem.h" -#endif #include #include #include diff --git a/src/afl-showmap.c b/src/afl-showmap.c index 5c9d38e0..6d95fc1d 100644 --- a/src/afl-showmap.c +++ b/src/afl-showmap.c @@ -31,9 +31,6 @@ #define AFL_MAIN -#ifdef __ANDROID__ - #include "android-ashmem.h" -#endif #include "config.h" #include "types.h" #include "debug.h" diff --git a/src/afl-tmin.c b/src/afl-tmin.c index 6e2d7708..5fd60cd2 100644 --- a/src/afl-tmin.c +++ b/src/afl-tmin.c @@ -29,10 +29,6 @@ #define AFL_MAIN -#ifdef __ANDROID__ - #include "android-ashmem.h" -#endif - #include "config.h" #include "types.h" #include "debug.h" diff --git a/utils/afl_network_proxy/afl-network-server.c b/utils/afl_network_proxy/afl-network-server.c index 513dc8f2..fe225416 100644 --- a/utils/afl_network_proxy/afl-network-server.c +++ b/utils/afl_network_proxy/afl-network-server.c @@ -24,10 +24,6 @@ #define AFL_MAIN -#ifdef __ANDROID__ - #include "android-ashmem.h" -#endif - #include "config.h" #include "types.h" #include "debug.h" -- cgit 1.4.1 From 52f1d535bd8a40698e8446786b134d6629700713 Mon Sep 17 00:00:00 2001 From: Joey Jiao Date: Thu, 14 Jan 2021 13:40:28 +0800 Subject: android: port afl_frida for arm64 --- Android.bp | 234 +- utils/afl_frida/android/frida-gum-example.c | 130 + utils/afl_frida/android/frida-gum.h | 51342 ++++++++++++++++++++++++++ utils/afl_frida/android/libfrida-gum.a | Bin 0 -> 41417006 bytes 4 files changed, 51512 insertions(+), 194 deletions(-) create mode 100644 utils/afl_frida/android/frida-gum-example.c create mode 100644 utils/afl_frida/android/frida-gum.h create mode 100644 utils/afl_frida/android/libfrida-gum.a (limited to 'utils') diff --git a/Android.bp b/Android.bp index 549577db..1ac9e565 100644 --- a/Android.bp +++ b/Android.bp @@ -10,6 +10,7 @@ cc_defaults { ], cflags: [ + "-flto=full", "-funroll-loops", "-Wno-pointer-sign", "-Wno-pointer-arith", @@ -18,13 +19,14 @@ cc_defaults { "-Wno-unused-function", "-Wno-format", "-Wno-user-defined-warnings", - "-DUSE_TRACE_PC=1", + "-DAFL_LLVM_USE_TRACE_PC=1", "-DBIN_PATH=\"out/host/linux-x86/bin\"", "-DDOC_PATH=\"out/host/linux-x86/shared/doc/afl\"", "-D__USE_GNU", "-D__aarch64__", "-DDEBUG_BUILD", "-U_FORTIFY_SOURCE", + "-ggdb3", "-g", "-O0", "-fno-omit-frame-pointer", @@ -188,224 +190,68 @@ cc_library_static { ], } -cc_defaults { - name: "afl-defaults-lto", - - include_dirs: [ - "prebuilts/clang/host/linux-x86/clang-r383902b/include", - ], -} - -/*cc_library_host_shared { - name: "afl-llvm-lto-instrumentlist", - - defaults: [ - "afl-defaults", - "afl-defaults-lto", - ], - - srcs: [ - "instrumentation/afl-llvm-lto-instrumentlist.so.cc", - "instrumentation/afl-llvm-common.cc", - ], -}*/ - -/*cc_library_host_shared { - name: "afl-llvm-dict2file", - - defaults: [ - "afl-defaults", - "afl-defaults-lto", - ], - - srcs: [ - "instrumentation/afl-llvm-dict2file.so.cc", - "instrumentation/afl-llvm-common.cc", - ], - - shared_libs: [ - "libLLVM-11git", - ], -}*/ - -/*cc_library_host_shared { - name: "cmplog-routines-pass", - - defaults: [ - "afl-defaults", - "afl-defaults-lto", - ], - - srcs: [ - "instrumentation/cmplog-routines-pass.cc", - "instrumentation/afl-llvm-common.cc", - ], -}*/ - -/*cc_library_host_shared { - name: "cmplog-instructions-pass", - - defaults: [ - "afl-defaults", - "afl-defaults-lto", - ], - - srcs: [ - "instrumentation/cmplog-instructions-pass.cc", - "instrumentation/afl-llvm-common.cc", - ], -}*/ - -/*cc_library_host_shared { - name: "split-switches-pass", - - defaults: [ - "afl-defaults", - "afl-defaults-lto", - ], - - srcs: [ - "instrumentation/split-switches-pass.so.cc", - "instrumentation/afl-llvm-common.cc", - ], -}*/ - -/*cc_library_host_shared { - name: "compare-transform-pass", - - defaults: [ - "afl-defaults", - "afl-defaults-lto", - ], +cc_prebuilt_library_static { + name: "libfrida-gum", + compile_multilib: "64", + strip: { + none: true, + }, srcs: [ - "instrumentation/compare-transform-pass.so.cc", - "instrumentation/afl-llvm-common.cc", + "utils/afl_frida/android/libfrida-gum.a", ], -}*/ - -/*cc_library_host_shared { - name: "split-compares-pass", - defaults: [ - "afl-defaults", - "afl-defaults-lto", + export_include_dirs: [ + "utils/afl_frida/android", ], +} - srcs: [ - "instrumentation/split-compares-pass.so.cc", - "instrumentation/afl-llvm-common.cc", - ], -}*/ - -/*cc_library_host_shared { - name: "libLLVMInsTrim", - - defaults: [ - "afl-defaults", - "afl-defaults-lto", - ], +cc_library_shared { + name: "libtestinstr", srcs: [ - "instrumentation/LLVMInsTrim.so.cc", - "instrumentation/MarkNodes.cc", - "instrumentation/afl-llvm-common.cc", - ], -}*/ - -/*cc_library_host_shared { - name: "afl-llvm-pass", - - defaults: [ - "afl-defaults", - "afl-defaults-lto", + "utils/afl_frida/libtestinstr.c", ], - srcs: [ - "instrumentation/afl-llvm-pass.so.cc", - "instrumentation/afl-llvm-common.cc", + cflags: [ + "-O0", + "-fPIC", ], -}*/ +} -/*cc_library_host_shared { - name: "SanitizerCoveragePCGUARD", +cc_binary { + name: "afl-frida", + compile_multilib: "64", defaults: [ "afl-defaults", - "afl-defaults-lto", - ], - - srcs: [ - "instrumentation/SanitizerCoveragePCGUARD.so.cc", - "instrumentation/afl-llvm-common.cc", ], -}*/ -/*cc_library_host_shared { - name: "SanitizerCoverageLTO", - - defaults: [ - "afl-defaults", - "afl-defaults-lto", + cflags: [ + "-g", + "-O0", + "-Wno-format", + "-Wno-pointer-sign", + "-fpermissive", + "-fPIC", ], - srcs: [ - "instrumentation/SanitizerCoverageLTO.so.cc", - "instrumentation/afl-llvm-common.cc", + static_libs: [ + "afl-llvm-rt", + "libfrida-gum", ], -}*/ - -/*cc_library_host_shared { - name: "afl-llvm-lto-instrumentation", - defaults: [ - "afl-defaults", - "afl-defaults-lto", + shared_libs: [ + "libdl", + "liblog", ], srcs: [ - "instrumentation/afl-llvm-lto-instrumentation.so.cc", - "instrumentation/afl-llvm-common.cc", + "utils/afl_frida/afl-frida.c", ], -}*/ -cc_library_static { - name: "afl-llvm-rt-lto", - compile_multilib: "both", - vendor_available: true, - host_supported: true, - recovery_available: true, - sdk_version: "9", - - apex_available: [ - "com.android.adbd", - "com.android.appsearch", - "com.android.art", - "com.android.bluetooth.updatable", - "com.android.cellbroadcast", - "com.android.conscrypt", - "com.android.extservices", - "com.android.cronet", - "com.android.neuralnetworks", - "com.android.media", - "com.android.media.swcodec", - "com.android.mediaprovider", - "com.android.permission", - "com.android.runtime", - "com.android.resolv", - "com.android.tethering", - "com.android.wifi", - "com.android.sdkext", - "com.android.os.statsd", - "//any", - ], - - defaults: [ - "afl-defaults", - "afl-defaults-lto", - ], - - srcs: [ - "instrumentation/afl-llvm-rt-lto.o.c", + local_include_dirs: [ + "utils/afl_frida", + "utils/afl_frida/android", ], } diff --git a/utils/afl_frida/android/frida-gum-example.c b/utils/afl_frida/android/frida-gum-example.c new file mode 100644 index 00000000..14d98248 --- /dev/null +++ b/utils/afl_frida/android/frida-gum-example.c @@ -0,0 +1,130 @@ +/* + * Compile with: + * + * clang -fPIC -DANDROID -ffunction-sections -fdata-sections -Os -pipe -g3 frida-gum-example.c -o frida-gum-example -L. -lfrida-gum -llog -ldl -lm -pthread -Wl,--gc-sections,-z,noexecstack,-z,relro,-z,now -fuse-ld=gold -fuse-ld=gold -Wl,--icf=all + * + * Visit https://frida.re to learn more about Frida. + */ + +#include "frida-gum.h" + +#include +#include + +typedef struct _ExampleListener ExampleListener; +typedef enum _ExampleHookId ExampleHookId; + +struct _ExampleListener +{ + GObject parent; + + guint num_calls; +}; + +enum _ExampleHookId +{ + EXAMPLE_HOOK_OPEN, + EXAMPLE_HOOK_CLOSE +}; + +static void example_listener_iface_init (gpointer g_iface, gpointer iface_data); + +#define EXAMPLE_TYPE_LISTENER (example_listener_get_type ()) +G_DECLARE_FINAL_TYPE (ExampleListener, example_listener, EXAMPLE, LISTENER, GObject) +G_DEFINE_TYPE_EXTENDED (ExampleListener, + example_listener, + G_TYPE_OBJECT, + 0, + G_IMPLEMENT_INTERFACE (GUM_TYPE_INVOCATION_LISTENER, + example_listener_iface_init)) + +int +main (int argc, + char * argv[]) +{ + GumInterceptor * interceptor; + GumInvocationListener * listener; + + gum_init_embedded (); + + interceptor = gum_interceptor_obtain (); + listener = g_object_new (EXAMPLE_TYPE_LISTENER, NULL); + + gum_interceptor_begin_transaction (interceptor); + gum_interceptor_attach (interceptor, + GSIZE_TO_POINTER (gum_module_find_export_by_name (NULL, "open")), + listener, + GSIZE_TO_POINTER (EXAMPLE_HOOK_OPEN)); + gum_interceptor_attach (interceptor, + GSIZE_TO_POINTER (gum_module_find_export_by_name (NULL, "close")), + listener, + GSIZE_TO_POINTER (EXAMPLE_HOOK_CLOSE)); + gum_interceptor_end_transaction (interceptor); + + close (open ("/etc/hosts", O_RDONLY)); + close (open ("/etc/fstab", O_RDONLY)); + + g_print ("[*] listener got %u calls\n", EXAMPLE_LISTENER (listener)->num_calls); + + gum_interceptor_detach (interceptor, listener); + + close (open ("/etc/hosts", O_RDONLY)); + close (open ("/etc/fstab", O_RDONLY)); + + g_print ("[*] listener still has %u calls\n", EXAMPLE_LISTENER (listener)->num_calls); + + g_object_unref (listener); + g_object_unref (interceptor); + + gum_deinit_embedded (); + + return 0; +} + +static void +example_listener_on_enter (GumInvocationListener * listener, + GumInvocationContext * ic) +{ + ExampleListener * self = EXAMPLE_LISTENER (listener); + ExampleHookId hook_id = GUM_IC_GET_FUNC_DATA (ic, ExampleHookId); + + switch (hook_id) + { + case EXAMPLE_HOOK_OPEN: + g_print ("[*] open(\"%s\")\n", (const gchar *) gum_invocation_context_get_nth_argument (ic, 0)); + break; + case EXAMPLE_HOOK_CLOSE: + g_print ("[*] close(%d)\n", GPOINTER_TO_INT (gum_invocation_context_get_nth_argument (ic, 0))); + break; + } + + self->num_calls++; +} + +static void +example_listener_on_leave (GumInvocationListener * listener, + GumInvocationContext * ic) +{ +} + +static void +example_listener_class_init (ExampleListenerClass * klass) +{ + (void) EXAMPLE_IS_LISTENER; + (void) glib_autoptr_cleanup_ExampleListener; +} + +static void +example_listener_iface_init (gpointer g_iface, + gpointer iface_data) +{ + GumInvocationListenerInterface * iface = g_iface; + + iface->on_enter = example_listener_on_enter; + iface->on_leave = example_listener_on_leave; +} + +static void +example_listener_init (ExampleListener * self) +{ +} diff --git a/utils/afl_frida/android/frida-gum.h b/utils/afl_frida/android/frida-gum.h new file mode 100644 index 00000000..52176cbd --- /dev/null +++ b/utils/afl_frida/android/frida-gum.h @@ -0,0 +1,51342 @@ +#ifndef GUM_STATIC +# define GUM_STATIC +#endif + +#ifndef __FRIDA_SYMBOL_MAPPINGS__ +#define __FRIDA_SYMBOL_MAPPINGS__ + +#define cs_close _frida_cs_close +#define cs_disasm _frida_cs_disasm +#define cs_disasm_iter _frida_cs_disasm_iter +#define cs_errno _frida_cs_errno +#define cs_free _frida_cs_free +#define cs_group_name _frida_cs_group_name +#define cs_insn_group _frida_cs_insn_group +#define cs_insn_name _frida_cs_insn_name +#define cs_malloc _frida_cs_malloc +#define cs_mem_calloc _frida_cs_mem_calloc +#define cs_mem_free _frida_cs_mem_free +#define cs_mem_malloc _frida_cs_mem_malloc +#define cs_mem_realloc _frida_cs_mem_realloc +#define cs_op_count _frida_cs_op_count +#define cs_op_index _frida_cs_op_index +#define cs_open _frida_cs_open +#define cs_option _frida_cs_option +#define cs_reg_name _frida_cs_reg_name +#define cs_reg_read _frida_cs_reg_read +#define cs_reg_write _frida_cs_reg_write +#define cs_regs_access _frida_cs_regs_access +#define cs_snprintf _frida_cs_snprintf +#define cs_strdup _frida_cs_strdup +#define cs_strerror _frida_cs_strerror +#define cs_support _frida_cs_support +#define cs_version _frida_cs_version +#define cs_vsnprintf _frida_cs_vsnprintf +#define g__inotify_lock_lock _frida_g__inotify_lock_lock +#define g_access _frida_g_access +#define g_action_activate _frida_g_action_activate +#define g_action_change_state _frida_g_action_change_state +#define g_action_get_enabled _frida_g_action_get_enabled +#define g_action_get_name _frida_g_action_get_name +#define g_action_get_parameter_type _frida_g_action_get_parameter_type +#define g_action_get_state _frida_g_action_get_state +#define g_action_get_state_hint _frida_g_action_get_state_hint +#define g_action_get_state_type _frida_g_action_get_state_type +#define g_action_get_type _frida_g_action_get_type +#define g_action_group_action_added _frida_g_action_group_action_added +#define g_action_group_action_enabled_changed _frida_g_action_group_action_enabled_changed +#define g_action_group_action_removed _frida_g_action_group_action_removed +#define g_action_group_action_state_changed _frida_g_action_group_action_state_changed +#define g_action_group_activate_action _frida_g_action_group_activate_action +#define g_action_group_change_action_state _frida_g_action_group_change_action_state +#define g_action_group_get_action_enabled _frida_g_action_group_get_action_enabled +#define g_action_group_get_action_parameter_type _frida_g_action_group_get_action_parameter_type +#define g_action_group_get_action_state _frida_g_action_group_get_action_state +#define g_action_group_get_action_state_hint _frida_g_action_group_get_action_state_hint +#define g_action_group_get_action_state_type _frida_g_action_group_get_action_state_type +#define g_action_group_get_type _frida_g_action_group_get_type +#define g_action_group_has_action _frida_g_action_group_has_action +#define g_action_group_list_actions _frida_g_action_group_list_actions +#define g_action_group_query_action _frida_g_action_group_query_action +#define g_action_map_add_action _frida_g_action_map_add_action +#define g_action_map_add_action_entries _frida_g_action_map_add_action_entries +#define g_action_map_get_type _frida_g_action_map_get_type +#define g_action_map_lookup_action _frida_g_action_map_lookup_action +#define g_action_map_remove_action _frida_g_action_map_remove_action +#define g_action_name_is_valid _frida_g_action_name_is_valid +#define g_action_parse_detailed_name _frida_g_action_parse_detailed_name +#define g_action_print_detailed_name _frida_g_action_print_detailed_name +#define g_allocator_free _frida_g_allocator_free +#define g_allocator_new _frida_g_allocator_new +#define g_app_info_add_supports_type _frida_g_app_info_add_supports_type +#define g_app_info_can_delete _frida_g_app_info_can_delete +#define g_app_info_can_remove_supports_type _frida_g_app_info_can_remove_supports_type +#define g_app_info_create_flags_get_type _frida_g_app_info_create_flags_get_type +#define g_app_info_create_from_commandline _frida_g_app_info_create_from_commandline +#define g_app_info_delete _frida_g_app_info_delete +#define g_app_info_dup _frida_g_app_info_dup +#define g_app_info_equal _frida_g_app_info_equal +#define g_app_info_get_all _frida_g_app_info_get_all +#define g_app_info_get_all_for_type _frida_g_app_info_get_all_for_type +#define g_app_info_get_commandline _frida_g_app_info_get_commandline +#define g_app_info_get_default_for_type _frida_g_app_info_get_default_for_type +#define g_app_info_get_default_for_uri_scheme _frida_g_app_info_get_default_for_uri_scheme +#define g_app_info_get_description _frida_g_app_info_get_description +#define g_app_info_get_display_name _frida_g_app_info_get_display_name +#define g_app_info_get_executable _frida_g_app_info_get_executable +#define g_app_info_get_fallback_for_type _frida_g_app_info_get_fallback_for_type +#define g_app_info_get_icon _frida_g_app_info_get_icon +#define g_app_info_get_id _frida_g_app_info_get_id +#define g_app_info_get_name _frida_g_app_info_get_name +#define g_app_info_get_recommended_for_type _frida_g_app_info_get_recommended_for_type +#define g_app_info_get_supported_types _frida_g_app_info_get_supported_types +#define g_app_info_get_type _frida_g_app_info_get_type +#define g_app_info_launch _frida_g_app_info_launch +#define g_app_info_launch_default_for_uri _frida_g_app_info_launch_default_for_uri +#define g_app_info_launch_default_for_uri_async _frida_g_app_info_launch_default_for_uri_async +#define g_app_info_launch_default_for_uri_finish _frida_g_app_info_launch_default_for_uri_finish +#define g_app_info_launch_uris _frida_g_app_info_launch_uris +#define g_app_info_launch_uris_async _frida_g_app_info_launch_uris_async +#define g_app_info_launch_uris_finish _frida_g_app_info_launch_uris_finish +#define g_app_info_monitor_fire _frida_g_app_info_monitor_fire +#define g_app_info_monitor_get _frida_g_app_info_monitor_get +#define g_app_info_monitor_get_type _frida_g_app_info_monitor_get_type +#define g_app_info_remove_supports_type _frida_g_app_info_remove_supports_type +#define g_app_info_reset_type_associations _frida_g_app_info_reset_type_associations +#define g_app_info_set_as_default_for_extension _frida_g_app_info_set_as_default_for_extension +#define g_app_info_set_as_default_for_type _frida_g_app_info_set_as_default_for_type +#define g_app_info_set_as_last_used_for_type _frida_g_app_info_set_as_last_used_for_type +#define g_app_info_should_show _frida_g_app_info_should_show +#define g_app_info_supports_files _frida_g_app_info_supports_files +#define g_app_info_supports_uris _frida_g_app_info_supports_uris +#define g_app_launch_context_get_display _frida_g_app_launch_context_get_display +#define g_app_launch_context_get_environment _frida_g_app_launch_context_get_environment +#define g_app_launch_context_get_startup_notify_id _frida_g_app_launch_context_get_startup_notify_id +#define g_app_launch_context_get_type _frida_g_app_launch_context_get_type +#define g_app_launch_context_launch_failed _frida_g_app_launch_context_launch_failed +#define g_app_launch_context_new _frida_g_app_launch_context_new +#define g_app_launch_context_setenv _frida_g_app_launch_context_setenv +#define g_app_launch_context_unsetenv _frida_g_app_launch_context_unsetenv +#define g_application_activate _frida_g_application_activate +#define g_application_add_main_option _frida_g_application_add_main_option +#define g_application_add_main_option_entries _frida_g_application_add_main_option_entries +#define g_application_add_option_group _frida_g_application_add_option_group +#define g_application_bind_busy_property _frida_g_application_bind_busy_property +#define g_application_command_line_create_file_for_arg _frida_g_application_command_line_create_file_for_arg +#define g_application_command_line_get_arguments _frida_g_application_command_line_get_arguments +#define g_application_command_line_get_cwd _frida_g_application_command_line_get_cwd +#define g_application_command_line_get_environ _frida_g_application_command_line_get_environ +#define g_application_command_line_get_exit_status _frida_g_application_command_line_get_exit_status +#define g_application_command_line_get_is_remote _frida_g_application_command_line_get_is_remote +#define g_application_command_line_get_options_dict _frida_g_application_command_line_get_options_dict +#define g_application_command_line_get_platform_data _frida_g_application_command_line_get_platform_data +#define g_application_command_line_get_stdin _frida_g_application_command_line_get_stdin +#define g_application_command_line_get_type _frida_g_application_command_line_get_type +#define g_application_command_line_getenv _frida_g_application_command_line_getenv +#define g_application_command_line_print _frida_g_application_command_line_print +#define g_application_command_line_printerr _frida_g_application_command_line_printerr +#define g_application_command_line_set_exit_status _frida_g_application_command_line_set_exit_status +#define g_application_flags_get_type _frida_g_application_flags_get_type +#define g_application_get_application_id _frida_g_application_get_application_id +#define g_application_get_dbus_connection _frida_g_application_get_dbus_connection +#define g_application_get_dbus_object_path _frida_g_application_get_dbus_object_path +#define g_application_get_default _frida_g_application_get_default +#define g_application_get_flags _frida_g_application_get_flags +#define g_application_get_inactivity_timeout _frida_g_application_get_inactivity_timeout +#define g_application_get_is_busy _frida_g_application_get_is_busy +#define g_application_get_is_registered _frida_g_application_get_is_registered +#define g_application_get_is_remote _frida_g_application_get_is_remote +#define g_application_get_resource_base_path _frida_g_application_get_resource_base_path +#define g_application_get_type _frida_g_application_get_type +#define g_application_hold _frida_g_application_hold +#define g_application_id_is_valid _frida_g_application_id_is_valid +#define g_application_impl_activate _frida_g_application_impl_activate +#define g_application_impl_command_line _frida_g_application_impl_command_line +#define g_application_impl_destroy _frida_g_application_impl_destroy +#define g_application_impl_flush _frida_g_application_impl_flush +#define g_application_impl_get_dbus_connection _frida_g_application_impl_get_dbus_connection +#define g_application_impl_get_dbus_object_path _frida_g_application_impl_get_dbus_object_path +#define g_application_impl_open _frida_g_application_impl_open +#define g_application_impl_register _frida_g_application_impl_register +#define g_application_impl_set_busy_state _frida_g_application_impl_set_busy_state +#define g_application_mark_busy _frida_g_application_mark_busy +#define g_application_new _frida_g_application_new +#define g_application_open _frida_g_application_open +#define g_application_quit _frida_g_application_quit +#define g_application_register _frida_g_application_register +#define g_application_release _frida_g_application_release +#define g_application_run _frida_g_application_run +#define g_application_send_notification _frida_g_application_send_notification +#define g_application_set_action_group _frida_g_application_set_action_group +#define g_application_set_application_id _frida_g_application_set_application_id +#define g_application_set_default _frida_g_application_set_default +#define g_application_set_flags _frida_g_application_set_flags +#define g_application_set_inactivity_timeout _frida_g_application_set_inactivity_timeout +#define g_application_set_option_context_description _frida_g_application_set_option_context_description +#define g_application_set_option_context_parameter_string _frida_g_application_set_option_context_parameter_string +#define g_application_set_option_context_summary _frida_g_application_set_option_context_summary +#define g_application_set_resource_base_path _frida_g_application_set_resource_base_path +#define g_application_unbind_busy_property _frida_g_application_unbind_busy_property +#define g_application_unmark_busy _frida_g_application_unmark_busy +#define g_application_withdraw_notification _frida_g_application_withdraw_notification +#define g_array_append_vals _frida_g_array_append_vals +#define g_array_binary_search _frida_g_array_binary_search +#define g_array_copy _frida_g_array_copy +#define g_array_free _frida_g_array_free +#define g_array_get_element_size _frida_g_array_get_element_size +#define g_array_get_type _frida_g_array_get_type +#define g_array_insert_vals _frida_g_array_insert_vals +#define g_array_new _frida_g_array_new +#define g_array_prepend_vals _frida_g_array_prepend_vals +#define g_array_ref _frida_g_array_ref +#define g_array_remove_index _frida_g_array_remove_index +#define g_array_remove_index_fast _frida_g_array_remove_index_fast +#define g_array_remove_range _frida_g_array_remove_range +#define g_array_set_clear_func _frida_g_array_set_clear_func +#define g_array_set_size _frida_g_array_set_size +#define g_array_sized_new _frida_g_array_sized_new +#define g_array_sort _frida_g_array_sort +#define g_array_sort_with_data _frida_g_array_sort_with_data +#define g_array_steal _frida_g_array_steal +#define g_array_unref _frida_g_array_unref +#define g_ascii_digit_value _frida_g_ascii_digit_value +#define g_ascii_dtostr _frida_g_ascii_dtostr +#define g_ascii_formatd _frida_g_ascii_formatd +#define g_ascii_strcasecmp _frida_g_ascii_strcasecmp +#define g_ascii_strdown _frida_g_ascii_strdown +#define g_ascii_string_to_signed _frida_g_ascii_string_to_signed +#define g_ascii_string_to_unsigned _frida_g_ascii_string_to_unsigned +#define g_ascii_strncasecmp _frida_g_ascii_strncasecmp +#define g_ascii_strtod _frida_g_ascii_strtod +#define g_ascii_strtoll _frida_g_ascii_strtoll +#define g_ascii_strtoull _frida_g_ascii_strtoull +#define g_ascii_strup _frida_g_ascii_strup +#define g_ascii_table _frida_g_ascii_table +#define g_ascii_tolower _frida_g_ascii_tolower +#define g_ascii_toupper _frida_g_ascii_toupper +#define g_ascii_xdigit_value _frida_g_ascii_xdigit_value +#define g_ask_password_flags_get_type _frida_g_ask_password_flags_get_type +#define g_assert_warning _frida_g_assert_warning +#define g_assertion_message _frida_g_assertion_message +#define g_assertion_message_cmpnum _frida_g_assertion_message_cmpnum +#define g_assertion_message_cmpstr _frida_g_assertion_message_cmpstr +#define g_assertion_message_cmpstrv _frida_g_assertion_message_cmpstrv +#define g_assertion_message_error _frida_g_assertion_message_error +#define g_assertion_message_expr _frida_g_assertion_message_expr +#define g_assertion_set_handler _frida_g_assertion_set_handler +#define g_async_initable_get_type _frida_g_async_initable_get_type +#define g_async_initable_init_async _frida_g_async_initable_init_async +#define g_async_initable_init_finish _frida_g_async_initable_init_finish +#define g_async_initable_new_async _frida_g_async_initable_new_async +#define g_async_initable_new_finish _frida_g_async_initable_new_finish +#define g_async_initable_new_valist_async _frida_g_async_initable_new_valist_async +#define g_async_initable_newv_async _frida_g_async_initable_newv_async +#define g_async_queue_length _frida_g_async_queue_length +#define g_async_queue_length_unlocked _frida_g_async_queue_length_unlocked +#define g_async_queue_lock _frida_g_async_queue_lock +#define g_async_queue_new _frida_g_async_queue_new +#define g_async_queue_new_full _frida_g_async_queue_new_full +#define g_async_queue_pop _frida_g_async_queue_pop +#define g_async_queue_pop_unlocked _frida_g_async_queue_pop_unlocked +#define g_async_queue_push _frida_g_async_queue_push +#define g_async_queue_push_front _frida_g_async_queue_push_front +#define g_async_queue_push_front_unlocked _frida_g_async_queue_push_front_unlocked +#define g_async_queue_push_sorted _frida_g_async_queue_push_sorted +#define g_async_queue_push_sorted_unlocked _frida_g_async_queue_push_sorted_unlocked +#define g_async_queue_push_unlocked _frida_g_async_queue_push_unlocked +#define g_async_queue_ref _frida_g_async_queue_ref +#define g_async_queue_ref_unlocked _frida_g_async_queue_ref_unlocked +#define g_async_queue_remove _frida_g_async_queue_remove +#define g_async_queue_remove_unlocked _frida_g_async_queue_remove_unlocked +#define g_async_queue_sort _frida_g_async_queue_sort +#define g_async_queue_sort_unlocked _frida_g_async_queue_sort_unlocked +#define g_async_queue_timed_pop _frida_g_async_queue_timed_pop +#define g_async_queue_timed_pop_unlocked _frida_g_async_queue_timed_pop_unlocked +#define g_async_queue_timeout_pop _frida_g_async_queue_timeout_pop +#define g_async_queue_timeout_pop_unlocked _frida_g_async_queue_timeout_pop_unlocked +#define g_async_queue_try_pop _frida_g_async_queue_try_pop +#define g_async_queue_try_pop_unlocked _frida_g_async_queue_try_pop_unlocked +#define g_async_queue_unlock _frida_g_async_queue_unlock +#define g_async_queue_unref _frida_g_async_queue_unref +#define g_async_queue_unref_and_unlock _frida_g_async_queue_unref_and_unlock +#define g_async_result_get_source_object _frida_g_async_result_get_source_object +#define g_async_result_get_type _frida_g_async_result_get_type +#define g_async_result_get_user_data _frida_g_async_result_get_user_data +#define g_async_result_is_tagged _frida_g_async_result_is_tagged +#define g_async_result_legacy_propagate_error _frida_g_async_result_legacy_propagate_error +#define g_atexit _frida_g_atexit +#define g_atomic_int_add _frida_g_atomic_int_add +#define g_atomic_int_and _frida_g_atomic_int_and +#define g_atomic_int_compare_and_exchange _frida_g_atomic_int_compare_and_exchange +#define g_atomic_int_dec_and_test _frida_g_atomic_int_dec_and_test +#define g_atomic_int_exchange_and_add _frida_g_atomic_int_exchange_and_add +#define g_atomic_int_get _frida_g_atomic_int_get +#define g_atomic_int_inc _frida_g_atomic_int_inc +#define g_atomic_int_or _frida_g_atomic_int_or +#define g_atomic_int_set _frida_g_atomic_int_set +#define g_atomic_int_xor _frida_g_atomic_int_xor +#define g_atomic_pointer_add _frida_g_atomic_pointer_add +#define g_atomic_pointer_and _frida_g_atomic_pointer_and +#define g_atomic_pointer_compare_and_exchange _frida_g_atomic_pointer_compare_and_exchange +#define g_atomic_pointer_get _frida_g_atomic_pointer_get +#define g_atomic_pointer_or _frida_g_atomic_pointer_or +#define g_atomic_pointer_set _frida_g_atomic_pointer_set +#define g_atomic_pointer_xor _frida_g_atomic_pointer_xor +#define g_atomic_rc_box_acquire _frida_g_atomic_rc_box_acquire +#define g_atomic_rc_box_alloc _frida_g_atomic_rc_box_alloc +#define g_atomic_rc_box_alloc0 _frida_g_atomic_rc_box_alloc0 +#define g_atomic_rc_box_dup _frida_g_atomic_rc_box_dup +#define g_atomic_rc_box_get_size _frida_g_atomic_rc_box_get_size +#define g_atomic_rc_box_release _frida_g_atomic_rc_box_release +#define g_atomic_rc_box_release_full _frida_g_atomic_rc_box_release_full +#define g_atomic_ref_count_compare _frida_g_atomic_ref_count_compare +#define g_atomic_ref_count_dec _frida_g_atomic_ref_count_dec +#define g_atomic_ref_count_inc _frida_g_atomic_ref_count_inc +#define g_atomic_ref_count_init _frida_g_atomic_ref_count_init +#define g_base64_decode _frida_g_base64_decode +#define g_base64_decode_inplace _frida_g_base64_decode_inplace +#define g_base64_decode_step _frida_g_base64_decode_step +#define g_base64_encode _frida_g_base64_encode +#define g_base64_encode_close _frida_g_base64_encode_close +#define g_base64_encode_step _frida_g_base64_encode_step +#define g_basename _frida_g_basename +#define g_binding_dup_source _frida_g_binding_dup_source +#define g_binding_dup_target _frida_g_binding_dup_target +#define g_binding_flags_get_type _frida_g_binding_flags_get_type +#define g_binding_get_flags _frida_g_binding_get_flags +#define g_binding_get_source _frida_g_binding_get_source +#define g_binding_get_source_property _frida_g_binding_get_source_property +#define g_binding_get_target _frida_g_binding_get_target +#define g_binding_get_target_property _frida_g_binding_get_target_property +#define g_binding_get_type _frida_g_binding_get_type +#define g_binding_unbind _frida_g_binding_unbind +#define g_bit_lock _frida_g_bit_lock +#define g_bit_nth_lsf _frida_g_bit_nth_lsf +#define g_bit_nth_msf _frida_g_bit_nth_msf +#define g_bit_storage _frida_g_bit_storage +#define g_bit_trylock _frida_g_bit_trylock +#define g_bit_unlock _frida_g_bit_unlock +#define g_blow_chunks _frida_g_blow_chunks +#define g_bookmark_file_add_application _frida_g_bookmark_file_add_application +#define g_bookmark_file_add_group _frida_g_bookmark_file_add_group +#define g_bookmark_file_error_quark _frida_g_bookmark_file_error_quark +#define g_bookmark_file_free _frida_g_bookmark_file_free +#define g_bookmark_file_get_added _frida_g_bookmark_file_get_added +#define g_bookmark_file_get_added_date_time _frida_g_bookmark_file_get_added_date_time +#define g_bookmark_file_get_app_info _frida_g_bookmark_file_get_app_info +#define g_bookmark_file_get_application_info _frida_g_bookmark_file_get_application_info +#define g_bookmark_file_get_applications _frida_g_bookmark_file_get_applications +#define g_bookmark_file_get_description _frida_g_bookmark_file_get_description +#define g_bookmark_file_get_groups _frida_g_bookmark_file_get_groups +#define g_bookmark_file_get_icon _frida_g_bookmark_file_get_icon +#define g_bookmark_file_get_is_private _frida_g_bookmark_file_get_is_private +#define g_bookmark_file_get_mime_type _frida_g_bookmark_file_get_mime_type +#define g_bookmark_file_get_modified _frida_g_bookmark_file_get_modified +#define g_bookmark_file_get_modified_date_time _frida_g_bookmark_file_get_modified_date_time +#define g_bookmark_file_get_size _frida_g_bookmark_file_get_size +#define g_bookmark_file_get_title _frida_g_bookmark_file_get_title +#define g_bookmark_file_get_uris _frida_g_bookmark_file_get_uris +#define g_bookmark_file_get_visited _frida_g_bookmark_file_get_visited +#define g_bookmark_file_get_visited_date_time _frida_g_bookmark_file_get_visited_date_time +#define g_bookmark_file_has_application _frida_g_bookmark_file_has_application +#define g_bookmark_file_has_group _frida_g_bookmark_file_has_group +#define g_bookmark_file_has_item _frida_g_bookmark_file_has_item +#define g_bookmark_file_load_from_data _frida_g_bookmark_file_load_from_data +#define g_bookmark_file_load_from_data_dirs _frida_g_bookmark_file_load_from_data_dirs +#define g_bookmark_file_load_from_file _frida_g_bookmark_file_load_from_file +#define g_bookmark_file_move_item _frida_g_bookmark_file_move_item +#define g_bookmark_file_new _frida_g_bookmark_file_new +#define g_bookmark_file_remove_application _frida_g_bookmark_file_remove_application +#define g_bookmark_file_remove_group _frida_g_bookmark_file_remove_group +#define g_bookmark_file_remove_item _frida_g_bookmark_file_remove_item +#define g_bookmark_file_set_added _frida_g_bookmark_file_set_added +#define g_bookmark_file_set_added_date_time _frida_g_bookmark_file_set_added_date_time +#define g_bookmark_file_set_app_info _frida_g_bookmark_file_set_app_info +#define g_bookmark_file_set_application_info _frida_g_bookmark_file_set_application_info +#define g_bookmark_file_set_description _frida_g_bookmark_file_set_description +#define g_bookmark_file_set_groups _frida_g_bookmark_file_set_groups +#define g_bookmark_file_set_icon _frida_g_bookmark_file_set_icon +#define g_bookmark_file_set_is_private _frida_g_bookmark_file_set_is_private +#define g_bookmark_file_set_mime_type _frida_g_bookmark_file_set_mime_type +#define g_bookmark_file_set_modified _frida_g_bookmark_file_set_modified +#define g_bookmark_file_set_modified_date_time _frida_g_bookmark_file_set_modified_date_time +#define g_bookmark_file_set_title _frida_g_bookmark_file_set_title +#define g_bookmark_file_set_visited _frida_g_bookmark_file_set_visited +#define g_bookmark_file_set_visited_date_time _frida_g_bookmark_file_set_visited_date_time +#define g_bookmark_file_to_data _frida_g_bookmark_file_to_data +#define g_bookmark_file_to_file _frida_g_bookmark_file_to_file +#define g_boxed_copy _frida_g_boxed_copy +#define g_boxed_free _frida_g_boxed_free +#define g_boxed_type_register_static _frida_g_boxed_type_register_static +#define g_buffered_input_stream_fill _frida_g_buffered_input_stream_fill +#define g_buffered_input_stream_fill_async _frida_g_buffered_input_stream_fill_async +#define g_buffered_input_stream_fill_finish _frida_g_buffered_input_stream_fill_finish +#define g_buffered_input_stream_get_available _frida_g_buffered_input_stream_get_available +#define g_buffered_input_stream_get_buffer_size _frida_g_buffered_input_stream_get_buffer_size +#define g_buffered_input_stream_get_type _frida_g_buffered_input_stream_get_type +#define g_buffered_input_stream_new _frida_g_buffered_input_stream_new +#define g_buffered_input_stream_new_sized _frida_g_buffered_input_stream_new_sized +#define g_buffered_input_stream_peek _frida_g_buffered_input_stream_peek +#define g_buffered_input_stream_peek_buffer _frida_g_buffered_input_stream_peek_buffer +#define g_buffered_input_stream_read_byte _frida_g_buffered_input_stream_read_byte +#define g_buffered_input_stream_set_buffer_size _frida_g_buffered_input_stream_set_buffer_size +#define g_buffered_output_stream_get_auto_grow _frida_g_buffered_output_stream_get_auto_grow +#define g_buffered_output_stream_get_buffer_size _frida_g_buffered_output_stream_get_buffer_size +#define g_buffered_output_stream_get_type _frida_g_buffered_output_stream_get_type +#define g_buffered_output_stream_new _frida_g_buffered_output_stream_new +#define g_buffered_output_stream_new_sized _frida_g_buffered_output_stream_new_sized +#define g_buffered_output_stream_set_auto_grow _frida_g_buffered_output_stream_set_auto_grow +#define g_buffered_output_stream_set_buffer_size _frida_g_buffered_output_stream_set_buffer_size +#define g_build_filename _frida_g_build_filename +#define g_build_filename_valist _frida_g_build_filename_valist +#define g_build_filenamev _frida_g_build_filenamev +#define g_build_path _frida_g_build_path +#define g_build_pathv _frida_g_build_pathv +#define g_bus_get _frida_g_bus_get +#define g_bus_get_finish _frida_g_bus_get_finish +#define g_bus_get_sync _frida_g_bus_get_sync +#define g_bus_name_owner_flags_get_type _frida_g_bus_name_owner_flags_get_type +#define g_bus_name_watcher_flags_get_type _frida_g_bus_name_watcher_flags_get_type +#define g_bus_own_name _frida_g_bus_own_name +#define g_bus_own_name_on_connection _frida_g_bus_own_name_on_connection +#define g_bus_own_name_on_connection_with_closures _frida_g_bus_own_name_on_connection_with_closures +#define g_bus_own_name_with_closures _frida_g_bus_own_name_with_closures +#define g_bus_type_get_type _frida_g_bus_type_get_type +#define g_bus_unown_name _frida_g_bus_unown_name +#define g_bus_unwatch_name _frida_g_bus_unwatch_name +#define g_bus_watch_name _frida_g_bus_watch_name +#define g_bus_watch_name_on_connection _frida_g_bus_watch_name_on_connection +#define g_bus_watch_name_on_connection_with_closures _frida_g_bus_watch_name_on_connection_with_closures +#define g_bus_watch_name_with_closures _frida_g_bus_watch_name_with_closures +#define g_byte_array_append _frida_g_byte_array_append +#define g_byte_array_free _frida_g_byte_array_free +#define g_byte_array_free_to_bytes _frida_g_byte_array_free_to_bytes +#define g_byte_array_get_type _frida_g_byte_array_get_type +#define g_byte_array_new _frida_g_byte_array_new +#define g_byte_array_new_take _frida_g_byte_array_new_take +#define g_byte_array_prepend _frida_g_byte_array_prepend +#define g_byte_array_ref _frida_g_byte_array_ref +#define g_byte_array_remove_index _frida_g_byte_array_remove_index +#define g_byte_array_remove_index_fast _frida_g_byte_array_remove_index_fast +#define g_byte_array_remove_range _frida_g_byte_array_remove_range +#define g_byte_array_set_size _frida_g_byte_array_set_size +#define g_byte_array_sized_new _frida_g_byte_array_sized_new +#define g_byte_array_sort _frida_g_byte_array_sort +#define g_byte_array_sort_with_data _frida_g_byte_array_sort_with_data +#define g_byte_array_steal _frida_g_byte_array_steal +#define g_byte_array_unref _frida_g_byte_array_unref +#define g_bytes_compare _frida_g_bytes_compare +#define g_bytes_equal _frida_g_bytes_equal +#define g_bytes_get_data _frida_g_bytes_get_data +#define g_bytes_get_size _frida_g_bytes_get_size +#define g_bytes_get_type _frida_g_bytes_get_type +#define g_bytes_hash _frida_g_bytes_hash +#define g_bytes_icon_get_bytes _frida_g_bytes_icon_get_bytes +#define g_bytes_icon_get_type _frida_g_bytes_icon_get_type +#define g_bytes_icon_new _frida_g_bytes_icon_new +#define g_bytes_new _frida_g_bytes_new +#define g_bytes_new_from_bytes _frida_g_bytes_new_from_bytes +#define g_bytes_new_static _frida_g_bytes_new_static +#define g_bytes_new_take _frida_g_bytes_new_take +#define g_bytes_new_with_free_func _frida_g_bytes_new_with_free_func +#define g_bytes_ref _frida_g_bytes_ref +#define g_bytes_unref _frida_g_bytes_unref +#define g_bytes_unref_to_array _frida_g_bytes_unref_to_array +#define g_bytes_unref_to_data _frida_g_bytes_unref_to_data +#define g_cache_destroy _frida_g_cache_destroy +#define g_cache_insert _frida_g_cache_insert +#define g_cache_key_foreach _frida_g_cache_key_foreach +#define g_cache_new _frida_g_cache_new +#define g_cache_remove _frida_g_cache_remove +#define g_cache_value_foreach _frida_g_cache_value_foreach +#define g_cancellable_cancel _frida_g_cancellable_cancel +#define g_cancellable_connect _frida_g_cancellable_connect +#define g_cancellable_disconnect _frida_g_cancellable_disconnect +#define g_cancellable_get_current _frida_g_cancellable_get_current +#define g_cancellable_get_fd _frida_g_cancellable_get_fd +#define g_cancellable_get_type _frida_g_cancellable_get_type +#define g_cancellable_is_cancelled _frida_g_cancellable_is_cancelled +#define g_cancellable_make_pollfd _frida_g_cancellable_make_pollfd +#define g_cancellable_new _frida_g_cancellable_new +#define g_cancellable_pop_current _frida_g_cancellable_pop_current +#define g_cancellable_push_current _frida_g_cancellable_push_current +#define g_cancellable_release_fd _frida_g_cancellable_release_fd +#define g_cancellable_reset _frida_g_cancellable_reset +#define g_cancellable_set_error_if_cancelled _frida_g_cancellable_set_error_if_cancelled +#define g_cancellable_source_new _frida_g_cancellable_source_new +#define g_canonicalize_filename _frida_g_canonicalize_filename +#define g_cclosure_marshal_BOOLEAN__BOXED_BOXED _frida_g_cclosure_marshal_BOOLEAN__BOXED_BOXED +#define g_cclosure_marshal_BOOLEAN__BOXED_BOXEDv _frida_g_cclosure_marshal_BOOLEAN__BOXED_BOXEDv +#define g_cclosure_marshal_BOOLEAN__FLAGS _frida_g_cclosure_marshal_BOOLEAN__FLAGS +#define g_cclosure_marshal_BOOLEAN__FLAGSv _frida_g_cclosure_marshal_BOOLEAN__FLAGSv +#define g_cclosure_marshal_STRING__OBJECT_POINTER _frida_g_cclosure_marshal_STRING__OBJECT_POINTER +#define g_cclosure_marshal_STRING__OBJECT_POINTERv _frida_g_cclosure_marshal_STRING__OBJECT_POINTERv +#define g_cclosure_marshal_VOID__BOOLEAN _frida_g_cclosure_marshal_VOID__BOOLEAN +#define g_cclosure_marshal_VOID__BOOLEANv _frida_g_cclosure_marshal_VOID__BOOLEANv +#define g_cclosure_marshal_VOID__BOXED _frida_g_cclosure_marshal_VOID__BOXED +#define g_cclosure_marshal_VOID__BOXEDv _frida_g_cclosure_marshal_VOID__BOXEDv +#define g_cclosure_marshal_VOID__CHAR _frida_g_cclosure_marshal_VOID__CHAR +#define g_cclosure_marshal_VOID__CHARv _frida_g_cclosure_marshal_VOID__CHARv +#define g_cclosure_marshal_VOID__DOUBLE _frida_g_cclosure_marshal_VOID__DOUBLE +#define g_cclosure_marshal_VOID__DOUBLEv _frida_g_cclosure_marshal_VOID__DOUBLEv +#define g_cclosure_marshal_VOID__ENUM _frida_g_cclosure_marshal_VOID__ENUM +#define g_cclosure_marshal_VOID__ENUMv _frida_g_cclosure_marshal_VOID__ENUMv +#define g_cclosure_marshal_VOID__FLAGS _frida_g_cclosure_marshal_VOID__FLAGS +#define g_cclosure_marshal_VOID__FLAGSv _frida_g_cclosure_marshal_VOID__FLAGSv +#define g_cclosure_marshal_VOID__FLOAT _frida_g_cclosure_marshal_VOID__FLOAT +#define g_cclosure_marshal_VOID__FLOATv _frida_g_cclosure_marshal_VOID__FLOATv +#define g_cclosure_marshal_VOID__INT _frida_g_cclosure_marshal_VOID__INT +#define g_cclosure_marshal_VOID__INTv _frida_g_cclosure_marshal_VOID__INTv +#define g_cclosure_marshal_VOID__LONG _frida_g_cclosure_marshal_VOID__LONG +#define g_cclosure_marshal_VOID__LONGv _frida_g_cclosure_marshal_VOID__LONGv +#define g_cclosure_marshal_VOID__OBJECT _frida_g_cclosure_marshal_VOID__OBJECT +#define g_cclosure_marshal_VOID__OBJECTv _frida_g_cclosure_marshal_VOID__OBJECTv +#define g_cclosure_marshal_VOID__PARAM _frida_g_cclosure_marshal_VOID__PARAM +#define g_cclosure_marshal_VOID__PARAMv _frida_g_cclosure_marshal_VOID__PARAMv +#define g_cclosure_marshal_VOID__POINTER _frida_g_cclosure_marshal_VOID__POINTER +#define g_cclosure_marshal_VOID__POINTERv _frida_g_cclosure_marshal_VOID__POINTERv +#define g_cclosure_marshal_VOID__STRING _frida_g_cclosure_marshal_VOID__STRING +#define g_cclosure_marshal_VOID__STRINGv _frida_g_cclosure_marshal_VOID__STRINGv +#define g_cclosure_marshal_VOID__UCHAR _frida_g_cclosure_marshal_VOID__UCHAR +#define g_cclosure_marshal_VOID__UCHARv _frida_g_cclosure_marshal_VOID__UCHARv +#define g_cclosure_marshal_VOID__UINT _frida_g_cclosure_marshal_VOID__UINT +#define g_cclosure_marshal_VOID__UINT_POINTER _frida_g_cclosure_marshal_VOID__UINT_POINTER +#define g_cclosure_marshal_VOID__UINT_POINTERv _frida_g_cclosure_marshal_VOID__UINT_POINTERv +#define g_cclosure_marshal_VOID__UINTv _frida_g_cclosure_marshal_VOID__UINTv +#define g_cclosure_marshal_VOID__ULONG _frida_g_cclosure_marshal_VOID__ULONG +#define g_cclosure_marshal_VOID__ULONGv _frida_g_cclosure_marshal_VOID__ULONGv +#define g_cclosure_marshal_VOID__VARIANT _frida_g_cclosure_marshal_VOID__VARIANT +#define g_cclosure_marshal_VOID__VARIANTv _frida_g_cclosure_marshal_VOID__VARIANTv +#define g_cclosure_marshal_VOID__VOID _frida_g_cclosure_marshal_VOID__VOID +#define g_cclosure_marshal_VOID__VOIDv _frida_g_cclosure_marshal_VOID__VOIDv +#define g_cclosure_marshal_generic _frida_g_cclosure_marshal_generic +#define g_cclosure_marshal_generic_va _frida_g_cclosure_marshal_generic_va +#define g_cclosure_new _frida_g_cclosure_new +#define g_cclosure_new_object _frida_g_cclosure_new_object +#define g_cclosure_new_object_swap _frida_g_cclosure_new_object_swap +#define g_cclosure_new_swap _frida_g_cclosure_new_swap +#define g_charset_converter_get_num_fallbacks _frida_g_charset_converter_get_num_fallbacks +#define g_charset_converter_get_type _frida_g_charset_converter_get_type +#define g_charset_converter_get_use_fallback _frida_g_charset_converter_get_use_fallback +#define g_charset_converter_new _frida_g_charset_converter_new +#define g_charset_converter_set_use_fallback _frida_g_charset_converter_set_use_fallback +#define g_chdir _frida_g_chdir +#define g_check_setuid _frida_g_check_setuid +#define g_checksum_copy _frida_g_checksum_copy +#define g_checksum_free _frida_g_checksum_free +#define g_checksum_get_digest _frida_g_checksum_get_digest +#define g_checksum_get_string _frida_g_checksum_get_string +#define g_checksum_get_type _frida_g_checksum_get_type +#define g_checksum_new _frida_g_checksum_new +#define g_checksum_reset _frida_g_checksum_reset +#define g_checksum_type_get_length _frida_g_checksum_type_get_length +#define g_checksum_update _frida_g_checksum_update +#define g_child_watch_add _frida_g_child_watch_add +#define g_child_watch_add_full _frida_g_child_watch_add_full +#define g_child_watch_funcs _frida_g_child_watch_funcs +#define g_child_watch_source_new _frida_g_child_watch_source_new +#define g_chmod _frida_g_chmod +#define g_clear_error _frida_g_clear_error +#define g_clear_handle_id _frida_g_clear_handle_id +#define g_clear_list _frida_g_clear_list +#define g_clear_object _frida_g_clear_object +#define g_clear_pointer _frida_g_clear_pointer +#define g_clear_signal_handler _frida_g_clear_signal_handler +#define g_clear_slist _frida_g_clear_slist +#define g_close _frida_g_close +#define g_closure_add_finalize_notifier _frida_g_closure_add_finalize_notifier +#define g_closure_add_invalidate_notifier _frida_g_closure_add_invalidate_notifier +#define g_closure_add_marshal_guards _frida_g_closure_add_marshal_guards +#define g_closure_get_type _frida_g_closure_get_type +#define g_closure_invalidate _frida_g_closure_invalidate +#define g_closure_invoke _frida_g_closure_invoke +#define g_closure_new_object _frida_g_closure_new_object +#define g_closure_new_simple _frida_g_closure_new_simple +#define g_closure_ref _frida_g_closure_ref +#define g_closure_remove_finalize_notifier _frida_g_closure_remove_finalize_notifier +#define g_closure_remove_invalidate_notifier _frida_g_closure_remove_invalidate_notifier +#define g_closure_set_marshal _frida_g_closure_set_marshal +#define g_closure_set_meta_marshal _frida_g_closure_set_meta_marshal +#define g_closure_sink _frida_g_closure_sink +#define g_closure_unref _frida_g_closure_unref +#define g_completion_add_items _frida_g_completion_add_items +#define g_completion_clear_items _frida_g_completion_clear_items +#define g_completion_complete _frida_g_completion_complete +#define g_completion_complete_utf8 _frida_g_completion_complete_utf8 +#define g_completion_free _frida_g_completion_free +#define g_completion_new _frida_g_completion_new +#define g_completion_remove_items _frida_g_completion_remove_items +#define g_completion_set_compare _frida_g_completion_set_compare +#define g_compute_checksum_for_bytes _frida_g_compute_checksum_for_bytes +#define g_compute_checksum_for_data _frida_g_compute_checksum_for_data +#define g_compute_checksum_for_string _frida_g_compute_checksum_for_string +#define g_compute_hmac_for_bytes _frida_g_compute_hmac_for_bytes +#define g_compute_hmac_for_data _frida_g_compute_hmac_for_data +#define g_compute_hmac_for_string _frida_g_compute_hmac_for_string +#define g_cond_broadcast _frida_g_cond_broadcast +#define g_cond_clear _frida_g_cond_clear +#define g_cond_free _frida_g_cond_free +#define g_cond_init _frida_g_cond_init +#define g_cond_new _frida_g_cond_new +#define g_cond_signal _frida_g_cond_signal +#define g_cond_timed_wait _frida_g_cond_timed_wait +#define g_cond_wait _frida_g_cond_wait +#define g_cond_wait_until _frida_g_cond_wait_until +#define g_content_type_can_be_executable _frida_g_content_type_can_be_executable +#define g_content_type_equals _frida_g_content_type_equals +#define g_content_type_from_mime_type _frida_g_content_type_from_mime_type +#define g_content_type_get_description _frida_g_content_type_get_description +#define g_content_type_get_generic_icon_name _frida_g_content_type_get_generic_icon_name +#define g_content_type_get_icon _frida_g_content_type_get_icon +#define g_content_type_get_mime_dirs _frida_g_content_type_get_mime_dirs +#define g_content_type_get_mime_type _frida_g_content_type_get_mime_type +#define g_content_type_get_symbolic_icon _frida_g_content_type_get_symbolic_icon +#define g_content_type_guess _frida_g_content_type_guess +#define g_content_type_guess_for_tree _frida_g_content_type_guess_for_tree +#define g_content_type_is_a _frida_g_content_type_is_a +#define g_content_type_is_mime_type _frida_g_content_type_is_mime_type +#define g_content_type_is_unknown _frida_g_content_type_is_unknown +#define g_content_type_set_mime_dirs _frida_g_content_type_set_mime_dirs +#define g_content_types_get_registered _frida_g_content_types_get_registered +#define g_context_specific_group_emit _frida_g_context_specific_group_emit +#define g_context_specific_group_get _frida_g_context_specific_group_get +#define g_context_specific_group_remove _frida_g_context_specific_group_remove +#define g_convert _frida_g_convert +#define g_convert_error_quark _frida_g_convert_error_quark +#define g_convert_with_fallback _frida_g_convert_with_fallback +#define g_convert_with_iconv _frida_g_convert_with_iconv +#define g_converter_convert _frida_g_converter_convert +#define g_converter_flags_get_type _frida_g_converter_flags_get_type +#define g_converter_get_type _frida_g_converter_get_type +#define g_converter_input_stream_get_converter _frida_g_converter_input_stream_get_converter +#define g_converter_input_stream_get_type _frida_g_converter_input_stream_get_type +#define g_converter_input_stream_new _frida_g_converter_input_stream_new +#define g_converter_output_stream_get_converter _frida_g_converter_output_stream_get_converter +#define g_converter_output_stream_get_type _frida_g_converter_output_stream_get_type +#define g_converter_output_stream_new _frida_g_converter_output_stream_new +#define g_converter_reset _frida_g_converter_reset +#define g_converter_result_get_type _frida_g_converter_result_get_type +#define g_creat _frida_g_creat +#define g_credentials_get_native _frida_g_credentials_get_native +#define g_credentials_get_type _frida_g_credentials_get_type +#define g_credentials_get_unix_pid _frida_g_credentials_get_unix_pid +#define g_credentials_get_unix_user _frida_g_credentials_get_unix_user +#define g_credentials_is_same_user _frida_g_credentials_is_same_user +#define g_credentials_new _frida_g_credentials_new +#define g_credentials_set_native _frida_g_credentials_set_native +#define g_credentials_set_unix_user _frida_g_credentials_set_unix_user +#define g_credentials_to_string _frida_g_credentials_to_string +#define g_credentials_type_get_type _frida_g_credentials_type_get_type +#define g_data_input_stream_get_byte_order _frida_g_data_input_stream_get_byte_order +#define g_data_input_stream_get_newline_type _frida_g_data_input_stream_get_newline_type +#define g_data_input_stream_get_type _frida_g_data_input_stream_get_type +#define g_data_input_stream_new _frida_g_data_input_stream_new +#define g_data_input_stream_read_byte _frida_g_data_input_stream_read_byte +#define g_data_input_stream_read_int16 _frida_g_data_input_stream_read_int16 +#define g_data_input_stream_read_int32 _frida_g_data_input_stream_read_int32 +#define g_data_input_stream_read_int64 _frida_g_data_input_stream_read_int64 +#define g_data_input_stream_read_line _frida_g_data_input_stream_read_line +#define g_data_input_stream_read_line_async _frida_g_data_input_stream_read_line_async +#define g_data_input_stream_read_line_finish _frida_g_data_input_stream_read_line_finish +#define g_data_input_stream_read_line_finish_utf8 _frida_g_data_input_stream_read_line_finish_utf8 +#define g_data_input_stream_read_line_utf8 _frida_g_data_input_stream_read_line_utf8 +#define g_data_input_stream_read_uint16 _frida_g_data_input_stream_read_uint16 +#define g_data_input_stream_read_uint32 _frida_g_data_input_stream_read_uint32 +#define g_data_input_stream_read_uint64 _frida_g_data_input_stream_read_uint64 +#define g_data_input_stream_read_until _frida_g_data_input_stream_read_until +#define g_data_input_stream_read_until_async _frida_g_data_input_stream_read_until_async +#define g_data_input_stream_read_until_finish _frida_g_data_input_stream_read_until_finish +#define g_data_input_stream_read_upto _frida_g_data_input_stream_read_upto +#define g_data_input_stream_read_upto_async _frida_g_data_input_stream_read_upto_async +#define g_data_input_stream_read_upto_finish _frida_g_data_input_stream_read_upto_finish +#define g_data_input_stream_set_byte_order _frida_g_data_input_stream_set_byte_order +#define g_data_input_stream_set_newline_type _frida_g_data_input_stream_set_newline_type +#define g_data_output_stream_get_byte_order _frida_g_data_output_stream_get_byte_order +#define g_data_output_stream_get_type _frida_g_data_output_stream_get_type +#define g_data_output_stream_new _frida_g_data_output_stream_new +#define g_data_output_stream_put_byte _frida_g_data_output_stream_put_byte +#define g_data_output_stream_put_int16 _frida_g_data_output_stream_put_int16 +#define g_data_output_stream_put_int32 _frida_g_data_output_stream_put_int32 +#define g_data_output_stream_put_int64 _frida_g_data_output_stream_put_int64 +#define g_data_output_stream_put_string _frida_g_data_output_stream_put_string +#define g_data_output_stream_put_uint16 _frida_g_data_output_stream_put_uint16 +#define g_data_output_stream_put_uint32 _frida_g_data_output_stream_put_uint32 +#define g_data_output_stream_put_uint64 _frida_g_data_output_stream_put_uint64 +#define g_data_output_stream_set_byte_order _frida_g_data_output_stream_set_byte_order +#define g_data_stream_byte_order_get_type _frida_g_data_stream_byte_order_get_type +#define g_data_stream_newline_type_get_type _frida_g_data_stream_newline_type_get_type +#define g_datagram_based_condition_check _frida_g_datagram_based_condition_check +#define g_datagram_based_condition_wait _frida_g_datagram_based_condition_wait +#define g_datagram_based_create_source _frida_g_datagram_based_create_source +#define g_datagram_based_get_type _frida_g_datagram_based_get_type +#define g_datagram_based_receive_messages _frida_g_datagram_based_receive_messages +#define g_datagram_based_send_messages _frida_g_datagram_based_send_messages +#define g_datalist_clear _frida_g_datalist_clear +#define g_datalist_foreach _frida_g_datalist_foreach +#define g_datalist_get_data _frida_g_datalist_get_data +#define g_datalist_get_flags _frida_g_datalist_get_flags +#define g_datalist_id_dup_data _frida_g_datalist_id_dup_data +#define g_datalist_id_get_data _frida_g_datalist_id_get_data +#define g_datalist_id_remove_no_notify _frida_g_datalist_id_remove_no_notify +#define g_datalist_id_replace_data _frida_g_datalist_id_replace_data +#define g_datalist_id_set_data_full _frida_g_datalist_id_set_data_full +#define g_datalist_init _frida_g_datalist_init +#define g_datalist_set_flags _frida_g_datalist_set_flags +#define g_datalist_unset_flags _frida_g_datalist_unset_flags +#define g_dataset_destroy _frida_g_dataset_destroy +#define g_dataset_foreach _frida_g_dataset_foreach +#define g_dataset_id_get_data _frida_g_dataset_id_get_data +#define g_dataset_id_remove_no_notify _frida_g_dataset_id_remove_no_notify +#define g_dataset_id_set_data_full _frida_g_dataset_id_set_data_full +#define g_date_add_days _frida_g_date_add_days +#define g_date_add_months _frida_g_date_add_months +#define g_date_add_years _frida_g_date_add_years +#define g_date_clamp _frida_g_date_clamp +#define g_date_clear _frida_g_date_clear +#define g_date_compare _frida_g_date_compare +#define g_date_copy _frida_g_date_copy +#define g_date_days_between _frida_g_date_days_between +#define g_date_free _frida_g_date_free +#define g_date_get_day _frida_g_date_get_day +#define g_date_get_day_of_year _frida_g_date_get_day_of_year +#define g_date_get_days_in_month _frida_g_date_get_days_in_month +#define g_date_get_iso8601_week_of_year _frida_g_date_get_iso8601_week_of_year +#define g_date_get_julian _frida_g_date_get_julian +#define g_date_get_monday_week_of_year _frida_g_date_get_monday_week_of_year +#define g_date_get_monday_weeks_in_year _frida_g_date_get_monday_weeks_in_year +#define g_date_get_month _frida_g_date_get_month +#define g_date_get_sunday_week_of_year _frida_g_date_get_sunday_week_of_year +#define g_date_get_sunday_weeks_in_year _frida_g_date_get_sunday_weeks_in_year +#define g_date_get_type _frida_g_date_get_type +#define g_date_get_weekday _frida_g_date_get_weekday +#define g_date_get_year _frida_g_date_get_year +#define g_date_is_first_of_month _frida_g_date_is_first_of_month +#define g_date_is_last_of_month _frida_g_date_is_last_of_month +#define g_date_is_leap_year _frida_g_date_is_leap_year +#define g_date_new _frida_g_date_new +#define g_date_new_dmy _frida_g_date_new_dmy +#define g_date_new_julian _frida_g_date_new_julian +#define g_date_order _frida_g_date_order +#define g_date_set_day _frida_g_date_set_day +#define g_date_set_dmy _frida_g_date_set_dmy +#define g_date_set_julian _frida_g_date_set_julian +#define g_date_set_month _frida_g_date_set_month +#define g_date_set_parse _frida_g_date_set_parse +#define g_date_set_time _frida_g_date_set_time +#define g_date_set_time_t _frida_g_date_set_time_t +#define g_date_set_time_val _frida_g_date_set_time_val +#define g_date_set_year _frida_g_date_set_year +#define g_date_strftime _frida_g_date_strftime +#define g_date_subtract_days _frida_g_date_subtract_days +#define g_date_subtract_months _frida_g_date_subtract_months +#define g_date_subtract_years _frida_g_date_subtract_years +#define g_date_time_add _frida_g_date_time_add +#define g_date_time_add_days _frida_g_date_time_add_days +#define g_date_time_add_full _frida_g_date_time_add_full +#define g_date_time_add_hours _frida_g_date_time_add_hours +#define g_date_time_add_minutes _frida_g_date_time_add_minutes +#define g_date_time_add_months _frida_g_date_time_add_months +#define g_date_time_add_seconds _frida_g_date_time_add_seconds +#define g_date_time_add_weeks _frida_g_date_time_add_weeks +#define g_date_time_add_years _frida_g_date_time_add_years +#define g_date_time_compare _frida_g_date_time_compare +#define g_date_time_difference _frida_g_date_time_difference +#define g_date_time_equal _frida_g_date_time_equal +#define g_date_time_format _frida_g_date_time_format +#define g_date_time_format_iso8601 _frida_g_date_time_format_iso8601 +#define g_date_time_get_day_of_month _frida_g_date_time_get_day_of_month +#define g_date_time_get_day_of_week _frida_g_date_time_get_day_of_week +#define g_date_time_get_day_of_year _frida_g_date_time_get_day_of_year +#define g_date_time_get_hour _frida_g_date_time_get_hour +#define g_date_time_get_microsecond _frida_g_date_time_get_microsecond +#define g_date_time_get_minute _frida_g_date_time_get_minute +#define g_date_time_get_month _frida_g_date_time_get_month +#define g_date_time_get_second _frida_g_date_time_get_second +#define g_date_time_get_seconds _frida_g_date_time_get_seconds +#define g_date_time_get_timezone _frida_g_date_time_get_timezone +#define g_date_time_get_timezone_abbreviation _frida_g_date_time_get_timezone_abbreviation +#define g_date_time_get_type _frida_g_date_time_get_type +#define g_date_time_get_utc_offset _frida_g_date_time_get_utc_offset +#define g_date_time_get_week_numbering_year _frida_g_date_time_get_week_numbering_year +#define g_date_time_get_week_of_year _frida_g_date_time_get_week_of_year +#define g_date_time_get_year _frida_g_date_time_get_year +#define g_date_time_get_ymd _frida_g_date_time_get_ymd +#define g_date_time_hash _frida_g_date_time_hash +#define g_date_time_is_daylight_savings _frida_g_date_time_is_daylight_savings +#define g_date_time_new _frida_g_date_time_new +#define g_date_time_new_from_iso8601 _frida_g_date_time_new_from_iso8601 +#define g_date_time_new_from_timeval_local _frida_g_date_time_new_from_timeval_local +#define g_date_time_new_from_timeval_utc _frida_g_date_time_new_from_timeval_utc +#define g_date_time_new_from_unix_local _frida_g_date_time_new_from_unix_local +#define g_date_time_new_from_unix_utc _frida_g_date_time_new_from_unix_utc +#define g_date_time_new_local _frida_g_date_time_new_local +#define g_date_time_new_now _frida_g_date_time_new_now +#define g_date_time_new_now_local _frida_g_date_time_new_now_local +#define g_date_time_new_now_utc _frida_g_date_time_new_now_utc +#define g_date_time_new_utc _frida_g_date_time_new_utc +#define g_date_time_ref _frida_g_date_time_ref +#define g_date_time_to_local _frida_g_date_time_to_local +#define g_date_time_to_timeval _frida_g_date_time_to_timeval +#define g_date_time_to_timezone _frida_g_date_time_to_timezone +#define g_date_time_to_unix _frida_g_date_time_to_unix +#define g_date_time_to_utc _frida_g_date_time_to_utc +#define g_date_time_unref _frida_g_date_time_unref +#define g_date_to_struct_tm _frida_g_date_to_struct_tm +#define g_date_valid _frida_g_date_valid +#define g_date_valid_day _frida_g_date_valid_day +#define g_date_valid_dmy _frida_g_date_valid_dmy +#define g_date_valid_julian _frida_g_date_valid_julian +#define g_date_valid_month _frida_g_date_valid_month +#define g_date_valid_weekday _frida_g_date_valid_weekday +#define g_date_valid_year _frida_g_date_valid_year +#define g_dbus_action_group_get _frida_g_dbus_action_group_get +#define g_dbus_action_group_get_type _frida_g_dbus_action_group_get_type +#define g_dbus_action_group_sync _frida_g_dbus_action_group_sync +#define g_dbus_address_escape_value _frida_g_dbus_address_escape_value +#define g_dbus_address_get_for_bus_sync _frida_g_dbus_address_get_for_bus_sync +#define g_dbus_address_get_stream _frida_g_dbus_address_get_stream +#define g_dbus_address_get_stream_finish _frida_g_dbus_address_get_stream_finish +#define g_dbus_address_get_stream_sync _frida_g_dbus_address_get_stream_sync +#define g_dbus_annotation_info_get_type _frida_g_dbus_annotation_info_get_type +#define g_dbus_annotation_info_lookup _frida_g_dbus_annotation_info_lookup +#define g_dbus_annotation_info_ref _frida_g_dbus_annotation_info_ref +#define g_dbus_annotation_info_unref _frida_g_dbus_annotation_info_unref +#define g_dbus_arg_info_get_type _frida_g_dbus_arg_info_get_type +#define g_dbus_arg_info_ref _frida_g_dbus_arg_info_ref +#define g_dbus_arg_info_unref _frida_g_dbus_arg_info_unref +#define g_dbus_auth_observer_allow_mechanism _frida_g_dbus_auth_observer_allow_mechanism +#define g_dbus_auth_observer_authorize_authenticated_peer _frida_g_dbus_auth_observer_authorize_authenticated_peer +#define g_dbus_auth_observer_get_type _frida_g_dbus_auth_observer_get_type +#define g_dbus_auth_observer_new _frida_g_dbus_auth_observer_new +#define g_dbus_call_flags_get_type _frida_g_dbus_call_flags_get_type +#define g_dbus_capability_flags_get_type _frida_g_dbus_capability_flags_get_type +#define g_dbus_connection_add_filter _frida_g_dbus_connection_add_filter +#define g_dbus_connection_call _frida_g_dbus_connection_call +#define g_dbus_connection_call_finish _frida_g_dbus_connection_call_finish +#define g_dbus_connection_call_sync _frida_g_dbus_connection_call_sync +#define g_dbus_connection_call_with_unix_fd_list _frida_g_dbus_connection_call_with_unix_fd_list +#define g_dbus_connection_call_with_unix_fd_list_finish _frida_g_dbus_connection_call_with_unix_fd_list_finish +#define g_dbus_connection_call_with_unix_fd_list_sync _frida_g_dbus_connection_call_with_unix_fd_list_sync +#define g_dbus_connection_close _frida_g_dbus_connection_close +#define g_dbus_connection_close_finish _frida_g_dbus_connection_close_finish +#define g_dbus_connection_close_sync _frida_g_dbus_connection_close_sync +#define g_dbus_connection_emit_signal _frida_g_dbus_connection_emit_signal +#define g_dbus_connection_export_action_group _frida_g_dbus_connection_export_action_group +#define g_dbus_connection_export_menu_model _frida_g_dbus_connection_export_menu_model +#define g_dbus_connection_flags_get_type _frida_g_dbus_connection_flags_get_type +#define g_dbus_connection_flush _frida_g_dbus_connection_flush +#define g_dbus_connection_flush_finish _frida_g_dbus_connection_flush_finish +#define g_dbus_connection_flush_sync _frida_g_dbus_connection_flush_sync +#define g_dbus_connection_get_capabilities _frida_g_dbus_connection_get_capabilities +#define g_dbus_connection_get_exit_on_close _frida_g_dbus_connection_get_exit_on_close +#define g_dbus_connection_get_flags _frida_g_dbus_connection_get_flags +#define g_dbus_connection_get_guid _frida_g_dbus_connection_get_guid +#define g_dbus_connection_get_last_serial _frida_g_dbus_connection_get_last_serial +#define g_dbus_connection_get_peer_credentials _frida_g_dbus_connection_get_peer_credentials +#define g_dbus_connection_get_stream _frida_g_dbus_connection_get_stream +#define g_dbus_connection_get_type _frida_g_dbus_connection_get_type +#define g_dbus_connection_get_unique_name _frida_g_dbus_connection_get_unique_name +#define g_dbus_connection_is_closed _frida_g_dbus_connection_is_closed +#define g_dbus_connection_new _frida_g_dbus_connection_new +#define g_dbus_connection_new_finish _frida_g_dbus_connection_new_finish +#define g_dbus_connection_new_for_address _frida_g_dbus_connection_new_for_address +#define g_dbus_connection_new_for_address_finish _frida_g_dbus_connection_new_for_address_finish +#define g_dbus_connection_new_for_address_sync _frida_g_dbus_connection_new_for_address_sync +#define g_dbus_connection_new_sync _frida_g_dbus_connection_new_sync +#define g_dbus_connection_register_object _frida_g_dbus_connection_register_object +#define g_dbus_connection_register_object_with_closures _frida_g_dbus_connection_register_object_with_closures +#define g_dbus_connection_register_subtree _frida_g_dbus_connection_register_subtree +#define g_dbus_connection_remove_filter _frida_g_dbus_connection_remove_filter +#define g_dbus_connection_send_message _frida_g_dbus_connection_send_message +#define g_dbus_connection_send_message_with_reply _frida_g_dbus_connection_send_message_with_reply +#define g_dbus_connection_send_message_with_reply_finish _frida_g_dbus_connection_send_message_with_reply_finish +#define g_dbus_connection_send_message_with_reply_sync _frida_g_dbus_connection_send_message_with_reply_sync +#define g_dbus_connection_set_exit_on_close _frida_g_dbus_connection_set_exit_on_close +#define g_dbus_connection_signal_subscribe _frida_g_dbus_connection_signal_subscribe +#define g_dbus_connection_signal_unsubscribe _frida_g_dbus_connection_signal_unsubscribe +#define g_dbus_connection_start_message_processing _frida_g_dbus_connection_start_message_processing +#define g_dbus_connection_unexport_action_group _frida_g_dbus_connection_unexport_action_group +#define g_dbus_connection_unexport_menu_model _frida_g_dbus_connection_unexport_menu_model +#define g_dbus_connection_unregister_object _frida_g_dbus_connection_unregister_object +#define g_dbus_connection_unregister_subtree _frida_g_dbus_connection_unregister_subtree +#define g_dbus_error_encode_gerror _frida_g_dbus_error_encode_gerror +#define g_dbus_error_get_remote_error _frida_g_dbus_error_get_remote_error +#define g_dbus_error_get_type _frida_g_dbus_error_get_type +#define g_dbus_error_is_remote_error _frida_g_dbus_error_is_remote_error +#define g_dbus_error_new_for_dbus_error _frida_g_dbus_error_new_for_dbus_error +#define g_dbus_error_quark _frida_g_dbus_error_quark +#define g_dbus_error_register_error _frida_g_dbus_error_register_error +#define g_dbus_error_register_error_domain _frida_g_dbus_error_register_error_domain +#define g_dbus_error_set_dbus_error _frida_g_dbus_error_set_dbus_error +#define g_dbus_error_set_dbus_error_valist _frida_g_dbus_error_set_dbus_error_valist +#define g_dbus_error_strip_remote_error _frida_g_dbus_error_strip_remote_error +#define g_dbus_error_unregister_error _frida_g_dbus_error_unregister_error +#define g_dbus_generate_guid _frida_g_dbus_generate_guid +#define g_dbus_gvalue_to_gvariant _frida_g_dbus_gvalue_to_gvariant +#define g_dbus_gvariant_to_gvalue _frida_g_dbus_gvariant_to_gvalue +#define g_dbus_interface_dup_object _frida_g_dbus_interface_dup_object +#define g_dbus_interface_get_info _frida_g_dbus_interface_get_info +#define g_dbus_interface_get_object _frida_g_dbus_interface_get_object +#define g_dbus_interface_get_type _frida_g_dbus_interface_get_type +#define g_dbus_interface_info_cache_build _frida_g_dbus_interface_info_cache_build +#define g_dbus_interface_info_cache_release _frida_g_dbus_interface_info_cache_release +#define g_dbus_interface_info_generate_xml _frida_g_dbus_interface_info_generate_xml +#define g_dbus_interface_info_get_type _frida_g_dbus_interface_info_get_type +#define g_dbus_interface_info_lookup_method _frida_g_dbus_interface_info_lookup_method +#define g_dbus_interface_info_lookup_property _frida_g_dbus_interface_info_lookup_property +#define g_dbus_interface_info_lookup_signal _frida_g_dbus_interface_info_lookup_signal +#define g_dbus_interface_info_ref _frida_g_dbus_interface_info_ref +#define g_dbus_interface_info_unref _frida_g_dbus_interface_info_unref +#define g_dbus_interface_set_object _frida_g_dbus_interface_set_object +#define g_dbus_interface_skeleton_export _frida_g_dbus_interface_skeleton_export +#define g_dbus_interface_skeleton_flags_get_type _frida_g_dbus_interface_skeleton_flags_get_type +#define g_dbus_interface_skeleton_flush _frida_g_dbus_interface_skeleton_flush +#define g_dbus_interface_skeleton_get_connection _frida_g_dbus_interface_skeleton_get_connection +#define g_dbus_interface_skeleton_get_connections _frida_g_dbus_interface_skeleton_get_connections +#define g_dbus_interface_skeleton_get_flags _frida_g_dbus_interface_skeleton_get_flags +#define g_dbus_interface_skeleton_get_info _frida_g_dbus_interface_skeleton_get_info +#define g_dbus_interface_skeleton_get_object_path _frida_g_dbus_interface_skeleton_get_object_path +#define g_dbus_interface_skeleton_get_properties _frida_g_dbus_interface_skeleton_get_properties +#define g_dbus_interface_skeleton_get_type _frida_g_dbus_interface_skeleton_get_type +#define g_dbus_interface_skeleton_get_vtable _frida_g_dbus_interface_skeleton_get_vtable +#define g_dbus_interface_skeleton_has_connection _frida_g_dbus_interface_skeleton_has_connection +#define g_dbus_interface_skeleton_set_flags _frida_g_dbus_interface_skeleton_set_flags +#define g_dbus_interface_skeleton_unexport _frida_g_dbus_interface_skeleton_unexport +#define g_dbus_interface_skeleton_unexport_from_connection _frida_g_dbus_interface_skeleton_unexport_from_connection +#define g_dbus_is_address _frida_g_dbus_is_address +#define g_dbus_is_guid _frida_g_dbus_is_guid +#define g_dbus_is_interface_name _frida_g_dbus_is_interface_name +#define g_dbus_is_member_name _frida_g_dbus_is_member_name +#define g_dbus_is_name _frida_g_dbus_is_name +#define g_dbus_is_supported_address _frida_g_dbus_is_supported_address +#define g_dbus_is_unique_name _frida_g_dbus_is_unique_name +#define g_dbus_menu_model_get _frida_g_dbus_menu_model_get +#define g_dbus_menu_model_get_type _frida_g_dbus_menu_model_get_type +#define g_dbus_message_byte_order_get_type _frida_g_dbus_message_byte_order_get_type +#define g_dbus_message_bytes_needed _frida_g_dbus_message_bytes_needed +#define g_dbus_message_copy _frida_g_dbus_message_copy +#define g_dbus_message_flags_get_type _frida_g_dbus_message_flags_get_type +#define g_dbus_message_get_arg0 _frida_g_dbus_message_get_arg0 +#define g_dbus_message_get_body _frida_g_dbus_message_get_body +#define g_dbus_message_get_byte_order _frida_g_dbus_message_get_byte_order +#define g_dbus_message_get_destination _frida_g_dbus_message_get_destination +#define g_dbus_message_get_error_name _frida_g_dbus_message_get_error_name +#define g_dbus_message_get_flags _frida_g_dbus_message_get_flags +#define g_dbus_message_get_header _frida_g_dbus_message_get_header +#define g_dbus_message_get_header_fields _frida_g_dbus_message_get_header_fields +#define g_dbus_message_get_interface _frida_g_dbus_message_get_interface +#define g_dbus_message_get_locked _frida_g_dbus_message_get_locked +#define g_dbus_message_get_member _frida_g_dbus_message_get_member +#define g_dbus_message_get_message_type _frida_g_dbus_message_get_message_type +#define g_dbus_message_get_num_unix_fds _frida_g_dbus_message_get_num_unix_fds +#define g_dbus_message_get_path _frida_g_dbus_message_get_path +#define g_dbus_message_get_reply_serial _frida_g_dbus_message_get_reply_serial +#define g_dbus_message_get_sender _frida_g_dbus_message_get_sender +#define g_dbus_message_get_serial _frida_g_dbus_message_get_serial +#define g_dbus_message_get_signature _frida_g_dbus_message_get_signature +#define g_dbus_message_get_type _frida_g_dbus_message_get_type +#define g_dbus_message_get_unix_fd_list _frida_g_dbus_message_get_unix_fd_list +#define g_dbus_message_header_field_get_type _frida_g_dbus_message_header_field_get_type +#define g_dbus_message_lock _frida_g_dbus_message_lock +#define g_dbus_message_new _frida_g_dbus_message_new +#define g_dbus_message_new_from_blob _frida_g_dbus_message_new_from_blob +#define g_dbus_message_new_method_call _frida_g_dbus_message_new_method_call +#define g_dbus_message_new_method_error _frida_g_dbus_message_new_method_error +#define g_dbus_message_new_method_error_literal _frida_g_dbus_message_new_method_error_literal +#define g_dbus_message_new_method_error_valist _frida_g_dbus_message_new_method_error_valist +#define g_dbus_message_new_method_reply _frida_g_dbus_message_new_method_reply +#define g_dbus_message_new_signal _frida_g_dbus_message_new_signal +#define g_dbus_message_print _frida_g_dbus_message_print +#define g_dbus_message_set_body _frida_g_dbus_message_set_body +#define g_dbus_message_set_byte_order _frida_g_dbus_message_set_byte_order +#define g_dbus_message_set_destination _frida_g_dbus_message_set_destination +#define g_dbus_message_set_error_name _frida_g_dbus_message_set_error_name +#define g_dbus_message_set_flags _frida_g_dbus_message_set_flags +#define g_dbus_message_set_header _frida_g_dbus_message_set_header +#define g_dbus_message_set_interface _frida_g_dbus_message_set_interface +#define g_dbus_message_set_member _frida_g_dbus_message_set_member +#define g_dbus_message_set_message_type _frida_g_dbus_message_set_message_type +#define g_dbus_message_set_num_unix_fds _frida_g_dbus_message_set_num_unix_fds +#define g_dbus_message_set_path _frida_g_dbus_message_set_path +#define g_dbus_message_set_reply_serial _frida_g_dbus_message_set_reply_serial +#define g_dbus_message_set_sender _frida_g_dbus_message_set_sender +#define g_dbus_message_set_serial _frida_g_dbus_message_set_serial +#define g_dbus_message_set_signature _frida_g_dbus_message_set_signature +#define g_dbus_message_set_unix_fd_list _frida_g_dbus_message_set_unix_fd_list +#define g_dbus_message_to_blob _frida_g_dbus_message_to_blob +#define g_dbus_message_to_gerror _frida_g_dbus_message_to_gerror +#define g_dbus_message_type_get_type _frida_g_dbus_message_type_get_type +#define g_dbus_method_info_get_type _frida_g_dbus_method_info_get_type +#define g_dbus_method_info_ref _frida_g_dbus_method_info_ref +#define g_dbus_method_info_unref _frida_g_dbus_method_info_unref +#define g_dbus_method_invocation_get_connection _frida_g_dbus_method_invocation_get_connection +#define g_dbus_method_invocation_get_interface_name _frida_g_dbus_method_invocation_get_interface_name +#define g_dbus_method_invocation_get_message _frida_g_dbus_method_invocation_get_message +#define g_dbus_method_invocation_get_method_info _frida_g_dbus_method_invocation_get_method_info +#define g_dbus_method_invocation_get_method_name _frida_g_dbus_method_invocation_get_method_name +#define g_dbus_method_invocation_get_object_path _frida_g_dbus_method_invocation_get_object_path +#define g_dbus_method_invocation_get_parameters _frida_g_dbus_method_invocation_get_parameters +#define g_dbus_method_invocation_get_property_info _frida_g_dbus_method_invocation_get_property_info +#define g_dbus_method_invocation_get_sender _frida_g_dbus_method_invocation_get_sender +#define g_dbus_method_invocation_get_type _frida_g_dbus_method_invocation_get_type +#define g_dbus_method_invocation_get_user_data _frida_g_dbus_method_invocation_get_user_data +#define g_dbus_method_invocation_return_dbus_error _frida_g_dbus_method_invocation_return_dbus_error +#define g_dbus_method_invocation_return_error _frida_g_dbus_method_invocation_return_error +#define g_dbus_method_invocation_return_error_literal _frida_g_dbus_method_invocation_return_error_literal +#define g_dbus_method_invocation_return_error_valist _frida_g_dbus_method_invocation_return_error_valist +#define g_dbus_method_invocation_return_gerror _frida_g_dbus_method_invocation_return_gerror +#define g_dbus_method_invocation_return_value _frida_g_dbus_method_invocation_return_value +#define g_dbus_method_invocation_return_value_with_unix_fd_list _frida_g_dbus_method_invocation_return_value_with_unix_fd_list +#define g_dbus_method_invocation_take_error _frida_g_dbus_method_invocation_take_error +#define g_dbus_node_info_generate_xml _frida_g_dbus_node_info_generate_xml +#define g_dbus_node_info_get_type _frida_g_dbus_node_info_get_type +#define g_dbus_node_info_lookup_interface _frida_g_dbus_node_info_lookup_interface +#define g_dbus_node_info_new_for_xml _frida_g_dbus_node_info_new_for_xml +#define g_dbus_node_info_ref _frida_g_dbus_node_info_ref +#define g_dbus_node_info_unref _frida_g_dbus_node_info_unref +#define g_dbus_object_get_interface _frida_g_dbus_object_get_interface +#define g_dbus_object_get_interfaces _frida_g_dbus_object_get_interfaces +#define g_dbus_object_get_object_path _frida_g_dbus_object_get_object_path +#define g_dbus_object_get_type _frida_g_dbus_object_get_type +#define g_dbus_object_manager_client_flags_get_type _frida_g_dbus_object_manager_client_flags_get_type +#define g_dbus_object_manager_client_get_connection _frida_g_dbus_object_manager_client_get_connection +#define g_dbus_object_manager_client_get_flags _frida_g_dbus_object_manager_client_get_flags +#define g_dbus_object_manager_client_get_name _frida_g_dbus_object_manager_client_get_name +#define g_dbus_object_manager_client_get_name_owner _frida_g_dbus_object_manager_client_get_name_owner +#define g_dbus_object_manager_client_get_type _frida_g_dbus_object_manager_client_get_type +#define g_dbus_object_manager_client_new _frida_g_dbus_object_manager_client_new +#define g_dbus_object_manager_client_new_finish _frida_g_dbus_object_manager_client_new_finish +#define g_dbus_object_manager_client_new_for_bus _frida_g_dbus_object_manager_client_new_for_bus +#define g_dbus_object_manager_client_new_for_bus_finish _frida_g_dbus_object_manager_client_new_for_bus_finish +#define g_dbus_object_manager_client_new_for_bus_sync _frida_g_dbus_object_manager_client_new_for_bus_sync +#define g_dbus_object_manager_client_new_sync _frida_g_dbus_object_manager_client_new_sync +#define g_dbus_object_manager_get_interface _frida_g_dbus_object_manager_get_interface +#define g_dbus_object_manager_get_object _frida_g_dbus_object_manager_get_object +#define g_dbus_object_manager_get_object_path _frida_g_dbus_object_manager_get_object_path +#define g_dbus_object_manager_get_objects _frida_g_dbus_object_manager_get_objects +#define g_dbus_object_manager_get_type _frida_g_dbus_object_manager_get_type +#define g_dbus_object_manager_server_export _frida_g_dbus_object_manager_server_export +#define g_dbus_object_manager_server_export_uniquely _frida_g_dbus_object_manager_server_export_uniquely +#define g_dbus_object_manager_server_get_connection _frida_g_dbus_object_manager_server_get_connection +#define g_dbus_object_manager_server_get_type _frida_g_dbus_object_manager_server_get_type +#define g_dbus_object_manager_server_is_exported _frida_g_dbus_object_manager_server_is_exported +#define g_dbus_object_manager_server_new _frida_g_dbus_object_manager_server_new +#define g_dbus_object_manager_server_set_connection _frida_g_dbus_object_manager_server_set_connection +#define g_dbus_object_manager_server_unexport _frida_g_dbus_object_manager_server_unexport +#define g_dbus_object_proxy_get_connection _frida_g_dbus_object_proxy_get_connection +#define g_dbus_object_proxy_get_type _frida_g_dbus_object_proxy_get_type +#define g_dbus_object_proxy_new _frida_g_dbus_object_proxy_new +#define g_dbus_object_skeleton_add_interface _frida_g_dbus_object_skeleton_add_interface +#define g_dbus_object_skeleton_flush _frida_g_dbus_object_skeleton_flush +#define g_dbus_object_skeleton_get_type _frida_g_dbus_object_skeleton_get_type +#define g_dbus_object_skeleton_new _frida_g_dbus_object_skeleton_new +#define g_dbus_object_skeleton_remove_interface _frida_g_dbus_object_skeleton_remove_interface +#define g_dbus_object_skeleton_remove_interface_by_name _frida_g_dbus_object_skeleton_remove_interface_by_name +#define g_dbus_object_skeleton_set_object_path _frida_g_dbus_object_skeleton_set_object_path +#define g_dbus_property_info_flags_get_type _frida_g_dbus_property_info_flags_get_type +#define g_dbus_property_info_get_type _frida_g_dbus_property_info_get_type +#define g_dbus_property_info_ref _frida_g_dbus_property_info_ref +#define g_dbus_property_info_unref _frida_g_dbus_property_info_unref +#define g_dbus_proxy_call _frida_g_dbus_proxy_call +#define g_dbus_proxy_call_finish _frida_g_dbus_proxy_call_finish +#define g_dbus_proxy_call_sync _frida_g_dbus_proxy_call_sync +#define g_dbus_proxy_call_with_unix_fd_list _frida_g_dbus_proxy_call_with_unix_fd_list +#define g_dbus_proxy_call_with_unix_fd_list_finish _frida_g_dbus_proxy_call_with_unix_fd_list_finish +#define g_dbus_proxy_call_with_unix_fd_list_sync _frida_g_dbus_proxy_call_with_unix_fd_list_sync +#define g_dbus_proxy_flags_get_type _frida_g_dbus_proxy_flags_get_type +#define g_dbus_proxy_get_cached_property _frida_g_dbus_proxy_get_cached_property +#define g_dbus_proxy_get_cached_property_names _frida_g_dbus_proxy_get_cached_property_names +#define g_dbus_proxy_get_connection _frida_g_dbus_proxy_get_connection +#define g_dbus_proxy_get_default_timeout _frida_g_dbus_proxy_get_default_timeout +#define g_dbus_proxy_get_flags _frida_g_dbus_proxy_get_flags +#define g_dbus_proxy_get_interface_info _frida_g_dbus_proxy_get_interface_info +#define g_dbus_proxy_get_interface_name _frida_g_dbus_proxy_get_interface_name +#define g_dbus_proxy_get_name _frida_g_dbus_proxy_get_name +#define g_dbus_proxy_get_name_owner _frida_g_dbus_proxy_get_name_owner +#define g_dbus_proxy_get_object_path _frida_g_dbus_proxy_get_object_path +#define g_dbus_proxy_get_type _frida_g_dbus_proxy_get_type +#define g_dbus_proxy_new _frida_g_dbus_proxy_new +#define g_dbus_proxy_new_finish _frida_g_dbus_proxy_new_finish +#define g_dbus_proxy_new_for_bus _frida_g_dbus_proxy_new_for_bus +#define g_dbus_proxy_new_for_bus_finish _frida_g_dbus_proxy_new_for_bus_finish +#define g_dbus_proxy_new_for_bus_sync _frida_g_dbus_proxy_new_for_bus_sync +#define g_dbus_proxy_new_sync _frida_g_dbus_proxy_new_sync +#define g_dbus_proxy_set_cached_property _frida_g_dbus_proxy_set_cached_property +#define g_dbus_proxy_set_default_timeout _frida_g_dbus_proxy_set_default_timeout +#define g_dbus_proxy_set_interface_info _frida_g_dbus_proxy_set_interface_info +#define g_dbus_send_message_flags_get_type _frida_g_dbus_send_message_flags_get_type +#define g_dbus_server_flags_get_type _frida_g_dbus_server_flags_get_type +#define g_dbus_server_get_client_address _frida_g_dbus_server_get_client_address +#define g_dbus_server_get_flags _frida_g_dbus_server_get_flags +#define g_dbus_server_get_guid _frida_g_dbus_server_get_guid +#define g_dbus_server_get_type _frida_g_dbus_server_get_type +#define g_dbus_server_is_active _frida_g_dbus_server_is_active +#define g_dbus_server_new_sync _frida_g_dbus_server_new_sync +#define g_dbus_server_start _frida_g_dbus_server_start +#define g_dbus_server_stop _frida_g_dbus_server_stop +#define g_dbus_signal_flags_get_type _frida_g_dbus_signal_flags_get_type +#define g_dbus_signal_info_get_type _frida_g_dbus_signal_info_get_type +#define g_dbus_signal_info_ref _frida_g_dbus_signal_info_ref +#define g_dbus_signal_info_unref _frida_g_dbus_signal_info_unref +#define g_dbus_subtree_flags_get_type _frida_g_dbus_subtree_flags_get_type +#define g_dcgettext _frida_g_dcgettext +#define g_delayed_settings_backend_apply _frida_g_delayed_settings_backend_apply +#define g_delayed_settings_backend_get_has_unapplied _frida_g_delayed_settings_backend_get_has_unapplied +#define g_delayed_settings_backend_get_type _frida_g_delayed_settings_backend_get_type +#define g_delayed_settings_backend_new _frida_g_delayed_settings_backend_new +#define g_delayed_settings_backend_revert _frida_g_delayed_settings_backend_revert +#define g_desktop_app_info_get_action_name _frida_g_desktop_app_info_get_action_name +#define g_desktop_app_info_get_boolean _frida_g_desktop_app_info_get_boolean +#define g_desktop_app_info_get_categories _frida_g_desktop_app_info_get_categories +#define g_desktop_app_info_get_filename _frida_g_desktop_app_info_get_filename +#define g_desktop_app_info_get_generic_name _frida_g_desktop_app_info_get_generic_name +#define g_desktop_app_info_get_implementations _frida_g_desktop_app_info_get_implementations +#define g_desktop_app_info_get_is_hidden _frida_g_desktop_app_info_get_is_hidden +#define g_desktop_app_info_get_keywords _frida_g_desktop_app_info_get_keywords +#define g_desktop_app_info_get_locale_string _frida_g_desktop_app_info_get_locale_string +#define g_desktop_app_info_get_nodisplay _frida_g_desktop_app_info_get_nodisplay +#define g_desktop_app_info_get_show_in _frida_g_desktop_app_info_get_show_in +#define g_desktop_app_info_get_startup_wm_class _frida_g_desktop_app_info_get_startup_wm_class +#define g_desktop_app_info_get_string _frida_g_desktop_app_info_get_string +#define g_desktop_app_info_get_string_list _frida_g_desktop_app_info_get_string_list +#define g_desktop_app_info_get_type _frida_g_desktop_app_info_get_type +#define g_desktop_app_info_has_key _frida_g_desktop_app_info_has_key +#define g_desktop_app_info_launch_action _frida_g_desktop_app_info_launch_action +#define g_desktop_app_info_launch_uris_as_manager _frida_g_desktop_app_info_launch_uris_as_manager +#define g_desktop_app_info_launch_uris_as_manager_with_fds _frida_g_desktop_app_info_launch_uris_as_manager_with_fds +#define g_desktop_app_info_list_actions _frida_g_desktop_app_info_list_actions +#define g_desktop_app_info_lookup_get_default_for_uri_scheme _frida_g_desktop_app_info_lookup_get_default_for_uri_scheme +#define g_desktop_app_info_lookup_get_type _frida_g_desktop_app_info_lookup_get_type +#define g_desktop_app_info_new _frida_g_desktop_app_info_new +#define g_desktop_app_info_new_from_filename _frida_g_desktop_app_info_new_from_filename +#define g_desktop_app_info_new_from_keyfile _frida_g_desktop_app_info_new_from_keyfile +#define g_desktop_app_info_search _frida_g_desktop_app_info_search +#define g_desktop_app_info_set_desktop_env _frida_g_desktop_app_info_set_desktop_env +#define g_dgettext _frida_g_dgettext +#define g_dir_close _frida_g_dir_close +#define g_dir_make_tmp _frida_g_dir_make_tmp +#define g_dir_new_from_dirp _frida_g_dir_new_from_dirp +#define g_dir_open _frida_g_dir_open +#define g_dir_open_with_errno _frida_g_dir_open_with_errno +#define g_dir_read_name _frida_g_dir_read_name +#define g_dir_rewind _frida_g_dir_rewind +#define g_direct_equal _frida_g_direct_equal +#define g_direct_hash _frida_g_direct_hash +#define g_dngettext _frida_g_dngettext +#define g_document_portal_add_documents _frida_g_document_portal_add_documents +#define g_double_equal _frida_g_double_equal +#define g_double_hash _frida_g_double_hash +#define g_dpgettext _frida_g_dpgettext +#define g_dpgettext2 _frida_g_dpgettext2 +#define g_drive_can_eject _frida_g_drive_can_eject +#define g_drive_can_poll_for_media _frida_g_drive_can_poll_for_media +#define g_drive_can_start _frida_g_drive_can_start +#define g_drive_can_start_degraded _frida_g_drive_can_start_degraded +#define g_drive_can_stop _frida_g_drive_can_stop +#define g_drive_eject _frida_g_drive_eject +#define g_drive_eject_finish _frida_g_drive_eject_finish +#define g_drive_eject_with_operation _frida_g_drive_eject_with_operation +#define g_drive_eject_with_operation_finish _frida_g_drive_eject_with_operation_finish +#define g_drive_enumerate_identifiers _frida_g_drive_enumerate_identifiers +#define g_drive_get_icon _frida_g_drive_get_icon +#define g_drive_get_identifier _frida_g_drive_get_identifier +#define g_drive_get_name _frida_g_drive_get_name +#define g_drive_get_sort_key _frida_g_drive_get_sort_key +#define g_drive_get_start_stop_type _frida_g_drive_get_start_stop_type +#define g_drive_get_symbolic_icon _frida_g_drive_get_symbolic_icon +#define g_drive_get_type _frida_g_drive_get_type +#define g_drive_get_volumes _frida_g_drive_get_volumes +#define g_drive_has_media _frida_g_drive_has_media +#define g_drive_has_volumes _frida_g_drive_has_volumes +#define g_drive_is_media_check_automatic _frida_g_drive_is_media_check_automatic +#define g_drive_is_media_removable _frida_g_drive_is_media_removable +#define g_drive_is_removable _frida_g_drive_is_removable +#define g_drive_poll_for_media _frida_g_drive_poll_for_media +#define g_drive_poll_for_media_finish _frida_g_drive_poll_for_media_finish +#define g_drive_start _frida_g_drive_start +#define g_drive_start_finish _frida_g_drive_start_finish +#define g_drive_start_flags_get_type _frida_g_drive_start_flags_get_type +#define g_drive_start_stop_type_get_type _frida_g_drive_start_stop_type_get_type +#define g_drive_stop _frida_g_drive_stop +#define g_drive_stop_finish _frida_g_drive_stop_finish +#define g_dtls_client_connection_get_accepted_cas _frida_g_dtls_client_connection_get_accepted_cas +#define g_dtls_client_connection_get_server_identity _frida_g_dtls_client_connection_get_server_identity +#define g_dtls_client_connection_get_type _frida_g_dtls_client_connection_get_type +#define g_dtls_client_connection_get_validation_flags _frida_g_dtls_client_connection_get_validation_flags +#define g_dtls_client_connection_new _frida_g_dtls_client_connection_new +#define g_dtls_client_connection_set_server_identity _frida_g_dtls_client_connection_set_server_identity +#define g_dtls_client_connection_set_validation_flags _frida_g_dtls_client_connection_set_validation_flags +#define g_dtls_connection_close _frida_g_dtls_connection_close +#define g_dtls_connection_close_async _frida_g_dtls_connection_close_async +#define g_dtls_connection_close_finish _frida_g_dtls_connection_close_finish +#define g_dtls_connection_emit_accept_certificate _frida_g_dtls_connection_emit_accept_certificate +#define g_dtls_connection_get_certificate _frida_g_dtls_connection_get_certificate +#define g_dtls_connection_get_channel_binding_data _frida_g_dtls_connection_get_channel_binding_data +#define g_dtls_connection_get_database _frida_g_dtls_connection_get_database +#define g_dtls_connection_get_interaction _frida_g_dtls_connection_get_interaction +#define g_dtls_connection_get_negotiated_protocol _frida_g_dtls_connection_get_negotiated_protocol +#define g_dtls_connection_get_peer_certificate _frida_g_dtls_connection_get_peer_certificate +#define g_dtls_connection_get_peer_certificate_errors _frida_g_dtls_connection_get_peer_certificate_errors +#define g_dtls_connection_get_rehandshake_mode _frida_g_dtls_connection_get_rehandshake_mode +#define g_dtls_connection_get_require_close_notify _frida_g_dtls_connection_get_require_close_notify +#define g_dtls_connection_get_type _frida_g_dtls_connection_get_type +#define g_dtls_connection_handshake _frida_g_dtls_connection_handshake +#define g_dtls_connection_handshake_async _frida_g_dtls_connection_handshake_async +#define g_dtls_connection_handshake_finish _frida_g_dtls_connection_handshake_finish +#define g_dtls_connection_set_advertised_protocols _frida_g_dtls_connection_set_advertised_protocols +#define g_dtls_connection_set_certificate _frida_g_dtls_connection_set_certificate +#define g_dtls_connection_set_database _frida_g_dtls_connection_set_database +#define g_dtls_connection_set_interaction _frida_g_dtls_connection_set_interaction +#define g_dtls_connection_set_rehandshake_mode _frida_g_dtls_connection_set_rehandshake_mode +#define g_dtls_connection_set_require_close_notify _frida_g_dtls_connection_set_require_close_notify +#define g_dtls_connection_shutdown _frida_g_dtls_connection_shutdown +#define g_dtls_connection_shutdown_async _frida_g_dtls_connection_shutdown_async +#define g_dtls_connection_shutdown_finish _frida_g_dtls_connection_shutdown_finish +#define g_dtls_server_connection_get_type _frida_g_dtls_server_connection_get_type +#define g_dtls_server_connection_new _frida_g_dtls_server_connection_new +#define g_emblem_get_icon _frida_g_emblem_get_icon +#define g_emblem_get_origin _frida_g_emblem_get_origin +#define g_emblem_get_type _frida_g_emblem_get_type +#define g_emblem_new _frida_g_emblem_new +#define g_emblem_new_with_origin _frida_g_emblem_new_with_origin +#define g_emblem_origin_get_type _frida_g_emblem_origin_get_type +#define g_emblemed_icon_add_emblem _frida_g_emblemed_icon_add_emblem +#define g_emblemed_icon_clear_emblems _frida_g_emblemed_icon_clear_emblems +#define g_emblemed_icon_get_emblems _frida_g_emblemed_icon_get_emblems +#define g_emblemed_icon_get_icon _frida_g_emblemed_icon_get_icon +#define g_emblemed_icon_get_type _frida_g_emblemed_icon_get_type +#define g_emblemed_icon_new _frida_g_emblemed_icon_new +#define g_enum_complete_type_info _frida_g_enum_complete_type_info +#define g_enum_get_value _frida_g_enum_get_value +#define g_enum_get_value_by_name _frida_g_enum_get_value_by_name +#define g_enum_get_value_by_nick _frida_g_enum_get_value_by_nick +#define g_enum_register_static _frida_g_enum_register_static +#define g_enum_to_string _frida_g_enum_to_string +#define g_environ_getenv _frida_g_environ_getenv +#define g_environ_setenv _frida_g_environ_setenv +#define g_environ_unsetenv _frida_g_environ_unsetenv +#define g_error_copy _frida_g_error_copy +#define g_error_free _frida_g_error_free +#define g_error_get_type _frida_g_error_get_type +#define g_error_matches _frida_g_error_matches +#define g_error_new _frida_g_error_new +#define g_error_new_literal _frida_g_error_new_literal +#define g_error_new_valist _frida_g_error_new_valist +#define g_fdo_notification_backend_get_type _frida_g_fdo_notification_backend_get_type +#define g_file_append_to _frida_g_file_append_to +#define g_file_append_to_async _frida_g_file_append_to_async +#define g_file_append_to_finish _frida_g_file_append_to_finish +#define g_file_attribute_info_flags_get_type _frida_g_file_attribute_info_flags_get_type +#define g_file_attribute_info_list_add _frida_g_file_attribute_info_list_add +#define g_file_attribute_info_list_dup _frida_g_file_attribute_info_list_dup +#define g_file_attribute_info_list_get_type _frida_g_file_attribute_info_list_get_type +#define g_file_attribute_info_list_lookup _frida_g_file_attribute_info_list_lookup +#define g_file_attribute_info_list_new _frida_g_file_attribute_info_list_new +#define g_file_attribute_info_list_ref _frida_g_file_attribute_info_list_ref +#define g_file_attribute_info_list_unref _frida_g_file_attribute_info_list_unref +#define g_file_attribute_matcher_enumerate_namespace _frida_g_file_attribute_matcher_enumerate_namespace +#define g_file_attribute_matcher_enumerate_next _frida_g_file_attribute_matcher_enumerate_next +#define g_file_attribute_matcher_get_type _frida_g_file_attribute_matcher_get_type +#define g_file_attribute_matcher_matches _frida_g_file_attribute_matcher_matches +#define g_file_attribute_matcher_matches_only _frida_g_file_attribute_matcher_matches_only +#define g_file_attribute_matcher_new _frida_g_file_attribute_matcher_new +#define g_file_attribute_matcher_ref _frida_g_file_attribute_matcher_ref +#define g_file_attribute_matcher_subtract _frida_g_file_attribute_matcher_subtract +#define g_file_attribute_matcher_to_string _frida_g_file_attribute_matcher_to_string +#define g_file_attribute_matcher_unref _frida_g_file_attribute_matcher_unref +#define g_file_attribute_status_get_type _frida_g_file_attribute_status_get_type +#define g_file_attribute_type_get_type _frida_g_file_attribute_type_get_type +#define g_file_build_attribute_list_for_copy _frida_g_file_build_attribute_list_for_copy +#define g_file_copy _frida_g_file_copy +#define g_file_copy_async _frida_g_file_copy_async +#define g_file_copy_attributes _frida_g_file_copy_attributes +#define g_file_copy_finish _frida_g_file_copy_finish +#define g_file_copy_flags_get_type _frida_g_file_copy_flags_get_type +#define g_file_create _frida_g_file_create +#define g_file_create_async _frida_g_file_create_async +#define g_file_create_finish _frida_g_file_create_finish +#define g_file_create_flags_get_type _frida_g_file_create_flags_get_type +#define g_file_create_readwrite _frida_g_file_create_readwrite +#define g_file_create_readwrite_async _frida_g_file_create_readwrite_async +#define g_file_create_readwrite_finish _frida_g_file_create_readwrite_finish +#define g_file_delete _frida_g_file_delete +#define g_file_delete_async _frida_g_file_delete_async +#define g_file_delete_finish _frida_g_file_delete_finish +#define g_file_descriptor_based_get_fd _frida_g_file_descriptor_based_get_fd +#define g_file_descriptor_based_get_type _frida_g_file_descriptor_based_get_type +#define g_file_dup _frida_g_file_dup +#define g_file_eject_mountable _frida_g_file_eject_mountable +#define g_file_eject_mountable_finish _frida_g_file_eject_mountable_finish +#define g_file_eject_mountable_with_operation _frida_g_file_eject_mountable_with_operation +#define g_file_eject_mountable_with_operation_finish _frida_g_file_eject_mountable_with_operation_finish +#define g_file_enumerate_children _frida_g_file_enumerate_children +#define g_file_enumerate_children_async _frida_g_file_enumerate_children_async +#define g_file_enumerate_children_finish _frida_g_file_enumerate_children_finish +#define g_file_enumerator_close _frida_g_file_enumerator_close +#define g_file_enumerator_close_async _frida_g_file_enumerator_close_async +#define g_file_enumerator_close_finish _frida_g_file_enumerator_close_finish +#define g_file_enumerator_get_child _frida_g_file_enumerator_get_child +#define g_file_enumerator_get_container _frida_g_file_enumerator_get_container +#define g_file_enumerator_get_type _frida_g_file_enumerator_get_type +#define g_file_enumerator_has_pending _frida_g_file_enumerator_has_pending +#define g_file_enumerator_is_closed _frida_g_file_enumerator_is_closed +#define g_file_enumerator_iterate _frida_g_file_enumerator_iterate +#define g_file_enumerator_next_file _frida_g_file_enumerator_next_file +#define g_file_enumerator_next_files_async _frida_g_file_enumerator_next_files_async +#define g_file_enumerator_next_files_finish _frida_g_file_enumerator_next_files_finish +#define g_file_enumerator_set_pending _frida_g_file_enumerator_set_pending +#define g_file_equal _frida_g_file_equal +#define g_file_error_from_errno _frida_g_file_error_from_errno +#define g_file_error_quark _frida_g_file_error_quark +#define g_file_find_enclosing_mount _frida_g_file_find_enclosing_mount +#define g_file_find_enclosing_mount_async _frida_g_file_find_enclosing_mount_async +#define g_file_find_enclosing_mount_finish _frida_g_file_find_enclosing_mount_finish +#define g_file_get_basename _frida_g_file_get_basename +#define g_file_get_child _frida_g_file_get_child +#define g_file_get_child_for_display_name _frida_g_file_get_child_for_display_name +#define g_file_get_contents _frida_g_file_get_contents +#define g_file_get_parent _frida_g_file_get_parent +#define g_file_get_parse_name _frida_g_file_get_parse_name +#define g_file_get_path _frida_g_file_get_path +#define g_file_get_relative_path _frida_g_file_get_relative_path +#define g_file_get_type _frida_g_file_get_type +#define g_file_get_uri _frida_g_file_get_uri +#define g_file_get_uri_scheme _frida_g_file_get_uri_scheme +#define g_file_has_parent _frida_g_file_has_parent +#define g_file_has_prefix _frida_g_file_has_prefix +#define g_file_has_uri_scheme _frida_g_file_has_uri_scheme +#define g_file_hash _frida_g_file_hash +#define g_file_icon_get_file _frida_g_file_icon_get_file +#define g_file_icon_get_type _frida_g_file_icon_get_type +#define g_file_icon_new _frida_g_file_icon_new +#define g_file_info_clear_status _frida_g_file_info_clear_status +#define g_file_info_copy_into _frida_g_file_info_copy_into +#define g_file_info_dup _frida_g_file_info_dup +#define g_file_info_get_attribute_as_string _frida_g_file_info_get_attribute_as_string +#define g_file_info_get_attribute_boolean _frida_g_file_info_get_attribute_boolean +#define g_file_info_get_attribute_byte_string _frida_g_file_info_get_attribute_byte_string +#define g_file_info_get_attribute_data _frida_g_file_info_get_attribute_data +#define g_file_info_get_attribute_int32 _frida_g_file_info_get_attribute_int32 +#define g_file_info_get_attribute_int64 _frida_g_file_info_get_attribute_int64 +#define g_file_info_get_attribute_object _frida_g_file_info_get_attribute_object +#define g_file_info_get_attribute_status _frida_g_file_info_get_attribute_status +#define g_file_info_get_attribute_string _frida_g_file_info_get_attribute_string +#define g_file_info_get_attribute_stringv _frida_g_file_info_get_attribute_stringv +#define g_file_info_get_attribute_type _frida_g_file_info_get_attribute_type +#define g_file_info_get_attribute_uint32 _frida_g_file_info_get_attribute_uint32 +#define g_file_info_get_attribute_uint64 _frida_g_file_info_get_attribute_uint64 +#define g_file_info_get_content_type _frida_g_file_info_get_content_type +#define g_file_info_get_deletion_date _frida_g_file_info_get_deletion_date +#define g_file_info_get_display_name _frida_g_file_info_get_display_name +#define g_file_info_get_edit_name _frida_g_file_info_get_edit_name +#define g_file_info_get_etag _frida_g_file_info_get_etag +#define g_file_info_get_file_type _frida_g_file_info_get_file_type +#define g_file_info_get_icon _frida_g_file_info_get_icon +#define g_file_info_get_is_backup _frida_g_file_info_get_is_backup +#define g_file_info_get_is_hidden _frida_g_file_info_get_is_hidden +#define g_file_info_get_is_symlink _frida_g_file_info_get_is_symlink +#define g_file_info_get_modification_date_time _frida_g_file_info_get_modification_date_time +#define g_file_info_get_modification_time _frida_g_file_info_get_modification_time +#define g_file_info_get_name _frida_g_file_info_get_name +#define g_file_info_get_size _frida_g_file_info_get_size +#define g_file_info_get_sort_order _frida_g_file_info_get_sort_order +#define g_file_info_get_symbolic_icon _frida_g_file_info_get_symbolic_icon +#define g_file_info_get_symlink_target _frida_g_file_info_get_symlink_target +#define g_file_info_get_type _frida_g_file_info_get_type +#define g_file_info_has_attribute _frida_g_file_info_has_attribute +#define g_file_info_has_namespace _frida_g_file_info_has_namespace +#define g_file_info_list_attributes _frida_g_file_info_list_attributes +#define g_file_info_new _frida_g_file_info_new +#define g_file_info_remove_attribute _frida_g_file_info_remove_attribute +#define g_file_info_set_attribute _frida_g_file_info_set_attribute +#define g_file_info_set_attribute_boolean _frida_g_file_info_set_attribute_boolean +#define g_file_info_set_attribute_byte_string _frida_g_file_info_set_attribute_byte_string +#define g_file_info_set_attribute_int32 _frida_g_file_info_set_attribute_int32 +#define g_file_info_set_attribute_int64 _frida_g_file_info_set_attribute_int64 +#define g_file_info_set_attribute_mask _frida_g_file_info_set_attribute_mask +#define g_file_info_set_attribute_object _frida_g_file_info_set_attribute_object +#define g_file_info_set_attribute_status _frida_g_file_info_set_attribute_status +#define g_file_info_set_attribute_string _frida_g_file_info_set_attribute_string +#define g_file_info_set_attribute_stringv _frida_g_file_info_set_attribute_stringv +#define g_file_info_set_attribute_uint32 _frida_g_file_info_set_attribute_uint32 +#define g_file_info_set_attribute_uint64 _frida_g_file_info_set_attribute_uint64 +#define g_file_info_set_content_type _frida_g_file_info_set_content_type +#define g_file_info_set_display_name _frida_g_file_info_set_display_name +#define g_file_info_set_edit_name _frida_g_file_info_set_edit_name +#define g_file_info_set_file_type _frida_g_file_info_set_file_type +#define g_file_info_set_icon _frida_g_file_info_set_icon +#define g_file_info_set_is_hidden _frida_g_file_info_set_is_hidden +#define g_file_info_set_is_symlink _frida_g_file_info_set_is_symlink +#define g_file_info_set_modification_date_time _frida_g_file_info_set_modification_date_time +#define g_file_info_set_modification_time _frida_g_file_info_set_modification_time +#define g_file_info_set_name _frida_g_file_info_set_name +#define g_file_info_set_size _frida_g_file_info_set_size +#define g_file_info_set_sort_order _frida_g_file_info_set_sort_order +#define g_file_info_set_symbolic_icon _frida_g_file_info_set_symbolic_icon +#define g_file_info_set_symlink_target _frida_g_file_info_set_symlink_target +#define g_file_info_unset_attribute_mask _frida_g_file_info_unset_attribute_mask +#define g_file_input_stream_get_type _frida_g_file_input_stream_get_type +#define g_file_input_stream_query_info _frida_g_file_input_stream_query_info +#define g_file_input_stream_query_info_async _frida_g_file_input_stream_query_info_async +#define g_file_input_stream_query_info_finish _frida_g_file_input_stream_query_info_finish +#define g_file_io_stream_get_etag _frida_g_file_io_stream_get_etag +#define g_file_io_stream_get_type _frida_g_file_io_stream_get_type +#define g_file_io_stream_query_info _frida_g_file_io_stream_query_info +#define g_file_io_stream_query_info_async _frida_g_file_io_stream_query_info_async +#define g_file_io_stream_query_info_finish _frida_g_file_io_stream_query_info_finish +#define g_file_is_native _frida_g_file_is_native +#define g_file_load_bytes _frida_g_file_load_bytes +#define g_file_load_bytes_async _frida_g_file_load_bytes_async +#define g_file_load_bytes_finish _frida_g_file_load_bytes_finish +#define g_file_load_contents _frida_g_file_load_contents +#define g_file_load_contents_async _frida_g_file_load_contents_async +#define g_file_load_contents_finish _frida_g_file_load_contents_finish +#define g_file_load_partial_contents_async _frida_g_file_load_partial_contents_async +#define g_file_load_partial_contents_finish _frida_g_file_load_partial_contents_finish +#define g_file_make_directory _frida_g_file_make_directory +#define g_file_make_directory_async _frida_g_file_make_directory_async +#define g_file_make_directory_finish _frida_g_file_make_directory_finish +#define g_file_make_directory_with_parents _frida_g_file_make_directory_with_parents +#define g_file_make_symbolic_link _frida_g_file_make_symbolic_link +#define g_file_measure_disk_usage _frida_g_file_measure_disk_usage +#define g_file_measure_disk_usage_async _frida_g_file_measure_disk_usage_async +#define g_file_measure_disk_usage_finish _frida_g_file_measure_disk_usage_finish +#define g_file_measure_flags_get_type _frida_g_file_measure_flags_get_type +#define g_file_monitor _frida_g_file_monitor +#define g_file_monitor_cancel _frida_g_file_monitor_cancel +#define g_file_monitor_directory _frida_g_file_monitor_directory +#define g_file_monitor_emit_event _frida_g_file_monitor_emit_event +#define g_file_monitor_event_get_type _frida_g_file_monitor_event_get_type +#define g_file_monitor_file _frida_g_file_monitor_file +#define g_file_monitor_flags_get_type _frida_g_file_monitor_flags_get_type +#define g_file_monitor_get_type _frida_g_file_monitor_get_type +#define g_file_monitor_is_cancelled _frida_g_file_monitor_is_cancelled +#define g_file_monitor_set_rate_limit _frida_g_file_monitor_set_rate_limit +#define g_file_monitor_source_handle_event _frida_g_file_monitor_source_handle_event +#define g_file_mount_enclosing_volume _frida_g_file_mount_enclosing_volume +#define g_file_mount_enclosing_volume_finish _frida_g_file_mount_enclosing_volume_finish +#define g_file_mount_mountable _frida_g_file_mount_mountable +#define g_file_mount_mountable_finish _frida_g_file_mount_mountable_finish +#define g_file_move _frida_g_file_move +#define g_file_new_build_filename _frida_g_file_new_build_filename +#define g_file_new_for_commandline_arg _frida_g_file_new_for_commandline_arg +#define g_file_new_for_commandline_arg_and_cwd _frida_g_file_new_for_commandline_arg_and_cwd +#define g_file_new_for_path _frida_g_file_new_for_path +#define g_file_new_for_uri _frida_g_file_new_for_uri +#define g_file_new_tmp _frida_g_file_new_tmp +#define g_file_open_readwrite _frida_g_file_open_readwrite +#define g_file_open_readwrite_async _frida_g_file_open_readwrite_async +#define g_file_open_readwrite_finish _frida_g_file_open_readwrite_finish +#define g_file_open_tmp _frida_g_file_open_tmp +#define g_file_output_stream_get_etag _frida_g_file_output_stream_get_etag +#define g_file_output_stream_get_type _frida_g_file_output_stream_get_type +#define g_file_output_stream_query_info _frida_g_file_output_stream_query_info +#define g_file_output_stream_query_info_async _frida_g_file_output_stream_query_info_async +#define g_file_output_stream_query_info_finish _frida_g_file_output_stream_query_info_finish +#define g_file_parse_name _frida_g_file_parse_name +#define g_file_peek_path _frida_g_file_peek_path +#define g_file_poll_mountable _frida_g_file_poll_mountable +#define g_file_poll_mountable_finish _frida_g_file_poll_mountable_finish +#define g_file_query_default_handler _frida_g_file_query_default_handler +#define g_file_query_default_handler_async _frida_g_file_query_default_handler_async +#define g_file_query_default_handler_finish _frida_g_file_query_default_handler_finish +#define g_file_query_exists _frida_g_file_query_exists +#define g_file_query_file_type _frida_g_file_query_file_type +#define g_file_query_filesystem_info _frida_g_file_query_filesystem_info +#define g_file_query_filesystem_info_async _frida_g_file_query_filesystem_info_async +#define g_file_query_filesystem_info_finish _frida_g_file_query_filesystem_info_finish +#define g_file_query_info _frida_g_file_query_info +#define g_file_query_info_async _frida_g_file_query_info_async +#define g_file_query_info_finish _frida_g_file_query_info_finish +#define g_file_query_info_flags_get_type _frida_g_file_query_info_flags_get_type +#define g_file_query_settable_attributes _frida_g_file_query_settable_attributes +#define g_file_query_writable_namespaces _frida_g_file_query_writable_namespaces +#define g_file_read _frida_g_file_read +#define g_file_read_async _frida_g_file_read_async +#define g_file_read_finish _frida_g_file_read_finish +#define g_file_read_link _frida_g_file_read_link +#define g_file_replace _frida_g_file_replace +#define g_file_replace_async _frida_g_file_replace_async +#define g_file_replace_contents _frida_g_file_replace_contents +#define g_file_replace_contents_async _frida_g_file_replace_contents_async +#define g_file_replace_contents_bytes_async _frida_g_file_replace_contents_bytes_async +#define g_file_replace_contents_finish _frida_g_file_replace_contents_finish +#define g_file_replace_finish _frida_g_file_replace_finish +#define g_file_replace_readwrite _frida_g_file_replace_readwrite +#define g_file_replace_readwrite_async _frida_g_file_replace_readwrite_async +#define g_file_replace_readwrite_finish _frida_g_file_replace_readwrite_finish +#define g_file_resolve_relative_path _frida_g_file_resolve_relative_path +#define g_file_set_attribute _frida_g_file_set_attribute +#define g_file_set_attribute_byte_string _frida_g_file_set_attribute_byte_string +#define g_file_set_attribute_int32 _frida_g_file_set_attribute_int32 +#define g_file_set_attribute_int64 _frida_g_file_set_attribute_int64 +#define g_file_set_attribute_string _frida_g_file_set_attribute_string +#define g_file_set_attribute_uint32 _frida_g_file_set_attribute_uint32 +#define g_file_set_attribute_uint64 _frida_g_file_set_attribute_uint64 +#define g_file_set_attributes_async _frida_g_file_set_attributes_async +#define g_file_set_attributes_finish _frida_g_file_set_attributes_finish +#define g_file_set_attributes_from_info _frida_g_file_set_attributes_from_info +#define g_file_set_contents _frida_g_file_set_contents +#define g_file_set_contents_full _frida_g_file_set_contents_full +#define g_file_set_display_name _frida_g_file_set_display_name +#define g_file_set_display_name_async _frida_g_file_set_display_name_async +#define g_file_set_display_name_finish _frida_g_file_set_display_name_finish +#define g_file_start_mountable _frida_g_file_start_mountable +#define g_file_start_mountable_finish _frida_g_file_start_mountable_finish +#define g_file_stop_mountable _frida_g_file_stop_mountable +#define g_file_stop_mountable_finish _frida_g_file_stop_mountable_finish +#define g_file_supports_thread_contexts _frida_g_file_supports_thread_contexts +#define g_file_test _frida_g_file_test +#define g_file_trash _frida_g_file_trash +#define g_file_trash_async _frida_g_file_trash_async +#define g_file_trash_finish _frida_g_file_trash_finish +#define g_file_type_get_type _frida_g_file_type_get_type +#define g_file_unmount_mountable _frida_g_file_unmount_mountable +#define g_file_unmount_mountable_finish _frida_g_file_unmount_mountable_finish +#define g_file_unmount_mountable_with_operation _frida_g_file_unmount_mountable_with_operation +#define g_file_unmount_mountable_with_operation_finish _frida_g_file_unmount_mountable_with_operation_finish +#define g_filename_completer_get_completion_suffix _frida_g_filename_completer_get_completion_suffix +#define g_filename_completer_get_completions _frida_g_filename_completer_get_completions +#define g_filename_completer_get_type _frida_g_filename_completer_get_type +#define g_filename_completer_new _frida_g_filename_completer_new +#define g_filename_completer_set_dirs_only _frida_g_filename_completer_set_dirs_only +#define g_filename_display_basename _frida_g_filename_display_basename +#define g_filename_display_name _frida_g_filename_display_name +#define g_filename_from_uri _frida_g_filename_from_uri +#define g_filename_from_utf8 _frida_g_filename_from_utf8 +#define g_filename_to_uri _frida_g_filename_to_uri +#define g_filename_to_utf8 _frida_g_filename_to_utf8 +#define g_filesystem_preview_type_get_type _frida_g_filesystem_preview_type_get_type +#define g_filter_input_stream_get_base_stream _frida_g_filter_input_stream_get_base_stream +#define g_filter_input_stream_get_close_base_stream _frida_g_filter_input_stream_get_close_base_stream +#define g_filter_input_stream_get_type _frida_g_filter_input_stream_get_type +#define g_filter_input_stream_set_close_base_stream _frida_g_filter_input_stream_set_close_base_stream +#define g_filter_output_stream_get_base_stream _frida_g_filter_output_stream_get_base_stream +#define g_filter_output_stream_get_close_base_stream _frida_g_filter_output_stream_get_close_base_stream +#define g_filter_output_stream_get_type _frida_g_filter_output_stream_get_type +#define g_filter_output_stream_set_close_base_stream _frida_g_filter_output_stream_set_close_base_stream +#define g_find_program_in_path _frida_g_find_program_in_path +#define g_flags_complete_type_info _frida_g_flags_complete_type_info +#define g_flags_get_first_value _frida_g_flags_get_first_value +#define g_flags_get_value_by_name _frida_g_flags_get_value_by_name +#define g_flags_get_value_by_nick _frida_g_flags_get_value_by_nick +#define g_flags_register_static _frida_g_flags_register_static +#define g_flags_to_string _frida_g_flags_to_string +#define g_fopen _frida_g_fopen +#define g_format_size _frida_g_format_size +#define g_format_size_for_display _frida_g_format_size_for_display +#define g_format_size_full _frida_g_format_size_full +#define g_fprintf _frida_g_fprintf +#define g_free _frida_g_free +#define g_freopen _frida_g_freopen +#define g_fsync _frida_g_fsync +#define g_get_application_name _frida_g_get_application_name +#define g_get_charset _frida_g_get_charset +#define g_get_codeset _frida_g_get_codeset +#define g_get_console_charset _frida_g_get_console_charset +#define g_get_current_dir _frida_g_get_current_dir +#define g_get_current_time _frida_g_get_current_time +#define g_get_environ _frida_g_get_environ +#define g_get_filename_charsets _frida_g_get_filename_charsets +#define g_get_home_dir _frida_g_get_home_dir +#define g_get_host_name _frida_g_get_host_name +#define g_get_language_names _frida_g_get_language_names +#define g_get_language_names_with_category _frida_g_get_language_names_with_category +#define g_get_locale_variants _frida_g_get_locale_variants +#define g_get_monotonic_time _frida_g_get_monotonic_time +#define g_get_num_processors _frida_g_get_num_processors +#define g_get_os_info _frida_g_get_os_info +#define g_get_prgname _frida_g_get_prgname +#define g_get_real_name _frida_g_get_real_name +#define g_get_real_time _frida_g_get_real_time +#define g_get_system_config_dirs _frida_g_get_system_config_dirs +#define g_get_system_data_dirs _frida_g_get_system_data_dirs +#define g_get_tmp_dir _frida_g_get_tmp_dir +#define g_get_user_cache_dir _frida_g_get_user_cache_dir +#define g_get_user_config_dir _frida_g_get_user_config_dir +#define g_get_user_data_dir _frida_g_get_user_data_dir +#define g_get_user_name _frida_g_get_user_name +#define g_get_user_runtime_dir _frida_g_get_user_runtime_dir +#define g_get_user_special_dir _frida_g_get_user_special_dir +#define g_get_worker_context _frida_g_get_worker_context +#define g_getenv _frida_g_getenv +#define g_gstring_get_type _frida_g_gstring_get_type +#define g_gtk_notification_backend_get_type _frida_g_gtk_notification_backend_get_type +#define g_gtype_get_type _frida_g_gtype_get_type +#define g_hash_table_add _frida_g_hash_table_add +#define g_hash_table_contains _frida_g_hash_table_contains +#define g_hash_table_destroy _frida_g_hash_table_destroy +#define g_hash_table_find _frida_g_hash_table_find +#define g_hash_table_foreach _frida_g_hash_table_foreach +#define g_hash_table_foreach_remove _frida_g_hash_table_foreach_remove +#define g_hash_table_foreach_steal _frida_g_hash_table_foreach_steal +#define g_hash_table_get_keys _frida_g_hash_table_get_keys +#define g_hash_table_get_keys_as_array _frida_g_hash_table_get_keys_as_array +#define g_hash_table_get_type _frida_g_hash_table_get_type +#define g_hash_table_get_values _frida_g_hash_table_get_values +#define g_hash_table_insert _frida_g_hash_table_insert +#define g_hash_table_iter_get_hash_table _frida_g_hash_table_iter_get_hash_table +#define g_hash_table_iter_init _frida_g_hash_table_iter_init +#define g_hash_table_iter_next _frida_g_hash_table_iter_next +#define g_hash_table_iter_remove _frida_g_hash_table_iter_remove +#define g_hash_table_iter_replace _frida_g_hash_table_iter_replace +#define g_hash_table_iter_steal _frida_g_hash_table_iter_steal +#define g_hash_table_lookup _frida_g_hash_table_lookup +#define g_hash_table_lookup_extended _frida_g_hash_table_lookup_extended +#define g_hash_table_new _frida_g_hash_table_new +#define g_hash_table_new_full _frida_g_hash_table_new_full +#define g_hash_table_ref _frida_g_hash_table_ref +#define g_hash_table_remove _frida_g_hash_table_remove +#define g_hash_table_remove_all _frida_g_hash_table_remove_all +#define g_hash_table_replace _frida_g_hash_table_replace +#define g_hash_table_size _frida_g_hash_table_size +#define g_hash_table_steal _frida_g_hash_table_steal +#define g_hash_table_steal_all _frida_g_hash_table_steal_all +#define g_hash_table_steal_extended _frida_g_hash_table_steal_extended +#define g_hash_table_unref _frida_g_hash_table_unref +#define g_hmac_copy _frida_g_hmac_copy +#define g_hmac_get_digest _frida_g_hmac_get_digest +#define g_hmac_get_string _frida_g_hmac_get_string +#define g_hmac_new _frida_g_hmac_new +#define g_hmac_ref _frida_g_hmac_ref +#define g_hmac_unref _frida_g_hmac_unref +#define g_hmac_update _frida_g_hmac_update +#define g_hook_alloc _frida_g_hook_alloc +#define g_hook_compare_ids _frida_g_hook_compare_ids +#define g_hook_destroy _frida_g_hook_destroy +#define g_hook_destroy_link _frida_g_hook_destroy_link +#define g_hook_find _frida_g_hook_find +#define g_hook_find_data _frida_g_hook_find_data +#define g_hook_find_func _frida_g_hook_find_func +#define g_hook_find_func_data _frida_g_hook_find_func_data +#define g_hook_first_valid _frida_g_hook_first_valid +#define g_hook_free _frida_g_hook_free +#define g_hook_get _frida_g_hook_get +#define g_hook_insert_before _frida_g_hook_insert_before +#define g_hook_insert_sorted _frida_g_hook_insert_sorted +#define g_hook_list_clear _frida_g_hook_list_clear +#define g_hook_list_init _frida_g_hook_list_init +#define g_hook_list_invoke _frida_g_hook_list_invoke +#define g_hook_list_invoke_check _frida_g_hook_list_invoke_check +#define g_hook_list_marshal _frida_g_hook_list_marshal +#define g_hook_list_marshal_check _frida_g_hook_list_marshal_check +#define g_hook_next_valid _frida_g_hook_next_valid +#define g_hook_prepend _frida_g_hook_prepend +#define g_hook_ref _frida_g_hook_ref +#define g_hook_unref _frida_g_hook_unref +#define g_hostname_is_ascii_encoded _frida_g_hostname_is_ascii_encoded +#define g_hostname_is_ip_address _frida_g_hostname_is_ip_address +#define g_hostname_is_non_ascii _frida_g_hostname_is_non_ascii +#define g_hostname_to_ascii _frida_g_hostname_to_ascii +#define g_hostname_to_unicode _frida_g_hostname_to_unicode +#define g_icon_deserialize _frida_g_icon_deserialize +#define g_icon_equal _frida_g_icon_equal +#define g_icon_get_type _frida_g_icon_get_type +#define g_icon_hash _frida_g_icon_hash +#define g_icon_new_for_string _frida_g_icon_new_for_string +#define g_icon_serialize _frida_g_icon_serialize +#define g_icon_to_string _frida_g_icon_to_string +#define g_iconv _frida_g_iconv +#define g_iconv_close _frida_g_iconv_close +#define g_iconv_open _frida_g_iconv_open +#define g_idle_add _frida_g_idle_add +#define g_idle_add_full _frida_g_idle_add_full +#define g_idle_funcs _frida_g_idle_funcs +#define g_idle_remove_by_data _frida_g_idle_remove_by_data +#define g_idle_source_new _frida_g_idle_source_new +#define g_inet_address_equal _frida_g_inet_address_equal +#define g_inet_address_get_family _frida_g_inet_address_get_family +#define g_inet_address_get_is_any _frida_g_inet_address_get_is_any +#define g_inet_address_get_is_link_local _frida_g_inet_address_get_is_link_local +#define g_inet_address_get_is_loopback _frida_g_inet_address_get_is_loopback +#define g_inet_address_get_is_mc_global _frida_g_inet_address_get_is_mc_global +#define g_inet_address_get_is_mc_link_local _frida_g_inet_address_get_is_mc_link_local +#define g_inet_address_get_is_mc_node_local _frida_g_inet_address_get_is_mc_node_local +#define g_inet_address_get_is_mc_org_local _frida_g_inet_address_get_is_mc_org_local +#define g_inet_address_get_is_mc_site_local _frida_g_inet_address_get_is_mc_site_local +#define g_inet_address_get_is_multicast _frida_g_inet_address_get_is_multicast +#define g_inet_address_get_is_site_local _frida_g_inet_address_get_is_site_local +#define g_inet_address_get_native_size _frida_g_inet_address_get_native_size +#define g_inet_address_get_type _frida_g_inet_address_get_type +#define g_inet_address_mask_equal _frida_g_inet_address_mask_equal +#define g_inet_address_mask_get_address _frida_g_inet_address_mask_get_address +#define g_inet_address_mask_get_family _frida_g_inet_address_mask_get_family +#define g_inet_address_mask_get_length _frida_g_inet_address_mask_get_length +#define g_inet_address_mask_get_type _frida_g_inet_address_mask_get_type +#define g_inet_address_mask_matches _frida_g_inet_address_mask_matches +#define g_inet_address_mask_new _frida_g_inet_address_mask_new +#define g_inet_address_mask_new_from_string _frida_g_inet_address_mask_new_from_string +#define g_inet_address_mask_to_string _frida_g_inet_address_mask_to_string +#define g_inet_address_new_any _frida_g_inet_address_new_any +#define g_inet_address_new_from_bytes _frida_g_inet_address_new_from_bytes +#define g_inet_address_new_from_string _frida_g_inet_address_new_from_string +#define g_inet_address_new_loopback _frida_g_inet_address_new_loopback +#define g_inet_address_to_bytes _frida_g_inet_address_to_bytes +#define g_inet_address_to_string _frida_g_inet_address_to_string +#define g_inet_socket_address_get_address _frida_g_inet_socket_address_get_address +#define g_inet_socket_address_get_flowinfo _frida_g_inet_socket_address_get_flowinfo +#define g_inet_socket_address_get_port _frida_g_inet_socket_address_get_port +#define g_inet_socket_address_get_scope_id _frida_g_inet_socket_address_get_scope_id +#define g_inet_socket_address_get_type _frida_g_inet_socket_address_get_type +#define g_inet_socket_address_new _frida_g_inet_socket_address_new +#define g_inet_socket_address_new_from_string _frida_g_inet_socket_address_new_from_string +#define g_initable_get_type _frida_g_initable_get_type +#define g_initable_init _frida_g_initable_init +#define g_initable_new _frida_g_initable_new +#define g_initable_new_valist _frida_g_initable_new_valist +#define g_initable_newv _frida_g_initable_newv +#define g_initially_unowned_get_type _frida_g_initially_unowned_get_type +#define g_inotify_file_monitor_get_type _frida_g_inotify_file_monitor_get_type +#define g_input_stream_async_close_is_via_threads _frida_g_input_stream_async_close_is_via_threads +#define g_input_stream_async_read_is_via_threads _frida_g_input_stream_async_read_is_via_threads +#define g_input_stream_clear_pending _frida_g_input_stream_clear_pending +#define g_input_stream_close _frida_g_input_stream_close +#define g_input_stream_close_async _frida_g_input_stream_close_async +#define g_input_stream_close_finish _frida_g_input_stream_close_finish +#define g_input_stream_get_type _frida_g_input_stream_get_type +#define g_input_stream_has_pending _frida_g_input_stream_has_pending +#define g_input_stream_is_closed _frida_g_input_stream_is_closed +#define g_input_stream_read _frida_g_input_stream_read +#define g_input_stream_read_all _frida_g_input_stream_read_all +#define g_input_stream_read_all_async _frida_g_input_stream_read_all_async +#define g_input_stream_read_all_finish _frida_g_input_stream_read_all_finish +#define g_input_stream_read_async _frida_g_input_stream_read_async +#define g_input_stream_read_bytes _frida_g_input_stream_read_bytes +#define g_input_stream_read_bytes_async _frida_g_input_stream_read_bytes_async +#define g_input_stream_read_bytes_finish _frida_g_input_stream_read_bytes_finish +#define g_input_stream_read_finish _frida_g_input_stream_read_finish +#define g_input_stream_set_pending _frida_g_input_stream_set_pending +#define g_input_stream_skip _frida_g_input_stream_skip +#define g_input_stream_skip_async _frida_g_input_stream_skip_async +#define g_input_stream_skip_finish _frida_g_input_stream_skip_finish +#define g_int64_equal _frida_g_int64_equal +#define g_int64_hash _frida_g_int64_hash +#define g_int_equal _frida_g_int_equal +#define g_int_hash _frida_g_int_hash +#define g_intern_static_string _frida_g_intern_static_string +#define g_intern_string _frida_g_intern_string +#define g_io_add_watch _frida_g_io_add_watch +#define g_io_add_watch_full _frida_g_io_add_watch_full +#define g_io_channel_close _frida_g_io_channel_close +#define g_io_channel_error_from_errno _frida_g_io_channel_error_from_errno +#define g_io_channel_error_quark _frida_g_io_channel_error_quark +#define g_io_channel_flush _frida_g_io_channel_flush +#define g_io_channel_get_buffer_condition _frida_g_io_channel_get_buffer_condition +#define g_io_channel_get_buffer_size _frida_g_io_channel_get_buffer_size +#define g_io_channel_get_buffered _frida_g_io_channel_get_buffered +#define g_io_channel_get_close_on_unref _frida_g_io_channel_get_close_on_unref +#define g_io_channel_get_encoding _frida_g_io_channel_get_encoding +#define g_io_channel_get_flags _frida_g_io_channel_get_flags +#define g_io_channel_get_line_term _frida_g_io_channel_get_line_term +#define g_io_channel_get_type _frida_g_io_channel_get_type +#define g_io_channel_init _frida_g_io_channel_init +#define g_io_channel_new_file _frida_g_io_channel_new_file +#define g_io_channel_read _frida_g_io_channel_read +#define g_io_channel_read_chars _frida_g_io_channel_read_chars +#define g_io_channel_read_line _frida_g_io_channel_read_line +#define g_io_channel_read_line_string _frida_g_io_channel_read_line_string +#define g_io_channel_read_to_end _frida_g_io_channel_read_to_end +#define g_io_channel_read_unichar _frida_g_io_channel_read_unichar +#define g_io_channel_ref _frida_g_io_channel_ref +#define g_io_channel_seek _frida_g_io_channel_seek +#define g_io_channel_seek_position _frida_g_io_channel_seek_position +#define g_io_channel_set_buffer_size _frida_g_io_channel_set_buffer_size +#define g_io_channel_set_buffered _frida_g_io_channel_set_buffered +#define g_io_channel_set_close_on_unref _frida_g_io_channel_set_close_on_unref +#define g_io_channel_set_encoding _frida_g_io_channel_set_encoding +#define g_io_channel_set_flags _frida_g_io_channel_set_flags +#define g_io_channel_set_line_term _frida_g_io_channel_set_line_term +#define g_io_channel_shutdown _frida_g_io_channel_shutdown +#define g_io_channel_unix_get_fd _frida_g_io_channel_unix_get_fd +#define g_io_channel_unix_new _frida_g_io_channel_unix_new +#define g_io_channel_unref _frida_g_io_channel_unref +#define g_io_channel_write _frida_g_io_channel_write +#define g_io_channel_write_chars _frida_g_io_channel_write_chars +#define g_io_channel_write_unichar _frida_g_io_channel_write_unichar +#define g_io_condition_get_type _frida_g_io_condition_get_type +#define g_io_create_watch _frida_g_io_create_watch +#define g_io_error_enum_get_type _frida_g_io_error_enum_get_type +#define g_io_error_from_errno _frida_g_io_error_from_errno +#define g_io_error_quark _frida_g_io_error_quark +#define g_io_extension_get_name _frida_g_io_extension_get_name +#define g_io_extension_get_priority _frida_g_io_extension_get_priority +#define g_io_extension_get_type _frida_g_io_extension_get_type +#define g_io_extension_point_get_extension_by_name _frida_g_io_extension_point_get_extension_by_name +#define g_io_extension_point_get_extensions _frida_g_io_extension_point_get_extensions +#define g_io_extension_point_get_required_type _frida_g_io_extension_point_get_required_type +#define g_io_extension_point_implement _frida_g_io_extension_point_implement +#define g_io_extension_point_lookup _frida_g_io_extension_point_lookup +#define g_io_extension_point_register _frida_g_io_extension_point_register +#define g_io_extension_point_set_required_type _frida_g_io_extension_point_set_required_type +#define g_io_extension_ref_class _frida_g_io_extension_ref_class +#define g_io_module_get_type _frida_g_io_module_get_type +#define g_io_module_new _frida_g_io_module_new +#define g_io_module_scope_block _frida_g_io_module_scope_block +#define g_io_module_scope_flags_get_type _frida_g_io_module_scope_flags_get_type +#define g_io_module_scope_free _frida_g_io_module_scope_free +#define g_io_module_scope_new _frida_g_io_module_scope_new +#define g_io_modules_load_all_in_directory _frida_g_io_modules_load_all_in_directory +#define g_io_modules_load_all_in_directory_with_scope _frida_g_io_modules_load_all_in_directory_with_scope +#define g_io_modules_scan_all_in_directory _frida_g_io_modules_scan_all_in_directory +#define g_io_modules_scan_all_in_directory_with_scope _frida_g_io_modules_scan_all_in_directory_with_scope +#define g_io_scheduler_cancel_all_jobs _frida_g_io_scheduler_cancel_all_jobs +#define g_io_scheduler_job_send_to_mainloop _frida_g_io_scheduler_job_send_to_mainloop +#define g_io_scheduler_job_send_to_mainloop_async _frida_g_io_scheduler_job_send_to_mainloop_async +#define g_io_scheduler_push_job _frida_g_io_scheduler_push_job +#define g_io_stream_clear_pending _frida_g_io_stream_clear_pending +#define g_io_stream_close _frida_g_io_stream_close +#define g_io_stream_close_async _frida_g_io_stream_close_async +#define g_io_stream_close_finish _frida_g_io_stream_close_finish +#define g_io_stream_get_input_stream _frida_g_io_stream_get_input_stream +#define g_io_stream_get_output_stream _frida_g_io_stream_get_output_stream +#define g_io_stream_get_type _frida_g_io_stream_get_type +#define g_io_stream_has_pending _frida_g_io_stream_has_pending +#define g_io_stream_is_closed _frida_g_io_stream_is_closed +#define g_io_stream_set_pending _frida_g_io_stream_set_pending +#define g_io_stream_splice_async _frida_g_io_stream_splice_async +#define g_io_stream_splice_finish _frida_g_io_stream_splice_finish +#define g_io_stream_splice_flags_get_type _frida_g_io_stream_splice_flags_get_type +#define g_io_watch_funcs _frida_g_io_watch_funcs +#define g_key_file_error_quark _frida_g_key_file_error_quark +#define g_key_file_free _frida_g_key_file_free +#define g_key_file_get_boolean _frida_g_key_file_get_boolean +#define g_key_file_get_boolean_list _frida_g_key_file_get_boolean_list +#define g_key_file_get_comment _frida_g_key_file_get_comment +#define g_key_file_get_double _frida_g_key_file_get_double +#define g_key_file_get_double_list _frida_g_key_file_get_double_list +#define g_key_file_get_groups _frida_g_key_file_get_groups +#define g_key_file_get_int64 _frida_g_key_file_get_int64 +#define g_key_file_get_integer _frida_g_key_file_get_integer +#define g_key_file_get_integer_list _frida_g_key_file_get_integer_list +#define g_key_file_get_keys _frida_g_key_file_get_keys +#define g_key_file_get_locale_for_key _frida_g_key_file_get_locale_for_key +#define g_key_file_get_locale_string _frida_g_key_file_get_locale_string +#define g_key_file_get_locale_string_list _frida_g_key_file_get_locale_string_list +#define g_key_file_get_start_group _frida_g_key_file_get_start_group +#define g_key_file_get_string _frida_g_key_file_get_string +#define g_key_file_get_string_list _frida_g_key_file_get_string_list +#define g_key_file_get_type _frida_g_key_file_get_type +#define g_key_file_get_uint64 _frida_g_key_file_get_uint64 +#define g_key_file_get_value _frida_g_key_file_get_value +#define g_key_file_has_group _frida_g_key_file_has_group +#define g_key_file_has_key _frida_g_key_file_has_key +#define g_key_file_load_from_bytes _frida_g_key_file_load_from_bytes +#define g_key_file_load_from_data _frida_g_key_file_load_from_data +#define g_key_file_load_from_data_dirs _frida_g_key_file_load_from_data_dirs +#define g_key_file_load_from_dirs _frida_g_key_file_load_from_dirs +#define g_key_file_load_from_file _frida_g_key_file_load_from_file +#define g_key_file_new _frida_g_key_file_new +#define g_key_file_ref _frida_g_key_file_ref +#define g_key_file_remove_comment _frida_g_key_file_remove_comment +#define g_key_file_remove_group _frida_g_key_file_remove_group +#define g_key_file_remove_key _frida_g_key_file_remove_key +#define g_key_file_save_to_file _frida_g_key_file_save_to_file +#define g_key_file_set_boolean _frida_g_key_file_set_boolean +#define g_key_file_set_boolean_list _frida_g_key_file_set_boolean_list +#define g_key_file_set_comment _frida_g_key_file_set_comment +#define g_key_file_set_double _frida_g_key_file_set_double +#define g_key_file_set_double_list _frida_g_key_file_set_double_list +#define g_key_file_set_int64 _frida_g_key_file_set_int64 +#define g_key_file_set_integer _frida_g_key_file_set_integer +#define g_key_file_set_integer_list _frida_g_key_file_set_integer_list +#define g_key_file_set_list_separator _frida_g_key_file_set_list_separator +#define g_key_file_set_locale_string _frida_g_key_file_set_locale_string +#define g_key_file_set_locale_string_list _frida_g_key_file_set_locale_string_list +#define g_key_file_set_string _frida_g_key_file_set_string +#define g_key_file_set_string_list _frida_g_key_file_set_string_list +#define g_key_file_set_uint64 _frida_g_key_file_set_uint64 +#define g_key_file_set_value _frida_g_key_file_set_value +#define g_key_file_to_data _frida_g_key_file_to_data +#define g_key_file_unref _frida_g_key_file_unref +#define g_keyfile_settings_backend_get_type _frida_g_keyfile_settings_backend_get_type +#define g_keyfile_settings_backend_new _frida_g_keyfile_settings_backend_new +#define g_libintl_bind_textdomain_codeset _frida_g_libintl_bind_textdomain_codeset +#define g_libintl_bindtextdomain _frida_g_libintl_bindtextdomain +#define g_libintl_dcgettext _frida_g_libintl_dcgettext +#define g_libintl_dcngettext _frida_g_libintl_dcngettext +#define g_libintl_dgettext _frida_g_libintl_dgettext +#define g_libintl_dngettext _frida_g_libintl_dngettext +#define g_libintl_gettext _frida_g_libintl_gettext +#define g_libintl_ngettext _frida_g_libintl_ngettext +#define g_libintl_textdomain _frida_g_libintl_textdomain +#define g_list_alloc _frida_g_list_alloc +#define g_list_append _frida_g_list_append +#define g_list_concat _frida_g_list_concat +#define g_list_copy _frida_g_list_copy +#define g_list_copy_deep _frida_g_list_copy_deep +#define g_list_delete_link _frida_g_list_delete_link +#define g_list_find _frida_g_list_find +#define g_list_find_custom _frida_g_list_find_custom +#define g_list_first _frida_g_list_first +#define g_list_foreach _frida_g_list_foreach +#define g_list_free _frida_g_list_free +#define g_list_free_1 _frida_g_list_free_1 +#define g_list_free_full _frida_g_list_free_full +#define g_list_index _frida_g_list_index +#define g_list_insert _frida_g_list_insert +#define g_list_insert_before _frida_g_list_insert_before +#define g_list_insert_before_link _frida_g_list_insert_before_link +#define g_list_insert_sorted _frida_g_list_insert_sorted +#define g_list_insert_sorted_with_data _frida_g_list_insert_sorted_with_data +#define g_list_last _frida_g_list_last +#define g_list_length _frida_g_list_length +#define g_list_model_get_item _frida_g_list_model_get_item +#define g_list_model_get_item_type _frida_g_list_model_get_item_type +#define g_list_model_get_n_items _frida_g_list_model_get_n_items +#define g_list_model_get_object _frida_g_list_model_get_object +#define g_list_model_get_type _frida_g_list_model_get_type +#define g_list_model_items_changed _frida_g_list_model_items_changed +#define g_list_nth _frida_g_list_nth +#define g_list_nth_data _frida_g_list_nth_data +#define g_list_nth_prev _frida_g_list_nth_prev +#define g_list_pop_allocator _frida_g_list_pop_allocator +#define g_list_position _frida_g_list_position +#define g_list_prepend _frida_g_list_prepend +#define g_list_push_allocator _frida_g_list_push_allocator +#define g_list_remove _frida_g_list_remove +#define g_list_remove_all _frida_g_list_remove_all +#define g_list_remove_link _frida_g_list_remove_link +#define g_list_reverse _frida_g_list_reverse +#define g_list_sort _frida_g_list_sort +#define g_list_sort_with_data _frida_g_list_sort_with_data +#define g_list_store_append _frida_g_list_store_append +#define g_list_store_find _frida_g_list_store_find +#define g_list_store_find_with_equal_func _frida_g_list_store_find_with_equal_func +#define g_list_store_get_type _frida_g_list_store_get_type +#define g_list_store_insert _frida_g_list_store_insert +#define g_list_store_insert_sorted _frida_g_list_store_insert_sorted +#define g_list_store_new _frida_g_list_store_new +#define g_list_store_remove _frida_g_list_store_remove +#define g_list_store_remove_all _frida_g_list_store_remove_all +#define g_list_store_sort _frida_g_list_store_sort +#define g_list_store_splice _frida_g_list_store_splice +#define g_listenv _frida_g_listenv +#define g_loadable_icon_get_type _frida_g_loadable_icon_get_type +#define g_loadable_icon_load _frida_g_loadable_icon_load +#define g_loadable_icon_load_async _frida_g_loadable_icon_load_async +#define g_loadable_icon_load_finish _frida_g_loadable_icon_load_finish +#define g_local_file_is_nfs_home _frida_g_local_file_is_nfs_home +#define g_local_file_monitor_get_type _frida_g_local_file_monitor_get_type +#define g_local_file_monitor_new_for_path _frida_g_local_file_monitor_new_for_path +#define g_local_file_monitor_new_in_worker _frida_g_local_file_monitor_new_in_worker +#define g_local_file_new_from_dirname_and_basename _frida_g_local_file_new_from_dirname_and_basename +#define g_locale_from_utf8 _frida_g_locale_from_utf8 +#define g_locale_to_utf8 _frida_g_locale_to_utf8 +#define g_log _frida_g_log +#define g_log_always_fatal _frida_g_log_always_fatal +#define g_log_default_handler _frida_g_log_default_handler +#define g_log_msg_prefix _frida_g_log_msg_prefix +#define g_log_remove_handler _frida_g_log_remove_handler +#define g_log_set_always_fatal _frida_g_log_set_always_fatal +#define g_log_set_default_handler _frida_g_log_set_default_handler +#define g_log_set_fatal_mask _frida_g_log_set_fatal_mask +#define g_log_set_handler _frida_g_log_set_handler +#define g_log_set_handler_full _frida_g_log_set_handler_full +#define g_log_set_writer_func _frida_g_log_set_writer_func +#define g_log_structured _frida_g_log_structured +#define g_log_structured_array _frida_g_log_structured_array +#define g_log_structured_standard _frida_g_log_structured_standard +#define g_log_variant _frida_g_log_variant +#define g_log_writer_default _frida_g_log_writer_default +#define g_log_writer_default_set_use_stderr _frida_g_log_writer_default_set_use_stderr +#define g_log_writer_default_would_drop _frida_g_log_writer_default_would_drop +#define g_log_writer_format_fields _frida_g_log_writer_format_fields +#define g_log_writer_is_journald _frida_g_log_writer_is_journald +#define g_log_writer_journald _frida_g_log_writer_journald +#define g_log_writer_standard_streams _frida_g_log_writer_standard_streams +#define g_log_writer_supports_color _frida_g_log_writer_supports_color +#define g_logv _frida_g_logv +#define g_lstat _frida_g_lstat +#define g_main_context_acquire _frida_g_main_context_acquire +#define g_main_context_add_poll _frida_g_main_context_add_poll +#define g_main_context_check _frida_g_main_context_check +#define g_main_context_default _frida_g_main_context_default +#define g_main_context_dispatch _frida_g_main_context_dispatch +#define g_main_context_find_source_by_funcs_user_data _frida_g_main_context_find_source_by_funcs_user_data +#define g_main_context_find_source_by_id _frida_g_main_context_find_source_by_id +#define g_main_context_find_source_by_user_data _frida_g_main_context_find_source_by_user_data +#define g_main_context_get_poll_func _frida_g_main_context_get_poll_func +#define g_main_context_get_thread_default _frida_g_main_context_get_thread_default +#define g_main_context_get_type _frida_g_main_context_get_type +#define g_main_context_invoke _frida_g_main_context_invoke +#define g_main_context_invoke_full _frida_g_main_context_invoke_full +#define g_main_context_is_owner _frida_g_main_context_is_owner +#define g_main_context_iteration _frida_g_main_context_iteration +#define g_main_context_new _frida_g_main_context_new +#define g_main_context_new_with_next_id _frida_g_main_context_new_with_next_id +#define g_main_context_pending _frida_g_main_context_pending +#define g_main_context_pop_thread_default _frida_g_main_context_pop_thread_default +#define g_main_context_prepare _frida_g_main_context_prepare +#define g_main_context_push_thread_default _frida_g_main_context_push_thread_default +#define g_main_context_query _frida_g_main_context_query +#define g_main_context_ref _frida_g_main_context_ref +#define g_main_context_ref_thread_default _frida_g_main_context_ref_thread_default +#define g_main_context_release _frida_g_main_context_release +#define g_main_context_remove_poll _frida_g_main_context_remove_poll +#define g_main_context_set_poll_func _frida_g_main_context_set_poll_func +#define g_main_context_unref _frida_g_main_context_unref +#define g_main_context_wait _frida_g_main_context_wait +#define g_main_context_wakeup _frida_g_main_context_wakeup +#define g_main_current_source _frida_g_main_current_source +#define g_main_depth _frida_g_main_depth +#define g_main_loop_get_context _frida_g_main_loop_get_context +#define g_main_loop_get_type _frida_g_main_loop_get_type +#define g_main_loop_is_running _frida_g_main_loop_is_running +#define g_main_loop_new _frida_g_main_loop_new +#define g_main_loop_quit _frida_g_main_loop_quit +#define g_main_loop_ref _frida_g_main_loop_ref +#define g_main_loop_run _frida_g_main_loop_run +#define g_main_loop_unref _frida_g_main_loop_unref +#define g_malloc _frida_g_malloc +#define g_malloc0 _frida_g_malloc0 +#define g_malloc0_n _frida_g_malloc0_n +#define g_malloc_n _frida_g_malloc_n +#define g_mapped_file_free _frida_g_mapped_file_free +#define g_mapped_file_get_bytes _frida_g_mapped_file_get_bytes +#define g_mapped_file_get_contents _frida_g_mapped_file_get_contents +#define g_mapped_file_get_length _frida_g_mapped_file_get_length +#define g_mapped_file_get_type _frida_g_mapped_file_get_type +#define g_mapped_file_new _frida_g_mapped_file_new +#define g_mapped_file_new_from_fd _frida_g_mapped_file_new_from_fd +#define g_mapped_file_ref _frida_g_mapped_file_ref +#define g_mapped_file_unref _frida_g_mapped_file_unref +#define g_markup_collect_attributes _frida_g_markup_collect_attributes +#define g_markup_error_quark _frida_g_markup_error_quark +#define g_markup_escape_text _frida_g_markup_escape_text +#define g_markup_parse_context_end_parse _frida_g_markup_parse_context_end_parse +#define g_markup_parse_context_free _frida_g_markup_parse_context_free +#define g_markup_parse_context_get_element _frida_g_markup_parse_context_get_element +#define g_markup_parse_context_get_element_stack _frida_g_markup_parse_context_get_element_stack +#define g_markup_parse_context_get_position _frida_g_markup_parse_context_get_position +#define g_markup_parse_context_get_type _frida_g_markup_parse_context_get_type +#define g_markup_parse_context_get_user_data _frida_g_markup_parse_context_get_user_data +#define g_markup_parse_context_new _frida_g_markup_parse_context_new +#define g_markup_parse_context_parse _frida_g_markup_parse_context_parse +#define g_markup_parse_context_pop _frida_g_markup_parse_context_pop +#define g_markup_parse_context_push _frida_g_markup_parse_context_push +#define g_markup_parse_context_ref _frida_g_markup_parse_context_ref +#define g_markup_parse_context_unref _frida_g_markup_parse_context_unref +#define g_markup_printf_escaped _frida_g_markup_printf_escaped +#define g_markup_vprintf_escaped _frida_g_markup_vprintf_escaped +#define g_match_info_expand_references _frida_g_match_info_expand_references +#define g_match_info_fetch _frida_g_match_info_fetch +#define g_match_info_fetch_all _frida_g_match_info_fetch_all +#define g_match_info_fetch_named _frida_g_match_info_fetch_named +#define g_match_info_fetch_named_pos _frida_g_match_info_fetch_named_pos +#define g_match_info_fetch_pos _frida_g_match_info_fetch_pos +#define g_match_info_free _frida_g_match_info_free +#define g_match_info_get_match_count _frida_g_match_info_get_match_count +#define g_match_info_get_regex _frida_g_match_info_get_regex +#define g_match_info_get_string _frida_g_match_info_get_string +#define g_match_info_get_type _frida_g_match_info_get_type +#define g_match_info_is_partial_match _frida_g_match_info_is_partial_match +#define g_match_info_matches _frida_g_match_info_matches +#define g_match_info_next _frida_g_match_info_next +#define g_match_info_ref _frida_g_match_info_ref +#define g_match_info_unref _frida_g_match_info_unref +#define g_mem_chunk_alloc _frida_g_mem_chunk_alloc +#define g_mem_chunk_alloc0 _frida_g_mem_chunk_alloc0 +#define g_mem_chunk_clean _frida_g_mem_chunk_clean +#define g_mem_chunk_destroy _frida_g_mem_chunk_destroy +#define g_mem_chunk_free _frida_g_mem_chunk_free +#define g_mem_chunk_info _frida_g_mem_chunk_info +#define g_mem_chunk_new _frida_g_mem_chunk_new +#define g_mem_chunk_print _frida_g_mem_chunk_print +#define g_mem_chunk_reset _frida_g_mem_chunk_reset +#define g_mem_gc_friendly _frida_g_mem_gc_friendly +#define g_mem_is_system_malloc _frida_g_mem_is_system_malloc +#define g_mem_profile _frida_g_mem_profile +#define g_mem_set_vtable _frida_g_mem_set_vtable +#define g_memdup _frida_g_memdup +#define g_memory_input_stream_add_bytes _frida_g_memory_input_stream_add_bytes +#define g_memory_input_stream_add_data _frida_g_memory_input_stream_add_data +#define g_memory_input_stream_get_type _frida_g_memory_input_stream_get_type +#define g_memory_input_stream_new _frida_g_memory_input_stream_new +#define g_memory_input_stream_new_from_bytes _frida_g_memory_input_stream_new_from_bytes +#define g_memory_input_stream_new_from_data _frida_g_memory_input_stream_new_from_data +#define g_memory_monitor_dbus_get_type _frida_g_memory_monitor_dbus_get_type +#define g_memory_monitor_dup_default _frida_g_memory_monitor_dup_default +#define g_memory_monitor_get_type _frida_g_memory_monitor_get_type +#define g_memory_monitor_portal_get_type _frida_g_memory_monitor_portal_get_type +#define g_memory_monitor_warning_level_get_type _frida_g_memory_monitor_warning_level_get_type +#define g_memory_output_stream_get_data _frida_g_memory_output_stream_get_data +#define g_memory_output_stream_get_data_size _frida_g_memory_output_stream_get_data_size +#define g_memory_output_stream_get_size _frida_g_memory_output_stream_get_size +#define g_memory_output_stream_get_type _frida_g_memory_output_stream_get_type +#define g_memory_output_stream_new _frida_g_memory_output_stream_new +#define g_memory_output_stream_new_resizable _frida_g_memory_output_stream_new_resizable +#define g_memory_output_stream_steal_as_bytes _frida_g_memory_output_stream_steal_as_bytes +#define g_memory_output_stream_steal_data _frida_g_memory_output_stream_steal_data +#define g_memory_settings_backend_get_type _frida_g_memory_settings_backend_get_type +#define g_memory_settings_backend_new _frida_g_memory_settings_backend_new +#define g_menu_append _frida_g_menu_append +#define g_menu_append_item _frida_g_menu_append_item +#define g_menu_append_section _frida_g_menu_append_section +#define g_menu_append_submenu _frida_g_menu_append_submenu +#define g_menu_attribute_iter_get_name _frida_g_menu_attribute_iter_get_name +#define g_menu_attribute_iter_get_next _frida_g_menu_attribute_iter_get_next +#define g_menu_attribute_iter_get_type _frida_g_menu_attribute_iter_get_type +#define g_menu_attribute_iter_get_value _frida_g_menu_attribute_iter_get_value +#define g_menu_attribute_iter_next _frida_g_menu_attribute_iter_next +#define g_menu_freeze _frida_g_menu_freeze +#define g_menu_get_type _frida_g_menu_get_type +#define g_menu_insert _frida_g_menu_insert +#define g_menu_insert_item _frida_g_menu_insert_item +#define g_menu_insert_section _frida_g_menu_insert_section +#define g_menu_insert_submenu _frida_g_menu_insert_submenu +#define g_menu_item_get_attribute _frida_g_menu_item_get_attribute +#define g_menu_item_get_attribute_value _frida_g_menu_item_get_attribute_value +#define g_menu_item_get_link _frida_g_menu_item_get_link +#define g_menu_item_get_type _frida_g_menu_item_get_type +#define g_menu_item_new _frida_g_menu_item_new +#define g_menu_item_new_from_model _frida_g_menu_item_new_from_model +#define g_menu_item_new_section _frida_g_menu_item_new_section +#define g_menu_item_new_submenu _frida_g_menu_item_new_submenu +#define g_menu_item_set_action_and_target _frida_g_menu_item_set_action_and_target +#define g_menu_item_set_action_and_target_value _frida_g_menu_item_set_action_and_target_value +#define g_menu_item_set_attribute _frida_g_menu_item_set_attribute +#define g_menu_item_set_attribute_value _frida_g_menu_item_set_attribute_value +#define g_menu_item_set_detailed_action _frida_g_menu_item_set_detailed_action +#define g_menu_item_set_icon _frida_g_menu_item_set_icon +#define g_menu_item_set_label _frida_g_menu_item_set_label +#define g_menu_item_set_link _frida_g_menu_item_set_link +#define g_menu_item_set_section _frida_g_menu_item_set_section +#define g_menu_item_set_submenu _frida_g_menu_item_set_submenu +#define g_menu_link_iter_get_name _frida_g_menu_link_iter_get_name +#define g_menu_link_iter_get_next _frida_g_menu_link_iter_get_next +#define g_menu_link_iter_get_type _frida_g_menu_link_iter_get_type +#define g_menu_link_iter_get_value _frida_g_menu_link_iter_get_value +#define g_menu_link_iter_next _frida_g_menu_link_iter_next +#define g_menu_model_get_item_attribute _frida_g_menu_model_get_item_attribute +#define g_menu_model_get_item_attribute_value _frida_g_menu_model_get_item_attribute_value +#define g_menu_model_get_item_link _frida_g_menu_model_get_item_link +#define g_menu_model_get_n_items _frida_g_menu_model_get_n_items +#define g_menu_model_get_type _frida_g_menu_model_get_type +#define g_menu_model_is_mutable _frida_g_menu_model_is_mutable +#define g_menu_model_items_changed _frida_g_menu_model_items_changed +#define g_menu_model_iterate_item_attributes _frida_g_menu_model_iterate_item_attributes +#define g_menu_model_iterate_item_links _frida_g_menu_model_iterate_item_links +#define g_menu_new _frida_g_menu_new +#define g_menu_prepend _frida_g_menu_prepend +#define g_menu_prepend_item _frida_g_menu_prepend_item +#define g_menu_prepend_section _frida_g_menu_prepend_section +#define g_menu_prepend_submenu _frida_g_menu_prepend_submenu +#define g_menu_remove _frida_g_menu_remove +#define g_menu_remove_all _frida_g_menu_remove_all +#define g_mkdir _frida_g_mkdir +#define g_mkdir_with_parents _frida_g_mkdir_with_parents +#define g_mkdtemp _frida_g_mkdtemp +#define g_mkdtemp_full _frida_g_mkdtemp_full +#define g_mkstemp _frida_g_mkstemp +#define g_mkstemp_full _frida_g_mkstemp_full +#define g_module_build_path _frida_g_module_build_path +#define g_module_close _frida_g_module_close +#define g_module_error _frida_g_module_error +#define g_module_make_resident _frida_g_module_make_resident +#define g_module_name _frida_g_module_name +#define g_module_open _frida_g_module_open +#define g_module_supported _frida_g_module_supported +#define g_module_symbol _frida_g_module_symbol +#define g_mount_can_eject _frida_g_mount_can_eject +#define g_mount_can_unmount _frida_g_mount_can_unmount +#define g_mount_eject _frida_g_mount_eject +#define g_mount_eject_finish _frida_g_mount_eject_finish +#define g_mount_eject_with_operation _frida_g_mount_eject_with_operation +#define g_mount_eject_with_operation_finish _frida_g_mount_eject_with_operation_finish +#define g_mount_get_default_location _frida_g_mount_get_default_location +#define g_mount_get_drive _frida_g_mount_get_drive +#define g_mount_get_icon _frida_g_mount_get_icon +#define g_mount_get_name _frida_g_mount_get_name +#define g_mount_get_root _frida_g_mount_get_root +#define g_mount_get_sort_key _frida_g_mount_get_sort_key +#define g_mount_get_symbolic_icon _frida_g_mount_get_symbolic_icon +#define g_mount_get_type _frida_g_mount_get_type +#define g_mount_get_uuid _frida_g_mount_get_uuid +#define g_mount_get_volume _frida_g_mount_get_volume +#define g_mount_guess_content_type _frida_g_mount_guess_content_type +#define g_mount_guess_content_type_finish _frida_g_mount_guess_content_type_finish +#define g_mount_guess_content_type_sync _frida_g_mount_guess_content_type_sync +#define g_mount_is_shadowed _frida_g_mount_is_shadowed +#define g_mount_mount_flags_get_type _frida_g_mount_mount_flags_get_type +#define g_mount_operation_get_anonymous _frida_g_mount_operation_get_anonymous +#define g_mount_operation_get_choice _frida_g_mount_operation_get_choice +#define g_mount_operation_get_domain _frida_g_mount_operation_get_domain +#define g_mount_operation_get_is_tcrypt_hidden_volume _frida_g_mount_operation_get_is_tcrypt_hidden_volume +#define g_mount_operation_get_is_tcrypt_system_volume _frida_g_mount_operation_get_is_tcrypt_system_volume +#define g_mount_operation_get_password _frida_g_mount_operation_get_password +#define g_mount_operation_get_password_save _frida_g_mount_operation_get_password_save +#define g_mount_operation_get_pim _frida_g_mount_operation_get_pim +#define g_mount_operation_get_type _frida_g_mount_operation_get_type +#define g_mount_operation_get_username _frida_g_mount_operation_get_username +#define g_mount_operation_new _frida_g_mount_operation_new +#define g_mount_operation_reply _frida_g_mount_operation_reply +#define g_mount_operation_result_get_type _frida_g_mount_operation_result_get_type +#define g_mount_operation_set_anonymous _frida_g_mount_operation_set_anonymous +#define g_mount_operation_set_choice _frida_g_mount_operation_set_choice +#define g_mount_operation_set_domain _frida_g_mount_operation_set_domain +#define g_mount_operation_set_is_tcrypt_hidden_volume _frida_g_mount_operation_set_is_tcrypt_hidden_volume +#define g_mount_operation_set_is_tcrypt_system_volume _frida_g_mount_operation_set_is_tcrypt_system_volume +#define g_mount_operation_set_password _frida_g_mount_operation_set_password +#define g_mount_operation_set_password_save _frida_g_mount_operation_set_password_save +#define g_mount_operation_set_pim _frida_g_mount_operation_set_pim +#define g_mount_operation_set_username _frida_g_mount_operation_set_username +#define g_mount_remount _frida_g_mount_remount +#define g_mount_remount_finish _frida_g_mount_remount_finish +#define g_mount_shadow _frida_g_mount_shadow +#define g_mount_unmount _frida_g_mount_unmount +#define g_mount_unmount_finish _frida_g_mount_unmount_finish +#define g_mount_unmount_flags_get_type _frida_g_mount_unmount_flags_get_type +#define g_mount_unmount_with_operation _frida_g_mount_unmount_with_operation +#define g_mount_unmount_with_operation_finish _frida_g_mount_unmount_with_operation_finish +#define g_mount_unshadow _frida_g_mount_unshadow +#define g_mutex_clear _frida_g_mutex_clear +#define g_mutex_free _frida_g_mutex_free +#define g_mutex_init _frida_g_mutex_init +#define g_mutex_lock _frida_g_mutex_lock +#define g_mutex_new _frida_g_mutex_new +#define g_mutex_trylock _frida_g_mutex_trylock +#define g_mutex_unlock _frida_g_mutex_unlock +#define g_native_socket_address_get_type _frida_g_native_socket_address_get_type +#define g_native_socket_address_new _frida_g_native_socket_address_new +#define g_native_volume_monitor_get_type _frida_g_native_volume_monitor_get_type +#define g_network_address_get_hostname _frida_g_network_address_get_hostname +#define g_network_address_get_port _frida_g_network_address_get_port +#define g_network_address_get_scheme _frida_g_network_address_get_scheme +#define g_network_address_get_type _frida_g_network_address_get_type +#define g_network_address_new _frida_g_network_address_new +#define g_network_address_new_loopback _frida_g_network_address_new_loopback +#define g_network_address_parse _frida_g_network_address_parse +#define g_network_address_parse_uri _frida_g_network_address_parse_uri +#define g_network_connectivity_get_type _frida_g_network_connectivity_get_type +#define g_network_monitor_base_add_network _frida_g_network_monitor_base_add_network +#define g_network_monitor_base_get_type _frida_g_network_monitor_base_get_type +#define g_network_monitor_base_remove_network _frida_g_network_monitor_base_remove_network +#define g_network_monitor_base_set_networks _frida_g_network_monitor_base_set_networks +#define g_network_monitor_can_reach _frida_g_network_monitor_can_reach +#define g_network_monitor_can_reach_async _frida_g_network_monitor_can_reach_async +#define g_network_monitor_can_reach_finish _frida_g_network_monitor_can_reach_finish +#define g_network_monitor_get_connectivity _frida_g_network_monitor_get_connectivity +#define g_network_monitor_get_default _frida_g_network_monitor_get_default +#define g_network_monitor_get_network_available _frida_g_network_monitor_get_network_available +#define g_network_monitor_get_network_metered _frida_g_network_monitor_get_network_metered +#define g_network_monitor_get_type _frida_g_network_monitor_get_type +#define g_network_monitor_portal_get_type _frida_g_network_monitor_portal_get_type +#define g_network_service_get_domain _frida_g_network_service_get_domain +#define g_network_service_get_protocol _frida_g_network_service_get_protocol +#define g_network_service_get_scheme _frida_g_network_service_get_scheme +#define g_network_service_get_service _frida_g_network_service_get_service +#define g_network_service_get_type _frida_g_network_service_get_type +#define g_network_service_new _frida_g_network_service_new +#define g_network_service_set_scheme _frida_g_network_service_set_scheme +#define g_networking_init _frida_g_networking_init +#define g_node_child_index _frida_g_node_child_index +#define g_node_child_position _frida_g_node_child_position +#define g_node_children_foreach _frida_g_node_children_foreach +#define g_node_copy _frida_g_node_copy +#define g_node_copy_deep _frida_g_node_copy_deep +#define g_node_depth _frida_g_node_depth +#define g_node_destroy _frida_g_node_destroy +#define g_node_find _frida_g_node_find +#define g_node_find_child _frida_g_node_find_child +#define g_node_first_sibling _frida_g_node_first_sibling +#define g_node_get_root _frida_g_node_get_root +#define g_node_insert _frida_g_node_insert +#define g_node_insert_after _frida_g_node_insert_after +#define g_node_insert_before _frida_g_node_insert_before +#define g_node_is_ancestor _frida_g_node_is_ancestor +#define g_node_last_child _frida_g_node_last_child +#define g_node_last_sibling _frida_g_node_last_sibling +#define g_node_max_height _frida_g_node_max_height +#define g_node_n_children _frida_g_node_n_children +#define g_node_n_nodes _frida_g_node_n_nodes +#define g_node_new _frida_g_node_new +#define g_node_nth_child _frida_g_node_nth_child +#define g_node_pop_allocator _frida_g_node_pop_allocator +#define g_node_prepend _frida_g_node_prepend +#define g_node_push_allocator _frida_g_node_push_allocator +#define g_node_reverse_children _frida_g_node_reverse_children +#define g_node_traverse _frida_g_node_traverse +#define g_node_unlink _frida_g_node_unlink +#define g_normalize_mode_get_type _frida_g_normalize_mode_get_type +#define g_notification_add_button _frida_g_notification_add_button +#define g_notification_add_button_with_target _frida_g_notification_add_button_with_target +#define g_notification_add_button_with_target_value _frida_g_notification_add_button_with_target_value +#define g_notification_backend_get_type _frida_g_notification_backend_get_type +#define g_notification_backend_new_default _frida_g_notification_backend_new_default +#define g_notification_backend_send_notification _frida_g_notification_backend_send_notification +#define g_notification_backend_withdraw_notification _frida_g_notification_backend_withdraw_notification +#define g_notification_get_body _frida_g_notification_get_body +#define g_notification_get_button _frida_g_notification_get_button +#define g_notification_get_button_with_action _frida_g_notification_get_button_with_action +#define g_notification_get_default_action _frida_g_notification_get_default_action +#define g_notification_get_icon _frida_g_notification_get_icon +#define g_notification_get_n_buttons _frida_g_notification_get_n_buttons +#define g_notification_get_priority _frida_g_notification_get_priority +#define g_notification_get_title _frida_g_notification_get_title +#define g_notification_get_type _frida_g_notification_get_type +#define g_notification_new _frida_g_notification_new +#define g_notification_priority_get_type _frida_g_notification_priority_get_type +#define g_notification_serialize _frida_g_notification_serialize +#define g_notification_set_body _frida_g_notification_set_body +#define g_notification_set_default_action _frida_g_notification_set_default_action +#define g_notification_set_default_action_and_target _frida_g_notification_set_default_action_and_target +#define g_notification_set_default_action_and_target_value _frida_g_notification_set_default_action_and_target_value +#define g_notification_set_icon _frida_g_notification_set_icon +#define g_notification_set_priority _frida_g_notification_set_priority +#define g_notification_set_title _frida_g_notification_set_title +#define g_notification_set_urgent _frida_g_notification_set_urgent +#define g_null_settings_backend_get_type _frida_g_null_settings_backend_get_type +#define g_null_settings_backend_new _frida_g_null_settings_backend_new +#define g_nullify_pointer _frida_g_nullify_pointer +#define g_number_parser_error_quark _frida_g_number_parser_error_quark +#define g_object_add_toggle_ref _frida_g_object_add_toggle_ref +#define g_object_add_weak_pointer _frida_g_object_add_weak_pointer +#define g_object_bind_property _frida_g_object_bind_property +#define g_object_bind_property_full _frida_g_object_bind_property_full +#define g_object_bind_property_with_closures _frida_g_object_bind_property_with_closures +#define g_object_class_find_property _frida_g_object_class_find_property +#define g_object_class_install_properties _frida_g_object_class_install_properties +#define g_object_class_install_property _frida_g_object_class_install_property +#define g_object_class_list_properties _frida_g_object_class_list_properties +#define g_object_class_override_property _frida_g_object_class_override_property +#define g_object_compat_control _frida_g_object_compat_control +#define g_object_connect _frida_g_object_connect +#define g_object_disconnect _frida_g_object_disconnect +#define g_object_dup_data _frida_g_object_dup_data +#define g_object_dup_qdata _frida_g_object_dup_qdata +#define g_object_force_floating _frida_g_object_force_floating +#define g_object_freeze_notify _frida_g_object_freeze_notify +#define g_object_get _frida_g_object_get +#define g_object_get_data _frida_g_object_get_data +#define g_object_get_property _frida_g_object_get_property +#define g_object_get_qdata _frida_g_object_get_qdata +#define g_object_get_type _frida_g_object_get_type +#define g_object_get_valist _frida_g_object_get_valist +#define g_object_getv _frida_g_object_getv +#define g_object_interface_find_property _frida_g_object_interface_find_property +#define g_object_interface_install_property _frida_g_object_interface_install_property +#define g_object_interface_list_properties _frida_g_object_interface_list_properties +#define g_object_is_floating _frida_g_object_is_floating +#define g_object_new _frida_g_object_new +#define g_object_new_valist _frida_g_object_new_valist +#define g_object_new_with_properties _frida_g_object_new_with_properties +#define g_object_newv _frida_g_object_newv +#define g_object_notify _frida_g_object_notify +#define g_object_notify_by_pspec _frida_g_object_notify_by_pspec +#define g_object_ref _frida_g_object_ref +#define g_object_ref_sink _frida_g_object_ref_sink +#define g_object_remove_toggle_ref _frida_g_object_remove_toggle_ref +#define g_object_remove_weak_pointer _frida_g_object_remove_weak_pointer +#define g_object_replace_data _frida_g_object_replace_data +#define g_object_replace_qdata _frida_g_object_replace_qdata +#define g_object_run_dispose _frida_g_object_run_dispose +#define g_object_set _frida_g_object_set +#define g_object_set_data _frida_g_object_set_data +#define g_object_set_data_full _frida_g_object_set_data_full +#define g_object_set_property _frida_g_object_set_property +#define g_object_set_qdata _frida_g_object_set_qdata +#define g_object_set_qdata_full _frida_g_object_set_qdata_full +#define g_object_set_valist _frida_g_object_set_valist +#define g_object_setv _frida_g_object_setv +#define g_object_steal_data _frida_g_object_steal_data +#define g_object_steal_qdata _frida_g_object_steal_qdata +#define g_object_thaw_notify _frida_g_object_thaw_notify +#define g_object_unref _frida_g_object_unref +#define g_object_watch_closure _frida_g_object_watch_closure +#define g_object_weak_ref _frida_g_object_weak_ref +#define g_object_weak_unref _frida_g_object_weak_unref +#define g_on_error_query _frida_g_on_error_query +#define g_on_error_stack_trace _frida_g_on_error_stack_trace +#define g_once_impl _frida_g_once_impl +#define g_once_init_enter _frida_g_once_init_enter +#define g_once_init_enter_impl _frida_g_once_init_enter_impl +#define g_once_init_leave _frida_g_once_init_leave +#define g_open _frida_g_open +#define g_openuri_portal_open_uri _frida_g_openuri_portal_open_uri +#define g_openuri_portal_open_uri_async _frida_g_openuri_portal_open_uri_async +#define g_openuri_portal_open_uri_finish _frida_g_openuri_portal_open_uri_finish +#define g_option_context_add_group _frida_g_option_context_add_group +#define g_option_context_add_main_entries _frida_g_option_context_add_main_entries +#define g_option_context_free _frida_g_option_context_free +#define g_option_context_get_description _frida_g_option_context_get_description +#define g_option_context_get_help _frida_g_option_context_get_help +#define g_option_context_get_help_enabled _frida_g_option_context_get_help_enabled +#define g_option_context_get_ignore_unknown_options _frida_g_option_context_get_ignore_unknown_options +#define g_option_context_get_main_group _frida_g_option_context_get_main_group +#define g_option_context_get_strict_posix _frida_g_option_context_get_strict_posix +#define g_option_context_get_summary _frida_g_option_context_get_summary +#define g_option_context_new _frida_g_option_context_new +#define g_option_context_parse _frida_g_option_context_parse +#define g_option_context_parse_strv _frida_g_option_context_parse_strv +#define g_option_context_set_description _frida_g_option_context_set_description +#define g_option_context_set_help_enabled _frida_g_option_context_set_help_enabled +#define g_option_context_set_ignore_unknown_options _frida_g_option_context_set_ignore_unknown_options +#define g_option_context_set_main_group _frida_g_option_context_set_main_group +#define g_option_context_set_strict_posix _frida_g_option_context_set_strict_posix +#define g_option_context_set_summary _frida_g_option_context_set_summary +#define g_option_context_set_translate_func _frida_g_option_context_set_translate_func +#define g_option_context_set_translation_domain _frida_g_option_context_set_translation_domain +#define g_option_error_quark _frida_g_option_error_quark +#define g_option_group_add_entries _frida_g_option_group_add_entries +#define g_option_group_free _frida_g_option_group_free +#define g_option_group_get_type _frida_g_option_group_get_type +#define g_option_group_new _frida_g_option_group_new +#define g_option_group_ref _frida_g_option_group_ref +#define g_option_group_set_error_hook _frida_g_option_group_set_error_hook +#define g_option_group_set_parse_hooks _frida_g_option_group_set_parse_hooks +#define g_option_group_set_translate_func _frida_g_option_group_set_translate_func +#define g_option_group_set_translation_domain _frida_g_option_group_set_translation_domain +#define g_option_group_unref _frida_g_option_group_unref +#define g_output_stream_async_close_is_via_threads _frida_g_output_stream_async_close_is_via_threads +#define g_output_stream_async_write_is_via_threads _frida_g_output_stream_async_write_is_via_threads +#define g_output_stream_async_writev_is_via_threads _frida_g_output_stream_async_writev_is_via_threads +#define g_output_stream_clear_pending _frida_g_output_stream_clear_pending +#define g_output_stream_close _frida_g_output_stream_close +#define g_output_stream_close_async _frida_g_output_stream_close_async +#define g_output_stream_close_finish _frida_g_output_stream_close_finish +#define g_output_stream_flush _frida_g_output_stream_flush +#define g_output_stream_flush_async _frida_g_output_stream_flush_async +#define g_output_stream_flush_finish _frida_g_output_stream_flush_finish +#define g_output_stream_get_type _frida_g_output_stream_get_type +#define g_output_stream_has_pending _frida_g_output_stream_has_pending +#define g_output_stream_is_closed _frida_g_output_stream_is_closed +#define g_output_stream_is_closing _frida_g_output_stream_is_closing +#define g_output_stream_printf _frida_g_output_stream_printf +#define g_output_stream_set_pending _frida_g_output_stream_set_pending +#define g_output_stream_splice _frida_g_output_stream_splice +#define g_output_stream_splice_async _frida_g_output_stream_splice_async +#define g_output_stream_splice_finish _frida_g_output_stream_splice_finish +#define g_output_stream_splice_flags_get_type _frida_g_output_stream_splice_flags_get_type +#define g_output_stream_vprintf _frida_g_output_stream_vprintf +#define g_output_stream_write _frida_g_output_stream_write +#define g_output_stream_write_all _frida_g_output_stream_write_all +#define g_output_stream_write_all_async _frida_g_output_stream_write_all_async +#define g_output_stream_write_all_finish _frida_g_output_stream_write_all_finish +#define g_output_stream_write_async _frida_g_output_stream_write_async +#define g_output_stream_write_bytes _frida_g_output_stream_write_bytes +#define g_output_stream_write_bytes_async _frida_g_output_stream_write_bytes_async +#define g_output_stream_write_bytes_finish _frida_g_output_stream_write_bytes_finish +#define g_output_stream_write_finish _frida_g_output_stream_write_finish +#define g_output_stream_writev _frida_g_output_stream_writev +#define g_output_stream_writev_all _frida_g_output_stream_writev_all +#define g_output_stream_writev_all_async _frida_g_output_stream_writev_all_async +#define g_output_stream_writev_all_finish _frida_g_output_stream_writev_all_finish +#define g_output_stream_writev_async _frida_g_output_stream_writev_async +#define g_output_stream_writev_finish _frida_g_output_stream_writev_finish +#define g_param_spec_boolean _frida_g_param_spec_boolean +#define g_param_spec_boxed _frida_g_param_spec_boxed +#define g_param_spec_char _frida_g_param_spec_char +#define g_param_spec_double _frida_g_param_spec_double +#define g_param_spec_enum _frida_g_param_spec_enum +#define g_param_spec_flags _frida_g_param_spec_flags +#define g_param_spec_float _frida_g_param_spec_float +#define g_param_spec_get_blurb _frida_g_param_spec_get_blurb +#define g_param_spec_get_default_value _frida_g_param_spec_get_default_value +#define g_param_spec_get_name _frida_g_param_spec_get_name +#define g_param_spec_get_name_quark _frida_g_param_spec_get_name_quark +#define g_param_spec_get_nick _frida_g_param_spec_get_nick +#define g_param_spec_get_qdata _frida_g_param_spec_get_qdata +#define g_param_spec_get_redirect_target _frida_g_param_spec_get_redirect_target +#define g_param_spec_gtype _frida_g_param_spec_gtype +#define g_param_spec_int _frida_g_param_spec_int +#define g_param_spec_int64 _frida_g_param_spec_int64 +#define g_param_spec_internal _frida_g_param_spec_internal +#define g_param_spec_is_valid_name _frida_g_param_spec_is_valid_name +#define g_param_spec_long _frida_g_param_spec_long +#define g_param_spec_object _frida_g_param_spec_object +#define g_param_spec_override _frida_g_param_spec_override +#define g_param_spec_param _frida_g_param_spec_param +#define g_param_spec_pointer _frida_g_param_spec_pointer +#define g_param_spec_pool_insert _frida_g_param_spec_pool_insert +#define g_param_spec_pool_list _frida_g_param_spec_pool_list +#define g_param_spec_pool_list_owned _frida_g_param_spec_pool_list_owned +#define g_param_spec_pool_lookup _frida_g_param_spec_pool_lookup +#define g_param_spec_pool_new _frida_g_param_spec_pool_new +#define g_param_spec_pool_remove _frida_g_param_spec_pool_remove +#define g_param_spec_ref _frida_g_param_spec_ref +#define g_param_spec_ref_sink _frida_g_param_spec_ref_sink +#define g_param_spec_set_qdata _frida_g_param_spec_set_qdata +#define g_param_spec_set_qdata_full _frida_g_param_spec_set_qdata_full +#define g_param_spec_sink _frida_g_param_spec_sink +#define g_param_spec_steal_qdata _frida_g_param_spec_steal_qdata +#define g_param_spec_string _frida_g_param_spec_string +#define g_param_spec_types _frida_g_param_spec_types +#define g_param_spec_uchar _frida_g_param_spec_uchar +#define g_param_spec_uint _frida_g_param_spec_uint +#define g_param_spec_uint64 _frida_g_param_spec_uint64 +#define g_param_spec_ulong _frida_g_param_spec_ulong +#define g_param_spec_unichar _frida_g_param_spec_unichar +#define g_param_spec_unref _frida_g_param_spec_unref +#define g_param_spec_value_array _frida_g_param_spec_value_array +#define g_param_spec_variant _frida_g_param_spec_variant +#define g_param_type_register_static _frida_g_param_type_register_static +#define g_param_value_convert _frida_g_param_value_convert +#define g_param_value_defaults _frida_g_param_value_defaults +#define g_param_value_set_default _frida_g_param_value_set_default +#define g_param_value_validate _frida_g_param_value_validate +#define g_param_values_cmp _frida_g_param_values_cmp +#define g_parse_debug_string _frida_g_parse_debug_string +#define g_password_save_get_type _frida_g_password_save_get_type +#define g_path_get_basename _frida_g_path_get_basename +#define g_path_get_dirname _frida_g_path_get_dirname +#define g_path_is_absolute _frida_g_path_is_absolute +#define g_path_skip_root _frida_g_path_skip_root +#define g_pattern_match _frida_g_pattern_match +#define g_pattern_match_simple _frida_g_pattern_match_simple +#define g_pattern_match_string _frida_g_pattern_match_string +#define g_pattern_spec_equal _frida_g_pattern_spec_equal +#define g_pattern_spec_free _frida_g_pattern_spec_free +#define g_pattern_spec_new _frida_g_pattern_spec_new +#define g_permission_acquire _frida_g_permission_acquire +#define g_permission_acquire_async _frida_g_permission_acquire_async +#define g_permission_acquire_finish _frida_g_permission_acquire_finish +#define g_permission_get_allowed _frida_g_permission_get_allowed +#define g_permission_get_can_acquire _frida_g_permission_get_can_acquire +#define g_permission_get_can_release _frida_g_permission_get_can_release +#define g_permission_get_type _frida_g_permission_get_type +#define g_permission_impl_update _frida_g_permission_impl_update +#define g_permission_release _frida_g_permission_release +#define g_permission_release_async _frida_g_permission_release_async +#define g_permission_release_finish _frida_g_permission_release_finish +#define g_platform_audit_set_fd_callbacks _frida_g_platform_audit_set_fd_callbacks +#define g_pointer_bit_lock _frida_g_pointer_bit_lock +#define g_pointer_bit_trylock _frida_g_pointer_bit_trylock +#define g_pointer_bit_unlock _frida_g_pointer_bit_unlock +#define g_pointer_type_register_static _frida_g_pointer_type_register_static +#define g_poll _frida_g_poll +#define g_pollable_input_stream_can_poll _frida_g_pollable_input_stream_can_poll +#define g_pollable_input_stream_create_source _frida_g_pollable_input_stream_create_source +#define g_pollable_input_stream_get_type _frida_g_pollable_input_stream_get_type +#define g_pollable_input_stream_is_readable _frida_g_pollable_input_stream_is_readable +#define g_pollable_input_stream_read_nonblocking _frida_g_pollable_input_stream_read_nonblocking +#define g_pollable_output_stream_can_poll _frida_g_pollable_output_stream_can_poll +#define g_pollable_output_stream_create_source _frida_g_pollable_output_stream_create_source +#define g_pollable_output_stream_get_type _frida_g_pollable_output_stream_get_type +#define g_pollable_output_stream_is_writable _frida_g_pollable_output_stream_is_writable +#define g_pollable_output_stream_write_nonblocking _frida_g_pollable_output_stream_write_nonblocking +#define g_pollable_output_stream_writev_nonblocking _frida_g_pollable_output_stream_writev_nonblocking +#define g_pollable_return_get_type _frida_g_pollable_return_get_type +#define g_pollable_source_new _frida_g_pollable_source_new +#define g_pollable_source_new_full _frida_g_pollable_source_new_full +#define g_pollable_stream_read _frida_g_pollable_stream_read +#define g_pollable_stream_write _frida_g_pollable_stream_write +#define g_pollable_stream_write_all _frida_g_pollable_stream_write_all +#define g_pollfd_get_type _frida_g_pollfd_get_type +#define g_portal_notification_backend_get_type _frida_g_portal_notification_backend_get_type +#define g_prefix_error _frida_g_prefix_error +#define g_print _frida_g_print +#define g_printerr _frida_g_printerr +#define g_printf _frida_g_printf +#define g_printf_string_upper_bound _frida_g_printf_string_upper_bound +#define g_private_get _frida_g_private_get +#define g_private_new _frida_g_private_new +#define g_private_replace _frida_g_private_replace +#define g_private_set _frida_g_private_set +#define g_private_set_alloc0 _frida_g_private_set_alloc0 +#define g_propagate_error _frida_g_propagate_error +#define g_propagate_prefixed_error _frida_g_propagate_prefixed_error +#define g_property_action_get_type _frida_g_property_action_get_type +#define g_property_action_new _frida_g_property_action_new +#define g_proxy_address_enumerator_get_type _frida_g_proxy_address_enumerator_get_type +#define g_proxy_address_get_destination_hostname _frida_g_proxy_address_get_destination_hostname +#define g_proxy_address_get_destination_port _frida_g_proxy_address_get_destination_port +#define g_proxy_address_get_destination_protocol _frida_g_proxy_address_get_destination_protocol +#define g_proxy_address_get_password _frida_g_proxy_address_get_password +#define g_proxy_address_get_protocol _frida_g_proxy_address_get_protocol +#define g_proxy_address_get_type _frida_g_proxy_address_get_type +#define g_proxy_address_get_uri _frida_g_proxy_address_get_uri +#define g_proxy_address_get_username _frida_g_proxy_address_get_username +#define g_proxy_address_new _frida_g_proxy_address_new +#define g_proxy_connect _frida_g_proxy_connect +#define g_proxy_connect_async _frida_g_proxy_connect_async +#define g_proxy_connect_finish _frida_g_proxy_connect_finish +#define g_proxy_get_default_for_protocol _frida_g_proxy_get_default_for_protocol +#define g_proxy_get_type _frida_g_proxy_get_type +#define g_proxy_resolver_get_default _frida_g_proxy_resolver_get_default +#define g_proxy_resolver_get_type _frida_g_proxy_resolver_get_type +#define g_proxy_resolver_is_supported _frida_g_proxy_resolver_is_supported +#define g_proxy_resolver_lookup _frida_g_proxy_resolver_lookup +#define g_proxy_resolver_lookup_async _frida_g_proxy_resolver_lookup_async +#define g_proxy_resolver_lookup_finish _frida_g_proxy_resolver_lookup_finish +#define g_proxy_resolver_portal_get_type _frida_g_proxy_resolver_portal_get_type +#define g_proxy_supports_hostname _frida_g_proxy_supports_hostname +#define g_ptr_array_add _frida_g_ptr_array_add +#define g_ptr_array_copy _frida_g_ptr_array_copy +#define g_ptr_array_extend _frida_g_ptr_array_extend +#define g_ptr_array_extend_and_steal _frida_g_ptr_array_extend_and_steal +#define g_ptr_array_find _frida_g_ptr_array_find +#define g_ptr_array_find_with_equal_func _frida_g_ptr_array_find_with_equal_func +#define g_ptr_array_foreach _frida_g_ptr_array_foreach +#define g_ptr_array_free _frida_g_ptr_array_free +#define g_ptr_array_get_type _frida_g_ptr_array_get_type +#define g_ptr_array_insert _frida_g_ptr_array_insert +#define g_ptr_array_new _frida_g_ptr_array_new +#define g_ptr_array_new_full _frida_g_ptr_array_new_full +#define g_ptr_array_new_with_free_func _frida_g_ptr_array_new_with_free_func +#define g_ptr_array_ref _frida_g_ptr_array_ref +#define g_ptr_array_remove _frida_g_ptr_array_remove +#define g_ptr_array_remove_fast _frida_g_ptr_array_remove_fast +#define g_ptr_array_remove_index _frida_g_ptr_array_remove_index +#define g_ptr_array_remove_index_fast _frida_g_ptr_array_remove_index_fast +#define g_ptr_array_remove_range _frida_g_ptr_array_remove_range +#define g_ptr_array_set_free_func _frida_g_ptr_array_set_free_func +#define g_ptr_array_set_size _frida_g_ptr_array_set_size +#define g_ptr_array_sized_new _frida_g_ptr_array_sized_new +#define g_ptr_array_sort _frida_g_ptr_array_sort +#define g_ptr_array_sort_with_data _frida_g_ptr_array_sort_with_data +#define g_ptr_array_steal _frida_g_ptr_array_steal +#define g_ptr_array_steal_index _frida_g_ptr_array_steal_index +#define g_ptr_array_steal_index_fast _frida_g_ptr_array_steal_index_fast +#define g_ptr_array_unref _frida_g_ptr_array_unref +#define g_qsort_with_data _frida_g_qsort_with_data +#define g_quark_from_static_string _frida_g_quark_from_static_string +#define g_quark_from_string _frida_g_quark_from_string +#define g_quark_init _frida_g_quark_init +#define g_quark_to_string _frida_g_quark_to_string +#define g_quark_try_string _frida_g_quark_try_string +#define g_queue_clear _frida_g_queue_clear +#define g_queue_clear_full _frida_g_queue_clear_full +#define g_queue_copy _frida_g_queue_copy +#define g_queue_delete_link _frida_g_queue_delete_link +#define g_queue_find _frida_g_queue_find +#define g_queue_find_custom _frida_g_queue_find_custom +#define g_queue_foreach _frida_g_queue_foreach +#define g_queue_free _frida_g_queue_free +#define g_queue_free_full _frida_g_queue_free_full +#define g_queue_get_length _frida_g_queue_get_length +#define g_queue_index _frida_g_queue_index +#define g_queue_init _frida_g_queue_init +#define g_queue_insert_after _frida_g_queue_insert_after +#define g_queue_insert_after_link _frida_g_queue_insert_after_link +#define g_queue_insert_before _frida_g_queue_insert_before +#define g_queue_insert_before_link _frida_g_queue_insert_before_link +#define g_queue_insert_sorted _frida_g_queue_insert_sorted +#define g_queue_is_empty _frida_g_queue_is_empty +#define g_queue_link_index _frida_g_queue_link_index +#define g_queue_new _frida_g_queue_new +#define g_queue_peek_head _frida_g_queue_peek_head +#define g_queue_peek_head_link _frida_g_queue_peek_head_link +#define g_queue_peek_nth _frida_g_queue_peek_nth +#define g_queue_peek_nth_link _frida_g_queue_peek_nth_link +#define g_queue_peek_tail _frida_g_queue_peek_tail +#define g_queue_peek_tail_link _frida_g_queue_peek_tail_link +#define g_queue_pop_head _frida_g_queue_pop_head +#define g_queue_pop_head_link _frida_g_queue_pop_head_link +#define g_queue_pop_nth _frida_g_queue_pop_nth +#define g_queue_pop_nth_link _frida_g_queue_pop_nth_link +#define g_queue_pop_tail _frida_g_queue_pop_tail +#define g_queue_pop_tail_link _frida_g_queue_pop_tail_link +#define g_queue_push_head _frida_g_queue_push_head +#define g_queue_push_head_link _frida_g_queue_push_head_link +#define g_queue_push_nth _frida_g_queue_push_nth +#define g_queue_push_nth_link _frida_g_queue_push_nth_link +#define g_queue_push_tail _frida_g_queue_push_tail +#define g_queue_push_tail_link _frida_g_queue_push_tail_link +#define g_queue_remove _frida_g_queue_remove +#define g_queue_remove_all _frida_g_queue_remove_all +#define g_queue_reverse _frida_g_queue_reverse +#define g_queue_sort _frida_g_queue_sort +#define g_queue_unlink _frida_g_queue_unlink +#define g_rand_copy _frida_g_rand_copy +#define g_rand_double _frida_g_rand_double +#define g_rand_double_range _frida_g_rand_double_range +#define g_rand_free _frida_g_rand_free +#define g_rand_int _frida_g_rand_int +#define g_rand_int_range _frida_g_rand_int_range +#define g_rand_new _frida_g_rand_new +#define g_rand_new_with_seed _frida_g_rand_new_with_seed +#define g_rand_new_with_seed_array _frida_g_rand_new_with_seed_array +#define g_rand_set_seed _frida_g_rand_set_seed +#define g_rand_set_seed_array _frida_g_rand_set_seed_array +#define g_random_double _frida_g_random_double +#define g_random_double_range _frida_g_random_double_range +#define g_random_int _frida_g_random_int +#define g_random_int_range _frida_g_random_int_range +#define g_random_set_seed _frida_g_random_set_seed +#define g_rc_box_acquire _frida_g_rc_box_acquire +#define g_rc_box_alloc _frida_g_rc_box_alloc +#define g_rc_box_alloc0 _frida_g_rc_box_alloc0 +#define g_rc_box_alloc_full _frida_g_rc_box_alloc_full +#define g_rc_box_dup _frida_g_rc_box_dup +#define g_rc_box_get_size _frida_g_rc_box_get_size +#define g_rc_box_release _frida_g_rc_box_release +#define g_rc_box_release_full _frida_g_rc_box_release_full +#define g_realloc _frida_g_realloc +#define g_realloc_n _frida_g_realloc_n +#define g_rec_mutex_clear _frida_g_rec_mutex_clear +#define g_rec_mutex_init _frida_g_rec_mutex_init +#define g_rec_mutex_lock _frida_g_rec_mutex_lock +#define g_rec_mutex_trylock _frida_g_rec_mutex_trylock +#define g_rec_mutex_unlock _frida_g_rec_mutex_unlock +#define g_ref_count_compare _frida_g_ref_count_compare +#define g_ref_count_dec _frida_g_ref_count_dec +#define g_ref_count_inc _frida_g_ref_count_inc +#define g_ref_count_init _frida_g_ref_count_init +#define g_ref_string_acquire _frida_g_ref_string_acquire +#define g_ref_string_length _frida_g_ref_string_length +#define g_ref_string_new _frida_g_ref_string_new +#define g_ref_string_new_intern _frida_g_ref_string_new_intern +#define g_ref_string_new_len _frida_g_ref_string_new_len +#define g_ref_string_release _frida_g_ref_string_release +#define g_regex_check_replacement _frida_g_regex_check_replacement +#define g_regex_error_quark _frida_g_regex_error_quark +#define g_regex_escape_nul _frida_g_regex_escape_nul +#define g_regex_escape_string _frida_g_regex_escape_string +#define g_regex_get_capture_count _frida_g_regex_get_capture_count +#define g_regex_get_compile_flags _frida_g_regex_get_compile_flags +#define g_regex_get_has_cr_or_lf _frida_g_regex_get_has_cr_or_lf +#define g_regex_get_match_flags _frida_g_regex_get_match_flags +#define g_regex_get_max_backref _frida_g_regex_get_max_backref +#define g_regex_get_max_lookbehind _frida_g_regex_get_max_lookbehind +#define g_regex_get_pattern _frida_g_regex_get_pattern +#define g_regex_get_string_number _frida_g_regex_get_string_number +#define g_regex_get_type _frida_g_regex_get_type +#define g_regex_match _frida_g_regex_match +#define g_regex_match_all _frida_g_regex_match_all +#define g_regex_match_all_full _frida_g_regex_match_all_full +#define g_regex_match_full _frida_g_regex_match_full +#define g_regex_match_simple _frida_g_regex_match_simple +#define g_regex_new _frida_g_regex_new +#define g_regex_ref _frida_g_regex_ref +#define g_regex_replace _frida_g_regex_replace +#define g_regex_replace_eval _frida_g_regex_replace_eval +#define g_regex_replace_literal _frida_g_regex_replace_literal +#define g_regex_split _frida_g_regex_split +#define g_regex_split_full _frida_g_regex_split_full +#define g_regex_split_simple _frida_g_regex_split_simple +#define g_regex_unref _frida_g_regex_unref +#define g_relation_count _frida_g_relation_count +#define g_relation_delete _frida_g_relation_delete +#define g_relation_destroy _frida_g_relation_destroy +#define g_relation_exists _frida_g_relation_exists +#define g_relation_index _frida_g_relation_index +#define g_relation_insert _frida_g_relation_insert +#define g_relation_new _frida_g_relation_new +#define g_relation_print _frida_g_relation_print +#define g_relation_select _frida_g_relation_select +#define g_reload_user_special_dirs_cache _frida_g_reload_user_special_dirs_cache +#define g_remote_action_group_activate_action_full _frida_g_remote_action_group_activate_action_full +#define g_remote_action_group_change_action_state_full _frida_g_remote_action_group_change_action_state_full +#define g_remote_action_group_get_type _frida_g_remote_action_group_get_type +#define g_remove _frida_g_remove +#define g_rename _frida_g_rename +#define g_resolver_error_get_type _frida_g_resolver_error_get_type +#define g_resolver_error_quark _frida_g_resolver_error_quark +#define g_resolver_free_addresses _frida_g_resolver_free_addresses +#define g_resolver_free_targets _frida_g_resolver_free_targets +#define g_resolver_get_default _frida_g_resolver_get_default +#define g_resolver_get_serial _frida_g_resolver_get_serial +#define g_resolver_get_type _frida_g_resolver_get_type +#define g_resolver_lookup_by_address _frida_g_resolver_lookup_by_address +#define g_resolver_lookup_by_address_async _frida_g_resolver_lookup_by_address_async +#define g_resolver_lookup_by_address_finish _frida_g_resolver_lookup_by_address_finish +#define g_resolver_lookup_by_name _frida_g_resolver_lookup_by_name +#define g_resolver_lookup_by_name_async _frida_g_resolver_lookup_by_name_async +#define g_resolver_lookup_by_name_finish _frida_g_resolver_lookup_by_name_finish +#define g_resolver_lookup_by_name_with_flags _frida_g_resolver_lookup_by_name_with_flags +#define g_resolver_lookup_by_name_with_flags_async _frida_g_resolver_lookup_by_name_with_flags_async +#define g_resolver_lookup_by_name_with_flags_finish _frida_g_resolver_lookup_by_name_with_flags_finish +#define g_resolver_lookup_records _frida_g_resolver_lookup_records +#define g_resolver_lookup_records_async _frida_g_resolver_lookup_records_async +#define g_resolver_lookup_records_finish _frida_g_resolver_lookup_records_finish +#define g_resolver_lookup_service _frida_g_resolver_lookup_service +#define g_resolver_lookup_service_async _frida_g_resolver_lookup_service_async +#define g_resolver_lookup_service_finish _frida_g_resolver_lookup_service_finish +#define g_resolver_name_lookup_flags_get_type _frida_g_resolver_name_lookup_flags_get_type +#define g_resolver_record_type_get_type _frida_g_resolver_record_type_get_type +#define g_resolver_set_default _frida_g_resolver_set_default +#define g_resource_enumerate_children _frida_g_resource_enumerate_children +#define g_resource_error_get_type _frida_g_resource_error_get_type +#define g_resource_error_quark _frida_g_resource_error_quark +#define g_resource_file_monitor_get_type _frida_g_resource_file_monitor_get_type +#define g_resource_flags_get_type _frida_g_resource_flags_get_type +#define g_resource_get_info _frida_g_resource_get_info +#define g_resource_get_type _frida_g_resource_get_type +#define g_resource_load _frida_g_resource_load +#define g_resource_lookup_data _frida_g_resource_lookup_data +#define g_resource_lookup_flags_get_type _frida_g_resource_lookup_flags_get_type +#define g_resource_new_from_data _frida_g_resource_new_from_data +#define g_resource_open_stream _frida_g_resource_open_stream +#define g_resource_ref _frida_g_resource_ref +#define g_resource_unref _frida_g_resource_unref +#define g_resources_enumerate_children _frida_g_resources_enumerate_children +#define g_resources_get_info _frida_g_resources_get_info +#define g_resources_lookup_data _frida_g_resources_lookup_data +#define g_resources_open_stream _frida_g_resources_open_stream +#define g_resources_register _frida_g_resources_register +#define g_resources_unregister _frida_g_resources_unregister +#define g_return_if_fail_warning _frida_g_return_if_fail_warning +#define g_rmdir _frida_g_rmdir +#define g_rw_lock_clear _frida_g_rw_lock_clear +#define g_rw_lock_init _frida_g_rw_lock_init +#define g_rw_lock_reader_lock _frida_g_rw_lock_reader_lock +#define g_rw_lock_reader_trylock _frida_g_rw_lock_reader_trylock +#define g_rw_lock_reader_unlock _frida_g_rw_lock_reader_unlock +#define g_rw_lock_writer_lock _frida_g_rw_lock_writer_lock +#define g_rw_lock_writer_trylock _frida_g_rw_lock_writer_trylock +#define g_rw_lock_writer_unlock _frida_g_rw_lock_writer_unlock +#define g_scanner_cur_line _frida_g_scanner_cur_line +#define g_scanner_cur_position _frida_g_scanner_cur_position +#define g_scanner_cur_token _frida_g_scanner_cur_token +#define g_scanner_cur_value _frida_g_scanner_cur_value +#define g_scanner_destroy _frida_g_scanner_destroy +#define g_scanner_eof _frida_g_scanner_eof +#define g_scanner_error _frida_g_scanner_error +#define g_scanner_get_next_token _frida_g_scanner_get_next_token +#define g_scanner_input_file _frida_g_scanner_input_file +#define g_scanner_input_text _frida_g_scanner_input_text +#define g_scanner_lookup_symbol _frida_g_scanner_lookup_symbol +#define g_scanner_new _frida_g_scanner_new +#define g_scanner_peek_next_token _frida_g_scanner_peek_next_token +#define g_scanner_scope_add_symbol _frida_g_scanner_scope_add_symbol +#define g_scanner_scope_foreach_symbol _frida_g_scanner_scope_foreach_symbol +#define g_scanner_scope_lookup_symbol _frida_g_scanner_scope_lookup_symbol +#define g_scanner_scope_remove_symbol _frida_g_scanner_scope_remove_symbol +#define g_scanner_set_scope _frida_g_scanner_set_scope +#define g_scanner_sync_file_offset _frida_g_scanner_sync_file_offset +#define g_scanner_unexp_token _frida_g_scanner_unexp_token +#define g_scanner_warn _frida_g_scanner_warn +#define g_seekable_can_seek _frida_g_seekable_can_seek +#define g_seekable_can_truncate _frida_g_seekable_can_truncate +#define g_seekable_get_type _frida_g_seekable_get_type +#define g_seekable_seek _frida_g_seekable_seek +#define g_seekable_tell _frida_g_seekable_tell +#define g_seekable_truncate _frida_g_seekable_truncate +#define g_sequence_append _frida_g_sequence_append +#define g_sequence_foreach _frida_g_sequence_foreach +#define g_sequence_foreach_range _frida_g_sequence_foreach_range +#define g_sequence_free _frida_g_sequence_free +#define g_sequence_get _frida_g_sequence_get +#define g_sequence_get_begin_iter _frida_g_sequence_get_begin_iter +#define g_sequence_get_end_iter _frida_g_sequence_get_end_iter +#define g_sequence_get_iter_at_pos _frida_g_sequence_get_iter_at_pos +#define g_sequence_get_length _frida_g_sequence_get_length +#define g_sequence_insert_before _frida_g_sequence_insert_before +#define g_sequence_insert_sorted _frida_g_sequence_insert_sorted +#define g_sequence_insert_sorted_iter _frida_g_sequence_insert_sorted_iter +#define g_sequence_is_empty _frida_g_sequence_is_empty +#define g_sequence_iter_compare _frida_g_sequence_iter_compare +#define g_sequence_iter_get_position _frida_g_sequence_iter_get_position +#define g_sequence_iter_get_sequence _frida_g_sequence_iter_get_sequence +#define g_sequence_iter_is_begin _frida_g_sequence_iter_is_begin +#define g_sequence_iter_is_end _frida_g_sequence_iter_is_end +#define g_sequence_iter_move _frida_g_sequence_iter_move +#define g_sequence_iter_next _frida_g_sequence_iter_next +#define g_sequence_iter_prev _frida_g_sequence_iter_prev +#define g_sequence_lookup _frida_g_sequence_lookup +#define g_sequence_lookup_iter _frida_g_sequence_lookup_iter +#define g_sequence_move _frida_g_sequence_move +#define g_sequence_move_range _frida_g_sequence_move_range +#define g_sequence_new _frida_g_sequence_new +#define g_sequence_prepend _frida_g_sequence_prepend +#define g_sequence_range_get_midpoint _frida_g_sequence_range_get_midpoint +#define g_sequence_remove _frida_g_sequence_remove +#define g_sequence_remove_range _frida_g_sequence_remove_range +#define g_sequence_search _frida_g_sequence_search +#define g_sequence_search_iter _frida_g_sequence_search_iter +#define g_sequence_set _frida_g_sequence_set +#define g_sequence_sort _frida_g_sequence_sort +#define g_sequence_sort_changed _frida_g_sequence_sort_changed +#define g_sequence_sort_changed_iter _frida_g_sequence_sort_changed_iter +#define g_sequence_sort_iter _frida_g_sequence_sort_iter +#define g_sequence_swap _frida_g_sequence_swap +#define g_set_application_name _frida_g_set_application_name +#define g_set_error _frida_g_set_error +#define g_set_error_literal _frida_g_set_error_literal +#define g_set_prgname _frida_g_set_prgname +#define g_set_print_handler _frida_g_set_print_handler +#define g_set_printerr_handler _frida_g_set_printerr_handler +#define g_set_user_dirs _frida_g_set_user_dirs +#define g_setenv _frida_g_setenv +#define g_settings_apply _frida_g_settings_apply +#define g_settings_backend_changed _frida_g_settings_backend_changed +#define g_settings_backend_changed_tree _frida_g_settings_backend_changed_tree +#define g_settings_backend_create_tree _frida_g_settings_backend_create_tree +#define g_settings_backend_flatten_tree _frida_g_settings_backend_flatten_tree +#define g_settings_backend_get_default _frida_g_settings_backend_get_default +#define g_settings_backend_get_permission _frida_g_settings_backend_get_permission +#define g_settings_backend_get_type _frida_g_settings_backend_get_type +#define g_settings_backend_get_writable _frida_g_settings_backend_get_writable +#define g_settings_backend_keys_changed _frida_g_settings_backend_keys_changed +#define g_settings_backend_path_changed _frida_g_settings_backend_path_changed +#define g_settings_backend_path_writable_changed _frida_g_settings_backend_path_writable_changed +#define g_settings_backend_read _frida_g_settings_backend_read +#define g_settings_backend_read_user_value _frida_g_settings_backend_read_user_value +#define g_settings_backend_reset _frida_g_settings_backend_reset +#define g_settings_backend_subscribe _frida_g_settings_backend_subscribe +#define g_settings_backend_sync_default _frida_g_settings_backend_sync_default +#define g_settings_backend_unsubscribe _frida_g_settings_backend_unsubscribe +#define g_settings_backend_unwatch _frida_g_settings_backend_unwatch +#define g_settings_backend_watch _frida_g_settings_backend_watch +#define g_settings_backend_writable_changed _frida_g_settings_backend_writable_changed +#define g_settings_backend_write _frida_g_settings_backend_write +#define g_settings_backend_write_tree _frida_g_settings_backend_write_tree +#define g_settings_bind _frida_g_settings_bind +#define g_settings_bind_flags_get_type _frida_g_settings_bind_flags_get_type +#define g_settings_bind_with_mapping _frida_g_settings_bind_with_mapping +#define g_settings_bind_writable _frida_g_settings_bind_writable +#define g_settings_create_action _frida_g_settings_create_action +#define g_settings_delay _frida_g_settings_delay +#define g_settings_get _frida_g_settings_get +#define g_settings_get_boolean _frida_g_settings_get_boolean +#define g_settings_get_child _frida_g_settings_get_child +#define g_settings_get_default_value _frida_g_settings_get_default_value +#define g_settings_get_double _frida_g_settings_get_double +#define g_settings_get_enum _frida_g_settings_get_enum +#define g_settings_get_flags _frida_g_settings_get_flags +#define g_settings_get_has_unapplied _frida_g_settings_get_has_unapplied +#define g_settings_get_int _frida_g_settings_get_int +#define g_settings_get_int64 _frida_g_settings_get_int64 +#define g_settings_get_mapped _frida_g_settings_get_mapped +#define g_settings_get_mapping _frida_g_settings_get_mapping +#define g_settings_get_range _frida_g_settings_get_range +#define g_settings_get_string _frida_g_settings_get_string +#define g_settings_get_strv _frida_g_settings_get_strv +#define g_settings_get_type _frida_g_settings_get_type +#define g_settings_get_uint _frida_g_settings_get_uint +#define g_settings_get_uint64 _frida_g_settings_get_uint64 +#define g_settings_get_user_value _frida_g_settings_get_user_value +#define g_settings_get_value _frida_g_settings_get_value +#define g_settings_is_writable _frida_g_settings_is_writable +#define g_settings_list_children _frida_g_settings_list_children +#define g_settings_list_keys _frida_g_settings_list_keys +#define g_settings_list_relocatable_schemas _frida_g_settings_list_relocatable_schemas +#define g_settings_list_schemas _frida_g_settings_list_schemas +#define g_settings_mapping_is_compatible _frida_g_settings_mapping_is_compatible +#define g_settings_new _frida_g_settings_new +#define g_settings_new_full _frida_g_settings_new_full +#define g_settings_new_with_backend _frida_g_settings_new_with_backend +#define g_settings_new_with_backend_and_path _frida_g_settings_new_with_backend_and_path +#define g_settings_new_with_path _frida_g_settings_new_with_path +#define g_settings_range_check _frida_g_settings_range_check +#define g_settings_reset _frida_g_settings_reset +#define g_settings_revert _frida_g_settings_revert +#define g_settings_schema_get_gettext_domain _frida_g_settings_schema_get_gettext_domain +#define g_settings_schema_get_id _frida_g_settings_schema_get_id +#define g_settings_schema_get_key _frida_g_settings_schema_get_key +#define g_settings_schema_get_path _frida_g_settings_schema_get_path +#define g_settings_schema_get_string _frida_g_settings_schema_get_string +#define g_settings_schema_get_type _frida_g_settings_schema_get_type +#define g_settings_schema_get_value _frida_g_settings_schema_get_value +#define g_settings_schema_has_key _frida_g_settings_schema_has_key +#define g_settings_schema_key_clear _frida_g_settings_schema_key_clear +#define g_settings_schema_key_from_enum _frida_g_settings_schema_key_from_enum +#define g_settings_schema_key_from_flags _frida_g_settings_schema_key_from_flags +#define g_settings_schema_key_get_default_value _frida_g_settings_schema_key_get_default_value +#define g_settings_schema_key_get_description _frida_g_settings_schema_key_get_description +#define g_settings_schema_key_get_name _frida_g_settings_schema_key_get_name +#define g_settings_schema_key_get_per_desktop_default _frida_g_settings_schema_key_get_per_desktop_default +#define g_settings_schema_key_get_range _frida_g_settings_schema_key_get_range +#define g_settings_schema_key_get_summary _frida_g_settings_schema_key_get_summary +#define g_settings_schema_key_get_translated_default _frida_g_settings_schema_key_get_translated_default +#define g_settings_schema_key_get_type _frida_g_settings_schema_key_get_type +#define g_settings_schema_key_get_value_type _frida_g_settings_schema_key_get_value_type +#define g_settings_schema_key_init _frida_g_settings_schema_key_init +#define g_settings_schema_key_range_check _frida_g_settings_schema_key_range_check +#define g_settings_schema_key_range_fixup _frida_g_settings_schema_key_range_fixup +#define g_settings_schema_key_ref _frida_g_settings_schema_key_ref +#define g_settings_schema_key_to_enum _frida_g_settings_schema_key_to_enum +#define g_settings_schema_key_to_flags _frida_g_settings_schema_key_to_flags +#define g_settings_schema_key_type_check _frida_g_settings_schema_key_type_check +#define g_settings_schema_key_unref _frida_g_settings_schema_key_unref +#define g_settings_schema_list _frida_g_settings_schema_list +#define g_settings_schema_list_children _frida_g_settings_schema_list_children +#define g_settings_schema_list_keys _frida_g_settings_schema_list_keys +#define g_settings_schema_ref _frida_g_settings_schema_ref +#define g_settings_schema_source_get_default _frida_g_settings_schema_source_get_default +#define g_settings_schema_source_get_type _frida_g_settings_schema_source_get_type +#define g_settings_schema_source_list_schemas _frida_g_settings_schema_source_list_schemas +#define g_settings_schema_source_lookup _frida_g_settings_schema_source_lookup +#define g_settings_schema_source_new_from_directory _frida_g_settings_schema_source_new_from_directory +#define g_settings_schema_source_ref _frida_g_settings_schema_source_ref +#define g_settings_schema_source_unref _frida_g_settings_schema_source_unref +#define g_settings_schema_unref _frida_g_settings_schema_unref +#define g_settings_set _frida_g_settings_set +#define g_settings_set_boolean _frida_g_settings_set_boolean +#define g_settings_set_double _frida_g_settings_set_double +#define g_settings_set_enum _frida_g_settings_set_enum +#define g_settings_set_flags _frida_g_settings_set_flags +#define g_settings_set_int _frida_g_settings_set_int +#define g_settings_set_int64 _frida_g_settings_set_int64 +#define g_settings_set_mapping _frida_g_settings_set_mapping +#define g_settings_set_string _frida_g_settings_set_string +#define g_settings_set_strv _frida_g_settings_set_strv +#define g_settings_set_uint _frida_g_settings_set_uint +#define g_settings_set_uint64 _frida_g_settings_set_uint64 +#define g_settings_set_value _frida_g_settings_set_value +#define g_settings_sync _frida_g_settings_sync +#define g_settings_unbind _frida_g_settings_unbind +#define g_shell_error_quark _frida_g_shell_error_quark +#define g_shell_parse_argv _frida_g_shell_parse_argv +#define g_shell_quote _frida_g_shell_quote +#define g_shell_unquote _frida_g_shell_unquote +#define g_signal_accumulator_first_wins _frida_g_signal_accumulator_first_wins +#define g_signal_accumulator_true_handled _frida_g_signal_accumulator_true_handled +#define g_signal_add_emission_hook _frida_g_signal_add_emission_hook +#define g_signal_chain_from_overridden _frida_g_signal_chain_from_overridden +#define g_signal_chain_from_overridden_handler _frida_g_signal_chain_from_overridden_handler +#define g_signal_connect_closure _frida_g_signal_connect_closure +#define g_signal_connect_closure_by_id _frida_g_signal_connect_closure_by_id +#define g_signal_connect_data _frida_g_signal_connect_data +#define g_signal_connect_object _frida_g_signal_connect_object +#define g_signal_emit _frida_g_signal_emit +#define g_signal_emit_by_name _frida_g_signal_emit_by_name +#define g_signal_emit_valist _frida_g_signal_emit_valist +#define g_signal_emitv _frida_g_signal_emitv +#define g_signal_get_invocation_hint _frida_g_signal_get_invocation_hint +#define g_signal_handler_block _frida_g_signal_handler_block +#define g_signal_handler_disconnect _frida_g_signal_handler_disconnect +#define g_signal_handler_find _frida_g_signal_handler_find +#define g_signal_handler_is_connected _frida_g_signal_handler_is_connected +#define g_signal_handler_unblock _frida_g_signal_handler_unblock +#define g_signal_handlers_block_matched _frida_g_signal_handlers_block_matched +#define g_signal_handlers_destroy _frida_g_signal_handlers_destroy +#define g_signal_handlers_disconnect_matched _frida_g_signal_handlers_disconnect_matched +#define g_signal_handlers_unblock_matched _frida_g_signal_handlers_unblock_matched +#define g_signal_has_handler_pending _frida_g_signal_has_handler_pending +#define g_signal_is_valid_name _frida_g_signal_is_valid_name +#define g_signal_list_ids _frida_g_signal_list_ids +#define g_signal_lookup _frida_g_signal_lookup +#define g_signal_name _frida_g_signal_name +#define g_signal_new _frida_g_signal_new +#define g_signal_new_class_handler _frida_g_signal_new_class_handler +#define g_signal_new_valist _frida_g_signal_new_valist +#define g_signal_newv _frida_g_signal_newv +#define g_signal_override_class_closure _frida_g_signal_override_class_closure +#define g_signal_override_class_handler _frida_g_signal_override_class_handler +#define g_signal_parse_name _frida_g_signal_parse_name +#define g_signal_query _frida_g_signal_query +#define g_signal_remove_emission_hook _frida_g_signal_remove_emission_hook +#define g_signal_set_va_marshaller _frida_g_signal_set_va_marshaller +#define g_signal_stop_emission _frida_g_signal_stop_emission +#define g_signal_stop_emission_by_name _frida_g_signal_stop_emission_by_name +#define g_signal_type_cclosure_new _frida_g_signal_type_cclosure_new +#define g_simple_action_get_type _frida_g_simple_action_get_type +#define g_simple_action_group_add_entries _frida_g_simple_action_group_add_entries +#define g_simple_action_group_get_type _frida_g_simple_action_group_get_type +#define g_simple_action_group_insert _frida_g_simple_action_group_insert +#define g_simple_action_group_lookup _frida_g_simple_action_group_lookup +#define g_simple_action_group_new _frida_g_simple_action_group_new +#define g_simple_action_group_remove _frida_g_simple_action_group_remove +#define g_simple_action_new _frida_g_simple_action_new +#define g_simple_action_new_stateful _frida_g_simple_action_new_stateful +#define g_simple_action_set_enabled _frida_g_simple_action_set_enabled +#define g_simple_action_set_state _frida_g_simple_action_set_state +#define g_simple_action_set_state_hint _frida_g_simple_action_set_state_hint +#define g_simple_async_report_error_in_idle _frida_g_simple_async_report_error_in_idle +#define g_simple_async_report_gerror_in_idle _frida_g_simple_async_report_gerror_in_idle +#define g_simple_async_report_take_gerror_in_idle _frida_g_simple_async_report_take_gerror_in_idle +#define g_simple_async_result_complete _frida_g_simple_async_result_complete +#define g_simple_async_result_complete_in_idle _frida_g_simple_async_result_complete_in_idle +#define g_simple_async_result_get_op_res_gboolean _frida_g_simple_async_result_get_op_res_gboolean +#define g_simple_async_result_get_op_res_gpointer _frida_g_simple_async_result_get_op_res_gpointer +#define g_simple_async_result_get_op_res_gssize _frida_g_simple_async_result_get_op_res_gssize +#define g_simple_async_result_get_source_tag _frida_g_simple_async_result_get_source_tag +#define g_simple_async_result_get_type _frida_g_simple_async_result_get_type +#define g_simple_async_result_is_valid _frida_g_simple_async_result_is_valid +#define g_simple_async_result_new _frida_g_simple_async_result_new +#define g_simple_async_result_new_error _frida_g_simple_async_result_new_error +#define g_simple_async_result_new_from_error _frida_g_simple_async_result_new_from_error +#define g_simple_async_result_new_take_error _frida_g_simple_async_result_new_take_error +#define g_simple_async_result_propagate_error _frida_g_simple_async_result_propagate_error +#define g_simple_async_result_run_in_thread _frida_g_simple_async_result_run_in_thread +#define g_simple_async_result_set_check_cancellable _frida_g_simple_async_result_set_check_cancellable +#define g_simple_async_result_set_error _frida_g_simple_async_result_set_error +#define g_simple_async_result_set_error_va _frida_g_simple_async_result_set_error_va +#define g_simple_async_result_set_from_error _frida_g_simple_async_result_set_from_error +#define g_simple_async_result_set_handle_cancellation _frida_g_simple_async_result_set_handle_cancellation +#define g_simple_async_result_set_op_res_gboolean _frida_g_simple_async_result_set_op_res_gboolean +#define g_simple_async_result_set_op_res_gpointer _frida_g_simple_async_result_set_op_res_gpointer +#define g_simple_async_result_set_op_res_gssize _frida_g_simple_async_result_set_op_res_gssize +#define g_simple_async_result_take_error _frida_g_simple_async_result_take_error +#define g_simple_io_stream_get_type _frida_g_simple_io_stream_get_type +#define g_simple_io_stream_new _frida_g_simple_io_stream_new +#define g_simple_permission_get_type _frida_g_simple_permission_get_type +#define g_simple_permission_new _frida_g_simple_permission_new +#define g_simple_proxy_resolver_get_type _frida_g_simple_proxy_resolver_get_type +#define g_simple_proxy_resolver_new _frida_g_simple_proxy_resolver_new +#define g_simple_proxy_resolver_set_default_proxy _frida_g_simple_proxy_resolver_set_default_proxy +#define g_simple_proxy_resolver_set_ignore_hosts _frida_g_simple_proxy_resolver_set_ignore_hosts +#define g_simple_proxy_resolver_set_uri_proxy _frida_g_simple_proxy_resolver_set_uri_proxy +#define g_slice_alloc _frida_g_slice_alloc +#define g_slice_alloc0 _frida_g_slice_alloc0 +#define g_slice_copy _frida_g_slice_copy +#define g_slice_free1 _frida_g_slice_free1 +#define g_slice_free_chain_with_offset _frida_g_slice_free_chain_with_offset +#define g_slice_get_config _frida_g_slice_get_config +#define g_slice_get_config_state _frida_g_slice_get_config_state +#define g_slice_set_config _frida_g_slice_set_config +#define g_slist_alloc _frida_g_slist_alloc +#define g_slist_append _frida_g_slist_append +#define g_slist_concat _frida_g_slist_concat +#define g_slist_copy _frida_g_slist_copy +#define g_slist_copy_deep _frida_g_slist_copy_deep +#define g_slist_delete_link _frida_g_slist_delete_link +#define g_slist_find _frida_g_slist_find +#define g_slist_find_custom _frida_g_slist_find_custom +#define g_slist_foreach _frida_g_slist_foreach +#define g_slist_free _frida_g_slist_free +#define g_slist_free_1 _frida_g_slist_free_1 +#define g_slist_free_full _frida_g_slist_free_full +#define g_slist_index _frida_g_slist_index +#define g_slist_insert _frida_g_slist_insert +#define g_slist_insert_before _frida_g_slist_insert_before +#define g_slist_insert_sorted _frida_g_slist_insert_sorted +#define g_slist_insert_sorted_with_data _frida_g_slist_insert_sorted_with_data +#define g_slist_last _frida_g_slist_last +#define g_slist_length _frida_g_slist_length +#define g_slist_nth _frida_g_slist_nth +#define g_slist_nth_data _frida_g_slist_nth_data +#define g_slist_pop_allocator _frida_g_slist_pop_allocator +#define g_slist_position _frida_g_slist_position +#define g_slist_prepend _frida_g_slist_prepend +#define g_slist_push_allocator _frida_g_slist_push_allocator +#define g_slist_remove _frida_g_slist_remove +#define g_slist_remove_all _frida_g_slist_remove_all +#define g_slist_remove_link _frida_g_slist_remove_link +#define g_slist_reverse _frida_g_slist_reverse +#define g_slist_sort _frida_g_slist_sort +#define g_slist_sort_with_data _frida_g_slist_sort_with_data +#define g_snprintf _frida_g_snprintf +#define g_socket _frida_g_socket +#define g_socket_accept _frida_g_socket_accept +#define g_socket_address_enumerator_get_type _frida_g_socket_address_enumerator_get_type +#define g_socket_address_enumerator_next _frida_g_socket_address_enumerator_next +#define g_socket_address_enumerator_next_async _frida_g_socket_address_enumerator_next_async +#define g_socket_address_enumerator_next_finish _frida_g_socket_address_enumerator_next_finish +#define g_socket_address_get_family _frida_g_socket_address_get_family +#define g_socket_address_get_native_size _frida_g_socket_address_get_native_size +#define g_socket_address_get_type _frida_g_socket_address_get_type +#define g_socket_address_new_from_native _frida_g_socket_address_new_from_native +#define g_socket_address_to_native _frida_g_socket_address_to_native +#define g_socket_bind _frida_g_socket_bind +#define g_socket_check_connect_result _frida_g_socket_check_connect_result +#define g_socket_client_add_application_proxy _frida_g_socket_client_add_application_proxy +#define g_socket_client_connect _frida_g_socket_client_connect +#define g_socket_client_connect_async _frida_g_socket_client_connect_async +#define g_socket_client_connect_finish _frida_g_socket_client_connect_finish +#define g_socket_client_connect_to_host _frida_g_socket_client_connect_to_host +#define g_socket_client_connect_to_host_async _frida_g_socket_client_connect_to_host_async +#define g_socket_client_connect_to_host_finish _frida_g_socket_client_connect_to_host_finish +#define g_socket_client_connect_to_service _frida_g_socket_client_connect_to_service +#define g_socket_client_connect_to_service_async _frida_g_socket_client_connect_to_service_async +#define g_socket_client_connect_to_service_finish _frida_g_socket_client_connect_to_service_finish +#define g_socket_client_connect_to_uri _frida_g_socket_client_connect_to_uri +#define g_socket_client_connect_to_uri_async _frida_g_socket_client_connect_to_uri_async +#define g_socket_client_connect_to_uri_finish _frida_g_socket_client_connect_to_uri_finish +#define g_socket_client_event_get_type _frida_g_socket_client_event_get_type +#define g_socket_client_get_enable_proxy _frida_g_socket_client_get_enable_proxy +#define g_socket_client_get_family _frida_g_socket_client_get_family +#define g_socket_client_get_local_address _frida_g_socket_client_get_local_address +#define g_socket_client_get_protocol _frida_g_socket_client_get_protocol +#define g_socket_client_get_proxy_resolver _frida_g_socket_client_get_proxy_resolver +#define g_socket_client_get_socket_type _frida_g_socket_client_get_socket_type +#define g_socket_client_get_timeout _frida_g_socket_client_get_timeout +#define g_socket_client_get_tls _frida_g_socket_client_get_tls +#define g_socket_client_get_tls_validation_flags _frida_g_socket_client_get_tls_validation_flags +#define g_socket_client_get_type _frida_g_socket_client_get_type +#define g_socket_client_new _frida_g_socket_client_new +#define g_socket_client_set_enable_proxy _frida_g_socket_client_set_enable_proxy +#define g_socket_client_set_family _frida_g_socket_client_set_family +#define g_socket_client_set_local_address _frida_g_socket_client_set_local_address +#define g_socket_client_set_protocol _frida_g_socket_client_set_protocol +#define g_socket_client_set_proxy_resolver _frida_g_socket_client_set_proxy_resolver +#define g_socket_client_set_socket_type _frida_g_socket_client_set_socket_type +#define g_socket_client_set_timeout _frida_g_socket_client_set_timeout +#define g_socket_client_set_tls _frida_g_socket_client_set_tls +#define g_socket_client_set_tls_validation_flags _frida_g_socket_client_set_tls_validation_flags +#define g_socket_close _frida_g_socket_close +#define g_socket_condition_check _frida_g_socket_condition_check +#define g_socket_condition_timed_wait _frida_g_socket_condition_timed_wait +#define g_socket_condition_wait _frida_g_socket_condition_wait +#define g_socket_connect _frida_g_socket_connect +#define g_socket_connectable_enumerate _frida_g_socket_connectable_enumerate +#define g_socket_connectable_get_type _frida_g_socket_connectable_get_type +#define g_socket_connectable_proxy_enumerate _frida_g_socket_connectable_proxy_enumerate +#define g_socket_connectable_to_string _frida_g_socket_connectable_to_string +#define g_socket_connection_connect _frida_g_socket_connection_connect +#define g_socket_connection_connect_async _frida_g_socket_connection_connect_async +#define g_socket_connection_connect_finish _frida_g_socket_connection_connect_finish +#define g_socket_connection_factory_create_connection _frida_g_socket_connection_factory_create_connection +#define g_socket_connection_factory_lookup_type _frida_g_socket_connection_factory_lookup_type +#define g_socket_connection_factory_register_type _frida_g_socket_connection_factory_register_type +#define g_socket_connection_get_local_address _frida_g_socket_connection_get_local_address +#define g_socket_connection_get_remote_address _frida_g_socket_connection_get_remote_address +#define g_socket_connection_get_socket _frida_g_socket_connection_get_socket +#define g_socket_connection_get_type _frida_g_socket_connection_get_type +#define g_socket_connection_is_connected _frida_g_socket_connection_is_connected +#define g_socket_connection_set_cached_remote_address _frida_g_socket_connection_set_cached_remote_address +#define g_socket_control_message_deserialize _frida_g_socket_control_message_deserialize +#define g_socket_control_message_get_level _frida_g_socket_control_message_get_level +#define g_socket_control_message_get_msg_type _frida_g_socket_control_message_get_msg_type +#define g_socket_control_message_get_size _frida_g_socket_control_message_get_size +#define g_socket_control_message_get_type _frida_g_socket_control_message_get_type +#define g_socket_control_message_serialize _frida_g_socket_control_message_serialize +#define g_socket_create_source _frida_g_socket_create_source +#define g_socket_family_get_type _frida_g_socket_family_get_type +#define g_socket_get_available_bytes _frida_g_socket_get_available_bytes +#define g_socket_get_blocking _frida_g_socket_get_blocking +#define g_socket_get_broadcast _frida_g_socket_get_broadcast +#define g_socket_get_credentials _frida_g_socket_get_credentials +#define g_socket_get_family _frida_g_socket_get_family +#define g_socket_get_fd _frida_g_socket_get_fd +#define g_socket_get_keepalive _frida_g_socket_get_keepalive +#define g_socket_get_listen_backlog _frida_g_socket_get_listen_backlog +#define g_socket_get_local_address _frida_g_socket_get_local_address +#define g_socket_get_multicast_loopback _frida_g_socket_get_multicast_loopback +#define g_socket_get_multicast_ttl _frida_g_socket_get_multicast_ttl +#define g_socket_get_option _frida_g_socket_get_option +#define g_socket_get_protocol _frida_g_socket_get_protocol +#define g_socket_get_remote_address _frida_g_socket_get_remote_address +#define g_socket_get_socket_type _frida_g_socket_get_socket_type +#define g_socket_get_timeout _frida_g_socket_get_timeout +#define g_socket_get_ttl _frida_g_socket_get_ttl +#define g_socket_get_type _frida_g_socket_get_type +#define g_socket_is_closed _frida_g_socket_is_closed +#define g_socket_is_connected _frida_g_socket_is_connected +#define g_socket_join_multicast_group _frida_g_socket_join_multicast_group +#define g_socket_join_multicast_group_ssm _frida_g_socket_join_multicast_group_ssm +#define g_socket_leave_multicast_group _frida_g_socket_leave_multicast_group +#define g_socket_leave_multicast_group_ssm _frida_g_socket_leave_multicast_group_ssm +#define g_socket_listen _frida_g_socket_listen +#define g_socket_listener_accept _frida_g_socket_listener_accept +#define g_socket_listener_accept_async _frida_g_socket_listener_accept_async +#define g_socket_listener_accept_finish _frida_g_socket_listener_accept_finish +#define g_socket_listener_accept_socket _frida_g_socket_listener_accept_socket +#define g_socket_listener_accept_socket_async _frida_g_socket_listener_accept_socket_async +#define g_socket_listener_accept_socket_finish _frida_g_socket_listener_accept_socket_finish +#define g_socket_listener_add_address _frida_g_socket_listener_add_address +#define g_socket_listener_add_any_inet_port _frida_g_socket_listener_add_any_inet_port +#define g_socket_listener_add_inet_port _frida_g_socket_listener_add_inet_port +#define g_socket_listener_add_socket _frida_g_socket_listener_add_socket +#define g_socket_listener_close _frida_g_socket_listener_close +#define g_socket_listener_event_get_type _frida_g_socket_listener_event_get_type +#define g_socket_listener_get_type _frida_g_socket_listener_get_type +#define g_socket_listener_new _frida_g_socket_listener_new +#define g_socket_listener_set_backlog _frida_g_socket_listener_set_backlog +#define g_socket_msg_flags_get_type _frida_g_socket_msg_flags_get_type +#define g_socket_new _frida_g_socket_new +#define g_socket_new_from_fd _frida_g_socket_new_from_fd +#define g_socket_protocol_get_type _frida_g_socket_protocol_get_type +#define g_socket_receive _frida_g_socket_receive +#define g_socket_receive_from _frida_g_socket_receive_from +#define g_socket_receive_message _frida_g_socket_receive_message +#define g_socket_receive_messages _frida_g_socket_receive_messages +#define g_socket_receive_with_blocking _frida_g_socket_receive_with_blocking +#define g_socket_send _frida_g_socket_send +#define g_socket_send_message _frida_g_socket_send_message +#define g_socket_send_message_with_timeout _frida_g_socket_send_message_with_timeout +#define g_socket_send_messages _frida_g_socket_send_messages +#define g_socket_send_to _frida_g_socket_send_to +#define g_socket_send_with_blocking _frida_g_socket_send_with_blocking +#define g_socket_service_get_type _frida_g_socket_service_get_type +#define g_socket_service_is_active _frida_g_socket_service_is_active +#define g_socket_service_new _frida_g_socket_service_new +#define g_socket_service_start _frida_g_socket_service_start +#define g_socket_service_stop _frida_g_socket_service_stop +#define g_socket_set_blocking _frida_g_socket_set_blocking +#define g_socket_set_broadcast _frida_g_socket_set_broadcast +#define g_socket_set_keepalive _frida_g_socket_set_keepalive +#define g_socket_set_listen_backlog _frida_g_socket_set_listen_backlog +#define g_socket_set_multicast_loopback _frida_g_socket_set_multicast_loopback +#define g_socket_set_multicast_ttl _frida_g_socket_set_multicast_ttl +#define g_socket_set_option _frida_g_socket_set_option +#define g_socket_set_timeout _frida_g_socket_set_timeout +#define g_socket_set_ttl _frida_g_socket_set_ttl +#define g_socket_shutdown _frida_g_socket_shutdown +#define g_socket_speaks_ipv4 _frida_g_socket_speaks_ipv4 +#define g_socket_type_get_type _frida_g_socket_type_get_type +#define g_source_add_child_source _frida_g_source_add_child_source +#define g_source_add_poll _frida_g_source_add_poll +#define g_source_add_unix_fd _frida_g_source_add_unix_fd +#define g_source_attach _frida_g_source_attach +#define g_source_destroy _frida_g_source_destroy +#define g_source_get_can_recurse _frida_g_source_get_can_recurse +#define g_source_get_context _frida_g_source_get_context +#define g_source_get_current_time _frida_g_source_get_current_time +#define g_source_get_id _frida_g_source_get_id +#define g_source_get_name _frida_g_source_get_name +#define g_source_get_priority _frida_g_source_get_priority +#define g_source_get_ready_time _frida_g_source_get_ready_time +#define g_source_get_time _frida_g_source_get_time +#define g_source_get_type _frida_g_source_get_type +#define g_source_is_destroyed _frida_g_source_is_destroyed +#define g_source_modify_unix_fd _frida_g_source_modify_unix_fd +#define g_source_new _frida_g_source_new +#define g_source_query_unix_fd _frida_g_source_query_unix_fd +#define g_source_ref _frida_g_source_ref +#define g_source_remove _frida_g_source_remove +#define g_source_remove_by_funcs_user_data _frida_g_source_remove_by_funcs_user_data +#define g_source_remove_by_user_data _frida_g_source_remove_by_user_data +#define g_source_remove_child_source _frida_g_source_remove_child_source +#define g_source_remove_poll _frida_g_source_remove_poll +#define g_source_remove_unix_fd _frida_g_source_remove_unix_fd +#define g_source_set_callback _frida_g_source_set_callback +#define g_source_set_callback_indirect _frida_g_source_set_callback_indirect +#define g_source_set_can_recurse _frida_g_source_set_can_recurse +#define g_source_set_closure _frida_g_source_set_closure +#define g_source_set_dispose_function _frida_g_source_set_dispose_function +#define g_source_set_dummy_callback _frida_g_source_set_dummy_callback +#define g_source_set_funcs _frida_g_source_set_funcs +#define g_source_set_name _frida_g_source_set_name +#define g_source_set_name_by_id _frida_g_source_set_name_by_id +#define g_source_set_priority _frida_g_source_set_priority +#define g_source_set_ready_time _frida_g_source_set_ready_time +#define g_source_unref _frida_g_source_unref +#define g_spaced_primes_closest _frida_g_spaced_primes_closest +#define g_spawn_async _frida_g_spawn_async +#define g_spawn_async_with_fds _frida_g_spawn_async_with_fds +#define g_spawn_async_with_pipes _frida_g_spawn_async_with_pipes +#define g_spawn_check_exit_status _frida_g_spawn_check_exit_status +#define g_spawn_close_pid _frida_g_spawn_close_pid +#define g_spawn_command_line_async _frida_g_spawn_command_line_async +#define g_spawn_command_line_sync _frida_g_spawn_command_line_sync +#define g_spawn_error_quark _frida_g_spawn_error_quark +#define g_spawn_exit_error_quark _frida_g_spawn_exit_error_quark +#define g_spawn_sync _frida_g_spawn_sync +#define g_sprintf _frida_g_sprintf +#define g_srv_target_copy _frida_g_srv_target_copy +#define g_srv_target_free _frida_g_srv_target_free +#define g_srv_target_get_hostname _frida_g_srv_target_get_hostname +#define g_srv_target_get_port _frida_g_srv_target_get_port +#define g_srv_target_get_priority _frida_g_srv_target_get_priority +#define g_srv_target_get_type _frida_g_srv_target_get_type +#define g_srv_target_get_weight _frida_g_srv_target_get_weight +#define g_srv_target_list_sort _frida_g_srv_target_list_sort +#define g_srv_target_new _frida_g_srv_target_new +#define g_stat _frida_g_stat +#define g_static_mutex_free _frida_g_static_mutex_free +#define g_static_mutex_get_mutex_impl _frida_g_static_mutex_get_mutex_impl +#define g_static_mutex_init _frida_g_static_mutex_init +#define g_static_private_free _frida_g_static_private_free +#define g_static_private_get _frida_g_static_private_get +#define g_static_private_init _frida_g_static_private_init +#define g_static_private_set _frida_g_static_private_set +#define g_static_rec_mutex_free _frida_g_static_rec_mutex_free +#define g_static_rec_mutex_init _frida_g_static_rec_mutex_init +#define g_static_rec_mutex_lock _frida_g_static_rec_mutex_lock +#define g_static_rec_mutex_lock_full _frida_g_static_rec_mutex_lock_full +#define g_static_rec_mutex_trylock _frida_g_static_rec_mutex_trylock +#define g_static_rec_mutex_unlock _frida_g_static_rec_mutex_unlock +#define g_static_rec_mutex_unlock_full _frida_g_static_rec_mutex_unlock_full +#define g_static_resource_fini _frida_g_static_resource_fini +#define g_static_resource_get_resource _frida_g_static_resource_get_resource +#define g_static_resource_init _frida_g_static_resource_init +#define g_static_rw_lock_free _frida_g_static_rw_lock_free +#define g_static_rw_lock_init _frida_g_static_rw_lock_init +#define g_static_rw_lock_reader_lock _frida_g_static_rw_lock_reader_lock +#define g_static_rw_lock_reader_trylock _frida_g_static_rw_lock_reader_trylock +#define g_static_rw_lock_reader_unlock _frida_g_static_rw_lock_reader_unlock +#define g_static_rw_lock_writer_lock _frida_g_static_rw_lock_writer_lock +#define g_static_rw_lock_writer_trylock _frida_g_static_rw_lock_writer_trylock +#define g_static_rw_lock_writer_unlock _frida_g_static_rw_lock_writer_unlock +#define g_stpcpy _frida_g_stpcpy +#define g_str_equal _frida_g_str_equal +#define g_str_has_prefix _frida_g_str_has_prefix +#define g_str_has_suffix _frida_g_str_has_suffix +#define g_str_hash _frida_g_str_hash +#define g_str_is_ascii _frida_g_str_is_ascii +#define g_str_match_string _frida_g_str_match_string +#define g_str_to_ascii _frida_g_str_to_ascii +#define g_str_tokenize_and_fold _frida_g_str_tokenize_and_fold +#define g_strcanon _frida_g_strcanon +#define g_strcasecmp _frida_g_strcasecmp +#define g_strchomp _frida_g_strchomp +#define g_strchug _frida_g_strchug +#define g_strcmp0 _frida_g_strcmp0 +#define g_strcompress _frida_g_strcompress +#define g_strconcat _frida_g_strconcat +#define g_strdelimit _frida_g_strdelimit +#define g_strdown _frida_g_strdown +#define g_strdup _frida_g_strdup +#define g_strdup_printf _frida_g_strdup_printf +#define g_strdup_value_contents _frida_g_strdup_value_contents +#define g_strdup_vprintf _frida_g_strdup_vprintf +#define g_strdupv _frida_g_strdupv +#define g_strerror _frida_g_strerror +#define g_strescape _frida_g_strescape +#define g_strfreev _frida_g_strfreev +#define g_string_append _frida_g_string_append +#define g_string_append_c _frida_g_string_append_c +#define g_string_append_len _frida_g_string_append_len +#define g_string_append_printf _frida_g_string_append_printf +#define g_string_append_unichar _frida_g_string_append_unichar +#define g_string_append_uri_escaped _frida_g_string_append_uri_escaped +#define g_string_append_vprintf _frida_g_string_append_vprintf +#define g_string_ascii_down _frida_g_string_ascii_down +#define g_string_ascii_up _frida_g_string_ascii_up +#define g_string_assign _frida_g_string_assign +#define g_string_chunk_clear _frida_g_string_chunk_clear +#define g_string_chunk_free _frida_g_string_chunk_free +#define g_string_chunk_insert _frida_g_string_chunk_insert +#define g_string_chunk_insert_const _frida_g_string_chunk_insert_const +#define g_string_chunk_insert_len _frida_g_string_chunk_insert_len +#define g_string_chunk_new _frida_g_string_chunk_new +#define g_string_down _frida_g_string_down +#define g_string_equal _frida_g_string_equal +#define g_string_erase _frida_g_string_erase +#define g_string_free _frida_g_string_free +#define g_string_free_to_bytes _frida_g_string_free_to_bytes +#define g_string_hash _frida_g_string_hash +#define g_string_insert _frida_g_string_insert +#define g_string_insert_c _frida_g_string_insert_c +#define g_string_insert_len _frida_g_string_insert_len +#define g_string_insert_unichar _frida_g_string_insert_unichar +#define g_string_new _frida_g_string_new +#define g_string_new_len _frida_g_string_new_len +#define g_string_overwrite _frida_g_string_overwrite +#define g_string_overwrite_len _frida_g_string_overwrite_len +#define g_string_prepend _frida_g_string_prepend +#define g_string_prepend_c _frida_g_string_prepend_c +#define g_string_prepend_len _frida_g_string_prepend_len +#define g_string_prepend_unichar _frida_g_string_prepend_unichar +#define g_string_printf _frida_g_string_printf +#define g_string_set_size _frida_g_string_set_size +#define g_string_sized_new _frida_g_string_sized_new +#define g_string_truncate _frida_g_string_truncate +#define g_string_up _frida_g_string_up +#define g_string_vprintf _frida_g_string_vprintf +#define g_strip_context _frida_g_strip_context +#define g_strjoin _frida_g_strjoin +#define g_strjoinv _frida_g_strjoinv +#define g_strlcat _frida_g_strlcat +#define g_strlcpy _frida_g_strlcpy +#define g_strncasecmp _frida_g_strncasecmp +#define g_strndup _frida_g_strndup +#define g_strnfill _frida_g_strnfill +#define g_strreverse _frida_g_strreverse +#define g_strrstr _frida_g_strrstr +#define g_strrstr_len _frida_g_strrstr_len +#define g_strsignal _frida_g_strsignal +#define g_strsplit _frida_g_strsplit +#define g_strsplit_set _frida_g_strsplit_set +#define g_strstr_len _frida_g_strstr_len +#define g_strtod _frida_g_strtod +#define g_strup _frida_g_strup +#define g_strv_builder_add _frida_g_strv_builder_add +#define g_strv_builder_end _frida_g_strv_builder_end +#define g_strv_builder_new _frida_g_strv_builder_new +#define g_strv_builder_ref _frida_g_strv_builder_ref +#define g_strv_builder_unref _frida_g_strv_builder_unref +#define g_strv_contains _frida_g_strv_contains +#define g_strv_equal _frida_g_strv_equal +#define g_strv_get_type _frida_g_strv_get_type +#define g_strv_length _frida_g_strv_length +#define g_subprocess_communicate _frida_g_subprocess_communicate +#define g_subprocess_communicate_async _frida_g_subprocess_communicate_async +#define g_subprocess_communicate_finish _frida_g_subprocess_communicate_finish +#define g_subprocess_communicate_utf8 _frida_g_subprocess_communicate_utf8 +#define g_subprocess_communicate_utf8_async _frida_g_subprocess_communicate_utf8_async +#define g_subprocess_communicate_utf8_finish _frida_g_subprocess_communicate_utf8_finish +#define g_subprocess_flags_get_type _frida_g_subprocess_flags_get_type +#define g_subprocess_force_exit _frida_g_subprocess_force_exit +#define g_subprocess_get_exit_status _frida_g_subprocess_get_exit_status +#define g_subprocess_get_identifier _frida_g_subprocess_get_identifier +#define g_subprocess_get_if_exited _frida_g_subprocess_get_if_exited +#define g_subprocess_get_if_signaled _frida_g_subprocess_get_if_signaled +#define g_subprocess_get_status _frida_g_subprocess_get_status +#define g_subprocess_get_stderr_pipe _frida_g_subprocess_get_stderr_pipe +#define g_subprocess_get_stdin_pipe _frida_g_subprocess_get_stdin_pipe +#define g_subprocess_get_stdout_pipe _frida_g_subprocess_get_stdout_pipe +#define g_subprocess_get_successful _frida_g_subprocess_get_successful +#define g_subprocess_get_term_sig _frida_g_subprocess_get_term_sig +#define g_subprocess_get_type _frida_g_subprocess_get_type +#define g_subprocess_launcher_close _frida_g_subprocess_launcher_close +#define g_subprocess_launcher_get_type _frida_g_subprocess_launcher_get_type +#define g_subprocess_launcher_getenv _frida_g_subprocess_launcher_getenv +#define g_subprocess_launcher_new _frida_g_subprocess_launcher_new +#define g_subprocess_launcher_set_child_setup _frida_g_subprocess_launcher_set_child_setup +#define g_subprocess_launcher_set_cwd _frida_g_subprocess_launcher_set_cwd +#define g_subprocess_launcher_set_environ _frida_g_subprocess_launcher_set_environ +#define g_subprocess_launcher_set_flags _frida_g_subprocess_launcher_set_flags +#define g_subprocess_launcher_set_stderr_file_path _frida_g_subprocess_launcher_set_stderr_file_path +#define g_subprocess_launcher_set_stdin_file_path _frida_g_subprocess_launcher_set_stdin_file_path +#define g_subprocess_launcher_set_stdout_file_path _frida_g_subprocess_launcher_set_stdout_file_path +#define g_subprocess_launcher_setenv _frida_g_subprocess_launcher_setenv +#define g_subprocess_launcher_spawn _frida_g_subprocess_launcher_spawn +#define g_subprocess_launcher_spawnv _frida_g_subprocess_launcher_spawnv +#define g_subprocess_launcher_take_fd _frida_g_subprocess_launcher_take_fd +#define g_subprocess_launcher_take_stderr_fd _frida_g_subprocess_launcher_take_stderr_fd +#define g_subprocess_launcher_take_stdin_fd _frida_g_subprocess_launcher_take_stdin_fd +#define g_subprocess_launcher_take_stdout_fd _frida_g_subprocess_launcher_take_stdout_fd +#define g_subprocess_launcher_unsetenv _frida_g_subprocess_launcher_unsetenv +#define g_subprocess_new _frida_g_subprocess_new +#define g_subprocess_newv _frida_g_subprocess_newv +#define g_subprocess_send_signal _frida_g_subprocess_send_signal +#define g_subprocess_set_launcher _frida_g_subprocess_set_launcher +#define g_subprocess_wait _frida_g_subprocess_wait +#define g_subprocess_wait_async _frida_g_subprocess_wait_async +#define g_subprocess_wait_check _frida_g_subprocess_wait_check +#define g_subprocess_wait_check_async _frida_g_subprocess_wait_check_async +#define g_subprocess_wait_check_finish _frida_g_subprocess_wait_check_finish +#define g_subprocess_wait_finish _frida_g_subprocess_wait_finish +#define g_system_thread_exit _frida_g_system_thread_exit +#define g_system_thread_free _frida_g_system_thread_free +#define g_system_thread_get_scheduler_settings _frida_g_system_thread_get_scheduler_settings +#define g_system_thread_new _frida_g_system_thread_new +#define g_system_thread_set_name _frida_g_system_thread_set_name +#define g_system_thread_wait _frida_g_system_thread_wait +#define g_task_attach_source _frida_g_task_attach_source +#define g_task_get_cancellable _frida_g_task_get_cancellable +#define g_task_get_check_cancellable _frida_g_task_get_check_cancellable +#define g_task_get_completed _frida_g_task_get_completed +#define g_task_get_context _frida_g_task_get_context +#define g_task_get_name _frida_g_task_get_name +#define g_task_get_priority _frida_g_task_get_priority +#define g_task_get_return_on_cancel _frida_g_task_get_return_on_cancel +#define g_task_get_source_object _frida_g_task_get_source_object +#define g_task_get_source_tag _frida_g_task_get_source_tag +#define g_task_get_task_data _frida_g_task_get_task_data +#define g_task_get_type _frida_g_task_get_type +#define g_task_had_error _frida_g_task_had_error +#define g_task_is_valid _frida_g_task_is_valid +#define g_task_new _frida_g_task_new +#define g_task_propagate_boolean _frida_g_task_propagate_boolean +#define g_task_propagate_int _frida_g_task_propagate_int +#define g_task_propagate_pointer _frida_g_task_propagate_pointer +#define g_task_propagate_value _frida_g_task_propagate_value +#define g_task_report_error _frida_g_task_report_error +#define g_task_report_new_error _frida_g_task_report_new_error +#define g_task_return_boolean _frida_g_task_return_boolean +#define g_task_return_error _frida_g_task_return_error +#define g_task_return_error_if_cancelled _frida_g_task_return_error_if_cancelled +#define g_task_return_int _frida_g_task_return_int +#define g_task_return_new_error _frida_g_task_return_new_error +#define g_task_return_pointer _frida_g_task_return_pointer +#define g_task_return_value _frida_g_task_return_value +#define g_task_run_in_thread _frida_g_task_run_in_thread +#define g_task_run_in_thread_sync _frida_g_task_run_in_thread_sync +#define g_task_set_check_cancellable _frida_g_task_set_check_cancellable +#define g_task_set_name _frida_g_task_set_name +#define g_task_set_priority _frida_g_task_set_priority +#define g_task_set_return_on_cancel _frida_g_task_set_return_on_cancel +#define g_task_set_source_tag _frida_g_task_set_source_tag +#define g_task_set_task_data _frida_g_task_set_task_data +#define g_tcp_connection_get_graceful_disconnect _frida_g_tcp_connection_get_graceful_disconnect +#define g_tcp_connection_get_type _frida_g_tcp_connection_get_type +#define g_tcp_connection_set_graceful_disconnect _frida_g_tcp_connection_set_graceful_disconnect +#define g_tcp_wrapper_connection_get_base_io_stream _frida_g_tcp_wrapper_connection_get_base_io_stream +#define g_tcp_wrapper_connection_get_type _frida_g_tcp_wrapper_connection_get_type +#define g_tcp_wrapper_connection_new _frida_g_tcp_wrapper_connection_new +#define g_test_add_data_func _frida_g_test_add_data_func +#define g_test_add_data_func_full _frida_g_test_add_data_func_full +#define g_test_add_func _frida_g_test_add_func +#define g_test_add_vtable _frida_g_test_add_vtable +#define g_test_assert_expected_messages_internal _frida_g_test_assert_expected_messages_internal +#define g_test_bug _frida_g_test_bug +#define g_test_bug_base _frida_g_test_bug_base +#define g_test_build_filename _frida_g_test_build_filename +#define g_test_config_vars _frida_g_test_config_vars +#define g_test_create_case _frida_g_test_create_case +#define g_test_create_suite _frida_g_test_create_suite +#define g_test_dbus_add_service_dir _frida_g_test_dbus_add_service_dir +#define g_test_dbus_down _frida_g_test_dbus_down +#define g_test_dbus_flags_get_type _frida_g_test_dbus_flags_get_type +#define g_test_dbus_get_bus_address _frida_g_test_dbus_get_bus_address +#define g_test_dbus_get_flags _frida_g_test_dbus_get_flags +#define g_test_dbus_get_type _frida_g_test_dbus_get_type +#define g_test_dbus_new _frida_g_test_dbus_new +#define g_test_dbus_stop _frida_g_test_dbus_stop +#define g_test_dbus_unset _frida_g_test_dbus_unset +#define g_test_dbus_up _frida_g_test_dbus_up +#define g_test_expect_message _frida_g_test_expect_message +#define g_test_fail _frida_g_test_fail +#define g_test_failed _frida_g_test_failed +#define g_test_get_dir _frida_g_test_get_dir +#define g_test_get_filename _frida_g_test_get_filename +#define g_test_get_root _frida_g_test_get_root +#define g_test_incomplete _frida_g_test_incomplete +#define g_test_init _frida_g_test_init +#define g_test_log_buffer_free _frida_g_test_log_buffer_free +#define g_test_log_buffer_new _frida_g_test_log_buffer_new +#define g_test_log_buffer_pop _frida_g_test_log_buffer_pop +#define g_test_log_buffer_push _frida_g_test_log_buffer_push +#define g_test_log_msg_free _frida_g_test_log_msg_free +#define g_test_log_set_fatal_handler _frida_g_test_log_set_fatal_handler +#define g_test_log_type_name _frida_g_test_log_type_name +#define g_test_maximized_result _frida_g_test_maximized_result +#define g_test_message _frida_g_test_message +#define g_test_minimized_result _frida_g_test_minimized_result +#define g_test_queue_destroy _frida_g_test_queue_destroy +#define g_test_queue_free _frida_g_test_queue_free +#define g_test_rand_double _frida_g_test_rand_double +#define g_test_rand_double_range _frida_g_test_rand_double_range +#define g_test_rand_int _frida_g_test_rand_int +#define g_test_rand_int_range _frida_g_test_rand_int_range +#define g_test_run _frida_g_test_run +#define g_test_run_suite _frida_g_test_run_suite +#define g_test_set_nonfatal_assertions _frida_g_test_set_nonfatal_assertions +#define g_test_skip _frida_g_test_skip +#define g_test_subprocess _frida_g_test_subprocess +#define g_test_suite_add _frida_g_test_suite_add +#define g_test_suite_add_suite _frida_g_test_suite_add_suite +#define g_test_summary _frida_g_test_summary +#define g_test_timer_elapsed _frida_g_test_timer_elapsed +#define g_test_timer_last _frida_g_test_timer_last +#define g_test_timer_start _frida_g_test_timer_start +#define g_test_trap_assertions _frida_g_test_trap_assertions +#define g_test_trap_fork _frida_g_test_trap_fork +#define g_test_trap_has_passed _frida_g_test_trap_has_passed +#define g_test_trap_reached_timeout _frida_g_test_trap_reached_timeout +#define g_test_trap_subprocess _frida_g_test_trap_subprocess +#define g_themed_icon_append_name _frida_g_themed_icon_append_name +#define g_themed_icon_get_names _frida_g_themed_icon_get_names +#define g_themed_icon_get_type _frida_g_themed_icon_get_type +#define g_themed_icon_new _frida_g_themed_icon_new +#define g_themed_icon_new_from_names _frida_g_themed_icon_new_from_names +#define g_themed_icon_new_with_default_fallbacks _frida_g_themed_icon_new_with_default_fallbacks +#define g_themed_icon_prepend_name _frida_g_themed_icon_prepend_name +#define g_thread_create _frida_g_thread_create +#define g_thread_create_full _frida_g_thread_create_full +#define g_thread_error_quark _frida_g_thread_error_quark +#define g_thread_exit _frida_g_thread_exit +#define g_thread_foreach _frida_g_thread_foreach +#define g_thread_functions_for_glib_use _frida_g_thread_functions_for_glib_use +#define g_thread_garbage_collect _frida_g_thread_garbage_collect +#define g_thread_get_initialized _frida_g_thread_get_initialized +#define g_thread_get_scheduler_settings _frida_g_thread_get_scheduler_settings +#define g_thread_get_type _frida_g_thread_get_type +#define g_thread_gettime _frida_g_thread_gettime +#define g_thread_init_glib _frida_g_thread_init_glib +#define g_thread_join _frida_g_thread_join +#define g_thread_lifetime_beacon_check _frida_g_thread_lifetime_beacon_check +#define g_thread_lifetime_beacon_free _frida_g_thread_lifetime_beacon_free +#define g_thread_lifetime_beacon_new _frida_g_thread_lifetime_beacon_new +#define g_thread_n_created _frida_g_thread_n_created +#define g_thread_new _frida_g_thread_new +#define g_thread_new_internal _frida_g_thread_new_internal +#define g_thread_perform_cleanup _frida_g_thread_perform_cleanup +#define g_thread_pool_free _frida_g_thread_pool_free +#define g_thread_pool_get_max_idle_time _frida_g_thread_pool_get_max_idle_time +#define g_thread_pool_get_max_threads _frida_g_thread_pool_get_max_threads +#define g_thread_pool_get_max_unused_threads _frida_g_thread_pool_get_max_unused_threads +#define g_thread_pool_get_num_threads _frida_g_thread_pool_get_num_threads +#define g_thread_pool_get_num_unused_threads _frida_g_thread_pool_get_num_unused_threads +#define g_thread_pool_move_to_front _frida_g_thread_pool_move_to_front +#define g_thread_pool_new _frida_g_thread_pool_new +#define g_thread_pool_push _frida_g_thread_pool_push +#define g_thread_pool_set_max_idle_time _frida_g_thread_pool_set_max_idle_time +#define g_thread_pool_set_max_threads _frida_g_thread_pool_set_max_threads +#define g_thread_pool_set_max_unused_threads _frida_g_thread_pool_set_max_unused_threads +#define g_thread_pool_set_sort_function _frida_g_thread_pool_set_sort_function +#define g_thread_pool_stop_unused_threads _frida_g_thread_pool_stop_unused_threads +#define g_thread_pool_unprocessed _frida_g_thread_pool_unprocessed +#define g_thread_private_destroy_later _frida_g_thread_private_destroy_later +#define g_thread_proxy _frida_g_thread_proxy +#define g_thread_ref _frida_g_thread_ref +#define g_thread_schedule_cleanup _frida_g_thread_schedule_cleanup +#define g_thread_self _frida_g_thread_self +#define g_thread_set_callbacks _frida_g_thread_set_callbacks +#define g_thread_set_garbage_handler _frida_g_thread_set_garbage_handler +#define g_thread_set_priority _frida_g_thread_set_priority +#define g_thread_try_new _frida_g_thread_try_new +#define g_thread_unref _frida_g_thread_unref +#define g_thread_use_default_impl _frida_g_thread_use_default_impl +#define g_thread_yield _frida_g_thread_yield +#define g_threaded_resolver_get_type _frida_g_threaded_resolver_get_type +#define g_threaded_socket_service_get_type _frida_g_threaded_socket_service_get_type +#define g_threaded_socket_service_new _frida_g_threaded_socket_service_new +#define g_threads_got_initialized _frida_g_threads_got_initialized +#define g_time_val_add _frida_g_time_val_add +#define g_time_val_from_iso8601 _frida_g_time_val_from_iso8601 +#define g_time_val_to_iso8601 _frida_g_time_val_to_iso8601 +#define g_time_zone_adjust_time _frida_g_time_zone_adjust_time +#define g_time_zone_find_interval _frida_g_time_zone_find_interval +#define g_time_zone_get_abbreviation _frida_g_time_zone_get_abbreviation +#define g_time_zone_get_identifier _frida_g_time_zone_get_identifier +#define g_time_zone_get_offset _frida_g_time_zone_get_offset +#define g_time_zone_get_type _frida_g_time_zone_get_type +#define g_time_zone_is_dst _frida_g_time_zone_is_dst +#define g_time_zone_new _frida_g_time_zone_new +#define g_time_zone_new_identifier _frida_g_time_zone_new_identifier +#define g_time_zone_new_local _frida_g_time_zone_new_local +#define g_time_zone_new_offset _frida_g_time_zone_new_offset +#define g_time_zone_new_utc _frida_g_time_zone_new_utc +#define g_time_zone_ref _frida_g_time_zone_ref +#define g_time_zone_unref _frida_g_time_zone_unref +#define g_timeout_add _frida_g_timeout_add +#define g_timeout_add_full _frida_g_timeout_add_full +#define g_timeout_add_seconds _frida_g_timeout_add_seconds +#define g_timeout_add_seconds_full _frida_g_timeout_add_seconds_full +#define g_timeout_funcs _frida_g_timeout_funcs +#define g_timeout_source_new _frida_g_timeout_source_new +#define g_timeout_source_new_seconds _frida_g_timeout_source_new_seconds +#define g_timer_continue _frida_g_timer_continue +#define g_timer_destroy _frida_g_timer_destroy +#define g_timer_elapsed _frida_g_timer_elapsed +#define g_timer_is_active _frida_g_timer_is_active +#define g_timer_new _frida_g_timer_new +#define g_timer_reset _frida_g_timer_reset +#define g_timer_start _frida_g_timer_start +#define g_timer_stop _frida_g_timer_stop +#define g_tinylist_foreach _frida_g_tinylist_foreach +#define g_tinylist_free _frida_g_tinylist_free +#define g_tinylist_prepend _frida_g_tinylist_prepend +#define g_tinylist_remove _frida_g_tinylist_remove +#define g_tls_authentication_mode_get_type _frida_g_tls_authentication_mode_get_type +#define g_tls_backend_get_certificate_type _frida_g_tls_backend_get_certificate_type +#define g_tls_backend_get_client_connection_type _frida_g_tls_backend_get_client_connection_type +#define g_tls_backend_get_default _frida_g_tls_backend_get_default +#define g_tls_backend_get_default_database _frida_g_tls_backend_get_default_database +#define g_tls_backend_get_dtls_client_connection_type _frida_g_tls_backend_get_dtls_client_connection_type +#define g_tls_backend_get_dtls_server_connection_type _frida_g_tls_backend_get_dtls_server_connection_type +#define g_tls_backend_get_file_database_type _frida_g_tls_backend_get_file_database_type +#define g_tls_backend_get_server_connection_type _frida_g_tls_backend_get_server_connection_type +#define g_tls_backend_get_type _frida_g_tls_backend_get_type +#define g_tls_backend_set_default_database _frida_g_tls_backend_set_default_database +#define g_tls_backend_supports_dtls _frida_g_tls_backend_supports_dtls +#define g_tls_backend_supports_tls _frida_g_tls_backend_supports_tls +#define g_tls_certificate_flags_get_type _frida_g_tls_certificate_flags_get_type +#define g_tls_certificate_get_issuer _frida_g_tls_certificate_get_issuer +#define g_tls_certificate_get_type _frida_g_tls_certificate_get_type +#define g_tls_certificate_is_same _frida_g_tls_certificate_is_same +#define g_tls_certificate_list_new_from_file _frida_g_tls_certificate_list_new_from_file +#define g_tls_certificate_new_from_file _frida_g_tls_certificate_new_from_file +#define g_tls_certificate_new_from_files _frida_g_tls_certificate_new_from_files +#define g_tls_certificate_new_from_pem _frida_g_tls_certificate_new_from_pem +#define g_tls_certificate_new_from_pkcs11_uris _frida_g_tls_certificate_new_from_pkcs11_uris +#define g_tls_certificate_request_flags_get_type _frida_g_tls_certificate_request_flags_get_type +#define g_tls_certificate_verify _frida_g_tls_certificate_verify +#define g_tls_channel_binding_error_get_type _frida_g_tls_channel_binding_error_get_type +#define g_tls_channel_binding_error_quark _frida_g_tls_channel_binding_error_quark +#define g_tls_channel_binding_type_get_type _frida_g_tls_channel_binding_type_get_type +#define g_tls_client_connection_copy_session_state _frida_g_tls_client_connection_copy_session_state +#define g_tls_client_connection_get_accepted_cas _frida_g_tls_client_connection_get_accepted_cas +#define g_tls_client_connection_get_server_identity _frida_g_tls_client_connection_get_server_identity +#define g_tls_client_connection_get_type _frida_g_tls_client_connection_get_type +#define g_tls_client_connection_get_use_ssl3 _frida_g_tls_client_connection_get_use_ssl3 +#define g_tls_client_connection_get_validation_flags _frida_g_tls_client_connection_get_validation_flags +#define g_tls_client_connection_new _frida_g_tls_client_connection_new +#define g_tls_client_connection_set_server_identity _frida_g_tls_client_connection_set_server_identity +#define g_tls_client_connection_set_use_ssl3 _frida_g_tls_client_connection_set_use_ssl3 +#define g_tls_client_connection_set_validation_flags _frida_g_tls_client_connection_set_validation_flags +#define g_tls_connection_emit_accept_certificate _frida_g_tls_connection_emit_accept_certificate +#define g_tls_connection_get_certificate _frida_g_tls_connection_get_certificate +#define g_tls_connection_get_channel_binding_data _frida_g_tls_connection_get_channel_binding_data +#define g_tls_connection_get_database _frida_g_tls_connection_get_database +#define g_tls_connection_get_interaction _frida_g_tls_connection_get_interaction +#define g_tls_connection_get_negotiated_protocol _frida_g_tls_connection_get_negotiated_protocol +#define g_tls_connection_get_peer_certificate _frida_g_tls_connection_get_peer_certificate +#define g_tls_connection_get_peer_certificate_errors _frida_g_tls_connection_get_peer_certificate_errors +#define g_tls_connection_get_rehandshake_mode _frida_g_tls_connection_get_rehandshake_mode +#define g_tls_connection_get_require_close_notify _frida_g_tls_connection_get_require_close_notify +#define g_tls_connection_get_type _frida_g_tls_connection_get_type +#define g_tls_connection_get_use_system_certdb _frida_g_tls_connection_get_use_system_certdb +#define g_tls_connection_handshake _frida_g_tls_connection_handshake +#define g_tls_connection_handshake_async _frida_g_tls_connection_handshake_async +#define g_tls_connection_handshake_finish _frida_g_tls_connection_handshake_finish +#define g_tls_connection_set_advertised_protocols _frida_g_tls_connection_set_advertised_protocols +#define g_tls_connection_set_certificate _frida_g_tls_connection_set_certificate +#define g_tls_connection_set_database _frida_g_tls_connection_set_database +#define g_tls_connection_set_interaction _frida_g_tls_connection_set_interaction +#define g_tls_connection_set_rehandshake_mode _frida_g_tls_connection_set_rehandshake_mode +#define g_tls_connection_set_require_close_notify _frida_g_tls_connection_set_require_close_notify +#define g_tls_connection_set_use_system_certdb _frida_g_tls_connection_set_use_system_certdb +#define g_tls_database_create_certificate_handle _frida_g_tls_database_create_certificate_handle +#define g_tls_database_get_type _frida_g_tls_database_get_type +#define g_tls_database_lookup_certificate_for_handle _frida_g_tls_database_lookup_certificate_for_handle +#define g_tls_database_lookup_certificate_for_handle_async _frida_g_tls_database_lookup_certificate_for_handle_async +#define g_tls_database_lookup_certificate_for_handle_finish _frida_g_tls_database_lookup_certificate_for_handle_finish +#define g_tls_database_lookup_certificate_issuer _frida_g_tls_database_lookup_certificate_issuer +#define g_tls_database_lookup_certificate_issuer_async _frida_g_tls_database_lookup_certificate_issuer_async +#define g_tls_database_lookup_certificate_issuer_finish _frida_g_tls_database_lookup_certificate_issuer_finish +#define g_tls_database_lookup_certificates_issued_by _frida_g_tls_database_lookup_certificates_issued_by +#define g_tls_database_lookup_certificates_issued_by_async _frida_g_tls_database_lookup_certificates_issued_by_async +#define g_tls_database_lookup_certificates_issued_by_finish _frida_g_tls_database_lookup_certificates_issued_by_finish +#define g_tls_database_lookup_flags_get_type _frida_g_tls_database_lookup_flags_get_type +#define g_tls_database_verify_chain _frida_g_tls_database_verify_chain +#define g_tls_database_verify_chain_async _frida_g_tls_database_verify_chain_async +#define g_tls_database_verify_chain_finish _frida_g_tls_database_verify_chain_finish +#define g_tls_database_verify_flags_get_type _frida_g_tls_database_verify_flags_get_type +#define g_tls_error_get_type _frida_g_tls_error_get_type +#define g_tls_error_quark _frida_g_tls_error_quark +#define g_tls_file_database_get_type _frida_g_tls_file_database_get_type +#define g_tls_file_database_new _frida_g_tls_file_database_new +#define g_tls_interaction_ask_password _frida_g_tls_interaction_ask_password +#define g_tls_interaction_ask_password_async _frida_g_tls_interaction_ask_password_async +#define g_tls_interaction_ask_password_finish _frida_g_tls_interaction_ask_password_finish +#define g_tls_interaction_get_type _frida_g_tls_interaction_get_type +#define g_tls_interaction_invoke_ask_password _frida_g_tls_interaction_invoke_ask_password +#define g_tls_interaction_invoke_request_certificate _frida_g_tls_interaction_invoke_request_certificate +#define g_tls_interaction_request_certificate _frida_g_tls_interaction_request_certificate +#define g_tls_interaction_request_certificate_async _frida_g_tls_interaction_request_certificate_async +#define g_tls_interaction_request_certificate_finish _frida_g_tls_interaction_request_certificate_finish +#define g_tls_interaction_result_get_type _frida_g_tls_interaction_result_get_type +#define g_tls_password_flags_get_type _frida_g_tls_password_flags_get_type +#define g_tls_password_get_description _frida_g_tls_password_get_description +#define g_tls_password_get_flags _frida_g_tls_password_get_flags +#define g_tls_password_get_type _frida_g_tls_password_get_type +#define g_tls_password_get_value _frida_g_tls_password_get_value +#define g_tls_password_get_warning _frida_g_tls_password_get_warning +#define g_tls_password_new _frida_g_tls_password_new +#define g_tls_password_set_description _frida_g_tls_password_set_description +#define g_tls_password_set_flags _frida_g_tls_password_set_flags +#define g_tls_password_set_value _frida_g_tls_password_set_value +#define g_tls_password_set_value_full _frida_g_tls_password_set_value_full +#define g_tls_password_set_warning _frida_g_tls_password_set_warning +#define g_tls_rehandshake_mode_get_type _frida_g_tls_rehandshake_mode_get_type +#define g_tls_server_connection_get_type _frida_g_tls_server_connection_get_type +#define g_tls_server_connection_new _frida_g_tls_server_connection_new +#define g_trace_define_int64_counter _frida_g_trace_define_int64_counter +#define g_trace_mark _frida_g_trace_mark +#define g_trace_set_int64_counter _frida_g_trace_set_int64_counter +#define g_trash_portal_trash_file _frida_g_trash_portal_trash_file +#define g_trash_stack_height _frida_g_trash_stack_height +#define g_trash_stack_peek _frida_g_trash_stack_peek +#define g_trash_stack_pop _frida_g_trash_stack_pop +#define g_trash_stack_push _frida_g_trash_stack_push +#define g_tree_destroy _frida_g_tree_destroy +#define g_tree_foreach _frida_g_tree_foreach +#define g_tree_foreach_node _frida_g_tree_foreach_node +#define g_tree_get_type _frida_g_tree_get_type +#define g_tree_height _frida_g_tree_height +#define g_tree_insert _frida_g_tree_insert +#define g_tree_insert_node _frida_g_tree_insert_node +#define g_tree_lookup _frida_g_tree_lookup +#define g_tree_lookup_extended _frida_g_tree_lookup_extended +#define g_tree_lookup_node _frida_g_tree_lookup_node +#define g_tree_lower_bound _frida_g_tree_lower_bound +#define g_tree_new _frida_g_tree_new +#define g_tree_new_full _frida_g_tree_new_full +#define g_tree_new_with_data _frida_g_tree_new_with_data +#define g_tree_nnodes _frida_g_tree_nnodes +#define g_tree_node_first _frida_g_tree_node_first +#define g_tree_node_key _frida_g_tree_node_key +#define g_tree_node_last _frida_g_tree_node_last +#define g_tree_node_next _frida_g_tree_node_next +#define g_tree_node_previous _frida_g_tree_node_previous +#define g_tree_node_value _frida_g_tree_node_value +#define g_tree_ref _frida_g_tree_ref +#define g_tree_remove _frida_g_tree_remove +#define g_tree_replace _frida_g_tree_replace +#define g_tree_replace_node _frida_g_tree_replace_node +#define g_tree_search _frida_g_tree_search +#define g_tree_search_node _frida_g_tree_search_node +#define g_tree_steal _frida_g_tree_steal +#define g_tree_traverse _frida_g_tree_traverse +#define g_tree_unref _frida_g_tree_unref +#define g_tree_upper_bound _frida_g_tree_upper_bound +#define g_try_malloc _frida_g_try_malloc +#define g_try_malloc0 _frida_g_try_malloc0 +#define g_try_malloc0_n _frida_g_try_malloc0_n +#define g_try_malloc_n _frida_g_try_malloc_n +#define g_try_realloc _frida_g_try_realloc +#define g_try_realloc_n _frida_g_try_realloc_n +#define g_tuples_destroy _frida_g_tuples_destroy +#define g_tuples_index _frida_g_tuples_index +#define g_type_add_class_cache_func _frida_g_type_add_class_cache_func +#define g_type_add_class_private _frida_g_type_add_class_private +#define g_type_add_instance_private _frida_g_type_add_instance_private +#define g_type_add_interface_check _frida_g_type_add_interface_check +#define g_type_add_interface_dynamic _frida_g_type_add_interface_dynamic +#define g_type_add_interface_static _frida_g_type_add_interface_static +#define g_type_check_class_cast _frida_g_type_check_class_cast +#define g_type_check_class_is_a _frida_g_type_check_class_is_a +#define g_type_check_instance _frida_g_type_check_instance +#define g_type_check_instance_cast _frida_g_type_check_instance_cast +#define g_type_check_instance_is_a _frida_g_type_check_instance_is_a +#define g_type_check_instance_is_fundamentally_a _frida_g_type_check_instance_is_fundamentally_a +#define g_type_check_is_value_type _frida_g_type_check_is_value_type +#define g_type_check_value _frida_g_type_check_value +#define g_type_check_value_holds _frida_g_type_check_value_holds +#define g_type_children _frida_g_type_children +#define g_type_class_add_private _frida_g_type_class_add_private +#define g_type_class_adjust_private_offset _frida_g_type_class_adjust_private_offset +#define g_type_class_get_instance_private_offset _frida_g_type_class_get_instance_private_offset +#define g_type_class_get_private _frida_g_type_class_get_private +#define g_type_class_peek _frida_g_type_class_peek +#define g_type_class_peek_parent _frida_g_type_class_peek_parent +#define g_type_class_peek_static _frida_g_type_class_peek_static +#define g_type_class_ref _frida_g_type_class_ref +#define g_type_class_unref _frida_g_type_class_unref +#define g_type_class_unref_uncached _frida_g_type_class_unref_uncached +#define g_type_create_instance _frida_g_type_create_instance +#define g_type_default_interface_peek _frida_g_type_default_interface_peek +#define g_type_default_interface_ref _frida_g_type_default_interface_ref +#define g_type_default_interface_unref _frida_g_type_default_interface_unref +#define g_type_depth _frida_g_type_depth +#define g_type_ensure _frida_g_type_ensure +#define g_type_free_instance _frida_g_type_free_instance +#define g_type_from_name _frida_g_type_from_name +#define g_type_fundamental _frida_g_type_fundamental +#define g_type_fundamental_next _frida_g_type_fundamental_next +#define g_type_get_instance_count _frida_g_type_get_instance_count +#define g_type_get_plugin _frida_g_type_get_plugin +#define g_type_get_qdata _frida_g_type_get_qdata +#define g_type_get_type_registration_serial _frida_g_type_get_type_registration_serial +#define g_type_init _frida_g_type_init +#define g_type_init_with_debug_flags _frida_g_type_init_with_debug_flags +#define g_type_instance_get_private _frida_g_type_instance_get_private +#define g_type_interface_add_prerequisite _frida_g_type_interface_add_prerequisite +#define g_type_interface_get_plugin _frida_g_type_interface_get_plugin +#define g_type_interface_instantiatable_prerequisite _frida_g_type_interface_instantiatable_prerequisite +#define g_type_interface_peek _frida_g_type_interface_peek +#define g_type_interface_peek_parent _frida_g_type_interface_peek_parent +#define g_type_interface_prerequisites _frida_g_type_interface_prerequisites +#define g_type_interfaces _frida_g_type_interfaces +#define g_type_is_a _frida_g_type_is_a +#define g_type_module_add_interface _frida_g_type_module_add_interface +#define g_type_module_get_type _frida_g_type_module_get_type +#define g_type_module_register_enum _frida_g_type_module_register_enum +#define g_type_module_register_flags _frida_g_type_module_register_flags +#define g_type_module_register_type _frida_g_type_module_register_type +#define g_type_module_set_name _frida_g_type_module_set_name +#define g_type_module_unuse _frida_g_type_module_unuse +#define g_type_module_use _frida_g_type_module_use +#define g_type_name _frida_g_type_name +#define g_type_name_from_class _frida_g_type_name_from_class +#define g_type_name_from_instance _frida_g_type_name_from_instance +#define g_type_next_base _frida_g_type_next_base +#define g_type_parent _frida_g_type_parent +#define g_type_plugin_complete_interface_info _frida_g_type_plugin_complete_interface_info +#define g_type_plugin_complete_type_info _frida_g_type_plugin_complete_type_info +#define g_type_plugin_get_type _frida_g_type_plugin_get_type +#define g_type_plugin_unuse _frida_g_type_plugin_unuse +#define g_type_plugin_use _frida_g_type_plugin_use +#define g_type_qname _frida_g_type_qname +#define g_type_query _frida_g_type_query +#define g_type_register_dynamic _frida_g_type_register_dynamic +#define g_type_register_fundamental _frida_g_type_register_fundamental +#define g_type_register_static _frida_g_type_register_static +#define g_type_register_static_simple _frida_g_type_register_static_simple +#define g_type_remove_class_cache_func _frida_g_type_remove_class_cache_func +#define g_type_remove_interface_check _frida_g_type_remove_interface_check +#define g_type_set_qdata _frida_g_type_set_qdata +#define g_type_test_flags _frida_g_type_test_flags +#define g_type_value_table_peek _frida_g_type_value_table_peek +#define g_ucs4_to_utf16 _frida_g_ucs4_to_utf16 +#define g_ucs4_to_utf8 _frida_g_ucs4_to_utf8 +#define g_unichar_break_type _frida_g_unichar_break_type +#define g_unichar_combining_class _frida_g_unichar_combining_class +#define g_unichar_compose _frida_g_unichar_compose +#define g_unichar_decompose _frida_g_unichar_decompose +#define g_unichar_digit_value _frida_g_unichar_digit_value +#define g_unichar_fully_decompose _frida_g_unichar_fully_decompose +#define g_unichar_get_mirror_char _frida_g_unichar_get_mirror_char +#define g_unichar_get_script _frida_g_unichar_get_script +#define g_unichar_isalnum _frida_g_unichar_isalnum +#define g_unichar_isalpha _frida_g_unichar_isalpha +#define g_unichar_iscntrl _frida_g_unichar_iscntrl +#define g_unichar_isdefined _frida_g_unichar_isdefined +#define g_unichar_isdigit _frida_g_unichar_isdigit +#define g_unichar_isgraph _frida_g_unichar_isgraph +#define g_unichar_islower _frida_g_unichar_islower +#define g_unichar_ismark _frida_g_unichar_ismark +#define g_unichar_isprint _frida_g_unichar_isprint +#define g_unichar_ispunct _frida_g_unichar_ispunct +#define g_unichar_isspace _frida_g_unichar_isspace +#define g_unichar_istitle _frida_g_unichar_istitle +#define g_unichar_isupper _frida_g_unichar_isupper +#define g_unichar_iswide _frida_g_unichar_iswide +#define g_unichar_iswide_cjk _frida_g_unichar_iswide_cjk +#define g_unichar_isxdigit _frida_g_unichar_isxdigit +#define g_unichar_iszerowidth _frida_g_unichar_iszerowidth +#define g_unichar_to_utf8 _frida_g_unichar_to_utf8 +#define g_unichar_tolower _frida_g_unichar_tolower +#define g_unichar_totitle _frida_g_unichar_totitle +#define g_unichar_toupper _frida_g_unichar_toupper +#define g_unichar_type _frida_g_unichar_type +#define g_unichar_validate _frida_g_unichar_validate +#define g_unichar_xdigit_value _frida_g_unichar_xdigit_value +#define g_unicode_break_type_get_type _frida_g_unicode_break_type_get_type +#define g_unicode_canonical_decomposition _frida_g_unicode_canonical_decomposition +#define g_unicode_canonical_ordering _frida_g_unicode_canonical_ordering +#define g_unicode_script_from_iso15924 _frida_g_unicode_script_from_iso15924 +#define g_unicode_script_get_type _frida_g_unicode_script_get_type +#define g_unicode_script_to_iso15924 _frida_g_unicode_script_to_iso15924 +#define g_unicode_type_get_type _frida_g_unicode_type_get_type +#define g_unix_connection_get_type _frida_g_unix_connection_get_type +#define g_unix_connection_receive_credentials _frida_g_unix_connection_receive_credentials +#define g_unix_connection_receive_credentials_async _frida_g_unix_connection_receive_credentials_async +#define g_unix_connection_receive_credentials_finish _frida_g_unix_connection_receive_credentials_finish +#define g_unix_connection_receive_fd _frida_g_unix_connection_receive_fd +#define g_unix_connection_send_credentials _frida_g_unix_connection_send_credentials +#define g_unix_connection_send_credentials_async _frida_g_unix_connection_send_credentials_async +#define g_unix_connection_send_credentials_finish _frida_g_unix_connection_send_credentials_finish +#define g_unix_connection_send_fd _frida_g_unix_connection_send_fd +#define g_unix_credentials_message_get_credentials _frida_g_unix_credentials_message_get_credentials +#define g_unix_credentials_message_get_type _frida_g_unix_credentials_message_get_type +#define g_unix_credentials_message_is_supported _frida_g_unix_credentials_message_is_supported +#define g_unix_credentials_message_new _frida_g_unix_credentials_message_new +#define g_unix_credentials_message_new_with_credentials _frida_g_unix_credentials_message_new_with_credentials +#define g_unix_error_quark _frida_g_unix_error_quark +#define g_unix_fd_add _frida_g_unix_fd_add +#define g_unix_fd_add_full _frida_g_unix_fd_add_full +#define g_unix_fd_list_append _frida_g_unix_fd_list_append +#define g_unix_fd_list_get _frida_g_unix_fd_list_get +#define g_unix_fd_list_get_length _frida_g_unix_fd_list_get_length +#define g_unix_fd_list_get_type _frida_g_unix_fd_list_get_type +#define g_unix_fd_list_new _frida_g_unix_fd_list_new +#define g_unix_fd_list_new_from_array _frida_g_unix_fd_list_new_from_array +#define g_unix_fd_list_peek_fds _frida_g_unix_fd_list_peek_fds +#define g_unix_fd_list_steal_fds _frida_g_unix_fd_list_steal_fds +#define g_unix_fd_message_append_fd _frida_g_unix_fd_message_append_fd +#define g_unix_fd_message_get_fd_list _frida_g_unix_fd_message_get_fd_list +#define g_unix_fd_message_get_type _frida_g_unix_fd_message_get_type +#define g_unix_fd_message_new _frida_g_unix_fd_message_new +#define g_unix_fd_message_new_with_fd_list _frida_g_unix_fd_message_new_with_fd_list +#define g_unix_fd_message_steal_fds _frida_g_unix_fd_message_steal_fds +#define g_unix_fd_source_funcs _frida_g_unix_fd_source_funcs +#define g_unix_fd_source_new _frida_g_unix_fd_source_new +#define g_unix_get_passwd_entry _frida_g_unix_get_passwd_entry +#define g_unix_input_stream_get_close_fd _frida_g_unix_input_stream_get_close_fd +#define g_unix_input_stream_get_fd _frida_g_unix_input_stream_get_fd +#define g_unix_input_stream_get_type _frida_g_unix_input_stream_get_type +#define g_unix_input_stream_new _frida_g_unix_input_stream_new +#define g_unix_input_stream_set_close_fd _frida_g_unix_input_stream_set_close_fd +#define g_unix_is_mount_path_system_internal _frida_g_unix_is_mount_path_system_internal +#define g_unix_is_system_device_path _frida_g_unix_is_system_device_path +#define g_unix_is_system_fs_type _frida_g_unix_is_system_fs_type +#define g_unix_mount_at _frida_g_unix_mount_at +#define g_unix_mount_compare _frida_g_unix_mount_compare +#define g_unix_mount_copy _frida_g_unix_mount_copy +#define g_unix_mount_entry_get_type _frida_g_unix_mount_entry_get_type +#define g_unix_mount_for _frida_g_unix_mount_for +#define g_unix_mount_free _frida_g_unix_mount_free +#define g_unix_mount_get_device_path _frida_g_unix_mount_get_device_path +#define g_unix_mount_get_fs_type _frida_g_unix_mount_get_fs_type +#define g_unix_mount_get_mount_path _frida_g_unix_mount_get_mount_path +#define g_unix_mount_get_options _frida_g_unix_mount_get_options +#define g_unix_mount_get_root_path _frida_g_unix_mount_get_root_path +#define g_unix_mount_guess_can_eject _frida_g_unix_mount_guess_can_eject +#define g_unix_mount_guess_icon _frida_g_unix_mount_guess_icon +#define g_unix_mount_guess_name _frida_g_unix_mount_guess_name +#define g_unix_mount_guess_should_display _frida_g_unix_mount_guess_should_display +#define g_unix_mount_guess_symbolic_icon _frida_g_unix_mount_guess_symbolic_icon +#define g_unix_mount_is_readonly _frida_g_unix_mount_is_readonly +#define g_unix_mount_is_system_internal _frida_g_unix_mount_is_system_internal +#define g_unix_mount_monitor_get _frida_g_unix_mount_monitor_get +#define g_unix_mount_monitor_get_type _frida_g_unix_mount_monitor_get_type +#define g_unix_mount_monitor_new _frida_g_unix_mount_monitor_new +#define g_unix_mount_monitor_set_rate_limit _frida_g_unix_mount_monitor_set_rate_limit +#define g_unix_mount_point_at _frida_g_unix_mount_point_at +#define g_unix_mount_point_compare _frida_g_unix_mount_point_compare +#define g_unix_mount_point_copy _frida_g_unix_mount_point_copy +#define g_unix_mount_point_free _frida_g_unix_mount_point_free +#define g_unix_mount_point_get_device_path _frida_g_unix_mount_point_get_device_path +#define g_unix_mount_point_get_fs_type _frida_g_unix_mount_point_get_fs_type +#define g_unix_mount_point_get_mount_path _frida_g_unix_mount_point_get_mount_path +#define g_unix_mount_point_get_options _frida_g_unix_mount_point_get_options +#define g_unix_mount_point_get_type _frida_g_unix_mount_point_get_type +#define g_unix_mount_point_guess_can_eject _frida_g_unix_mount_point_guess_can_eject +#define g_unix_mount_point_guess_icon _frida_g_unix_mount_point_guess_icon +#define g_unix_mount_point_guess_name _frida_g_unix_mount_point_guess_name +#define g_unix_mount_point_guess_symbolic_icon _frida_g_unix_mount_point_guess_symbolic_icon +#define g_unix_mount_point_is_loopback _frida_g_unix_mount_point_is_loopback +#define g_unix_mount_point_is_readonly _frida_g_unix_mount_point_is_readonly +#define g_unix_mount_point_is_user_mountable _frida_g_unix_mount_point_is_user_mountable +#define g_unix_mount_points_changed_since _frida_g_unix_mount_points_changed_since +#define g_unix_mount_points_get _frida_g_unix_mount_points_get +#define g_unix_mounts_changed_since _frida_g_unix_mounts_changed_since +#define g_unix_mounts_get _frida_g_unix_mounts_get +#define g_unix_open_pipe _frida_g_unix_open_pipe +#define g_unix_output_stream_get_close_fd _frida_g_unix_output_stream_get_close_fd +#define g_unix_output_stream_get_fd _frida_g_unix_output_stream_get_fd +#define g_unix_output_stream_get_type _frida_g_unix_output_stream_get_type +#define g_unix_output_stream_new _frida_g_unix_output_stream_new +#define g_unix_output_stream_set_close_fd _frida_g_unix_output_stream_set_close_fd +#define g_unix_set_fd_nonblocking _frida_g_unix_set_fd_nonblocking +#define g_unix_signal_add _frida_g_unix_signal_add +#define g_unix_signal_add_full _frida_g_unix_signal_add_full +#define g_unix_signal_funcs _frida_g_unix_signal_funcs +#define g_unix_signal_source_new _frida_g_unix_signal_source_new +#define g_unix_socket_address_abstract_names_supported _frida_g_unix_socket_address_abstract_names_supported +#define g_unix_socket_address_get_address_type _frida_g_unix_socket_address_get_address_type +#define g_unix_socket_address_get_is_abstract _frida_g_unix_socket_address_get_is_abstract +#define g_unix_socket_address_get_path _frida_g_unix_socket_address_get_path +#define g_unix_socket_address_get_path_len _frida_g_unix_socket_address_get_path_len +#define g_unix_socket_address_get_type _frida_g_unix_socket_address_get_type +#define g_unix_socket_address_new _frida_g_unix_socket_address_new +#define g_unix_socket_address_new_abstract _frida_g_unix_socket_address_new_abstract +#define g_unix_socket_address_new_with_type _frida_g_unix_socket_address_new_with_type +#define g_unix_socket_address_type_get_type _frida_g_unix_socket_address_type_get_type +#define g_unlink _frida_g_unlink +#define g_unsetenv _frida_g_unsetenv +#define g_uri_build _frida_g_uri_build +#define g_uri_build_with_user _frida_g_uri_build_with_user +#define g_uri_error_quark _frida_g_uri_error_quark +#define g_uri_escape_bytes _frida_g_uri_escape_bytes +#define g_uri_escape_string _frida_g_uri_escape_string +#define g_uri_get_auth_params _frida_g_uri_get_auth_params +#define g_uri_get_flags _frida_g_uri_get_flags +#define g_uri_get_fragment _frida_g_uri_get_fragment +#define g_uri_get_host _frida_g_uri_get_host +#define g_uri_get_password _frida_g_uri_get_password +#define g_uri_get_path _frida_g_uri_get_path +#define g_uri_get_port _frida_g_uri_get_port +#define g_uri_get_query _frida_g_uri_get_query +#define g_uri_get_scheme _frida_g_uri_get_scheme +#define g_uri_get_type _frida_g_uri_get_type +#define g_uri_get_user _frida_g_uri_get_user +#define g_uri_get_userinfo _frida_g_uri_get_userinfo +#define g_uri_is_valid _frida_g_uri_is_valid +#define g_uri_join _frida_g_uri_join +#define g_uri_join_with_user _frida_g_uri_join_with_user +#define g_uri_list_extract_uris _frida_g_uri_list_extract_uris +#define g_uri_params_iter_init _frida_g_uri_params_iter_init +#define g_uri_params_iter_next _frida_g_uri_params_iter_next +#define g_uri_parse _frida_g_uri_parse +#define g_uri_parse_params _frida_g_uri_parse_params +#define g_uri_parse_relative _frida_g_uri_parse_relative +#define g_uri_parse_scheme _frida_g_uri_parse_scheme +#define g_uri_peek_scheme _frida_g_uri_peek_scheme +#define g_uri_ref _frida_g_uri_ref +#define g_uri_resolve_relative _frida_g_uri_resolve_relative +#define g_uri_split _frida_g_uri_split +#define g_uri_split_network _frida_g_uri_split_network +#define g_uri_split_with_user _frida_g_uri_split_with_user +#define g_uri_to_string _frida_g_uri_to_string +#define g_uri_to_string_partial _frida_g_uri_to_string_partial +#define g_uri_unescape_bytes _frida_g_uri_unescape_bytes +#define g_uri_unescape_segment _frida_g_uri_unescape_segment +#define g_uri_unescape_string _frida_g_uri_unescape_string +#define g_uri_unref _frida_g_uri_unref +#define g_usleep _frida_g_usleep +#define g_utf16_to_ucs4 _frida_g_utf16_to_ucs4 +#define g_utf16_to_utf8 _frida_g_utf16_to_utf8 +#define g_utf8_casefold _frida_g_utf8_casefold +#define g_utf8_collate _frida_g_utf8_collate +#define g_utf8_collate_key _frida_g_utf8_collate_key +#define g_utf8_collate_key_for_filename _frida_g_utf8_collate_key_for_filename +#define g_utf8_find_next_char _frida_g_utf8_find_next_char +#define g_utf8_find_prev_char _frida_g_utf8_find_prev_char +#define g_utf8_get_char _frida_g_utf8_get_char +#define g_utf8_get_char_validated _frida_g_utf8_get_char_validated +#define g_utf8_make_valid _frida_g_utf8_make_valid +#define g_utf8_normalize _frida_g_utf8_normalize +#define g_utf8_offset_to_pointer _frida_g_utf8_offset_to_pointer +#define g_utf8_pointer_to_offset _frida_g_utf8_pointer_to_offset +#define g_utf8_prev_char _frida_g_utf8_prev_char +#define g_utf8_skip _frida_g_utf8_skip +#define g_utf8_strchr _frida_g_utf8_strchr +#define g_utf8_strdown _frida_g_utf8_strdown +#define g_utf8_strlen _frida_g_utf8_strlen +#define g_utf8_strncpy _frida_g_utf8_strncpy +#define g_utf8_strrchr _frida_g_utf8_strrchr +#define g_utf8_strreverse _frida_g_utf8_strreverse +#define g_utf8_strup _frida_g_utf8_strup +#define g_utf8_substring _frida_g_utf8_substring +#define g_utf8_to_ucs4 _frida_g_utf8_to_ucs4 +#define g_utf8_to_ucs4_fast _frida_g_utf8_to_ucs4_fast +#define g_utf8_to_utf16 _frida_g_utf8_to_utf16 +#define g_utf8_validate _frida_g_utf8_validate +#define g_utf8_validate_len _frida_g_utf8_validate_len +#define g_utime _frida_g_utime +#define g_uuid_string_is_valid _frida_g_uuid_string_is_valid +#define g_uuid_string_random _frida_g_uuid_string_random +#define g_value_array_append _frida_g_value_array_append +#define g_value_array_copy _frida_g_value_array_copy +#define g_value_array_free _frida_g_value_array_free +#define g_value_array_get_nth _frida_g_value_array_get_nth +#define g_value_array_get_type _frida_g_value_array_get_type +#define g_value_array_insert _frida_g_value_array_insert +#define g_value_array_new _frida_g_value_array_new +#define g_value_array_prepend _frida_g_value_array_prepend +#define g_value_array_remove _frida_g_value_array_remove +#define g_value_array_sort _frida_g_value_array_sort +#define g_value_array_sort_with_data _frida_g_value_array_sort_with_data +#define g_value_copy _frida_g_value_copy +#define g_value_dup_boxed _frida_g_value_dup_boxed +#define g_value_dup_object _frida_g_value_dup_object +#define g_value_dup_param _frida_g_value_dup_param +#define g_value_dup_string _frida_g_value_dup_string +#define g_value_dup_variant _frida_g_value_dup_variant +#define g_value_fits_pointer _frida_g_value_fits_pointer +#define g_value_get_boolean _frida_g_value_get_boolean +#define g_value_get_boxed _frida_g_value_get_boxed +#define g_value_get_char _frida_g_value_get_char +#define g_value_get_double _frida_g_value_get_double +#define g_value_get_enum _frida_g_value_get_enum +#define g_value_get_flags _frida_g_value_get_flags +#define g_value_get_float _frida_g_value_get_float +#define g_value_get_gtype _frida_g_value_get_gtype +#define g_value_get_int _frida_g_value_get_int +#define g_value_get_int64 _frida_g_value_get_int64 +#define g_value_get_long _frida_g_value_get_long +#define g_value_get_object _frida_g_value_get_object +#define g_value_get_param _frida_g_value_get_param +#define g_value_get_pointer _frida_g_value_get_pointer +#define g_value_get_schar _frida_g_value_get_schar +#define g_value_get_string _frida_g_value_get_string +#define g_value_get_type _frida_g_value_get_type +#define g_value_get_uchar _frida_g_value_get_uchar +#define g_value_get_uint _frida_g_value_get_uint +#define g_value_get_uint64 _frida_g_value_get_uint64 +#define g_value_get_ulong _frida_g_value_get_ulong +#define g_value_get_variant _frida_g_value_get_variant +#define g_value_init _frida_g_value_init +#define g_value_init_from_instance _frida_g_value_init_from_instance +#define g_value_peek_pointer _frida_g_value_peek_pointer +#define g_value_register_transform_func _frida_g_value_register_transform_func +#define g_value_reset _frida_g_value_reset +#define g_value_set_boolean _frida_g_value_set_boolean +#define g_value_set_boxed _frida_g_value_set_boxed +#define g_value_set_boxed_take_ownership _frida_g_value_set_boxed_take_ownership +#define g_value_set_char _frida_g_value_set_char +#define g_value_set_double _frida_g_value_set_double +#define g_value_set_enum _frida_g_value_set_enum +#define g_value_set_flags _frida_g_value_set_flags +#define g_value_set_float _frida_g_value_set_float +#define g_value_set_gtype _frida_g_value_set_gtype +#define g_value_set_instance _frida_g_value_set_instance +#define g_value_set_int _frida_g_value_set_int +#define g_value_set_int64 _frida_g_value_set_int64 +#define g_value_set_interned_string _frida_g_value_set_interned_string +#define g_value_set_long _frida_g_value_set_long +#define g_value_set_object _frida_g_value_set_object +#define g_value_set_object_take_ownership _frida_g_value_set_object_take_ownership +#define g_value_set_param _frida_g_value_set_param +#define g_value_set_param_take_ownership _frida_g_value_set_param_take_ownership +#define g_value_set_pointer _frida_g_value_set_pointer +#define g_value_set_schar _frida_g_value_set_schar +#define g_value_set_static_boxed _frida_g_value_set_static_boxed +#define g_value_set_static_string _frida_g_value_set_static_string +#define g_value_set_string _frida_g_value_set_string +#define g_value_set_string_take_ownership _frida_g_value_set_string_take_ownership +#define g_value_set_uchar _frida_g_value_set_uchar +#define g_value_set_uint _frida_g_value_set_uint +#define g_value_set_uint64 _frida_g_value_set_uint64 +#define g_value_set_ulong _frida_g_value_set_ulong +#define g_value_set_variant _frida_g_value_set_variant +#define g_value_take_boxed _frida_g_value_take_boxed +#define g_value_take_object _frida_g_value_take_object +#define g_value_take_param _frida_g_value_take_param +#define g_value_take_string _frida_g_value_take_string +#define g_value_take_variant _frida_g_value_take_variant +#define g_value_transform _frida_g_value_transform +#define g_value_type_compatible _frida_g_value_type_compatible +#define g_value_type_transformable _frida_g_value_type_transformable +#define g_value_unset _frida_g_value_unset +#define g_variant_builder_add _frida_g_variant_builder_add +#define g_variant_builder_add_parsed _frida_g_variant_builder_add_parsed +#define g_variant_builder_add_value _frida_g_variant_builder_add_value +#define g_variant_builder_clear _frida_g_variant_builder_clear +#define g_variant_builder_close _frida_g_variant_builder_close +#define g_variant_builder_end _frida_g_variant_builder_end +#define g_variant_builder_get_type _frida_g_variant_builder_get_type +#define g_variant_builder_init _frida_g_variant_builder_init +#define g_variant_builder_new _frida_g_variant_builder_new +#define g_variant_builder_open _frida_g_variant_builder_open +#define g_variant_builder_ref _frida_g_variant_builder_ref +#define g_variant_builder_unref _frida_g_variant_builder_unref +#define g_variant_byteswap _frida_g_variant_byteswap +#define g_variant_check_format_string _frida_g_variant_check_format_string +#define g_variant_classify _frida_g_variant_classify +#define g_variant_compare _frida_g_variant_compare +#define g_variant_dict_clear _frida_g_variant_dict_clear +#define g_variant_dict_contains _frida_g_variant_dict_contains +#define g_variant_dict_end _frida_g_variant_dict_end +#define g_variant_dict_get_type _frida_g_variant_dict_get_type +#define g_variant_dict_init _frida_g_variant_dict_init +#define g_variant_dict_insert _frida_g_variant_dict_insert +#define g_variant_dict_insert_value _frida_g_variant_dict_insert_value +#define g_variant_dict_lookup _frida_g_variant_dict_lookup +#define g_variant_dict_lookup_value _frida_g_variant_dict_lookup_value +#define g_variant_dict_new _frida_g_variant_dict_new +#define g_variant_dict_ref _frida_g_variant_dict_ref +#define g_variant_dict_remove _frida_g_variant_dict_remove +#define g_variant_dict_unref _frida_g_variant_dict_unref +#define g_variant_dup_bytestring _frida_g_variant_dup_bytestring +#define g_variant_dup_bytestring_array _frida_g_variant_dup_bytestring_array +#define g_variant_dup_objv _frida_g_variant_dup_objv +#define g_variant_dup_string _frida_g_variant_dup_string +#define g_variant_dup_strv _frida_g_variant_dup_strv +#define g_variant_equal _frida_g_variant_equal +#define g_variant_format_string_scan _frida_g_variant_format_string_scan +#define g_variant_format_string_scan_type _frida_g_variant_format_string_scan_type +#define g_variant_get _frida_g_variant_get +#define g_variant_get_boolean _frida_g_variant_get_boolean +#define g_variant_get_byte _frida_g_variant_get_byte +#define g_variant_get_bytestring _frida_g_variant_get_bytestring +#define g_variant_get_bytestring_array _frida_g_variant_get_bytestring_array +#define g_variant_get_child _frida_g_variant_get_child +#define g_variant_get_child_value _frida_g_variant_get_child_value +#define g_variant_get_data _frida_g_variant_get_data +#define g_variant_get_data_as_bytes _frida_g_variant_get_data_as_bytes +#define g_variant_get_depth _frida_g_variant_get_depth +#define g_variant_get_double _frida_g_variant_get_double +#define g_variant_get_fixed_array _frida_g_variant_get_fixed_array +#define g_variant_get_gtype _frida_g_variant_get_gtype +#define g_variant_get_handle _frida_g_variant_get_handle +#define g_variant_get_int16 _frida_g_variant_get_int16 +#define g_variant_get_int32 _frida_g_variant_get_int32 +#define g_variant_get_int64 _frida_g_variant_get_int64 +#define g_variant_get_maybe _frida_g_variant_get_maybe +#define g_variant_get_normal_form _frida_g_variant_get_normal_form +#define g_variant_get_objv _frida_g_variant_get_objv +#define g_variant_get_size _frida_g_variant_get_size +#define g_variant_get_string _frida_g_variant_get_string +#define g_variant_get_strv _frida_g_variant_get_strv +#define g_variant_get_type _frida_g_variant_get_type +#define g_variant_get_type_info _frida_g_variant_get_type_info +#define g_variant_get_type_string _frida_g_variant_get_type_string +#define g_variant_get_uint16 _frida_g_variant_get_uint16 +#define g_variant_get_uint32 _frida_g_variant_get_uint32 +#define g_variant_get_uint64 _frida_g_variant_get_uint64 +#define g_variant_get_va _frida_g_variant_get_va +#define g_variant_get_variant _frida_g_variant_get_variant +#define g_variant_hash _frida_g_variant_hash +#define g_variant_is_container _frida_g_variant_is_container +#define g_variant_is_floating _frida_g_variant_is_floating +#define g_variant_is_normal_form _frida_g_variant_is_normal_form +#define g_variant_is_object_path _frida_g_variant_is_object_path +#define g_variant_is_of_type _frida_g_variant_is_of_type +#define g_variant_is_signature _frida_g_variant_is_signature +#define g_variant_is_trusted _frida_g_variant_is_trusted +#define g_variant_iter_copy _frida_g_variant_iter_copy +#define g_variant_iter_free _frida_g_variant_iter_free +#define g_variant_iter_init _frida_g_variant_iter_init +#define g_variant_iter_loop _frida_g_variant_iter_loop +#define g_variant_iter_n_children _frida_g_variant_iter_n_children +#define g_variant_iter_new _frida_g_variant_iter_new +#define g_variant_iter_next _frida_g_variant_iter_next +#define g_variant_iter_next_value _frida_g_variant_iter_next_value +#define g_variant_lookup _frida_g_variant_lookup +#define g_variant_lookup_value _frida_g_variant_lookup_value +#define g_variant_n_children _frida_g_variant_n_children +#define g_variant_new _frida_g_variant_new +#define g_variant_new_array _frida_g_variant_new_array +#define g_variant_new_boolean _frida_g_variant_new_boolean +#define g_variant_new_byte _frida_g_variant_new_byte +#define g_variant_new_bytestring _frida_g_variant_new_bytestring +#define g_variant_new_bytestring_array _frida_g_variant_new_bytestring_array +#define g_variant_new_dict_entry _frida_g_variant_new_dict_entry +#define g_variant_new_double _frida_g_variant_new_double +#define g_variant_new_fixed_array _frida_g_variant_new_fixed_array +#define g_variant_new_from_bytes _frida_g_variant_new_from_bytes +#define g_variant_new_from_children _frida_g_variant_new_from_children +#define g_variant_new_from_data _frida_g_variant_new_from_data +#define g_variant_new_handle _frida_g_variant_new_handle +#define g_variant_new_int16 _frida_g_variant_new_int16 +#define g_variant_new_int32 _frida_g_variant_new_int32 +#define g_variant_new_int64 _frida_g_variant_new_int64 +#define g_variant_new_maybe _frida_g_variant_new_maybe +#define g_variant_new_object_path _frida_g_variant_new_object_path +#define g_variant_new_objv _frida_g_variant_new_objv +#define g_variant_new_parsed _frida_g_variant_new_parsed +#define g_variant_new_parsed_va _frida_g_variant_new_parsed_va +#define g_variant_new_printf _frida_g_variant_new_printf +#define g_variant_new_signature _frida_g_variant_new_signature +#define g_variant_new_string _frida_g_variant_new_string +#define g_variant_new_strv _frida_g_variant_new_strv +#define g_variant_new_take_string _frida_g_variant_new_take_string +#define g_variant_new_tuple _frida_g_variant_new_tuple +#define g_variant_new_uint16 _frida_g_variant_new_uint16 +#define g_variant_new_uint32 _frida_g_variant_new_uint32 +#define g_variant_new_uint64 _frida_g_variant_new_uint64 +#define g_variant_new_va _frida_g_variant_new_va +#define g_variant_new_variant _frida_g_variant_new_variant +#define g_variant_parse _frida_g_variant_parse +#define g_variant_parse_error_print_context _frida_g_variant_parse_error_print_context +#define g_variant_parse_error_quark _frida_g_variant_parse_error_quark +#define g_variant_parser_get_error_quark _frida_g_variant_parser_get_error_quark +#define g_variant_print _frida_g_variant_print +#define g_variant_print_string _frida_g_variant_print_string +#define g_variant_ref _frida_g_variant_ref +#define g_variant_ref_sink _frida_g_variant_ref_sink +#define g_variant_serialised_byteswap _frida_g_variant_serialised_byteswap +#define g_variant_serialised_check _frida_g_variant_serialised_check +#define g_variant_serialised_get_child _frida_g_variant_serialised_get_child +#define g_variant_serialised_is_normal _frida_g_variant_serialised_is_normal +#define g_variant_serialised_n_children _frida_g_variant_serialised_n_children +#define g_variant_serialiser_is_object_path _frida_g_variant_serialiser_is_object_path +#define g_variant_serialiser_is_signature _frida_g_variant_serialiser_is_signature +#define g_variant_serialiser_is_string _frida_g_variant_serialiser_is_string +#define g_variant_serialiser_needed_size _frida_g_variant_serialiser_needed_size +#define g_variant_serialiser_serialise _frida_g_variant_serialiser_serialise +#define g_variant_store _frida_g_variant_store +#define g_variant_take_ref _frida_g_variant_take_ref +#define g_variant_type_checked_ _frida_g_variant_type_checked_ +#define g_variant_type_copy _frida_g_variant_type_copy +#define g_variant_type_dup_string _frida_g_variant_type_dup_string +#define g_variant_type_element _frida_g_variant_type_element +#define g_variant_type_equal _frida_g_variant_type_equal +#define g_variant_type_first _frida_g_variant_type_first +#define g_variant_type_free _frida_g_variant_type_free +#define g_variant_type_get_gtype _frida_g_variant_type_get_gtype +#define g_variant_type_get_string_length _frida_g_variant_type_get_string_length +#define g_variant_type_hash _frida_g_variant_type_hash +#define g_variant_type_info_assert_no_infos _frida_g_variant_type_info_assert_no_infos +#define g_variant_type_info_element _frida_g_variant_type_info_element +#define g_variant_type_info_get _frida_g_variant_type_info_get +#define g_variant_type_info_get_type_string _frida_g_variant_type_info_get_type_string +#define g_variant_type_info_member_info _frida_g_variant_type_info_member_info +#define g_variant_type_info_n_members _frida_g_variant_type_info_n_members +#define g_variant_type_info_query _frida_g_variant_type_info_query +#define g_variant_type_info_query_depth _frida_g_variant_type_info_query_depth +#define g_variant_type_info_query_element _frida_g_variant_type_info_query_element +#define g_variant_type_info_ref _frida_g_variant_type_info_ref +#define g_variant_type_info_unref _frida_g_variant_type_info_unref +#define g_variant_type_is_array _frida_g_variant_type_is_array +#define g_variant_type_is_basic _frida_g_variant_type_is_basic +#define g_variant_type_is_container _frida_g_variant_type_is_container +#define g_variant_type_is_definite _frida_g_variant_type_is_definite +#define g_variant_type_is_dict_entry _frida_g_variant_type_is_dict_entry +#define g_variant_type_is_maybe _frida_g_variant_type_is_maybe +#define g_variant_type_is_subtype_of _frida_g_variant_type_is_subtype_of +#define g_variant_type_is_tuple _frida_g_variant_type_is_tuple +#define g_variant_type_is_variant _frida_g_variant_type_is_variant +#define g_variant_type_key _frida_g_variant_type_key +#define g_variant_type_n_items _frida_g_variant_type_n_items +#define g_variant_type_new _frida_g_variant_type_new +#define g_variant_type_new_array _frida_g_variant_type_new_array +#define g_variant_type_new_dict_entry _frida_g_variant_type_new_dict_entry +#define g_variant_type_new_maybe _frida_g_variant_type_new_maybe +#define g_variant_type_new_tuple _frida_g_variant_type_new_tuple +#define g_variant_type_next _frida_g_variant_type_next +#define g_variant_type_peek_string _frida_g_variant_type_peek_string +#define g_variant_type_string_get_depth_ _frida_g_variant_type_string_get_depth_ +#define g_variant_type_string_is_valid _frida_g_variant_type_string_is_valid +#define g_variant_type_string_scan _frida_g_variant_type_string_scan +#define g_variant_type_value _frida_g_variant_type_value +#define g_variant_unref _frida_g_variant_unref +#define g_vasprintf _frida_g_vasprintf +#define g_vfprintf _frida_g_vfprintf +#define g_vfs_get_default _frida_g_vfs_get_default +#define g_vfs_get_file_for_path _frida_g_vfs_get_file_for_path +#define g_vfs_get_file_for_uri _frida_g_vfs_get_file_for_uri +#define g_vfs_get_local _frida_g_vfs_get_local +#define g_vfs_get_supported_uri_schemes _frida_g_vfs_get_supported_uri_schemes +#define g_vfs_get_type _frida_g_vfs_get_type +#define g_vfs_is_active _frida_g_vfs_is_active +#define g_vfs_parse_name _frida_g_vfs_parse_name +#define g_vfs_register_uri_scheme _frida_g_vfs_register_uri_scheme +#define g_vfs_unregister_uri_scheme _frida_g_vfs_unregister_uri_scheme +#define g_volume_can_eject _frida_g_volume_can_eject +#define g_volume_can_mount _frida_g_volume_can_mount +#define g_volume_eject _frida_g_volume_eject +#define g_volume_eject_finish _frida_g_volume_eject_finish +#define g_volume_eject_with_operation _frida_g_volume_eject_with_operation +#define g_volume_eject_with_operation_finish _frida_g_volume_eject_with_operation_finish +#define g_volume_enumerate_identifiers _frida_g_volume_enumerate_identifiers +#define g_volume_get_activation_root _frida_g_volume_get_activation_root +#define g_volume_get_drive _frida_g_volume_get_drive +#define g_volume_get_icon _frida_g_volume_get_icon +#define g_volume_get_identifier _frida_g_volume_get_identifier +#define g_volume_get_mount _frida_g_volume_get_mount +#define g_volume_get_name _frida_g_volume_get_name +#define g_volume_get_sort_key _frida_g_volume_get_sort_key +#define g_volume_get_symbolic_icon _frida_g_volume_get_symbolic_icon +#define g_volume_get_type _frida_g_volume_get_type +#define g_volume_get_uuid _frida_g_volume_get_uuid +#define g_volume_monitor_adopt_orphan_mount _frida_g_volume_monitor_adopt_orphan_mount +#define g_volume_monitor_get _frida_g_volume_monitor_get +#define g_volume_monitor_get_connected_drives _frida_g_volume_monitor_get_connected_drives +#define g_volume_monitor_get_mount_for_uuid _frida_g_volume_monitor_get_mount_for_uuid +#define g_volume_monitor_get_mounts _frida_g_volume_monitor_get_mounts +#define g_volume_monitor_get_type _frida_g_volume_monitor_get_type +#define g_volume_monitor_get_volume_for_uuid _frida_g_volume_monitor_get_volume_for_uuid +#define g_volume_monitor_get_volumes _frida_g_volume_monitor_get_volumes +#define g_volume_mount _frida_g_volume_mount +#define g_volume_mount_finish _frida_g_volume_mount_finish +#define g_volume_should_automount _frida_g_volume_should_automount +#define g_vprintf _frida_g_vprintf +#define g_vsnprintf _frida_g_vsnprintf +#define g_vsprintf _frida_g_vsprintf +#define g_wakeup_acknowledge _frida_g_wakeup_acknowledge +#define g_wakeup_free _frida_g_wakeup_free +#define g_wakeup_get_pollfd _frida_g_wakeup_get_pollfd +#define g_wakeup_new _frida_g_wakeup_new +#define g_wakeup_signal _frida_g_wakeup_signal +#define g_warn_message _frida_g_warn_message +#define g_weak_ref_clear _frida_g_weak_ref_clear +#define g_weak_ref_get _frida_g_weak_ref_get +#define g_weak_ref_init _frida_g_weak_ref_init +#define g_weak_ref_set _frida_g_weak_ref_set +#define g_zlib_compressor_format_get_type _frida_g_zlib_compressor_format_get_type +#define g_zlib_compressor_get_file_info _frida_g_zlib_compressor_get_file_info +#define g_zlib_compressor_get_type _frida_g_zlib_compressor_get_type +#define g_zlib_compressor_new _frida_g_zlib_compressor_new +#define g_zlib_compressor_set_file_info _frida_g_zlib_compressor_set_file_info +#define g_zlib_decompressor_get_file_info _frida_g_zlib_decompressor_get_file_info +#define g_zlib_decompressor_get_type _frida_g_zlib_decompressor_get_type +#define g_zlib_decompressor_new _frida_g_zlib_decompressor_new +#define gio_deinit _frida_gio_deinit +#define gio_init _frida_gio_init +#define gio_prepare_to_fork _frida_gio_prepare_to_fork +#define gio_recover_from_fork_in_child _frida_gio_recover_from_fork_in_child +#define gio_recover_from_fork_in_parent _frida_gio_recover_from_fork_in_parent +#define gio_shutdown _frida_gio_shutdown +#define glib__private__ _frida_glib__private__ +#define glib_binary_age _frida_glib_binary_age +#define glib_check_version _frida_glib_check_version +#define glib_deinit _frida_glib_deinit +#define glib_fd_callbacks _frida_glib_fd_callbacks +#define glib_gettext _frida_glib_gettext +#define glib_has_dconf_access_in_sandbox _frida_glib_has_dconf_access_in_sandbox +#define glib_init _frida_glib_init +#define glib_interface_age _frida_glib_interface_age +#define glib_major_version _frida_glib_major_version +#define glib_mem_profiler_table _frida_glib_mem_profiler_table +#define glib_mem_table _frida_glib_mem_table +#define glib_micro_version _frida_glib_micro_version +#define glib_minor_version _frida_glib_minor_version +#define glib_network_available_in_sandbox _frida_glib_network_available_in_sandbox +#define glib_on_error_halt _frida_glib_on_error_halt +#define glib_pgettext _frida_glib_pgettext +#define glib_prepare_to_fork _frida_glib_prepare_to_fork +#define glib_recover_from_fork_in_child _frida_glib_recover_from_fork_in_child +#define glib_recover_from_fork_in_parent _frida_glib_recover_from_fork_in_parent +#define glib_should_use_portal _frida_glib_should_use_portal +#define glib_shutdown _frida_glib_shutdown +#define glib_thread_callbacks _frida_glib_thread_callbacks +#define gobject_init _frida_gobject_init + +#endif + +/* + * Copyright (C) 2008-2019 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_H__ +#define __GUM_H__ + +/* + * Copyright (C) 2008-2020 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUMDEFS_H__ +#define __GUMDEFS_H__ + + +/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */ + +#ifndef __GUM_ENUM_TYPES_H__ +#define __GUM_ENUM_TYPES_H__ + +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 1998, 1999, 2000 Tim Janik and Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ +#ifndef __GLIB_GOBJECT_H__ +#define __GLIB_GOBJECT_H__ + +#define __GLIB_GOBJECT_H_INSIDE__ + +/* gbinding.h: Binding for object properties + * + * Copyright (C) 2010 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Emmanuele Bassi + */ + +#ifndef __G_BINDING_H__ +#define __G_BINDING_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_LIB_H__ +#define __G_LIB_H__ + +#define __GLIB_H_INSIDE__ + +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_ALLOCA_H__ +#define __G_ALLOCA_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_TYPES_H__ +#define __G_TYPES_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +/* glibconfig.h + * + * This is a generated file. Please modify 'glibconfig.h.in' + */ + +#ifndef __GLIBCONFIG_H__ +#define __GLIBCONFIG_H__ + +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* This file must not include any other glib header file and must thus + * not refer to variables from glibconfig.h + */ + +#ifndef __G_MACROS_H__ +#define __G_MACROS_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +/* We include stddef.h to get the system's definition of NULL + */ +#include + +#ifdef __GNUC__ +#define G_GNUC_CHECK_VERSION(major, minor) \ + ((__GNUC__ > (major)) || \ + ((__GNUC__ == (major)) && \ + (__GNUC_MINOR__ >= (minor)))) +#else +#define G_GNUC_CHECK_VERSION(major, minor) 0 +#endif + +/* Here we provide G_GNUC_EXTENSION as an alias for __extension__, + * where this is valid. This allows for warningless compilation of + * "long long" types even in the presence of '-ansi -pedantic'. + */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) +#define G_GNUC_EXTENSION __extension__ +#else +#define G_GNUC_EXTENSION +#endif + +/* Every compiler that we target supports inlining, but some of them may + * complain about it if we don't say "__inline". If we have C99, or if + * we are using C++, then we can use "inline" directly. Unfortunately + * Visual Studio does not support __STDC_VERSION__, so we need to check + * whether we are on Visual Studio 2013 or earlier to see that we need to + * say "__inline" in C mode. + * Otherwise, we say "__inline" to avoid the warning. + */ +#define G_CAN_INLINE +#ifndef __cplusplus +# ifdef _MSC_VER +# if (_MSC_VER < 1900) +# define G_INLINE_DEFINE_NEEDED +# endif +# elif !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199900) +# define G_INLINE_DEFINE_NEEDED +# endif +#endif + +#ifdef G_INLINE_DEFINE_NEEDED +# undef inline +# define inline __inline +#endif + +#undef G_INLINE_DEFINE_NEEDED + +/** + * G_INLINE_FUNC: + * + * This macro used to be used to conditionally define inline functions + * in a compatible way before this feature was supported in all + * compilers. These days, GLib requires inlining support from the + * compiler, so your GLib-using programs can safely assume that the + * "inline" keyword works properly. + * + * Never use this macro anymore. Just say "static inline". + * + * Deprecated: 2.48: Use "static inline" instead + */ + +/* For historical reasons we need to continue to support those who + * define G_IMPLEMENT_INLINES to mean "don't implement this here". + */ +#ifdef G_IMPLEMENT_INLINES +# define G_INLINE_FUNC extern GLIB_DEPRECATED_MACRO_IN_2_48_FOR(static inline) +# undef G_CAN_INLINE +#else +# define G_INLINE_FUNC static inline GLIB_DEPRECATED_MACRO_IN_2_48_FOR(static inline) +#endif /* G_IMPLEMENT_INLINES */ + +/* Provide macros to feature the GCC function attribute. + */ + +/** + * G_GNUC_PURE: + * + * Expands to the GNU C `pure` function attribute if the compiler is gcc. + * Declaring a function as `pure` enables better optimization of calls to + * the function. A `pure` function has no effects except its return value + * and the return value depends only on the parameters and/or global + * variables. + * + * Place the attribute after the declaration, just before the semicolon. + * + * |[ + * gboolean g_type_check_value (const GValue *value) G_GNUC_PURE; + * ]| + * + * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-pure-function-attribute) for more details. + */ + +/** + * G_GNUC_MALLOC: + * + * Expands to the + * [GNU C `malloc` function attribute](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-functions-that-behave-like-malloc) + * if the compiler is gcc. + * Declaring a function as `malloc` enables better optimization of the function, + * but must only be done if the allocation behaviour of the function is fully + * understood, otherwise miscompilation can result. + * + * A function can have the `malloc` attribute if it returns a pointer which is + * guaranteed to not alias with any other pointer valid when the function + * returns, and moreover no pointers to valid objects occur in any storage + * addressed by the returned pointer. + * + * In practice, this means that `G_GNUC_MALLOC` can be used with any function + * which returns unallocated or zeroed-out memory, but not with functions which + * return initialised structures containing other pointers, or with functions + * that reallocate memory. This definition changed in GLib 2.58 to match the + * stricter definition introduced around GCC 5. + * + * Place the attribute after the declaration, just before the semicolon. + * + * |[ + * gpointer g_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); + * ]| + * + * See the + * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-functions-that-behave-like-malloc) + * for more details. + * + * Since: 2.6 + */ + +/** + * G_GNUC_NO_INLINE: + * + * Expands to the GNU C `noinline` function attribute if the compiler is gcc. + * If the compiler is not gcc, this macro expands to nothing. + * + * Declaring a function as `noinline` prevents the function from being + * considered for inlining. + * + * The attribute may be placed before the declaration or definition, + * right before the `static` keyword. + * + * |[ + * G_GNUC_NO_INLINE + * static int + * do_not_inline_this (void) + * { + * ... + * } + * ]| + * + * See the + * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noinline-function-attribute) + * for more details. + * + * Since: 2.58 + */ + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +#define G_GNUC_PURE __attribute__((__pure__)) +#define G_GNUC_MALLOC __attribute__((__malloc__)) +#define G_GNUC_NO_INLINE __attribute__((noinline)) +#else +#define G_GNUC_PURE +#define G_GNUC_MALLOC +#define G_GNUC_NO_INLINE +#endif + +/** + * G_GNUC_NULL_TERMINATED: + * + * Expands to the GNU C `sentinel` function attribute if the compiler is gcc. + * This function attribute only applies to variadic functions and instructs + * the compiler to check that the argument list is terminated with an + * explicit %NULL. + * + * Place the attribute after the declaration, just before the semicolon. + * + * |[ + * gchar *g_strconcat (const gchar *string1, + * ...) G_GNUC_NULL_TERMINATED; + * ]| + * + * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-sentinel-function-attribute) for more details. + * + * Since: 2.8 + */ +#if __GNUC__ >= 4 +#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) +#else +#define G_GNUC_NULL_TERMINATED +#endif + +/* + * We can only use __typeof__ on GCC >= 4.8, and not when compiling C++. Since + * __typeof__ is used in a few places in GLib, provide a pre-processor symbol + * to factor the check out from callers. + * + * This symbol is private. + */ +#undef glib_typeof +#if !defined(__cplusplus) && \ + ((defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) || \ + defined(__clang__)) +#define glib_typeof(t) __typeof__ (t) +#endif + +/* + * Clang feature detection: http://clang.llvm.org/docs/LanguageExtensions.html + * These are not available on GCC, but since the pre-processor doesn't do + * operator short-circuiting, we can't use it in a statement or we'll get: + * + * error: missing binary operator before token "(" + * + * So we define it to 0 to satisfy the pre-processor. + */ + +#ifdef __has_attribute +#define g_macro__has_attribute __has_attribute +#else +#define g_macro__has_attribute(x) 0 +#endif + +#ifdef __has_feature +#define g_macro__has_feature __has_feature +#else +#define g_macro__has_feature(x) 0 +#endif + +#ifdef __has_builtin +#define g_macro__has_builtin __has_builtin +#else +#define g_macro__has_builtin(x) 0 +#endif + +/** + * G_GNUC_ALLOC_SIZE: + * @x: the index of the argument specifying the allocation size + * + * Expands to the GNU C `alloc_size` function attribute if the compiler + * is a new enough gcc. This attribute tells the compiler that the + * function returns a pointer to memory of a size that is specified + * by the @xth function parameter. + * + * Place the attribute after the function declaration, just before the + * semicolon. + * + * |[ + * gpointer g_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); + * ]| + * + * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-alloc_005fsize-function-attribute) for more details. + * + * Since: 2.18 + */ + +/** + * G_GNUC_ALLOC_SIZE2: + * @x: the index of the argument specifying one factor of the allocation size + * @y: the index of the argument specifying the second factor of the allocation size + * + * Expands to the GNU C `alloc_size` function attribute if the compiler is a + * new enough gcc. This attribute tells the compiler that the function returns + * a pointer to memory of a size that is specified by the product of two + * function parameters. + * + * Place the attribute after the function declaration, just before the + * semicolon. + * + * |[ + * gpointer g_malloc_n (gsize n_blocks, + * gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1, 2); + * ]| + * + * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-alloc_005fsize-function-attribute) for more details. + * + * Since: 2.18 + */ +#if (!defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || \ + (defined(__clang__) && g_macro__has_attribute(__alloc_size__)) +#define G_GNUC_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) +#define G_GNUC_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y))) +#else +#define G_GNUC_ALLOC_SIZE(x) +#define G_GNUC_ALLOC_SIZE2(x,y) +#endif + +/** + * G_GNUC_PRINTF: + * @format_idx: the index of the argument corresponding to the + * format string (the arguments are numbered from 1) + * @arg_idx: the index of the first of the format arguments, or 0 if + * there are no format arguments + * + * Expands to the GNU C `format` function attribute if the compiler is gcc. + * This is used for declaring functions which take a variable number of + * arguments, with the same syntax as `printf()`. It allows the compiler + * to type-check the arguments passed to the function. + * + * Place the attribute after the function declaration, just before the + * semicolon. + * + * See the + * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288) + * for more details. + * + * |[ + * gint g_snprintf (gchar *string, + * gulong n, + * gchar const *format, + * ...) G_GNUC_PRINTF (3, 4); + * ]| + */ + +/** + * G_GNUC_SCANF: + * @format_idx: the index of the argument corresponding to + * the format string (the arguments are numbered from 1) + * @arg_idx: the index of the first of the format arguments, or 0 if + * there are no format arguments + * + * Expands to the GNU C `format` function attribute if the compiler is gcc. + * This is used for declaring functions which take a variable number of + * arguments, with the same syntax as `scanf()`. It allows the compiler + * to type-check the arguments passed to the function. + * + * |[ + * int my_scanf (MyStream *stream, + * const char *format, + * ...) G_GNUC_SCANF (2, 3); + * int my_vscanf (MyStream *stream, + * const char *format, + * va_list ap) G_GNUC_SCANF (2, 0); + * ]| + * + * See the + * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288) + * for details. + */ + +/** + * G_GNUC_STRFTIME: + * @format_idx: the index of the argument corresponding to + * the format string (the arguments are numbered from 1) + * + * Expands to the GNU C `strftime` format function attribute if the compiler + * is gcc. This is used for declaring functions which take a format argument + * which is passed to `strftime()` or an API implementing its formats. It allows + * the compiler check the format passed to the function. + * + * |[ + * gsize my_strftime (MyBuffer *buffer, + * const char *format, + * const struct tm *tm) G_GNUC_STRFTIME (2); + * ]| + * + * See the + * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288) + * for details. + * + * Since: 2.60 + */ + +/** + * G_GNUC_FORMAT: + * @arg_idx: the index of the argument + * + * Expands to the GNU C `format_arg` function attribute if the compiler + * is gcc. This function attribute specifies that a function takes a + * format string for a `printf()`, `scanf()`, `strftime()` or `strfmon()` style + * function and modifies it, so that the result can be passed to a `printf()`, + * `scanf()`, `strftime()` or `strfmon()` style function (with the remaining + * arguments to the format function the same as they would have been + * for the unmodified string). + * + * Place the attribute after the function declaration, just before the + * semicolon. + * + * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-nonliteral-1) for more details. + * + * |[ + * gchar *g_dgettext (gchar *domain_name, gchar *msgid) G_GNUC_FORMAT (2); + * ]| + */ + +/** + * G_GNUC_NORETURN: + * + * Expands to the GNU C `noreturn` function attribute if the compiler is gcc. + * It is used for declaring functions which never return. It enables + * optimization of the function, and avoids possible compiler warnings. + * + * Since 2.68, it is recommended that code uses %G_NORETURN instead of + * %G_GNUC_NORETURN, as that works on more platforms and compilers (in + * particular, MSVC and C++11) than %G_GNUC_NORETURN, which works with GCC and + * Clang only. %G_GNUC_NORETURN continues to work, so has not been deprecated + * yet. + * + * Place the attribute after the declaration, just before the semicolon. + * + * |[ + * void g_abort (void) G_GNUC_NORETURN; + * ]| + * + * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noreturn-function-attribute) for more details. + */ + +/** + * G_GNUC_CONST: + * + * Expands to the GNU C `const` function attribute if the compiler is gcc. + * Declaring a function as `const` enables better optimization of calls to + * the function. A `const` function doesn't examine any values except its + * parameters, and has no effects except its return value. + * + * Place the attribute after the declaration, just before the semicolon. + * + * |[ + * gchar g_ascii_tolower (gchar c) G_GNUC_CONST; + * ]| + * + * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-const-function-attribute) for more details. + * + * A function that has pointer arguments and examines the data pointed to + * must not be declared `const`. Likewise, a function that calls a non-`const` + * function usually must not be `const`. It doesn't make sense for a `const` + * function to return `void`. + */ + +/** + * G_GNUC_UNUSED: + * + * Expands to the GNU C `unused` function attribute if the compiler is gcc. + * It is used for declaring functions and arguments which may never be used. + * It avoids possible compiler warnings. + * + * For functions, place the attribute after the declaration, just before the + * semicolon. For arguments, place the attribute at the beginning of the + * argument declaration. + * + * |[ + * void my_unused_function (G_GNUC_UNUSED gint unused_argument, + * gint other_argument) G_GNUC_UNUSED; + * ]| + * + * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-unused-function-attribute) for more details. + */ + +/** + * G_GNUC_NO_INSTRUMENT: + * + * Expands to the GNU C `no_instrument_function` function attribute if the + * compiler is gcc. Functions with this attribute will not be instrumented + * for profiling, when the compiler is called with the + * `-finstrument-functions` option. + * + * Place the attribute after the declaration, just before the semicolon. + * + * |[ + * int do_uninteresting_things (void) G_GNUC_NO_INSTRUMENT; + * ]| + * + * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-no_005finstrument_005ffunction-function-attribute) for more details. + */ + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) +#if !defined (__clang__) && G_GNUC_CHECK_VERSION (4, 4) +#define G_GNUC_PRINTF( format_idx, arg_idx ) \ + __attribute__((__format__ (gnu_printf, format_idx, arg_idx))) +#define G_GNUC_SCANF( format_idx, arg_idx ) \ + __attribute__((__format__ (gnu_scanf, format_idx, arg_idx))) +#define G_GNUC_STRFTIME( format_idx ) \ + __attribute__((__format__ (gnu_strftime, format_idx, 0))) +#else +#define G_GNUC_PRINTF( format_idx, arg_idx ) \ + __attribute__((__format__ (__printf__, format_idx, arg_idx))) +#define G_GNUC_SCANF( format_idx, arg_idx ) \ + __attribute__((__format__ (__scanf__, format_idx, arg_idx))) +#define G_GNUC_STRFTIME( format_idx ) \ + __attribute__((__format__ (__strftime__, format_idx, 0))) +#endif +#define G_GNUC_FORMAT( arg_idx ) \ + __attribute__((__format_arg__ (arg_idx))) +#define G_GNUC_NORETURN \ + __attribute__((__noreturn__)) +#define G_GNUC_CONST \ + __attribute__((__const__)) +#define G_GNUC_UNUSED \ + __attribute__((__unused__)) +#define G_GNUC_NO_INSTRUMENT \ + __attribute__((__no_instrument_function__)) +#else /* !__GNUC__ */ +#define G_GNUC_PRINTF( format_idx, arg_idx ) +#define G_GNUC_SCANF( format_idx, arg_idx ) +#define G_GNUC_STRFTIME( format_idx ) +#define G_GNUC_FORMAT( arg_idx ) +/* NOTE: MSVC has __declspec(noreturn) but unlike GCC __attribute__, + * __declspec can only be placed at the start of the function prototype + * and not at the end, so we can't use it without breaking API. + */ +#define G_GNUC_NORETURN +#define G_GNUC_CONST +#define G_GNUC_UNUSED +#define G_GNUC_NO_INSTRUMENT +#endif /* !__GNUC__ */ + +/** + * G_GNUC_FALLTHROUGH: + * + * Expands to the GNU C `fallthrough` statement attribute if the compiler supports it. + * This allows declaring case statement to explicitly fall through in switch + * statements. To enable this feature, use `-Wimplicit-fallthrough` during + * compilation. + * + * Put the attribute right before the case statement you want to fall through + * to. + * + * |[ + * switch (foo) + * { + * case 1: + * g_message ("it's 1"); + * G_GNUC_FALLTHROUGH; + * case 2: + * g_message ("it's either 1 or 2"); + * break; + * } + * ]| + * + * + * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#index-fallthrough-statement-attribute) for more details. + * + * Since: 2.60 + */ +#if __GNUC__ > 6 +#define G_GNUC_FALLTHROUGH __attribute__((fallthrough)) +#elif g_macro__has_attribute (fallthrough) +#define G_GNUC_FALLTHROUGH __attribute__((fallthrough)) +#else +#define G_GNUC_FALLTHROUGH +#endif /* __GNUC__ */ + +/** + * G_GNUC_DEPRECATED: + * + * Expands to the GNU C `deprecated` attribute if the compiler is gcc. + * It can be used to mark `typedef`s, variables and functions as deprecated. + * When called with the `-Wdeprecated-declarations` option, + * gcc will generate warnings when deprecated interfaces are used. + * + * Place the attribute after the declaration, just before the semicolon. + * + * |[ + * int my_mistake (void) G_GNUC_DEPRECATED; + * ]| + * + * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-deprecated-function-attribute) for more details. + * + * Since: 2.2 + */ +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || defined (__clang__) +#define G_GNUC_DEPRECATED __attribute__((__deprecated__)) +#else +#define G_GNUC_DEPRECATED +#endif /* __GNUC__ */ + +/** + * G_GNUC_DEPRECATED_FOR: + * @f: the intended replacement for the deprecated symbol, + * such as the name of a function + * + * Like %G_GNUC_DEPRECATED, but names the intended replacement for the + * deprecated symbol if the version of gcc in use is new enough to support + * custom deprecation messages. + * + * Place the attribute after the declaration, just before the semicolon. + * + * |[ + * int my_mistake (void) G_GNUC_DEPRECATED_FOR(my_replacement); + * ]| + * + * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-deprecated-function-attribute) for more details. + * + * Note that if @f is a macro, it will be expanded in the warning message. + * You can enclose it in quotes to prevent this. (The quotes will show up + * in the warning, but it's better than showing the macro expansion.) + * + * Since: 2.26 + */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || defined (__clang__) +#define G_GNUC_DEPRECATED_FOR(f) \ + __attribute__((deprecated("Use " #f " instead"))) +#else +#define G_GNUC_DEPRECATED_FOR(f) G_GNUC_DEPRECATED +#endif /* __GNUC__ */ + +#ifdef __ICC +#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + _Pragma ("warning (push)") \ + _Pragma ("warning (disable:1478)") +#define G_GNUC_END_IGNORE_DEPRECATIONS \ + _Pragma ("warning (pop)") +#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) +#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#define G_GNUC_END_IGNORE_DEPRECATIONS \ + _Pragma ("GCC diagnostic pop") +#elif defined (_MSC_VER) && (_MSC_VER >= 1500) && !defined (__clang__) +#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + __pragma (warning (push)) \ + __pragma (warning (disable : 4996)) +#define G_GNUC_END_IGNORE_DEPRECATIONS \ + __pragma (warning (pop)) +#elif defined (__clang__) +#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") +#define G_GNUC_END_IGNORE_DEPRECATIONS \ + _Pragma("clang diagnostic pop") +#else +#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS +#define G_GNUC_END_IGNORE_DEPRECATIONS +#endif + +/** + * G_GNUC_MAY_ALIAS: + * + * Expands to the GNU C `may_alias` type attribute if the compiler is gcc. + * Types with this attribute will not be subjected to type-based alias + * analysis, but are assumed to alias with any other type, just like `char`. + * + * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-may_005falias-type-attribute) for details. + * + * Since: 2.14 + */ +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) +#define G_GNUC_MAY_ALIAS __attribute__((may_alias)) +#else +#define G_GNUC_MAY_ALIAS +#endif + +/** + * G_GNUC_WARN_UNUSED_RESULT: + * + * Expands to the GNU C `warn_unused_result` function attribute if the compiler + * is gcc. This function attribute makes the compiler emit a warning if the + * result of a function call is ignored. + * + * Place the attribute after the declaration, just before the semicolon. + * + * |[ + * GList *g_list_append (GList *list, + * gpointer data) G_GNUC_WARN_UNUSED_RESULT; + * ]| + * + * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-warn_005funused_005fresult-function-attribute) for more details. + * + * Since: 2.10 + */ +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +#define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) +#else +#define G_GNUC_WARN_UNUSED_RESULT +#endif /* __GNUC__ */ + +/** + * G_GNUC_FUNCTION: + * + * Expands to "" on all modern compilers, and to __FUNCTION__ on gcc + * version 2.x. Don't use it. + * + * Deprecated: 2.16: Use G_STRFUNC() instead + */ + +/** + * G_GNUC_PRETTY_FUNCTION: + * + * Expands to "" on all modern compilers, and to __PRETTY_FUNCTION__ + * on gcc version 2.x. Don't use it. + * + * Deprecated: 2.16: Use G_STRFUNC() instead + */ + +/* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with + * macros, so we can refer to them as strings unconditionally. + * usage not-recommended since gcc-3.0 + * + * Mark them as deprecated since 2.26, since that’s when version macros were + * introduced. + */ +#if defined (__GNUC__) && (__GNUC__ < 3) +#define G_GNUC_FUNCTION __FUNCTION__ GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC) +#define G_GNUC_PRETTY_FUNCTION __PRETTY_FUNCTION__ GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC) +#else /* !__GNUC__ */ +#define G_GNUC_FUNCTION "" GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC) +#define G_GNUC_PRETTY_FUNCTION "" GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC) +#endif /* !__GNUC__ */ + +#if g_macro__has_feature(attribute_analyzer_noreturn) && defined(__clang_analyzer__) +#define G_ANALYZER_ANALYZING 1 +#define G_ANALYZER_NORETURN __attribute__((analyzer_noreturn)) +#else +#define G_ANALYZER_ANALYZING 0 +#define G_ANALYZER_NORETURN +#endif + +#define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string) +#define G_STRINGIFY_ARG(contents) #contents + +#ifndef __GI_SCANNER__ /* The static assert macro really confuses the introspection parser */ +#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2 +#define G_PASTE(identifier1,identifier2) G_PASTE_ARGS (identifier1, identifier2) +#if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false") +#elif (defined(__cplusplus) && __cplusplus >= 201103L) || \ + (defined(__cplusplus) && defined (_MSC_VER) && (_MSC_VER >= 1600)) || \ + (defined (_MSC_VER) && (_MSC_VER >= 1800)) +#define G_STATIC_ASSERT(expr) static_assert (expr, "Expression evaluates to false") +#else +#ifdef __COUNTER__ +#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED +#else +#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __LINE__)[(expr) ? 1 : -1] G_GNUC_UNUSED +#endif +#endif /* __STDC_VERSION__ */ +#define G_STATIC_ASSERT_EXPR(expr) ((void) sizeof (char[(expr) ? 1 : -1])) +#endif /* !__GI_SCANNER__ */ + +/* Provide a string identifying the current code position */ +#if defined(__GNUC__) && (__GNUC__ < 3) && !defined(__cplusplus) +#define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()" +#else +#define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) +#endif + +/* Provide a string identifying the current function, non-concatenatable */ +#if defined (__GNUC__) && defined (__cplusplus) +#define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define G_STRFUNC ((const char*) (__func__)) +#elif defined (__GNUC__) || (defined(_MSC_VER) && (_MSC_VER > 1300)) +#define G_STRFUNC ((const char*) (__FUNCTION__)) +#else +#define G_STRFUNC ((const char*) ("???")) +#endif + +/* Guard C code in headers, while including them from C++ */ +#ifdef __cplusplus +#define G_BEGIN_DECLS extern "C" { +#define G_END_DECLS } +#else +#define G_BEGIN_DECLS +#define G_END_DECLS +#endif + +/* Provide definitions for some commonly used macros. + * Some of them are only provided if they haven't already + * been defined. It is assumed that if they are already + * defined then the current definition is correct. + */ +#ifndef NULL +# ifdef __cplusplus +# define NULL (0L) +# else /* !__cplusplus */ +# define NULL ((void*) 0) +# endif /* !__cplusplus */ +#endif + +#ifndef FALSE +#define FALSE (0) +#endif + +#ifndef TRUE +#define TRUE (!FALSE) +#endif + +#undef MAX +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) + +#undef MIN +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) + +#undef ABS +#define ABS(a) (((a) < 0) ? -(a) : (a)) + +#undef CLAMP +#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) + +#define G_APPROX_VALUE(a, b, epsilon) \ + (((a) > (b) ? (a) - (b) : (b) - (a)) < (epsilon)) + +/* Count the number of elements in an array. The array must be defined + * as such; using this with a dynamically allocated array will give + * incorrect results. + */ +#define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) + +/* Macros by analogy to GINT_TO_POINTER, GPOINTER_TO_INT + */ +#define GPOINTER_TO_SIZE(p) ((gsize) (p)) +#define GSIZE_TO_POINTER(s) ((gpointer) (gsize) (s)) + +/* Provide convenience macros for handling structure + * fields through their offsets. + */ + +#if (defined(__GNUC__) && __GNUC__ >= 4) || defined (_MSC_VER) +#define G_STRUCT_OFFSET(struct_type, member) \ + ((glong) offsetof (struct_type, member)) +#else +#define G_STRUCT_OFFSET(struct_type, member) \ + ((glong) ((guint8*) &((struct_type*) 0)->member)) +#endif + +#define G_STRUCT_MEMBER_P(struct_p, struct_offset) \ + ((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset))) +#define G_STRUCT_MEMBER(member_type, struct_p, struct_offset) \ + (*(member_type*) G_STRUCT_MEMBER_P ((struct_p), (struct_offset))) + +/* Provide simple macro statement wrappers: + * G_STMT_START { statements; } G_STMT_END; + * This can be used as a single statement, like: + * if (x) G_STMT_START { ... } G_STMT_END; else ... + * This intentionally does not use compiler extensions like GCC's '({...})' to + * avoid portability issue or side effects when compiled with different compilers. + * MSVC complains about "while(0)": C4127: "Conditional expression is constant", + * so we use __pragma to avoid the warning since the use here is intentional. + */ +#if !(defined (G_STMT_START) && defined (G_STMT_END)) +#define G_STMT_START do +#if defined (_MSC_VER) && (_MSC_VER >= 1500) +#define G_STMT_END \ + __pragma(warning(push)) \ + __pragma(warning(disable:4127)) \ + while(0) \ + __pragma(warning(pop)) +#else +#define G_STMT_END while (0) +#endif +#endif + +/* Provide G_ALIGNOF alignment macro. + * + * Note we cannot use the gcc __alignof__ operator here, as that returns the + * preferred alignment rather than the minimal alignment. See + * https://gitlab.gnome.org/GNOME/glib/merge_requests/538/diffs#note_390790. + */ + +/** + * G_ALIGNOF + * @type: a type-name + * + * Return the minimal alignment required by the platform ABI for values of the given + * type. The address of a variable or struct member of the given type must always be + * a multiple of this alignment. For example, most platforms require int variables + * to be aligned at a 4-byte boundary, so `G_ALIGNOF (int)` is 4 on most platforms. + * + * Note this is not necessarily the same as the value returned by GCC’s + * `__alignof__` operator, which returns the preferred alignment for a type. + * The preferred alignment may be a stricter alignment than the minimal + * alignment. + * + * Since: 2.60 + */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__cplusplus) +#define G_ALIGNOF(type) _Alignof (type) +#else +#define G_ALIGNOF(type) (G_STRUCT_OFFSET (struct { char a; type b; }, b)) +#endif + +/** + * G_CONST_RETURN: + * + * If %G_DISABLE_CONST_RETURNS is defined, this macro expands + * to nothing. By default, the macro expands to const. The macro + * can be used in place of const for functions that return a value + * that should not be modified. The purpose of this macro is to allow + * us to turn on const for returned constant strings by default, while + * allowing programmers who find that annoying to turn it off. This macro + * should only be used for return values and for "out" parameters, it + * doesn't make sense for "in" parameters. + * + * Deprecated: 2.30: API providers should replace all existing uses with + * const and API consumers should adjust their code accordingly + */ +#ifdef G_DISABLE_CONST_RETURNS +#define G_CONST_RETURN GLIB_DEPRECATED_MACRO_IN_2_30_FOR(const) +#else +#define G_CONST_RETURN const GLIB_DEPRECATED_MACRO_IN_2_30_FOR(const) +#endif + +/** + * G_NORETURN: + * + * Expands to the GNU C or MSVC `noreturn` function attribute depending on + * the compiler. It is used for declaring functions which never return. + * Enables optimization of the function, and avoids possible compiler warnings. + * + * Note that %G_NORETURN supersedes the previous %G_GNUC_NORETURN macro, which + * will eventually be deprecated. %G_NORETURN supports more platforms. + * + * Place the attribute before the function declaration as follows: + * + * |[ + * G_NORETURN void g_abort (void); + * ]| + * + * Since: 2.68 + */ +/* Note: We can’t annotate this with GLIB_AVAILABLE_MACRO_IN_2_68 because it’s + * used within the GLib headers in function declarations which are always + * evaluated when a header is included. This results in warnings in third party + * code which includes glib.h, even if the third party code doesn’t use the new + * macro itself. */ +#if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__)) || (0x5110 <= __SUNPRO_C) + /* For compatibility with G_NORETURN_FUNCPTR on clang, use + __attribute__((__noreturn__)), not _Noreturn. */ +# define G_NORETURN __attribute__ ((__noreturn__)) +#elif 1200 <= _MSC_VER + /* Use MSVC specific syntax. */ +# define G_NORETURN __declspec (noreturn) + /* Use ISO C++11 syntax when the compiler supports it. */ +#elif (__cplusplus >= 201103 && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) || (_MSC_VER >= 1900) +# define G_NORETURN [[noreturn]] + /* Use ISO C11 syntax when the compiler supports it. */ +#elif __STDC_VERSION__ >= 201112 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) +# define G_NORETURN _Noreturn +#else +# define G_NORETURN /* empty */ +#endif + +/** + * G_NORETURN_FUNCPTR: + * + * Expands to the GNU C or MSVC `noreturn` function attribute depending on + * the compiler. It is used for declaring function pointers which never return. + * Enables optimization of the function, and avoids possible compiler warnings. + * + * Place the attribute before the function declaration as follows: + * + * |[ + * G_NORETURN_FUNCPTR void (*funcptr) (void); + * ]| + * + * Note that if the function is not a function pointer, you can simply use + * the %G_NORETURN macro as follows: + * + * |[ + * G_NORETURN void g_abort (void); + * ]| + * + * Since: 2.68 + */ +#if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__)) || (0x5110 <= __SUNPRO_C) +# define G_NORETURN_FUNCPTR __attribute__ ((__noreturn__)) \ + GLIB_AVAILABLE_MACRO_IN_2_68 +#else +# define G_NORETURN_FUNCPTR /* empty */ \ + GLIB_AVAILABLE_MACRO_IN_2_68 +#endif + +/* + * The G_LIKELY and G_UNLIKELY macros let the programmer give hints to + * the compiler about the expected result of an expression. Some compilers + * can use this information for optimizations. + * + * The _G_BOOLEAN_EXPR macro is intended to trigger a gcc warning when + * putting assignments in g_return_if_fail (). + */ +#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) +#define _G_BOOLEAN_EXPR(expr) \ + G_GNUC_EXTENSION ({ \ + int _g_boolean_var_; \ + if (expr) \ + _g_boolean_var_ = 1; \ + else \ + _g_boolean_var_ = 0; \ + _g_boolean_var_; \ +}) +#define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1)) +#define G_UNLIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 0)) +#else +#define G_LIKELY(expr) (expr) +#define G_UNLIKELY(expr) (expr) +#endif + +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || defined (__clang__) +#define G_DEPRECATED __attribute__((__deprecated__)) +#elif defined(_MSC_VER) && (_MSC_VER >= 1300) +#define G_DEPRECATED __declspec(deprecated) +#else +#define G_DEPRECATED +#endif + +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || defined (__clang__) +#define G_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead"))) +#elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320) +#define G_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead")) +#else +#define G_DEPRECATED_FOR(f) G_DEPRECATED +#endif + +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || defined (__clang__) +#define G_UNAVAILABLE(maj,min) __attribute__((deprecated("Not available before " #maj "." #min))) +#elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320) +#define G_UNAVAILABLE(maj,min) __declspec(deprecated("is not available before " #maj "." #min)) +#else +#define G_UNAVAILABLE(maj,min) G_DEPRECATED +#endif + +#ifndef _GLIB_EXTERN +#define _GLIB_EXTERN extern +#endif + +/* These macros are used to mark deprecated symbols in GLib headers, + * and thus have to be exposed in installed headers. But please + * do *not* use them in other projects. Instead, use G_DEPRECATED + * or define your own wrappers around it. + */ + +#ifdef GLIB_DISABLE_DEPRECATION_WARNINGS +#define GLIB_DEPRECATED _GLIB_EXTERN +#define GLIB_DEPRECATED_FOR(f) _GLIB_EXTERN +#define GLIB_UNAVAILABLE(maj,min) _GLIB_EXTERN +#define GLIB_UNAVAILABLE_STATIC_INLINE(maj,min) +#else +#define GLIB_DEPRECATED G_DEPRECATED _GLIB_EXTERN +#define GLIB_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GLIB_EXTERN +#define GLIB_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _GLIB_EXTERN +#define GLIB_UNAVAILABLE_STATIC_INLINE(maj,min) G_UNAVAILABLE(maj,min) +#endif + +#if !defined(GLIB_DISABLE_DEPRECATION_WARNINGS) && \ + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || \ + __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4)) +#define _GLIB_GNUC_DO_PRAGMA(x) _Pragma(G_STRINGIFY (x)) +#define GLIB_DEPRECATED_MACRO _GLIB_GNUC_DO_PRAGMA(GCC warning "Deprecated pre-processor symbol") +#define GLIB_DEPRECATED_MACRO_FOR(f) _GLIB_GNUC_DO_PRAGMA(GCC warning "Deprecated pre-processor symbol, replace with " #f) +#define GLIB_UNAVAILABLE_MACRO(maj,min) _GLIB_GNUC_DO_PRAGMA(GCC warning "Not available before " #maj "." #min) +#else +#define GLIB_DEPRECATED_MACRO +#define GLIB_DEPRECATED_MACRO_FOR(f) +#define GLIB_UNAVAILABLE_MACRO(maj,min) +#endif + +#if !defined(GLIB_DISABLE_DEPRECATION_WARNINGS) && \ + ((defined (__GNUC__) && (__GNUC__ > 6 || (__GNUC__ == 6 && __GNUC_MINOR__ >= 1))) || \ + (defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0)))) +#define GLIB_DEPRECATED_ENUMERATOR G_DEPRECATED +#define GLIB_DEPRECATED_ENUMERATOR_FOR(f) G_DEPRECATED_FOR(f) +#define GLIB_UNAVAILABLE_ENUMERATOR(maj,min) G_UNAVAILABLE(maj,min) +#else +#define GLIB_DEPRECATED_ENUMERATOR +#define GLIB_DEPRECATED_ENUMERATOR_FOR(f) +#define GLIB_UNAVAILABLE_ENUMERATOR(maj,min) +#endif + +#if !defined(GLIB_DISABLE_DEPRECATION_WARNINGS) && \ + ((defined (__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))) || \ + (defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0)))) +#define GLIB_DEPRECATED_TYPE G_DEPRECATED +#define GLIB_DEPRECATED_TYPE_FOR(f) G_DEPRECATED_FOR(f) +#define GLIB_UNAVAILABLE_TYPE(maj,min) G_UNAVAILABLE(maj,min) +#else +#define GLIB_DEPRECATED_TYPE +#define GLIB_DEPRECATED_TYPE_FOR(f) +#define GLIB_UNAVAILABLE_TYPE(maj,min) +#endif + +#ifndef __GI_SCANNER__ + +#if defined (__GNUC__) || defined (__clang__) + +/* these macros are private */ +#define _GLIB_AUTOPTR_FUNC_NAME(TypeName) glib_autoptr_cleanup_##TypeName +#define _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) glib_autoptr_clear_##TypeName +#define _GLIB_AUTOPTR_TYPENAME(TypeName) TypeName##_autoptr +#define _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName) glib_listautoptr_cleanup_##TypeName +#define _GLIB_AUTOPTR_LIST_TYPENAME(TypeName) TypeName##_listautoptr +#define _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) glib_slistautoptr_cleanup_##TypeName +#define _GLIB_AUTOPTR_SLIST_TYPENAME(TypeName) TypeName##_slistautoptr +#define _GLIB_AUTOPTR_QUEUE_FUNC_NAME(TypeName) glib_queueautoptr_cleanup_##TypeName +#define _GLIB_AUTOPTR_QUEUE_TYPENAME(TypeName) TypeName##_queueautoptr +#define _GLIB_AUTO_FUNC_NAME(TypeName) glib_auto_cleanup_##TypeName +#define _GLIB_CLEANUP(func) __attribute__((cleanup(func))) +#define _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(TypeName, ParentName, cleanup) \ + typedef TypeName *_GLIB_AUTOPTR_TYPENAME(TypeName); \ + typedef GList *_GLIB_AUTOPTR_LIST_TYPENAME(TypeName); \ + typedef GSList *_GLIB_AUTOPTR_SLIST_TYPENAME(TypeName); \ + typedef GQueue *_GLIB_AUTOPTR_QUEUE_TYPENAME(TypeName); \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) (TypeName *_ptr) \ + { if (_ptr) (cleanup) ((ParentName *) _ptr); } \ + static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_FUNC_NAME(TypeName) (TypeName **_ptr) \ + { _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) (*_ptr); } \ + static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName) (GList **_l) \ + { g_list_free_full (*_l, (GDestroyNotify) (void(*)(void)) cleanup); } \ + static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) (GSList **_l) \ + { g_slist_free_full (*_l, (GDestroyNotify) (void(*)(void)) cleanup); } \ + static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_QUEUE_FUNC_NAME(TypeName) (GQueue **_q) \ + { if (*_q) g_queue_free_full (*_q, (GDestroyNotify) (void(*)(void)) cleanup); } \ + G_GNUC_END_IGNORE_DEPRECATIONS +#define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName) \ + _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(ModuleObjName, ParentName, _GLIB_AUTOPTR_CLEAR_FUNC_NAME(ParentName)) + + +/* these macros are API */ +#define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func) \ + _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(TypeName, TypeName, func) +#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + static G_GNUC_UNUSED inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { (func) (_ptr); } \ + G_GNUC_END_IGNORE_DEPRECATIONS +#define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none) \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + static G_GNUC_UNUSED inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { if (*_ptr != none) (func) (*_ptr); } \ + G_GNUC_END_IGNORE_DEPRECATIONS +#define g_autoptr(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_TYPENAME(TypeName) +#define g_autolist(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_LIST_TYPENAME(TypeName) +#define g_autoslist(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_SLIST_TYPENAME(TypeName) +#define g_autoqueue(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_QUEUE_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_QUEUE_TYPENAME(TypeName) +#define g_auto(TypeName) _GLIB_CLEANUP(_GLIB_AUTO_FUNC_NAME(TypeName)) TypeName +#define g_autofree _GLIB_CLEANUP(g_autoptr_cleanup_generic_gfree) + +#else /* not GNU C */ +/* this (dummy) macro is private */ +#define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName) + +/* these (dummy) macros are API */ +#define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func) +#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) +#define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none) + +/* no declaration of g_auto() or g_autoptr() here */ +#endif /* __GNUC__ */ + +#else + +#define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName) + +#define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func) +#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) +#define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none) + +#endif /* __GI_SCANNER__ */ + +/** + * G_SIZEOF_MEMBER: + * @struct_type: a structure type, e.g. #GOutputVector + * @member: a field in the structure, e.g. `size` + * + * Returns the size of @member in the struct definition without having a + * declared instance of @struct_type. + * + * Returns: the size of @member in bytes. + * + * Since: 2.64 + */ +#define G_SIZEOF_MEMBER(struct_type, member) \ + GLIB_AVAILABLE_MACRO_IN_2_64 \ + sizeof (((struct_type *) 0)->member) + +#endif /* __G_MACROS_H__ */ + +#include +#include +#define GLIB_HAVE_ALLOCA_H + +/* Specifies that GLib's g_print*() functions wrap the + * system printf functions. This is useful to know, for example, + * when using glibc's register_printf_function(). + */ +#undef GLIB_USING_SYSTEM_PRINTF + +#define GLIB_STATIC_COMPILATION 1 +#define GOBJECT_STATIC_COMPILATION 1 +#define GIO_STATIC_COMPILATION 1 + +G_BEGIN_DECLS + +#define G_MINFLOAT FLT_MIN +#define G_MAXFLOAT FLT_MAX +#define G_MINDOUBLE DBL_MIN +#define G_MAXDOUBLE DBL_MAX +#define G_MINSHORT SHRT_MIN +#define G_MAXSHORT SHRT_MAX +#define G_MAXUSHORT USHRT_MAX +#define G_MININT INT_MIN +#define G_MAXINT INT_MAX +#define G_MAXUINT UINT_MAX +#define G_MINLONG LONG_MIN +#define G_MAXLONG LONG_MAX +#define G_MAXULONG ULONG_MAX + +typedef signed char gint8; +typedef unsigned char guint8; + +typedef signed short gint16; +typedef unsigned short guint16; + +#define G_GINT16_MODIFIER "h" +#define G_GINT16_FORMAT "hi" +#define G_GUINT16_FORMAT "hu" + + +typedef signed int gint32; +typedef unsigned int guint32; + +#define G_GINT32_MODIFIER "" +#define G_GINT32_FORMAT "i" +#define G_GUINT32_FORMAT "u" + + +#define G_HAVE_GINT64 1 /* deprecated, always true */ + +typedef signed long gint64; +typedef unsigned long guint64; + +#define G_GINT64_CONSTANT(val) (val##L) +#define G_GUINT64_CONSTANT(val) (val##UL) + +#define G_GINT64_MODIFIER "l" +#define G_GINT64_FORMAT "li" +#define G_GUINT64_FORMAT "lu" + + +#define GLIB_SIZEOF_VOID_P 8 +#define GLIB_SIZEOF_LONG 8 +#define GLIB_SIZEOF_SIZE_T 8 +#define GLIB_SIZEOF_SSIZE_T 8 + +typedef signed long gssize; +typedef unsigned long gsize; +#define G_GSIZE_MODIFIER "l" +#define G_GSSIZE_MODIFIER "l" +#define G_GSIZE_FORMAT "lu" +#define G_GSSIZE_FORMAT "li" + +#define G_MAXSIZE G_MAXULONG +#define G_MINSSIZE G_MINLONG +#define G_MAXSSIZE G_MAXLONG + +typedef gint64 goffset; +#define G_MINOFFSET G_MININT64 +#define G_MAXOFFSET G_MAXINT64 + +#define G_GOFFSET_MODIFIER G_GINT64_MODIFIER +#define G_GOFFSET_FORMAT G_GINT64_FORMAT +#define G_GOFFSET_CONSTANT(val) G_GINT64_CONSTANT(val) + +#define G_POLLFD_FORMAT "%d" + +#define GPOINTER_TO_INT(p) ((gint) (glong) (p)) +#define GPOINTER_TO_UINT(p) ((guint) (gulong) (p)) + +#define GINT_TO_POINTER(i) ((gpointer) (glong) (i)) +#define GUINT_TO_POINTER(u) ((gpointer) (gulong) (u)) + +typedef signed long gintptr; +typedef unsigned long guintptr; + +#define G_GINTPTR_MODIFIER "l" +#define G_GINTPTR_FORMAT "li" +#define G_GUINTPTR_FORMAT "lu" + +#define GLIB_MAJOR_VERSION 2 +#define GLIB_MINOR_VERSION 67 +#define GLIB_MICRO_VERSION 1 + +#define G_OS_UNIX + +#define G_VA_COPY va_copy + + +#ifndef __cplusplus +# define G_HAVE_ISO_VARARGS 1 +#endif + +#ifdef __cplusplus +# define G_HAVE_ISO_VARARGS 1 +#endif + +/* gcc-2.95.x supports both gnu style and ISO varargs, but if -ansi + * is passed ISO vararg support is turned off, and there is no work + * around to turn it on, so we unconditionally turn it off. + */ +#if __GNUC__ == 2 && __GNUC_MINOR__ == 95 +# undef G_HAVE_ISO_VARARGS +#endif + +#define G_HAVE_GROWING_STACK 0 +#define G_HAVE_GNUC_VISIBILITY 1 + +#ifndef _MSC_VER +# define G_HAVE_GNUC_VARARGS 1 +#endif + +#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) +#define G_GNUC_INTERNAL __attribute__((visibility("hidden"))) +#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) +#define G_GNUC_INTERNAL __hidden +#elif defined (__GNUC__) && defined (G_HAVE_GNUC_VISIBILITY) +#define G_GNUC_INTERNAL __attribute__((visibility("hidden"))) +#else +#define G_GNUC_INTERNAL +#endif + +#define G_THREADS_ENABLED +#define G_THREADS_IMPL_POSIX + +#define G_ATOMIC_LOCK_FREE + +#define GINT16_TO_LE(val) ((gint16) (val)) +#define GUINT16_TO_LE(val) ((guint16) (val)) +#define GINT16_TO_BE(val) ((gint16) GUINT16_SWAP_LE_BE (val)) +#define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) + +#define GINT32_TO_LE(val) ((gint32) (val)) +#define GUINT32_TO_LE(val) ((guint32) (val)) +#define GINT32_TO_BE(val) ((gint32) GUINT32_SWAP_LE_BE (val)) +#define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val)) + +#define GINT64_TO_LE(val) ((gint64) (val)) +#define GUINT64_TO_LE(val) ((guint64) (val)) +#define GINT64_TO_BE(val) ((gint64) GUINT64_SWAP_LE_BE (val)) +#define GUINT64_TO_BE(val) (GUINT64_SWAP_LE_BE (val)) + +#define GLONG_TO_LE(val) ((glong) GINT64_TO_LE (val)) +#define GULONG_TO_LE(val) ((gulong) GUINT64_TO_LE (val)) +#define GLONG_TO_BE(val) ((glong) GINT64_TO_BE (val)) +#define GULONG_TO_BE(val) ((gulong) GUINT64_TO_BE (val)) +#define GINT_TO_LE(val) ((gint) GINT32_TO_LE (val)) +#define GUINT_TO_LE(val) ((guint) GUINT32_TO_LE (val)) +#define GINT_TO_BE(val) ((gint) GINT32_TO_BE (val)) +#define GUINT_TO_BE(val) ((guint) GUINT32_TO_BE (val)) +#define GSIZE_TO_LE(val) ((gsize) GUINT64_TO_LE (val)) +#define GSSIZE_TO_LE(val) ((gssize) GINT64_TO_LE (val)) +#define GSIZE_TO_BE(val) ((gsize) GUINT64_TO_BE (val)) +#define GSSIZE_TO_BE(val) ((gssize) GINT64_TO_BE (val)) +#define G_BYTE_ORDER G_LITTLE_ENDIAN + +#define GLIB_SYSDEF_POLLIN =1 +#define GLIB_SYSDEF_POLLOUT =4 +#define GLIB_SYSDEF_POLLPRI =2 +#define GLIB_SYSDEF_POLLHUP =16 +#define GLIB_SYSDEF_POLLERR =8 +#define GLIB_SYSDEF_POLLNVAL =32 + +#define G_MODULE_SUFFIX "so" + +typedef int GPid; +#define G_PID_FORMAT "i" + +#define GLIB_SYSDEF_AF_UNIX 1 +#define GLIB_SYSDEF_AF_INET 2 +#define GLIB_SYSDEF_AF_INET6 10 + +#define GLIB_SYSDEF_MSG_OOB 1 +#define GLIB_SYSDEF_MSG_PEEK 2 +#define GLIB_SYSDEF_MSG_DONTROUTE 4 + +#define G_DIR_SEPARATOR '/' +#define G_DIR_SEPARATOR_S "/" +#define G_SEARCHPATH_SEPARATOR ':' +#define G_SEARCHPATH_SEPARATOR_S ":" + +G_END_DECLS + +#endif /* __GLIBCONFIG_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_VERSION_MACROS_H__ +#define __G_VERSION_MACROS_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +/* Version boundaries checks */ + +#define G_ENCODE_VERSION(major,minor) ((major) << 16 | (minor) << 8) + +/* XXX: Every new stable minor release bump should add a macro here */ + +/** + * GLIB_VERSION_2_26: + * + * A macro that evaluates to the 2.26 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.32 + */ +#define GLIB_VERSION_2_26 (G_ENCODE_VERSION (2, 26)) + +/** + * GLIB_VERSION_2_28: + * + * A macro that evaluates to the 2.28 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.32 + */ +#define GLIB_VERSION_2_28 (G_ENCODE_VERSION (2, 28)) + +/** + * GLIB_VERSION_2_30: + * + * A macro that evaluates to the 2.30 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.32 + */ +#define GLIB_VERSION_2_30 (G_ENCODE_VERSION (2, 30)) + +/** + * GLIB_VERSION_2_32: + * + * A macro that evaluates to the 2.32 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.32 + */ +#define GLIB_VERSION_2_32 (G_ENCODE_VERSION (2, 32)) + +/** + * GLIB_VERSION_2_34: + * + * A macro that evaluates to the 2.34 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.34 + */ +#define GLIB_VERSION_2_34 (G_ENCODE_VERSION (2, 34)) + +/** + * GLIB_VERSION_2_36: + * + * A macro that evaluates to the 2.36 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.36 + */ +#define GLIB_VERSION_2_36 (G_ENCODE_VERSION (2, 36)) + +/** + * GLIB_VERSION_2_38: + * + * A macro that evaluates to the 2.38 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.38 + */ +#define GLIB_VERSION_2_38 (G_ENCODE_VERSION (2, 38)) + +/** + * GLIB_VERSION_2_40: + * + * A macro that evaluates to the 2.40 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.40 + */ +#define GLIB_VERSION_2_40 (G_ENCODE_VERSION (2, 40)) + +/** + * GLIB_VERSION_2_42: + * + * A macro that evaluates to the 2.42 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.42 + */ +#define GLIB_VERSION_2_42 (G_ENCODE_VERSION (2, 42)) + +/** + * GLIB_VERSION_2_44: + * + * A macro that evaluates to the 2.44 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.44 + */ +#define GLIB_VERSION_2_44 (G_ENCODE_VERSION (2, 44)) + +/** + * GLIB_VERSION_2_46: + * + * A macro that evaluates to the 2.46 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.46 + */ +#define GLIB_VERSION_2_46 (G_ENCODE_VERSION (2, 46)) + +/** + * GLIB_VERSION_2_48: + * + * A macro that evaluates to the 2.48 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.48 + */ +#define GLIB_VERSION_2_48 (G_ENCODE_VERSION (2, 48)) + +/** + * GLIB_VERSION_2_50: + * + * A macro that evaluates to the 2.50 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.50 + */ +#define GLIB_VERSION_2_50 (G_ENCODE_VERSION (2, 50)) + +/** + * GLIB_VERSION_2_52: + * + * A macro that evaluates to the 2.52 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.52 + */ +#define GLIB_VERSION_2_52 (G_ENCODE_VERSION (2, 52)) + +/** + * GLIB_VERSION_2_54: + * + * A macro that evaluates to the 2.54 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.54 + */ +#define GLIB_VERSION_2_54 (G_ENCODE_VERSION (2, 54)) + +/** + * GLIB_VERSION_2_56: + * + * A macro that evaluates to the 2.56 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.56 + */ +#define GLIB_VERSION_2_56 (G_ENCODE_VERSION (2, 56)) + +/** + * GLIB_VERSION_2_58: + * + * A macro that evaluates to the 2.58 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.58 + */ +#define GLIB_VERSION_2_58 (G_ENCODE_VERSION (2, 58)) + +/** + * GLIB_VERSION_2_60: + * + * A macro that evaluates to the 2.60 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.60 + */ +#define GLIB_VERSION_2_60 (G_ENCODE_VERSION (2, 60)) + +/** + * GLIB_VERSION_2_62: + * + * A macro that evaluates to the 2.62 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.62 + */ +#define GLIB_VERSION_2_62 (G_ENCODE_VERSION (2, 62)) + +/** + * GLIB_VERSION_2_64: + * + * A macro that evaluates to the 2.64 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.64 + */ +#define GLIB_VERSION_2_64 (G_ENCODE_VERSION (2, 64)) + +/** + * GLIB_VERSION_2_66: + * + * A macro that evaluates to the 2.66 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.66 + */ +#define GLIB_VERSION_2_66 (G_ENCODE_VERSION (2, 66)) + +/** + * GLIB_VERSION_2_68: + * + * A macro that evaluates to the 2.68 version of GLib, in a format + * that can be used by the C pre-processor. + * + * Since: 2.68 + */ +#define GLIB_VERSION_2_68 (G_ENCODE_VERSION (2, 68)) + +/* evaluates to the current stable version; for development cycles, + * this means the next stable target + */ +#if (GLIB_MINOR_VERSION % 2) +#define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1)) +#else +#define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION)) +#endif + +/* evaluates to the previous stable version */ +#if (GLIB_MINOR_VERSION % 2) +#define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1)) +#else +#define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2)) +#endif + +/** + * GLIB_VERSION_MIN_REQUIRED: + * + * A macro that should be defined by the user prior to including + * the glib.h header. + * The definition should be one of the predefined GLib version + * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,... + * + * This macro defines the earliest version of GLib that the package is + * required to be able to compile against. + * + * If the compiler is configured to warn about the use of deprecated + * functions, then using functions that were deprecated in version + * %GLIB_VERSION_MIN_REQUIRED or earlier will cause warnings (but + * using functions deprecated in later releases will not). + * + * Since: 2.32 + */ +/* If the package sets GLIB_VERSION_MIN_REQUIRED to some future + * GLIB_VERSION_X_Y value that we don't know about, it will compare as + * 0 in preprocessor tests. + */ +#ifndef GLIB_VERSION_MIN_REQUIRED +# define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE) +#elif GLIB_VERSION_MIN_REQUIRED == 0 +# undef GLIB_VERSION_MIN_REQUIRED +# define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE + 2) +#endif + +/** + * GLIB_VERSION_MAX_ALLOWED: + * + * A macro that should be defined by the user prior to including + * the glib.h header. + * The definition should be one of the predefined GLib version + * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,... + * + * This macro defines the latest version of the GLib API that the + * package is allowed to make use of. + * + * If the compiler is configured to warn about the use of deprecated + * functions, then using functions added after version + * %GLIB_VERSION_MAX_ALLOWED will cause warnings. + * + * Unless you are using GLIB_CHECK_VERSION() or the like to compile + * different code depending on the GLib version, then this should be + * set to the same value as %GLIB_VERSION_MIN_REQUIRED. + * + * Since: 2.32 + */ +#if !defined (GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0) +# undef GLIB_VERSION_MAX_ALLOWED +# define GLIB_VERSION_MAX_ALLOWED (GLIB_VERSION_CUR_STABLE) +#endif + +/* sanity checks */ +#if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE +#error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE" +#endif +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED +#error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED" +#endif +#if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26 +#error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26" +#endif + +/* These macros are used to mark deprecated functions in GLib headers, + * and thus have to be exposed in installed headers. But please + * do *not* use them in other projects. Instead, use G_DEPRECATED + * or define your own wrappers around it. + */ +#define GLIB_AVAILABLE_IN_ALL _GLIB_EXTERN + +/* XXX: Every new stable minor release should add a set of macros here */ + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26 +# define GLIB_DEPRECATED_IN_2_26 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_26_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_26 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_26_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_26 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_26_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_26 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_26_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_26 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_26_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_26 +# define GLIB_DEPRECATED_MACRO_IN_2_26_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_26 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_26_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_26 +# define GLIB_DEPRECATED_TYPE_IN_2_26_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26 +# define GLIB_AVAILABLE_IN_2_26 GLIB_UNAVAILABLE(2, 26) +# define GLIB_AVAILABLE_MACRO_IN_2_26 GLIB_UNAVAILABLE_MACRO(2, 26) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_26 GLIB_UNAVAILABLE_ENUMERATOR(2, 26) +# define GLIB_AVAILABLE_TYPE_IN_2_26 GLIB_UNAVAILABLE_TYPE(2, 26) +#else +# define GLIB_AVAILABLE_IN_2_26 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_26 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_26 +# define GLIB_AVAILABLE_TYPE_IN_2_26 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28 +# define GLIB_DEPRECATED_IN_2_28 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_28_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_28 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_28_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_28 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_28_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_28 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_28_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_28 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_28_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_28 +# define GLIB_DEPRECATED_MACRO_IN_2_28_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_28 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_28_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_28 +# define GLIB_DEPRECATED_TYPE_IN_2_28_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28 +# define GLIB_AVAILABLE_IN_2_28 GLIB_UNAVAILABLE(2, 28) +# define GLIB_AVAILABLE_MACRO_IN_2_28 GLIB_UNAVAILABLE_MACRO(2, 28) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_28 GLIB_UNAVAILABLE_ENUMERATOR(2, 28) +# define GLIB_AVAILABLE_TYPE_IN_2_28 GLIB_UNAVAILABLE_TYPE(2, 28) +#else +# define GLIB_AVAILABLE_IN_2_28 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_28 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_28 +# define GLIB_AVAILABLE_TYPE_IN_2_28 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30 +# define GLIB_DEPRECATED_IN_2_30 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_30_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_30 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_30_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_30 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_30_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_30 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_30_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_30 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_30_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_30 +# define GLIB_DEPRECATED_MACRO_IN_2_30_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_30 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_30_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_30 +# define GLIB_DEPRECATED_TYPE_IN_2_30_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30 +# define GLIB_AVAILABLE_IN_2_30 GLIB_UNAVAILABLE(2, 30) +# define GLIB_AVAILABLE_MACRO_IN_2_30 GLIB_UNAVAILABLE_MACRO(2, 30) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_30 GLIB_UNAVAILABLE_ENUMERATOR(2, 30) +# define GLIB_AVAILABLE_TYPE_IN_2_30 GLIB_UNAVAILABLE_TYPE(2, 30) +#else +# define GLIB_AVAILABLE_IN_2_30 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_30 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_30 +# define GLIB_AVAILABLE_TYPE_IN_2_30 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32 +# define GLIB_DEPRECATED_IN_2_32 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_32_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_32 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_32_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_32 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_32_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_32 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_32_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_32 +# define GLIB_DEPRECATED_MACRO_IN_2_32_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_32 +# define GLIB_DEPRECATED_TYPE_IN_2_32_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_32 +# define GLIB_DEPRECATED_TYPE_IN_2_32_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32 +# define GLIB_AVAILABLE_IN_2_32 GLIB_UNAVAILABLE(2, 32) +# define GLIB_AVAILABLE_MACRO_IN_2_32 GLIB_UNAVAILABLE_MACRO(2, 32) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_32 GLIB_UNAVAILABLE_ENUMERATOR(2, 32) +# define GLIB_AVAILABLE_TYPE_IN_2_32 GLIB_UNAVAILABLE_TYPE(2, 32) +#else +# define GLIB_AVAILABLE_IN_2_32 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_32 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_32 +# define GLIB_AVAILABLE_TYPE_IN_2_32 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34 +# define GLIB_DEPRECATED_IN_2_34 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_34_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_34 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_34_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_34 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_34_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_34 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_34_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_34 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_34_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_34 +# define GLIB_DEPRECATED_MACRO_IN_2_34_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_34 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_34_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_34 +# define GLIB_DEPRECATED_TYPE_IN_2_34_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34 +# define GLIB_AVAILABLE_IN_2_34 GLIB_UNAVAILABLE(2, 34) +# define GLIB_AVAILABLE_MACRO_IN_2_34 GLIB_UNAVAILABLE_MACRO(2, 34) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_34 GLIB_UNAVAILABLE_ENUMERATOR(2, 34) +# define GLIB_AVAILABLE_TYPE_IN_2_34 GLIB_UNAVAILABLE_TYPE(2, 34) +#else +# define GLIB_AVAILABLE_IN_2_34 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_34 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_34 +# define GLIB_AVAILABLE_TYPE_IN_2_34 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36 +# define GLIB_DEPRECATED_IN_2_36 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_36_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_36 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_36_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_36 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_36_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_36 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_36_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_36 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_36_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_36 +# define GLIB_DEPRECATED_MACRO_IN_2_36_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_36 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_36_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_36 +# define GLIB_DEPRECATED_TYPE_IN_2_36_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36 +# define GLIB_AVAILABLE_IN_2_36 GLIB_UNAVAILABLE(2, 36) +# define GLIB_AVAILABLE_MACRO_IN_2_36 GLIB_UNAVAILABLE_MACRO(2, 36) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_36 GLIB_UNAVAILABLE_ENUMERATOR(2, 36) +# define GLIB_AVAILABLE_TYPE_IN_2_36 GLIB_UNAVAILABLE_TYPE(2, 36) +#else +# define GLIB_AVAILABLE_IN_2_36 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_36 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_36 +# define GLIB_AVAILABLE_TYPE_IN_2_36 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38 +# define GLIB_DEPRECATED_IN_2_38 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_38_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_38 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_38_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_38 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_38_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_38 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_38_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_38 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_38_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_38 +# define GLIB_DEPRECATED_MACRO_IN_2_38_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_38 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_38_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_38 +# define GLIB_DEPRECATED_TYPE_IN_2_38_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 +# define GLIB_AVAILABLE_IN_2_38 GLIB_UNAVAILABLE(2, 38) +# define GLIB_AVAILABLE_MACRO_IN_2_38 GLIB_UNAVAILABLE_MACRO(2, 38) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_38 GLIB_UNAVAILABLE_ENUMERATOR(2, 38) +# define GLIB_AVAILABLE_TYPE_IN_2_38 GLIB_UNAVAILABLE_TYPE(2, 38) +#else +# define GLIB_AVAILABLE_IN_2_38 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_38 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_38 +# define GLIB_AVAILABLE_TYPE_IN_2_38 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_40 +# define GLIB_DEPRECATED_IN_2_40 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_40_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_40 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_40_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_40 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_40_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_40 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_40_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_40 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_40_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_40 +# define GLIB_DEPRECATED_MACRO_IN_2_40_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_40 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_40_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_40 +# define GLIB_DEPRECATED_TYPE_IN_2_40_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40 +# define GLIB_AVAILABLE_IN_2_40 GLIB_UNAVAILABLE(2, 40) +# define GLIB_AVAILABLE_MACRO_IN_2_40 GLIB_UNAVAILABLE_MACRO(2, 40) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_40 GLIB_UNAVAILABLE_ENUMERATOR(2, 40) +# define GLIB_AVAILABLE_TYPE_IN_2_40 GLIB_UNAVAILABLE_TYPE(2, 40) +#else +# define GLIB_AVAILABLE_IN_2_40 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_40 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_40 +# define GLIB_AVAILABLE_TYPE_IN_2_40 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_42 +# define GLIB_DEPRECATED_IN_2_42 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_42_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_42 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_42_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_42 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_42_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_42 +# define GLIB_DEPRECATED_MACRO_IN_2_42_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_42 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_42_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_42 +# define GLIB_DEPRECATED_TYPE_IN_2_42_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_42 +# define GLIB_AVAILABLE_IN_2_42 GLIB_UNAVAILABLE(2, 42) +# define GLIB_AVAILABLE_MACRO_IN_2_42 GLIB_UNAVAILABLE_MACRO(2, 42) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_42 GLIB_UNAVAILABLE_ENUMERATOR(2, 42) +# define GLIB_AVAILABLE_TYPE_IN_2_42 GLIB_UNAVAILABLE_TYPE(2, 42) +#else +# define GLIB_AVAILABLE_IN_2_42 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_42 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_42 +# define GLIB_AVAILABLE_TYPE_IN_2_42 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_44 +# define GLIB_DEPRECATED_IN_2_44 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_44_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_44 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_44_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_44 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_44_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_44 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_44_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_44 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_44_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_44 +# define GLIB_DEPRECATED_MACRO_IN_2_44_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_44 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_44_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_44 +# define GLIB_DEPRECATED_TYPE_IN_2_44_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_44 +# define GLIB_AVAILABLE_IN_2_44 GLIB_UNAVAILABLE(2, 44) +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 GLIB_UNAVAILABLE_STATIC_INLINE(2, 44) +# define GLIB_AVAILABLE_MACRO_IN_2_44 GLIB_UNAVAILABLE_MACRO(2, 44) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_44 GLIB_UNAVAILABLE_ENUMERATOR(2, 44) +# define GLIB_AVAILABLE_TYPE_IN_2_44 GLIB_UNAVAILABLE_TYPE(2, 44) +#else +# define GLIB_AVAILABLE_IN_2_44 _GLIB_EXTERN +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 +# define GLIB_AVAILABLE_MACRO_IN_2_44 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_44 +# define GLIB_AVAILABLE_TYPE_IN_2_44 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_46 +# define GLIB_DEPRECATED_IN_2_46 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_46_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_46 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_46_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_46 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_46_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_46 +# define GLIB_DEPRECATED_MACRO_IN_2_46_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_46 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_46_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_46 +# define GLIB_DEPRECATED_TYPE_IN_2_46_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_46 +# define GLIB_AVAILABLE_IN_2_46 GLIB_UNAVAILABLE(2, 46) +# define GLIB_AVAILABLE_MACRO_IN_2_46 GLIB_UNAVAILABLE_MACRO(2, 46) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_46 GLIB_UNAVAILABLE_ENUMERATOR(2, 46) +# define GLIB_AVAILABLE_TYPE_IN_2_46 GLIB_UNAVAILABLE_TYPE(2, 46) +#else +# define GLIB_AVAILABLE_IN_2_46 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_46 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_46 +# define GLIB_AVAILABLE_TYPE_IN_2_46 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_48 +# define GLIB_DEPRECATED_IN_2_48 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_48_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_48 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_48_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_48 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_48_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_48 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_48_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_48 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_48_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_48 +# define GLIB_DEPRECATED_MACRO_IN_2_48_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_48 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_48_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_48 +# define GLIB_DEPRECATED_TYPE_IN_2_48_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_48 +# define GLIB_AVAILABLE_IN_2_48 GLIB_UNAVAILABLE(2, 48) +# define GLIB_AVAILABLE_MACRO_IN_2_48 GLIB_UNAVAILABLE_MACRO(2, 48) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_48 GLIB_UNAVAILABLE_ENUMERATOR(2, 48) +# define GLIB_AVAILABLE_TYPE_IN_2_48 GLIB_UNAVAILABLE_TYPE(2, 48) +#else +# define GLIB_AVAILABLE_IN_2_48 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_48 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_48 +# define GLIB_AVAILABLE_TYPE_IN_2_48 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_50 +# define GLIB_DEPRECATED_IN_2_50 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_50_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_50 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_50_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_50 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_50_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_50 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_50_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_50 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_50_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_50 +# define GLIB_DEPRECATED_MACRO_IN_2_50_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_50 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_50_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_50 +# define GLIB_DEPRECATED_TYPE_IN_2_50_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_50 +# define GLIB_AVAILABLE_IN_2_50 GLIB_UNAVAILABLE(2, 50) +# define GLIB_AVAILABLE_MACRO_IN_2_50 GLIB_UNAVAILABLE_MACRO(2, 50) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_50 GLIB_UNAVAILABLE_ENUMERATOR(2, 50) +# define GLIB_AVAILABLE_TYPE_IN_2_50 GLIB_UNAVAILABLE_TYPE(2, 50) +#else +# define GLIB_AVAILABLE_IN_2_50 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_50 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_50 +# define GLIB_AVAILABLE_TYPE_IN_2_50 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_52 +# define GLIB_DEPRECATED_IN_2_52 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_52_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_52 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_52_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_52 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_52_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_52 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_52_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_52 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_52_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_52 +# define GLIB_DEPRECATED_MACRO_IN_2_52_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_52 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_52_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_52 +# define GLIB_DEPRECATED_TYPE_IN_2_52_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_52 +# define GLIB_AVAILABLE_IN_2_52 GLIB_UNAVAILABLE(2, 52) +# define GLIB_AVAILABLE_MACRO_IN_2_52 GLIB_UNAVAILABLE_MACRO(2, 52) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_52 GLIB_UNAVAILABLE_ENUMERATOR(2, 52) +# define GLIB_AVAILABLE_TYPE_IN_2_52 GLIB_UNAVAILABLE_TYPE(2, 52) +#else +# define GLIB_AVAILABLE_IN_2_52 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_52 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_52 +# define GLIB_AVAILABLE_TYPE_IN_2_52 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_54 +# define GLIB_DEPRECATED_IN_2_54 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_54_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_54 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_54_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_54 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_54_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_54 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_54_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_54 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_54_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_54 +# define GLIB_DEPRECATED_MACRO_IN_2_54_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_54 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_54_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_54 +# define GLIB_DEPRECATED_TYPE_IN_2_54_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_54 +# define GLIB_AVAILABLE_IN_2_54 GLIB_UNAVAILABLE(2, 54) +# define GLIB_AVAILABLE_MACRO_IN_2_54 GLIB_UNAVAILABLE_MACRO(2, 54) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_54 GLIB_UNAVAILABLE_ENUMERATOR(2, 54) +# define GLIB_AVAILABLE_TYPE_IN_2_54 GLIB_UNAVAILABLE_TYPE(2, 54) +#else +# define GLIB_AVAILABLE_IN_2_54 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_54 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_54 +# define GLIB_AVAILABLE_TYPE_IN_2_54 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_56 +# define GLIB_DEPRECATED_IN_2_56 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_56_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_56 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_56_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_56 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_56_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_56 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_56_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_56 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_56_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_56 +# define GLIB_DEPRECATED_MACRO_IN_2_56_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_56 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_56_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_56 +# define GLIB_DEPRECATED_TYPE_IN_2_56_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_56 +# define GLIB_AVAILABLE_IN_2_56 GLIB_UNAVAILABLE(2, 56) +# define GLIB_AVAILABLE_MACRO_IN_2_56 GLIB_UNAVAILABLE_MACRO(2, 56) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_56 GLIB_UNAVAILABLE_ENUMERATOR(2, 56) +# define GLIB_AVAILABLE_TYPE_IN_2_56 GLIB_UNAVAILABLE_TYPE(2, 56) +#else +# define GLIB_AVAILABLE_IN_2_56 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_56 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_56 +# define GLIB_AVAILABLE_TYPE_IN_2_56 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_58 +# define GLIB_DEPRECATED_IN_2_58 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_58_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_58 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_58_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_58 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_58_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_58 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_58_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_58 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_58_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_58 +# define GLIB_DEPRECATED_MACRO_IN_2_58_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_58 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_58_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_58 +# define GLIB_DEPRECATED_TYPE_IN_2_58_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_58 +# define GLIB_AVAILABLE_IN_2_58 GLIB_UNAVAILABLE(2, 58) +# define GLIB_AVAILABLE_MACRO_IN_2_58 GLIB_UNAVAILABLE_MACRO(2, 58) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_58 GLIB_UNAVAILABLE_ENUMERATOR(2, 58) +# define GLIB_AVAILABLE_TYPE_IN_2_58 GLIB_UNAVAILABLE_TYPE(2, 58) +#else +# define GLIB_AVAILABLE_IN_2_58 _GLIB_EXTERN +# define GLIB_AVAILABLE_MACRO_IN_2_58 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_58 +# define GLIB_AVAILABLE_TYPE_IN_2_58 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_60 +# define GLIB_DEPRECATED_IN_2_60 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_60_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_60 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_60_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_60 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_60_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_60 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_60_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_60 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_60_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_60 +# define GLIB_DEPRECATED_MACRO_IN_2_60_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_60 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_60_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_60 +# define GLIB_DEPRECATED_TYPE_IN_2_60_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_60 +# define GLIB_AVAILABLE_IN_2_60 GLIB_UNAVAILABLE(2, 60) +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_60 GLIB_UNAVAILABLE_STATIC_INLINE(2, 60) +# define GLIB_AVAILABLE_MACRO_IN_2_60 GLIB_UNAVAILABLE_MACRO(2, 60) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_60 GLIB_UNAVAILABLE_ENUMERATOR(2, 60) +# define GLIB_AVAILABLE_TYPE_IN_2_60 GLIB_UNAVAILABLE_TYPE(2, 60) +#else +# define GLIB_AVAILABLE_IN_2_60 _GLIB_EXTERN +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_60 +# define GLIB_AVAILABLE_MACRO_IN_2_60 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_60 +# define GLIB_AVAILABLE_TYPE_IN_2_60 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_62 +# define GLIB_DEPRECATED_IN_2_62 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_62_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_62 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_62_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_62 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_62_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_62 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_62_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_62 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_62_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_62 +# define GLIB_DEPRECATED_MACRO_IN_2_62_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_62 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_62_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_62 +# define GLIB_DEPRECATED_TYPE_IN_2_62_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_62 +# define GLIB_AVAILABLE_IN_2_62 GLIB_UNAVAILABLE(2, 62) +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 GLIB_UNAVAILABLE_STATIC_INLINE(2, 62) +# define GLIB_AVAILABLE_MACRO_IN_2_62 GLIB_UNAVAILABLE_MACRO(2, 62) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_62 GLIB_UNAVAILABLE_ENUMERATOR(2, 62) +# define GLIB_AVAILABLE_TYPE_IN_2_62 GLIB_UNAVAILABLE_TYPE(2, 62) +#else +# define GLIB_AVAILABLE_IN_2_62 _GLIB_EXTERN +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 +# define GLIB_AVAILABLE_MACRO_IN_2_62 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_62 +# define GLIB_AVAILABLE_TYPE_IN_2_62 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_64 +# define GLIB_DEPRECATED_IN_2_64 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_64_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_64 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_64_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_64 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_64_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_64 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_64_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_64 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_64_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_64 +# define GLIB_DEPRECATED_MACRO_IN_2_64_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_64 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_64_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_64 +# define GLIB_DEPRECATED_TYPE_IN_2_64_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_64 +# define GLIB_AVAILABLE_IN_2_64 GLIB_UNAVAILABLE(2, 64) +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 GLIB_UNAVAILABLE_STATIC_INLINE(2, 64) +# define GLIB_AVAILABLE_MACRO_IN_2_64 GLIB_UNAVAILABLE_MACRO(2, 64) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_64 GLIB_UNAVAILABLE_ENUMERATOR(2, 64) +# define GLIB_AVAILABLE_TYPE_IN_2_64 GLIB_UNAVAILABLE_TYPE(2, 64) +#else +# define GLIB_AVAILABLE_IN_2_64 _GLIB_EXTERN +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 +# define GLIB_AVAILABLE_MACRO_IN_2_64 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_64 +# define GLIB_AVAILABLE_TYPE_IN_2_64 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_66 +# define GLIB_DEPRECATED_IN_2_66 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_66_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_66 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_66_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_66 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_66_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_66 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_66_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_66 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_66_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_66 +# define GLIB_DEPRECATED_MACRO_IN_2_66_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_66 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_66_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_66 +# define GLIB_DEPRECATED_TYPE_IN_2_66_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_66 +# define GLIB_AVAILABLE_IN_2_66 GLIB_UNAVAILABLE(2, 66) +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_66 GLIB_UNAVAILABLE_STATIC_INLINE(2, 66) +# define GLIB_AVAILABLE_MACRO_IN_2_66 GLIB_UNAVAILABLE_MACRO(2, 66) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_66 GLIB_UNAVAILABLE_ENUMERATOR(2, 66) +# define GLIB_AVAILABLE_TYPE_IN_2_66 GLIB_UNAVAILABLE_TYPE(2, 66) +#else +# define GLIB_AVAILABLE_IN_2_66 _GLIB_EXTERN +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_66 +# define GLIB_AVAILABLE_MACRO_IN_2_66 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_66 +# define GLIB_AVAILABLE_TYPE_IN_2_66 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68 +# define GLIB_DEPRECATED_IN_2_68 GLIB_DEPRECATED +# define GLIB_DEPRECATED_IN_2_68_FOR(f) GLIB_DEPRECATED_FOR(f) +# define GLIB_DEPRECATED_MACRO_IN_2_68 GLIB_DEPRECATED_MACRO +# define GLIB_DEPRECATED_MACRO_IN_2_68_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_68 GLIB_DEPRECATED_ENUMERATOR +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_68_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_68 GLIB_DEPRECATED_TYPE +# define GLIB_DEPRECATED_TYPE_IN_2_68_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) +#else +# define GLIB_DEPRECATED_IN_2_68 _GLIB_EXTERN +# define GLIB_DEPRECATED_IN_2_68_FOR(f) _GLIB_EXTERN +# define GLIB_DEPRECATED_MACRO_IN_2_68 +# define GLIB_DEPRECATED_MACRO_IN_2_68_FOR(f) +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_68 +# define GLIB_DEPRECATED_ENUMERATOR_IN_2_68_FOR(f) +# define GLIB_DEPRECATED_TYPE_IN_2_68 +# define GLIB_DEPRECATED_TYPE_IN_2_68_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_68 +# define GLIB_AVAILABLE_IN_2_68 GLIB_UNAVAILABLE(2, 68) +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_68 GLIB_UNAVAILABLE_STATIC_INLINE(2, 68) +# define GLIB_AVAILABLE_MACRO_IN_2_68 GLIB_UNAVAILABLE_MACRO(2, 68) +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_68 GLIB_UNAVAILABLE_ENUMERATOR(2, 68) +# define GLIB_AVAILABLE_TYPE_IN_2_68 GLIB_UNAVAILABLE_TYPE(2, 68) +#else +# define GLIB_AVAILABLE_IN_2_68 _GLIB_EXTERN +# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_68 +# define GLIB_AVAILABLE_MACRO_IN_2_68 +# define GLIB_AVAILABLE_ENUMERATOR_IN_2_68 +# define GLIB_AVAILABLE_TYPE_IN_2_68 +#endif + +#endif /* __G_VERSION_MACROS_H__ */ +#include + +G_BEGIN_DECLS + +/* Provide type definitions for commonly used types. + * These are useful because a "gint8" can be adjusted + * to be 1 byte (8 bits) on all platforms. Similarly and + * more importantly, "gint32" can be adjusted to be + * 4 bytes (32 bits) on all platforms. + */ + +typedef char gchar; +typedef short gshort; +typedef long glong; +typedef int gint; +typedef gint gboolean; + +typedef unsigned char guchar; +typedef unsigned short gushort; +typedef unsigned long gulong; +typedef unsigned int guint; + +typedef float gfloat; +typedef double gdouble; + +/* Define min and max constants for the fixed size numerical types */ +/** + * G_MININT8: (value -128) + * + * The minimum value which can be held in a #gint8. + * + * Since: 2.4 + */ +#define G_MININT8 ((gint8) (-G_MAXINT8 - 1)) +#define G_MAXINT8 ((gint8) 0x7f) +#define G_MAXUINT8 ((guint8) 0xff) + +/** + * G_MININT16: (value -32768) + * + * The minimum value which can be held in a #gint16. + * + * Since: 2.4 + */ +#define G_MININT16 ((gint16) (-G_MAXINT16 - 1)) +#define G_MAXINT16 ((gint16) 0x7fff) +#define G_MAXUINT16 ((guint16) 0xffff) + +/** + * G_MININT32: (value -2147483648) + * + * The minimum value which can be held in a #gint32. + * + * Since: 2.4 + */ +#define G_MININT32 ((gint32) (-G_MAXINT32 - 1)) +#define G_MAXINT32 ((gint32) 0x7fffffff) +#define G_MAXUINT32 ((guint32) 0xffffffff) + +/** + * G_MININT64: (value -9223372036854775808) + * + * The minimum value which can be held in a #gint64. + */ +#define G_MININT64 ((gint64) (-G_MAXINT64 - G_GINT64_CONSTANT(1))) +#define G_MAXINT64 G_GINT64_CONSTANT(0x7fffffffffffffff) +#define G_MAXUINT64 G_GUINT64_CONSTANT(0xffffffffffffffff) + +typedef void* gpointer; +typedef const void *gconstpointer; + +typedef gint (*GCompareFunc) (gconstpointer a, + gconstpointer b); +typedef gint (*GCompareDataFunc) (gconstpointer a, + gconstpointer b, + gpointer user_data); +typedef gboolean (*GEqualFunc) (gconstpointer a, + gconstpointer b); +typedef void (*GDestroyNotify) (gpointer data); +typedef void (*GFunc) (gpointer data, + gpointer user_data); +typedef guint (*GHashFunc) (gconstpointer key); +typedef void (*GHFunc) (gpointer key, + gpointer value, + gpointer user_data); + +/** + * GCopyFunc: + * @src: (not nullable): A pointer to the data which should be copied + * @data: Additional data + * + * A function of this signature is used to copy the node data + * when doing a deep-copy of a tree. + * + * Returns: (not nullable): A pointer to the copy + * + * Since: 2.4 + */ +typedef gpointer (*GCopyFunc) (gconstpointer src, + gpointer data); +/** + * GFreeFunc: + * @data: a data pointer + * + * Declares a type of function which takes an arbitrary + * data pointer argument and has no return value. It is + * not currently used in GLib or GTK+. + */ +typedef void (*GFreeFunc) (gpointer data); + +/** + * GTranslateFunc: + * @str: the untranslated string + * @data: user data specified when installing the function, e.g. + * in g_option_group_set_translate_func() + * + * The type of functions which are used to translate user-visible + * strings, for output. + * + * Returns: a translation of the string for the current locale. + * The returned string is owned by GLib and must not be freed. + */ +typedef const gchar * (*GTranslateFunc) (const gchar *str, + gpointer data); + + +/* Define some mathematical constants that aren't available + * symbolically in some strict ISO C implementations. + * + * Note that the large number of digits used in these definitions + * doesn't imply that GLib or current computers in general would be + * able to handle floating point numbers with an accuracy like this. + * It's mostly an exercise in futility and future proofing. For + * extended precision floating point support, look somewhere else + * than GLib. + */ +#define G_E 2.7182818284590452353602874713526624977572470937000 +#define G_LN2 0.69314718055994530941723212145817656807550013436026 +#define G_LN10 2.3025850929940456840179914546843642076011014886288 +#define G_PI 3.1415926535897932384626433832795028841971693993751 +#define G_PI_2 1.5707963267948966192313216916397514420985846996876 +#define G_PI_4 0.78539816339744830961566084581987572104929234984378 +#define G_SQRT2 1.4142135623730950488016887242096980785696718753769 + +/* Portable endian checks and conversions + * + * glibconfig.h defines G_BYTE_ORDER which expands to one of + * the below macros. + */ +#define G_LITTLE_ENDIAN 1234 +#define G_BIG_ENDIAN 4321 +#define G_PDP_ENDIAN 3412 /* unused, need specific PDP check */ + + +/* Basic bit swapping functions + */ +#define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \ + (guint16) ((guint16) (val) >> 8) | \ + (guint16) ((guint16) (val) << 8))) + +#define GUINT32_SWAP_LE_BE_CONSTANT(val) ((guint32) ( \ + (((guint32) (val) & (guint32) 0x000000ffU) << 24) | \ + (((guint32) (val) & (guint32) 0x0000ff00U) << 8) | \ + (((guint32) (val) & (guint32) 0x00ff0000U) >> 8) | \ + (((guint32) (val) & (guint32) 0xff000000U) >> 24))) + +#define GUINT64_SWAP_LE_BE_CONSTANT(val) ((guint64) ( \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0x00000000000000ffU)) << 56) | \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0x000000000000ff00U)) << 40) | \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0x0000000000ff0000U)) << 24) | \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0x00000000ff000000U)) << 8) | \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0x000000ff00000000U)) >> 8) | \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0x0000ff0000000000U)) >> 24) | \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0x00ff000000000000U)) >> 40) | \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0xff00000000000000U)) >> 56))) + +/* Arch specific stuff for speed + */ +#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) + +# if __GNUC__ >= 4 && defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 3 +# define GUINT32_SWAP_LE_BE(val) ((guint32) __builtin_bswap32 ((guint32) (val))) +# define GUINT64_SWAP_LE_BE(val) ((guint64) __builtin_bswap64 ((guint64) (val))) +# endif + +# if defined (__i386__) +# define GUINT16_SWAP_LE_BE_IA32(val) \ + (G_GNUC_EXTENSION \ + ({ guint16 __v, __x = ((guint16) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ ("rorw $8, %w0" \ + : "=r" (__v) \ + : "0" (__x) \ + : "cc"); \ + __v; })) +# if !defined (__i486__) && !defined (__i586__) \ + && !defined (__pentium__) && !defined (__i686__) \ + && !defined (__pentiumpro__) && !defined (__pentium4__) +# define GUINT32_SWAP_LE_BE_IA32(val) \ + (G_GNUC_EXTENSION \ + ({ guint32 __v, __x = ((guint32) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ ("rorw $8, %w0\n\t" \ + "rorl $16, %0\n\t" \ + "rorw $8, %w0" \ + : "=r" (__v) \ + : "0" (__x) \ + : "cc"); \ + __v; })) +# else /* 486 and higher has bswap */ +# define GUINT32_SWAP_LE_BE_IA32(val) \ + (G_GNUC_EXTENSION \ + ({ guint32 __v, __x = ((guint32) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ ("bswap %0" \ + : "=r" (__v) \ + : "0" (__x)); \ + __v; })) +# endif /* processor specific 32-bit stuff */ +# define GUINT64_SWAP_LE_BE_IA32(val) \ + (G_GNUC_EXTENSION \ + ({ union { guint64 __ll; \ + guint32 __l[2]; } __w, __r; \ + __w.__ll = ((guint64) (val)); \ + if (__builtin_constant_p (__w.__ll)) \ + __r.__ll = GUINT64_SWAP_LE_BE_CONSTANT (__w.__ll); \ + else \ + { \ + __r.__l[0] = GUINT32_SWAP_LE_BE (__w.__l[1]); \ + __r.__l[1] = GUINT32_SWAP_LE_BE (__w.__l[0]); \ + } \ + __r.__ll; })) + /* Possibly just use the constant version and let gcc figure it out? */ +# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) +# ifndef GUINT32_SWAP_LE_BE +# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA32 (val)) +# endif +# ifndef GUINT64_SWAP_LE_BE +# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA32 (val)) +# endif +# elif defined (__ia64__) +# define GUINT16_SWAP_LE_BE_IA64(val) \ + (G_GNUC_EXTENSION \ + ({ guint16 __v, __x = ((guint16) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ __volatile__ ("shl %0 = %1, 48 ;;" \ + "mux1 %0 = %0, @rev ;;" \ + : "=r" (__v) \ + : "r" (__x)); \ + __v; })) +# define GUINT32_SWAP_LE_BE_IA64(val) \ + (G_GNUC_EXTENSION \ + ({ guint32 __v, __x = ((guint32) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ __volatile__ ("shl %0 = %1, 32 ;;" \ + "mux1 %0 = %0, @rev ;;" \ + : "=r" (__v) \ + : "r" (__x)); \ + __v; })) +# define GUINT64_SWAP_LE_BE_IA64(val) \ + (G_GNUC_EXTENSION \ + ({ guint64 __v, __x = ((guint64) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ __volatile__ ("mux1 %0 = %1, @rev ;;" \ + : "=r" (__v) \ + : "r" (__x)); \ + __v; })) +# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA64 (val)) +# ifndef GUINT32_SWAP_LE_BE +# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA64 (val)) +# endif +# ifndef GUINT64_SWAP_LE_BE +# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA64 (val)) +# endif +# elif defined (__x86_64__) +# define GUINT32_SWAP_LE_BE_X86_64(val) \ + (G_GNUC_EXTENSION \ + ({ guint32 __v, __x = ((guint32) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ ("bswapl %0" \ + : "=r" (__v) \ + : "0" (__x)); \ + __v; })) +# define GUINT64_SWAP_LE_BE_X86_64(val) \ + (G_GNUC_EXTENSION \ + ({ guint64 __v, __x = ((guint64) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ ("bswapq %0" \ + : "=r" (__v) \ + : "0" (__x)); \ + __v; })) + /* gcc seems to figure out optimal code for this on its own */ +# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val)) +# ifndef GUINT32_SWAP_LE_BE +# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86_64 (val)) +# endif +# ifndef GUINT64_SWAP_LE_BE +# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86_64 (val)) +# endif +# else /* generic gcc */ +# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val)) +# ifndef GUINT32_SWAP_LE_BE +# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val)) +# endif +# ifndef GUINT64_SWAP_LE_BE +# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val)) +# endif +# endif +#else /* generic */ +# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val)) +# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val)) +# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val)) +#endif /* generic */ + +#define GUINT16_SWAP_LE_PDP(val) ((guint16) (val)) +#define GUINT16_SWAP_BE_PDP(val) (GUINT16_SWAP_LE_BE (val)) +#define GUINT32_SWAP_LE_PDP(val) ((guint32) ( \ + (((guint32) (val) & (guint32) 0x0000ffffU) << 16) | \ + (((guint32) (val) & (guint32) 0xffff0000U) >> 16))) +#define GUINT32_SWAP_BE_PDP(val) ((guint32) ( \ + (((guint32) (val) & (guint32) 0x00ff00ffU) << 8) | \ + (((guint32) (val) & (guint32) 0xff00ff00U) >> 8))) + +/* The G*_TO_?E() macros are defined in glibconfig.h. + * The transformation is symmetric, so the FROM just maps to the TO. + */ +#define GINT16_FROM_LE(val) (GINT16_TO_LE (val)) +#define GUINT16_FROM_LE(val) (GUINT16_TO_LE (val)) +#define GINT16_FROM_BE(val) (GINT16_TO_BE (val)) +#define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val)) +#define GINT32_FROM_LE(val) (GINT32_TO_LE (val)) +#define GUINT32_FROM_LE(val) (GUINT32_TO_LE (val)) +#define GINT32_FROM_BE(val) (GINT32_TO_BE (val)) +#define GUINT32_FROM_BE(val) (GUINT32_TO_BE (val)) + +#define GINT64_FROM_LE(val) (GINT64_TO_LE (val)) +#define GUINT64_FROM_LE(val) (GUINT64_TO_LE (val)) +#define GINT64_FROM_BE(val) (GINT64_TO_BE (val)) +#define GUINT64_FROM_BE(val) (GUINT64_TO_BE (val)) + +#define GLONG_FROM_LE(val) (GLONG_TO_LE (val)) +#define GULONG_FROM_LE(val) (GULONG_TO_LE (val)) +#define GLONG_FROM_BE(val) (GLONG_TO_BE (val)) +#define GULONG_FROM_BE(val) (GULONG_TO_BE (val)) + +#define GINT_FROM_LE(val) (GINT_TO_LE (val)) +#define GUINT_FROM_LE(val) (GUINT_TO_LE (val)) +#define GINT_FROM_BE(val) (GINT_TO_BE (val)) +#define GUINT_FROM_BE(val) (GUINT_TO_BE (val)) + +#define GSIZE_FROM_LE(val) (GSIZE_TO_LE (val)) +#define GSSIZE_FROM_LE(val) (GSSIZE_TO_LE (val)) +#define GSIZE_FROM_BE(val) (GSIZE_TO_BE (val)) +#define GSSIZE_FROM_BE(val) (GSSIZE_TO_BE (val)) + +/* Portable versions of host-network order stuff + */ +#define g_ntohl(val) (GUINT32_FROM_BE (val)) +#define g_ntohs(val) (GUINT16_FROM_BE (val)) +#define g_htonl(val) (GUINT32_TO_BE (val)) +#define g_htons(val) (GUINT16_TO_BE (val)) + +/* Overflow-checked unsigned integer arithmetic + */ +#ifndef _GLIB_TEST_OVERFLOW_FALLBACK +/* https://bugzilla.gnome.org/show_bug.cgi?id=769104 */ +#if __GNUC__ >= 5 && !defined(__INTEL_COMPILER) +#define _GLIB_HAVE_BUILTIN_OVERFLOW_CHECKS +#elif g_macro__has_builtin(__builtin_uadd_overflow) +#define _GLIB_HAVE_BUILTIN_OVERFLOW_CHECKS +#endif +#endif + +#define g_uint_checked_add(dest, a, b) \ + _GLIB_CHECKED_ADD_U32(dest, a, b) +#define g_uint_checked_mul(dest, a, b) \ + _GLIB_CHECKED_MUL_U32(dest, a, b) + +#define g_uint64_checked_add(dest, a, b) \ + _GLIB_CHECKED_ADD_U64(dest, a, b) +#define g_uint64_checked_mul(dest, a, b) \ + _GLIB_CHECKED_MUL_U64(dest, a, b) + +#if GLIB_SIZEOF_SIZE_T == 8 +#define g_size_checked_add(dest, a, b) \ + _GLIB_CHECKED_ADD_U64(dest, a, b) +#define g_size_checked_mul(dest, a, b) \ + _GLIB_CHECKED_MUL_U64(dest, a, b) +#else +#define g_size_checked_add(dest, a, b) \ + _GLIB_CHECKED_ADD_U32(dest, a, b) +#define g_size_checked_mul(dest, a, b) \ + _GLIB_CHECKED_MUL_U32(dest, a, b) +#endif + +/* The names of the following inlines are private. Use the macro + * definitions above. + */ +#ifdef _GLIB_HAVE_BUILTIN_OVERFLOW_CHECKS +static inline gboolean _GLIB_CHECKED_ADD_U32 (guint32 *dest, guint32 a, guint32 b) { + return !__builtin_uadd_overflow(a, b, dest); } +static inline gboolean _GLIB_CHECKED_MUL_U32 (guint32 *dest, guint32 a, guint32 b) { + return !__builtin_umul_overflow(a, b, dest); } +static inline gboolean _GLIB_CHECKED_ADD_U64 (guint64 *dest, guint64 a, guint64 b) { + G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64)); + return !__builtin_uaddll_overflow(a, b, (unsigned long long *) dest); } +static inline gboolean _GLIB_CHECKED_MUL_U64 (guint64 *dest, guint64 a, guint64 b) { + return !__builtin_umulll_overflow(a, b, (unsigned long long *) dest); } +#else +static inline gboolean _GLIB_CHECKED_ADD_U32 (guint32 *dest, guint32 a, guint32 b) { + *dest = a + b; return *dest >= a; } +static inline gboolean _GLIB_CHECKED_MUL_U32 (guint32 *dest, guint32 a, guint32 b) { + *dest = a * b; return !a || *dest / a == b; } +static inline gboolean _GLIB_CHECKED_ADD_U64 (guint64 *dest, guint64 a, guint64 b) { + *dest = a + b; return *dest >= a; } +static inline gboolean _GLIB_CHECKED_MUL_U64 (guint64 *dest, guint64 a, guint64 b) { + *dest = a * b; return !a || *dest / a == b; } +#endif + +/* IEEE Standard 754 Single Precision Storage Format (gfloat): + * + * 31 30 23 22 0 + * +--------+---------------+---------------+ + * | s 1bit | e[30:23] 8bit | f[22:0] 23bit | + * +--------+---------------+---------------+ + * B0------------------->B1------->B2-->B3--> + * + * IEEE Standard 754 Double Precision Storage Format (gdouble): + * + * 63 62 52 51 32 31 0 + * +--------+----------------+----------------+ +---------------+ + * | s 1bit | e[62:52] 11bit | f[51:32] 20bit | | f[31:0] 32bit | + * +--------+----------------+----------------+ +---------------+ + * B0--------------->B1---------->B2--->B3----> B4->B5->B6->B7-> + */ +/* subtract from biased_exponent to form base2 exponent (normal numbers) */ +typedef union _GDoubleIEEE754 GDoubleIEEE754; +typedef union _GFloatIEEE754 GFloatIEEE754; +#define G_IEEE754_FLOAT_BIAS (127) +#define G_IEEE754_DOUBLE_BIAS (1023) +/* multiply with base2 exponent to get base10 exponent (normal numbers) */ +#define G_LOG_2_BASE_10 (0.30102999566398119521) +#if G_BYTE_ORDER == G_LITTLE_ENDIAN +union _GFloatIEEE754 +{ + gfloat v_float; + struct { + guint mantissa : 23; + guint biased_exponent : 8; + guint sign : 1; + } mpn; +}; +union _GDoubleIEEE754 +{ + gdouble v_double; + struct { + guint mantissa_low : 32; + guint mantissa_high : 20; + guint biased_exponent : 11; + guint sign : 1; + } mpn; +}; +#elif G_BYTE_ORDER == G_BIG_ENDIAN +union _GFloatIEEE754 +{ + gfloat v_float; + struct { + guint sign : 1; + guint biased_exponent : 8; + guint mantissa : 23; + } mpn; +}; +union _GDoubleIEEE754 +{ + gdouble v_double; + struct { + guint sign : 1; + guint biased_exponent : 11; + guint mantissa_high : 20; + guint mantissa_low : 32; + } mpn; +}; +#else /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */ +#error unknown ENDIAN type +#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */ + +typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime); + +struct _GTimeVal +{ + glong tv_sec; + glong tv_usec; +} GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime); + +typedef gint grefcount; +typedef gint gatomicrefcount; /* should be accessed only using atomics */ + +G_END_DECLS + +/* We prefix variable declarations so they can + * properly get exported in Windows DLLs. + */ +#ifndef GLIB_VAR +# ifdef G_PLATFORM_WIN32 +# ifdef GLIB_STATIC_COMPILATION +# define GLIB_VAR extern +# else /* !GLIB_STATIC_COMPILATION */ +# ifdef GLIB_COMPILATION +# ifdef DLL_EXPORT +# define GLIB_VAR extern __declspec(dllexport) +# else /* !DLL_EXPORT */ +# define GLIB_VAR extern +# endif /* !DLL_EXPORT */ +# else /* !GLIB_COMPILATION */ +# define GLIB_VAR extern __declspec(dllimport) +# endif /* !GLIB_COMPILATION */ +# endif /* !GLIB_STATIC_COMPILATION */ +# else /* !G_PLATFORM_WIN32 */ +# define GLIB_VAR _GLIB_EXTERN +# endif /* !G_PLATFORM_WIN32 */ +#endif /* GLIB_VAR */ + +#endif /* __G_TYPES_H__ */ + +#if defined(__BIONIC__) && defined (GLIB_HAVE_ALLOCA_H) +# include +#elif defined(__GNUC__) +/* GCC does the right thing */ +# undef alloca +# define alloca(size) __builtin_alloca (size) +#elif defined (GLIB_HAVE_ALLOCA_H) +/* a native and working alloca.h is there */ +# include +#else /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */ +# if defined(_MSC_VER) || defined(__DMC__) +# include +# define alloca _alloca +# else /* !_MSC_VER && !__DMC__ */ +# ifdef _AIX +# pragma alloca +# else /* !_AIX */ +# ifndef alloca /* predefined by HP cc +Olibcalls */ +G_BEGIN_DECLS +char *alloca (); +G_END_DECLS +# endif /* !alloca */ +# endif /* !_AIX */ +# endif /* !_MSC_VER && !__DMC__ */ +#endif /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */ + +/** + * g_alloca: + * @size: number of bytes to allocate. + * + * Allocates @size bytes on the stack; these bytes will be freed when the current + * stack frame is cleaned up. This macro essentially just wraps the alloca() + * function present on most UNIX variants. + * Thus it provides the same advantages and pitfalls as alloca(): + * + * - alloca() is very fast, as on most systems it's implemented by just adjusting + * the stack pointer register. + * + * - It doesn't cause any memory fragmentation, within its scope, separate alloca() + * blocks just build up and are released together at function end. + * + * - Allocation sizes have to fit into the current stack frame. For instance in a + * threaded environment on Linux, the per-thread stack size is limited to 2 Megabytes, + * so be sparse with alloca() uses. + * + * - Allocation failure due to insufficient stack space is not indicated with a %NULL + * return like e.g. with malloc(). Instead, most systems probably handle it the same + * way as out of stack space situations from infinite function recursion, i.e. + * with a segmentation fault. + * + * - Special care has to be taken when mixing alloca() with GNU C variable sized arrays. + * Stack space allocated with alloca() in the same scope as a variable sized array + * will be freed together with the variable sized array upon exit of that scope, and + * not upon exit of the enclosing function scope. + * + * Returns: space for @size bytes, allocated on the stack + */ +#define g_alloca(size) alloca (size) +/** + * g_newa: + * @struct_type: Type of memory chunks to be allocated + * @n_structs: Number of chunks to be allocated + * + * Wraps g_alloca() in a more typesafe manner. + * + * Returns: Pointer to stack space for @n_structs chunks of type @struct_type + */ +#define g_newa(struct_type, n_structs) ((struct_type*) g_alloca (sizeof (struct_type) * (gsize) (n_structs))) + +#endif /* __G_ALLOCA_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_ARRAY_H__ +#define __G_ARRAY_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GBytes GBytes; +typedef struct _GArray GArray; +typedef struct _GByteArray GByteArray; +typedef struct _GPtrArray GPtrArray; + +struct _GArray +{ + gchar *data; + guint len; +}; + +struct _GByteArray +{ + guint8 *data; + guint len; +}; + +struct _GPtrArray +{ + gpointer *pdata; + guint len; +}; + +/* Resizable arrays. remove fills any cleared spot and shortens the + * array, while preserving the order. remove_fast will distort the + * order by moving the last element to the position of the removed. + */ + +#define g_array_append_val(a,v) g_array_append_vals (a, &(v), 1) +#define g_array_prepend_val(a,v) g_array_prepend_vals (a, &(v), 1) +#define g_array_insert_val(a,i,v) g_array_insert_vals (a, i, &(v), 1) +#define g_array_index(a,t,i) (((t*) (void *) (a)->data) [(i)]) + +GLIB_AVAILABLE_IN_ALL +GArray* g_array_new (gboolean zero_terminated, + gboolean clear_, + guint element_size); +GLIB_AVAILABLE_IN_2_64 +gpointer g_array_steal (GArray *array, + gsize *len); +GLIB_AVAILABLE_IN_ALL +GArray* g_array_sized_new (gboolean zero_terminated, + gboolean clear_, + guint element_size, + guint reserved_size); +GLIB_AVAILABLE_IN_2_62 +GArray* g_array_copy (GArray *array); +GLIB_AVAILABLE_IN_ALL +gchar* g_array_free (GArray *array, + gboolean free_segment); +GLIB_AVAILABLE_IN_ALL +GArray *g_array_ref (GArray *array); +GLIB_AVAILABLE_IN_ALL +void g_array_unref (GArray *array); +GLIB_AVAILABLE_IN_ALL +guint g_array_get_element_size (GArray *array); +GLIB_AVAILABLE_IN_ALL +GArray* g_array_append_vals (GArray *array, + gconstpointer data, + guint len); +GLIB_AVAILABLE_IN_ALL +GArray* g_array_prepend_vals (GArray *array, + gconstpointer data, + guint len); +GLIB_AVAILABLE_IN_ALL +GArray* g_array_insert_vals (GArray *array, + guint index_, + gconstpointer data, + guint len); +GLIB_AVAILABLE_IN_ALL +GArray* g_array_set_size (GArray *array, + guint length); +GLIB_AVAILABLE_IN_ALL +GArray* g_array_remove_index (GArray *array, + guint index_); +GLIB_AVAILABLE_IN_ALL +GArray* g_array_remove_index_fast (GArray *array, + guint index_); +GLIB_AVAILABLE_IN_ALL +GArray* g_array_remove_range (GArray *array, + guint index_, + guint length); +GLIB_AVAILABLE_IN_ALL +void g_array_sort (GArray *array, + GCompareFunc compare_func); +GLIB_AVAILABLE_IN_ALL +void g_array_sort_with_data (GArray *array, + GCompareDataFunc compare_func, + gpointer user_data); +GLIB_AVAILABLE_IN_2_62 +gboolean g_array_binary_search (GArray *array, + gconstpointer target, + GCompareFunc compare_func, + guint *out_match_index); +GLIB_AVAILABLE_IN_ALL +void g_array_set_clear_func (GArray *array, + GDestroyNotify clear_func); + +/* Resizable pointer array. This interface is much less complicated + * than the above. Add appends a pointer. Remove fills any cleared + * spot and shortens the array. remove_fast will again distort order. + */ +#define g_ptr_array_index(array,index_) ((array)->pdata)[index_] +GLIB_AVAILABLE_IN_ALL +GPtrArray* g_ptr_array_new (void); +GLIB_AVAILABLE_IN_ALL +GPtrArray* g_ptr_array_new_with_free_func (GDestroyNotify element_free_func); +GLIB_AVAILABLE_IN_2_64 +gpointer* g_ptr_array_steal (GPtrArray *array, + gsize *len); +GLIB_AVAILABLE_IN_2_62 +GPtrArray *g_ptr_array_copy (GPtrArray *array, + GCopyFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +GPtrArray* g_ptr_array_sized_new (guint reserved_size); +GLIB_AVAILABLE_IN_ALL +GPtrArray* g_ptr_array_new_full (guint reserved_size, + GDestroyNotify element_free_func); +GLIB_AVAILABLE_IN_ALL +gpointer* g_ptr_array_free (GPtrArray *array, + gboolean free_seg); +GLIB_AVAILABLE_IN_ALL +GPtrArray* g_ptr_array_ref (GPtrArray *array); +GLIB_AVAILABLE_IN_ALL +void g_ptr_array_unref (GPtrArray *array); +GLIB_AVAILABLE_IN_ALL +void g_ptr_array_set_free_func (GPtrArray *array, + GDestroyNotify element_free_func); +GLIB_AVAILABLE_IN_ALL +void g_ptr_array_set_size (GPtrArray *array, + gint length); +GLIB_AVAILABLE_IN_ALL +gpointer g_ptr_array_remove_index (GPtrArray *array, + guint index_); +GLIB_AVAILABLE_IN_ALL +gpointer g_ptr_array_remove_index_fast (GPtrArray *array, + guint index_); +GLIB_AVAILABLE_IN_2_58 +gpointer g_ptr_array_steal_index (GPtrArray *array, + guint index_); +GLIB_AVAILABLE_IN_2_58 +gpointer g_ptr_array_steal_index_fast (GPtrArray *array, + guint index_); +GLIB_AVAILABLE_IN_ALL +gboolean g_ptr_array_remove (GPtrArray *array, + gpointer data); +GLIB_AVAILABLE_IN_ALL +gboolean g_ptr_array_remove_fast (GPtrArray *array, + gpointer data); +GLIB_AVAILABLE_IN_ALL +GPtrArray *g_ptr_array_remove_range (GPtrArray *array, + guint index_, + guint length); +GLIB_AVAILABLE_IN_ALL +void g_ptr_array_add (GPtrArray *array, + gpointer data); +GLIB_AVAILABLE_IN_2_62 +void g_ptr_array_extend (GPtrArray *array_to_extend, + GPtrArray *array, + GCopyFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_2_62 +void g_ptr_array_extend_and_steal (GPtrArray *array_to_extend, + GPtrArray *array); +GLIB_AVAILABLE_IN_2_40 +void g_ptr_array_insert (GPtrArray *array, + gint index_, + gpointer data); +GLIB_AVAILABLE_IN_ALL +void g_ptr_array_sort (GPtrArray *array, + GCompareFunc compare_func); +GLIB_AVAILABLE_IN_ALL +void g_ptr_array_sort_with_data (GPtrArray *array, + GCompareDataFunc compare_func, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +void g_ptr_array_foreach (GPtrArray *array, + GFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_2_54 +gboolean g_ptr_array_find (GPtrArray *haystack, + gconstpointer needle, + guint *index_); +GLIB_AVAILABLE_IN_2_54 +gboolean g_ptr_array_find_with_equal_func (GPtrArray *haystack, + gconstpointer needle, + GEqualFunc equal_func, + guint *index_); + + +/* Byte arrays, an array of guint8. Implemented as a GArray, + * but type-safe. + */ + +GLIB_AVAILABLE_IN_ALL +GByteArray* g_byte_array_new (void); +GLIB_AVAILABLE_IN_ALL +GByteArray* g_byte_array_new_take (guint8 *data, + gsize len); +GLIB_AVAILABLE_IN_2_64 +guint8* g_byte_array_steal (GByteArray *array, + gsize *len); +GLIB_AVAILABLE_IN_ALL +GByteArray* g_byte_array_sized_new (guint reserved_size); +GLIB_AVAILABLE_IN_ALL +guint8* g_byte_array_free (GByteArray *array, + gboolean free_segment); +GLIB_AVAILABLE_IN_ALL +GBytes* g_byte_array_free_to_bytes (GByteArray *array); +GLIB_AVAILABLE_IN_ALL +GByteArray *g_byte_array_ref (GByteArray *array); +GLIB_AVAILABLE_IN_ALL +void g_byte_array_unref (GByteArray *array); +GLIB_AVAILABLE_IN_ALL +GByteArray* g_byte_array_append (GByteArray *array, + const guint8 *data, + guint len); +GLIB_AVAILABLE_IN_ALL +GByteArray* g_byte_array_prepend (GByteArray *array, + const guint8 *data, + guint len); +GLIB_AVAILABLE_IN_ALL +GByteArray* g_byte_array_set_size (GByteArray *array, + guint length); +GLIB_AVAILABLE_IN_ALL +GByteArray* g_byte_array_remove_index (GByteArray *array, + guint index_); +GLIB_AVAILABLE_IN_ALL +GByteArray* g_byte_array_remove_index_fast (GByteArray *array, + guint index_); +GLIB_AVAILABLE_IN_ALL +GByteArray* g_byte_array_remove_range (GByteArray *array, + guint index_, + guint length); +GLIB_AVAILABLE_IN_ALL +void g_byte_array_sort (GByteArray *array, + GCompareFunc compare_func); +GLIB_AVAILABLE_IN_ALL +void g_byte_array_sort_with_data (GByteArray *array, + GCompareDataFunc compare_func, + gpointer user_data); + +G_END_DECLS + +#endif /* __G_ARRAY_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_ASYNCQUEUE_H__ +#define __G_ASYNCQUEUE_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_THREAD_H__ +#define __G_THREAD_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +/* + * Copyright © 2011 Ryan Lortie + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + */ + +#ifndef __G_ATOMIC_H__ +#define __G_ATOMIC_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_ALL +gint g_atomic_int_get (const volatile gint *atomic); +GLIB_AVAILABLE_IN_ALL +void g_atomic_int_set (volatile gint *atomic, + gint newval); +GLIB_AVAILABLE_IN_ALL +void g_atomic_int_inc (volatile gint *atomic); +GLIB_AVAILABLE_IN_ALL +gboolean g_atomic_int_dec_and_test (volatile gint *atomic); +GLIB_AVAILABLE_IN_ALL +gboolean g_atomic_int_compare_and_exchange (volatile gint *atomic, + gint oldval, + gint newval); +GLIB_AVAILABLE_IN_ALL +gint g_atomic_int_add (volatile gint *atomic, + gint val); +GLIB_AVAILABLE_IN_2_30 +guint g_atomic_int_and (volatile guint *atomic, + guint val); +GLIB_AVAILABLE_IN_2_30 +guint g_atomic_int_or (volatile guint *atomic, + guint val); +GLIB_AVAILABLE_IN_ALL +guint g_atomic_int_xor (volatile guint *atomic, + guint val); + +GLIB_AVAILABLE_IN_ALL +gpointer g_atomic_pointer_get (const volatile void *atomic); +GLIB_AVAILABLE_IN_ALL +void g_atomic_pointer_set (volatile void *atomic, + gpointer newval); +GLIB_AVAILABLE_IN_ALL +gboolean g_atomic_pointer_compare_and_exchange (volatile void *atomic, + gpointer oldval, + gpointer newval); +GLIB_AVAILABLE_IN_ALL +gssize g_atomic_pointer_add (volatile void *atomic, + gssize val); +GLIB_AVAILABLE_IN_2_30 +gsize g_atomic_pointer_and (volatile void *atomic, + gsize val); +GLIB_AVAILABLE_IN_2_30 +gsize g_atomic_pointer_or (volatile void *atomic, + gsize val); +GLIB_AVAILABLE_IN_ALL +gsize g_atomic_pointer_xor (volatile void *atomic, + gsize val); + +GLIB_DEPRECATED_IN_2_30_FOR(g_atomic_int_add) +gint g_atomic_int_exchange_and_add (volatile gint *atomic, + gint val); + +G_END_DECLS + +#if defined(G_ATOMIC_LOCK_FREE) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) + +/* We prefer the new C11-style atomic extension of GCC if available */ +#if defined(__ATOMIC_SEQ_CST) + +#undef g_atomic_int_get +#define g_atomic_int_get(atomic) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + gint gaig_temp; \ + (void) (0 ? *(atomic) ^ *(atomic) : 1); \ + __atomic_load ((gint *)(atomic), &gaig_temp, __ATOMIC_SEQ_CST); \ + (gint) gaig_temp; \ + })) +#undef g_atomic_int_set +#define g_atomic_int_set(atomic, newval) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + gint gais_temp = (gint) (newval); \ + (void) (0 ? *(atomic) ^ (newval) : 1); \ + __atomic_store ((gint *)(atomic), &gais_temp, __ATOMIC_SEQ_CST); \ + })) + +#if defined(glib_typeof) +#undef g_atomic_pointer_get +#define g_atomic_pointer_get(atomic) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + glib_typeof (*(atomic)) gapg_temp_newval; \ + glib_typeof ((atomic)) gapg_temp_atomic = (atomic); \ + __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \ + gapg_temp_newval; \ + })) +#undef g_atomic_pointer_set +#define g_atomic_pointer_set(atomic, newval) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + glib_typeof ((atomic)) gaps_temp_atomic = (atomic); \ + glib_typeof (*(atomic)) gaps_temp_newval = (newval); \ + (void) (0 ? (gpointer) * (atomic) : NULL); \ + __atomic_store (gaps_temp_atomic, &gaps_temp_newval, __ATOMIC_SEQ_CST); \ + })) +#else /* if !defined(glib_typeof) */ +#undef g_atomic_pointer_get +#define g_atomic_pointer_get(atomic) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + gpointer gapg_temp_newval; \ + gpointer *gapg_temp_atomic = (gpointer *)(atomic); \ + __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \ + gapg_temp_newval; \ + })) +#undef g_atomic_pointer_set +#define g_atomic_pointer_set(atomic, newval) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + gpointer *gaps_temp_atomic = (gpointer *)(atomic); \ + gpointer gaps_temp_newval = (gpointer)(newval); \ + (void) (0 ? (gpointer) *(atomic) : NULL); \ + __atomic_store (gaps_temp_atomic, &gaps_temp_newval, __ATOMIC_SEQ_CST); \ + })) +#endif /* !defined(glib_typeof) */ + +#undef g_atomic_int_inc +#define g_atomic_int_inc(atomic) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ *(atomic) : 1); \ + (void) __atomic_fetch_add ((atomic), 1, __ATOMIC_SEQ_CST); \ + })) +#undef g_atomic_int_dec_and_test +#define g_atomic_int_dec_and_test(atomic) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ *(atomic) : 1); \ + __atomic_fetch_sub ((atomic), 1, __ATOMIC_SEQ_CST) == 1; \ + })) +#undef g_atomic_int_compare_and_exchange +#define g_atomic_int_compare_and_exchange(atomic, oldval, newval) \ + (G_GNUC_EXTENSION ({ \ + gint gaicae_oldval = (oldval); \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (newval) ^ (oldval) : 1); \ + __atomic_compare_exchange_n ((atomic), &gaicae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ? TRUE : FALSE; \ + })) +#undef g_atomic_int_add +#define g_atomic_int_add(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (val) : 1); \ + (gint) __atomic_fetch_add ((atomic), (val), __ATOMIC_SEQ_CST); \ + })) +#undef g_atomic_int_and +#define g_atomic_int_and(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (val) : 1); \ + (guint) __atomic_fetch_and ((atomic), (val), __ATOMIC_SEQ_CST); \ + })) +#undef g_atomic_int_or +#define g_atomic_int_or(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (val) : 1); \ + (guint) __atomic_fetch_or ((atomic), (val), __ATOMIC_SEQ_CST); \ + })) +#undef g_atomic_int_xor +#define g_atomic_int_xor(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (val) : 1); \ + (guint) __atomic_fetch_xor ((atomic), (val), __ATOMIC_SEQ_CST); \ + })) + +#if defined(glib_typeof) +#undef g_atomic_pointer_compare_and_exchange +#define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof (oldval) == sizeof (gpointer)); \ + glib_typeof ((oldval)) gapcae_oldval = (oldval); \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : NULL); \ + __atomic_compare_exchange_n ((atomic), &gapcae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ? TRUE : FALSE; \ + })) +#else /* if !defined(glib_typeof) */ +#undef g_atomic_pointer_compare_and_exchange +#define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof (oldval) == sizeof (gpointer)); \ + gpointer gapcae_oldval = (gpointer)(oldval); \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : NULL); \ + __atomic_compare_exchange_n ((atomic), &gapcae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ? TRUE : FALSE; \ + })) +#endif /* defined(glib_typeof) */ +#undef g_atomic_pointer_add +#define g_atomic_pointer_add(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : NULL); \ + (void) (0 ? (val) ^ (val) : 1); \ + (gssize) __atomic_fetch_add ((atomic), (val), __ATOMIC_SEQ_CST); \ + })) +#undef g_atomic_pointer_and +#define g_atomic_pointer_and(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + gsize *gapa_atomic = (gsize *) (atomic); \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gsize)); \ + (void) (0 ? (gpointer) *(atomic) : NULL); \ + (void) (0 ? (val) ^ (val) : 1); \ + (gsize) __atomic_fetch_and (gapa_atomic, (val), __ATOMIC_SEQ_CST); \ + })) +#undef g_atomic_pointer_or +#define g_atomic_pointer_or(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + gsize *gapo_atomic = (gsize *) (atomic); \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gsize)); \ + (void) (0 ? (gpointer) *(atomic) : NULL); \ + (void) (0 ? (val) ^ (val) : 1); \ + (gsize) __atomic_fetch_or (gapo_atomic, (val), __ATOMIC_SEQ_CST); \ + })) +#undef g_atomic_pointer_xor +#define g_atomic_pointer_xor(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + gsize *gapx_atomic = (gsize *) (atomic); \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gsize)); \ + (void) (0 ? (gpointer) *(atomic) : NULL); \ + (void) (0 ? (val) ^ (val) : 1); \ + (gsize) __atomic_fetch_xor (gapx_atomic, (val), __ATOMIC_SEQ_CST); \ + })) + +#else /* defined(__ATOMIC_SEQ_CST) */ + +/* We want to achieve __ATOMIC_SEQ_CST semantics here. See + * https://en.cppreference.com/w/c/atomic/memory_order#Constants. For load + * operations, that means performing an *acquire*: + * > A load operation with this memory order performs the acquire operation on + * > the affected memory location: no reads or writes in the current thread can + * > be reordered before this load. All writes in other threads that release + * > the same atomic variable are visible in the current thread. + * + * “no reads or writes in the current thread can be reordered before this load” + * is implemented using a compiler barrier (a no-op `__asm__` section) to + * prevent instruction reordering. Writes in other threads are synchronised + * using `__sync_synchronize()`. It’s unclear from the GCC documentation whether + * `__sync_synchronize()` acts as a compiler barrier, hence our explicit use of + * one. + * + * For store operations, `__ATOMIC_SEQ_CST` means performing a *release*: + * > A store operation with this memory order performs the release operation: + * > no reads or writes in the current thread can be reordered after this store. + * > All writes in the current thread are visible in other threads that acquire + * > the same atomic variable (see Release-Acquire ordering below) and writes + * > that carry a dependency into the atomic variable become visible in other + * > threads that consume the same atomic (see Release-Consume ordering below). + * + * “no reads or writes in the current thread can be reordered after this store” + * is implemented using a compiler barrier to prevent instruction reordering. + * “All writes in the current thread are visible in other threads” is implemented + * using `__sync_synchronize()`; similarly for “writes that carry a dependency”. + */ +#undef g_atomic_int_get +#define g_atomic_int_get(atomic) \ + (G_GNUC_EXTENSION ({ \ + gint gaig_result; \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ *(atomic) : 1); \ + gaig_result = (gint) *(atomic); \ + __sync_synchronize (); \ + __asm__ __volatile__ ("" : : : "memory"); \ + gaig_result; \ + })) +#undef g_atomic_int_set +#define g_atomic_int_set(atomic, newval) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (newval) : 1); \ + __sync_synchronize (); \ + __asm__ __volatile__ ("" : : : "memory"); \ + *(atomic) = (newval); \ + })) +#undef g_atomic_pointer_get +#define g_atomic_pointer_get(atomic) \ + (G_GNUC_EXTENSION ({ \ + gpointer gapg_result; \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + gapg_result = (gpointer) *(atomic); \ + __sync_synchronize (); \ + __asm__ __volatile__ ("" : : : "memory"); \ + gapg_result; \ + })) +#if defined(glib_typeof) +#undef g_atomic_pointer_set +#define g_atomic_pointer_set(atomic, newval) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : NULL); \ + __sync_synchronize (); \ + __asm__ __volatile__ ("" : : : "memory"); \ + *(atomic) = (glib_typeof (*(atomic))) (gsize) (newval); \ + })) +#else /* if !defined(glib_typeof) */ +#undef g_atomic_pointer_set +#define g_atomic_pointer_set(atomic, newval) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : NULL); \ + __sync_synchronize (); \ + __asm__ __volatile__ ("" : : : "memory"); \ + *(atomic) = (gpointer) (gsize) (newval); \ + })) +#endif /* defined(glib_typeof) */ + +#undef g_atomic_int_inc +#define g_atomic_int_inc(atomic) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ *(atomic) : 1); \ + (void) __sync_fetch_and_add ((atomic), 1); \ + })) +#undef g_atomic_int_dec_and_test +#define g_atomic_int_dec_and_test(atomic) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ *(atomic) : 1); \ + __sync_fetch_and_sub ((atomic), 1) == 1; \ + })) +#undef g_atomic_int_compare_and_exchange +#define g_atomic_int_compare_and_exchange(atomic, oldval, newval) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (newval) ^ (oldval) : 1); \ + __sync_bool_compare_and_swap ((atomic), (oldval), (newval)) ? TRUE : FALSE; \ + })) +#undef g_atomic_int_add +#define g_atomic_int_add(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (val) : 1); \ + (gint) __sync_fetch_and_add ((atomic), (val)); \ + })) +#undef g_atomic_int_and +#define g_atomic_int_and(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (val) : 1); \ + (guint) __sync_fetch_and_and ((atomic), (val)); \ + })) +#undef g_atomic_int_or +#define g_atomic_int_or(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (val) : 1); \ + (guint) __sync_fetch_and_or ((atomic), (val)); \ + })) +#undef g_atomic_int_xor +#define g_atomic_int_xor(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (val) : 1); \ + (guint) __sync_fetch_and_xor ((atomic), (val)); \ + })) + +#undef g_atomic_pointer_compare_and_exchange +#define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : NULL); \ + __sync_bool_compare_and_swap ((atomic), (oldval), (newval)) ? TRUE : FALSE; \ + })) +#undef g_atomic_pointer_add +#define g_atomic_pointer_add(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : NULL); \ + (void) (0 ? (val) ^ (val) : 1); \ + (gssize) __sync_fetch_and_add ((atomic), (val)); \ + })) +#undef g_atomic_pointer_and +#define g_atomic_pointer_and(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : NULL); \ + (void) (0 ? (val) ^ (val) : 1); \ + (gsize) __sync_fetch_and_and ((atomic), (val)); \ + })) +#undef g_atomic_pointer_or +#define g_atomic_pointer_or(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : NULL); \ + (void) (0 ? (val) ^ (val) : 1); \ + (gsize) __sync_fetch_and_or ((atomic), (val)); \ + })) +#undef g_atomic_pointer_xor +#define g_atomic_pointer_xor(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : NULL); \ + (void) (0 ? (val) ^ (val) : 1); \ + (gsize) __sync_fetch_and_xor ((atomic), (val)); \ + })) + +#endif /* !defined(__ATOMIC_SEQ_CST) */ + +#else /* defined(G_ATOMIC_LOCK_FREE) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) */ + +#undef g_atomic_int_get +#define g_atomic_int_get(atomic) \ + (_frida_g_atomic_int_get ((gint *) (atomic))) +#undef g_atomic_int_set +#define g_atomic_int_set(atomic, newval) \ + (_frida_g_atomic_int_set ((gint *) (atomic), (gint) (newval))) +#undef g_atomic_int_compare_and_exchange +#define g_atomic_int_compare_and_exchange(atomic, oldval, newval) \ + (_frida_g_atomic_int_compare_and_exchange ((gint *) (atomic), (oldval), (newval))) +#undef g_atomic_int_add +#define g_atomic_int_add(atomic, val) \ + (_frida_g_atomic_int_add ((gint *) (atomic), (val))) +#undef g_atomic_int_and +#define g_atomic_int_and(atomic, val) \ + (_frida_g_atomic_int_and ((guint *) (atomic), (val))) +#undef g_atomic_int_or +#define g_atomic_int_or(atomic, val) \ + (_frida_g_atomic_int_or ((guint *) (atomic), (val))) +#undef g_atomic_int_xor +#define g_atomic_int_xor(atomic, val) \ + (_frida_g_atomic_int_xor ((guint *) (atomic), (val))) +#undef g_atomic_int_inc +#define g_atomic_int_inc(atomic) \ + (_frida_g_atomic_int_inc ((gint *) (atomic))) +#undef g_atomic_int_dec_and_test +#define g_atomic_int_dec_and_test(atomic) \ + (_frida_g_atomic_int_dec_and_test ((gint *) (atomic))) + +#undef g_atomic_pointer_get +#define g_atomic_pointer_get(atomic) \ + (_frida_g_atomic_pointer_get (atomic)) +#undef g_atomic_pointer_set +#define g_atomic_pointer_set(atomic, newval) \ + (_frida_g_atomic_pointer_set ((atomic), (gpointer) (newval))) +#undef g_atomic_pointer_compare_and_exchange +#define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \ + (_frida_g_atomic_pointer_compare_and_exchange ((atomic), (gpointer) (oldval), (gpointer) (newval))) +#undef g_atomic_pointer_add +#define g_atomic_pointer_add(atomic, val) \ + (_frida_g_atomic_pointer_add ((atomic), (gssize) (val))) +#undef g_atomic_pointer_and +#define g_atomic_pointer_and(atomic, val) \ + (_frida_g_atomic_pointer_and ((atomic), (gsize) (val))) +#undef g_atomic_pointer_or +#define g_atomic_pointer_or(atomic, val) \ + (_frida_g_atomic_pointer_or ((atomic), (gsize) (val))) +#undef g_atomic_pointer_xor +#define g_atomic_pointer_xor(atomic, val) \ + (_frida_g_atomic_pointer_xor ((atomic), (gsize) (val))) + +#endif /* defined(G_ATOMIC_LOCK_FREE) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) */ + +#endif /* __G_ATOMIC_H__ */ +/* gerror.h - Error reporting system + * + * Copyright 2000 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_ERROR_H__ +#define __G_ERROR_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_QUARK_H__ +#define __G_QUARK_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef guint32 GQuark; + +/* Quarks (string<->id association) + */ +GLIB_AVAILABLE_IN_ALL +GQuark g_quark_try_string (const gchar *string); +GLIB_AVAILABLE_IN_ALL +GQuark g_quark_from_static_string (const gchar *string); +GLIB_AVAILABLE_IN_ALL +GQuark g_quark_from_string (const gchar *string); +GLIB_AVAILABLE_IN_ALL +const gchar * g_quark_to_string (GQuark quark) G_GNUC_CONST; + +#define G_DEFINE_QUARK(QN, q_n) \ +GQuark \ +q_n##_quark (void) \ +{ \ + static GQuark q; \ + \ + if G_UNLIKELY (q == 0) \ + q = g_quark_from_static_string (#QN); \ + \ + return q; \ +} + +GLIB_AVAILABLE_IN_ALL +const gchar * g_intern_string (const gchar *string); +GLIB_AVAILABLE_IN_ALL +const gchar * g_intern_static_string (const gchar *string); + +G_END_DECLS + +#endif /* __G_QUARK_H__ */ + +G_BEGIN_DECLS + +/** + * GError: + * @domain: error domain, e.g. #G_FILE_ERROR + * @code: error code, e.g. %G_FILE_ERROR_NOENT + * @message: human-readable informative error message + * + * The `GError` structure contains information about + * an error that has occurred. + */ +typedef struct _GError GError; + +struct _GError +{ + GQuark domain; + gint code; + gchar *message; +}; + +GLIB_AVAILABLE_IN_ALL +GError* g_error_new (GQuark domain, + gint code, + const gchar *format, + ...) G_GNUC_PRINTF (3, 4); + +GLIB_AVAILABLE_IN_ALL +GError* g_error_new_literal (GQuark domain, + gint code, + const gchar *message); +GLIB_AVAILABLE_IN_ALL +GError* g_error_new_valist (GQuark domain, + gint code, + const gchar *format, + va_list args) G_GNUC_PRINTF(3, 0); + +GLIB_AVAILABLE_IN_ALL +void g_error_free (GError *error); +GLIB_AVAILABLE_IN_ALL +GError* g_error_copy (const GError *error); + +GLIB_AVAILABLE_IN_ALL +gboolean g_error_matches (const GError *error, + GQuark domain, + gint code); + +/* if (err) *err = g_error_new(domain, code, format, ...), also has + * some sanity checks. + */ +GLIB_AVAILABLE_IN_ALL +void g_set_error (GError **err, + GQuark domain, + gint code, + const gchar *format, + ...) G_GNUC_PRINTF (4, 5); + +GLIB_AVAILABLE_IN_ALL +void g_set_error_literal (GError **err, + GQuark domain, + gint code, + const gchar *message); + +/* if (dest) *dest = src; also has some sanity checks. + */ +GLIB_AVAILABLE_IN_ALL +void g_propagate_error (GError **dest, + GError *src); + +/* if (err && *err) { g_error_free(*err); *err = NULL; } */ +GLIB_AVAILABLE_IN_ALL +void g_clear_error (GError **err); + +/* if (err) prefix the formatted string to the ->message */ +GLIB_AVAILABLE_IN_ALL +void g_prefix_error (GError **err, + const gchar *format, + ...) G_GNUC_PRINTF (2, 3); + +/* g_propagate_error then g_error_prefix on dest */ +GLIB_AVAILABLE_IN_ALL +void g_propagate_prefixed_error (GError **dest, + GError *src, + const gchar *format, + ...) G_GNUC_PRINTF (3, 4); + +G_END_DECLS + +#endif /* __G_ERROR_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_UTILS_H__ +#define __G_UTILS_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +G_BEGIN_DECLS + +/* Define G_VA_COPY() to do the right thing for copying va_list variables. + * glibconfig.h may have already defined G_VA_COPY as va_copy or __va_copy. + */ +#if !defined (G_VA_COPY) +# if defined (__GNUC__) && defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32)) +# define G_VA_COPY(ap1, ap2) (*(ap1) = *(ap2)) +# elif defined (G_VA_COPY_AS_ARRAY) +# define G_VA_COPY(ap1, ap2) memmove ((ap1), (ap2), sizeof (va_list)) +# else /* va_list is a pointer */ +# define G_VA_COPY(ap1, ap2) ((ap1) = (ap2)) +# endif /* va_list is a pointer */ +#endif /* !G_VA_COPY */ + +GLIB_AVAILABLE_IN_ALL +const gchar * g_get_user_name (void); +GLIB_AVAILABLE_IN_ALL +const gchar * g_get_real_name (void); +GLIB_AVAILABLE_IN_ALL +const gchar * g_get_home_dir (void); +GLIB_AVAILABLE_IN_ALL +const gchar * g_get_tmp_dir (void); +GLIB_AVAILABLE_IN_ALL +const gchar * g_get_host_name (void); +GLIB_AVAILABLE_IN_ALL +const gchar * g_get_prgname (void); +GLIB_AVAILABLE_IN_ALL +void g_set_prgname (const gchar *prgname); +GLIB_AVAILABLE_IN_ALL +const gchar * g_get_application_name (void); +GLIB_AVAILABLE_IN_ALL +void g_set_application_name (const gchar *application_name); +GLIB_AVAILABLE_IN_2_64 +gchar * g_get_os_info (const gchar *key_name); + +/** + * G_OS_INFO_KEY_NAME: + * + * A key to get the name of the operating system excluding version information suitable for presentation to the user, e.g. "YoYoOS" + * + * Since: 2.64 + */ +#define G_OS_INFO_KEY_NAME \ + GLIB_AVAILABLE_MACRO_IN_2_64 \ + "NAME" + +/** + * G_OS_INFO_KEY_PRETTY_NAME: + * + * A key to get the name of the operating system in a format suitable for presentation to the user, e.g. "YoYoOS Foo" + * + * Since: 2.64 + */ +#define G_OS_INFO_KEY_PRETTY_NAME \ + GLIB_AVAILABLE_MACRO_IN_2_64 \ + "PRETTY_NAME" + +/** + * G_OS_INFO_KEY_VERSION: + * + * A key to get the operating system version suitable for presentation to the user, e.g. "42 (Foo)" + * + * Since: 2.64 + */ +#define G_OS_INFO_KEY_VERSION \ + GLIB_AVAILABLE_MACRO_IN_2_64 \ + "VERSION" + +/** + * G_OS_INFO_KEY_VERSION_CODENAME: + * + * A key to get a codename identifying the operating system release suitable for processing by scripts or usage in generated filenames, e.g. "foo" + * + * Since: 2.64 + */ +#define G_OS_INFO_KEY_VERSION_CODENAME \ + GLIB_AVAILABLE_MACRO_IN_2_64 \ + "VERSION_CODENAME" + +/** + * G_OS_INFO_KEY_VERSION_ID: + * + * A key to get the version of the operating system suitable for processing by scripts or usage in generated filenames, e.g. "42" + * + * Since: 2.64 + */ +#define G_OS_INFO_KEY_VERSION_ID \ + GLIB_AVAILABLE_MACRO_IN_2_64 \ + "VERSION_ID" + +/** + * G_OS_INFO_KEY_ID: + * + * A key to get an ID identifying the operating system suitable for processing by scripts or usage in generated filenames, e.g. "yoyoos" + * + * Since: 2.64 + */ +#define G_OS_INFO_KEY_ID \ + GLIB_AVAILABLE_MACRO_IN_2_64 \ + "ID" + +/** + * G_OS_INFO_KEY_HOME_URL: + * + * A key to get the homepage for the operating system, e.g. "https://www.yoyo-os.com/" + * + * Since: 2.64 + */ +#define G_OS_INFO_KEY_HOME_URL \ + GLIB_AVAILABLE_MACRO_IN_2_64 \ + "HOME_URL" + +/** + * G_OS_INFO_KEY_DOCUMENTATION_URL: + * + * A key to get the documentation page for the operating system, e.g. "https://docs.yoyo-os.com/" + * + * Since: 2.64 + */ +#define G_OS_INFO_KEY_DOCUMENTATION_URL \ + GLIB_AVAILABLE_MACRO_IN_2_64 \ + "DOCUMENTATION_URL" + +/** + * G_OS_INFO_KEY_SUPPORT_URL: + * + * A key to get the support page for the operating system, e.g. "https://support.yoyo-os.com/" + * + * Since: 2.64 + */ +#define G_OS_INFO_KEY_SUPPORT_URL \ + GLIB_AVAILABLE_MACRO_IN_2_64 \ + "SUPPORT_URL" + +/** + * G_OS_INFO_KEY_BUG_REPORT_URL: + * + * A key to get the bug reporting page for the operating system, e.g. "https://bugs.yoyo-os.com/" + * + * Since: 2.64 + */ +#define G_OS_INFO_KEY_BUG_REPORT_URL \ + GLIB_AVAILABLE_MACRO_IN_2_64 \ + "BUG_REPORT_URL" + +/** + * G_OS_INFO_KEY_PRIVACY_POLICY_URL: + * + * A key to get the privacy policy for the operating system, e.g. "https://privacy.yoyo-os.com/" + * + * Since: 2.64 + */ +#define G_OS_INFO_KEY_PRIVACY_POLICY_URL \ + GLIB_AVAILABLE_MACRO_IN_2_64 \ + "PRIVACY_POLICY_URL" + +GLIB_AVAILABLE_IN_ALL +void g_reload_user_special_dirs_cache (void); +GLIB_AVAILABLE_IN_ALL +const gchar * g_get_user_data_dir (void); +GLIB_AVAILABLE_IN_ALL +const gchar * g_get_user_config_dir (void); +GLIB_AVAILABLE_IN_ALL +const gchar * g_get_user_cache_dir (void); +GLIB_AVAILABLE_IN_ALL +const gchar * const * g_get_system_data_dirs (void); + +#ifdef G_OS_WIN32 +/* This function is not part of the public GLib API */ +GLIB_AVAILABLE_IN_ALL +const gchar * const * g_win32_get_system_data_dirs_for_module (void (*address_of_function)(void)); +#endif + +#if defined (G_OS_WIN32) && defined (G_CAN_INLINE) +/* This function is not part of the public GLib API either. Just call + * g_get_system_data_dirs() in your code, never mind that that is + * actually a macro and you will in fact call this inline function. + */ +static inline const gchar * const * +_g_win32_get_system_data_dirs (void) +{ + return g_win32_get_system_data_dirs_for_module ((void (*)(void)) &_g_win32_get_system_data_dirs); +} +#undef g_get_system_data_dirs +#define g_get_system_data_dirs _g_win32_get_system_data_dirs +#endif + +GLIB_AVAILABLE_IN_ALL +const gchar * const * g_get_system_config_dirs (void); + +GLIB_AVAILABLE_IN_ALL +const gchar * g_get_user_runtime_dir (void); + +/** + * GUserDirectory: + * @G_USER_DIRECTORY_DESKTOP: the user's Desktop directory + * @G_USER_DIRECTORY_DOCUMENTS: the user's Documents directory + * @G_USER_DIRECTORY_DOWNLOAD: the user's Downloads directory + * @G_USER_DIRECTORY_MUSIC: the user's Music directory + * @G_USER_DIRECTORY_PICTURES: the user's Pictures directory + * @G_USER_DIRECTORY_PUBLIC_SHARE: the user's shared directory + * @G_USER_DIRECTORY_TEMPLATES: the user's Templates directory + * @G_USER_DIRECTORY_VIDEOS: the user's Movies directory + * @G_USER_N_DIRECTORIES: the number of enum values + * + * These are logical ids for special directories which are defined + * depending on the platform used. You should use g_get_user_special_dir() + * to retrieve the full path associated to the logical id. + * + * The #GUserDirectory enumeration can be extended at later date. Not + * every platform has a directory for every logical id in this + * enumeration. + * + * Since: 2.14 + */ +typedef enum { + G_USER_DIRECTORY_DESKTOP, + G_USER_DIRECTORY_DOCUMENTS, + G_USER_DIRECTORY_DOWNLOAD, + G_USER_DIRECTORY_MUSIC, + G_USER_DIRECTORY_PICTURES, + G_USER_DIRECTORY_PUBLIC_SHARE, + G_USER_DIRECTORY_TEMPLATES, + G_USER_DIRECTORY_VIDEOS, + + G_USER_N_DIRECTORIES +} GUserDirectory; + +GLIB_AVAILABLE_IN_ALL +const gchar * g_get_user_special_dir (GUserDirectory directory); + +/** + * GDebugKey: + * @key: the string + * @value: the flag + * + * Associates a string with a bit flag. + * Used in g_parse_debug_string(). + */ +typedef struct _GDebugKey GDebugKey; +struct _GDebugKey +{ + const gchar *key; + guint value; +}; + +/* Miscellaneous utility functions + */ +GLIB_AVAILABLE_IN_ALL +guint g_parse_debug_string (const gchar *string, + const GDebugKey *keys, + guint nkeys); + +GLIB_AVAILABLE_IN_ALL +gint g_snprintf (gchar *string, + gulong n, + gchar const *format, + ...) G_GNUC_PRINTF (3, 4); +GLIB_AVAILABLE_IN_ALL +gint g_vsnprintf (gchar *string, + gulong n, + gchar const *format, + va_list args) + G_GNUC_PRINTF(3, 0); + +GLIB_AVAILABLE_IN_ALL +void g_nullify_pointer (gpointer *nullify_location); + +typedef enum +{ + G_FORMAT_SIZE_DEFAULT = 0, + G_FORMAT_SIZE_LONG_FORMAT = 1 << 0, + G_FORMAT_SIZE_IEC_UNITS = 1 << 1, + G_FORMAT_SIZE_BITS = 1 << 2 +} GFormatSizeFlags; + +GLIB_AVAILABLE_IN_2_30 +gchar *g_format_size_full (guint64 size, + GFormatSizeFlags flags); +GLIB_AVAILABLE_IN_2_30 +gchar *g_format_size (guint64 size); + +GLIB_DEPRECATED_IN_2_30_FOR(g_format_size) +gchar *g_format_size_for_display (goffset size); + +#define g_ATEXIT(proc) (atexit (proc)) GLIB_DEPRECATED_MACRO_IN_2_32 +#define g_memmove(dest,src,len) \ + G_STMT_START { memmove ((dest), (src), (len)); } G_STMT_END GLIB_DEPRECATED_MACRO_IN_2_40_FOR(memmove) + +/** + * GVoidFunc: + * + * Declares a type of function which takes no arguments + * and has no return value. It is used to specify the type + * function passed to g_atexit(). + */ +typedef void (*GVoidFunc) (void) GLIB_DEPRECATED_TYPE_IN_2_32; +#define ATEXIT(proc) g_ATEXIT(proc) GLIB_DEPRECATED_MACRO_IN_2_32 + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_DEPRECATED +void g_atexit (GVoidFunc func); +G_GNUC_END_IGNORE_DEPRECATIONS + +#ifdef G_OS_WIN32 +/* It's a bad idea to wrap atexit() on Windows. If the GLib DLL calls + * atexit(), the function will be called when the GLib DLL is detached + * from the program, which is not what the caller wants. The caller + * wants the function to be called when it *itself* exits (or is + * detached, in case the caller, too, is a DLL). + */ +#if (defined(__MINGW_H) && !defined(_STDLIB_H_)) || (defined(_MSC_VER) && !defined(_INC_STDLIB)) +int atexit (void (*)(void)); +#endif +#undef g_atexit +#define g_atexit(func) atexit(func) GLIB_DEPRECATED_MACRO_IN_2_32 +#endif + + +/* Look for an executable in PATH, following execvp() rules */ +GLIB_AVAILABLE_IN_ALL +gchar* g_find_program_in_path (const gchar *program); + +/* Bit tests + * + * These are defined in a convoluted way because we want the compiler to + * be able to inline the code for performance reasons, but for + * historical reasons, we must continue to provide non-inline versions + * on our ABI. + * + * We define these as functions in gutils.c which are just implemented + * as calls to the _impl() versions in order to preserve the ABI. + */ + +#undef g_bit_nth_lsf +#define g_bit_nth_lsf(mask, nth_bit) g_bit_nth_lsf_impl(mask, nth_bit) +#undef g_bit_nth_msf +#define g_bit_nth_msf(mask, nth_bit) g_bit_nth_msf_impl(mask, nth_bit) +#undef g_bit_storage +#define g_bit_storage(number) g_bit_storage_impl(number) + +GLIB_AVAILABLE_IN_ALL +gint (g_bit_nth_lsf) (gulong mask, + gint nth_bit); +GLIB_AVAILABLE_IN_ALL +gint (g_bit_nth_msf) (gulong mask, + gint nth_bit); +GLIB_AVAILABLE_IN_ALL +guint (g_bit_storage) (gulong number); + +static inline gint +g_bit_nth_lsf_impl (gulong mask, + gint nth_bit) +{ + if (G_UNLIKELY (nth_bit < -1)) + nth_bit = -1; + while (nth_bit < ((GLIB_SIZEOF_LONG * 8) - 1)) + { + nth_bit++; + if (mask & (1UL << nth_bit)) + return nth_bit; + } + return -1; +} + +static inline gint +g_bit_nth_msf_impl (gulong mask, + gint nth_bit) +{ + if (nth_bit < 0 || G_UNLIKELY (nth_bit > GLIB_SIZEOF_LONG * 8)) + nth_bit = GLIB_SIZEOF_LONG * 8; + while (nth_bit > 0) + { + nth_bit--; + if (mask & (1UL << nth_bit)) + return nth_bit; + } + return -1; +} + +static inline guint +g_bit_storage_impl (gulong number) +{ +#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__) + return G_LIKELY (number) ? + ((GLIB_SIZEOF_LONG * 8U - 1) ^ (guint) __builtin_clzl(number)) + 1 : 1; +#else + guint n_bits = 0; + + do + { + n_bits++; + number >>= 1; + } + while (number); + return n_bits; +#endif +} + +/* Crashes the program. */ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_50 +#ifndef G_OS_WIN32 +# include +# define g_abort() abort () +#else +GLIB_AVAILABLE_IN_2_50 +G_NORETURN void g_abort (void) G_ANALYZER_NORETURN; +#endif +#endif + +/* + * This macro is deprecated. This DllMain() is too complex. It is + * recommended to write an explicit minimal DLlMain() that just saves + * the handle to the DLL and then use that handle instead, for + * instance passing it to + * g_win32_get_package_installation_directory_of_module(). + * + * On Windows, this macro defines a DllMain function that stores the + * actual DLL name that the code being compiled will be included in. + * STATIC should be empty or 'static'. DLL_NAME is the name of the + * (pointer to the) char array where the DLL name will be stored. If + * this is used, you must also include . If you need a more complex + * DLL entry point function, you cannot use this. + * + * On non-Windows platforms, expands to nothing. + */ + +#ifndef G_PLATFORM_WIN32 +# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) GLIB_DEPRECATED_MACRO_IN_2_26 +#else +# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) \ +static char *dll_name; \ + \ +BOOL WINAPI \ +DllMain (HINSTANCE hinstDLL, \ + DWORD fdwReason, \ + LPVOID lpvReserved) \ +{ \ + wchar_t wcbfr[1000]; \ + char *tem; \ + switch (fdwReason) \ + { \ + case DLL_PROCESS_ATTACH: \ + GetModuleFileNameW ((HMODULE) hinstDLL, wcbfr, G_N_ELEMENTS (wcbfr)); \ + tem = g_utf16_to_utf8 (wcbfr, -1, NULL, NULL, NULL); \ + dll_name = g_path_get_basename (tem); \ + g_free (tem); \ + break; \ + } \ + \ + return TRUE; \ +} GLIB_DEPRECATED_MACRO_IN_2_26 +#endif /* G_PLATFORM_WIN32 */ + +G_END_DECLS + +#endif /* __G_UTILS_H__ */ + +G_BEGIN_DECLS + +#define G_THREAD_ERROR g_thread_error_quark () +GLIB_AVAILABLE_IN_ALL +GQuark g_thread_error_quark (void); + +typedef enum +{ + G_THREAD_ERROR_AGAIN /* Resource temporarily unavailable */ +} GThreadError; + +typedef gpointer (*GThreadFunc) (gpointer data); +typedef void (*GThreadGarbageHandler) (gpointer data); + +typedef struct _GThreadCallbacks GThreadCallbacks; +typedef struct _GThread GThread; + +typedef union _GMutex GMutex; +typedef struct _GRecMutex GRecMutex; +typedef struct _GRWLock GRWLock; +typedef struct _GCond GCond; +typedef struct _GPrivate GPrivate; +typedef struct _GOnce GOnce; + +typedef enum +{ + G_PRIVATE_DESTROY_LATE = 1 << 0, + G_PRIVATE_DESTROY_LAST = 1 << 1, +} GPrivateFlags; + +struct _GThreadCallbacks +{ + void (*on_thread_init) (void); + void (*on_thread_realize) (void); + void (*on_thread_dispose) (void); + void (*on_thread_finalize) (void); +}; + +union _GMutex +{ + /*< private >*/ + gpointer p; + guint i[2]; +}; + +struct _GRWLock +{ + /*< private >*/ + gpointer p; + guint i[2]; +}; + +struct _GCond +{ + /*< private >*/ + gpointer p; + guint i[2]; +}; + +struct _GRecMutex +{ + /*< private >*/ + gpointer p; + guint i[2]; +}; + +#define G_PRIVATE_INIT(notify) \ + { NULL, (notify), 0, { NULL } } +#define G_PRIVATE_INIT_WITH_FLAGS(notify, flags) \ + { NULL, (notify), (flags), { NULL } } +struct _GPrivate +{ + /*< private >*/ + gpointer p; + GDestroyNotify notify; + GPrivateFlags flags; + gpointer future[1]; +}; + +typedef enum +{ + G_ONCE_STATUS_NOTCALLED, + G_ONCE_STATUS_PROGRESS, + G_ONCE_STATUS_READY +} GOnceStatus; + +#define G_ONCE_INIT { G_ONCE_STATUS_NOTCALLED, NULL } +struct _GOnce +{ + volatile GOnceStatus status; + volatile gpointer retval; +}; + +#define G_LOCK_NAME(name) g__ ## name ## _lock +#define G_LOCK_DEFINE_STATIC(name) static G_LOCK_DEFINE (name) +#define G_LOCK_DEFINE(name) GMutex G_LOCK_NAME (name) +#define G_LOCK_EXTERN(name) extern GMutex G_LOCK_NAME (name) + +#ifdef G_DEBUG_LOCKS +# define G_LOCK(name) G_STMT_START{ \ + g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ + "file %s: line %d (%s): locking: %s ", \ + __FILE__, __LINE__, G_STRFUNC, \ + #name); \ + g_mutex_lock (&G_LOCK_NAME (name)); \ + }G_STMT_END +# define G_UNLOCK(name) G_STMT_START{ \ + g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ + "file %s: line %d (%s): unlocking: %s ", \ + __FILE__, __LINE__, G_STRFUNC, \ + #name); \ + g_mutex_unlock (&G_LOCK_NAME (name)); \ + }G_STMT_END +# define G_TRYLOCK(name) \ + (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ + "file %s: line %d (%s): try locking: %s ", \ + __FILE__, __LINE__, G_STRFUNC, \ + #name), g_mutex_trylock (&G_LOCK_NAME (name))) +#else /* !G_DEBUG_LOCKS */ +# define G_LOCK(name) g_mutex_lock (&G_LOCK_NAME (name)) +# define G_UNLOCK(name) g_mutex_unlock (&G_LOCK_NAME (name)) +# define G_TRYLOCK(name) g_mutex_trylock (&G_LOCK_NAME (name)) +#endif /* !G_DEBUG_LOCKS */ + +GLIB_VAR GThreadCallbacks *glib_thread_callbacks; +GLIB_AVAILABLE_IN_2_68 +void g_thread_set_callbacks (GThreadCallbacks *callbacks); +GLIB_AVAILABLE_IN_2_68 +void g_thread_set_garbage_handler (GThreadGarbageHandler handler, + gpointer user_data); +GLIB_AVAILABLE_IN_2_68 +gboolean g_thread_garbage_collect (void); + +GLIB_AVAILABLE_IN_2_32 +GThread * g_thread_ref (GThread *thread); +GLIB_AVAILABLE_IN_2_32 +void g_thread_unref (GThread *thread); +GLIB_AVAILABLE_IN_2_32 +GThread * g_thread_new (const gchar *name, + GThreadFunc func, + gpointer data); +GLIB_AVAILABLE_IN_2_32 +GThread * g_thread_try_new (const gchar *name, + GThreadFunc func, + gpointer data, + GError **error); +GLIB_AVAILABLE_IN_ALL +GThread * g_thread_self (void); +GLIB_AVAILABLE_IN_ALL +void g_thread_exit (gpointer retval); +GLIB_AVAILABLE_IN_ALL +gpointer g_thread_join (GThread *thread); +GLIB_AVAILABLE_IN_ALL +void g_thread_yield (void); + + +GLIB_AVAILABLE_IN_2_32 +void g_mutex_init (GMutex *mutex); +GLIB_AVAILABLE_IN_2_32 +void g_mutex_clear (GMutex *mutex); +GLIB_AVAILABLE_IN_ALL +void g_mutex_lock (GMutex *mutex); +GLIB_AVAILABLE_IN_ALL +gboolean g_mutex_trylock (GMutex *mutex); +GLIB_AVAILABLE_IN_ALL +void g_mutex_unlock (GMutex *mutex); + +GLIB_AVAILABLE_IN_2_32 +void g_rw_lock_init (GRWLock *rw_lock); +GLIB_AVAILABLE_IN_2_32 +void g_rw_lock_clear (GRWLock *rw_lock); +GLIB_AVAILABLE_IN_2_32 +void g_rw_lock_writer_lock (GRWLock *rw_lock); +GLIB_AVAILABLE_IN_2_32 +gboolean g_rw_lock_writer_trylock (GRWLock *rw_lock); +GLIB_AVAILABLE_IN_2_32 +void g_rw_lock_writer_unlock (GRWLock *rw_lock); +GLIB_AVAILABLE_IN_2_32 +void g_rw_lock_reader_lock (GRWLock *rw_lock); +GLIB_AVAILABLE_IN_2_32 +gboolean g_rw_lock_reader_trylock (GRWLock *rw_lock); +GLIB_AVAILABLE_IN_2_32 +void g_rw_lock_reader_unlock (GRWLock *rw_lock); + +GLIB_AVAILABLE_IN_2_32 +void g_rec_mutex_init (GRecMutex *rec_mutex); +GLIB_AVAILABLE_IN_2_32 +void g_rec_mutex_clear (GRecMutex *rec_mutex); +GLIB_AVAILABLE_IN_2_32 +void g_rec_mutex_lock (GRecMutex *rec_mutex); +GLIB_AVAILABLE_IN_2_32 +gboolean g_rec_mutex_trylock (GRecMutex *rec_mutex); +GLIB_AVAILABLE_IN_2_32 +void g_rec_mutex_unlock (GRecMutex *rec_mutex); + +GLIB_AVAILABLE_IN_2_32 +void g_cond_init (GCond *cond); +GLIB_AVAILABLE_IN_2_32 +void g_cond_clear (GCond *cond); +GLIB_AVAILABLE_IN_ALL +void g_cond_wait (GCond *cond, + GMutex *mutex); +GLIB_AVAILABLE_IN_ALL +void g_cond_signal (GCond *cond); +GLIB_AVAILABLE_IN_ALL +void g_cond_broadcast (GCond *cond); +GLIB_AVAILABLE_IN_2_32 +gboolean g_cond_wait_until (GCond *cond, + GMutex *mutex, + gint64 end_time); + +GLIB_AVAILABLE_IN_ALL +gpointer g_private_get (GPrivate *key); +GLIB_AVAILABLE_IN_ALL +void g_private_set (GPrivate *key, + gpointer value); +GLIB_AVAILABLE_IN_2_32 +void g_private_replace (GPrivate *key, + gpointer value); + +GLIB_AVAILABLE_IN_ALL +gpointer g_once_impl (GOnce *once, + GThreadFunc func, + gpointer arg); +GLIB_AVAILABLE_IN_ALL +gboolean g_once_init_enter (volatile void *location); +GLIB_AVAILABLE_IN_ALL +void g_once_init_leave (volatile void *location, + gsize result); + +/* Use C11-style atomic extensions to check the fast path for status=ready. If + * they are not available, fall back to using a mutex and condition variable in + * g_once_impl(). + * + * On the C11-style codepath, only the load of once->status needs to be atomic, + * as the writes to it and once->retval in g_once_impl() are related by a + * happens-before relation. Release-acquire semantics are defined such that any + * atomic/non-atomic write which happens-before a store/release is guaranteed to + * be seen by the load/acquire of the same atomic variable. */ +#if defined(G_ATOMIC_LOCK_FREE) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) && defined(__ATOMIC_SEQ_CST) +# define g_once(once, func, arg) \ + ((__atomic_load_n (&(once)->status, __ATOMIC_ACQUIRE) == G_ONCE_STATUS_READY) ? \ + (once)->retval : \ + g_once_impl ((once), (func), (arg))) +#else +# define g_once(once, func, arg) g_once_impl ((once), (func), (arg)) +#endif + +#ifdef __GNUC__ +#undef g_once_init_enter +# define g_once_init_enter(location) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(location) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(location) : NULL); \ + (!g_atomic_pointer_get (location) && \ + _frida_g_once_init_enter (location)); \ + })) +#undef g_once_init_leave +# define g_once_init_leave(location, result) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(location) == sizeof (gpointer)); \ + 0 ? (void) (*(location) = (result)) : (void) 0; \ + _frida_g_once_init_leave ((location), (gsize) (result)); \ + })) +#else +#undef g_once_init_enter +# define g_once_init_enter(location) \ + (_frida_g_once_init_enter((location))) +#undef g_once_init_leave +# define g_once_init_leave(location, result) \ + (_frida_g_once_init_leave((location), (gsize) (result))) +#endif + +GLIB_AVAILABLE_IN_2_36 +guint g_get_num_processors (void); + +/** + * GMutexLocker: + * + * Opaque type. See g_mutex_locker_new() for details. + * Since: 2.44 + */ +typedef void GMutexLocker; + +/** + * g_mutex_locker_new: + * @mutex: a mutex to lock + * + * Lock @mutex and return a new #GMutexLocker. Unlock with + * g_mutex_locker_free(). Using g_mutex_unlock() on @mutex + * while a #GMutexLocker exists can lead to undefined behaviour. + * + * No allocation is performed, it is equivalent to a g_mutex_lock() call. + * + * This is intended to be used with g_autoptr(). Note that g_autoptr() + * is only available when using GCC or clang, so the following example + * will only work with those compilers: + * |[ + * typedef struct + * { + * ... + * GMutex mutex; + * ... + * } MyObject; + * + * static void + * my_object_do_stuff (MyObject *self) + * { + * g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&self->mutex); + * + * // Code with mutex locked here + * + * if (cond) + * // No need to unlock + * return; + * + * // Optionally early unlock + * g_clear_pointer (&locker, g_mutex_locker_free); + * + * // Code with mutex unlocked here + * } + * ]| + * + * Returns: a #GMutexLocker + * Since: 2.44 + */ +GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 +static inline GMutexLocker * +g_mutex_locker_new (GMutex *mutex) +{ + g_mutex_lock (mutex); + return (GMutexLocker *) mutex; +} + +/** + * g_mutex_locker_free: + * @locker: a GMutexLocker + * + * Unlock @locker's mutex. See g_mutex_locker_new() for details. + * + * No memory is freed, it is equivalent to a g_mutex_unlock() call. + * + * Since: 2.44 + */ +GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 +static inline void +g_mutex_locker_free (GMutexLocker *locker) +{ + g_mutex_unlock ((GMutex *) locker); +} + +/** + * GRecMutexLocker: + * + * Opaque type. See g_rec_mutex_locker_new() for details. + * Since: 2.60 + */ +typedef void GRecMutexLocker; + +/** + * g_rec_mutex_locker_new: + * @rec_mutex: a recursive mutex to lock + * + * Lock @rec_mutex and return a new #GRecMutexLocker. Unlock with + * g_rec_mutex_locker_free(). Using g_rec_mutex_unlock() on @rec_mutex + * while a #GRecMutexLocker exists can lead to undefined behaviour. + * + * No allocation is performed, it is equivalent to a g_rec_mutex_lock() call. + * + * This is intended to be used with g_autoptr(). Note that g_autoptr() + * is only available when using GCC or clang, so the following example + * will only work with those compilers: + * |[ + * typedef struct + * { + * ... + * GRecMutex rec_mutex; + * ... + * } MyObject; + * + * static void + * my_object_do_stuff (MyObject *self) + * { + * g_autoptr(GRecMutexLocker) locker = g_rec_mutex_locker_new (&self->rec_mutex); + * + * // Code with rec_mutex locked here + * + * if (cond) + * // No need to unlock + * return; + * + * // Optionally early unlock + * g_clear_pointer (&locker, g_rec_mutex_locker_free); + * + * // Code with rec_mutex unlocked here + * } + * ]| + * + * Returns: a #GRecMutexLocker + * Since: 2.60 + */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_60 +static inline GRecMutexLocker * +g_rec_mutex_locker_new (GRecMutex *rec_mutex) +{ + g_rec_mutex_lock (rec_mutex); + return (GRecMutexLocker *) rec_mutex; +} +G_GNUC_END_IGNORE_DEPRECATIONS + +/** + * g_rec_mutex_locker_free: + * @locker: a GRecMutexLocker + * + * Unlock @locker's recursive mutex. See g_rec_mutex_locker_new() for details. + * + * No memory is freed, it is equivalent to a g_rec_mutex_unlock() call. + * + * Since: 2.60 + */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_60 +static inline void +g_rec_mutex_locker_free (GRecMutexLocker *locker) +{ + g_rec_mutex_unlock ((GRecMutex *) locker); +} +G_GNUC_END_IGNORE_DEPRECATIONS + +/** + * GRWLockWriterLocker: + * + * Opaque type. See g_rw_lock_writer_locker_new() for details. + * Since: 2.62 + */ +typedef void GRWLockWriterLocker; + +/** + * g_rw_lock_writer_locker_new: + * @rw_lock: a #GRWLock + * + * Obtain a write lock on @rw_lock and return a new #GRWLockWriterLocker. + * Unlock with g_rw_lock_writer_locker_free(). Using g_rw_lock_writer_unlock() + * on @rw_lock while a #GRWLockWriterLocker exists can lead to undefined + * behaviour. + * + * No allocation is performed, it is equivalent to a g_rw_lock_writer_lock() call. + * + * This is intended to be used with g_autoptr(). Note that g_autoptr() + * is only available when using GCC or clang, so the following example + * will only work with those compilers: + * |[ + * typedef struct + * { + * ... + * GRWLock rw_lock; + * GPtrArray *array; + * ... + * } MyObject; + * + * static gchar * + * my_object_get_data (MyObject *self, guint index) + * { + * g_autoptr(GRWLockReaderLocker) locker = g_rw_lock_reader_locker_new (&self->rw_lock); + * + * // Code with a read lock obtained on rw_lock here + * + * if (self->array == NULL) + * // No need to unlock + * return NULL; + * + * if (index < self->array->len) + * // No need to unlock + * return g_ptr_array_index (self->array, index); + * + * // Optionally early unlock + * g_clear_pointer (&locker, g_rw_lock_reader_locker_free); + * + * // Code with rw_lock unlocked here + * return NULL; + * } + * + * static void + * my_object_set_data (MyObject *self, guint index, gpointer data) + * { + * g_autoptr(GRWLockWriterLocker) locker = g_rw_lock_writer_locker_new (&self->rw_lock); + * + * // Code with a write lock obtained on rw_lock here + * + * if (self->array == NULL) + * self->array = g_ptr_array_new (); + * + * if (cond) + * // No need to unlock + * return; + * + * if (index >= self->array->len) + * g_ptr_array_set_size (self->array, index+1); + * g_ptr_array_index (self->array, index) = data; + * + * // Optionally early unlock + * g_clear_pointer (&locker, g_rw_lock_writer_locker_free); + * + * // Code with rw_lock unlocked here + * } + * ]| + * + * Returns: a #GRWLockWriterLocker + * Since: 2.62 + */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 +static inline GRWLockWriterLocker * +g_rw_lock_writer_locker_new (GRWLock *rw_lock) +{ + g_rw_lock_writer_lock (rw_lock); + return (GRWLockWriterLocker *) rw_lock; +} +G_GNUC_END_IGNORE_DEPRECATIONS + +/** + * g_rw_lock_writer_locker_free: + * @locker: a GRWLockWriterLocker + * + * Release a write lock on @locker's read-write lock. See + * g_rw_lock_writer_locker_new() for details. + * + * No memory is freed, it is equivalent to a g_rw_lock_writer_unlock() call. + * + * Since: 2.62 + */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 +static inline void +g_rw_lock_writer_locker_free (GRWLockWriterLocker *locker) +{ + g_rw_lock_writer_unlock ((GRWLock *) locker); +} +G_GNUC_END_IGNORE_DEPRECATIONS + +/** + * GRWLockReaderLocker: + * + * Opaque type. See g_rw_lock_reader_locker_new() for details. + * Since: 2.62 + */ +typedef void GRWLockReaderLocker; + +/** + * g_rw_lock_reader_locker_new: + * @rw_lock: a #GRWLock + * + * Obtain a read lock on @rw_lock and return a new #GRWLockReaderLocker. + * Unlock with g_rw_lock_reader_locker_free(). Using g_rw_lock_reader_unlock() + * on @rw_lock while a #GRWLockReaderLocker exists can lead to undefined + * behaviour. + * + * No allocation is performed, it is equivalent to a g_rw_lock_reader_lock() call. + * + * This is intended to be used with g_autoptr(). For a code sample, see + * g_rw_lock_writer_locker_new(). + * + * Returns: a #GRWLockReaderLocker + * Since: 2.62 + */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 +static inline GRWLockReaderLocker * +g_rw_lock_reader_locker_new (GRWLock *rw_lock) +{ + g_rw_lock_reader_lock (rw_lock); + return (GRWLockReaderLocker *) rw_lock; +} +G_GNUC_END_IGNORE_DEPRECATIONS + +/** + * g_rw_lock_reader_locker_free: + * @locker: a GRWLockReaderLocker + * + * Release a read lock on @locker's read-write lock. See + * g_rw_lock_reader_locker_new() for details. + * + * No memory is freed, it is equivalent to a g_rw_lock_reader_unlock() call. + * + * Since: 2.62 + */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 +static inline void +g_rw_lock_reader_locker_free (GRWLockReaderLocker *locker) +{ + g_rw_lock_reader_unlock ((GRWLock *) locker); +} +G_GNUC_END_IGNORE_DEPRECATIONS + +G_END_DECLS + +#endif /* __G_THREAD_H__ */ + +G_BEGIN_DECLS + +typedef struct _GAsyncQueue GAsyncQueue; + +GLIB_AVAILABLE_IN_ALL +GAsyncQueue *g_async_queue_new (void); +GLIB_AVAILABLE_IN_ALL +GAsyncQueue *g_async_queue_new_full (GDestroyNotify item_free_func); +GLIB_AVAILABLE_IN_ALL +void g_async_queue_lock (GAsyncQueue *queue); +GLIB_AVAILABLE_IN_ALL +void g_async_queue_unlock (GAsyncQueue *queue); +GLIB_AVAILABLE_IN_ALL +GAsyncQueue *g_async_queue_ref (GAsyncQueue *queue); +GLIB_AVAILABLE_IN_ALL +void g_async_queue_unref (GAsyncQueue *queue); + +GLIB_DEPRECATED_FOR(g_async_queue_ref) +void g_async_queue_ref_unlocked (GAsyncQueue *queue); + +GLIB_DEPRECATED_FOR(g_async_queue_unref) +void g_async_queue_unref_and_unlock (GAsyncQueue *queue); + +GLIB_AVAILABLE_IN_ALL +void g_async_queue_push (GAsyncQueue *queue, + gpointer data); +GLIB_AVAILABLE_IN_ALL +void g_async_queue_push_unlocked (GAsyncQueue *queue, + gpointer data); +GLIB_AVAILABLE_IN_ALL +void g_async_queue_push_sorted (GAsyncQueue *queue, + gpointer data, + GCompareDataFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +void g_async_queue_push_sorted_unlocked (GAsyncQueue *queue, + gpointer data, + GCompareDataFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +gpointer g_async_queue_pop (GAsyncQueue *queue); +GLIB_AVAILABLE_IN_ALL +gpointer g_async_queue_pop_unlocked (GAsyncQueue *queue); +GLIB_AVAILABLE_IN_ALL +gpointer g_async_queue_try_pop (GAsyncQueue *queue); +GLIB_AVAILABLE_IN_ALL +gpointer g_async_queue_try_pop_unlocked (GAsyncQueue *queue); +GLIB_AVAILABLE_IN_ALL +gpointer g_async_queue_timeout_pop (GAsyncQueue *queue, + guint64 timeout); +GLIB_AVAILABLE_IN_ALL +gpointer g_async_queue_timeout_pop_unlocked (GAsyncQueue *queue, + guint64 timeout); +GLIB_AVAILABLE_IN_ALL +gint g_async_queue_length (GAsyncQueue *queue); +GLIB_AVAILABLE_IN_ALL +gint g_async_queue_length_unlocked (GAsyncQueue *queue); +GLIB_AVAILABLE_IN_ALL +void g_async_queue_sort (GAsyncQueue *queue, + GCompareDataFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +void g_async_queue_sort_unlocked (GAsyncQueue *queue, + GCompareDataFunc func, + gpointer user_data); + +GLIB_AVAILABLE_IN_2_46 +gboolean g_async_queue_remove (GAsyncQueue *queue, + gpointer item); +GLIB_AVAILABLE_IN_2_46 +gboolean g_async_queue_remove_unlocked (GAsyncQueue *queue, + gpointer item); +GLIB_AVAILABLE_IN_2_46 +void g_async_queue_push_front (GAsyncQueue *queue, + gpointer item); +GLIB_AVAILABLE_IN_2_46 +void g_async_queue_push_front_unlocked (GAsyncQueue *queue, + gpointer item); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_DEPRECATED_FOR(g_async_queue_timeout_pop) +gpointer g_async_queue_timed_pop (GAsyncQueue *queue, + GTimeVal *end_time); +GLIB_DEPRECATED_FOR(g_async_queue_timeout_pop_unlocked) +gpointer g_async_queue_timed_pop_unlocked (GAsyncQueue *queue, + GTimeVal *end_time); +G_GNUC_END_IGNORE_DEPRECATIONS + +G_END_DECLS + +#endif /* __G_ASYNCQUEUE_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_BACKTRACE_H__ +#define __G_BACKTRACE_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifdef __sun__ +#include +#endif +#include + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_ALL +void g_on_error_query (const gchar *prg_name); +GLIB_AVAILABLE_IN_ALL +void g_on_error_stack_trace (const gchar *prg_name); + +/** + * G_BREAKPOINT: + * + * Inserts a breakpoint instruction into the code. + * + * On architectures which support it, this is implemented as a soft interrupt + * and on other architectures it raises a `SIGTRAP` signal. + * + * `SIGTRAP` is used rather than abort() to allow breakpoints to be skipped past + * in a debugger if they are not the desired target of debugging. + */ +#if (defined (__i386__) || defined (__x86_64__)) && defined (__GNUC__) && __GNUC__ >= 2 +# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("int $03"); }G_STMT_END +#elif (defined (_MSC_VER) || defined (__DMC__)) && defined (_M_IX86) +# define G_BREAKPOINT() G_STMT_START{ __asm int 3h }G_STMT_END +#elif defined (_MSC_VER) +# define G_BREAKPOINT() G_STMT_START{ __debugbreak(); }G_STMT_END +#elif defined (__alpha__) && !defined(__osf__) && defined (__GNUC__) && __GNUC__ >= 2 +# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("bpt"); }G_STMT_END +#elif defined (__APPLE__) || (defined(_WIN32) && (defined(__clang__) || defined(__GNUC__))) +# define G_BREAKPOINT() G_STMT_START{ __builtin_trap(); }G_STMT_END +#else /* !__i386__ && !__alpha__ */ +# define G_BREAKPOINT() G_STMT_START{ raise (SIGTRAP); }G_STMT_END +#endif /* __i386__ */ + +G_END_DECLS + +#endif /* __G_BACKTRACE_H__ */ +/* gbase64.h - Base64 coding functions + * + * Copyright (C) 2005 Alexander Larsson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_BASE64_H__ +#define __G_BASE64_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_ALL +gsize g_base64_encode_step (const guchar *in, + gsize len, + gboolean break_lines, + gchar *out, + gint *state, + gint *save); +GLIB_AVAILABLE_IN_ALL +gsize g_base64_encode_close (gboolean break_lines, + gchar *out, + gint *state, + gint *save); +GLIB_AVAILABLE_IN_ALL +gchar* g_base64_encode (const guchar *data, + gsize len) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gsize g_base64_decode_step (const gchar *in, + gsize len, + guchar *out, + gint *state, + guint *save); +GLIB_AVAILABLE_IN_ALL +guchar *g_base64_decode (const gchar *text, + gsize *out_len) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +guchar *g_base64_decode_inplace (gchar *text, + gsize *out_len); + + +G_END_DECLS + +#endif /* __G_BASE64_H__ */ +/* + * Copyright © 2008 Ryan Lortie + * Copyright © 2010 Codethink Limited + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + */ + +#ifndef __G_BITLOCK_H__ +#define __G_BITLOCK_H__ + + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_ALL +void g_bit_lock (volatile gint *address, + gint lock_bit); +GLIB_AVAILABLE_IN_ALL +gboolean g_bit_trylock (volatile gint *address, + gint lock_bit); +GLIB_AVAILABLE_IN_ALL +void g_bit_unlock (volatile gint *address, + gint lock_bit); + +GLIB_AVAILABLE_IN_ALL +void g_pointer_bit_lock (volatile void *address, + gint lock_bit); +GLIB_AVAILABLE_IN_ALL +gboolean g_pointer_bit_trylock (volatile void *address, + gint lock_bit); +GLIB_AVAILABLE_IN_ALL +void g_pointer_bit_unlock (volatile void *address, + gint lock_bit); + +#ifdef __GNUC__ + +#undef g_pointer_bit_lock +#define g_pointer_bit_lock(address, lock_bit) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \ + _frida_g_pointer_bit_lock ((address), (lock_bit)); \ + })) + +#undef g_pointer_bit_trylock +#define g_pointer_bit_trylock(address, lock_bit) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \ + _frida_g_pointer_bit_trylock ((address), (lock_bit)); \ + })) + +#undef g_pointer_bit_unlock +#define g_pointer_bit_unlock(address, lock_bit) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \ + _frida_g_pointer_bit_unlock ((address), (lock_bit)); \ + })) + +#endif + +G_END_DECLS + +#endif /* __G_BITLOCK_H_ */ +/* gbookmarkfile.h: parsing and building desktop bookmarks + * + * Copyright (C) 2005-2006 Emmanuele Bassi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_BOOKMARK_FILE_H__ +#define __G_BOOKMARK_FILE_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +/* + * Copyright (C) 2009-2010 Christian Hergert + * Copyright © 2010 Codethink Limited + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of the + * licence, or (at your option) any later version. + * + * This is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + * + * Authors: Christian Hergert + * Thiago Santos + * Emmanuele Bassi + * Ryan Lortie + */ + +#ifndef __G_DATE_TIME_H__ +#define __G_DATE_TIME_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +/* + * Copyright © 2010 Codethink Limited + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + */ + +#ifndef __G_TIME_ZONE_H__ +#define __G_TIME_ZONE_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GTimeZone GTimeZone; + +/** + * GTimeType: + * @G_TIME_TYPE_STANDARD: the time is in local standard time + * @G_TIME_TYPE_DAYLIGHT: the time is in local daylight time + * @G_TIME_TYPE_UNIVERSAL: the time is in UTC + * + * Disambiguates a given time in two ways. + * + * First, specifies if the given time is in universal or local time. + * + * Second, if the time is in local time, specifies if it is local + * standard time or local daylight time. This is important for the case + * where the same local time occurs twice (during daylight savings time + * transitions, for example). + */ +typedef enum +{ + G_TIME_TYPE_STANDARD, + G_TIME_TYPE_DAYLIGHT, + G_TIME_TYPE_UNIVERSAL +} GTimeType; + +GLIB_DEPRECATED_IN_2_68_FOR (g_time_zone_new_identifier) +GTimeZone * g_time_zone_new (const gchar *identifier); +GLIB_AVAILABLE_IN_2_68 +GTimeZone * g_time_zone_new_identifier (const gchar *identifier); +GLIB_AVAILABLE_IN_ALL +GTimeZone * g_time_zone_new_utc (void); +GLIB_AVAILABLE_IN_ALL +GTimeZone * g_time_zone_new_local (void); +GLIB_AVAILABLE_IN_2_58 +GTimeZone * g_time_zone_new_offset (gint32 seconds); + +GLIB_AVAILABLE_IN_ALL +GTimeZone * g_time_zone_ref (GTimeZone *tz); +GLIB_AVAILABLE_IN_ALL +void g_time_zone_unref (GTimeZone *tz); + +GLIB_AVAILABLE_IN_ALL +gint g_time_zone_find_interval (GTimeZone *tz, + GTimeType type, + gint64 time_); + +GLIB_AVAILABLE_IN_ALL +gint g_time_zone_adjust_time (GTimeZone *tz, + GTimeType type, + gint64 *time_); + +GLIB_AVAILABLE_IN_ALL +const gchar * g_time_zone_get_abbreviation (GTimeZone *tz, + gint interval); +GLIB_AVAILABLE_IN_ALL +gint32 g_time_zone_get_offset (GTimeZone *tz, + gint interval); +GLIB_AVAILABLE_IN_ALL +gboolean g_time_zone_is_dst (GTimeZone *tz, + gint interval); +GLIB_AVAILABLE_IN_2_58 +const gchar * g_time_zone_get_identifier (GTimeZone *tz); + +G_END_DECLS + +#endif /* __G_TIME_ZONE_H__ */ + +G_BEGIN_DECLS + +/** + * G_TIME_SPAN_DAY: + * + * Evaluates to a time span of one day. + * + * Since: 2.26 + */ +#define G_TIME_SPAN_DAY (G_GINT64_CONSTANT (86400000000)) + +/** + * G_TIME_SPAN_HOUR: + * + * Evaluates to a time span of one hour. + * + * Since: 2.26 + */ +#define G_TIME_SPAN_HOUR (G_GINT64_CONSTANT (3600000000)) + +/** + * G_TIME_SPAN_MINUTE: + * + * Evaluates to a time span of one minute. + * + * Since: 2.26 + */ +#define G_TIME_SPAN_MINUTE (G_GINT64_CONSTANT (60000000)) + +/** + * G_TIME_SPAN_SECOND: + * + * Evaluates to a time span of one second. + * + * Since: 2.26 + */ +#define G_TIME_SPAN_SECOND (G_GINT64_CONSTANT (1000000)) + +/** + * G_TIME_SPAN_MILLISECOND: + * + * Evaluates to a time span of one millisecond. + * + * Since: 2.26 + */ +#define G_TIME_SPAN_MILLISECOND (G_GINT64_CONSTANT (1000)) + +/** + * GTimeSpan: + * + * A value representing an interval of time, in microseconds. + * + * Since: 2.26 + */ +typedef gint64 GTimeSpan; + +/** + * GDateTime: + * + * `GDateTime` is an opaque structure whose members + * cannot be accessed directly. + * + * Since: 2.26 + */ +typedef struct _GDateTime GDateTime; + +GLIB_AVAILABLE_IN_ALL +void g_date_time_unref (GDateTime *datetime); +GLIB_AVAILABLE_IN_ALL +GDateTime * g_date_time_ref (GDateTime *datetime); + +GLIB_AVAILABLE_IN_ALL +GDateTime * g_date_time_new_now (GTimeZone *tz); +GLIB_AVAILABLE_IN_ALL +GDateTime * g_date_time_new_now_local (void); +GLIB_AVAILABLE_IN_ALL +GDateTime * g_date_time_new_now_utc (void); + +GLIB_AVAILABLE_IN_ALL +GDateTime * g_date_time_new_from_unix_local (gint64 t); +GLIB_AVAILABLE_IN_ALL +GDateTime * g_date_time_new_from_unix_utc (gint64 t); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_new_from_unix_local) +GDateTime * g_date_time_new_from_timeval_local (const GTimeVal *tv); +GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_new_from_unix_utc) +GDateTime * g_date_time_new_from_timeval_utc (const GTimeVal *tv); +G_GNUC_END_IGNORE_DEPRECATIONS + +GLIB_AVAILABLE_IN_2_56 +GDateTime * g_date_time_new_from_iso8601 (const gchar *text, + GTimeZone *default_tz); + +GLIB_AVAILABLE_IN_ALL +GDateTime * g_date_time_new (GTimeZone *tz, + gint year, + gint month, + gint day, + gint hour, + gint minute, + gdouble seconds); +GLIB_AVAILABLE_IN_ALL +GDateTime * g_date_time_new_local (gint year, + gint month, + gint day, + gint hour, + gint minute, + gdouble seconds); +GLIB_AVAILABLE_IN_ALL +GDateTime * g_date_time_new_utc (gint year, + gint month, + gint day, + gint hour, + gint minute, + gdouble seconds); + +GLIB_AVAILABLE_IN_ALL +G_GNUC_WARN_UNUSED_RESULT +GDateTime * g_date_time_add (GDateTime *datetime, + GTimeSpan timespan); + +GLIB_AVAILABLE_IN_ALL +G_GNUC_WARN_UNUSED_RESULT +GDateTime * g_date_time_add_years (GDateTime *datetime, + gint years); +GLIB_AVAILABLE_IN_ALL +G_GNUC_WARN_UNUSED_RESULT +GDateTime * g_date_time_add_months (GDateTime *datetime, + gint months); +GLIB_AVAILABLE_IN_ALL +G_GNUC_WARN_UNUSED_RESULT +GDateTime * g_date_time_add_weeks (GDateTime *datetime, + gint weeks); +GLIB_AVAILABLE_IN_ALL +G_GNUC_WARN_UNUSED_RESULT +GDateTime * g_date_time_add_days (GDateTime *datetime, + gint days); + +GLIB_AVAILABLE_IN_ALL +G_GNUC_WARN_UNUSED_RESULT +GDateTime * g_date_time_add_hours (GDateTime *datetime, + gint hours); +GLIB_AVAILABLE_IN_ALL +G_GNUC_WARN_UNUSED_RESULT +GDateTime * g_date_time_add_minutes (GDateTime *datetime, + gint minutes); +GLIB_AVAILABLE_IN_ALL +G_GNUC_WARN_UNUSED_RESULT +GDateTime * g_date_time_add_seconds (GDateTime *datetime, + gdouble seconds); + +GLIB_AVAILABLE_IN_ALL +G_GNUC_WARN_UNUSED_RESULT +GDateTime * g_date_time_add_full (GDateTime *datetime, + gint years, + gint months, + gint days, + gint hours, + gint minutes, + gdouble seconds); + +GLIB_AVAILABLE_IN_ALL +gint g_date_time_compare (gconstpointer dt1, + gconstpointer dt2); +GLIB_AVAILABLE_IN_ALL +GTimeSpan g_date_time_difference (GDateTime *end, + GDateTime *begin); +GLIB_AVAILABLE_IN_ALL +guint g_date_time_hash (gconstpointer datetime); +GLIB_AVAILABLE_IN_ALL +gboolean g_date_time_equal (gconstpointer dt1, + gconstpointer dt2); + +GLIB_AVAILABLE_IN_ALL +void g_date_time_get_ymd (GDateTime *datetime, + gint *year, + gint *month, + gint *day); + +GLIB_AVAILABLE_IN_ALL +gint g_date_time_get_year (GDateTime *datetime); +GLIB_AVAILABLE_IN_ALL +gint g_date_time_get_month (GDateTime *datetime); +GLIB_AVAILABLE_IN_ALL +gint g_date_time_get_day_of_month (GDateTime *datetime); + +GLIB_AVAILABLE_IN_ALL +gint g_date_time_get_week_numbering_year (GDateTime *datetime); +GLIB_AVAILABLE_IN_ALL +gint g_date_time_get_week_of_year (GDateTime *datetime); +GLIB_AVAILABLE_IN_ALL +gint g_date_time_get_day_of_week (GDateTime *datetime); + +GLIB_AVAILABLE_IN_ALL +gint g_date_time_get_day_of_year (GDateTime *datetime); + +GLIB_AVAILABLE_IN_ALL +gint g_date_time_get_hour (GDateTime *datetime); +GLIB_AVAILABLE_IN_ALL +gint g_date_time_get_minute (GDateTime *datetime); +GLIB_AVAILABLE_IN_ALL +gint g_date_time_get_second (GDateTime *datetime); +GLIB_AVAILABLE_IN_ALL +gint g_date_time_get_microsecond (GDateTime *datetime); +GLIB_AVAILABLE_IN_ALL +gdouble g_date_time_get_seconds (GDateTime *datetime); + +GLIB_AVAILABLE_IN_ALL +gint64 g_date_time_to_unix (GDateTime *datetime); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_to_unix) +gboolean g_date_time_to_timeval (GDateTime *datetime, + GTimeVal *tv); +G_GNUC_END_IGNORE_DEPRECATIONS + +GLIB_AVAILABLE_IN_ALL +GTimeSpan g_date_time_get_utc_offset (GDateTime *datetime); +GLIB_AVAILABLE_IN_2_58 +GTimeZone * g_date_time_get_timezone (GDateTime *datetime); +GLIB_AVAILABLE_IN_ALL +const gchar * g_date_time_get_timezone_abbreviation (GDateTime *datetime); +GLIB_AVAILABLE_IN_ALL +gboolean g_date_time_is_daylight_savings (GDateTime *datetime); + +GLIB_AVAILABLE_IN_ALL +GDateTime * g_date_time_to_timezone (GDateTime *datetime, + GTimeZone *tz); +GLIB_AVAILABLE_IN_ALL +GDateTime * g_date_time_to_local (GDateTime *datetime); +GLIB_AVAILABLE_IN_ALL +GDateTime * g_date_time_to_utc (GDateTime *datetime); + +GLIB_AVAILABLE_IN_ALL +gchar * g_date_time_format (GDateTime *datetime, + const gchar *format) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_2_62 +gchar * g_date_time_format_iso8601 (GDateTime *datetime) G_GNUC_MALLOC; + +G_END_DECLS + +#endif /* __G_DATE_TIME_H__ */ +#include + +G_BEGIN_DECLS + +/** + * G_BOOKMARK_FILE_ERROR: + * + * Error domain for bookmark file parsing. + * Errors in this domain will be from the #GBookmarkFileError + * enumeration. See #GError for information on error domains. + */ +#define G_BOOKMARK_FILE_ERROR (g_bookmark_file_error_quark ()) + + +/** + * GBookmarkFileError: + * @G_BOOKMARK_FILE_ERROR_INVALID_URI: URI was ill-formed + * @G_BOOKMARK_FILE_ERROR_INVALID_VALUE: a requested field was not found + * @G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED: a requested application did + * not register a bookmark + * @G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND: a requested URI was not found + * @G_BOOKMARK_FILE_ERROR_READ: document was ill formed + * @G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING: the text being parsed was + * in an unknown encoding + * @G_BOOKMARK_FILE_ERROR_WRITE: an error occurred while writing + * @G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND: requested file was not found + * + * Error codes returned by bookmark file parsing. + */ +typedef enum +{ + G_BOOKMARK_FILE_ERROR_INVALID_URI, + G_BOOKMARK_FILE_ERROR_INVALID_VALUE, + G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED, + G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND, + G_BOOKMARK_FILE_ERROR_READ, + G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING, + G_BOOKMARK_FILE_ERROR_WRITE, + G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND +} GBookmarkFileError; + +GLIB_AVAILABLE_IN_ALL +GQuark g_bookmark_file_error_quark (void); + +/** + * GBookmarkFile: + * + * The `GBookmarkFile` structure contains only + * private data and should not be directly accessed. + */ +typedef struct _GBookmarkFile GBookmarkFile; + +GLIB_AVAILABLE_IN_ALL +GBookmarkFile *g_bookmark_file_new (void); +GLIB_AVAILABLE_IN_ALL +void g_bookmark_file_free (GBookmarkFile *bookmark); + +GLIB_AVAILABLE_IN_ALL +gboolean g_bookmark_file_load_from_file (GBookmarkFile *bookmark, + const gchar *filename, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_bookmark_file_load_from_data (GBookmarkFile *bookmark, + const gchar *data, + gsize length, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_bookmark_file_load_from_data_dirs (GBookmarkFile *bookmark, + const gchar *file, + gchar **full_path, + GError **error); +GLIB_AVAILABLE_IN_ALL +gchar * g_bookmark_file_to_data (GBookmarkFile *bookmark, + gsize *length, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gboolean g_bookmark_file_to_file (GBookmarkFile *bookmark, + const gchar *filename, + GError **error); + +GLIB_AVAILABLE_IN_ALL +void g_bookmark_file_set_title (GBookmarkFile *bookmark, + const gchar *uri, + const gchar *title); +GLIB_AVAILABLE_IN_ALL +gchar * g_bookmark_file_get_title (GBookmarkFile *bookmark, + const gchar *uri, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +void g_bookmark_file_set_description (GBookmarkFile *bookmark, + const gchar *uri, + const gchar *description); +GLIB_AVAILABLE_IN_ALL +gchar * g_bookmark_file_get_description (GBookmarkFile *bookmark, + const gchar *uri, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +void g_bookmark_file_set_mime_type (GBookmarkFile *bookmark, + const gchar *uri, + const gchar *mime_type); +GLIB_AVAILABLE_IN_ALL +gchar * g_bookmark_file_get_mime_type (GBookmarkFile *bookmark, + const gchar *uri, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +void g_bookmark_file_set_groups (GBookmarkFile *bookmark, + const gchar *uri, + const gchar **groups, + gsize length); +GLIB_AVAILABLE_IN_ALL +void g_bookmark_file_add_group (GBookmarkFile *bookmark, + const gchar *uri, + const gchar *group); +GLIB_AVAILABLE_IN_ALL +gboolean g_bookmark_file_has_group (GBookmarkFile *bookmark, + const gchar *uri, + const gchar *group, + GError **error); +GLIB_AVAILABLE_IN_ALL +gchar ** g_bookmark_file_get_groups (GBookmarkFile *bookmark, + const gchar *uri, + gsize *length, + GError **error); +GLIB_AVAILABLE_IN_ALL +void g_bookmark_file_add_application (GBookmarkFile *bookmark, + const gchar *uri, + const gchar *name, + const gchar *exec); +GLIB_AVAILABLE_IN_ALL +gboolean g_bookmark_file_has_application (GBookmarkFile *bookmark, + const gchar *uri, + const gchar *name, + GError **error); +GLIB_AVAILABLE_IN_ALL +gchar ** g_bookmark_file_get_applications (GBookmarkFile *bookmark, + const gchar *uri, + gsize *length, + GError **error); +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_application_info) +gboolean g_bookmark_file_set_app_info (GBookmarkFile *bookmark, + const gchar *uri, + const gchar *name, + const gchar *exec, + gint count, + time_t stamp, + GError **error); +GLIB_AVAILABLE_IN_2_66 +gboolean g_bookmark_file_set_application_info (GBookmarkFile *bookmark, + const char *uri, + const char *name, + const char *exec, + int count, + GDateTime *stamp, + GError **error); +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_application_info) +gboolean g_bookmark_file_get_app_info (GBookmarkFile *bookmark, + const gchar *uri, + const gchar *name, + gchar **exec, + guint *count, + time_t *stamp, + GError **error); +GLIB_AVAILABLE_IN_2_66 +gboolean g_bookmark_file_get_application_info (GBookmarkFile *bookmark, + const char *uri, + const char *name, + char **exec, + unsigned int *count, + GDateTime **stamp, + GError **error); +GLIB_AVAILABLE_IN_ALL +void g_bookmark_file_set_is_private (GBookmarkFile *bookmark, + const gchar *uri, + gboolean is_private); +GLIB_AVAILABLE_IN_ALL +gboolean g_bookmark_file_get_is_private (GBookmarkFile *bookmark, + const gchar *uri, + GError **error); +GLIB_AVAILABLE_IN_ALL +void g_bookmark_file_set_icon (GBookmarkFile *bookmark, + const gchar *uri, + const gchar *href, + const gchar *mime_type); +GLIB_AVAILABLE_IN_ALL +gboolean g_bookmark_file_get_icon (GBookmarkFile *bookmark, + const gchar *uri, + gchar **href, + gchar **mime_type, + GError **error); +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_added_date_time) +void g_bookmark_file_set_added (GBookmarkFile *bookmark, + const gchar *uri, + time_t added); +GLIB_AVAILABLE_IN_2_66 +void g_bookmark_file_set_added_date_time (GBookmarkFile *bookmark, + const char *uri, + GDateTime *added); +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_added_date_time) +time_t g_bookmark_file_get_added (GBookmarkFile *bookmark, + const gchar *uri, + GError **error); +GLIB_AVAILABLE_IN_2_66 +GDateTime *g_bookmark_file_get_added_date_time (GBookmarkFile *bookmark, + const char *uri, + GError **error); +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_modified_date_time) +void g_bookmark_file_set_modified (GBookmarkFile *bookmark, + const gchar *uri, + time_t modified); +GLIB_AVAILABLE_IN_2_66 +void g_bookmark_file_set_modified_date_time (GBookmarkFile *bookmark, + const char *uri, + GDateTime *modified); +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_modified_date_time) +time_t g_bookmark_file_get_modified (GBookmarkFile *bookmark, + const gchar *uri, + GError **error); +GLIB_AVAILABLE_IN_2_66 +GDateTime *g_bookmark_file_get_modified_date_time (GBookmarkFile *bookmark, + const char *uri, + GError **error); +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_visited_date_time) +void g_bookmark_file_set_visited (GBookmarkFile *bookmark, + const gchar *uri, + time_t visited); +GLIB_AVAILABLE_IN_2_66 +void g_bookmark_file_set_visited_date_time (GBookmarkFile *bookmark, + const char *uri, + GDateTime *visited); +GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_visited_date_time) +time_t g_bookmark_file_get_visited (GBookmarkFile *bookmark, + const gchar *uri, + GError **error); +GLIB_AVAILABLE_IN_2_66 +GDateTime *g_bookmark_file_get_visited_date_time (GBookmarkFile *bookmark, + const char *uri, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_bookmark_file_has_item (GBookmarkFile *bookmark, + const gchar *uri); +GLIB_AVAILABLE_IN_ALL +gint g_bookmark_file_get_size (GBookmarkFile *bookmark); +GLIB_AVAILABLE_IN_ALL +gchar ** g_bookmark_file_get_uris (GBookmarkFile *bookmark, + gsize *length); +GLIB_AVAILABLE_IN_ALL +gboolean g_bookmark_file_remove_group (GBookmarkFile *bookmark, + const gchar *uri, + const gchar *group, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_bookmark_file_remove_application (GBookmarkFile *bookmark, + const gchar *uri, + const gchar *name, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_bookmark_file_remove_item (GBookmarkFile *bookmark, + const gchar *uri, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_bookmark_file_move_item (GBookmarkFile *bookmark, + const gchar *old_uri, + const gchar *new_uri, + GError **error); + +G_END_DECLS + +#endif /* __G_BOOKMARK_FILE_H__ */ +/* + * Copyright © 2009, 2010 Codethink Limited + * Copyright © 2011 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + * Stef Walter + */ + +#ifndef __G_BYTES_H__ +#define __G_BYTES_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_ALL +GBytes * g_bytes_new (gconstpointer data, + gsize size); + +GLIB_AVAILABLE_IN_ALL +GBytes * g_bytes_new_take (gpointer data, + gsize size); + +GLIB_AVAILABLE_IN_ALL +GBytes * g_bytes_new_static (gconstpointer data, + gsize size); + +GLIB_AVAILABLE_IN_ALL +GBytes * g_bytes_new_with_free_func (gconstpointer data, + gsize size, + GDestroyNotify free_func, + gpointer user_data); + +GLIB_AVAILABLE_IN_ALL +GBytes * g_bytes_new_from_bytes (GBytes *bytes, + gsize offset, + gsize length); + +GLIB_AVAILABLE_IN_ALL +gconstpointer g_bytes_get_data (GBytes *bytes, + gsize *size); + +GLIB_AVAILABLE_IN_ALL +gsize g_bytes_get_size (GBytes *bytes); + +GLIB_AVAILABLE_IN_ALL +GBytes * g_bytes_ref (GBytes *bytes); + +GLIB_AVAILABLE_IN_ALL +void g_bytes_unref (GBytes *bytes); + +GLIB_AVAILABLE_IN_ALL +gpointer g_bytes_unref_to_data (GBytes *bytes, + gsize *size); + +GLIB_AVAILABLE_IN_ALL +GByteArray * g_bytes_unref_to_array (GBytes *bytes); + +GLIB_AVAILABLE_IN_ALL +guint g_bytes_hash (gconstpointer bytes); + +GLIB_AVAILABLE_IN_ALL +gboolean g_bytes_equal (gconstpointer bytes1, + gconstpointer bytes2); + +GLIB_AVAILABLE_IN_ALL +gint g_bytes_compare (gconstpointer bytes1, + gconstpointer bytes2); + +G_END_DECLS + +#endif /* __G_BYTES_H__ */ +/* gcharset.h - Charset functions + * + * Copyright (C) 2011 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_CHARSET_H__ +#define __G_CHARSET_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_ALL +gboolean g_get_charset (const char **charset); +GLIB_AVAILABLE_IN_ALL +gchar * g_get_codeset (void); +GLIB_AVAILABLE_IN_2_62 +gboolean g_get_console_charset (const char **charset); + +GLIB_AVAILABLE_IN_ALL +const gchar * const * g_get_language_names (void); +GLIB_AVAILABLE_IN_2_58 +const gchar * const * g_get_language_names_with_category + (const gchar *category_name); +GLIB_AVAILABLE_IN_ALL +gchar ** g_get_locale_variants (const gchar *locale); + +G_END_DECLS + +#endif /* __G_CHARSET_H__ */ +/* gchecksum.h - data hashing functions + * + * Copyright (C) 2007 Emmanuele Bassi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_CHECKSUM_H__ +#define __G_CHECKSUM_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * GChecksumType: + * @G_CHECKSUM_MD5: Use the MD5 hashing algorithm + * @G_CHECKSUM_SHA1: Use the SHA-1 hashing algorithm + * @G_CHECKSUM_SHA256: Use the SHA-256 hashing algorithm + * @G_CHECKSUM_SHA384: Use the SHA-384 hashing algorithm (Since: 2.51) + * @G_CHECKSUM_SHA512: Use the SHA-512 hashing algorithm (Since: 2.36) + * + * The hashing algorithm to be used by #GChecksum when performing the + * digest of some data. + * + * Note that the #GChecksumType enumeration may be extended at a later + * date to include new hashing algorithm types. + * + * Since: 2.16 + */ +typedef enum { + G_CHECKSUM_MD5, + G_CHECKSUM_SHA1, + G_CHECKSUM_SHA256, + G_CHECKSUM_SHA512, + G_CHECKSUM_SHA384 +} GChecksumType; + +/** + * GChecksum: + * + * An opaque structure representing a checksumming operation. + * To create a new GChecksum, use g_checksum_new(). To free + * a GChecksum, use g_checksum_free(). + * + * Since: 2.16 + */ +typedef struct _GChecksum GChecksum; + +GLIB_AVAILABLE_IN_ALL +gssize g_checksum_type_get_length (GChecksumType checksum_type); + +GLIB_AVAILABLE_IN_ALL +GChecksum * g_checksum_new (GChecksumType checksum_type); +GLIB_AVAILABLE_IN_ALL +void g_checksum_reset (GChecksum *checksum); +GLIB_AVAILABLE_IN_ALL +GChecksum * g_checksum_copy (const GChecksum *checksum); +GLIB_AVAILABLE_IN_ALL +void g_checksum_free (GChecksum *checksum); +GLIB_AVAILABLE_IN_ALL +void g_checksum_update (GChecksum *checksum, + const guchar *data, + gssize length); +GLIB_AVAILABLE_IN_ALL +const gchar * g_checksum_get_string (GChecksum *checksum); +GLIB_AVAILABLE_IN_ALL +void g_checksum_get_digest (GChecksum *checksum, + guint8 *buffer, + gsize *digest_len); + +GLIB_AVAILABLE_IN_ALL +gchar *g_compute_checksum_for_data (GChecksumType checksum_type, + const guchar *data, + gsize length); +GLIB_AVAILABLE_IN_ALL +gchar *g_compute_checksum_for_string (GChecksumType checksum_type, + const gchar *str, + gssize length); + +GLIB_AVAILABLE_IN_2_34 +gchar *g_compute_checksum_for_bytes (GChecksumType checksum_type, + GBytes *data); + +G_END_DECLS + +#endif /* __G_CHECKSUM_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_CONVERT_H__ +#define __G_CONVERT_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * GConvertError: + * @G_CONVERT_ERROR_NO_CONVERSION: Conversion between the requested character + * sets is not supported. + * @G_CONVERT_ERROR_ILLEGAL_SEQUENCE: Invalid byte sequence in conversion input; + * or the character sequence could not be represented in the target + * character set. + * @G_CONVERT_ERROR_FAILED: Conversion failed for some reason. + * @G_CONVERT_ERROR_PARTIAL_INPUT: Partial character sequence at end of input. + * @G_CONVERT_ERROR_BAD_URI: URI is invalid. + * @G_CONVERT_ERROR_NOT_ABSOLUTE_PATH: Pathname is not an absolute path. + * @G_CONVERT_ERROR_NO_MEMORY: No memory available. Since: 2.40 + * @G_CONVERT_ERROR_EMBEDDED_NUL: An embedded NUL character is present in + * conversion output where a NUL-terminated string is expected. + * Since: 2.56 + * + * Error codes returned by character set conversion routines. + */ +typedef enum +{ + G_CONVERT_ERROR_NO_CONVERSION, + G_CONVERT_ERROR_ILLEGAL_SEQUENCE, + G_CONVERT_ERROR_FAILED, + G_CONVERT_ERROR_PARTIAL_INPUT, + G_CONVERT_ERROR_BAD_URI, + G_CONVERT_ERROR_NOT_ABSOLUTE_PATH, + G_CONVERT_ERROR_NO_MEMORY, + G_CONVERT_ERROR_EMBEDDED_NUL +} GConvertError; + +/** + * G_CONVERT_ERROR: + * + * Error domain for character set conversions. Errors in this domain will + * be from the #GConvertError enumeration. See #GError for information on + * error domains. + */ +#define G_CONVERT_ERROR g_convert_error_quark() +GLIB_AVAILABLE_IN_ALL +GQuark g_convert_error_quark (void); + +/** + * GIConv: (skip) + * + * The GIConv struct wraps an iconv() conversion descriptor. It contains + * private data and should only be accessed using the following functions. + */ +typedef struct _GIConv *GIConv; + +GLIB_AVAILABLE_IN_ALL +GIConv g_iconv_open (const gchar *to_codeset, + const gchar *from_codeset); +GLIB_AVAILABLE_IN_ALL +gsize g_iconv (GIConv converter, + gchar **inbuf, + gsize *inbytes_left, + gchar **outbuf, + gsize *outbytes_left); +GLIB_AVAILABLE_IN_ALL +gint g_iconv_close (GIConv converter); + + +GLIB_AVAILABLE_IN_ALL +gchar* g_convert (const gchar *str, + gssize len, + const gchar *to_codeset, + const gchar *from_codeset, + gsize *bytes_read, + gsize *bytes_written, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar* g_convert_with_iconv (const gchar *str, + gssize len, + GIConv converter, + gsize *bytes_read, + gsize *bytes_written, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar* g_convert_with_fallback (const gchar *str, + gssize len, + const gchar *to_codeset, + const gchar *from_codeset, + const gchar *fallback, + gsize *bytes_read, + gsize *bytes_written, + GError **error) G_GNUC_MALLOC; + + +/* Convert between libc's idea of strings and UTF-8. + */ +GLIB_AVAILABLE_IN_ALL +gchar* g_locale_to_utf8 (const gchar *opsysstring, + gssize len, + gsize *bytes_read, + gsize *bytes_written, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar* g_locale_from_utf8 (const gchar *utf8string, + gssize len, + gsize *bytes_read, + gsize *bytes_written, + GError **error) G_GNUC_MALLOC; + +/* Convert between the operating system (or C runtime) + * representation of file names and UTF-8. + */ +GLIB_AVAILABLE_IN_ALL +gchar* g_filename_to_utf8 (const gchar *opsysstring, + gssize len, + gsize *bytes_read, + gsize *bytes_written, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar* g_filename_from_utf8 (const gchar *utf8string, + gssize len, + gsize *bytes_read, + gsize *bytes_written, + GError **error) G_GNUC_MALLOC; + +GLIB_AVAILABLE_IN_ALL +gchar *g_filename_from_uri (const gchar *uri, + gchar **hostname, + GError **error) G_GNUC_MALLOC; + +GLIB_AVAILABLE_IN_ALL +gchar *g_filename_to_uri (const gchar *filename, + const gchar *hostname, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar *g_filename_display_name (const gchar *filename) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gboolean g_get_filename_charsets (const gchar ***filename_charsets); + +GLIB_AVAILABLE_IN_ALL +gchar *g_filename_display_basename (const gchar *filename) G_GNUC_MALLOC; + +GLIB_AVAILABLE_IN_ALL +gchar **g_uri_list_extract_uris (const gchar *uri_list); + +G_END_DECLS + +#endif /* __G_CONVERT_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_DATASET_H__ +#define __G_DATASET_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GData GData; + +typedef void (*GDataForeachFunc) (GQuark key_id, + gpointer data, + gpointer user_data); + +/* Keyed Data List + */ +GLIB_AVAILABLE_IN_ALL +void g_datalist_init (GData **datalist); +GLIB_AVAILABLE_IN_ALL +void g_datalist_clear (GData **datalist); +GLIB_AVAILABLE_IN_ALL +gpointer g_datalist_id_get_data (GData **datalist, + GQuark key_id); +GLIB_AVAILABLE_IN_ALL +void g_datalist_id_set_data_full (GData **datalist, + GQuark key_id, + gpointer data, + GDestroyNotify destroy_func); + +typedef gpointer (*GDuplicateFunc) (gpointer data, gpointer user_data); + +GLIB_AVAILABLE_IN_2_34 +gpointer g_datalist_id_dup_data (GData **datalist, + GQuark key_id, + GDuplicateFunc dup_func, + gpointer user_data); +GLIB_AVAILABLE_IN_2_34 +gboolean g_datalist_id_replace_data (GData **datalist, + GQuark key_id, + gpointer oldval, + gpointer newval, + GDestroyNotify destroy, + GDestroyNotify *old_destroy); + +GLIB_AVAILABLE_IN_ALL +gpointer g_datalist_id_remove_no_notify (GData **datalist, + GQuark key_id); +GLIB_AVAILABLE_IN_ALL +void g_datalist_foreach (GData **datalist, + GDataForeachFunc func, + gpointer user_data); + +/** + * G_DATALIST_FLAGS_MASK: + * + * A bitmask that restricts the possible flags passed to + * g_datalist_set_flags(). Passing a flags value where + * flags & ~G_DATALIST_FLAGS_MASK != 0 is an error. + */ +#define G_DATALIST_FLAGS_MASK 0x3 + +GLIB_AVAILABLE_IN_ALL +void g_datalist_set_flags (GData **datalist, + guint flags); +GLIB_AVAILABLE_IN_ALL +void g_datalist_unset_flags (GData **datalist, + guint flags); +GLIB_AVAILABLE_IN_ALL +guint g_datalist_get_flags (GData **datalist); + +#define g_datalist_id_set_data(dl, q, d) \ + g_datalist_id_set_data_full ((dl), (q), (d), NULL) +#define g_datalist_id_remove_data(dl, q) \ + g_datalist_id_set_data ((dl), (q), NULL) +#define g_datalist_set_data_full(dl, k, d, f) \ + g_datalist_id_set_data_full ((dl), g_quark_from_string (k), (d), (f)) +#define g_datalist_remove_no_notify(dl, k) \ + g_datalist_id_remove_no_notify ((dl), g_quark_try_string (k)) +#define g_datalist_set_data(dl, k, d) \ + g_datalist_set_data_full ((dl), (k), (d), NULL) +#define g_datalist_remove_data(dl, k) \ + g_datalist_id_set_data ((dl), g_quark_try_string (k), NULL) + +/* Location Associated Keyed Data + */ +GLIB_AVAILABLE_IN_ALL +void g_dataset_destroy (gconstpointer dataset_location); +GLIB_AVAILABLE_IN_ALL +gpointer g_dataset_id_get_data (gconstpointer dataset_location, + GQuark key_id); +GLIB_AVAILABLE_IN_ALL +gpointer g_datalist_get_data (GData **datalist, + const gchar *key); +GLIB_AVAILABLE_IN_ALL +void g_dataset_id_set_data_full (gconstpointer dataset_location, + GQuark key_id, + gpointer data, + GDestroyNotify destroy_func); +GLIB_AVAILABLE_IN_ALL +gpointer g_dataset_id_remove_no_notify (gconstpointer dataset_location, + GQuark key_id); +GLIB_AVAILABLE_IN_ALL +void g_dataset_foreach (gconstpointer dataset_location, + GDataForeachFunc func, + gpointer user_data); +#define g_dataset_id_set_data(l, k, d) \ + g_dataset_id_set_data_full ((l), (k), (d), NULL) +#define g_dataset_id_remove_data(l, k) \ + g_dataset_id_set_data ((l), (k), NULL) +#define g_dataset_get_data(l, k) \ + (g_dataset_id_get_data ((l), g_quark_try_string (k))) +#define g_dataset_set_data_full(l, k, d, f) \ + g_dataset_id_set_data_full ((l), g_quark_from_string (k), (d), (f)) +#define g_dataset_remove_no_notify(l, k) \ + g_dataset_id_remove_no_notify ((l), g_quark_try_string (k)) +#define g_dataset_set_data(l, k, d) \ + g_dataset_set_data_full ((l), (k), (d), NULL) +#define g_dataset_remove_data(l, k) \ + g_dataset_id_set_data ((l), g_quark_try_string (k), NULL) + +G_END_DECLS + +#endif /* __G_DATASET_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_DATE_H__ +#define __G_DATE_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#include + + +G_BEGIN_DECLS + +/* GDate + * + * Date calculations (not time for now, to be resolved). These are a + * mutant combination of Steffen Beyer's DateCalc routines + * (http://www.perl.com/CPAN/authors/id/STBEY/) and Jon Trowbridge's + * date routines (written for in-house software). Written by Havoc + * Pennington + */ + +typedef gint32 GTime GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime); +typedef guint16 GDateYear; +typedef guint8 GDateDay; /* day of the month */ +typedef struct _GDate GDate; + +/* enum used to specify order of appearance in parsed date strings */ +typedef enum +{ + G_DATE_DAY = 0, + G_DATE_MONTH = 1, + G_DATE_YEAR = 2 +} GDateDMY; + +/* actual week and month values */ +typedef enum +{ + G_DATE_BAD_WEEKDAY = 0, + G_DATE_MONDAY = 1, + G_DATE_TUESDAY = 2, + G_DATE_WEDNESDAY = 3, + G_DATE_THURSDAY = 4, + G_DATE_FRIDAY = 5, + G_DATE_SATURDAY = 6, + G_DATE_SUNDAY = 7 +} GDateWeekday; +typedef enum +{ + G_DATE_BAD_MONTH = 0, + G_DATE_JANUARY = 1, + G_DATE_FEBRUARY = 2, + G_DATE_MARCH = 3, + G_DATE_APRIL = 4, + G_DATE_MAY = 5, + G_DATE_JUNE = 6, + G_DATE_JULY = 7, + G_DATE_AUGUST = 8, + G_DATE_SEPTEMBER = 9, + G_DATE_OCTOBER = 10, + G_DATE_NOVEMBER = 11, + G_DATE_DECEMBER = 12 +} GDateMonth; + +#define G_DATE_BAD_JULIAN 0U +#define G_DATE_BAD_DAY 0U +#define G_DATE_BAD_YEAR 0U + +/* Note: directly manipulating structs is generally a bad idea, but + * in this case it's an *incredibly* bad idea, because all or part + * of this struct can be invalid at any given time. Use the functions, + * or you will get hosed, I promise. + */ +struct _GDate +{ + guint julian_days : 32; /* julian days representation - we use a + * bitfield hoping that 64 bit platforms + * will pack this whole struct in one big + * int + */ + + guint julian : 1; /* julian is valid */ + guint dmy : 1; /* dmy is valid */ + + /* DMY representation */ + guint day : 6; + guint month : 4; + guint year : 16; +}; + +/* g_date_new() returns an invalid date, you then have to _set() stuff + * to get a usable object. You can also allocate a GDate statically, + * then call g_date_clear() to initialize. + */ +GLIB_AVAILABLE_IN_ALL +GDate* g_date_new (void); +GLIB_AVAILABLE_IN_ALL +GDate* g_date_new_dmy (GDateDay day, + GDateMonth month, + GDateYear year); +GLIB_AVAILABLE_IN_ALL +GDate* g_date_new_julian (guint32 julian_day); +GLIB_AVAILABLE_IN_ALL +void g_date_free (GDate *date); +GLIB_AVAILABLE_IN_2_56 +GDate* g_date_copy (const GDate *date); + +/* check g_date_valid() after doing an operation that might fail, like + * _parse. Almost all g_date operations are undefined on invalid + * dates (the exceptions are the mutators, since you need those to + * return to validity). + */ +GLIB_AVAILABLE_IN_ALL +gboolean g_date_valid (const GDate *date); +GLIB_AVAILABLE_IN_ALL +gboolean g_date_valid_day (GDateDay day) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_date_valid_month (GDateMonth month) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_date_valid_year (GDateYear year) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_date_valid_weekday (GDateWeekday weekday) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_date_valid_julian (guint32 julian_date) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_date_valid_dmy (GDateDay day, + GDateMonth month, + GDateYear year) G_GNUC_CONST; + +GLIB_AVAILABLE_IN_ALL +GDateWeekday g_date_get_weekday (const GDate *date); +GLIB_AVAILABLE_IN_ALL +GDateMonth g_date_get_month (const GDate *date); +GLIB_AVAILABLE_IN_ALL +GDateYear g_date_get_year (const GDate *date); +GLIB_AVAILABLE_IN_ALL +GDateDay g_date_get_day (const GDate *date); +GLIB_AVAILABLE_IN_ALL +guint32 g_date_get_julian (const GDate *date); +GLIB_AVAILABLE_IN_ALL +guint g_date_get_day_of_year (const GDate *date); +/* First monday/sunday is the start of week 1; if we haven't reached + * that day, return 0. These are not ISO weeks of the year; that + * routine needs to be added. + * these functions return the number of weeks, starting on the + * corrsponding day + */ +GLIB_AVAILABLE_IN_ALL +guint g_date_get_monday_week_of_year (const GDate *date); +GLIB_AVAILABLE_IN_ALL +guint g_date_get_sunday_week_of_year (const GDate *date); +GLIB_AVAILABLE_IN_ALL +guint g_date_get_iso8601_week_of_year (const GDate *date); + +/* If you create a static date struct you need to clear it to get it + * in a safe state before use. You can clear a whole array at + * once with the ndates argument. + */ +GLIB_AVAILABLE_IN_ALL +void g_date_clear (GDate *date, + guint n_dates); + +/* The parse routine is meant for dates typed in by a user, so it + * permits many formats but tries to catch common typos. If your data + * needs to be strictly validated, it is not an appropriate function. + */ +GLIB_AVAILABLE_IN_ALL +void g_date_set_parse (GDate *date, + const gchar *str); +GLIB_AVAILABLE_IN_ALL +void g_date_set_time_t (GDate *date, + time_t timet); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_DEPRECATED_IN_2_62_FOR(g_date_set_time_t) +void g_date_set_time_val (GDate *date, + GTimeVal *timeval); +GLIB_DEPRECATED_FOR(g_date_set_time_t) +void g_date_set_time (GDate *date, + GTime time_); +G_GNUC_END_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_IN_ALL +void g_date_set_month (GDate *date, + GDateMonth month); +GLIB_AVAILABLE_IN_ALL +void g_date_set_day (GDate *date, + GDateDay day); +GLIB_AVAILABLE_IN_ALL +void g_date_set_year (GDate *date, + GDateYear year); +GLIB_AVAILABLE_IN_ALL +void g_date_set_dmy (GDate *date, + GDateDay day, + GDateMonth month, + GDateYear y); +GLIB_AVAILABLE_IN_ALL +void g_date_set_julian (GDate *date, + guint32 julian_date); +GLIB_AVAILABLE_IN_ALL +gboolean g_date_is_first_of_month (const GDate *date); +GLIB_AVAILABLE_IN_ALL +gboolean g_date_is_last_of_month (const GDate *date); + +/* To go forward by some number of weeks just go forward weeks*7 days */ +GLIB_AVAILABLE_IN_ALL +void g_date_add_days (GDate *date, + guint n_days); +GLIB_AVAILABLE_IN_ALL +void g_date_subtract_days (GDate *date, + guint n_days); + +/* If you add/sub months while day > 28, the day might change */ +GLIB_AVAILABLE_IN_ALL +void g_date_add_months (GDate *date, + guint n_months); +GLIB_AVAILABLE_IN_ALL +void g_date_subtract_months (GDate *date, + guint n_months); + +/* If it's feb 29, changing years can move you to the 28th */ +GLIB_AVAILABLE_IN_ALL +void g_date_add_years (GDate *date, + guint n_years); +GLIB_AVAILABLE_IN_ALL +void g_date_subtract_years (GDate *date, + guint n_years); +GLIB_AVAILABLE_IN_ALL +gboolean g_date_is_leap_year (GDateYear year) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +guint8 g_date_get_days_in_month (GDateMonth month, + GDateYear year) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +guint8 g_date_get_monday_weeks_in_year (GDateYear year) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +guint8 g_date_get_sunday_weeks_in_year (GDateYear year) G_GNUC_CONST; + +/* Returns the number of days between the two dates. If date2 comes + before date1, a negative value is return. */ +GLIB_AVAILABLE_IN_ALL +gint g_date_days_between (const GDate *date1, + const GDate *date2); + +/* qsort-friendly (with a cast...) */ +GLIB_AVAILABLE_IN_ALL +gint g_date_compare (const GDate *lhs, + const GDate *rhs); +GLIB_AVAILABLE_IN_ALL +void g_date_to_struct_tm (const GDate *date, + struct tm *tm); + +GLIB_AVAILABLE_IN_ALL +void g_date_clamp (GDate *date, + const GDate *min_date, + const GDate *max_date); + +/* Swap date1 and date2's values if date1 > date2. */ +GLIB_AVAILABLE_IN_ALL +void g_date_order (GDate *date1, GDate *date2); + +/* Just like strftime() except you can only use date-related formats. + * Using a time format is undefined. + */ +GLIB_AVAILABLE_IN_ALL +gsize g_date_strftime (gchar *s, + gsize slen, + const gchar *format, + const GDate *date); + +#define g_date_weekday g_date_get_weekday GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_weekday) +#define g_date_month g_date_get_month GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_month) +#define g_date_year g_date_get_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_year) +#define g_date_day g_date_get_day GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_day) +#define g_date_julian g_date_get_julian GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_julian) +#define g_date_day_of_year g_date_get_day_of_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_day_of_year) +#define g_date_monday_week_of_year g_date_get_monday_week_of_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_monday_week_of_year) +#define g_date_sunday_week_of_year g_date_get_sunday_week_of_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_sunday_week_of_year) +#define g_date_days_in_month g_date_get_days_in_month GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_days_in_month) +#define g_date_monday_weeks_in_year g_date_get_monday_weeks_in_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_monday_weeks_in_year) +#define g_date_sunday_weeks_in_year g_date_get_sunday_weeks_in_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_sunday_weeks_in_year) + +G_END_DECLS + +#endif /* __G_DATE_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * gdir.c: Simplified wrapper around the DIRENT functions. + * + * Copyright 2001 Hans Breuer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __G_DIR_H__ +#define __G_DIR_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +#ifdef G_OS_UNIX +#include +#endif + +G_BEGIN_DECLS + +typedef struct _GDir GDir; + +GLIB_AVAILABLE_IN_ALL +GDir * g_dir_open (const gchar *path, + guint flags, + GError **error); +GLIB_AVAILABLE_IN_ALL +const gchar * g_dir_read_name (GDir *dir); +GLIB_AVAILABLE_IN_ALL +void g_dir_rewind (GDir *dir); +GLIB_AVAILABLE_IN_ALL +void g_dir_close (GDir *dir); + +G_END_DECLS + +#endif /* __G_DIR_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_ENVIRON_H__ +#define __G_ENVIRON_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_ALL +const gchar * g_getenv (const gchar *variable); +GLIB_AVAILABLE_IN_ALL +gboolean g_setenv (const gchar *variable, + const gchar *value, + gboolean overwrite); +GLIB_AVAILABLE_IN_ALL +void g_unsetenv (const gchar *variable); +GLIB_AVAILABLE_IN_ALL +gchar ** g_listenv (void); + +GLIB_AVAILABLE_IN_ALL +gchar ** g_get_environ (void); +GLIB_AVAILABLE_IN_ALL +const gchar * g_environ_getenv (gchar **envp, + const gchar *variable); +GLIB_AVAILABLE_IN_ALL +gchar ** g_environ_setenv (gchar **envp, + const gchar *variable, + const gchar *value, + gboolean overwrite) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +gchar ** g_environ_unsetenv (gchar **envp, + const gchar *variable) G_GNUC_WARN_UNUSED_RESULT; + +G_END_DECLS + +#endif /* __G_ENVIRON_H__ */ +/* gfileutils.h - File utility functions + * + * Copyright 2000 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_FILEUTILS_H__ +#define __G_FILEUTILS_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_FILE_ERROR g_file_error_quark () + +typedef enum +{ + G_FILE_ERROR_EXIST, + G_FILE_ERROR_ISDIR, + G_FILE_ERROR_ACCES, + G_FILE_ERROR_NAMETOOLONG, + G_FILE_ERROR_NOENT, + G_FILE_ERROR_NOTDIR, + G_FILE_ERROR_NXIO, + G_FILE_ERROR_NODEV, + G_FILE_ERROR_ROFS, + G_FILE_ERROR_TXTBSY, + G_FILE_ERROR_FAULT, + G_FILE_ERROR_LOOP, + G_FILE_ERROR_NOSPC, + G_FILE_ERROR_NOMEM, + G_FILE_ERROR_MFILE, + G_FILE_ERROR_NFILE, + G_FILE_ERROR_BADF, + G_FILE_ERROR_INVAL, + G_FILE_ERROR_PIPE, + G_FILE_ERROR_AGAIN, + G_FILE_ERROR_INTR, + G_FILE_ERROR_IO, + G_FILE_ERROR_PERM, + G_FILE_ERROR_NOSYS, + G_FILE_ERROR_FAILED +} GFileError; + +/* For backward-compat reasons, these are synced to an old + * anonymous enum in libgnome. But don't use that enum + * in new code. + */ +typedef enum +{ + G_FILE_TEST_IS_REGULAR = 1 << 0, + G_FILE_TEST_IS_SYMLINK = 1 << 1, + G_FILE_TEST_IS_DIR = 1 << 2, + G_FILE_TEST_IS_EXECUTABLE = 1 << 3, + G_FILE_TEST_EXISTS = 1 << 4 +} GFileTest; + +/** + * GFileSetContentsFlags: + * @G_FILE_SET_CONTENTS_NONE: No guarantees about file consistency or durability. + * The most dangerous setting, which is slightly faster than other settings. + * @G_FILE_SET_CONTENTS_CONSISTENT: Guarantee file consistency: after a crash, + * either the old version of the file or the new version of the file will be + * available, but not a mixture. On Unix systems this equates to an `fsync()` + * on the file and use of an atomic `rename()` of the new version of the file + * over the old. + * @G_FILE_SET_CONTENTS_DURABLE: Guarantee file durability: after a crash, the + * new version of the file will be available. On Unix systems this equates to + * an `fsync()` on the file (if %G_FILE_SET_CONTENTS_CONSISTENT is unset), or + * the effects of %G_FILE_SET_CONTENTS_CONSISTENT plus an `fsync()` on the + * directory containing the file after calling `rename()`. + * @G_FILE_SET_CONTENTS_ONLY_EXISTING: Only apply consistency and durability + * guarantees if the file already exists. This may speed up file operations + * if the file doesn’t currently exist, but may result in a corrupted version + * of the new file if the system crashes while writing it. + * + * Flags to pass to g_file_set_contents_full() to affect its safety and + * performance. + * + * Since: 2.66 + */ +typedef enum +{ + G_FILE_SET_CONTENTS_NONE = 0, + G_FILE_SET_CONTENTS_CONSISTENT = 1 << 0, + G_FILE_SET_CONTENTS_DURABLE = 1 << 1, + G_FILE_SET_CONTENTS_ONLY_EXISTING = 1 << 2 +} GFileSetContentsFlags +GLIB_AVAILABLE_ENUMERATOR_IN_2_66; + +GLIB_AVAILABLE_IN_ALL +GQuark g_file_error_quark (void); +/* So other code can generate a GFileError */ +GLIB_AVAILABLE_IN_ALL +GFileError g_file_error_from_errno (gint err_no); + +GLIB_AVAILABLE_IN_ALL +gboolean g_file_test (const gchar *filename, + GFileTest test); +GLIB_AVAILABLE_IN_ALL +gboolean g_file_get_contents (const gchar *filename, + gchar **contents, + gsize *length, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_file_set_contents (const gchar *filename, + const gchar *contents, + gssize length, + GError **error); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_IN_2_66 +gboolean g_file_set_contents_full (const gchar *filename, + const gchar *contents, + gssize length, + GFileSetContentsFlags flags, + int mode, + GError **error); +G_GNUC_END_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_IN_ALL +gchar *g_file_read_link (const gchar *filename, + GError **error); + +/* Wrapper / workalike for mkdtemp() */ +GLIB_AVAILABLE_IN_2_30 +gchar *g_mkdtemp (gchar *tmpl); +GLIB_AVAILABLE_IN_2_30 +gchar *g_mkdtemp_full (gchar *tmpl, + gint mode); + +/* Wrapper / workalike for mkstemp() */ +GLIB_AVAILABLE_IN_ALL +gint g_mkstemp (gchar *tmpl); +GLIB_AVAILABLE_IN_ALL +gint g_mkstemp_full (gchar *tmpl, + gint flags, + gint mode); + +/* Wrappers for g_mkstemp and g_mkdtemp() */ +GLIB_AVAILABLE_IN_ALL +gint g_file_open_tmp (const gchar *tmpl, + gchar **name_used, + GError **error); +GLIB_AVAILABLE_IN_2_30 +gchar *g_dir_make_tmp (const gchar *tmpl, + GError **error); + +GLIB_AVAILABLE_IN_ALL +gchar *g_build_path (const gchar *separator, + const gchar *first_element, + ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED; +GLIB_AVAILABLE_IN_ALL +gchar *g_build_pathv (const gchar *separator, + gchar **args) G_GNUC_MALLOC; + +GLIB_AVAILABLE_IN_ALL +gchar *g_build_filename (const gchar *first_element, + ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED; +GLIB_AVAILABLE_IN_ALL +gchar *g_build_filenamev (gchar **args) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_2_56 +gchar *g_build_filename_valist (const gchar *first_element, + va_list *args) G_GNUC_MALLOC; + +GLIB_AVAILABLE_IN_ALL +gint g_mkdir_with_parents (const gchar *pathname, + gint mode); + +#ifdef G_OS_WIN32 + +/* On Win32, the canonical directory separator is the backslash, and + * the search path separator is the semicolon. Note that also the + * (forward) slash works as directory separator. + */ +#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR || (c) == '/') + +#else /* !G_OS_WIN32 */ + +#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR) + +#endif /* !G_OS_WIN32 */ + +GLIB_AVAILABLE_IN_ALL +gboolean g_path_is_absolute (const gchar *file_name); +GLIB_AVAILABLE_IN_ALL +const gchar *g_path_skip_root (const gchar *file_name); + +GLIB_DEPRECATED_FOR(g_path_get_basename) +const gchar *g_basename (const gchar *file_name); +#define g_dirname g_path_get_dirname GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_path_get_dirname) + +GLIB_AVAILABLE_IN_ALL +gchar *g_get_current_dir (void); +GLIB_AVAILABLE_IN_ALL +gchar *g_path_get_basename (const gchar *file_name) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar *g_path_get_dirname (const gchar *file_name) G_GNUC_MALLOC; + +GLIB_AVAILABLE_IN_2_58 +gchar *g_canonicalize_filename (const gchar *filename, + const gchar *relative_to) G_GNUC_MALLOC; + +G_END_DECLS + +#endif /* __G_FILEUTILS_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_GETTEXT_H__ +#define __G_GETTEXT_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_ALL +const gchar *g_strip_context (const gchar *msgid, + const gchar *msgval) G_GNUC_FORMAT(1); + +GLIB_AVAILABLE_IN_ALL +const gchar *g_dgettext (const gchar *domain, + const gchar *msgid) G_GNUC_FORMAT(2); +GLIB_AVAILABLE_IN_ALL +const gchar *g_dcgettext (const gchar *domain, + const gchar *msgid, + gint category) G_GNUC_FORMAT(2); +GLIB_AVAILABLE_IN_ALL +const gchar *g_dngettext (const gchar *domain, + const gchar *msgid, + const gchar *msgid_plural, + gulong n) G_GNUC_FORMAT(3); +GLIB_AVAILABLE_IN_ALL +const gchar *g_dpgettext (const gchar *domain, + const gchar *msgctxtid, + gsize msgidoffset) G_GNUC_FORMAT(2); +GLIB_AVAILABLE_IN_ALL +const gchar *g_dpgettext2 (const gchar *domain, + const gchar *context, + const gchar *msgid) G_GNUC_FORMAT(3); + +G_END_DECLS + +#endif /* __G_GETTEXT_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_HASH_H__ +#define __G_HASH_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_LIST_H__ +#define __G_LIST_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_MEM_H__ +#define __G_MEM_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * GMemVTable: + * @malloc: function to use for allocating memory. + * @realloc: function to use for reallocating memory. + * @free: function to use to free memory. + * @calloc: function to use for allocating zero-filled memory. + * @try_malloc: function to use for allocating memory without a default error handler. + * @try_realloc: function to use for reallocating memory without a default error handler. + * + * A set of functions used to perform memory allocation. The same #GMemVTable must + * be used for all allocations in the same program; a call to g_mem_set_vtable(), + * if it exists, should be prior to any use of GLib. + */ +typedef struct _GMemVTable GMemVTable; + + +#if GLIB_SIZEOF_VOID_P > GLIB_SIZEOF_LONG +/** + * G_MEM_ALIGN: + * + * Indicates the number of bytes to which memory will be aligned on the + * current platform. + */ +# define G_MEM_ALIGN GLIB_SIZEOF_VOID_P +#else /* GLIB_SIZEOF_VOID_P <= GLIB_SIZEOF_LONG */ +# define G_MEM_ALIGN GLIB_SIZEOF_LONG +#endif /* GLIB_SIZEOF_VOID_P <= GLIB_SIZEOF_LONG */ + + +/* Memory allocation functions + */ + +GLIB_AVAILABLE_IN_ALL +void g_free (gpointer mem); + +GLIB_AVAILABLE_IN_2_34 +void g_clear_pointer (gpointer *pp, + GDestroyNotify destroy); + +GLIB_AVAILABLE_IN_ALL +gpointer g_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +GLIB_AVAILABLE_IN_ALL +gpointer g_malloc0 (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +GLIB_AVAILABLE_IN_ALL +gpointer g_realloc (gpointer mem, + gsize n_bytes) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +gpointer g_try_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +GLIB_AVAILABLE_IN_ALL +gpointer g_try_malloc0 (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +GLIB_AVAILABLE_IN_ALL +gpointer g_try_realloc (gpointer mem, + gsize n_bytes) G_GNUC_WARN_UNUSED_RESULT; + +GLIB_AVAILABLE_IN_ALL +gpointer g_malloc_n (gsize n_blocks, + gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); +GLIB_AVAILABLE_IN_ALL +gpointer g_malloc0_n (gsize n_blocks, + gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); +GLIB_AVAILABLE_IN_ALL +gpointer g_realloc_n (gpointer mem, + gsize n_blocks, + gsize n_block_bytes) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +gpointer g_try_malloc_n (gsize n_blocks, + gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); +GLIB_AVAILABLE_IN_ALL +gpointer g_try_malloc0_n (gsize n_blocks, + gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); +GLIB_AVAILABLE_IN_ALL +gpointer g_try_realloc_n (gpointer mem, + gsize n_blocks, + gsize n_block_bytes) G_GNUC_WARN_UNUSED_RESULT; + +#if defined(glib_typeof) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_58 +#undef g_clear_pointer +#define g_clear_pointer(pp, destroy) \ + G_STMT_START \ + { \ + G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \ + glib_typeof ((pp)) _pp = (pp); \ + glib_typeof (*(pp)) _ptr = *_pp; \ + *_pp = NULL; \ + if (_ptr) \ + (destroy) (_ptr); \ + } \ + G_STMT_END \ + GLIB_AVAILABLE_MACRO_IN_2_34 +#else /* __GNUC__ */ +#undef g_clear_pointer +#define g_clear_pointer(pp, destroy) \ + G_STMT_START { \ + G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \ + /* Only one access, please; work around type aliasing */ \ + union { char *in; gpointer *out; } _pp; \ + gpointer _p; \ + /* This assignment is needed to avoid a gcc warning */ \ + GDestroyNotify _destroy = (GDestroyNotify) (destroy); \ + \ + _pp.in = (char *) (pp); \ + _p = *_pp.out; \ + if (_p) \ + { \ + *_pp.out = NULL; \ + _destroy (_p); \ + } \ + } G_STMT_END \ + GLIB_AVAILABLE_MACRO_IN_2_34 +#endif /* __GNUC__ */ + +/** + * g_steal_pointer: + * @pp: (not nullable): a pointer to a pointer + * + * Sets @pp to %NULL, returning the value that was there before. + * + * Conceptually, this transfers the ownership of the pointer from the + * referenced variable to the "caller" of the macro (ie: "steals" the + * reference). + * + * The return value will be properly typed, according to the type of + * @pp. + * + * This can be very useful when combined with g_autoptr() to prevent the + * return value of a function from being automatically freed. Consider + * the following example (which only works on GCC and clang): + * + * |[ + * GObject * + * create_object (void) + * { + * g_autoptr(GObject) obj = g_object_new (G_TYPE_OBJECT, NULL); + * + * if (early_error_case) + * return NULL; + * + * return g_steal_pointer (&obj); + * } + * ]| + * + * It can also be used in similar ways for 'out' parameters and is + * particularly useful for dealing with optional out parameters: + * + * |[ + * gboolean + * get_object (GObject **obj_out) + * { + * g_autoptr(GObject) obj = g_object_new (G_TYPE_OBJECT, NULL); + * + * if (early_error_case) + * return FALSE; + * + * if (obj_out) + * *obj_out = g_steal_pointer (&obj); + * + * return TRUE; + * } + * ]| + * + * In the above example, the object will be automatically freed in the + * early error case and also in the case that %NULL was given for + * @obj_out. + * + * Since: 2.44 + */ +GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 +static inline gpointer +g_steal_pointer (gpointer pp) +{ + gpointer *ptr = (gpointer *) pp; + gpointer ref; + + ref = *ptr; + *ptr = NULL; + + return ref; +} + +/* type safety */ +#if defined(glib_typeof) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_58 +#define g_steal_pointer(pp) ((glib_typeof (*pp)) (g_steal_pointer) (pp)) +#else /* __GNUC__ */ +/* This version does not depend on gcc extensions, but gcc does not warn + * about incompatible-pointer-types: */ +#define g_steal_pointer(pp) \ + (0 ? (*(pp)) : (g_steal_pointer) (pp)) +#endif /* __GNUC__ */ + +/* Optimise: avoid the call to the (slower) _n function if we can + * determine at compile-time that no overflow happens. + */ +#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) +# define _G_NEW(struct_type, n_structs, func) \ + (struct_type *) (G_GNUC_EXTENSION ({ \ + gsize __n = (gsize) (n_structs); \ + gsize __s = sizeof (struct_type); \ + gpointer __p; \ + if (__s == 1) \ + __p = g_##func (__n); \ + else if (__builtin_constant_p (__n) && \ + (__s == 0 || __n <= G_MAXSIZE / __s)) \ + __p = g_##func (__n * __s); \ + else \ + __p = g_##func##_n (__n, __s); \ + __p; \ + })) +# define _G_RENEW(struct_type, mem, n_structs, func) \ + (struct_type *) (G_GNUC_EXTENSION ({ \ + gsize __n = (gsize) (n_structs); \ + gsize __s = sizeof (struct_type); \ + gpointer __p = (gpointer) (mem); \ + if (__s == 1) \ + __p = g_##func (__p, __n); \ + else if (__builtin_constant_p (__n) && \ + (__s == 0 || __n <= G_MAXSIZE / __s)) \ + __p = g_##func (__p, __n * __s); \ + else \ + __p = g_##func##_n (__p, __n, __s); \ + __p; \ + })) + +#else + +/* Unoptimised version: always call the _n() function. */ + +#define _G_NEW(struct_type, n_structs, func) \ + ((struct_type *) g_##func##_n ((n_structs), sizeof (struct_type))) +#define _G_RENEW(struct_type, mem, n_structs, func) \ + ((struct_type *) g_##func##_n (mem, (n_structs), sizeof (struct_type))) + +#endif + +/** + * g_new: + * @struct_type: the type of the elements to allocate + * @n_structs: the number of elements to allocate + * + * Allocates @n_structs elements of type @struct_type. + * The returned pointer is cast to a pointer to the given type. + * If @n_structs is 0 it returns %NULL. + * Care is taken to avoid overflow when calculating the size of the allocated block. + * + * Since the returned pointer is already casted to the right type, + * it is normally unnecessary to cast it explicitly, and doing + * so might hide memory allocation errors. + * + * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type + */ +#define g_new(struct_type, n_structs) _G_NEW (struct_type, n_structs, malloc) +/** + * g_new0: + * @struct_type: the type of the elements to allocate. + * @n_structs: the number of elements to allocate. + * + * Allocates @n_structs elements of type @struct_type, initialized to 0's. + * The returned pointer is cast to a pointer to the given type. + * If @n_structs is 0 it returns %NULL. + * Care is taken to avoid overflow when calculating the size of the allocated block. + * + * Since the returned pointer is already casted to the right type, + * it is normally unnecessary to cast it explicitly, and doing + * so might hide memory allocation errors. + * + * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type. + */ +#define g_new0(struct_type, n_structs) _G_NEW (struct_type, n_structs, malloc0) +/** + * g_renew: + * @struct_type: the type of the elements to allocate + * @mem: the currently allocated memory + * @n_structs: the number of elements to allocate + * + * Reallocates the memory pointed to by @mem, so that it now has space for + * @n_structs elements of type @struct_type. It returns the new address of + * the memory, which may have been moved. + * Care is taken to avoid overflow when calculating the size of the allocated block. + * + * Returns: a pointer to the new allocated memory, cast to a pointer to @struct_type + */ +#define g_renew(struct_type, mem, n_structs) _G_RENEW (struct_type, mem, n_structs, realloc) +/** + * g_try_new: + * @struct_type: the type of the elements to allocate + * @n_structs: the number of elements to allocate + * + * Attempts to allocate @n_structs elements of type @struct_type, and returns + * %NULL on failure. Contrast with g_new(), which aborts the program on failure. + * The returned pointer is cast to a pointer to the given type. + * The function returns %NULL when @n_structs is 0 of if an overflow occurs. + * + * Since: 2.8 + * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type + */ +#define g_try_new(struct_type, n_structs) _G_NEW (struct_type, n_structs, try_malloc) +/** + * g_try_new0: + * @struct_type: the type of the elements to allocate + * @n_structs: the number of elements to allocate + * + * Attempts to allocate @n_structs elements of type @struct_type, initialized + * to 0's, and returns %NULL on failure. Contrast with g_new0(), which aborts + * the program on failure. + * The returned pointer is cast to a pointer to the given type. + * The function returns %NULL when @n_structs is 0 or if an overflow occurs. + * + * Since: 2.8 + * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type + */ +#define g_try_new0(struct_type, n_structs) _G_NEW (struct_type, n_structs, try_malloc0) +/** + * g_try_renew: + * @struct_type: the type of the elements to allocate + * @mem: the currently allocated memory + * @n_structs: the number of elements to allocate + * + * Attempts to reallocate the memory pointed to by @mem, so that it now has + * space for @n_structs elements of type @struct_type, and returns %NULL on + * failure. Contrast with g_renew(), which aborts the program on failure. + * It returns the new address of the memory, which may have been moved. + * The function returns %NULL if an overflow occurs. + * + * Since: 2.8 + * Returns: a pointer to the new allocated memory, cast to a pointer to @struct_type + */ +#define g_try_renew(struct_type, mem, n_structs) _G_RENEW (struct_type, mem, n_structs, try_realloc) + + +/* Memory allocation virtualization for debugging purposes + * g_mem_set_vtable() has to be the very first GLib function called + * if being used + */ +struct _GMemVTable { + gpointer (*malloc) (gsize n_bytes); + gpointer (*realloc) (gpointer mem, + gsize n_bytes); + /* optional; set to NULL if not supported */ + gpointer (*memalign) (gsize alignment, + gsize size); + void (*free) (gpointer mem); + /* optional; set to NULL if not used ! */ + gpointer (*calloc) (gsize n_blocks, + gsize n_block_bytes); + gpointer (*try_malloc) (gsize n_bytes); + gpointer (*try_realloc) (gpointer mem, + gsize n_bytes); +}; +GLIB_VAR GMemVTable *glib_mem_table; +GLIB_AVAILABLE_IN_ALL +void g_mem_set_vtable (GMemVTable *vtable); +GLIB_AVAILABLE_IN_ALL +gboolean g_mem_is_system_malloc (void); + +GLIB_VAR gboolean g_mem_gc_friendly; + +/* Memory profiler and checker, has to be enabled via g_mem_set_vtable() + */ +GLIB_VAR GMemVTable *glib_mem_profiler_table; +GLIB_DEPRECATED_IN_2_46 +void g_mem_profile (void); + +G_END_DECLS + +#endif /* __G_MEM_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_NODE_H__ +#define __G_NODE_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GNode GNode; + +/* Tree traverse flags */ +typedef enum +{ + G_TRAVERSE_LEAVES = 1 << 0, + G_TRAVERSE_NON_LEAVES = 1 << 1, + G_TRAVERSE_ALL = G_TRAVERSE_LEAVES | G_TRAVERSE_NON_LEAVES, + G_TRAVERSE_MASK = 0x03, + G_TRAVERSE_LEAFS = G_TRAVERSE_LEAVES, + G_TRAVERSE_NON_LEAFS = G_TRAVERSE_NON_LEAVES +} GTraverseFlags; + +/* Tree traverse orders */ +typedef enum +{ + G_IN_ORDER, + G_PRE_ORDER, + G_POST_ORDER, + G_LEVEL_ORDER +} GTraverseType; + +typedef gboolean (*GNodeTraverseFunc) (GNode *node, + gpointer data); +typedef void (*GNodeForeachFunc) (GNode *node, + gpointer data); + +/* N-way tree implementation + */ +struct _GNode +{ + gpointer data; + GNode *next; + GNode *prev; + GNode *parent; + GNode *children; +}; + +/** + * G_NODE_IS_ROOT: + * @node: a #GNode + * + * Returns %TRUE if a #GNode is the root of a tree. + * + * Returns: %TRUE if the #GNode is the root of a tree + * (i.e. it has no parent or siblings) + */ +#define G_NODE_IS_ROOT(node) (((GNode*) (node))->parent == NULL && \ + ((GNode*) (node))->prev == NULL && \ + ((GNode*) (node))->next == NULL) + +/** + * G_NODE_IS_LEAF: + * @node: a #GNode + * + * Returns %TRUE if a #GNode is a leaf node. + * + * Returns: %TRUE if the #GNode is a leaf node + * (i.e. it has no children) + */ +#define G_NODE_IS_LEAF(node) (((GNode*) (node))->children == NULL) + +GLIB_AVAILABLE_IN_ALL +GNode* g_node_new (gpointer data); +GLIB_AVAILABLE_IN_ALL +void g_node_destroy (GNode *root); +GLIB_AVAILABLE_IN_ALL +void g_node_unlink (GNode *node); +GLIB_AVAILABLE_IN_ALL +GNode* g_node_copy_deep (GNode *node, + GCopyFunc copy_func, + gpointer data); +GLIB_AVAILABLE_IN_ALL +GNode* g_node_copy (GNode *node); +GLIB_AVAILABLE_IN_ALL +GNode* g_node_insert (GNode *parent, + gint position, + GNode *node); +GLIB_AVAILABLE_IN_ALL +GNode* g_node_insert_before (GNode *parent, + GNode *sibling, + GNode *node); +GLIB_AVAILABLE_IN_ALL +GNode* g_node_insert_after (GNode *parent, + GNode *sibling, + GNode *node); +GLIB_AVAILABLE_IN_ALL +GNode* g_node_prepend (GNode *parent, + GNode *node); +GLIB_AVAILABLE_IN_ALL +guint g_node_n_nodes (GNode *root, + GTraverseFlags flags); +GLIB_AVAILABLE_IN_ALL +GNode* g_node_get_root (GNode *node); +GLIB_AVAILABLE_IN_ALL +gboolean g_node_is_ancestor (GNode *node, + GNode *descendant); +GLIB_AVAILABLE_IN_ALL +guint g_node_depth (GNode *node); +GLIB_AVAILABLE_IN_ALL +GNode* g_node_find (GNode *root, + GTraverseType order, + GTraverseFlags flags, + gpointer data); + +/* convenience macros */ +/** + * g_node_append: + * @parent: the #GNode to place the new #GNode under + * @node: the #GNode to insert + * + * Inserts a #GNode as the last child of the given parent. + * + * Returns: the inserted #GNode + */ +#define g_node_append(parent, node) \ + g_node_insert_before ((parent), NULL, (node)) + +/** + * g_node_insert_data: + * @parent: the #GNode to place the new #GNode under + * @position: the position to place the new #GNode at. If position is -1, + * the new #GNode is inserted as the last child of @parent + * @data: the data for the new #GNode + * + * Inserts a new #GNode at the given position. + * + * Returns: the new #GNode + */ +#define g_node_insert_data(parent, position, data) \ + g_node_insert ((parent), (position), g_node_new (data)) + +/** + * g_node_insert_data_after: + * @parent: the #GNode to place the new #GNode under + * @sibling: the sibling #GNode to place the new #GNode after + * @data: the data for the new #GNode + * + * Inserts a new #GNode after the given sibling. + * + * Returns: the new #GNode + */ + +#define g_node_insert_data_after(parent, sibling, data) \ + g_node_insert_after ((parent), (sibling), g_node_new (data)) +/** + * g_node_insert_data_before: + * @parent: the #GNode to place the new #GNode under + * @sibling: the sibling #GNode to place the new #GNode before + * @data: the data for the new #GNode + * + * Inserts a new #GNode before the given sibling. + * + * Returns: the new #GNode + */ +#define g_node_insert_data_before(parent, sibling, data) \ + g_node_insert_before ((parent), (sibling), g_node_new (data)) + +/** + * g_node_prepend_data: + * @parent: the #GNode to place the new #GNode under + * @data: the data for the new #GNode + * + * Inserts a new #GNode as the first child of the given parent. + * + * Returns: the new #GNode + */ +#define g_node_prepend_data(parent, data) \ + g_node_prepend ((parent), g_node_new (data)) + +/** + * g_node_append_data: + * @parent: the #GNode to place the new #GNode under + * @data: the data for the new #GNode + * + * Inserts a new #GNode as the last child of the given parent. + * + * Returns: the new #GNode + */ +#define g_node_append_data(parent, data) \ + g_node_insert_before ((parent), NULL, g_node_new (data)) + +/* traversal function, assumes that 'node' is root + * (only traverses 'node' and its subtree). + * this function is just a high level interface to + * low level traversal functions, optimized for speed. + */ +GLIB_AVAILABLE_IN_ALL +void g_node_traverse (GNode *root, + GTraverseType order, + GTraverseFlags flags, + gint max_depth, + GNodeTraverseFunc func, + gpointer data); + +/* return the maximum tree height starting with 'node', this is an expensive + * operation, since we need to visit all nodes. this could be shortened by + * adding 'guint height' to struct _GNode, but then again, this is not very + * often needed, and would make g_node_insert() more time consuming. + */ +GLIB_AVAILABLE_IN_ALL +guint g_node_max_height (GNode *root); + +GLIB_AVAILABLE_IN_ALL +void g_node_children_foreach (GNode *node, + GTraverseFlags flags, + GNodeForeachFunc func, + gpointer data); +GLIB_AVAILABLE_IN_ALL +void g_node_reverse_children (GNode *node); +GLIB_AVAILABLE_IN_ALL +guint g_node_n_children (GNode *node); +GLIB_AVAILABLE_IN_ALL +GNode* g_node_nth_child (GNode *node, + guint n); +GLIB_AVAILABLE_IN_ALL +GNode* g_node_last_child (GNode *node); +GLIB_AVAILABLE_IN_ALL +GNode* g_node_find_child (GNode *node, + GTraverseFlags flags, + gpointer data); +GLIB_AVAILABLE_IN_ALL +gint g_node_child_position (GNode *node, + GNode *child); +GLIB_AVAILABLE_IN_ALL +gint g_node_child_index (GNode *node, + gpointer data); + +GLIB_AVAILABLE_IN_ALL +GNode* g_node_first_sibling (GNode *node); +GLIB_AVAILABLE_IN_ALL +GNode* g_node_last_sibling (GNode *node); + +/** + * g_node_prev_sibling: + * @node: a #GNode + * + * Gets the previous sibling of a #GNode. + * + * Returns: the previous sibling of @node, or %NULL if @node is the first + * node or %NULL + */ +#define g_node_prev_sibling(node) ((node) ? \ + ((GNode*) (node))->prev : NULL) + +/** + * g_node_next_sibling: + * @node: a #GNode + * + * Gets the next sibling of a #GNode. + * + * Returns: the next sibling of @node, or %NULL if @node is the last node + * or %NULL + */ +#define g_node_next_sibling(node) ((node) ? \ + ((GNode*) (node))->next : NULL) + +/** + * g_node_first_child: + * @node: a #GNode + * + * Gets the first child of a #GNode. + * + * Returns: the first child of @node, or %NULL if @node is %NULL + * or has no children + */ +#define g_node_first_child(node) ((node) ? \ + ((GNode*) (node))->children : NULL) + +G_END_DECLS + +#endif /* __G_NODE_H__ */ + +G_BEGIN_DECLS + +typedef struct _GList GList; + +struct _GList +{ + gpointer data; + GList *next; + GList *prev; +}; + +/* Doubly linked lists + */ +GLIB_AVAILABLE_IN_ALL +GList* g_list_alloc (void) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +void g_list_free (GList *list); +GLIB_AVAILABLE_IN_ALL +void g_list_free_1 (GList *list); +#define g_list_free1 g_list_free_1 +GLIB_AVAILABLE_IN_ALL +void g_list_free_full (GList *list, + GDestroyNotify free_func); +GLIB_AVAILABLE_IN_ALL +GList* g_list_append (GList *list, + gpointer data) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GList* g_list_prepend (GList *list, + gpointer data) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GList* g_list_insert (GList *list, + gpointer data, + gint position) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GList* g_list_insert_sorted (GList *list, + gpointer data, + GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GList* g_list_insert_sorted_with_data (GList *list, + gpointer data, + GCompareDataFunc func, + gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GList* g_list_insert_before (GList *list, + GList *sibling, + gpointer data) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_2_62 +GList* g_list_insert_before_link (GList *list, + GList *sibling, + GList *link_) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GList* g_list_concat (GList *list1, + GList *list2) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GList* g_list_remove (GList *list, + gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GList* g_list_remove_all (GList *list, + gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GList* g_list_remove_link (GList *list, + GList *llink) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GList* g_list_delete_link (GList *list, + GList *link_) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GList* g_list_reverse (GList *list) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GList* g_list_copy (GList *list) G_GNUC_WARN_UNUSED_RESULT; + +GLIB_AVAILABLE_IN_2_34 +GList* g_list_copy_deep (GList *list, + GCopyFunc func, + gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; + +GLIB_AVAILABLE_IN_ALL +GList* g_list_nth (GList *list, + guint n); +GLIB_AVAILABLE_IN_ALL +GList* g_list_nth_prev (GList *list, + guint n); +GLIB_AVAILABLE_IN_ALL +GList* g_list_find (GList *list, + gconstpointer data); +GLIB_AVAILABLE_IN_ALL +GList* g_list_find_custom (GList *list, + gconstpointer data, + GCompareFunc func); +GLIB_AVAILABLE_IN_ALL +gint g_list_position (GList *list, + GList *llink); +GLIB_AVAILABLE_IN_ALL +gint g_list_index (GList *list, + gconstpointer data); +GLIB_AVAILABLE_IN_ALL +GList* g_list_last (GList *list); +GLIB_AVAILABLE_IN_ALL +GList* g_list_first (GList *list); +GLIB_AVAILABLE_IN_ALL +guint g_list_length (GList *list); +GLIB_AVAILABLE_IN_ALL +void g_list_foreach (GList *list, + GFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +GList* g_list_sort (GList *list, + GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GList* g_list_sort_with_data (GList *list, + GCompareDataFunc compare_func, + gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +gpointer g_list_nth_data (GList *list, + guint n); + +GLIB_AVAILABLE_IN_2_64 +void g_clear_list (GList **list_ptr, + GDestroyNotify destroy); + +#undef g_clear_list +#define g_clear_list(list_ptr, destroy) \ + G_STMT_START { \ + GList *_list; \ + \ + _list = *(list_ptr); \ + if (_list) \ + { \ + *list_ptr = NULL; \ + \ + if ((destroy) != NULL) \ + g_list_free_full (_list, (destroy)); \ + else \ + g_list_free (_list); \ + } \ + } G_STMT_END \ + GLIB_AVAILABLE_MACRO_IN_2_64 + + +#define g_list_previous(list) ((list) ? (((GList *)(list))->prev) : NULL) +#define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL) + +G_END_DECLS + +#endif /* __G_LIST_H__ */ + +G_BEGIN_DECLS + +typedef struct _GHashTable GHashTable; + +typedef gboolean (*GHRFunc) (gpointer key, + gpointer value, + gpointer user_data); + +typedef struct _GHashTableIter GHashTableIter; + +struct _GHashTableIter +{ + /*< private >*/ + gpointer dummy1; + gpointer dummy2; + gpointer dummy3; + int dummy4; + gboolean dummy5; + gpointer dummy6; +}; + +GLIB_AVAILABLE_IN_ALL +GHashTable* g_hash_table_new (GHashFunc hash_func, + GEqualFunc key_equal_func); +GLIB_AVAILABLE_IN_ALL +GHashTable* g_hash_table_new_full (GHashFunc hash_func, + GEqualFunc key_equal_func, + GDestroyNotify key_destroy_func, + GDestroyNotify value_destroy_func); +GLIB_AVAILABLE_IN_ALL +void g_hash_table_destroy (GHashTable *hash_table); +GLIB_AVAILABLE_IN_ALL +gboolean g_hash_table_insert (GHashTable *hash_table, + gpointer key, + gpointer value); +GLIB_AVAILABLE_IN_ALL +gboolean g_hash_table_replace (GHashTable *hash_table, + gpointer key, + gpointer value); +GLIB_AVAILABLE_IN_ALL +gboolean g_hash_table_add (GHashTable *hash_table, + gpointer key); +GLIB_AVAILABLE_IN_ALL +gboolean g_hash_table_remove (GHashTable *hash_table, + gconstpointer key); +GLIB_AVAILABLE_IN_ALL +void g_hash_table_remove_all (GHashTable *hash_table); +GLIB_AVAILABLE_IN_ALL +gboolean g_hash_table_steal (GHashTable *hash_table, + gconstpointer key); +GLIB_AVAILABLE_IN_2_58 +gboolean g_hash_table_steal_extended (GHashTable *hash_table, + gconstpointer lookup_key, + gpointer *stolen_key, + gpointer *stolen_value); +GLIB_AVAILABLE_IN_ALL +void g_hash_table_steal_all (GHashTable *hash_table); +GLIB_AVAILABLE_IN_ALL +gpointer g_hash_table_lookup (GHashTable *hash_table, + gconstpointer key); +GLIB_AVAILABLE_IN_ALL +gboolean g_hash_table_contains (GHashTable *hash_table, + gconstpointer key); +GLIB_AVAILABLE_IN_ALL +gboolean g_hash_table_lookup_extended (GHashTable *hash_table, + gconstpointer lookup_key, + gpointer *orig_key, + gpointer *value); +GLIB_AVAILABLE_IN_ALL +void g_hash_table_foreach (GHashTable *hash_table, + GHFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +gpointer g_hash_table_find (GHashTable *hash_table, + GHRFunc predicate, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +guint g_hash_table_foreach_remove (GHashTable *hash_table, + GHRFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +guint g_hash_table_foreach_steal (GHashTable *hash_table, + GHRFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +guint g_hash_table_size (GHashTable *hash_table); +GLIB_AVAILABLE_IN_ALL +GList * g_hash_table_get_keys (GHashTable *hash_table); +GLIB_AVAILABLE_IN_ALL +GList * g_hash_table_get_values (GHashTable *hash_table); +GLIB_AVAILABLE_IN_2_40 +gpointer * g_hash_table_get_keys_as_array (GHashTable *hash_table, + guint *length); + +GLIB_AVAILABLE_IN_ALL +void g_hash_table_iter_init (GHashTableIter *iter, + GHashTable *hash_table); +GLIB_AVAILABLE_IN_ALL +gboolean g_hash_table_iter_next (GHashTableIter *iter, + gpointer *key, + gpointer *value); +GLIB_AVAILABLE_IN_ALL +GHashTable* g_hash_table_iter_get_hash_table (GHashTableIter *iter); +GLIB_AVAILABLE_IN_ALL +void g_hash_table_iter_remove (GHashTableIter *iter); +GLIB_AVAILABLE_IN_2_30 +void g_hash_table_iter_replace (GHashTableIter *iter, + gpointer value); +GLIB_AVAILABLE_IN_ALL +void g_hash_table_iter_steal (GHashTableIter *iter); + +GLIB_AVAILABLE_IN_ALL +GHashTable* g_hash_table_ref (GHashTable *hash_table); +GLIB_AVAILABLE_IN_ALL +void g_hash_table_unref (GHashTable *hash_table); + +#define g_hash_table_freeze(hash_table) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26 +#define g_hash_table_thaw(hash_table) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26 + +/* Hash Functions + */ +GLIB_AVAILABLE_IN_ALL +gboolean g_str_equal (gconstpointer v1, + gconstpointer v2); +GLIB_AVAILABLE_IN_ALL +guint g_str_hash (gconstpointer v); + +GLIB_AVAILABLE_IN_ALL +gboolean g_int_equal (gconstpointer v1, + gconstpointer v2); +GLIB_AVAILABLE_IN_ALL +guint g_int_hash (gconstpointer v); + +GLIB_AVAILABLE_IN_ALL +gboolean g_int64_equal (gconstpointer v1, + gconstpointer v2); +GLIB_AVAILABLE_IN_ALL +guint g_int64_hash (gconstpointer v); + +GLIB_AVAILABLE_IN_ALL +gboolean g_double_equal (gconstpointer v1, + gconstpointer v2); +GLIB_AVAILABLE_IN_ALL +guint g_double_hash (gconstpointer v); + +GLIB_AVAILABLE_IN_ALL +guint g_direct_hash (gconstpointer v) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_direct_equal (gconstpointer v1, + gconstpointer v2) G_GNUC_CONST; + +G_END_DECLS + +#endif /* __G_HASH_H__ */ +/* ghmac.h - secure data hashing + * + * Copyright (C) 2011 Stef Walter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_HMAC_H__ +#define __G_HMAC_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * GHmac: + * + * An opaque structure representing a HMAC operation. + * To create a new GHmac, use g_hmac_new(). To free + * a GHmac, use g_hmac_unref(). + * + * Since: 2.30 + */ +typedef struct _GHmac GHmac; + +GLIB_AVAILABLE_IN_2_30 +GHmac * g_hmac_new (GChecksumType digest_type, + const guchar *key, + gsize key_len); +GLIB_AVAILABLE_IN_2_30 +GHmac * g_hmac_copy (const GHmac *hmac); +GLIB_AVAILABLE_IN_2_30 +GHmac * g_hmac_ref (GHmac *hmac); +GLIB_AVAILABLE_IN_2_30 +void g_hmac_unref (GHmac *hmac); +GLIB_AVAILABLE_IN_2_30 +void g_hmac_update (GHmac *hmac, + const guchar *data, + gssize length); +GLIB_AVAILABLE_IN_2_30 +const gchar * g_hmac_get_string (GHmac *hmac); +GLIB_AVAILABLE_IN_2_30 +void g_hmac_get_digest (GHmac *hmac, + guint8 *buffer, + gsize *digest_len); + +GLIB_AVAILABLE_IN_2_30 +gchar *g_compute_hmac_for_data (GChecksumType digest_type, + const guchar *key, + gsize key_len, + const guchar *data, + gsize length); +GLIB_AVAILABLE_IN_2_30 +gchar *g_compute_hmac_for_string (GChecksumType digest_type, + const guchar *key, + gsize key_len, + const gchar *str, + gssize length); +GLIB_AVAILABLE_IN_2_50 +gchar *g_compute_hmac_for_bytes (GChecksumType digest_type, + GBytes *key, + GBytes *data); + + +G_END_DECLS + +#endif /* __G_CHECKSUM_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_HOOK_H__ +#define __G_HOOK_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + + +/* --- typedefs --- */ +typedef struct _GHook GHook; +typedef struct _GHookList GHookList; + +typedef gint (*GHookCompareFunc) (GHook *new_hook, + GHook *sibling); +typedef gboolean (*GHookFindFunc) (GHook *hook, + gpointer data); +typedef void (*GHookMarshaller) (GHook *hook, + gpointer marshal_data); +typedef gboolean (*GHookCheckMarshaller) (GHook *hook, + gpointer marshal_data); +typedef void (*GHookFunc) (gpointer data); +typedef gboolean (*GHookCheckFunc) (gpointer data); +typedef void (*GHookFinalizeFunc) (GHookList *hook_list, + GHook *hook); +typedef enum +{ + G_HOOK_FLAG_ACTIVE = 1 << 0, + G_HOOK_FLAG_IN_CALL = 1 << 1, + G_HOOK_FLAG_MASK = 0x0f +} GHookFlagMask; +#define G_HOOK_FLAG_USER_SHIFT (4) + + +/* --- structures --- */ +struct _GHookList +{ + gulong seq_id; + guint hook_size : 16; + guint is_setup : 1; + GHook *hooks; + gpointer dummy3; + GHookFinalizeFunc finalize_hook; + gpointer dummy[2]; +}; +struct _GHook +{ + gpointer data; + GHook *next; + GHook *prev; + guint ref_count; + gulong hook_id; + guint flags; + gpointer func; + GDestroyNotify destroy; +}; + + +/* --- macros --- */ +#define G_HOOK(hook) ((GHook*) (hook)) +#define G_HOOK_FLAGS(hook) (G_HOOK (hook)->flags) +#define G_HOOK_ACTIVE(hook) ((G_HOOK_FLAGS (hook) & \ + G_HOOK_FLAG_ACTIVE) != 0) +#define G_HOOK_IN_CALL(hook) ((G_HOOK_FLAGS (hook) & \ + G_HOOK_FLAG_IN_CALL) != 0) +#define G_HOOK_IS_VALID(hook) (G_HOOK (hook)->hook_id != 0 && \ + (G_HOOK_FLAGS (hook) & \ + G_HOOK_FLAG_ACTIVE)) +#define G_HOOK_IS_UNLINKED(hook) (G_HOOK (hook)->next == NULL && \ + G_HOOK (hook)->prev == NULL && \ + G_HOOK (hook)->hook_id == 0 && \ + G_HOOK (hook)->ref_count == 0) + + +/* --- prototypes --- */ +/* callback maintenance functions */ +GLIB_AVAILABLE_IN_ALL +void g_hook_list_init (GHookList *hook_list, + guint hook_size); +GLIB_AVAILABLE_IN_ALL +void g_hook_list_clear (GHookList *hook_list); +GLIB_AVAILABLE_IN_ALL +GHook* g_hook_alloc (GHookList *hook_list); +GLIB_AVAILABLE_IN_ALL +void g_hook_free (GHookList *hook_list, + GHook *hook); +GLIB_AVAILABLE_IN_ALL +GHook * g_hook_ref (GHookList *hook_list, + GHook *hook); +GLIB_AVAILABLE_IN_ALL +void g_hook_unref (GHookList *hook_list, + GHook *hook); +GLIB_AVAILABLE_IN_ALL +gboolean g_hook_destroy (GHookList *hook_list, + gulong hook_id); +GLIB_AVAILABLE_IN_ALL +void g_hook_destroy_link (GHookList *hook_list, + GHook *hook); +GLIB_AVAILABLE_IN_ALL +void g_hook_prepend (GHookList *hook_list, + GHook *hook); +GLIB_AVAILABLE_IN_ALL +void g_hook_insert_before (GHookList *hook_list, + GHook *sibling, + GHook *hook); +GLIB_AVAILABLE_IN_ALL +void g_hook_insert_sorted (GHookList *hook_list, + GHook *hook, + GHookCompareFunc func); +GLIB_AVAILABLE_IN_ALL +GHook* g_hook_get (GHookList *hook_list, + gulong hook_id); +GLIB_AVAILABLE_IN_ALL +GHook* g_hook_find (GHookList *hook_list, + gboolean need_valids, + GHookFindFunc func, + gpointer data); +GLIB_AVAILABLE_IN_ALL +GHook* g_hook_find_data (GHookList *hook_list, + gboolean need_valids, + gpointer data); +GLIB_AVAILABLE_IN_ALL +GHook* g_hook_find_func (GHookList *hook_list, + gboolean need_valids, + gpointer func); +GLIB_AVAILABLE_IN_ALL +GHook* g_hook_find_func_data (GHookList *hook_list, + gboolean need_valids, + gpointer func, + gpointer data); +/* return the first valid hook, and increment its reference count */ +GLIB_AVAILABLE_IN_ALL +GHook* g_hook_first_valid (GHookList *hook_list, + gboolean may_be_in_call); +/* return the next valid hook with incremented reference count, and + * decrement the reference count of the original hook + */ +GLIB_AVAILABLE_IN_ALL +GHook* g_hook_next_valid (GHookList *hook_list, + GHook *hook, + gboolean may_be_in_call); +/* GHookCompareFunc implementation to insert hooks sorted by their id */ +GLIB_AVAILABLE_IN_ALL +gint g_hook_compare_ids (GHook *new_hook, + GHook *sibling); +/* convenience macros */ +#define g_hook_append( hook_list, hook ) \ + g_hook_insert_before ((hook_list), NULL, (hook)) +/* invoke all valid hooks with the (*GHookFunc) signature. + */ +GLIB_AVAILABLE_IN_ALL +void g_hook_list_invoke (GHookList *hook_list, + gboolean may_recurse); +/* invoke all valid hooks with the (*GHookCheckFunc) signature, + * and destroy the hook if FALSE is returned. + */ +GLIB_AVAILABLE_IN_ALL +void g_hook_list_invoke_check (GHookList *hook_list, + gboolean may_recurse); +/* invoke a marshaller on all valid hooks. + */ +GLIB_AVAILABLE_IN_ALL +void g_hook_list_marshal (GHookList *hook_list, + gboolean may_recurse, + GHookMarshaller marshaller, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_hook_list_marshal_check (GHookList *hook_list, + gboolean may_recurse, + GHookCheckMarshaller marshaller, + gpointer marshal_data); + +G_END_DECLS + +#endif /* __G_HOOK_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 2008 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_HOST_UTILS_H__ +#define __G_HOST_UTILS_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_ALL +gboolean g_hostname_is_non_ascii (const gchar *hostname); +GLIB_AVAILABLE_IN_ALL +gboolean g_hostname_is_ascii_encoded (const gchar *hostname); +GLIB_AVAILABLE_IN_ALL +gboolean g_hostname_is_ip_address (const gchar *hostname); + +GLIB_AVAILABLE_IN_ALL +gchar *g_hostname_to_ascii (const gchar *hostname); +GLIB_AVAILABLE_IN_ALL +gchar *g_hostname_to_unicode (const gchar *hostname); + +G_END_DECLS + +#endif /* __G_HOST_UTILS_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_IOCHANNEL_H__ +#define __G_IOCHANNEL_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +/* gmain.h - the GLib Main loop + * Copyright (C) 1998-2000 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_MAIN_H__ +#define __G_MAIN_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +/* gpoll.h - poll(2) support + * Copyright (C) 2008 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_POLL_H__ +#define __G_POLL_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (__G_MAIN_H__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/* Any definitions using GPollFD or GPollFunc are primarily + * for Unix and not guaranteed to be the compatible on all + * operating systems on which GLib runs. Right now, the + * GLib does use these functions on Win32 as well, but interprets + * them in a fairly different way than on Unix. If you use + * these definitions, you are should be prepared to recode + * for different operating systems. + * + * Note that on systems with a working poll(2), that function is used + * in place of g_poll(). Thus g_poll() must have the same signature as + * poll(), meaning GPollFD must have the same layout as struct pollfd. + * + * On Win32, the fd in a GPollFD should be Win32 HANDLE (*not* a file + * descriptor as provided by the C runtime) that can be used by + * MsgWaitForMultipleObjects. This does *not* include file handles + * from CreateFile, SOCKETs, nor pipe handles. (But you can use + * WSAEventSelect to signal events when a SOCKET is readable). + * + * On Win32, fd can also be the special value G_WIN32_MSG_HANDLE to + * indicate polling for messages. + * + * But note that G_WIN32_MSG_HANDLE GPollFDs should not be used by GDK + * (GTK) programs, as GDK itself wants to read messages and convert them + * to GDK events. + * + * So, unless you really know what you are doing, it's best not to try + * to use the main loop polling stuff for your own needs on + * Windows. + */ +typedef struct _GPollFD GPollFD; + +/** + * GPollFunc: + * @ufds: an array of #GPollFD elements + * @nfsd: the number of elements in @ufds + * @timeout_: the maximum time to wait for an event of the file descriptors. + * A negative value indicates an infinite timeout. + * + * Specifies the type of function passed to g_main_context_set_poll_func(). + * The semantics of the function should match those of the poll() system call. + * + * Returns: the number of #GPollFD elements which have events or errors + * reported, or -1 if an error occurred. + */ +typedef gint (*GPollFunc) (GPollFD *ufds, + guint nfsd, + gint timeout_); + +/** + * GPollFD: + * @fd: the file descriptor to poll (or a HANDLE on Win32) + * @events: a bitwise combination from #GIOCondition, specifying which + * events should be polled for. Typically for reading from a file + * descriptor you would use %G_IO_IN | %G_IO_HUP | %G_IO_ERR, and + * for writing you would use %G_IO_OUT | %G_IO_ERR. + * @revents: a bitwise combination of flags from #GIOCondition, returned + * from the poll() function to indicate which events occurred. + * + * Represents a file descriptor, which events to poll for, and which events + * occurred. + */ +struct _GPollFD +{ +#if defined (G_OS_WIN32) && GLIB_SIZEOF_VOID_P == 8 +#ifndef __GTK_DOC_IGNORE__ + gint64 fd; +#endif +#else + gint fd; +#endif + gushort events; + gushort revents; +}; + +/** + * G_POLLFD_FORMAT: + * + * A format specifier that can be used in printf()-style format strings + * when printing the @fd member of a #GPollFD. + */ +/* defined in glibconfig.h */ + +GLIB_AVAILABLE_IN_ALL +gint +g_poll (GPollFD *fds, + guint nfds, + gint timeout); + +G_END_DECLS + +#endif /* __G_POLL_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_SLIST_H__ +#define __G_SLIST_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GSList GSList; + +struct _GSList +{ + gpointer data; + GSList *next; +}; + +/* Singly linked lists + */ +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_alloc (void) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +void g_slist_free (GSList *list); +GLIB_AVAILABLE_IN_ALL +void g_slist_free_1 (GSList *list); +#define g_slist_free1 g_slist_free_1 +GLIB_AVAILABLE_IN_ALL +void g_slist_free_full (GSList *list, + GDestroyNotify free_func); +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_append (GSList *list, + gpointer data) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_prepend (GSList *list, + gpointer data) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_insert (GSList *list, + gpointer data, + gint position) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_insert_sorted (GSList *list, + gpointer data, + GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_insert_sorted_with_data (GSList *list, + gpointer data, + GCompareDataFunc func, + gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_insert_before (GSList *slist, + GSList *sibling, + gpointer data) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_concat (GSList *list1, + GSList *list2) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_remove (GSList *list, + gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_remove_all (GSList *list, + gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_remove_link (GSList *list, + GSList *link_) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_delete_link (GSList *list, + GSList *link_) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_reverse (GSList *list) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_copy (GSList *list) G_GNUC_WARN_UNUSED_RESULT; + +GLIB_AVAILABLE_IN_2_34 +GSList* g_slist_copy_deep (GSList *list, + GCopyFunc func, + gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_nth (GSList *list, + guint n); +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_find (GSList *list, + gconstpointer data); +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_find_custom (GSList *list, + gconstpointer data, + GCompareFunc func); +GLIB_AVAILABLE_IN_ALL +gint g_slist_position (GSList *list, + GSList *llink); +GLIB_AVAILABLE_IN_ALL +gint g_slist_index (GSList *list, + gconstpointer data); +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_last (GSList *list); +GLIB_AVAILABLE_IN_ALL +guint g_slist_length (GSList *list); +GLIB_AVAILABLE_IN_ALL +void g_slist_foreach (GSList *list, + GFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_sort (GSList *list, + GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +GSList* g_slist_sort_with_data (GSList *list, + GCompareDataFunc compare_func, + gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; +GLIB_AVAILABLE_IN_ALL +gpointer g_slist_nth_data (GSList *list, + guint n); + +GLIB_AVAILABLE_IN_2_64 +void g_clear_slist (GSList **slist_ptr, + GDestroyNotify destroy); + +#undef g_clear_slist +#define g_clear_slist(slist_ptr, destroy) \ + G_STMT_START { \ + GSList *_slist; \ + \ + _slist = *(slist_ptr); \ + if (_slist) \ + { \ + *slist_ptr = NULL; \ + \ + if ((destroy) != NULL) \ + g_slist_free_full (_slist, (destroy)); \ + else \ + g_slist_free (_slist); \ + } \ + } G_STMT_END \ + GLIB_AVAILABLE_MACRO_IN_2_64 + +#define g_slist_next(slist) ((slist) ? (((GSList *)(slist))->next) : NULL) + +G_END_DECLS + +#endif /* __G_SLIST_H__ */ + +G_BEGIN_DECLS + +typedef enum /*< flags >*/ +{ + G_IO_IN GLIB_SYSDEF_POLLIN, + G_IO_OUT GLIB_SYSDEF_POLLOUT, + G_IO_PRI GLIB_SYSDEF_POLLPRI, + G_IO_ERR GLIB_SYSDEF_POLLERR, + G_IO_HUP GLIB_SYSDEF_POLLHUP, + G_IO_NVAL GLIB_SYSDEF_POLLNVAL +} GIOCondition; + + +/** + * GMainContext: + * + * The `GMainContext` struct is an opaque data + * type representing a set of sources to be handled in a main loop. + */ +typedef struct _GMainContext GMainContext; + +/** + * GMainLoop: + * + * The `GMainLoop` struct is an opaque data type + * representing the main event loop of a GLib or GTK+ application. + */ +typedef struct _GMainLoop GMainLoop; + +/** + * GSource: + * + * The `GSource` struct is an opaque data type + * representing an event source. + */ +typedef struct _GSource GSource; +typedef struct _GSourcePrivate GSourcePrivate; + +/** + * GSourceCallbackFuncs: + * @ref: Called when a reference is added to the callback object + * @unref: Called when a reference to the callback object is dropped + * @get: Called to extract the callback function and data from the + * callback object. + * + * The `GSourceCallbackFuncs` struct contains + * functions for managing callback objects. + */ +typedef struct _GSourceCallbackFuncs GSourceCallbackFuncs; + +/** + * GSourceFuncs: + * @prepare: Called before all the file descriptors are polled. If the + * source can determine that it is ready here (without waiting for the + * results of the poll() call) it should return %TRUE. It can also return + * a @timeout_ value which should be the maximum timeout (in milliseconds) + * which should be passed to the poll() call. The actual timeout used will + * be -1 if all sources returned -1, or it will be the minimum of all + * the @timeout_ values returned which were >= 0. Since 2.36 this may + * be %NULL, in which case the effect is as if the function always returns + * %FALSE with a timeout of -1. If @prepare returns a + * timeout and the source also has a ready time set, then the + * lower of the two will be used. + * @check: Called after all the file descriptors are polled. The source + * should return %TRUE if it is ready to be dispatched. Note that some + * time may have passed since the previous prepare function was called, + * so the source should be checked again here. Since 2.36 this may + * be %NULL, in which case the effect is as if the function always returns + * %FALSE. + * @dispatch: Called to dispatch the event source, after it has returned + * %TRUE in either its @prepare or its @check function, or if a ready time + * has been reached. The @dispatch function receives a callback function and + * user data. The callback function may be %NULL if the source was never + * connected to a callback using g_source_set_callback(). The @dispatch + * function should call the callback function with @user_data and whatever + * additional parameters are needed for this type of event source. The + * return value of the @dispatch function should be #G_SOURCE_REMOVE if the + * source should be removed or #G_SOURCE_CONTINUE to keep it. + * @finalize: Called when the source is finalized. At this point, the source + * will have been destroyed, had its callback cleared, and have been removed + * from its #GMainContext, but it will still have its final reference count, + * so methods can be called on it from within this function. + * + * The `GSourceFuncs` struct contains a table of + * functions used to handle event sources in a generic manner. + * + * For idle sources, the prepare and check functions always return %TRUE + * to indicate that the source is always ready to be processed. The prepare + * function also returns a timeout value of 0 to ensure that the poll() call + * doesn't block (since that would be time wasted which could have been spent + * running the idle function). + * + * For timeout sources, the prepare and check functions both return %TRUE + * if the timeout interval has expired. The prepare function also returns + * a timeout value to ensure that the poll() call doesn't block too long + * and miss the next timeout. + * + * For file descriptor sources, the prepare function typically returns %FALSE, + * since it must wait until poll() has been called before it knows whether + * any events need to be processed. It sets the returned timeout to -1 to + * indicate that it doesn't mind how long the poll() call blocks. In the + * check function, it tests the results of the poll() call to see if the + * required condition has been met, and returns %TRUE if so. + */ +typedef struct _GSourceFuncs GSourceFuncs; + +/** + * GPid: + * + * A type which is used to hold a process identification. + * + * On UNIX, processes are identified by a process id (an integer), + * while Windows uses process handles (which are pointers). + * + * GPid is used in GLib only for descendant processes spawned with + * the g_spawn functions. + */ +/* defined in glibconfig.h */ + +/** + * G_PID_FORMAT: + * + * A format specifier that can be used in printf()-style format strings + * when printing a #GPid. + * + * Since: 2.50 + */ +/* defined in glibconfig.h */ + +/** + * GSourceFunc: + * @user_data: data passed to the function, set when the source was + * created with one of the above functions + * + * Specifies the type of function passed to g_timeout_add(), + * g_timeout_add_full(), g_idle_add(), and g_idle_add_full(). + * + * When calling g_source_set_callback(), you may need to cast a function of a + * different type to this type. Use G_SOURCE_FUNC() to avoid warnings about + * incompatible function types. + * + * Returns: %FALSE if the source should be removed. #G_SOURCE_CONTINUE and + * #G_SOURCE_REMOVE are more memorable names for the return value. + */ +typedef gboolean (*GSourceFunc) (gpointer user_data); + +/** + * G_SOURCE_FUNC: + * @f: a function pointer. + * + * Cast a function pointer to a #GSourceFunc, suppressing warnings from GCC 8 + * onwards with `-Wextra` or `-Wcast-function-type` enabled about the function + * types being incompatible. + * + * For example, the correct type of callback for a source created by + * g_child_watch_source_new() is #GChildWatchFunc, which accepts more arguments + * than #GSourceFunc. Casting the function with `(GSourceFunc)` to call + * g_source_set_callback() will trigger a warning, even though it will be cast + * back to the correct type before it is called by the source. + * + * Since: 2.58 + */ +#define G_SOURCE_FUNC(f) ((GSourceFunc) (void (*)(void)) (f)) GLIB_AVAILABLE_MACRO_IN_2_58 + +/** + * GChildWatchFunc: + * @pid: the process id of the child process + * @status: Status information about the child process, encoded + * in a platform-specific manner + * @user_data: user data passed to g_child_watch_add() + * + * Prototype of a #GChildWatchSource callback, called when a child + * process has exited. To interpret @status, see the documentation + * for g_spawn_check_exit_status(). + */ +typedef void (*GChildWatchFunc) (GPid pid, + gint status, + gpointer user_data); + + +/** + * GSourceDisposeFunc: + * @source: #GSource that is currently being disposed + * + * Dispose function for @source. See g_source_set_dispose_function() for + * details. + * + * Since: 2.64 + */ +GLIB_AVAILABLE_TYPE_IN_2_64 +typedef void (*GSourceDisposeFunc) (GSource *source); + +struct _GSource +{ + /*< private >*/ + gpointer callback_data; + GSourceCallbackFuncs *callback_funcs; + + const GSourceFuncs *source_funcs; + guint ref_count; + + GMainContext *context; + + gint priority; + guint flags; + guint source_id; + + GSList *poll_fds; + + GSource *prev; + GSource *next; + + char *name; + + GSourcePrivate *priv; +}; + +struct _GSourceCallbackFuncs +{ + void (*ref) (gpointer cb_data); + void (*unref) (gpointer cb_data); + void (*get) (gpointer cb_data, + GSource *source, + GSourceFunc *func, + gpointer *data); +}; + +/** + * GSourceDummyMarshal: + * + * This is just a placeholder for #GClosureMarshal, + * which cannot be used here for dependency reasons. + */ +typedef void (*GSourceDummyMarshal) (void); + +struct _GSourceFuncs +{ + gboolean (*prepare) (GSource *source, + gint *timeout_); + gboolean (*check) (GSource *source); + gboolean (*dispatch) (GSource *source, + GSourceFunc callback, + gpointer user_data); + void (*finalize) (GSource *source); /* Can be NULL */ + + /*< private >*/ + /* For use by g_source_set_closure */ + GSourceFunc closure_callback; + GSourceDummyMarshal closure_marshal; /* Really is of type GClosureMarshal */ +}; + +/* Standard priorities */ + +/** + * G_PRIORITY_HIGH: + * + * Use this for high priority event sources. + * + * It is not used within GLib or GTK+. + */ +#define G_PRIORITY_HIGH -100 + +/** + * G_PRIORITY_DEFAULT: + * + * Use this for default priority event sources. + * + * In GLib this priority is used when adding timeout functions + * with g_timeout_add(). In GDK this priority is used for events + * from the X server. + */ +#define G_PRIORITY_DEFAULT 0 + +/** + * G_PRIORITY_HIGH_IDLE: + * + * Use this for high priority idle functions. + * + * GTK+ uses #G_PRIORITY_HIGH_IDLE + 10 for resizing operations, + * and #G_PRIORITY_HIGH_IDLE + 20 for redrawing operations. (This is + * done to ensure that any pending resizes are processed before any + * pending redraws, so that widgets are not redrawn twice unnecessarily.) + */ +#define G_PRIORITY_HIGH_IDLE 100 + +/** + * G_PRIORITY_DEFAULT_IDLE: + * + * Use this for default priority idle functions. + * + * In GLib this priority is used when adding idle functions with + * g_idle_add(). + */ +#define G_PRIORITY_DEFAULT_IDLE 200 + +/** + * G_PRIORITY_LOW: + * + * Use this for very low priority background tasks. + * + * It is not used within GLib or GTK+. + */ +#define G_PRIORITY_LOW 300 + +/** + * G_SOURCE_REMOVE: + * + * Use this macro as the return value of a #GSourceFunc to remove + * the #GSource from the main loop. + * + * Since: 2.32 + */ +#define G_SOURCE_REMOVE FALSE + +/** + * G_SOURCE_CONTINUE: + * + * Use this macro as the return value of a #GSourceFunc to leave + * the #GSource in the main loop. + * + * Since: 2.32 + */ +#define G_SOURCE_CONTINUE TRUE + +/* GMainContext: */ + +GLIB_AVAILABLE_IN_ALL +GMainContext *g_main_context_new (void); +GLIB_AVAILABLE_IN_ALL +GMainContext *g_main_context_ref (GMainContext *context); +GLIB_AVAILABLE_IN_ALL +void g_main_context_unref (GMainContext *context); +GLIB_AVAILABLE_IN_ALL +GMainContext *g_main_context_default (void); + +GLIB_AVAILABLE_IN_ALL +gboolean g_main_context_iteration (GMainContext *context, + gboolean may_block); +GLIB_AVAILABLE_IN_ALL +gboolean g_main_context_pending (GMainContext *context); + +/* For implementation of legacy interfaces + */ +GLIB_AVAILABLE_IN_ALL +GSource *g_main_context_find_source_by_id (GMainContext *context, + guint source_id); +GLIB_AVAILABLE_IN_ALL +GSource *g_main_context_find_source_by_user_data (GMainContext *context, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +GSource *g_main_context_find_source_by_funcs_user_data (GMainContext *context, + GSourceFuncs *funcs, + gpointer user_data); + +/* Low level functions for implementing custom main loops. + */ +GLIB_AVAILABLE_IN_ALL +void g_main_context_wakeup (GMainContext *context); +GLIB_AVAILABLE_IN_ALL +gboolean g_main_context_acquire (GMainContext *context); +GLIB_AVAILABLE_IN_ALL +void g_main_context_release (GMainContext *context); +GLIB_AVAILABLE_IN_ALL +gboolean g_main_context_is_owner (GMainContext *context); +GLIB_DEPRECATED_IN_2_58_FOR(g_main_context_is_owner) +gboolean g_main_context_wait (GMainContext *context, + GCond *cond, + GMutex *mutex); + +GLIB_AVAILABLE_IN_ALL +gboolean g_main_context_prepare (GMainContext *context, + gint *priority); +GLIB_AVAILABLE_IN_ALL +gint g_main_context_query (GMainContext *context, + gint max_priority, + gint *timeout_, + GPollFD *fds, + gint n_fds); +GLIB_AVAILABLE_IN_ALL +gboolean g_main_context_check (GMainContext *context, + gint max_priority, + GPollFD *fds, + gint n_fds); +GLIB_AVAILABLE_IN_ALL +void g_main_context_dispatch (GMainContext *context); + +GLIB_AVAILABLE_IN_ALL +void g_main_context_set_poll_func (GMainContext *context, + GPollFunc func); +GLIB_AVAILABLE_IN_ALL +GPollFunc g_main_context_get_poll_func (GMainContext *context); + +/* Low level functions for use by source implementations + */ +GLIB_AVAILABLE_IN_ALL +void g_main_context_add_poll (GMainContext *context, + GPollFD *fd, + gint priority); +GLIB_AVAILABLE_IN_ALL +void g_main_context_remove_poll (GMainContext *context, + GPollFD *fd); + +GLIB_AVAILABLE_IN_ALL +gint g_main_depth (void); +GLIB_AVAILABLE_IN_ALL +GSource *g_main_current_source (void); + +/* GMainContexts for other threads + */ +GLIB_AVAILABLE_IN_ALL +void g_main_context_push_thread_default (GMainContext *context); +GLIB_AVAILABLE_IN_ALL +void g_main_context_pop_thread_default (GMainContext *context); +GLIB_AVAILABLE_IN_ALL +GMainContext *g_main_context_get_thread_default (void); +GLIB_AVAILABLE_IN_ALL +GMainContext *g_main_context_ref_thread_default (void); + +/** + * GMainContextPusher: + * + * Opaque type. See g_main_context_pusher_new() for details. + * + * Since: 2.64 + */ +typedef void GMainContextPusher GLIB_AVAILABLE_TYPE_IN_2_64; + +/** + * g_main_context_pusher_new: + * @main_context: (transfer none): a main context to push + * + * Push @main_context as the new thread-default main context for the current + * thread, using g_main_context_push_thread_default(), and return a new + * #GMainContextPusher. Pop with g_main_context_pusher_free(). Using + * g_main_context_pop_thread_default() on @main_context while a + * #GMainContextPusher exists for it can lead to undefined behaviour. + * + * Using two #GMainContextPushers in the same scope is not allowed, as it leads + * to an undefined pop order. + * + * This is intended to be used with g_autoptr(). Note that g_autoptr() + * is only available when using GCC or clang, so the following example + * will only work with those compilers: + * |[ + * typedef struct + * { + * ... + * GMainContext *context; + * ... + * } MyObject; + * + * static void + * my_object_do_stuff (MyObject *self) + * { + * g_autoptr(GMainContextPusher) pusher = g_main_context_pusher_new (self->context); + * + * // Code with main context as the thread default here + * + * if (cond) + * // No need to pop + * return; + * + * // Optionally early pop + * g_clear_pointer (&pusher, g_main_context_pusher_free); + * + * // Code with main context no longer the thread default here + * } + * ]| + * + * Returns: (transfer full): a #GMainContextPusher + * Since: 2.64 + */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 +static inline GMainContextPusher * +g_main_context_pusher_new (GMainContext *main_context) +{ + g_main_context_push_thread_default (main_context); + return (GMainContextPusher *) main_context; +} +G_GNUC_END_IGNORE_DEPRECATIONS + +/** + * g_main_context_pusher_free: + * @pusher: (transfer full): a #GMainContextPusher + * + * Pop @pusher’s main context as the thread default main context. + * See g_main_context_pusher_new() for details. + * + * This will pop the #GMainContext as the current thread-default main context, + * but will not call g_main_context_unref() on it. + * + * Since: 2.64 + */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 +static inline void +g_main_context_pusher_free (GMainContextPusher *pusher) +{ + g_main_context_pop_thread_default ((GMainContext *) pusher); +} +G_GNUC_END_IGNORE_DEPRECATIONS + +/* GMainLoop: */ + +GLIB_AVAILABLE_IN_ALL +GMainLoop *g_main_loop_new (GMainContext *context, + gboolean is_running); +GLIB_AVAILABLE_IN_ALL +void g_main_loop_run (GMainLoop *loop); +GLIB_AVAILABLE_IN_ALL +void g_main_loop_quit (GMainLoop *loop); +GLIB_AVAILABLE_IN_ALL +GMainLoop *g_main_loop_ref (GMainLoop *loop); +GLIB_AVAILABLE_IN_ALL +void g_main_loop_unref (GMainLoop *loop); +GLIB_AVAILABLE_IN_ALL +gboolean g_main_loop_is_running (GMainLoop *loop); +GLIB_AVAILABLE_IN_ALL +GMainContext *g_main_loop_get_context (GMainLoop *loop); + +/* GSource: */ + +GLIB_AVAILABLE_IN_ALL +GSource *g_source_new (GSourceFuncs *source_funcs, + guint struct_size); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_AVAILABLE_IN_2_64 +void g_source_set_dispose_function (GSource *source, + GSourceDisposeFunc dispose); +G_GNUC_END_IGNORE_DEPRECATIONS + +GLIB_AVAILABLE_IN_ALL +GSource *g_source_ref (GSource *source); +GLIB_AVAILABLE_IN_ALL +void g_source_unref (GSource *source); + +GLIB_AVAILABLE_IN_ALL +guint g_source_attach (GSource *source, + GMainContext *context); +GLIB_AVAILABLE_IN_ALL +void g_source_destroy (GSource *source); + +GLIB_AVAILABLE_IN_ALL +void g_source_set_priority (GSource *source, + gint priority); +GLIB_AVAILABLE_IN_ALL +gint g_source_get_priority (GSource *source); +GLIB_AVAILABLE_IN_ALL +void g_source_set_can_recurse (GSource *source, + gboolean can_recurse); +GLIB_AVAILABLE_IN_ALL +gboolean g_source_get_can_recurse (GSource *source); +GLIB_AVAILABLE_IN_ALL +guint g_source_get_id (GSource *source); + +GLIB_AVAILABLE_IN_ALL +GMainContext *g_source_get_context (GSource *source); + +GLIB_AVAILABLE_IN_ALL +void g_source_set_callback (GSource *source, + GSourceFunc func, + gpointer data, + GDestroyNotify notify); + +GLIB_AVAILABLE_IN_ALL +void g_source_set_funcs (GSource *source, + GSourceFuncs *funcs); +GLIB_AVAILABLE_IN_ALL +gboolean g_source_is_destroyed (GSource *source); + +GLIB_AVAILABLE_IN_ALL +void g_source_set_name (GSource *source, + const char *name); +GLIB_AVAILABLE_IN_ALL +const char * g_source_get_name (GSource *source); +GLIB_AVAILABLE_IN_ALL +void g_source_set_name_by_id (guint tag, + const char *name); + +GLIB_AVAILABLE_IN_2_36 +void g_source_set_ready_time (GSource *source, + gint64 ready_time); +GLIB_AVAILABLE_IN_2_36 +gint64 g_source_get_ready_time (GSource *source); + +#ifdef G_OS_UNIX +GLIB_AVAILABLE_IN_2_36 +gpointer g_source_add_unix_fd (GSource *source, + gint fd, + GIOCondition events); +GLIB_AVAILABLE_IN_2_36 +void g_source_modify_unix_fd (GSource *source, + gpointer tag, + GIOCondition new_events); +GLIB_AVAILABLE_IN_2_36 +void g_source_remove_unix_fd (GSource *source, + gpointer tag); +GLIB_AVAILABLE_IN_2_36 +GIOCondition g_source_query_unix_fd (GSource *source, + gpointer tag); +#endif + +/* Used to implement g_source_connect_closure and internally*/ +GLIB_AVAILABLE_IN_ALL +void g_source_set_callback_indirect (GSource *source, + gpointer callback_data, + GSourceCallbackFuncs *callback_funcs); + +GLIB_AVAILABLE_IN_ALL +void g_source_add_poll (GSource *source, + GPollFD *fd); +GLIB_AVAILABLE_IN_ALL +void g_source_remove_poll (GSource *source, + GPollFD *fd); + +GLIB_AVAILABLE_IN_ALL +void g_source_add_child_source (GSource *source, + GSource *child_source); +GLIB_AVAILABLE_IN_ALL +void g_source_remove_child_source (GSource *source, + GSource *child_source); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_DEPRECATED_IN_2_28_FOR(g_source_get_time) +void g_source_get_current_time (GSource *source, + GTimeVal *timeval); +G_GNUC_END_IGNORE_DEPRECATIONS + +GLIB_AVAILABLE_IN_ALL +gint64 g_source_get_time (GSource *source); + + /* void g_source_connect_closure (GSource *source, + GClosure *closure); + */ + +/* Specific source types + */ +GLIB_AVAILABLE_IN_ALL +GSource *g_idle_source_new (void); +GLIB_AVAILABLE_IN_ALL +GSource *g_child_watch_source_new (GPid pid); +GLIB_AVAILABLE_IN_ALL +GSource *g_timeout_source_new (guint interval); +GLIB_AVAILABLE_IN_ALL +GSource *g_timeout_source_new_seconds (guint interval); + +/* Miscellaneous functions + */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_DEPRECATED_IN_2_62_FOR(g_get_real_time) +void g_get_current_time (GTimeVal *result); +G_GNUC_END_IGNORE_DEPRECATIONS + +GLIB_AVAILABLE_IN_ALL +gint64 g_get_monotonic_time (void); +GLIB_AVAILABLE_IN_ALL +gint64 g_get_real_time (void); + + +/* Source manipulation by ID */ +GLIB_AVAILABLE_IN_ALL +gboolean g_source_remove (guint tag); +GLIB_AVAILABLE_IN_ALL +gboolean g_source_remove_by_user_data (gpointer user_data); +GLIB_AVAILABLE_IN_ALL +gboolean g_source_remove_by_funcs_user_data (GSourceFuncs *funcs, + gpointer user_data); + +/** + * GClearHandleFunc: + * @handle_id: the handle ID to clear + * + * Specifies the type of function passed to g_clear_handle_id(). + * The implementation is expected to free the resource identified + * by @handle_id; for instance, if @handle_id is a #GSource ID, + * g_source_remove() can be used. + * + * Since: 2.56 + */ +typedef void (* GClearHandleFunc) (guint handle_id); + +GLIB_AVAILABLE_IN_2_56 +void g_clear_handle_id (guint *tag_ptr, + GClearHandleFunc clear_func); + +#undef g_clear_handle_id +#define g_clear_handle_id(tag_ptr, clear_func) \ + G_STMT_START { \ + G_STATIC_ASSERT (sizeof *(tag_ptr) == sizeof (guint)); \ + guint *_tag_ptr = (guint *) (tag_ptr); \ + guint _handle_id; \ + \ + _handle_id = *_tag_ptr; \ + if (_handle_id > 0) \ + { \ + *_tag_ptr = 0; \ + clear_func (_handle_id); \ + } \ + } G_STMT_END \ + GLIB_AVAILABLE_MACRO_IN_2_56 + +/* Idles, child watchers and timeouts */ +GLIB_AVAILABLE_IN_ALL +guint g_timeout_add_full (gint priority, + guint interval, + GSourceFunc function, + gpointer data, + GDestroyNotify notify); +GLIB_AVAILABLE_IN_ALL +guint g_timeout_add (guint interval, + GSourceFunc function, + gpointer data); +GLIB_AVAILABLE_IN_ALL +guint g_timeout_add_seconds_full (gint priority, + guint interval, + GSourceFunc function, + gpointer data, + GDestroyNotify notify); +GLIB_AVAILABLE_IN_ALL +guint g_timeout_add_seconds (guint interval, + GSourceFunc function, + gpointer data); +GLIB_AVAILABLE_IN_ALL +guint g_child_watch_add_full (gint priority, + GPid pid, + GChildWatchFunc function, + gpointer data, + GDestroyNotify notify); +GLIB_AVAILABLE_IN_ALL +guint g_child_watch_add (GPid pid, + GChildWatchFunc function, + gpointer data); +GLIB_AVAILABLE_IN_ALL +guint g_idle_add (GSourceFunc function, + gpointer data); +GLIB_AVAILABLE_IN_ALL +guint g_idle_add_full (gint priority, + GSourceFunc function, + gpointer data, + GDestroyNotify notify); +GLIB_AVAILABLE_IN_ALL +gboolean g_idle_remove_by_data (gpointer data); + +GLIB_AVAILABLE_IN_ALL +void g_main_context_invoke_full (GMainContext *context, + gint priority, + GSourceFunc function, + gpointer data, + GDestroyNotify notify); +GLIB_AVAILABLE_IN_ALL +void g_main_context_invoke (GMainContext *context, + GSourceFunc function, + gpointer data); + +/* Hook for GClosure / GSource integration. Don't touch */ +GLIB_VAR GSourceFuncs g_timeout_funcs; +GLIB_VAR GSourceFuncs g_child_watch_funcs; +GLIB_VAR GSourceFuncs g_idle_funcs; +#ifdef G_OS_UNIX +GLIB_VAR GSourceFuncs g_unix_signal_funcs; +GLIB_VAR GSourceFuncs g_unix_fd_source_funcs; +#endif + +G_END_DECLS + +#endif /* __G_MAIN_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_STRING_H__ +#define __G_STRING_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +/* gunicode.h - Unicode manipulation functions + * + * Copyright (C) 1999, 2000 Tom Tromey + * Copyright 2000, 2005 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_UNICODE_H__ +#define __G_UNICODE_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * gunichar: + * + * A type which can hold any UTF-32 or UCS-4 character code, + * also known as a Unicode code point. + * + * If you want to produce the UTF-8 representation of a #gunichar, + * use g_ucs4_to_utf8(). See also g_utf8_to_ucs4() for the reverse + * process. + * + * To print/scan values of this type as integer, use + * %G_GINT32_MODIFIER and/or %G_GUINT32_FORMAT. + * + * The notation to express a Unicode code point in running text is + * as a hexadecimal number with four to six digits and uppercase + * letters, prefixed by the string "U+". Leading zeros are omitted, + * unless the code point would have fewer than four hexadecimal digits. + * For example, "U+0041 LATIN CAPITAL LETTER A". To print a code point + * in the U+-notation, use the format string "U+\%04"G_GINT32_FORMAT"X". + * To scan, use the format string "U+\%06"G_GINT32_FORMAT"X". + * + * |[ + * gunichar c; + * sscanf ("U+0041", "U+%06"G_GINT32_FORMAT"X", &c) + * g_print ("Read U+%04"G_GINT32_FORMAT"X", c); + * ]| + */ +typedef guint32 gunichar; + +/** + * gunichar2: + * + * A type which can hold any UTF-16 code + * pointUTF-16 also has so called + * surrogate pairs to encode characters beyond + * the BMP as pairs of 16bit numbers. Surrogate pairs cannot be stored + * in a single gunichar2 field, but all GLib functions accepting gunichar2 + * arrays will correctly interpret surrogate pairs.. + * + * To print/scan values of this type to/from text you need to convert + * to/from UTF-8, using g_utf16_to_utf8()/g_utf8_to_utf16(). + * + * To print/scan values of this type as integer, use + * %G_GINT16_MODIFIER and/or %G_GUINT16_FORMAT. + */ +typedef guint16 gunichar2; + +/** + * GUnicodeType: + * @G_UNICODE_CONTROL: General category "Other, Control" (Cc) + * @G_UNICODE_FORMAT: General category "Other, Format" (Cf) + * @G_UNICODE_UNASSIGNED: General category "Other, Not Assigned" (Cn) + * @G_UNICODE_PRIVATE_USE: General category "Other, Private Use" (Co) + * @G_UNICODE_SURROGATE: General category "Other, Surrogate" (Cs) + * @G_UNICODE_LOWERCASE_LETTER: General category "Letter, Lowercase" (Ll) + * @G_UNICODE_MODIFIER_LETTER: General category "Letter, Modifier" (Lm) + * @G_UNICODE_OTHER_LETTER: General category "Letter, Other" (Lo) + * @G_UNICODE_TITLECASE_LETTER: General category "Letter, Titlecase" (Lt) + * @G_UNICODE_UPPERCASE_LETTER: General category "Letter, Uppercase" (Lu) + * @G_UNICODE_SPACING_MARK: General category "Mark, Spacing" (Mc) + * @G_UNICODE_ENCLOSING_MARK: General category "Mark, Enclosing" (Me) + * @G_UNICODE_NON_SPACING_MARK: General category "Mark, Nonspacing" (Mn) + * @G_UNICODE_DECIMAL_NUMBER: General category "Number, Decimal Digit" (Nd) + * @G_UNICODE_LETTER_NUMBER: General category "Number, Letter" (Nl) + * @G_UNICODE_OTHER_NUMBER: General category "Number, Other" (No) + * @G_UNICODE_CONNECT_PUNCTUATION: General category "Punctuation, Connector" (Pc) + * @G_UNICODE_DASH_PUNCTUATION: General category "Punctuation, Dash" (Pd) + * @G_UNICODE_CLOSE_PUNCTUATION: General category "Punctuation, Close" (Pe) + * @G_UNICODE_FINAL_PUNCTUATION: General category "Punctuation, Final quote" (Pf) + * @G_UNICODE_INITIAL_PUNCTUATION: General category "Punctuation, Initial quote" (Pi) + * @G_UNICODE_OTHER_PUNCTUATION: General category "Punctuation, Other" (Po) + * @G_UNICODE_OPEN_PUNCTUATION: General category "Punctuation, Open" (Ps) + * @G_UNICODE_CURRENCY_SYMBOL: General category "Symbol, Currency" (Sc) + * @G_UNICODE_MODIFIER_SYMBOL: General category "Symbol, Modifier" (Sk) + * @G_UNICODE_MATH_SYMBOL: General category "Symbol, Math" (Sm) + * @G_UNICODE_OTHER_SYMBOL: General category "Symbol, Other" (So) + * @G_UNICODE_LINE_SEPARATOR: General category "Separator, Line" (Zl) + * @G_UNICODE_PARAGRAPH_SEPARATOR: General category "Separator, Paragraph" (Zp) + * @G_UNICODE_SPACE_SEPARATOR: General category "Separator, Space" (Zs) + * + * These are the possible character classifications from the + * Unicode specification. + * See [Unicode Character Database](http://www.unicode.org/reports/tr44/#General_Category_Values). + */ +typedef enum +{ + G_UNICODE_CONTROL, + G_UNICODE_FORMAT, + G_UNICODE_UNASSIGNED, + G_UNICODE_PRIVATE_USE, + G_UNICODE_SURROGATE, + G_UNICODE_LOWERCASE_LETTER, + G_UNICODE_MODIFIER_LETTER, + G_UNICODE_OTHER_LETTER, + G_UNICODE_TITLECASE_LETTER, + G_UNICODE_UPPERCASE_LETTER, + G_UNICODE_SPACING_MARK, + G_UNICODE_ENCLOSING_MARK, + G_UNICODE_NON_SPACING_MARK, + G_UNICODE_DECIMAL_NUMBER, + G_UNICODE_LETTER_NUMBER, + G_UNICODE_OTHER_NUMBER, + G_UNICODE_CONNECT_PUNCTUATION, + G_UNICODE_DASH_PUNCTUATION, + G_UNICODE_CLOSE_PUNCTUATION, + G_UNICODE_FINAL_PUNCTUATION, + G_UNICODE_INITIAL_PUNCTUATION, + G_UNICODE_OTHER_PUNCTUATION, + G_UNICODE_OPEN_PUNCTUATION, + G_UNICODE_CURRENCY_SYMBOL, + G_UNICODE_MODIFIER_SYMBOL, + G_UNICODE_MATH_SYMBOL, + G_UNICODE_OTHER_SYMBOL, + G_UNICODE_LINE_SEPARATOR, + G_UNICODE_PARAGRAPH_SEPARATOR, + G_UNICODE_SPACE_SEPARATOR +} GUnicodeType; + +/** + * G_UNICODE_COMBINING_MARK: + * + * Older name for %G_UNICODE_SPACING_MARK. + * + * Deprecated: 2.30: Use %G_UNICODE_SPACING_MARK. + */ +#define G_UNICODE_COMBINING_MARK G_UNICODE_SPACING_MARK GLIB_DEPRECATED_MACRO_IN_2_30_FOR(G_UNICODE_SPACING_MARK) + +/** + * GUnicodeBreakType: + * @G_UNICODE_BREAK_MANDATORY: Mandatory Break (BK) + * @G_UNICODE_BREAK_CARRIAGE_RETURN: Carriage Return (CR) + * @G_UNICODE_BREAK_LINE_FEED: Line Feed (LF) + * @G_UNICODE_BREAK_COMBINING_MARK: Attached Characters and Combining Marks (CM) + * @G_UNICODE_BREAK_SURROGATE: Surrogates (SG) + * @G_UNICODE_BREAK_ZERO_WIDTH_SPACE: Zero Width Space (ZW) + * @G_UNICODE_BREAK_INSEPARABLE: Inseparable (IN) + * @G_UNICODE_BREAK_NON_BREAKING_GLUE: Non-breaking ("Glue") (GL) + * @G_UNICODE_BREAK_CONTINGENT: Contingent Break Opportunity (CB) + * @G_UNICODE_BREAK_SPACE: Space (SP) + * @G_UNICODE_BREAK_AFTER: Break Opportunity After (BA) + * @G_UNICODE_BREAK_BEFORE: Break Opportunity Before (BB) + * @G_UNICODE_BREAK_BEFORE_AND_AFTER: Break Opportunity Before and After (B2) + * @G_UNICODE_BREAK_HYPHEN: Hyphen (HY) + * @G_UNICODE_BREAK_NON_STARTER: Nonstarter (NS) + * @G_UNICODE_BREAK_OPEN_PUNCTUATION: Opening Punctuation (OP) + * @G_UNICODE_BREAK_CLOSE_PUNCTUATION: Closing Punctuation (CL) + * @G_UNICODE_BREAK_QUOTATION: Ambiguous Quotation (QU) + * @G_UNICODE_BREAK_EXCLAMATION: Exclamation/Interrogation (EX) + * @G_UNICODE_BREAK_IDEOGRAPHIC: Ideographic (ID) + * @G_UNICODE_BREAK_NUMERIC: Numeric (NU) + * @G_UNICODE_BREAK_INFIX_SEPARATOR: Infix Separator (Numeric) (IS) + * @G_UNICODE_BREAK_SYMBOL: Symbols Allowing Break After (SY) + * @G_UNICODE_BREAK_ALPHABETIC: Ordinary Alphabetic and Symbol Characters (AL) + * @G_UNICODE_BREAK_PREFIX: Prefix (Numeric) (PR) + * @G_UNICODE_BREAK_POSTFIX: Postfix (Numeric) (PO) + * @G_UNICODE_BREAK_COMPLEX_CONTEXT: Complex Content Dependent (South East Asian) (SA) + * @G_UNICODE_BREAK_AMBIGUOUS: Ambiguous (Alphabetic or Ideographic) (AI) + * @G_UNICODE_BREAK_UNKNOWN: Unknown (XX) + * @G_UNICODE_BREAK_NEXT_LINE: Next Line (NL) + * @G_UNICODE_BREAK_WORD_JOINER: Word Joiner (WJ) + * @G_UNICODE_BREAK_HANGUL_L_JAMO: Hangul L Jamo (JL) + * @G_UNICODE_BREAK_HANGUL_V_JAMO: Hangul V Jamo (JV) + * @G_UNICODE_BREAK_HANGUL_T_JAMO: Hangul T Jamo (JT) + * @G_UNICODE_BREAK_HANGUL_LV_SYLLABLE: Hangul LV Syllable (H2) + * @G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE: Hangul LVT Syllable (H3) + * @G_UNICODE_BREAK_CLOSE_PARANTHESIS: Closing Parenthesis (CP). Since 2.28 + * @G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER: Conditional Japanese Starter (CJ). Since: 2.32 + * @G_UNICODE_BREAK_HEBREW_LETTER: Hebrew Letter (HL). Since: 2.32 + * @G_UNICODE_BREAK_REGIONAL_INDICATOR: Regional Indicator (RI). Since: 2.36 + * @G_UNICODE_BREAK_EMOJI_BASE: Emoji Base (EB). Since: 2.50 + * @G_UNICODE_BREAK_EMOJI_MODIFIER: Emoji Modifier (EM). Since: 2.50 + * @G_UNICODE_BREAK_ZERO_WIDTH_JOINER: Zero Width Joiner (ZWJ). Since: 2.50 + * + * These are the possible line break classifications. + * + * Since new unicode versions may add new types here, applications should be ready + * to handle unknown values. They may be regarded as %G_UNICODE_BREAK_UNKNOWN. + * + * See [Unicode Line Breaking Algorithm](http://www.unicode.org/unicode/reports/tr14/). + */ +typedef enum +{ + G_UNICODE_BREAK_MANDATORY, + G_UNICODE_BREAK_CARRIAGE_RETURN, + G_UNICODE_BREAK_LINE_FEED, + G_UNICODE_BREAK_COMBINING_MARK, + G_UNICODE_BREAK_SURROGATE, + G_UNICODE_BREAK_ZERO_WIDTH_SPACE, + G_UNICODE_BREAK_INSEPARABLE, + G_UNICODE_BREAK_NON_BREAKING_GLUE, + G_UNICODE_BREAK_CONTINGENT, + G_UNICODE_BREAK_SPACE, + G_UNICODE_BREAK_AFTER, + G_UNICODE_BREAK_BEFORE, + G_UNICODE_BREAK_BEFORE_AND_AFTER, + G_UNICODE_BREAK_HYPHEN, + G_UNICODE_BREAK_NON_STARTER, + G_UNICODE_BREAK_OPEN_PUNCTUATION, + G_UNICODE_BREAK_CLOSE_PUNCTUATION, + G_UNICODE_BREAK_QUOTATION, + G_UNICODE_BREAK_EXCLAMATION, + G_UNICODE_BREAK_IDEOGRAPHIC, + G_UNICODE_BREAK_NUMERIC, + G_UNICODE_BREAK_INFIX_SEPARATOR, + G_UNICODE_BREAK_SYMBOL, + G_UNICODE_BREAK_ALPHABETIC, + G_UNICODE_BREAK_PREFIX, + G_UNICODE_BREAK_POSTFIX, + G_UNICODE_BREAK_COMPLEX_CONTEXT, + G_UNICODE_BREAK_AMBIGUOUS, + G_UNICODE_BREAK_UNKNOWN, + G_UNICODE_BREAK_NEXT_LINE, + G_UNICODE_BREAK_WORD_JOINER, + G_UNICODE_BREAK_HANGUL_L_JAMO, + G_UNICODE_BREAK_HANGUL_V_JAMO, + G_UNICODE_BREAK_HANGUL_T_JAMO, + G_UNICODE_BREAK_HANGUL_LV_SYLLABLE, + G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE, + G_UNICODE_BREAK_CLOSE_PARANTHESIS, + G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER, + G_UNICODE_BREAK_HEBREW_LETTER, + G_UNICODE_BREAK_REGIONAL_INDICATOR, + G_UNICODE_BREAK_EMOJI_BASE, + G_UNICODE_BREAK_EMOJI_MODIFIER, + G_UNICODE_BREAK_ZERO_WIDTH_JOINER +} GUnicodeBreakType; + +/** + * GUnicodeScript: + * @G_UNICODE_SCRIPT_INVALID_CODE: + * a value never returned from g_unichar_get_script() + * @G_UNICODE_SCRIPT_COMMON: a character used by multiple different scripts + * @G_UNICODE_SCRIPT_INHERITED: a mark glyph that takes its script from the + * base glyph to which it is attached + * @G_UNICODE_SCRIPT_ARABIC: Arabic + * @G_UNICODE_SCRIPT_ARMENIAN: Armenian + * @G_UNICODE_SCRIPT_BENGALI: Bengali + * @G_UNICODE_SCRIPT_BOPOMOFO: Bopomofo + * @G_UNICODE_SCRIPT_CHEROKEE: Cherokee + * @G_UNICODE_SCRIPT_COPTIC: Coptic + * @G_UNICODE_SCRIPT_CYRILLIC: Cyrillic + * @G_UNICODE_SCRIPT_DESERET: Deseret + * @G_UNICODE_SCRIPT_DEVANAGARI: Devanagari + * @G_UNICODE_SCRIPT_ETHIOPIC: Ethiopic + * @G_UNICODE_SCRIPT_GEORGIAN: Georgian + * @G_UNICODE_SCRIPT_GOTHIC: Gothic + * @G_UNICODE_SCRIPT_GREEK: Greek + * @G_UNICODE_SCRIPT_GUJARATI: Gujarati + * @G_UNICODE_SCRIPT_GURMUKHI: Gurmukhi + * @G_UNICODE_SCRIPT_HAN: Han + * @G_UNICODE_SCRIPT_HANGUL: Hangul + * @G_UNICODE_SCRIPT_HEBREW: Hebrew + * @G_UNICODE_SCRIPT_HIRAGANA: Hiragana + * @G_UNICODE_SCRIPT_KANNADA: Kannada + * @G_UNICODE_SCRIPT_KATAKANA: Katakana + * @G_UNICODE_SCRIPT_KHMER: Khmer + * @G_UNICODE_SCRIPT_LAO: Lao + * @G_UNICODE_SCRIPT_LATIN: Latin + * @G_UNICODE_SCRIPT_MALAYALAM: Malayalam + * @G_UNICODE_SCRIPT_MONGOLIAN: Mongolian + * @G_UNICODE_SCRIPT_MYANMAR: Myanmar + * @G_UNICODE_SCRIPT_OGHAM: Ogham + * @G_UNICODE_SCRIPT_OLD_ITALIC: Old Italic + * @G_UNICODE_SCRIPT_ORIYA: Oriya + * @G_UNICODE_SCRIPT_RUNIC: Runic + * @G_UNICODE_SCRIPT_SINHALA: Sinhala + * @G_UNICODE_SCRIPT_SYRIAC: Syriac + * @G_UNICODE_SCRIPT_TAMIL: Tamil + * @G_UNICODE_SCRIPT_TELUGU: Telugu + * @G_UNICODE_SCRIPT_THAANA: Thaana + * @G_UNICODE_SCRIPT_THAI: Thai + * @G_UNICODE_SCRIPT_TIBETAN: Tibetan + * @G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL: + * Canadian Aboriginal + * @G_UNICODE_SCRIPT_YI: Yi + * @G_UNICODE_SCRIPT_TAGALOG: Tagalog + * @G_UNICODE_SCRIPT_HANUNOO: Hanunoo + * @G_UNICODE_SCRIPT_BUHID: Buhid + * @G_UNICODE_SCRIPT_TAGBANWA: Tagbanwa + * @G_UNICODE_SCRIPT_BRAILLE: Braille + * @G_UNICODE_SCRIPT_CYPRIOT: Cypriot + * @G_UNICODE_SCRIPT_LIMBU: Limbu + * @G_UNICODE_SCRIPT_OSMANYA: Osmanya + * @G_UNICODE_SCRIPT_SHAVIAN: Shavian + * @G_UNICODE_SCRIPT_LINEAR_B: Linear B + * @G_UNICODE_SCRIPT_TAI_LE: Tai Le + * @G_UNICODE_SCRIPT_UGARITIC: Ugaritic + * @G_UNICODE_SCRIPT_NEW_TAI_LUE: + * New Tai Lue + * @G_UNICODE_SCRIPT_BUGINESE: Buginese + * @G_UNICODE_SCRIPT_GLAGOLITIC: Glagolitic + * @G_UNICODE_SCRIPT_TIFINAGH: Tifinagh + * @G_UNICODE_SCRIPT_SYLOTI_NAGRI: + * Syloti Nagri + * @G_UNICODE_SCRIPT_OLD_PERSIAN: + * Old Persian + * @G_UNICODE_SCRIPT_KHAROSHTHI: Kharoshthi + * @G_UNICODE_SCRIPT_UNKNOWN: an unassigned code point + * @G_UNICODE_SCRIPT_BALINESE: Balinese + * @G_UNICODE_SCRIPT_CUNEIFORM: Cuneiform + * @G_UNICODE_SCRIPT_PHOENICIAN: Phoenician + * @G_UNICODE_SCRIPT_PHAGS_PA: Phags-pa + * @G_UNICODE_SCRIPT_NKO: N'Ko + * @G_UNICODE_SCRIPT_KAYAH_LI: Kayah Li. Since 2.16.3 + * @G_UNICODE_SCRIPT_LEPCHA: Lepcha. Since 2.16.3 + * @G_UNICODE_SCRIPT_REJANG: Rejang. Since 2.16.3 + * @G_UNICODE_SCRIPT_SUNDANESE: Sundanese. Since 2.16.3 + * @G_UNICODE_SCRIPT_SAURASHTRA: Saurashtra. Since 2.16.3 + * @G_UNICODE_SCRIPT_CHAM: Cham. Since 2.16.3 + * @G_UNICODE_SCRIPT_OL_CHIKI: Ol Chiki. Since 2.16.3 + * @G_UNICODE_SCRIPT_VAI: Vai. Since 2.16.3 + * @G_UNICODE_SCRIPT_CARIAN: Carian. Since 2.16.3 + * @G_UNICODE_SCRIPT_LYCIAN: Lycian. Since 2.16.3 + * @G_UNICODE_SCRIPT_LYDIAN: Lydian. Since 2.16.3 + * @G_UNICODE_SCRIPT_AVESTAN: Avestan. Since 2.26 + * @G_UNICODE_SCRIPT_BAMUM: Bamum. Since 2.26 + * @G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS: + * Egyptian Hieroglpyhs. Since 2.26 + * @G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC: + * Imperial Aramaic. Since 2.26 + * @G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI: + * Inscriptional Pahlavi. Since 2.26 + * @G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN: + * Inscriptional Parthian. Since 2.26 + * @G_UNICODE_SCRIPT_JAVANESE: Javanese. Since 2.26 + * @G_UNICODE_SCRIPT_KAITHI: Kaithi. Since 2.26 + * @G_UNICODE_SCRIPT_LISU: Lisu. Since 2.26 + * @G_UNICODE_SCRIPT_MEETEI_MAYEK: + * Meetei Mayek. Since 2.26 + * @G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN: + * Old South Arabian. Since 2.26 + * @G_UNICODE_SCRIPT_OLD_TURKIC: Old Turkic. Since 2.28 + * @G_UNICODE_SCRIPT_SAMARITAN: Samaritan. Since 2.26 + * @G_UNICODE_SCRIPT_TAI_THAM: Tai Tham. Since 2.26 + * @G_UNICODE_SCRIPT_TAI_VIET: Tai Viet. Since 2.26 + * @G_UNICODE_SCRIPT_BATAK: Batak. Since 2.28 + * @G_UNICODE_SCRIPT_BRAHMI: Brahmi. Since 2.28 + * @G_UNICODE_SCRIPT_MANDAIC: Mandaic. Since 2.28 + * @G_UNICODE_SCRIPT_CHAKMA: Chakma. Since: 2.32 + * @G_UNICODE_SCRIPT_MEROITIC_CURSIVE: Meroitic Cursive. Since: 2.32 + * @G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS: Meroitic Hieroglyphs. Since: 2.32 + * @G_UNICODE_SCRIPT_MIAO: Miao. Since: 2.32 + * @G_UNICODE_SCRIPT_SHARADA: Sharada. Since: 2.32 + * @G_UNICODE_SCRIPT_SORA_SOMPENG: Sora Sompeng. Since: 2.32 + * @G_UNICODE_SCRIPT_TAKRI: Takri. Since: 2.32 + * @G_UNICODE_SCRIPT_BASSA_VAH: Bassa. Since: 2.42 + * @G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN: Caucasian Albanian. Since: 2.42 + * @G_UNICODE_SCRIPT_DUPLOYAN: Duployan. Since: 2.42 + * @G_UNICODE_SCRIPT_ELBASAN: Elbasan. Since: 2.42 + * @G_UNICODE_SCRIPT_GRANTHA: Grantha. Since: 2.42 + * @G_UNICODE_SCRIPT_KHOJKI: Kjohki. Since: 2.42 + * @G_UNICODE_SCRIPT_KHUDAWADI: Khudawadi, Sindhi. Since: 2.42 + * @G_UNICODE_SCRIPT_LINEAR_A: Linear A. Since: 2.42 + * @G_UNICODE_SCRIPT_MAHAJANI: Mahajani. Since: 2.42 + * @G_UNICODE_SCRIPT_MANICHAEAN: Manichaean. Since: 2.42 + * @G_UNICODE_SCRIPT_MENDE_KIKAKUI: Mende Kikakui. Since: 2.42 + * @G_UNICODE_SCRIPT_MODI: Modi. Since: 2.42 + * @G_UNICODE_SCRIPT_MRO: Mro. Since: 2.42 + * @G_UNICODE_SCRIPT_NABATAEAN: Nabataean. Since: 2.42 + * @G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN: Old North Arabian. Since: 2.42 + * @G_UNICODE_SCRIPT_OLD_PERMIC: Old Permic. Since: 2.42 + * @G_UNICODE_SCRIPT_PAHAWH_HMONG: Pahawh Hmong. Since: 2.42 + * @G_UNICODE_SCRIPT_PALMYRENE: Palmyrene. Since: 2.42 + * @G_UNICODE_SCRIPT_PAU_CIN_HAU: Pau Cin Hau. Since: 2.42 + * @G_UNICODE_SCRIPT_PSALTER_PAHLAVI: Psalter Pahlavi. Since: 2.42 + * @G_UNICODE_SCRIPT_SIDDHAM: Siddham. Since: 2.42 + * @G_UNICODE_SCRIPT_TIRHUTA: Tirhuta. Since: 2.42 + * @G_UNICODE_SCRIPT_WARANG_CITI: Warang Citi. Since: 2.42 + * @G_UNICODE_SCRIPT_AHOM: Ahom. Since: 2.48 + * @G_UNICODE_SCRIPT_ANATOLIAN_HIEROGLYPHS: Anatolian Hieroglyphs. Since: 2.48 + * @G_UNICODE_SCRIPT_HATRAN: Hatran. Since: 2.48 + * @G_UNICODE_SCRIPT_MULTANI: Multani. Since: 2.48 + * @G_UNICODE_SCRIPT_OLD_HUNGARIAN: Old Hungarian. Since: 2.48 + * @G_UNICODE_SCRIPT_SIGNWRITING: Signwriting. Since: 2.48 + * @G_UNICODE_SCRIPT_ADLAM: Adlam. Since: 2.50 + * @G_UNICODE_SCRIPT_BHAIKSUKI: Bhaiksuki. Since: 2.50 + * @G_UNICODE_SCRIPT_MARCHEN: Marchen. Since: 2.50 + * @G_UNICODE_SCRIPT_NEWA: Newa. Since: 2.50 + * @G_UNICODE_SCRIPT_OSAGE: Osage. Since: 2.50 + * @G_UNICODE_SCRIPT_TANGUT: Tangut. Since: 2.50 + * @G_UNICODE_SCRIPT_MASARAM_GONDI: Masaram Gondi. Since: 2.54 + * @G_UNICODE_SCRIPT_NUSHU: Nushu. Since: 2.54 + * @G_UNICODE_SCRIPT_SOYOMBO: Soyombo. Since: 2.54 + * @G_UNICODE_SCRIPT_ZANABAZAR_SQUARE: Zanabazar Square. Since: 2.54 + * @G_UNICODE_SCRIPT_DOGRA: Dogra. Since: 2.58 + * @G_UNICODE_SCRIPT_GUNJALA_GONDI: Gunjala Gondi. Since: 2.58 + * @G_UNICODE_SCRIPT_HANIFI_ROHINGYA: Hanifi Rohingya. Since: 2.58 + * @G_UNICODE_SCRIPT_MAKASAR: Makasar. Since: 2.58 + * @G_UNICODE_SCRIPT_MEDEFAIDRIN: Medefaidrin. Since: 2.58 + * @G_UNICODE_SCRIPT_OLD_SOGDIAN: Old Sogdian. Since: 2.58 + * @G_UNICODE_SCRIPT_SOGDIAN: Sogdian. Since: 2.58 + * @G_UNICODE_SCRIPT_ELYMAIC: Elym. Since: 2.62 + * @G_UNICODE_SCRIPT_NANDINAGARI: Nand. Since: 2.62 + * @G_UNICODE_SCRIPT_NYIAKENG_PUACHUE_HMONG: Rohg. Since: 2.62 + * @G_UNICODE_SCRIPT_WANCHO: Wcho. Since: 2.62 + * @G_UNICODE_SCRIPT_CHORASMIAN: Chorasmian. Since: 2.66 + * @G_UNICODE_SCRIPT_DIVES_AKURU: Dives Akuru. Since: 2.66 + * @G_UNICODE_SCRIPT_KHITAN_SMALL_SCRIPT: Khitan small script. Since: 2.66 + * @G_UNICODE_SCRIPT_YEZIDI: Yezidi. Since: 2.66 + * + * The #GUnicodeScript enumeration identifies different writing + * systems. The values correspond to the names as defined in the + * Unicode standard. The enumeration has been added in GLib 2.14, + * and is interchangeable with #PangoScript. + * + * Note that new types may be added in the future. Applications + * should be ready to handle unknown values. + * See [Unicode Standard Annex #24: Script names](http://www.unicode.org/reports/tr24/). + */ +typedef enum +{ /* ISO 15924 code */ + G_UNICODE_SCRIPT_INVALID_CODE = -1, + G_UNICODE_SCRIPT_COMMON = 0, /* Zyyy */ + G_UNICODE_SCRIPT_INHERITED, /* Zinh (Qaai) */ + G_UNICODE_SCRIPT_ARABIC, /* Arab */ + G_UNICODE_SCRIPT_ARMENIAN, /* Armn */ + G_UNICODE_SCRIPT_BENGALI, /* Beng */ + G_UNICODE_SCRIPT_BOPOMOFO, /* Bopo */ + G_UNICODE_SCRIPT_CHEROKEE, /* Cher */ + G_UNICODE_SCRIPT_COPTIC, /* Copt (Qaac) */ + G_UNICODE_SCRIPT_CYRILLIC, /* Cyrl (Cyrs) */ + G_UNICODE_SCRIPT_DESERET, /* Dsrt */ + G_UNICODE_SCRIPT_DEVANAGARI, /* Deva */ + G_UNICODE_SCRIPT_ETHIOPIC, /* Ethi */ + G_UNICODE_SCRIPT_GEORGIAN, /* Geor (Geon, Geoa) */ + G_UNICODE_SCRIPT_GOTHIC, /* Goth */ + G_UNICODE_SCRIPT_GREEK, /* Grek */ + G_UNICODE_SCRIPT_GUJARATI, /* Gujr */ + G_UNICODE_SCRIPT_GURMUKHI, /* Guru */ + G_UNICODE_SCRIPT_HAN, /* Hani */ + G_UNICODE_SCRIPT_HANGUL, /* Hang */ + G_UNICODE_SCRIPT_HEBREW, /* Hebr */ + G_UNICODE_SCRIPT_HIRAGANA, /* Hira */ + G_UNICODE_SCRIPT_KANNADA, /* Knda */ + G_UNICODE_SCRIPT_KATAKANA, /* Kana */ + G_UNICODE_SCRIPT_KHMER, /* Khmr */ + G_UNICODE_SCRIPT_LAO, /* Laoo */ + G_UNICODE_SCRIPT_LATIN, /* Latn (Latf, Latg) */ + G_UNICODE_SCRIPT_MALAYALAM, /* Mlym */ + G_UNICODE_SCRIPT_MONGOLIAN, /* Mong */ + G_UNICODE_SCRIPT_MYANMAR, /* Mymr */ + G_UNICODE_SCRIPT_OGHAM, /* Ogam */ + G_UNICODE_SCRIPT_OLD_ITALIC, /* Ital */ + G_UNICODE_SCRIPT_ORIYA, /* Orya */ + G_UNICODE_SCRIPT_RUNIC, /* Runr */ + G_UNICODE_SCRIPT_SINHALA, /* Sinh */ + G_UNICODE_SCRIPT_SYRIAC, /* Syrc (Syrj, Syrn, Syre) */ + G_UNICODE_SCRIPT_TAMIL, /* Taml */ + G_UNICODE_SCRIPT_TELUGU, /* Telu */ + G_UNICODE_SCRIPT_THAANA, /* Thaa */ + G_UNICODE_SCRIPT_THAI, /* Thai */ + G_UNICODE_SCRIPT_TIBETAN, /* Tibt */ + G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL, /* Cans */ + G_UNICODE_SCRIPT_YI, /* Yiii */ + G_UNICODE_SCRIPT_TAGALOG, /* Tglg */ + G_UNICODE_SCRIPT_HANUNOO, /* Hano */ + G_UNICODE_SCRIPT_BUHID, /* Buhd */ + G_UNICODE_SCRIPT_TAGBANWA, /* Tagb */ + + /* Unicode-4.0 additions */ + G_UNICODE_SCRIPT_BRAILLE, /* Brai */ + G_UNICODE_SCRIPT_CYPRIOT, /* Cprt */ + G_UNICODE_SCRIPT_LIMBU, /* Limb */ + G_UNICODE_SCRIPT_OSMANYA, /* Osma */ + G_UNICODE_SCRIPT_SHAVIAN, /* Shaw */ + G_UNICODE_SCRIPT_LINEAR_B, /* Linb */ + G_UNICODE_SCRIPT_TAI_LE, /* Tale */ + G_UNICODE_SCRIPT_UGARITIC, /* Ugar */ + + /* Unicode-4.1 additions */ + G_UNICODE_SCRIPT_NEW_TAI_LUE, /* Talu */ + G_UNICODE_SCRIPT_BUGINESE, /* Bugi */ + G_UNICODE_SCRIPT_GLAGOLITIC, /* Glag */ + G_UNICODE_SCRIPT_TIFINAGH, /* Tfng */ + G_UNICODE_SCRIPT_SYLOTI_NAGRI, /* Sylo */ + G_UNICODE_SCRIPT_OLD_PERSIAN, /* Xpeo */ + G_UNICODE_SCRIPT_KHAROSHTHI, /* Khar */ + + /* Unicode-5.0 additions */ + G_UNICODE_SCRIPT_UNKNOWN, /* Zzzz */ + G_UNICODE_SCRIPT_BALINESE, /* Bali */ + G_UNICODE_SCRIPT_CUNEIFORM, /* Xsux */ + G_UNICODE_SCRIPT_PHOENICIAN, /* Phnx */ + G_UNICODE_SCRIPT_PHAGS_PA, /* Phag */ + G_UNICODE_SCRIPT_NKO, /* Nkoo */ + + /* Unicode-5.1 additions */ + G_UNICODE_SCRIPT_KAYAH_LI, /* Kali */ + G_UNICODE_SCRIPT_LEPCHA, /* Lepc */ + G_UNICODE_SCRIPT_REJANG, /* Rjng */ + G_UNICODE_SCRIPT_SUNDANESE, /* Sund */ + G_UNICODE_SCRIPT_SAURASHTRA, /* Saur */ + G_UNICODE_SCRIPT_CHAM, /* Cham */ + G_UNICODE_SCRIPT_OL_CHIKI, /* Olck */ + G_UNICODE_SCRIPT_VAI, /* Vaii */ + G_UNICODE_SCRIPT_CARIAN, /* Cari */ + G_UNICODE_SCRIPT_LYCIAN, /* Lyci */ + G_UNICODE_SCRIPT_LYDIAN, /* Lydi */ + + /* Unicode-5.2 additions */ + G_UNICODE_SCRIPT_AVESTAN, /* Avst */ + G_UNICODE_SCRIPT_BAMUM, /* Bamu */ + G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS, /* Egyp */ + G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC, /* Armi */ + G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI, /* Phli */ + G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN, /* Prti */ + G_UNICODE_SCRIPT_JAVANESE, /* Java */ + G_UNICODE_SCRIPT_KAITHI, /* Kthi */ + G_UNICODE_SCRIPT_LISU, /* Lisu */ + G_UNICODE_SCRIPT_MEETEI_MAYEK, /* Mtei */ + G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN, /* Sarb */ + G_UNICODE_SCRIPT_OLD_TURKIC, /* Orkh */ + G_UNICODE_SCRIPT_SAMARITAN, /* Samr */ + G_UNICODE_SCRIPT_TAI_THAM, /* Lana */ + G_UNICODE_SCRIPT_TAI_VIET, /* Tavt */ + + /* Unicode-6.0 additions */ + G_UNICODE_SCRIPT_BATAK, /* Batk */ + G_UNICODE_SCRIPT_BRAHMI, /* Brah */ + G_UNICODE_SCRIPT_MANDAIC, /* Mand */ + + /* Unicode-6.1 additions */ + G_UNICODE_SCRIPT_CHAKMA, /* Cakm */ + G_UNICODE_SCRIPT_MEROITIC_CURSIVE, /* Merc */ + G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS, /* Mero */ + G_UNICODE_SCRIPT_MIAO, /* Plrd */ + G_UNICODE_SCRIPT_SHARADA, /* Shrd */ + G_UNICODE_SCRIPT_SORA_SOMPENG, /* Sora */ + G_UNICODE_SCRIPT_TAKRI, /* Takr */ + + /* Unicode 7.0 additions */ + G_UNICODE_SCRIPT_BASSA_VAH, /* Bass */ + G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN, /* Aghb */ + G_UNICODE_SCRIPT_DUPLOYAN, /* Dupl */ + G_UNICODE_SCRIPT_ELBASAN, /* Elba */ + G_UNICODE_SCRIPT_GRANTHA, /* Gran */ + G_UNICODE_SCRIPT_KHOJKI, /* Khoj */ + G_UNICODE_SCRIPT_KHUDAWADI, /* Sind */ + G_UNICODE_SCRIPT_LINEAR_A, /* Lina */ + G_UNICODE_SCRIPT_MAHAJANI, /* Mahj */ + G_UNICODE_SCRIPT_MANICHAEAN, /* Mani */ + G_UNICODE_SCRIPT_MENDE_KIKAKUI, /* Mend */ + G_UNICODE_SCRIPT_MODI, /* Modi */ + G_UNICODE_SCRIPT_MRO, /* Mroo */ + G_UNICODE_SCRIPT_NABATAEAN, /* Nbat */ + G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN, /* Narb */ + G_UNICODE_SCRIPT_OLD_PERMIC, /* Perm */ + G_UNICODE_SCRIPT_PAHAWH_HMONG, /* Hmng */ + G_UNICODE_SCRIPT_PALMYRENE, /* Palm */ + G_UNICODE_SCRIPT_PAU_CIN_HAU, /* Pauc */ + G_UNICODE_SCRIPT_PSALTER_PAHLAVI, /* Phlp */ + G_UNICODE_SCRIPT_SIDDHAM, /* Sidd */ + G_UNICODE_SCRIPT_TIRHUTA, /* Tirh */ + G_UNICODE_SCRIPT_WARANG_CITI, /* Wara */ + + /* Unicode 8.0 additions */ + G_UNICODE_SCRIPT_AHOM, /* Ahom */ + G_UNICODE_SCRIPT_ANATOLIAN_HIEROGLYPHS, /* Hluw */ + G_UNICODE_SCRIPT_HATRAN, /* Hatr */ + G_UNICODE_SCRIPT_MULTANI, /* Mult */ + G_UNICODE_SCRIPT_OLD_HUNGARIAN, /* Hung */ + G_UNICODE_SCRIPT_SIGNWRITING, /* Sgnw */ + + /* Unicode 9.0 additions */ + G_UNICODE_SCRIPT_ADLAM, /* Adlm */ + G_UNICODE_SCRIPT_BHAIKSUKI, /* Bhks */ + G_UNICODE_SCRIPT_MARCHEN, /* Marc */ + G_UNICODE_SCRIPT_NEWA, /* Newa */ + G_UNICODE_SCRIPT_OSAGE, /* Osge */ + G_UNICODE_SCRIPT_TANGUT, /* Tang */ + + /* Unicode 10.0 additions */ + G_UNICODE_SCRIPT_MASARAM_GONDI, /* Gonm */ + G_UNICODE_SCRIPT_NUSHU, /* Nshu */ + G_UNICODE_SCRIPT_SOYOMBO, /* Soyo */ + G_UNICODE_SCRIPT_ZANABAZAR_SQUARE, /* Zanb */ + + /* Unicode 11.0 additions */ + G_UNICODE_SCRIPT_DOGRA, /* Dogr */ + G_UNICODE_SCRIPT_GUNJALA_GONDI, /* Gong */ + G_UNICODE_SCRIPT_HANIFI_ROHINGYA, /* Rohg */ + G_UNICODE_SCRIPT_MAKASAR, /* Maka */ + G_UNICODE_SCRIPT_MEDEFAIDRIN, /* Medf */ + G_UNICODE_SCRIPT_OLD_SOGDIAN, /* Sogo */ + G_UNICODE_SCRIPT_SOGDIAN, /* Sogd */ + + /* Unicode 12.0 additions */ + G_UNICODE_SCRIPT_ELYMAIC, /* Elym */ + G_UNICODE_SCRIPT_NANDINAGARI, /* Nand */ + G_UNICODE_SCRIPT_NYIAKENG_PUACHUE_HMONG, /* Rohg */ + G_UNICODE_SCRIPT_WANCHO, /* Wcho */ + + /* Unicode 13.0 additions */ + G_UNICODE_SCRIPT_CHORASMIAN, /* Chrs */ + G_UNICODE_SCRIPT_DIVES_AKURU, /* Diak */ + G_UNICODE_SCRIPT_KHITAN_SMALL_SCRIPT, /* Kits */ + G_UNICODE_SCRIPT_YEZIDI /* Yezi */ +} GUnicodeScript; + +GLIB_AVAILABLE_IN_ALL +guint32 g_unicode_script_to_iso15924 (GUnicodeScript script); +GLIB_AVAILABLE_IN_ALL +GUnicodeScript g_unicode_script_from_iso15924 (guint32 iso15924); + +/* These are all analogs of the functions. + */ +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_isalnum (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_isalpha (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_iscntrl (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_isdigit (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_isgraph (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_islower (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_isprint (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_ispunct (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_isspace (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_isupper (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_isxdigit (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_istitle (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_isdefined (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_iswide (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_iswide_cjk(gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_iszerowidth(gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_ismark (gunichar c) G_GNUC_CONST; + +/* More functions. These convert between the three cases. + * See the Unicode book to understand title case. */ +GLIB_AVAILABLE_IN_ALL +gunichar g_unichar_toupper (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gunichar g_unichar_tolower (gunichar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gunichar g_unichar_totitle (gunichar c) G_GNUC_CONST; + +/* If C is a digit (according to 'g_unichar_isdigit'), then return its + numeric value. Otherwise return -1. */ +GLIB_AVAILABLE_IN_ALL +gint g_unichar_digit_value (gunichar c) G_GNUC_CONST; + +GLIB_AVAILABLE_IN_ALL +gint g_unichar_xdigit_value (gunichar c) G_GNUC_CONST; + +/* Return the Unicode character type of a given character. */ +GLIB_AVAILABLE_IN_ALL +GUnicodeType g_unichar_type (gunichar c) G_GNUC_CONST; + +/* Return the line break property for a given character */ +GLIB_AVAILABLE_IN_ALL +GUnicodeBreakType g_unichar_break_type (gunichar c) G_GNUC_CONST; + +/* Returns the combining class for a given character */ +GLIB_AVAILABLE_IN_ALL +gint g_unichar_combining_class (gunichar uc) G_GNUC_CONST; + +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_get_mirror_char (gunichar ch, + gunichar *mirrored_ch); + +GLIB_AVAILABLE_IN_ALL +GUnicodeScript g_unichar_get_script (gunichar ch) G_GNUC_CONST; + +/* Validate a Unicode character */ +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_validate (gunichar ch) G_GNUC_CONST; + +/* Pairwise canonical compose/decompose */ +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_compose (gunichar a, + gunichar b, + gunichar *ch); +GLIB_AVAILABLE_IN_ALL +gboolean g_unichar_decompose (gunichar ch, + gunichar *a, + gunichar *b); + +GLIB_AVAILABLE_IN_ALL +gsize g_unichar_fully_decompose (gunichar ch, + gboolean compat, + gunichar *result, + gsize result_len); + +/** + * G_UNICHAR_MAX_DECOMPOSITION_LENGTH: + * + * The maximum length (in codepoints) of a compatibility or canonical + * decomposition of a single Unicode character. + * + * This is as defined by Unicode 6.1. + * + * Since: 2.32 + */ +#define G_UNICHAR_MAX_DECOMPOSITION_LENGTH 18 /* codepoints */ + +/* Compute canonical ordering of a string in-place. This rearranges + decomposed characters in the string according to their combining + classes. See the Unicode manual for more information. */ +GLIB_AVAILABLE_IN_ALL +void g_unicode_canonical_ordering (gunichar *string, + gsize len); + + +GLIB_DEPRECATED_IN_2_30 +gunichar *g_unicode_canonical_decomposition (gunichar ch, + gsize *result_len) G_GNUC_MALLOC; + +/* Array of skip-bytes-per-initial character. + */ +GLIB_VAR const gchar * const g_utf8_skip; + +/** + * g_utf8_next_char: + * @p: Pointer to the start of a valid UTF-8 character + * + * Skips to the next character in a UTF-8 string. The string must be + * valid; this macro is as fast as possible, and has no error-checking. + * You would use this macro to iterate over a string character by + * character. The macro returns the start of the next UTF-8 character. + * Before using this macro, use g_utf8_validate() to validate strings + * that may contain invalid UTF-8. + */ +#define g_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(const guchar *)(p)]) + +GLIB_AVAILABLE_IN_ALL +gunichar g_utf8_get_char (const gchar *p) G_GNUC_PURE; +GLIB_AVAILABLE_IN_ALL +gunichar g_utf8_get_char_validated (const gchar *p, + gssize max_len) G_GNUC_PURE; + +GLIB_AVAILABLE_IN_ALL +gchar* g_utf8_offset_to_pointer (const gchar *str, + glong offset) G_GNUC_PURE; +GLIB_AVAILABLE_IN_ALL +glong g_utf8_pointer_to_offset (const gchar *str, + const gchar *pos) G_GNUC_PURE; +GLIB_AVAILABLE_IN_ALL +gchar* g_utf8_prev_char (const gchar *p) G_GNUC_PURE; +GLIB_AVAILABLE_IN_ALL +gchar* g_utf8_find_next_char (const gchar *p, + const gchar *end) G_GNUC_PURE; +GLIB_AVAILABLE_IN_ALL +gchar* g_utf8_find_prev_char (const gchar *str, + const gchar *p) G_GNUC_PURE; + +GLIB_AVAILABLE_IN_ALL +glong g_utf8_strlen (const gchar *p, + gssize max) G_GNUC_PURE; + +GLIB_AVAILABLE_IN_2_30 +gchar *g_utf8_substring (const gchar *str, + glong start_pos, + glong end_pos) G_GNUC_MALLOC; + +GLIB_AVAILABLE_IN_ALL +gchar *g_utf8_strncpy (gchar *dest, + const gchar *src, + gsize n); + +/* Find the UTF-8 character corresponding to ch, in string p. These + functions are equivalants to strchr and strrchr */ +GLIB_AVAILABLE_IN_ALL +gchar* g_utf8_strchr (const gchar *p, + gssize len, + gunichar c); +GLIB_AVAILABLE_IN_ALL +gchar* g_utf8_strrchr (const gchar *p, + gssize len, + gunichar c); +GLIB_AVAILABLE_IN_ALL +gchar* g_utf8_strreverse (const gchar *str, + gssize len); + +GLIB_AVAILABLE_IN_ALL +gunichar2 *g_utf8_to_utf16 (const gchar *str, + glong len, + glong *items_read, + glong *items_written, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gunichar * g_utf8_to_ucs4 (const gchar *str, + glong len, + glong *items_read, + glong *items_written, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gunichar * g_utf8_to_ucs4_fast (const gchar *str, + glong len, + glong *items_written) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gunichar * g_utf16_to_ucs4 (const gunichar2 *str, + glong len, + glong *items_read, + glong *items_written, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar* g_utf16_to_utf8 (const gunichar2 *str, + glong len, + glong *items_read, + glong *items_written, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gunichar2 *g_ucs4_to_utf16 (const gunichar *str, + glong len, + glong *items_read, + glong *items_written, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar* g_ucs4_to_utf8 (const gunichar *str, + glong len, + glong *items_read, + glong *items_written, + GError **error) G_GNUC_MALLOC; + +GLIB_AVAILABLE_IN_ALL +gint g_unichar_to_utf8 (gunichar c, + gchar *outbuf); + +GLIB_AVAILABLE_IN_ALL +gboolean g_utf8_validate (const gchar *str, + gssize max_len, + const gchar **end); +GLIB_AVAILABLE_IN_2_60 +gboolean g_utf8_validate_len (const gchar *str, + gsize max_len, + const gchar **end); + +GLIB_AVAILABLE_IN_ALL +gchar *g_utf8_strup (const gchar *str, + gssize len) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar *g_utf8_strdown (const gchar *str, + gssize len) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar *g_utf8_casefold (const gchar *str, + gssize len) G_GNUC_MALLOC; + +/** + * GNormalizeMode: + * @G_NORMALIZE_DEFAULT: standardize differences that do not affect the + * text content, such as the above-mentioned accent representation + * @G_NORMALIZE_NFD: another name for %G_NORMALIZE_DEFAULT + * @G_NORMALIZE_DEFAULT_COMPOSE: like %G_NORMALIZE_DEFAULT, but with + * composed forms rather than a maximally decomposed form + * @G_NORMALIZE_NFC: another name for %G_NORMALIZE_DEFAULT_COMPOSE + * @G_NORMALIZE_ALL: beyond %G_NORMALIZE_DEFAULT also standardize the + * "compatibility" characters in Unicode, such as SUPERSCRIPT THREE + * to the standard forms (in this case DIGIT THREE). Formatting + * information may be lost but for most text operations such + * characters should be considered the same + * @G_NORMALIZE_NFKD: another name for %G_NORMALIZE_ALL + * @G_NORMALIZE_ALL_COMPOSE: like %G_NORMALIZE_ALL, but with composed + * forms rather than a maximally decomposed form + * @G_NORMALIZE_NFKC: another name for %G_NORMALIZE_ALL_COMPOSE + * + * Defines how a Unicode string is transformed in a canonical + * form, standardizing such issues as whether a character with + * an accent is represented as a base character and combining + * accent or as a single precomposed character. Unicode strings + * should generally be normalized before comparing them. + */ +typedef enum { + G_NORMALIZE_DEFAULT, + G_NORMALIZE_NFD = G_NORMALIZE_DEFAULT, + G_NORMALIZE_DEFAULT_COMPOSE, + G_NORMALIZE_NFC = G_NORMALIZE_DEFAULT_COMPOSE, + G_NORMALIZE_ALL, + G_NORMALIZE_NFKD = G_NORMALIZE_ALL, + G_NORMALIZE_ALL_COMPOSE, + G_NORMALIZE_NFKC = G_NORMALIZE_ALL_COMPOSE +} GNormalizeMode; + +GLIB_AVAILABLE_IN_ALL +gchar *g_utf8_normalize (const gchar *str, + gssize len, + GNormalizeMode mode) G_GNUC_MALLOC; + +GLIB_AVAILABLE_IN_ALL +gint g_utf8_collate (const gchar *str1, + const gchar *str2) G_GNUC_PURE; +GLIB_AVAILABLE_IN_ALL +gchar *g_utf8_collate_key (const gchar *str, + gssize len) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar *g_utf8_collate_key_for_filename (const gchar *str, + gssize len) G_GNUC_MALLOC; + +GLIB_AVAILABLE_IN_2_52 +gchar *g_utf8_make_valid (const gchar *str, + gssize len) G_GNUC_MALLOC; + +G_END_DECLS + +#endif /* __G_UNICODE_H__ */ + +G_BEGIN_DECLS + +typedef struct _GString GString; + +struct _GString +{ + gchar *str; + gsize len; + gsize allocated_len; +}; + +GLIB_AVAILABLE_IN_ALL +GString* g_string_new (const gchar *init); +GLIB_AVAILABLE_IN_ALL +GString* g_string_new_len (const gchar *init, + gssize len); +GLIB_AVAILABLE_IN_ALL +GString* g_string_sized_new (gsize dfl_size); +GLIB_AVAILABLE_IN_ALL +gchar* g_string_free (GString *string, + gboolean free_segment); +GLIB_AVAILABLE_IN_2_34 +GBytes* g_string_free_to_bytes (GString *string); +GLIB_AVAILABLE_IN_ALL +gboolean g_string_equal (const GString *v, + const GString *v2); +GLIB_AVAILABLE_IN_ALL +guint g_string_hash (const GString *str); +GLIB_AVAILABLE_IN_ALL +GString* g_string_assign (GString *string, + const gchar *rval); +GLIB_AVAILABLE_IN_ALL +GString* g_string_truncate (GString *string, + gsize len); +GLIB_AVAILABLE_IN_ALL +GString* g_string_set_size (GString *string, + gsize len); +GLIB_AVAILABLE_IN_ALL +GString* g_string_insert_len (GString *string, + gssize pos, + const gchar *val, + gssize len); +GLIB_AVAILABLE_IN_ALL +GString* g_string_append (GString *string, + const gchar *val); +GLIB_AVAILABLE_IN_ALL +GString* g_string_append_len (GString *string, + const gchar *val, + gssize len); +GLIB_AVAILABLE_IN_ALL +GString* g_string_append_c (GString *string, + gchar c); +GLIB_AVAILABLE_IN_ALL +GString* g_string_append_unichar (GString *string, + gunichar wc); +GLIB_AVAILABLE_IN_ALL +GString* g_string_prepend (GString *string, + const gchar *val); +GLIB_AVAILABLE_IN_ALL +GString* g_string_prepend_c (GString *string, + gchar c); +GLIB_AVAILABLE_IN_ALL +GString* g_string_prepend_unichar (GString *string, + gunichar wc); +GLIB_AVAILABLE_IN_ALL +GString* g_string_prepend_len (GString *string, + const gchar *val, + gssize len); +GLIB_AVAILABLE_IN_ALL +GString* g_string_insert (GString *string, + gssize pos, + const gchar *val); +GLIB_AVAILABLE_IN_ALL +GString* g_string_insert_c (GString *string, + gssize pos, + gchar c); +GLIB_AVAILABLE_IN_ALL +GString* g_string_insert_unichar (GString *string, + gssize pos, + gunichar wc); +GLIB_AVAILABLE_IN_ALL +GString* g_string_overwrite (GString *string, + gsize pos, + const gchar *val); +GLIB_AVAILABLE_IN_ALL +GString* g_string_overwrite_len (GString *string, + gsize pos, + const gchar *val, + gssize len); +GLIB_AVAILABLE_IN_ALL +GString* g_string_erase (GString *string, + gssize pos, + gssize len); +GLIB_AVAILABLE_IN_ALL +GString* g_string_ascii_down (GString *string); +GLIB_AVAILABLE_IN_ALL +GString* g_string_ascii_up (GString *string); +GLIB_AVAILABLE_IN_ALL +void g_string_vprintf (GString *string, + const gchar *format, + va_list args) + G_GNUC_PRINTF(2, 0); +GLIB_AVAILABLE_IN_ALL +void g_string_printf (GString *string, + const gchar *format, + ...) G_GNUC_PRINTF (2, 3); +GLIB_AVAILABLE_IN_ALL +void g_string_append_vprintf (GString *string, + const gchar *format, + va_list args) + G_GNUC_PRINTF(2, 0); +GLIB_AVAILABLE_IN_ALL +void g_string_append_printf (GString *string, + const gchar *format, + ...) G_GNUC_PRINTF (2, 3); +GLIB_AVAILABLE_IN_ALL +GString* g_string_append_uri_escaped (GString *string, + const gchar *unescaped, + const gchar *reserved_chars_allowed, + gboolean allow_utf8); + +/* -- optimize g_strig_append_c --- */ +#ifdef G_CAN_INLINE +static inline GString* +g_string_append_c_inline (GString *gstring, + gchar c) +{ + if (gstring->len + 1 < gstring->allocated_len) + { + gstring->str[gstring->len++] = c; + gstring->str[gstring->len] = 0; + } + else + g_string_insert_c (gstring, -1, c); + return gstring; +} +#undef g_string_append_c +#define g_string_append_c(gstr,c) g_string_append_c_inline (gstr, c) +#endif /* G_CAN_INLINE */ + + +GLIB_DEPRECATED +GString *g_string_down (GString *string); +GLIB_DEPRECATED +GString *g_string_up (GString *string); + +#define g_string_sprintf g_string_printf GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_string_printf) +#define g_string_sprintfa g_string_append_printf GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_string_append_printf) + +G_END_DECLS + +#endif /* __G_STRING_H__ */ + +G_BEGIN_DECLS + +/* GIOChannel + */ + +typedef struct _GIOChannel GIOChannel; +typedef struct _GIOFuncs GIOFuncs; + +typedef enum +{ + G_IO_ERROR_NONE, + G_IO_ERROR_AGAIN, + G_IO_ERROR_INVAL, + G_IO_ERROR_UNKNOWN +} GIOError; + +#define G_IO_CHANNEL_ERROR g_io_channel_error_quark() + +typedef enum +{ + /* Derived from errno */ + G_IO_CHANNEL_ERROR_FBIG, + G_IO_CHANNEL_ERROR_INVAL, + G_IO_CHANNEL_ERROR_IO, + G_IO_CHANNEL_ERROR_ISDIR, + G_IO_CHANNEL_ERROR_NOSPC, + G_IO_CHANNEL_ERROR_NXIO, + G_IO_CHANNEL_ERROR_OVERFLOW, + G_IO_CHANNEL_ERROR_PIPE, + /* Other */ + G_IO_CHANNEL_ERROR_FAILED +} GIOChannelError; + +typedef enum +{ + G_IO_STATUS_ERROR, + G_IO_STATUS_NORMAL, + G_IO_STATUS_EOF, + G_IO_STATUS_AGAIN +} GIOStatus; + +typedef enum +{ + G_SEEK_CUR, + G_SEEK_SET, + G_SEEK_END +} GSeekType; + +typedef enum +{ + G_IO_FLAG_APPEND = 1 << 0, + G_IO_FLAG_NONBLOCK = 1 << 1, + G_IO_FLAG_IS_READABLE = 1 << 2, /* Read only flag */ + G_IO_FLAG_IS_WRITABLE = 1 << 3, /* Read only flag */ + G_IO_FLAG_IS_WRITEABLE = 1 << 3, /* Misspelling in 2.29.10 and earlier */ + G_IO_FLAG_IS_SEEKABLE = 1 << 4, /* Read only flag */ + G_IO_FLAG_MASK = (1 << 5) - 1, + G_IO_FLAG_GET_MASK = G_IO_FLAG_MASK, + G_IO_FLAG_SET_MASK = G_IO_FLAG_APPEND | G_IO_FLAG_NONBLOCK +} GIOFlags; + +struct _GIOChannel +{ + /*< private >*/ + gint ref_count; + GIOFuncs *funcs; + + gchar *encoding; + GIConv read_cd; + GIConv write_cd; + gchar *line_term; /* String which indicates the end of a line of text */ + guint line_term_len; /* So we can have null in the line term */ + + gsize buf_size; + GString *read_buf; /* Raw data from the channel */ + GString *encoded_read_buf; /* Channel data converted to UTF-8 */ + GString *write_buf; /* Data ready to be written to the file */ + gchar partial_write_buf[6]; /* UTF-8 partial characters, null terminated */ + + /* Group the flags together, immediately after partial_write_buf, to save memory */ + + guint use_buffer : 1; /* The encoding uses the buffers */ + guint do_encode : 1; /* The encoding uses the GIConv coverters */ + guint close_on_unref : 1; /* Close the channel on final unref */ + guint is_readable : 1; /* Cached GIOFlag */ + guint is_writeable : 1; /* ditto */ + guint is_seekable : 1; /* ditto */ + + gpointer reserved1; + gpointer reserved2; +}; + +typedef gboolean (*GIOFunc) (GIOChannel *source, + GIOCondition condition, + gpointer data); +struct _GIOFuncs +{ + GIOStatus (*io_read) (GIOChannel *channel, + gchar *buf, + gsize count, + gsize *bytes_read, + GError **err); + GIOStatus (*io_write) (GIOChannel *channel, + const gchar *buf, + gsize count, + gsize *bytes_written, + GError **err); + GIOStatus (*io_seek) (GIOChannel *channel, + gint64 offset, + GSeekType type, + GError **err); + GIOStatus (*io_close) (GIOChannel *channel, + GError **err); + GSource* (*io_create_watch) (GIOChannel *channel, + GIOCondition condition); + void (*io_free) (GIOChannel *channel); + GIOStatus (*io_set_flags) (GIOChannel *channel, + GIOFlags flags, + GError **err); + GIOFlags (*io_get_flags) (GIOChannel *channel); +}; + +GLIB_AVAILABLE_IN_ALL +void g_io_channel_init (GIOChannel *channel); +GLIB_AVAILABLE_IN_ALL +GIOChannel *g_io_channel_ref (GIOChannel *channel); +GLIB_AVAILABLE_IN_ALL +void g_io_channel_unref (GIOChannel *channel); + +GLIB_DEPRECATED_FOR(g_io_channel_read_chars) +GIOError g_io_channel_read (GIOChannel *channel, + gchar *buf, + gsize count, + gsize *bytes_read); + +GLIB_DEPRECATED_FOR(g_io_channel_write_chars) +GIOError g_io_channel_write (GIOChannel *channel, + const gchar *buf, + gsize count, + gsize *bytes_written); + +GLIB_DEPRECATED_FOR(g_io_channel_seek_position) +GIOError g_io_channel_seek (GIOChannel *channel, + gint64 offset, + GSeekType type); + +GLIB_DEPRECATED_FOR(g_io_channel_shutdown) +void g_io_channel_close (GIOChannel *channel); + +GLIB_AVAILABLE_IN_ALL +GIOStatus g_io_channel_shutdown (GIOChannel *channel, + gboolean flush, + GError **err); +GLIB_AVAILABLE_IN_ALL +guint g_io_add_watch_full (GIOChannel *channel, + gint priority, + GIOCondition condition, + GIOFunc func, + gpointer user_data, + GDestroyNotify notify); +GLIB_AVAILABLE_IN_ALL +GSource * g_io_create_watch (GIOChannel *channel, + GIOCondition condition); +GLIB_AVAILABLE_IN_ALL +guint g_io_add_watch (GIOChannel *channel, + GIOCondition condition, + GIOFunc func, + gpointer user_data); + +/* character encoding conversion involved functions. + */ + +GLIB_AVAILABLE_IN_ALL +void g_io_channel_set_buffer_size (GIOChannel *channel, + gsize size); +GLIB_AVAILABLE_IN_ALL +gsize g_io_channel_get_buffer_size (GIOChannel *channel); +GLIB_AVAILABLE_IN_ALL +GIOCondition g_io_channel_get_buffer_condition (GIOChannel *channel); +GLIB_AVAILABLE_IN_ALL +GIOStatus g_io_channel_set_flags (GIOChannel *channel, + GIOFlags flags, + GError **error); +GLIB_AVAILABLE_IN_ALL +GIOFlags g_io_channel_get_flags (GIOChannel *channel); +GLIB_AVAILABLE_IN_ALL +void g_io_channel_set_line_term (GIOChannel *channel, + const gchar *line_term, + gint length); +GLIB_AVAILABLE_IN_ALL +const gchar * g_io_channel_get_line_term (GIOChannel *channel, + gint *length); +GLIB_AVAILABLE_IN_ALL +void g_io_channel_set_buffered (GIOChannel *channel, + gboolean buffered); +GLIB_AVAILABLE_IN_ALL +gboolean g_io_channel_get_buffered (GIOChannel *channel); +GLIB_AVAILABLE_IN_ALL +GIOStatus g_io_channel_set_encoding (GIOChannel *channel, + const gchar *encoding, + GError **error); +GLIB_AVAILABLE_IN_ALL +const gchar * g_io_channel_get_encoding (GIOChannel *channel); +GLIB_AVAILABLE_IN_ALL +void g_io_channel_set_close_on_unref (GIOChannel *channel, + gboolean do_close); +GLIB_AVAILABLE_IN_ALL +gboolean g_io_channel_get_close_on_unref (GIOChannel *channel); + + +GLIB_AVAILABLE_IN_ALL +GIOStatus g_io_channel_flush (GIOChannel *channel, + GError **error); +GLIB_AVAILABLE_IN_ALL +GIOStatus g_io_channel_read_line (GIOChannel *channel, + gchar **str_return, + gsize *length, + gsize *terminator_pos, + GError **error); +GLIB_AVAILABLE_IN_ALL +GIOStatus g_io_channel_read_line_string (GIOChannel *channel, + GString *buffer, + gsize *terminator_pos, + GError **error); +GLIB_AVAILABLE_IN_ALL +GIOStatus g_io_channel_read_to_end (GIOChannel *channel, + gchar **str_return, + gsize *length, + GError **error); +GLIB_AVAILABLE_IN_ALL +GIOStatus g_io_channel_read_chars (GIOChannel *channel, + gchar *buf, + gsize count, + gsize *bytes_read, + GError **error); +GLIB_AVAILABLE_IN_ALL +GIOStatus g_io_channel_read_unichar (GIOChannel *channel, + gunichar *thechar, + GError **error); +GLIB_AVAILABLE_IN_ALL +GIOStatus g_io_channel_write_chars (GIOChannel *channel, + const gchar *buf, + gssize count, + gsize *bytes_written, + GError **error); +GLIB_AVAILABLE_IN_ALL +GIOStatus g_io_channel_write_unichar (GIOChannel *channel, + gunichar thechar, + GError **error); +GLIB_AVAILABLE_IN_ALL +GIOStatus g_io_channel_seek_position (GIOChannel *channel, + gint64 offset, + GSeekType type, + GError **error); +GLIB_AVAILABLE_IN_ALL +GIOChannel* g_io_channel_new_file (const gchar *filename, + const gchar *mode, + GError **error); + +/* Error handling */ + +GLIB_AVAILABLE_IN_ALL +GQuark g_io_channel_error_quark (void); +GLIB_AVAILABLE_IN_ALL +GIOChannelError g_io_channel_error_from_errno (gint en); + +/* On Unix, IO channels created with this function for any file + * descriptor or socket. + * + * On Win32, this can be used either for files opened with the MSVCRT + * (the Microsoft run-time C library) _open() or _pipe, including file + * descriptors 0, 1 and 2 (corresponding to stdin, stdout and stderr), + * or for Winsock SOCKETs. If the parameter is a legal file + * descriptor, it is assumed to be such, otherwise it should be a + * SOCKET. This relies on SOCKETs and file descriptors not + * overlapping. If you want to be certain, call either + * g_io_channel_win32_new_fd() or g_io_channel_win32_new_socket() + * instead as appropriate. + * + * The term file descriptor as used in the context of Win32 refers to + * the emulated Unix-like file descriptors MSVCRT provides. The native + * corresponding concept is file HANDLE. There isn't as of yet a way to + * get GIOChannels for Win32 file HANDLEs. + */ +GLIB_AVAILABLE_IN_ALL +GIOChannel* g_io_channel_unix_new (int fd); +GLIB_AVAILABLE_IN_ALL +gint g_io_channel_unix_get_fd (GIOChannel *channel); + + +/* Hook for GClosure / GSource integration. Don't touch */ +GLIB_VAR GSourceFuncs g_io_watch_funcs; + +#ifdef G_OS_WIN32 + +/* You can use this "pseudo file descriptor" in a GPollFD to add + * polling for Windows messages. GTK applications should not do that. + */ + +#define G_WIN32_MSG_HANDLE 19981206 + +/* Use this to get a GPollFD from a GIOChannel, so that you can call + * g_io_channel_win32_poll(). After calling this you should only use + * g_io_channel_read() to read from the GIOChannel, i.e. never read() + * from the underlying file descriptor. For SOCKETs, it is possible to call + * recv(). + */ +GLIB_AVAILABLE_IN_ALL +void g_io_channel_win32_make_pollfd (GIOChannel *channel, + GIOCondition condition, + GPollFD *fd); + +/* This can be used to wait until at least one of the channels is readable. + * On Unix you would do a select() on the file descriptors of the channels. + */ +GLIB_AVAILABLE_IN_ALL +gint g_io_channel_win32_poll (GPollFD *fds, + gint n_fds, + gint timeout_); + +/* Create an IO channel for Windows messages for window handle hwnd. */ +#if GLIB_SIZEOF_VOID_P == 8 +/* We use gsize here so that it is still an integer type and not a + * pointer, like the guint in the traditional prototype. We can't use + * intptr_t as that is not portable enough. + */ +GLIB_AVAILABLE_IN_ALL +GIOChannel *g_io_channel_win32_new_messages (gsize hwnd); +#else +GLIB_AVAILABLE_IN_ALL +GIOChannel *g_io_channel_win32_new_messages (guint hwnd); +#endif + +/* Create an IO channel for C runtime (emulated Unix-like) file + * descriptors. After calling g_io_add_watch() on a IO channel + * returned by this function, you shouldn't call read() on the file + * descriptor. This is because adding polling for a file descriptor is + * implemented on Win32 by starting a thread that sits blocked in a + * read() from the file descriptor most of the time. All reads from + * the file descriptor should be done by this internal GLib + * thread. Your code should call only g_io_channel_read_chars(). + */ +GLIB_AVAILABLE_IN_ALL +GIOChannel* g_io_channel_win32_new_fd (gint fd); + +/* Get the C runtime file descriptor of a channel. */ +GLIB_AVAILABLE_IN_ALL +gint g_io_channel_win32_get_fd (GIOChannel *channel); + +/* Create an IO channel for a winsock socket. The parameter should be + * a SOCKET. Contrary to IO channels for file descriptors (on *Win32), + * you can use normal recv() or recvfrom() on sockets even if GLib + * is polling them. + */ +GLIB_AVAILABLE_IN_ALL +GIOChannel *g_io_channel_win32_new_socket (gint socket); + +GLIB_DEPRECATED_FOR(g_io_channel_win32_new_socket) +GIOChannel *g_io_channel_win32_new_stream_socket (gint socket); + +GLIB_AVAILABLE_IN_ALL +void g_io_channel_win32_set_debug (GIOChannel *channel, + gboolean flag); + +#endif + +G_END_DECLS + +#endif /* __G_IOCHANNEL_H__ */ +/* gkeyfile.h - desktop entry file parser + * + * Copyright 2004 Red Hat, Inc. + * + * Ray Strode + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_KEY_FILE_H__ +#define __G_KEY_FILE_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef enum +{ + G_KEY_FILE_ERROR_UNKNOWN_ENCODING, + G_KEY_FILE_ERROR_PARSE, + G_KEY_FILE_ERROR_NOT_FOUND, + G_KEY_FILE_ERROR_KEY_NOT_FOUND, + G_KEY_FILE_ERROR_GROUP_NOT_FOUND, + G_KEY_FILE_ERROR_INVALID_VALUE +} GKeyFileError; + +#define G_KEY_FILE_ERROR g_key_file_error_quark() + +GLIB_AVAILABLE_IN_ALL +GQuark g_key_file_error_quark (void); + +typedef struct _GKeyFile GKeyFile; + +typedef enum +{ + G_KEY_FILE_NONE = 0, + G_KEY_FILE_KEEP_COMMENTS = 1 << 0, + G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1 +} GKeyFileFlags; + +GLIB_AVAILABLE_IN_ALL +GKeyFile *g_key_file_new (void); +GLIB_AVAILABLE_IN_ALL +GKeyFile *g_key_file_ref (GKeyFile *key_file); +GLIB_AVAILABLE_IN_ALL +void g_key_file_unref (GKeyFile *key_file); +GLIB_AVAILABLE_IN_ALL +void g_key_file_free (GKeyFile *key_file); +GLIB_AVAILABLE_IN_ALL +void g_key_file_set_list_separator (GKeyFile *key_file, + gchar separator); +GLIB_AVAILABLE_IN_ALL +gboolean g_key_file_load_from_file (GKeyFile *key_file, + const gchar *file, + GKeyFileFlags flags, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_key_file_load_from_data (GKeyFile *key_file, + const gchar *data, + gsize length, + GKeyFileFlags flags, + GError **error); +GLIB_AVAILABLE_IN_2_50 +gboolean g_key_file_load_from_bytes (GKeyFile *key_file, + GBytes *bytes, + GKeyFileFlags flags, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_key_file_load_from_dirs (GKeyFile *key_file, + const gchar *file, + const gchar **search_dirs, + gchar **full_path, + GKeyFileFlags flags, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_key_file_load_from_data_dirs (GKeyFile *key_file, + const gchar *file, + gchar **full_path, + GKeyFileFlags flags, + GError **error); +GLIB_AVAILABLE_IN_ALL +gchar *g_key_file_to_data (GKeyFile *key_file, + gsize *length, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_2_40 +gboolean g_key_file_save_to_file (GKeyFile *key_file, + const gchar *filename, + GError **error); +GLIB_AVAILABLE_IN_ALL +gchar *g_key_file_get_start_group (GKeyFile *key_file) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar **g_key_file_get_groups (GKeyFile *key_file, + gsize *length); +GLIB_AVAILABLE_IN_ALL +gchar **g_key_file_get_keys (GKeyFile *key_file, + const gchar *group_name, + gsize *length, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_key_file_has_group (GKeyFile *key_file, + const gchar *group_name); +GLIB_AVAILABLE_IN_ALL +gboolean g_key_file_has_key (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + GError **error); +GLIB_AVAILABLE_IN_ALL +gchar *g_key_file_get_value (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +void g_key_file_set_value (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + const gchar *value); +GLIB_AVAILABLE_IN_ALL +gchar *g_key_file_get_string (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +void g_key_file_set_string (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + const gchar *string); +GLIB_AVAILABLE_IN_ALL +gchar *g_key_file_get_locale_string (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + const gchar *locale, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_2_56 +gchar *g_key_file_get_locale_for_key (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + const gchar *locale) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +void g_key_file_set_locale_string (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + const gchar *locale, + const gchar *string); +GLIB_AVAILABLE_IN_ALL +gboolean g_key_file_get_boolean (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + GError **error); +GLIB_AVAILABLE_IN_ALL +void g_key_file_set_boolean (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + gboolean value); +GLIB_AVAILABLE_IN_ALL +gint g_key_file_get_integer (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + GError **error); +GLIB_AVAILABLE_IN_ALL +void g_key_file_set_integer (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + gint value); +GLIB_AVAILABLE_IN_ALL +gint64 g_key_file_get_int64 (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + GError **error); +GLIB_AVAILABLE_IN_ALL +void g_key_file_set_int64 (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + gint64 value); +GLIB_AVAILABLE_IN_ALL +guint64 g_key_file_get_uint64 (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + GError **error); +GLIB_AVAILABLE_IN_ALL +void g_key_file_set_uint64 (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + guint64 value); +GLIB_AVAILABLE_IN_ALL +gdouble g_key_file_get_double (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + GError **error); +GLIB_AVAILABLE_IN_ALL +void g_key_file_set_double (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + gdouble value); +GLIB_AVAILABLE_IN_ALL +gchar **g_key_file_get_string_list (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + gsize *length, + GError **error); +GLIB_AVAILABLE_IN_ALL +void g_key_file_set_string_list (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + const gchar * const list[], + gsize length); +GLIB_AVAILABLE_IN_ALL +gchar **g_key_file_get_locale_string_list (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + const gchar *locale, + gsize *length, + GError **error); +GLIB_AVAILABLE_IN_ALL +void g_key_file_set_locale_string_list (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + const gchar *locale, + const gchar * const list[], + gsize length); +GLIB_AVAILABLE_IN_ALL +gboolean *g_key_file_get_boolean_list (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + gsize *length, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +void g_key_file_set_boolean_list (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + gboolean list[], + gsize length); +GLIB_AVAILABLE_IN_ALL +gint *g_key_file_get_integer_list (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + gsize *length, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +void g_key_file_set_double_list (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + gdouble list[], + gsize length); +GLIB_AVAILABLE_IN_ALL +gdouble *g_key_file_get_double_list (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + gsize *length, + GError **error) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +void g_key_file_set_integer_list (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + gint list[], + gsize length); +GLIB_AVAILABLE_IN_ALL +gboolean g_key_file_set_comment (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + const gchar *comment, + GError **error); +GLIB_AVAILABLE_IN_ALL +gchar *g_key_file_get_comment (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + GError **error) G_GNUC_MALLOC; + +GLIB_AVAILABLE_IN_ALL +gboolean g_key_file_remove_comment (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_key_file_remove_key (GKeyFile *key_file, + const gchar *group_name, + const gchar *key, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_key_file_remove_group (GKeyFile *key_file, + const gchar *group_name, + GError **error); + +/* Defines for handling freedesktop.org Desktop files */ +#define G_KEY_FILE_DESKTOP_GROUP "Desktop Entry" + +#define G_KEY_FILE_DESKTOP_KEY_TYPE "Type" +#define G_KEY_FILE_DESKTOP_KEY_VERSION "Version" +#define G_KEY_FILE_DESKTOP_KEY_NAME "Name" +#define G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME "GenericName" +#define G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY "NoDisplay" +#define G_KEY_FILE_DESKTOP_KEY_COMMENT "Comment" +#define G_KEY_FILE_DESKTOP_KEY_ICON "Icon" +#define G_KEY_FILE_DESKTOP_KEY_HIDDEN "Hidden" +#define G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN "OnlyShowIn" +#define G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN "NotShowIn" +#define G_KEY_FILE_DESKTOP_KEY_TRY_EXEC "TryExec" +#define G_KEY_FILE_DESKTOP_KEY_EXEC "Exec" +#define G_KEY_FILE_DESKTOP_KEY_PATH "Path" +#define G_KEY_FILE_DESKTOP_KEY_TERMINAL "Terminal" +#define G_KEY_FILE_DESKTOP_KEY_MIME_TYPE "MimeType" +#define G_KEY_FILE_DESKTOP_KEY_CATEGORIES "Categories" +#define G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY "StartupNotify" +#define G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS "StartupWMClass" +#define G_KEY_FILE_DESKTOP_KEY_URL "URL" +#define G_KEY_FILE_DESKTOP_KEY_DBUS_ACTIVATABLE "DBusActivatable" +#define G_KEY_FILE_DESKTOP_KEY_ACTIONS "Actions" + +#define G_KEY_FILE_DESKTOP_TYPE_APPLICATION "Application" +#define G_KEY_FILE_DESKTOP_TYPE_LINK "Link" +#define G_KEY_FILE_DESKTOP_TYPE_DIRECTORY "Directory" + +G_END_DECLS + +#endif /* __G_KEY_FILE_H__ */ +/* GLIB - Library of useful routines for C programming + * gmappedfile.h: Simplified wrapper around the mmap function + * + * Copyright 2005 Matthias Clasen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __G_MAPPED_FILE_H__ +#define __G_MAPPED_FILE_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GMappedFile GMappedFile; + +GLIB_AVAILABLE_IN_ALL +GMappedFile *g_mapped_file_new (const gchar *filename, + gboolean writable, + GError **error); +GLIB_AVAILABLE_IN_ALL +GMappedFile *g_mapped_file_new_from_fd (gint fd, + gboolean writable, + GError **error); +GLIB_AVAILABLE_IN_ALL +gsize g_mapped_file_get_length (GMappedFile *file); +GLIB_AVAILABLE_IN_ALL +gchar *g_mapped_file_get_contents (GMappedFile *file); +GLIB_AVAILABLE_IN_2_34 +GBytes * g_mapped_file_get_bytes (GMappedFile *file); +GLIB_AVAILABLE_IN_ALL +GMappedFile *g_mapped_file_ref (GMappedFile *file); +GLIB_AVAILABLE_IN_ALL +void g_mapped_file_unref (GMappedFile *file); + +GLIB_DEPRECATED_FOR(g_mapped_file_unref) +void g_mapped_file_free (GMappedFile *file); + +G_END_DECLS + +#endif /* __G_MAPPED_FILE_H__ */ +/* gmarkup.h - Simple XML-like string parser/writer + * + * Copyright 2000 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_MARKUP_H__ +#define __G_MARKUP_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#include + + +G_BEGIN_DECLS + +/** + * GMarkupError: + * @G_MARKUP_ERROR_BAD_UTF8: text being parsed was not valid UTF-8 + * @G_MARKUP_ERROR_EMPTY: document contained nothing, or only whitespace + * @G_MARKUP_ERROR_PARSE: document was ill-formed + * @G_MARKUP_ERROR_UNKNOWN_ELEMENT: error should be set by #GMarkupParser + * functions; element wasn't known + * @G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE: error should be set by #GMarkupParser + * functions; attribute wasn't known + * @G_MARKUP_ERROR_INVALID_CONTENT: error should be set by #GMarkupParser + * functions; content was invalid + * @G_MARKUP_ERROR_MISSING_ATTRIBUTE: error should be set by #GMarkupParser + * functions; a required attribute was missing + * + * Error codes returned by markup parsing. + */ +typedef enum +{ + G_MARKUP_ERROR_BAD_UTF8, + G_MARKUP_ERROR_EMPTY, + G_MARKUP_ERROR_PARSE, + /* The following are primarily intended for specific GMarkupParser + * implementations to set. + */ + G_MARKUP_ERROR_UNKNOWN_ELEMENT, + G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, + G_MARKUP_ERROR_INVALID_CONTENT, + G_MARKUP_ERROR_MISSING_ATTRIBUTE +} GMarkupError; + +/** + * G_MARKUP_ERROR: + * + * Error domain for markup parsing. + * Errors in this domain will be from the #GMarkupError enumeration. + * See #GError for information on error domains. + */ +#define G_MARKUP_ERROR g_markup_error_quark () + +GLIB_AVAILABLE_IN_ALL +GQuark g_markup_error_quark (void); + +/** + * GMarkupParseFlags: + * @G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG: flag you should not use + * @G_MARKUP_TREAT_CDATA_AS_TEXT: When this flag is set, CDATA marked + * sections are not passed literally to the @passthrough function of + * the parser. Instead, the content of the section (without the + * ``) is + * passed to the @text function. This flag was added in GLib 2.12 + * @G_MARKUP_PREFIX_ERROR_POSITION: Normally errors caught by GMarkup + * itself have line/column information prefixed to them to let the + * caller know the location of the error. When this flag is set the + * location information is also prefixed to errors generated by the + * #GMarkupParser implementation functions + * @G_MARKUP_IGNORE_QUALIFIED: Ignore (don't report) qualified + * attributes and tags, along with their contents. A qualified + * attribute or tag is one that contains ':' in its name (ie: is in + * another namespace). Since: 2.40. + * + * Flags that affect the behaviour of the parser. + */ +typedef enum +{ + G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 << 0, + G_MARKUP_TREAT_CDATA_AS_TEXT = 1 << 1, + G_MARKUP_PREFIX_ERROR_POSITION = 1 << 2, + G_MARKUP_IGNORE_QUALIFIED = 1 << 3 +} GMarkupParseFlags; + +/** + * GMarkupParseContext: + * + * A parse context is used to parse a stream of bytes that + * you expect to contain marked-up text. + * + * See g_markup_parse_context_new(), #GMarkupParser, and so + * on for more details. + */ +typedef struct _GMarkupParseContext GMarkupParseContext; +typedef struct _GMarkupParser GMarkupParser; + +/** + * GMarkupParser: + * @start_element: Callback to invoke when the opening tag of an element + * is seen. The callback's @attribute_names and @attribute_values parameters + * are %NULL-terminated. + * @end_element: Callback to invoke when the closing tag of an element + * is seen. Note that this is also called for empty tags like + * ``. + * @text: Callback to invoke when some text is seen (text is always + * inside an element). Note that the text of an element may be spread + * over multiple calls of this function. If the + * %G_MARKUP_TREAT_CDATA_AS_TEXT flag is set, this function is also + * called for the content of CDATA marked sections. + * @passthrough: Callback to invoke for comments, processing instructions + * and doctype declarations; if you're re-writing the parsed document, + * write the passthrough text back out in the same position. If the + * %G_MARKUP_TREAT_CDATA_AS_TEXT flag is not set, this function is also + * called for CDATA marked sections. + * @error: Callback to invoke when an error occurs. + * + * Any of the fields in #GMarkupParser can be %NULL, in which case they + * will be ignored. Except for the @error function, any of these callbacks + * can set an error; in particular the %G_MARKUP_ERROR_UNKNOWN_ELEMENT, + * %G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, and %G_MARKUP_ERROR_INVALID_CONTENT + * errors are intended to be set from these callbacks. If you set an error + * from a callback, g_markup_parse_context_parse() will report that error + * back to its caller. + */ +struct _GMarkupParser +{ + /* Called for open tags */ + void (*start_element) (GMarkupParseContext *context, + const gchar *element_name, + const gchar **attribute_names, + const gchar **attribute_values, + gpointer user_data, + GError **error); + + /* Called for close tags */ + void (*end_element) (GMarkupParseContext *context, + const gchar *element_name, + gpointer user_data, + GError **error); + + /* Called for character data */ + /* text is not nul-terminated */ + void (*text) (GMarkupParseContext *context, + const gchar *text, + gsize text_len, + gpointer user_data, + GError **error); + + /* Called for strings that should be re-saved verbatim in this same + * position, but are not otherwise interpretable. At the moment + * this includes comments and processing instructions. + */ + /* text is not nul-terminated. */ + void (*passthrough) (GMarkupParseContext *context, + const gchar *passthrough_text, + gsize text_len, + gpointer user_data, + GError **error); + + /* Called on error, including one set by other + * methods in the vtable. The GError should not be freed. + */ + void (*error) (GMarkupParseContext *context, + GError *error, + gpointer user_data); +}; + +GLIB_AVAILABLE_IN_ALL +GMarkupParseContext *g_markup_parse_context_new (const GMarkupParser *parser, + GMarkupParseFlags flags, + gpointer user_data, + GDestroyNotify user_data_dnotify); +GLIB_AVAILABLE_IN_2_36 +GMarkupParseContext *g_markup_parse_context_ref (GMarkupParseContext *context); +GLIB_AVAILABLE_IN_2_36 +void g_markup_parse_context_unref (GMarkupParseContext *context); +GLIB_AVAILABLE_IN_ALL +void g_markup_parse_context_free (GMarkupParseContext *context); +GLIB_AVAILABLE_IN_ALL +gboolean g_markup_parse_context_parse (GMarkupParseContext *context, + const gchar *text, + gssize text_len, + GError **error); +GLIB_AVAILABLE_IN_ALL +void g_markup_parse_context_push (GMarkupParseContext *context, + const GMarkupParser *parser, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +gpointer g_markup_parse_context_pop (GMarkupParseContext *context); + +GLIB_AVAILABLE_IN_ALL +gboolean g_markup_parse_context_end_parse (GMarkupParseContext *context, + GError **error); +GLIB_AVAILABLE_IN_ALL +const gchar * g_markup_parse_context_get_element (GMarkupParseContext *context); +GLIB_AVAILABLE_IN_ALL +const GSList * g_markup_parse_context_get_element_stack (GMarkupParseContext *context); + +/* For user-constructed error messages, has no precise semantics */ +GLIB_AVAILABLE_IN_ALL +void g_markup_parse_context_get_position (GMarkupParseContext *context, + gint *line_number, + gint *char_number); +GLIB_AVAILABLE_IN_ALL +gpointer g_markup_parse_context_get_user_data (GMarkupParseContext *context); + +/* useful when saving */ +GLIB_AVAILABLE_IN_ALL +gchar* g_markup_escape_text (const gchar *text, + gssize length); + +GLIB_AVAILABLE_IN_ALL +gchar *g_markup_printf_escaped (const char *format, + ...) G_GNUC_PRINTF (1, 2); +GLIB_AVAILABLE_IN_ALL +gchar *g_markup_vprintf_escaped (const char *format, + va_list args) G_GNUC_PRINTF(1, 0); + +typedef enum +{ + G_MARKUP_COLLECT_INVALID, + G_MARKUP_COLLECT_STRING, + G_MARKUP_COLLECT_STRDUP, + G_MARKUP_COLLECT_BOOLEAN, + G_MARKUP_COLLECT_TRISTATE, + + G_MARKUP_COLLECT_OPTIONAL = (1 << 16) +} GMarkupCollectType; + + +/* useful from start_element */ +GLIB_AVAILABLE_IN_ALL +gboolean g_markup_collect_attributes (const gchar *element_name, + const gchar **attribute_names, + const gchar **attribute_values, + GError **error, + GMarkupCollectType first_type, + const gchar *first_attr, + ...); + +G_END_DECLS + +#endif /* __G_MARKUP_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_MESSAGES_H__ +#define __G_MESSAGES_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#include +/* + * Copyright © 2007, 2008 Ryan Lortie + * Copyright © 2009, 2010 Codethink Limited + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + */ + +#ifndef __G_VARIANT_H__ +#define __G_VARIANT_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +/* + * Copyright © 2007, 2008 Ryan Lortie + * Copyright © 2009, 2010 Codethink Limited + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + */ + +#ifndef __G_VARIANT_TYPE_H__ +#define __G_VARIANT_TYPE_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * GVariantType: + * + * A type in the GVariant type system. + * + * Two types may not be compared by value; use g_variant_type_equal() or + * g_variant_type_is_subtype_of(). May be copied using + * g_variant_type_copy() and freed using g_variant_type_free(). + **/ +typedef struct _GVariantType GVariantType; + +/** + * G_VARIANT_TYPE_BOOLEAN: + * + * The type of a value that can be either %TRUE or %FALSE. + **/ +#define G_VARIANT_TYPE_BOOLEAN ((const GVariantType *) "b") + +/** + * G_VARIANT_TYPE_BYTE: + * + * The type of an integer value that can range from 0 to 255. + **/ +#define G_VARIANT_TYPE_BYTE ((const GVariantType *) "y") + +/** + * G_VARIANT_TYPE_INT16: + * + * The type of an integer value that can range from -32768 to 32767. + **/ +#define G_VARIANT_TYPE_INT16 ((const GVariantType *) "n") + +/** + * G_VARIANT_TYPE_UINT16: + * + * The type of an integer value that can range from 0 to 65535. + * There were about this many people living in Toronto in the 1870s. + **/ +#define G_VARIANT_TYPE_UINT16 ((const GVariantType *) "q") + +/** + * G_VARIANT_TYPE_INT32: + * + * The type of an integer value that can range from -2147483648 to + * 2147483647. + **/ +#define G_VARIANT_TYPE_INT32 ((const GVariantType *) "i") + +/** + * G_VARIANT_TYPE_UINT32: + * + * The type of an integer value that can range from 0 to 4294967295. + * That's one number for everyone who was around in the late 1970s. + **/ +#define G_VARIANT_TYPE_UINT32 ((const GVariantType *) "u") + +/** + * G_VARIANT_TYPE_INT64: + * + * The type of an integer value that can range from + * -9223372036854775808 to 9223372036854775807. + **/ +#define G_VARIANT_TYPE_INT64 ((const GVariantType *) "x") + +/** + * G_VARIANT_TYPE_UINT64: + * + * The type of an integer value that can range from 0 + * to 18446744073709551615 (inclusive). That's a really big number, + * but a Rubik's cube can have a bit more than twice as many possible + * positions. + **/ +#define G_VARIANT_TYPE_UINT64 ((const GVariantType *) "t") + +/** + * G_VARIANT_TYPE_DOUBLE: + * + * The type of a double precision IEEE754 floating point number. + * These guys go up to about 1.80e308 (plus and minus) but miss out on + * some numbers in between. In any case, that's far greater than the + * estimated number of fundamental particles in the observable + * universe. + **/ +#define G_VARIANT_TYPE_DOUBLE ((const GVariantType *) "d") + +/** + * G_VARIANT_TYPE_STRING: + * + * The type of a string. "" is a string. %NULL is not a string. + **/ +#define G_VARIANT_TYPE_STRING ((const GVariantType *) "s") + +/** + * G_VARIANT_TYPE_OBJECT_PATH: + * + * The type of a D-Bus object reference. These are strings of a + * specific format used to identify objects at a given destination on + * the bus. + * + * If you are not interacting with D-Bus, then there is no reason to make + * use of this type. If you are, then the D-Bus specification contains a + * precise description of valid object paths. + **/ +#define G_VARIANT_TYPE_OBJECT_PATH ((const GVariantType *) "o") + +/** + * G_VARIANT_TYPE_SIGNATURE: + * + * The type of a D-Bus type signature. These are strings of a specific + * format used as type signatures for D-Bus methods and messages. + * + * If you are not interacting with D-Bus, then there is no reason to make + * use of this type. If you are, then the D-Bus specification contains a + * precise description of valid signature strings. + **/ +#define G_VARIANT_TYPE_SIGNATURE ((const GVariantType *) "g") + +/** + * G_VARIANT_TYPE_VARIANT: + * + * The type of a box that contains any other value (including another + * variant). + **/ +#define G_VARIANT_TYPE_VARIANT ((const GVariantType *) "v") + +/** + * G_VARIANT_TYPE_HANDLE: + * + * The type of a 32bit signed integer value, that by convention, is used + * as an index into an array of file descriptors that are sent alongside + * a D-Bus message. + * + * If you are not interacting with D-Bus, then there is no reason to make + * use of this type. + **/ +#define G_VARIANT_TYPE_HANDLE ((const GVariantType *) "h") + +/** + * G_VARIANT_TYPE_UNIT: + * + * The empty tuple type. Has only one instance. Known also as "triv" + * or "void". + **/ +#define G_VARIANT_TYPE_UNIT ((const GVariantType *) "()") + +/** + * G_VARIANT_TYPE_ANY: + * + * An indefinite type that is a supertype of every type (including + * itself). + **/ +#define G_VARIANT_TYPE_ANY ((const GVariantType *) "*") + +/** + * G_VARIANT_TYPE_BASIC: + * + * An indefinite type that is a supertype of every basic (ie: + * non-container) type. + **/ +#define G_VARIANT_TYPE_BASIC ((const GVariantType *) "?") + +/** + * G_VARIANT_TYPE_MAYBE: + * + * An indefinite type that is a supertype of every maybe type. + **/ +#define G_VARIANT_TYPE_MAYBE ((const GVariantType *) "m*") + +/** + * G_VARIANT_TYPE_ARRAY: + * + * An indefinite type that is a supertype of every array type. + **/ +#define G_VARIANT_TYPE_ARRAY ((const GVariantType *) "a*") + +/** + * G_VARIANT_TYPE_TUPLE: + * + * An indefinite type that is a supertype of every tuple type, + * regardless of the number of items in the tuple. + **/ +#define G_VARIANT_TYPE_TUPLE ((const GVariantType *) "r") + +/** + * G_VARIANT_TYPE_DICT_ENTRY: + * + * An indefinite type that is a supertype of every dictionary entry + * type. + **/ +#define G_VARIANT_TYPE_DICT_ENTRY ((const GVariantType *) "{?*}") + +/** + * G_VARIANT_TYPE_DICTIONARY: + * + * An indefinite type that is a supertype of every dictionary type -- + * that is, any array type that has an element type equal to any + * dictionary entry type. + **/ +#define G_VARIANT_TYPE_DICTIONARY ((const GVariantType *) "a{?*}") + +/** + * G_VARIANT_TYPE_STRING_ARRAY: + * + * The type of an array of strings. + **/ +#define G_VARIANT_TYPE_STRING_ARRAY ((const GVariantType *) "as") + +/** + * G_VARIANT_TYPE_OBJECT_PATH_ARRAY: + * + * The type of an array of object paths. + **/ +#define G_VARIANT_TYPE_OBJECT_PATH_ARRAY ((const GVariantType *) "ao") + +/** + * G_VARIANT_TYPE_BYTESTRING: + * + * The type of an array of bytes. This type is commonly used to pass + * around strings that may not be valid utf8. In that case, the + * convention is that the nul terminator character should be included as + * the last character in the array. + **/ +#define G_VARIANT_TYPE_BYTESTRING ((const GVariantType *) "ay") + +/** + * G_VARIANT_TYPE_BYTESTRING_ARRAY: + * + * The type of an array of byte strings (an array of arrays of bytes). + **/ +#define G_VARIANT_TYPE_BYTESTRING_ARRAY ((const GVariantType *) "aay") + +/** + * G_VARIANT_TYPE_VARDICT: + * + * The type of a dictionary mapping strings to variants (the ubiquitous + * "a{sv}" type). + * + * Since: 2.30 + **/ +#define G_VARIANT_TYPE_VARDICT ((const GVariantType *) "a{sv}") + + +/** + * G_VARIANT_TYPE: + * @type_string: a well-formed #GVariantType type string + * + * Converts a string to a const #GVariantType. Depending on the + * current debugging level, this function may perform a runtime check + * to ensure that @string is a valid GVariant type string. + * + * It is always a programmer error to use this macro with an invalid + * type string. If in doubt, use g_variant_type_string_is_valid() to + * check if the string is valid. + * + * Since 2.24 + **/ +#ifndef G_DISABLE_CHECKS +# define G_VARIANT_TYPE(type_string) (g_variant_type_checked_ ((type_string))) +#else +# define G_VARIANT_TYPE(type_string) ((const GVariantType *) (type_string)) +#endif + +/* type string checking */ +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_type_string_is_valid (const gchar *type_string); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_type_string_scan (const gchar *string, + const gchar *limit, + const gchar **endptr); + +/* create/destroy */ +GLIB_AVAILABLE_IN_ALL +void g_variant_type_free (GVariantType *type); +GLIB_AVAILABLE_IN_ALL +GVariantType * g_variant_type_copy (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +GVariantType * g_variant_type_new (const gchar *type_string); + +/* getters */ +GLIB_AVAILABLE_IN_ALL +gsize g_variant_type_get_string_length (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +const gchar * g_variant_type_peek_string (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +gchar * g_variant_type_dup_string (const GVariantType *type); + +/* classification */ +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_type_is_definite (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_type_is_container (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_type_is_basic (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_type_is_maybe (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_type_is_array (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_type_is_tuple (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_type_is_dict_entry (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_type_is_variant (const GVariantType *type); + +/* for hash tables */ +GLIB_AVAILABLE_IN_ALL +guint g_variant_type_hash (gconstpointer type); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_type_equal (gconstpointer type1, + gconstpointer type2); + +/* subtypes */ +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_type_is_subtype_of (const GVariantType *type, + const GVariantType *supertype); + +/* type iterator interface */ +GLIB_AVAILABLE_IN_ALL +const GVariantType * g_variant_type_element (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +const GVariantType * g_variant_type_first (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +const GVariantType * g_variant_type_next (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +gsize g_variant_type_n_items (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +const GVariantType * g_variant_type_key (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +const GVariantType * g_variant_type_value (const GVariantType *type); + +/* constructors */ +GLIB_AVAILABLE_IN_ALL +GVariantType * g_variant_type_new_array (const GVariantType *element); +GLIB_AVAILABLE_IN_ALL +GVariantType * g_variant_type_new_maybe (const GVariantType *element); +GLIB_AVAILABLE_IN_ALL +GVariantType * g_variant_type_new_tuple (const GVariantType * const *items, + gint length); +GLIB_AVAILABLE_IN_ALL +GVariantType * g_variant_type_new_dict_entry (const GVariantType *key, + const GVariantType *value); + +/*< private >*/ +GLIB_AVAILABLE_IN_ALL +const GVariantType * g_variant_type_checked_ (const gchar *); +GLIB_AVAILABLE_IN_2_60 +gsize g_variant_type_string_get_depth_ (const gchar *type_string); + +G_END_DECLS + +#endif /* __G_VARIANT_TYPE_H__ */ + +G_BEGIN_DECLS + +typedef struct _GVariant GVariant; + +typedef enum +{ + G_VARIANT_CLASS_BOOLEAN = 'b', + G_VARIANT_CLASS_BYTE = 'y', + G_VARIANT_CLASS_INT16 = 'n', + G_VARIANT_CLASS_UINT16 = 'q', + G_VARIANT_CLASS_INT32 = 'i', + G_VARIANT_CLASS_UINT32 = 'u', + G_VARIANT_CLASS_INT64 = 'x', + G_VARIANT_CLASS_UINT64 = 't', + G_VARIANT_CLASS_HANDLE = 'h', + G_VARIANT_CLASS_DOUBLE = 'd', + G_VARIANT_CLASS_STRING = 's', + G_VARIANT_CLASS_OBJECT_PATH = 'o', + G_VARIANT_CLASS_SIGNATURE = 'g', + G_VARIANT_CLASS_VARIANT = 'v', + G_VARIANT_CLASS_MAYBE = 'm', + G_VARIANT_CLASS_ARRAY = 'a', + G_VARIANT_CLASS_TUPLE = '(', + G_VARIANT_CLASS_DICT_ENTRY = '{' +} GVariantClass; + +GLIB_AVAILABLE_IN_ALL +void g_variant_unref (GVariant *value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_ref (GVariant *value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_ref_sink (GVariant *value); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_is_floating (GVariant *value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_take_ref (GVariant *value); + +GLIB_AVAILABLE_IN_ALL +const GVariantType * g_variant_get_type (GVariant *value); +GLIB_AVAILABLE_IN_ALL +const gchar * g_variant_get_type_string (GVariant *value); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_is_of_type (GVariant *value, + const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_is_container (GVariant *value); +GLIB_AVAILABLE_IN_ALL +GVariantClass g_variant_classify (GVariant *value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_boolean (gboolean value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_byte (guint8 value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_int16 (gint16 value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_uint16 (guint16 value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_int32 (gint32 value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_uint32 (guint32 value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_int64 (gint64 value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_uint64 (guint64 value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_handle (gint32 value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_double (gdouble value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_string (const gchar *string); +GLIB_AVAILABLE_IN_2_38 +GVariant * g_variant_new_take_string (gchar *string); +GLIB_AVAILABLE_IN_2_38 +GVariant * g_variant_new_printf (const gchar *format_string, + ...) G_GNUC_PRINTF (1, 2); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_object_path (const gchar *object_path); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_is_object_path (const gchar *string); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_signature (const gchar *signature); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_is_signature (const gchar *string); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_variant (GVariant *value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_strv (const gchar * const *strv, + gssize length); +GLIB_AVAILABLE_IN_2_30 +GVariant * g_variant_new_objv (const gchar * const *strv, + gssize length); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_bytestring (const gchar *string); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_bytestring_array (const gchar * const *strv, + gssize length); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_fixed_array (const GVariantType *element_type, + gconstpointer elements, + gsize n_elements, + gsize element_size); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_get_boolean (GVariant *value); +GLIB_AVAILABLE_IN_ALL +guint8 g_variant_get_byte (GVariant *value); +GLIB_AVAILABLE_IN_ALL +gint16 g_variant_get_int16 (GVariant *value); +GLIB_AVAILABLE_IN_ALL +guint16 g_variant_get_uint16 (GVariant *value); +GLIB_AVAILABLE_IN_ALL +gint32 g_variant_get_int32 (GVariant *value); +GLIB_AVAILABLE_IN_ALL +guint32 g_variant_get_uint32 (GVariant *value); +GLIB_AVAILABLE_IN_ALL +gint64 g_variant_get_int64 (GVariant *value); +GLIB_AVAILABLE_IN_ALL +guint64 g_variant_get_uint64 (GVariant *value); +GLIB_AVAILABLE_IN_ALL +gint32 g_variant_get_handle (GVariant *value); +GLIB_AVAILABLE_IN_ALL +gdouble g_variant_get_double (GVariant *value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_get_variant (GVariant *value); +GLIB_AVAILABLE_IN_ALL +const gchar * g_variant_get_string (GVariant *value, + gsize *length); +GLIB_AVAILABLE_IN_ALL +gchar * g_variant_dup_string (GVariant *value, + gsize *length); +GLIB_AVAILABLE_IN_ALL +const gchar ** g_variant_get_strv (GVariant *value, + gsize *length); +GLIB_AVAILABLE_IN_ALL +gchar ** g_variant_dup_strv (GVariant *value, + gsize *length); +GLIB_AVAILABLE_IN_2_30 +const gchar ** g_variant_get_objv (GVariant *value, + gsize *length); +GLIB_AVAILABLE_IN_ALL +gchar ** g_variant_dup_objv (GVariant *value, + gsize *length); +GLIB_AVAILABLE_IN_ALL +const gchar * g_variant_get_bytestring (GVariant *value); +GLIB_AVAILABLE_IN_ALL +gchar * g_variant_dup_bytestring (GVariant *value, + gsize *length); +GLIB_AVAILABLE_IN_ALL +const gchar ** g_variant_get_bytestring_array (GVariant *value, + gsize *length); +GLIB_AVAILABLE_IN_ALL +gchar ** g_variant_dup_bytestring_array (GVariant *value, + gsize *length); + +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_maybe (const GVariantType *child_type, + GVariant *child); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_array (const GVariantType *child_type, + GVariant * const *children, + gsize n_children); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_tuple (GVariant * const *children, + gsize n_children); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_dict_entry (GVariant *key, + GVariant *value); + +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_get_maybe (GVariant *value); +GLIB_AVAILABLE_IN_ALL +gsize g_variant_n_children (GVariant *value); +GLIB_AVAILABLE_IN_ALL +void g_variant_get_child (GVariant *value, + gsize index_, + const gchar *format_string, + ...); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_get_child_value (GVariant *value, + gsize index_); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_lookup (GVariant *dictionary, + const gchar *key, + const gchar *format_string, + ...); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_lookup_value (GVariant *dictionary, + const gchar *key, + const GVariantType *expected_type); +GLIB_AVAILABLE_IN_ALL +gconstpointer g_variant_get_fixed_array (GVariant *value, + gsize *n_elements, + gsize element_size); + +GLIB_AVAILABLE_IN_ALL +gsize g_variant_get_size (GVariant *value); +GLIB_AVAILABLE_IN_ALL +gconstpointer g_variant_get_data (GVariant *value); +GLIB_AVAILABLE_IN_2_36 +GBytes * g_variant_get_data_as_bytes (GVariant *value); +GLIB_AVAILABLE_IN_ALL +void g_variant_store (GVariant *value, + gpointer data); + +GLIB_AVAILABLE_IN_ALL +gchar * g_variant_print (GVariant *value, + gboolean type_annotate); +GLIB_AVAILABLE_IN_ALL +GString * g_variant_print_string (GVariant *value, + GString *string, + gboolean type_annotate); + +GLIB_AVAILABLE_IN_ALL +guint g_variant_hash (gconstpointer value); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_equal (gconstpointer one, + gconstpointer two); + +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_get_normal_form (GVariant *value); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_is_normal_form (GVariant *value); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_byteswap (GVariant *value); + +GLIB_AVAILABLE_IN_2_36 +GVariant * g_variant_new_from_bytes (const GVariantType *type, + GBytes *bytes, + gboolean trusted); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_from_data (const GVariantType *type, + gconstpointer data, + gsize size, + gboolean trusted, + GDestroyNotify notify, + gpointer user_data); + +typedef struct _GVariantIter GVariantIter; +struct _GVariantIter { + /*< private >*/ + gsize x[16]; +}; + +GLIB_AVAILABLE_IN_ALL +GVariantIter * g_variant_iter_new (GVariant *value); +GLIB_AVAILABLE_IN_ALL +gsize g_variant_iter_init (GVariantIter *iter, + GVariant *value); +GLIB_AVAILABLE_IN_ALL +GVariantIter * g_variant_iter_copy (GVariantIter *iter); +GLIB_AVAILABLE_IN_ALL +gsize g_variant_iter_n_children (GVariantIter *iter); +GLIB_AVAILABLE_IN_ALL +void g_variant_iter_free (GVariantIter *iter); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_iter_next_value (GVariantIter *iter); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_iter_next (GVariantIter *iter, + const gchar *format_string, + ...); +GLIB_AVAILABLE_IN_ALL +gboolean g_variant_iter_loop (GVariantIter *iter, + const gchar *format_string, + ...); + + +typedef struct _GVariantBuilder GVariantBuilder; +struct _GVariantBuilder { + /*< private >*/ + union + { + struct { + gsize partial_magic; + const GVariantType *type; + gsize y[14]; + } s; + gsize x[16]; + } u; +}; + +typedef enum +{ + G_VARIANT_PARSE_ERROR_FAILED, + G_VARIANT_PARSE_ERROR_BASIC_TYPE_EXPECTED, + G_VARIANT_PARSE_ERROR_CANNOT_INFER_TYPE, + G_VARIANT_PARSE_ERROR_DEFINITE_TYPE_EXPECTED, + G_VARIANT_PARSE_ERROR_INPUT_NOT_AT_END, + G_VARIANT_PARSE_ERROR_INVALID_CHARACTER, + G_VARIANT_PARSE_ERROR_INVALID_FORMAT_STRING, + G_VARIANT_PARSE_ERROR_INVALID_OBJECT_PATH, + G_VARIANT_PARSE_ERROR_INVALID_SIGNATURE, + G_VARIANT_PARSE_ERROR_INVALID_TYPE_STRING, + G_VARIANT_PARSE_ERROR_NO_COMMON_TYPE, + G_VARIANT_PARSE_ERROR_NUMBER_OUT_OF_RANGE, + G_VARIANT_PARSE_ERROR_NUMBER_TOO_BIG, + G_VARIANT_PARSE_ERROR_TYPE_ERROR, + G_VARIANT_PARSE_ERROR_UNEXPECTED_TOKEN, + G_VARIANT_PARSE_ERROR_UNKNOWN_KEYWORD, + G_VARIANT_PARSE_ERROR_UNTERMINATED_STRING_CONSTANT, + G_VARIANT_PARSE_ERROR_VALUE_EXPECTED, + G_VARIANT_PARSE_ERROR_RECURSION +} GVariantParseError; +#define G_VARIANT_PARSE_ERROR (g_variant_parse_error_quark ()) + +GLIB_DEPRECATED_IN_2_38_FOR(g_variant_parse_error_quark) +GQuark g_variant_parser_get_error_quark (void); + +GLIB_AVAILABLE_IN_ALL +GQuark g_variant_parse_error_quark (void); + +/** + * G_VARIANT_BUILDER_INIT: + * @variant_type: a const GVariantType* + * + * A stack-allocated #GVariantBuilder must be initialized if it is + * used together with g_auto() to avoid warnings or crashes if + * function returns before g_variant_builder_init() is called on the + * builder. This macro can be used as initializer instead of an + * explicit zeroing a variable when declaring it and a following + * g_variant_builder_init(), but it cannot be assigned to a variable. + * + * The passed @variant_type should be a static GVariantType to avoid + * lifetime issues, as copying the @variant_type does not happen in + * the G_VARIANT_BUILDER_INIT() call, but rather in functions that + * make sure that #GVariantBuilder is valid. + * + * |[ + * g_auto(GVariantBuilder) builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_BYTESTRING); + * ]| + * + * Since: 2.50 + */ +#define G_VARIANT_BUILDER_INIT(variant_type) { { { 2942751021u, variant_type, { 0, } } } } + +GLIB_AVAILABLE_IN_ALL +GVariantBuilder * g_variant_builder_new (const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +void g_variant_builder_unref (GVariantBuilder *builder); +GLIB_AVAILABLE_IN_ALL +GVariantBuilder * g_variant_builder_ref (GVariantBuilder *builder); +GLIB_AVAILABLE_IN_ALL +void g_variant_builder_init (GVariantBuilder *builder, + const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_builder_end (GVariantBuilder *builder); +GLIB_AVAILABLE_IN_ALL +void g_variant_builder_clear (GVariantBuilder *builder); +GLIB_AVAILABLE_IN_ALL +void g_variant_builder_open (GVariantBuilder *builder, + const GVariantType *type); +GLIB_AVAILABLE_IN_ALL +void g_variant_builder_close (GVariantBuilder *builder); +GLIB_AVAILABLE_IN_ALL +void g_variant_builder_add_value (GVariantBuilder *builder, + GVariant *value); +GLIB_AVAILABLE_IN_ALL +void g_variant_builder_add (GVariantBuilder *builder, + const gchar *format_string, + ...); +GLIB_AVAILABLE_IN_ALL +void g_variant_builder_add_parsed (GVariantBuilder *builder, + const gchar *format, + ...); + +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new (const gchar *format_string, + ...); +GLIB_AVAILABLE_IN_ALL +void g_variant_get (GVariant *value, + const gchar *format_string, + ...); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_va (const gchar *format_string, + const gchar **endptr, + va_list *app); +GLIB_AVAILABLE_IN_ALL +void g_variant_get_va (GVariant *value, + const gchar *format_string, + const gchar **endptr, + va_list *app); +GLIB_AVAILABLE_IN_2_34 +gboolean g_variant_check_format_string (GVariant *value, + const gchar *format_string, + gboolean copy_only); + +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_parse (const GVariantType *type, + const gchar *text, + const gchar *limit, + const gchar **endptr, + GError **error); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_parsed (const gchar *format, + ...); +GLIB_AVAILABLE_IN_ALL +GVariant * g_variant_new_parsed_va (const gchar *format, + va_list *app); + +GLIB_AVAILABLE_IN_2_40 +gchar * g_variant_parse_error_print_context (GError *error, + const gchar *source_str); + +GLIB_AVAILABLE_IN_ALL +gint g_variant_compare (gconstpointer one, + gconstpointer two); + +typedef struct _GVariantDict GVariantDict; +struct _GVariantDict { + /*< private >*/ + union + { + struct { + GVariant *asv; + gsize partial_magic; + gsize y[14]; + } s; + gsize x[16]; + } u; +}; + +/** + * G_VARIANT_DICT_INIT: + * @asv: (nullable): a GVariant* + * + * A stack-allocated #GVariantDict must be initialized if it is used + * together with g_auto() to avoid warnings or crashes if function + * returns before g_variant_dict_init() is called on the builder. + * This macro can be used as initializer instead of an explicit + * zeroing a variable when declaring it and a following + * g_variant_dict_init(), but it cannot be assigned to a variable. + * + * The passed @asv has to live long enough for #GVariantDict to gather + * the entries from, as the gathering does not happen in the + * G_VARIANT_DICT_INIT() call, but rather in functions that make sure + * that #GVariantDict is valid. In context where the initialization + * value has to be a constant expression, the only possible value of + * @asv is %NULL. It is still possible to call g_variant_dict_init() + * safely with a different @asv right after the variable was + * initialized with G_VARIANT_DICT_INIT(). + * + * |[ + * g_autoptr(GVariant) variant = get_asv_variant (); + * g_auto(GVariantDict) dict = G_VARIANT_DICT_INIT (variant); + * ]| + * + * Since: 2.50 + */ +#define G_VARIANT_DICT_INIT(asv) { { { asv, 3488698669u, { 0, } } } } + +GLIB_AVAILABLE_IN_2_40 +GVariantDict * g_variant_dict_new (GVariant *from_asv); + +GLIB_AVAILABLE_IN_2_40 +void g_variant_dict_init (GVariantDict *dict, + GVariant *from_asv); + +GLIB_AVAILABLE_IN_2_40 +gboolean g_variant_dict_lookup (GVariantDict *dict, + const gchar *key, + const gchar *format_string, + ...); +GLIB_AVAILABLE_IN_2_40 +GVariant * g_variant_dict_lookup_value (GVariantDict *dict, + const gchar *key, + const GVariantType *expected_type); +GLIB_AVAILABLE_IN_2_40 +gboolean g_variant_dict_contains (GVariantDict *dict, + const gchar *key); +GLIB_AVAILABLE_IN_2_40 +void g_variant_dict_insert (GVariantDict *dict, + const gchar *key, + const gchar *format_string, + ...); +GLIB_AVAILABLE_IN_2_40 +void g_variant_dict_insert_value (GVariantDict *dict, + const gchar *key, + GVariant *value); +GLIB_AVAILABLE_IN_2_40 +gboolean g_variant_dict_remove (GVariantDict *dict, + const gchar *key); +GLIB_AVAILABLE_IN_2_40 +void g_variant_dict_clear (GVariantDict *dict); +GLIB_AVAILABLE_IN_2_40 +GVariant * g_variant_dict_end (GVariantDict *dict); +GLIB_AVAILABLE_IN_2_40 +GVariantDict * g_variant_dict_ref (GVariantDict *dict); +GLIB_AVAILABLE_IN_2_40 +void g_variant_dict_unref (GVariantDict *dict); + +G_END_DECLS + +#endif /* __G_VARIANT_H__ */ + +G_BEGIN_DECLS + +/* calculate a string size, guaranteed to fit format + args. + */ +GLIB_AVAILABLE_IN_ALL +gsize g_printf_string_upper_bound (const gchar* format, + va_list args) G_GNUC_PRINTF(1, 0); + +/* Log level shift offset for user defined + * log levels (0-7 are used by GLib). + */ +#define G_LOG_LEVEL_USER_SHIFT (8) + +/* Glib log levels and flags. + */ +typedef enum +{ + /* log flags */ + G_LOG_FLAG_RECURSION = 1 << 0, + G_LOG_FLAG_FATAL = 1 << 1, + + /* GLib log levels */ + G_LOG_LEVEL_ERROR = 1 << 2, /* always fatal */ + G_LOG_LEVEL_CRITICAL = 1 << 3, + G_LOG_LEVEL_WARNING = 1 << 4, + G_LOG_LEVEL_MESSAGE = 1 << 5, + G_LOG_LEVEL_INFO = 1 << 6, + G_LOG_LEVEL_DEBUG = 1 << 7, + + G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL) +} GLogLevelFlags; + +/* GLib log levels that are considered fatal by default */ +#define G_LOG_FATAL_MASK (G_LOG_FLAG_RECURSION | G_LOG_LEVEL_ERROR) + +typedef void (*GLogFunc) (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer user_data); + +/* Logging mechanism + */ +GLIB_AVAILABLE_IN_ALL +guint g_log_set_handler (const gchar *log_domain, + GLogLevelFlags log_levels, + GLogFunc log_func, + gpointer user_data); +GLIB_AVAILABLE_IN_2_46 +guint g_log_set_handler_full (const gchar *log_domain, + GLogLevelFlags log_levels, + GLogFunc log_func, + gpointer user_data, + GDestroyNotify destroy); +GLIB_AVAILABLE_IN_ALL +void g_log_remove_handler (const gchar *log_domain, + guint handler_id); +GLIB_AVAILABLE_IN_ALL +void g_log_default_handler (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer unused_data); +GLIB_AVAILABLE_IN_ALL +GLogFunc g_log_set_default_handler (GLogFunc log_func, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +void g_log (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *format, + ...) G_GNUC_PRINTF (3, 4); +GLIB_AVAILABLE_IN_ALL +void g_logv (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *format, + va_list args) G_GNUC_PRINTF(3, 0); +GLIB_AVAILABLE_IN_ALL +GLogLevelFlags g_log_set_fatal_mask (const gchar *log_domain, + GLogLevelFlags fatal_mask); +GLIB_AVAILABLE_IN_ALL +GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); + +/* Structured logging mechanism. */ + +/** + * GLogWriterOutput: + * @G_LOG_WRITER_HANDLED: Log writer has handled the log entry. + * @G_LOG_WRITER_UNHANDLED: Log writer could not handle the log entry. + * + * Return values from #GLogWriterFuncs to indicate whether the given log entry + * was successfully handled by the writer, or whether there was an error in + * handling it (and hence a fallback writer should be used). + * + * If a #GLogWriterFunc ignores a log entry, it should return + * %G_LOG_WRITER_HANDLED. + * + * Since: 2.50 + */ +typedef enum +{ + G_LOG_WRITER_HANDLED = 1, + G_LOG_WRITER_UNHANDLED = 0, +} GLogWriterOutput; + +/** + * GLogField: + * @key: field name (UTF-8 string) + * @value: field value (arbitrary bytes) + * @length: length of @value, in bytes, or -1 if it is nul-terminated + * + * Structure representing a single field in a structured log entry. See + * g_log_structured() for details. + * + * Log fields may contain arbitrary values, including binary with embedded nul + * bytes. If the field contains a string, the string must be UTF-8 encoded and + * have a trailing nul byte. Otherwise, @length must be set to a non-negative + * value. + * + * Since: 2.50 + */ +typedef struct _GLogField GLogField; +struct _GLogField +{ + const gchar *key; + gconstpointer value; + gssize length; +}; + +/** + * GLogWriterFunc: + * @log_level: log level of the message + * @fields: (array length=n_fields): fields forming the message + * @n_fields: number of @fields + * @user_data: user data passed to g_log_set_writer_func() + * + * Writer function for log entries. A log entry is a collection of one or more + * #GLogFields, using the standard [field names from journal + * specification](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html). + * See g_log_structured() for more information. + * + * Writer functions must ignore fields which they do not recognise, unless they + * can write arbitrary binary output, as field values may be arbitrary binary. + * + * @log_level is guaranteed to be included in @fields as the `PRIORITY` field, + * but is provided separately for convenience of deciding whether or where to + * output the log entry. + * + * Writer functions should return %G_LOG_WRITER_HANDLED if they handled the log + * message successfully or if they deliberately ignored it. If there was an + * error handling the message (for example, if the writer function is meant to + * send messages to a remote logging server and there is a network error), it + * should return %G_LOG_WRITER_UNHANDLED. This allows writer functions to be + * chained and fall back to simpler handlers in case of failure. + * + * Returns: %G_LOG_WRITER_HANDLED if the log entry was handled successfully; + * %G_LOG_WRITER_UNHANDLED otherwise + * Since: 2.50 + */ +typedef GLogWriterOutput (*GLogWriterFunc) (GLogLevelFlags log_level, + const GLogField *fields, + gsize n_fields, + gpointer user_data); + +GLIB_AVAILABLE_IN_2_50 +void g_log_structured (const gchar *log_domain, + GLogLevelFlags log_level, + ...); +GLIB_AVAILABLE_IN_2_50 +void g_log_structured_array (GLogLevelFlags log_level, + const GLogField *fields, + gsize n_fields); + +GLIB_AVAILABLE_IN_2_50 +void g_log_variant (const gchar *log_domain, + GLogLevelFlags log_level, + GVariant *fields); + +GLIB_AVAILABLE_IN_2_50 +void g_log_set_writer_func (GLogWriterFunc func, + gpointer user_data, + GDestroyNotify user_data_free); + +GLIB_AVAILABLE_IN_2_50 +gboolean g_log_writer_supports_color (gint output_fd); +GLIB_AVAILABLE_IN_2_50 +gboolean g_log_writer_is_journald (gint output_fd); + +GLIB_AVAILABLE_IN_2_50 +gchar *g_log_writer_format_fields (GLogLevelFlags log_level, + const GLogField *fields, + gsize n_fields, + gboolean use_color); + +GLIB_AVAILABLE_IN_2_50 +GLogWriterOutput g_log_writer_journald (GLogLevelFlags log_level, + const GLogField *fields, + gsize n_fields, + gpointer user_data); +GLIB_AVAILABLE_IN_2_50 +GLogWriterOutput g_log_writer_standard_streams (GLogLevelFlags log_level, + const GLogField *fields, + gsize n_fields, + gpointer user_data); +GLIB_AVAILABLE_IN_2_50 +GLogWriterOutput g_log_writer_default (GLogLevelFlags log_level, + const GLogField *fields, + gsize n_fields, + gpointer user_data); + +GLIB_AVAILABLE_IN_2_68 +void g_log_writer_default_set_use_stderr (gboolean use_stderr); +GLIB_AVAILABLE_IN_2_68 +gboolean g_log_writer_default_would_drop (GLogLevelFlags log_level, + const char *log_domain); + +/** + * G_DEBUG_HERE: + * + * A convenience form of g_log_structured(), recommended to be added to + * functions when debugging. It prints the current monotonic time and the code + * location using %G_STRLOC. + * + * Since: 2.50 + */ +#define G_DEBUG_HERE() \ + g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ + "CODE_FILE", __FILE__, \ + "CODE_LINE", G_STRINGIFY (__LINE__), \ + "CODE_FUNC", G_STRFUNC, \ + "MESSAGE", "%" G_GINT64_FORMAT ": %s", \ + g_get_monotonic_time (), G_STRLOC) + +/* internal */ +void _g_log_fallback_handler (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer unused_data); + +/* Internal functions, used to implement the following macros */ +GLIB_AVAILABLE_IN_ALL +void g_return_if_fail_warning (const char *log_domain, + const char *pretty_function, + const char *expression) G_ANALYZER_NORETURN; +GLIB_AVAILABLE_IN_ALL +void g_warn_message (const char *domain, + const char *file, + int line, + const char *func, + const char *warnexpr) G_ANALYZER_NORETURN; +GLIB_DEPRECATED +G_NORETURN +void g_assert_warning (const char *log_domain, + const char *file, + const int line, + const char *pretty_function, + const char *expression); + +GLIB_AVAILABLE_IN_2_56 +void g_log_structured_standard (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *file, + const gchar *line, + const gchar *func, + const gchar *message_format, + ...) G_GNUC_PRINTF (6, 7); + +#ifndef G_LOG_DOMAIN +#define G_LOG_DOMAIN ((gchar*) 0) +#endif /* G_LOG_DOMAIN */ + +#if defined(G_HAVE_ISO_VARARGS) && !G_ANALYZER_ANALYZING +#if defined(G_LOG_USE_STRUCTURED) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56 +#define g_error(...) G_STMT_START { \ + g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \ + __FILE__, G_STRINGIFY (__LINE__), \ + G_STRFUNC, __VA_ARGS__); \ + for (;;) ; \ + } G_STMT_END +#define g_message(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, \ + __FILE__, G_STRINGIFY (__LINE__), \ + G_STRFUNC, __VA_ARGS__) +#define g_critical(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ + __FILE__, G_STRINGIFY (__LINE__), \ + G_STRFUNC, __VA_ARGS__) +#define g_warning(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \ + __FILE__, G_STRINGIFY (__LINE__), \ + G_STRFUNC, __VA_ARGS__) +#define g_info(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \ + __FILE__, G_STRINGIFY (__LINE__), \ + G_STRFUNC, __VA_ARGS__) +#define g_debug(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ + __FILE__, G_STRINGIFY (__LINE__), \ + G_STRFUNC, __VA_ARGS__) +#else +/* for(;;) ; so that GCC knows that control doesn't go past g_error(). + * Put space before ending semicolon to avoid C++ build warnings. + */ +#define g_error(...) G_STMT_START { \ + g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_ERROR, \ + __VA_ARGS__); \ + for (;;) ; \ + } G_STMT_END +#define g_message(...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_MESSAGE, \ + __VA_ARGS__) +#define g_critical(...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_CRITICAL, \ + __VA_ARGS__) +#define g_warning(...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_WARNING, \ + __VA_ARGS__) +#define g_info(...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_INFO, \ + __VA_ARGS__) +#define g_debug(...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_DEBUG, \ + __VA_ARGS__) +#endif +#elif defined(G_HAVE_GNUC_VARARGS) && !G_ANALYZER_ANALYZING +#if defined(G_LOG_USE_STRUCTURED) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56 +#define g_error(format...) G_STMT_START { \ + g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \ + __FILE__, G_STRINGIFY (__LINE__), \ + G_STRFUNC, format); \ + for (;;) ; \ + } G_STMT_END +#define g_message(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, \ + __FILE__, G_STRINGIFY (__LINE__), \ + G_STRFUNC, format) +#define g_critical(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ + __FILE__, G_STRINGIFY (__LINE__), \ + G_STRFUNC, format) +#define g_warning(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \ + __FILE__, G_STRINGIFY (__LINE__), \ + G_STRFUNC, format) +#define g_info(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \ + __FILE__, G_STRINGIFY (__LINE__), \ + G_STRFUNC, format) +#define g_debug(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ + __FILE__, G_STRINGIFY (__LINE__), \ + G_STRFUNC, format) +#else +#define g_error(format...) G_STMT_START { \ + g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_ERROR, \ + format); \ + for (;;) ; \ + } G_STMT_END + +#define g_message(format...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_MESSAGE, \ + format) +#define g_critical(format...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_CRITICAL, \ + format) +#define g_warning(format...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_WARNING, \ + format) +#define g_info(format...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_INFO, \ + format) +#define g_debug(format...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_DEBUG, \ + format) +#endif +#else /* no varargs macros */ +static G_NORETURN void g_error (const gchar *format, ...) G_ANALYZER_NORETURN; +static void g_critical (const gchar *format, ...) G_ANALYZER_NORETURN; + +static inline void +g_error (const gchar *format, + ...) +{ + va_list args; + va_start (args, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args); + va_end (args); + + for(;;) ; +} +static inline void +g_message (const gchar *format, + ...) +{ + va_list args; + va_start (args, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, args); + va_end (args); +} +static inline void +g_critical (const gchar *format, + ...) +{ + va_list args; + va_start (args, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, format, args); + va_end (args); +} +static inline void +g_warning (const gchar *format, + ...) +{ + va_list args; + va_start (args, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format, args); + va_end (args); +} +static inline void +g_info (const gchar *format, + ...) +{ + va_list args; + va_start (args, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format, args); + va_end (args); +} +static inline void +g_debug (const gchar *format, + ...) +{ + va_list args; + va_start (args, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, args); + va_end (args); +} +#endif /* !__GNUC__ */ + +/** + * g_warning_once: + * @...: format string, followed by parameters to insert + * into the format string (as with printf()) + * + * Logs a warning only once. + * + * g_warning_once() calls g_warning() with the passed message the first time + * the statement is executed; subsequent times it is a no-op. + * + * Note! On platforms where the compiler doesn't support variadic macros, the + * warning is printed each time instead of only once. + * + * Since: 2.64 + */ +#if defined(G_HAVE_ISO_VARARGS) && !G_ANALYZER_ANALYZING +#define g_warning_once(...) \ + G_STMT_START { \ + static int G_PASTE (_GWarningOnceBoolean, __LINE__) = 0; /* (atomic) */ \ + if (g_atomic_int_compare_and_exchange (&G_PASTE (_GWarningOnceBoolean, __LINE__), \ + 0, 1)) \ + g_warning (__VA_ARGS__); \ + } G_STMT_END \ + GLIB_AVAILABLE_MACRO_IN_2_64 +#elif defined(G_HAVE_GNUC_VARARGS) && !G_ANALYZER_ANALYZING +#define g_warning_once(format...) \ + G_STMT_START { \ + static int G_PASTE (_GWarningOnceBoolean, __LINE__) = 0; /* (atomic) */ \ + if (g_atomic_int_compare_and_exchange (&G_PASTE (_GWarningOnceBoolean, __LINE__), \ + 0, 1)) \ + g_warning (format); \ + } G_STMT_END \ + GLIB_AVAILABLE_MACRO_IN_2_64 +#else +#define g_warning_once g_warning +#endif + +/** + * GPrintFunc: + * @string: the message to output + * + * Specifies the type of the print handler functions. + * These are called with the complete formatted string to output. + */ +typedef void (*GPrintFunc) (const gchar *string); +GLIB_AVAILABLE_IN_ALL +void g_print (const gchar *format, + ...) G_GNUC_PRINTF (1, 2); +GLIB_AVAILABLE_IN_ALL +GPrintFunc g_set_print_handler (GPrintFunc func); +GLIB_AVAILABLE_IN_ALL +void g_printerr (const gchar *format, + ...) G_GNUC_PRINTF (1, 2); +GLIB_AVAILABLE_IN_ALL +GPrintFunc g_set_printerr_handler (GPrintFunc func); + +/** + * g_warn_if_reached: + * + * Logs a warning. + * + * Since: 2.16 + */ +#define g_warn_if_reached() \ + do { \ + g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); \ + } while (0) + +/** + * g_warn_if_fail: + * @expr: the expression to check + * + * Logs a warning if the expression is not true. + * + * Since: 2.16 + */ +#define g_warn_if_fail(expr) \ + do { \ + if G_LIKELY (expr) ; \ + else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, #expr); \ + } while (0) + +#ifdef G_DISABLE_CHECKS + +/** + * g_return_if_fail: + * @expr: the expression to check + * + * Verifies that the expression @expr, usually representing a precondition, + * evaluates to %TRUE. If the function returns a value, use + * g_return_val_if_fail() instead. + * + * If @expr evaluates to %FALSE, the current function should be considered to + * have undefined behaviour (a programmer error). The only correct solution + * to such an error is to change the module that is calling the current + * function, so that it avoids this incorrect call. + * + * To make this undefined behaviour visible, if @expr evaluates to %FALSE, + * the result is usually that a critical message is logged and the current + * function returns. + * + * If `G_DISABLE_CHECKS` is defined then the check is not performed. You + * should therefore not depend on any side effects of @expr. + * + * To debug failure of a g_return_if_fail() check, run the code under a debugger + * with `G_DEBUG=fatal-criticals` or `G_DEBUG=fatal-warnings` defined in the + * environment (see [Running GLib Applications](glib-running.html)): + * + * |[ + * G_DEBUG=fatal-warnings gdb ./my-program + * ]| + * + * Any unrelated failures can be skipped over in + * [gdb](https://www.gnu.org/software/gdb/) using the `continue` command. + */ +#define g_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END + +/** + * g_return_val_if_fail: + * @expr: the expression to check + * @val: the value to return from the current function + * if the expression is not true + * + * Verifies that the expression @expr, usually representing a precondition, + * evaluates to %TRUE. If the function does not return a value, use + * g_return_if_fail() instead. + * + * If @expr evaluates to %FALSE, the current function should be considered to + * have undefined behaviour (a programmer error). The only correct solution + * to such an error is to change the module that is calling the current + * function, so that it avoids this incorrect call. + * + * To make this undefined behaviour visible, if @expr evaluates to %FALSE, + * the result is usually that a critical message is logged and @val is + * returned from the current function. + * + * If `G_DISABLE_CHECKS` is defined then the check is not performed. You + * should therefore not depend on any side effects of @expr. + * + * See g_return_if_fail() for guidance on how to debug failure of this check. + */ +#define g_return_val_if_fail(expr,val) G_STMT_START{ (void)0; }G_STMT_END + +/** + * g_return_if_reached: + * + * Logs a critical message and returns from the current function. + * This can only be used in functions which do not return a value. + * + * See g_return_if_fail() for guidance on how to debug failure of this check. + */ +#define g_return_if_reached() G_STMT_START{ return; }G_STMT_END + +/** + * g_return_val_if_reached: + * @val: the value to return from the current function + * + * Logs a critical message and returns @val. + * + * See g_return_if_fail() for guidance on how to debug failure of this check. + */ +#define g_return_val_if_reached(val) G_STMT_START{ return (val); }G_STMT_END + +#else /* !G_DISABLE_CHECKS */ + +#define g_return_if_fail(expr) \ + G_STMT_START { \ + if (G_LIKELY (expr)) \ + { } \ + else \ + { \ + g_return_if_fail_warning (G_LOG_DOMAIN, \ + G_STRFUNC, \ + #expr); \ + return; \ + } \ + } G_STMT_END + +#define g_return_val_if_fail(expr, val) \ + G_STMT_START { \ + if (G_LIKELY (expr)) \ + { } \ + else \ + { \ + g_return_if_fail_warning (G_LOG_DOMAIN, \ + G_STRFUNC, \ + #expr); \ + return (val); \ + } \ + } G_STMT_END + +#define g_return_if_reached() \ + G_STMT_START { \ + g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_CRITICAL, \ + "file %s: line %d (%s): should not be reached", \ + __FILE__, \ + __LINE__, \ + G_STRFUNC); \ + return; \ + } G_STMT_END + +#define g_return_val_if_reached(val) \ + G_STMT_START { \ + g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_CRITICAL, \ + "file %s: line %d (%s): should not be reached", \ + __FILE__, \ + __LINE__, \ + G_STRFUNC); \ + return (val); \ + } G_STMT_END + +#endif /* !G_DISABLE_CHECKS */ + +G_END_DECLS + +#endif /* __G_MESSAGES_H__ */ +/* goption.h - Option parser + * + * Copyright (C) 2004 Anders Carlsson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_OPTION_H__ +#define __G_OPTION_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * GOptionContext: + * + * A `GOptionContext` struct defines which options + * are accepted by the commandline option parser. The struct has only private + * fields and should not be directly accessed. + */ +typedef struct _GOptionContext GOptionContext; + +/** + * GOptionGroup: + * + * A `GOptionGroup` struct defines the options in a single + * group. The struct has only private fields and should not be directly accessed. + * + * All options in a group share the same translation function. Libraries which + * need to parse commandline options are expected to provide a function for + * getting a `GOptionGroup` holding their options, which + * the application can then add to its #GOptionContext. + */ +typedef struct _GOptionGroup GOptionGroup; +typedef struct _GOptionEntry GOptionEntry; + +/** + * GOptionFlags: + * @G_OPTION_FLAG_NONE: No flags. Since: 2.42. + * @G_OPTION_FLAG_HIDDEN: The option doesn't appear in `--help` output. + * @G_OPTION_FLAG_IN_MAIN: The option appears in the main section of the + * `--help` output, even if it is defined in a group. + * @G_OPTION_FLAG_REVERSE: For options of the %G_OPTION_ARG_NONE kind, this + * flag indicates that the sense of the option is reversed. + * @G_OPTION_FLAG_NO_ARG: For options of the %G_OPTION_ARG_CALLBACK kind, + * this flag indicates that the callback does not take any argument + * (like a %G_OPTION_ARG_NONE option). Since 2.8 + * @G_OPTION_FLAG_FILENAME: For options of the %G_OPTION_ARG_CALLBACK + * kind, this flag indicates that the argument should be passed to the + * callback in the GLib filename encoding rather than UTF-8. Since 2.8 + * @G_OPTION_FLAG_OPTIONAL_ARG: For options of the %G_OPTION_ARG_CALLBACK + * kind, this flag indicates that the argument supply is optional. + * If no argument is given then data of %GOptionParseFunc will be + * set to NULL. Since 2.8 + * @G_OPTION_FLAG_NOALIAS: This flag turns off the automatic conflict + * resolution which prefixes long option names with `groupname-` if + * there is a conflict. This option should only be used in situations + * where aliasing is necessary to model some legacy commandline interface. + * It is not safe to use this option, unless all option groups are under + * your direct control. Since 2.8. + * + * Flags which modify individual options. + */ +typedef enum +{ + G_OPTION_FLAG_NONE = 0, + G_OPTION_FLAG_HIDDEN = 1 << 0, + G_OPTION_FLAG_IN_MAIN = 1 << 1, + G_OPTION_FLAG_REVERSE = 1 << 2, + G_OPTION_FLAG_NO_ARG = 1 << 3, + G_OPTION_FLAG_FILENAME = 1 << 4, + G_OPTION_FLAG_OPTIONAL_ARG = 1 << 5, + G_OPTION_FLAG_NOALIAS = 1 << 6 +} GOptionFlags; + +/** + * GOptionArg: + * @G_OPTION_ARG_NONE: No extra argument. This is useful for simple flags. + * @G_OPTION_ARG_STRING: The option takes a UTF-8 string argument. + * @G_OPTION_ARG_INT: The option takes an integer argument. + * @G_OPTION_ARG_CALLBACK: The option provides a callback (of type + * #GOptionArgFunc) to parse the extra argument. + * @G_OPTION_ARG_FILENAME: The option takes a filename as argument, which will + be in the GLib filename encoding rather than UTF-8. + * @G_OPTION_ARG_STRING_ARRAY: The option takes a string argument, multiple + * uses of the option are collected into an array of strings. + * @G_OPTION_ARG_FILENAME_ARRAY: The option takes a filename as argument, + * multiple uses of the option are collected into an array of strings. + * @G_OPTION_ARG_DOUBLE: The option takes a double argument. The argument + * can be formatted either for the user's locale or for the "C" locale. + * Since 2.12 + * @G_OPTION_ARG_INT64: The option takes a 64-bit integer. Like + * %G_OPTION_ARG_INT but for larger numbers. The number can be in + * decimal base, or in hexadecimal (when prefixed with `0x`, for + * example, `0xffffffff`). Since 2.12 + * + * The #GOptionArg enum values determine which type of extra argument the + * options expect to find. If an option expects an extra argument, it can + * be specified in several ways; with a short option: `-x arg`, with a long + * option: `--name arg` or combined in a single argument: `--name=arg`. + */ +typedef enum +{ + G_OPTION_ARG_NONE, + G_OPTION_ARG_STRING, + G_OPTION_ARG_INT, + G_OPTION_ARG_CALLBACK, + G_OPTION_ARG_FILENAME, + G_OPTION_ARG_STRING_ARRAY, + G_OPTION_ARG_FILENAME_ARRAY, + G_OPTION_ARG_DOUBLE, + G_OPTION_ARG_INT64 +} GOptionArg; + +/** + * GOptionArgFunc: + * @option_name: The name of the option being parsed. This will be either a + * single dash followed by a single letter (for a short name) or two dashes + * followed by a long option name. + * @value: The value to be parsed. + * @data: User data added to the #GOptionGroup containing the option when it + * was created with g_option_group_new() + * @error: A return location for errors. The error code %G_OPTION_ERROR_FAILED + * is intended to be used for errors in #GOptionArgFunc callbacks. + * + * The type of function to be passed as callback for %G_OPTION_ARG_CALLBACK + * options. + * + * Returns: %TRUE if the option was successfully parsed, %FALSE if an error + * occurred, in which case @error should be set with g_set_error() + */ +typedef gboolean (*GOptionArgFunc) (const gchar *option_name, + const gchar *value, + gpointer data, + GError **error); + +/** + * GOptionParseFunc: + * @context: The active #GOptionContext + * @group: The group to which the function belongs + * @data: User data added to the #GOptionGroup containing the option when it + * was created with g_option_group_new() + * @error: A return location for error details + * + * The type of function that can be called before and after parsing. + * + * Returns: %TRUE if the function completed successfully, %FALSE if an error + * occurred, in which case @error should be set with g_set_error() + */ +typedef gboolean (*GOptionParseFunc) (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error); + +/** + * GOptionErrorFunc: + * @context: The active #GOptionContext + * @group: The group to which the function belongs + * @data: User data added to the #GOptionGroup containing the option when it + * was created with g_option_group_new() + * @error: The #GError containing details about the parse error + * + * The type of function to be used as callback when a parse error occurs. + */ +typedef void (*GOptionErrorFunc) (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error); + +/** + * G_OPTION_ERROR: + * + * Error domain for option parsing. Errors in this domain will + * be from the #GOptionError enumeration. See #GError for information on + * error domains. + */ +#define G_OPTION_ERROR (g_option_error_quark ()) + +/** + * GOptionError: + * @G_OPTION_ERROR_UNKNOWN_OPTION: An option was not known to the parser. + * This error will only be reported, if the parser hasn't been instructed + * to ignore unknown options, see g_option_context_set_ignore_unknown_options(). + * @G_OPTION_ERROR_BAD_VALUE: A value couldn't be parsed. + * @G_OPTION_ERROR_FAILED: A #GOptionArgFunc callback failed. + * + * Error codes returned by option parsing. + */ +typedef enum +{ + G_OPTION_ERROR_UNKNOWN_OPTION, + G_OPTION_ERROR_BAD_VALUE, + G_OPTION_ERROR_FAILED +} GOptionError; + +GLIB_AVAILABLE_IN_ALL +GQuark g_option_error_quark (void); + +/** + * GOptionEntry: + * @long_name: The long name of an option can be used to specify it + * in a commandline as `--long_name`. Every option must have a + * long name. To resolve conflicts if multiple option groups contain + * the same long name, it is also possible to specify the option as + * `--groupname-long_name`. + * @short_name: If an option has a short name, it can be specified + * `-short_name` in a commandline. @short_name must be a printable + * ASCII character different from '-', or zero if the option has no + * short name. + * @flags: Flags from #GOptionFlags + * @arg: The type of the option, as a #GOptionArg + * @arg_data: If the @arg type is %G_OPTION_ARG_CALLBACK, then @arg_data + * must point to a #GOptionArgFunc callback function, which will be + * called to handle the extra argument. Otherwise, @arg_data is a + * pointer to a location to store the value, the required type of + * the location depends on the @arg type: + * - %G_OPTION_ARG_NONE: %gboolean + * - %G_OPTION_ARG_STRING: %gchar* + * - %G_OPTION_ARG_INT: %gint + * - %G_OPTION_ARG_FILENAME: %gchar* + * - %G_OPTION_ARG_STRING_ARRAY: %gchar** + * - %G_OPTION_ARG_FILENAME_ARRAY: %gchar** + * - %G_OPTION_ARG_DOUBLE: %gdouble + * If @arg type is %G_OPTION_ARG_STRING or %G_OPTION_ARG_FILENAME, + * the location will contain a newly allocated string if the option + * was given. That string needs to be freed by the callee using g_free(). + * Likewise if @arg type is %G_OPTION_ARG_STRING_ARRAY or + * %G_OPTION_ARG_FILENAME_ARRAY, the data should be freed using g_strfreev(). + * @description: the description for the option in `--help` + * output. The @description is translated using the @translate_func + * of the group, see g_option_group_set_translation_domain(). + * @arg_description: The placeholder to use for the extra argument parsed + * by the option in `--help` output. The @arg_description is translated + * using the @translate_func of the group, see + * g_option_group_set_translation_domain(). + * + * A GOptionEntry struct defines a single option. To have an effect, they + * must be added to a #GOptionGroup with g_option_context_add_main_entries() + * or g_option_group_add_entries(). + */ +struct _GOptionEntry +{ + const gchar *long_name; + gchar short_name; + gint flags; + + GOptionArg arg; + gpointer arg_data; + + const gchar *description; + const gchar *arg_description; +}; + +/** + * G_OPTION_REMAINING: + * + * If a long option in the main group has this name, it is not treated as a + * regular option. Instead it collects all non-option arguments which would + * otherwise be left in `argv`. The option must be of type + * %G_OPTION_ARG_CALLBACK, %G_OPTION_ARG_STRING_ARRAY + * or %G_OPTION_ARG_FILENAME_ARRAY. + * + * + * Using #G_OPTION_REMAINING instead of simply scanning `argv` + * for leftover arguments has the advantage that GOption takes care of + * necessary encoding conversions for strings or filenames. + * + * Since: 2.6 + */ +#define G_OPTION_REMAINING "" + +GLIB_AVAILABLE_IN_ALL +GOptionContext *g_option_context_new (const gchar *parameter_string); +GLIB_AVAILABLE_IN_ALL +void g_option_context_set_summary (GOptionContext *context, + const gchar *summary); +GLIB_AVAILABLE_IN_ALL +const gchar * g_option_context_get_summary (GOptionContext *context); +GLIB_AVAILABLE_IN_ALL +void g_option_context_set_description (GOptionContext *context, + const gchar *description); +GLIB_AVAILABLE_IN_ALL +const gchar * g_option_context_get_description (GOptionContext *context); +GLIB_AVAILABLE_IN_ALL +void g_option_context_free (GOptionContext *context); +GLIB_AVAILABLE_IN_ALL +void g_option_context_set_help_enabled (GOptionContext *context, + gboolean help_enabled); +GLIB_AVAILABLE_IN_ALL +gboolean g_option_context_get_help_enabled (GOptionContext *context); +GLIB_AVAILABLE_IN_ALL +void g_option_context_set_ignore_unknown_options (GOptionContext *context, + gboolean ignore_unknown); +GLIB_AVAILABLE_IN_ALL +gboolean g_option_context_get_ignore_unknown_options (GOptionContext *context); + +GLIB_AVAILABLE_IN_2_44 +void g_option_context_set_strict_posix (GOptionContext *context, + gboolean strict_posix); +GLIB_AVAILABLE_IN_2_44 +gboolean g_option_context_get_strict_posix (GOptionContext *context); + +GLIB_AVAILABLE_IN_ALL +void g_option_context_add_main_entries (GOptionContext *context, + const GOptionEntry *entries, + const gchar *translation_domain); +GLIB_AVAILABLE_IN_ALL +gboolean g_option_context_parse (GOptionContext *context, + gint *argc, + gchar ***argv, + GError **error); +GLIB_AVAILABLE_IN_2_40 +gboolean g_option_context_parse_strv (GOptionContext *context, + gchar ***arguments, + GError **error); +GLIB_AVAILABLE_IN_ALL +void g_option_context_set_translate_func (GOptionContext *context, + GTranslateFunc func, + gpointer data, + GDestroyNotify destroy_notify); +GLIB_AVAILABLE_IN_ALL +void g_option_context_set_translation_domain (GOptionContext *context, + const gchar *domain); + +GLIB_AVAILABLE_IN_ALL +void g_option_context_add_group (GOptionContext *context, + GOptionGroup *group); +GLIB_AVAILABLE_IN_ALL +void g_option_context_set_main_group (GOptionContext *context, + GOptionGroup *group); +GLIB_AVAILABLE_IN_ALL +GOptionGroup *g_option_context_get_main_group (GOptionContext *context); +GLIB_AVAILABLE_IN_ALL +gchar *g_option_context_get_help (GOptionContext *context, + gboolean main_help, + GOptionGroup *group); + +GLIB_AVAILABLE_IN_ALL +GOptionGroup *g_option_group_new (const gchar *name, + const gchar *description, + const gchar *help_description, + gpointer user_data, + GDestroyNotify destroy); +GLIB_AVAILABLE_IN_ALL +void g_option_group_set_parse_hooks (GOptionGroup *group, + GOptionParseFunc pre_parse_func, + GOptionParseFunc post_parse_func); +GLIB_AVAILABLE_IN_ALL +void g_option_group_set_error_hook (GOptionGroup *group, + GOptionErrorFunc error_func); +GLIB_DEPRECATED_IN_2_44 +void g_option_group_free (GOptionGroup *group); +GLIB_AVAILABLE_IN_2_44 +GOptionGroup *g_option_group_ref (GOptionGroup *group); +GLIB_AVAILABLE_IN_2_44 +void g_option_group_unref (GOptionGroup *group); +GLIB_AVAILABLE_IN_ALL +void g_option_group_add_entries (GOptionGroup *group, + const GOptionEntry *entries); +GLIB_AVAILABLE_IN_ALL +void g_option_group_set_translate_func (GOptionGroup *group, + GTranslateFunc func, + gpointer data, + GDestroyNotify destroy_notify); +GLIB_AVAILABLE_IN_ALL +void g_option_group_set_translation_domain (GOptionGroup *group, + const gchar *domain); + +G_END_DECLS + +#endif /* __G_OPTION_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997, 1999 Peter Mattis, Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __G_PATTERN_H__ +#define __G_PATTERN_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + + +typedef struct _GPatternSpec GPatternSpec; + +GLIB_AVAILABLE_IN_ALL +GPatternSpec* g_pattern_spec_new (const gchar *pattern); +GLIB_AVAILABLE_IN_ALL +void g_pattern_spec_free (GPatternSpec *pspec); +GLIB_AVAILABLE_IN_ALL +gboolean g_pattern_spec_equal (GPatternSpec *pspec1, + GPatternSpec *pspec2); +GLIB_AVAILABLE_IN_ALL +gboolean g_pattern_match (GPatternSpec *pspec, + guint string_length, + const gchar *string, + const gchar *string_reversed); +GLIB_AVAILABLE_IN_ALL +gboolean g_pattern_match_string (GPatternSpec *pspec, + const gchar *string); +GLIB_AVAILABLE_IN_ALL +gboolean g_pattern_match_simple (const gchar *pattern, + const gchar *string); + +G_END_DECLS + +#endif /* __G_PATTERN_H__ */ +/* + * Copyright © 2018 Ole André Vadla Ravnås + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __G_PLATFORM_AUDIT_H__ +#define __G_PLATFORM_AUDIT_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GFDCallbacks GFDCallbacks; + +struct _GFDCallbacks +{ + void (*on_fd_opened) (gint fd, const gchar *description); + void (*on_fd_closed) (gint fd, const gchar *description); +}; + +GLIB_VAR +GFDCallbacks *glib_fd_callbacks; +GLIB_AVAILABLE_IN_2_68 +void g_platform_audit_set_fd_callbacks (GFDCallbacks *callbacks); + +G_END_DECLS + +#endif /* __G_PLATFORM_AUDIT_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_PRIMES_H__ +#define __G_PRIMES_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/* Prime numbers. + */ + +/* This function returns prime numbers spaced by approximately 1.5-2.0 + * and is for use in resizing data structures which prefer + * prime-valued sizes. The closest spaced prime function returns the + * next largest prime, or the highest it knows about which is about + * MAXINT/4. + */ +GLIB_AVAILABLE_IN_ALL +guint g_spaced_primes_closest (guint num) G_GNUC_CONST; + +G_END_DECLS + +#endif /* __G_PRIMES_H__ */ + /* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_QSORT_H__ +#define __G_QSORT_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_ALL +void g_qsort_with_data (gconstpointer pbase, + gint total_elems, + gsize size, + GCompareDataFunc compare_func, + gpointer user_data); + +G_END_DECLS + +#endif /* __G_QSORT_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_QUEUE_H__ +#define __G_QUEUE_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GQueue GQueue; + +/** + * GQueue: + * @head: a pointer to the first element of the queue + * @tail: a pointer to the last element of the queue + * @length: the number of elements in the queue + * + * Contains the public fields of a + * [Queue][glib-Double-ended-Queues]. + */ +struct _GQueue +{ + GList *head; + GList *tail; + guint length; +}; + +/** + * G_QUEUE_INIT: + * + * A statically-allocated #GQueue must be initialized with this + * macro before it can be used. This macro can be used to initialize + * a variable, but it cannot be assigned to a variable. In that case + * you have to use g_queue_init(). + * + * |[ + * GQueue my_queue = G_QUEUE_INIT; + * ]| + * + * Since: 2.14 + */ +#define G_QUEUE_INIT { NULL, NULL, 0 } + +/* Queues + */ +GLIB_AVAILABLE_IN_ALL +GQueue* g_queue_new (void); +GLIB_AVAILABLE_IN_ALL +void g_queue_free (GQueue *queue); +GLIB_AVAILABLE_IN_ALL +void g_queue_free_full (GQueue *queue, + GDestroyNotify free_func); +GLIB_AVAILABLE_IN_ALL +void g_queue_init (GQueue *queue); +GLIB_AVAILABLE_IN_ALL +void g_queue_clear (GQueue *queue); +GLIB_AVAILABLE_IN_ALL +gboolean g_queue_is_empty (GQueue *queue); +GLIB_AVAILABLE_IN_2_60 +void g_queue_clear_full (GQueue *queue, + GDestroyNotify free_func); +GLIB_AVAILABLE_IN_ALL +guint g_queue_get_length (GQueue *queue); +GLIB_AVAILABLE_IN_ALL +void g_queue_reverse (GQueue *queue); +GLIB_AVAILABLE_IN_ALL +GQueue * g_queue_copy (GQueue *queue); +GLIB_AVAILABLE_IN_ALL +void g_queue_foreach (GQueue *queue, + GFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +GList * g_queue_find (GQueue *queue, + gconstpointer data); +GLIB_AVAILABLE_IN_ALL +GList * g_queue_find_custom (GQueue *queue, + gconstpointer data, + GCompareFunc func); +GLIB_AVAILABLE_IN_ALL +void g_queue_sort (GQueue *queue, + GCompareDataFunc compare_func, + gpointer user_data); + +GLIB_AVAILABLE_IN_ALL +void g_queue_push_head (GQueue *queue, + gpointer data); +GLIB_AVAILABLE_IN_ALL +void g_queue_push_tail (GQueue *queue, + gpointer data); +GLIB_AVAILABLE_IN_ALL +void g_queue_push_nth (GQueue *queue, + gpointer data, + gint n); +GLIB_AVAILABLE_IN_ALL +gpointer g_queue_pop_head (GQueue *queue); +GLIB_AVAILABLE_IN_ALL +gpointer g_queue_pop_tail (GQueue *queue); +GLIB_AVAILABLE_IN_ALL +gpointer g_queue_pop_nth (GQueue *queue, + guint n); +GLIB_AVAILABLE_IN_ALL +gpointer g_queue_peek_head (GQueue *queue); +GLIB_AVAILABLE_IN_ALL +gpointer g_queue_peek_tail (GQueue *queue); +GLIB_AVAILABLE_IN_ALL +gpointer g_queue_peek_nth (GQueue *queue, + guint n); +GLIB_AVAILABLE_IN_ALL +gint g_queue_index (GQueue *queue, + gconstpointer data); +GLIB_AVAILABLE_IN_ALL +gboolean g_queue_remove (GQueue *queue, + gconstpointer data); +GLIB_AVAILABLE_IN_ALL +guint g_queue_remove_all (GQueue *queue, + gconstpointer data); +GLIB_AVAILABLE_IN_ALL +void g_queue_insert_before (GQueue *queue, + GList *sibling, + gpointer data); +GLIB_AVAILABLE_IN_2_62 +void g_queue_insert_before_link + (GQueue *queue, + GList *sibling, + GList *link_); +GLIB_AVAILABLE_IN_ALL +void g_queue_insert_after (GQueue *queue, + GList *sibling, + gpointer data); +GLIB_AVAILABLE_IN_2_62 +void g_queue_insert_after_link + (GQueue *queue, + GList *sibling, + GList *link_); +GLIB_AVAILABLE_IN_ALL +void g_queue_insert_sorted (GQueue *queue, + gpointer data, + GCompareDataFunc func, + gpointer user_data); + +GLIB_AVAILABLE_IN_ALL +void g_queue_push_head_link (GQueue *queue, + GList *link_); +GLIB_AVAILABLE_IN_ALL +void g_queue_push_tail_link (GQueue *queue, + GList *link_); +GLIB_AVAILABLE_IN_ALL +void g_queue_push_nth_link (GQueue *queue, + gint n, + GList *link_); +GLIB_AVAILABLE_IN_ALL +GList* g_queue_pop_head_link (GQueue *queue); +GLIB_AVAILABLE_IN_ALL +GList* g_queue_pop_tail_link (GQueue *queue); +GLIB_AVAILABLE_IN_ALL +GList* g_queue_pop_nth_link (GQueue *queue, + guint n); +GLIB_AVAILABLE_IN_ALL +GList* g_queue_peek_head_link (GQueue *queue); +GLIB_AVAILABLE_IN_ALL +GList* g_queue_peek_tail_link (GQueue *queue); +GLIB_AVAILABLE_IN_ALL +GList* g_queue_peek_nth_link (GQueue *queue, + guint n); +GLIB_AVAILABLE_IN_ALL +gint g_queue_link_index (GQueue *queue, + GList *link_); +GLIB_AVAILABLE_IN_ALL +void g_queue_unlink (GQueue *queue, + GList *link_); +GLIB_AVAILABLE_IN_ALL +void g_queue_delete_link (GQueue *queue, + GList *link_); + +G_END_DECLS + +#endif /* __G_QUEUE_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_RAND_H__ +#define __G_RAND_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GRand GRand; + +/* GRand - a good and fast random number generator: Mersenne Twister + * see http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html for more info. + * The range functions return a value in the interval [begin, end). + * int -> [0..2^32-1] + * int_range -> [begin..end-1] + * double -> [0..1) + * double_range -> [begin..end) + */ + +GLIB_AVAILABLE_IN_ALL +GRand* g_rand_new_with_seed (guint32 seed); +GLIB_AVAILABLE_IN_ALL +GRand* g_rand_new_with_seed_array (const guint32 *seed, + guint seed_length); +GLIB_AVAILABLE_IN_ALL +GRand* g_rand_new (void); +GLIB_AVAILABLE_IN_ALL +void g_rand_free (GRand *rand_); +GLIB_AVAILABLE_IN_ALL +GRand* g_rand_copy (GRand *rand_); +GLIB_AVAILABLE_IN_ALL +void g_rand_set_seed (GRand *rand_, + guint32 seed); +GLIB_AVAILABLE_IN_ALL +void g_rand_set_seed_array (GRand *rand_, + const guint32 *seed, + guint seed_length); + +#define g_rand_boolean(rand_) ((g_rand_int (rand_) & (1 << 15)) != 0) + +GLIB_AVAILABLE_IN_ALL +guint32 g_rand_int (GRand *rand_); +GLIB_AVAILABLE_IN_ALL +gint32 g_rand_int_range (GRand *rand_, + gint32 begin, + gint32 end); +GLIB_AVAILABLE_IN_ALL +gdouble g_rand_double (GRand *rand_); +GLIB_AVAILABLE_IN_ALL +gdouble g_rand_double_range (GRand *rand_, + gdouble begin, + gdouble end); +GLIB_AVAILABLE_IN_ALL +void g_random_set_seed (guint32 seed); + +#define g_random_boolean() ((g_random_int () & (1 << 15)) != 0) + +GLIB_AVAILABLE_IN_ALL +guint32 g_random_int (void); +GLIB_AVAILABLE_IN_ALL +gint32 g_random_int_range (gint32 begin, + gint32 end); +GLIB_AVAILABLE_IN_ALL +gdouble g_random_double (void); +GLIB_AVAILABLE_IN_ALL +gdouble g_random_double_range (gdouble begin, + gdouble end); + + +G_END_DECLS + +#endif /* __G_RAND_H__ */ +/* grcbox.h: Reference counted data + * + * Copyright 2018 Emmanuele Bassi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#pragma once + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_2_58 +gpointer g_rc_box_alloc (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +GLIB_AVAILABLE_IN_2_58 +gpointer g_rc_box_alloc0 (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +GLIB_AVAILABLE_IN_2_58 +gpointer g_rc_box_dup (gsize block_size, + gconstpointer mem_block) G_GNUC_ALLOC_SIZE(1); +GLIB_AVAILABLE_IN_2_58 +gpointer g_rc_box_acquire (gpointer mem_block); +GLIB_AVAILABLE_IN_2_58 +void g_rc_box_release (gpointer mem_block); +GLIB_AVAILABLE_IN_2_58 +void g_rc_box_release_full (gpointer mem_block, + GDestroyNotify clear_func); + +GLIB_AVAILABLE_IN_2_58 +gsize g_rc_box_get_size (gpointer mem_block); + +GLIB_AVAILABLE_IN_2_58 +gpointer g_atomic_rc_box_alloc (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +GLIB_AVAILABLE_IN_2_58 +gpointer g_atomic_rc_box_alloc0 (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +GLIB_AVAILABLE_IN_2_58 +gpointer g_atomic_rc_box_dup (gsize block_size, + gconstpointer mem_block) G_GNUC_ALLOC_SIZE(1); +GLIB_AVAILABLE_IN_2_58 +gpointer g_atomic_rc_box_acquire (gpointer mem_block); +GLIB_AVAILABLE_IN_2_58 +void g_atomic_rc_box_release (gpointer mem_block); +GLIB_AVAILABLE_IN_2_58 +void g_atomic_rc_box_release_full (gpointer mem_block, + GDestroyNotify clear_func); + +GLIB_AVAILABLE_IN_2_58 +gsize g_atomic_rc_box_get_size (gpointer mem_block); + +#define g_rc_box_new(type) \ + ((type *) g_rc_box_alloc (sizeof (type))) +#define g_rc_box_new0(type) \ + ((type *) g_rc_box_alloc0 (sizeof (type))) +#define g_atomic_rc_box_new(type) \ + ((type *) g_atomic_rc_box_alloc (sizeof (type))) +#define g_atomic_rc_box_new0(type) \ + ((type *) g_atomic_rc_box_alloc0 (sizeof (type))) + +#ifdef glib_typeof +/* Type check to avoid assigning references to different types */ +#undef g_rc_box_acquire +#define g_rc_box_acquire(mem_block) \ + ((glib_typeof (mem_block)) (_frida_g_rc_box_acquire) (mem_block)) +#undef g_atomic_rc_box_acquire +#define g_atomic_rc_box_acquire(mem_block) \ + ((glib_typeof (mem_block)) (_frida_g_atomic_rc_box_acquire) (mem_block)) + +/* Type check to avoid duplicating data to different types */ +#undef g_rc_box_dup +#define g_rc_box_dup(block_size, mem_block) \ + ((glib_typeof (mem_block)) (_frida_g_rc_box_dup) (block_size, mem_block)) +#undef g_atomic_rc_box_dup +#define g_atomic_rc_box_dup(block_size, mem_block) \ + ((glib_typeof (mem_block)) (_frida_g_atomic_rc_box_dup) (block_size, mem_block)) +#endif + +G_END_DECLS +/* grefcount.h: Reference counting + * + * Copyright 2018 Emmanuele Bassi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __GREFCOUNT_H__ +#define __GREFCOUNT_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#if defined(__GNUC__) && defined(G_DISABLE_CHECKS) +#endif + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_2_58 +void g_ref_count_init (grefcount *rc); +GLIB_AVAILABLE_IN_2_58 +void g_ref_count_inc (grefcount *rc); +GLIB_AVAILABLE_IN_2_58 +gboolean g_ref_count_dec (grefcount *rc); +GLIB_AVAILABLE_IN_2_58 +gboolean g_ref_count_compare (grefcount *rc, + gint val); + +GLIB_AVAILABLE_IN_2_58 +void g_atomic_ref_count_init (gatomicrefcount *arc); +GLIB_AVAILABLE_IN_2_58 +void g_atomic_ref_count_inc (gatomicrefcount *arc); +GLIB_AVAILABLE_IN_2_58 +gboolean g_atomic_ref_count_dec (gatomicrefcount *arc); +GLIB_AVAILABLE_IN_2_58 +gboolean g_atomic_ref_count_compare (gatomicrefcount *arc, + gint val); + +/* On GCC we can use __extension__ to inline the API without using + * ancillary functions; we only do this when disabling checks, as + * it disables warnings when saturating the reference counters + */ +#if defined(__GNUC__) && defined(G_DISABLE_CHECKS) + +#undef g_ref_count_init +# define g_ref_count_init(rc) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(rc) == sizeof (grefcount)); \ + (void) (0 ? *(rc) ^ *(rc) : 1); \ + *(rc) = -1; \ + })) + +#undef g_ref_count_inc +# define g_ref_count_inc(rc) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(rc) == sizeof (grefcount)); \ + (void) (0 ? *(rc) ^ *(rc) : 1); \ + if (*(rc) == G_MININT) ; else { \ + *(rc) -= 1; \ + } \ + })) + +#undef g_ref_count_dec +# define g_ref_count_dec(rc) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(rc) == sizeof (grefcount)); \ + grefcount __rc = *(rc); \ + __rc += 1; \ + if (__rc == 0) ; else { \ + *(rc) = __rc; \ + } \ + (gboolean) (__rc == 0); \ + })) + +#undef g_ref_count_compare +# define g_ref_count_compare(rc,val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(rc) == sizeof (grefcount)); \ + (void) (0 ? *(rc) ^ (val) : 1); \ + (gboolean) (*(rc) == -(val)); \ + })) + +#undef g_atomic_ref_count_init +# define g_atomic_ref_count_init(rc) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(rc) == sizeof (gatomicrefcount)); \ + (void) (0 ? *(rc) ^ *(rc) : 1); \ + *(rc) = 1; \ + })) + +#undef g_atomic_ref_count_inc +# define g_atomic_ref_count_inc(rc) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(rc) == sizeof (gatomicrefcount)); \ + (void) (0 ? *(rc) ^ *(rc) : 1); \ + (void) (g_atomic_int_get (rc) == G_MAXINT ? 0 : g_atomic_int_inc ((rc))); \ + })) + +#undef g_atomic_ref_count_dec +# define g_atomic_ref_count_dec(rc) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(rc) == sizeof (gatomicrefcount)); \ + (void) (0 ? *(rc) ^ *(rc) : 1); \ + g_atomic_int_dec_and_test ((rc)); \ + })) + +#undef g_atomic_ref_count_compare +# define g_atomic_ref_count_compare(rc,val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(rc) == sizeof (gatomicrefcount)); \ + (void) (0 ? *(rc) ^ (val) : 1); \ + (gboolean) (g_atomic_int_get (rc) == (val)); \ + })) + +#endif /* __GNUC__ && G_DISABLE_CHECKS */ + +G_END_DECLS + +#endif /* __GREFCOUNT_H__ */ +/* grefstring.h: Reference counted strings + * + * Copyright 2018 Emmanuele Bassi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#pragma once + + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_2_58 +char * g_ref_string_new (const char *str); +GLIB_AVAILABLE_IN_2_58 +char * g_ref_string_new_len (const char *str, + gssize len); +GLIB_AVAILABLE_IN_2_58 +char * g_ref_string_new_intern (const char *str); + +GLIB_AVAILABLE_IN_2_58 +char * g_ref_string_acquire (char *str); +GLIB_AVAILABLE_IN_2_58 +void g_ref_string_release (char *str); + +GLIB_AVAILABLE_IN_2_58 +gsize g_ref_string_length (char *str); + +/** + * GRefString: + * + * A typedef for a reference-counted string. A pointer to a #GRefString can be + * treated like a standard `char*` array by all code, but can additionally have + * `g_ref_string_*()` methods called on it. `g_ref_string_*()` methods cannot be + * called on `char*` arrays not allocated using g_ref_string_new(). + * + * If using #GRefString with autocleanups, g_autoptr() must be used rather than + * g_autofree(), so that the reference counting metadata is also freed. + * + * Since: 2.58 + */ +typedef char GRefString; + +G_END_DECLS +/* GRegex -- regular expression API wrapper around PCRE. + * + * Copyright (C) 1999, 2000 Scott Wimer + * Copyright (C) 2004, Matthias Clasen + * Copyright (C) 2005 - 2007, Marco Barisione + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_REGEX_H__ +#define __G_REGEX_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * GRegexError: + * @G_REGEX_ERROR_COMPILE: Compilation of the regular expression failed. + * @G_REGEX_ERROR_OPTIMIZE: Optimization of the regular expression failed. + * @G_REGEX_ERROR_REPLACE: Replacement failed due to an ill-formed replacement + * string. + * @G_REGEX_ERROR_MATCH: The match process failed. + * @G_REGEX_ERROR_INTERNAL: Internal error of the regular expression engine. + * Since 2.16 + * @G_REGEX_ERROR_STRAY_BACKSLASH: "\\" at end of pattern. Since 2.16 + * @G_REGEX_ERROR_MISSING_CONTROL_CHAR: "\\c" at end of pattern. Since 2.16 + * @G_REGEX_ERROR_UNRECOGNIZED_ESCAPE: Unrecognized character follows "\\". + * Since 2.16 + * @G_REGEX_ERROR_QUANTIFIERS_OUT_OF_ORDER: Numbers out of order in "{}" + * quantifier. Since 2.16 + * @G_REGEX_ERROR_QUANTIFIER_TOO_BIG: Number too big in "{}" quantifier. + * Since 2.16 + * @G_REGEX_ERROR_UNTERMINATED_CHARACTER_CLASS: Missing terminating "]" for + * character class. Since 2.16 + * @G_REGEX_ERROR_INVALID_ESCAPE_IN_CHARACTER_CLASS: Invalid escape sequence + * in character class. Since 2.16 + * @G_REGEX_ERROR_RANGE_OUT_OF_ORDER: Range out of order in character class. + * Since 2.16 + * @G_REGEX_ERROR_NOTHING_TO_REPEAT: Nothing to repeat. Since 2.16 + * @G_REGEX_ERROR_UNRECOGNIZED_CHARACTER: Unrecognized character after "(?", + * "(?<" or "(?P". Since 2.16 + * @G_REGEX_ERROR_POSIX_NAMED_CLASS_OUTSIDE_CLASS: POSIX named classes are + * supported only within a class. Since 2.16 + * @G_REGEX_ERROR_UNMATCHED_PARENTHESIS: Missing terminating ")" or ")" + * without opening "(". Since 2.16 + * @G_REGEX_ERROR_INEXISTENT_SUBPATTERN_REFERENCE: Reference to non-existent + * subpattern. Since 2.16 + * @G_REGEX_ERROR_UNTERMINATED_COMMENT: Missing terminating ")" after comment. + * Since 2.16 + * @G_REGEX_ERROR_EXPRESSION_TOO_LARGE: Regular expression too large. + * Since 2.16 + * @G_REGEX_ERROR_MEMORY_ERROR: Failed to get memory. Since 2.16 + * @G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND: Lookbehind assertion is not + * fixed length. Since 2.16 + * @G_REGEX_ERROR_MALFORMED_CONDITION: Malformed number or name after "(?(". + * Since 2.16 + * @G_REGEX_ERROR_TOO_MANY_CONDITIONAL_BRANCHES: Conditional group contains + * more than two branches. Since 2.16 + * @G_REGEX_ERROR_ASSERTION_EXPECTED: Assertion expected after "(?(". + * Since 2.16 + * @G_REGEX_ERROR_UNKNOWN_POSIX_CLASS_NAME: Unknown POSIX class name. + * Since 2.16 + * @G_REGEX_ERROR_POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED: POSIX collating + * elements are not supported. Since 2.16 + * @G_REGEX_ERROR_HEX_CODE_TOO_LARGE: Character value in "\\x{...}" sequence + * is too large. Since 2.16 + * @G_REGEX_ERROR_INVALID_CONDITION: Invalid condition "(?(0)". Since 2.16 + * @G_REGEX_ERROR_SINGLE_BYTE_MATCH_IN_LOOKBEHIND: \\C not allowed in + * lookbehind assertion. Since 2.16 + * @G_REGEX_ERROR_INFINITE_LOOP: Recursive call could loop indefinitely. + * Since 2.16 + * @G_REGEX_ERROR_MISSING_SUBPATTERN_NAME_TERMINATOR: Missing terminator + * in subpattern name. Since 2.16 + * @G_REGEX_ERROR_DUPLICATE_SUBPATTERN_NAME: Two named subpatterns have + * the same name. Since 2.16 + * @G_REGEX_ERROR_MALFORMED_PROPERTY: Malformed "\\P" or "\\p" sequence. + * Since 2.16 + * @G_REGEX_ERROR_UNKNOWN_PROPERTY: Unknown property name after "\\P" or + * "\\p". Since 2.16 + * @G_REGEX_ERROR_SUBPATTERN_NAME_TOO_LONG: Subpattern name is too long + * (maximum 32 characters). Since 2.16 + * @G_REGEX_ERROR_TOO_MANY_SUBPATTERNS: Too many named subpatterns (maximum + * 10,000). Since 2.16 + * @G_REGEX_ERROR_INVALID_OCTAL_VALUE: Octal value is greater than "\\377". + * Since 2.16 + * @G_REGEX_ERROR_TOO_MANY_BRANCHES_IN_DEFINE: "DEFINE" group contains more + * than one branch. Since 2.16 + * @G_REGEX_ERROR_DEFINE_REPETION: Repeating a "DEFINE" group is not allowed. + * This error is never raised. Since: 2.16 Deprecated: 2.34 + * @G_REGEX_ERROR_INCONSISTENT_NEWLINE_OPTIONS: Inconsistent newline options. + * Since 2.16 + * @G_REGEX_ERROR_MISSING_BACK_REFERENCE: "\\g" is not followed by a braced, + * angle-bracketed, or quoted name or number, or by a plain number. Since: 2.16 + * @G_REGEX_ERROR_INVALID_RELATIVE_REFERENCE: relative reference must not be zero. Since: 2.34 + * @G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_FORBIDDEN: the backtracing + * control verb used does not allow an argument. Since: 2.34 + * @G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB: unknown backtracing + * control verb. Since: 2.34 + * @G_REGEX_ERROR_NUMBER_TOO_BIG: number is too big in escape sequence. Since: 2.34 + * @G_REGEX_ERROR_MISSING_SUBPATTERN_NAME: Missing subpattern name. Since: 2.34 + * @G_REGEX_ERROR_MISSING_DIGIT: Missing digit. Since 2.34 + * @G_REGEX_ERROR_INVALID_DATA_CHARACTER: In JavaScript compatibility mode, + * "[" is an invalid data character. Since: 2.34 + * @G_REGEX_ERROR_EXTRA_SUBPATTERN_NAME: different names for subpatterns of the + * same number are not allowed. Since: 2.34 + * @G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_REQUIRED: the backtracing control + * verb requires an argument. Since: 2.34 + * @G_REGEX_ERROR_INVALID_CONTROL_CHAR: "\\c" must be followed by an ASCII + * character. Since: 2.34 + * @G_REGEX_ERROR_MISSING_NAME: "\\k" is not followed by a braced, angle-bracketed, or + * quoted name. Since: 2.34 + * @G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS: "\\N" is not supported in a class. Since: 2.34 + * @G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES: too many forward references. Since: 2.34 + * @G_REGEX_ERROR_NAME_TOO_LONG: the name is too long in "(*MARK)", "(*PRUNE)", + * "(*SKIP)", or "(*THEN)". Since: 2.34 + * @G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE: the character value in the \\u sequence is + * too large. Since: 2.34 + * + * Error codes returned by regular expressions functions. + * + * Since: 2.14 + */ +typedef enum +{ + G_REGEX_ERROR_COMPILE, + G_REGEX_ERROR_OPTIMIZE, + G_REGEX_ERROR_REPLACE, + G_REGEX_ERROR_MATCH, + G_REGEX_ERROR_INTERNAL, + + /* These are the error codes from PCRE + 100 */ + G_REGEX_ERROR_STRAY_BACKSLASH = 101, + G_REGEX_ERROR_MISSING_CONTROL_CHAR = 102, + G_REGEX_ERROR_UNRECOGNIZED_ESCAPE = 103, + G_REGEX_ERROR_QUANTIFIERS_OUT_OF_ORDER = 104, + G_REGEX_ERROR_QUANTIFIER_TOO_BIG = 105, + G_REGEX_ERROR_UNTERMINATED_CHARACTER_CLASS = 106, + G_REGEX_ERROR_INVALID_ESCAPE_IN_CHARACTER_CLASS = 107, + G_REGEX_ERROR_RANGE_OUT_OF_ORDER = 108, + G_REGEX_ERROR_NOTHING_TO_REPEAT = 109, + G_REGEX_ERROR_UNRECOGNIZED_CHARACTER = 112, + G_REGEX_ERROR_POSIX_NAMED_CLASS_OUTSIDE_CLASS = 113, + G_REGEX_ERROR_UNMATCHED_PARENTHESIS = 114, + G_REGEX_ERROR_INEXISTENT_SUBPATTERN_REFERENCE = 115, + G_REGEX_ERROR_UNTERMINATED_COMMENT = 118, + G_REGEX_ERROR_EXPRESSION_TOO_LARGE = 120, + G_REGEX_ERROR_MEMORY_ERROR = 121, + G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND = 125, + G_REGEX_ERROR_MALFORMED_CONDITION = 126, + G_REGEX_ERROR_TOO_MANY_CONDITIONAL_BRANCHES = 127, + G_REGEX_ERROR_ASSERTION_EXPECTED = 128, + G_REGEX_ERROR_UNKNOWN_POSIX_CLASS_NAME = 130, + G_REGEX_ERROR_POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED = 131, + G_REGEX_ERROR_HEX_CODE_TOO_LARGE = 134, + G_REGEX_ERROR_INVALID_CONDITION = 135, + G_REGEX_ERROR_SINGLE_BYTE_MATCH_IN_LOOKBEHIND = 136, + G_REGEX_ERROR_INFINITE_LOOP = 140, + G_REGEX_ERROR_MISSING_SUBPATTERN_NAME_TERMINATOR = 142, + G_REGEX_ERROR_DUPLICATE_SUBPATTERN_NAME = 143, + G_REGEX_ERROR_MALFORMED_PROPERTY = 146, + G_REGEX_ERROR_UNKNOWN_PROPERTY = 147, + G_REGEX_ERROR_SUBPATTERN_NAME_TOO_LONG = 148, + G_REGEX_ERROR_TOO_MANY_SUBPATTERNS = 149, + G_REGEX_ERROR_INVALID_OCTAL_VALUE = 151, + G_REGEX_ERROR_TOO_MANY_BRANCHES_IN_DEFINE = 154, + G_REGEX_ERROR_DEFINE_REPETION = 155, + G_REGEX_ERROR_INCONSISTENT_NEWLINE_OPTIONS = 156, + G_REGEX_ERROR_MISSING_BACK_REFERENCE = 157, + G_REGEX_ERROR_INVALID_RELATIVE_REFERENCE = 158, + G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_FORBIDDEN = 159, + G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB = 160, + G_REGEX_ERROR_NUMBER_TOO_BIG = 161, + G_REGEX_ERROR_MISSING_SUBPATTERN_NAME = 162, + G_REGEX_ERROR_MISSING_DIGIT = 163, + G_REGEX_ERROR_INVALID_DATA_CHARACTER = 164, + G_REGEX_ERROR_EXTRA_SUBPATTERN_NAME = 165, + G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_REQUIRED = 166, + G_REGEX_ERROR_INVALID_CONTROL_CHAR = 168, + G_REGEX_ERROR_MISSING_NAME = 169, + G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS = 171, + G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES = 172, + G_REGEX_ERROR_NAME_TOO_LONG = 175, + G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE = 176 +} GRegexError; + +/** + * G_REGEX_ERROR: + * + * Error domain for regular expressions. Errors in this domain will be + * from the #GRegexError enumeration. See #GError for information on + * error domains. + * + * Since: 2.14 + */ +#define G_REGEX_ERROR g_regex_error_quark () + +GLIB_AVAILABLE_IN_ALL +GQuark g_regex_error_quark (void); + +/** + * GRegexCompileFlags: + * @G_REGEX_CASELESS: Letters in the pattern match both upper- and + * lowercase letters. This option can be changed within a pattern + * by a "(?i)" option setting. + * @G_REGEX_MULTILINE: By default, GRegex treats the strings as consisting + * of a single line of characters (even if it actually contains + * newlines). The "start of line" metacharacter ("^") matches only + * at the start of the string, while the "end of line" metacharacter + * ("$") matches only at the end of the string, or before a terminating + * newline (unless #G_REGEX_DOLLAR_ENDONLY is set). When + * #G_REGEX_MULTILINE is set, the "start of line" and "end of line" + * constructs match immediately following or immediately before any + * newline in the string, respectively, as well as at the very start + * and end. This can be changed within a pattern by a "(?m)" option + * setting. + * @G_REGEX_DOTALL: A dot metacharacter (".") in the pattern matches all + * characters, including newlines. Without it, newlines are excluded. + * This option can be changed within a pattern by a ("?s") option setting. + * @G_REGEX_EXTENDED: Whitespace data characters in the pattern are + * totally ignored except when escaped or inside a character class. + * Whitespace does not include the VT character (code 11). In addition, + * characters between an unescaped "#" outside a character class and + * the next newline character, inclusive, are also ignored. This can + * be changed within a pattern by a "(?x)" option setting. + * @G_REGEX_ANCHORED: The pattern is forced to be "anchored", that is, + * it is constrained to match only at the first matching point in the + * string that is being searched. This effect can also be achieved by + * appropriate constructs in the pattern itself such as the "^" + * metacharacter. + * @G_REGEX_DOLLAR_ENDONLY: A dollar metacharacter ("$") in the pattern + * matches only at the end of the string. Without this option, a + * dollar also matches immediately before the final character if + * it is a newline (but not before any other newlines). This option + * is ignored if #G_REGEX_MULTILINE is set. + * @G_REGEX_UNGREEDY: Inverts the "greediness" of the quantifiers so that + * they are not greedy by default, but become greedy if followed by "?". + * It can also be set by a "(?U)" option setting within the pattern. + * @G_REGEX_RAW: Usually strings must be valid UTF-8 strings, using this + * flag they are considered as a raw sequence of bytes. + * @G_REGEX_NO_AUTO_CAPTURE: Disables the use of numbered capturing + * parentheses in the pattern. Any opening parenthesis that is not + * followed by "?" behaves as if it were followed by "?:" but named + * parentheses can still be used for capturing (and they acquire numbers + * in the usual way). + * @G_REGEX_OPTIMIZE: Optimize the regular expression. If the pattern will + * be used many times, then it may be worth the effort to optimize it + * to improve the speed of matches. + * @G_REGEX_FIRSTLINE: Limits an unanchored pattern to match before (or at) the + * first newline. Since: 2.34 + * @G_REGEX_DUPNAMES: Names used to identify capturing subpatterns need not + * be unique. This can be helpful for certain types of pattern when it + * is known that only one instance of the named subpattern can ever be + * matched. + * @G_REGEX_NEWLINE_CR: Usually any newline character or character sequence is + * recognized. If this option is set, the only recognized newline character + * is '\r'. + * @G_REGEX_NEWLINE_LF: Usually any newline character or character sequence is + * recognized. If this option is set, the only recognized newline character + * is '\n'. + * @G_REGEX_NEWLINE_CRLF: Usually any newline character or character sequence is + * recognized. If this option is set, the only recognized newline character + * sequence is '\r\n'. + * @G_REGEX_NEWLINE_ANYCRLF: Usually any newline character or character sequence + * is recognized. If this option is set, the only recognized newline character + * sequences are '\r', '\n', and '\r\n'. Since: 2.34 + * @G_REGEX_BSR_ANYCRLF: Usually any newline character or character sequence + * is recognised. If this option is set, then "\R" only recognizes the newline + * characters '\r', '\n' and '\r\n'. Since: 2.34 + * @G_REGEX_JAVASCRIPT_COMPAT: Changes behaviour so that it is compatible with + * JavaScript rather than PCRE. Since: 2.34 + * + * Flags specifying compile-time options. + * + * Since: 2.14 + */ +/* Remember to update G_REGEX_COMPILE_MASK in gregex.c after + * adding a new flag. + */ +typedef enum +{ + G_REGEX_CASELESS = 1 << 0, + G_REGEX_MULTILINE = 1 << 1, + G_REGEX_DOTALL = 1 << 2, + G_REGEX_EXTENDED = 1 << 3, + G_REGEX_ANCHORED = 1 << 4, + G_REGEX_DOLLAR_ENDONLY = 1 << 5, + G_REGEX_UNGREEDY = 1 << 9, + G_REGEX_RAW = 1 << 11, + G_REGEX_NO_AUTO_CAPTURE = 1 << 12, + G_REGEX_OPTIMIZE = 1 << 13, + G_REGEX_FIRSTLINE = 1 << 18, + G_REGEX_DUPNAMES = 1 << 19, + G_REGEX_NEWLINE_CR = 1 << 20, + G_REGEX_NEWLINE_LF = 1 << 21, + G_REGEX_NEWLINE_CRLF = G_REGEX_NEWLINE_CR | G_REGEX_NEWLINE_LF, + G_REGEX_NEWLINE_ANYCRLF = G_REGEX_NEWLINE_CR | 1 << 22, + G_REGEX_BSR_ANYCRLF = 1 << 23, + G_REGEX_JAVASCRIPT_COMPAT = 1 << 25 +} GRegexCompileFlags; + +/** + * GRegexMatchFlags: + * @G_REGEX_MATCH_ANCHORED: The pattern is forced to be "anchored", that is, + * it is constrained to match only at the first matching point in the + * string that is being searched. This effect can also be achieved by + * appropriate constructs in the pattern itself such as the "^" + * metacharacter. + * @G_REGEX_MATCH_NOTBOL: Specifies that first character of the string is + * not the beginning of a line, so the circumflex metacharacter should + * not match before it. Setting this without #G_REGEX_MULTILINE (at + * compile time) causes circumflex never to match. This option affects + * only the behaviour of the circumflex metacharacter, it does not + * affect "\A". + * @G_REGEX_MATCH_NOTEOL: Specifies that the end of the subject string is + * not the end of a line, so the dollar metacharacter should not match + * it nor (except in multiline mode) a newline immediately before it. + * Setting this without #G_REGEX_MULTILINE (at compile time) causes + * dollar never to match. This option affects only the behaviour of + * the dollar metacharacter, it does not affect "\Z" or "\z". + * @G_REGEX_MATCH_NOTEMPTY: An empty string is not considered to be a valid + * match if this option is set. If there are alternatives in the pattern, + * they are tried. If all the alternatives match the empty string, the + * entire match fails. For example, if the pattern "a?b?" is applied to + * a string not beginning with "a" or "b", it matches the empty string + * at the start of the string. With this flag set, this match is not + * valid, so GRegex searches further into the string for occurrences + * of "a" or "b". + * @G_REGEX_MATCH_PARTIAL: Turns on the partial matching feature, for more + * documentation on partial matching see g_match_info_is_partial_match(). + * @G_REGEX_MATCH_NEWLINE_CR: Overrides the newline definition set when + * creating a new #GRegex, setting the '\r' character as line terminator. + * @G_REGEX_MATCH_NEWLINE_LF: Overrides the newline definition set when + * creating a new #GRegex, setting the '\n' character as line terminator. + * @G_REGEX_MATCH_NEWLINE_CRLF: Overrides the newline definition set when + * creating a new #GRegex, setting the '\r\n' characters sequence as line terminator. + * @G_REGEX_MATCH_NEWLINE_ANY: Overrides the newline definition set when + * creating a new #GRegex, any Unicode newline sequence + * is recognised as a newline. These are '\r', '\n' and '\rn', and the + * single characters U+000B LINE TABULATION, U+000C FORM FEED (FF), + * U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and + * U+2029 PARAGRAPH SEPARATOR. + * @G_REGEX_MATCH_NEWLINE_ANYCRLF: Overrides the newline definition set when + * creating a new #GRegex; any '\r', '\n', or '\r\n' character sequence + * is recognized as a newline. Since: 2.34 + * @G_REGEX_MATCH_BSR_ANYCRLF: Overrides the newline definition for "\R" set when + * creating a new #GRegex; only '\r', '\n', or '\r\n' character sequences + * are recognized as a newline by "\R". Since: 2.34 + * @G_REGEX_MATCH_BSR_ANY: Overrides the newline definition for "\R" set when + * creating a new #GRegex; any Unicode newline character or character sequence + * are recognized as a newline by "\R". These are '\r', '\n' and '\rn', and the + * single characters U+000B LINE TABULATION, U+000C FORM FEED (FF), + * U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and + * U+2029 PARAGRAPH SEPARATOR. Since: 2.34 + * @G_REGEX_MATCH_PARTIAL_SOFT: An alias for #G_REGEX_MATCH_PARTIAL. Since: 2.34 + * @G_REGEX_MATCH_PARTIAL_HARD: Turns on the partial matching feature. In contrast to + * to #G_REGEX_MATCH_PARTIAL_SOFT, this stops matching as soon as a partial match + * is found, without continuing to search for a possible complete match. See + * g_match_info_is_partial_match() for more information. Since: 2.34 + * @G_REGEX_MATCH_NOTEMPTY_ATSTART: Like #G_REGEX_MATCH_NOTEMPTY, but only applied to + * the start of the matched string. For anchored + * patterns this can only happen for pattern containing "\K". Since: 2.34 + * + * Flags specifying match-time options. + * + * Since: 2.14 + */ +/* Remember to update G_REGEX_MATCH_MASK in gregex.c after + * adding a new flag. */ +typedef enum +{ + G_REGEX_MATCH_ANCHORED = 1 << 4, + G_REGEX_MATCH_NOTBOL = 1 << 7, + G_REGEX_MATCH_NOTEOL = 1 << 8, + G_REGEX_MATCH_NOTEMPTY = 1 << 10, + G_REGEX_MATCH_PARTIAL = 1 << 15, + G_REGEX_MATCH_NEWLINE_CR = 1 << 20, + G_REGEX_MATCH_NEWLINE_LF = 1 << 21, + G_REGEX_MATCH_NEWLINE_CRLF = G_REGEX_MATCH_NEWLINE_CR | G_REGEX_MATCH_NEWLINE_LF, + G_REGEX_MATCH_NEWLINE_ANY = 1 << 22, + G_REGEX_MATCH_NEWLINE_ANYCRLF = G_REGEX_MATCH_NEWLINE_CR | G_REGEX_MATCH_NEWLINE_ANY, + G_REGEX_MATCH_BSR_ANYCRLF = 1 << 23, + G_REGEX_MATCH_BSR_ANY = 1 << 24, + G_REGEX_MATCH_PARTIAL_SOFT = G_REGEX_MATCH_PARTIAL, + G_REGEX_MATCH_PARTIAL_HARD = 1 << 27, + G_REGEX_MATCH_NOTEMPTY_ATSTART = 1 << 28 +} GRegexMatchFlags; + +/** + * GRegex: + * + * A GRegex is the "compiled" form of a regular expression pattern. + * This structure is opaque and its fields cannot be accessed directly. + * + * Since: 2.14 + */ +typedef struct _GRegex GRegex; + + +/** + * GMatchInfo: + * + * A GMatchInfo is an opaque struct used to return information about + * matches. + */ +typedef struct _GMatchInfo GMatchInfo; + +/** + * GRegexEvalCallback: + * @match_info: the #GMatchInfo generated by the match. + * Use g_match_info_get_regex() and g_match_info_get_string() if you + * need the #GRegex or the matched string. + * @result: a #GString containing the new string + * @user_data: user data passed to g_regex_replace_eval() + * + * Specifies the type of the function passed to g_regex_replace_eval(). + * It is called for each occurrence of the pattern in the string passed + * to g_regex_replace_eval(), and it should append the replacement to + * @result. + * + * Returns: %FALSE to continue the replacement process, %TRUE to stop it + * + * Since: 2.14 + */ +typedef gboolean (*GRegexEvalCallback) (const GMatchInfo *match_info, + GString *result, + gpointer user_data); + + +GLIB_AVAILABLE_IN_ALL +GRegex *g_regex_new (const gchar *pattern, + GRegexCompileFlags compile_options, + GRegexMatchFlags match_options, + GError **error); +GLIB_AVAILABLE_IN_ALL +GRegex *g_regex_ref (GRegex *regex); +GLIB_AVAILABLE_IN_ALL +void g_regex_unref (GRegex *regex); +GLIB_AVAILABLE_IN_ALL +const gchar *g_regex_get_pattern (const GRegex *regex); +GLIB_AVAILABLE_IN_ALL +gint g_regex_get_max_backref (const GRegex *regex); +GLIB_AVAILABLE_IN_ALL +gint g_regex_get_capture_count (const GRegex *regex); +GLIB_AVAILABLE_IN_ALL +gboolean g_regex_get_has_cr_or_lf (const GRegex *regex); +GLIB_AVAILABLE_IN_2_38 +gint g_regex_get_max_lookbehind (const GRegex *regex); +GLIB_AVAILABLE_IN_ALL +gint g_regex_get_string_number (const GRegex *regex, + const gchar *name); +GLIB_AVAILABLE_IN_ALL +gchar *g_regex_escape_string (const gchar *string, + gint length); +GLIB_AVAILABLE_IN_ALL +gchar *g_regex_escape_nul (const gchar *string, + gint length); + +GLIB_AVAILABLE_IN_ALL +GRegexCompileFlags g_regex_get_compile_flags (const GRegex *regex); +GLIB_AVAILABLE_IN_ALL +GRegexMatchFlags g_regex_get_match_flags (const GRegex *regex); + +/* Matching. */ +GLIB_AVAILABLE_IN_ALL +gboolean g_regex_match_simple (const gchar *pattern, + const gchar *string, + GRegexCompileFlags compile_options, + GRegexMatchFlags match_options); +GLIB_AVAILABLE_IN_ALL +gboolean g_regex_match (const GRegex *regex, + const gchar *string, + GRegexMatchFlags match_options, + GMatchInfo **match_info); +GLIB_AVAILABLE_IN_ALL +gboolean g_regex_match_full (const GRegex *regex, + const gchar *string, + gssize string_len, + gint start_position, + GRegexMatchFlags match_options, + GMatchInfo **match_info, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_regex_match_all (const GRegex *regex, + const gchar *string, + GRegexMatchFlags match_options, + GMatchInfo **match_info); +GLIB_AVAILABLE_IN_ALL +gboolean g_regex_match_all_full (const GRegex *regex, + const gchar *string, + gssize string_len, + gint start_position, + GRegexMatchFlags match_options, + GMatchInfo **match_info, + GError **error); + +/* String splitting. */ +GLIB_AVAILABLE_IN_ALL +gchar **g_regex_split_simple (const gchar *pattern, + const gchar *string, + GRegexCompileFlags compile_options, + GRegexMatchFlags match_options); +GLIB_AVAILABLE_IN_ALL +gchar **g_regex_split (const GRegex *regex, + const gchar *string, + GRegexMatchFlags match_options); +GLIB_AVAILABLE_IN_ALL +gchar **g_regex_split_full (const GRegex *regex, + const gchar *string, + gssize string_len, + gint start_position, + GRegexMatchFlags match_options, + gint max_tokens, + GError **error); + +/* String replacement. */ +GLIB_AVAILABLE_IN_ALL +gchar *g_regex_replace (const GRegex *regex, + const gchar *string, + gssize string_len, + gint start_position, + const gchar *replacement, + GRegexMatchFlags match_options, + GError **error); +GLIB_AVAILABLE_IN_ALL +gchar *g_regex_replace_literal (const GRegex *regex, + const gchar *string, + gssize string_len, + gint start_position, + const gchar *replacement, + GRegexMatchFlags match_options, + GError **error); +GLIB_AVAILABLE_IN_ALL +gchar *g_regex_replace_eval (const GRegex *regex, + const gchar *string, + gssize string_len, + gint start_position, + GRegexMatchFlags match_options, + GRegexEvalCallback eval, + gpointer user_data, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_regex_check_replacement (const gchar *replacement, + gboolean *has_references, + GError **error); + +/* Match info */ +GLIB_AVAILABLE_IN_ALL +GRegex *g_match_info_get_regex (const GMatchInfo *match_info); +GLIB_AVAILABLE_IN_ALL +const gchar *g_match_info_get_string (const GMatchInfo *match_info); + +GLIB_AVAILABLE_IN_ALL +GMatchInfo *g_match_info_ref (GMatchInfo *match_info); +GLIB_AVAILABLE_IN_ALL +void g_match_info_unref (GMatchInfo *match_info); +GLIB_AVAILABLE_IN_ALL +void g_match_info_free (GMatchInfo *match_info); +GLIB_AVAILABLE_IN_ALL +gboolean g_match_info_next (GMatchInfo *match_info, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_match_info_matches (const GMatchInfo *match_info); +GLIB_AVAILABLE_IN_ALL +gint g_match_info_get_match_count (const GMatchInfo *match_info); +GLIB_AVAILABLE_IN_ALL +gboolean g_match_info_is_partial_match (const GMatchInfo *match_info); +GLIB_AVAILABLE_IN_ALL +gchar *g_match_info_expand_references(const GMatchInfo *match_info, + const gchar *string_to_expand, + GError **error); +GLIB_AVAILABLE_IN_ALL +gchar *g_match_info_fetch (const GMatchInfo *match_info, + gint match_num); +GLIB_AVAILABLE_IN_ALL +gboolean g_match_info_fetch_pos (const GMatchInfo *match_info, + gint match_num, + gint *start_pos, + gint *end_pos); +GLIB_AVAILABLE_IN_ALL +gchar *g_match_info_fetch_named (const GMatchInfo *match_info, + const gchar *name); +GLIB_AVAILABLE_IN_ALL +gboolean g_match_info_fetch_named_pos (const GMatchInfo *match_info, + const gchar *name, + gint *start_pos, + gint *end_pos); +GLIB_AVAILABLE_IN_ALL +gchar **g_match_info_fetch_all (const GMatchInfo *match_info); + +G_END_DECLS + +#endif /* __G_REGEX_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_SCANNER_H__ +#define __G_SCANNER_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GScanner GScanner; +typedef struct _GScannerConfig GScannerConfig; +typedef union _GTokenValue GTokenValue; + +typedef void (*GScannerMsgFunc) (GScanner *scanner, + gchar *message, + gboolean error); + +/* GScanner: Flexible lexical scanner for general purpose. + */ + +/* Character sets */ +#define G_CSET_A_2_Z "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +#define G_CSET_a_2_z "abcdefghijklmnopqrstuvwxyz" +#define G_CSET_DIGITS "0123456789" +#define G_CSET_LATINC "\300\301\302\303\304\305\306"\ + "\307\310\311\312\313\314\315\316\317\320"\ + "\321\322\323\324\325\326"\ + "\330\331\332\333\334\335\336" +#define G_CSET_LATINS "\337\340\341\342\343\344\345\346"\ + "\347\350\351\352\353\354\355\356\357\360"\ + "\361\362\363\364\365\366"\ + "\370\371\372\373\374\375\376\377" + +/* Error types */ +typedef enum +{ + G_ERR_UNKNOWN, + G_ERR_UNEXP_EOF, + G_ERR_UNEXP_EOF_IN_STRING, + G_ERR_UNEXP_EOF_IN_COMMENT, + G_ERR_NON_DIGIT_IN_CONST, + G_ERR_DIGIT_RADIX, + G_ERR_FLOAT_RADIX, + G_ERR_FLOAT_MALFORMED +} GErrorType; + +/* Token types */ +typedef enum +{ + G_TOKEN_EOF = 0, + + G_TOKEN_LEFT_PAREN = '(', + G_TOKEN_RIGHT_PAREN = ')', + G_TOKEN_LEFT_CURLY = '{', + G_TOKEN_RIGHT_CURLY = '}', + G_TOKEN_LEFT_BRACE = '[', + G_TOKEN_RIGHT_BRACE = ']', + G_TOKEN_EQUAL_SIGN = '=', + G_TOKEN_COMMA = ',', + + G_TOKEN_NONE = 256, + + G_TOKEN_ERROR, + + G_TOKEN_CHAR, + G_TOKEN_BINARY, + G_TOKEN_OCTAL, + G_TOKEN_INT, + G_TOKEN_HEX, + G_TOKEN_FLOAT, + G_TOKEN_STRING, + + G_TOKEN_SYMBOL, + G_TOKEN_IDENTIFIER, + G_TOKEN_IDENTIFIER_NULL, + + G_TOKEN_COMMENT_SINGLE, + G_TOKEN_COMMENT_MULTI, + + /*< private >*/ + G_TOKEN_LAST +} GTokenType; + +union _GTokenValue +{ + gpointer v_symbol; + gchar *v_identifier; + gulong v_binary; + gulong v_octal; + gulong v_int; + guint64 v_int64; + gdouble v_float; + gulong v_hex; + gchar *v_string; + gchar *v_comment; + guchar v_char; + guint v_error; +}; + +struct _GScannerConfig +{ + /* Character sets + */ + gchar *cset_skip_characters; /* default: " \t\n" */ + gchar *cset_identifier_first; + gchar *cset_identifier_nth; + gchar *cpair_comment_single; /* default: "#\n" */ + + /* Should symbol lookup work case sensitive? + */ + guint case_sensitive : 1; + + /* Boolean values to be adjusted "on the fly" + * to configure scanning behaviour. + */ + guint skip_comment_multi : 1; /* C like comment */ + guint skip_comment_single : 1; /* single line comment */ + guint scan_comment_multi : 1; /* scan multi line comments? */ + guint scan_identifier : 1; + guint scan_identifier_1char : 1; + guint scan_identifier_NULL : 1; + guint scan_symbols : 1; + guint scan_binary : 1; + guint scan_octal : 1; + guint scan_float : 1; + guint scan_hex : 1; /* '0x0ff0' */ + guint scan_hex_dollar : 1; /* '$0ff0' */ + guint scan_string_sq : 1; /* string: 'anything' */ + guint scan_string_dq : 1; /* string: "\\-escapes!\n" */ + guint numbers_2_int : 1; /* bin, octal, hex => int */ + guint int_2_float : 1; /* int => G_TOKEN_FLOAT? */ + guint identifier_2_string : 1; + guint char_2_token : 1; /* return G_TOKEN_CHAR? */ + guint symbol_2_token : 1; + guint scope_0_fallback : 1; /* try scope 0 on lookups? */ + guint store_int64 : 1; /* use value.v_int64 rather than v_int */ + + /*< private >*/ + guint padding_dummy; +}; + +struct _GScanner +{ + /* unused fields */ + gpointer user_data; + guint max_parse_errors; + + /* g_scanner_error() increments this field */ + guint parse_errors; + + /* name of input stream, featured by the default message handler */ + const gchar *input_name; + + /* quarked data */ + GData *qdata; + + /* link into the scanner configuration */ + GScannerConfig *config; + + /* fields filled in after g_scanner_get_next_token() */ + GTokenType token; + GTokenValue value; + guint line; + guint position; + + /* fields filled in after g_scanner_peek_next_token() */ + GTokenType next_token; + GTokenValue next_value; + guint next_line; + guint next_position; + + /*< private >*/ + /* to be considered private */ + GHashTable *symbol_table; + gint input_fd; + const gchar *text; + const gchar *text_end; + gchar *buffer; + guint scope_id; + + /*< public >*/ + /* handler function for _warn and _error */ + GScannerMsgFunc msg_handler; +}; + +GLIB_AVAILABLE_IN_ALL +GScanner* g_scanner_new (const GScannerConfig *config_templ); +GLIB_AVAILABLE_IN_ALL +void g_scanner_destroy (GScanner *scanner); +GLIB_AVAILABLE_IN_ALL +void g_scanner_input_file (GScanner *scanner, + gint input_fd); +GLIB_AVAILABLE_IN_ALL +void g_scanner_sync_file_offset (GScanner *scanner); +GLIB_AVAILABLE_IN_ALL +void g_scanner_input_text (GScanner *scanner, + const gchar *text, + guint text_len); +GLIB_AVAILABLE_IN_ALL +GTokenType g_scanner_get_next_token (GScanner *scanner); +GLIB_AVAILABLE_IN_ALL +GTokenType g_scanner_peek_next_token (GScanner *scanner); +GLIB_AVAILABLE_IN_ALL +GTokenType g_scanner_cur_token (GScanner *scanner); +GLIB_AVAILABLE_IN_ALL +GTokenValue g_scanner_cur_value (GScanner *scanner); +GLIB_AVAILABLE_IN_ALL +guint g_scanner_cur_line (GScanner *scanner); +GLIB_AVAILABLE_IN_ALL +guint g_scanner_cur_position (GScanner *scanner); +GLIB_AVAILABLE_IN_ALL +gboolean g_scanner_eof (GScanner *scanner); +GLIB_AVAILABLE_IN_ALL +guint g_scanner_set_scope (GScanner *scanner, + guint scope_id); +GLIB_AVAILABLE_IN_ALL +void g_scanner_scope_add_symbol (GScanner *scanner, + guint scope_id, + const gchar *symbol, + gpointer value); +GLIB_AVAILABLE_IN_ALL +void g_scanner_scope_remove_symbol (GScanner *scanner, + guint scope_id, + const gchar *symbol); +GLIB_AVAILABLE_IN_ALL +gpointer g_scanner_scope_lookup_symbol (GScanner *scanner, + guint scope_id, + const gchar *symbol); +GLIB_AVAILABLE_IN_ALL +void g_scanner_scope_foreach_symbol (GScanner *scanner, + guint scope_id, + GHFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +gpointer g_scanner_lookup_symbol (GScanner *scanner, + const gchar *symbol); +GLIB_AVAILABLE_IN_ALL +void g_scanner_unexp_token (GScanner *scanner, + GTokenType expected_token, + const gchar *identifier_spec, + const gchar *symbol_spec, + const gchar *symbol_name, + const gchar *message, + gint is_error); +GLIB_AVAILABLE_IN_ALL +void g_scanner_error (GScanner *scanner, + const gchar *format, + ...) G_GNUC_PRINTF (2,3); +GLIB_AVAILABLE_IN_ALL +void g_scanner_warn (GScanner *scanner, + const gchar *format, + ...) G_GNUC_PRINTF (2,3); + +/* keep downward source compatibility */ +#define g_scanner_add_symbol( scanner, symbol, value ) G_STMT_START { \ + g_scanner_scope_add_symbol ((scanner), 0, (symbol), (value)); \ +} G_STMT_END GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_scanner_scope_add_symbol) +#define g_scanner_remove_symbol( scanner, symbol ) G_STMT_START { \ + g_scanner_scope_remove_symbol ((scanner), 0, (symbol)); \ +} G_STMT_END GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_scanner_scope_remove_symbol) +#define g_scanner_foreach_symbol( scanner, func, data ) G_STMT_START { \ + g_scanner_scope_foreach_symbol ((scanner), 0, (func), (data)); \ +} G_STMT_END GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_scanner_scope_foreach_symbol) + +/* The following two functions are deprecated and will be removed in + * the next major release. They do no good. */ +#define g_scanner_freeze_symbol_table(scanner) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26 +#define g_scanner_thaw_symbol_table(scanner) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26 + +G_END_DECLS + +#endif /* __G_SCANNER_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 + * Soeren Sandmann (sandmann@daimi.au.dk) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __G_SEQUENCE_H__ +#define __G_SEQUENCE_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GSequence GSequence; +typedef struct _GSequenceNode GSequenceIter; + +typedef gint (* GSequenceIterCompareFunc) (GSequenceIter *a, + GSequenceIter *b, + gpointer data); + + +/* GSequence */ +GLIB_AVAILABLE_IN_ALL +GSequence * g_sequence_new (GDestroyNotify data_destroy); +GLIB_AVAILABLE_IN_ALL +void g_sequence_free (GSequence *seq); +GLIB_AVAILABLE_IN_ALL +gint g_sequence_get_length (GSequence *seq); +GLIB_AVAILABLE_IN_ALL +void g_sequence_foreach (GSequence *seq, + GFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +void g_sequence_foreach_range (GSequenceIter *begin, + GSequenceIter *end, + GFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +void g_sequence_sort (GSequence *seq, + GCompareDataFunc cmp_func, + gpointer cmp_data); +GLIB_AVAILABLE_IN_ALL +void g_sequence_sort_iter (GSequence *seq, + GSequenceIterCompareFunc cmp_func, + gpointer cmp_data); +GLIB_AVAILABLE_IN_2_48 +gboolean g_sequence_is_empty (GSequence *seq); + + +/* Getting iters */ +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_get_begin_iter (GSequence *seq); +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_get_end_iter (GSequence *seq); +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_get_iter_at_pos (GSequence *seq, + gint pos); +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_append (GSequence *seq, + gpointer data); +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_prepend (GSequence *seq, + gpointer data); +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_insert_before (GSequenceIter *iter, + gpointer data); +GLIB_AVAILABLE_IN_ALL +void g_sequence_move (GSequenceIter *src, + GSequenceIter *dest); +GLIB_AVAILABLE_IN_ALL +void g_sequence_swap (GSequenceIter *a, + GSequenceIter *b); +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_insert_sorted (GSequence *seq, + gpointer data, + GCompareDataFunc cmp_func, + gpointer cmp_data); +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_insert_sorted_iter (GSequence *seq, + gpointer data, + GSequenceIterCompareFunc iter_cmp, + gpointer cmp_data); +GLIB_AVAILABLE_IN_ALL +void g_sequence_sort_changed (GSequenceIter *iter, + GCompareDataFunc cmp_func, + gpointer cmp_data); +GLIB_AVAILABLE_IN_ALL +void g_sequence_sort_changed_iter (GSequenceIter *iter, + GSequenceIterCompareFunc iter_cmp, + gpointer cmp_data); +GLIB_AVAILABLE_IN_ALL +void g_sequence_remove (GSequenceIter *iter); +GLIB_AVAILABLE_IN_ALL +void g_sequence_remove_range (GSequenceIter *begin, + GSequenceIter *end); +GLIB_AVAILABLE_IN_ALL +void g_sequence_move_range (GSequenceIter *dest, + GSequenceIter *begin, + GSequenceIter *end); +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_search (GSequence *seq, + gpointer data, + GCompareDataFunc cmp_func, + gpointer cmp_data); +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_search_iter (GSequence *seq, + gpointer data, + GSequenceIterCompareFunc iter_cmp, + gpointer cmp_data); +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_lookup (GSequence *seq, + gpointer data, + GCompareDataFunc cmp_func, + gpointer cmp_data); +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_lookup_iter (GSequence *seq, + gpointer data, + GSequenceIterCompareFunc iter_cmp, + gpointer cmp_data); + + +/* Dereferencing */ +GLIB_AVAILABLE_IN_ALL +gpointer g_sequence_get (GSequenceIter *iter); +GLIB_AVAILABLE_IN_ALL +void g_sequence_set (GSequenceIter *iter, + gpointer data); + +/* Operations on GSequenceIter * */ +GLIB_AVAILABLE_IN_ALL +gboolean g_sequence_iter_is_begin (GSequenceIter *iter); +GLIB_AVAILABLE_IN_ALL +gboolean g_sequence_iter_is_end (GSequenceIter *iter); +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_iter_next (GSequenceIter *iter); +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_iter_prev (GSequenceIter *iter); +GLIB_AVAILABLE_IN_ALL +gint g_sequence_iter_get_position (GSequenceIter *iter); +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_iter_move (GSequenceIter *iter, + gint delta); +GLIB_AVAILABLE_IN_ALL +GSequence * g_sequence_iter_get_sequence (GSequenceIter *iter); + + +/* Search */ +GLIB_AVAILABLE_IN_ALL +gint g_sequence_iter_compare (GSequenceIter *a, + GSequenceIter *b); +GLIB_AVAILABLE_IN_ALL +GSequenceIter *g_sequence_range_get_midpoint (GSequenceIter *begin, + GSequenceIter *end); + +G_END_DECLS + +#endif /* __G_SEQUENCE_H__ */ +/* gshell.h - Shell-related utilities + * + * Copyright 2000 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_SHELL_H__ +#define __G_SHELL_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_SHELL_ERROR g_shell_error_quark () + +typedef enum +{ + /* mismatched or otherwise mangled quoting */ + G_SHELL_ERROR_BAD_QUOTING, + /* string to be parsed was empty */ + G_SHELL_ERROR_EMPTY_STRING, + G_SHELL_ERROR_FAILED +} GShellError; + +GLIB_AVAILABLE_IN_ALL +GQuark g_shell_error_quark (void); + +GLIB_AVAILABLE_IN_ALL +gchar* g_shell_quote (const gchar *unquoted_string); +GLIB_AVAILABLE_IN_ALL +gchar* g_shell_unquote (const gchar *quoted_string, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_shell_parse_argv (const gchar *command_line, + gint *argcp, + gchar ***argvp, + GError **error); + +G_END_DECLS + +#endif /* __G_SHELL_H__ */ +/* GLIB sliced memory - fast threaded memory chunk allocator + * Copyright (C) 2005 Tim Janik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __G_SLICE_H__ +#define __G_SLICE_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +G_BEGIN_DECLS + +/* slices - fast allocation/release of small memory blocks + */ +GLIB_AVAILABLE_IN_ALL +gpointer g_slice_alloc (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +GLIB_AVAILABLE_IN_ALL +gpointer g_slice_alloc0 (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +GLIB_AVAILABLE_IN_ALL +gpointer g_slice_copy (gsize block_size, + gconstpointer mem_block) G_GNUC_ALLOC_SIZE(1); +GLIB_AVAILABLE_IN_ALL +void g_slice_free1 (gsize block_size, + gpointer mem_block); +GLIB_AVAILABLE_IN_ALL +void g_slice_free_chain_with_offset (gsize block_size, + gpointer mem_chain, + gsize next_offset); +#define g_slice_new(type) ((type*) g_slice_alloc (sizeof (type))) + +/* Allow the compiler to inline memset(). Since the size is a constant, this + * can significantly improve performance. */ +#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) +# define g_slice_new0(type) \ + (type *) (G_GNUC_EXTENSION ({ \ + gsize __s = sizeof (type); \ + gpointer __p; \ + __p = g_slice_alloc (__s); \ + memset (__p, 0, __s); \ + __p; \ + })) +#else +# define g_slice_new0(type) ((type*) g_slice_alloc0 (sizeof (type))) +#endif + +/* MemoryBlockType * + * g_slice_dup (MemoryBlockType, + * MemoryBlockType *mem_block); + * g_slice_free (MemoryBlockType, + * MemoryBlockType *mem_block); + * g_slice_free_chain (MemoryBlockType, + * MemoryBlockType *first_chain_block, + * memory_block_next_field); + * pseudo prototypes for the macro + * definitions following below. + */ + +/* we go through extra hoops to ensure type safety */ +#define g_slice_dup(type, mem) \ + (1 ? (type*) g_slice_copy (sizeof (type), (mem)) \ + : ((void) ((type*) 0 == (mem)), (type*) 0)) +#define g_slice_free(type, mem) \ +G_STMT_START { \ + if (1) g_slice_free1 (sizeof (type), (mem)); \ + else (void) ((type*) 0 == (mem)); \ +} G_STMT_END +#define g_slice_free_chain(type, mem_chain, next) \ +G_STMT_START { \ + if (1) g_slice_free_chain_with_offset (sizeof (type), \ + (mem_chain), G_STRUCT_OFFSET (type, next)); \ + else (void) ((type*) 0 == (mem_chain)); \ +} G_STMT_END + +/* --- internal debugging API --- */ +typedef enum { + G_SLICE_CONFIG_ALWAYS_MALLOC = 1, + G_SLICE_CONFIG_BYPASS_MAGAZINES, + G_SLICE_CONFIG_WORKING_SET_MSECS, + G_SLICE_CONFIG_COLOR_INCREMENT, + G_SLICE_CONFIG_CHUNK_SIZES, + G_SLICE_CONFIG_CONTENTION_COUNTER +} GSliceConfig; + +GLIB_DEPRECATED_IN_2_34 +void g_slice_set_config (GSliceConfig ckey, gint64 value); +GLIB_DEPRECATED_IN_2_34 +gint64 g_slice_get_config (GSliceConfig ckey); +GLIB_DEPRECATED_IN_2_34 +gint64* g_slice_get_config_state (GSliceConfig ckey, gint64 address, guint *n_values); + +#ifdef G_ENABLE_DEBUG +GLIB_AVAILABLE_IN_ALL +void g_slice_debug_tree_statistics (void); +#endif + +G_END_DECLS + +#endif /* __G_SLICE_H__ */ +/* gspawn.h - Process launching + * + * Copyright 2000 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#ifndef __G_SPAWN_H__ +#define __G_SPAWN_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + + +/* I'm not sure I remember our proposed naming convention here. */ +/** + * G_SPAWN_ERROR: + * + * Error domain for spawning processes. Errors in this domain will + * be from the #GSpawnError enumeration. See #GError for information on + * error domains. + */ +#define G_SPAWN_ERROR g_spawn_error_quark () + +/** + * GSpawnError: + * @G_SPAWN_ERROR_FORK: Fork failed due to lack of memory. + * @G_SPAWN_ERROR_READ: Read or select on pipes failed. + * @G_SPAWN_ERROR_CHDIR: Changing to working directory failed. + * @G_SPAWN_ERROR_ACCES: execv() returned `EACCES` + * @G_SPAWN_ERROR_PERM: execv() returned `EPERM` + * @G_SPAWN_ERROR_TOO_BIG: execv() returned `E2BIG` + * @G_SPAWN_ERROR_2BIG: deprecated alias for %G_SPAWN_ERROR_TOO_BIG (deprecated since GLib 2.32) + * @G_SPAWN_ERROR_NOEXEC: execv() returned `ENOEXEC` + * @G_SPAWN_ERROR_NAMETOOLONG: execv() returned `ENAMETOOLONG` + * @G_SPAWN_ERROR_NOENT: execv() returned `ENOENT` + * @G_SPAWN_ERROR_NOMEM: execv() returned `ENOMEM` + * @G_SPAWN_ERROR_NOTDIR: execv() returned `ENOTDIR` + * @G_SPAWN_ERROR_LOOP: execv() returned `ELOOP` + * @G_SPAWN_ERROR_TXTBUSY: execv() returned `ETXTBUSY` + * @G_SPAWN_ERROR_IO: execv() returned `EIO` + * @G_SPAWN_ERROR_NFILE: execv() returned `ENFILE` + * @G_SPAWN_ERROR_MFILE: execv() returned `EMFILE` + * @G_SPAWN_ERROR_INVAL: execv() returned `EINVAL` + * @G_SPAWN_ERROR_ISDIR: execv() returned `EISDIR` + * @G_SPAWN_ERROR_LIBBAD: execv() returned `ELIBBAD` + * @G_SPAWN_ERROR_FAILED: Some other fatal failure, + * `error->message` should explain. + * + * Error codes returned by spawning processes. + */ +typedef enum +{ + G_SPAWN_ERROR_FORK, /* fork failed due to lack of memory */ + G_SPAWN_ERROR_READ, /* read or select on pipes failed */ + G_SPAWN_ERROR_CHDIR, /* changing to working dir failed */ + G_SPAWN_ERROR_ACCES, /* execv() returned EACCES */ + G_SPAWN_ERROR_PERM, /* execv() returned EPERM */ + G_SPAWN_ERROR_TOO_BIG,/* execv() returned E2BIG */ + G_SPAWN_ERROR_2BIG GLIB_DEPRECATED_ENUMERATOR_IN_2_32_FOR(G_SPAWN_ERROR_TOO_BIG) = G_SPAWN_ERROR_TOO_BIG, + G_SPAWN_ERROR_NOEXEC, /* execv() returned ENOEXEC */ + G_SPAWN_ERROR_NAMETOOLONG, /* "" "" ENAMETOOLONG */ + G_SPAWN_ERROR_NOENT, /* "" "" ENOENT */ + G_SPAWN_ERROR_NOMEM, /* "" "" ENOMEM */ + G_SPAWN_ERROR_NOTDIR, /* "" "" ENOTDIR */ + G_SPAWN_ERROR_LOOP, /* "" "" ELOOP */ + G_SPAWN_ERROR_TXTBUSY, /* "" "" ETXTBUSY */ + G_SPAWN_ERROR_IO, /* "" "" EIO */ + G_SPAWN_ERROR_NFILE, /* "" "" ENFILE */ + G_SPAWN_ERROR_MFILE, /* "" "" EMFLE */ + G_SPAWN_ERROR_INVAL, /* "" "" EINVAL */ + G_SPAWN_ERROR_ISDIR, /* "" "" EISDIR */ + G_SPAWN_ERROR_LIBBAD, /* "" "" ELIBBAD */ + G_SPAWN_ERROR_FAILED /* other fatal failure, error->message + * should explain + */ +} GSpawnError; + +/** + * G_SPAWN_EXIT_ERROR: + * + * Error domain used by g_spawn_check_exit_status(). The code + * will be the program exit code. + */ +#define G_SPAWN_EXIT_ERROR g_spawn_exit_error_quark () + +/** + * GSpawnChildSetupFunc: + * @user_data: (closure): user data to pass to the function. + * + * Specifies the type of the setup function passed to g_spawn_async(), + * g_spawn_sync() and g_spawn_async_with_pipes(), which can, in very + * limited ways, be used to affect the child's execution. + * + * On POSIX platforms, the function is called in the child after GLib + * has performed all the setup it plans to perform, but before calling + * exec(). Actions taken in this function will only affect the child, + * not the parent. + * + * On Windows, the function is called in the parent. Its usefulness on + * Windows is thus questionable. In many cases executing the child setup + * function in the parent can have ill effects, and you should be very + * careful when porting software to Windows that uses child setup + * functions. + * + * However, even on POSIX, you are extremely limited in what you can + * safely do from a #GSpawnChildSetupFunc, because any mutexes that were + * held by other threads in the parent process at the time of the fork() + * will still be locked in the child process, and they will never be + * unlocked (since the threads that held them don't exist in the child). + * POSIX allows only async-signal-safe functions (see signal(7)) to be + * called in the child between fork() and exec(), which drastically limits + * the usefulness of child setup functions. + * + * In particular, it is not safe to call any function which may + * call malloc(), which includes POSIX functions such as setenv(). + * If you need to set up the child environment differently from + * the parent, you should use g_get_environ(), g_environ_setenv(), + * and g_environ_unsetenv(), and then pass the complete environment + * list to the `g_spawn...` function. + */ +typedef void (* GSpawnChildSetupFunc) (gpointer user_data); + +/** + * GSpawnFlags: + * @G_SPAWN_DEFAULT: no flags, default behaviour + * @G_SPAWN_LEAVE_DESCRIPTORS_OPEN: the parent's open file descriptors will + * be inherited by the child; otherwise all descriptors except stdin, + * stdout and stderr will be closed before calling exec() in the child. + * @G_SPAWN_DO_NOT_REAP_CHILD: the child will not be automatically reaped; + * you must use g_child_watch_add() yourself (or call waitpid() or handle + * `SIGCHLD` yourself), or the child will become a zombie. + * @G_SPAWN_SEARCH_PATH: `argv[0]` need not be an absolute path, it will be + * looked for in the user's `PATH`. + * @G_SPAWN_STDOUT_TO_DEV_NULL: the child's standard output will be discarded, + * instead of going to the same location as the parent's standard output. + * @G_SPAWN_STDERR_TO_DEV_NULL: the child's standard error will be discarded. + * @G_SPAWN_CHILD_INHERITS_STDIN: the child will inherit the parent's standard + * input (by default, the child's standard input is attached to `/dev/null`). + * @G_SPAWN_FILE_AND_ARGV_ZERO: the first element of `argv` is the file to + * execute, while the remaining elements are the actual argument vector + * to pass to the file. Normally g_spawn_async_with_pipes() uses `argv[0]` + * as the file to execute, and passes all of `argv` to the child. + * @G_SPAWN_SEARCH_PATH_FROM_ENVP: if `argv[0]` is not an absolute path, + * it will be looked for in the `PATH` from the passed child environment. + * Since: 2.34 + * @G_SPAWN_CLOEXEC_PIPES: create all pipes with the `O_CLOEXEC` flag set. + * Since: 2.40 + * + * Flags passed to g_spawn_sync(), g_spawn_async() and g_spawn_async_with_pipes(). + */ +typedef enum +{ + G_SPAWN_DEFAULT = 0, + G_SPAWN_LEAVE_DESCRIPTORS_OPEN = 1 << 0, + G_SPAWN_DO_NOT_REAP_CHILD = 1 << 1, + /* look for argv[0] in the path i.e. use execvp() */ + G_SPAWN_SEARCH_PATH = 1 << 2, + /* Dump output to /dev/null */ + G_SPAWN_STDOUT_TO_DEV_NULL = 1 << 3, + G_SPAWN_STDERR_TO_DEV_NULL = 1 << 4, + G_SPAWN_CHILD_INHERITS_STDIN = 1 << 5, + G_SPAWN_FILE_AND_ARGV_ZERO = 1 << 6, + G_SPAWN_SEARCH_PATH_FROM_ENVP = 1 << 7, + G_SPAWN_CLOEXEC_PIPES = 1 << 8 +} GSpawnFlags; + +GLIB_AVAILABLE_IN_ALL +GQuark g_spawn_error_quark (void); +GLIB_AVAILABLE_IN_ALL +GQuark g_spawn_exit_error_quark (void); + +GLIB_AVAILABLE_IN_ALL +gboolean g_spawn_async (const gchar *working_directory, + gchar **argv, + gchar **envp, + GSpawnFlags flags, + GSpawnChildSetupFunc child_setup, + gpointer user_data, + GPid *child_pid, + GError **error); + + +/* Opens pipes for non-NULL standard_output, standard_input, standard_error, + * and returns the parent's end of the pipes. + */ +GLIB_AVAILABLE_IN_ALL +gboolean g_spawn_async_with_pipes (const gchar *working_directory, + gchar **argv, + gchar **envp, + GSpawnFlags flags, + GSpawnChildSetupFunc child_setup, + gpointer user_data, + GPid *child_pid, + gint *standard_input, + gint *standard_output, + gint *standard_error, + GError **error); + +/* Lets you provide fds for stdin/stdout/stderr */ +GLIB_AVAILABLE_IN_2_58 +gboolean g_spawn_async_with_fds (const gchar *working_directory, + gchar **argv, + gchar **envp, + GSpawnFlags flags, + GSpawnChildSetupFunc child_setup, + gpointer user_data, + GPid *child_pid, + gint stdin_fd, + gint stdout_fd, + gint stderr_fd, + GError **error); + +/* If standard_output or standard_error are non-NULL, the full + * standard output or error of the command will be placed there. + */ + +GLIB_AVAILABLE_IN_ALL +gboolean g_spawn_sync (const gchar *working_directory, + gchar **argv, + gchar **envp, + GSpawnFlags flags, + GSpawnChildSetupFunc child_setup, + gpointer user_data, + gchar **standard_output, + gchar **standard_error, + gint *exit_status, + GError **error); + +GLIB_AVAILABLE_IN_ALL +gboolean g_spawn_command_line_sync (const gchar *command_line, + gchar **standard_output, + gchar **standard_error, + gint *exit_status, + GError **error); +GLIB_AVAILABLE_IN_ALL +gboolean g_spawn_command_line_async (const gchar *command_line, + GError **error); + +GLIB_AVAILABLE_IN_2_34 +gboolean g_spawn_check_exit_status (gint exit_status, + GError **error); + +GLIB_AVAILABLE_IN_ALL +void g_spawn_close_pid (GPid pid); + +G_END_DECLS + +#endif /* __G_SPAWN_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_STRFUNCS_H__ +#define __G_STRFUNCS_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +G_BEGIN_DECLS + +/* Functions like the ones in that are not affected by locale. */ +typedef enum { + G_ASCII_ALNUM = 1 << 0, + G_ASCII_ALPHA = 1 << 1, + G_ASCII_CNTRL = 1 << 2, + G_ASCII_DIGIT = 1 << 3, + G_ASCII_GRAPH = 1 << 4, + G_ASCII_LOWER = 1 << 5, + G_ASCII_PRINT = 1 << 6, + G_ASCII_PUNCT = 1 << 7, + G_ASCII_SPACE = 1 << 8, + G_ASCII_UPPER = 1 << 9, + G_ASCII_XDIGIT = 1 << 10 +} GAsciiType; + +GLIB_VAR const guint16 * const g_ascii_table; + +#define g_ascii_isalnum(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_ALNUM) != 0) + +#define g_ascii_isalpha(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_ALPHA) != 0) + +#define g_ascii_iscntrl(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_CNTRL) != 0) + +#define g_ascii_isdigit(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_DIGIT) != 0) + +#define g_ascii_isgraph(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_GRAPH) != 0) + +#define g_ascii_islower(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_LOWER) != 0) + +#define g_ascii_isprint(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_PRINT) != 0) + +#define g_ascii_ispunct(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_PUNCT) != 0) + +#define g_ascii_isspace(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_SPACE) != 0) + +#define g_ascii_isupper(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_UPPER) != 0) + +#define g_ascii_isxdigit(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_XDIGIT) != 0) + +GLIB_AVAILABLE_IN_ALL +gchar g_ascii_tolower (gchar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gchar g_ascii_toupper (gchar c) G_GNUC_CONST; + +GLIB_AVAILABLE_IN_ALL +gint g_ascii_digit_value (gchar c) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gint g_ascii_xdigit_value (gchar c) G_GNUC_CONST; + +/* String utility functions that modify a string argument or + * return a constant string that must not be freed. + */ +#define G_STR_DELIMITERS "_-|> <." +GLIB_AVAILABLE_IN_ALL +gchar* g_strdelimit (gchar *string, + const gchar *delimiters, + gchar new_delimiter); +GLIB_AVAILABLE_IN_ALL +gchar* g_strcanon (gchar *string, + const gchar *valid_chars, + gchar substitutor); +GLIB_AVAILABLE_IN_ALL +const gchar * g_strerror (gint errnum) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +const gchar * g_strsignal (gint signum) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gchar * g_strreverse (gchar *string); +GLIB_AVAILABLE_IN_ALL +gsize g_strlcpy (gchar *dest, + const gchar *src, + gsize dest_size); +GLIB_AVAILABLE_IN_ALL +gsize g_strlcat (gchar *dest, + const gchar *src, + gsize dest_size); +GLIB_AVAILABLE_IN_ALL +gchar * g_strstr_len (const gchar *haystack, + gssize haystack_len, + const gchar *needle); +GLIB_AVAILABLE_IN_ALL +gchar * g_strrstr (const gchar *haystack, + const gchar *needle); +GLIB_AVAILABLE_IN_ALL +gchar * g_strrstr_len (const gchar *haystack, + gssize haystack_len, + const gchar *needle); + +GLIB_AVAILABLE_IN_ALL +gboolean g_str_has_suffix (const gchar *str, + const gchar *suffix); +GLIB_AVAILABLE_IN_ALL +gboolean g_str_has_prefix (const gchar *str, + const gchar *prefix); + +/* String to/from double conversion functions */ + +GLIB_AVAILABLE_IN_ALL +gdouble g_strtod (const gchar *nptr, + gchar **endptr); +GLIB_AVAILABLE_IN_ALL +gdouble g_ascii_strtod (const gchar *nptr, + gchar **endptr); +GLIB_AVAILABLE_IN_ALL +guint64 g_ascii_strtoull (const gchar *nptr, + gchar **endptr, + guint base); +GLIB_AVAILABLE_IN_ALL +gint64 g_ascii_strtoll (const gchar *nptr, + gchar **endptr, + guint base); +/* 29 bytes should enough for all possible values that + * g_ascii_dtostr can produce. + * Then add 10 for good measure */ +#define G_ASCII_DTOSTR_BUF_SIZE (29 + 10) +GLIB_AVAILABLE_IN_ALL +gchar * g_ascii_dtostr (gchar *buffer, + gint buf_len, + gdouble d); +GLIB_AVAILABLE_IN_ALL +gchar * g_ascii_formatd (gchar *buffer, + gint buf_len, + const gchar *format, + gdouble d); + +/* removes leading spaces */ +GLIB_AVAILABLE_IN_ALL +gchar* g_strchug (gchar *string); +/* removes trailing spaces */ +GLIB_AVAILABLE_IN_ALL +gchar* g_strchomp (gchar *string); +/* removes leading & trailing spaces */ +#define g_strstrip( string ) g_strchomp (g_strchug (string)) + +GLIB_AVAILABLE_IN_ALL +gint g_ascii_strcasecmp (const gchar *s1, + const gchar *s2); +GLIB_AVAILABLE_IN_ALL +gint g_ascii_strncasecmp (const gchar *s1, + const gchar *s2, + gsize n); +GLIB_AVAILABLE_IN_ALL +gchar* g_ascii_strdown (const gchar *str, + gssize len) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar* g_ascii_strup (const gchar *str, + gssize len) G_GNUC_MALLOC; + +GLIB_AVAILABLE_IN_2_40 +gboolean g_str_is_ascii (const gchar *str); + +GLIB_DEPRECATED +gint g_strcasecmp (const gchar *s1, + const gchar *s2); +GLIB_DEPRECATED +gint g_strncasecmp (const gchar *s1, + const gchar *s2, + guint n); +GLIB_DEPRECATED +gchar* g_strdown (gchar *string); +GLIB_DEPRECATED +gchar* g_strup (gchar *string); + + +/* String utility functions that return a newly allocated string which + * ought to be freed with g_free from the caller at some point. + */ +GLIB_AVAILABLE_IN_ALL +gchar* g_strdup (const gchar *str) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar* g_strdup_printf (const gchar *format, + ...) G_GNUC_PRINTF (1, 2) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar* g_strdup_vprintf (const gchar *format, + va_list args) G_GNUC_PRINTF(1, 0) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar* g_strndup (const gchar *str, + gsize n) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar* g_strnfill (gsize length, + gchar fill_char) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +gchar* g_strconcat (const gchar *string1, + ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED; +GLIB_AVAILABLE_IN_ALL +gchar* g_strjoin (const gchar *separator, + ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED; + +/* Make a copy of a string interpreting C string -style escape + * sequences. Inverse of g_strescape. The recognized sequences are \b + * \f \n \r \t \\ \" and the octal format. + */ +GLIB_AVAILABLE_IN_ALL +gchar* g_strcompress (const gchar *source) G_GNUC_MALLOC; + +/* Copy a string escaping nonprintable characters like in C strings. + * Inverse of g_strcompress. The exceptions parameter, if non-NULL, points + * to a string containing characters that are not to be escaped. + * + * Deprecated API: gchar* g_strescape (const gchar *source); + * Luckily this function wasn't used much, using NULL as second parameter + * provides mostly identical semantics. + */ +GLIB_AVAILABLE_IN_ALL +gchar* g_strescape (const gchar *source, + const gchar *exceptions) G_GNUC_MALLOC; + +GLIB_AVAILABLE_IN_ALL +gpointer g_memdup (gconstpointer mem, + guint byte_size) G_GNUC_ALLOC_SIZE(2); + +/* NULL terminated string arrays. + * g_strsplit(), g_strsplit_set() split up string into max_tokens tokens + * at delim and return a newly allocated string array. + * g_strjoinv() concatenates all of str_array's strings, sliding in an + * optional separator, the returned string is newly allocated. + * g_strfreev() frees the array itself and all of its strings. + * g_strdupv() copies a NULL-terminated array of strings + * g_strv_length() returns the length of a NULL-terminated array of strings + */ +typedef gchar** GStrv; +GLIB_AVAILABLE_IN_ALL +gchar** g_strsplit (const gchar *string, + const gchar *delimiter, + gint max_tokens); +GLIB_AVAILABLE_IN_ALL +gchar ** g_strsplit_set (const gchar *string, + const gchar *delimiters, + gint max_tokens); +GLIB_AVAILABLE_IN_ALL +gchar* g_strjoinv (const gchar *separator, + gchar **str_array) G_GNUC_MALLOC; +GLIB_AVAILABLE_IN_ALL +void g_strfreev (gchar **str_array); +GLIB_AVAILABLE_IN_ALL +gchar** g_strdupv (gchar **str_array); +GLIB_AVAILABLE_IN_ALL +guint g_strv_length (gchar **str_array); + +GLIB_AVAILABLE_IN_ALL +gchar* g_stpcpy (gchar *dest, + const char *src); + +GLIB_AVAILABLE_IN_2_40 +gchar * g_str_to_ascii (const gchar *str, + const gchar *from_locale); + +GLIB_AVAILABLE_IN_2_40 +gchar ** g_str_tokenize_and_fold (const gchar *string, + const gchar *translit_locale, + gchar ***ascii_alternates); + +GLIB_AVAILABLE_IN_2_40 +gboolean g_str_match_string (const gchar *search_term, + const gchar *potential_hit, + gboolean accept_alternates); + +GLIB_AVAILABLE_IN_2_44 +gboolean g_strv_contains (const gchar * const *strv, + const gchar *str); + +GLIB_AVAILABLE_IN_2_60 +gboolean g_strv_equal (const gchar * const *strv1, + const gchar * const *strv2); + +/* Convenience ASCII string to number API */ + +/** + * GNumberParserError: + * @G_NUMBER_PARSER_ERROR_INVALID: String was not a valid number. + * @G_NUMBER_PARSER_ERROR_OUT_OF_BOUNDS: String was a number, but out of bounds. + * + * Error codes returned by functions converting a string to a number. + * + * Since: 2.54 + */ +typedef enum + { + G_NUMBER_PARSER_ERROR_INVALID, + G_NUMBER_PARSER_ERROR_OUT_OF_BOUNDS, + } GNumberParserError; + +/** + * G_NUMBER_PARSER_ERROR: + * + * Domain for errors returned by functions converting a string to a + * number. + * + * Since: 2.54 + */ +#define G_NUMBER_PARSER_ERROR (g_number_parser_error_quark ()) + +GLIB_AVAILABLE_IN_2_54 +GQuark g_number_parser_error_quark (void); + +GLIB_AVAILABLE_IN_2_54 +gboolean g_ascii_string_to_signed (const gchar *str, + guint base, + gint64 min, + gint64 max, + gint64 *out_num, + GError **error); + +GLIB_AVAILABLE_IN_2_54 +gboolean g_ascii_string_to_unsigned (const gchar *str, + guint base, + guint64 min, + guint64 max, + guint64 *out_num, + GError **error); + +G_END_DECLS + +#endif /* __G_STRFUNCS_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_STRINGCHUNK_H__ +#define __G_STRINGCHUNK_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GStringChunk GStringChunk; + +GLIB_AVAILABLE_IN_ALL +GStringChunk* g_string_chunk_new (gsize size); +GLIB_AVAILABLE_IN_ALL +void g_string_chunk_free (GStringChunk *chunk); +GLIB_AVAILABLE_IN_ALL +void g_string_chunk_clear (GStringChunk *chunk); +GLIB_AVAILABLE_IN_ALL +gchar* g_string_chunk_insert (GStringChunk *chunk, + const gchar *string); +GLIB_AVAILABLE_IN_ALL +gchar* g_string_chunk_insert_len (GStringChunk *chunk, + const gchar *string, + gssize len); +GLIB_AVAILABLE_IN_ALL +gchar* g_string_chunk_insert_const (GStringChunk *chunk, + const gchar *string); + +G_END_DECLS + +#endif /* __G_STRING_H__ */ +/* + * Copyright © 2020 Canonical Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __G_STRVBUILDER_H__ +#define __G_STRVBUILDER_H__ + +#if !defined(__GLIB_H_INSIDE__) && !defined(GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * GStrvBuilder: + * + * A helper object to build a %NULL-terminated string array + * by appending. See g_strv_builder_new(). + * + * Since: 2.68 + */ +typedef struct _GStrvBuilder GStrvBuilder; + +GLIB_AVAILABLE_IN_2_68 +GStrvBuilder *g_strv_builder_new (void); + +GLIB_AVAILABLE_IN_2_68 +void g_strv_builder_unref (GStrvBuilder *builder); + +GLIB_AVAILABLE_IN_2_68 +GStrvBuilder *g_strv_builder_ref (GStrvBuilder *builder); + +GLIB_AVAILABLE_IN_2_68 +void g_strv_builder_add (GStrvBuilder *builder, + const char *value); + +GLIB_AVAILABLE_IN_2_68 +GStrv g_strv_builder_end (GStrvBuilder *builder); + +G_END_DECLS + +#endif /* __G_STRVBUILDER_H__ */ +/* GLib testing utilities + * Copyright (C) 2007 Imendio AB + * Authors: Tim Janik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __G_TEST_UTILS_H__ +#define __G_TEST_UTILS_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include + +G_BEGIN_DECLS + +typedef struct GTestCase GTestCase; +typedef struct GTestSuite GTestSuite; +typedef void (*GTestFunc) (void); +typedef void (*GTestDataFunc) (gconstpointer user_data); +typedef void (*GTestFixtureFunc) (gpointer fixture, + gconstpointer user_data); + +/* assertion API */ +#define g_assert_cmpstr(s1, cmp, s2) G_STMT_START { \ + const char *__s1 = (s1), *__s2 = (s2); \ + if (g_strcmp0 (__s1, __s2) cmp 0) ; else \ + g_assertion_message_cmpstr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #s1 " " #cmp " " #s2, __s1, #cmp, __s2); \ + } G_STMT_END +#define g_assert_cmpint(n1, cmp, n2) G_STMT_START { \ + gint64 __n1 = (n1), __n2 = (n2); \ + if (__n1 cmp __n2) ; else \ + g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #n1 " " #cmp " " #n2, (long double) __n1, #cmp, (long double) __n2, 'i'); \ + } G_STMT_END +#define g_assert_cmpuint(n1, cmp, n2) G_STMT_START { \ + guint64 __n1 = (n1), __n2 = (n2); \ + if (__n1 cmp __n2) ; else \ + g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #n1 " " #cmp " " #n2, (long double) __n1, #cmp, (long double) __n2, 'i'); \ + } G_STMT_END +#define g_assert_cmphex(n1, cmp, n2) G_STMT_START {\ + guint64 __n1 = (n1), __n2 = (n2); \ + if (__n1 cmp __n2) ; else \ + g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #n1 " " #cmp " " #n2, (long double) __n1, #cmp, (long double) __n2, 'x'); \ + } G_STMT_END +#define g_assert_cmpfloat(n1,cmp,n2) G_STMT_START { \ + long double __n1 = (long double) (n1), __n2 = (long double) (n2); \ + if (__n1 cmp __n2) ; else \ + g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #n1 " " #cmp " " #n2, (long double) __n1, #cmp, (long double) __n2, 'f'); \ + } G_STMT_END +#define g_assert_cmpfloat_with_epsilon(n1,n2,epsilon) \ + G_STMT_START { \ + double __n1 = (n1), __n2 = (n2), __epsilon = (epsilon); \ + if (G_APPROX_VALUE (__n1, __n2, __epsilon)) ; else \ + g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #n1 " == " #n2 " (+/- " #epsilon ")", __n1, "==", __n2, 'f'); \ + } G_STMT_END +#define g_assert_cmpmem(m1, l1, m2, l2) G_STMT_START {\ + gconstpointer __m1 = m1, __m2 = m2; \ + int __l1 = l1, __l2 = l2; \ + if (__l1 != 0 && __m1 == NULL) \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "assertion failed (" #l1 " == 0 || " #m1 " != NULL)"); \ + else if (__l2 != 0 && __m2 == NULL) \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "assertion failed (" #l2 " == 0 || " #m2 " != NULL)"); \ + else if (__l1 != __l2) \ + g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #l1 " (len(" #m1 ")) == " #l2 " (len(" #m2 "))", \ + (long double) __l1, "==", (long double) __l2, 'i'); \ + else if (__l1 != 0 && __m2 != NULL && memcmp (__m1, __m2, __l1) != 0) \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "assertion failed (" #m1 " == " #m2 ")"); \ + } G_STMT_END +#define g_assert_cmpvariant(v1, v2) \ + G_STMT_START \ + { \ + GVariant *__v1 = (v1), *__v2 = (v2); \ + if (!g_variant_equal (__v1, __v2)) \ + { \ + gchar *__s1, *__s2, *__msg; \ + __s1 = g_variant_print (__v1, TRUE); \ + __s2 = g_variant_print (__v2, TRUE); \ + __msg = g_strdup_printf ("assertion failed (" #v1 " == " #v2 "): %s does not equal %s", __s1, __s2); \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \ + g_free (__s1); \ + g_free (__s2); \ + g_free (__msg); \ + } \ + } \ + G_STMT_END +#define g_assert_cmpstrv(strv1, strv2) \ + G_STMT_START \ + { \ + const char * const *__strv1 = (const char * const *) (strv1); \ + const char * const *__strv2 = (const char * const *) (strv2); \ + if (!__strv1 || !__strv2) \ + { \ + if (__strv1) \ + { \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "assertion failed (" #strv1 " == " #strv2 "): " #strv2 " is NULL, but " #strv1 " is not"); \ + } \ + else if (__strv2) \ + { \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "assertion failed (" #strv1 " == " #strv2 "): " #strv1 " is NULL, but " #strv2 " is not"); \ + } \ + } \ + else \ + { \ + guint __l1 = g_strv_length ((char **) __strv1); \ + guint __l2 = g_strv_length ((char **) __strv2); \ + if (__l1 != __l2) \ + { \ + char *__msg; \ + __msg = g_strdup_printf ("assertion failed (" #strv1 " == " #strv2 "): length %u does not equal length %u", __l1, __l2); \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \ + g_free (__msg); \ + } \ + else \ + { \ + guint __i; \ + for (__i = 0; __i < __l1; __i++) \ + { \ + if (g_strcmp0 (__strv1[__i], __strv2[__i]) != 0) \ + { \ + g_assertion_message_cmpstrv (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #strv1 " == " #strv2, \ + __strv1, __strv2, __i); \ + } \ + } \ + } \ + } \ + } \ + G_STMT_END +#define g_assert_no_errno(expr) G_STMT_START { \ + int __ret, __errsv; \ + errno = 0; \ + __ret = expr; \ + __errsv = errno; \ + if (__ret < 0) \ + { \ + gchar *__msg; \ + __msg = g_strdup_printf ("assertion failed (" #expr " >= 0): errno %i: %s", __errsv, g_strerror (__errsv)); \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \ + g_free (__msg); \ + } \ + } G_STMT_END \ + GLIB_AVAILABLE_MACRO_IN_2_66 +#define g_assert_no_error(err) G_STMT_START { \ + if (err) \ + g_assertion_message_error (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #err, err, 0, 0); \ + } G_STMT_END +#define g_assert_error(err, dom, c) G_STMT_START { \ + if (!err || (err)->domain != dom || (err)->code != c) \ + g_assertion_message_error (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #err, err, dom, c); \ + } G_STMT_END +#define g_assert_true(expr) G_STMT_START { \ + if G_LIKELY (expr) ; else \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "'" #expr "' should be TRUE"); \ + } G_STMT_END +#define g_assert_false(expr) G_STMT_START { \ + if G_LIKELY (!(expr)) ; else \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "'" #expr "' should be FALSE"); \ + } G_STMT_END + +/* Use nullptr in C++ to catch misuse of these macros. */ +#if defined(__cplusplus) && __cplusplus >= 201100L +#define g_assert_null(expr) G_STMT_START { if G_LIKELY ((expr) == nullptr) ; else \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "'" #expr "' should be nullptr"); \ + } G_STMT_END +#define g_assert_nonnull(expr) G_STMT_START { \ + if G_LIKELY ((expr) != nullptr) ; else \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "'" #expr "' should not be nullptr"); \ + } G_STMT_END +#else /* not C++ */ +#define g_assert_null(expr) G_STMT_START { if G_LIKELY ((expr) == NULL) ; else \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "'" #expr "' should be NULL"); \ + } G_STMT_END +#define g_assert_nonnull(expr) G_STMT_START { \ + if G_LIKELY ((expr) != NULL) ; else \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "'" #expr "' should not be NULL"); \ + } G_STMT_END +#endif + +#ifdef G_DISABLE_ASSERT +/* https://gcc.gnu.org/onlinedocs/gcc-8.3.0/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005funreachable + * GCC 5 is not a strict lower bound for versions of GCC which provide __builtin_unreachable(). */ +#if __GNUC__ >= 5 || g_macro__has_builtin(__builtin_unreachable) +#define g_assert_not_reached() G_STMT_START { (void) 0; __builtin_unreachable (); } G_STMT_END +#elif defined (_MSC_VER) +#define g_assert_not_reached() G_STMT_START { (void) 0; __assume (0); } G_STMT_END +#else /* if __builtin_unreachable() is not supported: */ +#define g_assert_not_reached() G_STMT_START { (void) 0; } G_STMT_END +#endif + +#define g_assert(expr) G_STMT_START { (void) 0; } G_STMT_END +#else /* !G_DISABLE_ASSERT */ +#define g_assert_not_reached() G_STMT_START { g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); } G_STMT_END +#define g_assert(expr) G_STMT_START { \ + if G_LIKELY (expr) ; else \ + g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #expr); \ + } G_STMT_END +#endif /* !G_DISABLE_ASSERT */ + +typedef void (*GAssertionFunc) (const char *domain, + const char *file, + int line, + const char *func, + const char *message, + gpointer user_data); + +GLIB_AVAILABLE_IN_2_68 +void g_assertion_set_handler (GAssertionFunc handler, + gpointer user_data); + +GLIB_AVAILABLE_IN_ALL +int g_strcmp0 (const char *str1, + const char *str2); + +/* report performance results */ +GLIB_AVAILABLE_IN_ALL +void g_test_minimized_result (double minimized_quantity, + const char *format, + ...) G_GNUC_PRINTF (2, 3); +GLIB_AVAILABLE_IN_ALL +void g_test_maximized_result (double maximized_quantity, + const char *format, + ...) G_GNUC_PRINTF (2, 3); + +/* initialize testing framework */ +GLIB_AVAILABLE_IN_ALL +void g_test_init (int *argc, + char ***argv, + ...) G_GNUC_NULL_TERMINATED; + +/** + * G_TEST_OPTION_ISOLATE_DIRS: + * + * Creates a unique temporary directory for each unit test and uses + * g_set_user_dirs() to set XDG directories to point into subdirectories of it + * for the duration of the unit test. The directory tree is cleaned up after the + * test finishes successfully. Note that this doesn’t take effect until + * g_test_run() is called, so calls to (for example) g_get_user_home_dir() will + * return the system-wide value when made in a test program’s main() function. + * + * The following functions will return subdirectories of the temporary directory + * when this option is used. The specific subdirectory paths in use are not + * guaranteed to be stable API — always use a getter function to retrieve them. + * + * - g_get_home_dir() + * - g_get_user_cache_dir() + * - g_get_system_config_dirs() + * - g_get_user_config_dir() + * - g_get_system_data_dirs() + * - g_get_user_data_dir() + * - g_get_user_runtime_dir() + * + * The subdirectories may not be created by the test harness; as with normal + * calls to functions like g_get_user_cache_dir(), the caller must be prepared + * to create the directory if it doesn’t exist. + * + * Since: 2.60 + */ +#define G_TEST_OPTION_ISOLATE_DIRS "isolate_dirs" + +/* While we discourage its use, g_assert() is often used in unit tests + * (especially in legacy code). g_assert_*() should really be used instead. + * g_assert() can be disabled at client program compile time, which can render + * tests useless. Highlight that to the user. */ +#ifdef G_DISABLE_ASSERT +#if defined(G_HAVE_ISO_VARARGS) +#undef g_test_init +#define g_test_init(argc, argv, ...) \ + G_STMT_START { \ + g_printerr ("Tests were compiled with G_DISABLE_ASSERT and are likely no-ops. Aborting.\n"); \ + exit (1); \ + } G_STMT_END +#elif defined(G_HAVE_GNUC_VARARGS) +#undef g_test_init +#define g_test_init(argc, argv...) \ + G_STMT_START { \ + g_printerr ("Tests were compiled with G_DISABLE_ASSERT and are likely no-ops. Aborting.\n"); \ + exit (1); \ + } G_STMT_END +#else /* no varargs */ + /* do nothing */ +#endif /* varargs support */ +#endif /* G_DISABLE_ASSERT */ + +/* query testing framework config */ +#define g_test_initialized() (g_test_config_vars->test_initialized) +#define g_test_quick() (g_test_config_vars->test_quick) +#define g_test_slow() (!g_test_config_vars->test_quick) +#define g_test_thorough() (!g_test_config_vars->test_quick) +#define g_test_perf() (g_test_config_vars->test_perf) +#define g_test_verbose() (g_test_config_vars->test_verbose) +#define g_test_quiet() (g_test_config_vars->test_quiet) +#define g_test_undefined() (g_test_config_vars->test_undefined) +GLIB_AVAILABLE_IN_2_38 +gboolean g_test_subprocess (void); + +/* run all tests under toplevel suite (path: /) */ +GLIB_AVAILABLE_IN_ALL +int g_test_run (void); +/* hook up a test functions under test path */ +GLIB_AVAILABLE_IN_ALL +void g_test_add_func (const char *testpath, + GTestFunc test_func); + +GLIB_AVAILABLE_IN_ALL +void g_test_add_data_func (const char *testpath, + gconstpointer test_data, + GTestDataFunc test_func); + +GLIB_AVAILABLE_IN_2_34 +void g_test_add_data_func_full (const char *testpath, + gpointer test_data, + GTestDataFunc test_func, + GDestroyNotify data_free_func); + +/* tell about failure */ +GLIB_AVAILABLE_IN_2_30 +void g_test_fail (void); +GLIB_AVAILABLE_IN_2_38 +void g_test_incomplete (const gchar *msg); +GLIB_AVAILABLE_IN_2_38 +void g_test_skip (const gchar *msg); +GLIB_AVAILABLE_IN_2_38 +gboolean g_test_failed (void); +GLIB_AVAILABLE_IN_2_38 +void g_test_set_nonfatal_assertions (void); + +/** + * g_test_add: + * @testpath: The test path for a new test case. + * @Fixture: The type of a fixture data structure. + * @tdata: Data argument for the test functions. + * @fsetup: The function to set up the fixture data. + * @ftest: The actual test function. + * @fteardown: The function to tear down the fixture data. + * + * Hook up a new test case at @testpath, similar to g_test_add_func(). + * A fixture data structure with setup and teardown functions may be provided, + * similar to g_test_create_case(). + * + * g_test_add() is implemented as a macro, so that the fsetup(), ftest() and + * fteardown() callbacks can expect a @Fixture pointer as their first argument + * in a type safe manner. They otherwise have type #GTestFixtureFunc. + * + * Since: 2.16 + */ +#define g_test_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \ + G_STMT_START { \ + void (*add_vtable) (const char*, \ + gsize, \ + gconstpointer, \ + void (*) (Fixture*, gconstpointer), \ + void (*) (Fixture*, gconstpointer), \ + void (*) (Fixture*, gconstpointer)) = (void (*) (const gchar *, gsize, gconstpointer, void (*) (Fixture*, gconstpointer), void (*) (Fixture*, gconstpointer), void (*) (Fixture*, gconstpointer))) g_test_add_vtable; \ + add_vtable \ + (testpath, sizeof (Fixture), tdata, fsetup, ftest, fteardown); \ + } G_STMT_END + +/* add test messages to the test report */ +GLIB_AVAILABLE_IN_ALL +void g_test_message (const char *format, + ...) G_GNUC_PRINTF (1, 2); +GLIB_AVAILABLE_IN_ALL +void g_test_bug_base (const char *uri_pattern); +GLIB_AVAILABLE_IN_ALL +void g_test_bug (const char *bug_uri_snippet); +GLIB_AVAILABLE_IN_2_62 +void g_test_summary (const char *summary); +/* measure test timings */ +GLIB_AVAILABLE_IN_ALL +void g_test_timer_start (void); +GLIB_AVAILABLE_IN_ALL +double g_test_timer_elapsed (void); /* elapsed seconds */ +GLIB_AVAILABLE_IN_ALL +double g_test_timer_last (void); /* repeat last elapsed() result */ + +/* automatically g_free or g_object_unref upon teardown */ +GLIB_AVAILABLE_IN_ALL +void g_test_queue_free (gpointer gfree_pointer); +GLIB_AVAILABLE_IN_ALL +void g_test_queue_destroy (GDestroyNotify destroy_func, + gpointer destroy_data); +#define g_test_queue_unref(gobject) g_test_queue_destroy (g_object_unref, gobject) + +/** + * GTestTrapFlags: + * @G_TEST_TRAP_SILENCE_STDOUT: Redirect stdout of the test child to + * `/dev/null` so it cannot be observed on the console during test + * runs. The actual output is still captured though to allow later + * tests with g_test_trap_assert_stdout(). + * @G_TEST_TRAP_SILENCE_STDERR: Redirect stderr of the test child to + * `/dev/null` so it cannot be observed on the console during test + * runs. The actual output is still captured though to allow later + * tests with g_test_trap_assert_stderr(). + * @G_TEST_TRAP_INHERIT_STDIN: If this flag is given, stdin of the + * child process is shared with stdin of its parent process. + * It is redirected to `/dev/null` otherwise. + * + * Test traps are guards around forked tests. + * These flags determine what traps to set. + * + * Deprecated: 2.38: #GTestTrapFlags is used only with g_test_trap_fork(), + * which is deprecated. g_test_trap_subprocess() uses + * #GTestSubprocessFlags. + */ +typedef enum { + G_TEST_TRAP_SILENCE_STDOUT = 1 << 7, + G_TEST_TRAP_SILENCE_STDERR = 1 << 8, + G_TEST_TRAP_INHERIT_STDIN = 1 << 9 +} GTestTrapFlags GLIB_DEPRECATED_TYPE_IN_2_38_FOR(GTestSubprocessFlags); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +GLIB_DEPRECATED_IN_2_38_FOR (g_test_trap_subprocess) +gboolean g_test_trap_fork (guint64 usec_timeout, + GTestTrapFlags test_trap_flags); + +G_GNUC_END_IGNORE_DEPRECATIONS + +typedef enum { + G_TEST_SUBPROCESS_INHERIT_STDIN = 1 << 0, + G_TEST_SUBPROCESS_INHERIT_STDOUT = 1 << 1, + G_TEST_SUBPROCESS_INHERIT_STDERR = 1 << 2 +} GTestSubprocessFlags; + +GLIB_AVAILABLE_IN_2_38 +void g_test_trap_subprocess (const char *test_path, + guint64 usec_timeout, + GTestSubprocessFlags test_flags); + +GLIB_AVAILABLE_IN_ALL +gboolean g_test_trap_has_passed (void); +GLIB_AVAILABLE_IN_ALL +gboolean g_test_trap_reached_timeout (void); +#define g_test_trap_assert_passed() g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 0, 0) +#define g_test_trap_assert_failed() g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 1, 0) +#define g_test_trap_assert_stdout(soutpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 2, soutpattern) +#define g_test_trap_assert_stdout_unmatched(soutpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 3, soutpattern) +#define g_test_trap_assert_stderr(serrpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 4, serrpattern) +#define g_test_trap_assert_stderr_unmatched(serrpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 5, serrpattern) + +/* provide seed-able random numbers for tests */ +#define g_test_rand_bit() (0 != (g_test_rand_int() & (1 << 15))) +GLIB_AVAILABLE_IN_ALL +gint32 g_test_rand_int (void); +GLIB_AVAILABLE_IN_ALL +gint32 g_test_rand_int_range (gint32 begin, + gint32 end); +GLIB_AVAILABLE_IN_ALL +double g_test_rand_double (void); +GLIB_AVAILABLE_IN_ALL +double g_test_rand_double_range (double range_start, + double range_end); + +/* + * semi-internal API: non-documented symbols with stable ABI. You + * should use the non-internal helper macros instead. However, for + * compatibility reason, you may use this semi-internal API. + */ +GLIB_AVAILABLE_IN_ALL +GTestCase* g_test_create_case (const char *test_name, + gsize data_size, + gconstpointer test_data, + GTestFixtureFunc data_setup, + GTestFixtureFunc data_test, + GTestFixtureFunc data_teardown); +GLIB_AVAILABLE_IN_ALL +GTestSuite* g_test_create_suite (const char *suite_name); +GLIB_AVAILABLE_IN_ALL +GTestSuite* g_test_get_root (void); +GLIB_AVAILABLE_IN_ALL +void g_test_suite_add (GTestSuite *suite, + GTestCase *test_case); +GLIB_AVAILABLE_IN_ALL +void g_test_suite_add_suite (GTestSuite *suite, + GTestSuite *nestedsuite); +GLIB_AVAILABLE_IN_ALL +int g_test_run_suite (GTestSuite *suite); + +GLIB_AVAILABLE_IN_ALL +void g_test_trap_assertions (const char *domain, + const char *file, + int line, + const char *func, + guint64 assertion_flags, /* 0-pass, 1-fail, 2-outpattern, 4-errpattern */ + const char *pattern); +GLIB_AVAILABLE_IN_ALL +void g_assertion_message (const char *domain, + const char *file, + int line, + const char *func, + const char *message) G_ANALYZER_NORETURN; +GLIB_AVAILABLE_IN_ALL +G_NORETURN +void g_assertion_message_expr (const char *domain, + const char *file, + int line, + const char *func, + const char *expr); +GLIB_AVAILABLE_IN_ALL +void g_assertion_message_cmpstr (const char *domain, + const char *file, + int line, + const char *func, + const char *expr, + const char *arg1, + const char *cmp, + const char *arg2) G_ANALYZER_NORETURN; + +GLIB_AVAILABLE_IN_2_68 +void g_assertion_message_cmpstrv (const char *domain, + const char *file, + int line, + const char *func, + const char *expr, + const char * const *arg1, + const char * const *arg2, + gsize first_wrong_idx) G_ANALYZER_NORETURN; +GLIB_AVAILABLE_IN_ALL +void g_assertion_message_cmpnum (const char *domain, + const char *file, + int line, + const char *func, + const char *expr, + long double arg1, + const char *cmp, + long double arg2, + char numtype) G_ANALYZER_NORETURN; +GLIB_AVAILABLE_IN_ALL +void g_assertion_message_error (const char *domain, + const char *file, + int line, + const char *func, + const char *expr, + const GError *error, + GQuark error_domain, + int error_code) G_ANALYZER_NORETURN; +GLIB_AVAILABLE_IN_ALL +void g_test_add_vtable (const char *testpath, + gsize data_size, + gconstpointer test_data, + GTestFixtureFunc data_setup, + GTestFixtureFunc data_test, + GTestFixtureFunc data_teardown); +typedef struct { + gboolean test_initialized; + gboolean test_quick; /* disable thorough tests */ + gboolean test_perf; /* run performance tests */ + gboolean test_verbose; /* extra info */ + gboolean test_quiet; /* reduce output */ + gboolean test_undefined; /* run tests that are meant to assert */ +} GTestConfig; +GLIB_VAR const GTestConfig * const g_test_config_vars; + +/* internal logging API */ +typedef enum { + G_TEST_RUN_SUCCESS, + G_TEST_RUN_SKIPPED, + G_TEST_RUN_FAILURE, + G_TEST_RUN_INCOMPLETE +} GTestResult; + +typedef enum { + G_TEST_LOG_NONE, + G_TEST_LOG_ERROR, /* s:msg */ + G_TEST_LOG_START_BINARY, /* s:binaryname s:seed */ + G_TEST_LOG_LIST_CASE, /* s:testpath */ + G_TEST_LOG_SKIP_CASE, /* s:testpath */ + G_TEST_LOG_START_CASE, /* s:testpath */ + G_TEST_LOG_STOP_CASE, /* d:status d:nforks d:elapsed */ + G_TEST_LOG_MIN_RESULT, /* s:blurb d:result */ + G_TEST_LOG_MAX_RESULT, /* s:blurb d:result */ + G_TEST_LOG_MESSAGE, /* s:blurb */ + G_TEST_LOG_START_SUITE, + G_TEST_LOG_STOP_SUITE +} GTestLogType; + +typedef struct { + GTestLogType log_type; + guint n_strings; + gchar **strings; /* NULL terminated */ + guint n_nums; + long double *nums; +} GTestLogMsg; +typedef struct { + /*< private >*/ + GString *data; + GSList *msgs; +} GTestLogBuffer; + +GLIB_AVAILABLE_IN_ALL +const char* g_test_log_type_name (GTestLogType log_type); +GLIB_AVAILABLE_IN_ALL +GTestLogBuffer* g_test_log_buffer_new (void); +GLIB_AVAILABLE_IN_ALL +void g_test_log_buffer_free (GTestLogBuffer *tbuffer); +GLIB_AVAILABLE_IN_ALL +void g_test_log_buffer_push (GTestLogBuffer *tbuffer, + guint n_bytes, + const guint8 *bytes); +GLIB_AVAILABLE_IN_ALL +GTestLogMsg* g_test_log_buffer_pop (GTestLogBuffer *tbuffer); +GLIB_AVAILABLE_IN_ALL +void g_test_log_msg_free (GTestLogMsg *tmsg); + +/** + * GTestLogFatalFunc: + * @log_domain: the log domain of the message + * @log_level: the log level of the message (including the fatal and recursion flags) + * @message: the message to process + * @user_data: user data, set in g_test_log_set_fatal_handler() + * + * Specifies the prototype of fatal log handler functions. + * + * Returns: %TRUE if the program should abort, %FALSE otherwise + * + * Since: 2.22 + */ +typedef gboolean (*GTestLogFatalFunc) (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer user_data); +GLIB_AVAILABLE_IN_ALL +void +g_test_log_set_fatal_handler (GTestLogFatalFunc log_func, + gpointer user_data); + +GLIB_AVAILABLE_IN_2_34 +void g_test_expect_message (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *pattern); +GLIB_AVAILABLE_IN_2_34 +void g_test_assert_expected_messages_internal (const char *domain, + const char *file, + int line, + const char *func); + +typedef enum +{ + G_TEST_DIST, + G_TEST_BUILT +} GTestFileType; + +GLIB_AVAILABLE_IN_2_38 +gchar * g_test_build_filename (GTestFileType file_type, + const gchar *first_path, + ...) G_GNUC_NULL_TERMINATED; +GLIB_AVAILABLE_IN_2_38 +const gchar *g_test_get_dir (GTestFileType file_type); +GLIB_AVAILABLE_IN_2_38 +const gchar *g_test_get_filename (GTestFileType file_type, + const gchar *first_path, + ...) G_GNUC_NULL_TERMINATED; + +#define g_test_assert_expected_messages() g_test_assert_expected_messages_internal (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC) + +G_END_DECLS + +#endif /* __G_TEST_UTILS_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_THREADPOOL_H__ +#define __G_THREADPOOL_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GThreadPool GThreadPool; + +/* Thread Pools + */ + +struct _GThreadPool +{ + GFunc func; + gpointer user_data; + gboolean exclusive; +}; + +GLIB_AVAILABLE_IN_ALL +GThreadPool * g_thread_pool_new (GFunc func, + gpointer user_data, + gint max_threads, + gboolean exclusive, + GError **error); +GLIB_AVAILABLE_IN_ALL +void g_thread_pool_free (GThreadPool *pool, + gboolean immediate, + gboolean wait_); +GLIB_AVAILABLE_IN_ALL +gboolean g_thread_pool_push (GThreadPool *pool, + gpointer data, + GError **error); +GLIB_AVAILABLE_IN_ALL +guint g_thread_pool_unprocessed (GThreadPool *pool); +GLIB_AVAILABLE_IN_ALL +void g_thread_pool_set_sort_function (GThreadPool *pool, + GCompareDataFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_2_46 +gboolean g_thread_pool_move_to_front (GThreadPool *pool, + gpointer data); + +GLIB_AVAILABLE_IN_ALL +gboolean g_thread_pool_set_max_threads (GThreadPool *pool, + gint max_threads, + GError **error); +GLIB_AVAILABLE_IN_ALL +gint g_thread_pool_get_max_threads (GThreadPool *pool); +GLIB_AVAILABLE_IN_ALL +guint g_thread_pool_get_num_threads (GThreadPool *pool); + +GLIB_AVAILABLE_IN_ALL +void g_thread_pool_set_max_unused_threads (gint max_threads); +GLIB_AVAILABLE_IN_ALL +gint g_thread_pool_get_max_unused_threads (void); +GLIB_AVAILABLE_IN_ALL +guint g_thread_pool_get_num_unused_threads (void); +GLIB_AVAILABLE_IN_ALL +void g_thread_pool_stop_unused_threads (void); +GLIB_AVAILABLE_IN_ALL +void g_thread_pool_set_max_idle_time (guint interval); +GLIB_AVAILABLE_IN_ALL +guint g_thread_pool_get_max_idle_time (void); + +G_END_DECLS + +#endif /* __G_THREADPOOL_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_TIMER_H__ +#define __G_TIMER_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/* Timer + */ + +/* microseconds per second */ +typedef struct _GTimer GTimer; + +#define G_USEC_PER_SEC 1000000 + +GLIB_AVAILABLE_IN_ALL +GTimer* g_timer_new (void); +GLIB_AVAILABLE_IN_ALL +void g_timer_destroy (GTimer *timer); +GLIB_AVAILABLE_IN_ALL +void g_timer_start (GTimer *timer); +GLIB_AVAILABLE_IN_ALL +void g_timer_stop (GTimer *timer); +GLIB_AVAILABLE_IN_ALL +void g_timer_reset (GTimer *timer); +GLIB_AVAILABLE_IN_ALL +void g_timer_continue (GTimer *timer); +GLIB_AVAILABLE_IN_ALL +gdouble g_timer_elapsed (GTimer *timer, + gulong *microseconds); +GLIB_AVAILABLE_IN_2_62 +gboolean g_timer_is_active (GTimer *timer); + +GLIB_AVAILABLE_IN_ALL +void g_usleep (gulong microseconds); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_DEPRECATED_IN_2_62 +void g_time_val_add (GTimeVal *time_, + glong microseconds); +GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_new_from_iso8601) +gboolean g_time_val_from_iso8601 (const gchar *iso_date, + GTimeVal *time_); +GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_format) +gchar* g_time_val_to_iso8601 (GTimeVal *time_) G_GNUC_MALLOC; +G_GNUC_END_IGNORE_DEPRECATIONS + +G_END_DECLS + +#endif /* __G_TIMER_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_TRASH_STACK_H__ +#define __G_TRASH_STACK_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +typedef struct _GTrashStack GTrashStack GLIB_DEPRECATED_TYPE_IN_2_48; +struct _GTrashStack +{ + GTrashStack *next; +} GLIB_DEPRECATED_TYPE_IN_2_48; + +GLIB_DEPRECATED_IN_2_48 +void g_trash_stack_push (GTrashStack **stack_p, + gpointer data_p); +GLIB_DEPRECATED_IN_2_48 +gpointer g_trash_stack_pop (GTrashStack **stack_p); +GLIB_DEPRECATED_IN_2_48 +gpointer g_trash_stack_peek (GTrashStack **stack_p); +GLIB_DEPRECATED_IN_2_48 +guint g_trash_stack_height (GTrashStack **stack_p); + +G_GNUC_END_IGNORE_DEPRECATIONS + +G_END_DECLS + +#endif /* __G_TRASH_STACK_H_ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_TREE_H__ +#define __G_TREE_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#undef G_TREE_DEBUG + +typedef struct _GTree GTree; + +/** + * GTreeNode: + * + * An opaque type which identifies a specific node in a #GTree. + * + * Since: 2.68 + */ +typedef struct _GTreeNode GTreeNode; + +typedef gboolean (*GTraverseFunc) (gpointer key, + gpointer value, + gpointer data); + +/** + * GTraverseNodeFunc: + * @node: a #GTreeNode + * @data: user data passed to g_tree_foreach_node() + * + * Specifies the type of function passed to g_tree_foreach_node(). It is + * passed each node, together with the @user_data parameter passed to + * g_tree_foreach_node(). If the function returns %TRUE, the traversal is + * stopped. + * + * Returns: %TRUE to stop the traversal + * Since: 2.68 + */ +typedef gboolean (*GTraverseNodeFunc) (GTreeNode *node, + gpointer data); + +/* Balanced binary trees + */ +GLIB_AVAILABLE_IN_ALL +GTree* g_tree_new (GCompareFunc key_compare_func); +GLIB_AVAILABLE_IN_ALL +GTree* g_tree_new_with_data (GCompareDataFunc key_compare_func, + gpointer key_compare_data); +GLIB_AVAILABLE_IN_ALL +GTree* g_tree_new_full (GCompareDataFunc key_compare_func, + gpointer key_compare_data, + GDestroyNotify key_destroy_func, + GDestroyNotify value_destroy_func); +GLIB_AVAILABLE_IN_2_68 +GTreeNode *g_tree_node_first (GTree *tree); +GLIB_AVAILABLE_IN_2_68 +GTreeNode *g_tree_node_last (GTree *tree); +GLIB_AVAILABLE_IN_2_68 +GTreeNode *g_tree_node_previous (GTreeNode *node); +GLIB_AVAILABLE_IN_2_68 +GTreeNode *g_tree_node_next (GTreeNode *node); +GLIB_AVAILABLE_IN_ALL +GTree* g_tree_ref (GTree *tree); +GLIB_AVAILABLE_IN_ALL +void g_tree_unref (GTree *tree); +GLIB_AVAILABLE_IN_ALL +void g_tree_destroy (GTree *tree); +GLIB_AVAILABLE_IN_2_68 +GTreeNode *g_tree_insert_node (GTree *tree, + gpointer key, + gpointer value); +GLIB_AVAILABLE_IN_ALL +void g_tree_insert (GTree *tree, + gpointer key, + gpointer value); +GLIB_AVAILABLE_IN_2_68 +GTreeNode *g_tree_replace_node (GTree *tree, + gpointer key, + gpointer value); +GLIB_AVAILABLE_IN_ALL +void g_tree_replace (GTree *tree, + gpointer key, + gpointer value); +GLIB_AVAILABLE_IN_ALL +gboolean g_tree_remove (GTree *tree, + gconstpointer key); +GLIB_AVAILABLE_IN_ALL +gboolean g_tree_steal (GTree *tree, + gconstpointer key); +GLIB_AVAILABLE_IN_2_68 +gpointer g_tree_node_key (GTreeNode *node); +GLIB_AVAILABLE_IN_2_68 +gpointer g_tree_node_value (GTreeNode *node); +GLIB_AVAILABLE_IN_2_68 +GTreeNode *g_tree_lookup_node (GTree *tree, + gconstpointer key); +GLIB_AVAILABLE_IN_ALL +gpointer g_tree_lookup (GTree *tree, + gconstpointer key); +GLIB_AVAILABLE_IN_ALL +gboolean g_tree_lookup_extended (GTree *tree, + gconstpointer lookup_key, + gpointer *orig_key, + gpointer *value); +GLIB_AVAILABLE_IN_ALL +void g_tree_foreach (GTree *tree, + GTraverseFunc func, + gpointer user_data); +GLIB_AVAILABLE_IN_2_68 +void g_tree_foreach_node (GTree *tree, + GTraverseNodeFunc func, + gpointer user_data); + +GLIB_DEPRECATED +void g_tree_traverse (GTree *tree, + GTraverseFunc traverse_func, + GTraverseType traverse_type, + gpointer user_data); + +GLIB_AVAILABLE_IN_2_68 +GTreeNode *g_tree_search_node (GTree *tree, + GCompareFunc search_func, + gconstpointer user_data); +GLIB_AVAILABLE_IN_ALL +gpointer g_tree_search (GTree *tree, + GCompareFunc search_func, + gconstpointer user_data); +GLIB_AVAILABLE_IN_2_68 +GTreeNode *g_tree_lower_bound (GTree *tree, + gconstpointer key); +GLIB_AVAILABLE_IN_2_68 +GTreeNode *g_tree_upper_bound (GTree *tree, + gconstpointer key); +GLIB_AVAILABLE_IN_ALL +gint g_tree_height (GTree *tree); +GLIB_AVAILABLE_IN_ALL +gint g_tree_nnodes (GTree *tree); + +#ifdef G_TREE_DEBUG +/*< private >*/ +#ifndef __GTK_DOC_IGNORE__ +void g_tree_dump (GTree *tree); +#endif /* !__GTK_DOC_IGNORE__ */ +#endif /* G_TREE_DEBUG */ + +G_END_DECLS + +#endif /* __G_TREE_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright © 2020 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see + * . + */ + +#pragma once + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +typedef struct _GUri GUri; + +GLIB_AVAILABLE_IN_2_66 +GUri * g_uri_ref (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +void g_uri_unref (GUri *uri); + +/** + * GUriFlags: + * @G_URI_FLAGS_NONE: No flags set. + * @G_URI_FLAGS_PARSE_RELAXED: Parse the URI more relaxedly than the + * [RFC 3986](https://tools.ietf.org/html/rfc3986) grammar specifies, + * fixing up or ignoring common mistakes in URIs coming from external + * sources. This is also needed for some obscure URI schemes where `;` + * separates the host from the path. Don’t use this flag unless you need to. + * @G_URI_FLAGS_HAS_PASSWORD: The userinfo field may contain a password, + * which will be separated from the username by `:`. + * @G_URI_FLAGS_HAS_AUTH_PARAMS: The userinfo may contain additional + * authentication-related parameters, which will be separated from + * the username and/or password by `;`. + * @G_URI_FLAGS_NON_DNS: The host component should not be assumed to be a + * DNS hostname or IP address (for example, for `smb` URIs with NetBIOS + * hostnames). + * @G_URI_FLAGS_ENCODED: When parsing a URI, this indicates that `%`-encoded + * characters in the userinfo, path, query, and fragment fields + * should not be decoded. (And likewise the host field if + * %G_URI_FLAGS_NON_DNS is also set.) When building a URI, it indicates + * that you have already `%`-encoded the components, and so #GUri + * should not do any encoding itself. + * @G_URI_FLAGS_ENCODED_QUERY: Same as %G_URI_FLAGS_ENCODED, for the query + * field only. + * @G_URI_FLAGS_ENCODED_PATH: Same as %G_URI_FLAGS_ENCODED, for the path only. + * @G_URI_FLAGS_ENCODED_FRAGMENT: Same as %G_URI_FLAGS_ENCODED, for the + * fragment only. + * @G_URI_FLAGS_SCHEME_NORMALIZE: A scheme-based normalization will be applied. + * For example, when parsing an HTTP URI changing omitted path to `/` and + * omitted port to `80`; and when building a URI, changing empty path to `/` + * and default port `80`). This only supports a subset of known schemes. (Since: 2.68) + * + * Flags that describe a URI. + * + * When parsing a URI, if you need to choose different flags based on + * the type of URI, you can use g_uri_peek_scheme() on the URI string + * to check the scheme first, and use that to decide what flags to + * parse it with. + * + * Since: 2.66 + */ +GLIB_AVAILABLE_TYPE_IN_2_66 +typedef enum { + G_URI_FLAGS_NONE = 0, + G_URI_FLAGS_PARSE_RELAXED = 1 << 0, + G_URI_FLAGS_HAS_PASSWORD = 1 << 1, + G_URI_FLAGS_HAS_AUTH_PARAMS = 1 << 2, + G_URI_FLAGS_ENCODED = 1 << 3, + G_URI_FLAGS_NON_DNS = 1 << 4, + G_URI_FLAGS_ENCODED_QUERY = 1 << 5, + G_URI_FLAGS_ENCODED_PATH = 1 << 6, + G_URI_FLAGS_ENCODED_FRAGMENT = 1 << 7, + G_URI_FLAGS_SCHEME_NORMALIZE = 1 << 8, +} GUriFlags; + +GLIB_AVAILABLE_IN_2_66 +gboolean g_uri_split (const gchar *uri_ref, + GUriFlags flags, + gchar **scheme, + gchar **userinfo, + gchar **host, + gint *port, + gchar **path, + gchar **query, + gchar **fragment, + GError **error); +GLIB_AVAILABLE_IN_2_66 +gboolean g_uri_split_with_user (const gchar *uri_ref, + GUriFlags flags, + gchar **scheme, + gchar **user, + gchar **password, + gchar **auth_params, + gchar **host, + gint *port, + gchar **path, + gchar **query, + gchar **fragment, + GError **error); +GLIB_AVAILABLE_IN_2_66 +gboolean g_uri_split_network (const gchar *uri_string, + GUriFlags flags, + gchar **scheme, + gchar **host, + gint *port, + GError **error); + +GLIB_AVAILABLE_IN_2_66 +gboolean g_uri_is_valid (const gchar *uri_string, + GUriFlags flags, + GError **error); + +GLIB_AVAILABLE_IN_2_66 +gchar * g_uri_join (GUriFlags flags, + const gchar *scheme, + const gchar *userinfo, + const gchar *host, + gint port, + const gchar *path, + const gchar *query, + const gchar *fragment); +GLIB_AVAILABLE_IN_2_66 +gchar * g_uri_join_with_user (GUriFlags flags, + const gchar *scheme, + const gchar *user, + const gchar *password, + const gchar *auth_params, + const gchar *host, + gint port, + const gchar *path, + const gchar *query, + const gchar *fragment); + +GLIB_AVAILABLE_IN_2_66 +GUri * g_uri_parse (const gchar *uri_string, + GUriFlags flags, + GError **error); +GLIB_AVAILABLE_IN_2_66 +GUri * g_uri_parse_relative (GUri *base_uri, + const gchar *uri_ref, + GUriFlags flags, + GError **error); + +GLIB_AVAILABLE_IN_2_66 +gchar * g_uri_resolve_relative (const gchar *base_uri_string, + const gchar *uri_ref, + GUriFlags flags, + GError **error); + +GLIB_AVAILABLE_IN_2_66 +GUri * g_uri_build (GUriFlags flags, + const gchar *scheme, + const gchar *userinfo, + const gchar *host, + gint port, + const gchar *path, + const gchar *query, + const gchar *fragment); +GLIB_AVAILABLE_IN_2_66 +GUri * g_uri_build_with_user (GUriFlags flags, + const gchar *scheme, + const gchar *user, + const gchar *password, + const gchar *auth_params, + const gchar *host, + gint port, + const gchar *path, + const gchar *query, + const gchar *fragment); + +/** + * GUriHideFlags: + * @G_URI_HIDE_NONE: No flags set. + * @G_URI_HIDE_USERINFO: Hide the userinfo. + * @G_URI_HIDE_PASSWORD: Hide the password. + * @G_URI_HIDE_AUTH_PARAMS: Hide the auth_params. + * @G_URI_HIDE_QUERY: Hide the query. + * @G_URI_HIDE_FRAGMENT: Hide the fragment. + * + * Flags describing what parts of the URI to hide in + * g_uri_to_string_partial(). Note that %G_URI_HIDE_PASSWORD and + * %G_URI_HIDE_AUTH_PARAMS will only work if the #GUri was parsed with + * the corresponding flags. + * + * Since: 2.66 + */ +GLIB_AVAILABLE_TYPE_IN_2_66 +typedef enum { + G_URI_HIDE_NONE = 0, + G_URI_HIDE_USERINFO = 1 << 0, + G_URI_HIDE_PASSWORD = 1 << 1, + G_URI_HIDE_AUTH_PARAMS = 1 << 2, + G_URI_HIDE_QUERY = 1 << 3, + G_URI_HIDE_FRAGMENT = 1 << 4, +} GUriHideFlags; + +GLIB_AVAILABLE_IN_2_66 +char * g_uri_to_string (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +char * g_uri_to_string_partial (GUri *uri, + GUriHideFlags flags); + +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_scheme (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_userinfo (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_user (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_password (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_auth_params (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_host (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +gint g_uri_get_port (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_path (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_query (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +const gchar *g_uri_get_fragment (GUri *uri); +GLIB_AVAILABLE_IN_2_66 +GUriFlags g_uri_get_flags (GUri *uri); + +/** + * GUriParamsFlags: + * @G_URI_PARAMS_NONE: No flags set. + * @G_URI_PARAMS_CASE_INSENSITIVE: Parameter names are case insensitive. + * @G_URI_PARAMS_WWW_FORM: Replace `+` with space character. Only useful for + * URLs on the web, using the `https` or `http` schemas. + * @G_URI_PARAMS_PARSE_RELAXED: See %G_URI_FLAGS_PARSE_RELAXED. + * + * Flags modifying the way parameters are handled by g_uri_parse_params() and + * #GUriParamsIter. + * + * Since: 2.66 + */ +GLIB_AVAILABLE_TYPE_IN_2_66 +typedef enum { + G_URI_PARAMS_NONE = 0, + G_URI_PARAMS_CASE_INSENSITIVE = 1 << 0, + G_URI_PARAMS_WWW_FORM = 1 << 1, + G_URI_PARAMS_PARSE_RELAXED = 1 << 2, +} GUriParamsFlags; + +GLIB_AVAILABLE_IN_2_66 +GHashTable *g_uri_parse_params (const gchar *params, + gssize length, + const gchar *separators, + GUriParamsFlags flags, + GError **error); + +typedef struct _GUriParamsIter GUriParamsIter; + +struct _GUriParamsIter +{ + /*< private >*/ + gint dummy0; + gpointer dummy1; + gpointer dummy2; + guint8 dummy3[256]; +}; + +GLIB_AVAILABLE_IN_2_66 +void g_uri_params_iter_init (GUriParamsIter *iter, + const gchar *params, + gssize length, + const gchar *separators, + GUriParamsFlags flags); + +GLIB_AVAILABLE_IN_2_66 +gboolean g_uri_params_iter_next (GUriParamsIter *iter, + gchar **attribute, + gchar **value, + GError **error); + +/** + * G_URI_ERROR: + * + * Error domain for URI methods. Errors in this domain will be from + * the #GUriError enumeration. See #GError for information on error + * domains. + * + * Since: 2.66 + */ +#define G_URI_ERROR (g_uri_error_quark ()) GLIB_AVAILABLE_MACRO_IN_2_66 +GLIB_AVAILABLE_IN_2_66 +GQuark g_uri_error_quark (void); + +/** + * GUriError: + * @G_URI_ERROR_FAILED: Generic error if no more specific error is available. + * See the error message for details. + * @G_URI_ERROR_BAD_SCHEME: The scheme of a URI could not be parsed. + * @G_URI_ERROR_BAD_USER: The user/userinfo of a URI could not be parsed. + * @G_URI_ERROR_BAD_PASSWORD: The password of a URI could not be parsed. + * @G_URI_ERROR_BAD_AUTH_PARAMS: The authentication parameters of a URI could not be parsed. + * @G_URI_ERROR_BAD_HOST: The host of a URI could not be parsed. + * @G_URI_ERROR_BAD_PORT: The port of a URI could not be parsed. + * @G_URI_ERROR_BAD_PATH: The path of a URI could not be parsed. + * @G_URI_ERROR_BAD_QUERY: The query of a URI could not be parsed. + * @G_URI_ERROR_BAD_FRAGMENT: The fragment of a URI could not be parsed. + * + * Error codes returned by #GUri methods. + * + * Since: 2.66 + */ +typedef enum { + G_URI_ERROR_FAILED, + G_URI_ERROR_BAD_SCHEME, + G_URI_ERROR_BAD_USER, + G_URI_ERROR_BAD_PASSWORD, + G_URI_ERROR_BAD_AUTH_PARAMS, + G_URI_ERROR_BAD_HOST, + G_URI_ERROR_BAD_PORT, + G_URI_ERROR_BAD_PATH, + G_URI_ERROR_BAD_QUERY, + G_URI_ERROR_BAD_FRAGMENT, +} GUriError; + +/** + * G_URI_RESERVED_CHARS_GENERIC_DELIMITERS: + * + * Generic delimiters characters as defined in + * [RFC 3986](https://tools.ietf.org/html/rfc3986). Includes `:/?#[]@`. + * + * Since: 2.16 + **/ +#define G_URI_RESERVED_CHARS_GENERIC_DELIMITERS ":/?#[]@" + +/** + * G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS: + * + * Subcomponent delimiter characters as defined in + * [RFC 3986](https://tools.ietf.org/html/rfc3986). Includes `!$&'()*+,;=`. + * + * Since: 2.16 + **/ +#define G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS "!$&'()*+,;=" + +/** + * G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT: + * + * Allowed characters in path elements. Includes `!$&'()*+,;=:@`. + * + * Since: 2.16 + **/ +#define G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS ":@" + +/** + * G_URI_RESERVED_CHARS_ALLOWED_IN_PATH: + * + * Allowed characters in a path. Includes `!$&'()*+,;=:@/`. + * + * Since: 2.16 + **/ +#define G_URI_RESERVED_CHARS_ALLOWED_IN_PATH G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT "/" + +/** + * G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO: + * + * Allowed characters in userinfo as defined in + * [RFC 3986](https://tools.ietf.org/html/rfc3986). Includes `!$&'()*+,;=:`. + * + * Since: 2.16 + **/ +#define G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS ":" + +GLIB_AVAILABLE_IN_ALL +char * g_uri_unescape_string (const char *escaped_string, + const char *illegal_characters); +GLIB_AVAILABLE_IN_ALL +char * g_uri_unescape_segment (const char *escaped_string, + const char *escaped_string_end, + const char *illegal_characters); + +GLIB_AVAILABLE_IN_ALL +char * g_uri_parse_scheme (const char *uri); +GLIB_AVAILABLE_IN_2_66 +const char *g_uri_peek_scheme (const char *uri); + +GLIB_AVAILABLE_IN_ALL +char * g_uri_escape_string (const char *unescaped, + const char *reserved_chars_allowed, + gboolean allow_utf8); + +GLIB_AVAILABLE_IN_2_66 +GBytes * g_uri_unescape_bytes (const char *escaped_string, + gssize length, + const char *illegal_characters, + GError **error); + +GLIB_AVAILABLE_IN_2_66 +char * g_uri_escape_bytes (const guint8 *unescaped, + gsize length, + const char *reserved_chars_allowed); + +G_GNUC_END_IGNORE_DEPRECATIONS + +G_END_DECLS +/* guuid.h - UUID functions + * + * Copyright (C) 2013-2015, 2017 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of the + * licence, or (at your option) any later version. + * + * This is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + * USA. + * + * Authors: Marc-André Lureau + */ + +#ifndef __G_UUID_H__ +#define __G_UUID_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_2_52 +gboolean g_uuid_string_is_valid (const gchar *str); + +GLIB_AVAILABLE_IN_2_52 +gchar * g_uuid_string_random (void); + +G_END_DECLS + +#endif /* __G_UUID_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_VERSION_H__ +#define __G_VERSION_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +GLIB_VAR const guint glib_major_version; +GLIB_VAR const guint glib_minor_version; +GLIB_VAR const guint glib_micro_version; +GLIB_VAR const guint glib_interface_age; +GLIB_VAR const guint glib_binary_age; + +GLIB_AVAILABLE_IN_ALL +const gchar * glib_check_version (guint required_major, + guint required_minor, + guint required_micro); + +#define GLIB_CHECK_VERSION(major,minor,micro) \ + (GLIB_MAJOR_VERSION > (major) || \ + (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION > (minor)) || \ + (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION == (minor) && \ + GLIB_MICRO_VERSION >= (micro))) + +G_END_DECLS + +#endif /* __G_VERSION_H__ */ + +#ifdef G_PLATFORM_WIN32 +#include +#endif + +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __G_ALLOCATOR_H__ +#define __G_ALLOCATOR_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GAllocator GAllocator; +typedef struct _GMemChunk GMemChunk; + +#define G_ALLOC_ONLY 1 +#define G_ALLOC_AND_FREE 2 +#define G_ALLOCATOR_LIST 1 +#define G_ALLOCATOR_SLIST 2 +#define G_ALLOCATOR_NODE 3 + +#define g_chunk_new(type, chunk) ((type *) g_mem_chunk_alloc (chunk)) +#define g_chunk_new0(type, chunk) ((type *) g_mem_chunk_alloc0 (chunk)) +#define g_chunk_free(mem, mem_chunk) (g_mem_chunk_free (mem_chunk, mem)) +#define g_mem_chunk_create(type, x, y) (g_mem_chunk_new (NULL, sizeof (type), 0, 0)) + + +GLIB_DEPRECATED +GMemChunk * g_mem_chunk_new (const gchar *name, + gint atom_size, + gsize area_size, + gint type); +GLIB_DEPRECATED +void g_mem_chunk_destroy (GMemChunk *mem_chunk); +GLIB_DEPRECATED +gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk); +GLIB_DEPRECATED +gpointer g_mem_chunk_alloc0 (GMemChunk *mem_chunk); +GLIB_DEPRECATED +void g_mem_chunk_free (GMemChunk *mem_chunk, + gpointer mem); +GLIB_DEPRECATED +void g_mem_chunk_clean (GMemChunk *mem_chunk); +GLIB_DEPRECATED +void g_mem_chunk_reset (GMemChunk *mem_chunk); +GLIB_DEPRECATED +void g_mem_chunk_print (GMemChunk *mem_chunk); +GLIB_DEPRECATED +void g_mem_chunk_info (void); +GLIB_DEPRECATED +void g_blow_chunks (void); + + +GLIB_DEPRECATED +GAllocator * g_allocator_new (const gchar *name, + guint n_preallocs); +GLIB_DEPRECATED +void g_allocator_free (GAllocator *allocator); +GLIB_DEPRECATED +void g_list_push_allocator (GAllocator *allocator); +GLIB_DEPRECATED +void g_list_pop_allocator (void); +GLIB_DEPRECATED +void g_slist_push_allocator (GAllocator *allocator); +GLIB_DEPRECATED +void g_slist_pop_allocator (void); +GLIB_DEPRECATED +void g_node_push_allocator (GAllocator *allocator); +GLIB_DEPRECATED +void g_node_pop_allocator (void); + +G_END_DECLS + +#endif /* __G_ALLOCATOR_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_CACHE_H__ +#define __G_CACHE_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GCache GCache GLIB_DEPRECATED_TYPE_IN_2_26_FOR(GHashTable); + +typedef gpointer (*GCacheNewFunc) (gpointer key) GLIB_DEPRECATED_TYPE_IN_2_26; +typedef gpointer (*GCacheDupFunc) (gpointer value) GLIB_DEPRECATED_TYPE_IN_2_26; +typedef void (*GCacheDestroyFunc) (gpointer value) GLIB_DEPRECATED_TYPE_IN_2_26; + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +/* Caches + */ +GLIB_DEPRECATED +GCache* g_cache_new (GCacheNewFunc value_new_func, + GCacheDestroyFunc value_destroy_func, + GCacheDupFunc key_dup_func, + GCacheDestroyFunc key_destroy_func, + GHashFunc hash_key_func, + GHashFunc hash_value_func, + GEqualFunc key_equal_func); +GLIB_DEPRECATED +void g_cache_destroy (GCache *cache); +GLIB_DEPRECATED +gpointer g_cache_insert (GCache *cache, + gpointer key); +GLIB_DEPRECATED +void g_cache_remove (GCache *cache, + gconstpointer value); +GLIB_DEPRECATED +void g_cache_key_foreach (GCache *cache, + GHFunc func, + gpointer user_data); +GLIB_DEPRECATED +void g_cache_value_foreach (GCache *cache, + GHFunc func, + gpointer user_data); + +G_GNUC_END_IGNORE_DEPRECATIONS + +G_END_DECLS + +#endif /* __G_CACHE_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_COMPLETION_H__ +#define __G_COMPLETION_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GCompletion GCompletion; + +typedef gchar* (*GCompletionFunc) (gpointer); + +/* GCompletion + */ + +typedef gint (*GCompletionStrncmpFunc) (const gchar *s1, + const gchar *s2, + gsize n); + +struct _GCompletion +{ + GList* items; + GCompletionFunc func; + + gchar* prefix; + GList* cache; + GCompletionStrncmpFunc strncmp_func; +}; + +GLIB_DEPRECATED_IN_2_26 +GCompletion* g_completion_new (GCompletionFunc func); +GLIB_DEPRECATED_IN_2_26 +void g_completion_add_items (GCompletion* cmp, + GList* items); +GLIB_DEPRECATED_IN_2_26 +void g_completion_remove_items (GCompletion* cmp, + GList* items); +GLIB_DEPRECATED_IN_2_26 +void g_completion_clear_items (GCompletion* cmp); +GLIB_DEPRECATED_IN_2_26 +GList* g_completion_complete (GCompletion* cmp, + const gchar* prefix, + gchar** new_prefix); +GLIB_DEPRECATED_IN_2_26 +GList* g_completion_complete_utf8 (GCompletion *cmp, + const gchar* prefix, + gchar** new_prefix); +GLIB_DEPRECATED_IN_2_26 +void g_completion_set_compare (GCompletion *cmp, + GCompletionStrncmpFunc strncmp_func); +GLIB_DEPRECATED_IN_2_26 +void g_completion_free (GCompletion* cmp); + +G_END_DECLS + +#endif /* __G_COMPLETION_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_DEPRECATED_MAIN_H__ +#define __G_DEPRECATED_MAIN_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/* ============== Compat main loop stuff ================== */ + +/** + * g_main_new: + * @is_running: set to %TRUE to indicate that the loop is running. This + * is not very important since calling g_main_run() will set this + * to %TRUE anyway. + * + * Creates a new #GMainLoop for th default main context. + * + * Returns: a new #GMainLoop + * + * Deprecated: 2.2: Use g_main_loop_new() instead + */ +#define g_main_new(is_running) g_main_loop_new (NULL, is_running) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_new) + +/** + * g_main_run: + * @loop: a #GMainLoop + * + * Runs a main loop until it stops running. + * + * Deprecated: 2.2: Use g_main_loop_run() instead + */ +#define g_main_run(loop) g_main_loop_run(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_run) + +/** + * g_main_quit: + * @loop: a #GMainLoop + * + * Stops the #GMainLoop. + * If g_main_run() was called to run the #GMainLoop, it will now return. + * + * Deprecated: 2.2: Use g_main_loop_quit() instead + */ +#define g_main_quit(loop) g_main_loop_quit(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_quit) + +/** + * g_main_destroy: + * @loop: a #GMainLoop + * + * Frees the memory allocated for the #GMainLoop. + * + * Deprecated: 2.2: Use g_main_loop_unref() instead + */ +#define g_main_destroy(loop) g_main_loop_unref(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_unref) + +/** + * g_main_is_running: + * @loop: a #GMainLoop + * + * Checks if the main loop is running. + * + * Returns: %TRUE if the main loop is running + * + * Deprecated: 2.2: Use g_main_loop_is_running() instead + */ +#define g_main_is_running(loop) g_main_loop_is_running(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_is_running) + +/** + * g_main_iteration: + * @may_block: set to %TRUE if it should block (i.e. wait) until an event + * source becomes ready. It will return after an event source has been + * processed. If set to %FALSE it will return immediately if no event + * source is ready to be processed. + * + * Runs a single iteration for the default #GMainContext. + * + * Returns: %TRUE if more events are pending. + * + * Deprecated: 2.2: Use g_main_context_iteration() instead. + */ +#define g_main_iteration(may_block) g_main_context_iteration (NULL, may_block) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_context_iteration) + +/** + * g_main_pending: + * + * Checks if any events are pending for the default #GMainContext + * (i.e. ready to be processed). + * + * Returns: %TRUE if any events are pending. + * + * Deprecated: 2.2: Use g_main_context_pending() instead. + */ +#define g_main_pending() g_main_context_pending (NULL) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_context_pending) + +/** + * g_main_set_poll_func: + * @func: the function to call to poll all file descriptors + * + * Sets the function to use for the handle polling of file descriptors + * for the default main context. + * + * Deprecated: 2.2: Use g_main_context_set_poll_func() again + */ +#define g_main_set_poll_func(func) g_main_context_set_poll_func (NULL, func) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_context_set_poll_func) + +G_END_DECLS + +#endif /* __G_DEPRECATED_MAIN_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_REL_H__ +#define __G_REL_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GRelation GRelation; +typedef struct _GTuples GTuples; + +struct _GTuples +{ + guint len; +}; + +/* GRelation + * + * Indexed Relations. Imagine a really simple table in a + * database. Relations are not ordered. This data type is meant for + * maintaining a N-way mapping. + * + * g_relation_new() creates a relation with FIELDS fields + * + * g_relation_destroy() frees all resources + * g_tuples_destroy() frees the result of g_relation_select() + * + * g_relation_index() indexes relation FIELD with the provided + * equality and hash functions. this must be done before any + * calls to insert are made. + * + * g_relation_insert() inserts a new tuple. you are expected to + * provide the right number of fields. + * + * g_relation_delete() deletes all relations with KEY in FIELD + * g_relation_select() returns ... + * g_relation_count() counts ... + */ + +GLIB_DEPRECATED_IN_2_26 +GRelation* g_relation_new (gint fields); +GLIB_DEPRECATED_IN_2_26 +void g_relation_destroy (GRelation *relation); +GLIB_DEPRECATED_IN_2_26 +void g_relation_index (GRelation *relation, + gint field, + GHashFunc hash_func, + GEqualFunc key_equal_func); +GLIB_DEPRECATED_IN_2_26 +void g_relation_insert (GRelation *relation, + ...); +GLIB_DEPRECATED_IN_2_26 +gint g_relation_delete (GRelation *relation, + gconstpointer key, + gint field); +GLIB_DEPRECATED_IN_2_26 +GTuples* g_relation_select (GRelation *relation, + gconstpointer key, + gint field); +GLIB_DEPRECATED_IN_2_26 +gint g_relation_count (GRelation *relation, + gconstpointer key, + gint field); +GLIB_DEPRECATED_IN_2_26 +gboolean g_relation_exists (GRelation *relation, + ...); +GLIB_DEPRECATED_IN_2_26 +void g_relation_print (GRelation *relation); +GLIB_DEPRECATED_IN_2_26 +void g_tuples_destroy (GTuples *tuples); +GLIB_DEPRECATED_IN_2_26 +gpointer g_tuples_index (GTuples *tuples, + gint index_, + gint field); + +G_END_DECLS + +#endif /* __G_REL_H__ */ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_DEPRECATED_THREAD_H__ +#define __G_DEPRECATED_THREAD_H__ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +typedef enum +{ + G_THREAD_PRIORITY_LOW, + G_THREAD_PRIORITY_NORMAL, + G_THREAD_PRIORITY_HIGH, + G_THREAD_PRIORITY_URGENT +} GThreadPriority GLIB_DEPRECATED_TYPE_IN_2_32; + +struct _GThread +{ + /*< private >*/ + GThreadFunc func; + gpointer data; + gboolean joinable; + GThreadPriority priority; +}; + +typedef struct _GThreadFunctions GThreadFunctions GLIB_DEPRECATED_TYPE_IN_2_32; +struct _GThreadFunctions +{ + GMutex* (*mutex_new) (void); + void (*mutex_lock) (GMutex *mutex); + gboolean (*mutex_trylock) (GMutex *mutex); + void (*mutex_unlock) (GMutex *mutex); + void (*mutex_free) (GMutex *mutex); + GCond* (*cond_new) (void); + void (*cond_signal) (GCond *cond); + void (*cond_broadcast) (GCond *cond); + void (*cond_wait) (GCond *cond, + GMutex *mutex); + gboolean (*cond_timed_wait) (GCond *cond, + GMutex *mutex, + GTimeVal *end_time); + void (*cond_free) (GCond *cond); + GPrivate* (*private_new) (GDestroyNotify destructor); + gpointer (*private_get) (GPrivate *private_key); + void (*private_set) (GPrivate *private_key, + gpointer data); + void (*thread_create) (GThreadFunc func, + gpointer data, + gulong stack_size, + gboolean joinable, + gboolean bound, + GThreadPriority priority, + gpointer thread, + GError **error); + void (*thread_yield) (void); + void (*thread_join) (gpointer thread); + void (*thread_exit) (void); + void (*thread_set_priority)(gpointer thread, + GThreadPriority priority); + void (*thread_self) (gpointer thread); + gboolean (*thread_equal) (gpointer thread1, + gpointer thread2); +} GLIB_DEPRECATED_TYPE_IN_2_32; + +GLIB_VAR GThreadFunctions g_thread_functions_for_glib_use; +GLIB_VAR gboolean g_thread_use_default_impl; + +GLIB_VAR guint64 (*g_thread_gettime) (void); + +GLIB_DEPRECATED_IN_2_32_FOR(g_thread_new) +GThread *g_thread_create (GThreadFunc func, + gpointer data, + gboolean joinable, + GError **error); + +GLIB_DEPRECATED_IN_2_32_FOR(g_thread_new) +GThread *g_thread_create_full (GThreadFunc func, + gpointer data, + gulong stack_size, + gboolean joinable, + gboolean bound, + GThreadPriority priority, + GError **error); + +GLIB_DEPRECATED_IN_2_32 +void g_thread_set_priority (GThread *thread, + GThreadPriority priority); + +GLIB_DEPRECATED_IN_2_32 +void g_thread_foreach (GFunc thread_func, + gpointer user_data); + +#ifndef G_OS_WIN32 +#include +#include +#endif + +#define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl GLIB_DEPRECATED_MACRO_IN_2_32 +#define G_STATIC_MUTEX_INIT { NULL } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_init) +typedef struct +{ + GMutex *mutex; +#ifndef G_OS_WIN32 + /* only for ABI compatibility reasons */ + pthread_mutex_t unused; +#endif +} GStaticMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GMutex); + +#define g_static_mutex_lock(mutex) \ + g_mutex_lock (g_static_mutex_get_mutex (mutex)) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_lock) +#define g_static_mutex_trylock(mutex) \ + g_mutex_trylock (g_static_mutex_get_mutex (mutex)) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_trylock) +#define g_static_mutex_unlock(mutex) \ + g_mutex_unlock (g_static_mutex_get_mutex (mutex)) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_unlock) + +GLIB_DEPRECATED_IN_2_32_FOR(g_mutex_init) +void g_static_mutex_init (GStaticMutex *mutex); +GLIB_DEPRECATED_IN_2_32_FOR(g_mutex_clear) +void g_static_mutex_free (GStaticMutex *mutex); +GLIB_DEPRECATED_IN_2_32_FOR(GMutex) +GMutex *g_static_mutex_get_mutex_impl (GStaticMutex *mutex); + +typedef struct _GStaticRecMutex GStaticRecMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRecMutex); +struct _GStaticRecMutex +{ + /*< private >*/ + GStaticMutex mutex; + guint depth; + + /* ABI compat only */ + union { +#ifdef G_OS_WIN32 + void *owner; +#else + pthread_t owner; +#endif + gdouble dummy; + } unused; +} GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRecMutex); + +#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT, 0, { 0 } } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_rec_mutex_init) +GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_init) +void g_static_rec_mutex_init (GStaticRecMutex *mutex); + +GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_lock) +void g_static_rec_mutex_lock (GStaticRecMutex *mutex); + +GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_try_lock) +gboolean g_static_rec_mutex_trylock (GStaticRecMutex *mutex); + +GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_unlock) +void g_static_rec_mutex_unlock (GStaticRecMutex *mutex); + +GLIB_DEPRECATED_IN_2_32 +void g_static_rec_mutex_lock_full (GStaticRecMutex *mutex, + guint depth); + +GLIB_DEPRECATED_IN_2_32 +guint g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex); + +GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_free) +void g_static_rec_mutex_free (GStaticRecMutex *mutex); + +typedef struct _GStaticRWLock GStaticRWLock GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRWLock); +struct _GStaticRWLock +{ + /*< private >*/ + GStaticMutex mutex; + GCond *read_cond; + GCond *write_cond; + guint read_counter; + gboolean have_writer; + guint want_to_read; + guint want_to_write; +} GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRWLock); + +#define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_rw_lock_init) + +GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_init) +void g_static_rw_lock_init (GStaticRWLock *lock); + +GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_lock) +void g_static_rw_lock_reader_lock (GStaticRWLock *lock); + +GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_trylock) +gboolean g_static_rw_lock_reader_trylock (GStaticRWLock *lock); + +GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_unlock) +void g_static_rw_lock_reader_unlock (GStaticRWLock *lock); + +GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_lock) +void g_static_rw_lock_writer_lock (GStaticRWLock *lock); + +GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_trylock) +gboolean g_static_rw_lock_writer_trylock (GStaticRWLock *lock); + +GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_unlock) +void g_static_rw_lock_writer_unlock (GStaticRWLock *lock); + +GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_free) +void g_static_rw_lock_free (GStaticRWLock *lock); + +GLIB_DEPRECATED_IN_2_32 +GPrivate * g_private_new (GDestroyNotify notify); + +typedef struct _GStaticPrivate GStaticPrivate GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate); +struct _GStaticPrivate +{ + /*< private >*/ + guint index; +} GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate); + +#define G_STATIC_PRIVATE_INIT { 0 } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(G_PRIVATE_INIT) +GLIB_DEPRECATED_IN_2_32 +void g_static_private_init (GStaticPrivate *private_key); + +GLIB_DEPRECATED_IN_2_32_FOR(g_private_get) +gpointer g_static_private_get (GStaticPrivate *private_key); + +GLIB_DEPRECATED_IN_2_32_FOR(g_private_set) +void g_static_private_set (GStaticPrivate *private_key, + gpointer data, + GDestroyNotify notify); + +GLIB_DEPRECATED_IN_2_32 +void g_static_private_free (GStaticPrivate *private_key); + +GLIB_DEPRECATED_IN_2_32 +gboolean g_once_init_enter_impl (volatile gsize *location); + +GLIB_DEPRECATED_IN_2_32 +void g_thread_init (gpointer vtable); +GLIB_DEPRECATED_IN_2_32 +void g_thread_init_with_errorcheck_mutexes (gpointer vtable); + +GLIB_DEPRECATED_IN_2_32 +gboolean g_thread_get_initialized (void); + +GLIB_VAR gboolean g_threads_got_initialized; + +#define g_thread_supported() (1) GLIB_DEPRECATED_MACRO_IN_2_32 + +GLIB_DEPRECATED_IN_2_32 +GMutex * g_mutex_new (void); +GLIB_DEPRECATED_IN_2_32 +void g_mutex_free (GMutex *mutex); +GLIB_DEPRECATED_IN_2_32 +GCond * g_cond_new (void); +GLIB_DEPRECATED_IN_2_32 +void g_cond_free (GCond *cond); +GLIB_DEPRECATED_IN_2_32 +gboolean g_cond_timed_wait (GCond *cond, + GMutex *mutex, + GTimeVal *timeval); + +G_GNUC_END_IGNORE_DEPRECATIONS + +G_END_DECLS + +#endif /* __G_DEPRECATED_THREAD_H__ */ + +/* + * Copyright © 2015 Canonical Limited + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + */ + +#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +static inline void +g_autoptr_cleanup_generic_gfree (void *p) +{ + void **pp = (void**)p; + g_free (*pp); +} + +static inline void +g_autoptr_cleanup_gstring_free (GString *string) +{ + if (string) + g_string_free (string, TRUE); +} + +/* Ignore deprecations in case we refer to a type which was added in a more + * recent GLib version than the user’s #GLIB_VERSION_MAX_ALLOWED definition. */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +/* If adding a cleanup here, please also add a test case to + * glib/tests/autoptr.c + */ +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncQueue, g_async_queue_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBookmarkFile, g_bookmark_file_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBytes, g_bytes_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GChecksum, g_checksum_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDateTime, g_date_time_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDate, g_date_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDir, g_dir_close) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHashTable, g_hash_table_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHmac, g_hmac_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIOChannel, g_io_channel_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GKeyFile, g_key_file_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GList, g_list_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GArray, g_array_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPtrArray, g_ptr_array_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GByteArray, g_byte_array_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContext, g_main_context_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContextPusher, g_main_context_pusher_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainLoop, g_main_loop_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSource, g_source_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMappedFile, g_mapped_file_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMarkupParseContext, g_markup_parse_context_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNode, g_node_destroy) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionContext, g_option_context_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionGroup, g_option_group_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPatternSpec, g_pattern_spec_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GQueue, g_queue_free) +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GQueue, g_queue_clear) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRand, g_rand_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRegex, g_regex_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMatchInfo, g_match_info_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GScanner, g_scanner_destroy) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSequence, g_sequence_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSList, g_slist_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GString, g_autoptr_cleanup_gstring_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStringChunk, g_string_chunk_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStrvBuilder, g_strv_builder_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GThread, g_thread_unref) +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GMutex, g_mutex_clear) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMutexLocker, g_mutex_locker_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRecMutexLocker, g_rec_mutex_locker_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRWLockWriterLocker, g_rw_lock_writer_locker_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRWLockReaderLocker, g_rw_lock_reader_locker_free) +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GCond, g_cond_clear) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimer, g_timer_destroy) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimeZone, g_time_zone_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTree, g_tree_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariant, g_variant_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantBuilder, g_variant_builder_unref) +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantBuilder, g_variant_builder_clear) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantIter, g_variant_iter_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref) +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free) +G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRefString, g_ref_string_release) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUri, g_uri_unref) + +G_GNUC_END_IGNORE_DEPRECATIONS + +#undef __GLIB_H_INSIDE__ + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_2_68 +void glib_init (void); + +GLIB_AVAILABLE_IN_2_68 +void glib_shutdown (void); + +GLIB_AVAILABLE_IN_2_68 +void glib_deinit (void); + +GLIB_AVAILABLE_IN_2_68 +void glib_prepare_to_fork (void); + +GLIB_AVAILABLE_IN_2_68 +void glib_recover_from_fork_in_parent (void); + +GLIB_AVAILABLE_IN_2_68 +void glib_recover_from_fork_in_child (void); + +G_END_DECLS + +#endif /* __G_LIB_H__ */ +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ +#ifndef __G_OBJECT_H__ +#define __G_OBJECT_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ +#ifndef __G_TYPE_H__ +#define __G_TYPE_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/* Basic Type Macros + */ +/** + * G_TYPE_FUNDAMENTAL: + * @type: A #GType value. + * + * The fundamental type which is the ancestor of @type. + * Fundamental types are types that serve as ultimate bases for the derived types, + * thus they are the roots of distinct inheritance hierarchies. + */ +#define G_TYPE_FUNDAMENTAL(type) (g_type_fundamental (type)) +/** + * G_TYPE_FUNDAMENTAL_MAX: + * + * An integer constant that represents the number of identifiers reserved + * for types that are assigned at compile-time. + */ +#define G_TYPE_FUNDAMENTAL_MAX (255 << G_TYPE_FUNDAMENTAL_SHIFT) + +/* Constant fundamental types, + */ +/** + * G_TYPE_INVALID: + * + * An invalid #GType used as error return value in some functions which return + * a #GType. + */ +#define G_TYPE_INVALID G_TYPE_MAKE_FUNDAMENTAL (0) +/** + * G_TYPE_NONE: + * + * A fundamental type which is used as a replacement for the C + * void return type. + */ +#define G_TYPE_NONE G_TYPE_MAKE_FUNDAMENTAL (1) +/** + * G_TYPE_INTERFACE: + * + * The fundamental type from which all interfaces are derived. + */ +#define G_TYPE_INTERFACE G_TYPE_MAKE_FUNDAMENTAL (2) +/** + * G_TYPE_CHAR: + * + * The fundamental type corresponding to #gchar. + * The type designated by G_TYPE_CHAR is unconditionally an 8-bit signed integer. + * This may or may not be the same type a the C type "gchar". + */ +#define G_TYPE_CHAR G_TYPE_MAKE_FUNDAMENTAL (3) +/** + * G_TYPE_UCHAR: + * + * The fundamental type corresponding to #guchar. + */ +#define G_TYPE_UCHAR G_TYPE_MAKE_FUNDAMENTAL (4) +/** + * G_TYPE_BOOLEAN: + * + * The fundamental type corresponding to #gboolean. + */ +#define G_TYPE_BOOLEAN G_TYPE_MAKE_FUNDAMENTAL (5) +/** + * G_TYPE_INT: + * + * The fundamental type corresponding to #gint. + */ +#define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6) +/** + * G_TYPE_UINT: + * + * The fundamental type corresponding to #guint. + */ +#define G_TYPE_UINT G_TYPE_MAKE_FUNDAMENTAL (7) +/** + * G_TYPE_LONG: + * + * The fundamental type corresponding to #glong. + */ +#define G_TYPE_LONG G_TYPE_MAKE_FUNDAMENTAL (8) +/** + * G_TYPE_ULONG: + * + * The fundamental type corresponding to #gulong. + */ +#define G_TYPE_ULONG G_TYPE_MAKE_FUNDAMENTAL (9) +/** + * G_TYPE_INT64: + * + * The fundamental type corresponding to #gint64. + */ +#define G_TYPE_INT64 G_TYPE_MAKE_FUNDAMENTAL (10) +/** + * G_TYPE_UINT64: + * + * The fundamental type corresponding to #guint64. + */ +#define G_TYPE_UINT64 G_TYPE_MAKE_FUNDAMENTAL (11) +/** + * G_TYPE_ENUM: + * + * The fundamental type from which all enumeration types are derived. + */ +#define G_TYPE_ENUM G_TYPE_MAKE_FUNDAMENTAL (12) +/** + * G_TYPE_FLAGS: + * + * The fundamental type from which all flags types are derived. + */ +#define G_TYPE_FLAGS G_TYPE_MAKE_FUNDAMENTAL (13) +/** + * G_TYPE_FLOAT: + * + * The fundamental type corresponding to #gfloat. + */ +#define G_TYPE_FLOAT G_TYPE_MAKE_FUNDAMENTAL (14) +/** + * G_TYPE_DOUBLE: + * + * The fundamental type corresponding to #gdouble. + */ +#define G_TYPE_DOUBLE G_TYPE_MAKE_FUNDAMENTAL (15) +/** + * G_TYPE_STRING: + * + * The fundamental type corresponding to nul-terminated C strings. + */ +#define G_TYPE_STRING G_TYPE_MAKE_FUNDAMENTAL (16) +/** + * G_TYPE_POINTER: + * + * The fundamental type corresponding to #gpointer. + */ +#define G_TYPE_POINTER G_TYPE_MAKE_FUNDAMENTAL (17) +/** + * G_TYPE_BOXED: + * + * The fundamental type from which all boxed types are derived. + */ +#define G_TYPE_BOXED G_TYPE_MAKE_FUNDAMENTAL (18) +/** + * G_TYPE_PARAM: + * + * The fundamental type from which all #GParamSpec types are derived. + */ +#define G_TYPE_PARAM G_TYPE_MAKE_FUNDAMENTAL (19) +/** + * G_TYPE_OBJECT: + * + * The fundamental type for #GObject. + */ +#define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20) +/** + * G_TYPE_VARIANT: + * + * The fundamental type corresponding to #GVariant. + * + * All floating #GVariant instances passed through the #GType system are + * consumed. + * + * Note that callbacks in closures, and signal handlers + * for signals of return type %G_TYPE_VARIANT, must never return floating + * variants. + * + * Note: GLib 2.24 did include a boxed type with this name. It was replaced + * with this fundamental type in 2.26. + * + * Since: 2.26 + */ +#define G_TYPE_VARIANT G_TYPE_MAKE_FUNDAMENTAL (21) + + +/* Reserved fundamental type numbers to create new fundamental + * type IDs with G_TYPE_MAKE_FUNDAMENTAL(). + * + * Open an issue on https://gitlab.gnome.org/GNOME/glib/issues/new for + * reservations. + */ +/** + * G_TYPE_FUNDAMENTAL_SHIFT: + * + * Shift value used in converting numbers to type IDs. + */ +#define G_TYPE_FUNDAMENTAL_SHIFT (2) +/** + * G_TYPE_MAKE_FUNDAMENTAL: + * @x: the fundamental type number. + * + * Get the type ID for the fundamental type number @x. + * Use g_type_fundamental_next() instead of this macro to create new fundamental + * types. + * + * Returns: the GType + */ +#define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT)) +/** + * G_TYPE_RESERVED_GLIB_FIRST: + * + * First fundamental type number to create a new fundamental type id with + * G_TYPE_MAKE_FUNDAMENTAL() reserved for GLib. + */ +#define G_TYPE_RESERVED_GLIB_FIRST (22) +/** + * G_TYPE_RESERVED_GLIB_LAST: + * + * Last fundamental type number reserved for GLib. + */ +#define G_TYPE_RESERVED_GLIB_LAST (31) +/** + * G_TYPE_RESERVED_BSE_FIRST: + * + * First fundamental type number to create a new fundamental type id with + * G_TYPE_MAKE_FUNDAMENTAL() reserved for BSE. + */ +#define G_TYPE_RESERVED_BSE_FIRST (32) +/** + * G_TYPE_RESERVED_BSE_LAST: + * + * Last fundamental type number reserved for BSE. + */ +#define G_TYPE_RESERVED_BSE_LAST (48) +/** + * G_TYPE_RESERVED_USER_FIRST: + * + * First available fundamental type number to create new fundamental + * type id with G_TYPE_MAKE_FUNDAMENTAL(). + */ +#define G_TYPE_RESERVED_USER_FIRST (49) + + +/* Type Checking Macros + */ +/** + * G_TYPE_IS_FUNDAMENTAL: + * @type: A #GType value + * + * Checks if @type is a fundamental type. + * + * Returns: %TRUE on success + */ +#define G_TYPE_IS_FUNDAMENTAL(type) ((type) <= G_TYPE_FUNDAMENTAL_MAX) +/** + * G_TYPE_IS_DERIVED: + * @type: A #GType value + * + * Checks if @type is derived (or in object-oriented terminology: + * inherited) from another type (this holds true for all non-fundamental + * types). + * + * Returns: %TRUE on success + */ +#define G_TYPE_IS_DERIVED(type) ((type) > G_TYPE_FUNDAMENTAL_MAX) +/** + * G_TYPE_IS_INTERFACE: + * @type: A #GType value + * + * Checks if @type is an interface type. + * An interface type provides a pure API, the implementation + * of which is provided by another type (which is then said to conform + * to the interface). GLib interfaces are somewhat analogous to Java + * interfaces and C++ classes containing only pure virtual functions, + * with the difference that GType interfaces are not derivable (but see + * g_type_interface_add_prerequisite() for an alternative). + * + * Returns: %TRUE on success + */ +#define G_TYPE_IS_INTERFACE(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_INTERFACE) +/** + * G_TYPE_IS_CLASSED: + * @type: A #GType value + * + * Checks if @type is a classed type. + * + * Returns: %TRUE on success + */ +#define G_TYPE_IS_CLASSED(type) (g_type_test_flags ((type), G_TYPE_FLAG_CLASSED)) +/** + * G_TYPE_IS_INSTANTIATABLE: + * @type: A #GType value + * + * Checks if @type can be instantiated. Instantiation is the + * process of creating an instance (object) of this type. + * + * Returns: %TRUE on success + */ +#define G_TYPE_IS_INSTANTIATABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_INSTANTIATABLE)) +/** + * G_TYPE_IS_DERIVABLE: + * @type: A #GType value + * + * Checks if @type is a derivable type. A derivable type can + * be used as the base class of a flat (single-level) class hierarchy. + * + * Returns: %TRUE on success + */ +#define G_TYPE_IS_DERIVABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_DERIVABLE)) +/** + * G_TYPE_IS_DEEP_DERIVABLE: + * @type: A #GType value + * + * Checks if @type is a deep derivable type. A deep derivable type + * can be used as the base class of a deep (multi-level) class hierarchy. + * + * Returns: %TRUE on success + */ +#define G_TYPE_IS_DEEP_DERIVABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_DEEP_DERIVABLE)) +/** + * G_TYPE_IS_ABSTRACT: + * @type: A #GType value + * + * Checks if @type is an abstract type. An abstract type cannot be + * instantiated and is normally used as an abstract base class for + * derived classes. + * + * Returns: %TRUE on success + */ +#define G_TYPE_IS_ABSTRACT(type) (g_type_test_flags ((type), G_TYPE_FLAG_ABSTRACT)) +/** + * G_TYPE_IS_VALUE_ABSTRACT: + * @type: A #GType value + * + * Checks if @type is an abstract value type. An abstract value type introduces + * a value table, but can't be used for g_value_init() and is normally used as + * an abstract base type for derived value types. + * + * Returns: %TRUE on success + */ +#define G_TYPE_IS_VALUE_ABSTRACT(type) (g_type_test_flags ((type), G_TYPE_FLAG_VALUE_ABSTRACT)) +/** + * G_TYPE_IS_VALUE_TYPE: + * @type: A #GType value + * + * Checks if @type is a value type and can be used with g_value_init(). + * + * Returns: %TRUE on success + */ +#define G_TYPE_IS_VALUE_TYPE(type) (g_type_check_is_value_type (type)) +/** + * G_TYPE_HAS_VALUE_TABLE: + * @type: A #GType value + * + * Checks if @type has a #GTypeValueTable. + * + * Returns: %TRUE on success + */ +#define G_TYPE_HAS_VALUE_TABLE(type) (g_type_value_table_peek (type) != NULL) + + +/* Typedefs + */ +/** + * GType: + * + * A numerical value which represents the unique identifier of a registered + * type. + */ +#if GLIB_SIZEOF_SIZE_T != GLIB_SIZEOF_LONG || !defined __cplusplus +typedef gsize GType; +#else /* for historic reasons, C++ links against gulong GTypes */ +typedef gulong GType; +#endif +typedef struct _GValue GValue; +typedef union _GTypeCValue GTypeCValue; +typedef struct _GTypePlugin GTypePlugin; +typedef struct _GTypeClass GTypeClass; +typedef struct _GTypeInterface GTypeInterface; +typedef struct _GTypeInstance GTypeInstance; +typedef struct _GTypeInfo GTypeInfo; +typedef struct _GTypeFundamentalInfo GTypeFundamentalInfo; +typedef struct _GInterfaceInfo GInterfaceInfo; +typedef struct _GTypeValueTable GTypeValueTable; +typedef struct _GTypeQuery GTypeQuery; + + +/* Basic Type Structures + */ +/** + * GTypeClass: + * + * An opaque structure used as the base of all classes. + */ +struct _GTypeClass +{ + /*< private >*/ + GType g_type; +}; +/** + * GTypeInstance: + * + * An opaque structure used as the base of all type instances. + */ +struct _GTypeInstance +{ + /*< private >*/ + GTypeClass *g_class; +}; +/** + * GTypeInterface: + * + * An opaque structure used as the base of all interface types. + */ +struct _GTypeInterface +{ + /*< private >*/ + GType g_type; /* iface type */ + GType g_instance_type; +}; +/** + * GTypeQuery: + * @type: the #GType value of the type + * @type_name: the name of the type + * @class_size: the size of the class structure + * @instance_size: the size of the instance structure + * + * A structure holding information for a specific type. + * It is filled in by the g_type_query() function. + */ +struct _GTypeQuery +{ + GType type; + const gchar *type_name; + guint class_size; + guint instance_size; +}; + + +/* Casts, checks and accessors for structured types + * usage of these macros is reserved to type implementations only + */ +/*< protected >*/ +/** + * G_TYPE_CHECK_INSTANCE: + * @instance: Location of a #GTypeInstance structure + * + * Checks if @instance is a valid #GTypeInstance structure, + * otherwise issues a warning and returns %FALSE. %NULL is not a valid + * #GTypeInstance. + * + * This macro should only be used in type implementations. + * + * Returns: %TRUE on success + */ +#define G_TYPE_CHECK_INSTANCE(instance) (_G_TYPE_CHI ((GTypeInstance*) (instance))) +/** + * G_TYPE_CHECK_INSTANCE_CAST: + * @instance: (nullable): Location of a #GTypeInstance structure + * @g_type: The type to be returned + * @c_type: The corresponding C type of @g_type + * + * Checks that @instance is an instance of the type identified by @g_type + * and issues a warning if this is not the case. Returns @instance casted + * to a pointer to @c_type. + * + * No warning will be issued if @instance is %NULL, and %NULL will be returned. + * + * This macro should only be used in type implementations. + */ +#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) +/** + * G_TYPE_CHECK_INSTANCE_TYPE: + * @instance: (nullable): Location of a #GTypeInstance structure. + * @g_type: The type to be checked + * + * Checks if @instance is an instance of the type identified by @g_type. If + * @instance is %NULL, %FALSE will be returned. + * + * This macro should only be used in type implementations. + * + * Returns: %TRUE on success + */ +#define G_TYPE_CHECK_INSTANCE_TYPE(instance, g_type) (_G_TYPE_CIT ((instance), (g_type))) +/** + * G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE: + * @instance: (nullable): Location of a #GTypeInstance structure. + * @g_type: The fundamental type to be checked + * + * Checks if @instance is an instance of the fundamental type identified by @g_type. + * If @instance is %NULL, %FALSE will be returned. + * + * This macro should only be used in type implementations. + * + * Returns: %TRUE on success + */ +#define G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE(instance, g_type) (_G_TYPE_CIFT ((instance), (g_type))) +/** + * G_TYPE_INSTANCE_GET_CLASS: + * @instance: Location of the #GTypeInstance structure + * @g_type: The #GType of the class to be returned + * @c_type: The C type of the class structure + * + * Get the class structure of a given @instance, casted + * to a specified ancestor type @g_type of the instance. + * + * Note that while calling a GInstanceInitFunc(), the class pointer + * gets modified, so it might not always return the expected pointer. + * + * This macro should only be used in type implementations. + * + * Returns: a pointer to the class structure + */ +#define G_TYPE_INSTANCE_GET_CLASS(instance, g_type, c_type) (_G_TYPE_IGC ((instance), (g_type), c_type)) +/** + * G_TYPE_INSTANCE_GET_INTERFACE: + * @instance: Location of the #GTypeInstance structure + * @g_type: The #GType of the interface to be returned + * @c_type: The C type of the interface structure + * + * Get the interface structure for interface @g_type of a given @instance. + * + * This macro should only be used in type implementations. + * + * Returns: a pointer to the interface structure + */ +#define G_TYPE_INSTANCE_GET_INTERFACE(instance, g_type, c_type) (_G_TYPE_IGI ((instance), (g_type), c_type)) +/** + * G_TYPE_CHECK_CLASS_CAST: + * @g_class: Location of a #GTypeClass structure + * @g_type: The type to be returned + * @c_type: The corresponding C type of class structure of @g_type + * + * Checks that @g_class is a class structure of the type identified by @g_type + * and issues a warning if this is not the case. Returns @g_class casted + * to a pointer to @c_type. %NULL is not a valid class structure. + * + * This macro should only be used in type implementations. + */ +#define G_TYPE_CHECK_CLASS_CAST(g_class, g_type, c_type) (_G_TYPE_CCC ((g_class), (g_type), c_type)) +/** + * G_TYPE_CHECK_CLASS_TYPE: + * @g_class: (nullable): Location of a #GTypeClass structure + * @g_type: The type to be checked + * + * Checks if @g_class is a class structure of the type identified by + * @g_type. If @g_class is %NULL, %FALSE will be returned. + * + * This macro should only be used in type implementations. + * + * Returns: %TRUE on success + */ +#define G_TYPE_CHECK_CLASS_TYPE(g_class, g_type) (_G_TYPE_CCT ((g_class), (g_type))) +/** + * G_TYPE_CHECK_VALUE: + * @value: a #GValue + * + * Checks if @value has been initialized to hold values + * of a value type. + * + * This macro should only be used in type implementations. + * + * Returns: %TRUE on success + */ +#define G_TYPE_CHECK_VALUE(value) (_G_TYPE_CHV ((value))) +/** + * G_TYPE_CHECK_VALUE_TYPE: + * @value: a #GValue + * @g_type: The type to be checked + * + * Checks if @value has been initialized to hold values + * of type @g_type. + * + * This macro should only be used in type implementations. + * + * Returns: %TRUE on success + */ +#define G_TYPE_CHECK_VALUE_TYPE(value, g_type) (_G_TYPE_CVH ((value), (g_type))) +/** + * G_TYPE_FROM_INSTANCE: + * @instance: Location of a valid #GTypeInstance structure + * + * Get the type identifier from a given @instance structure. + * + * This macro should only be used in type implementations. + * + * Returns: the #GType + */ +#define G_TYPE_FROM_INSTANCE(instance) (G_TYPE_FROM_CLASS (((GTypeInstance*) (instance))->g_class)) +/** + * G_TYPE_FROM_CLASS: + * @g_class: Location of a valid #GTypeClass structure + * + * Get the type identifier from a given @class structure. + * + * This macro should only be used in type implementations. + * + * Returns: the #GType + */ +#define G_TYPE_FROM_CLASS(g_class) (((GTypeClass*) (g_class))->g_type) +/** + * G_TYPE_FROM_INTERFACE: + * @g_iface: Location of a valid #GTypeInterface structure + * + * Get the type identifier from a given @interface structure. + * + * This macro should only be used in type implementations. + * + * Returns: the #GType + */ +#define G_TYPE_FROM_INTERFACE(g_iface) (((GTypeInterface*) (g_iface))->g_type) + +/** + * G_TYPE_INSTANCE_GET_PRIVATE: + * @instance: the instance of a type deriving from @private_type + * @g_type: the type identifying which private data to retrieve + * @c_type: The C type for the private structure + * + * Gets the private structure for a particular type. + * The private structure must have been registered in the + * class_init function with g_type_class_add_private(). + * + * This macro should only be used in type implementations. + * + * Since: 2.4 + * Deprecated: 2.58: Use %G_ADD_PRIVATE and the generated + * `your_type_get_instance_private()` function instead + * Returns: (not nullable): a pointer to the private data structure + */ +#define G_TYPE_INSTANCE_GET_PRIVATE(instance, g_type, c_type) ((c_type*) g_type_instance_get_private ((GTypeInstance*) (instance), (g_type))) GLIB_DEPRECATED_MACRO_IN_2_58_FOR(G_ADD_PRIVATE) + +/** + * G_TYPE_CLASS_GET_PRIVATE: + * @klass: the class of a type deriving from @private_type + * @g_type: the type identifying which private data to retrieve + * @c_type: The C type for the private structure + * + * Gets the private class structure for a particular type. + * The private structure must have been registered in the + * get_type() function with g_type_add_class_private(). + * + * This macro should only be used in type implementations. + * + * Since: 2.24 + * Returns: (not nullable): a pointer to the private data structure + */ +#define G_TYPE_CLASS_GET_PRIVATE(klass, g_type, c_type) ((c_type*) g_type_class_get_private ((GTypeClass*) (klass), (g_type))) + +/** + * GTypeDebugFlags: + * @G_TYPE_DEBUG_NONE: Print no messages + * @G_TYPE_DEBUG_OBJECTS: Print messages about object bookkeeping + * @G_TYPE_DEBUG_SIGNALS: Print messages about signal emissions + * @G_TYPE_DEBUG_MASK: Mask covering all debug flags + * @G_TYPE_DEBUG_INSTANCE_COUNT: Keep a count of instances of each type + * + * These flags used to be passed to g_type_init_with_debug_flags() which + * is now deprecated. + * + * If you need to enable debugging features, use the GOBJECT_DEBUG + * environment variable. + * + * Deprecated: 2.36: g_type_init() is now done automatically + */ +typedef enum /*< skip >*/ +{ + G_TYPE_DEBUG_NONE = 0, + G_TYPE_DEBUG_OBJECTS = 1 << 0, + G_TYPE_DEBUG_SIGNALS = 1 << 1, + G_TYPE_DEBUG_INSTANCE_COUNT = 1 << 2, + G_TYPE_DEBUG_MASK = 0x07 +} GTypeDebugFlags GLIB_DEPRECATED_TYPE_IN_2_36; + + +/* --- prototypes --- */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GLIB_DEPRECATED_IN_2_36 +void g_type_init (void); +GLIB_DEPRECATED_IN_2_36 +void g_type_init_with_debug_flags (GTypeDebugFlags debug_flags); +G_GNUC_END_IGNORE_DEPRECATIONS + +GLIB_AVAILABLE_IN_ALL +const gchar * g_type_name (GType type); +GLIB_AVAILABLE_IN_ALL +GQuark g_type_qname (GType type); +GLIB_AVAILABLE_IN_ALL +GType g_type_from_name (const gchar *name); +GLIB_AVAILABLE_IN_ALL +GType g_type_parent (GType type); +GLIB_AVAILABLE_IN_ALL +guint g_type_depth (GType type); +GLIB_AVAILABLE_IN_ALL +GType g_type_next_base (GType leaf_type, + GType root_type); +GLIB_AVAILABLE_IN_ALL +gboolean g_type_is_a (GType type, + GType is_a_type); +GLIB_AVAILABLE_IN_ALL +gpointer g_type_class_ref (GType type); +GLIB_AVAILABLE_IN_ALL +gpointer g_type_class_peek (GType type); +GLIB_AVAILABLE_IN_ALL +gpointer g_type_class_peek_static (GType type); +GLIB_AVAILABLE_IN_ALL +void g_type_class_unref (gpointer g_class); +GLIB_AVAILABLE_IN_ALL +gpointer g_type_class_peek_parent (gpointer g_class); +GLIB_AVAILABLE_IN_ALL +gpointer g_type_interface_peek (gpointer instance_class, + GType iface_type); +GLIB_AVAILABLE_IN_ALL +gpointer g_type_interface_peek_parent (gpointer g_iface); + +GLIB_AVAILABLE_IN_ALL +gpointer g_type_default_interface_ref (GType g_type); +GLIB_AVAILABLE_IN_ALL +gpointer g_type_default_interface_peek (GType g_type); +GLIB_AVAILABLE_IN_ALL +void g_type_default_interface_unref (gpointer g_iface); + +/* g_free() the returned arrays */ +GLIB_AVAILABLE_IN_ALL +GType* g_type_children (GType type, + guint *n_children); +GLIB_AVAILABLE_IN_ALL +GType* g_type_interfaces (GType type, + guint *n_interfaces); + +/* per-type _static_ data */ +GLIB_AVAILABLE_IN_ALL +void g_type_set_qdata (GType type, + GQuark quark, + gpointer data); +GLIB_AVAILABLE_IN_ALL +gpointer g_type_get_qdata (GType type, + GQuark quark); +GLIB_AVAILABLE_IN_ALL +void g_type_query (GType type, + GTypeQuery *query); + +GLIB_AVAILABLE_IN_2_44 +int g_type_get_instance_count (GType type); + +/* --- type registration --- */ +/** + * GBaseInitFunc: + * @g_class: (type GObject.TypeClass): The #GTypeClass structure to initialize + * + * A callback function used by the type system to do base initialization + * of the class structures of derived types. It is called as part of the + * initialization process of all derived classes and should reallocate + * or reset all dynamic class members copied over from the parent class. + * For example, class members (such as strings) that are not sufficiently + * handled by a plain memory copy of the parent class into the derived class + * have to be altered. See GClassInitFunc() for a discussion of the class + * initialization process. + */ +typedef void (*GBaseInitFunc) (gpointer g_class); +/** + * GBaseFinalizeFunc: + * @g_class: (type GObject.TypeClass): The #GTypeClass structure to finalize + * + * A callback function used by the type system to finalize those portions + * of a derived types class structure that were setup from the corresponding + * GBaseInitFunc() function. Class finalization basically works the inverse + * way in which class initialization is performed. + * See GClassInitFunc() for a discussion of the class initialization process. + */ +typedef void (*GBaseFinalizeFunc) (gpointer g_class); +/** + * GClassInitFunc: + * @g_class: (type GObject.TypeClass): The #GTypeClass structure to initialize. + * @class_data: The @class_data member supplied via the #GTypeInfo structure. + * + * A callback function used by the type system to initialize the class + * of a specific type. This function should initialize all static class + * members. + * + * The initialization process of a class involves: + * + * - Copying common members from the parent class over to the + * derived class structure. + * - Zero initialization of the remaining members not copied + * over from the parent class. + * - Invocation of the GBaseInitFunc() initializers of all parent + * types and the class' type. + * - Invocation of the class' GClassInitFunc() initializer. + * + * Since derived classes are partially initialized through a memory copy + * of the parent class, the general rule is that GBaseInitFunc() and + * GBaseFinalizeFunc() should take care of necessary reinitialization + * and release of those class members that were introduced by the type + * that specified these GBaseInitFunc()/GBaseFinalizeFunc(). + * GClassInitFunc() should only care about initializing static + * class members, while dynamic class members (such as allocated strings + * or reference counted resources) are better handled by a GBaseInitFunc() + * for this type, so proper initialization of the dynamic class members + * is performed for class initialization of derived types as well. + * + * An example may help to correspond the intend of the different class + * initializers: + * + * |[ + * typedef struct { + * GObjectClass parent_class; + * gint static_integer; + * gchar *dynamic_string; + * } TypeAClass; + * static void + * type_a_base_class_init (TypeAClass *class) + * { + * class->dynamic_string = g_strdup ("some string"); + * } + * static void + * type_a_base_class_finalize (TypeAClass *class) + * { + * g_free (class->dynamic_string); + * } + * static void + * type_a_class_init (TypeAClass *class) + * { + * class->static_integer = 42; + * } + * + * typedef struct { + * TypeAClass parent_class; + * gfloat static_float; + * GString *dynamic_gstring; + * } TypeBClass; + * static void + * type_b_base_class_init (TypeBClass *class) + * { + * class->dynamic_gstring = g_string_new ("some other string"); + * } + * static void + * type_b_base_class_finalize (TypeBClass *class) + * { + * g_string_free (class->dynamic_gstring); + * } + * static void + * type_b_class_init (TypeBClass *class) + * { + * class->static_float = 3.14159265358979323846; + * } + * ]| + * Initialization of TypeBClass will first cause initialization of + * TypeAClass (derived classes reference their parent classes, see + * g_type_class_ref() on this). + * + * Initialization of TypeAClass roughly involves zero-initializing its fields, + * then calling its GBaseInitFunc() type_a_base_class_init() to allocate + * its dynamic members (dynamic_string), and finally calling its GClassInitFunc() + * type_a_class_init() to initialize its static members (static_integer). + * The first step in the initialization process of TypeBClass is then + * a plain memory copy of the contents of TypeAClass into TypeBClass and + * zero-initialization of the remaining fields in TypeBClass. + * The dynamic members of TypeAClass within TypeBClass now need + * reinitialization which is performed by calling type_a_base_class_init() + * with an argument of TypeBClass. + * + * After that, the GBaseInitFunc() of TypeBClass, type_b_base_class_init() + * is called to allocate the dynamic members of TypeBClass (dynamic_gstring), + * and finally the GClassInitFunc() of TypeBClass, type_b_class_init(), + * is called to complete the initialization process with the static members + * (static_float). + * + * Corresponding finalization counter parts to the GBaseInitFunc() functions + * have to be provided to release allocated resources at class finalization + * time. + */ +typedef void (*GClassInitFunc) (gpointer g_class, + gpointer class_data); +/** + * GClassFinalizeFunc: + * @g_class: (type GObject.TypeClass): The #GTypeClass structure to finalize + * @class_data: The @class_data member supplied via the #GTypeInfo structure + * + * A callback function used by the type system to finalize a class. + * This function is rarely needed, as dynamically allocated class resources + * should be handled by GBaseInitFunc() and GBaseFinalizeFunc(). + * Also, specification of a GClassFinalizeFunc() in the #GTypeInfo + * structure of a static type is invalid, because classes of static types + * will never be finalized (they are artificially kept alive when their + * reference count drops to zero). + */ +typedef void (*GClassFinalizeFunc) (gpointer g_class, + gpointer class_data); +/** + * GInstanceInitFunc: + * @instance: The instance to initialize + * @g_class: (type GObject.TypeClass): The class of the type the instance is + * created for + * + * A callback function used by the type system to initialize a new + * instance of a type. This function initializes all instance members and + * allocates any resources required by it. + * + * Initialization of a derived instance involves calling all its parent + * types instance initializers, so the class member of the instance + * is altered during its initialization to always point to the class that + * belongs to the type the current initializer was introduced for. + * + * The extended members of @instance are guaranteed to have been filled with + * zeros before this function is called. + */ +typedef void (*GInstanceInitFunc) (GTypeInstance *instance, + gpointer g_class); +/** + * GInterfaceInitFunc: + * @g_iface: (type GObject.TypeInterface): The interface structure to initialize + * @iface_data: The @interface_data supplied via the #GInterfaceInfo structure + * + * A callback function used by the type system to initialize a new + * interface. This function should initialize all internal data and + * allocate any resources required by the interface. + * + * The members of @iface_data are guaranteed to have been filled with + * zeros before this function is called. + */ +typedef void (*GInterfaceInitFunc) (gpointer g_iface, + gpointer iface_data); +/** + * GInterfaceFinalizeFunc: + * @g_iface: (type GObject.TypeInterface): The interface structure to finalize + * @iface_data: The @interface_data supplied via the #GInterfaceInfo structure + * + * A callback function used by the type system to finalize an interface. + * This function should destroy any internal data and release any resources + * allocated by the corresponding GInterfaceInitFunc() function. + */ +typedef void (*GInterfaceFinalizeFunc) (gpointer g_iface, + gpointer iface_data); +/** + * GTypeClassCacheFunc: + * @cache_data: data that was given to the g_type_add_class_cache_func() call + * @g_class: (type GObject.TypeClass): The #GTypeClass structure which is + * unreferenced + * + * A callback function which is called when the reference count of a class + * drops to zero. It may use g_type_class_ref() to prevent the class from + * being freed. You should not call g_type_class_unref() from a + * #GTypeClassCacheFunc function to prevent infinite recursion, use + * g_type_class_unref_uncached() instead. + * + * The functions have to check the class id passed in to figure + * whether they actually want to cache the class of this type, since all + * classes are routed through the same #GTypeClassCacheFunc chain. + * + * Returns: %TRUE to stop further #GTypeClassCacheFuncs from being + * called, %FALSE to continue + */ +typedef gboolean (*GTypeClassCacheFunc) (gpointer cache_data, + GTypeClass *g_class); +/** + * GTypeInterfaceCheckFunc: + * @check_data: data passed to g_type_add_interface_check() + * @g_iface: (type GObject.TypeInterface): the interface that has been + * initialized + * + * A callback called after an interface vtable is initialized. + * See g_type_add_interface_check(). + * + * Since: 2.4 + */ +typedef void (*GTypeInterfaceCheckFunc) (gpointer check_data, + gpointer g_iface); +/** + * GTypeFundamentalFlags: + * @G_TYPE_FLAG_CLASSED: Indicates a classed type + * @G_TYPE_FLAG_INSTANTIATABLE: Indicates an instantiatable type (implies classed) + * @G_TYPE_FLAG_DERIVABLE: Indicates a flat derivable type + * @G_TYPE_FLAG_DEEP_DERIVABLE: Indicates a deep derivable type (implies derivable) + * + * Bit masks used to check or determine specific characteristics of a + * fundamental type. + */ +typedef enum /*< skip >*/ +{ + G_TYPE_FLAG_CLASSED = (1 << 0), + G_TYPE_FLAG_INSTANTIATABLE = (1 << 1), + G_TYPE_FLAG_DERIVABLE = (1 << 2), + G_TYPE_FLAG_DEEP_DERIVABLE = (1 << 3) +} GTypeFundamentalFlags; +/** + * GTypeFlags: + * @G_TYPE_FLAG_ABSTRACT: Indicates an abstract type. No instances can be + * created for an abstract type + * @G_TYPE_FLAG_VALUE_ABSTRACT: Indicates an abstract value type, i.e. a type + * that introduces a value table, but can't be used for + * g_value_init() + * + * Bit masks used to check or determine characteristics of a type. + */ +typedef enum /*< skip >*/ +{ + G_TYPE_FLAG_ABSTRACT = (1 << 4), + G_TYPE_FLAG_VALUE_ABSTRACT = (1 << 5) +} GTypeFlags; +/** + * GTypeInfo: + * @class_size: Size of the class structure (required for interface, classed and instantiatable types) + * @base_init: Location of the base initialization function (optional) + * @base_finalize: Location of the base finalization function (optional) + * @class_init: Location of the class initialization function for + * classed and instantiatable types. Location of the default vtable + * inititalization function for interface types. (optional) This function + * is used both to fill in virtual functions in the class or default vtable, + * and to do type-specific setup such as registering signals and object + * properties. + * @class_finalize: Location of the class finalization function for + * classed and instantiatable types. Location of the default vtable + * finalization function for interface types. (optional) + * @class_data: User-supplied data passed to the class init/finalize functions + * @instance_size: Size of the instance (object) structure (required for instantiatable types only) + * @n_preallocs: Prior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10, it is ignored, since instances are allocated with the [slice allocator][glib-Memory-Slices] now. + * @instance_init: Location of the instance initialization function (optional, for instantiatable types only) + * @value_table: A #GTypeValueTable function table for generic handling of GValues + * of this type (usually only useful for fundamental types) + * + * This structure is used to provide the type system with the information + * required to initialize and destruct (finalize) a type's class and + * its instances. + * + * The initialized structure is passed to the g_type_register_static() function + * (or is copied into the provided #GTypeInfo structure in the + * g_type_plugin_complete_type_info()). The type system will perform a deep + * copy of this structure, so its memory does not need to be persistent + * across invocation of g_type_register_static(). + */ +struct _GTypeInfo +{ + /* interface types, classed types, instantiated types */ + guint16 class_size; + + GBaseInitFunc base_init; + GBaseFinalizeFunc base_finalize; + + /* interface types, classed types, instantiated types */ + GClassInitFunc class_init; + GClassFinalizeFunc class_finalize; + gconstpointer class_data; + + /* instantiated types */ + guint16 instance_size; + guint16 n_preallocs; + GInstanceInitFunc instance_init; + + /* value handling */ + const GTypeValueTable *value_table; +}; +/** + * GTypeFundamentalInfo: + * @type_flags: #GTypeFundamentalFlags describing the characteristics of the fundamental type + * + * A structure that provides information to the type system which is + * used specifically for managing fundamental types. + */ +struct _GTypeFundamentalInfo +{ + GTypeFundamentalFlags type_flags; +}; +/** + * GInterfaceInfo: + * @interface_init: location of the interface initialization function + * @interface_finalize: location of the interface finalization function + * @interface_data: user-supplied data passed to the interface init/finalize functions + * + * A structure that provides information to the type system which is + * used specifically for managing interface types. + */ +struct _GInterfaceInfo +{ + GInterfaceInitFunc interface_init; + GInterfaceFinalizeFunc interface_finalize; + gpointer interface_data; +}; +/** + * GTypeValueTable: + * @value_init: Default initialize @values contents by poking values + * directly into the value->data array. The data array of + * the #GValue passed into this function was zero-filled + * with `memset()`, so no care has to be taken to free any + * old contents. E.g. for the implementation of a string + * value that may never be %NULL, the implementation might + * look like: + * |[ + * value->data[0].v_pointer = g_strdup (""); + * ]| + * @value_free: Free any old contents that might be left in the + * data array of the passed in @value. No resources may + * remain allocated through the #GValue contents after + * this function returns. E.g. for our above string type: + * |[ + * // only free strings without a specific flag for static storage + * if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS)) + * g_free (value->data[0].v_pointer); + * ]| + * @value_copy: @dest_value is a #GValue with zero-filled data section + * and @src_value is a properly setup #GValue of same or + * derived type. + * The purpose of this function is to copy the contents of + * @src_value into @dest_value in a way, that even after + * @src_value has been freed, the contents of @dest_value + * remain valid. String type example: + * |[ + * dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer); + * ]| + * @value_peek_pointer: If the value contents fit into a pointer, such as objects + * or strings, return this pointer, so the caller can peek at + * the current contents. To extend on our above string example: + * |[ + * return value->data[0].v_pointer; + * ]| + * @collect_format: A string format describing how to collect the contents of + * this value bit-by-bit. Each character in the format represents + * an argument to be collected, and the characters themselves indicate + * the type of the argument. Currently supported arguments are: + * - 'i' - Integers. passed as collect_values[].v_int. + * - 'l' - Longs. passed as collect_values[].v_long. + * - 'd' - Doubles. passed as collect_values[].v_double. + * - 'p' - Pointers. passed as collect_values[].v_pointer. + * It should be noted that for variable argument list construction, + * ANSI C promotes every type smaller than an integer to an int, and + * floats to doubles. So for collection of short int or char, 'i' + * needs to be used, and for collection of floats 'd'. + * @collect_value: The collect_value() function is responsible for converting the + * values collected from a variable argument list into contents + * suitable for storage in a GValue. This function should setup + * @value similar to value_init(); e.g. for a string value that + * does not allow %NULL pointers, it needs to either spew an error, + * or do an implicit conversion by storing an empty string. + * The @value passed in to this function has a zero-filled data + * array, so just like for value_init() it is guaranteed to not + * contain any old contents that might need freeing. + * @n_collect_values is exactly the string length of @collect_format, + * and @collect_values is an array of unions #GTypeCValue with + * length @n_collect_values, containing the collected values + * according to @collect_format. + * @collect_flags is an argument provided as a hint by the caller. + * It may contain the flag %G_VALUE_NOCOPY_CONTENTS indicating, + * that the collected value contents may be considered "static" + * for the duration of the @value lifetime. + * Thus an extra copy of the contents stored in @collect_values is + * not required for assignment to @value. + * For our above string example, we continue with: + * |[ + * if (!collect_values[0].v_pointer) + * value->data[0].v_pointer = g_strdup (""); + * else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) + * { + * value->data[0].v_pointer = collect_values[0].v_pointer; + * // keep a flag for the value_free() implementation to not free this string + * value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS; + * } + * else + * value->data[0].v_pointer = g_strdup (collect_values[0].v_pointer); + * return NULL; + * ]| + * It should be noted, that it is generally a bad idea to follow the + * #G_VALUE_NOCOPY_CONTENTS hint for reference counted types. Due to + * reentrancy requirements and reference count assertions performed + * by the signal emission code, reference counts should always be + * incremented for reference counted contents stored in the value->data + * array. To deviate from our string example for a moment, and taking + * a look at an exemplary implementation for collect_value() of + * #GObject: + * |[ + * GObject *object = G_OBJECT (collect_values[0].v_pointer); + * g_return_val_if_fail (object != NULL, + * g_strdup_printf ("Object passed as invalid NULL pointer")); + * // never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types + * value->data[0].v_pointer = g_object_ref (object); + * return NULL; + * ]| + * The reference count for valid objects is always incremented, + * regardless of @collect_flags. For invalid objects, the example + * returns a newly allocated string without altering @value. + * Upon success, collect_value() needs to return %NULL. If, however, + * an error condition occurred, collect_value() may spew an + * error by returning a newly allocated non-%NULL string, giving + * a suitable description of the error condition. + * The calling code makes no assumptions about the @value + * contents being valid upon error returns, @value + * is simply thrown away without further freeing. As such, it is + * a good idea to not allocate #GValue contents, prior to returning + * an error, however, collect_values() is not obliged to return + * a correctly setup @value for error returns, simply because + * any non-%NULL return is considered a fatal condition so further + * program behaviour is undefined. + * @lcopy_format: Format description of the arguments to collect for @lcopy_value, + * analogous to @collect_format. Usually, @lcopy_format string consists + * only of 'p's to provide lcopy_value() with pointers to storage locations. + * @lcopy_value: This function is responsible for storing the @value contents into + * arguments passed through a variable argument list which got + * collected into @collect_values according to @lcopy_format. + * @n_collect_values equals the string length of @lcopy_format, + * and @collect_flags may contain %G_VALUE_NOCOPY_CONTENTS. + * In contrast to collect_value(), lcopy_value() is obliged to + * always properly support %G_VALUE_NOCOPY_CONTENTS. + * Similar to collect_value() the function may prematurely abort + * by returning a newly allocated string describing an error condition. + * To complete the string example: + * |[ + * gchar **string_p = collect_values[0].v_pointer; + * g_return_val_if_fail (string_p != NULL, + * g_strdup_printf ("string location passed as NULL")); + * if (collect_flags & G_VALUE_NOCOPY_CONTENTS) + * *string_p = value->data[0].v_pointer; + * else + * *string_p = g_strdup (value->data[0].v_pointer); + * ]| + * And an illustrative version of lcopy_value() for + * reference-counted types: + * |[ + * GObject **object_p = collect_values[0].v_pointer; + * g_return_val_if_fail (object_p != NULL, + * g_strdup_printf ("object location passed as NULL")); + * if (!value->data[0].v_pointer) + * *object_p = NULL; + * else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) // always honour + * *object_p = value->data[0].v_pointer; + * else + * *object_p = g_object_ref (value->data[0].v_pointer); + * return NULL; + * ]| + * + * The #GTypeValueTable provides the functions required by the #GValue + * implementation, to serve as a container for values of a type. + */ + +struct _GTypeValueTable +{ + void (*value_init) (GValue *value); + void (*value_free) (GValue *value); + void (*value_copy) (const GValue *src_value, + GValue *dest_value); + /* varargs functionality (optional) */ + gpointer (*value_peek_pointer) (const GValue *value); + const gchar *collect_format; + gchar* (*collect_value) (GValue *value, + guint n_collect_values, + GTypeCValue *collect_values, + guint collect_flags); + const gchar *lcopy_format; + gchar* (*lcopy_value) (const GValue *value, + guint n_collect_values, + GTypeCValue *collect_values, + guint collect_flags); +}; +GLIB_AVAILABLE_IN_ALL +GType g_type_register_static (GType parent_type, + const gchar *type_name, + const GTypeInfo *info, + GTypeFlags flags); +GLIB_AVAILABLE_IN_ALL +GType g_type_register_static_simple (GType parent_type, + const gchar *type_name, + guint class_size, + GClassInitFunc class_init, + guint instance_size, + GInstanceInitFunc instance_init, + GTypeFlags flags); + +GLIB_AVAILABLE_IN_ALL +GType g_type_register_dynamic (GType parent_type, + const gchar *type_name, + GTypePlugin *plugin, + GTypeFlags flags); +GLIB_AVAILABLE_IN_ALL +GType g_type_register_fundamental (GType type_id, + const gchar *type_name, + const GTypeInfo *info, + const GTypeFundamentalInfo *finfo, + GTypeFlags flags); +GLIB_AVAILABLE_IN_ALL +void g_type_add_interface_static (GType instance_type, + GType interface_type, + const GInterfaceInfo *info); +GLIB_AVAILABLE_IN_ALL +void g_type_add_interface_dynamic (GType instance_type, + GType interface_type, + GTypePlugin *plugin); +GLIB_AVAILABLE_IN_ALL +void g_type_interface_add_prerequisite (GType interface_type, + GType prerequisite_type); +GLIB_AVAILABLE_IN_ALL +GType*g_type_interface_prerequisites (GType interface_type, + guint *n_prerequisites); +GLIB_AVAILABLE_IN_2_68 +GType g_type_interface_instantiatable_prerequisite + (GType interface_type); +GLIB_DEPRECATED_IN_2_58 +void g_type_class_add_private (gpointer g_class, + gsize private_size); +GLIB_AVAILABLE_IN_2_38 +gint g_type_add_instance_private (GType class_type, + gsize private_size); +GLIB_AVAILABLE_IN_ALL +gpointer g_type_instance_get_private (GTypeInstance *instance, + GType private_type); +GLIB_AVAILABLE_IN_2_38 +void g_type_class_adjust_private_offset (gpointer g_class, + gint *private_size_or_offset); + +GLIB_AVAILABLE_IN_ALL +void g_type_add_class_private (GType class_type, + gsize private_size); +GLIB_AVAILABLE_IN_ALL +gpointer g_type_class_get_private (GTypeClass *klass, + GType private_type); +GLIB_AVAILABLE_IN_2_38 +gint g_type_class_get_instance_private_offset (gpointer g_class); + +GLIB_AVAILABLE_IN_2_34 +void g_type_ensure (GType type); +GLIB_AVAILABLE_IN_2_36 +guint g_type_get_type_registration_serial (void); + + +/* --- GType boilerplate --- */ +/** + * G_DECLARE_FINAL_TYPE: + * @ModuleObjName: The name of the new type, in camel case (like GtkWidget) + * @module_obj_name: The name of the new type in lowercase, with words + * separated by '_' (like 'gtk_widget') + * @MODULE: The name of the module, in all caps (like 'GTK') + * @OBJ_NAME: The bare name of the type, in all caps (like 'WIDGET') + * @ParentName: the name of the parent type, in camel case (like GtkWidget) + * + * A convenience macro for emitting the usual declarations in the header file for a type which is not (at the + * present time) intended to be subclassed. + * + * You might use it in a header as follows: + * + * |[ + * #ifndef _myapp_window_h_ + * #define _myapp_window_h_ + * + * #include + * + * #define MY_APP_TYPE_WINDOW my_app_window_get_type () + * G_DECLARE_FINAL_TYPE (MyAppWindow, my_app_window, MY_APP, WINDOW, GtkWindow) + * + * MyAppWindow * my_app_window_new (void); + * + * ... + * + * #endif + * ]| + * + * This results in the following things happening: + * + * - the usual my_app_window_get_type() function is declared with a return type of #GType + * + * - the MyAppWindow types is defined as a typedef of struct _MyAppWindow. The struct itself is not + * defined and should be defined from the .c file before G_DEFINE_TYPE() is used. + * + * - the MY_APP_WINDOW() cast is emitted as static inline function along with the MY_APP_IS_WINDOW() type + * checking function + * + * - the MyAppWindowClass type is defined as a struct containing GtkWindowClass. This is done for the + * convenience of the person defining the type and should not be considered to be part of the ABI. In + * particular, without a firm declaration of the instance structure, it is not possible to subclass the type + * and therefore the fact that the size of the class structure is exposed is not a concern and it can be + * freely changed at any point in the future. + * + * - g_autoptr() support being added for your type, based on the type of your parent class + * + * You can only use this function if your parent type also supports g_autoptr(). + * + * Because the type macro (MY_APP_TYPE_WINDOW in the above example) is not a callable, you must continue to + * manually define this as a macro for yourself. + * + * The declaration of the _get_type() function is the first thing emitted by the macro. This allows this macro + * to be used in the usual way with export control and API versioning macros. + * + * If you want to declare your own class structure, use G_DECLARE_DERIVABLE_TYPE(). + * + * If you are writing a library, it is important to note that it is possible to convert a type from using + * G_DECLARE_FINAL_TYPE() to G_DECLARE_DERIVABLE_TYPE() without breaking API or ABI. As a precaution, you + * should therefore use G_DECLARE_FINAL_TYPE() until you are sure that it makes sense for your class to be + * subclassed. Once a class structure has been exposed it is not possible to change its size or remove or + * reorder items without breaking the API and/or ABI. + * + * Since: 2.44 + **/ +#define G_DECLARE_FINAL_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \ + GType module_obj_name##_get_type (void); \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + typedef struct _##ModuleObjName ModuleObjName; \ + typedef struct { ParentName##Class parent_class; } ModuleObjName##Class; \ + \ + _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName) \ + G_DEFINE_AUTOPTR_CLEANUP_FUNC (ModuleObjName##Class, g_type_class_unref) \ + \ + G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \ + return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \ + G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) { \ + return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \ + G_GNUC_END_IGNORE_DEPRECATIONS + +/** + * G_DECLARE_DERIVABLE_TYPE: + * @ModuleObjName: The name of the new type, in camel case (like GtkWidget) + * @module_obj_name: The name of the new type in lowercase, with words + * separated by '_' (like 'gtk_widget') + * @MODULE: The name of the module, in all caps (like 'GTK') + * @OBJ_NAME: The bare name of the type, in all caps (like 'WIDGET') + * @ParentName: the name of the parent type, in camel case (like GtkWidget) + * + * A convenience macro for emitting the usual declarations in the + * header file for a type which is intended to be subclassed. + * + * You might use it in a header as follows: + * + * |[ + * #ifndef _gtk_frobber_h_ + * #define _gtk_frobber_h_ + * + * #define GTK_TYPE_FROBBER gtk_frobber_get_type () + * GDK_AVAILABLE_IN_3_12 + * G_DECLARE_DERIVABLE_TYPE (GtkFrobber, gtk_frobber, GTK, FROBBER, GtkWidget) + * + * struct _GtkFrobberClass + * { + * GtkWidgetClass parent_class; + * + * void (* handle_frob) (GtkFrobber *frobber, + * guint n_frobs); + * + * gpointer padding[12]; + * }; + * + * GtkWidget * gtk_frobber_new (void); + * + * ... + * + * #endif + * ]| + * + * This results in the following things happening: + * + * - the usual gtk_frobber_get_type() function is declared with a return type of #GType + * + * - the GtkFrobber struct is created with GtkWidget as the first and only item. You are expected to use + * a private structure from your .c file to store your instance variables. + * + * - the GtkFrobberClass type is defined as a typedef to struct _GtkFrobberClass, which is left undefined. + * You should do this from the header file directly after you use the macro. + * + * - the GTK_FROBBER() and GTK_FROBBER_CLASS() casts are emitted as static inline functions along with + * the GTK_IS_FROBBER() and GTK_IS_FROBBER_CLASS() type checking functions and GTK_FROBBER_GET_CLASS() + * function. + * + * - g_autoptr() support being added for your type, based on the type of your parent class + * + * You can only use this function if your parent type also supports g_autoptr(). + * + * Because the type macro (GTK_TYPE_FROBBER in the above example) is not a callable, you must continue to + * manually define this as a macro for yourself. + * + * The declaration of the _get_type() function is the first thing emitted by the macro. This allows this macro + * to be used in the usual way with export control and API versioning macros. + * + * If you are writing a library, it is important to note that it is possible to convert a type from using + * G_DECLARE_FINAL_TYPE() to G_DECLARE_DERIVABLE_TYPE() without breaking API or ABI. As a precaution, you + * should therefore use G_DECLARE_FINAL_TYPE() until you are sure that it makes sense for your class to be + * subclassed. Once a class structure has been exposed it is not possible to change its size or remove or + * reorder items without breaking the API and/or ABI. If you want to declare your own class structure, use + * G_DECLARE_DERIVABLE_TYPE(). If you want to declare a class without exposing the class or instance + * structures, use G_DECLARE_FINAL_TYPE(). + * + * If you must use G_DECLARE_DERIVABLE_TYPE() you should be sure to include some padding at the bottom of your + * class structure to leave space for the addition of future virtual functions. + * + * Since: 2.44 + **/ +#define G_DECLARE_DERIVABLE_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \ + GType module_obj_name##_get_type (void); \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + typedef struct _##ModuleObjName ModuleObjName; \ + typedef struct _##ModuleObjName##Class ModuleObjName##Class; \ + struct _##ModuleObjName { ParentName parent_instance; }; \ + \ + _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName) \ + G_DEFINE_AUTOPTR_CLEANUP_FUNC (ModuleObjName##Class, g_type_class_unref) \ + \ + G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \ + return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \ + G_GNUC_UNUSED static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_CLASS (gpointer ptr) { \ + return G_TYPE_CHECK_CLASS_CAST (ptr, module_obj_name##_get_type (), ModuleObjName##Class); } \ + G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) { \ + return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \ + G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME##_CLASS (gpointer ptr) { \ + return G_TYPE_CHECK_CLASS_TYPE (ptr, module_obj_name##_get_type ()); } \ + G_GNUC_UNUSED static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_GET_CLASS (gpointer ptr) { \ + return G_TYPE_INSTANCE_GET_CLASS (ptr, module_obj_name##_get_type (), ModuleObjName##Class); } \ + G_GNUC_END_IGNORE_DEPRECATIONS + +/** + * G_DECLARE_INTERFACE: + * @ModuleObjName: The name of the new type, in camel case (like GtkWidget) + * @module_obj_name: The name of the new type in lowercase, with words + * separated by '_' (like 'gtk_widget') + * @MODULE: The name of the module, in all caps (like 'GTK') + * @OBJ_NAME: The bare name of the type, in all caps (like 'WIDGET') + * @PrerequisiteName: the name of the prerequisite type, in camel case (like GtkWidget) + * + * A convenience macro for emitting the usual declarations in the header file for a GInterface type. + * + * You might use it in a header as follows: + * + * |[ + * #ifndef _my_model_h_ + * #define _my_model_h_ + * + * #define MY_TYPE_MODEL my_model_get_type () + * GDK_AVAILABLE_IN_3_12 + * G_DECLARE_INTERFACE (MyModel, my_model, MY, MODEL, GObject) + * + * struct _MyModelInterface + * { + * GTypeInterface g_iface; + * + * gpointer (* get_item) (MyModel *model); + * }; + * + * gpointer my_model_get_item (MyModel *model); + * + * ... + * + * #endif + * ]| + * + * This results in the following things happening: + * + * - the usual my_model_get_type() function is declared with a return type of #GType + * + * - the MyModelInterface type is defined as a typedef to struct _MyModelInterface, + * which is left undefined. You should do this from the header file directly after + * you use the macro. + * + * - the MY_MODEL() cast is emitted as static inline functions along with + * the MY_IS_MODEL() type checking function and MY_MODEL_GET_IFACE() function. + * + * - g_autoptr() support being added for your type, based on your prerequisite type. + * + * You can only use this function if your prerequisite type also supports g_autoptr(). + * + * Because the type macro (MY_TYPE_MODEL in the above example) is not a callable, you must continue to + * manually define this as a macro for yourself. + * + * The declaration of the _get_type() function is the first thing emitted by the macro. This allows this macro + * to be used in the usual way with export control and API versioning macros. + * + * Since: 2.44 + **/ +#define G_DECLARE_INTERFACE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, PrerequisiteName) \ + GType module_obj_name##_get_type (void); \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + typedef struct _##ModuleObjName ModuleObjName; \ + typedef struct _##ModuleObjName##Interface ModuleObjName##Interface; \ + \ + _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, PrerequisiteName) \ + \ + G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \ + return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \ + G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) { \ + return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \ + G_GNUC_UNUSED static inline ModuleObjName##Interface * MODULE##_##OBJ_NAME##_GET_IFACE (gpointer ptr) { \ + return G_TYPE_INSTANCE_GET_INTERFACE (ptr, module_obj_name##_get_type (), ModuleObjName##Interface); } \ + G_GNUC_END_IGNORE_DEPRECATIONS + +/** + * G_DEFINE_TYPE: + * @TN: The name of the new type, in Camel case. + * @t_n: The name of the new type, in lowercase, with words + * separated by '_'. + * @T_P: The #GType of the parent type. + * + * A convenience macro for type implementations, which declares a class + * initialization function, an instance initialization function (see #GTypeInfo + * for information about these) and a static variable named `t_n_parent_class` + * pointing to the parent class. Furthermore, it defines a *_get_type() function. + * See G_DEFINE_TYPE_EXTENDED() for an example. + * + * Since: 2.4 + */ +#define G_DEFINE_TYPE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, {}) +/** + * G_DEFINE_TYPE_WITH_CODE: + * @TN: The name of the new type, in Camel case. + * @t_n: The name of the new type in lowercase, with words separated by '_'. + * @T_P: The #GType of the parent type. + * @_C_: Custom code that gets inserted in the *_get_type() function. + * + * A convenience macro for type implementations. + * Similar to G_DEFINE_TYPE(), but allows you to insert custom code into the + * *_get_type() function, e.g. interface implementations via G_IMPLEMENT_INTERFACE(). + * See G_DEFINE_TYPE_EXTENDED() for an example. + * + * Since: 2.4 + */ +#define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() +/** + * G_DEFINE_TYPE_WITH_PRIVATE: + * @TN: The name of the new type, in Camel case. + * @t_n: The name of the new type, in lowercase, with words + * separated by '_'. + * @T_P: The #GType of the parent type. + * + * A convenience macro for type implementations, which declares a class + * initialization function, an instance initialization function (see #GTypeInfo + * for information about these), a static variable named `t_n_parent_class` + * pointing to the parent class, and adds private instance data to the type. + * Furthermore, it defines a *_get_type() function. See G_DEFINE_TYPE_EXTENDED() + * for an example. + * + * Note that private structs added with this macros must have a struct + * name of the form @TN Private. + * + * The private instance data can be retrieved using the automatically generated + * getter function `t_n_get_instance_private()`. + * + * See also: G_ADD_PRIVATE() + * + * Since: 2.38 + */ +#define G_DEFINE_TYPE_WITH_PRIVATE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, G_ADD_PRIVATE (TN)) +/** + * G_DEFINE_ABSTRACT_TYPE: + * @TN: The name of the new type, in Camel case. + * @t_n: The name of the new type, in lowercase, with words + * separated by '_'. + * @T_P: The #GType of the parent type. + * + * A convenience macro for type implementations. + * Similar to G_DEFINE_TYPE(), but defines an abstract type. + * See G_DEFINE_TYPE_EXTENDED() for an example. + * + * Since: 2.4 + */ +#define G_DEFINE_ABSTRACT_TYPE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, {}) +/** + * G_DEFINE_ABSTRACT_TYPE_WITH_CODE: + * @TN: The name of the new type, in Camel case. + * @t_n: The name of the new type, in lowercase, with words + * separated by '_'. + * @T_P: The #GType of the parent type. + * @_C_: Custom code that gets inserted in the @type_name_get_type() function. + * + * A convenience macro for type implementations. + * Similar to G_DEFINE_TYPE_WITH_CODE(), but defines an abstract type and + * allows you to insert custom code into the *_get_type() function, e.g. + * interface implementations via G_IMPLEMENT_INTERFACE(). + * See G_DEFINE_TYPE_EXTENDED() for an example. + * + * Since: 2.4 + */ +#define G_DEFINE_ABSTRACT_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() +/** + * G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE: + * @TN: The name of the new type, in Camel case. + * @t_n: The name of the new type, in lowercase, with words + * separated by '_'. + * @T_P: The #GType of the parent type. + * + * Similar to G_DEFINE_TYPE_WITH_PRIVATE(), but defines an abstract type. + * See G_DEFINE_TYPE_EXTENDED() for an example. + * + * Since: 2.38 + */ +#define G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, G_ADD_PRIVATE (TN)) +/** + * G_DEFINE_TYPE_EXTENDED: + * @TN: The name of the new type, in Camel case. + * @t_n: The name of the new type, in lowercase, with words + * separated by '_'. + * @T_P: The #GType of the parent type. + * @_f_: #GTypeFlags to pass to g_type_register_static() + * @_C_: Custom code that gets inserted in the *_get_type() function. + * + * The most general convenience macro for type implementations, on which + * G_DEFINE_TYPE(), etc are based. + * + * |[ + * G_DEFINE_TYPE_EXTENDED (GtkGadget, + * gtk_gadget, + * GTK_TYPE_WIDGET, + * 0, + * G_ADD_PRIVATE (GtkGadget) + * G_IMPLEMENT_INTERFACE (TYPE_GIZMO, + * gtk_gadget_gizmo_init)); + * ]| + * expands to + * |[ + * static void gtk_gadget_init (GtkGadget *self); + * static void gtk_gadget_class_init (GtkGadgetClass *klass); + * static gpointer gtk_gadget_parent_class = NULL; + * static gint GtkGadget_private_offset; + * static void gtk_gadget_class_intern_init (gpointer klass) + * { + * gtk_gadget_parent_class = g_type_class_peek_parent (klass); + * if (GtkGadget_private_offset != 0) + * g_type_class_adjust_private_offset (klass, &GtkGadget_private_offset); + * gtk_gadget_class_init ((GtkGadgetClass*) klass); + * } + * static inline gpointer gtk_gadget_get_instance_private (GtkGadget *self) + * { + * return (G_STRUCT_MEMBER_P (self, GtkGadget_private_offset)); + * } + * + * GType + * gtk_gadget_get_type (void) + * { + * static gsize static_g_define_type_id = 0; + * if (g_once_init_enter (&static_g_define_type_id)) + * { + * GType g_define_type_id = + * g_type_register_static_simple (GTK_TYPE_WIDGET, + * g_intern_static_string ("GtkGadget"), + * sizeof (GtkGadgetClass), + * (GClassInitFunc) gtk_gadget_class_intern_init, + * sizeof (GtkGadget), + * (GInstanceInitFunc) gtk_gadget_init, + * 0); + * { + * GtkGadget_private_offset = + * g_type_add_instance_private (g_define_type_id, sizeof (GtkGadgetPrivate)); + * } + * { + * const GInterfaceInfo g_implement_interface_info = { + * (GInterfaceInitFunc) gtk_gadget_gizmo_init + * }; + * g_type_add_interface_static (g_define_type_id, TYPE_GIZMO, &g_implement_interface_info); + * } + * g_once_init_leave (&static_g_define_type_id, g_define_type_id); + * } + * return static_g_define_type_id; + * } + * ]| + * The only pieces which have to be manually provided are the definitions of + * the instance and class structure and the definitions of the instance and + * class init functions. + * + * Since: 2.4 + */ +#define G_DEFINE_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, _f_) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() + +/** + * G_DEFINE_INTERFACE: + * @TN: The name of the new type, in Camel case. + * @t_n: The name of the new type, in lowercase, with words separated by '_'. + * @T_P: The #GType of the prerequisite type for the interface, or 0 + * (%G_TYPE_INVALID) for no prerequisite type. + * + * A convenience macro for #GTypeInterface definitions, which declares + * a default vtable initialization function and defines a *_get_type() + * function. + * + * The macro expects the interface initialization function to have the + * name `t_n ## _default_init`, and the interface structure to have the + * name `TN ## Interface`. + * + * The initialization function has signature + * `static void t_n ## _default_init (TypeName##Interface *klass);`, rather than + * the full #GInterfaceInitFunc signature, for brevity and convenience. If you + * need to use an initialization function with an `iface_data` argument, you + * must write the #GTypeInterface definitions manually. + * + * Since: 2.24 + */ +#define G_DEFINE_INTERFACE(TN, t_n, T_P) G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, ;) + +/** + * G_DEFINE_INTERFACE_WITH_CODE: + * @TN: The name of the new type, in Camel case. + * @t_n: The name of the new type, in lowercase, with words separated by '_'. + * @T_P: The #GType of the prerequisite type for the interface, or 0 + * (%G_TYPE_INVALID) for no prerequisite type. + * @_C_: Custom code that gets inserted in the *_get_type() function. + * + * A convenience macro for #GTypeInterface definitions. Similar to + * G_DEFINE_INTERFACE(), but allows you to insert custom code into the + * *_get_type() function, e.g. additional interface implementations + * via G_IMPLEMENT_INTERFACE(), or additional prerequisite types. See + * G_DEFINE_TYPE_EXTENDED() for a similar example using + * G_DEFINE_TYPE_WITH_CODE(). + * + * Since: 2.24 + */ +#define G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TN, t_n, T_P) {_C_;} _G_DEFINE_INTERFACE_EXTENDED_END() + +/** + * G_IMPLEMENT_INTERFACE: + * @TYPE_IFACE: The #GType of the interface to add + * @iface_init: (type GInterfaceInitFunc): The interface init function, of type #GInterfaceInitFunc + * + * A convenience macro to ease interface addition in the `_C_` section + * of G_DEFINE_TYPE_WITH_CODE() or G_DEFINE_ABSTRACT_TYPE_WITH_CODE(). + * See G_DEFINE_TYPE_EXTENDED() for an example. + * + * Note that this macro can only be used together with the G_DEFINE_TYPE_* + * macros, since it depends on variable names from those macros. + * + * Since: 2.4 + */ +#define G_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init) { \ + const GInterfaceInfo g_implement_interface_info = { \ + (GInterfaceInitFunc)(void (*)(void)) iface_init, NULL, NULL \ + }; \ + g_type_add_interface_static (g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \ +} + +/** + * G_ADD_PRIVATE: + * @TypeName: the name of the type in CamelCase + * + * A convenience macro to ease adding private data to instances of a new type + * in the @_C_ section of G_DEFINE_TYPE_WITH_CODE() or + * G_DEFINE_ABSTRACT_TYPE_WITH_CODE(). + * + * For instance: + * + * |[ + * typedef struct _MyObject MyObject; + * typedef struct _MyObjectClass MyObjectClass; + * + * typedef struct { + * gint foo; + * gint bar; + * } MyObjectPrivate; + * + * G_DEFINE_TYPE_WITH_CODE (MyObject, my_object, G_TYPE_OBJECT, + * G_ADD_PRIVATE (MyObject)) + * ]| + * + * Will add MyObjectPrivate as the private data to any instance of the MyObject + * type. + * + * G_DEFINE_TYPE_* macros will automatically create a private function + * based on the arguments to this macro, which can be used to safely + * retrieve the private data from an instance of the type; for instance: + * + * |[ + * gint + * my_object_get_foo (MyObject *obj) + * { + * MyObjectPrivate *priv = my_object_get_instance_private (obj); + * + * g_return_val_if_fail (MY_IS_OBJECT (obj), 0); + * + * return priv->foo; + * } + * + * void + * my_object_set_bar (MyObject *obj, + * gint bar) + * { + * MyObjectPrivate *priv = my_object_get_instance_private (obj); + * + * g_return_if_fail (MY_IS_OBJECT (obj)); + * + * if (priv->bar != bar) + * priv->bar = bar; + * } + * ]| + * + * Note that this macro can only be used together with the G_DEFINE_TYPE_* + * macros, since it depends on variable names from those macros. + * + * Also note that private structs added with these macros must have a struct + * name of the form `TypeNamePrivate`. + * + * It is safe to call the `_get_instance_private` function on %NULL or invalid + * objects since it's only adding an offset to the instance pointer. In that + * case the returned pointer must not be dereferenced. + * + * Since: 2.38 + */ +#define G_ADD_PRIVATE(TypeName) { \ + TypeName##_private_offset = \ + g_type_add_instance_private (g_define_type_id, sizeof (TypeName##Private)); \ +} + +/** + * G_PRIVATE_OFFSET: + * @TypeName: the name of the type in CamelCase + * @field: the name of the field in the private data structure + * + * Evaluates to the offset of the @field inside the instance private data + * structure for @TypeName. + * + * Note that this macro can only be used together with the G_DEFINE_TYPE_* + * and G_ADD_PRIVATE() macros, since it depends on variable names from + * those macros. + * + * Since: 2.38 + */ +#define G_PRIVATE_OFFSET(TypeName, field) \ + (TypeName##_private_offset + (G_STRUCT_OFFSET (TypeName##Private, field))) + +/** + * G_PRIVATE_FIELD_P: + * @TypeName: the name of the type in CamelCase + * @inst: the instance of @TypeName you wish to access + * @field_name: the name of the field in the private data structure + * + * Evaluates to a pointer to the @field_name inside the @inst private data + * structure for @TypeName. + * + * Note that this macro can only be used together with the G_DEFINE_TYPE_* + * and G_ADD_PRIVATE() macros, since it depends on variable names from + * those macros. + * + * Since: 2.38 + */ +#define G_PRIVATE_FIELD_P(TypeName, inst, field_name) \ + G_STRUCT_MEMBER_P (inst, G_PRIVATE_OFFSET (TypeName, field_name)) + +/** + * G_PRIVATE_FIELD: + * @TypeName: the name of the type in CamelCase + * @inst: the instance of @TypeName you wish to access + * @field_type: the type of the field in the private data structure + * @field_name: the name of the field in the private data structure + * + * Evaluates to the @field_name inside the @inst private data + * structure for @TypeName. + * + * Note that this macro can only be used together with the G_DEFINE_TYPE_* + * and G_ADD_PRIVATE() macros, since it depends on variable names from + * those macros. + * + * Since: 2.38 + */ +#define G_PRIVATE_FIELD(TypeName, inst, field_type, field_name) \ + G_STRUCT_MEMBER (field_type, inst, G_PRIVATE_OFFSET (TypeName, field_name)) + +/* we need to have this macro under conditional expansion, as it references + * a function that has been added in 2.38. see bug: + * https://bugzilla.gnome.org/show_bug.cgi?id=703191 + */ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +#define _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \ +static void type_name##_class_intern_init (gpointer klass) \ +{ \ + type_name##_parent_class = g_type_class_peek_parent (klass); \ + if (TypeName##_private_offset != 0) \ + g_type_class_adjust_private_offset (klass, &TypeName##_private_offset); \ + type_name##_class_init ((TypeName##Class*) klass); \ +} + +#else +#define _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \ +static void type_name##_class_intern_init (gpointer klass) \ +{ \ + type_name##_parent_class = g_type_class_peek_parent (klass); \ + type_name##_class_init ((TypeName##Class*) klass); \ +} +#endif /* GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 */ + +/* Added for _G_DEFINE_TYPE_EXTENDED_WITH_PRELUDE */ +#define _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \ +\ +static void type_name##_init (TypeName *self); \ +static void type_name##_class_init (TypeName##Class *klass); \ +static GType type_name##_get_type_once (void); \ +static gpointer type_name##_parent_class = NULL; \ +static gint TypeName##_private_offset; \ +\ +_G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \ +\ +G_GNUC_UNUSED \ +static inline gpointer \ +type_name##_get_instance_private (TypeName *self) \ +{ \ + return (G_STRUCT_MEMBER_P (self, TypeName##_private_offset)); \ +} \ +\ +GType \ +type_name##_get_type (void) \ +{ \ + static gsize static_g_define_type_id = 0; + /* Prelude goes here */ + +/* Added for _G_DEFINE_TYPE_EXTENDED_WITH_PRELUDE */ +#define _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \ + if (g_once_init_enter (&static_g_define_type_id)) \ + { \ + GType g_define_type_id = type_name##_get_type_once (); \ + g_once_init_leave (&static_g_define_type_id, g_define_type_id); \ + } \ + return static_g_define_type_id; \ +} /* closes type_name##_get_type() */ \ +\ +G_GNUC_NO_INLINE \ +static GType \ +type_name##_get_type_once (void) \ +{ \ + GType g_define_type_id = \ + g_type_register_static_simple (TYPE_PARENT, \ + g_intern_static_string (#TypeName), \ + sizeof (TypeName##Class), \ + (GClassInitFunc)(void (*)(void)) type_name##_class_intern_init, \ + sizeof (TypeName), \ + (GInstanceInitFunc)(void (*)(void)) type_name##_init, \ + (GTypeFlags) flags); \ + { /* custom code follows */ +#define _G_DEFINE_TYPE_EXTENDED_END() \ + /* following custom code */ \ + } \ + return g_define_type_id; \ +} /* closes type_name##_get_type_once() */ + +/* This was defined before we had G_DEFINE_TYPE_WITH_CODE_AND_PRELUDE, it's simplest + * to keep it. + */ +#define _G_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) \ + _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \ + _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \ + +#define _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PREREQ) \ +\ +static void type_name##_default_init (TypeName##Interface *klass); \ +\ +GType \ +type_name##_get_type (void) \ +{ \ + static gsize static_g_define_type_id = 0; \ + if (g_once_init_enter (&static_g_define_type_id)) \ + { \ + GType g_define_type_id = \ + g_type_register_static_simple (G_TYPE_INTERFACE, \ + g_intern_static_string (#TypeName), \ + sizeof (TypeName##Interface), \ + (GClassInitFunc)(void (*)(void)) type_name##_default_init, \ + 0, \ + (GInstanceInitFunc)NULL, \ + (GTypeFlags) 0); \ + if (TYPE_PREREQ != G_TYPE_INVALID) \ + g_type_interface_add_prerequisite (g_define_type_id, TYPE_PREREQ); \ + { /* custom code follows */ +#define _G_DEFINE_INTERFACE_EXTENDED_END() \ + /* following custom code */ \ + } \ + g_once_init_leave (&static_g_define_type_id, g_define_type_id); \ + } \ + return static_g_define_type_id; \ +} /* closes type_name##_get_type() */ + +/** + * G_DEFINE_BOXED_TYPE: + * @TypeName: The name of the new type, in Camel case + * @type_name: The name of the new type, in lowercase, with words + * separated by '_' + * @copy_func: the #GBoxedCopyFunc for the new type + * @free_func: the #GBoxedFreeFunc for the new type + * + * A convenience macro for boxed type implementations, which defines a + * type_name_get_type() function registering the boxed type. + * + * Since: 2.26 + */ +#define G_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func) G_DEFINE_BOXED_TYPE_WITH_CODE (TypeName, type_name, copy_func, free_func, {}) +/** + * G_DEFINE_BOXED_TYPE_WITH_CODE: + * @TypeName: The name of the new type, in Camel case + * @type_name: The name of the new type, in lowercase, with words + * separated by '_' + * @copy_func: the #GBoxedCopyFunc for the new type + * @free_func: the #GBoxedFreeFunc for the new type + * @_C_: Custom code that gets inserted in the *_get_type() function + * + * A convenience macro for boxed type implementations. + * Similar to G_DEFINE_BOXED_TYPE(), but allows to insert custom code into the + * type_name_get_type() function, e.g. to register value transformations with + * g_value_register_transform_func(), for instance: + * + * |[ + * G_DEFINE_BOXED_TYPE_WITH_CODE (GdkRectangle, gdk_rectangle, + * gdk_rectangle_copy, + * gdk_rectangle_free, + * register_rectangle_transform_funcs (g_define_type_id)) + * ]| + * + * Similarly to the %G_DEFINE_TYPE family of macros, the #GType of the newly + * defined boxed type is exposed in the `g_define_type_id` variable. + * + * Since: 2.26 + */ +#define G_DEFINE_BOXED_TYPE_WITH_CODE(TypeName, type_name, copy_func, free_func, _C_) _G_DEFINE_BOXED_TYPE_BEGIN (TypeName, type_name, copy_func, free_func) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() + +/* Only use this in non-C++ on GCC >= 2.7, except for Darwin/ppc64. + * See https://bugzilla.gnome.org/show_bug.cgi?id=647145 + */ +#if !defined (__cplusplus) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) && !(defined (__APPLE__) && defined (__ppc64__)) +#define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func, free_func) \ +static GType type_name##_get_type_once (void); \ +\ +GType \ +type_name##_get_type (void) \ +{ \ + static gsize static_g_define_type_id = 0; \ + if (g_once_init_enter (&static_g_define_type_id)) \ + { \ + GType g_define_type_id = type_name##_get_type_once (); \ + g_once_init_leave (&static_g_define_type_id, g_define_type_id); \ + } \ + return static_g_define_type_id; \ +} \ +\ +G_GNUC_NO_INLINE \ +static GType \ +type_name##_get_type_once (void) \ +{ \ + GType (* _g_register_boxed) \ + (const gchar *, \ + union \ + { \ + TypeName * (*do_copy_type) (TypeName *); \ + TypeName * (*do_const_copy_type) (const TypeName *); \ + GBoxedCopyFunc do_copy_boxed; \ + } __attribute__((__transparent_union__)), \ + union \ + { \ + void (* do_free_type) (TypeName *); \ + GBoxedFreeFunc do_free_boxed; \ + } __attribute__((__transparent_union__)) \ + ) = g_boxed_type_register_static; \ + GType g_define_type_id = \ + _g_register_boxed (g_intern_static_string (#TypeName), copy_func, free_func); \ + { /* custom code follows */ +#else +#define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func, free_func) \ +static GType type_name##_get_type_once (void); \ +\ +GType \ +type_name##_get_type (void) \ +{ \ + static gsize static_g_define_type_id = 0; \ + if (g_once_init_enter (&static_g_define_type_id)) \ + { \ + GType g_define_type_id = type_name##_get_type_once (); \ + g_once_init_leave (&static_g_define_type_id, g_define_type_id); \ + } \ + return static_g_define_type_id; \ +} \ +\ +G_GNUC_NO_INLINE \ +static GType \ +type_name##_get_type_once (void) \ +{ \ + GType g_define_type_id = \ + g_boxed_type_register_static (g_intern_static_string (#TypeName), \ + (GBoxedCopyFunc) copy_func, \ + (GBoxedFreeFunc) free_func); \ + { /* custom code follows */ +#endif /* __GNUC__ */ + +/** + * G_DEFINE_POINTER_TYPE: + * @TypeName: The name of the new type, in Camel case + * @type_name: The name of the new type, in lowercase, with words + * separated by '_' + * + * A convenience macro for pointer type implementations, which defines a + * type_name_get_type() function registering the pointer type. + * + * Since: 2.26 + */ +#define G_DEFINE_POINTER_TYPE(TypeName, type_name) G_DEFINE_POINTER_TYPE_WITH_CODE (TypeName, type_name, {}) +/** + * G_DEFINE_POINTER_TYPE_WITH_CODE: + * @TypeName: The name of the new type, in Camel case + * @type_name: The name of the new type, in lowercase, with words + * separated by '_' + * @_C_: Custom code that gets inserted in the *_get_type() function + * + * A convenience macro for pointer type implementations. + * Similar to G_DEFINE_POINTER_TYPE(), but allows to insert + * custom code into the type_name_get_type() function. + * + * Since: 2.26 + */ +#define G_DEFINE_POINTER_TYPE_WITH_CODE(TypeName, type_name, _C_) _G_DEFINE_POINTER_TYPE_BEGIN (TypeName, type_name) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() + +#define _G_DEFINE_POINTER_TYPE_BEGIN(TypeName, type_name) \ +static GType type_name##_get_type_once (void); \ +\ +GType \ +type_name##_get_type (void) \ +{ \ + static gsize static_g_define_type_id = 0; \ + if (g_once_init_enter (&static_g_define_type_id)) \ + { \ + GType g_define_type_id = type_name##_get_type_once (); \ + g_once_init_leave (&static_g_define_type_id, g_define_type_id); \ + } \ + return static_g_define_type_id; \ +} \ +\ +G_GNUC_NO_INLINE \ +static GType \ +type_name##_get_type_once (void) \ +{ \ + GType g_define_type_id = \ + g_pointer_type_register_static (g_intern_static_string (#TypeName)); \ + { /* custom code follows */ + +/* --- protected (for fundamental type implementations) --- */ +GLIB_AVAILABLE_IN_ALL +GTypePlugin* g_type_get_plugin (GType type); +GLIB_AVAILABLE_IN_ALL +GTypePlugin* g_type_interface_get_plugin (GType instance_type, + GType interface_type); +GLIB_AVAILABLE_IN_ALL +GType g_type_fundamental_next (void); +GLIB_AVAILABLE_IN_ALL +GType g_type_fundamental (GType type_id); +GLIB_AVAILABLE_IN_ALL +GTypeInstance* g_type_create_instance (GType type); +GLIB_AVAILABLE_IN_ALL +void g_type_free_instance (GTypeInstance *instance); + +GLIB_AVAILABLE_IN_ALL +void g_type_add_class_cache_func (gpointer cache_data, + GTypeClassCacheFunc cache_func); +GLIB_AVAILABLE_IN_ALL +void g_type_remove_class_cache_func (gpointer cache_data, + GTypeClassCacheFunc cache_func); +GLIB_AVAILABLE_IN_ALL +void g_type_class_unref_uncached (gpointer g_class); + +GLIB_AVAILABLE_IN_ALL +void g_type_add_interface_check (gpointer check_data, + GTypeInterfaceCheckFunc check_func); +GLIB_AVAILABLE_IN_ALL +void g_type_remove_interface_check (gpointer check_data, + GTypeInterfaceCheckFunc check_func); + +GLIB_AVAILABLE_IN_ALL +GTypeValueTable* g_type_value_table_peek (GType type); + + +/*< private >*/ +GLIB_AVAILABLE_IN_ALL +gboolean g_type_check_instance (GTypeInstance *instance) G_GNUC_PURE; +GLIB_AVAILABLE_IN_ALL +GTypeInstance* g_type_check_instance_cast (GTypeInstance *instance, + GType iface_type); +GLIB_AVAILABLE_IN_ALL +gboolean g_type_check_instance_is_a (GTypeInstance *instance, + GType iface_type) G_GNUC_PURE; +GLIB_AVAILABLE_IN_2_42 +gboolean g_type_check_instance_is_fundamentally_a (GTypeInstance *instance, + GType fundamental_type) G_GNUC_PURE; +GLIB_AVAILABLE_IN_ALL +GTypeClass* g_type_check_class_cast (GTypeClass *g_class, + GType is_a_type); +GLIB_AVAILABLE_IN_ALL +gboolean g_type_check_class_is_a (GTypeClass *g_class, + GType is_a_type) G_GNUC_PURE; +GLIB_AVAILABLE_IN_ALL +gboolean g_type_check_is_value_type (GType type) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_type_check_value (const GValue *value) G_GNUC_PURE; +GLIB_AVAILABLE_IN_ALL +gboolean g_type_check_value_holds (const GValue *value, + GType type) G_GNUC_PURE; +GLIB_AVAILABLE_IN_ALL +gboolean g_type_test_flags (GType type, + guint flags) G_GNUC_CONST; + + +/* --- debugging functions --- */ +GLIB_AVAILABLE_IN_ALL +const gchar * g_type_name_from_instance (GTypeInstance *instance); +GLIB_AVAILABLE_IN_ALL +const gchar * g_type_name_from_class (GTypeClass *g_class); + + +/* --- implementation bits --- */ +#ifndef G_DISABLE_CAST_CHECKS +# define _G_TYPE_CIC(ip, gt, ct) \ + ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) +# define _G_TYPE_CCC(cp, gt, ct) \ + ((ct*) g_type_check_class_cast ((GTypeClass*) cp, gt)) +#else /* G_DISABLE_CAST_CHECKS */ +# define _G_TYPE_CIC(ip, gt, ct) ((ct*) ip) +# define _G_TYPE_CCC(cp, gt, ct) ((ct*) cp) +#endif /* G_DISABLE_CAST_CHECKS */ +#define _G_TYPE_CHI(ip) (g_type_check_instance ((GTypeInstance*) ip)) +#define _G_TYPE_CHV(vl) (g_type_check_value ((GValue*) vl)) +#define _G_TYPE_IGC(ip, gt, ct) ((ct*) (((GTypeInstance*) ip)->g_class)) +#define _G_TYPE_IGI(ip, gt, ct) ((ct*) g_type_interface_peek (((GTypeInstance*) ip)->g_class, gt)) +#define _G_TYPE_CIFT(ip, ft) (g_type_check_instance_is_fundamentally_a ((GTypeInstance*) ip, ft)) +#ifdef __GNUC__ +# define _G_TYPE_CIT(ip, gt) (G_GNUC_EXTENSION ({ \ + GTypeInstance *__inst = (GTypeInstance*) ip; GType __t = gt; gboolean __r; \ + if (!__inst) \ + __r = FALSE; \ + else if (__inst->g_class && __inst->g_class->g_type == __t) \ + __r = TRUE; \ + else \ + __r = g_type_check_instance_is_a (__inst, __t); \ + __r; \ +})) +# define _G_TYPE_CCT(cp, gt) (G_GNUC_EXTENSION ({ \ + GTypeClass *__class = (GTypeClass*) cp; GType __t = gt; gboolean __r; \ + if (!__class) \ + __r = FALSE; \ + else if (__class->g_type == __t) \ + __r = TRUE; \ + else \ + __r = g_type_check_class_is_a (__class, __t); \ + __r; \ +})) +# define _G_TYPE_CVH(vl, gt) (G_GNUC_EXTENSION ({ \ + const GValue *__val = (const GValue*) vl; GType __t = gt; gboolean __r; \ + if (!__val) \ + __r = FALSE; \ + else if (__val->g_type == __t) \ + __r = TRUE; \ + else \ + __r = g_type_check_value_holds (__val, __t); \ + __r; \ +})) +#else /* !__GNUC__ */ +# define _G_TYPE_CIT(ip, gt) (g_type_check_instance_is_a ((GTypeInstance*) ip, gt)) +# define _G_TYPE_CCT(cp, gt) (g_type_check_class_is_a ((GTypeClass*) cp, gt)) +# define _G_TYPE_CVH(vl, gt) (g_type_check_value_holds ((const GValue*) vl, gt)) +#endif /* !__GNUC__ */ +/** + * G_TYPE_FLAG_RESERVED_ID_BIT: + * + * A bit in the type number that's supposed to be left untouched. + */ +#define G_TYPE_FLAG_RESERVED_ID_BIT ((GType) (1 << 0)) + +G_END_DECLS + +#endif /* __G_TYPE_H__ */ +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * gvalue.h: generic GValue functions + */ +#ifndef __G_VALUE_H__ +#define __G_VALUE_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/* --- type macros --- */ +/** + * G_TYPE_IS_VALUE: + * @type: A #GType value. + * + * Checks whether the passed in type ID can be used for g_value_init(). + * That is, this macro checks whether this type provides an implementation + * of the #GTypeValueTable functions required for a type to create a #GValue of. + * + * Returns: Whether @type is suitable as a #GValue type. + */ +#define G_TYPE_IS_VALUE(type) (g_type_check_is_value_type (type)) +/** + * G_IS_VALUE: + * @value: A #GValue structure. + * + * Checks if @value is a valid and initialized #GValue structure. + * + * Returns: %TRUE on success. + */ +#define G_IS_VALUE(value) (G_TYPE_CHECK_VALUE (value)) +/** + * G_VALUE_TYPE: + * @value: A #GValue structure. + * + * Get the type identifier of @value. + * + * Returns: the #GType. + */ +#define G_VALUE_TYPE(value) (((GValue*) (value))->g_type) +/** + * G_VALUE_TYPE_NAME: + * @value: A #GValue structure. + * + * Gets the type name of @value. + * + * Returns: the type name. + */ +#define G_VALUE_TYPE_NAME(value) (g_type_name (G_VALUE_TYPE (value))) +/** + * G_VALUE_HOLDS: + * @value: A #GValue structure. + * @type: A #GType value. + * + * Checks if @value holds (or contains) a value of @type. + * This macro will also check for @value != %NULL and issue a + * warning if the check fails. + * + * Returns: %TRUE if @value holds the @type. + */ +#define G_VALUE_HOLDS(value,type) (G_TYPE_CHECK_VALUE_TYPE ((value), (type))) + + +/* --- typedefs & structures --- */ +/** + * GValueTransform: + * @src_value: Source value. + * @dest_value: Target value. + * + * The type of value transformation functions which can be registered with + * g_value_register_transform_func(). + * + * @dest_value will be initialized to the correct destination type. + */ +typedef void (*GValueTransform) (const GValue *src_value, + GValue *dest_value); +/** + * GValue: + * + * An opaque structure used to hold different types of values. + * The data within the structure has protected scope: it is accessible only + * to functions within a #GTypeValueTable structure, or implementations of + * the g_value_*() API. That is, code portions which implement new fundamental + * types. + * #GValue users cannot make any assumptions about how data is stored + * within the 2 element @data union, and the @g_type member should + * only be accessed through the G_VALUE_TYPE() macro. + */ +struct _GValue +{ + /*< private >*/ + GType g_type; + + /* public for GTypeValueTable methods */ + union { + gint v_int; + guint v_uint; + glong v_long; + gulong v_ulong; + gint64 v_int64; + guint64 v_uint64; + gfloat v_float; + gdouble v_double; + gpointer v_pointer; + } data[2]; +}; + + +/* --- prototypes --- */ +GLIB_AVAILABLE_IN_ALL +GValue* g_value_init (GValue *value, + GType g_type); +GLIB_AVAILABLE_IN_ALL +void g_value_copy (const GValue *src_value, + GValue *dest_value); +GLIB_AVAILABLE_IN_ALL +GValue* g_value_reset (GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_unset (GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_instance (GValue *value, + gpointer instance); +GLIB_AVAILABLE_IN_2_42 +void g_value_init_from_instance (GValue *value, + gpointer instance); + + +/* --- private --- */ +GLIB_AVAILABLE_IN_ALL +gboolean g_value_fits_pointer (const GValue *value); +GLIB_AVAILABLE_IN_ALL +gpointer g_value_peek_pointer (const GValue *value); + + +/* --- implementation details --- */ +GLIB_AVAILABLE_IN_ALL +gboolean g_value_type_compatible (GType src_type, + GType dest_type); +GLIB_AVAILABLE_IN_ALL +gboolean g_value_type_transformable (GType src_type, + GType dest_type); +GLIB_AVAILABLE_IN_ALL +gboolean g_value_transform (const GValue *src_value, + GValue *dest_value); +GLIB_AVAILABLE_IN_ALL +void g_value_register_transform_func (GType src_type, + GType dest_type, + GValueTransform transform_func); + +/** + * G_VALUE_NOCOPY_CONTENTS: + * + * If passed to G_VALUE_COLLECT(), allocated data won't be copied + * but used verbatim. This does not affect ref-counted types like + * objects. This does not affect usage of g_value_copy(), the data will + * be copied if it is not ref-counted. + */ +#define G_VALUE_NOCOPY_CONTENTS (1 << 27) + +/** + * G_VALUE_INTERNED_STRING: + * + * For string values, indicates that the string contained is canonical and will + * exist for the duration of the process. See g_value_set_interned_string(). + * + * Since: 2.66 + */ +#define G_VALUE_INTERNED_STRING (1 << 28) GLIB_AVAILABLE_MACRO_IN_2_66 + +/** + * G_VALUE_INIT: + * + * A #GValue must be initialized before it can be used. This macro can + * be used as initializer instead of an explicit `{ 0 }` when declaring + * a variable, but it cannot be assigned to a variable. + * + * |[ + * GValue value = G_VALUE_INIT; + * ]| + * + * Since: 2.30 + */ +#define G_VALUE_INIT { 0, { { 0 } } } + + +G_END_DECLS + +#endif /* __G_VALUE_H__ */ +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * gparam.h: GParamSpec base class implementation + */ +#ifndef __G_PARAM_H__ +#define __G_PARAM_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/* --- standard type macros --- */ +/** + * G_TYPE_IS_PARAM: + * @type: a #GType ID + * + * Checks whether @type "is a" %G_TYPE_PARAM. + */ +#define G_TYPE_IS_PARAM(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_PARAM) +/** + * G_PARAM_SPEC: + * @pspec: a valid #GParamSpec + * + * Casts a derived #GParamSpec object (e.g. of type #GParamSpecInt) into + * a #GParamSpec object. + */ +#define G_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM, GParamSpec)) +/** + * G_IS_PARAM_SPEC: + * @pspec: a #GParamSpec + * + * Checks whether @pspec "is a" valid #GParamSpec structure of type %G_TYPE_PARAM + * or derived. + */ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_42 +#define G_IS_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE ((pspec), G_TYPE_PARAM)) +#else +#define G_IS_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM)) +#endif +/** + * G_PARAM_SPEC_CLASS: + * @pclass: a valid #GParamSpecClass + * + * Casts a derived #GParamSpecClass structure into a #GParamSpecClass structure. + */ +#define G_PARAM_SPEC_CLASS(pclass) (G_TYPE_CHECK_CLASS_CAST ((pclass), G_TYPE_PARAM, GParamSpecClass)) +/** + * G_IS_PARAM_SPEC_CLASS: + * @pclass: a #GParamSpecClass + * + * Checks whether @pclass "is a" valid #GParamSpecClass structure of type + * %G_TYPE_PARAM or derived. + */ +#define G_IS_PARAM_SPEC_CLASS(pclass) (G_TYPE_CHECK_CLASS_TYPE ((pclass), G_TYPE_PARAM)) +/** + * G_PARAM_SPEC_GET_CLASS: + * @pspec: a valid #GParamSpec + * + * Retrieves the #GParamSpecClass of a #GParamSpec. + */ +#define G_PARAM_SPEC_GET_CLASS(pspec) (G_TYPE_INSTANCE_GET_CLASS ((pspec), G_TYPE_PARAM, GParamSpecClass)) + + +/* --- convenience macros --- */ +/** + * G_PARAM_SPEC_TYPE: + * @pspec: a valid #GParamSpec + * + * Retrieves the #GType of this @pspec. + */ +#define G_PARAM_SPEC_TYPE(pspec) (G_TYPE_FROM_INSTANCE (pspec)) +/** + * G_PARAM_SPEC_TYPE_NAME: + * @pspec: a valid #GParamSpec + * + * Retrieves the #GType name of this @pspec. + */ +#define G_PARAM_SPEC_TYPE_NAME(pspec) (g_type_name (G_PARAM_SPEC_TYPE (pspec))) +/** + * G_PARAM_SPEC_VALUE_TYPE: + * @pspec: a valid #GParamSpec + * + * Retrieves the #GType to initialize a #GValue for this parameter. + */ +#define G_PARAM_SPEC_VALUE_TYPE(pspec) (G_PARAM_SPEC (pspec)->value_type) +/** + * G_VALUE_HOLDS_PARAM: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values derived from type %G_TYPE_PARAM. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_PARAM(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_PARAM)) + + +/* --- flags --- */ +/** + * GParamFlags: + * @G_PARAM_READABLE: the parameter is readable + * @G_PARAM_WRITABLE: the parameter is writable + * @G_PARAM_READWRITE: alias for %G_PARAM_READABLE | %G_PARAM_WRITABLE + * @G_PARAM_CONSTRUCT: the parameter will be set upon object construction + * @G_PARAM_CONSTRUCT_ONLY: the parameter can only be set upon object construction + * @G_PARAM_LAX_VALIDATION: upon parameter conversion (see g_param_value_convert()) + * strict validation is not required + * @G_PARAM_STATIC_NAME: the string used as name when constructing the + * parameter is guaranteed to remain valid and + * unmodified for the lifetime of the parameter. + * Since 2.8 + * @G_PARAM_STATIC_NICK: the string used as nick when constructing the + * parameter is guaranteed to remain valid and + * unmmodified for the lifetime of the parameter. + * Since 2.8 + * @G_PARAM_STATIC_BLURB: the string used as blurb when constructing the + * parameter is guaranteed to remain valid and + * unmodified for the lifetime of the parameter. + * Since 2.8 + * @G_PARAM_EXPLICIT_NOTIFY: calls to g_object_set_property() for this + * property will not automatically result in a "notify" signal being + * emitted: the implementation must call g_object_notify() themselves + * in case the property actually changes. Since: 2.42. + * @G_PARAM_PRIVATE: internal + * @G_PARAM_DEPRECATED: the parameter is deprecated and will be removed + * in a future version. A warning will be generated if it is used + * while running with G_ENABLE_DIAGNOSTIC=1. + * Since 2.26 + * + * Through the #GParamFlags flag values, certain aspects of parameters + * can be configured. See also #G_PARAM_STATIC_STRINGS. + */ +typedef enum +{ + G_PARAM_READABLE = 1 << 0, + G_PARAM_WRITABLE = 1 << 1, + G_PARAM_READWRITE = (G_PARAM_READABLE | G_PARAM_WRITABLE), + G_PARAM_CONSTRUCT = 1 << 2, + G_PARAM_CONSTRUCT_ONLY = 1 << 3, + G_PARAM_LAX_VALIDATION = 1 << 4, + G_PARAM_STATIC_NAME = 1 << 5, + G_PARAM_PRIVATE GLIB_DEPRECATED_ENUMERATOR_IN_2_26 = G_PARAM_STATIC_NAME, + G_PARAM_STATIC_NICK = 1 << 6, + G_PARAM_STATIC_BLURB = 1 << 7, + /* User defined flags go here */ + G_PARAM_EXPLICIT_NOTIFY = 1 << 30, + /* Avoid warning with -Wpedantic for gcc6 */ + G_PARAM_DEPRECATED = (gint)(1u << 31) +} GParamFlags; + +/** + * G_PARAM_STATIC_STRINGS: + * + * #GParamFlags value alias for %G_PARAM_STATIC_NAME | %G_PARAM_STATIC_NICK | %G_PARAM_STATIC_BLURB. + * + * Since 2.13.0 + */ +#define G_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB) +/* bits in the range 0xffffff00 are reserved for 3rd party usage */ +/** + * G_PARAM_MASK: + * + * Mask containing the bits of #GParamSpec.flags which are reserved for GLib. + */ +#define G_PARAM_MASK (0x000000ff) +/** + * G_PARAM_USER_SHIFT: + * + * Minimum shift count to be used for user defined flags, to be stored in + * #GParamSpec.flags. The maximum allowed is 10. + */ +#define G_PARAM_USER_SHIFT (8) + +/* --- typedefs & structures --- */ +typedef struct _GParamSpec GParamSpec; +typedef struct _GParamSpecClass GParamSpecClass; +typedef struct _GParameter GParameter GLIB_DEPRECATED_TYPE_IN_2_54; +typedef struct _GParamSpecPool GParamSpecPool; +/** + * GParamSpec: (ref-func g_param_spec_ref_sink) (unref-func g_param_spec_uref) (set-value-func g_value_set_param) (get-value-func g_value_get_param) + * @g_type_instance: private #GTypeInstance portion + * @name: name of this parameter: always an interned string + * @flags: #GParamFlags flags for this parameter + * @value_type: the #GValue type for this parameter + * @owner_type: #GType type that uses (introduces) this parameter + * + * All other fields of the GParamSpec struct are private and + * should not be used directly. + */ +struct _GParamSpec +{ + GTypeInstance g_type_instance; + + const gchar *name; /* interned string */ + GParamFlags flags; + GType value_type; + GType owner_type; /* class or interface using this property */ + + /*< private >*/ + gchar *_nick; + gchar *_blurb; + GData *qdata; + guint ref_count; + guint param_id; /* sort-criteria */ +}; +/** + * GParamSpecClass: + * @g_type_class: the parent class + * @value_type: the #GValue type for this parameter + * @finalize: The instance finalization function (optional), should chain + * up to the finalize method of the parent class. + * @value_set_default: Resets a @value to the default value for this type + * (recommended, the default is g_value_reset()), see + * g_param_value_set_default(). + * @value_validate: Ensures that the contents of @value comply with the + * specifications set out by this type (optional), see + * g_param_value_validate(). + * @values_cmp: Compares @value1 with @value2 according to this type + * (recommended, the default is memcmp()), see g_param_values_cmp(). + * + * The class structure for the GParamSpec type. + * Normally, GParamSpec classes are filled by + * g_param_type_register_static(). + */ +struct _GParamSpecClass +{ + GTypeClass g_type_class; + + GType value_type; + + void (*finalize) (GParamSpec *pspec); + + /* GParam methods */ + void (*value_set_default) (GParamSpec *pspec, + GValue *value); + gboolean (*value_validate) (GParamSpec *pspec, + GValue *value); + gint (*values_cmp) (GParamSpec *pspec, + const GValue *value1, + const GValue *value2); + /*< private >*/ + gpointer dummy[4]; +}; +/** + * GParameter: + * @name: the parameter name + * @value: the parameter value + * + * The GParameter struct is an auxiliary structure used + * to hand parameter name/value pairs to g_object_newv(). + * + * Deprecated: 2.54: This type is not introspectable. + */ +struct _GParameter /* auxiliary structure for _setv() variants */ +{ + const gchar *name; + GValue value; +} GLIB_DEPRECATED_TYPE_IN_2_54; + + +/* --- prototypes --- */ +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_ref (GParamSpec *pspec); +GLIB_AVAILABLE_IN_ALL +void g_param_spec_unref (GParamSpec *pspec); +GLIB_AVAILABLE_IN_ALL +void g_param_spec_sink (GParamSpec *pspec); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_ref_sink (GParamSpec *pspec); +GLIB_AVAILABLE_IN_ALL +gpointer g_param_spec_get_qdata (GParamSpec *pspec, + GQuark quark); +GLIB_AVAILABLE_IN_ALL +void g_param_spec_set_qdata (GParamSpec *pspec, + GQuark quark, + gpointer data); +GLIB_AVAILABLE_IN_ALL +void g_param_spec_set_qdata_full (GParamSpec *pspec, + GQuark quark, + gpointer data, + GDestroyNotify destroy); +GLIB_AVAILABLE_IN_ALL +gpointer g_param_spec_steal_qdata (GParamSpec *pspec, + GQuark quark); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_get_redirect_target (GParamSpec *pspec); + +GLIB_AVAILABLE_IN_ALL +void g_param_value_set_default (GParamSpec *pspec, + GValue *value); +GLIB_AVAILABLE_IN_ALL +gboolean g_param_value_defaults (GParamSpec *pspec, + const GValue *value); +GLIB_AVAILABLE_IN_ALL +gboolean g_param_value_validate (GParamSpec *pspec, + GValue *value); +GLIB_AVAILABLE_IN_ALL +gboolean g_param_value_convert (GParamSpec *pspec, + const GValue *src_value, + GValue *dest_value, + gboolean strict_validation); +GLIB_AVAILABLE_IN_ALL +gint g_param_values_cmp (GParamSpec *pspec, + const GValue *value1, + const GValue *value2); +GLIB_AVAILABLE_IN_ALL +const gchar * g_param_spec_get_name (GParamSpec *pspec); +GLIB_AVAILABLE_IN_ALL +const gchar * g_param_spec_get_nick (GParamSpec *pspec); +GLIB_AVAILABLE_IN_ALL +const gchar * g_param_spec_get_blurb (GParamSpec *pspec); +GLIB_AVAILABLE_IN_ALL +void g_value_set_param (GValue *value, + GParamSpec *param); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_value_get_param (const GValue *value); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_value_dup_param (const GValue *value); + + +GLIB_AVAILABLE_IN_ALL +void g_value_take_param (GValue *value, + GParamSpec *param); +GLIB_DEPRECATED_FOR(g_value_take_param) +void g_value_set_param_take_ownership (GValue *value, + GParamSpec *param); +GLIB_AVAILABLE_IN_2_36 +const GValue * g_param_spec_get_default_value (GParamSpec *pspec); + +GLIB_AVAILABLE_IN_2_46 +GQuark g_param_spec_get_name_quark (GParamSpec *pspec); + +/* --- convenience functions --- */ +typedef struct _GParamSpecTypeInfo GParamSpecTypeInfo; +/** + * GParamSpecTypeInfo: + * @instance_size: Size of the instance (object) structure. + * @n_preallocs: Prior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10, it is ignored, since instances are allocated with the [slice allocator][glib-Memory-Slices] now. + * @instance_init: Location of the instance initialization function (optional). + * @value_type: The #GType of values conforming to this #GParamSpec + * @finalize: The instance finalization function (optional). + * @value_set_default: Resets a @value to the default value for @pspec + * (recommended, the default is g_value_reset()), see + * g_param_value_set_default(). + * @value_validate: Ensures that the contents of @value comply with the + * specifications set out by @pspec (optional), see + * g_param_value_validate(). + * @values_cmp: Compares @value1 with @value2 according to @pspec + * (recommended, the default is memcmp()), see g_param_values_cmp(). + * + * This structure is used to provide the type system with the information + * required to initialize and destruct (finalize) a parameter's class and + * instances thereof. + * The initialized structure is passed to the g_param_type_register_static() + * The type system will perform a deep copy of this structure, so its memory + * does not need to be persistent across invocation of + * g_param_type_register_static(). + */ +struct _GParamSpecTypeInfo +{ + /* type system portion */ + guint16 instance_size; /* obligatory */ + guint16 n_preallocs; /* optional */ + void (*instance_init) (GParamSpec *pspec); /* optional */ + + /* class portion */ + GType value_type; /* obligatory */ + void (*finalize) (GParamSpec *pspec); /* optional */ + void (*value_set_default) (GParamSpec *pspec, /* recommended */ + GValue *value); + gboolean (*value_validate) (GParamSpec *pspec, /* optional */ + GValue *value); + gint (*values_cmp) (GParamSpec *pspec, /* recommended */ + const GValue *value1, + const GValue *value2); +}; +GLIB_AVAILABLE_IN_ALL +GType g_param_type_register_static (const gchar *name, + const GParamSpecTypeInfo *pspec_info); + +GLIB_AVAILABLE_IN_2_66 +gboolean g_param_spec_is_valid_name (const gchar *name); + +/* For registering builting types */ +GType _g_param_type_register_static_constant (const gchar *name, + const GParamSpecTypeInfo *pspec_info, + GType opt_type); + + +/* --- protected --- */ +GLIB_AVAILABLE_IN_ALL +gpointer g_param_spec_internal (GType param_type, + const gchar *name, + const gchar *nick, + const gchar *blurb, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpecPool* g_param_spec_pool_new (gboolean type_prefixing); +GLIB_AVAILABLE_IN_ALL +void g_param_spec_pool_insert (GParamSpecPool *pool, + GParamSpec *pspec, + GType owner_type); +GLIB_AVAILABLE_IN_ALL +void g_param_spec_pool_remove (GParamSpecPool *pool, + GParamSpec *pspec); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_pool_lookup (GParamSpecPool *pool, + const gchar *param_name, + GType owner_type, + gboolean walk_ancestors); +GLIB_AVAILABLE_IN_ALL +GList* g_param_spec_pool_list_owned (GParamSpecPool *pool, + GType owner_type); +GLIB_AVAILABLE_IN_ALL +GParamSpec** g_param_spec_pool_list (GParamSpecPool *pool, + GType owner_type, + guint *n_pspecs_p); + + +/* contracts: + * + * gboolean value_validate (GParamSpec *pspec, + * GValue *value): + * modify value contents in the least destructive way, so + * that it complies with pspec's requirements (i.e. + * according to minimum/maximum ranges etc...). return + * whether modification was necessary. + * + * gint values_cmp (GParamSpec *pspec, + * const GValue *value1, + * const GValue *value2): + * return value1 - value2, i.e. (-1) if value1 < value2, + * (+1) if value1 > value2, and (0) otherwise (equality) + */ + +G_END_DECLS + +#endif /* __G_PARAM_H__ */ +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 2000-2001 Red Hat, Inc. + * Copyright (C) 2005 Imendio AB + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ +#ifndef __G_CLOSURE_H__ +#define __G_CLOSURE_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/* --- defines --- */ +/** + * G_CLOSURE_NEEDS_MARSHAL: + * @closure: a #GClosure + * + * Check if the closure still needs a marshaller. See g_closure_set_marshal(). + * + * Returns: %TRUE if a #GClosureMarshal marshaller has not yet been set on + * @closure. + */ +#define G_CLOSURE_NEEDS_MARSHAL(closure) (((GClosure*) (closure))->marshal == NULL) +/** + * G_CLOSURE_N_NOTIFIERS: + * @cl: a #GClosure + * + * Get the total number of notifiers connected with the closure @cl. + * The count includes the meta marshaller, the finalize and invalidate notifiers + * and the marshal guards. Note that each guard counts as two notifiers. + * See g_closure_set_meta_marshal(), g_closure_add_finalize_notifier(), + * g_closure_add_invalidate_notifier() and g_closure_add_marshal_guards(). + * + * Returns: number of notifiers + */ +#define G_CLOSURE_N_NOTIFIERS(cl) (((cl)->n_guards << 1L) + \ + (cl)->n_fnotifiers + (cl)->n_inotifiers) +/** + * G_CCLOSURE_SWAP_DATA: + * @cclosure: a #GCClosure + * + * Checks whether the user data of the #GCClosure should be passed as the + * first parameter to the callback. See g_cclosure_new_swap(). + * + * Returns: %TRUE if data has to be swapped. + */ +#define G_CCLOSURE_SWAP_DATA(cclosure) (((GClosure*) (cclosure))->derivative_flag) +/** + * G_CALLBACK: + * @f: a function pointer. + * + * Cast a function pointer to a #GCallback. + */ +#define G_CALLBACK(f) ((GCallback) (f)) + + +/* -- typedefs --- */ +typedef struct _GClosure GClosure; +typedef struct _GClosureNotifyData GClosureNotifyData; + +/** + * GCallback: + * + * The type used for callback functions in structure definitions and function + * signatures. This doesn't mean that all callback functions must take no + * parameters and return void. The required signature of a callback function + * is determined by the context in which is used (e.g. the signal to which it + * is connected). Use G_CALLBACK() to cast the callback function to a #GCallback. + */ +typedef void (*GCallback) (void); +/** + * GClosureNotify: + * @data: data specified when registering the notification callback + * @closure: the #GClosure on which the notification is emitted + * + * The type used for the various notification callbacks which can be registered + * on closures. + */ +typedef void (*GClosureNotify) (gpointer data, + GClosure *closure); +/** + * GClosureMarshal: + * @closure: the #GClosure to which the marshaller belongs + * @return_value: (nullable): a #GValue to store the return + * value. May be %NULL if the callback of @closure doesn't return a + * value. + * @n_param_values: the length of the @param_values array + * @param_values: (array length=n_param_values): an array of + * #GValues holding the arguments on which to invoke the + * callback of @closure + * @invocation_hint: (nullable): the invocation hint given as the + * last argument to g_closure_invoke() + * @marshal_data: (nullable): additional data specified when + * registering the marshaller, see g_closure_set_marshal() and + * g_closure_set_meta_marshal() + * + * The type used for marshaller functions. + */ +typedef void (*GClosureMarshal) (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); + +/** + * GVaClosureMarshal: + * @closure: the #GClosure to which the marshaller belongs + * @return_value: (nullable): a #GValue to store the return + * value. May be %NULL if the callback of @closure doesn't return a + * value. + * @instance: (type GObject.TypeInstance): the instance on which the closure is + * invoked. + * @args: va_list of arguments to be passed to the closure. + * @marshal_data: (nullable): additional data specified when + * registering the marshaller, see g_closure_set_marshal() and + * g_closure_set_meta_marshal() + * @n_params: the length of the @param_types array + * @param_types: (array length=n_params): the #GType of each argument from + * @args. + * + * This is the signature of va_list marshaller functions, an optional + * marshaller that can be used in some situations to avoid + * marshalling the signal argument into GValues. + */ +typedef void (* GVaClosureMarshal) (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/** + * GCClosure: + * @closure: the #GClosure + * @callback: the callback function + * + * A #GCClosure is a specialization of #GClosure for C function callbacks. + */ +typedef struct _GCClosure GCClosure; + + +/* --- structures --- */ +struct _GClosureNotifyData +{ + gpointer data; + GClosureNotify notify; +}; +/** + * GClosure: + * @in_marshal: Indicates whether the closure is currently being invoked with + * g_closure_invoke() + * @is_invalid: Indicates whether the closure has been invalidated by + * g_closure_invalidate() + * + * A #GClosure represents a callback supplied by the programmer. + */ +struct _GClosure +{ + /*< private >*/ + guint ref_count : 15; /* (atomic) */ + /* meta_marshal is not used anymore but must be zero for historical reasons + as it was exposed in the G_CLOSURE_N_NOTIFIERS macro */ + guint meta_marshal_nouse : 1; /* (atomic) */ + guint n_guards : 1; /* (atomic) */ + guint n_fnotifiers : 2; /* finalization notifiers (atomic) */ + guint n_inotifiers : 8; /* invalidation notifiers (atomic) */ + guint in_inotify : 1; /* (atomic) */ + guint floating : 1; /* (atomic) */ + /*< protected >*/ + guint derivative_flag : 1; /* (atomic) */ + /*< public >*/ + guint in_marshal : 1; /* (atomic) */ + guint is_invalid : 1; /* (atomic) */ + + /*< private >*/ void (*marshal) (GClosure *closure, + GValue /*out*/ *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); + /*< protected >*/ gpointer data; + + /*< private >*/ GClosureNotifyData *notifiers; + + /* invariants/constraints: + * - ->marshal and ->data are _invalid_ as soon as ->is_invalid==TRUE + * - invocation of all inotifiers occurs prior to fnotifiers + * - order of inotifiers is random + * inotifiers may _not_ free/invalidate parameter values (e.g. ->data) + * - order of fnotifiers is random + * - each notifier may only be removed before or during its invocation + * - reference counting may only happen prior to fnotify invocation + * (in that sense, fnotifiers are really finalization handlers) + */ +}; +/* closure for C function calls, callback() is the user function + */ +struct _GCClosure +{ + GClosure closure; + gpointer callback; +}; + + +/* --- prototypes --- */ +GLIB_AVAILABLE_IN_ALL +GClosure* g_cclosure_new (GCallback callback_func, + gpointer user_data, + GClosureNotify destroy_data); +GLIB_AVAILABLE_IN_ALL +GClosure* g_cclosure_new_swap (GCallback callback_func, + gpointer user_data, + GClosureNotify destroy_data); +GLIB_AVAILABLE_IN_ALL +GClosure* g_signal_type_cclosure_new (GType itype, + guint struct_offset); + + +/* --- prototypes --- */ +GLIB_AVAILABLE_IN_ALL +GClosure* g_closure_ref (GClosure *closure); +GLIB_AVAILABLE_IN_ALL +void g_closure_sink (GClosure *closure); +GLIB_AVAILABLE_IN_ALL +void g_closure_unref (GClosure *closure); +/* intimidating */ +GLIB_AVAILABLE_IN_ALL +GClosure* g_closure_new_simple (guint sizeof_closure, + gpointer data); +GLIB_AVAILABLE_IN_ALL +void g_closure_add_finalize_notifier (GClosure *closure, + gpointer notify_data, + GClosureNotify notify_func); +GLIB_AVAILABLE_IN_ALL +void g_closure_remove_finalize_notifier (GClosure *closure, + gpointer notify_data, + GClosureNotify notify_func); +GLIB_AVAILABLE_IN_ALL +void g_closure_add_invalidate_notifier (GClosure *closure, + gpointer notify_data, + GClosureNotify notify_func); +GLIB_AVAILABLE_IN_ALL +void g_closure_remove_invalidate_notifier (GClosure *closure, + gpointer notify_data, + GClosureNotify notify_func); +GLIB_AVAILABLE_IN_ALL +void g_closure_add_marshal_guards (GClosure *closure, + gpointer pre_marshal_data, + GClosureNotify pre_marshal_notify, + gpointer post_marshal_data, + GClosureNotify post_marshal_notify); +GLIB_AVAILABLE_IN_ALL +void g_closure_set_marshal (GClosure *closure, + GClosureMarshal marshal); +GLIB_AVAILABLE_IN_ALL +void g_closure_set_meta_marshal (GClosure *closure, + gpointer marshal_data, + GClosureMarshal meta_marshal); +GLIB_AVAILABLE_IN_ALL +void g_closure_invalidate (GClosure *closure); +GLIB_AVAILABLE_IN_ALL +void g_closure_invoke (GClosure *closure, + GValue /*out*/ *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint); + +/* FIXME: + OK: data_object::destroy -> closure_invalidate(); + MIS: closure_invalidate() -> disconnect(closure); + MIS: disconnect(closure) -> (unlink) closure_unref(); + OK: closure_finalize() -> g_free (data_string); + + random remarks: + - need marshaller repo with decent aliasing to base types + - provide marshaller collection, virtually covering anything out there +*/ + +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_generic (GClosure *closure, + GValue *return_gvalue, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); + +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_generic_va (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args_list, + gpointer marshal_data, + int n_params, + GType *param_types); + + +G_END_DECLS + +#endif /* __G_CLOSURE_H__ */ +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 2000-2001 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ +#ifndef __G_SIGNAL_H__ +#define __G_SIGNAL_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + +/* GObject - GLib Type, Object, Parameter and Signal Library + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_MARSHAL_H__ +#define __G_MARSHAL_H__ + +G_BEGIN_DECLS + +/* VOID:VOID */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__VOID (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__VOIDv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:BOOLEAN */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__BOOLEAN (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__BOOLEANv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:CHAR */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__CHAR (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__CHARv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:UCHAR */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__UCHAR (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__UCHARv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:INT */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__INT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__INTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:UINT */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__UINT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__UINTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:LONG */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__LONG (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__LONGv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:ULONG */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__ULONG (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__ULONGv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:ENUM */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__ENUM (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__ENUMv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:FLAGS */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__FLAGS (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__FLAGSv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:FLOAT */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__FLOAT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__FLOATv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:DOUBLE */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__DOUBLE (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__DOUBLEv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:STRING */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__STRING (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__STRINGv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:PARAM */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__PARAM (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__PARAMv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:BOXED */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__BOXED (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__BOXEDv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:POINTER */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__POINTERv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:OBJECT */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__OBJECT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__OBJECTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:VARIANT */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__VARIANT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__VARIANTv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* VOID:UINT,POINTER */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__UINT_POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_VOID__UINT_POINTERv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* BOOL:FLAGS */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_BOOLEAN__FLAGS (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_BOOLEAN__FLAGSv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/** + * g_cclosure_marshal_BOOL__FLAGS: + * @closure: A #GClosure. + * @return_value: A #GValue to store the return value. May be %NULL + * if the callback of closure doesn't return a value. + * @n_param_values: The length of the @param_values array. + * @param_values: An array of #GValues holding the arguments + * on which to invoke the callback of closure. + * @invocation_hint: The invocation hint given as the last argument to + * g_closure_invoke(). + * @marshal_data: Additional data specified when registering the + * marshaller, see g_closure_set_marshal() and + * g_closure_set_meta_marshal() + * + * An old alias for g_cclosure_marshal_BOOLEAN__FLAGS(). + */ +#define g_cclosure_marshal_BOOL__FLAGS g_cclosure_marshal_BOOLEAN__FLAGS + +/* STRING:OBJECT,POINTER */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_STRING__OBJECT_POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_STRING__OBJECT_POINTERv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/* BOOL:BOXED,BOXED */ +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_BOOLEAN__BOXED_BOXED (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); +GLIB_AVAILABLE_IN_ALL +void g_cclosure_marshal_BOOLEAN__BOXED_BOXEDv (GClosure *closure, + GValue *return_value, + gpointer instance, + va_list args, + gpointer marshal_data, + int n_params, + GType *param_types); + +/** + * g_cclosure_marshal_BOOL__BOXED_BOXED: + * @closure: A #GClosure. + * @return_value: A #GValue to store the return value. May be %NULL + * if the callback of closure doesn't return a value. + * @n_param_values: The length of the @param_values array. + * @param_values: An array of #GValues holding the arguments + * on which to invoke the callback of closure. + * @invocation_hint: The invocation hint given as the last argument to + * g_closure_invoke(). + * @marshal_data: Additional data specified when registering the + * marshaller, see g_closure_set_marshal() and + * g_closure_set_meta_marshal() + * + * An old alias for g_cclosure_marshal_BOOLEAN__BOXED_BOXED(). + */ +#define g_cclosure_marshal_BOOL__BOXED_BOXED g_cclosure_marshal_BOOLEAN__BOXED_BOXED + +G_END_DECLS + +#endif /* __G_MARSHAL_H__ */ + +G_BEGIN_DECLS + +/* --- typedefs --- */ +typedef struct _GSignalQuery GSignalQuery; +typedef struct _GSignalInvocationHint GSignalInvocationHint; +/** + * GSignalCMarshaller: + * + * This is the signature of marshaller functions, required to marshall + * arrays of parameter values to signal emissions into C language callback + * invocations. It is merely an alias to #GClosureMarshal since the #GClosure + * mechanism takes over responsibility of actual function invocation for the + * signal system. + */ +typedef GClosureMarshal GSignalCMarshaller; +/** + * GSignalCVaMarshaller: + * + * This is the signature of va_list marshaller functions, an optional + * marshaller that can be used in some situations to avoid + * marshalling the signal argument into GValues. + */ +typedef GVaClosureMarshal GSignalCVaMarshaller; +/** + * GSignalEmissionHook: + * @ihint: Signal invocation hint, see #GSignalInvocationHint. + * @n_param_values: the number of parameters to the function, including + * the instance on which the signal was emitted. + * @param_values: (array length=n_param_values): the instance on which + * the signal was emitted, followed by the parameters of the emission. + * @data: user data associated with the hook. + * + * A simple function pointer to get invoked when the signal is emitted. This + * allows you to tie a hook to the signal type, so that it will trap all + * emissions of that signal, from any object. + * + * You may not attach these to signals created with the #G_SIGNAL_NO_HOOKS flag. + * + * Returns: whether it wants to stay connected. If it returns %FALSE, the signal + * hook is disconnected (and destroyed). + */ +typedef gboolean (*GSignalEmissionHook) (GSignalInvocationHint *ihint, + guint n_param_values, + const GValue *param_values, + gpointer data); +/** + * GSignalAccumulator: + * @ihint: Signal invocation hint, see #GSignalInvocationHint. + * @return_accu: Accumulator to collect callback return values in, this + * is the return value of the current signal emission. + * @handler_return: A #GValue holding the return value of the signal handler. + * @data: Callback data that was specified when creating the signal. + * + * The signal accumulator is a special callback function that can be used + * to collect return values of the various callbacks that are called + * during a signal emission. The signal accumulator is specified at signal + * creation time, if it is left %NULL, no accumulation of callback return + * values is performed. The return value of signal emissions is then the + * value returned by the last callback. + * + * Returns: The accumulator function returns whether the signal emission + * should be aborted. Returning %FALSE means to abort the + * current emission and %TRUE is returned for continuation. + */ +typedef gboolean (*GSignalAccumulator) (GSignalInvocationHint *ihint, + GValue *return_accu, + const GValue *handler_return, + gpointer data); + + +/* --- run, match and connect types --- */ +/** + * GSignalFlags: + * @G_SIGNAL_RUN_FIRST: Invoke the object method handler in the first emission stage. + * @G_SIGNAL_RUN_LAST: Invoke the object method handler in the third emission stage. + * @G_SIGNAL_RUN_CLEANUP: Invoke the object method handler in the last emission stage. + * @G_SIGNAL_NO_RECURSE: Signals being emitted for an object while currently being in + * emission for this very object will not be emitted recursively, + * but instead cause the first emission to be restarted. + * @G_SIGNAL_DETAILED: This signal supports "::detail" appendices to the signal name + * upon handler connections and emissions. + * @G_SIGNAL_ACTION: Action signals are signals that may freely be emitted on alive + * objects from user code via g_signal_emit() and friends, without + * the need of being embedded into extra code that performs pre or + * post emission adjustments on the object. They can also be thought + * of as object methods which can be called generically by + * third-party code. + * @G_SIGNAL_NO_HOOKS: No emissions hooks are supported for this signal. + * @G_SIGNAL_MUST_COLLECT: Varargs signal emission will always collect the + * arguments, even if there are no signal handlers connected. Since 2.30. + * @G_SIGNAL_DEPRECATED: The signal is deprecated and will be removed + * in a future version. A warning will be generated if it is connected while + * running with G_ENABLE_DIAGNOSTIC=1. Since 2.32. + * @G_SIGNAL_ACCUMULATOR_FIRST_RUN: Only used in #GSignalAccumulator accumulator + * functions for the #GSignalInvocationHint::run_type field to mark the first + * call to the accumulator function for a signal emission. Since 2.68. + * + * The signal flags are used to specify a signal's behaviour, the overall + * signal description outlines how especially the RUN flags control the + * stages of a signal emission. + */ +typedef enum +{ + G_SIGNAL_RUN_FIRST = 1 << 0, + G_SIGNAL_RUN_LAST = 1 << 1, + G_SIGNAL_RUN_CLEANUP = 1 << 2, + G_SIGNAL_NO_RECURSE = 1 << 3, + G_SIGNAL_DETAILED = 1 << 4, + G_SIGNAL_ACTION = 1 << 5, + G_SIGNAL_NO_HOOKS = 1 << 6, + G_SIGNAL_MUST_COLLECT = 1 << 7, + G_SIGNAL_DEPRECATED = 1 << 8, + /* normal signal flags until 1 << 16 */ + G_SIGNAL_ACCUMULATOR_FIRST_RUN = 1 << 17, +} GSignalFlags; +/** + * G_SIGNAL_FLAGS_MASK: + * + * A mask for all #GSignalFlags bits. + */ +#define G_SIGNAL_FLAGS_MASK 0x1ff +/** + * GConnectFlags: + * @G_CONNECT_AFTER: whether the handler should be called before or after the + * default handler of the signal. + * @G_CONNECT_SWAPPED: whether the instance and data should be swapped when + * calling the handler; see g_signal_connect_swapped() for an example. + * + * The connection flags are used to specify the behaviour of a signal's + * connection. + */ +typedef enum +{ + G_CONNECT_AFTER = 1 << 0, + G_CONNECT_SWAPPED = 1 << 1 +} GConnectFlags; +/** + * GSignalMatchType: + * @G_SIGNAL_MATCH_ID: The signal id must be equal. + * @G_SIGNAL_MATCH_DETAIL: The signal detail must be equal. + * @G_SIGNAL_MATCH_CLOSURE: The closure must be the same. + * @G_SIGNAL_MATCH_FUNC: The C closure callback must be the same. + * @G_SIGNAL_MATCH_DATA: The closure data must be the same. + * @G_SIGNAL_MATCH_UNBLOCKED: Only unblocked signals may be matched. + * + * The match types specify what g_signal_handlers_block_matched(), + * g_signal_handlers_unblock_matched() and g_signal_handlers_disconnect_matched() + * match signals by. + */ +typedef enum +{ + G_SIGNAL_MATCH_ID = 1 << 0, + G_SIGNAL_MATCH_DETAIL = 1 << 1, + G_SIGNAL_MATCH_CLOSURE = 1 << 2, + G_SIGNAL_MATCH_FUNC = 1 << 3, + G_SIGNAL_MATCH_DATA = 1 << 4, + G_SIGNAL_MATCH_UNBLOCKED = 1 << 5 +} GSignalMatchType; +/** + * G_SIGNAL_MATCH_MASK: + * + * A mask for all #GSignalMatchType bits. + */ +#define G_SIGNAL_MATCH_MASK 0x3f +/** + * G_SIGNAL_TYPE_STATIC_SCOPE: + * + * This macro flags signal argument types for which the signal system may + * assume that instances thereof remain persistent across all signal emissions + * they are used in. This is only useful for non ref-counted, value-copy types. + * + * To flag a signal argument in this way, add `| G_SIGNAL_TYPE_STATIC_SCOPE` + * to the corresponding argument of g_signal_new(). + * |[ + * g_signal_new ("size_request", + * G_TYPE_FROM_CLASS (gobject_class), + * G_SIGNAL_RUN_FIRST, + * G_STRUCT_OFFSET (GtkWidgetClass, size_request), + * NULL, NULL, + * _gtk_marshal_VOID__BOXED, + * G_TYPE_NONE, 1, + * GTK_TYPE_REQUISITION | G_SIGNAL_TYPE_STATIC_SCOPE); + * ]| + */ +#define G_SIGNAL_TYPE_STATIC_SCOPE (G_TYPE_FLAG_RESERVED_ID_BIT) + + +/* --- signal information --- */ +/** + * GSignalInvocationHint: + * @signal_id: The signal id of the signal invoking the callback + * @detail: The detail passed on for this emission + * @run_type: The stage the signal emission is currently in, this + * field will contain one of %G_SIGNAL_RUN_FIRST, + * %G_SIGNAL_RUN_LAST or %G_SIGNAL_RUN_CLEANUP and %G_SIGNAL_ACCUMULATOR_FIRST_RUN. + * %G_SIGNAL_ACCUMULATOR_FIRST_RUN is only set for the first run of the accumulator + * function for a signal emission. + * + * The #GSignalInvocationHint structure is used to pass on additional information + * to callbacks during a signal emission. + */ +struct _GSignalInvocationHint +{ + guint signal_id; + GQuark detail; + GSignalFlags run_type; +}; +/** + * GSignalQuery: + * @signal_id: The signal id of the signal being queried, or 0 if the + * signal to be queried was unknown. + * @signal_name: The signal name. + * @itype: The interface/instance type that this signal can be emitted for. + * @signal_flags: The signal flags as passed in to g_signal_new(). + * @return_type: The return type for user callbacks. + * @n_params: The number of parameters that user callbacks take. + * @param_types: (array length=n_params): The individual parameter types for + * user callbacks, note that the effective callback signature is: + * |[ + * @return_type callback (#gpointer data1, + * [param_types param_names,] + * gpointer data2); + * ]| + * + * A structure holding in-depth information for a specific signal. It is + * filled in by the g_signal_query() function. + */ +struct _GSignalQuery +{ + guint signal_id; + const gchar *signal_name; + GType itype; + GSignalFlags signal_flags; + GType return_type; /* mangled with G_SIGNAL_TYPE_STATIC_SCOPE flag */ + guint n_params; + const GType *param_types; /* mangled with G_SIGNAL_TYPE_STATIC_SCOPE flag */ +}; + + +/* --- signals --- */ +GLIB_AVAILABLE_IN_ALL +guint g_signal_newv (const gchar *signal_name, + GType itype, + GSignalFlags signal_flags, + GClosure *class_closure, + GSignalAccumulator accumulator, + gpointer accu_data, + GSignalCMarshaller c_marshaller, + GType return_type, + guint n_params, + GType *param_types); +GLIB_AVAILABLE_IN_ALL +guint g_signal_new_valist (const gchar *signal_name, + GType itype, + GSignalFlags signal_flags, + GClosure *class_closure, + GSignalAccumulator accumulator, + gpointer accu_data, + GSignalCMarshaller c_marshaller, + GType return_type, + guint n_params, + va_list args); +GLIB_AVAILABLE_IN_ALL +guint g_signal_new (const gchar *signal_name, + GType itype, + GSignalFlags signal_flags, + guint class_offset, + GSignalAccumulator accumulator, + gpointer accu_data, + GSignalCMarshaller c_marshaller, + GType return_type, + guint n_params, + ...); +GLIB_AVAILABLE_IN_ALL +guint g_signal_new_class_handler (const gchar *signal_name, + GType itype, + GSignalFlags signal_flags, + GCallback class_handler, + GSignalAccumulator accumulator, + gpointer accu_data, + GSignalCMarshaller c_marshaller, + GType return_type, + guint n_params, + ...); +GLIB_AVAILABLE_IN_ALL +void g_signal_set_va_marshaller (guint signal_id, + GType instance_type, + GSignalCVaMarshaller va_marshaller); + +GLIB_AVAILABLE_IN_ALL +void g_signal_emitv (const GValue *instance_and_params, + guint signal_id, + GQuark detail, + GValue *return_value); +GLIB_AVAILABLE_IN_ALL +void g_signal_emit_valist (gpointer instance, + guint signal_id, + GQuark detail, + va_list var_args); +GLIB_AVAILABLE_IN_ALL +void g_signal_emit (gpointer instance, + guint signal_id, + GQuark detail, + ...); +GLIB_AVAILABLE_IN_ALL +void g_signal_emit_by_name (gpointer instance, + const gchar *detailed_signal, + ...); +GLIB_AVAILABLE_IN_ALL +guint g_signal_lookup (const gchar *name, + GType itype); +GLIB_AVAILABLE_IN_ALL +const gchar * g_signal_name (guint signal_id); +GLIB_AVAILABLE_IN_ALL +void g_signal_query (guint signal_id, + GSignalQuery *query); +GLIB_AVAILABLE_IN_ALL +guint* g_signal_list_ids (GType itype, + guint *n_ids); +GLIB_AVAILABLE_IN_2_66 +gboolean g_signal_is_valid_name (const gchar *name); +GLIB_AVAILABLE_IN_ALL +gboolean g_signal_parse_name (const gchar *detailed_signal, + GType itype, + guint *signal_id_p, + GQuark *detail_p, + gboolean force_detail_quark); +GLIB_AVAILABLE_IN_ALL +GSignalInvocationHint* g_signal_get_invocation_hint (gpointer instance); + + +/* --- signal emissions --- */ +GLIB_AVAILABLE_IN_ALL +void g_signal_stop_emission (gpointer instance, + guint signal_id, + GQuark detail); +GLIB_AVAILABLE_IN_ALL +void g_signal_stop_emission_by_name (gpointer instance, + const gchar *detailed_signal); +GLIB_AVAILABLE_IN_ALL +gulong g_signal_add_emission_hook (guint signal_id, + GQuark detail, + GSignalEmissionHook hook_func, + gpointer hook_data, + GDestroyNotify data_destroy); +GLIB_AVAILABLE_IN_ALL +void g_signal_remove_emission_hook (guint signal_id, + gulong hook_id); + + +/* --- signal handlers --- */ +GLIB_AVAILABLE_IN_ALL +gboolean g_signal_has_handler_pending (gpointer instance, + guint signal_id, + GQuark detail, + gboolean may_be_blocked); +GLIB_AVAILABLE_IN_ALL +gulong g_signal_connect_closure_by_id (gpointer instance, + guint signal_id, + GQuark detail, + GClosure *closure, + gboolean after); +GLIB_AVAILABLE_IN_ALL +gulong g_signal_connect_closure (gpointer instance, + const gchar *detailed_signal, + GClosure *closure, + gboolean after); +GLIB_AVAILABLE_IN_ALL +gulong g_signal_connect_data (gpointer instance, + const gchar *detailed_signal, + GCallback c_handler, + gpointer data, + GClosureNotify destroy_data, + GConnectFlags connect_flags); +GLIB_AVAILABLE_IN_ALL +void g_signal_handler_block (gpointer instance, + gulong handler_id); +GLIB_AVAILABLE_IN_ALL +void g_signal_handler_unblock (gpointer instance, + gulong handler_id); +GLIB_AVAILABLE_IN_ALL +void g_signal_handler_disconnect (gpointer instance, + gulong handler_id); +GLIB_AVAILABLE_IN_ALL +gboolean g_signal_handler_is_connected (gpointer instance, + gulong handler_id); +GLIB_AVAILABLE_IN_ALL +gulong g_signal_handler_find (gpointer instance, + GSignalMatchType mask, + guint signal_id, + GQuark detail, + GClosure *closure, + gpointer func, + gpointer data); +GLIB_AVAILABLE_IN_ALL +guint g_signal_handlers_block_matched (gpointer instance, + GSignalMatchType mask, + guint signal_id, + GQuark detail, + GClosure *closure, + gpointer func, + gpointer data); +GLIB_AVAILABLE_IN_ALL +guint g_signal_handlers_unblock_matched (gpointer instance, + GSignalMatchType mask, + guint signal_id, + GQuark detail, + GClosure *closure, + gpointer func, + gpointer data); +GLIB_AVAILABLE_IN_ALL +guint g_signal_handlers_disconnect_matched (gpointer instance, + GSignalMatchType mask, + guint signal_id, + GQuark detail, + GClosure *closure, + gpointer func, + gpointer data); + +GLIB_AVAILABLE_IN_2_62 +void g_clear_signal_handler (gulong *handler_id_ptr, + gpointer instance); + +#undef g_clear_signal_handler +#define g_clear_signal_handler(handler_id_ptr, instance) \ + G_STMT_START { \ + G_STATIC_ASSERT (sizeof *(handler_id_ptr) == sizeof (gulong)); \ + gulong _handler_id = *(handler_id_ptr); \ + \ + if (_handler_id > 0) \ + { \ + g_signal_handler_disconnect ((instance), _handler_id); \ + *(handler_id_ptr) = 0; \ + } \ + } G_STMT_END \ + GLIB_AVAILABLE_MACRO_IN_2_62 + +/* --- overriding and chaining --- */ +GLIB_AVAILABLE_IN_ALL +void g_signal_override_class_closure (guint signal_id, + GType instance_type, + GClosure *class_closure); +GLIB_AVAILABLE_IN_ALL +void g_signal_override_class_handler (const gchar *signal_name, + GType instance_type, + GCallback class_handler); +GLIB_AVAILABLE_IN_ALL +void g_signal_chain_from_overridden (const GValue *instance_and_params, + GValue *return_value); +GLIB_AVAILABLE_IN_ALL +void g_signal_chain_from_overridden_handler (gpointer instance, + ...); + + +/* --- convenience --- */ +/** + * g_signal_connect: + * @instance: the instance to connect to. + * @detailed_signal: a string of the form "signal-name::detail". + * @c_handler: the #GCallback to connect. + * @data: data to pass to @c_handler calls. + * + * Connects a #GCallback function to a signal for a particular object. + * + * The handler will be called before the default handler of the signal. + * + * See [memory management of signal handlers][signal-memory-management] for + * details on how to handle the return value and memory management of @data. + * + * Returns: the handler ID, of type #gulong (always greater than 0 for successful connections) + */ +#define g_signal_connect(instance, detailed_signal, c_handler, data) \ + g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, (GConnectFlags) 0) +/** + * g_signal_connect_after: + * @instance: the instance to connect to. + * @detailed_signal: a string of the form "signal-name::detail". + * @c_handler: the #GCallback to connect. + * @data: data to pass to @c_handler calls. + * + * Connects a #GCallback function to a signal for a particular object. + * + * The handler will be called after the default handler of the signal. + * + * Returns: the handler ID, of type #gulong (always greater than 0 for successful connections) + */ +#define g_signal_connect_after(instance, detailed_signal, c_handler, data) \ + g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, G_CONNECT_AFTER) +/** + * g_signal_connect_swapped: + * @instance: the instance to connect to. + * @detailed_signal: a string of the form "signal-name::detail". + * @c_handler: the #GCallback to connect. + * @data: data to pass to @c_handler calls. + * + * Connects a #GCallback function to a signal for a particular object. + * + * The instance on which the signal is emitted and @data will be swapped when + * calling the handler. This is useful when calling pre-existing functions to + * operate purely on the @data, rather than the @instance: swapping the + * parameters avoids the need to write a wrapper function. + * + * For example, this allows the shorter code: + * |[ + * g_signal_connect_swapped (button, "clicked", + * (GCallback) gtk_widget_hide, other_widget); + * ]| + * + * Rather than the cumbersome: + * |[ + * static void + * button_clicked_cb (GtkButton *button, GtkWidget *other_widget) + * { + * gtk_widget_hide (other_widget); + * } + * + * ... + * + * g_signal_connect (button, "clicked", + * (GCallback) button_clicked_cb, other_widget); + * ]| + * + * Returns: the handler ID, of type #gulong (always greater than 0 for successful connections) + */ +#define g_signal_connect_swapped(instance, detailed_signal, c_handler, data) \ + g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, G_CONNECT_SWAPPED) +/** + * g_signal_handlers_disconnect_by_func: + * @instance: The instance to remove handlers from. + * @func: The C closure callback of the handlers (useless for non-C closures). + * @data: The closure data of the handlers' closures. + * + * Disconnects all handlers on an instance that match @func and @data. + * + * Returns: The number of handlers that matched. + */ +#define g_signal_handlers_disconnect_by_func(instance, func, data) \ + g_signal_handlers_disconnect_matched ((instance), \ + (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), \ + 0, 0, NULL, (func), (data)) + +/** + * g_signal_handlers_disconnect_by_data: + * @instance: The instance to remove handlers from + * @data: the closure data of the handlers' closures + * + * Disconnects all handlers on an instance that match @data. + * + * Returns: The number of handlers that matched. + * + * Since: 2.32 + */ +#define g_signal_handlers_disconnect_by_data(instance, data) \ + g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, (data)) + +/** + * g_signal_handlers_block_by_func: + * @instance: The instance to block handlers from. + * @func: The C closure callback of the handlers (useless for non-C closures). + * @data: The closure data of the handlers' closures. + * + * Blocks all handlers on an instance that match @func and @data. + * + * Returns: The number of handlers that matched. + */ +#define g_signal_handlers_block_by_func(instance, func, data) \ + g_signal_handlers_block_matched ((instance), \ + (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), \ + 0, 0, NULL, (func), (data)) +/** + * g_signal_handlers_unblock_by_func: + * @instance: The instance to unblock handlers from. + * @func: The C closure callback of the handlers (useless for non-C closures). + * @data: The closure data of the handlers' closures. + * + * Unblocks all handlers on an instance that match @func and @data. + * + * Returns: The number of handlers that matched. + */ +#define g_signal_handlers_unblock_by_func(instance, func, data) \ + g_signal_handlers_unblock_matched ((instance), \ + (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), \ + 0, 0, NULL, (func), (data)) + + +GLIB_AVAILABLE_IN_ALL +gboolean g_signal_accumulator_true_handled (GSignalInvocationHint *ihint, + GValue *return_accu, + const GValue *handler_return, + gpointer dummy); + +GLIB_AVAILABLE_IN_ALL +gboolean g_signal_accumulator_first_wins (GSignalInvocationHint *ihint, + GValue *return_accu, + const GValue *handler_return, + gpointer dummy); + +/*< private >*/ +GLIB_AVAILABLE_IN_ALL +void g_signal_handlers_destroy (gpointer instance); +void _g_signals_destroy (GType itype); + +G_END_DECLS + +#endif /* __G_SIGNAL_H__ */ +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 2000-2001 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ +#ifndef __G_BOXED_H__ +#define __G_BOXED_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + + +#ifndef __GI_SCANNER__ +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 2000-2001 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ +#ifndef __GLIB_TYPES_H__ +#define __GLIB_TYPES_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) && !defined(GLIB_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/* A hack necesssary to preprocess this file with g-ir-scanner */ +#ifdef __GI_SCANNER__ +typedef gsize GType; +#endif + +/* --- GLib boxed types --- */ +/** + * G_TYPE_DATE: + * + * The #GType for #GDate. + */ +#define G_TYPE_DATE (g_date_get_type ()) + +/** + * G_TYPE_STRV: + * + * The #GType for a boxed type holding a %NULL-terminated array of strings. + * + * The code fragments in the following example show the use of a property of + * type #G_TYPE_STRV with g_object_class_install_property(), g_object_set() + * and g_object_get(). + * + * |[ + * g_object_class_install_property (object_class, + * PROP_AUTHORS, + * g_param_spec_boxed ("authors", + * _("Authors"), + * _("List of authors"), + * G_TYPE_STRV, + * G_PARAM_READWRITE)); + * + * gchar *authors[] = { "Owen", "Tim", NULL }; + * g_object_set (obj, "authors", authors, NULL); + * + * gchar *writers[]; + * g_object_get (obj, "authors", &writers, NULL); + * /* do something with writers */ + * g_strfreev (writers); + * ]| + * + * Since: 2.4 + */ +#define G_TYPE_STRV (g_strv_get_type ()) + +/** + * G_TYPE_GSTRING: + * + * The #GType for #GString. + */ +#define G_TYPE_GSTRING (g_gstring_get_type ()) + +/** + * G_TYPE_HASH_TABLE: + * + * The #GType for a boxed type holding a #GHashTable reference. + * + * Since: 2.10 + */ +#define G_TYPE_HASH_TABLE (g_hash_table_get_type ()) + +/** + * G_TYPE_REGEX: + * + * The #GType for a boxed type holding a #GRegex reference. + * + * Since: 2.14 + */ +#define G_TYPE_REGEX (g_regex_get_type ()) + +/** + * G_TYPE_MATCH_INFO: + * + * The #GType for a boxed type holding a #GMatchInfo reference. + * + * Since: 2.30 + */ +#define G_TYPE_MATCH_INFO (g_match_info_get_type ()) + +/** + * G_TYPE_ARRAY: + * + * The #GType for a boxed type holding a #GArray reference. + * + * Since: 2.22 + */ +#define G_TYPE_ARRAY (g_array_get_type ()) + +/** + * G_TYPE_BYTE_ARRAY: + * + * The #GType for a boxed type holding a #GByteArray reference. + * + * Since: 2.22 + */ +#define G_TYPE_BYTE_ARRAY (g_byte_array_get_type ()) + +/** + * G_TYPE_PTR_ARRAY: + * + * The #GType for a boxed type holding a #GPtrArray reference. + * + * Since: 2.22 + */ +#define G_TYPE_PTR_ARRAY (g_ptr_array_get_type ()) + +/** + * G_TYPE_BYTES: + * + * The #GType for #GBytes. + * + * Since: 2.32 + */ +#define G_TYPE_BYTES (g_bytes_get_type ()) + +/** + * G_TYPE_VARIANT_TYPE: + * + * The #GType for a boxed type holding a #GVariantType. + * + * Since: 2.24 + */ +#define G_TYPE_VARIANT_TYPE (g_variant_type_get_gtype ()) + +/** + * G_TYPE_ERROR: + * + * The #GType for a boxed type holding a #GError. + * + * Since: 2.26 + */ +#define G_TYPE_ERROR (g_error_get_type ()) + +/** + * G_TYPE_DATE_TIME: + * + * The #GType for a boxed type holding a #GDateTime. + * + * Since: 2.26 + */ +#define G_TYPE_DATE_TIME (g_date_time_get_type ()) + +/** + * G_TYPE_TIME_ZONE: + * + * The #GType for a boxed type holding a #GTimeZone. + * + * Since: 2.34 + */ +#define G_TYPE_TIME_ZONE (g_time_zone_get_type ()) + +/** + * G_TYPE_IO_CHANNEL: + * + * The #GType for #GIOChannel. + */ +#define G_TYPE_IO_CHANNEL (g_io_channel_get_type ()) + +/** + * G_TYPE_IO_CONDITION: + * + * The #GType for #GIOCondition. + */ +#define G_TYPE_IO_CONDITION (g_io_condition_get_type ()) + +/** + * G_TYPE_VARIANT_BUILDER: + * + * The #GType for a boxed type holding a #GVariantBuilder. + * + * Since: 2.30 + */ +#define G_TYPE_VARIANT_BUILDER (g_variant_builder_get_type ()) + +/** + * G_TYPE_VARIANT_DICT: + * + * The #GType for a boxed type holding a #GVariantDict. + * + * Since: 2.40 + */ +#define G_TYPE_VARIANT_DICT (g_variant_dict_get_type ()) + +/** + * G_TYPE_MAIN_LOOP: + * + * The #GType for a boxed type holding a #GMainLoop. + * + * Since: 2.30 + */ +#define G_TYPE_MAIN_LOOP (g_main_loop_get_type ()) + +/** + * G_TYPE_MAIN_CONTEXT: + * + * The #GType for a boxed type holding a #GMainContext. + * + * Since: 2.30 + */ +#define G_TYPE_MAIN_CONTEXT (g_main_context_get_type ()) + +/** + * G_TYPE_SOURCE: + * + * The #GType for a boxed type holding a #GSource. + * + * Since: 2.30 + */ +#define G_TYPE_SOURCE (g_source_get_type ()) + +/** + * G_TYPE_POLLFD: + * + * The #GType for a boxed type holding a #GPollFD. + * + * Since: 2.36 + */ +#define G_TYPE_POLLFD (g_pollfd_get_type ()) + +/** + * G_TYPE_MARKUP_PARSE_CONTEXT: + * + * The #GType for a boxed type holding a #GMarkupParseContext. + * + * Since: 2.36 + */ +#define G_TYPE_MARKUP_PARSE_CONTEXT (g_markup_parse_context_get_type ()) + +/** + * G_TYPE_KEY_FILE: + * + * The #GType for a boxed type holding a #GKeyFile. + * + * Since: 2.32 + */ +#define G_TYPE_KEY_FILE (g_key_file_get_type ()) + +/** + * G_TYPE_MAPPED_FILE: + * + * The #GType for a boxed type holding a #GMappedFile. + * + * Since: 2.40 + */ +#define G_TYPE_MAPPED_FILE (g_mapped_file_get_type ()) + +/** + * G_TYPE_THREAD: + * + * The #GType for a boxed type holding a #GThread. + * + * Since: 2.36 + */ +#define G_TYPE_THREAD (g_thread_get_type ()) + +/** + * G_TYPE_CHECKSUM: + * + * The #GType for a boxed type holding a #GChecksum. + * + * Since: 2.36 + */ +#define G_TYPE_CHECKSUM (g_checksum_get_type ()) + +/** + * G_TYPE_OPTION_GROUP: + * + * The #GType for a boxed type holding a #GOptionGroup. + * + * Since: 2.44 + */ +#define G_TYPE_OPTION_GROUP (g_option_group_get_type ()) + +/** + * G_TYPE_URI: + * + * The #GType for a boxed type holding a #GUri. + * + * Since: 2.66 + */ +#define G_TYPE_URI (g_uri_get_type ()) + +/** + * G_TYPE_TREE: + * + * The #GType for #GTree. + * + * Since: 2.68 + */ +#define G_TYPE_TREE (g_tree_get_type ()) + +GLIB_AVAILABLE_IN_ALL +GType g_date_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_strv_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_gstring_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_hash_table_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_array_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_byte_array_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_ptr_array_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_bytes_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_variant_type_get_gtype (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_regex_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_2_30 +GType g_match_info_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_error_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_date_time_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_time_zone_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_io_channel_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_io_condition_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_variant_builder_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_2_40 +GType g_variant_dict_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_key_file_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_2_30 +GType g_main_loop_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_2_30 +GType g_main_context_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_2_30 +GType g_source_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_2_36 +GType g_pollfd_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_2_36 +GType g_thread_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_2_36 +GType g_checksum_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_2_36 +GType g_markup_parse_context_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_2_40 +GType g_mapped_file_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_2_44 +GType g_option_group_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_2_66 +GType g_uri_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_2_68 +GType g_tree_get_type (void) G_GNUC_CONST; + +GLIB_DEPRECATED_FOR('G_TYPE_VARIANT') +GType g_variant_get_gtype (void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* __GLIB_TYPES_H__ */ +#endif + +G_BEGIN_DECLS + +/* --- type macros --- */ +#define G_TYPE_IS_BOXED(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_BOXED) +/** + * G_VALUE_HOLDS_BOXED: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values derived + * from type %G_TYPE_BOXED. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_BOXED(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_BOXED)) + + +/* --- typedefs --- */ +/** + * GBoxedCopyFunc: + * @boxed: (not nullable): The boxed structure to be copied. + * + * This function is provided by the user and should produce a copy + * of the passed in boxed structure. + * + * Returns: (not nullable): The newly created copy of the boxed structure. + */ +typedef gpointer (*GBoxedCopyFunc) (gpointer boxed); + +/** + * GBoxedFreeFunc: + * @boxed: (not nullable): The boxed structure to be freed. + * + * This function is provided by the user and should free the boxed + * structure passed. + */ +typedef void (*GBoxedFreeFunc) (gpointer boxed); + + +/* --- prototypes --- */ +GLIB_AVAILABLE_IN_ALL +gpointer g_boxed_copy (GType boxed_type, + gconstpointer src_boxed); +GLIB_AVAILABLE_IN_ALL +void g_boxed_free (GType boxed_type, + gpointer boxed); +GLIB_AVAILABLE_IN_ALL +void g_value_set_boxed (GValue *value, + gconstpointer v_boxed); +GLIB_AVAILABLE_IN_ALL +void g_value_set_static_boxed (GValue *value, + gconstpointer v_boxed); +GLIB_AVAILABLE_IN_ALL +void g_value_take_boxed (GValue *value, + gconstpointer v_boxed); +GLIB_DEPRECATED_FOR(g_value_take_boxed) +void g_value_set_boxed_take_ownership (GValue *value, + gconstpointer v_boxed); +GLIB_AVAILABLE_IN_ALL +gpointer g_value_get_boxed (const GValue *value); +GLIB_AVAILABLE_IN_ALL +gpointer g_value_dup_boxed (const GValue *value); + + +/* --- convenience --- */ +GLIB_AVAILABLE_IN_ALL +GType g_boxed_type_register_static (const gchar *name, + GBoxedCopyFunc boxed_copy, + GBoxedFreeFunc boxed_free); + +/* --- GObject boxed types --- */ +/** + * G_TYPE_CLOSURE: + * + * The #GType for #GClosure. + */ +#define G_TYPE_CLOSURE (g_closure_get_type ()) + +/** + * G_TYPE_VALUE: + * + * The type ID of the "GValue" type which is a boxed type, + * used to pass around pointers to GValues. + */ +#define G_TYPE_VALUE (g_value_get_type ()) + +GLIB_AVAILABLE_IN_ALL +GType g_closure_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_value_get_type (void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* __G_BOXED_H__ */ + +G_BEGIN_DECLS + +/* --- type macros --- */ +/** + * G_TYPE_IS_OBJECT: + * @type: Type id to check + * + * Check if the passed in type id is a %G_TYPE_OBJECT or derived from it. + * + * Returns: %FALSE or %TRUE, indicating whether @type is a %G_TYPE_OBJECT. + */ +#define G_TYPE_IS_OBJECT(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_OBJECT) +/** + * G_OBJECT: + * @object: Object which is subject to casting. + * + * Casts a #GObject or derived pointer into a (GObject*) pointer. + * Depending on the current debugging level, this function may invoke + * certain runtime checks to identify invalid casts. + */ +#define G_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject)) +/** + * G_OBJECT_CLASS: + * @class: a valid #GObjectClass + * + * Casts a derived #GObjectClass structure into a #GObjectClass structure. + */ +#define G_OBJECT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_OBJECT, GObjectClass)) +/** + * G_IS_OBJECT: + * @object: Instance to check for being a %G_TYPE_OBJECT. + * + * Checks whether a valid #GTypeInstance pointer is of type %G_TYPE_OBJECT. + */ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_42 +#define G_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE ((object), G_TYPE_OBJECT)) +#else +#define G_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_OBJECT)) +#endif +/** + * G_IS_OBJECT_CLASS: + * @class: a #GObjectClass + * + * Checks whether @class "is a" valid #GObjectClass structure of type + * %G_TYPE_OBJECT or derived. + */ +#define G_IS_OBJECT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_OBJECT)) +/** + * G_OBJECT_GET_CLASS: + * @object: a #GObject instance. + * + * Get the class structure associated to a #GObject instance. + * + * Returns: pointer to object class structure. + */ +#define G_OBJECT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_OBJECT, GObjectClass)) +/** + * G_OBJECT_TYPE: + * @object: Object to return the type id for. + * + * Get the type id of an object. + * + * Returns: Type id of @object. + */ +#define G_OBJECT_TYPE(object) (G_TYPE_FROM_INSTANCE (object)) +/** + * G_OBJECT_TYPE_NAME: + * @object: Object to return the type name for. + * + * Get the name of an object's type. + * + * Returns: Type name of @object. The string is owned by the type system and + * should not be freed. + */ +#define G_OBJECT_TYPE_NAME(object) (g_type_name (G_OBJECT_TYPE (object))) +/** + * G_OBJECT_CLASS_TYPE: + * @class: a valid #GObjectClass + * + * Get the type id of a class structure. + * + * Returns: Type id of @class. + */ +#define G_OBJECT_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class)) +/** + * G_OBJECT_CLASS_NAME: + * @class: a valid #GObjectClass + * + * Return the name of a class structure's type. + * + * Returns: Type name of @class. The string is owned by the type system and + * should not be freed. + */ +#define G_OBJECT_CLASS_NAME(class) (g_type_name (G_OBJECT_CLASS_TYPE (class))) +/** + * G_VALUE_HOLDS_OBJECT: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values derived from type %G_TYPE_OBJECT. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_OBJECT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_OBJECT)) + +/* --- type macros --- */ +/** + * G_TYPE_INITIALLY_UNOWNED: + * + * The type for #GInitiallyUnowned. + */ +#define G_TYPE_INITIALLY_UNOWNED (g_initially_unowned_get_type()) +/** + * G_INITIALLY_UNOWNED: + * @object: Object which is subject to casting. + * + * Casts a #GInitiallyUnowned or derived pointer into a (GInitiallyUnowned*) + * pointer. Depending on the current debugging level, this function may invoke + * certain runtime checks to identify invalid casts. + */ +#define G_INITIALLY_UNOWNED(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnowned)) +/** + * G_INITIALLY_UNOWNED_CLASS: + * @class: a valid #GInitiallyUnownedClass + * + * Casts a derived #GInitiallyUnownedClass structure into a + * #GInitiallyUnownedClass structure. + */ +#define G_INITIALLY_UNOWNED_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnownedClass)) +/** + * G_IS_INITIALLY_UNOWNED: + * @object: Instance to check for being a %G_TYPE_INITIALLY_UNOWNED. + * + * Checks whether a valid #GTypeInstance pointer is of type %G_TYPE_INITIALLY_UNOWNED. + */ +#define G_IS_INITIALLY_UNOWNED(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_INITIALLY_UNOWNED)) +/** + * G_IS_INITIALLY_UNOWNED_CLASS: + * @class: a #GInitiallyUnownedClass + * + * Checks whether @class "is a" valid #GInitiallyUnownedClass structure of type + * %G_TYPE_INITIALLY_UNOWNED or derived. + */ +#define G_IS_INITIALLY_UNOWNED_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_INITIALLY_UNOWNED)) +/** + * G_INITIALLY_UNOWNED_GET_CLASS: + * @object: a #GInitiallyUnowned instance. + * + * Get the class structure associated to a #GInitiallyUnowned instance. + * + * Returns: pointer to object class structure. + */ +#define G_INITIALLY_UNOWNED_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnownedClass)) +/* GInitiallyUnowned ia a GObject with initially floating reference count */ + + +/* --- typedefs & structures --- */ +typedef struct _GObject GObject; +typedef struct _GObjectClass GObjectClass; +typedef struct _GObject GInitiallyUnowned; +typedef struct _GObjectClass GInitiallyUnownedClass; +typedef struct _GObjectConstructParam GObjectConstructParam; +/** + * GObjectGetPropertyFunc: + * @object: a #GObject + * @property_id: the numeric id under which the property was registered with + * g_object_class_install_property(). + * @value: a #GValue to return the property value in + * @pspec: the #GParamSpec describing the property + * + * The type of the @get_property function of #GObjectClass. + */ +typedef void (*GObjectGetPropertyFunc) (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); +/** + * GObjectSetPropertyFunc: + * @object: a #GObject + * @property_id: the numeric id under which the property was registered with + * g_object_class_install_property(). + * @value: the new value for the property + * @pspec: the #GParamSpec describing the property + * + * The type of the @set_property function of #GObjectClass. + */ +typedef void (*GObjectSetPropertyFunc) (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +/** + * GObjectFinalizeFunc: + * @object: the #GObject being finalized + * + * The type of the @finalize function of #GObjectClass. + */ +typedef void (*GObjectFinalizeFunc) (GObject *object); +/** + * GWeakNotify: + * @data: data that was provided when the weak reference was established + * @where_the_object_was: the object being disposed + * + * A #GWeakNotify function can be added to an object as a callback that gets + * triggered when the object is finalized. Since the object is already being + * disposed when the #GWeakNotify is called, there's not much you could do + * with the object, apart from e.g. using its address as hash-index or the like. + */ +typedef void (*GWeakNotify) (gpointer data, + GObject *where_the_object_was); +/** + * GObject: + * + * All the fields in the GObject structure are private + * to the #GObject implementation and should never be accessed directly. + */ +struct _GObject +{ + GTypeInstance g_type_instance; + + /*< private >*/ + guint ref_count; /* (atomic) */ + GData *qdata; +}; +/** + * GObjectClass: + * @g_type_class: the parent class + * @constructor: the @constructor function is called by g_object_new () to + * complete the object initialization after all the construction properties are + * set. The first thing a @constructor implementation must do is chain up to the + * @constructor of the parent class. Overriding @constructor should be rarely + * needed, e.g. to handle construct properties, or to implement singletons. + * @set_property: the generic setter for all properties of this type. Should be + * overridden for every type with properties. If implementations of + * @set_property don't emit property change notification explicitly, this will + * be done implicitly by the type system. However, if the notify signal is + * emitted explicitly, the type system will not emit it a second time. + * @get_property: the generic getter for all properties of this type. Should be + * overridden for every type with properties. + * @dispose: the @dispose function is supposed to drop all references to other + * objects, but keep the instance otherwise intact, so that client method + * invocations still work. It may be run multiple times (due to reference + * loops). Before returning, @dispose should chain up to the @dispose method + * of the parent class. + * @finalize: instance finalization function, should finish the finalization of + * the instance begun in @dispose and chain up to the @finalize method of the + * parent class. + * @dispatch_properties_changed: emits property change notification for a bunch + * of properties. Overriding @dispatch_properties_changed should be rarely + * needed. + * @notify: the class closure for the notify signal + * @constructed: the @constructed function is called by g_object_new() as the + * final step of the object creation process. At the point of the call, all + * construction properties have been set on the object. The purpose of this + * call is to allow for object initialisation steps that can only be performed + * after construction properties have been set. @constructed implementors + * should chain up to the @constructed call of their parent class to allow it + * to complete its initialisation. + * + * The class structure for the GObject type. + * + * |[ + * // Example of implementing a singleton using a constructor. + * static MySingleton *the_singleton = NULL; + * + * static GObject* + * my_singleton_constructor (GType type, + * guint n_construct_params, + * GObjectConstructParam *construct_params) + * { + * GObject *object; + * + * if (!the_singleton) + * { + * object = G_OBJECT_CLASS (parent_class)->constructor (type, + * n_construct_params, + * construct_params); + * the_singleton = MY_SINGLETON (object); + * } + * else + * object = g_object_ref (G_OBJECT (the_singleton)); + * + * return object; + * } + * ]| + */ +struct _GObjectClass +{ + GTypeClass g_type_class; + + /*< private >*/ + GSList *construct_properties; + + /*< public >*/ + /* seldom overridden */ + GObject* (*constructor) (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties); + /* overridable methods */ + void (*set_property) (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); + void (*get_property) (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); + void (*dispose) (GObject *object); + void (*finalize) (GObject *object); + /* seldom overridden */ + void (*dispatch_properties_changed) (GObject *object, + guint n_pspecs, + GParamSpec **pspecs); + /* signals */ + void (*notify) (GObject *object, + GParamSpec *pspec); + + /* called when done constructing */ + void (*constructed) (GObject *object); + + /*< private >*/ + gsize flags; + + /* padding */ + gpointer pdummy[6]; +}; +/** + * GObjectConstructParam: + * @pspec: the #GParamSpec of the construct parameter + * @value: the value to set the parameter to + * + * The GObjectConstructParam struct is an auxiliary + * structure used to hand #GParamSpec/#GValue pairs to the @constructor of + * a #GObjectClass. + */ +struct _GObjectConstructParam +{ + GParamSpec *pspec; + GValue *value; +}; + +/** + * GInitiallyUnowned: + * + * All the fields in the GInitiallyUnowned structure + * are private to the #GInitiallyUnowned implementation and should never be + * accessed directly. + */ +/** + * GInitiallyUnownedClass: + * + * The class structure for the GInitiallyUnowned type. + */ + + +/* --- prototypes --- */ +GLIB_AVAILABLE_IN_ALL +GType g_initially_unowned_get_type (void); +GLIB_AVAILABLE_IN_ALL +void g_object_class_install_property (GObjectClass *oclass, + guint property_id, + GParamSpec *pspec); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_object_class_find_property (GObjectClass *oclass, + const gchar *property_name); +GLIB_AVAILABLE_IN_ALL +GParamSpec**g_object_class_list_properties (GObjectClass *oclass, + guint *n_properties); +GLIB_AVAILABLE_IN_ALL +void g_object_class_override_property (GObjectClass *oclass, + guint property_id, + const gchar *name); +GLIB_AVAILABLE_IN_ALL +void g_object_class_install_properties (GObjectClass *oclass, + guint n_pspecs, + GParamSpec **pspecs); + +GLIB_AVAILABLE_IN_ALL +void g_object_interface_install_property (gpointer g_iface, + GParamSpec *pspec); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_object_interface_find_property (gpointer g_iface, + const gchar *property_name); +GLIB_AVAILABLE_IN_ALL +GParamSpec**g_object_interface_list_properties (gpointer g_iface, + guint *n_properties_p); + +GLIB_AVAILABLE_IN_ALL +GType g_object_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gpointer g_object_new (GType object_type, + const gchar *first_property_name, + ...); +GLIB_AVAILABLE_IN_2_54 +GObject* g_object_new_with_properties (GType object_type, + guint n_properties, + const char *names[], + const GValue values[]); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +GLIB_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties) +gpointer g_object_newv (GType object_type, + guint n_parameters, + GParameter *parameters); + +G_GNUC_END_IGNORE_DEPRECATIONS + +GLIB_AVAILABLE_IN_ALL +GObject* g_object_new_valist (GType object_type, + const gchar *first_property_name, + va_list var_args); +GLIB_AVAILABLE_IN_ALL +void g_object_set (gpointer object, + const gchar *first_property_name, + ...) G_GNUC_NULL_TERMINATED; +GLIB_AVAILABLE_IN_ALL +void g_object_get (gpointer object, + const gchar *first_property_name, + ...) G_GNUC_NULL_TERMINATED; +GLIB_AVAILABLE_IN_ALL +gpointer g_object_connect (gpointer object, + const gchar *signal_spec, + ...) G_GNUC_NULL_TERMINATED; +GLIB_AVAILABLE_IN_ALL +void g_object_disconnect (gpointer object, + const gchar *signal_spec, + ...) G_GNUC_NULL_TERMINATED; +GLIB_AVAILABLE_IN_2_54 +void g_object_setv (GObject *object, + guint n_properties, + const gchar *names[], + const GValue values[]); +GLIB_AVAILABLE_IN_ALL +void g_object_set_valist (GObject *object, + const gchar *first_property_name, + va_list var_args); +GLIB_AVAILABLE_IN_2_54 +void g_object_getv (GObject *object, + guint n_properties, + const gchar *names[], + GValue values[]); +GLIB_AVAILABLE_IN_ALL +void g_object_get_valist (GObject *object, + const gchar *first_property_name, + va_list var_args); +GLIB_AVAILABLE_IN_ALL +void g_object_set_property (GObject *object, + const gchar *property_name, + const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_object_get_property (GObject *object, + const gchar *property_name, + GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_object_freeze_notify (GObject *object); +GLIB_AVAILABLE_IN_ALL +void g_object_notify (GObject *object, + const gchar *property_name); +GLIB_AVAILABLE_IN_ALL +void g_object_notify_by_pspec (GObject *object, + GParamSpec *pspec); +GLIB_AVAILABLE_IN_ALL +void g_object_thaw_notify (GObject *object); +GLIB_AVAILABLE_IN_ALL +gboolean g_object_is_floating (gpointer object); +GLIB_AVAILABLE_IN_ALL +gpointer g_object_ref_sink (gpointer object); +GLIB_AVAILABLE_IN_ALL +gpointer g_object_ref (gpointer object); +GLIB_AVAILABLE_IN_ALL +void g_object_unref (gpointer object); +GLIB_AVAILABLE_IN_ALL +void g_object_weak_ref (GObject *object, + GWeakNotify notify, + gpointer data); +GLIB_AVAILABLE_IN_ALL +void g_object_weak_unref (GObject *object, + GWeakNotify notify, + gpointer data); +GLIB_AVAILABLE_IN_ALL +void g_object_add_weak_pointer (GObject *object, + gpointer *weak_pointer_location); +GLIB_AVAILABLE_IN_ALL +void g_object_remove_weak_pointer (GObject *object, + gpointer *weak_pointer_location); + +#if defined(glib_typeof) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56 +/* Make reference APIs type safe with macros */ +#undef g_object_ref +#define g_object_ref(Obj) ((glib_typeof (Obj)) (_frida_g_object_ref) (Obj)) +#undef g_object_ref_sink +#define g_object_ref_sink(Obj) ((glib_typeof (Obj)) (_frida_g_object_ref_sink) (Obj)) +#endif + +/** + * GToggleNotify: + * @data: Callback data passed to g_object_add_toggle_ref() + * @object: The object on which g_object_add_toggle_ref() was called. + * @is_last_ref: %TRUE if the toggle reference is now the + * last reference to the object. %FALSE if the toggle + * reference was the last reference and there are now other + * references. + * + * A callback function used for notification when the state + * of a toggle reference changes. See g_object_add_toggle_ref(). + */ +typedef void (*GToggleNotify) (gpointer data, + GObject *object, + gboolean is_last_ref); + +GLIB_AVAILABLE_IN_ALL +void g_object_add_toggle_ref (GObject *object, + GToggleNotify notify, + gpointer data); +GLIB_AVAILABLE_IN_ALL +void g_object_remove_toggle_ref (GObject *object, + GToggleNotify notify, + gpointer data); + +GLIB_AVAILABLE_IN_ALL +gpointer g_object_get_qdata (GObject *object, + GQuark quark); +GLIB_AVAILABLE_IN_ALL +void g_object_set_qdata (GObject *object, + GQuark quark, + gpointer data); +GLIB_AVAILABLE_IN_ALL +void g_object_set_qdata_full (GObject *object, + GQuark quark, + gpointer data, + GDestroyNotify destroy); +GLIB_AVAILABLE_IN_ALL +gpointer g_object_steal_qdata (GObject *object, + GQuark quark); + +GLIB_AVAILABLE_IN_2_34 +gpointer g_object_dup_qdata (GObject *object, + GQuark quark, + GDuplicateFunc dup_func, + gpointer user_data); +GLIB_AVAILABLE_IN_2_34 +gboolean g_object_replace_qdata (GObject *object, + GQuark quark, + gpointer oldval, + gpointer newval, + GDestroyNotify destroy, + GDestroyNotify *old_destroy); + +GLIB_AVAILABLE_IN_ALL +gpointer g_object_get_data (GObject *object, + const gchar *key); +GLIB_AVAILABLE_IN_ALL +void g_object_set_data (GObject *object, + const gchar *key, + gpointer data); +GLIB_AVAILABLE_IN_ALL +void g_object_set_data_full (GObject *object, + const gchar *key, + gpointer data, + GDestroyNotify destroy); +GLIB_AVAILABLE_IN_ALL +gpointer g_object_steal_data (GObject *object, + const gchar *key); + +GLIB_AVAILABLE_IN_2_34 +gpointer g_object_dup_data (GObject *object, + const gchar *key, + GDuplicateFunc dup_func, + gpointer user_data); +GLIB_AVAILABLE_IN_2_34 +gboolean g_object_replace_data (GObject *object, + const gchar *key, + gpointer oldval, + gpointer newval, + GDestroyNotify destroy, + GDestroyNotify *old_destroy); + + +GLIB_AVAILABLE_IN_ALL +void g_object_watch_closure (GObject *object, + GClosure *closure); +GLIB_AVAILABLE_IN_ALL +GClosure* g_cclosure_new_object (GCallback callback_func, + GObject *object); +GLIB_AVAILABLE_IN_ALL +GClosure* g_cclosure_new_object_swap (GCallback callback_func, + GObject *object); +GLIB_AVAILABLE_IN_ALL +GClosure* g_closure_new_object (guint sizeof_closure, + GObject *object); +GLIB_AVAILABLE_IN_ALL +void g_value_set_object (GValue *value, + gpointer v_object); +GLIB_AVAILABLE_IN_ALL +gpointer g_value_get_object (const GValue *value); +GLIB_AVAILABLE_IN_ALL +gpointer g_value_dup_object (const GValue *value); +GLIB_AVAILABLE_IN_ALL +gulong g_signal_connect_object (gpointer instance, + const gchar *detailed_signal, + GCallback c_handler, + gpointer gobject, + GConnectFlags connect_flags); + +/*< protected >*/ +GLIB_AVAILABLE_IN_ALL +void g_object_force_floating (GObject *object); +GLIB_AVAILABLE_IN_ALL +void g_object_run_dispose (GObject *object); + + +GLIB_AVAILABLE_IN_ALL +void g_value_take_object (GValue *value, + gpointer v_object); +GLIB_DEPRECATED_FOR(g_value_take_object) +void g_value_set_object_take_ownership (GValue *value, + gpointer v_object); + +GLIB_DEPRECATED +gsize g_object_compat_control (gsize what, + gpointer data); + +/* --- implementation macros --- */ +#define G_OBJECT_WARN_INVALID_PSPEC(object, pname, property_id, pspec) \ +G_STMT_START { \ + GObject *_glib__object = (GObject*) (object); \ + GParamSpec *_glib__pspec = (GParamSpec*) (pspec); \ + guint _glib__property_id = (property_id); \ + g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'", \ + __FILE__, __LINE__, \ + (pname), \ + _glib__property_id, \ + _glib__pspec->name, \ + g_type_name (G_PARAM_SPEC_TYPE (_glib__pspec)), \ + G_OBJECT_TYPE_NAME (_glib__object)); \ +} G_STMT_END +/** + * G_OBJECT_WARN_INVALID_PROPERTY_ID: + * @object: the #GObject on which set_property() or get_property() was called + * @property_id: the numeric id of the property + * @pspec: the #GParamSpec of the property + * + * This macro should be used to emit a standard warning about unexpected + * properties in set_property() and get_property() implementations. + */ +#define G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec) \ + G_OBJECT_WARN_INVALID_PSPEC ((object), "property", (property_id), (pspec)) + +GLIB_AVAILABLE_IN_ALL +void g_clear_object (GObject **object_ptr); +#undef g_clear_object +#define g_clear_object(object_ptr) g_clear_pointer ((object_ptr), g_object_unref) + +/** + * g_set_object: (skip) + * @object_ptr: (inout) (not optional) (nullable): a pointer to a #GObject reference + * @new_object: (nullable) (transfer none): a pointer to the new #GObject to + * assign to @object_ptr, or %NULL to clear the pointer + * + * Updates a #GObject pointer to refer to @new_object. It increments the + * reference count of @new_object (if non-%NULL), decrements the reference + * count of the current value of @object_ptr (if non-%NULL), and assigns + * @new_object to @object_ptr. The assignment is not atomic. + * + * @object_ptr must not be %NULL, but can point to a %NULL value. + * + * A macro is also included that allows this function to be used without + * pointer casts. The function itself is static inline, so its address may vary + * between compilation units. + * + * One convenient usage of this function is in implementing property setters: + * |[ + * void + * foo_set_bar (Foo *foo, + * Bar *new_bar) + * { + * g_return_if_fail (IS_FOO (foo)); + * g_return_if_fail (new_bar == NULL || IS_BAR (new_bar)); + * + * if (g_set_object (&foo->bar, new_bar)) + * g_object_notify (foo, "bar"); + * } + * ]| + * + * Returns: %TRUE if the value of @object_ptr changed, %FALSE otherwise + * + * Since: 2.44 + */ +static inline gboolean +(g_set_object) (GObject **object_ptr, + GObject *new_object) +{ + GObject *old_object = *object_ptr; + + /* rely on g_object_[un]ref() to check the pointers are actually GObjects; + * elide a (object_ptr != NULL) check because most of the time we will be + * operating on struct members with a constant offset, so a NULL check would + * not catch bugs + */ + + if (old_object == new_object) + return FALSE; + + if (new_object != NULL) + g_object_ref (new_object); + + *object_ptr = new_object; + + if (old_object != NULL) + g_object_unref (old_object); + + return TRUE; +} + +/* We need GCC for __extension__, which we need to sort out strict aliasing of @object_ptr */ +#if defined(__GNUC__) + +#define g_set_object(object_ptr, new_object) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(object_ptr) == sizeof (new_object)); \ + /* Only one access, please; work around type aliasing */ \ + union { char *in; GObject **out; } _object_ptr; \ + _object_ptr.in = (char *) (object_ptr); \ + /* Check types match */ \ + (void) (0 ? *(object_ptr) = (new_object), FALSE : FALSE); \ + (g_set_object) (_object_ptr.out, (GObject *) new_object); \ + })) \ + GLIB_AVAILABLE_MACRO_IN_2_44 + +#else /* if !defined(__GNUC__) */ + +#define g_set_object(object_ptr, new_object) \ + (/* Check types match. */ \ + 0 ? *(object_ptr) = (new_object), FALSE : \ + (g_set_object) ((GObject **) (object_ptr), (GObject *) (new_object)) \ + ) + +#endif /* !defined(__GNUC__) */ + +/** + * g_assert_finalize_object: (skip) + * @object: (transfer full) (type GObject.Object): an object + * + * Assert that @object is non-%NULL, then release one reference to it with + * g_object_unref() and assert that it has been finalized (i.e. that there + * are no more references). + * + * If assertions are disabled via `G_DISABLE_ASSERT`, + * this macro just calls g_object_unref() without any further checks. + * + * This macro should only be used in regression tests. + * + * Since: 2.62 + */ +static inline void +(g_assert_finalize_object) (GObject *object) +{ + gpointer weak_pointer = object; + + g_assert_true (G_IS_OBJECT (weak_pointer)); + g_object_add_weak_pointer (object, &weak_pointer); + g_object_unref (weak_pointer); + g_assert_null (weak_pointer); +} + +#ifdef G_DISABLE_ASSERT +#define g_assert_finalize_object(object) g_object_unref (object) +#else +#define g_assert_finalize_object(object) (g_assert_finalize_object ((GObject *) object)) +#endif + +/** + * g_clear_weak_pointer: (skip) + * @weak_pointer_location: The memory address of a pointer + * + * Clears a weak reference to a #GObject. + * + * @weak_pointer_location must not be %NULL. + * + * If the weak reference is %NULL then this function does nothing. + * Otherwise, the weak reference to the object is removed for that location + * and the pointer is set to %NULL. + * + * A macro is also included that allows this function to be used without + * pointer casts. The function itself is static inline, so its address may vary + * between compilation units. + * + * Since: 2.56 + */ +static inline void +(g_clear_weak_pointer) (gpointer *weak_pointer_location) +{ + GObject *object = (GObject *) *weak_pointer_location; + + if (object != NULL) + { + g_object_remove_weak_pointer (object, weak_pointer_location); + *weak_pointer_location = NULL; + } +} + +#define g_clear_weak_pointer(weak_pointer_location) \ + (/* Check types match. */ \ + (g_clear_weak_pointer) ((gpointer *) (weak_pointer_location)) \ + ) + +/** + * g_set_weak_pointer: (skip) + * @weak_pointer_location: the memory address of a pointer + * @new_object: (nullable) (transfer none): a pointer to the new #GObject to + * assign to it, or %NULL to clear the pointer + * + * Updates a pointer to weakly refer to @new_object. It assigns @new_object + * to @weak_pointer_location and ensures that @weak_pointer_location will + * automatically be set to %NULL if @new_object gets destroyed. The assignment + * is not atomic. The weak reference is not thread-safe, see + * g_object_add_weak_pointer() for details. + * + * @weak_pointer_location must not be %NULL. + * + * A macro is also included that allows this function to be used without + * pointer casts. The function itself is static inline, so its address may vary + * between compilation units. + * + * One convenient usage of this function is in implementing property setters: + * |[ + * void + * foo_set_bar (Foo *foo, + * Bar *new_bar) + * { + * g_return_if_fail (IS_FOO (foo)); + * g_return_if_fail (new_bar == NULL || IS_BAR (new_bar)); + * + * if (g_set_weak_pointer (&foo->bar, new_bar)) + * g_object_notify (foo, "bar"); + * } + * ]| + * + * Returns: %TRUE if the value of @weak_pointer_location changed, %FALSE otherwise + * + * Since: 2.56 + */ +static inline gboolean +(g_set_weak_pointer) (gpointer *weak_pointer_location, + GObject *new_object) +{ + GObject *old_object = (GObject *) *weak_pointer_location; + + /* elide a (weak_pointer_location != NULL) check because most of the time we + * will be operating on struct members with a constant offset, so a NULL + * check would not catch bugs + */ + + if (old_object == new_object) + return FALSE; + + if (old_object != NULL) + g_object_remove_weak_pointer (old_object, weak_pointer_location); + + *weak_pointer_location = new_object; + + if (new_object != NULL) + g_object_add_weak_pointer (new_object, weak_pointer_location); + + return TRUE; +} + +#define g_set_weak_pointer(weak_pointer_location, new_object) \ + (/* Check types match. */ \ + 0 ? *(weak_pointer_location) = (new_object), FALSE : \ + (g_set_weak_pointer) ((gpointer *) (weak_pointer_location), (GObject *) (new_object)) \ + ) + +typedef struct { + /**/ + union { gpointer p; } priv; +} GWeakRef; + +GLIB_AVAILABLE_IN_ALL +void g_weak_ref_init (GWeakRef *weak_ref, + gpointer object); +GLIB_AVAILABLE_IN_ALL +void g_weak_ref_clear (GWeakRef *weak_ref); +GLIB_AVAILABLE_IN_ALL +gpointer g_weak_ref_get (GWeakRef *weak_ref); +GLIB_AVAILABLE_IN_ALL +void g_weak_ref_set (GWeakRef *weak_ref, + gpointer object); + +G_END_DECLS + +#endif /* __G_OBJECT_H__ */ + +G_BEGIN_DECLS + +#define G_TYPE_BINDING_FLAGS (g_binding_flags_get_type ()) + +#define G_TYPE_BINDING (g_binding_get_type ()) +#define G_BINDING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_BINDING, GBinding)) +#define G_IS_BINDING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_BINDING)) + +/** + * GBinding: + * + * GBinding is an opaque structure whose members + * cannot be accessed directly. + * + * Since: 2.26 + */ +typedef struct _GBinding GBinding; + +/** + * GBindingTransformFunc: + * @binding: a #GBinding + * @from_value: the #GValue containing the value to transform + * @to_value: the #GValue in which to store the transformed value + * @user_data: data passed to the transform function + * + * A function to be called to transform @from_value to @to_value. If + * this is the @transform_to function of a binding, then @from_value + * is the @source_property on the @source object, and @to_value is the + * @target_property on the @target object. If this is the + * @transform_from function of a %G_BINDING_BIDIRECTIONAL binding, + * then those roles are reversed. + * + * Returns: %TRUE if the transformation was successful, and %FALSE + * otherwise + * + * Since: 2.26 + */ +typedef gboolean (* GBindingTransformFunc) (GBinding *binding, + const GValue *from_value, + GValue *to_value, + gpointer user_data); + +/** + * GBindingFlags: + * @G_BINDING_DEFAULT: The default binding; if the source property + * changes, the target property is updated with its value. + * @G_BINDING_BIDIRECTIONAL: Bidirectional binding; if either the + * property of the source or the property of the target changes, + * the other is updated. + * @G_BINDING_SYNC_CREATE: Synchronize the values of the source and + * target properties when creating the binding; the direction of + * the synchronization is always from the source to the target. + * @G_BINDING_INVERT_BOOLEAN: If the two properties being bound are + * booleans, setting one to %TRUE will result in the other being + * set to %FALSE and vice versa. This flag will only work for + * boolean properties, and cannot be used when passing custom + * transformation functions to g_object_bind_property_full(). + * + * Flags to be passed to g_object_bind_property() or + * g_object_bind_property_full(). + * + * This enumeration can be extended at later date. + * + * Since: 2.26 + */ +typedef enum { /*< prefix=G_BINDING >*/ + G_BINDING_DEFAULT = 0, + + G_BINDING_BIDIRECTIONAL = 1 << 0, + G_BINDING_SYNC_CREATE = 1 << 1, + G_BINDING_INVERT_BOOLEAN = 1 << 2 +} GBindingFlags; + +GLIB_AVAILABLE_IN_ALL +GType g_binding_flags_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +GType g_binding_get_type (void) G_GNUC_CONST; + +GLIB_AVAILABLE_IN_ALL +GBindingFlags g_binding_get_flags (GBinding *binding); +GLIB_DEPRECATED_IN_2_68_FOR(g_binding_dup_source) +GObject * g_binding_get_source (GBinding *binding); +GLIB_AVAILABLE_IN_2_68 +GObject * g_binding_dup_source (GBinding *binding); +GLIB_DEPRECATED_IN_2_68_FOR(g_binding_dup_target) +GObject * g_binding_get_target (GBinding *binding); +GLIB_AVAILABLE_IN_2_68 +GObject * g_binding_dup_target (GBinding *binding); +GLIB_AVAILABLE_IN_ALL +const gchar * g_binding_get_source_property (GBinding *binding); +GLIB_AVAILABLE_IN_ALL +const gchar * g_binding_get_target_property (GBinding *binding); +GLIB_AVAILABLE_IN_2_38 +void g_binding_unbind (GBinding *binding); + +GLIB_AVAILABLE_IN_ALL +GBinding *g_object_bind_property (gpointer source, + const gchar *source_property, + gpointer target, + const gchar *target_property, + GBindingFlags flags); +GLIB_AVAILABLE_IN_ALL +GBinding *g_object_bind_property_full (gpointer source, + const gchar *source_property, + gpointer target, + const gchar *target_property, + GBindingFlags flags, + GBindingTransformFunc transform_to, + GBindingTransformFunc transform_from, + gpointer user_data, + GDestroyNotify notify); +GLIB_AVAILABLE_IN_ALL +GBinding *g_object_bind_property_with_closures (gpointer source, + const gchar *source_property, + gpointer target, + const gchar *target_property, + GBindingFlags flags, + GClosure *transform_to, + GClosure *transform_from); + +G_END_DECLS + +#endif /* __G_BINDING_H__ */ +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ +#ifndef __G_ENUMS_H__ +#define __G_ENUMS_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/* --- type macros --- */ +/** + * G_TYPE_IS_ENUM: + * @type: a #GType ID. + * + * Checks whether @type "is a" %G_TYPE_ENUM. + * + * Returns: %TRUE if @type "is a" %G_TYPE_ENUM. + */ +#define G_TYPE_IS_ENUM(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_ENUM) +/** + * G_ENUM_CLASS: + * @class: a valid #GEnumClass + * + * Casts a derived #GEnumClass structure into a #GEnumClass structure. + */ +#define G_ENUM_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_ENUM, GEnumClass)) +/** + * G_IS_ENUM_CLASS: + * @class: a #GEnumClass + * + * Checks whether @class "is a" valid #GEnumClass structure of type %G_TYPE_ENUM + * or derived. + */ +#define G_IS_ENUM_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_ENUM)) +/** + * G_ENUM_CLASS_TYPE: + * @class: a #GEnumClass + * + * Get the type identifier from a given #GEnumClass structure. + * + * Returns: the #GType + */ +#define G_ENUM_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class)) +/** + * G_ENUM_CLASS_TYPE_NAME: + * @class: a #GEnumClass + * + * Get the static type name from a given #GEnumClass structure. + * + * Returns: the type name. + */ +#define G_ENUM_CLASS_TYPE_NAME(class) (g_type_name (G_ENUM_CLASS_TYPE (class))) + + +/** + * G_TYPE_IS_FLAGS: + * @type: a #GType ID. + * + * Checks whether @type "is a" %G_TYPE_FLAGS. + * + * Returns: %TRUE if @type "is a" %G_TYPE_FLAGS. + */ +#define G_TYPE_IS_FLAGS(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_FLAGS) +/** + * G_FLAGS_CLASS: + * @class: a valid #GFlagsClass + * + * Casts a derived #GFlagsClass structure into a #GFlagsClass structure. + */ +#define G_FLAGS_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_FLAGS, GFlagsClass)) +/** + * G_IS_FLAGS_CLASS: + * @class: a #GFlagsClass + * + * Checks whether @class "is a" valid #GFlagsClass structure of type %G_TYPE_FLAGS + * or derived. + */ +#define G_IS_FLAGS_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_FLAGS)) +/** + * G_FLAGS_CLASS_TYPE: + * @class: a #GFlagsClass + * + * Get the type identifier from a given #GFlagsClass structure. + * + * Returns: the #GType + */ +#define G_FLAGS_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class)) +/** + * G_FLAGS_CLASS_TYPE_NAME: + * @class: a #GFlagsClass + * + * Get the static type name from a given #GFlagsClass structure. + * + * Returns: the type name. + */ +#define G_FLAGS_CLASS_TYPE_NAME(class) (g_type_name (G_FLAGS_CLASS_TYPE (class))) + + +/** + * G_VALUE_HOLDS_ENUM: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values derived from type %G_TYPE_ENUM. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_ENUM(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_ENUM)) +/** + * G_VALUE_HOLDS_FLAGS: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values derived from type %G_TYPE_FLAGS. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_FLAGS(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLAGS)) + + +/* --- enum/flag values & classes --- */ +typedef struct _GEnumClass GEnumClass; +typedef struct _GFlagsClass GFlagsClass; +typedef struct _GEnumValue GEnumValue; +typedef struct _GFlagsValue GFlagsValue; + +/** + * GEnumClass: + * @g_type_class: the parent class + * @minimum: the smallest possible value. + * @maximum: the largest possible value. + * @n_values: the number of possible values. + * @values: an array of #GEnumValue structs describing the + * individual values. + * + * The class of an enumeration type holds information about its + * possible values. + */ +struct _GEnumClass +{ + GTypeClass g_type_class; + + /*< public >*/ + gint minimum; + gint maximum; + guint n_values; + GEnumValue *values; +}; +/** + * GFlagsClass: + * @g_type_class: the parent class + * @mask: a mask covering all possible values. + * @n_values: the number of possible values. + * @values: an array of #GFlagsValue structs describing the + * individual values. + * + * The class of a flags type holds information about its + * possible values. + */ +struct _GFlagsClass +{ + GTypeClass g_type_class; + + /*< public >*/ + guint mask; + guint n_values; + GFlagsValue *values; +}; +/** + * GEnumValue: + * @value: the enum value + * @value_name: the name of the value + * @value_nick: the nickname of the value + * + * A structure which contains a single enum value, its name, and its + * nickname. + */ +struct _GEnumValue +{ + gint value; + const gchar *value_name; + const gchar *value_nick; +}; +/** + * GFlagsValue: + * @value: the flags value + * @value_name: the name of the value + * @value_nick: the nickname of the value + * + * A structure which contains a single flags value, its name, and its + * nickname. + */ +struct _GFlagsValue +{ + guint value; + const gchar *value_name; + const gchar *value_nick; +}; + + +/* --- prototypes --- */ +GLIB_AVAILABLE_IN_ALL +GEnumValue* g_enum_get_value (GEnumClass *enum_class, + gint value); +GLIB_AVAILABLE_IN_ALL +GEnumValue* g_enum_get_value_by_name (GEnumClass *enum_class, + const gchar *name); +GLIB_AVAILABLE_IN_ALL +GEnumValue* g_enum_get_value_by_nick (GEnumClass *enum_class, + const gchar *nick); +GLIB_AVAILABLE_IN_ALL +GFlagsValue* g_flags_get_first_value (GFlagsClass *flags_class, + guint value); +GLIB_AVAILABLE_IN_ALL +GFlagsValue* g_flags_get_value_by_name (GFlagsClass *flags_class, + const gchar *name); +GLIB_AVAILABLE_IN_ALL +GFlagsValue* g_flags_get_value_by_nick (GFlagsClass *flags_class, + const gchar *nick); +GLIB_AVAILABLE_IN_2_54 +gchar *g_enum_to_string (GType g_enum_type, + gint value); +GLIB_AVAILABLE_IN_2_54 +gchar *g_flags_to_string (GType flags_type, + guint value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_enum (GValue *value, + gint v_enum); +GLIB_AVAILABLE_IN_ALL +gint g_value_get_enum (const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_flags (GValue *value, + guint v_flags); +GLIB_AVAILABLE_IN_ALL +guint g_value_get_flags (const GValue *value); + + + +/* --- registration functions --- */ +/* const_static_values is a NULL terminated array of enum/flags + * values that is taken over! + */ +GLIB_AVAILABLE_IN_ALL +GType g_enum_register_static (const gchar *name, + const GEnumValue *const_static_values); +GLIB_AVAILABLE_IN_ALL +GType g_flags_register_static (const gchar *name, + const GFlagsValue *const_static_values); +/* functions to complete the type information + * for enums/flags implemented by plugins + */ +GLIB_AVAILABLE_IN_ALL +void g_enum_complete_type_info (GType g_enum_type, + GTypeInfo *info, + const GEnumValue *const_values); +GLIB_AVAILABLE_IN_ALL +void g_flags_complete_type_info (GType g_flags_type, + GTypeInfo *info, + const GFlagsValue *const_values); + +G_END_DECLS + +#endif /* __G_ENUMS_H__ */ + +/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */ + +#ifndef __GOBJECT_ENUM_TYPES_H__ +#define __GOBJECT_ENUM_TYPES_H__ + + +G_BEGIN_DECLS + +/* enumerations from "../../../deps/glib/gobject/../glib/gunicode.h" */ +GLIB_AVAILABLE_IN_2_60 GType g_unicode_type_get_type (void) G_GNUC_CONST; +#define G_TYPE_UNICODE_TYPE (g_unicode_type_get_type ()) +GLIB_AVAILABLE_IN_2_60 GType g_unicode_break_type_get_type (void) G_GNUC_CONST; +#define G_TYPE_UNICODE_BREAK_TYPE (g_unicode_break_type_get_type ()) +GLIB_AVAILABLE_IN_2_60 GType g_unicode_script_get_type (void) G_GNUC_CONST; +#define G_TYPE_UNICODE_SCRIPT (g_unicode_script_get_type ()) +GLIB_AVAILABLE_IN_2_60 GType g_normalize_mode_get_type (void) G_GNUC_CONST; +#define G_TYPE_NORMALIZE_MODE (g_normalize_mode_get_type ()) +G_END_DECLS + +#endif /* __GOBJECT_ENUM_TYPES_H__ */ + +/* Generated data ends here */ + +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * gparamspecs.h: GLib default param specs + */ +#ifndef __G_PARAMSPECS_H__ +#define __G_PARAMSPECS_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/* --- type macros --- */ +/** + * G_TYPE_PARAM_CHAR: + * + * The #GType of #GParamSpecChar. + */ +#define G_TYPE_PARAM_CHAR (g_param_spec_types[0]) +/** + * G_IS_PARAM_SPEC_CHAR: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_CHAR. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_CHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CHAR)) +/** + * G_PARAM_SPEC_CHAR: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecChar. + */ +#define G_PARAM_SPEC_CHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CHAR, GParamSpecChar)) + +/** + * G_TYPE_PARAM_UCHAR: + * + * The #GType of #GParamSpecUChar. + */ +#define G_TYPE_PARAM_UCHAR (g_param_spec_types[1]) +/** + * G_IS_PARAM_SPEC_UCHAR: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UCHAR. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_UCHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UCHAR)) +/** + * G_PARAM_SPEC_UCHAR: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecUChar. + */ +#define G_PARAM_SPEC_UCHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UCHAR, GParamSpecUChar)) + +/** + * G_TYPE_PARAM_BOOLEAN: + * + * The #GType of #GParamSpecBoolean. + */ +#define G_TYPE_PARAM_BOOLEAN (g_param_spec_types[2]) +/** + * G_IS_PARAM_SPEC_BOOLEAN: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_BOOLEAN. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_BOOLEAN(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOOLEAN)) +/** + * G_PARAM_SPEC_BOOLEAN: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecBoolean. + */ +#define G_PARAM_SPEC_BOOLEAN(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOOLEAN, GParamSpecBoolean)) + +/** + * G_TYPE_PARAM_INT: + * + * The #GType of #GParamSpecInt. + */ +#define G_TYPE_PARAM_INT (g_param_spec_types[3]) +/** + * G_IS_PARAM_SPEC_INT: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_INT. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_INT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT)) +/** + * G_PARAM_SPEC_INT: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecInt. + */ +#define G_PARAM_SPEC_INT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT, GParamSpecInt)) + +/** + * G_TYPE_PARAM_UINT: + * + * The #GType of #GParamSpecUInt. + */ +#define G_TYPE_PARAM_UINT (g_param_spec_types[4]) +/** + * G_IS_PARAM_SPEC_UINT: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UINT. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_UINT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT)) +/** + * G_PARAM_SPEC_UINT: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecUInt. + */ +#define G_PARAM_SPEC_UINT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT, GParamSpecUInt)) + +/** + * G_TYPE_PARAM_LONG: + * + * The #GType of #GParamSpecLong. + */ +#define G_TYPE_PARAM_LONG (g_param_spec_types[5]) +/** + * G_IS_PARAM_SPEC_LONG: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_LONG. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_LONG(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_LONG)) +/** + * G_PARAM_SPEC_LONG: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecLong. + */ +#define G_PARAM_SPEC_LONG(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_LONG, GParamSpecLong)) + +/** + * G_TYPE_PARAM_ULONG: + * + * The #GType of #GParamSpecULong. + */ +#define G_TYPE_PARAM_ULONG (g_param_spec_types[6]) +/** + * G_IS_PARAM_SPEC_ULONG: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_ULONG. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_ULONG(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ULONG)) +/** + * G_PARAM_SPEC_ULONG: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecULong. + */ +#define G_PARAM_SPEC_ULONG(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ULONG, GParamSpecULong)) + +/** + * G_TYPE_PARAM_INT64: + * + * The #GType of #GParamSpecInt64. + */ +#define G_TYPE_PARAM_INT64 (g_param_spec_types[7]) +/** + * G_IS_PARAM_SPEC_INT64: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_INT64. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_INT64(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT64)) +/** + * G_PARAM_SPEC_INT64: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecInt64. + */ +#define G_PARAM_SPEC_INT64(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT64, GParamSpecInt64)) + +/** + * G_TYPE_PARAM_UINT64: + * + * The #GType of #GParamSpecUInt64. + */ +#define G_TYPE_PARAM_UINT64 (g_param_spec_types[8]) +/** + * G_IS_PARAM_SPEC_UINT64: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UINT64. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_UINT64(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT64)) +/** + * G_PARAM_SPEC_UINT64: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecUInt64. + */ +#define G_PARAM_SPEC_UINT64(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT64, GParamSpecUInt64)) + +/** + * G_TYPE_PARAM_UNICHAR: + * + * The #GType of #GParamSpecUnichar. + */ +#define G_TYPE_PARAM_UNICHAR (g_param_spec_types[9]) +/** + * G_PARAM_SPEC_UNICHAR: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecUnichar. + */ +#define G_PARAM_SPEC_UNICHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UNICHAR, GParamSpecUnichar)) +/** + * G_IS_PARAM_SPEC_UNICHAR: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UNICHAR. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_UNICHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UNICHAR)) + +/** + * G_TYPE_PARAM_ENUM: + * + * The #GType of #GParamSpecEnum. + */ +#define G_TYPE_PARAM_ENUM (g_param_spec_types[10]) +/** + * G_IS_PARAM_SPEC_ENUM: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_ENUM. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ENUM)) +/** + * G_PARAM_SPEC_ENUM: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecEnum. + */ +#define G_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ENUM, GParamSpecEnum)) + +/** + * G_TYPE_PARAM_FLAGS: + * + * The #GType of #GParamSpecFlags. + */ +#define G_TYPE_PARAM_FLAGS (g_param_spec_types[11]) +/** + * G_IS_PARAM_SPEC_FLAGS: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_FLAGS. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLAGS)) +/** + * G_PARAM_SPEC_FLAGS: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecFlags. + */ +#define G_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLAGS, GParamSpecFlags)) + +/** + * G_TYPE_PARAM_FLOAT: + * + * The #GType of #GParamSpecFloat. + */ +#define G_TYPE_PARAM_FLOAT (g_param_spec_types[12]) +/** + * G_IS_PARAM_SPEC_FLOAT: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_FLOAT. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLOAT)) +/** + * G_PARAM_SPEC_FLOAT: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecFloat. + */ +#define G_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLOAT, GParamSpecFloat)) + +/** + * G_TYPE_PARAM_DOUBLE: + * + * The #GType of #GParamSpecDouble. + */ +#define G_TYPE_PARAM_DOUBLE (g_param_spec_types[13]) +/** + * G_IS_PARAM_SPEC_DOUBLE: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_DOUBLE. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_DOUBLE)) +/** + * G_PARAM_SPEC_DOUBLE: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecDouble. + */ +#define G_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_DOUBLE, GParamSpecDouble)) + +/** + * G_TYPE_PARAM_STRING: + * + * The #GType of #GParamSpecString. + */ +#define G_TYPE_PARAM_STRING (g_param_spec_types[14]) +/** + * G_IS_PARAM_SPEC_STRING: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_STRING. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_STRING)) +/** + * G_PARAM_SPEC_STRING: + * @pspec: a valid #GParamSpec instance + * + * Casts a #GParamSpec instance into a #GParamSpecString. + */ +#define G_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_STRING, GParamSpecString)) + +/** + * G_TYPE_PARAM_PARAM: + * + * The #GType of #GParamSpecParam. + */ +#define G_TYPE_PARAM_PARAM (g_param_spec_types[15]) +/** + * G_IS_PARAM_SPEC_PARAM: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_PARAM. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_PARAM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_PARAM)) +/** + * G_PARAM_SPEC_PARAM: + * @pspec: a valid #GParamSpec instance + * + * Casts a #GParamSpec instance into a #GParamSpecParam. + */ +#define G_PARAM_SPEC_PARAM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_PARAM, GParamSpecParam)) + +/** + * G_TYPE_PARAM_BOXED: + * + * The #GType of #GParamSpecBoxed. + */ +#define G_TYPE_PARAM_BOXED (g_param_spec_types[16]) +/** + * G_IS_PARAM_SPEC_BOXED: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_BOXED. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOXED)) +/** + * G_PARAM_SPEC_BOXED: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecBoxed. + */ +#define G_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOXED, GParamSpecBoxed)) + +/** + * G_TYPE_PARAM_POINTER: + * + * The #GType of #GParamSpecPointer. + */ +#define G_TYPE_PARAM_POINTER (g_param_spec_types[17]) +/** + * G_IS_PARAM_SPEC_POINTER: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_POINTER. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_POINTER(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_POINTER)) +/** + * G_PARAM_SPEC_POINTER: + * @pspec: a valid #GParamSpec instance + * + * Casts a #GParamSpec instance into a #GParamSpecPointer. + */ +#define G_PARAM_SPEC_POINTER(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_POINTER, GParamSpecPointer)) + +/** + * G_TYPE_PARAM_VALUE_ARRAY: + * + * The #GType of #GParamSpecValueArray. + * + * Deprecated: 2.32: Use #GArray instead of #GValueArray + */ +#define G_TYPE_PARAM_VALUE_ARRAY (g_param_spec_types[18]) GLIB_DEPRECATED_MACRO_IN_2_32 +/** + * G_IS_PARAM_SPEC_VALUE_ARRAY: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_VALUE_ARRAY. + * + * Returns: %TRUE on success. + * + * Deprecated: 2.32: Use #GArray instead of #GValueArray + */ +#define G_IS_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VALUE_ARRAY)) GLIB_DEPRECATED_MACRO_IN_2_32 +/** + * G_PARAM_SPEC_VALUE_ARRAY: + * @pspec: a valid #GParamSpec instance + * + * Cast a #GParamSpec instance into a #GParamSpecValueArray. + * + * Deprecated: 2.32: Use #GArray instead of #GValueArray + */ +#define G_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VALUE_ARRAY, GParamSpecValueArray)) GLIB_DEPRECATED_MACRO_IN_2_32 + +/** + * G_TYPE_PARAM_OBJECT: + * + * The #GType of #GParamSpecObject. + */ +#define G_TYPE_PARAM_OBJECT (g_param_spec_types[19]) +/** + * G_IS_PARAM_SPEC_OBJECT: + * @pspec: a valid #GParamSpec instance + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_OBJECT. + * + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OBJECT)) +/** + * G_PARAM_SPEC_OBJECT: + * @pspec: a valid #GParamSpec instance + * + * Casts a #GParamSpec instance into a #GParamSpecObject. + */ +#define G_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OBJECT, GParamSpecObject)) + +/** + * G_TYPE_PARAM_OVERRIDE: + * + * The #GType of #GParamSpecOverride. + * + * Since: 2.4 + */ +#define G_TYPE_PARAM_OVERRIDE (g_param_spec_types[20]) +/** + * G_IS_PARAM_SPEC_OVERRIDE: + * @pspec: a #GParamSpec + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_OVERRIDE. + * + * Since: 2.4 + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_OVERRIDE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OVERRIDE)) +/** + * G_PARAM_SPEC_OVERRIDE: + * @pspec: a #GParamSpec + * + * Casts a #GParamSpec into a #GParamSpecOverride. + * + * Since: 2.4 + */ +#define G_PARAM_SPEC_OVERRIDE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OVERRIDE, GParamSpecOverride)) + +/** + * G_TYPE_PARAM_GTYPE: + * + * The #GType of #GParamSpecGType. + * + * Since: 2.10 + */ +#define G_TYPE_PARAM_GTYPE (g_param_spec_types[21]) +/** + * G_IS_PARAM_SPEC_GTYPE: + * @pspec: a #GParamSpec + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_GTYPE. + * + * Since: 2.10 + * Returns: %TRUE on success. + */ +#define G_IS_PARAM_SPEC_GTYPE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_GTYPE)) +/** + * G_PARAM_SPEC_GTYPE: + * @pspec: a #GParamSpec + * + * Casts a #GParamSpec into a #GParamSpecGType. + * + * Since: 2.10 + */ +#define G_PARAM_SPEC_GTYPE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_GTYPE, GParamSpecGType)) + +/** + * G_TYPE_PARAM_VARIANT: + * + * The #GType of #GParamSpecVariant. + * + * Since: 2.26 + */ +#define G_TYPE_PARAM_VARIANT (g_param_spec_types[22]) +/** + * G_IS_PARAM_SPEC_VARIANT: + * @pspec: a #GParamSpec + * + * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_VARIANT. + * + * Returns: %TRUE on success + * + * Since: 2.26 + */ +#define G_IS_PARAM_SPEC_VARIANT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VARIANT)) +/** + * G_PARAM_SPEC_VARIANT: + * @pspec: a #GParamSpec + * + * Casts a #GParamSpec into a #GParamSpecVariant. + * + * Since: 2.26 + */ +#define G_PARAM_SPEC_VARIANT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VARIANT, GParamSpecVariant)) + +/* --- typedefs & structures --- */ +typedef struct _GParamSpecChar GParamSpecChar; +typedef struct _GParamSpecUChar GParamSpecUChar; +typedef struct _GParamSpecBoolean GParamSpecBoolean; +typedef struct _GParamSpecInt GParamSpecInt; +typedef struct _GParamSpecUInt GParamSpecUInt; +typedef struct _GParamSpecLong GParamSpecLong; +typedef struct _GParamSpecULong GParamSpecULong; +typedef struct _GParamSpecInt64 GParamSpecInt64; +typedef struct _GParamSpecUInt64 GParamSpecUInt64; +typedef struct _GParamSpecUnichar GParamSpecUnichar; +typedef struct _GParamSpecEnum GParamSpecEnum; +typedef struct _GParamSpecFlags GParamSpecFlags; +typedef struct _GParamSpecFloat GParamSpecFloat; +typedef struct _GParamSpecDouble GParamSpecDouble; +typedef struct _GParamSpecString GParamSpecString; +typedef struct _GParamSpecParam GParamSpecParam; +typedef struct _GParamSpecBoxed GParamSpecBoxed; +typedef struct _GParamSpecPointer GParamSpecPointer; +typedef struct _GParamSpecValueArray GParamSpecValueArray; +typedef struct _GParamSpecObject GParamSpecObject; +typedef struct _GParamSpecOverride GParamSpecOverride; +typedef struct _GParamSpecGType GParamSpecGType; +typedef struct _GParamSpecVariant GParamSpecVariant; + +/** + * GParamSpecChar: + * @parent_instance: private #GParamSpec portion + * @minimum: minimum value for the property specified + * @maximum: maximum value for the property specified + * @default_value: default value for the property specified + * + * A #GParamSpec derived structure that contains the meta data for character properties. + */ +struct _GParamSpecChar +{ + GParamSpec parent_instance; + + gint8 minimum; + gint8 maximum; + gint8 default_value; +}; +/** + * GParamSpecUChar: + * @parent_instance: private #GParamSpec portion + * @minimum: minimum value for the property specified + * @maximum: maximum value for the property specified + * @default_value: default value for the property specified + * + * A #GParamSpec derived structure that contains the meta data for unsigned character properties. + */ +struct _GParamSpecUChar +{ + GParamSpec parent_instance; + + guint8 minimum; + guint8 maximum; + guint8 default_value; +}; +/** + * GParamSpecBoolean: + * @parent_instance: private #GParamSpec portion + * @default_value: default value for the property specified + * + * A #GParamSpec derived structure that contains the meta data for boolean properties. + */ +struct _GParamSpecBoolean +{ + GParamSpec parent_instance; + + gboolean default_value; +}; +/** + * GParamSpecInt: + * @parent_instance: private #GParamSpec portion + * @minimum: minimum value for the property specified + * @maximum: maximum value for the property specified + * @default_value: default value for the property specified + * + * A #GParamSpec derived structure that contains the meta data for integer properties. + */ +struct _GParamSpecInt +{ + GParamSpec parent_instance; + + gint minimum; + gint maximum; + gint default_value; +}; +/** + * GParamSpecUInt: + * @parent_instance: private #GParamSpec portion + * @minimum: minimum value for the property specified + * @maximum: maximum value for the property specified + * @default_value: default value for the property specified + * + * A #GParamSpec derived structure that contains the meta data for unsigned integer properties. + */ +struct _GParamSpecUInt +{ + GParamSpec parent_instance; + + guint minimum; + guint maximum; + guint default_value; +}; +/** + * GParamSpecLong: + * @parent_instance: private #GParamSpec portion + * @minimum: minimum value for the property specified + * @maximum: maximum value for the property specified + * @default_value: default value for the property specified + * + * A #GParamSpec derived structure that contains the meta data for long integer properties. + */ +struct _GParamSpecLong +{ + GParamSpec parent_instance; + + glong minimum; + glong maximum; + glong default_value; +}; +/** + * GParamSpecULong: + * @parent_instance: private #GParamSpec portion + * @minimum: minimum value for the property specified + * @maximum: maximum value for the property specified + * @default_value: default value for the property specified + * + * A #GParamSpec derived structure that contains the meta data for unsigned long integer properties. + */ +struct _GParamSpecULong +{ + GParamSpec parent_instance; + + gulong minimum; + gulong maximum; + gulong default_value; +}; +/** + * GParamSpecInt64: + * @parent_instance: private #GParamSpec portion + * @minimum: minimum value for the property specified + * @maximum: maximum value for the property specified + * @default_value: default value for the property specified + * + * A #GParamSpec derived structure that contains the meta data for 64bit integer properties. + */ +struct _GParamSpecInt64 +{ + GParamSpec parent_instance; + + gint64 minimum; + gint64 maximum; + gint64 default_value; +}; +/** + * GParamSpecUInt64: + * @parent_instance: private #GParamSpec portion + * @minimum: minimum value for the property specified + * @maximum: maximum value for the property specified + * @default_value: default value for the property specified + * + * A #GParamSpec derived structure that contains the meta data for unsigned 64bit integer properties. + */ +struct _GParamSpecUInt64 +{ + GParamSpec parent_instance; + + guint64 minimum; + guint64 maximum; + guint64 default_value; +}; +/** + * GParamSpecUnichar: + * @parent_instance: private #GParamSpec portion + * @default_value: default value for the property specified + * + * A #GParamSpec derived structure that contains the meta data for unichar (unsigned integer) properties. + */ +struct _GParamSpecUnichar +{ + GParamSpec parent_instance; + + gunichar default_value; +}; +/** + * GParamSpecEnum: + * @parent_instance: private #GParamSpec portion + * @enum_class: the #GEnumClass for the enum + * @default_value: default value for the property specified + * + * A #GParamSpec derived structure that contains the meta data for enum + * properties. + */ +struct _GParamSpecEnum +{ + GParamSpec parent_instance; + + GEnumClass *enum_class; + gint default_value; +}; +/** + * GParamSpecFlags: + * @parent_instance: private #GParamSpec portion + * @flags_class: the #GFlagsClass for the flags + * @default_value: default value for the property specified + * + * A #GParamSpec derived structure that contains the meta data for flags + * properties. + */ +struct _GParamSpecFlags +{ + GParamSpec parent_instance; + + GFlagsClass *flags_class; + guint default_value; +}; +/** + * GParamSpecFloat: + * @parent_instance: private #GParamSpec portion + * @minimum: minimum value for the property specified + * @maximum: maximum value for the property specified + * @default_value: default value for the property specified + * @epsilon: values closer than @epsilon will be considered identical + * by g_param_values_cmp(); the default value is 1e-30. + * + * A #GParamSpec derived structure that contains the meta data for float properties. + */ +struct _GParamSpecFloat +{ + GParamSpec parent_instance; + + gfloat minimum; + gfloat maximum; + gfloat default_value; + gfloat epsilon; +}; +/** + * GParamSpecDouble: + * @parent_instance: private #GParamSpec portion + * @minimum: minimum value for the property specified + * @maximum: maximum value for the property specified + * @default_value: default value for the property specified + * @epsilon: values closer than @epsilon will be considered identical + * by g_param_values_cmp(); the default value is 1e-90. + * + * A #GParamSpec derived structure that contains the meta data for double properties. + */ +struct _GParamSpecDouble +{ + GParamSpec parent_instance; + + gdouble minimum; + gdouble maximum; + gdouble default_value; + gdouble epsilon; +}; +/** + * GParamSpecString: + * @parent_instance: private #GParamSpec portion + * @default_value: default value for the property specified + * @cset_first: a string containing the allowed values for the first byte + * @cset_nth: a string containing the allowed values for the subsequent bytes + * @substitutor: the replacement byte for bytes which don't match @cset_first or @cset_nth. + * @null_fold_if_empty: replace empty string by %NULL + * @ensure_non_null: replace %NULL strings by an empty string + * + * A #GParamSpec derived structure that contains the meta data for string + * properties. + */ +struct _GParamSpecString +{ + GParamSpec parent_instance; + + gchar *default_value; + gchar *cset_first; + gchar *cset_nth; + gchar substitutor; + guint null_fold_if_empty : 1; + guint ensure_non_null : 1; +}; +/** + * GParamSpecParam: + * @parent_instance: private #GParamSpec portion + * + * A #GParamSpec derived structure that contains the meta data for %G_TYPE_PARAM + * properties. + */ +struct _GParamSpecParam +{ + GParamSpec parent_instance; +}; +/** + * GParamSpecBoxed: + * @parent_instance: private #GParamSpec portion + * + * A #GParamSpec derived structure that contains the meta data for boxed properties. + */ +struct _GParamSpecBoxed +{ + GParamSpec parent_instance; +}; +/** + * GParamSpecPointer: + * @parent_instance: private #GParamSpec portion + * + * A #GParamSpec derived structure that contains the meta data for pointer properties. + */ +struct _GParamSpecPointer +{ + GParamSpec parent_instance; +}; +/** + * GParamSpecValueArray: + * @parent_instance: private #GParamSpec portion + * @element_spec: a #GParamSpec describing the elements contained in arrays of this property, may be %NULL + * @fixed_n_elements: if greater than 0, arrays of this property will always have this many elements + * + * A #GParamSpec derived structure that contains the meta data for #GValueArray properties. + */ +struct _GParamSpecValueArray +{ + GParamSpec parent_instance; + GParamSpec *element_spec; + guint fixed_n_elements; +}; +/** + * GParamSpecObject: + * @parent_instance: private #GParamSpec portion + * + * A #GParamSpec derived structure that contains the meta data for object properties. + */ +struct _GParamSpecObject +{ + GParamSpec parent_instance; +}; +/** + * GParamSpecOverride: + * + * This is a type of #GParamSpec type that simply redirects operations to + * another paramspec. All operations other than getting or + * setting the value are redirected, including accessing the nick and + * blurb, validating a value, and so forth. See + * g_param_spec_get_redirect_target() for retrieving the overridden + * property. #GParamSpecOverride is used in implementing + * g_object_class_override_property(), and will not be directly useful + * unless you are implementing a new base type similar to GObject. + * + * Since: 2.4 + */ +struct _GParamSpecOverride +{ + /*< private >*/ + GParamSpec parent_instance; + GParamSpec *overridden; +}; +/** + * GParamSpecGType: + * @parent_instance: private #GParamSpec portion + * @is_a_type: a #GType whose subtypes can occur as values + * + * A #GParamSpec derived structure that contains the meta data for #GType properties. + * + * Since: 2.10 + */ +struct _GParamSpecGType +{ + GParamSpec parent_instance; + GType is_a_type; +}; +/** + * GParamSpecVariant: + * @parent_instance: private #GParamSpec portion + * @type: a #GVariantType, or %NULL + * @default_value: a #GVariant, or %NULL + * + * A #GParamSpec derived structure that contains the meta data for #GVariant properties. + * + * When comparing values with g_param_values_cmp(), scalar values with the same + * type will be compared with g_variant_compare(). Other non-%NULL variants will + * be checked for equality with g_variant_equal(), and their sort order is + * otherwise undefined. %NULL is ordered before non-%NULL variants. Two %NULL + * values compare equal. + * + * Since: 2.26 + */ +struct _GParamSpecVariant +{ + GParamSpec parent_instance; + GVariantType *type; + GVariant *default_value; + + /*< private >*/ + gpointer padding[4]; +}; + +/* --- GParamSpec prototypes --- */ +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_char (const gchar *name, + const gchar *nick, + const gchar *blurb, + gint8 minimum, + gint8 maximum, + gint8 default_value, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_uchar (const gchar *name, + const gchar *nick, + const gchar *blurb, + guint8 minimum, + guint8 maximum, + guint8 default_value, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_boolean (const gchar *name, + const gchar *nick, + const gchar *blurb, + gboolean default_value, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_int (const gchar *name, + const gchar *nick, + const gchar *blurb, + gint minimum, + gint maximum, + gint default_value, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_uint (const gchar *name, + const gchar *nick, + const gchar *blurb, + guint minimum, + guint maximum, + guint default_value, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_long (const gchar *name, + const gchar *nick, + const gchar *blurb, + glong minimum, + glong maximum, + glong default_value, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_ulong (const gchar *name, + const gchar *nick, + const gchar *blurb, + gulong minimum, + gulong maximum, + gulong default_value, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_int64 (const gchar *name, + const gchar *nick, + const gchar *blurb, + gint64 minimum, + gint64 maximum, + gint64 default_value, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_uint64 (const gchar *name, + const gchar *nick, + const gchar *blurb, + guint64 minimum, + guint64 maximum, + guint64 default_value, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_unichar (const gchar *name, + const gchar *nick, + const gchar *blurb, + gunichar default_value, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_enum (const gchar *name, + const gchar *nick, + const gchar *blurb, + GType enum_type, + gint default_value, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_flags (const gchar *name, + const gchar *nick, + const gchar *blurb, + GType flags_type, + guint default_value, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_float (const gchar *name, + const gchar *nick, + const gchar *blurb, + gfloat minimum, + gfloat maximum, + gfloat default_value, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_double (const gchar *name, + const gchar *nick, + const gchar *blurb, + gdouble minimum, + gdouble maximum, + gdouble default_value, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_string (const gchar *name, + const gchar *nick, + const gchar *blurb, + const gchar *default_value, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_param (const gchar *name, + const gchar *nick, + const gchar *blurb, + GType param_type, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_boxed (const gchar *name, + const gchar *nick, + const gchar *blurb, + GType boxed_type, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_pointer (const gchar *name, + const gchar *nick, + const gchar *blurb, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_value_array (const gchar *name, + const gchar *nick, + const gchar *blurb, + GParamSpec *element_spec, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_object (const gchar *name, + const gchar *nick, + const gchar *blurb, + GType object_type, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_override (const gchar *name, + GParamSpec *overridden); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_gtype (const gchar *name, + const gchar *nick, + const gchar *blurb, + GType is_a_type, + GParamFlags flags); +GLIB_AVAILABLE_IN_ALL +GParamSpec* g_param_spec_variant (const gchar *name, + const gchar *nick, + const gchar *blurb, + const GVariantType *type, + GVariant *default_value, + GParamFlags flags); + +/* --- internal --- */ +/* We prefix variable declarations so they can + * properly get exported in windows dlls. + */ +#ifndef GOBJECT_VAR +# ifdef G_PLATFORM_WIN32 +# ifdef GOBJECT_STATIC_COMPILATION +# define GOBJECT_VAR extern +# else /* !GOBJECT_STATIC_COMPILATION */ +# ifdef GOBJECT_COMPILATION +# ifdef DLL_EXPORT +# define GOBJECT_VAR extern __declspec(dllexport) +# else /* !DLL_EXPORT */ +# define GOBJECT_VAR extern +# endif /* !DLL_EXPORT */ +# else /* !GOBJECT_COMPILATION */ +# define GOBJECT_VAR extern __declspec(dllimport) +# endif /* !GOBJECT_COMPILATION */ +# endif /* !GOBJECT_STATIC_COMPILATION */ +# else /* !G_PLATFORM_WIN32 */ +# define GOBJECT_VAR _GLIB_EXTERN +# endif /* !G_PLATFORM_WIN32 */ +#endif /* GOBJECT_VAR */ + +GOBJECT_VAR GType *g_param_spec_types; + +G_END_DECLS + +#endif /* __G_PARAMSPECS_H__ */ +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 2001 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ +#ifndef __G_SOURCECLOSURE_H__ +#define __G_SOURCECLOSURE_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +GLIB_AVAILABLE_IN_ALL +void g_source_set_closure (GSource *source, + GClosure *closure); + +GLIB_AVAILABLE_IN_ALL +void g_source_set_dummy_callback (GSource *source); + +G_END_DECLS + +#endif /* __G_SOURCECLOSURE_H__ */ +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 2000 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ +#ifndef __G_TYPE_MODULE_H__ +#define __G_TYPE_MODULE_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +typedef struct _GTypeModule GTypeModule; +typedef struct _GTypeModuleClass GTypeModuleClass; + +#define G_TYPE_TYPE_MODULE (g_type_module_get_type ()) +#define G_TYPE_MODULE(module) (G_TYPE_CHECK_INSTANCE_CAST ((module), G_TYPE_TYPE_MODULE, GTypeModule)) +#define G_TYPE_MODULE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TYPE_MODULE, GTypeModuleClass)) +#define G_IS_TYPE_MODULE(module) (G_TYPE_CHECK_INSTANCE_TYPE ((module), G_TYPE_TYPE_MODULE)) +#define G_IS_TYPE_MODULE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TYPE_MODULE)) +#define G_TYPE_MODULE_GET_CLASS(module) (G_TYPE_INSTANCE_GET_CLASS ((module), G_TYPE_TYPE_MODULE, GTypeModuleClass)) + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTypeModule, g_object_unref) + +/** + * GTypeModule: + * @name: the name of the module + * + * The members of the GTypeModule structure should not + * be accessed directly, except for the @name field. + */ +struct _GTypeModule +{ + GObject parent_instance; + + guint use_count; + GSList *type_infos; + GSList *interface_infos; + + /*< public >*/ + gchar *name; +}; + +/** + * GTypeModuleClass: + * @parent_class: the parent class + * @load: loads the module and registers one or more types using + * g_type_module_register_type(). + * @unload: unloads the module + * + * In order to implement dynamic loading of types based on #GTypeModule, + * the @load and @unload functions in #GTypeModuleClass must be implemented. + */ +struct _GTypeModuleClass +{ + GObjectClass parent_class; + + /*< public >*/ + gboolean (* load) (GTypeModule *module); + void (* unload) (GTypeModule *module); + + /*< private >*/ + /* Padding for future expansion */ + void (*reserved1) (void); + void (*reserved2) (void); + void (*reserved3) (void); + void (*reserved4) (void); +}; + +/** + * G_DEFINE_DYNAMIC_TYPE: + * @TN: The name of the new type, in Camel case. + * @t_n: The name of the new type, in lowercase, with words + * separated by '_'. + * @T_P: The #GType of the parent type. + * + * A convenience macro for dynamic type implementations, which declares a + * class initialization function, an instance initialization function (see + * #GTypeInfo for information about these) and a static variable named + * `t_n`_parent_class pointing to the parent class. Furthermore, + * it defines a `*_get_type()` and a static `*_register_type()` functions + * for use in your `module_init()`. + * + * See G_DEFINE_DYNAMIC_TYPE_EXTENDED() for an example. + * + * Since: 2.14 + */ +#define G_DEFINE_DYNAMIC_TYPE(TN, t_n, T_P) G_DEFINE_DYNAMIC_TYPE_EXTENDED (TN, t_n, T_P, 0, {}) +/** + * G_DEFINE_DYNAMIC_TYPE_EXTENDED: + * @TypeName: The name of the new type, in Camel case. + * @type_name: The name of the new type, in lowercase, with words + * separated by '_'. + * @TYPE_PARENT: The #GType of the parent type. + * @flags: #GTypeFlags to pass to g_type_module_register_type() + * @CODE: Custom code that gets inserted in the *_get_type() function. + * + * A more general version of G_DEFINE_DYNAMIC_TYPE() which + * allows to specify #GTypeFlags and custom code. + * + * |[ + * G_DEFINE_DYNAMIC_TYPE_EXTENDED (GtkGadget, + * gtk_gadget, + * GTK_TYPE_THING, + * 0, + * G_IMPLEMENT_INTERFACE_DYNAMIC (TYPE_GIZMO, + * gtk_gadget_gizmo_init)); + * ]| + * expands to + * |[ + * static void gtk_gadget_init (GtkGadget *self); + * static void gtk_gadget_class_init (GtkGadgetClass *klass); + * static void gtk_gadget_class_finalize (GtkGadgetClass *klass); + * + * static gpointer gtk_gadget_parent_class = NULL; + * static GType gtk_gadget_type_id = 0; + * + * static void gtk_gadget_class_intern_init (gpointer klass) + * { + * gtk_gadget_parent_class = g_type_class_peek_parent (klass); + * gtk_gadget_class_init ((GtkGadgetClass*) klass); + * } + * + * GType + * gtk_gadget_get_type (void) + * { + * return gtk_gadget_type_id; + * } + * + * static void + * gtk_gadget_register_type (GTypeModule *type_module) + * { + * const GTypeInfo g_define_type_info = { + * sizeof (GtkGadgetClass), + * (GBaseInitFunc) NULL, + * (GBaseFinalizeFunc) NULL, + * (GClassInitFunc) gtk_gadget_class_intern_init, + * (GClassFinalizeFunc) gtk_gadget_class_finalize, + * NULL, // class_data + * sizeof (GtkGadget), + * 0, // n_preallocs + * (GInstanceInitFunc) gtk_gadget_init, + * NULL // value_table + * }; + * gtk_gadget_type_id = g_type_module_register_type (type_module, + * GTK_TYPE_THING, + * "GtkGadget", + * &g_define_type_info, + * (GTypeFlags) flags); + * { + * const GInterfaceInfo g_implement_interface_info = { + * (GInterfaceInitFunc) gtk_gadget_gizmo_init + * }; + * g_type_module_add_interface (type_module, g_define_type_id, TYPE_GIZMO, &g_implement_interface_info); + * } + * } + * ]| + * + * Since: 2.14 + */ +#define G_DEFINE_DYNAMIC_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, flags, CODE) \ +static void type_name##_init (TypeName *self); \ +static void type_name##_class_init (TypeName##Class *klass); \ +static void type_name##_class_finalize (TypeName##Class *klass); \ +static gpointer type_name##_parent_class = NULL; \ +static GType type_name##_type_id = 0; \ +static gint TypeName##_private_offset; \ +\ +_G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \ +\ +G_GNUC_UNUSED \ +static inline gpointer \ +type_name##_get_instance_private (TypeName *self) \ +{ \ + return (G_STRUCT_MEMBER_P (self, TypeName##_private_offset)); \ +} \ +\ +GType \ +type_name##_get_type (void) \ +{ \ + return type_name##_type_id; \ +} \ +static void \ +type_name##_register_type (GTypeModule *type_module) \ +{ \ + GType g_define_type_id G_GNUC_UNUSED; \ + const GTypeInfo g_define_type_info = { \ + sizeof (TypeName##Class), \ + (GBaseInitFunc) NULL, \ + (GBaseFinalizeFunc) NULL, \ + (GClassInitFunc)(void (*)(void)) type_name##_class_intern_init, \ + (GClassFinalizeFunc)(void (*)(void)) type_name##_class_finalize, \ + NULL, /* class_data */ \ + sizeof (TypeName), \ + 0, /* n_preallocs */ \ + (GInstanceInitFunc)(void (*)(void)) type_name##_init, \ + NULL /* value_table */ \ + }; \ + type_name##_type_id = g_type_module_register_type (type_module, \ + TYPE_PARENT, \ + #TypeName, \ + &g_define_type_info, \ + (GTypeFlags) flags); \ + g_define_type_id = type_name##_type_id; \ + { CODE ; } \ +} + +/** + * G_IMPLEMENT_INTERFACE_DYNAMIC: + * @TYPE_IFACE: The #GType of the interface to add + * @iface_init: The interface init function + * + * A convenience macro to ease interface addition in the @_C_ section + * of G_DEFINE_DYNAMIC_TYPE_EXTENDED(). See G_DEFINE_DYNAMIC_TYPE_EXTENDED() + * for an example. + * + * Note that this macro can only be used together with the + * G_DEFINE_DYNAMIC_TYPE_EXTENDED macros, since it depends on variable + * names from that macro. + * + * Since: 2.24 + */ +#define G_IMPLEMENT_INTERFACE_DYNAMIC(TYPE_IFACE, iface_init) { \ + const GInterfaceInfo g_implement_interface_info = { \ + (GInterfaceInitFunc)(void (*)(void)) iface_init, NULL, NULL \ + }; \ + g_type_module_add_interface (type_module, g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \ +} + +/** + * G_ADD_PRIVATE_DYNAMIC: + * @TypeName: the name of the type in CamelCase + * + * A convenience macro to ease adding private data to instances of a new dynamic + * type in the @_C_ section of G_DEFINE_DYNAMIC_TYPE_EXTENDED(). See + * G_ADD_PRIVATE() for details, it is similar but for static types. + * + * Note that this macro can only be used together with the + * G_DEFINE_DYNAMIC_TYPE_EXTENDED macros, since it depends on variable + * names from that macro. + * + * Since: 2.38 + */ +#define G_ADD_PRIVATE_DYNAMIC(TypeName) { \ + TypeName##_private_offset = sizeof (TypeName##Private); \ +} + +GLIB_AVAILABLE_IN_ALL +GType g_type_module_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +gboolean g_type_module_use (GTypeModule *module); +GLIB_AVAILABLE_IN_ALL +void g_type_module_unuse (GTypeModule *module); +GLIB_AVAILABLE_IN_ALL +void g_type_module_set_name (GTypeModule *module, + const gchar *name); +GLIB_AVAILABLE_IN_ALL +GType g_type_module_register_type (GTypeModule *module, + GType parent_type, + const gchar *type_name, + const GTypeInfo *type_info, + GTypeFlags flags); +GLIB_AVAILABLE_IN_ALL +void g_type_module_add_interface (GTypeModule *module, + GType instance_type, + GType interface_type, + const GInterfaceInfo *interface_info); +GLIB_AVAILABLE_IN_ALL +GType g_type_module_register_enum (GTypeModule *module, + const gchar *name, + const GEnumValue *const_static_values); +GLIB_AVAILABLE_IN_ALL +GType g_type_module_register_flags (GTypeModule *module, + const gchar *name, + const GFlagsValue *const_static_values); + +G_END_DECLS + +#endif /* __G_TYPE_MODULE_H__ */ +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 2000 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ +#ifndef __G_TYPE_PLUGIN_H__ +#define __G_TYPE_PLUGIN_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/* --- type macros --- */ +#define G_TYPE_TYPE_PLUGIN (g_type_plugin_get_type ()) +#define G_TYPE_PLUGIN(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TYPE_PLUGIN, GTypePlugin)) +#define G_TYPE_PLUGIN_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), G_TYPE_TYPE_PLUGIN, GTypePluginClass)) +#define G_IS_TYPE_PLUGIN(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TYPE_PLUGIN)) +#define G_IS_TYPE_PLUGIN_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), G_TYPE_TYPE_PLUGIN)) +#define G_TYPE_PLUGIN_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_TYPE_PLUGIN, GTypePluginClass)) + + +/* --- typedefs & structures --- */ +typedef struct _GTypePluginClass GTypePluginClass; +/** + * GTypePluginUse: + * @plugin: the #GTypePlugin whose use count should be increased + * + * The type of the @use_plugin function of #GTypePluginClass, which gets called + * to increase the use count of @plugin. + */ +typedef void (*GTypePluginUse) (GTypePlugin *plugin); +/** + * GTypePluginUnuse: + * @plugin: the #GTypePlugin whose use count should be decreased + * + * The type of the @unuse_plugin function of #GTypePluginClass. + */ +typedef void (*GTypePluginUnuse) (GTypePlugin *plugin); +/** + * GTypePluginCompleteTypeInfo: + * @plugin: the #GTypePlugin + * @g_type: the #GType whose info is completed + * @info: the #GTypeInfo struct to fill in + * @value_table: the #GTypeValueTable to fill in + * + * The type of the @complete_type_info function of #GTypePluginClass. + */ +typedef void (*GTypePluginCompleteTypeInfo) (GTypePlugin *plugin, + GType g_type, + GTypeInfo *info, + GTypeValueTable *value_table); +/** + * GTypePluginCompleteInterfaceInfo: + * @plugin: the #GTypePlugin + * @instance_type: the #GType of an instantiatable type to which the interface + * is added + * @interface_type: the #GType of the interface whose info is completed + * @info: the #GInterfaceInfo to fill in + * + * The type of the @complete_interface_info function of #GTypePluginClass. + */ +typedef void (*GTypePluginCompleteInterfaceInfo) (GTypePlugin *plugin, + GType instance_type, + GType interface_type, + GInterfaceInfo *info); +/** + * GTypePlugin: + * + * The GTypePlugin typedef is used as a placeholder + * for objects that implement the GTypePlugin interface. + */ +/** + * GTypePluginClass: + * @use_plugin: Increases the use count of the plugin. + * @unuse_plugin: Decreases the use count of the plugin. + * @complete_type_info: Fills in the #GTypeInfo and + * #GTypeValueTable structs for the type. The structs are initialized + * with `memset(s, 0, sizeof (s))` before calling this function. + * @complete_interface_info: Fills in missing parts of the #GInterfaceInfo + * for the interface. The structs is initialized with + * `memset(s, 0, sizeof (s))` before calling this function. + * + * The #GTypePlugin interface is used by the type system in order to handle + * the lifecycle of dynamically loaded types. + */ +struct _GTypePluginClass +{ + /*< private >*/ + GTypeInterface base_iface; + + /*< public >*/ + GTypePluginUse use_plugin; + GTypePluginUnuse unuse_plugin; + GTypePluginCompleteTypeInfo complete_type_info; + GTypePluginCompleteInterfaceInfo complete_interface_info; +}; + + +/* --- prototypes --- */ +GLIB_AVAILABLE_IN_ALL +GType g_type_plugin_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL +void g_type_plugin_use (GTypePlugin *plugin); +GLIB_AVAILABLE_IN_ALL +void g_type_plugin_unuse (GTypePlugin *plugin); +GLIB_AVAILABLE_IN_ALL +void g_type_plugin_complete_type_info (GTypePlugin *plugin, + GType g_type, + GTypeInfo *info, + GTypeValueTable *value_table); +GLIB_AVAILABLE_IN_ALL +void g_type_plugin_complete_interface_info (GTypePlugin *plugin, + GType instance_type, + GType interface_type, + GInterfaceInfo *info); + +G_END_DECLS + +#endif /* __G_TYPE_PLUGIN_H__ */ +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 2001 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * gvaluearray.h: GLib array type holding GValues + */ +#ifndef __G_VALUE_ARRAY_H__ +#define __G_VALUE_ARRAY_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * G_TYPE_VALUE_ARRAY: + * + * The type ID of the "GValueArray" type which is a boxed type, + * used to pass around pointers to GValueArrays. + * + * Deprecated: 2.32: Use #GArray instead of #GValueArray + */ +#define G_TYPE_VALUE_ARRAY (g_value_array_get_type ()) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(G_TYPE_ARRAY) + +/* --- typedefs & structs --- */ +typedef struct _GValueArray GValueArray; +/** + * GValueArray: + * @n_values: number of values contained in the array + * @values: array of values + * + * A #GValueArray contains an array of #GValue elements. + */ +struct _GValueArray +{ + guint n_values; + GValue *values; + + /*< private >*/ + guint n_prealloced; +}; + +/* --- prototypes --- */ +GLIB_DEPRECATED_IN_2_32_FOR(GArray) +GType g_value_array_get_type (void) G_GNUC_CONST; + +GLIB_DEPRECATED_IN_2_32_FOR(GArray) +GValue* g_value_array_get_nth (GValueArray *value_array, + guint index_); + +GLIB_DEPRECATED_IN_2_32_FOR(GArray) +GValueArray* g_value_array_new (guint n_prealloced); + +GLIB_DEPRECATED_IN_2_32_FOR(GArray) +void g_value_array_free (GValueArray *value_array); + +GLIB_DEPRECATED_IN_2_32_FOR(GArray) +GValueArray* g_value_array_copy (const GValueArray *value_array); + +GLIB_DEPRECATED_IN_2_32_FOR(GArray) +GValueArray* g_value_array_prepend (GValueArray *value_array, + const GValue *value); + +GLIB_DEPRECATED_IN_2_32_FOR(GArray) +GValueArray* g_value_array_append (GValueArray *value_array, + const GValue *value); + +GLIB_DEPRECATED_IN_2_32_FOR(GArray) +GValueArray* g_value_array_insert (GValueArray *value_array, + guint index_, + const GValue *value); + +GLIB_DEPRECATED_IN_2_32_FOR(GArray) +GValueArray* g_value_array_remove (GValueArray *value_array, + guint index_); + +GLIB_DEPRECATED_IN_2_32_FOR(GArray) +GValueArray* g_value_array_sort (GValueArray *value_array, + GCompareFunc compare_func); + +GLIB_DEPRECATED_IN_2_32_FOR(GArray) +GValueArray* g_value_array_sort_with_data (GValueArray *value_array, + GCompareDataFunc compare_func, + gpointer user_data); + + +G_END_DECLS + +#endif /* __G_VALUE_ARRAY_H__ */ +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * gvaluetypes.h: GLib default values + */ +#ifndef __G_VALUETYPES_H__ +#define __G_VALUETYPES_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/* --- type macros --- */ +/** + * G_VALUE_HOLDS_CHAR: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values of type %G_TYPE_CHAR. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_CHAR(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_CHAR)) +/** + * G_VALUE_HOLDS_UCHAR: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values of type %G_TYPE_UCHAR. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_UCHAR(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UCHAR)) +/** + * G_VALUE_HOLDS_BOOLEAN: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values of type %G_TYPE_BOOLEAN. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_BOOLEAN(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_BOOLEAN)) +/** + * G_VALUE_HOLDS_INT: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values of type %G_TYPE_INT. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_INT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT)) +/** + * G_VALUE_HOLDS_UINT: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values of type %G_TYPE_UINT. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_UINT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UINT)) +/** + * G_VALUE_HOLDS_LONG: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values of type %G_TYPE_LONG. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_LONG(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_LONG)) +/** + * G_VALUE_HOLDS_ULONG: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values of type %G_TYPE_ULONG. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_ULONG(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_ULONG)) +/** + * G_VALUE_HOLDS_INT64: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values of type %G_TYPE_INT64. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_INT64(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT64)) +/** + * G_VALUE_HOLDS_UINT64: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values of type %G_TYPE_UINT64. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_UINT64(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UINT64)) +/** + * G_VALUE_HOLDS_FLOAT: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values of type %G_TYPE_FLOAT. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_FLOAT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLOAT)) +/** + * G_VALUE_HOLDS_DOUBLE: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values of type %G_TYPE_DOUBLE. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_DOUBLE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_DOUBLE)) +/** + * G_VALUE_HOLDS_STRING: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values of type %G_TYPE_STRING. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_STRING(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_STRING)) +/** + * G_VALUE_IS_INTERNED_STRING: + * @value: a valid #GValue structure + * + * Checks whether @value contains a string which is canonical. + * + * Returns: %TRUE if the value contains a string in its canonical + * representation, as returned by g_intern_string(). See also + * g_value_set_interned_string(). + * + * Since: 2.66 + */ +#define G_VALUE_IS_INTERNED_STRING(value) (G_VALUE_HOLDS_STRING (value) && ((value)->data[1].v_uint & G_VALUE_INTERNED_STRING)) GLIB_AVAILABLE_MACRO_IN_2_66 +/** + * G_VALUE_HOLDS_POINTER: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values of type %G_TYPE_POINTER. + * + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_POINTER(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_POINTER)) +/** + * G_TYPE_GTYPE: + * + * The type for #GType. + */ +#define G_TYPE_GTYPE (g_gtype_get_type()) +/** + * G_VALUE_HOLDS_GTYPE: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values of type %G_TYPE_GTYPE. + * + * Since: 2.12 + * Returns: %TRUE on success. + */ +#define G_VALUE_HOLDS_GTYPE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_GTYPE)) +/** + * G_VALUE_HOLDS_VARIANT: + * @value: a valid #GValue structure + * + * Checks whether the given #GValue can hold values of type %G_TYPE_VARIANT. + * + * Returns: %TRUE on success. + * + * Since: 2.26 + */ +#define G_VALUE_HOLDS_VARIANT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_VARIANT)) + + +/* --- prototypes --- */ +GLIB_DEPRECATED_IN_2_32_FOR(g_value_set_schar) +void g_value_set_char (GValue *value, + gchar v_char); +GLIB_DEPRECATED_IN_2_32_FOR(g_value_get_schar) +gchar g_value_get_char (const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_schar (GValue *value, + gint8 v_char); +GLIB_AVAILABLE_IN_ALL +gint8 g_value_get_schar (const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_uchar (GValue *value, + guchar v_uchar); +GLIB_AVAILABLE_IN_ALL +guchar g_value_get_uchar (const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_boolean (GValue *value, + gboolean v_boolean); +GLIB_AVAILABLE_IN_ALL +gboolean g_value_get_boolean (const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_int (GValue *value, + gint v_int); +GLIB_AVAILABLE_IN_ALL +gint g_value_get_int (const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_uint (GValue *value, + guint v_uint); +GLIB_AVAILABLE_IN_ALL +guint g_value_get_uint (const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_long (GValue *value, + glong v_long); +GLIB_AVAILABLE_IN_ALL +glong g_value_get_long (const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_ulong (GValue *value, + gulong v_ulong); +GLIB_AVAILABLE_IN_ALL +gulong g_value_get_ulong (const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_int64 (GValue *value, + gint64 v_int64); +GLIB_AVAILABLE_IN_ALL +gint64 g_value_get_int64 (const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_uint64 (GValue *value, + guint64 v_uint64); +GLIB_AVAILABLE_IN_ALL +guint64 g_value_get_uint64 (const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_float (GValue *value, + gfloat v_float); +GLIB_AVAILABLE_IN_ALL +gfloat g_value_get_float (const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_double (GValue *value, + gdouble v_double); +GLIB_AVAILABLE_IN_ALL +gdouble g_value_get_double (const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_string (GValue *value, + const gchar *v_string); +GLIB_AVAILABLE_IN_ALL +void g_value_set_static_string (GValue *value, + const gchar *v_string); +GLIB_AVAILABLE_IN_2_66 +void g_value_set_interned_string (GValue *value, + const gchar *v_string); +GLIB_AVAILABLE_IN_ALL +const gchar * g_value_get_string (const GValue *value); +GLIB_AVAILABLE_IN_ALL +gchar* g_value_dup_string (const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_pointer (GValue *value, + gpointer v_pointer); +GLIB_AVAILABLE_IN_ALL +gpointer g_value_get_pointer (const GValue *value); +GLIB_AVAILABLE_IN_ALL +GType g_gtype_get_type (void); +GLIB_AVAILABLE_IN_ALL +void g_value_set_gtype (GValue *value, + GType v_gtype); +GLIB_AVAILABLE_IN_ALL +GType g_value_get_gtype (const GValue *value); +GLIB_AVAILABLE_IN_ALL +void g_value_set_variant (GValue *value, + GVariant *variant); +GLIB_AVAILABLE_IN_ALL +void g_value_take_variant (GValue *value, + GVariant *variant); +GLIB_AVAILABLE_IN_ALL +GVariant* g_value_get_variant (const GValue *value); +GLIB_AVAILABLE_IN_ALL +GVariant* g_value_dup_variant (const GValue *value); + + +/* Convenience for registering new pointer types */ +GLIB_AVAILABLE_IN_ALL +GType g_pointer_type_register_static (const gchar *name); + +/* debugging aid, describe value contents as string */ +GLIB_AVAILABLE_IN_ALL +gchar* g_strdup_value_contents (const GValue *value); + + +GLIB_AVAILABLE_IN_ALL +void g_value_take_string (GValue *value, + gchar *v_string); +GLIB_DEPRECATED_FOR(g_value_take_string) +void g_value_set_string_take_ownership (GValue *value, + gchar *v_string); + + +/* humpf, need a C representable type name for G_TYPE_STRING */ +/** + * gchararray: + * + * A C representable type name for #G_TYPE_STRING. + */ +typedef gchar* gchararray; + + +G_END_DECLS + +#endif /* __G_VALUETYPES_H__ */ + +/* + * Copyright © 2015 Canonical Limited + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + */ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GClosure, g_closure_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GEnumClass, g_type_class_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFlagsClass, g_type_class_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GObject, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInitiallyUnowned, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GParamSpec, g_param_spec_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTypeClass, g_type_class_unref) +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GValue, g_value_unset) + +#undef __GLIB_GOBJECT_H_INSIDE__ + +GLIB_AVAILABLE_IN_2_68 +void gobject_init (void); + +#endif /* __GLIB_GOBJECT_H__ */ + +G_BEGIN_DECLS + +/* Enumerations from "gumdarwinmodule.h" */ +GType gum_darwin_module_flags_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_DARWIN_MODULE_FLAGS (gum_darwin_module_flags_get_type ()) + +/* Enumerations from "gumdefs.h" */ +GType gum_cpu_type_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_CPU_TYPE (gum_cpu_type_get_type ()) + +/* Enumerations from "guminterceptor.h" */ +GType gum_attach_return_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ATTACH_RETURN (gum_attach_return_get_type ()) +GType gum_replace_return_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_REPLACE_RETURN (gum_replace_return_get_type ()) + +/* Enumerations from "gumprocess.h" */ +GType gum_code_signing_policy_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_CODE_SIGNING_POLICY (gum_code_signing_policy_get_type ()) +G_END_DECLS + +#endif /* __GUM_ENUM_TYPES_H__ */ + +/* Generated data ends here */ + + +#if !defined (GUM_STATIC) && defined (G_OS_WIN32) +# ifdef GUM_EXPORTS +# define GUM_API __declspec(dllexport) +# else +# define GUM_API __declspec(dllimport) +# endif +#else +# define GUM_API +#endif + +#if !defined (__arm__) && !defined (__aarch64__) +# if GLIB_SIZEOF_VOID_P == 4 +# define GUM_NATIVE_CPU GUM_CPU_IA32 +# else +# define GUM_NATIVE_CPU GUM_CPU_AMD64 +# endif +#elif defined (__arm__) || defined (__aarch64__) +# if GLIB_SIZEOF_VOID_P == 4 +# define GUM_NATIVE_CPU GUM_CPU_ARM +# else +# define GUM_NATIVE_CPU GUM_CPU_ARM64 +# endif +#elif defined (__mips__) +# define GUM_NATIVE_CPU GUM_CPU_MIPS +#endif +#ifdef G_OS_WIN32 +# define GUM_NATIVE_ABI GUM_ABI_WINDOWS +# define GUM_NATIVE_ABI_IS_WINDOWS 1 +# define GUM_NATIVE_ABI_IS_UNIX 0 +#else +# define GUM_NATIVE_ABI GUM_ABI_UNIX +# define GUM_NATIVE_ABI_IS_WINDOWS 0 +# define GUM_NATIVE_ABI_IS_UNIX 1 +#endif + +G_BEGIN_DECLS + +typedef guint64 GumAddress; +#define GUM_ADDRESS(a) ((GumAddress) (guintptr) (a)) +#define GUM_TYPE_ADDRESS (gum_address_get_type ()) +typedef guint GumOS; +typedef guint GumCallingConvention; +typedef guint GumAbiType; +typedef guint GumCpuFeatures; +typedef guint GumInstructionEncoding; +typedef guint GumArgType; +typedef struct _GumArgument GumArgument; +typedef guint GumBranchHint; +typedef struct _GumIA32CpuContext GumIA32CpuContext; +typedef struct _GumX64CpuContext GumX64CpuContext; +typedef struct _GumArmCpuContext GumArmCpuContext; +typedef struct _GumArm64CpuContext GumArm64CpuContext; +typedef struct _GumMipsCpuContext GumMipsCpuContext; +/* + * The only non-legacy big-endian configuration on 32-bit ARM systems is BE8. + * In this configuration, whilst the data is in big-endian, the code stream is + * still in little-endian. Since Capstone is disassembling the code stream, it + * should work in little-endian even on BE8 systems. + */ +#if G_BYTE_ORDER == G_LITTLE_ENDIAN || defined (__arm__) +# define GUM_DEFAULT_CS_ENDIAN CS_MODE_LITTLE_ENDIAN +#else +# define GUM_DEFAULT_CS_ENDIAN CS_MODE_BIG_ENDIAN +#endif +#if !defined (__arm__) && !defined (__aarch64__) && !defined (__mips__) +# define GUM_DEFAULT_CS_ARCH CS_ARCH_X86 +# if GLIB_SIZEOF_VOID_P == 4 +/** + * GUM_DEFAULT_CS_MODE: (skip) + */ +# define GUM_DEFAULT_CS_MODE CS_MODE_32 +typedef GumIA32CpuContext GumCpuContext; +# else +/** + * GUM_DEFAULT_CS_MODE: (skip) + */ +# define GUM_DEFAULT_CS_MODE CS_MODE_64 +typedef GumX64CpuContext GumCpuContext; +# endif +#elif defined (__arm__) && !defined (__aarch64__) +# define GUM_DEFAULT_CS_ARCH CS_ARCH_ARM +/** + * GUM_DEFAULT_CS_MODE: (skip) + */ +# define GUM_DEFAULT_CS_MODE \ + ((cs_mode) (CS_MODE_ARM | CS_MODE_V8 | GUM_DEFAULT_CS_ENDIAN)) +# define GUM_PSR_T_BIT 0x20 +typedef GumArmCpuContext GumCpuContext; +#elif defined (__aarch64__) +# define GUM_DEFAULT_CS_ARCH CS_ARCH_ARM64 +/** + * GUM_DEFAULT_CS_MODE: (skip) + */ +# define GUM_DEFAULT_CS_MODE GUM_DEFAULT_CS_ENDIAN +typedef GumArm64CpuContext GumCpuContext; +#elif defined (__mips__) +# define GUM_DEFAULT_CS_ARCH CS_ARCH_MIPS +# if GLIB_SIZEOF_VOID_P == 4 +/** + * GUM_DEFAULT_CS_MODE: (skip) + */ +# define GUM_DEFAULT_CS_MODE ((cs_mode) \ + (CS_MODE_MIPS32 | GUM_DEFAULT_CS_ENDIAN)) +# else +/** + * GUM_DEFAULT_CS_MODE: (skip) + */ +# define GUM_DEFAULT_CS_MODE ((cs_mode) \ + (CS_MODE_MIPS64 | GUM_DEFAULT_CS_ENDIAN)) +# endif +typedef GumMipsCpuContext GumCpuContext; +#endif +typedef guint GumRelocationScenario; + +enum _GumOS +{ + GUM_OS_WINDOWS, + GUM_OS_MACOS, + GUM_OS_LINUX, + GUM_OS_IOS, + GUM_OS_ANDROID, + GUM_OS_QNX +}; + +enum _GumCallingConvention +{ + GUM_CALL_CAPI, + GUM_CALL_SYSAPI +}; + +enum _GumAbiType +{ + GUM_ABI_UNIX, + GUM_ABI_WINDOWS +}; + +typedef enum { + GUM_CPU_INVALID, + GUM_CPU_IA32, + GUM_CPU_AMD64, + GUM_CPU_ARM, + GUM_CPU_ARM64, + GUM_CPU_MIPS +} GumCpuType; + +enum _GumCpuFeatures +{ + GUM_CPU_AVX2 = 1 << 0, + GUM_CPU_VFP2 = 1 << 1, + GUM_CPU_VFP3 = 1 << 2, + GUM_CPU_PTRAUTH = 1 << 3, +}; + +enum _GumInstructionEncoding +{ + GUM_INSTRUCTION_DEFAULT, + GUM_INSTRUCTION_SPECIAL +}; + +enum _GumArgType +{ + GUM_ARG_ADDRESS, + GUM_ARG_REGISTER +}; + +struct _GumArgument +{ + GumArgType type; + + union + { + GumAddress address; + gint reg; + } value; +}; + +enum _GumBranchHint +{ + GUM_NO_HINT, + GUM_LIKELY, + GUM_UNLIKELY +}; + +struct _GumIA32CpuContext +{ + guint32 eip; + + guint32 edi; + guint32 esi; + guint32 ebp; + guint32 esp; + guint32 ebx; + guint32 edx; + guint32 ecx; + guint32 eax; +}; + +struct _GumX64CpuContext +{ + guint64 rip; + + guint64 r15; + guint64 r14; + guint64 r13; + guint64 r12; + guint64 r11; + guint64 r10; + guint64 r9; + guint64 r8; + + guint64 rdi; + guint64 rsi; + guint64 rbp; + guint64 rsp; + guint64 rbx; + guint64 rdx; + guint64 rcx; + guint64 rax; +}; + +struct _GumArmCpuContext +{ + guint32 cpsr; + guint32 pc; + guint32 sp; + + guint32 r8; + guint32 r9; + guint32 r10; + guint32 r11; + guint32 r12; + + guint32 r[8]; + guint32 lr; +}; + +struct _GumArm64CpuContext +{ + guint64 pc; + guint64 sp; + + guint64 x[29]; + guint64 fp; + guint64 lr; + guint8 q[128]; +}; + +struct _GumMipsCpuContext +{ + /* + * This structure represents the register state pushed onto the stack by the + * trampoline which allows us to vector from the original minimal assembly + * hook to architecture agnostic C code inside frida-gum. These registers are + * natively sized. Even if some have not been expanded to 64-bits from the + * MIPS32 architecture MIPS can only perform aligned data access and as such + * pushing zero extended values is simpler than attempting to push minimally + * sized data types. + */ + gsize pc; + + gsize gp; + gsize sp; + gsize fp; + gsize ra; + + gsize hi; + gsize lo; + + gsize at; + + gsize v0; + gsize v1; + + gsize a0; + gsize a1; + gsize a2; + gsize a3; + + gsize t0; + gsize t1; + gsize t2; + gsize t3; + gsize t4; + gsize t5; + gsize t6; + gsize t7; + gsize t8; + gsize t9; + + gsize s0; + gsize s1; + gsize s2; + gsize s3; + gsize s4; + gsize s5; + gsize s6; + gsize s7; + + gsize k0; + gsize k1; +}; + +enum _GumRelocationScenario +{ + GUM_SCENARIO_OFFLINE, + GUM_SCENARIO_ONLINE +}; + +#ifndef __arm__ +# if GLIB_SIZEOF_VOID_P == 8 +# define GUM_CPU_CONTEXT_XAX(c) ((c)->rax) +# define GUM_CPU_CONTEXT_XCX(c) ((c)->rcx) +# define GUM_CPU_CONTEXT_XDX(c) ((c)->rdx) +# define GUM_CPU_CONTEXT_XBX(c) ((c)->rbx) +# define GUM_CPU_CONTEXT_XSP(c) ((c)->rsp) +# define GUM_CPU_CONTEXT_XBP(c) ((c)->rbp) +# define GUM_CPU_CONTEXT_XSI(c) ((c)->rsi) +# define GUM_CPU_CONTEXT_XDI(c) ((c)->rdi) +# define GUM_CPU_CONTEXT_XIP(c) ((c)->rip) +# define GUM_CPU_CONTEXT_OFFSET_XAX (G_STRUCT_OFFSET (GumCpuContext, rax)) +# define GUM_CPU_CONTEXT_OFFSET_XCX (G_STRUCT_OFFSET (GumCpuContext, rcx)) +# define GUM_CPU_CONTEXT_OFFSET_XDX (G_STRUCT_OFFSET (GumCpuContext, rdx)) +# define GUM_CPU_CONTEXT_OFFSET_XBX (G_STRUCT_OFFSET (GumCpuContext, rbx)) +# define GUM_CPU_CONTEXT_OFFSET_XSP (G_STRUCT_OFFSET (GumCpuContext, rsp)) +# define GUM_CPU_CONTEXT_OFFSET_XBP (G_STRUCT_OFFSET (GumCpuContext, rbp)) +# define GUM_CPU_CONTEXT_OFFSET_XSI (G_STRUCT_OFFSET (GumCpuContext, rsi)) +# define GUM_CPU_CONTEXT_OFFSET_XDI (G_STRUCT_OFFSET (GumCpuContext, rdi)) +# define GUM_CPU_CONTEXT_OFFSET_XIP (G_STRUCT_OFFSET (GumCpuContext, rip)) +# else +# define GUM_CPU_CONTEXT_XAX(c) ((c)->eax) +# define GUM_CPU_CONTEXT_XCX(c) ((c)->ecx) +# define GUM_CPU_CONTEXT_XDX(c) ((c)->edx) +# define GUM_CPU_CONTEXT_XBX(c) ((c)->ebx) +# define GUM_CPU_CONTEXT_XSP(c) ((c)->esp) +# define GUM_CPU_CONTEXT_XBP(c) ((c)->ebp) +# define GUM_CPU_CONTEXT_XSI(c) ((c)->esi) +# define GUM_CPU_CONTEXT_XDI(c) ((c)->edi) +# define GUM_CPU_CONTEXT_XIP(c) ((c)->eip) +# define GUM_CPU_CONTEXT_OFFSET_XAX (G_STRUCT_OFFSET (GumCpuContext, eax)) +# define GUM_CPU_CONTEXT_OFFSET_XCX (G_STRUCT_OFFSET (GumCpuContext, ecx)) +# define GUM_CPU_CONTEXT_OFFSET_XDX (G_STRUCT_OFFSET (GumCpuContext, edx)) +# define GUM_CPU_CONTEXT_OFFSET_XBX (G_STRUCT_OFFSET (GumCpuContext, ebx)) +# define GUM_CPU_CONTEXT_OFFSET_XSP (G_STRUCT_OFFSET (GumCpuContext, esp)) +# define GUM_CPU_CONTEXT_OFFSET_XBP (G_STRUCT_OFFSET (GumCpuContext, ebp)) +# define GUM_CPU_CONTEXT_OFFSET_XSI (G_STRUCT_OFFSET (GumCpuContext, esi)) +# define GUM_CPU_CONTEXT_OFFSET_XDI (G_STRUCT_OFFSET (GumCpuContext, edi)) +# define GUM_CPU_CONTEXT_OFFSET_XIP (G_STRUCT_OFFSET (GumCpuContext, eip)) +# endif +#endif + +#define GUM_MAX_PATH 260 +#define GUM_MAX_TYPE_NAME 16 +#define GUM_MAX_SYMBOL_NAME 2048 + +#define GUM_MAX_THREADS 768 +#define GUM_MAX_CALL_DEPTH 32 +#define GUM_MAX_BACKTRACE_DEPTH 16 +#define GUM_MAX_WORST_CASE_INFO_SIZE 128 + +#define GUM_MAX_LISTENERS_PER_FUNCTION 2 +#define GUM_MAX_LISTENER_DATA 512 + +#define GUM_MAX_THREAD_RANGES 2 + +#if GLIB_SIZEOF_VOID_P == 8 +#define GUM_CPU_MODE CS_MODE_64 +#define GUM_THUNK +#else +#define GUM_CPU_MODE CS_MODE_32 +#define GUM_THUNK GUM_FASTCALL +#endif +#if !defined (G_OS_WIN32) && GLIB_SIZEOF_VOID_P == 8 +# define GUM_THUNK_REG_ARG0 GUM_REG_XDI +# define GUM_THUNK_REG_ARG1 GUM_REG_XSI +#else +# define GUM_THUNK_REG_ARG0 GUM_REG_XCX +# define GUM_THUNK_REG_ARG1 GUM_REG_XDX +#endif +#define GUM_RED_ZONE_SIZE 128 + +#ifdef _MSC_VER +# define GUM_CDECL __cdecl +# define GUM_STDCALL __stdcall +# define GUM_FASTCALL __fastcall +# define GUM_NOINLINE __declspec (noinline) +#else +# ifndef __arm__ +# if GLIB_SIZEOF_VOID_P == 4 +# define GUM_CDECL __attribute__((cdecl)) +# define GUM_STDCALL __attribute__((stdcall)) +# else +# define GUM_CDECL +# define GUM_STDCALL +# endif +# define GUM_FASTCALL __attribute__((fastcall)) +# else +# define GUM_CDECL +# define GUM_STDCALL +# define GUM_FASTCALL +# endif +# define GUM_NOINLINE __attribute__((noinline)) +#endif + +#define GUM_ALIGN_POINTER(t, p, b) \ + ((t) GSIZE_TO_POINTER (((GPOINTER_TO_SIZE (p) + ((gsize) (b - 1))) & \ + ~((gsize) (b - 1))))) +#define GUM_ALIGN_SIZE(s, b) \ + ((((gsize) s) + ((gsize) (b - 1))) & ~((gsize) (b - 1))) + +#define GUM_FUNCPTR_TO_POINTER(f) (GSIZE_TO_POINTER (f)) +#define GUM_POINTER_TO_FUNCPTR(t, p) ((t) GPOINTER_TO_SIZE (p)) + +#define GUM_INT2_MASK 0x00000003U +#define GUM_INT4_MASK 0x0000000fU +#define GUM_INT5_MASK 0x0000001fU +#define GUM_INT6_MASK 0x0000003fU +#define GUM_INT8_MASK 0x000000ffU +#define GUM_INT10_MASK 0x000003ffU +#define GUM_INT11_MASK 0x000007ffU +#define GUM_INT12_MASK 0x00000fffU +#define GUM_INT14_MASK 0x00003fffU +#define GUM_INT16_MASK 0x0000ffffU +#define GUM_INT18_MASK 0x0003ffffU +#define GUM_INT19_MASK 0x0007ffffU +#define GUM_INT24_MASK 0x00ffffffU +#define GUM_INT26_MASK 0x03ffffffU +#define GUM_INT28_MASK 0x0fffffffU +#define GUM_INT32_MASK 0xffffffffU + +#define GUM_IS_WITHIN_UINT7_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (0) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (127)) +#define GUM_IS_WITHIN_UINT8_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (0) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (255)) +#define GUM_IS_WITHIN_INT8_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-128) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (127)) +#define GUM_IS_WITHIN_INT11_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-1024) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (1023)) +#define GUM_IS_WITHIN_INT14_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-8192) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (8191)) +#define GUM_IS_WITHIN_INT16_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-32768) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (32767)) +#define GUM_IS_WITHIN_INT18_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-131072) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (131071)) +#define GUM_IS_WITHIN_INT19_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-262144) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (262143)) +#define GUM_IS_WITHIN_INT20_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-524288) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (524287)) +#define GUM_IS_WITHIN_INT21_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-1048576) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (1048575)) +#define GUM_IS_WITHIN_INT24_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-8388608) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (8388607)) +#define GUM_IS_WITHIN_INT26_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-33554432) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (33554431)) +#define GUM_IS_WITHIN_INT28_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-134217728) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (134217727)) +#define GUM_IS_WITHIN_INT32_RANGE(i) \ + (((gint64) (i)) >= (gint64) G_MININT32 && \ + ((gint64) (i)) <= (gint64) G_MAXINT32) + +GUM_API GumCpuFeatures gum_query_cpu_features (void); + +GUM_API gpointer gum_cpu_context_get_nth_argument (GumCpuContext * self, + guint n); +GUM_API void gum_cpu_context_replace_nth_argument (GumCpuContext * self, + guint n, gpointer value); +GUM_API gpointer gum_cpu_context_get_return_value (GumCpuContext * self); +GUM_API void gum_cpu_context_replace_return_value (GumCpuContext * self, + gpointer value); + +GUM_API GType gum_address_get_type (void) G_GNUC_CONST; + +G_END_DECLS + +#endif + +/* + * Copyright (C) 2016-2018 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_API_RESOLVER_H__ +#define __GUM_API_RESOLVER_H__ + + +G_BEGIN_DECLS + +#define GUM_TYPE_API_RESOLVER (gum_api_resolver_get_type ()) +G_DECLARE_INTERFACE (GumApiResolver, gum_api_resolver, GUM, API_RESOLVER, + GObject) + +typedef struct _GumApiDetails GumApiDetails; + +typedef gboolean (* GumFoundApiFunc) (const GumApiDetails * details, + gpointer user_data); + +struct _GumApiResolverInterface +{ + GTypeInterface parent; + + void (* enumerate_matches) (GumApiResolver * self, const gchar * query, + GumFoundApiFunc func, gpointer user_data, GError ** error); +}; + +struct _GumApiDetails +{ + const gchar * name; + GumAddress address; +}; + +GUM_API GumApiResolver * gum_api_resolver_make (const gchar * type); + +GUM_API void gum_api_resolver_enumerate_matches (GumApiResolver * self, + const gchar * query, GumFoundApiFunc func, gpointer user_data, + GError ** error); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2008-2018 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_BACKTRACER_H__ +#define __GUM_BACKTRACER_H__ + +/* + * Copyright (C) 2008-2010 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_RETURN_ADDRESS_H__ +#define __GUM_RETURN_ADDRESS_H__ + + +typedef struct _GumReturnAddressDetails GumReturnAddressDetails; +typedef gpointer GumReturnAddress; +typedef struct _GumReturnAddressArray GumReturnAddressArray; + +struct _GumReturnAddressDetails +{ + GumReturnAddress address; + gchar module_name[GUM_MAX_PATH + 1]; + gchar function_name[GUM_MAX_SYMBOL_NAME + 1]; + gchar file_name[GUM_MAX_PATH + 1]; + guint line_number; +}; + +struct _GumReturnAddressArray +{ + guint len; + GumReturnAddress items[GUM_MAX_BACKTRACE_DEPTH]; +}; + +G_BEGIN_DECLS + +GUM_API gboolean gum_return_address_details_from_address ( + GumReturnAddress address, GumReturnAddressDetails * details); + +GUM_API gboolean gum_return_address_array_is_equal ( + const GumReturnAddressArray * array1, + const GumReturnAddressArray * array2); + +G_END_DECLS + +#endif + +G_BEGIN_DECLS + +#define GUM_TYPE_BACKTRACER (gum_backtracer_get_type ()) +G_DECLARE_INTERFACE (GumBacktracer, gum_backtracer, GUM, BACKTRACER, GObject) + +struct _GumBacktracerInterface +{ + GTypeInterface parent; + + void (* generate) (GumBacktracer * self, const GumCpuContext * cpu_context, + GumReturnAddressArray * return_addresses); +}; + +GUM_API GumBacktracer * gum_backtracer_make_accurate (void); +GUM_API GumBacktracer * gum_backtracer_make_fuzzy (void); + +GUM_API void gum_backtracer_generate (GumBacktracer * self, + const GumCpuContext * cpu_context, + GumReturnAddressArray * return_addresses); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2017-2018 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_CLOAK_H__ +#define __GUM_CLOAK_H__ + +/* + * Copyright (C) 2008-2020 Ole André Vadla Ravnås + * Copyright (C) 2008 Christian Berentsen + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_MEMORY_H__ +#define __GUM_MEMORY_H__ + + +#define GUM_TYPE_MEMORY_RANGE (gum_memory_range_get_type ()) +#define GUM_MEMORY_RANGE_INCLUDES(r, a) ((a) >= (r)->base_address && \ + (a) < ((r)->base_address + (r)->size)) + +#define GUM_PAGE_RW ((GumPageProtection) (GUM_PAGE_READ | GUM_PAGE_WRITE)) +#define GUM_PAGE_RX ((GumPageProtection) (GUM_PAGE_READ | GUM_PAGE_EXECUTE)) +#define GUM_PAGE_RWX ((GumPageProtection) (GUM_PAGE_READ | GUM_PAGE_WRITE | \ + GUM_PAGE_EXECUTE)) + +G_BEGIN_DECLS + +typedef guint GumPtrauthSupport; +typedef guint GumRwxSupport; +typedef guint GumMemoryOperation; +typedef guint GumPageProtection; +typedef struct _GumAddressSpec GumAddressSpec; +typedef struct _GumMemoryRange GumMemoryRange; +typedef struct _GumMatchPattern GumMatchPattern; + +typedef gboolean (* GumMemoryIsNearFunc) (gpointer memory, gpointer address); + +enum _GumPtrauthSupport +{ + GUM_PTRAUTH_INVALID, + GUM_PTRAUTH_UNSUPPORTED, + GUM_PTRAUTH_SUPPORTED +}; + +enum _GumRwxSupport +{ + GUM_RWX_NONE, + GUM_RWX_ALLOCATIONS_ONLY, + GUM_RWX_FULL +}; + +enum _GumMemoryOperation +{ + GUM_MEMOP_INVALID, + GUM_MEMOP_READ, + GUM_MEMOP_WRITE, + GUM_MEMOP_EXECUTE +}; + +enum _GumPageProtection +{ + GUM_PAGE_NO_ACCESS = 0, + GUM_PAGE_READ = (1 << 0), + GUM_PAGE_WRITE = (1 << 1), + GUM_PAGE_EXECUTE = (1 << 2), +}; + +struct _GumAddressSpec +{ + gpointer near_address; + gsize max_distance; +}; + +struct _GumMemoryRange +{ + GumAddress base_address; + gsize size; +}; + +typedef void (* GumMemoryPatchApplyFunc) (gpointer mem, gpointer user_data); +typedef gboolean (* GumMemoryScanMatchFunc) (GumAddress address, gsize size, + gpointer user_data); + +GUM_API void gum_internal_heap_ref (void); +GUM_API void gum_internal_heap_unref (void); + +GUM_API gpointer gum_sign_code_pointer (gpointer value); +GUM_API gpointer gum_strip_code_pointer (gpointer value); +GUM_API GumAddress gum_sign_code_address (GumAddress value); +GUM_API GumAddress gum_strip_code_address (GumAddress value); +GUM_API GumPtrauthSupport gum_query_ptrauth_support (void); +GUM_API guint gum_query_page_size (void); +GUM_API gboolean gum_query_is_rwx_supported (void); +GUM_API GumRwxSupport gum_query_rwx_support (void); +GUM_API gboolean gum_memory_is_readable (gconstpointer address, gsize len); +GUM_API guint8 * gum_memory_read (gconstpointer address, gsize len, + gsize * n_bytes_read); +GUM_API gboolean gum_memory_write (gpointer address, const guint8 * bytes, + gsize len); +GUM_API gboolean gum_memory_patch_code (gpointer address, gsize size, + GumMemoryPatchApplyFunc apply, gpointer apply_data); +GUM_API gboolean gum_memory_mark_code (gpointer address, gsize size); + +GUM_API void gum_memory_scan (const GumMemoryRange * range, + const GumMatchPattern * pattern, GumMemoryScanMatchFunc func, + gpointer user_data); + +GUM_API GumMatchPattern * gum_match_pattern_new_from_string ( + const gchar * match_combined_str); +GUM_API void gum_match_pattern_free (GumMatchPattern * pattern); + +GUM_API void gum_ensure_code_readable (gconstpointer address, gsize size); + +GUM_API void gum_mprotect (gpointer address, gsize size, + GumPageProtection page_prot); +GUM_API gboolean gum_try_mprotect (gpointer address, gsize size, + GumPageProtection page_prot); + +GUM_API void gum_clear_cache (gpointer address, gsize size); + +#define gum_new(struct_type, n_structs) \ + ((struct_type *) gum_malloc (n_structs * sizeof (struct_type))) +#define gum_new0(struct_type, n_structs) \ + ((struct_type *) gum_malloc0 (n_structs * sizeof (struct_type))) + +GUM_API guint gum_peek_private_memory_usage (void); + +GUM_API gpointer gum_malloc (gsize size); +GUM_API gpointer gum_malloc0 (gsize size); +GUM_API gsize gum_malloc_usable_size (gconstpointer mem); +GUM_API gpointer gum_calloc (gsize count, gsize size); +GUM_API gpointer gum_realloc (gpointer mem, gsize size); +GUM_API gpointer gum_memalign (gsize alignment, gsize size); +GUM_API gpointer gum_memdup (gconstpointer mem, gsize byte_size); +GUM_API void gum_free (gpointer mem); + +GUM_API gpointer gum_alloc_n_pages (guint n_pages, GumPageProtection page_prot); +GUM_API gpointer gum_try_alloc_n_pages (guint n_pages, + GumPageProtection page_prot); +GUM_API gpointer gum_alloc_n_pages_near (guint n_pages, + GumPageProtection page_prot, const GumAddressSpec * address_spec); +GUM_API gpointer gum_try_alloc_n_pages_near (guint n_pages, + GumPageProtection page_prot, const GumAddressSpec * address_spec); +GUM_API void gum_query_page_allocation_range (gconstpointer mem, guint size, + GumMemoryRange * range); +GUM_API void gum_free_pages (gpointer mem); + +GUM_API gpointer gum_memory_allocate (gpointer address, gsize size, + gsize alignment, GumPageProtection page_prot); +GUM_API gboolean gum_memory_free (gpointer address, gsize size); +GUM_API gboolean gum_memory_release (gpointer address, gsize size); +GUM_API gboolean gum_memory_commit (gpointer address, gsize size, + GumPageProtection page_prot); +GUM_API gboolean gum_memory_decommit (gpointer address, gsize size); + +GUM_API GType gum_memory_range_get_type (void) G_GNUC_CONST; +GUM_API GumMemoryRange * gum_memory_range_copy (const GumMemoryRange * range); +GUM_API void gum_memory_range_free (GumMemoryRange * range); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2008-2020 Ole André Vadla Ravnås + * Copyright (C) 2020 Francesco Tamagni + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_PROCESS_H__ +#define __GUM_PROCESS_H__ + + +#define GUM_THREAD_ID_INVALID ((GumThreadId) -1) + +#define GUM_TYPE_MODULE_DETAILS (gum_module_details_get_type ()) + +G_BEGIN_DECLS + +typedef guint GumProcessId; +typedef gsize GumThreadId; +typedef guint GumThreadState; +typedef struct _GumThreadDetails GumThreadDetails; +typedef struct _GumModuleDetails GumModuleDetails; +typedef guint GumImportType; +typedef guint GumExportType; +typedef guint GumSymbolType; +typedef struct _GumImportDetails GumImportDetails; +typedef struct _GumExportDetails GumExportDetails; +typedef struct _GumSymbolDetails GumSymbolDetails; +typedef struct _GumSymbolSection GumSymbolSection; +typedef struct _GumRangeDetails GumRangeDetails; +typedef struct _GumFileMapping GumFileMapping; +typedef struct _GumMallocRangeDetails GumMallocRangeDetails; + +typedef enum { + GUM_CODE_SIGNING_OPTIONAL, + GUM_CODE_SIGNING_REQUIRED +} GumCodeSigningPolicy; + +enum _GumThreadState +{ + GUM_THREAD_RUNNING = 1, + GUM_THREAD_STOPPED, + GUM_THREAD_WAITING, + GUM_THREAD_UNINTERRUPTIBLE, + GUM_THREAD_HALTED +}; + +struct _GumThreadDetails +{ + GumThreadId id; + GumThreadState state; + GumCpuContext cpu_context; +}; + +struct _GumModuleDetails +{ + const gchar * name; + const GumMemoryRange * range; + const gchar * path; +}; + +enum _GumImportType +{ + GUM_IMPORT_UNKNOWN, + GUM_IMPORT_FUNCTION, + GUM_IMPORT_VARIABLE +}; + +enum _GumExportType +{ + GUM_EXPORT_FUNCTION = 1, + GUM_EXPORT_VARIABLE +}; + +enum _GumSymbolType +{ + /* Common */ + GUM_SYMBOL_UNKNOWN, + GUM_SYMBOL_SECTION, + + /* Mach-O */ + GUM_SYMBOL_UNDEFINED, + GUM_SYMBOL_ABSOLUTE, + GUM_SYMBOL_PREBOUND_UNDEFINED, + GUM_SYMBOL_INDIRECT, + + /* ELF */ + GUM_SYMBOL_OBJECT, + GUM_SYMBOL_FUNCTION, + GUM_SYMBOL_FILE, + GUM_SYMBOL_COMMON, + GUM_SYMBOL_TLS, +}; + +struct _GumImportDetails +{ + GumImportType type; + const gchar * name; + const gchar * module; + GumAddress address; + GumAddress slot; +}; + +struct _GumExportDetails +{ + GumExportType type; + const gchar * name; + GumAddress address; +}; + +struct _GumSymbolDetails +{ + gboolean is_global; + GumSymbolType type; + const GumSymbolSection * section; + const gchar * name; + GumAddress address; + gssize size; +}; + +struct _GumSymbolSection +{ + const gchar * id; + GumPageProtection protection; +}; + +struct _GumRangeDetails +{ + const GumMemoryRange * range; + GumPageProtection protection; + const GumFileMapping * file; +}; + +struct _GumFileMapping +{ + const gchar * path; + guint64 offset; + gsize size; +}; + +struct _GumMallocRangeDetails +{ + const GumMemoryRange * range; +}; + +typedef void (* GumModifyThreadFunc) (GumThreadId thread_id, + GumCpuContext * cpu_context, gpointer user_data); +typedef gboolean (* GumFoundThreadFunc) (const GumThreadDetails * details, + gpointer user_data); +typedef gboolean (* GumFoundModuleFunc) (const GumModuleDetails * details, + gpointer user_data); +typedef gboolean (* GumFoundImportFunc) (const GumImportDetails * details, + gpointer user_data); +typedef gboolean (* GumFoundExportFunc) (const GumExportDetails * details, + gpointer user_data); +typedef gboolean (* GumFoundSymbolFunc) (const GumSymbolDetails * details, + gpointer user_data); +typedef gboolean (* GumFoundRangeFunc) (const GumRangeDetails * details, + gpointer user_data); +typedef gboolean (* GumFoundMallocRangeFunc) ( + const GumMallocRangeDetails * details, gpointer user_data); + +GUM_API GumOS gum_process_get_native_os (void); +GUM_API GumCodeSigningPolicy gum_process_get_code_signing_policy (void); +GUM_API void gum_process_set_code_signing_policy (GumCodeSigningPolicy policy); +GUM_API const gchar * gum_process_query_libc_name (void); +GUM_API gboolean gum_process_is_debugger_attached (void); +GUM_API GumProcessId gum_process_get_id (void); +GUM_API GumThreadId gum_process_get_current_thread_id (void); +GUM_API gboolean gum_process_has_thread (GumThreadId thread_id); +GUM_API gboolean gum_process_modify_thread (GumThreadId thread_id, + GumModifyThreadFunc func, gpointer user_data); +GUM_API void gum_process_enumerate_threads (GumFoundThreadFunc func, + gpointer user_data); +GUM_API void gum_process_enumerate_modules (GumFoundModuleFunc func, + gpointer user_data); +GUM_API void gum_process_enumerate_ranges (GumPageProtection prot, + GumFoundRangeFunc func, gpointer user_data); +GUM_API void gum_process_enumerate_malloc_ranges ( + GumFoundMallocRangeFunc func, gpointer user_data); +GUM_API guint gum_thread_try_get_ranges (GumMemoryRange * ranges, + guint max_length); +GUM_API gint gum_thread_get_system_error (void); +GUM_API void gum_thread_set_system_error (gint value); +GUM_API gboolean gum_module_load (const gchar * module_name, GError ** error); +GUM_API gboolean gum_module_ensure_initialized (const gchar * module_name); +GUM_API void gum_module_enumerate_imports (const gchar * module_name, + GumFoundImportFunc func, gpointer user_data); +GUM_API void gum_module_enumerate_exports (const gchar * module_name, + GumFoundExportFunc func, gpointer user_data); +GUM_API void gum_module_enumerate_symbols (const gchar * module_name, + GumFoundSymbolFunc func, gpointer user_data); +GUM_API void gum_module_enumerate_ranges (const gchar * module_name, + GumPageProtection prot, GumFoundRangeFunc func, gpointer user_data); +GUM_API GumAddress gum_module_find_base_address (const gchar * module_name); +GUM_API GumAddress gum_module_find_export_by_name (const gchar * module_name, + const gchar * symbol_name); +GUM_API GumAddress gum_module_find_symbol_by_name (const gchar * module_name, + const gchar * symbol_name); + +GUM_API const gchar * gum_code_signing_policy_to_string ( + GumCodeSigningPolicy policy); + +GUM_API GType gum_module_details_get_type (void) G_GNUC_CONST; +GUM_API GumModuleDetails * gum_module_details_copy ( + const GumModuleDetails * module); +GUM_API void gum_module_details_free (GumModuleDetails * module); + +GUM_API const gchar * gum_symbol_type_to_string (GumSymbolType type); + +G_END_DECLS + +#endif + +G_BEGIN_DECLS + +typedef gboolean (* GumCloakFoundThreadFunc) (GumThreadId id, + gpointer user_data); +typedef gboolean (* GumCloakFoundRangeFunc) (const GumMemoryRange * range, + gpointer user_data); +typedef gboolean (* GumCloakFoundFDFunc) (gint fd, gpointer user_data); + +GUM_API void gum_cloak_add_thread (GumThreadId id); +GUM_API void gum_cloak_remove_thread (GumThreadId id); +GUM_API gboolean gum_cloak_has_thread (GumThreadId id); +GUM_API void gum_cloak_enumerate_threads (GumCloakFoundThreadFunc func, + gpointer user_data); + +GUM_API void gum_cloak_add_range (const GumMemoryRange * range); +GUM_API void gum_cloak_remove_range (const GumMemoryRange * range); +GUM_API GArray * gum_cloak_clip_range (const GumMemoryRange * range); +GUM_API void gum_cloak_enumerate_ranges (GumCloakFoundRangeFunc func, + gpointer user_data); + +GUM_API void gum_cloak_add_file_descriptor (gint fd); +GUM_API void gum_cloak_remove_file_descriptor (gint fd); +GUM_API gboolean gum_cloak_has_file_descriptor (gint fd); +GUM_API void gum_cloak_enumerate_file_descriptors (GumCloakFoundFDFunc func, + gpointer user_data); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2010 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_CODE_ALLOCATOR_H__ +#define __GUM_CODE_ALLOCATOR_H__ + + +typedef struct _GumCodeAllocator GumCodeAllocator; +typedef struct _GumCodeSlice GumCodeSlice; +typedef struct _GumCodeDeflector GumCodeDeflector; + +struct _GumCodeAllocator +{ + gsize slice_size; + gsize pages_per_batch; + gsize slices_per_batch; + gsize pages_metadata_size; + + GSList * uncommitted_pages; + GHashTable * dirty_pages; + GList * free_slices; + + GSList * dispatchers; +}; + +struct _GumCodeSlice +{ + gpointer data; + gsize size; +}; + +struct _GumCodeDeflector +{ + gpointer return_address; + gpointer target; + gpointer trampoline; +}; + +void gum_code_allocator_init (GumCodeAllocator * allocator, gsize slice_size); +void gum_code_allocator_free (GumCodeAllocator * allocator); + +GumCodeSlice * gum_code_allocator_alloc_slice (GumCodeAllocator * self); +GumCodeSlice * gum_code_allocator_try_alloc_slice_near (GumCodeAllocator * self, + const GumAddressSpec * spec, gsize alignment); +void gum_code_allocator_commit (GumCodeAllocator * self); +void gum_code_slice_free (GumCodeSlice * slice); + +GumCodeDeflector * gum_code_allocator_alloc_deflector (GumCodeAllocator * self, + const GumAddressSpec * caller, gpointer return_address, gpointer target, + gboolean dedicated); +void gum_code_deflector_free (GumCodeDeflector * deflector); + +#endif +/* + * Copyright (C) 2016-2019 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_CODE_SEGMENT_H__ +#define __GUM_CODE_SEGMENT_H__ + + +G_BEGIN_DECLS + +typedef struct _GumCodeSegment GumCodeSegment; + +GUM_API gboolean gum_code_segment_is_supported (void); + +GUM_API GumCodeSegment * gum_code_segment_new (gsize size, + const GumAddressSpec * spec); +GUM_API void gum_code_segment_free (GumCodeSegment * segment); + +GUM_API gpointer gum_code_segment_get_address (GumCodeSegment * self); +GUM_API gsize gum_code_segment_get_size (GumCodeSegment * self); +GUM_API gsize gum_code_segment_get_virtual_size (GumCodeSegment * self); + +GUM_API void gum_code_segment_realize (GumCodeSegment * self); +GUM_API void gum_code_segment_map (GumCodeSegment * self, gsize source_offset, + gsize source_size, gpointer target_address); + +GUM_API gboolean gum_code_segment_mark (gpointer code, gsize size, + GError ** error); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2015-2020 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_DARWIN_MODULE_H__ +#define __GUM_DARWIN_MODULE_H__ + + +#define GUM_DARWIN_EXPORT_SYMBOL_FLAGS_KIND_ABSOLUTE 2 + +G_BEGIN_DECLS + +#define GUM_TYPE_DARWIN_MODULE (gum_darwin_module_get_type ()) +G_DECLARE_FINAL_TYPE (GumDarwinModule, gum_darwin_module, GUM_DARWIN, MODULE, + GObject) + +#define GUM_DARWIN_PORT_NULL 0 +#define GUM_DARWIN_EXPORT_KIND_MASK 3 + +typedef guint GumDarwinModuleFiletype; +typedef gint GumDarwinCpuType; +typedef gint GumDarwinCpuSubtype; + +typedef struct _GumDarwinModuleImage GumDarwinModuleImage; + +typedef struct _GumDarwinModuleImageSegment GumDarwinModuleImageSegment; +typedef struct _GumDarwinSectionDetails GumDarwinSectionDetails; +typedef struct _GumDarwinChainedFixupsDetails GumDarwinChainedFixupsDetails; +typedef struct _GumDarwinRebaseDetails GumDarwinRebaseDetails; +typedef struct _GumDarwinBindDetails GumDarwinBindDetails; +typedef struct _GumDarwinThreadedItem GumDarwinThreadedItem; +typedef struct _GumDarwinInitPointersDetails GumDarwinInitPointersDetails; +typedef struct _GumDarwinInitOffsetsDetails GumDarwinInitOffsetsDetails; +typedef struct _GumDarwinTermPointersDetails GumDarwinTermPointersDetails; +typedef struct _GumDarwinSegment GumDarwinSegment; +typedef struct _GumDarwinExportDetails GumDarwinExportDetails; +typedef struct _GumDarwinSymbolDetails GumDarwinSymbolDetails; + +typedef guint8 GumDarwinRebaseType; +typedef guint8 GumDarwinBindType; +typedef guint8 GumDarwinThreadedItemType; +typedef gint GumDarwinBindOrdinal; +typedef guint8 GumDarwinBindSymbolFlags; +typedef guint8 GumDarwinExportSymbolKind; +typedef guint8 GumDarwinExportSymbolFlags; + +typedef guint GumDarwinPort; +typedef gint GumDarwinPageProtection; + +typedef gboolean (* GumFoundDarwinExportFunc) ( + const GumDarwinExportDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinSymbolFunc) ( + const GumDarwinSymbolDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinSectionFunc) ( + const GumDarwinSectionDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinChainedFixupsFunc) ( + const GumDarwinChainedFixupsDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinRebaseFunc) ( + const GumDarwinRebaseDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinBindFunc) ( + const GumDarwinBindDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinInitPointersFunc) ( + const GumDarwinInitPointersDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinInitOffsetsFunc) ( + const GumDarwinInitOffsetsDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinTermPointersFunc) ( + const GumDarwinTermPointersDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinDependencyFunc) (const gchar * path, + gpointer user_data); + +typedef struct _GumDyldInfoCommand GumDyldInfoCommand; +typedef struct _GumSymtabCommand GumSymtabCommand; +typedef struct _GumDysymtabCommand GumDysymtabCommand; + +typedef enum { + GUM_DARWIN_MODULE_FLAGS_NONE = 0, + GUM_DARWIN_MODULE_FLAGS_HEADER_ONLY = (1 << 0), +} GumDarwinModuleFlags; + +struct _GumDarwinModule +{ + GObject parent; + + GumDarwinModuleFiletype filetype; + gchar * name; + gchar * uuid; + + GumDarwinPort task; + gboolean is_local; + gboolean is_kernel; + GumCpuType cpu_type; + GumPtrauthSupport ptrauth_support; + gsize pointer_size; + GumAddress base_address; + gchar * source_path; + GBytes * source_blob; + GumDarwinModuleFlags flags; + + GumDarwinModuleImage * image; + + const GumDyldInfoCommand * info; + const GumSymtabCommand * symtab; + const GumDysymtabCommand * dysymtab; + + GumAddress preferred_address; + + GArray * segments; + GArray * text_ranges; + + const guint8 * rebases; + const guint8 * rebases_end; + gpointer rebases_malloc_data; + + const guint8 * binds; + const guint8 * binds_end; + gpointer binds_malloc_data; + + const guint8 * lazy_binds; + const guint8 * lazy_binds_end; + gpointer lazy_binds_malloc_data; + + const guint8 * exports; + const guint8 * exports_end; + gpointer exports_malloc_data; + + GPtrArray * dependencies; + GPtrArray * reexports; +}; + +enum _GumDarwinModuleFiletype +{ + GUM_DARWIN_MODULE_FILETYPE_OBJECT = 1, + GUM_DARWIN_MODULE_FILETYPE_EXECUTE, + GUM_DARWIN_MODULE_FILETYPE_FVMLIB, + GUM_DARWIN_MODULE_FILETYPE_CORE, + GUM_DARWIN_MODULE_FILETYPE_PRELOAD, + GUM_DARWIN_MODULE_FILETYPE_DYLIB, + GUM_DARWIN_MODULE_FILETYPE_DYLINKER, + GUM_DARWIN_MODULE_FILETYPE_BUNDLE, + GUM_DARWIN_MODULE_FILETYPE_DYLIB_STUB, + GUM_DARWIN_MODULE_FILETYPE_DSYM, + GUM_DARWIN_MODULE_FILETYPE_KEXT_BUNDLE, + GUM_DARWIN_MODULE_FILETYPE_FILESET, +}; + +enum _GumDarwinCpuArchType +{ + GUM_DARWIN_CPU_ARCH_ABI64 = 0x01000000, + GUM_DARWIN_CPU_ARCH_ABI64_32 = 0x02000000, +}; + +enum _GumDarwinCpuType +{ + GUM_DARWIN_CPU_X86 = 7, + GUM_DARWIN_CPU_X86_64 = 7 | GUM_DARWIN_CPU_ARCH_ABI64, + GUM_DARWIN_CPU_ARM = 12, + GUM_DARWIN_CPU_ARM64 = 12 | GUM_DARWIN_CPU_ARCH_ABI64, + GUM_DARWIN_CPU_ARM64_32 = 12 | GUM_DARWIN_CPU_ARCH_ABI64_32, +}; + +enum _GumDarwinCpuSubtype +{ + GUM_DARWIN_CPU_SUBTYPE_ARM64E = 2, + + GUM_DARWIN_CPU_SUBTYPE_MASK = 0x00ffffff, +}; + +struct _GumDarwinModuleImage +{ + gpointer data; + guint64 size; + gconstpointer linkedit; + + guint64 source_offset; + guint64 source_size; + guint64 shared_offset; + guint64 shared_size; + GArray * shared_segments; + + GBytes * bytes; + gpointer malloc_data; +}; + +struct _GumDarwinModuleImageSegment +{ + guint64 offset; + guint64 size; + GumDarwinPageProtection protection; +}; + +struct _GumDarwinSectionDetails +{ + gchar segment_name[17]; + gchar section_name[17]; + GumAddress vm_address; + guint64 size; + GumDarwinPageProtection protection; + guint32 file_offset; + guint32 flags; +}; + +struct _GumDarwinChainedFixupsDetails +{ + GumAddress vm_address; + guint64 file_offset; + guint32 size; +}; + +struct _GumDarwinRebaseDetails +{ + const GumDarwinSegment * segment; + guint64 offset; + GumDarwinRebaseType type; + GumAddress slide; +}; + +struct _GumDarwinBindDetails +{ + const GumDarwinSegment * segment; + guint64 offset; + GumDarwinBindType type; + GumDarwinBindOrdinal library_ordinal; + const gchar * symbol_name; + GumDarwinBindSymbolFlags symbol_flags; + gint64 addend; + guint16 threaded_table_size; +}; + +struct _GumDarwinThreadedItem +{ + gboolean is_authenticated; + GumDarwinThreadedItemType type; + guint16 delta; + guint8 key; + gboolean has_address_diversity; + guint16 diversity; + + guint16 bind_ordinal; + + GumAddress rebase_address; +}; + +struct _GumDarwinInitPointersDetails +{ + GumAddress address; + guint64 count; +}; + +struct _GumDarwinInitOffsetsDetails +{ + GumAddress address; + guint64 count; +}; + +struct _GumDarwinTermPointersDetails +{ + GumAddress address; + guint64 count; +}; + +struct _GumDarwinSegment +{ + gchar name[17]; + GumAddress vm_address; + guint64 vm_size; + guint64 file_offset; + guint64 file_size; + GumDarwinPageProtection protection; +}; + +struct _GumDarwinExportDetails +{ + const gchar * name; + guint64 flags; + + union + { + struct + { + guint64 offset; + }; + + struct + { + guint64 stub; + guint64 resolver; + }; + + struct + { + gint reexport_library_ordinal; + const gchar * reexport_symbol; + }; + }; +}; + +struct _GumDarwinSymbolDetails +{ + const gchar * name; + GumAddress address; + + /* These map 1:1 to their struct nlist / nlist_64 equivalents. */ + guint8 type; + guint8 section; + guint16 description; +}; + +enum _GumDarwinRebaseType +{ + GUM_DARWIN_REBASE_POINTER = 1, + GUM_DARWIN_REBASE_TEXT_ABSOLUTE32, + GUM_DARWIN_REBASE_TEXT_PCREL32, +}; + +enum _GumDarwinBindType +{ + GUM_DARWIN_BIND_POINTER = 1, + GUM_DARWIN_BIND_TEXT_ABSOLUTE32, + GUM_DARWIN_BIND_TEXT_PCREL32, + GUM_DARWIN_BIND_THREADED_TABLE, + GUM_DARWIN_BIND_THREADED_ITEMS, +}; + +enum _GumDarwinThreadedItemType +{ + GUM_DARWIN_THREADED_REBASE, + GUM_DARWIN_THREADED_BIND +}; + +enum _GumDarwinBindOrdinal +{ + GUM_DARWIN_BIND_SELF = 0, + GUM_DARWIN_BIND_MAIN_EXECUTABLE = -1, + GUM_DARWIN_BIND_FLAT_LOOKUP = -2, + GUM_DARWIN_BIND_WEAK_LOOKUP = -3, +}; + +enum _GumDarwinBindSymbolFlags +{ + GUM_DARWIN_BIND_WEAK_IMPORT = 0x1, + GUM_DARWIN_BIND_NON_WEAK_DEFINITION = 0x8, +}; + +enum _GumDarwinExportSymbolKind +{ + GUM_DARWIN_EXPORT_REGULAR, + GUM_DARWIN_EXPORT_THREAD_LOCAL, + GUM_DARWIN_EXPORT_ABSOLUTE +}; + +enum _GumDarwinExportSymbolFlags +{ + GUM_DARWIN_EXPORT_WEAK_DEFINITION = 0x04, + GUM_DARWIN_EXPORT_REEXPORT = 0x08, + GUM_DARWIN_EXPORT_STUB_AND_RESOLVER = 0x10, +}; + +GUM_API GumDarwinModule * gum_darwin_module_new_from_file (const gchar * path, + GumCpuType cpu_type, GumPtrauthSupport ptrauth_support, + GumDarwinModuleFlags flags, GError ** error); +GUM_API GumDarwinModule * gum_darwin_module_new_from_blob (GBytes * blob, + GumCpuType cpu_type, GumPtrauthSupport ptrauth_support, + GumDarwinModuleFlags flags, GError ** error); +GUM_API GumDarwinModule * gum_darwin_module_new_from_memory (const gchar * name, + GumDarwinPort task, GumAddress base_address, GumDarwinModuleFlags flags, + GError ** error); + +GUM_API gboolean gum_darwin_module_resolve_export (GumDarwinModule * self, + const gchar * symbol, GumDarwinExportDetails * details); +GUM_API GumAddress gum_darwin_module_resolve_symbol_address ( + GumDarwinModule * self, const gchar * symbol); +GUM_API gboolean gum_darwin_module_get_lacks_exports_for_reexports ( + GumDarwinModule * self); +GUM_API void gum_darwin_module_enumerate_imports (GumDarwinModule * self, + GumFoundImportFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_exports (GumDarwinModule * self, + GumFoundDarwinExportFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_symbols (GumDarwinModule * self, + GumFoundDarwinSymbolFunc func, gpointer user_data); +GUM_API GumAddress gum_darwin_module_get_slide (GumDarwinModule * self); +GUM_API const GumDarwinSegment * gum_darwin_module_get_nth_segment ( + GumDarwinModule * self, gsize index); +GUM_API void gum_darwin_module_enumerate_sections (GumDarwinModule * self, + GumFoundDarwinSectionFunc func, gpointer user_data); +GUM_API gboolean gum_darwin_module_is_address_in_text_section ( + GumDarwinModule * self, GumAddress address); +GUM_API void gum_darwin_module_enumerate_chained_fixups (GumDarwinModule * self, + GumFoundDarwinChainedFixupsFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_rebases (GumDarwinModule * self, + GumFoundDarwinRebaseFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_binds (GumDarwinModule * self, + GumFoundDarwinBindFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_lazy_binds (GumDarwinModule * self, + GumFoundDarwinBindFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_init_pointers (GumDarwinModule * self, + GumFoundDarwinInitPointersFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_init_offsets (GumDarwinModule * self, + GumFoundDarwinInitOffsetsFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_term_pointers (GumDarwinModule * self, + GumFoundDarwinTermPointersFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_dependencies (GumDarwinModule * self, + GumFoundDarwinDependencyFunc func, gpointer user_data); +GUM_API const gchar * gum_darwin_module_get_dependency_by_ordinal ( + GumDarwinModule * self, gint ordinal); + +GUM_API void gum_darwin_threaded_item_parse (guint64 value, + GumDarwinThreadedItem * result); + +GUM_API GumDarwinModuleImage * gum_darwin_module_image_new (void); +GUM_API GumDarwinModuleImage * gum_darwin_module_image_dup ( + const GumDarwinModuleImage * other); +GUM_API void gum_darwin_module_image_free (GumDarwinModuleImage * image); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2009 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_EVENT_H__ +#define __GUM_EVENT_H__ + + +G_BEGIN_DECLS + +typedef guint GumEventType; + +typedef union _GumEvent GumEvent; + +typedef struct _GumAnyEvent GumAnyEvent; +typedef struct _GumCallEvent GumCallEvent; +typedef struct _GumRetEvent GumRetEvent; +typedef struct _GumExecEvent GumExecEvent; +typedef struct _GumBlockEvent GumBlockEvent; +typedef struct _GumCompileEvent GumCompileEvent; + +enum _GumEventType +{ + GUM_NOTHING = 0, + GUM_CALL = 1 << 0, + GUM_RET = 1 << 1, + GUM_EXEC = 1 << 2, + GUM_BLOCK = 1 << 3, + GUM_COMPILE = 1 << 4, +}; + +struct _GumAnyEvent +{ + GumEventType type; +}; + +struct _GumCallEvent +{ + GumEventType type; + + gpointer location; + gpointer target; + gint depth; +}; + +struct _GumRetEvent +{ + GumEventType type; + + gpointer location; + gpointer target; + gint depth; +}; + +struct _GumExecEvent +{ + GumEventType type; + + gpointer location; +}; + +struct _GumBlockEvent +{ + GumEventType type; + + gpointer begin; + gpointer end; +}; + +struct _GumCompileEvent +{ + GumEventType type; + + gpointer begin; + gpointer end; +}; + +union _GumEvent +{ + GumEventType type; + + GumAnyEvent any; + GumCallEvent call; + GumRetEvent ret; + GumExecEvent exec; + GumBlockEvent block; + GumCompileEvent compile; +}; + +G_END_DECLS + +#endif +/* + * Copyright (C) 2009-2020 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_EVENT_SINK_H__ +#define __GUM_EVENT_SINK_H__ + + +G_BEGIN_DECLS + +#define GUM_TYPE_EVENT_SINK (gum_event_sink_get_type ()) +G_DECLARE_INTERFACE (GumEventSink, gum_event_sink, GUM, EVENT_SINK, GObject) + +#define GUM_TYPE_DEFAULT_EVENT_SINK (gum_default_event_sink_get_type ()) +G_DECLARE_FINAL_TYPE (GumDefaultEventSink, gum_default_event_sink, GUM, + DEFAULT_EVENT_SINK, GObject) + +struct _GumEventSinkInterface +{ + GTypeInterface parent; + + GumEventType (* query_mask) (GumEventSink * self); + void (* start) (GumEventSink * self); + void (* process) (GumEventSink * self, const GumEvent * event, + GumCpuContext * cpu_context); + void (* flush) (GumEventSink * self); + void (* stop) (GumEventSink * self); +}; + +GUM_API GumEventType gum_event_sink_query_mask (GumEventSink * self); +GUM_API void gum_event_sink_start (GumEventSink * self); +GUM_API void gum_event_sink_process (GumEventSink * self, + const GumEvent * event, GumCpuContext * cpu_context); +GUM_API void gum_event_sink_flush (GumEventSink * self); +GUM_API void gum_event_sink_stop (GumEventSink * self); + +GUM_API GumEventSink * gum_event_sink_make_default (void); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2015-2018 Ole André Vadla Ravnås + * Copyright (C) 2020 Francesco Tamagni + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_EXCEPTOR_H__ +#define __GUM_EXCEPTOR_H__ + +#include + +G_BEGIN_DECLS + +#define GUM_TYPE_EXCEPTOR (gum_exceptor_get_type ()) +G_DECLARE_FINAL_TYPE (GumExceptor, gum_exceptor, GUM, EXCEPTOR, GObject) + +#if defined (G_OS_WIN32) || defined (__APPLE__) +# define GUM_NATIVE_SETJMP(env) setjmp (env) +# define GUM_NATIVE_LONGJMP longjmp + typedef jmp_buf GumExceptorNativeJmpBuf; +#else +# define GUM_NATIVE_SETJMP(env) sigsetjmp (env, TRUE) +# define GUM_NATIVE_LONGJMP siglongjmp +# if !defined (GUM_GIR_COMPILATION) + typedef sigjmp_buf GumExceptorNativeJmpBuf; +# endif +#endif + +typedef struct _GumExceptionDetails GumExceptionDetails; +typedef guint GumExceptionType; +typedef struct _GumExceptionMemoryDetails GumExceptionMemoryDetails; +typedef gboolean (* GumExceptionHandler) (GumExceptionDetails * details, + gpointer user_data); + +typedef struct _GumExceptorScope GumExceptorScope; + +enum _GumExceptionType +{ + GUM_EXCEPTION_ABORT = 1, + GUM_EXCEPTION_ACCESS_VIOLATION, + GUM_EXCEPTION_GUARD_PAGE, + GUM_EXCEPTION_ILLEGAL_INSTRUCTION, + GUM_EXCEPTION_STACK_OVERFLOW, + GUM_EXCEPTION_ARITHMETIC, + GUM_EXCEPTION_BREAKPOINT, + GUM_EXCEPTION_SINGLE_STEP, + GUM_EXCEPTION_SYSTEM +}; + +struct _GumExceptionMemoryDetails +{ + GumMemoryOperation operation; + gpointer address; +}; + +struct _GumExceptionDetails +{ + GumThreadId thread_id; + GumExceptionType type; + gpointer address; + GumExceptionMemoryDetails memory; + GumCpuContext context; + gpointer native_context; +}; + +struct _GumExceptorScope +{ + GumExceptionDetails exception; + + /*< private */ + gboolean exception_occurred; + gpointer padding[2]; + jmp_buf env; +#ifdef __ANDROID__ + sigset_t mask; +#endif + + GumExceptorScope * next; +}; + +GUM_API GumExceptor * gum_exceptor_obtain (void); + +GUM_API void gum_exceptor_add (GumExceptor * self, GumExceptionHandler func, + gpointer user_data); +GUM_API void gum_exceptor_remove (GumExceptor * self, GumExceptionHandler func, + gpointer user_data); + +#if defined (_MSC_VER) && GLIB_SIZEOF_VOID_P == 8 +/* + * On MSVC/64-bit setjmp() is actually an intrinsic that calls _setjmp() with a + * a hidden second argument specifying the frame pointer. This makes sense when + * the longjmp() is guaranteed to happen from code we control, but is not + * reliable otherwise. + */ +# define gum_exceptor_try(self, scope) ( \ + _gum_exceptor_prepare_try (self, scope), \ + ((int (*) (jmp_buf env, void * frame_pointer)) _setjmp) ( \ + (scope)->env, NULL) == 0) +#else +# define gum_exceptor_try(self, scope) ( \ + _gum_exceptor_prepare_try (self, scope), \ + GUM_NATIVE_SETJMP ((scope)->env) == 0) +#endif +GUM_API gboolean gum_exceptor_catch (GumExceptor * self, + GumExceptorScope * scope); +GUM_API gboolean gum_exceptor_has_scope (GumExceptor * self, + GumThreadId thread_id); + +GUM_API gchar * gum_exception_details_to_string ( + const GumExceptionDetails * details); + +GUM_API void _gum_exceptor_prepare_try (GumExceptor * self, + GumExceptorScope * scope); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2009 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_FUNCTION_H__ +#define __GUM_FUNCTION_H__ + +G_BEGIN_DECLS + +typedef struct _GumFunctionDetails GumFunctionDetails; + +struct _GumFunctionDetails +{ + const gchar * name; + gpointer address; + gint num_arguments; +}; + +G_END_DECLS + +#endif +/* + * Copyright (C) 2008-2019 Ole André Vadla Ravnås + * Copyright (C) 2008 Christian Berentsen + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_INTERCEPTOR_H__ +#define __GUM_INTERCEPTOR_H__ + +/* + * Copyright (C) 2008-2018 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_INVOCATION_LISTENER_H__ +#define __GUM_INVOCATION_LISTENER_H__ + +/* + * Copyright (C) 2008-2019 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_INVOCATION_CONTEXT_H__ +#define __GUM_INVOCATION_CONTEXT_H__ + + + +#define GUM_IC_GET_THREAD_DATA(context, data_type) \ + ((data_type *) gum_invocation_context_get_listener_thread_data (context, \ + sizeof (data_type))) +#define GUM_IC_GET_FUNC_DATA(context, data_type) \ + ((data_type) gum_invocation_context_get_listener_function_data (context)) +#define GUM_IC_GET_INVOCATION_DATA(context, data_type) \ + ((data_type *) \ + gum_invocation_context_get_listener_invocation_data (context,\ + sizeof (data_type))) + +#define GUM_IC_GET_REPLACEMENT_DATA(ctx, data_type) \ + ((data_type) gum_invocation_context_get_replacement_data (ctx)) + +typedef struct _GumInvocationBackend GumInvocationBackend; +typedef struct _GumInvocationContext GumInvocationContext; +typedef guint GumPointCut; + +struct _GumInvocationBackend +{ + GumPointCut (* get_point_cut) (GumInvocationContext * context); + + GumThreadId (* get_thread_id) (GumInvocationContext * context); + guint (* get_depth) (GumInvocationContext * context); + + gpointer (* get_listener_thread_data) (GumInvocationContext * context, + gsize required_size); + gpointer (* get_listener_function_data) (GumInvocationContext * context); + gpointer (* get_listener_invocation_data) ( + GumInvocationContext * context, gsize required_size); + + gpointer (* get_replacement_data) (GumInvocationContext * context); + + gpointer state; + gpointer data; +}; + +struct _GumInvocationContext +{ + GCallback function; + GumCpuContext * cpu_context; + gint system_error; + + /*< private */ + GumInvocationBackend * backend; +}; + +enum _GumPointCut +{ + GUM_POINT_ENTER, + GUM_POINT_LEAVE +}; + +G_BEGIN_DECLS + +GUM_API GumPointCut gum_invocation_context_get_point_cut ( + GumInvocationContext * context); + +GUM_API gpointer gum_invocation_context_get_nth_argument ( + GumInvocationContext * context, guint n); +GUM_API void gum_invocation_context_replace_nth_argument ( + GumInvocationContext * context, guint n, gpointer value); +GUM_API gpointer gum_invocation_context_get_return_value ( + GumInvocationContext * context); +GUM_API void gum_invocation_context_replace_return_value ( + GumInvocationContext * context, gpointer value); + +GUM_API gpointer gum_invocation_context_get_return_address ( + GumInvocationContext * context); + +GUM_API guint gum_invocation_context_get_thread_id ( + GumInvocationContext * context); +GUM_API guint gum_invocation_context_get_depth ( + GumInvocationContext * context); + +GUM_API gpointer gum_invocation_context_get_listener_thread_data ( + GumInvocationContext * context, gsize required_size); +GUM_API gpointer gum_invocation_context_get_listener_function_data ( + GumInvocationContext * context); +GUM_API gpointer gum_invocation_context_get_listener_invocation_data ( + GumInvocationContext * context, gsize required_size); + +GUM_API gpointer gum_invocation_context_get_replacement_data ( + GumInvocationContext * context); + +G_END_DECLS + +#endif + +G_BEGIN_DECLS + +#define GUM_TYPE_INVOCATION_LISTENER (gum_invocation_listener_get_type ()) +G_DECLARE_INTERFACE (GumInvocationListener, gum_invocation_listener, GUM, + INVOCATION_LISTENER, GObject) + +struct _GumInvocationListenerInterface +{ + GTypeInterface parent; + + void (* on_enter) (GumInvocationListener * self, + GumInvocationContext * context); + void (* on_leave) (GumInvocationListener * self, + GumInvocationContext * context); +}; + +GUM_API void gum_invocation_listener_on_enter (GumInvocationListener * self, + GumInvocationContext * context); +GUM_API void gum_invocation_listener_on_leave (GumInvocationListener * self, + GumInvocationContext * context); + +G_END_DECLS + +#endif + +G_BEGIN_DECLS + +#define GUM_TYPE_INTERCEPTOR (gum_interceptor_get_type ()) +G_DECLARE_FINAL_TYPE (GumInterceptor, gum_interceptor, GUM, INTERCEPTOR, + GObject) + +typedef GArray GumInvocationStack; +typedef guint GumInvocationState; + +typedef enum +{ + GUM_ATTACH_OK = 0, + GUM_ATTACH_WRONG_SIGNATURE = -1, + GUM_ATTACH_ALREADY_ATTACHED = -2, + GUM_ATTACH_POLICY_VIOLATION = -3 +} GumAttachReturn; + +typedef enum +{ + GUM_REPLACE_OK = 0, + GUM_REPLACE_WRONG_SIGNATURE = -1, + GUM_REPLACE_ALREADY_REPLACED = -2, + GUM_REPLACE_POLICY_VIOLATION = -3 +} GumReplaceReturn; + +GUM_API GumInterceptor * gum_interceptor_obtain (void); + +GUM_API GumAttachReturn gum_interceptor_attach (GumInterceptor * self, + gpointer function_address, GumInvocationListener * listener, + gpointer listener_function_data); +GUM_API void gum_interceptor_detach (GumInterceptor * self, + GumInvocationListener * listener); + +GUM_API GumReplaceReturn gum_interceptor_replace (GumInterceptor * self, + gpointer function_address, gpointer replacement_function, + gpointer replacement_data); +GUM_API void gum_interceptor_revert (GumInterceptor * self, + gpointer function_address); + +GUM_API void gum_interceptor_begin_transaction (GumInterceptor * self); +GUM_API void gum_interceptor_end_transaction (GumInterceptor * self); +GUM_API gboolean gum_interceptor_flush (GumInterceptor * self); + +GUM_API GumInvocationContext * gum_interceptor_get_current_invocation (void); +GUM_API GumInvocationStack * gum_interceptor_get_current_stack (void); + +GUM_API void gum_interceptor_ignore_current_thread (GumInterceptor * self); +GUM_API void gum_interceptor_unignore_current_thread (GumInterceptor * self); + +GUM_API void gum_interceptor_ignore_other_threads (GumInterceptor * self); +GUM_API void gum_interceptor_unignore_other_threads (GumInterceptor * self); + +GUM_API gpointer gum_invocation_stack_translate (GumInvocationStack * self, + gpointer return_address); + +GUM_API void gum_interceptor_save (GumInvocationState * state); +GUM_API void gum_interceptor_restore (GumInvocationState * state); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2015 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_KERNEL_H__ +#define __GUM_KERNEL_H__ + + +G_BEGIN_DECLS + +typedef struct _GumKernelModuleRangeDetails GumKernelModuleRangeDetails; + +struct _GumKernelModuleRangeDetails +{ + gchar name[48]; + GumAddress address; + guint64 size; + GumPageProtection protection; +}; + +typedef gboolean (* GumFoundKernelModuleRangeFunc) ( + const GumKernelModuleRangeDetails * details, gpointer user_data); + +GUM_API gboolean gum_kernel_api_is_available (void); +GUM_API guint gum_kernel_query_page_size (void); +GUM_API GumAddress gum_kernel_alloc_n_pages (guint n_pages); +GUM_API void gum_kernel_free_pages (GumAddress mem); +GUM_API gboolean gum_kernel_try_mprotect (GumAddress address, gsize size, + GumPageProtection page_prot); +GUM_API guint8 * gum_kernel_read (GumAddress address, gsize len, + gsize * n_bytes_read); +GUM_API gboolean gum_kernel_write (GumAddress address, const guint8 * bytes, + gsize len); +GUM_API void gum_kernel_scan (const GumMemoryRange * range, + const GumMatchPattern * pattern, GumMemoryScanMatchFunc func, + gpointer user_data); +GUM_API void gum_kernel_enumerate_ranges (GumPageProtection prot, + GumFoundRangeFunc func, gpointer user_data); +GUM_API void gum_kernel_enumerate_module_ranges (const gchar * module_name, + GumPageProtection prot, GumFoundKernelModuleRangeFunc func, + gpointer user_data); +GUM_API void gum_kernel_enumerate_modules (GumFoundModuleFunc func, + gpointer user_data); +GUM_API GumAddress gum_kernel_find_base_address (void); +GUM_API void gum_kernel_set_base_address (GumAddress base); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2015 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_LIBC_H__ +#define __GUM_LIBC_H__ + + +G_BEGIN_DECLS + +G_GNUC_INTERNAL gpointer gum_memset (gpointer dst, gint c, gsize n); +G_GNUC_INTERNAL gpointer gum_memcpy (gpointer dst, gconstpointer src, gsize n); +G_GNUC_INTERNAL gpointer gum_memmove (gpointer dst, gconstpointer src, gsize n); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2010-2018 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_MEMORY_ACCESS_MONITOR_H__ +#define __GUM_MEMORY_ACCESS_MONITOR_H__ + + +G_BEGIN_DECLS + +#define GUM_TYPE_MEMORY_ACCESS_MONITOR (gum_memory_access_monitor_get_type ()) +G_DECLARE_FINAL_TYPE (GumMemoryAccessMonitor, gum_memory_access_monitor, GUM, + MEMORY_ACCESS_MONITOR, GObject) + +typedef struct _GumMemoryAccessDetails GumMemoryAccessDetails; + +typedef void (* GumMemoryAccessNotify) (GumMemoryAccessMonitor * monitor, + const GumMemoryAccessDetails * details, gpointer user_data); + +struct _GumMemoryAccessDetails +{ + GumMemoryOperation operation; + gpointer from; + gpointer address; + + guint range_index; + guint page_index; + guint pages_completed; + guint pages_total; +}; + +GUM_API GumMemoryAccessMonitor * gum_memory_access_monitor_new ( + const GumMemoryRange * ranges, guint num_ranges, + GumPageProtection access_mask, gboolean auto_reset, + GumMemoryAccessNotify func, gpointer data, + GDestroyNotify data_destroy); + +GUM_API gboolean gum_memory_access_monitor_enable ( + GumMemoryAccessMonitor * self, GError ** error); +GUM_API void gum_memory_access_monitor_disable (GumMemoryAccessMonitor * self); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2013-2018 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_MEMORY_MAP_H__ +#define __GUM_MEMORY_MAP_H__ + + +G_BEGIN_DECLS + +#define GUM_TYPE_MEMORY_MAP (gum_memory_map_get_type ()) +G_DECLARE_FINAL_TYPE (GumMemoryMap, gum_memory_map, GUM, MEMORY_MAP, GObject) + +GUM_API GumMemoryMap * gum_memory_map_new (GumPageProtection prot); + +GUM_API gboolean gum_memory_map_contains (GumMemoryMap * self, + const GumMemoryRange * range); + +GUM_API void gum_memory_map_update (GumMemoryMap * self); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2017-2019 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_METAL_ARRAY_H__ +#define __GUM_METAL_ARRAY_H__ + + +typedef struct _GumMetalArray GumMetalArray; + +struct _GumMetalArray +{ + gpointer data; + guint length; + guint capacity; + + guint element_size; +}; + +G_BEGIN_DECLS + +GUM_API void gum_metal_array_init (GumMetalArray * array, guint element_size); +GUM_API void gum_metal_array_free (GumMetalArray * array); + +GUM_API gpointer gum_metal_array_element_at (GumMetalArray * self, + guint index_); +GUM_API gpointer gum_metal_array_insert_at (GumMetalArray * self, guint index_); +GUM_API void gum_metal_array_remove_at (GumMetalArray * self, guint index_); +GUM_API void gum_metal_array_remove_all (GumMetalArray * self); +GUM_API gpointer gum_metal_array_append (GumMetalArray * self); + +GUM_API void gum_metal_array_get_extents (GumMetalArray * self, + gpointer * start, gpointer * end); +GUM_API void gum_metal_array_ensure_capacity (GumMetalArray * self, + guint capacity); + +G_END_DECLS + +#endif +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __GUM_METAL_HASH_H__ +#define __GUM_METAL_HASH_H__ + + +G_BEGIN_DECLS + +typedef struct _GumMetalHashTable GumMetalHashTable; +typedef struct _GumMetalHashTableIter GumMetalHashTableIter; + +struct _GumMetalHashTableIter +{ + gpointer dummy1; + gpointer dummy2; + gpointer dummy3; + int dummy4; + gboolean dummy5; + gpointer dummy6; +}; + +GUM_API GumMetalHashTable * gum_metal_hash_table_new (GHashFunc hash_func, + GEqualFunc key_equal_func); +GUM_API GumMetalHashTable * gum_metal_hash_table_new_full (GHashFunc hash_func, + GEqualFunc key_equal_func, GDestroyNotify key_destroy_func, + GDestroyNotify value_destroy_func); +GUM_API void gum_metal_hash_table_destroy (GumMetalHashTable * hash_table); +GUM_API gboolean gum_metal_hash_table_insert (GumMetalHashTable * hash_table, + gpointer key, gpointer value); +GUM_API gboolean gum_metal_hash_table_replace (GumMetalHashTable * hash_table, + gpointer key, gpointer value); +GUM_API gboolean gum_metal_hash_table_add (GumMetalHashTable * hash_table, + gpointer key); +GUM_API gboolean gum_metal_hash_table_remove (GumMetalHashTable * hash_table, + gconstpointer key); +GUM_API void gum_metal_hash_table_remove_all (GumMetalHashTable * hash_table); +GUM_API gboolean gum_metal_hash_table_steal (GumMetalHashTable * hash_table, + gconstpointer key); +GUM_API void gum_metal_hash_table_steal_all (GumMetalHashTable * hash_table); +GUM_API gpointer gum_metal_hash_table_lookup (GumMetalHashTable * hash_table, + gconstpointer key); +GUM_API gboolean gum_metal_hash_table_contains (GumMetalHashTable * hash_table, + gconstpointer key); +GUM_API gboolean gum_metal_hash_table_lookup_extended ( + GumMetalHashTable * hash_table, gconstpointer lookup_key, + gpointer * orig_key, gpointer * value); +GUM_API void gum_metal_hash_table_foreach (GumMetalHashTable * hash_table, + GHFunc func, gpointer user_data); +GUM_API gpointer gum_metal_hash_table_find (GumMetalHashTable * hash_table, + GHRFunc predicate, gpointer user_data); +GUM_API guint gum_metal_hash_table_foreach_remove ( + GumMetalHashTable * hash_table, GHRFunc func, gpointer user_data); +GUM_API guint gum_metal_hash_table_foreach_steal (GumMetalHashTable * hash_table, + GHRFunc func, gpointer user_data); +GUM_API guint gum_metal_hash_table_size (GumMetalHashTable * hash_table); + +GUM_API void gum_metal_hash_table_iter_init (GumMetalHashTableIter * iter, + GumMetalHashTable * hash_table); +GUM_API gboolean gum_metal_hash_table_iter_next (GumMetalHashTableIter * iter, + gpointer * key, gpointer * value); +GUM_API GumMetalHashTable* gum_metal_hash_table_iter_get_hash_table ( + GumMetalHashTableIter * iter); +GUM_API void gum_metal_hash_table_iter_remove (GumMetalHashTableIter * iter); +GUM_API void gum_metal_hash_table_iter_replace (GumMetalHashTableIter * iter, + gpointer value); +GUM_API void gum_metal_hash_table_iter_steal (GumMetalHashTableIter * iter); + +GUM_API GumMetalHashTable * gum_metal_hash_table_ref ( + GumMetalHashTable * hash_table); +GUM_API void gum_metal_hash_table_unref (GumMetalHashTable * hash_table); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2016 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_MODULE_API_RESOLVER_H__ +#define __GUM_MODULE_API_RESOLVER_H__ + + +G_BEGIN_DECLS + +#define GUM_TYPE_MODULE_API_RESOLVER (gum_module_api_resolver_get_type ()) +G_DECLARE_FINAL_TYPE (GumModuleApiResolver, gum_module_api_resolver, GUM, + MODULE_API_RESOLVER, GObject) + +GUM_API GumApiResolver * gum_module_api_resolver_new (void); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2015-2017 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_MODULE_MAP_H__ +#define __GUM_MODULE_MAP_H__ + + +G_BEGIN_DECLS + +#define GUM_TYPE_MODULE_MAP (gum_module_map_get_type ()) +G_DECLARE_FINAL_TYPE (GumModuleMap, gum_module_map, GUM, MODULE_MAP, GObject) + +typedef gboolean (* GumModuleMapFilterFunc) (const GumModuleDetails * details, + gpointer user_data); + +GUM_API GumModuleMap * gum_module_map_new (void); +GUM_API GumModuleMap * gum_module_map_new_filtered (GumModuleMapFilterFunc func, + gpointer data, GDestroyNotify data_destroy); + +GUM_API const GumModuleDetails * gum_module_map_find (GumModuleMap * self, + GumAddress address); + +GUM_API void gum_module_map_update (GumModuleMap * self); + +GUM_API GArray * gum_module_map_get_values (GumModuleMap * self); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2014 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_PRINTF_H__ +#define __GUM_PRINTF_H__ + + +G_BEGIN_DECLS + +gint gum_vsnprintf (gchar * str, gsize size, const gchar * format, + va_list args); +gint gum_snprintf (gchar * str, gsize size, const gchar * format, ...); +gint gum_vasprintf (gchar ** ret, const gchar * format, va_list ap); +gint gum_asprintf (gchar ** ret, const gchar * format, ...); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2010-2019 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_SPINLOCK_H__ +#define __GUM_SPINLOCK_H__ + + +#define GUM_SPINLOCK_INIT { NULL } + +G_BEGIN_DECLS + +typedef struct _GumSpinlock GumSpinlock; + +struct _GumSpinlock +{ + gpointer data; +}; + +void gum_spinlock_init (GumSpinlock * spinlock); + +void gum_spinlock_acquire (GumSpinlock * spinlock); +void gum_spinlock_release (GumSpinlock * spinlock); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2009-2018 Ole André Vadla Ravnås + * Copyright (C) 2010 Karl Trygve Kalleberg + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_STALKER_H__ +#define __GUM_STALKER_H__ + +#ifndef CAPSTONE_ENGINE_H +#define CAPSTONE_ENGINE_H + +/* Capstone Disassembly Engine */ +/* By Nguyen Anh Quynh , 2013-2016 */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#if defined(CAPSTONE_HAS_OSXKERNEL) +#include +#else +#include +#include +#endif + +/* Capstone Disassembly Engine */ +/* By Axel Souchet & Nguyen Anh Quynh, 2014 */ + +#ifndef CAPSTONE_PLATFORM_H +#define CAPSTONE_PLATFORM_H + + +// handle C99 issue (for pre-2013 VisualStudio) +#if !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__) && (defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64)) +// MSVC + +// stdbool.h +#if (_MSC_VER < 1800) || defined(_KERNEL_MODE) +// this system does not have stdbool.h +#ifndef __cplusplus +typedef unsigned char bool; +#define false 0 +#define true 1 +#endif // __cplusplus + +#else +// VisualStudio 2013+ -> C99 is supported +#include +#endif // (_MSC_VER < 1800) || defined(_KERNEL_MODE) + +#else +// not MSVC -> C99 is supported +#include +#endif // !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__) && (defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64)) + + +// handle inttypes.h / stdint.h compatibility +#if defined(_WIN32_WCE) && (_WIN32_WCE < 0x800) +#include "windowsce/stdint.h" +#endif // defined(_WIN32_WCE) && (_WIN32_WCE < 0x800) + +#if defined(CAPSTONE_HAS_OSXKERNEL) || (defined(_MSC_VER) && (_MSC_VER <= 1700 || defined(_KERNEL_MODE))) +// this system does not have inttypes.h + +#if defined(_MSC_VER) && (_MSC_VER <= 1600 || defined(_KERNEL_MODE)) +// this system does not have stdint.h +typedef signed char int8_t; +typedef signed short int16_t; +typedef signed int int32_t; +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +#endif // defined(_MSC_VER) && (_MSC_VER <= 1600 || defined(_KERNEL_MODE)) + +#if defined(_MSC_VER) && (_MSC_VER < 1600 || defined(_KERNEL_MODE)) +#define INT8_MIN (-127i8 - 1) +#define INT16_MIN (-32767i16 - 1) +#define INT32_MIN (-2147483647i32 - 1) +#define INT64_MIN (-9223372036854775807i64 - 1) +#define INT8_MAX 127i8 +#define INT16_MAX 32767i16 +#define INT32_MAX 2147483647i32 +#define INT64_MAX 9223372036854775807i64 +#define UINT8_MAX 0xffui8 +#define UINT16_MAX 0xffffui16 +#define UINT32_MAX 0xffffffffui32 +#define UINT64_MAX 0xffffffffffffffffui64 +#endif // defined(_MSC_VER) && (_MSC_VER < 1600 || defined(_KERNEL_MODE)) + +#ifdef CAPSTONE_HAS_OSXKERNEL +// this system has stdint.h +#include +#endif + +#define __PRI_8_LENGTH_MODIFIER__ "hh" +#define __PRI_64_LENGTH_MODIFIER__ "ll" + +#define PRId8 __PRI_8_LENGTH_MODIFIER__ "d" +#define PRIi8 __PRI_8_LENGTH_MODIFIER__ "i" +#define PRIo8 __PRI_8_LENGTH_MODIFIER__ "o" +#define PRIu8 __PRI_8_LENGTH_MODIFIER__ "u" +#define PRIx8 __PRI_8_LENGTH_MODIFIER__ "x" +#define PRIX8 __PRI_8_LENGTH_MODIFIER__ "X" + +#define PRId16 "hd" +#define PRIi16 "hi" +#define PRIo16 "ho" +#define PRIu16 "hu" +#define PRIx16 "hx" +#define PRIX16 "hX" + +#if defined(_MSC_VER) && _MSC_VER <= 1700 +#define PRId32 "ld" +#define PRIi32 "li" +#define PRIo32 "lo" +#define PRIu32 "lu" +#define PRIx32 "lx" +#define PRIX32 "lX" +#else // OSX +#define PRId32 "d" +#define PRIi32 "i" +#define PRIo32 "o" +#define PRIu32 "u" +#define PRIx32 "x" +#define PRIX32 "X" +#endif // defined(_MSC_VER) && _MSC_VER <= 1700 + +#if defined(_MSC_VER) && _MSC_VER <= 1700 +// redefine functions from inttypes.h used in cstool +#define strtoull _strtoui64 +#endif + +#define PRId64 __PRI_64_LENGTH_MODIFIER__ "d" +#define PRIi64 __PRI_64_LENGTH_MODIFIER__ "i" +#define PRIo64 __PRI_64_LENGTH_MODIFIER__ "o" +#define PRIu64 __PRI_64_LENGTH_MODIFIER__ "u" +#define PRIx64 __PRI_64_LENGTH_MODIFIER__ "x" +#define PRIX64 __PRI_64_LENGTH_MODIFIER__ "X" + +#else +// this system has inttypes.h by default +#include +#endif // defined(CAPSTONE_HAS_OSXKERNEL) || (defined(_MSC_VER) && (_MSC_VER <= 1700 || defined(_KERNEL_MODE))) + +#endif + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#pragma warning(disable:4100) +#define CAPSTONE_API __cdecl +#ifdef CAPSTONE_SHARED +#define CAPSTONE_EXPORT __declspec(dllexport) +#else // defined(CAPSTONE_STATIC) +#define CAPSTONE_EXPORT +#endif +#else +#define CAPSTONE_API +#if (defined(__GNUC__) || defined(__IBMC__)) && !defined(CAPSTONE_STATIC) +#define CAPSTONE_EXPORT __attribute__((visibility("default"))) +#else // defined(CAPSTONE_STATIC) +#define CAPSTONE_EXPORT +#endif +#endif + +#if (defined(__GNUC__) || defined(__IBMC__)) +#define CAPSTONE_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) +#define CAPSTONE_DEPRECATED __declspec(deprecated) +#else +#pragma message("WARNING: You need to implement CAPSTONE_DEPRECATED for this compiler") +#define CAPSTONE_DEPRECATED +#endif + +// Capstone API version +#define CS_API_MAJOR 5 +#define CS_API_MINOR 0 + +// Version for bleeding edge code of the Github's "next" branch. +// Use this if you want the absolutely latest development code. +// This version number will be bumped up whenever we have a new major change. +#define CS_NEXT_VERSION 5 + +// Capstone package version +#define CS_VERSION_MAJOR CS_API_MAJOR +#define CS_VERSION_MINOR CS_API_MINOR +#define CS_VERSION_EXTRA 0 + +/// Macro to create combined version which can be compared to +/// result of cs_version() API. +#define CS_MAKE_VERSION(major, minor) ((major << 8) + minor) + +/// Maximum size of an instruction mnemonic string. +#define CS_MNEMONIC_SIZE 32 + +// Handle using with all API +typedef size_t csh; + +/// Architecture type +typedef enum cs_arch { + CS_ARCH_ARM = 0, ///< ARM architecture (including Thumb, Thumb-2) + CS_ARCH_ARM64, ///< ARM-64, also called AArch64 + CS_ARCH_MIPS, ///< Mips architecture + CS_ARCH_X86, ///< X86 architecture (including x86 & x86-64) + CS_ARCH_PPC, ///< PowerPC architecture + CS_ARCH_SPARC, ///< Sparc architecture + CS_ARCH_SYSZ, ///< SystemZ architecture + CS_ARCH_XCORE, ///< XCore architecture + CS_ARCH_M68K, ///< 68K architecture + CS_ARCH_TMS320C64X, ///< TMS320C64x architecture + CS_ARCH_M680X, ///< 680X architecture + CS_ARCH_EVM, ///< Ethereum architecture + CS_ARCH_MOS65XX, ///< MOS65XX architecture (including MOS6502) + CS_ARCH_WASM, ///< WebAssembly architecture + CS_ARCH_BPF, ///< Berkeley Packet Filter architecture (including eBPF) + CS_ARCH_RISCV, ///< RISCV architecture + CS_ARCH_MAX, + CS_ARCH_ALL = 0xFFFF, // All architectures - for cs_support() +} cs_arch; + +// Support value to verify diet mode of the engine. +// If cs_support(CS_SUPPORT_DIET) return True, the engine was compiled +// in diet mode. +#define CS_SUPPORT_DIET (CS_ARCH_ALL + 1) + +// Support value to verify X86 reduce mode of the engine. +// If cs_support(CS_SUPPORT_X86_REDUCE) return True, the engine was compiled +// in X86 reduce mode. +#define CS_SUPPORT_X86_REDUCE (CS_ARCH_ALL + 2) + +/// Mode type +typedef enum cs_mode { + CS_MODE_LITTLE_ENDIAN = 0, ///< little-endian mode (default mode) + CS_MODE_ARM = 0, ///< 32-bit ARM + CS_MODE_16 = 1 << 1, ///< 16-bit mode (X86) + CS_MODE_32 = 1 << 2, ///< 32-bit mode (X86) + CS_MODE_64 = 1 << 3, ///< 64-bit mode (X86, PPC) + CS_MODE_THUMB = 1 << 4, ///< ARM's Thumb mode, including Thumb-2 + CS_MODE_MCLASS = 1 << 5, ///< ARM's Cortex-M series + CS_MODE_V8 = 1 << 6, ///< ARMv8 A32 encodings for ARM + CS_MODE_MICRO = 1 << 4, ///< MicroMips mode (MIPS) + CS_MODE_MIPS3 = 1 << 5, ///< Mips III ISA + CS_MODE_MIPS32R6 = 1 << 6, ///< Mips32r6 ISA + CS_MODE_MIPS2 = 1 << 7, ///< Mips II ISA + CS_MODE_V9 = 1 << 4, ///< SparcV9 mode (Sparc) + CS_MODE_QPX = 1 << 4, ///< Quad Processing eXtensions mode (PPC) + CS_MODE_SPE = 1 << 5, ///< Signal Processing Engine mode (PPC) + CS_MODE_BOOKE = 1 << 6, ///< Book-E mode (PPC) + CS_MODE_M68K_000 = 1 << 1, ///< M68K 68000 mode + CS_MODE_M68K_010 = 1 << 2, ///< M68K 68010 mode + CS_MODE_M68K_020 = 1 << 3, ///< M68K 68020 mode + CS_MODE_M68K_030 = 1 << 4, ///< M68K 68030 mode + CS_MODE_M68K_040 = 1 << 5, ///< M68K 68040 mode + CS_MODE_M68K_060 = 1 << 6, ///< M68K 68060 mode + CS_MODE_BIG_ENDIAN = 1U << 31, ///< big-endian mode + CS_MODE_MIPS32 = CS_MODE_32, ///< Mips32 ISA (Mips) + CS_MODE_MIPS64 = CS_MODE_64, ///< Mips64 ISA (Mips) + CS_MODE_M680X_6301 = 1 << 1, ///< M680X Hitachi 6301,6303 mode + CS_MODE_M680X_6309 = 1 << 2, ///< M680X Hitachi 6309 mode + CS_MODE_M680X_6800 = 1 << 3, ///< M680X Motorola 6800,6802 mode + CS_MODE_M680X_6801 = 1 << 4, ///< M680X Motorola 6801,6803 mode + CS_MODE_M680X_6805 = 1 << 5, ///< M680X Motorola/Freescale 6805 mode + CS_MODE_M680X_6808 = 1 << 6, ///< M680X Motorola/Freescale/NXP 68HC08 mode + CS_MODE_M680X_6809 = 1 << 7, ///< M680X Motorola 6809 mode + CS_MODE_M680X_6811 = 1 << 8, ///< M680X Motorola/Freescale/NXP 68HC11 mode + CS_MODE_M680X_CPU12 = 1 << 9, ///< M680X Motorola/Freescale/NXP CPU12 + ///< used on M68HC12/HCS12 + CS_MODE_M680X_HCS08 = 1 << 10, ///< M680X Freescale/NXP HCS08 mode + CS_MODE_BPF_CLASSIC = 0, ///< Classic BPF mode (default) + CS_MODE_BPF_EXTENDED = 1 << 0, ///< Extended BPF mode + CS_MODE_RISCV32 = 1 << 0, ///< RISCV RV32G + CS_MODE_RISCV64 = 1 << 1, ///< RISCV RV64G + CS_MODE_RISCVC = 1 << 2, ///< RISCV compressed instructure mode + CS_MODE_MOS65XX_6502 = 1 << 1, ///< MOS65XXX MOS 6502 + CS_MODE_MOS65XX_65C02 = 1 << 2, ///< MOS65XXX WDC 65c02 + CS_MODE_MOS65XX_W65C02 = 1 << 3, ///< MOS65XXX WDC W65c02 + CS_MODE_MOS65XX_65816 = 1 << 4, ///< MOS65XXX WDC 65816, 8-bit m/x + CS_MODE_MOS65XX_65816_LONG_M = (1 << 5), ///< MOS65XXX WDC 65816, 16-bit m, 8-bit x + CS_MODE_MOS65XX_65816_LONG_X = (1 << 6), ///< MOS65XXX WDC 65816, 8-bit m, 16-bit x + CS_MODE_MOS65XX_65816_LONG_MX = CS_MODE_MOS65XX_65816_LONG_M | CS_MODE_MOS65XX_65816_LONG_X, +} cs_mode; + +typedef void* (CAPSTONE_API *cs_malloc_t)(size_t size); +typedef void* (CAPSTONE_API *cs_calloc_t)(size_t nmemb, size_t size); +typedef void* (CAPSTONE_API *cs_realloc_t)(void *ptr, size_t size); +typedef void (CAPSTONE_API *cs_free_t)(void *ptr); +typedef int (CAPSTONE_API *cs_vsnprintf_t)(char *str, size_t size, const char *format, va_list ap); + + +/// User-defined dynamic memory related functions: malloc/calloc/realloc/free/vsnprintf() +/// By default, Capstone uses system's malloc(), calloc(), realloc(), free() & vsnprintf(). +typedef struct cs_opt_mem { + cs_malloc_t malloc; + cs_calloc_t calloc; + cs_realloc_t realloc; + cs_free_t free; + cs_vsnprintf_t vsnprintf; +} cs_opt_mem; + +/// Customize mnemonic for instructions with alternative name. +/// To reset existing customized instruction to its default mnemonic, +/// call cs_option(CS_OPT_MNEMONIC) again with the same @id and NULL value +/// for @mnemonic. +typedef struct cs_opt_mnem { + /// ID of instruction to be customized. + unsigned int id; + /// Customized instruction mnemonic. + const char *mnemonic; +} cs_opt_mnem; + +/// Runtime option for the disassembled engine +typedef enum cs_opt_type { + CS_OPT_INVALID = 0, ///< No option specified + CS_OPT_SYNTAX, ///< Assembly output syntax + CS_OPT_DETAIL, ///< Break down instruction structure into details + CS_OPT_MODE, ///< Change engine's mode at run-time + CS_OPT_MEM, ///< User-defined dynamic memory related functions + CS_OPT_SKIPDATA, ///< Skip data when disassembling. Then engine is in SKIPDATA mode. + CS_OPT_SKIPDATA_SETUP, ///< Setup user-defined function for SKIPDATA option + CS_OPT_MNEMONIC, ///< Customize instruction mnemonic + CS_OPT_UNSIGNED, ///< print immediate operands in unsigned form +} cs_opt_type; + +/// Runtime option value (associated with option type above) +typedef enum cs_opt_value { + CS_OPT_OFF = 0, ///< Turn OFF an option - default for CS_OPT_DETAIL, CS_OPT_SKIPDATA, CS_OPT_UNSIGNED. + CS_OPT_ON = 3, ///< Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA). + CS_OPT_SYNTAX_DEFAULT = 0, ///< Default asm syntax (CS_OPT_SYNTAX). + CS_OPT_SYNTAX_INTEL, ///< X86 Intel asm syntax - default on X86 (CS_OPT_SYNTAX). + CS_OPT_SYNTAX_ATT, ///< X86 ATT asm syntax (CS_OPT_SYNTAX). + CS_OPT_SYNTAX_NOREGNAME, ///< Prints register name with only number (CS_OPT_SYNTAX) + CS_OPT_SYNTAX_MASM, ///< X86 Intel Masm syntax (CS_OPT_SYNTAX). + CS_OPT_SYNTAX_MOTOROLA, ///< MOS65XX use $ as hex prefix +} cs_opt_value; + +/// Common instruction operand types - to be consistent across all architectures. +typedef enum cs_op_type { + CS_OP_INVALID = 0, ///< uninitialized/invalid operand. + CS_OP_REG, ///< Register operand. + CS_OP_IMM, ///< Immediate operand. + CS_OP_MEM, ///< Memory operand. + CS_OP_FP, ///< Floating-Point operand. +} cs_op_type; + +/// Common instruction operand access types - to be consistent across all architectures. +/// It is possible to combine access types, for example: CS_AC_READ | CS_AC_WRITE +typedef enum cs_ac_type { + CS_AC_INVALID = 0, ///< Uninitialized/invalid access type. + CS_AC_READ = 1 << 0, ///< Operand read from memory or register. + CS_AC_WRITE = 1 << 1, ///< Operand write to memory or register. +} cs_ac_type; + +/// Common instruction groups - to be consistent across all architectures. +typedef enum cs_group_type { + CS_GRP_INVALID = 0, ///< uninitialized/invalid group. + CS_GRP_JUMP, ///< all jump instructions (conditional+direct+indirect jumps) + CS_GRP_CALL, ///< all call instructions + CS_GRP_RET, ///< all return instructions + CS_GRP_INT, ///< all interrupt instructions (int+syscall) + CS_GRP_IRET, ///< all interrupt return instructions + CS_GRP_PRIVILEGE, ///< all privileged instructions + CS_GRP_BRANCH_RELATIVE, ///< all relative branching instructions +} cs_group_type; + +/** + User-defined callback function for SKIPDATA option. + See tests/test_skipdata.c for sample code demonstrating this API. + + @code: the input buffer containing code to be disassembled. + This is the same buffer passed to cs_disasm(). + @code_size: size (in bytes) of the above @code buffer. + @offset: the position of the currently-examining byte in the input + buffer @code mentioned above. + @user_data: user-data passed to cs_option() via @user_data field in + cs_opt_skipdata struct below. + + @return: return number of bytes to skip, or 0 to immediately stop disassembling. +*/ +typedef size_t (CAPSTONE_API *cs_skipdata_cb_t)(const uint8_t *code, size_t code_size, size_t offset, void *user_data); + +/// User-customized setup for SKIPDATA option +typedef struct cs_opt_skipdata { + /// Capstone considers data to skip as special "instructions". + /// User can specify the string for this instruction's "mnemonic" here. + /// By default (if @mnemonic is NULL), Capstone use ".byte". + const char *mnemonic; + + /// User-defined callback function to be called when Capstone hits data. + /// If the returned value from this callback is positive (>0), Capstone + /// will skip exactly that number of bytes & continue. Otherwise, if + /// the callback returns 0, Capstone stops disassembling and returns + /// immediately from cs_disasm() + /// NOTE: if this callback pointer is NULL, Capstone would skip a number + /// of bytes depending on architectures, as following: + /// Arm: 2 bytes (Thumb mode) or 4 bytes. + /// Arm64: 4 bytes. + /// Mips: 4 bytes. + /// M680x: 1 byte. + /// PowerPC: 4 bytes. + /// Sparc: 4 bytes. + /// SystemZ: 2 bytes. + /// X86: 1 bytes. + /// XCore: 2 bytes. + /// EVM: 1 bytes. + /// RISCV: 4 bytes. + /// WASM: 1 bytes. + /// MOS65XX: 1 bytes. + /// BPF: 8 bytes. + cs_skipdata_cb_t callback; // default value is NULL + + /// User-defined data to be passed to @callback function pointer. + void *user_data; +} cs_opt_skipdata; + + +#ifndef CAPSTONE_ARM_H +#define CAPSTONE_ARM_H + +/* Capstone Disassembly Engine */ +/* By Nguyen Anh Quynh , 2013-2015 */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +/// ARM shift type +typedef enum arm_shifter { + ARM_SFT_INVALID = 0, + ARM_SFT_ASR, ///< shift with immediate const + ARM_SFT_LSL, ///< shift with immediate const + ARM_SFT_LSR, ///< shift with immediate const + ARM_SFT_ROR, ///< shift with immediate const + ARM_SFT_RRX, ///< shift with immediate const + ARM_SFT_ASR_REG, ///< shift with register + ARM_SFT_LSL_REG, ///< shift with register + ARM_SFT_LSR_REG, ///< shift with register + ARM_SFT_ROR_REG, ///< shift with register + ARM_SFT_RRX_REG, ///< shift with register +} arm_shifter; + +/// ARM condition code +typedef enum arm_cc { + ARM_CC_INVALID = 0, + ARM_CC_EQ, ///< Equal Equal + ARM_CC_NE, ///< Not equal Not equal, or unordered + ARM_CC_HS, ///< Carry set >, ==, or unordered + ARM_CC_LO, ///< Carry clear Less than + ARM_CC_MI, ///< Minus, negative Less than + ARM_CC_PL, ///< Plus, positive or zero >, ==, or unordered + ARM_CC_VS, ///< Overflow Unordered + ARM_CC_VC, ///< No overflow Not unordered + ARM_CC_HI, ///< Unsigned higher Greater than, or unordered + ARM_CC_LS, ///< Unsigned lower or same Less than or equal + ARM_CC_GE, ///< Greater than or equal Greater than or equal + ARM_CC_LT, ///< Less than Less than, or unordered + ARM_CC_GT, ///< Greater than Greater than + ARM_CC_LE, ///< Less than or equal <, ==, or unordered + ARM_CC_AL ///< Always (unconditional) Always (unconditional) +} arm_cc; + +typedef enum arm_sysreg { + /// Special registers for MSR + ARM_SYSREG_INVALID = 0, + + // SPSR* registers can be OR combined + ARM_SYSREG_SPSR_C = 1, + ARM_SYSREG_SPSR_X = 2, + ARM_SYSREG_SPSR_S = 4, + ARM_SYSREG_SPSR_F = 8, + + // CPSR* registers can be OR combined + ARM_SYSREG_CPSR_C = 16, + ARM_SYSREG_CPSR_X = 32, + ARM_SYSREG_CPSR_S = 64, + ARM_SYSREG_CPSR_F = 128, + + // independent registers + ARM_SYSREG_APSR = 256, + ARM_SYSREG_APSR_G, + ARM_SYSREG_APSR_NZCVQ, + ARM_SYSREG_APSR_NZCVQG, + + ARM_SYSREG_IAPSR, + ARM_SYSREG_IAPSR_G, + ARM_SYSREG_IAPSR_NZCVQG, + ARM_SYSREG_IAPSR_NZCVQ, + + ARM_SYSREG_EAPSR, + ARM_SYSREG_EAPSR_G, + ARM_SYSREG_EAPSR_NZCVQG, + ARM_SYSREG_EAPSR_NZCVQ, + + ARM_SYSREG_XPSR, + ARM_SYSREG_XPSR_G, + ARM_SYSREG_XPSR_NZCVQG, + ARM_SYSREG_XPSR_NZCVQ, + + ARM_SYSREG_IPSR, + ARM_SYSREG_EPSR, + ARM_SYSREG_IEPSR, + + ARM_SYSREG_MSP, + ARM_SYSREG_PSP, + ARM_SYSREG_PRIMASK, + ARM_SYSREG_BASEPRI, + ARM_SYSREG_BASEPRI_MAX, + ARM_SYSREG_FAULTMASK, + ARM_SYSREG_CONTROL, + ARM_SYSREG_MSPLIM, + ARM_SYSREG_PSPLIM, + ARM_SYSREG_MSP_NS, + ARM_SYSREG_PSP_NS, + ARM_SYSREG_MSPLIM_NS, + ARM_SYSREG_PSPLIM_NS, + ARM_SYSREG_PRIMASK_NS, + ARM_SYSREG_BASEPRI_NS, + ARM_SYSREG_FAULTMASK_NS, + ARM_SYSREG_CONTROL_NS, + ARM_SYSREG_SP_NS, + + // Banked Registers + ARM_SYSREG_R8_USR, + ARM_SYSREG_R9_USR, + ARM_SYSREG_R10_USR, + ARM_SYSREG_R11_USR, + ARM_SYSREG_R12_USR, + ARM_SYSREG_SP_USR, + ARM_SYSREG_LR_USR, + ARM_SYSREG_R8_FIQ, + ARM_SYSREG_R9_FIQ, + ARM_SYSREG_R10_FIQ, + ARM_SYSREG_R11_FIQ, + ARM_SYSREG_R12_FIQ, + ARM_SYSREG_SP_FIQ, + ARM_SYSREG_LR_FIQ, + ARM_SYSREG_LR_IRQ, + ARM_SYSREG_SP_IRQ, + ARM_SYSREG_LR_SVC, + ARM_SYSREG_SP_SVC, + ARM_SYSREG_LR_ABT, + ARM_SYSREG_SP_ABT, + ARM_SYSREG_LR_UND, + ARM_SYSREG_SP_UND, + ARM_SYSREG_LR_MON, + ARM_SYSREG_SP_MON, + ARM_SYSREG_ELR_HYP, + ARM_SYSREG_SP_HYP, + + ARM_SYSREG_SPSR_FIQ, + ARM_SYSREG_SPSR_IRQ, + ARM_SYSREG_SPSR_SVC, + ARM_SYSREG_SPSR_ABT, + ARM_SYSREG_SPSR_UND, + ARM_SYSREG_SPSR_MON, + ARM_SYSREG_SPSR_HYP, +} arm_sysreg; + +/// The memory barrier constants map directly to the 4-bit encoding of +/// the option field for Memory Barrier operations. +typedef enum arm_mem_barrier { + ARM_MB_INVALID = 0, + ARM_MB_RESERVED_0, + ARM_MB_OSHLD, + ARM_MB_OSHST, + ARM_MB_OSH, + ARM_MB_RESERVED_4, + ARM_MB_NSHLD, + ARM_MB_NSHST, + ARM_MB_NSH, + ARM_MB_RESERVED_8, + ARM_MB_ISHLD, + ARM_MB_ISHST, + ARM_MB_ISH, + ARM_MB_RESERVED_12, + ARM_MB_LD, + ARM_MB_ST, + ARM_MB_SY, +} arm_mem_barrier; + +/// Operand type for instruction's operands +typedef enum arm_op_type { + ARM_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + ARM_OP_REG, ///< = CS_OP_REG (Register operand). + ARM_OP_IMM, ///< = CS_OP_IMM (Immediate operand). + ARM_OP_MEM, ///< = CS_OP_MEM (Memory operand). + ARM_OP_FP, ///< = CS_OP_FP (Floating-Point operand). + ARM_OP_CIMM = 64, ///< C-Immediate (coprocessor registers) + ARM_OP_PIMM, ///< P-Immediate (coprocessor registers) + ARM_OP_SETEND, ///< operand for SETEND instruction + ARM_OP_SYSREG, ///< MSR/MRS special register operand +} arm_op_type; + +/// Operand type for SETEND instruction +typedef enum arm_setend_type { + ARM_SETEND_INVALID = 0, ///< Uninitialized. + ARM_SETEND_BE, ///< BE operand. + ARM_SETEND_LE, ///< LE operand +} arm_setend_type; + +typedef enum arm_cpsmode_type { + ARM_CPSMODE_INVALID = 0, + ARM_CPSMODE_IE = 2, + ARM_CPSMODE_ID = 3 +} arm_cpsmode_type; + +/// Operand type for SETEND instruction +typedef enum arm_cpsflag_type { + ARM_CPSFLAG_INVALID = 0, + ARM_CPSFLAG_F = 1, + ARM_CPSFLAG_I = 2, + ARM_CPSFLAG_A = 4, + ARM_CPSFLAG_NONE = 16, ///< no flag +} arm_cpsflag_type; + +/// Data type for elements of vector instructions. +typedef enum arm_vectordata_type { + ARM_VECTORDATA_INVALID = 0, + + // Integer type + ARM_VECTORDATA_I8, + ARM_VECTORDATA_I16, + ARM_VECTORDATA_I32, + ARM_VECTORDATA_I64, + + // Signed integer type + ARM_VECTORDATA_S8, + ARM_VECTORDATA_S16, + ARM_VECTORDATA_S32, + ARM_VECTORDATA_S64, + + // Unsigned integer type + ARM_VECTORDATA_U8, + ARM_VECTORDATA_U16, + ARM_VECTORDATA_U32, + ARM_VECTORDATA_U64, + + // Data type for VMUL/VMULL + ARM_VECTORDATA_P8, + + // Floating type + ARM_VECTORDATA_F16, + ARM_VECTORDATA_F32, + ARM_VECTORDATA_F64, + + // Convert float <-> float + ARM_VECTORDATA_F16F64, // f16.f64 + ARM_VECTORDATA_F64F16, // f64.f16 + ARM_VECTORDATA_F32F16, // f32.f16 + ARM_VECTORDATA_F16F32, // f32.f16 + ARM_VECTORDATA_F64F32, // f64.f32 + ARM_VECTORDATA_F32F64, // f32.f64 + + // Convert integer <-> float + ARM_VECTORDATA_S32F32, // s32.f32 + ARM_VECTORDATA_U32F32, // u32.f32 + ARM_VECTORDATA_F32S32, // f32.s32 + ARM_VECTORDATA_F32U32, // f32.u32 + ARM_VECTORDATA_F64S16, // f64.s16 + ARM_VECTORDATA_F32S16, // f32.s16 + ARM_VECTORDATA_F64S32, // f64.s32 + ARM_VECTORDATA_S16F64, // s16.f64 + ARM_VECTORDATA_S16F32, // s16.f64 + ARM_VECTORDATA_S32F64, // s32.f64 + ARM_VECTORDATA_U16F64, // u16.f64 + ARM_VECTORDATA_U16F32, // u16.f32 + ARM_VECTORDATA_U32F64, // u32.f64 + ARM_VECTORDATA_F64U16, // f64.u16 + ARM_VECTORDATA_F32U16, // f32.u16 + ARM_VECTORDATA_F64U32, // f64.u32 + ARM_VECTORDATA_F16U16, // f16.u16 + ARM_VECTORDATA_U16F16, // u16.f16 + ARM_VECTORDATA_F16U32, // f16.u32 + ARM_VECTORDATA_U32F16, // u32.f16 +} arm_vectordata_type; + +/// ARM registers +typedef enum arm_reg { + ARM_REG_INVALID = 0, + ARM_REG_APSR, + ARM_REG_APSR_NZCV, + ARM_REG_CPSR, + ARM_REG_FPEXC, + ARM_REG_FPINST, + ARM_REG_FPSCR, + ARM_REG_FPSCR_NZCV, + ARM_REG_FPSID, + ARM_REG_ITSTATE, + ARM_REG_LR, + ARM_REG_PC, + ARM_REG_SP, + ARM_REG_SPSR, + ARM_REG_D0, + ARM_REG_D1, + ARM_REG_D2, + ARM_REG_D3, + ARM_REG_D4, + ARM_REG_D5, + ARM_REG_D6, + ARM_REG_D7, + ARM_REG_D8, + ARM_REG_D9, + ARM_REG_D10, + ARM_REG_D11, + ARM_REG_D12, + ARM_REG_D13, + ARM_REG_D14, + ARM_REG_D15, + ARM_REG_D16, + ARM_REG_D17, + ARM_REG_D18, + ARM_REG_D19, + ARM_REG_D20, + ARM_REG_D21, + ARM_REG_D22, + ARM_REG_D23, + ARM_REG_D24, + ARM_REG_D25, + ARM_REG_D26, + ARM_REG_D27, + ARM_REG_D28, + ARM_REG_D29, + ARM_REG_D30, + ARM_REG_D31, + ARM_REG_FPINST2, + ARM_REG_MVFR0, + ARM_REG_MVFR1, + ARM_REG_MVFR2, + ARM_REG_Q0, + ARM_REG_Q1, + ARM_REG_Q2, + ARM_REG_Q3, + ARM_REG_Q4, + ARM_REG_Q5, + ARM_REG_Q6, + ARM_REG_Q7, + ARM_REG_Q8, + ARM_REG_Q9, + ARM_REG_Q10, + ARM_REG_Q11, + ARM_REG_Q12, + ARM_REG_Q13, + ARM_REG_Q14, + ARM_REG_Q15, + ARM_REG_R0, + ARM_REG_R1, + ARM_REG_R2, + ARM_REG_R3, + ARM_REG_R4, + ARM_REG_R5, + ARM_REG_R6, + ARM_REG_R7, + ARM_REG_R8, + ARM_REG_R9, + ARM_REG_R10, + ARM_REG_R11, + ARM_REG_R12, + ARM_REG_S0, + ARM_REG_S1, + ARM_REG_S2, + ARM_REG_S3, + ARM_REG_S4, + ARM_REG_S5, + ARM_REG_S6, + ARM_REG_S7, + ARM_REG_S8, + ARM_REG_S9, + ARM_REG_S10, + ARM_REG_S11, + ARM_REG_S12, + ARM_REG_S13, + ARM_REG_S14, + ARM_REG_S15, + ARM_REG_S16, + ARM_REG_S17, + ARM_REG_S18, + ARM_REG_S19, + ARM_REG_S20, + ARM_REG_S21, + ARM_REG_S22, + ARM_REG_S23, + ARM_REG_S24, + ARM_REG_S25, + ARM_REG_S26, + ARM_REG_S27, + ARM_REG_S28, + ARM_REG_S29, + ARM_REG_S30, + ARM_REG_S31, + + ARM_REG_ENDING, // <-- mark the end of the list or registers + + // alias registers + ARM_REG_R13 = ARM_REG_SP, + ARM_REG_R14 = ARM_REG_LR, + ARM_REG_R15 = ARM_REG_PC, + + ARM_REG_SB = ARM_REG_R9, + ARM_REG_SL = ARM_REG_R10, + ARM_REG_FP = ARM_REG_R11, + ARM_REG_IP = ARM_REG_R12, +} arm_reg; + +/// Instruction's operand referring to memory +/// This is associated with ARM_OP_MEM operand type above +typedef struct arm_op_mem { + arm_reg base; ///< base register + arm_reg index; ///< index register + int scale; ///< scale for index register (can be 1, or -1) + int disp; ///< displacement/offset value + /// left-shift on index register, or 0 if irrelevant + /// NOTE: this value can also be fetched via operand.shift.value + int lshift; +} arm_op_mem; + +/// Instruction operand +typedef struct cs_arm_op { + int vector_index; ///< Vector Index for some vector operands (or -1 if irrelevant) + + struct { + arm_shifter type; + unsigned int value; + } shift; + + arm_op_type type; ///< operand type + + union { + int reg; ///< register value for REG/SYSREG operand + int32_t imm; ///< immediate value for C-IMM, P-IMM or IMM operand + double fp; ///< floating point value for FP operand + arm_op_mem mem; ///< base/index/scale/disp value for MEM operand + arm_setend_type setend; ///< SETEND instruction's operand type + }; + + /// in some instructions, an operand can be subtracted or added to + /// the base register, + /// if TRUE, this operand is subtracted. otherwise, it is added. + bool subtracted; + + /// How is this operand accessed? (READ, WRITE or READ|WRITE) + /// This field is combined of cs_ac_type. + /// NOTE: this field is irrelevant if engine is compiled in DIET mode. + uint8_t access; + + /// Neon lane index for NEON instructions (or -1 if irrelevant) + int8_t neon_lane; +} cs_arm_op; + +/// Instruction structure +typedef struct cs_arm { + bool usermode; ///< User-mode registers to be loaded (for LDM/STM instructions) + int vector_size; ///< Scalar size for vector instructions + arm_vectordata_type vector_data; ///< Data type for elements of vector instructions + arm_cpsmode_type cps_mode; ///< CPS mode for CPS instruction + arm_cpsflag_type cps_flag; ///< CPS mode for CPS instruction + arm_cc cc; ///< conditional code for this insn + bool update_flags; ///< does this insn update flags? + bool writeback; ///< does this insn write-back? + arm_mem_barrier mem_barrier; ///< Option for some memory barrier instructions + + /// Number of operands of this instruction, + /// or 0 when instruction has no operand. + uint8_t op_count; + + cs_arm_op operands[36]; ///< operands for this instruction. +} cs_arm; + +/// ARM instruction +typedef enum arm_insn { + ARM_INS_INVALID = 0, + + ARM_INS_ADC, + ARM_INS_ADD, + ARM_INS_ADDW, + ARM_INS_ADR, + ARM_INS_AESD, + ARM_INS_AESE, + ARM_INS_AESIMC, + ARM_INS_AESMC, + ARM_INS_AND, + ARM_INS_ASR, + ARM_INS_B, + ARM_INS_BFC, + ARM_INS_BFI, + ARM_INS_BIC, + ARM_INS_BKPT, + ARM_INS_BL, + ARM_INS_BLX, + ARM_INS_BLXNS, + ARM_INS_BX, + ARM_INS_BXJ, + ARM_INS_BXNS, + ARM_INS_CBNZ, + ARM_INS_CBZ, + ARM_INS_CDP, + ARM_INS_CDP2, + ARM_INS_CLREX, + ARM_INS_CLZ, + ARM_INS_CMN, + ARM_INS_CMP, + ARM_INS_CPS, + ARM_INS_CRC32B, + ARM_INS_CRC32CB, + ARM_INS_CRC32CH, + ARM_INS_CRC32CW, + ARM_INS_CRC32H, + ARM_INS_CRC32W, + ARM_INS_CSDB, + ARM_INS_DBG, + ARM_INS_DCPS1, + ARM_INS_DCPS2, + ARM_INS_DCPS3, + ARM_INS_DFB, + ARM_INS_DMB, + ARM_INS_DSB, + ARM_INS_EOR, + ARM_INS_ERET, + ARM_INS_ESB, + ARM_INS_FADDD, + ARM_INS_FADDS, + ARM_INS_FCMPZD, + ARM_INS_FCMPZS, + ARM_INS_FCONSTD, + ARM_INS_FCONSTS, + ARM_INS_FLDMDBX, + ARM_INS_FLDMIAX, + ARM_INS_FMDHR, + ARM_INS_FMDLR, + ARM_INS_FMSTAT, + ARM_INS_FSTMDBX, + ARM_INS_FSTMIAX, + ARM_INS_FSUBD, + ARM_INS_FSUBS, + ARM_INS_HINT, + ARM_INS_HLT, + ARM_INS_HVC, + ARM_INS_ISB, + ARM_INS_IT, + ARM_INS_LDA, + ARM_INS_LDAB, + ARM_INS_LDAEX, + ARM_INS_LDAEXB, + ARM_INS_LDAEXD, + ARM_INS_LDAEXH, + ARM_INS_LDAH, + ARM_INS_LDC, + ARM_INS_LDC2, + ARM_INS_LDC2L, + ARM_INS_LDCL, + ARM_INS_LDM, + ARM_INS_LDMDA, + ARM_INS_LDMDB, + ARM_INS_LDMIB, + ARM_INS_LDR, + ARM_INS_LDRB, + ARM_INS_LDRBT, + ARM_INS_LDRD, + ARM_INS_LDREX, + ARM_INS_LDREXB, + ARM_INS_LDREXD, + ARM_INS_LDREXH, + ARM_INS_LDRH, + ARM_INS_LDRHT, + ARM_INS_LDRSB, + ARM_INS_LDRSBT, + ARM_INS_LDRSH, + ARM_INS_LDRSHT, + ARM_INS_LDRT, + ARM_INS_LSL, + ARM_INS_LSR, + ARM_INS_MCR, + ARM_INS_MCR2, + ARM_INS_MCRR, + ARM_INS_MCRR2, + ARM_INS_MLA, + ARM_INS_MLS, + ARM_INS_MOV, + ARM_INS_MOVS, + ARM_INS_MOVT, + ARM_INS_MOVW, + ARM_INS_MRC, + ARM_INS_MRC2, + ARM_INS_MRRC, + ARM_INS_MRRC2, + ARM_INS_MRS, + ARM_INS_MSR, + ARM_INS_MUL, + ARM_INS_MVN, + ARM_INS_NEG, + ARM_INS_NOP, + ARM_INS_ORN, + ARM_INS_ORR, + ARM_INS_PKHBT, + ARM_INS_PKHTB, + ARM_INS_PLD, + ARM_INS_PLDW, + ARM_INS_PLI, + ARM_INS_POP, + ARM_INS_PUSH, + ARM_INS_QADD, + ARM_INS_QADD16, + ARM_INS_QADD8, + ARM_INS_QASX, + ARM_INS_QDADD, + ARM_INS_QDSUB, + ARM_INS_QSAX, + ARM_INS_QSUB, + ARM_INS_QSUB16, + ARM_INS_QSUB8, + ARM_INS_RBIT, + ARM_INS_REV, + ARM_INS_REV16, + ARM_INS_REVSH, + ARM_INS_RFEDA, + ARM_INS_RFEDB, + ARM_INS_RFEIA, + ARM_INS_RFEIB, + ARM_INS_ROR, + ARM_INS_RRX, + ARM_INS_RSB, + ARM_INS_RSC, + ARM_INS_SADD16, + ARM_INS_SADD8, + ARM_INS_SASX, + ARM_INS_SBC, + ARM_INS_SBFX, + ARM_INS_SDIV, + ARM_INS_SEL, + ARM_INS_SETEND, + ARM_INS_SETPAN, + ARM_INS_SEV, + ARM_INS_SEVL, + ARM_INS_SG, + ARM_INS_SHA1C, + ARM_INS_SHA1H, + ARM_INS_SHA1M, + ARM_INS_SHA1P, + ARM_INS_SHA1SU0, + ARM_INS_SHA1SU1, + ARM_INS_SHA256H, + ARM_INS_SHA256H2, + ARM_INS_SHA256SU0, + ARM_INS_SHA256SU1, + ARM_INS_SHADD16, + ARM_INS_SHADD8, + ARM_INS_SHASX, + ARM_INS_SHSAX, + ARM_INS_SHSUB16, + ARM_INS_SHSUB8, + ARM_INS_SMC, + ARM_INS_SMLABB, + ARM_INS_SMLABT, + ARM_INS_SMLAD, + ARM_INS_SMLADX, + ARM_INS_SMLAL, + ARM_INS_SMLALBB, + ARM_INS_SMLALBT, + ARM_INS_SMLALD, + ARM_INS_SMLALDX, + ARM_INS_SMLALTB, + ARM_INS_SMLALTT, + ARM_INS_SMLATB, + ARM_INS_SMLATT, + ARM_INS_SMLAWB, + ARM_INS_SMLAWT, + ARM_INS_SMLSD, + ARM_INS_SMLSDX, + ARM_INS_SMLSLD, + ARM_INS_SMLSLDX, + ARM_INS_SMMLA, + ARM_INS_SMMLAR, + ARM_INS_SMMLS, + ARM_INS_SMMLSR, + ARM_INS_SMMUL, + ARM_INS_SMMULR, + ARM_INS_SMUAD, + ARM_INS_SMUADX, + ARM_INS_SMULBB, + ARM_INS_SMULBT, + ARM_INS_SMULL, + ARM_INS_SMULTB, + ARM_INS_SMULTT, + ARM_INS_SMULWB, + ARM_INS_SMULWT, + ARM_INS_SMUSD, + ARM_INS_SMUSDX, + ARM_INS_SRSDA, + ARM_INS_SRSDB, + ARM_INS_SRSIA, + ARM_INS_SRSIB, + ARM_INS_SSAT, + ARM_INS_SSAT16, + ARM_INS_SSAX, + ARM_INS_SSUB16, + ARM_INS_SSUB8, + ARM_INS_STC, + ARM_INS_STC2, + ARM_INS_STC2L, + ARM_INS_STCL, + ARM_INS_STL, + ARM_INS_STLB, + ARM_INS_STLEX, + ARM_INS_STLEXB, + ARM_INS_STLEXD, + ARM_INS_STLEXH, + ARM_INS_STLH, + ARM_INS_STM, + ARM_INS_STMDA, + ARM_INS_STMDB, + ARM_INS_STMIB, + ARM_INS_STR, + ARM_INS_STRB, + ARM_INS_STRBT, + ARM_INS_STRD, + ARM_INS_STREX, + ARM_INS_STREXB, + ARM_INS_STREXD, + ARM_INS_STREXH, + ARM_INS_STRH, + ARM_INS_STRHT, + ARM_INS_STRT, + ARM_INS_SUB, + ARM_INS_SUBS, + ARM_INS_SUBW, + ARM_INS_SVC, + ARM_INS_SWP, + ARM_INS_SWPB, + ARM_INS_SXTAB, + ARM_INS_SXTAB16, + ARM_INS_SXTAH, + ARM_INS_SXTB, + ARM_INS_SXTB16, + ARM_INS_SXTH, + ARM_INS_TBB, + ARM_INS_TBH, + ARM_INS_TEQ, + ARM_INS_TRAP, + ARM_INS_TSB, + ARM_INS_TST, + ARM_INS_TT, + ARM_INS_TTA, + ARM_INS_TTAT, + ARM_INS_TTT, + ARM_INS_UADD16, + ARM_INS_UADD8, + ARM_INS_UASX, + ARM_INS_UBFX, + ARM_INS_UDF, + ARM_INS_UDIV, + ARM_INS_UHADD16, + ARM_INS_UHADD8, + ARM_INS_UHASX, + ARM_INS_UHSAX, + ARM_INS_UHSUB16, + ARM_INS_UHSUB8, + ARM_INS_UMAAL, + ARM_INS_UMLAL, + ARM_INS_UMULL, + ARM_INS_UQADD16, + ARM_INS_UQADD8, + ARM_INS_UQASX, + ARM_INS_UQSAX, + ARM_INS_UQSUB16, + ARM_INS_UQSUB8, + ARM_INS_USAD8, + ARM_INS_USADA8, + ARM_INS_USAT, + ARM_INS_USAT16, + ARM_INS_USAX, + ARM_INS_USUB16, + ARM_INS_USUB8, + ARM_INS_UXTAB, + ARM_INS_UXTAB16, + ARM_INS_UXTAH, + ARM_INS_UXTB, + ARM_INS_UXTB16, + ARM_INS_UXTH, + ARM_INS_VABA, + ARM_INS_VABAL, + ARM_INS_VABD, + ARM_INS_VABDL, + ARM_INS_VABS, + ARM_INS_VACGE, + ARM_INS_VACGT, + ARM_INS_VACLE, + ARM_INS_VACLT, + ARM_INS_VADD, + ARM_INS_VADDHN, + ARM_INS_VADDL, + ARM_INS_VADDW, + ARM_INS_VAND, + ARM_INS_VBIC, + ARM_INS_VBIF, + ARM_INS_VBIT, + ARM_INS_VBSL, + ARM_INS_VCADD, + ARM_INS_VCEQ, + ARM_INS_VCGE, + ARM_INS_VCGT, + ARM_INS_VCLE, + ARM_INS_VCLS, + ARM_INS_VCLT, + ARM_INS_VCLZ, + ARM_INS_VCMLA, + ARM_INS_VCMP, + ARM_INS_VCMPE, + ARM_INS_VCNT, + ARM_INS_VCVT, + ARM_INS_VCVTA, + ARM_INS_VCVTB, + ARM_INS_VCVTM, + ARM_INS_VCVTN, + ARM_INS_VCVTP, + ARM_INS_VCVTR, + ARM_INS_VCVTT, + ARM_INS_VDIV, + ARM_INS_VDUP, + ARM_INS_VEOR, + ARM_INS_VEXT, + ARM_INS_VFMA, + ARM_INS_VFMS, + ARM_INS_VFNMA, + ARM_INS_VFNMS, + ARM_INS_VHADD, + ARM_INS_VHSUB, + ARM_INS_VINS, + ARM_INS_VJCVT, + ARM_INS_VLD1, + ARM_INS_VLD2, + ARM_INS_VLD3, + ARM_INS_VLD4, + ARM_INS_VLDMDB, + ARM_INS_VLDMIA, + ARM_INS_VLDR, + ARM_INS_VLLDM, + ARM_INS_VLSTM, + ARM_INS_VMAX, + ARM_INS_VMAXNM, + ARM_INS_VMIN, + ARM_INS_VMINNM, + ARM_INS_VMLA, + ARM_INS_VMLAL, + ARM_INS_VMLS, + ARM_INS_VMLSL, + ARM_INS_VMOV, + ARM_INS_VMOVL, + ARM_INS_VMOVN, + ARM_INS_VMOVX, + ARM_INS_VMRS, + ARM_INS_VMSR, + ARM_INS_VMUL, + ARM_INS_VMULL, + ARM_INS_VMVN, + ARM_INS_VNEG, + ARM_INS_VNMLA, + ARM_INS_VNMLS, + ARM_INS_VNMUL, + ARM_INS_VORN, + ARM_INS_VORR, + ARM_INS_VPADAL, + ARM_INS_VPADD, + ARM_INS_VPADDL, + ARM_INS_VPMAX, + ARM_INS_VPMIN, + ARM_INS_VPOP, + ARM_INS_VPUSH, + ARM_INS_VQABS, + ARM_INS_VQADD, + ARM_INS_VQDMLAL, + ARM_INS_VQDMLSL, + ARM_INS_VQDMULH, + ARM_INS_VQDMULL, + ARM_INS_VQMOVN, + ARM_INS_VQMOVUN, + ARM_INS_VQNEG, + ARM_INS_VQRDMLAH, + ARM_INS_VQRDMLSH, + ARM_INS_VQRDMULH, + ARM_INS_VQRSHL, + ARM_INS_VQRSHRN, + ARM_INS_VQRSHRUN, + ARM_INS_VQSHL, + ARM_INS_VQSHLU, + ARM_INS_VQSHRN, + ARM_INS_VQSHRUN, + ARM_INS_VQSUB, + ARM_INS_VRADDHN, + ARM_INS_VRECPE, + ARM_INS_VRECPS, + ARM_INS_VREV16, + ARM_INS_VREV32, + ARM_INS_VREV64, + ARM_INS_VRHADD, + ARM_INS_VRINTA, + ARM_INS_VRINTM, + ARM_INS_VRINTN, + ARM_INS_VRINTP, + ARM_INS_VRINTR, + ARM_INS_VRINTX, + ARM_INS_VRINTZ, + ARM_INS_VRSHL, + ARM_INS_VRSHR, + ARM_INS_VRSHRN, + ARM_INS_VRSQRTE, + ARM_INS_VRSQRTS, + ARM_INS_VRSRA, + ARM_INS_VRSUBHN, + ARM_INS_VSDOT, + ARM_INS_VSELEQ, + ARM_INS_VSELGE, + ARM_INS_VSELGT, + ARM_INS_VSELVS, + ARM_INS_VSHL, + ARM_INS_VSHLL, + ARM_INS_VSHR, + ARM_INS_VSHRN, + ARM_INS_VSLI, + ARM_INS_VSQRT, + ARM_INS_VSRA, + ARM_INS_VSRI, + ARM_INS_VST1, + ARM_INS_VST2, + ARM_INS_VST3, + ARM_INS_VST4, + ARM_INS_VSTMDB, + ARM_INS_VSTMIA, + ARM_INS_VSTR, + ARM_INS_VSUB, + ARM_INS_VSUBHN, + ARM_INS_VSUBL, + ARM_INS_VSUBW, + ARM_INS_VSWP, + ARM_INS_VTBL, + ARM_INS_VTBX, + ARM_INS_VTRN, + ARM_INS_VTST, + ARM_INS_VUDOT, + ARM_INS_VUZP, + ARM_INS_VZIP, + ARM_INS_WFE, + ARM_INS_WFI, + ARM_INS_YIELD, + + ARM_INS_ENDING, // <-- mark the end of the list of instructions +} arm_insn; + +/// Group of ARM instructions +typedef enum arm_insn_group { + ARM_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + // Generic groups + // all jump instructions (conditional+direct+indirect jumps) + ARM_GRP_JUMP, ///< = CS_GRP_JUMP + ARM_GRP_CALL, ///< = CS_GRP_CALL + ARM_GRP_INT = 4, ///< = CS_GRP_INT + ARM_GRP_PRIVILEGE = 6, ///< = CS_GRP_PRIVILEGE + ARM_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE + + // Architecture-specific groups + ARM_GRP_CRYPTO = 128, + ARM_GRP_DATABARRIER, + ARM_GRP_DIVIDE, + ARM_GRP_FPARMV8, + ARM_GRP_MULTPRO, + ARM_GRP_NEON, + ARM_GRP_T2EXTRACTPACK, + ARM_GRP_THUMB2DSP, + ARM_GRP_TRUSTZONE, + ARM_GRP_V4T, + ARM_GRP_V5T, + ARM_GRP_V5TE, + ARM_GRP_V6, + ARM_GRP_V6T2, + ARM_GRP_V7, + ARM_GRP_V8, + ARM_GRP_VFP2, + ARM_GRP_VFP3, + ARM_GRP_VFP4, + ARM_GRP_ARM, + ARM_GRP_MCLASS, + ARM_GRP_NOTMCLASS, + ARM_GRP_THUMB, + ARM_GRP_THUMB1ONLY, + ARM_GRP_THUMB2, + ARM_GRP_PREV8, + ARM_GRP_FPVMLX, + ARM_GRP_MULOPS, + ARM_GRP_CRC, + ARM_GRP_DPVFP, + ARM_GRP_V6M, + ARM_GRP_VIRTUALIZATION, + + ARM_GRP_ENDING, +} arm_insn_group; + +#ifdef __cplusplus +} +#endif + +#endif +#ifndef CAPSTONE_ARM64_H +#define CAPSTONE_ARM64_H + +/* Capstone Disassembly Engine */ +/* By Nguyen Anh Quynh , 2013-2015 */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +/// ARM64 shift type +typedef enum arm64_shifter { + ARM64_SFT_INVALID = 0, + ARM64_SFT_LSL = 1, + ARM64_SFT_MSL = 2, + ARM64_SFT_LSR = 3, + ARM64_SFT_ASR = 4, + ARM64_SFT_ROR = 5, +} arm64_shifter; + +/// ARM64 extender type +typedef enum arm64_extender { + ARM64_EXT_INVALID = 0, + ARM64_EXT_UXTB = 1, + ARM64_EXT_UXTH = 2, + ARM64_EXT_UXTW = 3, + ARM64_EXT_UXTX = 4, + ARM64_EXT_SXTB = 5, + ARM64_EXT_SXTH = 6, + ARM64_EXT_SXTW = 7, + ARM64_EXT_SXTX = 8, +} arm64_extender; + +/// ARM64 condition code +typedef enum arm64_cc { + ARM64_CC_INVALID = 0, + ARM64_CC_EQ = 1, ///< Equal + ARM64_CC_NE = 2, ///< Not equal: Not equal, or unordered + ARM64_CC_HS = 3, ///< Unsigned higher or same: >, ==, or unordered + ARM64_CC_LO = 4, ///< Unsigned lower or same: Less than + ARM64_CC_MI = 5, ///< Minus, negative: Less than + ARM64_CC_PL = 6, ///< Plus, positive or zero: >, ==, or unordered + ARM64_CC_VS = 7, ///< Overflow: Unordered + ARM64_CC_VC = 8, ///< No overflow: Ordered + ARM64_CC_HI = 9, ///< Unsigned higher: Greater than, or unordered + ARM64_CC_LS = 10, ///< Unsigned lower or same: Less than or equal + ARM64_CC_GE = 11, ///< Greater than or equal: Greater than or equal + ARM64_CC_LT = 12, ///< Less than: Less than, or unordered + ARM64_CC_GT = 13, ///< Signed greater than: Greater than + ARM64_CC_LE = 14, ///< Signed less than or equal: <, ==, or unordered + ARM64_CC_AL = 15, ///< Always (unconditional): Always (unconditional) + ARM64_CC_NV = 16, ///< Always (unconditional): Always (unconditional) + //< Note the NV exists purely to disassemble 0b1111. Execution is "always". +} arm64_cc; + +/// System registers +typedef enum arm64_sysreg { + // System registers for MRS + ARM64_SYSREG_INVALID = 0, + + ARM64_SYSREG_MDCCSR_EL0 = 0x9808, + ARM64_SYSREG_DBGDTRRX_EL0 = 0x9828, + ARM64_SYSREG_MDRAR_EL1 = 0x8080, + ARM64_SYSREG_OSLSR_EL1 = 0x808C, + ARM64_SYSREG_DBGAUTHSTATUS_EL1 = 0x83F6, + ARM64_SYSREG_PMCEID0_EL0 = 0xDCE6, + ARM64_SYSREG_PMCEID1_EL0 = 0xDCE7, + ARM64_SYSREG_MIDR_EL1 = 0xC000, + ARM64_SYSREG_CCSIDR_EL1 = 0xC800, + ARM64_SYSREG_CCSIDR2_EL1 = 0xC802, + ARM64_SYSREG_CLIDR_EL1 = 0xC801, + ARM64_SYSREG_CTR_EL0 = 0xD801, + ARM64_SYSREG_MPIDR_EL1 = 0xC005, + ARM64_SYSREG_REVIDR_EL1 = 0xC006, + ARM64_SYSREG_AIDR_EL1 = 0xC807, + ARM64_SYSREG_DCZID_EL0 = 0xD807, + ARM64_SYSREG_ID_PFR0_EL1 = 0xC008, + ARM64_SYSREG_ID_PFR1_EL1 = 0xC009, + ARM64_SYSREG_ID_DFR0_EL1 = 0xC00A, + ARM64_SYSREG_ID_AFR0_EL1 = 0xC00B, + ARM64_SYSREG_ID_MMFR0_EL1 = 0xC00C, + ARM64_SYSREG_ID_MMFR1_EL1 = 0xC00D, + ARM64_SYSREG_ID_MMFR2_EL1 = 0xC00E, + ARM64_SYSREG_ID_MMFR3_EL1 = 0xC00F, + ARM64_SYSREG_ID_ISAR0_EL1 = 0xC010, + ARM64_SYSREG_ID_ISAR1_EL1 = 0xC011, + ARM64_SYSREG_ID_ISAR2_EL1 = 0xC012, + ARM64_SYSREG_ID_ISAR3_EL1 = 0xC013, + ARM64_SYSREG_ID_ISAR4_EL1 = 0xC014, + ARM64_SYSREG_ID_ISAR5_EL1 = 0xC015, + ARM64_SYSREG_ID_ISAR6_EL1 = 0xC017, + ARM64_SYSREG_ID_AA64PFR0_EL1 = 0xC020, + ARM64_SYSREG_ID_AA64PFR1_EL1 = 0xC021, + ARM64_SYSREG_ID_AA64DFR0_EL1 = 0xC028, + ARM64_SYSREG_ID_AA64DFR1_EL1 = 0xC029, + ARM64_SYSREG_ID_AA64AFR0_EL1 = 0xC02C, + ARM64_SYSREG_ID_AA64AFR1_EL1 = 0xC02D, + ARM64_SYSREG_ID_AA64ISAR0_EL1 = 0xC030, + ARM64_SYSREG_ID_AA64ISAR1_EL1 = 0xC031, + ARM64_SYSREG_ID_AA64MMFR0_EL1 = 0xC038, + ARM64_SYSREG_ID_AA64MMFR1_EL1 = 0xC039, + ARM64_SYSREG_ID_AA64MMFR2_EL1 = 0xC03A, + ARM64_SYSREG_MVFR0_EL1 = 0xC018, + ARM64_SYSREG_MVFR1_EL1 = 0xC019, + ARM64_SYSREG_MVFR2_EL1 = 0xC01A, + ARM64_SYSREG_RVBAR_EL1 = 0xC601, + ARM64_SYSREG_RVBAR_EL2 = 0xE601, + ARM64_SYSREG_RVBAR_EL3 = 0xF601, + ARM64_SYSREG_ISR_EL1 = 0xC608, + ARM64_SYSREG_CNTPCT_EL0 = 0xDF01, + ARM64_SYSREG_CNTVCT_EL0 = 0xDF02, + ARM64_SYSREG_ID_MMFR4_EL1 = 0xC016, + ARM64_SYSREG_TRCSTATR = 0x8818, + ARM64_SYSREG_TRCIDR8 = 0x8806, + ARM64_SYSREG_TRCIDR9 = 0x880E, + ARM64_SYSREG_TRCIDR10 = 0x8816, + ARM64_SYSREG_TRCIDR11 = 0x881E, + ARM64_SYSREG_TRCIDR12 = 0x8826, + ARM64_SYSREG_TRCIDR13 = 0x882E, + ARM64_SYSREG_TRCIDR0 = 0x8847, + ARM64_SYSREG_TRCIDR1 = 0x884F, + ARM64_SYSREG_TRCIDR2 = 0x8857, + ARM64_SYSREG_TRCIDR3 = 0x885F, + ARM64_SYSREG_TRCIDR4 = 0x8867, + ARM64_SYSREG_TRCIDR5 = 0x886F, + ARM64_SYSREG_TRCIDR6 = 0x8877, + ARM64_SYSREG_TRCIDR7 = 0x887F, + ARM64_SYSREG_TRCOSLSR = 0x888C, + ARM64_SYSREG_TRCPDSR = 0x88AC, + ARM64_SYSREG_TRCDEVAFF0 = 0x8BD6, + ARM64_SYSREG_TRCDEVAFF1 = 0x8BDE, + ARM64_SYSREG_TRCLSR = 0x8BEE, + ARM64_SYSREG_TRCAUTHSTATUS = 0x8BF6, + ARM64_SYSREG_TRCDEVARCH = 0x8BFE, + ARM64_SYSREG_TRCDEVID = 0x8B97, + ARM64_SYSREG_TRCDEVTYPE = 0x8B9F, + ARM64_SYSREG_TRCPIDR4 = 0x8BA7, + ARM64_SYSREG_TRCPIDR5 = 0x8BAF, + ARM64_SYSREG_TRCPIDR6 = 0x8BB7, + ARM64_SYSREG_TRCPIDR7 = 0x8BBF, + ARM64_SYSREG_TRCPIDR0 = 0x8BC7, + ARM64_SYSREG_TRCPIDR1 = 0x8BCF, + ARM64_SYSREG_TRCPIDR2 = 0x8BD7, + ARM64_SYSREG_TRCPIDR3 = 0x8BDF, + ARM64_SYSREG_TRCCIDR0 = 0x8BE7, + ARM64_SYSREG_TRCCIDR1 = 0x8BEF, + ARM64_SYSREG_TRCCIDR2 = 0x8BF7, + ARM64_SYSREG_TRCCIDR3 = 0x8BFF, + ARM64_SYSREG_ICC_IAR1_EL1 = 0xC660, + ARM64_SYSREG_ICC_IAR0_EL1 = 0xC640, + ARM64_SYSREG_ICC_HPPIR1_EL1 = 0xC662, + ARM64_SYSREG_ICC_HPPIR0_EL1 = 0xC642, + ARM64_SYSREG_ICC_RPR_EL1 = 0xC65B, + ARM64_SYSREG_ICH_VTR_EL2 = 0xE659, + ARM64_SYSREG_ICH_EISR_EL2 = 0xE65B, + ARM64_SYSREG_ICH_ELRSR_EL2 = 0xE65D, + ARM64_SYSREG_ID_AA64ZFR0_EL1 = 0xC024, + ARM64_SYSREG_LORID_EL1 = 0xC527, + ARM64_SYSREG_ERRIDR_EL1 = 0xC298, + ARM64_SYSREG_ERXFR_EL1 = 0xC2A0, + ARM64_SYSREG_DBGDTRTX_EL0 = 0x9828, + ARM64_SYSREG_OSLAR_EL1 = 0x8084, + ARM64_SYSREG_PMSWINC_EL0 = 0xDCE4, + ARM64_SYSREG_TRCOSLAR = 0x8884, + ARM64_SYSREG_TRCLAR = 0x8BE6, + ARM64_SYSREG_ICC_EOIR1_EL1 = 0xC661, + ARM64_SYSREG_ICC_EOIR0_EL1 = 0xC641, + ARM64_SYSREG_ICC_DIR_EL1 = 0xC659, + ARM64_SYSREG_ICC_SGI1R_EL1 = 0xC65D, + ARM64_SYSREG_ICC_ASGI1R_EL1 = 0xC65E, + ARM64_SYSREG_ICC_SGI0R_EL1 = 0xC65F, + ARM64_SYSREG_OSDTRRX_EL1 = 0x8002, + ARM64_SYSREG_OSDTRTX_EL1 = 0x801A, + ARM64_SYSREG_TEECR32_EL1 = 0x9000, + ARM64_SYSREG_MDCCINT_EL1 = 0x8010, + ARM64_SYSREG_MDSCR_EL1 = 0x8012, + ARM64_SYSREG_DBGDTR_EL0 = 0x9820, + ARM64_SYSREG_OSECCR_EL1 = 0x8032, + ARM64_SYSREG_DBGVCR32_EL2 = 0xA038, + ARM64_SYSREG_DBGBVR0_EL1 = 0x8004, + ARM64_SYSREG_DBGBVR1_EL1 = 0x800C, + ARM64_SYSREG_DBGBVR2_EL1 = 0x8014, + ARM64_SYSREG_DBGBVR3_EL1 = 0x801C, + ARM64_SYSREG_DBGBVR4_EL1 = 0x8024, + ARM64_SYSREG_DBGBVR5_EL1 = 0x802C, + ARM64_SYSREG_DBGBVR6_EL1 = 0x8034, + ARM64_SYSREG_DBGBVR7_EL1 = 0x803C, + ARM64_SYSREG_DBGBVR8_EL1 = 0x8044, + ARM64_SYSREG_DBGBVR9_EL1 = 0x804C, + ARM64_SYSREG_DBGBVR10_EL1 = 0x8054, + ARM64_SYSREG_DBGBVR11_EL1 = 0x805C, + ARM64_SYSREG_DBGBVR12_EL1 = 0x8064, + ARM64_SYSREG_DBGBVR13_EL1 = 0x806C, + ARM64_SYSREG_DBGBVR14_EL1 = 0x8074, + ARM64_SYSREG_DBGBVR15_EL1 = 0x807C, + ARM64_SYSREG_DBGBCR0_EL1 = 0x8005, + ARM64_SYSREG_DBGBCR1_EL1 = 0x800D, + ARM64_SYSREG_DBGBCR2_EL1 = 0x8015, + ARM64_SYSREG_DBGBCR3_EL1 = 0x801D, + ARM64_SYSREG_DBGBCR4_EL1 = 0x8025, + ARM64_SYSREG_DBGBCR5_EL1 = 0x802D, + ARM64_SYSREG_DBGBCR6_EL1 = 0x8035, + ARM64_SYSREG_DBGBCR7_EL1 = 0x803D, + ARM64_SYSREG_DBGBCR8_EL1 = 0x8045, + ARM64_SYSREG_DBGBCR9_EL1 = 0x804D, + ARM64_SYSREG_DBGBCR10_EL1 = 0x8055, + ARM64_SYSREG_DBGBCR11_EL1 = 0x805D, + ARM64_SYSREG_DBGBCR12_EL1 = 0x8065, + ARM64_SYSREG_DBGBCR13_EL1 = 0x806D, + ARM64_SYSREG_DBGBCR14_EL1 = 0x8075, + ARM64_SYSREG_DBGBCR15_EL1 = 0x807D, + ARM64_SYSREG_DBGWVR0_EL1 = 0x8006, + ARM64_SYSREG_DBGWVR1_EL1 = 0x800E, + ARM64_SYSREG_DBGWVR2_EL1 = 0x8016, + ARM64_SYSREG_DBGWVR3_EL1 = 0x801E, + ARM64_SYSREG_DBGWVR4_EL1 = 0x8026, + ARM64_SYSREG_DBGWVR5_EL1 = 0x802E, + ARM64_SYSREG_DBGWVR6_EL1 = 0x8036, + ARM64_SYSREG_DBGWVR7_EL1 = 0x803E, + ARM64_SYSREG_DBGWVR8_EL1 = 0x8046, + ARM64_SYSREG_DBGWVR9_EL1 = 0x804E, + ARM64_SYSREG_DBGWVR10_EL1 = 0x8056, + ARM64_SYSREG_DBGWVR11_EL1 = 0x805E, + ARM64_SYSREG_DBGWVR12_EL1 = 0x8066, + ARM64_SYSREG_DBGWVR13_EL1 = 0x806E, + ARM64_SYSREG_DBGWVR14_EL1 = 0x8076, + ARM64_SYSREG_DBGWVR15_EL1 = 0x807E, + ARM64_SYSREG_DBGWCR0_EL1 = 0x8007, + ARM64_SYSREG_DBGWCR1_EL1 = 0x800F, + ARM64_SYSREG_DBGWCR2_EL1 = 0x8017, + ARM64_SYSREG_DBGWCR3_EL1 = 0x801F, + ARM64_SYSREG_DBGWCR4_EL1 = 0x8027, + ARM64_SYSREG_DBGWCR5_EL1 = 0x802F, + ARM64_SYSREG_DBGWCR6_EL1 = 0x8037, + ARM64_SYSREG_DBGWCR7_EL1 = 0x803F, + ARM64_SYSREG_DBGWCR8_EL1 = 0x8047, + ARM64_SYSREG_DBGWCR9_EL1 = 0x804F, + ARM64_SYSREG_DBGWCR10_EL1 = 0x8057, + ARM64_SYSREG_DBGWCR11_EL1 = 0x805F, + ARM64_SYSREG_DBGWCR12_EL1 = 0x8067, + ARM64_SYSREG_DBGWCR13_EL1 = 0x806F, + ARM64_SYSREG_DBGWCR14_EL1 = 0x8077, + ARM64_SYSREG_DBGWCR15_EL1 = 0x807F, + ARM64_SYSREG_TEEHBR32_EL1 = 0x9080, + ARM64_SYSREG_OSDLR_EL1 = 0x809C, + ARM64_SYSREG_DBGPRCR_EL1 = 0x80A4, + ARM64_SYSREG_DBGCLAIMSET_EL1 = 0x83C6, + ARM64_SYSREG_DBGCLAIMCLR_EL1 = 0x83CE, + ARM64_SYSREG_CSSELR_EL1 = 0xD000, + ARM64_SYSREG_VPIDR_EL2 = 0xE000, + ARM64_SYSREG_VMPIDR_EL2 = 0xE005, + ARM64_SYSREG_CPACR_EL1 = 0xC082, + ARM64_SYSREG_SCTLR_EL1 = 0xC080, + ARM64_SYSREG_SCTLR_EL2 = 0xE080, + ARM64_SYSREG_SCTLR_EL3 = 0xF080, + ARM64_SYSREG_ACTLR_EL1 = 0xC081, + ARM64_SYSREG_ACTLR_EL2 = 0xE081, + ARM64_SYSREG_ACTLR_EL3 = 0xF081, + ARM64_SYSREG_HCR_EL2 = 0xE088, + ARM64_SYSREG_SCR_EL3 = 0xF088, + ARM64_SYSREG_MDCR_EL2 = 0xE089, + ARM64_SYSREG_SDER32_EL3 = 0xF089, + ARM64_SYSREG_CPTR_EL2 = 0xE08A, + ARM64_SYSREG_CPTR_EL3 = 0xF08A, + ARM64_SYSREG_HSTR_EL2 = 0xE08B, + ARM64_SYSREG_HACR_EL2 = 0xE08F, + ARM64_SYSREG_MDCR_EL3 = 0xF099, + ARM64_SYSREG_TTBR0_EL1 = 0xC100, + ARM64_SYSREG_TTBR0_EL2 = 0xE100, + ARM64_SYSREG_TTBR0_EL3 = 0xF100, + ARM64_SYSREG_TTBR1_EL1 = 0xC101, + ARM64_SYSREG_TCR_EL1 = 0xC102, + ARM64_SYSREG_TCR_EL2 = 0xE102, + ARM64_SYSREG_TCR_EL3 = 0xF102, + ARM64_SYSREG_VTTBR_EL2 = 0xE108, + ARM64_SYSREG_VTCR_EL2 = 0xE10A, + ARM64_SYSREG_DACR32_EL2 = 0xE180, + ARM64_SYSREG_SPSR_EL1 = 0xC200, + ARM64_SYSREG_SPSR_EL2 = 0xE200, + ARM64_SYSREG_SPSR_EL3 = 0xF200, + ARM64_SYSREG_ELR_EL1 = 0xC201, + ARM64_SYSREG_ELR_EL2 = 0xE201, + ARM64_SYSREG_ELR_EL3 = 0xF201, + ARM64_SYSREG_SP_EL0 = 0xC208, + ARM64_SYSREG_SP_EL1 = 0xE208, + ARM64_SYSREG_SP_EL2 = 0xF208, + ARM64_SYSREG_SPSEL = 0xC210, + ARM64_SYSREG_NZCV = 0xDA10, + ARM64_SYSREG_DAIF = 0xDA11, + ARM64_SYSREG_CURRENTEL = 0xC212, + ARM64_SYSREG_SPSR_IRQ = 0xE218, + ARM64_SYSREG_SPSR_ABT = 0xE219, + ARM64_SYSREG_SPSR_UND = 0xE21A, + ARM64_SYSREG_SPSR_FIQ = 0xE21B, + ARM64_SYSREG_FPCR = 0xDA20, + ARM64_SYSREG_FPSR = 0xDA21, + ARM64_SYSREG_DSPSR_EL0 = 0xDA28, + ARM64_SYSREG_DLR_EL0 = 0xDA29, + ARM64_SYSREG_IFSR32_EL2 = 0xE281, + ARM64_SYSREG_AFSR0_EL1 = 0xC288, + ARM64_SYSREG_AFSR0_EL2 = 0xE288, + ARM64_SYSREG_AFSR0_EL3 = 0xF288, + ARM64_SYSREG_AFSR1_EL1 = 0xC289, + ARM64_SYSREG_AFSR1_EL2 = 0xE289, + ARM64_SYSREG_AFSR1_EL3 = 0xF289, + ARM64_SYSREG_ESR_EL1 = 0xC290, + ARM64_SYSREG_ESR_EL2 = 0xE290, + ARM64_SYSREG_ESR_EL3 = 0xF290, + ARM64_SYSREG_FPEXC32_EL2 = 0xE298, + ARM64_SYSREG_FAR_EL1 = 0xC300, + ARM64_SYSREG_FAR_EL2 = 0xE300, + ARM64_SYSREG_FAR_EL3 = 0xF300, + ARM64_SYSREG_HPFAR_EL2 = 0xE304, + ARM64_SYSREG_PAR_EL1 = 0xC3A0, + ARM64_SYSREG_PMCR_EL0 = 0xDCE0, + ARM64_SYSREG_PMCNTENSET_EL0 = 0xDCE1, + ARM64_SYSREG_PMCNTENCLR_EL0 = 0xDCE2, + ARM64_SYSREG_PMOVSCLR_EL0 = 0xDCE3, + ARM64_SYSREG_PMSELR_EL0 = 0xDCE5, + ARM64_SYSREG_PMCCNTR_EL0 = 0xDCE8, + ARM64_SYSREG_PMXEVTYPER_EL0 = 0xDCE9, + ARM64_SYSREG_PMXEVCNTR_EL0 = 0xDCEA, + ARM64_SYSREG_PMUSERENR_EL0 = 0xDCF0, + ARM64_SYSREG_PMINTENSET_EL1 = 0xC4F1, + ARM64_SYSREG_PMINTENCLR_EL1 = 0xC4F2, + ARM64_SYSREG_PMOVSSET_EL0 = 0xDCF3, + ARM64_SYSREG_MAIR_EL1 = 0xC510, + ARM64_SYSREG_MAIR_EL2 = 0xE510, + ARM64_SYSREG_MAIR_EL3 = 0xF510, + ARM64_SYSREG_AMAIR_EL1 = 0xC518, + ARM64_SYSREG_AMAIR_EL2 = 0xE518, + ARM64_SYSREG_AMAIR_EL3 = 0xF518, + ARM64_SYSREG_VBAR_EL1 = 0xC600, + ARM64_SYSREG_VBAR_EL2 = 0xE600, + ARM64_SYSREG_VBAR_EL3 = 0xF600, + ARM64_SYSREG_RMR_EL1 = 0xC602, + ARM64_SYSREG_RMR_EL2 = 0xE602, + ARM64_SYSREG_RMR_EL3 = 0xF602, + ARM64_SYSREG_CONTEXTIDR_EL1 = 0xC681, + ARM64_SYSREG_TPIDR_EL0 = 0xDE82, + ARM64_SYSREG_TPIDR_EL2 = 0xE682, + ARM64_SYSREG_TPIDR_EL3 = 0xF682, + ARM64_SYSREG_TPIDRRO_EL0 = 0xDE83, + ARM64_SYSREG_TPIDR_EL1 = 0xC684, + ARM64_SYSREG_CNTFRQ_EL0 = 0xDF00, + ARM64_SYSREG_CNTVOFF_EL2 = 0xE703, + ARM64_SYSREG_CNTKCTL_EL1 = 0xC708, + ARM64_SYSREG_CNTHCTL_EL2 = 0xE708, + ARM64_SYSREG_CNTP_TVAL_EL0 = 0xDF10, + ARM64_SYSREG_CNTHP_TVAL_EL2 = 0xE710, + ARM64_SYSREG_CNTPS_TVAL_EL1 = 0xFF10, + ARM64_SYSREG_CNTP_CTL_EL0 = 0xDF11, + ARM64_SYSREG_CNTHP_CTL_EL2 = 0xE711, + ARM64_SYSREG_CNTPS_CTL_EL1 = 0xFF11, + ARM64_SYSREG_CNTP_CVAL_EL0 = 0xDF12, + ARM64_SYSREG_CNTHP_CVAL_EL2 = 0xE712, + ARM64_SYSREG_CNTPS_CVAL_EL1 = 0xFF12, + ARM64_SYSREG_CNTV_TVAL_EL0 = 0xDF18, + ARM64_SYSREG_CNTV_CTL_EL0 = 0xDF19, + ARM64_SYSREG_CNTV_CVAL_EL0 = 0xDF1A, + ARM64_SYSREG_PMEVCNTR0_EL0 = 0xDF40, + ARM64_SYSREG_PMEVCNTR1_EL0 = 0xDF41, + ARM64_SYSREG_PMEVCNTR2_EL0 = 0xDF42, + ARM64_SYSREG_PMEVCNTR3_EL0 = 0xDF43, + ARM64_SYSREG_PMEVCNTR4_EL0 = 0xDF44, + ARM64_SYSREG_PMEVCNTR5_EL0 = 0xDF45, + ARM64_SYSREG_PMEVCNTR6_EL0 = 0xDF46, + ARM64_SYSREG_PMEVCNTR7_EL0 = 0xDF47, + ARM64_SYSREG_PMEVCNTR8_EL0 = 0xDF48, + ARM64_SYSREG_PMEVCNTR9_EL0 = 0xDF49, + ARM64_SYSREG_PMEVCNTR10_EL0 = 0xDF4A, + ARM64_SYSREG_PMEVCNTR11_EL0 = 0xDF4B, + ARM64_SYSREG_PMEVCNTR12_EL0 = 0xDF4C, + ARM64_SYSREG_PMEVCNTR13_EL0 = 0xDF4D, + ARM64_SYSREG_PMEVCNTR14_EL0 = 0xDF4E, + ARM64_SYSREG_PMEVCNTR15_EL0 = 0xDF4F, + ARM64_SYSREG_PMEVCNTR16_EL0 = 0xDF50, + ARM64_SYSREG_PMEVCNTR17_EL0 = 0xDF51, + ARM64_SYSREG_PMEVCNTR18_EL0 = 0xDF52, + ARM64_SYSREG_PMEVCNTR19_EL0 = 0xDF53, + ARM64_SYSREG_PMEVCNTR20_EL0 = 0xDF54, + ARM64_SYSREG_PMEVCNTR21_EL0 = 0xDF55, + ARM64_SYSREG_PMEVCNTR22_EL0 = 0xDF56, + ARM64_SYSREG_PMEVCNTR23_EL0 = 0xDF57, + ARM64_SYSREG_PMEVCNTR24_EL0 = 0xDF58, + ARM64_SYSREG_PMEVCNTR25_EL0 = 0xDF59, + ARM64_SYSREG_PMEVCNTR26_EL0 = 0xDF5A, + ARM64_SYSREG_PMEVCNTR27_EL0 = 0xDF5B, + ARM64_SYSREG_PMEVCNTR28_EL0 = 0xDF5C, + ARM64_SYSREG_PMEVCNTR29_EL0 = 0xDF5D, + ARM64_SYSREG_PMEVCNTR30_EL0 = 0xDF5E, + ARM64_SYSREG_PMCCFILTR_EL0 = 0xDF7F, + ARM64_SYSREG_PMEVTYPER0_EL0 = 0xDF60, + ARM64_SYSREG_PMEVTYPER1_EL0 = 0xDF61, + ARM64_SYSREG_PMEVTYPER2_EL0 = 0xDF62, + ARM64_SYSREG_PMEVTYPER3_EL0 = 0xDF63, + ARM64_SYSREG_PMEVTYPER4_EL0 = 0xDF64, + ARM64_SYSREG_PMEVTYPER5_EL0 = 0xDF65, + ARM64_SYSREG_PMEVTYPER6_EL0 = 0xDF66, + ARM64_SYSREG_PMEVTYPER7_EL0 = 0xDF67, + ARM64_SYSREG_PMEVTYPER8_EL0 = 0xDF68, + ARM64_SYSREG_PMEVTYPER9_EL0 = 0xDF69, + ARM64_SYSREG_PMEVTYPER10_EL0 = 0xDF6A, + ARM64_SYSREG_PMEVTYPER11_EL0 = 0xDF6B, + ARM64_SYSREG_PMEVTYPER12_EL0 = 0xDF6C, + ARM64_SYSREG_PMEVTYPER13_EL0 = 0xDF6D, + ARM64_SYSREG_PMEVTYPER14_EL0 = 0xDF6E, + ARM64_SYSREG_PMEVTYPER15_EL0 = 0xDF6F, + ARM64_SYSREG_PMEVTYPER16_EL0 = 0xDF70, + ARM64_SYSREG_PMEVTYPER17_EL0 = 0xDF71, + ARM64_SYSREG_PMEVTYPER18_EL0 = 0xDF72, + ARM64_SYSREG_PMEVTYPER19_EL0 = 0xDF73, + ARM64_SYSREG_PMEVTYPER20_EL0 = 0xDF74, + ARM64_SYSREG_PMEVTYPER21_EL0 = 0xDF75, + ARM64_SYSREG_PMEVTYPER22_EL0 = 0xDF76, + ARM64_SYSREG_PMEVTYPER23_EL0 = 0xDF77, + ARM64_SYSREG_PMEVTYPER24_EL0 = 0xDF78, + ARM64_SYSREG_PMEVTYPER25_EL0 = 0xDF79, + ARM64_SYSREG_PMEVTYPER26_EL0 = 0xDF7A, + ARM64_SYSREG_PMEVTYPER27_EL0 = 0xDF7B, + ARM64_SYSREG_PMEVTYPER28_EL0 = 0xDF7C, + ARM64_SYSREG_PMEVTYPER29_EL0 = 0xDF7D, + ARM64_SYSREG_PMEVTYPER30_EL0 = 0xDF7E, + ARM64_SYSREG_TRCPRGCTLR = 0x8808, + ARM64_SYSREG_TRCPROCSELR = 0x8810, + ARM64_SYSREG_TRCCONFIGR = 0x8820, + ARM64_SYSREG_TRCAUXCTLR = 0x8830, + ARM64_SYSREG_TRCEVENTCTL0R = 0x8840, + ARM64_SYSREG_TRCEVENTCTL1R = 0x8848, + ARM64_SYSREG_TRCSTALLCTLR = 0x8858, + ARM64_SYSREG_TRCTSCTLR = 0x8860, + ARM64_SYSREG_TRCSYNCPR = 0x8868, + ARM64_SYSREG_TRCCCCTLR = 0x8870, + ARM64_SYSREG_TRCBBCTLR = 0x8878, + ARM64_SYSREG_TRCTRACEIDR = 0x8801, + ARM64_SYSREG_TRCQCTLR = 0x8809, + ARM64_SYSREG_TRCVICTLR = 0x8802, + ARM64_SYSREG_TRCVIIECTLR = 0x880A, + ARM64_SYSREG_TRCVISSCTLR = 0x8812, + ARM64_SYSREG_TRCVIPCSSCTLR = 0x881A, + ARM64_SYSREG_TRCVDCTLR = 0x8842, + ARM64_SYSREG_TRCVDSACCTLR = 0x884A, + ARM64_SYSREG_TRCVDARCCTLR = 0x8852, + ARM64_SYSREG_TRCSEQEVR0 = 0x8804, + ARM64_SYSREG_TRCSEQEVR1 = 0x880C, + ARM64_SYSREG_TRCSEQEVR2 = 0x8814, + ARM64_SYSREG_TRCSEQRSTEVR = 0x8834, + ARM64_SYSREG_TRCSEQSTR = 0x883C, + ARM64_SYSREG_TRCEXTINSELR = 0x8844, + ARM64_SYSREG_TRCCNTRLDVR0 = 0x8805, + ARM64_SYSREG_TRCCNTRLDVR1 = 0x880D, + ARM64_SYSREG_TRCCNTRLDVR2 = 0x8815, + ARM64_SYSREG_TRCCNTRLDVR3 = 0x881D, + ARM64_SYSREG_TRCCNTCTLR0 = 0x8825, + ARM64_SYSREG_TRCCNTCTLR1 = 0x882D, + ARM64_SYSREG_TRCCNTCTLR2 = 0x8835, + ARM64_SYSREG_TRCCNTCTLR3 = 0x883D, + ARM64_SYSREG_TRCCNTVR0 = 0x8845, + ARM64_SYSREG_TRCCNTVR1 = 0x884D, + ARM64_SYSREG_TRCCNTVR2 = 0x8855, + ARM64_SYSREG_TRCCNTVR3 = 0x885D, + ARM64_SYSREG_TRCIMSPEC0 = 0x8807, + ARM64_SYSREG_TRCIMSPEC1 = 0x880F, + ARM64_SYSREG_TRCIMSPEC2 = 0x8817, + ARM64_SYSREG_TRCIMSPEC3 = 0x881F, + ARM64_SYSREG_TRCIMSPEC4 = 0x8827, + ARM64_SYSREG_TRCIMSPEC5 = 0x882F, + ARM64_SYSREG_TRCIMSPEC6 = 0x8837, + ARM64_SYSREG_TRCIMSPEC7 = 0x883F, + ARM64_SYSREG_TRCRSCTLR2 = 0x8890, + ARM64_SYSREG_TRCRSCTLR3 = 0x8898, + ARM64_SYSREG_TRCRSCTLR4 = 0x88A0, + ARM64_SYSREG_TRCRSCTLR5 = 0x88A8, + ARM64_SYSREG_TRCRSCTLR6 = 0x88B0, + ARM64_SYSREG_TRCRSCTLR7 = 0x88B8, + ARM64_SYSREG_TRCRSCTLR8 = 0x88C0, + ARM64_SYSREG_TRCRSCTLR9 = 0x88C8, + ARM64_SYSREG_TRCRSCTLR10 = 0x88D0, + ARM64_SYSREG_TRCRSCTLR11 = 0x88D8, + ARM64_SYSREG_TRCRSCTLR12 = 0x88E0, + ARM64_SYSREG_TRCRSCTLR13 = 0x88E8, + ARM64_SYSREG_TRCRSCTLR14 = 0x88F0, + ARM64_SYSREG_TRCRSCTLR15 = 0x88F8, + ARM64_SYSREG_TRCRSCTLR16 = 0x8881, + ARM64_SYSREG_TRCRSCTLR17 = 0x8889, + ARM64_SYSREG_TRCRSCTLR18 = 0x8891, + ARM64_SYSREG_TRCRSCTLR19 = 0x8899, + ARM64_SYSREG_TRCRSCTLR20 = 0x88A1, + ARM64_SYSREG_TRCRSCTLR21 = 0x88A9, + ARM64_SYSREG_TRCRSCTLR22 = 0x88B1, + ARM64_SYSREG_TRCRSCTLR23 = 0x88B9, + ARM64_SYSREG_TRCRSCTLR24 = 0x88C1, + ARM64_SYSREG_TRCRSCTLR25 = 0x88C9, + ARM64_SYSREG_TRCRSCTLR26 = 0x88D1, + ARM64_SYSREG_TRCRSCTLR27 = 0x88D9, + ARM64_SYSREG_TRCRSCTLR28 = 0x88E1, + ARM64_SYSREG_TRCRSCTLR29 = 0x88E9, + ARM64_SYSREG_TRCRSCTLR30 = 0x88F1, + ARM64_SYSREG_TRCRSCTLR31 = 0x88F9, + ARM64_SYSREG_TRCSSCCR0 = 0x8882, + ARM64_SYSREG_TRCSSCCR1 = 0x888A, + ARM64_SYSREG_TRCSSCCR2 = 0x8892, + ARM64_SYSREG_TRCSSCCR3 = 0x889A, + ARM64_SYSREG_TRCSSCCR4 = 0x88A2, + ARM64_SYSREG_TRCSSCCR5 = 0x88AA, + ARM64_SYSREG_TRCSSCCR6 = 0x88B2, + ARM64_SYSREG_TRCSSCCR7 = 0x88BA, + ARM64_SYSREG_TRCSSCSR0 = 0x88C2, + ARM64_SYSREG_TRCSSCSR1 = 0x88CA, + ARM64_SYSREG_TRCSSCSR2 = 0x88D2, + ARM64_SYSREG_TRCSSCSR3 = 0x88DA, + ARM64_SYSREG_TRCSSCSR4 = 0x88E2, + ARM64_SYSREG_TRCSSCSR5 = 0x88EA, + ARM64_SYSREG_TRCSSCSR6 = 0x88F2, + ARM64_SYSREG_TRCSSCSR7 = 0x88FA, + ARM64_SYSREG_TRCSSPCICR0 = 0x8883, + ARM64_SYSREG_TRCSSPCICR1 = 0x888B, + ARM64_SYSREG_TRCSSPCICR2 = 0x8893, + ARM64_SYSREG_TRCSSPCICR3 = 0x889B, + ARM64_SYSREG_TRCSSPCICR4 = 0x88A3, + ARM64_SYSREG_TRCSSPCICR5 = 0x88AB, + ARM64_SYSREG_TRCSSPCICR6 = 0x88B3, + ARM64_SYSREG_TRCSSPCICR7 = 0x88BB, + ARM64_SYSREG_TRCPDCR = 0x88A4, + ARM64_SYSREG_TRCACVR0 = 0x8900, + ARM64_SYSREG_TRCACVR1 = 0x8910, + ARM64_SYSREG_TRCACVR2 = 0x8920, + ARM64_SYSREG_TRCACVR3 = 0x8930, + ARM64_SYSREG_TRCACVR4 = 0x8940, + ARM64_SYSREG_TRCACVR5 = 0x8950, + ARM64_SYSREG_TRCACVR6 = 0x8960, + ARM64_SYSREG_TRCACVR7 = 0x8970, + ARM64_SYSREG_TRCACVR8 = 0x8901, + ARM64_SYSREG_TRCACVR9 = 0x8911, + ARM64_SYSREG_TRCACVR10 = 0x8921, + ARM64_SYSREG_TRCACVR11 = 0x8931, + ARM64_SYSREG_TRCACVR12 = 0x8941, + ARM64_SYSREG_TRCACVR13 = 0x8951, + ARM64_SYSREG_TRCACVR14 = 0x8961, + ARM64_SYSREG_TRCACVR15 = 0x8971, + ARM64_SYSREG_TRCACATR0 = 0x8902, + ARM64_SYSREG_TRCACATR1 = 0x8912, + ARM64_SYSREG_TRCACATR2 = 0x8922, + ARM64_SYSREG_TRCACATR3 = 0x8932, + ARM64_SYSREG_TRCACATR4 = 0x8942, + ARM64_SYSREG_TRCACATR5 = 0x8952, + ARM64_SYSREG_TRCACATR6 = 0x8962, + ARM64_SYSREG_TRCACATR7 = 0x8972, + ARM64_SYSREG_TRCACATR8 = 0x8903, + ARM64_SYSREG_TRCACATR9 = 0x8913, + ARM64_SYSREG_TRCACATR10 = 0x8923, + ARM64_SYSREG_TRCACATR11 = 0x8933, + ARM64_SYSREG_TRCACATR12 = 0x8943, + ARM64_SYSREG_TRCACATR13 = 0x8953, + ARM64_SYSREG_TRCACATR14 = 0x8963, + ARM64_SYSREG_TRCACATR15 = 0x8973, + ARM64_SYSREG_TRCDVCVR0 = 0x8904, + ARM64_SYSREG_TRCDVCVR1 = 0x8924, + ARM64_SYSREG_TRCDVCVR2 = 0x8944, + ARM64_SYSREG_TRCDVCVR3 = 0x8964, + ARM64_SYSREG_TRCDVCVR4 = 0x8905, + ARM64_SYSREG_TRCDVCVR5 = 0x8925, + ARM64_SYSREG_TRCDVCVR6 = 0x8945, + ARM64_SYSREG_TRCDVCVR7 = 0x8965, + ARM64_SYSREG_TRCDVCMR0 = 0x8906, + ARM64_SYSREG_TRCDVCMR1 = 0x8926, + ARM64_SYSREG_TRCDVCMR2 = 0x8946, + ARM64_SYSREG_TRCDVCMR3 = 0x8966, + ARM64_SYSREG_TRCDVCMR4 = 0x8907, + ARM64_SYSREG_TRCDVCMR5 = 0x8927, + ARM64_SYSREG_TRCDVCMR6 = 0x8947, + ARM64_SYSREG_TRCDVCMR7 = 0x8967, + ARM64_SYSREG_TRCCIDCVR0 = 0x8980, + ARM64_SYSREG_TRCCIDCVR1 = 0x8990, + ARM64_SYSREG_TRCCIDCVR2 = 0x89A0, + ARM64_SYSREG_TRCCIDCVR3 = 0x89B0, + ARM64_SYSREG_TRCCIDCVR4 = 0x89C0, + ARM64_SYSREG_TRCCIDCVR5 = 0x89D0, + ARM64_SYSREG_TRCCIDCVR6 = 0x89E0, + ARM64_SYSREG_TRCCIDCVR7 = 0x89F0, + ARM64_SYSREG_TRCVMIDCVR0 = 0x8981, + ARM64_SYSREG_TRCVMIDCVR1 = 0x8991, + ARM64_SYSREG_TRCVMIDCVR2 = 0x89A1, + ARM64_SYSREG_TRCVMIDCVR3 = 0x89B1, + ARM64_SYSREG_TRCVMIDCVR4 = 0x89C1, + ARM64_SYSREG_TRCVMIDCVR5 = 0x89D1, + ARM64_SYSREG_TRCVMIDCVR6 = 0x89E1, + ARM64_SYSREG_TRCVMIDCVR7 = 0x89F1, + ARM64_SYSREG_TRCCIDCCTLR0 = 0x8982, + ARM64_SYSREG_TRCCIDCCTLR1 = 0x898A, + ARM64_SYSREG_TRCVMIDCCTLR0 = 0x8992, + ARM64_SYSREG_TRCVMIDCCTLR1 = 0x899A, + ARM64_SYSREG_TRCITCTRL = 0x8B84, + ARM64_SYSREG_TRCCLAIMSET = 0x8BC6, + ARM64_SYSREG_TRCCLAIMCLR = 0x8BCE, + ARM64_SYSREG_ICC_BPR1_EL1 = 0xC663, + ARM64_SYSREG_ICC_BPR0_EL1 = 0xC643, + ARM64_SYSREG_ICC_PMR_EL1 = 0xC230, + ARM64_SYSREG_ICC_CTLR_EL1 = 0xC664, + ARM64_SYSREG_ICC_CTLR_EL3 = 0xF664, + ARM64_SYSREG_ICC_SRE_EL1 = 0xC665, + ARM64_SYSREG_ICC_SRE_EL2 = 0xE64D, + ARM64_SYSREG_ICC_SRE_EL3 = 0xF665, + ARM64_SYSREG_ICC_IGRPEN0_EL1 = 0xC666, + ARM64_SYSREG_ICC_IGRPEN1_EL1 = 0xC667, + ARM64_SYSREG_ICC_IGRPEN1_EL3 = 0xF667, + ARM64_SYSREG_ICC_SEIEN_EL1 = 0xC668, + ARM64_SYSREG_ICC_AP0R0_EL1 = 0xC644, + ARM64_SYSREG_ICC_AP0R1_EL1 = 0xC645, + ARM64_SYSREG_ICC_AP0R2_EL1 = 0xC646, + ARM64_SYSREG_ICC_AP0R3_EL1 = 0xC647, + ARM64_SYSREG_ICC_AP1R0_EL1 = 0xC648, + ARM64_SYSREG_ICC_AP1R1_EL1 = 0xC649, + ARM64_SYSREG_ICC_AP1R2_EL1 = 0xC64A, + ARM64_SYSREG_ICC_AP1R3_EL1 = 0xC64B, + ARM64_SYSREG_ICH_AP0R0_EL2 = 0xE640, + ARM64_SYSREG_ICH_AP0R1_EL2 = 0xE641, + ARM64_SYSREG_ICH_AP0R2_EL2 = 0xE642, + ARM64_SYSREG_ICH_AP0R3_EL2 = 0xE643, + ARM64_SYSREG_ICH_AP1R0_EL2 = 0xE648, + ARM64_SYSREG_ICH_AP1R1_EL2 = 0xE649, + ARM64_SYSREG_ICH_AP1R2_EL2 = 0xE64A, + ARM64_SYSREG_ICH_AP1R3_EL2 = 0xE64B, + ARM64_SYSREG_ICH_HCR_EL2 = 0xE658, + ARM64_SYSREG_ICH_MISR_EL2 = 0xE65A, + ARM64_SYSREG_ICH_VMCR_EL2 = 0xE65F, + ARM64_SYSREG_ICH_VSEIR_EL2 = 0xE64C, + ARM64_SYSREG_ICH_LR0_EL2 = 0xE660, + ARM64_SYSREG_ICH_LR1_EL2 = 0xE661, + ARM64_SYSREG_ICH_LR2_EL2 = 0xE662, + ARM64_SYSREG_ICH_LR3_EL2 = 0xE663, + ARM64_SYSREG_ICH_LR4_EL2 = 0xE664, + ARM64_SYSREG_ICH_LR5_EL2 = 0xE665, + ARM64_SYSREG_ICH_LR6_EL2 = 0xE666, + ARM64_SYSREG_ICH_LR7_EL2 = 0xE667, + ARM64_SYSREG_ICH_LR8_EL2 = 0xE668, + ARM64_SYSREG_ICH_LR9_EL2 = 0xE669, + ARM64_SYSREG_ICH_LR10_EL2 = 0xE66A, + ARM64_SYSREG_ICH_LR11_EL2 = 0xE66B, + ARM64_SYSREG_ICH_LR12_EL2 = 0xE66C, + ARM64_SYSREG_ICH_LR13_EL2 = 0xE66D, + ARM64_SYSREG_ICH_LR14_EL2 = 0xE66E, + ARM64_SYSREG_ICH_LR15_EL2 = 0xE66F, + ARM64_SYSREG_PAN = 0xC213, + ARM64_SYSREG_LORSA_EL1 = 0xC520, + ARM64_SYSREG_LOREA_EL1 = 0xC521, + ARM64_SYSREG_LORN_EL1 = 0xC522, + ARM64_SYSREG_LORC_EL1 = 0xC523, + ARM64_SYSREG_TTBR1_EL2 = 0xE101, + ARM64_SYSREG_CONTEXTIDR_EL2 = 0xE681, + ARM64_SYSREG_CNTHV_TVAL_EL2 = 0xE718, + ARM64_SYSREG_CNTHV_CVAL_EL2 = 0xE71A, + ARM64_SYSREG_CNTHV_CTL_EL2 = 0xE719, + ARM64_SYSREG_SCTLR_EL12 = 0xE880, + ARM64_SYSREG_CPACR_EL12 = 0xE882, + ARM64_SYSREG_TTBR0_EL12 = 0xE900, + ARM64_SYSREG_TTBR1_EL12 = 0xE901, + ARM64_SYSREG_TCR_EL12 = 0xE902, + ARM64_SYSREG_AFSR0_EL12 = 0xEA88, + ARM64_SYSREG_AFSR1_EL12 = 0xEA89, + ARM64_SYSREG_ESR_EL12 = 0xEA90, + ARM64_SYSREG_FAR_EL12 = 0xEB00, + ARM64_SYSREG_MAIR_EL12 = 0xED10, + ARM64_SYSREG_AMAIR_EL12 = 0xED18, + ARM64_SYSREG_VBAR_EL12 = 0xEE00, + ARM64_SYSREG_CONTEXTIDR_EL12 = 0xEE81, + ARM64_SYSREG_CNTKCTL_EL12 = 0xEF08, + ARM64_SYSREG_CNTP_TVAL_EL02 = 0xEF10, + ARM64_SYSREG_CNTP_CTL_EL02 = 0xEF11, + ARM64_SYSREG_CNTP_CVAL_EL02 = 0xEF12, + ARM64_SYSREG_CNTV_TVAL_EL02 = 0xEF18, + ARM64_SYSREG_CNTV_CTL_EL02 = 0xEF19, + ARM64_SYSREG_CNTV_CVAL_EL02 = 0xEF1A, + ARM64_SYSREG_SPSR_EL12 = 0xEA00, + ARM64_SYSREG_ELR_EL12 = 0xEA01, + ARM64_SYSREG_UAO = 0xC214, + ARM64_SYSREG_PMBLIMITR_EL1 = 0xC4D0, + ARM64_SYSREG_PMBPTR_EL1 = 0xC4D1, + ARM64_SYSREG_PMBSR_EL1 = 0xC4D3, + ARM64_SYSREG_PMBIDR_EL1 = 0xC4D7, + ARM64_SYSREG_PMSCR_EL2 = 0xE4C8, + ARM64_SYSREG_PMSCR_EL12 = 0xECC8, + ARM64_SYSREG_PMSCR_EL1 = 0xC4C8, + ARM64_SYSREG_PMSICR_EL1 = 0xC4CA, + ARM64_SYSREG_PMSIRR_EL1 = 0xC4CB, + ARM64_SYSREG_PMSFCR_EL1 = 0xC4CC, + ARM64_SYSREG_PMSEVFR_EL1 = 0xC4CD, + ARM64_SYSREG_PMSLATFR_EL1 = 0xC4CE, + ARM64_SYSREG_PMSIDR_EL1 = 0xC4CF, + ARM64_SYSREG_ERRSELR_EL1 = 0xC299, + ARM64_SYSREG_ERXCTLR_EL1 = 0xC2A1, + ARM64_SYSREG_ERXSTATUS_EL1 = 0xC2A2, + ARM64_SYSREG_ERXADDR_EL1 = 0xC2A3, + ARM64_SYSREG_ERXMISC0_EL1 = 0xC2A8, + ARM64_SYSREG_ERXMISC1_EL1 = 0xC2A9, + ARM64_SYSREG_DISR_EL1 = 0xC609, + ARM64_SYSREG_VDISR_EL2 = 0xE609, + ARM64_SYSREG_VSESR_EL2 = 0xE293, + ARM64_SYSREG_APIAKEYLO_EL1 = 0xC108, + ARM64_SYSREG_APIAKEYHI_EL1 = 0xC109, + ARM64_SYSREG_APIBKEYLO_EL1 = 0xC10A, + ARM64_SYSREG_APIBKEYHI_EL1 = 0xC10B, + ARM64_SYSREG_APDAKEYLO_EL1 = 0xC110, + ARM64_SYSREG_APDAKEYHI_EL1 = 0xC111, + ARM64_SYSREG_APDBKEYLO_EL1 = 0xC112, + ARM64_SYSREG_APDBKEYHI_EL1 = 0xC113, + ARM64_SYSREG_APGAKEYLO_EL1 = 0xC118, + ARM64_SYSREG_APGAKEYHI_EL1 = 0xC119, + ARM64_SYSREG_VSTCR_EL2 = 0xE132, + ARM64_SYSREG_VSTTBR_EL2 = 0xE130, + ARM64_SYSREG_CNTHVS_TVAL_EL2 = 0xE720, + ARM64_SYSREG_CNTHVS_CVAL_EL2 = 0xE722, + ARM64_SYSREG_CNTHVS_CTL_EL2 = 0xE721, + ARM64_SYSREG_CNTHPS_TVAL_EL2 = 0xE728, + ARM64_SYSREG_CNTHPS_CVAL_EL2 = 0xE72A, + ARM64_SYSREG_CNTHPS_CTL_EL2 = 0xE729, + ARM64_SYSREG_SDER32_EL2 = 0xE099, + ARM64_SYSREG_ERXPFGCTL_EL1 = 0xC2A5, + ARM64_SYSREG_ERXPFGCDN_EL1 = 0xC2A6, + ARM64_SYSREG_ERXTS_EL1 = 0xC2AF, + ARM64_SYSREG_ERXMISC2_EL1 = 0xC2AA, + ARM64_SYSREG_ERXMISC3_EL1 = 0xC2AB, + ARM64_SYSREG_ERXPFGF_EL1 = 0xC2A4, + ARM64_SYSREG_MPAM0_EL1 = 0xC529, + ARM64_SYSREG_MPAM1_EL1 = 0xC528, + ARM64_SYSREG_MPAM2_EL2 = 0xE528, + ARM64_SYSREG_MPAM3_EL3 = 0xF528, + ARM64_SYSREG_MPAM1_EL12 = 0xED28, + ARM64_SYSREG_MPAMHCR_EL2 = 0xE520, + ARM64_SYSREG_MPAMVPMV_EL2 = 0xE521, + ARM64_SYSREG_MPAMVPM0_EL2 = 0xE530, + ARM64_SYSREG_MPAMVPM1_EL2 = 0xE531, + ARM64_SYSREG_MPAMVPM2_EL2 = 0xE532, + ARM64_SYSREG_MPAMVPM3_EL2 = 0xE533, + ARM64_SYSREG_MPAMVPM4_EL2 = 0xE534, + ARM64_SYSREG_MPAMVPM5_EL2 = 0xE535, + ARM64_SYSREG_MPAMVPM6_EL2 = 0xE536, + ARM64_SYSREG_MPAMVPM7_EL2 = 0xE537, + ARM64_SYSREG_MPAMIDR_EL1 = 0xC524, + ARM64_SYSREG_AMCR_EL0 = 0xDE90, + ARM64_SYSREG_AMCFGR_EL0 = 0xDE91, + ARM64_SYSREG_AMCGCR_EL0 = 0xDE92, + ARM64_SYSREG_AMUSERENR_EL0 = 0xDE93, + ARM64_SYSREG_AMCNTENCLR0_EL0 = 0xDE94, + ARM64_SYSREG_AMCNTENSET0_EL0 = 0xDE95, + ARM64_SYSREG_AMEVCNTR00_EL0 = 0xDEA0, + ARM64_SYSREG_AMEVCNTR01_EL0 = 0xDEA1, + ARM64_SYSREG_AMEVCNTR02_EL0 = 0xDEA2, + ARM64_SYSREG_AMEVCNTR03_EL0 = 0xDEA3, + ARM64_SYSREG_AMEVTYPER00_EL0 = 0xDEB0, + ARM64_SYSREG_AMEVTYPER01_EL0 = 0xDEB1, + ARM64_SYSREG_AMEVTYPER02_EL0 = 0xDEB2, + ARM64_SYSREG_AMEVTYPER03_EL0 = 0xDEB3, + ARM64_SYSREG_AMCNTENCLR1_EL0 = 0xDE98, + ARM64_SYSREG_AMCNTENSET1_EL0 = 0xDE99, + ARM64_SYSREG_AMEVCNTR10_EL0 = 0xDEE0, + ARM64_SYSREG_AMEVCNTR11_EL0 = 0xDEE1, + ARM64_SYSREG_AMEVCNTR12_EL0 = 0xDEE2, + ARM64_SYSREG_AMEVCNTR13_EL0 = 0xDEE3, + ARM64_SYSREG_AMEVCNTR14_EL0 = 0xDEE4, + ARM64_SYSREG_AMEVCNTR15_EL0 = 0xDEE5, + ARM64_SYSREG_AMEVCNTR16_EL0 = 0xDEE6, + ARM64_SYSREG_AMEVCNTR17_EL0 = 0xDEE7, + ARM64_SYSREG_AMEVCNTR18_EL0 = 0xDEE8, + ARM64_SYSREG_AMEVCNTR19_EL0 = 0xDEE9, + ARM64_SYSREG_AMEVCNTR110_EL0 = 0xDEEA, + ARM64_SYSREG_AMEVCNTR111_EL0 = 0xDEEB, + ARM64_SYSREG_AMEVCNTR112_EL0 = 0xDEEC, + ARM64_SYSREG_AMEVCNTR113_EL0 = 0xDEED, + ARM64_SYSREG_AMEVCNTR114_EL0 = 0xDEEE, + ARM64_SYSREG_AMEVCNTR115_EL0 = 0xDEEF, + ARM64_SYSREG_AMEVTYPER10_EL0 = 0xDEF0, + ARM64_SYSREG_AMEVTYPER11_EL0 = 0xDEF1, + ARM64_SYSREG_AMEVTYPER12_EL0 = 0xDEF2, + ARM64_SYSREG_AMEVTYPER13_EL0 = 0xDEF3, + ARM64_SYSREG_AMEVTYPER14_EL0 = 0xDEF4, + ARM64_SYSREG_AMEVTYPER15_EL0 = 0xDEF5, + ARM64_SYSREG_AMEVTYPER16_EL0 = 0xDEF6, + ARM64_SYSREG_AMEVTYPER17_EL0 = 0xDEF7, + ARM64_SYSREG_AMEVTYPER18_EL0 = 0xDEF8, + ARM64_SYSREG_AMEVTYPER19_EL0 = 0xDEF9, + ARM64_SYSREG_AMEVTYPER110_EL0 = 0xDEFA, + ARM64_SYSREG_AMEVTYPER111_EL0 = 0xDEFB, + ARM64_SYSREG_AMEVTYPER112_EL0 = 0xDEFC, + ARM64_SYSREG_AMEVTYPER113_EL0 = 0xDEFD, + ARM64_SYSREG_AMEVTYPER114_EL0 = 0xDEFE, + ARM64_SYSREG_AMEVTYPER115_EL0 = 0xDEFF, + ARM64_SYSREG_TRFCR_EL1 = 0xC091, + ARM64_SYSREG_TRFCR_EL2 = 0xE091, + ARM64_SYSREG_TRFCR_EL12 = 0xE891, + ARM64_SYSREG_DIT = 0xDA15, + ARM64_SYSREG_VNCR_EL2 = 0xE110, + ARM64_SYSREG_ZCR_EL1 = 0xC090, + ARM64_SYSREG_ZCR_EL2 = 0xE090, + ARM64_SYSREG_ZCR_EL3 = 0xF090, + ARM64_SYSREG_ZCR_EL12 = 0xE890, + ARM64_SYSREG_CPM_IOACC_CTL_EL3 = 0xFF90, +} arm64_sysreg; + +/// System PState Field (MSR instruction) +typedef enum arm64_pstate { + ARM64_PSTATE_INVALID = 0, + ARM64_PSTATE_SPSEL = 0x05, + ARM64_PSTATE_DAIFSET = 0x1e, + ARM64_PSTATE_DAIFCLR = 0x1f, + ARM64_PSTATE_PAN = 0x4, + ARM64_PSTATE_UAO = 0x3, + ARM64_PSTATE_DIT = 0x1a, +} arm64_pstate; + +/// Vector arrangement specifier (for FloatingPoint/Advanced SIMD insn) +typedef enum arm64_vas { + ARM64_VAS_INVALID = 0, + ARM64_VAS_16B, + ARM64_VAS_8B, + ARM64_VAS_4B, + ARM64_VAS_1B, + ARM64_VAS_8H, + ARM64_VAS_4H, + ARM64_VAS_2H, + ARM64_VAS_1H, + ARM64_VAS_4S, + ARM64_VAS_2S, + ARM64_VAS_1S, + ARM64_VAS_2D, + ARM64_VAS_1D, + ARM64_VAS_1Q, +} arm64_vas; + +/// Memory barrier operands +typedef enum arm64_barrier_op { + ARM64_BARRIER_INVALID = 0, + ARM64_BARRIER_OSHLD = 0x1, + ARM64_BARRIER_OSHST = 0x2, + ARM64_BARRIER_OSH = 0x3, + ARM64_BARRIER_NSHLD = 0x5, + ARM64_BARRIER_NSHST = 0x6, + ARM64_BARRIER_NSH = 0x7, + ARM64_BARRIER_ISHLD = 0x9, + ARM64_BARRIER_ISHST = 0xa, + ARM64_BARRIER_ISH = 0xb, + ARM64_BARRIER_LD = 0xd, + ARM64_BARRIER_ST = 0xe, + ARM64_BARRIER_SY = 0xf +} arm64_barrier_op; + +/// Operand type for instruction's operands +typedef enum arm64_op_type { + ARM64_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + ARM64_OP_REG, ///< = CS_OP_REG (Register operand). + ARM64_OP_IMM, ///< = CS_OP_IMM (Immediate operand). + ARM64_OP_MEM, ///< = CS_OP_MEM (Memory operand). + ARM64_OP_FP, ///< = CS_OP_FP (Floating-Point operand). + ARM64_OP_CIMM = 64, ///< C-Immediate + ARM64_OP_REG_MRS, ///< MRS register operand. + ARM64_OP_REG_MSR, ///< MSR register operand. + ARM64_OP_PSTATE, ///< PState operand. + ARM64_OP_SYS, ///< SYS operand for IC/DC/AT/TLBI instructions. + ARM64_OP_PREFETCH, ///< Prefetch operand (PRFM). + ARM64_OP_BARRIER, ///< Memory barrier operand (ISB/DMB/DSB instructions). +} arm64_op_type; + +/// TLBI operations +typedef enum arm64_tlbi_op { + ARM64_TLBI_INVALID = 0, + + ARM64_TLBI_IPAS2E1IS, + ARM64_TLBI_IPAS2LE1IS, + ARM64_TLBI_VMALLE1IS, + ARM64_TLBI_ALLE2IS, + ARM64_TLBI_ALLE3IS, + ARM64_TLBI_VAE1IS, + ARM64_TLBI_VAE2IS, + ARM64_TLBI_VAE3IS, + ARM64_TLBI_ASIDE1IS, + ARM64_TLBI_VAAE1IS, + ARM64_TLBI_ALLE1IS, + ARM64_TLBI_VALE1IS, + ARM64_TLBI_VALE2IS, + ARM64_TLBI_VALE3IS, + ARM64_TLBI_VMALLS12E1IS, + ARM64_TLBI_VAALE1IS, + ARM64_TLBI_IPAS2E1, + ARM64_TLBI_IPAS2LE1, + ARM64_TLBI_VMALLE1, + ARM64_TLBI_ALLE2, + ARM64_TLBI_ALLE3, + ARM64_TLBI_VAE1, + ARM64_TLBI_VAE2, + ARM64_TLBI_VAE3, + ARM64_TLBI_ASIDE1, + ARM64_TLBI_VAAE1, + ARM64_TLBI_ALLE1, + ARM64_TLBI_VALE1, + ARM64_TLBI_VALE2, + ARM64_TLBI_VALE3, + ARM64_TLBI_VMALLS12E1, + ARM64_TLBI_VAALE1, + ARM64_TLBI_VMALLE1OS, + ARM64_TLBI_VAE1OS, + ARM64_TLBI_ASIDE1OS, + ARM64_TLBI_VAAE1OS, + ARM64_TLBI_VALE1OS, + ARM64_TLBI_VAALE1OS, + ARM64_TLBI_IPAS2E1OS, + ARM64_TLBI_IPAS2LE1OS, + ARM64_TLBI_VAE2OS, + ARM64_TLBI_VALE2OS, + ARM64_TLBI_VMALLS12E1OS, + ARM64_TLBI_VAE3OS, + ARM64_TLBI_VALE3OS, + ARM64_TLBI_ALLE2OS, + ARM64_TLBI_ALLE1OS, + ARM64_TLBI_ALLE3OS, + ARM64_TLBI_RVAE1, + ARM64_TLBI_RVAAE1, + ARM64_TLBI_RVALE1, + ARM64_TLBI_RVAALE1, + ARM64_TLBI_RVAE1IS, + ARM64_TLBI_RVAAE1IS, + ARM64_TLBI_RVALE1IS, + ARM64_TLBI_RVAALE1IS, + ARM64_TLBI_RVAE1OS, + ARM64_TLBI_RVAAE1OS, + ARM64_TLBI_RVALE1OS, + ARM64_TLBI_RVAALE1OS, + ARM64_TLBI_RIPAS2E1IS, + ARM64_TLBI_RIPAS2LE1IS, + ARM64_TLBI_RIPAS2E1, + ARM64_TLBI_RIPAS2LE1, + ARM64_TLBI_RIPAS2E1OS, + ARM64_TLBI_RIPAS2LE1OS, + ARM64_TLBI_RVAE2, + ARM64_TLBI_RVALE2, + ARM64_TLBI_RVAE2IS, + ARM64_TLBI_RVALE2IS, + ARM64_TLBI_RVAE2OS, + ARM64_TLBI_RVALE2OS, + ARM64_TLBI_RVAE3, + ARM64_TLBI_RVALE3, + ARM64_TLBI_RVAE3IS, + ARM64_TLBI_RVALE3IS, + ARM64_TLBI_RVAE3OS, + ARM64_TLBI_RVALE3OS, +} arm64_tlbi_op; + +/// AT operations +typedef enum arm64_at_op { + ARM64_AT_S1E1R, + ARM64_AT_S1E2R, + ARM64_AT_S1E3R, + ARM64_AT_S1E1W, + ARM64_AT_S1E2W, + ARM64_AT_S1E3W, + ARM64_AT_S1E0R, + ARM64_AT_S1E0W, + ARM64_AT_S12E1R, + ARM64_AT_S12E1W, + ARM64_AT_S12E0R, + ARM64_AT_S12E0W, + ARM64_AT_S1E1RP, + ARM64_AT_S1E1WP, +} arm64_at_op; + +/// DC operations +typedef enum arm64_dc_op { + ARM64_DC_INVALID = 0, + ARM64_DC_ZVA, + ARM64_DC_IVAC, + ARM64_DC_ISW, + ARM64_DC_CVAC, + ARM64_DC_CSW, + ARM64_DC_CVAU, + ARM64_DC_CIVAC, + ARM64_DC_CISW, + ARM64_DC_CVAP, +} arm64_dc_op; + +/// IC operations +typedef enum arm64_ic_op { + ARM64_IC_INVALID = 0, + ARM64_IC_IALLUIS, + ARM64_IC_IALLU, + ARM64_IC_IVAU, +} arm64_ic_op; + +/// Prefetch operations (PRFM) +typedef enum arm64_prefetch_op { + ARM64_PRFM_INVALID = 0, + ARM64_PRFM_PLDL1KEEP = 0x00 + 1, + ARM64_PRFM_PLDL1STRM = 0x01 + 1, + ARM64_PRFM_PLDL2KEEP = 0x02 + 1, + ARM64_PRFM_PLDL2STRM = 0x03 + 1, + ARM64_PRFM_PLDL3KEEP = 0x04 + 1, + ARM64_PRFM_PLDL3STRM = 0x05 + 1, + ARM64_PRFM_PLIL1KEEP = 0x08 + 1, + ARM64_PRFM_PLIL1STRM = 0x09 + 1, + ARM64_PRFM_PLIL2KEEP = 0x0a + 1, + ARM64_PRFM_PLIL2STRM = 0x0b + 1, + ARM64_PRFM_PLIL3KEEP = 0x0c + 1, + ARM64_PRFM_PLIL3STRM = 0x0d + 1, + ARM64_PRFM_PSTL1KEEP = 0x10 + 1, + ARM64_PRFM_PSTL1STRM = 0x11 + 1, + ARM64_PRFM_PSTL2KEEP = 0x12 + 1, + ARM64_PRFM_PSTL2STRM = 0x13 + 1, + ARM64_PRFM_PSTL3KEEP = 0x14 + 1, + ARM64_PRFM_PSTL3STRM = 0x15 + 1, +} arm64_prefetch_op; + +/// ARM64 registers +typedef enum arm64_reg { + ARM64_REG_INVALID = 0, + + ARM64_REG_FFR = 1, + ARM64_REG_FP = 2, + ARM64_REG_LR = 3, + ARM64_REG_NZCV = 4, + ARM64_REG_SP = 5, + ARM64_REG_WSP = 6, + ARM64_REG_WZR = 7, + ARM64_REG_XZR = 8, + ARM64_REG_B0 = 9, + ARM64_REG_B1 = 10, + ARM64_REG_B2 = 11, + ARM64_REG_B3 = 12, + ARM64_REG_B4 = 13, + ARM64_REG_B5 = 14, + ARM64_REG_B6 = 15, + ARM64_REG_B7 = 16, + ARM64_REG_B8 = 17, + ARM64_REG_B9 = 18, + ARM64_REG_B10 = 19, + ARM64_REG_B11 = 20, + ARM64_REG_B12 = 21, + ARM64_REG_B13 = 22, + ARM64_REG_B14 = 23, + ARM64_REG_B15 = 24, + ARM64_REG_B16 = 25, + ARM64_REG_B17 = 26, + ARM64_REG_B18 = 27, + ARM64_REG_B19 = 28, + ARM64_REG_B20 = 29, + ARM64_REG_B21 = 30, + ARM64_REG_B22 = 31, + ARM64_REG_B23 = 32, + ARM64_REG_B24 = 33, + ARM64_REG_B25 = 34, + ARM64_REG_B26 = 35, + ARM64_REG_B27 = 36, + ARM64_REG_B28 = 37, + ARM64_REG_B29 = 38, + ARM64_REG_B30 = 39, + ARM64_REG_B31 = 40, + ARM64_REG_D0 = 41, + ARM64_REG_D1 = 42, + ARM64_REG_D2 = 43, + ARM64_REG_D3 = 44, + ARM64_REG_D4 = 45, + ARM64_REG_D5 = 46, + ARM64_REG_D6 = 47, + ARM64_REG_D7 = 48, + ARM64_REG_D8 = 49, + ARM64_REG_D9 = 50, + ARM64_REG_D10 = 51, + ARM64_REG_D11 = 52, + ARM64_REG_D12 = 53, + ARM64_REG_D13 = 54, + ARM64_REG_D14 = 55, + ARM64_REG_D15 = 56, + ARM64_REG_D16 = 57, + ARM64_REG_D17 = 58, + ARM64_REG_D18 = 59, + ARM64_REG_D19 = 60, + ARM64_REG_D20 = 61, + ARM64_REG_D21 = 62, + ARM64_REG_D22 = 63, + ARM64_REG_D23 = 64, + ARM64_REG_D24 = 65, + ARM64_REG_D25 = 66, + ARM64_REG_D26 = 67, + ARM64_REG_D27 = 68, + ARM64_REG_D28 = 69, + ARM64_REG_D29 = 70, + ARM64_REG_D30 = 71, + ARM64_REG_D31 = 72, + ARM64_REG_H0 = 73, + ARM64_REG_H1 = 74, + ARM64_REG_H2 = 75, + ARM64_REG_H3 = 76, + ARM64_REG_H4 = 77, + ARM64_REG_H5 = 78, + ARM64_REG_H6 = 79, + ARM64_REG_H7 = 80, + ARM64_REG_H8 = 81, + ARM64_REG_H9 = 82, + ARM64_REG_H10 = 83, + ARM64_REG_H11 = 84, + ARM64_REG_H12 = 85, + ARM64_REG_H13 = 86, + ARM64_REG_H14 = 87, + ARM64_REG_H15 = 88, + ARM64_REG_H16 = 89, + ARM64_REG_H17 = 90, + ARM64_REG_H18 = 91, + ARM64_REG_H19 = 92, + ARM64_REG_H20 = 93, + ARM64_REG_H21 = 94, + ARM64_REG_H22 = 95, + ARM64_REG_H23 = 96, + ARM64_REG_H24 = 97, + ARM64_REG_H25 = 98, + ARM64_REG_H26 = 99, + ARM64_REG_H27 = 100, + ARM64_REG_H28 = 101, + ARM64_REG_H29 = 102, + ARM64_REG_H30 = 103, + ARM64_REG_H31 = 104, + ARM64_REG_P0 = 105, + ARM64_REG_P1 = 106, + ARM64_REG_P2 = 107, + ARM64_REG_P3 = 108, + ARM64_REG_P4 = 109, + ARM64_REG_P5 = 110, + ARM64_REG_P6 = 111, + ARM64_REG_P7 = 112, + ARM64_REG_P8 = 113, + ARM64_REG_P9 = 114, + ARM64_REG_P10 = 115, + ARM64_REG_P11 = 116, + ARM64_REG_P12 = 117, + ARM64_REG_P13 = 118, + ARM64_REG_P14 = 119, + ARM64_REG_P15 = 120, + ARM64_REG_Q0 = 121, + ARM64_REG_Q1 = 122, + ARM64_REG_Q2 = 123, + ARM64_REG_Q3 = 124, + ARM64_REG_Q4 = 125, + ARM64_REG_Q5 = 126, + ARM64_REG_Q6 = 127, + ARM64_REG_Q7 = 128, + ARM64_REG_Q8 = 129, + ARM64_REG_Q9 = 130, + ARM64_REG_Q10 = 131, + ARM64_REG_Q11 = 132, + ARM64_REG_Q12 = 133, + ARM64_REG_Q13 = 134, + ARM64_REG_Q14 = 135, + ARM64_REG_Q15 = 136, + ARM64_REG_Q16 = 137, + ARM64_REG_Q17 = 138, + ARM64_REG_Q18 = 139, + ARM64_REG_Q19 = 140, + ARM64_REG_Q20 = 141, + ARM64_REG_Q21 = 142, + ARM64_REG_Q22 = 143, + ARM64_REG_Q23 = 144, + ARM64_REG_Q24 = 145, + ARM64_REG_Q25 = 146, + ARM64_REG_Q26 = 147, + ARM64_REG_Q27 = 148, + ARM64_REG_Q28 = 149, + ARM64_REG_Q29 = 150, + ARM64_REG_Q30 = 151, + ARM64_REG_Q31 = 152, + ARM64_REG_S0 = 153, + ARM64_REG_S1 = 154, + ARM64_REG_S2 = 155, + ARM64_REG_S3 = 156, + ARM64_REG_S4 = 157, + ARM64_REG_S5 = 158, + ARM64_REG_S6 = 159, + ARM64_REG_S7 = 160, + ARM64_REG_S8 = 161, + ARM64_REG_S9 = 162, + ARM64_REG_S10 = 163, + ARM64_REG_S11 = 164, + ARM64_REG_S12 = 165, + ARM64_REG_S13 = 166, + ARM64_REG_S14 = 167, + ARM64_REG_S15 = 168, + ARM64_REG_S16 = 169, + ARM64_REG_S17 = 170, + ARM64_REG_S18 = 171, + ARM64_REG_S19 = 172, + ARM64_REG_S20 = 173, + ARM64_REG_S21 = 174, + ARM64_REG_S22 = 175, + ARM64_REG_S23 = 176, + ARM64_REG_S24 = 177, + ARM64_REG_S25 = 178, + ARM64_REG_S26 = 179, + ARM64_REG_S27 = 180, + ARM64_REG_S28 = 181, + ARM64_REG_S29 = 182, + ARM64_REG_S30 = 183, + ARM64_REG_S31 = 184, + ARM64_REG_W0 = 185, + ARM64_REG_W1 = 186, + ARM64_REG_W2 = 187, + ARM64_REG_W3 = 188, + ARM64_REG_W4 = 189, + ARM64_REG_W5 = 190, + ARM64_REG_W6 = 191, + ARM64_REG_W7 = 192, + ARM64_REG_W8 = 193, + ARM64_REG_W9 = 194, + ARM64_REG_W10 = 195, + ARM64_REG_W11 = 196, + ARM64_REG_W12 = 197, + ARM64_REG_W13 = 198, + ARM64_REG_W14 = 199, + ARM64_REG_W15 = 200, + ARM64_REG_W16 = 201, + ARM64_REG_W17 = 202, + ARM64_REG_W18 = 203, + ARM64_REG_W19 = 204, + ARM64_REG_W20 = 205, + ARM64_REG_W21 = 206, + ARM64_REG_W22 = 207, + ARM64_REG_W23 = 208, + ARM64_REG_W24 = 209, + ARM64_REG_W25 = 210, + ARM64_REG_W26 = 211, + ARM64_REG_W27 = 212, + ARM64_REG_W28 = 213, + ARM64_REG_W29 = 214, + ARM64_REG_W30 = 215, + ARM64_REG_X0 = 216, + ARM64_REG_X1 = 217, + ARM64_REG_X2 = 218, + ARM64_REG_X3 = 219, + ARM64_REG_X4 = 220, + ARM64_REG_X5 = 221, + ARM64_REG_X6 = 222, + ARM64_REG_X7 = 223, + ARM64_REG_X8 = 224, + ARM64_REG_X9 = 225, + ARM64_REG_X10 = 226, + ARM64_REG_X11 = 227, + ARM64_REG_X12 = 228, + ARM64_REG_X13 = 229, + ARM64_REG_X14 = 230, + ARM64_REG_X15 = 231, + ARM64_REG_X16 = 232, + ARM64_REG_X17 = 233, + ARM64_REG_X18 = 234, + ARM64_REG_X19 = 235, + ARM64_REG_X20 = 236, + ARM64_REG_X21 = 237, + ARM64_REG_X22 = 238, + ARM64_REG_X23 = 239, + ARM64_REG_X24 = 240, + ARM64_REG_X25 = 241, + ARM64_REG_X26 = 242, + ARM64_REG_X27 = 243, + ARM64_REG_X28 = 244, + ARM64_REG_Z0 = 245, + ARM64_REG_Z1 = 246, + ARM64_REG_Z2 = 247, + ARM64_REG_Z3 = 248, + ARM64_REG_Z4 = 249, + ARM64_REG_Z5 = 250, + ARM64_REG_Z6 = 251, + ARM64_REG_Z7 = 252, + ARM64_REG_Z8 = 253, + ARM64_REG_Z9 = 254, + ARM64_REG_Z10 = 255, + ARM64_REG_Z11 = 256, + ARM64_REG_Z12 = 257, + ARM64_REG_Z13 = 258, + ARM64_REG_Z14 = 259, + ARM64_REG_Z15 = 260, + ARM64_REG_Z16 = 261, + ARM64_REG_Z17 = 262, + ARM64_REG_Z18 = 263, + ARM64_REG_Z19 = 264, + ARM64_REG_Z20 = 265, + ARM64_REG_Z21 = 266, + ARM64_REG_Z22 = 267, + ARM64_REG_Z23 = 268, + ARM64_REG_Z24 = 269, + ARM64_REG_Z25 = 270, + ARM64_REG_Z26 = 271, + ARM64_REG_Z27 = 272, + ARM64_REG_Z28 = 273, + ARM64_REG_Z29 = 274, + ARM64_REG_Z30 = 275, + ARM64_REG_Z31 = 276, + + ARM64_REG_V0, + ARM64_REG_V1, + ARM64_REG_V2, + ARM64_REG_V3, + ARM64_REG_V4, + ARM64_REG_V5, + ARM64_REG_V6, + ARM64_REG_V7, + ARM64_REG_V8, + ARM64_REG_V9, + ARM64_REG_V10, + ARM64_REG_V11, + ARM64_REG_V12, + ARM64_REG_V13, + ARM64_REG_V14, + ARM64_REG_V15, + ARM64_REG_V16, + ARM64_REG_V17, + ARM64_REG_V18, + ARM64_REG_V19, + ARM64_REG_V20, + ARM64_REG_V21, + ARM64_REG_V22, + ARM64_REG_V23, + ARM64_REG_V24, + ARM64_REG_V25, + ARM64_REG_V26, + ARM64_REG_V27, + ARM64_REG_V28, + ARM64_REG_V29, + ARM64_REG_V30, + ARM64_REG_V31, + + ARM64_REG_ENDING, // <-- mark the end of the list of registers + + // alias registers + ARM64_REG_IP0 = ARM64_REG_X16, + ARM64_REG_IP1 = ARM64_REG_X17, + ARM64_REG_X29 = ARM64_REG_FP, + ARM64_REG_X30 = ARM64_REG_LR, +} arm64_reg; + +/// Instruction's operand referring to memory +/// This is associated with ARM64_OP_MEM operand type above +typedef struct arm64_op_mem { + arm64_reg base; ///< base register + arm64_reg index; ///< index register + int32_t disp; ///< displacement/offset value +} arm64_op_mem; + +/// Instruction operand +typedef struct cs_arm64_op { + int vector_index; ///< Vector Index for some vector operands (or -1 if irrelevant) + arm64_vas vas; ///< Vector Arrangement Specifier + struct { + arm64_shifter type; ///< shifter type of this operand + unsigned int value; ///< shifter value of this operand + } shift; + arm64_extender ext; ///< extender type of this operand + arm64_op_type type; ///< operand type + union { + arm64_reg reg; ///< register value for REG operand + int64_t imm; ///< immediate value, or index for C-IMM or IMM operand + double fp; ///< floating point value for FP operand + arm64_op_mem mem; ///< base/index/scale/disp value for MEM operand + arm64_pstate pstate; ///< PState field of MSR instruction. + unsigned int sys; ///< IC/DC/AT/TLBI operation (see arm64_ic_op, arm64_dc_op, arm64_at_op, arm64_tlbi_op) + arm64_prefetch_op prefetch; ///< PRFM operation. + arm64_barrier_op barrier; ///< Memory barrier operation (ISB/DMB/DSB instructions). + }; + + /// How is this operand accessed? (READ, WRITE or READ|WRITE) + /// This field is combined of cs_ac_type. + /// NOTE: this field is irrelevant if engine is compiled in DIET mode. + uint8_t access; +} cs_arm64_op; + +/// Instruction structure +typedef struct cs_arm64 { + arm64_cc cc; ///< conditional code for this insn + bool update_flags; ///< does this insn update flags? + bool writeback; ///< does this insn request writeback? 'True' means 'yes' + + /// Number of operands of this instruction, + /// or 0 when instruction has no operand. + uint8_t op_count; + + cs_arm64_op operands[8]; ///< operands for this instruction. +} cs_arm64; + +/// ARM64 instruction +typedef enum arm64_insn { + ARM64_INS_INVALID = 0, + + ARM64_INS_ABS, + ARM64_INS_ADC, + ARM64_INS_ADCS, + ARM64_INS_ADD, + ARM64_INS_ADDHN, + ARM64_INS_ADDHN2, + ARM64_INS_ADDP, + ARM64_INS_ADDPL, + ARM64_INS_ADDS, + ARM64_INS_ADDV, + ARM64_INS_ADDVL, + ARM64_INS_ADR, + ARM64_INS_ADRP, + ARM64_INS_AESD, + ARM64_INS_AESE, + ARM64_INS_AESIMC, + ARM64_INS_AESMC, + ARM64_INS_AND, + ARM64_INS_ANDS, + ARM64_INS_ANDV, + ARM64_INS_ASR, + ARM64_INS_ASRD, + ARM64_INS_ASRR, + ARM64_INS_ASRV, + ARM64_INS_AUTDA, + ARM64_INS_AUTDB, + ARM64_INS_AUTDZA, + ARM64_INS_AUTDZB, + ARM64_INS_AUTIA, + ARM64_INS_AUTIA1716, + ARM64_INS_AUTIASP, + ARM64_INS_AUTIAZ, + ARM64_INS_AUTIB, + ARM64_INS_AUTIB1716, + ARM64_INS_AUTIBSP, + ARM64_INS_AUTIBZ, + ARM64_INS_AUTIZA, + ARM64_INS_AUTIZB, + ARM64_INS_B, + ARM64_INS_BCAX, + ARM64_INS_BFM, + ARM64_INS_BIC, + ARM64_INS_BICS, + ARM64_INS_BIF, + ARM64_INS_BIT, + ARM64_INS_BL, + ARM64_INS_BLR, + ARM64_INS_BLRAA, + ARM64_INS_BLRAAZ, + ARM64_INS_BLRAB, + ARM64_INS_BLRABZ, + ARM64_INS_BR, + ARM64_INS_BRAA, + ARM64_INS_BRAAZ, + ARM64_INS_BRAB, + ARM64_INS_BRABZ, + ARM64_INS_BRK, + ARM64_INS_BRKA, + ARM64_INS_BRKAS, + ARM64_INS_BRKB, + ARM64_INS_BRKBS, + ARM64_INS_BRKN, + ARM64_INS_BRKNS, + ARM64_INS_BRKPA, + ARM64_INS_BRKPAS, + ARM64_INS_BRKPB, + ARM64_INS_BRKPBS, + ARM64_INS_BSL, + ARM64_INS_CAS, + ARM64_INS_CASA, + ARM64_INS_CASAB, + ARM64_INS_CASAH, + ARM64_INS_CASAL, + ARM64_INS_CASALB, + ARM64_INS_CASALH, + ARM64_INS_CASB, + ARM64_INS_CASH, + ARM64_INS_CASL, + ARM64_INS_CASLB, + ARM64_INS_CASLH, + ARM64_INS_CASP, + ARM64_INS_CASPA, + ARM64_INS_CASPAL, + ARM64_INS_CASPL, + ARM64_INS_CBNZ, + ARM64_INS_CBZ, + ARM64_INS_CCMN, + ARM64_INS_CCMP, + ARM64_INS_CFINV, + ARM64_INS_CINC, + ARM64_INS_CINV, + ARM64_INS_CLASTA, + ARM64_INS_CLASTB, + ARM64_INS_CLREX, + ARM64_INS_CLS, + ARM64_INS_CLZ, + ARM64_INS_CMEQ, + ARM64_INS_CMGE, + ARM64_INS_CMGT, + ARM64_INS_CMHI, + ARM64_INS_CMHS, + ARM64_INS_CMLE, + ARM64_INS_CMLO, + ARM64_INS_CMLS, + ARM64_INS_CMLT, + ARM64_INS_CMN, + ARM64_INS_CMP, + ARM64_INS_CMPEQ, + ARM64_INS_CMPGE, + ARM64_INS_CMPGT, + ARM64_INS_CMPHI, + ARM64_INS_CMPHS, + ARM64_INS_CMPLE, + ARM64_INS_CMPLO, + ARM64_INS_CMPLS, + ARM64_INS_CMPLT, + ARM64_INS_CMPNE, + ARM64_INS_CMTST, + ARM64_INS_CNEG, + ARM64_INS_CNOT, + ARM64_INS_CNT, + ARM64_INS_CNTB, + ARM64_INS_CNTD, + ARM64_INS_CNTH, + ARM64_INS_CNTP, + ARM64_INS_CNTW, + ARM64_INS_COMPACT, + ARM64_INS_CPY, + ARM64_INS_CRC32B, + ARM64_INS_CRC32CB, + ARM64_INS_CRC32CH, + ARM64_INS_CRC32CW, + ARM64_INS_CRC32CX, + ARM64_INS_CRC32H, + ARM64_INS_CRC32W, + ARM64_INS_CRC32X, + ARM64_INS_CSDB, + ARM64_INS_CSEL, + ARM64_INS_CSET, + ARM64_INS_CSETM, + ARM64_INS_CSINC, + ARM64_INS_CSINV, + ARM64_INS_CSNEG, + ARM64_INS_CTERMEQ, + ARM64_INS_CTERMNE, + ARM64_INS_DCPS1, + ARM64_INS_DCPS2, + ARM64_INS_DCPS3, + ARM64_INS_DECB, + ARM64_INS_DECD, + ARM64_INS_DECH, + ARM64_INS_DECP, + ARM64_INS_DECW, + ARM64_INS_DMB, + ARM64_INS_DRPS, + ARM64_INS_DSB, + ARM64_INS_DUP, + ARM64_INS_DUPM, + ARM64_INS_EON, + ARM64_INS_EOR, + ARM64_INS_EOR3, + ARM64_INS_EORS, + ARM64_INS_EORV, + ARM64_INS_ERET, + ARM64_INS_ERETAA, + ARM64_INS_ERETAB, + ARM64_INS_ESB, + ARM64_INS_EXT, + ARM64_INS_EXTR, + ARM64_INS_FABD, + ARM64_INS_FABS, + ARM64_INS_FACGE, + ARM64_INS_FACGT, + ARM64_INS_FACLE, + ARM64_INS_FACLT, + ARM64_INS_FADD, + ARM64_INS_FADDA, + ARM64_INS_FADDP, + ARM64_INS_FADDV, + ARM64_INS_FCADD, + ARM64_INS_FCCMP, + ARM64_INS_FCCMPE, + ARM64_INS_FCMEQ, + ARM64_INS_FCMGE, + ARM64_INS_FCMGT, + ARM64_INS_FCMLA, + ARM64_INS_FCMLE, + ARM64_INS_FCMLT, + ARM64_INS_FCMNE, + ARM64_INS_FCMP, + ARM64_INS_FCMPE, + ARM64_INS_FCMUO, + ARM64_INS_FCPY, + ARM64_INS_FCSEL, + ARM64_INS_FCVT, + ARM64_INS_FCVTAS, + ARM64_INS_FCVTAU, + ARM64_INS_FCVTL, + ARM64_INS_FCVTL2, + ARM64_INS_FCVTMS, + ARM64_INS_FCVTMU, + ARM64_INS_FCVTN, + ARM64_INS_FCVTN2, + ARM64_INS_FCVTNS, + ARM64_INS_FCVTNU, + ARM64_INS_FCVTPS, + ARM64_INS_FCVTPU, + ARM64_INS_FCVTXN, + ARM64_INS_FCVTXN2, + ARM64_INS_FCVTZS, + ARM64_INS_FCVTZU, + ARM64_INS_FDIV, + ARM64_INS_FDIVR, + ARM64_INS_FDUP, + ARM64_INS_FEXPA, + ARM64_INS_FJCVTZS, + ARM64_INS_FMAD, + ARM64_INS_FMADD, + ARM64_INS_FMAX, + ARM64_INS_FMAXNM, + ARM64_INS_FMAXNMP, + ARM64_INS_FMAXNMV, + ARM64_INS_FMAXP, + ARM64_INS_FMAXV, + ARM64_INS_FMIN, + ARM64_INS_FMINNM, + ARM64_INS_FMINNMP, + ARM64_INS_FMINNMV, + ARM64_INS_FMINP, + ARM64_INS_FMINV, + ARM64_INS_FMLA, + ARM64_INS_FMLS, + ARM64_INS_FMOV, + ARM64_INS_FMSB, + ARM64_INS_FMSUB, + ARM64_INS_FMUL, + ARM64_INS_FMULX, + ARM64_INS_FNEG, + ARM64_INS_FNMAD, + ARM64_INS_FNMADD, + ARM64_INS_FNMLA, + ARM64_INS_FNMLS, + ARM64_INS_FNMSB, + ARM64_INS_FNMSUB, + ARM64_INS_FNMUL, + ARM64_INS_FRECPE, + ARM64_INS_FRECPS, + ARM64_INS_FRECPX, + ARM64_INS_FRINTA, + ARM64_INS_FRINTI, + ARM64_INS_FRINTM, + ARM64_INS_FRINTN, + ARM64_INS_FRINTP, + ARM64_INS_FRINTX, + ARM64_INS_FRINTZ, + ARM64_INS_FRSQRTE, + ARM64_INS_FRSQRTS, + ARM64_INS_FSCALE, + ARM64_INS_FSQRT, + ARM64_INS_FSUB, + ARM64_INS_FSUBR, + ARM64_INS_FTMAD, + ARM64_INS_FTSMUL, + ARM64_INS_FTSSEL, + ARM64_INS_HINT, + ARM64_INS_HLT, + ARM64_INS_HVC, + ARM64_INS_INCB, + ARM64_INS_INCD, + ARM64_INS_INCH, + ARM64_INS_INCP, + ARM64_INS_INCW, + ARM64_INS_INDEX, + ARM64_INS_INS, + ARM64_INS_INSR, + ARM64_INS_ISB, + ARM64_INS_LASTA, + ARM64_INS_LASTB, + ARM64_INS_LD1, + ARM64_INS_LD1B, + ARM64_INS_LD1D, + ARM64_INS_LD1H, + ARM64_INS_LD1R, + ARM64_INS_LD1RB, + ARM64_INS_LD1RD, + ARM64_INS_LD1RH, + ARM64_INS_LD1RQB, + ARM64_INS_LD1RQD, + ARM64_INS_LD1RQH, + ARM64_INS_LD1RQW, + ARM64_INS_LD1RSB, + ARM64_INS_LD1RSH, + ARM64_INS_LD1RSW, + ARM64_INS_LD1RW, + ARM64_INS_LD1SB, + ARM64_INS_LD1SH, + ARM64_INS_LD1SW, + ARM64_INS_LD1W, + ARM64_INS_LD2, + ARM64_INS_LD2B, + ARM64_INS_LD2D, + ARM64_INS_LD2H, + ARM64_INS_LD2R, + ARM64_INS_LD2W, + ARM64_INS_LD3, + ARM64_INS_LD3B, + ARM64_INS_LD3D, + ARM64_INS_LD3H, + ARM64_INS_LD3R, + ARM64_INS_LD3W, + ARM64_INS_LD4, + ARM64_INS_LD4B, + ARM64_INS_LD4D, + ARM64_INS_LD4H, + ARM64_INS_LD4R, + ARM64_INS_LD4W, + ARM64_INS_LDADD, + ARM64_INS_LDADDA, + ARM64_INS_LDADDAB, + ARM64_INS_LDADDAH, + ARM64_INS_LDADDAL, + ARM64_INS_LDADDALB, + ARM64_INS_LDADDALH, + ARM64_INS_LDADDB, + ARM64_INS_LDADDH, + ARM64_INS_LDADDL, + ARM64_INS_LDADDLB, + ARM64_INS_LDADDLH, + ARM64_INS_LDAPR, + ARM64_INS_LDAPRB, + ARM64_INS_LDAPRH, + ARM64_INS_LDAPUR, + ARM64_INS_LDAPURB, + ARM64_INS_LDAPURH, + ARM64_INS_LDAPURSB, + ARM64_INS_LDAPURSH, + ARM64_INS_LDAPURSW, + ARM64_INS_LDAR, + ARM64_INS_LDARB, + ARM64_INS_LDARH, + ARM64_INS_LDAXP, + ARM64_INS_LDAXR, + ARM64_INS_LDAXRB, + ARM64_INS_LDAXRH, + ARM64_INS_LDCLR, + ARM64_INS_LDCLRA, + ARM64_INS_LDCLRAB, + ARM64_INS_LDCLRAH, + ARM64_INS_LDCLRAL, + ARM64_INS_LDCLRALB, + ARM64_INS_LDCLRALH, + ARM64_INS_LDCLRB, + ARM64_INS_LDCLRH, + ARM64_INS_LDCLRL, + ARM64_INS_LDCLRLB, + ARM64_INS_LDCLRLH, + ARM64_INS_LDEOR, + ARM64_INS_LDEORA, + ARM64_INS_LDEORAB, + ARM64_INS_LDEORAH, + ARM64_INS_LDEORAL, + ARM64_INS_LDEORALB, + ARM64_INS_LDEORALH, + ARM64_INS_LDEORB, + ARM64_INS_LDEORH, + ARM64_INS_LDEORL, + ARM64_INS_LDEORLB, + ARM64_INS_LDEORLH, + ARM64_INS_LDFF1B, + ARM64_INS_LDFF1D, + ARM64_INS_LDFF1H, + ARM64_INS_LDFF1SB, + ARM64_INS_LDFF1SH, + ARM64_INS_LDFF1SW, + ARM64_INS_LDFF1W, + ARM64_INS_LDLAR, + ARM64_INS_LDLARB, + ARM64_INS_LDLARH, + ARM64_INS_LDNF1B, + ARM64_INS_LDNF1D, + ARM64_INS_LDNF1H, + ARM64_INS_LDNF1SB, + ARM64_INS_LDNF1SH, + ARM64_INS_LDNF1SW, + ARM64_INS_LDNF1W, + ARM64_INS_LDNP, + ARM64_INS_LDNT1B, + ARM64_INS_LDNT1D, + ARM64_INS_LDNT1H, + ARM64_INS_LDNT1W, + ARM64_INS_LDP, + ARM64_INS_LDPSW, + ARM64_INS_LDR, + ARM64_INS_LDRAA, + ARM64_INS_LDRAB, + ARM64_INS_LDRB, + ARM64_INS_LDRH, + ARM64_INS_LDRSB, + ARM64_INS_LDRSH, + ARM64_INS_LDRSW, + ARM64_INS_LDSET, + ARM64_INS_LDSETA, + ARM64_INS_LDSETAB, + ARM64_INS_LDSETAH, + ARM64_INS_LDSETAL, + ARM64_INS_LDSETALB, + ARM64_INS_LDSETALH, + ARM64_INS_LDSETB, + ARM64_INS_LDSETH, + ARM64_INS_LDSETL, + ARM64_INS_LDSETLB, + ARM64_INS_LDSETLH, + ARM64_INS_LDSMAX, + ARM64_INS_LDSMAXA, + ARM64_INS_LDSMAXAB, + ARM64_INS_LDSMAXAH, + ARM64_INS_LDSMAXAL, + ARM64_INS_LDSMAXALB, + ARM64_INS_LDSMAXALH, + ARM64_INS_LDSMAXB, + ARM64_INS_LDSMAXH, + ARM64_INS_LDSMAXL, + ARM64_INS_LDSMAXLB, + ARM64_INS_LDSMAXLH, + ARM64_INS_LDSMIN, + ARM64_INS_LDSMINA, + ARM64_INS_LDSMINAB, + ARM64_INS_LDSMINAH, + ARM64_INS_LDSMINAL, + ARM64_INS_LDSMINALB, + ARM64_INS_LDSMINALH, + ARM64_INS_LDSMINB, + ARM64_INS_LDSMINH, + ARM64_INS_LDSMINL, + ARM64_INS_LDSMINLB, + ARM64_INS_LDSMINLH, + ARM64_INS_LDTR, + ARM64_INS_LDTRB, + ARM64_INS_LDTRH, + ARM64_INS_LDTRSB, + ARM64_INS_LDTRSH, + ARM64_INS_LDTRSW, + ARM64_INS_LDUMAX, + ARM64_INS_LDUMAXA, + ARM64_INS_LDUMAXAB, + ARM64_INS_LDUMAXAH, + ARM64_INS_LDUMAXAL, + ARM64_INS_LDUMAXALB, + ARM64_INS_LDUMAXALH, + ARM64_INS_LDUMAXB, + ARM64_INS_LDUMAXH, + ARM64_INS_LDUMAXL, + ARM64_INS_LDUMAXLB, + ARM64_INS_LDUMAXLH, + ARM64_INS_LDUMIN, + ARM64_INS_LDUMINA, + ARM64_INS_LDUMINAB, + ARM64_INS_LDUMINAH, + ARM64_INS_LDUMINAL, + ARM64_INS_LDUMINALB, + ARM64_INS_LDUMINALH, + ARM64_INS_LDUMINB, + ARM64_INS_LDUMINH, + ARM64_INS_LDUMINL, + ARM64_INS_LDUMINLB, + ARM64_INS_LDUMINLH, + ARM64_INS_LDUR, + ARM64_INS_LDURB, + ARM64_INS_LDURH, + ARM64_INS_LDURSB, + ARM64_INS_LDURSH, + ARM64_INS_LDURSW, + ARM64_INS_LDXP, + ARM64_INS_LDXR, + ARM64_INS_LDXRB, + ARM64_INS_LDXRH, + ARM64_INS_LSL, + ARM64_INS_LSLR, + ARM64_INS_LSLV, + ARM64_INS_LSR, + ARM64_INS_LSRR, + ARM64_INS_LSRV, + ARM64_INS_MAD, + ARM64_INS_MADD, + ARM64_INS_MLA, + ARM64_INS_MLS, + ARM64_INS_MNEG, + ARM64_INS_MOV, + ARM64_INS_MOVI, + ARM64_INS_MOVK, + ARM64_INS_MOVN, + ARM64_INS_MOVPRFX, + ARM64_INS_MOVS, + ARM64_INS_MOVZ, + ARM64_INS_MRS, + ARM64_INS_MSB, + ARM64_INS_MSR, + ARM64_INS_MSUB, + ARM64_INS_MUL, + ARM64_INS_MVN, + ARM64_INS_MVNI, + ARM64_INS_NAND, + ARM64_INS_NANDS, + ARM64_INS_NEG, + ARM64_INS_NEGS, + ARM64_INS_NGC, + ARM64_INS_NGCS, + ARM64_INS_NOP, + ARM64_INS_NOR, + ARM64_INS_NORS, + ARM64_INS_NOT, + ARM64_INS_NOTS, + ARM64_INS_ORN, + ARM64_INS_ORNS, + ARM64_INS_ORR, + ARM64_INS_ORRS, + ARM64_INS_ORV, + ARM64_INS_PACDA, + ARM64_INS_PACDB, + ARM64_INS_PACDZA, + ARM64_INS_PACDZB, + ARM64_INS_PACGA, + ARM64_INS_PACIA, + ARM64_INS_PACIA1716, + ARM64_INS_PACIASP, + ARM64_INS_PACIAZ, + ARM64_INS_PACIB, + ARM64_INS_PACIB1716, + ARM64_INS_PACIBSP, + ARM64_INS_PACIBZ, + ARM64_INS_PACIZA, + ARM64_INS_PACIZB, + ARM64_INS_PFALSE, + ARM64_INS_PFIRST, + ARM64_INS_PMUL, + ARM64_INS_PMULL, + ARM64_INS_PMULL2, + ARM64_INS_PNEXT, + ARM64_INS_PRFB, + ARM64_INS_PRFD, + ARM64_INS_PRFH, + ARM64_INS_PRFM, + ARM64_INS_PRFUM, + ARM64_INS_PRFW, + ARM64_INS_PSB, + ARM64_INS_PTEST, + ARM64_INS_PTRUE, + ARM64_INS_PTRUES, + ARM64_INS_PUNPKHI, + ARM64_INS_PUNPKLO, + ARM64_INS_RADDHN, + ARM64_INS_RADDHN2, + ARM64_INS_RAX1, + ARM64_INS_RBIT, + ARM64_INS_RDFFR, + ARM64_INS_RDFFRS, + ARM64_INS_RDVL, + ARM64_INS_RET, + ARM64_INS_RETAA, + ARM64_INS_RETAB, + ARM64_INS_REV, + ARM64_INS_REV16, + ARM64_INS_REV32, + ARM64_INS_REV64, + ARM64_INS_REVB, + ARM64_INS_REVH, + ARM64_INS_REVW, + ARM64_INS_RMIF, + ARM64_INS_ROR, + ARM64_INS_RORV, + ARM64_INS_RSHRN, + ARM64_INS_RSHRN2, + ARM64_INS_RSUBHN, + ARM64_INS_RSUBHN2, + ARM64_INS_SABA, + ARM64_INS_SABAL, + ARM64_INS_SABAL2, + ARM64_INS_SABD, + ARM64_INS_SABDL, + ARM64_INS_SABDL2, + ARM64_INS_SADALP, + ARM64_INS_SADDL, + ARM64_INS_SADDL2, + ARM64_INS_SADDLP, + ARM64_INS_SADDLV, + ARM64_INS_SADDV, + ARM64_INS_SADDW, + ARM64_INS_SADDW2, + ARM64_INS_SBC, + ARM64_INS_SBCS, + ARM64_INS_SBFM, + ARM64_INS_SCVTF, + ARM64_INS_SDIV, + ARM64_INS_SDIVR, + ARM64_INS_SDOT, + ARM64_INS_SEL, + ARM64_INS_SETF16, + ARM64_INS_SETF8, + ARM64_INS_SETFFR, + ARM64_INS_SEV, + ARM64_INS_SEVL, + ARM64_INS_SHA1C, + ARM64_INS_SHA1H, + ARM64_INS_SHA1M, + ARM64_INS_SHA1P, + ARM64_INS_SHA1SU0, + ARM64_INS_SHA1SU1, + ARM64_INS_SHA256H, + ARM64_INS_SHA256H2, + ARM64_INS_SHA256SU0, + ARM64_INS_SHA256SU1, + ARM64_INS_SHA512H, + ARM64_INS_SHA512H2, + ARM64_INS_SHA512SU0, + ARM64_INS_SHA512SU1, + ARM64_INS_SHADD, + ARM64_INS_SHL, + ARM64_INS_SHLL, + ARM64_INS_SHLL2, + ARM64_INS_SHRN, + ARM64_INS_SHRN2, + ARM64_INS_SHSUB, + ARM64_INS_SLI, + ARM64_INS_SM3PARTW1, + ARM64_INS_SM3PARTW2, + ARM64_INS_SM3SS1, + ARM64_INS_SM3TT1A, + ARM64_INS_SM3TT1B, + ARM64_INS_SM3TT2A, + ARM64_INS_SM3TT2B, + ARM64_INS_SM4E, + ARM64_INS_SM4EKEY, + ARM64_INS_SMADDL, + ARM64_INS_SMAX, + ARM64_INS_SMAXP, + ARM64_INS_SMAXV, + ARM64_INS_SMC, + ARM64_INS_SMIN, + ARM64_INS_SMINP, + ARM64_INS_SMINV, + ARM64_INS_SMLAL, + ARM64_INS_SMLAL2, + ARM64_INS_SMLSL, + ARM64_INS_SMLSL2, + ARM64_INS_SMNEGL, + ARM64_INS_SMOV, + ARM64_INS_SMSUBL, + ARM64_INS_SMULH, + ARM64_INS_SMULL, + ARM64_INS_SMULL2, + ARM64_INS_SPLICE, + ARM64_INS_SQABS, + ARM64_INS_SQADD, + ARM64_INS_SQDECB, + ARM64_INS_SQDECD, + ARM64_INS_SQDECH, + ARM64_INS_SQDECP, + ARM64_INS_SQDECW, + ARM64_INS_SQDMLAL, + ARM64_INS_SQDMLAL2, + ARM64_INS_SQDMLSL, + ARM64_INS_SQDMLSL2, + ARM64_INS_SQDMULH, + ARM64_INS_SQDMULL, + ARM64_INS_SQDMULL2, + ARM64_INS_SQINCB, + ARM64_INS_SQINCD, + ARM64_INS_SQINCH, + ARM64_INS_SQINCP, + ARM64_INS_SQINCW, + ARM64_INS_SQNEG, + ARM64_INS_SQRDMLAH, + ARM64_INS_SQRDMLSH, + ARM64_INS_SQRDMULH, + ARM64_INS_SQRSHL, + ARM64_INS_SQRSHRN, + ARM64_INS_SQRSHRN2, + ARM64_INS_SQRSHRUN, + ARM64_INS_SQRSHRUN2, + ARM64_INS_SQSHL, + ARM64_INS_SQSHLU, + ARM64_INS_SQSHRN, + ARM64_INS_SQSHRN2, + ARM64_INS_SQSHRUN, + ARM64_INS_SQSHRUN2, + ARM64_INS_SQSUB, + ARM64_INS_SQXTN, + ARM64_INS_SQXTN2, + ARM64_INS_SQXTUN, + ARM64_INS_SQXTUN2, + ARM64_INS_SRHADD, + ARM64_INS_SRI, + ARM64_INS_SRSHL, + ARM64_INS_SRSHR, + ARM64_INS_SRSRA, + ARM64_INS_SSHL, + ARM64_INS_SSHLL, + ARM64_INS_SSHLL2, + ARM64_INS_SSHR, + ARM64_INS_SSRA, + ARM64_INS_SSUBL, + ARM64_INS_SSUBL2, + ARM64_INS_SSUBW, + ARM64_INS_SSUBW2, + ARM64_INS_ST1, + ARM64_INS_ST1B, + ARM64_INS_ST1D, + ARM64_INS_ST1H, + ARM64_INS_ST1W, + ARM64_INS_ST2, + ARM64_INS_ST2B, + ARM64_INS_ST2D, + ARM64_INS_ST2H, + ARM64_INS_ST2W, + ARM64_INS_ST3, + ARM64_INS_ST3B, + ARM64_INS_ST3D, + ARM64_INS_ST3H, + ARM64_INS_ST3W, + ARM64_INS_ST4, + ARM64_INS_ST4B, + ARM64_INS_ST4D, + ARM64_INS_ST4H, + ARM64_INS_ST4W, + ARM64_INS_STADD, + ARM64_INS_STADDB, + ARM64_INS_STADDH, + ARM64_INS_STADDL, + ARM64_INS_STADDLB, + ARM64_INS_STADDLH, + ARM64_INS_STCLR, + ARM64_INS_STCLRB, + ARM64_INS_STCLRH, + ARM64_INS_STCLRL, + ARM64_INS_STCLRLB, + ARM64_INS_STCLRLH, + ARM64_INS_STEOR, + ARM64_INS_STEORB, + ARM64_INS_STEORH, + ARM64_INS_STEORL, + ARM64_INS_STEORLB, + ARM64_INS_STEORLH, + ARM64_INS_STLLR, + ARM64_INS_STLLRB, + ARM64_INS_STLLRH, + ARM64_INS_STLR, + ARM64_INS_STLRB, + ARM64_INS_STLRH, + ARM64_INS_STLUR, + ARM64_INS_STLURB, + ARM64_INS_STLURH, + ARM64_INS_STLXP, + ARM64_INS_STLXR, + ARM64_INS_STLXRB, + ARM64_INS_STLXRH, + ARM64_INS_STNP, + ARM64_INS_STNT1B, + ARM64_INS_STNT1D, + ARM64_INS_STNT1H, + ARM64_INS_STNT1W, + ARM64_INS_STP, + ARM64_INS_STR, + ARM64_INS_STRB, + ARM64_INS_STRH, + ARM64_INS_STSET, + ARM64_INS_STSETB, + ARM64_INS_STSETH, + ARM64_INS_STSETL, + ARM64_INS_STSETLB, + ARM64_INS_STSETLH, + ARM64_INS_STSMAX, + ARM64_INS_STSMAXB, + ARM64_INS_STSMAXH, + ARM64_INS_STSMAXL, + ARM64_INS_STSMAXLB, + ARM64_INS_STSMAXLH, + ARM64_INS_STSMIN, + ARM64_INS_STSMINB, + ARM64_INS_STSMINH, + ARM64_INS_STSMINL, + ARM64_INS_STSMINLB, + ARM64_INS_STSMINLH, + ARM64_INS_STTR, + ARM64_INS_STTRB, + ARM64_INS_STTRH, + ARM64_INS_STUMAX, + ARM64_INS_STUMAXB, + ARM64_INS_STUMAXH, + ARM64_INS_STUMAXL, + ARM64_INS_STUMAXLB, + ARM64_INS_STUMAXLH, + ARM64_INS_STUMIN, + ARM64_INS_STUMINB, + ARM64_INS_STUMINH, + ARM64_INS_STUMINL, + ARM64_INS_STUMINLB, + ARM64_INS_STUMINLH, + ARM64_INS_STUR, + ARM64_INS_STURB, + ARM64_INS_STURH, + ARM64_INS_STXP, + ARM64_INS_STXR, + ARM64_INS_STXRB, + ARM64_INS_STXRH, + ARM64_INS_SUB, + ARM64_INS_SUBHN, + ARM64_INS_SUBHN2, + ARM64_INS_SUBR, + ARM64_INS_SUBS, + ARM64_INS_SUNPKHI, + ARM64_INS_SUNPKLO, + ARM64_INS_SUQADD, + ARM64_INS_SVC, + ARM64_INS_SWP, + ARM64_INS_SWPA, + ARM64_INS_SWPAB, + ARM64_INS_SWPAH, + ARM64_INS_SWPAL, + ARM64_INS_SWPALB, + ARM64_INS_SWPALH, + ARM64_INS_SWPB, + ARM64_INS_SWPH, + ARM64_INS_SWPL, + ARM64_INS_SWPLB, + ARM64_INS_SWPLH, + ARM64_INS_SXTB, + ARM64_INS_SXTH, + ARM64_INS_SXTL, + ARM64_INS_SXTL2, + ARM64_INS_SXTW, + ARM64_INS_SYS, + ARM64_INS_SYSL, + ARM64_INS_TBL, + ARM64_INS_TBNZ, + ARM64_INS_TBX, + ARM64_INS_TBZ, + ARM64_INS_TRN1, + ARM64_INS_TRN2, + ARM64_INS_TSB, + ARM64_INS_TST, + ARM64_INS_UABA, + ARM64_INS_UABAL, + ARM64_INS_UABAL2, + ARM64_INS_UABD, + ARM64_INS_UABDL, + ARM64_INS_UABDL2, + ARM64_INS_UADALP, + ARM64_INS_UADDL, + ARM64_INS_UADDL2, + ARM64_INS_UADDLP, + ARM64_INS_UADDLV, + ARM64_INS_UADDV, + ARM64_INS_UADDW, + ARM64_INS_UADDW2, + ARM64_INS_UBFM, + ARM64_INS_UCVTF, + ARM64_INS_UDIV, + ARM64_INS_UDIVR, + ARM64_INS_UDOT, + ARM64_INS_UHADD, + ARM64_INS_UHSUB, + ARM64_INS_UMADDL, + ARM64_INS_UMAX, + ARM64_INS_UMAXP, + ARM64_INS_UMAXV, + ARM64_INS_UMIN, + ARM64_INS_UMINP, + ARM64_INS_UMINV, + ARM64_INS_UMLAL, + ARM64_INS_UMLAL2, + ARM64_INS_UMLSL, + ARM64_INS_UMLSL2, + ARM64_INS_UMNEGL, + ARM64_INS_UMOV, + ARM64_INS_UMSUBL, + ARM64_INS_UMULH, + ARM64_INS_UMULL, + ARM64_INS_UMULL2, + ARM64_INS_UQADD, + ARM64_INS_UQDECB, + ARM64_INS_UQDECD, + ARM64_INS_UQDECH, + ARM64_INS_UQDECP, + ARM64_INS_UQDECW, + ARM64_INS_UQINCB, + ARM64_INS_UQINCD, + ARM64_INS_UQINCH, + ARM64_INS_UQINCP, + ARM64_INS_UQINCW, + ARM64_INS_UQRSHL, + ARM64_INS_UQRSHRN, + ARM64_INS_UQRSHRN2, + ARM64_INS_UQSHL, + ARM64_INS_UQSHRN, + ARM64_INS_UQSHRN2, + ARM64_INS_UQSUB, + ARM64_INS_UQXTN, + ARM64_INS_UQXTN2, + ARM64_INS_URECPE, + ARM64_INS_URHADD, + ARM64_INS_URSHL, + ARM64_INS_URSHR, + ARM64_INS_URSQRTE, + ARM64_INS_URSRA, + ARM64_INS_USHL, + ARM64_INS_USHLL, + ARM64_INS_USHLL2, + ARM64_INS_USHR, + ARM64_INS_USQADD, + ARM64_INS_USRA, + ARM64_INS_USUBL, + ARM64_INS_USUBL2, + ARM64_INS_USUBW, + ARM64_INS_USUBW2, + ARM64_INS_UUNPKHI, + ARM64_INS_UUNPKLO, + ARM64_INS_UXTB, + ARM64_INS_UXTH, + ARM64_INS_UXTL, + ARM64_INS_UXTL2, + ARM64_INS_UXTW, + ARM64_INS_UZP1, + ARM64_INS_UZP2, + ARM64_INS_WFE, + ARM64_INS_WFI, + ARM64_INS_WHILELE, + ARM64_INS_WHILELO, + ARM64_INS_WHILELS, + ARM64_INS_WHILELT, + ARM64_INS_WRFFR, + ARM64_INS_XAR, + ARM64_INS_XPACD, + ARM64_INS_XPACI, + ARM64_INS_XPACLRI, + ARM64_INS_XTN, + ARM64_INS_XTN2, + ARM64_INS_YIELD, + ARM64_INS_ZIP1, + ARM64_INS_ZIP2, + + // alias insn + ARM64_INS_SBFIZ, + ARM64_INS_UBFIZ, + ARM64_INS_SBFX, + ARM64_INS_UBFX, + ARM64_INS_BFI, + ARM64_INS_BFXIL, + ARM64_INS_IC, + ARM64_INS_DC, + ARM64_INS_AT, + ARM64_INS_TLBI, + + ARM64_INS_ENDING, // <-- mark the end of the list of insn +} arm64_insn; + +/// Group of ARM64 instructions +typedef enum arm64_insn_group { + ARM64_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + // Generic groups + // all jump instructions (conditional+direct+indirect jumps) + ARM64_GRP_JUMP, ///< = CS_GRP_JUMP + ARM64_GRP_CALL, + ARM64_GRP_RET, + ARM64_GRP_INT, + ARM64_GRP_PRIVILEGE = 6, ///< = CS_GRP_PRIVILEGE + ARM64_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE + ARM64_GRP_PAC, + + // Architecture-specific groups + ARM64_GRP_CRYPTO = 128, + ARM64_GRP_FPARMV8, + ARM64_GRP_NEON, + ARM64_GRP_CRC, + ARM64_GRP_AES, + ARM64_GRP_DOTPROD, + ARM64_GRP_FULLFP16, + ARM64_GRP_LSE, + ARM64_GRP_RCPC, + ARM64_GRP_RDM, + ARM64_GRP_SHA2, + ARM64_GRP_SHA3, + ARM64_GRP_SM4, + ARM64_GRP_SVE, + ARM64_GRP_V8_1A, + ARM64_GRP_V8_3A, + ARM64_GRP_V8_4A, + + ARM64_GRP_ENDING, // <-- mark the end of the list of groups +} arm64_insn_group; + +#ifdef __cplusplus +} +#endif + +#endif +#ifndef CAPSTONE_M68K_H +#define CAPSTONE_M68K_H + +/* Capstone Disassembly Engine */ +/* By Daniel Collin , 2015-2016 */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +#define M68K_OPERAND_COUNT 4 + +/// M68K registers and special registers +typedef enum m68k_reg { + M68K_REG_INVALID = 0, + + M68K_REG_D0, + M68K_REG_D1, + M68K_REG_D2, + M68K_REG_D3, + M68K_REG_D4, + M68K_REG_D5, + M68K_REG_D6, + M68K_REG_D7, + + M68K_REG_A0, + M68K_REG_A1, + M68K_REG_A2, + M68K_REG_A3, + M68K_REG_A4, + M68K_REG_A5, + M68K_REG_A6, + M68K_REG_A7, + + M68K_REG_FP0, + M68K_REG_FP1, + M68K_REG_FP2, + M68K_REG_FP3, + M68K_REG_FP4, + M68K_REG_FP5, + M68K_REG_FP6, + M68K_REG_FP7, + + M68K_REG_PC, + + M68K_REG_SR, + M68K_REG_CCR, + M68K_REG_SFC, + M68K_REG_DFC, + M68K_REG_USP, + M68K_REG_VBR, + M68K_REG_CACR, + M68K_REG_CAAR, + M68K_REG_MSP, + M68K_REG_ISP, + M68K_REG_TC, + M68K_REG_ITT0, + M68K_REG_ITT1, + M68K_REG_DTT0, + M68K_REG_DTT1, + M68K_REG_MMUSR, + M68K_REG_URP, + M68K_REG_SRP, + + M68K_REG_FPCR, + M68K_REG_FPSR, + M68K_REG_FPIAR, + + M68K_REG_ENDING, // <-- mark the end of the list of registers +} m68k_reg; + +/// M68K Addressing Modes +typedef enum m68k_address_mode { + M68K_AM_NONE = 0, ///< No address mode. + + M68K_AM_REG_DIRECT_DATA, ///< Register Direct - Data + M68K_AM_REG_DIRECT_ADDR, ///< Register Direct - Address + + M68K_AM_REGI_ADDR, ///< Register Indirect - Address + M68K_AM_REGI_ADDR_POST_INC, ///< Register Indirect - Address with Postincrement + M68K_AM_REGI_ADDR_PRE_DEC, ///< Register Indirect - Address with Predecrement + M68K_AM_REGI_ADDR_DISP, ///< Register Indirect - Address with Displacement + + M68K_AM_AREGI_INDEX_8_BIT_DISP, ///< Address Register Indirect With Index- 8-bit displacement + M68K_AM_AREGI_INDEX_BASE_DISP, ///< Address Register Indirect With Index- Base displacement + + M68K_AM_MEMI_POST_INDEX, ///< Memory indirect - Postindex + M68K_AM_MEMI_PRE_INDEX, ///< Memory indirect - Preindex + + M68K_AM_PCI_DISP, ///< Program Counter Indirect - with Displacement + + M68K_AM_PCI_INDEX_8_BIT_DISP, ///< Program Counter Indirect with Index - with 8-Bit Displacement + M68K_AM_PCI_INDEX_BASE_DISP, ///< Program Counter Indirect with Index - with Base Displacement + + M68K_AM_PC_MEMI_POST_INDEX, ///< Program Counter Memory Indirect - Postindexed + M68K_AM_PC_MEMI_PRE_INDEX, ///< Program Counter Memory Indirect - Preindexed + + M68K_AM_ABSOLUTE_DATA_SHORT, ///< Absolute Data Addressing - Short + M68K_AM_ABSOLUTE_DATA_LONG, ///< Absolute Data Addressing - Long + M68K_AM_IMMEDIATE, ///< Immediate value + + M68K_AM_BRANCH_DISPLACEMENT, ///< Address as displacement from (PC+2) used by branches +} m68k_address_mode; + +/// Operand type for instruction's operands +typedef enum m68k_op_type { + M68K_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + M68K_OP_REG, ///< = CS_OP_REG (Register operand). + M68K_OP_IMM, ///< = CS_OP_IMM (Immediate operand). + M68K_OP_MEM, ///< = CS_OP_MEM (Memory operand). + M68K_OP_FP_SINGLE, ///< single precision Floating-Point operand + M68K_OP_FP_DOUBLE, ///< double precision Floating-Point operand + M68K_OP_REG_BITS, ///< Register bits move + M68K_OP_REG_PAIR, ///< Register pair in the same op (upper 4 bits for first reg, lower for second) + M68K_OP_BR_DISP, ///< Branch displacement +} m68k_op_type; + +/// Instruction's operand referring to memory +/// This is associated with M68K_OP_MEM operand type above +typedef struct m68k_op_mem { + m68k_reg base_reg; ///< base register (or M68K_REG_INVALID if irrelevant) + m68k_reg index_reg; ///< index register (or M68K_REG_INVALID if irrelevant) + m68k_reg in_base_reg; ///< indirect base register (or M68K_REG_INVALID if irrelevant) + uint32_t in_disp; ///< indirect displacement + uint32_t out_disp; ///< other displacement + int16_t disp; ///< displacement value + uint8_t scale; ///< scale for index register + uint8_t bitfield; ///< set to true if the two values below should be used + uint8_t width; ///< used for bf* instructions + uint8_t offset; ///< used for bf* instructions + uint8_t index_size; ///< 0 = w, 1 = l +} m68k_op_mem; + +/// Operand type for instruction's operands +typedef enum m68k_op_br_disp_size { + M68K_OP_BR_DISP_SIZE_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + M68K_OP_BR_DISP_SIZE_BYTE = 1, ///< signed 8-bit displacement + M68K_OP_BR_DISP_SIZE_WORD = 2, ///< signed 16-bit displacement + M68K_OP_BR_DISP_SIZE_LONG = 4, ///< signed 32-bit displacement +} m68k_op_br_disp_size; + +typedef struct m68k_op_br_disp { + int32_t disp; ///< displacement value + uint8_t disp_size; ///< Size from m68k_op_br_disp_size type above +} m68k_op_br_disp; + +/// Register pair in one operand. +typedef struct cs_m68k_op_reg_pair { + m68k_reg reg_0; + m68k_reg reg_1; +} cs_m68k_op_reg_pair; + +/// Instruction operand +typedef struct cs_m68k_op { + union { + uint64_t imm; ///< immediate value for IMM operand + double dimm; ///< double imm + float simm; ///< float imm + m68k_reg reg; ///< register value for REG operand + cs_m68k_op_reg_pair reg_pair; ///< register pair in one operand + }; + + m68k_op_mem mem; ///< data when operand is targeting memory + m68k_op_br_disp br_disp; ///< data when operand is a branch displacement + uint32_t register_bits; ///< register bits for movem etc. (always in d0-d7, a0-a7, fp0 - fp7 order) + m68k_op_type type; + m68k_address_mode address_mode; ///< M68K addressing mode for this op +} cs_m68k_op; + +/// Operation size of the CPU instructions +typedef enum m68k_cpu_size { + M68K_CPU_SIZE_NONE = 0, ///< unsized or unspecified + M68K_CPU_SIZE_BYTE = 1, ///< 1 byte in size + M68K_CPU_SIZE_WORD = 2, ///< 2 bytes in size + M68K_CPU_SIZE_LONG = 4, ///< 4 bytes in size +} m68k_cpu_size; + +/// Operation size of the FPU instructions (Notice that FPU instruction can also use CPU sizes if needed) +typedef enum m68k_fpu_size { + M68K_FPU_SIZE_NONE = 0, ///< unsized like fsave/frestore + M68K_FPU_SIZE_SINGLE = 4, ///< 4 byte in size (single float) + M68K_FPU_SIZE_DOUBLE = 8, ///< 8 byte in size (double) + M68K_FPU_SIZE_EXTENDED = 12, ///< 12 byte in size (extended real format) +} m68k_fpu_size; + +/// Type of size that is being used for the current instruction +typedef enum m68k_size_type { + M68K_SIZE_TYPE_INVALID = 0, + + M68K_SIZE_TYPE_CPU, + M68K_SIZE_TYPE_FPU, +} m68k_size_type; + +/// Operation size of the current instruction (NOT the actually size of instruction) +typedef struct m68k_op_size { + m68k_size_type type; + union { + m68k_cpu_size cpu_size; + m68k_fpu_size fpu_size; + }; +} m68k_op_size; + +/// The M68K instruction and it's operands +typedef struct cs_m68k { + // Number of operands of this instruction or 0 when instruction has no operand. + cs_m68k_op operands[M68K_OPERAND_COUNT]; ///< operands for this instruction. + m68k_op_size op_size; ///< size of data operand works on in bytes (.b, .w, .l, etc) + uint8_t op_count; ///< number of operands for the instruction +} cs_m68k; + +/// M68K instruction +typedef enum m68k_insn { + M68K_INS_INVALID = 0, + + M68K_INS_ABCD, + M68K_INS_ADD, + M68K_INS_ADDA, + M68K_INS_ADDI, + M68K_INS_ADDQ, + M68K_INS_ADDX, + M68K_INS_AND, + M68K_INS_ANDI, + M68K_INS_ASL, + M68K_INS_ASR, + M68K_INS_BHS, + M68K_INS_BLO, + M68K_INS_BHI, + M68K_INS_BLS, + M68K_INS_BCC, + M68K_INS_BCS, + M68K_INS_BNE, + M68K_INS_BEQ, + M68K_INS_BVC, + M68K_INS_BVS, + M68K_INS_BPL, + M68K_INS_BMI, + M68K_INS_BGE, + M68K_INS_BLT, + M68K_INS_BGT, + M68K_INS_BLE, + M68K_INS_BRA, + M68K_INS_BSR, + M68K_INS_BCHG, + M68K_INS_BCLR, + M68K_INS_BSET, + M68K_INS_BTST, + M68K_INS_BFCHG, + M68K_INS_BFCLR, + M68K_INS_BFEXTS, + M68K_INS_BFEXTU, + M68K_INS_BFFFO, + M68K_INS_BFINS, + M68K_INS_BFSET, + M68K_INS_BFTST, + M68K_INS_BKPT, + M68K_INS_CALLM, + M68K_INS_CAS, + M68K_INS_CAS2, + M68K_INS_CHK, + M68K_INS_CHK2, + M68K_INS_CLR, + M68K_INS_CMP, + M68K_INS_CMPA, + M68K_INS_CMPI, + M68K_INS_CMPM, + M68K_INS_CMP2, + M68K_INS_CINVL, + M68K_INS_CINVP, + M68K_INS_CINVA, + M68K_INS_CPUSHL, + M68K_INS_CPUSHP, + M68K_INS_CPUSHA, + M68K_INS_DBT, + M68K_INS_DBF, + M68K_INS_DBHI, + M68K_INS_DBLS, + M68K_INS_DBCC, + M68K_INS_DBCS, + M68K_INS_DBNE, + M68K_INS_DBEQ, + M68K_INS_DBVC, + M68K_INS_DBVS, + M68K_INS_DBPL, + M68K_INS_DBMI, + M68K_INS_DBGE, + M68K_INS_DBLT, + M68K_INS_DBGT, + M68K_INS_DBLE, + M68K_INS_DBRA, + M68K_INS_DIVS, + M68K_INS_DIVSL, + M68K_INS_DIVU, + M68K_INS_DIVUL, + M68K_INS_EOR, + M68K_INS_EORI, + M68K_INS_EXG, + M68K_INS_EXT, + M68K_INS_EXTB, + M68K_INS_FABS, + M68K_INS_FSABS, + M68K_INS_FDABS, + M68K_INS_FACOS, + M68K_INS_FADD, + M68K_INS_FSADD, + M68K_INS_FDADD, + M68K_INS_FASIN, + M68K_INS_FATAN, + M68K_INS_FATANH, + M68K_INS_FBF, + M68K_INS_FBEQ, + M68K_INS_FBOGT, + M68K_INS_FBOGE, + M68K_INS_FBOLT, + M68K_INS_FBOLE, + M68K_INS_FBOGL, + M68K_INS_FBOR, + M68K_INS_FBUN, + M68K_INS_FBUEQ, + M68K_INS_FBUGT, + M68K_INS_FBUGE, + M68K_INS_FBULT, + M68K_INS_FBULE, + M68K_INS_FBNE, + M68K_INS_FBT, + M68K_INS_FBSF, + M68K_INS_FBSEQ, + M68K_INS_FBGT, + M68K_INS_FBGE, + M68K_INS_FBLT, + M68K_INS_FBLE, + M68K_INS_FBGL, + M68K_INS_FBGLE, + M68K_INS_FBNGLE, + M68K_INS_FBNGL, + M68K_INS_FBNLE, + M68K_INS_FBNLT, + M68K_INS_FBNGE, + M68K_INS_FBNGT, + M68K_INS_FBSNE, + M68K_INS_FBST, + M68K_INS_FCMP, + M68K_INS_FCOS, + M68K_INS_FCOSH, + M68K_INS_FDBF, + M68K_INS_FDBEQ, + M68K_INS_FDBOGT, + M68K_INS_FDBOGE, + M68K_INS_FDBOLT, + M68K_INS_FDBOLE, + M68K_INS_FDBOGL, + M68K_INS_FDBOR, + M68K_INS_FDBUN, + M68K_INS_FDBUEQ, + M68K_INS_FDBUGT, + M68K_INS_FDBUGE, + M68K_INS_FDBULT, + M68K_INS_FDBULE, + M68K_INS_FDBNE, + M68K_INS_FDBT, + M68K_INS_FDBSF, + M68K_INS_FDBSEQ, + M68K_INS_FDBGT, + M68K_INS_FDBGE, + M68K_INS_FDBLT, + M68K_INS_FDBLE, + M68K_INS_FDBGL, + M68K_INS_FDBGLE, + M68K_INS_FDBNGLE, + M68K_INS_FDBNGL, + M68K_INS_FDBNLE, + M68K_INS_FDBNLT, + M68K_INS_FDBNGE, + M68K_INS_FDBNGT, + M68K_INS_FDBSNE, + M68K_INS_FDBST, + M68K_INS_FDIV, + M68K_INS_FSDIV, + M68K_INS_FDDIV, + M68K_INS_FETOX, + M68K_INS_FETOXM1, + M68K_INS_FGETEXP, + M68K_INS_FGETMAN, + M68K_INS_FINT, + M68K_INS_FINTRZ, + M68K_INS_FLOG10, + M68K_INS_FLOG2, + M68K_INS_FLOGN, + M68K_INS_FLOGNP1, + M68K_INS_FMOD, + M68K_INS_FMOVE, + M68K_INS_FSMOVE, + M68K_INS_FDMOVE, + M68K_INS_FMOVECR, + M68K_INS_FMOVEM, + M68K_INS_FMUL, + M68K_INS_FSMUL, + M68K_INS_FDMUL, + M68K_INS_FNEG, + M68K_INS_FSNEG, + M68K_INS_FDNEG, + M68K_INS_FNOP, + M68K_INS_FREM, + M68K_INS_FRESTORE, + M68K_INS_FSAVE, + M68K_INS_FSCALE, + M68K_INS_FSGLDIV, + M68K_INS_FSGLMUL, + M68K_INS_FSIN, + M68K_INS_FSINCOS, + M68K_INS_FSINH, + M68K_INS_FSQRT, + M68K_INS_FSSQRT, + M68K_INS_FDSQRT, + M68K_INS_FSF, + M68K_INS_FSBEQ, + M68K_INS_FSOGT, + M68K_INS_FSOGE, + M68K_INS_FSOLT, + M68K_INS_FSOLE, + M68K_INS_FSOGL, + M68K_INS_FSOR, + M68K_INS_FSUN, + M68K_INS_FSUEQ, + M68K_INS_FSUGT, + M68K_INS_FSUGE, + M68K_INS_FSULT, + M68K_INS_FSULE, + M68K_INS_FSNE, + M68K_INS_FST, + M68K_INS_FSSF, + M68K_INS_FSSEQ, + M68K_INS_FSGT, + M68K_INS_FSGE, + M68K_INS_FSLT, + M68K_INS_FSLE, + M68K_INS_FSGL, + M68K_INS_FSGLE, + M68K_INS_FSNGLE, + M68K_INS_FSNGL, + M68K_INS_FSNLE, + M68K_INS_FSNLT, + M68K_INS_FSNGE, + M68K_INS_FSNGT, + M68K_INS_FSSNE, + M68K_INS_FSST, + M68K_INS_FSUB, + M68K_INS_FSSUB, + M68K_INS_FDSUB, + M68K_INS_FTAN, + M68K_INS_FTANH, + M68K_INS_FTENTOX, + M68K_INS_FTRAPF, + M68K_INS_FTRAPEQ, + M68K_INS_FTRAPOGT, + M68K_INS_FTRAPOGE, + M68K_INS_FTRAPOLT, + M68K_INS_FTRAPOLE, + M68K_INS_FTRAPOGL, + M68K_INS_FTRAPOR, + M68K_INS_FTRAPUN, + M68K_INS_FTRAPUEQ, + M68K_INS_FTRAPUGT, + M68K_INS_FTRAPUGE, + M68K_INS_FTRAPULT, + M68K_INS_FTRAPULE, + M68K_INS_FTRAPNE, + M68K_INS_FTRAPT, + M68K_INS_FTRAPSF, + M68K_INS_FTRAPSEQ, + M68K_INS_FTRAPGT, + M68K_INS_FTRAPGE, + M68K_INS_FTRAPLT, + M68K_INS_FTRAPLE, + M68K_INS_FTRAPGL, + M68K_INS_FTRAPGLE, + M68K_INS_FTRAPNGLE, + M68K_INS_FTRAPNGL, + M68K_INS_FTRAPNLE, + M68K_INS_FTRAPNLT, + M68K_INS_FTRAPNGE, + M68K_INS_FTRAPNGT, + M68K_INS_FTRAPSNE, + M68K_INS_FTRAPST, + M68K_INS_FTST, + M68K_INS_FTWOTOX, + M68K_INS_HALT, + M68K_INS_ILLEGAL, + M68K_INS_JMP, + M68K_INS_JSR, + M68K_INS_LEA, + M68K_INS_LINK, + M68K_INS_LPSTOP, + M68K_INS_LSL, + M68K_INS_LSR, + M68K_INS_MOVE, + M68K_INS_MOVEA, + M68K_INS_MOVEC, + M68K_INS_MOVEM, + M68K_INS_MOVEP, + M68K_INS_MOVEQ, + M68K_INS_MOVES, + M68K_INS_MOVE16, + M68K_INS_MULS, + M68K_INS_MULU, + M68K_INS_NBCD, + M68K_INS_NEG, + M68K_INS_NEGX, + M68K_INS_NOP, + M68K_INS_NOT, + M68K_INS_OR, + M68K_INS_ORI, + M68K_INS_PACK, + M68K_INS_PEA, + M68K_INS_PFLUSH, + M68K_INS_PFLUSHA, + M68K_INS_PFLUSHAN, + M68K_INS_PFLUSHN, + M68K_INS_PLOADR, + M68K_INS_PLOADW, + M68K_INS_PLPAR, + M68K_INS_PLPAW, + M68K_INS_PMOVE, + M68K_INS_PMOVEFD, + M68K_INS_PTESTR, + M68K_INS_PTESTW, + M68K_INS_PULSE, + M68K_INS_REMS, + M68K_INS_REMU, + M68K_INS_RESET, + M68K_INS_ROL, + M68K_INS_ROR, + M68K_INS_ROXL, + M68K_INS_ROXR, + M68K_INS_RTD, + M68K_INS_RTE, + M68K_INS_RTM, + M68K_INS_RTR, + M68K_INS_RTS, + M68K_INS_SBCD, + M68K_INS_ST, + M68K_INS_SF, + M68K_INS_SHI, + M68K_INS_SLS, + M68K_INS_SCC, + M68K_INS_SHS, + M68K_INS_SCS, + M68K_INS_SLO, + M68K_INS_SNE, + M68K_INS_SEQ, + M68K_INS_SVC, + M68K_INS_SVS, + M68K_INS_SPL, + M68K_INS_SMI, + M68K_INS_SGE, + M68K_INS_SLT, + M68K_INS_SGT, + M68K_INS_SLE, + M68K_INS_STOP, + M68K_INS_SUB, + M68K_INS_SUBA, + M68K_INS_SUBI, + M68K_INS_SUBQ, + M68K_INS_SUBX, + M68K_INS_SWAP, + M68K_INS_TAS, + M68K_INS_TRAP, + M68K_INS_TRAPV, + M68K_INS_TRAPT, + M68K_INS_TRAPF, + M68K_INS_TRAPHI, + M68K_INS_TRAPLS, + M68K_INS_TRAPCC, + M68K_INS_TRAPHS, + M68K_INS_TRAPCS, + M68K_INS_TRAPLO, + M68K_INS_TRAPNE, + M68K_INS_TRAPEQ, + M68K_INS_TRAPVC, + M68K_INS_TRAPVS, + M68K_INS_TRAPPL, + M68K_INS_TRAPMI, + M68K_INS_TRAPGE, + M68K_INS_TRAPLT, + M68K_INS_TRAPGT, + M68K_INS_TRAPLE, + M68K_INS_TST, + M68K_INS_UNLK, + M68K_INS_UNPK, + M68K_INS_ENDING, // <-- mark the end of the list of instructions +} m68k_insn; + +/// Group of M68K instructions +typedef enum m68k_group_type { + M68K_GRP_INVALID = 0, ///< CS_GRUP_INVALID + M68K_GRP_JUMP, ///< = CS_GRP_JUMP + M68K_GRP_RET = 3, ///< = CS_GRP_RET + M68K_GRP_IRET = 5, ///< = CS_GRP_IRET + M68K_GRP_BRANCH_RELATIVE = 7, ///< = CS_GRP_BRANCH_RELATIVE + + M68K_GRP_ENDING,// <-- mark the end of the list of groups +} m68k_group_type; + +#ifdef __cplusplus +} +#endif + +#endif +#ifndef CAPSTONE_MIPS_H +#define CAPSTONE_MIPS_H + +/* Capstone Disassembly Engine */ +/* By Nguyen Anh Quynh , 2013-2015 */ + +#ifdef __cplusplus +extern "C" { +#endif + + +// GCC MIPS toolchain has a default macro called "mips" which breaks +// compilation +#undef mips + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +/// Operand type for instruction's operands +typedef enum mips_op_type { + MIPS_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + MIPS_OP_REG, ///< = CS_OP_REG (Register operand). + MIPS_OP_IMM, ///< = CS_OP_IMM (Immediate operand). + MIPS_OP_MEM, ///< = CS_OP_MEM (Memory operand). +} mips_op_type; + +/// MIPS registers +typedef enum mips_reg { + MIPS_REG_INVALID = 0, + // General purpose registers + MIPS_REG_PC, + + MIPS_REG_0, + MIPS_REG_1, + MIPS_REG_2, + MIPS_REG_3, + MIPS_REG_4, + MIPS_REG_5, + MIPS_REG_6, + MIPS_REG_7, + MIPS_REG_8, + MIPS_REG_9, + MIPS_REG_10, + MIPS_REG_11, + MIPS_REG_12, + MIPS_REG_13, + MIPS_REG_14, + MIPS_REG_15, + MIPS_REG_16, + MIPS_REG_17, + MIPS_REG_18, + MIPS_REG_19, + MIPS_REG_20, + MIPS_REG_21, + MIPS_REG_22, + MIPS_REG_23, + MIPS_REG_24, + MIPS_REG_25, + MIPS_REG_26, + MIPS_REG_27, + MIPS_REG_28, + MIPS_REG_29, + MIPS_REG_30, + MIPS_REG_31, + + // DSP registers + MIPS_REG_DSPCCOND, + MIPS_REG_DSPCARRY, + MIPS_REG_DSPEFI, + MIPS_REG_DSPOUTFLAG, + MIPS_REG_DSPOUTFLAG16_19, + MIPS_REG_DSPOUTFLAG20, + MIPS_REG_DSPOUTFLAG21, + MIPS_REG_DSPOUTFLAG22, + MIPS_REG_DSPOUTFLAG23, + MIPS_REG_DSPPOS, + MIPS_REG_DSPSCOUNT, + + // ACC registers + MIPS_REG_AC0, + MIPS_REG_AC1, + MIPS_REG_AC2, + MIPS_REG_AC3, + + // COP registers + MIPS_REG_CC0, + MIPS_REG_CC1, + MIPS_REG_CC2, + MIPS_REG_CC3, + MIPS_REG_CC4, + MIPS_REG_CC5, + MIPS_REG_CC6, + MIPS_REG_CC7, + + // FPU registers + MIPS_REG_F0, + MIPS_REG_F1, + MIPS_REG_F2, + MIPS_REG_F3, + MIPS_REG_F4, + MIPS_REG_F5, + MIPS_REG_F6, + MIPS_REG_F7, + MIPS_REG_F8, + MIPS_REG_F9, + MIPS_REG_F10, + MIPS_REG_F11, + MIPS_REG_F12, + MIPS_REG_F13, + MIPS_REG_F14, + MIPS_REG_F15, + MIPS_REG_F16, + MIPS_REG_F17, + MIPS_REG_F18, + MIPS_REG_F19, + MIPS_REG_F20, + MIPS_REG_F21, + MIPS_REG_F22, + MIPS_REG_F23, + MIPS_REG_F24, + MIPS_REG_F25, + MIPS_REG_F26, + MIPS_REG_F27, + MIPS_REG_F28, + MIPS_REG_F29, + MIPS_REG_F30, + MIPS_REG_F31, + + MIPS_REG_FCC0, + MIPS_REG_FCC1, + MIPS_REG_FCC2, + MIPS_REG_FCC3, + MIPS_REG_FCC4, + MIPS_REG_FCC5, + MIPS_REG_FCC6, + MIPS_REG_FCC7, + + // AFPR128 + MIPS_REG_W0, + MIPS_REG_W1, + MIPS_REG_W2, + MIPS_REG_W3, + MIPS_REG_W4, + MIPS_REG_W5, + MIPS_REG_W6, + MIPS_REG_W7, + MIPS_REG_W8, + MIPS_REG_W9, + MIPS_REG_W10, + MIPS_REG_W11, + MIPS_REG_W12, + MIPS_REG_W13, + MIPS_REG_W14, + MIPS_REG_W15, + MIPS_REG_W16, + MIPS_REG_W17, + MIPS_REG_W18, + MIPS_REG_W19, + MIPS_REG_W20, + MIPS_REG_W21, + MIPS_REG_W22, + MIPS_REG_W23, + MIPS_REG_W24, + MIPS_REG_W25, + MIPS_REG_W26, + MIPS_REG_W27, + MIPS_REG_W28, + MIPS_REG_W29, + MIPS_REG_W30, + MIPS_REG_W31, + + MIPS_REG_HI, + MIPS_REG_LO, + + MIPS_REG_P0, + MIPS_REG_P1, + MIPS_REG_P2, + + MIPS_REG_MPL0, + MIPS_REG_MPL1, + MIPS_REG_MPL2, + + MIPS_REG_ENDING, // <-- mark the end of the list or registers + + // alias registers + MIPS_REG_ZERO = MIPS_REG_0, + MIPS_REG_AT = MIPS_REG_1, + MIPS_REG_V0 = MIPS_REG_2, + MIPS_REG_V1 = MIPS_REG_3, + MIPS_REG_A0 = MIPS_REG_4, + MIPS_REG_A1 = MIPS_REG_5, + MIPS_REG_A2 = MIPS_REG_6, + MIPS_REG_A3 = MIPS_REG_7, + MIPS_REG_T0 = MIPS_REG_8, + MIPS_REG_T1 = MIPS_REG_9, + MIPS_REG_T2 = MIPS_REG_10, + MIPS_REG_T3 = MIPS_REG_11, + MIPS_REG_T4 = MIPS_REG_12, + MIPS_REG_T5 = MIPS_REG_13, + MIPS_REG_T6 = MIPS_REG_14, + MIPS_REG_T7 = MIPS_REG_15, + MIPS_REG_S0 = MIPS_REG_16, + MIPS_REG_S1 = MIPS_REG_17, + MIPS_REG_S2 = MIPS_REG_18, + MIPS_REG_S3 = MIPS_REG_19, + MIPS_REG_S4 = MIPS_REG_20, + MIPS_REG_S5 = MIPS_REG_21, + MIPS_REG_S6 = MIPS_REG_22, + MIPS_REG_S7 = MIPS_REG_23, + MIPS_REG_T8 = MIPS_REG_24, + MIPS_REG_T9 = MIPS_REG_25, + MIPS_REG_K0 = MIPS_REG_26, + MIPS_REG_K1 = MIPS_REG_27, + MIPS_REG_GP = MIPS_REG_28, + MIPS_REG_SP = MIPS_REG_29, + MIPS_REG_FP = MIPS_REG_30, MIPS_REG_S8 = MIPS_REG_30, + MIPS_REG_RA = MIPS_REG_31, + + MIPS_REG_HI0 = MIPS_REG_AC0, + MIPS_REG_HI1 = MIPS_REG_AC1, + MIPS_REG_HI2 = MIPS_REG_AC2, + MIPS_REG_HI3 = MIPS_REG_AC3, + + MIPS_REG_LO0 = MIPS_REG_HI0, + MIPS_REG_LO1 = MIPS_REG_HI1, + MIPS_REG_LO2 = MIPS_REG_HI2, + MIPS_REG_LO3 = MIPS_REG_HI3, +} mips_reg; + +/// Instruction's operand referring to memory +/// This is associated with MIPS_OP_MEM operand type above +typedef struct mips_op_mem { + mips_reg base; ///< base register + int64_t disp; ///< displacement/offset value +} mips_op_mem; + +/// Instruction operand +typedef struct cs_mips_op { + mips_op_type type; ///< operand type + union { + mips_reg reg; ///< register id for REG operand + int64_t imm; ///< immediate value for IMM operand + mips_op_mem mem; ///< base/index/scale/disp value for MEM operand + }; +} cs_mips_op; + +/// Instruction structure +typedef struct cs_mips { + /// Number of operands of this instruction, + /// or 0 when instruction has no operand. + uint8_t op_count; + cs_mips_op operands[10]; ///< operands for this instruction. +} cs_mips; + +/// MIPS instruction +typedef enum mips_insn { + MIPS_INS_INVALID = 0, + + MIPS_INS_ABSQ_S, + MIPS_INS_ADD, + MIPS_INS_ADDIUPC, + MIPS_INS_ADDIUR1SP, + MIPS_INS_ADDIUR2, + MIPS_INS_ADDIUS5, + MIPS_INS_ADDIUSP, + MIPS_INS_ADDQH, + MIPS_INS_ADDQH_R, + MIPS_INS_ADDQ, + MIPS_INS_ADDQ_S, + MIPS_INS_ADDSC, + MIPS_INS_ADDS_A, + MIPS_INS_ADDS_S, + MIPS_INS_ADDS_U, + MIPS_INS_ADDU16, + MIPS_INS_ADDUH, + MIPS_INS_ADDUH_R, + MIPS_INS_ADDU, + MIPS_INS_ADDU_S, + MIPS_INS_ADDVI, + MIPS_INS_ADDV, + MIPS_INS_ADDWC, + MIPS_INS_ADD_A, + MIPS_INS_ADDI, + MIPS_INS_ADDIU, + MIPS_INS_ALIGN, + MIPS_INS_ALUIPC, + MIPS_INS_AND, + MIPS_INS_AND16, + MIPS_INS_ANDI16, + MIPS_INS_ANDI, + MIPS_INS_APPEND, + MIPS_INS_ASUB_S, + MIPS_INS_ASUB_U, + MIPS_INS_AUI, + MIPS_INS_AUIPC, + MIPS_INS_AVER_S, + MIPS_INS_AVER_U, + MIPS_INS_AVE_S, + MIPS_INS_AVE_U, + MIPS_INS_B16, + MIPS_INS_BADDU, + MIPS_INS_BAL, + MIPS_INS_BALC, + MIPS_INS_BALIGN, + MIPS_INS_BBIT0, + MIPS_INS_BBIT032, + MIPS_INS_BBIT1, + MIPS_INS_BBIT132, + MIPS_INS_BC, + MIPS_INS_BC0F, + MIPS_INS_BC0FL, + MIPS_INS_BC0T, + MIPS_INS_BC0TL, + MIPS_INS_BC1EQZ, + MIPS_INS_BC1F, + MIPS_INS_BC1FL, + MIPS_INS_BC1NEZ, + MIPS_INS_BC1T, + MIPS_INS_BC1TL, + MIPS_INS_BC2EQZ, + MIPS_INS_BC2F, + MIPS_INS_BC2FL, + MIPS_INS_BC2NEZ, + MIPS_INS_BC2T, + MIPS_INS_BC2TL, + MIPS_INS_BC3F, + MIPS_INS_BC3FL, + MIPS_INS_BC3T, + MIPS_INS_BC3TL, + MIPS_INS_BCLRI, + MIPS_INS_BCLR, + MIPS_INS_BEQ, + MIPS_INS_BEQC, + MIPS_INS_BEQL, + MIPS_INS_BEQZ16, + MIPS_INS_BEQZALC, + MIPS_INS_BEQZC, + MIPS_INS_BGEC, + MIPS_INS_BGEUC, + MIPS_INS_BGEZ, + MIPS_INS_BGEZAL, + MIPS_INS_BGEZALC, + MIPS_INS_BGEZALL, + MIPS_INS_BGEZALS, + MIPS_INS_BGEZC, + MIPS_INS_BGEZL, + MIPS_INS_BGTZ, + MIPS_INS_BGTZALC, + MIPS_INS_BGTZC, + MIPS_INS_BGTZL, + MIPS_INS_BINSLI, + MIPS_INS_BINSL, + MIPS_INS_BINSRI, + MIPS_INS_BINSR, + MIPS_INS_BITREV, + MIPS_INS_BITSWAP, + MIPS_INS_BLEZ, + MIPS_INS_BLEZALC, + MIPS_INS_BLEZC, + MIPS_INS_BLEZL, + MIPS_INS_BLTC, + MIPS_INS_BLTUC, + MIPS_INS_BLTZ, + MIPS_INS_BLTZAL, + MIPS_INS_BLTZALC, + MIPS_INS_BLTZALL, + MIPS_INS_BLTZALS, + MIPS_INS_BLTZC, + MIPS_INS_BLTZL, + MIPS_INS_BMNZI, + MIPS_INS_BMNZ, + MIPS_INS_BMZI, + MIPS_INS_BMZ, + MIPS_INS_BNE, + MIPS_INS_BNEC, + MIPS_INS_BNEGI, + MIPS_INS_BNEG, + MIPS_INS_BNEL, + MIPS_INS_BNEZ16, + MIPS_INS_BNEZALC, + MIPS_INS_BNEZC, + MIPS_INS_BNVC, + MIPS_INS_BNZ, + MIPS_INS_BOVC, + MIPS_INS_BPOSGE32, + MIPS_INS_BREAK, + MIPS_INS_BREAK16, + MIPS_INS_BSELI, + MIPS_INS_BSEL, + MIPS_INS_BSETI, + MIPS_INS_BSET, + MIPS_INS_BZ, + MIPS_INS_BEQZ, + MIPS_INS_B, + MIPS_INS_BNEZ, + MIPS_INS_BTEQZ, + MIPS_INS_BTNEZ, + MIPS_INS_CACHE, + MIPS_INS_CEIL, + MIPS_INS_CEQI, + MIPS_INS_CEQ, + MIPS_INS_CFC1, + MIPS_INS_CFCMSA, + MIPS_INS_CINS, + MIPS_INS_CINS32, + MIPS_INS_CLASS, + MIPS_INS_CLEI_S, + MIPS_INS_CLEI_U, + MIPS_INS_CLE_S, + MIPS_INS_CLE_U, + MIPS_INS_CLO, + MIPS_INS_CLTI_S, + MIPS_INS_CLTI_U, + MIPS_INS_CLT_S, + MIPS_INS_CLT_U, + MIPS_INS_CLZ, + MIPS_INS_CMPGDU, + MIPS_INS_CMPGU, + MIPS_INS_CMPU, + MIPS_INS_CMP, + MIPS_INS_COPY_S, + MIPS_INS_COPY_U, + MIPS_INS_CTC1, + MIPS_INS_CTCMSA, + MIPS_INS_CVT, + MIPS_INS_C, + MIPS_INS_CMPI, + MIPS_INS_DADD, + MIPS_INS_DADDI, + MIPS_INS_DADDIU, + MIPS_INS_DADDU, + MIPS_INS_DAHI, + MIPS_INS_DALIGN, + MIPS_INS_DATI, + MIPS_INS_DAUI, + MIPS_INS_DBITSWAP, + MIPS_INS_DCLO, + MIPS_INS_DCLZ, + MIPS_INS_DDIV, + MIPS_INS_DDIVU, + MIPS_INS_DERET, + MIPS_INS_DEXT, + MIPS_INS_DEXTM, + MIPS_INS_DEXTU, + MIPS_INS_DI, + MIPS_INS_DINS, + MIPS_INS_DINSM, + MIPS_INS_DINSU, + MIPS_INS_DIV, + MIPS_INS_DIVU, + MIPS_INS_DIV_S, + MIPS_INS_DIV_U, + MIPS_INS_DLSA, + MIPS_INS_DMFC0, + MIPS_INS_DMFC1, + MIPS_INS_DMFC2, + MIPS_INS_DMOD, + MIPS_INS_DMODU, + MIPS_INS_DMTC0, + MIPS_INS_DMTC1, + MIPS_INS_DMTC2, + MIPS_INS_DMUH, + MIPS_INS_DMUHU, + MIPS_INS_DMUL, + MIPS_INS_DMULT, + MIPS_INS_DMULTU, + MIPS_INS_DMULU, + MIPS_INS_DOTP_S, + MIPS_INS_DOTP_U, + MIPS_INS_DPADD_S, + MIPS_INS_DPADD_U, + MIPS_INS_DPAQX_SA, + MIPS_INS_DPAQX_S, + MIPS_INS_DPAQ_SA, + MIPS_INS_DPAQ_S, + MIPS_INS_DPAU, + MIPS_INS_DPAX, + MIPS_INS_DPA, + MIPS_INS_DPOP, + MIPS_INS_DPSQX_SA, + MIPS_INS_DPSQX_S, + MIPS_INS_DPSQ_SA, + MIPS_INS_DPSQ_S, + MIPS_INS_DPSUB_S, + MIPS_INS_DPSUB_U, + MIPS_INS_DPSU, + MIPS_INS_DPSX, + MIPS_INS_DPS, + MIPS_INS_DROTR, + MIPS_INS_DROTR32, + MIPS_INS_DROTRV, + MIPS_INS_DSBH, + MIPS_INS_DSHD, + MIPS_INS_DSLL, + MIPS_INS_DSLL32, + MIPS_INS_DSLLV, + MIPS_INS_DSRA, + MIPS_INS_DSRA32, + MIPS_INS_DSRAV, + MIPS_INS_DSRL, + MIPS_INS_DSRL32, + MIPS_INS_DSRLV, + MIPS_INS_DSUB, + MIPS_INS_DSUBU, + MIPS_INS_EHB, + MIPS_INS_EI, + MIPS_INS_ERET, + MIPS_INS_EXT, + MIPS_INS_EXTP, + MIPS_INS_EXTPDP, + MIPS_INS_EXTPDPV, + MIPS_INS_EXTPV, + MIPS_INS_EXTRV_RS, + MIPS_INS_EXTRV_R, + MIPS_INS_EXTRV_S, + MIPS_INS_EXTRV, + MIPS_INS_EXTR_RS, + MIPS_INS_EXTR_R, + MIPS_INS_EXTR_S, + MIPS_INS_EXTR, + MIPS_INS_EXTS, + MIPS_INS_EXTS32, + MIPS_INS_ABS, + MIPS_INS_FADD, + MIPS_INS_FCAF, + MIPS_INS_FCEQ, + MIPS_INS_FCLASS, + MIPS_INS_FCLE, + MIPS_INS_FCLT, + MIPS_INS_FCNE, + MIPS_INS_FCOR, + MIPS_INS_FCUEQ, + MIPS_INS_FCULE, + MIPS_INS_FCULT, + MIPS_INS_FCUNE, + MIPS_INS_FCUN, + MIPS_INS_FDIV, + MIPS_INS_FEXDO, + MIPS_INS_FEXP2, + MIPS_INS_FEXUPL, + MIPS_INS_FEXUPR, + MIPS_INS_FFINT_S, + MIPS_INS_FFINT_U, + MIPS_INS_FFQL, + MIPS_INS_FFQR, + MIPS_INS_FILL, + MIPS_INS_FLOG2, + MIPS_INS_FLOOR, + MIPS_INS_FMADD, + MIPS_INS_FMAX_A, + MIPS_INS_FMAX, + MIPS_INS_FMIN_A, + MIPS_INS_FMIN, + MIPS_INS_MOV, + MIPS_INS_FMSUB, + MIPS_INS_FMUL, + MIPS_INS_MUL, + MIPS_INS_NEG, + MIPS_INS_FRCP, + MIPS_INS_FRINT, + MIPS_INS_FRSQRT, + MIPS_INS_FSAF, + MIPS_INS_FSEQ, + MIPS_INS_FSLE, + MIPS_INS_FSLT, + MIPS_INS_FSNE, + MIPS_INS_FSOR, + MIPS_INS_FSQRT, + MIPS_INS_SQRT, + MIPS_INS_FSUB, + MIPS_INS_SUB, + MIPS_INS_FSUEQ, + MIPS_INS_FSULE, + MIPS_INS_FSULT, + MIPS_INS_FSUNE, + MIPS_INS_FSUN, + MIPS_INS_FTINT_S, + MIPS_INS_FTINT_U, + MIPS_INS_FTQ, + MIPS_INS_FTRUNC_S, + MIPS_INS_FTRUNC_U, + MIPS_INS_HADD_S, + MIPS_INS_HADD_U, + MIPS_INS_HSUB_S, + MIPS_INS_HSUB_U, + MIPS_INS_ILVEV, + MIPS_INS_ILVL, + MIPS_INS_ILVOD, + MIPS_INS_ILVR, + MIPS_INS_INS, + MIPS_INS_INSERT, + MIPS_INS_INSV, + MIPS_INS_INSVE, + MIPS_INS_J, + MIPS_INS_JAL, + MIPS_INS_JALR, + MIPS_INS_JALRS16, + MIPS_INS_JALRS, + MIPS_INS_JALS, + MIPS_INS_JALX, + MIPS_INS_JIALC, + MIPS_INS_JIC, + MIPS_INS_JR, + MIPS_INS_JR16, + MIPS_INS_JRADDIUSP, + MIPS_INS_JRC, + MIPS_INS_JALRC, + MIPS_INS_LB, + MIPS_INS_LBU16, + MIPS_INS_LBUX, + MIPS_INS_LBU, + MIPS_INS_LD, + MIPS_INS_LDC1, + MIPS_INS_LDC2, + MIPS_INS_LDC3, + MIPS_INS_LDI, + MIPS_INS_LDL, + MIPS_INS_LDPC, + MIPS_INS_LDR, + MIPS_INS_LDXC1, + MIPS_INS_LH, + MIPS_INS_LHU16, + MIPS_INS_LHX, + MIPS_INS_LHU, + MIPS_INS_LI16, + MIPS_INS_LL, + MIPS_INS_LLD, + MIPS_INS_LSA, + MIPS_INS_LUXC1, + MIPS_INS_LUI, + MIPS_INS_LW, + MIPS_INS_LW16, + MIPS_INS_LWC1, + MIPS_INS_LWC2, + MIPS_INS_LWC3, + MIPS_INS_LWL, + MIPS_INS_LWM16, + MIPS_INS_LWM32, + MIPS_INS_LWPC, + MIPS_INS_LWP, + MIPS_INS_LWR, + MIPS_INS_LWUPC, + MIPS_INS_LWU, + MIPS_INS_LWX, + MIPS_INS_LWXC1, + MIPS_INS_LWXS, + MIPS_INS_LI, + MIPS_INS_MADD, + MIPS_INS_MADDF, + MIPS_INS_MADDR_Q, + MIPS_INS_MADDU, + MIPS_INS_MADDV, + MIPS_INS_MADD_Q, + MIPS_INS_MAQ_SA, + MIPS_INS_MAQ_S, + MIPS_INS_MAXA, + MIPS_INS_MAXI_S, + MIPS_INS_MAXI_U, + MIPS_INS_MAX_A, + MIPS_INS_MAX, + MIPS_INS_MAX_S, + MIPS_INS_MAX_U, + MIPS_INS_MFC0, + MIPS_INS_MFC1, + MIPS_INS_MFC2, + MIPS_INS_MFHC1, + MIPS_INS_MFHI, + MIPS_INS_MFLO, + MIPS_INS_MINA, + MIPS_INS_MINI_S, + MIPS_INS_MINI_U, + MIPS_INS_MIN_A, + MIPS_INS_MIN, + MIPS_INS_MIN_S, + MIPS_INS_MIN_U, + MIPS_INS_MOD, + MIPS_INS_MODSUB, + MIPS_INS_MODU, + MIPS_INS_MOD_S, + MIPS_INS_MOD_U, + MIPS_INS_MOVE, + MIPS_INS_MOVEP, + MIPS_INS_MOVF, + MIPS_INS_MOVN, + MIPS_INS_MOVT, + MIPS_INS_MOVZ, + MIPS_INS_MSUB, + MIPS_INS_MSUBF, + MIPS_INS_MSUBR_Q, + MIPS_INS_MSUBU, + MIPS_INS_MSUBV, + MIPS_INS_MSUB_Q, + MIPS_INS_MTC0, + MIPS_INS_MTC1, + MIPS_INS_MTC2, + MIPS_INS_MTHC1, + MIPS_INS_MTHI, + MIPS_INS_MTHLIP, + MIPS_INS_MTLO, + MIPS_INS_MTM0, + MIPS_INS_MTM1, + MIPS_INS_MTM2, + MIPS_INS_MTP0, + MIPS_INS_MTP1, + MIPS_INS_MTP2, + MIPS_INS_MUH, + MIPS_INS_MUHU, + MIPS_INS_MULEQ_S, + MIPS_INS_MULEU_S, + MIPS_INS_MULQ_RS, + MIPS_INS_MULQ_S, + MIPS_INS_MULR_Q, + MIPS_INS_MULSAQ_S, + MIPS_INS_MULSA, + MIPS_INS_MULT, + MIPS_INS_MULTU, + MIPS_INS_MULU, + MIPS_INS_MULV, + MIPS_INS_MUL_Q, + MIPS_INS_MUL_S, + MIPS_INS_NLOC, + MIPS_INS_NLZC, + MIPS_INS_NMADD, + MIPS_INS_NMSUB, + MIPS_INS_NOR, + MIPS_INS_NORI, + MIPS_INS_NOT16, + MIPS_INS_NOT, + MIPS_INS_OR, + MIPS_INS_OR16, + MIPS_INS_ORI, + MIPS_INS_PACKRL, + MIPS_INS_PAUSE, + MIPS_INS_PCKEV, + MIPS_INS_PCKOD, + MIPS_INS_PCNT, + MIPS_INS_PICK, + MIPS_INS_POP, + MIPS_INS_PRECEQU, + MIPS_INS_PRECEQ, + MIPS_INS_PRECEU, + MIPS_INS_PRECRQU_S, + MIPS_INS_PRECRQ, + MIPS_INS_PRECRQ_RS, + MIPS_INS_PRECR, + MIPS_INS_PRECR_SRA, + MIPS_INS_PRECR_SRA_R, + MIPS_INS_PREF, + MIPS_INS_PREPEND, + MIPS_INS_RADDU, + MIPS_INS_RDDSP, + MIPS_INS_RDHWR, + MIPS_INS_REPLV, + MIPS_INS_REPL, + MIPS_INS_RINT, + MIPS_INS_ROTR, + MIPS_INS_ROTRV, + MIPS_INS_ROUND, + MIPS_INS_SAT_S, + MIPS_INS_SAT_U, + MIPS_INS_SB, + MIPS_INS_SB16, + MIPS_INS_SC, + MIPS_INS_SCD, + MIPS_INS_SD, + MIPS_INS_SDBBP, + MIPS_INS_SDBBP16, + MIPS_INS_SDC1, + MIPS_INS_SDC2, + MIPS_INS_SDC3, + MIPS_INS_SDL, + MIPS_INS_SDR, + MIPS_INS_SDXC1, + MIPS_INS_SEB, + MIPS_INS_SEH, + MIPS_INS_SELEQZ, + MIPS_INS_SELNEZ, + MIPS_INS_SEL, + MIPS_INS_SEQ, + MIPS_INS_SEQI, + MIPS_INS_SH, + MIPS_INS_SH16, + MIPS_INS_SHF, + MIPS_INS_SHILO, + MIPS_INS_SHILOV, + MIPS_INS_SHLLV, + MIPS_INS_SHLLV_S, + MIPS_INS_SHLL, + MIPS_INS_SHLL_S, + MIPS_INS_SHRAV, + MIPS_INS_SHRAV_R, + MIPS_INS_SHRA, + MIPS_INS_SHRA_R, + MIPS_INS_SHRLV, + MIPS_INS_SHRL, + MIPS_INS_SLDI, + MIPS_INS_SLD, + MIPS_INS_SLL, + MIPS_INS_SLL16, + MIPS_INS_SLLI, + MIPS_INS_SLLV, + MIPS_INS_SLT, + MIPS_INS_SLTI, + MIPS_INS_SLTIU, + MIPS_INS_SLTU, + MIPS_INS_SNE, + MIPS_INS_SNEI, + MIPS_INS_SPLATI, + MIPS_INS_SPLAT, + MIPS_INS_SRA, + MIPS_INS_SRAI, + MIPS_INS_SRARI, + MIPS_INS_SRAR, + MIPS_INS_SRAV, + MIPS_INS_SRL, + MIPS_INS_SRL16, + MIPS_INS_SRLI, + MIPS_INS_SRLRI, + MIPS_INS_SRLR, + MIPS_INS_SRLV, + MIPS_INS_SSNOP, + MIPS_INS_ST, + MIPS_INS_SUBQH, + MIPS_INS_SUBQH_R, + MIPS_INS_SUBQ, + MIPS_INS_SUBQ_S, + MIPS_INS_SUBSUS_U, + MIPS_INS_SUBSUU_S, + MIPS_INS_SUBS_S, + MIPS_INS_SUBS_U, + MIPS_INS_SUBU16, + MIPS_INS_SUBUH, + MIPS_INS_SUBUH_R, + MIPS_INS_SUBU, + MIPS_INS_SUBU_S, + MIPS_INS_SUBVI, + MIPS_INS_SUBV, + MIPS_INS_SUXC1, + MIPS_INS_SW, + MIPS_INS_SW16, + MIPS_INS_SWC1, + MIPS_INS_SWC2, + MIPS_INS_SWC3, + MIPS_INS_SWL, + MIPS_INS_SWM16, + MIPS_INS_SWM32, + MIPS_INS_SWP, + MIPS_INS_SWR, + MIPS_INS_SWXC1, + MIPS_INS_SYNC, + MIPS_INS_SYNCI, + MIPS_INS_SYSCALL, + MIPS_INS_TEQ, + MIPS_INS_TEQI, + MIPS_INS_TGE, + MIPS_INS_TGEI, + MIPS_INS_TGEIU, + MIPS_INS_TGEU, + MIPS_INS_TLBP, + MIPS_INS_TLBR, + MIPS_INS_TLBWI, + MIPS_INS_TLBWR, + MIPS_INS_TLT, + MIPS_INS_TLTI, + MIPS_INS_TLTIU, + MIPS_INS_TLTU, + MIPS_INS_TNE, + MIPS_INS_TNEI, + MIPS_INS_TRUNC, + MIPS_INS_V3MULU, + MIPS_INS_VMM0, + MIPS_INS_VMULU, + MIPS_INS_VSHF, + MIPS_INS_WAIT, + MIPS_INS_WRDSP, + MIPS_INS_WSBH, + MIPS_INS_XOR, + MIPS_INS_XOR16, + MIPS_INS_XORI, + + //> some alias instructions + MIPS_INS_NOP, + MIPS_INS_NEGU, + + //> special instructions + MIPS_INS_JALR_HB, // jump and link with Hazard Barrier + MIPS_INS_JR_HB, // jump register with Hazard Barrier + + MIPS_INS_ENDING, +} mips_insn; + +/// Group of MIPS instructions +typedef enum mips_insn_group { + MIPS_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + // Generic groups + // all jump instructions (conditional+direct+indirect jumps) + MIPS_GRP_JUMP, ///< = CS_GRP_JUMP + // all call instructions + MIPS_GRP_CALL, ///< = CS_GRP_CALL + // all return instructions + MIPS_GRP_RET, ///< = CS_GRP_RET + // all interrupt instructions (int+syscall) + MIPS_GRP_INT, ///< = CS_GRP_INT + // all interrupt return instructions + MIPS_GRP_IRET, ///< = CS_GRP_IRET + // all privileged instructions + MIPS_GRP_PRIVILEGE, ///< = CS_GRP_PRIVILEGE + // all relative branching instructions + MIPS_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE + + // Architecture-specific groups + MIPS_GRP_BITCOUNT = 128, + MIPS_GRP_DSP, + MIPS_GRP_DSPR2, + MIPS_GRP_FPIDX, + MIPS_GRP_MSA, + MIPS_GRP_MIPS32R2, + MIPS_GRP_MIPS64, + MIPS_GRP_MIPS64R2, + MIPS_GRP_SEINREG, + MIPS_GRP_STDENC, + MIPS_GRP_SWAP, + MIPS_GRP_MICROMIPS, + MIPS_GRP_MIPS16MODE, + MIPS_GRP_FP64BIT, + MIPS_GRP_NONANSFPMATH, + MIPS_GRP_NOTFP64BIT, + MIPS_GRP_NOTINMICROMIPS, + MIPS_GRP_NOTNACL, + MIPS_GRP_NOTMIPS32R6, + MIPS_GRP_NOTMIPS64R6, + MIPS_GRP_CNMIPS, + MIPS_GRP_MIPS32, + MIPS_GRP_MIPS32R6, + MIPS_GRP_MIPS64R6, + MIPS_GRP_MIPS2, + MIPS_GRP_MIPS3, + MIPS_GRP_MIPS3_32, + MIPS_GRP_MIPS3_32R2, + MIPS_GRP_MIPS4_32, + MIPS_GRP_MIPS4_32R2, + MIPS_GRP_MIPS5_32R2, + MIPS_GRP_GP32BIT, + MIPS_GRP_GP64BIT, + + MIPS_GRP_ENDING, +} mips_insn_group; + +#ifdef __cplusplus +} +#endif + +#endif +#ifndef CAPSTONE_PPC_H +#define CAPSTONE_PPC_H + +/* Capstone Disassembly Engine */ +/* By Nguyen Anh Quynh , 2013-2015 */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +/// PPC branch codes for some branch instructions +typedef enum ppc_bc { + PPC_BC_INVALID = 0, + PPC_BC_LT = (0 << 5) | 12, + PPC_BC_LE = (1 << 5) | 4, + PPC_BC_EQ = (2 << 5) | 12, + PPC_BC_GE = (0 << 5) | 4, + PPC_BC_GT = (1 << 5) | 12, + PPC_BC_NE = (2 << 5) | 4, + PPC_BC_UN = (3 << 5) | 12, + PPC_BC_NU = (3 << 5) | 4, + + // extra conditions + PPC_BC_SO = (4 << 5) | 12, ///< summary overflow + PPC_BC_NS = (4 << 5) | 4, ///< not summary overflow +} ppc_bc; + +/// PPC branch hint for some branch instructions +typedef enum ppc_bh { + PPC_BH_INVALID = 0, ///< no hint + PPC_BH_PLUS, ///< PLUS hint + PPC_BH_MINUS, ///< MINUS hint +} ppc_bh; + +/// Operand type for instruction's operands +typedef enum ppc_op_type { + PPC_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + PPC_OP_REG, ///< = CS_OP_REG (Register operand). + PPC_OP_IMM, ///< = CS_OP_IMM (Immediate operand). + PPC_OP_MEM, ///< = CS_OP_MEM (Memory operand). + PPC_OP_CRX = 64, ///< Condition Register field +} ppc_op_type; + +/// PPC registers +typedef enum ppc_reg { + PPC_REG_INVALID = 0, + + PPC_REG_CARRY = 2, + PPC_REG_CTR = 3, + PPC_REG_LR = 5, + PPC_REG_RM = 6, + PPC_REG_VRSAVE = 8, + PPC_REG_XER = 9, + PPC_REG_ZERO = 10, + PPC_REG_CR0 = 12, + PPC_REG_CR1 = 13, + PPC_REG_CR2 = 14, + PPC_REG_CR3 = 15, + PPC_REG_CR4 = 16, + PPC_REG_CR5 = 17, + PPC_REG_CR6 = 18, + PPC_REG_CR7 = 19, + PPC_REG_CTR8 = 20, + PPC_REG_F0 = 21, + PPC_REG_F1 = 22, + PPC_REG_F2 = 23, + PPC_REG_F3 = 24, + PPC_REG_F4 = 25, + PPC_REG_F5 = 26, + PPC_REG_F6 = 27, + PPC_REG_F7 = 28, + PPC_REG_F8 = 29, + PPC_REG_F9 = 30, + PPC_REG_F10 = 31, + PPC_REG_F11 = 32, + PPC_REG_F12 = 33, + PPC_REG_F13 = 34, + PPC_REG_F14 = 35, + PPC_REG_F15 = 36, + PPC_REG_F16 = 37, + PPC_REG_F17 = 38, + PPC_REG_F18 = 39, + PPC_REG_F19 = 40, + PPC_REG_F20 = 41, + PPC_REG_F21 = 42, + PPC_REG_F22 = 43, + PPC_REG_F23 = 44, + PPC_REG_F24 = 45, + PPC_REG_F25 = 46, + PPC_REG_F26 = 47, + PPC_REG_F27 = 48, + PPC_REG_F28 = 49, + PPC_REG_F29 = 50, + PPC_REG_F30 = 51, + PPC_REG_F31 = 52, + PPC_REG_LR8 = 54, + PPC_REG_Q0 = 55, + PPC_REG_Q1 = 56, + PPC_REG_Q2 = 57, + PPC_REG_Q3 = 58, + PPC_REG_Q4 = 59, + PPC_REG_Q5 = 60, + PPC_REG_Q6 = 61, + PPC_REG_Q7 = 62, + PPC_REG_Q8 = 63, + PPC_REG_Q9 = 64, + PPC_REG_Q10 = 65, + PPC_REG_Q11 = 66, + PPC_REG_Q12 = 67, + PPC_REG_Q13 = 68, + PPC_REG_Q14 = 69, + PPC_REG_Q15 = 70, + PPC_REG_Q16 = 71, + PPC_REG_Q17 = 72, + PPC_REG_Q18 = 73, + PPC_REG_Q19 = 74, + PPC_REG_Q20 = 75, + PPC_REG_Q21 = 76, + PPC_REG_Q22 = 77, + PPC_REG_Q23 = 78, + PPC_REG_Q24 = 79, + PPC_REG_Q25 = 80, + PPC_REG_Q26 = 81, + PPC_REG_Q27 = 82, + PPC_REG_Q28 = 83, + PPC_REG_Q29 = 84, + PPC_REG_Q30 = 85, + PPC_REG_Q31 = 86, + PPC_REG_R0 = 87, + PPC_REG_R1 = 88, + PPC_REG_R2 = 89, + PPC_REG_R3 = 90, + PPC_REG_R4 = 91, + PPC_REG_R5 = 92, + PPC_REG_R6 = 93, + PPC_REG_R7 = 94, + PPC_REG_R8 = 95, + PPC_REG_R9 = 96, + PPC_REG_R10 = 97, + PPC_REG_R11 = 98, + PPC_REG_R12 = 99, + PPC_REG_R13 = 100, + PPC_REG_R14 = 101, + PPC_REG_R15 = 102, + PPC_REG_R16 = 103, + PPC_REG_R17 = 104, + PPC_REG_R18 = 105, + PPC_REG_R19 = 106, + PPC_REG_R20 = 107, + PPC_REG_R21 = 108, + PPC_REG_R22 = 109, + PPC_REG_R23 = 110, + PPC_REG_R24 = 111, + PPC_REG_R25 = 112, + PPC_REG_R26 = 113, + PPC_REG_R27 = 114, + PPC_REG_R28 = 115, + PPC_REG_R29 = 116, + PPC_REG_R30 = 117, + PPC_REG_R31 = 118, + PPC_REG_V0 = 151, + PPC_REG_V1 = 152, + PPC_REG_V2 = 153, + PPC_REG_V3 = 154, + PPC_REG_V4 = 155, + PPC_REG_V5 = 156, + PPC_REG_V6 = 157, + PPC_REG_V7 = 158, + PPC_REG_V8 = 159, + PPC_REG_V9 = 160, + PPC_REG_V10 = 161, + PPC_REG_V11 = 162, + PPC_REG_V12 = 163, + PPC_REG_V13 = 164, + PPC_REG_V14 = 165, + PPC_REG_V15 = 166, + PPC_REG_V16 = 167, + PPC_REG_V17 = 168, + PPC_REG_V18 = 169, + PPC_REG_V19 = 170, + PPC_REG_V20 = 171, + PPC_REG_V21 = 172, + PPC_REG_V22 = 173, + PPC_REG_V23 = 174, + PPC_REG_V24 = 175, + PPC_REG_V25 = 176, + PPC_REG_V26 = 177, + PPC_REG_V27 = 178, + PPC_REG_V28 = 179, + PPC_REG_V29 = 180, + PPC_REG_V30 = 181, + PPC_REG_V31 = 182, + PPC_REG_VS0 = 215, + PPC_REG_VS1 = 216, + PPC_REG_VS2 = 217, + PPC_REG_VS3 = 218, + PPC_REG_VS4 = 219, + PPC_REG_VS5 = 220, + PPC_REG_VS6 = 221, + PPC_REG_VS7 = 222, + PPC_REG_VS8 = 223, + PPC_REG_VS9 = 224, + PPC_REG_VS10 = 225, + PPC_REG_VS11 = 226, + PPC_REG_VS12 = 227, + PPC_REG_VS13 = 228, + PPC_REG_VS14 = 229, + PPC_REG_VS15 = 230, + PPC_REG_VS16 = 231, + PPC_REG_VS17 = 232, + PPC_REG_VS18 = 233, + PPC_REG_VS19 = 234, + PPC_REG_VS20 = 235, + PPC_REG_VS21 = 236, + PPC_REG_VS22 = 237, + PPC_REG_VS23 = 238, + PPC_REG_VS24 = 239, + PPC_REG_VS25 = 240, + PPC_REG_VS26 = 241, + PPC_REG_VS27 = 242, + PPC_REG_VS28 = 243, + PPC_REG_VS29 = 244, + PPC_REG_VS30 = 245, + PPC_REG_VS31 = 246, + PPC_REG_VS32 = 247, + PPC_REG_VS33 = 248, + PPC_REG_VS34 = 249, + PPC_REG_VS35 = 250, + PPC_REG_VS36 = 251, + PPC_REG_VS37 = 252, + PPC_REG_VS38 = 253, + PPC_REG_VS39 = 254, + PPC_REG_VS40 = 255, + PPC_REG_VS41 = 256, + PPC_REG_VS42 = 257, + PPC_REG_VS43 = 258, + PPC_REG_VS44 = 259, + PPC_REG_VS45 = 260, + PPC_REG_VS46 = 261, + PPC_REG_VS47 = 262, + PPC_REG_VS48 = 263, + PPC_REG_VS49 = 264, + PPC_REG_VS50 = 265, + PPC_REG_VS51 = 266, + PPC_REG_VS52 = 267, + PPC_REG_VS53 = 268, + PPC_REG_VS54 = 269, + PPC_REG_VS55 = 270, + PPC_REG_VS56 = 271, + PPC_REG_VS57 = 272, + PPC_REG_VS58 = 273, + PPC_REG_VS59 = 274, + PPC_REG_VS60 = 275, + PPC_REG_VS61 = 276, + PPC_REG_VS62 = 277, + PPC_REG_VS63 = 278, + + PPC_REG_CR0EQ = 312, + PPC_REG_CR1EQ = 313, + PPC_REG_CR2EQ = 314, + PPC_REG_CR3EQ = 315, + PPC_REG_CR4EQ = 316, + PPC_REG_CR5EQ = 317, + PPC_REG_CR6EQ = 318, + PPC_REG_CR7EQ = 319, + PPC_REG_CR0GT = 320, + PPC_REG_CR1GT = 321, + PPC_REG_CR2GT = 322, + PPC_REG_CR3GT = 323, + PPC_REG_CR4GT = 324, + PPC_REG_CR5GT = 325, + PPC_REG_CR6GT = 326, + PPC_REG_CR7GT = 327, + PPC_REG_CR0LT = 328, + PPC_REG_CR1LT = 329, + PPC_REG_CR2LT = 330, + PPC_REG_CR3LT = 331, + PPC_REG_CR4LT = 332, + PPC_REG_CR5LT = 333, + PPC_REG_CR6LT = 334, + PPC_REG_CR7LT = 335, + PPC_REG_CR0UN = 336, + PPC_REG_CR1UN = 337, + PPC_REG_CR2UN = 338, + PPC_REG_CR3UN = 339, + PPC_REG_CR4UN = 340, + PPC_REG_CR5UN = 341, + PPC_REG_CR6UN = 342, + PPC_REG_CR7UN = 343, + + PPC_REG_ENDING, // <-- mark the end of the list of registers +} ppc_reg; + +/// Instruction's operand referring to memory +/// This is associated with PPC_OP_MEM operand type above +typedef struct ppc_op_mem { + ppc_reg base; ///< base register + int32_t disp; ///< displacement/offset value +} ppc_op_mem; + +typedef struct ppc_op_crx { + unsigned int scale; + ppc_reg reg; + ppc_bc cond; +} ppc_op_crx; + +/// Instruction operand +typedef struct cs_ppc_op { + ppc_op_type type; ///< operand type + union { + ppc_reg reg; ///< register value for REG operand + int64_t imm; ///< immediate value for IMM operand + ppc_op_mem mem; ///< base/disp value for MEM operand + ppc_op_crx crx; ///< operand with condition register + }; +} cs_ppc_op; + +/// Instruction structure +typedef struct cs_ppc { + /// branch code for branch instructions + ppc_bc bc; + + /// branch hint for branch instructions + ppc_bh bh; + + /// if update_cr0 = True, then this 'dot' insn updates CR0 + bool update_cr0; + + /// Number of operands of this instruction, + /// or 0 when instruction has no operand. + uint8_t op_count; + cs_ppc_op operands[8]; ///< operands for this instruction. +} cs_ppc; + +/// PPC instruction +typedef enum ppc_insn { + PPC_INS_INVALID = 0, + + PPC_INS_ADD, + PPC_INS_ADDC, + PPC_INS_ADDE, + PPC_INS_ADDI, + PPC_INS_ADDIC, + PPC_INS_ADDIS, + PPC_INS_ADDME, + PPC_INS_ADDPCIS, + PPC_INS_ADDZE, + PPC_INS_AND, + PPC_INS_ANDC, + PPC_INS_ANDI, + PPC_INS_ANDIS, + PPC_INS_ATTN, + PPC_INS_B, + PPC_INS_BA, + PPC_INS_BC, + PPC_INS_BCA, + PPC_INS_BCCTR, + PPC_INS_BCCTRL, + PPC_INS_BCDCFN, + PPC_INS_BCDCFSQ, + PPC_INS_BCDCFZ, + PPC_INS_BCDCPSGN, + PPC_INS_BCDCTN, + PPC_INS_BCDCTSQ, + PPC_INS_BCDCTZ, + PPC_INS_BCDS, + PPC_INS_BCDSETSGN, + PPC_INS_BCDSR, + PPC_INS_BCDTRUNC, + PPC_INS_BCDUS, + PPC_INS_BCDUTRUNC, + PPC_INS_BCL, + PPC_INS_BCLA, + PPC_INS_BCLR, + PPC_INS_BCLRL, + PPC_INS_BCTR, + PPC_INS_BCTRL, + PPC_INS_BDNZ, + PPC_INS_BDNZA, + PPC_INS_BDNZF, + PPC_INS_BDNZFA, + PPC_INS_BDNZFL, + PPC_INS_BDNZFLA, + PPC_INS_BDNZFLR, + PPC_INS_BDNZFLRL, + PPC_INS_BDNZL, + PPC_INS_BDNZLA, + PPC_INS_BDNZLR, + PPC_INS_BDNZLRL, + PPC_INS_BDNZT, + PPC_INS_BDNZTA, + PPC_INS_BDNZTL, + PPC_INS_BDNZTLA, + PPC_INS_BDNZTLR, + PPC_INS_BDNZTLRL, + PPC_INS_BDZ, + PPC_INS_BDZA, + PPC_INS_BDZF, + PPC_INS_BDZFA, + PPC_INS_BDZFL, + PPC_INS_BDZFLA, + PPC_INS_BDZFLR, + PPC_INS_BDZFLRL, + PPC_INS_BDZL, + PPC_INS_BDZLA, + PPC_INS_BDZLR, + PPC_INS_BDZLRL, + PPC_INS_BDZT, + PPC_INS_BDZTA, + PPC_INS_BDZTL, + PPC_INS_BDZTLA, + PPC_INS_BDZTLR, + PPC_INS_BDZTLRL, + PPC_INS_BEQ, + PPC_INS_BEQA, + PPC_INS_BEQCTR, + PPC_INS_BEQCTRL, + PPC_INS_BEQL, + PPC_INS_BEQLA, + PPC_INS_BEQLR, + PPC_INS_BEQLRL, + PPC_INS_BF, + PPC_INS_BFA, + PPC_INS_BFCTR, + PPC_INS_BFCTRL, + PPC_INS_BFL, + PPC_INS_BFLA, + PPC_INS_BFLR, + PPC_INS_BFLRL, + PPC_INS_BGE, + PPC_INS_BGEA, + PPC_INS_BGECTR, + PPC_INS_BGECTRL, + PPC_INS_BGEL, + PPC_INS_BGELA, + PPC_INS_BGELR, + PPC_INS_BGELRL, + PPC_INS_BGT, + PPC_INS_BGTA, + PPC_INS_BGTCTR, + PPC_INS_BGTCTRL, + PPC_INS_BGTL, + PPC_INS_BGTLA, + PPC_INS_BGTLR, + PPC_INS_BGTLRL, + PPC_INS_BL, + PPC_INS_BLA, + PPC_INS_BLE, + PPC_INS_BLEA, + PPC_INS_BLECTR, + PPC_INS_BLECTRL, + PPC_INS_BLEL, + PPC_INS_BLELA, + PPC_INS_BLELR, + PPC_INS_BLELRL, + PPC_INS_BLR, + PPC_INS_BLRL, + PPC_INS_BLT, + PPC_INS_BLTA, + PPC_INS_BLTCTR, + PPC_INS_BLTCTRL, + PPC_INS_BLTL, + PPC_INS_BLTLA, + PPC_INS_BLTLR, + PPC_INS_BLTLRL, + PPC_INS_BNE, + PPC_INS_BNEA, + PPC_INS_BNECTR, + PPC_INS_BNECTRL, + PPC_INS_BNEL, + PPC_INS_BNELA, + PPC_INS_BNELR, + PPC_INS_BNELRL, + PPC_INS_BNG, + PPC_INS_BNGA, + PPC_INS_BNGCTR, + PPC_INS_BNGCTRL, + PPC_INS_BNGL, + PPC_INS_BNGLA, + PPC_INS_BNGLR, + PPC_INS_BNGLRL, + PPC_INS_BNL, + PPC_INS_BNLA, + PPC_INS_BNLCTR, + PPC_INS_BNLCTRL, + PPC_INS_BNLL, + PPC_INS_BNLLA, + PPC_INS_BNLLR, + PPC_INS_BNLLRL, + PPC_INS_BNS, + PPC_INS_BNSA, + PPC_INS_BNSCTR, + PPC_INS_BNSCTRL, + PPC_INS_BNSL, + PPC_INS_BNSLA, + PPC_INS_BNSLR, + PPC_INS_BNSLRL, + PPC_INS_BNU, + PPC_INS_BNUA, + PPC_INS_BNUCTR, + PPC_INS_BNUCTRL, + PPC_INS_BNUL, + PPC_INS_BNULA, + PPC_INS_BNULR, + PPC_INS_BNULRL, + PPC_INS_BPERMD, + PPC_INS_BRINC, + PPC_INS_BSO, + PPC_INS_BSOA, + PPC_INS_BSOCTR, + PPC_INS_BSOCTRL, + PPC_INS_BSOL, + PPC_INS_BSOLA, + PPC_INS_BSOLR, + PPC_INS_BSOLRL, + PPC_INS_BT, + PPC_INS_BTA, + PPC_INS_BTCTR, + PPC_INS_BTCTRL, + PPC_INS_BTL, + PPC_INS_BTLA, + PPC_INS_BTLR, + PPC_INS_BTLRL, + PPC_INS_BUN, + PPC_INS_BUNA, + PPC_INS_BUNCTR, + PPC_INS_BUNCTRL, + PPC_INS_BUNL, + PPC_INS_BUNLA, + PPC_INS_BUNLR, + PPC_INS_BUNLRL, + PPC_INS_CLRBHRB, + PPC_INS_CLRLDI, + PPC_INS_CLRLSLDI, + PPC_INS_CLRLSLWI, + PPC_INS_CLRLWI, + PPC_INS_CLRRDI, + PPC_INS_CLRRWI, + PPC_INS_CMP, + PPC_INS_CMPB, + PPC_INS_CMPD, + PPC_INS_CMPDI, + PPC_INS_CMPEQB, + PPC_INS_CMPI, + PPC_INS_CMPL, + PPC_INS_CMPLD, + PPC_INS_CMPLDI, + PPC_INS_CMPLI, + PPC_INS_CMPLW, + PPC_INS_CMPLWI, + PPC_INS_CMPRB, + PPC_INS_CMPW, + PPC_INS_CMPWI, + PPC_INS_CNTLZD, + PPC_INS_CNTLZW, + PPC_INS_CNTTZD, + PPC_INS_CNTTZW, + PPC_INS_COPY, + PPC_INS_COPY_FIRST, + PPC_INS_CP_ABORT, + PPC_INS_CRAND, + PPC_INS_CRANDC, + PPC_INS_CRCLR, + PPC_INS_CREQV, + PPC_INS_CRMOVE, + PPC_INS_CRNAND, + PPC_INS_CRNOR, + PPC_INS_CRNOT, + PPC_INS_CROR, + PPC_INS_CRORC, + PPC_INS_CRSET, + PPC_INS_CRXOR, + PPC_INS_DARN, + PPC_INS_DCBA, + PPC_INS_DCBF, + PPC_INS_DCBFEP, + PPC_INS_DCBFL, + PPC_INS_DCBFLP, + PPC_INS_DCBI, + PPC_INS_DCBST, + PPC_INS_DCBSTEP, + PPC_INS_DCBT, + PPC_INS_DCBTCT, + PPC_INS_DCBTDS, + PPC_INS_DCBTEP, + PPC_INS_DCBTST, + PPC_INS_DCBTSTCT, + PPC_INS_DCBTSTDS, + PPC_INS_DCBTSTEP, + PPC_INS_DCBTSTT, + PPC_INS_DCBTT, + PPC_INS_DCBZ, + PPC_INS_DCBZEP, + PPC_INS_DCBZL, + PPC_INS_DCBZLEP, + PPC_INS_DCCCI, + PPC_INS_DCI, + PPC_INS_DIVD, + PPC_INS_DIVDE, + PPC_INS_DIVDEU, + PPC_INS_DIVDU, + PPC_INS_DIVW, + PPC_INS_DIVWE, + PPC_INS_DIVWEU, + PPC_INS_DIVWU, + PPC_INS_DSS, + PPC_INS_DSSALL, + PPC_INS_DST, + PPC_INS_DSTST, + PPC_INS_DSTSTT, + PPC_INS_DSTT, + PPC_INS_EFDABS, + PPC_INS_EFDADD, + PPC_INS_EFDCFS, + PPC_INS_EFDCFSF, + PPC_INS_EFDCFSI, + PPC_INS_EFDCFSID, + PPC_INS_EFDCFUF, + PPC_INS_EFDCFUI, + PPC_INS_EFDCFUID, + PPC_INS_EFDCMPEQ, + PPC_INS_EFDCMPGT, + PPC_INS_EFDCMPLT, + PPC_INS_EFDCTSF, + PPC_INS_EFDCTSI, + PPC_INS_EFDCTSIDZ, + PPC_INS_EFDCTSIZ, + PPC_INS_EFDCTUF, + PPC_INS_EFDCTUI, + PPC_INS_EFDCTUIDZ, + PPC_INS_EFDCTUIZ, + PPC_INS_EFDDIV, + PPC_INS_EFDMUL, + PPC_INS_EFDNABS, + PPC_INS_EFDNEG, + PPC_INS_EFDSUB, + PPC_INS_EFDTSTEQ, + PPC_INS_EFDTSTGT, + PPC_INS_EFDTSTLT, + PPC_INS_EFSABS, + PPC_INS_EFSADD, + PPC_INS_EFSCFD, + PPC_INS_EFSCFSF, + PPC_INS_EFSCFSI, + PPC_INS_EFSCFUF, + PPC_INS_EFSCFUI, + PPC_INS_EFSCMPEQ, + PPC_INS_EFSCMPGT, + PPC_INS_EFSCMPLT, + PPC_INS_EFSCTSF, + PPC_INS_EFSCTSI, + PPC_INS_EFSCTSIZ, + PPC_INS_EFSCTUF, + PPC_INS_EFSCTUI, + PPC_INS_EFSCTUIZ, + PPC_INS_EFSDIV, + PPC_INS_EFSMUL, + PPC_INS_EFSNABS, + PPC_INS_EFSNEG, + PPC_INS_EFSSUB, + PPC_INS_EFSTSTEQ, + PPC_INS_EFSTSTGT, + PPC_INS_EFSTSTLT, + PPC_INS_EIEIO, + PPC_INS_EQV, + PPC_INS_EVABS, + PPC_INS_EVADDIW, + PPC_INS_EVADDSMIAAW, + PPC_INS_EVADDSSIAAW, + PPC_INS_EVADDUMIAAW, + PPC_INS_EVADDUSIAAW, + PPC_INS_EVADDW, + PPC_INS_EVAND, + PPC_INS_EVANDC, + PPC_INS_EVCMPEQ, + PPC_INS_EVCMPGTS, + PPC_INS_EVCMPGTU, + PPC_INS_EVCMPLTS, + PPC_INS_EVCMPLTU, + PPC_INS_EVCNTLSW, + PPC_INS_EVCNTLZW, + PPC_INS_EVDIVWS, + PPC_INS_EVDIVWU, + PPC_INS_EVEQV, + PPC_INS_EVEXTSB, + PPC_INS_EVEXTSH, + PPC_INS_EVFSABS, + PPC_INS_EVFSADD, + PPC_INS_EVFSCFSF, + PPC_INS_EVFSCFSI, + PPC_INS_EVFSCFUF, + PPC_INS_EVFSCFUI, + PPC_INS_EVFSCMPEQ, + PPC_INS_EVFSCMPGT, + PPC_INS_EVFSCMPLT, + PPC_INS_EVFSCTSF, + PPC_INS_EVFSCTSI, + PPC_INS_EVFSCTSIZ, + PPC_INS_EVFSCTUI, + PPC_INS_EVFSDIV, + PPC_INS_EVFSMUL, + PPC_INS_EVFSNABS, + PPC_INS_EVFSNEG, + PPC_INS_EVFSSUB, + PPC_INS_EVFSTSTEQ, + PPC_INS_EVFSTSTGT, + PPC_INS_EVFSTSTLT, + PPC_INS_EVLDD, + PPC_INS_EVLDDX, + PPC_INS_EVLDH, + PPC_INS_EVLDHX, + PPC_INS_EVLDW, + PPC_INS_EVLDWX, + PPC_INS_EVLHHESPLAT, + PPC_INS_EVLHHESPLATX, + PPC_INS_EVLHHOSSPLAT, + PPC_INS_EVLHHOSSPLATX, + PPC_INS_EVLHHOUSPLAT, + PPC_INS_EVLHHOUSPLATX, + PPC_INS_EVLWHE, + PPC_INS_EVLWHEX, + PPC_INS_EVLWHOS, + PPC_INS_EVLWHOSX, + PPC_INS_EVLWHOU, + PPC_INS_EVLWHOUX, + PPC_INS_EVLWHSPLAT, + PPC_INS_EVLWHSPLATX, + PPC_INS_EVLWWSPLAT, + PPC_INS_EVLWWSPLATX, + PPC_INS_EVMERGEHI, + PPC_INS_EVMERGEHILO, + PPC_INS_EVMERGELO, + PPC_INS_EVMERGELOHI, + PPC_INS_EVMHEGSMFAA, + PPC_INS_EVMHEGSMFAN, + PPC_INS_EVMHEGSMIAA, + PPC_INS_EVMHEGSMIAN, + PPC_INS_EVMHEGUMIAA, + PPC_INS_EVMHEGUMIAN, + PPC_INS_EVMHESMF, + PPC_INS_EVMHESMFA, + PPC_INS_EVMHESMFAAW, + PPC_INS_EVMHESMFANW, + PPC_INS_EVMHESMI, + PPC_INS_EVMHESMIA, + PPC_INS_EVMHESMIAAW, + PPC_INS_EVMHESMIANW, + PPC_INS_EVMHESSF, + PPC_INS_EVMHESSFA, + PPC_INS_EVMHESSFAAW, + PPC_INS_EVMHESSFANW, + PPC_INS_EVMHESSIAAW, + PPC_INS_EVMHESSIANW, + PPC_INS_EVMHEUMI, + PPC_INS_EVMHEUMIA, + PPC_INS_EVMHEUMIAAW, + PPC_INS_EVMHEUMIANW, + PPC_INS_EVMHEUSIAAW, + PPC_INS_EVMHEUSIANW, + PPC_INS_EVMHOGSMFAA, + PPC_INS_EVMHOGSMFAN, + PPC_INS_EVMHOGSMIAA, + PPC_INS_EVMHOGSMIAN, + PPC_INS_EVMHOGUMIAA, + PPC_INS_EVMHOGUMIAN, + PPC_INS_EVMHOSMF, + PPC_INS_EVMHOSMFA, + PPC_INS_EVMHOSMFAAW, + PPC_INS_EVMHOSMFANW, + PPC_INS_EVMHOSMI, + PPC_INS_EVMHOSMIA, + PPC_INS_EVMHOSMIAAW, + PPC_INS_EVMHOSMIANW, + PPC_INS_EVMHOSSF, + PPC_INS_EVMHOSSFA, + PPC_INS_EVMHOSSFAAW, + PPC_INS_EVMHOSSFANW, + PPC_INS_EVMHOSSIAAW, + PPC_INS_EVMHOSSIANW, + PPC_INS_EVMHOUMI, + PPC_INS_EVMHOUMIA, + PPC_INS_EVMHOUMIAAW, + PPC_INS_EVMHOUMIANW, + PPC_INS_EVMHOUSIAAW, + PPC_INS_EVMHOUSIANW, + PPC_INS_EVMRA, + PPC_INS_EVMWHSMF, + PPC_INS_EVMWHSMFA, + PPC_INS_EVMWHSMI, + PPC_INS_EVMWHSMIA, + PPC_INS_EVMWHSSF, + PPC_INS_EVMWHSSFA, + PPC_INS_EVMWHUMI, + PPC_INS_EVMWHUMIA, + PPC_INS_EVMWLSMIAAW, + PPC_INS_EVMWLSMIANW, + PPC_INS_EVMWLSSIAAW, + PPC_INS_EVMWLSSIANW, + PPC_INS_EVMWLUMI, + PPC_INS_EVMWLUMIA, + PPC_INS_EVMWLUMIAAW, + PPC_INS_EVMWLUMIANW, + PPC_INS_EVMWLUSIAAW, + PPC_INS_EVMWLUSIANW, + PPC_INS_EVMWSMF, + PPC_INS_EVMWSMFA, + PPC_INS_EVMWSMFAA, + PPC_INS_EVMWSMFAN, + PPC_INS_EVMWSMI, + PPC_INS_EVMWSMIA, + PPC_INS_EVMWSMIAA, + PPC_INS_EVMWSMIAN, + PPC_INS_EVMWSSF, + PPC_INS_EVMWSSFA, + PPC_INS_EVMWSSFAA, + PPC_INS_EVMWSSFAN, + PPC_INS_EVMWUMI, + PPC_INS_EVMWUMIA, + PPC_INS_EVMWUMIAA, + PPC_INS_EVMWUMIAN, + PPC_INS_EVNAND, + PPC_INS_EVNEG, + PPC_INS_EVNOR, + PPC_INS_EVOR, + PPC_INS_EVORC, + PPC_INS_EVRLW, + PPC_INS_EVRLWI, + PPC_INS_EVRNDW, + PPC_INS_EVSEL, + PPC_INS_EVSLW, + PPC_INS_EVSLWI, + PPC_INS_EVSPLATFI, + PPC_INS_EVSPLATI, + PPC_INS_EVSRWIS, + PPC_INS_EVSRWIU, + PPC_INS_EVSRWS, + PPC_INS_EVSRWU, + PPC_INS_EVSTDD, + PPC_INS_EVSTDDX, + PPC_INS_EVSTDH, + PPC_INS_EVSTDHX, + PPC_INS_EVSTDW, + PPC_INS_EVSTDWX, + PPC_INS_EVSTWHE, + PPC_INS_EVSTWHEX, + PPC_INS_EVSTWHO, + PPC_INS_EVSTWHOX, + PPC_INS_EVSTWWE, + PPC_INS_EVSTWWEX, + PPC_INS_EVSTWWO, + PPC_INS_EVSTWWOX, + PPC_INS_EVSUBFSMIAAW, + PPC_INS_EVSUBFSSIAAW, + PPC_INS_EVSUBFUMIAAW, + PPC_INS_EVSUBFUSIAAW, + PPC_INS_EVSUBFW, + PPC_INS_EVSUBIFW, + PPC_INS_EVXOR, + PPC_INS_EXTLDI, + PPC_INS_EXTLWI, + PPC_INS_EXTRDI, + PPC_INS_EXTRWI, + PPC_INS_EXTSB, + PPC_INS_EXTSH, + PPC_INS_EXTSW, + PPC_INS_EXTSWSLI, + PPC_INS_FABS, + PPC_INS_FADD, + PPC_INS_FADDS, + PPC_INS_FCFID, + PPC_INS_FCFIDS, + PPC_INS_FCFIDU, + PPC_INS_FCFIDUS, + PPC_INS_FCMPU, + PPC_INS_FCPSGN, + PPC_INS_FCTID, + PPC_INS_FCTIDU, + PPC_INS_FCTIDUZ, + PPC_INS_FCTIDZ, + PPC_INS_FCTIW, + PPC_INS_FCTIWU, + PPC_INS_FCTIWUZ, + PPC_INS_FCTIWZ, + PPC_INS_FDIV, + PPC_INS_FDIVS, + PPC_INS_FMADD, + PPC_INS_FMADDS, + PPC_INS_FMR, + PPC_INS_FMSUB, + PPC_INS_FMSUBS, + PPC_INS_FMUL, + PPC_INS_FMULS, + PPC_INS_FNABS, + PPC_INS_FNEG, + PPC_INS_FNMADD, + PPC_INS_FNMADDS, + PPC_INS_FNMSUB, + PPC_INS_FNMSUBS, + PPC_INS_FRE, + PPC_INS_FRES, + PPC_INS_FRIM, + PPC_INS_FRIN, + PPC_INS_FRIP, + PPC_INS_FRIZ, + PPC_INS_FRSP, + PPC_INS_FRSQRTE, + PPC_INS_FRSQRTES, + PPC_INS_FSEL, + PPC_INS_FSQRT, + PPC_INS_FSQRTS, + PPC_INS_FSUB, + PPC_INS_FSUBS, + PPC_INS_FTDIV, + PPC_INS_FTSQRT, + PPC_INS_HRFID, + PPC_INS_ICBI, + PPC_INS_ICBIEP, + PPC_INS_ICBLC, + PPC_INS_ICBLQ, + PPC_INS_ICBT, + PPC_INS_ICBTLS, + PPC_INS_ICCCI, + PPC_INS_ICI, + PPC_INS_INSLWI, + PPC_INS_INSRDI, + PPC_INS_INSRWI, + PPC_INS_ISEL, + PPC_INS_ISYNC, + PPC_INS_LA, + PPC_INS_LBARX, + PPC_INS_LBEPX, + PPC_INS_LBZ, + PPC_INS_LBZCIX, + PPC_INS_LBZU, + PPC_INS_LBZUX, + PPC_INS_LBZX, + PPC_INS_LD, + PPC_INS_LDARX, + PPC_INS_LDAT, + PPC_INS_LDBRX, + PPC_INS_LDCIX, + PPC_INS_LDMX, + PPC_INS_LDU, + PPC_INS_LDUX, + PPC_INS_LDX, + PPC_INS_LFD, + PPC_INS_LFDEPX, + PPC_INS_LFDU, + PPC_INS_LFDUX, + PPC_INS_LFDX, + PPC_INS_LFIWAX, + PPC_INS_LFIWZX, + PPC_INS_LFS, + PPC_INS_LFSU, + PPC_INS_LFSUX, + PPC_INS_LFSX, + PPC_INS_LHA, + PPC_INS_LHARX, + PPC_INS_LHAU, + PPC_INS_LHAUX, + PPC_INS_LHAX, + PPC_INS_LHBRX, + PPC_INS_LHEPX, + PPC_INS_LHZ, + PPC_INS_LHZCIX, + PPC_INS_LHZU, + PPC_INS_LHZUX, + PPC_INS_LHZX, + PPC_INS_LI, + PPC_INS_LIS, + PPC_INS_LMW, + PPC_INS_LNIA, + PPC_INS_LSWI, + PPC_INS_LVEBX, + PPC_INS_LVEHX, + PPC_INS_LVEWX, + PPC_INS_LVSL, + PPC_INS_LVSR, + PPC_INS_LVX, + PPC_INS_LVXL, + PPC_INS_LWA, + PPC_INS_LWARX, + PPC_INS_LWAT, + PPC_INS_LWAUX, + PPC_INS_LWAX, + PPC_INS_LWBRX, + PPC_INS_LWEPX, + PPC_INS_LWSYNC, + PPC_INS_LWZ, + PPC_INS_LWZCIX, + PPC_INS_LWZU, + PPC_INS_LWZUX, + PPC_INS_LWZX, + PPC_INS_LXSD, + PPC_INS_LXSDX, + PPC_INS_LXSIBZX, + PPC_INS_LXSIHZX, + PPC_INS_LXSIWAX, + PPC_INS_LXSIWZX, + PPC_INS_LXSSP, + PPC_INS_LXSSPX, + PPC_INS_LXV, + PPC_INS_LXVB16X, + PPC_INS_LXVD2X, + PPC_INS_LXVDSX, + PPC_INS_LXVH8X, + PPC_INS_LXVL, + PPC_INS_LXVLL, + PPC_INS_LXVW4X, + PPC_INS_LXVWSX, + PPC_INS_LXVX, + PPC_INS_MADDHD, + PPC_INS_MADDHDU, + PPC_INS_MADDLD, + PPC_INS_MBAR, + PPC_INS_MCRF, + PPC_INS_MCRFS, + PPC_INS_MCRXRX, + PPC_INS_MFAMR, + PPC_INS_MFASR, + PPC_INS_MFBHRBE, + PPC_INS_MFBR0, + PPC_INS_MFBR1, + PPC_INS_MFBR2, + PPC_INS_MFBR3, + PPC_INS_MFBR4, + PPC_INS_MFBR5, + PPC_INS_MFBR6, + PPC_INS_MFBR7, + PPC_INS_MFCFAR, + PPC_INS_MFCR, + PPC_INS_MFCTR, + PPC_INS_MFDAR, + PPC_INS_MFDBATL, + PPC_INS_MFDBATU, + PPC_INS_MFDCCR, + PPC_INS_MFDCR, + PPC_INS_MFDEAR, + PPC_INS_MFDEC, + PPC_INS_MFDSCR, + PPC_INS_MFDSISR, + PPC_INS_MFESR, + PPC_INS_MFFPRD, + PPC_INS_MFFS, + PPC_INS_MFFSCDRN, + PPC_INS_MFFSCDRNI, + PPC_INS_MFFSCE, + PPC_INS_MFFSCRN, + PPC_INS_MFFSCRNI, + PPC_INS_MFFSL, + PPC_INS_MFIBATL, + PPC_INS_MFIBATU, + PPC_INS_MFICCR, + PPC_INS_MFLR, + PPC_INS_MFMSR, + PPC_INS_MFOCRF, + PPC_INS_MFPID, + PPC_INS_MFPMR, + PPC_INS_MFPVR, + PPC_INS_MFRTCL, + PPC_INS_MFRTCU, + PPC_INS_MFSDR1, + PPC_INS_MFSPEFSCR, + PPC_INS_MFSPR, + PPC_INS_MFSPRG, + PPC_INS_MFSPRG0, + PPC_INS_MFSPRG1, + PPC_INS_MFSPRG2, + PPC_INS_MFSPRG3, + PPC_INS_MFSPRG4, + PPC_INS_MFSPRG5, + PPC_INS_MFSPRG6, + PPC_INS_MFSPRG7, + PPC_INS_MFSR, + PPC_INS_MFSRIN, + PPC_INS_MFSRR0, + PPC_INS_MFSRR1, + PPC_INS_MFSRR2, + PPC_INS_MFSRR3, + PPC_INS_MFTB, + PPC_INS_MFTBHI, + PPC_INS_MFTBL, + PPC_INS_MFTBLO, + PPC_INS_MFTBU, + PPC_INS_MFTCR, + PPC_INS_MFVRD, + PPC_INS_MFVRSAVE, + PPC_INS_MFVSCR, + PPC_INS_MFVSRD, + PPC_INS_MFVSRLD, + PPC_INS_MFVSRWZ, + PPC_INS_MFXER, + PPC_INS_MODSD, + PPC_INS_MODSW, + PPC_INS_MODUD, + PPC_INS_MODUW, + PPC_INS_MR, + PPC_INS_MSGSYNC, + PPC_INS_MSYNC, + PPC_INS_MTAMR, + PPC_INS_MTASR, + PPC_INS_MTBR0, + PPC_INS_MTBR1, + PPC_INS_MTBR2, + PPC_INS_MTBR3, + PPC_INS_MTBR4, + PPC_INS_MTBR5, + PPC_INS_MTBR6, + PPC_INS_MTBR7, + PPC_INS_MTCFAR, + PPC_INS_MTCR, + PPC_INS_MTCRF, + PPC_INS_MTCTR, + PPC_INS_MTDAR, + PPC_INS_MTDBATL, + PPC_INS_MTDBATU, + PPC_INS_MTDCCR, + PPC_INS_MTDCR, + PPC_INS_MTDEAR, + PPC_INS_MTDEC, + PPC_INS_MTDSCR, + PPC_INS_MTDSISR, + PPC_INS_MTESR, + PPC_INS_MTFSB0, + PPC_INS_MTFSB1, + PPC_INS_MTFSF, + PPC_INS_MTFSFI, + PPC_INS_MTIBATL, + PPC_INS_MTIBATU, + PPC_INS_MTICCR, + PPC_INS_MTLR, + PPC_INS_MTMSR, + PPC_INS_MTMSRD, + PPC_INS_MTOCRF, + PPC_INS_MTPID, + PPC_INS_MTPMR, + PPC_INS_MTSDR1, + PPC_INS_MTSPEFSCR, + PPC_INS_MTSPR, + PPC_INS_MTSPRG, + PPC_INS_MTSPRG0, + PPC_INS_MTSPRG1, + PPC_INS_MTSPRG2, + PPC_INS_MTSPRG3, + PPC_INS_MTSPRG4, + PPC_INS_MTSPRG5, + PPC_INS_MTSPRG6, + PPC_INS_MTSPRG7, + PPC_INS_MTSR, + PPC_INS_MTSRIN, + PPC_INS_MTSRR0, + PPC_INS_MTSRR1, + PPC_INS_MTSRR2, + PPC_INS_MTSRR3, + PPC_INS_MTTBHI, + PPC_INS_MTTBL, + PPC_INS_MTTBLO, + PPC_INS_MTTBU, + PPC_INS_MTTCR, + PPC_INS_MTVRSAVE, + PPC_INS_MTVSCR, + PPC_INS_MTVSRD, + PPC_INS_MTVSRDD, + PPC_INS_MTVSRWA, + PPC_INS_MTVSRWS, + PPC_INS_MTVSRWZ, + PPC_INS_MTXER, + PPC_INS_MULHD, + PPC_INS_MULHDU, + PPC_INS_MULHW, + PPC_INS_MULHWU, + PPC_INS_MULLD, + PPC_INS_MULLI, + PPC_INS_MULLW, + PPC_INS_NAND, + PPC_INS_NAP, + PPC_INS_NEG, + PPC_INS_NOP, + PPC_INS_NOR, + PPC_INS_NOT, + PPC_INS_OR, + PPC_INS_ORC, + PPC_INS_ORI, + PPC_INS_ORIS, + PPC_INS_PASTE, + PPC_INS_PASTE_LAST, + PPC_INS_POPCNTB, + PPC_INS_POPCNTD, + PPC_INS_POPCNTW, + PPC_INS_PTESYNC, + PPC_INS_QVALIGNI, + PPC_INS_QVESPLATI, + PPC_INS_QVFABS, + PPC_INS_QVFADD, + PPC_INS_QVFADDS, + PPC_INS_QVFAND, + PPC_INS_QVFANDC, + PPC_INS_QVFCFID, + PPC_INS_QVFCFIDS, + PPC_INS_QVFCFIDU, + PPC_INS_QVFCFIDUS, + PPC_INS_QVFCLR, + PPC_INS_QVFCMPEQ, + PPC_INS_QVFCMPGT, + PPC_INS_QVFCMPLT, + PPC_INS_QVFCPSGN, + PPC_INS_QVFCTFB, + PPC_INS_QVFCTID, + PPC_INS_QVFCTIDU, + PPC_INS_QVFCTIDUZ, + PPC_INS_QVFCTIDZ, + PPC_INS_QVFCTIW, + PPC_INS_QVFCTIWU, + PPC_INS_QVFCTIWUZ, + PPC_INS_QVFCTIWZ, + PPC_INS_QVFEQU, + PPC_INS_QVFLOGICAL, + PPC_INS_QVFMADD, + PPC_INS_QVFMADDS, + PPC_INS_QVFMR, + PPC_INS_QVFMSUB, + PPC_INS_QVFMSUBS, + PPC_INS_QVFMUL, + PPC_INS_QVFMULS, + PPC_INS_QVFNABS, + PPC_INS_QVFNAND, + PPC_INS_QVFNEG, + PPC_INS_QVFNMADD, + PPC_INS_QVFNMADDS, + PPC_INS_QVFNMSUB, + PPC_INS_QVFNMSUBS, + PPC_INS_QVFNOR, + PPC_INS_QVFNOT, + PPC_INS_QVFOR, + PPC_INS_QVFORC, + PPC_INS_QVFPERM, + PPC_INS_QVFRE, + PPC_INS_QVFRES, + PPC_INS_QVFRIM, + PPC_INS_QVFRIN, + PPC_INS_QVFRIP, + PPC_INS_QVFRIZ, + PPC_INS_QVFRSP, + PPC_INS_QVFRSQRTE, + PPC_INS_QVFRSQRTES, + PPC_INS_QVFSEL, + PPC_INS_QVFSET, + PPC_INS_QVFSUB, + PPC_INS_QVFSUBS, + PPC_INS_QVFTSTNAN, + PPC_INS_QVFXMADD, + PPC_INS_QVFXMADDS, + PPC_INS_QVFXMUL, + PPC_INS_QVFXMULS, + PPC_INS_QVFXOR, + PPC_INS_QVFXXCPNMADD, + PPC_INS_QVFXXCPNMADDS, + PPC_INS_QVFXXMADD, + PPC_INS_QVFXXMADDS, + PPC_INS_QVFXXNPMADD, + PPC_INS_QVFXXNPMADDS, + PPC_INS_QVGPCI, + PPC_INS_QVLFCDUX, + PPC_INS_QVLFCDUXA, + PPC_INS_QVLFCDX, + PPC_INS_QVLFCDXA, + PPC_INS_QVLFCSUX, + PPC_INS_QVLFCSUXA, + PPC_INS_QVLFCSX, + PPC_INS_QVLFCSXA, + PPC_INS_QVLFDUX, + PPC_INS_QVLFDUXA, + PPC_INS_QVLFDX, + PPC_INS_QVLFDXA, + PPC_INS_QVLFIWAX, + PPC_INS_QVLFIWAXA, + PPC_INS_QVLFIWZX, + PPC_INS_QVLFIWZXA, + PPC_INS_QVLFSUX, + PPC_INS_QVLFSUXA, + PPC_INS_QVLFSX, + PPC_INS_QVLFSXA, + PPC_INS_QVLPCLDX, + PPC_INS_QVLPCLSX, + PPC_INS_QVLPCRDX, + PPC_INS_QVLPCRSX, + PPC_INS_QVSTFCDUX, + PPC_INS_QVSTFCDUXA, + PPC_INS_QVSTFCDUXI, + PPC_INS_QVSTFCDUXIA, + PPC_INS_QVSTFCDX, + PPC_INS_QVSTFCDXA, + PPC_INS_QVSTFCDXI, + PPC_INS_QVSTFCDXIA, + PPC_INS_QVSTFCSUX, + PPC_INS_QVSTFCSUXA, + PPC_INS_QVSTFCSUXI, + PPC_INS_QVSTFCSUXIA, + PPC_INS_QVSTFCSX, + PPC_INS_QVSTFCSXA, + PPC_INS_QVSTFCSXI, + PPC_INS_QVSTFCSXIA, + PPC_INS_QVSTFDUX, + PPC_INS_QVSTFDUXA, + PPC_INS_QVSTFDUXI, + PPC_INS_QVSTFDUXIA, + PPC_INS_QVSTFDX, + PPC_INS_QVSTFDXA, + PPC_INS_QVSTFDXI, + PPC_INS_QVSTFDXIA, + PPC_INS_QVSTFIWX, + PPC_INS_QVSTFIWXA, + PPC_INS_QVSTFSUX, + PPC_INS_QVSTFSUXA, + PPC_INS_QVSTFSUXI, + PPC_INS_QVSTFSUXIA, + PPC_INS_QVSTFSX, + PPC_INS_QVSTFSXA, + PPC_INS_QVSTFSXI, + PPC_INS_QVSTFSXIA, + PPC_INS_RFCI, + PPC_INS_RFDI, + PPC_INS_RFEBB, + PPC_INS_RFI, + PPC_INS_RFID, + PPC_INS_RFMCI, + PPC_INS_RLDCL, + PPC_INS_RLDCR, + PPC_INS_RLDIC, + PPC_INS_RLDICL, + PPC_INS_RLDICR, + PPC_INS_RLDIMI, + PPC_INS_RLWIMI, + PPC_INS_RLWINM, + PPC_INS_RLWNM, + PPC_INS_ROTLD, + PPC_INS_ROTLDI, + PPC_INS_ROTLW, + PPC_INS_ROTLWI, + PPC_INS_ROTRDI, + PPC_INS_ROTRWI, + PPC_INS_SC, + PPC_INS_SETB, + PPC_INS_SLBIA, + PPC_INS_SLBIE, + PPC_INS_SLBIEG, + PPC_INS_SLBMFEE, + PPC_INS_SLBMFEV, + PPC_INS_SLBMTE, + PPC_INS_SLBSYNC, + PPC_INS_SLD, + PPC_INS_SLDI, + PPC_INS_SLW, + PPC_INS_SLWI, + PPC_INS_SRAD, + PPC_INS_SRADI, + PPC_INS_SRAW, + PPC_INS_SRAWI, + PPC_INS_SRD, + PPC_INS_SRDI, + PPC_INS_SRW, + PPC_INS_SRWI, + PPC_INS_STB, + PPC_INS_STBCIX, + PPC_INS_STBCX, + PPC_INS_STBEPX, + PPC_INS_STBU, + PPC_INS_STBUX, + PPC_INS_STBX, + PPC_INS_STD, + PPC_INS_STDAT, + PPC_INS_STDBRX, + PPC_INS_STDCIX, + PPC_INS_STDCX, + PPC_INS_STDU, + PPC_INS_STDUX, + PPC_INS_STDX, + PPC_INS_STFD, + PPC_INS_STFDEPX, + PPC_INS_STFDU, + PPC_INS_STFDUX, + PPC_INS_STFDX, + PPC_INS_STFIWX, + PPC_INS_STFS, + PPC_INS_STFSU, + PPC_INS_STFSUX, + PPC_INS_STFSX, + PPC_INS_STH, + PPC_INS_STHBRX, + PPC_INS_STHCIX, + PPC_INS_STHCX, + PPC_INS_STHEPX, + PPC_INS_STHU, + PPC_INS_STHUX, + PPC_INS_STHX, + PPC_INS_STMW, + PPC_INS_STOP, + PPC_INS_STSWI, + PPC_INS_STVEBX, + PPC_INS_STVEHX, + PPC_INS_STVEWX, + PPC_INS_STVX, + PPC_INS_STVXL, + PPC_INS_STW, + PPC_INS_STWAT, + PPC_INS_STWBRX, + PPC_INS_STWCIX, + PPC_INS_STWCX, + PPC_INS_STWEPX, + PPC_INS_STWU, + PPC_INS_STWUX, + PPC_INS_STWX, + PPC_INS_STXSD, + PPC_INS_STXSDX, + PPC_INS_STXSIBX, + PPC_INS_STXSIHX, + PPC_INS_STXSIWX, + PPC_INS_STXSSP, + PPC_INS_STXSSPX, + PPC_INS_STXV, + PPC_INS_STXVB16X, + PPC_INS_STXVD2X, + PPC_INS_STXVH8X, + PPC_INS_STXVL, + PPC_INS_STXVLL, + PPC_INS_STXVW4X, + PPC_INS_STXVX, + PPC_INS_SUB, + PPC_INS_SUBC, + PPC_INS_SUBF, + PPC_INS_SUBFC, + PPC_INS_SUBFE, + PPC_INS_SUBFIC, + PPC_INS_SUBFME, + PPC_INS_SUBFZE, + PPC_INS_SUBI, + PPC_INS_SUBIC, + PPC_INS_SUBIS, + PPC_INS_SUBPCIS, + PPC_INS_SYNC, + PPC_INS_TABORT, + PPC_INS_TABORTDC, + PPC_INS_TABORTDCI, + PPC_INS_TABORTWC, + PPC_INS_TABORTWCI, + PPC_INS_TBEGIN, + PPC_INS_TCHECK, + PPC_INS_TD, + PPC_INS_TDEQ, + PPC_INS_TDEQI, + PPC_INS_TDGE, + PPC_INS_TDGEI, + PPC_INS_TDGT, + PPC_INS_TDGTI, + PPC_INS_TDI, + PPC_INS_TDLE, + PPC_INS_TDLEI, + PPC_INS_TDLGE, + PPC_INS_TDLGEI, + PPC_INS_TDLGT, + PPC_INS_TDLGTI, + PPC_INS_TDLLE, + PPC_INS_TDLLEI, + PPC_INS_TDLLT, + PPC_INS_TDLLTI, + PPC_INS_TDLNG, + PPC_INS_TDLNGI, + PPC_INS_TDLNL, + PPC_INS_TDLNLI, + PPC_INS_TDLT, + PPC_INS_TDLTI, + PPC_INS_TDNE, + PPC_INS_TDNEI, + PPC_INS_TDNG, + PPC_INS_TDNGI, + PPC_INS_TDNL, + PPC_INS_TDNLI, + PPC_INS_TDU, + PPC_INS_TDUI, + PPC_INS_TEND, + PPC_INS_TLBIA, + PPC_INS_TLBIE, + PPC_INS_TLBIEL, + PPC_INS_TLBIVAX, + PPC_INS_TLBLD, + PPC_INS_TLBLI, + PPC_INS_TLBRE, + PPC_INS_TLBREHI, + PPC_INS_TLBRELO, + PPC_INS_TLBSX, + PPC_INS_TLBSYNC, + PPC_INS_TLBWE, + PPC_INS_TLBWEHI, + PPC_INS_TLBWELO, + PPC_INS_TRAP, + PPC_INS_TRECHKPT, + PPC_INS_TRECLAIM, + PPC_INS_TSR, + PPC_INS_TW, + PPC_INS_TWEQ, + PPC_INS_TWEQI, + PPC_INS_TWGE, + PPC_INS_TWGEI, + PPC_INS_TWGT, + PPC_INS_TWGTI, + PPC_INS_TWI, + PPC_INS_TWLE, + PPC_INS_TWLEI, + PPC_INS_TWLGE, + PPC_INS_TWLGEI, + PPC_INS_TWLGT, + PPC_INS_TWLGTI, + PPC_INS_TWLLE, + PPC_INS_TWLLEI, + PPC_INS_TWLLT, + PPC_INS_TWLLTI, + PPC_INS_TWLNG, + PPC_INS_TWLNGI, + PPC_INS_TWLNL, + PPC_INS_TWLNLI, + PPC_INS_TWLT, + PPC_INS_TWLTI, + PPC_INS_TWNE, + PPC_INS_TWNEI, + PPC_INS_TWNG, + PPC_INS_TWNGI, + PPC_INS_TWNL, + PPC_INS_TWNLI, + PPC_INS_TWU, + PPC_INS_TWUI, + PPC_INS_VABSDUB, + PPC_INS_VABSDUH, + PPC_INS_VABSDUW, + PPC_INS_VADDCUQ, + PPC_INS_VADDCUW, + PPC_INS_VADDECUQ, + PPC_INS_VADDEUQM, + PPC_INS_VADDFP, + PPC_INS_VADDSBS, + PPC_INS_VADDSHS, + PPC_INS_VADDSWS, + PPC_INS_VADDUBM, + PPC_INS_VADDUBS, + PPC_INS_VADDUDM, + PPC_INS_VADDUHM, + PPC_INS_VADDUHS, + PPC_INS_VADDUQM, + PPC_INS_VADDUWM, + PPC_INS_VADDUWS, + PPC_INS_VAND, + PPC_INS_VANDC, + PPC_INS_VAVGSB, + PPC_INS_VAVGSH, + PPC_INS_VAVGSW, + PPC_INS_VAVGUB, + PPC_INS_VAVGUH, + PPC_INS_VAVGUW, + PPC_INS_VBPERMD, + PPC_INS_VBPERMQ, + PPC_INS_VCFSX, + PPC_INS_VCFUX, + PPC_INS_VCIPHER, + PPC_INS_VCIPHERLAST, + PPC_INS_VCLZB, + PPC_INS_VCLZD, + PPC_INS_VCLZH, + PPC_INS_VCLZLSBB, + PPC_INS_VCLZW, + PPC_INS_VCMPBFP, + PPC_INS_VCMPEQFP, + PPC_INS_VCMPEQUB, + PPC_INS_VCMPEQUD, + PPC_INS_VCMPEQUH, + PPC_INS_VCMPEQUW, + PPC_INS_VCMPGEFP, + PPC_INS_VCMPGTFP, + PPC_INS_VCMPGTSB, + PPC_INS_VCMPGTSD, + PPC_INS_VCMPGTSH, + PPC_INS_VCMPGTSW, + PPC_INS_VCMPGTUB, + PPC_INS_VCMPGTUD, + PPC_INS_VCMPGTUH, + PPC_INS_VCMPGTUW, + PPC_INS_VCMPNEB, + PPC_INS_VCMPNEH, + PPC_INS_VCMPNEW, + PPC_INS_VCMPNEZB, + PPC_INS_VCMPNEZH, + PPC_INS_VCMPNEZW, + PPC_INS_VCTSXS, + PPC_INS_VCTUXS, + PPC_INS_VCTZB, + PPC_INS_VCTZD, + PPC_INS_VCTZH, + PPC_INS_VCTZLSBB, + PPC_INS_VCTZW, + PPC_INS_VEQV, + PPC_INS_VEXPTEFP, + PPC_INS_VEXTRACTD, + PPC_INS_VEXTRACTUB, + PPC_INS_VEXTRACTUH, + PPC_INS_VEXTRACTUW, + PPC_INS_VEXTSB2D, + PPC_INS_VEXTSB2W, + PPC_INS_VEXTSH2D, + PPC_INS_VEXTSH2W, + PPC_INS_VEXTSW2D, + PPC_INS_VEXTUBLX, + PPC_INS_VEXTUBRX, + PPC_INS_VEXTUHLX, + PPC_INS_VEXTUHRX, + PPC_INS_VEXTUWLX, + PPC_INS_VEXTUWRX, + PPC_INS_VGBBD, + PPC_INS_VINSERTB, + PPC_INS_VINSERTD, + PPC_INS_VINSERTH, + PPC_INS_VINSERTW, + PPC_INS_VLOGEFP, + PPC_INS_VMADDFP, + PPC_INS_VMAXFP, + PPC_INS_VMAXSB, + PPC_INS_VMAXSD, + PPC_INS_VMAXSH, + PPC_INS_VMAXSW, + PPC_INS_VMAXUB, + PPC_INS_VMAXUD, + PPC_INS_VMAXUH, + PPC_INS_VMAXUW, + PPC_INS_VMHADDSHS, + PPC_INS_VMHRADDSHS, + PPC_INS_VMINFP, + PPC_INS_VMINSB, + PPC_INS_VMINSD, + PPC_INS_VMINSH, + PPC_INS_VMINSW, + PPC_INS_VMINUB, + PPC_INS_VMINUD, + PPC_INS_VMINUH, + PPC_INS_VMINUW, + PPC_INS_VMLADDUHM, + PPC_INS_VMR, + PPC_INS_VMRGEW, + PPC_INS_VMRGHB, + PPC_INS_VMRGHH, + PPC_INS_VMRGHW, + PPC_INS_VMRGLB, + PPC_INS_VMRGLH, + PPC_INS_VMRGLW, + PPC_INS_VMRGOW, + PPC_INS_VMSUMMBM, + PPC_INS_VMSUMSHM, + PPC_INS_VMSUMSHS, + PPC_INS_VMSUMUBM, + PPC_INS_VMSUMUHM, + PPC_INS_VMSUMUHS, + PPC_INS_VMUL10CUQ, + PPC_INS_VMUL10ECUQ, + PPC_INS_VMUL10EUQ, + PPC_INS_VMUL10UQ, + PPC_INS_VMULESB, + PPC_INS_VMULESH, + PPC_INS_VMULESW, + PPC_INS_VMULEUB, + PPC_INS_VMULEUH, + PPC_INS_VMULEUW, + PPC_INS_VMULOSB, + PPC_INS_VMULOSH, + PPC_INS_VMULOSW, + PPC_INS_VMULOUB, + PPC_INS_VMULOUH, + PPC_INS_VMULOUW, + PPC_INS_VMULUWM, + PPC_INS_VNAND, + PPC_INS_VNCIPHER, + PPC_INS_VNCIPHERLAST, + PPC_INS_VNEGD, + PPC_INS_VNEGW, + PPC_INS_VNMSUBFP, + PPC_INS_VNOR, + PPC_INS_VNOT, + PPC_INS_VOR, + PPC_INS_VORC, + PPC_INS_VPERM, + PPC_INS_VPERMR, + PPC_INS_VPERMXOR, + PPC_INS_VPKPX, + PPC_INS_VPKSDSS, + PPC_INS_VPKSDUS, + PPC_INS_VPKSHSS, + PPC_INS_VPKSHUS, + PPC_INS_VPKSWSS, + PPC_INS_VPKSWUS, + PPC_INS_VPKUDUM, + PPC_INS_VPKUDUS, + PPC_INS_VPKUHUM, + PPC_INS_VPKUHUS, + PPC_INS_VPKUWUM, + PPC_INS_VPKUWUS, + PPC_INS_VPMSUMB, + PPC_INS_VPMSUMD, + PPC_INS_VPMSUMH, + PPC_INS_VPMSUMW, + PPC_INS_VPOPCNTB, + PPC_INS_VPOPCNTD, + PPC_INS_VPOPCNTH, + PPC_INS_VPOPCNTW, + PPC_INS_VPRTYBD, + PPC_INS_VPRTYBQ, + PPC_INS_VPRTYBW, + PPC_INS_VREFP, + PPC_INS_VRFIM, + PPC_INS_VRFIN, + PPC_INS_VRFIP, + PPC_INS_VRFIZ, + PPC_INS_VRLB, + PPC_INS_VRLD, + PPC_INS_VRLDMI, + PPC_INS_VRLDNM, + PPC_INS_VRLH, + PPC_INS_VRLW, + PPC_INS_VRLWMI, + PPC_INS_VRLWNM, + PPC_INS_VRSQRTEFP, + PPC_INS_VSBOX, + PPC_INS_VSEL, + PPC_INS_VSHASIGMAD, + PPC_INS_VSHASIGMAW, + PPC_INS_VSL, + PPC_INS_VSLB, + PPC_INS_VSLD, + PPC_INS_VSLDOI, + PPC_INS_VSLH, + PPC_INS_VSLO, + PPC_INS_VSLV, + PPC_INS_VSLW, + PPC_INS_VSPLTB, + PPC_INS_VSPLTH, + PPC_INS_VSPLTISB, + PPC_INS_VSPLTISH, + PPC_INS_VSPLTISW, + PPC_INS_VSPLTW, + PPC_INS_VSR, + PPC_INS_VSRAB, + PPC_INS_VSRAD, + PPC_INS_VSRAH, + PPC_INS_VSRAW, + PPC_INS_VSRB, + PPC_INS_VSRD, + PPC_INS_VSRH, + PPC_INS_VSRO, + PPC_INS_VSRV, + PPC_INS_VSRW, + PPC_INS_VSUBCUQ, + PPC_INS_VSUBCUW, + PPC_INS_VSUBECUQ, + PPC_INS_VSUBEUQM, + PPC_INS_VSUBFP, + PPC_INS_VSUBSBS, + PPC_INS_VSUBSHS, + PPC_INS_VSUBSWS, + PPC_INS_VSUBUBM, + PPC_INS_VSUBUBS, + PPC_INS_VSUBUDM, + PPC_INS_VSUBUHM, + PPC_INS_VSUBUHS, + PPC_INS_VSUBUQM, + PPC_INS_VSUBUWM, + PPC_INS_VSUBUWS, + PPC_INS_VSUM2SWS, + PPC_INS_VSUM4SBS, + PPC_INS_VSUM4SHS, + PPC_INS_VSUM4UBS, + PPC_INS_VSUMSWS, + PPC_INS_VUPKHPX, + PPC_INS_VUPKHSB, + PPC_INS_VUPKHSH, + PPC_INS_VUPKHSW, + PPC_INS_VUPKLPX, + PPC_INS_VUPKLSB, + PPC_INS_VUPKLSH, + PPC_INS_VUPKLSW, + PPC_INS_VXOR, + PPC_INS_WAIT, + PPC_INS_WAITIMPL, + PPC_INS_WAITRSV, + PPC_INS_WRTEE, + PPC_INS_WRTEEI, + PPC_INS_XNOP, + PPC_INS_XOR, + PPC_INS_XORI, + PPC_INS_XORIS, + PPC_INS_XSABSDP, + PPC_INS_XSABSQP, + PPC_INS_XSADDDP, + PPC_INS_XSADDQP, + PPC_INS_XSADDQPO, + PPC_INS_XSADDSP, + PPC_INS_XSCMPEQDP, + PPC_INS_XSCMPEXPDP, + PPC_INS_XSCMPEXPQP, + PPC_INS_XSCMPGEDP, + PPC_INS_XSCMPGTDP, + PPC_INS_XSCMPODP, + PPC_INS_XSCMPOQP, + PPC_INS_XSCMPUDP, + PPC_INS_XSCMPUQP, + PPC_INS_XSCPSGNDP, + PPC_INS_XSCPSGNQP, + PPC_INS_XSCVDPHP, + PPC_INS_XSCVDPQP, + PPC_INS_XSCVDPSP, + PPC_INS_XSCVDPSPN, + PPC_INS_XSCVDPSXDS, + PPC_INS_XSCVDPSXWS, + PPC_INS_XSCVDPUXDS, + PPC_INS_XSCVDPUXWS, + PPC_INS_XSCVHPDP, + PPC_INS_XSCVQPDP, + PPC_INS_XSCVQPDPO, + PPC_INS_XSCVQPSDZ, + PPC_INS_XSCVQPSWZ, + PPC_INS_XSCVQPUDZ, + PPC_INS_XSCVQPUWZ, + PPC_INS_XSCVSDQP, + PPC_INS_XSCVSPDP, + PPC_INS_XSCVSPDPN, + PPC_INS_XSCVSXDDP, + PPC_INS_XSCVSXDSP, + PPC_INS_XSCVUDQP, + PPC_INS_XSCVUXDDP, + PPC_INS_XSCVUXDSP, + PPC_INS_XSDIVDP, + PPC_INS_XSDIVQP, + PPC_INS_XSDIVQPO, + PPC_INS_XSDIVSP, + PPC_INS_XSIEXPDP, + PPC_INS_XSIEXPQP, + PPC_INS_XSMADDADP, + PPC_INS_XSMADDASP, + PPC_INS_XSMADDMDP, + PPC_INS_XSMADDMSP, + PPC_INS_XSMADDQP, + PPC_INS_XSMADDQPO, + PPC_INS_XSMAXCDP, + PPC_INS_XSMAXDP, + PPC_INS_XSMAXJDP, + PPC_INS_XSMINCDP, + PPC_INS_XSMINDP, + PPC_INS_XSMINJDP, + PPC_INS_XSMSUBADP, + PPC_INS_XSMSUBASP, + PPC_INS_XSMSUBMDP, + PPC_INS_XSMSUBMSP, + PPC_INS_XSMSUBQP, + PPC_INS_XSMSUBQPO, + PPC_INS_XSMULDP, + PPC_INS_XSMULQP, + PPC_INS_XSMULQPO, + PPC_INS_XSMULSP, + PPC_INS_XSNABSDP, + PPC_INS_XSNABSQP, + PPC_INS_XSNEGDP, + PPC_INS_XSNEGQP, + PPC_INS_XSNMADDADP, + PPC_INS_XSNMADDASP, + PPC_INS_XSNMADDMDP, + PPC_INS_XSNMADDMSP, + PPC_INS_XSNMADDQP, + PPC_INS_XSNMADDQPO, + PPC_INS_XSNMSUBADP, + PPC_INS_XSNMSUBASP, + PPC_INS_XSNMSUBMDP, + PPC_INS_XSNMSUBMSP, + PPC_INS_XSNMSUBQP, + PPC_INS_XSNMSUBQPO, + PPC_INS_XSRDPI, + PPC_INS_XSRDPIC, + PPC_INS_XSRDPIM, + PPC_INS_XSRDPIP, + PPC_INS_XSRDPIZ, + PPC_INS_XSREDP, + PPC_INS_XSRESP, + PPC_INS_XSRQPI, + PPC_INS_XSRQPIX, + PPC_INS_XSRQPXP, + PPC_INS_XSRSP, + PPC_INS_XSRSQRTEDP, + PPC_INS_XSRSQRTESP, + PPC_INS_XSSQRTDP, + PPC_INS_XSSQRTQP, + PPC_INS_XSSQRTQPO, + PPC_INS_XSSQRTSP, + PPC_INS_XSSUBDP, + PPC_INS_XSSUBQP, + PPC_INS_XSSUBQPO, + PPC_INS_XSSUBSP, + PPC_INS_XSTDIVDP, + PPC_INS_XSTSQRTDP, + PPC_INS_XSTSTDCDP, + PPC_INS_XSTSTDCQP, + PPC_INS_XSTSTDCSP, + PPC_INS_XSXEXPDP, + PPC_INS_XSXEXPQP, + PPC_INS_XSXSIGDP, + PPC_INS_XSXSIGQP, + PPC_INS_XVABSDP, + PPC_INS_XVABSSP, + PPC_INS_XVADDDP, + PPC_INS_XVADDSP, + PPC_INS_XVCMPEQDP, + PPC_INS_XVCMPEQSP, + PPC_INS_XVCMPGEDP, + PPC_INS_XVCMPGESP, + PPC_INS_XVCMPGTDP, + PPC_INS_XVCMPGTSP, + PPC_INS_XVCPSGNDP, + PPC_INS_XVCPSGNSP, + PPC_INS_XVCVDPSP, + PPC_INS_XVCVDPSXDS, + PPC_INS_XVCVDPSXWS, + PPC_INS_XVCVDPUXDS, + PPC_INS_XVCVDPUXWS, + PPC_INS_XVCVHPSP, + PPC_INS_XVCVSPDP, + PPC_INS_XVCVSPHP, + PPC_INS_XVCVSPSXDS, + PPC_INS_XVCVSPSXWS, + PPC_INS_XVCVSPUXDS, + PPC_INS_XVCVSPUXWS, + PPC_INS_XVCVSXDDP, + PPC_INS_XVCVSXDSP, + PPC_INS_XVCVSXWDP, + PPC_INS_XVCVSXWSP, + PPC_INS_XVCVUXDDP, + PPC_INS_XVCVUXDSP, + PPC_INS_XVCVUXWDP, + PPC_INS_XVCVUXWSP, + PPC_INS_XVDIVDP, + PPC_INS_XVDIVSP, + PPC_INS_XVIEXPDP, + PPC_INS_XVIEXPSP, + PPC_INS_XVMADDADP, + PPC_INS_XVMADDASP, + PPC_INS_XVMADDMDP, + PPC_INS_XVMADDMSP, + PPC_INS_XVMAXDP, + PPC_INS_XVMAXSP, + PPC_INS_XVMINDP, + PPC_INS_XVMINSP, + PPC_INS_XVMOVDP, + PPC_INS_XVMOVSP, + PPC_INS_XVMSUBADP, + PPC_INS_XVMSUBASP, + PPC_INS_XVMSUBMDP, + PPC_INS_XVMSUBMSP, + PPC_INS_XVMULDP, + PPC_INS_XVMULSP, + PPC_INS_XVNABSDP, + PPC_INS_XVNABSSP, + PPC_INS_XVNEGDP, + PPC_INS_XVNEGSP, + PPC_INS_XVNMADDADP, + PPC_INS_XVNMADDASP, + PPC_INS_XVNMADDMDP, + PPC_INS_XVNMADDMSP, + PPC_INS_XVNMSUBADP, + PPC_INS_XVNMSUBASP, + PPC_INS_XVNMSUBMDP, + PPC_INS_XVNMSUBMSP, + PPC_INS_XVRDPI, + PPC_INS_XVRDPIC, + PPC_INS_XVRDPIM, + PPC_INS_XVRDPIP, + PPC_INS_XVRDPIZ, + PPC_INS_XVREDP, + PPC_INS_XVRESP, + PPC_INS_XVRSPI, + PPC_INS_XVRSPIC, + PPC_INS_XVRSPIM, + PPC_INS_XVRSPIP, + PPC_INS_XVRSPIZ, + PPC_INS_XVRSQRTEDP, + PPC_INS_XVRSQRTESP, + PPC_INS_XVSQRTDP, + PPC_INS_XVSQRTSP, + PPC_INS_XVSUBDP, + PPC_INS_XVSUBSP, + PPC_INS_XVTDIVDP, + PPC_INS_XVTDIVSP, + PPC_INS_XVTSQRTDP, + PPC_INS_XVTSQRTSP, + PPC_INS_XVTSTDCDP, + PPC_INS_XVTSTDCSP, + PPC_INS_XVXEXPDP, + PPC_INS_XVXEXPSP, + PPC_INS_XVXSIGDP, + PPC_INS_XVXSIGSP, + PPC_INS_XXBRD, + PPC_INS_XXBRH, + PPC_INS_XXBRQ, + PPC_INS_XXBRW, + PPC_INS_XXEXTRACTUW, + PPC_INS_XXINSERTW, + PPC_INS_XXLAND, + PPC_INS_XXLANDC, + PPC_INS_XXLEQV, + PPC_INS_XXLNAND, + PPC_INS_XXLNOR, + PPC_INS_XXLOR, + PPC_INS_XXLORC, + PPC_INS_XXLXOR, + PPC_INS_XXMRGHD, + PPC_INS_XXMRGHW, + PPC_INS_XXMRGLD, + PPC_INS_XXMRGLW, + PPC_INS_XXPERM, + PPC_INS_XXPERMDI, + PPC_INS_XXPERMR, + PPC_INS_XXSEL, + PPC_INS_XXSLDWI, + PPC_INS_XXSPLTD, + PPC_INS_XXSPLTIB, + PPC_INS_XXSPLTW, + PPC_INS_XXSWAPD, + PPC_INS_ENDING, // <-- mark the end of the list of instructions +} ppc_insn; + +/// Group of PPC instructions +typedef enum ppc_insn_group { + PPC_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + // Generic groups + // all jump instructions (conditional+direct+indirect jumps) + PPC_GRP_JUMP, ///< = CS_GRP_JUMP + + // Architecture-specific groups + PPC_GRP_ALTIVEC = 128, + PPC_GRP_MODE32, + PPC_GRP_MODE64, + PPC_GRP_BOOKE, + PPC_GRP_NOTBOOKE, + PPC_GRP_SPE, + PPC_GRP_VSX, + PPC_GRP_E500, + PPC_GRP_PPC4XX, + PPC_GRP_PPC6XX, + PPC_GRP_ICBT, + PPC_GRP_P8ALTIVEC, + PPC_GRP_P8VECTOR, + PPC_GRP_QPX, + + PPC_GRP_ENDING, // <-- mark the end of the list of groups +} ppc_insn_group; + +#ifdef __cplusplus +} +#endif + +#endif +#ifndef CAPSTONE_SPARC_H +#define CAPSTONE_SPARC_H + +/* Capstone Disassembly Engine */ +/* By Nguyen Anh Quynh , 2014-2015 */ + +#ifdef __cplusplus +extern "C" { +#endif + + +// GCC SPARC toolchain has a default macro called "sparc" which breaks +// compilation +#undef sparc + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +/// Enums corresponding to Sparc condition codes, both icc's and fcc's. +typedef enum sparc_cc { + SPARC_CC_INVALID = 0, ///< invalid CC (default) + // Integer condition codes + SPARC_CC_ICC_A = 8+256, ///< Always + SPARC_CC_ICC_N = 0+256, ///< Never + SPARC_CC_ICC_NE = 9+256, ///< Not Equal + SPARC_CC_ICC_E = 1+256, ///< Equal + SPARC_CC_ICC_G = 10+256, ///< Greater + SPARC_CC_ICC_LE = 2+256, ///< Less or Equal + SPARC_CC_ICC_GE = 11+256, ///< Greater or Equal + SPARC_CC_ICC_L = 3+256, ///< Less + SPARC_CC_ICC_GU = 12+256, ///< Greater Unsigned + SPARC_CC_ICC_LEU = 4+256, ///< Less or Equal Unsigned + SPARC_CC_ICC_CC = 13+256, ///< Carry Clear/Great or Equal Unsigned + SPARC_CC_ICC_CS = 5+256, ///< Carry Set/Less Unsigned + SPARC_CC_ICC_POS = 14+256, ///< Positive + SPARC_CC_ICC_NEG = 6+256, ///< Negative + SPARC_CC_ICC_VC = 15+256, ///< Overflow Clear + SPARC_CC_ICC_VS = 7+256, ///< Overflow Set + + // Floating condition codes + SPARC_CC_FCC_A = 8+16+256, ///< Always + SPARC_CC_FCC_N = 0+16+256, ///< Never + SPARC_CC_FCC_U = 7+16+256, ///< Unordered + SPARC_CC_FCC_G = 6+16+256, ///< Greater + SPARC_CC_FCC_UG = 5+16+256, ///< Unordered or Greater + SPARC_CC_FCC_L = 4+16+256, ///< Less + SPARC_CC_FCC_UL = 3+16+256, ///< Unordered or Less + SPARC_CC_FCC_LG = 2+16+256, ///< Less or Greater + SPARC_CC_FCC_NE = 1+16+256, ///< Not Equal + SPARC_CC_FCC_E = 9+16+256, ///< Equal + SPARC_CC_FCC_UE = 10+16+256, ///< Unordered or Equal + SPARC_CC_FCC_GE = 11+16+256, ///< Greater or Equal + SPARC_CC_FCC_UGE = 12+16+256, ///< Unordered or Greater or Equal + SPARC_CC_FCC_LE = 13+16+256, ///< Less or Equal + SPARC_CC_FCC_ULE = 14+16+256, ///< Unordered or Less or Equal + SPARC_CC_FCC_O = 15+16+256, ///< Ordered +} sparc_cc; + +/// Branch hint +typedef enum sparc_hint { + SPARC_HINT_INVALID = 0, ///< no hint + SPARC_HINT_A = 1 << 0, ///< annul delay slot instruction + SPARC_HINT_PT = 1 << 1, ///< branch taken + SPARC_HINT_PN = 1 << 2, ///< branch NOT taken +} sparc_hint; + +/// Operand type for instruction's operands +typedef enum sparc_op_type { + SPARC_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + SPARC_OP_REG, ///< = CS_OP_REG (Register operand). + SPARC_OP_IMM, ///< = CS_OP_IMM (Immediate operand). + SPARC_OP_MEM, ///< = CS_OP_MEM (Memory operand). +} sparc_op_type; + +/// SPARC registers +typedef enum sparc_reg { + SPARC_REG_INVALID = 0, + + SPARC_REG_F0, + SPARC_REG_F1, + SPARC_REG_F2, + SPARC_REG_F3, + SPARC_REG_F4, + SPARC_REG_F5, + SPARC_REG_F6, + SPARC_REG_F7, + SPARC_REG_F8, + SPARC_REG_F9, + SPARC_REG_F10, + SPARC_REG_F11, + SPARC_REG_F12, + SPARC_REG_F13, + SPARC_REG_F14, + SPARC_REG_F15, + SPARC_REG_F16, + SPARC_REG_F17, + SPARC_REG_F18, + SPARC_REG_F19, + SPARC_REG_F20, + SPARC_REG_F21, + SPARC_REG_F22, + SPARC_REG_F23, + SPARC_REG_F24, + SPARC_REG_F25, + SPARC_REG_F26, + SPARC_REG_F27, + SPARC_REG_F28, + SPARC_REG_F29, + SPARC_REG_F30, + SPARC_REG_F31, + SPARC_REG_F32, + SPARC_REG_F34, + SPARC_REG_F36, + SPARC_REG_F38, + SPARC_REG_F40, + SPARC_REG_F42, + SPARC_REG_F44, + SPARC_REG_F46, + SPARC_REG_F48, + SPARC_REG_F50, + SPARC_REG_F52, + SPARC_REG_F54, + SPARC_REG_F56, + SPARC_REG_F58, + SPARC_REG_F60, + SPARC_REG_F62, + SPARC_REG_FCC0, // Floating condition codes + SPARC_REG_FCC1, + SPARC_REG_FCC2, + SPARC_REG_FCC3, + SPARC_REG_FP, + SPARC_REG_G0, + SPARC_REG_G1, + SPARC_REG_G2, + SPARC_REG_G3, + SPARC_REG_G4, + SPARC_REG_G5, + SPARC_REG_G6, + SPARC_REG_G7, + SPARC_REG_I0, + SPARC_REG_I1, + SPARC_REG_I2, + SPARC_REG_I3, + SPARC_REG_I4, + SPARC_REG_I5, + SPARC_REG_I7, + SPARC_REG_ICC, // Integer condition codes + SPARC_REG_L0, + SPARC_REG_L1, + SPARC_REG_L2, + SPARC_REG_L3, + SPARC_REG_L4, + SPARC_REG_L5, + SPARC_REG_L6, + SPARC_REG_L7, + SPARC_REG_O0, + SPARC_REG_O1, + SPARC_REG_O2, + SPARC_REG_O3, + SPARC_REG_O4, + SPARC_REG_O5, + SPARC_REG_O7, + SPARC_REG_SP, + SPARC_REG_Y, + + // special register + SPARC_REG_XCC, + + SPARC_REG_ENDING, // <-- mark the end of the list of registers + + // extras + SPARC_REG_O6 = SPARC_REG_SP, + SPARC_REG_I6 = SPARC_REG_FP, +} sparc_reg; + +/// Instruction's operand referring to memory +/// This is associated with SPARC_OP_MEM operand type above +typedef struct sparc_op_mem { + uint8_t base; ///< base register, can be safely interpreted as + ///< a value of type `sparc_reg`, but it is only + ///< one byte wide + uint8_t index; ///< index register, same conditions apply here + int32_t disp; ///< displacement/offset value +} sparc_op_mem; + +/// Instruction operand +typedef struct cs_sparc_op { + sparc_op_type type; ///< operand type + union { + sparc_reg reg; ///< register value for REG operand + int64_t imm; ///< immediate value for IMM operand + sparc_op_mem mem; ///< base/disp value for MEM operand + }; +} cs_sparc_op; + +/// Instruction structure +typedef struct cs_sparc { + sparc_cc cc; ///< code condition for this insn + sparc_hint hint; ///< branch hint: encoding as bitwise OR of sparc_hint. + /// Number of operands of this instruction, + /// or 0 when instruction has no operand. + uint8_t op_count; + cs_sparc_op operands[4]; ///< operands for this instruction. +} cs_sparc; + +/// SPARC instruction +typedef enum sparc_insn { + SPARC_INS_INVALID = 0, + + SPARC_INS_ADDCC, + SPARC_INS_ADDX, + SPARC_INS_ADDXCC, + SPARC_INS_ADDXC, + SPARC_INS_ADDXCCC, + SPARC_INS_ADD, + SPARC_INS_ALIGNADDR, + SPARC_INS_ALIGNADDRL, + SPARC_INS_ANDCC, + SPARC_INS_ANDNCC, + SPARC_INS_ANDN, + SPARC_INS_AND, + SPARC_INS_ARRAY16, + SPARC_INS_ARRAY32, + SPARC_INS_ARRAY8, + SPARC_INS_B, + SPARC_INS_JMP, + SPARC_INS_BMASK, + SPARC_INS_FB, + SPARC_INS_BRGEZ, + SPARC_INS_BRGZ, + SPARC_INS_BRLEZ, + SPARC_INS_BRLZ, + SPARC_INS_BRNZ, + SPARC_INS_BRZ, + SPARC_INS_BSHUFFLE, + SPARC_INS_CALL, + SPARC_INS_CASX, + SPARC_INS_CAS, + SPARC_INS_CMASK16, + SPARC_INS_CMASK32, + SPARC_INS_CMASK8, + SPARC_INS_CMP, + SPARC_INS_EDGE16, + SPARC_INS_EDGE16L, + SPARC_INS_EDGE16LN, + SPARC_INS_EDGE16N, + SPARC_INS_EDGE32, + SPARC_INS_EDGE32L, + SPARC_INS_EDGE32LN, + SPARC_INS_EDGE32N, + SPARC_INS_EDGE8, + SPARC_INS_EDGE8L, + SPARC_INS_EDGE8LN, + SPARC_INS_EDGE8N, + SPARC_INS_FABSD, + SPARC_INS_FABSQ, + SPARC_INS_FABSS, + SPARC_INS_FADDD, + SPARC_INS_FADDQ, + SPARC_INS_FADDS, + SPARC_INS_FALIGNDATA, + SPARC_INS_FAND, + SPARC_INS_FANDNOT1, + SPARC_INS_FANDNOT1S, + SPARC_INS_FANDNOT2, + SPARC_INS_FANDNOT2S, + SPARC_INS_FANDS, + SPARC_INS_FCHKSM16, + SPARC_INS_FCMPD, + SPARC_INS_FCMPEQ16, + SPARC_INS_FCMPEQ32, + SPARC_INS_FCMPGT16, + SPARC_INS_FCMPGT32, + SPARC_INS_FCMPLE16, + SPARC_INS_FCMPLE32, + SPARC_INS_FCMPNE16, + SPARC_INS_FCMPNE32, + SPARC_INS_FCMPQ, + SPARC_INS_FCMPS, + SPARC_INS_FDIVD, + SPARC_INS_FDIVQ, + SPARC_INS_FDIVS, + SPARC_INS_FDMULQ, + SPARC_INS_FDTOI, + SPARC_INS_FDTOQ, + SPARC_INS_FDTOS, + SPARC_INS_FDTOX, + SPARC_INS_FEXPAND, + SPARC_INS_FHADDD, + SPARC_INS_FHADDS, + SPARC_INS_FHSUBD, + SPARC_INS_FHSUBS, + SPARC_INS_FITOD, + SPARC_INS_FITOQ, + SPARC_INS_FITOS, + SPARC_INS_FLCMPD, + SPARC_INS_FLCMPS, + SPARC_INS_FLUSHW, + SPARC_INS_FMEAN16, + SPARC_INS_FMOVD, + SPARC_INS_FMOVQ, + SPARC_INS_FMOVRDGEZ, + SPARC_INS_FMOVRQGEZ, + SPARC_INS_FMOVRSGEZ, + SPARC_INS_FMOVRDGZ, + SPARC_INS_FMOVRQGZ, + SPARC_INS_FMOVRSGZ, + SPARC_INS_FMOVRDLEZ, + SPARC_INS_FMOVRQLEZ, + SPARC_INS_FMOVRSLEZ, + SPARC_INS_FMOVRDLZ, + SPARC_INS_FMOVRQLZ, + SPARC_INS_FMOVRSLZ, + SPARC_INS_FMOVRDNZ, + SPARC_INS_FMOVRQNZ, + SPARC_INS_FMOVRSNZ, + SPARC_INS_FMOVRDZ, + SPARC_INS_FMOVRQZ, + SPARC_INS_FMOVRSZ, + SPARC_INS_FMOVS, + SPARC_INS_FMUL8SUX16, + SPARC_INS_FMUL8ULX16, + SPARC_INS_FMUL8X16, + SPARC_INS_FMUL8X16AL, + SPARC_INS_FMUL8X16AU, + SPARC_INS_FMULD, + SPARC_INS_FMULD8SUX16, + SPARC_INS_FMULD8ULX16, + SPARC_INS_FMULQ, + SPARC_INS_FMULS, + SPARC_INS_FNADDD, + SPARC_INS_FNADDS, + SPARC_INS_FNAND, + SPARC_INS_FNANDS, + SPARC_INS_FNEGD, + SPARC_INS_FNEGQ, + SPARC_INS_FNEGS, + SPARC_INS_FNHADDD, + SPARC_INS_FNHADDS, + SPARC_INS_FNOR, + SPARC_INS_FNORS, + SPARC_INS_FNOT1, + SPARC_INS_FNOT1S, + SPARC_INS_FNOT2, + SPARC_INS_FNOT2S, + SPARC_INS_FONE, + SPARC_INS_FONES, + SPARC_INS_FOR, + SPARC_INS_FORNOT1, + SPARC_INS_FORNOT1S, + SPARC_INS_FORNOT2, + SPARC_INS_FORNOT2S, + SPARC_INS_FORS, + SPARC_INS_FPACK16, + SPARC_INS_FPACK32, + SPARC_INS_FPACKFIX, + SPARC_INS_FPADD16, + SPARC_INS_FPADD16S, + SPARC_INS_FPADD32, + SPARC_INS_FPADD32S, + SPARC_INS_FPADD64, + SPARC_INS_FPMERGE, + SPARC_INS_FPSUB16, + SPARC_INS_FPSUB16S, + SPARC_INS_FPSUB32, + SPARC_INS_FPSUB32S, + SPARC_INS_FQTOD, + SPARC_INS_FQTOI, + SPARC_INS_FQTOS, + SPARC_INS_FQTOX, + SPARC_INS_FSLAS16, + SPARC_INS_FSLAS32, + SPARC_INS_FSLL16, + SPARC_INS_FSLL32, + SPARC_INS_FSMULD, + SPARC_INS_FSQRTD, + SPARC_INS_FSQRTQ, + SPARC_INS_FSQRTS, + SPARC_INS_FSRA16, + SPARC_INS_FSRA32, + SPARC_INS_FSRC1, + SPARC_INS_FSRC1S, + SPARC_INS_FSRC2, + SPARC_INS_FSRC2S, + SPARC_INS_FSRL16, + SPARC_INS_FSRL32, + SPARC_INS_FSTOD, + SPARC_INS_FSTOI, + SPARC_INS_FSTOQ, + SPARC_INS_FSTOX, + SPARC_INS_FSUBD, + SPARC_INS_FSUBQ, + SPARC_INS_FSUBS, + SPARC_INS_FXNOR, + SPARC_INS_FXNORS, + SPARC_INS_FXOR, + SPARC_INS_FXORS, + SPARC_INS_FXTOD, + SPARC_INS_FXTOQ, + SPARC_INS_FXTOS, + SPARC_INS_FZERO, + SPARC_INS_FZEROS, + SPARC_INS_JMPL, + SPARC_INS_LDD, + SPARC_INS_LD, + SPARC_INS_LDQ, + SPARC_INS_LDSB, + SPARC_INS_LDSH, + SPARC_INS_LDSW, + SPARC_INS_LDUB, + SPARC_INS_LDUH, + SPARC_INS_LDX, + SPARC_INS_LZCNT, + SPARC_INS_MEMBAR, + SPARC_INS_MOVDTOX, + SPARC_INS_MOV, + SPARC_INS_MOVRGEZ, + SPARC_INS_MOVRGZ, + SPARC_INS_MOVRLEZ, + SPARC_INS_MOVRLZ, + SPARC_INS_MOVRNZ, + SPARC_INS_MOVRZ, + SPARC_INS_MOVSTOSW, + SPARC_INS_MOVSTOUW, + SPARC_INS_MULX, + SPARC_INS_NOP, + SPARC_INS_ORCC, + SPARC_INS_ORNCC, + SPARC_INS_ORN, + SPARC_INS_OR, + SPARC_INS_PDIST, + SPARC_INS_PDISTN, + SPARC_INS_POPC, + SPARC_INS_RD, + SPARC_INS_RESTORE, + SPARC_INS_RETT, + SPARC_INS_SAVE, + SPARC_INS_SDIVCC, + SPARC_INS_SDIVX, + SPARC_INS_SDIV, + SPARC_INS_SETHI, + SPARC_INS_SHUTDOWN, + SPARC_INS_SIAM, + SPARC_INS_SLLX, + SPARC_INS_SLL, + SPARC_INS_SMULCC, + SPARC_INS_SMUL, + SPARC_INS_SRAX, + SPARC_INS_SRA, + SPARC_INS_SRLX, + SPARC_INS_SRL, + SPARC_INS_STBAR, + SPARC_INS_STB, + SPARC_INS_STD, + SPARC_INS_ST, + SPARC_INS_STH, + SPARC_INS_STQ, + SPARC_INS_STX, + SPARC_INS_SUBCC, + SPARC_INS_SUBX, + SPARC_INS_SUBXCC, + SPARC_INS_SUB, + SPARC_INS_SWAP, + SPARC_INS_TADDCCTV, + SPARC_INS_TADDCC, + SPARC_INS_T, + SPARC_INS_TSUBCCTV, + SPARC_INS_TSUBCC, + SPARC_INS_UDIVCC, + SPARC_INS_UDIVX, + SPARC_INS_UDIV, + SPARC_INS_UMULCC, + SPARC_INS_UMULXHI, + SPARC_INS_UMUL, + SPARC_INS_UNIMP, + SPARC_INS_FCMPED, + SPARC_INS_FCMPEQ, + SPARC_INS_FCMPES, + SPARC_INS_WR, + SPARC_INS_XMULX, + SPARC_INS_XMULXHI, + SPARC_INS_XNORCC, + SPARC_INS_XNOR, + SPARC_INS_XORCC, + SPARC_INS_XOR, + + // alias instructions + SPARC_INS_RET, + SPARC_INS_RETL, + + SPARC_INS_ENDING, // <-- mark the end of the list of instructions +} sparc_insn; + +/// Group of SPARC instructions +typedef enum sparc_insn_group { + SPARC_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + // Generic groups + // all jump instructions (conditional+direct+indirect jumps) + SPARC_GRP_JUMP, ///< = CS_GRP_JUMP + + // Architecture-specific groups + SPARC_GRP_HARDQUAD = 128, + SPARC_GRP_V9, + SPARC_GRP_VIS, + SPARC_GRP_VIS2, + SPARC_GRP_VIS3, + SPARC_GRP_32BIT, + SPARC_GRP_64BIT, + + SPARC_GRP_ENDING, // <-- mark the end of the list of groups +} sparc_insn_group; + +#ifdef __cplusplus +} +#endif + +#endif +#ifndef CAPSTONE_SYSTEMZ_H +#define CAPSTONE_SYSTEMZ_H + +/* Capstone Disassembly Engine */ +/* By Nguyen Anh Quynh , 2014-2015 */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +/// Enums corresponding to SystemZ condition codes +typedef enum sysz_cc { + SYSZ_CC_INVALID = 0, ///< invalid CC (default) + + SYSZ_CC_O, + SYSZ_CC_H, + SYSZ_CC_NLE, + SYSZ_CC_L, + SYSZ_CC_NHE, + SYSZ_CC_LH, + SYSZ_CC_NE, + SYSZ_CC_E, + SYSZ_CC_NLH, + SYSZ_CC_HE, + SYSZ_CC_NL, + SYSZ_CC_LE, + SYSZ_CC_NH, + SYSZ_CC_NO, +} sysz_cc; + +/// Operand type for instruction's operands +typedef enum sysz_op_type { + SYSZ_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + SYSZ_OP_REG, ///< = CS_OP_REG (Register operand). + SYSZ_OP_IMM, ///< = CS_OP_IMM (Immediate operand). + SYSZ_OP_MEM, ///< = CS_OP_MEM (Memory operand). + SYSZ_OP_ACREG = 64, ///< Access register operand. +} sysz_op_type; + +/// SystemZ registers +typedef enum sysz_reg { + SYSZ_REG_INVALID = 0, + + SYSZ_REG_0, + SYSZ_REG_1, + SYSZ_REG_2, + SYSZ_REG_3, + SYSZ_REG_4, + SYSZ_REG_5, + SYSZ_REG_6, + SYSZ_REG_7, + SYSZ_REG_8, + SYSZ_REG_9, + SYSZ_REG_10, + SYSZ_REG_11, + SYSZ_REG_12, + SYSZ_REG_13, + SYSZ_REG_14, + SYSZ_REG_15, + SYSZ_REG_CC, + SYSZ_REG_F0, + SYSZ_REG_F1, + SYSZ_REG_F2, + SYSZ_REG_F3, + SYSZ_REG_F4, + SYSZ_REG_F5, + SYSZ_REG_F6, + SYSZ_REG_F7, + SYSZ_REG_F8, + SYSZ_REG_F9, + SYSZ_REG_F10, + SYSZ_REG_F11, + SYSZ_REG_F12, + SYSZ_REG_F13, + SYSZ_REG_F14, + SYSZ_REG_F15, + + SYSZ_REG_R0L, + + SYSZ_REG_A0, + SYSZ_REG_A1, + SYSZ_REG_A2, + SYSZ_REG_A3, + SYSZ_REG_A4, + SYSZ_REG_A5, + SYSZ_REG_A6, + SYSZ_REG_A7, + SYSZ_REG_A8, + SYSZ_REG_A9, + SYSZ_REG_A10, + SYSZ_REG_A11, + SYSZ_REG_A12, + SYSZ_REG_A13, + SYSZ_REG_A14, + SYSZ_REG_A15, + SYSZ_REG_C0, + SYSZ_REG_C1, + SYSZ_REG_C2, + SYSZ_REG_C3, + SYSZ_REG_C4, + SYSZ_REG_C5, + SYSZ_REG_C6, + SYSZ_REG_C7, + SYSZ_REG_C8, + SYSZ_REG_C9, + SYSZ_REG_C10, + SYSZ_REG_C11, + SYSZ_REG_C12, + SYSZ_REG_C13, + SYSZ_REG_C14, + SYSZ_REG_C15, + SYSZ_REG_V0, + SYSZ_REG_V1, + SYSZ_REG_V2, + SYSZ_REG_V3, + SYSZ_REG_V4, + SYSZ_REG_V5, + SYSZ_REG_V6, + SYSZ_REG_V7, + SYSZ_REG_V8, + SYSZ_REG_V9, + SYSZ_REG_V10, + SYSZ_REG_V11, + SYSZ_REG_V12, + SYSZ_REG_V13, + SYSZ_REG_V14, + SYSZ_REG_V15, + SYSZ_REG_V16, + SYSZ_REG_V17, + SYSZ_REG_V18, + SYSZ_REG_V19, + SYSZ_REG_V20, + SYSZ_REG_V21, + SYSZ_REG_V22, + SYSZ_REG_V23, + SYSZ_REG_V24, + SYSZ_REG_V25, + SYSZ_REG_V26, + SYSZ_REG_V27, + SYSZ_REG_V28, + SYSZ_REG_V29, + SYSZ_REG_V30, + SYSZ_REG_V31, + SYSZ_REG_F16, + SYSZ_REG_F17, + SYSZ_REG_F18, + SYSZ_REG_F19, + SYSZ_REG_F20, + SYSZ_REG_F21, + SYSZ_REG_F22, + SYSZ_REG_F23, + SYSZ_REG_F24, + SYSZ_REG_F25, + SYSZ_REG_F26, + SYSZ_REG_F27, + SYSZ_REG_F28, + SYSZ_REG_F29, + SYSZ_REG_F30, + SYSZ_REG_F31, + SYSZ_REG_F0Q, + SYSZ_REG_F4Q, + + SYSZ_REG_ENDING, +} sysz_reg; + +/// Instruction's operand referring to memory +/// This is associated with SYSZ_OP_MEM operand type above +typedef struct sysz_op_mem { + uint8_t base; ///< base register, can be safely interpreted as + ///< a value of type `sysz_reg`, but it is only + ///< one byte wide + uint8_t index; ///< index register, same conditions apply here + uint64_t length; ///< BDLAddr operand + int64_t disp; ///< displacement/offset value +} sysz_op_mem; + +/// Instruction operand +typedef struct cs_sysz_op { + sysz_op_type type; ///< operand type + union { + sysz_reg reg; ///< register value for REG operand + int64_t imm; ///< immediate value for IMM operand + sysz_op_mem mem; ///< base/disp value for MEM operand + }; +} cs_sysz_op; + +// Instruction structure +typedef struct cs_sysz { + sysz_cc cc; ///< Code condition + /// Number of operands of this instruction, + /// or 0 when instruction has no operand. + uint8_t op_count; + cs_sysz_op operands[6]; ///< operands for this instruction. +} cs_sysz; + +/// SystemZ instruction +typedef enum sysz_insn { + SYSZ_INS_INVALID = 0, + + SYSZ_INS_A, + SYSZ_INS_ADB, + SYSZ_INS_ADBR, + SYSZ_INS_AEB, + SYSZ_INS_AEBR, + SYSZ_INS_AFI, + SYSZ_INS_AG, + SYSZ_INS_AGF, + SYSZ_INS_AGFI, + SYSZ_INS_AGFR, + SYSZ_INS_AGHI, + SYSZ_INS_AGHIK, + SYSZ_INS_AGR, + SYSZ_INS_AGRK, + SYSZ_INS_AGSI, + SYSZ_INS_AH, + SYSZ_INS_AHI, + SYSZ_INS_AHIK, + SYSZ_INS_AHY, + SYSZ_INS_AIH, + SYSZ_INS_AL, + SYSZ_INS_ALC, + SYSZ_INS_ALCG, + SYSZ_INS_ALCGR, + SYSZ_INS_ALCR, + SYSZ_INS_ALFI, + SYSZ_INS_ALG, + SYSZ_INS_ALGF, + SYSZ_INS_ALGFI, + SYSZ_INS_ALGFR, + SYSZ_INS_ALGHSIK, + SYSZ_INS_ALGR, + SYSZ_INS_ALGRK, + SYSZ_INS_ALHSIK, + SYSZ_INS_ALR, + SYSZ_INS_ALRK, + SYSZ_INS_ALY, + SYSZ_INS_AR, + SYSZ_INS_ARK, + SYSZ_INS_ASI, + SYSZ_INS_AXBR, + SYSZ_INS_AY, + SYSZ_INS_BCR, + SYSZ_INS_BRC, + SYSZ_INS_BRCL, + SYSZ_INS_CGIJ, + SYSZ_INS_CGRJ, + SYSZ_INS_CIJ, + SYSZ_INS_CLGIJ, + SYSZ_INS_CLGRJ, + SYSZ_INS_CLIJ, + SYSZ_INS_CLRJ, + SYSZ_INS_CRJ, + SYSZ_INS_BER, + SYSZ_INS_JE, + SYSZ_INS_JGE, + SYSZ_INS_LOCE, + SYSZ_INS_LOCGE, + SYSZ_INS_LOCGRE, + SYSZ_INS_LOCRE, + SYSZ_INS_STOCE, + SYSZ_INS_STOCGE, + SYSZ_INS_BHR, + SYSZ_INS_BHER, + SYSZ_INS_JHE, + SYSZ_INS_JGHE, + SYSZ_INS_LOCHE, + SYSZ_INS_LOCGHE, + SYSZ_INS_LOCGRHE, + SYSZ_INS_LOCRHE, + SYSZ_INS_STOCHE, + SYSZ_INS_STOCGHE, + SYSZ_INS_JH, + SYSZ_INS_JGH, + SYSZ_INS_LOCH, + SYSZ_INS_LOCGH, + SYSZ_INS_LOCGRH, + SYSZ_INS_LOCRH, + SYSZ_INS_STOCH, + SYSZ_INS_STOCGH, + SYSZ_INS_CGIJNLH, + SYSZ_INS_CGRJNLH, + SYSZ_INS_CIJNLH, + SYSZ_INS_CLGIJNLH, + SYSZ_INS_CLGRJNLH, + SYSZ_INS_CLIJNLH, + SYSZ_INS_CLRJNLH, + SYSZ_INS_CRJNLH, + SYSZ_INS_CGIJE, + SYSZ_INS_CGRJE, + SYSZ_INS_CIJE, + SYSZ_INS_CLGIJE, + SYSZ_INS_CLGRJE, + SYSZ_INS_CLIJE, + SYSZ_INS_CLRJE, + SYSZ_INS_CRJE, + SYSZ_INS_CGIJNLE, + SYSZ_INS_CGRJNLE, + SYSZ_INS_CIJNLE, + SYSZ_INS_CLGIJNLE, + SYSZ_INS_CLGRJNLE, + SYSZ_INS_CLIJNLE, + SYSZ_INS_CLRJNLE, + SYSZ_INS_CRJNLE, + SYSZ_INS_CGIJH, + SYSZ_INS_CGRJH, + SYSZ_INS_CIJH, + SYSZ_INS_CLGIJH, + SYSZ_INS_CLGRJH, + SYSZ_INS_CLIJH, + SYSZ_INS_CLRJH, + SYSZ_INS_CRJH, + SYSZ_INS_CGIJNL, + SYSZ_INS_CGRJNL, + SYSZ_INS_CIJNL, + SYSZ_INS_CLGIJNL, + SYSZ_INS_CLGRJNL, + SYSZ_INS_CLIJNL, + SYSZ_INS_CLRJNL, + SYSZ_INS_CRJNL, + SYSZ_INS_CGIJHE, + SYSZ_INS_CGRJHE, + SYSZ_INS_CIJHE, + SYSZ_INS_CLGIJHE, + SYSZ_INS_CLGRJHE, + SYSZ_INS_CLIJHE, + SYSZ_INS_CLRJHE, + SYSZ_INS_CRJHE, + SYSZ_INS_CGIJNHE, + SYSZ_INS_CGRJNHE, + SYSZ_INS_CIJNHE, + SYSZ_INS_CLGIJNHE, + SYSZ_INS_CLGRJNHE, + SYSZ_INS_CLIJNHE, + SYSZ_INS_CLRJNHE, + SYSZ_INS_CRJNHE, + SYSZ_INS_CGIJL, + SYSZ_INS_CGRJL, + SYSZ_INS_CIJL, + SYSZ_INS_CLGIJL, + SYSZ_INS_CLGRJL, + SYSZ_INS_CLIJL, + SYSZ_INS_CLRJL, + SYSZ_INS_CRJL, + SYSZ_INS_CGIJNH, + SYSZ_INS_CGRJNH, + SYSZ_INS_CIJNH, + SYSZ_INS_CLGIJNH, + SYSZ_INS_CLGRJNH, + SYSZ_INS_CLIJNH, + SYSZ_INS_CLRJNH, + SYSZ_INS_CRJNH, + SYSZ_INS_CGIJLE, + SYSZ_INS_CGRJLE, + SYSZ_INS_CIJLE, + SYSZ_INS_CLGIJLE, + SYSZ_INS_CLGRJLE, + SYSZ_INS_CLIJLE, + SYSZ_INS_CLRJLE, + SYSZ_INS_CRJLE, + SYSZ_INS_CGIJNE, + SYSZ_INS_CGRJNE, + SYSZ_INS_CIJNE, + SYSZ_INS_CLGIJNE, + SYSZ_INS_CLGRJNE, + SYSZ_INS_CLIJNE, + SYSZ_INS_CLRJNE, + SYSZ_INS_CRJNE, + SYSZ_INS_CGIJLH, + SYSZ_INS_CGRJLH, + SYSZ_INS_CIJLH, + SYSZ_INS_CLGIJLH, + SYSZ_INS_CLGRJLH, + SYSZ_INS_CLIJLH, + SYSZ_INS_CLRJLH, + SYSZ_INS_CRJLH, + SYSZ_INS_BLR, + SYSZ_INS_BLER, + SYSZ_INS_JLE, + SYSZ_INS_JGLE, + SYSZ_INS_LOCLE, + SYSZ_INS_LOCGLE, + SYSZ_INS_LOCGRLE, + SYSZ_INS_LOCRLE, + SYSZ_INS_STOCLE, + SYSZ_INS_STOCGLE, + SYSZ_INS_BLHR, + SYSZ_INS_JLH, + SYSZ_INS_JGLH, + SYSZ_INS_LOCLH, + SYSZ_INS_LOCGLH, + SYSZ_INS_LOCGRLH, + SYSZ_INS_LOCRLH, + SYSZ_INS_STOCLH, + SYSZ_INS_STOCGLH, + SYSZ_INS_JL, + SYSZ_INS_JGL, + SYSZ_INS_LOCL, + SYSZ_INS_LOCGL, + SYSZ_INS_LOCGRL, + SYSZ_INS_LOCRL, + SYSZ_INS_LOC, + SYSZ_INS_LOCG, + SYSZ_INS_LOCGR, + SYSZ_INS_LOCR, + SYSZ_INS_STOCL, + SYSZ_INS_STOCGL, + SYSZ_INS_BNER, + SYSZ_INS_JNE, + SYSZ_INS_JGNE, + SYSZ_INS_LOCNE, + SYSZ_INS_LOCGNE, + SYSZ_INS_LOCGRNE, + SYSZ_INS_LOCRNE, + SYSZ_INS_STOCNE, + SYSZ_INS_STOCGNE, + SYSZ_INS_BNHR, + SYSZ_INS_BNHER, + SYSZ_INS_JNHE, + SYSZ_INS_JGNHE, + SYSZ_INS_LOCNHE, + SYSZ_INS_LOCGNHE, + SYSZ_INS_LOCGRNHE, + SYSZ_INS_LOCRNHE, + SYSZ_INS_STOCNHE, + SYSZ_INS_STOCGNHE, + SYSZ_INS_JNH, + SYSZ_INS_JGNH, + SYSZ_INS_LOCNH, + SYSZ_INS_LOCGNH, + SYSZ_INS_LOCGRNH, + SYSZ_INS_LOCRNH, + SYSZ_INS_STOCNH, + SYSZ_INS_STOCGNH, + SYSZ_INS_BNLR, + SYSZ_INS_BNLER, + SYSZ_INS_JNLE, + SYSZ_INS_JGNLE, + SYSZ_INS_LOCNLE, + SYSZ_INS_LOCGNLE, + SYSZ_INS_LOCGRNLE, + SYSZ_INS_LOCRNLE, + SYSZ_INS_STOCNLE, + SYSZ_INS_STOCGNLE, + SYSZ_INS_BNLHR, + SYSZ_INS_JNLH, + SYSZ_INS_JGNLH, + SYSZ_INS_LOCNLH, + SYSZ_INS_LOCGNLH, + SYSZ_INS_LOCGRNLH, + SYSZ_INS_LOCRNLH, + SYSZ_INS_STOCNLH, + SYSZ_INS_STOCGNLH, + SYSZ_INS_JNL, + SYSZ_INS_JGNL, + SYSZ_INS_LOCNL, + SYSZ_INS_LOCGNL, + SYSZ_INS_LOCGRNL, + SYSZ_INS_LOCRNL, + SYSZ_INS_STOCNL, + SYSZ_INS_STOCGNL, + SYSZ_INS_BNOR, + SYSZ_INS_JNO, + SYSZ_INS_JGNO, + SYSZ_INS_LOCNO, + SYSZ_INS_LOCGNO, + SYSZ_INS_LOCGRNO, + SYSZ_INS_LOCRNO, + SYSZ_INS_STOCNO, + SYSZ_INS_STOCGNO, + SYSZ_INS_BOR, + SYSZ_INS_JO, + SYSZ_INS_JGO, + SYSZ_INS_LOCO, + SYSZ_INS_LOCGO, + SYSZ_INS_LOCGRO, + SYSZ_INS_LOCRO, + SYSZ_INS_STOCO, + SYSZ_INS_STOCGO, + SYSZ_INS_STOC, + SYSZ_INS_STOCG, + SYSZ_INS_BASR, + SYSZ_INS_BR, + SYSZ_INS_BRAS, + SYSZ_INS_BRASL, + SYSZ_INS_J, + SYSZ_INS_JG, + SYSZ_INS_BRCT, + SYSZ_INS_BRCTG, + SYSZ_INS_C, + SYSZ_INS_CDB, + SYSZ_INS_CDBR, + SYSZ_INS_CDFBR, + SYSZ_INS_CDGBR, + SYSZ_INS_CDLFBR, + SYSZ_INS_CDLGBR, + SYSZ_INS_CEB, + SYSZ_INS_CEBR, + SYSZ_INS_CEFBR, + SYSZ_INS_CEGBR, + SYSZ_INS_CELFBR, + SYSZ_INS_CELGBR, + SYSZ_INS_CFDBR, + SYSZ_INS_CFEBR, + SYSZ_INS_CFI, + SYSZ_INS_CFXBR, + SYSZ_INS_CG, + SYSZ_INS_CGDBR, + SYSZ_INS_CGEBR, + SYSZ_INS_CGF, + SYSZ_INS_CGFI, + SYSZ_INS_CGFR, + SYSZ_INS_CGFRL, + SYSZ_INS_CGH, + SYSZ_INS_CGHI, + SYSZ_INS_CGHRL, + SYSZ_INS_CGHSI, + SYSZ_INS_CGR, + SYSZ_INS_CGRL, + SYSZ_INS_CGXBR, + SYSZ_INS_CH, + SYSZ_INS_CHF, + SYSZ_INS_CHHSI, + SYSZ_INS_CHI, + SYSZ_INS_CHRL, + SYSZ_INS_CHSI, + SYSZ_INS_CHY, + SYSZ_INS_CIH, + SYSZ_INS_CL, + SYSZ_INS_CLC, + SYSZ_INS_CLFDBR, + SYSZ_INS_CLFEBR, + SYSZ_INS_CLFHSI, + SYSZ_INS_CLFI, + SYSZ_INS_CLFXBR, + SYSZ_INS_CLG, + SYSZ_INS_CLGDBR, + SYSZ_INS_CLGEBR, + SYSZ_INS_CLGF, + SYSZ_INS_CLGFI, + SYSZ_INS_CLGFR, + SYSZ_INS_CLGFRL, + SYSZ_INS_CLGHRL, + SYSZ_INS_CLGHSI, + SYSZ_INS_CLGR, + SYSZ_INS_CLGRL, + SYSZ_INS_CLGXBR, + SYSZ_INS_CLHF, + SYSZ_INS_CLHHSI, + SYSZ_INS_CLHRL, + SYSZ_INS_CLI, + SYSZ_INS_CLIH, + SYSZ_INS_CLIY, + SYSZ_INS_CLR, + SYSZ_INS_CLRL, + SYSZ_INS_CLST, + SYSZ_INS_CLY, + SYSZ_INS_CPSDR, + SYSZ_INS_CR, + SYSZ_INS_CRL, + SYSZ_INS_CS, + SYSZ_INS_CSG, + SYSZ_INS_CSY, + SYSZ_INS_CXBR, + SYSZ_INS_CXFBR, + SYSZ_INS_CXGBR, + SYSZ_INS_CXLFBR, + SYSZ_INS_CXLGBR, + SYSZ_INS_CY, + SYSZ_INS_DDB, + SYSZ_INS_DDBR, + SYSZ_INS_DEB, + SYSZ_INS_DEBR, + SYSZ_INS_DL, + SYSZ_INS_DLG, + SYSZ_INS_DLGR, + SYSZ_INS_DLR, + SYSZ_INS_DSG, + SYSZ_INS_DSGF, + SYSZ_INS_DSGFR, + SYSZ_INS_DSGR, + SYSZ_INS_DXBR, + SYSZ_INS_EAR, + SYSZ_INS_FIDBR, + SYSZ_INS_FIDBRA, + SYSZ_INS_FIEBR, + SYSZ_INS_FIEBRA, + SYSZ_INS_FIXBR, + SYSZ_INS_FIXBRA, + SYSZ_INS_FLOGR, + SYSZ_INS_IC, + SYSZ_INS_ICY, + SYSZ_INS_IIHF, + SYSZ_INS_IIHH, + SYSZ_INS_IIHL, + SYSZ_INS_IILF, + SYSZ_INS_IILH, + SYSZ_INS_IILL, + SYSZ_INS_IPM, + SYSZ_INS_L, + SYSZ_INS_LA, + SYSZ_INS_LAA, + SYSZ_INS_LAAG, + SYSZ_INS_LAAL, + SYSZ_INS_LAALG, + SYSZ_INS_LAN, + SYSZ_INS_LANG, + SYSZ_INS_LAO, + SYSZ_INS_LAOG, + SYSZ_INS_LARL, + SYSZ_INS_LAX, + SYSZ_INS_LAXG, + SYSZ_INS_LAY, + SYSZ_INS_LB, + SYSZ_INS_LBH, + SYSZ_INS_LBR, + SYSZ_INS_LCDBR, + SYSZ_INS_LCEBR, + SYSZ_INS_LCGFR, + SYSZ_INS_LCGR, + SYSZ_INS_LCR, + SYSZ_INS_LCXBR, + SYSZ_INS_LD, + SYSZ_INS_LDEB, + SYSZ_INS_LDEBR, + SYSZ_INS_LDGR, + SYSZ_INS_LDR, + SYSZ_INS_LDXBR, + SYSZ_INS_LDXBRA, + SYSZ_INS_LDY, + SYSZ_INS_LE, + SYSZ_INS_LEDBR, + SYSZ_INS_LEDBRA, + SYSZ_INS_LER, + SYSZ_INS_LEXBR, + SYSZ_INS_LEXBRA, + SYSZ_INS_LEY, + SYSZ_INS_LFH, + SYSZ_INS_LG, + SYSZ_INS_LGB, + SYSZ_INS_LGBR, + SYSZ_INS_LGDR, + SYSZ_INS_LGF, + SYSZ_INS_LGFI, + SYSZ_INS_LGFR, + SYSZ_INS_LGFRL, + SYSZ_INS_LGH, + SYSZ_INS_LGHI, + SYSZ_INS_LGHR, + SYSZ_INS_LGHRL, + SYSZ_INS_LGR, + SYSZ_INS_LGRL, + SYSZ_INS_LH, + SYSZ_INS_LHH, + SYSZ_INS_LHI, + SYSZ_INS_LHR, + SYSZ_INS_LHRL, + SYSZ_INS_LHY, + SYSZ_INS_LLC, + SYSZ_INS_LLCH, + SYSZ_INS_LLCR, + SYSZ_INS_LLGC, + SYSZ_INS_LLGCR, + SYSZ_INS_LLGF, + SYSZ_INS_LLGFR, + SYSZ_INS_LLGFRL, + SYSZ_INS_LLGH, + SYSZ_INS_LLGHR, + SYSZ_INS_LLGHRL, + SYSZ_INS_LLH, + SYSZ_INS_LLHH, + SYSZ_INS_LLHR, + SYSZ_INS_LLHRL, + SYSZ_INS_LLIHF, + SYSZ_INS_LLIHH, + SYSZ_INS_LLIHL, + SYSZ_INS_LLILF, + SYSZ_INS_LLILH, + SYSZ_INS_LLILL, + SYSZ_INS_LMG, + SYSZ_INS_LNDBR, + SYSZ_INS_LNEBR, + SYSZ_INS_LNGFR, + SYSZ_INS_LNGR, + SYSZ_INS_LNR, + SYSZ_INS_LNXBR, + SYSZ_INS_LPDBR, + SYSZ_INS_LPEBR, + SYSZ_INS_LPGFR, + SYSZ_INS_LPGR, + SYSZ_INS_LPR, + SYSZ_INS_LPXBR, + SYSZ_INS_LR, + SYSZ_INS_LRL, + SYSZ_INS_LRV, + SYSZ_INS_LRVG, + SYSZ_INS_LRVGR, + SYSZ_INS_LRVR, + SYSZ_INS_LT, + SYSZ_INS_LTDBR, + SYSZ_INS_LTEBR, + SYSZ_INS_LTG, + SYSZ_INS_LTGF, + SYSZ_INS_LTGFR, + SYSZ_INS_LTGR, + SYSZ_INS_LTR, + SYSZ_INS_LTXBR, + SYSZ_INS_LXDB, + SYSZ_INS_LXDBR, + SYSZ_INS_LXEB, + SYSZ_INS_LXEBR, + SYSZ_INS_LXR, + SYSZ_INS_LY, + SYSZ_INS_LZDR, + SYSZ_INS_LZER, + SYSZ_INS_LZXR, + SYSZ_INS_MADB, + SYSZ_INS_MADBR, + SYSZ_INS_MAEB, + SYSZ_INS_MAEBR, + SYSZ_INS_MDB, + SYSZ_INS_MDBR, + SYSZ_INS_MDEB, + SYSZ_INS_MDEBR, + SYSZ_INS_MEEB, + SYSZ_INS_MEEBR, + SYSZ_INS_MGHI, + SYSZ_INS_MH, + SYSZ_INS_MHI, + SYSZ_INS_MHY, + SYSZ_INS_MLG, + SYSZ_INS_MLGR, + SYSZ_INS_MS, + SYSZ_INS_MSDB, + SYSZ_INS_MSDBR, + SYSZ_INS_MSEB, + SYSZ_INS_MSEBR, + SYSZ_INS_MSFI, + SYSZ_INS_MSG, + SYSZ_INS_MSGF, + SYSZ_INS_MSGFI, + SYSZ_INS_MSGFR, + SYSZ_INS_MSGR, + SYSZ_INS_MSR, + SYSZ_INS_MSY, + SYSZ_INS_MVC, + SYSZ_INS_MVGHI, + SYSZ_INS_MVHHI, + SYSZ_INS_MVHI, + SYSZ_INS_MVI, + SYSZ_INS_MVIY, + SYSZ_INS_MVST, + SYSZ_INS_MXBR, + SYSZ_INS_MXDB, + SYSZ_INS_MXDBR, + SYSZ_INS_N, + SYSZ_INS_NC, + SYSZ_INS_NG, + SYSZ_INS_NGR, + SYSZ_INS_NGRK, + SYSZ_INS_NI, + SYSZ_INS_NIHF, + SYSZ_INS_NIHH, + SYSZ_INS_NIHL, + SYSZ_INS_NILF, + SYSZ_INS_NILH, + SYSZ_INS_NILL, + SYSZ_INS_NIY, + SYSZ_INS_NR, + SYSZ_INS_NRK, + SYSZ_INS_NY, + SYSZ_INS_O, + SYSZ_INS_OC, + SYSZ_INS_OG, + SYSZ_INS_OGR, + SYSZ_INS_OGRK, + SYSZ_INS_OI, + SYSZ_INS_OIHF, + SYSZ_INS_OIHH, + SYSZ_INS_OIHL, + SYSZ_INS_OILF, + SYSZ_INS_OILH, + SYSZ_INS_OILL, + SYSZ_INS_OIY, + SYSZ_INS_OR, + SYSZ_INS_ORK, + SYSZ_INS_OY, + SYSZ_INS_PFD, + SYSZ_INS_PFDRL, + SYSZ_INS_RISBG, + SYSZ_INS_RISBHG, + SYSZ_INS_RISBLG, + SYSZ_INS_RLL, + SYSZ_INS_RLLG, + SYSZ_INS_RNSBG, + SYSZ_INS_ROSBG, + SYSZ_INS_RXSBG, + SYSZ_INS_S, + SYSZ_INS_SDB, + SYSZ_INS_SDBR, + SYSZ_INS_SEB, + SYSZ_INS_SEBR, + SYSZ_INS_SG, + SYSZ_INS_SGF, + SYSZ_INS_SGFR, + SYSZ_INS_SGR, + SYSZ_INS_SGRK, + SYSZ_INS_SH, + SYSZ_INS_SHY, + SYSZ_INS_SL, + SYSZ_INS_SLB, + SYSZ_INS_SLBG, + SYSZ_INS_SLBR, + SYSZ_INS_SLFI, + SYSZ_INS_SLG, + SYSZ_INS_SLBGR, + SYSZ_INS_SLGF, + SYSZ_INS_SLGFI, + SYSZ_INS_SLGFR, + SYSZ_INS_SLGR, + SYSZ_INS_SLGRK, + SYSZ_INS_SLL, + SYSZ_INS_SLLG, + SYSZ_INS_SLLK, + SYSZ_INS_SLR, + SYSZ_INS_SLRK, + SYSZ_INS_SLY, + SYSZ_INS_SQDB, + SYSZ_INS_SQDBR, + SYSZ_INS_SQEB, + SYSZ_INS_SQEBR, + SYSZ_INS_SQXBR, + SYSZ_INS_SR, + SYSZ_INS_SRA, + SYSZ_INS_SRAG, + SYSZ_INS_SRAK, + SYSZ_INS_SRK, + SYSZ_INS_SRL, + SYSZ_INS_SRLG, + SYSZ_INS_SRLK, + SYSZ_INS_SRST, + SYSZ_INS_ST, + SYSZ_INS_STC, + SYSZ_INS_STCH, + SYSZ_INS_STCY, + SYSZ_INS_STD, + SYSZ_INS_STDY, + SYSZ_INS_STE, + SYSZ_INS_STEY, + SYSZ_INS_STFH, + SYSZ_INS_STG, + SYSZ_INS_STGRL, + SYSZ_INS_STH, + SYSZ_INS_STHH, + SYSZ_INS_STHRL, + SYSZ_INS_STHY, + SYSZ_INS_STMG, + SYSZ_INS_STRL, + SYSZ_INS_STRV, + SYSZ_INS_STRVG, + SYSZ_INS_STY, + SYSZ_INS_SXBR, + SYSZ_INS_SY, + SYSZ_INS_TM, + SYSZ_INS_TMHH, + SYSZ_INS_TMHL, + SYSZ_INS_TMLH, + SYSZ_INS_TMLL, + SYSZ_INS_TMY, + SYSZ_INS_X, + SYSZ_INS_XC, + SYSZ_INS_XG, + SYSZ_INS_XGR, + SYSZ_INS_XGRK, + SYSZ_INS_XI, + SYSZ_INS_XIHF, + SYSZ_INS_XILF, + SYSZ_INS_XIY, + SYSZ_INS_XR, + SYSZ_INS_XRK, + SYSZ_INS_XY, + SYSZ_INS_AD, + SYSZ_INS_ADR, + SYSZ_INS_ADTR, + SYSZ_INS_ADTRA, + SYSZ_INS_AE, + SYSZ_INS_AER, + SYSZ_INS_AGH, + SYSZ_INS_AHHHR, + SYSZ_INS_AHHLR, + SYSZ_INS_ALGSI, + SYSZ_INS_ALHHHR, + SYSZ_INS_ALHHLR, + SYSZ_INS_ALSI, + SYSZ_INS_ALSIH, + SYSZ_INS_ALSIHN, + SYSZ_INS_AP, + SYSZ_INS_AU, + SYSZ_INS_AUR, + SYSZ_INS_AW, + SYSZ_INS_AWR, + SYSZ_INS_AXR, + SYSZ_INS_AXTR, + SYSZ_INS_AXTRA, + SYSZ_INS_B, + SYSZ_INS_BAKR, + SYSZ_INS_BAL, + SYSZ_INS_BALR, + SYSZ_INS_BAS, + SYSZ_INS_BASSM, + SYSZ_INS_BC, + SYSZ_INS_BCT, + SYSZ_INS_BCTG, + SYSZ_INS_BCTGR, + SYSZ_INS_BCTR, + SYSZ_INS_BE, + SYSZ_INS_BH, + SYSZ_INS_BHE, + SYSZ_INS_BI, + SYSZ_INS_BIC, + SYSZ_INS_BIE, + SYSZ_INS_BIH, + SYSZ_INS_BIHE, + SYSZ_INS_BIL, + SYSZ_INS_BILE, + SYSZ_INS_BILH, + SYSZ_INS_BIM, + SYSZ_INS_BINE, + SYSZ_INS_BINH, + SYSZ_INS_BINHE, + SYSZ_INS_BINL, + SYSZ_INS_BINLE, + SYSZ_INS_BINLH, + SYSZ_INS_BINM, + SYSZ_INS_BINO, + SYSZ_INS_BINP, + SYSZ_INS_BINZ, + SYSZ_INS_BIO, + SYSZ_INS_BIP, + SYSZ_INS_BIZ, + SYSZ_INS_BL, + SYSZ_INS_BLE, + SYSZ_INS_BLH, + SYSZ_INS_BM, + SYSZ_INS_BMR, + SYSZ_INS_BNE, + SYSZ_INS_BNH, + SYSZ_INS_BNHE, + SYSZ_INS_BNL, + SYSZ_INS_BNLE, + SYSZ_INS_BNLH, + SYSZ_INS_BNM, + SYSZ_INS_BNMR, + SYSZ_INS_BNO, + SYSZ_INS_BNP, + SYSZ_INS_BNPR, + SYSZ_INS_BNZ, + SYSZ_INS_BNZR, + SYSZ_INS_BO, + SYSZ_INS_BP, + SYSZ_INS_BPP, + SYSZ_INS_BPR, + SYSZ_INS_BPRP, + SYSZ_INS_BRCTH, + SYSZ_INS_BRXH, + SYSZ_INS_BRXHG, + SYSZ_INS_BRXLE, + SYSZ_INS_BRXLG, + SYSZ_INS_BSA, + SYSZ_INS_BSG, + SYSZ_INS_BSM, + SYSZ_INS_BXH, + SYSZ_INS_BXHG, + SYSZ_INS_BXLE, + SYSZ_INS_BXLEG, + SYSZ_INS_BZ, + SYSZ_INS_BZR, + SYSZ_INS_CD, + SYSZ_INS_CDFBRA, + SYSZ_INS_CDFR, + SYSZ_INS_CDFTR, + SYSZ_INS_CDGBRA, + SYSZ_INS_CDGR, + SYSZ_INS_CDGTR, + SYSZ_INS_CDGTRA, + SYSZ_INS_CDLFTR, + SYSZ_INS_CDLGTR, + SYSZ_INS_CDPT, + SYSZ_INS_CDR, + SYSZ_INS_CDS, + SYSZ_INS_CDSG, + SYSZ_INS_CDSTR, + SYSZ_INS_CDSY, + SYSZ_INS_CDTR, + SYSZ_INS_CDUTR, + SYSZ_INS_CDZT, + SYSZ_INS_CE, + SYSZ_INS_CEDTR, + SYSZ_INS_CEFBRA, + SYSZ_INS_CEFR, + SYSZ_INS_CEGBRA, + SYSZ_INS_CEGR, + SYSZ_INS_CER, + SYSZ_INS_CEXTR, + SYSZ_INS_CFC, + SYSZ_INS_CFDBRA, + SYSZ_INS_CFDR, + SYSZ_INS_CFDTR, + SYSZ_INS_CFEBRA, + SYSZ_INS_CFER, + SYSZ_INS_CFXBRA, + SYSZ_INS_CFXR, + SYSZ_INS_CFXTR, + SYSZ_INS_CGDBRA, + SYSZ_INS_CGDR, + SYSZ_INS_CGDTR, + SYSZ_INS_CGDTRA, + SYSZ_INS_CGEBRA, + SYSZ_INS_CGER, + SYSZ_INS_CGIB, + SYSZ_INS_CGIBE, + SYSZ_INS_CGIBH, + SYSZ_INS_CGIBHE, + SYSZ_INS_CGIBL, + SYSZ_INS_CGIBLE, + SYSZ_INS_CGIBLH, + SYSZ_INS_CGIBNE, + SYSZ_INS_CGIBNH, + SYSZ_INS_CGIBNHE, + SYSZ_INS_CGIBNL, + SYSZ_INS_CGIBNLE, + SYSZ_INS_CGIBNLH, + SYSZ_INS_CGIT, + SYSZ_INS_CGITE, + SYSZ_INS_CGITH, + SYSZ_INS_CGITHE, + SYSZ_INS_CGITL, + SYSZ_INS_CGITLE, + SYSZ_INS_CGITLH, + SYSZ_INS_CGITNE, + SYSZ_INS_CGITNH, + SYSZ_INS_CGITNHE, + SYSZ_INS_CGITNL, + SYSZ_INS_CGITNLE, + SYSZ_INS_CGITNLH, + SYSZ_INS_CGRB, + SYSZ_INS_CGRBE, + SYSZ_INS_CGRBH, + SYSZ_INS_CGRBHE, + SYSZ_INS_CGRBL, + SYSZ_INS_CGRBLE, + SYSZ_INS_CGRBLH, + SYSZ_INS_CGRBNE, + SYSZ_INS_CGRBNH, + SYSZ_INS_CGRBNHE, + SYSZ_INS_CGRBNL, + SYSZ_INS_CGRBNLE, + SYSZ_INS_CGRBNLH, + SYSZ_INS_CGRT, + SYSZ_INS_CGRTE, + SYSZ_INS_CGRTH, + SYSZ_INS_CGRTHE, + SYSZ_INS_CGRTL, + SYSZ_INS_CGRTLE, + SYSZ_INS_CGRTLH, + SYSZ_INS_CGRTNE, + SYSZ_INS_CGRTNH, + SYSZ_INS_CGRTNHE, + SYSZ_INS_CGRTNL, + SYSZ_INS_CGRTNLE, + SYSZ_INS_CGRTNLH, + SYSZ_INS_CGXBRA, + SYSZ_INS_CGXR, + SYSZ_INS_CGXTR, + SYSZ_INS_CGXTRA, + SYSZ_INS_CHHR, + SYSZ_INS_CHLR, + SYSZ_INS_CIB, + SYSZ_INS_CIBE, + SYSZ_INS_CIBH, + SYSZ_INS_CIBHE, + SYSZ_INS_CIBL, + SYSZ_INS_CIBLE, + SYSZ_INS_CIBLH, + SYSZ_INS_CIBNE, + SYSZ_INS_CIBNH, + SYSZ_INS_CIBNHE, + SYSZ_INS_CIBNL, + SYSZ_INS_CIBNLE, + SYSZ_INS_CIBNLH, + SYSZ_INS_CIT, + SYSZ_INS_CITE, + SYSZ_INS_CITH, + SYSZ_INS_CITHE, + SYSZ_INS_CITL, + SYSZ_INS_CITLE, + SYSZ_INS_CITLH, + SYSZ_INS_CITNE, + SYSZ_INS_CITNH, + SYSZ_INS_CITNHE, + SYSZ_INS_CITNL, + SYSZ_INS_CITNLE, + SYSZ_INS_CITNLH, + SYSZ_INS_CKSM, + SYSZ_INS_CLCL, + SYSZ_INS_CLCLE, + SYSZ_INS_CLCLU, + SYSZ_INS_CLFDTR, + SYSZ_INS_CLFIT, + SYSZ_INS_CLFITE, + SYSZ_INS_CLFITH, + SYSZ_INS_CLFITHE, + SYSZ_INS_CLFITL, + SYSZ_INS_CLFITLE, + SYSZ_INS_CLFITLH, + SYSZ_INS_CLFITNE, + SYSZ_INS_CLFITNH, + SYSZ_INS_CLFITNHE, + SYSZ_INS_CLFITNL, + SYSZ_INS_CLFITNLE, + SYSZ_INS_CLFITNLH, + SYSZ_INS_CLFXTR, + SYSZ_INS_CLGDTR, + SYSZ_INS_CLGIB, + SYSZ_INS_CLGIBE, + SYSZ_INS_CLGIBH, + SYSZ_INS_CLGIBHE, + SYSZ_INS_CLGIBL, + SYSZ_INS_CLGIBLE, + SYSZ_INS_CLGIBLH, + SYSZ_INS_CLGIBNE, + SYSZ_INS_CLGIBNH, + SYSZ_INS_CLGIBNHE, + SYSZ_INS_CLGIBNL, + SYSZ_INS_CLGIBNLE, + SYSZ_INS_CLGIBNLH, + SYSZ_INS_CLGIT, + SYSZ_INS_CLGITE, + SYSZ_INS_CLGITH, + SYSZ_INS_CLGITHE, + SYSZ_INS_CLGITL, + SYSZ_INS_CLGITLE, + SYSZ_INS_CLGITLH, + SYSZ_INS_CLGITNE, + SYSZ_INS_CLGITNH, + SYSZ_INS_CLGITNHE, + SYSZ_INS_CLGITNL, + SYSZ_INS_CLGITNLE, + SYSZ_INS_CLGITNLH, + SYSZ_INS_CLGRB, + SYSZ_INS_CLGRBE, + SYSZ_INS_CLGRBH, + SYSZ_INS_CLGRBHE, + SYSZ_INS_CLGRBL, + SYSZ_INS_CLGRBLE, + SYSZ_INS_CLGRBLH, + SYSZ_INS_CLGRBNE, + SYSZ_INS_CLGRBNH, + SYSZ_INS_CLGRBNHE, + SYSZ_INS_CLGRBNL, + SYSZ_INS_CLGRBNLE, + SYSZ_INS_CLGRBNLH, + SYSZ_INS_CLGRT, + SYSZ_INS_CLGRTE, + SYSZ_INS_CLGRTH, + SYSZ_INS_CLGRTHE, + SYSZ_INS_CLGRTL, + SYSZ_INS_CLGRTLE, + SYSZ_INS_CLGRTLH, + SYSZ_INS_CLGRTNE, + SYSZ_INS_CLGRTNH, + SYSZ_INS_CLGRTNHE, + SYSZ_INS_CLGRTNL, + SYSZ_INS_CLGRTNLE, + SYSZ_INS_CLGRTNLH, + SYSZ_INS_CLGT, + SYSZ_INS_CLGTE, + SYSZ_INS_CLGTH, + SYSZ_INS_CLGTHE, + SYSZ_INS_CLGTL, + SYSZ_INS_CLGTLE, + SYSZ_INS_CLGTLH, + SYSZ_INS_CLGTNE, + SYSZ_INS_CLGTNH, + SYSZ_INS_CLGTNHE, + SYSZ_INS_CLGTNL, + SYSZ_INS_CLGTNLE, + SYSZ_INS_CLGTNLH, + SYSZ_INS_CLGXTR, + SYSZ_INS_CLHHR, + SYSZ_INS_CLHLR, + SYSZ_INS_CLIB, + SYSZ_INS_CLIBE, + SYSZ_INS_CLIBH, + SYSZ_INS_CLIBHE, + SYSZ_INS_CLIBL, + SYSZ_INS_CLIBLE, + SYSZ_INS_CLIBLH, + SYSZ_INS_CLIBNE, + SYSZ_INS_CLIBNH, + SYSZ_INS_CLIBNHE, + SYSZ_INS_CLIBNL, + SYSZ_INS_CLIBNLE, + SYSZ_INS_CLIBNLH, + SYSZ_INS_CLM, + SYSZ_INS_CLMH, + SYSZ_INS_CLMY, + SYSZ_INS_CLRB, + SYSZ_INS_CLRBE, + SYSZ_INS_CLRBH, + SYSZ_INS_CLRBHE, + SYSZ_INS_CLRBL, + SYSZ_INS_CLRBLE, + SYSZ_INS_CLRBLH, + SYSZ_INS_CLRBNE, + SYSZ_INS_CLRBNH, + SYSZ_INS_CLRBNHE, + SYSZ_INS_CLRBNL, + SYSZ_INS_CLRBNLE, + SYSZ_INS_CLRBNLH, + SYSZ_INS_CLRT, + SYSZ_INS_CLRTE, + SYSZ_INS_CLRTH, + SYSZ_INS_CLRTHE, + SYSZ_INS_CLRTL, + SYSZ_INS_CLRTLE, + SYSZ_INS_CLRTLH, + SYSZ_INS_CLRTNE, + SYSZ_INS_CLRTNH, + SYSZ_INS_CLRTNHE, + SYSZ_INS_CLRTNL, + SYSZ_INS_CLRTNLE, + SYSZ_INS_CLRTNLH, + SYSZ_INS_CLT, + SYSZ_INS_CLTE, + SYSZ_INS_CLTH, + SYSZ_INS_CLTHE, + SYSZ_INS_CLTL, + SYSZ_INS_CLTLE, + SYSZ_INS_CLTLH, + SYSZ_INS_CLTNE, + SYSZ_INS_CLTNH, + SYSZ_INS_CLTNHE, + SYSZ_INS_CLTNL, + SYSZ_INS_CLTNLE, + SYSZ_INS_CLTNLH, + SYSZ_INS_CMPSC, + SYSZ_INS_CP, + SYSZ_INS_CPDT, + SYSZ_INS_CPXT, + SYSZ_INS_CPYA, + SYSZ_INS_CRB, + SYSZ_INS_CRBE, + SYSZ_INS_CRBH, + SYSZ_INS_CRBHE, + SYSZ_INS_CRBL, + SYSZ_INS_CRBLE, + SYSZ_INS_CRBLH, + SYSZ_INS_CRBNE, + SYSZ_INS_CRBNH, + SYSZ_INS_CRBNHE, + SYSZ_INS_CRBNL, + SYSZ_INS_CRBNLE, + SYSZ_INS_CRBNLH, + SYSZ_INS_CRDTE, + SYSZ_INS_CRT, + SYSZ_INS_CRTE, + SYSZ_INS_CRTH, + SYSZ_INS_CRTHE, + SYSZ_INS_CRTL, + SYSZ_INS_CRTLE, + SYSZ_INS_CRTLH, + SYSZ_INS_CRTNE, + SYSZ_INS_CRTNH, + SYSZ_INS_CRTNHE, + SYSZ_INS_CRTNL, + SYSZ_INS_CRTNLE, + SYSZ_INS_CRTNLH, + SYSZ_INS_CSCH, + SYSZ_INS_CSDTR, + SYSZ_INS_CSP, + SYSZ_INS_CSPG, + SYSZ_INS_CSST, + SYSZ_INS_CSXTR, + SYSZ_INS_CU12, + SYSZ_INS_CU14, + SYSZ_INS_CU21, + SYSZ_INS_CU24, + SYSZ_INS_CU41, + SYSZ_INS_CU42, + SYSZ_INS_CUDTR, + SYSZ_INS_CUSE, + SYSZ_INS_CUTFU, + SYSZ_INS_CUUTF, + SYSZ_INS_CUXTR, + SYSZ_INS_CVB, + SYSZ_INS_CVBG, + SYSZ_INS_CVBY, + SYSZ_INS_CVD, + SYSZ_INS_CVDG, + SYSZ_INS_CVDY, + SYSZ_INS_CXFBRA, + SYSZ_INS_CXFR, + SYSZ_INS_CXFTR, + SYSZ_INS_CXGBRA, + SYSZ_INS_CXGR, + SYSZ_INS_CXGTR, + SYSZ_INS_CXGTRA, + SYSZ_INS_CXLFTR, + SYSZ_INS_CXLGTR, + SYSZ_INS_CXPT, + SYSZ_INS_CXR, + SYSZ_INS_CXSTR, + SYSZ_INS_CXTR, + SYSZ_INS_CXUTR, + SYSZ_INS_CXZT, + SYSZ_INS_CZDT, + SYSZ_INS_CZXT, + SYSZ_INS_D, + SYSZ_INS_DD, + SYSZ_INS_DDR, + SYSZ_INS_DDTR, + SYSZ_INS_DDTRA, + SYSZ_INS_DE, + SYSZ_INS_DER, + SYSZ_INS_DIAG, + SYSZ_INS_DIDBR, + SYSZ_INS_DIEBR, + SYSZ_INS_DP, + SYSZ_INS_DR, + SYSZ_INS_DXR, + SYSZ_INS_DXTR, + SYSZ_INS_DXTRA, + SYSZ_INS_ECAG, + SYSZ_INS_ECCTR, + SYSZ_INS_ECPGA, + SYSZ_INS_ECTG, + SYSZ_INS_ED, + SYSZ_INS_EDMK, + SYSZ_INS_EEDTR, + SYSZ_INS_EEXTR, + SYSZ_INS_EFPC, + SYSZ_INS_EPAIR, + SYSZ_INS_EPAR, + SYSZ_INS_EPCTR, + SYSZ_INS_EPSW, + SYSZ_INS_EREG, + SYSZ_INS_EREGG, + SYSZ_INS_ESAIR, + SYSZ_INS_ESAR, + SYSZ_INS_ESDTR, + SYSZ_INS_ESEA, + SYSZ_INS_ESTA, + SYSZ_INS_ESXTR, + SYSZ_INS_ETND, + SYSZ_INS_EX, + SYSZ_INS_EXRL, + SYSZ_INS_FIDR, + SYSZ_INS_FIDTR, + SYSZ_INS_FIER, + SYSZ_INS_FIXR, + SYSZ_INS_FIXTR, + SYSZ_INS_HDR, + SYSZ_INS_HER, + SYSZ_INS_HSCH, + SYSZ_INS_IAC, + SYSZ_INS_ICM, + SYSZ_INS_ICMH, + SYSZ_INS_ICMY, + SYSZ_INS_IDTE, + SYSZ_INS_IEDTR, + SYSZ_INS_IEXTR, + SYSZ_INS_IPK, + SYSZ_INS_IPTE, + SYSZ_INS_IRBM, + SYSZ_INS_ISKE, + SYSZ_INS_IVSK, + SYSZ_INS_JGM, + SYSZ_INS_JGNM, + SYSZ_INS_JGNP, + SYSZ_INS_JGNZ, + SYSZ_INS_JGP, + SYSZ_INS_JGZ, + SYSZ_INS_JM, + SYSZ_INS_JNM, + SYSZ_INS_JNP, + SYSZ_INS_JNZ, + SYSZ_INS_JP, + SYSZ_INS_JZ, + SYSZ_INS_KDB, + SYSZ_INS_KDBR, + SYSZ_INS_KDTR, + SYSZ_INS_KEB, + SYSZ_INS_KEBR, + SYSZ_INS_KIMD, + SYSZ_INS_KLMD, + SYSZ_INS_KM, + SYSZ_INS_KMA, + SYSZ_INS_KMAC, + SYSZ_INS_KMC, + SYSZ_INS_KMCTR, + SYSZ_INS_KMF, + SYSZ_INS_KMO, + SYSZ_INS_KXBR, + SYSZ_INS_KXTR, + SYSZ_INS_LAE, + SYSZ_INS_LAEY, + SYSZ_INS_LAM, + SYSZ_INS_LAMY, + SYSZ_INS_LASP, + SYSZ_INS_LAT, + SYSZ_INS_LCBB, + SYSZ_INS_LCCTL, + SYSZ_INS_LCDFR, + SYSZ_INS_LCDR, + SYSZ_INS_LCER, + SYSZ_INS_LCTL, + SYSZ_INS_LCTLG, + SYSZ_INS_LCXR, + SYSZ_INS_LDE, + SYSZ_INS_LDER, + SYSZ_INS_LDETR, + SYSZ_INS_LDXR, + SYSZ_INS_LDXTR, + SYSZ_INS_LEDR, + SYSZ_INS_LEDTR, + SYSZ_INS_LEXR, + SYSZ_INS_LFAS, + SYSZ_INS_LFHAT, + SYSZ_INS_LFPC, + SYSZ_INS_LGAT, + SYSZ_INS_LGG, + SYSZ_INS_LGSC, + SYSZ_INS_LLGFAT, + SYSZ_INS_LLGFSG, + SYSZ_INS_LLGT, + SYSZ_INS_LLGTAT, + SYSZ_INS_LLGTR, + SYSZ_INS_LLZRGF, + SYSZ_INS_LM, + SYSZ_INS_LMD, + SYSZ_INS_LMH, + SYSZ_INS_LMY, + SYSZ_INS_LNDFR, + SYSZ_INS_LNDR, + SYSZ_INS_LNER, + SYSZ_INS_LNXR, + SYSZ_INS_LOCFH, + SYSZ_INS_LOCFHE, + SYSZ_INS_LOCFHH, + SYSZ_INS_LOCFHHE, + SYSZ_INS_LOCFHL, + SYSZ_INS_LOCFHLE, + SYSZ_INS_LOCFHLH, + SYSZ_INS_LOCFHM, + SYSZ_INS_LOCFHNE, + SYSZ_INS_LOCFHNH, + SYSZ_INS_LOCFHNHE, + SYSZ_INS_LOCFHNL, + SYSZ_INS_LOCFHNLE, + SYSZ_INS_LOCFHNLH, + SYSZ_INS_LOCFHNM, + SYSZ_INS_LOCFHNO, + SYSZ_INS_LOCFHNP, + SYSZ_INS_LOCFHNZ, + SYSZ_INS_LOCFHO, + SYSZ_INS_LOCFHP, + SYSZ_INS_LOCFHR, + SYSZ_INS_LOCFHRE, + SYSZ_INS_LOCFHRH, + SYSZ_INS_LOCFHRHE, + SYSZ_INS_LOCFHRL, + SYSZ_INS_LOCFHRLE, + SYSZ_INS_LOCFHRLH, + SYSZ_INS_LOCFHRM, + SYSZ_INS_LOCFHRNE, + SYSZ_INS_LOCFHRNH, + SYSZ_INS_LOCFHRNHE, + SYSZ_INS_LOCFHRNL, + SYSZ_INS_LOCFHRNLE, + SYSZ_INS_LOCFHRNLH, + SYSZ_INS_LOCFHRNM, + SYSZ_INS_LOCFHRNO, + SYSZ_INS_LOCFHRNP, + SYSZ_INS_LOCFHRNZ, + SYSZ_INS_LOCFHRO, + SYSZ_INS_LOCFHRP, + SYSZ_INS_LOCFHRZ, + SYSZ_INS_LOCFHZ, + SYSZ_INS_LOCGHI, + SYSZ_INS_LOCGHIE, + SYSZ_INS_LOCGHIH, + SYSZ_INS_LOCGHIHE, + SYSZ_INS_LOCGHIL, + SYSZ_INS_LOCGHILE, + SYSZ_INS_LOCGHILH, + SYSZ_INS_LOCGHIM, + SYSZ_INS_LOCGHINE, + SYSZ_INS_LOCGHINH, + SYSZ_INS_LOCGHINHE, + SYSZ_INS_LOCGHINL, + SYSZ_INS_LOCGHINLE, + SYSZ_INS_LOCGHINLH, + SYSZ_INS_LOCGHINM, + SYSZ_INS_LOCGHINO, + SYSZ_INS_LOCGHINP, + SYSZ_INS_LOCGHINZ, + SYSZ_INS_LOCGHIO, + SYSZ_INS_LOCGHIP, + SYSZ_INS_LOCGHIZ, + SYSZ_INS_LOCGM, + SYSZ_INS_LOCGNM, + SYSZ_INS_LOCGNP, + SYSZ_INS_LOCGNZ, + SYSZ_INS_LOCGP, + SYSZ_INS_LOCGRM, + SYSZ_INS_LOCGRNM, + SYSZ_INS_LOCGRNP, + SYSZ_INS_LOCGRNZ, + SYSZ_INS_LOCGRP, + SYSZ_INS_LOCGRZ, + SYSZ_INS_LOCGZ, + SYSZ_INS_LOCHHI, + SYSZ_INS_LOCHHIE, + SYSZ_INS_LOCHHIH, + SYSZ_INS_LOCHHIHE, + SYSZ_INS_LOCHHIL, + SYSZ_INS_LOCHHILE, + SYSZ_INS_LOCHHILH, + SYSZ_INS_LOCHHIM, + SYSZ_INS_LOCHHINE, + SYSZ_INS_LOCHHINH, + SYSZ_INS_LOCHHINHE, + SYSZ_INS_LOCHHINL, + SYSZ_INS_LOCHHINLE, + SYSZ_INS_LOCHHINLH, + SYSZ_INS_LOCHHINM, + SYSZ_INS_LOCHHINO, + SYSZ_INS_LOCHHINP, + SYSZ_INS_LOCHHINZ, + SYSZ_INS_LOCHHIO, + SYSZ_INS_LOCHHIP, + SYSZ_INS_LOCHHIZ, + SYSZ_INS_LOCHI, + SYSZ_INS_LOCHIE, + SYSZ_INS_LOCHIH, + SYSZ_INS_LOCHIHE, + SYSZ_INS_LOCHIL, + SYSZ_INS_LOCHILE, + SYSZ_INS_LOCHILH, + SYSZ_INS_LOCHIM, + SYSZ_INS_LOCHINE, + SYSZ_INS_LOCHINH, + SYSZ_INS_LOCHINHE, + SYSZ_INS_LOCHINL, + SYSZ_INS_LOCHINLE, + SYSZ_INS_LOCHINLH, + SYSZ_INS_LOCHINM, + SYSZ_INS_LOCHINO, + SYSZ_INS_LOCHINP, + SYSZ_INS_LOCHINZ, + SYSZ_INS_LOCHIO, + SYSZ_INS_LOCHIP, + SYSZ_INS_LOCHIZ, + SYSZ_INS_LOCM, + SYSZ_INS_LOCNM, + SYSZ_INS_LOCNP, + SYSZ_INS_LOCNZ, + SYSZ_INS_LOCP, + SYSZ_INS_LOCRM, + SYSZ_INS_LOCRNM, + SYSZ_INS_LOCRNP, + SYSZ_INS_LOCRNZ, + SYSZ_INS_LOCRP, + SYSZ_INS_LOCRZ, + SYSZ_INS_LOCZ, + SYSZ_INS_LPCTL, + SYSZ_INS_LPD, + SYSZ_INS_LPDFR, + SYSZ_INS_LPDG, + SYSZ_INS_LPDR, + SYSZ_INS_LPER, + SYSZ_INS_LPP, + SYSZ_INS_LPQ, + SYSZ_INS_LPSW, + SYSZ_INS_LPSWE, + SYSZ_INS_LPTEA, + SYSZ_INS_LPXR, + SYSZ_INS_LRA, + SYSZ_INS_LRAG, + SYSZ_INS_LRAY, + SYSZ_INS_LRDR, + SYSZ_INS_LRER, + SYSZ_INS_LRVH, + SYSZ_INS_LSCTL, + SYSZ_INS_LTDR, + SYSZ_INS_LTDTR, + SYSZ_INS_LTER, + SYSZ_INS_LTXR, + SYSZ_INS_LTXTR, + SYSZ_INS_LURA, + SYSZ_INS_LURAG, + SYSZ_INS_LXD, + SYSZ_INS_LXDR, + SYSZ_INS_LXDTR, + SYSZ_INS_LXE, + SYSZ_INS_LXER, + SYSZ_INS_LZRF, + SYSZ_INS_LZRG, + SYSZ_INS_M, + SYSZ_INS_MAD, + SYSZ_INS_MADR, + SYSZ_INS_MAE, + SYSZ_INS_MAER, + SYSZ_INS_MAY, + SYSZ_INS_MAYH, + SYSZ_INS_MAYHR, + SYSZ_INS_MAYL, + SYSZ_INS_MAYLR, + SYSZ_INS_MAYR, + SYSZ_INS_MC, + SYSZ_INS_MD, + SYSZ_INS_MDE, + SYSZ_INS_MDER, + SYSZ_INS_MDR, + SYSZ_INS_MDTR, + SYSZ_INS_MDTRA, + SYSZ_INS_ME, + SYSZ_INS_MEE, + SYSZ_INS_MEER, + SYSZ_INS_MER, + SYSZ_INS_MFY, + SYSZ_INS_MG, + SYSZ_INS_MGH, + SYSZ_INS_MGRK, + SYSZ_INS_ML, + SYSZ_INS_MLR, + SYSZ_INS_MP, + SYSZ_INS_MR, + SYSZ_INS_MSC, + SYSZ_INS_MSCH, + SYSZ_INS_MSD, + SYSZ_INS_MSDR, + SYSZ_INS_MSE, + SYSZ_INS_MSER, + SYSZ_INS_MSGC, + SYSZ_INS_MSGRKC, + SYSZ_INS_MSRKC, + SYSZ_INS_MSTA, + SYSZ_INS_MVCDK, + SYSZ_INS_MVCIN, + SYSZ_INS_MVCK, + SYSZ_INS_MVCL, + SYSZ_INS_MVCLE, + SYSZ_INS_MVCLU, + SYSZ_INS_MVCOS, + SYSZ_INS_MVCP, + SYSZ_INS_MVCS, + SYSZ_INS_MVCSK, + SYSZ_INS_MVN, + SYSZ_INS_MVO, + SYSZ_INS_MVPG, + SYSZ_INS_MVZ, + SYSZ_INS_MXD, + SYSZ_INS_MXDR, + SYSZ_INS_MXR, + SYSZ_INS_MXTR, + SYSZ_INS_MXTRA, + SYSZ_INS_MY, + SYSZ_INS_MYH, + SYSZ_INS_MYHR, + SYSZ_INS_MYL, + SYSZ_INS_MYLR, + SYSZ_INS_MYR, + SYSZ_INS_NIAI, + SYSZ_INS_NTSTG, + SYSZ_INS_PACK, + SYSZ_INS_PALB, + SYSZ_INS_PC, + SYSZ_INS_PCC, + SYSZ_INS_PCKMO, + SYSZ_INS_PFMF, + SYSZ_INS_PFPO, + SYSZ_INS_PGIN, + SYSZ_INS_PGOUT, + SYSZ_INS_PKA, + SYSZ_INS_PKU, + SYSZ_INS_PLO, + SYSZ_INS_POPCNT, + SYSZ_INS_PPA, + SYSZ_INS_PPNO, + SYSZ_INS_PR, + SYSZ_INS_PRNO, + SYSZ_INS_PT, + SYSZ_INS_PTF, + SYSZ_INS_PTFF, + SYSZ_INS_PTI, + SYSZ_INS_PTLB, + SYSZ_INS_QADTR, + SYSZ_INS_QAXTR, + SYSZ_INS_QCTRI, + SYSZ_INS_QSI, + SYSZ_INS_RCHP, + SYSZ_INS_RISBGN, + SYSZ_INS_RP, + SYSZ_INS_RRBE, + SYSZ_INS_RRBM, + SYSZ_INS_RRDTR, + SYSZ_INS_RRXTR, + SYSZ_INS_RSCH, + SYSZ_INS_SAC, + SYSZ_INS_SACF, + SYSZ_INS_SAL, + SYSZ_INS_SAM24, + SYSZ_INS_SAM31, + SYSZ_INS_SAM64, + SYSZ_INS_SAR, + SYSZ_INS_SCCTR, + SYSZ_INS_SCHM, + SYSZ_INS_SCK, + SYSZ_INS_SCKC, + SYSZ_INS_SCKPF, + SYSZ_INS_SD, + SYSZ_INS_SDR, + SYSZ_INS_SDTR, + SYSZ_INS_SDTRA, + SYSZ_INS_SE, + SYSZ_INS_SER, + SYSZ_INS_SFASR, + SYSZ_INS_SFPC, + SYSZ_INS_SGH, + SYSZ_INS_SHHHR, + SYSZ_INS_SHHLR, + SYSZ_INS_SIE, + SYSZ_INS_SIGA, + SYSZ_INS_SIGP, + SYSZ_INS_SLA, + SYSZ_INS_SLAG, + SYSZ_INS_SLAK, + SYSZ_INS_SLDA, + SYSZ_INS_SLDL, + SYSZ_INS_SLDT, + SYSZ_INS_SLHHHR, + SYSZ_INS_SLHHLR, + SYSZ_INS_SLXT, + SYSZ_INS_SP, + SYSZ_INS_SPCTR, + SYSZ_INS_SPKA, + SYSZ_INS_SPM, + SYSZ_INS_SPT, + SYSZ_INS_SPX, + SYSZ_INS_SQD, + SYSZ_INS_SQDR, + SYSZ_INS_SQE, + SYSZ_INS_SQER, + SYSZ_INS_SQXR, + SYSZ_INS_SRDA, + SYSZ_INS_SRDL, + SYSZ_INS_SRDT, + SYSZ_INS_SRNM, + SYSZ_INS_SRNMB, + SYSZ_INS_SRNMT, + SYSZ_INS_SRP, + SYSZ_INS_SRSTU, + SYSZ_INS_SRXT, + SYSZ_INS_SSAIR, + SYSZ_INS_SSAR, + SYSZ_INS_SSCH, + SYSZ_INS_SSKE, + SYSZ_INS_SSM, + SYSZ_INS_STAM, + SYSZ_INS_STAMY, + SYSZ_INS_STAP, + SYSZ_INS_STCK, + SYSZ_INS_STCKC, + SYSZ_INS_STCKE, + SYSZ_INS_STCKF, + SYSZ_INS_STCM, + SYSZ_INS_STCMH, + SYSZ_INS_STCMY, + SYSZ_INS_STCPS, + SYSZ_INS_STCRW, + SYSZ_INS_STCTG, + SYSZ_INS_STCTL, + SYSZ_INS_STFL, + SYSZ_INS_STFLE, + SYSZ_INS_STFPC, + SYSZ_INS_STGSC, + SYSZ_INS_STIDP, + SYSZ_INS_STM, + SYSZ_INS_STMH, + SYSZ_INS_STMY, + SYSZ_INS_STNSM, + SYSZ_INS_STOCFH, + SYSZ_INS_STOCFHE, + SYSZ_INS_STOCFHH, + SYSZ_INS_STOCFHHE, + SYSZ_INS_STOCFHL, + SYSZ_INS_STOCFHLE, + SYSZ_INS_STOCFHLH, + SYSZ_INS_STOCFHM, + SYSZ_INS_STOCFHNE, + SYSZ_INS_STOCFHNH, + SYSZ_INS_STOCFHNHE, + SYSZ_INS_STOCFHNL, + SYSZ_INS_STOCFHNLE, + SYSZ_INS_STOCFHNLH, + SYSZ_INS_STOCFHNM, + SYSZ_INS_STOCFHNO, + SYSZ_INS_STOCFHNP, + SYSZ_INS_STOCFHNZ, + SYSZ_INS_STOCFHO, + SYSZ_INS_STOCFHP, + SYSZ_INS_STOCFHZ, + SYSZ_INS_STOCGM, + SYSZ_INS_STOCGNM, + SYSZ_INS_STOCGNP, + SYSZ_INS_STOCGNZ, + SYSZ_INS_STOCGP, + SYSZ_INS_STOCGZ, + SYSZ_INS_STOCM, + SYSZ_INS_STOCNM, + SYSZ_INS_STOCNP, + SYSZ_INS_STOCNZ, + SYSZ_INS_STOCP, + SYSZ_INS_STOCZ, + SYSZ_INS_STOSM, + SYSZ_INS_STPQ, + SYSZ_INS_STPT, + SYSZ_INS_STPX, + SYSZ_INS_STRAG, + SYSZ_INS_STRVH, + SYSZ_INS_STSCH, + SYSZ_INS_STSI, + SYSZ_INS_STURA, + SYSZ_INS_STURG, + SYSZ_INS_SU, + SYSZ_INS_SUR, + SYSZ_INS_SVC, + SYSZ_INS_SW, + SYSZ_INS_SWR, + SYSZ_INS_SXR, + SYSZ_INS_SXTR, + SYSZ_INS_SXTRA, + SYSZ_INS_TABORT, + SYSZ_INS_TAM, + SYSZ_INS_TAR, + SYSZ_INS_TB, + SYSZ_INS_TBDR, + SYSZ_INS_TBEDR, + SYSZ_INS_TBEGIN, + SYSZ_INS_TBEGINC, + SYSZ_INS_TCDB, + SYSZ_INS_TCEB, + SYSZ_INS_TCXB, + SYSZ_INS_TDCDT, + SYSZ_INS_TDCET, + SYSZ_INS_TDCXT, + SYSZ_INS_TDGDT, + SYSZ_INS_TDGET, + SYSZ_INS_TDGXT, + SYSZ_INS_TEND, + SYSZ_INS_THDER, + SYSZ_INS_THDR, + SYSZ_INS_TP, + SYSZ_INS_TPI, + SYSZ_INS_TPROT, + SYSZ_INS_TR, + SYSZ_INS_TRACE, + SYSZ_INS_TRACG, + SYSZ_INS_TRAP2, + SYSZ_INS_TRAP4, + SYSZ_INS_TRE, + SYSZ_INS_TROO, + SYSZ_INS_TROT, + SYSZ_INS_TRT, + SYSZ_INS_TRTE, + SYSZ_INS_TRTO, + SYSZ_INS_TRTR, + SYSZ_INS_TRTRE, + SYSZ_INS_TRTT, + SYSZ_INS_TS, + SYSZ_INS_TSCH, + SYSZ_INS_UNPK, + SYSZ_INS_UNPKA, + SYSZ_INS_UNPKU, + SYSZ_INS_UPT, + SYSZ_INS_VA, + SYSZ_INS_VAB, + SYSZ_INS_VAC, + SYSZ_INS_VACC, + SYSZ_INS_VACCB, + SYSZ_INS_VACCC, + SYSZ_INS_VACCCQ, + SYSZ_INS_VACCF, + SYSZ_INS_VACCG, + SYSZ_INS_VACCH, + SYSZ_INS_VACCQ, + SYSZ_INS_VACQ, + SYSZ_INS_VAF, + SYSZ_INS_VAG, + SYSZ_INS_VAH, + SYSZ_INS_VAP, + SYSZ_INS_VAQ, + SYSZ_INS_VAVG, + SYSZ_INS_VAVGB, + SYSZ_INS_VAVGF, + SYSZ_INS_VAVGG, + SYSZ_INS_VAVGH, + SYSZ_INS_VAVGL, + SYSZ_INS_VAVGLB, + SYSZ_INS_VAVGLF, + SYSZ_INS_VAVGLG, + SYSZ_INS_VAVGLH, + SYSZ_INS_VBPERM, + SYSZ_INS_VCDG, + SYSZ_INS_VCDGB, + SYSZ_INS_VCDLG, + SYSZ_INS_VCDLGB, + SYSZ_INS_VCEQ, + SYSZ_INS_VCEQB, + SYSZ_INS_VCEQBS, + SYSZ_INS_VCEQF, + SYSZ_INS_VCEQFS, + SYSZ_INS_VCEQG, + SYSZ_INS_VCEQGS, + SYSZ_INS_VCEQH, + SYSZ_INS_VCEQHS, + SYSZ_INS_VCGD, + SYSZ_INS_VCGDB, + SYSZ_INS_VCH, + SYSZ_INS_VCHB, + SYSZ_INS_VCHBS, + SYSZ_INS_VCHF, + SYSZ_INS_VCHFS, + SYSZ_INS_VCHG, + SYSZ_INS_VCHGS, + SYSZ_INS_VCHH, + SYSZ_INS_VCHHS, + SYSZ_INS_VCHL, + SYSZ_INS_VCHLB, + SYSZ_INS_VCHLBS, + SYSZ_INS_VCHLF, + SYSZ_INS_VCHLFS, + SYSZ_INS_VCHLG, + SYSZ_INS_VCHLGS, + SYSZ_INS_VCHLH, + SYSZ_INS_VCHLHS, + SYSZ_INS_VCKSM, + SYSZ_INS_VCLGD, + SYSZ_INS_VCLGDB, + SYSZ_INS_VCLZ, + SYSZ_INS_VCLZB, + SYSZ_INS_VCLZF, + SYSZ_INS_VCLZG, + SYSZ_INS_VCLZH, + SYSZ_INS_VCP, + SYSZ_INS_VCTZ, + SYSZ_INS_VCTZB, + SYSZ_INS_VCTZF, + SYSZ_INS_VCTZG, + SYSZ_INS_VCTZH, + SYSZ_INS_VCVB, + SYSZ_INS_VCVBG, + SYSZ_INS_VCVD, + SYSZ_INS_VCVDG, + SYSZ_INS_VDP, + SYSZ_INS_VEC, + SYSZ_INS_VECB, + SYSZ_INS_VECF, + SYSZ_INS_VECG, + SYSZ_INS_VECH, + SYSZ_INS_VECL, + SYSZ_INS_VECLB, + SYSZ_INS_VECLF, + SYSZ_INS_VECLG, + SYSZ_INS_VECLH, + SYSZ_INS_VERIM, + SYSZ_INS_VERIMB, + SYSZ_INS_VERIMF, + SYSZ_INS_VERIMG, + SYSZ_INS_VERIMH, + SYSZ_INS_VERLL, + SYSZ_INS_VERLLB, + SYSZ_INS_VERLLF, + SYSZ_INS_VERLLG, + SYSZ_INS_VERLLH, + SYSZ_INS_VERLLV, + SYSZ_INS_VERLLVB, + SYSZ_INS_VERLLVF, + SYSZ_INS_VERLLVG, + SYSZ_INS_VERLLVH, + SYSZ_INS_VESL, + SYSZ_INS_VESLB, + SYSZ_INS_VESLF, + SYSZ_INS_VESLG, + SYSZ_INS_VESLH, + SYSZ_INS_VESLV, + SYSZ_INS_VESLVB, + SYSZ_INS_VESLVF, + SYSZ_INS_VESLVG, + SYSZ_INS_VESLVH, + SYSZ_INS_VESRA, + SYSZ_INS_VESRAB, + SYSZ_INS_VESRAF, + SYSZ_INS_VESRAG, + SYSZ_INS_VESRAH, + SYSZ_INS_VESRAV, + SYSZ_INS_VESRAVB, + SYSZ_INS_VESRAVF, + SYSZ_INS_VESRAVG, + SYSZ_INS_VESRAVH, + SYSZ_INS_VESRL, + SYSZ_INS_VESRLB, + SYSZ_INS_VESRLF, + SYSZ_INS_VESRLG, + SYSZ_INS_VESRLH, + SYSZ_INS_VESRLV, + SYSZ_INS_VESRLVB, + SYSZ_INS_VESRLVF, + SYSZ_INS_VESRLVG, + SYSZ_INS_VESRLVH, + SYSZ_INS_VFA, + SYSZ_INS_VFADB, + SYSZ_INS_VFAE, + SYSZ_INS_VFAEB, + SYSZ_INS_VFAEBS, + SYSZ_INS_VFAEF, + SYSZ_INS_VFAEFS, + SYSZ_INS_VFAEH, + SYSZ_INS_VFAEHS, + SYSZ_INS_VFAEZB, + SYSZ_INS_VFAEZBS, + SYSZ_INS_VFAEZF, + SYSZ_INS_VFAEZFS, + SYSZ_INS_VFAEZH, + SYSZ_INS_VFAEZHS, + SYSZ_INS_VFASB, + SYSZ_INS_VFCE, + SYSZ_INS_VFCEDB, + SYSZ_INS_VFCEDBS, + SYSZ_INS_VFCESB, + SYSZ_INS_VFCESBS, + SYSZ_INS_VFCH, + SYSZ_INS_VFCHDB, + SYSZ_INS_VFCHDBS, + SYSZ_INS_VFCHE, + SYSZ_INS_VFCHEDB, + SYSZ_INS_VFCHEDBS, + SYSZ_INS_VFCHESB, + SYSZ_INS_VFCHESBS, + SYSZ_INS_VFCHSB, + SYSZ_INS_VFCHSBS, + SYSZ_INS_VFD, + SYSZ_INS_VFDDB, + SYSZ_INS_VFDSB, + SYSZ_INS_VFEE, + SYSZ_INS_VFEEB, + SYSZ_INS_VFEEBS, + SYSZ_INS_VFEEF, + SYSZ_INS_VFEEFS, + SYSZ_INS_VFEEH, + SYSZ_INS_VFEEHS, + SYSZ_INS_VFEEZB, + SYSZ_INS_VFEEZBS, + SYSZ_INS_VFEEZF, + SYSZ_INS_VFEEZFS, + SYSZ_INS_VFEEZH, + SYSZ_INS_VFEEZHS, + SYSZ_INS_VFENE, + SYSZ_INS_VFENEB, + SYSZ_INS_VFENEBS, + SYSZ_INS_VFENEF, + SYSZ_INS_VFENEFS, + SYSZ_INS_VFENEH, + SYSZ_INS_VFENEHS, + SYSZ_INS_VFENEZB, + SYSZ_INS_VFENEZBS, + SYSZ_INS_VFENEZF, + SYSZ_INS_VFENEZFS, + SYSZ_INS_VFENEZH, + SYSZ_INS_VFENEZHS, + SYSZ_INS_VFI, + SYSZ_INS_VFIDB, + SYSZ_INS_VFISB, + SYSZ_INS_VFKEDB, + SYSZ_INS_VFKEDBS, + SYSZ_INS_VFKESB, + SYSZ_INS_VFKESBS, + SYSZ_INS_VFKHDB, + SYSZ_INS_VFKHDBS, + SYSZ_INS_VFKHEDB, + SYSZ_INS_VFKHEDBS, + SYSZ_INS_VFKHESB, + SYSZ_INS_VFKHESBS, + SYSZ_INS_VFKHSB, + SYSZ_INS_VFKHSBS, + SYSZ_INS_VFLCDB, + SYSZ_INS_VFLCSB, + SYSZ_INS_VFLL, + SYSZ_INS_VFLLS, + SYSZ_INS_VFLNDB, + SYSZ_INS_VFLNSB, + SYSZ_INS_VFLPDB, + SYSZ_INS_VFLPSB, + SYSZ_INS_VFLR, + SYSZ_INS_VFLRD, + SYSZ_INS_VFM, + SYSZ_INS_VFMA, + SYSZ_INS_VFMADB, + SYSZ_INS_VFMASB, + SYSZ_INS_VFMAX, + SYSZ_INS_VFMAXDB, + SYSZ_INS_VFMAXSB, + SYSZ_INS_VFMDB, + SYSZ_INS_VFMIN, + SYSZ_INS_VFMINDB, + SYSZ_INS_VFMINSB, + SYSZ_INS_VFMS, + SYSZ_INS_VFMSB, + SYSZ_INS_VFMSDB, + SYSZ_INS_VFMSSB, + SYSZ_INS_VFNMA, + SYSZ_INS_VFNMADB, + SYSZ_INS_VFNMASB, + SYSZ_INS_VFNMS, + SYSZ_INS_VFNMSDB, + SYSZ_INS_VFNMSSB, + SYSZ_INS_VFPSO, + SYSZ_INS_VFPSODB, + SYSZ_INS_VFPSOSB, + SYSZ_INS_VFS, + SYSZ_INS_VFSDB, + SYSZ_INS_VFSQ, + SYSZ_INS_VFSQDB, + SYSZ_INS_VFSQSB, + SYSZ_INS_VFSSB, + SYSZ_INS_VFTCI, + SYSZ_INS_VFTCIDB, + SYSZ_INS_VFTCISB, + SYSZ_INS_VGBM, + SYSZ_INS_VGEF, + SYSZ_INS_VGEG, + SYSZ_INS_VGFM, + SYSZ_INS_VGFMA, + SYSZ_INS_VGFMAB, + SYSZ_INS_VGFMAF, + SYSZ_INS_VGFMAG, + SYSZ_INS_VGFMAH, + SYSZ_INS_VGFMB, + SYSZ_INS_VGFMF, + SYSZ_INS_VGFMG, + SYSZ_INS_VGFMH, + SYSZ_INS_VGM, + SYSZ_INS_VGMB, + SYSZ_INS_VGMF, + SYSZ_INS_VGMG, + SYSZ_INS_VGMH, + SYSZ_INS_VISTR, + SYSZ_INS_VISTRB, + SYSZ_INS_VISTRBS, + SYSZ_INS_VISTRF, + SYSZ_INS_VISTRFS, + SYSZ_INS_VISTRH, + SYSZ_INS_VISTRHS, + SYSZ_INS_VL, + SYSZ_INS_VLBB, + SYSZ_INS_VLC, + SYSZ_INS_VLCB, + SYSZ_INS_VLCF, + SYSZ_INS_VLCG, + SYSZ_INS_VLCH, + SYSZ_INS_VLDE, + SYSZ_INS_VLDEB, + SYSZ_INS_VLEB, + SYSZ_INS_VLED, + SYSZ_INS_VLEDB, + SYSZ_INS_VLEF, + SYSZ_INS_VLEG, + SYSZ_INS_VLEH, + SYSZ_INS_VLEIB, + SYSZ_INS_VLEIF, + SYSZ_INS_VLEIG, + SYSZ_INS_VLEIH, + SYSZ_INS_VLGV, + SYSZ_INS_VLGVB, + SYSZ_INS_VLGVF, + SYSZ_INS_VLGVG, + SYSZ_INS_VLGVH, + SYSZ_INS_VLIP, + SYSZ_INS_VLL, + SYSZ_INS_VLLEZ, + SYSZ_INS_VLLEZB, + SYSZ_INS_VLLEZF, + SYSZ_INS_VLLEZG, + SYSZ_INS_VLLEZH, + SYSZ_INS_VLLEZLF, + SYSZ_INS_VLM, + SYSZ_INS_VLP, + SYSZ_INS_VLPB, + SYSZ_INS_VLPF, + SYSZ_INS_VLPG, + SYSZ_INS_VLPH, + SYSZ_INS_VLR, + SYSZ_INS_VLREP, + SYSZ_INS_VLREPB, + SYSZ_INS_VLREPF, + SYSZ_INS_VLREPG, + SYSZ_INS_VLREPH, + SYSZ_INS_VLRL, + SYSZ_INS_VLRLR, + SYSZ_INS_VLVG, + SYSZ_INS_VLVGB, + SYSZ_INS_VLVGF, + SYSZ_INS_VLVGG, + SYSZ_INS_VLVGH, + SYSZ_INS_VLVGP, + SYSZ_INS_VMAE, + SYSZ_INS_VMAEB, + SYSZ_INS_VMAEF, + SYSZ_INS_VMAEH, + SYSZ_INS_VMAH, + SYSZ_INS_VMAHB, + SYSZ_INS_VMAHF, + SYSZ_INS_VMAHH, + SYSZ_INS_VMAL, + SYSZ_INS_VMALB, + SYSZ_INS_VMALE, + SYSZ_INS_VMALEB, + SYSZ_INS_VMALEF, + SYSZ_INS_VMALEH, + SYSZ_INS_VMALF, + SYSZ_INS_VMALH, + SYSZ_INS_VMALHB, + SYSZ_INS_VMALHF, + SYSZ_INS_VMALHH, + SYSZ_INS_VMALHW, + SYSZ_INS_VMALO, + SYSZ_INS_VMALOB, + SYSZ_INS_VMALOF, + SYSZ_INS_VMALOH, + SYSZ_INS_VMAO, + SYSZ_INS_VMAOB, + SYSZ_INS_VMAOF, + SYSZ_INS_VMAOH, + SYSZ_INS_VME, + SYSZ_INS_VMEB, + SYSZ_INS_VMEF, + SYSZ_INS_VMEH, + SYSZ_INS_VMH, + SYSZ_INS_VMHB, + SYSZ_INS_VMHF, + SYSZ_INS_VMHH, + SYSZ_INS_VML, + SYSZ_INS_VMLB, + SYSZ_INS_VMLE, + SYSZ_INS_VMLEB, + SYSZ_INS_VMLEF, + SYSZ_INS_VMLEH, + SYSZ_INS_VMLF, + SYSZ_INS_VMLH, + SYSZ_INS_VMLHB, + SYSZ_INS_VMLHF, + SYSZ_INS_VMLHH, + SYSZ_INS_VMLHW, + SYSZ_INS_VMLO, + SYSZ_INS_VMLOB, + SYSZ_INS_VMLOF, + SYSZ_INS_VMLOH, + SYSZ_INS_VMN, + SYSZ_INS_VMNB, + SYSZ_INS_VMNF, + SYSZ_INS_VMNG, + SYSZ_INS_VMNH, + SYSZ_INS_VMNL, + SYSZ_INS_VMNLB, + SYSZ_INS_VMNLF, + SYSZ_INS_VMNLG, + SYSZ_INS_VMNLH, + SYSZ_INS_VMO, + SYSZ_INS_VMOB, + SYSZ_INS_VMOF, + SYSZ_INS_VMOH, + SYSZ_INS_VMP, + SYSZ_INS_VMRH, + SYSZ_INS_VMRHB, + SYSZ_INS_VMRHF, + SYSZ_INS_VMRHG, + SYSZ_INS_VMRHH, + SYSZ_INS_VMRL, + SYSZ_INS_VMRLB, + SYSZ_INS_VMRLF, + SYSZ_INS_VMRLG, + SYSZ_INS_VMRLH, + SYSZ_INS_VMSL, + SYSZ_INS_VMSLG, + SYSZ_INS_VMSP, + SYSZ_INS_VMX, + SYSZ_INS_VMXB, + SYSZ_INS_VMXF, + SYSZ_INS_VMXG, + SYSZ_INS_VMXH, + SYSZ_INS_VMXL, + SYSZ_INS_VMXLB, + SYSZ_INS_VMXLF, + SYSZ_INS_VMXLG, + SYSZ_INS_VMXLH, + SYSZ_INS_VN, + SYSZ_INS_VNC, + SYSZ_INS_VNN, + SYSZ_INS_VNO, + SYSZ_INS_VNX, + SYSZ_INS_VO, + SYSZ_INS_VOC, + SYSZ_INS_VONE, + SYSZ_INS_VPDI, + SYSZ_INS_VPERM, + SYSZ_INS_VPK, + SYSZ_INS_VPKF, + SYSZ_INS_VPKG, + SYSZ_INS_VPKH, + SYSZ_INS_VPKLS, + SYSZ_INS_VPKLSF, + SYSZ_INS_VPKLSFS, + SYSZ_INS_VPKLSG, + SYSZ_INS_VPKLSGS, + SYSZ_INS_VPKLSH, + SYSZ_INS_VPKLSHS, + SYSZ_INS_VPKS, + SYSZ_INS_VPKSF, + SYSZ_INS_VPKSFS, + SYSZ_INS_VPKSG, + SYSZ_INS_VPKSGS, + SYSZ_INS_VPKSH, + SYSZ_INS_VPKSHS, + SYSZ_INS_VPKZ, + SYSZ_INS_VPOPCT, + SYSZ_INS_VPOPCTB, + SYSZ_INS_VPOPCTF, + SYSZ_INS_VPOPCTG, + SYSZ_INS_VPOPCTH, + SYSZ_INS_VPSOP, + SYSZ_INS_VREP, + SYSZ_INS_VREPB, + SYSZ_INS_VREPF, + SYSZ_INS_VREPG, + SYSZ_INS_VREPH, + SYSZ_INS_VREPI, + SYSZ_INS_VREPIB, + SYSZ_INS_VREPIF, + SYSZ_INS_VREPIG, + SYSZ_INS_VREPIH, + SYSZ_INS_VRP, + SYSZ_INS_VS, + SYSZ_INS_VSB, + SYSZ_INS_VSBCBI, + SYSZ_INS_VSBCBIQ, + SYSZ_INS_VSBI, + SYSZ_INS_VSBIQ, + SYSZ_INS_VSCBI, + SYSZ_INS_VSCBIB, + SYSZ_INS_VSCBIF, + SYSZ_INS_VSCBIG, + SYSZ_INS_VSCBIH, + SYSZ_INS_VSCBIQ, + SYSZ_INS_VSCEF, + SYSZ_INS_VSCEG, + SYSZ_INS_VSDP, + SYSZ_INS_VSEG, + SYSZ_INS_VSEGB, + SYSZ_INS_VSEGF, + SYSZ_INS_VSEGH, + SYSZ_INS_VSEL, + SYSZ_INS_VSF, + SYSZ_INS_VSG, + SYSZ_INS_VSH, + SYSZ_INS_VSL, + SYSZ_INS_VSLB, + SYSZ_INS_VSLDB, + SYSZ_INS_VSP, + SYSZ_INS_VSQ, + SYSZ_INS_VSRA, + SYSZ_INS_VSRAB, + SYSZ_INS_VSRL, + SYSZ_INS_VSRLB, + SYSZ_INS_VSRP, + SYSZ_INS_VST, + SYSZ_INS_VSTEB, + SYSZ_INS_VSTEF, + SYSZ_INS_VSTEG, + SYSZ_INS_VSTEH, + SYSZ_INS_VSTL, + SYSZ_INS_VSTM, + SYSZ_INS_VSTRC, + SYSZ_INS_VSTRCB, + SYSZ_INS_VSTRCBS, + SYSZ_INS_VSTRCF, + SYSZ_INS_VSTRCFS, + SYSZ_INS_VSTRCH, + SYSZ_INS_VSTRCHS, + SYSZ_INS_VSTRCZB, + SYSZ_INS_VSTRCZBS, + SYSZ_INS_VSTRCZF, + SYSZ_INS_VSTRCZFS, + SYSZ_INS_VSTRCZH, + SYSZ_INS_VSTRCZHS, + SYSZ_INS_VSTRL, + SYSZ_INS_VSTRLR, + SYSZ_INS_VSUM, + SYSZ_INS_VSUMB, + SYSZ_INS_VSUMG, + SYSZ_INS_VSUMGF, + SYSZ_INS_VSUMGH, + SYSZ_INS_VSUMH, + SYSZ_INS_VSUMQ, + SYSZ_INS_VSUMQF, + SYSZ_INS_VSUMQG, + SYSZ_INS_VTM, + SYSZ_INS_VTP, + SYSZ_INS_VUPH, + SYSZ_INS_VUPHB, + SYSZ_INS_VUPHF, + SYSZ_INS_VUPHH, + SYSZ_INS_VUPKZ, + SYSZ_INS_VUPL, + SYSZ_INS_VUPLB, + SYSZ_INS_VUPLF, + SYSZ_INS_VUPLH, + SYSZ_INS_VUPLHB, + SYSZ_INS_VUPLHF, + SYSZ_INS_VUPLHH, + SYSZ_INS_VUPLHW, + SYSZ_INS_VUPLL, + SYSZ_INS_VUPLLB, + SYSZ_INS_VUPLLF, + SYSZ_INS_VUPLLH, + SYSZ_INS_VX, + SYSZ_INS_VZERO, + SYSZ_INS_WCDGB, + SYSZ_INS_WCDLGB, + SYSZ_INS_WCGDB, + SYSZ_INS_WCLGDB, + SYSZ_INS_WFADB, + SYSZ_INS_WFASB, + SYSZ_INS_WFAXB, + SYSZ_INS_WFC, + SYSZ_INS_WFCDB, + SYSZ_INS_WFCEDB, + SYSZ_INS_WFCEDBS, + SYSZ_INS_WFCESB, + SYSZ_INS_WFCESBS, + SYSZ_INS_WFCEXB, + SYSZ_INS_WFCEXBS, + SYSZ_INS_WFCHDB, + SYSZ_INS_WFCHDBS, + SYSZ_INS_WFCHEDB, + SYSZ_INS_WFCHEDBS, + SYSZ_INS_WFCHESB, + SYSZ_INS_WFCHESBS, + SYSZ_INS_WFCHEXB, + SYSZ_INS_WFCHEXBS, + SYSZ_INS_WFCHSB, + SYSZ_INS_WFCHSBS, + SYSZ_INS_WFCHXB, + SYSZ_INS_WFCHXBS, + SYSZ_INS_WFCSB, + SYSZ_INS_WFCXB, + SYSZ_INS_WFDDB, + SYSZ_INS_WFDSB, + SYSZ_INS_WFDXB, + SYSZ_INS_WFIDB, + SYSZ_INS_WFISB, + SYSZ_INS_WFIXB, + SYSZ_INS_WFK, + SYSZ_INS_WFKDB, + SYSZ_INS_WFKEDB, + SYSZ_INS_WFKEDBS, + SYSZ_INS_WFKESB, + SYSZ_INS_WFKESBS, + SYSZ_INS_WFKEXB, + SYSZ_INS_WFKEXBS, + SYSZ_INS_WFKHDB, + SYSZ_INS_WFKHDBS, + SYSZ_INS_WFKHEDB, + SYSZ_INS_WFKHEDBS, + SYSZ_INS_WFKHESB, + SYSZ_INS_WFKHESBS, + SYSZ_INS_WFKHEXB, + SYSZ_INS_WFKHEXBS, + SYSZ_INS_WFKHSB, + SYSZ_INS_WFKHSBS, + SYSZ_INS_WFKHXB, + SYSZ_INS_WFKHXBS, + SYSZ_INS_WFKSB, + SYSZ_INS_WFKXB, + SYSZ_INS_WFLCDB, + SYSZ_INS_WFLCSB, + SYSZ_INS_WFLCXB, + SYSZ_INS_WFLLD, + SYSZ_INS_WFLLS, + SYSZ_INS_WFLNDB, + SYSZ_INS_WFLNSB, + SYSZ_INS_WFLNXB, + SYSZ_INS_WFLPDB, + SYSZ_INS_WFLPSB, + SYSZ_INS_WFLPXB, + SYSZ_INS_WFLRD, + SYSZ_INS_WFLRX, + SYSZ_INS_WFMADB, + SYSZ_INS_WFMASB, + SYSZ_INS_WFMAXB, + SYSZ_INS_WFMAXDB, + SYSZ_INS_WFMAXSB, + SYSZ_INS_WFMAXXB, + SYSZ_INS_WFMDB, + SYSZ_INS_WFMINDB, + SYSZ_INS_WFMINSB, + SYSZ_INS_WFMINXB, + SYSZ_INS_WFMSB, + SYSZ_INS_WFMSDB, + SYSZ_INS_WFMSSB, + SYSZ_INS_WFMSXB, + SYSZ_INS_WFMXB, + SYSZ_INS_WFNMADB, + SYSZ_INS_WFNMASB, + SYSZ_INS_WFNMAXB, + SYSZ_INS_WFNMSDB, + SYSZ_INS_WFNMSSB, + SYSZ_INS_WFNMSXB, + SYSZ_INS_WFPSODB, + SYSZ_INS_WFPSOSB, + SYSZ_INS_WFPSOXB, + SYSZ_INS_WFSDB, + SYSZ_INS_WFSQDB, + SYSZ_INS_WFSQSB, + SYSZ_INS_WFSQXB, + SYSZ_INS_WFSSB, + SYSZ_INS_WFSXB, + SYSZ_INS_WFTCIDB, + SYSZ_INS_WFTCISB, + SYSZ_INS_WFTCIXB, + SYSZ_INS_WLDEB, + SYSZ_INS_WLEDB, + SYSZ_INS_XSCH, + SYSZ_INS_ZAP, + + SYSZ_INS_ENDING, // <-- mark the end of the list of instructions +} sysz_insn; + +/// Group of SystemZ instructions +typedef enum sysz_insn_group { + SYSZ_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + // Generic groups + // all jump instructions (conditional+direct+indirect jumps) + SYSZ_GRP_JUMP, ///< = CS_GRP_JUMP + + // Architecture-specific groups + SYSZ_GRP_DISTINCTOPS = 128, + SYSZ_GRP_FPEXTENSION, + SYSZ_GRP_HIGHWORD, + SYSZ_GRP_INTERLOCKEDACCESS1, + SYSZ_GRP_LOADSTOREONCOND, + SYSZ_GRP_DFPPACKEDCONVERSION, + SYSZ_GRP_DFPZONEDCONVERSION, + SYSZ_GRP_ENHANCEDDAT2, + SYSZ_GRP_EXECUTIONHINT, + SYSZ_GRP_GUARDEDSTORAGE, + SYSZ_GRP_INSERTREFERENCEBITSMULTIPLE, + SYSZ_GRP_LOADANDTRAP, + SYSZ_GRP_LOADANDZERORIGHTMOSTBYTE, + SYSZ_GRP_LOADSTOREONCOND2, + SYSZ_GRP_MESSAGESECURITYASSIST3, + SYSZ_GRP_MESSAGESECURITYASSIST4, + SYSZ_GRP_MESSAGESECURITYASSIST5, + SYSZ_GRP_MESSAGESECURITYASSIST7, + SYSZ_GRP_MESSAGESECURITYASSIST8, + SYSZ_GRP_MISCELLANEOUSEXTENSIONS, + SYSZ_GRP_MISCELLANEOUSEXTENSIONS2, + SYSZ_GRP_NOVECTOR, + SYSZ_GRP_POPULATIONCOUNT, + SYSZ_GRP_PROCESSORASSIST, + SYSZ_GRP_RESETREFERENCEBITSMULTIPLE, + SYSZ_GRP_TRANSACTIONALEXECUTION, + SYSZ_GRP_VECTOR, + SYSZ_GRP_VECTORENHANCEMENTS1, + SYSZ_GRP_VECTORPACKEDDECIMAL, + + SYSZ_GRP_ENDING, // <-- mark the end of the list of groups +} sysz_insn_group; + +#ifdef __cplusplus +} +#endif + +#endif +#ifndef CAPSTONE_X86_H +#define CAPSTONE_X86_H + +/* Capstone Disassembly Engine */ +/* By Nguyen Anh Quynh , 2013-2015 */ + +#ifdef __cplusplus +extern "C" { +#endif + + +/// Calculate relative address for X86-64, given cs_insn structure +#define X86_REL_ADDR(insn) (((insn).detail->x86.operands[0].type == X86_OP_IMM) \ + ? (uint64_t)((insn).detail->x86.operands[0].imm) \ + : (((insn).address + (insn).size) + (uint64_t)(insn).detail->x86.disp)) + +/// X86 registers +typedef enum x86_reg { + X86_REG_INVALID = 0, + X86_REG_AH, X86_REG_AL, X86_REG_AX, X86_REG_BH, X86_REG_BL, + X86_REG_BP, X86_REG_BPL, X86_REG_BX, X86_REG_CH, X86_REG_CL, + X86_REG_CS, X86_REG_CX, X86_REG_DH, X86_REG_DI, X86_REG_DIL, + X86_REG_DL, X86_REG_DS, X86_REG_DX, X86_REG_EAX, X86_REG_EBP, + X86_REG_EBX, X86_REG_ECX, X86_REG_EDI, X86_REG_EDX, X86_REG_EFLAGS, + X86_REG_EIP, X86_REG_EIZ, X86_REG_ES, X86_REG_ESI, X86_REG_ESP, + X86_REG_FPSW, X86_REG_FS, X86_REG_GS, X86_REG_IP, X86_REG_RAX, + X86_REG_RBP, X86_REG_RBX, X86_REG_RCX, X86_REG_RDI, X86_REG_RDX, + X86_REG_RIP, X86_REG_RIZ, X86_REG_RSI, X86_REG_RSP, X86_REG_SI, + X86_REG_SIL, X86_REG_SP, X86_REG_SPL, X86_REG_SS, X86_REG_CR0, + X86_REG_CR1, X86_REG_CR2, X86_REG_CR3, X86_REG_CR4, X86_REG_CR5, + X86_REG_CR6, X86_REG_CR7, X86_REG_CR8, X86_REG_CR9, X86_REG_CR10, + X86_REG_CR11, X86_REG_CR12, X86_REG_CR13, X86_REG_CR14, X86_REG_CR15, + X86_REG_DR0, X86_REG_DR1, X86_REG_DR2, X86_REG_DR3, X86_REG_DR4, + X86_REG_DR5, X86_REG_DR6, X86_REG_DR7, X86_REG_DR8, X86_REG_DR9, + X86_REG_DR10, X86_REG_DR11, X86_REG_DR12, X86_REG_DR13, X86_REG_DR14, + X86_REG_DR15, X86_REG_FP0, X86_REG_FP1, X86_REG_FP2, X86_REG_FP3, + X86_REG_FP4, X86_REG_FP5, X86_REG_FP6, X86_REG_FP7, + X86_REG_K0, X86_REG_K1, X86_REG_K2, X86_REG_K3, X86_REG_K4, + X86_REG_K5, X86_REG_K6, X86_REG_K7, X86_REG_MM0, X86_REG_MM1, + X86_REG_MM2, X86_REG_MM3, X86_REG_MM4, X86_REG_MM5, X86_REG_MM6, + X86_REG_MM7, X86_REG_R8, X86_REG_R9, X86_REG_R10, X86_REG_R11, + X86_REG_R12, X86_REG_R13, X86_REG_R14, X86_REG_R15, + X86_REG_ST0, X86_REG_ST1, X86_REG_ST2, X86_REG_ST3, + X86_REG_ST4, X86_REG_ST5, X86_REG_ST6, X86_REG_ST7, + X86_REG_XMM0, X86_REG_XMM1, X86_REG_XMM2, X86_REG_XMM3, X86_REG_XMM4, + X86_REG_XMM5, X86_REG_XMM6, X86_REG_XMM7, X86_REG_XMM8, X86_REG_XMM9, + X86_REG_XMM10, X86_REG_XMM11, X86_REG_XMM12, X86_REG_XMM13, X86_REG_XMM14, + X86_REG_XMM15, X86_REG_XMM16, X86_REG_XMM17, X86_REG_XMM18, X86_REG_XMM19, + X86_REG_XMM20, X86_REG_XMM21, X86_REG_XMM22, X86_REG_XMM23, X86_REG_XMM24, + X86_REG_XMM25, X86_REG_XMM26, X86_REG_XMM27, X86_REG_XMM28, X86_REG_XMM29, + X86_REG_XMM30, X86_REG_XMM31, X86_REG_YMM0, X86_REG_YMM1, X86_REG_YMM2, + X86_REG_YMM3, X86_REG_YMM4, X86_REG_YMM5, X86_REG_YMM6, X86_REG_YMM7, + X86_REG_YMM8, X86_REG_YMM9, X86_REG_YMM10, X86_REG_YMM11, X86_REG_YMM12, + X86_REG_YMM13, X86_REG_YMM14, X86_REG_YMM15, X86_REG_YMM16, X86_REG_YMM17, + X86_REG_YMM18, X86_REG_YMM19, X86_REG_YMM20, X86_REG_YMM21, X86_REG_YMM22, + X86_REG_YMM23, X86_REG_YMM24, X86_REG_YMM25, X86_REG_YMM26, X86_REG_YMM27, + X86_REG_YMM28, X86_REG_YMM29, X86_REG_YMM30, X86_REG_YMM31, X86_REG_ZMM0, + X86_REG_ZMM1, X86_REG_ZMM2, X86_REG_ZMM3, X86_REG_ZMM4, X86_REG_ZMM5, + X86_REG_ZMM6, X86_REG_ZMM7, X86_REG_ZMM8, X86_REG_ZMM9, X86_REG_ZMM10, + X86_REG_ZMM11, X86_REG_ZMM12, X86_REG_ZMM13, X86_REG_ZMM14, X86_REG_ZMM15, + X86_REG_ZMM16, X86_REG_ZMM17, X86_REG_ZMM18, X86_REG_ZMM19, X86_REG_ZMM20, + X86_REG_ZMM21, X86_REG_ZMM22, X86_REG_ZMM23, X86_REG_ZMM24, X86_REG_ZMM25, + X86_REG_ZMM26, X86_REG_ZMM27, X86_REG_ZMM28, X86_REG_ZMM29, X86_REG_ZMM30, + X86_REG_ZMM31, X86_REG_R8B, X86_REG_R9B, X86_REG_R10B, X86_REG_R11B, + X86_REG_R12B, X86_REG_R13B, X86_REG_R14B, X86_REG_R15B, X86_REG_R8D, + X86_REG_R9D, X86_REG_R10D, X86_REG_R11D, X86_REG_R12D, X86_REG_R13D, + X86_REG_R14D, X86_REG_R15D, X86_REG_R8W, X86_REG_R9W, X86_REG_R10W, + X86_REG_R11W, X86_REG_R12W, X86_REG_R13W, X86_REG_R14W, X86_REG_R15W, + X86_REG_BND0, X86_REG_BND1, X86_REG_BND2, X86_REG_BND3, + + X86_REG_ENDING // <-- mark the end of the list of registers +} x86_reg; + +// Sub-flags of EFLAGS +#define X86_EFLAGS_MODIFY_AF (1ULL << 0) +#define X86_EFLAGS_MODIFY_CF (1ULL << 1) +#define X86_EFLAGS_MODIFY_SF (1ULL << 2) +#define X86_EFLAGS_MODIFY_ZF (1ULL << 3) +#define X86_EFLAGS_MODIFY_PF (1ULL << 4) +#define X86_EFLAGS_MODIFY_OF (1ULL << 5) +#define X86_EFLAGS_MODIFY_TF (1ULL << 6) +#define X86_EFLAGS_MODIFY_IF (1ULL << 7) +#define X86_EFLAGS_MODIFY_DF (1ULL << 8) +#define X86_EFLAGS_MODIFY_NT (1ULL << 9) +#define X86_EFLAGS_MODIFY_RF (1ULL << 10) +#define X86_EFLAGS_PRIOR_OF (1ULL << 11) +#define X86_EFLAGS_PRIOR_SF (1ULL << 12) +#define X86_EFLAGS_PRIOR_ZF (1ULL << 13) +#define X86_EFLAGS_PRIOR_AF (1ULL << 14) +#define X86_EFLAGS_PRIOR_PF (1ULL << 15) +#define X86_EFLAGS_PRIOR_CF (1ULL << 16) +#define X86_EFLAGS_PRIOR_TF (1ULL << 17) +#define X86_EFLAGS_PRIOR_IF (1ULL << 18) +#define X86_EFLAGS_PRIOR_DF (1ULL << 19) +#define X86_EFLAGS_PRIOR_NT (1ULL << 20) +#define X86_EFLAGS_RESET_OF (1ULL << 21) +#define X86_EFLAGS_RESET_CF (1ULL << 22) +#define X86_EFLAGS_RESET_DF (1ULL << 23) +#define X86_EFLAGS_RESET_IF (1ULL << 24) +#define X86_EFLAGS_RESET_SF (1ULL << 25) +#define X86_EFLAGS_RESET_AF (1ULL << 26) +#define X86_EFLAGS_RESET_TF (1ULL << 27) +#define X86_EFLAGS_RESET_NT (1ULL << 28) +#define X86_EFLAGS_RESET_PF (1ULL << 29) +#define X86_EFLAGS_SET_CF (1ULL << 30) +#define X86_EFLAGS_SET_DF (1ULL << 31) +#define X86_EFLAGS_SET_IF (1ULL << 32) +#define X86_EFLAGS_TEST_OF (1ULL << 33) +#define X86_EFLAGS_TEST_SF (1ULL << 34) +#define X86_EFLAGS_TEST_ZF (1ULL << 35) +#define X86_EFLAGS_TEST_PF (1ULL << 36) +#define X86_EFLAGS_TEST_CF (1ULL << 37) +#define X86_EFLAGS_TEST_NT (1ULL << 38) +#define X86_EFLAGS_TEST_DF (1ULL << 39) +#define X86_EFLAGS_UNDEFINED_OF (1ULL << 40) +#define X86_EFLAGS_UNDEFINED_SF (1ULL << 41) +#define X86_EFLAGS_UNDEFINED_ZF (1ULL << 42) +#define X86_EFLAGS_UNDEFINED_PF (1ULL << 43) +#define X86_EFLAGS_UNDEFINED_AF (1ULL << 44) +#define X86_EFLAGS_UNDEFINED_CF (1ULL << 45) +#define X86_EFLAGS_RESET_RF (1ULL << 46) +#define X86_EFLAGS_TEST_RF (1ULL << 47) +#define X86_EFLAGS_TEST_IF (1ULL << 48) +#define X86_EFLAGS_TEST_TF (1ULL << 49) +#define X86_EFLAGS_TEST_AF (1ULL << 50) +#define X86_EFLAGS_RESET_ZF (1ULL << 51) +#define X86_EFLAGS_SET_OF (1ULL << 52) +#define X86_EFLAGS_SET_SF (1ULL << 53) +#define X86_EFLAGS_SET_ZF (1ULL << 54) +#define X86_EFLAGS_SET_AF (1ULL << 55) +#define X86_EFLAGS_SET_PF (1ULL << 56) +#define X86_EFLAGS_RESET_0F (1ULL << 57) +#define X86_EFLAGS_RESET_AC (1ULL << 58) + +#define X86_FPU_FLAGS_MODIFY_C0 (1ULL << 0) +#define X86_FPU_FLAGS_MODIFY_C1 (1ULL << 1) +#define X86_FPU_FLAGS_MODIFY_C2 (1ULL << 2) +#define X86_FPU_FLAGS_MODIFY_C3 (1ULL << 3) +#define X86_FPU_FLAGS_RESET_C0 (1ULL << 4) +#define X86_FPU_FLAGS_RESET_C1 (1ULL << 5) +#define X86_FPU_FLAGS_RESET_C2 (1ULL << 6) +#define X86_FPU_FLAGS_RESET_C3 (1ULL << 7) +#define X86_FPU_FLAGS_SET_C0 (1ULL << 8) +#define X86_FPU_FLAGS_SET_C1 (1ULL << 9) +#define X86_FPU_FLAGS_SET_C2 (1ULL << 10) +#define X86_FPU_FLAGS_SET_C3 (1ULL << 11) +#define X86_FPU_FLAGS_UNDEFINED_C0 (1ULL << 12) +#define X86_FPU_FLAGS_UNDEFINED_C1 (1ULL << 13) +#define X86_FPU_FLAGS_UNDEFINED_C2 (1ULL << 14) +#define X86_FPU_FLAGS_UNDEFINED_C3 (1ULL << 15) +#define X86_FPU_FLAGS_TEST_C0 (1ULL << 16) +#define X86_FPU_FLAGS_TEST_C1 (1ULL << 17) +#define X86_FPU_FLAGS_TEST_C2 (1ULL << 18) +#define X86_FPU_FLAGS_TEST_C3 (1ULL << 19) + + +/// Operand type for instruction's operands +typedef enum x86_op_type { + X86_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + X86_OP_REG, ///< = CS_OP_REG (Register operand). + X86_OP_IMM, ///< = CS_OP_IMM (Immediate operand). + X86_OP_MEM, ///< = CS_OP_MEM (Memory operand). +} x86_op_type; + +/// XOP Code Condition type +typedef enum x86_xop_cc { + X86_XOP_CC_INVALID = 0, ///< Uninitialized. + X86_XOP_CC_LT, + X86_XOP_CC_LE, + X86_XOP_CC_GT, + X86_XOP_CC_GE, + X86_XOP_CC_EQ, + X86_XOP_CC_NEQ, + X86_XOP_CC_FALSE, + X86_XOP_CC_TRUE, +} x86_xop_cc; + +/// AVX broadcast type +typedef enum x86_avx_bcast { + X86_AVX_BCAST_INVALID = 0, ///< Uninitialized. + X86_AVX_BCAST_2, ///< AVX512 broadcast type {1to2} + X86_AVX_BCAST_4, ///< AVX512 broadcast type {1to4} + X86_AVX_BCAST_8, ///< AVX512 broadcast type {1to8} + X86_AVX_BCAST_16, ///< AVX512 broadcast type {1to16} +} x86_avx_bcast; + +/// SSE Code Condition type +typedef enum x86_sse_cc { + X86_SSE_CC_INVALID = 0, ///< Uninitialized. + X86_SSE_CC_EQ, + X86_SSE_CC_LT, + X86_SSE_CC_LE, + X86_SSE_CC_UNORD, + X86_SSE_CC_NEQ, + X86_SSE_CC_NLT, + X86_SSE_CC_NLE, + X86_SSE_CC_ORD, +} x86_sse_cc; + +/// AVX Code Condition type +typedef enum x86_avx_cc { + X86_AVX_CC_INVALID = 0, ///< Uninitialized. + X86_AVX_CC_EQ, + X86_AVX_CC_LT, + X86_AVX_CC_LE, + X86_AVX_CC_UNORD, + X86_AVX_CC_NEQ, + X86_AVX_CC_NLT, + X86_AVX_CC_NLE, + X86_AVX_CC_ORD, + X86_AVX_CC_EQ_UQ, + X86_AVX_CC_NGE, + X86_AVX_CC_NGT, + X86_AVX_CC_FALSE, + X86_AVX_CC_NEQ_OQ, + X86_AVX_CC_GE, + X86_AVX_CC_GT, + X86_AVX_CC_TRUE, + X86_AVX_CC_EQ_OS, + X86_AVX_CC_LT_OQ, + X86_AVX_CC_LE_OQ, + X86_AVX_CC_UNORD_S, + X86_AVX_CC_NEQ_US, + X86_AVX_CC_NLT_UQ, + X86_AVX_CC_NLE_UQ, + X86_AVX_CC_ORD_S, + X86_AVX_CC_EQ_US, + X86_AVX_CC_NGE_UQ, + X86_AVX_CC_NGT_UQ, + X86_AVX_CC_FALSE_OS, + X86_AVX_CC_NEQ_OS, + X86_AVX_CC_GE_OQ, + X86_AVX_CC_GT_OQ, + X86_AVX_CC_TRUE_US, +} x86_avx_cc; + +/// AVX static rounding mode type +typedef enum x86_avx_rm { + X86_AVX_RM_INVALID = 0, ///< Uninitialized. + X86_AVX_RM_RN, ///< Round to nearest + X86_AVX_RM_RD, ///< Round down + X86_AVX_RM_RU, ///< Round up + X86_AVX_RM_RZ, ///< Round toward zero +} x86_avx_rm; + +/// Instruction prefixes - to be used in cs_x86.prefix[] +typedef enum x86_prefix { + X86_PREFIX_LOCK = 0xf0, ///< lock (cs_x86.prefix[0] + X86_PREFIX_REP = 0xf3, ///< rep (cs_x86.prefix[0] + X86_PREFIX_REPE = 0xf3, ///< repe/repz (cs_x86.prefix[0] + X86_PREFIX_REPNE = 0xf2, ///< repne/repnz (cs_x86.prefix[0] + + X86_PREFIX_CS = 0x2e, ///< segment override CS (cs_x86.prefix[1] + X86_PREFIX_SS = 0x36, ///< segment override SS (cs_x86.prefix[1] + X86_PREFIX_DS = 0x3e, ///< segment override DS (cs_x86.prefix[1] + X86_PREFIX_ES = 0x26, ///< segment override ES (cs_x86.prefix[1] + X86_PREFIX_FS = 0x64, ///< segment override FS (cs_x86.prefix[1] + X86_PREFIX_GS = 0x65, ///< segment override GS (cs_x86.prefix[1] + + X86_PREFIX_OPSIZE = 0x66, ///< operand-size override (cs_x86.prefix[2] + X86_PREFIX_ADDRSIZE = 0x67, ///< address-size override (cs_x86.prefix[3] +} x86_prefix; + +/// Instruction's operand referring to memory +/// This is associated with X86_OP_MEM operand type above +typedef struct x86_op_mem { + x86_reg segment; ///< segment register (or X86_REG_INVALID if irrelevant) + x86_reg base; ///< base register (or X86_REG_INVALID if irrelevant) + x86_reg index; ///< index register (or X86_REG_INVALID if irrelevant) + int scale; ///< scale for index register + int64_t disp; ///< displacement value +} x86_op_mem; + +/// Instruction operand +typedef struct cs_x86_op { + x86_op_type type; ///< operand type + union { + x86_reg reg; ///< register value for REG operand + int64_t imm; ///< immediate value for IMM operand + x86_op_mem mem; ///< base/index/scale/disp value for MEM operand + }; + + /// size of this operand (in bytes). + uint8_t size; + + /// How is this operand accessed? (READ, WRITE or READ|WRITE) + /// This field is combined of cs_ac_type. + /// NOTE: this field is irrelevant if engine is compiled in DIET mode. + uint8_t access; + + /// AVX broadcast type, or 0 if irrelevant + x86_avx_bcast avx_bcast; + + /// AVX zero opmask {z} + bool avx_zero_opmask; +} cs_x86_op; + +typedef struct cs_x86_encoding { + /// ModR/M offset, or 0 when irrelevant + uint8_t modrm_offset; + + /// Displacement offset, or 0 when irrelevant. + uint8_t disp_offset; + uint8_t disp_size; + + /// Immediate offset, or 0 when irrelevant. + uint8_t imm_offset; + uint8_t imm_size; +} cs_x86_encoding; + +/// Instruction structure +typedef struct cs_x86 { + /// Instruction prefix, which can be up to 4 bytes. + /// A prefix byte gets value 0 when irrelevant. + /// prefix[0] indicates REP/REPNE/LOCK prefix (See X86_PREFIX_REP/REPNE/LOCK above) + /// prefix[1] indicates segment override (irrelevant for x86_64): + /// See X86_PREFIX_CS/SS/DS/ES/FS/GS above. + /// prefix[2] indicates operand-size override (X86_PREFIX_OPSIZE) + /// prefix[3] indicates address-size override (X86_PREFIX_ADDRSIZE) + uint8_t prefix[4]; + + /// Instruction opcode, which can be from 1 to 4 bytes in size. + /// This contains VEX opcode as well. + /// An trailing opcode byte gets value 0 when irrelevant. + uint8_t opcode[4]; + + /// REX prefix: only a non-zero value is relevant for x86_64 + uint8_t rex; + + /// Address size, which can be overridden with above prefix[5]. + uint8_t addr_size; + + /// ModR/M byte + uint8_t modrm; + + /// SIB value, or 0 when irrelevant. + uint8_t sib; + + /// Displacement value, valid if encoding.disp_offset != 0 + int64_t disp; + + /// SIB index register, or X86_REG_INVALID when irrelevant. + x86_reg sib_index; + /// SIB scale, only applicable if sib_index is valid. + int8_t sib_scale; + /// SIB base register, or X86_REG_INVALID when irrelevant. + x86_reg sib_base; + + /// XOP Code Condition + x86_xop_cc xop_cc; + + /// SSE Code Condition + x86_sse_cc sse_cc; + + /// AVX Code Condition + x86_avx_cc avx_cc; + + /// AVX Suppress all Exception + bool avx_sae; + + /// AVX static rounding mode + x86_avx_rm avx_rm; + + + union { + /// EFLAGS updated by this instruction. + /// This can be formed from OR combination of X86_EFLAGS_* symbols in x86.h + uint64_t eflags; + /// FPU_FLAGS updated by this instruction. + /// This can be formed from OR combination of X86_FPU_FLAGS_* symbols in x86.h + uint64_t fpu_flags; + }; + + /// Number of operands of this instruction, + /// or 0 when instruction has no operand. + uint8_t op_count; + + cs_x86_op operands[8]; ///< operands for this instruction. + + cs_x86_encoding encoding; ///< encoding information +} cs_x86; + +/// X86 instructions +typedef enum x86_insn { + X86_INS_INVALID = 0, + + X86_INS_AAA, + X86_INS_AAD, + X86_INS_AAM, + X86_INS_AAS, + X86_INS_FABS, + X86_INS_ADC, + X86_INS_ADCX, + X86_INS_ADD, + X86_INS_ADDPD, + X86_INS_ADDPS, + X86_INS_ADDSD, + X86_INS_ADDSS, + X86_INS_ADDSUBPD, + X86_INS_ADDSUBPS, + X86_INS_FADD, + X86_INS_FIADD, + X86_INS_ADOX, + X86_INS_AESDECLAST, + X86_INS_AESDEC, + X86_INS_AESENCLAST, + X86_INS_AESENC, + X86_INS_AESIMC, + X86_INS_AESKEYGENASSIST, + X86_INS_AND, + X86_INS_ANDN, + X86_INS_ANDNPD, + X86_INS_ANDNPS, + X86_INS_ANDPD, + X86_INS_ANDPS, + X86_INS_ARPL, + X86_INS_BEXTR, + X86_INS_BLCFILL, + X86_INS_BLCI, + X86_INS_BLCIC, + X86_INS_BLCMSK, + X86_INS_BLCS, + X86_INS_BLENDPD, + X86_INS_BLENDPS, + X86_INS_BLENDVPD, + X86_INS_BLENDVPS, + X86_INS_BLSFILL, + X86_INS_BLSI, + X86_INS_BLSIC, + X86_INS_BLSMSK, + X86_INS_BLSR, + X86_INS_BNDCL, + X86_INS_BNDCN, + X86_INS_BNDCU, + X86_INS_BNDLDX, + X86_INS_BNDMK, + X86_INS_BNDMOV, + X86_INS_BNDSTX, + X86_INS_BOUND, + X86_INS_BSF, + X86_INS_BSR, + X86_INS_BSWAP, + X86_INS_BT, + X86_INS_BTC, + X86_INS_BTR, + X86_INS_BTS, + X86_INS_BZHI, + X86_INS_CALL, + X86_INS_CBW, + X86_INS_CDQ, + X86_INS_CDQE, + X86_INS_FCHS, + X86_INS_CLAC, + X86_INS_CLC, + X86_INS_CLD, + X86_INS_CLDEMOTE, + X86_INS_CLFLUSH, + X86_INS_CLFLUSHOPT, + X86_INS_CLGI, + X86_INS_CLI, + X86_INS_CLRSSBSY, + X86_INS_CLTS, + X86_INS_CLWB, + X86_INS_CLZERO, + X86_INS_CMC, + X86_INS_CMOVA, + X86_INS_CMOVAE, + X86_INS_CMOVB, + X86_INS_CMOVBE, + X86_INS_FCMOVBE, + X86_INS_FCMOVB, + X86_INS_CMOVE, + X86_INS_FCMOVE, + X86_INS_CMOVG, + X86_INS_CMOVGE, + X86_INS_CMOVL, + X86_INS_CMOVLE, + X86_INS_FCMOVNBE, + X86_INS_FCMOVNB, + X86_INS_CMOVNE, + X86_INS_FCMOVNE, + X86_INS_CMOVNO, + X86_INS_CMOVNP, + X86_INS_FCMOVNU, + X86_INS_FCMOVNP, + X86_INS_CMOVNS, + X86_INS_CMOVO, + X86_INS_CMOVP, + X86_INS_FCMOVU, + X86_INS_CMOVS, + X86_INS_CMP, + X86_INS_CMPPD, + X86_INS_CMPPS, + X86_INS_CMPSB, + X86_INS_CMPSD, + X86_INS_CMPSQ, + X86_INS_CMPSS, + X86_INS_CMPSW, + X86_INS_CMPXCHG16B, + X86_INS_CMPXCHG, + X86_INS_CMPXCHG8B, + X86_INS_COMISD, + X86_INS_COMISS, + X86_INS_FCOMP, + X86_INS_FCOMPI, + X86_INS_FCOMI, + X86_INS_FCOM, + X86_INS_FCOS, + X86_INS_CPUID, + X86_INS_CQO, + X86_INS_CRC32, + X86_INS_CVTDQ2PD, + X86_INS_CVTDQ2PS, + X86_INS_CVTPD2DQ, + X86_INS_CVTPD2PS, + X86_INS_CVTPS2DQ, + X86_INS_CVTPS2PD, + X86_INS_CVTSD2SI, + X86_INS_CVTSD2SS, + X86_INS_CVTSI2SD, + X86_INS_CVTSI2SS, + X86_INS_CVTSS2SD, + X86_INS_CVTSS2SI, + X86_INS_CVTTPD2DQ, + X86_INS_CVTTPS2DQ, + X86_INS_CVTTSD2SI, + X86_INS_CVTTSS2SI, + X86_INS_CWD, + X86_INS_CWDE, + X86_INS_DAA, + X86_INS_DAS, + X86_INS_DATA16, + X86_INS_DEC, + X86_INS_DIV, + X86_INS_DIVPD, + X86_INS_DIVPS, + X86_INS_FDIVR, + X86_INS_FIDIVR, + X86_INS_FDIVRP, + X86_INS_DIVSD, + X86_INS_DIVSS, + X86_INS_FDIV, + X86_INS_FIDIV, + X86_INS_FDIVP, + X86_INS_DPPD, + X86_INS_DPPS, + X86_INS_ENCLS, + X86_INS_ENCLU, + X86_INS_ENCLV, + X86_INS_ENDBR32, + X86_INS_ENDBR64, + X86_INS_ENTER, + X86_INS_EXTRACTPS, + X86_INS_EXTRQ, + X86_INS_F2XM1, + X86_INS_LCALL, + X86_INS_LJMP, + X86_INS_JMP, + X86_INS_FBLD, + X86_INS_FBSTP, + X86_INS_FCOMPP, + X86_INS_FDECSTP, + X86_INS_FDISI8087_NOP, + X86_INS_FEMMS, + X86_INS_FENI8087_NOP, + X86_INS_FFREE, + X86_INS_FFREEP, + X86_INS_FICOM, + X86_INS_FICOMP, + X86_INS_FINCSTP, + X86_INS_FLDCW, + X86_INS_FLDENV, + X86_INS_FLDL2E, + X86_INS_FLDL2T, + X86_INS_FLDLG2, + X86_INS_FLDLN2, + X86_INS_FLDPI, + X86_INS_FNCLEX, + X86_INS_FNINIT, + X86_INS_FNOP, + X86_INS_FNSTCW, + X86_INS_FNSTSW, + X86_INS_FPATAN, + X86_INS_FSTPNCE, + X86_INS_FPREM, + X86_INS_FPREM1, + X86_INS_FPTAN, + X86_INS_FRNDINT, + X86_INS_FRSTOR, + X86_INS_FNSAVE, + X86_INS_FSCALE, + X86_INS_FSETPM, + X86_INS_FSINCOS, + X86_INS_FNSTENV, + X86_INS_FXAM, + X86_INS_FXRSTOR, + X86_INS_FXRSTOR64, + X86_INS_FXSAVE, + X86_INS_FXSAVE64, + X86_INS_FXTRACT, + X86_INS_FYL2X, + X86_INS_FYL2XP1, + X86_INS_GETSEC, + X86_INS_GF2P8AFFINEINVQB, + X86_INS_GF2P8AFFINEQB, + X86_INS_GF2P8MULB, + X86_INS_HADDPD, + X86_INS_HADDPS, + X86_INS_HLT, + X86_INS_HSUBPD, + X86_INS_HSUBPS, + X86_INS_IDIV, + X86_INS_FILD, + X86_INS_IMUL, + X86_INS_IN, + X86_INS_INC, + X86_INS_INCSSPD, + X86_INS_INCSSPQ, + X86_INS_INSB, + X86_INS_INSERTPS, + X86_INS_INSERTQ, + X86_INS_INSD, + X86_INS_INSW, + X86_INS_INT, + X86_INS_INT1, + X86_INS_INT3, + X86_INS_INTO, + X86_INS_INVD, + X86_INS_INVEPT, + X86_INS_INVLPG, + X86_INS_INVLPGA, + X86_INS_INVPCID, + X86_INS_INVVPID, + X86_INS_IRET, + X86_INS_IRETD, + X86_INS_IRETQ, + X86_INS_FISTTP, + X86_INS_FIST, + X86_INS_FISTP, + X86_INS_JAE, + X86_INS_JA, + X86_INS_JBE, + X86_INS_JB, + X86_INS_JCXZ, + X86_INS_JECXZ, + X86_INS_JE, + X86_INS_JGE, + X86_INS_JG, + X86_INS_JLE, + X86_INS_JL, + X86_INS_JNE, + X86_INS_JNO, + X86_INS_JNP, + X86_INS_JNS, + X86_INS_JO, + X86_INS_JP, + X86_INS_JRCXZ, + X86_INS_JS, + X86_INS_KADDB, + X86_INS_KADDD, + X86_INS_KADDQ, + X86_INS_KADDW, + X86_INS_KANDB, + X86_INS_KANDD, + X86_INS_KANDNB, + X86_INS_KANDND, + X86_INS_KANDNQ, + X86_INS_KANDNW, + X86_INS_KANDQ, + X86_INS_KANDW, + X86_INS_KMOVB, + X86_INS_KMOVD, + X86_INS_KMOVQ, + X86_INS_KMOVW, + X86_INS_KNOTB, + X86_INS_KNOTD, + X86_INS_KNOTQ, + X86_INS_KNOTW, + X86_INS_KORB, + X86_INS_KORD, + X86_INS_KORQ, + X86_INS_KORTESTB, + X86_INS_KORTESTD, + X86_INS_KORTESTQ, + X86_INS_KORTESTW, + X86_INS_KORW, + X86_INS_KSHIFTLB, + X86_INS_KSHIFTLD, + X86_INS_KSHIFTLQ, + X86_INS_KSHIFTLW, + X86_INS_KSHIFTRB, + X86_INS_KSHIFTRD, + X86_INS_KSHIFTRQ, + X86_INS_KSHIFTRW, + X86_INS_KTESTB, + X86_INS_KTESTD, + X86_INS_KTESTQ, + X86_INS_KTESTW, + X86_INS_KUNPCKBW, + X86_INS_KUNPCKDQ, + X86_INS_KUNPCKWD, + X86_INS_KXNORB, + X86_INS_KXNORD, + X86_INS_KXNORQ, + X86_INS_KXNORW, + X86_INS_KXORB, + X86_INS_KXORD, + X86_INS_KXORQ, + X86_INS_KXORW, + X86_INS_LAHF, + X86_INS_LAR, + X86_INS_LDDQU, + X86_INS_LDMXCSR, + X86_INS_LDS, + X86_INS_FLDZ, + X86_INS_FLD1, + X86_INS_FLD, + X86_INS_LEA, + X86_INS_LEAVE, + X86_INS_LES, + X86_INS_LFENCE, + X86_INS_LFS, + X86_INS_LGDT, + X86_INS_LGS, + X86_INS_LIDT, + X86_INS_LLDT, + X86_INS_LLWPCB, + X86_INS_LMSW, + X86_INS_LOCK, + X86_INS_LODSB, + X86_INS_LODSD, + X86_INS_LODSQ, + X86_INS_LODSW, + X86_INS_LOOP, + X86_INS_LOOPE, + X86_INS_LOOPNE, + X86_INS_RETF, + X86_INS_RETFQ, + X86_INS_LSL, + X86_INS_LSS, + X86_INS_LTR, + X86_INS_LWPINS, + X86_INS_LWPVAL, + X86_INS_LZCNT, + X86_INS_MASKMOVDQU, + X86_INS_MAXPD, + X86_INS_MAXPS, + X86_INS_MAXSD, + X86_INS_MAXSS, + X86_INS_MFENCE, + X86_INS_MINPD, + X86_INS_MINPS, + X86_INS_MINSD, + X86_INS_MINSS, + X86_INS_CVTPD2PI, + X86_INS_CVTPI2PD, + X86_INS_CVTPI2PS, + X86_INS_CVTPS2PI, + X86_INS_CVTTPD2PI, + X86_INS_CVTTPS2PI, + X86_INS_EMMS, + X86_INS_MASKMOVQ, + X86_INS_MOVD, + X86_INS_MOVQ, + X86_INS_MOVDQ2Q, + X86_INS_MOVNTQ, + X86_INS_MOVQ2DQ, + X86_INS_PABSB, + X86_INS_PABSD, + X86_INS_PABSW, + X86_INS_PACKSSDW, + X86_INS_PACKSSWB, + X86_INS_PACKUSWB, + X86_INS_PADDB, + X86_INS_PADDD, + X86_INS_PADDQ, + X86_INS_PADDSB, + X86_INS_PADDSW, + X86_INS_PADDUSB, + X86_INS_PADDUSW, + X86_INS_PADDW, + X86_INS_PALIGNR, + X86_INS_PANDN, + X86_INS_PAND, + X86_INS_PAVGB, + X86_INS_PAVGW, + X86_INS_PCMPEQB, + X86_INS_PCMPEQD, + X86_INS_PCMPEQW, + X86_INS_PCMPGTB, + X86_INS_PCMPGTD, + X86_INS_PCMPGTW, + X86_INS_PEXTRW, + X86_INS_PHADDD, + X86_INS_PHADDSW, + X86_INS_PHADDW, + X86_INS_PHSUBD, + X86_INS_PHSUBSW, + X86_INS_PHSUBW, + X86_INS_PINSRW, + X86_INS_PMADDUBSW, + X86_INS_PMADDWD, + X86_INS_PMAXSW, + X86_INS_PMAXUB, + X86_INS_PMINSW, + X86_INS_PMINUB, + X86_INS_PMOVMSKB, + X86_INS_PMULHRSW, + X86_INS_PMULHUW, + X86_INS_PMULHW, + X86_INS_PMULLW, + X86_INS_PMULUDQ, + X86_INS_POR, + X86_INS_PSADBW, + X86_INS_PSHUFB, + X86_INS_PSHUFW, + X86_INS_PSIGNB, + X86_INS_PSIGND, + X86_INS_PSIGNW, + X86_INS_PSLLD, + X86_INS_PSLLQ, + X86_INS_PSLLW, + X86_INS_PSRAD, + X86_INS_PSRAW, + X86_INS_PSRLD, + X86_INS_PSRLQ, + X86_INS_PSRLW, + X86_INS_PSUBB, + X86_INS_PSUBD, + X86_INS_PSUBQ, + X86_INS_PSUBSB, + X86_INS_PSUBSW, + X86_INS_PSUBUSB, + X86_INS_PSUBUSW, + X86_INS_PSUBW, + X86_INS_PUNPCKHBW, + X86_INS_PUNPCKHDQ, + X86_INS_PUNPCKHWD, + X86_INS_PUNPCKLBW, + X86_INS_PUNPCKLDQ, + X86_INS_PUNPCKLWD, + X86_INS_PXOR, + X86_INS_MONITORX, + X86_INS_MONITOR, + X86_INS_MONTMUL, + X86_INS_MOV, + X86_INS_MOVABS, + X86_INS_MOVAPD, + X86_INS_MOVAPS, + X86_INS_MOVBE, + X86_INS_MOVDDUP, + X86_INS_MOVDIR64B, + X86_INS_MOVDIRI, + X86_INS_MOVDQA, + X86_INS_MOVDQU, + X86_INS_MOVHLPS, + X86_INS_MOVHPD, + X86_INS_MOVHPS, + X86_INS_MOVLHPS, + X86_INS_MOVLPD, + X86_INS_MOVLPS, + X86_INS_MOVMSKPD, + X86_INS_MOVMSKPS, + X86_INS_MOVNTDQA, + X86_INS_MOVNTDQ, + X86_INS_MOVNTI, + X86_INS_MOVNTPD, + X86_INS_MOVNTPS, + X86_INS_MOVNTSD, + X86_INS_MOVNTSS, + X86_INS_MOVSB, + X86_INS_MOVSD, + X86_INS_MOVSHDUP, + X86_INS_MOVSLDUP, + X86_INS_MOVSQ, + X86_INS_MOVSS, + X86_INS_MOVSW, + X86_INS_MOVSX, + X86_INS_MOVSXD, + X86_INS_MOVUPD, + X86_INS_MOVUPS, + X86_INS_MOVZX, + X86_INS_MPSADBW, + X86_INS_MUL, + X86_INS_MULPD, + X86_INS_MULPS, + X86_INS_MULSD, + X86_INS_MULSS, + X86_INS_MULX, + X86_INS_FMUL, + X86_INS_FIMUL, + X86_INS_FMULP, + X86_INS_MWAITX, + X86_INS_MWAIT, + X86_INS_NEG, + X86_INS_NOP, + X86_INS_NOT, + X86_INS_OR, + X86_INS_ORPD, + X86_INS_ORPS, + X86_INS_OUT, + X86_INS_OUTSB, + X86_INS_OUTSD, + X86_INS_OUTSW, + X86_INS_PACKUSDW, + X86_INS_PAUSE, + X86_INS_PAVGUSB, + X86_INS_PBLENDVB, + X86_INS_PBLENDW, + X86_INS_PCLMULQDQ, + X86_INS_PCMPEQQ, + X86_INS_PCMPESTRI, + X86_INS_PCMPESTRM, + X86_INS_PCMPGTQ, + X86_INS_PCMPISTRI, + X86_INS_PCMPISTRM, + X86_INS_PCONFIG, + X86_INS_PDEP, + X86_INS_PEXT, + X86_INS_PEXTRB, + X86_INS_PEXTRD, + X86_INS_PEXTRQ, + X86_INS_PF2ID, + X86_INS_PF2IW, + X86_INS_PFACC, + X86_INS_PFADD, + X86_INS_PFCMPEQ, + X86_INS_PFCMPGE, + X86_INS_PFCMPGT, + X86_INS_PFMAX, + X86_INS_PFMIN, + X86_INS_PFMUL, + X86_INS_PFNACC, + X86_INS_PFPNACC, + X86_INS_PFRCPIT1, + X86_INS_PFRCPIT2, + X86_INS_PFRCP, + X86_INS_PFRSQIT1, + X86_INS_PFRSQRT, + X86_INS_PFSUBR, + X86_INS_PFSUB, + X86_INS_PHMINPOSUW, + X86_INS_PI2FD, + X86_INS_PI2FW, + X86_INS_PINSRB, + X86_INS_PINSRD, + X86_INS_PINSRQ, + X86_INS_PMAXSB, + X86_INS_PMAXSD, + X86_INS_PMAXUD, + X86_INS_PMAXUW, + X86_INS_PMINSB, + X86_INS_PMINSD, + X86_INS_PMINUD, + X86_INS_PMINUW, + X86_INS_PMOVSXBD, + X86_INS_PMOVSXBQ, + X86_INS_PMOVSXBW, + X86_INS_PMOVSXDQ, + X86_INS_PMOVSXWD, + X86_INS_PMOVSXWQ, + X86_INS_PMOVZXBD, + X86_INS_PMOVZXBQ, + X86_INS_PMOVZXBW, + X86_INS_PMOVZXDQ, + X86_INS_PMOVZXWD, + X86_INS_PMOVZXWQ, + X86_INS_PMULDQ, + X86_INS_PMULHRW, + X86_INS_PMULLD, + X86_INS_POP, + X86_INS_POPAW, + X86_INS_POPAL, + X86_INS_POPCNT, + X86_INS_POPF, + X86_INS_POPFD, + X86_INS_POPFQ, + X86_INS_PREFETCH, + X86_INS_PREFETCHNTA, + X86_INS_PREFETCHT0, + X86_INS_PREFETCHT1, + X86_INS_PREFETCHT2, + X86_INS_PREFETCHW, + X86_INS_PREFETCHWT1, + X86_INS_PSHUFD, + X86_INS_PSHUFHW, + X86_INS_PSHUFLW, + X86_INS_PSLLDQ, + X86_INS_PSRLDQ, + X86_INS_PSWAPD, + X86_INS_PTEST, + X86_INS_PTWRITE, + X86_INS_PUNPCKHQDQ, + X86_INS_PUNPCKLQDQ, + X86_INS_PUSH, + X86_INS_PUSHAW, + X86_INS_PUSHAL, + X86_INS_PUSHF, + X86_INS_PUSHFD, + X86_INS_PUSHFQ, + X86_INS_RCL, + X86_INS_RCPPS, + X86_INS_RCPSS, + X86_INS_RCR, + X86_INS_RDFSBASE, + X86_INS_RDGSBASE, + X86_INS_RDMSR, + X86_INS_RDPID, + X86_INS_RDPKRU, + X86_INS_RDPMC, + X86_INS_RDRAND, + X86_INS_RDSEED, + X86_INS_RDSSPD, + X86_INS_RDSSPQ, + X86_INS_RDTSC, + X86_INS_RDTSCP, + X86_INS_REPNE, + X86_INS_REP, + X86_INS_RET, + X86_INS_REX64, + X86_INS_ROL, + X86_INS_ROR, + X86_INS_RORX, + X86_INS_ROUNDPD, + X86_INS_ROUNDPS, + X86_INS_ROUNDSD, + X86_INS_ROUNDSS, + X86_INS_RSM, + X86_INS_RSQRTPS, + X86_INS_RSQRTSS, + X86_INS_RSTORSSP, + X86_INS_SAHF, + X86_INS_SAL, + X86_INS_SALC, + X86_INS_SAR, + X86_INS_SARX, + X86_INS_SAVEPREVSSP, + X86_INS_SBB, + X86_INS_SCASB, + X86_INS_SCASD, + X86_INS_SCASQ, + X86_INS_SCASW, + X86_INS_SETAE, + X86_INS_SETA, + X86_INS_SETBE, + X86_INS_SETB, + X86_INS_SETE, + X86_INS_SETGE, + X86_INS_SETG, + X86_INS_SETLE, + X86_INS_SETL, + X86_INS_SETNE, + X86_INS_SETNO, + X86_INS_SETNP, + X86_INS_SETNS, + X86_INS_SETO, + X86_INS_SETP, + X86_INS_SETSSBSY, + X86_INS_SETS, + X86_INS_SFENCE, + X86_INS_SGDT, + X86_INS_SHA1MSG1, + X86_INS_SHA1MSG2, + X86_INS_SHA1NEXTE, + X86_INS_SHA1RNDS4, + X86_INS_SHA256MSG1, + X86_INS_SHA256MSG2, + X86_INS_SHA256RNDS2, + X86_INS_SHL, + X86_INS_SHLD, + X86_INS_SHLX, + X86_INS_SHR, + X86_INS_SHRD, + X86_INS_SHRX, + X86_INS_SHUFPD, + X86_INS_SHUFPS, + X86_INS_SIDT, + X86_INS_FSIN, + X86_INS_SKINIT, + X86_INS_SLDT, + X86_INS_SLWPCB, + X86_INS_SMSW, + X86_INS_SQRTPD, + X86_INS_SQRTPS, + X86_INS_SQRTSD, + X86_INS_SQRTSS, + X86_INS_FSQRT, + X86_INS_STAC, + X86_INS_STC, + X86_INS_STD, + X86_INS_STGI, + X86_INS_STI, + X86_INS_STMXCSR, + X86_INS_STOSB, + X86_INS_STOSD, + X86_INS_STOSQ, + X86_INS_STOSW, + X86_INS_STR, + X86_INS_FST, + X86_INS_FSTP, + X86_INS_SUB, + X86_INS_SUBPD, + X86_INS_SUBPS, + X86_INS_FSUBR, + X86_INS_FISUBR, + X86_INS_FSUBRP, + X86_INS_SUBSD, + X86_INS_SUBSS, + X86_INS_FSUB, + X86_INS_FISUB, + X86_INS_FSUBP, + X86_INS_SWAPGS, + X86_INS_SYSCALL, + X86_INS_SYSENTER, + X86_INS_SYSEXIT, + X86_INS_SYSEXITQ, + X86_INS_SYSRET, + X86_INS_SYSRETQ, + X86_INS_T1MSKC, + X86_INS_TEST, + X86_INS_TPAUSE, + X86_INS_FTST, + X86_INS_TZCNT, + X86_INS_TZMSK, + X86_INS_UCOMISD, + X86_INS_UCOMISS, + X86_INS_FUCOMPI, + X86_INS_FUCOMI, + X86_INS_FUCOMPP, + X86_INS_FUCOMP, + X86_INS_FUCOM, + X86_INS_UD0, + X86_INS_UD1, + X86_INS_UD2, + X86_INS_UMONITOR, + X86_INS_UMWAIT, + X86_INS_UNPCKHPD, + X86_INS_UNPCKHPS, + X86_INS_UNPCKLPD, + X86_INS_UNPCKLPS, + X86_INS_V4FMADDPS, + X86_INS_V4FMADDSS, + X86_INS_V4FNMADDPS, + X86_INS_V4FNMADDSS, + X86_INS_VADDPD, + X86_INS_VADDPS, + X86_INS_VADDSD, + X86_INS_VADDSS, + X86_INS_VADDSUBPD, + X86_INS_VADDSUBPS, + X86_INS_VAESDECLAST, + X86_INS_VAESDEC, + X86_INS_VAESENCLAST, + X86_INS_VAESENC, + X86_INS_VAESIMC, + X86_INS_VAESKEYGENASSIST, + X86_INS_VALIGND, + X86_INS_VALIGNQ, + X86_INS_VANDNPD, + X86_INS_VANDNPS, + X86_INS_VANDPD, + X86_INS_VANDPS, + X86_INS_VBLENDMPD, + X86_INS_VBLENDMPS, + X86_INS_VBLENDPD, + X86_INS_VBLENDPS, + X86_INS_VBLENDVPD, + X86_INS_VBLENDVPS, + X86_INS_VBROADCASTF128, + X86_INS_VBROADCASTF32X2, + X86_INS_VBROADCASTF32X4, + X86_INS_VBROADCASTF32X8, + X86_INS_VBROADCASTF64X2, + X86_INS_VBROADCASTF64X4, + X86_INS_VBROADCASTI128, + X86_INS_VBROADCASTI32X2, + X86_INS_VBROADCASTI32X4, + X86_INS_VBROADCASTI32X8, + X86_INS_VBROADCASTI64X2, + X86_INS_VBROADCASTI64X4, + X86_INS_VBROADCASTSD, + X86_INS_VBROADCASTSS, + X86_INS_VCMP, + X86_INS_VCMPPD, + X86_INS_VCMPPS, + X86_INS_VCMPSD, + X86_INS_VCMPSS, + X86_INS_VCOMISD, + X86_INS_VCOMISS, + X86_INS_VCOMPRESSPD, + X86_INS_VCOMPRESSPS, + X86_INS_VCVTDQ2PD, + X86_INS_VCVTDQ2PS, + X86_INS_VCVTPD2DQ, + X86_INS_VCVTPD2PS, + X86_INS_VCVTPD2QQ, + X86_INS_VCVTPD2UDQ, + X86_INS_VCVTPD2UQQ, + X86_INS_VCVTPH2PS, + X86_INS_VCVTPS2DQ, + X86_INS_VCVTPS2PD, + X86_INS_VCVTPS2PH, + X86_INS_VCVTPS2QQ, + X86_INS_VCVTPS2UDQ, + X86_INS_VCVTPS2UQQ, + X86_INS_VCVTQQ2PD, + X86_INS_VCVTQQ2PS, + X86_INS_VCVTSD2SI, + X86_INS_VCVTSD2SS, + X86_INS_VCVTSD2USI, + X86_INS_VCVTSI2SD, + X86_INS_VCVTSI2SS, + X86_INS_VCVTSS2SD, + X86_INS_VCVTSS2SI, + X86_INS_VCVTSS2USI, + X86_INS_VCVTTPD2DQ, + X86_INS_VCVTTPD2QQ, + X86_INS_VCVTTPD2UDQ, + X86_INS_VCVTTPD2UQQ, + X86_INS_VCVTTPS2DQ, + X86_INS_VCVTTPS2QQ, + X86_INS_VCVTTPS2UDQ, + X86_INS_VCVTTPS2UQQ, + X86_INS_VCVTTSD2SI, + X86_INS_VCVTTSD2USI, + X86_INS_VCVTTSS2SI, + X86_INS_VCVTTSS2USI, + X86_INS_VCVTUDQ2PD, + X86_INS_VCVTUDQ2PS, + X86_INS_VCVTUQQ2PD, + X86_INS_VCVTUQQ2PS, + X86_INS_VCVTUSI2SD, + X86_INS_VCVTUSI2SS, + X86_INS_VDBPSADBW, + X86_INS_VDIVPD, + X86_INS_VDIVPS, + X86_INS_VDIVSD, + X86_INS_VDIVSS, + X86_INS_VDPPD, + X86_INS_VDPPS, + X86_INS_VERR, + X86_INS_VERW, + X86_INS_VEXP2PD, + X86_INS_VEXP2PS, + X86_INS_VEXPANDPD, + X86_INS_VEXPANDPS, + X86_INS_VEXTRACTF128, + X86_INS_VEXTRACTF32X4, + X86_INS_VEXTRACTF32X8, + X86_INS_VEXTRACTF64X2, + X86_INS_VEXTRACTF64X4, + X86_INS_VEXTRACTI128, + X86_INS_VEXTRACTI32X4, + X86_INS_VEXTRACTI32X8, + X86_INS_VEXTRACTI64X2, + X86_INS_VEXTRACTI64X4, + X86_INS_VEXTRACTPS, + X86_INS_VFIXUPIMMPD, + X86_INS_VFIXUPIMMPS, + X86_INS_VFIXUPIMMSD, + X86_INS_VFIXUPIMMSS, + X86_INS_VFMADD132PD, + X86_INS_VFMADD132PS, + X86_INS_VFMADD132SD, + X86_INS_VFMADD132SS, + X86_INS_VFMADD213PD, + X86_INS_VFMADD213PS, + X86_INS_VFMADD213SD, + X86_INS_VFMADD213SS, + X86_INS_VFMADD231PD, + X86_INS_VFMADD231PS, + X86_INS_VFMADD231SD, + X86_INS_VFMADD231SS, + X86_INS_VFMADDPD, + X86_INS_VFMADDPS, + X86_INS_VFMADDSD, + X86_INS_VFMADDSS, + X86_INS_VFMADDSUB132PD, + X86_INS_VFMADDSUB132PS, + X86_INS_VFMADDSUB213PD, + X86_INS_VFMADDSUB213PS, + X86_INS_VFMADDSUB231PD, + X86_INS_VFMADDSUB231PS, + X86_INS_VFMADDSUBPD, + X86_INS_VFMADDSUBPS, + X86_INS_VFMSUB132PD, + X86_INS_VFMSUB132PS, + X86_INS_VFMSUB132SD, + X86_INS_VFMSUB132SS, + X86_INS_VFMSUB213PD, + X86_INS_VFMSUB213PS, + X86_INS_VFMSUB213SD, + X86_INS_VFMSUB213SS, + X86_INS_VFMSUB231PD, + X86_INS_VFMSUB231PS, + X86_INS_VFMSUB231SD, + X86_INS_VFMSUB231SS, + X86_INS_VFMSUBADD132PD, + X86_INS_VFMSUBADD132PS, + X86_INS_VFMSUBADD213PD, + X86_INS_VFMSUBADD213PS, + X86_INS_VFMSUBADD231PD, + X86_INS_VFMSUBADD231PS, + X86_INS_VFMSUBADDPD, + X86_INS_VFMSUBADDPS, + X86_INS_VFMSUBPD, + X86_INS_VFMSUBPS, + X86_INS_VFMSUBSD, + X86_INS_VFMSUBSS, + X86_INS_VFNMADD132PD, + X86_INS_VFNMADD132PS, + X86_INS_VFNMADD132SD, + X86_INS_VFNMADD132SS, + X86_INS_VFNMADD213PD, + X86_INS_VFNMADD213PS, + X86_INS_VFNMADD213SD, + X86_INS_VFNMADD213SS, + X86_INS_VFNMADD231PD, + X86_INS_VFNMADD231PS, + X86_INS_VFNMADD231SD, + X86_INS_VFNMADD231SS, + X86_INS_VFNMADDPD, + X86_INS_VFNMADDPS, + X86_INS_VFNMADDSD, + X86_INS_VFNMADDSS, + X86_INS_VFNMSUB132PD, + X86_INS_VFNMSUB132PS, + X86_INS_VFNMSUB132SD, + X86_INS_VFNMSUB132SS, + X86_INS_VFNMSUB213PD, + X86_INS_VFNMSUB213PS, + X86_INS_VFNMSUB213SD, + X86_INS_VFNMSUB213SS, + X86_INS_VFNMSUB231PD, + X86_INS_VFNMSUB231PS, + X86_INS_VFNMSUB231SD, + X86_INS_VFNMSUB231SS, + X86_INS_VFNMSUBPD, + X86_INS_VFNMSUBPS, + X86_INS_VFNMSUBSD, + X86_INS_VFNMSUBSS, + X86_INS_VFPCLASSPD, + X86_INS_VFPCLASSPS, + X86_INS_VFPCLASSSD, + X86_INS_VFPCLASSSS, + X86_INS_VFRCZPD, + X86_INS_VFRCZPS, + X86_INS_VFRCZSD, + X86_INS_VFRCZSS, + X86_INS_VGATHERDPD, + X86_INS_VGATHERDPS, + X86_INS_VGATHERPF0DPD, + X86_INS_VGATHERPF0DPS, + X86_INS_VGATHERPF0QPD, + X86_INS_VGATHERPF0QPS, + X86_INS_VGATHERPF1DPD, + X86_INS_VGATHERPF1DPS, + X86_INS_VGATHERPF1QPD, + X86_INS_VGATHERPF1QPS, + X86_INS_VGATHERQPD, + X86_INS_VGATHERQPS, + X86_INS_VGETEXPPD, + X86_INS_VGETEXPPS, + X86_INS_VGETEXPSD, + X86_INS_VGETEXPSS, + X86_INS_VGETMANTPD, + X86_INS_VGETMANTPS, + X86_INS_VGETMANTSD, + X86_INS_VGETMANTSS, + X86_INS_VGF2P8AFFINEINVQB, + X86_INS_VGF2P8AFFINEQB, + X86_INS_VGF2P8MULB, + X86_INS_VHADDPD, + X86_INS_VHADDPS, + X86_INS_VHSUBPD, + X86_INS_VHSUBPS, + X86_INS_VINSERTF128, + X86_INS_VINSERTF32X4, + X86_INS_VINSERTF32X8, + X86_INS_VINSERTF64X2, + X86_INS_VINSERTF64X4, + X86_INS_VINSERTI128, + X86_INS_VINSERTI32X4, + X86_INS_VINSERTI32X8, + X86_INS_VINSERTI64X2, + X86_INS_VINSERTI64X4, + X86_INS_VINSERTPS, + X86_INS_VLDDQU, + X86_INS_VLDMXCSR, + X86_INS_VMASKMOVDQU, + X86_INS_VMASKMOVPD, + X86_INS_VMASKMOVPS, + X86_INS_VMAXPD, + X86_INS_VMAXPS, + X86_INS_VMAXSD, + X86_INS_VMAXSS, + X86_INS_VMCALL, + X86_INS_VMCLEAR, + X86_INS_VMFUNC, + X86_INS_VMINPD, + X86_INS_VMINPS, + X86_INS_VMINSD, + X86_INS_VMINSS, + X86_INS_VMLAUNCH, + X86_INS_VMLOAD, + X86_INS_VMMCALL, + X86_INS_VMOVQ, + X86_INS_VMOVAPD, + X86_INS_VMOVAPS, + X86_INS_VMOVDDUP, + X86_INS_VMOVD, + X86_INS_VMOVDQA32, + X86_INS_VMOVDQA64, + X86_INS_VMOVDQA, + X86_INS_VMOVDQU16, + X86_INS_VMOVDQU32, + X86_INS_VMOVDQU64, + X86_INS_VMOVDQU8, + X86_INS_VMOVDQU, + X86_INS_VMOVHLPS, + X86_INS_VMOVHPD, + X86_INS_VMOVHPS, + X86_INS_VMOVLHPS, + X86_INS_VMOVLPD, + X86_INS_VMOVLPS, + X86_INS_VMOVMSKPD, + X86_INS_VMOVMSKPS, + X86_INS_VMOVNTDQA, + X86_INS_VMOVNTDQ, + X86_INS_VMOVNTPD, + X86_INS_VMOVNTPS, + X86_INS_VMOVSD, + X86_INS_VMOVSHDUP, + X86_INS_VMOVSLDUP, + X86_INS_VMOVSS, + X86_INS_VMOVUPD, + X86_INS_VMOVUPS, + X86_INS_VMPSADBW, + X86_INS_VMPTRLD, + X86_INS_VMPTRST, + X86_INS_VMREAD, + X86_INS_VMRESUME, + X86_INS_VMRUN, + X86_INS_VMSAVE, + X86_INS_VMULPD, + X86_INS_VMULPS, + X86_INS_VMULSD, + X86_INS_VMULSS, + X86_INS_VMWRITE, + X86_INS_VMXOFF, + X86_INS_VMXON, + X86_INS_VORPD, + X86_INS_VORPS, + X86_INS_VP4DPWSSDS, + X86_INS_VP4DPWSSD, + X86_INS_VPABSB, + X86_INS_VPABSD, + X86_INS_VPABSQ, + X86_INS_VPABSW, + X86_INS_VPACKSSDW, + X86_INS_VPACKSSWB, + X86_INS_VPACKUSDW, + X86_INS_VPACKUSWB, + X86_INS_VPADDB, + X86_INS_VPADDD, + X86_INS_VPADDQ, + X86_INS_VPADDSB, + X86_INS_VPADDSW, + X86_INS_VPADDUSB, + X86_INS_VPADDUSW, + X86_INS_VPADDW, + X86_INS_VPALIGNR, + X86_INS_VPANDD, + X86_INS_VPANDND, + X86_INS_VPANDNQ, + X86_INS_VPANDN, + X86_INS_VPANDQ, + X86_INS_VPAND, + X86_INS_VPAVGB, + X86_INS_VPAVGW, + X86_INS_VPBLENDD, + X86_INS_VPBLENDMB, + X86_INS_VPBLENDMD, + X86_INS_VPBLENDMQ, + X86_INS_VPBLENDMW, + X86_INS_VPBLENDVB, + X86_INS_VPBLENDW, + X86_INS_VPBROADCASTB, + X86_INS_VPBROADCASTD, + X86_INS_VPBROADCASTMB2Q, + X86_INS_VPBROADCASTMW2D, + X86_INS_VPBROADCASTQ, + X86_INS_VPBROADCASTW, + X86_INS_VPCLMULQDQ, + X86_INS_VPCMOV, + X86_INS_VPCMP, + X86_INS_VPCMPB, + X86_INS_VPCMPD, + X86_INS_VPCMPEQB, + X86_INS_VPCMPEQD, + X86_INS_VPCMPEQQ, + X86_INS_VPCMPEQW, + X86_INS_VPCMPESTRI, + X86_INS_VPCMPESTRM, + X86_INS_VPCMPGTB, + X86_INS_VPCMPGTD, + X86_INS_VPCMPGTQ, + X86_INS_VPCMPGTW, + X86_INS_VPCMPISTRI, + X86_INS_VPCMPISTRM, + X86_INS_VPCMPQ, + X86_INS_VPCMPUB, + X86_INS_VPCMPUD, + X86_INS_VPCMPUQ, + X86_INS_VPCMPUW, + X86_INS_VPCMPW, + X86_INS_VPCOM, + X86_INS_VPCOMB, + X86_INS_VPCOMD, + X86_INS_VPCOMPRESSB, + X86_INS_VPCOMPRESSD, + X86_INS_VPCOMPRESSQ, + X86_INS_VPCOMPRESSW, + X86_INS_VPCOMQ, + X86_INS_VPCOMUB, + X86_INS_VPCOMUD, + X86_INS_VPCOMUQ, + X86_INS_VPCOMUW, + X86_INS_VPCOMW, + X86_INS_VPCONFLICTD, + X86_INS_VPCONFLICTQ, + X86_INS_VPDPBUSDS, + X86_INS_VPDPBUSD, + X86_INS_VPDPWSSDS, + X86_INS_VPDPWSSD, + X86_INS_VPERM2F128, + X86_INS_VPERM2I128, + X86_INS_VPERMB, + X86_INS_VPERMD, + X86_INS_VPERMI2B, + X86_INS_VPERMI2D, + X86_INS_VPERMI2PD, + X86_INS_VPERMI2PS, + X86_INS_VPERMI2Q, + X86_INS_VPERMI2W, + X86_INS_VPERMIL2PD, + X86_INS_VPERMILPD, + X86_INS_VPERMIL2PS, + X86_INS_VPERMILPS, + X86_INS_VPERMPD, + X86_INS_VPERMPS, + X86_INS_VPERMQ, + X86_INS_VPERMT2B, + X86_INS_VPERMT2D, + X86_INS_VPERMT2PD, + X86_INS_VPERMT2PS, + X86_INS_VPERMT2Q, + X86_INS_VPERMT2W, + X86_INS_VPERMW, + X86_INS_VPEXPANDB, + X86_INS_VPEXPANDD, + X86_INS_VPEXPANDQ, + X86_INS_VPEXPANDW, + X86_INS_VPEXTRB, + X86_INS_VPEXTRD, + X86_INS_VPEXTRQ, + X86_INS_VPEXTRW, + X86_INS_VPGATHERDD, + X86_INS_VPGATHERDQ, + X86_INS_VPGATHERQD, + X86_INS_VPGATHERQQ, + X86_INS_VPHADDBD, + X86_INS_VPHADDBQ, + X86_INS_VPHADDBW, + X86_INS_VPHADDDQ, + X86_INS_VPHADDD, + X86_INS_VPHADDSW, + X86_INS_VPHADDUBD, + X86_INS_VPHADDUBQ, + X86_INS_VPHADDUBW, + X86_INS_VPHADDUDQ, + X86_INS_VPHADDUWD, + X86_INS_VPHADDUWQ, + X86_INS_VPHADDWD, + X86_INS_VPHADDWQ, + X86_INS_VPHADDW, + X86_INS_VPHMINPOSUW, + X86_INS_VPHSUBBW, + X86_INS_VPHSUBDQ, + X86_INS_VPHSUBD, + X86_INS_VPHSUBSW, + X86_INS_VPHSUBWD, + X86_INS_VPHSUBW, + X86_INS_VPINSRB, + X86_INS_VPINSRD, + X86_INS_VPINSRQ, + X86_INS_VPINSRW, + X86_INS_VPLZCNTD, + X86_INS_VPLZCNTQ, + X86_INS_VPMACSDD, + X86_INS_VPMACSDQH, + X86_INS_VPMACSDQL, + X86_INS_VPMACSSDD, + X86_INS_VPMACSSDQH, + X86_INS_VPMACSSDQL, + X86_INS_VPMACSSWD, + X86_INS_VPMACSSWW, + X86_INS_VPMACSWD, + X86_INS_VPMACSWW, + X86_INS_VPMADCSSWD, + X86_INS_VPMADCSWD, + X86_INS_VPMADD52HUQ, + X86_INS_VPMADD52LUQ, + X86_INS_VPMADDUBSW, + X86_INS_VPMADDWD, + X86_INS_VPMASKMOVD, + X86_INS_VPMASKMOVQ, + X86_INS_VPMAXSB, + X86_INS_VPMAXSD, + X86_INS_VPMAXSQ, + X86_INS_VPMAXSW, + X86_INS_VPMAXUB, + X86_INS_VPMAXUD, + X86_INS_VPMAXUQ, + X86_INS_VPMAXUW, + X86_INS_VPMINSB, + X86_INS_VPMINSD, + X86_INS_VPMINSQ, + X86_INS_VPMINSW, + X86_INS_VPMINUB, + X86_INS_VPMINUD, + X86_INS_VPMINUQ, + X86_INS_VPMINUW, + X86_INS_VPMOVB2M, + X86_INS_VPMOVD2M, + X86_INS_VPMOVDB, + X86_INS_VPMOVDW, + X86_INS_VPMOVM2B, + X86_INS_VPMOVM2D, + X86_INS_VPMOVM2Q, + X86_INS_VPMOVM2W, + X86_INS_VPMOVMSKB, + X86_INS_VPMOVQ2M, + X86_INS_VPMOVQB, + X86_INS_VPMOVQD, + X86_INS_VPMOVQW, + X86_INS_VPMOVSDB, + X86_INS_VPMOVSDW, + X86_INS_VPMOVSQB, + X86_INS_VPMOVSQD, + X86_INS_VPMOVSQW, + X86_INS_VPMOVSWB, + X86_INS_VPMOVSXBD, + X86_INS_VPMOVSXBQ, + X86_INS_VPMOVSXBW, + X86_INS_VPMOVSXDQ, + X86_INS_VPMOVSXWD, + X86_INS_VPMOVSXWQ, + X86_INS_VPMOVUSDB, + X86_INS_VPMOVUSDW, + X86_INS_VPMOVUSQB, + X86_INS_VPMOVUSQD, + X86_INS_VPMOVUSQW, + X86_INS_VPMOVUSWB, + X86_INS_VPMOVW2M, + X86_INS_VPMOVWB, + X86_INS_VPMOVZXBD, + X86_INS_VPMOVZXBQ, + X86_INS_VPMOVZXBW, + X86_INS_VPMOVZXDQ, + X86_INS_VPMOVZXWD, + X86_INS_VPMOVZXWQ, + X86_INS_VPMULDQ, + X86_INS_VPMULHRSW, + X86_INS_VPMULHUW, + X86_INS_VPMULHW, + X86_INS_VPMULLD, + X86_INS_VPMULLQ, + X86_INS_VPMULLW, + X86_INS_VPMULTISHIFTQB, + X86_INS_VPMULUDQ, + X86_INS_VPOPCNTB, + X86_INS_VPOPCNTD, + X86_INS_VPOPCNTQ, + X86_INS_VPOPCNTW, + X86_INS_VPORD, + X86_INS_VPORQ, + X86_INS_VPOR, + X86_INS_VPPERM, + X86_INS_VPROLD, + X86_INS_VPROLQ, + X86_INS_VPROLVD, + X86_INS_VPROLVQ, + X86_INS_VPRORD, + X86_INS_VPRORQ, + X86_INS_VPRORVD, + X86_INS_VPRORVQ, + X86_INS_VPROTB, + X86_INS_VPROTD, + X86_INS_VPROTQ, + X86_INS_VPROTW, + X86_INS_VPSADBW, + X86_INS_VPSCATTERDD, + X86_INS_VPSCATTERDQ, + X86_INS_VPSCATTERQD, + X86_INS_VPSCATTERQQ, + X86_INS_VPSHAB, + X86_INS_VPSHAD, + X86_INS_VPSHAQ, + X86_INS_VPSHAW, + X86_INS_VPSHLB, + X86_INS_VPSHLDD, + X86_INS_VPSHLDQ, + X86_INS_VPSHLDVD, + X86_INS_VPSHLDVQ, + X86_INS_VPSHLDVW, + X86_INS_VPSHLDW, + X86_INS_VPSHLD, + X86_INS_VPSHLQ, + X86_INS_VPSHLW, + X86_INS_VPSHRDD, + X86_INS_VPSHRDQ, + X86_INS_VPSHRDVD, + X86_INS_VPSHRDVQ, + X86_INS_VPSHRDVW, + X86_INS_VPSHRDW, + X86_INS_VPSHUFBITQMB, + X86_INS_VPSHUFB, + X86_INS_VPSHUFD, + X86_INS_VPSHUFHW, + X86_INS_VPSHUFLW, + X86_INS_VPSIGNB, + X86_INS_VPSIGND, + X86_INS_VPSIGNW, + X86_INS_VPSLLDQ, + X86_INS_VPSLLD, + X86_INS_VPSLLQ, + X86_INS_VPSLLVD, + X86_INS_VPSLLVQ, + X86_INS_VPSLLVW, + X86_INS_VPSLLW, + X86_INS_VPSRAD, + X86_INS_VPSRAQ, + X86_INS_VPSRAVD, + X86_INS_VPSRAVQ, + X86_INS_VPSRAVW, + X86_INS_VPSRAW, + X86_INS_VPSRLDQ, + X86_INS_VPSRLD, + X86_INS_VPSRLQ, + X86_INS_VPSRLVD, + X86_INS_VPSRLVQ, + X86_INS_VPSRLVW, + X86_INS_VPSRLW, + X86_INS_VPSUBB, + X86_INS_VPSUBD, + X86_INS_VPSUBQ, + X86_INS_VPSUBSB, + X86_INS_VPSUBSW, + X86_INS_VPSUBUSB, + X86_INS_VPSUBUSW, + X86_INS_VPSUBW, + X86_INS_VPTERNLOGD, + X86_INS_VPTERNLOGQ, + X86_INS_VPTESTMB, + X86_INS_VPTESTMD, + X86_INS_VPTESTMQ, + X86_INS_VPTESTMW, + X86_INS_VPTESTNMB, + X86_INS_VPTESTNMD, + X86_INS_VPTESTNMQ, + X86_INS_VPTESTNMW, + X86_INS_VPTEST, + X86_INS_VPUNPCKHBW, + X86_INS_VPUNPCKHDQ, + X86_INS_VPUNPCKHQDQ, + X86_INS_VPUNPCKHWD, + X86_INS_VPUNPCKLBW, + X86_INS_VPUNPCKLDQ, + X86_INS_VPUNPCKLQDQ, + X86_INS_VPUNPCKLWD, + X86_INS_VPXORD, + X86_INS_VPXORQ, + X86_INS_VPXOR, + X86_INS_VRANGEPD, + X86_INS_VRANGEPS, + X86_INS_VRANGESD, + X86_INS_VRANGESS, + X86_INS_VRCP14PD, + X86_INS_VRCP14PS, + X86_INS_VRCP14SD, + X86_INS_VRCP14SS, + X86_INS_VRCP28PD, + X86_INS_VRCP28PS, + X86_INS_VRCP28SD, + X86_INS_VRCP28SS, + X86_INS_VRCPPS, + X86_INS_VRCPSS, + X86_INS_VREDUCEPD, + X86_INS_VREDUCEPS, + X86_INS_VREDUCESD, + X86_INS_VREDUCESS, + X86_INS_VRNDSCALEPD, + X86_INS_VRNDSCALEPS, + X86_INS_VRNDSCALESD, + X86_INS_VRNDSCALESS, + X86_INS_VROUNDPD, + X86_INS_VROUNDPS, + X86_INS_VROUNDSD, + X86_INS_VROUNDSS, + X86_INS_VRSQRT14PD, + X86_INS_VRSQRT14PS, + X86_INS_VRSQRT14SD, + X86_INS_VRSQRT14SS, + X86_INS_VRSQRT28PD, + X86_INS_VRSQRT28PS, + X86_INS_VRSQRT28SD, + X86_INS_VRSQRT28SS, + X86_INS_VRSQRTPS, + X86_INS_VRSQRTSS, + X86_INS_VSCALEFPD, + X86_INS_VSCALEFPS, + X86_INS_VSCALEFSD, + X86_INS_VSCALEFSS, + X86_INS_VSCATTERDPD, + X86_INS_VSCATTERDPS, + X86_INS_VSCATTERPF0DPD, + X86_INS_VSCATTERPF0DPS, + X86_INS_VSCATTERPF0QPD, + X86_INS_VSCATTERPF0QPS, + X86_INS_VSCATTERPF1DPD, + X86_INS_VSCATTERPF1DPS, + X86_INS_VSCATTERPF1QPD, + X86_INS_VSCATTERPF1QPS, + X86_INS_VSCATTERQPD, + X86_INS_VSCATTERQPS, + X86_INS_VSHUFF32X4, + X86_INS_VSHUFF64X2, + X86_INS_VSHUFI32X4, + X86_INS_VSHUFI64X2, + X86_INS_VSHUFPD, + X86_INS_VSHUFPS, + X86_INS_VSQRTPD, + X86_INS_VSQRTPS, + X86_INS_VSQRTSD, + X86_INS_VSQRTSS, + X86_INS_VSTMXCSR, + X86_INS_VSUBPD, + X86_INS_VSUBPS, + X86_INS_VSUBSD, + X86_INS_VSUBSS, + X86_INS_VTESTPD, + X86_INS_VTESTPS, + X86_INS_VUCOMISD, + X86_INS_VUCOMISS, + X86_INS_VUNPCKHPD, + X86_INS_VUNPCKHPS, + X86_INS_VUNPCKLPD, + X86_INS_VUNPCKLPS, + X86_INS_VXORPD, + X86_INS_VXORPS, + X86_INS_VZEROALL, + X86_INS_VZEROUPPER, + X86_INS_WAIT, + X86_INS_WBINVD, + X86_INS_WBNOINVD, + X86_INS_WRFSBASE, + X86_INS_WRGSBASE, + X86_INS_WRMSR, + X86_INS_WRPKRU, + X86_INS_WRSSD, + X86_INS_WRSSQ, + X86_INS_WRUSSD, + X86_INS_WRUSSQ, + X86_INS_XABORT, + X86_INS_XACQUIRE, + X86_INS_XADD, + X86_INS_XBEGIN, + X86_INS_XCHG, + X86_INS_FXCH, + X86_INS_XCRYPTCBC, + X86_INS_XCRYPTCFB, + X86_INS_XCRYPTCTR, + X86_INS_XCRYPTECB, + X86_INS_XCRYPTOFB, + X86_INS_XEND, + X86_INS_XGETBV, + X86_INS_XLATB, + X86_INS_XOR, + X86_INS_XORPD, + X86_INS_XORPS, + X86_INS_XRELEASE, + X86_INS_XRSTOR, + X86_INS_XRSTOR64, + X86_INS_XRSTORS, + X86_INS_XRSTORS64, + X86_INS_XSAVE, + X86_INS_XSAVE64, + X86_INS_XSAVEC, + X86_INS_XSAVEC64, + X86_INS_XSAVEOPT, + X86_INS_XSAVEOPT64, + X86_INS_XSAVES, + X86_INS_XSAVES64, + X86_INS_XSETBV, + X86_INS_XSHA1, + X86_INS_XSHA256, + X86_INS_XSTORE, + X86_INS_XTEST, + + X86_INS_ENDING, // mark the end of the list of insn +} x86_insn; + +/// Group of X86 instructions +typedef enum x86_insn_group { + X86_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + // Generic groups + // all jump instructions (conditional+direct+indirect jumps) + X86_GRP_JUMP, ///< = CS_GRP_JUMP + // all call instructions + X86_GRP_CALL, ///< = CS_GRP_CALL + // all return instructions + X86_GRP_RET, ///< = CS_GRP_RET + // all interrupt instructions (int+syscall) + X86_GRP_INT, ///< = CS_GRP_INT + // all interrupt return instructions + X86_GRP_IRET, ///< = CS_GRP_IRET + // all privileged instructions + X86_GRP_PRIVILEGE, ///< = CS_GRP_PRIVILEGE + // all relative branching instructions + X86_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE + + // Architecture-specific groups + X86_GRP_VM = 128, ///< all virtualization instructions (VT-x + AMD-V) + X86_GRP_3DNOW, + X86_GRP_AES, + X86_GRP_ADX, + X86_GRP_AVX, + X86_GRP_AVX2, + X86_GRP_AVX512, + X86_GRP_BMI, + X86_GRP_BMI2, + X86_GRP_CMOV, + X86_GRP_F16C, + X86_GRP_FMA, + X86_GRP_FMA4, + X86_GRP_FSGSBASE, + X86_GRP_HLE, + X86_GRP_MMX, + X86_GRP_MODE32, + X86_GRP_MODE64, + X86_GRP_RTM, + X86_GRP_SHA, + X86_GRP_SSE1, + X86_GRP_SSE2, + X86_GRP_SSE3, + X86_GRP_SSE41, + X86_GRP_SSE42, + X86_GRP_SSE4A, + X86_GRP_SSSE3, + X86_GRP_PCLMUL, + X86_GRP_XOP, + X86_GRP_CDI, + X86_GRP_ERI, + X86_GRP_TBM, + X86_GRP_16BITMODE, + X86_GRP_NOT64BITMODE, + X86_GRP_SGX, + X86_GRP_DQI, + X86_GRP_BWI, + X86_GRP_PFI, + X86_GRP_VLX, + X86_GRP_SMAP, + X86_GRP_NOVLX, + X86_GRP_FPU, + + X86_GRP_ENDING +} x86_insn_group; + +#ifdef __cplusplus +} +#endif + +#endif +#ifndef CAPSTONE_XCORE_H +#define CAPSTONE_XCORE_H + +/* Capstone Disassembly Engine */ +/* By Nguyen Anh Quynh , 2014-2015 */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +/// Operand type for instruction's operands +typedef enum xcore_op_type { + XCORE_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + XCORE_OP_REG, ///< = CS_OP_REG (Register operand). + XCORE_OP_IMM, ///< = CS_OP_IMM (Immediate operand). + XCORE_OP_MEM, ///< = CS_OP_MEM (Memory operand). +} xcore_op_type; + +/// XCore registers +typedef enum xcore_reg { + XCORE_REG_INVALID = 0, + + XCORE_REG_CP, + XCORE_REG_DP, + XCORE_REG_LR, + XCORE_REG_SP, + XCORE_REG_R0, + XCORE_REG_R1, + XCORE_REG_R2, + XCORE_REG_R3, + XCORE_REG_R4, + XCORE_REG_R5, + XCORE_REG_R6, + XCORE_REG_R7, + XCORE_REG_R8, + XCORE_REG_R9, + XCORE_REG_R10, + XCORE_REG_R11, + + // pseudo registers + XCORE_REG_PC, ///< pc + + // internal thread registers + // see The-XMOS-XS1-Architecture(X7879A).pdf + XCORE_REG_SCP, ///< save pc + XCORE_REG_SSR, //< save status + XCORE_REG_ET, //< exception type + XCORE_REG_ED, //< exception data + XCORE_REG_SED, //< save exception data + XCORE_REG_KEP, //< kernel entry pointer + XCORE_REG_KSP, //< kernel stack pointer + XCORE_REG_ID, //< thread ID + + XCORE_REG_ENDING, // <-- mark the end of the list of registers +} xcore_reg; + +/// Instruction's operand referring to memory +/// This is associated with XCORE_OP_MEM operand type above +typedef struct xcore_op_mem { + uint8_t base; ///< base register, can be safely interpreted as + ///< a value of type `xcore_reg`, but it is only + ///< one byte wide + uint8_t index; ///< index register, same conditions apply here + int32_t disp; ///< displacement/offset value + int direct; ///< +1: forward, -1: backward +} xcore_op_mem; + +/// Instruction operand +typedef struct cs_xcore_op { + xcore_op_type type; ///< operand type + union { + xcore_reg reg; ///< register value for REG operand + int32_t imm; ///< immediate value for IMM operand + xcore_op_mem mem; ///< base/disp value for MEM operand + }; +} cs_xcore_op; + +/// Instruction structure +typedef struct cs_xcore { + /// Number of operands of this instruction, + /// or 0 when instruction has no operand. + uint8_t op_count; + cs_xcore_op operands[8]; ///< operands for this instruction. +} cs_xcore; + +/// XCore instruction +typedef enum xcore_insn { + XCORE_INS_INVALID = 0, + + XCORE_INS_ADD, + XCORE_INS_ANDNOT, + XCORE_INS_AND, + XCORE_INS_ASHR, + XCORE_INS_BAU, + XCORE_INS_BITREV, + XCORE_INS_BLA, + XCORE_INS_BLAT, + XCORE_INS_BL, + XCORE_INS_BF, + XCORE_INS_BT, + XCORE_INS_BU, + XCORE_INS_BRU, + XCORE_INS_BYTEREV, + XCORE_INS_CHKCT, + XCORE_INS_CLRE, + XCORE_INS_CLRPT, + XCORE_INS_CLRSR, + XCORE_INS_CLZ, + XCORE_INS_CRC8, + XCORE_INS_CRC32, + XCORE_INS_DCALL, + XCORE_INS_DENTSP, + XCORE_INS_DGETREG, + XCORE_INS_DIVS, + XCORE_INS_DIVU, + XCORE_INS_DRESTSP, + XCORE_INS_DRET, + XCORE_INS_ECALLF, + XCORE_INS_ECALLT, + XCORE_INS_EDU, + XCORE_INS_EEF, + XCORE_INS_EET, + XCORE_INS_EEU, + XCORE_INS_ENDIN, + XCORE_INS_ENTSP, + XCORE_INS_EQ, + XCORE_INS_EXTDP, + XCORE_INS_EXTSP, + XCORE_INS_FREER, + XCORE_INS_FREET, + XCORE_INS_GETD, + XCORE_INS_GET, + XCORE_INS_GETN, + XCORE_INS_GETR, + XCORE_INS_GETSR, + XCORE_INS_GETST, + XCORE_INS_GETTS, + XCORE_INS_INCT, + XCORE_INS_INIT, + XCORE_INS_INPW, + XCORE_INS_INSHR, + XCORE_INS_INT, + XCORE_INS_IN, + XCORE_INS_KCALL, + XCORE_INS_KENTSP, + XCORE_INS_KRESTSP, + XCORE_INS_KRET, + XCORE_INS_LADD, + XCORE_INS_LD16S, + XCORE_INS_LD8U, + XCORE_INS_LDA16, + XCORE_INS_LDAP, + XCORE_INS_LDAW, + XCORE_INS_LDC, + XCORE_INS_LDW, + XCORE_INS_LDIVU, + XCORE_INS_LMUL, + XCORE_INS_LSS, + XCORE_INS_LSUB, + XCORE_INS_LSU, + XCORE_INS_MACCS, + XCORE_INS_MACCU, + XCORE_INS_MJOIN, + XCORE_INS_MKMSK, + XCORE_INS_MSYNC, + XCORE_INS_MUL, + XCORE_INS_NEG, + XCORE_INS_NOT, + XCORE_INS_OR, + XCORE_INS_OUTCT, + XCORE_INS_OUTPW, + XCORE_INS_OUTSHR, + XCORE_INS_OUTT, + XCORE_INS_OUT, + XCORE_INS_PEEK, + XCORE_INS_REMS, + XCORE_INS_REMU, + XCORE_INS_RETSP, + XCORE_INS_SETCLK, + XCORE_INS_SET, + XCORE_INS_SETC, + XCORE_INS_SETD, + XCORE_INS_SETEV, + XCORE_INS_SETN, + XCORE_INS_SETPSC, + XCORE_INS_SETPT, + XCORE_INS_SETRDY, + XCORE_INS_SETSR, + XCORE_INS_SETTW, + XCORE_INS_SETV, + XCORE_INS_SEXT, + XCORE_INS_SHL, + XCORE_INS_SHR, + XCORE_INS_SSYNC, + XCORE_INS_ST16, + XCORE_INS_ST8, + XCORE_INS_STW, + XCORE_INS_SUB, + XCORE_INS_SYNCR, + XCORE_INS_TESTCT, + XCORE_INS_TESTLCL, + XCORE_INS_TESTWCT, + XCORE_INS_TSETMR, + XCORE_INS_START, + XCORE_INS_WAITEF, + XCORE_INS_WAITET, + XCORE_INS_WAITEU, + XCORE_INS_XOR, + XCORE_INS_ZEXT, + + XCORE_INS_ENDING, // <-- mark the end of the list of instructions +} xcore_insn; + +/// Group of XCore instructions +typedef enum xcore_insn_group { + XCORE_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + // Generic groups + // all jump instructions (conditional+direct+indirect jumps) + XCORE_GRP_JUMP, ///< = CS_GRP_JUMP + + XCORE_GRP_ENDING, // <-- mark the end of the list of groups +} xcore_insn_group; + +#ifdef __cplusplus +} +#endif + +#endif +/* Capstone Disassembly Engine */ +/* TMS320C64x Backend by Fotis Loukos 2016 */ + +#ifndef CAPSTONE_TMS320C64X_H +#define CAPSTONE_TMS320C64X_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +typedef enum tms320c64x_op_type { + TMS320C64X_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + TMS320C64X_OP_REG, ///< = CS_OP_REG (Register operand). + TMS320C64X_OP_IMM, ///< = CS_OP_IMM (Immediate operand). + TMS320C64X_OP_MEM, ///< = CS_OP_MEM (Memory operand). + TMS320C64X_OP_REGPAIR = 64, ///< Register pair for double word ops +} tms320c64x_op_type; + +typedef enum tms320c64x_mem_disp { + TMS320C64X_MEM_DISP_INVALID = 0, + TMS320C64X_MEM_DISP_CONSTANT, + TMS320C64X_MEM_DISP_REGISTER, +} tms320c64x_mem_disp; + +typedef enum tms320c64x_mem_dir { + TMS320C64X_MEM_DIR_INVALID = 0, + TMS320C64X_MEM_DIR_FW, + TMS320C64X_MEM_DIR_BW, +} tms320c64x_mem_dir; + +typedef enum tms320c64x_mem_mod { + TMS320C64X_MEM_MOD_INVALID = 0, + TMS320C64X_MEM_MOD_NO, + TMS320C64X_MEM_MOD_PRE, + TMS320C64X_MEM_MOD_POST, +} tms320c64x_mem_mod; + +typedef struct tms320c64x_op_mem { + unsigned int base; ///< base register + unsigned int disp; ///< displacement/offset value + unsigned int unit; ///< unit of base and offset register + unsigned int scaled; ///< offset scaled + unsigned int disptype; ///< displacement type + unsigned int direction; ///< direction + unsigned int modify; ///< modification +} tms320c64x_op_mem; + +typedef struct cs_tms320c64x_op { + tms320c64x_op_type type; ///< operand type + union { + unsigned int reg; ///< register value for REG operand or first register for REGPAIR operand + int32_t imm; ///< immediate value for IMM operand + tms320c64x_op_mem mem; ///< base/disp value for MEM operand + }; +} cs_tms320c64x_op; + +typedef struct cs_tms320c64x { + uint8_t op_count; + cs_tms320c64x_op operands[8]; ///< operands for this instruction. + struct { + unsigned int reg; + unsigned int zero; + } condition; + struct { + unsigned int unit; + unsigned int side; + unsigned int crosspath; + } funit; + unsigned int parallel; +} cs_tms320c64x; + +typedef enum tms320c64x_reg { + TMS320C64X_REG_INVALID = 0, + + TMS320C64X_REG_AMR, + TMS320C64X_REG_CSR, + TMS320C64X_REG_DIER, + TMS320C64X_REG_DNUM, + TMS320C64X_REG_ECR, + TMS320C64X_REG_GFPGFR, + TMS320C64X_REG_GPLYA, + TMS320C64X_REG_GPLYB, + TMS320C64X_REG_ICR, + TMS320C64X_REG_IER, + TMS320C64X_REG_IERR, + TMS320C64X_REG_ILC, + TMS320C64X_REG_IRP, + TMS320C64X_REG_ISR, + TMS320C64X_REG_ISTP, + TMS320C64X_REG_ITSR, + TMS320C64X_REG_NRP, + TMS320C64X_REG_NTSR, + TMS320C64X_REG_REP, + TMS320C64X_REG_RILC, + TMS320C64X_REG_SSR, + TMS320C64X_REG_TSCH, + TMS320C64X_REG_TSCL, + TMS320C64X_REG_TSR, + TMS320C64X_REG_A0, + TMS320C64X_REG_A1, + TMS320C64X_REG_A2, + TMS320C64X_REG_A3, + TMS320C64X_REG_A4, + TMS320C64X_REG_A5, + TMS320C64X_REG_A6, + TMS320C64X_REG_A7, + TMS320C64X_REG_A8, + TMS320C64X_REG_A9, + TMS320C64X_REG_A10, + TMS320C64X_REG_A11, + TMS320C64X_REG_A12, + TMS320C64X_REG_A13, + TMS320C64X_REG_A14, + TMS320C64X_REG_A15, + TMS320C64X_REG_A16, + TMS320C64X_REG_A17, + TMS320C64X_REG_A18, + TMS320C64X_REG_A19, + TMS320C64X_REG_A20, + TMS320C64X_REG_A21, + TMS320C64X_REG_A22, + TMS320C64X_REG_A23, + TMS320C64X_REG_A24, + TMS320C64X_REG_A25, + TMS320C64X_REG_A26, + TMS320C64X_REG_A27, + TMS320C64X_REG_A28, + TMS320C64X_REG_A29, + TMS320C64X_REG_A30, + TMS320C64X_REG_A31, + TMS320C64X_REG_B0, + TMS320C64X_REG_B1, + TMS320C64X_REG_B2, + TMS320C64X_REG_B3, + TMS320C64X_REG_B4, + TMS320C64X_REG_B5, + TMS320C64X_REG_B6, + TMS320C64X_REG_B7, + TMS320C64X_REG_B8, + TMS320C64X_REG_B9, + TMS320C64X_REG_B10, + TMS320C64X_REG_B11, + TMS320C64X_REG_B12, + TMS320C64X_REG_B13, + TMS320C64X_REG_B14, + TMS320C64X_REG_B15, + TMS320C64X_REG_B16, + TMS320C64X_REG_B17, + TMS320C64X_REG_B18, + TMS320C64X_REG_B19, + TMS320C64X_REG_B20, + TMS320C64X_REG_B21, + TMS320C64X_REG_B22, + TMS320C64X_REG_B23, + TMS320C64X_REG_B24, + TMS320C64X_REG_B25, + TMS320C64X_REG_B26, + TMS320C64X_REG_B27, + TMS320C64X_REG_B28, + TMS320C64X_REG_B29, + TMS320C64X_REG_B30, + TMS320C64X_REG_B31, + TMS320C64X_REG_PCE1, + + TMS320C64X_REG_ENDING, // <-- mark the end of the list of registers + + // Alias registers + TMS320C64X_REG_EFR = TMS320C64X_REG_ECR, + TMS320C64X_REG_IFR = TMS320C64X_REG_ISR, +} tms320c64x_reg; + +typedef enum tms320c64x_insn { + TMS320C64X_INS_INVALID = 0, + + TMS320C64X_INS_ABS, + TMS320C64X_INS_ABS2, + TMS320C64X_INS_ADD, + TMS320C64X_INS_ADD2, + TMS320C64X_INS_ADD4, + TMS320C64X_INS_ADDAB, + TMS320C64X_INS_ADDAD, + TMS320C64X_INS_ADDAH, + TMS320C64X_INS_ADDAW, + TMS320C64X_INS_ADDK, + TMS320C64X_INS_ADDKPC, + TMS320C64X_INS_ADDU, + TMS320C64X_INS_AND, + TMS320C64X_INS_ANDN, + TMS320C64X_INS_AVG2, + TMS320C64X_INS_AVGU4, + TMS320C64X_INS_B, + TMS320C64X_INS_BDEC, + TMS320C64X_INS_BITC4, + TMS320C64X_INS_BNOP, + TMS320C64X_INS_BPOS, + TMS320C64X_INS_CLR, + TMS320C64X_INS_CMPEQ, + TMS320C64X_INS_CMPEQ2, + TMS320C64X_INS_CMPEQ4, + TMS320C64X_INS_CMPGT, + TMS320C64X_INS_CMPGT2, + TMS320C64X_INS_CMPGTU4, + TMS320C64X_INS_CMPLT, + TMS320C64X_INS_CMPLTU, + TMS320C64X_INS_DEAL, + TMS320C64X_INS_DOTP2, + TMS320C64X_INS_DOTPN2, + TMS320C64X_INS_DOTPNRSU2, + TMS320C64X_INS_DOTPRSU2, + TMS320C64X_INS_DOTPSU4, + TMS320C64X_INS_DOTPU4, + TMS320C64X_INS_EXT, + TMS320C64X_INS_EXTU, + TMS320C64X_INS_GMPGTU, + TMS320C64X_INS_GMPY4, + TMS320C64X_INS_LDB, + TMS320C64X_INS_LDBU, + TMS320C64X_INS_LDDW, + TMS320C64X_INS_LDH, + TMS320C64X_INS_LDHU, + TMS320C64X_INS_LDNDW, + TMS320C64X_INS_LDNW, + TMS320C64X_INS_LDW, + TMS320C64X_INS_LMBD, + TMS320C64X_INS_MAX2, + TMS320C64X_INS_MAXU4, + TMS320C64X_INS_MIN2, + TMS320C64X_INS_MINU4, + TMS320C64X_INS_MPY, + TMS320C64X_INS_MPY2, + TMS320C64X_INS_MPYH, + TMS320C64X_INS_MPYHI, + TMS320C64X_INS_MPYHIR, + TMS320C64X_INS_MPYHL, + TMS320C64X_INS_MPYHLU, + TMS320C64X_INS_MPYHSLU, + TMS320C64X_INS_MPYHSU, + TMS320C64X_INS_MPYHU, + TMS320C64X_INS_MPYHULS, + TMS320C64X_INS_MPYHUS, + TMS320C64X_INS_MPYLH, + TMS320C64X_INS_MPYLHU, + TMS320C64X_INS_MPYLI, + TMS320C64X_INS_MPYLIR, + TMS320C64X_INS_MPYLSHU, + TMS320C64X_INS_MPYLUHS, + TMS320C64X_INS_MPYSU, + TMS320C64X_INS_MPYSU4, + TMS320C64X_INS_MPYU, + TMS320C64X_INS_MPYU4, + TMS320C64X_INS_MPYUS, + TMS320C64X_INS_MVC, + TMS320C64X_INS_MVD, + TMS320C64X_INS_MVK, + TMS320C64X_INS_MVKL, + TMS320C64X_INS_MVKLH, + TMS320C64X_INS_NOP, + TMS320C64X_INS_NORM, + TMS320C64X_INS_OR, + TMS320C64X_INS_PACK2, + TMS320C64X_INS_PACKH2, + TMS320C64X_INS_PACKH4, + TMS320C64X_INS_PACKHL2, + TMS320C64X_INS_PACKL4, + TMS320C64X_INS_PACKLH2, + TMS320C64X_INS_ROTL, + TMS320C64X_INS_SADD, + TMS320C64X_INS_SADD2, + TMS320C64X_INS_SADDU4, + TMS320C64X_INS_SADDUS2, + TMS320C64X_INS_SAT, + TMS320C64X_INS_SET, + TMS320C64X_INS_SHFL, + TMS320C64X_INS_SHL, + TMS320C64X_INS_SHLMB, + TMS320C64X_INS_SHR, + TMS320C64X_INS_SHR2, + TMS320C64X_INS_SHRMB, + TMS320C64X_INS_SHRU, + TMS320C64X_INS_SHRU2, + TMS320C64X_INS_SMPY, + TMS320C64X_INS_SMPY2, + TMS320C64X_INS_SMPYH, + TMS320C64X_INS_SMPYHL, + TMS320C64X_INS_SMPYLH, + TMS320C64X_INS_SPACK2, + TMS320C64X_INS_SPACKU4, + TMS320C64X_INS_SSHL, + TMS320C64X_INS_SSHVL, + TMS320C64X_INS_SSHVR, + TMS320C64X_INS_SSUB, + TMS320C64X_INS_STB, + TMS320C64X_INS_STDW, + TMS320C64X_INS_STH, + TMS320C64X_INS_STNDW, + TMS320C64X_INS_STNW, + TMS320C64X_INS_STW, + TMS320C64X_INS_SUB, + TMS320C64X_INS_SUB2, + TMS320C64X_INS_SUB4, + TMS320C64X_INS_SUBAB, + TMS320C64X_INS_SUBABS4, + TMS320C64X_INS_SUBAH, + TMS320C64X_INS_SUBAW, + TMS320C64X_INS_SUBC, + TMS320C64X_INS_SUBU, + TMS320C64X_INS_SWAP4, + TMS320C64X_INS_UNPKHU4, + TMS320C64X_INS_UNPKLU4, + TMS320C64X_INS_XOR, + TMS320C64X_INS_XPND2, + TMS320C64X_INS_XPND4, + // Aliases + TMS320C64X_INS_IDLE, + TMS320C64X_INS_MV, + TMS320C64X_INS_NEG, + TMS320C64X_INS_NOT, + TMS320C64X_INS_SWAP2, + TMS320C64X_INS_ZERO, + + TMS320C64X_INS_ENDING, // <-- mark the end of the list of instructions +} tms320c64x_insn; + +typedef enum tms320c64x_insn_group { + TMS320C64X_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + TMS320C64X_GRP_JUMP, ///< = CS_GRP_JUMP + + TMS320C64X_GRP_FUNIT_D = 128, + TMS320C64X_GRP_FUNIT_L, + TMS320C64X_GRP_FUNIT_M, + TMS320C64X_GRP_FUNIT_S, + TMS320C64X_GRP_FUNIT_NO, + + TMS320C64X_GRP_ENDING, // <-- mark the end of the list of groups +} tms320c64x_insn_group; + +typedef enum tms320c64x_funit { + TMS320C64X_FUNIT_INVALID = 0, + TMS320C64X_FUNIT_D, + TMS320C64X_FUNIT_L, + TMS320C64X_FUNIT_M, + TMS320C64X_FUNIT_S, + TMS320C64X_FUNIT_NO +} tms320c64x_funit; + +#ifdef __cplusplus +} +#endif + +#endif + +#ifndef CAPSTONE_M680X_H +#define CAPSTONE_M680X_H + +/* Capstone Disassembly Engine */ +/* M680X Backend by Wolfgang Schwotzer 2017 */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +#define M680X_OPERAND_COUNT 9 + +/// M680X registers and special registers +typedef enum m680x_reg { + M680X_REG_INVALID = 0, + + M680X_REG_A, ///< M6800/1/2/3/9, HD6301/9 + M680X_REG_B, ///< M6800/1/2/3/9, HD6301/9 + M680X_REG_E, ///< HD6309 + M680X_REG_F, ///< HD6309 + M680X_REG_0, ///< HD6309 + + M680X_REG_D, ///< M6801/3/9, HD6301/9 + M680X_REG_W, ///< HD6309 + + M680X_REG_CC, ///< M6800/1/2/3/9, M6301/9 + M680X_REG_DP, ///< M6809/M6309 + M680X_REG_MD, ///< M6309 + + M680X_REG_HX, ///< M6808 + M680X_REG_H, ///< M6808 + M680X_REG_X, ///< M6800/1/2/3/9, M6301/9 + M680X_REG_Y, ///< M6809/M6309 + M680X_REG_S, ///< M6809/M6309 + M680X_REG_U, ///< M6809/M6309 + M680X_REG_V, ///< M6309 + + M680X_REG_Q, ///< M6309 + + M680X_REG_PC, ///< M6800/1/2/3/9, M6301/9 + + M680X_REG_TMP2, ///< CPU12 + M680X_REG_TMP3, ///< CPU12 + + M680X_REG_ENDING, ///< <-- mark the end of the list of registers +} m680x_reg; + +/// Operand type for instruction's operands +typedef enum m680x_op_type { + M680X_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + M680X_OP_REGISTER, ///< = Register operand. + M680X_OP_IMMEDIATE, ///< = Immediate operand. + M680X_OP_INDEXED, ///< = Indexed addressing operand. + M680X_OP_EXTENDED, ///< = Extended addressing operand. + M680X_OP_DIRECT, ///< = Direct addressing operand. + M680X_OP_RELATIVE, ///< = Relative addressing operand. + M680X_OP_CONSTANT, ///< = constant operand (Displayed as number only). + ///< Used e.g. for a bit index or page number. +} m680x_op_type; + +// Supported bit values for mem.idx.offset_bits +#define M680X_OFFSET_NONE 0 +#define M680X_OFFSET_BITS_5 5 +#define M680X_OFFSET_BITS_8 8 +#define M680X_OFFSET_BITS_9 9 +#define M680X_OFFSET_BITS_16 16 + +// Supported bit flags for mem.idx.flags +// These flags can be combined +#define M680X_IDX_INDIRECT 1 +#define M680X_IDX_NO_COMMA 2 +#define M680X_IDX_POST_INC_DEC 4 + +/// Instruction's operand referring to indexed addressing +typedef struct m680x_op_idx { + m680x_reg base_reg; ///< base register (or M680X_REG_INVALID if + ///< irrelevant) + m680x_reg offset_reg; ///< offset register (or M680X_REG_INVALID if + ///< irrelevant) + int16_t offset; ///< 5-,8- or 16-bit offset. See also offset_bits. + uint16_t offset_addr; ///< = offset addr. if base_reg == M680X_REG_PC. + ///< calculated as offset + PC + uint8_t offset_bits; ///< offset width in bits for indexed addressing + int8_t inc_dec; ///< inc. or dec. value: + ///< 0: no inc-/decrement + ///< 1 .. 8: increment by 1 .. 8 + ///< -1 .. -8: decrement by 1 .. 8 + ///< if flag M680X_IDX_POST_INC_DEC set it is post + ///< inc-/decrement otherwise pre inc-/decrement + uint8_t flags; ///< 8-bit flags (see above) +} m680x_op_idx; + +/// Instruction's memory operand referring to relative addressing (Bcc/LBcc) +typedef struct m680x_op_rel { + uint16_t address; ///< The absolute address. + ///< calculated as PC + offset. PC is the first + ///< address after the instruction. + int16_t offset; ///< the offset/displacement value +} m680x_op_rel; + +/// Instruction's operand referring to extended addressing +typedef struct m680x_op_ext { + uint16_t address; ///< The absolute address + bool indirect; ///< true if extended indirect addressing +} m680x_op_ext; + +/// Instruction operand +typedef struct cs_m680x_op { + m680x_op_type type; + union { + int32_t imm; ///< immediate value for IMM operand + m680x_reg reg; ///< register value for REG operand + m680x_op_idx idx; ///< Indexed addressing operand + m680x_op_rel rel; ///< Relative address. operand (Bcc/LBcc) + m680x_op_ext ext; ///< Extended address + uint8_t direct_addr; ///<, 2013-2018 */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +/// Instruction structure +typedef struct cs_evm { + unsigned char pop; ///< number of items popped from the stack + unsigned char push; ///< number of items pushed into the stack + unsigned int fee; ///< gas fee for the instruction +} cs_evm; + +/// EVM instruction +typedef enum evm_insn { + EVM_INS_STOP = 0, + EVM_INS_ADD = 1, + EVM_INS_MUL = 2, + EVM_INS_SUB = 3, + EVM_INS_DIV = 4, + EVM_INS_SDIV = 5, + EVM_INS_MOD = 6, + EVM_INS_SMOD = 7, + EVM_INS_ADDMOD = 8, + EVM_INS_MULMOD = 9, + EVM_INS_EXP = 10, + EVM_INS_SIGNEXTEND = 11, + EVM_INS_LT = 16, + EVM_INS_GT = 17, + EVM_INS_SLT = 18, + EVM_INS_SGT = 19, + EVM_INS_EQ = 20, + EVM_INS_ISZERO = 21, + EVM_INS_AND = 22, + EVM_INS_OR = 23, + EVM_INS_XOR = 24, + EVM_INS_NOT = 25, + EVM_INS_BYTE = 26, + EVM_INS_SHA3 = 32, + EVM_INS_ADDRESS = 48, + EVM_INS_BALANCE = 49, + EVM_INS_ORIGIN = 50, + EVM_INS_CALLER = 51, + EVM_INS_CALLVALUE = 52, + EVM_INS_CALLDATALOAD = 53, + EVM_INS_CALLDATASIZE = 54, + EVM_INS_CALLDATACOPY = 55, + EVM_INS_CODESIZE = 56, + EVM_INS_CODECOPY = 57, + EVM_INS_GASPRICE = 58, + EVM_INS_EXTCODESIZE = 59, + EVM_INS_EXTCODECOPY = 60, + EVM_INS_RETURNDATASIZE = 61, + EVM_INS_RETURNDATACOPY = 62, + EVM_INS_BLOCKHASH = 64, + EVM_INS_COINBASE = 65, + EVM_INS_TIMESTAMP = 66, + EVM_INS_NUMBER = 67, + EVM_INS_DIFFICULTY = 68, + EVM_INS_GASLIMIT = 69, + EVM_INS_POP = 80, + EVM_INS_MLOAD = 81, + EVM_INS_MSTORE = 82, + EVM_INS_MSTORE8 = 83, + EVM_INS_SLOAD = 84, + EVM_INS_SSTORE = 85, + EVM_INS_JUMP = 86, + EVM_INS_JUMPI = 87, + EVM_INS_PC = 88, + EVM_INS_MSIZE = 89, + EVM_INS_GAS = 90, + EVM_INS_JUMPDEST = 91, + EVM_INS_PUSH1 = 96, + EVM_INS_PUSH2 = 97, + EVM_INS_PUSH3 = 98, + EVM_INS_PUSH4 = 99, + EVM_INS_PUSH5 = 100, + EVM_INS_PUSH6 = 101, + EVM_INS_PUSH7 = 102, + EVM_INS_PUSH8 = 103, + EVM_INS_PUSH9 = 104, + EVM_INS_PUSH10 = 105, + EVM_INS_PUSH11 = 106, + EVM_INS_PUSH12 = 107, + EVM_INS_PUSH13 = 108, + EVM_INS_PUSH14 = 109, + EVM_INS_PUSH15 = 110, + EVM_INS_PUSH16 = 111, + EVM_INS_PUSH17 = 112, + EVM_INS_PUSH18 = 113, + EVM_INS_PUSH19 = 114, + EVM_INS_PUSH20 = 115, + EVM_INS_PUSH21 = 116, + EVM_INS_PUSH22 = 117, + EVM_INS_PUSH23 = 118, + EVM_INS_PUSH24 = 119, + EVM_INS_PUSH25 = 120, + EVM_INS_PUSH26 = 121, + EVM_INS_PUSH27 = 122, + EVM_INS_PUSH28 = 123, + EVM_INS_PUSH29 = 124, + EVM_INS_PUSH30 = 125, + EVM_INS_PUSH31 = 126, + EVM_INS_PUSH32 = 127, + EVM_INS_DUP1 = 128, + EVM_INS_DUP2 = 129, + EVM_INS_DUP3 = 130, + EVM_INS_DUP4 = 131, + EVM_INS_DUP5 = 132, + EVM_INS_DUP6 = 133, + EVM_INS_DUP7 = 134, + EVM_INS_DUP8 = 135, + EVM_INS_DUP9 = 136, + EVM_INS_DUP10 = 137, + EVM_INS_DUP11 = 138, + EVM_INS_DUP12 = 139, + EVM_INS_DUP13 = 140, + EVM_INS_DUP14 = 141, + EVM_INS_DUP15 = 142, + EVM_INS_DUP16 = 143, + EVM_INS_SWAP1 = 144, + EVM_INS_SWAP2 = 145, + EVM_INS_SWAP3 = 146, + EVM_INS_SWAP4 = 147, + EVM_INS_SWAP5 = 148, + EVM_INS_SWAP6 = 149, + EVM_INS_SWAP7 = 150, + EVM_INS_SWAP8 = 151, + EVM_INS_SWAP9 = 152, + EVM_INS_SWAP10 = 153, + EVM_INS_SWAP11 = 154, + EVM_INS_SWAP12 = 155, + EVM_INS_SWAP13 = 156, + EVM_INS_SWAP14 = 157, + EVM_INS_SWAP15 = 158, + EVM_INS_SWAP16 = 159, + EVM_INS_LOG0 = 160, + EVM_INS_LOG1 = 161, + EVM_INS_LOG2 = 162, + EVM_INS_LOG3 = 163, + EVM_INS_LOG4 = 164, + EVM_INS_CREATE = 240, + EVM_INS_CALL = 241, + EVM_INS_CALLCODE = 242, + EVM_INS_RETURN = 243, + EVM_INS_DELEGATECALL = 244, + EVM_INS_CALLBLACKBOX = 245, + EVM_INS_STATICCALL = 250, + EVM_INS_REVERT = 253, + EVM_INS_SUICIDE = 255, + + EVM_INS_INVALID = 512, + EVM_INS_ENDING, // <-- mark the end of the list of instructions +} evm_insn; + +/// Group of EVM instructions +typedef enum evm_insn_group { + EVM_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + EVM_GRP_JUMP, ///< all jump instructions + + EVM_GRP_MATH = 8, ///< math instructions + EVM_GRP_STACK_WRITE, ///< instructions write to stack + EVM_GRP_STACK_READ, ///< instructions read from stack + EVM_GRP_MEM_WRITE, ///< instructions write to memory + EVM_GRP_MEM_READ, ///< instructions read from memory + EVM_GRP_STORE_WRITE, ///< instructions write to storage + EVM_GRP_STORE_READ, ///< instructions read from storage + EVM_GRP_HALT, ///< instructions halt execution + + EVM_GRP_ENDING, ///< <-- mark the end of the list of groups +} evm_insn_group; + +#ifdef __cplusplus +} +#endif + +#endif +#ifndef CAPSTONE_RISCV_H +#define CAPSTONE_RISCV_H + +/* Capstone Disassembly Engine */ +/* RISC-V Backend By Rodrigo Cortes Porto & + Shawn Chang , HardenedLinux@2018 */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_MSC_VER) || !defined(_KERNEL_MODE) +#include +#endif + + +// GCC MIPS toolchain has a default macro called "mips" which breaks +// compilation +//#undef riscv + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +//> Operand type for instruction's operands +typedef enum riscv_op_type { + RISCV_OP_INVALID = 0, // = CS_OP_INVALID (Uninitialized). + RISCV_OP_REG, // = CS_OP_REG (Register operand). + RISCV_OP_IMM, // = CS_OP_IMM (Immediate operand). + RISCV_OP_MEM, // = CS_OP_MEM (Memory operand). +} riscv_op_type; + +// Instruction's operand referring to memory +// This is associated with RISCV_OP_MEM operand type above +typedef struct riscv_op_mem { + unsigned int base; // base register + int64_t disp; // displacement/offset value +} riscv_op_mem; + +// Instruction operand +typedef struct cs_riscv_op { + riscv_op_type type; // operand type + union { + unsigned int reg; // register value for REG operand + int64_t imm; // immediate value for IMM operand + riscv_op_mem mem; // base/disp value for MEM operand + }; +} cs_riscv_op; + +// Instruction structure +typedef struct cs_riscv { + // Does this instruction need effective address or not. + bool need_effective_addr; + // Number of operands of this instruction, + // or 0 when instruction has no operand. + uint8_t op_count; + cs_riscv_op operands[8]; // operands for this instruction. +} cs_riscv; + +//> RISCV registers +typedef enum riscv_reg { + RISCV_REG_INVALID = 0, + //> General purpose registers + RISCV_REG_X0, // "zero" + RISCV_REG_ZERO = RISCV_REG_X0, // "zero" + RISCV_REG_X1, // "ra" + RISCV_REG_RA = RISCV_REG_X1, // "ra" + RISCV_REG_X2, // "sp" + RISCV_REG_SP = RISCV_REG_X2, // "sp" + RISCV_REG_X3, // "gp" + RISCV_REG_GP = RISCV_REG_X3, // "gp" + RISCV_REG_X4, // "tp" + RISCV_REG_TP = RISCV_REG_X4, // "tp" + RISCV_REG_X5, // "t0" + RISCV_REG_T0 = RISCV_REG_X5, // "t0" + RISCV_REG_X6, // "t1" + RISCV_REG_T1 = RISCV_REG_X6, // "t1" + RISCV_REG_X7, // "t2" + RISCV_REG_T2 = RISCV_REG_X7, // "t2" + RISCV_REG_X8, // "s0/fp" + RISCV_REG_S0 = RISCV_REG_X8, // "s0" + RISCV_REG_FP = RISCV_REG_X8, // "fp" + RISCV_REG_X9, // "s1" + RISCV_REG_S1 = RISCV_REG_X9, // "s1" + RISCV_REG_X10, // "a0" + RISCV_REG_A0 = RISCV_REG_X10, // "a0" + RISCV_REG_X11, // "a1" + RISCV_REG_A1 = RISCV_REG_X11, // "a1" + RISCV_REG_X12, // "a2" + RISCV_REG_A2 = RISCV_REG_X12, // "a2" + RISCV_REG_X13, // "a3" + RISCV_REG_A3 = RISCV_REG_X13, // "a3" + RISCV_REG_X14, // "a4" + RISCV_REG_A4 = RISCV_REG_X14, // "a4" + RISCV_REG_X15, // "a5" + RISCV_REG_A5 = RISCV_REG_X15, // "a5" + RISCV_REG_X16, // "a6" + RISCV_REG_A6 = RISCV_REG_X16, // "a6" + RISCV_REG_X17, // "a7" + RISCV_REG_A7 = RISCV_REG_X17, // "a7" + RISCV_REG_X18, // "s2" + RISCV_REG_S2 = RISCV_REG_X18, // "s2" + RISCV_REG_X19, // "s3" + RISCV_REG_S3 = RISCV_REG_X19, // "s3" + RISCV_REG_X20, // "s4" + RISCV_REG_S4 = RISCV_REG_X20, // "s4" + RISCV_REG_X21, // "s5" + RISCV_REG_S5 = RISCV_REG_X21, // "s5" + RISCV_REG_X22, // "s6" + RISCV_REG_S6 = RISCV_REG_X22, // "s6" + RISCV_REG_X23, // "s7" + RISCV_REG_S7 = RISCV_REG_X23, // "s7" + RISCV_REG_X24, // "s8" + RISCV_REG_S8 = RISCV_REG_X24, // "s8" + RISCV_REG_X25, // "s9" + RISCV_REG_S9 = RISCV_REG_X25, // "s9" + RISCV_REG_X26, // "s10" + RISCV_REG_S10 = RISCV_REG_X26, // "s10" + RISCV_REG_X27, // "s11" + RISCV_REG_S11 = RISCV_REG_X27, // "s11" + RISCV_REG_X28, // "t3" + RISCV_REG_T3 = RISCV_REG_X28, // "t3" + RISCV_REG_X29, // "t4" + RISCV_REG_T4 = RISCV_REG_X29, // "t4" + RISCV_REG_X30, // "t5" + RISCV_REG_T5 = RISCV_REG_X30, // "t5" + RISCV_REG_X31, // "t6" + RISCV_REG_T6 = RISCV_REG_X31, // "t6" + + //> Floating-point registers + RISCV_REG_F0_32, // "ft0" + RISCV_REG_F0_64, // "ft0" + RISCV_REG_F1_32, // "ft1" + RISCV_REG_F1_64, // "ft1" + RISCV_REG_F2_32, // "ft2" + RISCV_REG_F2_64, // "ft2" + RISCV_REG_F3_32, // "ft3" + RISCV_REG_F3_64, // "ft3" + RISCV_REG_F4_32, // "ft4" + RISCV_REG_F4_64, // "ft4" + RISCV_REG_F5_32, // "ft5" + RISCV_REG_F5_64, // "ft5" + RISCV_REG_F6_32, // "ft6" + RISCV_REG_F6_64, // "ft6" + RISCV_REG_F7_32, // "ft7" + RISCV_REG_F7_64, // "ft7" + RISCV_REG_F8_32, // "fs0" + RISCV_REG_F8_64, // "fs0" + RISCV_REG_F9_32, // "fs1" + RISCV_REG_F9_64, // "fs1" + RISCV_REG_F10_32, // "fa0" + RISCV_REG_F10_64, // "fa0" + RISCV_REG_F11_32, // "fa1" + RISCV_REG_F11_64, // "fa1" + RISCV_REG_F12_32, // "fa2" + RISCV_REG_F12_64, // "fa2" + RISCV_REG_F13_32, // "fa3" + RISCV_REG_F13_64, // "fa3" + RISCV_REG_F14_32, // "fa4" + RISCV_REG_F14_64, // "fa4" + RISCV_REG_F15_32, // "fa5" + RISCV_REG_F15_64, // "fa5" + RISCV_REG_F16_32, // "fa6" + RISCV_REG_F16_64, // "fa6" + RISCV_REG_F17_32, // "fa7" + RISCV_REG_F17_64, // "fa7" + RISCV_REG_F18_32, // "fs2" + RISCV_REG_F18_64, // "fs2" + RISCV_REG_F19_32, // "fs3" + RISCV_REG_F19_64, // "fs3" + RISCV_REG_F20_32, // "fs4" + RISCV_REG_F20_64, // "fs4" + RISCV_REG_F21_32, // "fs5" + RISCV_REG_F21_64, // "fs5" + RISCV_REG_F22_32, // "fs6" + RISCV_REG_F22_64, // "fs6" + RISCV_REG_F23_32, // "fs7" + RISCV_REG_F23_64, // "fs7" + RISCV_REG_F24_32, // "fs8" + RISCV_REG_F24_64, // "fs8" + RISCV_REG_F25_32, // "fs9" + RISCV_REG_F25_64, // "fs9" + RISCV_REG_F26_32, // "fs10" + RISCV_REG_F26_64, // "fs10" + RISCV_REG_F27_32, // "fs11" + RISCV_REG_F27_64, // "fs11" + RISCV_REG_F28_32, // "ft8" + RISCV_REG_F28_64, // "ft8" + RISCV_REG_F29_32, // "ft9" + RISCV_REG_F29_64, // "ft9" + RISCV_REG_F30_32, // "ft10" + RISCV_REG_F30_64, // "ft10" + RISCV_REG_F31_32, // "ft11" + RISCV_REG_F31_64, // "ft11" + + RISCV_REG_ENDING, // <-- mark the end of the list or registers +} riscv_reg; + +//> RISCV instruction +typedef enum riscv_insn { + RISCV_INS_INVALID = 0, + + RISCV_INS_ADD, + RISCV_INS_ADDI, + RISCV_INS_ADDIW, + RISCV_INS_ADDW, + RISCV_INS_AMOADD_D, + RISCV_INS_AMOADD_D_AQ, + RISCV_INS_AMOADD_D_AQ_RL, + RISCV_INS_AMOADD_D_RL, + RISCV_INS_AMOADD_W, + RISCV_INS_AMOADD_W_AQ, + RISCV_INS_AMOADD_W_AQ_RL, + RISCV_INS_AMOADD_W_RL, + RISCV_INS_AMOAND_D, + RISCV_INS_AMOAND_D_AQ, + RISCV_INS_AMOAND_D_AQ_RL, + RISCV_INS_AMOAND_D_RL, + RISCV_INS_AMOAND_W, + RISCV_INS_AMOAND_W_AQ, + RISCV_INS_AMOAND_W_AQ_RL, + RISCV_INS_AMOAND_W_RL, + RISCV_INS_AMOMAXU_D, + RISCV_INS_AMOMAXU_D_AQ, + RISCV_INS_AMOMAXU_D_AQ_RL, + RISCV_INS_AMOMAXU_D_RL, + RISCV_INS_AMOMAXU_W, + RISCV_INS_AMOMAXU_W_AQ, + RISCV_INS_AMOMAXU_W_AQ_RL, + RISCV_INS_AMOMAXU_W_RL, + RISCV_INS_AMOMAX_D, + RISCV_INS_AMOMAX_D_AQ, + RISCV_INS_AMOMAX_D_AQ_RL, + RISCV_INS_AMOMAX_D_RL, + RISCV_INS_AMOMAX_W, + RISCV_INS_AMOMAX_W_AQ, + RISCV_INS_AMOMAX_W_AQ_RL, + RISCV_INS_AMOMAX_W_RL, + RISCV_INS_AMOMINU_D, + RISCV_INS_AMOMINU_D_AQ, + RISCV_INS_AMOMINU_D_AQ_RL, + RISCV_INS_AMOMINU_D_RL, + RISCV_INS_AMOMINU_W, + RISCV_INS_AMOMINU_W_AQ, + RISCV_INS_AMOMINU_W_AQ_RL, + RISCV_INS_AMOMINU_W_RL, + RISCV_INS_AMOMIN_D, + RISCV_INS_AMOMIN_D_AQ, + RISCV_INS_AMOMIN_D_AQ_RL, + RISCV_INS_AMOMIN_D_RL, + RISCV_INS_AMOMIN_W, + RISCV_INS_AMOMIN_W_AQ, + RISCV_INS_AMOMIN_W_AQ_RL, + RISCV_INS_AMOMIN_W_RL, + RISCV_INS_AMOOR_D, + RISCV_INS_AMOOR_D_AQ, + RISCV_INS_AMOOR_D_AQ_RL, + RISCV_INS_AMOOR_D_RL, + RISCV_INS_AMOOR_W, + RISCV_INS_AMOOR_W_AQ, + RISCV_INS_AMOOR_W_AQ_RL, + RISCV_INS_AMOOR_W_RL, + RISCV_INS_AMOSWAP_D, + RISCV_INS_AMOSWAP_D_AQ, + RISCV_INS_AMOSWAP_D_AQ_RL, + RISCV_INS_AMOSWAP_D_RL, + RISCV_INS_AMOSWAP_W, + RISCV_INS_AMOSWAP_W_AQ, + RISCV_INS_AMOSWAP_W_AQ_RL, + RISCV_INS_AMOSWAP_W_RL, + RISCV_INS_AMOXOR_D, + RISCV_INS_AMOXOR_D_AQ, + RISCV_INS_AMOXOR_D_AQ_RL, + RISCV_INS_AMOXOR_D_RL, + RISCV_INS_AMOXOR_W, + RISCV_INS_AMOXOR_W_AQ, + RISCV_INS_AMOXOR_W_AQ_RL, + RISCV_INS_AMOXOR_W_RL, + RISCV_INS_AND, + RISCV_INS_ANDI, + RISCV_INS_AUIPC, + RISCV_INS_BEQ, + RISCV_INS_BGE, + RISCV_INS_BGEU, + RISCV_INS_BLT, + RISCV_INS_BLTU, + RISCV_INS_BNE, + RISCV_INS_CSRRC, + RISCV_INS_CSRRCI, + RISCV_INS_CSRRS, + RISCV_INS_CSRRSI, + RISCV_INS_CSRRW, + RISCV_INS_CSRRWI, + RISCV_INS_C_ADD, + RISCV_INS_C_ADDI, + RISCV_INS_C_ADDI16SP, + RISCV_INS_C_ADDI4SPN, + RISCV_INS_C_ADDIW, + RISCV_INS_C_ADDW, + RISCV_INS_C_AND, + RISCV_INS_C_ANDI, + RISCV_INS_C_BEQZ, + RISCV_INS_C_BNEZ, + RISCV_INS_C_EBREAK, + RISCV_INS_C_FLD, + RISCV_INS_C_FLDSP, + RISCV_INS_C_FLW, + RISCV_INS_C_FLWSP, + RISCV_INS_C_FSD, + RISCV_INS_C_FSDSP, + RISCV_INS_C_FSW, + RISCV_INS_C_FSWSP, + RISCV_INS_C_J, + RISCV_INS_C_JAL, + RISCV_INS_C_JALR, + RISCV_INS_C_JR, + RISCV_INS_C_LD, + RISCV_INS_C_LDSP, + RISCV_INS_C_LI, + RISCV_INS_C_LUI, + RISCV_INS_C_LW, + RISCV_INS_C_LWSP, + RISCV_INS_C_MV, + RISCV_INS_C_NOP, + RISCV_INS_C_OR, + RISCV_INS_C_SD, + RISCV_INS_C_SDSP, + RISCV_INS_C_SLLI, + RISCV_INS_C_SRAI, + RISCV_INS_C_SRLI, + RISCV_INS_C_SUB, + RISCV_INS_C_SUBW, + RISCV_INS_C_SW, + RISCV_INS_C_SWSP, + RISCV_INS_C_UNIMP, + RISCV_INS_C_XOR, + RISCV_INS_DIV, + RISCV_INS_DIVU, + RISCV_INS_DIVUW, + RISCV_INS_DIVW, + RISCV_INS_EBREAK, + RISCV_INS_ECALL, + RISCV_INS_FADD_D, + RISCV_INS_FADD_S, + RISCV_INS_FCLASS_D, + RISCV_INS_FCLASS_S, + RISCV_INS_FCVT_D_L, + RISCV_INS_FCVT_D_LU, + RISCV_INS_FCVT_D_S, + RISCV_INS_FCVT_D_W, + RISCV_INS_FCVT_D_WU, + RISCV_INS_FCVT_LU_D, + RISCV_INS_FCVT_LU_S, + RISCV_INS_FCVT_L_D, + RISCV_INS_FCVT_L_S, + RISCV_INS_FCVT_S_D, + RISCV_INS_FCVT_S_L, + RISCV_INS_FCVT_S_LU, + RISCV_INS_FCVT_S_W, + RISCV_INS_FCVT_S_WU, + RISCV_INS_FCVT_WU_D, + RISCV_INS_FCVT_WU_S, + RISCV_INS_FCVT_W_D, + RISCV_INS_FCVT_W_S, + RISCV_INS_FDIV_D, + RISCV_INS_FDIV_S, + RISCV_INS_FENCE, + RISCV_INS_FENCE_I, + RISCV_INS_FENCE_TSO, + RISCV_INS_FEQ_D, + RISCV_INS_FEQ_S, + RISCV_INS_FLD, + RISCV_INS_FLE_D, + RISCV_INS_FLE_S, + RISCV_INS_FLT_D, + RISCV_INS_FLT_S, + RISCV_INS_FLW, + RISCV_INS_FMADD_D, + RISCV_INS_FMADD_S, + RISCV_INS_FMAX_D, + RISCV_INS_FMAX_S, + RISCV_INS_FMIN_D, + RISCV_INS_FMIN_S, + RISCV_INS_FMSUB_D, + RISCV_INS_FMSUB_S, + RISCV_INS_FMUL_D, + RISCV_INS_FMUL_S, + RISCV_INS_FMV_D_X, + RISCV_INS_FMV_W_X, + RISCV_INS_FMV_X_D, + RISCV_INS_FMV_X_W, + RISCV_INS_FNMADD_D, + RISCV_INS_FNMADD_S, + RISCV_INS_FNMSUB_D, + RISCV_INS_FNMSUB_S, + RISCV_INS_FSD, + RISCV_INS_FSGNJN_D, + RISCV_INS_FSGNJN_S, + RISCV_INS_FSGNJX_D, + RISCV_INS_FSGNJX_S, + RISCV_INS_FSGNJ_D, + RISCV_INS_FSGNJ_S, + RISCV_INS_FSQRT_D, + RISCV_INS_FSQRT_S, + RISCV_INS_FSUB_D, + RISCV_INS_FSUB_S, + RISCV_INS_FSW, + RISCV_INS_JAL, + RISCV_INS_JALR, + RISCV_INS_LB, + RISCV_INS_LBU, + RISCV_INS_LD, + RISCV_INS_LH, + RISCV_INS_LHU, + RISCV_INS_LR_D, + RISCV_INS_LR_D_AQ, + RISCV_INS_LR_D_AQ_RL, + RISCV_INS_LR_D_RL, + RISCV_INS_LR_W, + RISCV_INS_LR_W_AQ, + RISCV_INS_LR_W_AQ_RL, + RISCV_INS_LR_W_RL, + RISCV_INS_LUI, + RISCV_INS_LW, + RISCV_INS_LWU, + RISCV_INS_MRET, + RISCV_INS_MUL, + RISCV_INS_MULH, + RISCV_INS_MULHSU, + RISCV_INS_MULHU, + RISCV_INS_MULW, + RISCV_INS_OR, + RISCV_INS_ORI, + RISCV_INS_REM, + RISCV_INS_REMU, + RISCV_INS_REMUW, + RISCV_INS_REMW, + RISCV_INS_SB, + RISCV_INS_SC_D, + RISCV_INS_SC_D_AQ, + RISCV_INS_SC_D_AQ_RL, + RISCV_INS_SC_D_RL, + RISCV_INS_SC_W, + RISCV_INS_SC_W_AQ, + RISCV_INS_SC_W_AQ_RL, + RISCV_INS_SC_W_RL, + RISCV_INS_SD, + RISCV_INS_SFENCE_VMA, + RISCV_INS_SH, + RISCV_INS_SLL, + RISCV_INS_SLLI, + RISCV_INS_SLLIW, + RISCV_INS_SLLW, + RISCV_INS_SLT, + RISCV_INS_SLTI, + RISCV_INS_SLTIU, + RISCV_INS_SLTU, + RISCV_INS_SRA, + RISCV_INS_SRAI, + RISCV_INS_SRAIW, + RISCV_INS_SRAW, + RISCV_INS_SRET, + RISCV_INS_SRL, + RISCV_INS_SRLI, + RISCV_INS_SRLIW, + RISCV_INS_SRLW, + RISCV_INS_SUB, + RISCV_INS_SUBW, + RISCV_INS_SW, + RISCV_INS_UNIMP, + RISCV_INS_URET, + RISCV_INS_WFI, + RISCV_INS_XOR, + RISCV_INS_XORI, + + RISCV_INS_ENDING, +} riscv_insn; + +//> Group of RISCV instructions +typedef enum riscv_insn_group { + RISCV_GRP_INVALID = 0, // = CS_GRP_INVALID + RISCV_GRP_JUMP, + + RISCV_GRP_ISRV32 = 128, + RISCV_GRP_ISRV64, + RISCV_GRP_HASSTDEXTA, + RISCV_GRP_HASSTDEXTC, + RISCV_GRP_HASSTDEXTD, + RISCV_GRP_HASSTDEXTF, + RISCV_GRP_HASSTDEXTM, + /* + RISCV_GRP_ISRVA, + RISCV_GRP_ISRVC, + RISCV_GRP_ISRVD, + RISCV_GRP_ISRVCD, + RISCV_GRP_ISRVF, + RISCV_GRP_ISRV32C, + RISCV_GRP_ISRV32CF, + RISCV_GRP_ISRVM, + RISCV_GRP_ISRV64A, + RISCV_GRP_ISRV64C, + RISCV_GRP_ISRV64D, + RISCV_GRP_ISRV64F, + RISCV_GRP_ISRV64M, + */ + RISCV_GRP_ENDING, +} riscv_insn_group; + +#ifdef __cplusplus +} +#endif + +#endif + +/* Capstone Disassembly Engine */ +/* By Spike , xwings 2019 */ + +#ifndef CAPSTONE_WASM_H +#define CAPSTONE_WASM_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +typedef enum wasm_op_type { + WASM_OP_INVALID = 0, + WASM_OP_NONE, + WASM_OP_INT7, + WASM_OP_VARUINT32, + WASM_OP_VARUINT64, + WASM_OP_UINT32, + WASM_OP_UINT64, + WASM_OP_IMM, + WASM_OP_BRTABLE, +} wasm_op_type; + +typedef struct cs_wasm_brtable { + uint32_t length; + uint64_t address; + uint32_t default_target; +} cs_wasm_brtable; + +typedef struct cs_wasm_op { + wasm_op_type type; + uint32_t size; + union { + int8_t int7; + uint32_t varuint32; + uint64_t varuint64; + uint32_t uint32; + uint64_t uint64; + uint32_t immediate[2]; + cs_wasm_brtable brtable; + }; +} cs_wasm_op; + +/// Instruction structure +typedef struct cs_wasm { + uint8_t op_count; + cs_wasm_op operands[2]; +} cs_wasm; + +/// WASM instruction +typedef enum wasm_insn { + WASM_INS_UNREACHABLE = 0x0, + WASM_INS_NOP = 0x1, + WASM_INS_BLOCK = 0x2, + WASM_INS_LOOP = 0x3, + WASM_INS_IF = 0x4, + WASM_INS_ELSE = 0x5, + WASM_INS_END = 0xb, + WASM_INS_BR = 0xc, + WASM_INS_BR_IF = 0xd, + WASM_INS_BR_TABLE = 0xe, + WASM_INS_RETURN = 0xf, + WASM_INS_CALL = 0x10, + WASM_INS_CALL_INDIRECT = 0x11, + WASM_INS_DROP = 0x1a, + WASM_INS_SELECT = 0x1b, + WASM_INS_GET_LOCAL = 0x20, + WASM_INS_SET_LOCAL = 0x21, + WASM_INS_TEE_LOCAL = 0x22, + WASM_INS_GET_GLOBAL = 0x23, + WASM_INS_SET_GLOBAL = 0x24, + WASM_INS_I32_LOAD = 0x28, + WASM_INS_I64_LOAD = 0x29, + WASM_INS_F32_LOAD = 0x2a, + WASM_INS_F64_LOAD = 0x2b, + WASM_INS_I32_LOAD8_S = 0x2c, + WASM_INS_I32_LOAD8_U = 0x2d, + WASM_INS_I32_LOAD16_S = 0x2e, + WASM_INS_I32_LOAD16_U = 0x2f, + WASM_INS_I64_LOAD8_S = 0x30, + WASM_INS_I64_LOAD8_U = 0x31, + WASM_INS_I64_LOAD16_S = 0x32, + WASM_INS_I64_LOAD16_U = 0x33, + WASM_INS_I64_LOAD32_S = 0x34, + WASM_INS_I64_LOAD32_U = 0x35, + WASM_INS_I32_STORE = 0x36, + WASM_INS_I64_STORE = 0x37, + WASM_INS_F32_STORE = 0x38, + WASM_INS_F64_STORE = 0x39, + WASM_INS_I32_STORE8 = 0x3a, + WASM_INS_I32_STORE16 = 0x3b, + WASM_INS_I64_STORE8 = 0x3c, + WASM_INS_I64_STORE16 = 0x3d, + WASM_INS_I64_STORE32 = 0x3e, + WASM_INS_CURRENT_MEMORY = 0x3f, + WASM_INS_GROW_MEMORY = 0x40, + WASM_INS_I32_CONST = 0x41, + WASM_INS_I64_CONST = 0x42, + WASM_INS_F32_CONST = 0x43, + WASM_INS_F64_CONST = 0x44, + WASM_INS_I32_EQZ = 0x45, + WASM_INS_I32_EQ = 0x46, + WASM_INS_I32_NE = 0x47, + WASM_INS_I32_LT_S = 0x48, + WASM_INS_I32_LT_U = 0x49, + WASM_INS_I32_GT_S = 0x4a, + WASM_INS_I32_GT_U = 0x4b, + WASM_INS_I32_LE_S = 0x4c, + WASM_INS_I32_LE_U = 0x4d, + WASM_INS_I32_GE_S = 0x4e, + WASM_INS_I32_GE_U = 0x4f, + WASM_INS_I64_EQZ = 0x50, + WASM_INS_I64_EQ = 0x51, + WASM_INS_I64_NE = 0x52, + WASM_INS_I64_LT_S = 0x53, + WASM_INS_I64_LT_U = 0x54, + WASN_INS_I64_GT_S = 0x55, + WASM_INS_I64_GT_U = 0x56, + WASM_INS_I64_LE_S = 0x57, + WASM_INS_I64_LE_U = 0x58, + WASM_INS_I64_GE_S = 0x59, + WASM_INS_I64_GE_U = 0x5a, + WASM_INS_F32_EQ = 0x5b, + WASM_INS_F32_NE = 0x5c, + WASM_INS_F32_LT = 0x5d, + WASM_INS_F32_GT = 0x5e, + WASM_INS_F32_LE = 0x5f, + WASM_INS_F32_GE = 0x60, + WASM_INS_F64_EQ = 0x61, + WASM_INS_F64_NE = 0x62, + WASM_INS_F64_LT = 0x63, + WASM_INS_F64_GT = 0x64, + WASM_INS_F64_LE = 0x65, + WASM_INS_F64_GE = 0x66, + WASM_INS_I32_CLZ = 0x67, + WASM_INS_I32_CTZ = 0x68, + WASM_INS_I32_POPCNT = 0x69, + WASM_INS_I32_ADD = 0x6a, + WASM_INS_I32_SUB = 0x6b, + WASM_INS_I32_MUL = 0x6c, + WASM_INS_I32_DIV_S = 0x6d, + WASM_INS_I32_DIV_U = 0x6e, + WASM_INS_I32_REM_S = 0x6f, + WASM_INS_I32_REM_U = 0x70, + WASM_INS_I32_AND = 0x71, + WASM_INS_I32_OR = 0x72, + WASM_INS_I32_XOR = 0x73, + WASM_INS_I32_SHL = 0x74, + WASM_INS_I32_SHR_S = 0x75, + WASM_INS_I32_SHR_U = 0x76, + WASM_INS_I32_ROTL = 0x77, + WASM_INS_I32_ROTR = 0x78, + WASM_INS_I64_CLZ = 0x79, + WASM_INS_I64_CTZ = 0x7a, + WASM_INS_I64_POPCNT = 0x7b, + WASM_INS_I64_ADD = 0x7c, + WASM_INS_I64_SUB = 0x7d, + WASM_INS_I64_MUL = 0x7e, + WASM_INS_I64_DIV_S = 0x7f, + WASM_INS_I64_DIV_U = 0x80, + WASM_INS_I64_REM_S = 0x81, + WASM_INS_I64_REM_U = 0x82, + WASM_INS_I64_AND = 0x83, + WASM_INS_I64_OR = 0x84, + WASM_INS_I64_XOR = 0x85, + WASM_INS_I64_SHL = 0x86, + WASM_INS_I64_SHR_S = 0x87, + WASM_INS_I64_SHR_U = 0x88, + WASM_INS_I64_ROTL = 0x89, + WASM_INS_I64_ROTR = 0x8a, + WASM_INS_F32_ABS = 0x8b, + WASM_INS_F32_NEG = 0x8c, + WASM_INS_F32_CEIL = 0x8d, + WASM_INS_F32_FLOOR = 0x8e, + WASM_INS_F32_TRUNC = 0x8f, + WASM_INS_F32_NEAREST = 0x90, + WASM_INS_F32_SQRT = 0x91, + WASM_INS_F32_ADD = 0x92, + WASM_INS_F32_SUB = 0x93, + WASM_INS_F32_MUL = 0x94, + WASM_INS_F32_DIV = 0x95, + WASM_INS_F32_MIN = 0x96, + WASM_INS_F32_MAX = 0x97, + WASM_INS_F32_COPYSIGN = 0x98, + WASM_INS_F64_ABS = 0x99, + WASM_INS_F64_NEG = 0x9a, + WASM_INS_F64_CEIL = 0x9b, + WASM_INS_F64_FLOOR = 0x9c, + WASM_INS_F64_TRUNC = 0x9d, + WASM_INS_F64_NEAREST = 0x9e, + WASM_INS_F64_SQRT = 0x9f, + WASM_INS_F64_ADD = 0xa0, + WASM_INS_F64_SUB = 0xa1, + WASM_INS_F64_MUL = 0xa2, + WASM_INS_F64_DIV = 0xa3, + WASM_INS_F64_MIN = 0xa4, + WASM_INS_F64_MAX = 0xa5, + WASM_INS_F64_COPYSIGN = 0xa6, + WASM_INS_I32_WARP_I64 = 0xa7, + WASP_INS_I32_TRUNC_S_F32 = 0xa8, + WASM_INS_I32_TRUNC_U_F32 = 0xa9, + WASM_INS_I32_TRUNC_S_F64 = 0xaa, + WASM_INS_I32_TRUNC_U_F64 = 0xab, + WASM_INS_I64_EXTEND_S_I32 = 0xac, + WASM_INS_I64_EXTEND_U_I32 = 0xad, + WASM_INS_I64_TRUNC_S_F32 = 0xae, + WASM_INS_I64_TRUNC_U_F32 = 0xaf, + WASM_INS_I64_TRUNC_S_F64 = 0xb0, + WASM_INS_I64_TRUNC_U_F64 = 0xb1, + WASM_INS_F32_CONVERT_S_I32 = 0xb2, + WASM_INS_F32_CONVERT_U_I32 = 0xb3, + WASM_INS_F32_CONVERT_S_I64 = 0xb4, + WASM_INS_F32_CONVERT_U_I64 = 0xb5, + WASM_INS_F32_DEMOTE_F64 = 0xb6, + WASM_INS_F64_CONVERT_S_I32 = 0xb7, + WASM_INS_F64_CONVERT_U_I32 = 0xb8, + WASM_INS_F64_CONVERT_S_I64 = 0xb9, + WASM_INS_F64_CONVERT_U_I64 = 0xba, + WASM_INS_F64_PROMOTE_F32 = 0xbb, + WASM_INS_I32_REINTERPRET_F32 = 0xbc, + WASM_INS_I64_REINTERPRET_F64 = 0xbd, + WASM_INS_F32_REINTERPRET_I32 = 0xbe, + WASM_INS_F64_REINTERPRET_I64 = 0xbf, + WASM_INS_INVALID = 512, + WASM_INS_ENDING, +} wasm_insn; + +/// Group of WASM instructions +typedef enum wasm_insn_group { + WASM_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + WASM_GRP_NUMBERIC = 8, + WASM_GRP_PARAMETRIC, + WASM_GRP_VARIABLE, + WASM_GRP_MEMORY, + WASM_GRP_CONTROL, + + WASM_GRP_ENDING, ///< <-- mark the end of the list of groups +} wasm_insn_group; + +#ifdef __cplusplus +} +#endif + +#endif +#ifndef CAPSTONE_MOS65XX_H +#define CAPSTONE_MOS65XX_H + +/* Capstone Disassembly Engine */ +/* By Sebastian Macke , 2019 */ + +#ifndef CAPSTONE_BPF_H +#define CAPSTONE_BPF_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +/// Operand type for instruction's operands +typedef enum bpf_op_type { + BPF_OP_INVALID = 0, + + BPF_OP_REG, + BPF_OP_IMM, + BPF_OP_OFF, + BPF_OP_MEM, + BPF_OP_MMEM, ///< M[k] in cBPF + BPF_OP_MSH, ///< corresponds to cBPF's BPF_MSH mode + BPF_OP_EXT, ///< cBPF's extension (not eBPF) +} bpf_op_type; + +/// BPF registers +typedef enum bpf_reg { + BPF_REG_INVALID = 0, + + ///< cBPF + BPF_REG_A, + BPF_REG_X, + + ///< eBPF + BPF_REG_R0, + BPF_REG_R1, + BPF_REG_R2, + BPF_REG_R3, + BPF_REG_R4, + BPF_REG_R5, + BPF_REG_R6, + BPF_REG_R7, + BPF_REG_R8, + BPF_REG_R9, + BPF_REG_R10, + + BPF_REG_ENDING, +} bpf_reg; + +/// Instruction's operand referring to memory +/// This is associated with BPF_OP_MEM operand type above +typedef struct bpf_op_mem { + bpf_reg base; ///< base register + uint32_t disp; ///< offset value +} bpf_op_mem; + +typedef enum bpf_ext_type { + BPF_EXT_INVALID = 0, + + BPF_EXT_LEN, +} bpf_ext_type; + +/// Instruction operand +typedef struct cs_bpf_op { + bpf_op_type type; + union { + uint8_t reg; ///< register value for REG operand + uint64_t imm; ///< immediate value IMM operand + uint32_t off; ///< offset value, used in jump & call + bpf_op_mem mem; ///< base/disp value for MEM operand + /* cBPF only */ + uint32_t mmem; ///< M[k] in cBPF + uint32_t msh; ///< corresponds to cBPF's BPF_MSH mode + uint32_t ext; ///< cBPF's extension (not eBPF) + }; + + /// How is this operand accessed? (READ, WRITE or READ|WRITE) + /// This field is combined of cs_ac_type. + /// NOTE: this field is irrelevant if engine is compiled in DIET mode. + uint8_t access; +} cs_bpf_op; + +/// Instruction structure +typedef struct cs_bpf { + uint8_t op_count; + cs_bpf_op operands[4]; +} cs_bpf; + +/// BPF instruction +typedef enum bpf_insn { + BPF_INS_INVALID = 0, + + ///< ALU + BPF_INS_ADD, + BPF_INS_SUB, + BPF_INS_MUL, + BPF_INS_DIV, + BPF_INS_OR, + BPF_INS_AND, + BPF_INS_LSH, + BPF_INS_RSH, + BPF_INS_NEG, + BPF_INS_MOD, + BPF_INS_XOR, + BPF_INS_MOV, ///< eBPF only + BPF_INS_ARSH, ///< eBPF only + + ///< ALU64, eBPF only + BPF_INS_ADD64, + BPF_INS_SUB64, + BPF_INS_MUL64, + BPF_INS_DIV64, + BPF_INS_OR64, + BPF_INS_AND64, + BPF_INS_LSH64, + BPF_INS_RSH64, + BPF_INS_NEG64, + BPF_INS_MOD64, + BPF_INS_XOR64, + BPF_INS_MOV64, + BPF_INS_ARSH64, + + ///< Byteswap, eBPF only + BPF_INS_LE16, + BPF_INS_LE32, + BPF_INS_LE64, + BPF_INS_BE16, + BPF_INS_BE32, + BPF_INS_BE64, + + ///< Load + BPF_INS_LDW, ///< eBPF only + BPF_INS_LDH, + BPF_INS_LDB, + BPF_INS_LDDW, ///< eBPF only: load 64-bit imm + BPF_INS_LDXW, ///< eBPF only + BPF_INS_LDXH, ///< eBPF only + BPF_INS_LDXB, ///< eBPF only + BPF_INS_LDXDW, ///< eBPF only + + ///< Store + BPF_INS_STW, ///< eBPF only + BPF_INS_STH, ///< eBPF only + BPF_INS_STB, ///< eBPF only + BPF_INS_STDW, ///< eBPF only + BPF_INS_STXW, ///< eBPF only + BPF_INS_STXH, ///< eBPF only + BPF_INS_STXB, ///< eBPF only + BPF_INS_STXDW, ///< eBPF only + BPF_INS_XADDW, ///< eBPF only + BPF_INS_XADDDW, ///< eBPF only + + ///< Jump + BPF_INS_JMP, + BPF_INS_JEQ, + BPF_INS_JGT, + BPF_INS_JGE, + BPF_INS_JSET, + BPF_INS_JNE, ///< eBPF only + BPF_INS_JSGT, ///< eBPF only + BPF_INS_JSGE, ///< eBPF only + BPF_INS_CALL, ///< eBPF only + BPF_INS_EXIT, ///< eBPF only + BPF_INS_JLT, ///< eBPF only + BPF_INS_JLE, ///< eBPF only + BPF_INS_JSLT, ///< eBPF only + BPF_INS_JSLE, ///< eBPF only + + ///< Return, cBPF only + BPF_INS_RET, + + ///< Misc, cBPF only + BPF_INS_TAX, + BPF_INS_TXA, + + BPF_INS_ENDING, + + // alias instructions + BPF_INS_LD = BPF_INS_LDW, ///< cBPF only + BPF_INS_LDX = BPF_INS_LDXW, ///< cBPF only + BPF_INS_ST = BPF_INS_STW, ///< cBPF only + BPF_INS_STX = BPF_INS_STXW, ///< cBPF only +} bpf_insn; + +/// Group of BPF instructions +typedef enum bpf_insn_group { + BPF_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + BPF_GRP_LOAD, + BPF_GRP_STORE, + BPF_GRP_ALU, + BPF_GRP_JUMP, + BPF_GRP_CALL, ///< eBPF only + BPF_GRP_RETURN, + BPF_GRP_MISC, ///< cBPF only + + BPF_GRP_ENDING, +} bpf_insn_group; + +#ifdef __cplusplus +} +#endif + +#endif + +/// NOTE: All information in cs_detail is only available when CS_OPT_DETAIL = CS_OPT_ON +/// Initialized as memset(., 0, offsetof(cs_detail, ARCH)+sizeof(cs_ARCH)) +/// by ARCH_getInstruction in arch/ARCH/ARCHDisassembler.c +/// if cs_detail changes, in particular if a field is added after the union, +/// then update arch/ARCH/ARCHDisassembler.c accordingly +typedef struct cs_detail { + uint16_t regs_read[16]; ///< list of implicit registers read by this insn + uint8_t regs_read_count; ///< number of implicit registers read by this insn + + uint16_t regs_write[20]; ///< list of implicit registers modified by this insn + uint8_t regs_write_count; ///< number of implicit registers modified by this insn + + uint8_t groups[8]; ///< list of group this instruction belong to + uint8_t groups_count; ///< number of groups this insn belongs to + + /// Architecture-specific instruction info + union { + cs_x86 x86; ///< X86 architecture, including 16-bit, 32-bit & 64-bit mode + cs_arm64 arm64; ///< ARM64 architecture (aka AArch64) + cs_arm arm; ///< ARM architecture (including Thumb/Thumb2) + cs_m68k m68k; ///< M68K architecture + cs_mips mips; ///< MIPS architecture + cs_ppc ppc; ///< PowerPC architecture + cs_sparc sparc; ///< Sparc architecture + cs_sysz sysz; ///< SystemZ architecture + cs_xcore xcore; ///< XCore architecture + cs_tms320c64x tms320c64x; ///< TMS320C64x architecture + cs_m680x m680x; ///< M680X architecture + cs_evm evm; ///< Ethereum architecture + cs_mos65xx mos65xx; ///< MOS65XX architecture (including MOS6502) + cs_wasm wasm; ///< Web Assembly architecture + cs_bpf bpf; ///< Berkeley Packet Filter architecture (including eBPF) + cs_riscv riscv; ///< RISCV architecture + }; +} cs_detail; + +/// Detail information of disassembled instruction +typedef struct cs_insn { + /// Instruction ID (basically a numeric ID for the instruction mnemonic) + /// Find the instruction id in the '[ARCH]_insn' enum in the header file + /// of corresponding architecture, such as 'arm_insn' in arm.h for ARM, + /// 'x86_insn' in x86.h for X86, etc... + /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF + /// NOTE: in Skipdata mode, "data" instruction has 0 for this id field. + unsigned int id; + + /// Address (EIP) of this instruction + /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF + uint64_t address; + + /// Size of this instruction + /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF + uint16_t size; + + /// Machine bytes of this instruction, with number of bytes indicated by @size above + /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF + uint8_t bytes[24]; + + /// Ascii text of instruction mnemonic + /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF + char mnemonic[CS_MNEMONIC_SIZE]; + + /// Ascii text of instruction operands + /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF + char op_str[160]; + + /// Pointer to cs_detail. + /// NOTE: detail pointer is only valid when both requirements below are met: + /// (1) CS_OP_DETAIL = CS_OPT_ON + /// (2) Engine is not in Skipdata mode (CS_OP_SKIPDATA option set to CS_OPT_ON) + /// + /// NOTE 2: when in Skipdata mode, or when detail mode is OFF, even if this pointer + /// is not NULL, its content is still irrelevant. + cs_detail *detail; +} cs_insn; + + +/// Calculate the offset of a disassembled instruction in its buffer, given its position +/// in its array of disassembled insn +/// NOTE: this macro works with position (>=1), not index +#define CS_INSN_OFFSET(insns, post) (insns[post - 1].address - insns[0].address) + + +/// All type of errors encountered by Capstone API. +/// These are values returned by cs_errno() +typedef enum cs_err { + CS_ERR_OK = 0, ///< No error: everything was fine + CS_ERR_MEM, ///< Out-Of-Memory error: cs_open(), cs_disasm(), cs_disasm_iter() + CS_ERR_ARCH, ///< Unsupported architecture: cs_open() + CS_ERR_HANDLE, ///< Invalid handle: cs_op_count(), cs_op_index() + CS_ERR_CSH, ///< Invalid csh argument: cs_close(), cs_errno(), cs_option() + CS_ERR_MODE, ///< Invalid/unsupported mode: cs_open() + CS_ERR_OPTION, ///< Invalid/unsupported option: cs_option() + CS_ERR_DETAIL, ///< Information is unavailable because detail option is OFF + CS_ERR_MEMSETUP, ///< Dynamic memory management uninitialized (see CS_OPT_MEM) + CS_ERR_VERSION, ///< Unsupported version (bindings) + CS_ERR_DIET, ///< Access irrelevant data in "diet" engine + CS_ERR_SKIPDATA, ///< Access irrelevant data for "data" instruction in SKIPDATA mode + CS_ERR_X86_ATT, ///< X86 AT&T syntax is unsupported (opt-out at compile time) + CS_ERR_X86_INTEL, ///< X86 Intel syntax is unsupported (opt-out at compile time) + CS_ERR_X86_MASM, ///< X86 Masm syntax is unsupported (opt-out at compile time) +} cs_err; + +/** + Return combined API version & major and minor version numbers. + + @major: major number of API version + @minor: minor number of API version + + @return hexical number as (major << 8 | minor), which encodes both + major & minor versions. + NOTE: This returned value can be compared with version number made + with macro CS_MAKE_VERSION + + For example, second API version would return 1 in @major, and 1 in @minor + The return value would be 0x0101 + + NOTE: if you only care about returned value, but not major and minor values, + set both @major & @minor arguments to NULL. +*/ +CAPSTONE_EXPORT +unsigned int CAPSTONE_API cs_version(int *major, int *minor); + + +/** + This API can be used to either ask for archs supported by this library, + or check to see if the library was compile with 'diet' option (or called + in 'diet' mode). + + To check if a particular arch is supported by this library, set @query to + arch mode (CS_ARCH_* value). + To verify if this library supports all the archs, use CS_ARCH_ALL. + + To check if this library is in 'diet' mode, set @query to CS_SUPPORT_DIET. + + @return True if this library supports the given arch, or in 'diet' mode. +*/ +CAPSTONE_EXPORT +bool CAPSTONE_API cs_support(int query); + +/** + Initialize CS handle: this must be done before any usage of CS. + + @arch: architecture type (CS_ARCH_*) + @mode: hardware mode. This is combined of CS_MODE_* + @handle: pointer to handle, which will be updated at return time + + @return CS_ERR_OK on success, or other value on failure (refer to cs_err enum + for detailed error). +*/ +CAPSTONE_EXPORT +cs_err CAPSTONE_API cs_open(cs_arch arch, cs_mode mode, csh *handle); + +/** + Close CS handle: MUST do to release the handle when it is not used anymore. + NOTE: this must be only called when there is no longer usage of Capstone, + not even access to cs_insn array. The reason is the this API releases some + cached memory, thus access to any Capstone API after cs_close() might crash + your application. + + In fact,this API invalidate @handle by ZERO out its value (i.e *handle = 0). + + @handle: pointer to a handle returned by cs_open() + + @return CS_ERR_OK on success, or other value on failure (refer to cs_err enum + for detailed error). +*/ +CAPSTONE_EXPORT +cs_err CAPSTONE_API cs_close(csh *handle); + +/** + Set option for disassembling engine at runtime + + @handle: handle returned by cs_open() + @type: type of option to be set + @value: option value corresponding with @type + + @return: CS_ERR_OK on success, or other value on failure. + Refer to cs_err enum for detailed error. + + NOTE: in the case of CS_OPT_MEM, handle's value can be anything, + so that cs_option(handle, CS_OPT_MEM, value) can (i.e must) be called + even before cs_open() +*/ +CAPSTONE_EXPORT +cs_err CAPSTONE_API cs_option(csh handle, cs_opt_type type, size_t value); + +/** + Report the last error number when some API function fail. + Like glibc's errno, cs_errno might not retain its old value once accessed. + + @handle: handle returned by cs_open() + + @return: error code of cs_err enum type (CS_ERR_*, see above) +*/ +CAPSTONE_EXPORT +cs_err CAPSTONE_API cs_errno(csh handle); + + +/** + Return a string describing given error code. + + @code: error code (see CS_ERR_* above) + + @return: returns a pointer to a string that describes the error code + passed in the argument @code +*/ +CAPSTONE_EXPORT +const char * CAPSTONE_API cs_strerror(cs_err code); + +/** + Disassemble binary code, given the code buffer, size, address and number + of instructions to be decoded. + This API dynamically allocate memory to contain disassembled instruction. + Resulting instructions will be put into @*insn + + NOTE 1: this API will automatically determine memory needed to contain + output disassembled instructions in @insn. + + NOTE 2: caller must free the allocated memory itself to avoid memory leaking. + + NOTE 3: for system with scarce memory to be dynamically allocated such as + OS kernel or firmware, the API cs_disasm_iter() might be a better choice than + cs_disasm(). The reason is that with cs_disasm(), based on limited available + memory, we have to calculate in advance how many instructions to be disassembled, + which complicates things. This is especially troublesome for the case @count=0, + when cs_disasm() runs uncontrollably (until either end of input buffer, or + when it encounters an invalid instruction). + + @handle: handle returned by cs_open() + @code: buffer containing raw binary code to be disassembled. + @code_size: size of the above code buffer. + @address: address of the first instruction in given raw code buffer. + @insn: array of instructions filled in by this API. + NOTE: @insn will be allocated by this function, and should be freed + with cs_free() API. + @count: number of instructions to be disassembled, or 0 to get all of them + + @return: the number of successfully disassembled instructions, + or 0 if this function failed to disassemble the given code + + On failure, call cs_errno() for error code. +*/ +CAPSTONE_EXPORT +size_t CAPSTONE_API cs_disasm(csh handle, + const uint8_t *code, size_t code_size, + uint64_t address, + size_t count, + cs_insn **insn); + +/** + Free memory allocated by cs_malloc() or cs_disasm() (argument @insn) + + @insn: pointer returned by @insn argument in cs_disasm() or cs_malloc() + @count: number of cs_insn structures returned by cs_disasm(), or 1 + to free memory allocated by cs_malloc(). +*/ +CAPSTONE_EXPORT +void CAPSTONE_API cs_free(cs_insn *insn, size_t count); + + +/** + Allocate memory for 1 instruction to be used by cs_disasm_iter(). + + @handle: handle returned by cs_open() + + NOTE: when no longer in use, you can reclaim the memory allocated for + this instruction with cs_free(insn, 1) +*/ +CAPSTONE_EXPORT +cs_insn * CAPSTONE_API cs_malloc(csh handle); + +/** + Fast API to disassemble binary code, given the code buffer, size, address + and number of instructions to be decoded. + This API puts the resulting instruction into a given cache in @insn. + See tests/test_iter.c for sample code demonstrating this API. + + NOTE 1: this API will update @code, @size & @address to point to the next + instruction in the input buffer. Therefore, it is convenient to use + cs_disasm_iter() inside a loop to quickly iterate all the instructions. + While decoding one instruction at a time can also be achieved with + cs_disasm(count=1), some benchmarks shown that cs_disasm_iter() can be 30% + faster on random input. + + NOTE 2: the cache in @insn can be created with cs_malloc() API. + + NOTE 3: for system with scarce memory to be dynamically allocated such as + OS kernel or firmware, this API is recommended over cs_disasm(), which + allocates memory based on the number of instructions to be disassembled. + The reason is that with cs_disasm(), based on limited available memory, + we have to calculate in advance how many instructions to be disassembled, + which complicates things. This is especially troublesome for the case + @count=0, when cs_disasm() runs uncontrollably (until either end of input + buffer, or when it encounters an invalid instruction). + + @handle: handle returned by cs_open() + @code: buffer containing raw binary code to be disassembled + @size: size of above code + @address: address of the first insn in given raw code buffer + @insn: pointer to instruction to be filled in by this API. + + @return: true if this API successfully decode 1 instruction, + or false otherwise. + + On failure, call cs_errno() for error code. +*/ +CAPSTONE_EXPORT +bool CAPSTONE_API cs_disasm_iter(csh handle, + const uint8_t **code, size_t *size, + uint64_t *address, cs_insn *insn); + +/** + Return friendly name of register in a string. + Find the instruction id from header file of corresponding architecture (arm.h for ARM, + x86.h for X86, ...) + + WARN: when in 'diet' mode, this API is irrelevant because engine does not + store register name. + + @handle: handle returned by cs_open() + @reg_id: register id + + @return: string name of the register, or NULL if @reg_id is invalid. +*/ +CAPSTONE_EXPORT +const char * CAPSTONE_API cs_reg_name(csh handle, unsigned int reg_id); + +/** + Return friendly name of an instruction in a string. + Find the instruction id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) + + WARN: when in 'diet' mode, this API is irrelevant because the engine does not + store instruction name. + + @handle: handle returned by cs_open() + @insn_id: instruction id + + @return: string name of the instruction, or NULL if @insn_id is invalid. +*/ +CAPSTONE_EXPORT +const char * CAPSTONE_API cs_insn_name(csh handle, unsigned int insn_id); + +/** + Return friendly name of a group id (that an instruction can belong to) + Find the group id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) + + WARN: when in 'diet' mode, this API is irrelevant because the engine does not + store group name. + + @handle: handle returned by cs_open() + @group_id: group id + + @return: string name of the group, or NULL if @group_id is invalid. +*/ +CAPSTONE_EXPORT +const char * CAPSTONE_API cs_group_name(csh handle, unsigned int group_id); + +/** + Check if a disassembled instruction belong to a particular group. + Find the group id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) + Internally, this simply verifies if @group_id matches any member of insn->groups array. + + NOTE: this API is only valid when detail option is ON (which is OFF by default). + + WARN: when in 'diet' mode, this API is irrelevant because the engine does not + update @groups array. + + @handle: handle returned by cs_open() + @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() + @group_id: group that you want to check if this instruction belong to. + + @return: true if this instruction indeed belongs to the given group, or false otherwise. +*/ +CAPSTONE_EXPORT +bool CAPSTONE_API cs_insn_group(csh handle, const cs_insn *insn, unsigned int group_id); + +/** + Check if a disassembled instruction IMPLICITLY used a particular register. + Find the register id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) + Internally, this simply verifies if @reg_id matches any member of insn->regs_read array. + + NOTE: this API is only valid when detail option is ON (which is OFF by default) + + WARN: when in 'diet' mode, this API is irrelevant because the engine does not + update @regs_read array. + + @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() + @reg_id: register that you want to check if this instruction used it. + + @return: true if this instruction indeed implicitly used the given register, or false otherwise. +*/ +CAPSTONE_EXPORT +bool CAPSTONE_API cs_reg_read(csh handle, const cs_insn *insn, unsigned int reg_id); + +/** + Check if a disassembled instruction IMPLICITLY modified a particular register. + Find the register id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) + Internally, this simply verifies if @reg_id matches any member of insn->regs_write array. + + NOTE: this API is only valid when detail option is ON (which is OFF by default) + + WARN: when in 'diet' mode, this API is irrelevant because the engine does not + update @regs_write array. + + @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() + @reg_id: register that you want to check if this instruction modified it. + + @return: true if this instruction indeed implicitly modified the given register, or false otherwise. +*/ +CAPSTONE_EXPORT +bool CAPSTONE_API cs_reg_write(csh handle, const cs_insn *insn, unsigned int reg_id); + +/** + Count the number of operands of a given type. + Find the operand type in header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) + + NOTE: this API is only valid when detail option is ON (which is OFF by default) + + @handle: handle returned by cs_open() + @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() + @op_type: Operand type to be found. + + @return: number of operands of given type @op_type in instruction @insn, + or -1 on failure. +*/ +CAPSTONE_EXPORT +int CAPSTONE_API cs_op_count(csh handle, const cs_insn *insn, unsigned int op_type); + +/** + Retrieve the position of operand of given type in .operands[] array. + Later, the operand can be accessed using the returned position. + Find the operand type in header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) + + NOTE: this API is only valid when detail option is ON (which is OFF by default) + + @handle: handle returned by cs_open() + @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() + @op_type: Operand type to be found. + @position: position of the operand to be found. This must be in the range + [1, cs_op_count(handle, insn, op_type)] + + @return: index of operand of given type @op_type in .operands[] array + in instruction @insn, or -1 on failure. +*/ +CAPSTONE_EXPORT +int CAPSTONE_API cs_op_index(csh handle, const cs_insn *insn, unsigned int op_type, + unsigned int position); + +/// Type of array to keep the list of registers +typedef uint16_t cs_regs[64]; + +/** + Retrieve all the registers accessed by an instruction, either explicitly or + implicitly. + + WARN: when in 'diet' mode, this API is irrelevant because engine does not + store registers. + + @handle: handle returned by cs_open() + @insn: disassembled instruction structure returned from cs_disasm() or cs_disasm_iter() + @regs_read: on return, this array contains all registers read by instruction. + @regs_read_count: number of registers kept inside @regs_read array. + @regs_write: on return, this array contains all registers written by instruction. + @regs_write_count: number of registers kept inside @regs_write array. + + @return CS_ERR_OK on success, or other value on failure (refer to cs_err enum + for detailed error). +*/ +CAPSTONE_EXPORT +cs_err CAPSTONE_API cs_regs_access(csh handle, const cs_insn *insn, + cs_regs regs_read, uint8_t *regs_read_count, + cs_regs regs_write, uint8_t *regs_write_count); + +#ifdef __cplusplus +} +#endif + +#endif +/* + * Copyright (C) 2009-2019 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_X86_WRITER_H__ +#define __GUM_X86_WRITER_H__ + + + +G_BEGIN_DECLS + +typedef struct _GumX86Writer GumX86Writer; +typedef guint GumCpuReg; +typedef guint GumPtrTarget; + +struct _GumX86Writer +{ + volatile gint ref_count; + + GumCpuType target_cpu; + GumAbiType target_abi; + + guint8 * base; + guint8 * code; + GumAddress pc; + + GumMetalHashTable * label_defs; + GumMetalArray label_refs; +}; + +enum _GumCpuReg +{ + /* 32 bit */ + GUM_REG_EAX = 0, + GUM_REG_ECX, + GUM_REG_EDX, + GUM_REG_EBX, + GUM_REG_ESP, + GUM_REG_EBP, + GUM_REG_ESI, + GUM_REG_EDI, + + GUM_REG_R8D, + GUM_REG_R9D, + GUM_REG_R10D, + GUM_REG_R11D, + GUM_REG_R12D, + GUM_REG_R13D, + GUM_REG_R14D, + GUM_REG_R15D, + + GUM_REG_EIP, + + /* 64 bit */ + GUM_REG_RAX, + GUM_REG_RCX, + GUM_REG_RDX, + GUM_REG_RBX, + GUM_REG_RSP, + GUM_REG_RBP, + GUM_REG_RSI, + GUM_REG_RDI, + + GUM_REG_R8, + GUM_REG_R9, + GUM_REG_R10, + GUM_REG_R11, + GUM_REG_R12, + GUM_REG_R13, + GUM_REG_R14, + GUM_REG_R15, + + GUM_REG_RIP, + + /* Meta */ + GUM_REG_XAX, + GUM_REG_XCX, + GUM_REG_XDX, + GUM_REG_XBX, + GUM_REG_XSP, + GUM_REG_XBP, + GUM_REG_XSI, + GUM_REG_XDI, + + GUM_REG_XIP, + + GUM_REG_NONE +}; + +enum _GumPtrTarget +{ + GUM_PTR_BYTE, + GUM_PTR_DWORD, + GUM_PTR_QWORD +}; + +GUM_API GumX86Writer * gum_x86_writer_new (gpointer code_address); +GUM_API GumX86Writer * gum_x86_writer_ref (GumX86Writer * writer); +GUM_API void gum_x86_writer_unref (GumX86Writer * writer); + +GUM_API void gum_x86_writer_init (GumX86Writer * writer, + gpointer code_address); +GUM_API void gum_x86_writer_clear (GumX86Writer * writer); + +GUM_API void gum_x86_writer_reset (GumX86Writer * writer, + gpointer code_address); +GUM_API void gum_x86_writer_set_target_cpu (GumX86Writer * self, + GumCpuType cpu_type); +GUM_API void gum_x86_writer_set_target_abi (GumX86Writer * self, + GumAbiType abi_type); + +GUM_API gpointer gum_x86_writer_cur (GumX86Writer * self); +GUM_API guint gum_x86_writer_offset (GumX86Writer * self); + +GUM_API gboolean gum_x86_writer_flush (GumX86Writer * self); + +GUM_API GumCpuReg gum_x86_writer_get_cpu_register_for_nth_argument ( + GumX86Writer * self, guint n); + +GUM_API gboolean gum_x86_writer_put_label (GumX86Writer * self, + gconstpointer id); + +GUM_API gboolean gum_x86_writer_can_branch_directly_between (GumAddress from, + GumAddress to); +GUM_API gboolean gum_x86_writer_put_call_address_with_arguments ( + GumX86Writer * self, GumCallingConvention conv, GumAddress func, + guint n_args, ...); +GUM_API gboolean gum_x86_writer_put_call_address_with_arguments_array ( + GumX86Writer * self, GumCallingConvention conv, GumAddress func, + guint n_args, const GumArgument * args); +GUM_API gboolean gum_x86_writer_put_call_address_with_aligned_arguments ( + GumX86Writer * self, GumCallingConvention conv, GumAddress func, + guint n_args, ...); +GUM_API gboolean gum_x86_writer_put_call_address_with_aligned_arguments_array ( + GumX86Writer * self, GumCallingConvention conv, GumAddress func, + guint n_args, const GumArgument * args); +GUM_API gboolean gum_x86_writer_put_call_reg_with_arguments ( + GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, + guint n_args, ...); +GUM_API gboolean gum_x86_writer_put_call_reg_with_arguments_array ( + GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, + guint n_args, const GumArgument * args); +GUM_API gboolean gum_x86_writer_put_call_reg_with_aligned_arguments ( + GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, + guint n_args, ...); +GUM_API gboolean gum_x86_writer_put_call_reg_with_aligned_arguments_array ( + GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, + guint n_args, const GumArgument * args); +GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr_with_arguments ( + GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, + gssize offset, guint n_args, ...); +GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr_with_arguments_array ( + GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, + gssize offset, guint n_args, const GumArgument * args); +GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr_with_aligned_arguments ( + GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, + gssize offset, guint n_args, ...); +GUM_API gboolean + gum_x86_writer_put_call_reg_offset_ptr_with_aligned_arguments_array ( + GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, + gssize offset, guint n_args, const GumArgument * args); +GUM_API gboolean gum_x86_writer_put_call_address (GumX86Writer * self, + GumAddress address); +GUM_API gboolean gum_x86_writer_put_call_reg (GumX86Writer * self, + GumCpuReg reg); +GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr (GumX86Writer * self, + GumCpuReg reg, gssize offset); +GUM_API gboolean gum_x86_writer_put_call_indirect (GumX86Writer * self, + GumAddress addr); +GUM_API gboolean gum_x86_writer_put_call_indirect_label (GumX86Writer * self, + gconstpointer label_id); +GUM_API void gum_x86_writer_put_call_near_label (GumX86Writer * self, + gconstpointer label_id); +GUM_API void gum_x86_writer_put_leave (GumX86Writer * self); +GUM_API void gum_x86_writer_put_ret (GumX86Writer * self); +GUM_API void gum_x86_writer_put_ret_imm (GumX86Writer * self, + guint16 imm_value); +GUM_API gboolean gum_x86_writer_put_jmp_address (GumX86Writer * self, + GumAddress address); +GUM_API void gum_x86_writer_put_jmp_short_label (GumX86Writer * self, + gconstpointer label_id); +GUM_API void gum_x86_writer_put_jmp_near_label (GumX86Writer * self, + gconstpointer label_id); +GUM_API gboolean gum_x86_writer_put_jmp_reg (GumX86Writer * self, + GumCpuReg reg); +GUM_API gboolean gum_x86_writer_put_jmp_reg_ptr (GumX86Writer * self, + GumCpuReg reg); +GUM_API gboolean gum_x86_writer_put_jmp_reg_offset_ptr (GumX86Writer * self, + GumCpuReg reg, gssize offset); +GUM_API gboolean gum_x86_writer_put_jmp_near_ptr (GumX86Writer * self, + GumAddress address); +GUM_API gboolean gum_x86_writer_put_jcc_short (GumX86Writer * self, + x86_insn instruction_id, gconstpointer target, GumBranchHint hint); +GUM_API gboolean gum_x86_writer_put_jcc_near (GumX86Writer * self, + x86_insn instruction_id, gconstpointer target, GumBranchHint hint); +GUM_API void gum_x86_writer_put_jcc_short_label (GumX86Writer * self, + x86_insn instruction_id, gconstpointer label_id, GumBranchHint hint); +GUM_API void gum_x86_writer_put_jcc_near_label (GumX86Writer * self, + x86_insn instruction_id, gconstpointer label_id, GumBranchHint hint); + +GUM_API gboolean gum_x86_writer_put_add_reg_imm (GumX86Writer * self, + GumCpuReg reg, gssize imm_value); +GUM_API gboolean gum_x86_writer_put_add_reg_reg (GumX86Writer * self, + GumCpuReg dst_reg, GumCpuReg src_reg); +GUM_API gboolean gum_x86_writer_put_add_reg_near_ptr (GumX86Writer * self, + GumCpuReg dst_reg, GumAddress src_address); +GUM_API gboolean gum_x86_writer_put_sub_reg_imm (GumX86Writer * self, + GumCpuReg reg, gssize imm_value); +GUM_API gboolean gum_x86_writer_put_sub_reg_reg (GumX86Writer * self, + GumCpuReg dst_reg, GumCpuReg src_reg); +GUM_API gboolean gum_x86_writer_put_sub_reg_near_ptr (GumX86Writer * self, + GumCpuReg dst_reg, GumAddress src_address); +GUM_API gboolean gum_x86_writer_put_inc_reg (GumX86Writer * self, + GumCpuReg reg); +GUM_API gboolean gum_x86_writer_put_dec_reg (GumX86Writer * self, + GumCpuReg reg); +GUM_API gboolean gum_x86_writer_put_inc_reg_ptr (GumX86Writer * self, + GumPtrTarget target, GumCpuReg reg); +GUM_API gboolean gum_x86_writer_put_dec_reg_ptr (GumX86Writer * self, + GumPtrTarget target, GumCpuReg reg); +GUM_API gboolean gum_x86_writer_put_lock_xadd_reg_ptr_reg (GumX86Writer * self, + GumCpuReg dst_reg, GumCpuReg src_reg); +GUM_API gboolean gum_x86_writer_put_lock_cmpxchg_reg_ptr_reg ( + GumX86Writer * self, GumCpuReg dst_reg, GumCpuReg src_reg); +GUM_API gboolean gum_x86_writer_put_lock_inc_imm32_ptr (GumX86Writer * self, + gpointer target); +GUM_API gboolean gum_x86_writer_put_lock_dec_imm32_ptr (GumX86Writer * self, + gpointer target); + +GUM_API gboolean gum_x86_writer_put_and_reg_reg (GumX86Writer * self, + GumCpuReg dst_reg, GumCpuReg src_reg); +GUM_API gboolean gum_x86_writer_put_and_reg_u32 (GumX86Writer * self, + GumCpuReg reg, guint32 imm_value); +GUM_API gboolean gum_x86_writer_put_shl_reg_u8 (GumX86Writer * self, + GumCpuReg reg, guint8 imm_value); +GUM_API gboolean gum_x86_writer_put_shr_reg_u8 (GumX86Writer * self, + GumCpuReg reg, guint8 imm_value); +GUM_API gboolean gum_x86_writer_put_xor_reg_reg (GumX86Writer * self, + GumCpuReg dst_reg, GumCpuReg src_reg); + +GUM_API gboolean gum_x86_writer_put_mov_reg_reg (GumX86Writer * self, + GumCpuReg dst_reg, GumCpuReg src_reg); +GUM_API gboolean gum_x86_writer_put_mov_reg_u32 (GumX86Writer * self, + GumCpuReg dst_reg, guint32 imm_value); +GUM_API gboolean gum_x86_writer_put_mov_reg_u64 (GumX86Writer * self, + GumCpuReg dst_reg, guint64 imm_value); +GUM_API void gum_x86_writer_put_mov_reg_address (GumX86Writer * self, + GumCpuReg dst_reg, GumAddress address); +GUM_API void gum_x86_writer_put_mov_reg_ptr_u32 (GumX86Writer * self, + GumCpuReg dst_reg, guint32 imm_value); +GUM_API gboolean gum_x86_writer_put_mov_reg_offset_ptr_u32 (GumX86Writer * self, + GumCpuReg dst_reg, gssize dst_offset, guint32 imm_value); +GUM_API void gum_x86_writer_put_mov_reg_ptr_reg (GumX86Writer * self, + GumCpuReg dst_reg, GumCpuReg src_reg); +GUM_API gboolean gum_x86_writer_put_mov_reg_offset_ptr_reg (GumX86Writer * self, + GumCpuReg dst_reg, gssize dst_offset, GumCpuReg src_reg); +GUM_API void gum_x86_writer_put_mov_reg_reg_ptr (GumX86Writer * self, + GumCpuReg dst_reg, GumCpuReg src_reg); +GUM_API gboolean gum_x86_writer_put_mov_reg_reg_offset_ptr (GumX86Writer * self, + GumCpuReg dst_reg, GumCpuReg src_reg, gssize src_offset); +GUM_API gboolean gum_x86_writer_put_mov_reg_base_index_scale_offset_ptr ( + GumX86Writer * self, GumCpuReg dst_reg, GumCpuReg base_reg, + GumCpuReg index_reg, guint8 scale, gssize offset); + +GUM_API gboolean gum_x86_writer_put_mov_reg_near_ptr (GumX86Writer * self, + GumCpuReg dst_reg, GumAddress src_address); +GUM_API gboolean gum_x86_writer_put_mov_near_ptr_reg (GumX86Writer * self, + GumAddress dst_address, GumCpuReg src_reg); + +GUM_API gboolean gum_x86_writer_put_mov_fs_u32_ptr_reg (GumX86Writer * self, + guint32 fs_offset, GumCpuReg src_reg); +GUM_API gboolean gum_x86_writer_put_mov_reg_fs_u32_ptr (GumX86Writer * self, + GumCpuReg dst_reg, guint32 fs_offset); +GUM_API gboolean gum_x86_writer_put_mov_gs_u32_ptr_reg (GumX86Writer * self, + guint32 fs_offset, GumCpuReg src_reg); +GUM_API gboolean gum_x86_writer_put_mov_reg_gs_u32_ptr (GumX86Writer * self, + GumCpuReg dst_reg, guint32 fs_offset); + +GUM_API void gum_x86_writer_put_movq_xmm0_esp_offset_ptr (GumX86Writer * self, + gint8 offset); +GUM_API void gum_x86_writer_put_movq_eax_offset_ptr_xmm0 (GumX86Writer * self, + gint8 offset); +GUM_API void gum_x86_writer_put_movdqu_xmm0_esp_offset_ptr (GumX86Writer * self, + gint8 offset); +GUM_API void gum_x86_writer_put_movdqu_eax_offset_ptr_xmm0 (GumX86Writer * self, + gint8 offset); + +GUM_API gboolean gum_x86_writer_put_lea_reg_reg_offset (GumX86Writer * self, + GumCpuReg dst_reg, GumCpuReg src_reg, gssize src_offset); + +GUM_API gboolean gum_x86_writer_put_xchg_reg_reg_ptr (GumX86Writer * self, + GumCpuReg left_reg, GumCpuReg right_reg); + +GUM_API void gum_x86_writer_put_push_u32 (GumX86Writer * self, + guint32 imm_value); +GUM_API gboolean gum_x86_writer_put_push_near_ptr (GumX86Writer * self, + GumAddress address); +GUM_API gboolean gum_x86_writer_put_push_reg (GumX86Writer * self, + GumCpuReg reg); +GUM_API gboolean gum_x86_writer_put_pop_reg (GumX86Writer * self, + GumCpuReg reg); +GUM_API void gum_x86_writer_put_push_imm_ptr (GumX86Writer * self, + gconstpointer imm_ptr); +GUM_API void gum_x86_writer_put_pushax (GumX86Writer * self); +GUM_API void gum_x86_writer_put_popax (GumX86Writer * self); +GUM_API void gum_x86_writer_put_pushfx (GumX86Writer * self); +GUM_API void gum_x86_writer_put_popfx (GumX86Writer * self); + +GUM_API gboolean gum_x86_writer_put_test_reg_reg (GumX86Writer * self, + GumCpuReg reg_a, GumCpuReg reg_b); +GUM_API gboolean gum_x86_writer_put_test_reg_u32 (GumX86Writer * self, + GumCpuReg reg, guint32 imm_value); +GUM_API gboolean gum_x86_writer_put_cmp_reg_i32 (GumX86Writer * self, + GumCpuReg reg, gint32 imm_value); +GUM_API gboolean gum_x86_writer_put_cmp_reg_offset_ptr_reg (GumX86Writer * self, + GumCpuReg reg_a, gssize offset, GumCpuReg reg_b); +GUM_API void gum_x86_writer_put_cmp_imm_ptr_imm_u32 (GumX86Writer * self, + gconstpointer imm_ptr, guint32 imm_value); +GUM_API gboolean gum_x86_writer_put_cmp_reg_reg (GumX86Writer * self, + GumCpuReg reg_a, GumCpuReg reg_b); +GUM_API void gum_x86_writer_put_clc (GumX86Writer * self); +GUM_API void gum_x86_writer_put_stc (GumX86Writer * self); +GUM_API void gum_x86_writer_put_cld (GumX86Writer * self); +GUM_API void gum_x86_writer_put_std (GumX86Writer * self); + +GUM_API void gum_x86_writer_put_cpuid (GumX86Writer * self); +GUM_API void gum_x86_writer_put_lfence (GumX86Writer * self); +GUM_API void gum_x86_writer_put_rdtsc (GumX86Writer * self); +GUM_API void gum_x86_writer_put_pause (GumX86Writer * self); +GUM_API void gum_x86_writer_put_nop (GumX86Writer * self); +GUM_API void gum_x86_writer_put_breakpoint (GumX86Writer * self); +GUM_API void gum_x86_writer_put_padding (GumX86Writer * self, guint n); +GUM_API void gum_x86_writer_put_nop_padding (GumX86Writer * self, guint n); + +GUM_API void gum_x86_writer_put_u8 (GumX86Writer * self, guint8 value); +GUM_API void gum_x86_writer_put_s8 (GumX86Writer * self, gint8 value); +GUM_API void gum_x86_writer_put_bytes (GumX86Writer * self, const guint8 * data, + guint n); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2010-2020 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_ARM_WRITER_H__ +#define __GUM_ARM_WRITER_H__ + + +#define GUM_ARM_B_MAX_DISTANCE 0x01fffffc + +G_BEGIN_DECLS + +typedef struct _GumArmWriter GumArmWriter; + +struct _GumArmWriter +{ + volatile gint ref_count; + + GumOS target_os; + + guint32 * base; + guint32 * code; + GumAddress pc; + + GumMetalHashTable * label_defs; + GumMetalArray label_refs; + GumMetalArray literal_refs; + const guint32 * earliest_literal_insn; +}; + +GUM_API GumArmWriter * gum_arm_writer_new (gpointer code_address); +GUM_API GumArmWriter * gum_arm_writer_ref (GumArmWriter * writer); +GUM_API void gum_arm_writer_unref (GumArmWriter * writer); + +GUM_API void gum_arm_writer_init (GumArmWriter * writer, gpointer code_address); +GUM_API void gum_arm_writer_clear (GumArmWriter * writer); + +GUM_API void gum_arm_writer_reset (GumArmWriter * writer, + gpointer code_address); +GUM_API void gum_arm_writer_set_target_os (GumArmWriter * self, GumOS os); + +GUM_API gpointer gum_arm_writer_cur (GumArmWriter * self); +GUM_API guint gum_arm_writer_offset (GumArmWriter * self); +GUM_API void gum_arm_writer_skip (GumArmWriter * self, guint n_bytes); + +GUM_API gboolean gum_arm_writer_flush (GumArmWriter * self); + +GUM_API gboolean gum_arm_writer_put_label (GumArmWriter * self, + gconstpointer id); + +GUM_API void gum_arm_writer_put_call_address_with_arguments ( + GumArmWriter * self, GumAddress func, guint n_args, ...); +GUM_API void gum_arm_writer_put_call_address_with_arguments_array ( + GumArmWriter * self, GumAddress func, guint n_args, + const GumArgument * args); + +GUM_API void gum_arm_writer_put_branch_address (GumArmWriter * self, + GumAddress address); + +GUM_API gboolean gum_arm_writer_can_branch_directly_between ( + GumArmWriter * self, GumAddress from, GumAddress to); +GUM_API gboolean gum_arm_writer_put_b_imm (GumArmWriter * self, + GumAddress target); +GUM_API gboolean gum_arm_writer_put_b_cond_imm (GumArmWriter * self, + arm_cc cc, GumAddress target); +GUM_API void gum_arm_writer_put_b_label (GumArmWriter * self, + gconstpointer label_id); +GUM_API void gum_arm_writer_put_b_cond_label (GumArmWriter * self, + arm_cc cc, gconstpointer label_id); +GUM_API gboolean gum_arm_writer_put_bl_imm (GumArmWriter * self, + GumAddress target); +GUM_API gboolean gum_arm_writer_put_blx_imm (GumArmWriter * self, + GumAddress target); +GUM_API void gum_arm_writer_put_bl_label (GumArmWriter * self, + gconstpointer label_id); +GUM_API void gum_arm_writer_put_bx_reg (GumArmWriter * self, arm_reg reg); +GUM_API void gum_arm_writer_put_blx_reg (GumArmWriter * self, arm_reg reg); +GUM_API void gum_arm_writer_put_ret (GumArmWriter * self); + +GUM_API void gum_arm_writer_put_push_registers (GumArmWriter * self, guint n, + ...); +GUM_API void gum_arm_writer_put_pop_registers (GumArmWriter * self, guint n, + ...); + +GUM_API gboolean gum_arm_writer_put_ldr_reg_address (GumArmWriter * self, + arm_reg reg, GumAddress address); +GUM_API gboolean gum_arm_writer_put_ldr_reg_u32 (GumArmWriter * self, + arm_reg reg, guint32 val); +GUM_API gboolean gum_arm_writer_put_ldr_reg_reg_offset (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg, gssize src_offset); +GUM_API gboolean gum_arm_writer_put_ldr_cond_reg_reg_offset ( + GumArmWriter * self, arm_cc cc, arm_reg dst_reg, arm_reg src_reg, + gssize src_offset); +GUM_API void gum_arm_writer_put_ldmia_reg_mask (GumArmWriter * self, + arm_reg reg, guint16 mask); +GUM_API gboolean gum_arm_writer_put_str_reg_reg_offset ( + GumArmWriter * self, arm_reg src_reg, arm_reg dst_reg, + gssize dst_offset); +GUM_API gboolean gum_arm_writer_put_str_cond_reg_reg_offset ( + GumArmWriter * self, arm_cc cc, arm_reg src_reg, + arm_reg dst_reg, gssize dst_offset); +GUM_API void gum_arm_writer_put_mov_reg_reg (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg); +GUM_API void gum_arm_writer_put_mov_reg_reg_shift (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg, arm_shifter shift, + guint16 shift_value); +GUM_API void gum_arm_writer_put_mov_reg_cpsr (GumArmWriter * self, arm_reg reg); +GUM_API void gum_arm_writer_put_mov_cpsr_reg (GumArmWriter * self, arm_reg reg); +GUM_API void gum_arm_writer_put_add_reg_u16 (GumArmWriter * self, + arm_reg dst_reg, guint16 val); +GUM_API void gum_arm_writer_put_add_reg_u32 (GumArmWriter * self, + arm_reg dst_reg, guint32 val); +GUM_API void gum_arm_writer_put_add_reg_reg_imm (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); +GUM_API void gum_arm_writer_put_add_reg_reg_reg (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg1, arm_reg src_reg2); +GUM_API void gum_arm_writer_put_add_reg_reg_reg_shift (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg1, arm_reg src_reg2, arm_shifter shift, + guint16 shift_value); +GUM_API void gum_arm_writer_put_sub_reg_u16 (GumArmWriter * self, + arm_reg dst_reg, guint16 val); +GUM_API void gum_arm_writer_put_sub_reg_u32 (GumArmWriter * self, + arm_reg dst_reg, guint32 val); +GUM_API void gum_arm_writer_put_sub_reg_reg_imm (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); +GUM_API void gum_arm_writer_put_sub_reg_reg_reg (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg1, arm_reg src_reg2); +GUM_API void gum_arm_writer_put_rsb_reg_reg_imm (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); +GUM_API void gum_arm_writer_put_ands_reg_reg_imm (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); +GUM_API void gum_arm_writer_put_cmp_reg_imm (GumArmWriter * self, + arm_reg dst_reg, guint32 imm_val); + +GUM_API void gum_arm_writer_put_nop (GumArmWriter * self); +GUM_API void gum_arm_writer_put_breakpoint (GumArmWriter * self); +GUM_API void gum_arm_writer_put_brk_imm (GumArmWriter * self, + guint16 imm); + +GUM_API void gum_arm_writer_put_instruction (GumArmWriter * self, guint32 insn); +GUM_API gboolean gum_arm_writer_put_bytes (GumArmWriter * self, + const guint8 * data, guint n); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2010-2019 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_THUMB_WRITER_H__ +#define __GUM_THUMB_WRITER_H__ + + +#define GUM_THUMB_B_MAX_DISTANCE 0x00fffffe + +G_BEGIN_DECLS + +typedef struct _GumThumbWriter GumThumbWriter; + +struct _GumThumbWriter +{ + volatile gint ref_count; + + GumOS target_os; + + guint16 * base; + guint16 * code; + GumAddress pc; + + GumMetalHashTable * label_defs; + GumMetalArray label_refs; + GumMetalArray literal_refs; + const guint16 * earliest_literal_insn; +}; + +GUM_API GumThumbWriter * gum_thumb_writer_new (gpointer code_address); +GUM_API GumThumbWriter * gum_thumb_writer_ref (GumThumbWriter * writer); +GUM_API void gum_thumb_writer_unref (GumThumbWriter * writer); + +GUM_API void gum_thumb_writer_init (GumThumbWriter * writer, + gpointer code_address); +GUM_API void gum_thumb_writer_clear (GumThumbWriter * writer); + +GUM_API void gum_thumb_writer_reset (GumThumbWriter * writer, + gpointer code_address); +GUM_API void gum_thumb_writer_set_target_os (GumThumbWriter * self, GumOS os); + +GUM_API gpointer gum_thumb_writer_cur (GumThumbWriter * self); +GUM_API guint gum_thumb_writer_offset (GumThumbWriter * self); +GUM_API void gum_thumb_writer_skip (GumThumbWriter * self, guint n_bytes); + +GUM_API gboolean gum_thumb_writer_flush (GumThumbWriter * self); + +GUM_API gboolean gum_thumb_writer_put_label (GumThumbWriter * self, + gconstpointer id); +GUM_API gboolean gum_thumb_writer_commit_label (GumThumbWriter * self, + gconstpointer id); + +GUM_API void gum_thumb_writer_put_call_address_with_arguments ( + GumThumbWriter * self, GumAddress func, guint n_args, ...); +GUM_API void gum_thumb_writer_put_call_address_with_arguments_array ( + GumThumbWriter * self, GumAddress func, guint n_args, + const GumArgument * args); +GUM_API void gum_thumb_writer_put_call_reg_with_arguments ( + GumThumbWriter * self, arm_reg reg, guint n_args, ...); +GUM_API void gum_thumb_writer_put_call_reg_with_arguments_array ( + GumThumbWriter * self, arm_reg reg, guint n_args, const GumArgument * args); + +GUM_API void gum_thumb_writer_put_branch_address (GumThumbWriter * self, + GumAddress address); + +GUM_API gboolean gum_thumb_writer_can_branch_directly_between ( + GumThumbWriter * self, GumAddress from, GumAddress to); +GUM_API void gum_thumb_writer_put_b_imm (GumThumbWriter * self, + GumAddress target); +GUM_API void gum_thumb_writer_put_b_label (GumThumbWriter * self, + gconstpointer label_id); +GUM_API void gum_thumb_writer_put_b_label_wide (GumThumbWriter * self, + gconstpointer label_id); +GUM_API void gum_thumb_writer_put_bx_reg (GumThumbWriter * self, arm_reg reg); +GUM_API void gum_thumb_writer_put_bl_imm (GumThumbWriter * self, + GumAddress target); +GUM_API void gum_thumb_writer_put_bl_label (GumThumbWriter * self, + gconstpointer label_id); +GUM_API void gum_thumb_writer_put_blx_imm (GumThumbWriter * self, + GumAddress target); +GUM_API void gum_thumb_writer_put_blx_reg (GumThumbWriter * self, arm_reg reg); +GUM_API void gum_thumb_writer_put_cmp_reg_imm (GumThumbWriter * self, + arm_reg reg, guint8 imm_value); +GUM_API void gum_thumb_writer_put_beq_label (GumThumbWriter * self, + gconstpointer label_id); +GUM_API void gum_thumb_writer_put_bne_label (GumThumbWriter * self, + gconstpointer label_id); +GUM_API void gum_thumb_writer_put_b_cond_label (GumThumbWriter * self, + arm_cc cc, gconstpointer label_id); +GUM_API void gum_thumb_writer_put_b_cond_label_wide (GumThumbWriter * self, + arm_cc cc, gconstpointer label_id); +GUM_API void gum_thumb_writer_put_cbz_reg_label (GumThumbWriter * self, + arm_reg reg, gconstpointer label_id); +GUM_API void gum_thumb_writer_put_cbnz_reg_label (GumThumbWriter * self, + arm_reg reg, gconstpointer label_id); + +GUM_API gboolean gum_thumb_writer_put_push_regs (GumThumbWriter * self, + guint n_regs, arm_reg first_reg, ...); +GUM_API gboolean gum_thumb_writer_put_push_regs_array (GumThumbWriter * self, + guint n_regs, const arm_reg * regs); +GUM_API gboolean gum_thumb_writer_put_pop_regs (GumThumbWriter * self, + guint n_regs, arm_reg first_reg, ...); +GUM_API gboolean gum_thumb_writer_put_pop_regs_array (GumThumbWriter * self, + guint n_regs, const arm_reg * regs); +GUM_API gboolean gum_thumb_writer_put_ldr_reg_address (GumThumbWriter * self, + arm_reg reg, GumAddress address); +GUM_API gboolean gum_thumb_writer_put_ldr_reg_u32 (GumThumbWriter * self, + arm_reg reg, guint32 val); +GUM_API void gum_thumb_writer_put_ldr_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_reg src_reg); +GUM_API gboolean gum_thumb_writer_put_ldr_reg_reg_offset (GumThumbWriter * self, + arm_reg dst_reg, arm_reg src_reg, gsize src_offset); +GUM_API void gum_thumb_writer_put_ldrb_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_reg src_reg); +void gum_thumb_writer_put_ldrh_reg_reg (GumThumbWriter * self, arm_reg dst_reg, + arm_reg src_reg); +GUM_API gboolean gum_thumb_writer_put_vldr_reg_reg_offset ( + GumThumbWriter * self, arm_reg dst_reg, arm_reg src_reg, gssize src_offset); +GUM_API void gum_thumb_writer_put_ldmia_reg_mask (GumThumbWriter * self, + arm_reg reg, guint16 mask); +GUM_API void gum_thumb_writer_put_str_reg_reg (GumThumbWriter * self, + arm_reg src_reg, arm_reg dst_reg); +GUM_API gboolean gum_thumb_writer_put_str_reg_reg_offset (GumThumbWriter * self, + arm_reg src_reg, arm_reg dst_reg, gsize dst_offset); +GUM_API void gum_thumb_writer_put_mov_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_reg src_reg); +GUM_API void gum_thumb_writer_put_mov_reg_u8 (GumThumbWriter * self, + arm_reg dst_reg, guint8 imm_value); +GUM_API void gum_thumb_writer_put_mov_reg_cpsr (GumThumbWriter * self, + arm_reg reg); +GUM_API void gum_thumb_writer_put_mov_cpsr_reg (GumThumbWriter * self, + arm_reg reg); +GUM_API gboolean gum_thumb_writer_put_add_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, gssize imm_value); +GUM_API void gum_thumb_writer_put_add_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_reg src_reg); +GUM_API void gum_thumb_writer_put_add_reg_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, arm_reg right_reg); +GUM_API gboolean gum_thumb_writer_put_add_reg_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, gssize right_value); +GUM_API gboolean gum_thumb_writer_put_sub_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, gssize imm_value); +GUM_API void gum_thumb_writer_put_sub_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_reg src_reg); +GUM_API void gum_thumb_writer_put_sub_reg_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, arm_reg right_reg); +GUM_API gboolean gum_thumb_writer_put_sub_reg_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, gssize right_value); +GUM_API gboolean gum_thumb_writer_put_and_reg_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, gssize right_value); +GUM_API gboolean gum_thumb_writer_put_or_reg_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, gssize right_value); +GUM_API gboolean gum_thumb_writer_put_lsl_reg_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, guint8 right_value); +GUM_API gboolean gum_thumb_writer_put_lsls_reg_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, guint8 right_value); +GUM_API gboolean gum_thumb_writer_put_lsrs_reg_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, guint8 right_value); +GUM_API gboolean gum_thumb_writer_put_mrs_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_sysreg src_reg); +GUM_API gboolean gum_thumb_writer_put_msr_reg_reg (GumThumbWriter * self, + arm_sysreg dst_reg, arm_reg src_reg); + +GUM_API void gum_thumb_writer_put_nop (GumThumbWriter * self); +GUM_API void gum_thumb_writer_put_bkpt_imm (GumThumbWriter * self, guint8 imm); +GUM_API void gum_thumb_writer_put_breakpoint (GumThumbWriter * self); + +GUM_API void gum_thumb_writer_put_instruction (GumThumbWriter * self, + guint16 insn); +GUM_API void gum_thumb_writer_put_instruction_wide (GumThumbWriter * self, + guint16 upper, guint16 lower); +GUM_API gboolean gum_thumb_writer_put_bytes (GumThumbWriter * self, + const guint8 * data, guint n); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2014-2020 Ole André Vadla Ravnås + * Copyright (C) 2017 Antonio Ken Iannillo + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_ARM64_WRITER_H__ +#define __GUM_ARM64_WRITER_H__ + + +#define GUM_ARM64_ADRP_MAX_DISTANCE 0xfffff000 +#define GUM_ARM64_B_MAX_DISTANCE 0x07fffffc + +G_BEGIN_DECLS + +typedef struct _GumArm64Writer GumArm64Writer; +typedef guint GumArm64IndexMode; + +struct _GumArm64Writer +{ + volatile gint ref_count; + + GumOS target_os; + GumPtrauthSupport ptrauth_support; + GumAddress (* sign) (GumAddress value); + + guint32 * base; + guint32 * code; + GumAddress pc; + + GumMetalHashTable * label_defs; + GumMetalArray label_refs; + GumMetalArray literal_refs; + const guint32 * earliest_literal_insn; +}; + +enum _GumArm64IndexMode +{ + GUM_INDEX_POST_ADJUST = 1, + GUM_INDEX_SIGNED_OFFSET = 2, + GUM_INDEX_PRE_ADJUST = 3, +}; + +GUM_API GumArm64Writer * gum_arm64_writer_new (gpointer code_address); +GUM_API GumArm64Writer * gum_arm64_writer_ref (GumArm64Writer * writer); +GUM_API void gum_arm64_writer_unref (GumArm64Writer * writer); + +GUM_API void gum_arm64_writer_init (GumArm64Writer * writer, + gpointer code_address); +GUM_API void gum_arm64_writer_clear (GumArm64Writer * writer); + +GUM_API void gum_arm64_writer_reset (GumArm64Writer * writer, + gpointer code_address); + +GUM_API gpointer gum_arm64_writer_cur (GumArm64Writer * self); +GUM_API guint gum_arm64_writer_offset (GumArm64Writer * self); +GUM_API void gum_arm64_writer_skip (GumArm64Writer * self, guint n_bytes); + +GUM_API gboolean gum_arm64_writer_flush (GumArm64Writer * self); + +GUM_API gboolean gum_arm64_writer_put_label (GumArm64Writer * self, + gconstpointer id); + +GUM_API void gum_arm64_writer_put_call_address_with_arguments ( + GumArm64Writer * self, GumAddress func, guint n_args, ...); +GUM_API void gum_arm64_writer_put_call_address_with_arguments_array ( + GumArm64Writer * self, GumAddress func, guint n_args, + const GumArgument * args); +GUM_API void gum_arm64_writer_put_call_reg_with_arguments ( + GumArm64Writer * self, arm64_reg reg, guint n_args, ...); +GUM_API void gum_arm64_writer_put_call_reg_with_arguments_array ( + GumArm64Writer * self, arm64_reg reg, guint n_args, + const GumArgument * args); + +GUM_API void gum_arm64_writer_put_branch_address (GumArm64Writer * self, + GumAddress address); + +GUM_API gboolean gum_arm64_writer_can_branch_directly_between ( + GumArm64Writer * self, GumAddress from, GumAddress to); +GUM_API gboolean gum_arm64_writer_put_b_imm (GumArm64Writer * self, + GumAddress address); +GUM_API void gum_arm64_writer_put_b_label (GumArm64Writer * self, + gconstpointer label_id); +GUM_API void gum_arm64_writer_put_b_cond_label (GumArm64Writer * self, + arm64_cc cc, gconstpointer label_id); +GUM_API gboolean gum_arm64_writer_put_bl_imm (GumArm64Writer * self, + GumAddress address); +GUM_API void gum_arm64_writer_put_bl_label (GumArm64Writer * self, + gconstpointer label_id); +GUM_API gboolean gum_arm64_writer_put_br_reg (GumArm64Writer * self, + arm64_reg reg); +GUM_API gboolean gum_arm64_writer_put_br_reg_no_auth (GumArm64Writer * self, + arm64_reg reg); +GUM_API gboolean gum_arm64_writer_put_blr_reg (GumArm64Writer * self, + arm64_reg reg); +GUM_API gboolean gum_arm64_writer_put_blr_reg_no_auth (GumArm64Writer * self, + arm64_reg reg); +GUM_API void gum_arm64_writer_put_ret (GumArm64Writer * self); +GUM_API void gum_arm64_writer_put_cbz_reg_label (GumArm64Writer * self, + arm64_reg reg, gconstpointer label_id); +GUM_API void gum_arm64_writer_put_cbnz_reg_label (GumArm64Writer * self, + arm64_reg reg, gconstpointer label_id); +GUM_API void gum_arm64_writer_put_tbz_reg_imm_label (GumArm64Writer * self, + arm64_reg reg, guint bit, gconstpointer label_id); +GUM_API void gum_arm64_writer_put_tbnz_reg_imm_label (GumArm64Writer * self, + arm64_reg reg, guint bit, gconstpointer label_id); + +GUM_API gboolean gum_arm64_writer_put_push_reg_reg (GumArm64Writer * self, + arm64_reg reg_a, arm64_reg reg_b); +GUM_API gboolean gum_arm64_writer_put_pop_reg_reg (GumArm64Writer * self, + arm64_reg reg_a, arm64_reg reg_b); +GUM_API void gum_arm64_writer_put_push_all_x_registers (GumArm64Writer * self); +GUM_API void gum_arm64_writer_put_pop_all_x_registers (GumArm64Writer * self); +GUM_API void gum_arm64_writer_put_push_all_q_registers (GumArm64Writer * self); +GUM_API void gum_arm64_writer_put_pop_all_q_registers (GumArm64Writer * self); + +GUM_API gboolean gum_arm64_writer_put_ldr_reg_address (GumArm64Writer * self, + arm64_reg reg, GumAddress address); +GUM_API gboolean gum_arm64_writer_put_ldr_reg_u64 (GumArm64Writer * self, + arm64_reg reg, guint64 val); +GUM_API guint gum_arm64_writer_put_ldr_reg_ref (GumArm64Writer * self, + arm64_reg reg); +GUM_API void gum_arm64_writer_put_ldr_reg_value (GumArm64Writer * self, + guint ref, GumAddress value); +GUM_API gboolean gum_arm64_writer_put_ldr_reg_reg_offset (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg src_reg, gsize src_offset); +GUM_API gboolean gum_arm64_writer_put_ldrsw_reg_reg_offset ( + GumArm64Writer * self, arm64_reg dst_reg, arm64_reg src_reg, + gsize src_offset); +GUM_API gboolean gum_arm64_writer_put_adrp_reg_address (GumArm64Writer * self, + arm64_reg reg, GumAddress address); +GUM_API gboolean gum_arm64_writer_put_str_reg_reg_offset (GumArm64Writer * self, + arm64_reg src_reg, arm64_reg dst_reg, gsize dst_offset); +GUM_API gboolean gum_arm64_writer_put_ldp_reg_reg_reg_offset ( + GumArm64Writer * self, arm64_reg reg_a, arm64_reg reg_b, arm64_reg reg_src, + gssize src_offset, GumArm64IndexMode mode); +GUM_API gboolean gum_arm64_writer_put_stp_reg_reg_reg_offset ( + GumArm64Writer * self, arm64_reg reg_a, arm64_reg reg_b, arm64_reg reg_dst, + gssize dst_offset, GumArm64IndexMode mode); +GUM_API gboolean gum_arm64_writer_put_mov_reg_reg (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg src_reg); +GUM_API gboolean gum_arm64_writer_put_uxtw_reg_reg (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg src_reg); +GUM_API gboolean gum_arm64_writer_put_add_reg_reg_imm (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg left_reg, gsize right_value); +GUM_API gboolean gum_arm64_writer_put_add_reg_reg_reg (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg left_reg, arm64_reg right_reg); +GUM_API gboolean gum_arm64_writer_put_sub_reg_reg_imm (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg left_reg, gsize right_value); +GUM_API gboolean gum_arm64_writer_put_sub_reg_reg_reg (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg left_reg, arm64_reg right_reg); +GUM_API gboolean gum_arm64_writer_put_and_reg_reg_imm (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg left_reg, gsize right_value); +GUM_API gboolean gum_arm64_writer_put_tst_reg_imm (GumArm64Writer * self, + arm64_reg reg, guint64 imm_value); +GUM_API gboolean gum_arm64_writer_put_cmp_reg_reg (GumArm64Writer * self, + arm64_reg reg_a, arm64_reg reg_b); + +GUM_API gboolean gum_arm64_writer_put_xpaci_reg (GumArm64Writer * self, + arm64_reg reg); + +GUM_API void gum_arm64_writer_put_nop (GumArm64Writer * self); +GUM_API void gum_arm64_writer_put_brk_imm (GumArm64Writer * self, guint16 imm); + +GUM_API void gum_arm64_writer_put_instruction (GumArm64Writer * self, + guint32 insn); +GUM_API gboolean gum_arm64_writer_put_bytes (GumArm64Writer * self, + const guint8 * data, guint n); + +GUM_API GumAddress gum_arm64_writer_sign (GumArm64Writer * self, + GumAddress value); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2014-2019 Ole André Vadla Ravnås + * Copyright (C) 2019 Jon Wilson + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_MIPS_WRITER_H__ +#define __GUM_MIPS_WRITER_H__ + + +#define GUM_MIPS_J_MAX_DISTANCE (1 << 28) + +G_BEGIN_DECLS + +typedef struct _GumMipsWriter GumMipsWriter; + +struct _GumMipsWriter +{ + volatile gint ref_count; + + guint32 * base; + guint32 * code; + GumAddress pc; + + GumMetalHashTable * label_defs; + GumMetalArray label_refs; +}; + +GUM_API GumMipsWriter * gum_mips_writer_new (gpointer code_address); +GUM_API GumMipsWriter * gum_mips_writer_ref (GumMipsWriter * writer); +GUM_API void gum_mips_writer_unref (GumMipsWriter * writer); + +GUM_API void gum_mips_writer_init (GumMipsWriter * writer, + gpointer code_address); +GUM_API void gum_mips_writer_clear (GumMipsWriter * writer); + +GUM_API void gum_mips_writer_reset (GumMipsWriter * writer, + gpointer code_address); + +GUM_API gpointer gum_mips_writer_cur (GumMipsWriter * self); +GUM_API guint gum_mips_writer_offset (GumMipsWriter * self); +GUM_API void gum_mips_writer_skip (GumMipsWriter * self, guint n_bytes); + +GUM_API gboolean gum_mips_writer_flush (GumMipsWriter * self); + +GUM_API gboolean gum_mips_writer_put_label (GumMipsWriter * self, + gconstpointer id); + +GUM_API void gum_mips_writer_put_call_address_with_arguments ( + GumMipsWriter * self, GumAddress func, guint n_args, ...); +GUM_API void gum_mips_writer_put_call_address_with_arguments_array ( + GumMipsWriter * self, GumAddress func, guint n_args, + const GumArgument * args); +GUM_API void gum_mips_writer_put_call_reg_with_arguments (GumMipsWriter * self, + mips_reg reg, guint n_args, ...); +GUM_API void gum_mips_writer_put_call_reg_with_arguments_array ( + GumMipsWriter * self, mips_reg reg, guint n_args, const GumArgument * args); + +GUM_API gboolean gum_mips_writer_can_branch_directly_between (GumAddress from, + GumAddress to); +GUM_API gboolean gum_mips_writer_put_j_address (GumMipsWriter * self, + GumAddress address); +GUM_API gboolean gum_mips_writer_put_j_address_without_nop ( + GumMipsWriter * self, GumAddress address); +GUM_API void gum_mips_writer_put_j_label (GumMipsWriter * self, + gconstpointer label_id); +GUM_API void gum_mips_writer_put_jr_reg (GumMipsWriter * self, mips_reg reg); +GUM_API void gum_mips_writer_put_jal_address (GumMipsWriter * self, + guint32 address); +GUM_API void gum_mips_writer_put_jalr_reg (GumMipsWriter * self, mips_reg reg); +GUM_API void gum_mips_writer_put_b_offset (GumMipsWriter * self, gint32 offset); +GUM_API void gum_mips_writer_put_beq_reg_reg_label (GumMipsWriter * self, + mips_reg right_reg, mips_reg left_reg, gconstpointer label_id); +GUM_API void gum_mips_writer_put_ret (GumMipsWriter * self); + +GUM_API void gum_mips_writer_put_la_reg_address (GumMipsWriter * self, + mips_reg reg, GumAddress address); +GUM_API void gum_mips_writer_put_lui_reg_imm (GumMipsWriter * self, + mips_reg reg, guint imm); +GUM_API void gum_mips_writer_put_dsll_reg_reg (GumMipsWriter * self, + mips_reg dst_reg, mips_reg src_reg, guint amount); +GUM_API void gum_mips_writer_put_ori_reg_reg_imm (GumMipsWriter * self, + mips_reg rt, mips_reg rs, guint imm); +GUM_API void gum_mips_writer_put_ld_reg_reg_offset (GumMipsWriter * self, + mips_reg dst_reg, mips_reg src_reg, gsize src_offset); +GUM_API void gum_mips_writer_put_lw_reg_reg_offset (GumMipsWriter * self, + mips_reg dst_reg, mips_reg src_reg, gsize src_offset); +GUM_API void gum_mips_writer_put_sw_reg_reg_offset (GumMipsWriter * self, + mips_reg src_reg, mips_reg dst_reg, gsize dst_offset); +GUM_API void gum_mips_writer_put_move_reg_reg (GumMipsWriter * self, + mips_reg dst_reg, mips_reg src_reg); +GUM_API void gum_mips_writer_put_addu_reg_reg_reg (GumMipsWriter * self, + mips_reg dst_reg, mips_reg left_reg, mips_reg right_reg); +GUM_API void gum_mips_writer_put_addi_reg_reg_imm (GumMipsWriter * self, + mips_reg dst_reg, mips_reg left_reg, gint32 imm); +GUM_API void gum_mips_writer_put_addi_reg_imm (GumMipsWriter * self, + mips_reg dst_reg, gint32 imm); +GUM_API void gum_mips_writer_put_sub_reg_reg_imm (GumMipsWriter * self, + mips_reg dst_reg, mips_reg left_reg, gint32 imm); + +GUM_API void gum_mips_writer_put_push_reg (GumMipsWriter * self, mips_reg reg); +GUM_API void gum_mips_writer_put_pop_reg (GumMipsWriter * self, mips_reg reg); + +GUM_API void gum_mips_writer_put_mfhi_reg (GumMipsWriter * self, mips_reg reg); +GUM_API void gum_mips_writer_put_mflo_reg (GumMipsWriter * self, mips_reg reg); +GUM_API void gum_mips_writer_put_mthi_reg (GumMipsWriter * self, mips_reg reg); +GUM_API void gum_mips_writer_put_mtlo_reg (GumMipsWriter * self, mips_reg reg); + +GUM_API void gum_mips_writer_put_nop (GumMipsWriter * self); +GUM_API void gum_mips_writer_put_break (GumMipsWriter * self); + +GUM_API void gum_mips_writer_put_prologue_trampoline (GumMipsWriter * self, + mips_reg reg, GumAddress address); + +GUM_API void gum_mips_writer_put_instruction (GumMipsWriter * self, + guint32 insn); +GUM_API gboolean gum_mips_writer_put_bytes (GumMipsWriter * self, + const guint8 * data, guint n); + +G_END_DECLS + +#endif + +G_BEGIN_DECLS + +#define GUM_TYPE_STALKER (gum_stalker_get_type ()) +G_DECLARE_FINAL_TYPE (GumStalker, gum_stalker, GUM, STALKER, GObject) + +#define GUM_TYPE_STALKER_TRANSFORMER (gum_stalker_transformer_get_type ()) +G_DECLARE_INTERFACE (GumStalkerTransformer, gum_stalker_transformer, GUM, + STALKER_TRANSFORMER, GObject) + +#define GUM_TYPE_DEFAULT_STALKER_TRANSFORMER \ + (gum_default_stalker_transformer_get_type ()) +G_DECLARE_FINAL_TYPE (GumDefaultStalkerTransformer, + gum_default_stalker_transformer, GUM, DEFAULT_STALKER_TRANSFORMER, + GObject) + +#define GUM_TYPE_CALLBACK_STALKER_TRANSFORMER \ + (gum_callback_stalker_transformer_get_type ()) +G_DECLARE_FINAL_TYPE (GumCallbackStalkerTransformer, + gum_callback_stalker_transformer, GUM, CALLBACK_STALKER_TRANSFORMER, + GObject) + +typedef struct _GumStalkerIterator GumStalkerIterator; +typedef struct _GumStalkerOutput GumStalkerOutput; +typedef union _GumStalkerWriter GumStalkerWriter; +typedef void (* GumStalkerTransformerCallback) (GumStalkerIterator * iterator, + GumStalkerOutput * output, gpointer user_data); +typedef void (* GumStalkerCallout) (GumCpuContext * cpu_context, + gpointer user_data); + +typedef guint GumProbeId; +typedef struct _GumCallSite GumCallSite; +typedef void (* GumCallProbeCallback) (GumCallSite * site, gpointer user_data); + +struct _GumStalkerTransformerInterface +{ + GTypeInterface parent; + + void (* transform_block) (GumStalkerTransformer * self, + GumStalkerIterator * iterator, GumStalkerOutput * output); +}; + +union _GumStalkerWriter +{ + gpointer instance; + GumX86Writer * x86; + GumArmWriter * arm; + GumThumbWriter * thumb; + GumArm64Writer * arm64; + GumMipsWriter * mips; +}; + +struct _GumStalkerOutput +{ + GumStalkerWriter writer; + GumInstructionEncoding encoding; +}; + +struct _GumCallSite +{ + gpointer block_address; + gpointer stack_data; + GumCpuContext * cpu_context; +}; + +GUM_API gboolean gum_stalker_is_supported (void); + +GUM_API GumStalker * gum_stalker_new (void); + +GUM_API void gum_stalker_exclude (GumStalker * self, + const GumMemoryRange * range); + +GUM_API gint gum_stalker_get_trust_threshold (GumStalker * self); +GUM_API void gum_stalker_set_trust_threshold (GumStalker * self, + gint trust_threshold); + +GUM_API void gum_stalker_flush (GumStalker * self); +GUM_API void gum_stalker_stop (GumStalker * self); +GUM_API gboolean gum_stalker_garbage_collect (GumStalker * self); + +GUM_API void gum_stalker_follow_me (GumStalker * self, + GumStalkerTransformer * transformer, GumEventSink * sink); +GUM_API void gum_stalker_unfollow_me (GumStalker * self); +GUM_API gboolean gum_stalker_is_following_me (GumStalker * self); + +GUM_API void gum_stalker_follow (GumStalker * self, GumThreadId thread_id, + GumStalkerTransformer * transformer, GumEventSink * sink); +GUM_API void gum_stalker_unfollow (GumStalker * self, GumThreadId thread_id); + +GUM_API void gum_stalker_activate (GumStalker * self, gconstpointer target); +GUM_API void gum_stalker_deactivate (GumStalker * self); + +GUM_API GumProbeId gum_stalker_add_call_probe (GumStalker * self, + gpointer target_address, GumCallProbeCallback callback, gpointer data, + GDestroyNotify notify); +GUM_API void gum_stalker_remove_call_probe (GumStalker * self, + GumProbeId id); + +#define gum_call_site_get_nth_argument(s, n) \ + gum_cpu_context_get_nth_argument ((s)->cpu_context, n) +#define gum_call_site_replace_nth_argument(s, n, v) \ + gum_cpu_context_replace_nth_argument ((s)->cpu_context, n, v) + +GUM_API GumStalkerTransformer * gum_stalker_transformer_make_default (void); +GUM_API GumStalkerTransformer * gum_stalker_transformer_make_from_callback ( + GumStalkerTransformerCallback callback, gpointer data, + GDestroyNotify data_destroy); + +GUM_API void gum_stalker_transformer_transform_block ( + GumStalkerTransformer * self, GumStalkerIterator * iterator, + GumStalkerOutput * output); + +GUM_API gboolean gum_stalker_iterator_next (GumStalkerIterator * self, + const cs_insn ** insn); +GUM_API void gum_stalker_iterator_keep (GumStalkerIterator * self); +GUM_API void gum_stalker_iterator_put_callout (GumStalkerIterator * self, + GumStalkerCallout callout, gpointer data, GDestroyNotify data_destroy); + +GUM_API void gum_stalker_set_counters_enabled (gboolean enabled); +GUM_API void gum_stalker_dump_counters (void); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2008-2010 Ole André Vadla Ravnås + * Copyright (C) 2008 Christian Berentsen + * Copyright (C) 2020 Matt Oh + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_SYMBOL_UTIL_H__ +#define __GUM_SYMBOL_UTIL_H__ + + +typedef struct _GumDebugSymbolDetails GumDebugSymbolDetails; + +struct _GumDebugSymbolDetails +{ + GumAddress address; + gchar module_name[GUM_MAX_PATH + 1]; + gchar symbol_name[GUM_MAX_SYMBOL_NAME + 1]; + gchar file_name[GUM_MAX_PATH + 1]; + guint line_number; +}; + +G_BEGIN_DECLS + +GUM_API gboolean gum_symbol_details_from_address (gpointer address, + GumDebugSymbolDetails * details); +GUM_API gchar * gum_symbol_name_from_address (gpointer address); + +GUM_API gpointer gum_find_function (const gchar * name); +GUM_API GArray * gum_find_functions_named (const gchar * name); +GUM_API GArray * gum_find_functions_matching (const gchar * str); +GUM_API gboolean gum_load_symbols (const gchar * path); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2010-2014 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_SYS_INTERNALS_H__ +#define __GUM_SYS_INTERNALS_H__ + + +#ifdef G_OS_WIN32 + +# if GLIB_SIZEOF_VOID_P == 4 +# define GUM_TEB_OFFSET_SELF 0x0018 +# define GUM_TEB_OFFSET_TID 0x0024 +# else +# define GUM_TEB_OFFSET_SELF 0x0030 +# define GUM_TEB_OFFSET_TID 0x0048 +# endif + +#endif + +#endif +/* + * Copyright (C) 2010-2017 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_TLS_H__ +#define __GUM_TLS_H__ + + +G_BEGIN_DECLS + +typedef gsize GumTlsKey; + +GUM_API GumTlsKey gum_tls_key_new (void); +GUM_API void gum_tls_key_free (GumTlsKey key); + +GUM_API gpointer gum_tls_key_get_value (GumTlsKey key); +GUM_API void gum_tls_key_set_value (GumTlsKey key, gpointer value); + +G_END_DECLS + +#endif + +G_BEGIN_DECLS + +GUM_API void gum_init (void); +GUM_API void gum_shutdown (void); +GUM_API void gum_deinit (void); + +GUM_API void gum_init_embedded (void); +GUM_API void gum_deinit_embedded (void); + +GUM_API void gum_prepare_to_fork (void); +GUM_API void gum_recover_from_fork_in_parent (void); +GUM_API void gum_recover_from_fork_in_child (void); + +G_END_DECLS + +#endif diff --git a/utils/afl_frida/android/libfrida-gum.a b/utils/afl_frida/android/libfrida-gum.a new file mode 100644 index 00000000..2da655c8 Binary files /dev/null and b/utils/afl_frida/android/libfrida-gum.a differ -- cgit 1.4.1 From 868ef6c10c8137e0085789452a84435cd6b72f2f Mon Sep 17 00:00:00 2001 From: Joey Jiao Date: Thu, 14 Jan 2021 14:16:17 +0800 Subject: android: afl_frida: get target lib/function from command line --- utils/afl_frida/afl-frida.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'utils') diff --git a/utils/afl_frida/afl-frida.c b/utils/afl_frida/afl-frida.c index b5b8196d..89a5b932 100644 --- a/utils/afl_frida/afl-frida.c +++ b/utils/afl_frida/afl-frida.c @@ -153,7 +153,7 @@ static int enumerate_ranges(const GumRangeDetails *details, } -int main() { +int main(int argc, char** argv) { #ifndef __APPLE__ (void)personality(ADDR_NO_RANDOMIZE); // disable ASLR @@ -164,17 +164,32 @@ int main() { // If there is just one function, then there is nothing to change // or add here. - void *dl = dlopen(TARGET_LIBRARY, RTLD_LAZY); + void *dl = NULL; + if (argc > 2) { + dl = dlopen(argv[1], RTLD_LAZY); + } else { + dl = dlopen(TARGET_LIBRARY, RTLD_LAZY); + } if (!dl) { - fprintf(stderr, "Could not load %s\n", TARGET_LIBRARY); + if (argc > 2) + fprintf(stderr, "Could not load %s\n", argv[1]); + else + fprintf(stderr, "Could not load %s\n", TARGET_LIBRARY); exit(-1); } - if (!(o_function = dlsym(dl, TARGET_FUNCTION))) { + if (argc > 2) + o_function = dlsym(dl, argv[2]); + else + o_function = dlsym(dl, TARGET_FUNCTION); + if (!o_function) { - fprintf(stderr, "Could not find function %s\n", TARGET_FUNCTION); + if (argc > 2) + fprintf(stderr, "Could not find function %s\n", argv[2]); + else + fprintf(stderr, "Could not find function %s\n", TARGET_FUNCTION); exit(-1); } -- cgit 1.4.1 From 6dc20fc298c28658ea988a74eb7d400115a3f78a Mon Sep 17 00:00:00 2001 From: Joey Jiao Date: Thu, 14 Jan 2021 21:47:00 +0800 Subject: afl_frida: fix target lib --- utils/afl_frida/afl-frida.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'utils') diff --git a/utils/afl_frida/afl-frida.c b/utils/afl_frida/afl-frida.c index 89a5b932..4a99d6ed 100644 --- a/utils/afl_frida/afl-frida.c +++ b/utils/afl_frida/afl-frida.c @@ -206,9 +206,17 @@ int main(int argc, char** argv) { GumStalker *stalker = gum_stalker_new(); - GumAddress base_address = gum_module_find_base_address(TARGET_LIBRARY); + GumAddress base_address; + if (argc > 2) + base_address = gum_module_find_base_address(argv[1]); + else + base_address = gum_module_find_base_address(TARGET_LIBRARY); GumMemoryRange code_range; - gum_module_enumerate_ranges(TARGET_LIBRARY, GUM_PAGE_RX, enumerate_ranges, + if (argc > 2) + gum_module_enumerate_ranges(argv[1], GUM_PAGE_RX, enumerate_ranges, + &code_range); + else + gum_module_enumerate_ranges(TARGET_LIBRARY, GUM_PAGE_RX, enumerate_ranges, &code_range); guint64 code_start = code_range.base_address; @@ -219,7 +227,11 @@ int main(int argc, char** argv) { base_address, code_start, code_end); if (!code_start || !code_end) { - fprintf(stderr, "Error: no valid memory address found for %s\n", + if (argc > 2) + fprintf(stderr, "Error: no valid memory address found for %s\n", + argv[1]); + else + fprintf(stderr, "Error: no valid memory address found for %s\n", TARGET_LIBRARY); exit(-1); -- cgit 1.4.1 From bb9d27535018caf41557fa042884e3edf7836f8b Mon Sep 17 00:00:00 2001 From: Joey Jiao Date: Wed, 20 Jan 2021 14:26:02 +0800 Subject: afl_frida: Add AFL_FRIDA_TEST_INPUT env to debug input --- utils/afl_frida/afl-frida.c | 184 +++++++++++++++++++++++--------------------- 1 file changed, 96 insertions(+), 88 deletions(-) (limited to 'utils') diff --git a/utils/afl_frida/afl-frida.c b/utils/afl_frida/afl-frida.c index 4a99d6ed..087f18e8 100644 --- a/utils/afl_frida/afl-frida.c +++ b/utils/afl_frida/afl-frida.c @@ -196,100 +196,108 @@ int main(int argc, char** argv) { // END STEP 2 - gum_init_embedded(); - if (!gum_stalker_is_supported()) { - - gum_deinit_embedded(); - return 1; - - } - - GumStalker *stalker = gum_stalker_new(); - - GumAddress base_address; - if (argc > 2) - base_address = gum_module_find_base_address(argv[1]); - else - base_address = gum_module_find_base_address(TARGET_LIBRARY); - GumMemoryRange code_range; - if (argc > 2) - gum_module_enumerate_ranges(argv[1], GUM_PAGE_RX, enumerate_ranges, - &code_range); - else - gum_module_enumerate_ranges(TARGET_LIBRARY, GUM_PAGE_RX, enumerate_ranges, - &code_range); - - guint64 code_start = code_range.base_address; - guint64 code_end = code_range.base_address + code_range.size; - range_t instr_range = {0, code_start, code_end}; - - printf("Frida instrumentation: base=0x%lx instrumenting=0x%lx-%lx\n", - base_address, code_start, code_end); - if (!code_start || !code_end) { - + if (!getenv("AFL_FRIDA_TEST_INPUT")) { + gum_init_embedded(); + if (!gum_stalker_is_supported()) { + + gum_deinit_embedded(); + return 1; + + } + + GumStalker *stalker = gum_stalker_new(); + + GumAddress base_address; if (argc > 2) - fprintf(stderr, "Error: no valid memory address found for %s\n", - argv[1]); + base_address = gum_module_find_base_address(argv[1]); else - fprintf(stderr, "Error: no valid memory address found for %s\n", - TARGET_LIBRARY); - exit(-1); - - } - - GumStalkerTransformer *transformer = - gum_stalker_transformer_make_from_callback(instr_basic_block, - &instr_range, NULL); - - // to ensure that the signatures are not optimized out - memcpy(__afl_area_ptr, (void *)AFL_PERSISTENT, sizeof(AFL_PERSISTENT) + 1); - memcpy(__afl_area_ptr + 32, (void *)AFL_DEFER_FORKSVR, - sizeof(AFL_DEFER_FORKSVR) + 1); - __afl_manual_init(); - - // - // any expensive target library initialization that has to be done just once - // - put that here - // - - gum_stalker_follow_me(stalker, transformer, NULL); - - while (__afl_persistent_loop(UINT32_MAX) != 0) { - - previous_pc = 0; // Required! - -#ifdef _DEBUG - fprintf(stderr, "CLIENT crc: %016llx len: %u\n", - hash64(__afl_fuzz_ptr, *__afl_fuzz_len), *__afl_fuzz_len); - fprintf(stderr, "RECV:"); - for (int i = 0; i < *__afl_fuzz_len; i++) - fprintf(stderr, "%02x", __afl_fuzz_ptr[i]); - fprintf(stderr, "\n"); -#endif - - // STEP 3: ensure the minimum length is present and setup the target - // function to fuzz. - - if (*__afl_fuzz_len > 0) { - - __afl_fuzz_ptr[*__afl_fuzz_len] = 0; // if you need to null terminate - (*o_function)(__afl_fuzz_ptr, *__afl_fuzz_len); - + base_address = gum_module_find_base_address(TARGET_LIBRARY); + GumMemoryRange code_range; + if (argc > 2) + gum_module_enumerate_ranges(argv[1], GUM_PAGE_RX, enumerate_ranges, + &code_range); + else + gum_module_enumerate_ranges(TARGET_LIBRARY, GUM_PAGE_RX, enumerate_ranges, + &code_range); + + guint64 code_start = code_range.base_address; + guint64 code_end = code_range.base_address + code_range.size; + range_t instr_range = {0, code_start, code_end}; + + printf("Frida instrumentation: base=0x%lx instrumenting=0x%lx-%lx\n", + base_address, code_start, code_end); + if (!code_start || !code_end) { + + if (argc > 2) + fprintf(stderr, "Error: no valid memory address found for %s\n", + argv[1]); + else + fprintf(stderr, "Error: no valid memory address found for %s\n", + TARGET_LIBRARY); + exit(-1); + } + + GumStalkerTransformer *transformer = + gum_stalker_transformer_make_from_callback(instr_basic_block, + &instr_range, NULL); + + // to ensure that the signatures are not optimized out + memcpy(__afl_area_ptr, (void *)AFL_PERSISTENT, sizeof(AFL_PERSISTENT) + 1); + memcpy(__afl_area_ptr + 32, (void *)AFL_DEFER_FORKSVR, + sizeof(AFL_DEFER_FORKSVR) + 1); + __afl_manual_init(); + + // + // any expensive target library initialization that has to be done just once + // - put that here + // + + gum_stalker_follow_me(stalker, transformer, NULL); + + while (__afl_persistent_loop(UINT32_MAX) != 0) { + + previous_pc = 0; // Required! + + #ifdef _DEBUG + fprintf(stderr, "CLIENT crc: %016llx len: %u\n", + hash64(__afl_fuzz_ptr, *__afl_fuzz_len), *__afl_fuzz_len); + fprintf(stderr, "RECV:"); + for (int i = 0; i < *__afl_fuzz_len; i++) + fprintf(stderr, "%02x", __afl_fuzz_ptr[i]); + fprintf(stderr, "\n"); + #endif + + // STEP 3: ensure the minimum length is present and setup the target + // function to fuzz. + + if (*__afl_fuzz_len > 0) { + + __afl_fuzz_ptr[*__afl_fuzz_len] = 0; // if you need to null terminate + (*o_function)(__afl_fuzz_ptr, *__afl_fuzz_len); + + } + + // END STEP 3 + + } + + gum_stalker_unfollow_me(stalker); + + while (gum_stalker_garbage_collect(stalker)) + g_usleep(10000); + + g_object_unref(stalker); + g_object_unref(transformer); + gum_deinit_embedded(); - // END STEP 3 - + } else { + char buf[8*1024] = {0}; + int count = read(0, buf, sizeof(buf)); + buf[8*1024-1] = '\0'; + (*o_function)(buf, count); } - gum_stalker_unfollow_me(stalker); - - while (gum_stalker_garbage_collect(stalker)) - g_usleep(10000); - - g_object_unref(stalker); - g_object_unref(transformer); - gum_deinit_embedded(); - return 0; } -- cgit 1.4.1 From 02079d8ef9c1661e4badd464ebcd7668e88118fc Mon Sep 17 00:00:00 2001 From: Joey Jiao Date: Wed, 20 Jan 2021 19:16:57 +0800 Subject: android: Remove frida-gum package --- utils/afl_frida/android/README.md | 1 + utils/afl_frida/android/frida-gum.h | 51342 ------------------------------- utils/afl_frida/android/libfrida-gum.a | Bin 41417006 -> 0 bytes 3 files changed, 1 insertion(+), 51342 deletions(-) create mode 100644 utils/afl_frida/android/README.md delete mode 100644 utils/afl_frida/android/frida-gum.h delete mode 100644 utils/afl_frida/android/libfrida-gum.a (limited to 'utils') diff --git a/utils/afl_frida/android/README.md b/utils/afl_frida/android/README.md new file mode 100644 index 00000000..044b48a1 --- /dev/null +++ b/utils/afl_frida/android/README.md @@ -0,0 +1 @@ +For android, frida-gum package (ex. https://github.com/frida/frida/releases/download/14.2.6/frida-gum-devkit-14.2.6-android-arm64.tar.xz) is needed to be extracted in the directory. diff --git a/utils/afl_frida/android/frida-gum.h b/utils/afl_frida/android/frida-gum.h deleted file mode 100644 index 52176cbd..00000000 --- a/utils/afl_frida/android/frida-gum.h +++ /dev/null @@ -1,51342 +0,0 @@ -#ifndef GUM_STATIC -# define GUM_STATIC -#endif - -#ifndef __FRIDA_SYMBOL_MAPPINGS__ -#define __FRIDA_SYMBOL_MAPPINGS__ - -#define cs_close _frida_cs_close -#define cs_disasm _frida_cs_disasm -#define cs_disasm_iter _frida_cs_disasm_iter -#define cs_errno _frida_cs_errno -#define cs_free _frida_cs_free -#define cs_group_name _frida_cs_group_name -#define cs_insn_group _frida_cs_insn_group -#define cs_insn_name _frida_cs_insn_name -#define cs_malloc _frida_cs_malloc -#define cs_mem_calloc _frida_cs_mem_calloc -#define cs_mem_free _frida_cs_mem_free -#define cs_mem_malloc _frida_cs_mem_malloc -#define cs_mem_realloc _frida_cs_mem_realloc -#define cs_op_count _frida_cs_op_count -#define cs_op_index _frida_cs_op_index -#define cs_open _frida_cs_open -#define cs_option _frida_cs_option -#define cs_reg_name _frida_cs_reg_name -#define cs_reg_read _frida_cs_reg_read -#define cs_reg_write _frida_cs_reg_write -#define cs_regs_access _frida_cs_regs_access -#define cs_snprintf _frida_cs_snprintf -#define cs_strdup _frida_cs_strdup -#define cs_strerror _frida_cs_strerror -#define cs_support _frida_cs_support -#define cs_version _frida_cs_version -#define cs_vsnprintf _frida_cs_vsnprintf -#define g__inotify_lock_lock _frida_g__inotify_lock_lock -#define g_access _frida_g_access -#define g_action_activate _frida_g_action_activate -#define g_action_change_state _frida_g_action_change_state -#define g_action_get_enabled _frida_g_action_get_enabled -#define g_action_get_name _frida_g_action_get_name -#define g_action_get_parameter_type _frida_g_action_get_parameter_type -#define g_action_get_state _frida_g_action_get_state -#define g_action_get_state_hint _frida_g_action_get_state_hint -#define g_action_get_state_type _frida_g_action_get_state_type -#define g_action_get_type _frida_g_action_get_type -#define g_action_group_action_added _frida_g_action_group_action_added -#define g_action_group_action_enabled_changed _frida_g_action_group_action_enabled_changed -#define g_action_group_action_removed _frida_g_action_group_action_removed -#define g_action_group_action_state_changed _frida_g_action_group_action_state_changed -#define g_action_group_activate_action _frida_g_action_group_activate_action -#define g_action_group_change_action_state _frida_g_action_group_change_action_state -#define g_action_group_get_action_enabled _frida_g_action_group_get_action_enabled -#define g_action_group_get_action_parameter_type _frida_g_action_group_get_action_parameter_type -#define g_action_group_get_action_state _frida_g_action_group_get_action_state -#define g_action_group_get_action_state_hint _frida_g_action_group_get_action_state_hint -#define g_action_group_get_action_state_type _frida_g_action_group_get_action_state_type -#define g_action_group_get_type _frida_g_action_group_get_type -#define g_action_group_has_action _frida_g_action_group_has_action -#define g_action_group_list_actions _frida_g_action_group_list_actions -#define g_action_group_query_action _frida_g_action_group_query_action -#define g_action_map_add_action _frida_g_action_map_add_action -#define g_action_map_add_action_entries _frida_g_action_map_add_action_entries -#define g_action_map_get_type _frida_g_action_map_get_type -#define g_action_map_lookup_action _frida_g_action_map_lookup_action -#define g_action_map_remove_action _frida_g_action_map_remove_action -#define g_action_name_is_valid _frida_g_action_name_is_valid -#define g_action_parse_detailed_name _frida_g_action_parse_detailed_name -#define g_action_print_detailed_name _frida_g_action_print_detailed_name -#define g_allocator_free _frida_g_allocator_free -#define g_allocator_new _frida_g_allocator_new -#define g_app_info_add_supports_type _frida_g_app_info_add_supports_type -#define g_app_info_can_delete _frida_g_app_info_can_delete -#define g_app_info_can_remove_supports_type _frida_g_app_info_can_remove_supports_type -#define g_app_info_create_flags_get_type _frida_g_app_info_create_flags_get_type -#define g_app_info_create_from_commandline _frida_g_app_info_create_from_commandline -#define g_app_info_delete _frida_g_app_info_delete -#define g_app_info_dup _frida_g_app_info_dup -#define g_app_info_equal _frida_g_app_info_equal -#define g_app_info_get_all _frida_g_app_info_get_all -#define g_app_info_get_all_for_type _frida_g_app_info_get_all_for_type -#define g_app_info_get_commandline _frida_g_app_info_get_commandline -#define g_app_info_get_default_for_type _frida_g_app_info_get_default_for_type -#define g_app_info_get_default_for_uri_scheme _frida_g_app_info_get_default_for_uri_scheme -#define g_app_info_get_description _frida_g_app_info_get_description -#define g_app_info_get_display_name _frida_g_app_info_get_display_name -#define g_app_info_get_executable _frida_g_app_info_get_executable -#define g_app_info_get_fallback_for_type _frida_g_app_info_get_fallback_for_type -#define g_app_info_get_icon _frida_g_app_info_get_icon -#define g_app_info_get_id _frida_g_app_info_get_id -#define g_app_info_get_name _frida_g_app_info_get_name -#define g_app_info_get_recommended_for_type _frida_g_app_info_get_recommended_for_type -#define g_app_info_get_supported_types _frida_g_app_info_get_supported_types -#define g_app_info_get_type _frida_g_app_info_get_type -#define g_app_info_launch _frida_g_app_info_launch -#define g_app_info_launch_default_for_uri _frida_g_app_info_launch_default_for_uri -#define g_app_info_launch_default_for_uri_async _frida_g_app_info_launch_default_for_uri_async -#define g_app_info_launch_default_for_uri_finish _frida_g_app_info_launch_default_for_uri_finish -#define g_app_info_launch_uris _frida_g_app_info_launch_uris -#define g_app_info_launch_uris_async _frida_g_app_info_launch_uris_async -#define g_app_info_launch_uris_finish _frida_g_app_info_launch_uris_finish -#define g_app_info_monitor_fire _frida_g_app_info_monitor_fire -#define g_app_info_monitor_get _frida_g_app_info_monitor_get -#define g_app_info_monitor_get_type _frida_g_app_info_monitor_get_type -#define g_app_info_remove_supports_type _frida_g_app_info_remove_supports_type -#define g_app_info_reset_type_associations _frida_g_app_info_reset_type_associations -#define g_app_info_set_as_default_for_extension _frida_g_app_info_set_as_default_for_extension -#define g_app_info_set_as_default_for_type _frida_g_app_info_set_as_default_for_type -#define g_app_info_set_as_last_used_for_type _frida_g_app_info_set_as_last_used_for_type -#define g_app_info_should_show _frida_g_app_info_should_show -#define g_app_info_supports_files _frida_g_app_info_supports_files -#define g_app_info_supports_uris _frida_g_app_info_supports_uris -#define g_app_launch_context_get_display _frida_g_app_launch_context_get_display -#define g_app_launch_context_get_environment _frida_g_app_launch_context_get_environment -#define g_app_launch_context_get_startup_notify_id _frida_g_app_launch_context_get_startup_notify_id -#define g_app_launch_context_get_type _frida_g_app_launch_context_get_type -#define g_app_launch_context_launch_failed _frida_g_app_launch_context_launch_failed -#define g_app_launch_context_new _frida_g_app_launch_context_new -#define g_app_launch_context_setenv _frida_g_app_launch_context_setenv -#define g_app_launch_context_unsetenv _frida_g_app_launch_context_unsetenv -#define g_application_activate _frida_g_application_activate -#define g_application_add_main_option _frida_g_application_add_main_option -#define g_application_add_main_option_entries _frida_g_application_add_main_option_entries -#define g_application_add_option_group _frida_g_application_add_option_group -#define g_application_bind_busy_property _frida_g_application_bind_busy_property -#define g_application_command_line_create_file_for_arg _frida_g_application_command_line_create_file_for_arg -#define g_application_command_line_get_arguments _frida_g_application_command_line_get_arguments -#define g_application_command_line_get_cwd _frida_g_application_command_line_get_cwd -#define g_application_command_line_get_environ _frida_g_application_command_line_get_environ -#define g_application_command_line_get_exit_status _frida_g_application_command_line_get_exit_status -#define g_application_command_line_get_is_remote _frida_g_application_command_line_get_is_remote -#define g_application_command_line_get_options_dict _frida_g_application_command_line_get_options_dict -#define g_application_command_line_get_platform_data _frida_g_application_command_line_get_platform_data -#define g_application_command_line_get_stdin _frida_g_application_command_line_get_stdin -#define g_application_command_line_get_type _frida_g_application_command_line_get_type -#define g_application_command_line_getenv _frida_g_application_command_line_getenv -#define g_application_command_line_print _frida_g_application_command_line_print -#define g_application_command_line_printerr _frida_g_application_command_line_printerr -#define g_application_command_line_set_exit_status _frida_g_application_command_line_set_exit_status -#define g_application_flags_get_type _frida_g_application_flags_get_type -#define g_application_get_application_id _frida_g_application_get_application_id -#define g_application_get_dbus_connection _frida_g_application_get_dbus_connection -#define g_application_get_dbus_object_path _frida_g_application_get_dbus_object_path -#define g_application_get_default _frida_g_application_get_default -#define g_application_get_flags _frida_g_application_get_flags -#define g_application_get_inactivity_timeout _frida_g_application_get_inactivity_timeout -#define g_application_get_is_busy _frida_g_application_get_is_busy -#define g_application_get_is_registered _frida_g_application_get_is_registered -#define g_application_get_is_remote _frida_g_application_get_is_remote -#define g_application_get_resource_base_path _frida_g_application_get_resource_base_path -#define g_application_get_type _frida_g_application_get_type -#define g_application_hold _frida_g_application_hold -#define g_application_id_is_valid _frida_g_application_id_is_valid -#define g_application_impl_activate _frida_g_application_impl_activate -#define g_application_impl_command_line _frida_g_application_impl_command_line -#define g_application_impl_destroy _frida_g_application_impl_destroy -#define g_application_impl_flush _frida_g_application_impl_flush -#define g_application_impl_get_dbus_connection _frida_g_application_impl_get_dbus_connection -#define g_application_impl_get_dbus_object_path _frida_g_application_impl_get_dbus_object_path -#define g_application_impl_open _frida_g_application_impl_open -#define g_application_impl_register _frida_g_application_impl_register -#define g_application_impl_set_busy_state _frida_g_application_impl_set_busy_state -#define g_application_mark_busy _frida_g_application_mark_busy -#define g_application_new _frida_g_application_new -#define g_application_open _frida_g_application_open -#define g_application_quit _frida_g_application_quit -#define g_application_register _frida_g_application_register -#define g_application_release _frida_g_application_release -#define g_application_run _frida_g_application_run -#define g_application_send_notification _frida_g_application_send_notification -#define g_application_set_action_group _frida_g_application_set_action_group -#define g_application_set_application_id _frida_g_application_set_application_id -#define g_application_set_default _frida_g_application_set_default -#define g_application_set_flags _frida_g_application_set_flags -#define g_application_set_inactivity_timeout _frida_g_application_set_inactivity_timeout -#define g_application_set_option_context_description _frida_g_application_set_option_context_description -#define g_application_set_option_context_parameter_string _frida_g_application_set_option_context_parameter_string -#define g_application_set_option_context_summary _frida_g_application_set_option_context_summary -#define g_application_set_resource_base_path _frida_g_application_set_resource_base_path -#define g_application_unbind_busy_property _frida_g_application_unbind_busy_property -#define g_application_unmark_busy _frida_g_application_unmark_busy -#define g_application_withdraw_notification _frida_g_application_withdraw_notification -#define g_array_append_vals _frida_g_array_append_vals -#define g_array_binary_search _frida_g_array_binary_search -#define g_array_copy _frida_g_array_copy -#define g_array_free _frida_g_array_free -#define g_array_get_element_size _frida_g_array_get_element_size -#define g_array_get_type _frida_g_array_get_type -#define g_array_insert_vals _frida_g_array_insert_vals -#define g_array_new _frida_g_array_new -#define g_array_prepend_vals _frida_g_array_prepend_vals -#define g_array_ref _frida_g_array_ref -#define g_array_remove_index _frida_g_array_remove_index -#define g_array_remove_index_fast _frida_g_array_remove_index_fast -#define g_array_remove_range _frida_g_array_remove_range -#define g_array_set_clear_func _frida_g_array_set_clear_func -#define g_array_set_size _frida_g_array_set_size -#define g_array_sized_new _frida_g_array_sized_new -#define g_array_sort _frida_g_array_sort -#define g_array_sort_with_data _frida_g_array_sort_with_data -#define g_array_steal _frida_g_array_steal -#define g_array_unref _frida_g_array_unref -#define g_ascii_digit_value _frida_g_ascii_digit_value -#define g_ascii_dtostr _frida_g_ascii_dtostr -#define g_ascii_formatd _frida_g_ascii_formatd -#define g_ascii_strcasecmp _frida_g_ascii_strcasecmp -#define g_ascii_strdown _frida_g_ascii_strdown -#define g_ascii_string_to_signed _frida_g_ascii_string_to_signed -#define g_ascii_string_to_unsigned _frida_g_ascii_string_to_unsigned -#define g_ascii_strncasecmp _frida_g_ascii_strncasecmp -#define g_ascii_strtod _frida_g_ascii_strtod -#define g_ascii_strtoll _frida_g_ascii_strtoll -#define g_ascii_strtoull _frida_g_ascii_strtoull -#define g_ascii_strup _frida_g_ascii_strup -#define g_ascii_table _frida_g_ascii_table -#define g_ascii_tolower _frida_g_ascii_tolower -#define g_ascii_toupper _frida_g_ascii_toupper -#define g_ascii_xdigit_value _frida_g_ascii_xdigit_value -#define g_ask_password_flags_get_type _frida_g_ask_password_flags_get_type -#define g_assert_warning _frida_g_assert_warning -#define g_assertion_message _frida_g_assertion_message -#define g_assertion_message_cmpnum _frida_g_assertion_message_cmpnum -#define g_assertion_message_cmpstr _frida_g_assertion_message_cmpstr -#define g_assertion_message_cmpstrv _frida_g_assertion_message_cmpstrv -#define g_assertion_message_error _frida_g_assertion_message_error -#define g_assertion_message_expr _frida_g_assertion_message_expr -#define g_assertion_set_handler _frida_g_assertion_set_handler -#define g_async_initable_get_type _frida_g_async_initable_get_type -#define g_async_initable_init_async _frida_g_async_initable_init_async -#define g_async_initable_init_finish _frida_g_async_initable_init_finish -#define g_async_initable_new_async _frida_g_async_initable_new_async -#define g_async_initable_new_finish _frida_g_async_initable_new_finish -#define g_async_initable_new_valist_async _frida_g_async_initable_new_valist_async -#define g_async_initable_newv_async _frida_g_async_initable_newv_async -#define g_async_queue_length _frida_g_async_queue_length -#define g_async_queue_length_unlocked _frida_g_async_queue_length_unlocked -#define g_async_queue_lock _frida_g_async_queue_lock -#define g_async_queue_new _frida_g_async_queue_new -#define g_async_queue_new_full _frida_g_async_queue_new_full -#define g_async_queue_pop _frida_g_async_queue_pop -#define g_async_queue_pop_unlocked _frida_g_async_queue_pop_unlocked -#define g_async_queue_push _frida_g_async_queue_push -#define g_async_queue_push_front _frida_g_async_queue_push_front -#define g_async_queue_push_front_unlocked _frida_g_async_queue_push_front_unlocked -#define g_async_queue_push_sorted _frida_g_async_queue_push_sorted -#define g_async_queue_push_sorted_unlocked _frida_g_async_queue_push_sorted_unlocked -#define g_async_queue_push_unlocked _frida_g_async_queue_push_unlocked -#define g_async_queue_ref _frida_g_async_queue_ref -#define g_async_queue_ref_unlocked _frida_g_async_queue_ref_unlocked -#define g_async_queue_remove _frida_g_async_queue_remove -#define g_async_queue_remove_unlocked _frida_g_async_queue_remove_unlocked -#define g_async_queue_sort _frida_g_async_queue_sort -#define g_async_queue_sort_unlocked _frida_g_async_queue_sort_unlocked -#define g_async_queue_timed_pop _frida_g_async_queue_timed_pop -#define g_async_queue_timed_pop_unlocked _frida_g_async_queue_timed_pop_unlocked -#define g_async_queue_timeout_pop _frida_g_async_queue_timeout_pop -#define g_async_queue_timeout_pop_unlocked _frida_g_async_queue_timeout_pop_unlocked -#define g_async_queue_try_pop _frida_g_async_queue_try_pop -#define g_async_queue_try_pop_unlocked _frida_g_async_queue_try_pop_unlocked -#define g_async_queue_unlock _frida_g_async_queue_unlock -#define g_async_queue_unref _frida_g_async_queue_unref -#define g_async_queue_unref_and_unlock _frida_g_async_queue_unref_and_unlock -#define g_async_result_get_source_object _frida_g_async_result_get_source_object -#define g_async_result_get_type _frida_g_async_result_get_type -#define g_async_result_get_user_data _frida_g_async_result_get_user_data -#define g_async_result_is_tagged _frida_g_async_result_is_tagged -#define g_async_result_legacy_propagate_error _frida_g_async_result_legacy_propagate_error -#define g_atexit _frida_g_atexit -#define g_atomic_int_add _frida_g_atomic_int_add -#define g_atomic_int_and _frida_g_atomic_int_and -#define g_atomic_int_compare_and_exchange _frida_g_atomic_int_compare_and_exchange -#define g_atomic_int_dec_and_test _frida_g_atomic_int_dec_and_test -#define g_atomic_int_exchange_and_add _frida_g_atomic_int_exchange_and_add -#define g_atomic_int_get _frida_g_atomic_int_get -#define g_atomic_int_inc _frida_g_atomic_int_inc -#define g_atomic_int_or _frida_g_atomic_int_or -#define g_atomic_int_set _frida_g_atomic_int_set -#define g_atomic_int_xor _frida_g_atomic_int_xor -#define g_atomic_pointer_add _frida_g_atomic_pointer_add -#define g_atomic_pointer_and _frida_g_atomic_pointer_and -#define g_atomic_pointer_compare_and_exchange _frida_g_atomic_pointer_compare_and_exchange -#define g_atomic_pointer_get _frida_g_atomic_pointer_get -#define g_atomic_pointer_or _frida_g_atomic_pointer_or -#define g_atomic_pointer_set _frida_g_atomic_pointer_set -#define g_atomic_pointer_xor _frida_g_atomic_pointer_xor -#define g_atomic_rc_box_acquire _frida_g_atomic_rc_box_acquire -#define g_atomic_rc_box_alloc _frida_g_atomic_rc_box_alloc -#define g_atomic_rc_box_alloc0 _frida_g_atomic_rc_box_alloc0 -#define g_atomic_rc_box_dup _frida_g_atomic_rc_box_dup -#define g_atomic_rc_box_get_size _frida_g_atomic_rc_box_get_size -#define g_atomic_rc_box_release _frida_g_atomic_rc_box_release -#define g_atomic_rc_box_release_full _frida_g_atomic_rc_box_release_full -#define g_atomic_ref_count_compare _frida_g_atomic_ref_count_compare -#define g_atomic_ref_count_dec _frida_g_atomic_ref_count_dec -#define g_atomic_ref_count_inc _frida_g_atomic_ref_count_inc -#define g_atomic_ref_count_init _frida_g_atomic_ref_count_init -#define g_base64_decode _frida_g_base64_decode -#define g_base64_decode_inplace _frida_g_base64_decode_inplace -#define g_base64_decode_step _frida_g_base64_decode_step -#define g_base64_encode _frida_g_base64_encode -#define g_base64_encode_close _frida_g_base64_encode_close -#define g_base64_encode_step _frida_g_base64_encode_step -#define g_basename _frida_g_basename -#define g_binding_dup_source _frida_g_binding_dup_source -#define g_binding_dup_target _frida_g_binding_dup_target -#define g_binding_flags_get_type _frida_g_binding_flags_get_type -#define g_binding_get_flags _frida_g_binding_get_flags -#define g_binding_get_source _frida_g_binding_get_source -#define g_binding_get_source_property _frida_g_binding_get_source_property -#define g_binding_get_target _frida_g_binding_get_target -#define g_binding_get_target_property _frida_g_binding_get_target_property -#define g_binding_get_type _frida_g_binding_get_type -#define g_binding_unbind _frida_g_binding_unbind -#define g_bit_lock _frida_g_bit_lock -#define g_bit_nth_lsf _frida_g_bit_nth_lsf -#define g_bit_nth_msf _frida_g_bit_nth_msf -#define g_bit_storage _frida_g_bit_storage -#define g_bit_trylock _frida_g_bit_trylock -#define g_bit_unlock _frida_g_bit_unlock -#define g_blow_chunks _frida_g_blow_chunks -#define g_bookmark_file_add_application _frida_g_bookmark_file_add_application -#define g_bookmark_file_add_group _frida_g_bookmark_file_add_group -#define g_bookmark_file_error_quark _frida_g_bookmark_file_error_quark -#define g_bookmark_file_free _frida_g_bookmark_file_free -#define g_bookmark_file_get_added _frida_g_bookmark_file_get_added -#define g_bookmark_file_get_added_date_time _frida_g_bookmark_file_get_added_date_time -#define g_bookmark_file_get_app_info _frida_g_bookmark_file_get_app_info -#define g_bookmark_file_get_application_info _frida_g_bookmark_file_get_application_info -#define g_bookmark_file_get_applications _frida_g_bookmark_file_get_applications -#define g_bookmark_file_get_description _frida_g_bookmark_file_get_description -#define g_bookmark_file_get_groups _frida_g_bookmark_file_get_groups -#define g_bookmark_file_get_icon _frida_g_bookmark_file_get_icon -#define g_bookmark_file_get_is_private _frida_g_bookmark_file_get_is_private -#define g_bookmark_file_get_mime_type _frida_g_bookmark_file_get_mime_type -#define g_bookmark_file_get_modified _frida_g_bookmark_file_get_modified -#define g_bookmark_file_get_modified_date_time _frida_g_bookmark_file_get_modified_date_time -#define g_bookmark_file_get_size _frida_g_bookmark_file_get_size -#define g_bookmark_file_get_title _frida_g_bookmark_file_get_title -#define g_bookmark_file_get_uris _frida_g_bookmark_file_get_uris -#define g_bookmark_file_get_visited _frida_g_bookmark_file_get_visited -#define g_bookmark_file_get_visited_date_time _frida_g_bookmark_file_get_visited_date_time -#define g_bookmark_file_has_application _frida_g_bookmark_file_has_application -#define g_bookmark_file_has_group _frida_g_bookmark_file_has_group -#define g_bookmark_file_has_item _frida_g_bookmark_file_has_item -#define g_bookmark_file_load_from_data _frida_g_bookmark_file_load_from_data -#define g_bookmark_file_load_from_data_dirs _frida_g_bookmark_file_load_from_data_dirs -#define g_bookmark_file_load_from_file _frida_g_bookmark_file_load_from_file -#define g_bookmark_file_move_item _frida_g_bookmark_file_move_item -#define g_bookmark_file_new _frida_g_bookmark_file_new -#define g_bookmark_file_remove_application _frida_g_bookmark_file_remove_application -#define g_bookmark_file_remove_group _frida_g_bookmark_file_remove_group -#define g_bookmark_file_remove_item _frida_g_bookmark_file_remove_item -#define g_bookmark_file_set_added _frida_g_bookmark_file_set_added -#define g_bookmark_file_set_added_date_time _frida_g_bookmark_file_set_added_date_time -#define g_bookmark_file_set_app_info _frida_g_bookmark_file_set_app_info -#define g_bookmark_file_set_application_info _frida_g_bookmark_file_set_application_info -#define g_bookmark_file_set_description _frida_g_bookmark_file_set_description -#define g_bookmark_file_set_groups _frida_g_bookmark_file_set_groups -#define g_bookmark_file_set_icon _frida_g_bookmark_file_set_icon -#define g_bookmark_file_set_is_private _frida_g_bookmark_file_set_is_private -#define g_bookmark_file_set_mime_type _frida_g_bookmark_file_set_mime_type -#define g_bookmark_file_set_modified _frida_g_bookmark_file_set_modified -#define g_bookmark_file_set_modified_date_time _frida_g_bookmark_file_set_modified_date_time -#define g_bookmark_file_set_title _frida_g_bookmark_file_set_title -#define g_bookmark_file_set_visited _frida_g_bookmark_file_set_visited -#define g_bookmark_file_set_visited_date_time _frida_g_bookmark_file_set_visited_date_time -#define g_bookmark_file_to_data _frida_g_bookmark_file_to_data -#define g_bookmark_file_to_file _frida_g_bookmark_file_to_file -#define g_boxed_copy _frida_g_boxed_copy -#define g_boxed_free _frida_g_boxed_free -#define g_boxed_type_register_static _frida_g_boxed_type_register_static -#define g_buffered_input_stream_fill _frida_g_buffered_input_stream_fill -#define g_buffered_input_stream_fill_async _frida_g_buffered_input_stream_fill_async -#define g_buffered_input_stream_fill_finish _frida_g_buffered_input_stream_fill_finish -#define g_buffered_input_stream_get_available _frida_g_buffered_input_stream_get_available -#define g_buffered_input_stream_get_buffer_size _frida_g_buffered_input_stream_get_buffer_size -#define g_buffered_input_stream_get_type _frida_g_buffered_input_stream_get_type -#define g_buffered_input_stream_new _frida_g_buffered_input_stream_new -#define g_buffered_input_stream_new_sized _frida_g_buffered_input_stream_new_sized -#define g_buffered_input_stream_peek _frida_g_buffered_input_stream_peek -#define g_buffered_input_stream_peek_buffer _frida_g_buffered_input_stream_peek_buffer -#define g_buffered_input_stream_read_byte _frida_g_buffered_input_stream_read_byte -#define g_buffered_input_stream_set_buffer_size _frida_g_buffered_input_stream_set_buffer_size -#define g_buffered_output_stream_get_auto_grow _frida_g_buffered_output_stream_get_auto_grow -#define g_buffered_output_stream_get_buffer_size _frida_g_buffered_output_stream_get_buffer_size -#define g_buffered_output_stream_get_type _frida_g_buffered_output_stream_get_type -#define g_buffered_output_stream_new _frida_g_buffered_output_stream_new -#define g_buffered_output_stream_new_sized _frida_g_buffered_output_stream_new_sized -#define g_buffered_output_stream_set_auto_grow _frida_g_buffered_output_stream_set_auto_grow -#define g_buffered_output_stream_set_buffer_size _frida_g_buffered_output_stream_set_buffer_size -#define g_build_filename _frida_g_build_filename -#define g_build_filename_valist _frida_g_build_filename_valist -#define g_build_filenamev _frida_g_build_filenamev -#define g_build_path _frida_g_build_path -#define g_build_pathv _frida_g_build_pathv -#define g_bus_get _frida_g_bus_get -#define g_bus_get_finish _frida_g_bus_get_finish -#define g_bus_get_sync _frida_g_bus_get_sync -#define g_bus_name_owner_flags_get_type _frida_g_bus_name_owner_flags_get_type -#define g_bus_name_watcher_flags_get_type _frida_g_bus_name_watcher_flags_get_type -#define g_bus_own_name _frida_g_bus_own_name -#define g_bus_own_name_on_connection _frida_g_bus_own_name_on_connection -#define g_bus_own_name_on_connection_with_closures _frida_g_bus_own_name_on_connection_with_closures -#define g_bus_own_name_with_closures _frida_g_bus_own_name_with_closures -#define g_bus_type_get_type _frida_g_bus_type_get_type -#define g_bus_unown_name _frida_g_bus_unown_name -#define g_bus_unwatch_name _frida_g_bus_unwatch_name -#define g_bus_watch_name _frida_g_bus_watch_name -#define g_bus_watch_name_on_connection _frida_g_bus_watch_name_on_connection -#define g_bus_watch_name_on_connection_with_closures _frida_g_bus_watch_name_on_connection_with_closures -#define g_bus_watch_name_with_closures _frida_g_bus_watch_name_with_closures -#define g_byte_array_append _frida_g_byte_array_append -#define g_byte_array_free _frida_g_byte_array_free -#define g_byte_array_free_to_bytes _frida_g_byte_array_free_to_bytes -#define g_byte_array_get_type _frida_g_byte_array_get_type -#define g_byte_array_new _frida_g_byte_array_new -#define g_byte_array_new_take _frida_g_byte_array_new_take -#define g_byte_array_prepend _frida_g_byte_array_prepend -#define g_byte_array_ref _frida_g_byte_array_ref -#define g_byte_array_remove_index _frida_g_byte_array_remove_index -#define g_byte_array_remove_index_fast _frida_g_byte_array_remove_index_fast -#define g_byte_array_remove_range _frida_g_byte_array_remove_range -#define g_byte_array_set_size _frida_g_byte_array_set_size -#define g_byte_array_sized_new _frida_g_byte_array_sized_new -#define g_byte_array_sort _frida_g_byte_array_sort -#define g_byte_array_sort_with_data _frida_g_byte_array_sort_with_data -#define g_byte_array_steal _frida_g_byte_array_steal -#define g_byte_array_unref _frida_g_byte_array_unref -#define g_bytes_compare _frida_g_bytes_compare -#define g_bytes_equal _frida_g_bytes_equal -#define g_bytes_get_data _frida_g_bytes_get_data -#define g_bytes_get_size _frida_g_bytes_get_size -#define g_bytes_get_type _frida_g_bytes_get_type -#define g_bytes_hash _frida_g_bytes_hash -#define g_bytes_icon_get_bytes _frida_g_bytes_icon_get_bytes -#define g_bytes_icon_get_type _frida_g_bytes_icon_get_type -#define g_bytes_icon_new _frida_g_bytes_icon_new -#define g_bytes_new _frida_g_bytes_new -#define g_bytes_new_from_bytes _frida_g_bytes_new_from_bytes -#define g_bytes_new_static _frida_g_bytes_new_static -#define g_bytes_new_take _frida_g_bytes_new_take -#define g_bytes_new_with_free_func _frida_g_bytes_new_with_free_func -#define g_bytes_ref _frida_g_bytes_ref -#define g_bytes_unref _frida_g_bytes_unref -#define g_bytes_unref_to_array _frida_g_bytes_unref_to_array -#define g_bytes_unref_to_data _frida_g_bytes_unref_to_data -#define g_cache_destroy _frida_g_cache_destroy -#define g_cache_insert _frida_g_cache_insert -#define g_cache_key_foreach _frida_g_cache_key_foreach -#define g_cache_new _frida_g_cache_new -#define g_cache_remove _frida_g_cache_remove -#define g_cache_value_foreach _frida_g_cache_value_foreach -#define g_cancellable_cancel _frida_g_cancellable_cancel -#define g_cancellable_connect _frida_g_cancellable_connect -#define g_cancellable_disconnect _frida_g_cancellable_disconnect -#define g_cancellable_get_current _frida_g_cancellable_get_current -#define g_cancellable_get_fd _frida_g_cancellable_get_fd -#define g_cancellable_get_type _frida_g_cancellable_get_type -#define g_cancellable_is_cancelled _frida_g_cancellable_is_cancelled -#define g_cancellable_make_pollfd _frida_g_cancellable_make_pollfd -#define g_cancellable_new _frida_g_cancellable_new -#define g_cancellable_pop_current _frida_g_cancellable_pop_current -#define g_cancellable_push_current _frida_g_cancellable_push_current -#define g_cancellable_release_fd _frida_g_cancellable_release_fd -#define g_cancellable_reset _frida_g_cancellable_reset -#define g_cancellable_set_error_if_cancelled _frida_g_cancellable_set_error_if_cancelled -#define g_cancellable_source_new _frida_g_cancellable_source_new -#define g_canonicalize_filename _frida_g_canonicalize_filename -#define g_cclosure_marshal_BOOLEAN__BOXED_BOXED _frida_g_cclosure_marshal_BOOLEAN__BOXED_BOXED -#define g_cclosure_marshal_BOOLEAN__BOXED_BOXEDv _frida_g_cclosure_marshal_BOOLEAN__BOXED_BOXEDv -#define g_cclosure_marshal_BOOLEAN__FLAGS _frida_g_cclosure_marshal_BOOLEAN__FLAGS -#define g_cclosure_marshal_BOOLEAN__FLAGSv _frida_g_cclosure_marshal_BOOLEAN__FLAGSv -#define g_cclosure_marshal_STRING__OBJECT_POINTER _frida_g_cclosure_marshal_STRING__OBJECT_POINTER -#define g_cclosure_marshal_STRING__OBJECT_POINTERv _frida_g_cclosure_marshal_STRING__OBJECT_POINTERv -#define g_cclosure_marshal_VOID__BOOLEAN _frida_g_cclosure_marshal_VOID__BOOLEAN -#define g_cclosure_marshal_VOID__BOOLEANv _frida_g_cclosure_marshal_VOID__BOOLEANv -#define g_cclosure_marshal_VOID__BOXED _frida_g_cclosure_marshal_VOID__BOXED -#define g_cclosure_marshal_VOID__BOXEDv _frida_g_cclosure_marshal_VOID__BOXEDv -#define g_cclosure_marshal_VOID__CHAR _frida_g_cclosure_marshal_VOID__CHAR -#define g_cclosure_marshal_VOID__CHARv _frida_g_cclosure_marshal_VOID__CHARv -#define g_cclosure_marshal_VOID__DOUBLE _frida_g_cclosure_marshal_VOID__DOUBLE -#define g_cclosure_marshal_VOID__DOUBLEv _frida_g_cclosure_marshal_VOID__DOUBLEv -#define g_cclosure_marshal_VOID__ENUM _frida_g_cclosure_marshal_VOID__ENUM -#define g_cclosure_marshal_VOID__ENUMv _frida_g_cclosure_marshal_VOID__ENUMv -#define g_cclosure_marshal_VOID__FLAGS _frida_g_cclosure_marshal_VOID__FLAGS -#define g_cclosure_marshal_VOID__FLAGSv _frida_g_cclosure_marshal_VOID__FLAGSv -#define g_cclosure_marshal_VOID__FLOAT _frida_g_cclosure_marshal_VOID__FLOAT -#define g_cclosure_marshal_VOID__FLOATv _frida_g_cclosure_marshal_VOID__FLOATv -#define g_cclosure_marshal_VOID__INT _frida_g_cclosure_marshal_VOID__INT -#define g_cclosure_marshal_VOID__INTv _frida_g_cclosure_marshal_VOID__INTv -#define g_cclosure_marshal_VOID__LONG _frida_g_cclosure_marshal_VOID__LONG -#define g_cclosure_marshal_VOID__LONGv _frida_g_cclosure_marshal_VOID__LONGv -#define g_cclosure_marshal_VOID__OBJECT _frida_g_cclosure_marshal_VOID__OBJECT -#define g_cclosure_marshal_VOID__OBJECTv _frida_g_cclosure_marshal_VOID__OBJECTv -#define g_cclosure_marshal_VOID__PARAM _frida_g_cclosure_marshal_VOID__PARAM -#define g_cclosure_marshal_VOID__PARAMv _frida_g_cclosure_marshal_VOID__PARAMv -#define g_cclosure_marshal_VOID__POINTER _frida_g_cclosure_marshal_VOID__POINTER -#define g_cclosure_marshal_VOID__POINTERv _frida_g_cclosure_marshal_VOID__POINTERv -#define g_cclosure_marshal_VOID__STRING _frida_g_cclosure_marshal_VOID__STRING -#define g_cclosure_marshal_VOID__STRINGv _frida_g_cclosure_marshal_VOID__STRINGv -#define g_cclosure_marshal_VOID__UCHAR _frida_g_cclosure_marshal_VOID__UCHAR -#define g_cclosure_marshal_VOID__UCHARv _frida_g_cclosure_marshal_VOID__UCHARv -#define g_cclosure_marshal_VOID__UINT _frida_g_cclosure_marshal_VOID__UINT -#define g_cclosure_marshal_VOID__UINT_POINTER _frida_g_cclosure_marshal_VOID__UINT_POINTER -#define g_cclosure_marshal_VOID__UINT_POINTERv _frida_g_cclosure_marshal_VOID__UINT_POINTERv -#define g_cclosure_marshal_VOID__UINTv _frida_g_cclosure_marshal_VOID__UINTv -#define g_cclosure_marshal_VOID__ULONG _frida_g_cclosure_marshal_VOID__ULONG -#define g_cclosure_marshal_VOID__ULONGv _frida_g_cclosure_marshal_VOID__ULONGv -#define g_cclosure_marshal_VOID__VARIANT _frida_g_cclosure_marshal_VOID__VARIANT -#define g_cclosure_marshal_VOID__VARIANTv _frida_g_cclosure_marshal_VOID__VARIANTv -#define g_cclosure_marshal_VOID__VOID _frida_g_cclosure_marshal_VOID__VOID -#define g_cclosure_marshal_VOID__VOIDv _frida_g_cclosure_marshal_VOID__VOIDv -#define g_cclosure_marshal_generic _frida_g_cclosure_marshal_generic -#define g_cclosure_marshal_generic_va _frida_g_cclosure_marshal_generic_va -#define g_cclosure_new _frida_g_cclosure_new -#define g_cclosure_new_object _frida_g_cclosure_new_object -#define g_cclosure_new_object_swap _frida_g_cclosure_new_object_swap -#define g_cclosure_new_swap _frida_g_cclosure_new_swap -#define g_charset_converter_get_num_fallbacks _frida_g_charset_converter_get_num_fallbacks -#define g_charset_converter_get_type _frida_g_charset_converter_get_type -#define g_charset_converter_get_use_fallback _frida_g_charset_converter_get_use_fallback -#define g_charset_converter_new _frida_g_charset_converter_new -#define g_charset_converter_set_use_fallback _frida_g_charset_converter_set_use_fallback -#define g_chdir _frida_g_chdir -#define g_check_setuid _frida_g_check_setuid -#define g_checksum_copy _frida_g_checksum_copy -#define g_checksum_free _frida_g_checksum_free -#define g_checksum_get_digest _frida_g_checksum_get_digest -#define g_checksum_get_string _frida_g_checksum_get_string -#define g_checksum_get_type _frida_g_checksum_get_type -#define g_checksum_new _frida_g_checksum_new -#define g_checksum_reset _frida_g_checksum_reset -#define g_checksum_type_get_length _frida_g_checksum_type_get_length -#define g_checksum_update _frida_g_checksum_update -#define g_child_watch_add _frida_g_child_watch_add -#define g_child_watch_add_full _frida_g_child_watch_add_full -#define g_child_watch_funcs _frida_g_child_watch_funcs -#define g_child_watch_source_new _frida_g_child_watch_source_new -#define g_chmod _frida_g_chmod -#define g_clear_error _frida_g_clear_error -#define g_clear_handle_id _frida_g_clear_handle_id -#define g_clear_list _frida_g_clear_list -#define g_clear_object _frida_g_clear_object -#define g_clear_pointer _frida_g_clear_pointer -#define g_clear_signal_handler _frida_g_clear_signal_handler -#define g_clear_slist _frida_g_clear_slist -#define g_close _frida_g_close -#define g_closure_add_finalize_notifier _frida_g_closure_add_finalize_notifier -#define g_closure_add_invalidate_notifier _frida_g_closure_add_invalidate_notifier -#define g_closure_add_marshal_guards _frida_g_closure_add_marshal_guards -#define g_closure_get_type _frida_g_closure_get_type -#define g_closure_invalidate _frida_g_closure_invalidate -#define g_closure_invoke _frida_g_closure_invoke -#define g_closure_new_object _frida_g_closure_new_object -#define g_closure_new_simple _frida_g_closure_new_simple -#define g_closure_ref _frida_g_closure_ref -#define g_closure_remove_finalize_notifier _frida_g_closure_remove_finalize_notifier -#define g_closure_remove_invalidate_notifier _frida_g_closure_remove_invalidate_notifier -#define g_closure_set_marshal _frida_g_closure_set_marshal -#define g_closure_set_meta_marshal _frida_g_closure_set_meta_marshal -#define g_closure_sink _frida_g_closure_sink -#define g_closure_unref _frida_g_closure_unref -#define g_completion_add_items _frida_g_completion_add_items -#define g_completion_clear_items _frida_g_completion_clear_items -#define g_completion_complete _frida_g_completion_complete -#define g_completion_complete_utf8 _frida_g_completion_complete_utf8 -#define g_completion_free _frida_g_completion_free -#define g_completion_new _frida_g_completion_new -#define g_completion_remove_items _frida_g_completion_remove_items -#define g_completion_set_compare _frida_g_completion_set_compare -#define g_compute_checksum_for_bytes _frida_g_compute_checksum_for_bytes -#define g_compute_checksum_for_data _frida_g_compute_checksum_for_data -#define g_compute_checksum_for_string _frida_g_compute_checksum_for_string -#define g_compute_hmac_for_bytes _frida_g_compute_hmac_for_bytes -#define g_compute_hmac_for_data _frida_g_compute_hmac_for_data -#define g_compute_hmac_for_string _frida_g_compute_hmac_for_string -#define g_cond_broadcast _frida_g_cond_broadcast -#define g_cond_clear _frida_g_cond_clear -#define g_cond_free _frida_g_cond_free -#define g_cond_init _frida_g_cond_init -#define g_cond_new _frida_g_cond_new -#define g_cond_signal _frida_g_cond_signal -#define g_cond_timed_wait _frida_g_cond_timed_wait -#define g_cond_wait _frida_g_cond_wait -#define g_cond_wait_until _frida_g_cond_wait_until -#define g_content_type_can_be_executable _frida_g_content_type_can_be_executable -#define g_content_type_equals _frida_g_content_type_equals -#define g_content_type_from_mime_type _frida_g_content_type_from_mime_type -#define g_content_type_get_description _frida_g_content_type_get_description -#define g_content_type_get_generic_icon_name _frida_g_content_type_get_generic_icon_name -#define g_content_type_get_icon _frida_g_content_type_get_icon -#define g_content_type_get_mime_dirs _frida_g_content_type_get_mime_dirs -#define g_content_type_get_mime_type _frida_g_content_type_get_mime_type -#define g_content_type_get_symbolic_icon _frida_g_content_type_get_symbolic_icon -#define g_content_type_guess _frida_g_content_type_guess -#define g_content_type_guess_for_tree _frida_g_content_type_guess_for_tree -#define g_content_type_is_a _frida_g_content_type_is_a -#define g_content_type_is_mime_type _frida_g_content_type_is_mime_type -#define g_content_type_is_unknown _frida_g_content_type_is_unknown -#define g_content_type_set_mime_dirs _frida_g_content_type_set_mime_dirs -#define g_content_types_get_registered _frida_g_content_types_get_registered -#define g_context_specific_group_emit _frida_g_context_specific_group_emit -#define g_context_specific_group_get _frida_g_context_specific_group_get -#define g_context_specific_group_remove _frida_g_context_specific_group_remove -#define g_convert _frida_g_convert -#define g_convert_error_quark _frida_g_convert_error_quark -#define g_convert_with_fallback _frida_g_convert_with_fallback -#define g_convert_with_iconv _frida_g_convert_with_iconv -#define g_converter_convert _frida_g_converter_convert -#define g_converter_flags_get_type _frida_g_converter_flags_get_type -#define g_converter_get_type _frida_g_converter_get_type -#define g_converter_input_stream_get_converter _frida_g_converter_input_stream_get_converter -#define g_converter_input_stream_get_type _frida_g_converter_input_stream_get_type -#define g_converter_input_stream_new _frida_g_converter_input_stream_new -#define g_converter_output_stream_get_converter _frida_g_converter_output_stream_get_converter -#define g_converter_output_stream_get_type _frida_g_converter_output_stream_get_type -#define g_converter_output_stream_new _frida_g_converter_output_stream_new -#define g_converter_reset _frida_g_converter_reset -#define g_converter_result_get_type _frida_g_converter_result_get_type -#define g_creat _frida_g_creat -#define g_credentials_get_native _frida_g_credentials_get_native -#define g_credentials_get_type _frida_g_credentials_get_type -#define g_credentials_get_unix_pid _frida_g_credentials_get_unix_pid -#define g_credentials_get_unix_user _frida_g_credentials_get_unix_user -#define g_credentials_is_same_user _frida_g_credentials_is_same_user -#define g_credentials_new _frida_g_credentials_new -#define g_credentials_set_native _frida_g_credentials_set_native -#define g_credentials_set_unix_user _frida_g_credentials_set_unix_user -#define g_credentials_to_string _frida_g_credentials_to_string -#define g_credentials_type_get_type _frida_g_credentials_type_get_type -#define g_data_input_stream_get_byte_order _frida_g_data_input_stream_get_byte_order -#define g_data_input_stream_get_newline_type _frida_g_data_input_stream_get_newline_type -#define g_data_input_stream_get_type _frida_g_data_input_stream_get_type -#define g_data_input_stream_new _frida_g_data_input_stream_new -#define g_data_input_stream_read_byte _frida_g_data_input_stream_read_byte -#define g_data_input_stream_read_int16 _frida_g_data_input_stream_read_int16 -#define g_data_input_stream_read_int32 _frida_g_data_input_stream_read_int32 -#define g_data_input_stream_read_int64 _frida_g_data_input_stream_read_int64 -#define g_data_input_stream_read_line _frida_g_data_input_stream_read_line -#define g_data_input_stream_read_line_async _frida_g_data_input_stream_read_line_async -#define g_data_input_stream_read_line_finish _frida_g_data_input_stream_read_line_finish -#define g_data_input_stream_read_line_finish_utf8 _frida_g_data_input_stream_read_line_finish_utf8 -#define g_data_input_stream_read_line_utf8 _frida_g_data_input_stream_read_line_utf8 -#define g_data_input_stream_read_uint16 _frida_g_data_input_stream_read_uint16 -#define g_data_input_stream_read_uint32 _frida_g_data_input_stream_read_uint32 -#define g_data_input_stream_read_uint64 _frida_g_data_input_stream_read_uint64 -#define g_data_input_stream_read_until _frida_g_data_input_stream_read_until -#define g_data_input_stream_read_until_async _frida_g_data_input_stream_read_until_async -#define g_data_input_stream_read_until_finish _frida_g_data_input_stream_read_until_finish -#define g_data_input_stream_read_upto _frida_g_data_input_stream_read_upto -#define g_data_input_stream_read_upto_async _frida_g_data_input_stream_read_upto_async -#define g_data_input_stream_read_upto_finish _frida_g_data_input_stream_read_upto_finish -#define g_data_input_stream_set_byte_order _frida_g_data_input_stream_set_byte_order -#define g_data_input_stream_set_newline_type _frida_g_data_input_stream_set_newline_type -#define g_data_output_stream_get_byte_order _frida_g_data_output_stream_get_byte_order -#define g_data_output_stream_get_type _frida_g_data_output_stream_get_type -#define g_data_output_stream_new _frida_g_data_output_stream_new -#define g_data_output_stream_put_byte _frida_g_data_output_stream_put_byte -#define g_data_output_stream_put_int16 _frida_g_data_output_stream_put_int16 -#define g_data_output_stream_put_int32 _frida_g_data_output_stream_put_int32 -#define g_data_output_stream_put_int64 _frida_g_data_output_stream_put_int64 -#define g_data_output_stream_put_string _frida_g_data_output_stream_put_string -#define g_data_output_stream_put_uint16 _frida_g_data_output_stream_put_uint16 -#define g_data_output_stream_put_uint32 _frida_g_data_output_stream_put_uint32 -#define g_data_output_stream_put_uint64 _frida_g_data_output_stream_put_uint64 -#define g_data_output_stream_set_byte_order _frida_g_data_output_stream_set_byte_order -#define g_data_stream_byte_order_get_type _frida_g_data_stream_byte_order_get_type -#define g_data_stream_newline_type_get_type _frida_g_data_stream_newline_type_get_type -#define g_datagram_based_condition_check _frida_g_datagram_based_condition_check -#define g_datagram_based_condition_wait _frida_g_datagram_based_condition_wait -#define g_datagram_based_create_source _frida_g_datagram_based_create_source -#define g_datagram_based_get_type _frida_g_datagram_based_get_type -#define g_datagram_based_receive_messages _frida_g_datagram_based_receive_messages -#define g_datagram_based_send_messages _frida_g_datagram_based_send_messages -#define g_datalist_clear _frida_g_datalist_clear -#define g_datalist_foreach _frida_g_datalist_foreach -#define g_datalist_get_data _frida_g_datalist_get_data -#define g_datalist_get_flags _frida_g_datalist_get_flags -#define g_datalist_id_dup_data _frida_g_datalist_id_dup_data -#define g_datalist_id_get_data _frida_g_datalist_id_get_data -#define g_datalist_id_remove_no_notify _frida_g_datalist_id_remove_no_notify -#define g_datalist_id_replace_data _frida_g_datalist_id_replace_data -#define g_datalist_id_set_data_full _frida_g_datalist_id_set_data_full -#define g_datalist_init _frida_g_datalist_init -#define g_datalist_set_flags _frida_g_datalist_set_flags -#define g_datalist_unset_flags _frida_g_datalist_unset_flags -#define g_dataset_destroy _frida_g_dataset_destroy -#define g_dataset_foreach _frida_g_dataset_foreach -#define g_dataset_id_get_data _frida_g_dataset_id_get_data -#define g_dataset_id_remove_no_notify _frida_g_dataset_id_remove_no_notify -#define g_dataset_id_set_data_full _frida_g_dataset_id_set_data_full -#define g_date_add_days _frida_g_date_add_days -#define g_date_add_months _frida_g_date_add_months -#define g_date_add_years _frida_g_date_add_years -#define g_date_clamp _frida_g_date_clamp -#define g_date_clear _frida_g_date_clear -#define g_date_compare _frida_g_date_compare -#define g_date_copy _frida_g_date_copy -#define g_date_days_between _frida_g_date_days_between -#define g_date_free _frida_g_date_free -#define g_date_get_day _frida_g_date_get_day -#define g_date_get_day_of_year _frida_g_date_get_day_of_year -#define g_date_get_days_in_month _frida_g_date_get_days_in_month -#define g_date_get_iso8601_week_of_year _frida_g_date_get_iso8601_week_of_year -#define g_date_get_julian _frida_g_date_get_julian -#define g_date_get_monday_week_of_year _frida_g_date_get_monday_week_of_year -#define g_date_get_monday_weeks_in_year _frida_g_date_get_monday_weeks_in_year -#define g_date_get_month _frida_g_date_get_month -#define g_date_get_sunday_week_of_year _frida_g_date_get_sunday_week_of_year -#define g_date_get_sunday_weeks_in_year _frida_g_date_get_sunday_weeks_in_year -#define g_date_get_type _frida_g_date_get_type -#define g_date_get_weekday _frida_g_date_get_weekday -#define g_date_get_year _frida_g_date_get_year -#define g_date_is_first_of_month _frida_g_date_is_first_of_month -#define g_date_is_last_of_month _frida_g_date_is_last_of_month -#define g_date_is_leap_year _frida_g_date_is_leap_year -#define g_date_new _frida_g_date_new -#define g_date_new_dmy _frida_g_date_new_dmy -#define g_date_new_julian _frida_g_date_new_julian -#define g_date_order _frida_g_date_order -#define g_date_set_day _frida_g_date_set_day -#define g_date_set_dmy _frida_g_date_set_dmy -#define g_date_set_julian _frida_g_date_set_julian -#define g_date_set_month _frida_g_date_set_month -#define g_date_set_parse _frida_g_date_set_parse -#define g_date_set_time _frida_g_date_set_time -#define g_date_set_time_t _frida_g_date_set_time_t -#define g_date_set_time_val _frida_g_date_set_time_val -#define g_date_set_year _frida_g_date_set_year -#define g_date_strftime _frida_g_date_strftime -#define g_date_subtract_days _frida_g_date_subtract_days -#define g_date_subtract_months _frida_g_date_subtract_months -#define g_date_subtract_years _frida_g_date_subtract_years -#define g_date_time_add _frida_g_date_time_add -#define g_date_time_add_days _frida_g_date_time_add_days -#define g_date_time_add_full _frida_g_date_time_add_full -#define g_date_time_add_hours _frida_g_date_time_add_hours -#define g_date_time_add_minutes _frida_g_date_time_add_minutes -#define g_date_time_add_months _frida_g_date_time_add_months -#define g_date_time_add_seconds _frida_g_date_time_add_seconds -#define g_date_time_add_weeks _frida_g_date_time_add_weeks -#define g_date_time_add_years _frida_g_date_time_add_years -#define g_date_time_compare _frida_g_date_time_compare -#define g_date_time_difference _frida_g_date_time_difference -#define g_date_time_equal _frida_g_date_time_equal -#define g_date_time_format _frida_g_date_time_format -#define g_date_time_format_iso8601 _frida_g_date_time_format_iso8601 -#define g_date_time_get_day_of_month _frida_g_date_time_get_day_of_month -#define g_date_time_get_day_of_week _frida_g_date_time_get_day_of_week -#define g_date_time_get_day_of_year _frida_g_date_time_get_day_of_year -#define g_date_time_get_hour _frida_g_date_time_get_hour -#define g_date_time_get_microsecond _frida_g_date_time_get_microsecond -#define g_date_time_get_minute _frida_g_date_time_get_minute -#define g_date_time_get_month _frida_g_date_time_get_month -#define g_date_time_get_second _frida_g_date_time_get_second -#define g_date_time_get_seconds _frida_g_date_time_get_seconds -#define g_date_time_get_timezone _frida_g_date_time_get_timezone -#define g_date_time_get_timezone_abbreviation _frida_g_date_time_get_timezone_abbreviation -#define g_date_time_get_type _frida_g_date_time_get_type -#define g_date_time_get_utc_offset _frida_g_date_time_get_utc_offset -#define g_date_time_get_week_numbering_year _frida_g_date_time_get_week_numbering_year -#define g_date_time_get_week_of_year _frida_g_date_time_get_week_of_year -#define g_date_time_get_year _frida_g_date_time_get_year -#define g_date_time_get_ymd _frida_g_date_time_get_ymd -#define g_date_time_hash _frida_g_date_time_hash -#define g_date_time_is_daylight_savings _frida_g_date_time_is_daylight_savings -#define g_date_time_new _frida_g_date_time_new -#define g_date_time_new_from_iso8601 _frida_g_date_time_new_from_iso8601 -#define g_date_time_new_from_timeval_local _frida_g_date_time_new_from_timeval_local -#define g_date_time_new_from_timeval_utc _frida_g_date_time_new_from_timeval_utc -#define g_date_time_new_from_unix_local _frida_g_date_time_new_from_unix_local -#define g_date_time_new_from_unix_utc _frida_g_date_time_new_from_unix_utc -#define g_date_time_new_local _frida_g_date_time_new_local -#define g_date_time_new_now _frida_g_date_time_new_now -#define g_date_time_new_now_local _frida_g_date_time_new_now_local -#define g_date_time_new_now_utc _frida_g_date_time_new_now_utc -#define g_date_time_new_utc _frida_g_date_time_new_utc -#define g_date_time_ref _frida_g_date_time_ref -#define g_date_time_to_local _frida_g_date_time_to_local -#define g_date_time_to_timeval _frida_g_date_time_to_timeval -#define g_date_time_to_timezone _frida_g_date_time_to_timezone -#define g_date_time_to_unix _frida_g_date_time_to_unix -#define g_date_time_to_utc _frida_g_date_time_to_utc -#define g_date_time_unref _frida_g_date_time_unref -#define g_date_to_struct_tm _frida_g_date_to_struct_tm -#define g_date_valid _frida_g_date_valid -#define g_date_valid_day _frida_g_date_valid_day -#define g_date_valid_dmy _frida_g_date_valid_dmy -#define g_date_valid_julian _frida_g_date_valid_julian -#define g_date_valid_month _frida_g_date_valid_month -#define g_date_valid_weekday _frida_g_date_valid_weekday -#define g_date_valid_year _frida_g_date_valid_year -#define g_dbus_action_group_get _frida_g_dbus_action_group_get -#define g_dbus_action_group_get_type _frida_g_dbus_action_group_get_type -#define g_dbus_action_group_sync _frida_g_dbus_action_group_sync -#define g_dbus_address_escape_value _frida_g_dbus_address_escape_value -#define g_dbus_address_get_for_bus_sync _frida_g_dbus_address_get_for_bus_sync -#define g_dbus_address_get_stream _frida_g_dbus_address_get_stream -#define g_dbus_address_get_stream_finish _frida_g_dbus_address_get_stream_finish -#define g_dbus_address_get_stream_sync _frida_g_dbus_address_get_stream_sync -#define g_dbus_annotation_info_get_type _frida_g_dbus_annotation_info_get_type -#define g_dbus_annotation_info_lookup _frida_g_dbus_annotation_info_lookup -#define g_dbus_annotation_info_ref _frida_g_dbus_annotation_info_ref -#define g_dbus_annotation_info_unref _frida_g_dbus_annotation_info_unref -#define g_dbus_arg_info_get_type _frida_g_dbus_arg_info_get_type -#define g_dbus_arg_info_ref _frida_g_dbus_arg_info_ref -#define g_dbus_arg_info_unref _frida_g_dbus_arg_info_unref -#define g_dbus_auth_observer_allow_mechanism _frida_g_dbus_auth_observer_allow_mechanism -#define g_dbus_auth_observer_authorize_authenticated_peer _frida_g_dbus_auth_observer_authorize_authenticated_peer -#define g_dbus_auth_observer_get_type _frida_g_dbus_auth_observer_get_type -#define g_dbus_auth_observer_new _frida_g_dbus_auth_observer_new -#define g_dbus_call_flags_get_type _frida_g_dbus_call_flags_get_type -#define g_dbus_capability_flags_get_type _frida_g_dbus_capability_flags_get_type -#define g_dbus_connection_add_filter _frida_g_dbus_connection_add_filter -#define g_dbus_connection_call _frida_g_dbus_connection_call -#define g_dbus_connection_call_finish _frida_g_dbus_connection_call_finish -#define g_dbus_connection_call_sync _frida_g_dbus_connection_call_sync -#define g_dbus_connection_call_with_unix_fd_list _frida_g_dbus_connection_call_with_unix_fd_list -#define g_dbus_connection_call_with_unix_fd_list_finish _frida_g_dbus_connection_call_with_unix_fd_list_finish -#define g_dbus_connection_call_with_unix_fd_list_sync _frida_g_dbus_connection_call_with_unix_fd_list_sync -#define g_dbus_connection_close _frida_g_dbus_connection_close -#define g_dbus_connection_close_finish _frida_g_dbus_connection_close_finish -#define g_dbus_connection_close_sync _frida_g_dbus_connection_close_sync -#define g_dbus_connection_emit_signal _frida_g_dbus_connection_emit_signal -#define g_dbus_connection_export_action_group _frida_g_dbus_connection_export_action_group -#define g_dbus_connection_export_menu_model _frida_g_dbus_connection_export_menu_model -#define g_dbus_connection_flags_get_type _frida_g_dbus_connection_flags_get_type -#define g_dbus_connection_flush _frida_g_dbus_connection_flush -#define g_dbus_connection_flush_finish _frida_g_dbus_connection_flush_finish -#define g_dbus_connection_flush_sync _frida_g_dbus_connection_flush_sync -#define g_dbus_connection_get_capabilities _frida_g_dbus_connection_get_capabilities -#define g_dbus_connection_get_exit_on_close _frida_g_dbus_connection_get_exit_on_close -#define g_dbus_connection_get_flags _frida_g_dbus_connection_get_flags -#define g_dbus_connection_get_guid _frida_g_dbus_connection_get_guid -#define g_dbus_connection_get_last_serial _frida_g_dbus_connection_get_last_serial -#define g_dbus_connection_get_peer_credentials _frida_g_dbus_connection_get_peer_credentials -#define g_dbus_connection_get_stream _frida_g_dbus_connection_get_stream -#define g_dbus_connection_get_type _frida_g_dbus_connection_get_type -#define g_dbus_connection_get_unique_name _frida_g_dbus_connection_get_unique_name -#define g_dbus_connection_is_closed _frida_g_dbus_connection_is_closed -#define g_dbus_connection_new _frida_g_dbus_connection_new -#define g_dbus_connection_new_finish _frida_g_dbus_connection_new_finish -#define g_dbus_connection_new_for_address _frida_g_dbus_connection_new_for_address -#define g_dbus_connection_new_for_address_finish _frida_g_dbus_connection_new_for_address_finish -#define g_dbus_connection_new_for_address_sync _frida_g_dbus_connection_new_for_address_sync -#define g_dbus_connection_new_sync _frida_g_dbus_connection_new_sync -#define g_dbus_connection_register_object _frida_g_dbus_connection_register_object -#define g_dbus_connection_register_object_with_closures _frida_g_dbus_connection_register_object_with_closures -#define g_dbus_connection_register_subtree _frida_g_dbus_connection_register_subtree -#define g_dbus_connection_remove_filter _frida_g_dbus_connection_remove_filter -#define g_dbus_connection_send_message _frida_g_dbus_connection_send_message -#define g_dbus_connection_send_message_with_reply _frida_g_dbus_connection_send_message_with_reply -#define g_dbus_connection_send_message_with_reply_finish _frida_g_dbus_connection_send_message_with_reply_finish -#define g_dbus_connection_send_message_with_reply_sync _frida_g_dbus_connection_send_message_with_reply_sync -#define g_dbus_connection_set_exit_on_close _frida_g_dbus_connection_set_exit_on_close -#define g_dbus_connection_signal_subscribe _frida_g_dbus_connection_signal_subscribe -#define g_dbus_connection_signal_unsubscribe _frida_g_dbus_connection_signal_unsubscribe -#define g_dbus_connection_start_message_processing _frida_g_dbus_connection_start_message_processing -#define g_dbus_connection_unexport_action_group _frida_g_dbus_connection_unexport_action_group -#define g_dbus_connection_unexport_menu_model _frida_g_dbus_connection_unexport_menu_model -#define g_dbus_connection_unregister_object _frida_g_dbus_connection_unregister_object -#define g_dbus_connection_unregister_subtree _frida_g_dbus_connection_unregister_subtree -#define g_dbus_error_encode_gerror _frida_g_dbus_error_encode_gerror -#define g_dbus_error_get_remote_error _frida_g_dbus_error_get_remote_error -#define g_dbus_error_get_type _frida_g_dbus_error_get_type -#define g_dbus_error_is_remote_error _frida_g_dbus_error_is_remote_error -#define g_dbus_error_new_for_dbus_error _frida_g_dbus_error_new_for_dbus_error -#define g_dbus_error_quark _frida_g_dbus_error_quark -#define g_dbus_error_register_error _frida_g_dbus_error_register_error -#define g_dbus_error_register_error_domain _frida_g_dbus_error_register_error_domain -#define g_dbus_error_set_dbus_error _frida_g_dbus_error_set_dbus_error -#define g_dbus_error_set_dbus_error_valist _frida_g_dbus_error_set_dbus_error_valist -#define g_dbus_error_strip_remote_error _frida_g_dbus_error_strip_remote_error -#define g_dbus_error_unregister_error _frida_g_dbus_error_unregister_error -#define g_dbus_generate_guid _frida_g_dbus_generate_guid -#define g_dbus_gvalue_to_gvariant _frida_g_dbus_gvalue_to_gvariant -#define g_dbus_gvariant_to_gvalue _frida_g_dbus_gvariant_to_gvalue -#define g_dbus_interface_dup_object _frida_g_dbus_interface_dup_object -#define g_dbus_interface_get_info _frida_g_dbus_interface_get_info -#define g_dbus_interface_get_object _frida_g_dbus_interface_get_object -#define g_dbus_interface_get_type _frida_g_dbus_interface_get_type -#define g_dbus_interface_info_cache_build _frida_g_dbus_interface_info_cache_build -#define g_dbus_interface_info_cache_release _frida_g_dbus_interface_info_cache_release -#define g_dbus_interface_info_generate_xml _frida_g_dbus_interface_info_generate_xml -#define g_dbus_interface_info_get_type _frida_g_dbus_interface_info_get_type -#define g_dbus_interface_info_lookup_method _frida_g_dbus_interface_info_lookup_method -#define g_dbus_interface_info_lookup_property _frida_g_dbus_interface_info_lookup_property -#define g_dbus_interface_info_lookup_signal _frida_g_dbus_interface_info_lookup_signal -#define g_dbus_interface_info_ref _frida_g_dbus_interface_info_ref -#define g_dbus_interface_info_unref _frida_g_dbus_interface_info_unref -#define g_dbus_interface_set_object _frida_g_dbus_interface_set_object -#define g_dbus_interface_skeleton_export _frida_g_dbus_interface_skeleton_export -#define g_dbus_interface_skeleton_flags_get_type _frida_g_dbus_interface_skeleton_flags_get_type -#define g_dbus_interface_skeleton_flush _frida_g_dbus_interface_skeleton_flush -#define g_dbus_interface_skeleton_get_connection _frida_g_dbus_interface_skeleton_get_connection -#define g_dbus_interface_skeleton_get_connections _frida_g_dbus_interface_skeleton_get_connections -#define g_dbus_interface_skeleton_get_flags _frida_g_dbus_interface_skeleton_get_flags -#define g_dbus_interface_skeleton_get_info _frida_g_dbus_interface_skeleton_get_info -#define g_dbus_interface_skeleton_get_object_path _frida_g_dbus_interface_skeleton_get_object_path -#define g_dbus_interface_skeleton_get_properties _frida_g_dbus_interface_skeleton_get_properties -#define g_dbus_interface_skeleton_get_type _frida_g_dbus_interface_skeleton_get_type -#define g_dbus_interface_skeleton_get_vtable _frida_g_dbus_interface_skeleton_get_vtable -#define g_dbus_interface_skeleton_has_connection _frida_g_dbus_interface_skeleton_has_connection -#define g_dbus_interface_skeleton_set_flags _frida_g_dbus_interface_skeleton_set_flags -#define g_dbus_interface_skeleton_unexport _frida_g_dbus_interface_skeleton_unexport -#define g_dbus_interface_skeleton_unexport_from_connection _frida_g_dbus_interface_skeleton_unexport_from_connection -#define g_dbus_is_address _frida_g_dbus_is_address -#define g_dbus_is_guid _frida_g_dbus_is_guid -#define g_dbus_is_interface_name _frida_g_dbus_is_interface_name -#define g_dbus_is_member_name _frida_g_dbus_is_member_name -#define g_dbus_is_name _frida_g_dbus_is_name -#define g_dbus_is_supported_address _frida_g_dbus_is_supported_address -#define g_dbus_is_unique_name _frida_g_dbus_is_unique_name -#define g_dbus_menu_model_get _frida_g_dbus_menu_model_get -#define g_dbus_menu_model_get_type _frida_g_dbus_menu_model_get_type -#define g_dbus_message_byte_order_get_type _frida_g_dbus_message_byte_order_get_type -#define g_dbus_message_bytes_needed _frida_g_dbus_message_bytes_needed -#define g_dbus_message_copy _frida_g_dbus_message_copy -#define g_dbus_message_flags_get_type _frida_g_dbus_message_flags_get_type -#define g_dbus_message_get_arg0 _frida_g_dbus_message_get_arg0 -#define g_dbus_message_get_body _frida_g_dbus_message_get_body -#define g_dbus_message_get_byte_order _frida_g_dbus_message_get_byte_order -#define g_dbus_message_get_destination _frida_g_dbus_message_get_destination -#define g_dbus_message_get_error_name _frida_g_dbus_message_get_error_name -#define g_dbus_message_get_flags _frida_g_dbus_message_get_flags -#define g_dbus_message_get_header _frida_g_dbus_message_get_header -#define g_dbus_message_get_header_fields _frida_g_dbus_message_get_header_fields -#define g_dbus_message_get_interface _frida_g_dbus_message_get_interface -#define g_dbus_message_get_locked _frida_g_dbus_message_get_locked -#define g_dbus_message_get_member _frida_g_dbus_message_get_member -#define g_dbus_message_get_message_type _frida_g_dbus_message_get_message_type -#define g_dbus_message_get_num_unix_fds _frida_g_dbus_message_get_num_unix_fds -#define g_dbus_message_get_path _frida_g_dbus_message_get_path -#define g_dbus_message_get_reply_serial _frida_g_dbus_message_get_reply_serial -#define g_dbus_message_get_sender _frida_g_dbus_message_get_sender -#define g_dbus_message_get_serial _frida_g_dbus_message_get_serial -#define g_dbus_message_get_signature _frida_g_dbus_message_get_signature -#define g_dbus_message_get_type _frida_g_dbus_message_get_type -#define g_dbus_message_get_unix_fd_list _frida_g_dbus_message_get_unix_fd_list -#define g_dbus_message_header_field_get_type _frida_g_dbus_message_header_field_get_type -#define g_dbus_message_lock _frida_g_dbus_message_lock -#define g_dbus_message_new _frida_g_dbus_message_new -#define g_dbus_message_new_from_blob _frida_g_dbus_message_new_from_blob -#define g_dbus_message_new_method_call _frida_g_dbus_message_new_method_call -#define g_dbus_message_new_method_error _frida_g_dbus_message_new_method_error -#define g_dbus_message_new_method_error_literal _frida_g_dbus_message_new_method_error_literal -#define g_dbus_message_new_method_error_valist _frida_g_dbus_message_new_method_error_valist -#define g_dbus_message_new_method_reply _frida_g_dbus_message_new_method_reply -#define g_dbus_message_new_signal _frida_g_dbus_message_new_signal -#define g_dbus_message_print _frida_g_dbus_message_print -#define g_dbus_message_set_body _frida_g_dbus_message_set_body -#define g_dbus_message_set_byte_order _frida_g_dbus_message_set_byte_order -#define g_dbus_message_set_destination _frida_g_dbus_message_set_destination -#define g_dbus_message_set_error_name _frida_g_dbus_message_set_error_name -#define g_dbus_message_set_flags _frida_g_dbus_message_set_flags -#define g_dbus_message_set_header _frida_g_dbus_message_set_header -#define g_dbus_message_set_interface _frida_g_dbus_message_set_interface -#define g_dbus_message_set_member _frida_g_dbus_message_set_member -#define g_dbus_message_set_message_type _frida_g_dbus_message_set_message_type -#define g_dbus_message_set_num_unix_fds _frida_g_dbus_message_set_num_unix_fds -#define g_dbus_message_set_path _frida_g_dbus_message_set_path -#define g_dbus_message_set_reply_serial _frida_g_dbus_message_set_reply_serial -#define g_dbus_message_set_sender _frida_g_dbus_message_set_sender -#define g_dbus_message_set_serial _frida_g_dbus_message_set_serial -#define g_dbus_message_set_signature _frida_g_dbus_message_set_signature -#define g_dbus_message_set_unix_fd_list _frida_g_dbus_message_set_unix_fd_list -#define g_dbus_message_to_blob _frida_g_dbus_message_to_blob -#define g_dbus_message_to_gerror _frida_g_dbus_message_to_gerror -#define g_dbus_message_type_get_type _frida_g_dbus_message_type_get_type -#define g_dbus_method_info_get_type _frida_g_dbus_method_info_get_type -#define g_dbus_method_info_ref _frida_g_dbus_method_info_ref -#define g_dbus_method_info_unref _frida_g_dbus_method_info_unref -#define g_dbus_method_invocation_get_connection _frida_g_dbus_method_invocation_get_connection -#define g_dbus_method_invocation_get_interface_name _frida_g_dbus_method_invocation_get_interface_name -#define g_dbus_method_invocation_get_message _frida_g_dbus_method_invocation_get_message -#define g_dbus_method_invocation_get_method_info _frida_g_dbus_method_invocation_get_method_info -#define g_dbus_method_invocation_get_method_name _frida_g_dbus_method_invocation_get_method_name -#define g_dbus_method_invocation_get_object_path _frida_g_dbus_method_invocation_get_object_path -#define g_dbus_method_invocation_get_parameters _frida_g_dbus_method_invocation_get_parameters -#define g_dbus_method_invocation_get_property_info _frida_g_dbus_method_invocation_get_property_info -#define g_dbus_method_invocation_get_sender _frida_g_dbus_method_invocation_get_sender -#define g_dbus_method_invocation_get_type _frida_g_dbus_method_invocation_get_type -#define g_dbus_method_invocation_get_user_data _frida_g_dbus_method_invocation_get_user_data -#define g_dbus_method_invocation_return_dbus_error _frida_g_dbus_method_invocation_return_dbus_error -#define g_dbus_method_invocation_return_error _frida_g_dbus_method_invocation_return_error -#define g_dbus_method_invocation_return_error_literal _frida_g_dbus_method_invocation_return_error_literal -#define g_dbus_method_invocation_return_error_valist _frida_g_dbus_method_invocation_return_error_valist -#define g_dbus_method_invocation_return_gerror _frida_g_dbus_method_invocation_return_gerror -#define g_dbus_method_invocation_return_value _frida_g_dbus_method_invocation_return_value -#define g_dbus_method_invocation_return_value_with_unix_fd_list _frida_g_dbus_method_invocation_return_value_with_unix_fd_list -#define g_dbus_method_invocation_take_error _frida_g_dbus_method_invocation_take_error -#define g_dbus_node_info_generate_xml _frida_g_dbus_node_info_generate_xml -#define g_dbus_node_info_get_type _frida_g_dbus_node_info_get_type -#define g_dbus_node_info_lookup_interface _frida_g_dbus_node_info_lookup_interface -#define g_dbus_node_info_new_for_xml _frida_g_dbus_node_info_new_for_xml -#define g_dbus_node_info_ref _frida_g_dbus_node_info_ref -#define g_dbus_node_info_unref _frida_g_dbus_node_info_unref -#define g_dbus_object_get_interface _frida_g_dbus_object_get_interface -#define g_dbus_object_get_interfaces _frida_g_dbus_object_get_interfaces -#define g_dbus_object_get_object_path _frida_g_dbus_object_get_object_path -#define g_dbus_object_get_type _frida_g_dbus_object_get_type -#define g_dbus_object_manager_client_flags_get_type _frida_g_dbus_object_manager_client_flags_get_type -#define g_dbus_object_manager_client_get_connection _frida_g_dbus_object_manager_client_get_connection -#define g_dbus_object_manager_client_get_flags _frida_g_dbus_object_manager_client_get_flags -#define g_dbus_object_manager_client_get_name _frida_g_dbus_object_manager_client_get_name -#define g_dbus_object_manager_client_get_name_owner _frida_g_dbus_object_manager_client_get_name_owner -#define g_dbus_object_manager_client_get_type _frida_g_dbus_object_manager_client_get_type -#define g_dbus_object_manager_client_new _frida_g_dbus_object_manager_client_new -#define g_dbus_object_manager_client_new_finish _frida_g_dbus_object_manager_client_new_finish -#define g_dbus_object_manager_client_new_for_bus _frida_g_dbus_object_manager_client_new_for_bus -#define g_dbus_object_manager_client_new_for_bus_finish _frida_g_dbus_object_manager_client_new_for_bus_finish -#define g_dbus_object_manager_client_new_for_bus_sync _frida_g_dbus_object_manager_client_new_for_bus_sync -#define g_dbus_object_manager_client_new_sync _frida_g_dbus_object_manager_client_new_sync -#define g_dbus_object_manager_get_interface _frida_g_dbus_object_manager_get_interface -#define g_dbus_object_manager_get_object _frida_g_dbus_object_manager_get_object -#define g_dbus_object_manager_get_object_path _frida_g_dbus_object_manager_get_object_path -#define g_dbus_object_manager_get_objects _frida_g_dbus_object_manager_get_objects -#define g_dbus_object_manager_get_type _frida_g_dbus_object_manager_get_type -#define g_dbus_object_manager_server_export _frida_g_dbus_object_manager_server_export -#define g_dbus_object_manager_server_export_uniquely _frida_g_dbus_object_manager_server_export_uniquely -#define g_dbus_object_manager_server_get_connection _frida_g_dbus_object_manager_server_get_connection -#define g_dbus_object_manager_server_get_type _frida_g_dbus_object_manager_server_get_type -#define g_dbus_object_manager_server_is_exported _frida_g_dbus_object_manager_server_is_exported -#define g_dbus_object_manager_server_new _frida_g_dbus_object_manager_server_new -#define g_dbus_object_manager_server_set_connection _frida_g_dbus_object_manager_server_set_connection -#define g_dbus_object_manager_server_unexport _frida_g_dbus_object_manager_server_unexport -#define g_dbus_object_proxy_get_connection _frida_g_dbus_object_proxy_get_connection -#define g_dbus_object_proxy_get_type _frida_g_dbus_object_proxy_get_type -#define g_dbus_object_proxy_new _frida_g_dbus_object_proxy_new -#define g_dbus_object_skeleton_add_interface _frida_g_dbus_object_skeleton_add_interface -#define g_dbus_object_skeleton_flush _frida_g_dbus_object_skeleton_flush -#define g_dbus_object_skeleton_get_type _frida_g_dbus_object_skeleton_get_type -#define g_dbus_object_skeleton_new _frida_g_dbus_object_skeleton_new -#define g_dbus_object_skeleton_remove_interface _frida_g_dbus_object_skeleton_remove_interface -#define g_dbus_object_skeleton_remove_interface_by_name _frida_g_dbus_object_skeleton_remove_interface_by_name -#define g_dbus_object_skeleton_set_object_path _frida_g_dbus_object_skeleton_set_object_path -#define g_dbus_property_info_flags_get_type _frida_g_dbus_property_info_flags_get_type -#define g_dbus_property_info_get_type _frida_g_dbus_property_info_get_type -#define g_dbus_property_info_ref _frida_g_dbus_property_info_ref -#define g_dbus_property_info_unref _frida_g_dbus_property_info_unref -#define g_dbus_proxy_call _frida_g_dbus_proxy_call -#define g_dbus_proxy_call_finish _frida_g_dbus_proxy_call_finish -#define g_dbus_proxy_call_sync _frida_g_dbus_proxy_call_sync -#define g_dbus_proxy_call_with_unix_fd_list _frida_g_dbus_proxy_call_with_unix_fd_list -#define g_dbus_proxy_call_with_unix_fd_list_finish _frida_g_dbus_proxy_call_with_unix_fd_list_finish -#define g_dbus_proxy_call_with_unix_fd_list_sync _frida_g_dbus_proxy_call_with_unix_fd_list_sync -#define g_dbus_proxy_flags_get_type _frida_g_dbus_proxy_flags_get_type -#define g_dbus_proxy_get_cached_property _frida_g_dbus_proxy_get_cached_property -#define g_dbus_proxy_get_cached_property_names _frida_g_dbus_proxy_get_cached_property_names -#define g_dbus_proxy_get_connection _frida_g_dbus_proxy_get_connection -#define g_dbus_proxy_get_default_timeout _frida_g_dbus_proxy_get_default_timeout -#define g_dbus_proxy_get_flags _frida_g_dbus_proxy_get_flags -#define g_dbus_proxy_get_interface_info _frida_g_dbus_proxy_get_interface_info -#define g_dbus_proxy_get_interface_name _frida_g_dbus_proxy_get_interface_name -#define g_dbus_proxy_get_name _frida_g_dbus_proxy_get_name -#define g_dbus_proxy_get_name_owner _frida_g_dbus_proxy_get_name_owner -#define g_dbus_proxy_get_object_path _frida_g_dbus_proxy_get_object_path -#define g_dbus_proxy_get_type _frida_g_dbus_proxy_get_type -#define g_dbus_proxy_new _frida_g_dbus_proxy_new -#define g_dbus_proxy_new_finish _frida_g_dbus_proxy_new_finish -#define g_dbus_proxy_new_for_bus _frida_g_dbus_proxy_new_for_bus -#define g_dbus_proxy_new_for_bus_finish _frida_g_dbus_proxy_new_for_bus_finish -#define g_dbus_proxy_new_for_bus_sync _frida_g_dbus_proxy_new_for_bus_sync -#define g_dbus_proxy_new_sync _frida_g_dbus_proxy_new_sync -#define g_dbus_proxy_set_cached_property _frida_g_dbus_proxy_set_cached_property -#define g_dbus_proxy_set_default_timeout _frida_g_dbus_proxy_set_default_timeout -#define g_dbus_proxy_set_interface_info _frida_g_dbus_proxy_set_interface_info -#define g_dbus_send_message_flags_get_type _frida_g_dbus_send_message_flags_get_type -#define g_dbus_server_flags_get_type _frida_g_dbus_server_flags_get_type -#define g_dbus_server_get_client_address _frida_g_dbus_server_get_client_address -#define g_dbus_server_get_flags _frida_g_dbus_server_get_flags -#define g_dbus_server_get_guid _frida_g_dbus_server_get_guid -#define g_dbus_server_get_type _frida_g_dbus_server_get_type -#define g_dbus_server_is_active _frida_g_dbus_server_is_active -#define g_dbus_server_new_sync _frida_g_dbus_server_new_sync -#define g_dbus_server_start _frida_g_dbus_server_start -#define g_dbus_server_stop _frida_g_dbus_server_stop -#define g_dbus_signal_flags_get_type _frida_g_dbus_signal_flags_get_type -#define g_dbus_signal_info_get_type _frida_g_dbus_signal_info_get_type -#define g_dbus_signal_info_ref _frida_g_dbus_signal_info_ref -#define g_dbus_signal_info_unref _frida_g_dbus_signal_info_unref -#define g_dbus_subtree_flags_get_type _frida_g_dbus_subtree_flags_get_type -#define g_dcgettext _frida_g_dcgettext -#define g_delayed_settings_backend_apply _frida_g_delayed_settings_backend_apply -#define g_delayed_settings_backend_get_has_unapplied _frida_g_delayed_settings_backend_get_has_unapplied -#define g_delayed_settings_backend_get_type _frida_g_delayed_settings_backend_get_type -#define g_delayed_settings_backend_new _frida_g_delayed_settings_backend_new -#define g_delayed_settings_backend_revert _frida_g_delayed_settings_backend_revert -#define g_desktop_app_info_get_action_name _frida_g_desktop_app_info_get_action_name -#define g_desktop_app_info_get_boolean _frida_g_desktop_app_info_get_boolean -#define g_desktop_app_info_get_categories _frida_g_desktop_app_info_get_categories -#define g_desktop_app_info_get_filename _frida_g_desktop_app_info_get_filename -#define g_desktop_app_info_get_generic_name _frida_g_desktop_app_info_get_generic_name -#define g_desktop_app_info_get_implementations _frida_g_desktop_app_info_get_implementations -#define g_desktop_app_info_get_is_hidden _frida_g_desktop_app_info_get_is_hidden -#define g_desktop_app_info_get_keywords _frida_g_desktop_app_info_get_keywords -#define g_desktop_app_info_get_locale_string _frida_g_desktop_app_info_get_locale_string -#define g_desktop_app_info_get_nodisplay _frida_g_desktop_app_info_get_nodisplay -#define g_desktop_app_info_get_show_in _frida_g_desktop_app_info_get_show_in -#define g_desktop_app_info_get_startup_wm_class _frida_g_desktop_app_info_get_startup_wm_class -#define g_desktop_app_info_get_string _frida_g_desktop_app_info_get_string -#define g_desktop_app_info_get_string_list _frida_g_desktop_app_info_get_string_list -#define g_desktop_app_info_get_type _frida_g_desktop_app_info_get_type -#define g_desktop_app_info_has_key _frida_g_desktop_app_info_has_key -#define g_desktop_app_info_launch_action _frida_g_desktop_app_info_launch_action -#define g_desktop_app_info_launch_uris_as_manager _frida_g_desktop_app_info_launch_uris_as_manager -#define g_desktop_app_info_launch_uris_as_manager_with_fds _frida_g_desktop_app_info_launch_uris_as_manager_with_fds -#define g_desktop_app_info_list_actions _frida_g_desktop_app_info_list_actions -#define g_desktop_app_info_lookup_get_default_for_uri_scheme _frida_g_desktop_app_info_lookup_get_default_for_uri_scheme -#define g_desktop_app_info_lookup_get_type _frida_g_desktop_app_info_lookup_get_type -#define g_desktop_app_info_new _frida_g_desktop_app_info_new -#define g_desktop_app_info_new_from_filename _frida_g_desktop_app_info_new_from_filename -#define g_desktop_app_info_new_from_keyfile _frida_g_desktop_app_info_new_from_keyfile -#define g_desktop_app_info_search _frida_g_desktop_app_info_search -#define g_desktop_app_info_set_desktop_env _frida_g_desktop_app_info_set_desktop_env -#define g_dgettext _frida_g_dgettext -#define g_dir_close _frida_g_dir_close -#define g_dir_make_tmp _frida_g_dir_make_tmp -#define g_dir_new_from_dirp _frida_g_dir_new_from_dirp -#define g_dir_open _frida_g_dir_open -#define g_dir_open_with_errno _frida_g_dir_open_with_errno -#define g_dir_read_name _frida_g_dir_read_name -#define g_dir_rewind _frida_g_dir_rewind -#define g_direct_equal _frida_g_direct_equal -#define g_direct_hash _frida_g_direct_hash -#define g_dngettext _frida_g_dngettext -#define g_document_portal_add_documents _frida_g_document_portal_add_documents -#define g_double_equal _frida_g_double_equal -#define g_double_hash _frida_g_double_hash -#define g_dpgettext _frida_g_dpgettext -#define g_dpgettext2 _frida_g_dpgettext2 -#define g_drive_can_eject _frida_g_drive_can_eject -#define g_drive_can_poll_for_media _frida_g_drive_can_poll_for_media -#define g_drive_can_start _frida_g_drive_can_start -#define g_drive_can_start_degraded _frida_g_drive_can_start_degraded -#define g_drive_can_stop _frida_g_drive_can_stop -#define g_drive_eject _frida_g_drive_eject -#define g_drive_eject_finish _frida_g_drive_eject_finish -#define g_drive_eject_with_operation _frida_g_drive_eject_with_operation -#define g_drive_eject_with_operation_finish _frida_g_drive_eject_with_operation_finish -#define g_drive_enumerate_identifiers _frida_g_drive_enumerate_identifiers -#define g_drive_get_icon _frida_g_drive_get_icon -#define g_drive_get_identifier _frida_g_drive_get_identifier -#define g_drive_get_name _frida_g_drive_get_name -#define g_drive_get_sort_key _frida_g_drive_get_sort_key -#define g_drive_get_start_stop_type _frida_g_drive_get_start_stop_type -#define g_drive_get_symbolic_icon _frida_g_drive_get_symbolic_icon -#define g_drive_get_type _frida_g_drive_get_type -#define g_drive_get_volumes _frida_g_drive_get_volumes -#define g_drive_has_media _frida_g_drive_has_media -#define g_drive_has_volumes _frida_g_drive_has_volumes -#define g_drive_is_media_check_automatic _frida_g_drive_is_media_check_automatic -#define g_drive_is_media_removable _frida_g_drive_is_media_removable -#define g_drive_is_removable _frida_g_drive_is_removable -#define g_drive_poll_for_media _frida_g_drive_poll_for_media -#define g_drive_poll_for_media_finish _frida_g_drive_poll_for_media_finish -#define g_drive_start _frida_g_drive_start -#define g_drive_start_finish _frida_g_drive_start_finish -#define g_drive_start_flags_get_type _frida_g_drive_start_flags_get_type -#define g_drive_start_stop_type_get_type _frida_g_drive_start_stop_type_get_type -#define g_drive_stop _frida_g_drive_stop -#define g_drive_stop_finish _frida_g_drive_stop_finish -#define g_dtls_client_connection_get_accepted_cas _frida_g_dtls_client_connection_get_accepted_cas -#define g_dtls_client_connection_get_server_identity _frida_g_dtls_client_connection_get_server_identity -#define g_dtls_client_connection_get_type _frida_g_dtls_client_connection_get_type -#define g_dtls_client_connection_get_validation_flags _frida_g_dtls_client_connection_get_validation_flags -#define g_dtls_client_connection_new _frida_g_dtls_client_connection_new -#define g_dtls_client_connection_set_server_identity _frida_g_dtls_client_connection_set_server_identity -#define g_dtls_client_connection_set_validation_flags _frida_g_dtls_client_connection_set_validation_flags -#define g_dtls_connection_close _frida_g_dtls_connection_close -#define g_dtls_connection_close_async _frida_g_dtls_connection_close_async -#define g_dtls_connection_close_finish _frida_g_dtls_connection_close_finish -#define g_dtls_connection_emit_accept_certificate _frida_g_dtls_connection_emit_accept_certificate -#define g_dtls_connection_get_certificate _frida_g_dtls_connection_get_certificate -#define g_dtls_connection_get_channel_binding_data _frida_g_dtls_connection_get_channel_binding_data -#define g_dtls_connection_get_database _frida_g_dtls_connection_get_database -#define g_dtls_connection_get_interaction _frida_g_dtls_connection_get_interaction -#define g_dtls_connection_get_negotiated_protocol _frida_g_dtls_connection_get_negotiated_protocol -#define g_dtls_connection_get_peer_certificate _frida_g_dtls_connection_get_peer_certificate -#define g_dtls_connection_get_peer_certificate_errors _frida_g_dtls_connection_get_peer_certificate_errors -#define g_dtls_connection_get_rehandshake_mode _frida_g_dtls_connection_get_rehandshake_mode -#define g_dtls_connection_get_require_close_notify _frida_g_dtls_connection_get_require_close_notify -#define g_dtls_connection_get_type _frida_g_dtls_connection_get_type -#define g_dtls_connection_handshake _frida_g_dtls_connection_handshake -#define g_dtls_connection_handshake_async _frida_g_dtls_connection_handshake_async -#define g_dtls_connection_handshake_finish _frida_g_dtls_connection_handshake_finish -#define g_dtls_connection_set_advertised_protocols _frida_g_dtls_connection_set_advertised_protocols -#define g_dtls_connection_set_certificate _frida_g_dtls_connection_set_certificate -#define g_dtls_connection_set_database _frida_g_dtls_connection_set_database -#define g_dtls_connection_set_interaction _frida_g_dtls_connection_set_interaction -#define g_dtls_connection_set_rehandshake_mode _frida_g_dtls_connection_set_rehandshake_mode -#define g_dtls_connection_set_require_close_notify _frida_g_dtls_connection_set_require_close_notify -#define g_dtls_connection_shutdown _frida_g_dtls_connection_shutdown -#define g_dtls_connection_shutdown_async _frida_g_dtls_connection_shutdown_async -#define g_dtls_connection_shutdown_finish _frida_g_dtls_connection_shutdown_finish -#define g_dtls_server_connection_get_type _frida_g_dtls_server_connection_get_type -#define g_dtls_server_connection_new _frida_g_dtls_server_connection_new -#define g_emblem_get_icon _frida_g_emblem_get_icon -#define g_emblem_get_origin _frida_g_emblem_get_origin -#define g_emblem_get_type _frida_g_emblem_get_type -#define g_emblem_new _frida_g_emblem_new -#define g_emblem_new_with_origin _frida_g_emblem_new_with_origin -#define g_emblem_origin_get_type _frida_g_emblem_origin_get_type -#define g_emblemed_icon_add_emblem _frida_g_emblemed_icon_add_emblem -#define g_emblemed_icon_clear_emblems _frida_g_emblemed_icon_clear_emblems -#define g_emblemed_icon_get_emblems _frida_g_emblemed_icon_get_emblems -#define g_emblemed_icon_get_icon _frida_g_emblemed_icon_get_icon -#define g_emblemed_icon_get_type _frida_g_emblemed_icon_get_type -#define g_emblemed_icon_new _frida_g_emblemed_icon_new -#define g_enum_complete_type_info _frida_g_enum_complete_type_info -#define g_enum_get_value _frida_g_enum_get_value -#define g_enum_get_value_by_name _frida_g_enum_get_value_by_name -#define g_enum_get_value_by_nick _frida_g_enum_get_value_by_nick -#define g_enum_register_static _frida_g_enum_register_static -#define g_enum_to_string _frida_g_enum_to_string -#define g_environ_getenv _frida_g_environ_getenv -#define g_environ_setenv _frida_g_environ_setenv -#define g_environ_unsetenv _frida_g_environ_unsetenv -#define g_error_copy _frida_g_error_copy -#define g_error_free _frida_g_error_free -#define g_error_get_type _frida_g_error_get_type -#define g_error_matches _frida_g_error_matches -#define g_error_new _frida_g_error_new -#define g_error_new_literal _frida_g_error_new_literal -#define g_error_new_valist _frida_g_error_new_valist -#define g_fdo_notification_backend_get_type _frida_g_fdo_notification_backend_get_type -#define g_file_append_to _frida_g_file_append_to -#define g_file_append_to_async _frida_g_file_append_to_async -#define g_file_append_to_finish _frida_g_file_append_to_finish -#define g_file_attribute_info_flags_get_type _frida_g_file_attribute_info_flags_get_type -#define g_file_attribute_info_list_add _frida_g_file_attribute_info_list_add -#define g_file_attribute_info_list_dup _frida_g_file_attribute_info_list_dup -#define g_file_attribute_info_list_get_type _frida_g_file_attribute_info_list_get_type -#define g_file_attribute_info_list_lookup _frida_g_file_attribute_info_list_lookup -#define g_file_attribute_info_list_new _frida_g_file_attribute_info_list_new -#define g_file_attribute_info_list_ref _frida_g_file_attribute_info_list_ref -#define g_file_attribute_info_list_unref _frida_g_file_attribute_info_list_unref -#define g_file_attribute_matcher_enumerate_namespace _frida_g_file_attribute_matcher_enumerate_namespace -#define g_file_attribute_matcher_enumerate_next _frida_g_file_attribute_matcher_enumerate_next -#define g_file_attribute_matcher_get_type _frida_g_file_attribute_matcher_get_type -#define g_file_attribute_matcher_matches _frida_g_file_attribute_matcher_matches -#define g_file_attribute_matcher_matches_only _frida_g_file_attribute_matcher_matches_only -#define g_file_attribute_matcher_new _frida_g_file_attribute_matcher_new -#define g_file_attribute_matcher_ref _frida_g_file_attribute_matcher_ref -#define g_file_attribute_matcher_subtract _frida_g_file_attribute_matcher_subtract -#define g_file_attribute_matcher_to_string _frida_g_file_attribute_matcher_to_string -#define g_file_attribute_matcher_unref _frida_g_file_attribute_matcher_unref -#define g_file_attribute_status_get_type _frida_g_file_attribute_status_get_type -#define g_file_attribute_type_get_type _frida_g_file_attribute_type_get_type -#define g_file_build_attribute_list_for_copy _frida_g_file_build_attribute_list_for_copy -#define g_file_copy _frida_g_file_copy -#define g_file_copy_async _frida_g_file_copy_async -#define g_file_copy_attributes _frida_g_file_copy_attributes -#define g_file_copy_finish _frida_g_file_copy_finish -#define g_file_copy_flags_get_type _frida_g_file_copy_flags_get_type -#define g_file_create _frida_g_file_create -#define g_file_create_async _frida_g_file_create_async -#define g_file_create_finish _frida_g_file_create_finish -#define g_file_create_flags_get_type _frida_g_file_create_flags_get_type -#define g_file_create_readwrite _frida_g_file_create_readwrite -#define g_file_create_readwrite_async _frida_g_file_create_readwrite_async -#define g_file_create_readwrite_finish _frida_g_file_create_readwrite_finish -#define g_file_delete _frida_g_file_delete -#define g_file_delete_async _frida_g_file_delete_async -#define g_file_delete_finish _frida_g_file_delete_finish -#define g_file_descriptor_based_get_fd _frida_g_file_descriptor_based_get_fd -#define g_file_descriptor_based_get_type _frida_g_file_descriptor_based_get_type -#define g_file_dup _frida_g_file_dup -#define g_file_eject_mountable _frida_g_file_eject_mountable -#define g_file_eject_mountable_finish _frida_g_file_eject_mountable_finish -#define g_file_eject_mountable_with_operation _frida_g_file_eject_mountable_with_operation -#define g_file_eject_mountable_with_operation_finish _frida_g_file_eject_mountable_with_operation_finish -#define g_file_enumerate_children _frida_g_file_enumerate_children -#define g_file_enumerate_children_async _frida_g_file_enumerate_children_async -#define g_file_enumerate_children_finish _frida_g_file_enumerate_children_finish -#define g_file_enumerator_close _frida_g_file_enumerator_close -#define g_file_enumerator_close_async _frida_g_file_enumerator_close_async -#define g_file_enumerator_close_finish _frida_g_file_enumerator_close_finish -#define g_file_enumerator_get_child _frida_g_file_enumerator_get_child -#define g_file_enumerator_get_container _frida_g_file_enumerator_get_container -#define g_file_enumerator_get_type _frida_g_file_enumerator_get_type -#define g_file_enumerator_has_pending _frida_g_file_enumerator_has_pending -#define g_file_enumerator_is_closed _frida_g_file_enumerator_is_closed -#define g_file_enumerator_iterate _frida_g_file_enumerator_iterate -#define g_file_enumerator_next_file _frida_g_file_enumerator_next_file -#define g_file_enumerator_next_files_async _frida_g_file_enumerator_next_files_async -#define g_file_enumerator_next_files_finish _frida_g_file_enumerator_next_files_finish -#define g_file_enumerator_set_pending _frida_g_file_enumerator_set_pending -#define g_file_equal _frida_g_file_equal -#define g_file_error_from_errno _frida_g_file_error_from_errno -#define g_file_error_quark _frida_g_file_error_quark -#define g_file_find_enclosing_mount _frida_g_file_find_enclosing_mount -#define g_file_find_enclosing_mount_async _frida_g_file_find_enclosing_mount_async -#define g_file_find_enclosing_mount_finish _frida_g_file_find_enclosing_mount_finish -#define g_file_get_basename _frida_g_file_get_basename -#define g_file_get_child _frida_g_file_get_child -#define g_file_get_child_for_display_name _frida_g_file_get_child_for_display_name -#define g_file_get_contents _frida_g_file_get_contents -#define g_file_get_parent _frida_g_file_get_parent -#define g_file_get_parse_name _frida_g_file_get_parse_name -#define g_file_get_path _frida_g_file_get_path -#define g_file_get_relative_path _frida_g_file_get_relative_path -#define g_file_get_type _frida_g_file_get_type -#define g_file_get_uri _frida_g_file_get_uri -#define g_file_get_uri_scheme _frida_g_file_get_uri_scheme -#define g_file_has_parent _frida_g_file_has_parent -#define g_file_has_prefix _frida_g_file_has_prefix -#define g_file_has_uri_scheme _frida_g_file_has_uri_scheme -#define g_file_hash _frida_g_file_hash -#define g_file_icon_get_file _frida_g_file_icon_get_file -#define g_file_icon_get_type _frida_g_file_icon_get_type -#define g_file_icon_new _frida_g_file_icon_new -#define g_file_info_clear_status _frida_g_file_info_clear_status -#define g_file_info_copy_into _frida_g_file_info_copy_into -#define g_file_info_dup _frida_g_file_info_dup -#define g_file_info_get_attribute_as_string _frida_g_file_info_get_attribute_as_string -#define g_file_info_get_attribute_boolean _frida_g_file_info_get_attribute_boolean -#define g_file_info_get_attribute_byte_string _frida_g_file_info_get_attribute_byte_string -#define g_file_info_get_attribute_data _frida_g_file_info_get_attribute_data -#define g_file_info_get_attribute_int32 _frida_g_file_info_get_attribute_int32 -#define g_file_info_get_attribute_int64 _frida_g_file_info_get_attribute_int64 -#define g_file_info_get_attribute_object _frida_g_file_info_get_attribute_object -#define g_file_info_get_attribute_status _frida_g_file_info_get_attribute_status -#define g_file_info_get_attribute_string _frida_g_file_info_get_attribute_string -#define g_file_info_get_attribute_stringv _frida_g_file_info_get_attribute_stringv -#define g_file_info_get_attribute_type _frida_g_file_info_get_attribute_type -#define g_file_info_get_attribute_uint32 _frida_g_file_info_get_attribute_uint32 -#define g_file_info_get_attribute_uint64 _frida_g_file_info_get_attribute_uint64 -#define g_file_info_get_content_type _frida_g_file_info_get_content_type -#define g_file_info_get_deletion_date _frida_g_file_info_get_deletion_date -#define g_file_info_get_display_name _frida_g_file_info_get_display_name -#define g_file_info_get_edit_name _frida_g_file_info_get_edit_name -#define g_file_info_get_etag _frida_g_file_info_get_etag -#define g_file_info_get_file_type _frida_g_file_info_get_file_type -#define g_file_info_get_icon _frida_g_file_info_get_icon -#define g_file_info_get_is_backup _frida_g_file_info_get_is_backup -#define g_file_info_get_is_hidden _frida_g_file_info_get_is_hidden -#define g_file_info_get_is_symlink _frida_g_file_info_get_is_symlink -#define g_file_info_get_modification_date_time _frida_g_file_info_get_modification_date_time -#define g_file_info_get_modification_time _frida_g_file_info_get_modification_time -#define g_file_info_get_name _frida_g_file_info_get_name -#define g_file_info_get_size _frida_g_file_info_get_size -#define g_file_info_get_sort_order _frida_g_file_info_get_sort_order -#define g_file_info_get_symbolic_icon _frida_g_file_info_get_symbolic_icon -#define g_file_info_get_symlink_target _frida_g_file_info_get_symlink_target -#define g_file_info_get_type _frida_g_file_info_get_type -#define g_file_info_has_attribute _frida_g_file_info_has_attribute -#define g_file_info_has_namespace _frida_g_file_info_has_namespace -#define g_file_info_list_attributes _frida_g_file_info_list_attributes -#define g_file_info_new _frida_g_file_info_new -#define g_file_info_remove_attribute _frida_g_file_info_remove_attribute -#define g_file_info_set_attribute _frida_g_file_info_set_attribute -#define g_file_info_set_attribute_boolean _frida_g_file_info_set_attribute_boolean -#define g_file_info_set_attribute_byte_string _frida_g_file_info_set_attribute_byte_string -#define g_file_info_set_attribute_int32 _frida_g_file_info_set_attribute_int32 -#define g_file_info_set_attribute_int64 _frida_g_file_info_set_attribute_int64 -#define g_file_info_set_attribute_mask _frida_g_file_info_set_attribute_mask -#define g_file_info_set_attribute_object _frida_g_file_info_set_attribute_object -#define g_file_info_set_attribute_status _frida_g_file_info_set_attribute_status -#define g_file_info_set_attribute_string _frida_g_file_info_set_attribute_string -#define g_file_info_set_attribute_stringv _frida_g_file_info_set_attribute_stringv -#define g_file_info_set_attribute_uint32 _frida_g_file_info_set_attribute_uint32 -#define g_file_info_set_attribute_uint64 _frida_g_file_info_set_attribute_uint64 -#define g_file_info_set_content_type _frida_g_file_info_set_content_type -#define g_file_info_set_display_name _frida_g_file_info_set_display_name -#define g_file_info_set_edit_name _frida_g_file_info_set_edit_name -#define g_file_info_set_file_type _frida_g_file_info_set_file_type -#define g_file_info_set_icon _frida_g_file_info_set_icon -#define g_file_info_set_is_hidden _frida_g_file_info_set_is_hidden -#define g_file_info_set_is_symlink _frida_g_file_info_set_is_symlink -#define g_file_info_set_modification_date_time _frida_g_file_info_set_modification_date_time -#define g_file_info_set_modification_time _frida_g_file_info_set_modification_time -#define g_file_info_set_name _frida_g_file_info_set_name -#define g_file_info_set_size _frida_g_file_info_set_size -#define g_file_info_set_sort_order _frida_g_file_info_set_sort_order -#define g_file_info_set_symbolic_icon _frida_g_file_info_set_symbolic_icon -#define g_file_info_set_symlink_target _frida_g_file_info_set_symlink_target -#define g_file_info_unset_attribute_mask _frida_g_file_info_unset_attribute_mask -#define g_file_input_stream_get_type _frida_g_file_input_stream_get_type -#define g_file_input_stream_query_info _frida_g_file_input_stream_query_info -#define g_file_input_stream_query_info_async _frida_g_file_input_stream_query_info_async -#define g_file_input_stream_query_info_finish _frida_g_file_input_stream_query_info_finish -#define g_file_io_stream_get_etag _frida_g_file_io_stream_get_etag -#define g_file_io_stream_get_type _frida_g_file_io_stream_get_type -#define g_file_io_stream_query_info _frida_g_file_io_stream_query_info -#define g_file_io_stream_query_info_async _frida_g_file_io_stream_query_info_async -#define g_file_io_stream_query_info_finish _frida_g_file_io_stream_query_info_finish -#define g_file_is_native _frida_g_file_is_native -#define g_file_load_bytes _frida_g_file_load_bytes -#define g_file_load_bytes_async _frida_g_file_load_bytes_async -#define g_file_load_bytes_finish _frida_g_file_load_bytes_finish -#define g_file_load_contents _frida_g_file_load_contents -#define g_file_load_contents_async _frida_g_file_load_contents_async -#define g_file_load_contents_finish _frida_g_file_load_contents_finish -#define g_file_load_partial_contents_async _frida_g_file_load_partial_contents_async -#define g_file_load_partial_contents_finish _frida_g_file_load_partial_contents_finish -#define g_file_make_directory _frida_g_file_make_directory -#define g_file_make_directory_async _frida_g_file_make_directory_async -#define g_file_make_directory_finish _frida_g_file_make_directory_finish -#define g_file_make_directory_with_parents _frida_g_file_make_directory_with_parents -#define g_file_make_symbolic_link _frida_g_file_make_symbolic_link -#define g_file_measure_disk_usage _frida_g_file_measure_disk_usage -#define g_file_measure_disk_usage_async _frida_g_file_measure_disk_usage_async -#define g_file_measure_disk_usage_finish _frida_g_file_measure_disk_usage_finish -#define g_file_measure_flags_get_type _frida_g_file_measure_flags_get_type -#define g_file_monitor _frida_g_file_monitor -#define g_file_monitor_cancel _frida_g_file_monitor_cancel -#define g_file_monitor_directory _frida_g_file_monitor_directory -#define g_file_monitor_emit_event _frida_g_file_monitor_emit_event -#define g_file_monitor_event_get_type _frida_g_file_monitor_event_get_type -#define g_file_monitor_file _frida_g_file_monitor_file -#define g_file_monitor_flags_get_type _frida_g_file_monitor_flags_get_type -#define g_file_monitor_get_type _frida_g_file_monitor_get_type -#define g_file_monitor_is_cancelled _frida_g_file_monitor_is_cancelled -#define g_file_monitor_set_rate_limit _frida_g_file_monitor_set_rate_limit -#define g_file_monitor_source_handle_event _frida_g_file_monitor_source_handle_event -#define g_file_mount_enclosing_volume _frida_g_file_mount_enclosing_volume -#define g_file_mount_enclosing_volume_finish _frida_g_file_mount_enclosing_volume_finish -#define g_file_mount_mountable _frida_g_file_mount_mountable -#define g_file_mount_mountable_finish _frida_g_file_mount_mountable_finish -#define g_file_move _frida_g_file_move -#define g_file_new_build_filename _frida_g_file_new_build_filename -#define g_file_new_for_commandline_arg _frida_g_file_new_for_commandline_arg -#define g_file_new_for_commandline_arg_and_cwd _frida_g_file_new_for_commandline_arg_and_cwd -#define g_file_new_for_path _frida_g_file_new_for_path -#define g_file_new_for_uri _frida_g_file_new_for_uri -#define g_file_new_tmp _frida_g_file_new_tmp -#define g_file_open_readwrite _frida_g_file_open_readwrite -#define g_file_open_readwrite_async _frida_g_file_open_readwrite_async -#define g_file_open_readwrite_finish _frida_g_file_open_readwrite_finish -#define g_file_open_tmp _frida_g_file_open_tmp -#define g_file_output_stream_get_etag _frida_g_file_output_stream_get_etag -#define g_file_output_stream_get_type _frida_g_file_output_stream_get_type -#define g_file_output_stream_query_info _frida_g_file_output_stream_query_info -#define g_file_output_stream_query_info_async _frida_g_file_output_stream_query_info_async -#define g_file_output_stream_query_info_finish _frida_g_file_output_stream_query_info_finish -#define g_file_parse_name _frida_g_file_parse_name -#define g_file_peek_path _frida_g_file_peek_path -#define g_file_poll_mountable _frida_g_file_poll_mountable -#define g_file_poll_mountable_finish _frida_g_file_poll_mountable_finish -#define g_file_query_default_handler _frida_g_file_query_default_handler -#define g_file_query_default_handler_async _frida_g_file_query_default_handler_async -#define g_file_query_default_handler_finish _frida_g_file_query_default_handler_finish -#define g_file_query_exists _frida_g_file_query_exists -#define g_file_query_file_type _frida_g_file_query_file_type -#define g_file_query_filesystem_info _frida_g_file_query_filesystem_info -#define g_file_query_filesystem_info_async _frida_g_file_query_filesystem_info_async -#define g_file_query_filesystem_info_finish _frida_g_file_query_filesystem_info_finish -#define g_file_query_info _frida_g_file_query_info -#define g_file_query_info_async _frida_g_file_query_info_async -#define g_file_query_info_finish _frida_g_file_query_info_finish -#define g_file_query_info_flags_get_type _frida_g_file_query_info_flags_get_type -#define g_file_query_settable_attributes _frida_g_file_query_settable_attributes -#define g_file_query_writable_namespaces _frida_g_file_query_writable_namespaces -#define g_file_read _frida_g_file_read -#define g_file_read_async _frida_g_file_read_async -#define g_file_read_finish _frida_g_file_read_finish -#define g_file_read_link _frida_g_file_read_link -#define g_file_replace _frida_g_file_replace -#define g_file_replace_async _frida_g_file_replace_async -#define g_file_replace_contents _frida_g_file_replace_contents -#define g_file_replace_contents_async _frida_g_file_replace_contents_async -#define g_file_replace_contents_bytes_async _frida_g_file_replace_contents_bytes_async -#define g_file_replace_contents_finish _frida_g_file_replace_contents_finish -#define g_file_replace_finish _frida_g_file_replace_finish -#define g_file_replace_readwrite _frida_g_file_replace_readwrite -#define g_file_replace_readwrite_async _frida_g_file_replace_readwrite_async -#define g_file_replace_readwrite_finish _frida_g_file_replace_readwrite_finish -#define g_file_resolve_relative_path _frida_g_file_resolve_relative_path -#define g_file_set_attribute _frida_g_file_set_attribute -#define g_file_set_attribute_byte_string _frida_g_file_set_attribute_byte_string -#define g_file_set_attribute_int32 _frida_g_file_set_attribute_int32 -#define g_file_set_attribute_int64 _frida_g_file_set_attribute_int64 -#define g_file_set_attribute_string _frida_g_file_set_attribute_string -#define g_file_set_attribute_uint32 _frida_g_file_set_attribute_uint32 -#define g_file_set_attribute_uint64 _frida_g_file_set_attribute_uint64 -#define g_file_set_attributes_async _frida_g_file_set_attributes_async -#define g_file_set_attributes_finish _frida_g_file_set_attributes_finish -#define g_file_set_attributes_from_info _frida_g_file_set_attributes_from_info -#define g_file_set_contents _frida_g_file_set_contents -#define g_file_set_contents_full _frida_g_file_set_contents_full -#define g_file_set_display_name _frida_g_file_set_display_name -#define g_file_set_display_name_async _frida_g_file_set_display_name_async -#define g_file_set_display_name_finish _frida_g_file_set_display_name_finish -#define g_file_start_mountable _frida_g_file_start_mountable -#define g_file_start_mountable_finish _frida_g_file_start_mountable_finish -#define g_file_stop_mountable _frida_g_file_stop_mountable -#define g_file_stop_mountable_finish _frida_g_file_stop_mountable_finish -#define g_file_supports_thread_contexts _frida_g_file_supports_thread_contexts -#define g_file_test _frida_g_file_test -#define g_file_trash _frida_g_file_trash -#define g_file_trash_async _frida_g_file_trash_async -#define g_file_trash_finish _frida_g_file_trash_finish -#define g_file_type_get_type _frida_g_file_type_get_type -#define g_file_unmount_mountable _frida_g_file_unmount_mountable -#define g_file_unmount_mountable_finish _frida_g_file_unmount_mountable_finish -#define g_file_unmount_mountable_with_operation _frida_g_file_unmount_mountable_with_operation -#define g_file_unmount_mountable_with_operation_finish _frida_g_file_unmount_mountable_with_operation_finish -#define g_filename_completer_get_completion_suffix _frida_g_filename_completer_get_completion_suffix -#define g_filename_completer_get_completions _frida_g_filename_completer_get_completions -#define g_filename_completer_get_type _frida_g_filename_completer_get_type -#define g_filename_completer_new _frida_g_filename_completer_new -#define g_filename_completer_set_dirs_only _frida_g_filename_completer_set_dirs_only -#define g_filename_display_basename _frida_g_filename_display_basename -#define g_filename_display_name _frida_g_filename_display_name -#define g_filename_from_uri _frida_g_filename_from_uri -#define g_filename_from_utf8 _frida_g_filename_from_utf8 -#define g_filename_to_uri _frida_g_filename_to_uri -#define g_filename_to_utf8 _frida_g_filename_to_utf8 -#define g_filesystem_preview_type_get_type _frida_g_filesystem_preview_type_get_type -#define g_filter_input_stream_get_base_stream _frida_g_filter_input_stream_get_base_stream -#define g_filter_input_stream_get_close_base_stream _frida_g_filter_input_stream_get_close_base_stream -#define g_filter_input_stream_get_type _frida_g_filter_input_stream_get_type -#define g_filter_input_stream_set_close_base_stream _frida_g_filter_input_stream_set_close_base_stream -#define g_filter_output_stream_get_base_stream _frida_g_filter_output_stream_get_base_stream -#define g_filter_output_stream_get_close_base_stream _frida_g_filter_output_stream_get_close_base_stream -#define g_filter_output_stream_get_type _frida_g_filter_output_stream_get_type -#define g_filter_output_stream_set_close_base_stream _frida_g_filter_output_stream_set_close_base_stream -#define g_find_program_in_path _frida_g_find_program_in_path -#define g_flags_complete_type_info _frida_g_flags_complete_type_info -#define g_flags_get_first_value _frida_g_flags_get_first_value -#define g_flags_get_value_by_name _frida_g_flags_get_value_by_name -#define g_flags_get_value_by_nick _frida_g_flags_get_value_by_nick -#define g_flags_register_static _frida_g_flags_register_static -#define g_flags_to_string _frida_g_flags_to_string -#define g_fopen _frida_g_fopen -#define g_format_size _frida_g_format_size -#define g_format_size_for_display _frida_g_format_size_for_display -#define g_format_size_full _frida_g_format_size_full -#define g_fprintf _frida_g_fprintf -#define g_free _frida_g_free -#define g_freopen _frida_g_freopen -#define g_fsync _frida_g_fsync -#define g_get_application_name _frida_g_get_application_name -#define g_get_charset _frida_g_get_charset -#define g_get_codeset _frida_g_get_codeset -#define g_get_console_charset _frida_g_get_console_charset -#define g_get_current_dir _frida_g_get_current_dir -#define g_get_current_time _frida_g_get_current_time -#define g_get_environ _frida_g_get_environ -#define g_get_filename_charsets _frida_g_get_filename_charsets -#define g_get_home_dir _frida_g_get_home_dir -#define g_get_host_name _frida_g_get_host_name -#define g_get_language_names _frida_g_get_language_names -#define g_get_language_names_with_category _frida_g_get_language_names_with_category -#define g_get_locale_variants _frida_g_get_locale_variants -#define g_get_monotonic_time _frida_g_get_monotonic_time -#define g_get_num_processors _frida_g_get_num_processors -#define g_get_os_info _frida_g_get_os_info -#define g_get_prgname _frida_g_get_prgname -#define g_get_real_name _frida_g_get_real_name -#define g_get_real_time _frida_g_get_real_time -#define g_get_system_config_dirs _frida_g_get_system_config_dirs -#define g_get_system_data_dirs _frida_g_get_system_data_dirs -#define g_get_tmp_dir _frida_g_get_tmp_dir -#define g_get_user_cache_dir _frida_g_get_user_cache_dir -#define g_get_user_config_dir _frida_g_get_user_config_dir -#define g_get_user_data_dir _frida_g_get_user_data_dir -#define g_get_user_name _frida_g_get_user_name -#define g_get_user_runtime_dir _frida_g_get_user_runtime_dir -#define g_get_user_special_dir _frida_g_get_user_special_dir -#define g_get_worker_context _frida_g_get_worker_context -#define g_getenv _frida_g_getenv -#define g_gstring_get_type _frida_g_gstring_get_type -#define g_gtk_notification_backend_get_type _frida_g_gtk_notification_backend_get_type -#define g_gtype_get_type _frida_g_gtype_get_type -#define g_hash_table_add _frida_g_hash_table_add -#define g_hash_table_contains _frida_g_hash_table_contains -#define g_hash_table_destroy _frida_g_hash_table_destroy -#define g_hash_table_find _frida_g_hash_table_find -#define g_hash_table_foreach _frida_g_hash_table_foreach -#define g_hash_table_foreach_remove _frida_g_hash_table_foreach_remove -#define g_hash_table_foreach_steal _frida_g_hash_table_foreach_steal -#define g_hash_table_get_keys _frida_g_hash_table_get_keys -#define g_hash_table_get_keys_as_array _frida_g_hash_table_get_keys_as_array -#define g_hash_table_get_type _frida_g_hash_table_get_type -#define g_hash_table_get_values _frida_g_hash_table_get_values -#define g_hash_table_insert _frida_g_hash_table_insert -#define g_hash_table_iter_get_hash_table _frida_g_hash_table_iter_get_hash_table -#define g_hash_table_iter_init _frida_g_hash_table_iter_init -#define g_hash_table_iter_next _frida_g_hash_table_iter_next -#define g_hash_table_iter_remove _frida_g_hash_table_iter_remove -#define g_hash_table_iter_replace _frida_g_hash_table_iter_replace -#define g_hash_table_iter_steal _frida_g_hash_table_iter_steal -#define g_hash_table_lookup _frida_g_hash_table_lookup -#define g_hash_table_lookup_extended _frida_g_hash_table_lookup_extended -#define g_hash_table_new _frida_g_hash_table_new -#define g_hash_table_new_full _frida_g_hash_table_new_full -#define g_hash_table_ref _frida_g_hash_table_ref -#define g_hash_table_remove _frida_g_hash_table_remove -#define g_hash_table_remove_all _frida_g_hash_table_remove_all -#define g_hash_table_replace _frida_g_hash_table_replace -#define g_hash_table_size _frida_g_hash_table_size -#define g_hash_table_steal _frida_g_hash_table_steal -#define g_hash_table_steal_all _frida_g_hash_table_steal_all -#define g_hash_table_steal_extended _frida_g_hash_table_steal_extended -#define g_hash_table_unref _frida_g_hash_table_unref -#define g_hmac_copy _frida_g_hmac_copy -#define g_hmac_get_digest _frida_g_hmac_get_digest -#define g_hmac_get_string _frida_g_hmac_get_string -#define g_hmac_new _frida_g_hmac_new -#define g_hmac_ref _frida_g_hmac_ref -#define g_hmac_unref _frida_g_hmac_unref -#define g_hmac_update _frida_g_hmac_update -#define g_hook_alloc _frida_g_hook_alloc -#define g_hook_compare_ids _frida_g_hook_compare_ids -#define g_hook_destroy _frida_g_hook_destroy -#define g_hook_destroy_link _frida_g_hook_destroy_link -#define g_hook_find _frida_g_hook_find -#define g_hook_find_data _frida_g_hook_find_data -#define g_hook_find_func _frida_g_hook_find_func -#define g_hook_find_func_data _frida_g_hook_find_func_data -#define g_hook_first_valid _frida_g_hook_first_valid -#define g_hook_free _frida_g_hook_free -#define g_hook_get _frida_g_hook_get -#define g_hook_insert_before _frida_g_hook_insert_before -#define g_hook_insert_sorted _frida_g_hook_insert_sorted -#define g_hook_list_clear _frida_g_hook_list_clear -#define g_hook_list_init _frida_g_hook_list_init -#define g_hook_list_invoke _frida_g_hook_list_invoke -#define g_hook_list_invoke_check _frida_g_hook_list_invoke_check -#define g_hook_list_marshal _frida_g_hook_list_marshal -#define g_hook_list_marshal_check _frida_g_hook_list_marshal_check -#define g_hook_next_valid _frida_g_hook_next_valid -#define g_hook_prepend _frida_g_hook_prepend -#define g_hook_ref _frida_g_hook_ref -#define g_hook_unref _frida_g_hook_unref -#define g_hostname_is_ascii_encoded _frida_g_hostname_is_ascii_encoded -#define g_hostname_is_ip_address _frida_g_hostname_is_ip_address -#define g_hostname_is_non_ascii _frida_g_hostname_is_non_ascii -#define g_hostname_to_ascii _frida_g_hostname_to_ascii -#define g_hostname_to_unicode _frida_g_hostname_to_unicode -#define g_icon_deserialize _frida_g_icon_deserialize -#define g_icon_equal _frida_g_icon_equal -#define g_icon_get_type _frida_g_icon_get_type -#define g_icon_hash _frida_g_icon_hash -#define g_icon_new_for_string _frida_g_icon_new_for_string -#define g_icon_serialize _frida_g_icon_serialize -#define g_icon_to_string _frida_g_icon_to_string -#define g_iconv _frida_g_iconv -#define g_iconv_close _frida_g_iconv_close -#define g_iconv_open _frida_g_iconv_open -#define g_idle_add _frida_g_idle_add -#define g_idle_add_full _frida_g_idle_add_full -#define g_idle_funcs _frida_g_idle_funcs -#define g_idle_remove_by_data _frida_g_idle_remove_by_data -#define g_idle_source_new _frida_g_idle_source_new -#define g_inet_address_equal _frida_g_inet_address_equal -#define g_inet_address_get_family _frida_g_inet_address_get_family -#define g_inet_address_get_is_any _frida_g_inet_address_get_is_any -#define g_inet_address_get_is_link_local _frida_g_inet_address_get_is_link_local -#define g_inet_address_get_is_loopback _frida_g_inet_address_get_is_loopback -#define g_inet_address_get_is_mc_global _frida_g_inet_address_get_is_mc_global -#define g_inet_address_get_is_mc_link_local _frida_g_inet_address_get_is_mc_link_local -#define g_inet_address_get_is_mc_node_local _frida_g_inet_address_get_is_mc_node_local -#define g_inet_address_get_is_mc_org_local _frida_g_inet_address_get_is_mc_org_local -#define g_inet_address_get_is_mc_site_local _frida_g_inet_address_get_is_mc_site_local -#define g_inet_address_get_is_multicast _frida_g_inet_address_get_is_multicast -#define g_inet_address_get_is_site_local _frida_g_inet_address_get_is_site_local -#define g_inet_address_get_native_size _frida_g_inet_address_get_native_size -#define g_inet_address_get_type _frida_g_inet_address_get_type -#define g_inet_address_mask_equal _frida_g_inet_address_mask_equal -#define g_inet_address_mask_get_address _frida_g_inet_address_mask_get_address -#define g_inet_address_mask_get_family _frida_g_inet_address_mask_get_family -#define g_inet_address_mask_get_length _frida_g_inet_address_mask_get_length -#define g_inet_address_mask_get_type _frida_g_inet_address_mask_get_type -#define g_inet_address_mask_matches _frida_g_inet_address_mask_matches -#define g_inet_address_mask_new _frida_g_inet_address_mask_new -#define g_inet_address_mask_new_from_string _frida_g_inet_address_mask_new_from_string -#define g_inet_address_mask_to_string _frida_g_inet_address_mask_to_string -#define g_inet_address_new_any _frida_g_inet_address_new_any -#define g_inet_address_new_from_bytes _frida_g_inet_address_new_from_bytes -#define g_inet_address_new_from_string _frida_g_inet_address_new_from_string -#define g_inet_address_new_loopback _frida_g_inet_address_new_loopback -#define g_inet_address_to_bytes _frida_g_inet_address_to_bytes -#define g_inet_address_to_string _frida_g_inet_address_to_string -#define g_inet_socket_address_get_address _frida_g_inet_socket_address_get_address -#define g_inet_socket_address_get_flowinfo _frida_g_inet_socket_address_get_flowinfo -#define g_inet_socket_address_get_port _frida_g_inet_socket_address_get_port -#define g_inet_socket_address_get_scope_id _frida_g_inet_socket_address_get_scope_id -#define g_inet_socket_address_get_type _frida_g_inet_socket_address_get_type -#define g_inet_socket_address_new _frida_g_inet_socket_address_new -#define g_inet_socket_address_new_from_string _frida_g_inet_socket_address_new_from_string -#define g_initable_get_type _frida_g_initable_get_type -#define g_initable_init _frida_g_initable_init -#define g_initable_new _frida_g_initable_new -#define g_initable_new_valist _frida_g_initable_new_valist -#define g_initable_newv _frida_g_initable_newv -#define g_initially_unowned_get_type _frida_g_initially_unowned_get_type -#define g_inotify_file_monitor_get_type _frida_g_inotify_file_monitor_get_type -#define g_input_stream_async_close_is_via_threads _frida_g_input_stream_async_close_is_via_threads -#define g_input_stream_async_read_is_via_threads _frida_g_input_stream_async_read_is_via_threads -#define g_input_stream_clear_pending _frida_g_input_stream_clear_pending -#define g_input_stream_close _frida_g_input_stream_close -#define g_input_stream_close_async _frida_g_input_stream_close_async -#define g_input_stream_close_finish _frida_g_input_stream_close_finish -#define g_input_stream_get_type _frida_g_input_stream_get_type -#define g_input_stream_has_pending _frida_g_input_stream_has_pending -#define g_input_stream_is_closed _frida_g_input_stream_is_closed -#define g_input_stream_read _frida_g_input_stream_read -#define g_input_stream_read_all _frida_g_input_stream_read_all -#define g_input_stream_read_all_async _frida_g_input_stream_read_all_async -#define g_input_stream_read_all_finish _frida_g_input_stream_read_all_finish -#define g_input_stream_read_async _frida_g_input_stream_read_async -#define g_input_stream_read_bytes _frida_g_input_stream_read_bytes -#define g_input_stream_read_bytes_async _frida_g_input_stream_read_bytes_async -#define g_input_stream_read_bytes_finish _frida_g_input_stream_read_bytes_finish -#define g_input_stream_read_finish _frida_g_input_stream_read_finish -#define g_input_stream_set_pending _frida_g_input_stream_set_pending -#define g_input_stream_skip _frida_g_input_stream_skip -#define g_input_stream_skip_async _frida_g_input_stream_skip_async -#define g_input_stream_skip_finish _frida_g_input_stream_skip_finish -#define g_int64_equal _frida_g_int64_equal -#define g_int64_hash _frida_g_int64_hash -#define g_int_equal _frida_g_int_equal -#define g_int_hash _frida_g_int_hash -#define g_intern_static_string _frida_g_intern_static_string -#define g_intern_string _frida_g_intern_string -#define g_io_add_watch _frida_g_io_add_watch -#define g_io_add_watch_full _frida_g_io_add_watch_full -#define g_io_channel_close _frida_g_io_channel_close -#define g_io_channel_error_from_errno _frida_g_io_channel_error_from_errno -#define g_io_channel_error_quark _frida_g_io_channel_error_quark -#define g_io_channel_flush _frida_g_io_channel_flush -#define g_io_channel_get_buffer_condition _frida_g_io_channel_get_buffer_condition -#define g_io_channel_get_buffer_size _frida_g_io_channel_get_buffer_size -#define g_io_channel_get_buffered _frida_g_io_channel_get_buffered -#define g_io_channel_get_close_on_unref _frida_g_io_channel_get_close_on_unref -#define g_io_channel_get_encoding _frida_g_io_channel_get_encoding -#define g_io_channel_get_flags _frida_g_io_channel_get_flags -#define g_io_channel_get_line_term _frida_g_io_channel_get_line_term -#define g_io_channel_get_type _frida_g_io_channel_get_type -#define g_io_channel_init _frida_g_io_channel_init -#define g_io_channel_new_file _frida_g_io_channel_new_file -#define g_io_channel_read _frida_g_io_channel_read -#define g_io_channel_read_chars _frida_g_io_channel_read_chars -#define g_io_channel_read_line _frida_g_io_channel_read_line -#define g_io_channel_read_line_string _frida_g_io_channel_read_line_string -#define g_io_channel_read_to_end _frida_g_io_channel_read_to_end -#define g_io_channel_read_unichar _frida_g_io_channel_read_unichar -#define g_io_channel_ref _frida_g_io_channel_ref -#define g_io_channel_seek _frida_g_io_channel_seek -#define g_io_channel_seek_position _frida_g_io_channel_seek_position -#define g_io_channel_set_buffer_size _frida_g_io_channel_set_buffer_size -#define g_io_channel_set_buffered _frida_g_io_channel_set_buffered -#define g_io_channel_set_close_on_unref _frida_g_io_channel_set_close_on_unref -#define g_io_channel_set_encoding _frida_g_io_channel_set_encoding -#define g_io_channel_set_flags _frida_g_io_channel_set_flags -#define g_io_channel_set_line_term _frida_g_io_channel_set_line_term -#define g_io_channel_shutdown _frida_g_io_channel_shutdown -#define g_io_channel_unix_get_fd _frida_g_io_channel_unix_get_fd -#define g_io_channel_unix_new _frida_g_io_channel_unix_new -#define g_io_channel_unref _frida_g_io_channel_unref -#define g_io_channel_write _frida_g_io_channel_write -#define g_io_channel_write_chars _frida_g_io_channel_write_chars -#define g_io_channel_write_unichar _frida_g_io_channel_write_unichar -#define g_io_condition_get_type _frida_g_io_condition_get_type -#define g_io_create_watch _frida_g_io_create_watch -#define g_io_error_enum_get_type _frida_g_io_error_enum_get_type -#define g_io_error_from_errno _frida_g_io_error_from_errno -#define g_io_error_quark _frida_g_io_error_quark -#define g_io_extension_get_name _frida_g_io_extension_get_name -#define g_io_extension_get_priority _frida_g_io_extension_get_priority -#define g_io_extension_get_type _frida_g_io_extension_get_type -#define g_io_extension_point_get_extension_by_name _frida_g_io_extension_point_get_extension_by_name -#define g_io_extension_point_get_extensions _frida_g_io_extension_point_get_extensions -#define g_io_extension_point_get_required_type _frida_g_io_extension_point_get_required_type -#define g_io_extension_point_implement _frida_g_io_extension_point_implement -#define g_io_extension_point_lookup _frida_g_io_extension_point_lookup -#define g_io_extension_point_register _frida_g_io_extension_point_register -#define g_io_extension_point_set_required_type _frida_g_io_extension_point_set_required_type -#define g_io_extension_ref_class _frida_g_io_extension_ref_class -#define g_io_module_get_type _frida_g_io_module_get_type -#define g_io_module_new _frida_g_io_module_new -#define g_io_module_scope_block _frida_g_io_module_scope_block -#define g_io_module_scope_flags_get_type _frida_g_io_module_scope_flags_get_type -#define g_io_module_scope_free _frida_g_io_module_scope_free -#define g_io_module_scope_new _frida_g_io_module_scope_new -#define g_io_modules_load_all_in_directory _frida_g_io_modules_load_all_in_directory -#define g_io_modules_load_all_in_directory_with_scope _frida_g_io_modules_load_all_in_directory_with_scope -#define g_io_modules_scan_all_in_directory _frida_g_io_modules_scan_all_in_directory -#define g_io_modules_scan_all_in_directory_with_scope _frida_g_io_modules_scan_all_in_directory_with_scope -#define g_io_scheduler_cancel_all_jobs _frida_g_io_scheduler_cancel_all_jobs -#define g_io_scheduler_job_send_to_mainloop _frida_g_io_scheduler_job_send_to_mainloop -#define g_io_scheduler_job_send_to_mainloop_async _frida_g_io_scheduler_job_send_to_mainloop_async -#define g_io_scheduler_push_job _frida_g_io_scheduler_push_job -#define g_io_stream_clear_pending _frida_g_io_stream_clear_pending -#define g_io_stream_close _frida_g_io_stream_close -#define g_io_stream_close_async _frida_g_io_stream_close_async -#define g_io_stream_close_finish _frida_g_io_stream_close_finish -#define g_io_stream_get_input_stream _frida_g_io_stream_get_input_stream -#define g_io_stream_get_output_stream _frida_g_io_stream_get_output_stream -#define g_io_stream_get_type _frida_g_io_stream_get_type -#define g_io_stream_has_pending _frida_g_io_stream_has_pending -#define g_io_stream_is_closed _frida_g_io_stream_is_closed -#define g_io_stream_set_pending _frida_g_io_stream_set_pending -#define g_io_stream_splice_async _frida_g_io_stream_splice_async -#define g_io_stream_splice_finish _frida_g_io_stream_splice_finish -#define g_io_stream_splice_flags_get_type _frida_g_io_stream_splice_flags_get_type -#define g_io_watch_funcs _frida_g_io_watch_funcs -#define g_key_file_error_quark _frida_g_key_file_error_quark -#define g_key_file_free _frida_g_key_file_free -#define g_key_file_get_boolean _frida_g_key_file_get_boolean -#define g_key_file_get_boolean_list _frida_g_key_file_get_boolean_list -#define g_key_file_get_comment _frida_g_key_file_get_comment -#define g_key_file_get_double _frida_g_key_file_get_double -#define g_key_file_get_double_list _frida_g_key_file_get_double_list -#define g_key_file_get_groups _frida_g_key_file_get_groups -#define g_key_file_get_int64 _frida_g_key_file_get_int64 -#define g_key_file_get_integer _frida_g_key_file_get_integer -#define g_key_file_get_integer_list _frida_g_key_file_get_integer_list -#define g_key_file_get_keys _frida_g_key_file_get_keys -#define g_key_file_get_locale_for_key _frida_g_key_file_get_locale_for_key -#define g_key_file_get_locale_string _frida_g_key_file_get_locale_string -#define g_key_file_get_locale_string_list _frida_g_key_file_get_locale_string_list -#define g_key_file_get_start_group _frida_g_key_file_get_start_group -#define g_key_file_get_string _frida_g_key_file_get_string -#define g_key_file_get_string_list _frida_g_key_file_get_string_list -#define g_key_file_get_type _frida_g_key_file_get_type -#define g_key_file_get_uint64 _frida_g_key_file_get_uint64 -#define g_key_file_get_value _frida_g_key_file_get_value -#define g_key_file_has_group _frida_g_key_file_has_group -#define g_key_file_has_key _frida_g_key_file_has_key -#define g_key_file_load_from_bytes _frida_g_key_file_load_from_bytes -#define g_key_file_load_from_data _frida_g_key_file_load_from_data -#define g_key_file_load_from_data_dirs _frida_g_key_file_load_from_data_dirs -#define g_key_file_load_from_dirs _frida_g_key_file_load_from_dirs -#define g_key_file_load_from_file _frida_g_key_file_load_from_file -#define g_key_file_new _frida_g_key_file_new -#define g_key_file_ref _frida_g_key_file_ref -#define g_key_file_remove_comment _frida_g_key_file_remove_comment -#define g_key_file_remove_group _frida_g_key_file_remove_group -#define g_key_file_remove_key _frida_g_key_file_remove_key -#define g_key_file_save_to_file _frida_g_key_file_save_to_file -#define g_key_file_set_boolean _frida_g_key_file_set_boolean -#define g_key_file_set_boolean_list _frida_g_key_file_set_boolean_list -#define g_key_file_set_comment _frida_g_key_file_set_comment -#define g_key_file_set_double _frida_g_key_file_set_double -#define g_key_file_set_double_list _frida_g_key_file_set_double_list -#define g_key_file_set_int64 _frida_g_key_file_set_int64 -#define g_key_file_set_integer _frida_g_key_file_set_integer -#define g_key_file_set_integer_list _frida_g_key_file_set_integer_list -#define g_key_file_set_list_separator _frida_g_key_file_set_list_separator -#define g_key_file_set_locale_string _frida_g_key_file_set_locale_string -#define g_key_file_set_locale_string_list _frida_g_key_file_set_locale_string_list -#define g_key_file_set_string _frida_g_key_file_set_string -#define g_key_file_set_string_list _frida_g_key_file_set_string_list -#define g_key_file_set_uint64 _frida_g_key_file_set_uint64 -#define g_key_file_set_value _frida_g_key_file_set_value -#define g_key_file_to_data _frida_g_key_file_to_data -#define g_key_file_unref _frida_g_key_file_unref -#define g_keyfile_settings_backend_get_type _frida_g_keyfile_settings_backend_get_type -#define g_keyfile_settings_backend_new _frida_g_keyfile_settings_backend_new -#define g_libintl_bind_textdomain_codeset _frida_g_libintl_bind_textdomain_codeset -#define g_libintl_bindtextdomain _frida_g_libintl_bindtextdomain -#define g_libintl_dcgettext _frida_g_libintl_dcgettext -#define g_libintl_dcngettext _frida_g_libintl_dcngettext -#define g_libintl_dgettext _frida_g_libintl_dgettext -#define g_libintl_dngettext _frida_g_libintl_dngettext -#define g_libintl_gettext _frida_g_libintl_gettext -#define g_libintl_ngettext _frida_g_libintl_ngettext -#define g_libintl_textdomain _frida_g_libintl_textdomain -#define g_list_alloc _frida_g_list_alloc -#define g_list_append _frida_g_list_append -#define g_list_concat _frida_g_list_concat -#define g_list_copy _frida_g_list_copy -#define g_list_copy_deep _frida_g_list_copy_deep -#define g_list_delete_link _frida_g_list_delete_link -#define g_list_find _frida_g_list_find -#define g_list_find_custom _frida_g_list_find_custom -#define g_list_first _frida_g_list_first -#define g_list_foreach _frida_g_list_foreach -#define g_list_free _frida_g_list_free -#define g_list_free_1 _frida_g_list_free_1 -#define g_list_free_full _frida_g_list_free_full -#define g_list_index _frida_g_list_index -#define g_list_insert _frida_g_list_insert -#define g_list_insert_before _frida_g_list_insert_before -#define g_list_insert_before_link _frida_g_list_insert_before_link -#define g_list_insert_sorted _frida_g_list_insert_sorted -#define g_list_insert_sorted_with_data _frida_g_list_insert_sorted_with_data -#define g_list_last _frida_g_list_last -#define g_list_length _frida_g_list_length -#define g_list_model_get_item _frida_g_list_model_get_item -#define g_list_model_get_item_type _frida_g_list_model_get_item_type -#define g_list_model_get_n_items _frida_g_list_model_get_n_items -#define g_list_model_get_object _frida_g_list_model_get_object -#define g_list_model_get_type _frida_g_list_model_get_type -#define g_list_model_items_changed _frida_g_list_model_items_changed -#define g_list_nth _frida_g_list_nth -#define g_list_nth_data _frida_g_list_nth_data -#define g_list_nth_prev _frida_g_list_nth_prev -#define g_list_pop_allocator _frida_g_list_pop_allocator -#define g_list_position _frida_g_list_position -#define g_list_prepend _frida_g_list_prepend -#define g_list_push_allocator _frida_g_list_push_allocator -#define g_list_remove _frida_g_list_remove -#define g_list_remove_all _frida_g_list_remove_all -#define g_list_remove_link _frida_g_list_remove_link -#define g_list_reverse _frida_g_list_reverse -#define g_list_sort _frida_g_list_sort -#define g_list_sort_with_data _frida_g_list_sort_with_data -#define g_list_store_append _frida_g_list_store_append -#define g_list_store_find _frida_g_list_store_find -#define g_list_store_find_with_equal_func _frida_g_list_store_find_with_equal_func -#define g_list_store_get_type _frida_g_list_store_get_type -#define g_list_store_insert _frida_g_list_store_insert -#define g_list_store_insert_sorted _frida_g_list_store_insert_sorted -#define g_list_store_new _frida_g_list_store_new -#define g_list_store_remove _frida_g_list_store_remove -#define g_list_store_remove_all _frida_g_list_store_remove_all -#define g_list_store_sort _frida_g_list_store_sort -#define g_list_store_splice _frida_g_list_store_splice -#define g_listenv _frida_g_listenv -#define g_loadable_icon_get_type _frida_g_loadable_icon_get_type -#define g_loadable_icon_load _frida_g_loadable_icon_load -#define g_loadable_icon_load_async _frida_g_loadable_icon_load_async -#define g_loadable_icon_load_finish _frida_g_loadable_icon_load_finish -#define g_local_file_is_nfs_home _frida_g_local_file_is_nfs_home -#define g_local_file_monitor_get_type _frida_g_local_file_monitor_get_type -#define g_local_file_monitor_new_for_path _frida_g_local_file_monitor_new_for_path -#define g_local_file_monitor_new_in_worker _frida_g_local_file_monitor_new_in_worker -#define g_local_file_new_from_dirname_and_basename _frida_g_local_file_new_from_dirname_and_basename -#define g_locale_from_utf8 _frida_g_locale_from_utf8 -#define g_locale_to_utf8 _frida_g_locale_to_utf8 -#define g_log _frida_g_log -#define g_log_always_fatal _frida_g_log_always_fatal -#define g_log_default_handler _frida_g_log_default_handler -#define g_log_msg_prefix _frida_g_log_msg_prefix -#define g_log_remove_handler _frida_g_log_remove_handler -#define g_log_set_always_fatal _frida_g_log_set_always_fatal -#define g_log_set_default_handler _frida_g_log_set_default_handler -#define g_log_set_fatal_mask _frida_g_log_set_fatal_mask -#define g_log_set_handler _frida_g_log_set_handler -#define g_log_set_handler_full _frida_g_log_set_handler_full -#define g_log_set_writer_func _frida_g_log_set_writer_func -#define g_log_structured _frida_g_log_structured -#define g_log_structured_array _frida_g_log_structured_array -#define g_log_structured_standard _frida_g_log_structured_standard -#define g_log_variant _frida_g_log_variant -#define g_log_writer_default _frida_g_log_writer_default -#define g_log_writer_default_set_use_stderr _frida_g_log_writer_default_set_use_stderr -#define g_log_writer_default_would_drop _frida_g_log_writer_default_would_drop -#define g_log_writer_format_fields _frida_g_log_writer_format_fields -#define g_log_writer_is_journald _frida_g_log_writer_is_journald -#define g_log_writer_journald _frida_g_log_writer_journald -#define g_log_writer_standard_streams _frida_g_log_writer_standard_streams -#define g_log_writer_supports_color _frida_g_log_writer_supports_color -#define g_logv _frida_g_logv -#define g_lstat _frida_g_lstat -#define g_main_context_acquire _frida_g_main_context_acquire -#define g_main_context_add_poll _frida_g_main_context_add_poll -#define g_main_context_check _frida_g_main_context_check -#define g_main_context_default _frida_g_main_context_default -#define g_main_context_dispatch _frida_g_main_context_dispatch -#define g_main_context_find_source_by_funcs_user_data _frida_g_main_context_find_source_by_funcs_user_data -#define g_main_context_find_source_by_id _frida_g_main_context_find_source_by_id -#define g_main_context_find_source_by_user_data _frida_g_main_context_find_source_by_user_data -#define g_main_context_get_poll_func _frida_g_main_context_get_poll_func -#define g_main_context_get_thread_default _frida_g_main_context_get_thread_default -#define g_main_context_get_type _frida_g_main_context_get_type -#define g_main_context_invoke _frida_g_main_context_invoke -#define g_main_context_invoke_full _frida_g_main_context_invoke_full -#define g_main_context_is_owner _frida_g_main_context_is_owner -#define g_main_context_iteration _frida_g_main_context_iteration -#define g_main_context_new _frida_g_main_context_new -#define g_main_context_new_with_next_id _frida_g_main_context_new_with_next_id -#define g_main_context_pending _frida_g_main_context_pending -#define g_main_context_pop_thread_default _frida_g_main_context_pop_thread_default -#define g_main_context_prepare _frida_g_main_context_prepare -#define g_main_context_push_thread_default _frida_g_main_context_push_thread_default -#define g_main_context_query _frida_g_main_context_query -#define g_main_context_ref _frida_g_main_context_ref -#define g_main_context_ref_thread_default _frida_g_main_context_ref_thread_default -#define g_main_context_release _frida_g_main_context_release -#define g_main_context_remove_poll _frida_g_main_context_remove_poll -#define g_main_context_set_poll_func _frida_g_main_context_set_poll_func -#define g_main_context_unref _frida_g_main_context_unref -#define g_main_context_wait _frida_g_main_context_wait -#define g_main_context_wakeup _frida_g_main_context_wakeup -#define g_main_current_source _frida_g_main_current_source -#define g_main_depth _frida_g_main_depth -#define g_main_loop_get_context _frida_g_main_loop_get_context -#define g_main_loop_get_type _frida_g_main_loop_get_type -#define g_main_loop_is_running _frida_g_main_loop_is_running -#define g_main_loop_new _frida_g_main_loop_new -#define g_main_loop_quit _frida_g_main_loop_quit -#define g_main_loop_ref _frida_g_main_loop_ref -#define g_main_loop_run _frida_g_main_loop_run -#define g_main_loop_unref _frida_g_main_loop_unref -#define g_malloc _frida_g_malloc -#define g_malloc0 _frida_g_malloc0 -#define g_malloc0_n _frida_g_malloc0_n -#define g_malloc_n _frida_g_malloc_n -#define g_mapped_file_free _frida_g_mapped_file_free -#define g_mapped_file_get_bytes _frida_g_mapped_file_get_bytes -#define g_mapped_file_get_contents _frida_g_mapped_file_get_contents -#define g_mapped_file_get_length _frida_g_mapped_file_get_length -#define g_mapped_file_get_type _frida_g_mapped_file_get_type -#define g_mapped_file_new _frida_g_mapped_file_new -#define g_mapped_file_new_from_fd _frida_g_mapped_file_new_from_fd -#define g_mapped_file_ref _frida_g_mapped_file_ref -#define g_mapped_file_unref _frida_g_mapped_file_unref -#define g_markup_collect_attributes _frida_g_markup_collect_attributes -#define g_markup_error_quark _frida_g_markup_error_quark -#define g_markup_escape_text _frida_g_markup_escape_text -#define g_markup_parse_context_end_parse _frida_g_markup_parse_context_end_parse -#define g_markup_parse_context_free _frida_g_markup_parse_context_free -#define g_markup_parse_context_get_element _frida_g_markup_parse_context_get_element -#define g_markup_parse_context_get_element_stack _frida_g_markup_parse_context_get_element_stack -#define g_markup_parse_context_get_position _frida_g_markup_parse_context_get_position -#define g_markup_parse_context_get_type _frida_g_markup_parse_context_get_type -#define g_markup_parse_context_get_user_data _frida_g_markup_parse_context_get_user_data -#define g_markup_parse_context_new _frida_g_markup_parse_context_new -#define g_markup_parse_context_parse _frida_g_markup_parse_context_parse -#define g_markup_parse_context_pop _frida_g_markup_parse_context_pop -#define g_markup_parse_context_push _frida_g_markup_parse_context_push -#define g_markup_parse_context_ref _frida_g_markup_parse_context_ref -#define g_markup_parse_context_unref _frida_g_markup_parse_context_unref -#define g_markup_printf_escaped _frida_g_markup_printf_escaped -#define g_markup_vprintf_escaped _frida_g_markup_vprintf_escaped -#define g_match_info_expand_references _frida_g_match_info_expand_references -#define g_match_info_fetch _frida_g_match_info_fetch -#define g_match_info_fetch_all _frida_g_match_info_fetch_all -#define g_match_info_fetch_named _frida_g_match_info_fetch_named -#define g_match_info_fetch_named_pos _frida_g_match_info_fetch_named_pos -#define g_match_info_fetch_pos _frida_g_match_info_fetch_pos -#define g_match_info_free _frida_g_match_info_free -#define g_match_info_get_match_count _frida_g_match_info_get_match_count -#define g_match_info_get_regex _frida_g_match_info_get_regex -#define g_match_info_get_string _frida_g_match_info_get_string -#define g_match_info_get_type _frida_g_match_info_get_type -#define g_match_info_is_partial_match _frida_g_match_info_is_partial_match -#define g_match_info_matches _frida_g_match_info_matches -#define g_match_info_next _frida_g_match_info_next -#define g_match_info_ref _frida_g_match_info_ref -#define g_match_info_unref _frida_g_match_info_unref -#define g_mem_chunk_alloc _frida_g_mem_chunk_alloc -#define g_mem_chunk_alloc0 _frida_g_mem_chunk_alloc0 -#define g_mem_chunk_clean _frida_g_mem_chunk_clean -#define g_mem_chunk_destroy _frida_g_mem_chunk_destroy -#define g_mem_chunk_free _frida_g_mem_chunk_free -#define g_mem_chunk_info _frida_g_mem_chunk_info -#define g_mem_chunk_new _frida_g_mem_chunk_new -#define g_mem_chunk_print _frida_g_mem_chunk_print -#define g_mem_chunk_reset _frida_g_mem_chunk_reset -#define g_mem_gc_friendly _frida_g_mem_gc_friendly -#define g_mem_is_system_malloc _frida_g_mem_is_system_malloc -#define g_mem_profile _frida_g_mem_profile -#define g_mem_set_vtable _frida_g_mem_set_vtable -#define g_memdup _frida_g_memdup -#define g_memory_input_stream_add_bytes _frida_g_memory_input_stream_add_bytes -#define g_memory_input_stream_add_data _frida_g_memory_input_stream_add_data -#define g_memory_input_stream_get_type _frida_g_memory_input_stream_get_type -#define g_memory_input_stream_new _frida_g_memory_input_stream_new -#define g_memory_input_stream_new_from_bytes _frida_g_memory_input_stream_new_from_bytes -#define g_memory_input_stream_new_from_data _frida_g_memory_input_stream_new_from_data -#define g_memory_monitor_dbus_get_type _frida_g_memory_monitor_dbus_get_type -#define g_memory_monitor_dup_default _frida_g_memory_monitor_dup_default -#define g_memory_monitor_get_type _frida_g_memory_monitor_get_type -#define g_memory_monitor_portal_get_type _frida_g_memory_monitor_portal_get_type -#define g_memory_monitor_warning_level_get_type _frida_g_memory_monitor_warning_level_get_type -#define g_memory_output_stream_get_data _frida_g_memory_output_stream_get_data -#define g_memory_output_stream_get_data_size _frida_g_memory_output_stream_get_data_size -#define g_memory_output_stream_get_size _frida_g_memory_output_stream_get_size -#define g_memory_output_stream_get_type _frida_g_memory_output_stream_get_type -#define g_memory_output_stream_new _frida_g_memory_output_stream_new -#define g_memory_output_stream_new_resizable _frida_g_memory_output_stream_new_resizable -#define g_memory_output_stream_steal_as_bytes _frida_g_memory_output_stream_steal_as_bytes -#define g_memory_output_stream_steal_data _frida_g_memory_output_stream_steal_data -#define g_memory_settings_backend_get_type _frida_g_memory_settings_backend_get_type -#define g_memory_settings_backend_new _frida_g_memory_settings_backend_new -#define g_menu_append _frida_g_menu_append -#define g_menu_append_item _frida_g_menu_append_item -#define g_menu_append_section _frida_g_menu_append_section -#define g_menu_append_submenu _frida_g_menu_append_submenu -#define g_menu_attribute_iter_get_name _frida_g_menu_attribute_iter_get_name -#define g_menu_attribute_iter_get_next _frida_g_menu_attribute_iter_get_next -#define g_menu_attribute_iter_get_type _frida_g_menu_attribute_iter_get_type -#define g_menu_attribute_iter_get_value _frida_g_menu_attribute_iter_get_value -#define g_menu_attribute_iter_next _frida_g_menu_attribute_iter_next -#define g_menu_freeze _frida_g_menu_freeze -#define g_menu_get_type _frida_g_menu_get_type -#define g_menu_insert _frida_g_menu_insert -#define g_menu_insert_item _frida_g_menu_insert_item -#define g_menu_insert_section _frida_g_menu_insert_section -#define g_menu_insert_submenu _frida_g_menu_insert_submenu -#define g_menu_item_get_attribute _frida_g_menu_item_get_attribute -#define g_menu_item_get_attribute_value _frida_g_menu_item_get_attribute_value -#define g_menu_item_get_link _frida_g_menu_item_get_link -#define g_menu_item_get_type _frida_g_menu_item_get_type -#define g_menu_item_new _frida_g_menu_item_new -#define g_menu_item_new_from_model _frida_g_menu_item_new_from_model -#define g_menu_item_new_section _frida_g_menu_item_new_section -#define g_menu_item_new_submenu _frida_g_menu_item_new_submenu -#define g_menu_item_set_action_and_target _frida_g_menu_item_set_action_and_target -#define g_menu_item_set_action_and_target_value _frida_g_menu_item_set_action_and_target_value -#define g_menu_item_set_attribute _frida_g_menu_item_set_attribute -#define g_menu_item_set_attribute_value _frida_g_menu_item_set_attribute_value -#define g_menu_item_set_detailed_action _frida_g_menu_item_set_detailed_action -#define g_menu_item_set_icon _frida_g_menu_item_set_icon -#define g_menu_item_set_label _frida_g_menu_item_set_label -#define g_menu_item_set_link _frida_g_menu_item_set_link -#define g_menu_item_set_section _frida_g_menu_item_set_section -#define g_menu_item_set_submenu _frida_g_menu_item_set_submenu -#define g_menu_link_iter_get_name _frida_g_menu_link_iter_get_name -#define g_menu_link_iter_get_next _frida_g_menu_link_iter_get_next -#define g_menu_link_iter_get_type _frida_g_menu_link_iter_get_type -#define g_menu_link_iter_get_value _frida_g_menu_link_iter_get_value -#define g_menu_link_iter_next _frida_g_menu_link_iter_next -#define g_menu_model_get_item_attribute _frida_g_menu_model_get_item_attribute -#define g_menu_model_get_item_attribute_value _frida_g_menu_model_get_item_attribute_value -#define g_menu_model_get_item_link _frida_g_menu_model_get_item_link -#define g_menu_model_get_n_items _frida_g_menu_model_get_n_items -#define g_menu_model_get_type _frida_g_menu_model_get_type -#define g_menu_model_is_mutable _frida_g_menu_model_is_mutable -#define g_menu_model_items_changed _frida_g_menu_model_items_changed -#define g_menu_model_iterate_item_attributes _frida_g_menu_model_iterate_item_attributes -#define g_menu_model_iterate_item_links _frida_g_menu_model_iterate_item_links -#define g_menu_new _frida_g_menu_new -#define g_menu_prepend _frida_g_menu_prepend -#define g_menu_prepend_item _frida_g_menu_prepend_item -#define g_menu_prepend_section _frida_g_menu_prepend_section -#define g_menu_prepend_submenu _frida_g_menu_prepend_submenu -#define g_menu_remove _frida_g_menu_remove -#define g_menu_remove_all _frida_g_menu_remove_all -#define g_mkdir _frida_g_mkdir -#define g_mkdir_with_parents _frida_g_mkdir_with_parents -#define g_mkdtemp _frida_g_mkdtemp -#define g_mkdtemp_full _frida_g_mkdtemp_full -#define g_mkstemp _frida_g_mkstemp -#define g_mkstemp_full _frida_g_mkstemp_full -#define g_module_build_path _frida_g_module_build_path -#define g_module_close _frida_g_module_close -#define g_module_error _frida_g_module_error -#define g_module_make_resident _frida_g_module_make_resident -#define g_module_name _frida_g_module_name -#define g_module_open _frida_g_module_open -#define g_module_supported _frida_g_module_supported -#define g_module_symbol _frida_g_module_symbol -#define g_mount_can_eject _frida_g_mount_can_eject -#define g_mount_can_unmount _frida_g_mount_can_unmount -#define g_mount_eject _frida_g_mount_eject -#define g_mount_eject_finish _frida_g_mount_eject_finish -#define g_mount_eject_with_operation _frida_g_mount_eject_with_operation -#define g_mount_eject_with_operation_finish _frida_g_mount_eject_with_operation_finish -#define g_mount_get_default_location _frida_g_mount_get_default_location -#define g_mount_get_drive _frida_g_mount_get_drive -#define g_mount_get_icon _frida_g_mount_get_icon -#define g_mount_get_name _frida_g_mount_get_name -#define g_mount_get_root _frida_g_mount_get_root -#define g_mount_get_sort_key _frida_g_mount_get_sort_key -#define g_mount_get_symbolic_icon _frida_g_mount_get_symbolic_icon -#define g_mount_get_type _frida_g_mount_get_type -#define g_mount_get_uuid _frida_g_mount_get_uuid -#define g_mount_get_volume _frida_g_mount_get_volume -#define g_mount_guess_content_type _frida_g_mount_guess_content_type -#define g_mount_guess_content_type_finish _frida_g_mount_guess_content_type_finish -#define g_mount_guess_content_type_sync _frida_g_mount_guess_content_type_sync -#define g_mount_is_shadowed _frida_g_mount_is_shadowed -#define g_mount_mount_flags_get_type _frida_g_mount_mount_flags_get_type -#define g_mount_operation_get_anonymous _frida_g_mount_operation_get_anonymous -#define g_mount_operation_get_choice _frida_g_mount_operation_get_choice -#define g_mount_operation_get_domain _frida_g_mount_operation_get_domain -#define g_mount_operation_get_is_tcrypt_hidden_volume _frida_g_mount_operation_get_is_tcrypt_hidden_volume -#define g_mount_operation_get_is_tcrypt_system_volume _frida_g_mount_operation_get_is_tcrypt_system_volume -#define g_mount_operation_get_password _frida_g_mount_operation_get_password -#define g_mount_operation_get_password_save _frida_g_mount_operation_get_password_save -#define g_mount_operation_get_pim _frida_g_mount_operation_get_pim -#define g_mount_operation_get_type _frida_g_mount_operation_get_type -#define g_mount_operation_get_username _frida_g_mount_operation_get_username -#define g_mount_operation_new _frida_g_mount_operation_new -#define g_mount_operation_reply _frida_g_mount_operation_reply -#define g_mount_operation_result_get_type _frida_g_mount_operation_result_get_type -#define g_mount_operation_set_anonymous _frida_g_mount_operation_set_anonymous -#define g_mount_operation_set_choice _frida_g_mount_operation_set_choice -#define g_mount_operation_set_domain _frida_g_mount_operation_set_domain -#define g_mount_operation_set_is_tcrypt_hidden_volume _frida_g_mount_operation_set_is_tcrypt_hidden_volume -#define g_mount_operation_set_is_tcrypt_system_volume _frida_g_mount_operation_set_is_tcrypt_system_volume -#define g_mount_operation_set_password _frida_g_mount_operation_set_password -#define g_mount_operation_set_password_save _frida_g_mount_operation_set_password_save -#define g_mount_operation_set_pim _frida_g_mount_operation_set_pim -#define g_mount_operation_set_username _frida_g_mount_operation_set_username -#define g_mount_remount _frida_g_mount_remount -#define g_mount_remount_finish _frida_g_mount_remount_finish -#define g_mount_shadow _frida_g_mount_shadow -#define g_mount_unmount _frida_g_mount_unmount -#define g_mount_unmount_finish _frida_g_mount_unmount_finish -#define g_mount_unmount_flags_get_type _frida_g_mount_unmount_flags_get_type -#define g_mount_unmount_with_operation _frida_g_mount_unmount_with_operation -#define g_mount_unmount_with_operation_finish _frida_g_mount_unmount_with_operation_finish -#define g_mount_unshadow _frida_g_mount_unshadow -#define g_mutex_clear _frida_g_mutex_clear -#define g_mutex_free _frida_g_mutex_free -#define g_mutex_init _frida_g_mutex_init -#define g_mutex_lock _frida_g_mutex_lock -#define g_mutex_new _frida_g_mutex_new -#define g_mutex_trylock _frida_g_mutex_trylock -#define g_mutex_unlock _frida_g_mutex_unlock -#define g_native_socket_address_get_type _frida_g_native_socket_address_get_type -#define g_native_socket_address_new _frida_g_native_socket_address_new -#define g_native_volume_monitor_get_type _frida_g_native_volume_monitor_get_type -#define g_network_address_get_hostname _frida_g_network_address_get_hostname -#define g_network_address_get_port _frida_g_network_address_get_port -#define g_network_address_get_scheme _frida_g_network_address_get_scheme -#define g_network_address_get_type _frida_g_network_address_get_type -#define g_network_address_new _frida_g_network_address_new -#define g_network_address_new_loopback _frida_g_network_address_new_loopback -#define g_network_address_parse _frida_g_network_address_parse -#define g_network_address_parse_uri _frida_g_network_address_parse_uri -#define g_network_connectivity_get_type _frida_g_network_connectivity_get_type -#define g_network_monitor_base_add_network _frida_g_network_monitor_base_add_network -#define g_network_monitor_base_get_type _frida_g_network_monitor_base_get_type -#define g_network_monitor_base_remove_network _frida_g_network_monitor_base_remove_network -#define g_network_monitor_base_set_networks _frida_g_network_monitor_base_set_networks -#define g_network_monitor_can_reach _frida_g_network_monitor_can_reach -#define g_network_monitor_can_reach_async _frida_g_network_monitor_can_reach_async -#define g_network_monitor_can_reach_finish _frida_g_network_monitor_can_reach_finish -#define g_network_monitor_get_connectivity _frida_g_network_monitor_get_connectivity -#define g_network_monitor_get_default _frida_g_network_monitor_get_default -#define g_network_monitor_get_network_available _frida_g_network_monitor_get_network_available -#define g_network_monitor_get_network_metered _frida_g_network_monitor_get_network_metered -#define g_network_monitor_get_type _frida_g_network_monitor_get_type -#define g_network_monitor_portal_get_type _frida_g_network_monitor_portal_get_type -#define g_network_service_get_domain _frida_g_network_service_get_domain -#define g_network_service_get_protocol _frida_g_network_service_get_protocol -#define g_network_service_get_scheme _frida_g_network_service_get_scheme -#define g_network_service_get_service _frida_g_network_service_get_service -#define g_network_service_get_type _frida_g_network_service_get_type -#define g_network_service_new _frida_g_network_service_new -#define g_network_service_set_scheme _frida_g_network_service_set_scheme -#define g_networking_init _frida_g_networking_init -#define g_node_child_index _frida_g_node_child_index -#define g_node_child_position _frida_g_node_child_position -#define g_node_children_foreach _frida_g_node_children_foreach -#define g_node_copy _frida_g_node_copy -#define g_node_copy_deep _frida_g_node_copy_deep -#define g_node_depth _frida_g_node_depth -#define g_node_destroy _frida_g_node_destroy -#define g_node_find _frida_g_node_find -#define g_node_find_child _frida_g_node_find_child -#define g_node_first_sibling _frida_g_node_first_sibling -#define g_node_get_root _frida_g_node_get_root -#define g_node_insert _frida_g_node_insert -#define g_node_insert_after _frida_g_node_insert_after -#define g_node_insert_before _frida_g_node_insert_before -#define g_node_is_ancestor _frida_g_node_is_ancestor -#define g_node_last_child _frida_g_node_last_child -#define g_node_last_sibling _frida_g_node_last_sibling -#define g_node_max_height _frida_g_node_max_height -#define g_node_n_children _frida_g_node_n_children -#define g_node_n_nodes _frida_g_node_n_nodes -#define g_node_new _frida_g_node_new -#define g_node_nth_child _frida_g_node_nth_child -#define g_node_pop_allocator _frida_g_node_pop_allocator -#define g_node_prepend _frida_g_node_prepend -#define g_node_push_allocator _frida_g_node_push_allocator -#define g_node_reverse_children _frida_g_node_reverse_children -#define g_node_traverse _frida_g_node_traverse -#define g_node_unlink _frida_g_node_unlink -#define g_normalize_mode_get_type _frida_g_normalize_mode_get_type -#define g_notification_add_button _frida_g_notification_add_button -#define g_notification_add_button_with_target _frida_g_notification_add_button_with_target -#define g_notification_add_button_with_target_value _frida_g_notification_add_button_with_target_value -#define g_notification_backend_get_type _frida_g_notification_backend_get_type -#define g_notification_backend_new_default _frida_g_notification_backend_new_default -#define g_notification_backend_send_notification _frida_g_notification_backend_send_notification -#define g_notification_backend_withdraw_notification _frida_g_notification_backend_withdraw_notification -#define g_notification_get_body _frida_g_notification_get_body -#define g_notification_get_button _frida_g_notification_get_button -#define g_notification_get_button_with_action _frida_g_notification_get_button_with_action -#define g_notification_get_default_action _frida_g_notification_get_default_action -#define g_notification_get_icon _frida_g_notification_get_icon -#define g_notification_get_n_buttons _frida_g_notification_get_n_buttons -#define g_notification_get_priority _frida_g_notification_get_priority -#define g_notification_get_title _frida_g_notification_get_title -#define g_notification_get_type _frida_g_notification_get_type -#define g_notification_new _frida_g_notification_new -#define g_notification_priority_get_type _frida_g_notification_priority_get_type -#define g_notification_serialize _frida_g_notification_serialize -#define g_notification_set_body _frida_g_notification_set_body -#define g_notification_set_default_action _frida_g_notification_set_default_action -#define g_notification_set_default_action_and_target _frida_g_notification_set_default_action_and_target -#define g_notification_set_default_action_and_target_value _frida_g_notification_set_default_action_and_target_value -#define g_notification_set_icon _frida_g_notification_set_icon -#define g_notification_set_priority _frida_g_notification_set_priority -#define g_notification_set_title _frida_g_notification_set_title -#define g_notification_set_urgent _frida_g_notification_set_urgent -#define g_null_settings_backend_get_type _frida_g_null_settings_backend_get_type -#define g_null_settings_backend_new _frida_g_null_settings_backend_new -#define g_nullify_pointer _frida_g_nullify_pointer -#define g_number_parser_error_quark _frida_g_number_parser_error_quark -#define g_object_add_toggle_ref _frida_g_object_add_toggle_ref -#define g_object_add_weak_pointer _frida_g_object_add_weak_pointer -#define g_object_bind_property _frida_g_object_bind_property -#define g_object_bind_property_full _frida_g_object_bind_property_full -#define g_object_bind_property_with_closures _frida_g_object_bind_property_with_closures -#define g_object_class_find_property _frida_g_object_class_find_property -#define g_object_class_install_properties _frida_g_object_class_install_properties -#define g_object_class_install_property _frida_g_object_class_install_property -#define g_object_class_list_properties _frida_g_object_class_list_properties -#define g_object_class_override_property _frida_g_object_class_override_property -#define g_object_compat_control _frida_g_object_compat_control -#define g_object_connect _frida_g_object_connect -#define g_object_disconnect _frida_g_object_disconnect -#define g_object_dup_data _frida_g_object_dup_data -#define g_object_dup_qdata _frida_g_object_dup_qdata -#define g_object_force_floating _frida_g_object_force_floating -#define g_object_freeze_notify _frida_g_object_freeze_notify -#define g_object_get _frida_g_object_get -#define g_object_get_data _frida_g_object_get_data -#define g_object_get_property _frida_g_object_get_property -#define g_object_get_qdata _frida_g_object_get_qdata -#define g_object_get_type _frida_g_object_get_type -#define g_object_get_valist _frida_g_object_get_valist -#define g_object_getv _frida_g_object_getv -#define g_object_interface_find_property _frida_g_object_interface_find_property -#define g_object_interface_install_property _frida_g_object_interface_install_property -#define g_object_interface_list_properties _frida_g_object_interface_list_properties -#define g_object_is_floating _frida_g_object_is_floating -#define g_object_new _frida_g_object_new -#define g_object_new_valist _frida_g_object_new_valist -#define g_object_new_with_properties _frida_g_object_new_with_properties -#define g_object_newv _frida_g_object_newv -#define g_object_notify _frida_g_object_notify -#define g_object_notify_by_pspec _frida_g_object_notify_by_pspec -#define g_object_ref _frida_g_object_ref -#define g_object_ref_sink _frida_g_object_ref_sink -#define g_object_remove_toggle_ref _frida_g_object_remove_toggle_ref -#define g_object_remove_weak_pointer _frida_g_object_remove_weak_pointer -#define g_object_replace_data _frida_g_object_replace_data -#define g_object_replace_qdata _frida_g_object_replace_qdata -#define g_object_run_dispose _frida_g_object_run_dispose -#define g_object_set _frida_g_object_set -#define g_object_set_data _frida_g_object_set_data -#define g_object_set_data_full _frida_g_object_set_data_full -#define g_object_set_property _frida_g_object_set_property -#define g_object_set_qdata _frida_g_object_set_qdata -#define g_object_set_qdata_full _frida_g_object_set_qdata_full -#define g_object_set_valist _frida_g_object_set_valist -#define g_object_setv _frida_g_object_setv -#define g_object_steal_data _frida_g_object_steal_data -#define g_object_steal_qdata _frida_g_object_steal_qdata -#define g_object_thaw_notify _frida_g_object_thaw_notify -#define g_object_unref _frida_g_object_unref -#define g_object_watch_closure _frida_g_object_watch_closure -#define g_object_weak_ref _frida_g_object_weak_ref -#define g_object_weak_unref _frida_g_object_weak_unref -#define g_on_error_query _frida_g_on_error_query -#define g_on_error_stack_trace _frida_g_on_error_stack_trace -#define g_once_impl _frida_g_once_impl -#define g_once_init_enter _frida_g_once_init_enter -#define g_once_init_enter_impl _frida_g_once_init_enter_impl -#define g_once_init_leave _frida_g_once_init_leave -#define g_open _frida_g_open -#define g_openuri_portal_open_uri _frida_g_openuri_portal_open_uri -#define g_openuri_portal_open_uri_async _frida_g_openuri_portal_open_uri_async -#define g_openuri_portal_open_uri_finish _frida_g_openuri_portal_open_uri_finish -#define g_option_context_add_group _frida_g_option_context_add_group -#define g_option_context_add_main_entries _frida_g_option_context_add_main_entries -#define g_option_context_free _frida_g_option_context_free -#define g_option_context_get_description _frida_g_option_context_get_description -#define g_option_context_get_help _frida_g_option_context_get_help -#define g_option_context_get_help_enabled _frida_g_option_context_get_help_enabled -#define g_option_context_get_ignore_unknown_options _frida_g_option_context_get_ignore_unknown_options -#define g_option_context_get_main_group _frida_g_option_context_get_main_group -#define g_option_context_get_strict_posix _frida_g_option_context_get_strict_posix -#define g_option_context_get_summary _frida_g_option_context_get_summary -#define g_option_context_new _frida_g_option_context_new -#define g_option_context_parse _frida_g_option_context_parse -#define g_option_context_parse_strv _frida_g_option_context_parse_strv -#define g_option_context_set_description _frida_g_option_context_set_description -#define g_option_context_set_help_enabled _frida_g_option_context_set_help_enabled -#define g_option_context_set_ignore_unknown_options _frida_g_option_context_set_ignore_unknown_options -#define g_option_context_set_main_group _frida_g_option_context_set_main_group -#define g_option_context_set_strict_posix _frida_g_option_context_set_strict_posix -#define g_option_context_set_summary _frida_g_option_context_set_summary -#define g_option_context_set_translate_func _frida_g_option_context_set_translate_func -#define g_option_context_set_translation_domain _frida_g_option_context_set_translation_domain -#define g_option_error_quark _frida_g_option_error_quark -#define g_option_group_add_entries _frida_g_option_group_add_entries -#define g_option_group_free _frida_g_option_group_free -#define g_option_group_get_type _frida_g_option_group_get_type -#define g_option_group_new _frida_g_option_group_new -#define g_option_group_ref _frida_g_option_group_ref -#define g_option_group_set_error_hook _frida_g_option_group_set_error_hook -#define g_option_group_set_parse_hooks _frida_g_option_group_set_parse_hooks -#define g_option_group_set_translate_func _frida_g_option_group_set_translate_func -#define g_option_group_set_translation_domain _frida_g_option_group_set_translation_domain -#define g_option_group_unref _frida_g_option_group_unref -#define g_output_stream_async_close_is_via_threads _frida_g_output_stream_async_close_is_via_threads -#define g_output_stream_async_write_is_via_threads _frida_g_output_stream_async_write_is_via_threads -#define g_output_stream_async_writev_is_via_threads _frida_g_output_stream_async_writev_is_via_threads -#define g_output_stream_clear_pending _frida_g_output_stream_clear_pending -#define g_output_stream_close _frida_g_output_stream_close -#define g_output_stream_close_async _frida_g_output_stream_close_async -#define g_output_stream_close_finish _frida_g_output_stream_close_finish -#define g_output_stream_flush _frida_g_output_stream_flush -#define g_output_stream_flush_async _frida_g_output_stream_flush_async -#define g_output_stream_flush_finish _frida_g_output_stream_flush_finish -#define g_output_stream_get_type _frida_g_output_stream_get_type -#define g_output_stream_has_pending _frida_g_output_stream_has_pending -#define g_output_stream_is_closed _frida_g_output_stream_is_closed -#define g_output_stream_is_closing _frida_g_output_stream_is_closing -#define g_output_stream_printf _frida_g_output_stream_printf -#define g_output_stream_set_pending _frida_g_output_stream_set_pending -#define g_output_stream_splice _frida_g_output_stream_splice -#define g_output_stream_splice_async _frida_g_output_stream_splice_async -#define g_output_stream_splice_finish _frida_g_output_stream_splice_finish -#define g_output_stream_splice_flags_get_type _frida_g_output_stream_splice_flags_get_type -#define g_output_stream_vprintf _frida_g_output_stream_vprintf -#define g_output_stream_write _frida_g_output_stream_write -#define g_output_stream_write_all _frida_g_output_stream_write_all -#define g_output_stream_write_all_async _frida_g_output_stream_write_all_async -#define g_output_stream_write_all_finish _frida_g_output_stream_write_all_finish -#define g_output_stream_write_async _frida_g_output_stream_write_async -#define g_output_stream_write_bytes _frida_g_output_stream_write_bytes -#define g_output_stream_write_bytes_async _frida_g_output_stream_write_bytes_async -#define g_output_stream_write_bytes_finish _frida_g_output_stream_write_bytes_finish -#define g_output_stream_write_finish _frida_g_output_stream_write_finish -#define g_output_stream_writev _frida_g_output_stream_writev -#define g_output_stream_writev_all _frida_g_output_stream_writev_all -#define g_output_stream_writev_all_async _frida_g_output_stream_writev_all_async -#define g_output_stream_writev_all_finish _frida_g_output_stream_writev_all_finish -#define g_output_stream_writev_async _frida_g_output_stream_writev_async -#define g_output_stream_writev_finish _frida_g_output_stream_writev_finish -#define g_param_spec_boolean _frida_g_param_spec_boolean -#define g_param_spec_boxed _frida_g_param_spec_boxed -#define g_param_spec_char _frida_g_param_spec_char -#define g_param_spec_double _frida_g_param_spec_double -#define g_param_spec_enum _frida_g_param_spec_enum -#define g_param_spec_flags _frida_g_param_spec_flags -#define g_param_spec_float _frida_g_param_spec_float -#define g_param_spec_get_blurb _frida_g_param_spec_get_blurb -#define g_param_spec_get_default_value _frida_g_param_spec_get_default_value -#define g_param_spec_get_name _frida_g_param_spec_get_name -#define g_param_spec_get_name_quark _frida_g_param_spec_get_name_quark -#define g_param_spec_get_nick _frida_g_param_spec_get_nick -#define g_param_spec_get_qdata _frida_g_param_spec_get_qdata -#define g_param_spec_get_redirect_target _frida_g_param_spec_get_redirect_target -#define g_param_spec_gtype _frida_g_param_spec_gtype -#define g_param_spec_int _frida_g_param_spec_int -#define g_param_spec_int64 _frida_g_param_spec_int64 -#define g_param_spec_internal _frida_g_param_spec_internal -#define g_param_spec_is_valid_name _frida_g_param_spec_is_valid_name -#define g_param_spec_long _frida_g_param_spec_long -#define g_param_spec_object _frida_g_param_spec_object -#define g_param_spec_override _frida_g_param_spec_override -#define g_param_spec_param _frida_g_param_spec_param -#define g_param_spec_pointer _frida_g_param_spec_pointer -#define g_param_spec_pool_insert _frida_g_param_spec_pool_insert -#define g_param_spec_pool_list _frida_g_param_spec_pool_list -#define g_param_spec_pool_list_owned _frida_g_param_spec_pool_list_owned -#define g_param_spec_pool_lookup _frida_g_param_spec_pool_lookup -#define g_param_spec_pool_new _frida_g_param_spec_pool_new -#define g_param_spec_pool_remove _frida_g_param_spec_pool_remove -#define g_param_spec_ref _frida_g_param_spec_ref -#define g_param_spec_ref_sink _frida_g_param_spec_ref_sink -#define g_param_spec_set_qdata _frida_g_param_spec_set_qdata -#define g_param_spec_set_qdata_full _frida_g_param_spec_set_qdata_full -#define g_param_spec_sink _frida_g_param_spec_sink -#define g_param_spec_steal_qdata _frida_g_param_spec_steal_qdata -#define g_param_spec_string _frida_g_param_spec_string -#define g_param_spec_types _frida_g_param_spec_types -#define g_param_spec_uchar _frida_g_param_spec_uchar -#define g_param_spec_uint _frida_g_param_spec_uint -#define g_param_spec_uint64 _frida_g_param_spec_uint64 -#define g_param_spec_ulong _frida_g_param_spec_ulong -#define g_param_spec_unichar _frida_g_param_spec_unichar -#define g_param_spec_unref _frida_g_param_spec_unref -#define g_param_spec_value_array _frida_g_param_spec_value_array -#define g_param_spec_variant _frida_g_param_spec_variant -#define g_param_type_register_static _frida_g_param_type_register_static -#define g_param_value_convert _frida_g_param_value_convert -#define g_param_value_defaults _frida_g_param_value_defaults -#define g_param_value_set_default _frida_g_param_value_set_default -#define g_param_value_validate _frida_g_param_value_validate -#define g_param_values_cmp _frida_g_param_values_cmp -#define g_parse_debug_string _frida_g_parse_debug_string -#define g_password_save_get_type _frida_g_password_save_get_type -#define g_path_get_basename _frida_g_path_get_basename -#define g_path_get_dirname _frida_g_path_get_dirname -#define g_path_is_absolute _frida_g_path_is_absolute -#define g_path_skip_root _frida_g_path_skip_root -#define g_pattern_match _frida_g_pattern_match -#define g_pattern_match_simple _frida_g_pattern_match_simple -#define g_pattern_match_string _frida_g_pattern_match_string -#define g_pattern_spec_equal _frida_g_pattern_spec_equal -#define g_pattern_spec_free _frida_g_pattern_spec_free -#define g_pattern_spec_new _frida_g_pattern_spec_new -#define g_permission_acquire _frida_g_permission_acquire -#define g_permission_acquire_async _frida_g_permission_acquire_async -#define g_permission_acquire_finish _frida_g_permission_acquire_finish -#define g_permission_get_allowed _frida_g_permission_get_allowed -#define g_permission_get_can_acquire _frida_g_permission_get_can_acquire -#define g_permission_get_can_release _frida_g_permission_get_can_release -#define g_permission_get_type _frida_g_permission_get_type -#define g_permission_impl_update _frida_g_permission_impl_update -#define g_permission_release _frida_g_permission_release -#define g_permission_release_async _frida_g_permission_release_async -#define g_permission_release_finish _frida_g_permission_release_finish -#define g_platform_audit_set_fd_callbacks _frida_g_platform_audit_set_fd_callbacks -#define g_pointer_bit_lock _frida_g_pointer_bit_lock -#define g_pointer_bit_trylock _frida_g_pointer_bit_trylock -#define g_pointer_bit_unlock _frida_g_pointer_bit_unlock -#define g_pointer_type_register_static _frida_g_pointer_type_register_static -#define g_poll _frida_g_poll -#define g_pollable_input_stream_can_poll _frida_g_pollable_input_stream_can_poll -#define g_pollable_input_stream_create_source _frida_g_pollable_input_stream_create_source -#define g_pollable_input_stream_get_type _frida_g_pollable_input_stream_get_type -#define g_pollable_input_stream_is_readable _frida_g_pollable_input_stream_is_readable -#define g_pollable_input_stream_read_nonblocking _frida_g_pollable_input_stream_read_nonblocking -#define g_pollable_output_stream_can_poll _frida_g_pollable_output_stream_can_poll -#define g_pollable_output_stream_create_source _frida_g_pollable_output_stream_create_source -#define g_pollable_output_stream_get_type _frida_g_pollable_output_stream_get_type -#define g_pollable_output_stream_is_writable _frida_g_pollable_output_stream_is_writable -#define g_pollable_output_stream_write_nonblocking _frida_g_pollable_output_stream_write_nonblocking -#define g_pollable_output_stream_writev_nonblocking _frida_g_pollable_output_stream_writev_nonblocking -#define g_pollable_return_get_type _frida_g_pollable_return_get_type -#define g_pollable_source_new _frida_g_pollable_source_new -#define g_pollable_source_new_full _frida_g_pollable_source_new_full -#define g_pollable_stream_read _frida_g_pollable_stream_read -#define g_pollable_stream_write _frida_g_pollable_stream_write -#define g_pollable_stream_write_all _frida_g_pollable_stream_write_all -#define g_pollfd_get_type _frida_g_pollfd_get_type -#define g_portal_notification_backend_get_type _frida_g_portal_notification_backend_get_type -#define g_prefix_error _frida_g_prefix_error -#define g_print _frida_g_print -#define g_printerr _frida_g_printerr -#define g_printf _frida_g_printf -#define g_printf_string_upper_bound _frida_g_printf_string_upper_bound -#define g_private_get _frida_g_private_get -#define g_private_new _frida_g_private_new -#define g_private_replace _frida_g_private_replace -#define g_private_set _frida_g_private_set -#define g_private_set_alloc0 _frida_g_private_set_alloc0 -#define g_propagate_error _frida_g_propagate_error -#define g_propagate_prefixed_error _frida_g_propagate_prefixed_error -#define g_property_action_get_type _frida_g_property_action_get_type -#define g_property_action_new _frida_g_property_action_new -#define g_proxy_address_enumerator_get_type _frida_g_proxy_address_enumerator_get_type -#define g_proxy_address_get_destination_hostname _frida_g_proxy_address_get_destination_hostname -#define g_proxy_address_get_destination_port _frida_g_proxy_address_get_destination_port -#define g_proxy_address_get_destination_protocol _frida_g_proxy_address_get_destination_protocol -#define g_proxy_address_get_password _frida_g_proxy_address_get_password -#define g_proxy_address_get_protocol _frida_g_proxy_address_get_protocol -#define g_proxy_address_get_type _frida_g_proxy_address_get_type -#define g_proxy_address_get_uri _frida_g_proxy_address_get_uri -#define g_proxy_address_get_username _frida_g_proxy_address_get_username -#define g_proxy_address_new _frida_g_proxy_address_new -#define g_proxy_connect _frida_g_proxy_connect -#define g_proxy_connect_async _frida_g_proxy_connect_async -#define g_proxy_connect_finish _frida_g_proxy_connect_finish -#define g_proxy_get_default_for_protocol _frida_g_proxy_get_default_for_protocol -#define g_proxy_get_type _frida_g_proxy_get_type -#define g_proxy_resolver_get_default _frida_g_proxy_resolver_get_default -#define g_proxy_resolver_get_type _frida_g_proxy_resolver_get_type -#define g_proxy_resolver_is_supported _frida_g_proxy_resolver_is_supported -#define g_proxy_resolver_lookup _frida_g_proxy_resolver_lookup -#define g_proxy_resolver_lookup_async _frida_g_proxy_resolver_lookup_async -#define g_proxy_resolver_lookup_finish _frida_g_proxy_resolver_lookup_finish -#define g_proxy_resolver_portal_get_type _frida_g_proxy_resolver_portal_get_type -#define g_proxy_supports_hostname _frida_g_proxy_supports_hostname -#define g_ptr_array_add _frida_g_ptr_array_add -#define g_ptr_array_copy _frida_g_ptr_array_copy -#define g_ptr_array_extend _frida_g_ptr_array_extend -#define g_ptr_array_extend_and_steal _frida_g_ptr_array_extend_and_steal -#define g_ptr_array_find _frida_g_ptr_array_find -#define g_ptr_array_find_with_equal_func _frida_g_ptr_array_find_with_equal_func -#define g_ptr_array_foreach _frida_g_ptr_array_foreach -#define g_ptr_array_free _frida_g_ptr_array_free -#define g_ptr_array_get_type _frida_g_ptr_array_get_type -#define g_ptr_array_insert _frida_g_ptr_array_insert -#define g_ptr_array_new _frida_g_ptr_array_new -#define g_ptr_array_new_full _frida_g_ptr_array_new_full -#define g_ptr_array_new_with_free_func _frida_g_ptr_array_new_with_free_func -#define g_ptr_array_ref _frida_g_ptr_array_ref -#define g_ptr_array_remove _frida_g_ptr_array_remove -#define g_ptr_array_remove_fast _frida_g_ptr_array_remove_fast -#define g_ptr_array_remove_index _frida_g_ptr_array_remove_index -#define g_ptr_array_remove_index_fast _frida_g_ptr_array_remove_index_fast -#define g_ptr_array_remove_range _frida_g_ptr_array_remove_range -#define g_ptr_array_set_free_func _frida_g_ptr_array_set_free_func -#define g_ptr_array_set_size _frida_g_ptr_array_set_size -#define g_ptr_array_sized_new _frida_g_ptr_array_sized_new -#define g_ptr_array_sort _frida_g_ptr_array_sort -#define g_ptr_array_sort_with_data _frida_g_ptr_array_sort_with_data -#define g_ptr_array_steal _frida_g_ptr_array_steal -#define g_ptr_array_steal_index _frida_g_ptr_array_steal_index -#define g_ptr_array_steal_index_fast _frida_g_ptr_array_steal_index_fast -#define g_ptr_array_unref _frida_g_ptr_array_unref -#define g_qsort_with_data _frida_g_qsort_with_data -#define g_quark_from_static_string _frida_g_quark_from_static_string -#define g_quark_from_string _frida_g_quark_from_string -#define g_quark_init _frida_g_quark_init -#define g_quark_to_string _frida_g_quark_to_string -#define g_quark_try_string _frida_g_quark_try_string -#define g_queue_clear _frida_g_queue_clear -#define g_queue_clear_full _frida_g_queue_clear_full -#define g_queue_copy _frida_g_queue_copy -#define g_queue_delete_link _frida_g_queue_delete_link -#define g_queue_find _frida_g_queue_find -#define g_queue_find_custom _frida_g_queue_find_custom -#define g_queue_foreach _frida_g_queue_foreach -#define g_queue_free _frida_g_queue_free -#define g_queue_free_full _frida_g_queue_free_full -#define g_queue_get_length _frida_g_queue_get_length -#define g_queue_index _frida_g_queue_index -#define g_queue_init _frida_g_queue_init -#define g_queue_insert_after _frida_g_queue_insert_after -#define g_queue_insert_after_link _frida_g_queue_insert_after_link -#define g_queue_insert_before _frida_g_queue_insert_before -#define g_queue_insert_before_link _frida_g_queue_insert_before_link -#define g_queue_insert_sorted _frida_g_queue_insert_sorted -#define g_queue_is_empty _frida_g_queue_is_empty -#define g_queue_link_index _frida_g_queue_link_index -#define g_queue_new _frida_g_queue_new -#define g_queue_peek_head _frida_g_queue_peek_head -#define g_queue_peek_head_link _frida_g_queue_peek_head_link -#define g_queue_peek_nth _frida_g_queue_peek_nth -#define g_queue_peek_nth_link _frida_g_queue_peek_nth_link -#define g_queue_peek_tail _frida_g_queue_peek_tail -#define g_queue_peek_tail_link _frida_g_queue_peek_tail_link -#define g_queue_pop_head _frida_g_queue_pop_head -#define g_queue_pop_head_link _frida_g_queue_pop_head_link -#define g_queue_pop_nth _frida_g_queue_pop_nth -#define g_queue_pop_nth_link _frida_g_queue_pop_nth_link -#define g_queue_pop_tail _frida_g_queue_pop_tail -#define g_queue_pop_tail_link _frida_g_queue_pop_tail_link -#define g_queue_push_head _frida_g_queue_push_head -#define g_queue_push_head_link _frida_g_queue_push_head_link -#define g_queue_push_nth _frida_g_queue_push_nth -#define g_queue_push_nth_link _frida_g_queue_push_nth_link -#define g_queue_push_tail _frida_g_queue_push_tail -#define g_queue_push_tail_link _frida_g_queue_push_tail_link -#define g_queue_remove _frida_g_queue_remove -#define g_queue_remove_all _frida_g_queue_remove_all -#define g_queue_reverse _frida_g_queue_reverse -#define g_queue_sort _frida_g_queue_sort -#define g_queue_unlink _frida_g_queue_unlink -#define g_rand_copy _frida_g_rand_copy -#define g_rand_double _frida_g_rand_double -#define g_rand_double_range _frida_g_rand_double_range -#define g_rand_free _frida_g_rand_free -#define g_rand_int _frida_g_rand_int -#define g_rand_int_range _frida_g_rand_int_range -#define g_rand_new _frida_g_rand_new -#define g_rand_new_with_seed _frida_g_rand_new_with_seed -#define g_rand_new_with_seed_array _frida_g_rand_new_with_seed_array -#define g_rand_set_seed _frida_g_rand_set_seed -#define g_rand_set_seed_array _frida_g_rand_set_seed_array -#define g_random_double _frida_g_random_double -#define g_random_double_range _frida_g_random_double_range -#define g_random_int _frida_g_random_int -#define g_random_int_range _frida_g_random_int_range -#define g_random_set_seed _frida_g_random_set_seed -#define g_rc_box_acquire _frida_g_rc_box_acquire -#define g_rc_box_alloc _frida_g_rc_box_alloc -#define g_rc_box_alloc0 _frida_g_rc_box_alloc0 -#define g_rc_box_alloc_full _frida_g_rc_box_alloc_full -#define g_rc_box_dup _frida_g_rc_box_dup -#define g_rc_box_get_size _frida_g_rc_box_get_size -#define g_rc_box_release _frida_g_rc_box_release -#define g_rc_box_release_full _frida_g_rc_box_release_full -#define g_realloc _frida_g_realloc -#define g_realloc_n _frida_g_realloc_n -#define g_rec_mutex_clear _frida_g_rec_mutex_clear -#define g_rec_mutex_init _frida_g_rec_mutex_init -#define g_rec_mutex_lock _frida_g_rec_mutex_lock -#define g_rec_mutex_trylock _frida_g_rec_mutex_trylock -#define g_rec_mutex_unlock _frida_g_rec_mutex_unlock -#define g_ref_count_compare _frida_g_ref_count_compare -#define g_ref_count_dec _frida_g_ref_count_dec -#define g_ref_count_inc _frida_g_ref_count_inc -#define g_ref_count_init _frida_g_ref_count_init -#define g_ref_string_acquire _frida_g_ref_string_acquire -#define g_ref_string_length _frida_g_ref_string_length -#define g_ref_string_new _frida_g_ref_string_new -#define g_ref_string_new_intern _frida_g_ref_string_new_intern -#define g_ref_string_new_len _frida_g_ref_string_new_len -#define g_ref_string_release _frida_g_ref_string_release -#define g_regex_check_replacement _frida_g_regex_check_replacement -#define g_regex_error_quark _frida_g_regex_error_quark -#define g_regex_escape_nul _frida_g_regex_escape_nul -#define g_regex_escape_string _frida_g_regex_escape_string -#define g_regex_get_capture_count _frida_g_regex_get_capture_count -#define g_regex_get_compile_flags _frida_g_regex_get_compile_flags -#define g_regex_get_has_cr_or_lf _frida_g_regex_get_has_cr_or_lf -#define g_regex_get_match_flags _frida_g_regex_get_match_flags -#define g_regex_get_max_backref _frida_g_regex_get_max_backref -#define g_regex_get_max_lookbehind _frida_g_regex_get_max_lookbehind -#define g_regex_get_pattern _frida_g_regex_get_pattern -#define g_regex_get_string_number _frida_g_regex_get_string_number -#define g_regex_get_type _frida_g_regex_get_type -#define g_regex_match _frida_g_regex_match -#define g_regex_match_all _frida_g_regex_match_all -#define g_regex_match_all_full _frida_g_regex_match_all_full -#define g_regex_match_full _frida_g_regex_match_full -#define g_regex_match_simple _frida_g_regex_match_simple -#define g_regex_new _frida_g_regex_new -#define g_regex_ref _frida_g_regex_ref -#define g_regex_replace _frida_g_regex_replace -#define g_regex_replace_eval _frida_g_regex_replace_eval -#define g_regex_replace_literal _frida_g_regex_replace_literal -#define g_regex_split _frida_g_regex_split -#define g_regex_split_full _frida_g_regex_split_full -#define g_regex_split_simple _frida_g_regex_split_simple -#define g_regex_unref _frida_g_regex_unref -#define g_relation_count _frida_g_relation_count -#define g_relation_delete _frida_g_relation_delete -#define g_relation_destroy _frida_g_relation_destroy -#define g_relation_exists _frida_g_relation_exists -#define g_relation_index _frida_g_relation_index -#define g_relation_insert _frida_g_relation_insert -#define g_relation_new _frida_g_relation_new -#define g_relation_print _frida_g_relation_print -#define g_relation_select _frida_g_relation_select -#define g_reload_user_special_dirs_cache _frida_g_reload_user_special_dirs_cache -#define g_remote_action_group_activate_action_full _frida_g_remote_action_group_activate_action_full -#define g_remote_action_group_change_action_state_full _frida_g_remote_action_group_change_action_state_full -#define g_remote_action_group_get_type _frida_g_remote_action_group_get_type -#define g_remove _frida_g_remove -#define g_rename _frida_g_rename -#define g_resolver_error_get_type _frida_g_resolver_error_get_type -#define g_resolver_error_quark _frida_g_resolver_error_quark -#define g_resolver_free_addresses _frida_g_resolver_free_addresses -#define g_resolver_free_targets _frida_g_resolver_free_targets -#define g_resolver_get_default _frida_g_resolver_get_default -#define g_resolver_get_serial _frida_g_resolver_get_serial -#define g_resolver_get_type _frida_g_resolver_get_type -#define g_resolver_lookup_by_address _frida_g_resolver_lookup_by_address -#define g_resolver_lookup_by_address_async _frida_g_resolver_lookup_by_address_async -#define g_resolver_lookup_by_address_finish _frida_g_resolver_lookup_by_address_finish -#define g_resolver_lookup_by_name _frida_g_resolver_lookup_by_name -#define g_resolver_lookup_by_name_async _frida_g_resolver_lookup_by_name_async -#define g_resolver_lookup_by_name_finish _frida_g_resolver_lookup_by_name_finish -#define g_resolver_lookup_by_name_with_flags _frida_g_resolver_lookup_by_name_with_flags -#define g_resolver_lookup_by_name_with_flags_async _frida_g_resolver_lookup_by_name_with_flags_async -#define g_resolver_lookup_by_name_with_flags_finish _frida_g_resolver_lookup_by_name_with_flags_finish -#define g_resolver_lookup_records _frida_g_resolver_lookup_records -#define g_resolver_lookup_records_async _frida_g_resolver_lookup_records_async -#define g_resolver_lookup_records_finish _frida_g_resolver_lookup_records_finish -#define g_resolver_lookup_service _frida_g_resolver_lookup_service -#define g_resolver_lookup_service_async _frida_g_resolver_lookup_service_async -#define g_resolver_lookup_service_finish _frida_g_resolver_lookup_service_finish -#define g_resolver_name_lookup_flags_get_type _frida_g_resolver_name_lookup_flags_get_type -#define g_resolver_record_type_get_type _frida_g_resolver_record_type_get_type -#define g_resolver_set_default _frida_g_resolver_set_default -#define g_resource_enumerate_children _frida_g_resource_enumerate_children -#define g_resource_error_get_type _frida_g_resource_error_get_type -#define g_resource_error_quark _frida_g_resource_error_quark -#define g_resource_file_monitor_get_type _frida_g_resource_file_monitor_get_type -#define g_resource_flags_get_type _frida_g_resource_flags_get_type -#define g_resource_get_info _frida_g_resource_get_info -#define g_resource_get_type _frida_g_resource_get_type -#define g_resource_load _frida_g_resource_load -#define g_resource_lookup_data _frida_g_resource_lookup_data -#define g_resource_lookup_flags_get_type _frida_g_resource_lookup_flags_get_type -#define g_resource_new_from_data _frida_g_resource_new_from_data -#define g_resource_open_stream _frida_g_resource_open_stream -#define g_resource_ref _frida_g_resource_ref -#define g_resource_unref _frida_g_resource_unref -#define g_resources_enumerate_children _frida_g_resources_enumerate_children -#define g_resources_get_info _frida_g_resources_get_info -#define g_resources_lookup_data _frida_g_resources_lookup_data -#define g_resources_open_stream _frida_g_resources_open_stream -#define g_resources_register _frida_g_resources_register -#define g_resources_unregister _frida_g_resources_unregister -#define g_return_if_fail_warning _frida_g_return_if_fail_warning -#define g_rmdir _frida_g_rmdir -#define g_rw_lock_clear _frida_g_rw_lock_clear -#define g_rw_lock_init _frida_g_rw_lock_init -#define g_rw_lock_reader_lock _frida_g_rw_lock_reader_lock -#define g_rw_lock_reader_trylock _frida_g_rw_lock_reader_trylock -#define g_rw_lock_reader_unlock _frida_g_rw_lock_reader_unlock -#define g_rw_lock_writer_lock _frida_g_rw_lock_writer_lock -#define g_rw_lock_writer_trylock _frida_g_rw_lock_writer_trylock -#define g_rw_lock_writer_unlock _frida_g_rw_lock_writer_unlock -#define g_scanner_cur_line _frida_g_scanner_cur_line -#define g_scanner_cur_position _frida_g_scanner_cur_position -#define g_scanner_cur_token _frida_g_scanner_cur_token -#define g_scanner_cur_value _frida_g_scanner_cur_value -#define g_scanner_destroy _frida_g_scanner_destroy -#define g_scanner_eof _frida_g_scanner_eof -#define g_scanner_error _frida_g_scanner_error -#define g_scanner_get_next_token _frida_g_scanner_get_next_token -#define g_scanner_input_file _frida_g_scanner_input_file -#define g_scanner_input_text _frida_g_scanner_input_text -#define g_scanner_lookup_symbol _frida_g_scanner_lookup_symbol -#define g_scanner_new _frida_g_scanner_new -#define g_scanner_peek_next_token _frida_g_scanner_peek_next_token -#define g_scanner_scope_add_symbol _frida_g_scanner_scope_add_symbol -#define g_scanner_scope_foreach_symbol _frida_g_scanner_scope_foreach_symbol -#define g_scanner_scope_lookup_symbol _frida_g_scanner_scope_lookup_symbol -#define g_scanner_scope_remove_symbol _frida_g_scanner_scope_remove_symbol -#define g_scanner_set_scope _frida_g_scanner_set_scope -#define g_scanner_sync_file_offset _frida_g_scanner_sync_file_offset -#define g_scanner_unexp_token _frida_g_scanner_unexp_token -#define g_scanner_warn _frida_g_scanner_warn -#define g_seekable_can_seek _frida_g_seekable_can_seek -#define g_seekable_can_truncate _frida_g_seekable_can_truncate -#define g_seekable_get_type _frida_g_seekable_get_type -#define g_seekable_seek _frida_g_seekable_seek -#define g_seekable_tell _frida_g_seekable_tell -#define g_seekable_truncate _frida_g_seekable_truncate -#define g_sequence_append _frida_g_sequence_append -#define g_sequence_foreach _frida_g_sequence_foreach -#define g_sequence_foreach_range _frida_g_sequence_foreach_range -#define g_sequence_free _frida_g_sequence_free -#define g_sequence_get _frida_g_sequence_get -#define g_sequence_get_begin_iter _frida_g_sequence_get_begin_iter -#define g_sequence_get_end_iter _frida_g_sequence_get_end_iter -#define g_sequence_get_iter_at_pos _frida_g_sequence_get_iter_at_pos -#define g_sequence_get_length _frida_g_sequence_get_length -#define g_sequence_insert_before _frida_g_sequence_insert_before -#define g_sequence_insert_sorted _frida_g_sequence_insert_sorted -#define g_sequence_insert_sorted_iter _frida_g_sequence_insert_sorted_iter -#define g_sequence_is_empty _frida_g_sequence_is_empty -#define g_sequence_iter_compare _frida_g_sequence_iter_compare -#define g_sequence_iter_get_position _frida_g_sequence_iter_get_position -#define g_sequence_iter_get_sequence _frida_g_sequence_iter_get_sequence -#define g_sequence_iter_is_begin _frida_g_sequence_iter_is_begin -#define g_sequence_iter_is_end _frida_g_sequence_iter_is_end -#define g_sequence_iter_move _frida_g_sequence_iter_move -#define g_sequence_iter_next _frida_g_sequence_iter_next -#define g_sequence_iter_prev _frida_g_sequence_iter_prev -#define g_sequence_lookup _frida_g_sequence_lookup -#define g_sequence_lookup_iter _frida_g_sequence_lookup_iter -#define g_sequence_move _frida_g_sequence_move -#define g_sequence_move_range _frida_g_sequence_move_range -#define g_sequence_new _frida_g_sequence_new -#define g_sequence_prepend _frida_g_sequence_prepend -#define g_sequence_range_get_midpoint _frida_g_sequence_range_get_midpoint -#define g_sequence_remove _frida_g_sequence_remove -#define g_sequence_remove_range _frida_g_sequence_remove_range -#define g_sequence_search _frida_g_sequence_search -#define g_sequence_search_iter _frida_g_sequence_search_iter -#define g_sequence_set _frida_g_sequence_set -#define g_sequence_sort _frida_g_sequence_sort -#define g_sequence_sort_changed _frida_g_sequence_sort_changed -#define g_sequence_sort_changed_iter _frida_g_sequence_sort_changed_iter -#define g_sequence_sort_iter _frida_g_sequence_sort_iter -#define g_sequence_swap _frida_g_sequence_swap -#define g_set_application_name _frida_g_set_application_name -#define g_set_error _frida_g_set_error -#define g_set_error_literal _frida_g_set_error_literal -#define g_set_prgname _frida_g_set_prgname -#define g_set_print_handler _frida_g_set_print_handler -#define g_set_printerr_handler _frida_g_set_printerr_handler -#define g_set_user_dirs _frida_g_set_user_dirs -#define g_setenv _frida_g_setenv -#define g_settings_apply _frida_g_settings_apply -#define g_settings_backend_changed _frida_g_settings_backend_changed -#define g_settings_backend_changed_tree _frida_g_settings_backend_changed_tree -#define g_settings_backend_create_tree _frida_g_settings_backend_create_tree -#define g_settings_backend_flatten_tree _frida_g_settings_backend_flatten_tree -#define g_settings_backend_get_default _frida_g_settings_backend_get_default -#define g_settings_backend_get_permission _frida_g_settings_backend_get_permission -#define g_settings_backend_get_type _frida_g_settings_backend_get_type -#define g_settings_backend_get_writable _frida_g_settings_backend_get_writable -#define g_settings_backend_keys_changed _frida_g_settings_backend_keys_changed -#define g_settings_backend_path_changed _frida_g_settings_backend_path_changed -#define g_settings_backend_path_writable_changed _frida_g_settings_backend_path_writable_changed -#define g_settings_backend_read _frida_g_settings_backend_read -#define g_settings_backend_read_user_value _frida_g_settings_backend_read_user_value -#define g_settings_backend_reset _frida_g_settings_backend_reset -#define g_settings_backend_subscribe _frida_g_settings_backend_subscribe -#define g_settings_backend_sync_default _frida_g_settings_backend_sync_default -#define g_settings_backend_unsubscribe _frida_g_settings_backend_unsubscribe -#define g_settings_backend_unwatch _frida_g_settings_backend_unwatch -#define g_settings_backend_watch _frida_g_settings_backend_watch -#define g_settings_backend_writable_changed _frida_g_settings_backend_writable_changed -#define g_settings_backend_write _frida_g_settings_backend_write -#define g_settings_backend_write_tree _frida_g_settings_backend_write_tree -#define g_settings_bind _frida_g_settings_bind -#define g_settings_bind_flags_get_type _frida_g_settings_bind_flags_get_type -#define g_settings_bind_with_mapping _frida_g_settings_bind_with_mapping -#define g_settings_bind_writable _frida_g_settings_bind_writable -#define g_settings_create_action _frida_g_settings_create_action -#define g_settings_delay _frida_g_settings_delay -#define g_settings_get _frida_g_settings_get -#define g_settings_get_boolean _frida_g_settings_get_boolean -#define g_settings_get_child _frida_g_settings_get_child -#define g_settings_get_default_value _frida_g_settings_get_default_value -#define g_settings_get_double _frida_g_settings_get_double -#define g_settings_get_enum _frida_g_settings_get_enum -#define g_settings_get_flags _frida_g_settings_get_flags -#define g_settings_get_has_unapplied _frida_g_settings_get_has_unapplied -#define g_settings_get_int _frida_g_settings_get_int -#define g_settings_get_int64 _frida_g_settings_get_int64 -#define g_settings_get_mapped _frida_g_settings_get_mapped -#define g_settings_get_mapping _frida_g_settings_get_mapping -#define g_settings_get_range _frida_g_settings_get_range -#define g_settings_get_string _frida_g_settings_get_string -#define g_settings_get_strv _frida_g_settings_get_strv -#define g_settings_get_type _frida_g_settings_get_type -#define g_settings_get_uint _frida_g_settings_get_uint -#define g_settings_get_uint64 _frida_g_settings_get_uint64 -#define g_settings_get_user_value _frida_g_settings_get_user_value -#define g_settings_get_value _frida_g_settings_get_value -#define g_settings_is_writable _frida_g_settings_is_writable -#define g_settings_list_children _frida_g_settings_list_children -#define g_settings_list_keys _frida_g_settings_list_keys -#define g_settings_list_relocatable_schemas _frida_g_settings_list_relocatable_schemas -#define g_settings_list_schemas _frida_g_settings_list_schemas -#define g_settings_mapping_is_compatible _frida_g_settings_mapping_is_compatible -#define g_settings_new _frida_g_settings_new -#define g_settings_new_full _frida_g_settings_new_full -#define g_settings_new_with_backend _frida_g_settings_new_with_backend -#define g_settings_new_with_backend_and_path _frida_g_settings_new_with_backend_and_path -#define g_settings_new_with_path _frida_g_settings_new_with_path -#define g_settings_range_check _frida_g_settings_range_check -#define g_settings_reset _frida_g_settings_reset -#define g_settings_revert _frida_g_settings_revert -#define g_settings_schema_get_gettext_domain _frida_g_settings_schema_get_gettext_domain -#define g_settings_schema_get_id _frida_g_settings_schema_get_id -#define g_settings_schema_get_key _frida_g_settings_schema_get_key -#define g_settings_schema_get_path _frida_g_settings_schema_get_path -#define g_settings_schema_get_string _frida_g_settings_schema_get_string -#define g_settings_schema_get_type _frida_g_settings_schema_get_type -#define g_settings_schema_get_value _frida_g_settings_schema_get_value -#define g_settings_schema_has_key _frida_g_settings_schema_has_key -#define g_settings_schema_key_clear _frida_g_settings_schema_key_clear -#define g_settings_schema_key_from_enum _frida_g_settings_schema_key_from_enum -#define g_settings_schema_key_from_flags _frida_g_settings_schema_key_from_flags -#define g_settings_schema_key_get_default_value _frida_g_settings_schema_key_get_default_value -#define g_settings_schema_key_get_description _frida_g_settings_schema_key_get_description -#define g_settings_schema_key_get_name _frida_g_settings_schema_key_get_name -#define g_settings_schema_key_get_per_desktop_default _frida_g_settings_schema_key_get_per_desktop_default -#define g_settings_schema_key_get_range _frida_g_settings_schema_key_get_range -#define g_settings_schema_key_get_summary _frida_g_settings_schema_key_get_summary -#define g_settings_schema_key_get_translated_default _frida_g_settings_schema_key_get_translated_default -#define g_settings_schema_key_get_type _frida_g_settings_schema_key_get_type -#define g_settings_schema_key_get_value_type _frida_g_settings_schema_key_get_value_type -#define g_settings_schema_key_init _frida_g_settings_schema_key_init -#define g_settings_schema_key_range_check _frida_g_settings_schema_key_range_check -#define g_settings_schema_key_range_fixup _frida_g_settings_schema_key_range_fixup -#define g_settings_schema_key_ref _frida_g_settings_schema_key_ref -#define g_settings_schema_key_to_enum _frida_g_settings_schema_key_to_enum -#define g_settings_schema_key_to_flags _frida_g_settings_schema_key_to_flags -#define g_settings_schema_key_type_check _frida_g_settings_schema_key_type_check -#define g_settings_schema_key_unref _frida_g_settings_schema_key_unref -#define g_settings_schema_list _frida_g_settings_schema_list -#define g_settings_schema_list_children _frida_g_settings_schema_list_children -#define g_settings_schema_list_keys _frida_g_settings_schema_list_keys -#define g_settings_schema_ref _frida_g_settings_schema_ref -#define g_settings_schema_source_get_default _frida_g_settings_schema_source_get_default -#define g_settings_schema_source_get_type _frida_g_settings_schema_source_get_type -#define g_settings_schema_source_list_schemas _frida_g_settings_schema_source_list_schemas -#define g_settings_schema_source_lookup _frida_g_settings_schema_source_lookup -#define g_settings_schema_source_new_from_directory _frida_g_settings_schema_source_new_from_directory -#define g_settings_schema_source_ref _frida_g_settings_schema_source_ref -#define g_settings_schema_source_unref _frida_g_settings_schema_source_unref -#define g_settings_schema_unref _frida_g_settings_schema_unref -#define g_settings_set _frida_g_settings_set -#define g_settings_set_boolean _frida_g_settings_set_boolean -#define g_settings_set_double _frida_g_settings_set_double -#define g_settings_set_enum _frida_g_settings_set_enum -#define g_settings_set_flags _frida_g_settings_set_flags -#define g_settings_set_int _frida_g_settings_set_int -#define g_settings_set_int64 _frida_g_settings_set_int64 -#define g_settings_set_mapping _frida_g_settings_set_mapping -#define g_settings_set_string _frida_g_settings_set_string -#define g_settings_set_strv _frida_g_settings_set_strv -#define g_settings_set_uint _frida_g_settings_set_uint -#define g_settings_set_uint64 _frida_g_settings_set_uint64 -#define g_settings_set_value _frida_g_settings_set_value -#define g_settings_sync _frida_g_settings_sync -#define g_settings_unbind _frida_g_settings_unbind -#define g_shell_error_quark _frida_g_shell_error_quark -#define g_shell_parse_argv _frida_g_shell_parse_argv -#define g_shell_quote _frida_g_shell_quote -#define g_shell_unquote _frida_g_shell_unquote -#define g_signal_accumulator_first_wins _frida_g_signal_accumulator_first_wins -#define g_signal_accumulator_true_handled _frida_g_signal_accumulator_true_handled -#define g_signal_add_emission_hook _frida_g_signal_add_emission_hook -#define g_signal_chain_from_overridden _frida_g_signal_chain_from_overridden -#define g_signal_chain_from_overridden_handler _frida_g_signal_chain_from_overridden_handler -#define g_signal_connect_closure _frida_g_signal_connect_closure -#define g_signal_connect_closure_by_id _frida_g_signal_connect_closure_by_id -#define g_signal_connect_data _frida_g_signal_connect_data -#define g_signal_connect_object _frida_g_signal_connect_object -#define g_signal_emit _frida_g_signal_emit -#define g_signal_emit_by_name _frida_g_signal_emit_by_name -#define g_signal_emit_valist _frida_g_signal_emit_valist -#define g_signal_emitv _frida_g_signal_emitv -#define g_signal_get_invocation_hint _frida_g_signal_get_invocation_hint -#define g_signal_handler_block _frida_g_signal_handler_block -#define g_signal_handler_disconnect _frida_g_signal_handler_disconnect -#define g_signal_handler_find _frida_g_signal_handler_find -#define g_signal_handler_is_connected _frida_g_signal_handler_is_connected -#define g_signal_handler_unblock _frida_g_signal_handler_unblock -#define g_signal_handlers_block_matched _frida_g_signal_handlers_block_matched -#define g_signal_handlers_destroy _frida_g_signal_handlers_destroy -#define g_signal_handlers_disconnect_matched _frida_g_signal_handlers_disconnect_matched -#define g_signal_handlers_unblock_matched _frida_g_signal_handlers_unblock_matched -#define g_signal_has_handler_pending _frida_g_signal_has_handler_pending -#define g_signal_is_valid_name _frida_g_signal_is_valid_name -#define g_signal_list_ids _frida_g_signal_list_ids -#define g_signal_lookup _frida_g_signal_lookup -#define g_signal_name _frida_g_signal_name -#define g_signal_new _frida_g_signal_new -#define g_signal_new_class_handler _frida_g_signal_new_class_handler -#define g_signal_new_valist _frida_g_signal_new_valist -#define g_signal_newv _frida_g_signal_newv -#define g_signal_override_class_closure _frida_g_signal_override_class_closure -#define g_signal_override_class_handler _frida_g_signal_override_class_handler -#define g_signal_parse_name _frida_g_signal_parse_name -#define g_signal_query _frida_g_signal_query -#define g_signal_remove_emission_hook _frida_g_signal_remove_emission_hook -#define g_signal_set_va_marshaller _frida_g_signal_set_va_marshaller -#define g_signal_stop_emission _frida_g_signal_stop_emission -#define g_signal_stop_emission_by_name _frida_g_signal_stop_emission_by_name -#define g_signal_type_cclosure_new _frida_g_signal_type_cclosure_new -#define g_simple_action_get_type _frida_g_simple_action_get_type -#define g_simple_action_group_add_entries _frida_g_simple_action_group_add_entries -#define g_simple_action_group_get_type _frida_g_simple_action_group_get_type -#define g_simple_action_group_insert _frida_g_simple_action_group_insert -#define g_simple_action_group_lookup _frida_g_simple_action_group_lookup -#define g_simple_action_group_new _frida_g_simple_action_group_new -#define g_simple_action_group_remove _frida_g_simple_action_group_remove -#define g_simple_action_new _frida_g_simple_action_new -#define g_simple_action_new_stateful _frida_g_simple_action_new_stateful -#define g_simple_action_set_enabled _frida_g_simple_action_set_enabled -#define g_simple_action_set_state _frida_g_simple_action_set_state -#define g_simple_action_set_state_hint _frida_g_simple_action_set_state_hint -#define g_simple_async_report_error_in_idle _frida_g_simple_async_report_error_in_idle -#define g_simple_async_report_gerror_in_idle _frida_g_simple_async_report_gerror_in_idle -#define g_simple_async_report_take_gerror_in_idle _frida_g_simple_async_report_take_gerror_in_idle -#define g_simple_async_result_complete _frida_g_simple_async_result_complete -#define g_simple_async_result_complete_in_idle _frida_g_simple_async_result_complete_in_idle -#define g_simple_async_result_get_op_res_gboolean _frida_g_simple_async_result_get_op_res_gboolean -#define g_simple_async_result_get_op_res_gpointer _frida_g_simple_async_result_get_op_res_gpointer -#define g_simple_async_result_get_op_res_gssize _frida_g_simple_async_result_get_op_res_gssize -#define g_simple_async_result_get_source_tag _frida_g_simple_async_result_get_source_tag -#define g_simple_async_result_get_type _frida_g_simple_async_result_get_type -#define g_simple_async_result_is_valid _frida_g_simple_async_result_is_valid -#define g_simple_async_result_new _frida_g_simple_async_result_new -#define g_simple_async_result_new_error _frida_g_simple_async_result_new_error -#define g_simple_async_result_new_from_error _frida_g_simple_async_result_new_from_error -#define g_simple_async_result_new_take_error _frida_g_simple_async_result_new_take_error -#define g_simple_async_result_propagate_error _frida_g_simple_async_result_propagate_error -#define g_simple_async_result_run_in_thread _frida_g_simple_async_result_run_in_thread -#define g_simple_async_result_set_check_cancellable _frida_g_simple_async_result_set_check_cancellable -#define g_simple_async_result_set_error _frida_g_simple_async_result_set_error -#define g_simple_async_result_set_error_va _frida_g_simple_async_result_set_error_va -#define g_simple_async_result_set_from_error _frida_g_simple_async_result_set_from_error -#define g_simple_async_result_set_handle_cancellation _frida_g_simple_async_result_set_handle_cancellation -#define g_simple_async_result_set_op_res_gboolean _frida_g_simple_async_result_set_op_res_gboolean -#define g_simple_async_result_set_op_res_gpointer _frida_g_simple_async_result_set_op_res_gpointer -#define g_simple_async_result_set_op_res_gssize _frida_g_simple_async_result_set_op_res_gssize -#define g_simple_async_result_take_error _frida_g_simple_async_result_take_error -#define g_simple_io_stream_get_type _frida_g_simple_io_stream_get_type -#define g_simple_io_stream_new _frida_g_simple_io_stream_new -#define g_simple_permission_get_type _frida_g_simple_permission_get_type -#define g_simple_permission_new _frida_g_simple_permission_new -#define g_simple_proxy_resolver_get_type _frida_g_simple_proxy_resolver_get_type -#define g_simple_proxy_resolver_new _frida_g_simple_proxy_resolver_new -#define g_simple_proxy_resolver_set_default_proxy _frida_g_simple_proxy_resolver_set_default_proxy -#define g_simple_proxy_resolver_set_ignore_hosts _frida_g_simple_proxy_resolver_set_ignore_hosts -#define g_simple_proxy_resolver_set_uri_proxy _frida_g_simple_proxy_resolver_set_uri_proxy -#define g_slice_alloc _frida_g_slice_alloc -#define g_slice_alloc0 _frida_g_slice_alloc0 -#define g_slice_copy _frida_g_slice_copy -#define g_slice_free1 _frida_g_slice_free1 -#define g_slice_free_chain_with_offset _frida_g_slice_free_chain_with_offset -#define g_slice_get_config _frida_g_slice_get_config -#define g_slice_get_config_state _frida_g_slice_get_config_state -#define g_slice_set_config _frida_g_slice_set_config -#define g_slist_alloc _frida_g_slist_alloc -#define g_slist_append _frida_g_slist_append -#define g_slist_concat _frida_g_slist_concat -#define g_slist_copy _frida_g_slist_copy -#define g_slist_copy_deep _frida_g_slist_copy_deep -#define g_slist_delete_link _frida_g_slist_delete_link -#define g_slist_find _frida_g_slist_find -#define g_slist_find_custom _frida_g_slist_find_custom -#define g_slist_foreach _frida_g_slist_foreach -#define g_slist_free _frida_g_slist_free -#define g_slist_free_1 _frida_g_slist_free_1 -#define g_slist_free_full _frida_g_slist_free_full -#define g_slist_index _frida_g_slist_index -#define g_slist_insert _frida_g_slist_insert -#define g_slist_insert_before _frida_g_slist_insert_before -#define g_slist_insert_sorted _frida_g_slist_insert_sorted -#define g_slist_insert_sorted_with_data _frida_g_slist_insert_sorted_with_data -#define g_slist_last _frida_g_slist_last -#define g_slist_length _frida_g_slist_length -#define g_slist_nth _frida_g_slist_nth -#define g_slist_nth_data _frida_g_slist_nth_data -#define g_slist_pop_allocator _frida_g_slist_pop_allocator -#define g_slist_position _frida_g_slist_position -#define g_slist_prepend _frida_g_slist_prepend -#define g_slist_push_allocator _frida_g_slist_push_allocator -#define g_slist_remove _frida_g_slist_remove -#define g_slist_remove_all _frida_g_slist_remove_all -#define g_slist_remove_link _frida_g_slist_remove_link -#define g_slist_reverse _frida_g_slist_reverse -#define g_slist_sort _frida_g_slist_sort -#define g_slist_sort_with_data _frida_g_slist_sort_with_data -#define g_snprintf _frida_g_snprintf -#define g_socket _frida_g_socket -#define g_socket_accept _frida_g_socket_accept -#define g_socket_address_enumerator_get_type _frida_g_socket_address_enumerator_get_type -#define g_socket_address_enumerator_next _frida_g_socket_address_enumerator_next -#define g_socket_address_enumerator_next_async _frida_g_socket_address_enumerator_next_async -#define g_socket_address_enumerator_next_finish _frida_g_socket_address_enumerator_next_finish -#define g_socket_address_get_family _frida_g_socket_address_get_family -#define g_socket_address_get_native_size _frida_g_socket_address_get_native_size -#define g_socket_address_get_type _frida_g_socket_address_get_type -#define g_socket_address_new_from_native _frida_g_socket_address_new_from_native -#define g_socket_address_to_native _frida_g_socket_address_to_native -#define g_socket_bind _frida_g_socket_bind -#define g_socket_check_connect_result _frida_g_socket_check_connect_result -#define g_socket_client_add_application_proxy _frida_g_socket_client_add_application_proxy -#define g_socket_client_connect _frida_g_socket_client_connect -#define g_socket_client_connect_async _frida_g_socket_client_connect_async -#define g_socket_client_connect_finish _frida_g_socket_client_connect_finish -#define g_socket_client_connect_to_host _frida_g_socket_client_connect_to_host -#define g_socket_client_connect_to_host_async _frida_g_socket_client_connect_to_host_async -#define g_socket_client_connect_to_host_finish _frida_g_socket_client_connect_to_host_finish -#define g_socket_client_connect_to_service _frida_g_socket_client_connect_to_service -#define g_socket_client_connect_to_service_async _frida_g_socket_client_connect_to_service_async -#define g_socket_client_connect_to_service_finish _frida_g_socket_client_connect_to_service_finish -#define g_socket_client_connect_to_uri _frida_g_socket_client_connect_to_uri -#define g_socket_client_connect_to_uri_async _frida_g_socket_client_connect_to_uri_async -#define g_socket_client_connect_to_uri_finish _frida_g_socket_client_connect_to_uri_finish -#define g_socket_client_event_get_type _frida_g_socket_client_event_get_type -#define g_socket_client_get_enable_proxy _frida_g_socket_client_get_enable_proxy -#define g_socket_client_get_family _frida_g_socket_client_get_family -#define g_socket_client_get_local_address _frida_g_socket_client_get_local_address -#define g_socket_client_get_protocol _frida_g_socket_client_get_protocol -#define g_socket_client_get_proxy_resolver _frida_g_socket_client_get_proxy_resolver -#define g_socket_client_get_socket_type _frida_g_socket_client_get_socket_type -#define g_socket_client_get_timeout _frida_g_socket_client_get_timeout -#define g_socket_client_get_tls _frida_g_socket_client_get_tls -#define g_socket_client_get_tls_validation_flags _frida_g_socket_client_get_tls_validation_flags -#define g_socket_client_get_type _frida_g_socket_client_get_type -#define g_socket_client_new _frida_g_socket_client_new -#define g_socket_client_set_enable_proxy _frida_g_socket_client_set_enable_proxy -#define g_socket_client_set_family _frida_g_socket_client_set_family -#define g_socket_client_set_local_address _frida_g_socket_client_set_local_address -#define g_socket_client_set_protocol _frida_g_socket_client_set_protocol -#define g_socket_client_set_proxy_resolver _frida_g_socket_client_set_proxy_resolver -#define g_socket_client_set_socket_type _frida_g_socket_client_set_socket_type -#define g_socket_client_set_timeout _frida_g_socket_client_set_timeout -#define g_socket_client_set_tls _frida_g_socket_client_set_tls -#define g_socket_client_set_tls_validation_flags _frida_g_socket_client_set_tls_validation_flags -#define g_socket_close _frida_g_socket_close -#define g_socket_condition_check _frida_g_socket_condition_check -#define g_socket_condition_timed_wait _frida_g_socket_condition_timed_wait -#define g_socket_condition_wait _frida_g_socket_condition_wait -#define g_socket_connect _frida_g_socket_connect -#define g_socket_connectable_enumerate _frida_g_socket_connectable_enumerate -#define g_socket_connectable_get_type _frida_g_socket_connectable_get_type -#define g_socket_connectable_proxy_enumerate _frida_g_socket_connectable_proxy_enumerate -#define g_socket_connectable_to_string _frida_g_socket_connectable_to_string -#define g_socket_connection_connect _frida_g_socket_connection_connect -#define g_socket_connection_connect_async _frida_g_socket_connection_connect_async -#define g_socket_connection_connect_finish _frida_g_socket_connection_connect_finish -#define g_socket_connection_factory_create_connection _frida_g_socket_connection_factory_create_connection -#define g_socket_connection_factory_lookup_type _frida_g_socket_connection_factory_lookup_type -#define g_socket_connection_factory_register_type _frida_g_socket_connection_factory_register_type -#define g_socket_connection_get_local_address _frida_g_socket_connection_get_local_address -#define g_socket_connection_get_remote_address _frida_g_socket_connection_get_remote_address -#define g_socket_connection_get_socket _frida_g_socket_connection_get_socket -#define g_socket_connection_get_type _frida_g_socket_connection_get_type -#define g_socket_connection_is_connected _frida_g_socket_connection_is_connected -#define g_socket_connection_set_cached_remote_address _frida_g_socket_connection_set_cached_remote_address -#define g_socket_control_message_deserialize _frida_g_socket_control_message_deserialize -#define g_socket_control_message_get_level _frida_g_socket_control_message_get_level -#define g_socket_control_message_get_msg_type _frida_g_socket_control_message_get_msg_type -#define g_socket_control_message_get_size _frida_g_socket_control_message_get_size -#define g_socket_control_message_get_type _frida_g_socket_control_message_get_type -#define g_socket_control_message_serialize _frida_g_socket_control_message_serialize -#define g_socket_create_source _frida_g_socket_create_source -#define g_socket_family_get_type _frida_g_socket_family_get_type -#define g_socket_get_available_bytes _frida_g_socket_get_available_bytes -#define g_socket_get_blocking _frida_g_socket_get_blocking -#define g_socket_get_broadcast _frida_g_socket_get_broadcast -#define g_socket_get_credentials _frida_g_socket_get_credentials -#define g_socket_get_family _frida_g_socket_get_family -#define g_socket_get_fd _frida_g_socket_get_fd -#define g_socket_get_keepalive _frida_g_socket_get_keepalive -#define g_socket_get_listen_backlog _frida_g_socket_get_listen_backlog -#define g_socket_get_local_address _frida_g_socket_get_local_address -#define g_socket_get_multicast_loopback _frida_g_socket_get_multicast_loopback -#define g_socket_get_multicast_ttl _frida_g_socket_get_multicast_ttl -#define g_socket_get_option _frida_g_socket_get_option -#define g_socket_get_protocol _frida_g_socket_get_protocol -#define g_socket_get_remote_address _frida_g_socket_get_remote_address -#define g_socket_get_socket_type _frida_g_socket_get_socket_type -#define g_socket_get_timeout _frida_g_socket_get_timeout -#define g_socket_get_ttl _frida_g_socket_get_ttl -#define g_socket_get_type _frida_g_socket_get_type -#define g_socket_is_closed _frida_g_socket_is_closed -#define g_socket_is_connected _frida_g_socket_is_connected -#define g_socket_join_multicast_group _frida_g_socket_join_multicast_group -#define g_socket_join_multicast_group_ssm _frida_g_socket_join_multicast_group_ssm -#define g_socket_leave_multicast_group _frida_g_socket_leave_multicast_group -#define g_socket_leave_multicast_group_ssm _frida_g_socket_leave_multicast_group_ssm -#define g_socket_listen _frida_g_socket_listen -#define g_socket_listener_accept _frida_g_socket_listener_accept -#define g_socket_listener_accept_async _frida_g_socket_listener_accept_async -#define g_socket_listener_accept_finish _frida_g_socket_listener_accept_finish -#define g_socket_listener_accept_socket _frida_g_socket_listener_accept_socket -#define g_socket_listener_accept_socket_async _frida_g_socket_listener_accept_socket_async -#define g_socket_listener_accept_socket_finish _frida_g_socket_listener_accept_socket_finish -#define g_socket_listener_add_address _frida_g_socket_listener_add_address -#define g_socket_listener_add_any_inet_port _frida_g_socket_listener_add_any_inet_port -#define g_socket_listener_add_inet_port _frida_g_socket_listener_add_inet_port -#define g_socket_listener_add_socket _frida_g_socket_listener_add_socket -#define g_socket_listener_close _frida_g_socket_listener_close -#define g_socket_listener_event_get_type _frida_g_socket_listener_event_get_type -#define g_socket_listener_get_type _frida_g_socket_listener_get_type -#define g_socket_listener_new _frida_g_socket_listener_new -#define g_socket_listener_set_backlog _frida_g_socket_listener_set_backlog -#define g_socket_msg_flags_get_type _frida_g_socket_msg_flags_get_type -#define g_socket_new _frida_g_socket_new -#define g_socket_new_from_fd _frida_g_socket_new_from_fd -#define g_socket_protocol_get_type _frida_g_socket_protocol_get_type -#define g_socket_receive _frida_g_socket_receive -#define g_socket_receive_from _frida_g_socket_receive_from -#define g_socket_receive_message _frida_g_socket_receive_message -#define g_socket_receive_messages _frida_g_socket_receive_messages -#define g_socket_receive_with_blocking _frida_g_socket_receive_with_blocking -#define g_socket_send _frida_g_socket_send -#define g_socket_send_message _frida_g_socket_send_message -#define g_socket_send_message_with_timeout _frida_g_socket_send_message_with_timeout -#define g_socket_send_messages _frida_g_socket_send_messages -#define g_socket_send_to _frida_g_socket_send_to -#define g_socket_send_with_blocking _frida_g_socket_send_with_blocking -#define g_socket_service_get_type _frida_g_socket_service_get_type -#define g_socket_service_is_active _frida_g_socket_service_is_active -#define g_socket_service_new _frida_g_socket_service_new -#define g_socket_service_start _frida_g_socket_service_start -#define g_socket_service_stop _frida_g_socket_service_stop -#define g_socket_set_blocking _frida_g_socket_set_blocking -#define g_socket_set_broadcast _frida_g_socket_set_broadcast -#define g_socket_set_keepalive _frida_g_socket_set_keepalive -#define g_socket_set_listen_backlog _frida_g_socket_set_listen_backlog -#define g_socket_set_multicast_loopback _frida_g_socket_set_multicast_loopback -#define g_socket_set_multicast_ttl _frida_g_socket_set_multicast_ttl -#define g_socket_set_option _frida_g_socket_set_option -#define g_socket_set_timeout _frida_g_socket_set_timeout -#define g_socket_set_ttl _frida_g_socket_set_ttl -#define g_socket_shutdown _frida_g_socket_shutdown -#define g_socket_speaks_ipv4 _frida_g_socket_speaks_ipv4 -#define g_socket_type_get_type _frida_g_socket_type_get_type -#define g_source_add_child_source _frida_g_source_add_child_source -#define g_source_add_poll _frida_g_source_add_poll -#define g_source_add_unix_fd _frida_g_source_add_unix_fd -#define g_source_attach _frida_g_source_attach -#define g_source_destroy _frida_g_source_destroy -#define g_source_get_can_recurse _frida_g_source_get_can_recurse -#define g_source_get_context _frida_g_source_get_context -#define g_source_get_current_time _frida_g_source_get_current_time -#define g_source_get_id _frida_g_source_get_id -#define g_source_get_name _frida_g_source_get_name -#define g_source_get_priority _frida_g_source_get_priority -#define g_source_get_ready_time _frida_g_source_get_ready_time -#define g_source_get_time _frida_g_source_get_time -#define g_source_get_type _frida_g_source_get_type -#define g_source_is_destroyed _frida_g_source_is_destroyed -#define g_source_modify_unix_fd _frida_g_source_modify_unix_fd -#define g_source_new _frida_g_source_new -#define g_source_query_unix_fd _frida_g_source_query_unix_fd -#define g_source_ref _frida_g_source_ref -#define g_source_remove _frida_g_source_remove -#define g_source_remove_by_funcs_user_data _frida_g_source_remove_by_funcs_user_data -#define g_source_remove_by_user_data _frida_g_source_remove_by_user_data -#define g_source_remove_child_source _frida_g_source_remove_child_source -#define g_source_remove_poll _frida_g_source_remove_poll -#define g_source_remove_unix_fd _frida_g_source_remove_unix_fd -#define g_source_set_callback _frida_g_source_set_callback -#define g_source_set_callback_indirect _frida_g_source_set_callback_indirect -#define g_source_set_can_recurse _frida_g_source_set_can_recurse -#define g_source_set_closure _frida_g_source_set_closure -#define g_source_set_dispose_function _frida_g_source_set_dispose_function -#define g_source_set_dummy_callback _frida_g_source_set_dummy_callback -#define g_source_set_funcs _frida_g_source_set_funcs -#define g_source_set_name _frida_g_source_set_name -#define g_source_set_name_by_id _frida_g_source_set_name_by_id -#define g_source_set_priority _frida_g_source_set_priority -#define g_source_set_ready_time _frida_g_source_set_ready_time -#define g_source_unref _frida_g_source_unref -#define g_spaced_primes_closest _frida_g_spaced_primes_closest -#define g_spawn_async _frida_g_spawn_async -#define g_spawn_async_with_fds _frida_g_spawn_async_with_fds -#define g_spawn_async_with_pipes _frida_g_spawn_async_with_pipes -#define g_spawn_check_exit_status _frida_g_spawn_check_exit_status -#define g_spawn_close_pid _frida_g_spawn_close_pid -#define g_spawn_command_line_async _frida_g_spawn_command_line_async -#define g_spawn_command_line_sync _frida_g_spawn_command_line_sync -#define g_spawn_error_quark _frida_g_spawn_error_quark -#define g_spawn_exit_error_quark _frida_g_spawn_exit_error_quark -#define g_spawn_sync _frida_g_spawn_sync -#define g_sprintf _frida_g_sprintf -#define g_srv_target_copy _frida_g_srv_target_copy -#define g_srv_target_free _frida_g_srv_target_free -#define g_srv_target_get_hostname _frida_g_srv_target_get_hostname -#define g_srv_target_get_port _frida_g_srv_target_get_port -#define g_srv_target_get_priority _frida_g_srv_target_get_priority -#define g_srv_target_get_type _frida_g_srv_target_get_type -#define g_srv_target_get_weight _frida_g_srv_target_get_weight -#define g_srv_target_list_sort _frida_g_srv_target_list_sort -#define g_srv_target_new _frida_g_srv_target_new -#define g_stat _frida_g_stat -#define g_static_mutex_free _frida_g_static_mutex_free -#define g_static_mutex_get_mutex_impl _frida_g_static_mutex_get_mutex_impl -#define g_static_mutex_init _frida_g_static_mutex_init -#define g_static_private_free _frida_g_static_private_free -#define g_static_private_get _frida_g_static_private_get -#define g_static_private_init _frida_g_static_private_init -#define g_static_private_set _frida_g_static_private_set -#define g_static_rec_mutex_free _frida_g_static_rec_mutex_free -#define g_static_rec_mutex_init _frida_g_static_rec_mutex_init -#define g_static_rec_mutex_lock _frida_g_static_rec_mutex_lock -#define g_static_rec_mutex_lock_full _frida_g_static_rec_mutex_lock_full -#define g_static_rec_mutex_trylock _frida_g_static_rec_mutex_trylock -#define g_static_rec_mutex_unlock _frida_g_static_rec_mutex_unlock -#define g_static_rec_mutex_unlock_full _frida_g_static_rec_mutex_unlock_full -#define g_static_resource_fini _frida_g_static_resource_fini -#define g_static_resource_get_resource _frida_g_static_resource_get_resource -#define g_static_resource_init _frida_g_static_resource_init -#define g_static_rw_lock_free _frida_g_static_rw_lock_free -#define g_static_rw_lock_init _frida_g_static_rw_lock_init -#define g_static_rw_lock_reader_lock _frida_g_static_rw_lock_reader_lock -#define g_static_rw_lock_reader_trylock _frida_g_static_rw_lock_reader_trylock -#define g_static_rw_lock_reader_unlock _frida_g_static_rw_lock_reader_unlock -#define g_static_rw_lock_writer_lock _frida_g_static_rw_lock_writer_lock -#define g_static_rw_lock_writer_trylock _frida_g_static_rw_lock_writer_trylock -#define g_static_rw_lock_writer_unlock _frida_g_static_rw_lock_writer_unlock -#define g_stpcpy _frida_g_stpcpy -#define g_str_equal _frida_g_str_equal -#define g_str_has_prefix _frida_g_str_has_prefix -#define g_str_has_suffix _frida_g_str_has_suffix -#define g_str_hash _frida_g_str_hash -#define g_str_is_ascii _frida_g_str_is_ascii -#define g_str_match_string _frida_g_str_match_string -#define g_str_to_ascii _frida_g_str_to_ascii -#define g_str_tokenize_and_fold _frida_g_str_tokenize_and_fold -#define g_strcanon _frida_g_strcanon -#define g_strcasecmp _frida_g_strcasecmp -#define g_strchomp _frida_g_strchomp -#define g_strchug _frida_g_strchug -#define g_strcmp0 _frida_g_strcmp0 -#define g_strcompress _frida_g_strcompress -#define g_strconcat _frida_g_strconcat -#define g_strdelimit _frida_g_strdelimit -#define g_strdown _frida_g_strdown -#define g_strdup _frida_g_strdup -#define g_strdup_printf _frida_g_strdup_printf -#define g_strdup_value_contents _frida_g_strdup_value_contents -#define g_strdup_vprintf _frida_g_strdup_vprintf -#define g_strdupv _frida_g_strdupv -#define g_strerror _frida_g_strerror -#define g_strescape _frida_g_strescape -#define g_strfreev _frida_g_strfreev -#define g_string_append _frida_g_string_append -#define g_string_append_c _frida_g_string_append_c -#define g_string_append_len _frida_g_string_append_len -#define g_string_append_printf _frida_g_string_append_printf -#define g_string_append_unichar _frida_g_string_append_unichar -#define g_string_append_uri_escaped _frida_g_string_append_uri_escaped -#define g_string_append_vprintf _frida_g_string_append_vprintf -#define g_string_ascii_down _frida_g_string_ascii_down -#define g_string_ascii_up _frida_g_string_ascii_up -#define g_string_assign _frida_g_string_assign -#define g_string_chunk_clear _frida_g_string_chunk_clear -#define g_string_chunk_free _frida_g_string_chunk_free -#define g_string_chunk_insert _frida_g_string_chunk_insert -#define g_string_chunk_insert_const _frida_g_string_chunk_insert_const -#define g_string_chunk_insert_len _frida_g_string_chunk_insert_len -#define g_string_chunk_new _frida_g_string_chunk_new -#define g_string_down _frida_g_string_down -#define g_string_equal _frida_g_string_equal -#define g_string_erase _frida_g_string_erase -#define g_string_free _frida_g_string_free -#define g_string_free_to_bytes _frida_g_string_free_to_bytes -#define g_string_hash _frida_g_string_hash -#define g_string_insert _frida_g_string_insert -#define g_string_insert_c _frida_g_string_insert_c -#define g_string_insert_len _frida_g_string_insert_len -#define g_string_insert_unichar _frida_g_string_insert_unichar -#define g_string_new _frida_g_string_new -#define g_string_new_len _frida_g_string_new_len -#define g_string_overwrite _frida_g_string_overwrite -#define g_string_overwrite_len _frida_g_string_overwrite_len -#define g_string_prepend _frida_g_string_prepend -#define g_string_prepend_c _frida_g_string_prepend_c -#define g_string_prepend_len _frida_g_string_prepend_len -#define g_string_prepend_unichar _frida_g_string_prepend_unichar -#define g_string_printf _frida_g_string_printf -#define g_string_set_size _frida_g_string_set_size -#define g_string_sized_new _frida_g_string_sized_new -#define g_string_truncate _frida_g_string_truncate -#define g_string_up _frida_g_string_up -#define g_string_vprintf _frida_g_string_vprintf -#define g_strip_context _frida_g_strip_context -#define g_strjoin _frida_g_strjoin -#define g_strjoinv _frida_g_strjoinv -#define g_strlcat _frida_g_strlcat -#define g_strlcpy _frida_g_strlcpy -#define g_strncasecmp _frida_g_strncasecmp -#define g_strndup _frida_g_strndup -#define g_strnfill _frida_g_strnfill -#define g_strreverse _frida_g_strreverse -#define g_strrstr _frida_g_strrstr -#define g_strrstr_len _frida_g_strrstr_len -#define g_strsignal _frida_g_strsignal -#define g_strsplit _frida_g_strsplit -#define g_strsplit_set _frida_g_strsplit_set -#define g_strstr_len _frida_g_strstr_len -#define g_strtod _frida_g_strtod -#define g_strup _frida_g_strup -#define g_strv_builder_add _frida_g_strv_builder_add -#define g_strv_builder_end _frida_g_strv_builder_end -#define g_strv_builder_new _frida_g_strv_builder_new -#define g_strv_builder_ref _frida_g_strv_builder_ref -#define g_strv_builder_unref _frida_g_strv_builder_unref -#define g_strv_contains _frida_g_strv_contains -#define g_strv_equal _frida_g_strv_equal -#define g_strv_get_type _frida_g_strv_get_type -#define g_strv_length _frida_g_strv_length -#define g_subprocess_communicate _frida_g_subprocess_communicate -#define g_subprocess_communicate_async _frida_g_subprocess_communicate_async -#define g_subprocess_communicate_finish _frida_g_subprocess_communicate_finish -#define g_subprocess_communicate_utf8 _frida_g_subprocess_communicate_utf8 -#define g_subprocess_communicate_utf8_async _frida_g_subprocess_communicate_utf8_async -#define g_subprocess_communicate_utf8_finish _frida_g_subprocess_communicate_utf8_finish -#define g_subprocess_flags_get_type _frida_g_subprocess_flags_get_type -#define g_subprocess_force_exit _frida_g_subprocess_force_exit -#define g_subprocess_get_exit_status _frida_g_subprocess_get_exit_status -#define g_subprocess_get_identifier _frida_g_subprocess_get_identifier -#define g_subprocess_get_if_exited _frida_g_subprocess_get_if_exited -#define g_subprocess_get_if_signaled _frida_g_subprocess_get_if_signaled -#define g_subprocess_get_status _frida_g_subprocess_get_status -#define g_subprocess_get_stderr_pipe _frida_g_subprocess_get_stderr_pipe -#define g_subprocess_get_stdin_pipe _frida_g_subprocess_get_stdin_pipe -#define g_subprocess_get_stdout_pipe _frida_g_subprocess_get_stdout_pipe -#define g_subprocess_get_successful _frida_g_subprocess_get_successful -#define g_subprocess_get_term_sig _frida_g_subprocess_get_term_sig -#define g_subprocess_get_type _frida_g_subprocess_get_type -#define g_subprocess_launcher_close _frida_g_subprocess_launcher_close -#define g_subprocess_launcher_get_type _frida_g_subprocess_launcher_get_type -#define g_subprocess_launcher_getenv _frida_g_subprocess_launcher_getenv -#define g_subprocess_launcher_new _frida_g_subprocess_launcher_new -#define g_subprocess_launcher_set_child_setup _frida_g_subprocess_launcher_set_child_setup -#define g_subprocess_launcher_set_cwd _frida_g_subprocess_launcher_set_cwd -#define g_subprocess_launcher_set_environ _frida_g_subprocess_launcher_set_environ -#define g_subprocess_launcher_set_flags _frida_g_subprocess_launcher_set_flags -#define g_subprocess_launcher_set_stderr_file_path _frida_g_subprocess_launcher_set_stderr_file_path -#define g_subprocess_launcher_set_stdin_file_path _frida_g_subprocess_launcher_set_stdin_file_path -#define g_subprocess_launcher_set_stdout_file_path _frida_g_subprocess_launcher_set_stdout_file_path -#define g_subprocess_launcher_setenv _frida_g_subprocess_launcher_setenv -#define g_subprocess_launcher_spawn _frida_g_subprocess_launcher_spawn -#define g_subprocess_launcher_spawnv _frida_g_subprocess_launcher_spawnv -#define g_subprocess_launcher_take_fd _frida_g_subprocess_launcher_take_fd -#define g_subprocess_launcher_take_stderr_fd _frida_g_subprocess_launcher_take_stderr_fd -#define g_subprocess_launcher_take_stdin_fd _frida_g_subprocess_launcher_take_stdin_fd -#define g_subprocess_launcher_take_stdout_fd _frida_g_subprocess_launcher_take_stdout_fd -#define g_subprocess_launcher_unsetenv _frida_g_subprocess_launcher_unsetenv -#define g_subprocess_new _frida_g_subprocess_new -#define g_subprocess_newv _frida_g_subprocess_newv -#define g_subprocess_send_signal _frida_g_subprocess_send_signal -#define g_subprocess_set_launcher _frida_g_subprocess_set_launcher -#define g_subprocess_wait _frida_g_subprocess_wait -#define g_subprocess_wait_async _frida_g_subprocess_wait_async -#define g_subprocess_wait_check _frida_g_subprocess_wait_check -#define g_subprocess_wait_check_async _frida_g_subprocess_wait_check_async -#define g_subprocess_wait_check_finish _frida_g_subprocess_wait_check_finish -#define g_subprocess_wait_finish _frida_g_subprocess_wait_finish -#define g_system_thread_exit _frida_g_system_thread_exit -#define g_system_thread_free _frida_g_system_thread_free -#define g_system_thread_get_scheduler_settings _frida_g_system_thread_get_scheduler_settings -#define g_system_thread_new _frida_g_system_thread_new -#define g_system_thread_set_name _frida_g_system_thread_set_name -#define g_system_thread_wait _frida_g_system_thread_wait -#define g_task_attach_source _frida_g_task_attach_source -#define g_task_get_cancellable _frida_g_task_get_cancellable -#define g_task_get_check_cancellable _frida_g_task_get_check_cancellable -#define g_task_get_completed _frida_g_task_get_completed -#define g_task_get_context _frida_g_task_get_context -#define g_task_get_name _frida_g_task_get_name -#define g_task_get_priority _frida_g_task_get_priority -#define g_task_get_return_on_cancel _frida_g_task_get_return_on_cancel -#define g_task_get_source_object _frida_g_task_get_source_object -#define g_task_get_source_tag _frida_g_task_get_source_tag -#define g_task_get_task_data _frida_g_task_get_task_data -#define g_task_get_type _frida_g_task_get_type -#define g_task_had_error _frida_g_task_had_error -#define g_task_is_valid _frida_g_task_is_valid -#define g_task_new _frida_g_task_new -#define g_task_propagate_boolean _frida_g_task_propagate_boolean -#define g_task_propagate_int _frida_g_task_propagate_int -#define g_task_propagate_pointer _frida_g_task_propagate_pointer -#define g_task_propagate_value _frida_g_task_propagate_value -#define g_task_report_error _frida_g_task_report_error -#define g_task_report_new_error _frida_g_task_report_new_error -#define g_task_return_boolean _frida_g_task_return_boolean -#define g_task_return_error _frida_g_task_return_error -#define g_task_return_error_if_cancelled _frida_g_task_return_error_if_cancelled -#define g_task_return_int _frida_g_task_return_int -#define g_task_return_new_error _frida_g_task_return_new_error -#define g_task_return_pointer _frida_g_task_return_pointer -#define g_task_return_value _frida_g_task_return_value -#define g_task_run_in_thread _frida_g_task_run_in_thread -#define g_task_run_in_thread_sync _frida_g_task_run_in_thread_sync -#define g_task_set_check_cancellable _frida_g_task_set_check_cancellable -#define g_task_set_name _frida_g_task_set_name -#define g_task_set_priority _frida_g_task_set_priority -#define g_task_set_return_on_cancel _frida_g_task_set_return_on_cancel -#define g_task_set_source_tag _frida_g_task_set_source_tag -#define g_task_set_task_data _frida_g_task_set_task_data -#define g_tcp_connection_get_graceful_disconnect _frida_g_tcp_connection_get_graceful_disconnect -#define g_tcp_connection_get_type _frida_g_tcp_connection_get_type -#define g_tcp_connection_set_graceful_disconnect _frida_g_tcp_connection_set_graceful_disconnect -#define g_tcp_wrapper_connection_get_base_io_stream _frida_g_tcp_wrapper_connection_get_base_io_stream -#define g_tcp_wrapper_connection_get_type _frida_g_tcp_wrapper_connection_get_type -#define g_tcp_wrapper_connection_new _frida_g_tcp_wrapper_connection_new -#define g_test_add_data_func _frida_g_test_add_data_func -#define g_test_add_data_func_full _frida_g_test_add_data_func_full -#define g_test_add_func _frida_g_test_add_func -#define g_test_add_vtable _frida_g_test_add_vtable -#define g_test_assert_expected_messages_internal _frida_g_test_assert_expected_messages_internal -#define g_test_bug _frida_g_test_bug -#define g_test_bug_base _frida_g_test_bug_base -#define g_test_build_filename _frida_g_test_build_filename -#define g_test_config_vars _frida_g_test_config_vars -#define g_test_create_case _frida_g_test_create_case -#define g_test_create_suite _frida_g_test_create_suite -#define g_test_dbus_add_service_dir _frida_g_test_dbus_add_service_dir -#define g_test_dbus_down _frida_g_test_dbus_down -#define g_test_dbus_flags_get_type _frida_g_test_dbus_flags_get_type -#define g_test_dbus_get_bus_address _frida_g_test_dbus_get_bus_address -#define g_test_dbus_get_flags _frida_g_test_dbus_get_flags -#define g_test_dbus_get_type _frida_g_test_dbus_get_type -#define g_test_dbus_new _frida_g_test_dbus_new -#define g_test_dbus_stop _frida_g_test_dbus_stop -#define g_test_dbus_unset _frida_g_test_dbus_unset -#define g_test_dbus_up _frida_g_test_dbus_up -#define g_test_expect_message _frida_g_test_expect_message -#define g_test_fail _frida_g_test_fail -#define g_test_failed _frida_g_test_failed -#define g_test_get_dir _frida_g_test_get_dir -#define g_test_get_filename _frida_g_test_get_filename -#define g_test_get_root _frida_g_test_get_root -#define g_test_incomplete _frida_g_test_incomplete -#define g_test_init _frida_g_test_init -#define g_test_log_buffer_free _frida_g_test_log_buffer_free -#define g_test_log_buffer_new _frida_g_test_log_buffer_new -#define g_test_log_buffer_pop _frida_g_test_log_buffer_pop -#define g_test_log_buffer_push _frida_g_test_log_buffer_push -#define g_test_log_msg_free _frida_g_test_log_msg_free -#define g_test_log_set_fatal_handler _frida_g_test_log_set_fatal_handler -#define g_test_log_type_name _frida_g_test_log_type_name -#define g_test_maximized_result _frida_g_test_maximized_result -#define g_test_message _frida_g_test_message -#define g_test_minimized_result _frida_g_test_minimized_result -#define g_test_queue_destroy _frida_g_test_queue_destroy -#define g_test_queue_free _frida_g_test_queue_free -#define g_test_rand_double _frida_g_test_rand_double -#define g_test_rand_double_range _frida_g_test_rand_double_range -#define g_test_rand_int _frida_g_test_rand_int -#define g_test_rand_int_range _frida_g_test_rand_int_range -#define g_test_run _frida_g_test_run -#define g_test_run_suite _frida_g_test_run_suite -#define g_test_set_nonfatal_assertions _frida_g_test_set_nonfatal_assertions -#define g_test_skip _frida_g_test_skip -#define g_test_subprocess _frida_g_test_subprocess -#define g_test_suite_add _frida_g_test_suite_add -#define g_test_suite_add_suite _frida_g_test_suite_add_suite -#define g_test_summary _frida_g_test_summary -#define g_test_timer_elapsed _frida_g_test_timer_elapsed -#define g_test_timer_last _frida_g_test_timer_last -#define g_test_timer_start _frida_g_test_timer_start -#define g_test_trap_assertions _frida_g_test_trap_assertions -#define g_test_trap_fork _frida_g_test_trap_fork -#define g_test_trap_has_passed _frida_g_test_trap_has_passed -#define g_test_trap_reached_timeout _frida_g_test_trap_reached_timeout -#define g_test_trap_subprocess _frida_g_test_trap_subprocess -#define g_themed_icon_append_name _frida_g_themed_icon_append_name -#define g_themed_icon_get_names _frida_g_themed_icon_get_names -#define g_themed_icon_get_type _frida_g_themed_icon_get_type -#define g_themed_icon_new _frida_g_themed_icon_new -#define g_themed_icon_new_from_names _frida_g_themed_icon_new_from_names -#define g_themed_icon_new_with_default_fallbacks _frida_g_themed_icon_new_with_default_fallbacks -#define g_themed_icon_prepend_name _frida_g_themed_icon_prepend_name -#define g_thread_create _frida_g_thread_create -#define g_thread_create_full _frida_g_thread_create_full -#define g_thread_error_quark _frida_g_thread_error_quark -#define g_thread_exit _frida_g_thread_exit -#define g_thread_foreach _frida_g_thread_foreach -#define g_thread_functions_for_glib_use _frida_g_thread_functions_for_glib_use -#define g_thread_garbage_collect _frida_g_thread_garbage_collect -#define g_thread_get_initialized _frida_g_thread_get_initialized -#define g_thread_get_scheduler_settings _frida_g_thread_get_scheduler_settings -#define g_thread_get_type _frida_g_thread_get_type -#define g_thread_gettime _frida_g_thread_gettime -#define g_thread_init_glib _frida_g_thread_init_glib -#define g_thread_join _frida_g_thread_join -#define g_thread_lifetime_beacon_check _frida_g_thread_lifetime_beacon_check -#define g_thread_lifetime_beacon_free _frida_g_thread_lifetime_beacon_free -#define g_thread_lifetime_beacon_new _frida_g_thread_lifetime_beacon_new -#define g_thread_n_created _frida_g_thread_n_created -#define g_thread_new _frida_g_thread_new -#define g_thread_new_internal _frida_g_thread_new_internal -#define g_thread_perform_cleanup _frida_g_thread_perform_cleanup -#define g_thread_pool_free _frida_g_thread_pool_free -#define g_thread_pool_get_max_idle_time _frida_g_thread_pool_get_max_idle_time -#define g_thread_pool_get_max_threads _frida_g_thread_pool_get_max_threads -#define g_thread_pool_get_max_unused_threads _frida_g_thread_pool_get_max_unused_threads -#define g_thread_pool_get_num_threads _frida_g_thread_pool_get_num_threads -#define g_thread_pool_get_num_unused_threads _frida_g_thread_pool_get_num_unused_threads -#define g_thread_pool_move_to_front _frida_g_thread_pool_move_to_front -#define g_thread_pool_new _frida_g_thread_pool_new -#define g_thread_pool_push _frida_g_thread_pool_push -#define g_thread_pool_set_max_idle_time _frida_g_thread_pool_set_max_idle_time -#define g_thread_pool_set_max_threads _frida_g_thread_pool_set_max_threads -#define g_thread_pool_set_max_unused_threads _frida_g_thread_pool_set_max_unused_threads -#define g_thread_pool_set_sort_function _frida_g_thread_pool_set_sort_function -#define g_thread_pool_stop_unused_threads _frida_g_thread_pool_stop_unused_threads -#define g_thread_pool_unprocessed _frida_g_thread_pool_unprocessed -#define g_thread_private_destroy_later _frida_g_thread_private_destroy_later -#define g_thread_proxy _frida_g_thread_proxy -#define g_thread_ref _frida_g_thread_ref -#define g_thread_schedule_cleanup _frida_g_thread_schedule_cleanup -#define g_thread_self _frida_g_thread_self -#define g_thread_set_callbacks _frida_g_thread_set_callbacks -#define g_thread_set_garbage_handler _frida_g_thread_set_garbage_handler -#define g_thread_set_priority _frida_g_thread_set_priority -#define g_thread_try_new _frida_g_thread_try_new -#define g_thread_unref _frida_g_thread_unref -#define g_thread_use_default_impl _frida_g_thread_use_default_impl -#define g_thread_yield _frida_g_thread_yield -#define g_threaded_resolver_get_type _frida_g_threaded_resolver_get_type -#define g_threaded_socket_service_get_type _frida_g_threaded_socket_service_get_type -#define g_threaded_socket_service_new _frida_g_threaded_socket_service_new -#define g_threads_got_initialized _frida_g_threads_got_initialized -#define g_time_val_add _frida_g_time_val_add -#define g_time_val_from_iso8601 _frida_g_time_val_from_iso8601 -#define g_time_val_to_iso8601 _frida_g_time_val_to_iso8601 -#define g_time_zone_adjust_time _frida_g_time_zone_adjust_time -#define g_time_zone_find_interval _frida_g_time_zone_find_interval -#define g_time_zone_get_abbreviation _frida_g_time_zone_get_abbreviation -#define g_time_zone_get_identifier _frida_g_time_zone_get_identifier -#define g_time_zone_get_offset _frida_g_time_zone_get_offset -#define g_time_zone_get_type _frida_g_time_zone_get_type -#define g_time_zone_is_dst _frida_g_time_zone_is_dst -#define g_time_zone_new _frida_g_time_zone_new -#define g_time_zone_new_identifier _frida_g_time_zone_new_identifier -#define g_time_zone_new_local _frida_g_time_zone_new_local -#define g_time_zone_new_offset _frida_g_time_zone_new_offset -#define g_time_zone_new_utc _frida_g_time_zone_new_utc -#define g_time_zone_ref _frida_g_time_zone_ref -#define g_time_zone_unref _frida_g_time_zone_unref -#define g_timeout_add _frida_g_timeout_add -#define g_timeout_add_full _frida_g_timeout_add_full -#define g_timeout_add_seconds _frida_g_timeout_add_seconds -#define g_timeout_add_seconds_full _frida_g_timeout_add_seconds_full -#define g_timeout_funcs _frida_g_timeout_funcs -#define g_timeout_source_new _frida_g_timeout_source_new -#define g_timeout_source_new_seconds _frida_g_timeout_source_new_seconds -#define g_timer_continue _frida_g_timer_continue -#define g_timer_destroy _frida_g_timer_destroy -#define g_timer_elapsed _frida_g_timer_elapsed -#define g_timer_is_active _frida_g_timer_is_active -#define g_timer_new _frida_g_timer_new -#define g_timer_reset _frida_g_timer_reset -#define g_timer_start _frida_g_timer_start -#define g_timer_stop _frida_g_timer_stop -#define g_tinylist_foreach _frida_g_tinylist_foreach -#define g_tinylist_free _frida_g_tinylist_free -#define g_tinylist_prepend _frida_g_tinylist_prepend -#define g_tinylist_remove _frida_g_tinylist_remove -#define g_tls_authentication_mode_get_type _frida_g_tls_authentication_mode_get_type -#define g_tls_backend_get_certificate_type _frida_g_tls_backend_get_certificate_type -#define g_tls_backend_get_client_connection_type _frida_g_tls_backend_get_client_connection_type -#define g_tls_backend_get_default _frida_g_tls_backend_get_default -#define g_tls_backend_get_default_database _frida_g_tls_backend_get_default_database -#define g_tls_backend_get_dtls_client_connection_type _frida_g_tls_backend_get_dtls_client_connection_type -#define g_tls_backend_get_dtls_server_connection_type _frida_g_tls_backend_get_dtls_server_connection_type -#define g_tls_backend_get_file_database_type _frida_g_tls_backend_get_file_database_type -#define g_tls_backend_get_server_connection_type _frida_g_tls_backend_get_server_connection_type -#define g_tls_backend_get_type _frida_g_tls_backend_get_type -#define g_tls_backend_set_default_database _frida_g_tls_backend_set_default_database -#define g_tls_backend_supports_dtls _frida_g_tls_backend_supports_dtls -#define g_tls_backend_supports_tls _frida_g_tls_backend_supports_tls -#define g_tls_certificate_flags_get_type _frida_g_tls_certificate_flags_get_type -#define g_tls_certificate_get_issuer _frida_g_tls_certificate_get_issuer -#define g_tls_certificate_get_type _frida_g_tls_certificate_get_type -#define g_tls_certificate_is_same _frida_g_tls_certificate_is_same -#define g_tls_certificate_list_new_from_file _frida_g_tls_certificate_list_new_from_file -#define g_tls_certificate_new_from_file _frida_g_tls_certificate_new_from_file -#define g_tls_certificate_new_from_files _frida_g_tls_certificate_new_from_files -#define g_tls_certificate_new_from_pem _frida_g_tls_certificate_new_from_pem -#define g_tls_certificate_new_from_pkcs11_uris _frida_g_tls_certificate_new_from_pkcs11_uris -#define g_tls_certificate_request_flags_get_type _frida_g_tls_certificate_request_flags_get_type -#define g_tls_certificate_verify _frida_g_tls_certificate_verify -#define g_tls_channel_binding_error_get_type _frida_g_tls_channel_binding_error_get_type -#define g_tls_channel_binding_error_quark _frida_g_tls_channel_binding_error_quark -#define g_tls_channel_binding_type_get_type _frida_g_tls_channel_binding_type_get_type -#define g_tls_client_connection_copy_session_state _frida_g_tls_client_connection_copy_session_state -#define g_tls_client_connection_get_accepted_cas _frida_g_tls_client_connection_get_accepted_cas -#define g_tls_client_connection_get_server_identity _frida_g_tls_client_connection_get_server_identity -#define g_tls_client_connection_get_type _frida_g_tls_client_connection_get_type -#define g_tls_client_connection_get_use_ssl3 _frida_g_tls_client_connection_get_use_ssl3 -#define g_tls_client_connection_get_validation_flags _frida_g_tls_client_connection_get_validation_flags -#define g_tls_client_connection_new _frida_g_tls_client_connection_new -#define g_tls_client_connection_set_server_identity _frida_g_tls_client_connection_set_server_identity -#define g_tls_client_connection_set_use_ssl3 _frida_g_tls_client_connection_set_use_ssl3 -#define g_tls_client_connection_set_validation_flags _frida_g_tls_client_connection_set_validation_flags -#define g_tls_connection_emit_accept_certificate _frida_g_tls_connection_emit_accept_certificate -#define g_tls_connection_get_certificate _frida_g_tls_connection_get_certificate -#define g_tls_connection_get_channel_binding_data _frida_g_tls_connection_get_channel_binding_data -#define g_tls_connection_get_database _frida_g_tls_connection_get_database -#define g_tls_connection_get_interaction _frida_g_tls_connection_get_interaction -#define g_tls_connection_get_negotiated_protocol _frida_g_tls_connection_get_negotiated_protocol -#define g_tls_connection_get_peer_certificate _frida_g_tls_connection_get_peer_certificate -#define g_tls_connection_get_peer_certificate_errors _frida_g_tls_connection_get_peer_certificate_errors -#define g_tls_connection_get_rehandshake_mode _frida_g_tls_connection_get_rehandshake_mode -#define g_tls_connection_get_require_close_notify _frida_g_tls_connection_get_require_close_notify -#define g_tls_connection_get_type _frida_g_tls_connection_get_type -#define g_tls_connection_get_use_system_certdb _frida_g_tls_connection_get_use_system_certdb -#define g_tls_connection_handshake _frida_g_tls_connection_handshake -#define g_tls_connection_handshake_async _frida_g_tls_connection_handshake_async -#define g_tls_connection_handshake_finish _frida_g_tls_connection_handshake_finish -#define g_tls_connection_set_advertised_protocols _frida_g_tls_connection_set_advertised_protocols -#define g_tls_connection_set_certificate _frida_g_tls_connection_set_certificate -#define g_tls_connection_set_database _frida_g_tls_connection_set_database -#define g_tls_connection_set_interaction _frida_g_tls_connection_set_interaction -#define g_tls_connection_set_rehandshake_mode _frida_g_tls_connection_set_rehandshake_mode -#define g_tls_connection_set_require_close_notify _frida_g_tls_connection_set_require_close_notify -#define g_tls_connection_set_use_system_certdb _frida_g_tls_connection_set_use_system_certdb -#define g_tls_database_create_certificate_handle _frida_g_tls_database_create_certificate_handle -#define g_tls_database_get_type _frida_g_tls_database_get_type -#define g_tls_database_lookup_certificate_for_handle _frida_g_tls_database_lookup_certificate_for_handle -#define g_tls_database_lookup_certificate_for_handle_async _frida_g_tls_database_lookup_certificate_for_handle_async -#define g_tls_database_lookup_certificate_for_handle_finish _frida_g_tls_database_lookup_certificate_for_handle_finish -#define g_tls_database_lookup_certificate_issuer _frida_g_tls_database_lookup_certificate_issuer -#define g_tls_database_lookup_certificate_issuer_async _frida_g_tls_database_lookup_certificate_issuer_async -#define g_tls_database_lookup_certificate_issuer_finish _frida_g_tls_database_lookup_certificate_issuer_finish -#define g_tls_database_lookup_certificates_issued_by _frida_g_tls_database_lookup_certificates_issued_by -#define g_tls_database_lookup_certificates_issued_by_async _frida_g_tls_database_lookup_certificates_issued_by_async -#define g_tls_database_lookup_certificates_issued_by_finish _frida_g_tls_database_lookup_certificates_issued_by_finish -#define g_tls_database_lookup_flags_get_type _frida_g_tls_database_lookup_flags_get_type -#define g_tls_database_verify_chain _frida_g_tls_database_verify_chain -#define g_tls_database_verify_chain_async _frida_g_tls_database_verify_chain_async -#define g_tls_database_verify_chain_finish _frida_g_tls_database_verify_chain_finish -#define g_tls_database_verify_flags_get_type _frida_g_tls_database_verify_flags_get_type -#define g_tls_error_get_type _frida_g_tls_error_get_type -#define g_tls_error_quark _frida_g_tls_error_quark -#define g_tls_file_database_get_type _frida_g_tls_file_database_get_type -#define g_tls_file_database_new _frida_g_tls_file_database_new -#define g_tls_interaction_ask_password _frida_g_tls_interaction_ask_password -#define g_tls_interaction_ask_password_async _frida_g_tls_interaction_ask_password_async -#define g_tls_interaction_ask_password_finish _frida_g_tls_interaction_ask_password_finish -#define g_tls_interaction_get_type _frida_g_tls_interaction_get_type -#define g_tls_interaction_invoke_ask_password _frida_g_tls_interaction_invoke_ask_password -#define g_tls_interaction_invoke_request_certificate _frida_g_tls_interaction_invoke_request_certificate -#define g_tls_interaction_request_certificate _frida_g_tls_interaction_request_certificate -#define g_tls_interaction_request_certificate_async _frida_g_tls_interaction_request_certificate_async -#define g_tls_interaction_request_certificate_finish _frida_g_tls_interaction_request_certificate_finish -#define g_tls_interaction_result_get_type _frida_g_tls_interaction_result_get_type -#define g_tls_password_flags_get_type _frida_g_tls_password_flags_get_type -#define g_tls_password_get_description _frida_g_tls_password_get_description -#define g_tls_password_get_flags _frida_g_tls_password_get_flags -#define g_tls_password_get_type _frida_g_tls_password_get_type -#define g_tls_password_get_value _frida_g_tls_password_get_value -#define g_tls_password_get_warning _frida_g_tls_password_get_warning -#define g_tls_password_new _frida_g_tls_password_new -#define g_tls_password_set_description _frida_g_tls_password_set_description -#define g_tls_password_set_flags _frida_g_tls_password_set_flags -#define g_tls_password_set_value _frida_g_tls_password_set_value -#define g_tls_password_set_value_full _frida_g_tls_password_set_value_full -#define g_tls_password_set_warning _frida_g_tls_password_set_warning -#define g_tls_rehandshake_mode_get_type _frida_g_tls_rehandshake_mode_get_type -#define g_tls_server_connection_get_type _frida_g_tls_server_connection_get_type -#define g_tls_server_connection_new _frida_g_tls_server_connection_new -#define g_trace_define_int64_counter _frida_g_trace_define_int64_counter -#define g_trace_mark _frida_g_trace_mark -#define g_trace_set_int64_counter _frida_g_trace_set_int64_counter -#define g_trash_portal_trash_file _frida_g_trash_portal_trash_file -#define g_trash_stack_height _frida_g_trash_stack_height -#define g_trash_stack_peek _frida_g_trash_stack_peek -#define g_trash_stack_pop _frida_g_trash_stack_pop -#define g_trash_stack_push _frida_g_trash_stack_push -#define g_tree_destroy _frida_g_tree_destroy -#define g_tree_foreach _frida_g_tree_foreach -#define g_tree_foreach_node _frida_g_tree_foreach_node -#define g_tree_get_type _frida_g_tree_get_type -#define g_tree_height _frida_g_tree_height -#define g_tree_insert _frida_g_tree_insert -#define g_tree_insert_node _frida_g_tree_insert_node -#define g_tree_lookup _frida_g_tree_lookup -#define g_tree_lookup_extended _frida_g_tree_lookup_extended -#define g_tree_lookup_node _frida_g_tree_lookup_node -#define g_tree_lower_bound _frida_g_tree_lower_bound -#define g_tree_new _frida_g_tree_new -#define g_tree_new_full _frida_g_tree_new_full -#define g_tree_new_with_data _frida_g_tree_new_with_data -#define g_tree_nnodes _frida_g_tree_nnodes -#define g_tree_node_first _frida_g_tree_node_first -#define g_tree_node_key _frida_g_tree_node_key -#define g_tree_node_last _frida_g_tree_node_last -#define g_tree_node_next _frida_g_tree_node_next -#define g_tree_node_previous _frida_g_tree_node_previous -#define g_tree_node_value _frida_g_tree_node_value -#define g_tree_ref _frida_g_tree_ref -#define g_tree_remove _frida_g_tree_remove -#define g_tree_replace _frida_g_tree_replace -#define g_tree_replace_node _frida_g_tree_replace_node -#define g_tree_search _frida_g_tree_search -#define g_tree_search_node _frida_g_tree_search_node -#define g_tree_steal _frida_g_tree_steal -#define g_tree_traverse _frida_g_tree_traverse -#define g_tree_unref _frida_g_tree_unref -#define g_tree_upper_bound _frida_g_tree_upper_bound -#define g_try_malloc _frida_g_try_malloc -#define g_try_malloc0 _frida_g_try_malloc0 -#define g_try_malloc0_n _frida_g_try_malloc0_n -#define g_try_malloc_n _frida_g_try_malloc_n -#define g_try_realloc _frida_g_try_realloc -#define g_try_realloc_n _frida_g_try_realloc_n -#define g_tuples_destroy _frida_g_tuples_destroy -#define g_tuples_index _frida_g_tuples_index -#define g_type_add_class_cache_func _frida_g_type_add_class_cache_func -#define g_type_add_class_private _frida_g_type_add_class_private -#define g_type_add_instance_private _frida_g_type_add_instance_private -#define g_type_add_interface_check _frida_g_type_add_interface_check -#define g_type_add_interface_dynamic _frida_g_type_add_interface_dynamic -#define g_type_add_interface_static _frida_g_type_add_interface_static -#define g_type_check_class_cast _frida_g_type_check_class_cast -#define g_type_check_class_is_a _frida_g_type_check_class_is_a -#define g_type_check_instance _frida_g_type_check_instance -#define g_type_check_instance_cast _frida_g_type_check_instance_cast -#define g_type_check_instance_is_a _frida_g_type_check_instance_is_a -#define g_type_check_instance_is_fundamentally_a _frida_g_type_check_instance_is_fundamentally_a -#define g_type_check_is_value_type _frida_g_type_check_is_value_type -#define g_type_check_value _frida_g_type_check_value -#define g_type_check_value_holds _frida_g_type_check_value_holds -#define g_type_children _frida_g_type_children -#define g_type_class_add_private _frida_g_type_class_add_private -#define g_type_class_adjust_private_offset _frida_g_type_class_adjust_private_offset -#define g_type_class_get_instance_private_offset _frida_g_type_class_get_instance_private_offset -#define g_type_class_get_private _frida_g_type_class_get_private -#define g_type_class_peek _frida_g_type_class_peek -#define g_type_class_peek_parent _frida_g_type_class_peek_parent -#define g_type_class_peek_static _frida_g_type_class_peek_static -#define g_type_class_ref _frida_g_type_class_ref -#define g_type_class_unref _frida_g_type_class_unref -#define g_type_class_unref_uncached _frida_g_type_class_unref_uncached -#define g_type_create_instance _frida_g_type_create_instance -#define g_type_default_interface_peek _frida_g_type_default_interface_peek -#define g_type_default_interface_ref _frida_g_type_default_interface_ref -#define g_type_default_interface_unref _frida_g_type_default_interface_unref -#define g_type_depth _frida_g_type_depth -#define g_type_ensure _frida_g_type_ensure -#define g_type_free_instance _frida_g_type_free_instance -#define g_type_from_name _frida_g_type_from_name -#define g_type_fundamental _frida_g_type_fundamental -#define g_type_fundamental_next _frida_g_type_fundamental_next -#define g_type_get_instance_count _frida_g_type_get_instance_count -#define g_type_get_plugin _frida_g_type_get_plugin -#define g_type_get_qdata _frida_g_type_get_qdata -#define g_type_get_type_registration_serial _frida_g_type_get_type_registration_serial -#define g_type_init _frida_g_type_init -#define g_type_init_with_debug_flags _frida_g_type_init_with_debug_flags -#define g_type_instance_get_private _frida_g_type_instance_get_private -#define g_type_interface_add_prerequisite _frida_g_type_interface_add_prerequisite -#define g_type_interface_get_plugin _frida_g_type_interface_get_plugin -#define g_type_interface_instantiatable_prerequisite _frida_g_type_interface_instantiatable_prerequisite -#define g_type_interface_peek _frida_g_type_interface_peek -#define g_type_interface_peek_parent _frida_g_type_interface_peek_parent -#define g_type_interface_prerequisites _frida_g_type_interface_prerequisites -#define g_type_interfaces _frida_g_type_interfaces -#define g_type_is_a _frida_g_type_is_a -#define g_type_module_add_interface _frida_g_type_module_add_interface -#define g_type_module_get_type _frida_g_type_module_get_type -#define g_type_module_register_enum _frida_g_type_module_register_enum -#define g_type_module_register_flags _frida_g_type_module_register_flags -#define g_type_module_register_type _frida_g_type_module_register_type -#define g_type_module_set_name _frida_g_type_module_set_name -#define g_type_module_unuse _frida_g_type_module_unuse -#define g_type_module_use _frida_g_type_module_use -#define g_type_name _frida_g_type_name -#define g_type_name_from_class _frida_g_type_name_from_class -#define g_type_name_from_instance _frida_g_type_name_from_instance -#define g_type_next_base _frida_g_type_next_base -#define g_type_parent _frida_g_type_parent -#define g_type_plugin_complete_interface_info _frida_g_type_plugin_complete_interface_info -#define g_type_plugin_complete_type_info _frida_g_type_plugin_complete_type_info -#define g_type_plugin_get_type _frida_g_type_plugin_get_type -#define g_type_plugin_unuse _frida_g_type_plugin_unuse -#define g_type_plugin_use _frida_g_type_plugin_use -#define g_type_qname _frida_g_type_qname -#define g_type_query _frida_g_type_query -#define g_type_register_dynamic _frida_g_type_register_dynamic -#define g_type_register_fundamental _frida_g_type_register_fundamental -#define g_type_register_static _frida_g_type_register_static -#define g_type_register_static_simple _frida_g_type_register_static_simple -#define g_type_remove_class_cache_func _frida_g_type_remove_class_cache_func -#define g_type_remove_interface_check _frida_g_type_remove_interface_check -#define g_type_set_qdata _frida_g_type_set_qdata -#define g_type_test_flags _frida_g_type_test_flags -#define g_type_value_table_peek _frida_g_type_value_table_peek -#define g_ucs4_to_utf16 _frida_g_ucs4_to_utf16 -#define g_ucs4_to_utf8 _frida_g_ucs4_to_utf8 -#define g_unichar_break_type _frida_g_unichar_break_type -#define g_unichar_combining_class _frida_g_unichar_combining_class -#define g_unichar_compose _frida_g_unichar_compose -#define g_unichar_decompose _frida_g_unichar_decompose -#define g_unichar_digit_value _frida_g_unichar_digit_value -#define g_unichar_fully_decompose _frida_g_unichar_fully_decompose -#define g_unichar_get_mirror_char _frida_g_unichar_get_mirror_char -#define g_unichar_get_script _frida_g_unichar_get_script -#define g_unichar_isalnum _frida_g_unichar_isalnum -#define g_unichar_isalpha _frida_g_unichar_isalpha -#define g_unichar_iscntrl _frida_g_unichar_iscntrl -#define g_unichar_isdefined _frida_g_unichar_isdefined -#define g_unichar_isdigit _frida_g_unichar_isdigit -#define g_unichar_isgraph _frida_g_unichar_isgraph -#define g_unichar_islower _frida_g_unichar_islower -#define g_unichar_ismark _frida_g_unichar_ismark -#define g_unichar_isprint _frida_g_unichar_isprint -#define g_unichar_ispunct _frida_g_unichar_ispunct -#define g_unichar_isspace _frida_g_unichar_isspace -#define g_unichar_istitle _frida_g_unichar_istitle -#define g_unichar_isupper _frida_g_unichar_isupper -#define g_unichar_iswide _frida_g_unichar_iswide -#define g_unichar_iswide_cjk _frida_g_unichar_iswide_cjk -#define g_unichar_isxdigit _frida_g_unichar_isxdigit -#define g_unichar_iszerowidth _frida_g_unichar_iszerowidth -#define g_unichar_to_utf8 _frida_g_unichar_to_utf8 -#define g_unichar_tolower _frida_g_unichar_tolower -#define g_unichar_totitle _frida_g_unichar_totitle -#define g_unichar_toupper _frida_g_unichar_toupper -#define g_unichar_type _frida_g_unichar_type -#define g_unichar_validate _frida_g_unichar_validate -#define g_unichar_xdigit_value _frida_g_unichar_xdigit_value -#define g_unicode_break_type_get_type _frida_g_unicode_break_type_get_type -#define g_unicode_canonical_decomposition _frida_g_unicode_canonical_decomposition -#define g_unicode_canonical_ordering _frida_g_unicode_canonical_ordering -#define g_unicode_script_from_iso15924 _frida_g_unicode_script_from_iso15924 -#define g_unicode_script_get_type _frida_g_unicode_script_get_type -#define g_unicode_script_to_iso15924 _frida_g_unicode_script_to_iso15924 -#define g_unicode_type_get_type _frida_g_unicode_type_get_type -#define g_unix_connection_get_type _frida_g_unix_connection_get_type -#define g_unix_connection_receive_credentials _frida_g_unix_connection_receive_credentials -#define g_unix_connection_receive_credentials_async _frida_g_unix_connection_receive_credentials_async -#define g_unix_connection_receive_credentials_finish _frida_g_unix_connection_receive_credentials_finish -#define g_unix_connection_receive_fd _frida_g_unix_connection_receive_fd -#define g_unix_connection_send_credentials _frida_g_unix_connection_send_credentials -#define g_unix_connection_send_credentials_async _frida_g_unix_connection_send_credentials_async -#define g_unix_connection_send_credentials_finish _frida_g_unix_connection_send_credentials_finish -#define g_unix_connection_send_fd _frida_g_unix_connection_send_fd -#define g_unix_credentials_message_get_credentials _frida_g_unix_credentials_message_get_credentials -#define g_unix_credentials_message_get_type _frida_g_unix_credentials_message_get_type -#define g_unix_credentials_message_is_supported _frida_g_unix_credentials_message_is_supported -#define g_unix_credentials_message_new _frida_g_unix_credentials_message_new -#define g_unix_credentials_message_new_with_credentials _frida_g_unix_credentials_message_new_with_credentials -#define g_unix_error_quark _frida_g_unix_error_quark -#define g_unix_fd_add _frida_g_unix_fd_add -#define g_unix_fd_add_full _frida_g_unix_fd_add_full -#define g_unix_fd_list_append _frida_g_unix_fd_list_append -#define g_unix_fd_list_get _frida_g_unix_fd_list_get -#define g_unix_fd_list_get_length _frida_g_unix_fd_list_get_length -#define g_unix_fd_list_get_type _frida_g_unix_fd_list_get_type -#define g_unix_fd_list_new _frida_g_unix_fd_list_new -#define g_unix_fd_list_new_from_array _frida_g_unix_fd_list_new_from_array -#define g_unix_fd_list_peek_fds _frida_g_unix_fd_list_peek_fds -#define g_unix_fd_list_steal_fds _frida_g_unix_fd_list_steal_fds -#define g_unix_fd_message_append_fd _frida_g_unix_fd_message_append_fd -#define g_unix_fd_message_get_fd_list _frida_g_unix_fd_message_get_fd_list -#define g_unix_fd_message_get_type _frida_g_unix_fd_message_get_type -#define g_unix_fd_message_new _frida_g_unix_fd_message_new -#define g_unix_fd_message_new_with_fd_list _frida_g_unix_fd_message_new_with_fd_list -#define g_unix_fd_message_steal_fds _frida_g_unix_fd_message_steal_fds -#define g_unix_fd_source_funcs _frida_g_unix_fd_source_funcs -#define g_unix_fd_source_new _frida_g_unix_fd_source_new -#define g_unix_get_passwd_entry _frida_g_unix_get_passwd_entry -#define g_unix_input_stream_get_close_fd _frida_g_unix_input_stream_get_close_fd -#define g_unix_input_stream_get_fd _frida_g_unix_input_stream_get_fd -#define g_unix_input_stream_get_type _frida_g_unix_input_stream_get_type -#define g_unix_input_stream_new _frida_g_unix_input_stream_new -#define g_unix_input_stream_set_close_fd _frida_g_unix_input_stream_set_close_fd -#define g_unix_is_mount_path_system_internal _frida_g_unix_is_mount_path_system_internal -#define g_unix_is_system_device_path _frida_g_unix_is_system_device_path -#define g_unix_is_system_fs_type _frida_g_unix_is_system_fs_type -#define g_unix_mount_at _frida_g_unix_mount_at -#define g_unix_mount_compare _frida_g_unix_mount_compare -#define g_unix_mount_copy _frida_g_unix_mount_copy -#define g_unix_mount_entry_get_type _frida_g_unix_mount_entry_get_type -#define g_unix_mount_for _frida_g_unix_mount_for -#define g_unix_mount_free _frida_g_unix_mount_free -#define g_unix_mount_get_device_path _frida_g_unix_mount_get_device_path -#define g_unix_mount_get_fs_type _frida_g_unix_mount_get_fs_type -#define g_unix_mount_get_mount_path _frida_g_unix_mount_get_mount_path -#define g_unix_mount_get_options _frida_g_unix_mount_get_options -#define g_unix_mount_get_root_path _frida_g_unix_mount_get_root_path -#define g_unix_mount_guess_can_eject _frida_g_unix_mount_guess_can_eject -#define g_unix_mount_guess_icon _frida_g_unix_mount_guess_icon -#define g_unix_mount_guess_name _frida_g_unix_mount_guess_name -#define g_unix_mount_guess_should_display _frida_g_unix_mount_guess_should_display -#define g_unix_mount_guess_symbolic_icon _frida_g_unix_mount_guess_symbolic_icon -#define g_unix_mount_is_readonly _frida_g_unix_mount_is_readonly -#define g_unix_mount_is_system_internal _frida_g_unix_mount_is_system_internal -#define g_unix_mount_monitor_get _frida_g_unix_mount_monitor_get -#define g_unix_mount_monitor_get_type _frida_g_unix_mount_monitor_get_type -#define g_unix_mount_monitor_new _frida_g_unix_mount_monitor_new -#define g_unix_mount_monitor_set_rate_limit _frida_g_unix_mount_monitor_set_rate_limit -#define g_unix_mount_point_at _frida_g_unix_mount_point_at -#define g_unix_mount_point_compare _frida_g_unix_mount_point_compare -#define g_unix_mount_point_copy _frida_g_unix_mount_point_copy -#define g_unix_mount_point_free _frida_g_unix_mount_point_free -#define g_unix_mount_point_get_device_path _frida_g_unix_mount_point_get_device_path -#define g_unix_mount_point_get_fs_type _frida_g_unix_mount_point_get_fs_type -#define g_unix_mount_point_get_mount_path _frida_g_unix_mount_point_get_mount_path -#define g_unix_mount_point_get_options _frida_g_unix_mount_point_get_options -#define g_unix_mount_point_get_type _frida_g_unix_mount_point_get_type -#define g_unix_mount_point_guess_can_eject _frida_g_unix_mount_point_guess_can_eject -#define g_unix_mount_point_guess_icon _frida_g_unix_mount_point_guess_icon -#define g_unix_mount_point_guess_name _frida_g_unix_mount_point_guess_name -#define g_unix_mount_point_guess_symbolic_icon _frida_g_unix_mount_point_guess_symbolic_icon -#define g_unix_mount_point_is_loopback _frida_g_unix_mount_point_is_loopback -#define g_unix_mount_point_is_readonly _frida_g_unix_mount_point_is_readonly -#define g_unix_mount_point_is_user_mountable _frida_g_unix_mount_point_is_user_mountable -#define g_unix_mount_points_changed_since _frida_g_unix_mount_points_changed_since -#define g_unix_mount_points_get _frida_g_unix_mount_points_get -#define g_unix_mounts_changed_since _frida_g_unix_mounts_changed_since -#define g_unix_mounts_get _frida_g_unix_mounts_get -#define g_unix_open_pipe _frida_g_unix_open_pipe -#define g_unix_output_stream_get_close_fd _frida_g_unix_output_stream_get_close_fd -#define g_unix_output_stream_get_fd _frida_g_unix_output_stream_get_fd -#define g_unix_output_stream_get_type _frida_g_unix_output_stream_get_type -#define g_unix_output_stream_new _frida_g_unix_output_stream_new -#define g_unix_output_stream_set_close_fd _frida_g_unix_output_stream_set_close_fd -#define g_unix_set_fd_nonblocking _frida_g_unix_set_fd_nonblocking -#define g_unix_signal_add _frida_g_unix_signal_add -#define g_unix_signal_add_full _frida_g_unix_signal_add_full -#define g_unix_signal_funcs _frida_g_unix_signal_funcs -#define g_unix_signal_source_new _frida_g_unix_signal_source_new -#define g_unix_socket_address_abstract_names_supported _frida_g_unix_socket_address_abstract_names_supported -#define g_unix_socket_address_get_address_type _frida_g_unix_socket_address_get_address_type -#define g_unix_socket_address_get_is_abstract _frida_g_unix_socket_address_get_is_abstract -#define g_unix_socket_address_get_path _frida_g_unix_socket_address_get_path -#define g_unix_socket_address_get_path_len _frida_g_unix_socket_address_get_path_len -#define g_unix_socket_address_get_type _frida_g_unix_socket_address_get_type -#define g_unix_socket_address_new _frida_g_unix_socket_address_new -#define g_unix_socket_address_new_abstract _frida_g_unix_socket_address_new_abstract -#define g_unix_socket_address_new_with_type _frida_g_unix_socket_address_new_with_type -#define g_unix_socket_address_type_get_type _frida_g_unix_socket_address_type_get_type -#define g_unlink _frida_g_unlink -#define g_unsetenv _frida_g_unsetenv -#define g_uri_build _frida_g_uri_build -#define g_uri_build_with_user _frida_g_uri_build_with_user -#define g_uri_error_quark _frida_g_uri_error_quark -#define g_uri_escape_bytes _frida_g_uri_escape_bytes -#define g_uri_escape_string _frida_g_uri_escape_string -#define g_uri_get_auth_params _frida_g_uri_get_auth_params -#define g_uri_get_flags _frida_g_uri_get_flags -#define g_uri_get_fragment _frida_g_uri_get_fragment -#define g_uri_get_host _frida_g_uri_get_host -#define g_uri_get_password _frida_g_uri_get_password -#define g_uri_get_path _frida_g_uri_get_path -#define g_uri_get_port _frida_g_uri_get_port -#define g_uri_get_query _frida_g_uri_get_query -#define g_uri_get_scheme _frida_g_uri_get_scheme -#define g_uri_get_type _frida_g_uri_get_type -#define g_uri_get_user _frida_g_uri_get_user -#define g_uri_get_userinfo _frida_g_uri_get_userinfo -#define g_uri_is_valid _frida_g_uri_is_valid -#define g_uri_join _frida_g_uri_join -#define g_uri_join_with_user _frida_g_uri_join_with_user -#define g_uri_list_extract_uris _frida_g_uri_list_extract_uris -#define g_uri_params_iter_init _frida_g_uri_params_iter_init -#define g_uri_params_iter_next _frida_g_uri_params_iter_next -#define g_uri_parse _frida_g_uri_parse -#define g_uri_parse_params _frida_g_uri_parse_params -#define g_uri_parse_relative _frida_g_uri_parse_relative -#define g_uri_parse_scheme _frida_g_uri_parse_scheme -#define g_uri_peek_scheme _frida_g_uri_peek_scheme -#define g_uri_ref _frida_g_uri_ref -#define g_uri_resolve_relative _frida_g_uri_resolve_relative -#define g_uri_split _frida_g_uri_split -#define g_uri_split_network _frida_g_uri_split_network -#define g_uri_split_with_user _frida_g_uri_split_with_user -#define g_uri_to_string _frida_g_uri_to_string -#define g_uri_to_string_partial _frida_g_uri_to_string_partial -#define g_uri_unescape_bytes _frida_g_uri_unescape_bytes -#define g_uri_unescape_segment _frida_g_uri_unescape_segment -#define g_uri_unescape_string _frida_g_uri_unescape_string -#define g_uri_unref _frida_g_uri_unref -#define g_usleep _frida_g_usleep -#define g_utf16_to_ucs4 _frida_g_utf16_to_ucs4 -#define g_utf16_to_utf8 _frida_g_utf16_to_utf8 -#define g_utf8_casefold _frida_g_utf8_casefold -#define g_utf8_collate _frida_g_utf8_collate -#define g_utf8_collate_key _frida_g_utf8_collate_key -#define g_utf8_collate_key_for_filename _frida_g_utf8_collate_key_for_filename -#define g_utf8_find_next_char _frida_g_utf8_find_next_char -#define g_utf8_find_prev_char _frida_g_utf8_find_prev_char -#define g_utf8_get_char _frida_g_utf8_get_char -#define g_utf8_get_char_validated _frida_g_utf8_get_char_validated -#define g_utf8_make_valid _frida_g_utf8_make_valid -#define g_utf8_normalize _frida_g_utf8_normalize -#define g_utf8_offset_to_pointer _frida_g_utf8_offset_to_pointer -#define g_utf8_pointer_to_offset _frida_g_utf8_pointer_to_offset -#define g_utf8_prev_char _frida_g_utf8_prev_char -#define g_utf8_skip _frida_g_utf8_skip -#define g_utf8_strchr _frida_g_utf8_strchr -#define g_utf8_strdown _frida_g_utf8_strdown -#define g_utf8_strlen _frida_g_utf8_strlen -#define g_utf8_strncpy _frida_g_utf8_strncpy -#define g_utf8_strrchr _frida_g_utf8_strrchr -#define g_utf8_strreverse _frida_g_utf8_strreverse -#define g_utf8_strup _frida_g_utf8_strup -#define g_utf8_substring _frida_g_utf8_substring -#define g_utf8_to_ucs4 _frida_g_utf8_to_ucs4 -#define g_utf8_to_ucs4_fast _frida_g_utf8_to_ucs4_fast -#define g_utf8_to_utf16 _frida_g_utf8_to_utf16 -#define g_utf8_validate _frida_g_utf8_validate -#define g_utf8_validate_len _frida_g_utf8_validate_len -#define g_utime _frida_g_utime -#define g_uuid_string_is_valid _frida_g_uuid_string_is_valid -#define g_uuid_string_random _frida_g_uuid_string_random -#define g_value_array_append _frida_g_value_array_append -#define g_value_array_copy _frida_g_value_array_copy -#define g_value_array_free _frida_g_value_array_free -#define g_value_array_get_nth _frida_g_value_array_get_nth -#define g_value_array_get_type _frida_g_value_array_get_type -#define g_value_array_insert _frida_g_value_array_insert -#define g_value_array_new _frida_g_value_array_new -#define g_value_array_prepend _frida_g_value_array_prepend -#define g_value_array_remove _frida_g_value_array_remove -#define g_value_array_sort _frida_g_value_array_sort -#define g_value_array_sort_with_data _frida_g_value_array_sort_with_data -#define g_value_copy _frida_g_value_copy -#define g_value_dup_boxed _frida_g_value_dup_boxed -#define g_value_dup_object _frida_g_value_dup_object -#define g_value_dup_param _frida_g_value_dup_param -#define g_value_dup_string _frida_g_value_dup_string -#define g_value_dup_variant _frida_g_value_dup_variant -#define g_value_fits_pointer _frida_g_value_fits_pointer -#define g_value_get_boolean _frida_g_value_get_boolean -#define g_value_get_boxed _frida_g_value_get_boxed -#define g_value_get_char _frida_g_value_get_char -#define g_value_get_double _frida_g_value_get_double -#define g_value_get_enum _frida_g_value_get_enum -#define g_value_get_flags _frida_g_value_get_flags -#define g_value_get_float _frida_g_value_get_float -#define g_value_get_gtype _frida_g_value_get_gtype -#define g_value_get_int _frida_g_value_get_int -#define g_value_get_int64 _frida_g_value_get_int64 -#define g_value_get_long _frida_g_value_get_long -#define g_value_get_object _frida_g_value_get_object -#define g_value_get_param _frida_g_value_get_param -#define g_value_get_pointer _frida_g_value_get_pointer -#define g_value_get_schar _frida_g_value_get_schar -#define g_value_get_string _frida_g_value_get_string -#define g_value_get_type _frida_g_value_get_type -#define g_value_get_uchar _frida_g_value_get_uchar -#define g_value_get_uint _frida_g_value_get_uint -#define g_value_get_uint64 _frida_g_value_get_uint64 -#define g_value_get_ulong _frida_g_value_get_ulong -#define g_value_get_variant _frida_g_value_get_variant -#define g_value_init _frida_g_value_init -#define g_value_init_from_instance _frida_g_value_init_from_instance -#define g_value_peek_pointer _frida_g_value_peek_pointer -#define g_value_register_transform_func _frida_g_value_register_transform_func -#define g_value_reset _frida_g_value_reset -#define g_value_set_boolean _frida_g_value_set_boolean -#define g_value_set_boxed _frida_g_value_set_boxed -#define g_value_set_boxed_take_ownership _frida_g_value_set_boxed_take_ownership -#define g_value_set_char _frida_g_value_set_char -#define g_value_set_double _frida_g_value_set_double -#define g_value_set_enum _frida_g_value_set_enum -#define g_value_set_flags _frida_g_value_set_flags -#define g_value_set_float _frida_g_value_set_float -#define g_value_set_gtype _frida_g_value_set_gtype -#define g_value_set_instance _frida_g_value_set_instance -#define g_value_set_int _frida_g_value_set_int -#define g_value_set_int64 _frida_g_value_set_int64 -#define g_value_set_interned_string _frida_g_value_set_interned_string -#define g_value_set_long _frida_g_value_set_long -#define g_value_set_object _frida_g_value_set_object -#define g_value_set_object_take_ownership _frida_g_value_set_object_take_ownership -#define g_value_set_param _frida_g_value_set_param -#define g_value_set_param_take_ownership _frida_g_value_set_param_take_ownership -#define g_value_set_pointer _frida_g_value_set_pointer -#define g_value_set_schar _frida_g_value_set_schar -#define g_value_set_static_boxed _frida_g_value_set_static_boxed -#define g_value_set_static_string _frida_g_value_set_static_string -#define g_value_set_string _frida_g_value_set_string -#define g_value_set_string_take_ownership _frida_g_value_set_string_take_ownership -#define g_value_set_uchar _frida_g_value_set_uchar -#define g_value_set_uint _frida_g_value_set_uint -#define g_value_set_uint64 _frida_g_value_set_uint64 -#define g_value_set_ulong _frida_g_value_set_ulong -#define g_value_set_variant _frida_g_value_set_variant -#define g_value_take_boxed _frida_g_value_take_boxed -#define g_value_take_object _frida_g_value_take_object -#define g_value_take_param _frida_g_value_take_param -#define g_value_take_string _frida_g_value_take_string -#define g_value_take_variant _frida_g_value_take_variant -#define g_value_transform _frida_g_value_transform -#define g_value_type_compatible _frida_g_value_type_compatible -#define g_value_type_transformable _frida_g_value_type_transformable -#define g_value_unset _frida_g_value_unset -#define g_variant_builder_add _frida_g_variant_builder_add -#define g_variant_builder_add_parsed _frida_g_variant_builder_add_parsed -#define g_variant_builder_add_value _frida_g_variant_builder_add_value -#define g_variant_builder_clear _frida_g_variant_builder_clear -#define g_variant_builder_close _frida_g_variant_builder_close -#define g_variant_builder_end _frida_g_variant_builder_end -#define g_variant_builder_get_type _frida_g_variant_builder_get_type -#define g_variant_builder_init _frida_g_variant_builder_init -#define g_variant_builder_new _frida_g_variant_builder_new -#define g_variant_builder_open _frida_g_variant_builder_open -#define g_variant_builder_ref _frida_g_variant_builder_ref -#define g_variant_builder_unref _frida_g_variant_builder_unref -#define g_variant_byteswap _frida_g_variant_byteswap -#define g_variant_check_format_string _frida_g_variant_check_format_string -#define g_variant_classify _frida_g_variant_classify -#define g_variant_compare _frida_g_variant_compare -#define g_variant_dict_clear _frida_g_variant_dict_clear -#define g_variant_dict_contains _frida_g_variant_dict_contains -#define g_variant_dict_end _frida_g_variant_dict_end -#define g_variant_dict_get_type _frida_g_variant_dict_get_type -#define g_variant_dict_init _frida_g_variant_dict_init -#define g_variant_dict_insert _frida_g_variant_dict_insert -#define g_variant_dict_insert_value _frida_g_variant_dict_insert_value -#define g_variant_dict_lookup _frida_g_variant_dict_lookup -#define g_variant_dict_lookup_value _frida_g_variant_dict_lookup_value -#define g_variant_dict_new _frida_g_variant_dict_new -#define g_variant_dict_ref _frida_g_variant_dict_ref -#define g_variant_dict_remove _frida_g_variant_dict_remove -#define g_variant_dict_unref _frida_g_variant_dict_unref -#define g_variant_dup_bytestring _frida_g_variant_dup_bytestring -#define g_variant_dup_bytestring_array _frida_g_variant_dup_bytestring_array -#define g_variant_dup_objv _frida_g_variant_dup_objv -#define g_variant_dup_string _frida_g_variant_dup_string -#define g_variant_dup_strv _frida_g_variant_dup_strv -#define g_variant_equal _frida_g_variant_equal -#define g_variant_format_string_scan _frida_g_variant_format_string_scan -#define g_variant_format_string_scan_type _frida_g_variant_format_string_scan_type -#define g_variant_get _frida_g_variant_get -#define g_variant_get_boolean _frida_g_variant_get_boolean -#define g_variant_get_byte _frida_g_variant_get_byte -#define g_variant_get_bytestring _frida_g_variant_get_bytestring -#define g_variant_get_bytestring_array _frida_g_variant_get_bytestring_array -#define g_variant_get_child _frida_g_variant_get_child -#define g_variant_get_child_value _frida_g_variant_get_child_value -#define g_variant_get_data _frida_g_variant_get_data -#define g_variant_get_data_as_bytes _frida_g_variant_get_data_as_bytes -#define g_variant_get_depth _frida_g_variant_get_depth -#define g_variant_get_double _frida_g_variant_get_double -#define g_variant_get_fixed_array _frida_g_variant_get_fixed_array -#define g_variant_get_gtype _frida_g_variant_get_gtype -#define g_variant_get_handle _frida_g_variant_get_handle -#define g_variant_get_int16 _frida_g_variant_get_int16 -#define g_variant_get_int32 _frida_g_variant_get_int32 -#define g_variant_get_int64 _frida_g_variant_get_int64 -#define g_variant_get_maybe _frida_g_variant_get_maybe -#define g_variant_get_normal_form _frida_g_variant_get_normal_form -#define g_variant_get_objv _frida_g_variant_get_objv -#define g_variant_get_size _frida_g_variant_get_size -#define g_variant_get_string _frida_g_variant_get_string -#define g_variant_get_strv _frida_g_variant_get_strv -#define g_variant_get_type _frida_g_variant_get_type -#define g_variant_get_type_info _frida_g_variant_get_type_info -#define g_variant_get_type_string _frida_g_variant_get_type_string -#define g_variant_get_uint16 _frida_g_variant_get_uint16 -#define g_variant_get_uint32 _frida_g_variant_get_uint32 -#define g_variant_get_uint64 _frida_g_variant_get_uint64 -#define g_variant_get_va _frida_g_variant_get_va -#define g_variant_get_variant _frida_g_variant_get_variant -#define g_variant_hash _frida_g_variant_hash -#define g_variant_is_container _frida_g_variant_is_container -#define g_variant_is_floating _frida_g_variant_is_floating -#define g_variant_is_normal_form _frida_g_variant_is_normal_form -#define g_variant_is_object_path _frida_g_variant_is_object_path -#define g_variant_is_of_type _frida_g_variant_is_of_type -#define g_variant_is_signature _frida_g_variant_is_signature -#define g_variant_is_trusted _frida_g_variant_is_trusted -#define g_variant_iter_copy _frida_g_variant_iter_copy -#define g_variant_iter_free _frida_g_variant_iter_free -#define g_variant_iter_init _frida_g_variant_iter_init -#define g_variant_iter_loop _frida_g_variant_iter_loop -#define g_variant_iter_n_children _frida_g_variant_iter_n_children -#define g_variant_iter_new _frida_g_variant_iter_new -#define g_variant_iter_next _frida_g_variant_iter_next -#define g_variant_iter_next_value _frida_g_variant_iter_next_value -#define g_variant_lookup _frida_g_variant_lookup -#define g_variant_lookup_value _frida_g_variant_lookup_value -#define g_variant_n_children _frida_g_variant_n_children -#define g_variant_new _frida_g_variant_new -#define g_variant_new_array _frida_g_variant_new_array -#define g_variant_new_boolean _frida_g_variant_new_boolean -#define g_variant_new_byte _frida_g_variant_new_byte -#define g_variant_new_bytestring _frida_g_variant_new_bytestring -#define g_variant_new_bytestring_array _frida_g_variant_new_bytestring_array -#define g_variant_new_dict_entry _frida_g_variant_new_dict_entry -#define g_variant_new_double _frida_g_variant_new_double -#define g_variant_new_fixed_array _frida_g_variant_new_fixed_array -#define g_variant_new_from_bytes _frida_g_variant_new_from_bytes -#define g_variant_new_from_children _frida_g_variant_new_from_children -#define g_variant_new_from_data _frida_g_variant_new_from_data -#define g_variant_new_handle _frida_g_variant_new_handle -#define g_variant_new_int16 _frida_g_variant_new_int16 -#define g_variant_new_int32 _frida_g_variant_new_int32 -#define g_variant_new_int64 _frida_g_variant_new_int64 -#define g_variant_new_maybe _frida_g_variant_new_maybe -#define g_variant_new_object_path _frida_g_variant_new_object_path -#define g_variant_new_objv _frida_g_variant_new_objv -#define g_variant_new_parsed _frida_g_variant_new_parsed -#define g_variant_new_parsed_va _frida_g_variant_new_parsed_va -#define g_variant_new_printf _frida_g_variant_new_printf -#define g_variant_new_signature _frida_g_variant_new_signature -#define g_variant_new_string _frida_g_variant_new_string -#define g_variant_new_strv _frida_g_variant_new_strv -#define g_variant_new_take_string _frida_g_variant_new_take_string -#define g_variant_new_tuple _frida_g_variant_new_tuple -#define g_variant_new_uint16 _frida_g_variant_new_uint16 -#define g_variant_new_uint32 _frida_g_variant_new_uint32 -#define g_variant_new_uint64 _frida_g_variant_new_uint64 -#define g_variant_new_va _frida_g_variant_new_va -#define g_variant_new_variant _frida_g_variant_new_variant -#define g_variant_parse _frida_g_variant_parse -#define g_variant_parse_error_print_context _frida_g_variant_parse_error_print_context -#define g_variant_parse_error_quark _frida_g_variant_parse_error_quark -#define g_variant_parser_get_error_quark _frida_g_variant_parser_get_error_quark -#define g_variant_print _frida_g_variant_print -#define g_variant_print_string _frida_g_variant_print_string -#define g_variant_ref _frida_g_variant_ref -#define g_variant_ref_sink _frida_g_variant_ref_sink -#define g_variant_serialised_byteswap _frida_g_variant_serialised_byteswap -#define g_variant_serialised_check _frida_g_variant_serialised_check -#define g_variant_serialised_get_child _frida_g_variant_serialised_get_child -#define g_variant_serialised_is_normal _frida_g_variant_serialised_is_normal -#define g_variant_serialised_n_children _frida_g_variant_serialised_n_children -#define g_variant_serialiser_is_object_path _frida_g_variant_serialiser_is_object_path -#define g_variant_serialiser_is_signature _frida_g_variant_serialiser_is_signature -#define g_variant_serialiser_is_string _frida_g_variant_serialiser_is_string -#define g_variant_serialiser_needed_size _frida_g_variant_serialiser_needed_size -#define g_variant_serialiser_serialise _frida_g_variant_serialiser_serialise -#define g_variant_store _frida_g_variant_store -#define g_variant_take_ref _frida_g_variant_take_ref -#define g_variant_type_checked_ _frida_g_variant_type_checked_ -#define g_variant_type_copy _frida_g_variant_type_copy -#define g_variant_type_dup_string _frida_g_variant_type_dup_string -#define g_variant_type_element _frida_g_variant_type_element -#define g_variant_type_equal _frida_g_variant_type_equal -#define g_variant_type_first _frida_g_variant_type_first -#define g_variant_type_free _frida_g_variant_type_free -#define g_variant_type_get_gtype _frida_g_variant_type_get_gtype -#define g_variant_type_get_string_length _frida_g_variant_type_get_string_length -#define g_variant_type_hash _frida_g_variant_type_hash -#define g_variant_type_info_assert_no_infos _frida_g_variant_type_info_assert_no_infos -#define g_variant_type_info_element _frida_g_variant_type_info_element -#define g_variant_type_info_get _frida_g_variant_type_info_get -#define g_variant_type_info_get_type_string _frida_g_variant_type_info_get_type_string -#define g_variant_type_info_member_info _frida_g_variant_type_info_member_info -#define g_variant_type_info_n_members _frida_g_variant_type_info_n_members -#define g_variant_type_info_query _frida_g_variant_type_info_query -#define g_variant_type_info_query_depth _frida_g_variant_type_info_query_depth -#define g_variant_type_info_query_element _frida_g_variant_type_info_query_element -#define g_variant_type_info_ref _frida_g_variant_type_info_ref -#define g_variant_type_info_unref _frida_g_variant_type_info_unref -#define g_variant_type_is_array _frida_g_variant_type_is_array -#define g_variant_type_is_basic _frida_g_variant_type_is_basic -#define g_variant_type_is_container _frida_g_variant_type_is_container -#define g_variant_type_is_definite _frida_g_variant_type_is_definite -#define g_variant_type_is_dict_entry _frida_g_variant_type_is_dict_entry -#define g_variant_type_is_maybe _frida_g_variant_type_is_maybe -#define g_variant_type_is_subtype_of _frida_g_variant_type_is_subtype_of -#define g_variant_type_is_tuple _frida_g_variant_type_is_tuple -#define g_variant_type_is_variant _frida_g_variant_type_is_variant -#define g_variant_type_key _frida_g_variant_type_key -#define g_variant_type_n_items _frida_g_variant_type_n_items -#define g_variant_type_new _frida_g_variant_type_new -#define g_variant_type_new_array _frida_g_variant_type_new_array -#define g_variant_type_new_dict_entry _frida_g_variant_type_new_dict_entry -#define g_variant_type_new_maybe _frida_g_variant_type_new_maybe -#define g_variant_type_new_tuple _frida_g_variant_type_new_tuple -#define g_variant_type_next _frida_g_variant_type_next -#define g_variant_type_peek_string _frida_g_variant_type_peek_string -#define g_variant_type_string_get_depth_ _frida_g_variant_type_string_get_depth_ -#define g_variant_type_string_is_valid _frida_g_variant_type_string_is_valid -#define g_variant_type_string_scan _frida_g_variant_type_string_scan -#define g_variant_type_value _frida_g_variant_type_value -#define g_variant_unref _frida_g_variant_unref -#define g_vasprintf _frida_g_vasprintf -#define g_vfprintf _frida_g_vfprintf -#define g_vfs_get_default _frida_g_vfs_get_default -#define g_vfs_get_file_for_path _frida_g_vfs_get_file_for_path -#define g_vfs_get_file_for_uri _frida_g_vfs_get_file_for_uri -#define g_vfs_get_local _frida_g_vfs_get_local -#define g_vfs_get_supported_uri_schemes _frida_g_vfs_get_supported_uri_schemes -#define g_vfs_get_type _frida_g_vfs_get_type -#define g_vfs_is_active _frida_g_vfs_is_active -#define g_vfs_parse_name _frida_g_vfs_parse_name -#define g_vfs_register_uri_scheme _frida_g_vfs_register_uri_scheme -#define g_vfs_unregister_uri_scheme _frida_g_vfs_unregister_uri_scheme -#define g_volume_can_eject _frida_g_volume_can_eject -#define g_volume_can_mount _frida_g_volume_can_mount -#define g_volume_eject _frida_g_volume_eject -#define g_volume_eject_finish _frida_g_volume_eject_finish -#define g_volume_eject_with_operation _frida_g_volume_eject_with_operation -#define g_volume_eject_with_operation_finish _frida_g_volume_eject_with_operation_finish -#define g_volume_enumerate_identifiers _frida_g_volume_enumerate_identifiers -#define g_volume_get_activation_root _frida_g_volume_get_activation_root -#define g_volume_get_drive _frida_g_volume_get_drive -#define g_volume_get_icon _frida_g_volume_get_icon -#define g_volume_get_identifier _frida_g_volume_get_identifier -#define g_volume_get_mount _frida_g_volume_get_mount -#define g_volume_get_name _frida_g_volume_get_name -#define g_volume_get_sort_key _frida_g_volume_get_sort_key -#define g_volume_get_symbolic_icon _frida_g_volume_get_symbolic_icon -#define g_volume_get_type _frida_g_volume_get_type -#define g_volume_get_uuid _frida_g_volume_get_uuid -#define g_volume_monitor_adopt_orphan_mount _frida_g_volume_monitor_adopt_orphan_mount -#define g_volume_monitor_get _frida_g_volume_monitor_get -#define g_volume_monitor_get_connected_drives _frida_g_volume_monitor_get_connected_drives -#define g_volume_monitor_get_mount_for_uuid _frida_g_volume_monitor_get_mount_for_uuid -#define g_volume_monitor_get_mounts _frida_g_volume_monitor_get_mounts -#define g_volume_monitor_get_type _frida_g_volume_monitor_get_type -#define g_volume_monitor_get_volume_for_uuid _frida_g_volume_monitor_get_volume_for_uuid -#define g_volume_monitor_get_volumes _frida_g_volume_monitor_get_volumes -#define g_volume_mount _frida_g_volume_mount -#define g_volume_mount_finish _frida_g_volume_mount_finish -#define g_volume_should_automount _frida_g_volume_should_automount -#define g_vprintf _frida_g_vprintf -#define g_vsnprintf _frida_g_vsnprintf -#define g_vsprintf _frida_g_vsprintf -#define g_wakeup_acknowledge _frida_g_wakeup_acknowledge -#define g_wakeup_free _frida_g_wakeup_free -#define g_wakeup_get_pollfd _frida_g_wakeup_get_pollfd -#define g_wakeup_new _frida_g_wakeup_new -#define g_wakeup_signal _frida_g_wakeup_signal -#define g_warn_message _frida_g_warn_message -#define g_weak_ref_clear _frida_g_weak_ref_clear -#define g_weak_ref_get _frida_g_weak_ref_get -#define g_weak_ref_init _frida_g_weak_ref_init -#define g_weak_ref_set _frida_g_weak_ref_set -#define g_zlib_compressor_format_get_type _frida_g_zlib_compressor_format_get_type -#define g_zlib_compressor_get_file_info _frida_g_zlib_compressor_get_file_info -#define g_zlib_compressor_get_type _frida_g_zlib_compressor_get_type -#define g_zlib_compressor_new _frida_g_zlib_compressor_new -#define g_zlib_compressor_set_file_info _frida_g_zlib_compressor_set_file_info -#define g_zlib_decompressor_get_file_info _frida_g_zlib_decompressor_get_file_info -#define g_zlib_decompressor_get_type _frida_g_zlib_decompressor_get_type -#define g_zlib_decompressor_new _frida_g_zlib_decompressor_new -#define gio_deinit _frida_gio_deinit -#define gio_init _frida_gio_init -#define gio_prepare_to_fork _frida_gio_prepare_to_fork -#define gio_recover_from_fork_in_child _frida_gio_recover_from_fork_in_child -#define gio_recover_from_fork_in_parent _frida_gio_recover_from_fork_in_parent -#define gio_shutdown _frida_gio_shutdown -#define glib__private__ _frida_glib__private__ -#define glib_binary_age _frida_glib_binary_age -#define glib_check_version _frida_glib_check_version -#define glib_deinit _frida_glib_deinit -#define glib_fd_callbacks _frida_glib_fd_callbacks -#define glib_gettext _frida_glib_gettext -#define glib_has_dconf_access_in_sandbox _frida_glib_has_dconf_access_in_sandbox -#define glib_init _frida_glib_init -#define glib_interface_age _frida_glib_interface_age -#define glib_major_version _frida_glib_major_version -#define glib_mem_profiler_table _frida_glib_mem_profiler_table -#define glib_mem_table _frida_glib_mem_table -#define glib_micro_version _frida_glib_micro_version -#define glib_minor_version _frida_glib_minor_version -#define glib_network_available_in_sandbox _frida_glib_network_available_in_sandbox -#define glib_on_error_halt _frida_glib_on_error_halt -#define glib_pgettext _frida_glib_pgettext -#define glib_prepare_to_fork _frida_glib_prepare_to_fork -#define glib_recover_from_fork_in_child _frida_glib_recover_from_fork_in_child -#define glib_recover_from_fork_in_parent _frida_glib_recover_from_fork_in_parent -#define glib_should_use_portal _frida_glib_should_use_portal -#define glib_shutdown _frida_glib_shutdown -#define glib_thread_callbacks _frida_glib_thread_callbacks -#define gobject_init _frida_gobject_init - -#endif - -/* - * Copyright (C) 2008-2019 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_H__ -#define __GUM_H__ - -/* - * Copyright (C) 2008-2020 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUMDEFS_H__ -#define __GUMDEFS_H__ - - -/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */ - -#ifndef __GUM_ENUM_TYPES_H__ -#define __GUM_ENUM_TYPES_H__ - -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 1998, 1999, 2000 Tim Janik and Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ -#ifndef __GLIB_GOBJECT_H__ -#define __GLIB_GOBJECT_H__ - -#define __GLIB_GOBJECT_H_INSIDE__ - -/* gbinding.h: Binding for object properties - * - * Copyright (C) 2010 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - * - * Author: Emmanuele Bassi - */ - -#ifndef __G_BINDING_H__ -#define __G_BINDING_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_LIB_H__ -#define __G_LIB_H__ - -#define __GLIB_H_INSIDE__ - -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_ALLOCA_H__ -#define __G_ALLOCA_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_TYPES_H__ -#define __G_TYPES_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -/* glibconfig.h - * - * This is a generated file. Please modify 'glibconfig.h.in' - */ - -#ifndef __GLIBCONFIG_H__ -#define __GLIBCONFIG_H__ - -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -/* This file must not include any other glib header file and must thus - * not refer to variables from glibconfig.h - */ - -#ifndef __G_MACROS_H__ -#define __G_MACROS_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -/* We include stddef.h to get the system's definition of NULL - */ -#include - -#ifdef __GNUC__ -#define G_GNUC_CHECK_VERSION(major, minor) \ - ((__GNUC__ > (major)) || \ - ((__GNUC__ == (major)) && \ - (__GNUC_MINOR__ >= (minor)))) -#else -#define G_GNUC_CHECK_VERSION(major, minor) 0 -#endif - -/* Here we provide G_GNUC_EXTENSION as an alias for __extension__, - * where this is valid. This allows for warningless compilation of - * "long long" types even in the presence of '-ansi -pedantic'. - */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) -#define G_GNUC_EXTENSION __extension__ -#else -#define G_GNUC_EXTENSION -#endif - -/* Every compiler that we target supports inlining, but some of them may - * complain about it if we don't say "__inline". If we have C99, or if - * we are using C++, then we can use "inline" directly. Unfortunately - * Visual Studio does not support __STDC_VERSION__, so we need to check - * whether we are on Visual Studio 2013 or earlier to see that we need to - * say "__inline" in C mode. - * Otherwise, we say "__inline" to avoid the warning. - */ -#define G_CAN_INLINE -#ifndef __cplusplus -# ifdef _MSC_VER -# if (_MSC_VER < 1900) -# define G_INLINE_DEFINE_NEEDED -# endif -# elif !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199900) -# define G_INLINE_DEFINE_NEEDED -# endif -#endif - -#ifdef G_INLINE_DEFINE_NEEDED -# undef inline -# define inline __inline -#endif - -#undef G_INLINE_DEFINE_NEEDED - -/** - * G_INLINE_FUNC: - * - * This macro used to be used to conditionally define inline functions - * in a compatible way before this feature was supported in all - * compilers. These days, GLib requires inlining support from the - * compiler, so your GLib-using programs can safely assume that the - * "inline" keyword works properly. - * - * Never use this macro anymore. Just say "static inline". - * - * Deprecated: 2.48: Use "static inline" instead - */ - -/* For historical reasons we need to continue to support those who - * define G_IMPLEMENT_INLINES to mean "don't implement this here". - */ -#ifdef G_IMPLEMENT_INLINES -# define G_INLINE_FUNC extern GLIB_DEPRECATED_MACRO_IN_2_48_FOR(static inline) -# undef G_CAN_INLINE -#else -# define G_INLINE_FUNC static inline GLIB_DEPRECATED_MACRO_IN_2_48_FOR(static inline) -#endif /* G_IMPLEMENT_INLINES */ - -/* Provide macros to feature the GCC function attribute. - */ - -/** - * G_GNUC_PURE: - * - * Expands to the GNU C `pure` function attribute if the compiler is gcc. - * Declaring a function as `pure` enables better optimization of calls to - * the function. A `pure` function has no effects except its return value - * and the return value depends only on the parameters and/or global - * variables. - * - * Place the attribute after the declaration, just before the semicolon. - * - * |[ - * gboolean g_type_check_value (const GValue *value) G_GNUC_PURE; - * ]| - * - * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-pure-function-attribute) for more details. - */ - -/** - * G_GNUC_MALLOC: - * - * Expands to the - * [GNU C `malloc` function attribute](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-functions-that-behave-like-malloc) - * if the compiler is gcc. - * Declaring a function as `malloc` enables better optimization of the function, - * but must only be done if the allocation behaviour of the function is fully - * understood, otherwise miscompilation can result. - * - * A function can have the `malloc` attribute if it returns a pointer which is - * guaranteed to not alias with any other pointer valid when the function - * returns, and moreover no pointers to valid objects occur in any storage - * addressed by the returned pointer. - * - * In practice, this means that `G_GNUC_MALLOC` can be used with any function - * which returns unallocated or zeroed-out memory, but not with functions which - * return initialised structures containing other pointers, or with functions - * that reallocate memory. This definition changed in GLib 2.58 to match the - * stricter definition introduced around GCC 5. - * - * Place the attribute after the declaration, just before the semicolon. - * - * |[ - * gpointer g_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); - * ]| - * - * See the - * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-functions-that-behave-like-malloc) - * for more details. - * - * Since: 2.6 - */ - -/** - * G_GNUC_NO_INLINE: - * - * Expands to the GNU C `noinline` function attribute if the compiler is gcc. - * If the compiler is not gcc, this macro expands to nothing. - * - * Declaring a function as `noinline` prevents the function from being - * considered for inlining. - * - * The attribute may be placed before the declaration or definition, - * right before the `static` keyword. - * - * |[ - * G_GNUC_NO_INLINE - * static int - * do_not_inline_this (void) - * { - * ... - * } - * ]| - * - * See the - * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noinline-function-attribute) - * for more details. - * - * Since: 2.58 - */ - -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -#define G_GNUC_PURE __attribute__((__pure__)) -#define G_GNUC_MALLOC __attribute__((__malloc__)) -#define G_GNUC_NO_INLINE __attribute__((noinline)) -#else -#define G_GNUC_PURE -#define G_GNUC_MALLOC -#define G_GNUC_NO_INLINE -#endif - -/** - * G_GNUC_NULL_TERMINATED: - * - * Expands to the GNU C `sentinel` function attribute if the compiler is gcc. - * This function attribute only applies to variadic functions and instructs - * the compiler to check that the argument list is terminated with an - * explicit %NULL. - * - * Place the attribute after the declaration, just before the semicolon. - * - * |[ - * gchar *g_strconcat (const gchar *string1, - * ...) G_GNUC_NULL_TERMINATED; - * ]| - * - * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-sentinel-function-attribute) for more details. - * - * Since: 2.8 - */ -#if __GNUC__ >= 4 -#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) -#else -#define G_GNUC_NULL_TERMINATED -#endif - -/* - * We can only use __typeof__ on GCC >= 4.8, and not when compiling C++. Since - * __typeof__ is used in a few places in GLib, provide a pre-processor symbol - * to factor the check out from callers. - * - * This symbol is private. - */ -#undef glib_typeof -#if !defined(__cplusplus) && \ - ((defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) || \ - defined(__clang__)) -#define glib_typeof(t) __typeof__ (t) -#endif - -/* - * Clang feature detection: http://clang.llvm.org/docs/LanguageExtensions.html - * These are not available on GCC, but since the pre-processor doesn't do - * operator short-circuiting, we can't use it in a statement or we'll get: - * - * error: missing binary operator before token "(" - * - * So we define it to 0 to satisfy the pre-processor. - */ - -#ifdef __has_attribute -#define g_macro__has_attribute __has_attribute -#else -#define g_macro__has_attribute(x) 0 -#endif - -#ifdef __has_feature -#define g_macro__has_feature __has_feature -#else -#define g_macro__has_feature(x) 0 -#endif - -#ifdef __has_builtin -#define g_macro__has_builtin __has_builtin -#else -#define g_macro__has_builtin(x) 0 -#endif - -/** - * G_GNUC_ALLOC_SIZE: - * @x: the index of the argument specifying the allocation size - * - * Expands to the GNU C `alloc_size` function attribute if the compiler - * is a new enough gcc. This attribute tells the compiler that the - * function returns a pointer to memory of a size that is specified - * by the @xth function parameter. - * - * Place the attribute after the function declaration, just before the - * semicolon. - * - * |[ - * gpointer g_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); - * ]| - * - * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-alloc_005fsize-function-attribute) for more details. - * - * Since: 2.18 - */ - -/** - * G_GNUC_ALLOC_SIZE2: - * @x: the index of the argument specifying one factor of the allocation size - * @y: the index of the argument specifying the second factor of the allocation size - * - * Expands to the GNU C `alloc_size` function attribute if the compiler is a - * new enough gcc. This attribute tells the compiler that the function returns - * a pointer to memory of a size that is specified by the product of two - * function parameters. - * - * Place the attribute after the function declaration, just before the - * semicolon. - * - * |[ - * gpointer g_malloc_n (gsize n_blocks, - * gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1, 2); - * ]| - * - * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-alloc_005fsize-function-attribute) for more details. - * - * Since: 2.18 - */ -#if (!defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || \ - (defined(__clang__) && g_macro__has_attribute(__alloc_size__)) -#define G_GNUC_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) -#define G_GNUC_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y))) -#else -#define G_GNUC_ALLOC_SIZE(x) -#define G_GNUC_ALLOC_SIZE2(x,y) -#endif - -/** - * G_GNUC_PRINTF: - * @format_idx: the index of the argument corresponding to the - * format string (the arguments are numbered from 1) - * @arg_idx: the index of the first of the format arguments, or 0 if - * there are no format arguments - * - * Expands to the GNU C `format` function attribute if the compiler is gcc. - * This is used for declaring functions which take a variable number of - * arguments, with the same syntax as `printf()`. It allows the compiler - * to type-check the arguments passed to the function. - * - * Place the attribute after the function declaration, just before the - * semicolon. - * - * See the - * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288) - * for more details. - * - * |[ - * gint g_snprintf (gchar *string, - * gulong n, - * gchar const *format, - * ...) G_GNUC_PRINTF (3, 4); - * ]| - */ - -/** - * G_GNUC_SCANF: - * @format_idx: the index of the argument corresponding to - * the format string (the arguments are numbered from 1) - * @arg_idx: the index of the first of the format arguments, or 0 if - * there are no format arguments - * - * Expands to the GNU C `format` function attribute if the compiler is gcc. - * This is used for declaring functions which take a variable number of - * arguments, with the same syntax as `scanf()`. It allows the compiler - * to type-check the arguments passed to the function. - * - * |[ - * int my_scanf (MyStream *stream, - * const char *format, - * ...) G_GNUC_SCANF (2, 3); - * int my_vscanf (MyStream *stream, - * const char *format, - * va_list ap) G_GNUC_SCANF (2, 0); - * ]| - * - * See the - * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288) - * for details. - */ - -/** - * G_GNUC_STRFTIME: - * @format_idx: the index of the argument corresponding to - * the format string (the arguments are numbered from 1) - * - * Expands to the GNU C `strftime` format function attribute if the compiler - * is gcc. This is used for declaring functions which take a format argument - * which is passed to `strftime()` or an API implementing its formats. It allows - * the compiler check the format passed to the function. - * - * |[ - * gsize my_strftime (MyBuffer *buffer, - * const char *format, - * const struct tm *tm) G_GNUC_STRFTIME (2); - * ]| - * - * See the - * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288) - * for details. - * - * Since: 2.60 - */ - -/** - * G_GNUC_FORMAT: - * @arg_idx: the index of the argument - * - * Expands to the GNU C `format_arg` function attribute if the compiler - * is gcc. This function attribute specifies that a function takes a - * format string for a `printf()`, `scanf()`, `strftime()` or `strfmon()` style - * function and modifies it, so that the result can be passed to a `printf()`, - * `scanf()`, `strftime()` or `strfmon()` style function (with the remaining - * arguments to the format function the same as they would have been - * for the unmodified string). - * - * Place the attribute after the function declaration, just before the - * semicolon. - * - * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-nonliteral-1) for more details. - * - * |[ - * gchar *g_dgettext (gchar *domain_name, gchar *msgid) G_GNUC_FORMAT (2); - * ]| - */ - -/** - * G_GNUC_NORETURN: - * - * Expands to the GNU C `noreturn` function attribute if the compiler is gcc. - * It is used for declaring functions which never return. It enables - * optimization of the function, and avoids possible compiler warnings. - * - * Since 2.68, it is recommended that code uses %G_NORETURN instead of - * %G_GNUC_NORETURN, as that works on more platforms and compilers (in - * particular, MSVC and C++11) than %G_GNUC_NORETURN, which works with GCC and - * Clang only. %G_GNUC_NORETURN continues to work, so has not been deprecated - * yet. - * - * Place the attribute after the declaration, just before the semicolon. - * - * |[ - * void g_abort (void) G_GNUC_NORETURN; - * ]| - * - * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noreturn-function-attribute) for more details. - */ - -/** - * G_GNUC_CONST: - * - * Expands to the GNU C `const` function attribute if the compiler is gcc. - * Declaring a function as `const` enables better optimization of calls to - * the function. A `const` function doesn't examine any values except its - * parameters, and has no effects except its return value. - * - * Place the attribute after the declaration, just before the semicolon. - * - * |[ - * gchar g_ascii_tolower (gchar c) G_GNUC_CONST; - * ]| - * - * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-const-function-attribute) for more details. - * - * A function that has pointer arguments and examines the data pointed to - * must not be declared `const`. Likewise, a function that calls a non-`const` - * function usually must not be `const`. It doesn't make sense for a `const` - * function to return `void`. - */ - -/** - * G_GNUC_UNUSED: - * - * Expands to the GNU C `unused` function attribute if the compiler is gcc. - * It is used for declaring functions and arguments which may never be used. - * It avoids possible compiler warnings. - * - * For functions, place the attribute after the declaration, just before the - * semicolon. For arguments, place the attribute at the beginning of the - * argument declaration. - * - * |[ - * void my_unused_function (G_GNUC_UNUSED gint unused_argument, - * gint other_argument) G_GNUC_UNUSED; - * ]| - * - * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-unused-function-attribute) for more details. - */ - -/** - * G_GNUC_NO_INSTRUMENT: - * - * Expands to the GNU C `no_instrument_function` function attribute if the - * compiler is gcc. Functions with this attribute will not be instrumented - * for profiling, when the compiler is called with the - * `-finstrument-functions` option. - * - * Place the attribute after the declaration, just before the semicolon. - * - * |[ - * int do_uninteresting_things (void) G_GNUC_NO_INSTRUMENT; - * ]| - * - * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-no_005finstrument_005ffunction-function-attribute) for more details. - */ - -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) -#if !defined (__clang__) && G_GNUC_CHECK_VERSION (4, 4) -#define G_GNUC_PRINTF( format_idx, arg_idx ) \ - __attribute__((__format__ (gnu_printf, format_idx, arg_idx))) -#define G_GNUC_SCANF( format_idx, arg_idx ) \ - __attribute__((__format__ (gnu_scanf, format_idx, arg_idx))) -#define G_GNUC_STRFTIME( format_idx ) \ - __attribute__((__format__ (gnu_strftime, format_idx, 0))) -#else -#define G_GNUC_PRINTF( format_idx, arg_idx ) \ - __attribute__((__format__ (__printf__, format_idx, arg_idx))) -#define G_GNUC_SCANF( format_idx, arg_idx ) \ - __attribute__((__format__ (__scanf__, format_idx, arg_idx))) -#define G_GNUC_STRFTIME( format_idx ) \ - __attribute__((__format__ (__strftime__, format_idx, 0))) -#endif -#define G_GNUC_FORMAT( arg_idx ) \ - __attribute__((__format_arg__ (arg_idx))) -#define G_GNUC_NORETURN \ - __attribute__((__noreturn__)) -#define G_GNUC_CONST \ - __attribute__((__const__)) -#define G_GNUC_UNUSED \ - __attribute__((__unused__)) -#define G_GNUC_NO_INSTRUMENT \ - __attribute__((__no_instrument_function__)) -#else /* !__GNUC__ */ -#define G_GNUC_PRINTF( format_idx, arg_idx ) -#define G_GNUC_SCANF( format_idx, arg_idx ) -#define G_GNUC_STRFTIME( format_idx ) -#define G_GNUC_FORMAT( arg_idx ) -/* NOTE: MSVC has __declspec(noreturn) but unlike GCC __attribute__, - * __declspec can only be placed at the start of the function prototype - * and not at the end, so we can't use it without breaking API. - */ -#define G_GNUC_NORETURN -#define G_GNUC_CONST -#define G_GNUC_UNUSED -#define G_GNUC_NO_INSTRUMENT -#endif /* !__GNUC__ */ - -/** - * G_GNUC_FALLTHROUGH: - * - * Expands to the GNU C `fallthrough` statement attribute if the compiler supports it. - * This allows declaring case statement to explicitly fall through in switch - * statements. To enable this feature, use `-Wimplicit-fallthrough` during - * compilation. - * - * Put the attribute right before the case statement you want to fall through - * to. - * - * |[ - * switch (foo) - * { - * case 1: - * g_message ("it's 1"); - * G_GNUC_FALLTHROUGH; - * case 2: - * g_message ("it's either 1 or 2"); - * break; - * } - * ]| - * - * - * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#index-fallthrough-statement-attribute) for more details. - * - * Since: 2.60 - */ -#if __GNUC__ > 6 -#define G_GNUC_FALLTHROUGH __attribute__((fallthrough)) -#elif g_macro__has_attribute (fallthrough) -#define G_GNUC_FALLTHROUGH __attribute__((fallthrough)) -#else -#define G_GNUC_FALLTHROUGH -#endif /* __GNUC__ */ - -/** - * G_GNUC_DEPRECATED: - * - * Expands to the GNU C `deprecated` attribute if the compiler is gcc. - * It can be used to mark `typedef`s, variables and functions as deprecated. - * When called with the `-Wdeprecated-declarations` option, - * gcc will generate warnings when deprecated interfaces are used. - * - * Place the attribute after the declaration, just before the semicolon. - * - * |[ - * int my_mistake (void) G_GNUC_DEPRECATED; - * ]| - * - * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-deprecated-function-attribute) for more details. - * - * Since: 2.2 - */ -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || defined (__clang__) -#define G_GNUC_DEPRECATED __attribute__((__deprecated__)) -#else -#define G_GNUC_DEPRECATED -#endif /* __GNUC__ */ - -/** - * G_GNUC_DEPRECATED_FOR: - * @f: the intended replacement for the deprecated symbol, - * such as the name of a function - * - * Like %G_GNUC_DEPRECATED, but names the intended replacement for the - * deprecated symbol if the version of gcc in use is new enough to support - * custom deprecation messages. - * - * Place the attribute after the declaration, just before the semicolon. - * - * |[ - * int my_mistake (void) G_GNUC_DEPRECATED_FOR(my_replacement); - * ]| - * - * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-deprecated-function-attribute) for more details. - * - * Note that if @f is a macro, it will be expanded in the warning message. - * You can enclose it in quotes to prevent this. (The quotes will show up - * in the warning, but it's better than showing the macro expansion.) - * - * Since: 2.26 - */ -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || defined (__clang__) -#define G_GNUC_DEPRECATED_FOR(f) \ - __attribute__((deprecated("Use " #f " instead"))) -#else -#define G_GNUC_DEPRECATED_FOR(f) G_GNUC_DEPRECATED -#endif /* __GNUC__ */ - -#ifdef __ICC -#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - _Pragma ("warning (push)") \ - _Pragma ("warning (disable:1478)") -#define G_GNUC_END_IGNORE_DEPRECATIONS \ - _Pragma ("warning (pop)") -#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) -#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"") -#define G_GNUC_END_IGNORE_DEPRECATIONS \ - _Pragma ("GCC diagnostic pop") -#elif defined (_MSC_VER) && (_MSC_VER >= 1500) && !defined (__clang__) -#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - __pragma (warning (push)) \ - __pragma (warning (disable : 4996)) -#define G_GNUC_END_IGNORE_DEPRECATIONS \ - __pragma (warning (pop)) -#elif defined (__clang__) -#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") -#define G_GNUC_END_IGNORE_DEPRECATIONS \ - _Pragma("clang diagnostic pop") -#else -#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS -#define G_GNUC_END_IGNORE_DEPRECATIONS -#endif - -/** - * G_GNUC_MAY_ALIAS: - * - * Expands to the GNU C `may_alias` type attribute if the compiler is gcc. - * Types with this attribute will not be subjected to type-based alias - * analysis, but are assumed to alias with any other type, just like `char`. - * - * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-may_005falias-type-attribute) for details. - * - * Since: 2.14 - */ -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) -#define G_GNUC_MAY_ALIAS __attribute__((may_alias)) -#else -#define G_GNUC_MAY_ALIAS -#endif - -/** - * G_GNUC_WARN_UNUSED_RESULT: - * - * Expands to the GNU C `warn_unused_result` function attribute if the compiler - * is gcc. This function attribute makes the compiler emit a warning if the - * result of a function call is ignored. - * - * Place the attribute after the declaration, just before the semicolon. - * - * |[ - * GList *g_list_append (GList *list, - * gpointer data) G_GNUC_WARN_UNUSED_RESULT; - * ]| - * - * See the [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-warn_005funused_005fresult-function-attribute) for more details. - * - * Since: 2.10 - */ -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -#define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -#else -#define G_GNUC_WARN_UNUSED_RESULT -#endif /* __GNUC__ */ - -/** - * G_GNUC_FUNCTION: - * - * Expands to "" on all modern compilers, and to __FUNCTION__ on gcc - * version 2.x. Don't use it. - * - * Deprecated: 2.16: Use G_STRFUNC() instead - */ - -/** - * G_GNUC_PRETTY_FUNCTION: - * - * Expands to "" on all modern compilers, and to __PRETTY_FUNCTION__ - * on gcc version 2.x. Don't use it. - * - * Deprecated: 2.16: Use G_STRFUNC() instead - */ - -/* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with - * macros, so we can refer to them as strings unconditionally. - * usage not-recommended since gcc-3.0 - * - * Mark them as deprecated since 2.26, since that’s when version macros were - * introduced. - */ -#if defined (__GNUC__) && (__GNUC__ < 3) -#define G_GNUC_FUNCTION __FUNCTION__ GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC) -#define G_GNUC_PRETTY_FUNCTION __PRETTY_FUNCTION__ GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC) -#else /* !__GNUC__ */ -#define G_GNUC_FUNCTION "" GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC) -#define G_GNUC_PRETTY_FUNCTION "" GLIB_DEPRECATED_MACRO_IN_2_26_FOR(G_STRFUNC) -#endif /* !__GNUC__ */ - -#if g_macro__has_feature(attribute_analyzer_noreturn) && defined(__clang_analyzer__) -#define G_ANALYZER_ANALYZING 1 -#define G_ANALYZER_NORETURN __attribute__((analyzer_noreturn)) -#else -#define G_ANALYZER_ANALYZING 0 -#define G_ANALYZER_NORETURN -#endif - -#define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string) -#define G_STRINGIFY_ARG(contents) #contents - -#ifndef __GI_SCANNER__ /* The static assert macro really confuses the introspection parser */ -#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2 -#define G_PASTE(identifier1,identifier2) G_PASTE_ARGS (identifier1, identifier2) -#if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L -#define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false") -#elif (defined(__cplusplus) && __cplusplus >= 201103L) || \ - (defined(__cplusplus) && defined (_MSC_VER) && (_MSC_VER >= 1600)) || \ - (defined (_MSC_VER) && (_MSC_VER >= 1800)) -#define G_STATIC_ASSERT(expr) static_assert (expr, "Expression evaluates to false") -#else -#ifdef __COUNTER__ -#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED -#else -#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __LINE__)[(expr) ? 1 : -1] G_GNUC_UNUSED -#endif -#endif /* __STDC_VERSION__ */ -#define G_STATIC_ASSERT_EXPR(expr) ((void) sizeof (char[(expr) ? 1 : -1])) -#endif /* !__GI_SCANNER__ */ - -/* Provide a string identifying the current code position */ -#if defined(__GNUC__) && (__GNUC__ < 3) && !defined(__cplusplus) -#define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()" -#else -#define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) -#endif - -/* Provide a string identifying the current function, non-concatenatable */ -#if defined (__GNUC__) && defined (__cplusplus) -#define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#define G_STRFUNC ((const char*) (__func__)) -#elif defined (__GNUC__) || (defined(_MSC_VER) && (_MSC_VER > 1300)) -#define G_STRFUNC ((const char*) (__FUNCTION__)) -#else -#define G_STRFUNC ((const char*) ("???")) -#endif - -/* Guard C code in headers, while including them from C++ */ -#ifdef __cplusplus -#define G_BEGIN_DECLS extern "C" { -#define G_END_DECLS } -#else -#define G_BEGIN_DECLS -#define G_END_DECLS -#endif - -/* Provide definitions for some commonly used macros. - * Some of them are only provided if they haven't already - * been defined. It is assumed that if they are already - * defined then the current definition is correct. - */ -#ifndef NULL -# ifdef __cplusplus -# define NULL (0L) -# else /* !__cplusplus */ -# define NULL ((void*) 0) -# endif /* !__cplusplus */ -#endif - -#ifndef FALSE -#define FALSE (0) -#endif - -#ifndef TRUE -#define TRUE (!FALSE) -#endif - -#undef MAX -#define MAX(a, b) (((a) > (b)) ? (a) : (b)) - -#undef MIN -#define MIN(a, b) (((a) < (b)) ? (a) : (b)) - -#undef ABS -#define ABS(a) (((a) < 0) ? -(a) : (a)) - -#undef CLAMP -#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) - -#define G_APPROX_VALUE(a, b, epsilon) \ - (((a) > (b) ? (a) - (b) : (b) - (a)) < (epsilon)) - -/* Count the number of elements in an array. The array must be defined - * as such; using this with a dynamically allocated array will give - * incorrect results. - */ -#define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) - -/* Macros by analogy to GINT_TO_POINTER, GPOINTER_TO_INT - */ -#define GPOINTER_TO_SIZE(p) ((gsize) (p)) -#define GSIZE_TO_POINTER(s) ((gpointer) (gsize) (s)) - -/* Provide convenience macros for handling structure - * fields through their offsets. - */ - -#if (defined(__GNUC__) && __GNUC__ >= 4) || defined (_MSC_VER) -#define G_STRUCT_OFFSET(struct_type, member) \ - ((glong) offsetof (struct_type, member)) -#else -#define G_STRUCT_OFFSET(struct_type, member) \ - ((glong) ((guint8*) &((struct_type*) 0)->member)) -#endif - -#define G_STRUCT_MEMBER_P(struct_p, struct_offset) \ - ((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset))) -#define G_STRUCT_MEMBER(member_type, struct_p, struct_offset) \ - (*(member_type*) G_STRUCT_MEMBER_P ((struct_p), (struct_offset))) - -/* Provide simple macro statement wrappers: - * G_STMT_START { statements; } G_STMT_END; - * This can be used as a single statement, like: - * if (x) G_STMT_START { ... } G_STMT_END; else ... - * This intentionally does not use compiler extensions like GCC's '({...})' to - * avoid portability issue or side effects when compiled with different compilers. - * MSVC complains about "while(0)": C4127: "Conditional expression is constant", - * so we use __pragma to avoid the warning since the use here is intentional. - */ -#if !(defined (G_STMT_START) && defined (G_STMT_END)) -#define G_STMT_START do -#if defined (_MSC_VER) && (_MSC_VER >= 1500) -#define G_STMT_END \ - __pragma(warning(push)) \ - __pragma(warning(disable:4127)) \ - while(0) \ - __pragma(warning(pop)) -#else -#define G_STMT_END while (0) -#endif -#endif - -/* Provide G_ALIGNOF alignment macro. - * - * Note we cannot use the gcc __alignof__ operator here, as that returns the - * preferred alignment rather than the minimal alignment. See - * https://gitlab.gnome.org/GNOME/glib/merge_requests/538/diffs#note_390790. - */ - -/** - * G_ALIGNOF - * @type: a type-name - * - * Return the minimal alignment required by the platform ABI for values of the given - * type. The address of a variable or struct member of the given type must always be - * a multiple of this alignment. For example, most platforms require int variables - * to be aligned at a 4-byte boundary, so `G_ALIGNOF (int)` is 4 on most platforms. - * - * Note this is not necessarily the same as the value returned by GCC’s - * `__alignof__` operator, which returns the preferred alignment for a type. - * The preferred alignment may be a stricter alignment than the minimal - * alignment. - * - * Since: 2.60 - */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__cplusplus) -#define G_ALIGNOF(type) _Alignof (type) -#else -#define G_ALIGNOF(type) (G_STRUCT_OFFSET (struct { char a; type b; }, b)) -#endif - -/** - * G_CONST_RETURN: - * - * If %G_DISABLE_CONST_RETURNS is defined, this macro expands - * to nothing. By default, the macro expands to const. The macro - * can be used in place of const for functions that return a value - * that should not be modified. The purpose of this macro is to allow - * us to turn on const for returned constant strings by default, while - * allowing programmers who find that annoying to turn it off. This macro - * should only be used for return values and for "out" parameters, it - * doesn't make sense for "in" parameters. - * - * Deprecated: 2.30: API providers should replace all existing uses with - * const and API consumers should adjust their code accordingly - */ -#ifdef G_DISABLE_CONST_RETURNS -#define G_CONST_RETURN GLIB_DEPRECATED_MACRO_IN_2_30_FOR(const) -#else -#define G_CONST_RETURN const GLIB_DEPRECATED_MACRO_IN_2_30_FOR(const) -#endif - -/** - * G_NORETURN: - * - * Expands to the GNU C or MSVC `noreturn` function attribute depending on - * the compiler. It is used for declaring functions which never return. - * Enables optimization of the function, and avoids possible compiler warnings. - * - * Note that %G_NORETURN supersedes the previous %G_GNUC_NORETURN macro, which - * will eventually be deprecated. %G_NORETURN supports more platforms. - * - * Place the attribute before the function declaration as follows: - * - * |[ - * G_NORETURN void g_abort (void); - * ]| - * - * Since: 2.68 - */ -/* Note: We can’t annotate this with GLIB_AVAILABLE_MACRO_IN_2_68 because it’s - * used within the GLib headers in function declarations which are always - * evaluated when a header is included. This results in warnings in third party - * code which includes glib.h, even if the third party code doesn’t use the new - * macro itself. */ -#if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__)) || (0x5110 <= __SUNPRO_C) - /* For compatibility with G_NORETURN_FUNCPTR on clang, use - __attribute__((__noreturn__)), not _Noreturn. */ -# define G_NORETURN __attribute__ ((__noreturn__)) -#elif 1200 <= _MSC_VER - /* Use MSVC specific syntax. */ -# define G_NORETURN __declspec (noreturn) - /* Use ISO C++11 syntax when the compiler supports it. */ -#elif (__cplusplus >= 201103 && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) || (_MSC_VER >= 1900) -# define G_NORETURN [[noreturn]] - /* Use ISO C11 syntax when the compiler supports it. */ -#elif __STDC_VERSION__ >= 201112 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) -# define G_NORETURN _Noreturn -#else -# define G_NORETURN /* empty */ -#endif - -/** - * G_NORETURN_FUNCPTR: - * - * Expands to the GNU C or MSVC `noreturn` function attribute depending on - * the compiler. It is used for declaring function pointers which never return. - * Enables optimization of the function, and avoids possible compiler warnings. - * - * Place the attribute before the function declaration as follows: - * - * |[ - * G_NORETURN_FUNCPTR void (*funcptr) (void); - * ]| - * - * Note that if the function is not a function pointer, you can simply use - * the %G_NORETURN macro as follows: - * - * |[ - * G_NORETURN void g_abort (void); - * ]| - * - * Since: 2.68 - */ -#if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__)) || (0x5110 <= __SUNPRO_C) -# define G_NORETURN_FUNCPTR __attribute__ ((__noreturn__)) \ - GLIB_AVAILABLE_MACRO_IN_2_68 -#else -# define G_NORETURN_FUNCPTR /* empty */ \ - GLIB_AVAILABLE_MACRO_IN_2_68 -#endif - -/* - * The G_LIKELY and G_UNLIKELY macros let the programmer give hints to - * the compiler about the expected result of an expression. Some compilers - * can use this information for optimizations. - * - * The _G_BOOLEAN_EXPR macro is intended to trigger a gcc warning when - * putting assignments in g_return_if_fail (). - */ -#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) -#define _G_BOOLEAN_EXPR(expr) \ - G_GNUC_EXTENSION ({ \ - int _g_boolean_var_; \ - if (expr) \ - _g_boolean_var_ = 1; \ - else \ - _g_boolean_var_ = 0; \ - _g_boolean_var_; \ -}) -#define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1)) -#define G_UNLIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 0)) -#else -#define G_LIKELY(expr) (expr) -#define G_UNLIKELY(expr) (expr) -#endif - -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || defined (__clang__) -#define G_DEPRECATED __attribute__((__deprecated__)) -#elif defined(_MSC_VER) && (_MSC_VER >= 1300) -#define G_DEPRECATED __declspec(deprecated) -#else -#define G_DEPRECATED -#endif - -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || defined (__clang__) -#define G_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead"))) -#elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320) -#define G_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead")) -#else -#define G_DEPRECATED_FOR(f) G_DEPRECATED -#endif - -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || defined (__clang__) -#define G_UNAVAILABLE(maj,min) __attribute__((deprecated("Not available before " #maj "." #min))) -#elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320) -#define G_UNAVAILABLE(maj,min) __declspec(deprecated("is not available before " #maj "." #min)) -#else -#define G_UNAVAILABLE(maj,min) G_DEPRECATED -#endif - -#ifndef _GLIB_EXTERN -#define _GLIB_EXTERN extern -#endif - -/* These macros are used to mark deprecated symbols in GLib headers, - * and thus have to be exposed in installed headers. But please - * do *not* use them in other projects. Instead, use G_DEPRECATED - * or define your own wrappers around it. - */ - -#ifdef GLIB_DISABLE_DEPRECATION_WARNINGS -#define GLIB_DEPRECATED _GLIB_EXTERN -#define GLIB_DEPRECATED_FOR(f) _GLIB_EXTERN -#define GLIB_UNAVAILABLE(maj,min) _GLIB_EXTERN -#define GLIB_UNAVAILABLE_STATIC_INLINE(maj,min) -#else -#define GLIB_DEPRECATED G_DEPRECATED _GLIB_EXTERN -#define GLIB_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GLIB_EXTERN -#define GLIB_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _GLIB_EXTERN -#define GLIB_UNAVAILABLE_STATIC_INLINE(maj,min) G_UNAVAILABLE(maj,min) -#endif - -#if !defined(GLIB_DISABLE_DEPRECATION_WARNINGS) && \ - (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || \ - __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4)) -#define _GLIB_GNUC_DO_PRAGMA(x) _Pragma(G_STRINGIFY (x)) -#define GLIB_DEPRECATED_MACRO _GLIB_GNUC_DO_PRAGMA(GCC warning "Deprecated pre-processor symbol") -#define GLIB_DEPRECATED_MACRO_FOR(f) _GLIB_GNUC_DO_PRAGMA(GCC warning "Deprecated pre-processor symbol, replace with " #f) -#define GLIB_UNAVAILABLE_MACRO(maj,min) _GLIB_GNUC_DO_PRAGMA(GCC warning "Not available before " #maj "." #min) -#else -#define GLIB_DEPRECATED_MACRO -#define GLIB_DEPRECATED_MACRO_FOR(f) -#define GLIB_UNAVAILABLE_MACRO(maj,min) -#endif - -#if !defined(GLIB_DISABLE_DEPRECATION_WARNINGS) && \ - ((defined (__GNUC__) && (__GNUC__ > 6 || (__GNUC__ == 6 && __GNUC_MINOR__ >= 1))) || \ - (defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0)))) -#define GLIB_DEPRECATED_ENUMERATOR G_DEPRECATED -#define GLIB_DEPRECATED_ENUMERATOR_FOR(f) G_DEPRECATED_FOR(f) -#define GLIB_UNAVAILABLE_ENUMERATOR(maj,min) G_UNAVAILABLE(maj,min) -#else -#define GLIB_DEPRECATED_ENUMERATOR -#define GLIB_DEPRECATED_ENUMERATOR_FOR(f) -#define GLIB_UNAVAILABLE_ENUMERATOR(maj,min) -#endif - -#if !defined(GLIB_DISABLE_DEPRECATION_WARNINGS) && \ - ((defined (__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))) || \ - (defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0)))) -#define GLIB_DEPRECATED_TYPE G_DEPRECATED -#define GLIB_DEPRECATED_TYPE_FOR(f) G_DEPRECATED_FOR(f) -#define GLIB_UNAVAILABLE_TYPE(maj,min) G_UNAVAILABLE(maj,min) -#else -#define GLIB_DEPRECATED_TYPE -#define GLIB_DEPRECATED_TYPE_FOR(f) -#define GLIB_UNAVAILABLE_TYPE(maj,min) -#endif - -#ifndef __GI_SCANNER__ - -#if defined (__GNUC__) || defined (__clang__) - -/* these macros are private */ -#define _GLIB_AUTOPTR_FUNC_NAME(TypeName) glib_autoptr_cleanup_##TypeName -#define _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) glib_autoptr_clear_##TypeName -#define _GLIB_AUTOPTR_TYPENAME(TypeName) TypeName##_autoptr -#define _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName) glib_listautoptr_cleanup_##TypeName -#define _GLIB_AUTOPTR_LIST_TYPENAME(TypeName) TypeName##_listautoptr -#define _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) glib_slistautoptr_cleanup_##TypeName -#define _GLIB_AUTOPTR_SLIST_TYPENAME(TypeName) TypeName##_slistautoptr -#define _GLIB_AUTOPTR_QUEUE_FUNC_NAME(TypeName) glib_queueautoptr_cleanup_##TypeName -#define _GLIB_AUTOPTR_QUEUE_TYPENAME(TypeName) TypeName##_queueautoptr -#define _GLIB_AUTO_FUNC_NAME(TypeName) glib_auto_cleanup_##TypeName -#define _GLIB_CLEANUP(func) __attribute__((cleanup(func))) -#define _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(TypeName, ParentName, cleanup) \ - typedef TypeName *_GLIB_AUTOPTR_TYPENAME(TypeName); \ - typedef GList *_GLIB_AUTOPTR_LIST_TYPENAME(TypeName); \ - typedef GSList *_GLIB_AUTOPTR_SLIST_TYPENAME(TypeName); \ - typedef GQueue *_GLIB_AUTOPTR_QUEUE_TYPENAME(TypeName); \ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) (TypeName *_ptr) \ - { if (_ptr) (cleanup) ((ParentName *) _ptr); } \ - static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_FUNC_NAME(TypeName) (TypeName **_ptr) \ - { _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) (*_ptr); } \ - static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName) (GList **_l) \ - { g_list_free_full (*_l, (GDestroyNotify) (void(*)(void)) cleanup); } \ - static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) (GSList **_l) \ - { g_slist_free_full (*_l, (GDestroyNotify) (void(*)(void)) cleanup); } \ - static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_QUEUE_FUNC_NAME(TypeName) (GQueue **_q) \ - { if (*_q) g_queue_free_full (*_q, (GDestroyNotify) (void(*)(void)) cleanup); } \ - G_GNUC_END_IGNORE_DEPRECATIONS -#define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName) \ - _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(ModuleObjName, ParentName, _GLIB_AUTOPTR_CLEAR_FUNC_NAME(ParentName)) - - -/* these macros are API */ -#define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func) \ - _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(TypeName, TypeName, func) -#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) \ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - static G_GNUC_UNUSED inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { (func) (_ptr); } \ - G_GNUC_END_IGNORE_DEPRECATIONS -#define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none) \ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - static G_GNUC_UNUSED inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { if (*_ptr != none) (func) (*_ptr); } \ - G_GNUC_END_IGNORE_DEPRECATIONS -#define g_autoptr(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_TYPENAME(TypeName) -#define g_autolist(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_LIST_TYPENAME(TypeName) -#define g_autoslist(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_SLIST_TYPENAME(TypeName) -#define g_autoqueue(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_QUEUE_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_QUEUE_TYPENAME(TypeName) -#define g_auto(TypeName) _GLIB_CLEANUP(_GLIB_AUTO_FUNC_NAME(TypeName)) TypeName -#define g_autofree _GLIB_CLEANUP(g_autoptr_cleanup_generic_gfree) - -#else /* not GNU C */ -/* this (dummy) macro is private */ -#define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName) - -/* these (dummy) macros are API */ -#define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func) -#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) -#define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none) - -/* no declaration of g_auto() or g_autoptr() here */ -#endif /* __GNUC__ */ - -#else - -#define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName) - -#define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func) -#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) -#define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none) - -#endif /* __GI_SCANNER__ */ - -/** - * G_SIZEOF_MEMBER: - * @struct_type: a structure type, e.g. #GOutputVector - * @member: a field in the structure, e.g. `size` - * - * Returns the size of @member in the struct definition without having a - * declared instance of @struct_type. - * - * Returns: the size of @member in bytes. - * - * Since: 2.64 - */ -#define G_SIZEOF_MEMBER(struct_type, member) \ - GLIB_AVAILABLE_MACRO_IN_2_64 \ - sizeof (((struct_type *) 0)->member) - -#endif /* __G_MACROS_H__ */ - -#include -#include -#define GLIB_HAVE_ALLOCA_H - -/* Specifies that GLib's g_print*() functions wrap the - * system printf functions. This is useful to know, for example, - * when using glibc's register_printf_function(). - */ -#undef GLIB_USING_SYSTEM_PRINTF - -#define GLIB_STATIC_COMPILATION 1 -#define GOBJECT_STATIC_COMPILATION 1 -#define GIO_STATIC_COMPILATION 1 - -G_BEGIN_DECLS - -#define G_MINFLOAT FLT_MIN -#define G_MAXFLOAT FLT_MAX -#define G_MINDOUBLE DBL_MIN -#define G_MAXDOUBLE DBL_MAX -#define G_MINSHORT SHRT_MIN -#define G_MAXSHORT SHRT_MAX -#define G_MAXUSHORT USHRT_MAX -#define G_MININT INT_MIN -#define G_MAXINT INT_MAX -#define G_MAXUINT UINT_MAX -#define G_MINLONG LONG_MIN -#define G_MAXLONG LONG_MAX -#define G_MAXULONG ULONG_MAX - -typedef signed char gint8; -typedef unsigned char guint8; - -typedef signed short gint16; -typedef unsigned short guint16; - -#define G_GINT16_MODIFIER "h" -#define G_GINT16_FORMAT "hi" -#define G_GUINT16_FORMAT "hu" - - -typedef signed int gint32; -typedef unsigned int guint32; - -#define G_GINT32_MODIFIER "" -#define G_GINT32_FORMAT "i" -#define G_GUINT32_FORMAT "u" - - -#define G_HAVE_GINT64 1 /* deprecated, always true */ - -typedef signed long gint64; -typedef unsigned long guint64; - -#define G_GINT64_CONSTANT(val) (val##L) -#define G_GUINT64_CONSTANT(val) (val##UL) - -#define G_GINT64_MODIFIER "l" -#define G_GINT64_FORMAT "li" -#define G_GUINT64_FORMAT "lu" - - -#define GLIB_SIZEOF_VOID_P 8 -#define GLIB_SIZEOF_LONG 8 -#define GLIB_SIZEOF_SIZE_T 8 -#define GLIB_SIZEOF_SSIZE_T 8 - -typedef signed long gssize; -typedef unsigned long gsize; -#define G_GSIZE_MODIFIER "l" -#define G_GSSIZE_MODIFIER "l" -#define G_GSIZE_FORMAT "lu" -#define G_GSSIZE_FORMAT "li" - -#define G_MAXSIZE G_MAXULONG -#define G_MINSSIZE G_MINLONG -#define G_MAXSSIZE G_MAXLONG - -typedef gint64 goffset; -#define G_MINOFFSET G_MININT64 -#define G_MAXOFFSET G_MAXINT64 - -#define G_GOFFSET_MODIFIER G_GINT64_MODIFIER -#define G_GOFFSET_FORMAT G_GINT64_FORMAT -#define G_GOFFSET_CONSTANT(val) G_GINT64_CONSTANT(val) - -#define G_POLLFD_FORMAT "%d" - -#define GPOINTER_TO_INT(p) ((gint) (glong) (p)) -#define GPOINTER_TO_UINT(p) ((guint) (gulong) (p)) - -#define GINT_TO_POINTER(i) ((gpointer) (glong) (i)) -#define GUINT_TO_POINTER(u) ((gpointer) (gulong) (u)) - -typedef signed long gintptr; -typedef unsigned long guintptr; - -#define G_GINTPTR_MODIFIER "l" -#define G_GINTPTR_FORMAT "li" -#define G_GUINTPTR_FORMAT "lu" - -#define GLIB_MAJOR_VERSION 2 -#define GLIB_MINOR_VERSION 67 -#define GLIB_MICRO_VERSION 1 - -#define G_OS_UNIX - -#define G_VA_COPY va_copy - - -#ifndef __cplusplus -# define G_HAVE_ISO_VARARGS 1 -#endif - -#ifdef __cplusplus -# define G_HAVE_ISO_VARARGS 1 -#endif - -/* gcc-2.95.x supports both gnu style and ISO varargs, but if -ansi - * is passed ISO vararg support is turned off, and there is no work - * around to turn it on, so we unconditionally turn it off. - */ -#if __GNUC__ == 2 && __GNUC_MINOR__ == 95 -# undef G_HAVE_ISO_VARARGS -#endif - -#define G_HAVE_GROWING_STACK 0 -#define G_HAVE_GNUC_VISIBILITY 1 - -#ifndef _MSC_VER -# define G_HAVE_GNUC_VARARGS 1 -#endif - -#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) -#define G_GNUC_INTERNAL __attribute__((visibility("hidden"))) -#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) -#define G_GNUC_INTERNAL __hidden -#elif defined (__GNUC__) && defined (G_HAVE_GNUC_VISIBILITY) -#define G_GNUC_INTERNAL __attribute__((visibility("hidden"))) -#else -#define G_GNUC_INTERNAL -#endif - -#define G_THREADS_ENABLED -#define G_THREADS_IMPL_POSIX - -#define G_ATOMIC_LOCK_FREE - -#define GINT16_TO_LE(val) ((gint16) (val)) -#define GUINT16_TO_LE(val) ((guint16) (val)) -#define GINT16_TO_BE(val) ((gint16) GUINT16_SWAP_LE_BE (val)) -#define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) - -#define GINT32_TO_LE(val) ((gint32) (val)) -#define GUINT32_TO_LE(val) ((guint32) (val)) -#define GINT32_TO_BE(val) ((gint32) GUINT32_SWAP_LE_BE (val)) -#define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val)) - -#define GINT64_TO_LE(val) ((gint64) (val)) -#define GUINT64_TO_LE(val) ((guint64) (val)) -#define GINT64_TO_BE(val) ((gint64) GUINT64_SWAP_LE_BE (val)) -#define GUINT64_TO_BE(val) (GUINT64_SWAP_LE_BE (val)) - -#define GLONG_TO_LE(val) ((glong) GINT64_TO_LE (val)) -#define GULONG_TO_LE(val) ((gulong) GUINT64_TO_LE (val)) -#define GLONG_TO_BE(val) ((glong) GINT64_TO_BE (val)) -#define GULONG_TO_BE(val) ((gulong) GUINT64_TO_BE (val)) -#define GINT_TO_LE(val) ((gint) GINT32_TO_LE (val)) -#define GUINT_TO_LE(val) ((guint) GUINT32_TO_LE (val)) -#define GINT_TO_BE(val) ((gint) GINT32_TO_BE (val)) -#define GUINT_TO_BE(val) ((guint) GUINT32_TO_BE (val)) -#define GSIZE_TO_LE(val) ((gsize) GUINT64_TO_LE (val)) -#define GSSIZE_TO_LE(val) ((gssize) GINT64_TO_LE (val)) -#define GSIZE_TO_BE(val) ((gsize) GUINT64_TO_BE (val)) -#define GSSIZE_TO_BE(val) ((gssize) GINT64_TO_BE (val)) -#define G_BYTE_ORDER G_LITTLE_ENDIAN - -#define GLIB_SYSDEF_POLLIN =1 -#define GLIB_SYSDEF_POLLOUT =4 -#define GLIB_SYSDEF_POLLPRI =2 -#define GLIB_SYSDEF_POLLHUP =16 -#define GLIB_SYSDEF_POLLERR =8 -#define GLIB_SYSDEF_POLLNVAL =32 - -#define G_MODULE_SUFFIX "so" - -typedef int GPid; -#define G_PID_FORMAT "i" - -#define GLIB_SYSDEF_AF_UNIX 1 -#define GLIB_SYSDEF_AF_INET 2 -#define GLIB_SYSDEF_AF_INET6 10 - -#define GLIB_SYSDEF_MSG_OOB 1 -#define GLIB_SYSDEF_MSG_PEEK 2 -#define GLIB_SYSDEF_MSG_DONTROUTE 4 - -#define G_DIR_SEPARATOR '/' -#define G_DIR_SEPARATOR_S "/" -#define G_SEARCHPATH_SEPARATOR ':' -#define G_SEARCHPATH_SEPARATOR_S ":" - -G_END_DECLS - -#endif /* __GLIBCONFIG_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_VERSION_MACROS_H__ -#define __G_VERSION_MACROS_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -/* Version boundaries checks */ - -#define G_ENCODE_VERSION(major,minor) ((major) << 16 | (minor) << 8) - -/* XXX: Every new stable minor release bump should add a macro here */ - -/** - * GLIB_VERSION_2_26: - * - * A macro that evaluates to the 2.26 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.32 - */ -#define GLIB_VERSION_2_26 (G_ENCODE_VERSION (2, 26)) - -/** - * GLIB_VERSION_2_28: - * - * A macro that evaluates to the 2.28 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.32 - */ -#define GLIB_VERSION_2_28 (G_ENCODE_VERSION (2, 28)) - -/** - * GLIB_VERSION_2_30: - * - * A macro that evaluates to the 2.30 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.32 - */ -#define GLIB_VERSION_2_30 (G_ENCODE_VERSION (2, 30)) - -/** - * GLIB_VERSION_2_32: - * - * A macro that evaluates to the 2.32 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.32 - */ -#define GLIB_VERSION_2_32 (G_ENCODE_VERSION (2, 32)) - -/** - * GLIB_VERSION_2_34: - * - * A macro that evaluates to the 2.34 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.34 - */ -#define GLIB_VERSION_2_34 (G_ENCODE_VERSION (2, 34)) - -/** - * GLIB_VERSION_2_36: - * - * A macro that evaluates to the 2.36 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.36 - */ -#define GLIB_VERSION_2_36 (G_ENCODE_VERSION (2, 36)) - -/** - * GLIB_VERSION_2_38: - * - * A macro that evaluates to the 2.38 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.38 - */ -#define GLIB_VERSION_2_38 (G_ENCODE_VERSION (2, 38)) - -/** - * GLIB_VERSION_2_40: - * - * A macro that evaluates to the 2.40 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.40 - */ -#define GLIB_VERSION_2_40 (G_ENCODE_VERSION (2, 40)) - -/** - * GLIB_VERSION_2_42: - * - * A macro that evaluates to the 2.42 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.42 - */ -#define GLIB_VERSION_2_42 (G_ENCODE_VERSION (2, 42)) - -/** - * GLIB_VERSION_2_44: - * - * A macro that evaluates to the 2.44 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.44 - */ -#define GLIB_VERSION_2_44 (G_ENCODE_VERSION (2, 44)) - -/** - * GLIB_VERSION_2_46: - * - * A macro that evaluates to the 2.46 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.46 - */ -#define GLIB_VERSION_2_46 (G_ENCODE_VERSION (2, 46)) - -/** - * GLIB_VERSION_2_48: - * - * A macro that evaluates to the 2.48 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.48 - */ -#define GLIB_VERSION_2_48 (G_ENCODE_VERSION (2, 48)) - -/** - * GLIB_VERSION_2_50: - * - * A macro that evaluates to the 2.50 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.50 - */ -#define GLIB_VERSION_2_50 (G_ENCODE_VERSION (2, 50)) - -/** - * GLIB_VERSION_2_52: - * - * A macro that evaluates to the 2.52 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.52 - */ -#define GLIB_VERSION_2_52 (G_ENCODE_VERSION (2, 52)) - -/** - * GLIB_VERSION_2_54: - * - * A macro that evaluates to the 2.54 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.54 - */ -#define GLIB_VERSION_2_54 (G_ENCODE_VERSION (2, 54)) - -/** - * GLIB_VERSION_2_56: - * - * A macro that evaluates to the 2.56 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.56 - */ -#define GLIB_VERSION_2_56 (G_ENCODE_VERSION (2, 56)) - -/** - * GLIB_VERSION_2_58: - * - * A macro that evaluates to the 2.58 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.58 - */ -#define GLIB_VERSION_2_58 (G_ENCODE_VERSION (2, 58)) - -/** - * GLIB_VERSION_2_60: - * - * A macro that evaluates to the 2.60 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.60 - */ -#define GLIB_VERSION_2_60 (G_ENCODE_VERSION (2, 60)) - -/** - * GLIB_VERSION_2_62: - * - * A macro that evaluates to the 2.62 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.62 - */ -#define GLIB_VERSION_2_62 (G_ENCODE_VERSION (2, 62)) - -/** - * GLIB_VERSION_2_64: - * - * A macro that evaluates to the 2.64 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.64 - */ -#define GLIB_VERSION_2_64 (G_ENCODE_VERSION (2, 64)) - -/** - * GLIB_VERSION_2_66: - * - * A macro that evaluates to the 2.66 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.66 - */ -#define GLIB_VERSION_2_66 (G_ENCODE_VERSION (2, 66)) - -/** - * GLIB_VERSION_2_68: - * - * A macro that evaluates to the 2.68 version of GLib, in a format - * that can be used by the C pre-processor. - * - * Since: 2.68 - */ -#define GLIB_VERSION_2_68 (G_ENCODE_VERSION (2, 68)) - -/* evaluates to the current stable version; for development cycles, - * this means the next stable target - */ -#if (GLIB_MINOR_VERSION % 2) -#define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1)) -#else -#define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION)) -#endif - -/* evaluates to the previous stable version */ -#if (GLIB_MINOR_VERSION % 2) -#define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1)) -#else -#define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2)) -#endif - -/** - * GLIB_VERSION_MIN_REQUIRED: - * - * A macro that should be defined by the user prior to including - * the glib.h header. - * The definition should be one of the predefined GLib version - * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,... - * - * This macro defines the earliest version of GLib that the package is - * required to be able to compile against. - * - * If the compiler is configured to warn about the use of deprecated - * functions, then using functions that were deprecated in version - * %GLIB_VERSION_MIN_REQUIRED or earlier will cause warnings (but - * using functions deprecated in later releases will not). - * - * Since: 2.32 - */ -/* If the package sets GLIB_VERSION_MIN_REQUIRED to some future - * GLIB_VERSION_X_Y value that we don't know about, it will compare as - * 0 in preprocessor tests. - */ -#ifndef GLIB_VERSION_MIN_REQUIRED -# define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE) -#elif GLIB_VERSION_MIN_REQUIRED == 0 -# undef GLIB_VERSION_MIN_REQUIRED -# define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE + 2) -#endif - -/** - * GLIB_VERSION_MAX_ALLOWED: - * - * A macro that should be defined by the user prior to including - * the glib.h header. - * The definition should be one of the predefined GLib version - * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,... - * - * This macro defines the latest version of the GLib API that the - * package is allowed to make use of. - * - * If the compiler is configured to warn about the use of deprecated - * functions, then using functions added after version - * %GLIB_VERSION_MAX_ALLOWED will cause warnings. - * - * Unless you are using GLIB_CHECK_VERSION() or the like to compile - * different code depending on the GLib version, then this should be - * set to the same value as %GLIB_VERSION_MIN_REQUIRED. - * - * Since: 2.32 - */ -#if !defined (GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0) -# undef GLIB_VERSION_MAX_ALLOWED -# define GLIB_VERSION_MAX_ALLOWED (GLIB_VERSION_CUR_STABLE) -#endif - -/* sanity checks */ -#if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE -#error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE" -#endif -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED -#error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED" -#endif -#if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26 -#error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26" -#endif - -/* These macros are used to mark deprecated functions in GLib headers, - * and thus have to be exposed in installed headers. But please - * do *not* use them in other projects. Instead, use G_DEPRECATED - * or define your own wrappers around it. - */ -#define GLIB_AVAILABLE_IN_ALL _GLIB_EXTERN - -/* XXX: Every new stable minor release should add a set of macros here */ - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26 -# define GLIB_DEPRECATED_IN_2_26 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_26_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_26 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_26_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_26 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_26_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_26 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_26_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_26 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_26_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_26 -# define GLIB_DEPRECATED_MACRO_IN_2_26_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_26 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_26_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_26 -# define GLIB_DEPRECATED_TYPE_IN_2_26_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26 -# define GLIB_AVAILABLE_IN_2_26 GLIB_UNAVAILABLE(2, 26) -# define GLIB_AVAILABLE_MACRO_IN_2_26 GLIB_UNAVAILABLE_MACRO(2, 26) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_26 GLIB_UNAVAILABLE_ENUMERATOR(2, 26) -# define GLIB_AVAILABLE_TYPE_IN_2_26 GLIB_UNAVAILABLE_TYPE(2, 26) -#else -# define GLIB_AVAILABLE_IN_2_26 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_26 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_26 -# define GLIB_AVAILABLE_TYPE_IN_2_26 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28 -# define GLIB_DEPRECATED_IN_2_28 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_28_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_28 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_28_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_28 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_28_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_28 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_28_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_28 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_28_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_28 -# define GLIB_DEPRECATED_MACRO_IN_2_28_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_28 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_28_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_28 -# define GLIB_DEPRECATED_TYPE_IN_2_28_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28 -# define GLIB_AVAILABLE_IN_2_28 GLIB_UNAVAILABLE(2, 28) -# define GLIB_AVAILABLE_MACRO_IN_2_28 GLIB_UNAVAILABLE_MACRO(2, 28) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_28 GLIB_UNAVAILABLE_ENUMERATOR(2, 28) -# define GLIB_AVAILABLE_TYPE_IN_2_28 GLIB_UNAVAILABLE_TYPE(2, 28) -#else -# define GLIB_AVAILABLE_IN_2_28 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_28 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_28 -# define GLIB_AVAILABLE_TYPE_IN_2_28 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30 -# define GLIB_DEPRECATED_IN_2_30 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_30_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_30 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_30_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_30 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_30_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_30 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_30_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_30 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_30_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_30 -# define GLIB_DEPRECATED_MACRO_IN_2_30_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_30 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_30_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_30 -# define GLIB_DEPRECATED_TYPE_IN_2_30_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30 -# define GLIB_AVAILABLE_IN_2_30 GLIB_UNAVAILABLE(2, 30) -# define GLIB_AVAILABLE_MACRO_IN_2_30 GLIB_UNAVAILABLE_MACRO(2, 30) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_30 GLIB_UNAVAILABLE_ENUMERATOR(2, 30) -# define GLIB_AVAILABLE_TYPE_IN_2_30 GLIB_UNAVAILABLE_TYPE(2, 30) -#else -# define GLIB_AVAILABLE_IN_2_30 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_30 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_30 -# define GLIB_AVAILABLE_TYPE_IN_2_30 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32 -# define GLIB_DEPRECATED_IN_2_32 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_32_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_32 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_32_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_32 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_32_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_32 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_32_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_32 -# define GLIB_DEPRECATED_MACRO_IN_2_32_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_32 -# define GLIB_DEPRECATED_TYPE_IN_2_32_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_32_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_32 -# define GLIB_DEPRECATED_TYPE_IN_2_32_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32 -# define GLIB_AVAILABLE_IN_2_32 GLIB_UNAVAILABLE(2, 32) -# define GLIB_AVAILABLE_MACRO_IN_2_32 GLIB_UNAVAILABLE_MACRO(2, 32) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_32 GLIB_UNAVAILABLE_ENUMERATOR(2, 32) -# define GLIB_AVAILABLE_TYPE_IN_2_32 GLIB_UNAVAILABLE_TYPE(2, 32) -#else -# define GLIB_AVAILABLE_IN_2_32 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_32 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_32 -# define GLIB_AVAILABLE_TYPE_IN_2_32 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34 -# define GLIB_DEPRECATED_IN_2_34 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_34_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_34 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_34_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_34 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_34_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_34 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_34_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_34 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_34_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_34 -# define GLIB_DEPRECATED_MACRO_IN_2_34_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_34 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_34_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_34 -# define GLIB_DEPRECATED_TYPE_IN_2_34_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34 -# define GLIB_AVAILABLE_IN_2_34 GLIB_UNAVAILABLE(2, 34) -# define GLIB_AVAILABLE_MACRO_IN_2_34 GLIB_UNAVAILABLE_MACRO(2, 34) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_34 GLIB_UNAVAILABLE_ENUMERATOR(2, 34) -# define GLIB_AVAILABLE_TYPE_IN_2_34 GLIB_UNAVAILABLE_TYPE(2, 34) -#else -# define GLIB_AVAILABLE_IN_2_34 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_34 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_34 -# define GLIB_AVAILABLE_TYPE_IN_2_34 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36 -# define GLIB_DEPRECATED_IN_2_36 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_36_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_36 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_36_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_36 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_36_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_36 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_36_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_36 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_36_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_36 -# define GLIB_DEPRECATED_MACRO_IN_2_36_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_36 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_36_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_36 -# define GLIB_DEPRECATED_TYPE_IN_2_36_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36 -# define GLIB_AVAILABLE_IN_2_36 GLIB_UNAVAILABLE(2, 36) -# define GLIB_AVAILABLE_MACRO_IN_2_36 GLIB_UNAVAILABLE_MACRO(2, 36) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_36 GLIB_UNAVAILABLE_ENUMERATOR(2, 36) -# define GLIB_AVAILABLE_TYPE_IN_2_36 GLIB_UNAVAILABLE_TYPE(2, 36) -#else -# define GLIB_AVAILABLE_IN_2_36 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_36 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_36 -# define GLIB_AVAILABLE_TYPE_IN_2_36 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38 -# define GLIB_DEPRECATED_IN_2_38 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_38_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_38 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_38_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_38 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_38_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_38 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_38_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_38 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_38_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_38 -# define GLIB_DEPRECATED_MACRO_IN_2_38_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_38 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_38_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_38 -# define GLIB_DEPRECATED_TYPE_IN_2_38_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 -# define GLIB_AVAILABLE_IN_2_38 GLIB_UNAVAILABLE(2, 38) -# define GLIB_AVAILABLE_MACRO_IN_2_38 GLIB_UNAVAILABLE_MACRO(2, 38) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_38 GLIB_UNAVAILABLE_ENUMERATOR(2, 38) -# define GLIB_AVAILABLE_TYPE_IN_2_38 GLIB_UNAVAILABLE_TYPE(2, 38) -#else -# define GLIB_AVAILABLE_IN_2_38 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_38 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_38 -# define GLIB_AVAILABLE_TYPE_IN_2_38 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_40 -# define GLIB_DEPRECATED_IN_2_40 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_40_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_40 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_40_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_40 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_40_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_40 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_40_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_40 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_40_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_40 -# define GLIB_DEPRECATED_MACRO_IN_2_40_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_40 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_40_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_40 -# define GLIB_DEPRECATED_TYPE_IN_2_40_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40 -# define GLIB_AVAILABLE_IN_2_40 GLIB_UNAVAILABLE(2, 40) -# define GLIB_AVAILABLE_MACRO_IN_2_40 GLIB_UNAVAILABLE_MACRO(2, 40) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_40 GLIB_UNAVAILABLE_ENUMERATOR(2, 40) -# define GLIB_AVAILABLE_TYPE_IN_2_40 GLIB_UNAVAILABLE_TYPE(2, 40) -#else -# define GLIB_AVAILABLE_IN_2_40 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_40 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_40 -# define GLIB_AVAILABLE_TYPE_IN_2_40 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_42 -# define GLIB_DEPRECATED_IN_2_42 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_42_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_42 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_42_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_42 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_42_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_42 -# define GLIB_DEPRECATED_MACRO_IN_2_42_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_42 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_42_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_42 -# define GLIB_DEPRECATED_TYPE_IN_2_42_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_42 -# define GLIB_AVAILABLE_IN_2_42 GLIB_UNAVAILABLE(2, 42) -# define GLIB_AVAILABLE_MACRO_IN_2_42 GLIB_UNAVAILABLE_MACRO(2, 42) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_42 GLIB_UNAVAILABLE_ENUMERATOR(2, 42) -# define GLIB_AVAILABLE_TYPE_IN_2_42 GLIB_UNAVAILABLE_TYPE(2, 42) -#else -# define GLIB_AVAILABLE_IN_2_42 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_42 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_42 -# define GLIB_AVAILABLE_TYPE_IN_2_42 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_44 -# define GLIB_DEPRECATED_IN_2_44 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_44_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_44 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_44_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_44 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_44_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_44 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_44_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_44 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_44_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_44 -# define GLIB_DEPRECATED_MACRO_IN_2_44_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_44 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_44_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_44 -# define GLIB_DEPRECATED_TYPE_IN_2_44_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_44 -# define GLIB_AVAILABLE_IN_2_44 GLIB_UNAVAILABLE(2, 44) -# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 GLIB_UNAVAILABLE_STATIC_INLINE(2, 44) -# define GLIB_AVAILABLE_MACRO_IN_2_44 GLIB_UNAVAILABLE_MACRO(2, 44) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_44 GLIB_UNAVAILABLE_ENUMERATOR(2, 44) -# define GLIB_AVAILABLE_TYPE_IN_2_44 GLIB_UNAVAILABLE_TYPE(2, 44) -#else -# define GLIB_AVAILABLE_IN_2_44 _GLIB_EXTERN -# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 -# define GLIB_AVAILABLE_MACRO_IN_2_44 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_44 -# define GLIB_AVAILABLE_TYPE_IN_2_44 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_46 -# define GLIB_DEPRECATED_IN_2_46 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_46_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_46 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_46_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_46 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_46_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_46 -# define GLIB_DEPRECATED_MACRO_IN_2_46_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_46 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_46_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_46 -# define GLIB_DEPRECATED_TYPE_IN_2_46_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_46 -# define GLIB_AVAILABLE_IN_2_46 GLIB_UNAVAILABLE(2, 46) -# define GLIB_AVAILABLE_MACRO_IN_2_46 GLIB_UNAVAILABLE_MACRO(2, 46) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_46 GLIB_UNAVAILABLE_ENUMERATOR(2, 46) -# define GLIB_AVAILABLE_TYPE_IN_2_46 GLIB_UNAVAILABLE_TYPE(2, 46) -#else -# define GLIB_AVAILABLE_IN_2_46 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_46 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_46 -# define GLIB_AVAILABLE_TYPE_IN_2_46 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_48 -# define GLIB_DEPRECATED_IN_2_48 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_48_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_48 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_48_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_48 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_48_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_48 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_48_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_48 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_48_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_48 -# define GLIB_DEPRECATED_MACRO_IN_2_48_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_48 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_48_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_48 -# define GLIB_DEPRECATED_TYPE_IN_2_48_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_48 -# define GLIB_AVAILABLE_IN_2_48 GLIB_UNAVAILABLE(2, 48) -# define GLIB_AVAILABLE_MACRO_IN_2_48 GLIB_UNAVAILABLE_MACRO(2, 48) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_48 GLIB_UNAVAILABLE_ENUMERATOR(2, 48) -# define GLIB_AVAILABLE_TYPE_IN_2_48 GLIB_UNAVAILABLE_TYPE(2, 48) -#else -# define GLIB_AVAILABLE_IN_2_48 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_48 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_48 -# define GLIB_AVAILABLE_TYPE_IN_2_48 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_50 -# define GLIB_DEPRECATED_IN_2_50 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_50_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_50 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_50_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_50 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_50_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_50 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_50_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_50 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_50_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_50 -# define GLIB_DEPRECATED_MACRO_IN_2_50_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_50 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_50_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_50 -# define GLIB_DEPRECATED_TYPE_IN_2_50_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_50 -# define GLIB_AVAILABLE_IN_2_50 GLIB_UNAVAILABLE(2, 50) -# define GLIB_AVAILABLE_MACRO_IN_2_50 GLIB_UNAVAILABLE_MACRO(2, 50) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_50 GLIB_UNAVAILABLE_ENUMERATOR(2, 50) -# define GLIB_AVAILABLE_TYPE_IN_2_50 GLIB_UNAVAILABLE_TYPE(2, 50) -#else -# define GLIB_AVAILABLE_IN_2_50 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_50 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_50 -# define GLIB_AVAILABLE_TYPE_IN_2_50 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_52 -# define GLIB_DEPRECATED_IN_2_52 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_52_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_52 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_52_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_52 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_52_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_52 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_52_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_52 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_52_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_52 -# define GLIB_DEPRECATED_MACRO_IN_2_52_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_52 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_52_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_52 -# define GLIB_DEPRECATED_TYPE_IN_2_52_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_52 -# define GLIB_AVAILABLE_IN_2_52 GLIB_UNAVAILABLE(2, 52) -# define GLIB_AVAILABLE_MACRO_IN_2_52 GLIB_UNAVAILABLE_MACRO(2, 52) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_52 GLIB_UNAVAILABLE_ENUMERATOR(2, 52) -# define GLIB_AVAILABLE_TYPE_IN_2_52 GLIB_UNAVAILABLE_TYPE(2, 52) -#else -# define GLIB_AVAILABLE_IN_2_52 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_52 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_52 -# define GLIB_AVAILABLE_TYPE_IN_2_52 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_54 -# define GLIB_DEPRECATED_IN_2_54 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_54_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_54 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_54_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_54 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_54_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_54 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_54_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_54 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_54_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_54 -# define GLIB_DEPRECATED_MACRO_IN_2_54_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_54 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_54_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_54 -# define GLIB_DEPRECATED_TYPE_IN_2_54_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_54 -# define GLIB_AVAILABLE_IN_2_54 GLIB_UNAVAILABLE(2, 54) -# define GLIB_AVAILABLE_MACRO_IN_2_54 GLIB_UNAVAILABLE_MACRO(2, 54) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_54 GLIB_UNAVAILABLE_ENUMERATOR(2, 54) -# define GLIB_AVAILABLE_TYPE_IN_2_54 GLIB_UNAVAILABLE_TYPE(2, 54) -#else -# define GLIB_AVAILABLE_IN_2_54 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_54 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_54 -# define GLIB_AVAILABLE_TYPE_IN_2_54 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_56 -# define GLIB_DEPRECATED_IN_2_56 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_56_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_56 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_56_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_56 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_56_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_56 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_56_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_56 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_56_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_56 -# define GLIB_DEPRECATED_MACRO_IN_2_56_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_56 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_56_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_56 -# define GLIB_DEPRECATED_TYPE_IN_2_56_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_56 -# define GLIB_AVAILABLE_IN_2_56 GLIB_UNAVAILABLE(2, 56) -# define GLIB_AVAILABLE_MACRO_IN_2_56 GLIB_UNAVAILABLE_MACRO(2, 56) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_56 GLIB_UNAVAILABLE_ENUMERATOR(2, 56) -# define GLIB_AVAILABLE_TYPE_IN_2_56 GLIB_UNAVAILABLE_TYPE(2, 56) -#else -# define GLIB_AVAILABLE_IN_2_56 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_56 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_56 -# define GLIB_AVAILABLE_TYPE_IN_2_56 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_58 -# define GLIB_DEPRECATED_IN_2_58 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_58_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_58 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_58_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_58 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_58_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_58 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_58_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_58 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_58_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_58 -# define GLIB_DEPRECATED_MACRO_IN_2_58_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_58 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_58_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_58 -# define GLIB_DEPRECATED_TYPE_IN_2_58_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_58 -# define GLIB_AVAILABLE_IN_2_58 GLIB_UNAVAILABLE(2, 58) -# define GLIB_AVAILABLE_MACRO_IN_2_58 GLIB_UNAVAILABLE_MACRO(2, 58) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_58 GLIB_UNAVAILABLE_ENUMERATOR(2, 58) -# define GLIB_AVAILABLE_TYPE_IN_2_58 GLIB_UNAVAILABLE_TYPE(2, 58) -#else -# define GLIB_AVAILABLE_IN_2_58 _GLIB_EXTERN -# define GLIB_AVAILABLE_MACRO_IN_2_58 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_58 -# define GLIB_AVAILABLE_TYPE_IN_2_58 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_60 -# define GLIB_DEPRECATED_IN_2_60 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_60_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_60 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_60_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_60 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_60_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_60 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_60_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_60 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_60_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_60 -# define GLIB_DEPRECATED_MACRO_IN_2_60_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_60 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_60_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_60 -# define GLIB_DEPRECATED_TYPE_IN_2_60_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_60 -# define GLIB_AVAILABLE_IN_2_60 GLIB_UNAVAILABLE(2, 60) -# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_60 GLIB_UNAVAILABLE_STATIC_INLINE(2, 60) -# define GLIB_AVAILABLE_MACRO_IN_2_60 GLIB_UNAVAILABLE_MACRO(2, 60) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_60 GLIB_UNAVAILABLE_ENUMERATOR(2, 60) -# define GLIB_AVAILABLE_TYPE_IN_2_60 GLIB_UNAVAILABLE_TYPE(2, 60) -#else -# define GLIB_AVAILABLE_IN_2_60 _GLIB_EXTERN -# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_60 -# define GLIB_AVAILABLE_MACRO_IN_2_60 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_60 -# define GLIB_AVAILABLE_TYPE_IN_2_60 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_62 -# define GLIB_DEPRECATED_IN_2_62 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_62_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_62 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_62_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_62 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_62_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_62 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_62_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_62 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_62_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_62 -# define GLIB_DEPRECATED_MACRO_IN_2_62_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_62 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_62_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_62 -# define GLIB_DEPRECATED_TYPE_IN_2_62_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_62 -# define GLIB_AVAILABLE_IN_2_62 GLIB_UNAVAILABLE(2, 62) -# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 GLIB_UNAVAILABLE_STATIC_INLINE(2, 62) -# define GLIB_AVAILABLE_MACRO_IN_2_62 GLIB_UNAVAILABLE_MACRO(2, 62) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_62 GLIB_UNAVAILABLE_ENUMERATOR(2, 62) -# define GLIB_AVAILABLE_TYPE_IN_2_62 GLIB_UNAVAILABLE_TYPE(2, 62) -#else -# define GLIB_AVAILABLE_IN_2_62 _GLIB_EXTERN -# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 -# define GLIB_AVAILABLE_MACRO_IN_2_62 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_62 -# define GLIB_AVAILABLE_TYPE_IN_2_62 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_64 -# define GLIB_DEPRECATED_IN_2_64 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_64_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_64 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_64_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_64 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_64_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_64 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_64_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_64 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_64_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_64 -# define GLIB_DEPRECATED_MACRO_IN_2_64_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_64 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_64_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_64 -# define GLIB_DEPRECATED_TYPE_IN_2_64_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_64 -# define GLIB_AVAILABLE_IN_2_64 GLIB_UNAVAILABLE(2, 64) -# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 GLIB_UNAVAILABLE_STATIC_INLINE(2, 64) -# define GLIB_AVAILABLE_MACRO_IN_2_64 GLIB_UNAVAILABLE_MACRO(2, 64) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_64 GLIB_UNAVAILABLE_ENUMERATOR(2, 64) -# define GLIB_AVAILABLE_TYPE_IN_2_64 GLIB_UNAVAILABLE_TYPE(2, 64) -#else -# define GLIB_AVAILABLE_IN_2_64 _GLIB_EXTERN -# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 -# define GLIB_AVAILABLE_MACRO_IN_2_64 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_64 -# define GLIB_AVAILABLE_TYPE_IN_2_64 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_66 -# define GLIB_DEPRECATED_IN_2_66 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_66_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_66 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_66_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_66 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_66_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_66 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_66_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_66 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_66_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_66 -# define GLIB_DEPRECATED_MACRO_IN_2_66_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_66 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_66_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_66 -# define GLIB_DEPRECATED_TYPE_IN_2_66_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_66 -# define GLIB_AVAILABLE_IN_2_66 GLIB_UNAVAILABLE(2, 66) -# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_66 GLIB_UNAVAILABLE_STATIC_INLINE(2, 66) -# define GLIB_AVAILABLE_MACRO_IN_2_66 GLIB_UNAVAILABLE_MACRO(2, 66) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_66 GLIB_UNAVAILABLE_ENUMERATOR(2, 66) -# define GLIB_AVAILABLE_TYPE_IN_2_66 GLIB_UNAVAILABLE_TYPE(2, 66) -#else -# define GLIB_AVAILABLE_IN_2_66 _GLIB_EXTERN -# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_66 -# define GLIB_AVAILABLE_MACRO_IN_2_66 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_66 -# define GLIB_AVAILABLE_TYPE_IN_2_66 -#endif - -#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68 -# define GLIB_DEPRECATED_IN_2_68 GLIB_DEPRECATED -# define GLIB_DEPRECATED_IN_2_68_FOR(f) GLIB_DEPRECATED_FOR(f) -# define GLIB_DEPRECATED_MACRO_IN_2_68 GLIB_DEPRECATED_MACRO -# define GLIB_DEPRECATED_MACRO_IN_2_68_FOR(f) GLIB_DEPRECATED_MACRO_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_68 GLIB_DEPRECATED_ENUMERATOR -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_68_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_68 GLIB_DEPRECATED_TYPE -# define GLIB_DEPRECATED_TYPE_IN_2_68_FOR(f) GLIB_DEPRECATED_TYPE_FOR(f) -#else -# define GLIB_DEPRECATED_IN_2_68 _GLIB_EXTERN -# define GLIB_DEPRECATED_IN_2_68_FOR(f) _GLIB_EXTERN -# define GLIB_DEPRECATED_MACRO_IN_2_68 -# define GLIB_DEPRECATED_MACRO_IN_2_68_FOR(f) -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_68 -# define GLIB_DEPRECATED_ENUMERATOR_IN_2_68_FOR(f) -# define GLIB_DEPRECATED_TYPE_IN_2_68 -# define GLIB_DEPRECATED_TYPE_IN_2_68_FOR(f) -#endif - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_68 -# define GLIB_AVAILABLE_IN_2_68 GLIB_UNAVAILABLE(2, 68) -# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_68 GLIB_UNAVAILABLE_STATIC_INLINE(2, 68) -# define GLIB_AVAILABLE_MACRO_IN_2_68 GLIB_UNAVAILABLE_MACRO(2, 68) -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_68 GLIB_UNAVAILABLE_ENUMERATOR(2, 68) -# define GLIB_AVAILABLE_TYPE_IN_2_68 GLIB_UNAVAILABLE_TYPE(2, 68) -#else -# define GLIB_AVAILABLE_IN_2_68 _GLIB_EXTERN -# define GLIB_AVAILABLE_STATIC_INLINE_IN_2_68 -# define GLIB_AVAILABLE_MACRO_IN_2_68 -# define GLIB_AVAILABLE_ENUMERATOR_IN_2_68 -# define GLIB_AVAILABLE_TYPE_IN_2_68 -#endif - -#endif /* __G_VERSION_MACROS_H__ */ -#include - -G_BEGIN_DECLS - -/* Provide type definitions for commonly used types. - * These are useful because a "gint8" can be adjusted - * to be 1 byte (8 bits) on all platforms. Similarly and - * more importantly, "gint32" can be adjusted to be - * 4 bytes (32 bits) on all platforms. - */ - -typedef char gchar; -typedef short gshort; -typedef long glong; -typedef int gint; -typedef gint gboolean; - -typedef unsigned char guchar; -typedef unsigned short gushort; -typedef unsigned long gulong; -typedef unsigned int guint; - -typedef float gfloat; -typedef double gdouble; - -/* Define min and max constants for the fixed size numerical types */ -/** - * G_MININT8: (value -128) - * - * The minimum value which can be held in a #gint8. - * - * Since: 2.4 - */ -#define G_MININT8 ((gint8) (-G_MAXINT8 - 1)) -#define G_MAXINT8 ((gint8) 0x7f) -#define G_MAXUINT8 ((guint8) 0xff) - -/** - * G_MININT16: (value -32768) - * - * The minimum value which can be held in a #gint16. - * - * Since: 2.4 - */ -#define G_MININT16 ((gint16) (-G_MAXINT16 - 1)) -#define G_MAXINT16 ((gint16) 0x7fff) -#define G_MAXUINT16 ((guint16) 0xffff) - -/** - * G_MININT32: (value -2147483648) - * - * The minimum value which can be held in a #gint32. - * - * Since: 2.4 - */ -#define G_MININT32 ((gint32) (-G_MAXINT32 - 1)) -#define G_MAXINT32 ((gint32) 0x7fffffff) -#define G_MAXUINT32 ((guint32) 0xffffffff) - -/** - * G_MININT64: (value -9223372036854775808) - * - * The minimum value which can be held in a #gint64. - */ -#define G_MININT64 ((gint64) (-G_MAXINT64 - G_GINT64_CONSTANT(1))) -#define G_MAXINT64 G_GINT64_CONSTANT(0x7fffffffffffffff) -#define G_MAXUINT64 G_GUINT64_CONSTANT(0xffffffffffffffff) - -typedef void* gpointer; -typedef const void *gconstpointer; - -typedef gint (*GCompareFunc) (gconstpointer a, - gconstpointer b); -typedef gint (*GCompareDataFunc) (gconstpointer a, - gconstpointer b, - gpointer user_data); -typedef gboolean (*GEqualFunc) (gconstpointer a, - gconstpointer b); -typedef void (*GDestroyNotify) (gpointer data); -typedef void (*GFunc) (gpointer data, - gpointer user_data); -typedef guint (*GHashFunc) (gconstpointer key); -typedef void (*GHFunc) (gpointer key, - gpointer value, - gpointer user_data); - -/** - * GCopyFunc: - * @src: (not nullable): A pointer to the data which should be copied - * @data: Additional data - * - * A function of this signature is used to copy the node data - * when doing a deep-copy of a tree. - * - * Returns: (not nullable): A pointer to the copy - * - * Since: 2.4 - */ -typedef gpointer (*GCopyFunc) (gconstpointer src, - gpointer data); -/** - * GFreeFunc: - * @data: a data pointer - * - * Declares a type of function which takes an arbitrary - * data pointer argument and has no return value. It is - * not currently used in GLib or GTK+. - */ -typedef void (*GFreeFunc) (gpointer data); - -/** - * GTranslateFunc: - * @str: the untranslated string - * @data: user data specified when installing the function, e.g. - * in g_option_group_set_translate_func() - * - * The type of functions which are used to translate user-visible - * strings, for output. - * - * Returns: a translation of the string for the current locale. - * The returned string is owned by GLib and must not be freed. - */ -typedef const gchar * (*GTranslateFunc) (const gchar *str, - gpointer data); - - -/* Define some mathematical constants that aren't available - * symbolically in some strict ISO C implementations. - * - * Note that the large number of digits used in these definitions - * doesn't imply that GLib or current computers in general would be - * able to handle floating point numbers with an accuracy like this. - * It's mostly an exercise in futility and future proofing. For - * extended precision floating point support, look somewhere else - * than GLib. - */ -#define G_E 2.7182818284590452353602874713526624977572470937000 -#define G_LN2 0.69314718055994530941723212145817656807550013436026 -#define G_LN10 2.3025850929940456840179914546843642076011014886288 -#define G_PI 3.1415926535897932384626433832795028841971693993751 -#define G_PI_2 1.5707963267948966192313216916397514420985846996876 -#define G_PI_4 0.78539816339744830961566084581987572104929234984378 -#define G_SQRT2 1.4142135623730950488016887242096980785696718753769 - -/* Portable endian checks and conversions - * - * glibconfig.h defines G_BYTE_ORDER which expands to one of - * the below macros. - */ -#define G_LITTLE_ENDIAN 1234 -#define G_BIG_ENDIAN 4321 -#define G_PDP_ENDIAN 3412 /* unused, need specific PDP check */ - - -/* Basic bit swapping functions - */ -#define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \ - (guint16) ((guint16) (val) >> 8) | \ - (guint16) ((guint16) (val) << 8))) - -#define GUINT32_SWAP_LE_BE_CONSTANT(val) ((guint32) ( \ - (((guint32) (val) & (guint32) 0x000000ffU) << 24) | \ - (((guint32) (val) & (guint32) 0x0000ff00U) << 8) | \ - (((guint32) (val) & (guint32) 0x00ff0000U) >> 8) | \ - (((guint32) (val) & (guint32) 0xff000000U) >> 24))) - -#define GUINT64_SWAP_LE_BE_CONSTANT(val) ((guint64) ( \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0x00000000000000ffU)) << 56) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0x000000000000ff00U)) << 40) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0x0000000000ff0000U)) << 24) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0x00000000ff000000U)) << 8) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0x000000ff00000000U)) >> 8) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0x0000ff0000000000U)) >> 24) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0x00ff000000000000U)) >> 40) | \ - (((guint64) (val) & \ - (guint64) G_GINT64_CONSTANT (0xff00000000000000U)) >> 56))) - -/* Arch specific stuff for speed - */ -#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) - -# if __GNUC__ >= 4 && defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 3 -# define GUINT32_SWAP_LE_BE(val) ((guint32) __builtin_bswap32 ((guint32) (val))) -# define GUINT64_SWAP_LE_BE(val) ((guint64) __builtin_bswap64 ((guint64) (val))) -# endif - -# if defined (__i386__) -# define GUINT16_SWAP_LE_BE_IA32(val) \ - (G_GNUC_EXTENSION \ - ({ guint16 __v, __x = ((guint16) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ ("rorw $8, %w0" \ - : "=r" (__v) \ - : "0" (__x) \ - : "cc"); \ - __v; })) -# if !defined (__i486__) && !defined (__i586__) \ - && !defined (__pentium__) && !defined (__i686__) \ - && !defined (__pentiumpro__) && !defined (__pentium4__) -# define GUINT32_SWAP_LE_BE_IA32(val) \ - (G_GNUC_EXTENSION \ - ({ guint32 __v, __x = ((guint32) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ ("rorw $8, %w0\n\t" \ - "rorl $16, %0\n\t" \ - "rorw $8, %w0" \ - : "=r" (__v) \ - : "0" (__x) \ - : "cc"); \ - __v; })) -# else /* 486 and higher has bswap */ -# define GUINT32_SWAP_LE_BE_IA32(val) \ - (G_GNUC_EXTENSION \ - ({ guint32 __v, __x = ((guint32) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ ("bswap %0" \ - : "=r" (__v) \ - : "0" (__x)); \ - __v; })) -# endif /* processor specific 32-bit stuff */ -# define GUINT64_SWAP_LE_BE_IA32(val) \ - (G_GNUC_EXTENSION \ - ({ union { guint64 __ll; \ - guint32 __l[2]; } __w, __r; \ - __w.__ll = ((guint64) (val)); \ - if (__builtin_constant_p (__w.__ll)) \ - __r.__ll = GUINT64_SWAP_LE_BE_CONSTANT (__w.__ll); \ - else \ - { \ - __r.__l[0] = GUINT32_SWAP_LE_BE (__w.__l[1]); \ - __r.__l[1] = GUINT32_SWAP_LE_BE (__w.__l[0]); \ - } \ - __r.__ll; })) - /* Possibly just use the constant version and let gcc figure it out? */ -# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) -# ifndef GUINT32_SWAP_LE_BE -# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA32 (val)) -# endif -# ifndef GUINT64_SWAP_LE_BE -# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA32 (val)) -# endif -# elif defined (__ia64__) -# define GUINT16_SWAP_LE_BE_IA64(val) \ - (G_GNUC_EXTENSION \ - ({ guint16 __v, __x = ((guint16) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ __volatile__ ("shl %0 = %1, 48 ;;" \ - "mux1 %0 = %0, @rev ;;" \ - : "=r" (__v) \ - : "r" (__x)); \ - __v; })) -# define GUINT32_SWAP_LE_BE_IA64(val) \ - (G_GNUC_EXTENSION \ - ({ guint32 __v, __x = ((guint32) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ __volatile__ ("shl %0 = %1, 32 ;;" \ - "mux1 %0 = %0, @rev ;;" \ - : "=r" (__v) \ - : "r" (__x)); \ - __v; })) -# define GUINT64_SWAP_LE_BE_IA64(val) \ - (G_GNUC_EXTENSION \ - ({ guint64 __v, __x = ((guint64) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ __volatile__ ("mux1 %0 = %1, @rev ;;" \ - : "=r" (__v) \ - : "r" (__x)); \ - __v; })) -# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA64 (val)) -# ifndef GUINT32_SWAP_LE_BE -# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA64 (val)) -# endif -# ifndef GUINT64_SWAP_LE_BE -# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA64 (val)) -# endif -# elif defined (__x86_64__) -# define GUINT32_SWAP_LE_BE_X86_64(val) \ - (G_GNUC_EXTENSION \ - ({ guint32 __v, __x = ((guint32) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ ("bswapl %0" \ - : "=r" (__v) \ - : "0" (__x)); \ - __v; })) -# define GUINT64_SWAP_LE_BE_X86_64(val) \ - (G_GNUC_EXTENSION \ - ({ guint64 __v, __x = ((guint64) (val)); \ - if (__builtin_constant_p (__x)) \ - __v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \ - else \ - __asm__ ("bswapq %0" \ - : "=r" (__v) \ - : "0" (__x)); \ - __v; })) - /* gcc seems to figure out optimal code for this on its own */ -# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val)) -# ifndef GUINT32_SWAP_LE_BE -# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86_64 (val)) -# endif -# ifndef GUINT64_SWAP_LE_BE -# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86_64 (val)) -# endif -# else /* generic gcc */ -# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val)) -# ifndef GUINT32_SWAP_LE_BE -# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val)) -# endif -# ifndef GUINT64_SWAP_LE_BE -# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val)) -# endif -# endif -#else /* generic */ -# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val)) -# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val)) -# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val)) -#endif /* generic */ - -#define GUINT16_SWAP_LE_PDP(val) ((guint16) (val)) -#define GUINT16_SWAP_BE_PDP(val) (GUINT16_SWAP_LE_BE (val)) -#define GUINT32_SWAP_LE_PDP(val) ((guint32) ( \ - (((guint32) (val) & (guint32) 0x0000ffffU) << 16) | \ - (((guint32) (val) & (guint32) 0xffff0000U) >> 16))) -#define GUINT32_SWAP_BE_PDP(val) ((guint32) ( \ - (((guint32) (val) & (guint32) 0x00ff00ffU) << 8) | \ - (((guint32) (val) & (guint32) 0xff00ff00U) >> 8))) - -/* The G*_TO_?E() macros are defined in glibconfig.h. - * The transformation is symmetric, so the FROM just maps to the TO. - */ -#define GINT16_FROM_LE(val) (GINT16_TO_LE (val)) -#define GUINT16_FROM_LE(val) (GUINT16_TO_LE (val)) -#define GINT16_FROM_BE(val) (GINT16_TO_BE (val)) -#define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val)) -#define GINT32_FROM_LE(val) (GINT32_TO_LE (val)) -#define GUINT32_FROM_LE(val) (GUINT32_TO_LE (val)) -#define GINT32_FROM_BE(val) (GINT32_TO_BE (val)) -#define GUINT32_FROM_BE(val) (GUINT32_TO_BE (val)) - -#define GINT64_FROM_LE(val) (GINT64_TO_LE (val)) -#define GUINT64_FROM_LE(val) (GUINT64_TO_LE (val)) -#define GINT64_FROM_BE(val) (GINT64_TO_BE (val)) -#define GUINT64_FROM_BE(val) (GUINT64_TO_BE (val)) - -#define GLONG_FROM_LE(val) (GLONG_TO_LE (val)) -#define GULONG_FROM_LE(val) (GULONG_TO_LE (val)) -#define GLONG_FROM_BE(val) (GLONG_TO_BE (val)) -#define GULONG_FROM_BE(val) (GULONG_TO_BE (val)) - -#define GINT_FROM_LE(val) (GINT_TO_LE (val)) -#define GUINT_FROM_LE(val) (GUINT_TO_LE (val)) -#define GINT_FROM_BE(val) (GINT_TO_BE (val)) -#define GUINT_FROM_BE(val) (GUINT_TO_BE (val)) - -#define GSIZE_FROM_LE(val) (GSIZE_TO_LE (val)) -#define GSSIZE_FROM_LE(val) (GSSIZE_TO_LE (val)) -#define GSIZE_FROM_BE(val) (GSIZE_TO_BE (val)) -#define GSSIZE_FROM_BE(val) (GSSIZE_TO_BE (val)) - -/* Portable versions of host-network order stuff - */ -#define g_ntohl(val) (GUINT32_FROM_BE (val)) -#define g_ntohs(val) (GUINT16_FROM_BE (val)) -#define g_htonl(val) (GUINT32_TO_BE (val)) -#define g_htons(val) (GUINT16_TO_BE (val)) - -/* Overflow-checked unsigned integer arithmetic - */ -#ifndef _GLIB_TEST_OVERFLOW_FALLBACK -/* https://bugzilla.gnome.org/show_bug.cgi?id=769104 */ -#if __GNUC__ >= 5 && !defined(__INTEL_COMPILER) -#define _GLIB_HAVE_BUILTIN_OVERFLOW_CHECKS -#elif g_macro__has_builtin(__builtin_uadd_overflow) -#define _GLIB_HAVE_BUILTIN_OVERFLOW_CHECKS -#endif -#endif - -#define g_uint_checked_add(dest, a, b) \ - _GLIB_CHECKED_ADD_U32(dest, a, b) -#define g_uint_checked_mul(dest, a, b) \ - _GLIB_CHECKED_MUL_U32(dest, a, b) - -#define g_uint64_checked_add(dest, a, b) \ - _GLIB_CHECKED_ADD_U64(dest, a, b) -#define g_uint64_checked_mul(dest, a, b) \ - _GLIB_CHECKED_MUL_U64(dest, a, b) - -#if GLIB_SIZEOF_SIZE_T == 8 -#define g_size_checked_add(dest, a, b) \ - _GLIB_CHECKED_ADD_U64(dest, a, b) -#define g_size_checked_mul(dest, a, b) \ - _GLIB_CHECKED_MUL_U64(dest, a, b) -#else -#define g_size_checked_add(dest, a, b) \ - _GLIB_CHECKED_ADD_U32(dest, a, b) -#define g_size_checked_mul(dest, a, b) \ - _GLIB_CHECKED_MUL_U32(dest, a, b) -#endif - -/* The names of the following inlines are private. Use the macro - * definitions above. - */ -#ifdef _GLIB_HAVE_BUILTIN_OVERFLOW_CHECKS -static inline gboolean _GLIB_CHECKED_ADD_U32 (guint32 *dest, guint32 a, guint32 b) { - return !__builtin_uadd_overflow(a, b, dest); } -static inline gboolean _GLIB_CHECKED_MUL_U32 (guint32 *dest, guint32 a, guint32 b) { - return !__builtin_umul_overflow(a, b, dest); } -static inline gboolean _GLIB_CHECKED_ADD_U64 (guint64 *dest, guint64 a, guint64 b) { - G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64)); - return !__builtin_uaddll_overflow(a, b, (unsigned long long *) dest); } -static inline gboolean _GLIB_CHECKED_MUL_U64 (guint64 *dest, guint64 a, guint64 b) { - return !__builtin_umulll_overflow(a, b, (unsigned long long *) dest); } -#else -static inline gboolean _GLIB_CHECKED_ADD_U32 (guint32 *dest, guint32 a, guint32 b) { - *dest = a + b; return *dest >= a; } -static inline gboolean _GLIB_CHECKED_MUL_U32 (guint32 *dest, guint32 a, guint32 b) { - *dest = a * b; return !a || *dest / a == b; } -static inline gboolean _GLIB_CHECKED_ADD_U64 (guint64 *dest, guint64 a, guint64 b) { - *dest = a + b; return *dest >= a; } -static inline gboolean _GLIB_CHECKED_MUL_U64 (guint64 *dest, guint64 a, guint64 b) { - *dest = a * b; return !a || *dest / a == b; } -#endif - -/* IEEE Standard 754 Single Precision Storage Format (gfloat): - * - * 31 30 23 22 0 - * +--------+---------------+---------------+ - * | s 1bit | e[30:23] 8bit | f[22:0] 23bit | - * +--------+---------------+---------------+ - * B0------------------->B1------->B2-->B3--> - * - * IEEE Standard 754 Double Precision Storage Format (gdouble): - * - * 63 62 52 51 32 31 0 - * +--------+----------------+----------------+ +---------------+ - * | s 1bit | e[62:52] 11bit | f[51:32] 20bit | | f[31:0] 32bit | - * +--------+----------------+----------------+ +---------------+ - * B0--------------->B1---------->B2--->B3----> B4->B5->B6->B7-> - */ -/* subtract from biased_exponent to form base2 exponent (normal numbers) */ -typedef union _GDoubleIEEE754 GDoubleIEEE754; -typedef union _GFloatIEEE754 GFloatIEEE754; -#define G_IEEE754_FLOAT_BIAS (127) -#define G_IEEE754_DOUBLE_BIAS (1023) -/* multiply with base2 exponent to get base10 exponent (normal numbers) */ -#define G_LOG_2_BASE_10 (0.30102999566398119521) -#if G_BYTE_ORDER == G_LITTLE_ENDIAN -union _GFloatIEEE754 -{ - gfloat v_float; - struct { - guint mantissa : 23; - guint biased_exponent : 8; - guint sign : 1; - } mpn; -}; -union _GDoubleIEEE754 -{ - gdouble v_double; - struct { - guint mantissa_low : 32; - guint mantissa_high : 20; - guint biased_exponent : 11; - guint sign : 1; - } mpn; -}; -#elif G_BYTE_ORDER == G_BIG_ENDIAN -union _GFloatIEEE754 -{ - gfloat v_float; - struct { - guint sign : 1; - guint biased_exponent : 8; - guint mantissa : 23; - } mpn; -}; -union _GDoubleIEEE754 -{ - gdouble v_double; - struct { - guint sign : 1; - guint biased_exponent : 11; - guint mantissa_high : 20; - guint mantissa_low : 32; - } mpn; -}; -#else /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */ -#error unknown ENDIAN type -#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */ - -typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime); - -struct _GTimeVal -{ - glong tv_sec; - glong tv_usec; -} GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime); - -typedef gint grefcount; -typedef gint gatomicrefcount; /* should be accessed only using atomics */ - -G_END_DECLS - -/* We prefix variable declarations so they can - * properly get exported in Windows DLLs. - */ -#ifndef GLIB_VAR -# ifdef G_PLATFORM_WIN32 -# ifdef GLIB_STATIC_COMPILATION -# define GLIB_VAR extern -# else /* !GLIB_STATIC_COMPILATION */ -# ifdef GLIB_COMPILATION -# ifdef DLL_EXPORT -# define GLIB_VAR extern __declspec(dllexport) -# else /* !DLL_EXPORT */ -# define GLIB_VAR extern -# endif /* !DLL_EXPORT */ -# else /* !GLIB_COMPILATION */ -# define GLIB_VAR extern __declspec(dllimport) -# endif /* !GLIB_COMPILATION */ -# endif /* !GLIB_STATIC_COMPILATION */ -# else /* !G_PLATFORM_WIN32 */ -# define GLIB_VAR _GLIB_EXTERN -# endif /* !G_PLATFORM_WIN32 */ -#endif /* GLIB_VAR */ - -#endif /* __G_TYPES_H__ */ - -#if defined(__BIONIC__) && defined (GLIB_HAVE_ALLOCA_H) -# include -#elif defined(__GNUC__) -/* GCC does the right thing */ -# undef alloca -# define alloca(size) __builtin_alloca (size) -#elif defined (GLIB_HAVE_ALLOCA_H) -/* a native and working alloca.h is there */ -# include -#else /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */ -# if defined(_MSC_VER) || defined(__DMC__) -# include -# define alloca _alloca -# else /* !_MSC_VER && !__DMC__ */ -# ifdef _AIX -# pragma alloca -# else /* !_AIX */ -# ifndef alloca /* predefined by HP cc +Olibcalls */ -G_BEGIN_DECLS -char *alloca (); -G_END_DECLS -# endif /* !alloca */ -# endif /* !_AIX */ -# endif /* !_MSC_VER && !__DMC__ */ -#endif /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */ - -/** - * g_alloca: - * @size: number of bytes to allocate. - * - * Allocates @size bytes on the stack; these bytes will be freed when the current - * stack frame is cleaned up. This macro essentially just wraps the alloca() - * function present on most UNIX variants. - * Thus it provides the same advantages and pitfalls as alloca(): - * - * - alloca() is very fast, as on most systems it's implemented by just adjusting - * the stack pointer register. - * - * - It doesn't cause any memory fragmentation, within its scope, separate alloca() - * blocks just build up and are released together at function end. - * - * - Allocation sizes have to fit into the current stack frame. For instance in a - * threaded environment on Linux, the per-thread stack size is limited to 2 Megabytes, - * so be sparse with alloca() uses. - * - * - Allocation failure due to insufficient stack space is not indicated with a %NULL - * return like e.g. with malloc(). Instead, most systems probably handle it the same - * way as out of stack space situations from infinite function recursion, i.e. - * with a segmentation fault. - * - * - Special care has to be taken when mixing alloca() with GNU C variable sized arrays. - * Stack space allocated with alloca() in the same scope as a variable sized array - * will be freed together with the variable sized array upon exit of that scope, and - * not upon exit of the enclosing function scope. - * - * Returns: space for @size bytes, allocated on the stack - */ -#define g_alloca(size) alloca (size) -/** - * g_newa: - * @struct_type: Type of memory chunks to be allocated - * @n_structs: Number of chunks to be allocated - * - * Wraps g_alloca() in a more typesafe manner. - * - * Returns: Pointer to stack space for @n_structs chunks of type @struct_type - */ -#define g_newa(struct_type, n_structs) ((struct_type*) g_alloca (sizeof (struct_type) * (gsize) (n_structs))) - -#endif /* __G_ALLOCA_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_ARRAY_H__ -#define __G_ARRAY_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GBytes GBytes; -typedef struct _GArray GArray; -typedef struct _GByteArray GByteArray; -typedef struct _GPtrArray GPtrArray; - -struct _GArray -{ - gchar *data; - guint len; -}; - -struct _GByteArray -{ - guint8 *data; - guint len; -}; - -struct _GPtrArray -{ - gpointer *pdata; - guint len; -}; - -/* Resizable arrays. remove fills any cleared spot and shortens the - * array, while preserving the order. remove_fast will distort the - * order by moving the last element to the position of the removed. - */ - -#define g_array_append_val(a,v) g_array_append_vals (a, &(v), 1) -#define g_array_prepend_val(a,v) g_array_prepend_vals (a, &(v), 1) -#define g_array_insert_val(a,i,v) g_array_insert_vals (a, i, &(v), 1) -#define g_array_index(a,t,i) (((t*) (void *) (a)->data) [(i)]) - -GLIB_AVAILABLE_IN_ALL -GArray* g_array_new (gboolean zero_terminated, - gboolean clear_, - guint element_size); -GLIB_AVAILABLE_IN_2_64 -gpointer g_array_steal (GArray *array, - gsize *len); -GLIB_AVAILABLE_IN_ALL -GArray* g_array_sized_new (gboolean zero_terminated, - gboolean clear_, - guint element_size, - guint reserved_size); -GLIB_AVAILABLE_IN_2_62 -GArray* g_array_copy (GArray *array); -GLIB_AVAILABLE_IN_ALL -gchar* g_array_free (GArray *array, - gboolean free_segment); -GLIB_AVAILABLE_IN_ALL -GArray *g_array_ref (GArray *array); -GLIB_AVAILABLE_IN_ALL -void g_array_unref (GArray *array); -GLIB_AVAILABLE_IN_ALL -guint g_array_get_element_size (GArray *array); -GLIB_AVAILABLE_IN_ALL -GArray* g_array_append_vals (GArray *array, - gconstpointer data, - guint len); -GLIB_AVAILABLE_IN_ALL -GArray* g_array_prepend_vals (GArray *array, - gconstpointer data, - guint len); -GLIB_AVAILABLE_IN_ALL -GArray* g_array_insert_vals (GArray *array, - guint index_, - gconstpointer data, - guint len); -GLIB_AVAILABLE_IN_ALL -GArray* g_array_set_size (GArray *array, - guint length); -GLIB_AVAILABLE_IN_ALL -GArray* g_array_remove_index (GArray *array, - guint index_); -GLIB_AVAILABLE_IN_ALL -GArray* g_array_remove_index_fast (GArray *array, - guint index_); -GLIB_AVAILABLE_IN_ALL -GArray* g_array_remove_range (GArray *array, - guint index_, - guint length); -GLIB_AVAILABLE_IN_ALL -void g_array_sort (GArray *array, - GCompareFunc compare_func); -GLIB_AVAILABLE_IN_ALL -void g_array_sort_with_data (GArray *array, - GCompareDataFunc compare_func, - gpointer user_data); -GLIB_AVAILABLE_IN_2_62 -gboolean g_array_binary_search (GArray *array, - gconstpointer target, - GCompareFunc compare_func, - guint *out_match_index); -GLIB_AVAILABLE_IN_ALL -void g_array_set_clear_func (GArray *array, - GDestroyNotify clear_func); - -/* Resizable pointer array. This interface is much less complicated - * than the above. Add appends a pointer. Remove fills any cleared - * spot and shortens the array. remove_fast will again distort order. - */ -#define g_ptr_array_index(array,index_) ((array)->pdata)[index_] -GLIB_AVAILABLE_IN_ALL -GPtrArray* g_ptr_array_new (void); -GLIB_AVAILABLE_IN_ALL -GPtrArray* g_ptr_array_new_with_free_func (GDestroyNotify element_free_func); -GLIB_AVAILABLE_IN_2_64 -gpointer* g_ptr_array_steal (GPtrArray *array, - gsize *len); -GLIB_AVAILABLE_IN_2_62 -GPtrArray *g_ptr_array_copy (GPtrArray *array, - GCopyFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -GPtrArray* g_ptr_array_sized_new (guint reserved_size); -GLIB_AVAILABLE_IN_ALL -GPtrArray* g_ptr_array_new_full (guint reserved_size, - GDestroyNotify element_free_func); -GLIB_AVAILABLE_IN_ALL -gpointer* g_ptr_array_free (GPtrArray *array, - gboolean free_seg); -GLIB_AVAILABLE_IN_ALL -GPtrArray* g_ptr_array_ref (GPtrArray *array); -GLIB_AVAILABLE_IN_ALL -void g_ptr_array_unref (GPtrArray *array); -GLIB_AVAILABLE_IN_ALL -void g_ptr_array_set_free_func (GPtrArray *array, - GDestroyNotify element_free_func); -GLIB_AVAILABLE_IN_ALL -void g_ptr_array_set_size (GPtrArray *array, - gint length); -GLIB_AVAILABLE_IN_ALL -gpointer g_ptr_array_remove_index (GPtrArray *array, - guint index_); -GLIB_AVAILABLE_IN_ALL -gpointer g_ptr_array_remove_index_fast (GPtrArray *array, - guint index_); -GLIB_AVAILABLE_IN_2_58 -gpointer g_ptr_array_steal_index (GPtrArray *array, - guint index_); -GLIB_AVAILABLE_IN_2_58 -gpointer g_ptr_array_steal_index_fast (GPtrArray *array, - guint index_); -GLIB_AVAILABLE_IN_ALL -gboolean g_ptr_array_remove (GPtrArray *array, - gpointer data); -GLIB_AVAILABLE_IN_ALL -gboolean g_ptr_array_remove_fast (GPtrArray *array, - gpointer data); -GLIB_AVAILABLE_IN_ALL -GPtrArray *g_ptr_array_remove_range (GPtrArray *array, - guint index_, - guint length); -GLIB_AVAILABLE_IN_ALL -void g_ptr_array_add (GPtrArray *array, - gpointer data); -GLIB_AVAILABLE_IN_2_62 -void g_ptr_array_extend (GPtrArray *array_to_extend, - GPtrArray *array, - GCopyFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_2_62 -void g_ptr_array_extend_and_steal (GPtrArray *array_to_extend, - GPtrArray *array); -GLIB_AVAILABLE_IN_2_40 -void g_ptr_array_insert (GPtrArray *array, - gint index_, - gpointer data); -GLIB_AVAILABLE_IN_ALL -void g_ptr_array_sort (GPtrArray *array, - GCompareFunc compare_func); -GLIB_AVAILABLE_IN_ALL -void g_ptr_array_sort_with_data (GPtrArray *array, - GCompareDataFunc compare_func, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -void g_ptr_array_foreach (GPtrArray *array, - GFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_2_54 -gboolean g_ptr_array_find (GPtrArray *haystack, - gconstpointer needle, - guint *index_); -GLIB_AVAILABLE_IN_2_54 -gboolean g_ptr_array_find_with_equal_func (GPtrArray *haystack, - gconstpointer needle, - GEqualFunc equal_func, - guint *index_); - - -/* Byte arrays, an array of guint8. Implemented as a GArray, - * but type-safe. - */ - -GLIB_AVAILABLE_IN_ALL -GByteArray* g_byte_array_new (void); -GLIB_AVAILABLE_IN_ALL -GByteArray* g_byte_array_new_take (guint8 *data, - gsize len); -GLIB_AVAILABLE_IN_2_64 -guint8* g_byte_array_steal (GByteArray *array, - gsize *len); -GLIB_AVAILABLE_IN_ALL -GByteArray* g_byte_array_sized_new (guint reserved_size); -GLIB_AVAILABLE_IN_ALL -guint8* g_byte_array_free (GByteArray *array, - gboolean free_segment); -GLIB_AVAILABLE_IN_ALL -GBytes* g_byte_array_free_to_bytes (GByteArray *array); -GLIB_AVAILABLE_IN_ALL -GByteArray *g_byte_array_ref (GByteArray *array); -GLIB_AVAILABLE_IN_ALL -void g_byte_array_unref (GByteArray *array); -GLIB_AVAILABLE_IN_ALL -GByteArray* g_byte_array_append (GByteArray *array, - const guint8 *data, - guint len); -GLIB_AVAILABLE_IN_ALL -GByteArray* g_byte_array_prepend (GByteArray *array, - const guint8 *data, - guint len); -GLIB_AVAILABLE_IN_ALL -GByteArray* g_byte_array_set_size (GByteArray *array, - guint length); -GLIB_AVAILABLE_IN_ALL -GByteArray* g_byte_array_remove_index (GByteArray *array, - guint index_); -GLIB_AVAILABLE_IN_ALL -GByteArray* g_byte_array_remove_index_fast (GByteArray *array, - guint index_); -GLIB_AVAILABLE_IN_ALL -GByteArray* g_byte_array_remove_range (GByteArray *array, - guint index_, - guint length); -GLIB_AVAILABLE_IN_ALL -void g_byte_array_sort (GByteArray *array, - GCompareFunc compare_func); -GLIB_AVAILABLE_IN_ALL -void g_byte_array_sort_with_data (GByteArray *array, - GCompareDataFunc compare_func, - gpointer user_data); - -G_END_DECLS - -#endif /* __G_ARRAY_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_ASYNCQUEUE_H__ -#define __G_ASYNCQUEUE_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_THREAD_H__ -#define __G_THREAD_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -/* - * Copyright © 2011 Ryan Lortie - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - * - * Author: Ryan Lortie - */ - -#ifndef __G_ATOMIC_H__ -#define __G_ATOMIC_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_ALL -gint g_atomic_int_get (const volatile gint *atomic); -GLIB_AVAILABLE_IN_ALL -void g_atomic_int_set (volatile gint *atomic, - gint newval); -GLIB_AVAILABLE_IN_ALL -void g_atomic_int_inc (volatile gint *atomic); -GLIB_AVAILABLE_IN_ALL -gboolean g_atomic_int_dec_and_test (volatile gint *atomic); -GLIB_AVAILABLE_IN_ALL -gboolean g_atomic_int_compare_and_exchange (volatile gint *atomic, - gint oldval, - gint newval); -GLIB_AVAILABLE_IN_ALL -gint g_atomic_int_add (volatile gint *atomic, - gint val); -GLIB_AVAILABLE_IN_2_30 -guint g_atomic_int_and (volatile guint *atomic, - guint val); -GLIB_AVAILABLE_IN_2_30 -guint g_atomic_int_or (volatile guint *atomic, - guint val); -GLIB_AVAILABLE_IN_ALL -guint g_atomic_int_xor (volatile guint *atomic, - guint val); - -GLIB_AVAILABLE_IN_ALL -gpointer g_atomic_pointer_get (const volatile void *atomic); -GLIB_AVAILABLE_IN_ALL -void g_atomic_pointer_set (volatile void *atomic, - gpointer newval); -GLIB_AVAILABLE_IN_ALL -gboolean g_atomic_pointer_compare_and_exchange (volatile void *atomic, - gpointer oldval, - gpointer newval); -GLIB_AVAILABLE_IN_ALL -gssize g_atomic_pointer_add (volatile void *atomic, - gssize val); -GLIB_AVAILABLE_IN_2_30 -gsize g_atomic_pointer_and (volatile void *atomic, - gsize val); -GLIB_AVAILABLE_IN_2_30 -gsize g_atomic_pointer_or (volatile void *atomic, - gsize val); -GLIB_AVAILABLE_IN_ALL -gsize g_atomic_pointer_xor (volatile void *atomic, - gsize val); - -GLIB_DEPRECATED_IN_2_30_FOR(g_atomic_int_add) -gint g_atomic_int_exchange_and_add (volatile gint *atomic, - gint val); - -G_END_DECLS - -#if defined(G_ATOMIC_LOCK_FREE) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) - -/* We prefer the new C11-style atomic extension of GCC if available */ -#if defined(__ATOMIC_SEQ_CST) - -#undef g_atomic_int_get -#define g_atomic_int_get(atomic) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - gint gaig_temp; \ - (void) (0 ? *(atomic) ^ *(atomic) : 1); \ - __atomic_load ((gint *)(atomic), &gaig_temp, __ATOMIC_SEQ_CST); \ - (gint) gaig_temp; \ - })) -#undef g_atomic_int_set -#define g_atomic_int_set(atomic, newval) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - gint gais_temp = (gint) (newval); \ - (void) (0 ? *(atomic) ^ (newval) : 1); \ - __atomic_store ((gint *)(atomic), &gais_temp, __ATOMIC_SEQ_CST); \ - })) - -#if defined(glib_typeof) -#undef g_atomic_pointer_get -#define g_atomic_pointer_get(atomic) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - glib_typeof (*(atomic)) gapg_temp_newval; \ - glib_typeof ((atomic)) gapg_temp_atomic = (atomic); \ - __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \ - gapg_temp_newval; \ - })) -#undef g_atomic_pointer_set -#define g_atomic_pointer_set(atomic, newval) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - glib_typeof ((atomic)) gaps_temp_atomic = (atomic); \ - glib_typeof (*(atomic)) gaps_temp_newval = (newval); \ - (void) (0 ? (gpointer) * (atomic) : NULL); \ - __atomic_store (gaps_temp_atomic, &gaps_temp_newval, __ATOMIC_SEQ_CST); \ - })) -#else /* if !defined(glib_typeof) */ -#undef g_atomic_pointer_get -#define g_atomic_pointer_get(atomic) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - gpointer gapg_temp_newval; \ - gpointer *gapg_temp_atomic = (gpointer *)(atomic); \ - __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \ - gapg_temp_newval; \ - })) -#undef g_atomic_pointer_set -#define g_atomic_pointer_set(atomic, newval) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - gpointer *gaps_temp_atomic = (gpointer *)(atomic); \ - gpointer gaps_temp_newval = (gpointer)(newval); \ - (void) (0 ? (gpointer) *(atomic) : NULL); \ - __atomic_store (gaps_temp_atomic, &gaps_temp_newval, __ATOMIC_SEQ_CST); \ - })) -#endif /* !defined(glib_typeof) */ - -#undef g_atomic_int_inc -#define g_atomic_int_inc(atomic) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ *(atomic) : 1); \ - (void) __atomic_fetch_add ((atomic), 1, __ATOMIC_SEQ_CST); \ - })) -#undef g_atomic_int_dec_and_test -#define g_atomic_int_dec_and_test(atomic) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ *(atomic) : 1); \ - __atomic_fetch_sub ((atomic), 1, __ATOMIC_SEQ_CST) == 1; \ - })) -#undef g_atomic_int_compare_and_exchange -#define g_atomic_int_compare_and_exchange(atomic, oldval, newval) \ - (G_GNUC_EXTENSION ({ \ - gint gaicae_oldval = (oldval); \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ (newval) ^ (oldval) : 1); \ - __atomic_compare_exchange_n ((atomic), &gaicae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ? TRUE : FALSE; \ - })) -#undef g_atomic_int_add -#define g_atomic_int_add(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ (val) : 1); \ - (gint) __atomic_fetch_add ((atomic), (val), __ATOMIC_SEQ_CST); \ - })) -#undef g_atomic_int_and -#define g_atomic_int_and(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ (val) : 1); \ - (guint) __atomic_fetch_and ((atomic), (val), __ATOMIC_SEQ_CST); \ - })) -#undef g_atomic_int_or -#define g_atomic_int_or(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ (val) : 1); \ - (guint) __atomic_fetch_or ((atomic), (val), __ATOMIC_SEQ_CST); \ - })) -#undef g_atomic_int_xor -#define g_atomic_int_xor(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ (val) : 1); \ - (guint) __atomic_fetch_xor ((atomic), (val), __ATOMIC_SEQ_CST); \ - })) - -#if defined(glib_typeof) -#undef g_atomic_pointer_compare_and_exchange -#define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof (oldval) == sizeof (gpointer)); \ - glib_typeof ((oldval)) gapcae_oldval = (oldval); \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - (void) (0 ? (gpointer) *(atomic) : NULL); \ - __atomic_compare_exchange_n ((atomic), &gapcae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ? TRUE : FALSE; \ - })) -#else /* if !defined(glib_typeof) */ -#undef g_atomic_pointer_compare_and_exchange -#define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof (oldval) == sizeof (gpointer)); \ - gpointer gapcae_oldval = (gpointer)(oldval); \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - (void) (0 ? (gpointer) *(atomic) : NULL); \ - __atomic_compare_exchange_n ((atomic), &gapcae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ? TRUE : FALSE; \ - })) -#endif /* defined(glib_typeof) */ -#undef g_atomic_pointer_add -#define g_atomic_pointer_add(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - (void) (0 ? (gpointer) *(atomic) : NULL); \ - (void) (0 ? (val) ^ (val) : 1); \ - (gssize) __atomic_fetch_add ((atomic), (val), __ATOMIC_SEQ_CST); \ - })) -#undef g_atomic_pointer_and -#define g_atomic_pointer_and(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - gsize *gapa_atomic = (gsize *) (atomic); \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gsize)); \ - (void) (0 ? (gpointer) *(atomic) : NULL); \ - (void) (0 ? (val) ^ (val) : 1); \ - (gsize) __atomic_fetch_and (gapa_atomic, (val), __ATOMIC_SEQ_CST); \ - })) -#undef g_atomic_pointer_or -#define g_atomic_pointer_or(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - gsize *gapo_atomic = (gsize *) (atomic); \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gsize)); \ - (void) (0 ? (gpointer) *(atomic) : NULL); \ - (void) (0 ? (val) ^ (val) : 1); \ - (gsize) __atomic_fetch_or (gapo_atomic, (val), __ATOMIC_SEQ_CST); \ - })) -#undef g_atomic_pointer_xor -#define g_atomic_pointer_xor(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - gsize *gapx_atomic = (gsize *) (atomic); \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gsize)); \ - (void) (0 ? (gpointer) *(atomic) : NULL); \ - (void) (0 ? (val) ^ (val) : 1); \ - (gsize) __atomic_fetch_xor (gapx_atomic, (val), __ATOMIC_SEQ_CST); \ - })) - -#else /* defined(__ATOMIC_SEQ_CST) */ - -/* We want to achieve __ATOMIC_SEQ_CST semantics here. See - * https://en.cppreference.com/w/c/atomic/memory_order#Constants. For load - * operations, that means performing an *acquire*: - * > A load operation with this memory order performs the acquire operation on - * > the affected memory location: no reads or writes in the current thread can - * > be reordered before this load. All writes in other threads that release - * > the same atomic variable are visible in the current thread. - * - * “no reads or writes in the current thread can be reordered before this load” - * is implemented using a compiler barrier (a no-op `__asm__` section) to - * prevent instruction reordering. Writes in other threads are synchronised - * using `__sync_synchronize()`. It’s unclear from the GCC documentation whether - * `__sync_synchronize()` acts as a compiler barrier, hence our explicit use of - * one. - * - * For store operations, `__ATOMIC_SEQ_CST` means performing a *release*: - * > A store operation with this memory order performs the release operation: - * > no reads or writes in the current thread can be reordered after this store. - * > All writes in the current thread are visible in other threads that acquire - * > the same atomic variable (see Release-Acquire ordering below) and writes - * > that carry a dependency into the atomic variable become visible in other - * > threads that consume the same atomic (see Release-Consume ordering below). - * - * “no reads or writes in the current thread can be reordered after this store” - * is implemented using a compiler barrier to prevent instruction reordering. - * “All writes in the current thread are visible in other threads” is implemented - * using `__sync_synchronize()`; similarly for “writes that carry a dependency”. - */ -#undef g_atomic_int_get -#define g_atomic_int_get(atomic) \ - (G_GNUC_EXTENSION ({ \ - gint gaig_result; \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ *(atomic) : 1); \ - gaig_result = (gint) *(atomic); \ - __sync_synchronize (); \ - __asm__ __volatile__ ("" : : : "memory"); \ - gaig_result; \ - })) -#undef g_atomic_int_set -#define g_atomic_int_set(atomic, newval) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ (newval) : 1); \ - __sync_synchronize (); \ - __asm__ __volatile__ ("" : : : "memory"); \ - *(atomic) = (newval); \ - })) -#undef g_atomic_pointer_get -#define g_atomic_pointer_get(atomic) \ - (G_GNUC_EXTENSION ({ \ - gpointer gapg_result; \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - gapg_result = (gpointer) *(atomic); \ - __sync_synchronize (); \ - __asm__ __volatile__ ("" : : : "memory"); \ - gapg_result; \ - })) -#if defined(glib_typeof) -#undef g_atomic_pointer_set -#define g_atomic_pointer_set(atomic, newval) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - (void) (0 ? (gpointer) *(atomic) : NULL); \ - __sync_synchronize (); \ - __asm__ __volatile__ ("" : : : "memory"); \ - *(atomic) = (glib_typeof (*(atomic))) (gsize) (newval); \ - })) -#else /* if !defined(glib_typeof) */ -#undef g_atomic_pointer_set -#define g_atomic_pointer_set(atomic, newval) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - (void) (0 ? (gpointer) *(atomic) : NULL); \ - __sync_synchronize (); \ - __asm__ __volatile__ ("" : : : "memory"); \ - *(atomic) = (gpointer) (gsize) (newval); \ - })) -#endif /* defined(glib_typeof) */ - -#undef g_atomic_int_inc -#define g_atomic_int_inc(atomic) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ *(atomic) : 1); \ - (void) __sync_fetch_and_add ((atomic), 1); \ - })) -#undef g_atomic_int_dec_and_test -#define g_atomic_int_dec_and_test(atomic) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ *(atomic) : 1); \ - __sync_fetch_and_sub ((atomic), 1) == 1; \ - })) -#undef g_atomic_int_compare_and_exchange -#define g_atomic_int_compare_and_exchange(atomic, oldval, newval) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ (newval) ^ (oldval) : 1); \ - __sync_bool_compare_and_swap ((atomic), (oldval), (newval)) ? TRUE : FALSE; \ - })) -#undef g_atomic_int_add -#define g_atomic_int_add(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ (val) : 1); \ - (gint) __sync_fetch_and_add ((atomic), (val)); \ - })) -#undef g_atomic_int_and -#define g_atomic_int_and(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ (val) : 1); \ - (guint) __sync_fetch_and_and ((atomic), (val)); \ - })) -#undef g_atomic_int_or -#define g_atomic_int_or(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ (val) : 1); \ - (guint) __sync_fetch_and_or ((atomic), (val)); \ - })) -#undef g_atomic_int_xor -#define g_atomic_int_xor(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ - (void) (0 ? *(atomic) ^ (val) : 1); \ - (guint) __sync_fetch_and_xor ((atomic), (val)); \ - })) - -#undef g_atomic_pointer_compare_and_exchange -#define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - (void) (0 ? (gpointer) *(atomic) : NULL); \ - __sync_bool_compare_and_swap ((atomic), (oldval), (newval)) ? TRUE : FALSE; \ - })) -#undef g_atomic_pointer_add -#define g_atomic_pointer_add(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - (void) (0 ? (gpointer) *(atomic) : NULL); \ - (void) (0 ? (val) ^ (val) : 1); \ - (gssize) __sync_fetch_and_add ((atomic), (val)); \ - })) -#undef g_atomic_pointer_and -#define g_atomic_pointer_and(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - (void) (0 ? (gpointer) *(atomic) : NULL); \ - (void) (0 ? (val) ^ (val) : 1); \ - (gsize) __sync_fetch_and_and ((atomic), (val)); \ - })) -#undef g_atomic_pointer_or -#define g_atomic_pointer_or(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - (void) (0 ? (gpointer) *(atomic) : NULL); \ - (void) (0 ? (val) ^ (val) : 1); \ - (gsize) __sync_fetch_and_or ((atomic), (val)); \ - })) -#undef g_atomic_pointer_xor -#define g_atomic_pointer_xor(atomic, val) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ - (void) (0 ? (gpointer) *(atomic) : NULL); \ - (void) (0 ? (val) ^ (val) : 1); \ - (gsize) __sync_fetch_and_xor ((atomic), (val)); \ - })) - -#endif /* !defined(__ATOMIC_SEQ_CST) */ - -#else /* defined(G_ATOMIC_LOCK_FREE) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) */ - -#undef g_atomic_int_get -#define g_atomic_int_get(atomic) \ - (_frida_g_atomic_int_get ((gint *) (atomic))) -#undef g_atomic_int_set -#define g_atomic_int_set(atomic, newval) \ - (_frida_g_atomic_int_set ((gint *) (atomic), (gint) (newval))) -#undef g_atomic_int_compare_and_exchange -#define g_atomic_int_compare_and_exchange(atomic, oldval, newval) \ - (_frida_g_atomic_int_compare_and_exchange ((gint *) (atomic), (oldval), (newval))) -#undef g_atomic_int_add -#define g_atomic_int_add(atomic, val) \ - (_frida_g_atomic_int_add ((gint *) (atomic), (val))) -#undef g_atomic_int_and -#define g_atomic_int_and(atomic, val) \ - (_frida_g_atomic_int_and ((guint *) (atomic), (val))) -#undef g_atomic_int_or -#define g_atomic_int_or(atomic, val) \ - (_frida_g_atomic_int_or ((guint *) (atomic), (val))) -#undef g_atomic_int_xor -#define g_atomic_int_xor(atomic, val) \ - (_frida_g_atomic_int_xor ((guint *) (atomic), (val))) -#undef g_atomic_int_inc -#define g_atomic_int_inc(atomic) \ - (_frida_g_atomic_int_inc ((gint *) (atomic))) -#undef g_atomic_int_dec_and_test -#define g_atomic_int_dec_and_test(atomic) \ - (_frida_g_atomic_int_dec_and_test ((gint *) (atomic))) - -#undef g_atomic_pointer_get -#define g_atomic_pointer_get(atomic) \ - (_frida_g_atomic_pointer_get (atomic)) -#undef g_atomic_pointer_set -#define g_atomic_pointer_set(atomic, newval) \ - (_frida_g_atomic_pointer_set ((atomic), (gpointer) (newval))) -#undef g_atomic_pointer_compare_and_exchange -#define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \ - (_frida_g_atomic_pointer_compare_and_exchange ((atomic), (gpointer) (oldval), (gpointer) (newval))) -#undef g_atomic_pointer_add -#define g_atomic_pointer_add(atomic, val) \ - (_frida_g_atomic_pointer_add ((atomic), (gssize) (val))) -#undef g_atomic_pointer_and -#define g_atomic_pointer_and(atomic, val) \ - (_frida_g_atomic_pointer_and ((atomic), (gsize) (val))) -#undef g_atomic_pointer_or -#define g_atomic_pointer_or(atomic, val) \ - (_frida_g_atomic_pointer_or ((atomic), (gsize) (val))) -#undef g_atomic_pointer_xor -#define g_atomic_pointer_xor(atomic, val) \ - (_frida_g_atomic_pointer_xor ((atomic), (gsize) (val))) - -#endif /* defined(G_ATOMIC_LOCK_FREE) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) */ - -#endif /* __G_ATOMIC_H__ */ -/* gerror.h - Error reporting system - * - * Copyright 2000 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_ERROR_H__ -#define __G_ERROR_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -#include - -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_QUARK_H__ -#define __G_QUARK_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef guint32 GQuark; - -/* Quarks (string<->id association) - */ -GLIB_AVAILABLE_IN_ALL -GQuark g_quark_try_string (const gchar *string); -GLIB_AVAILABLE_IN_ALL -GQuark g_quark_from_static_string (const gchar *string); -GLIB_AVAILABLE_IN_ALL -GQuark g_quark_from_string (const gchar *string); -GLIB_AVAILABLE_IN_ALL -const gchar * g_quark_to_string (GQuark quark) G_GNUC_CONST; - -#define G_DEFINE_QUARK(QN, q_n) \ -GQuark \ -q_n##_quark (void) \ -{ \ - static GQuark q; \ - \ - if G_UNLIKELY (q == 0) \ - q = g_quark_from_static_string (#QN); \ - \ - return q; \ -} - -GLIB_AVAILABLE_IN_ALL -const gchar * g_intern_string (const gchar *string); -GLIB_AVAILABLE_IN_ALL -const gchar * g_intern_static_string (const gchar *string); - -G_END_DECLS - -#endif /* __G_QUARK_H__ */ - -G_BEGIN_DECLS - -/** - * GError: - * @domain: error domain, e.g. #G_FILE_ERROR - * @code: error code, e.g. %G_FILE_ERROR_NOENT - * @message: human-readable informative error message - * - * The `GError` structure contains information about - * an error that has occurred. - */ -typedef struct _GError GError; - -struct _GError -{ - GQuark domain; - gint code; - gchar *message; -}; - -GLIB_AVAILABLE_IN_ALL -GError* g_error_new (GQuark domain, - gint code, - const gchar *format, - ...) G_GNUC_PRINTF (3, 4); - -GLIB_AVAILABLE_IN_ALL -GError* g_error_new_literal (GQuark domain, - gint code, - const gchar *message); -GLIB_AVAILABLE_IN_ALL -GError* g_error_new_valist (GQuark domain, - gint code, - const gchar *format, - va_list args) G_GNUC_PRINTF(3, 0); - -GLIB_AVAILABLE_IN_ALL -void g_error_free (GError *error); -GLIB_AVAILABLE_IN_ALL -GError* g_error_copy (const GError *error); - -GLIB_AVAILABLE_IN_ALL -gboolean g_error_matches (const GError *error, - GQuark domain, - gint code); - -/* if (err) *err = g_error_new(domain, code, format, ...), also has - * some sanity checks. - */ -GLIB_AVAILABLE_IN_ALL -void g_set_error (GError **err, - GQuark domain, - gint code, - const gchar *format, - ...) G_GNUC_PRINTF (4, 5); - -GLIB_AVAILABLE_IN_ALL -void g_set_error_literal (GError **err, - GQuark domain, - gint code, - const gchar *message); - -/* if (dest) *dest = src; also has some sanity checks. - */ -GLIB_AVAILABLE_IN_ALL -void g_propagate_error (GError **dest, - GError *src); - -/* if (err && *err) { g_error_free(*err); *err = NULL; } */ -GLIB_AVAILABLE_IN_ALL -void g_clear_error (GError **err); - -/* if (err) prefix the formatted string to the ->message */ -GLIB_AVAILABLE_IN_ALL -void g_prefix_error (GError **err, - const gchar *format, - ...) G_GNUC_PRINTF (2, 3); - -/* g_propagate_error then g_error_prefix on dest */ -GLIB_AVAILABLE_IN_ALL -void g_propagate_prefixed_error (GError **dest, - GError *src, - const gchar *format, - ...) G_GNUC_PRINTF (3, 4); - -G_END_DECLS - -#endif /* __G_ERROR_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_UTILS_H__ -#define __G_UTILS_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -#include - -G_BEGIN_DECLS - -/* Define G_VA_COPY() to do the right thing for copying va_list variables. - * glibconfig.h may have already defined G_VA_COPY as va_copy or __va_copy. - */ -#if !defined (G_VA_COPY) -# if defined (__GNUC__) && defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32)) -# define G_VA_COPY(ap1, ap2) (*(ap1) = *(ap2)) -# elif defined (G_VA_COPY_AS_ARRAY) -# define G_VA_COPY(ap1, ap2) memmove ((ap1), (ap2), sizeof (va_list)) -# else /* va_list is a pointer */ -# define G_VA_COPY(ap1, ap2) ((ap1) = (ap2)) -# endif /* va_list is a pointer */ -#endif /* !G_VA_COPY */ - -GLIB_AVAILABLE_IN_ALL -const gchar * g_get_user_name (void); -GLIB_AVAILABLE_IN_ALL -const gchar * g_get_real_name (void); -GLIB_AVAILABLE_IN_ALL -const gchar * g_get_home_dir (void); -GLIB_AVAILABLE_IN_ALL -const gchar * g_get_tmp_dir (void); -GLIB_AVAILABLE_IN_ALL -const gchar * g_get_host_name (void); -GLIB_AVAILABLE_IN_ALL -const gchar * g_get_prgname (void); -GLIB_AVAILABLE_IN_ALL -void g_set_prgname (const gchar *prgname); -GLIB_AVAILABLE_IN_ALL -const gchar * g_get_application_name (void); -GLIB_AVAILABLE_IN_ALL -void g_set_application_name (const gchar *application_name); -GLIB_AVAILABLE_IN_2_64 -gchar * g_get_os_info (const gchar *key_name); - -/** - * G_OS_INFO_KEY_NAME: - * - * A key to get the name of the operating system excluding version information suitable for presentation to the user, e.g. "YoYoOS" - * - * Since: 2.64 - */ -#define G_OS_INFO_KEY_NAME \ - GLIB_AVAILABLE_MACRO_IN_2_64 \ - "NAME" - -/** - * G_OS_INFO_KEY_PRETTY_NAME: - * - * A key to get the name of the operating system in a format suitable for presentation to the user, e.g. "YoYoOS Foo" - * - * Since: 2.64 - */ -#define G_OS_INFO_KEY_PRETTY_NAME \ - GLIB_AVAILABLE_MACRO_IN_2_64 \ - "PRETTY_NAME" - -/** - * G_OS_INFO_KEY_VERSION: - * - * A key to get the operating system version suitable for presentation to the user, e.g. "42 (Foo)" - * - * Since: 2.64 - */ -#define G_OS_INFO_KEY_VERSION \ - GLIB_AVAILABLE_MACRO_IN_2_64 \ - "VERSION" - -/** - * G_OS_INFO_KEY_VERSION_CODENAME: - * - * A key to get a codename identifying the operating system release suitable for processing by scripts or usage in generated filenames, e.g. "foo" - * - * Since: 2.64 - */ -#define G_OS_INFO_KEY_VERSION_CODENAME \ - GLIB_AVAILABLE_MACRO_IN_2_64 \ - "VERSION_CODENAME" - -/** - * G_OS_INFO_KEY_VERSION_ID: - * - * A key to get the version of the operating system suitable for processing by scripts or usage in generated filenames, e.g. "42" - * - * Since: 2.64 - */ -#define G_OS_INFO_KEY_VERSION_ID \ - GLIB_AVAILABLE_MACRO_IN_2_64 \ - "VERSION_ID" - -/** - * G_OS_INFO_KEY_ID: - * - * A key to get an ID identifying the operating system suitable for processing by scripts or usage in generated filenames, e.g. "yoyoos" - * - * Since: 2.64 - */ -#define G_OS_INFO_KEY_ID \ - GLIB_AVAILABLE_MACRO_IN_2_64 \ - "ID" - -/** - * G_OS_INFO_KEY_HOME_URL: - * - * A key to get the homepage for the operating system, e.g. "https://www.yoyo-os.com/" - * - * Since: 2.64 - */ -#define G_OS_INFO_KEY_HOME_URL \ - GLIB_AVAILABLE_MACRO_IN_2_64 \ - "HOME_URL" - -/** - * G_OS_INFO_KEY_DOCUMENTATION_URL: - * - * A key to get the documentation page for the operating system, e.g. "https://docs.yoyo-os.com/" - * - * Since: 2.64 - */ -#define G_OS_INFO_KEY_DOCUMENTATION_URL \ - GLIB_AVAILABLE_MACRO_IN_2_64 \ - "DOCUMENTATION_URL" - -/** - * G_OS_INFO_KEY_SUPPORT_URL: - * - * A key to get the support page for the operating system, e.g. "https://support.yoyo-os.com/" - * - * Since: 2.64 - */ -#define G_OS_INFO_KEY_SUPPORT_URL \ - GLIB_AVAILABLE_MACRO_IN_2_64 \ - "SUPPORT_URL" - -/** - * G_OS_INFO_KEY_BUG_REPORT_URL: - * - * A key to get the bug reporting page for the operating system, e.g. "https://bugs.yoyo-os.com/" - * - * Since: 2.64 - */ -#define G_OS_INFO_KEY_BUG_REPORT_URL \ - GLIB_AVAILABLE_MACRO_IN_2_64 \ - "BUG_REPORT_URL" - -/** - * G_OS_INFO_KEY_PRIVACY_POLICY_URL: - * - * A key to get the privacy policy for the operating system, e.g. "https://privacy.yoyo-os.com/" - * - * Since: 2.64 - */ -#define G_OS_INFO_KEY_PRIVACY_POLICY_URL \ - GLIB_AVAILABLE_MACRO_IN_2_64 \ - "PRIVACY_POLICY_URL" - -GLIB_AVAILABLE_IN_ALL -void g_reload_user_special_dirs_cache (void); -GLIB_AVAILABLE_IN_ALL -const gchar * g_get_user_data_dir (void); -GLIB_AVAILABLE_IN_ALL -const gchar * g_get_user_config_dir (void); -GLIB_AVAILABLE_IN_ALL -const gchar * g_get_user_cache_dir (void); -GLIB_AVAILABLE_IN_ALL -const gchar * const * g_get_system_data_dirs (void); - -#ifdef G_OS_WIN32 -/* This function is not part of the public GLib API */ -GLIB_AVAILABLE_IN_ALL -const gchar * const * g_win32_get_system_data_dirs_for_module (void (*address_of_function)(void)); -#endif - -#if defined (G_OS_WIN32) && defined (G_CAN_INLINE) -/* This function is not part of the public GLib API either. Just call - * g_get_system_data_dirs() in your code, never mind that that is - * actually a macro and you will in fact call this inline function. - */ -static inline const gchar * const * -_g_win32_get_system_data_dirs (void) -{ - return g_win32_get_system_data_dirs_for_module ((void (*)(void)) &_g_win32_get_system_data_dirs); -} -#undef g_get_system_data_dirs -#define g_get_system_data_dirs _g_win32_get_system_data_dirs -#endif - -GLIB_AVAILABLE_IN_ALL -const gchar * const * g_get_system_config_dirs (void); - -GLIB_AVAILABLE_IN_ALL -const gchar * g_get_user_runtime_dir (void); - -/** - * GUserDirectory: - * @G_USER_DIRECTORY_DESKTOP: the user's Desktop directory - * @G_USER_DIRECTORY_DOCUMENTS: the user's Documents directory - * @G_USER_DIRECTORY_DOWNLOAD: the user's Downloads directory - * @G_USER_DIRECTORY_MUSIC: the user's Music directory - * @G_USER_DIRECTORY_PICTURES: the user's Pictures directory - * @G_USER_DIRECTORY_PUBLIC_SHARE: the user's shared directory - * @G_USER_DIRECTORY_TEMPLATES: the user's Templates directory - * @G_USER_DIRECTORY_VIDEOS: the user's Movies directory - * @G_USER_N_DIRECTORIES: the number of enum values - * - * These are logical ids for special directories which are defined - * depending on the platform used. You should use g_get_user_special_dir() - * to retrieve the full path associated to the logical id. - * - * The #GUserDirectory enumeration can be extended at later date. Not - * every platform has a directory for every logical id in this - * enumeration. - * - * Since: 2.14 - */ -typedef enum { - G_USER_DIRECTORY_DESKTOP, - G_USER_DIRECTORY_DOCUMENTS, - G_USER_DIRECTORY_DOWNLOAD, - G_USER_DIRECTORY_MUSIC, - G_USER_DIRECTORY_PICTURES, - G_USER_DIRECTORY_PUBLIC_SHARE, - G_USER_DIRECTORY_TEMPLATES, - G_USER_DIRECTORY_VIDEOS, - - G_USER_N_DIRECTORIES -} GUserDirectory; - -GLIB_AVAILABLE_IN_ALL -const gchar * g_get_user_special_dir (GUserDirectory directory); - -/** - * GDebugKey: - * @key: the string - * @value: the flag - * - * Associates a string with a bit flag. - * Used in g_parse_debug_string(). - */ -typedef struct _GDebugKey GDebugKey; -struct _GDebugKey -{ - const gchar *key; - guint value; -}; - -/* Miscellaneous utility functions - */ -GLIB_AVAILABLE_IN_ALL -guint g_parse_debug_string (const gchar *string, - const GDebugKey *keys, - guint nkeys); - -GLIB_AVAILABLE_IN_ALL -gint g_snprintf (gchar *string, - gulong n, - gchar const *format, - ...) G_GNUC_PRINTF (3, 4); -GLIB_AVAILABLE_IN_ALL -gint g_vsnprintf (gchar *string, - gulong n, - gchar const *format, - va_list args) - G_GNUC_PRINTF(3, 0); - -GLIB_AVAILABLE_IN_ALL -void g_nullify_pointer (gpointer *nullify_location); - -typedef enum -{ - G_FORMAT_SIZE_DEFAULT = 0, - G_FORMAT_SIZE_LONG_FORMAT = 1 << 0, - G_FORMAT_SIZE_IEC_UNITS = 1 << 1, - G_FORMAT_SIZE_BITS = 1 << 2 -} GFormatSizeFlags; - -GLIB_AVAILABLE_IN_2_30 -gchar *g_format_size_full (guint64 size, - GFormatSizeFlags flags); -GLIB_AVAILABLE_IN_2_30 -gchar *g_format_size (guint64 size); - -GLIB_DEPRECATED_IN_2_30_FOR(g_format_size) -gchar *g_format_size_for_display (goffset size); - -#define g_ATEXIT(proc) (atexit (proc)) GLIB_DEPRECATED_MACRO_IN_2_32 -#define g_memmove(dest,src,len) \ - G_STMT_START { memmove ((dest), (src), (len)); } G_STMT_END GLIB_DEPRECATED_MACRO_IN_2_40_FOR(memmove) - -/** - * GVoidFunc: - * - * Declares a type of function which takes no arguments - * and has no return value. It is used to specify the type - * function passed to g_atexit(). - */ -typedef void (*GVoidFunc) (void) GLIB_DEPRECATED_TYPE_IN_2_32; -#define ATEXIT(proc) g_ATEXIT(proc) GLIB_DEPRECATED_MACRO_IN_2_32 - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_DEPRECATED -void g_atexit (GVoidFunc func); -G_GNUC_END_IGNORE_DEPRECATIONS - -#ifdef G_OS_WIN32 -/* It's a bad idea to wrap atexit() on Windows. If the GLib DLL calls - * atexit(), the function will be called when the GLib DLL is detached - * from the program, which is not what the caller wants. The caller - * wants the function to be called when it *itself* exits (or is - * detached, in case the caller, too, is a DLL). - */ -#if (defined(__MINGW_H) && !defined(_STDLIB_H_)) || (defined(_MSC_VER) && !defined(_INC_STDLIB)) -int atexit (void (*)(void)); -#endif -#undef g_atexit -#define g_atexit(func) atexit(func) GLIB_DEPRECATED_MACRO_IN_2_32 -#endif - - -/* Look for an executable in PATH, following execvp() rules */ -GLIB_AVAILABLE_IN_ALL -gchar* g_find_program_in_path (const gchar *program); - -/* Bit tests - * - * These are defined in a convoluted way because we want the compiler to - * be able to inline the code for performance reasons, but for - * historical reasons, we must continue to provide non-inline versions - * on our ABI. - * - * We define these as functions in gutils.c which are just implemented - * as calls to the _impl() versions in order to preserve the ABI. - */ - -#undef g_bit_nth_lsf -#define g_bit_nth_lsf(mask, nth_bit) g_bit_nth_lsf_impl(mask, nth_bit) -#undef g_bit_nth_msf -#define g_bit_nth_msf(mask, nth_bit) g_bit_nth_msf_impl(mask, nth_bit) -#undef g_bit_storage -#define g_bit_storage(number) g_bit_storage_impl(number) - -GLIB_AVAILABLE_IN_ALL -gint (g_bit_nth_lsf) (gulong mask, - gint nth_bit); -GLIB_AVAILABLE_IN_ALL -gint (g_bit_nth_msf) (gulong mask, - gint nth_bit); -GLIB_AVAILABLE_IN_ALL -guint (g_bit_storage) (gulong number); - -static inline gint -g_bit_nth_lsf_impl (gulong mask, - gint nth_bit) -{ - if (G_UNLIKELY (nth_bit < -1)) - nth_bit = -1; - while (nth_bit < ((GLIB_SIZEOF_LONG * 8) - 1)) - { - nth_bit++; - if (mask & (1UL << nth_bit)) - return nth_bit; - } - return -1; -} - -static inline gint -g_bit_nth_msf_impl (gulong mask, - gint nth_bit) -{ - if (nth_bit < 0 || G_UNLIKELY (nth_bit > GLIB_SIZEOF_LONG * 8)) - nth_bit = GLIB_SIZEOF_LONG * 8; - while (nth_bit > 0) - { - nth_bit--; - if (mask & (1UL << nth_bit)) - return nth_bit; - } - return -1; -} - -static inline guint -g_bit_storage_impl (gulong number) -{ -#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__) - return G_LIKELY (number) ? - ((GLIB_SIZEOF_LONG * 8U - 1) ^ (guint) __builtin_clzl(number)) + 1 : 1; -#else - guint n_bits = 0; - - do - { - n_bits++; - number >>= 1; - } - while (number); - return n_bits; -#endif -} - -/* Crashes the program. */ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_50 -#ifndef G_OS_WIN32 -# include -# define g_abort() abort () -#else -GLIB_AVAILABLE_IN_2_50 -G_NORETURN void g_abort (void) G_ANALYZER_NORETURN; -#endif -#endif - -/* - * This macro is deprecated. This DllMain() is too complex. It is - * recommended to write an explicit minimal DLlMain() that just saves - * the handle to the DLL and then use that handle instead, for - * instance passing it to - * g_win32_get_package_installation_directory_of_module(). - * - * On Windows, this macro defines a DllMain function that stores the - * actual DLL name that the code being compiled will be included in. - * STATIC should be empty or 'static'. DLL_NAME is the name of the - * (pointer to the) char array where the DLL name will be stored. If - * this is used, you must also include . If you need a more complex - * DLL entry point function, you cannot use this. - * - * On non-Windows platforms, expands to nothing. - */ - -#ifndef G_PLATFORM_WIN32 -# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) GLIB_DEPRECATED_MACRO_IN_2_26 -#else -# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) \ -static char *dll_name; \ - \ -BOOL WINAPI \ -DllMain (HINSTANCE hinstDLL, \ - DWORD fdwReason, \ - LPVOID lpvReserved) \ -{ \ - wchar_t wcbfr[1000]; \ - char *tem; \ - switch (fdwReason) \ - { \ - case DLL_PROCESS_ATTACH: \ - GetModuleFileNameW ((HMODULE) hinstDLL, wcbfr, G_N_ELEMENTS (wcbfr)); \ - tem = g_utf16_to_utf8 (wcbfr, -1, NULL, NULL, NULL); \ - dll_name = g_path_get_basename (tem); \ - g_free (tem); \ - break; \ - } \ - \ - return TRUE; \ -} GLIB_DEPRECATED_MACRO_IN_2_26 -#endif /* G_PLATFORM_WIN32 */ - -G_END_DECLS - -#endif /* __G_UTILS_H__ */ - -G_BEGIN_DECLS - -#define G_THREAD_ERROR g_thread_error_quark () -GLIB_AVAILABLE_IN_ALL -GQuark g_thread_error_quark (void); - -typedef enum -{ - G_THREAD_ERROR_AGAIN /* Resource temporarily unavailable */ -} GThreadError; - -typedef gpointer (*GThreadFunc) (gpointer data); -typedef void (*GThreadGarbageHandler) (gpointer data); - -typedef struct _GThreadCallbacks GThreadCallbacks; -typedef struct _GThread GThread; - -typedef union _GMutex GMutex; -typedef struct _GRecMutex GRecMutex; -typedef struct _GRWLock GRWLock; -typedef struct _GCond GCond; -typedef struct _GPrivate GPrivate; -typedef struct _GOnce GOnce; - -typedef enum -{ - G_PRIVATE_DESTROY_LATE = 1 << 0, - G_PRIVATE_DESTROY_LAST = 1 << 1, -} GPrivateFlags; - -struct _GThreadCallbacks -{ - void (*on_thread_init) (void); - void (*on_thread_realize) (void); - void (*on_thread_dispose) (void); - void (*on_thread_finalize) (void); -}; - -union _GMutex -{ - /*< private >*/ - gpointer p; - guint i[2]; -}; - -struct _GRWLock -{ - /*< private >*/ - gpointer p; - guint i[2]; -}; - -struct _GCond -{ - /*< private >*/ - gpointer p; - guint i[2]; -}; - -struct _GRecMutex -{ - /*< private >*/ - gpointer p; - guint i[2]; -}; - -#define G_PRIVATE_INIT(notify) \ - { NULL, (notify), 0, { NULL } } -#define G_PRIVATE_INIT_WITH_FLAGS(notify, flags) \ - { NULL, (notify), (flags), { NULL } } -struct _GPrivate -{ - /*< private >*/ - gpointer p; - GDestroyNotify notify; - GPrivateFlags flags; - gpointer future[1]; -}; - -typedef enum -{ - G_ONCE_STATUS_NOTCALLED, - G_ONCE_STATUS_PROGRESS, - G_ONCE_STATUS_READY -} GOnceStatus; - -#define G_ONCE_INIT { G_ONCE_STATUS_NOTCALLED, NULL } -struct _GOnce -{ - volatile GOnceStatus status; - volatile gpointer retval; -}; - -#define G_LOCK_NAME(name) g__ ## name ## _lock -#define G_LOCK_DEFINE_STATIC(name) static G_LOCK_DEFINE (name) -#define G_LOCK_DEFINE(name) GMutex G_LOCK_NAME (name) -#define G_LOCK_EXTERN(name) extern GMutex G_LOCK_NAME (name) - -#ifdef G_DEBUG_LOCKS -# define G_LOCK(name) G_STMT_START{ \ - g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ - "file %s: line %d (%s): locking: %s ", \ - __FILE__, __LINE__, G_STRFUNC, \ - #name); \ - g_mutex_lock (&G_LOCK_NAME (name)); \ - }G_STMT_END -# define G_UNLOCK(name) G_STMT_START{ \ - g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ - "file %s: line %d (%s): unlocking: %s ", \ - __FILE__, __LINE__, G_STRFUNC, \ - #name); \ - g_mutex_unlock (&G_LOCK_NAME (name)); \ - }G_STMT_END -# define G_TRYLOCK(name) \ - (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ - "file %s: line %d (%s): try locking: %s ", \ - __FILE__, __LINE__, G_STRFUNC, \ - #name), g_mutex_trylock (&G_LOCK_NAME (name))) -#else /* !G_DEBUG_LOCKS */ -# define G_LOCK(name) g_mutex_lock (&G_LOCK_NAME (name)) -# define G_UNLOCK(name) g_mutex_unlock (&G_LOCK_NAME (name)) -# define G_TRYLOCK(name) g_mutex_trylock (&G_LOCK_NAME (name)) -#endif /* !G_DEBUG_LOCKS */ - -GLIB_VAR GThreadCallbacks *glib_thread_callbacks; -GLIB_AVAILABLE_IN_2_68 -void g_thread_set_callbacks (GThreadCallbacks *callbacks); -GLIB_AVAILABLE_IN_2_68 -void g_thread_set_garbage_handler (GThreadGarbageHandler handler, - gpointer user_data); -GLIB_AVAILABLE_IN_2_68 -gboolean g_thread_garbage_collect (void); - -GLIB_AVAILABLE_IN_2_32 -GThread * g_thread_ref (GThread *thread); -GLIB_AVAILABLE_IN_2_32 -void g_thread_unref (GThread *thread); -GLIB_AVAILABLE_IN_2_32 -GThread * g_thread_new (const gchar *name, - GThreadFunc func, - gpointer data); -GLIB_AVAILABLE_IN_2_32 -GThread * g_thread_try_new (const gchar *name, - GThreadFunc func, - gpointer data, - GError **error); -GLIB_AVAILABLE_IN_ALL -GThread * g_thread_self (void); -GLIB_AVAILABLE_IN_ALL -void g_thread_exit (gpointer retval); -GLIB_AVAILABLE_IN_ALL -gpointer g_thread_join (GThread *thread); -GLIB_AVAILABLE_IN_ALL -void g_thread_yield (void); - - -GLIB_AVAILABLE_IN_2_32 -void g_mutex_init (GMutex *mutex); -GLIB_AVAILABLE_IN_2_32 -void g_mutex_clear (GMutex *mutex); -GLIB_AVAILABLE_IN_ALL -void g_mutex_lock (GMutex *mutex); -GLIB_AVAILABLE_IN_ALL -gboolean g_mutex_trylock (GMutex *mutex); -GLIB_AVAILABLE_IN_ALL -void g_mutex_unlock (GMutex *mutex); - -GLIB_AVAILABLE_IN_2_32 -void g_rw_lock_init (GRWLock *rw_lock); -GLIB_AVAILABLE_IN_2_32 -void g_rw_lock_clear (GRWLock *rw_lock); -GLIB_AVAILABLE_IN_2_32 -void g_rw_lock_writer_lock (GRWLock *rw_lock); -GLIB_AVAILABLE_IN_2_32 -gboolean g_rw_lock_writer_trylock (GRWLock *rw_lock); -GLIB_AVAILABLE_IN_2_32 -void g_rw_lock_writer_unlock (GRWLock *rw_lock); -GLIB_AVAILABLE_IN_2_32 -void g_rw_lock_reader_lock (GRWLock *rw_lock); -GLIB_AVAILABLE_IN_2_32 -gboolean g_rw_lock_reader_trylock (GRWLock *rw_lock); -GLIB_AVAILABLE_IN_2_32 -void g_rw_lock_reader_unlock (GRWLock *rw_lock); - -GLIB_AVAILABLE_IN_2_32 -void g_rec_mutex_init (GRecMutex *rec_mutex); -GLIB_AVAILABLE_IN_2_32 -void g_rec_mutex_clear (GRecMutex *rec_mutex); -GLIB_AVAILABLE_IN_2_32 -void g_rec_mutex_lock (GRecMutex *rec_mutex); -GLIB_AVAILABLE_IN_2_32 -gboolean g_rec_mutex_trylock (GRecMutex *rec_mutex); -GLIB_AVAILABLE_IN_2_32 -void g_rec_mutex_unlock (GRecMutex *rec_mutex); - -GLIB_AVAILABLE_IN_2_32 -void g_cond_init (GCond *cond); -GLIB_AVAILABLE_IN_2_32 -void g_cond_clear (GCond *cond); -GLIB_AVAILABLE_IN_ALL -void g_cond_wait (GCond *cond, - GMutex *mutex); -GLIB_AVAILABLE_IN_ALL -void g_cond_signal (GCond *cond); -GLIB_AVAILABLE_IN_ALL -void g_cond_broadcast (GCond *cond); -GLIB_AVAILABLE_IN_2_32 -gboolean g_cond_wait_until (GCond *cond, - GMutex *mutex, - gint64 end_time); - -GLIB_AVAILABLE_IN_ALL -gpointer g_private_get (GPrivate *key); -GLIB_AVAILABLE_IN_ALL -void g_private_set (GPrivate *key, - gpointer value); -GLIB_AVAILABLE_IN_2_32 -void g_private_replace (GPrivate *key, - gpointer value); - -GLIB_AVAILABLE_IN_ALL -gpointer g_once_impl (GOnce *once, - GThreadFunc func, - gpointer arg); -GLIB_AVAILABLE_IN_ALL -gboolean g_once_init_enter (volatile void *location); -GLIB_AVAILABLE_IN_ALL -void g_once_init_leave (volatile void *location, - gsize result); - -/* Use C11-style atomic extensions to check the fast path for status=ready. If - * they are not available, fall back to using a mutex and condition variable in - * g_once_impl(). - * - * On the C11-style codepath, only the load of once->status needs to be atomic, - * as the writes to it and once->retval in g_once_impl() are related by a - * happens-before relation. Release-acquire semantics are defined such that any - * atomic/non-atomic write which happens-before a store/release is guaranteed to - * be seen by the load/acquire of the same atomic variable. */ -#if defined(G_ATOMIC_LOCK_FREE) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) && defined(__ATOMIC_SEQ_CST) -# define g_once(once, func, arg) \ - ((__atomic_load_n (&(once)->status, __ATOMIC_ACQUIRE) == G_ONCE_STATUS_READY) ? \ - (once)->retval : \ - g_once_impl ((once), (func), (arg))) -#else -# define g_once(once, func, arg) g_once_impl ((once), (func), (arg)) -#endif - -#ifdef __GNUC__ -#undef g_once_init_enter -# define g_once_init_enter(location) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(location) == sizeof (gpointer)); \ - (void) (0 ? (gpointer) *(location) : NULL); \ - (!g_atomic_pointer_get (location) && \ - _frida_g_once_init_enter (location)); \ - })) -#undef g_once_init_leave -# define g_once_init_leave(location, result) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(location) == sizeof (gpointer)); \ - 0 ? (void) (*(location) = (result)) : (void) 0; \ - _frida_g_once_init_leave ((location), (gsize) (result)); \ - })) -#else -#undef g_once_init_enter -# define g_once_init_enter(location) \ - (_frida_g_once_init_enter((location))) -#undef g_once_init_leave -# define g_once_init_leave(location, result) \ - (_frida_g_once_init_leave((location), (gsize) (result))) -#endif - -GLIB_AVAILABLE_IN_2_36 -guint g_get_num_processors (void); - -/** - * GMutexLocker: - * - * Opaque type. See g_mutex_locker_new() for details. - * Since: 2.44 - */ -typedef void GMutexLocker; - -/** - * g_mutex_locker_new: - * @mutex: a mutex to lock - * - * Lock @mutex and return a new #GMutexLocker. Unlock with - * g_mutex_locker_free(). Using g_mutex_unlock() on @mutex - * while a #GMutexLocker exists can lead to undefined behaviour. - * - * No allocation is performed, it is equivalent to a g_mutex_lock() call. - * - * This is intended to be used with g_autoptr(). Note that g_autoptr() - * is only available when using GCC or clang, so the following example - * will only work with those compilers: - * |[ - * typedef struct - * { - * ... - * GMutex mutex; - * ... - * } MyObject; - * - * static void - * my_object_do_stuff (MyObject *self) - * { - * g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&self->mutex); - * - * // Code with mutex locked here - * - * if (cond) - * // No need to unlock - * return; - * - * // Optionally early unlock - * g_clear_pointer (&locker, g_mutex_locker_free); - * - * // Code with mutex unlocked here - * } - * ]| - * - * Returns: a #GMutexLocker - * Since: 2.44 - */ -GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 -static inline GMutexLocker * -g_mutex_locker_new (GMutex *mutex) -{ - g_mutex_lock (mutex); - return (GMutexLocker *) mutex; -} - -/** - * g_mutex_locker_free: - * @locker: a GMutexLocker - * - * Unlock @locker's mutex. See g_mutex_locker_new() for details. - * - * No memory is freed, it is equivalent to a g_mutex_unlock() call. - * - * Since: 2.44 - */ -GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 -static inline void -g_mutex_locker_free (GMutexLocker *locker) -{ - g_mutex_unlock ((GMutex *) locker); -} - -/** - * GRecMutexLocker: - * - * Opaque type. See g_rec_mutex_locker_new() for details. - * Since: 2.60 - */ -typedef void GRecMutexLocker; - -/** - * g_rec_mutex_locker_new: - * @rec_mutex: a recursive mutex to lock - * - * Lock @rec_mutex and return a new #GRecMutexLocker. Unlock with - * g_rec_mutex_locker_free(). Using g_rec_mutex_unlock() on @rec_mutex - * while a #GRecMutexLocker exists can lead to undefined behaviour. - * - * No allocation is performed, it is equivalent to a g_rec_mutex_lock() call. - * - * This is intended to be used with g_autoptr(). Note that g_autoptr() - * is only available when using GCC or clang, so the following example - * will only work with those compilers: - * |[ - * typedef struct - * { - * ... - * GRecMutex rec_mutex; - * ... - * } MyObject; - * - * static void - * my_object_do_stuff (MyObject *self) - * { - * g_autoptr(GRecMutexLocker) locker = g_rec_mutex_locker_new (&self->rec_mutex); - * - * // Code with rec_mutex locked here - * - * if (cond) - * // No need to unlock - * return; - * - * // Optionally early unlock - * g_clear_pointer (&locker, g_rec_mutex_locker_free); - * - * // Code with rec_mutex unlocked here - * } - * ]| - * - * Returns: a #GRecMutexLocker - * Since: 2.60 - */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_AVAILABLE_STATIC_INLINE_IN_2_60 -static inline GRecMutexLocker * -g_rec_mutex_locker_new (GRecMutex *rec_mutex) -{ - g_rec_mutex_lock (rec_mutex); - return (GRecMutexLocker *) rec_mutex; -} -G_GNUC_END_IGNORE_DEPRECATIONS - -/** - * g_rec_mutex_locker_free: - * @locker: a GRecMutexLocker - * - * Unlock @locker's recursive mutex. See g_rec_mutex_locker_new() for details. - * - * No memory is freed, it is equivalent to a g_rec_mutex_unlock() call. - * - * Since: 2.60 - */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_AVAILABLE_STATIC_INLINE_IN_2_60 -static inline void -g_rec_mutex_locker_free (GRecMutexLocker *locker) -{ - g_rec_mutex_unlock ((GRecMutex *) locker); -} -G_GNUC_END_IGNORE_DEPRECATIONS - -/** - * GRWLockWriterLocker: - * - * Opaque type. See g_rw_lock_writer_locker_new() for details. - * Since: 2.62 - */ -typedef void GRWLockWriterLocker; - -/** - * g_rw_lock_writer_locker_new: - * @rw_lock: a #GRWLock - * - * Obtain a write lock on @rw_lock and return a new #GRWLockWriterLocker. - * Unlock with g_rw_lock_writer_locker_free(). Using g_rw_lock_writer_unlock() - * on @rw_lock while a #GRWLockWriterLocker exists can lead to undefined - * behaviour. - * - * No allocation is performed, it is equivalent to a g_rw_lock_writer_lock() call. - * - * This is intended to be used with g_autoptr(). Note that g_autoptr() - * is only available when using GCC or clang, so the following example - * will only work with those compilers: - * |[ - * typedef struct - * { - * ... - * GRWLock rw_lock; - * GPtrArray *array; - * ... - * } MyObject; - * - * static gchar * - * my_object_get_data (MyObject *self, guint index) - * { - * g_autoptr(GRWLockReaderLocker) locker = g_rw_lock_reader_locker_new (&self->rw_lock); - * - * // Code with a read lock obtained on rw_lock here - * - * if (self->array == NULL) - * // No need to unlock - * return NULL; - * - * if (index < self->array->len) - * // No need to unlock - * return g_ptr_array_index (self->array, index); - * - * // Optionally early unlock - * g_clear_pointer (&locker, g_rw_lock_reader_locker_free); - * - * // Code with rw_lock unlocked here - * return NULL; - * } - * - * static void - * my_object_set_data (MyObject *self, guint index, gpointer data) - * { - * g_autoptr(GRWLockWriterLocker) locker = g_rw_lock_writer_locker_new (&self->rw_lock); - * - * // Code with a write lock obtained on rw_lock here - * - * if (self->array == NULL) - * self->array = g_ptr_array_new (); - * - * if (cond) - * // No need to unlock - * return; - * - * if (index >= self->array->len) - * g_ptr_array_set_size (self->array, index+1); - * g_ptr_array_index (self->array, index) = data; - * - * // Optionally early unlock - * g_clear_pointer (&locker, g_rw_lock_writer_locker_free); - * - * // Code with rw_lock unlocked here - * } - * ]| - * - * Returns: a #GRWLockWriterLocker - * Since: 2.62 - */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 -static inline GRWLockWriterLocker * -g_rw_lock_writer_locker_new (GRWLock *rw_lock) -{ - g_rw_lock_writer_lock (rw_lock); - return (GRWLockWriterLocker *) rw_lock; -} -G_GNUC_END_IGNORE_DEPRECATIONS - -/** - * g_rw_lock_writer_locker_free: - * @locker: a GRWLockWriterLocker - * - * Release a write lock on @locker's read-write lock. See - * g_rw_lock_writer_locker_new() for details. - * - * No memory is freed, it is equivalent to a g_rw_lock_writer_unlock() call. - * - * Since: 2.62 - */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 -static inline void -g_rw_lock_writer_locker_free (GRWLockWriterLocker *locker) -{ - g_rw_lock_writer_unlock ((GRWLock *) locker); -} -G_GNUC_END_IGNORE_DEPRECATIONS - -/** - * GRWLockReaderLocker: - * - * Opaque type. See g_rw_lock_reader_locker_new() for details. - * Since: 2.62 - */ -typedef void GRWLockReaderLocker; - -/** - * g_rw_lock_reader_locker_new: - * @rw_lock: a #GRWLock - * - * Obtain a read lock on @rw_lock and return a new #GRWLockReaderLocker. - * Unlock with g_rw_lock_reader_locker_free(). Using g_rw_lock_reader_unlock() - * on @rw_lock while a #GRWLockReaderLocker exists can lead to undefined - * behaviour. - * - * No allocation is performed, it is equivalent to a g_rw_lock_reader_lock() call. - * - * This is intended to be used with g_autoptr(). For a code sample, see - * g_rw_lock_writer_locker_new(). - * - * Returns: a #GRWLockReaderLocker - * Since: 2.62 - */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 -static inline GRWLockReaderLocker * -g_rw_lock_reader_locker_new (GRWLock *rw_lock) -{ - g_rw_lock_reader_lock (rw_lock); - return (GRWLockReaderLocker *) rw_lock; -} -G_GNUC_END_IGNORE_DEPRECATIONS - -/** - * g_rw_lock_reader_locker_free: - * @locker: a GRWLockReaderLocker - * - * Release a read lock on @locker's read-write lock. See - * g_rw_lock_reader_locker_new() for details. - * - * No memory is freed, it is equivalent to a g_rw_lock_reader_unlock() call. - * - * Since: 2.62 - */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_AVAILABLE_STATIC_INLINE_IN_2_62 -static inline void -g_rw_lock_reader_locker_free (GRWLockReaderLocker *locker) -{ - g_rw_lock_reader_unlock ((GRWLock *) locker); -} -G_GNUC_END_IGNORE_DEPRECATIONS - -G_END_DECLS - -#endif /* __G_THREAD_H__ */ - -G_BEGIN_DECLS - -typedef struct _GAsyncQueue GAsyncQueue; - -GLIB_AVAILABLE_IN_ALL -GAsyncQueue *g_async_queue_new (void); -GLIB_AVAILABLE_IN_ALL -GAsyncQueue *g_async_queue_new_full (GDestroyNotify item_free_func); -GLIB_AVAILABLE_IN_ALL -void g_async_queue_lock (GAsyncQueue *queue); -GLIB_AVAILABLE_IN_ALL -void g_async_queue_unlock (GAsyncQueue *queue); -GLIB_AVAILABLE_IN_ALL -GAsyncQueue *g_async_queue_ref (GAsyncQueue *queue); -GLIB_AVAILABLE_IN_ALL -void g_async_queue_unref (GAsyncQueue *queue); - -GLIB_DEPRECATED_FOR(g_async_queue_ref) -void g_async_queue_ref_unlocked (GAsyncQueue *queue); - -GLIB_DEPRECATED_FOR(g_async_queue_unref) -void g_async_queue_unref_and_unlock (GAsyncQueue *queue); - -GLIB_AVAILABLE_IN_ALL -void g_async_queue_push (GAsyncQueue *queue, - gpointer data); -GLIB_AVAILABLE_IN_ALL -void g_async_queue_push_unlocked (GAsyncQueue *queue, - gpointer data); -GLIB_AVAILABLE_IN_ALL -void g_async_queue_push_sorted (GAsyncQueue *queue, - gpointer data, - GCompareDataFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -void g_async_queue_push_sorted_unlocked (GAsyncQueue *queue, - gpointer data, - GCompareDataFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -gpointer g_async_queue_pop (GAsyncQueue *queue); -GLIB_AVAILABLE_IN_ALL -gpointer g_async_queue_pop_unlocked (GAsyncQueue *queue); -GLIB_AVAILABLE_IN_ALL -gpointer g_async_queue_try_pop (GAsyncQueue *queue); -GLIB_AVAILABLE_IN_ALL -gpointer g_async_queue_try_pop_unlocked (GAsyncQueue *queue); -GLIB_AVAILABLE_IN_ALL -gpointer g_async_queue_timeout_pop (GAsyncQueue *queue, - guint64 timeout); -GLIB_AVAILABLE_IN_ALL -gpointer g_async_queue_timeout_pop_unlocked (GAsyncQueue *queue, - guint64 timeout); -GLIB_AVAILABLE_IN_ALL -gint g_async_queue_length (GAsyncQueue *queue); -GLIB_AVAILABLE_IN_ALL -gint g_async_queue_length_unlocked (GAsyncQueue *queue); -GLIB_AVAILABLE_IN_ALL -void g_async_queue_sort (GAsyncQueue *queue, - GCompareDataFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -void g_async_queue_sort_unlocked (GAsyncQueue *queue, - GCompareDataFunc func, - gpointer user_data); - -GLIB_AVAILABLE_IN_2_46 -gboolean g_async_queue_remove (GAsyncQueue *queue, - gpointer item); -GLIB_AVAILABLE_IN_2_46 -gboolean g_async_queue_remove_unlocked (GAsyncQueue *queue, - gpointer item); -GLIB_AVAILABLE_IN_2_46 -void g_async_queue_push_front (GAsyncQueue *queue, - gpointer item); -GLIB_AVAILABLE_IN_2_46 -void g_async_queue_push_front_unlocked (GAsyncQueue *queue, - gpointer item); - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_DEPRECATED_FOR(g_async_queue_timeout_pop) -gpointer g_async_queue_timed_pop (GAsyncQueue *queue, - GTimeVal *end_time); -GLIB_DEPRECATED_FOR(g_async_queue_timeout_pop_unlocked) -gpointer g_async_queue_timed_pop_unlocked (GAsyncQueue *queue, - GTimeVal *end_time); -G_GNUC_END_IGNORE_DEPRECATIONS - -G_END_DECLS - -#endif /* __G_ASYNCQUEUE_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_BACKTRACE_H__ -#define __G_BACKTRACE_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -#ifdef __sun__ -#include -#endif -#include - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_ALL -void g_on_error_query (const gchar *prg_name); -GLIB_AVAILABLE_IN_ALL -void g_on_error_stack_trace (const gchar *prg_name); - -/** - * G_BREAKPOINT: - * - * Inserts a breakpoint instruction into the code. - * - * On architectures which support it, this is implemented as a soft interrupt - * and on other architectures it raises a `SIGTRAP` signal. - * - * `SIGTRAP` is used rather than abort() to allow breakpoints to be skipped past - * in a debugger if they are not the desired target of debugging. - */ -#if (defined (__i386__) || defined (__x86_64__)) && defined (__GNUC__) && __GNUC__ >= 2 -# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("int $03"); }G_STMT_END -#elif (defined (_MSC_VER) || defined (__DMC__)) && defined (_M_IX86) -# define G_BREAKPOINT() G_STMT_START{ __asm int 3h }G_STMT_END -#elif defined (_MSC_VER) -# define G_BREAKPOINT() G_STMT_START{ __debugbreak(); }G_STMT_END -#elif defined (__alpha__) && !defined(__osf__) && defined (__GNUC__) && __GNUC__ >= 2 -# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("bpt"); }G_STMT_END -#elif defined (__APPLE__) || (defined(_WIN32) && (defined(__clang__) || defined(__GNUC__))) -# define G_BREAKPOINT() G_STMT_START{ __builtin_trap(); }G_STMT_END -#else /* !__i386__ && !__alpha__ */ -# define G_BREAKPOINT() G_STMT_START{ raise (SIGTRAP); }G_STMT_END -#endif /* __i386__ */ - -G_END_DECLS - -#endif /* __G_BACKTRACE_H__ */ -/* gbase64.h - Base64 coding functions - * - * Copyright (C) 2005 Alexander Larsson - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_BASE64_H__ -#define __G_BASE64_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_ALL -gsize g_base64_encode_step (const guchar *in, - gsize len, - gboolean break_lines, - gchar *out, - gint *state, - gint *save); -GLIB_AVAILABLE_IN_ALL -gsize g_base64_encode_close (gboolean break_lines, - gchar *out, - gint *state, - gint *save); -GLIB_AVAILABLE_IN_ALL -gchar* g_base64_encode (const guchar *data, - gsize len) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gsize g_base64_decode_step (const gchar *in, - gsize len, - guchar *out, - gint *state, - guint *save); -GLIB_AVAILABLE_IN_ALL -guchar *g_base64_decode (const gchar *text, - gsize *out_len) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -guchar *g_base64_decode_inplace (gchar *text, - gsize *out_len); - - -G_END_DECLS - -#endif /* __G_BASE64_H__ */ -/* - * Copyright © 2008 Ryan Lortie - * Copyright © 2010 Codethink Limited - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - * - * Author: Ryan Lortie - */ - -#ifndef __G_BITLOCK_H__ -#define __G_BITLOCK_H__ - - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_ALL -void g_bit_lock (volatile gint *address, - gint lock_bit); -GLIB_AVAILABLE_IN_ALL -gboolean g_bit_trylock (volatile gint *address, - gint lock_bit); -GLIB_AVAILABLE_IN_ALL -void g_bit_unlock (volatile gint *address, - gint lock_bit); - -GLIB_AVAILABLE_IN_ALL -void g_pointer_bit_lock (volatile void *address, - gint lock_bit); -GLIB_AVAILABLE_IN_ALL -gboolean g_pointer_bit_trylock (volatile void *address, - gint lock_bit); -GLIB_AVAILABLE_IN_ALL -void g_pointer_bit_unlock (volatile void *address, - gint lock_bit); - -#ifdef __GNUC__ - -#undef g_pointer_bit_lock -#define g_pointer_bit_lock(address, lock_bit) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \ - _frida_g_pointer_bit_lock ((address), (lock_bit)); \ - })) - -#undef g_pointer_bit_trylock -#define g_pointer_bit_trylock(address, lock_bit) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \ - _frida_g_pointer_bit_trylock ((address), (lock_bit)); \ - })) - -#undef g_pointer_bit_unlock -#define g_pointer_bit_unlock(address, lock_bit) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \ - _frida_g_pointer_bit_unlock ((address), (lock_bit)); \ - })) - -#endif - -G_END_DECLS - -#endif /* __G_BITLOCK_H_ */ -/* gbookmarkfile.h: parsing and building desktop bookmarks - * - * Copyright (C) 2005-2006 Emmanuele Bassi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_BOOKMARK_FILE_H__ -#define __G_BOOKMARK_FILE_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -/* - * Copyright (C) 2009-2010 Christian Hergert - * Copyright © 2010 Codethink Limited - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of the - * licence, or (at your option) any later version. - * - * This is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - * - * Authors: Christian Hergert - * Thiago Santos - * Emmanuele Bassi - * Ryan Lortie - */ - -#ifndef __G_DATE_TIME_H__ -#define __G_DATE_TIME_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -/* - * Copyright © 2010 Codethink Limited - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - * - * Author: Ryan Lortie - */ - -#ifndef __G_TIME_ZONE_H__ -#define __G_TIME_ZONE_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GTimeZone GTimeZone; - -/** - * GTimeType: - * @G_TIME_TYPE_STANDARD: the time is in local standard time - * @G_TIME_TYPE_DAYLIGHT: the time is in local daylight time - * @G_TIME_TYPE_UNIVERSAL: the time is in UTC - * - * Disambiguates a given time in two ways. - * - * First, specifies if the given time is in universal or local time. - * - * Second, if the time is in local time, specifies if it is local - * standard time or local daylight time. This is important for the case - * where the same local time occurs twice (during daylight savings time - * transitions, for example). - */ -typedef enum -{ - G_TIME_TYPE_STANDARD, - G_TIME_TYPE_DAYLIGHT, - G_TIME_TYPE_UNIVERSAL -} GTimeType; - -GLIB_DEPRECATED_IN_2_68_FOR (g_time_zone_new_identifier) -GTimeZone * g_time_zone_new (const gchar *identifier); -GLIB_AVAILABLE_IN_2_68 -GTimeZone * g_time_zone_new_identifier (const gchar *identifier); -GLIB_AVAILABLE_IN_ALL -GTimeZone * g_time_zone_new_utc (void); -GLIB_AVAILABLE_IN_ALL -GTimeZone * g_time_zone_new_local (void); -GLIB_AVAILABLE_IN_2_58 -GTimeZone * g_time_zone_new_offset (gint32 seconds); - -GLIB_AVAILABLE_IN_ALL -GTimeZone * g_time_zone_ref (GTimeZone *tz); -GLIB_AVAILABLE_IN_ALL -void g_time_zone_unref (GTimeZone *tz); - -GLIB_AVAILABLE_IN_ALL -gint g_time_zone_find_interval (GTimeZone *tz, - GTimeType type, - gint64 time_); - -GLIB_AVAILABLE_IN_ALL -gint g_time_zone_adjust_time (GTimeZone *tz, - GTimeType type, - gint64 *time_); - -GLIB_AVAILABLE_IN_ALL -const gchar * g_time_zone_get_abbreviation (GTimeZone *tz, - gint interval); -GLIB_AVAILABLE_IN_ALL -gint32 g_time_zone_get_offset (GTimeZone *tz, - gint interval); -GLIB_AVAILABLE_IN_ALL -gboolean g_time_zone_is_dst (GTimeZone *tz, - gint interval); -GLIB_AVAILABLE_IN_2_58 -const gchar * g_time_zone_get_identifier (GTimeZone *tz); - -G_END_DECLS - -#endif /* __G_TIME_ZONE_H__ */ - -G_BEGIN_DECLS - -/** - * G_TIME_SPAN_DAY: - * - * Evaluates to a time span of one day. - * - * Since: 2.26 - */ -#define G_TIME_SPAN_DAY (G_GINT64_CONSTANT (86400000000)) - -/** - * G_TIME_SPAN_HOUR: - * - * Evaluates to a time span of one hour. - * - * Since: 2.26 - */ -#define G_TIME_SPAN_HOUR (G_GINT64_CONSTANT (3600000000)) - -/** - * G_TIME_SPAN_MINUTE: - * - * Evaluates to a time span of one minute. - * - * Since: 2.26 - */ -#define G_TIME_SPAN_MINUTE (G_GINT64_CONSTANT (60000000)) - -/** - * G_TIME_SPAN_SECOND: - * - * Evaluates to a time span of one second. - * - * Since: 2.26 - */ -#define G_TIME_SPAN_SECOND (G_GINT64_CONSTANT (1000000)) - -/** - * G_TIME_SPAN_MILLISECOND: - * - * Evaluates to a time span of one millisecond. - * - * Since: 2.26 - */ -#define G_TIME_SPAN_MILLISECOND (G_GINT64_CONSTANT (1000)) - -/** - * GTimeSpan: - * - * A value representing an interval of time, in microseconds. - * - * Since: 2.26 - */ -typedef gint64 GTimeSpan; - -/** - * GDateTime: - * - * `GDateTime` is an opaque structure whose members - * cannot be accessed directly. - * - * Since: 2.26 - */ -typedef struct _GDateTime GDateTime; - -GLIB_AVAILABLE_IN_ALL -void g_date_time_unref (GDateTime *datetime); -GLIB_AVAILABLE_IN_ALL -GDateTime * g_date_time_ref (GDateTime *datetime); - -GLIB_AVAILABLE_IN_ALL -GDateTime * g_date_time_new_now (GTimeZone *tz); -GLIB_AVAILABLE_IN_ALL -GDateTime * g_date_time_new_now_local (void); -GLIB_AVAILABLE_IN_ALL -GDateTime * g_date_time_new_now_utc (void); - -GLIB_AVAILABLE_IN_ALL -GDateTime * g_date_time_new_from_unix_local (gint64 t); -GLIB_AVAILABLE_IN_ALL -GDateTime * g_date_time_new_from_unix_utc (gint64 t); - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_new_from_unix_local) -GDateTime * g_date_time_new_from_timeval_local (const GTimeVal *tv); -GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_new_from_unix_utc) -GDateTime * g_date_time_new_from_timeval_utc (const GTimeVal *tv); -G_GNUC_END_IGNORE_DEPRECATIONS - -GLIB_AVAILABLE_IN_2_56 -GDateTime * g_date_time_new_from_iso8601 (const gchar *text, - GTimeZone *default_tz); - -GLIB_AVAILABLE_IN_ALL -GDateTime * g_date_time_new (GTimeZone *tz, - gint year, - gint month, - gint day, - gint hour, - gint minute, - gdouble seconds); -GLIB_AVAILABLE_IN_ALL -GDateTime * g_date_time_new_local (gint year, - gint month, - gint day, - gint hour, - gint minute, - gdouble seconds); -GLIB_AVAILABLE_IN_ALL -GDateTime * g_date_time_new_utc (gint year, - gint month, - gint day, - gint hour, - gint minute, - gdouble seconds); - -GLIB_AVAILABLE_IN_ALL -G_GNUC_WARN_UNUSED_RESULT -GDateTime * g_date_time_add (GDateTime *datetime, - GTimeSpan timespan); - -GLIB_AVAILABLE_IN_ALL -G_GNUC_WARN_UNUSED_RESULT -GDateTime * g_date_time_add_years (GDateTime *datetime, - gint years); -GLIB_AVAILABLE_IN_ALL -G_GNUC_WARN_UNUSED_RESULT -GDateTime * g_date_time_add_months (GDateTime *datetime, - gint months); -GLIB_AVAILABLE_IN_ALL -G_GNUC_WARN_UNUSED_RESULT -GDateTime * g_date_time_add_weeks (GDateTime *datetime, - gint weeks); -GLIB_AVAILABLE_IN_ALL -G_GNUC_WARN_UNUSED_RESULT -GDateTime * g_date_time_add_days (GDateTime *datetime, - gint days); - -GLIB_AVAILABLE_IN_ALL -G_GNUC_WARN_UNUSED_RESULT -GDateTime * g_date_time_add_hours (GDateTime *datetime, - gint hours); -GLIB_AVAILABLE_IN_ALL -G_GNUC_WARN_UNUSED_RESULT -GDateTime * g_date_time_add_minutes (GDateTime *datetime, - gint minutes); -GLIB_AVAILABLE_IN_ALL -G_GNUC_WARN_UNUSED_RESULT -GDateTime * g_date_time_add_seconds (GDateTime *datetime, - gdouble seconds); - -GLIB_AVAILABLE_IN_ALL -G_GNUC_WARN_UNUSED_RESULT -GDateTime * g_date_time_add_full (GDateTime *datetime, - gint years, - gint months, - gint days, - gint hours, - gint minutes, - gdouble seconds); - -GLIB_AVAILABLE_IN_ALL -gint g_date_time_compare (gconstpointer dt1, - gconstpointer dt2); -GLIB_AVAILABLE_IN_ALL -GTimeSpan g_date_time_difference (GDateTime *end, - GDateTime *begin); -GLIB_AVAILABLE_IN_ALL -guint g_date_time_hash (gconstpointer datetime); -GLIB_AVAILABLE_IN_ALL -gboolean g_date_time_equal (gconstpointer dt1, - gconstpointer dt2); - -GLIB_AVAILABLE_IN_ALL -void g_date_time_get_ymd (GDateTime *datetime, - gint *year, - gint *month, - gint *day); - -GLIB_AVAILABLE_IN_ALL -gint g_date_time_get_year (GDateTime *datetime); -GLIB_AVAILABLE_IN_ALL -gint g_date_time_get_month (GDateTime *datetime); -GLIB_AVAILABLE_IN_ALL -gint g_date_time_get_day_of_month (GDateTime *datetime); - -GLIB_AVAILABLE_IN_ALL -gint g_date_time_get_week_numbering_year (GDateTime *datetime); -GLIB_AVAILABLE_IN_ALL -gint g_date_time_get_week_of_year (GDateTime *datetime); -GLIB_AVAILABLE_IN_ALL -gint g_date_time_get_day_of_week (GDateTime *datetime); - -GLIB_AVAILABLE_IN_ALL -gint g_date_time_get_day_of_year (GDateTime *datetime); - -GLIB_AVAILABLE_IN_ALL -gint g_date_time_get_hour (GDateTime *datetime); -GLIB_AVAILABLE_IN_ALL -gint g_date_time_get_minute (GDateTime *datetime); -GLIB_AVAILABLE_IN_ALL -gint g_date_time_get_second (GDateTime *datetime); -GLIB_AVAILABLE_IN_ALL -gint g_date_time_get_microsecond (GDateTime *datetime); -GLIB_AVAILABLE_IN_ALL -gdouble g_date_time_get_seconds (GDateTime *datetime); - -GLIB_AVAILABLE_IN_ALL -gint64 g_date_time_to_unix (GDateTime *datetime); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_to_unix) -gboolean g_date_time_to_timeval (GDateTime *datetime, - GTimeVal *tv); -G_GNUC_END_IGNORE_DEPRECATIONS - -GLIB_AVAILABLE_IN_ALL -GTimeSpan g_date_time_get_utc_offset (GDateTime *datetime); -GLIB_AVAILABLE_IN_2_58 -GTimeZone * g_date_time_get_timezone (GDateTime *datetime); -GLIB_AVAILABLE_IN_ALL -const gchar * g_date_time_get_timezone_abbreviation (GDateTime *datetime); -GLIB_AVAILABLE_IN_ALL -gboolean g_date_time_is_daylight_savings (GDateTime *datetime); - -GLIB_AVAILABLE_IN_ALL -GDateTime * g_date_time_to_timezone (GDateTime *datetime, - GTimeZone *tz); -GLIB_AVAILABLE_IN_ALL -GDateTime * g_date_time_to_local (GDateTime *datetime); -GLIB_AVAILABLE_IN_ALL -GDateTime * g_date_time_to_utc (GDateTime *datetime); - -GLIB_AVAILABLE_IN_ALL -gchar * g_date_time_format (GDateTime *datetime, - const gchar *format) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_2_62 -gchar * g_date_time_format_iso8601 (GDateTime *datetime) G_GNUC_MALLOC; - -G_END_DECLS - -#endif /* __G_DATE_TIME_H__ */ -#include - -G_BEGIN_DECLS - -/** - * G_BOOKMARK_FILE_ERROR: - * - * Error domain for bookmark file parsing. - * Errors in this domain will be from the #GBookmarkFileError - * enumeration. See #GError for information on error domains. - */ -#define G_BOOKMARK_FILE_ERROR (g_bookmark_file_error_quark ()) - - -/** - * GBookmarkFileError: - * @G_BOOKMARK_FILE_ERROR_INVALID_URI: URI was ill-formed - * @G_BOOKMARK_FILE_ERROR_INVALID_VALUE: a requested field was not found - * @G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED: a requested application did - * not register a bookmark - * @G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND: a requested URI was not found - * @G_BOOKMARK_FILE_ERROR_READ: document was ill formed - * @G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING: the text being parsed was - * in an unknown encoding - * @G_BOOKMARK_FILE_ERROR_WRITE: an error occurred while writing - * @G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND: requested file was not found - * - * Error codes returned by bookmark file parsing. - */ -typedef enum -{ - G_BOOKMARK_FILE_ERROR_INVALID_URI, - G_BOOKMARK_FILE_ERROR_INVALID_VALUE, - G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED, - G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND, - G_BOOKMARK_FILE_ERROR_READ, - G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING, - G_BOOKMARK_FILE_ERROR_WRITE, - G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND -} GBookmarkFileError; - -GLIB_AVAILABLE_IN_ALL -GQuark g_bookmark_file_error_quark (void); - -/** - * GBookmarkFile: - * - * The `GBookmarkFile` structure contains only - * private data and should not be directly accessed. - */ -typedef struct _GBookmarkFile GBookmarkFile; - -GLIB_AVAILABLE_IN_ALL -GBookmarkFile *g_bookmark_file_new (void); -GLIB_AVAILABLE_IN_ALL -void g_bookmark_file_free (GBookmarkFile *bookmark); - -GLIB_AVAILABLE_IN_ALL -gboolean g_bookmark_file_load_from_file (GBookmarkFile *bookmark, - const gchar *filename, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_bookmark_file_load_from_data (GBookmarkFile *bookmark, - const gchar *data, - gsize length, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_bookmark_file_load_from_data_dirs (GBookmarkFile *bookmark, - const gchar *file, - gchar **full_path, - GError **error); -GLIB_AVAILABLE_IN_ALL -gchar * g_bookmark_file_to_data (GBookmarkFile *bookmark, - gsize *length, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gboolean g_bookmark_file_to_file (GBookmarkFile *bookmark, - const gchar *filename, - GError **error); - -GLIB_AVAILABLE_IN_ALL -void g_bookmark_file_set_title (GBookmarkFile *bookmark, - const gchar *uri, - const gchar *title); -GLIB_AVAILABLE_IN_ALL -gchar * g_bookmark_file_get_title (GBookmarkFile *bookmark, - const gchar *uri, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -void g_bookmark_file_set_description (GBookmarkFile *bookmark, - const gchar *uri, - const gchar *description); -GLIB_AVAILABLE_IN_ALL -gchar * g_bookmark_file_get_description (GBookmarkFile *bookmark, - const gchar *uri, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -void g_bookmark_file_set_mime_type (GBookmarkFile *bookmark, - const gchar *uri, - const gchar *mime_type); -GLIB_AVAILABLE_IN_ALL -gchar * g_bookmark_file_get_mime_type (GBookmarkFile *bookmark, - const gchar *uri, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -void g_bookmark_file_set_groups (GBookmarkFile *bookmark, - const gchar *uri, - const gchar **groups, - gsize length); -GLIB_AVAILABLE_IN_ALL -void g_bookmark_file_add_group (GBookmarkFile *bookmark, - const gchar *uri, - const gchar *group); -GLIB_AVAILABLE_IN_ALL -gboolean g_bookmark_file_has_group (GBookmarkFile *bookmark, - const gchar *uri, - const gchar *group, - GError **error); -GLIB_AVAILABLE_IN_ALL -gchar ** g_bookmark_file_get_groups (GBookmarkFile *bookmark, - const gchar *uri, - gsize *length, - GError **error); -GLIB_AVAILABLE_IN_ALL -void g_bookmark_file_add_application (GBookmarkFile *bookmark, - const gchar *uri, - const gchar *name, - const gchar *exec); -GLIB_AVAILABLE_IN_ALL -gboolean g_bookmark_file_has_application (GBookmarkFile *bookmark, - const gchar *uri, - const gchar *name, - GError **error); -GLIB_AVAILABLE_IN_ALL -gchar ** g_bookmark_file_get_applications (GBookmarkFile *bookmark, - const gchar *uri, - gsize *length, - GError **error); -GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_application_info) -gboolean g_bookmark_file_set_app_info (GBookmarkFile *bookmark, - const gchar *uri, - const gchar *name, - const gchar *exec, - gint count, - time_t stamp, - GError **error); -GLIB_AVAILABLE_IN_2_66 -gboolean g_bookmark_file_set_application_info (GBookmarkFile *bookmark, - const char *uri, - const char *name, - const char *exec, - int count, - GDateTime *stamp, - GError **error); -GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_application_info) -gboolean g_bookmark_file_get_app_info (GBookmarkFile *bookmark, - const gchar *uri, - const gchar *name, - gchar **exec, - guint *count, - time_t *stamp, - GError **error); -GLIB_AVAILABLE_IN_2_66 -gboolean g_bookmark_file_get_application_info (GBookmarkFile *bookmark, - const char *uri, - const char *name, - char **exec, - unsigned int *count, - GDateTime **stamp, - GError **error); -GLIB_AVAILABLE_IN_ALL -void g_bookmark_file_set_is_private (GBookmarkFile *bookmark, - const gchar *uri, - gboolean is_private); -GLIB_AVAILABLE_IN_ALL -gboolean g_bookmark_file_get_is_private (GBookmarkFile *bookmark, - const gchar *uri, - GError **error); -GLIB_AVAILABLE_IN_ALL -void g_bookmark_file_set_icon (GBookmarkFile *bookmark, - const gchar *uri, - const gchar *href, - const gchar *mime_type); -GLIB_AVAILABLE_IN_ALL -gboolean g_bookmark_file_get_icon (GBookmarkFile *bookmark, - const gchar *uri, - gchar **href, - gchar **mime_type, - GError **error); -GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_added_date_time) -void g_bookmark_file_set_added (GBookmarkFile *bookmark, - const gchar *uri, - time_t added); -GLIB_AVAILABLE_IN_2_66 -void g_bookmark_file_set_added_date_time (GBookmarkFile *bookmark, - const char *uri, - GDateTime *added); -GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_added_date_time) -time_t g_bookmark_file_get_added (GBookmarkFile *bookmark, - const gchar *uri, - GError **error); -GLIB_AVAILABLE_IN_2_66 -GDateTime *g_bookmark_file_get_added_date_time (GBookmarkFile *bookmark, - const char *uri, - GError **error); -GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_modified_date_time) -void g_bookmark_file_set_modified (GBookmarkFile *bookmark, - const gchar *uri, - time_t modified); -GLIB_AVAILABLE_IN_2_66 -void g_bookmark_file_set_modified_date_time (GBookmarkFile *bookmark, - const char *uri, - GDateTime *modified); -GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_modified_date_time) -time_t g_bookmark_file_get_modified (GBookmarkFile *bookmark, - const gchar *uri, - GError **error); -GLIB_AVAILABLE_IN_2_66 -GDateTime *g_bookmark_file_get_modified_date_time (GBookmarkFile *bookmark, - const char *uri, - GError **error); -GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_set_visited_date_time) -void g_bookmark_file_set_visited (GBookmarkFile *bookmark, - const gchar *uri, - time_t visited); -GLIB_AVAILABLE_IN_2_66 -void g_bookmark_file_set_visited_date_time (GBookmarkFile *bookmark, - const char *uri, - GDateTime *visited); -GLIB_DEPRECATED_IN_2_66_FOR(g_bookmark_file_get_visited_date_time) -time_t g_bookmark_file_get_visited (GBookmarkFile *bookmark, - const gchar *uri, - GError **error); -GLIB_AVAILABLE_IN_2_66 -GDateTime *g_bookmark_file_get_visited_date_time (GBookmarkFile *bookmark, - const char *uri, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_bookmark_file_has_item (GBookmarkFile *bookmark, - const gchar *uri); -GLIB_AVAILABLE_IN_ALL -gint g_bookmark_file_get_size (GBookmarkFile *bookmark); -GLIB_AVAILABLE_IN_ALL -gchar ** g_bookmark_file_get_uris (GBookmarkFile *bookmark, - gsize *length); -GLIB_AVAILABLE_IN_ALL -gboolean g_bookmark_file_remove_group (GBookmarkFile *bookmark, - const gchar *uri, - const gchar *group, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_bookmark_file_remove_application (GBookmarkFile *bookmark, - const gchar *uri, - const gchar *name, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_bookmark_file_remove_item (GBookmarkFile *bookmark, - const gchar *uri, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_bookmark_file_move_item (GBookmarkFile *bookmark, - const gchar *old_uri, - const gchar *new_uri, - GError **error); - -G_END_DECLS - -#endif /* __G_BOOKMARK_FILE_H__ */ -/* - * Copyright © 2009, 2010 Codethink Limited - * Copyright © 2011 Collabora Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - * - * Author: Ryan Lortie - * Stef Walter - */ - -#ifndef __G_BYTES_H__ -#define __G_BYTES_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_ALL -GBytes * g_bytes_new (gconstpointer data, - gsize size); - -GLIB_AVAILABLE_IN_ALL -GBytes * g_bytes_new_take (gpointer data, - gsize size); - -GLIB_AVAILABLE_IN_ALL -GBytes * g_bytes_new_static (gconstpointer data, - gsize size); - -GLIB_AVAILABLE_IN_ALL -GBytes * g_bytes_new_with_free_func (gconstpointer data, - gsize size, - GDestroyNotify free_func, - gpointer user_data); - -GLIB_AVAILABLE_IN_ALL -GBytes * g_bytes_new_from_bytes (GBytes *bytes, - gsize offset, - gsize length); - -GLIB_AVAILABLE_IN_ALL -gconstpointer g_bytes_get_data (GBytes *bytes, - gsize *size); - -GLIB_AVAILABLE_IN_ALL -gsize g_bytes_get_size (GBytes *bytes); - -GLIB_AVAILABLE_IN_ALL -GBytes * g_bytes_ref (GBytes *bytes); - -GLIB_AVAILABLE_IN_ALL -void g_bytes_unref (GBytes *bytes); - -GLIB_AVAILABLE_IN_ALL -gpointer g_bytes_unref_to_data (GBytes *bytes, - gsize *size); - -GLIB_AVAILABLE_IN_ALL -GByteArray * g_bytes_unref_to_array (GBytes *bytes); - -GLIB_AVAILABLE_IN_ALL -guint g_bytes_hash (gconstpointer bytes); - -GLIB_AVAILABLE_IN_ALL -gboolean g_bytes_equal (gconstpointer bytes1, - gconstpointer bytes2); - -GLIB_AVAILABLE_IN_ALL -gint g_bytes_compare (gconstpointer bytes1, - gconstpointer bytes2); - -G_END_DECLS - -#endif /* __G_BYTES_H__ */ -/* gcharset.h - Charset functions - * - * Copyright (C) 2011 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_CHARSET_H__ -#define __G_CHARSET_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_ALL -gboolean g_get_charset (const char **charset); -GLIB_AVAILABLE_IN_ALL -gchar * g_get_codeset (void); -GLIB_AVAILABLE_IN_2_62 -gboolean g_get_console_charset (const char **charset); - -GLIB_AVAILABLE_IN_ALL -const gchar * const * g_get_language_names (void); -GLIB_AVAILABLE_IN_2_58 -const gchar * const * g_get_language_names_with_category - (const gchar *category_name); -GLIB_AVAILABLE_IN_ALL -gchar ** g_get_locale_variants (const gchar *locale); - -G_END_DECLS - -#endif /* __G_CHARSET_H__ */ -/* gchecksum.h - data hashing functions - * - * Copyright (C) 2007 Emmanuele Bassi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_CHECKSUM_H__ -#define __G_CHECKSUM_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/** - * GChecksumType: - * @G_CHECKSUM_MD5: Use the MD5 hashing algorithm - * @G_CHECKSUM_SHA1: Use the SHA-1 hashing algorithm - * @G_CHECKSUM_SHA256: Use the SHA-256 hashing algorithm - * @G_CHECKSUM_SHA384: Use the SHA-384 hashing algorithm (Since: 2.51) - * @G_CHECKSUM_SHA512: Use the SHA-512 hashing algorithm (Since: 2.36) - * - * The hashing algorithm to be used by #GChecksum when performing the - * digest of some data. - * - * Note that the #GChecksumType enumeration may be extended at a later - * date to include new hashing algorithm types. - * - * Since: 2.16 - */ -typedef enum { - G_CHECKSUM_MD5, - G_CHECKSUM_SHA1, - G_CHECKSUM_SHA256, - G_CHECKSUM_SHA512, - G_CHECKSUM_SHA384 -} GChecksumType; - -/** - * GChecksum: - * - * An opaque structure representing a checksumming operation. - * To create a new GChecksum, use g_checksum_new(). To free - * a GChecksum, use g_checksum_free(). - * - * Since: 2.16 - */ -typedef struct _GChecksum GChecksum; - -GLIB_AVAILABLE_IN_ALL -gssize g_checksum_type_get_length (GChecksumType checksum_type); - -GLIB_AVAILABLE_IN_ALL -GChecksum * g_checksum_new (GChecksumType checksum_type); -GLIB_AVAILABLE_IN_ALL -void g_checksum_reset (GChecksum *checksum); -GLIB_AVAILABLE_IN_ALL -GChecksum * g_checksum_copy (const GChecksum *checksum); -GLIB_AVAILABLE_IN_ALL -void g_checksum_free (GChecksum *checksum); -GLIB_AVAILABLE_IN_ALL -void g_checksum_update (GChecksum *checksum, - const guchar *data, - gssize length); -GLIB_AVAILABLE_IN_ALL -const gchar * g_checksum_get_string (GChecksum *checksum); -GLIB_AVAILABLE_IN_ALL -void g_checksum_get_digest (GChecksum *checksum, - guint8 *buffer, - gsize *digest_len); - -GLIB_AVAILABLE_IN_ALL -gchar *g_compute_checksum_for_data (GChecksumType checksum_type, - const guchar *data, - gsize length); -GLIB_AVAILABLE_IN_ALL -gchar *g_compute_checksum_for_string (GChecksumType checksum_type, - const gchar *str, - gssize length); - -GLIB_AVAILABLE_IN_2_34 -gchar *g_compute_checksum_for_bytes (GChecksumType checksum_type, - GBytes *data); - -G_END_DECLS - -#endif /* __G_CHECKSUM_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_CONVERT_H__ -#define __G_CONVERT_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/** - * GConvertError: - * @G_CONVERT_ERROR_NO_CONVERSION: Conversion between the requested character - * sets is not supported. - * @G_CONVERT_ERROR_ILLEGAL_SEQUENCE: Invalid byte sequence in conversion input; - * or the character sequence could not be represented in the target - * character set. - * @G_CONVERT_ERROR_FAILED: Conversion failed for some reason. - * @G_CONVERT_ERROR_PARTIAL_INPUT: Partial character sequence at end of input. - * @G_CONVERT_ERROR_BAD_URI: URI is invalid. - * @G_CONVERT_ERROR_NOT_ABSOLUTE_PATH: Pathname is not an absolute path. - * @G_CONVERT_ERROR_NO_MEMORY: No memory available. Since: 2.40 - * @G_CONVERT_ERROR_EMBEDDED_NUL: An embedded NUL character is present in - * conversion output where a NUL-terminated string is expected. - * Since: 2.56 - * - * Error codes returned by character set conversion routines. - */ -typedef enum -{ - G_CONVERT_ERROR_NO_CONVERSION, - G_CONVERT_ERROR_ILLEGAL_SEQUENCE, - G_CONVERT_ERROR_FAILED, - G_CONVERT_ERROR_PARTIAL_INPUT, - G_CONVERT_ERROR_BAD_URI, - G_CONVERT_ERROR_NOT_ABSOLUTE_PATH, - G_CONVERT_ERROR_NO_MEMORY, - G_CONVERT_ERROR_EMBEDDED_NUL -} GConvertError; - -/** - * G_CONVERT_ERROR: - * - * Error domain for character set conversions. Errors in this domain will - * be from the #GConvertError enumeration. See #GError for information on - * error domains. - */ -#define G_CONVERT_ERROR g_convert_error_quark() -GLIB_AVAILABLE_IN_ALL -GQuark g_convert_error_quark (void); - -/** - * GIConv: (skip) - * - * The GIConv struct wraps an iconv() conversion descriptor. It contains - * private data and should only be accessed using the following functions. - */ -typedef struct _GIConv *GIConv; - -GLIB_AVAILABLE_IN_ALL -GIConv g_iconv_open (const gchar *to_codeset, - const gchar *from_codeset); -GLIB_AVAILABLE_IN_ALL -gsize g_iconv (GIConv converter, - gchar **inbuf, - gsize *inbytes_left, - gchar **outbuf, - gsize *outbytes_left); -GLIB_AVAILABLE_IN_ALL -gint g_iconv_close (GIConv converter); - - -GLIB_AVAILABLE_IN_ALL -gchar* g_convert (const gchar *str, - gssize len, - const gchar *to_codeset, - const gchar *from_codeset, - gsize *bytes_read, - gsize *bytes_written, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar* g_convert_with_iconv (const gchar *str, - gssize len, - GIConv converter, - gsize *bytes_read, - gsize *bytes_written, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar* g_convert_with_fallback (const gchar *str, - gssize len, - const gchar *to_codeset, - const gchar *from_codeset, - const gchar *fallback, - gsize *bytes_read, - gsize *bytes_written, - GError **error) G_GNUC_MALLOC; - - -/* Convert between libc's idea of strings and UTF-8. - */ -GLIB_AVAILABLE_IN_ALL -gchar* g_locale_to_utf8 (const gchar *opsysstring, - gssize len, - gsize *bytes_read, - gsize *bytes_written, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar* g_locale_from_utf8 (const gchar *utf8string, - gssize len, - gsize *bytes_read, - gsize *bytes_written, - GError **error) G_GNUC_MALLOC; - -/* Convert between the operating system (or C runtime) - * representation of file names and UTF-8. - */ -GLIB_AVAILABLE_IN_ALL -gchar* g_filename_to_utf8 (const gchar *opsysstring, - gssize len, - gsize *bytes_read, - gsize *bytes_written, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar* g_filename_from_utf8 (const gchar *utf8string, - gssize len, - gsize *bytes_read, - gsize *bytes_written, - GError **error) G_GNUC_MALLOC; - -GLIB_AVAILABLE_IN_ALL -gchar *g_filename_from_uri (const gchar *uri, - gchar **hostname, - GError **error) G_GNUC_MALLOC; - -GLIB_AVAILABLE_IN_ALL -gchar *g_filename_to_uri (const gchar *filename, - const gchar *hostname, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar *g_filename_display_name (const gchar *filename) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gboolean g_get_filename_charsets (const gchar ***filename_charsets); - -GLIB_AVAILABLE_IN_ALL -gchar *g_filename_display_basename (const gchar *filename) G_GNUC_MALLOC; - -GLIB_AVAILABLE_IN_ALL -gchar **g_uri_list_extract_uris (const gchar *uri_list); - -G_END_DECLS - -#endif /* __G_CONVERT_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_DATASET_H__ -#define __G_DATASET_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GData GData; - -typedef void (*GDataForeachFunc) (GQuark key_id, - gpointer data, - gpointer user_data); - -/* Keyed Data List - */ -GLIB_AVAILABLE_IN_ALL -void g_datalist_init (GData **datalist); -GLIB_AVAILABLE_IN_ALL -void g_datalist_clear (GData **datalist); -GLIB_AVAILABLE_IN_ALL -gpointer g_datalist_id_get_data (GData **datalist, - GQuark key_id); -GLIB_AVAILABLE_IN_ALL -void g_datalist_id_set_data_full (GData **datalist, - GQuark key_id, - gpointer data, - GDestroyNotify destroy_func); - -typedef gpointer (*GDuplicateFunc) (gpointer data, gpointer user_data); - -GLIB_AVAILABLE_IN_2_34 -gpointer g_datalist_id_dup_data (GData **datalist, - GQuark key_id, - GDuplicateFunc dup_func, - gpointer user_data); -GLIB_AVAILABLE_IN_2_34 -gboolean g_datalist_id_replace_data (GData **datalist, - GQuark key_id, - gpointer oldval, - gpointer newval, - GDestroyNotify destroy, - GDestroyNotify *old_destroy); - -GLIB_AVAILABLE_IN_ALL -gpointer g_datalist_id_remove_no_notify (GData **datalist, - GQuark key_id); -GLIB_AVAILABLE_IN_ALL -void g_datalist_foreach (GData **datalist, - GDataForeachFunc func, - gpointer user_data); - -/** - * G_DATALIST_FLAGS_MASK: - * - * A bitmask that restricts the possible flags passed to - * g_datalist_set_flags(). Passing a flags value where - * flags & ~G_DATALIST_FLAGS_MASK != 0 is an error. - */ -#define G_DATALIST_FLAGS_MASK 0x3 - -GLIB_AVAILABLE_IN_ALL -void g_datalist_set_flags (GData **datalist, - guint flags); -GLIB_AVAILABLE_IN_ALL -void g_datalist_unset_flags (GData **datalist, - guint flags); -GLIB_AVAILABLE_IN_ALL -guint g_datalist_get_flags (GData **datalist); - -#define g_datalist_id_set_data(dl, q, d) \ - g_datalist_id_set_data_full ((dl), (q), (d), NULL) -#define g_datalist_id_remove_data(dl, q) \ - g_datalist_id_set_data ((dl), (q), NULL) -#define g_datalist_set_data_full(dl, k, d, f) \ - g_datalist_id_set_data_full ((dl), g_quark_from_string (k), (d), (f)) -#define g_datalist_remove_no_notify(dl, k) \ - g_datalist_id_remove_no_notify ((dl), g_quark_try_string (k)) -#define g_datalist_set_data(dl, k, d) \ - g_datalist_set_data_full ((dl), (k), (d), NULL) -#define g_datalist_remove_data(dl, k) \ - g_datalist_id_set_data ((dl), g_quark_try_string (k), NULL) - -/* Location Associated Keyed Data - */ -GLIB_AVAILABLE_IN_ALL -void g_dataset_destroy (gconstpointer dataset_location); -GLIB_AVAILABLE_IN_ALL -gpointer g_dataset_id_get_data (gconstpointer dataset_location, - GQuark key_id); -GLIB_AVAILABLE_IN_ALL -gpointer g_datalist_get_data (GData **datalist, - const gchar *key); -GLIB_AVAILABLE_IN_ALL -void g_dataset_id_set_data_full (gconstpointer dataset_location, - GQuark key_id, - gpointer data, - GDestroyNotify destroy_func); -GLIB_AVAILABLE_IN_ALL -gpointer g_dataset_id_remove_no_notify (gconstpointer dataset_location, - GQuark key_id); -GLIB_AVAILABLE_IN_ALL -void g_dataset_foreach (gconstpointer dataset_location, - GDataForeachFunc func, - gpointer user_data); -#define g_dataset_id_set_data(l, k, d) \ - g_dataset_id_set_data_full ((l), (k), (d), NULL) -#define g_dataset_id_remove_data(l, k) \ - g_dataset_id_set_data ((l), (k), NULL) -#define g_dataset_get_data(l, k) \ - (g_dataset_id_get_data ((l), g_quark_try_string (k))) -#define g_dataset_set_data_full(l, k, d, f) \ - g_dataset_id_set_data_full ((l), g_quark_from_string (k), (d), (f)) -#define g_dataset_remove_no_notify(l, k) \ - g_dataset_id_remove_no_notify ((l), g_quark_try_string (k)) -#define g_dataset_set_data(l, k, d) \ - g_dataset_set_data_full ((l), (k), (d), NULL) -#define g_dataset_remove_data(l, k) \ - g_dataset_id_set_data ((l), g_quark_try_string (k), NULL) - -G_END_DECLS - -#endif /* __G_DATASET_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_DATE_H__ -#define __G_DATE_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -#include - - -G_BEGIN_DECLS - -/* GDate - * - * Date calculations (not time for now, to be resolved). These are a - * mutant combination of Steffen Beyer's DateCalc routines - * (http://www.perl.com/CPAN/authors/id/STBEY/) and Jon Trowbridge's - * date routines (written for in-house software). Written by Havoc - * Pennington - */ - -typedef gint32 GTime GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime); -typedef guint16 GDateYear; -typedef guint8 GDateDay; /* day of the month */ -typedef struct _GDate GDate; - -/* enum used to specify order of appearance in parsed date strings */ -typedef enum -{ - G_DATE_DAY = 0, - G_DATE_MONTH = 1, - G_DATE_YEAR = 2 -} GDateDMY; - -/* actual week and month values */ -typedef enum -{ - G_DATE_BAD_WEEKDAY = 0, - G_DATE_MONDAY = 1, - G_DATE_TUESDAY = 2, - G_DATE_WEDNESDAY = 3, - G_DATE_THURSDAY = 4, - G_DATE_FRIDAY = 5, - G_DATE_SATURDAY = 6, - G_DATE_SUNDAY = 7 -} GDateWeekday; -typedef enum -{ - G_DATE_BAD_MONTH = 0, - G_DATE_JANUARY = 1, - G_DATE_FEBRUARY = 2, - G_DATE_MARCH = 3, - G_DATE_APRIL = 4, - G_DATE_MAY = 5, - G_DATE_JUNE = 6, - G_DATE_JULY = 7, - G_DATE_AUGUST = 8, - G_DATE_SEPTEMBER = 9, - G_DATE_OCTOBER = 10, - G_DATE_NOVEMBER = 11, - G_DATE_DECEMBER = 12 -} GDateMonth; - -#define G_DATE_BAD_JULIAN 0U -#define G_DATE_BAD_DAY 0U -#define G_DATE_BAD_YEAR 0U - -/* Note: directly manipulating structs is generally a bad idea, but - * in this case it's an *incredibly* bad idea, because all or part - * of this struct can be invalid at any given time. Use the functions, - * or you will get hosed, I promise. - */ -struct _GDate -{ - guint julian_days : 32; /* julian days representation - we use a - * bitfield hoping that 64 bit platforms - * will pack this whole struct in one big - * int - */ - - guint julian : 1; /* julian is valid */ - guint dmy : 1; /* dmy is valid */ - - /* DMY representation */ - guint day : 6; - guint month : 4; - guint year : 16; -}; - -/* g_date_new() returns an invalid date, you then have to _set() stuff - * to get a usable object. You can also allocate a GDate statically, - * then call g_date_clear() to initialize. - */ -GLIB_AVAILABLE_IN_ALL -GDate* g_date_new (void); -GLIB_AVAILABLE_IN_ALL -GDate* g_date_new_dmy (GDateDay day, - GDateMonth month, - GDateYear year); -GLIB_AVAILABLE_IN_ALL -GDate* g_date_new_julian (guint32 julian_day); -GLIB_AVAILABLE_IN_ALL -void g_date_free (GDate *date); -GLIB_AVAILABLE_IN_2_56 -GDate* g_date_copy (const GDate *date); - -/* check g_date_valid() after doing an operation that might fail, like - * _parse. Almost all g_date operations are undefined on invalid - * dates (the exceptions are the mutators, since you need those to - * return to validity). - */ -GLIB_AVAILABLE_IN_ALL -gboolean g_date_valid (const GDate *date); -GLIB_AVAILABLE_IN_ALL -gboolean g_date_valid_day (GDateDay day) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_date_valid_month (GDateMonth month) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_date_valid_year (GDateYear year) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_date_valid_weekday (GDateWeekday weekday) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_date_valid_julian (guint32 julian_date) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_date_valid_dmy (GDateDay day, - GDateMonth month, - GDateYear year) G_GNUC_CONST; - -GLIB_AVAILABLE_IN_ALL -GDateWeekday g_date_get_weekday (const GDate *date); -GLIB_AVAILABLE_IN_ALL -GDateMonth g_date_get_month (const GDate *date); -GLIB_AVAILABLE_IN_ALL -GDateYear g_date_get_year (const GDate *date); -GLIB_AVAILABLE_IN_ALL -GDateDay g_date_get_day (const GDate *date); -GLIB_AVAILABLE_IN_ALL -guint32 g_date_get_julian (const GDate *date); -GLIB_AVAILABLE_IN_ALL -guint g_date_get_day_of_year (const GDate *date); -/* First monday/sunday is the start of week 1; if we haven't reached - * that day, return 0. These are not ISO weeks of the year; that - * routine needs to be added. - * these functions return the number of weeks, starting on the - * corrsponding day - */ -GLIB_AVAILABLE_IN_ALL -guint g_date_get_monday_week_of_year (const GDate *date); -GLIB_AVAILABLE_IN_ALL -guint g_date_get_sunday_week_of_year (const GDate *date); -GLIB_AVAILABLE_IN_ALL -guint g_date_get_iso8601_week_of_year (const GDate *date); - -/* If you create a static date struct you need to clear it to get it - * in a safe state before use. You can clear a whole array at - * once with the ndates argument. - */ -GLIB_AVAILABLE_IN_ALL -void g_date_clear (GDate *date, - guint n_dates); - -/* The parse routine is meant for dates typed in by a user, so it - * permits many formats but tries to catch common typos. If your data - * needs to be strictly validated, it is not an appropriate function. - */ -GLIB_AVAILABLE_IN_ALL -void g_date_set_parse (GDate *date, - const gchar *str); -GLIB_AVAILABLE_IN_ALL -void g_date_set_time_t (GDate *date, - time_t timet); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_DEPRECATED_IN_2_62_FOR(g_date_set_time_t) -void g_date_set_time_val (GDate *date, - GTimeVal *timeval); -GLIB_DEPRECATED_FOR(g_date_set_time_t) -void g_date_set_time (GDate *date, - GTime time_); -G_GNUC_END_IGNORE_DEPRECATIONS -GLIB_AVAILABLE_IN_ALL -void g_date_set_month (GDate *date, - GDateMonth month); -GLIB_AVAILABLE_IN_ALL -void g_date_set_day (GDate *date, - GDateDay day); -GLIB_AVAILABLE_IN_ALL -void g_date_set_year (GDate *date, - GDateYear year); -GLIB_AVAILABLE_IN_ALL -void g_date_set_dmy (GDate *date, - GDateDay day, - GDateMonth month, - GDateYear y); -GLIB_AVAILABLE_IN_ALL -void g_date_set_julian (GDate *date, - guint32 julian_date); -GLIB_AVAILABLE_IN_ALL -gboolean g_date_is_first_of_month (const GDate *date); -GLIB_AVAILABLE_IN_ALL -gboolean g_date_is_last_of_month (const GDate *date); - -/* To go forward by some number of weeks just go forward weeks*7 days */ -GLIB_AVAILABLE_IN_ALL -void g_date_add_days (GDate *date, - guint n_days); -GLIB_AVAILABLE_IN_ALL -void g_date_subtract_days (GDate *date, - guint n_days); - -/* If you add/sub months while day > 28, the day might change */ -GLIB_AVAILABLE_IN_ALL -void g_date_add_months (GDate *date, - guint n_months); -GLIB_AVAILABLE_IN_ALL -void g_date_subtract_months (GDate *date, - guint n_months); - -/* If it's feb 29, changing years can move you to the 28th */ -GLIB_AVAILABLE_IN_ALL -void g_date_add_years (GDate *date, - guint n_years); -GLIB_AVAILABLE_IN_ALL -void g_date_subtract_years (GDate *date, - guint n_years); -GLIB_AVAILABLE_IN_ALL -gboolean g_date_is_leap_year (GDateYear year) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -guint8 g_date_get_days_in_month (GDateMonth month, - GDateYear year) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -guint8 g_date_get_monday_weeks_in_year (GDateYear year) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -guint8 g_date_get_sunday_weeks_in_year (GDateYear year) G_GNUC_CONST; - -/* Returns the number of days between the two dates. If date2 comes - before date1, a negative value is return. */ -GLIB_AVAILABLE_IN_ALL -gint g_date_days_between (const GDate *date1, - const GDate *date2); - -/* qsort-friendly (with a cast...) */ -GLIB_AVAILABLE_IN_ALL -gint g_date_compare (const GDate *lhs, - const GDate *rhs); -GLIB_AVAILABLE_IN_ALL -void g_date_to_struct_tm (const GDate *date, - struct tm *tm); - -GLIB_AVAILABLE_IN_ALL -void g_date_clamp (GDate *date, - const GDate *min_date, - const GDate *max_date); - -/* Swap date1 and date2's values if date1 > date2. */ -GLIB_AVAILABLE_IN_ALL -void g_date_order (GDate *date1, GDate *date2); - -/* Just like strftime() except you can only use date-related formats. - * Using a time format is undefined. - */ -GLIB_AVAILABLE_IN_ALL -gsize g_date_strftime (gchar *s, - gsize slen, - const gchar *format, - const GDate *date); - -#define g_date_weekday g_date_get_weekday GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_weekday) -#define g_date_month g_date_get_month GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_month) -#define g_date_year g_date_get_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_year) -#define g_date_day g_date_get_day GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_day) -#define g_date_julian g_date_get_julian GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_julian) -#define g_date_day_of_year g_date_get_day_of_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_day_of_year) -#define g_date_monday_week_of_year g_date_get_monday_week_of_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_monday_week_of_year) -#define g_date_sunday_week_of_year g_date_get_sunday_week_of_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_sunday_week_of_year) -#define g_date_days_in_month g_date_get_days_in_month GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_days_in_month) -#define g_date_monday_weeks_in_year g_date_get_monday_weeks_in_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_monday_weeks_in_year) -#define g_date_sunday_weeks_in_year g_date_get_sunday_weeks_in_year GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_date_get_sunday_weeks_in_year) - -G_END_DECLS - -#endif /* __G_DATE_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * gdir.c: Simplified wrapper around the DIRENT functions. - * - * Copyright 2001 Hans Breuer - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#ifndef __G_DIR_H__ -#define __G_DIR_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -#ifdef G_OS_UNIX -#include -#endif - -G_BEGIN_DECLS - -typedef struct _GDir GDir; - -GLIB_AVAILABLE_IN_ALL -GDir * g_dir_open (const gchar *path, - guint flags, - GError **error); -GLIB_AVAILABLE_IN_ALL -const gchar * g_dir_read_name (GDir *dir); -GLIB_AVAILABLE_IN_ALL -void g_dir_rewind (GDir *dir); -GLIB_AVAILABLE_IN_ALL -void g_dir_close (GDir *dir); - -G_END_DECLS - -#endif /* __G_DIR_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_ENVIRON_H__ -#define __G_ENVIRON_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_ALL -const gchar * g_getenv (const gchar *variable); -GLIB_AVAILABLE_IN_ALL -gboolean g_setenv (const gchar *variable, - const gchar *value, - gboolean overwrite); -GLIB_AVAILABLE_IN_ALL -void g_unsetenv (const gchar *variable); -GLIB_AVAILABLE_IN_ALL -gchar ** g_listenv (void); - -GLIB_AVAILABLE_IN_ALL -gchar ** g_get_environ (void); -GLIB_AVAILABLE_IN_ALL -const gchar * g_environ_getenv (gchar **envp, - const gchar *variable); -GLIB_AVAILABLE_IN_ALL -gchar ** g_environ_setenv (gchar **envp, - const gchar *variable, - const gchar *value, - gboolean overwrite) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -gchar ** g_environ_unsetenv (gchar **envp, - const gchar *variable) G_GNUC_WARN_UNUSED_RESULT; - -G_END_DECLS - -#endif /* __G_ENVIRON_H__ */ -/* gfileutils.h - File utility functions - * - * Copyright 2000 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_FILEUTILS_H__ -#define __G_FILEUTILS_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -#define G_FILE_ERROR g_file_error_quark () - -typedef enum -{ - G_FILE_ERROR_EXIST, - G_FILE_ERROR_ISDIR, - G_FILE_ERROR_ACCES, - G_FILE_ERROR_NAMETOOLONG, - G_FILE_ERROR_NOENT, - G_FILE_ERROR_NOTDIR, - G_FILE_ERROR_NXIO, - G_FILE_ERROR_NODEV, - G_FILE_ERROR_ROFS, - G_FILE_ERROR_TXTBSY, - G_FILE_ERROR_FAULT, - G_FILE_ERROR_LOOP, - G_FILE_ERROR_NOSPC, - G_FILE_ERROR_NOMEM, - G_FILE_ERROR_MFILE, - G_FILE_ERROR_NFILE, - G_FILE_ERROR_BADF, - G_FILE_ERROR_INVAL, - G_FILE_ERROR_PIPE, - G_FILE_ERROR_AGAIN, - G_FILE_ERROR_INTR, - G_FILE_ERROR_IO, - G_FILE_ERROR_PERM, - G_FILE_ERROR_NOSYS, - G_FILE_ERROR_FAILED -} GFileError; - -/* For backward-compat reasons, these are synced to an old - * anonymous enum in libgnome. But don't use that enum - * in new code. - */ -typedef enum -{ - G_FILE_TEST_IS_REGULAR = 1 << 0, - G_FILE_TEST_IS_SYMLINK = 1 << 1, - G_FILE_TEST_IS_DIR = 1 << 2, - G_FILE_TEST_IS_EXECUTABLE = 1 << 3, - G_FILE_TEST_EXISTS = 1 << 4 -} GFileTest; - -/** - * GFileSetContentsFlags: - * @G_FILE_SET_CONTENTS_NONE: No guarantees about file consistency or durability. - * The most dangerous setting, which is slightly faster than other settings. - * @G_FILE_SET_CONTENTS_CONSISTENT: Guarantee file consistency: after a crash, - * either the old version of the file or the new version of the file will be - * available, but not a mixture. On Unix systems this equates to an `fsync()` - * on the file and use of an atomic `rename()` of the new version of the file - * over the old. - * @G_FILE_SET_CONTENTS_DURABLE: Guarantee file durability: after a crash, the - * new version of the file will be available. On Unix systems this equates to - * an `fsync()` on the file (if %G_FILE_SET_CONTENTS_CONSISTENT is unset), or - * the effects of %G_FILE_SET_CONTENTS_CONSISTENT plus an `fsync()` on the - * directory containing the file after calling `rename()`. - * @G_FILE_SET_CONTENTS_ONLY_EXISTING: Only apply consistency and durability - * guarantees if the file already exists. This may speed up file operations - * if the file doesn’t currently exist, but may result in a corrupted version - * of the new file if the system crashes while writing it. - * - * Flags to pass to g_file_set_contents_full() to affect its safety and - * performance. - * - * Since: 2.66 - */ -typedef enum -{ - G_FILE_SET_CONTENTS_NONE = 0, - G_FILE_SET_CONTENTS_CONSISTENT = 1 << 0, - G_FILE_SET_CONTENTS_DURABLE = 1 << 1, - G_FILE_SET_CONTENTS_ONLY_EXISTING = 1 << 2 -} GFileSetContentsFlags -GLIB_AVAILABLE_ENUMERATOR_IN_2_66; - -GLIB_AVAILABLE_IN_ALL -GQuark g_file_error_quark (void); -/* So other code can generate a GFileError */ -GLIB_AVAILABLE_IN_ALL -GFileError g_file_error_from_errno (gint err_no); - -GLIB_AVAILABLE_IN_ALL -gboolean g_file_test (const gchar *filename, - GFileTest test); -GLIB_AVAILABLE_IN_ALL -gboolean g_file_get_contents (const gchar *filename, - gchar **contents, - gsize *length, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_file_set_contents (const gchar *filename, - const gchar *contents, - gssize length, - GError **error); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_AVAILABLE_IN_2_66 -gboolean g_file_set_contents_full (const gchar *filename, - const gchar *contents, - gssize length, - GFileSetContentsFlags flags, - int mode, - GError **error); -G_GNUC_END_IGNORE_DEPRECATIONS -GLIB_AVAILABLE_IN_ALL -gchar *g_file_read_link (const gchar *filename, - GError **error); - -/* Wrapper / workalike for mkdtemp() */ -GLIB_AVAILABLE_IN_2_30 -gchar *g_mkdtemp (gchar *tmpl); -GLIB_AVAILABLE_IN_2_30 -gchar *g_mkdtemp_full (gchar *tmpl, - gint mode); - -/* Wrapper / workalike for mkstemp() */ -GLIB_AVAILABLE_IN_ALL -gint g_mkstemp (gchar *tmpl); -GLIB_AVAILABLE_IN_ALL -gint g_mkstemp_full (gchar *tmpl, - gint flags, - gint mode); - -/* Wrappers for g_mkstemp and g_mkdtemp() */ -GLIB_AVAILABLE_IN_ALL -gint g_file_open_tmp (const gchar *tmpl, - gchar **name_used, - GError **error); -GLIB_AVAILABLE_IN_2_30 -gchar *g_dir_make_tmp (const gchar *tmpl, - GError **error); - -GLIB_AVAILABLE_IN_ALL -gchar *g_build_path (const gchar *separator, - const gchar *first_element, - ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED; -GLIB_AVAILABLE_IN_ALL -gchar *g_build_pathv (const gchar *separator, - gchar **args) G_GNUC_MALLOC; - -GLIB_AVAILABLE_IN_ALL -gchar *g_build_filename (const gchar *first_element, - ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED; -GLIB_AVAILABLE_IN_ALL -gchar *g_build_filenamev (gchar **args) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_2_56 -gchar *g_build_filename_valist (const gchar *first_element, - va_list *args) G_GNUC_MALLOC; - -GLIB_AVAILABLE_IN_ALL -gint g_mkdir_with_parents (const gchar *pathname, - gint mode); - -#ifdef G_OS_WIN32 - -/* On Win32, the canonical directory separator is the backslash, and - * the search path separator is the semicolon. Note that also the - * (forward) slash works as directory separator. - */ -#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR || (c) == '/') - -#else /* !G_OS_WIN32 */ - -#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR) - -#endif /* !G_OS_WIN32 */ - -GLIB_AVAILABLE_IN_ALL -gboolean g_path_is_absolute (const gchar *file_name); -GLIB_AVAILABLE_IN_ALL -const gchar *g_path_skip_root (const gchar *file_name); - -GLIB_DEPRECATED_FOR(g_path_get_basename) -const gchar *g_basename (const gchar *file_name); -#define g_dirname g_path_get_dirname GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_path_get_dirname) - -GLIB_AVAILABLE_IN_ALL -gchar *g_get_current_dir (void); -GLIB_AVAILABLE_IN_ALL -gchar *g_path_get_basename (const gchar *file_name) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar *g_path_get_dirname (const gchar *file_name) G_GNUC_MALLOC; - -GLIB_AVAILABLE_IN_2_58 -gchar *g_canonicalize_filename (const gchar *filename, - const gchar *relative_to) G_GNUC_MALLOC; - -G_END_DECLS - -#endif /* __G_FILEUTILS_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_GETTEXT_H__ -#define __G_GETTEXT_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_ALL -const gchar *g_strip_context (const gchar *msgid, - const gchar *msgval) G_GNUC_FORMAT(1); - -GLIB_AVAILABLE_IN_ALL -const gchar *g_dgettext (const gchar *domain, - const gchar *msgid) G_GNUC_FORMAT(2); -GLIB_AVAILABLE_IN_ALL -const gchar *g_dcgettext (const gchar *domain, - const gchar *msgid, - gint category) G_GNUC_FORMAT(2); -GLIB_AVAILABLE_IN_ALL -const gchar *g_dngettext (const gchar *domain, - const gchar *msgid, - const gchar *msgid_plural, - gulong n) G_GNUC_FORMAT(3); -GLIB_AVAILABLE_IN_ALL -const gchar *g_dpgettext (const gchar *domain, - const gchar *msgctxtid, - gsize msgidoffset) G_GNUC_FORMAT(2); -GLIB_AVAILABLE_IN_ALL -const gchar *g_dpgettext2 (const gchar *domain, - const gchar *context, - const gchar *msgid) G_GNUC_FORMAT(3); - -G_END_DECLS - -#endif /* __G_GETTEXT_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_HASH_H__ -#define __G_HASH_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_LIST_H__ -#define __G_LIST_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_MEM_H__ -#define __G_MEM_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/** - * GMemVTable: - * @malloc: function to use for allocating memory. - * @realloc: function to use for reallocating memory. - * @free: function to use to free memory. - * @calloc: function to use for allocating zero-filled memory. - * @try_malloc: function to use for allocating memory without a default error handler. - * @try_realloc: function to use for reallocating memory without a default error handler. - * - * A set of functions used to perform memory allocation. The same #GMemVTable must - * be used for all allocations in the same program; a call to g_mem_set_vtable(), - * if it exists, should be prior to any use of GLib. - */ -typedef struct _GMemVTable GMemVTable; - - -#if GLIB_SIZEOF_VOID_P > GLIB_SIZEOF_LONG -/** - * G_MEM_ALIGN: - * - * Indicates the number of bytes to which memory will be aligned on the - * current platform. - */ -# define G_MEM_ALIGN GLIB_SIZEOF_VOID_P -#else /* GLIB_SIZEOF_VOID_P <= GLIB_SIZEOF_LONG */ -# define G_MEM_ALIGN GLIB_SIZEOF_LONG -#endif /* GLIB_SIZEOF_VOID_P <= GLIB_SIZEOF_LONG */ - - -/* Memory allocation functions - */ - -GLIB_AVAILABLE_IN_ALL -void g_free (gpointer mem); - -GLIB_AVAILABLE_IN_2_34 -void g_clear_pointer (gpointer *pp, - GDestroyNotify destroy); - -GLIB_AVAILABLE_IN_ALL -gpointer g_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); -GLIB_AVAILABLE_IN_ALL -gpointer g_malloc0 (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); -GLIB_AVAILABLE_IN_ALL -gpointer g_realloc (gpointer mem, - gsize n_bytes) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -gpointer g_try_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); -GLIB_AVAILABLE_IN_ALL -gpointer g_try_malloc0 (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); -GLIB_AVAILABLE_IN_ALL -gpointer g_try_realloc (gpointer mem, - gsize n_bytes) G_GNUC_WARN_UNUSED_RESULT; - -GLIB_AVAILABLE_IN_ALL -gpointer g_malloc_n (gsize n_blocks, - gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); -GLIB_AVAILABLE_IN_ALL -gpointer g_malloc0_n (gsize n_blocks, - gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); -GLIB_AVAILABLE_IN_ALL -gpointer g_realloc_n (gpointer mem, - gsize n_blocks, - gsize n_block_bytes) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -gpointer g_try_malloc_n (gsize n_blocks, - gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); -GLIB_AVAILABLE_IN_ALL -gpointer g_try_malloc0_n (gsize n_blocks, - gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); -GLIB_AVAILABLE_IN_ALL -gpointer g_try_realloc_n (gpointer mem, - gsize n_blocks, - gsize n_block_bytes) G_GNUC_WARN_UNUSED_RESULT; - -#if defined(glib_typeof) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_58 -#undef g_clear_pointer -#define g_clear_pointer(pp, destroy) \ - G_STMT_START \ - { \ - G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \ - glib_typeof ((pp)) _pp = (pp); \ - glib_typeof (*(pp)) _ptr = *_pp; \ - *_pp = NULL; \ - if (_ptr) \ - (destroy) (_ptr); \ - } \ - G_STMT_END \ - GLIB_AVAILABLE_MACRO_IN_2_34 -#else /* __GNUC__ */ -#undef g_clear_pointer -#define g_clear_pointer(pp, destroy) \ - G_STMT_START { \ - G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \ - /* Only one access, please; work around type aliasing */ \ - union { char *in; gpointer *out; } _pp; \ - gpointer _p; \ - /* This assignment is needed to avoid a gcc warning */ \ - GDestroyNotify _destroy = (GDestroyNotify) (destroy); \ - \ - _pp.in = (char *) (pp); \ - _p = *_pp.out; \ - if (_p) \ - { \ - *_pp.out = NULL; \ - _destroy (_p); \ - } \ - } G_STMT_END \ - GLIB_AVAILABLE_MACRO_IN_2_34 -#endif /* __GNUC__ */ - -/** - * g_steal_pointer: - * @pp: (not nullable): a pointer to a pointer - * - * Sets @pp to %NULL, returning the value that was there before. - * - * Conceptually, this transfers the ownership of the pointer from the - * referenced variable to the "caller" of the macro (ie: "steals" the - * reference). - * - * The return value will be properly typed, according to the type of - * @pp. - * - * This can be very useful when combined with g_autoptr() to prevent the - * return value of a function from being automatically freed. Consider - * the following example (which only works on GCC and clang): - * - * |[ - * GObject * - * create_object (void) - * { - * g_autoptr(GObject) obj = g_object_new (G_TYPE_OBJECT, NULL); - * - * if (early_error_case) - * return NULL; - * - * return g_steal_pointer (&obj); - * } - * ]| - * - * It can also be used in similar ways for 'out' parameters and is - * particularly useful for dealing with optional out parameters: - * - * |[ - * gboolean - * get_object (GObject **obj_out) - * { - * g_autoptr(GObject) obj = g_object_new (G_TYPE_OBJECT, NULL); - * - * if (early_error_case) - * return FALSE; - * - * if (obj_out) - * *obj_out = g_steal_pointer (&obj); - * - * return TRUE; - * } - * ]| - * - * In the above example, the object will be automatically freed in the - * early error case and also in the case that %NULL was given for - * @obj_out. - * - * Since: 2.44 - */ -GLIB_AVAILABLE_STATIC_INLINE_IN_2_44 -static inline gpointer -g_steal_pointer (gpointer pp) -{ - gpointer *ptr = (gpointer *) pp; - gpointer ref; - - ref = *ptr; - *ptr = NULL; - - return ref; -} - -/* type safety */ -#if defined(glib_typeof) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_58 -#define g_steal_pointer(pp) ((glib_typeof (*pp)) (g_steal_pointer) (pp)) -#else /* __GNUC__ */ -/* This version does not depend on gcc extensions, but gcc does not warn - * about incompatible-pointer-types: */ -#define g_steal_pointer(pp) \ - (0 ? (*(pp)) : (g_steal_pointer) (pp)) -#endif /* __GNUC__ */ - -/* Optimise: avoid the call to the (slower) _n function if we can - * determine at compile-time that no overflow happens. - */ -#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) -# define _G_NEW(struct_type, n_structs, func) \ - (struct_type *) (G_GNUC_EXTENSION ({ \ - gsize __n = (gsize) (n_structs); \ - gsize __s = sizeof (struct_type); \ - gpointer __p; \ - if (__s == 1) \ - __p = g_##func (__n); \ - else if (__builtin_constant_p (__n) && \ - (__s == 0 || __n <= G_MAXSIZE / __s)) \ - __p = g_##func (__n * __s); \ - else \ - __p = g_##func##_n (__n, __s); \ - __p; \ - })) -# define _G_RENEW(struct_type, mem, n_structs, func) \ - (struct_type *) (G_GNUC_EXTENSION ({ \ - gsize __n = (gsize) (n_structs); \ - gsize __s = sizeof (struct_type); \ - gpointer __p = (gpointer) (mem); \ - if (__s == 1) \ - __p = g_##func (__p, __n); \ - else if (__builtin_constant_p (__n) && \ - (__s == 0 || __n <= G_MAXSIZE / __s)) \ - __p = g_##func (__p, __n * __s); \ - else \ - __p = g_##func##_n (__p, __n, __s); \ - __p; \ - })) - -#else - -/* Unoptimised version: always call the _n() function. */ - -#define _G_NEW(struct_type, n_structs, func) \ - ((struct_type *) g_##func##_n ((n_structs), sizeof (struct_type))) -#define _G_RENEW(struct_type, mem, n_structs, func) \ - ((struct_type *) g_##func##_n (mem, (n_structs), sizeof (struct_type))) - -#endif - -/** - * g_new: - * @struct_type: the type of the elements to allocate - * @n_structs: the number of elements to allocate - * - * Allocates @n_structs elements of type @struct_type. - * The returned pointer is cast to a pointer to the given type. - * If @n_structs is 0 it returns %NULL. - * Care is taken to avoid overflow when calculating the size of the allocated block. - * - * Since the returned pointer is already casted to the right type, - * it is normally unnecessary to cast it explicitly, and doing - * so might hide memory allocation errors. - * - * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type - */ -#define g_new(struct_type, n_structs) _G_NEW (struct_type, n_structs, malloc) -/** - * g_new0: - * @struct_type: the type of the elements to allocate. - * @n_structs: the number of elements to allocate. - * - * Allocates @n_structs elements of type @struct_type, initialized to 0's. - * The returned pointer is cast to a pointer to the given type. - * If @n_structs is 0 it returns %NULL. - * Care is taken to avoid overflow when calculating the size of the allocated block. - * - * Since the returned pointer is already casted to the right type, - * it is normally unnecessary to cast it explicitly, and doing - * so might hide memory allocation errors. - * - * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type. - */ -#define g_new0(struct_type, n_structs) _G_NEW (struct_type, n_structs, malloc0) -/** - * g_renew: - * @struct_type: the type of the elements to allocate - * @mem: the currently allocated memory - * @n_structs: the number of elements to allocate - * - * Reallocates the memory pointed to by @mem, so that it now has space for - * @n_structs elements of type @struct_type. It returns the new address of - * the memory, which may have been moved. - * Care is taken to avoid overflow when calculating the size of the allocated block. - * - * Returns: a pointer to the new allocated memory, cast to a pointer to @struct_type - */ -#define g_renew(struct_type, mem, n_structs) _G_RENEW (struct_type, mem, n_structs, realloc) -/** - * g_try_new: - * @struct_type: the type of the elements to allocate - * @n_structs: the number of elements to allocate - * - * Attempts to allocate @n_structs elements of type @struct_type, and returns - * %NULL on failure. Contrast with g_new(), which aborts the program on failure. - * The returned pointer is cast to a pointer to the given type. - * The function returns %NULL when @n_structs is 0 of if an overflow occurs. - * - * Since: 2.8 - * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type - */ -#define g_try_new(struct_type, n_structs) _G_NEW (struct_type, n_structs, try_malloc) -/** - * g_try_new0: - * @struct_type: the type of the elements to allocate - * @n_structs: the number of elements to allocate - * - * Attempts to allocate @n_structs elements of type @struct_type, initialized - * to 0's, and returns %NULL on failure. Contrast with g_new0(), which aborts - * the program on failure. - * The returned pointer is cast to a pointer to the given type. - * The function returns %NULL when @n_structs is 0 or if an overflow occurs. - * - * Since: 2.8 - * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type - */ -#define g_try_new0(struct_type, n_structs) _G_NEW (struct_type, n_structs, try_malloc0) -/** - * g_try_renew: - * @struct_type: the type of the elements to allocate - * @mem: the currently allocated memory - * @n_structs: the number of elements to allocate - * - * Attempts to reallocate the memory pointed to by @mem, so that it now has - * space for @n_structs elements of type @struct_type, and returns %NULL on - * failure. Contrast with g_renew(), which aborts the program on failure. - * It returns the new address of the memory, which may have been moved. - * The function returns %NULL if an overflow occurs. - * - * Since: 2.8 - * Returns: a pointer to the new allocated memory, cast to a pointer to @struct_type - */ -#define g_try_renew(struct_type, mem, n_structs) _G_RENEW (struct_type, mem, n_structs, try_realloc) - - -/* Memory allocation virtualization for debugging purposes - * g_mem_set_vtable() has to be the very first GLib function called - * if being used - */ -struct _GMemVTable { - gpointer (*malloc) (gsize n_bytes); - gpointer (*realloc) (gpointer mem, - gsize n_bytes); - /* optional; set to NULL if not supported */ - gpointer (*memalign) (gsize alignment, - gsize size); - void (*free) (gpointer mem); - /* optional; set to NULL if not used ! */ - gpointer (*calloc) (gsize n_blocks, - gsize n_block_bytes); - gpointer (*try_malloc) (gsize n_bytes); - gpointer (*try_realloc) (gpointer mem, - gsize n_bytes); -}; -GLIB_VAR GMemVTable *glib_mem_table; -GLIB_AVAILABLE_IN_ALL -void g_mem_set_vtable (GMemVTable *vtable); -GLIB_AVAILABLE_IN_ALL -gboolean g_mem_is_system_malloc (void); - -GLIB_VAR gboolean g_mem_gc_friendly; - -/* Memory profiler and checker, has to be enabled via g_mem_set_vtable() - */ -GLIB_VAR GMemVTable *glib_mem_profiler_table; -GLIB_DEPRECATED_IN_2_46 -void g_mem_profile (void); - -G_END_DECLS - -#endif /* __G_MEM_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_NODE_H__ -#define __G_NODE_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GNode GNode; - -/* Tree traverse flags */ -typedef enum -{ - G_TRAVERSE_LEAVES = 1 << 0, - G_TRAVERSE_NON_LEAVES = 1 << 1, - G_TRAVERSE_ALL = G_TRAVERSE_LEAVES | G_TRAVERSE_NON_LEAVES, - G_TRAVERSE_MASK = 0x03, - G_TRAVERSE_LEAFS = G_TRAVERSE_LEAVES, - G_TRAVERSE_NON_LEAFS = G_TRAVERSE_NON_LEAVES -} GTraverseFlags; - -/* Tree traverse orders */ -typedef enum -{ - G_IN_ORDER, - G_PRE_ORDER, - G_POST_ORDER, - G_LEVEL_ORDER -} GTraverseType; - -typedef gboolean (*GNodeTraverseFunc) (GNode *node, - gpointer data); -typedef void (*GNodeForeachFunc) (GNode *node, - gpointer data); - -/* N-way tree implementation - */ -struct _GNode -{ - gpointer data; - GNode *next; - GNode *prev; - GNode *parent; - GNode *children; -}; - -/** - * G_NODE_IS_ROOT: - * @node: a #GNode - * - * Returns %TRUE if a #GNode is the root of a tree. - * - * Returns: %TRUE if the #GNode is the root of a tree - * (i.e. it has no parent or siblings) - */ -#define G_NODE_IS_ROOT(node) (((GNode*) (node))->parent == NULL && \ - ((GNode*) (node))->prev == NULL && \ - ((GNode*) (node))->next == NULL) - -/** - * G_NODE_IS_LEAF: - * @node: a #GNode - * - * Returns %TRUE if a #GNode is a leaf node. - * - * Returns: %TRUE if the #GNode is a leaf node - * (i.e. it has no children) - */ -#define G_NODE_IS_LEAF(node) (((GNode*) (node))->children == NULL) - -GLIB_AVAILABLE_IN_ALL -GNode* g_node_new (gpointer data); -GLIB_AVAILABLE_IN_ALL -void g_node_destroy (GNode *root); -GLIB_AVAILABLE_IN_ALL -void g_node_unlink (GNode *node); -GLIB_AVAILABLE_IN_ALL -GNode* g_node_copy_deep (GNode *node, - GCopyFunc copy_func, - gpointer data); -GLIB_AVAILABLE_IN_ALL -GNode* g_node_copy (GNode *node); -GLIB_AVAILABLE_IN_ALL -GNode* g_node_insert (GNode *parent, - gint position, - GNode *node); -GLIB_AVAILABLE_IN_ALL -GNode* g_node_insert_before (GNode *parent, - GNode *sibling, - GNode *node); -GLIB_AVAILABLE_IN_ALL -GNode* g_node_insert_after (GNode *parent, - GNode *sibling, - GNode *node); -GLIB_AVAILABLE_IN_ALL -GNode* g_node_prepend (GNode *parent, - GNode *node); -GLIB_AVAILABLE_IN_ALL -guint g_node_n_nodes (GNode *root, - GTraverseFlags flags); -GLIB_AVAILABLE_IN_ALL -GNode* g_node_get_root (GNode *node); -GLIB_AVAILABLE_IN_ALL -gboolean g_node_is_ancestor (GNode *node, - GNode *descendant); -GLIB_AVAILABLE_IN_ALL -guint g_node_depth (GNode *node); -GLIB_AVAILABLE_IN_ALL -GNode* g_node_find (GNode *root, - GTraverseType order, - GTraverseFlags flags, - gpointer data); - -/* convenience macros */ -/** - * g_node_append: - * @parent: the #GNode to place the new #GNode under - * @node: the #GNode to insert - * - * Inserts a #GNode as the last child of the given parent. - * - * Returns: the inserted #GNode - */ -#define g_node_append(parent, node) \ - g_node_insert_before ((parent), NULL, (node)) - -/** - * g_node_insert_data: - * @parent: the #GNode to place the new #GNode under - * @position: the position to place the new #GNode at. If position is -1, - * the new #GNode is inserted as the last child of @parent - * @data: the data for the new #GNode - * - * Inserts a new #GNode at the given position. - * - * Returns: the new #GNode - */ -#define g_node_insert_data(parent, position, data) \ - g_node_insert ((parent), (position), g_node_new (data)) - -/** - * g_node_insert_data_after: - * @parent: the #GNode to place the new #GNode under - * @sibling: the sibling #GNode to place the new #GNode after - * @data: the data for the new #GNode - * - * Inserts a new #GNode after the given sibling. - * - * Returns: the new #GNode - */ - -#define g_node_insert_data_after(parent, sibling, data) \ - g_node_insert_after ((parent), (sibling), g_node_new (data)) -/** - * g_node_insert_data_before: - * @parent: the #GNode to place the new #GNode under - * @sibling: the sibling #GNode to place the new #GNode before - * @data: the data for the new #GNode - * - * Inserts a new #GNode before the given sibling. - * - * Returns: the new #GNode - */ -#define g_node_insert_data_before(parent, sibling, data) \ - g_node_insert_before ((parent), (sibling), g_node_new (data)) - -/** - * g_node_prepend_data: - * @parent: the #GNode to place the new #GNode under - * @data: the data for the new #GNode - * - * Inserts a new #GNode as the first child of the given parent. - * - * Returns: the new #GNode - */ -#define g_node_prepend_data(parent, data) \ - g_node_prepend ((parent), g_node_new (data)) - -/** - * g_node_append_data: - * @parent: the #GNode to place the new #GNode under - * @data: the data for the new #GNode - * - * Inserts a new #GNode as the last child of the given parent. - * - * Returns: the new #GNode - */ -#define g_node_append_data(parent, data) \ - g_node_insert_before ((parent), NULL, g_node_new (data)) - -/* traversal function, assumes that 'node' is root - * (only traverses 'node' and its subtree). - * this function is just a high level interface to - * low level traversal functions, optimized for speed. - */ -GLIB_AVAILABLE_IN_ALL -void g_node_traverse (GNode *root, - GTraverseType order, - GTraverseFlags flags, - gint max_depth, - GNodeTraverseFunc func, - gpointer data); - -/* return the maximum tree height starting with 'node', this is an expensive - * operation, since we need to visit all nodes. this could be shortened by - * adding 'guint height' to struct _GNode, but then again, this is not very - * often needed, and would make g_node_insert() more time consuming. - */ -GLIB_AVAILABLE_IN_ALL -guint g_node_max_height (GNode *root); - -GLIB_AVAILABLE_IN_ALL -void g_node_children_foreach (GNode *node, - GTraverseFlags flags, - GNodeForeachFunc func, - gpointer data); -GLIB_AVAILABLE_IN_ALL -void g_node_reverse_children (GNode *node); -GLIB_AVAILABLE_IN_ALL -guint g_node_n_children (GNode *node); -GLIB_AVAILABLE_IN_ALL -GNode* g_node_nth_child (GNode *node, - guint n); -GLIB_AVAILABLE_IN_ALL -GNode* g_node_last_child (GNode *node); -GLIB_AVAILABLE_IN_ALL -GNode* g_node_find_child (GNode *node, - GTraverseFlags flags, - gpointer data); -GLIB_AVAILABLE_IN_ALL -gint g_node_child_position (GNode *node, - GNode *child); -GLIB_AVAILABLE_IN_ALL -gint g_node_child_index (GNode *node, - gpointer data); - -GLIB_AVAILABLE_IN_ALL -GNode* g_node_first_sibling (GNode *node); -GLIB_AVAILABLE_IN_ALL -GNode* g_node_last_sibling (GNode *node); - -/** - * g_node_prev_sibling: - * @node: a #GNode - * - * Gets the previous sibling of a #GNode. - * - * Returns: the previous sibling of @node, or %NULL if @node is the first - * node or %NULL - */ -#define g_node_prev_sibling(node) ((node) ? \ - ((GNode*) (node))->prev : NULL) - -/** - * g_node_next_sibling: - * @node: a #GNode - * - * Gets the next sibling of a #GNode. - * - * Returns: the next sibling of @node, or %NULL if @node is the last node - * or %NULL - */ -#define g_node_next_sibling(node) ((node) ? \ - ((GNode*) (node))->next : NULL) - -/** - * g_node_first_child: - * @node: a #GNode - * - * Gets the first child of a #GNode. - * - * Returns: the first child of @node, or %NULL if @node is %NULL - * or has no children - */ -#define g_node_first_child(node) ((node) ? \ - ((GNode*) (node))->children : NULL) - -G_END_DECLS - -#endif /* __G_NODE_H__ */ - -G_BEGIN_DECLS - -typedef struct _GList GList; - -struct _GList -{ - gpointer data; - GList *next; - GList *prev; -}; - -/* Doubly linked lists - */ -GLIB_AVAILABLE_IN_ALL -GList* g_list_alloc (void) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -void g_list_free (GList *list); -GLIB_AVAILABLE_IN_ALL -void g_list_free_1 (GList *list); -#define g_list_free1 g_list_free_1 -GLIB_AVAILABLE_IN_ALL -void g_list_free_full (GList *list, - GDestroyNotify free_func); -GLIB_AVAILABLE_IN_ALL -GList* g_list_append (GList *list, - gpointer data) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GList* g_list_prepend (GList *list, - gpointer data) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GList* g_list_insert (GList *list, - gpointer data, - gint position) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GList* g_list_insert_sorted (GList *list, - gpointer data, - GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GList* g_list_insert_sorted_with_data (GList *list, - gpointer data, - GCompareDataFunc func, - gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GList* g_list_insert_before (GList *list, - GList *sibling, - gpointer data) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_2_62 -GList* g_list_insert_before_link (GList *list, - GList *sibling, - GList *link_) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GList* g_list_concat (GList *list1, - GList *list2) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GList* g_list_remove (GList *list, - gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GList* g_list_remove_all (GList *list, - gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GList* g_list_remove_link (GList *list, - GList *llink) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GList* g_list_delete_link (GList *list, - GList *link_) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GList* g_list_reverse (GList *list) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GList* g_list_copy (GList *list) G_GNUC_WARN_UNUSED_RESULT; - -GLIB_AVAILABLE_IN_2_34 -GList* g_list_copy_deep (GList *list, - GCopyFunc func, - gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; - -GLIB_AVAILABLE_IN_ALL -GList* g_list_nth (GList *list, - guint n); -GLIB_AVAILABLE_IN_ALL -GList* g_list_nth_prev (GList *list, - guint n); -GLIB_AVAILABLE_IN_ALL -GList* g_list_find (GList *list, - gconstpointer data); -GLIB_AVAILABLE_IN_ALL -GList* g_list_find_custom (GList *list, - gconstpointer data, - GCompareFunc func); -GLIB_AVAILABLE_IN_ALL -gint g_list_position (GList *list, - GList *llink); -GLIB_AVAILABLE_IN_ALL -gint g_list_index (GList *list, - gconstpointer data); -GLIB_AVAILABLE_IN_ALL -GList* g_list_last (GList *list); -GLIB_AVAILABLE_IN_ALL -GList* g_list_first (GList *list); -GLIB_AVAILABLE_IN_ALL -guint g_list_length (GList *list); -GLIB_AVAILABLE_IN_ALL -void g_list_foreach (GList *list, - GFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -GList* g_list_sort (GList *list, - GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GList* g_list_sort_with_data (GList *list, - GCompareDataFunc compare_func, - gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -gpointer g_list_nth_data (GList *list, - guint n); - -GLIB_AVAILABLE_IN_2_64 -void g_clear_list (GList **list_ptr, - GDestroyNotify destroy); - -#undef g_clear_list -#define g_clear_list(list_ptr, destroy) \ - G_STMT_START { \ - GList *_list; \ - \ - _list = *(list_ptr); \ - if (_list) \ - { \ - *list_ptr = NULL; \ - \ - if ((destroy) != NULL) \ - g_list_free_full (_list, (destroy)); \ - else \ - g_list_free (_list); \ - } \ - } G_STMT_END \ - GLIB_AVAILABLE_MACRO_IN_2_64 - - -#define g_list_previous(list) ((list) ? (((GList *)(list))->prev) : NULL) -#define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL) - -G_END_DECLS - -#endif /* __G_LIST_H__ */ - -G_BEGIN_DECLS - -typedef struct _GHashTable GHashTable; - -typedef gboolean (*GHRFunc) (gpointer key, - gpointer value, - gpointer user_data); - -typedef struct _GHashTableIter GHashTableIter; - -struct _GHashTableIter -{ - /*< private >*/ - gpointer dummy1; - gpointer dummy2; - gpointer dummy3; - int dummy4; - gboolean dummy5; - gpointer dummy6; -}; - -GLIB_AVAILABLE_IN_ALL -GHashTable* g_hash_table_new (GHashFunc hash_func, - GEqualFunc key_equal_func); -GLIB_AVAILABLE_IN_ALL -GHashTable* g_hash_table_new_full (GHashFunc hash_func, - GEqualFunc key_equal_func, - GDestroyNotify key_destroy_func, - GDestroyNotify value_destroy_func); -GLIB_AVAILABLE_IN_ALL -void g_hash_table_destroy (GHashTable *hash_table); -GLIB_AVAILABLE_IN_ALL -gboolean g_hash_table_insert (GHashTable *hash_table, - gpointer key, - gpointer value); -GLIB_AVAILABLE_IN_ALL -gboolean g_hash_table_replace (GHashTable *hash_table, - gpointer key, - gpointer value); -GLIB_AVAILABLE_IN_ALL -gboolean g_hash_table_add (GHashTable *hash_table, - gpointer key); -GLIB_AVAILABLE_IN_ALL -gboolean g_hash_table_remove (GHashTable *hash_table, - gconstpointer key); -GLIB_AVAILABLE_IN_ALL -void g_hash_table_remove_all (GHashTable *hash_table); -GLIB_AVAILABLE_IN_ALL -gboolean g_hash_table_steal (GHashTable *hash_table, - gconstpointer key); -GLIB_AVAILABLE_IN_2_58 -gboolean g_hash_table_steal_extended (GHashTable *hash_table, - gconstpointer lookup_key, - gpointer *stolen_key, - gpointer *stolen_value); -GLIB_AVAILABLE_IN_ALL -void g_hash_table_steal_all (GHashTable *hash_table); -GLIB_AVAILABLE_IN_ALL -gpointer g_hash_table_lookup (GHashTable *hash_table, - gconstpointer key); -GLIB_AVAILABLE_IN_ALL -gboolean g_hash_table_contains (GHashTable *hash_table, - gconstpointer key); -GLIB_AVAILABLE_IN_ALL -gboolean g_hash_table_lookup_extended (GHashTable *hash_table, - gconstpointer lookup_key, - gpointer *orig_key, - gpointer *value); -GLIB_AVAILABLE_IN_ALL -void g_hash_table_foreach (GHashTable *hash_table, - GHFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -gpointer g_hash_table_find (GHashTable *hash_table, - GHRFunc predicate, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -guint g_hash_table_foreach_remove (GHashTable *hash_table, - GHRFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -guint g_hash_table_foreach_steal (GHashTable *hash_table, - GHRFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -guint g_hash_table_size (GHashTable *hash_table); -GLIB_AVAILABLE_IN_ALL -GList * g_hash_table_get_keys (GHashTable *hash_table); -GLIB_AVAILABLE_IN_ALL -GList * g_hash_table_get_values (GHashTable *hash_table); -GLIB_AVAILABLE_IN_2_40 -gpointer * g_hash_table_get_keys_as_array (GHashTable *hash_table, - guint *length); - -GLIB_AVAILABLE_IN_ALL -void g_hash_table_iter_init (GHashTableIter *iter, - GHashTable *hash_table); -GLIB_AVAILABLE_IN_ALL -gboolean g_hash_table_iter_next (GHashTableIter *iter, - gpointer *key, - gpointer *value); -GLIB_AVAILABLE_IN_ALL -GHashTable* g_hash_table_iter_get_hash_table (GHashTableIter *iter); -GLIB_AVAILABLE_IN_ALL -void g_hash_table_iter_remove (GHashTableIter *iter); -GLIB_AVAILABLE_IN_2_30 -void g_hash_table_iter_replace (GHashTableIter *iter, - gpointer value); -GLIB_AVAILABLE_IN_ALL -void g_hash_table_iter_steal (GHashTableIter *iter); - -GLIB_AVAILABLE_IN_ALL -GHashTable* g_hash_table_ref (GHashTable *hash_table); -GLIB_AVAILABLE_IN_ALL -void g_hash_table_unref (GHashTable *hash_table); - -#define g_hash_table_freeze(hash_table) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26 -#define g_hash_table_thaw(hash_table) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26 - -/* Hash Functions - */ -GLIB_AVAILABLE_IN_ALL -gboolean g_str_equal (gconstpointer v1, - gconstpointer v2); -GLIB_AVAILABLE_IN_ALL -guint g_str_hash (gconstpointer v); - -GLIB_AVAILABLE_IN_ALL -gboolean g_int_equal (gconstpointer v1, - gconstpointer v2); -GLIB_AVAILABLE_IN_ALL -guint g_int_hash (gconstpointer v); - -GLIB_AVAILABLE_IN_ALL -gboolean g_int64_equal (gconstpointer v1, - gconstpointer v2); -GLIB_AVAILABLE_IN_ALL -guint g_int64_hash (gconstpointer v); - -GLIB_AVAILABLE_IN_ALL -gboolean g_double_equal (gconstpointer v1, - gconstpointer v2); -GLIB_AVAILABLE_IN_ALL -guint g_double_hash (gconstpointer v); - -GLIB_AVAILABLE_IN_ALL -guint g_direct_hash (gconstpointer v) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_direct_equal (gconstpointer v1, - gconstpointer v2) G_GNUC_CONST; - -G_END_DECLS - -#endif /* __G_HASH_H__ */ -/* ghmac.h - secure data hashing - * - * Copyright (C) 2011 Stef Walter - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_HMAC_H__ -#define __G_HMAC_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/** - * GHmac: - * - * An opaque structure representing a HMAC operation. - * To create a new GHmac, use g_hmac_new(). To free - * a GHmac, use g_hmac_unref(). - * - * Since: 2.30 - */ -typedef struct _GHmac GHmac; - -GLIB_AVAILABLE_IN_2_30 -GHmac * g_hmac_new (GChecksumType digest_type, - const guchar *key, - gsize key_len); -GLIB_AVAILABLE_IN_2_30 -GHmac * g_hmac_copy (const GHmac *hmac); -GLIB_AVAILABLE_IN_2_30 -GHmac * g_hmac_ref (GHmac *hmac); -GLIB_AVAILABLE_IN_2_30 -void g_hmac_unref (GHmac *hmac); -GLIB_AVAILABLE_IN_2_30 -void g_hmac_update (GHmac *hmac, - const guchar *data, - gssize length); -GLIB_AVAILABLE_IN_2_30 -const gchar * g_hmac_get_string (GHmac *hmac); -GLIB_AVAILABLE_IN_2_30 -void g_hmac_get_digest (GHmac *hmac, - guint8 *buffer, - gsize *digest_len); - -GLIB_AVAILABLE_IN_2_30 -gchar *g_compute_hmac_for_data (GChecksumType digest_type, - const guchar *key, - gsize key_len, - const guchar *data, - gsize length); -GLIB_AVAILABLE_IN_2_30 -gchar *g_compute_hmac_for_string (GChecksumType digest_type, - const guchar *key, - gsize key_len, - const gchar *str, - gssize length); -GLIB_AVAILABLE_IN_2_50 -gchar *g_compute_hmac_for_bytes (GChecksumType digest_type, - GBytes *key, - GBytes *data); - - -G_END_DECLS - -#endif /* __G_CHECKSUM_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_HOOK_H__ -#define __G_HOOK_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - - -/* --- typedefs --- */ -typedef struct _GHook GHook; -typedef struct _GHookList GHookList; - -typedef gint (*GHookCompareFunc) (GHook *new_hook, - GHook *sibling); -typedef gboolean (*GHookFindFunc) (GHook *hook, - gpointer data); -typedef void (*GHookMarshaller) (GHook *hook, - gpointer marshal_data); -typedef gboolean (*GHookCheckMarshaller) (GHook *hook, - gpointer marshal_data); -typedef void (*GHookFunc) (gpointer data); -typedef gboolean (*GHookCheckFunc) (gpointer data); -typedef void (*GHookFinalizeFunc) (GHookList *hook_list, - GHook *hook); -typedef enum -{ - G_HOOK_FLAG_ACTIVE = 1 << 0, - G_HOOK_FLAG_IN_CALL = 1 << 1, - G_HOOK_FLAG_MASK = 0x0f -} GHookFlagMask; -#define G_HOOK_FLAG_USER_SHIFT (4) - - -/* --- structures --- */ -struct _GHookList -{ - gulong seq_id; - guint hook_size : 16; - guint is_setup : 1; - GHook *hooks; - gpointer dummy3; - GHookFinalizeFunc finalize_hook; - gpointer dummy[2]; -}; -struct _GHook -{ - gpointer data; - GHook *next; - GHook *prev; - guint ref_count; - gulong hook_id; - guint flags; - gpointer func; - GDestroyNotify destroy; -}; - - -/* --- macros --- */ -#define G_HOOK(hook) ((GHook*) (hook)) -#define G_HOOK_FLAGS(hook) (G_HOOK (hook)->flags) -#define G_HOOK_ACTIVE(hook) ((G_HOOK_FLAGS (hook) & \ - G_HOOK_FLAG_ACTIVE) != 0) -#define G_HOOK_IN_CALL(hook) ((G_HOOK_FLAGS (hook) & \ - G_HOOK_FLAG_IN_CALL) != 0) -#define G_HOOK_IS_VALID(hook) (G_HOOK (hook)->hook_id != 0 && \ - (G_HOOK_FLAGS (hook) & \ - G_HOOK_FLAG_ACTIVE)) -#define G_HOOK_IS_UNLINKED(hook) (G_HOOK (hook)->next == NULL && \ - G_HOOK (hook)->prev == NULL && \ - G_HOOK (hook)->hook_id == 0 && \ - G_HOOK (hook)->ref_count == 0) - - -/* --- prototypes --- */ -/* callback maintenance functions */ -GLIB_AVAILABLE_IN_ALL -void g_hook_list_init (GHookList *hook_list, - guint hook_size); -GLIB_AVAILABLE_IN_ALL -void g_hook_list_clear (GHookList *hook_list); -GLIB_AVAILABLE_IN_ALL -GHook* g_hook_alloc (GHookList *hook_list); -GLIB_AVAILABLE_IN_ALL -void g_hook_free (GHookList *hook_list, - GHook *hook); -GLIB_AVAILABLE_IN_ALL -GHook * g_hook_ref (GHookList *hook_list, - GHook *hook); -GLIB_AVAILABLE_IN_ALL -void g_hook_unref (GHookList *hook_list, - GHook *hook); -GLIB_AVAILABLE_IN_ALL -gboolean g_hook_destroy (GHookList *hook_list, - gulong hook_id); -GLIB_AVAILABLE_IN_ALL -void g_hook_destroy_link (GHookList *hook_list, - GHook *hook); -GLIB_AVAILABLE_IN_ALL -void g_hook_prepend (GHookList *hook_list, - GHook *hook); -GLIB_AVAILABLE_IN_ALL -void g_hook_insert_before (GHookList *hook_list, - GHook *sibling, - GHook *hook); -GLIB_AVAILABLE_IN_ALL -void g_hook_insert_sorted (GHookList *hook_list, - GHook *hook, - GHookCompareFunc func); -GLIB_AVAILABLE_IN_ALL -GHook* g_hook_get (GHookList *hook_list, - gulong hook_id); -GLIB_AVAILABLE_IN_ALL -GHook* g_hook_find (GHookList *hook_list, - gboolean need_valids, - GHookFindFunc func, - gpointer data); -GLIB_AVAILABLE_IN_ALL -GHook* g_hook_find_data (GHookList *hook_list, - gboolean need_valids, - gpointer data); -GLIB_AVAILABLE_IN_ALL -GHook* g_hook_find_func (GHookList *hook_list, - gboolean need_valids, - gpointer func); -GLIB_AVAILABLE_IN_ALL -GHook* g_hook_find_func_data (GHookList *hook_list, - gboolean need_valids, - gpointer func, - gpointer data); -/* return the first valid hook, and increment its reference count */ -GLIB_AVAILABLE_IN_ALL -GHook* g_hook_first_valid (GHookList *hook_list, - gboolean may_be_in_call); -/* return the next valid hook with incremented reference count, and - * decrement the reference count of the original hook - */ -GLIB_AVAILABLE_IN_ALL -GHook* g_hook_next_valid (GHookList *hook_list, - GHook *hook, - gboolean may_be_in_call); -/* GHookCompareFunc implementation to insert hooks sorted by their id */ -GLIB_AVAILABLE_IN_ALL -gint g_hook_compare_ids (GHook *new_hook, - GHook *sibling); -/* convenience macros */ -#define g_hook_append( hook_list, hook ) \ - g_hook_insert_before ((hook_list), NULL, (hook)) -/* invoke all valid hooks with the (*GHookFunc) signature. - */ -GLIB_AVAILABLE_IN_ALL -void g_hook_list_invoke (GHookList *hook_list, - gboolean may_recurse); -/* invoke all valid hooks with the (*GHookCheckFunc) signature, - * and destroy the hook if FALSE is returned. - */ -GLIB_AVAILABLE_IN_ALL -void g_hook_list_invoke_check (GHookList *hook_list, - gboolean may_recurse); -/* invoke a marshaller on all valid hooks. - */ -GLIB_AVAILABLE_IN_ALL -void g_hook_list_marshal (GHookList *hook_list, - gboolean may_recurse, - GHookMarshaller marshaller, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_hook_list_marshal_check (GHookList *hook_list, - gboolean may_recurse, - GHookCheckMarshaller marshaller, - gpointer marshal_data); - -G_END_DECLS - -#endif /* __G_HOOK_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 2008 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ - -#ifndef __G_HOST_UTILS_H__ -#define __G_HOST_UTILS_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_ALL -gboolean g_hostname_is_non_ascii (const gchar *hostname); -GLIB_AVAILABLE_IN_ALL -gboolean g_hostname_is_ascii_encoded (const gchar *hostname); -GLIB_AVAILABLE_IN_ALL -gboolean g_hostname_is_ip_address (const gchar *hostname); - -GLIB_AVAILABLE_IN_ALL -gchar *g_hostname_to_ascii (const gchar *hostname); -GLIB_AVAILABLE_IN_ALL -gchar *g_hostname_to_unicode (const gchar *hostname); - -G_END_DECLS - -#endif /* __G_HOST_UTILS_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_IOCHANNEL_H__ -#define __G_IOCHANNEL_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -/* gmain.h - the GLib Main loop - * Copyright (C) 1998-2000 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_MAIN_H__ -#define __G_MAIN_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -/* gpoll.h - poll(2) support - * Copyright (C) 2008 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_POLL_H__ -#define __G_POLL_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (__G_MAIN_H__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/* Any definitions using GPollFD or GPollFunc are primarily - * for Unix and not guaranteed to be the compatible on all - * operating systems on which GLib runs. Right now, the - * GLib does use these functions on Win32 as well, but interprets - * them in a fairly different way than on Unix. If you use - * these definitions, you are should be prepared to recode - * for different operating systems. - * - * Note that on systems with a working poll(2), that function is used - * in place of g_poll(). Thus g_poll() must have the same signature as - * poll(), meaning GPollFD must have the same layout as struct pollfd. - * - * On Win32, the fd in a GPollFD should be Win32 HANDLE (*not* a file - * descriptor as provided by the C runtime) that can be used by - * MsgWaitForMultipleObjects. This does *not* include file handles - * from CreateFile, SOCKETs, nor pipe handles. (But you can use - * WSAEventSelect to signal events when a SOCKET is readable). - * - * On Win32, fd can also be the special value G_WIN32_MSG_HANDLE to - * indicate polling for messages. - * - * But note that G_WIN32_MSG_HANDLE GPollFDs should not be used by GDK - * (GTK) programs, as GDK itself wants to read messages and convert them - * to GDK events. - * - * So, unless you really know what you are doing, it's best not to try - * to use the main loop polling stuff for your own needs on - * Windows. - */ -typedef struct _GPollFD GPollFD; - -/** - * GPollFunc: - * @ufds: an array of #GPollFD elements - * @nfsd: the number of elements in @ufds - * @timeout_: the maximum time to wait for an event of the file descriptors. - * A negative value indicates an infinite timeout. - * - * Specifies the type of function passed to g_main_context_set_poll_func(). - * The semantics of the function should match those of the poll() system call. - * - * Returns: the number of #GPollFD elements which have events or errors - * reported, or -1 if an error occurred. - */ -typedef gint (*GPollFunc) (GPollFD *ufds, - guint nfsd, - gint timeout_); - -/** - * GPollFD: - * @fd: the file descriptor to poll (or a HANDLE on Win32) - * @events: a bitwise combination from #GIOCondition, specifying which - * events should be polled for. Typically for reading from a file - * descriptor you would use %G_IO_IN | %G_IO_HUP | %G_IO_ERR, and - * for writing you would use %G_IO_OUT | %G_IO_ERR. - * @revents: a bitwise combination of flags from #GIOCondition, returned - * from the poll() function to indicate which events occurred. - * - * Represents a file descriptor, which events to poll for, and which events - * occurred. - */ -struct _GPollFD -{ -#if defined (G_OS_WIN32) && GLIB_SIZEOF_VOID_P == 8 -#ifndef __GTK_DOC_IGNORE__ - gint64 fd; -#endif -#else - gint fd; -#endif - gushort events; - gushort revents; -}; - -/** - * G_POLLFD_FORMAT: - * - * A format specifier that can be used in printf()-style format strings - * when printing the @fd member of a #GPollFD. - */ -/* defined in glibconfig.h */ - -GLIB_AVAILABLE_IN_ALL -gint -g_poll (GPollFD *fds, - guint nfds, - gint timeout); - -G_END_DECLS - -#endif /* __G_POLL_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_SLIST_H__ -#define __G_SLIST_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GSList GSList; - -struct _GSList -{ - gpointer data; - GSList *next; -}; - -/* Singly linked lists - */ -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_alloc (void) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -void g_slist_free (GSList *list); -GLIB_AVAILABLE_IN_ALL -void g_slist_free_1 (GSList *list); -#define g_slist_free1 g_slist_free_1 -GLIB_AVAILABLE_IN_ALL -void g_slist_free_full (GSList *list, - GDestroyNotify free_func); -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_append (GSList *list, - gpointer data) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_prepend (GSList *list, - gpointer data) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_insert (GSList *list, - gpointer data, - gint position) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_insert_sorted (GSList *list, - gpointer data, - GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_insert_sorted_with_data (GSList *list, - gpointer data, - GCompareDataFunc func, - gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_insert_before (GSList *slist, - GSList *sibling, - gpointer data) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_concat (GSList *list1, - GSList *list2) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_remove (GSList *list, - gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_remove_all (GSList *list, - gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_remove_link (GSList *list, - GSList *link_) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_delete_link (GSList *list, - GSList *link_) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_reverse (GSList *list) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_copy (GSList *list) G_GNUC_WARN_UNUSED_RESULT; - -GLIB_AVAILABLE_IN_2_34 -GSList* g_slist_copy_deep (GSList *list, - GCopyFunc func, - gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_nth (GSList *list, - guint n); -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_find (GSList *list, - gconstpointer data); -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_find_custom (GSList *list, - gconstpointer data, - GCompareFunc func); -GLIB_AVAILABLE_IN_ALL -gint g_slist_position (GSList *list, - GSList *llink); -GLIB_AVAILABLE_IN_ALL -gint g_slist_index (GSList *list, - gconstpointer data); -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_last (GSList *list); -GLIB_AVAILABLE_IN_ALL -guint g_slist_length (GSList *list); -GLIB_AVAILABLE_IN_ALL -void g_slist_foreach (GSList *list, - GFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_sort (GSList *list, - GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -GSList* g_slist_sort_with_data (GSList *list, - GCompareDataFunc compare_func, - gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; -GLIB_AVAILABLE_IN_ALL -gpointer g_slist_nth_data (GSList *list, - guint n); - -GLIB_AVAILABLE_IN_2_64 -void g_clear_slist (GSList **slist_ptr, - GDestroyNotify destroy); - -#undef g_clear_slist -#define g_clear_slist(slist_ptr, destroy) \ - G_STMT_START { \ - GSList *_slist; \ - \ - _slist = *(slist_ptr); \ - if (_slist) \ - { \ - *slist_ptr = NULL; \ - \ - if ((destroy) != NULL) \ - g_slist_free_full (_slist, (destroy)); \ - else \ - g_slist_free (_slist); \ - } \ - } G_STMT_END \ - GLIB_AVAILABLE_MACRO_IN_2_64 - -#define g_slist_next(slist) ((slist) ? (((GSList *)(slist))->next) : NULL) - -G_END_DECLS - -#endif /* __G_SLIST_H__ */ - -G_BEGIN_DECLS - -typedef enum /*< flags >*/ -{ - G_IO_IN GLIB_SYSDEF_POLLIN, - G_IO_OUT GLIB_SYSDEF_POLLOUT, - G_IO_PRI GLIB_SYSDEF_POLLPRI, - G_IO_ERR GLIB_SYSDEF_POLLERR, - G_IO_HUP GLIB_SYSDEF_POLLHUP, - G_IO_NVAL GLIB_SYSDEF_POLLNVAL -} GIOCondition; - - -/** - * GMainContext: - * - * The `GMainContext` struct is an opaque data - * type representing a set of sources to be handled in a main loop. - */ -typedef struct _GMainContext GMainContext; - -/** - * GMainLoop: - * - * The `GMainLoop` struct is an opaque data type - * representing the main event loop of a GLib or GTK+ application. - */ -typedef struct _GMainLoop GMainLoop; - -/** - * GSource: - * - * The `GSource` struct is an opaque data type - * representing an event source. - */ -typedef struct _GSource GSource; -typedef struct _GSourcePrivate GSourcePrivate; - -/** - * GSourceCallbackFuncs: - * @ref: Called when a reference is added to the callback object - * @unref: Called when a reference to the callback object is dropped - * @get: Called to extract the callback function and data from the - * callback object. - * - * The `GSourceCallbackFuncs` struct contains - * functions for managing callback objects. - */ -typedef struct _GSourceCallbackFuncs GSourceCallbackFuncs; - -/** - * GSourceFuncs: - * @prepare: Called before all the file descriptors are polled. If the - * source can determine that it is ready here (without waiting for the - * results of the poll() call) it should return %TRUE. It can also return - * a @timeout_ value which should be the maximum timeout (in milliseconds) - * which should be passed to the poll() call. The actual timeout used will - * be -1 if all sources returned -1, or it will be the minimum of all - * the @timeout_ values returned which were >= 0. Since 2.36 this may - * be %NULL, in which case the effect is as if the function always returns - * %FALSE with a timeout of -1. If @prepare returns a - * timeout and the source also has a ready time set, then the - * lower of the two will be used. - * @check: Called after all the file descriptors are polled. The source - * should return %TRUE if it is ready to be dispatched. Note that some - * time may have passed since the previous prepare function was called, - * so the source should be checked again here. Since 2.36 this may - * be %NULL, in which case the effect is as if the function always returns - * %FALSE. - * @dispatch: Called to dispatch the event source, after it has returned - * %TRUE in either its @prepare or its @check function, or if a ready time - * has been reached. The @dispatch function receives a callback function and - * user data. The callback function may be %NULL if the source was never - * connected to a callback using g_source_set_callback(). The @dispatch - * function should call the callback function with @user_data and whatever - * additional parameters are needed for this type of event source. The - * return value of the @dispatch function should be #G_SOURCE_REMOVE if the - * source should be removed or #G_SOURCE_CONTINUE to keep it. - * @finalize: Called when the source is finalized. At this point, the source - * will have been destroyed, had its callback cleared, and have been removed - * from its #GMainContext, but it will still have its final reference count, - * so methods can be called on it from within this function. - * - * The `GSourceFuncs` struct contains a table of - * functions used to handle event sources in a generic manner. - * - * For idle sources, the prepare and check functions always return %TRUE - * to indicate that the source is always ready to be processed. The prepare - * function also returns a timeout value of 0 to ensure that the poll() call - * doesn't block (since that would be time wasted which could have been spent - * running the idle function). - * - * For timeout sources, the prepare and check functions both return %TRUE - * if the timeout interval has expired. The prepare function also returns - * a timeout value to ensure that the poll() call doesn't block too long - * and miss the next timeout. - * - * For file descriptor sources, the prepare function typically returns %FALSE, - * since it must wait until poll() has been called before it knows whether - * any events need to be processed. It sets the returned timeout to -1 to - * indicate that it doesn't mind how long the poll() call blocks. In the - * check function, it tests the results of the poll() call to see if the - * required condition has been met, and returns %TRUE if so. - */ -typedef struct _GSourceFuncs GSourceFuncs; - -/** - * GPid: - * - * A type which is used to hold a process identification. - * - * On UNIX, processes are identified by a process id (an integer), - * while Windows uses process handles (which are pointers). - * - * GPid is used in GLib only for descendant processes spawned with - * the g_spawn functions. - */ -/* defined in glibconfig.h */ - -/** - * G_PID_FORMAT: - * - * A format specifier that can be used in printf()-style format strings - * when printing a #GPid. - * - * Since: 2.50 - */ -/* defined in glibconfig.h */ - -/** - * GSourceFunc: - * @user_data: data passed to the function, set when the source was - * created with one of the above functions - * - * Specifies the type of function passed to g_timeout_add(), - * g_timeout_add_full(), g_idle_add(), and g_idle_add_full(). - * - * When calling g_source_set_callback(), you may need to cast a function of a - * different type to this type. Use G_SOURCE_FUNC() to avoid warnings about - * incompatible function types. - * - * Returns: %FALSE if the source should be removed. #G_SOURCE_CONTINUE and - * #G_SOURCE_REMOVE are more memorable names for the return value. - */ -typedef gboolean (*GSourceFunc) (gpointer user_data); - -/** - * G_SOURCE_FUNC: - * @f: a function pointer. - * - * Cast a function pointer to a #GSourceFunc, suppressing warnings from GCC 8 - * onwards with `-Wextra` or `-Wcast-function-type` enabled about the function - * types being incompatible. - * - * For example, the correct type of callback for a source created by - * g_child_watch_source_new() is #GChildWatchFunc, which accepts more arguments - * than #GSourceFunc. Casting the function with `(GSourceFunc)` to call - * g_source_set_callback() will trigger a warning, even though it will be cast - * back to the correct type before it is called by the source. - * - * Since: 2.58 - */ -#define G_SOURCE_FUNC(f) ((GSourceFunc) (void (*)(void)) (f)) GLIB_AVAILABLE_MACRO_IN_2_58 - -/** - * GChildWatchFunc: - * @pid: the process id of the child process - * @status: Status information about the child process, encoded - * in a platform-specific manner - * @user_data: user data passed to g_child_watch_add() - * - * Prototype of a #GChildWatchSource callback, called when a child - * process has exited. To interpret @status, see the documentation - * for g_spawn_check_exit_status(). - */ -typedef void (*GChildWatchFunc) (GPid pid, - gint status, - gpointer user_data); - - -/** - * GSourceDisposeFunc: - * @source: #GSource that is currently being disposed - * - * Dispose function for @source. See g_source_set_dispose_function() for - * details. - * - * Since: 2.64 - */ -GLIB_AVAILABLE_TYPE_IN_2_64 -typedef void (*GSourceDisposeFunc) (GSource *source); - -struct _GSource -{ - /*< private >*/ - gpointer callback_data; - GSourceCallbackFuncs *callback_funcs; - - const GSourceFuncs *source_funcs; - guint ref_count; - - GMainContext *context; - - gint priority; - guint flags; - guint source_id; - - GSList *poll_fds; - - GSource *prev; - GSource *next; - - char *name; - - GSourcePrivate *priv; -}; - -struct _GSourceCallbackFuncs -{ - void (*ref) (gpointer cb_data); - void (*unref) (gpointer cb_data); - void (*get) (gpointer cb_data, - GSource *source, - GSourceFunc *func, - gpointer *data); -}; - -/** - * GSourceDummyMarshal: - * - * This is just a placeholder for #GClosureMarshal, - * which cannot be used here for dependency reasons. - */ -typedef void (*GSourceDummyMarshal) (void); - -struct _GSourceFuncs -{ - gboolean (*prepare) (GSource *source, - gint *timeout_); - gboolean (*check) (GSource *source); - gboolean (*dispatch) (GSource *source, - GSourceFunc callback, - gpointer user_data); - void (*finalize) (GSource *source); /* Can be NULL */ - - /*< private >*/ - /* For use by g_source_set_closure */ - GSourceFunc closure_callback; - GSourceDummyMarshal closure_marshal; /* Really is of type GClosureMarshal */ -}; - -/* Standard priorities */ - -/** - * G_PRIORITY_HIGH: - * - * Use this for high priority event sources. - * - * It is not used within GLib or GTK+. - */ -#define G_PRIORITY_HIGH -100 - -/** - * G_PRIORITY_DEFAULT: - * - * Use this for default priority event sources. - * - * In GLib this priority is used when adding timeout functions - * with g_timeout_add(). In GDK this priority is used for events - * from the X server. - */ -#define G_PRIORITY_DEFAULT 0 - -/** - * G_PRIORITY_HIGH_IDLE: - * - * Use this for high priority idle functions. - * - * GTK+ uses #G_PRIORITY_HIGH_IDLE + 10 for resizing operations, - * and #G_PRIORITY_HIGH_IDLE + 20 for redrawing operations. (This is - * done to ensure that any pending resizes are processed before any - * pending redraws, so that widgets are not redrawn twice unnecessarily.) - */ -#define G_PRIORITY_HIGH_IDLE 100 - -/** - * G_PRIORITY_DEFAULT_IDLE: - * - * Use this for default priority idle functions. - * - * In GLib this priority is used when adding idle functions with - * g_idle_add(). - */ -#define G_PRIORITY_DEFAULT_IDLE 200 - -/** - * G_PRIORITY_LOW: - * - * Use this for very low priority background tasks. - * - * It is not used within GLib or GTK+. - */ -#define G_PRIORITY_LOW 300 - -/** - * G_SOURCE_REMOVE: - * - * Use this macro as the return value of a #GSourceFunc to remove - * the #GSource from the main loop. - * - * Since: 2.32 - */ -#define G_SOURCE_REMOVE FALSE - -/** - * G_SOURCE_CONTINUE: - * - * Use this macro as the return value of a #GSourceFunc to leave - * the #GSource in the main loop. - * - * Since: 2.32 - */ -#define G_SOURCE_CONTINUE TRUE - -/* GMainContext: */ - -GLIB_AVAILABLE_IN_ALL -GMainContext *g_main_context_new (void); -GLIB_AVAILABLE_IN_ALL -GMainContext *g_main_context_ref (GMainContext *context); -GLIB_AVAILABLE_IN_ALL -void g_main_context_unref (GMainContext *context); -GLIB_AVAILABLE_IN_ALL -GMainContext *g_main_context_default (void); - -GLIB_AVAILABLE_IN_ALL -gboolean g_main_context_iteration (GMainContext *context, - gboolean may_block); -GLIB_AVAILABLE_IN_ALL -gboolean g_main_context_pending (GMainContext *context); - -/* For implementation of legacy interfaces - */ -GLIB_AVAILABLE_IN_ALL -GSource *g_main_context_find_source_by_id (GMainContext *context, - guint source_id); -GLIB_AVAILABLE_IN_ALL -GSource *g_main_context_find_source_by_user_data (GMainContext *context, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -GSource *g_main_context_find_source_by_funcs_user_data (GMainContext *context, - GSourceFuncs *funcs, - gpointer user_data); - -/* Low level functions for implementing custom main loops. - */ -GLIB_AVAILABLE_IN_ALL -void g_main_context_wakeup (GMainContext *context); -GLIB_AVAILABLE_IN_ALL -gboolean g_main_context_acquire (GMainContext *context); -GLIB_AVAILABLE_IN_ALL -void g_main_context_release (GMainContext *context); -GLIB_AVAILABLE_IN_ALL -gboolean g_main_context_is_owner (GMainContext *context); -GLIB_DEPRECATED_IN_2_58_FOR(g_main_context_is_owner) -gboolean g_main_context_wait (GMainContext *context, - GCond *cond, - GMutex *mutex); - -GLIB_AVAILABLE_IN_ALL -gboolean g_main_context_prepare (GMainContext *context, - gint *priority); -GLIB_AVAILABLE_IN_ALL -gint g_main_context_query (GMainContext *context, - gint max_priority, - gint *timeout_, - GPollFD *fds, - gint n_fds); -GLIB_AVAILABLE_IN_ALL -gboolean g_main_context_check (GMainContext *context, - gint max_priority, - GPollFD *fds, - gint n_fds); -GLIB_AVAILABLE_IN_ALL -void g_main_context_dispatch (GMainContext *context); - -GLIB_AVAILABLE_IN_ALL -void g_main_context_set_poll_func (GMainContext *context, - GPollFunc func); -GLIB_AVAILABLE_IN_ALL -GPollFunc g_main_context_get_poll_func (GMainContext *context); - -/* Low level functions for use by source implementations - */ -GLIB_AVAILABLE_IN_ALL -void g_main_context_add_poll (GMainContext *context, - GPollFD *fd, - gint priority); -GLIB_AVAILABLE_IN_ALL -void g_main_context_remove_poll (GMainContext *context, - GPollFD *fd); - -GLIB_AVAILABLE_IN_ALL -gint g_main_depth (void); -GLIB_AVAILABLE_IN_ALL -GSource *g_main_current_source (void); - -/* GMainContexts for other threads - */ -GLIB_AVAILABLE_IN_ALL -void g_main_context_push_thread_default (GMainContext *context); -GLIB_AVAILABLE_IN_ALL -void g_main_context_pop_thread_default (GMainContext *context); -GLIB_AVAILABLE_IN_ALL -GMainContext *g_main_context_get_thread_default (void); -GLIB_AVAILABLE_IN_ALL -GMainContext *g_main_context_ref_thread_default (void); - -/** - * GMainContextPusher: - * - * Opaque type. See g_main_context_pusher_new() for details. - * - * Since: 2.64 - */ -typedef void GMainContextPusher GLIB_AVAILABLE_TYPE_IN_2_64; - -/** - * g_main_context_pusher_new: - * @main_context: (transfer none): a main context to push - * - * Push @main_context as the new thread-default main context for the current - * thread, using g_main_context_push_thread_default(), and return a new - * #GMainContextPusher. Pop with g_main_context_pusher_free(). Using - * g_main_context_pop_thread_default() on @main_context while a - * #GMainContextPusher exists for it can lead to undefined behaviour. - * - * Using two #GMainContextPushers in the same scope is not allowed, as it leads - * to an undefined pop order. - * - * This is intended to be used with g_autoptr(). Note that g_autoptr() - * is only available when using GCC or clang, so the following example - * will only work with those compilers: - * |[ - * typedef struct - * { - * ... - * GMainContext *context; - * ... - * } MyObject; - * - * static void - * my_object_do_stuff (MyObject *self) - * { - * g_autoptr(GMainContextPusher) pusher = g_main_context_pusher_new (self->context); - * - * // Code with main context as the thread default here - * - * if (cond) - * // No need to pop - * return; - * - * // Optionally early pop - * g_clear_pointer (&pusher, g_main_context_pusher_free); - * - * // Code with main context no longer the thread default here - * } - * ]| - * - * Returns: (transfer full): a #GMainContextPusher - * Since: 2.64 - */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 -static inline GMainContextPusher * -g_main_context_pusher_new (GMainContext *main_context) -{ - g_main_context_push_thread_default (main_context); - return (GMainContextPusher *) main_context; -} -G_GNUC_END_IGNORE_DEPRECATIONS - -/** - * g_main_context_pusher_free: - * @pusher: (transfer full): a #GMainContextPusher - * - * Pop @pusher’s main context as the thread default main context. - * See g_main_context_pusher_new() for details. - * - * This will pop the #GMainContext as the current thread-default main context, - * but will not call g_main_context_unref() on it. - * - * Since: 2.64 - */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 -static inline void -g_main_context_pusher_free (GMainContextPusher *pusher) -{ - g_main_context_pop_thread_default ((GMainContext *) pusher); -} -G_GNUC_END_IGNORE_DEPRECATIONS - -/* GMainLoop: */ - -GLIB_AVAILABLE_IN_ALL -GMainLoop *g_main_loop_new (GMainContext *context, - gboolean is_running); -GLIB_AVAILABLE_IN_ALL -void g_main_loop_run (GMainLoop *loop); -GLIB_AVAILABLE_IN_ALL -void g_main_loop_quit (GMainLoop *loop); -GLIB_AVAILABLE_IN_ALL -GMainLoop *g_main_loop_ref (GMainLoop *loop); -GLIB_AVAILABLE_IN_ALL -void g_main_loop_unref (GMainLoop *loop); -GLIB_AVAILABLE_IN_ALL -gboolean g_main_loop_is_running (GMainLoop *loop); -GLIB_AVAILABLE_IN_ALL -GMainContext *g_main_loop_get_context (GMainLoop *loop); - -/* GSource: */ - -GLIB_AVAILABLE_IN_ALL -GSource *g_source_new (GSourceFuncs *source_funcs, - guint struct_size); - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_AVAILABLE_IN_2_64 -void g_source_set_dispose_function (GSource *source, - GSourceDisposeFunc dispose); -G_GNUC_END_IGNORE_DEPRECATIONS - -GLIB_AVAILABLE_IN_ALL -GSource *g_source_ref (GSource *source); -GLIB_AVAILABLE_IN_ALL -void g_source_unref (GSource *source); - -GLIB_AVAILABLE_IN_ALL -guint g_source_attach (GSource *source, - GMainContext *context); -GLIB_AVAILABLE_IN_ALL -void g_source_destroy (GSource *source); - -GLIB_AVAILABLE_IN_ALL -void g_source_set_priority (GSource *source, - gint priority); -GLIB_AVAILABLE_IN_ALL -gint g_source_get_priority (GSource *source); -GLIB_AVAILABLE_IN_ALL -void g_source_set_can_recurse (GSource *source, - gboolean can_recurse); -GLIB_AVAILABLE_IN_ALL -gboolean g_source_get_can_recurse (GSource *source); -GLIB_AVAILABLE_IN_ALL -guint g_source_get_id (GSource *source); - -GLIB_AVAILABLE_IN_ALL -GMainContext *g_source_get_context (GSource *source); - -GLIB_AVAILABLE_IN_ALL -void g_source_set_callback (GSource *source, - GSourceFunc func, - gpointer data, - GDestroyNotify notify); - -GLIB_AVAILABLE_IN_ALL -void g_source_set_funcs (GSource *source, - GSourceFuncs *funcs); -GLIB_AVAILABLE_IN_ALL -gboolean g_source_is_destroyed (GSource *source); - -GLIB_AVAILABLE_IN_ALL -void g_source_set_name (GSource *source, - const char *name); -GLIB_AVAILABLE_IN_ALL -const char * g_source_get_name (GSource *source); -GLIB_AVAILABLE_IN_ALL -void g_source_set_name_by_id (guint tag, - const char *name); - -GLIB_AVAILABLE_IN_2_36 -void g_source_set_ready_time (GSource *source, - gint64 ready_time); -GLIB_AVAILABLE_IN_2_36 -gint64 g_source_get_ready_time (GSource *source); - -#ifdef G_OS_UNIX -GLIB_AVAILABLE_IN_2_36 -gpointer g_source_add_unix_fd (GSource *source, - gint fd, - GIOCondition events); -GLIB_AVAILABLE_IN_2_36 -void g_source_modify_unix_fd (GSource *source, - gpointer tag, - GIOCondition new_events); -GLIB_AVAILABLE_IN_2_36 -void g_source_remove_unix_fd (GSource *source, - gpointer tag); -GLIB_AVAILABLE_IN_2_36 -GIOCondition g_source_query_unix_fd (GSource *source, - gpointer tag); -#endif - -/* Used to implement g_source_connect_closure and internally*/ -GLIB_AVAILABLE_IN_ALL -void g_source_set_callback_indirect (GSource *source, - gpointer callback_data, - GSourceCallbackFuncs *callback_funcs); - -GLIB_AVAILABLE_IN_ALL -void g_source_add_poll (GSource *source, - GPollFD *fd); -GLIB_AVAILABLE_IN_ALL -void g_source_remove_poll (GSource *source, - GPollFD *fd); - -GLIB_AVAILABLE_IN_ALL -void g_source_add_child_source (GSource *source, - GSource *child_source); -GLIB_AVAILABLE_IN_ALL -void g_source_remove_child_source (GSource *source, - GSource *child_source); - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_DEPRECATED_IN_2_28_FOR(g_source_get_time) -void g_source_get_current_time (GSource *source, - GTimeVal *timeval); -G_GNUC_END_IGNORE_DEPRECATIONS - -GLIB_AVAILABLE_IN_ALL -gint64 g_source_get_time (GSource *source); - - /* void g_source_connect_closure (GSource *source, - GClosure *closure); - */ - -/* Specific source types - */ -GLIB_AVAILABLE_IN_ALL -GSource *g_idle_source_new (void); -GLIB_AVAILABLE_IN_ALL -GSource *g_child_watch_source_new (GPid pid); -GLIB_AVAILABLE_IN_ALL -GSource *g_timeout_source_new (guint interval); -GLIB_AVAILABLE_IN_ALL -GSource *g_timeout_source_new_seconds (guint interval); - -/* Miscellaneous functions - */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_DEPRECATED_IN_2_62_FOR(g_get_real_time) -void g_get_current_time (GTimeVal *result); -G_GNUC_END_IGNORE_DEPRECATIONS - -GLIB_AVAILABLE_IN_ALL -gint64 g_get_monotonic_time (void); -GLIB_AVAILABLE_IN_ALL -gint64 g_get_real_time (void); - - -/* Source manipulation by ID */ -GLIB_AVAILABLE_IN_ALL -gboolean g_source_remove (guint tag); -GLIB_AVAILABLE_IN_ALL -gboolean g_source_remove_by_user_data (gpointer user_data); -GLIB_AVAILABLE_IN_ALL -gboolean g_source_remove_by_funcs_user_data (GSourceFuncs *funcs, - gpointer user_data); - -/** - * GClearHandleFunc: - * @handle_id: the handle ID to clear - * - * Specifies the type of function passed to g_clear_handle_id(). - * The implementation is expected to free the resource identified - * by @handle_id; for instance, if @handle_id is a #GSource ID, - * g_source_remove() can be used. - * - * Since: 2.56 - */ -typedef void (* GClearHandleFunc) (guint handle_id); - -GLIB_AVAILABLE_IN_2_56 -void g_clear_handle_id (guint *tag_ptr, - GClearHandleFunc clear_func); - -#undef g_clear_handle_id -#define g_clear_handle_id(tag_ptr, clear_func) \ - G_STMT_START { \ - G_STATIC_ASSERT (sizeof *(tag_ptr) == sizeof (guint)); \ - guint *_tag_ptr = (guint *) (tag_ptr); \ - guint _handle_id; \ - \ - _handle_id = *_tag_ptr; \ - if (_handle_id > 0) \ - { \ - *_tag_ptr = 0; \ - clear_func (_handle_id); \ - } \ - } G_STMT_END \ - GLIB_AVAILABLE_MACRO_IN_2_56 - -/* Idles, child watchers and timeouts */ -GLIB_AVAILABLE_IN_ALL -guint g_timeout_add_full (gint priority, - guint interval, - GSourceFunc function, - gpointer data, - GDestroyNotify notify); -GLIB_AVAILABLE_IN_ALL -guint g_timeout_add (guint interval, - GSourceFunc function, - gpointer data); -GLIB_AVAILABLE_IN_ALL -guint g_timeout_add_seconds_full (gint priority, - guint interval, - GSourceFunc function, - gpointer data, - GDestroyNotify notify); -GLIB_AVAILABLE_IN_ALL -guint g_timeout_add_seconds (guint interval, - GSourceFunc function, - gpointer data); -GLIB_AVAILABLE_IN_ALL -guint g_child_watch_add_full (gint priority, - GPid pid, - GChildWatchFunc function, - gpointer data, - GDestroyNotify notify); -GLIB_AVAILABLE_IN_ALL -guint g_child_watch_add (GPid pid, - GChildWatchFunc function, - gpointer data); -GLIB_AVAILABLE_IN_ALL -guint g_idle_add (GSourceFunc function, - gpointer data); -GLIB_AVAILABLE_IN_ALL -guint g_idle_add_full (gint priority, - GSourceFunc function, - gpointer data, - GDestroyNotify notify); -GLIB_AVAILABLE_IN_ALL -gboolean g_idle_remove_by_data (gpointer data); - -GLIB_AVAILABLE_IN_ALL -void g_main_context_invoke_full (GMainContext *context, - gint priority, - GSourceFunc function, - gpointer data, - GDestroyNotify notify); -GLIB_AVAILABLE_IN_ALL -void g_main_context_invoke (GMainContext *context, - GSourceFunc function, - gpointer data); - -/* Hook for GClosure / GSource integration. Don't touch */ -GLIB_VAR GSourceFuncs g_timeout_funcs; -GLIB_VAR GSourceFuncs g_child_watch_funcs; -GLIB_VAR GSourceFuncs g_idle_funcs; -#ifdef G_OS_UNIX -GLIB_VAR GSourceFuncs g_unix_signal_funcs; -GLIB_VAR GSourceFuncs g_unix_fd_source_funcs; -#endif - -G_END_DECLS - -#endif /* __G_MAIN_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_STRING_H__ -#define __G_STRING_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -/* gunicode.h - Unicode manipulation functions - * - * Copyright (C) 1999, 2000 Tom Tromey - * Copyright 2000, 2005 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_UNICODE_H__ -#define __G_UNICODE_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/** - * gunichar: - * - * A type which can hold any UTF-32 or UCS-4 character code, - * also known as a Unicode code point. - * - * If you want to produce the UTF-8 representation of a #gunichar, - * use g_ucs4_to_utf8(). See also g_utf8_to_ucs4() for the reverse - * process. - * - * To print/scan values of this type as integer, use - * %G_GINT32_MODIFIER and/or %G_GUINT32_FORMAT. - * - * The notation to express a Unicode code point in running text is - * as a hexadecimal number with four to six digits and uppercase - * letters, prefixed by the string "U+". Leading zeros are omitted, - * unless the code point would have fewer than four hexadecimal digits. - * For example, "U+0041 LATIN CAPITAL LETTER A". To print a code point - * in the U+-notation, use the format string "U+\%04"G_GINT32_FORMAT"X". - * To scan, use the format string "U+\%06"G_GINT32_FORMAT"X". - * - * |[ - * gunichar c; - * sscanf ("U+0041", "U+%06"G_GINT32_FORMAT"X", &c) - * g_print ("Read U+%04"G_GINT32_FORMAT"X", c); - * ]| - */ -typedef guint32 gunichar; - -/** - * gunichar2: - * - * A type which can hold any UTF-16 code - * pointUTF-16 also has so called - * surrogate pairs to encode characters beyond - * the BMP as pairs of 16bit numbers. Surrogate pairs cannot be stored - * in a single gunichar2 field, but all GLib functions accepting gunichar2 - * arrays will correctly interpret surrogate pairs.. - * - * To print/scan values of this type to/from text you need to convert - * to/from UTF-8, using g_utf16_to_utf8()/g_utf8_to_utf16(). - * - * To print/scan values of this type as integer, use - * %G_GINT16_MODIFIER and/or %G_GUINT16_FORMAT. - */ -typedef guint16 gunichar2; - -/** - * GUnicodeType: - * @G_UNICODE_CONTROL: General category "Other, Control" (Cc) - * @G_UNICODE_FORMAT: General category "Other, Format" (Cf) - * @G_UNICODE_UNASSIGNED: General category "Other, Not Assigned" (Cn) - * @G_UNICODE_PRIVATE_USE: General category "Other, Private Use" (Co) - * @G_UNICODE_SURROGATE: General category "Other, Surrogate" (Cs) - * @G_UNICODE_LOWERCASE_LETTER: General category "Letter, Lowercase" (Ll) - * @G_UNICODE_MODIFIER_LETTER: General category "Letter, Modifier" (Lm) - * @G_UNICODE_OTHER_LETTER: General category "Letter, Other" (Lo) - * @G_UNICODE_TITLECASE_LETTER: General category "Letter, Titlecase" (Lt) - * @G_UNICODE_UPPERCASE_LETTER: General category "Letter, Uppercase" (Lu) - * @G_UNICODE_SPACING_MARK: General category "Mark, Spacing" (Mc) - * @G_UNICODE_ENCLOSING_MARK: General category "Mark, Enclosing" (Me) - * @G_UNICODE_NON_SPACING_MARK: General category "Mark, Nonspacing" (Mn) - * @G_UNICODE_DECIMAL_NUMBER: General category "Number, Decimal Digit" (Nd) - * @G_UNICODE_LETTER_NUMBER: General category "Number, Letter" (Nl) - * @G_UNICODE_OTHER_NUMBER: General category "Number, Other" (No) - * @G_UNICODE_CONNECT_PUNCTUATION: General category "Punctuation, Connector" (Pc) - * @G_UNICODE_DASH_PUNCTUATION: General category "Punctuation, Dash" (Pd) - * @G_UNICODE_CLOSE_PUNCTUATION: General category "Punctuation, Close" (Pe) - * @G_UNICODE_FINAL_PUNCTUATION: General category "Punctuation, Final quote" (Pf) - * @G_UNICODE_INITIAL_PUNCTUATION: General category "Punctuation, Initial quote" (Pi) - * @G_UNICODE_OTHER_PUNCTUATION: General category "Punctuation, Other" (Po) - * @G_UNICODE_OPEN_PUNCTUATION: General category "Punctuation, Open" (Ps) - * @G_UNICODE_CURRENCY_SYMBOL: General category "Symbol, Currency" (Sc) - * @G_UNICODE_MODIFIER_SYMBOL: General category "Symbol, Modifier" (Sk) - * @G_UNICODE_MATH_SYMBOL: General category "Symbol, Math" (Sm) - * @G_UNICODE_OTHER_SYMBOL: General category "Symbol, Other" (So) - * @G_UNICODE_LINE_SEPARATOR: General category "Separator, Line" (Zl) - * @G_UNICODE_PARAGRAPH_SEPARATOR: General category "Separator, Paragraph" (Zp) - * @G_UNICODE_SPACE_SEPARATOR: General category "Separator, Space" (Zs) - * - * These are the possible character classifications from the - * Unicode specification. - * See [Unicode Character Database](http://www.unicode.org/reports/tr44/#General_Category_Values). - */ -typedef enum -{ - G_UNICODE_CONTROL, - G_UNICODE_FORMAT, - G_UNICODE_UNASSIGNED, - G_UNICODE_PRIVATE_USE, - G_UNICODE_SURROGATE, - G_UNICODE_LOWERCASE_LETTER, - G_UNICODE_MODIFIER_LETTER, - G_UNICODE_OTHER_LETTER, - G_UNICODE_TITLECASE_LETTER, - G_UNICODE_UPPERCASE_LETTER, - G_UNICODE_SPACING_MARK, - G_UNICODE_ENCLOSING_MARK, - G_UNICODE_NON_SPACING_MARK, - G_UNICODE_DECIMAL_NUMBER, - G_UNICODE_LETTER_NUMBER, - G_UNICODE_OTHER_NUMBER, - G_UNICODE_CONNECT_PUNCTUATION, - G_UNICODE_DASH_PUNCTUATION, - G_UNICODE_CLOSE_PUNCTUATION, - G_UNICODE_FINAL_PUNCTUATION, - G_UNICODE_INITIAL_PUNCTUATION, - G_UNICODE_OTHER_PUNCTUATION, - G_UNICODE_OPEN_PUNCTUATION, - G_UNICODE_CURRENCY_SYMBOL, - G_UNICODE_MODIFIER_SYMBOL, - G_UNICODE_MATH_SYMBOL, - G_UNICODE_OTHER_SYMBOL, - G_UNICODE_LINE_SEPARATOR, - G_UNICODE_PARAGRAPH_SEPARATOR, - G_UNICODE_SPACE_SEPARATOR -} GUnicodeType; - -/** - * G_UNICODE_COMBINING_MARK: - * - * Older name for %G_UNICODE_SPACING_MARK. - * - * Deprecated: 2.30: Use %G_UNICODE_SPACING_MARK. - */ -#define G_UNICODE_COMBINING_MARK G_UNICODE_SPACING_MARK GLIB_DEPRECATED_MACRO_IN_2_30_FOR(G_UNICODE_SPACING_MARK) - -/** - * GUnicodeBreakType: - * @G_UNICODE_BREAK_MANDATORY: Mandatory Break (BK) - * @G_UNICODE_BREAK_CARRIAGE_RETURN: Carriage Return (CR) - * @G_UNICODE_BREAK_LINE_FEED: Line Feed (LF) - * @G_UNICODE_BREAK_COMBINING_MARK: Attached Characters and Combining Marks (CM) - * @G_UNICODE_BREAK_SURROGATE: Surrogates (SG) - * @G_UNICODE_BREAK_ZERO_WIDTH_SPACE: Zero Width Space (ZW) - * @G_UNICODE_BREAK_INSEPARABLE: Inseparable (IN) - * @G_UNICODE_BREAK_NON_BREAKING_GLUE: Non-breaking ("Glue") (GL) - * @G_UNICODE_BREAK_CONTINGENT: Contingent Break Opportunity (CB) - * @G_UNICODE_BREAK_SPACE: Space (SP) - * @G_UNICODE_BREAK_AFTER: Break Opportunity After (BA) - * @G_UNICODE_BREAK_BEFORE: Break Opportunity Before (BB) - * @G_UNICODE_BREAK_BEFORE_AND_AFTER: Break Opportunity Before and After (B2) - * @G_UNICODE_BREAK_HYPHEN: Hyphen (HY) - * @G_UNICODE_BREAK_NON_STARTER: Nonstarter (NS) - * @G_UNICODE_BREAK_OPEN_PUNCTUATION: Opening Punctuation (OP) - * @G_UNICODE_BREAK_CLOSE_PUNCTUATION: Closing Punctuation (CL) - * @G_UNICODE_BREAK_QUOTATION: Ambiguous Quotation (QU) - * @G_UNICODE_BREAK_EXCLAMATION: Exclamation/Interrogation (EX) - * @G_UNICODE_BREAK_IDEOGRAPHIC: Ideographic (ID) - * @G_UNICODE_BREAK_NUMERIC: Numeric (NU) - * @G_UNICODE_BREAK_INFIX_SEPARATOR: Infix Separator (Numeric) (IS) - * @G_UNICODE_BREAK_SYMBOL: Symbols Allowing Break After (SY) - * @G_UNICODE_BREAK_ALPHABETIC: Ordinary Alphabetic and Symbol Characters (AL) - * @G_UNICODE_BREAK_PREFIX: Prefix (Numeric) (PR) - * @G_UNICODE_BREAK_POSTFIX: Postfix (Numeric) (PO) - * @G_UNICODE_BREAK_COMPLEX_CONTEXT: Complex Content Dependent (South East Asian) (SA) - * @G_UNICODE_BREAK_AMBIGUOUS: Ambiguous (Alphabetic or Ideographic) (AI) - * @G_UNICODE_BREAK_UNKNOWN: Unknown (XX) - * @G_UNICODE_BREAK_NEXT_LINE: Next Line (NL) - * @G_UNICODE_BREAK_WORD_JOINER: Word Joiner (WJ) - * @G_UNICODE_BREAK_HANGUL_L_JAMO: Hangul L Jamo (JL) - * @G_UNICODE_BREAK_HANGUL_V_JAMO: Hangul V Jamo (JV) - * @G_UNICODE_BREAK_HANGUL_T_JAMO: Hangul T Jamo (JT) - * @G_UNICODE_BREAK_HANGUL_LV_SYLLABLE: Hangul LV Syllable (H2) - * @G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE: Hangul LVT Syllable (H3) - * @G_UNICODE_BREAK_CLOSE_PARANTHESIS: Closing Parenthesis (CP). Since 2.28 - * @G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER: Conditional Japanese Starter (CJ). Since: 2.32 - * @G_UNICODE_BREAK_HEBREW_LETTER: Hebrew Letter (HL). Since: 2.32 - * @G_UNICODE_BREAK_REGIONAL_INDICATOR: Regional Indicator (RI). Since: 2.36 - * @G_UNICODE_BREAK_EMOJI_BASE: Emoji Base (EB). Since: 2.50 - * @G_UNICODE_BREAK_EMOJI_MODIFIER: Emoji Modifier (EM). Since: 2.50 - * @G_UNICODE_BREAK_ZERO_WIDTH_JOINER: Zero Width Joiner (ZWJ). Since: 2.50 - * - * These are the possible line break classifications. - * - * Since new unicode versions may add new types here, applications should be ready - * to handle unknown values. They may be regarded as %G_UNICODE_BREAK_UNKNOWN. - * - * See [Unicode Line Breaking Algorithm](http://www.unicode.org/unicode/reports/tr14/). - */ -typedef enum -{ - G_UNICODE_BREAK_MANDATORY, - G_UNICODE_BREAK_CARRIAGE_RETURN, - G_UNICODE_BREAK_LINE_FEED, - G_UNICODE_BREAK_COMBINING_MARK, - G_UNICODE_BREAK_SURROGATE, - G_UNICODE_BREAK_ZERO_WIDTH_SPACE, - G_UNICODE_BREAK_INSEPARABLE, - G_UNICODE_BREAK_NON_BREAKING_GLUE, - G_UNICODE_BREAK_CONTINGENT, - G_UNICODE_BREAK_SPACE, - G_UNICODE_BREAK_AFTER, - G_UNICODE_BREAK_BEFORE, - G_UNICODE_BREAK_BEFORE_AND_AFTER, - G_UNICODE_BREAK_HYPHEN, - G_UNICODE_BREAK_NON_STARTER, - G_UNICODE_BREAK_OPEN_PUNCTUATION, - G_UNICODE_BREAK_CLOSE_PUNCTUATION, - G_UNICODE_BREAK_QUOTATION, - G_UNICODE_BREAK_EXCLAMATION, - G_UNICODE_BREAK_IDEOGRAPHIC, - G_UNICODE_BREAK_NUMERIC, - G_UNICODE_BREAK_INFIX_SEPARATOR, - G_UNICODE_BREAK_SYMBOL, - G_UNICODE_BREAK_ALPHABETIC, - G_UNICODE_BREAK_PREFIX, - G_UNICODE_BREAK_POSTFIX, - G_UNICODE_BREAK_COMPLEX_CONTEXT, - G_UNICODE_BREAK_AMBIGUOUS, - G_UNICODE_BREAK_UNKNOWN, - G_UNICODE_BREAK_NEXT_LINE, - G_UNICODE_BREAK_WORD_JOINER, - G_UNICODE_BREAK_HANGUL_L_JAMO, - G_UNICODE_BREAK_HANGUL_V_JAMO, - G_UNICODE_BREAK_HANGUL_T_JAMO, - G_UNICODE_BREAK_HANGUL_LV_SYLLABLE, - G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE, - G_UNICODE_BREAK_CLOSE_PARANTHESIS, - G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER, - G_UNICODE_BREAK_HEBREW_LETTER, - G_UNICODE_BREAK_REGIONAL_INDICATOR, - G_UNICODE_BREAK_EMOJI_BASE, - G_UNICODE_BREAK_EMOJI_MODIFIER, - G_UNICODE_BREAK_ZERO_WIDTH_JOINER -} GUnicodeBreakType; - -/** - * GUnicodeScript: - * @G_UNICODE_SCRIPT_INVALID_CODE: - * a value never returned from g_unichar_get_script() - * @G_UNICODE_SCRIPT_COMMON: a character used by multiple different scripts - * @G_UNICODE_SCRIPT_INHERITED: a mark glyph that takes its script from the - * base glyph to which it is attached - * @G_UNICODE_SCRIPT_ARABIC: Arabic - * @G_UNICODE_SCRIPT_ARMENIAN: Armenian - * @G_UNICODE_SCRIPT_BENGALI: Bengali - * @G_UNICODE_SCRIPT_BOPOMOFO: Bopomofo - * @G_UNICODE_SCRIPT_CHEROKEE: Cherokee - * @G_UNICODE_SCRIPT_COPTIC: Coptic - * @G_UNICODE_SCRIPT_CYRILLIC: Cyrillic - * @G_UNICODE_SCRIPT_DESERET: Deseret - * @G_UNICODE_SCRIPT_DEVANAGARI: Devanagari - * @G_UNICODE_SCRIPT_ETHIOPIC: Ethiopic - * @G_UNICODE_SCRIPT_GEORGIAN: Georgian - * @G_UNICODE_SCRIPT_GOTHIC: Gothic - * @G_UNICODE_SCRIPT_GREEK: Greek - * @G_UNICODE_SCRIPT_GUJARATI: Gujarati - * @G_UNICODE_SCRIPT_GURMUKHI: Gurmukhi - * @G_UNICODE_SCRIPT_HAN: Han - * @G_UNICODE_SCRIPT_HANGUL: Hangul - * @G_UNICODE_SCRIPT_HEBREW: Hebrew - * @G_UNICODE_SCRIPT_HIRAGANA: Hiragana - * @G_UNICODE_SCRIPT_KANNADA: Kannada - * @G_UNICODE_SCRIPT_KATAKANA: Katakana - * @G_UNICODE_SCRIPT_KHMER: Khmer - * @G_UNICODE_SCRIPT_LAO: Lao - * @G_UNICODE_SCRIPT_LATIN: Latin - * @G_UNICODE_SCRIPT_MALAYALAM: Malayalam - * @G_UNICODE_SCRIPT_MONGOLIAN: Mongolian - * @G_UNICODE_SCRIPT_MYANMAR: Myanmar - * @G_UNICODE_SCRIPT_OGHAM: Ogham - * @G_UNICODE_SCRIPT_OLD_ITALIC: Old Italic - * @G_UNICODE_SCRIPT_ORIYA: Oriya - * @G_UNICODE_SCRIPT_RUNIC: Runic - * @G_UNICODE_SCRIPT_SINHALA: Sinhala - * @G_UNICODE_SCRIPT_SYRIAC: Syriac - * @G_UNICODE_SCRIPT_TAMIL: Tamil - * @G_UNICODE_SCRIPT_TELUGU: Telugu - * @G_UNICODE_SCRIPT_THAANA: Thaana - * @G_UNICODE_SCRIPT_THAI: Thai - * @G_UNICODE_SCRIPT_TIBETAN: Tibetan - * @G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL: - * Canadian Aboriginal - * @G_UNICODE_SCRIPT_YI: Yi - * @G_UNICODE_SCRIPT_TAGALOG: Tagalog - * @G_UNICODE_SCRIPT_HANUNOO: Hanunoo - * @G_UNICODE_SCRIPT_BUHID: Buhid - * @G_UNICODE_SCRIPT_TAGBANWA: Tagbanwa - * @G_UNICODE_SCRIPT_BRAILLE: Braille - * @G_UNICODE_SCRIPT_CYPRIOT: Cypriot - * @G_UNICODE_SCRIPT_LIMBU: Limbu - * @G_UNICODE_SCRIPT_OSMANYA: Osmanya - * @G_UNICODE_SCRIPT_SHAVIAN: Shavian - * @G_UNICODE_SCRIPT_LINEAR_B: Linear B - * @G_UNICODE_SCRIPT_TAI_LE: Tai Le - * @G_UNICODE_SCRIPT_UGARITIC: Ugaritic - * @G_UNICODE_SCRIPT_NEW_TAI_LUE: - * New Tai Lue - * @G_UNICODE_SCRIPT_BUGINESE: Buginese - * @G_UNICODE_SCRIPT_GLAGOLITIC: Glagolitic - * @G_UNICODE_SCRIPT_TIFINAGH: Tifinagh - * @G_UNICODE_SCRIPT_SYLOTI_NAGRI: - * Syloti Nagri - * @G_UNICODE_SCRIPT_OLD_PERSIAN: - * Old Persian - * @G_UNICODE_SCRIPT_KHAROSHTHI: Kharoshthi - * @G_UNICODE_SCRIPT_UNKNOWN: an unassigned code point - * @G_UNICODE_SCRIPT_BALINESE: Balinese - * @G_UNICODE_SCRIPT_CUNEIFORM: Cuneiform - * @G_UNICODE_SCRIPT_PHOENICIAN: Phoenician - * @G_UNICODE_SCRIPT_PHAGS_PA: Phags-pa - * @G_UNICODE_SCRIPT_NKO: N'Ko - * @G_UNICODE_SCRIPT_KAYAH_LI: Kayah Li. Since 2.16.3 - * @G_UNICODE_SCRIPT_LEPCHA: Lepcha. Since 2.16.3 - * @G_UNICODE_SCRIPT_REJANG: Rejang. Since 2.16.3 - * @G_UNICODE_SCRIPT_SUNDANESE: Sundanese. Since 2.16.3 - * @G_UNICODE_SCRIPT_SAURASHTRA: Saurashtra. Since 2.16.3 - * @G_UNICODE_SCRIPT_CHAM: Cham. Since 2.16.3 - * @G_UNICODE_SCRIPT_OL_CHIKI: Ol Chiki. Since 2.16.3 - * @G_UNICODE_SCRIPT_VAI: Vai. Since 2.16.3 - * @G_UNICODE_SCRIPT_CARIAN: Carian. Since 2.16.3 - * @G_UNICODE_SCRIPT_LYCIAN: Lycian. Since 2.16.3 - * @G_UNICODE_SCRIPT_LYDIAN: Lydian. Since 2.16.3 - * @G_UNICODE_SCRIPT_AVESTAN: Avestan. Since 2.26 - * @G_UNICODE_SCRIPT_BAMUM: Bamum. Since 2.26 - * @G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS: - * Egyptian Hieroglpyhs. Since 2.26 - * @G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC: - * Imperial Aramaic. Since 2.26 - * @G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI: - * Inscriptional Pahlavi. Since 2.26 - * @G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN: - * Inscriptional Parthian. Since 2.26 - * @G_UNICODE_SCRIPT_JAVANESE: Javanese. Since 2.26 - * @G_UNICODE_SCRIPT_KAITHI: Kaithi. Since 2.26 - * @G_UNICODE_SCRIPT_LISU: Lisu. Since 2.26 - * @G_UNICODE_SCRIPT_MEETEI_MAYEK: - * Meetei Mayek. Since 2.26 - * @G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN: - * Old South Arabian. Since 2.26 - * @G_UNICODE_SCRIPT_OLD_TURKIC: Old Turkic. Since 2.28 - * @G_UNICODE_SCRIPT_SAMARITAN: Samaritan. Since 2.26 - * @G_UNICODE_SCRIPT_TAI_THAM: Tai Tham. Since 2.26 - * @G_UNICODE_SCRIPT_TAI_VIET: Tai Viet. Since 2.26 - * @G_UNICODE_SCRIPT_BATAK: Batak. Since 2.28 - * @G_UNICODE_SCRIPT_BRAHMI: Brahmi. Since 2.28 - * @G_UNICODE_SCRIPT_MANDAIC: Mandaic. Since 2.28 - * @G_UNICODE_SCRIPT_CHAKMA: Chakma. Since: 2.32 - * @G_UNICODE_SCRIPT_MEROITIC_CURSIVE: Meroitic Cursive. Since: 2.32 - * @G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS: Meroitic Hieroglyphs. Since: 2.32 - * @G_UNICODE_SCRIPT_MIAO: Miao. Since: 2.32 - * @G_UNICODE_SCRIPT_SHARADA: Sharada. Since: 2.32 - * @G_UNICODE_SCRIPT_SORA_SOMPENG: Sora Sompeng. Since: 2.32 - * @G_UNICODE_SCRIPT_TAKRI: Takri. Since: 2.32 - * @G_UNICODE_SCRIPT_BASSA_VAH: Bassa. Since: 2.42 - * @G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN: Caucasian Albanian. Since: 2.42 - * @G_UNICODE_SCRIPT_DUPLOYAN: Duployan. Since: 2.42 - * @G_UNICODE_SCRIPT_ELBASAN: Elbasan. Since: 2.42 - * @G_UNICODE_SCRIPT_GRANTHA: Grantha. Since: 2.42 - * @G_UNICODE_SCRIPT_KHOJKI: Kjohki. Since: 2.42 - * @G_UNICODE_SCRIPT_KHUDAWADI: Khudawadi, Sindhi. Since: 2.42 - * @G_UNICODE_SCRIPT_LINEAR_A: Linear A. Since: 2.42 - * @G_UNICODE_SCRIPT_MAHAJANI: Mahajani. Since: 2.42 - * @G_UNICODE_SCRIPT_MANICHAEAN: Manichaean. Since: 2.42 - * @G_UNICODE_SCRIPT_MENDE_KIKAKUI: Mende Kikakui. Since: 2.42 - * @G_UNICODE_SCRIPT_MODI: Modi. Since: 2.42 - * @G_UNICODE_SCRIPT_MRO: Mro. Since: 2.42 - * @G_UNICODE_SCRIPT_NABATAEAN: Nabataean. Since: 2.42 - * @G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN: Old North Arabian. Since: 2.42 - * @G_UNICODE_SCRIPT_OLD_PERMIC: Old Permic. Since: 2.42 - * @G_UNICODE_SCRIPT_PAHAWH_HMONG: Pahawh Hmong. Since: 2.42 - * @G_UNICODE_SCRIPT_PALMYRENE: Palmyrene. Since: 2.42 - * @G_UNICODE_SCRIPT_PAU_CIN_HAU: Pau Cin Hau. Since: 2.42 - * @G_UNICODE_SCRIPT_PSALTER_PAHLAVI: Psalter Pahlavi. Since: 2.42 - * @G_UNICODE_SCRIPT_SIDDHAM: Siddham. Since: 2.42 - * @G_UNICODE_SCRIPT_TIRHUTA: Tirhuta. Since: 2.42 - * @G_UNICODE_SCRIPT_WARANG_CITI: Warang Citi. Since: 2.42 - * @G_UNICODE_SCRIPT_AHOM: Ahom. Since: 2.48 - * @G_UNICODE_SCRIPT_ANATOLIAN_HIEROGLYPHS: Anatolian Hieroglyphs. Since: 2.48 - * @G_UNICODE_SCRIPT_HATRAN: Hatran. Since: 2.48 - * @G_UNICODE_SCRIPT_MULTANI: Multani. Since: 2.48 - * @G_UNICODE_SCRIPT_OLD_HUNGARIAN: Old Hungarian. Since: 2.48 - * @G_UNICODE_SCRIPT_SIGNWRITING: Signwriting. Since: 2.48 - * @G_UNICODE_SCRIPT_ADLAM: Adlam. Since: 2.50 - * @G_UNICODE_SCRIPT_BHAIKSUKI: Bhaiksuki. Since: 2.50 - * @G_UNICODE_SCRIPT_MARCHEN: Marchen. Since: 2.50 - * @G_UNICODE_SCRIPT_NEWA: Newa. Since: 2.50 - * @G_UNICODE_SCRIPT_OSAGE: Osage. Since: 2.50 - * @G_UNICODE_SCRIPT_TANGUT: Tangut. Since: 2.50 - * @G_UNICODE_SCRIPT_MASARAM_GONDI: Masaram Gondi. Since: 2.54 - * @G_UNICODE_SCRIPT_NUSHU: Nushu. Since: 2.54 - * @G_UNICODE_SCRIPT_SOYOMBO: Soyombo. Since: 2.54 - * @G_UNICODE_SCRIPT_ZANABAZAR_SQUARE: Zanabazar Square. Since: 2.54 - * @G_UNICODE_SCRIPT_DOGRA: Dogra. Since: 2.58 - * @G_UNICODE_SCRIPT_GUNJALA_GONDI: Gunjala Gondi. Since: 2.58 - * @G_UNICODE_SCRIPT_HANIFI_ROHINGYA: Hanifi Rohingya. Since: 2.58 - * @G_UNICODE_SCRIPT_MAKASAR: Makasar. Since: 2.58 - * @G_UNICODE_SCRIPT_MEDEFAIDRIN: Medefaidrin. Since: 2.58 - * @G_UNICODE_SCRIPT_OLD_SOGDIAN: Old Sogdian. Since: 2.58 - * @G_UNICODE_SCRIPT_SOGDIAN: Sogdian. Since: 2.58 - * @G_UNICODE_SCRIPT_ELYMAIC: Elym. Since: 2.62 - * @G_UNICODE_SCRIPT_NANDINAGARI: Nand. Since: 2.62 - * @G_UNICODE_SCRIPT_NYIAKENG_PUACHUE_HMONG: Rohg. Since: 2.62 - * @G_UNICODE_SCRIPT_WANCHO: Wcho. Since: 2.62 - * @G_UNICODE_SCRIPT_CHORASMIAN: Chorasmian. Since: 2.66 - * @G_UNICODE_SCRIPT_DIVES_AKURU: Dives Akuru. Since: 2.66 - * @G_UNICODE_SCRIPT_KHITAN_SMALL_SCRIPT: Khitan small script. Since: 2.66 - * @G_UNICODE_SCRIPT_YEZIDI: Yezidi. Since: 2.66 - * - * The #GUnicodeScript enumeration identifies different writing - * systems. The values correspond to the names as defined in the - * Unicode standard. The enumeration has been added in GLib 2.14, - * and is interchangeable with #PangoScript. - * - * Note that new types may be added in the future. Applications - * should be ready to handle unknown values. - * See [Unicode Standard Annex #24: Script names](http://www.unicode.org/reports/tr24/). - */ -typedef enum -{ /* ISO 15924 code */ - G_UNICODE_SCRIPT_INVALID_CODE = -1, - G_UNICODE_SCRIPT_COMMON = 0, /* Zyyy */ - G_UNICODE_SCRIPT_INHERITED, /* Zinh (Qaai) */ - G_UNICODE_SCRIPT_ARABIC, /* Arab */ - G_UNICODE_SCRIPT_ARMENIAN, /* Armn */ - G_UNICODE_SCRIPT_BENGALI, /* Beng */ - G_UNICODE_SCRIPT_BOPOMOFO, /* Bopo */ - G_UNICODE_SCRIPT_CHEROKEE, /* Cher */ - G_UNICODE_SCRIPT_COPTIC, /* Copt (Qaac) */ - G_UNICODE_SCRIPT_CYRILLIC, /* Cyrl (Cyrs) */ - G_UNICODE_SCRIPT_DESERET, /* Dsrt */ - G_UNICODE_SCRIPT_DEVANAGARI, /* Deva */ - G_UNICODE_SCRIPT_ETHIOPIC, /* Ethi */ - G_UNICODE_SCRIPT_GEORGIAN, /* Geor (Geon, Geoa) */ - G_UNICODE_SCRIPT_GOTHIC, /* Goth */ - G_UNICODE_SCRIPT_GREEK, /* Grek */ - G_UNICODE_SCRIPT_GUJARATI, /* Gujr */ - G_UNICODE_SCRIPT_GURMUKHI, /* Guru */ - G_UNICODE_SCRIPT_HAN, /* Hani */ - G_UNICODE_SCRIPT_HANGUL, /* Hang */ - G_UNICODE_SCRIPT_HEBREW, /* Hebr */ - G_UNICODE_SCRIPT_HIRAGANA, /* Hira */ - G_UNICODE_SCRIPT_KANNADA, /* Knda */ - G_UNICODE_SCRIPT_KATAKANA, /* Kana */ - G_UNICODE_SCRIPT_KHMER, /* Khmr */ - G_UNICODE_SCRIPT_LAO, /* Laoo */ - G_UNICODE_SCRIPT_LATIN, /* Latn (Latf, Latg) */ - G_UNICODE_SCRIPT_MALAYALAM, /* Mlym */ - G_UNICODE_SCRIPT_MONGOLIAN, /* Mong */ - G_UNICODE_SCRIPT_MYANMAR, /* Mymr */ - G_UNICODE_SCRIPT_OGHAM, /* Ogam */ - G_UNICODE_SCRIPT_OLD_ITALIC, /* Ital */ - G_UNICODE_SCRIPT_ORIYA, /* Orya */ - G_UNICODE_SCRIPT_RUNIC, /* Runr */ - G_UNICODE_SCRIPT_SINHALA, /* Sinh */ - G_UNICODE_SCRIPT_SYRIAC, /* Syrc (Syrj, Syrn, Syre) */ - G_UNICODE_SCRIPT_TAMIL, /* Taml */ - G_UNICODE_SCRIPT_TELUGU, /* Telu */ - G_UNICODE_SCRIPT_THAANA, /* Thaa */ - G_UNICODE_SCRIPT_THAI, /* Thai */ - G_UNICODE_SCRIPT_TIBETAN, /* Tibt */ - G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL, /* Cans */ - G_UNICODE_SCRIPT_YI, /* Yiii */ - G_UNICODE_SCRIPT_TAGALOG, /* Tglg */ - G_UNICODE_SCRIPT_HANUNOO, /* Hano */ - G_UNICODE_SCRIPT_BUHID, /* Buhd */ - G_UNICODE_SCRIPT_TAGBANWA, /* Tagb */ - - /* Unicode-4.0 additions */ - G_UNICODE_SCRIPT_BRAILLE, /* Brai */ - G_UNICODE_SCRIPT_CYPRIOT, /* Cprt */ - G_UNICODE_SCRIPT_LIMBU, /* Limb */ - G_UNICODE_SCRIPT_OSMANYA, /* Osma */ - G_UNICODE_SCRIPT_SHAVIAN, /* Shaw */ - G_UNICODE_SCRIPT_LINEAR_B, /* Linb */ - G_UNICODE_SCRIPT_TAI_LE, /* Tale */ - G_UNICODE_SCRIPT_UGARITIC, /* Ugar */ - - /* Unicode-4.1 additions */ - G_UNICODE_SCRIPT_NEW_TAI_LUE, /* Talu */ - G_UNICODE_SCRIPT_BUGINESE, /* Bugi */ - G_UNICODE_SCRIPT_GLAGOLITIC, /* Glag */ - G_UNICODE_SCRIPT_TIFINAGH, /* Tfng */ - G_UNICODE_SCRIPT_SYLOTI_NAGRI, /* Sylo */ - G_UNICODE_SCRIPT_OLD_PERSIAN, /* Xpeo */ - G_UNICODE_SCRIPT_KHAROSHTHI, /* Khar */ - - /* Unicode-5.0 additions */ - G_UNICODE_SCRIPT_UNKNOWN, /* Zzzz */ - G_UNICODE_SCRIPT_BALINESE, /* Bali */ - G_UNICODE_SCRIPT_CUNEIFORM, /* Xsux */ - G_UNICODE_SCRIPT_PHOENICIAN, /* Phnx */ - G_UNICODE_SCRIPT_PHAGS_PA, /* Phag */ - G_UNICODE_SCRIPT_NKO, /* Nkoo */ - - /* Unicode-5.1 additions */ - G_UNICODE_SCRIPT_KAYAH_LI, /* Kali */ - G_UNICODE_SCRIPT_LEPCHA, /* Lepc */ - G_UNICODE_SCRIPT_REJANG, /* Rjng */ - G_UNICODE_SCRIPT_SUNDANESE, /* Sund */ - G_UNICODE_SCRIPT_SAURASHTRA, /* Saur */ - G_UNICODE_SCRIPT_CHAM, /* Cham */ - G_UNICODE_SCRIPT_OL_CHIKI, /* Olck */ - G_UNICODE_SCRIPT_VAI, /* Vaii */ - G_UNICODE_SCRIPT_CARIAN, /* Cari */ - G_UNICODE_SCRIPT_LYCIAN, /* Lyci */ - G_UNICODE_SCRIPT_LYDIAN, /* Lydi */ - - /* Unicode-5.2 additions */ - G_UNICODE_SCRIPT_AVESTAN, /* Avst */ - G_UNICODE_SCRIPT_BAMUM, /* Bamu */ - G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS, /* Egyp */ - G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC, /* Armi */ - G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI, /* Phli */ - G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN, /* Prti */ - G_UNICODE_SCRIPT_JAVANESE, /* Java */ - G_UNICODE_SCRIPT_KAITHI, /* Kthi */ - G_UNICODE_SCRIPT_LISU, /* Lisu */ - G_UNICODE_SCRIPT_MEETEI_MAYEK, /* Mtei */ - G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN, /* Sarb */ - G_UNICODE_SCRIPT_OLD_TURKIC, /* Orkh */ - G_UNICODE_SCRIPT_SAMARITAN, /* Samr */ - G_UNICODE_SCRIPT_TAI_THAM, /* Lana */ - G_UNICODE_SCRIPT_TAI_VIET, /* Tavt */ - - /* Unicode-6.0 additions */ - G_UNICODE_SCRIPT_BATAK, /* Batk */ - G_UNICODE_SCRIPT_BRAHMI, /* Brah */ - G_UNICODE_SCRIPT_MANDAIC, /* Mand */ - - /* Unicode-6.1 additions */ - G_UNICODE_SCRIPT_CHAKMA, /* Cakm */ - G_UNICODE_SCRIPT_MEROITIC_CURSIVE, /* Merc */ - G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS, /* Mero */ - G_UNICODE_SCRIPT_MIAO, /* Plrd */ - G_UNICODE_SCRIPT_SHARADA, /* Shrd */ - G_UNICODE_SCRIPT_SORA_SOMPENG, /* Sora */ - G_UNICODE_SCRIPT_TAKRI, /* Takr */ - - /* Unicode 7.0 additions */ - G_UNICODE_SCRIPT_BASSA_VAH, /* Bass */ - G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN, /* Aghb */ - G_UNICODE_SCRIPT_DUPLOYAN, /* Dupl */ - G_UNICODE_SCRIPT_ELBASAN, /* Elba */ - G_UNICODE_SCRIPT_GRANTHA, /* Gran */ - G_UNICODE_SCRIPT_KHOJKI, /* Khoj */ - G_UNICODE_SCRIPT_KHUDAWADI, /* Sind */ - G_UNICODE_SCRIPT_LINEAR_A, /* Lina */ - G_UNICODE_SCRIPT_MAHAJANI, /* Mahj */ - G_UNICODE_SCRIPT_MANICHAEAN, /* Mani */ - G_UNICODE_SCRIPT_MENDE_KIKAKUI, /* Mend */ - G_UNICODE_SCRIPT_MODI, /* Modi */ - G_UNICODE_SCRIPT_MRO, /* Mroo */ - G_UNICODE_SCRIPT_NABATAEAN, /* Nbat */ - G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN, /* Narb */ - G_UNICODE_SCRIPT_OLD_PERMIC, /* Perm */ - G_UNICODE_SCRIPT_PAHAWH_HMONG, /* Hmng */ - G_UNICODE_SCRIPT_PALMYRENE, /* Palm */ - G_UNICODE_SCRIPT_PAU_CIN_HAU, /* Pauc */ - G_UNICODE_SCRIPT_PSALTER_PAHLAVI, /* Phlp */ - G_UNICODE_SCRIPT_SIDDHAM, /* Sidd */ - G_UNICODE_SCRIPT_TIRHUTA, /* Tirh */ - G_UNICODE_SCRIPT_WARANG_CITI, /* Wara */ - - /* Unicode 8.0 additions */ - G_UNICODE_SCRIPT_AHOM, /* Ahom */ - G_UNICODE_SCRIPT_ANATOLIAN_HIEROGLYPHS, /* Hluw */ - G_UNICODE_SCRIPT_HATRAN, /* Hatr */ - G_UNICODE_SCRIPT_MULTANI, /* Mult */ - G_UNICODE_SCRIPT_OLD_HUNGARIAN, /* Hung */ - G_UNICODE_SCRIPT_SIGNWRITING, /* Sgnw */ - - /* Unicode 9.0 additions */ - G_UNICODE_SCRIPT_ADLAM, /* Adlm */ - G_UNICODE_SCRIPT_BHAIKSUKI, /* Bhks */ - G_UNICODE_SCRIPT_MARCHEN, /* Marc */ - G_UNICODE_SCRIPT_NEWA, /* Newa */ - G_UNICODE_SCRIPT_OSAGE, /* Osge */ - G_UNICODE_SCRIPT_TANGUT, /* Tang */ - - /* Unicode 10.0 additions */ - G_UNICODE_SCRIPT_MASARAM_GONDI, /* Gonm */ - G_UNICODE_SCRIPT_NUSHU, /* Nshu */ - G_UNICODE_SCRIPT_SOYOMBO, /* Soyo */ - G_UNICODE_SCRIPT_ZANABAZAR_SQUARE, /* Zanb */ - - /* Unicode 11.0 additions */ - G_UNICODE_SCRIPT_DOGRA, /* Dogr */ - G_UNICODE_SCRIPT_GUNJALA_GONDI, /* Gong */ - G_UNICODE_SCRIPT_HANIFI_ROHINGYA, /* Rohg */ - G_UNICODE_SCRIPT_MAKASAR, /* Maka */ - G_UNICODE_SCRIPT_MEDEFAIDRIN, /* Medf */ - G_UNICODE_SCRIPT_OLD_SOGDIAN, /* Sogo */ - G_UNICODE_SCRIPT_SOGDIAN, /* Sogd */ - - /* Unicode 12.0 additions */ - G_UNICODE_SCRIPT_ELYMAIC, /* Elym */ - G_UNICODE_SCRIPT_NANDINAGARI, /* Nand */ - G_UNICODE_SCRIPT_NYIAKENG_PUACHUE_HMONG, /* Rohg */ - G_UNICODE_SCRIPT_WANCHO, /* Wcho */ - - /* Unicode 13.0 additions */ - G_UNICODE_SCRIPT_CHORASMIAN, /* Chrs */ - G_UNICODE_SCRIPT_DIVES_AKURU, /* Diak */ - G_UNICODE_SCRIPT_KHITAN_SMALL_SCRIPT, /* Kits */ - G_UNICODE_SCRIPT_YEZIDI /* Yezi */ -} GUnicodeScript; - -GLIB_AVAILABLE_IN_ALL -guint32 g_unicode_script_to_iso15924 (GUnicodeScript script); -GLIB_AVAILABLE_IN_ALL -GUnicodeScript g_unicode_script_from_iso15924 (guint32 iso15924); - -/* These are all analogs of the functions. - */ -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_isalnum (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_isalpha (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_iscntrl (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_isdigit (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_isgraph (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_islower (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_isprint (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_ispunct (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_isspace (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_isupper (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_isxdigit (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_istitle (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_isdefined (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_iswide (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_iswide_cjk(gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_iszerowidth(gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_ismark (gunichar c) G_GNUC_CONST; - -/* More functions. These convert between the three cases. - * See the Unicode book to understand title case. */ -GLIB_AVAILABLE_IN_ALL -gunichar g_unichar_toupper (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gunichar g_unichar_tolower (gunichar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gunichar g_unichar_totitle (gunichar c) G_GNUC_CONST; - -/* If C is a digit (according to 'g_unichar_isdigit'), then return its - numeric value. Otherwise return -1. */ -GLIB_AVAILABLE_IN_ALL -gint g_unichar_digit_value (gunichar c) G_GNUC_CONST; - -GLIB_AVAILABLE_IN_ALL -gint g_unichar_xdigit_value (gunichar c) G_GNUC_CONST; - -/* Return the Unicode character type of a given character. */ -GLIB_AVAILABLE_IN_ALL -GUnicodeType g_unichar_type (gunichar c) G_GNUC_CONST; - -/* Return the line break property for a given character */ -GLIB_AVAILABLE_IN_ALL -GUnicodeBreakType g_unichar_break_type (gunichar c) G_GNUC_CONST; - -/* Returns the combining class for a given character */ -GLIB_AVAILABLE_IN_ALL -gint g_unichar_combining_class (gunichar uc) G_GNUC_CONST; - -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_get_mirror_char (gunichar ch, - gunichar *mirrored_ch); - -GLIB_AVAILABLE_IN_ALL -GUnicodeScript g_unichar_get_script (gunichar ch) G_GNUC_CONST; - -/* Validate a Unicode character */ -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_validate (gunichar ch) G_GNUC_CONST; - -/* Pairwise canonical compose/decompose */ -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_compose (gunichar a, - gunichar b, - gunichar *ch); -GLIB_AVAILABLE_IN_ALL -gboolean g_unichar_decompose (gunichar ch, - gunichar *a, - gunichar *b); - -GLIB_AVAILABLE_IN_ALL -gsize g_unichar_fully_decompose (gunichar ch, - gboolean compat, - gunichar *result, - gsize result_len); - -/** - * G_UNICHAR_MAX_DECOMPOSITION_LENGTH: - * - * The maximum length (in codepoints) of a compatibility or canonical - * decomposition of a single Unicode character. - * - * This is as defined by Unicode 6.1. - * - * Since: 2.32 - */ -#define G_UNICHAR_MAX_DECOMPOSITION_LENGTH 18 /* codepoints */ - -/* Compute canonical ordering of a string in-place. This rearranges - decomposed characters in the string according to their combining - classes. See the Unicode manual for more information. */ -GLIB_AVAILABLE_IN_ALL -void g_unicode_canonical_ordering (gunichar *string, - gsize len); - - -GLIB_DEPRECATED_IN_2_30 -gunichar *g_unicode_canonical_decomposition (gunichar ch, - gsize *result_len) G_GNUC_MALLOC; - -/* Array of skip-bytes-per-initial character. - */ -GLIB_VAR const gchar * const g_utf8_skip; - -/** - * g_utf8_next_char: - * @p: Pointer to the start of a valid UTF-8 character - * - * Skips to the next character in a UTF-8 string. The string must be - * valid; this macro is as fast as possible, and has no error-checking. - * You would use this macro to iterate over a string character by - * character. The macro returns the start of the next UTF-8 character. - * Before using this macro, use g_utf8_validate() to validate strings - * that may contain invalid UTF-8. - */ -#define g_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(const guchar *)(p)]) - -GLIB_AVAILABLE_IN_ALL -gunichar g_utf8_get_char (const gchar *p) G_GNUC_PURE; -GLIB_AVAILABLE_IN_ALL -gunichar g_utf8_get_char_validated (const gchar *p, - gssize max_len) G_GNUC_PURE; - -GLIB_AVAILABLE_IN_ALL -gchar* g_utf8_offset_to_pointer (const gchar *str, - glong offset) G_GNUC_PURE; -GLIB_AVAILABLE_IN_ALL -glong g_utf8_pointer_to_offset (const gchar *str, - const gchar *pos) G_GNUC_PURE; -GLIB_AVAILABLE_IN_ALL -gchar* g_utf8_prev_char (const gchar *p) G_GNUC_PURE; -GLIB_AVAILABLE_IN_ALL -gchar* g_utf8_find_next_char (const gchar *p, - const gchar *end) G_GNUC_PURE; -GLIB_AVAILABLE_IN_ALL -gchar* g_utf8_find_prev_char (const gchar *str, - const gchar *p) G_GNUC_PURE; - -GLIB_AVAILABLE_IN_ALL -glong g_utf8_strlen (const gchar *p, - gssize max) G_GNUC_PURE; - -GLIB_AVAILABLE_IN_2_30 -gchar *g_utf8_substring (const gchar *str, - glong start_pos, - glong end_pos) G_GNUC_MALLOC; - -GLIB_AVAILABLE_IN_ALL -gchar *g_utf8_strncpy (gchar *dest, - const gchar *src, - gsize n); - -/* Find the UTF-8 character corresponding to ch, in string p. These - functions are equivalants to strchr and strrchr */ -GLIB_AVAILABLE_IN_ALL -gchar* g_utf8_strchr (const gchar *p, - gssize len, - gunichar c); -GLIB_AVAILABLE_IN_ALL -gchar* g_utf8_strrchr (const gchar *p, - gssize len, - gunichar c); -GLIB_AVAILABLE_IN_ALL -gchar* g_utf8_strreverse (const gchar *str, - gssize len); - -GLIB_AVAILABLE_IN_ALL -gunichar2 *g_utf8_to_utf16 (const gchar *str, - glong len, - glong *items_read, - glong *items_written, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gunichar * g_utf8_to_ucs4 (const gchar *str, - glong len, - glong *items_read, - glong *items_written, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gunichar * g_utf8_to_ucs4_fast (const gchar *str, - glong len, - glong *items_written) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gunichar * g_utf16_to_ucs4 (const gunichar2 *str, - glong len, - glong *items_read, - glong *items_written, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar* g_utf16_to_utf8 (const gunichar2 *str, - glong len, - glong *items_read, - glong *items_written, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gunichar2 *g_ucs4_to_utf16 (const gunichar *str, - glong len, - glong *items_read, - glong *items_written, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar* g_ucs4_to_utf8 (const gunichar *str, - glong len, - glong *items_read, - glong *items_written, - GError **error) G_GNUC_MALLOC; - -GLIB_AVAILABLE_IN_ALL -gint g_unichar_to_utf8 (gunichar c, - gchar *outbuf); - -GLIB_AVAILABLE_IN_ALL -gboolean g_utf8_validate (const gchar *str, - gssize max_len, - const gchar **end); -GLIB_AVAILABLE_IN_2_60 -gboolean g_utf8_validate_len (const gchar *str, - gsize max_len, - const gchar **end); - -GLIB_AVAILABLE_IN_ALL -gchar *g_utf8_strup (const gchar *str, - gssize len) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar *g_utf8_strdown (const gchar *str, - gssize len) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar *g_utf8_casefold (const gchar *str, - gssize len) G_GNUC_MALLOC; - -/** - * GNormalizeMode: - * @G_NORMALIZE_DEFAULT: standardize differences that do not affect the - * text content, such as the above-mentioned accent representation - * @G_NORMALIZE_NFD: another name for %G_NORMALIZE_DEFAULT - * @G_NORMALIZE_DEFAULT_COMPOSE: like %G_NORMALIZE_DEFAULT, but with - * composed forms rather than a maximally decomposed form - * @G_NORMALIZE_NFC: another name for %G_NORMALIZE_DEFAULT_COMPOSE - * @G_NORMALIZE_ALL: beyond %G_NORMALIZE_DEFAULT also standardize the - * "compatibility" characters in Unicode, such as SUPERSCRIPT THREE - * to the standard forms (in this case DIGIT THREE). Formatting - * information may be lost but for most text operations such - * characters should be considered the same - * @G_NORMALIZE_NFKD: another name for %G_NORMALIZE_ALL - * @G_NORMALIZE_ALL_COMPOSE: like %G_NORMALIZE_ALL, but with composed - * forms rather than a maximally decomposed form - * @G_NORMALIZE_NFKC: another name for %G_NORMALIZE_ALL_COMPOSE - * - * Defines how a Unicode string is transformed in a canonical - * form, standardizing such issues as whether a character with - * an accent is represented as a base character and combining - * accent or as a single precomposed character. Unicode strings - * should generally be normalized before comparing them. - */ -typedef enum { - G_NORMALIZE_DEFAULT, - G_NORMALIZE_NFD = G_NORMALIZE_DEFAULT, - G_NORMALIZE_DEFAULT_COMPOSE, - G_NORMALIZE_NFC = G_NORMALIZE_DEFAULT_COMPOSE, - G_NORMALIZE_ALL, - G_NORMALIZE_NFKD = G_NORMALIZE_ALL, - G_NORMALIZE_ALL_COMPOSE, - G_NORMALIZE_NFKC = G_NORMALIZE_ALL_COMPOSE -} GNormalizeMode; - -GLIB_AVAILABLE_IN_ALL -gchar *g_utf8_normalize (const gchar *str, - gssize len, - GNormalizeMode mode) G_GNUC_MALLOC; - -GLIB_AVAILABLE_IN_ALL -gint g_utf8_collate (const gchar *str1, - const gchar *str2) G_GNUC_PURE; -GLIB_AVAILABLE_IN_ALL -gchar *g_utf8_collate_key (const gchar *str, - gssize len) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar *g_utf8_collate_key_for_filename (const gchar *str, - gssize len) G_GNUC_MALLOC; - -GLIB_AVAILABLE_IN_2_52 -gchar *g_utf8_make_valid (const gchar *str, - gssize len) G_GNUC_MALLOC; - -G_END_DECLS - -#endif /* __G_UNICODE_H__ */ - -G_BEGIN_DECLS - -typedef struct _GString GString; - -struct _GString -{ - gchar *str; - gsize len; - gsize allocated_len; -}; - -GLIB_AVAILABLE_IN_ALL -GString* g_string_new (const gchar *init); -GLIB_AVAILABLE_IN_ALL -GString* g_string_new_len (const gchar *init, - gssize len); -GLIB_AVAILABLE_IN_ALL -GString* g_string_sized_new (gsize dfl_size); -GLIB_AVAILABLE_IN_ALL -gchar* g_string_free (GString *string, - gboolean free_segment); -GLIB_AVAILABLE_IN_2_34 -GBytes* g_string_free_to_bytes (GString *string); -GLIB_AVAILABLE_IN_ALL -gboolean g_string_equal (const GString *v, - const GString *v2); -GLIB_AVAILABLE_IN_ALL -guint g_string_hash (const GString *str); -GLIB_AVAILABLE_IN_ALL -GString* g_string_assign (GString *string, - const gchar *rval); -GLIB_AVAILABLE_IN_ALL -GString* g_string_truncate (GString *string, - gsize len); -GLIB_AVAILABLE_IN_ALL -GString* g_string_set_size (GString *string, - gsize len); -GLIB_AVAILABLE_IN_ALL -GString* g_string_insert_len (GString *string, - gssize pos, - const gchar *val, - gssize len); -GLIB_AVAILABLE_IN_ALL -GString* g_string_append (GString *string, - const gchar *val); -GLIB_AVAILABLE_IN_ALL -GString* g_string_append_len (GString *string, - const gchar *val, - gssize len); -GLIB_AVAILABLE_IN_ALL -GString* g_string_append_c (GString *string, - gchar c); -GLIB_AVAILABLE_IN_ALL -GString* g_string_append_unichar (GString *string, - gunichar wc); -GLIB_AVAILABLE_IN_ALL -GString* g_string_prepend (GString *string, - const gchar *val); -GLIB_AVAILABLE_IN_ALL -GString* g_string_prepend_c (GString *string, - gchar c); -GLIB_AVAILABLE_IN_ALL -GString* g_string_prepend_unichar (GString *string, - gunichar wc); -GLIB_AVAILABLE_IN_ALL -GString* g_string_prepend_len (GString *string, - const gchar *val, - gssize len); -GLIB_AVAILABLE_IN_ALL -GString* g_string_insert (GString *string, - gssize pos, - const gchar *val); -GLIB_AVAILABLE_IN_ALL -GString* g_string_insert_c (GString *string, - gssize pos, - gchar c); -GLIB_AVAILABLE_IN_ALL -GString* g_string_insert_unichar (GString *string, - gssize pos, - gunichar wc); -GLIB_AVAILABLE_IN_ALL -GString* g_string_overwrite (GString *string, - gsize pos, - const gchar *val); -GLIB_AVAILABLE_IN_ALL -GString* g_string_overwrite_len (GString *string, - gsize pos, - const gchar *val, - gssize len); -GLIB_AVAILABLE_IN_ALL -GString* g_string_erase (GString *string, - gssize pos, - gssize len); -GLIB_AVAILABLE_IN_ALL -GString* g_string_ascii_down (GString *string); -GLIB_AVAILABLE_IN_ALL -GString* g_string_ascii_up (GString *string); -GLIB_AVAILABLE_IN_ALL -void g_string_vprintf (GString *string, - const gchar *format, - va_list args) - G_GNUC_PRINTF(2, 0); -GLIB_AVAILABLE_IN_ALL -void g_string_printf (GString *string, - const gchar *format, - ...) G_GNUC_PRINTF (2, 3); -GLIB_AVAILABLE_IN_ALL -void g_string_append_vprintf (GString *string, - const gchar *format, - va_list args) - G_GNUC_PRINTF(2, 0); -GLIB_AVAILABLE_IN_ALL -void g_string_append_printf (GString *string, - const gchar *format, - ...) G_GNUC_PRINTF (2, 3); -GLIB_AVAILABLE_IN_ALL -GString* g_string_append_uri_escaped (GString *string, - const gchar *unescaped, - const gchar *reserved_chars_allowed, - gboolean allow_utf8); - -/* -- optimize g_strig_append_c --- */ -#ifdef G_CAN_INLINE -static inline GString* -g_string_append_c_inline (GString *gstring, - gchar c) -{ - if (gstring->len + 1 < gstring->allocated_len) - { - gstring->str[gstring->len++] = c; - gstring->str[gstring->len] = 0; - } - else - g_string_insert_c (gstring, -1, c); - return gstring; -} -#undef g_string_append_c -#define g_string_append_c(gstr,c) g_string_append_c_inline (gstr, c) -#endif /* G_CAN_INLINE */ - - -GLIB_DEPRECATED -GString *g_string_down (GString *string); -GLIB_DEPRECATED -GString *g_string_up (GString *string); - -#define g_string_sprintf g_string_printf GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_string_printf) -#define g_string_sprintfa g_string_append_printf GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_string_append_printf) - -G_END_DECLS - -#endif /* __G_STRING_H__ */ - -G_BEGIN_DECLS - -/* GIOChannel - */ - -typedef struct _GIOChannel GIOChannel; -typedef struct _GIOFuncs GIOFuncs; - -typedef enum -{ - G_IO_ERROR_NONE, - G_IO_ERROR_AGAIN, - G_IO_ERROR_INVAL, - G_IO_ERROR_UNKNOWN -} GIOError; - -#define G_IO_CHANNEL_ERROR g_io_channel_error_quark() - -typedef enum -{ - /* Derived from errno */ - G_IO_CHANNEL_ERROR_FBIG, - G_IO_CHANNEL_ERROR_INVAL, - G_IO_CHANNEL_ERROR_IO, - G_IO_CHANNEL_ERROR_ISDIR, - G_IO_CHANNEL_ERROR_NOSPC, - G_IO_CHANNEL_ERROR_NXIO, - G_IO_CHANNEL_ERROR_OVERFLOW, - G_IO_CHANNEL_ERROR_PIPE, - /* Other */ - G_IO_CHANNEL_ERROR_FAILED -} GIOChannelError; - -typedef enum -{ - G_IO_STATUS_ERROR, - G_IO_STATUS_NORMAL, - G_IO_STATUS_EOF, - G_IO_STATUS_AGAIN -} GIOStatus; - -typedef enum -{ - G_SEEK_CUR, - G_SEEK_SET, - G_SEEK_END -} GSeekType; - -typedef enum -{ - G_IO_FLAG_APPEND = 1 << 0, - G_IO_FLAG_NONBLOCK = 1 << 1, - G_IO_FLAG_IS_READABLE = 1 << 2, /* Read only flag */ - G_IO_FLAG_IS_WRITABLE = 1 << 3, /* Read only flag */ - G_IO_FLAG_IS_WRITEABLE = 1 << 3, /* Misspelling in 2.29.10 and earlier */ - G_IO_FLAG_IS_SEEKABLE = 1 << 4, /* Read only flag */ - G_IO_FLAG_MASK = (1 << 5) - 1, - G_IO_FLAG_GET_MASK = G_IO_FLAG_MASK, - G_IO_FLAG_SET_MASK = G_IO_FLAG_APPEND | G_IO_FLAG_NONBLOCK -} GIOFlags; - -struct _GIOChannel -{ - /*< private >*/ - gint ref_count; - GIOFuncs *funcs; - - gchar *encoding; - GIConv read_cd; - GIConv write_cd; - gchar *line_term; /* String which indicates the end of a line of text */ - guint line_term_len; /* So we can have null in the line term */ - - gsize buf_size; - GString *read_buf; /* Raw data from the channel */ - GString *encoded_read_buf; /* Channel data converted to UTF-8 */ - GString *write_buf; /* Data ready to be written to the file */ - gchar partial_write_buf[6]; /* UTF-8 partial characters, null terminated */ - - /* Group the flags together, immediately after partial_write_buf, to save memory */ - - guint use_buffer : 1; /* The encoding uses the buffers */ - guint do_encode : 1; /* The encoding uses the GIConv coverters */ - guint close_on_unref : 1; /* Close the channel on final unref */ - guint is_readable : 1; /* Cached GIOFlag */ - guint is_writeable : 1; /* ditto */ - guint is_seekable : 1; /* ditto */ - - gpointer reserved1; - gpointer reserved2; -}; - -typedef gboolean (*GIOFunc) (GIOChannel *source, - GIOCondition condition, - gpointer data); -struct _GIOFuncs -{ - GIOStatus (*io_read) (GIOChannel *channel, - gchar *buf, - gsize count, - gsize *bytes_read, - GError **err); - GIOStatus (*io_write) (GIOChannel *channel, - const gchar *buf, - gsize count, - gsize *bytes_written, - GError **err); - GIOStatus (*io_seek) (GIOChannel *channel, - gint64 offset, - GSeekType type, - GError **err); - GIOStatus (*io_close) (GIOChannel *channel, - GError **err); - GSource* (*io_create_watch) (GIOChannel *channel, - GIOCondition condition); - void (*io_free) (GIOChannel *channel); - GIOStatus (*io_set_flags) (GIOChannel *channel, - GIOFlags flags, - GError **err); - GIOFlags (*io_get_flags) (GIOChannel *channel); -}; - -GLIB_AVAILABLE_IN_ALL -void g_io_channel_init (GIOChannel *channel); -GLIB_AVAILABLE_IN_ALL -GIOChannel *g_io_channel_ref (GIOChannel *channel); -GLIB_AVAILABLE_IN_ALL -void g_io_channel_unref (GIOChannel *channel); - -GLIB_DEPRECATED_FOR(g_io_channel_read_chars) -GIOError g_io_channel_read (GIOChannel *channel, - gchar *buf, - gsize count, - gsize *bytes_read); - -GLIB_DEPRECATED_FOR(g_io_channel_write_chars) -GIOError g_io_channel_write (GIOChannel *channel, - const gchar *buf, - gsize count, - gsize *bytes_written); - -GLIB_DEPRECATED_FOR(g_io_channel_seek_position) -GIOError g_io_channel_seek (GIOChannel *channel, - gint64 offset, - GSeekType type); - -GLIB_DEPRECATED_FOR(g_io_channel_shutdown) -void g_io_channel_close (GIOChannel *channel); - -GLIB_AVAILABLE_IN_ALL -GIOStatus g_io_channel_shutdown (GIOChannel *channel, - gboolean flush, - GError **err); -GLIB_AVAILABLE_IN_ALL -guint g_io_add_watch_full (GIOChannel *channel, - gint priority, - GIOCondition condition, - GIOFunc func, - gpointer user_data, - GDestroyNotify notify); -GLIB_AVAILABLE_IN_ALL -GSource * g_io_create_watch (GIOChannel *channel, - GIOCondition condition); -GLIB_AVAILABLE_IN_ALL -guint g_io_add_watch (GIOChannel *channel, - GIOCondition condition, - GIOFunc func, - gpointer user_data); - -/* character encoding conversion involved functions. - */ - -GLIB_AVAILABLE_IN_ALL -void g_io_channel_set_buffer_size (GIOChannel *channel, - gsize size); -GLIB_AVAILABLE_IN_ALL -gsize g_io_channel_get_buffer_size (GIOChannel *channel); -GLIB_AVAILABLE_IN_ALL -GIOCondition g_io_channel_get_buffer_condition (GIOChannel *channel); -GLIB_AVAILABLE_IN_ALL -GIOStatus g_io_channel_set_flags (GIOChannel *channel, - GIOFlags flags, - GError **error); -GLIB_AVAILABLE_IN_ALL -GIOFlags g_io_channel_get_flags (GIOChannel *channel); -GLIB_AVAILABLE_IN_ALL -void g_io_channel_set_line_term (GIOChannel *channel, - const gchar *line_term, - gint length); -GLIB_AVAILABLE_IN_ALL -const gchar * g_io_channel_get_line_term (GIOChannel *channel, - gint *length); -GLIB_AVAILABLE_IN_ALL -void g_io_channel_set_buffered (GIOChannel *channel, - gboolean buffered); -GLIB_AVAILABLE_IN_ALL -gboolean g_io_channel_get_buffered (GIOChannel *channel); -GLIB_AVAILABLE_IN_ALL -GIOStatus g_io_channel_set_encoding (GIOChannel *channel, - const gchar *encoding, - GError **error); -GLIB_AVAILABLE_IN_ALL -const gchar * g_io_channel_get_encoding (GIOChannel *channel); -GLIB_AVAILABLE_IN_ALL -void g_io_channel_set_close_on_unref (GIOChannel *channel, - gboolean do_close); -GLIB_AVAILABLE_IN_ALL -gboolean g_io_channel_get_close_on_unref (GIOChannel *channel); - - -GLIB_AVAILABLE_IN_ALL -GIOStatus g_io_channel_flush (GIOChannel *channel, - GError **error); -GLIB_AVAILABLE_IN_ALL -GIOStatus g_io_channel_read_line (GIOChannel *channel, - gchar **str_return, - gsize *length, - gsize *terminator_pos, - GError **error); -GLIB_AVAILABLE_IN_ALL -GIOStatus g_io_channel_read_line_string (GIOChannel *channel, - GString *buffer, - gsize *terminator_pos, - GError **error); -GLIB_AVAILABLE_IN_ALL -GIOStatus g_io_channel_read_to_end (GIOChannel *channel, - gchar **str_return, - gsize *length, - GError **error); -GLIB_AVAILABLE_IN_ALL -GIOStatus g_io_channel_read_chars (GIOChannel *channel, - gchar *buf, - gsize count, - gsize *bytes_read, - GError **error); -GLIB_AVAILABLE_IN_ALL -GIOStatus g_io_channel_read_unichar (GIOChannel *channel, - gunichar *thechar, - GError **error); -GLIB_AVAILABLE_IN_ALL -GIOStatus g_io_channel_write_chars (GIOChannel *channel, - const gchar *buf, - gssize count, - gsize *bytes_written, - GError **error); -GLIB_AVAILABLE_IN_ALL -GIOStatus g_io_channel_write_unichar (GIOChannel *channel, - gunichar thechar, - GError **error); -GLIB_AVAILABLE_IN_ALL -GIOStatus g_io_channel_seek_position (GIOChannel *channel, - gint64 offset, - GSeekType type, - GError **error); -GLIB_AVAILABLE_IN_ALL -GIOChannel* g_io_channel_new_file (const gchar *filename, - const gchar *mode, - GError **error); - -/* Error handling */ - -GLIB_AVAILABLE_IN_ALL -GQuark g_io_channel_error_quark (void); -GLIB_AVAILABLE_IN_ALL -GIOChannelError g_io_channel_error_from_errno (gint en); - -/* On Unix, IO channels created with this function for any file - * descriptor or socket. - * - * On Win32, this can be used either for files opened with the MSVCRT - * (the Microsoft run-time C library) _open() or _pipe, including file - * descriptors 0, 1 and 2 (corresponding to stdin, stdout and stderr), - * or for Winsock SOCKETs. If the parameter is a legal file - * descriptor, it is assumed to be such, otherwise it should be a - * SOCKET. This relies on SOCKETs and file descriptors not - * overlapping. If you want to be certain, call either - * g_io_channel_win32_new_fd() or g_io_channel_win32_new_socket() - * instead as appropriate. - * - * The term file descriptor as used in the context of Win32 refers to - * the emulated Unix-like file descriptors MSVCRT provides. The native - * corresponding concept is file HANDLE. There isn't as of yet a way to - * get GIOChannels for Win32 file HANDLEs. - */ -GLIB_AVAILABLE_IN_ALL -GIOChannel* g_io_channel_unix_new (int fd); -GLIB_AVAILABLE_IN_ALL -gint g_io_channel_unix_get_fd (GIOChannel *channel); - - -/* Hook for GClosure / GSource integration. Don't touch */ -GLIB_VAR GSourceFuncs g_io_watch_funcs; - -#ifdef G_OS_WIN32 - -/* You can use this "pseudo file descriptor" in a GPollFD to add - * polling for Windows messages. GTK applications should not do that. - */ - -#define G_WIN32_MSG_HANDLE 19981206 - -/* Use this to get a GPollFD from a GIOChannel, so that you can call - * g_io_channel_win32_poll(). After calling this you should only use - * g_io_channel_read() to read from the GIOChannel, i.e. never read() - * from the underlying file descriptor. For SOCKETs, it is possible to call - * recv(). - */ -GLIB_AVAILABLE_IN_ALL -void g_io_channel_win32_make_pollfd (GIOChannel *channel, - GIOCondition condition, - GPollFD *fd); - -/* This can be used to wait until at least one of the channels is readable. - * On Unix you would do a select() on the file descriptors of the channels. - */ -GLIB_AVAILABLE_IN_ALL -gint g_io_channel_win32_poll (GPollFD *fds, - gint n_fds, - gint timeout_); - -/* Create an IO channel for Windows messages for window handle hwnd. */ -#if GLIB_SIZEOF_VOID_P == 8 -/* We use gsize here so that it is still an integer type and not a - * pointer, like the guint in the traditional prototype. We can't use - * intptr_t as that is not portable enough. - */ -GLIB_AVAILABLE_IN_ALL -GIOChannel *g_io_channel_win32_new_messages (gsize hwnd); -#else -GLIB_AVAILABLE_IN_ALL -GIOChannel *g_io_channel_win32_new_messages (guint hwnd); -#endif - -/* Create an IO channel for C runtime (emulated Unix-like) file - * descriptors. After calling g_io_add_watch() on a IO channel - * returned by this function, you shouldn't call read() on the file - * descriptor. This is because adding polling for a file descriptor is - * implemented on Win32 by starting a thread that sits blocked in a - * read() from the file descriptor most of the time. All reads from - * the file descriptor should be done by this internal GLib - * thread. Your code should call only g_io_channel_read_chars(). - */ -GLIB_AVAILABLE_IN_ALL -GIOChannel* g_io_channel_win32_new_fd (gint fd); - -/* Get the C runtime file descriptor of a channel. */ -GLIB_AVAILABLE_IN_ALL -gint g_io_channel_win32_get_fd (GIOChannel *channel); - -/* Create an IO channel for a winsock socket. The parameter should be - * a SOCKET. Contrary to IO channels for file descriptors (on *Win32), - * you can use normal recv() or recvfrom() on sockets even if GLib - * is polling them. - */ -GLIB_AVAILABLE_IN_ALL -GIOChannel *g_io_channel_win32_new_socket (gint socket); - -GLIB_DEPRECATED_FOR(g_io_channel_win32_new_socket) -GIOChannel *g_io_channel_win32_new_stream_socket (gint socket); - -GLIB_AVAILABLE_IN_ALL -void g_io_channel_win32_set_debug (GIOChannel *channel, - gboolean flag); - -#endif - -G_END_DECLS - -#endif /* __G_IOCHANNEL_H__ */ -/* gkeyfile.h - desktop entry file parser - * - * Copyright 2004 Red Hat, Inc. - * - * Ray Strode - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_KEY_FILE_H__ -#define __G_KEY_FILE_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef enum -{ - G_KEY_FILE_ERROR_UNKNOWN_ENCODING, - G_KEY_FILE_ERROR_PARSE, - G_KEY_FILE_ERROR_NOT_FOUND, - G_KEY_FILE_ERROR_KEY_NOT_FOUND, - G_KEY_FILE_ERROR_GROUP_NOT_FOUND, - G_KEY_FILE_ERROR_INVALID_VALUE -} GKeyFileError; - -#define G_KEY_FILE_ERROR g_key_file_error_quark() - -GLIB_AVAILABLE_IN_ALL -GQuark g_key_file_error_quark (void); - -typedef struct _GKeyFile GKeyFile; - -typedef enum -{ - G_KEY_FILE_NONE = 0, - G_KEY_FILE_KEEP_COMMENTS = 1 << 0, - G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1 -} GKeyFileFlags; - -GLIB_AVAILABLE_IN_ALL -GKeyFile *g_key_file_new (void); -GLIB_AVAILABLE_IN_ALL -GKeyFile *g_key_file_ref (GKeyFile *key_file); -GLIB_AVAILABLE_IN_ALL -void g_key_file_unref (GKeyFile *key_file); -GLIB_AVAILABLE_IN_ALL -void g_key_file_free (GKeyFile *key_file); -GLIB_AVAILABLE_IN_ALL -void g_key_file_set_list_separator (GKeyFile *key_file, - gchar separator); -GLIB_AVAILABLE_IN_ALL -gboolean g_key_file_load_from_file (GKeyFile *key_file, - const gchar *file, - GKeyFileFlags flags, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_key_file_load_from_data (GKeyFile *key_file, - const gchar *data, - gsize length, - GKeyFileFlags flags, - GError **error); -GLIB_AVAILABLE_IN_2_50 -gboolean g_key_file_load_from_bytes (GKeyFile *key_file, - GBytes *bytes, - GKeyFileFlags flags, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_key_file_load_from_dirs (GKeyFile *key_file, - const gchar *file, - const gchar **search_dirs, - gchar **full_path, - GKeyFileFlags flags, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_key_file_load_from_data_dirs (GKeyFile *key_file, - const gchar *file, - gchar **full_path, - GKeyFileFlags flags, - GError **error); -GLIB_AVAILABLE_IN_ALL -gchar *g_key_file_to_data (GKeyFile *key_file, - gsize *length, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_2_40 -gboolean g_key_file_save_to_file (GKeyFile *key_file, - const gchar *filename, - GError **error); -GLIB_AVAILABLE_IN_ALL -gchar *g_key_file_get_start_group (GKeyFile *key_file) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar **g_key_file_get_groups (GKeyFile *key_file, - gsize *length); -GLIB_AVAILABLE_IN_ALL -gchar **g_key_file_get_keys (GKeyFile *key_file, - const gchar *group_name, - gsize *length, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_key_file_has_group (GKeyFile *key_file, - const gchar *group_name); -GLIB_AVAILABLE_IN_ALL -gboolean g_key_file_has_key (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - GError **error); -GLIB_AVAILABLE_IN_ALL -gchar *g_key_file_get_value (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -void g_key_file_set_value (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - const gchar *value); -GLIB_AVAILABLE_IN_ALL -gchar *g_key_file_get_string (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -void g_key_file_set_string (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - const gchar *string); -GLIB_AVAILABLE_IN_ALL -gchar *g_key_file_get_locale_string (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - const gchar *locale, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_2_56 -gchar *g_key_file_get_locale_for_key (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - const gchar *locale) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -void g_key_file_set_locale_string (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - const gchar *locale, - const gchar *string); -GLIB_AVAILABLE_IN_ALL -gboolean g_key_file_get_boolean (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - GError **error); -GLIB_AVAILABLE_IN_ALL -void g_key_file_set_boolean (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - gboolean value); -GLIB_AVAILABLE_IN_ALL -gint g_key_file_get_integer (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - GError **error); -GLIB_AVAILABLE_IN_ALL -void g_key_file_set_integer (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - gint value); -GLIB_AVAILABLE_IN_ALL -gint64 g_key_file_get_int64 (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - GError **error); -GLIB_AVAILABLE_IN_ALL -void g_key_file_set_int64 (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - gint64 value); -GLIB_AVAILABLE_IN_ALL -guint64 g_key_file_get_uint64 (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - GError **error); -GLIB_AVAILABLE_IN_ALL -void g_key_file_set_uint64 (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - guint64 value); -GLIB_AVAILABLE_IN_ALL -gdouble g_key_file_get_double (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - GError **error); -GLIB_AVAILABLE_IN_ALL -void g_key_file_set_double (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - gdouble value); -GLIB_AVAILABLE_IN_ALL -gchar **g_key_file_get_string_list (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - gsize *length, - GError **error); -GLIB_AVAILABLE_IN_ALL -void g_key_file_set_string_list (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - const gchar * const list[], - gsize length); -GLIB_AVAILABLE_IN_ALL -gchar **g_key_file_get_locale_string_list (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - const gchar *locale, - gsize *length, - GError **error); -GLIB_AVAILABLE_IN_ALL -void g_key_file_set_locale_string_list (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - const gchar *locale, - const gchar * const list[], - gsize length); -GLIB_AVAILABLE_IN_ALL -gboolean *g_key_file_get_boolean_list (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - gsize *length, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -void g_key_file_set_boolean_list (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - gboolean list[], - gsize length); -GLIB_AVAILABLE_IN_ALL -gint *g_key_file_get_integer_list (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - gsize *length, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -void g_key_file_set_double_list (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - gdouble list[], - gsize length); -GLIB_AVAILABLE_IN_ALL -gdouble *g_key_file_get_double_list (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - gsize *length, - GError **error) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -void g_key_file_set_integer_list (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - gint list[], - gsize length); -GLIB_AVAILABLE_IN_ALL -gboolean g_key_file_set_comment (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - const gchar *comment, - GError **error); -GLIB_AVAILABLE_IN_ALL -gchar *g_key_file_get_comment (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - GError **error) G_GNUC_MALLOC; - -GLIB_AVAILABLE_IN_ALL -gboolean g_key_file_remove_comment (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_key_file_remove_key (GKeyFile *key_file, - const gchar *group_name, - const gchar *key, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_key_file_remove_group (GKeyFile *key_file, - const gchar *group_name, - GError **error); - -/* Defines for handling freedesktop.org Desktop files */ -#define G_KEY_FILE_DESKTOP_GROUP "Desktop Entry" - -#define G_KEY_FILE_DESKTOP_KEY_TYPE "Type" -#define G_KEY_FILE_DESKTOP_KEY_VERSION "Version" -#define G_KEY_FILE_DESKTOP_KEY_NAME "Name" -#define G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME "GenericName" -#define G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY "NoDisplay" -#define G_KEY_FILE_DESKTOP_KEY_COMMENT "Comment" -#define G_KEY_FILE_DESKTOP_KEY_ICON "Icon" -#define G_KEY_FILE_DESKTOP_KEY_HIDDEN "Hidden" -#define G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN "OnlyShowIn" -#define G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN "NotShowIn" -#define G_KEY_FILE_DESKTOP_KEY_TRY_EXEC "TryExec" -#define G_KEY_FILE_DESKTOP_KEY_EXEC "Exec" -#define G_KEY_FILE_DESKTOP_KEY_PATH "Path" -#define G_KEY_FILE_DESKTOP_KEY_TERMINAL "Terminal" -#define G_KEY_FILE_DESKTOP_KEY_MIME_TYPE "MimeType" -#define G_KEY_FILE_DESKTOP_KEY_CATEGORIES "Categories" -#define G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY "StartupNotify" -#define G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS "StartupWMClass" -#define G_KEY_FILE_DESKTOP_KEY_URL "URL" -#define G_KEY_FILE_DESKTOP_KEY_DBUS_ACTIVATABLE "DBusActivatable" -#define G_KEY_FILE_DESKTOP_KEY_ACTIONS "Actions" - -#define G_KEY_FILE_DESKTOP_TYPE_APPLICATION "Application" -#define G_KEY_FILE_DESKTOP_TYPE_LINK "Link" -#define G_KEY_FILE_DESKTOP_TYPE_DIRECTORY "Directory" - -G_END_DECLS - -#endif /* __G_KEY_FILE_H__ */ -/* GLIB - Library of useful routines for C programming - * gmappedfile.h: Simplified wrapper around the mmap function - * - * Copyright 2005 Matthias Clasen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#ifndef __G_MAPPED_FILE_H__ -#define __G_MAPPED_FILE_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GMappedFile GMappedFile; - -GLIB_AVAILABLE_IN_ALL -GMappedFile *g_mapped_file_new (const gchar *filename, - gboolean writable, - GError **error); -GLIB_AVAILABLE_IN_ALL -GMappedFile *g_mapped_file_new_from_fd (gint fd, - gboolean writable, - GError **error); -GLIB_AVAILABLE_IN_ALL -gsize g_mapped_file_get_length (GMappedFile *file); -GLIB_AVAILABLE_IN_ALL -gchar *g_mapped_file_get_contents (GMappedFile *file); -GLIB_AVAILABLE_IN_2_34 -GBytes * g_mapped_file_get_bytes (GMappedFile *file); -GLIB_AVAILABLE_IN_ALL -GMappedFile *g_mapped_file_ref (GMappedFile *file); -GLIB_AVAILABLE_IN_ALL -void g_mapped_file_unref (GMappedFile *file); - -GLIB_DEPRECATED_FOR(g_mapped_file_unref) -void g_mapped_file_free (GMappedFile *file); - -G_END_DECLS - -#endif /* __G_MAPPED_FILE_H__ */ -/* gmarkup.h - Simple XML-like string parser/writer - * - * Copyright 2000 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_MARKUP_H__ -#define __G_MARKUP_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -#include - - -G_BEGIN_DECLS - -/** - * GMarkupError: - * @G_MARKUP_ERROR_BAD_UTF8: text being parsed was not valid UTF-8 - * @G_MARKUP_ERROR_EMPTY: document contained nothing, or only whitespace - * @G_MARKUP_ERROR_PARSE: document was ill-formed - * @G_MARKUP_ERROR_UNKNOWN_ELEMENT: error should be set by #GMarkupParser - * functions; element wasn't known - * @G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE: error should be set by #GMarkupParser - * functions; attribute wasn't known - * @G_MARKUP_ERROR_INVALID_CONTENT: error should be set by #GMarkupParser - * functions; content was invalid - * @G_MARKUP_ERROR_MISSING_ATTRIBUTE: error should be set by #GMarkupParser - * functions; a required attribute was missing - * - * Error codes returned by markup parsing. - */ -typedef enum -{ - G_MARKUP_ERROR_BAD_UTF8, - G_MARKUP_ERROR_EMPTY, - G_MARKUP_ERROR_PARSE, - /* The following are primarily intended for specific GMarkupParser - * implementations to set. - */ - G_MARKUP_ERROR_UNKNOWN_ELEMENT, - G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, - G_MARKUP_ERROR_INVALID_CONTENT, - G_MARKUP_ERROR_MISSING_ATTRIBUTE -} GMarkupError; - -/** - * G_MARKUP_ERROR: - * - * Error domain for markup parsing. - * Errors in this domain will be from the #GMarkupError enumeration. - * See #GError for information on error domains. - */ -#define G_MARKUP_ERROR g_markup_error_quark () - -GLIB_AVAILABLE_IN_ALL -GQuark g_markup_error_quark (void); - -/** - * GMarkupParseFlags: - * @G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG: flag you should not use - * @G_MARKUP_TREAT_CDATA_AS_TEXT: When this flag is set, CDATA marked - * sections are not passed literally to the @passthrough function of - * the parser. Instead, the content of the section (without the - * ``) is - * passed to the @text function. This flag was added in GLib 2.12 - * @G_MARKUP_PREFIX_ERROR_POSITION: Normally errors caught by GMarkup - * itself have line/column information prefixed to them to let the - * caller know the location of the error. When this flag is set the - * location information is also prefixed to errors generated by the - * #GMarkupParser implementation functions - * @G_MARKUP_IGNORE_QUALIFIED: Ignore (don't report) qualified - * attributes and tags, along with their contents. A qualified - * attribute or tag is one that contains ':' in its name (ie: is in - * another namespace). Since: 2.40. - * - * Flags that affect the behaviour of the parser. - */ -typedef enum -{ - G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 << 0, - G_MARKUP_TREAT_CDATA_AS_TEXT = 1 << 1, - G_MARKUP_PREFIX_ERROR_POSITION = 1 << 2, - G_MARKUP_IGNORE_QUALIFIED = 1 << 3 -} GMarkupParseFlags; - -/** - * GMarkupParseContext: - * - * A parse context is used to parse a stream of bytes that - * you expect to contain marked-up text. - * - * See g_markup_parse_context_new(), #GMarkupParser, and so - * on for more details. - */ -typedef struct _GMarkupParseContext GMarkupParseContext; -typedef struct _GMarkupParser GMarkupParser; - -/** - * GMarkupParser: - * @start_element: Callback to invoke when the opening tag of an element - * is seen. The callback's @attribute_names and @attribute_values parameters - * are %NULL-terminated. - * @end_element: Callback to invoke when the closing tag of an element - * is seen. Note that this is also called for empty tags like - * ``. - * @text: Callback to invoke when some text is seen (text is always - * inside an element). Note that the text of an element may be spread - * over multiple calls of this function. If the - * %G_MARKUP_TREAT_CDATA_AS_TEXT flag is set, this function is also - * called for the content of CDATA marked sections. - * @passthrough: Callback to invoke for comments, processing instructions - * and doctype declarations; if you're re-writing the parsed document, - * write the passthrough text back out in the same position. If the - * %G_MARKUP_TREAT_CDATA_AS_TEXT flag is not set, this function is also - * called for CDATA marked sections. - * @error: Callback to invoke when an error occurs. - * - * Any of the fields in #GMarkupParser can be %NULL, in which case they - * will be ignored. Except for the @error function, any of these callbacks - * can set an error; in particular the %G_MARKUP_ERROR_UNKNOWN_ELEMENT, - * %G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, and %G_MARKUP_ERROR_INVALID_CONTENT - * errors are intended to be set from these callbacks. If you set an error - * from a callback, g_markup_parse_context_parse() will report that error - * back to its caller. - */ -struct _GMarkupParser -{ - /* Called for open tags */ - void (*start_element) (GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - gpointer user_data, - GError **error); - - /* Called for close tags */ - void (*end_element) (GMarkupParseContext *context, - const gchar *element_name, - gpointer user_data, - GError **error); - - /* Called for character data */ - /* text is not nul-terminated */ - void (*text) (GMarkupParseContext *context, - const gchar *text, - gsize text_len, - gpointer user_data, - GError **error); - - /* Called for strings that should be re-saved verbatim in this same - * position, but are not otherwise interpretable. At the moment - * this includes comments and processing instructions. - */ - /* text is not nul-terminated. */ - void (*passthrough) (GMarkupParseContext *context, - const gchar *passthrough_text, - gsize text_len, - gpointer user_data, - GError **error); - - /* Called on error, including one set by other - * methods in the vtable. The GError should not be freed. - */ - void (*error) (GMarkupParseContext *context, - GError *error, - gpointer user_data); -}; - -GLIB_AVAILABLE_IN_ALL -GMarkupParseContext *g_markup_parse_context_new (const GMarkupParser *parser, - GMarkupParseFlags flags, - gpointer user_data, - GDestroyNotify user_data_dnotify); -GLIB_AVAILABLE_IN_2_36 -GMarkupParseContext *g_markup_parse_context_ref (GMarkupParseContext *context); -GLIB_AVAILABLE_IN_2_36 -void g_markup_parse_context_unref (GMarkupParseContext *context); -GLIB_AVAILABLE_IN_ALL -void g_markup_parse_context_free (GMarkupParseContext *context); -GLIB_AVAILABLE_IN_ALL -gboolean g_markup_parse_context_parse (GMarkupParseContext *context, - const gchar *text, - gssize text_len, - GError **error); -GLIB_AVAILABLE_IN_ALL -void g_markup_parse_context_push (GMarkupParseContext *context, - const GMarkupParser *parser, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -gpointer g_markup_parse_context_pop (GMarkupParseContext *context); - -GLIB_AVAILABLE_IN_ALL -gboolean g_markup_parse_context_end_parse (GMarkupParseContext *context, - GError **error); -GLIB_AVAILABLE_IN_ALL -const gchar * g_markup_parse_context_get_element (GMarkupParseContext *context); -GLIB_AVAILABLE_IN_ALL -const GSList * g_markup_parse_context_get_element_stack (GMarkupParseContext *context); - -/* For user-constructed error messages, has no precise semantics */ -GLIB_AVAILABLE_IN_ALL -void g_markup_parse_context_get_position (GMarkupParseContext *context, - gint *line_number, - gint *char_number); -GLIB_AVAILABLE_IN_ALL -gpointer g_markup_parse_context_get_user_data (GMarkupParseContext *context); - -/* useful when saving */ -GLIB_AVAILABLE_IN_ALL -gchar* g_markup_escape_text (const gchar *text, - gssize length); - -GLIB_AVAILABLE_IN_ALL -gchar *g_markup_printf_escaped (const char *format, - ...) G_GNUC_PRINTF (1, 2); -GLIB_AVAILABLE_IN_ALL -gchar *g_markup_vprintf_escaped (const char *format, - va_list args) G_GNUC_PRINTF(1, 0); - -typedef enum -{ - G_MARKUP_COLLECT_INVALID, - G_MARKUP_COLLECT_STRING, - G_MARKUP_COLLECT_STRDUP, - G_MARKUP_COLLECT_BOOLEAN, - G_MARKUP_COLLECT_TRISTATE, - - G_MARKUP_COLLECT_OPTIONAL = (1 << 16) -} GMarkupCollectType; - - -/* useful from start_element */ -GLIB_AVAILABLE_IN_ALL -gboolean g_markup_collect_attributes (const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - GError **error, - GMarkupCollectType first_type, - const gchar *first_attr, - ...); - -G_END_DECLS - -#endif /* __G_MARKUP_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_MESSAGES_H__ -#define __G_MESSAGES_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -#include -/* - * Copyright © 2007, 2008 Ryan Lortie - * Copyright © 2009, 2010 Codethink Limited - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - * - * Author: Ryan Lortie - */ - -#ifndef __G_VARIANT_H__ -#define __G_VARIANT_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -/* - * Copyright © 2007, 2008 Ryan Lortie - * Copyright © 2009, 2010 Codethink Limited - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - * - * Author: Ryan Lortie - */ - -#ifndef __G_VARIANT_TYPE_H__ -#define __G_VARIANT_TYPE_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/** - * GVariantType: - * - * A type in the GVariant type system. - * - * Two types may not be compared by value; use g_variant_type_equal() or - * g_variant_type_is_subtype_of(). May be copied using - * g_variant_type_copy() and freed using g_variant_type_free(). - **/ -typedef struct _GVariantType GVariantType; - -/** - * G_VARIANT_TYPE_BOOLEAN: - * - * The type of a value that can be either %TRUE or %FALSE. - **/ -#define G_VARIANT_TYPE_BOOLEAN ((const GVariantType *) "b") - -/** - * G_VARIANT_TYPE_BYTE: - * - * The type of an integer value that can range from 0 to 255. - **/ -#define G_VARIANT_TYPE_BYTE ((const GVariantType *) "y") - -/** - * G_VARIANT_TYPE_INT16: - * - * The type of an integer value that can range from -32768 to 32767. - **/ -#define G_VARIANT_TYPE_INT16 ((const GVariantType *) "n") - -/** - * G_VARIANT_TYPE_UINT16: - * - * The type of an integer value that can range from 0 to 65535. - * There were about this many people living in Toronto in the 1870s. - **/ -#define G_VARIANT_TYPE_UINT16 ((const GVariantType *) "q") - -/** - * G_VARIANT_TYPE_INT32: - * - * The type of an integer value that can range from -2147483648 to - * 2147483647. - **/ -#define G_VARIANT_TYPE_INT32 ((const GVariantType *) "i") - -/** - * G_VARIANT_TYPE_UINT32: - * - * The type of an integer value that can range from 0 to 4294967295. - * That's one number for everyone who was around in the late 1970s. - **/ -#define G_VARIANT_TYPE_UINT32 ((const GVariantType *) "u") - -/** - * G_VARIANT_TYPE_INT64: - * - * The type of an integer value that can range from - * -9223372036854775808 to 9223372036854775807. - **/ -#define G_VARIANT_TYPE_INT64 ((const GVariantType *) "x") - -/** - * G_VARIANT_TYPE_UINT64: - * - * The type of an integer value that can range from 0 - * to 18446744073709551615 (inclusive). That's a really big number, - * but a Rubik's cube can have a bit more than twice as many possible - * positions. - **/ -#define G_VARIANT_TYPE_UINT64 ((const GVariantType *) "t") - -/** - * G_VARIANT_TYPE_DOUBLE: - * - * The type of a double precision IEEE754 floating point number. - * These guys go up to about 1.80e308 (plus and minus) but miss out on - * some numbers in between. In any case, that's far greater than the - * estimated number of fundamental particles in the observable - * universe. - **/ -#define G_VARIANT_TYPE_DOUBLE ((const GVariantType *) "d") - -/** - * G_VARIANT_TYPE_STRING: - * - * The type of a string. "" is a string. %NULL is not a string. - **/ -#define G_VARIANT_TYPE_STRING ((const GVariantType *) "s") - -/** - * G_VARIANT_TYPE_OBJECT_PATH: - * - * The type of a D-Bus object reference. These are strings of a - * specific format used to identify objects at a given destination on - * the bus. - * - * If you are not interacting with D-Bus, then there is no reason to make - * use of this type. If you are, then the D-Bus specification contains a - * precise description of valid object paths. - **/ -#define G_VARIANT_TYPE_OBJECT_PATH ((const GVariantType *) "o") - -/** - * G_VARIANT_TYPE_SIGNATURE: - * - * The type of a D-Bus type signature. These are strings of a specific - * format used as type signatures for D-Bus methods and messages. - * - * If you are not interacting with D-Bus, then there is no reason to make - * use of this type. If you are, then the D-Bus specification contains a - * precise description of valid signature strings. - **/ -#define G_VARIANT_TYPE_SIGNATURE ((const GVariantType *) "g") - -/** - * G_VARIANT_TYPE_VARIANT: - * - * The type of a box that contains any other value (including another - * variant). - **/ -#define G_VARIANT_TYPE_VARIANT ((const GVariantType *) "v") - -/** - * G_VARIANT_TYPE_HANDLE: - * - * The type of a 32bit signed integer value, that by convention, is used - * as an index into an array of file descriptors that are sent alongside - * a D-Bus message. - * - * If you are not interacting with D-Bus, then there is no reason to make - * use of this type. - **/ -#define G_VARIANT_TYPE_HANDLE ((const GVariantType *) "h") - -/** - * G_VARIANT_TYPE_UNIT: - * - * The empty tuple type. Has only one instance. Known also as "triv" - * or "void". - **/ -#define G_VARIANT_TYPE_UNIT ((const GVariantType *) "()") - -/** - * G_VARIANT_TYPE_ANY: - * - * An indefinite type that is a supertype of every type (including - * itself). - **/ -#define G_VARIANT_TYPE_ANY ((const GVariantType *) "*") - -/** - * G_VARIANT_TYPE_BASIC: - * - * An indefinite type that is a supertype of every basic (ie: - * non-container) type. - **/ -#define G_VARIANT_TYPE_BASIC ((const GVariantType *) "?") - -/** - * G_VARIANT_TYPE_MAYBE: - * - * An indefinite type that is a supertype of every maybe type. - **/ -#define G_VARIANT_TYPE_MAYBE ((const GVariantType *) "m*") - -/** - * G_VARIANT_TYPE_ARRAY: - * - * An indefinite type that is a supertype of every array type. - **/ -#define G_VARIANT_TYPE_ARRAY ((const GVariantType *) "a*") - -/** - * G_VARIANT_TYPE_TUPLE: - * - * An indefinite type that is a supertype of every tuple type, - * regardless of the number of items in the tuple. - **/ -#define G_VARIANT_TYPE_TUPLE ((const GVariantType *) "r") - -/** - * G_VARIANT_TYPE_DICT_ENTRY: - * - * An indefinite type that is a supertype of every dictionary entry - * type. - **/ -#define G_VARIANT_TYPE_DICT_ENTRY ((const GVariantType *) "{?*}") - -/** - * G_VARIANT_TYPE_DICTIONARY: - * - * An indefinite type that is a supertype of every dictionary type -- - * that is, any array type that has an element type equal to any - * dictionary entry type. - **/ -#define G_VARIANT_TYPE_DICTIONARY ((const GVariantType *) "a{?*}") - -/** - * G_VARIANT_TYPE_STRING_ARRAY: - * - * The type of an array of strings. - **/ -#define G_VARIANT_TYPE_STRING_ARRAY ((const GVariantType *) "as") - -/** - * G_VARIANT_TYPE_OBJECT_PATH_ARRAY: - * - * The type of an array of object paths. - **/ -#define G_VARIANT_TYPE_OBJECT_PATH_ARRAY ((const GVariantType *) "ao") - -/** - * G_VARIANT_TYPE_BYTESTRING: - * - * The type of an array of bytes. This type is commonly used to pass - * around strings that may not be valid utf8. In that case, the - * convention is that the nul terminator character should be included as - * the last character in the array. - **/ -#define G_VARIANT_TYPE_BYTESTRING ((const GVariantType *) "ay") - -/** - * G_VARIANT_TYPE_BYTESTRING_ARRAY: - * - * The type of an array of byte strings (an array of arrays of bytes). - **/ -#define G_VARIANT_TYPE_BYTESTRING_ARRAY ((const GVariantType *) "aay") - -/** - * G_VARIANT_TYPE_VARDICT: - * - * The type of a dictionary mapping strings to variants (the ubiquitous - * "a{sv}" type). - * - * Since: 2.30 - **/ -#define G_VARIANT_TYPE_VARDICT ((const GVariantType *) "a{sv}") - - -/** - * G_VARIANT_TYPE: - * @type_string: a well-formed #GVariantType type string - * - * Converts a string to a const #GVariantType. Depending on the - * current debugging level, this function may perform a runtime check - * to ensure that @string is a valid GVariant type string. - * - * It is always a programmer error to use this macro with an invalid - * type string. If in doubt, use g_variant_type_string_is_valid() to - * check if the string is valid. - * - * Since 2.24 - **/ -#ifndef G_DISABLE_CHECKS -# define G_VARIANT_TYPE(type_string) (g_variant_type_checked_ ((type_string))) -#else -# define G_VARIANT_TYPE(type_string) ((const GVariantType *) (type_string)) -#endif - -/* type string checking */ -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_string_is_valid (const gchar *type_string); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_string_scan (const gchar *string, - const gchar *limit, - const gchar **endptr); - -/* create/destroy */ -GLIB_AVAILABLE_IN_ALL -void g_variant_type_free (GVariantType *type); -GLIB_AVAILABLE_IN_ALL -GVariantType * g_variant_type_copy (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -GVariantType * g_variant_type_new (const gchar *type_string); - -/* getters */ -GLIB_AVAILABLE_IN_ALL -gsize g_variant_type_get_string_length (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -const gchar * g_variant_type_peek_string (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -gchar * g_variant_type_dup_string (const GVariantType *type); - -/* classification */ -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_definite (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_container (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_basic (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_maybe (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_array (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_tuple (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_dict_entry (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_variant (const GVariantType *type); - -/* for hash tables */ -GLIB_AVAILABLE_IN_ALL -guint g_variant_type_hash (gconstpointer type); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_equal (gconstpointer type1, - gconstpointer type2); - -/* subtypes */ -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_type_is_subtype_of (const GVariantType *type, - const GVariantType *supertype); - -/* type iterator interface */ -GLIB_AVAILABLE_IN_ALL -const GVariantType * g_variant_type_element (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -const GVariantType * g_variant_type_first (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -const GVariantType * g_variant_type_next (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -gsize g_variant_type_n_items (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -const GVariantType * g_variant_type_key (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -const GVariantType * g_variant_type_value (const GVariantType *type); - -/* constructors */ -GLIB_AVAILABLE_IN_ALL -GVariantType * g_variant_type_new_array (const GVariantType *element); -GLIB_AVAILABLE_IN_ALL -GVariantType * g_variant_type_new_maybe (const GVariantType *element); -GLIB_AVAILABLE_IN_ALL -GVariantType * g_variant_type_new_tuple (const GVariantType * const *items, - gint length); -GLIB_AVAILABLE_IN_ALL -GVariantType * g_variant_type_new_dict_entry (const GVariantType *key, - const GVariantType *value); - -/*< private >*/ -GLIB_AVAILABLE_IN_ALL -const GVariantType * g_variant_type_checked_ (const gchar *); -GLIB_AVAILABLE_IN_2_60 -gsize g_variant_type_string_get_depth_ (const gchar *type_string); - -G_END_DECLS - -#endif /* __G_VARIANT_TYPE_H__ */ - -G_BEGIN_DECLS - -typedef struct _GVariant GVariant; - -typedef enum -{ - G_VARIANT_CLASS_BOOLEAN = 'b', - G_VARIANT_CLASS_BYTE = 'y', - G_VARIANT_CLASS_INT16 = 'n', - G_VARIANT_CLASS_UINT16 = 'q', - G_VARIANT_CLASS_INT32 = 'i', - G_VARIANT_CLASS_UINT32 = 'u', - G_VARIANT_CLASS_INT64 = 'x', - G_VARIANT_CLASS_UINT64 = 't', - G_VARIANT_CLASS_HANDLE = 'h', - G_VARIANT_CLASS_DOUBLE = 'd', - G_VARIANT_CLASS_STRING = 's', - G_VARIANT_CLASS_OBJECT_PATH = 'o', - G_VARIANT_CLASS_SIGNATURE = 'g', - G_VARIANT_CLASS_VARIANT = 'v', - G_VARIANT_CLASS_MAYBE = 'm', - G_VARIANT_CLASS_ARRAY = 'a', - G_VARIANT_CLASS_TUPLE = '(', - G_VARIANT_CLASS_DICT_ENTRY = '{' -} GVariantClass; - -GLIB_AVAILABLE_IN_ALL -void g_variant_unref (GVariant *value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_ref (GVariant *value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_ref_sink (GVariant *value); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_is_floating (GVariant *value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_take_ref (GVariant *value); - -GLIB_AVAILABLE_IN_ALL -const GVariantType * g_variant_get_type (GVariant *value); -GLIB_AVAILABLE_IN_ALL -const gchar * g_variant_get_type_string (GVariant *value); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_is_of_type (GVariant *value, - const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_is_container (GVariant *value); -GLIB_AVAILABLE_IN_ALL -GVariantClass g_variant_classify (GVariant *value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_boolean (gboolean value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_byte (guint8 value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_int16 (gint16 value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_uint16 (guint16 value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_int32 (gint32 value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_uint32 (guint32 value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_int64 (gint64 value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_uint64 (guint64 value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_handle (gint32 value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_double (gdouble value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_string (const gchar *string); -GLIB_AVAILABLE_IN_2_38 -GVariant * g_variant_new_take_string (gchar *string); -GLIB_AVAILABLE_IN_2_38 -GVariant * g_variant_new_printf (const gchar *format_string, - ...) G_GNUC_PRINTF (1, 2); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_object_path (const gchar *object_path); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_is_object_path (const gchar *string); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_signature (const gchar *signature); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_is_signature (const gchar *string); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_variant (GVariant *value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_strv (const gchar * const *strv, - gssize length); -GLIB_AVAILABLE_IN_2_30 -GVariant * g_variant_new_objv (const gchar * const *strv, - gssize length); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_bytestring (const gchar *string); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_bytestring_array (const gchar * const *strv, - gssize length); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_fixed_array (const GVariantType *element_type, - gconstpointer elements, - gsize n_elements, - gsize element_size); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_get_boolean (GVariant *value); -GLIB_AVAILABLE_IN_ALL -guint8 g_variant_get_byte (GVariant *value); -GLIB_AVAILABLE_IN_ALL -gint16 g_variant_get_int16 (GVariant *value); -GLIB_AVAILABLE_IN_ALL -guint16 g_variant_get_uint16 (GVariant *value); -GLIB_AVAILABLE_IN_ALL -gint32 g_variant_get_int32 (GVariant *value); -GLIB_AVAILABLE_IN_ALL -guint32 g_variant_get_uint32 (GVariant *value); -GLIB_AVAILABLE_IN_ALL -gint64 g_variant_get_int64 (GVariant *value); -GLIB_AVAILABLE_IN_ALL -guint64 g_variant_get_uint64 (GVariant *value); -GLIB_AVAILABLE_IN_ALL -gint32 g_variant_get_handle (GVariant *value); -GLIB_AVAILABLE_IN_ALL -gdouble g_variant_get_double (GVariant *value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_get_variant (GVariant *value); -GLIB_AVAILABLE_IN_ALL -const gchar * g_variant_get_string (GVariant *value, - gsize *length); -GLIB_AVAILABLE_IN_ALL -gchar * g_variant_dup_string (GVariant *value, - gsize *length); -GLIB_AVAILABLE_IN_ALL -const gchar ** g_variant_get_strv (GVariant *value, - gsize *length); -GLIB_AVAILABLE_IN_ALL -gchar ** g_variant_dup_strv (GVariant *value, - gsize *length); -GLIB_AVAILABLE_IN_2_30 -const gchar ** g_variant_get_objv (GVariant *value, - gsize *length); -GLIB_AVAILABLE_IN_ALL -gchar ** g_variant_dup_objv (GVariant *value, - gsize *length); -GLIB_AVAILABLE_IN_ALL -const gchar * g_variant_get_bytestring (GVariant *value); -GLIB_AVAILABLE_IN_ALL -gchar * g_variant_dup_bytestring (GVariant *value, - gsize *length); -GLIB_AVAILABLE_IN_ALL -const gchar ** g_variant_get_bytestring_array (GVariant *value, - gsize *length); -GLIB_AVAILABLE_IN_ALL -gchar ** g_variant_dup_bytestring_array (GVariant *value, - gsize *length); - -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_maybe (const GVariantType *child_type, - GVariant *child); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_array (const GVariantType *child_type, - GVariant * const *children, - gsize n_children); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_tuple (GVariant * const *children, - gsize n_children); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_dict_entry (GVariant *key, - GVariant *value); - -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_get_maybe (GVariant *value); -GLIB_AVAILABLE_IN_ALL -gsize g_variant_n_children (GVariant *value); -GLIB_AVAILABLE_IN_ALL -void g_variant_get_child (GVariant *value, - gsize index_, - const gchar *format_string, - ...); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_get_child_value (GVariant *value, - gsize index_); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_lookup (GVariant *dictionary, - const gchar *key, - const gchar *format_string, - ...); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_lookup_value (GVariant *dictionary, - const gchar *key, - const GVariantType *expected_type); -GLIB_AVAILABLE_IN_ALL -gconstpointer g_variant_get_fixed_array (GVariant *value, - gsize *n_elements, - gsize element_size); - -GLIB_AVAILABLE_IN_ALL -gsize g_variant_get_size (GVariant *value); -GLIB_AVAILABLE_IN_ALL -gconstpointer g_variant_get_data (GVariant *value); -GLIB_AVAILABLE_IN_2_36 -GBytes * g_variant_get_data_as_bytes (GVariant *value); -GLIB_AVAILABLE_IN_ALL -void g_variant_store (GVariant *value, - gpointer data); - -GLIB_AVAILABLE_IN_ALL -gchar * g_variant_print (GVariant *value, - gboolean type_annotate); -GLIB_AVAILABLE_IN_ALL -GString * g_variant_print_string (GVariant *value, - GString *string, - gboolean type_annotate); - -GLIB_AVAILABLE_IN_ALL -guint g_variant_hash (gconstpointer value); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_equal (gconstpointer one, - gconstpointer two); - -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_get_normal_form (GVariant *value); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_is_normal_form (GVariant *value); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_byteswap (GVariant *value); - -GLIB_AVAILABLE_IN_2_36 -GVariant * g_variant_new_from_bytes (const GVariantType *type, - GBytes *bytes, - gboolean trusted); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_from_data (const GVariantType *type, - gconstpointer data, - gsize size, - gboolean trusted, - GDestroyNotify notify, - gpointer user_data); - -typedef struct _GVariantIter GVariantIter; -struct _GVariantIter { - /*< private >*/ - gsize x[16]; -}; - -GLIB_AVAILABLE_IN_ALL -GVariantIter * g_variant_iter_new (GVariant *value); -GLIB_AVAILABLE_IN_ALL -gsize g_variant_iter_init (GVariantIter *iter, - GVariant *value); -GLIB_AVAILABLE_IN_ALL -GVariantIter * g_variant_iter_copy (GVariantIter *iter); -GLIB_AVAILABLE_IN_ALL -gsize g_variant_iter_n_children (GVariantIter *iter); -GLIB_AVAILABLE_IN_ALL -void g_variant_iter_free (GVariantIter *iter); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_iter_next_value (GVariantIter *iter); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_iter_next (GVariantIter *iter, - const gchar *format_string, - ...); -GLIB_AVAILABLE_IN_ALL -gboolean g_variant_iter_loop (GVariantIter *iter, - const gchar *format_string, - ...); - - -typedef struct _GVariantBuilder GVariantBuilder; -struct _GVariantBuilder { - /*< private >*/ - union - { - struct { - gsize partial_magic; - const GVariantType *type; - gsize y[14]; - } s; - gsize x[16]; - } u; -}; - -typedef enum -{ - G_VARIANT_PARSE_ERROR_FAILED, - G_VARIANT_PARSE_ERROR_BASIC_TYPE_EXPECTED, - G_VARIANT_PARSE_ERROR_CANNOT_INFER_TYPE, - G_VARIANT_PARSE_ERROR_DEFINITE_TYPE_EXPECTED, - G_VARIANT_PARSE_ERROR_INPUT_NOT_AT_END, - G_VARIANT_PARSE_ERROR_INVALID_CHARACTER, - G_VARIANT_PARSE_ERROR_INVALID_FORMAT_STRING, - G_VARIANT_PARSE_ERROR_INVALID_OBJECT_PATH, - G_VARIANT_PARSE_ERROR_INVALID_SIGNATURE, - G_VARIANT_PARSE_ERROR_INVALID_TYPE_STRING, - G_VARIANT_PARSE_ERROR_NO_COMMON_TYPE, - G_VARIANT_PARSE_ERROR_NUMBER_OUT_OF_RANGE, - G_VARIANT_PARSE_ERROR_NUMBER_TOO_BIG, - G_VARIANT_PARSE_ERROR_TYPE_ERROR, - G_VARIANT_PARSE_ERROR_UNEXPECTED_TOKEN, - G_VARIANT_PARSE_ERROR_UNKNOWN_KEYWORD, - G_VARIANT_PARSE_ERROR_UNTERMINATED_STRING_CONSTANT, - G_VARIANT_PARSE_ERROR_VALUE_EXPECTED, - G_VARIANT_PARSE_ERROR_RECURSION -} GVariantParseError; -#define G_VARIANT_PARSE_ERROR (g_variant_parse_error_quark ()) - -GLIB_DEPRECATED_IN_2_38_FOR(g_variant_parse_error_quark) -GQuark g_variant_parser_get_error_quark (void); - -GLIB_AVAILABLE_IN_ALL -GQuark g_variant_parse_error_quark (void); - -/** - * G_VARIANT_BUILDER_INIT: - * @variant_type: a const GVariantType* - * - * A stack-allocated #GVariantBuilder must be initialized if it is - * used together with g_auto() to avoid warnings or crashes if - * function returns before g_variant_builder_init() is called on the - * builder. This macro can be used as initializer instead of an - * explicit zeroing a variable when declaring it and a following - * g_variant_builder_init(), but it cannot be assigned to a variable. - * - * The passed @variant_type should be a static GVariantType to avoid - * lifetime issues, as copying the @variant_type does not happen in - * the G_VARIANT_BUILDER_INIT() call, but rather in functions that - * make sure that #GVariantBuilder is valid. - * - * |[ - * g_auto(GVariantBuilder) builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_BYTESTRING); - * ]| - * - * Since: 2.50 - */ -#define G_VARIANT_BUILDER_INIT(variant_type) { { { 2942751021u, variant_type, { 0, } } } } - -GLIB_AVAILABLE_IN_ALL -GVariantBuilder * g_variant_builder_new (const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -void g_variant_builder_unref (GVariantBuilder *builder); -GLIB_AVAILABLE_IN_ALL -GVariantBuilder * g_variant_builder_ref (GVariantBuilder *builder); -GLIB_AVAILABLE_IN_ALL -void g_variant_builder_init (GVariantBuilder *builder, - const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_builder_end (GVariantBuilder *builder); -GLIB_AVAILABLE_IN_ALL -void g_variant_builder_clear (GVariantBuilder *builder); -GLIB_AVAILABLE_IN_ALL -void g_variant_builder_open (GVariantBuilder *builder, - const GVariantType *type); -GLIB_AVAILABLE_IN_ALL -void g_variant_builder_close (GVariantBuilder *builder); -GLIB_AVAILABLE_IN_ALL -void g_variant_builder_add_value (GVariantBuilder *builder, - GVariant *value); -GLIB_AVAILABLE_IN_ALL -void g_variant_builder_add (GVariantBuilder *builder, - const gchar *format_string, - ...); -GLIB_AVAILABLE_IN_ALL -void g_variant_builder_add_parsed (GVariantBuilder *builder, - const gchar *format, - ...); - -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new (const gchar *format_string, - ...); -GLIB_AVAILABLE_IN_ALL -void g_variant_get (GVariant *value, - const gchar *format_string, - ...); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_va (const gchar *format_string, - const gchar **endptr, - va_list *app); -GLIB_AVAILABLE_IN_ALL -void g_variant_get_va (GVariant *value, - const gchar *format_string, - const gchar **endptr, - va_list *app); -GLIB_AVAILABLE_IN_2_34 -gboolean g_variant_check_format_string (GVariant *value, - const gchar *format_string, - gboolean copy_only); - -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_parse (const GVariantType *type, - const gchar *text, - const gchar *limit, - const gchar **endptr, - GError **error); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_parsed (const gchar *format, - ...); -GLIB_AVAILABLE_IN_ALL -GVariant * g_variant_new_parsed_va (const gchar *format, - va_list *app); - -GLIB_AVAILABLE_IN_2_40 -gchar * g_variant_parse_error_print_context (GError *error, - const gchar *source_str); - -GLIB_AVAILABLE_IN_ALL -gint g_variant_compare (gconstpointer one, - gconstpointer two); - -typedef struct _GVariantDict GVariantDict; -struct _GVariantDict { - /*< private >*/ - union - { - struct { - GVariant *asv; - gsize partial_magic; - gsize y[14]; - } s; - gsize x[16]; - } u; -}; - -/** - * G_VARIANT_DICT_INIT: - * @asv: (nullable): a GVariant* - * - * A stack-allocated #GVariantDict must be initialized if it is used - * together with g_auto() to avoid warnings or crashes if function - * returns before g_variant_dict_init() is called on the builder. - * This macro can be used as initializer instead of an explicit - * zeroing a variable when declaring it and a following - * g_variant_dict_init(), but it cannot be assigned to a variable. - * - * The passed @asv has to live long enough for #GVariantDict to gather - * the entries from, as the gathering does not happen in the - * G_VARIANT_DICT_INIT() call, but rather in functions that make sure - * that #GVariantDict is valid. In context where the initialization - * value has to be a constant expression, the only possible value of - * @asv is %NULL. It is still possible to call g_variant_dict_init() - * safely with a different @asv right after the variable was - * initialized with G_VARIANT_DICT_INIT(). - * - * |[ - * g_autoptr(GVariant) variant = get_asv_variant (); - * g_auto(GVariantDict) dict = G_VARIANT_DICT_INIT (variant); - * ]| - * - * Since: 2.50 - */ -#define G_VARIANT_DICT_INIT(asv) { { { asv, 3488698669u, { 0, } } } } - -GLIB_AVAILABLE_IN_2_40 -GVariantDict * g_variant_dict_new (GVariant *from_asv); - -GLIB_AVAILABLE_IN_2_40 -void g_variant_dict_init (GVariantDict *dict, - GVariant *from_asv); - -GLIB_AVAILABLE_IN_2_40 -gboolean g_variant_dict_lookup (GVariantDict *dict, - const gchar *key, - const gchar *format_string, - ...); -GLIB_AVAILABLE_IN_2_40 -GVariant * g_variant_dict_lookup_value (GVariantDict *dict, - const gchar *key, - const GVariantType *expected_type); -GLIB_AVAILABLE_IN_2_40 -gboolean g_variant_dict_contains (GVariantDict *dict, - const gchar *key); -GLIB_AVAILABLE_IN_2_40 -void g_variant_dict_insert (GVariantDict *dict, - const gchar *key, - const gchar *format_string, - ...); -GLIB_AVAILABLE_IN_2_40 -void g_variant_dict_insert_value (GVariantDict *dict, - const gchar *key, - GVariant *value); -GLIB_AVAILABLE_IN_2_40 -gboolean g_variant_dict_remove (GVariantDict *dict, - const gchar *key); -GLIB_AVAILABLE_IN_2_40 -void g_variant_dict_clear (GVariantDict *dict); -GLIB_AVAILABLE_IN_2_40 -GVariant * g_variant_dict_end (GVariantDict *dict); -GLIB_AVAILABLE_IN_2_40 -GVariantDict * g_variant_dict_ref (GVariantDict *dict); -GLIB_AVAILABLE_IN_2_40 -void g_variant_dict_unref (GVariantDict *dict); - -G_END_DECLS - -#endif /* __G_VARIANT_H__ */ - -G_BEGIN_DECLS - -/* calculate a string size, guaranteed to fit format + args. - */ -GLIB_AVAILABLE_IN_ALL -gsize g_printf_string_upper_bound (const gchar* format, - va_list args) G_GNUC_PRINTF(1, 0); - -/* Log level shift offset for user defined - * log levels (0-7 are used by GLib). - */ -#define G_LOG_LEVEL_USER_SHIFT (8) - -/* Glib log levels and flags. - */ -typedef enum -{ - /* log flags */ - G_LOG_FLAG_RECURSION = 1 << 0, - G_LOG_FLAG_FATAL = 1 << 1, - - /* GLib log levels */ - G_LOG_LEVEL_ERROR = 1 << 2, /* always fatal */ - G_LOG_LEVEL_CRITICAL = 1 << 3, - G_LOG_LEVEL_WARNING = 1 << 4, - G_LOG_LEVEL_MESSAGE = 1 << 5, - G_LOG_LEVEL_INFO = 1 << 6, - G_LOG_LEVEL_DEBUG = 1 << 7, - - G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL) -} GLogLevelFlags; - -/* GLib log levels that are considered fatal by default */ -#define G_LOG_FATAL_MASK (G_LOG_FLAG_RECURSION | G_LOG_LEVEL_ERROR) - -typedef void (*GLogFunc) (const gchar *log_domain, - GLogLevelFlags log_level, - const gchar *message, - gpointer user_data); - -/* Logging mechanism - */ -GLIB_AVAILABLE_IN_ALL -guint g_log_set_handler (const gchar *log_domain, - GLogLevelFlags log_levels, - GLogFunc log_func, - gpointer user_data); -GLIB_AVAILABLE_IN_2_46 -guint g_log_set_handler_full (const gchar *log_domain, - GLogLevelFlags log_levels, - GLogFunc log_func, - gpointer user_data, - GDestroyNotify destroy); -GLIB_AVAILABLE_IN_ALL -void g_log_remove_handler (const gchar *log_domain, - guint handler_id); -GLIB_AVAILABLE_IN_ALL -void g_log_default_handler (const gchar *log_domain, - GLogLevelFlags log_level, - const gchar *message, - gpointer unused_data); -GLIB_AVAILABLE_IN_ALL -GLogFunc g_log_set_default_handler (GLogFunc log_func, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -void g_log (const gchar *log_domain, - GLogLevelFlags log_level, - const gchar *format, - ...) G_GNUC_PRINTF (3, 4); -GLIB_AVAILABLE_IN_ALL -void g_logv (const gchar *log_domain, - GLogLevelFlags log_level, - const gchar *format, - va_list args) G_GNUC_PRINTF(3, 0); -GLIB_AVAILABLE_IN_ALL -GLogLevelFlags g_log_set_fatal_mask (const gchar *log_domain, - GLogLevelFlags fatal_mask); -GLIB_AVAILABLE_IN_ALL -GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); - -/* Structured logging mechanism. */ - -/** - * GLogWriterOutput: - * @G_LOG_WRITER_HANDLED: Log writer has handled the log entry. - * @G_LOG_WRITER_UNHANDLED: Log writer could not handle the log entry. - * - * Return values from #GLogWriterFuncs to indicate whether the given log entry - * was successfully handled by the writer, or whether there was an error in - * handling it (and hence a fallback writer should be used). - * - * If a #GLogWriterFunc ignores a log entry, it should return - * %G_LOG_WRITER_HANDLED. - * - * Since: 2.50 - */ -typedef enum -{ - G_LOG_WRITER_HANDLED = 1, - G_LOG_WRITER_UNHANDLED = 0, -} GLogWriterOutput; - -/** - * GLogField: - * @key: field name (UTF-8 string) - * @value: field value (arbitrary bytes) - * @length: length of @value, in bytes, or -1 if it is nul-terminated - * - * Structure representing a single field in a structured log entry. See - * g_log_structured() for details. - * - * Log fields may contain arbitrary values, including binary with embedded nul - * bytes. If the field contains a string, the string must be UTF-8 encoded and - * have a trailing nul byte. Otherwise, @length must be set to a non-negative - * value. - * - * Since: 2.50 - */ -typedef struct _GLogField GLogField; -struct _GLogField -{ - const gchar *key; - gconstpointer value; - gssize length; -}; - -/** - * GLogWriterFunc: - * @log_level: log level of the message - * @fields: (array length=n_fields): fields forming the message - * @n_fields: number of @fields - * @user_data: user data passed to g_log_set_writer_func() - * - * Writer function for log entries. A log entry is a collection of one or more - * #GLogFields, using the standard [field names from journal - * specification](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html). - * See g_log_structured() for more information. - * - * Writer functions must ignore fields which they do not recognise, unless they - * can write arbitrary binary output, as field values may be arbitrary binary. - * - * @log_level is guaranteed to be included in @fields as the `PRIORITY` field, - * but is provided separately for convenience of deciding whether or where to - * output the log entry. - * - * Writer functions should return %G_LOG_WRITER_HANDLED if they handled the log - * message successfully or if they deliberately ignored it. If there was an - * error handling the message (for example, if the writer function is meant to - * send messages to a remote logging server and there is a network error), it - * should return %G_LOG_WRITER_UNHANDLED. This allows writer functions to be - * chained and fall back to simpler handlers in case of failure. - * - * Returns: %G_LOG_WRITER_HANDLED if the log entry was handled successfully; - * %G_LOG_WRITER_UNHANDLED otherwise - * Since: 2.50 - */ -typedef GLogWriterOutput (*GLogWriterFunc) (GLogLevelFlags log_level, - const GLogField *fields, - gsize n_fields, - gpointer user_data); - -GLIB_AVAILABLE_IN_2_50 -void g_log_structured (const gchar *log_domain, - GLogLevelFlags log_level, - ...); -GLIB_AVAILABLE_IN_2_50 -void g_log_structured_array (GLogLevelFlags log_level, - const GLogField *fields, - gsize n_fields); - -GLIB_AVAILABLE_IN_2_50 -void g_log_variant (const gchar *log_domain, - GLogLevelFlags log_level, - GVariant *fields); - -GLIB_AVAILABLE_IN_2_50 -void g_log_set_writer_func (GLogWriterFunc func, - gpointer user_data, - GDestroyNotify user_data_free); - -GLIB_AVAILABLE_IN_2_50 -gboolean g_log_writer_supports_color (gint output_fd); -GLIB_AVAILABLE_IN_2_50 -gboolean g_log_writer_is_journald (gint output_fd); - -GLIB_AVAILABLE_IN_2_50 -gchar *g_log_writer_format_fields (GLogLevelFlags log_level, - const GLogField *fields, - gsize n_fields, - gboolean use_color); - -GLIB_AVAILABLE_IN_2_50 -GLogWriterOutput g_log_writer_journald (GLogLevelFlags log_level, - const GLogField *fields, - gsize n_fields, - gpointer user_data); -GLIB_AVAILABLE_IN_2_50 -GLogWriterOutput g_log_writer_standard_streams (GLogLevelFlags log_level, - const GLogField *fields, - gsize n_fields, - gpointer user_data); -GLIB_AVAILABLE_IN_2_50 -GLogWriterOutput g_log_writer_default (GLogLevelFlags log_level, - const GLogField *fields, - gsize n_fields, - gpointer user_data); - -GLIB_AVAILABLE_IN_2_68 -void g_log_writer_default_set_use_stderr (gboolean use_stderr); -GLIB_AVAILABLE_IN_2_68 -gboolean g_log_writer_default_would_drop (GLogLevelFlags log_level, - const char *log_domain); - -/** - * G_DEBUG_HERE: - * - * A convenience form of g_log_structured(), recommended to be added to - * functions when debugging. It prints the current monotonic time and the code - * location using %G_STRLOC. - * - * Since: 2.50 - */ -#define G_DEBUG_HERE() \ - g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ - "CODE_FILE", __FILE__, \ - "CODE_LINE", G_STRINGIFY (__LINE__), \ - "CODE_FUNC", G_STRFUNC, \ - "MESSAGE", "%" G_GINT64_FORMAT ": %s", \ - g_get_monotonic_time (), G_STRLOC) - -/* internal */ -void _g_log_fallback_handler (const gchar *log_domain, - GLogLevelFlags log_level, - const gchar *message, - gpointer unused_data); - -/* Internal functions, used to implement the following macros */ -GLIB_AVAILABLE_IN_ALL -void g_return_if_fail_warning (const char *log_domain, - const char *pretty_function, - const char *expression) G_ANALYZER_NORETURN; -GLIB_AVAILABLE_IN_ALL -void g_warn_message (const char *domain, - const char *file, - int line, - const char *func, - const char *warnexpr) G_ANALYZER_NORETURN; -GLIB_DEPRECATED -G_NORETURN -void g_assert_warning (const char *log_domain, - const char *file, - const int line, - const char *pretty_function, - const char *expression); - -GLIB_AVAILABLE_IN_2_56 -void g_log_structured_standard (const gchar *log_domain, - GLogLevelFlags log_level, - const gchar *file, - const gchar *line, - const gchar *func, - const gchar *message_format, - ...) G_GNUC_PRINTF (6, 7); - -#ifndef G_LOG_DOMAIN -#define G_LOG_DOMAIN ((gchar*) 0) -#endif /* G_LOG_DOMAIN */ - -#if defined(G_HAVE_ISO_VARARGS) && !G_ANALYZER_ANALYZING -#if defined(G_LOG_USE_STRUCTURED) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56 -#define g_error(...) G_STMT_START { \ - g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \ - __FILE__, G_STRINGIFY (__LINE__), \ - G_STRFUNC, __VA_ARGS__); \ - for (;;) ; \ - } G_STMT_END -#define g_message(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, \ - __FILE__, G_STRINGIFY (__LINE__), \ - G_STRFUNC, __VA_ARGS__) -#define g_critical(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ - __FILE__, G_STRINGIFY (__LINE__), \ - G_STRFUNC, __VA_ARGS__) -#define g_warning(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \ - __FILE__, G_STRINGIFY (__LINE__), \ - G_STRFUNC, __VA_ARGS__) -#define g_info(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \ - __FILE__, G_STRINGIFY (__LINE__), \ - G_STRFUNC, __VA_ARGS__) -#define g_debug(...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ - __FILE__, G_STRINGIFY (__LINE__), \ - G_STRFUNC, __VA_ARGS__) -#else -/* for(;;) ; so that GCC knows that control doesn't go past g_error(). - * Put space before ending semicolon to avoid C++ build warnings. - */ -#define g_error(...) G_STMT_START { \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_ERROR, \ - __VA_ARGS__); \ - for (;;) ; \ - } G_STMT_END -#define g_message(...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_MESSAGE, \ - __VA_ARGS__) -#define g_critical(...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_CRITICAL, \ - __VA_ARGS__) -#define g_warning(...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_WARNING, \ - __VA_ARGS__) -#define g_info(...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_INFO, \ - __VA_ARGS__) -#define g_debug(...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_DEBUG, \ - __VA_ARGS__) -#endif -#elif defined(G_HAVE_GNUC_VARARGS) && !G_ANALYZER_ANALYZING -#if defined(G_LOG_USE_STRUCTURED) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56 -#define g_error(format...) G_STMT_START { \ - g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \ - __FILE__, G_STRINGIFY (__LINE__), \ - G_STRFUNC, format); \ - for (;;) ; \ - } G_STMT_END -#define g_message(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, \ - __FILE__, G_STRINGIFY (__LINE__), \ - G_STRFUNC, format) -#define g_critical(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ - __FILE__, G_STRINGIFY (__LINE__), \ - G_STRFUNC, format) -#define g_warning(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \ - __FILE__, G_STRINGIFY (__LINE__), \ - G_STRFUNC, format) -#define g_info(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \ - __FILE__, G_STRINGIFY (__LINE__), \ - G_STRFUNC, format) -#define g_debug(format...) g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ - __FILE__, G_STRINGIFY (__LINE__), \ - G_STRFUNC, format) -#else -#define g_error(format...) G_STMT_START { \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_ERROR, \ - format); \ - for (;;) ; \ - } G_STMT_END - -#define g_message(format...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_MESSAGE, \ - format) -#define g_critical(format...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_CRITICAL, \ - format) -#define g_warning(format...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_WARNING, \ - format) -#define g_info(format...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_INFO, \ - format) -#define g_debug(format...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_DEBUG, \ - format) -#endif -#else /* no varargs macros */ -static G_NORETURN void g_error (const gchar *format, ...) G_ANALYZER_NORETURN; -static void g_critical (const gchar *format, ...) G_ANALYZER_NORETURN; - -static inline void -g_error (const gchar *format, - ...) -{ - va_list args; - va_start (args, format); - g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args); - va_end (args); - - for(;;) ; -} -static inline void -g_message (const gchar *format, - ...) -{ - va_list args; - va_start (args, format); - g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, args); - va_end (args); -} -static inline void -g_critical (const gchar *format, - ...) -{ - va_list args; - va_start (args, format); - g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, format, args); - va_end (args); -} -static inline void -g_warning (const gchar *format, - ...) -{ - va_list args; - va_start (args, format); - g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format, args); - va_end (args); -} -static inline void -g_info (const gchar *format, - ...) -{ - va_list args; - va_start (args, format); - g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format, args); - va_end (args); -} -static inline void -g_debug (const gchar *format, - ...) -{ - va_list args; - va_start (args, format); - g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, args); - va_end (args); -} -#endif /* !__GNUC__ */ - -/** - * g_warning_once: - * @...: format string, followed by parameters to insert - * into the format string (as with printf()) - * - * Logs a warning only once. - * - * g_warning_once() calls g_warning() with the passed message the first time - * the statement is executed; subsequent times it is a no-op. - * - * Note! On platforms where the compiler doesn't support variadic macros, the - * warning is printed each time instead of only once. - * - * Since: 2.64 - */ -#if defined(G_HAVE_ISO_VARARGS) && !G_ANALYZER_ANALYZING -#define g_warning_once(...) \ - G_STMT_START { \ - static int G_PASTE (_GWarningOnceBoolean, __LINE__) = 0; /* (atomic) */ \ - if (g_atomic_int_compare_and_exchange (&G_PASTE (_GWarningOnceBoolean, __LINE__), \ - 0, 1)) \ - g_warning (__VA_ARGS__); \ - } G_STMT_END \ - GLIB_AVAILABLE_MACRO_IN_2_64 -#elif defined(G_HAVE_GNUC_VARARGS) && !G_ANALYZER_ANALYZING -#define g_warning_once(format...) \ - G_STMT_START { \ - static int G_PASTE (_GWarningOnceBoolean, __LINE__) = 0; /* (atomic) */ \ - if (g_atomic_int_compare_and_exchange (&G_PASTE (_GWarningOnceBoolean, __LINE__), \ - 0, 1)) \ - g_warning (format); \ - } G_STMT_END \ - GLIB_AVAILABLE_MACRO_IN_2_64 -#else -#define g_warning_once g_warning -#endif - -/** - * GPrintFunc: - * @string: the message to output - * - * Specifies the type of the print handler functions. - * These are called with the complete formatted string to output. - */ -typedef void (*GPrintFunc) (const gchar *string); -GLIB_AVAILABLE_IN_ALL -void g_print (const gchar *format, - ...) G_GNUC_PRINTF (1, 2); -GLIB_AVAILABLE_IN_ALL -GPrintFunc g_set_print_handler (GPrintFunc func); -GLIB_AVAILABLE_IN_ALL -void g_printerr (const gchar *format, - ...) G_GNUC_PRINTF (1, 2); -GLIB_AVAILABLE_IN_ALL -GPrintFunc g_set_printerr_handler (GPrintFunc func); - -/** - * g_warn_if_reached: - * - * Logs a warning. - * - * Since: 2.16 - */ -#define g_warn_if_reached() \ - do { \ - g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); \ - } while (0) - -/** - * g_warn_if_fail: - * @expr: the expression to check - * - * Logs a warning if the expression is not true. - * - * Since: 2.16 - */ -#define g_warn_if_fail(expr) \ - do { \ - if G_LIKELY (expr) ; \ - else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, #expr); \ - } while (0) - -#ifdef G_DISABLE_CHECKS - -/** - * g_return_if_fail: - * @expr: the expression to check - * - * Verifies that the expression @expr, usually representing a precondition, - * evaluates to %TRUE. If the function returns a value, use - * g_return_val_if_fail() instead. - * - * If @expr evaluates to %FALSE, the current function should be considered to - * have undefined behaviour (a programmer error). The only correct solution - * to such an error is to change the module that is calling the current - * function, so that it avoids this incorrect call. - * - * To make this undefined behaviour visible, if @expr evaluates to %FALSE, - * the result is usually that a critical message is logged and the current - * function returns. - * - * If `G_DISABLE_CHECKS` is defined then the check is not performed. You - * should therefore not depend on any side effects of @expr. - * - * To debug failure of a g_return_if_fail() check, run the code under a debugger - * with `G_DEBUG=fatal-criticals` or `G_DEBUG=fatal-warnings` defined in the - * environment (see [Running GLib Applications](glib-running.html)): - * - * |[ - * G_DEBUG=fatal-warnings gdb ./my-program - * ]| - * - * Any unrelated failures can be skipped over in - * [gdb](https://www.gnu.org/software/gdb/) using the `continue` command. - */ -#define g_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END - -/** - * g_return_val_if_fail: - * @expr: the expression to check - * @val: the value to return from the current function - * if the expression is not true - * - * Verifies that the expression @expr, usually representing a precondition, - * evaluates to %TRUE. If the function does not return a value, use - * g_return_if_fail() instead. - * - * If @expr evaluates to %FALSE, the current function should be considered to - * have undefined behaviour (a programmer error). The only correct solution - * to such an error is to change the module that is calling the current - * function, so that it avoids this incorrect call. - * - * To make this undefined behaviour visible, if @expr evaluates to %FALSE, - * the result is usually that a critical message is logged and @val is - * returned from the current function. - * - * If `G_DISABLE_CHECKS` is defined then the check is not performed. You - * should therefore not depend on any side effects of @expr. - * - * See g_return_if_fail() for guidance on how to debug failure of this check. - */ -#define g_return_val_if_fail(expr,val) G_STMT_START{ (void)0; }G_STMT_END - -/** - * g_return_if_reached: - * - * Logs a critical message and returns from the current function. - * This can only be used in functions which do not return a value. - * - * See g_return_if_fail() for guidance on how to debug failure of this check. - */ -#define g_return_if_reached() G_STMT_START{ return; }G_STMT_END - -/** - * g_return_val_if_reached: - * @val: the value to return from the current function - * - * Logs a critical message and returns @val. - * - * See g_return_if_fail() for guidance on how to debug failure of this check. - */ -#define g_return_val_if_reached(val) G_STMT_START{ return (val); }G_STMT_END - -#else /* !G_DISABLE_CHECKS */ - -#define g_return_if_fail(expr) \ - G_STMT_START { \ - if (G_LIKELY (expr)) \ - { } \ - else \ - { \ - g_return_if_fail_warning (G_LOG_DOMAIN, \ - G_STRFUNC, \ - #expr); \ - return; \ - } \ - } G_STMT_END - -#define g_return_val_if_fail(expr, val) \ - G_STMT_START { \ - if (G_LIKELY (expr)) \ - { } \ - else \ - { \ - g_return_if_fail_warning (G_LOG_DOMAIN, \ - G_STRFUNC, \ - #expr); \ - return (val); \ - } \ - } G_STMT_END - -#define g_return_if_reached() \ - G_STMT_START { \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_CRITICAL, \ - "file %s: line %d (%s): should not be reached", \ - __FILE__, \ - __LINE__, \ - G_STRFUNC); \ - return; \ - } G_STMT_END - -#define g_return_val_if_reached(val) \ - G_STMT_START { \ - g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_CRITICAL, \ - "file %s: line %d (%s): should not be reached", \ - __FILE__, \ - __LINE__, \ - G_STRFUNC); \ - return (val); \ - } G_STMT_END - -#endif /* !G_DISABLE_CHECKS */ - -G_END_DECLS - -#endif /* __G_MESSAGES_H__ */ -/* goption.h - Option parser - * - * Copyright (C) 2004 Anders Carlsson - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_OPTION_H__ -#define __G_OPTION_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/** - * GOptionContext: - * - * A `GOptionContext` struct defines which options - * are accepted by the commandline option parser. The struct has only private - * fields and should not be directly accessed. - */ -typedef struct _GOptionContext GOptionContext; - -/** - * GOptionGroup: - * - * A `GOptionGroup` struct defines the options in a single - * group. The struct has only private fields and should not be directly accessed. - * - * All options in a group share the same translation function. Libraries which - * need to parse commandline options are expected to provide a function for - * getting a `GOptionGroup` holding their options, which - * the application can then add to its #GOptionContext. - */ -typedef struct _GOptionGroup GOptionGroup; -typedef struct _GOptionEntry GOptionEntry; - -/** - * GOptionFlags: - * @G_OPTION_FLAG_NONE: No flags. Since: 2.42. - * @G_OPTION_FLAG_HIDDEN: The option doesn't appear in `--help` output. - * @G_OPTION_FLAG_IN_MAIN: The option appears in the main section of the - * `--help` output, even if it is defined in a group. - * @G_OPTION_FLAG_REVERSE: For options of the %G_OPTION_ARG_NONE kind, this - * flag indicates that the sense of the option is reversed. - * @G_OPTION_FLAG_NO_ARG: For options of the %G_OPTION_ARG_CALLBACK kind, - * this flag indicates that the callback does not take any argument - * (like a %G_OPTION_ARG_NONE option). Since 2.8 - * @G_OPTION_FLAG_FILENAME: For options of the %G_OPTION_ARG_CALLBACK - * kind, this flag indicates that the argument should be passed to the - * callback in the GLib filename encoding rather than UTF-8. Since 2.8 - * @G_OPTION_FLAG_OPTIONAL_ARG: For options of the %G_OPTION_ARG_CALLBACK - * kind, this flag indicates that the argument supply is optional. - * If no argument is given then data of %GOptionParseFunc will be - * set to NULL. Since 2.8 - * @G_OPTION_FLAG_NOALIAS: This flag turns off the automatic conflict - * resolution which prefixes long option names with `groupname-` if - * there is a conflict. This option should only be used in situations - * where aliasing is necessary to model some legacy commandline interface. - * It is not safe to use this option, unless all option groups are under - * your direct control. Since 2.8. - * - * Flags which modify individual options. - */ -typedef enum -{ - G_OPTION_FLAG_NONE = 0, - G_OPTION_FLAG_HIDDEN = 1 << 0, - G_OPTION_FLAG_IN_MAIN = 1 << 1, - G_OPTION_FLAG_REVERSE = 1 << 2, - G_OPTION_FLAG_NO_ARG = 1 << 3, - G_OPTION_FLAG_FILENAME = 1 << 4, - G_OPTION_FLAG_OPTIONAL_ARG = 1 << 5, - G_OPTION_FLAG_NOALIAS = 1 << 6 -} GOptionFlags; - -/** - * GOptionArg: - * @G_OPTION_ARG_NONE: No extra argument. This is useful for simple flags. - * @G_OPTION_ARG_STRING: The option takes a UTF-8 string argument. - * @G_OPTION_ARG_INT: The option takes an integer argument. - * @G_OPTION_ARG_CALLBACK: The option provides a callback (of type - * #GOptionArgFunc) to parse the extra argument. - * @G_OPTION_ARG_FILENAME: The option takes a filename as argument, which will - be in the GLib filename encoding rather than UTF-8. - * @G_OPTION_ARG_STRING_ARRAY: The option takes a string argument, multiple - * uses of the option are collected into an array of strings. - * @G_OPTION_ARG_FILENAME_ARRAY: The option takes a filename as argument, - * multiple uses of the option are collected into an array of strings. - * @G_OPTION_ARG_DOUBLE: The option takes a double argument. The argument - * can be formatted either for the user's locale or for the "C" locale. - * Since 2.12 - * @G_OPTION_ARG_INT64: The option takes a 64-bit integer. Like - * %G_OPTION_ARG_INT but for larger numbers. The number can be in - * decimal base, or in hexadecimal (when prefixed with `0x`, for - * example, `0xffffffff`). Since 2.12 - * - * The #GOptionArg enum values determine which type of extra argument the - * options expect to find. If an option expects an extra argument, it can - * be specified in several ways; with a short option: `-x arg`, with a long - * option: `--name arg` or combined in a single argument: `--name=arg`. - */ -typedef enum -{ - G_OPTION_ARG_NONE, - G_OPTION_ARG_STRING, - G_OPTION_ARG_INT, - G_OPTION_ARG_CALLBACK, - G_OPTION_ARG_FILENAME, - G_OPTION_ARG_STRING_ARRAY, - G_OPTION_ARG_FILENAME_ARRAY, - G_OPTION_ARG_DOUBLE, - G_OPTION_ARG_INT64 -} GOptionArg; - -/** - * GOptionArgFunc: - * @option_name: The name of the option being parsed. This will be either a - * single dash followed by a single letter (for a short name) or two dashes - * followed by a long option name. - * @value: The value to be parsed. - * @data: User data added to the #GOptionGroup containing the option when it - * was created with g_option_group_new() - * @error: A return location for errors. The error code %G_OPTION_ERROR_FAILED - * is intended to be used for errors in #GOptionArgFunc callbacks. - * - * The type of function to be passed as callback for %G_OPTION_ARG_CALLBACK - * options. - * - * Returns: %TRUE if the option was successfully parsed, %FALSE if an error - * occurred, in which case @error should be set with g_set_error() - */ -typedef gboolean (*GOptionArgFunc) (const gchar *option_name, - const gchar *value, - gpointer data, - GError **error); - -/** - * GOptionParseFunc: - * @context: The active #GOptionContext - * @group: The group to which the function belongs - * @data: User data added to the #GOptionGroup containing the option when it - * was created with g_option_group_new() - * @error: A return location for error details - * - * The type of function that can be called before and after parsing. - * - * Returns: %TRUE if the function completed successfully, %FALSE if an error - * occurred, in which case @error should be set with g_set_error() - */ -typedef gboolean (*GOptionParseFunc) (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error); - -/** - * GOptionErrorFunc: - * @context: The active #GOptionContext - * @group: The group to which the function belongs - * @data: User data added to the #GOptionGroup containing the option when it - * was created with g_option_group_new() - * @error: The #GError containing details about the parse error - * - * The type of function to be used as callback when a parse error occurs. - */ -typedef void (*GOptionErrorFunc) (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error); - -/** - * G_OPTION_ERROR: - * - * Error domain for option parsing. Errors in this domain will - * be from the #GOptionError enumeration. See #GError for information on - * error domains. - */ -#define G_OPTION_ERROR (g_option_error_quark ()) - -/** - * GOptionError: - * @G_OPTION_ERROR_UNKNOWN_OPTION: An option was not known to the parser. - * This error will only be reported, if the parser hasn't been instructed - * to ignore unknown options, see g_option_context_set_ignore_unknown_options(). - * @G_OPTION_ERROR_BAD_VALUE: A value couldn't be parsed. - * @G_OPTION_ERROR_FAILED: A #GOptionArgFunc callback failed. - * - * Error codes returned by option parsing. - */ -typedef enum -{ - G_OPTION_ERROR_UNKNOWN_OPTION, - G_OPTION_ERROR_BAD_VALUE, - G_OPTION_ERROR_FAILED -} GOptionError; - -GLIB_AVAILABLE_IN_ALL -GQuark g_option_error_quark (void); - -/** - * GOptionEntry: - * @long_name: The long name of an option can be used to specify it - * in a commandline as `--long_name`. Every option must have a - * long name. To resolve conflicts if multiple option groups contain - * the same long name, it is also possible to specify the option as - * `--groupname-long_name`. - * @short_name: If an option has a short name, it can be specified - * `-short_name` in a commandline. @short_name must be a printable - * ASCII character different from '-', or zero if the option has no - * short name. - * @flags: Flags from #GOptionFlags - * @arg: The type of the option, as a #GOptionArg - * @arg_data: If the @arg type is %G_OPTION_ARG_CALLBACK, then @arg_data - * must point to a #GOptionArgFunc callback function, which will be - * called to handle the extra argument. Otherwise, @arg_data is a - * pointer to a location to store the value, the required type of - * the location depends on the @arg type: - * - %G_OPTION_ARG_NONE: %gboolean - * - %G_OPTION_ARG_STRING: %gchar* - * - %G_OPTION_ARG_INT: %gint - * - %G_OPTION_ARG_FILENAME: %gchar* - * - %G_OPTION_ARG_STRING_ARRAY: %gchar** - * - %G_OPTION_ARG_FILENAME_ARRAY: %gchar** - * - %G_OPTION_ARG_DOUBLE: %gdouble - * If @arg type is %G_OPTION_ARG_STRING or %G_OPTION_ARG_FILENAME, - * the location will contain a newly allocated string if the option - * was given. That string needs to be freed by the callee using g_free(). - * Likewise if @arg type is %G_OPTION_ARG_STRING_ARRAY or - * %G_OPTION_ARG_FILENAME_ARRAY, the data should be freed using g_strfreev(). - * @description: the description for the option in `--help` - * output. The @description is translated using the @translate_func - * of the group, see g_option_group_set_translation_domain(). - * @arg_description: The placeholder to use for the extra argument parsed - * by the option in `--help` output. The @arg_description is translated - * using the @translate_func of the group, see - * g_option_group_set_translation_domain(). - * - * A GOptionEntry struct defines a single option. To have an effect, they - * must be added to a #GOptionGroup with g_option_context_add_main_entries() - * or g_option_group_add_entries(). - */ -struct _GOptionEntry -{ - const gchar *long_name; - gchar short_name; - gint flags; - - GOptionArg arg; - gpointer arg_data; - - const gchar *description; - const gchar *arg_description; -}; - -/** - * G_OPTION_REMAINING: - * - * If a long option in the main group has this name, it is not treated as a - * regular option. Instead it collects all non-option arguments which would - * otherwise be left in `argv`. The option must be of type - * %G_OPTION_ARG_CALLBACK, %G_OPTION_ARG_STRING_ARRAY - * or %G_OPTION_ARG_FILENAME_ARRAY. - * - * - * Using #G_OPTION_REMAINING instead of simply scanning `argv` - * for leftover arguments has the advantage that GOption takes care of - * necessary encoding conversions for strings or filenames. - * - * Since: 2.6 - */ -#define G_OPTION_REMAINING "" - -GLIB_AVAILABLE_IN_ALL -GOptionContext *g_option_context_new (const gchar *parameter_string); -GLIB_AVAILABLE_IN_ALL -void g_option_context_set_summary (GOptionContext *context, - const gchar *summary); -GLIB_AVAILABLE_IN_ALL -const gchar * g_option_context_get_summary (GOptionContext *context); -GLIB_AVAILABLE_IN_ALL -void g_option_context_set_description (GOptionContext *context, - const gchar *description); -GLIB_AVAILABLE_IN_ALL -const gchar * g_option_context_get_description (GOptionContext *context); -GLIB_AVAILABLE_IN_ALL -void g_option_context_free (GOptionContext *context); -GLIB_AVAILABLE_IN_ALL -void g_option_context_set_help_enabled (GOptionContext *context, - gboolean help_enabled); -GLIB_AVAILABLE_IN_ALL -gboolean g_option_context_get_help_enabled (GOptionContext *context); -GLIB_AVAILABLE_IN_ALL -void g_option_context_set_ignore_unknown_options (GOptionContext *context, - gboolean ignore_unknown); -GLIB_AVAILABLE_IN_ALL -gboolean g_option_context_get_ignore_unknown_options (GOptionContext *context); - -GLIB_AVAILABLE_IN_2_44 -void g_option_context_set_strict_posix (GOptionContext *context, - gboolean strict_posix); -GLIB_AVAILABLE_IN_2_44 -gboolean g_option_context_get_strict_posix (GOptionContext *context); - -GLIB_AVAILABLE_IN_ALL -void g_option_context_add_main_entries (GOptionContext *context, - const GOptionEntry *entries, - const gchar *translation_domain); -GLIB_AVAILABLE_IN_ALL -gboolean g_option_context_parse (GOptionContext *context, - gint *argc, - gchar ***argv, - GError **error); -GLIB_AVAILABLE_IN_2_40 -gboolean g_option_context_parse_strv (GOptionContext *context, - gchar ***arguments, - GError **error); -GLIB_AVAILABLE_IN_ALL -void g_option_context_set_translate_func (GOptionContext *context, - GTranslateFunc func, - gpointer data, - GDestroyNotify destroy_notify); -GLIB_AVAILABLE_IN_ALL -void g_option_context_set_translation_domain (GOptionContext *context, - const gchar *domain); - -GLIB_AVAILABLE_IN_ALL -void g_option_context_add_group (GOptionContext *context, - GOptionGroup *group); -GLIB_AVAILABLE_IN_ALL -void g_option_context_set_main_group (GOptionContext *context, - GOptionGroup *group); -GLIB_AVAILABLE_IN_ALL -GOptionGroup *g_option_context_get_main_group (GOptionContext *context); -GLIB_AVAILABLE_IN_ALL -gchar *g_option_context_get_help (GOptionContext *context, - gboolean main_help, - GOptionGroup *group); - -GLIB_AVAILABLE_IN_ALL -GOptionGroup *g_option_group_new (const gchar *name, - const gchar *description, - const gchar *help_description, - gpointer user_data, - GDestroyNotify destroy); -GLIB_AVAILABLE_IN_ALL -void g_option_group_set_parse_hooks (GOptionGroup *group, - GOptionParseFunc pre_parse_func, - GOptionParseFunc post_parse_func); -GLIB_AVAILABLE_IN_ALL -void g_option_group_set_error_hook (GOptionGroup *group, - GOptionErrorFunc error_func); -GLIB_DEPRECATED_IN_2_44 -void g_option_group_free (GOptionGroup *group); -GLIB_AVAILABLE_IN_2_44 -GOptionGroup *g_option_group_ref (GOptionGroup *group); -GLIB_AVAILABLE_IN_2_44 -void g_option_group_unref (GOptionGroup *group); -GLIB_AVAILABLE_IN_ALL -void g_option_group_add_entries (GOptionGroup *group, - const GOptionEntry *entries); -GLIB_AVAILABLE_IN_ALL -void g_option_group_set_translate_func (GOptionGroup *group, - GTranslateFunc func, - gpointer data, - GDestroyNotify destroy_notify); -GLIB_AVAILABLE_IN_ALL -void g_option_group_set_translation_domain (GOptionGroup *group, - const gchar *domain); - -G_END_DECLS - -#endif /* __G_OPTION_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997, 1999 Peter Mattis, Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#ifndef __G_PATTERN_H__ -#define __G_PATTERN_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - - -typedef struct _GPatternSpec GPatternSpec; - -GLIB_AVAILABLE_IN_ALL -GPatternSpec* g_pattern_spec_new (const gchar *pattern); -GLIB_AVAILABLE_IN_ALL -void g_pattern_spec_free (GPatternSpec *pspec); -GLIB_AVAILABLE_IN_ALL -gboolean g_pattern_spec_equal (GPatternSpec *pspec1, - GPatternSpec *pspec2); -GLIB_AVAILABLE_IN_ALL -gboolean g_pattern_match (GPatternSpec *pspec, - guint string_length, - const gchar *string, - const gchar *string_reversed); -GLIB_AVAILABLE_IN_ALL -gboolean g_pattern_match_string (GPatternSpec *pspec, - const gchar *string); -GLIB_AVAILABLE_IN_ALL -gboolean g_pattern_match_simple (const gchar *pattern, - const gchar *string); - -G_END_DECLS - -#endif /* __G_PATTERN_H__ */ -/* - * Copyright © 2018 Ole André Vadla Ravnås - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#ifndef __G_PLATFORM_AUDIT_H__ -#define __G_PLATFORM_AUDIT_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GFDCallbacks GFDCallbacks; - -struct _GFDCallbacks -{ - void (*on_fd_opened) (gint fd, const gchar *description); - void (*on_fd_closed) (gint fd, const gchar *description); -}; - -GLIB_VAR -GFDCallbacks *glib_fd_callbacks; -GLIB_AVAILABLE_IN_2_68 -void g_platform_audit_set_fd_callbacks (GFDCallbacks *callbacks); - -G_END_DECLS - -#endif /* __G_PLATFORM_AUDIT_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_PRIMES_H__ -#define __G_PRIMES_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/* Prime numbers. - */ - -/* This function returns prime numbers spaced by approximately 1.5-2.0 - * and is for use in resizing data structures which prefer - * prime-valued sizes. The closest spaced prime function returns the - * next largest prime, or the highest it knows about which is about - * MAXINT/4. - */ -GLIB_AVAILABLE_IN_ALL -guint g_spaced_primes_closest (guint num) G_GNUC_CONST; - -G_END_DECLS - -#endif /* __G_PRIMES_H__ */ - /* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_QSORT_H__ -#define __G_QSORT_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_ALL -void g_qsort_with_data (gconstpointer pbase, - gint total_elems, - gsize size, - GCompareDataFunc compare_func, - gpointer user_data); - -G_END_DECLS - -#endif /* __G_QSORT_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_QUEUE_H__ -#define __G_QUEUE_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GQueue GQueue; - -/** - * GQueue: - * @head: a pointer to the first element of the queue - * @tail: a pointer to the last element of the queue - * @length: the number of elements in the queue - * - * Contains the public fields of a - * [Queue][glib-Double-ended-Queues]. - */ -struct _GQueue -{ - GList *head; - GList *tail; - guint length; -}; - -/** - * G_QUEUE_INIT: - * - * A statically-allocated #GQueue must be initialized with this - * macro before it can be used. This macro can be used to initialize - * a variable, but it cannot be assigned to a variable. In that case - * you have to use g_queue_init(). - * - * |[ - * GQueue my_queue = G_QUEUE_INIT; - * ]| - * - * Since: 2.14 - */ -#define G_QUEUE_INIT { NULL, NULL, 0 } - -/* Queues - */ -GLIB_AVAILABLE_IN_ALL -GQueue* g_queue_new (void); -GLIB_AVAILABLE_IN_ALL -void g_queue_free (GQueue *queue); -GLIB_AVAILABLE_IN_ALL -void g_queue_free_full (GQueue *queue, - GDestroyNotify free_func); -GLIB_AVAILABLE_IN_ALL -void g_queue_init (GQueue *queue); -GLIB_AVAILABLE_IN_ALL -void g_queue_clear (GQueue *queue); -GLIB_AVAILABLE_IN_ALL -gboolean g_queue_is_empty (GQueue *queue); -GLIB_AVAILABLE_IN_2_60 -void g_queue_clear_full (GQueue *queue, - GDestroyNotify free_func); -GLIB_AVAILABLE_IN_ALL -guint g_queue_get_length (GQueue *queue); -GLIB_AVAILABLE_IN_ALL -void g_queue_reverse (GQueue *queue); -GLIB_AVAILABLE_IN_ALL -GQueue * g_queue_copy (GQueue *queue); -GLIB_AVAILABLE_IN_ALL -void g_queue_foreach (GQueue *queue, - GFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -GList * g_queue_find (GQueue *queue, - gconstpointer data); -GLIB_AVAILABLE_IN_ALL -GList * g_queue_find_custom (GQueue *queue, - gconstpointer data, - GCompareFunc func); -GLIB_AVAILABLE_IN_ALL -void g_queue_sort (GQueue *queue, - GCompareDataFunc compare_func, - gpointer user_data); - -GLIB_AVAILABLE_IN_ALL -void g_queue_push_head (GQueue *queue, - gpointer data); -GLIB_AVAILABLE_IN_ALL -void g_queue_push_tail (GQueue *queue, - gpointer data); -GLIB_AVAILABLE_IN_ALL -void g_queue_push_nth (GQueue *queue, - gpointer data, - gint n); -GLIB_AVAILABLE_IN_ALL -gpointer g_queue_pop_head (GQueue *queue); -GLIB_AVAILABLE_IN_ALL -gpointer g_queue_pop_tail (GQueue *queue); -GLIB_AVAILABLE_IN_ALL -gpointer g_queue_pop_nth (GQueue *queue, - guint n); -GLIB_AVAILABLE_IN_ALL -gpointer g_queue_peek_head (GQueue *queue); -GLIB_AVAILABLE_IN_ALL -gpointer g_queue_peek_tail (GQueue *queue); -GLIB_AVAILABLE_IN_ALL -gpointer g_queue_peek_nth (GQueue *queue, - guint n); -GLIB_AVAILABLE_IN_ALL -gint g_queue_index (GQueue *queue, - gconstpointer data); -GLIB_AVAILABLE_IN_ALL -gboolean g_queue_remove (GQueue *queue, - gconstpointer data); -GLIB_AVAILABLE_IN_ALL -guint g_queue_remove_all (GQueue *queue, - gconstpointer data); -GLIB_AVAILABLE_IN_ALL -void g_queue_insert_before (GQueue *queue, - GList *sibling, - gpointer data); -GLIB_AVAILABLE_IN_2_62 -void g_queue_insert_before_link - (GQueue *queue, - GList *sibling, - GList *link_); -GLIB_AVAILABLE_IN_ALL -void g_queue_insert_after (GQueue *queue, - GList *sibling, - gpointer data); -GLIB_AVAILABLE_IN_2_62 -void g_queue_insert_after_link - (GQueue *queue, - GList *sibling, - GList *link_); -GLIB_AVAILABLE_IN_ALL -void g_queue_insert_sorted (GQueue *queue, - gpointer data, - GCompareDataFunc func, - gpointer user_data); - -GLIB_AVAILABLE_IN_ALL -void g_queue_push_head_link (GQueue *queue, - GList *link_); -GLIB_AVAILABLE_IN_ALL -void g_queue_push_tail_link (GQueue *queue, - GList *link_); -GLIB_AVAILABLE_IN_ALL -void g_queue_push_nth_link (GQueue *queue, - gint n, - GList *link_); -GLIB_AVAILABLE_IN_ALL -GList* g_queue_pop_head_link (GQueue *queue); -GLIB_AVAILABLE_IN_ALL -GList* g_queue_pop_tail_link (GQueue *queue); -GLIB_AVAILABLE_IN_ALL -GList* g_queue_pop_nth_link (GQueue *queue, - guint n); -GLIB_AVAILABLE_IN_ALL -GList* g_queue_peek_head_link (GQueue *queue); -GLIB_AVAILABLE_IN_ALL -GList* g_queue_peek_tail_link (GQueue *queue); -GLIB_AVAILABLE_IN_ALL -GList* g_queue_peek_nth_link (GQueue *queue, - guint n); -GLIB_AVAILABLE_IN_ALL -gint g_queue_link_index (GQueue *queue, - GList *link_); -GLIB_AVAILABLE_IN_ALL -void g_queue_unlink (GQueue *queue, - GList *link_); -GLIB_AVAILABLE_IN_ALL -void g_queue_delete_link (GQueue *queue, - GList *link_); - -G_END_DECLS - -#endif /* __G_QUEUE_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_RAND_H__ -#define __G_RAND_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GRand GRand; - -/* GRand - a good and fast random number generator: Mersenne Twister - * see http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html for more info. - * The range functions return a value in the interval [begin, end). - * int -> [0..2^32-1] - * int_range -> [begin..end-1] - * double -> [0..1) - * double_range -> [begin..end) - */ - -GLIB_AVAILABLE_IN_ALL -GRand* g_rand_new_with_seed (guint32 seed); -GLIB_AVAILABLE_IN_ALL -GRand* g_rand_new_with_seed_array (const guint32 *seed, - guint seed_length); -GLIB_AVAILABLE_IN_ALL -GRand* g_rand_new (void); -GLIB_AVAILABLE_IN_ALL -void g_rand_free (GRand *rand_); -GLIB_AVAILABLE_IN_ALL -GRand* g_rand_copy (GRand *rand_); -GLIB_AVAILABLE_IN_ALL -void g_rand_set_seed (GRand *rand_, - guint32 seed); -GLIB_AVAILABLE_IN_ALL -void g_rand_set_seed_array (GRand *rand_, - const guint32 *seed, - guint seed_length); - -#define g_rand_boolean(rand_) ((g_rand_int (rand_) & (1 << 15)) != 0) - -GLIB_AVAILABLE_IN_ALL -guint32 g_rand_int (GRand *rand_); -GLIB_AVAILABLE_IN_ALL -gint32 g_rand_int_range (GRand *rand_, - gint32 begin, - gint32 end); -GLIB_AVAILABLE_IN_ALL -gdouble g_rand_double (GRand *rand_); -GLIB_AVAILABLE_IN_ALL -gdouble g_rand_double_range (GRand *rand_, - gdouble begin, - gdouble end); -GLIB_AVAILABLE_IN_ALL -void g_random_set_seed (guint32 seed); - -#define g_random_boolean() ((g_random_int () & (1 << 15)) != 0) - -GLIB_AVAILABLE_IN_ALL -guint32 g_random_int (void); -GLIB_AVAILABLE_IN_ALL -gint32 g_random_int_range (gint32 begin, - gint32 end); -GLIB_AVAILABLE_IN_ALL -gdouble g_random_double (void); -GLIB_AVAILABLE_IN_ALL -gdouble g_random_double_range (gdouble begin, - gdouble end); - - -G_END_DECLS - -#endif /* __G_RAND_H__ */ -/* grcbox.h: Reference counted data - * - * Copyright 2018 Emmanuele Bassi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#pragma once - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_2_58 -gpointer g_rc_box_alloc (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); -GLIB_AVAILABLE_IN_2_58 -gpointer g_rc_box_alloc0 (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); -GLIB_AVAILABLE_IN_2_58 -gpointer g_rc_box_dup (gsize block_size, - gconstpointer mem_block) G_GNUC_ALLOC_SIZE(1); -GLIB_AVAILABLE_IN_2_58 -gpointer g_rc_box_acquire (gpointer mem_block); -GLIB_AVAILABLE_IN_2_58 -void g_rc_box_release (gpointer mem_block); -GLIB_AVAILABLE_IN_2_58 -void g_rc_box_release_full (gpointer mem_block, - GDestroyNotify clear_func); - -GLIB_AVAILABLE_IN_2_58 -gsize g_rc_box_get_size (gpointer mem_block); - -GLIB_AVAILABLE_IN_2_58 -gpointer g_atomic_rc_box_alloc (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); -GLIB_AVAILABLE_IN_2_58 -gpointer g_atomic_rc_box_alloc0 (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); -GLIB_AVAILABLE_IN_2_58 -gpointer g_atomic_rc_box_dup (gsize block_size, - gconstpointer mem_block) G_GNUC_ALLOC_SIZE(1); -GLIB_AVAILABLE_IN_2_58 -gpointer g_atomic_rc_box_acquire (gpointer mem_block); -GLIB_AVAILABLE_IN_2_58 -void g_atomic_rc_box_release (gpointer mem_block); -GLIB_AVAILABLE_IN_2_58 -void g_atomic_rc_box_release_full (gpointer mem_block, - GDestroyNotify clear_func); - -GLIB_AVAILABLE_IN_2_58 -gsize g_atomic_rc_box_get_size (gpointer mem_block); - -#define g_rc_box_new(type) \ - ((type *) g_rc_box_alloc (sizeof (type))) -#define g_rc_box_new0(type) \ - ((type *) g_rc_box_alloc0 (sizeof (type))) -#define g_atomic_rc_box_new(type) \ - ((type *) g_atomic_rc_box_alloc (sizeof (type))) -#define g_atomic_rc_box_new0(type) \ - ((type *) g_atomic_rc_box_alloc0 (sizeof (type))) - -#ifdef glib_typeof -/* Type check to avoid assigning references to different types */ -#undef g_rc_box_acquire -#define g_rc_box_acquire(mem_block) \ - ((glib_typeof (mem_block)) (_frida_g_rc_box_acquire) (mem_block)) -#undef g_atomic_rc_box_acquire -#define g_atomic_rc_box_acquire(mem_block) \ - ((glib_typeof (mem_block)) (_frida_g_atomic_rc_box_acquire) (mem_block)) - -/* Type check to avoid duplicating data to different types */ -#undef g_rc_box_dup -#define g_rc_box_dup(block_size, mem_block) \ - ((glib_typeof (mem_block)) (_frida_g_rc_box_dup) (block_size, mem_block)) -#undef g_atomic_rc_box_dup -#define g_atomic_rc_box_dup(block_size, mem_block) \ - ((glib_typeof (mem_block)) (_frida_g_atomic_rc_box_dup) (block_size, mem_block)) -#endif - -G_END_DECLS -/* grefcount.h: Reference counting - * - * Copyright 2018 Emmanuele Bassi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#ifndef __GREFCOUNT_H__ -#define __GREFCOUNT_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -#if defined(__GNUC__) && defined(G_DISABLE_CHECKS) -#endif - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_2_58 -void g_ref_count_init (grefcount *rc); -GLIB_AVAILABLE_IN_2_58 -void g_ref_count_inc (grefcount *rc); -GLIB_AVAILABLE_IN_2_58 -gboolean g_ref_count_dec (grefcount *rc); -GLIB_AVAILABLE_IN_2_58 -gboolean g_ref_count_compare (grefcount *rc, - gint val); - -GLIB_AVAILABLE_IN_2_58 -void g_atomic_ref_count_init (gatomicrefcount *arc); -GLIB_AVAILABLE_IN_2_58 -void g_atomic_ref_count_inc (gatomicrefcount *arc); -GLIB_AVAILABLE_IN_2_58 -gboolean g_atomic_ref_count_dec (gatomicrefcount *arc); -GLIB_AVAILABLE_IN_2_58 -gboolean g_atomic_ref_count_compare (gatomicrefcount *arc, - gint val); - -/* On GCC we can use __extension__ to inline the API without using - * ancillary functions; we only do this when disabling checks, as - * it disables warnings when saturating the reference counters - */ -#if defined(__GNUC__) && defined(G_DISABLE_CHECKS) - -#undef g_ref_count_init -# define g_ref_count_init(rc) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(rc) == sizeof (grefcount)); \ - (void) (0 ? *(rc) ^ *(rc) : 1); \ - *(rc) = -1; \ - })) - -#undef g_ref_count_inc -# define g_ref_count_inc(rc) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(rc) == sizeof (grefcount)); \ - (void) (0 ? *(rc) ^ *(rc) : 1); \ - if (*(rc) == G_MININT) ; else { \ - *(rc) -= 1; \ - } \ - })) - -#undef g_ref_count_dec -# define g_ref_count_dec(rc) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(rc) == sizeof (grefcount)); \ - grefcount __rc = *(rc); \ - __rc += 1; \ - if (__rc == 0) ; else { \ - *(rc) = __rc; \ - } \ - (gboolean) (__rc == 0); \ - })) - -#undef g_ref_count_compare -# define g_ref_count_compare(rc,val) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(rc) == sizeof (grefcount)); \ - (void) (0 ? *(rc) ^ (val) : 1); \ - (gboolean) (*(rc) == -(val)); \ - })) - -#undef g_atomic_ref_count_init -# define g_atomic_ref_count_init(rc) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(rc) == sizeof (gatomicrefcount)); \ - (void) (0 ? *(rc) ^ *(rc) : 1); \ - *(rc) = 1; \ - })) - -#undef g_atomic_ref_count_inc -# define g_atomic_ref_count_inc(rc) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(rc) == sizeof (gatomicrefcount)); \ - (void) (0 ? *(rc) ^ *(rc) : 1); \ - (void) (g_atomic_int_get (rc) == G_MAXINT ? 0 : g_atomic_int_inc ((rc))); \ - })) - -#undef g_atomic_ref_count_dec -# define g_atomic_ref_count_dec(rc) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(rc) == sizeof (gatomicrefcount)); \ - (void) (0 ? *(rc) ^ *(rc) : 1); \ - g_atomic_int_dec_and_test ((rc)); \ - })) - -#undef g_atomic_ref_count_compare -# define g_atomic_ref_count_compare(rc,val) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(rc) == sizeof (gatomicrefcount)); \ - (void) (0 ? *(rc) ^ (val) : 1); \ - (gboolean) (g_atomic_int_get (rc) == (val)); \ - })) - -#endif /* __GNUC__ && G_DISABLE_CHECKS */ - -G_END_DECLS - -#endif /* __GREFCOUNT_H__ */ -/* grefstring.h: Reference counted strings - * - * Copyright 2018 Emmanuele Bassi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#pragma once - - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_2_58 -char * g_ref_string_new (const char *str); -GLIB_AVAILABLE_IN_2_58 -char * g_ref_string_new_len (const char *str, - gssize len); -GLIB_AVAILABLE_IN_2_58 -char * g_ref_string_new_intern (const char *str); - -GLIB_AVAILABLE_IN_2_58 -char * g_ref_string_acquire (char *str); -GLIB_AVAILABLE_IN_2_58 -void g_ref_string_release (char *str); - -GLIB_AVAILABLE_IN_2_58 -gsize g_ref_string_length (char *str); - -/** - * GRefString: - * - * A typedef for a reference-counted string. A pointer to a #GRefString can be - * treated like a standard `char*` array by all code, but can additionally have - * `g_ref_string_*()` methods called on it. `g_ref_string_*()` methods cannot be - * called on `char*` arrays not allocated using g_ref_string_new(). - * - * If using #GRefString with autocleanups, g_autoptr() must be used rather than - * g_autofree(), so that the reference counting metadata is also freed. - * - * Since: 2.58 - */ -typedef char GRefString; - -G_END_DECLS -/* GRegex -- regular expression API wrapper around PCRE. - * - * Copyright (C) 1999, 2000 Scott Wimer - * Copyright (C) 2004, Matthias Clasen - * Copyright (C) 2005 - 2007, Marco Barisione - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_REGEX_H__ -#define __G_REGEX_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/** - * GRegexError: - * @G_REGEX_ERROR_COMPILE: Compilation of the regular expression failed. - * @G_REGEX_ERROR_OPTIMIZE: Optimization of the regular expression failed. - * @G_REGEX_ERROR_REPLACE: Replacement failed due to an ill-formed replacement - * string. - * @G_REGEX_ERROR_MATCH: The match process failed. - * @G_REGEX_ERROR_INTERNAL: Internal error of the regular expression engine. - * Since 2.16 - * @G_REGEX_ERROR_STRAY_BACKSLASH: "\\" at end of pattern. Since 2.16 - * @G_REGEX_ERROR_MISSING_CONTROL_CHAR: "\\c" at end of pattern. Since 2.16 - * @G_REGEX_ERROR_UNRECOGNIZED_ESCAPE: Unrecognized character follows "\\". - * Since 2.16 - * @G_REGEX_ERROR_QUANTIFIERS_OUT_OF_ORDER: Numbers out of order in "{}" - * quantifier. Since 2.16 - * @G_REGEX_ERROR_QUANTIFIER_TOO_BIG: Number too big in "{}" quantifier. - * Since 2.16 - * @G_REGEX_ERROR_UNTERMINATED_CHARACTER_CLASS: Missing terminating "]" for - * character class. Since 2.16 - * @G_REGEX_ERROR_INVALID_ESCAPE_IN_CHARACTER_CLASS: Invalid escape sequence - * in character class. Since 2.16 - * @G_REGEX_ERROR_RANGE_OUT_OF_ORDER: Range out of order in character class. - * Since 2.16 - * @G_REGEX_ERROR_NOTHING_TO_REPEAT: Nothing to repeat. Since 2.16 - * @G_REGEX_ERROR_UNRECOGNIZED_CHARACTER: Unrecognized character after "(?", - * "(?<" or "(?P". Since 2.16 - * @G_REGEX_ERROR_POSIX_NAMED_CLASS_OUTSIDE_CLASS: POSIX named classes are - * supported only within a class. Since 2.16 - * @G_REGEX_ERROR_UNMATCHED_PARENTHESIS: Missing terminating ")" or ")" - * without opening "(". Since 2.16 - * @G_REGEX_ERROR_INEXISTENT_SUBPATTERN_REFERENCE: Reference to non-existent - * subpattern. Since 2.16 - * @G_REGEX_ERROR_UNTERMINATED_COMMENT: Missing terminating ")" after comment. - * Since 2.16 - * @G_REGEX_ERROR_EXPRESSION_TOO_LARGE: Regular expression too large. - * Since 2.16 - * @G_REGEX_ERROR_MEMORY_ERROR: Failed to get memory. Since 2.16 - * @G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND: Lookbehind assertion is not - * fixed length. Since 2.16 - * @G_REGEX_ERROR_MALFORMED_CONDITION: Malformed number or name after "(?(". - * Since 2.16 - * @G_REGEX_ERROR_TOO_MANY_CONDITIONAL_BRANCHES: Conditional group contains - * more than two branches. Since 2.16 - * @G_REGEX_ERROR_ASSERTION_EXPECTED: Assertion expected after "(?(". - * Since 2.16 - * @G_REGEX_ERROR_UNKNOWN_POSIX_CLASS_NAME: Unknown POSIX class name. - * Since 2.16 - * @G_REGEX_ERROR_POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED: POSIX collating - * elements are not supported. Since 2.16 - * @G_REGEX_ERROR_HEX_CODE_TOO_LARGE: Character value in "\\x{...}" sequence - * is too large. Since 2.16 - * @G_REGEX_ERROR_INVALID_CONDITION: Invalid condition "(?(0)". Since 2.16 - * @G_REGEX_ERROR_SINGLE_BYTE_MATCH_IN_LOOKBEHIND: \\C not allowed in - * lookbehind assertion. Since 2.16 - * @G_REGEX_ERROR_INFINITE_LOOP: Recursive call could loop indefinitely. - * Since 2.16 - * @G_REGEX_ERROR_MISSING_SUBPATTERN_NAME_TERMINATOR: Missing terminator - * in subpattern name. Since 2.16 - * @G_REGEX_ERROR_DUPLICATE_SUBPATTERN_NAME: Two named subpatterns have - * the same name. Since 2.16 - * @G_REGEX_ERROR_MALFORMED_PROPERTY: Malformed "\\P" or "\\p" sequence. - * Since 2.16 - * @G_REGEX_ERROR_UNKNOWN_PROPERTY: Unknown property name after "\\P" or - * "\\p". Since 2.16 - * @G_REGEX_ERROR_SUBPATTERN_NAME_TOO_LONG: Subpattern name is too long - * (maximum 32 characters). Since 2.16 - * @G_REGEX_ERROR_TOO_MANY_SUBPATTERNS: Too many named subpatterns (maximum - * 10,000). Since 2.16 - * @G_REGEX_ERROR_INVALID_OCTAL_VALUE: Octal value is greater than "\\377". - * Since 2.16 - * @G_REGEX_ERROR_TOO_MANY_BRANCHES_IN_DEFINE: "DEFINE" group contains more - * than one branch. Since 2.16 - * @G_REGEX_ERROR_DEFINE_REPETION: Repeating a "DEFINE" group is not allowed. - * This error is never raised. Since: 2.16 Deprecated: 2.34 - * @G_REGEX_ERROR_INCONSISTENT_NEWLINE_OPTIONS: Inconsistent newline options. - * Since 2.16 - * @G_REGEX_ERROR_MISSING_BACK_REFERENCE: "\\g" is not followed by a braced, - * angle-bracketed, or quoted name or number, or by a plain number. Since: 2.16 - * @G_REGEX_ERROR_INVALID_RELATIVE_REFERENCE: relative reference must not be zero. Since: 2.34 - * @G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_FORBIDDEN: the backtracing - * control verb used does not allow an argument. Since: 2.34 - * @G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB: unknown backtracing - * control verb. Since: 2.34 - * @G_REGEX_ERROR_NUMBER_TOO_BIG: number is too big in escape sequence. Since: 2.34 - * @G_REGEX_ERROR_MISSING_SUBPATTERN_NAME: Missing subpattern name. Since: 2.34 - * @G_REGEX_ERROR_MISSING_DIGIT: Missing digit. Since 2.34 - * @G_REGEX_ERROR_INVALID_DATA_CHARACTER: In JavaScript compatibility mode, - * "[" is an invalid data character. Since: 2.34 - * @G_REGEX_ERROR_EXTRA_SUBPATTERN_NAME: different names for subpatterns of the - * same number are not allowed. Since: 2.34 - * @G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_REQUIRED: the backtracing control - * verb requires an argument. Since: 2.34 - * @G_REGEX_ERROR_INVALID_CONTROL_CHAR: "\\c" must be followed by an ASCII - * character. Since: 2.34 - * @G_REGEX_ERROR_MISSING_NAME: "\\k" is not followed by a braced, angle-bracketed, or - * quoted name. Since: 2.34 - * @G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS: "\\N" is not supported in a class. Since: 2.34 - * @G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES: too many forward references. Since: 2.34 - * @G_REGEX_ERROR_NAME_TOO_LONG: the name is too long in "(*MARK)", "(*PRUNE)", - * "(*SKIP)", or "(*THEN)". Since: 2.34 - * @G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE: the character value in the \\u sequence is - * too large. Since: 2.34 - * - * Error codes returned by regular expressions functions. - * - * Since: 2.14 - */ -typedef enum -{ - G_REGEX_ERROR_COMPILE, - G_REGEX_ERROR_OPTIMIZE, - G_REGEX_ERROR_REPLACE, - G_REGEX_ERROR_MATCH, - G_REGEX_ERROR_INTERNAL, - - /* These are the error codes from PCRE + 100 */ - G_REGEX_ERROR_STRAY_BACKSLASH = 101, - G_REGEX_ERROR_MISSING_CONTROL_CHAR = 102, - G_REGEX_ERROR_UNRECOGNIZED_ESCAPE = 103, - G_REGEX_ERROR_QUANTIFIERS_OUT_OF_ORDER = 104, - G_REGEX_ERROR_QUANTIFIER_TOO_BIG = 105, - G_REGEX_ERROR_UNTERMINATED_CHARACTER_CLASS = 106, - G_REGEX_ERROR_INVALID_ESCAPE_IN_CHARACTER_CLASS = 107, - G_REGEX_ERROR_RANGE_OUT_OF_ORDER = 108, - G_REGEX_ERROR_NOTHING_TO_REPEAT = 109, - G_REGEX_ERROR_UNRECOGNIZED_CHARACTER = 112, - G_REGEX_ERROR_POSIX_NAMED_CLASS_OUTSIDE_CLASS = 113, - G_REGEX_ERROR_UNMATCHED_PARENTHESIS = 114, - G_REGEX_ERROR_INEXISTENT_SUBPATTERN_REFERENCE = 115, - G_REGEX_ERROR_UNTERMINATED_COMMENT = 118, - G_REGEX_ERROR_EXPRESSION_TOO_LARGE = 120, - G_REGEX_ERROR_MEMORY_ERROR = 121, - G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND = 125, - G_REGEX_ERROR_MALFORMED_CONDITION = 126, - G_REGEX_ERROR_TOO_MANY_CONDITIONAL_BRANCHES = 127, - G_REGEX_ERROR_ASSERTION_EXPECTED = 128, - G_REGEX_ERROR_UNKNOWN_POSIX_CLASS_NAME = 130, - G_REGEX_ERROR_POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED = 131, - G_REGEX_ERROR_HEX_CODE_TOO_LARGE = 134, - G_REGEX_ERROR_INVALID_CONDITION = 135, - G_REGEX_ERROR_SINGLE_BYTE_MATCH_IN_LOOKBEHIND = 136, - G_REGEX_ERROR_INFINITE_LOOP = 140, - G_REGEX_ERROR_MISSING_SUBPATTERN_NAME_TERMINATOR = 142, - G_REGEX_ERROR_DUPLICATE_SUBPATTERN_NAME = 143, - G_REGEX_ERROR_MALFORMED_PROPERTY = 146, - G_REGEX_ERROR_UNKNOWN_PROPERTY = 147, - G_REGEX_ERROR_SUBPATTERN_NAME_TOO_LONG = 148, - G_REGEX_ERROR_TOO_MANY_SUBPATTERNS = 149, - G_REGEX_ERROR_INVALID_OCTAL_VALUE = 151, - G_REGEX_ERROR_TOO_MANY_BRANCHES_IN_DEFINE = 154, - G_REGEX_ERROR_DEFINE_REPETION = 155, - G_REGEX_ERROR_INCONSISTENT_NEWLINE_OPTIONS = 156, - G_REGEX_ERROR_MISSING_BACK_REFERENCE = 157, - G_REGEX_ERROR_INVALID_RELATIVE_REFERENCE = 158, - G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_FORBIDDEN = 159, - G_REGEX_ERROR_UNKNOWN_BACKTRACKING_CONTROL_VERB = 160, - G_REGEX_ERROR_NUMBER_TOO_BIG = 161, - G_REGEX_ERROR_MISSING_SUBPATTERN_NAME = 162, - G_REGEX_ERROR_MISSING_DIGIT = 163, - G_REGEX_ERROR_INVALID_DATA_CHARACTER = 164, - G_REGEX_ERROR_EXTRA_SUBPATTERN_NAME = 165, - G_REGEX_ERROR_BACKTRACKING_CONTROL_VERB_ARGUMENT_REQUIRED = 166, - G_REGEX_ERROR_INVALID_CONTROL_CHAR = 168, - G_REGEX_ERROR_MISSING_NAME = 169, - G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS = 171, - G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES = 172, - G_REGEX_ERROR_NAME_TOO_LONG = 175, - G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE = 176 -} GRegexError; - -/** - * G_REGEX_ERROR: - * - * Error domain for regular expressions. Errors in this domain will be - * from the #GRegexError enumeration. See #GError for information on - * error domains. - * - * Since: 2.14 - */ -#define G_REGEX_ERROR g_regex_error_quark () - -GLIB_AVAILABLE_IN_ALL -GQuark g_regex_error_quark (void); - -/** - * GRegexCompileFlags: - * @G_REGEX_CASELESS: Letters in the pattern match both upper- and - * lowercase letters. This option can be changed within a pattern - * by a "(?i)" option setting. - * @G_REGEX_MULTILINE: By default, GRegex treats the strings as consisting - * of a single line of characters (even if it actually contains - * newlines). The "start of line" metacharacter ("^") matches only - * at the start of the string, while the "end of line" metacharacter - * ("$") matches only at the end of the string, or before a terminating - * newline (unless #G_REGEX_DOLLAR_ENDONLY is set). When - * #G_REGEX_MULTILINE is set, the "start of line" and "end of line" - * constructs match immediately following or immediately before any - * newline in the string, respectively, as well as at the very start - * and end. This can be changed within a pattern by a "(?m)" option - * setting. - * @G_REGEX_DOTALL: A dot metacharacter (".") in the pattern matches all - * characters, including newlines. Without it, newlines are excluded. - * This option can be changed within a pattern by a ("?s") option setting. - * @G_REGEX_EXTENDED: Whitespace data characters in the pattern are - * totally ignored except when escaped or inside a character class. - * Whitespace does not include the VT character (code 11). In addition, - * characters between an unescaped "#" outside a character class and - * the next newline character, inclusive, are also ignored. This can - * be changed within a pattern by a "(?x)" option setting. - * @G_REGEX_ANCHORED: The pattern is forced to be "anchored", that is, - * it is constrained to match only at the first matching point in the - * string that is being searched. This effect can also be achieved by - * appropriate constructs in the pattern itself such as the "^" - * metacharacter. - * @G_REGEX_DOLLAR_ENDONLY: A dollar metacharacter ("$") in the pattern - * matches only at the end of the string. Without this option, a - * dollar also matches immediately before the final character if - * it is a newline (but not before any other newlines). This option - * is ignored if #G_REGEX_MULTILINE is set. - * @G_REGEX_UNGREEDY: Inverts the "greediness" of the quantifiers so that - * they are not greedy by default, but become greedy if followed by "?". - * It can also be set by a "(?U)" option setting within the pattern. - * @G_REGEX_RAW: Usually strings must be valid UTF-8 strings, using this - * flag they are considered as a raw sequence of bytes. - * @G_REGEX_NO_AUTO_CAPTURE: Disables the use of numbered capturing - * parentheses in the pattern. Any opening parenthesis that is not - * followed by "?" behaves as if it were followed by "?:" but named - * parentheses can still be used for capturing (and they acquire numbers - * in the usual way). - * @G_REGEX_OPTIMIZE: Optimize the regular expression. If the pattern will - * be used many times, then it may be worth the effort to optimize it - * to improve the speed of matches. - * @G_REGEX_FIRSTLINE: Limits an unanchored pattern to match before (or at) the - * first newline. Since: 2.34 - * @G_REGEX_DUPNAMES: Names used to identify capturing subpatterns need not - * be unique. This can be helpful for certain types of pattern when it - * is known that only one instance of the named subpattern can ever be - * matched. - * @G_REGEX_NEWLINE_CR: Usually any newline character or character sequence is - * recognized. If this option is set, the only recognized newline character - * is '\r'. - * @G_REGEX_NEWLINE_LF: Usually any newline character or character sequence is - * recognized. If this option is set, the only recognized newline character - * is '\n'. - * @G_REGEX_NEWLINE_CRLF: Usually any newline character or character sequence is - * recognized. If this option is set, the only recognized newline character - * sequence is '\r\n'. - * @G_REGEX_NEWLINE_ANYCRLF: Usually any newline character or character sequence - * is recognized. If this option is set, the only recognized newline character - * sequences are '\r', '\n', and '\r\n'. Since: 2.34 - * @G_REGEX_BSR_ANYCRLF: Usually any newline character or character sequence - * is recognised. If this option is set, then "\R" only recognizes the newline - * characters '\r', '\n' and '\r\n'. Since: 2.34 - * @G_REGEX_JAVASCRIPT_COMPAT: Changes behaviour so that it is compatible with - * JavaScript rather than PCRE. Since: 2.34 - * - * Flags specifying compile-time options. - * - * Since: 2.14 - */ -/* Remember to update G_REGEX_COMPILE_MASK in gregex.c after - * adding a new flag. - */ -typedef enum -{ - G_REGEX_CASELESS = 1 << 0, - G_REGEX_MULTILINE = 1 << 1, - G_REGEX_DOTALL = 1 << 2, - G_REGEX_EXTENDED = 1 << 3, - G_REGEX_ANCHORED = 1 << 4, - G_REGEX_DOLLAR_ENDONLY = 1 << 5, - G_REGEX_UNGREEDY = 1 << 9, - G_REGEX_RAW = 1 << 11, - G_REGEX_NO_AUTO_CAPTURE = 1 << 12, - G_REGEX_OPTIMIZE = 1 << 13, - G_REGEX_FIRSTLINE = 1 << 18, - G_REGEX_DUPNAMES = 1 << 19, - G_REGEX_NEWLINE_CR = 1 << 20, - G_REGEX_NEWLINE_LF = 1 << 21, - G_REGEX_NEWLINE_CRLF = G_REGEX_NEWLINE_CR | G_REGEX_NEWLINE_LF, - G_REGEX_NEWLINE_ANYCRLF = G_REGEX_NEWLINE_CR | 1 << 22, - G_REGEX_BSR_ANYCRLF = 1 << 23, - G_REGEX_JAVASCRIPT_COMPAT = 1 << 25 -} GRegexCompileFlags; - -/** - * GRegexMatchFlags: - * @G_REGEX_MATCH_ANCHORED: The pattern is forced to be "anchored", that is, - * it is constrained to match only at the first matching point in the - * string that is being searched. This effect can also be achieved by - * appropriate constructs in the pattern itself such as the "^" - * metacharacter. - * @G_REGEX_MATCH_NOTBOL: Specifies that first character of the string is - * not the beginning of a line, so the circumflex metacharacter should - * not match before it. Setting this without #G_REGEX_MULTILINE (at - * compile time) causes circumflex never to match. This option affects - * only the behaviour of the circumflex metacharacter, it does not - * affect "\A". - * @G_REGEX_MATCH_NOTEOL: Specifies that the end of the subject string is - * not the end of a line, so the dollar metacharacter should not match - * it nor (except in multiline mode) a newline immediately before it. - * Setting this without #G_REGEX_MULTILINE (at compile time) causes - * dollar never to match. This option affects only the behaviour of - * the dollar metacharacter, it does not affect "\Z" or "\z". - * @G_REGEX_MATCH_NOTEMPTY: An empty string is not considered to be a valid - * match if this option is set. If there are alternatives in the pattern, - * they are tried. If all the alternatives match the empty string, the - * entire match fails. For example, if the pattern "a?b?" is applied to - * a string not beginning with "a" or "b", it matches the empty string - * at the start of the string. With this flag set, this match is not - * valid, so GRegex searches further into the string for occurrences - * of "a" or "b". - * @G_REGEX_MATCH_PARTIAL: Turns on the partial matching feature, for more - * documentation on partial matching see g_match_info_is_partial_match(). - * @G_REGEX_MATCH_NEWLINE_CR: Overrides the newline definition set when - * creating a new #GRegex, setting the '\r' character as line terminator. - * @G_REGEX_MATCH_NEWLINE_LF: Overrides the newline definition set when - * creating a new #GRegex, setting the '\n' character as line terminator. - * @G_REGEX_MATCH_NEWLINE_CRLF: Overrides the newline definition set when - * creating a new #GRegex, setting the '\r\n' characters sequence as line terminator. - * @G_REGEX_MATCH_NEWLINE_ANY: Overrides the newline definition set when - * creating a new #GRegex, any Unicode newline sequence - * is recognised as a newline. These are '\r', '\n' and '\rn', and the - * single characters U+000B LINE TABULATION, U+000C FORM FEED (FF), - * U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and - * U+2029 PARAGRAPH SEPARATOR. - * @G_REGEX_MATCH_NEWLINE_ANYCRLF: Overrides the newline definition set when - * creating a new #GRegex; any '\r', '\n', or '\r\n' character sequence - * is recognized as a newline. Since: 2.34 - * @G_REGEX_MATCH_BSR_ANYCRLF: Overrides the newline definition for "\R" set when - * creating a new #GRegex; only '\r', '\n', or '\r\n' character sequences - * are recognized as a newline by "\R". Since: 2.34 - * @G_REGEX_MATCH_BSR_ANY: Overrides the newline definition for "\R" set when - * creating a new #GRegex; any Unicode newline character or character sequence - * are recognized as a newline by "\R". These are '\r', '\n' and '\rn', and the - * single characters U+000B LINE TABULATION, U+000C FORM FEED (FF), - * U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and - * U+2029 PARAGRAPH SEPARATOR. Since: 2.34 - * @G_REGEX_MATCH_PARTIAL_SOFT: An alias for #G_REGEX_MATCH_PARTIAL. Since: 2.34 - * @G_REGEX_MATCH_PARTIAL_HARD: Turns on the partial matching feature. In contrast to - * to #G_REGEX_MATCH_PARTIAL_SOFT, this stops matching as soon as a partial match - * is found, without continuing to search for a possible complete match. See - * g_match_info_is_partial_match() for more information. Since: 2.34 - * @G_REGEX_MATCH_NOTEMPTY_ATSTART: Like #G_REGEX_MATCH_NOTEMPTY, but only applied to - * the start of the matched string. For anchored - * patterns this can only happen for pattern containing "\K". Since: 2.34 - * - * Flags specifying match-time options. - * - * Since: 2.14 - */ -/* Remember to update G_REGEX_MATCH_MASK in gregex.c after - * adding a new flag. */ -typedef enum -{ - G_REGEX_MATCH_ANCHORED = 1 << 4, - G_REGEX_MATCH_NOTBOL = 1 << 7, - G_REGEX_MATCH_NOTEOL = 1 << 8, - G_REGEX_MATCH_NOTEMPTY = 1 << 10, - G_REGEX_MATCH_PARTIAL = 1 << 15, - G_REGEX_MATCH_NEWLINE_CR = 1 << 20, - G_REGEX_MATCH_NEWLINE_LF = 1 << 21, - G_REGEX_MATCH_NEWLINE_CRLF = G_REGEX_MATCH_NEWLINE_CR | G_REGEX_MATCH_NEWLINE_LF, - G_REGEX_MATCH_NEWLINE_ANY = 1 << 22, - G_REGEX_MATCH_NEWLINE_ANYCRLF = G_REGEX_MATCH_NEWLINE_CR | G_REGEX_MATCH_NEWLINE_ANY, - G_REGEX_MATCH_BSR_ANYCRLF = 1 << 23, - G_REGEX_MATCH_BSR_ANY = 1 << 24, - G_REGEX_MATCH_PARTIAL_SOFT = G_REGEX_MATCH_PARTIAL, - G_REGEX_MATCH_PARTIAL_HARD = 1 << 27, - G_REGEX_MATCH_NOTEMPTY_ATSTART = 1 << 28 -} GRegexMatchFlags; - -/** - * GRegex: - * - * A GRegex is the "compiled" form of a regular expression pattern. - * This structure is opaque and its fields cannot be accessed directly. - * - * Since: 2.14 - */ -typedef struct _GRegex GRegex; - - -/** - * GMatchInfo: - * - * A GMatchInfo is an opaque struct used to return information about - * matches. - */ -typedef struct _GMatchInfo GMatchInfo; - -/** - * GRegexEvalCallback: - * @match_info: the #GMatchInfo generated by the match. - * Use g_match_info_get_regex() and g_match_info_get_string() if you - * need the #GRegex or the matched string. - * @result: a #GString containing the new string - * @user_data: user data passed to g_regex_replace_eval() - * - * Specifies the type of the function passed to g_regex_replace_eval(). - * It is called for each occurrence of the pattern in the string passed - * to g_regex_replace_eval(), and it should append the replacement to - * @result. - * - * Returns: %FALSE to continue the replacement process, %TRUE to stop it - * - * Since: 2.14 - */ -typedef gboolean (*GRegexEvalCallback) (const GMatchInfo *match_info, - GString *result, - gpointer user_data); - - -GLIB_AVAILABLE_IN_ALL -GRegex *g_regex_new (const gchar *pattern, - GRegexCompileFlags compile_options, - GRegexMatchFlags match_options, - GError **error); -GLIB_AVAILABLE_IN_ALL -GRegex *g_regex_ref (GRegex *regex); -GLIB_AVAILABLE_IN_ALL -void g_regex_unref (GRegex *regex); -GLIB_AVAILABLE_IN_ALL -const gchar *g_regex_get_pattern (const GRegex *regex); -GLIB_AVAILABLE_IN_ALL -gint g_regex_get_max_backref (const GRegex *regex); -GLIB_AVAILABLE_IN_ALL -gint g_regex_get_capture_count (const GRegex *regex); -GLIB_AVAILABLE_IN_ALL -gboolean g_regex_get_has_cr_or_lf (const GRegex *regex); -GLIB_AVAILABLE_IN_2_38 -gint g_regex_get_max_lookbehind (const GRegex *regex); -GLIB_AVAILABLE_IN_ALL -gint g_regex_get_string_number (const GRegex *regex, - const gchar *name); -GLIB_AVAILABLE_IN_ALL -gchar *g_regex_escape_string (const gchar *string, - gint length); -GLIB_AVAILABLE_IN_ALL -gchar *g_regex_escape_nul (const gchar *string, - gint length); - -GLIB_AVAILABLE_IN_ALL -GRegexCompileFlags g_regex_get_compile_flags (const GRegex *regex); -GLIB_AVAILABLE_IN_ALL -GRegexMatchFlags g_regex_get_match_flags (const GRegex *regex); - -/* Matching. */ -GLIB_AVAILABLE_IN_ALL -gboolean g_regex_match_simple (const gchar *pattern, - const gchar *string, - GRegexCompileFlags compile_options, - GRegexMatchFlags match_options); -GLIB_AVAILABLE_IN_ALL -gboolean g_regex_match (const GRegex *regex, - const gchar *string, - GRegexMatchFlags match_options, - GMatchInfo **match_info); -GLIB_AVAILABLE_IN_ALL -gboolean g_regex_match_full (const GRegex *regex, - const gchar *string, - gssize string_len, - gint start_position, - GRegexMatchFlags match_options, - GMatchInfo **match_info, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_regex_match_all (const GRegex *regex, - const gchar *string, - GRegexMatchFlags match_options, - GMatchInfo **match_info); -GLIB_AVAILABLE_IN_ALL -gboolean g_regex_match_all_full (const GRegex *regex, - const gchar *string, - gssize string_len, - gint start_position, - GRegexMatchFlags match_options, - GMatchInfo **match_info, - GError **error); - -/* String splitting. */ -GLIB_AVAILABLE_IN_ALL -gchar **g_regex_split_simple (const gchar *pattern, - const gchar *string, - GRegexCompileFlags compile_options, - GRegexMatchFlags match_options); -GLIB_AVAILABLE_IN_ALL -gchar **g_regex_split (const GRegex *regex, - const gchar *string, - GRegexMatchFlags match_options); -GLIB_AVAILABLE_IN_ALL -gchar **g_regex_split_full (const GRegex *regex, - const gchar *string, - gssize string_len, - gint start_position, - GRegexMatchFlags match_options, - gint max_tokens, - GError **error); - -/* String replacement. */ -GLIB_AVAILABLE_IN_ALL -gchar *g_regex_replace (const GRegex *regex, - const gchar *string, - gssize string_len, - gint start_position, - const gchar *replacement, - GRegexMatchFlags match_options, - GError **error); -GLIB_AVAILABLE_IN_ALL -gchar *g_regex_replace_literal (const GRegex *regex, - const gchar *string, - gssize string_len, - gint start_position, - const gchar *replacement, - GRegexMatchFlags match_options, - GError **error); -GLIB_AVAILABLE_IN_ALL -gchar *g_regex_replace_eval (const GRegex *regex, - const gchar *string, - gssize string_len, - gint start_position, - GRegexMatchFlags match_options, - GRegexEvalCallback eval, - gpointer user_data, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_regex_check_replacement (const gchar *replacement, - gboolean *has_references, - GError **error); - -/* Match info */ -GLIB_AVAILABLE_IN_ALL -GRegex *g_match_info_get_regex (const GMatchInfo *match_info); -GLIB_AVAILABLE_IN_ALL -const gchar *g_match_info_get_string (const GMatchInfo *match_info); - -GLIB_AVAILABLE_IN_ALL -GMatchInfo *g_match_info_ref (GMatchInfo *match_info); -GLIB_AVAILABLE_IN_ALL -void g_match_info_unref (GMatchInfo *match_info); -GLIB_AVAILABLE_IN_ALL -void g_match_info_free (GMatchInfo *match_info); -GLIB_AVAILABLE_IN_ALL -gboolean g_match_info_next (GMatchInfo *match_info, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_match_info_matches (const GMatchInfo *match_info); -GLIB_AVAILABLE_IN_ALL -gint g_match_info_get_match_count (const GMatchInfo *match_info); -GLIB_AVAILABLE_IN_ALL -gboolean g_match_info_is_partial_match (const GMatchInfo *match_info); -GLIB_AVAILABLE_IN_ALL -gchar *g_match_info_expand_references(const GMatchInfo *match_info, - const gchar *string_to_expand, - GError **error); -GLIB_AVAILABLE_IN_ALL -gchar *g_match_info_fetch (const GMatchInfo *match_info, - gint match_num); -GLIB_AVAILABLE_IN_ALL -gboolean g_match_info_fetch_pos (const GMatchInfo *match_info, - gint match_num, - gint *start_pos, - gint *end_pos); -GLIB_AVAILABLE_IN_ALL -gchar *g_match_info_fetch_named (const GMatchInfo *match_info, - const gchar *name); -GLIB_AVAILABLE_IN_ALL -gboolean g_match_info_fetch_named_pos (const GMatchInfo *match_info, - const gchar *name, - gint *start_pos, - gint *end_pos); -GLIB_AVAILABLE_IN_ALL -gchar **g_match_info_fetch_all (const GMatchInfo *match_info); - -G_END_DECLS - -#endif /* __G_REGEX_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_SCANNER_H__ -#define __G_SCANNER_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GScanner GScanner; -typedef struct _GScannerConfig GScannerConfig; -typedef union _GTokenValue GTokenValue; - -typedef void (*GScannerMsgFunc) (GScanner *scanner, - gchar *message, - gboolean error); - -/* GScanner: Flexible lexical scanner for general purpose. - */ - -/* Character sets */ -#define G_CSET_A_2_Z "ABCDEFGHIJKLMNOPQRSTUVWXYZ" -#define G_CSET_a_2_z "abcdefghijklmnopqrstuvwxyz" -#define G_CSET_DIGITS "0123456789" -#define G_CSET_LATINC "\300\301\302\303\304\305\306"\ - "\307\310\311\312\313\314\315\316\317\320"\ - "\321\322\323\324\325\326"\ - "\330\331\332\333\334\335\336" -#define G_CSET_LATINS "\337\340\341\342\343\344\345\346"\ - "\347\350\351\352\353\354\355\356\357\360"\ - "\361\362\363\364\365\366"\ - "\370\371\372\373\374\375\376\377" - -/* Error types */ -typedef enum -{ - G_ERR_UNKNOWN, - G_ERR_UNEXP_EOF, - G_ERR_UNEXP_EOF_IN_STRING, - G_ERR_UNEXP_EOF_IN_COMMENT, - G_ERR_NON_DIGIT_IN_CONST, - G_ERR_DIGIT_RADIX, - G_ERR_FLOAT_RADIX, - G_ERR_FLOAT_MALFORMED -} GErrorType; - -/* Token types */ -typedef enum -{ - G_TOKEN_EOF = 0, - - G_TOKEN_LEFT_PAREN = '(', - G_TOKEN_RIGHT_PAREN = ')', - G_TOKEN_LEFT_CURLY = '{', - G_TOKEN_RIGHT_CURLY = '}', - G_TOKEN_LEFT_BRACE = '[', - G_TOKEN_RIGHT_BRACE = ']', - G_TOKEN_EQUAL_SIGN = '=', - G_TOKEN_COMMA = ',', - - G_TOKEN_NONE = 256, - - G_TOKEN_ERROR, - - G_TOKEN_CHAR, - G_TOKEN_BINARY, - G_TOKEN_OCTAL, - G_TOKEN_INT, - G_TOKEN_HEX, - G_TOKEN_FLOAT, - G_TOKEN_STRING, - - G_TOKEN_SYMBOL, - G_TOKEN_IDENTIFIER, - G_TOKEN_IDENTIFIER_NULL, - - G_TOKEN_COMMENT_SINGLE, - G_TOKEN_COMMENT_MULTI, - - /*< private >*/ - G_TOKEN_LAST -} GTokenType; - -union _GTokenValue -{ - gpointer v_symbol; - gchar *v_identifier; - gulong v_binary; - gulong v_octal; - gulong v_int; - guint64 v_int64; - gdouble v_float; - gulong v_hex; - gchar *v_string; - gchar *v_comment; - guchar v_char; - guint v_error; -}; - -struct _GScannerConfig -{ - /* Character sets - */ - gchar *cset_skip_characters; /* default: " \t\n" */ - gchar *cset_identifier_first; - gchar *cset_identifier_nth; - gchar *cpair_comment_single; /* default: "#\n" */ - - /* Should symbol lookup work case sensitive? - */ - guint case_sensitive : 1; - - /* Boolean values to be adjusted "on the fly" - * to configure scanning behaviour. - */ - guint skip_comment_multi : 1; /* C like comment */ - guint skip_comment_single : 1; /* single line comment */ - guint scan_comment_multi : 1; /* scan multi line comments? */ - guint scan_identifier : 1; - guint scan_identifier_1char : 1; - guint scan_identifier_NULL : 1; - guint scan_symbols : 1; - guint scan_binary : 1; - guint scan_octal : 1; - guint scan_float : 1; - guint scan_hex : 1; /* '0x0ff0' */ - guint scan_hex_dollar : 1; /* '$0ff0' */ - guint scan_string_sq : 1; /* string: 'anything' */ - guint scan_string_dq : 1; /* string: "\\-escapes!\n" */ - guint numbers_2_int : 1; /* bin, octal, hex => int */ - guint int_2_float : 1; /* int => G_TOKEN_FLOAT? */ - guint identifier_2_string : 1; - guint char_2_token : 1; /* return G_TOKEN_CHAR? */ - guint symbol_2_token : 1; - guint scope_0_fallback : 1; /* try scope 0 on lookups? */ - guint store_int64 : 1; /* use value.v_int64 rather than v_int */ - - /*< private >*/ - guint padding_dummy; -}; - -struct _GScanner -{ - /* unused fields */ - gpointer user_data; - guint max_parse_errors; - - /* g_scanner_error() increments this field */ - guint parse_errors; - - /* name of input stream, featured by the default message handler */ - const gchar *input_name; - - /* quarked data */ - GData *qdata; - - /* link into the scanner configuration */ - GScannerConfig *config; - - /* fields filled in after g_scanner_get_next_token() */ - GTokenType token; - GTokenValue value; - guint line; - guint position; - - /* fields filled in after g_scanner_peek_next_token() */ - GTokenType next_token; - GTokenValue next_value; - guint next_line; - guint next_position; - - /*< private >*/ - /* to be considered private */ - GHashTable *symbol_table; - gint input_fd; - const gchar *text; - const gchar *text_end; - gchar *buffer; - guint scope_id; - - /*< public >*/ - /* handler function for _warn and _error */ - GScannerMsgFunc msg_handler; -}; - -GLIB_AVAILABLE_IN_ALL -GScanner* g_scanner_new (const GScannerConfig *config_templ); -GLIB_AVAILABLE_IN_ALL -void g_scanner_destroy (GScanner *scanner); -GLIB_AVAILABLE_IN_ALL -void g_scanner_input_file (GScanner *scanner, - gint input_fd); -GLIB_AVAILABLE_IN_ALL -void g_scanner_sync_file_offset (GScanner *scanner); -GLIB_AVAILABLE_IN_ALL -void g_scanner_input_text (GScanner *scanner, - const gchar *text, - guint text_len); -GLIB_AVAILABLE_IN_ALL -GTokenType g_scanner_get_next_token (GScanner *scanner); -GLIB_AVAILABLE_IN_ALL -GTokenType g_scanner_peek_next_token (GScanner *scanner); -GLIB_AVAILABLE_IN_ALL -GTokenType g_scanner_cur_token (GScanner *scanner); -GLIB_AVAILABLE_IN_ALL -GTokenValue g_scanner_cur_value (GScanner *scanner); -GLIB_AVAILABLE_IN_ALL -guint g_scanner_cur_line (GScanner *scanner); -GLIB_AVAILABLE_IN_ALL -guint g_scanner_cur_position (GScanner *scanner); -GLIB_AVAILABLE_IN_ALL -gboolean g_scanner_eof (GScanner *scanner); -GLIB_AVAILABLE_IN_ALL -guint g_scanner_set_scope (GScanner *scanner, - guint scope_id); -GLIB_AVAILABLE_IN_ALL -void g_scanner_scope_add_symbol (GScanner *scanner, - guint scope_id, - const gchar *symbol, - gpointer value); -GLIB_AVAILABLE_IN_ALL -void g_scanner_scope_remove_symbol (GScanner *scanner, - guint scope_id, - const gchar *symbol); -GLIB_AVAILABLE_IN_ALL -gpointer g_scanner_scope_lookup_symbol (GScanner *scanner, - guint scope_id, - const gchar *symbol); -GLIB_AVAILABLE_IN_ALL -void g_scanner_scope_foreach_symbol (GScanner *scanner, - guint scope_id, - GHFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -gpointer g_scanner_lookup_symbol (GScanner *scanner, - const gchar *symbol); -GLIB_AVAILABLE_IN_ALL -void g_scanner_unexp_token (GScanner *scanner, - GTokenType expected_token, - const gchar *identifier_spec, - const gchar *symbol_spec, - const gchar *symbol_name, - const gchar *message, - gint is_error); -GLIB_AVAILABLE_IN_ALL -void g_scanner_error (GScanner *scanner, - const gchar *format, - ...) G_GNUC_PRINTF (2,3); -GLIB_AVAILABLE_IN_ALL -void g_scanner_warn (GScanner *scanner, - const gchar *format, - ...) G_GNUC_PRINTF (2,3); - -/* keep downward source compatibility */ -#define g_scanner_add_symbol( scanner, symbol, value ) G_STMT_START { \ - g_scanner_scope_add_symbol ((scanner), 0, (symbol), (value)); \ -} G_STMT_END GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_scanner_scope_add_symbol) -#define g_scanner_remove_symbol( scanner, symbol ) G_STMT_START { \ - g_scanner_scope_remove_symbol ((scanner), 0, (symbol)); \ -} G_STMT_END GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_scanner_scope_remove_symbol) -#define g_scanner_foreach_symbol( scanner, func, data ) G_STMT_START { \ - g_scanner_scope_foreach_symbol ((scanner), 0, (func), (data)); \ -} G_STMT_END GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_scanner_scope_foreach_symbol) - -/* The following two functions are deprecated and will be removed in - * the next major release. They do no good. */ -#define g_scanner_freeze_symbol_table(scanner) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26 -#define g_scanner_thaw_symbol_table(scanner) ((void)0) GLIB_DEPRECATED_MACRO_IN_2_26 - -G_END_DECLS - -#endif /* __G_SCANNER_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 - * Soeren Sandmann (sandmann@daimi.au.dk) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#ifndef __G_SEQUENCE_H__ -#define __G_SEQUENCE_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GSequence GSequence; -typedef struct _GSequenceNode GSequenceIter; - -typedef gint (* GSequenceIterCompareFunc) (GSequenceIter *a, - GSequenceIter *b, - gpointer data); - - -/* GSequence */ -GLIB_AVAILABLE_IN_ALL -GSequence * g_sequence_new (GDestroyNotify data_destroy); -GLIB_AVAILABLE_IN_ALL -void g_sequence_free (GSequence *seq); -GLIB_AVAILABLE_IN_ALL -gint g_sequence_get_length (GSequence *seq); -GLIB_AVAILABLE_IN_ALL -void g_sequence_foreach (GSequence *seq, - GFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -void g_sequence_foreach_range (GSequenceIter *begin, - GSequenceIter *end, - GFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -void g_sequence_sort (GSequence *seq, - GCompareDataFunc cmp_func, - gpointer cmp_data); -GLIB_AVAILABLE_IN_ALL -void g_sequence_sort_iter (GSequence *seq, - GSequenceIterCompareFunc cmp_func, - gpointer cmp_data); -GLIB_AVAILABLE_IN_2_48 -gboolean g_sequence_is_empty (GSequence *seq); - - -/* Getting iters */ -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_get_begin_iter (GSequence *seq); -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_get_end_iter (GSequence *seq); -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_get_iter_at_pos (GSequence *seq, - gint pos); -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_append (GSequence *seq, - gpointer data); -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_prepend (GSequence *seq, - gpointer data); -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_insert_before (GSequenceIter *iter, - gpointer data); -GLIB_AVAILABLE_IN_ALL -void g_sequence_move (GSequenceIter *src, - GSequenceIter *dest); -GLIB_AVAILABLE_IN_ALL -void g_sequence_swap (GSequenceIter *a, - GSequenceIter *b); -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_insert_sorted (GSequence *seq, - gpointer data, - GCompareDataFunc cmp_func, - gpointer cmp_data); -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_insert_sorted_iter (GSequence *seq, - gpointer data, - GSequenceIterCompareFunc iter_cmp, - gpointer cmp_data); -GLIB_AVAILABLE_IN_ALL -void g_sequence_sort_changed (GSequenceIter *iter, - GCompareDataFunc cmp_func, - gpointer cmp_data); -GLIB_AVAILABLE_IN_ALL -void g_sequence_sort_changed_iter (GSequenceIter *iter, - GSequenceIterCompareFunc iter_cmp, - gpointer cmp_data); -GLIB_AVAILABLE_IN_ALL -void g_sequence_remove (GSequenceIter *iter); -GLIB_AVAILABLE_IN_ALL -void g_sequence_remove_range (GSequenceIter *begin, - GSequenceIter *end); -GLIB_AVAILABLE_IN_ALL -void g_sequence_move_range (GSequenceIter *dest, - GSequenceIter *begin, - GSequenceIter *end); -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_search (GSequence *seq, - gpointer data, - GCompareDataFunc cmp_func, - gpointer cmp_data); -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_search_iter (GSequence *seq, - gpointer data, - GSequenceIterCompareFunc iter_cmp, - gpointer cmp_data); -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_lookup (GSequence *seq, - gpointer data, - GCompareDataFunc cmp_func, - gpointer cmp_data); -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_lookup_iter (GSequence *seq, - gpointer data, - GSequenceIterCompareFunc iter_cmp, - gpointer cmp_data); - - -/* Dereferencing */ -GLIB_AVAILABLE_IN_ALL -gpointer g_sequence_get (GSequenceIter *iter); -GLIB_AVAILABLE_IN_ALL -void g_sequence_set (GSequenceIter *iter, - gpointer data); - -/* Operations on GSequenceIter * */ -GLIB_AVAILABLE_IN_ALL -gboolean g_sequence_iter_is_begin (GSequenceIter *iter); -GLIB_AVAILABLE_IN_ALL -gboolean g_sequence_iter_is_end (GSequenceIter *iter); -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_iter_next (GSequenceIter *iter); -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_iter_prev (GSequenceIter *iter); -GLIB_AVAILABLE_IN_ALL -gint g_sequence_iter_get_position (GSequenceIter *iter); -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_iter_move (GSequenceIter *iter, - gint delta); -GLIB_AVAILABLE_IN_ALL -GSequence * g_sequence_iter_get_sequence (GSequenceIter *iter); - - -/* Search */ -GLIB_AVAILABLE_IN_ALL -gint g_sequence_iter_compare (GSequenceIter *a, - GSequenceIter *b); -GLIB_AVAILABLE_IN_ALL -GSequenceIter *g_sequence_range_get_midpoint (GSequenceIter *begin, - GSequenceIter *end); - -G_END_DECLS - -#endif /* __G_SEQUENCE_H__ */ -/* gshell.h - Shell-related utilities - * - * Copyright 2000 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_SHELL_H__ -#define __G_SHELL_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -#define G_SHELL_ERROR g_shell_error_quark () - -typedef enum -{ - /* mismatched or otherwise mangled quoting */ - G_SHELL_ERROR_BAD_QUOTING, - /* string to be parsed was empty */ - G_SHELL_ERROR_EMPTY_STRING, - G_SHELL_ERROR_FAILED -} GShellError; - -GLIB_AVAILABLE_IN_ALL -GQuark g_shell_error_quark (void); - -GLIB_AVAILABLE_IN_ALL -gchar* g_shell_quote (const gchar *unquoted_string); -GLIB_AVAILABLE_IN_ALL -gchar* g_shell_unquote (const gchar *quoted_string, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_shell_parse_argv (const gchar *command_line, - gint *argcp, - gchar ***argvp, - GError **error); - -G_END_DECLS - -#endif /* __G_SHELL_H__ */ -/* GLIB sliced memory - fast threaded memory chunk allocator - * Copyright (C) 2005 Tim Janik - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#ifndef __G_SLICE_H__ -#define __G_SLICE_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -#include - -G_BEGIN_DECLS - -/* slices - fast allocation/release of small memory blocks - */ -GLIB_AVAILABLE_IN_ALL -gpointer g_slice_alloc (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); -GLIB_AVAILABLE_IN_ALL -gpointer g_slice_alloc0 (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); -GLIB_AVAILABLE_IN_ALL -gpointer g_slice_copy (gsize block_size, - gconstpointer mem_block) G_GNUC_ALLOC_SIZE(1); -GLIB_AVAILABLE_IN_ALL -void g_slice_free1 (gsize block_size, - gpointer mem_block); -GLIB_AVAILABLE_IN_ALL -void g_slice_free_chain_with_offset (gsize block_size, - gpointer mem_chain, - gsize next_offset); -#define g_slice_new(type) ((type*) g_slice_alloc (sizeof (type))) - -/* Allow the compiler to inline memset(). Since the size is a constant, this - * can significantly improve performance. */ -#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) -# define g_slice_new0(type) \ - (type *) (G_GNUC_EXTENSION ({ \ - gsize __s = sizeof (type); \ - gpointer __p; \ - __p = g_slice_alloc (__s); \ - memset (__p, 0, __s); \ - __p; \ - })) -#else -# define g_slice_new0(type) ((type*) g_slice_alloc0 (sizeof (type))) -#endif - -/* MemoryBlockType * - * g_slice_dup (MemoryBlockType, - * MemoryBlockType *mem_block); - * g_slice_free (MemoryBlockType, - * MemoryBlockType *mem_block); - * g_slice_free_chain (MemoryBlockType, - * MemoryBlockType *first_chain_block, - * memory_block_next_field); - * pseudo prototypes for the macro - * definitions following below. - */ - -/* we go through extra hoops to ensure type safety */ -#define g_slice_dup(type, mem) \ - (1 ? (type*) g_slice_copy (sizeof (type), (mem)) \ - : ((void) ((type*) 0 == (mem)), (type*) 0)) -#define g_slice_free(type, mem) \ -G_STMT_START { \ - if (1) g_slice_free1 (sizeof (type), (mem)); \ - else (void) ((type*) 0 == (mem)); \ -} G_STMT_END -#define g_slice_free_chain(type, mem_chain, next) \ -G_STMT_START { \ - if (1) g_slice_free_chain_with_offset (sizeof (type), \ - (mem_chain), G_STRUCT_OFFSET (type, next)); \ - else (void) ((type*) 0 == (mem_chain)); \ -} G_STMT_END - -/* --- internal debugging API --- */ -typedef enum { - G_SLICE_CONFIG_ALWAYS_MALLOC = 1, - G_SLICE_CONFIG_BYPASS_MAGAZINES, - G_SLICE_CONFIG_WORKING_SET_MSECS, - G_SLICE_CONFIG_COLOR_INCREMENT, - G_SLICE_CONFIG_CHUNK_SIZES, - G_SLICE_CONFIG_CONTENTION_COUNTER -} GSliceConfig; - -GLIB_DEPRECATED_IN_2_34 -void g_slice_set_config (GSliceConfig ckey, gint64 value); -GLIB_DEPRECATED_IN_2_34 -gint64 g_slice_get_config (GSliceConfig ckey); -GLIB_DEPRECATED_IN_2_34 -gint64* g_slice_get_config_state (GSliceConfig ckey, gint64 address, guint *n_values); - -#ifdef G_ENABLE_DEBUG -GLIB_AVAILABLE_IN_ALL -void g_slice_debug_tree_statistics (void); -#endif - -G_END_DECLS - -#endif /* __G_SLICE_H__ */ -/* gspawn.h - Process launching - * - * Copyright 2000 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#ifndef __G_SPAWN_H__ -#define __G_SPAWN_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - - -/* I'm not sure I remember our proposed naming convention here. */ -/** - * G_SPAWN_ERROR: - * - * Error domain for spawning processes. Errors in this domain will - * be from the #GSpawnError enumeration. See #GError for information on - * error domains. - */ -#define G_SPAWN_ERROR g_spawn_error_quark () - -/** - * GSpawnError: - * @G_SPAWN_ERROR_FORK: Fork failed due to lack of memory. - * @G_SPAWN_ERROR_READ: Read or select on pipes failed. - * @G_SPAWN_ERROR_CHDIR: Changing to working directory failed. - * @G_SPAWN_ERROR_ACCES: execv() returned `EACCES` - * @G_SPAWN_ERROR_PERM: execv() returned `EPERM` - * @G_SPAWN_ERROR_TOO_BIG: execv() returned `E2BIG` - * @G_SPAWN_ERROR_2BIG: deprecated alias for %G_SPAWN_ERROR_TOO_BIG (deprecated since GLib 2.32) - * @G_SPAWN_ERROR_NOEXEC: execv() returned `ENOEXEC` - * @G_SPAWN_ERROR_NAMETOOLONG: execv() returned `ENAMETOOLONG` - * @G_SPAWN_ERROR_NOENT: execv() returned `ENOENT` - * @G_SPAWN_ERROR_NOMEM: execv() returned `ENOMEM` - * @G_SPAWN_ERROR_NOTDIR: execv() returned `ENOTDIR` - * @G_SPAWN_ERROR_LOOP: execv() returned `ELOOP` - * @G_SPAWN_ERROR_TXTBUSY: execv() returned `ETXTBUSY` - * @G_SPAWN_ERROR_IO: execv() returned `EIO` - * @G_SPAWN_ERROR_NFILE: execv() returned `ENFILE` - * @G_SPAWN_ERROR_MFILE: execv() returned `EMFILE` - * @G_SPAWN_ERROR_INVAL: execv() returned `EINVAL` - * @G_SPAWN_ERROR_ISDIR: execv() returned `EISDIR` - * @G_SPAWN_ERROR_LIBBAD: execv() returned `ELIBBAD` - * @G_SPAWN_ERROR_FAILED: Some other fatal failure, - * `error->message` should explain. - * - * Error codes returned by spawning processes. - */ -typedef enum -{ - G_SPAWN_ERROR_FORK, /* fork failed due to lack of memory */ - G_SPAWN_ERROR_READ, /* read or select on pipes failed */ - G_SPAWN_ERROR_CHDIR, /* changing to working dir failed */ - G_SPAWN_ERROR_ACCES, /* execv() returned EACCES */ - G_SPAWN_ERROR_PERM, /* execv() returned EPERM */ - G_SPAWN_ERROR_TOO_BIG,/* execv() returned E2BIG */ - G_SPAWN_ERROR_2BIG GLIB_DEPRECATED_ENUMERATOR_IN_2_32_FOR(G_SPAWN_ERROR_TOO_BIG) = G_SPAWN_ERROR_TOO_BIG, - G_SPAWN_ERROR_NOEXEC, /* execv() returned ENOEXEC */ - G_SPAWN_ERROR_NAMETOOLONG, /* "" "" ENAMETOOLONG */ - G_SPAWN_ERROR_NOENT, /* "" "" ENOENT */ - G_SPAWN_ERROR_NOMEM, /* "" "" ENOMEM */ - G_SPAWN_ERROR_NOTDIR, /* "" "" ENOTDIR */ - G_SPAWN_ERROR_LOOP, /* "" "" ELOOP */ - G_SPAWN_ERROR_TXTBUSY, /* "" "" ETXTBUSY */ - G_SPAWN_ERROR_IO, /* "" "" EIO */ - G_SPAWN_ERROR_NFILE, /* "" "" ENFILE */ - G_SPAWN_ERROR_MFILE, /* "" "" EMFLE */ - G_SPAWN_ERROR_INVAL, /* "" "" EINVAL */ - G_SPAWN_ERROR_ISDIR, /* "" "" EISDIR */ - G_SPAWN_ERROR_LIBBAD, /* "" "" ELIBBAD */ - G_SPAWN_ERROR_FAILED /* other fatal failure, error->message - * should explain - */ -} GSpawnError; - -/** - * G_SPAWN_EXIT_ERROR: - * - * Error domain used by g_spawn_check_exit_status(). The code - * will be the program exit code. - */ -#define G_SPAWN_EXIT_ERROR g_spawn_exit_error_quark () - -/** - * GSpawnChildSetupFunc: - * @user_data: (closure): user data to pass to the function. - * - * Specifies the type of the setup function passed to g_spawn_async(), - * g_spawn_sync() and g_spawn_async_with_pipes(), which can, in very - * limited ways, be used to affect the child's execution. - * - * On POSIX platforms, the function is called in the child after GLib - * has performed all the setup it plans to perform, but before calling - * exec(). Actions taken in this function will only affect the child, - * not the parent. - * - * On Windows, the function is called in the parent. Its usefulness on - * Windows is thus questionable. In many cases executing the child setup - * function in the parent can have ill effects, and you should be very - * careful when porting software to Windows that uses child setup - * functions. - * - * However, even on POSIX, you are extremely limited in what you can - * safely do from a #GSpawnChildSetupFunc, because any mutexes that were - * held by other threads in the parent process at the time of the fork() - * will still be locked in the child process, and they will never be - * unlocked (since the threads that held them don't exist in the child). - * POSIX allows only async-signal-safe functions (see signal(7)) to be - * called in the child between fork() and exec(), which drastically limits - * the usefulness of child setup functions. - * - * In particular, it is not safe to call any function which may - * call malloc(), which includes POSIX functions such as setenv(). - * If you need to set up the child environment differently from - * the parent, you should use g_get_environ(), g_environ_setenv(), - * and g_environ_unsetenv(), and then pass the complete environment - * list to the `g_spawn...` function. - */ -typedef void (* GSpawnChildSetupFunc) (gpointer user_data); - -/** - * GSpawnFlags: - * @G_SPAWN_DEFAULT: no flags, default behaviour - * @G_SPAWN_LEAVE_DESCRIPTORS_OPEN: the parent's open file descriptors will - * be inherited by the child; otherwise all descriptors except stdin, - * stdout and stderr will be closed before calling exec() in the child. - * @G_SPAWN_DO_NOT_REAP_CHILD: the child will not be automatically reaped; - * you must use g_child_watch_add() yourself (or call waitpid() or handle - * `SIGCHLD` yourself), or the child will become a zombie. - * @G_SPAWN_SEARCH_PATH: `argv[0]` need not be an absolute path, it will be - * looked for in the user's `PATH`. - * @G_SPAWN_STDOUT_TO_DEV_NULL: the child's standard output will be discarded, - * instead of going to the same location as the parent's standard output. - * @G_SPAWN_STDERR_TO_DEV_NULL: the child's standard error will be discarded. - * @G_SPAWN_CHILD_INHERITS_STDIN: the child will inherit the parent's standard - * input (by default, the child's standard input is attached to `/dev/null`). - * @G_SPAWN_FILE_AND_ARGV_ZERO: the first element of `argv` is the file to - * execute, while the remaining elements are the actual argument vector - * to pass to the file. Normally g_spawn_async_with_pipes() uses `argv[0]` - * as the file to execute, and passes all of `argv` to the child. - * @G_SPAWN_SEARCH_PATH_FROM_ENVP: if `argv[0]` is not an absolute path, - * it will be looked for in the `PATH` from the passed child environment. - * Since: 2.34 - * @G_SPAWN_CLOEXEC_PIPES: create all pipes with the `O_CLOEXEC` flag set. - * Since: 2.40 - * - * Flags passed to g_spawn_sync(), g_spawn_async() and g_spawn_async_with_pipes(). - */ -typedef enum -{ - G_SPAWN_DEFAULT = 0, - G_SPAWN_LEAVE_DESCRIPTORS_OPEN = 1 << 0, - G_SPAWN_DO_NOT_REAP_CHILD = 1 << 1, - /* look for argv[0] in the path i.e. use execvp() */ - G_SPAWN_SEARCH_PATH = 1 << 2, - /* Dump output to /dev/null */ - G_SPAWN_STDOUT_TO_DEV_NULL = 1 << 3, - G_SPAWN_STDERR_TO_DEV_NULL = 1 << 4, - G_SPAWN_CHILD_INHERITS_STDIN = 1 << 5, - G_SPAWN_FILE_AND_ARGV_ZERO = 1 << 6, - G_SPAWN_SEARCH_PATH_FROM_ENVP = 1 << 7, - G_SPAWN_CLOEXEC_PIPES = 1 << 8 -} GSpawnFlags; - -GLIB_AVAILABLE_IN_ALL -GQuark g_spawn_error_quark (void); -GLIB_AVAILABLE_IN_ALL -GQuark g_spawn_exit_error_quark (void); - -GLIB_AVAILABLE_IN_ALL -gboolean g_spawn_async (const gchar *working_directory, - gchar **argv, - gchar **envp, - GSpawnFlags flags, - GSpawnChildSetupFunc child_setup, - gpointer user_data, - GPid *child_pid, - GError **error); - - -/* Opens pipes for non-NULL standard_output, standard_input, standard_error, - * and returns the parent's end of the pipes. - */ -GLIB_AVAILABLE_IN_ALL -gboolean g_spawn_async_with_pipes (const gchar *working_directory, - gchar **argv, - gchar **envp, - GSpawnFlags flags, - GSpawnChildSetupFunc child_setup, - gpointer user_data, - GPid *child_pid, - gint *standard_input, - gint *standard_output, - gint *standard_error, - GError **error); - -/* Lets you provide fds for stdin/stdout/stderr */ -GLIB_AVAILABLE_IN_2_58 -gboolean g_spawn_async_with_fds (const gchar *working_directory, - gchar **argv, - gchar **envp, - GSpawnFlags flags, - GSpawnChildSetupFunc child_setup, - gpointer user_data, - GPid *child_pid, - gint stdin_fd, - gint stdout_fd, - gint stderr_fd, - GError **error); - -/* If standard_output or standard_error are non-NULL, the full - * standard output or error of the command will be placed there. - */ - -GLIB_AVAILABLE_IN_ALL -gboolean g_spawn_sync (const gchar *working_directory, - gchar **argv, - gchar **envp, - GSpawnFlags flags, - GSpawnChildSetupFunc child_setup, - gpointer user_data, - gchar **standard_output, - gchar **standard_error, - gint *exit_status, - GError **error); - -GLIB_AVAILABLE_IN_ALL -gboolean g_spawn_command_line_sync (const gchar *command_line, - gchar **standard_output, - gchar **standard_error, - gint *exit_status, - GError **error); -GLIB_AVAILABLE_IN_ALL -gboolean g_spawn_command_line_async (const gchar *command_line, - GError **error); - -GLIB_AVAILABLE_IN_2_34 -gboolean g_spawn_check_exit_status (gint exit_status, - GError **error); - -GLIB_AVAILABLE_IN_ALL -void g_spawn_close_pid (GPid pid); - -G_END_DECLS - -#endif /* __G_SPAWN_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_STRFUNCS_H__ -#define __G_STRFUNCS_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -#include - -G_BEGIN_DECLS - -/* Functions like the ones in that are not affected by locale. */ -typedef enum { - G_ASCII_ALNUM = 1 << 0, - G_ASCII_ALPHA = 1 << 1, - G_ASCII_CNTRL = 1 << 2, - G_ASCII_DIGIT = 1 << 3, - G_ASCII_GRAPH = 1 << 4, - G_ASCII_LOWER = 1 << 5, - G_ASCII_PRINT = 1 << 6, - G_ASCII_PUNCT = 1 << 7, - G_ASCII_SPACE = 1 << 8, - G_ASCII_UPPER = 1 << 9, - G_ASCII_XDIGIT = 1 << 10 -} GAsciiType; - -GLIB_VAR const guint16 * const g_ascii_table; - -#define g_ascii_isalnum(c) \ - ((g_ascii_table[(guchar) (c)] & G_ASCII_ALNUM) != 0) - -#define g_ascii_isalpha(c) \ - ((g_ascii_table[(guchar) (c)] & G_ASCII_ALPHA) != 0) - -#define g_ascii_iscntrl(c) \ - ((g_ascii_table[(guchar) (c)] & G_ASCII_CNTRL) != 0) - -#define g_ascii_isdigit(c) \ - ((g_ascii_table[(guchar) (c)] & G_ASCII_DIGIT) != 0) - -#define g_ascii_isgraph(c) \ - ((g_ascii_table[(guchar) (c)] & G_ASCII_GRAPH) != 0) - -#define g_ascii_islower(c) \ - ((g_ascii_table[(guchar) (c)] & G_ASCII_LOWER) != 0) - -#define g_ascii_isprint(c) \ - ((g_ascii_table[(guchar) (c)] & G_ASCII_PRINT) != 0) - -#define g_ascii_ispunct(c) \ - ((g_ascii_table[(guchar) (c)] & G_ASCII_PUNCT) != 0) - -#define g_ascii_isspace(c) \ - ((g_ascii_table[(guchar) (c)] & G_ASCII_SPACE) != 0) - -#define g_ascii_isupper(c) \ - ((g_ascii_table[(guchar) (c)] & G_ASCII_UPPER) != 0) - -#define g_ascii_isxdigit(c) \ - ((g_ascii_table[(guchar) (c)] & G_ASCII_XDIGIT) != 0) - -GLIB_AVAILABLE_IN_ALL -gchar g_ascii_tolower (gchar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gchar g_ascii_toupper (gchar c) G_GNUC_CONST; - -GLIB_AVAILABLE_IN_ALL -gint g_ascii_digit_value (gchar c) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gint g_ascii_xdigit_value (gchar c) G_GNUC_CONST; - -/* String utility functions that modify a string argument or - * return a constant string that must not be freed. - */ -#define G_STR_DELIMITERS "_-|> <." -GLIB_AVAILABLE_IN_ALL -gchar* g_strdelimit (gchar *string, - const gchar *delimiters, - gchar new_delimiter); -GLIB_AVAILABLE_IN_ALL -gchar* g_strcanon (gchar *string, - const gchar *valid_chars, - gchar substitutor); -GLIB_AVAILABLE_IN_ALL -const gchar * g_strerror (gint errnum) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -const gchar * g_strsignal (gint signum) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gchar * g_strreverse (gchar *string); -GLIB_AVAILABLE_IN_ALL -gsize g_strlcpy (gchar *dest, - const gchar *src, - gsize dest_size); -GLIB_AVAILABLE_IN_ALL -gsize g_strlcat (gchar *dest, - const gchar *src, - gsize dest_size); -GLIB_AVAILABLE_IN_ALL -gchar * g_strstr_len (const gchar *haystack, - gssize haystack_len, - const gchar *needle); -GLIB_AVAILABLE_IN_ALL -gchar * g_strrstr (const gchar *haystack, - const gchar *needle); -GLIB_AVAILABLE_IN_ALL -gchar * g_strrstr_len (const gchar *haystack, - gssize haystack_len, - const gchar *needle); - -GLIB_AVAILABLE_IN_ALL -gboolean g_str_has_suffix (const gchar *str, - const gchar *suffix); -GLIB_AVAILABLE_IN_ALL -gboolean g_str_has_prefix (const gchar *str, - const gchar *prefix); - -/* String to/from double conversion functions */ - -GLIB_AVAILABLE_IN_ALL -gdouble g_strtod (const gchar *nptr, - gchar **endptr); -GLIB_AVAILABLE_IN_ALL -gdouble g_ascii_strtod (const gchar *nptr, - gchar **endptr); -GLIB_AVAILABLE_IN_ALL -guint64 g_ascii_strtoull (const gchar *nptr, - gchar **endptr, - guint base); -GLIB_AVAILABLE_IN_ALL -gint64 g_ascii_strtoll (const gchar *nptr, - gchar **endptr, - guint base); -/* 29 bytes should enough for all possible values that - * g_ascii_dtostr can produce. - * Then add 10 for good measure */ -#define G_ASCII_DTOSTR_BUF_SIZE (29 + 10) -GLIB_AVAILABLE_IN_ALL -gchar * g_ascii_dtostr (gchar *buffer, - gint buf_len, - gdouble d); -GLIB_AVAILABLE_IN_ALL -gchar * g_ascii_formatd (gchar *buffer, - gint buf_len, - const gchar *format, - gdouble d); - -/* removes leading spaces */ -GLIB_AVAILABLE_IN_ALL -gchar* g_strchug (gchar *string); -/* removes trailing spaces */ -GLIB_AVAILABLE_IN_ALL -gchar* g_strchomp (gchar *string); -/* removes leading & trailing spaces */ -#define g_strstrip( string ) g_strchomp (g_strchug (string)) - -GLIB_AVAILABLE_IN_ALL -gint g_ascii_strcasecmp (const gchar *s1, - const gchar *s2); -GLIB_AVAILABLE_IN_ALL -gint g_ascii_strncasecmp (const gchar *s1, - const gchar *s2, - gsize n); -GLIB_AVAILABLE_IN_ALL -gchar* g_ascii_strdown (const gchar *str, - gssize len) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar* g_ascii_strup (const gchar *str, - gssize len) G_GNUC_MALLOC; - -GLIB_AVAILABLE_IN_2_40 -gboolean g_str_is_ascii (const gchar *str); - -GLIB_DEPRECATED -gint g_strcasecmp (const gchar *s1, - const gchar *s2); -GLIB_DEPRECATED -gint g_strncasecmp (const gchar *s1, - const gchar *s2, - guint n); -GLIB_DEPRECATED -gchar* g_strdown (gchar *string); -GLIB_DEPRECATED -gchar* g_strup (gchar *string); - - -/* String utility functions that return a newly allocated string which - * ought to be freed with g_free from the caller at some point. - */ -GLIB_AVAILABLE_IN_ALL -gchar* g_strdup (const gchar *str) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar* g_strdup_printf (const gchar *format, - ...) G_GNUC_PRINTF (1, 2) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar* g_strdup_vprintf (const gchar *format, - va_list args) G_GNUC_PRINTF(1, 0) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar* g_strndup (const gchar *str, - gsize n) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar* g_strnfill (gsize length, - gchar fill_char) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -gchar* g_strconcat (const gchar *string1, - ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED; -GLIB_AVAILABLE_IN_ALL -gchar* g_strjoin (const gchar *separator, - ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED; - -/* Make a copy of a string interpreting C string -style escape - * sequences. Inverse of g_strescape. The recognized sequences are \b - * \f \n \r \t \\ \" and the octal format. - */ -GLIB_AVAILABLE_IN_ALL -gchar* g_strcompress (const gchar *source) G_GNUC_MALLOC; - -/* Copy a string escaping nonprintable characters like in C strings. - * Inverse of g_strcompress. The exceptions parameter, if non-NULL, points - * to a string containing characters that are not to be escaped. - * - * Deprecated API: gchar* g_strescape (const gchar *source); - * Luckily this function wasn't used much, using NULL as second parameter - * provides mostly identical semantics. - */ -GLIB_AVAILABLE_IN_ALL -gchar* g_strescape (const gchar *source, - const gchar *exceptions) G_GNUC_MALLOC; - -GLIB_AVAILABLE_IN_ALL -gpointer g_memdup (gconstpointer mem, - guint byte_size) G_GNUC_ALLOC_SIZE(2); - -/* NULL terminated string arrays. - * g_strsplit(), g_strsplit_set() split up string into max_tokens tokens - * at delim and return a newly allocated string array. - * g_strjoinv() concatenates all of str_array's strings, sliding in an - * optional separator, the returned string is newly allocated. - * g_strfreev() frees the array itself and all of its strings. - * g_strdupv() copies a NULL-terminated array of strings - * g_strv_length() returns the length of a NULL-terminated array of strings - */ -typedef gchar** GStrv; -GLIB_AVAILABLE_IN_ALL -gchar** g_strsplit (const gchar *string, - const gchar *delimiter, - gint max_tokens); -GLIB_AVAILABLE_IN_ALL -gchar ** g_strsplit_set (const gchar *string, - const gchar *delimiters, - gint max_tokens); -GLIB_AVAILABLE_IN_ALL -gchar* g_strjoinv (const gchar *separator, - gchar **str_array) G_GNUC_MALLOC; -GLIB_AVAILABLE_IN_ALL -void g_strfreev (gchar **str_array); -GLIB_AVAILABLE_IN_ALL -gchar** g_strdupv (gchar **str_array); -GLIB_AVAILABLE_IN_ALL -guint g_strv_length (gchar **str_array); - -GLIB_AVAILABLE_IN_ALL -gchar* g_stpcpy (gchar *dest, - const char *src); - -GLIB_AVAILABLE_IN_2_40 -gchar * g_str_to_ascii (const gchar *str, - const gchar *from_locale); - -GLIB_AVAILABLE_IN_2_40 -gchar ** g_str_tokenize_and_fold (const gchar *string, - const gchar *translit_locale, - gchar ***ascii_alternates); - -GLIB_AVAILABLE_IN_2_40 -gboolean g_str_match_string (const gchar *search_term, - const gchar *potential_hit, - gboolean accept_alternates); - -GLIB_AVAILABLE_IN_2_44 -gboolean g_strv_contains (const gchar * const *strv, - const gchar *str); - -GLIB_AVAILABLE_IN_2_60 -gboolean g_strv_equal (const gchar * const *strv1, - const gchar * const *strv2); - -/* Convenience ASCII string to number API */ - -/** - * GNumberParserError: - * @G_NUMBER_PARSER_ERROR_INVALID: String was not a valid number. - * @G_NUMBER_PARSER_ERROR_OUT_OF_BOUNDS: String was a number, but out of bounds. - * - * Error codes returned by functions converting a string to a number. - * - * Since: 2.54 - */ -typedef enum - { - G_NUMBER_PARSER_ERROR_INVALID, - G_NUMBER_PARSER_ERROR_OUT_OF_BOUNDS, - } GNumberParserError; - -/** - * G_NUMBER_PARSER_ERROR: - * - * Domain for errors returned by functions converting a string to a - * number. - * - * Since: 2.54 - */ -#define G_NUMBER_PARSER_ERROR (g_number_parser_error_quark ()) - -GLIB_AVAILABLE_IN_2_54 -GQuark g_number_parser_error_quark (void); - -GLIB_AVAILABLE_IN_2_54 -gboolean g_ascii_string_to_signed (const gchar *str, - guint base, - gint64 min, - gint64 max, - gint64 *out_num, - GError **error); - -GLIB_AVAILABLE_IN_2_54 -gboolean g_ascii_string_to_unsigned (const gchar *str, - guint base, - guint64 min, - guint64 max, - guint64 *out_num, - GError **error); - -G_END_DECLS - -#endif /* __G_STRFUNCS_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_STRINGCHUNK_H__ -#define __G_STRINGCHUNK_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GStringChunk GStringChunk; - -GLIB_AVAILABLE_IN_ALL -GStringChunk* g_string_chunk_new (gsize size); -GLIB_AVAILABLE_IN_ALL -void g_string_chunk_free (GStringChunk *chunk); -GLIB_AVAILABLE_IN_ALL -void g_string_chunk_clear (GStringChunk *chunk); -GLIB_AVAILABLE_IN_ALL -gchar* g_string_chunk_insert (GStringChunk *chunk, - const gchar *string); -GLIB_AVAILABLE_IN_ALL -gchar* g_string_chunk_insert_len (GStringChunk *chunk, - const gchar *string, - gssize len); -GLIB_AVAILABLE_IN_ALL -gchar* g_string_chunk_insert_const (GStringChunk *chunk, - const gchar *string); - -G_END_DECLS - -#endif /* __G_STRING_H__ */ -/* - * Copyright © 2020 Canonical Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#ifndef __G_STRVBUILDER_H__ -#define __G_STRVBUILDER_H__ - -#if !defined(__GLIB_H_INSIDE__) && !defined(GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/** - * GStrvBuilder: - * - * A helper object to build a %NULL-terminated string array - * by appending. See g_strv_builder_new(). - * - * Since: 2.68 - */ -typedef struct _GStrvBuilder GStrvBuilder; - -GLIB_AVAILABLE_IN_2_68 -GStrvBuilder *g_strv_builder_new (void); - -GLIB_AVAILABLE_IN_2_68 -void g_strv_builder_unref (GStrvBuilder *builder); - -GLIB_AVAILABLE_IN_2_68 -GStrvBuilder *g_strv_builder_ref (GStrvBuilder *builder); - -GLIB_AVAILABLE_IN_2_68 -void g_strv_builder_add (GStrvBuilder *builder, - const char *value); - -GLIB_AVAILABLE_IN_2_68 -GStrv g_strv_builder_end (GStrvBuilder *builder); - -G_END_DECLS - -#endif /* __G_STRVBUILDER_H__ */ -/* GLib testing utilities - * Copyright (C) 2007 Imendio AB - * Authors: Tim Janik - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#ifndef __G_TEST_UTILS_H__ -#define __G_TEST_UTILS_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -#include -#include - -G_BEGIN_DECLS - -typedef struct GTestCase GTestCase; -typedef struct GTestSuite GTestSuite; -typedef void (*GTestFunc) (void); -typedef void (*GTestDataFunc) (gconstpointer user_data); -typedef void (*GTestFixtureFunc) (gpointer fixture, - gconstpointer user_data); - -/* assertion API */ -#define g_assert_cmpstr(s1, cmp, s2) G_STMT_START { \ - const char *__s1 = (s1), *__s2 = (s2); \ - if (g_strcmp0 (__s1, __s2) cmp 0) ; else \ - g_assertion_message_cmpstr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #s1 " " #cmp " " #s2, __s1, #cmp, __s2); \ - } G_STMT_END -#define g_assert_cmpint(n1, cmp, n2) G_STMT_START { \ - gint64 __n1 = (n1), __n2 = (n2); \ - if (__n1 cmp __n2) ; else \ - g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #n1 " " #cmp " " #n2, (long double) __n1, #cmp, (long double) __n2, 'i'); \ - } G_STMT_END -#define g_assert_cmpuint(n1, cmp, n2) G_STMT_START { \ - guint64 __n1 = (n1), __n2 = (n2); \ - if (__n1 cmp __n2) ; else \ - g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #n1 " " #cmp " " #n2, (long double) __n1, #cmp, (long double) __n2, 'i'); \ - } G_STMT_END -#define g_assert_cmphex(n1, cmp, n2) G_STMT_START {\ - guint64 __n1 = (n1), __n2 = (n2); \ - if (__n1 cmp __n2) ; else \ - g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #n1 " " #cmp " " #n2, (long double) __n1, #cmp, (long double) __n2, 'x'); \ - } G_STMT_END -#define g_assert_cmpfloat(n1,cmp,n2) G_STMT_START { \ - long double __n1 = (long double) (n1), __n2 = (long double) (n2); \ - if (__n1 cmp __n2) ; else \ - g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #n1 " " #cmp " " #n2, (long double) __n1, #cmp, (long double) __n2, 'f'); \ - } G_STMT_END -#define g_assert_cmpfloat_with_epsilon(n1,n2,epsilon) \ - G_STMT_START { \ - double __n1 = (n1), __n2 = (n2), __epsilon = (epsilon); \ - if (G_APPROX_VALUE (__n1, __n2, __epsilon)) ; else \ - g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #n1 " == " #n2 " (+/- " #epsilon ")", __n1, "==", __n2, 'f'); \ - } G_STMT_END -#define g_assert_cmpmem(m1, l1, m2, l2) G_STMT_START {\ - gconstpointer __m1 = m1, __m2 = m2; \ - int __l1 = l1, __l2 = l2; \ - if (__l1 != 0 && __m1 == NULL) \ - g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "assertion failed (" #l1 " == 0 || " #m1 " != NULL)"); \ - else if (__l2 != 0 && __m2 == NULL) \ - g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "assertion failed (" #l2 " == 0 || " #m2 " != NULL)"); \ - else if (__l1 != __l2) \ - g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #l1 " (len(" #m1 ")) == " #l2 " (len(" #m2 "))", \ - (long double) __l1, "==", (long double) __l2, 'i'); \ - else if (__l1 != 0 && __m2 != NULL && memcmp (__m1, __m2, __l1) != 0) \ - g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "assertion failed (" #m1 " == " #m2 ")"); \ - } G_STMT_END -#define g_assert_cmpvariant(v1, v2) \ - G_STMT_START \ - { \ - GVariant *__v1 = (v1), *__v2 = (v2); \ - if (!g_variant_equal (__v1, __v2)) \ - { \ - gchar *__s1, *__s2, *__msg; \ - __s1 = g_variant_print (__v1, TRUE); \ - __s2 = g_variant_print (__v2, TRUE); \ - __msg = g_strdup_printf ("assertion failed (" #v1 " == " #v2 "): %s does not equal %s", __s1, __s2); \ - g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \ - g_free (__s1); \ - g_free (__s2); \ - g_free (__msg); \ - } \ - } \ - G_STMT_END -#define g_assert_cmpstrv(strv1, strv2) \ - G_STMT_START \ - { \ - const char * const *__strv1 = (const char * const *) (strv1); \ - const char * const *__strv2 = (const char * const *) (strv2); \ - if (!__strv1 || !__strv2) \ - { \ - if (__strv1) \ - { \ - g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "assertion failed (" #strv1 " == " #strv2 "): " #strv2 " is NULL, but " #strv1 " is not"); \ - } \ - else if (__strv2) \ - { \ - g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "assertion failed (" #strv1 " == " #strv2 "): " #strv1 " is NULL, but " #strv2 " is not"); \ - } \ - } \ - else \ - { \ - guint __l1 = g_strv_length ((char **) __strv1); \ - guint __l2 = g_strv_length ((char **) __strv2); \ - if (__l1 != __l2) \ - { \ - char *__msg; \ - __msg = g_strdup_printf ("assertion failed (" #strv1 " == " #strv2 "): length %u does not equal length %u", __l1, __l2); \ - g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \ - g_free (__msg); \ - } \ - else \ - { \ - guint __i; \ - for (__i = 0; __i < __l1; __i++) \ - { \ - if (g_strcmp0 (__strv1[__i], __strv2[__i]) != 0) \ - { \ - g_assertion_message_cmpstrv (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #strv1 " == " #strv2, \ - __strv1, __strv2, __i); \ - } \ - } \ - } \ - } \ - } \ - G_STMT_END -#define g_assert_no_errno(expr) G_STMT_START { \ - int __ret, __errsv; \ - errno = 0; \ - __ret = expr; \ - __errsv = errno; \ - if (__ret < 0) \ - { \ - gchar *__msg; \ - __msg = g_strdup_printf ("assertion failed (" #expr " >= 0): errno %i: %s", __errsv, g_strerror (__errsv)); \ - g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \ - g_free (__msg); \ - } \ - } G_STMT_END \ - GLIB_AVAILABLE_MACRO_IN_2_66 -#define g_assert_no_error(err) G_STMT_START { \ - if (err) \ - g_assertion_message_error (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #err, err, 0, 0); \ - } G_STMT_END -#define g_assert_error(err, dom, c) G_STMT_START { \ - if (!err || (err)->domain != dom || (err)->code != c) \ - g_assertion_message_error (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #err, err, dom, c); \ - } G_STMT_END -#define g_assert_true(expr) G_STMT_START { \ - if G_LIKELY (expr) ; else \ - g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "'" #expr "' should be TRUE"); \ - } G_STMT_END -#define g_assert_false(expr) G_STMT_START { \ - if G_LIKELY (!(expr)) ; else \ - g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "'" #expr "' should be FALSE"); \ - } G_STMT_END - -/* Use nullptr in C++ to catch misuse of these macros. */ -#if defined(__cplusplus) && __cplusplus >= 201100L -#define g_assert_null(expr) G_STMT_START { if G_LIKELY ((expr) == nullptr) ; else \ - g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "'" #expr "' should be nullptr"); \ - } G_STMT_END -#define g_assert_nonnull(expr) G_STMT_START { \ - if G_LIKELY ((expr) != nullptr) ; else \ - g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "'" #expr "' should not be nullptr"); \ - } G_STMT_END -#else /* not C++ */ -#define g_assert_null(expr) G_STMT_START { if G_LIKELY ((expr) == NULL) ; else \ - g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "'" #expr "' should be NULL"); \ - } G_STMT_END -#define g_assert_nonnull(expr) G_STMT_START { \ - if G_LIKELY ((expr) != NULL) ; else \ - g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "'" #expr "' should not be NULL"); \ - } G_STMT_END -#endif - -#ifdef G_DISABLE_ASSERT -/* https://gcc.gnu.org/onlinedocs/gcc-8.3.0/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005funreachable - * GCC 5 is not a strict lower bound for versions of GCC which provide __builtin_unreachable(). */ -#if __GNUC__ >= 5 || g_macro__has_builtin(__builtin_unreachable) -#define g_assert_not_reached() G_STMT_START { (void) 0; __builtin_unreachable (); } G_STMT_END -#elif defined (_MSC_VER) -#define g_assert_not_reached() G_STMT_START { (void) 0; __assume (0); } G_STMT_END -#else /* if __builtin_unreachable() is not supported: */ -#define g_assert_not_reached() G_STMT_START { (void) 0; } G_STMT_END -#endif - -#define g_assert(expr) G_STMT_START { (void) 0; } G_STMT_END -#else /* !G_DISABLE_ASSERT */ -#define g_assert_not_reached() G_STMT_START { g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); } G_STMT_END -#define g_assert(expr) G_STMT_START { \ - if G_LIKELY (expr) ; else \ - g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #expr); \ - } G_STMT_END -#endif /* !G_DISABLE_ASSERT */ - -typedef void (*GAssertionFunc) (const char *domain, - const char *file, - int line, - const char *func, - const char *message, - gpointer user_data); - -GLIB_AVAILABLE_IN_2_68 -void g_assertion_set_handler (GAssertionFunc handler, - gpointer user_data); - -GLIB_AVAILABLE_IN_ALL -int g_strcmp0 (const char *str1, - const char *str2); - -/* report performance results */ -GLIB_AVAILABLE_IN_ALL -void g_test_minimized_result (double minimized_quantity, - const char *format, - ...) G_GNUC_PRINTF (2, 3); -GLIB_AVAILABLE_IN_ALL -void g_test_maximized_result (double maximized_quantity, - const char *format, - ...) G_GNUC_PRINTF (2, 3); - -/* initialize testing framework */ -GLIB_AVAILABLE_IN_ALL -void g_test_init (int *argc, - char ***argv, - ...) G_GNUC_NULL_TERMINATED; - -/** - * G_TEST_OPTION_ISOLATE_DIRS: - * - * Creates a unique temporary directory for each unit test and uses - * g_set_user_dirs() to set XDG directories to point into subdirectories of it - * for the duration of the unit test. The directory tree is cleaned up after the - * test finishes successfully. Note that this doesn’t take effect until - * g_test_run() is called, so calls to (for example) g_get_user_home_dir() will - * return the system-wide value when made in a test program’s main() function. - * - * The following functions will return subdirectories of the temporary directory - * when this option is used. The specific subdirectory paths in use are not - * guaranteed to be stable API — always use a getter function to retrieve them. - * - * - g_get_home_dir() - * - g_get_user_cache_dir() - * - g_get_system_config_dirs() - * - g_get_user_config_dir() - * - g_get_system_data_dirs() - * - g_get_user_data_dir() - * - g_get_user_runtime_dir() - * - * The subdirectories may not be created by the test harness; as with normal - * calls to functions like g_get_user_cache_dir(), the caller must be prepared - * to create the directory if it doesn’t exist. - * - * Since: 2.60 - */ -#define G_TEST_OPTION_ISOLATE_DIRS "isolate_dirs" - -/* While we discourage its use, g_assert() is often used in unit tests - * (especially in legacy code). g_assert_*() should really be used instead. - * g_assert() can be disabled at client program compile time, which can render - * tests useless. Highlight that to the user. */ -#ifdef G_DISABLE_ASSERT -#if defined(G_HAVE_ISO_VARARGS) -#undef g_test_init -#define g_test_init(argc, argv, ...) \ - G_STMT_START { \ - g_printerr ("Tests were compiled with G_DISABLE_ASSERT and are likely no-ops. Aborting.\n"); \ - exit (1); \ - } G_STMT_END -#elif defined(G_HAVE_GNUC_VARARGS) -#undef g_test_init -#define g_test_init(argc, argv...) \ - G_STMT_START { \ - g_printerr ("Tests were compiled with G_DISABLE_ASSERT and are likely no-ops. Aborting.\n"); \ - exit (1); \ - } G_STMT_END -#else /* no varargs */ - /* do nothing */ -#endif /* varargs support */ -#endif /* G_DISABLE_ASSERT */ - -/* query testing framework config */ -#define g_test_initialized() (g_test_config_vars->test_initialized) -#define g_test_quick() (g_test_config_vars->test_quick) -#define g_test_slow() (!g_test_config_vars->test_quick) -#define g_test_thorough() (!g_test_config_vars->test_quick) -#define g_test_perf() (g_test_config_vars->test_perf) -#define g_test_verbose() (g_test_config_vars->test_verbose) -#define g_test_quiet() (g_test_config_vars->test_quiet) -#define g_test_undefined() (g_test_config_vars->test_undefined) -GLIB_AVAILABLE_IN_2_38 -gboolean g_test_subprocess (void); - -/* run all tests under toplevel suite (path: /) */ -GLIB_AVAILABLE_IN_ALL -int g_test_run (void); -/* hook up a test functions under test path */ -GLIB_AVAILABLE_IN_ALL -void g_test_add_func (const char *testpath, - GTestFunc test_func); - -GLIB_AVAILABLE_IN_ALL -void g_test_add_data_func (const char *testpath, - gconstpointer test_data, - GTestDataFunc test_func); - -GLIB_AVAILABLE_IN_2_34 -void g_test_add_data_func_full (const char *testpath, - gpointer test_data, - GTestDataFunc test_func, - GDestroyNotify data_free_func); - -/* tell about failure */ -GLIB_AVAILABLE_IN_2_30 -void g_test_fail (void); -GLIB_AVAILABLE_IN_2_38 -void g_test_incomplete (const gchar *msg); -GLIB_AVAILABLE_IN_2_38 -void g_test_skip (const gchar *msg); -GLIB_AVAILABLE_IN_2_38 -gboolean g_test_failed (void); -GLIB_AVAILABLE_IN_2_38 -void g_test_set_nonfatal_assertions (void); - -/** - * g_test_add: - * @testpath: The test path for a new test case. - * @Fixture: The type of a fixture data structure. - * @tdata: Data argument for the test functions. - * @fsetup: The function to set up the fixture data. - * @ftest: The actual test function. - * @fteardown: The function to tear down the fixture data. - * - * Hook up a new test case at @testpath, similar to g_test_add_func(). - * A fixture data structure with setup and teardown functions may be provided, - * similar to g_test_create_case(). - * - * g_test_add() is implemented as a macro, so that the fsetup(), ftest() and - * fteardown() callbacks can expect a @Fixture pointer as their first argument - * in a type safe manner. They otherwise have type #GTestFixtureFunc. - * - * Since: 2.16 - */ -#define g_test_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \ - G_STMT_START { \ - void (*add_vtable) (const char*, \ - gsize, \ - gconstpointer, \ - void (*) (Fixture*, gconstpointer), \ - void (*) (Fixture*, gconstpointer), \ - void (*) (Fixture*, gconstpointer)) = (void (*) (const gchar *, gsize, gconstpointer, void (*) (Fixture*, gconstpointer), void (*) (Fixture*, gconstpointer), void (*) (Fixture*, gconstpointer))) g_test_add_vtable; \ - add_vtable \ - (testpath, sizeof (Fixture), tdata, fsetup, ftest, fteardown); \ - } G_STMT_END - -/* add test messages to the test report */ -GLIB_AVAILABLE_IN_ALL -void g_test_message (const char *format, - ...) G_GNUC_PRINTF (1, 2); -GLIB_AVAILABLE_IN_ALL -void g_test_bug_base (const char *uri_pattern); -GLIB_AVAILABLE_IN_ALL -void g_test_bug (const char *bug_uri_snippet); -GLIB_AVAILABLE_IN_2_62 -void g_test_summary (const char *summary); -/* measure test timings */ -GLIB_AVAILABLE_IN_ALL -void g_test_timer_start (void); -GLIB_AVAILABLE_IN_ALL -double g_test_timer_elapsed (void); /* elapsed seconds */ -GLIB_AVAILABLE_IN_ALL -double g_test_timer_last (void); /* repeat last elapsed() result */ - -/* automatically g_free or g_object_unref upon teardown */ -GLIB_AVAILABLE_IN_ALL -void g_test_queue_free (gpointer gfree_pointer); -GLIB_AVAILABLE_IN_ALL -void g_test_queue_destroy (GDestroyNotify destroy_func, - gpointer destroy_data); -#define g_test_queue_unref(gobject) g_test_queue_destroy (g_object_unref, gobject) - -/** - * GTestTrapFlags: - * @G_TEST_TRAP_SILENCE_STDOUT: Redirect stdout of the test child to - * `/dev/null` so it cannot be observed on the console during test - * runs. The actual output is still captured though to allow later - * tests with g_test_trap_assert_stdout(). - * @G_TEST_TRAP_SILENCE_STDERR: Redirect stderr of the test child to - * `/dev/null` so it cannot be observed on the console during test - * runs. The actual output is still captured though to allow later - * tests with g_test_trap_assert_stderr(). - * @G_TEST_TRAP_INHERIT_STDIN: If this flag is given, stdin of the - * child process is shared with stdin of its parent process. - * It is redirected to `/dev/null` otherwise. - * - * Test traps are guards around forked tests. - * These flags determine what traps to set. - * - * Deprecated: 2.38: #GTestTrapFlags is used only with g_test_trap_fork(), - * which is deprecated. g_test_trap_subprocess() uses - * #GTestSubprocessFlags. - */ -typedef enum { - G_TEST_TRAP_SILENCE_STDOUT = 1 << 7, - G_TEST_TRAP_SILENCE_STDERR = 1 << 8, - G_TEST_TRAP_INHERIT_STDIN = 1 << 9 -} GTestTrapFlags GLIB_DEPRECATED_TYPE_IN_2_38_FOR(GTestSubprocessFlags); - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -GLIB_DEPRECATED_IN_2_38_FOR (g_test_trap_subprocess) -gboolean g_test_trap_fork (guint64 usec_timeout, - GTestTrapFlags test_trap_flags); - -G_GNUC_END_IGNORE_DEPRECATIONS - -typedef enum { - G_TEST_SUBPROCESS_INHERIT_STDIN = 1 << 0, - G_TEST_SUBPROCESS_INHERIT_STDOUT = 1 << 1, - G_TEST_SUBPROCESS_INHERIT_STDERR = 1 << 2 -} GTestSubprocessFlags; - -GLIB_AVAILABLE_IN_2_38 -void g_test_trap_subprocess (const char *test_path, - guint64 usec_timeout, - GTestSubprocessFlags test_flags); - -GLIB_AVAILABLE_IN_ALL -gboolean g_test_trap_has_passed (void); -GLIB_AVAILABLE_IN_ALL -gboolean g_test_trap_reached_timeout (void); -#define g_test_trap_assert_passed() g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 0, 0) -#define g_test_trap_assert_failed() g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 1, 0) -#define g_test_trap_assert_stdout(soutpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 2, soutpattern) -#define g_test_trap_assert_stdout_unmatched(soutpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 3, soutpattern) -#define g_test_trap_assert_stderr(serrpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 4, serrpattern) -#define g_test_trap_assert_stderr_unmatched(serrpattern) g_test_trap_assertions (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, 5, serrpattern) - -/* provide seed-able random numbers for tests */ -#define g_test_rand_bit() (0 != (g_test_rand_int() & (1 << 15))) -GLIB_AVAILABLE_IN_ALL -gint32 g_test_rand_int (void); -GLIB_AVAILABLE_IN_ALL -gint32 g_test_rand_int_range (gint32 begin, - gint32 end); -GLIB_AVAILABLE_IN_ALL -double g_test_rand_double (void); -GLIB_AVAILABLE_IN_ALL -double g_test_rand_double_range (double range_start, - double range_end); - -/* - * semi-internal API: non-documented symbols with stable ABI. You - * should use the non-internal helper macros instead. However, for - * compatibility reason, you may use this semi-internal API. - */ -GLIB_AVAILABLE_IN_ALL -GTestCase* g_test_create_case (const char *test_name, - gsize data_size, - gconstpointer test_data, - GTestFixtureFunc data_setup, - GTestFixtureFunc data_test, - GTestFixtureFunc data_teardown); -GLIB_AVAILABLE_IN_ALL -GTestSuite* g_test_create_suite (const char *suite_name); -GLIB_AVAILABLE_IN_ALL -GTestSuite* g_test_get_root (void); -GLIB_AVAILABLE_IN_ALL -void g_test_suite_add (GTestSuite *suite, - GTestCase *test_case); -GLIB_AVAILABLE_IN_ALL -void g_test_suite_add_suite (GTestSuite *suite, - GTestSuite *nestedsuite); -GLIB_AVAILABLE_IN_ALL -int g_test_run_suite (GTestSuite *suite); - -GLIB_AVAILABLE_IN_ALL -void g_test_trap_assertions (const char *domain, - const char *file, - int line, - const char *func, - guint64 assertion_flags, /* 0-pass, 1-fail, 2-outpattern, 4-errpattern */ - const char *pattern); -GLIB_AVAILABLE_IN_ALL -void g_assertion_message (const char *domain, - const char *file, - int line, - const char *func, - const char *message) G_ANALYZER_NORETURN; -GLIB_AVAILABLE_IN_ALL -G_NORETURN -void g_assertion_message_expr (const char *domain, - const char *file, - int line, - const char *func, - const char *expr); -GLIB_AVAILABLE_IN_ALL -void g_assertion_message_cmpstr (const char *domain, - const char *file, - int line, - const char *func, - const char *expr, - const char *arg1, - const char *cmp, - const char *arg2) G_ANALYZER_NORETURN; - -GLIB_AVAILABLE_IN_2_68 -void g_assertion_message_cmpstrv (const char *domain, - const char *file, - int line, - const char *func, - const char *expr, - const char * const *arg1, - const char * const *arg2, - gsize first_wrong_idx) G_ANALYZER_NORETURN; -GLIB_AVAILABLE_IN_ALL -void g_assertion_message_cmpnum (const char *domain, - const char *file, - int line, - const char *func, - const char *expr, - long double arg1, - const char *cmp, - long double arg2, - char numtype) G_ANALYZER_NORETURN; -GLIB_AVAILABLE_IN_ALL -void g_assertion_message_error (const char *domain, - const char *file, - int line, - const char *func, - const char *expr, - const GError *error, - GQuark error_domain, - int error_code) G_ANALYZER_NORETURN; -GLIB_AVAILABLE_IN_ALL -void g_test_add_vtable (const char *testpath, - gsize data_size, - gconstpointer test_data, - GTestFixtureFunc data_setup, - GTestFixtureFunc data_test, - GTestFixtureFunc data_teardown); -typedef struct { - gboolean test_initialized; - gboolean test_quick; /* disable thorough tests */ - gboolean test_perf; /* run performance tests */ - gboolean test_verbose; /* extra info */ - gboolean test_quiet; /* reduce output */ - gboolean test_undefined; /* run tests that are meant to assert */ -} GTestConfig; -GLIB_VAR const GTestConfig * const g_test_config_vars; - -/* internal logging API */ -typedef enum { - G_TEST_RUN_SUCCESS, - G_TEST_RUN_SKIPPED, - G_TEST_RUN_FAILURE, - G_TEST_RUN_INCOMPLETE -} GTestResult; - -typedef enum { - G_TEST_LOG_NONE, - G_TEST_LOG_ERROR, /* s:msg */ - G_TEST_LOG_START_BINARY, /* s:binaryname s:seed */ - G_TEST_LOG_LIST_CASE, /* s:testpath */ - G_TEST_LOG_SKIP_CASE, /* s:testpath */ - G_TEST_LOG_START_CASE, /* s:testpath */ - G_TEST_LOG_STOP_CASE, /* d:status d:nforks d:elapsed */ - G_TEST_LOG_MIN_RESULT, /* s:blurb d:result */ - G_TEST_LOG_MAX_RESULT, /* s:blurb d:result */ - G_TEST_LOG_MESSAGE, /* s:blurb */ - G_TEST_LOG_START_SUITE, - G_TEST_LOG_STOP_SUITE -} GTestLogType; - -typedef struct { - GTestLogType log_type; - guint n_strings; - gchar **strings; /* NULL terminated */ - guint n_nums; - long double *nums; -} GTestLogMsg; -typedef struct { - /*< private >*/ - GString *data; - GSList *msgs; -} GTestLogBuffer; - -GLIB_AVAILABLE_IN_ALL -const char* g_test_log_type_name (GTestLogType log_type); -GLIB_AVAILABLE_IN_ALL -GTestLogBuffer* g_test_log_buffer_new (void); -GLIB_AVAILABLE_IN_ALL -void g_test_log_buffer_free (GTestLogBuffer *tbuffer); -GLIB_AVAILABLE_IN_ALL -void g_test_log_buffer_push (GTestLogBuffer *tbuffer, - guint n_bytes, - const guint8 *bytes); -GLIB_AVAILABLE_IN_ALL -GTestLogMsg* g_test_log_buffer_pop (GTestLogBuffer *tbuffer); -GLIB_AVAILABLE_IN_ALL -void g_test_log_msg_free (GTestLogMsg *tmsg); - -/** - * GTestLogFatalFunc: - * @log_domain: the log domain of the message - * @log_level: the log level of the message (including the fatal and recursion flags) - * @message: the message to process - * @user_data: user data, set in g_test_log_set_fatal_handler() - * - * Specifies the prototype of fatal log handler functions. - * - * Returns: %TRUE if the program should abort, %FALSE otherwise - * - * Since: 2.22 - */ -typedef gboolean (*GTestLogFatalFunc) (const gchar *log_domain, - GLogLevelFlags log_level, - const gchar *message, - gpointer user_data); -GLIB_AVAILABLE_IN_ALL -void -g_test_log_set_fatal_handler (GTestLogFatalFunc log_func, - gpointer user_data); - -GLIB_AVAILABLE_IN_2_34 -void g_test_expect_message (const gchar *log_domain, - GLogLevelFlags log_level, - const gchar *pattern); -GLIB_AVAILABLE_IN_2_34 -void g_test_assert_expected_messages_internal (const char *domain, - const char *file, - int line, - const char *func); - -typedef enum -{ - G_TEST_DIST, - G_TEST_BUILT -} GTestFileType; - -GLIB_AVAILABLE_IN_2_38 -gchar * g_test_build_filename (GTestFileType file_type, - const gchar *first_path, - ...) G_GNUC_NULL_TERMINATED; -GLIB_AVAILABLE_IN_2_38 -const gchar *g_test_get_dir (GTestFileType file_type); -GLIB_AVAILABLE_IN_2_38 -const gchar *g_test_get_filename (GTestFileType file_type, - const gchar *first_path, - ...) G_GNUC_NULL_TERMINATED; - -#define g_test_assert_expected_messages() g_test_assert_expected_messages_internal (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC) - -G_END_DECLS - -#endif /* __G_TEST_UTILS_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_THREADPOOL_H__ -#define __G_THREADPOOL_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GThreadPool GThreadPool; - -/* Thread Pools - */ - -struct _GThreadPool -{ - GFunc func; - gpointer user_data; - gboolean exclusive; -}; - -GLIB_AVAILABLE_IN_ALL -GThreadPool * g_thread_pool_new (GFunc func, - gpointer user_data, - gint max_threads, - gboolean exclusive, - GError **error); -GLIB_AVAILABLE_IN_ALL -void g_thread_pool_free (GThreadPool *pool, - gboolean immediate, - gboolean wait_); -GLIB_AVAILABLE_IN_ALL -gboolean g_thread_pool_push (GThreadPool *pool, - gpointer data, - GError **error); -GLIB_AVAILABLE_IN_ALL -guint g_thread_pool_unprocessed (GThreadPool *pool); -GLIB_AVAILABLE_IN_ALL -void g_thread_pool_set_sort_function (GThreadPool *pool, - GCompareDataFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_2_46 -gboolean g_thread_pool_move_to_front (GThreadPool *pool, - gpointer data); - -GLIB_AVAILABLE_IN_ALL -gboolean g_thread_pool_set_max_threads (GThreadPool *pool, - gint max_threads, - GError **error); -GLIB_AVAILABLE_IN_ALL -gint g_thread_pool_get_max_threads (GThreadPool *pool); -GLIB_AVAILABLE_IN_ALL -guint g_thread_pool_get_num_threads (GThreadPool *pool); - -GLIB_AVAILABLE_IN_ALL -void g_thread_pool_set_max_unused_threads (gint max_threads); -GLIB_AVAILABLE_IN_ALL -gint g_thread_pool_get_max_unused_threads (void); -GLIB_AVAILABLE_IN_ALL -guint g_thread_pool_get_num_unused_threads (void); -GLIB_AVAILABLE_IN_ALL -void g_thread_pool_stop_unused_threads (void); -GLIB_AVAILABLE_IN_ALL -void g_thread_pool_set_max_idle_time (guint interval); -GLIB_AVAILABLE_IN_ALL -guint g_thread_pool_get_max_idle_time (void); - -G_END_DECLS - -#endif /* __G_THREADPOOL_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_TIMER_H__ -#define __G_TIMER_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/* Timer - */ - -/* microseconds per second */ -typedef struct _GTimer GTimer; - -#define G_USEC_PER_SEC 1000000 - -GLIB_AVAILABLE_IN_ALL -GTimer* g_timer_new (void); -GLIB_AVAILABLE_IN_ALL -void g_timer_destroy (GTimer *timer); -GLIB_AVAILABLE_IN_ALL -void g_timer_start (GTimer *timer); -GLIB_AVAILABLE_IN_ALL -void g_timer_stop (GTimer *timer); -GLIB_AVAILABLE_IN_ALL -void g_timer_reset (GTimer *timer); -GLIB_AVAILABLE_IN_ALL -void g_timer_continue (GTimer *timer); -GLIB_AVAILABLE_IN_ALL -gdouble g_timer_elapsed (GTimer *timer, - gulong *microseconds); -GLIB_AVAILABLE_IN_2_62 -gboolean g_timer_is_active (GTimer *timer); - -GLIB_AVAILABLE_IN_ALL -void g_usleep (gulong microseconds); - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_DEPRECATED_IN_2_62 -void g_time_val_add (GTimeVal *time_, - glong microseconds); -GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_new_from_iso8601) -gboolean g_time_val_from_iso8601 (const gchar *iso_date, - GTimeVal *time_); -GLIB_DEPRECATED_IN_2_62_FOR(g_date_time_format) -gchar* g_time_val_to_iso8601 (GTimeVal *time_) G_GNUC_MALLOC; -G_GNUC_END_IGNORE_DEPRECATIONS - -G_END_DECLS - -#endif /* __G_TIMER_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_TRASH_STACK_H__ -#define __G_TRASH_STACK_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -typedef struct _GTrashStack GTrashStack GLIB_DEPRECATED_TYPE_IN_2_48; -struct _GTrashStack -{ - GTrashStack *next; -} GLIB_DEPRECATED_TYPE_IN_2_48; - -GLIB_DEPRECATED_IN_2_48 -void g_trash_stack_push (GTrashStack **stack_p, - gpointer data_p); -GLIB_DEPRECATED_IN_2_48 -gpointer g_trash_stack_pop (GTrashStack **stack_p); -GLIB_DEPRECATED_IN_2_48 -gpointer g_trash_stack_peek (GTrashStack **stack_p); -GLIB_DEPRECATED_IN_2_48 -guint g_trash_stack_height (GTrashStack **stack_p); - -G_GNUC_END_IGNORE_DEPRECATIONS - -G_END_DECLS - -#endif /* __G_TRASH_STACK_H_ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_TREE_H__ -#define __G_TREE_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -#undef G_TREE_DEBUG - -typedef struct _GTree GTree; - -/** - * GTreeNode: - * - * An opaque type which identifies a specific node in a #GTree. - * - * Since: 2.68 - */ -typedef struct _GTreeNode GTreeNode; - -typedef gboolean (*GTraverseFunc) (gpointer key, - gpointer value, - gpointer data); - -/** - * GTraverseNodeFunc: - * @node: a #GTreeNode - * @data: user data passed to g_tree_foreach_node() - * - * Specifies the type of function passed to g_tree_foreach_node(). It is - * passed each node, together with the @user_data parameter passed to - * g_tree_foreach_node(). If the function returns %TRUE, the traversal is - * stopped. - * - * Returns: %TRUE to stop the traversal - * Since: 2.68 - */ -typedef gboolean (*GTraverseNodeFunc) (GTreeNode *node, - gpointer data); - -/* Balanced binary trees - */ -GLIB_AVAILABLE_IN_ALL -GTree* g_tree_new (GCompareFunc key_compare_func); -GLIB_AVAILABLE_IN_ALL -GTree* g_tree_new_with_data (GCompareDataFunc key_compare_func, - gpointer key_compare_data); -GLIB_AVAILABLE_IN_ALL -GTree* g_tree_new_full (GCompareDataFunc key_compare_func, - gpointer key_compare_data, - GDestroyNotify key_destroy_func, - GDestroyNotify value_destroy_func); -GLIB_AVAILABLE_IN_2_68 -GTreeNode *g_tree_node_first (GTree *tree); -GLIB_AVAILABLE_IN_2_68 -GTreeNode *g_tree_node_last (GTree *tree); -GLIB_AVAILABLE_IN_2_68 -GTreeNode *g_tree_node_previous (GTreeNode *node); -GLIB_AVAILABLE_IN_2_68 -GTreeNode *g_tree_node_next (GTreeNode *node); -GLIB_AVAILABLE_IN_ALL -GTree* g_tree_ref (GTree *tree); -GLIB_AVAILABLE_IN_ALL -void g_tree_unref (GTree *tree); -GLIB_AVAILABLE_IN_ALL -void g_tree_destroy (GTree *tree); -GLIB_AVAILABLE_IN_2_68 -GTreeNode *g_tree_insert_node (GTree *tree, - gpointer key, - gpointer value); -GLIB_AVAILABLE_IN_ALL -void g_tree_insert (GTree *tree, - gpointer key, - gpointer value); -GLIB_AVAILABLE_IN_2_68 -GTreeNode *g_tree_replace_node (GTree *tree, - gpointer key, - gpointer value); -GLIB_AVAILABLE_IN_ALL -void g_tree_replace (GTree *tree, - gpointer key, - gpointer value); -GLIB_AVAILABLE_IN_ALL -gboolean g_tree_remove (GTree *tree, - gconstpointer key); -GLIB_AVAILABLE_IN_ALL -gboolean g_tree_steal (GTree *tree, - gconstpointer key); -GLIB_AVAILABLE_IN_2_68 -gpointer g_tree_node_key (GTreeNode *node); -GLIB_AVAILABLE_IN_2_68 -gpointer g_tree_node_value (GTreeNode *node); -GLIB_AVAILABLE_IN_2_68 -GTreeNode *g_tree_lookup_node (GTree *tree, - gconstpointer key); -GLIB_AVAILABLE_IN_ALL -gpointer g_tree_lookup (GTree *tree, - gconstpointer key); -GLIB_AVAILABLE_IN_ALL -gboolean g_tree_lookup_extended (GTree *tree, - gconstpointer lookup_key, - gpointer *orig_key, - gpointer *value); -GLIB_AVAILABLE_IN_ALL -void g_tree_foreach (GTree *tree, - GTraverseFunc func, - gpointer user_data); -GLIB_AVAILABLE_IN_2_68 -void g_tree_foreach_node (GTree *tree, - GTraverseNodeFunc func, - gpointer user_data); - -GLIB_DEPRECATED -void g_tree_traverse (GTree *tree, - GTraverseFunc traverse_func, - GTraverseType traverse_type, - gpointer user_data); - -GLIB_AVAILABLE_IN_2_68 -GTreeNode *g_tree_search_node (GTree *tree, - GCompareFunc search_func, - gconstpointer user_data); -GLIB_AVAILABLE_IN_ALL -gpointer g_tree_search (GTree *tree, - GCompareFunc search_func, - gconstpointer user_data); -GLIB_AVAILABLE_IN_2_68 -GTreeNode *g_tree_lower_bound (GTree *tree, - gconstpointer key); -GLIB_AVAILABLE_IN_2_68 -GTreeNode *g_tree_upper_bound (GTree *tree, - gconstpointer key); -GLIB_AVAILABLE_IN_ALL -gint g_tree_height (GTree *tree); -GLIB_AVAILABLE_IN_ALL -gint g_tree_nnodes (GTree *tree); - -#ifdef G_TREE_DEBUG -/*< private >*/ -#ifndef __GTK_DOC_IGNORE__ -void g_tree_dump (GTree *tree); -#endif /* !__GTK_DOC_IGNORE__ */ -#endif /* G_TREE_DEBUG */ - -G_END_DECLS - -#endif /* __G_TREE_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright © 2020 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see - * . - */ - -#pragma once - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -typedef struct _GUri GUri; - -GLIB_AVAILABLE_IN_2_66 -GUri * g_uri_ref (GUri *uri); -GLIB_AVAILABLE_IN_2_66 -void g_uri_unref (GUri *uri); - -/** - * GUriFlags: - * @G_URI_FLAGS_NONE: No flags set. - * @G_URI_FLAGS_PARSE_RELAXED: Parse the URI more relaxedly than the - * [RFC 3986](https://tools.ietf.org/html/rfc3986) grammar specifies, - * fixing up or ignoring common mistakes in URIs coming from external - * sources. This is also needed for some obscure URI schemes where `;` - * separates the host from the path. Don’t use this flag unless you need to. - * @G_URI_FLAGS_HAS_PASSWORD: The userinfo field may contain a password, - * which will be separated from the username by `:`. - * @G_URI_FLAGS_HAS_AUTH_PARAMS: The userinfo may contain additional - * authentication-related parameters, which will be separated from - * the username and/or password by `;`. - * @G_URI_FLAGS_NON_DNS: The host component should not be assumed to be a - * DNS hostname or IP address (for example, for `smb` URIs with NetBIOS - * hostnames). - * @G_URI_FLAGS_ENCODED: When parsing a URI, this indicates that `%`-encoded - * characters in the userinfo, path, query, and fragment fields - * should not be decoded. (And likewise the host field if - * %G_URI_FLAGS_NON_DNS is also set.) When building a URI, it indicates - * that you have already `%`-encoded the components, and so #GUri - * should not do any encoding itself. - * @G_URI_FLAGS_ENCODED_QUERY: Same as %G_URI_FLAGS_ENCODED, for the query - * field only. - * @G_URI_FLAGS_ENCODED_PATH: Same as %G_URI_FLAGS_ENCODED, for the path only. - * @G_URI_FLAGS_ENCODED_FRAGMENT: Same as %G_URI_FLAGS_ENCODED, for the - * fragment only. - * @G_URI_FLAGS_SCHEME_NORMALIZE: A scheme-based normalization will be applied. - * For example, when parsing an HTTP URI changing omitted path to `/` and - * omitted port to `80`; and when building a URI, changing empty path to `/` - * and default port `80`). This only supports a subset of known schemes. (Since: 2.68) - * - * Flags that describe a URI. - * - * When parsing a URI, if you need to choose different flags based on - * the type of URI, you can use g_uri_peek_scheme() on the URI string - * to check the scheme first, and use that to decide what flags to - * parse it with. - * - * Since: 2.66 - */ -GLIB_AVAILABLE_TYPE_IN_2_66 -typedef enum { - G_URI_FLAGS_NONE = 0, - G_URI_FLAGS_PARSE_RELAXED = 1 << 0, - G_URI_FLAGS_HAS_PASSWORD = 1 << 1, - G_URI_FLAGS_HAS_AUTH_PARAMS = 1 << 2, - G_URI_FLAGS_ENCODED = 1 << 3, - G_URI_FLAGS_NON_DNS = 1 << 4, - G_URI_FLAGS_ENCODED_QUERY = 1 << 5, - G_URI_FLAGS_ENCODED_PATH = 1 << 6, - G_URI_FLAGS_ENCODED_FRAGMENT = 1 << 7, - G_URI_FLAGS_SCHEME_NORMALIZE = 1 << 8, -} GUriFlags; - -GLIB_AVAILABLE_IN_2_66 -gboolean g_uri_split (const gchar *uri_ref, - GUriFlags flags, - gchar **scheme, - gchar **userinfo, - gchar **host, - gint *port, - gchar **path, - gchar **query, - gchar **fragment, - GError **error); -GLIB_AVAILABLE_IN_2_66 -gboolean g_uri_split_with_user (const gchar *uri_ref, - GUriFlags flags, - gchar **scheme, - gchar **user, - gchar **password, - gchar **auth_params, - gchar **host, - gint *port, - gchar **path, - gchar **query, - gchar **fragment, - GError **error); -GLIB_AVAILABLE_IN_2_66 -gboolean g_uri_split_network (const gchar *uri_string, - GUriFlags flags, - gchar **scheme, - gchar **host, - gint *port, - GError **error); - -GLIB_AVAILABLE_IN_2_66 -gboolean g_uri_is_valid (const gchar *uri_string, - GUriFlags flags, - GError **error); - -GLIB_AVAILABLE_IN_2_66 -gchar * g_uri_join (GUriFlags flags, - const gchar *scheme, - const gchar *userinfo, - const gchar *host, - gint port, - const gchar *path, - const gchar *query, - const gchar *fragment); -GLIB_AVAILABLE_IN_2_66 -gchar * g_uri_join_with_user (GUriFlags flags, - const gchar *scheme, - const gchar *user, - const gchar *password, - const gchar *auth_params, - const gchar *host, - gint port, - const gchar *path, - const gchar *query, - const gchar *fragment); - -GLIB_AVAILABLE_IN_2_66 -GUri * g_uri_parse (const gchar *uri_string, - GUriFlags flags, - GError **error); -GLIB_AVAILABLE_IN_2_66 -GUri * g_uri_parse_relative (GUri *base_uri, - const gchar *uri_ref, - GUriFlags flags, - GError **error); - -GLIB_AVAILABLE_IN_2_66 -gchar * g_uri_resolve_relative (const gchar *base_uri_string, - const gchar *uri_ref, - GUriFlags flags, - GError **error); - -GLIB_AVAILABLE_IN_2_66 -GUri * g_uri_build (GUriFlags flags, - const gchar *scheme, - const gchar *userinfo, - const gchar *host, - gint port, - const gchar *path, - const gchar *query, - const gchar *fragment); -GLIB_AVAILABLE_IN_2_66 -GUri * g_uri_build_with_user (GUriFlags flags, - const gchar *scheme, - const gchar *user, - const gchar *password, - const gchar *auth_params, - const gchar *host, - gint port, - const gchar *path, - const gchar *query, - const gchar *fragment); - -/** - * GUriHideFlags: - * @G_URI_HIDE_NONE: No flags set. - * @G_URI_HIDE_USERINFO: Hide the userinfo. - * @G_URI_HIDE_PASSWORD: Hide the password. - * @G_URI_HIDE_AUTH_PARAMS: Hide the auth_params. - * @G_URI_HIDE_QUERY: Hide the query. - * @G_URI_HIDE_FRAGMENT: Hide the fragment. - * - * Flags describing what parts of the URI to hide in - * g_uri_to_string_partial(). Note that %G_URI_HIDE_PASSWORD and - * %G_URI_HIDE_AUTH_PARAMS will only work if the #GUri was parsed with - * the corresponding flags. - * - * Since: 2.66 - */ -GLIB_AVAILABLE_TYPE_IN_2_66 -typedef enum { - G_URI_HIDE_NONE = 0, - G_URI_HIDE_USERINFO = 1 << 0, - G_URI_HIDE_PASSWORD = 1 << 1, - G_URI_HIDE_AUTH_PARAMS = 1 << 2, - G_URI_HIDE_QUERY = 1 << 3, - G_URI_HIDE_FRAGMENT = 1 << 4, -} GUriHideFlags; - -GLIB_AVAILABLE_IN_2_66 -char * g_uri_to_string (GUri *uri); -GLIB_AVAILABLE_IN_2_66 -char * g_uri_to_string_partial (GUri *uri, - GUriHideFlags flags); - -GLIB_AVAILABLE_IN_2_66 -const gchar *g_uri_get_scheme (GUri *uri); -GLIB_AVAILABLE_IN_2_66 -const gchar *g_uri_get_userinfo (GUri *uri); -GLIB_AVAILABLE_IN_2_66 -const gchar *g_uri_get_user (GUri *uri); -GLIB_AVAILABLE_IN_2_66 -const gchar *g_uri_get_password (GUri *uri); -GLIB_AVAILABLE_IN_2_66 -const gchar *g_uri_get_auth_params (GUri *uri); -GLIB_AVAILABLE_IN_2_66 -const gchar *g_uri_get_host (GUri *uri); -GLIB_AVAILABLE_IN_2_66 -gint g_uri_get_port (GUri *uri); -GLIB_AVAILABLE_IN_2_66 -const gchar *g_uri_get_path (GUri *uri); -GLIB_AVAILABLE_IN_2_66 -const gchar *g_uri_get_query (GUri *uri); -GLIB_AVAILABLE_IN_2_66 -const gchar *g_uri_get_fragment (GUri *uri); -GLIB_AVAILABLE_IN_2_66 -GUriFlags g_uri_get_flags (GUri *uri); - -/** - * GUriParamsFlags: - * @G_URI_PARAMS_NONE: No flags set. - * @G_URI_PARAMS_CASE_INSENSITIVE: Parameter names are case insensitive. - * @G_URI_PARAMS_WWW_FORM: Replace `+` with space character. Only useful for - * URLs on the web, using the `https` or `http` schemas. - * @G_URI_PARAMS_PARSE_RELAXED: See %G_URI_FLAGS_PARSE_RELAXED. - * - * Flags modifying the way parameters are handled by g_uri_parse_params() and - * #GUriParamsIter. - * - * Since: 2.66 - */ -GLIB_AVAILABLE_TYPE_IN_2_66 -typedef enum { - G_URI_PARAMS_NONE = 0, - G_URI_PARAMS_CASE_INSENSITIVE = 1 << 0, - G_URI_PARAMS_WWW_FORM = 1 << 1, - G_URI_PARAMS_PARSE_RELAXED = 1 << 2, -} GUriParamsFlags; - -GLIB_AVAILABLE_IN_2_66 -GHashTable *g_uri_parse_params (const gchar *params, - gssize length, - const gchar *separators, - GUriParamsFlags flags, - GError **error); - -typedef struct _GUriParamsIter GUriParamsIter; - -struct _GUriParamsIter -{ - /*< private >*/ - gint dummy0; - gpointer dummy1; - gpointer dummy2; - guint8 dummy3[256]; -}; - -GLIB_AVAILABLE_IN_2_66 -void g_uri_params_iter_init (GUriParamsIter *iter, - const gchar *params, - gssize length, - const gchar *separators, - GUriParamsFlags flags); - -GLIB_AVAILABLE_IN_2_66 -gboolean g_uri_params_iter_next (GUriParamsIter *iter, - gchar **attribute, - gchar **value, - GError **error); - -/** - * G_URI_ERROR: - * - * Error domain for URI methods. Errors in this domain will be from - * the #GUriError enumeration. See #GError for information on error - * domains. - * - * Since: 2.66 - */ -#define G_URI_ERROR (g_uri_error_quark ()) GLIB_AVAILABLE_MACRO_IN_2_66 -GLIB_AVAILABLE_IN_2_66 -GQuark g_uri_error_quark (void); - -/** - * GUriError: - * @G_URI_ERROR_FAILED: Generic error if no more specific error is available. - * See the error message for details. - * @G_URI_ERROR_BAD_SCHEME: The scheme of a URI could not be parsed. - * @G_URI_ERROR_BAD_USER: The user/userinfo of a URI could not be parsed. - * @G_URI_ERROR_BAD_PASSWORD: The password of a URI could not be parsed. - * @G_URI_ERROR_BAD_AUTH_PARAMS: The authentication parameters of a URI could not be parsed. - * @G_URI_ERROR_BAD_HOST: The host of a URI could not be parsed. - * @G_URI_ERROR_BAD_PORT: The port of a URI could not be parsed. - * @G_URI_ERROR_BAD_PATH: The path of a URI could not be parsed. - * @G_URI_ERROR_BAD_QUERY: The query of a URI could not be parsed. - * @G_URI_ERROR_BAD_FRAGMENT: The fragment of a URI could not be parsed. - * - * Error codes returned by #GUri methods. - * - * Since: 2.66 - */ -typedef enum { - G_URI_ERROR_FAILED, - G_URI_ERROR_BAD_SCHEME, - G_URI_ERROR_BAD_USER, - G_URI_ERROR_BAD_PASSWORD, - G_URI_ERROR_BAD_AUTH_PARAMS, - G_URI_ERROR_BAD_HOST, - G_URI_ERROR_BAD_PORT, - G_URI_ERROR_BAD_PATH, - G_URI_ERROR_BAD_QUERY, - G_URI_ERROR_BAD_FRAGMENT, -} GUriError; - -/** - * G_URI_RESERVED_CHARS_GENERIC_DELIMITERS: - * - * Generic delimiters characters as defined in - * [RFC 3986](https://tools.ietf.org/html/rfc3986). Includes `:/?#[]@`. - * - * Since: 2.16 - **/ -#define G_URI_RESERVED_CHARS_GENERIC_DELIMITERS ":/?#[]@" - -/** - * G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS: - * - * Subcomponent delimiter characters as defined in - * [RFC 3986](https://tools.ietf.org/html/rfc3986). Includes `!$&'()*+,;=`. - * - * Since: 2.16 - **/ -#define G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS "!$&'()*+,;=" - -/** - * G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT: - * - * Allowed characters in path elements. Includes `!$&'()*+,;=:@`. - * - * Since: 2.16 - **/ -#define G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS ":@" - -/** - * G_URI_RESERVED_CHARS_ALLOWED_IN_PATH: - * - * Allowed characters in a path. Includes `!$&'()*+,;=:@/`. - * - * Since: 2.16 - **/ -#define G_URI_RESERVED_CHARS_ALLOWED_IN_PATH G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT "/" - -/** - * G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO: - * - * Allowed characters in userinfo as defined in - * [RFC 3986](https://tools.ietf.org/html/rfc3986). Includes `!$&'()*+,;=:`. - * - * Since: 2.16 - **/ -#define G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS ":" - -GLIB_AVAILABLE_IN_ALL -char * g_uri_unescape_string (const char *escaped_string, - const char *illegal_characters); -GLIB_AVAILABLE_IN_ALL -char * g_uri_unescape_segment (const char *escaped_string, - const char *escaped_string_end, - const char *illegal_characters); - -GLIB_AVAILABLE_IN_ALL -char * g_uri_parse_scheme (const char *uri); -GLIB_AVAILABLE_IN_2_66 -const char *g_uri_peek_scheme (const char *uri); - -GLIB_AVAILABLE_IN_ALL -char * g_uri_escape_string (const char *unescaped, - const char *reserved_chars_allowed, - gboolean allow_utf8); - -GLIB_AVAILABLE_IN_2_66 -GBytes * g_uri_unescape_bytes (const char *escaped_string, - gssize length, - const char *illegal_characters, - GError **error); - -GLIB_AVAILABLE_IN_2_66 -char * g_uri_escape_bytes (const guint8 *unescaped, - gsize length, - const char *reserved_chars_allowed); - -G_GNUC_END_IGNORE_DEPRECATIONS - -G_END_DECLS -/* guuid.h - UUID functions - * - * Copyright (C) 2013-2015, 2017 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of the - * licence, or (at your option) any later version. - * - * This is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 - * USA. - * - * Authors: Marc-André Lureau - */ - -#ifndef __G_UUID_H__ -#define __G_UUID_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_2_52 -gboolean g_uuid_string_is_valid (const gchar *str); - -GLIB_AVAILABLE_IN_2_52 -gchar * g_uuid_string_random (void); - -G_END_DECLS - -#endif /* __G_UUID_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_VERSION_H__ -#define __G_VERSION_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -GLIB_VAR const guint glib_major_version; -GLIB_VAR const guint glib_minor_version; -GLIB_VAR const guint glib_micro_version; -GLIB_VAR const guint glib_interface_age; -GLIB_VAR const guint glib_binary_age; - -GLIB_AVAILABLE_IN_ALL -const gchar * glib_check_version (guint required_major, - guint required_minor, - guint required_micro); - -#define GLIB_CHECK_VERSION(major,minor,micro) \ - (GLIB_MAJOR_VERSION > (major) || \ - (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION > (minor)) || \ - (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION == (minor) && \ - GLIB_MICRO_VERSION >= (micro))) - -G_END_DECLS - -#endif /* __G_VERSION_H__ */ - -#ifdef G_PLATFORM_WIN32 -#include -#endif - -/* - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#ifndef __G_ALLOCATOR_H__ -#define __G_ALLOCATOR_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GAllocator GAllocator; -typedef struct _GMemChunk GMemChunk; - -#define G_ALLOC_ONLY 1 -#define G_ALLOC_AND_FREE 2 -#define G_ALLOCATOR_LIST 1 -#define G_ALLOCATOR_SLIST 2 -#define G_ALLOCATOR_NODE 3 - -#define g_chunk_new(type, chunk) ((type *) g_mem_chunk_alloc (chunk)) -#define g_chunk_new0(type, chunk) ((type *) g_mem_chunk_alloc0 (chunk)) -#define g_chunk_free(mem, mem_chunk) (g_mem_chunk_free (mem_chunk, mem)) -#define g_mem_chunk_create(type, x, y) (g_mem_chunk_new (NULL, sizeof (type), 0, 0)) - - -GLIB_DEPRECATED -GMemChunk * g_mem_chunk_new (const gchar *name, - gint atom_size, - gsize area_size, - gint type); -GLIB_DEPRECATED -void g_mem_chunk_destroy (GMemChunk *mem_chunk); -GLIB_DEPRECATED -gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk); -GLIB_DEPRECATED -gpointer g_mem_chunk_alloc0 (GMemChunk *mem_chunk); -GLIB_DEPRECATED -void g_mem_chunk_free (GMemChunk *mem_chunk, - gpointer mem); -GLIB_DEPRECATED -void g_mem_chunk_clean (GMemChunk *mem_chunk); -GLIB_DEPRECATED -void g_mem_chunk_reset (GMemChunk *mem_chunk); -GLIB_DEPRECATED -void g_mem_chunk_print (GMemChunk *mem_chunk); -GLIB_DEPRECATED -void g_mem_chunk_info (void); -GLIB_DEPRECATED -void g_blow_chunks (void); - - -GLIB_DEPRECATED -GAllocator * g_allocator_new (const gchar *name, - guint n_preallocs); -GLIB_DEPRECATED -void g_allocator_free (GAllocator *allocator); -GLIB_DEPRECATED -void g_list_push_allocator (GAllocator *allocator); -GLIB_DEPRECATED -void g_list_pop_allocator (void); -GLIB_DEPRECATED -void g_slist_push_allocator (GAllocator *allocator); -GLIB_DEPRECATED -void g_slist_pop_allocator (void); -GLIB_DEPRECATED -void g_node_push_allocator (GAllocator *allocator); -GLIB_DEPRECATED -void g_node_pop_allocator (void); - -G_END_DECLS - -#endif /* __G_ALLOCATOR_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_CACHE_H__ -#define __G_CACHE_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GCache GCache GLIB_DEPRECATED_TYPE_IN_2_26_FOR(GHashTable); - -typedef gpointer (*GCacheNewFunc) (gpointer key) GLIB_DEPRECATED_TYPE_IN_2_26; -typedef gpointer (*GCacheDupFunc) (gpointer value) GLIB_DEPRECATED_TYPE_IN_2_26; -typedef void (*GCacheDestroyFunc) (gpointer value) GLIB_DEPRECATED_TYPE_IN_2_26; - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -/* Caches - */ -GLIB_DEPRECATED -GCache* g_cache_new (GCacheNewFunc value_new_func, - GCacheDestroyFunc value_destroy_func, - GCacheDupFunc key_dup_func, - GCacheDestroyFunc key_destroy_func, - GHashFunc hash_key_func, - GHashFunc hash_value_func, - GEqualFunc key_equal_func); -GLIB_DEPRECATED -void g_cache_destroy (GCache *cache); -GLIB_DEPRECATED -gpointer g_cache_insert (GCache *cache, - gpointer key); -GLIB_DEPRECATED -void g_cache_remove (GCache *cache, - gconstpointer value); -GLIB_DEPRECATED -void g_cache_key_foreach (GCache *cache, - GHFunc func, - gpointer user_data); -GLIB_DEPRECATED -void g_cache_value_foreach (GCache *cache, - GHFunc func, - gpointer user_data); - -G_GNUC_END_IGNORE_DEPRECATIONS - -G_END_DECLS - -#endif /* __G_CACHE_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_COMPLETION_H__ -#define __G_COMPLETION_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GCompletion GCompletion; - -typedef gchar* (*GCompletionFunc) (gpointer); - -/* GCompletion - */ - -typedef gint (*GCompletionStrncmpFunc) (const gchar *s1, - const gchar *s2, - gsize n); - -struct _GCompletion -{ - GList* items; - GCompletionFunc func; - - gchar* prefix; - GList* cache; - GCompletionStrncmpFunc strncmp_func; -}; - -GLIB_DEPRECATED_IN_2_26 -GCompletion* g_completion_new (GCompletionFunc func); -GLIB_DEPRECATED_IN_2_26 -void g_completion_add_items (GCompletion* cmp, - GList* items); -GLIB_DEPRECATED_IN_2_26 -void g_completion_remove_items (GCompletion* cmp, - GList* items); -GLIB_DEPRECATED_IN_2_26 -void g_completion_clear_items (GCompletion* cmp); -GLIB_DEPRECATED_IN_2_26 -GList* g_completion_complete (GCompletion* cmp, - const gchar* prefix, - gchar** new_prefix); -GLIB_DEPRECATED_IN_2_26 -GList* g_completion_complete_utf8 (GCompletion *cmp, - const gchar* prefix, - gchar** new_prefix); -GLIB_DEPRECATED_IN_2_26 -void g_completion_set_compare (GCompletion *cmp, - GCompletionStrncmpFunc strncmp_func); -GLIB_DEPRECATED_IN_2_26 -void g_completion_free (GCompletion* cmp); - -G_END_DECLS - -#endif /* __G_COMPLETION_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_DEPRECATED_MAIN_H__ -#define __G_DEPRECATED_MAIN_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/* ============== Compat main loop stuff ================== */ - -/** - * g_main_new: - * @is_running: set to %TRUE to indicate that the loop is running. This - * is not very important since calling g_main_run() will set this - * to %TRUE anyway. - * - * Creates a new #GMainLoop for th default main context. - * - * Returns: a new #GMainLoop - * - * Deprecated: 2.2: Use g_main_loop_new() instead - */ -#define g_main_new(is_running) g_main_loop_new (NULL, is_running) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_new) - -/** - * g_main_run: - * @loop: a #GMainLoop - * - * Runs a main loop until it stops running. - * - * Deprecated: 2.2: Use g_main_loop_run() instead - */ -#define g_main_run(loop) g_main_loop_run(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_run) - -/** - * g_main_quit: - * @loop: a #GMainLoop - * - * Stops the #GMainLoop. - * If g_main_run() was called to run the #GMainLoop, it will now return. - * - * Deprecated: 2.2: Use g_main_loop_quit() instead - */ -#define g_main_quit(loop) g_main_loop_quit(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_quit) - -/** - * g_main_destroy: - * @loop: a #GMainLoop - * - * Frees the memory allocated for the #GMainLoop. - * - * Deprecated: 2.2: Use g_main_loop_unref() instead - */ -#define g_main_destroy(loop) g_main_loop_unref(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_unref) - -/** - * g_main_is_running: - * @loop: a #GMainLoop - * - * Checks if the main loop is running. - * - * Returns: %TRUE if the main loop is running - * - * Deprecated: 2.2: Use g_main_loop_is_running() instead - */ -#define g_main_is_running(loop) g_main_loop_is_running(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_is_running) - -/** - * g_main_iteration: - * @may_block: set to %TRUE if it should block (i.e. wait) until an event - * source becomes ready. It will return after an event source has been - * processed. If set to %FALSE it will return immediately if no event - * source is ready to be processed. - * - * Runs a single iteration for the default #GMainContext. - * - * Returns: %TRUE if more events are pending. - * - * Deprecated: 2.2: Use g_main_context_iteration() instead. - */ -#define g_main_iteration(may_block) g_main_context_iteration (NULL, may_block) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_context_iteration) - -/** - * g_main_pending: - * - * Checks if any events are pending for the default #GMainContext - * (i.e. ready to be processed). - * - * Returns: %TRUE if any events are pending. - * - * Deprecated: 2.2: Use g_main_context_pending() instead. - */ -#define g_main_pending() g_main_context_pending (NULL) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_context_pending) - -/** - * g_main_set_poll_func: - * @func: the function to call to poll all file descriptors - * - * Sets the function to use for the handle polling of file descriptors - * for the default main context. - * - * Deprecated: 2.2: Use g_main_context_set_poll_func() again - */ -#define g_main_set_poll_func(func) g_main_context_set_poll_func (NULL, func) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_context_set_poll_func) - -G_END_DECLS - -#endif /* __G_DEPRECATED_MAIN_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_REL_H__ -#define __G_REL_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GRelation GRelation; -typedef struct _GTuples GTuples; - -struct _GTuples -{ - guint len; -}; - -/* GRelation - * - * Indexed Relations. Imagine a really simple table in a - * database. Relations are not ordered. This data type is meant for - * maintaining a N-way mapping. - * - * g_relation_new() creates a relation with FIELDS fields - * - * g_relation_destroy() frees all resources - * g_tuples_destroy() frees the result of g_relation_select() - * - * g_relation_index() indexes relation FIELD with the provided - * equality and hash functions. this must be done before any - * calls to insert are made. - * - * g_relation_insert() inserts a new tuple. you are expected to - * provide the right number of fields. - * - * g_relation_delete() deletes all relations with KEY in FIELD - * g_relation_select() returns ... - * g_relation_count() counts ... - */ - -GLIB_DEPRECATED_IN_2_26 -GRelation* g_relation_new (gint fields); -GLIB_DEPRECATED_IN_2_26 -void g_relation_destroy (GRelation *relation); -GLIB_DEPRECATED_IN_2_26 -void g_relation_index (GRelation *relation, - gint field, - GHashFunc hash_func, - GEqualFunc key_equal_func); -GLIB_DEPRECATED_IN_2_26 -void g_relation_insert (GRelation *relation, - ...); -GLIB_DEPRECATED_IN_2_26 -gint g_relation_delete (GRelation *relation, - gconstpointer key, - gint field); -GLIB_DEPRECATED_IN_2_26 -GTuples* g_relation_select (GRelation *relation, - gconstpointer key, - gint field); -GLIB_DEPRECATED_IN_2_26 -gint g_relation_count (GRelation *relation, - gconstpointer key, - gint field); -GLIB_DEPRECATED_IN_2_26 -gboolean g_relation_exists (GRelation *relation, - ...); -GLIB_DEPRECATED_IN_2_26 -void g_relation_print (GRelation *relation); -GLIB_DEPRECATED_IN_2_26 -void g_tuples_destroy (GTuples *tuples); -GLIB_DEPRECATED_IN_2_26 -gpointer g_tuples_index (GTuples *tuples, - gint index_, - gint field); - -G_END_DECLS - -#endif /* __G_REL_H__ */ -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __G_DEPRECATED_THREAD_H__ -#define __G_DEPRECATED_THREAD_H__ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -typedef enum -{ - G_THREAD_PRIORITY_LOW, - G_THREAD_PRIORITY_NORMAL, - G_THREAD_PRIORITY_HIGH, - G_THREAD_PRIORITY_URGENT -} GThreadPriority GLIB_DEPRECATED_TYPE_IN_2_32; - -struct _GThread -{ - /*< private >*/ - GThreadFunc func; - gpointer data; - gboolean joinable; - GThreadPriority priority; -}; - -typedef struct _GThreadFunctions GThreadFunctions GLIB_DEPRECATED_TYPE_IN_2_32; -struct _GThreadFunctions -{ - GMutex* (*mutex_new) (void); - void (*mutex_lock) (GMutex *mutex); - gboolean (*mutex_trylock) (GMutex *mutex); - void (*mutex_unlock) (GMutex *mutex); - void (*mutex_free) (GMutex *mutex); - GCond* (*cond_new) (void); - void (*cond_signal) (GCond *cond); - void (*cond_broadcast) (GCond *cond); - void (*cond_wait) (GCond *cond, - GMutex *mutex); - gboolean (*cond_timed_wait) (GCond *cond, - GMutex *mutex, - GTimeVal *end_time); - void (*cond_free) (GCond *cond); - GPrivate* (*private_new) (GDestroyNotify destructor); - gpointer (*private_get) (GPrivate *private_key); - void (*private_set) (GPrivate *private_key, - gpointer data); - void (*thread_create) (GThreadFunc func, - gpointer data, - gulong stack_size, - gboolean joinable, - gboolean bound, - GThreadPriority priority, - gpointer thread, - GError **error); - void (*thread_yield) (void); - void (*thread_join) (gpointer thread); - void (*thread_exit) (void); - void (*thread_set_priority)(gpointer thread, - GThreadPriority priority); - void (*thread_self) (gpointer thread); - gboolean (*thread_equal) (gpointer thread1, - gpointer thread2); -} GLIB_DEPRECATED_TYPE_IN_2_32; - -GLIB_VAR GThreadFunctions g_thread_functions_for_glib_use; -GLIB_VAR gboolean g_thread_use_default_impl; - -GLIB_VAR guint64 (*g_thread_gettime) (void); - -GLIB_DEPRECATED_IN_2_32_FOR(g_thread_new) -GThread *g_thread_create (GThreadFunc func, - gpointer data, - gboolean joinable, - GError **error); - -GLIB_DEPRECATED_IN_2_32_FOR(g_thread_new) -GThread *g_thread_create_full (GThreadFunc func, - gpointer data, - gulong stack_size, - gboolean joinable, - gboolean bound, - GThreadPriority priority, - GError **error); - -GLIB_DEPRECATED_IN_2_32 -void g_thread_set_priority (GThread *thread, - GThreadPriority priority); - -GLIB_DEPRECATED_IN_2_32 -void g_thread_foreach (GFunc thread_func, - gpointer user_data); - -#ifndef G_OS_WIN32 -#include -#include -#endif - -#define g_static_mutex_get_mutex g_static_mutex_get_mutex_impl GLIB_DEPRECATED_MACRO_IN_2_32 -#define G_STATIC_MUTEX_INIT { NULL } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_init) -typedef struct -{ - GMutex *mutex; -#ifndef G_OS_WIN32 - /* only for ABI compatibility reasons */ - pthread_mutex_t unused; -#endif -} GStaticMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GMutex); - -#define g_static_mutex_lock(mutex) \ - g_mutex_lock (g_static_mutex_get_mutex (mutex)) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_lock) -#define g_static_mutex_trylock(mutex) \ - g_mutex_trylock (g_static_mutex_get_mutex (mutex)) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_trylock) -#define g_static_mutex_unlock(mutex) \ - g_mutex_unlock (g_static_mutex_get_mutex (mutex)) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_mutex_unlock) - -GLIB_DEPRECATED_IN_2_32_FOR(g_mutex_init) -void g_static_mutex_init (GStaticMutex *mutex); -GLIB_DEPRECATED_IN_2_32_FOR(g_mutex_clear) -void g_static_mutex_free (GStaticMutex *mutex); -GLIB_DEPRECATED_IN_2_32_FOR(GMutex) -GMutex *g_static_mutex_get_mutex_impl (GStaticMutex *mutex); - -typedef struct _GStaticRecMutex GStaticRecMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRecMutex); -struct _GStaticRecMutex -{ - /*< private >*/ - GStaticMutex mutex; - guint depth; - - /* ABI compat only */ - union { -#ifdef G_OS_WIN32 - void *owner; -#else - pthread_t owner; -#endif - gdouble dummy; - } unused; -} GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRecMutex); - -#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT, 0, { 0 } } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_rec_mutex_init) -GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_init) -void g_static_rec_mutex_init (GStaticRecMutex *mutex); - -GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_lock) -void g_static_rec_mutex_lock (GStaticRecMutex *mutex); - -GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_try_lock) -gboolean g_static_rec_mutex_trylock (GStaticRecMutex *mutex); - -GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_unlock) -void g_static_rec_mutex_unlock (GStaticRecMutex *mutex); - -GLIB_DEPRECATED_IN_2_32 -void g_static_rec_mutex_lock_full (GStaticRecMutex *mutex, - guint depth); - -GLIB_DEPRECATED_IN_2_32 -guint g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex); - -GLIB_DEPRECATED_IN_2_32_FOR(g_rec_mutex_free) -void g_static_rec_mutex_free (GStaticRecMutex *mutex); - -typedef struct _GStaticRWLock GStaticRWLock GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRWLock); -struct _GStaticRWLock -{ - /*< private >*/ - GStaticMutex mutex; - GCond *read_cond; - GCond *write_cond; - guint read_counter; - gboolean have_writer; - guint want_to_read; - guint want_to_write; -} GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRWLock); - -#define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_rw_lock_init) - -GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_init) -void g_static_rw_lock_init (GStaticRWLock *lock); - -GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_lock) -void g_static_rw_lock_reader_lock (GStaticRWLock *lock); - -GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_trylock) -gboolean g_static_rw_lock_reader_trylock (GStaticRWLock *lock); - -GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_reader_unlock) -void g_static_rw_lock_reader_unlock (GStaticRWLock *lock); - -GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_lock) -void g_static_rw_lock_writer_lock (GStaticRWLock *lock); - -GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_trylock) -gboolean g_static_rw_lock_writer_trylock (GStaticRWLock *lock); - -GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_writer_unlock) -void g_static_rw_lock_writer_unlock (GStaticRWLock *lock); - -GLIB_DEPRECATED_IN_2_32_FOR(g_rw_lock_free) -void g_static_rw_lock_free (GStaticRWLock *lock); - -GLIB_DEPRECATED_IN_2_32 -GPrivate * g_private_new (GDestroyNotify notify); - -typedef struct _GStaticPrivate GStaticPrivate GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate); -struct _GStaticPrivate -{ - /*< private >*/ - guint index; -} GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GPrivate); - -#define G_STATIC_PRIVATE_INIT { 0 } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(G_PRIVATE_INIT) -GLIB_DEPRECATED_IN_2_32 -void g_static_private_init (GStaticPrivate *private_key); - -GLIB_DEPRECATED_IN_2_32_FOR(g_private_get) -gpointer g_static_private_get (GStaticPrivate *private_key); - -GLIB_DEPRECATED_IN_2_32_FOR(g_private_set) -void g_static_private_set (GStaticPrivate *private_key, - gpointer data, - GDestroyNotify notify); - -GLIB_DEPRECATED_IN_2_32 -void g_static_private_free (GStaticPrivate *private_key); - -GLIB_DEPRECATED_IN_2_32 -gboolean g_once_init_enter_impl (volatile gsize *location); - -GLIB_DEPRECATED_IN_2_32 -void g_thread_init (gpointer vtable); -GLIB_DEPRECATED_IN_2_32 -void g_thread_init_with_errorcheck_mutexes (gpointer vtable); - -GLIB_DEPRECATED_IN_2_32 -gboolean g_thread_get_initialized (void); - -GLIB_VAR gboolean g_threads_got_initialized; - -#define g_thread_supported() (1) GLIB_DEPRECATED_MACRO_IN_2_32 - -GLIB_DEPRECATED_IN_2_32 -GMutex * g_mutex_new (void); -GLIB_DEPRECATED_IN_2_32 -void g_mutex_free (GMutex *mutex); -GLIB_DEPRECATED_IN_2_32 -GCond * g_cond_new (void); -GLIB_DEPRECATED_IN_2_32 -void g_cond_free (GCond *cond); -GLIB_DEPRECATED_IN_2_32 -gboolean g_cond_timed_wait (GCond *cond, - GMutex *mutex, - GTimeVal *timeval); - -G_GNUC_END_IGNORE_DEPRECATIONS - -G_END_DECLS - -#endif /* __G_DEPRECATED_THREAD_H__ */ - -/* - * Copyright © 2015 Canonical Limited - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - * - * Author: Ryan Lortie - */ - -#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) -#error "Only can be included directly." -#endif - -static inline void -g_autoptr_cleanup_generic_gfree (void *p) -{ - void **pp = (void**)p; - g_free (*pp); -} - -static inline void -g_autoptr_cleanup_gstring_free (GString *string) -{ - if (string) - g_string_free (string, TRUE); -} - -/* Ignore deprecations in case we refer to a type which was added in a more - * recent GLib version than the user’s #GLIB_VERSION_MAX_ALLOWED definition. */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -/* If adding a cleanup here, please also add a test case to - * glib/tests/autoptr.c - */ -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncQueue, g_async_queue_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBookmarkFile, g_bookmark_file_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBytes, g_bytes_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GChecksum, g_checksum_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDateTime, g_date_time_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDate, g_date_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDir, g_dir_close) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHashTable, g_hash_table_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHmac, g_hmac_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIOChannel, g_io_channel_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GKeyFile, g_key_file_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GList, g_list_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GArray, g_array_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPtrArray, g_ptr_array_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GByteArray, g_byte_array_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContext, g_main_context_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContextPusher, g_main_context_pusher_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainLoop, g_main_loop_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSource, g_source_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMappedFile, g_mapped_file_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMarkupParseContext, g_markup_parse_context_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNode, g_node_destroy) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionContext, g_option_context_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionGroup, g_option_group_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPatternSpec, g_pattern_spec_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GQueue, g_queue_free) -G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GQueue, g_queue_clear) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRand, g_rand_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRegex, g_regex_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMatchInfo, g_match_info_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GScanner, g_scanner_destroy) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSequence, g_sequence_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSList, g_slist_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GString, g_autoptr_cleanup_gstring_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStringChunk, g_string_chunk_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStrvBuilder, g_strv_builder_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GThread, g_thread_unref) -G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GMutex, g_mutex_clear) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMutexLocker, g_mutex_locker_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRecMutexLocker, g_rec_mutex_locker_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRWLockWriterLocker, g_rw_lock_writer_locker_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRWLockReaderLocker, g_rw_lock_reader_locker_free) -G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GCond, g_cond_clear) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimer, g_timer_destroy) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimeZone, g_time_zone_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTree, g_tree_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariant, g_variant_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantBuilder, g_variant_builder_unref) -G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantBuilder, g_variant_builder_clear) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantIter, g_variant_iter_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref) -G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free) -G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRefString, g_ref_string_release) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUri, g_uri_unref) - -G_GNUC_END_IGNORE_DEPRECATIONS - -#undef __GLIB_H_INSIDE__ - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_2_68 -void glib_init (void); - -GLIB_AVAILABLE_IN_2_68 -void glib_shutdown (void); - -GLIB_AVAILABLE_IN_2_68 -void glib_deinit (void); - -GLIB_AVAILABLE_IN_2_68 -void glib_prepare_to_fork (void); - -GLIB_AVAILABLE_IN_2_68 -void glib_recover_from_fork_in_parent (void); - -GLIB_AVAILABLE_IN_2_68 -void glib_recover_from_fork_in_child (void); - -G_END_DECLS - -#endif /* __G_LIB_H__ */ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ -#ifndef __G_OBJECT_H__ -#define __G_OBJECT_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ -#ifndef __G_TYPE_H__ -#define __G_TYPE_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/* Basic Type Macros - */ -/** - * G_TYPE_FUNDAMENTAL: - * @type: A #GType value. - * - * The fundamental type which is the ancestor of @type. - * Fundamental types are types that serve as ultimate bases for the derived types, - * thus they are the roots of distinct inheritance hierarchies. - */ -#define G_TYPE_FUNDAMENTAL(type) (g_type_fundamental (type)) -/** - * G_TYPE_FUNDAMENTAL_MAX: - * - * An integer constant that represents the number of identifiers reserved - * for types that are assigned at compile-time. - */ -#define G_TYPE_FUNDAMENTAL_MAX (255 << G_TYPE_FUNDAMENTAL_SHIFT) - -/* Constant fundamental types, - */ -/** - * G_TYPE_INVALID: - * - * An invalid #GType used as error return value in some functions which return - * a #GType. - */ -#define G_TYPE_INVALID G_TYPE_MAKE_FUNDAMENTAL (0) -/** - * G_TYPE_NONE: - * - * A fundamental type which is used as a replacement for the C - * void return type. - */ -#define G_TYPE_NONE G_TYPE_MAKE_FUNDAMENTAL (1) -/** - * G_TYPE_INTERFACE: - * - * The fundamental type from which all interfaces are derived. - */ -#define G_TYPE_INTERFACE G_TYPE_MAKE_FUNDAMENTAL (2) -/** - * G_TYPE_CHAR: - * - * The fundamental type corresponding to #gchar. - * The type designated by G_TYPE_CHAR is unconditionally an 8-bit signed integer. - * This may or may not be the same type a the C type "gchar". - */ -#define G_TYPE_CHAR G_TYPE_MAKE_FUNDAMENTAL (3) -/** - * G_TYPE_UCHAR: - * - * The fundamental type corresponding to #guchar. - */ -#define G_TYPE_UCHAR G_TYPE_MAKE_FUNDAMENTAL (4) -/** - * G_TYPE_BOOLEAN: - * - * The fundamental type corresponding to #gboolean. - */ -#define G_TYPE_BOOLEAN G_TYPE_MAKE_FUNDAMENTAL (5) -/** - * G_TYPE_INT: - * - * The fundamental type corresponding to #gint. - */ -#define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6) -/** - * G_TYPE_UINT: - * - * The fundamental type corresponding to #guint. - */ -#define G_TYPE_UINT G_TYPE_MAKE_FUNDAMENTAL (7) -/** - * G_TYPE_LONG: - * - * The fundamental type corresponding to #glong. - */ -#define G_TYPE_LONG G_TYPE_MAKE_FUNDAMENTAL (8) -/** - * G_TYPE_ULONG: - * - * The fundamental type corresponding to #gulong. - */ -#define G_TYPE_ULONG G_TYPE_MAKE_FUNDAMENTAL (9) -/** - * G_TYPE_INT64: - * - * The fundamental type corresponding to #gint64. - */ -#define G_TYPE_INT64 G_TYPE_MAKE_FUNDAMENTAL (10) -/** - * G_TYPE_UINT64: - * - * The fundamental type corresponding to #guint64. - */ -#define G_TYPE_UINT64 G_TYPE_MAKE_FUNDAMENTAL (11) -/** - * G_TYPE_ENUM: - * - * The fundamental type from which all enumeration types are derived. - */ -#define G_TYPE_ENUM G_TYPE_MAKE_FUNDAMENTAL (12) -/** - * G_TYPE_FLAGS: - * - * The fundamental type from which all flags types are derived. - */ -#define G_TYPE_FLAGS G_TYPE_MAKE_FUNDAMENTAL (13) -/** - * G_TYPE_FLOAT: - * - * The fundamental type corresponding to #gfloat. - */ -#define G_TYPE_FLOAT G_TYPE_MAKE_FUNDAMENTAL (14) -/** - * G_TYPE_DOUBLE: - * - * The fundamental type corresponding to #gdouble. - */ -#define G_TYPE_DOUBLE G_TYPE_MAKE_FUNDAMENTAL (15) -/** - * G_TYPE_STRING: - * - * The fundamental type corresponding to nul-terminated C strings. - */ -#define G_TYPE_STRING G_TYPE_MAKE_FUNDAMENTAL (16) -/** - * G_TYPE_POINTER: - * - * The fundamental type corresponding to #gpointer. - */ -#define G_TYPE_POINTER G_TYPE_MAKE_FUNDAMENTAL (17) -/** - * G_TYPE_BOXED: - * - * The fundamental type from which all boxed types are derived. - */ -#define G_TYPE_BOXED G_TYPE_MAKE_FUNDAMENTAL (18) -/** - * G_TYPE_PARAM: - * - * The fundamental type from which all #GParamSpec types are derived. - */ -#define G_TYPE_PARAM G_TYPE_MAKE_FUNDAMENTAL (19) -/** - * G_TYPE_OBJECT: - * - * The fundamental type for #GObject. - */ -#define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20) -/** - * G_TYPE_VARIANT: - * - * The fundamental type corresponding to #GVariant. - * - * All floating #GVariant instances passed through the #GType system are - * consumed. - * - * Note that callbacks in closures, and signal handlers - * for signals of return type %G_TYPE_VARIANT, must never return floating - * variants. - * - * Note: GLib 2.24 did include a boxed type with this name. It was replaced - * with this fundamental type in 2.26. - * - * Since: 2.26 - */ -#define G_TYPE_VARIANT G_TYPE_MAKE_FUNDAMENTAL (21) - - -/* Reserved fundamental type numbers to create new fundamental - * type IDs with G_TYPE_MAKE_FUNDAMENTAL(). - * - * Open an issue on https://gitlab.gnome.org/GNOME/glib/issues/new for - * reservations. - */ -/** - * G_TYPE_FUNDAMENTAL_SHIFT: - * - * Shift value used in converting numbers to type IDs. - */ -#define G_TYPE_FUNDAMENTAL_SHIFT (2) -/** - * G_TYPE_MAKE_FUNDAMENTAL: - * @x: the fundamental type number. - * - * Get the type ID for the fundamental type number @x. - * Use g_type_fundamental_next() instead of this macro to create new fundamental - * types. - * - * Returns: the GType - */ -#define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT)) -/** - * G_TYPE_RESERVED_GLIB_FIRST: - * - * First fundamental type number to create a new fundamental type id with - * G_TYPE_MAKE_FUNDAMENTAL() reserved for GLib. - */ -#define G_TYPE_RESERVED_GLIB_FIRST (22) -/** - * G_TYPE_RESERVED_GLIB_LAST: - * - * Last fundamental type number reserved for GLib. - */ -#define G_TYPE_RESERVED_GLIB_LAST (31) -/** - * G_TYPE_RESERVED_BSE_FIRST: - * - * First fundamental type number to create a new fundamental type id with - * G_TYPE_MAKE_FUNDAMENTAL() reserved for BSE. - */ -#define G_TYPE_RESERVED_BSE_FIRST (32) -/** - * G_TYPE_RESERVED_BSE_LAST: - * - * Last fundamental type number reserved for BSE. - */ -#define G_TYPE_RESERVED_BSE_LAST (48) -/** - * G_TYPE_RESERVED_USER_FIRST: - * - * First available fundamental type number to create new fundamental - * type id with G_TYPE_MAKE_FUNDAMENTAL(). - */ -#define G_TYPE_RESERVED_USER_FIRST (49) - - -/* Type Checking Macros - */ -/** - * G_TYPE_IS_FUNDAMENTAL: - * @type: A #GType value - * - * Checks if @type is a fundamental type. - * - * Returns: %TRUE on success - */ -#define G_TYPE_IS_FUNDAMENTAL(type) ((type) <= G_TYPE_FUNDAMENTAL_MAX) -/** - * G_TYPE_IS_DERIVED: - * @type: A #GType value - * - * Checks if @type is derived (or in object-oriented terminology: - * inherited) from another type (this holds true for all non-fundamental - * types). - * - * Returns: %TRUE on success - */ -#define G_TYPE_IS_DERIVED(type) ((type) > G_TYPE_FUNDAMENTAL_MAX) -/** - * G_TYPE_IS_INTERFACE: - * @type: A #GType value - * - * Checks if @type is an interface type. - * An interface type provides a pure API, the implementation - * of which is provided by another type (which is then said to conform - * to the interface). GLib interfaces are somewhat analogous to Java - * interfaces and C++ classes containing only pure virtual functions, - * with the difference that GType interfaces are not derivable (but see - * g_type_interface_add_prerequisite() for an alternative). - * - * Returns: %TRUE on success - */ -#define G_TYPE_IS_INTERFACE(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_INTERFACE) -/** - * G_TYPE_IS_CLASSED: - * @type: A #GType value - * - * Checks if @type is a classed type. - * - * Returns: %TRUE on success - */ -#define G_TYPE_IS_CLASSED(type) (g_type_test_flags ((type), G_TYPE_FLAG_CLASSED)) -/** - * G_TYPE_IS_INSTANTIATABLE: - * @type: A #GType value - * - * Checks if @type can be instantiated. Instantiation is the - * process of creating an instance (object) of this type. - * - * Returns: %TRUE on success - */ -#define G_TYPE_IS_INSTANTIATABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_INSTANTIATABLE)) -/** - * G_TYPE_IS_DERIVABLE: - * @type: A #GType value - * - * Checks if @type is a derivable type. A derivable type can - * be used as the base class of a flat (single-level) class hierarchy. - * - * Returns: %TRUE on success - */ -#define G_TYPE_IS_DERIVABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_DERIVABLE)) -/** - * G_TYPE_IS_DEEP_DERIVABLE: - * @type: A #GType value - * - * Checks if @type is a deep derivable type. A deep derivable type - * can be used as the base class of a deep (multi-level) class hierarchy. - * - * Returns: %TRUE on success - */ -#define G_TYPE_IS_DEEP_DERIVABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_DEEP_DERIVABLE)) -/** - * G_TYPE_IS_ABSTRACT: - * @type: A #GType value - * - * Checks if @type is an abstract type. An abstract type cannot be - * instantiated and is normally used as an abstract base class for - * derived classes. - * - * Returns: %TRUE on success - */ -#define G_TYPE_IS_ABSTRACT(type) (g_type_test_flags ((type), G_TYPE_FLAG_ABSTRACT)) -/** - * G_TYPE_IS_VALUE_ABSTRACT: - * @type: A #GType value - * - * Checks if @type is an abstract value type. An abstract value type introduces - * a value table, but can't be used for g_value_init() and is normally used as - * an abstract base type for derived value types. - * - * Returns: %TRUE on success - */ -#define G_TYPE_IS_VALUE_ABSTRACT(type) (g_type_test_flags ((type), G_TYPE_FLAG_VALUE_ABSTRACT)) -/** - * G_TYPE_IS_VALUE_TYPE: - * @type: A #GType value - * - * Checks if @type is a value type and can be used with g_value_init(). - * - * Returns: %TRUE on success - */ -#define G_TYPE_IS_VALUE_TYPE(type) (g_type_check_is_value_type (type)) -/** - * G_TYPE_HAS_VALUE_TABLE: - * @type: A #GType value - * - * Checks if @type has a #GTypeValueTable. - * - * Returns: %TRUE on success - */ -#define G_TYPE_HAS_VALUE_TABLE(type) (g_type_value_table_peek (type) != NULL) - - -/* Typedefs - */ -/** - * GType: - * - * A numerical value which represents the unique identifier of a registered - * type. - */ -#if GLIB_SIZEOF_SIZE_T != GLIB_SIZEOF_LONG || !defined __cplusplus -typedef gsize GType; -#else /* for historic reasons, C++ links against gulong GTypes */ -typedef gulong GType; -#endif -typedef struct _GValue GValue; -typedef union _GTypeCValue GTypeCValue; -typedef struct _GTypePlugin GTypePlugin; -typedef struct _GTypeClass GTypeClass; -typedef struct _GTypeInterface GTypeInterface; -typedef struct _GTypeInstance GTypeInstance; -typedef struct _GTypeInfo GTypeInfo; -typedef struct _GTypeFundamentalInfo GTypeFundamentalInfo; -typedef struct _GInterfaceInfo GInterfaceInfo; -typedef struct _GTypeValueTable GTypeValueTable; -typedef struct _GTypeQuery GTypeQuery; - - -/* Basic Type Structures - */ -/** - * GTypeClass: - * - * An opaque structure used as the base of all classes. - */ -struct _GTypeClass -{ - /*< private >*/ - GType g_type; -}; -/** - * GTypeInstance: - * - * An opaque structure used as the base of all type instances. - */ -struct _GTypeInstance -{ - /*< private >*/ - GTypeClass *g_class; -}; -/** - * GTypeInterface: - * - * An opaque structure used as the base of all interface types. - */ -struct _GTypeInterface -{ - /*< private >*/ - GType g_type; /* iface type */ - GType g_instance_type; -}; -/** - * GTypeQuery: - * @type: the #GType value of the type - * @type_name: the name of the type - * @class_size: the size of the class structure - * @instance_size: the size of the instance structure - * - * A structure holding information for a specific type. - * It is filled in by the g_type_query() function. - */ -struct _GTypeQuery -{ - GType type; - const gchar *type_name; - guint class_size; - guint instance_size; -}; - - -/* Casts, checks and accessors for structured types - * usage of these macros is reserved to type implementations only - */ -/*< protected >*/ -/** - * G_TYPE_CHECK_INSTANCE: - * @instance: Location of a #GTypeInstance structure - * - * Checks if @instance is a valid #GTypeInstance structure, - * otherwise issues a warning and returns %FALSE. %NULL is not a valid - * #GTypeInstance. - * - * This macro should only be used in type implementations. - * - * Returns: %TRUE on success - */ -#define G_TYPE_CHECK_INSTANCE(instance) (_G_TYPE_CHI ((GTypeInstance*) (instance))) -/** - * G_TYPE_CHECK_INSTANCE_CAST: - * @instance: (nullable): Location of a #GTypeInstance structure - * @g_type: The type to be returned - * @c_type: The corresponding C type of @g_type - * - * Checks that @instance is an instance of the type identified by @g_type - * and issues a warning if this is not the case. Returns @instance casted - * to a pointer to @c_type. - * - * No warning will be issued if @instance is %NULL, and %NULL will be returned. - * - * This macro should only be used in type implementations. - */ -#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) -/** - * G_TYPE_CHECK_INSTANCE_TYPE: - * @instance: (nullable): Location of a #GTypeInstance structure. - * @g_type: The type to be checked - * - * Checks if @instance is an instance of the type identified by @g_type. If - * @instance is %NULL, %FALSE will be returned. - * - * This macro should only be used in type implementations. - * - * Returns: %TRUE on success - */ -#define G_TYPE_CHECK_INSTANCE_TYPE(instance, g_type) (_G_TYPE_CIT ((instance), (g_type))) -/** - * G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE: - * @instance: (nullable): Location of a #GTypeInstance structure. - * @g_type: The fundamental type to be checked - * - * Checks if @instance is an instance of the fundamental type identified by @g_type. - * If @instance is %NULL, %FALSE will be returned. - * - * This macro should only be used in type implementations. - * - * Returns: %TRUE on success - */ -#define G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE(instance, g_type) (_G_TYPE_CIFT ((instance), (g_type))) -/** - * G_TYPE_INSTANCE_GET_CLASS: - * @instance: Location of the #GTypeInstance structure - * @g_type: The #GType of the class to be returned - * @c_type: The C type of the class structure - * - * Get the class structure of a given @instance, casted - * to a specified ancestor type @g_type of the instance. - * - * Note that while calling a GInstanceInitFunc(), the class pointer - * gets modified, so it might not always return the expected pointer. - * - * This macro should only be used in type implementations. - * - * Returns: a pointer to the class structure - */ -#define G_TYPE_INSTANCE_GET_CLASS(instance, g_type, c_type) (_G_TYPE_IGC ((instance), (g_type), c_type)) -/** - * G_TYPE_INSTANCE_GET_INTERFACE: - * @instance: Location of the #GTypeInstance structure - * @g_type: The #GType of the interface to be returned - * @c_type: The C type of the interface structure - * - * Get the interface structure for interface @g_type of a given @instance. - * - * This macro should only be used in type implementations. - * - * Returns: a pointer to the interface structure - */ -#define G_TYPE_INSTANCE_GET_INTERFACE(instance, g_type, c_type) (_G_TYPE_IGI ((instance), (g_type), c_type)) -/** - * G_TYPE_CHECK_CLASS_CAST: - * @g_class: Location of a #GTypeClass structure - * @g_type: The type to be returned - * @c_type: The corresponding C type of class structure of @g_type - * - * Checks that @g_class is a class structure of the type identified by @g_type - * and issues a warning if this is not the case. Returns @g_class casted - * to a pointer to @c_type. %NULL is not a valid class structure. - * - * This macro should only be used in type implementations. - */ -#define G_TYPE_CHECK_CLASS_CAST(g_class, g_type, c_type) (_G_TYPE_CCC ((g_class), (g_type), c_type)) -/** - * G_TYPE_CHECK_CLASS_TYPE: - * @g_class: (nullable): Location of a #GTypeClass structure - * @g_type: The type to be checked - * - * Checks if @g_class is a class structure of the type identified by - * @g_type. If @g_class is %NULL, %FALSE will be returned. - * - * This macro should only be used in type implementations. - * - * Returns: %TRUE on success - */ -#define G_TYPE_CHECK_CLASS_TYPE(g_class, g_type) (_G_TYPE_CCT ((g_class), (g_type))) -/** - * G_TYPE_CHECK_VALUE: - * @value: a #GValue - * - * Checks if @value has been initialized to hold values - * of a value type. - * - * This macro should only be used in type implementations. - * - * Returns: %TRUE on success - */ -#define G_TYPE_CHECK_VALUE(value) (_G_TYPE_CHV ((value))) -/** - * G_TYPE_CHECK_VALUE_TYPE: - * @value: a #GValue - * @g_type: The type to be checked - * - * Checks if @value has been initialized to hold values - * of type @g_type. - * - * This macro should only be used in type implementations. - * - * Returns: %TRUE on success - */ -#define G_TYPE_CHECK_VALUE_TYPE(value, g_type) (_G_TYPE_CVH ((value), (g_type))) -/** - * G_TYPE_FROM_INSTANCE: - * @instance: Location of a valid #GTypeInstance structure - * - * Get the type identifier from a given @instance structure. - * - * This macro should only be used in type implementations. - * - * Returns: the #GType - */ -#define G_TYPE_FROM_INSTANCE(instance) (G_TYPE_FROM_CLASS (((GTypeInstance*) (instance))->g_class)) -/** - * G_TYPE_FROM_CLASS: - * @g_class: Location of a valid #GTypeClass structure - * - * Get the type identifier from a given @class structure. - * - * This macro should only be used in type implementations. - * - * Returns: the #GType - */ -#define G_TYPE_FROM_CLASS(g_class) (((GTypeClass*) (g_class))->g_type) -/** - * G_TYPE_FROM_INTERFACE: - * @g_iface: Location of a valid #GTypeInterface structure - * - * Get the type identifier from a given @interface structure. - * - * This macro should only be used in type implementations. - * - * Returns: the #GType - */ -#define G_TYPE_FROM_INTERFACE(g_iface) (((GTypeInterface*) (g_iface))->g_type) - -/** - * G_TYPE_INSTANCE_GET_PRIVATE: - * @instance: the instance of a type deriving from @private_type - * @g_type: the type identifying which private data to retrieve - * @c_type: The C type for the private structure - * - * Gets the private structure for a particular type. - * The private structure must have been registered in the - * class_init function with g_type_class_add_private(). - * - * This macro should only be used in type implementations. - * - * Since: 2.4 - * Deprecated: 2.58: Use %G_ADD_PRIVATE and the generated - * `your_type_get_instance_private()` function instead - * Returns: (not nullable): a pointer to the private data structure - */ -#define G_TYPE_INSTANCE_GET_PRIVATE(instance, g_type, c_type) ((c_type*) g_type_instance_get_private ((GTypeInstance*) (instance), (g_type))) GLIB_DEPRECATED_MACRO_IN_2_58_FOR(G_ADD_PRIVATE) - -/** - * G_TYPE_CLASS_GET_PRIVATE: - * @klass: the class of a type deriving from @private_type - * @g_type: the type identifying which private data to retrieve - * @c_type: The C type for the private structure - * - * Gets the private class structure for a particular type. - * The private structure must have been registered in the - * get_type() function with g_type_add_class_private(). - * - * This macro should only be used in type implementations. - * - * Since: 2.24 - * Returns: (not nullable): a pointer to the private data structure - */ -#define G_TYPE_CLASS_GET_PRIVATE(klass, g_type, c_type) ((c_type*) g_type_class_get_private ((GTypeClass*) (klass), (g_type))) - -/** - * GTypeDebugFlags: - * @G_TYPE_DEBUG_NONE: Print no messages - * @G_TYPE_DEBUG_OBJECTS: Print messages about object bookkeeping - * @G_TYPE_DEBUG_SIGNALS: Print messages about signal emissions - * @G_TYPE_DEBUG_MASK: Mask covering all debug flags - * @G_TYPE_DEBUG_INSTANCE_COUNT: Keep a count of instances of each type - * - * These flags used to be passed to g_type_init_with_debug_flags() which - * is now deprecated. - * - * If you need to enable debugging features, use the GOBJECT_DEBUG - * environment variable. - * - * Deprecated: 2.36: g_type_init() is now done automatically - */ -typedef enum /*< skip >*/ -{ - G_TYPE_DEBUG_NONE = 0, - G_TYPE_DEBUG_OBJECTS = 1 << 0, - G_TYPE_DEBUG_SIGNALS = 1 << 1, - G_TYPE_DEBUG_INSTANCE_COUNT = 1 << 2, - G_TYPE_DEBUG_MASK = 0x07 -} GTypeDebugFlags GLIB_DEPRECATED_TYPE_IN_2_36; - - -/* --- prototypes --- */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -GLIB_DEPRECATED_IN_2_36 -void g_type_init (void); -GLIB_DEPRECATED_IN_2_36 -void g_type_init_with_debug_flags (GTypeDebugFlags debug_flags); -G_GNUC_END_IGNORE_DEPRECATIONS - -GLIB_AVAILABLE_IN_ALL -const gchar * g_type_name (GType type); -GLIB_AVAILABLE_IN_ALL -GQuark g_type_qname (GType type); -GLIB_AVAILABLE_IN_ALL -GType g_type_from_name (const gchar *name); -GLIB_AVAILABLE_IN_ALL -GType g_type_parent (GType type); -GLIB_AVAILABLE_IN_ALL -guint g_type_depth (GType type); -GLIB_AVAILABLE_IN_ALL -GType g_type_next_base (GType leaf_type, - GType root_type); -GLIB_AVAILABLE_IN_ALL -gboolean g_type_is_a (GType type, - GType is_a_type); -GLIB_AVAILABLE_IN_ALL -gpointer g_type_class_ref (GType type); -GLIB_AVAILABLE_IN_ALL -gpointer g_type_class_peek (GType type); -GLIB_AVAILABLE_IN_ALL -gpointer g_type_class_peek_static (GType type); -GLIB_AVAILABLE_IN_ALL -void g_type_class_unref (gpointer g_class); -GLIB_AVAILABLE_IN_ALL -gpointer g_type_class_peek_parent (gpointer g_class); -GLIB_AVAILABLE_IN_ALL -gpointer g_type_interface_peek (gpointer instance_class, - GType iface_type); -GLIB_AVAILABLE_IN_ALL -gpointer g_type_interface_peek_parent (gpointer g_iface); - -GLIB_AVAILABLE_IN_ALL -gpointer g_type_default_interface_ref (GType g_type); -GLIB_AVAILABLE_IN_ALL -gpointer g_type_default_interface_peek (GType g_type); -GLIB_AVAILABLE_IN_ALL -void g_type_default_interface_unref (gpointer g_iface); - -/* g_free() the returned arrays */ -GLIB_AVAILABLE_IN_ALL -GType* g_type_children (GType type, - guint *n_children); -GLIB_AVAILABLE_IN_ALL -GType* g_type_interfaces (GType type, - guint *n_interfaces); - -/* per-type _static_ data */ -GLIB_AVAILABLE_IN_ALL -void g_type_set_qdata (GType type, - GQuark quark, - gpointer data); -GLIB_AVAILABLE_IN_ALL -gpointer g_type_get_qdata (GType type, - GQuark quark); -GLIB_AVAILABLE_IN_ALL -void g_type_query (GType type, - GTypeQuery *query); - -GLIB_AVAILABLE_IN_2_44 -int g_type_get_instance_count (GType type); - -/* --- type registration --- */ -/** - * GBaseInitFunc: - * @g_class: (type GObject.TypeClass): The #GTypeClass structure to initialize - * - * A callback function used by the type system to do base initialization - * of the class structures of derived types. It is called as part of the - * initialization process of all derived classes and should reallocate - * or reset all dynamic class members copied over from the parent class. - * For example, class members (such as strings) that are not sufficiently - * handled by a plain memory copy of the parent class into the derived class - * have to be altered. See GClassInitFunc() for a discussion of the class - * initialization process. - */ -typedef void (*GBaseInitFunc) (gpointer g_class); -/** - * GBaseFinalizeFunc: - * @g_class: (type GObject.TypeClass): The #GTypeClass structure to finalize - * - * A callback function used by the type system to finalize those portions - * of a derived types class structure that were setup from the corresponding - * GBaseInitFunc() function. Class finalization basically works the inverse - * way in which class initialization is performed. - * See GClassInitFunc() for a discussion of the class initialization process. - */ -typedef void (*GBaseFinalizeFunc) (gpointer g_class); -/** - * GClassInitFunc: - * @g_class: (type GObject.TypeClass): The #GTypeClass structure to initialize. - * @class_data: The @class_data member supplied via the #GTypeInfo structure. - * - * A callback function used by the type system to initialize the class - * of a specific type. This function should initialize all static class - * members. - * - * The initialization process of a class involves: - * - * - Copying common members from the parent class over to the - * derived class structure. - * - Zero initialization of the remaining members not copied - * over from the parent class. - * - Invocation of the GBaseInitFunc() initializers of all parent - * types and the class' type. - * - Invocation of the class' GClassInitFunc() initializer. - * - * Since derived classes are partially initialized through a memory copy - * of the parent class, the general rule is that GBaseInitFunc() and - * GBaseFinalizeFunc() should take care of necessary reinitialization - * and release of those class members that were introduced by the type - * that specified these GBaseInitFunc()/GBaseFinalizeFunc(). - * GClassInitFunc() should only care about initializing static - * class members, while dynamic class members (such as allocated strings - * or reference counted resources) are better handled by a GBaseInitFunc() - * for this type, so proper initialization of the dynamic class members - * is performed for class initialization of derived types as well. - * - * An example may help to correspond the intend of the different class - * initializers: - * - * |[ - * typedef struct { - * GObjectClass parent_class; - * gint static_integer; - * gchar *dynamic_string; - * } TypeAClass; - * static void - * type_a_base_class_init (TypeAClass *class) - * { - * class->dynamic_string = g_strdup ("some string"); - * } - * static void - * type_a_base_class_finalize (TypeAClass *class) - * { - * g_free (class->dynamic_string); - * } - * static void - * type_a_class_init (TypeAClass *class) - * { - * class->static_integer = 42; - * } - * - * typedef struct { - * TypeAClass parent_class; - * gfloat static_float; - * GString *dynamic_gstring; - * } TypeBClass; - * static void - * type_b_base_class_init (TypeBClass *class) - * { - * class->dynamic_gstring = g_string_new ("some other string"); - * } - * static void - * type_b_base_class_finalize (TypeBClass *class) - * { - * g_string_free (class->dynamic_gstring); - * } - * static void - * type_b_class_init (TypeBClass *class) - * { - * class->static_float = 3.14159265358979323846; - * } - * ]| - * Initialization of TypeBClass will first cause initialization of - * TypeAClass (derived classes reference their parent classes, see - * g_type_class_ref() on this). - * - * Initialization of TypeAClass roughly involves zero-initializing its fields, - * then calling its GBaseInitFunc() type_a_base_class_init() to allocate - * its dynamic members (dynamic_string), and finally calling its GClassInitFunc() - * type_a_class_init() to initialize its static members (static_integer). - * The first step in the initialization process of TypeBClass is then - * a plain memory copy of the contents of TypeAClass into TypeBClass and - * zero-initialization of the remaining fields in TypeBClass. - * The dynamic members of TypeAClass within TypeBClass now need - * reinitialization which is performed by calling type_a_base_class_init() - * with an argument of TypeBClass. - * - * After that, the GBaseInitFunc() of TypeBClass, type_b_base_class_init() - * is called to allocate the dynamic members of TypeBClass (dynamic_gstring), - * and finally the GClassInitFunc() of TypeBClass, type_b_class_init(), - * is called to complete the initialization process with the static members - * (static_float). - * - * Corresponding finalization counter parts to the GBaseInitFunc() functions - * have to be provided to release allocated resources at class finalization - * time. - */ -typedef void (*GClassInitFunc) (gpointer g_class, - gpointer class_data); -/** - * GClassFinalizeFunc: - * @g_class: (type GObject.TypeClass): The #GTypeClass structure to finalize - * @class_data: The @class_data member supplied via the #GTypeInfo structure - * - * A callback function used by the type system to finalize a class. - * This function is rarely needed, as dynamically allocated class resources - * should be handled by GBaseInitFunc() and GBaseFinalizeFunc(). - * Also, specification of a GClassFinalizeFunc() in the #GTypeInfo - * structure of a static type is invalid, because classes of static types - * will never be finalized (they are artificially kept alive when their - * reference count drops to zero). - */ -typedef void (*GClassFinalizeFunc) (gpointer g_class, - gpointer class_data); -/** - * GInstanceInitFunc: - * @instance: The instance to initialize - * @g_class: (type GObject.TypeClass): The class of the type the instance is - * created for - * - * A callback function used by the type system to initialize a new - * instance of a type. This function initializes all instance members and - * allocates any resources required by it. - * - * Initialization of a derived instance involves calling all its parent - * types instance initializers, so the class member of the instance - * is altered during its initialization to always point to the class that - * belongs to the type the current initializer was introduced for. - * - * The extended members of @instance are guaranteed to have been filled with - * zeros before this function is called. - */ -typedef void (*GInstanceInitFunc) (GTypeInstance *instance, - gpointer g_class); -/** - * GInterfaceInitFunc: - * @g_iface: (type GObject.TypeInterface): The interface structure to initialize - * @iface_data: The @interface_data supplied via the #GInterfaceInfo structure - * - * A callback function used by the type system to initialize a new - * interface. This function should initialize all internal data and - * allocate any resources required by the interface. - * - * The members of @iface_data are guaranteed to have been filled with - * zeros before this function is called. - */ -typedef void (*GInterfaceInitFunc) (gpointer g_iface, - gpointer iface_data); -/** - * GInterfaceFinalizeFunc: - * @g_iface: (type GObject.TypeInterface): The interface structure to finalize - * @iface_data: The @interface_data supplied via the #GInterfaceInfo structure - * - * A callback function used by the type system to finalize an interface. - * This function should destroy any internal data and release any resources - * allocated by the corresponding GInterfaceInitFunc() function. - */ -typedef void (*GInterfaceFinalizeFunc) (gpointer g_iface, - gpointer iface_data); -/** - * GTypeClassCacheFunc: - * @cache_data: data that was given to the g_type_add_class_cache_func() call - * @g_class: (type GObject.TypeClass): The #GTypeClass structure which is - * unreferenced - * - * A callback function which is called when the reference count of a class - * drops to zero. It may use g_type_class_ref() to prevent the class from - * being freed. You should not call g_type_class_unref() from a - * #GTypeClassCacheFunc function to prevent infinite recursion, use - * g_type_class_unref_uncached() instead. - * - * The functions have to check the class id passed in to figure - * whether they actually want to cache the class of this type, since all - * classes are routed through the same #GTypeClassCacheFunc chain. - * - * Returns: %TRUE to stop further #GTypeClassCacheFuncs from being - * called, %FALSE to continue - */ -typedef gboolean (*GTypeClassCacheFunc) (gpointer cache_data, - GTypeClass *g_class); -/** - * GTypeInterfaceCheckFunc: - * @check_data: data passed to g_type_add_interface_check() - * @g_iface: (type GObject.TypeInterface): the interface that has been - * initialized - * - * A callback called after an interface vtable is initialized. - * See g_type_add_interface_check(). - * - * Since: 2.4 - */ -typedef void (*GTypeInterfaceCheckFunc) (gpointer check_data, - gpointer g_iface); -/** - * GTypeFundamentalFlags: - * @G_TYPE_FLAG_CLASSED: Indicates a classed type - * @G_TYPE_FLAG_INSTANTIATABLE: Indicates an instantiatable type (implies classed) - * @G_TYPE_FLAG_DERIVABLE: Indicates a flat derivable type - * @G_TYPE_FLAG_DEEP_DERIVABLE: Indicates a deep derivable type (implies derivable) - * - * Bit masks used to check or determine specific characteristics of a - * fundamental type. - */ -typedef enum /*< skip >*/ -{ - G_TYPE_FLAG_CLASSED = (1 << 0), - G_TYPE_FLAG_INSTANTIATABLE = (1 << 1), - G_TYPE_FLAG_DERIVABLE = (1 << 2), - G_TYPE_FLAG_DEEP_DERIVABLE = (1 << 3) -} GTypeFundamentalFlags; -/** - * GTypeFlags: - * @G_TYPE_FLAG_ABSTRACT: Indicates an abstract type. No instances can be - * created for an abstract type - * @G_TYPE_FLAG_VALUE_ABSTRACT: Indicates an abstract value type, i.e. a type - * that introduces a value table, but can't be used for - * g_value_init() - * - * Bit masks used to check or determine characteristics of a type. - */ -typedef enum /*< skip >*/ -{ - G_TYPE_FLAG_ABSTRACT = (1 << 4), - G_TYPE_FLAG_VALUE_ABSTRACT = (1 << 5) -} GTypeFlags; -/** - * GTypeInfo: - * @class_size: Size of the class structure (required for interface, classed and instantiatable types) - * @base_init: Location of the base initialization function (optional) - * @base_finalize: Location of the base finalization function (optional) - * @class_init: Location of the class initialization function for - * classed and instantiatable types. Location of the default vtable - * inititalization function for interface types. (optional) This function - * is used both to fill in virtual functions in the class or default vtable, - * and to do type-specific setup such as registering signals and object - * properties. - * @class_finalize: Location of the class finalization function for - * classed and instantiatable types. Location of the default vtable - * finalization function for interface types. (optional) - * @class_data: User-supplied data passed to the class init/finalize functions - * @instance_size: Size of the instance (object) structure (required for instantiatable types only) - * @n_preallocs: Prior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10, it is ignored, since instances are allocated with the [slice allocator][glib-Memory-Slices] now. - * @instance_init: Location of the instance initialization function (optional, for instantiatable types only) - * @value_table: A #GTypeValueTable function table for generic handling of GValues - * of this type (usually only useful for fundamental types) - * - * This structure is used to provide the type system with the information - * required to initialize and destruct (finalize) a type's class and - * its instances. - * - * The initialized structure is passed to the g_type_register_static() function - * (or is copied into the provided #GTypeInfo structure in the - * g_type_plugin_complete_type_info()). The type system will perform a deep - * copy of this structure, so its memory does not need to be persistent - * across invocation of g_type_register_static(). - */ -struct _GTypeInfo -{ - /* interface types, classed types, instantiated types */ - guint16 class_size; - - GBaseInitFunc base_init; - GBaseFinalizeFunc base_finalize; - - /* interface types, classed types, instantiated types */ - GClassInitFunc class_init; - GClassFinalizeFunc class_finalize; - gconstpointer class_data; - - /* instantiated types */ - guint16 instance_size; - guint16 n_preallocs; - GInstanceInitFunc instance_init; - - /* value handling */ - const GTypeValueTable *value_table; -}; -/** - * GTypeFundamentalInfo: - * @type_flags: #GTypeFundamentalFlags describing the characteristics of the fundamental type - * - * A structure that provides information to the type system which is - * used specifically for managing fundamental types. - */ -struct _GTypeFundamentalInfo -{ - GTypeFundamentalFlags type_flags; -}; -/** - * GInterfaceInfo: - * @interface_init: location of the interface initialization function - * @interface_finalize: location of the interface finalization function - * @interface_data: user-supplied data passed to the interface init/finalize functions - * - * A structure that provides information to the type system which is - * used specifically for managing interface types. - */ -struct _GInterfaceInfo -{ - GInterfaceInitFunc interface_init; - GInterfaceFinalizeFunc interface_finalize; - gpointer interface_data; -}; -/** - * GTypeValueTable: - * @value_init: Default initialize @values contents by poking values - * directly into the value->data array. The data array of - * the #GValue passed into this function was zero-filled - * with `memset()`, so no care has to be taken to free any - * old contents. E.g. for the implementation of a string - * value that may never be %NULL, the implementation might - * look like: - * |[ - * value->data[0].v_pointer = g_strdup (""); - * ]| - * @value_free: Free any old contents that might be left in the - * data array of the passed in @value. No resources may - * remain allocated through the #GValue contents after - * this function returns. E.g. for our above string type: - * |[ - * // only free strings without a specific flag for static storage - * if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS)) - * g_free (value->data[0].v_pointer); - * ]| - * @value_copy: @dest_value is a #GValue with zero-filled data section - * and @src_value is a properly setup #GValue of same or - * derived type. - * The purpose of this function is to copy the contents of - * @src_value into @dest_value in a way, that even after - * @src_value has been freed, the contents of @dest_value - * remain valid. String type example: - * |[ - * dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer); - * ]| - * @value_peek_pointer: If the value contents fit into a pointer, such as objects - * or strings, return this pointer, so the caller can peek at - * the current contents. To extend on our above string example: - * |[ - * return value->data[0].v_pointer; - * ]| - * @collect_format: A string format describing how to collect the contents of - * this value bit-by-bit. Each character in the format represents - * an argument to be collected, and the characters themselves indicate - * the type of the argument. Currently supported arguments are: - * - 'i' - Integers. passed as collect_values[].v_int. - * - 'l' - Longs. passed as collect_values[].v_long. - * - 'd' - Doubles. passed as collect_values[].v_double. - * - 'p' - Pointers. passed as collect_values[].v_pointer. - * It should be noted that for variable argument list construction, - * ANSI C promotes every type smaller than an integer to an int, and - * floats to doubles. So for collection of short int or char, 'i' - * needs to be used, and for collection of floats 'd'. - * @collect_value: The collect_value() function is responsible for converting the - * values collected from a variable argument list into contents - * suitable for storage in a GValue. This function should setup - * @value similar to value_init(); e.g. for a string value that - * does not allow %NULL pointers, it needs to either spew an error, - * or do an implicit conversion by storing an empty string. - * The @value passed in to this function has a zero-filled data - * array, so just like for value_init() it is guaranteed to not - * contain any old contents that might need freeing. - * @n_collect_values is exactly the string length of @collect_format, - * and @collect_values is an array of unions #GTypeCValue with - * length @n_collect_values, containing the collected values - * according to @collect_format. - * @collect_flags is an argument provided as a hint by the caller. - * It may contain the flag %G_VALUE_NOCOPY_CONTENTS indicating, - * that the collected value contents may be considered "static" - * for the duration of the @value lifetime. - * Thus an extra copy of the contents stored in @collect_values is - * not required for assignment to @value. - * For our above string example, we continue with: - * |[ - * if (!collect_values[0].v_pointer) - * value->data[0].v_pointer = g_strdup (""); - * else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) - * { - * value->data[0].v_pointer = collect_values[0].v_pointer; - * // keep a flag for the value_free() implementation to not free this string - * value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS; - * } - * else - * value->data[0].v_pointer = g_strdup (collect_values[0].v_pointer); - * return NULL; - * ]| - * It should be noted, that it is generally a bad idea to follow the - * #G_VALUE_NOCOPY_CONTENTS hint for reference counted types. Due to - * reentrancy requirements and reference count assertions performed - * by the signal emission code, reference counts should always be - * incremented for reference counted contents stored in the value->data - * array. To deviate from our string example for a moment, and taking - * a look at an exemplary implementation for collect_value() of - * #GObject: - * |[ - * GObject *object = G_OBJECT (collect_values[0].v_pointer); - * g_return_val_if_fail (object != NULL, - * g_strdup_printf ("Object passed as invalid NULL pointer")); - * // never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types - * value->data[0].v_pointer = g_object_ref (object); - * return NULL; - * ]| - * The reference count for valid objects is always incremented, - * regardless of @collect_flags. For invalid objects, the example - * returns a newly allocated string without altering @value. - * Upon success, collect_value() needs to return %NULL. If, however, - * an error condition occurred, collect_value() may spew an - * error by returning a newly allocated non-%NULL string, giving - * a suitable description of the error condition. - * The calling code makes no assumptions about the @value - * contents being valid upon error returns, @value - * is simply thrown away without further freeing. As such, it is - * a good idea to not allocate #GValue contents, prior to returning - * an error, however, collect_values() is not obliged to return - * a correctly setup @value for error returns, simply because - * any non-%NULL return is considered a fatal condition so further - * program behaviour is undefined. - * @lcopy_format: Format description of the arguments to collect for @lcopy_value, - * analogous to @collect_format. Usually, @lcopy_format string consists - * only of 'p's to provide lcopy_value() with pointers to storage locations. - * @lcopy_value: This function is responsible for storing the @value contents into - * arguments passed through a variable argument list which got - * collected into @collect_values according to @lcopy_format. - * @n_collect_values equals the string length of @lcopy_format, - * and @collect_flags may contain %G_VALUE_NOCOPY_CONTENTS. - * In contrast to collect_value(), lcopy_value() is obliged to - * always properly support %G_VALUE_NOCOPY_CONTENTS. - * Similar to collect_value() the function may prematurely abort - * by returning a newly allocated string describing an error condition. - * To complete the string example: - * |[ - * gchar **string_p = collect_values[0].v_pointer; - * g_return_val_if_fail (string_p != NULL, - * g_strdup_printf ("string location passed as NULL")); - * if (collect_flags & G_VALUE_NOCOPY_CONTENTS) - * *string_p = value->data[0].v_pointer; - * else - * *string_p = g_strdup (value->data[0].v_pointer); - * ]| - * And an illustrative version of lcopy_value() for - * reference-counted types: - * |[ - * GObject **object_p = collect_values[0].v_pointer; - * g_return_val_if_fail (object_p != NULL, - * g_strdup_printf ("object location passed as NULL")); - * if (!value->data[0].v_pointer) - * *object_p = NULL; - * else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) // always honour - * *object_p = value->data[0].v_pointer; - * else - * *object_p = g_object_ref (value->data[0].v_pointer); - * return NULL; - * ]| - * - * The #GTypeValueTable provides the functions required by the #GValue - * implementation, to serve as a container for values of a type. - */ - -struct _GTypeValueTable -{ - void (*value_init) (GValue *value); - void (*value_free) (GValue *value); - void (*value_copy) (const GValue *src_value, - GValue *dest_value); - /* varargs functionality (optional) */ - gpointer (*value_peek_pointer) (const GValue *value); - const gchar *collect_format; - gchar* (*collect_value) (GValue *value, - guint n_collect_values, - GTypeCValue *collect_values, - guint collect_flags); - const gchar *lcopy_format; - gchar* (*lcopy_value) (const GValue *value, - guint n_collect_values, - GTypeCValue *collect_values, - guint collect_flags); -}; -GLIB_AVAILABLE_IN_ALL -GType g_type_register_static (GType parent_type, - const gchar *type_name, - const GTypeInfo *info, - GTypeFlags flags); -GLIB_AVAILABLE_IN_ALL -GType g_type_register_static_simple (GType parent_type, - const gchar *type_name, - guint class_size, - GClassInitFunc class_init, - guint instance_size, - GInstanceInitFunc instance_init, - GTypeFlags flags); - -GLIB_AVAILABLE_IN_ALL -GType g_type_register_dynamic (GType parent_type, - const gchar *type_name, - GTypePlugin *plugin, - GTypeFlags flags); -GLIB_AVAILABLE_IN_ALL -GType g_type_register_fundamental (GType type_id, - const gchar *type_name, - const GTypeInfo *info, - const GTypeFundamentalInfo *finfo, - GTypeFlags flags); -GLIB_AVAILABLE_IN_ALL -void g_type_add_interface_static (GType instance_type, - GType interface_type, - const GInterfaceInfo *info); -GLIB_AVAILABLE_IN_ALL -void g_type_add_interface_dynamic (GType instance_type, - GType interface_type, - GTypePlugin *plugin); -GLIB_AVAILABLE_IN_ALL -void g_type_interface_add_prerequisite (GType interface_type, - GType prerequisite_type); -GLIB_AVAILABLE_IN_ALL -GType*g_type_interface_prerequisites (GType interface_type, - guint *n_prerequisites); -GLIB_AVAILABLE_IN_2_68 -GType g_type_interface_instantiatable_prerequisite - (GType interface_type); -GLIB_DEPRECATED_IN_2_58 -void g_type_class_add_private (gpointer g_class, - gsize private_size); -GLIB_AVAILABLE_IN_2_38 -gint g_type_add_instance_private (GType class_type, - gsize private_size); -GLIB_AVAILABLE_IN_ALL -gpointer g_type_instance_get_private (GTypeInstance *instance, - GType private_type); -GLIB_AVAILABLE_IN_2_38 -void g_type_class_adjust_private_offset (gpointer g_class, - gint *private_size_or_offset); - -GLIB_AVAILABLE_IN_ALL -void g_type_add_class_private (GType class_type, - gsize private_size); -GLIB_AVAILABLE_IN_ALL -gpointer g_type_class_get_private (GTypeClass *klass, - GType private_type); -GLIB_AVAILABLE_IN_2_38 -gint g_type_class_get_instance_private_offset (gpointer g_class); - -GLIB_AVAILABLE_IN_2_34 -void g_type_ensure (GType type); -GLIB_AVAILABLE_IN_2_36 -guint g_type_get_type_registration_serial (void); - - -/* --- GType boilerplate --- */ -/** - * G_DECLARE_FINAL_TYPE: - * @ModuleObjName: The name of the new type, in camel case (like GtkWidget) - * @module_obj_name: The name of the new type in lowercase, with words - * separated by '_' (like 'gtk_widget') - * @MODULE: The name of the module, in all caps (like 'GTK') - * @OBJ_NAME: The bare name of the type, in all caps (like 'WIDGET') - * @ParentName: the name of the parent type, in camel case (like GtkWidget) - * - * A convenience macro for emitting the usual declarations in the header file for a type which is not (at the - * present time) intended to be subclassed. - * - * You might use it in a header as follows: - * - * |[ - * #ifndef _myapp_window_h_ - * #define _myapp_window_h_ - * - * #include - * - * #define MY_APP_TYPE_WINDOW my_app_window_get_type () - * G_DECLARE_FINAL_TYPE (MyAppWindow, my_app_window, MY_APP, WINDOW, GtkWindow) - * - * MyAppWindow * my_app_window_new (void); - * - * ... - * - * #endif - * ]| - * - * This results in the following things happening: - * - * - the usual my_app_window_get_type() function is declared with a return type of #GType - * - * - the MyAppWindow types is defined as a typedef of struct _MyAppWindow. The struct itself is not - * defined and should be defined from the .c file before G_DEFINE_TYPE() is used. - * - * - the MY_APP_WINDOW() cast is emitted as static inline function along with the MY_APP_IS_WINDOW() type - * checking function - * - * - the MyAppWindowClass type is defined as a struct containing GtkWindowClass. This is done for the - * convenience of the person defining the type and should not be considered to be part of the ABI. In - * particular, without a firm declaration of the instance structure, it is not possible to subclass the type - * and therefore the fact that the size of the class structure is exposed is not a concern and it can be - * freely changed at any point in the future. - * - * - g_autoptr() support being added for your type, based on the type of your parent class - * - * You can only use this function if your parent type also supports g_autoptr(). - * - * Because the type macro (MY_APP_TYPE_WINDOW in the above example) is not a callable, you must continue to - * manually define this as a macro for yourself. - * - * The declaration of the _get_type() function is the first thing emitted by the macro. This allows this macro - * to be used in the usual way with export control and API versioning macros. - * - * If you want to declare your own class structure, use G_DECLARE_DERIVABLE_TYPE(). - * - * If you are writing a library, it is important to note that it is possible to convert a type from using - * G_DECLARE_FINAL_TYPE() to G_DECLARE_DERIVABLE_TYPE() without breaking API or ABI. As a precaution, you - * should therefore use G_DECLARE_FINAL_TYPE() until you are sure that it makes sense for your class to be - * subclassed. Once a class structure has been exposed it is not possible to change its size or remove or - * reorder items without breaking the API and/or ABI. - * - * Since: 2.44 - **/ -#define G_DECLARE_FINAL_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \ - GType module_obj_name##_get_type (void); \ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - typedef struct _##ModuleObjName ModuleObjName; \ - typedef struct { ParentName##Class parent_class; } ModuleObjName##Class; \ - \ - _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName) \ - G_DEFINE_AUTOPTR_CLEANUP_FUNC (ModuleObjName##Class, g_type_class_unref) \ - \ - G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \ - return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \ - G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) { \ - return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \ - G_GNUC_END_IGNORE_DEPRECATIONS - -/** - * G_DECLARE_DERIVABLE_TYPE: - * @ModuleObjName: The name of the new type, in camel case (like GtkWidget) - * @module_obj_name: The name of the new type in lowercase, with words - * separated by '_' (like 'gtk_widget') - * @MODULE: The name of the module, in all caps (like 'GTK') - * @OBJ_NAME: The bare name of the type, in all caps (like 'WIDGET') - * @ParentName: the name of the parent type, in camel case (like GtkWidget) - * - * A convenience macro for emitting the usual declarations in the - * header file for a type which is intended to be subclassed. - * - * You might use it in a header as follows: - * - * |[ - * #ifndef _gtk_frobber_h_ - * #define _gtk_frobber_h_ - * - * #define GTK_TYPE_FROBBER gtk_frobber_get_type () - * GDK_AVAILABLE_IN_3_12 - * G_DECLARE_DERIVABLE_TYPE (GtkFrobber, gtk_frobber, GTK, FROBBER, GtkWidget) - * - * struct _GtkFrobberClass - * { - * GtkWidgetClass parent_class; - * - * void (* handle_frob) (GtkFrobber *frobber, - * guint n_frobs); - * - * gpointer padding[12]; - * }; - * - * GtkWidget * gtk_frobber_new (void); - * - * ... - * - * #endif - * ]| - * - * This results in the following things happening: - * - * - the usual gtk_frobber_get_type() function is declared with a return type of #GType - * - * - the GtkFrobber struct is created with GtkWidget as the first and only item. You are expected to use - * a private structure from your .c file to store your instance variables. - * - * - the GtkFrobberClass type is defined as a typedef to struct _GtkFrobberClass, which is left undefined. - * You should do this from the header file directly after you use the macro. - * - * - the GTK_FROBBER() and GTK_FROBBER_CLASS() casts are emitted as static inline functions along with - * the GTK_IS_FROBBER() and GTK_IS_FROBBER_CLASS() type checking functions and GTK_FROBBER_GET_CLASS() - * function. - * - * - g_autoptr() support being added for your type, based on the type of your parent class - * - * You can only use this function if your parent type also supports g_autoptr(). - * - * Because the type macro (GTK_TYPE_FROBBER in the above example) is not a callable, you must continue to - * manually define this as a macro for yourself. - * - * The declaration of the _get_type() function is the first thing emitted by the macro. This allows this macro - * to be used in the usual way with export control and API versioning macros. - * - * If you are writing a library, it is important to note that it is possible to convert a type from using - * G_DECLARE_FINAL_TYPE() to G_DECLARE_DERIVABLE_TYPE() without breaking API or ABI. As a precaution, you - * should therefore use G_DECLARE_FINAL_TYPE() until you are sure that it makes sense for your class to be - * subclassed. Once a class structure has been exposed it is not possible to change its size or remove or - * reorder items without breaking the API and/or ABI. If you want to declare your own class structure, use - * G_DECLARE_DERIVABLE_TYPE(). If you want to declare a class without exposing the class or instance - * structures, use G_DECLARE_FINAL_TYPE(). - * - * If you must use G_DECLARE_DERIVABLE_TYPE() you should be sure to include some padding at the bottom of your - * class structure to leave space for the addition of future virtual functions. - * - * Since: 2.44 - **/ -#define G_DECLARE_DERIVABLE_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \ - GType module_obj_name##_get_type (void); \ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - typedef struct _##ModuleObjName ModuleObjName; \ - typedef struct _##ModuleObjName##Class ModuleObjName##Class; \ - struct _##ModuleObjName { ParentName parent_instance; }; \ - \ - _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName) \ - G_DEFINE_AUTOPTR_CLEANUP_FUNC (ModuleObjName##Class, g_type_class_unref) \ - \ - G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \ - return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \ - G_GNUC_UNUSED static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_CLASS (gpointer ptr) { \ - return G_TYPE_CHECK_CLASS_CAST (ptr, module_obj_name##_get_type (), ModuleObjName##Class); } \ - G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) { \ - return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \ - G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME##_CLASS (gpointer ptr) { \ - return G_TYPE_CHECK_CLASS_TYPE (ptr, module_obj_name##_get_type ()); } \ - G_GNUC_UNUSED static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_GET_CLASS (gpointer ptr) { \ - return G_TYPE_INSTANCE_GET_CLASS (ptr, module_obj_name##_get_type (), ModuleObjName##Class); } \ - G_GNUC_END_IGNORE_DEPRECATIONS - -/** - * G_DECLARE_INTERFACE: - * @ModuleObjName: The name of the new type, in camel case (like GtkWidget) - * @module_obj_name: The name of the new type in lowercase, with words - * separated by '_' (like 'gtk_widget') - * @MODULE: The name of the module, in all caps (like 'GTK') - * @OBJ_NAME: The bare name of the type, in all caps (like 'WIDGET') - * @PrerequisiteName: the name of the prerequisite type, in camel case (like GtkWidget) - * - * A convenience macro for emitting the usual declarations in the header file for a GInterface type. - * - * You might use it in a header as follows: - * - * |[ - * #ifndef _my_model_h_ - * #define _my_model_h_ - * - * #define MY_TYPE_MODEL my_model_get_type () - * GDK_AVAILABLE_IN_3_12 - * G_DECLARE_INTERFACE (MyModel, my_model, MY, MODEL, GObject) - * - * struct _MyModelInterface - * { - * GTypeInterface g_iface; - * - * gpointer (* get_item) (MyModel *model); - * }; - * - * gpointer my_model_get_item (MyModel *model); - * - * ... - * - * #endif - * ]| - * - * This results in the following things happening: - * - * - the usual my_model_get_type() function is declared with a return type of #GType - * - * - the MyModelInterface type is defined as a typedef to struct _MyModelInterface, - * which is left undefined. You should do this from the header file directly after - * you use the macro. - * - * - the MY_MODEL() cast is emitted as static inline functions along with - * the MY_IS_MODEL() type checking function and MY_MODEL_GET_IFACE() function. - * - * - g_autoptr() support being added for your type, based on your prerequisite type. - * - * You can only use this function if your prerequisite type also supports g_autoptr(). - * - * Because the type macro (MY_TYPE_MODEL in the above example) is not a callable, you must continue to - * manually define this as a macro for yourself. - * - * The declaration of the _get_type() function is the first thing emitted by the macro. This allows this macro - * to be used in the usual way with export control and API versioning macros. - * - * Since: 2.44 - **/ -#define G_DECLARE_INTERFACE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, PrerequisiteName) \ - GType module_obj_name##_get_type (void); \ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - typedef struct _##ModuleObjName ModuleObjName; \ - typedef struct _##ModuleObjName##Interface ModuleObjName##Interface; \ - \ - _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, PrerequisiteName) \ - \ - G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \ - return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \ - G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) { \ - return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \ - G_GNUC_UNUSED static inline ModuleObjName##Interface * MODULE##_##OBJ_NAME##_GET_IFACE (gpointer ptr) { \ - return G_TYPE_INSTANCE_GET_INTERFACE (ptr, module_obj_name##_get_type (), ModuleObjName##Interface); } \ - G_GNUC_END_IGNORE_DEPRECATIONS - -/** - * G_DEFINE_TYPE: - * @TN: The name of the new type, in Camel case. - * @t_n: The name of the new type, in lowercase, with words - * separated by '_'. - * @T_P: The #GType of the parent type. - * - * A convenience macro for type implementations, which declares a class - * initialization function, an instance initialization function (see #GTypeInfo - * for information about these) and a static variable named `t_n_parent_class` - * pointing to the parent class. Furthermore, it defines a *_get_type() function. - * See G_DEFINE_TYPE_EXTENDED() for an example. - * - * Since: 2.4 - */ -#define G_DEFINE_TYPE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, {}) -/** - * G_DEFINE_TYPE_WITH_CODE: - * @TN: The name of the new type, in Camel case. - * @t_n: The name of the new type in lowercase, with words separated by '_'. - * @T_P: The #GType of the parent type. - * @_C_: Custom code that gets inserted in the *_get_type() function. - * - * A convenience macro for type implementations. - * Similar to G_DEFINE_TYPE(), but allows you to insert custom code into the - * *_get_type() function, e.g. interface implementations via G_IMPLEMENT_INTERFACE(). - * See G_DEFINE_TYPE_EXTENDED() for an example. - * - * Since: 2.4 - */ -#define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() -/** - * G_DEFINE_TYPE_WITH_PRIVATE: - * @TN: The name of the new type, in Camel case. - * @t_n: The name of the new type, in lowercase, with words - * separated by '_'. - * @T_P: The #GType of the parent type. - * - * A convenience macro for type implementations, which declares a class - * initialization function, an instance initialization function (see #GTypeInfo - * for information about these), a static variable named `t_n_parent_class` - * pointing to the parent class, and adds private instance data to the type. - * Furthermore, it defines a *_get_type() function. See G_DEFINE_TYPE_EXTENDED() - * for an example. - * - * Note that private structs added with this macros must have a struct - * name of the form @TN Private. - * - * The private instance data can be retrieved using the automatically generated - * getter function `t_n_get_instance_private()`. - * - * See also: G_ADD_PRIVATE() - * - * Since: 2.38 - */ -#define G_DEFINE_TYPE_WITH_PRIVATE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, G_ADD_PRIVATE (TN)) -/** - * G_DEFINE_ABSTRACT_TYPE: - * @TN: The name of the new type, in Camel case. - * @t_n: The name of the new type, in lowercase, with words - * separated by '_'. - * @T_P: The #GType of the parent type. - * - * A convenience macro for type implementations. - * Similar to G_DEFINE_TYPE(), but defines an abstract type. - * See G_DEFINE_TYPE_EXTENDED() for an example. - * - * Since: 2.4 - */ -#define G_DEFINE_ABSTRACT_TYPE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, {}) -/** - * G_DEFINE_ABSTRACT_TYPE_WITH_CODE: - * @TN: The name of the new type, in Camel case. - * @t_n: The name of the new type, in lowercase, with words - * separated by '_'. - * @T_P: The #GType of the parent type. - * @_C_: Custom code that gets inserted in the @type_name_get_type() function. - * - * A convenience macro for type implementations. - * Similar to G_DEFINE_TYPE_WITH_CODE(), but defines an abstract type and - * allows you to insert custom code into the *_get_type() function, e.g. - * interface implementations via G_IMPLEMENT_INTERFACE(). - * See G_DEFINE_TYPE_EXTENDED() for an example. - * - * Since: 2.4 - */ -#define G_DEFINE_ABSTRACT_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() -/** - * G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE: - * @TN: The name of the new type, in Camel case. - * @t_n: The name of the new type, in lowercase, with words - * separated by '_'. - * @T_P: The #GType of the parent type. - * - * Similar to G_DEFINE_TYPE_WITH_PRIVATE(), but defines an abstract type. - * See G_DEFINE_TYPE_EXTENDED() for an example. - * - * Since: 2.38 - */ -#define G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(TN, t_n, T_P) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, G_ADD_PRIVATE (TN)) -/** - * G_DEFINE_TYPE_EXTENDED: - * @TN: The name of the new type, in Camel case. - * @t_n: The name of the new type, in lowercase, with words - * separated by '_'. - * @T_P: The #GType of the parent type. - * @_f_: #GTypeFlags to pass to g_type_register_static() - * @_C_: Custom code that gets inserted in the *_get_type() function. - * - * The most general convenience macro for type implementations, on which - * G_DEFINE_TYPE(), etc are based. - * - * |[ - * G_DEFINE_TYPE_EXTENDED (GtkGadget, - * gtk_gadget, - * GTK_TYPE_WIDGET, - * 0, - * G_ADD_PRIVATE (GtkGadget) - * G_IMPLEMENT_INTERFACE (TYPE_GIZMO, - * gtk_gadget_gizmo_init)); - * ]| - * expands to - * |[ - * static void gtk_gadget_init (GtkGadget *self); - * static void gtk_gadget_class_init (GtkGadgetClass *klass); - * static gpointer gtk_gadget_parent_class = NULL; - * static gint GtkGadget_private_offset; - * static void gtk_gadget_class_intern_init (gpointer klass) - * { - * gtk_gadget_parent_class = g_type_class_peek_parent (klass); - * if (GtkGadget_private_offset != 0) - * g_type_class_adjust_private_offset (klass, &GtkGadget_private_offset); - * gtk_gadget_class_init ((GtkGadgetClass*) klass); - * } - * static inline gpointer gtk_gadget_get_instance_private (GtkGadget *self) - * { - * return (G_STRUCT_MEMBER_P (self, GtkGadget_private_offset)); - * } - * - * GType - * gtk_gadget_get_type (void) - * { - * static gsize static_g_define_type_id = 0; - * if (g_once_init_enter (&static_g_define_type_id)) - * { - * GType g_define_type_id = - * g_type_register_static_simple (GTK_TYPE_WIDGET, - * g_intern_static_string ("GtkGadget"), - * sizeof (GtkGadgetClass), - * (GClassInitFunc) gtk_gadget_class_intern_init, - * sizeof (GtkGadget), - * (GInstanceInitFunc) gtk_gadget_init, - * 0); - * { - * GtkGadget_private_offset = - * g_type_add_instance_private (g_define_type_id, sizeof (GtkGadgetPrivate)); - * } - * { - * const GInterfaceInfo g_implement_interface_info = { - * (GInterfaceInitFunc) gtk_gadget_gizmo_init - * }; - * g_type_add_interface_static (g_define_type_id, TYPE_GIZMO, &g_implement_interface_info); - * } - * g_once_init_leave (&static_g_define_type_id, g_define_type_id); - * } - * return static_g_define_type_id; - * } - * ]| - * The only pieces which have to be manually provided are the definitions of - * the instance and class structure and the definitions of the instance and - * class init functions. - * - * Since: 2.4 - */ -#define G_DEFINE_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, _f_) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() - -/** - * G_DEFINE_INTERFACE: - * @TN: The name of the new type, in Camel case. - * @t_n: The name of the new type, in lowercase, with words separated by '_'. - * @T_P: The #GType of the prerequisite type for the interface, or 0 - * (%G_TYPE_INVALID) for no prerequisite type. - * - * A convenience macro for #GTypeInterface definitions, which declares - * a default vtable initialization function and defines a *_get_type() - * function. - * - * The macro expects the interface initialization function to have the - * name `t_n ## _default_init`, and the interface structure to have the - * name `TN ## Interface`. - * - * The initialization function has signature - * `static void t_n ## _default_init (TypeName##Interface *klass);`, rather than - * the full #GInterfaceInitFunc signature, for brevity and convenience. If you - * need to use an initialization function with an `iface_data` argument, you - * must write the #GTypeInterface definitions manually. - * - * Since: 2.24 - */ -#define G_DEFINE_INTERFACE(TN, t_n, T_P) G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, ;) - -/** - * G_DEFINE_INTERFACE_WITH_CODE: - * @TN: The name of the new type, in Camel case. - * @t_n: The name of the new type, in lowercase, with words separated by '_'. - * @T_P: The #GType of the prerequisite type for the interface, or 0 - * (%G_TYPE_INVALID) for no prerequisite type. - * @_C_: Custom code that gets inserted in the *_get_type() function. - * - * A convenience macro for #GTypeInterface definitions. Similar to - * G_DEFINE_INTERFACE(), but allows you to insert custom code into the - * *_get_type() function, e.g. additional interface implementations - * via G_IMPLEMENT_INTERFACE(), or additional prerequisite types. See - * G_DEFINE_TYPE_EXTENDED() for a similar example using - * G_DEFINE_TYPE_WITH_CODE(). - * - * Since: 2.24 - */ -#define G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TN, t_n, T_P) {_C_;} _G_DEFINE_INTERFACE_EXTENDED_END() - -/** - * G_IMPLEMENT_INTERFACE: - * @TYPE_IFACE: The #GType of the interface to add - * @iface_init: (type GInterfaceInitFunc): The interface init function, of type #GInterfaceInitFunc - * - * A convenience macro to ease interface addition in the `_C_` section - * of G_DEFINE_TYPE_WITH_CODE() or G_DEFINE_ABSTRACT_TYPE_WITH_CODE(). - * See G_DEFINE_TYPE_EXTENDED() for an example. - * - * Note that this macro can only be used together with the G_DEFINE_TYPE_* - * macros, since it depends on variable names from those macros. - * - * Since: 2.4 - */ -#define G_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init) { \ - const GInterfaceInfo g_implement_interface_info = { \ - (GInterfaceInitFunc)(void (*)(void)) iface_init, NULL, NULL \ - }; \ - g_type_add_interface_static (g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \ -} - -/** - * G_ADD_PRIVATE: - * @TypeName: the name of the type in CamelCase - * - * A convenience macro to ease adding private data to instances of a new type - * in the @_C_ section of G_DEFINE_TYPE_WITH_CODE() or - * G_DEFINE_ABSTRACT_TYPE_WITH_CODE(). - * - * For instance: - * - * |[ - * typedef struct _MyObject MyObject; - * typedef struct _MyObjectClass MyObjectClass; - * - * typedef struct { - * gint foo; - * gint bar; - * } MyObjectPrivate; - * - * G_DEFINE_TYPE_WITH_CODE (MyObject, my_object, G_TYPE_OBJECT, - * G_ADD_PRIVATE (MyObject)) - * ]| - * - * Will add MyObjectPrivate as the private data to any instance of the MyObject - * type. - * - * G_DEFINE_TYPE_* macros will automatically create a private function - * based on the arguments to this macro, which can be used to safely - * retrieve the private data from an instance of the type; for instance: - * - * |[ - * gint - * my_object_get_foo (MyObject *obj) - * { - * MyObjectPrivate *priv = my_object_get_instance_private (obj); - * - * g_return_val_if_fail (MY_IS_OBJECT (obj), 0); - * - * return priv->foo; - * } - * - * void - * my_object_set_bar (MyObject *obj, - * gint bar) - * { - * MyObjectPrivate *priv = my_object_get_instance_private (obj); - * - * g_return_if_fail (MY_IS_OBJECT (obj)); - * - * if (priv->bar != bar) - * priv->bar = bar; - * } - * ]| - * - * Note that this macro can only be used together with the G_DEFINE_TYPE_* - * macros, since it depends on variable names from those macros. - * - * Also note that private structs added with these macros must have a struct - * name of the form `TypeNamePrivate`. - * - * It is safe to call the `_get_instance_private` function on %NULL or invalid - * objects since it's only adding an offset to the instance pointer. In that - * case the returned pointer must not be dereferenced. - * - * Since: 2.38 - */ -#define G_ADD_PRIVATE(TypeName) { \ - TypeName##_private_offset = \ - g_type_add_instance_private (g_define_type_id, sizeof (TypeName##Private)); \ -} - -/** - * G_PRIVATE_OFFSET: - * @TypeName: the name of the type in CamelCase - * @field: the name of the field in the private data structure - * - * Evaluates to the offset of the @field inside the instance private data - * structure for @TypeName. - * - * Note that this macro can only be used together with the G_DEFINE_TYPE_* - * and G_ADD_PRIVATE() macros, since it depends on variable names from - * those macros. - * - * Since: 2.38 - */ -#define G_PRIVATE_OFFSET(TypeName, field) \ - (TypeName##_private_offset + (G_STRUCT_OFFSET (TypeName##Private, field))) - -/** - * G_PRIVATE_FIELD_P: - * @TypeName: the name of the type in CamelCase - * @inst: the instance of @TypeName you wish to access - * @field_name: the name of the field in the private data structure - * - * Evaluates to a pointer to the @field_name inside the @inst private data - * structure for @TypeName. - * - * Note that this macro can only be used together with the G_DEFINE_TYPE_* - * and G_ADD_PRIVATE() macros, since it depends on variable names from - * those macros. - * - * Since: 2.38 - */ -#define G_PRIVATE_FIELD_P(TypeName, inst, field_name) \ - G_STRUCT_MEMBER_P (inst, G_PRIVATE_OFFSET (TypeName, field_name)) - -/** - * G_PRIVATE_FIELD: - * @TypeName: the name of the type in CamelCase - * @inst: the instance of @TypeName you wish to access - * @field_type: the type of the field in the private data structure - * @field_name: the name of the field in the private data structure - * - * Evaluates to the @field_name inside the @inst private data - * structure for @TypeName. - * - * Note that this macro can only be used together with the G_DEFINE_TYPE_* - * and G_ADD_PRIVATE() macros, since it depends on variable names from - * those macros. - * - * Since: 2.38 - */ -#define G_PRIVATE_FIELD(TypeName, inst, field_type, field_name) \ - G_STRUCT_MEMBER (field_type, inst, G_PRIVATE_OFFSET (TypeName, field_name)) - -/* we need to have this macro under conditional expansion, as it references - * a function that has been added in 2.38. see bug: - * https://bugzilla.gnome.org/show_bug.cgi?id=703191 - */ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 -#define _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \ -static void type_name##_class_intern_init (gpointer klass) \ -{ \ - type_name##_parent_class = g_type_class_peek_parent (klass); \ - if (TypeName##_private_offset != 0) \ - g_type_class_adjust_private_offset (klass, &TypeName##_private_offset); \ - type_name##_class_init ((TypeName##Class*) klass); \ -} - -#else -#define _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \ -static void type_name##_class_intern_init (gpointer klass) \ -{ \ - type_name##_parent_class = g_type_class_peek_parent (klass); \ - type_name##_class_init ((TypeName##Class*) klass); \ -} -#endif /* GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 */ - -/* Added for _G_DEFINE_TYPE_EXTENDED_WITH_PRELUDE */ -#define _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \ -\ -static void type_name##_init (TypeName *self); \ -static void type_name##_class_init (TypeName##Class *klass); \ -static GType type_name##_get_type_once (void); \ -static gpointer type_name##_parent_class = NULL; \ -static gint TypeName##_private_offset; \ -\ -_G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \ -\ -G_GNUC_UNUSED \ -static inline gpointer \ -type_name##_get_instance_private (TypeName *self) \ -{ \ - return (G_STRUCT_MEMBER_P (self, TypeName##_private_offset)); \ -} \ -\ -GType \ -type_name##_get_type (void) \ -{ \ - static gsize static_g_define_type_id = 0; - /* Prelude goes here */ - -/* Added for _G_DEFINE_TYPE_EXTENDED_WITH_PRELUDE */ -#define _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \ - if (g_once_init_enter (&static_g_define_type_id)) \ - { \ - GType g_define_type_id = type_name##_get_type_once (); \ - g_once_init_leave (&static_g_define_type_id, g_define_type_id); \ - } \ - return static_g_define_type_id; \ -} /* closes type_name##_get_type() */ \ -\ -G_GNUC_NO_INLINE \ -static GType \ -type_name##_get_type_once (void) \ -{ \ - GType g_define_type_id = \ - g_type_register_static_simple (TYPE_PARENT, \ - g_intern_static_string (#TypeName), \ - sizeof (TypeName##Class), \ - (GClassInitFunc)(void (*)(void)) type_name##_class_intern_init, \ - sizeof (TypeName), \ - (GInstanceInitFunc)(void (*)(void)) type_name##_init, \ - (GTypeFlags) flags); \ - { /* custom code follows */ -#define _G_DEFINE_TYPE_EXTENDED_END() \ - /* following custom code */ \ - } \ - return g_define_type_id; \ -} /* closes type_name##_get_type_once() */ - -/* This was defined before we had G_DEFINE_TYPE_WITH_CODE_AND_PRELUDE, it's simplest - * to keep it. - */ -#define _G_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) \ - _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \ - _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \ - -#define _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PREREQ) \ -\ -static void type_name##_default_init (TypeName##Interface *klass); \ -\ -GType \ -type_name##_get_type (void) \ -{ \ - static gsize static_g_define_type_id = 0; \ - if (g_once_init_enter (&static_g_define_type_id)) \ - { \ - GType g_define_type_id = \ - g_type_register_static_simple (G_TYPE_INTERFACE, \ - g_intern_static_string (#TypeName), \ - sizeof (TypeName##Interface), \ - (GClassInitFunc)(void (*)(void)) type_name##_default_init, \ - 0, \ - (GInstanceInitFunc)NULL, \ - (GTypeFlags) 0); \ - if (TYPE_PREREQ != G_TYPE_INVALID) \ - g_type_interface_add_prerequisite (g_define_type_id, TYPE_PREREQ); \ - { /* custom code follows */ -#define _G_DEFINE_INTERFACE_EXTENDED_END() \ - /* following custom code */ \ - } \ - g_once_init_leave (&static_g_define_type_id, g_define_type_id); \ - } \ - return static_g_define_type_id; \ -} /* closes type_name##_get_type() */ - -/** - * G_DEFINE_BOXED_TYPE: - * @TypeName: The name of the new type, in Camel case - * @type_name: The name of the new type, in lowercase, with words - * separated by '_' - * @copy_func: the #GBoxedCopyFunc for the new type - * @free_func: the #GBoxedFreeFunc for the new type - * - * A convenience macro for boxed type implementations, which defines a - * type_name_get_type() function registering the boxed type. - * - * Since: 2.26 - */ -#define G_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func) G_DEFINE_BOXED_TYPE_WITH_CODE (TypeName, type_name, copy_func, free_func, {}) -/** - * G_DEFINE_BOXED_TYPE_WITH_CODE: - * @TypeName: The name of the new type, in Camel case - * @type_name: The name of the new type, in lowercase, with words - * separated by '_' - * @copy_func: the #GBoxedCopyFunc for the new type - * @free_func: the #GBoxedFreeFunc for the new type - * @_C_: Custom code that gets inserted in the *_get_type() function - * - * A convenience macro for boxed type implementations. - * Similar to G_DEFINE_BOXED_TYPE(), but allows to insert custom code into the - * type_name_get_type() function, e.g. to register value transformations with - * g_value_register_transform_func(), for instance: - * - * |[ - * G_DEFINE_BOXED_TYPE_WITH_CODE (GdkRectangle, gdk_rectangle, - * gdk_rectangle_copy, - * gdk_rectangle_free, - * register_rectangle_transform_funcs (g_define_type_id)) - * ]| - * - * Similarly to the %G_DEFINE_TYPE family of macros, the #GType of the newly - * defined boxed type is exposed in the `g_define_type_id` variable. - * - * Since: 2.26 - */ -#define G_DEFINE_BOXED_TYPE_WITH_CODE(TypeName, type_name, copy_func, free_func, _C_) _G_DEFINE_BOXED_TYPE_BEGIN (TypeName, type_name, copy_func, free_func) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() - -/* Only use this in non-C++ on GCC >= 2.7, except for Darwin/ppc64. - * See https://bugzilla.gnome.org/show_bug.cgi?id=647145 - */ -#if !defined (__cplusplus) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) && !(defined (__APPLE__) && defined (__ppc64__)) -#define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func, free_func) \ -static GType type_name##_get_type_once (void); \ -\ -GType \ -type_name##_get_type (void) \ -{ \ - static gsize static_g_define_type_id = 0; \ - if (g_once_init_enter (&static_g_define_type_id)) \ - { \ - GType g_define_type_id = type_name##_get_type_once (); \ - g_once_init_leave (&static_g_define_type_id, g_define_type_id); \ - } \ - return static_g_define_type_id; \ -} \ -\ -G_GNUC_NO_INLINE \ -static GType \ -type_name##_get_type_once (void) \ -{ \ - GType (* _g_register_boxed) \ - (const gchar *, \ - union \ - { \ - TypeName * (*do_copy_type) (TypeName *); \ - TypeName * (*do_const_copy_type) (const TypeName *); \ - GBoxedCopyFunc do_copy_boxed; \ - } __attribute__((__transparent_union__)), \ - union \ - { \ - void (* do_free_type) (TypeName *); \ - GBoxedFreeFunc do_free_boxed; \ - } __attribute__((__transparent_union__)) \ - ) = g_boxed_type_register_static; \ - GType g_define_type_id = \ - _g_register_boxed (g_intern_static_string (#TypeName), copy_func, free_func); \ - { /* custom code follows */ -#else -#define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func, free_func) \ -static GType type_name##_get_type_once (void); \ -\ -GType \ -type_name##_get_type (void) \ -{ \ - static gsize static_g_define_type_id = 0; \ - if (g_once_init_enter (&static_g_define_type_id)) \ - { \ - GType g_define_type_id = type_name##_get_type_once (); \ - g_once_init_leave (&static_g_define_type_id, g_define_type_id); \ - } \ - return static_g_define_type_id; \ -} \ -\ -G_GNUC_NO_INLINE \ -static GType \ -type_name##_get_type_once (void) \ -{ \ - GType g_define_type_id = \ - g_boxed_type_register_static (g_intern_static_string (#TypeName), \ - (GBoxedCopyFunc) copy_func, \ - (GBoxedFreeFunc) free_func); \ - { /* custom code follows */ -#endif /* __GNUC__ */ - -/** - * G_DEFINE_POINTER_TYPE: - * @TypeName: The name of the new type, in Camel case - * @type_name: The name of the new type, in lowercase, with words - * separated by '_' - * - * A convenience macro for pointer type implementations, which defines a - * type_name_get_type() function registering the pointer type. - * - * Since: 2.26 - */ -#define G_DEFINE_POINTER_TYPE(TypeName, type_name) G_DEFINE_POINTER_TYPE_WITH_CODE (TypeName, type_name, {}) -/** - * G_DEFINE_POINTER_TYPE_WITH_CODE: - * @TypeName: The name of the new type, in Camel case - * @type_name: The name of the new type, in lowercase, with words - * separated by '_' - * @_C_: Custom code that gets inserted in the *_get_type() function - * - * A convenience macro for pointer type implementations. - * Similar to G_DEFINE_POINTER_TYPE(), but allows to insert - * custom code into the type_name_get_type() function. - * - * Since: 2.26 - */ -#define G_DEFINE_POINTER_TYPE_WITH_CODE(TypeName, type_name, _C_) _G_DEFINE_POINTER_TYPE_BEGIN (TypeName, type_name) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() - -#define _G_DEFINE_POINTER_TYPE_BEGIN(TypeName, type_name) \ -static GType type_name##_get_type_once (void); \ -\ -GType \ -type_name##_get_type (void) \ -{ \ - static gsize static_g_define_type_id = 0; \ - if (g_once_init_enter (&static_g_define_type_id)) \ - { \ - GType g_define_type_id = type_name##_get_type_once (); \ - g_once_init_leave (&static_g_define_type_id, g_define_type_id); \ - } \ - return static_g_define_type_id; \ -} \ -\ -G_GNUC_NO_INLINE \ -static GType \ -type_name##_get_type_once (void) \ -{ \ - GType g_define_type_id = \ - g_pointer_type_register_static (g_intern_static_string (#TypeName)); \ - { /* custom code follows */ - -/* --- protected (for fundamental type implementations) --- */ -GLIB_AVAILABLE_IN_ALL -GTypePlugin* g_type_get_plugin (GType type); -GLIB_AVAILABLE_IN_ALL -GTypePlugin* g_type_interface_get_plugin (GType instance_type, - GType interface_type); -GLIB_AVAILABLE_IN_ALL -GType g_type_fundamental_next (void); -GLIB_AVAILABLE_IN_ALL -GType g_type_fundamental (GType type_id); -GLIB_AVAILABLE_IN_ALL -GTypeInstance* g_type_create_instance (GType type); -GLIB_AVAILABLE_IN_ALL -void g_type_free_instance (GTypeInstance *instance); - -GLIB_AVAILABLE_IN_ALL -void g_type_add_class_cache_func (gpointer cache_data, - GTypeClassCacheFunc cache_func); -GLIB_AVAILABLE_IN_ALL -void g_type_remove_class_cache_func (gpointer cache_data, - GTypeClassCacheFunc cache_func); -GLIB_AVAILABLE_IN_ALL -void g_type_class_unref_uncached (gpointer g_class); - -GLIB_AVAILABLE_IN_ALL -void g_type_add_interface_check (gpointer check_data, - GTypeInterfaceCheckFunc check_func); -GLIB_AVAILABLE_IN_ALL -void g_type_remove_interface_check (gpointer check_data, - GTypeInterfaceCheckFunc check_func); - -GLIB_AVAILABLE_IN_ALL -GTypeValueTable* g_type_value_table_peek (GType type); - - -/*< private >*/ -GLIB_AVAILABLE_IN_ALL -gboolean g_type_check_instance (GTypeInstance *instance) G_GNUC_PURE; -GLIB_AVAILABLE_IN_ALL -GTypeInstance* g_type_check_instance_cast (GTypeInstance *instance, - GType iface_type); -GLIB_AVAILABLE_IN_ALL -gboolean g_type_check_instance_is_a (GTypeInstance *instance, - GType iface_type) G_GNUC_PURE; -GLIB_AVAILABLE_IN_2_42 -gboolean g_type_check_instance_is_fundamentally_a (GTypeInstance *instance, - GType fundamental_type) G_GNUC_PURE; -GLIB_AVAILABLE_IN_ALL -GTypeClass* g_type_check_class_cast (GTypeClass *g_class, - GType is_a_type); -GLIB_AVAILABLE_IN_ALL -gboolean g_type_check_class_is_a (GTypeClass *g_class, - GType is_a_type) G_GNUC_PURE; -GLIB_AVAILABLE_IN_ALL -gboolean g_type_check_is_value_type (GType type) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_type_check_value (const GValue *value) G_GNUC_PURE; -GLIB_AVAILABLE_IN_ALL -gboolean g_type_check_value_holds (const GValue *value, - GType type) G_GNUC_PURE; -GLIB_AVAILABLE_IN_ALL -gboolean g_type_test_flags (GType type, - guint flags) G_GNUC_CONST; - - -/* --- debugging functions --- */ -GLIB_AVAILABLE_IN_ALL -const gchar * g_type_name_from_instance (GTypeInstance *instance); -GLIB_AVAILABLE_IN_ALL -const gchar * g_type_name_from_class (GTypeClass *g_class); - - -/* --- implementation bits --- */ -#ifndef G_DISABLE_CAST_CHECKS -# define _G_TYPE_CIC(ip, gt, ct) \ - ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) -# define _G_TYPE_CCC(cp, gt, ct) \ - ((ct*) g_type_check_class_cast ((GTypeClass*) cp, gt)) -#else /* G_DISABLE_CAST_CHECKS */ -# define _G_TYPE_CIC(ip, gt, ct) ((ct*) ip) -# define _G_TYPE_CCC(cp, gt, ct) ((ct*) cp) -#endif /* G_DISABLE_CAST_CHECKS */ -#define _G_TYPE_CHI(ip) (g_type_check_instance ((GTypeInstance*) ip)) -#define _G_TYPE_CHV(vl) (g_type_check_value ((GValue*) vl)) -#define _G_TYPE_IGC(ip, gt, ct) ((ct*) (((GTypeInstance*) ip)->g_class)) -#define _G_TYPE_IGI(ip, gt, ct) ((ct*) g_type_interface_peek (((GTypeInstance*) ip)->g_class, gt)) -#define _G_TYPE_CIFT(ip, ft) (g_type_check_instance_is_fundamentally_a ((GTypeInstance*) ip, ft)) -#ifdef __GNUC__ -# define _G_TYPE_CIT(ip, gt) (G_GNUC_EXTENSION ({ \ - GTypeInstance *__inst = (GTypeInstance*) ip; GType __t = gt; gboolean __r; \ - if (!__inst) \ - __r = FALSE; \ - else if (__inst->g_class && __inst->g_class->g_type == __t) \ - __r = TRUE; \ - else \ - __r = g_type_check_instance_is_a (__inst, __t); \ - __r; \ -})) -# define _G_TYPE_CCT(cp, gt) (G_GNUC_EXTENSION ({ \ - GTypeClass *__class = (GTypeClass*) cp; GType __t = gt; gboolean __r; \ - if (!__class) \ - __r = FALSE; \ - else if (__class->g_type == __t) \ - __r = TRUE; \ - else \ - __r = g_type_check_class_is_a (__class, __t); \ - __r; \ -})) -# define _G_TYPE_CVH(vl, gt) (G_GNUC_EXTENSION ({ \ - const GValue *__val = (const GValue*) vl; GType __t = gt; gboolean __r; \ - if (!__val) \ - __r = FALSE; \ - else if (__val->g_type == __t) \ - __r = TRUE; \ - else \ - __r = g_type_check_value_holds (__val, __t); \ - __r; \ -})) -#else /* !__GNUC__ */ -# define _G_TYPE_CIT(ip, gt) (g_type_check_instance_is_a ((GTypeInstance*) ip, gt)) -# define _G_TYPE_CCT(cp, gt) (g_type_check_class_is_a ((GTypeClass*) cp, gt)) -# define _G_TYPE_CVH(vl, gt) (g_type_check_value_holds ((const GValue*) vl, gt)) -#endif /* !__GNUC__ */ -/** - * G_TYPE_FLAG_RESERVED_ID_BIT: - * - * A bit in the type number that's supposed to be left untouched. - */ -#define G_TYPE_FLAG_RESERVED_ID_BIT ((GType) (1 << 0)) - -G_END_DECLS - -#endif /* __G_TYPE_H__ */ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - * - * gvalue.h: generic GValue functions - */ -#ifndef __G_VALUE_H__ -#define __G_VALUE_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/* --- type macros --- */ -/** - * G_TYPE_IS_VALUE: - * @type: A #GType value. - * - * Checks whether the passed in type ID can be used for g_value_init(). - * That is, this macro checks whether this type provides an implementation - * of the #GTypeValueTable functions required for a type to create a #GValue of. - * - * Returns: Whether @type is suitable as a #GValue type. - */ -#define G_TYPE_IS_VALUE(type) (g_type_check_is_value_type (type)) -/** - * G_IS_VALUE: - * @value: A #GValue structure. - * - * Checks if @value is a valid and initialized #GValue structure. - * - * Returns: %TRUE on success. - */ -#define G_IS_VALUE(value) (G_TYPE_CHECK_VALUE (value)) -/** - * G_VALUE_TYPE: - * @value: A #GValue structure. - * - * Get the type identifier of @value. - * - * Returns: the #GType. - */ -#define G_VALUE_TYPE(value) (((GValue*) (value))->g_type) -/** - * G_VALUE_TYPE_NAME: - * @value: A #GValue structure. - * - * Gets the type name of @value. - * - * Returns: the type name. - */ -#define G_VALUE_TYPE_NAME(value) (g_type_name (G_VALUE_TYPE (value))) -/** - * G_VALUE_HOLDS: - * @value: A #GValue structure. - * @type: A #GType value. - * - * Checks if @value holds (or contains) a value of @type. - * This macro will also check for @value != %NULL and issue a - * warning if the check fails. - * - * Returns: %TRUE if @value holds the @type. - */ -#define G_VALUE_HOLDS(value,type) (G_TYPE_CHECK_VALUE_TYPE ((value), (type))) - - -/* --- typedefs & structures --- */ -/** - * GValueTransform: - * @src_value: Source value. - * @dest_value: Target value. - * - * The type of value transformation functions which can be registered with - * g_value_register_transform_func(). - * - * @dest_value will be initialized to the correct destination type. - */ -typedef void (*GValueTransform) (const GValue *src_value, - GValue *dest_value); -/** - * GValue: - * - * An opaque structure used to hold different types of values. - * The data within the structure has protected scope: it is accessible only - * to functions within a #GTypeValueTable structure, or implementations of - * the g_value_*() API. That is, code portions which implement new fundamental - * types. - * #GValue users cannot make any assumptions about how data is stored - * within the 2 element @data union, and the @g_type member should - * only be accessed through the G_VALUE_TYPE() macro. - */ -struct _GValue -{ - /*< private >*/ - GType g_type; - - /* public for GTypeValueTable methods */ - union { - gint v_int; - guint v_uint; - glong v_long; - gulong v_ulong; - gint64 v_int64; - guint64 v_uint64; - gfloat v_float; - gdouble v_double; - gpointer v_pointer; - } data[2]; -}; - - -/* --- prototypes --- */ -GLIB_AVAILABLE_IN_ALL -GValue* g_value_init (GValue *value, - GType g_type); -GLIB_AVAILABLE_IN_ALL -void g_value_copy (const GValue *src_value, - GValue *dest_value); -GLIB_AVAILABLE_IN_ALL -GValue* g_value_reset (GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_unset (GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_instance (GValue *value, - gpointer instance); -GLIB_AVAILABLE_IN_2_42 -void g_value_init_from_instance (GValue *value, - gpointer instance); - - -/* --- private --- */ -GLIB_AVAILABLE_IN_ALL -gboolean g_value_fits_pointer (const GValue *value); -GLIB_AVAILABLE_IN_ALL -gpointer g_value_peek_pointer (const GValue *value); - - -/* --- implementation details --- */ -GLIB_AVAILABLE_IN_ALL -gboolean g_value_type_compatible (GType src_type, - GType dest_type); -GLIB_AVAILABLE_IN_ALL -gboolean g_value_type_transformable (GType src_type, - GType dest_type); -GLIB_AVAILABLE_IN_ALL -gboolean g_value_transform (const GValue *src_value, - GValue *dest_value); -GLIB_AVAILABLE_IN_ALL -void g_value_register_transform_func (GType src_type, - GType dest_type, - GValueTransform transform_func); - -/** - * G_VALUE_NOCOPY_CONTENTS: - * - * If passed to G_VALUE_COLLECT(), allocated data won't be copied - * but used verbatim. This does not affect ref-counted types like - * objects. This does not affect usage of g_value_copy(), the data will - * be copied if it is not ref-counted. - */ -#define G_VALUE_NOCOPY_CONTENTS (1 << 27) - -/** - * G_VALUE_INTERNED_STRING: - * - * For string values, indicates that the string contained is canonical and will - * exist for the duration of the process. See g_value_set_interned_string(). - * - * Since: 2.66 - */ -#define G_VALUE_INTERNED_STRING (1 << 28) GLIB_AVAILABLE_MACRO_IN_2_66 - -/** - * G_VALUE_INIT: - * - * A #GValue must be initialized before it can be used. This macro can - * be used as initializer instead of an explicit `{ 0 }` when declaring - * a variable, but it cannot be assigned to a variable. - * - * |[ - * GValue value = G_VALUE_INIT; - * ]| - * - * Since: 2.30 - */ -#define G_VALUE_INIT { 0, { { 0 } } } - - -G_END_DECLS - -#endif /* __G_VALUE_H__ */ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - * - * gparam.h: GParamSpec base class implementation - */ -#ifndef __G_PARAM_H__ -#define __G_PARAM_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/* --- standard type macros --- */ -/** - * G_TYPE_IS_PARAM: - * @type: a #GType ID - * - * Checks whether @type "is a" %G_TYPE_PARAM. - */ -#define G_TYPE_IS_PARAM(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_PARAM) -/** - * G_PARAM_SPEC: - * @pspec: a valid #GParamSpec - * - * Casts a derived #GParamSpec object (e.g. of type #GParamSpecInt) into - * a #GParamSpec object. - */ -#define G_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM, GParamSpec)) -/** - * G_IS_PARAM_SPEC: - * @pspec: a #GParamSpec - * - * Checks whether @pspec "is a" valid #GParamSpec structure of type %G_TYPE_PARAM - * or derived. - */ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_42 -#define G_IS_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE ((pspec), G_TYPE_PARAM)) -#else -#define G_IS_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM)) -#endif -/** - * G_PARAM_SPEC_CLASS: - * @pclass: a valid #GParamSpecClass - * - * Casts a derived #GParamSpecClass structure into a #GParamSpecClass structure. - */ -#define G_PARAM_SPEC_CLASS(pclass) (G_TYPE_CHECK_CLASS_CAST ((pclass), G_TYPE_PARAM, GParamSpecClass)) -/** - * G_IS_PARAM_SPEC_CLASS: - * @pclass: a #GParamSpecClass - * - * Checks whether @pclass "is a" valid #GParamSpecClass structure of type - * %G_TYPE_PARAM or derived. - */ -#define G_IS_PARAM_SPEC_CLASS(pclass) (G_TYPE_CHECK_CLASS_TYPE ((pclass), G_TYPE_PARAM)) -/** - * G_PARAM_SPEC_GET_CLASS: - * @pspec: a valid #GParamSpec - * - * Retrieves the #GParamSpecClass of a #GParamSpec. - */ -#define G_PARAM_SPEC_GET_CLASS(pspec) (G_TYPE_INSTANCE_GET_CLASS ((pspec), G_TYPE_PARAM, GParamSpecClass)) - - -/* --- convenience macros --- */ -/** - * G_PARAM_SPEC_TYPE: - * @pspec: a valid #GParamSpec - * - * Retrieves the #GType of this @pspec. - */ -#define G_PARAM_SPEC_TYPE(pspec) (G_TYPE_FROM_INSTANCE (pspec)) -/** - * G_PARAM_SPEC_TYPE_NAME: - * @pspec: a valid #GParamSpec - * - * Retrieves the #GType name of this @pspec. - */ -#define G_PARAM_SPEC_TYPE_NAME(pspec) (g_type_name (G_PARAM_SPEC_TYPE (pspec))) -/** - * G_PARAM_SPEC_VALUE_TYPE: - * @pspec: a valid #GParamSpec - * - * Retrieves the #GType to initialize a #GValue for this parameter. - */ -#define G_PARAM_SPEC_VALUE_TYPE(pspec) (G_PARAM_SPEC (pspec)->value_type) -/** - * G_VALUE_HOLDS_PARAM: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values derived from type %G_TYPE_PARAM. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_PARAM(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_PARAM)) - - -/* --- flags --- */ -/** - * GParamFlags: - * @G_PARAM_READABLE: the parameter is readable - * @G_PARAM_WRITABLE: the parameter is writable - * @G_PARAM_READWRITE: alias for %G_PARAM_READABLE | %G_PARAM_WRITABLE - * @G_PARAM_CONSTRUCT: the parameter will be set upon object construction - * @G_PARAM_CONSTRUCT_ONLY: the parameter can only be set upon object construction - * @G_PARAM_LAX_VALIDATION: upon parameter conversion (see g_param_value_convert()) - * strict validation is not required - * @G_PARAM_STATIC_NAME: the string used as name when constructing the - * parameter is guaranteed to remain valid and - * unmodified for the lifetime of the parameter. - * Since 2.8 - * @G_PARAM_STATIC_NICK: the string used as nick when constructing the - * parameter is guaranteed to remain valid and - * unmmodified for the lifetime of the parameter. - * Since 2.8 - * @G_PARAM_STATIC_BLURB: the string used as blurb when constructing the - * parameter is guaranteed to remain valid and - * unmodified for the lifetime of the parameter. - * Since 2.8 - * @G_PARAM_EXPLICIT_NOTIFY: calls to g_object_set_property() for this - * property will not automatically result in a "notify" signal being - * emitted: the implementation must call g_object_notify() themselves - * in case the property actually changes. Since: 2.42. - * @G_PARAM_PRIVATE: internal - * @G_PARAM_DEPRECATED: the parameter is deprecated and will be removed - * in a future version. A warning will be generated if it is used - * while running with G_ENABLE_DIAGNOSTIC=1. - * Since 2.26 - * - * Through the #GParamFlags flag values, certain aspects of parameters - * can be configured. See also #G_PARAM_STATIC_STRINGS. - */ -typedef enum -{ - G_PARAM_READABLE = 1 << 0, - G_PARAM_WRITABLE = 1 << 1, - G_PARAM_READWRITE = (G_PARAM_READABLE | G_PARAM_WRITABLE), - G_PARAM_CONSTRUCT = 1 << 2, - G_PARAM_CONSTRUCT_ONLY = 1 << 3, - G_PARAM_LAX_VALIDATION = 1 << 4, - G_PARAM_STATIC_NAME = 1 << 5, - G_PARAM_PRIVATE GLIB_DEPRECATED_ENUMERATOR_IN_2_26 = G_PARAM_STATIC_NAME, - G_PARAM_STATIC_NICK = 1 << 6, - G_PARAM_STATIC_BLURB = 1 << 7, - /* User defined flags go here */ - G_PARAM_EXPLICIT_NOTIFY = 1 << 30, - /* Avoid warning with -Wpedantic for gcc6 */ - G_PARAM_DEPRECATED = (gint)(1u << 31) -} GParamFlags; - -/** - * G_PARAM_STATIC_STRINGS: - * - * #GParamFlags value alias for %G_PARAM_STATIC_NAME | %G_PARAM_STATIC_NICK | %G_PARAM_STATIC_BLURB. - * - * Since 2.13.0 - */ -#define G_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB) -/* bits in the range 0xffffff00 are reserved for 3rd party usage */ -/** - * G_PARAM_MASK: - * - * Mask containing the bits of #GParamSpec.flags which are reserved for GLib. - */ -#define G_PARAM_MASK (0x000000ff) -/** - * G_PARAM_USER_SHIFT: - * - * Minimum shift count to be used for user defined flags, to be stored in - * #GParamSpec.flags. The maximum allowed is 10. - */ -#define G_PARAM_USER_SHIFT (8) - -/* --- typedefs & structures --- */ -typedef struct _GParamSpec GParamSpec; -typedef struct _GParamSpecClass GParamSpecClass; -typedef struct _GParameter GParameter GLIB_DEPRECATED_TYPE_IN_2_54; -typedef struct _GParamSpecPool GParamSpecPool; -/** - * GParamSpec: (ref-func g_param_spec_ref_sink) (unref-func g_param_spec_uref) (set-value-func g_value_set_param) (get-value-func g_value_get_param) - * @g_type_instance: private #GTypeInstance portion - * @name: name of this parameter: always an interned string - * @flags: #GParamFlags flags for this parameter - * @value_type: the #GValue type for this parameter - * @owner_type: #GType type that uses (introduces) this parameter - * - * All other fields of the GParamSpec struct are private and - * should not be used directly. - */ -struct _GParamSpec -{ - GTypeInstance g_type_instance; - - const gchar *name; /* interned string */ - GParamFlags flags; - GType value_type; - GType owner_type; /* class or interface using this property */ - - /*< private >*/ - gchar *_nick; - gchar *_blurb; - GData *qdata; - guint ref_count; - guint param_id; /* sort-criteria */ -}; -/** - * GParamSpecClass: - * @g_type_class: the parent class - * @value_type: the #GValue type for this parameter - * @finalize: The instance finalization function (optional), should chain - * up to the finalize method of the parent class. - * @value_set_default: Resets a @value to the default value for this type - * (recommended, the default is g_value_reset()), see - * g_param_value_set_default(). - * @value_validate: Ensures that the contents of @value comply with the - * specifications set out by this type (optional), see - * g_param_value_validate(). - * @values_cmp: Compares @value1 with @value2 according to this type - * (recommended, the default is memcmp()), see g_param_values_cmp(). - * - * The class structure for the GParamSpec type. - * Normally, GParamSpec classes are filled by - * g_param_type_register_static(). - */ -struct _GParamSpecClass -{ - GTypeClass g_type_class; - - GType value_type; - - void (*finalize) (GParamSpec *pspec); - - /* GParam methods */ - void (*value_set_default) (GParamSpec *pspec, - GValue *value); - gboolean (*value_validate) (GParamSpec *pspec, - GValue *value); - gint (*values_cmp) (GParamSpec *pspec, - const GValue *value1, - const GValue *value2); - /*< private >*/ - gpointer dummy[4]; -}; -/** - * GParameter: - * @name: the parameter name - * @value: the parameter value - * - * The GParameter struct is an auxiliary structure used - * to hand parameter name/value pairs to g_object_newv(). - * - * Deprecated: 2.54: This type is not introspectable. - */ -struct _GParameter /* auxiliary structure for _setv() variants */ -{ - const gchar *name; - GValue value; -} GLIB_DEPRECATED_TYPE_IN_2_54; - - -/* --- prototypes --- */ -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_ref (GParamSpec *pspec); -GLIB_AVAILABLE_IN_ALL -void g_param_spec_unref (GParamSpec *pspec); -GLIB_AVAILABLE_IN_ALL -void g_param_spec_sink (GParamSpec *pspec); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_ref_sink (GParamSpec *pspec); -GLIB_AVAILABLE_IN_ALL -gpointer g_param_spec_get_qdata (GParamSpec *pspec, - GQuark quark); -GLIB_AVAILABLE_IN_ALL -void g_param_spec_set_qdata (GParamSpec *pspec, - GQuark quark, - gpointer data); -GLIB_AVAILABLE_IN_ALL -void g_param_spec_set_qdata_full (GParamSpec *pspec, - GQuark quark, - gpointer data, - GDestroyNotify destroy); -GLIB_AVAILABLE_IN_ALL -gpointer g_param_spec_steal_qdata (GParamSpec *pspec, - GQuark quark); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_get_redirect_target (GParamSpec *pspec); - -GLIB_AVAILABLE_IN_ALL -void g_param_value_set_default (GParamSpec *pspec, - GValue *value); -GLIB_AVAILABLE_IN_ALL -gboolean g_param_value_defaults (GParamSpec *pspec, - const GValue *value); -GLIB_AVAILABLE_IN_ALL -gboolean g_param_value_validate (GParamSpec *pspec, - GValue *value); -GLIB_AVAILABLE_IN_ALL -gboolean g_param_value_convert (GParamSpec *pspec, - const GValue *src_value, - GValue *dest_value, - gboolean strict_validation); -GLIB_AVAILABLE_IN_ALL -gint g_param_values_cmp (GParamSpec *pspec, - const GValue *value1, - const GValue *value2); -GLIB_AVAILABLE_IN_ALL -const gchar * g_param_spec_get_name (GParamSpec *pspec); -GLIB_AVAILABLE_IN_ALL -const gchar * g_param_spec_get_nick (GParamSpec *pspec); -GLIB_AVAILABLE_IN_ALL -const gchar * g_param_spec_get_blurb (GParamSpec *pspec); -GLIB_AVAILABLE_IN_ALL -void g_value_set_param (GValue *value, - GParamSpec *param); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_value_get_param (const GValue *value); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_value_dup_param (const GValue *value); - - -GLIB_AVAILABLE_IN_ALL -void g_value_take_param (GValue *value, - GParamSpec *param); -GLIB_DEPRECATED_FOR(g_value_take_param) -void g_value_set_param_take_ownership (GValue *value, - GParamSpec *param); -GLIB_AVAILABLE_IN_2_36 -const GValue * g_param_spec_get_default_value (GParamSpec *pspec); - -GLIB_AVAILABLE_IN_2_46 -GQuark g_param_spec_get_name_quark (GParamSpec *pspec); - -/* --- convenience functions --- */ -typedef struct _GParamSpecTypeInfo GParamSpecTypeInfo; -/** - * GParamSpecTypeInfo: - * @instance_size: Size of the instance (object) structure. - * @n_preallocs: Prior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10, it is ignored, since instances are allocated with the [slice allocator][glib-Memory-Slices] now. - * @instance_init: Location of the instance initialization function (optional). - * @value_type: The #GType of values conforming to this #GParamSpec - * @finalize: The instance finalization function (optional). - * @value_set_default: Resets a @value to the default value for @pspec - * (recommended, the default is g_value_reset()), see - * g_param_value_set_default(). - * @value_validate: Ensures that the contents of @value comply with the - * specifications set out by @pspec (optional), see - * g_param_value_validate(). - * @values_cmp: Compares @value1 with @value2 according to @pspec - * (recommended, the default is memcmp()), see g_param_values_cmp(). - * - * This structure is used to provide the type system with the information - * required to initialize and destruct (finalize) a parameter's class and - * instances thereof. - * The initialized structure is passed to the g_param_type_register_static() - * The type system will perform a deep copy of this structure, so its memory - * does not need to be persistent across invocation of - * g_param_type_register_static(). - */ -struct _GParamSpecTypeInfo -{ - /* type system portion */ - guint16 instance_size; /* obligatory */ - guint16 n_preallocs; /* optional */ - void (*instance_init) (GParamSpec *pspec); /* optional */ - - /* class portion */ - GType value_type; /* obligatory */ - void (*finalize) (GParamSpec *pspec); /* optional */ - void (*value_set_default) (GParamSpec *pspec, /* recommended */ - GValue *value); - gboolean (*value_validate) (GParamSpec *pspec, /* optional */ - GValue *value); - gint (*values_cmp) (GParamSpec *pspec, /* recommended */ - const GValue *value1, - const GValue *value2); -}; -GLIB_AVAILABLE_IN_ALL -GType g_param_type_register_static (const gchar *name, - const GParamSpecTypeInfo *pspec_info); - -GLIB_AVAILABLE_IN_2_66 -gboolean g_param_spec_is_valid_name (const gchar *name); - -/* For registering builting types */ -GType _g_param_type_register_static_constant (const gchar *name, - const GParamSpecTypeInfo *pspec_info, - GType opt_type); - - -/* --- protected --- */ -GLIB_AVAILABLE_IN_ALL -gpointer g_param_spec_internal (GType param_type, - const gchar *name, - const gchar *nick, - const gchar *blurb, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpecPool* g_param_spec_pool_new (gboolean type_prefixing); -GLIB_AVAILABLE_IN_ALL -void g_param_spec_pool_insert (GParamSpecPool *pool, - GParamSpec *pspec, - GType owner_type); -GLIB_AVAILABLE_IN_ALL -void g_param_spec_pool_remove (GParamSpecPool *pool, - GParamSpec *pspec); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_pool_lookup (GParamSpecPool *pool, - const gchar *param_name, - GType owner_type, - gboolean walk_ancestors); -GLIB_AVAILABLE_IN_ALL -GList* g_param_spec_pool_list_owned (GParamSpecPool *pool, - GType owner_type); -GLIB_AVAILABLE_IN_ALL -GParamSpec** g_param_spec_pool_list (GParamSpecPool *pool, - GType owner_type, - guint *n_pspecs_p); - - -/* contracts: - * - * gboolean value_validate (GParamSpec *pspec, - * GValue *value): - * modify value contents in the least destructive way, so - * that it complies with pspec's requirements (i.e. - * according to minimum/maximum ranges etc...). return - * whether modification was necessary. - * - * gint values_cmp (GParamSpec *pspec, - * const GValue *value1, - * const GValue *value2): - * return value1 - value2, i.e. (-1) if value1 < value2, - * (+1) if value1 > value2, and (0) otherwise (equality) - */ - -G_END_DECLS - -#endif /* __G_PARAM_H__ */ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 2000-2001 Red Hat, Inc. - * Copyright (C) 2005 Imendio AB - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ -#ifndef __G_CLOSURE_H__ -#define __G_CLOSURE_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/* --- defines --- */ -/** - * G_CLOSURE_NEEDS_MARSHAL: - * @closure: a #GClosure - * - * Check if the closure still needs a marshaller. See g_closure_set_marshal(). - * - * Returns: %TRUE if a #GClosureMarshal marshaller has not yet been set on - * @closure. - */ -#define G_CLOSURE_NEEDS_MARSHAL(closure) (((GClosure*) (closure))->marshal == NULL) -/** - * G_CLOSURE_N_NOTIFIERS: - * @cl: a #GClosure - * - * Get the total number of notifiers connected with the closure @cl. - * The count includes the meta marshaller, the finalize and invalidate notifiers - * and the marshal guards. Note that each guard counts as two notifiers. - * See g_closure_set_meta_marshal(), g_closure_add_finalize_notifier(), - * g_closure_add_invalidate_notifier() and g_closure_add_marshal_guards(). - * - * Returns: number of notifiers - */ -#define G_CLOSURE_N_NOTIFIERS(cl) (((cl)->n_guards << 1L) + \ - (cl)->n_fnotifiers + (cl)->n_inotifiers) -/** - * G_CCLOSURE_SWAP_DATA: - * @cclosure: a #GCClosure - * - * Checks whether the user data of the #GCClosure should be passed as the - * first parameter to the callback. See g_cclosure_new_swap(). - * - * Returns: %TRUE if data has to be swapped. - */ -#define G_CCLOSURE_SWAP_DATA(cclosure) (((GClosure*) (cclosure))->derivative_flag) -/** - * G_CALLBACK: - * @f: a function pointer. - * - * Cast a function pointer to a #GCallback. - */ -#define G_CALLBACK(f) ((GCallback) (f)) - - -/* -- typedefs --- */ -typedef struct _GClosure GClosure; -typedef struct _GClosureNotifyData GClosureNotifyData; - -/** - * GCallback: - * - * The type used for callback functions in structure definitions and function - * signatures. This doesn't mean that all callback functions must take no - * parameters and return void. The required signature of a callback function - * is determined by the context in which is used (e.g. the signal to which it - * is connected). Use G_CALLBACK() to cast the callback function to a #GCallback. - */ -typedef void (*GCallback) (void); -/** - * GClosureNotify: - * @data: data specified when registering the notification callback - * @closure: the #GClosure on which the notification is emitted - * - * The type used for the various notification callbacks which can be registered - * on closures. - */ -typedef void (*GClosureNotify) (gpointer data, - GClosure *closure); -/** - * GClosureMarshal: - * @closure: the #GClosure to which the marshaller belongs - * @return_value: (nullable): a #GValue to store the return - * value. May be %NULL if the callback of @closure doesn't return a - * value. - * @n_param_values: the length of the @param_values array - * @param_values: (array length=n_param_values): an array of - * #GValues holding the arguments on which to invoke the - * callback of @closure - * @invocation_hint: (nullable): the invocation hint given as the - * last argument to g_closure_invoke() - * @marshal_data: (nullable): additional data specified when - * registering the marshaller, see g_closure_set_marshal() and - * g_closure_set_meta_marshal() - * - * The type used for marshaller functions. - */ -typedef void (*GClosureMarshal) (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/** - * GVaClosureMarshal: - * @closure: the #GClosure to which the marshaller belongs - * @return_value: (nullable): a #GValue to store the return - * value. May be %NULL if the callback of @closure doesn't return a - * value. - * @instance: (type GObject.TypeInstance): the instance on which the closure is - * invoked. - * @args: va_list of arguments to be passed to the closure. - * @marshal_data: (nullable): additional data specified when - * registering the marshaller, see g_closure_set_marshal() and - * g_closure_set_meta_marshal() - * @n_params: the length of the @param_types array - * @param_types: (array length=n_params): the #GType of each argument from - * @args. - * - * This is the signature of va_list marshaller functions, an optional - * marshaller that can be used in some situations to avoid - * marshalling the signal argument into GValues. - */ -typedef void (* GVaClosureMarshal) (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/** - * GCClosure: - * @closure: the #GClosure - * @callback: the callback function - * - * A #GCClosure is a specialization of #GClosure for C function callbacks. - */ -typedef struct _GCClosure GCClosure; - - -/* --- structures --- */ -struct _GClosureNotifyData -{ - gpointer data; - GClosureNotify notify; -}; -/** - * GClosure: - * @in_marshal: Indicates whether the closure is currently being invoked with - * g_closure_invoke() - * @is_invalid: Indicates whether the closure has been invalidated by - * g_closure_invalidate() - * - * A #GClosure represents a callback supplied by the programmer. - */ -struct _GClosure -{ - /*< private >*/ - guint ref_count : 15; /* (atomic) */ - /* meta_marshal is not used anymore but must be zero for historical reasons - as it was exposed in the G_CLOSURE_N_NOTIFIERS macro */ - guint meta_marshal_nouse : 1; /* (atomic) */ - guint n_guards : 1; /* (atomic) */ - guint n_fnotifiers : 2; /* finalization notifiers (atomic) */ - guint n_inotifiers : 8; /* invalidation notifiers (atomic) */ - guint in_inotify : 1; /* (atomic) */ - guint floating : 1; /* (atomic) */ - /*< protected >*/ - guint derivative_flag : 1; /* (atomic) */ - /*< public >*/ - guint in_marshal : 1; /* (atomic) */ - guint is_invalid : 1; /* (atomic) */ - - /*< private >*/ void (*marshal) (GClosure *closure, - GValue /*out*/ *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - /*< protected >*/ gpointer data; - - /*< private >*/ GClosureNotifyData *notifiers; - - /* invariants/constraints: - * - ->marshal and ->data are _invalid_ as soon as ->is_invalid==TRUE - * - invocation of all inotifiers occurs prior to fnotifiers - * - order of inotifiers is random - * inotifiers may _not_ free/invalidate parameter values (e.g. ->data) - * - order of fnotifiers is random - * - each notifier may only be removed before or during its invocation - * - reference counting may only happen prior to fnotify invocation - * (in that sense, fnotifiers are really finalization handlers) - */ -}; -/* closure for C function calls, callback() is the user function - */ -struct _GCClosure -{ - GClosure closure; - gpointer callback; -}; - - -/* --- prototypes --- */ -GLIB_AVAILABLE_IN_ALL -GClosure* g_cclosure_new (GCallback callback_func, - gpointer user_data, - GClosureNotify destroy_data); -GLIB_AVAILABLE_IN_ALL -GClosure* g_cclosure_new_swap (GCallback callback_func, - gpointer user_data, - GClosureNotify destroy_data); -GLIB_AVAILABLE_IN_ALL -GClosure* g_signal_type_cclosure_new (GType itype, - guint struct_offset); - - -/* --- prototypes --- */ -GLIB_AVAILABLE_IN_ALL -GClosure* g_closure_ref (GClosure *closure); -GLIB_AVAILABLE_IN_ALL -void g_closure_sink (GClosure *closure); -GLIB_AVAILABLE_IN_ALL -void g_closure_unref (GClosure *closure); -/* intimidating */ -GLIB_AVAILABLE_IN_ALL -GClosure* g_closure_new_simple (guint sizeof_closure, - gpointer data); -GLIB_AVAILABLE_IN_ALL -void g_closure_add_finalize_notifier (GClosure *closure, - gpointer notify_data, - GClosureNotify notify_func); -GLIB_AVAILABLE_IN_ALL -void g_closure_remove_finalize_notifier (GClosure *closure, - gpointer notify_data, - GClosureNotify notify_func); -GLIB_AVAILABLE_IN_ALL -void g_closure_add_invalidate_notifier (GClosure *closure, - gpointer notify_data, - GClosureNotify notify_func); -GLIB_AVAILABLE_IN_ALL -void g_closure_remove_invalidate_notifier (GClosure *closure, - gpointer notify_data, - GClosureNotify notify_func); -GLIB_AVAILABLE_IN_ALL -void g_closure_add_marshal_guards (GClosure *closure, - gpointer pre_marshal_data, - GClosureNotify pre_marshal_notify, - gpointer post_marshal_data, - GClosureNotify post_marshal_notify); -GLIB_AVAILABLE_IN_ALL -void g_closure_set_marshal (GClosure *closure, - GClosureMarshal marshal); -GLIB_AVAILABLE_IN_ALL -void g_closure_set_meta_marshal (GClosure *closure, - gpointer marshal_data, - GClosureMarshal meta_marshal); -GLIB_AVAILABLE_IN_ALL -void g_closure_invalidate (GClosure *closure); -GLIB_AVAILABLE_IN_ALL -void g_closure_invoke (GClosure *closure, - GValue /*out*/ *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint); - -/* FIXME: - OK: data_object::destroy -> closure_invalidate(); - MIS: closure_invalidate() -> disconnect(closure); - MIS: disconnect(closure) -> (unlink) closure_unref(); - OK: closure_finalize() -> g_free (data_string); - - random remarks: - - need marshaller repo with decent aliasing to base types - - provide marshaller collection, virtually covering anything out there -*/ - -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_generic (GClosure *closure, - GValue *return_gvalue, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_generic_va (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args_list, - gpointer marshal_data, - int n_params, - GType *param_types); - - -G_END_DECLS - -#endif /* __G_CLOSURE_H__ */ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 2000-2001 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ -#ifndef __G_SIGNAL_H__ -#define __G_SIGNAL_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - -/* GObject - GLib Type, Object, Parameter and Signal Library - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ - -#ifndef __G_MARSHAL_H__ -#define __G_MARSHAL_H__ - -G_BEGIN_DECLS - -/* VOID:VOID */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__VOID (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__VOIDv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:BOOLEAN */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__BOOLEAN (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__BOOLEANv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:CHAR */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__CHAR (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__CHARv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:UCHAR */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__UCHAR (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__UCHARv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:INT */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__INT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__INTv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:UINT */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__UINT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__UINTv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:LONG */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__LONG (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__LONGv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:ULONG */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__ULONG (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__ULONGv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:ENUM */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__ENUM (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__ENUMv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:FLAGS */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__FLAGS (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__FLAGSv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:FLOAT */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__FLOAT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__FLOATv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:DOUBLE */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__DOUBLE (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__DOUBLEv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:STRING */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__STRING (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__STRINGv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:PARAM */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__PARAM (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__PARAMv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:BOXED */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__BOXED (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__BOXEDv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:POINTER */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__POINTERv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:OBJECT */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__OBJECT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__OBJECTv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:VARIANT */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__VARIANT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__VARIANTv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* VOID:UINT,POINTER */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__UINT_POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_VOID__UINT_POINTERv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* BOOL:FLAGS */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_BOOLEAN__FLAGS (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_BOOLEAN__FLAGSv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/** - * g_cclosure_marshal_BOOL__FLAGS: - * @closure: A #GClosure. - * @return_value: A #GValue to store the return value. May be %NULL - * if the callback of closure doesn't return a value. - * @n_param_values: The length of the @param_values array. - * @param_values: An array of #GValues holding the arguments - * on which to invoke the callback of closure. - * @invocation_hint: The invocation hint given as the last argument to - * g_closure_invoke(). - * @marshal_data: Additional data specified when registering the - * marshaller, see g_closure_set_marshal() and - * g_closure_set_meta_marshal() - * - * An old alias for g_cclosure_marshal_BOOLEAN__FLAGS(). - */ -#define g_cclosure_marshal_BOOL__FLAGS g_cclosure_marshal_BOOLEAN__FLAGS - -/* STRING:OBJECT,POINTER */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_STRING__OBJECT_POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_STRING__OBJECT_POINTERv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/* BOOL:BOXED,BOXED */ -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_BOOLEAN__BOXED_BOXED (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); -GLIB_AVAILABLE_IN_ALL -void g_cclosure_marshal_BOOLEAN__BOXED_BOXEDv (GClosure *closure, - GValue *return_value, - gpointer instance, - va_list args, - gpointer marshal_data, - int n_params, - GType *param_types); - -/** - * g_cclosure_marshal_BOOL__BOXED_BOXED: - * @closure: A #GClosure. - * @return_value: A #GValue to store the return value. May be %NULL - * if the callback of closure doesn't return a value. - * @n_param_values: The length of the @param_values array. - * @param_values: An array of #GValues holding the arguments - * on which to invoke the callback of closure. - * @invocation_hint: The invocation hint given as the last argument to - * g_closure_invoke(). - * @marshal_data: Additional data specified when registering the - * marshaller, see g_closure_set_marshal() and - * g_closure_set_meta_marshal() - * - * An old alias for g_cclosure_marshal_BOOLEAN__BOXED_BOXED(). - */ -#define g_cclosure_marshal_BOOL__BOXED_BOXED g_cclosure_marshal_BOOLEAN__BOXED_BOXED - -G_END_DECLS - -#endif /* __G_MARSHAL_H__ */ - -G_BEGIN_DECLS - -/* --- typedefs --- */ -typedef struct _GSignalQuery GSignalQuery; -typedef struct _GSignalInvocationHint GSignalInvocationHint; -/** - * GSignalCMarshaller: - * - * This is the signature of marshaller functions, required to marshall - * arrays of parameter values to signal emissions into C language callback - * invocations. It is merely an alias to #GClosureMarshal since the #GClosure - * mechanism takes over responsibility of actual function invocation for the - * signal system. - */ -typedef GClosureMarshal GSignalCMarshaller; -/** - * GSignalCVaMarshaller: - * - * This is the signature of va_list marshaller functions, an optional - * marshaller that can be used in some situations to avoid - * marshalling the signal argument into GValues. - */ -typedef GVaClosureMarshal GSignalCVaMarshaller; -/** - * GSignalEmissionHook: - * @ihint: Signal invocation hint, see #GSignalInvocationHint. - * @n_param_values: the number of parameters to the function, including - * the instance on which the signal was emitted. - * @param_values: (array length=n_param_values): the instance on which - * the signal was emitted, followed by the parameters of the emission. - * @data: user data associated with the hook. - * - * A simple function pointer to get invoked when the signal is emitted. This - * allows you to tie a hook to the signal type, so that it will trap all - * emissions of that signal, from any object. - * - * You may not attach these to signals created with the #G_SIGNAL_NO_HOOKS flag. - * - * Returns: whether it wants to stay connected. If it returns %FALSE, the signal - * hook is disconnected (and destroyed). - */ -typedef gboolean (*GSignalEmissionHook) (GSignalInvocationHint *ihint, - guint n_param_values, - const GValue *param_values, - gpointer data); -/** - * GSignalAccumulator: - * @ihint: Signal invocation hint, see #GSignalInvocationHint. - * @return_accu: Accumulator to collect callback return values in, this - * is the return value of the current signal emission. - * @handler_return: A #GValue holding the return value of the signal handler. - * @data: Callback data that was specified when creating the signal. - * - * The signal accumulator is a special callback function that can be used - * to collect return values of the various callbacks that are called - * during a signal emission. The signal accumulator is specified at signal - * creation time, if it is left %NULL, no accumulation of callback return - * values is performed. The return value of signal emissions is then the - * value returned by the last callback. - * - * Returns: The accumulator function returns whether the signal emission - * should be aborted. Returning %FALSE means to abort the - * current emission and %TRUE is returned for continuation. - */ -typedef gboolean (*GSignalAccumulator) (GSignalInvocationHint *ihint, - GValue *return_accu, - const GValue *handler_return, - gpointer data); - - -/* --- run, match and connect types --- */ -/** - * GSignalFlags: - * @G_SIGNAL_RUN_FIRST: Invoke the object method handler in the first emission stage. - * @G_SIGNAL_RUN_LAST: Invoke the object method handler in the third emission stage. - * @G_SIGNAL_RUN_CLEANUP: Invoke the object method handler in the last emission stage. - * @G_SIGNAL_NO_RECURSE: Signals being emitted for an object while currently being in - * emission for this very object will not be emitted recursively, - * but instead cause the first emission to be restarted. - * @G_SIGNAL_DETAILED: This signal supports "::detail" appendices to the signal name - * upon handler connections and emissions. - * @G_SIGNAL_ACTION: Action signals are signals that may freely be emitted on alive - * objects from user code via g_signal_emit() and friends, without - * the need of being embedded into extra code that performs pre or - * post emission adjustments on the object. They can also be thought - * of as object methods which can be called generically by - * third-party code. - * @G_SIGNAL_NO_HOOKS: No emissions hooks are supported for this signal. - * @G_SIGNAL_MUST_COLLECT: Varargs signal emission will always collect the - * arguments, even if there are no signal handlers connected. Since 2.30. - * @G_SIGNAL_DEPRECATED: The signal is deprecated and will be removed - * in a future version. A warning will be generated if it is connected while - * running with G_ENABLE_DIAGNOSTIC=1. Since 2.32. - * @G_SIGNAL_ACCUMULATOR_FIRST_RUN: Only used in #GSignalAccumulator accumulator - * functions for the #GSignalInvocationHint::run_type field to mark the first - * call to the accumulator function for a signal emission. Since 2.68. - * - * The signal flags are used to specify a signal's behaviour, the overall - * signal description outlines how especially the RUN flags control the - * stages of a signal emission. - */ -typedef enum -{ - G_SIGNAL_RUN_FIRST = 1 << 0, - G_SIGNAL_RUN_LAST = 1 << 1, - G_SIGNAL_RUN_CLEANUP = 1 << 2, - G_SIGNAL_NO_RECURSE = 1 << 3, - G_SIGNAL_DETAILED = 1 << 4, - G_SIGNAL_ACTION = 1 << 5, - G_SIGNAL_NO_HOOKS = 1 << 6, - G_SIGNAL_MUST_COLLECT = 1 << 7, - G_SIGNAL_DEPRECATED = 1 << 8, - /* normal signal flags until 1 << 16 */ - G_SIGNAL_ACCUMULATOR_FIRST_RUN = 1 << 17, -} GSignalFlags; -/** - * G_SIGNAL_FLAGS_MASK: - * - * A mask for all #GSignalFlags bits. - */ -#define G_SIGNAL_FLAGS_MASK 0x1ff -/** - * GConnectFlags: - * @G_CONNECT_AFTER: whether the handler should be called before or after the - * default handler of the signal. - * @G_CONNECT_SWAPPED: whether the instance and data should be swapped when - * calling the handler; see g_signal_connect_swapped() for an example. - * - * The connection flags are used to specify the behaviour of a signal's - * connection. - */ -typedef enum -{ - G_CONNECT_AFTER = 1 << 0, - G_CONNECT_SWAPPED = 1 << 1 -} GConnectFlags; -/** - * GSignalMatchType: - * @G_SIGNAL_MATCH_ID: The signal id must be equal. - * @G_SIGNAL_MATCH_DETAIL: The signal detail must be equal. - * @G_SIGNAL_MATCH_CLOSURE: The closure must be the same. - * @G_SIGNAL_MATCH_FUNC: The C closure callback must be the same. - * @G_SIGNAL_MATCH_DATA: The closure data must be the same. - * @G_SIGNAL_MATCH_UNBLOCKED: Only unblocked signals may be matched. - * - * The match types specify what g_signal_handlers_block_matched(), - * g_signal_handlers_unblock_matched() and g_signal_handlers_disconnect_matched() - * match signals by. - */ -typedef enum -{ - G_SIGNAL_MATCH_ID = 1 << 0, - G_SIGNAL_MATCH_DETAIL = 1 << 1, - G_SIGNAL_MATCH_CLOSURE = 1 << 2, - G_SIGNAL_MATCH_FUNC = 1 << 3, - G_SIGNAL_MATCH_DATA = 1 << 4, - G_SIGNAL_MATCH_UNBLOCKED = 1 << 5 -} GSignalMatchType; -/** - * G_SIGNAL_MATCH_MASK: - * - * A mask for all #GSignalMatchType bits. - */ -#define G_SIGNAL_MATCH_MASK 0x3f -/** - * G_SIGNAL_TYPE_STATIC_SCOPE: - * - * This macro flags signal argument types for which the signal system may - * assume that instances thereof remain persistent across all signal emissions - * they are used in. This is only useful for non ref-counted, value-copy types. - * - * To flag a signal argument in this way, add `| G_SIGNAL_TYPE_STATIC_SCOPE` - * to the corresponding argument of g_signal_new(). - * |[ - * g_signal_new ("size_request", - * G_TYPE_FROM_CLASS (gobject_class), - * G_SIGNAL_RUN_FIRST, - * G_STRUCT_OFFSET (GtkWidgetClass, size_request), - * NULL, NULL, - * _gtk_marshal_VOID__BOXED, - * G_TYPE_NONE, 1, - * GTK_TYPE_REQUISITION | G_SIGNAL_TYPE_STATIC_SCOPE); - * ]| - */ -#define G_SIGNAL_TYPE_STATIC_SCOPE (G_TYPE_FLAG_RESERVED_ID_BIT) - - -/* --- signal information --- */ -/** - * GSignalInvocationHint: - * @signal_id: The signal id of the signal invoking the callback - * @detail: The detail passed on for this emission - * @run_type: The stage the signal emission is currently in, this - * field will contain one of %G_SIGNAL_RUN_FIRST, - * %G_SIGNAL_RUN_LAST or %G_SIGNAL_RUN_CLEANUP and %G_SIGNAL_ACCUMULATOR_FIRST_RUN. - * %G_SIGNAL_ACCUMULATOR_FIRST_RUN is only set for the first run of the accumulator - * function for a signal emission. - * - * The #GSignalInvocationHint structure is used to pass on additional information - * to callbacks during a signal emission. - */ -struct _GSignalInvocationHint -{ - guint signal_id; - GQuark detail; - GSignalFlags run_type; -}; -/** - * GSignalQuery: - * @signal_id: The signal id of the signal being queried, or 0 if the - * signal to be queried was unknown. - * @signal_name: The signal name. - * @itype: The interface/instance type that this signal can be emitted for. - * @signal_flags: The signal flags as passed in to g_signal_new(). - * @return_type: The return type for user callbacks. - * @n_params: The number of parameters that user callbacks take. - * @param_types: (array length=n_params): The individual parameter types for - * user callbacks, note that the effective callback signature is: - * |[ - * @return_type callback (#gpointer data1, - * [param_types param_names,] - * gpointer data2); - * ]| - * - * A structure holding in-depth information for a specific signal. It is - * filled in by the g_signal_query() function. - */ -struct _GSignalQuery -{ - guint signal_id; - const gchar *signal_name; - GType itype; - GSignalFlags signal_flags; - GType return_type; /* mangled with G_SIGNAL_TYPE_STATIC_SCOPE flag */ - guint n_params; - const GType *param_types; /* mangled with G_SIGNAL_TYPE_STATIC_SCOPE flag */ -}; - - -/* --- signals --- */ -GLIB_AVAILABLE_IN_ALL -guint g_signal_newv (const gchar *signal_name, - GType itype, - GSignalFlags signal_flags, - GClosure *class_closure, - GSignalAccumulator accumulator, - gpointer accu_data, - GSignalCMarshaller c_marshaller, - GType return_type, - guint n_params, - GType *param_types); -GLIB_AVAILABLE_IN_ALL -guint g_signal_new_valist (const gchar *signal_name, - GType itype, - GSignalFlags signal_flags, - GClosure *class_closure, - GSignalAccumulator accumulator, - gpointer accu_data, - GSignalCMarshaller c_marshaller, - GType return_type, - guint n_params, - va_list args); -GLIB_AVAILABLE_IN_ALL -guint g_signal_new (const gchar *signal_name, - GType itype, - GSignalFlags signal_flags, - guint class_offset, - GSignalAccumulator accumulator, - gpointer accu_data, - GSignalCMarshaller c_marshaller, - GType return_type, - guint n_params, - ...); -GLIB_AVAILABLE_IN_ALL -guint g_signal_new_class_handler (const gchar *signal_name, - GType itype, - GSignalFlags signal_flags, - GCallback class_handler, - GSignalAccumulator accumulator, - gpointer accu_data, - GSignalCMarshaller c_marshaller, - GType return_type, - guint n_params, - ...); -GLIB_AVAILABLE_IN_ALL -void g_signal_set_va_marshaller (guint signal_id, - GType instance_type, - GSignalCVaMarshaller va_marshaller); - -GLIB_AVAILABLE_IN_ALL -void g_signal_emitv (const GValue *instance_and_params, - guint signal_id, - GQuark detail, - GValue *return_value); -GLIB_AVAILABLE_IN_ALL -void g_signal_emit_valist (gpointer instance, - guint signal_id, - GQuark detail, - va_list var_args); -GLIB_AVAILABLE_IN_ALL -void g_signal_emit (gpointer instance, - guint signal_id, - GQuark detail, - ...); -GLIB_AVAILABLE_IN_ALL -void g_signal_emit_by_name (gpointer instance, - const gchar *detailed_signal, - ...); -GLIB_AVAILABLE_IN_ALL -guint g_signal_lookup (const gchar *name, - GType itype); -GLIB_AVAILABLE_IN_ALL -const gchar * g_signal_name (guint signal_id); -GLIB_AVAILABLE_IN_ALL -void g_signal_query (guint signal_id, - GSignalQuery *query); -GLIB_AVAILABLE_IN_ALL -guint* g_signal_list_ids (GType itype, - guint *n_ids); -GLIB_AVAILABLE_IN_2_66 -gboolean g_signal_is_valid_name (const gchar *name); -GLIB_AVAILABLE_IN_ALL -gboolean g_signal_parse_name (const gchar *detailed_signal, - GType itype, - guint *signal_id_p, - GQuark *detail_p, - gboolean force_detail_quark); -GLIB_AVAILABLE_IN_ALL -GSignalInvocationHint* g_signal_get_invocation_hint (gpointer instance); - - -/* --- signal emissions --- */ -GLIB_AVAILABLE_IN_ALL -void g_signal_stop_emission (gpointer instance, - guint signal_id, - GQuark detail); -GLIB_AVAILABLE_IN_ALL -void g_signal_stop_emission_by_name (gpointer instance, - const gchar *detailed_signal); -GLIB_AVAILABLE_IN_ALL -gulong g_signal_add_emission_hook (guint signal_id, - GQuark detail, - GSignalEmissionHook hook_func, - gpointer hook_data, - GDestroyNotify data_destroy); -GLIB_AVAILABLE_IN_ALL -void g_signal_remove_emission_hook (guint signal_id, - gulong hook_id); - - -/* --- signal handlers --- */ -GLIB_AVAILABLE_IN_ALL -gboolean g_signal_has_handler_pending (gpointer instance, - guint signal_id, - GQuark detail, - gboolean may_be_blocked); -GLIB_AVAILABLE_IN_ALL -gulong g_signal_connect_closure_by_id (gpointer instance, - guint signal_id, - GQuark detail, - GClosure *closure, - gboolean after); -GLIB_AVAILABLE_IN_ALL -gulong g_signal_connect_closure (gpointer instance, - const gchar *detailed_signal, - GClosure *closure, - gboolean after); -GLIB_AVAILABLE_IN_ALL -gulong g_signal_connect_data (gpointer instance, - const gchar *detailed_signal, - GCallback c_handler, - gpointer data, - GClosureNotify destroy_data, - GConnectFlags connect_flags); -GLIB_AVAILABLE_IN_ALL -void g_signal_handler_block (gpointer instance, - gulong handler_id); -GLIB_AVAILABLE_IN_ALL -void g_signal_handler_unblock (gpointer instance, - gulong handler_id); -GLIB_AVAILABLE_IN_ALL -void g_signal_handler_disconnect (gpointer instance, - gulong handler_id); -GLIB_AVAILABLE_IN_ALL -gboolean g_signal_handler_is_connected (gpointer instance, - gulong handler_id); -GLIB_AVAILABLE_IN_ALL -gulong g_signal_handler_find (gpointer instance, - GSignalMatchType mask, - guint signal_id, - GQuark detail, - GClosure *closure, - gpointer func, - gpointer data); -GLIB_AVAILABLE_IN_ALL -guint g_signal_handlers_block_matched (gpointer instance, - GSignalMatchType mask, - guint signal_id, - GQuark detail, - GClosure *closure, - gpointer func, - gpointer data); -GLIB_AVAILABLE_IN_ALL -guint g_signal_handlers_unblock_matched (gpointer instance, - GSignalMatchType mask, - guint signal_id, - GQuark detail, - GClosure *closure, - gpointer func, - gpointer data); -GLIB_AVAILABLE_IN_ALL -guint g_signal_handlers_disconnect_matched (gpointer instance, - GSignalMatchType mask, - guint signal_id, - GQuark detail, - GClosure *closure, - gpointer func, - gpointer data); - -GLIB_AVAILABLE_IN_2_62 -void g_clear_signal_handler (gulong *handler_id_ptr, - gpointer instance); - -#undef g_clear_signal_handler -#define g_clear_signal_handler(handler_id_ptr, instance) \ - G_STMT_START { \ - G_STATIC_ASSERT (sizeof *(handler_id_ptr) == sizeof (gulong)); \ - gulong _handler_id = *(handler_id_ptr); \ - \ - if (_handler_id > 0) \ - { \ - g_signal_handler_disconnect ((instance), _handler_id); \ - *(handler_id_ptr) = 0; \ - } \ - } G_STMT_END \ - GLIB_AVAILABLE_MACRO_IN_2_62 - -/* --- overriding and chaining --- */ -GLIB_AVAILABLE_IN_ALL -void g_signal_override_class_closure (guint signal_id, - GType instance_type, - GClosure *class_closure); -GLIB_AVAILABLE_IN_ALL -void g_signal_override_class_handler (const gchar *signal_name, - GType instance_type, - GCallback class_handler); -GLIB_AVAILABLE_IN_ALL -void g_signal_chain_from_overridden (const GValue *instance_and_params, - GValue *return_value); -GLIB_AVAILABLE_IN_ALL -void g_signal_chain_from_overridden_handler (gpointer instance, - ...); - - -/* --- convenience --- */ -/** - * g_signal_connect: - * @instance: the instance to connect to. - * @detailed_signal: a string of the form "signal-name::detail". - * @c_handler: the #GCallback to connect. - * @data: data to pass to @c_handler calls. - * - * Connects a #GCallback function to a signal for a particular object. - * - * The handler will be called before the default handler of the signal. - * - * See [memory management of signal handlers][signal-memory-management] for - * details on how to handle the return value and memory management of @data. - * - * Returns: the handler ID, of type #gulong (always greater than 0 for successful connections) - */ -#define g_signal_connect(instance, detailed_signal, c_handler, data) \ - g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, (GConnectFlags) 0) -/** - * g_signal_connect_after: - * @instance: the instance to connect to. - * @detailed_signal: a string of the form "signal-name::detail". - * @c_handler: the #GCallback to connect. - * @data: data to pass to @c_handler calls. - * - * Connects a #GCallback function to a signal for a particular object. - * - * The handler will be called after the default handler of the signal. - * - * Returns: the handler ID, of type #gulong (always greater than 0 for successful connections) - */ -#define g_signal_connect_after(instance, detailed_signal, c_handler, data) \ - g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, G_CONNECT_AFTER) -/** - * g_signal_connect_swapped: - * @instance: the instance to connect to. - * @detailed_signal: a string of the form "signal-name::detail". - * @c_handler: the #GCallback to connect. - * @data: data to pass to @c_handler calls. - * - * Connects a #GCallback function to a signal for a particular object. - * - * The instance on which the signal is emitted and @data will be swapped when - * calling the handler. This is useful when calling pre-existing functions to - * operate purely on the @data, rather than the @instance: swapping the - * parameters avoids the need to write a wrapper function. - * - * For example, this allows the shorter code: - * |[ - * g_signal_connect_swapped (button, "clicked", - * (GCallback) gtk_widget_hide, other_widget); - * ]| - * - * Rather than the cumbersome: - * |[ - * static void - * button_clicked_cb (GtkButton *button, GtkWidget *other_widget) - * { - * gtk_widget_hide (other_widget); - * } - * - * ... - * - * g_signal_connect (button, "clicked", - * (GCallback) button_clicked_cb, other_widget); - * ]| - * - * Returns: the handler ID, of type #gulong (always greater than 0 for successful connections) - */ -#define g_signal_connect_swapped(instance, detailed_signal, c_handler, data) \ - g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, G_CONNECT_SWAPPED) -/** - * g_signal_handlers_disconnect_by_func: - * @instance: The instance to remove handlers from. - * @func: The C closure callback of the handlers (useless for non-C closures). - * @data: The closure data of the handlers' closures. - * - * Disconnects all handlers on an instance that match @func and @data. - * - * Returns: The number of handlers that matched. - */ -#define g_signal_handlers_disconnect_by_func(instance, func, data) \ - g_signal_handlers_disconnect_matched ((instance), \ - (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), \ - 0, 0, NULL, (func), (data)) - -/** - * g_signal_handlers_disconnect_by_data: - * @instance: The instance to remove handlers from - * @data: the closure data of the handlers' closures - * - * Disconnects all handlers on an instance that match @data. - * - * Returns: The number of handlers that matched. - * - * Since: 2.32 - */ -#define g_signal_handlers_disconnect_by_data(instance, data) \ - g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, (data)) - -/** - * g_signal_handlers_block_by_func: - * @instance: The instance to block handlers from. - * @func: The C closure callback of the handlers (useless for non-C closures). - * @data: The closure data of the handlers' closures. - * - * Blocks all handlers on an instance that match @func and @data. - * - * Returns: The number of handlers that matched. - */ -#define g_signal_handlers_block_by_func(instance, func, data) \ - g_signal_handlers_block_matched ((instance), \ - (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), \ - 0, 0, NULL, (func), (data)) -/** - * g_signal_handlers_unblock_by_func: - * @instance: The instance to unblock handlers from. - * @func: The C closure callback of the handlers (useless for non-C closures). - * @data: The closure data of the handlers' closures. - * - * Unblocks all handlers on an instance that match @func and @data. - * - * Returns: The number of handlers that matched. - */ -#define g_signal_handlers_unblock_by_func(instance, func, data) \ - g_signal_handlers_unblock_matched ((instance), \ - (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), \ - 0, 0, NULL, (func), (data)) - - -GLIB_AVAILABLE_IN_ALL -gboolean g_signal_accumulator_true_handled (GSignalInvocationHint *ihint, - GValue *return_accu, - const GValue *handler_return, - gpointer dummy); - -GLIB_AVAILABLE_IN_ALL -gboolean g_signal_accumulator_first_wins (GSignalInvocationHint *ihint, - GValue *return_accu, - const GValue *handler_return, - gpointer dummy); - -/*< private >*/ -GLIB_AVAILABLE_IN_ALL -void g_signal_handlers_destroy (gpointer instance); -void _g_signals_destroy (GType itype); - -G_END_DECLS - -#endif /* __G_SIGNAL_H__ */ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 2000-2001 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ -#ifndef __G_BOXED_H__ -#define __G_BOXED_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - - -#ifndef __GI_SCANNER__ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 2000-2001 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ -#ifndef __GLIB_TYPES_H__ -#define __GLIB_TYPES_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) && !defined(GLIB_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/* A hack necesssary to preprocess this file with g-ir-scanner */ -#ifdef __GI_SCANNER__ -typedef gsize GType; -#endif - -/* --- GLib boxed types --- */ -/** - * G_TYPE_DATE: - * - * The #GType for #GDate. - */ -#define G_TYPE_DATE (g_date_get_type ()) - -/** - * G_TYPE_STRV: - * - * The #GType for a boxed type holding a %NULL-terminated array of strings. - * - * The code fragments in the following example show the use of a property of - * type #G_TYPE_STRV with g_object_class_install_property(), g_object_set() - * and g_object_get(). - * - * |[ - * g_object_class_install_property (object_class, - * PROP_AUTHORS, - * g_param_spec_boxed ("authors", - * _("Authors"), - * _("List of authors"), - * G_TYPE_STRV, - * G_PARAM_READWRITE)); - * - * gchar *authors[] = { "Owen", "Tim", NULL }; - * g_object_set (obj, "authors", authors, NULL); - * - * gchar *writers[]; - * g_object_get (obj, "authors", &writers, NULL); - * /* do something with writers */ - * g_strfreev (writers); - * ]| - * - * Since: 2.4 - */ -#define G_TYPE_STRV (g_strv_get_type ()) - -/** - * G_TYPE_GSTRING: - * - * The #GType for #GString. - */ -#define G_TYPE_GSTRING (g_gstring_get_type ()) - -/** - * G_TYPE_HASH_TABLE: - * - * The #GType for a boxed type holding a #GHashTable reference. - * - * Since: 2.10 - */ -#define G_TYPE_HASH_TABLE (g_hash_table_get_type ()) - -/** - * G_TYPE_REGEX: - * - * The #GType for a boxed type holding a #GRegex reference. - * - * Since: 2.14 - */ -#define G_TYPE_REGEX (g_regex_get_type ()) - -/** - * G_TYPE_MATCH_INFO: - * - * The #GType for a boxed type holding a #GMatchInfo reference. - * - * Since: 2.30 - */ -#define G_TYPE_MATCH_INFO (g_match_info_get_type ()) - -/** - * G_TYPE_ARRAY: - * - * The #GType for a boxed type holding a #GArray reference. - * - * Since: 2.22 - */ -#define G_TYPE_ARRAY (g_array_get_type ()) - -/** - * G_TYPE_BYTE_ARRAY: - * - * The #GType for a boxed type holding a #GByteArray reference. - * - * Since: 2.22 - */ -#define G_TYPE_BYTE_ARRAY (g_byte_array_get_type ()) - -/** - * G_TYPE_PTR_ARRAY: - * - * The #GType for a boxed type holding a #GPtrArray reference. - * - * Since: 2.22 - */ -#define G_TYPE_PTR_ARRAY (g_ptr_array_get_type ()) - -/** - * G_TYPE_BYTES: - * - * The #GType for #GBytes. - * - * Since: 2.32 - */ -#define G_TYPE_BYTES (g_bytes_get_type ()) - -/** - * G_TYPE_VARIANT_TYPE: - * - * The #GType for a boxed type holding a #GVariantType. - * - * Since: 2.24 - */ -#define G_TYPE_VARIANT_TYPE (g_variant_type_get_gtype ()) - -/** - * G_TYPE_ERROR: - * - * The #GType for a boxed type holding a #GError. - * - * Since: 2.26 - */ -#define G_TYPE_ERROR (g_error_get_type ()) - -/** - * G_TYPE_DATE_TIME: - * - * The #GType for a boxed type holding a #GDateTime. - * - * Since: 2.26 - */ -#define G_TYPE_DATE_TIME (g_date_time_get_type ()) - -/** - * G_TYPE_TIME_ZONE: - * - * The #GType for a boxed type holding a #GTimeZone. - * - * Since: 2.34 - */ -#define G_TYPE_TIME_ZONE (g_time_zone_get_type ()) - -/** - * G_TYPE_IO_CHANNEL: - * - * The #GType for #GIOChannel. - */ -#define G_TYPE_IO_CHANNEL (g_io_channel_get_type ()) - -/** - * G_TYPE_IO_CONDITION: - * - * The #GType for #GIOCondition. - */ -#define G_TYPE_IO_CONDITION (g_io_condition_get_type ()) - -/** - * G_TYPE_VARIANT_BUILDER: - * - * The #GType for a boxed type holding a #GVariantBuilder. - * - * Since: 2.30 - */ -#define G_TYPE_VARIANT_BUILDER (g_variant_builder_get_type ()) - -/** - * G_TYPE_VARIANT_DICT: - * - * The #GType for a boxed type holding a #GVariantDict. - * - * Since: 2.40 - */ -#define G_TYPE_VARIANT_DICT (g_variant_dict_get_type ()) - -/** - * G_TYPE_MAIN_LOOP: - * - * The #GType for a boxed type holding a #GMainLoop. - * - * Since: 2.30 - */ -#define G_TYPE_MAIN_LOOP (g_main_loop_get_type ()) - -/** - * G_TYPE_MAIN_CONTEXT: - * - * The #GType for a boxed type holding a #GMainContext. - * - * Since: 2.30 - */ -#define G_TYPE_MAIN_CONTEXT (g_main_context_get_type ()) - -/** - * G_TYPE_SOURCE: - * - * The #GType for a boxed type holding a #GSource. - * - * Since: 2.30 - */ -#define G_TYPE_SOURCE (g_source_get_type ()) - -/** - * G_TYPE_POLLFD: - * - * The #GType for a boxed type holding a #GPollFD. - * - * Since: 2.36 - */ -#define G_TYPE_POLLFD (g_pollfd_get_type ()) - -/** - * G_TYPE_MARKUP_PARSE_CONTEXT: - * - * The #GType for a boxed type holding a #GMarkupParseContext. - * - * Since: 2.36 - */ -#define G_TYPE_MARKUP_PARSE_CONTEXT (g_markup_parse_context_get_type ()) - -/** - * G_TYPE_KEY_FILE: - * - * The #GType for a boxed type holding a #GKeyFile. - * - * Since: 2.32 - */ -#define G_TYPE_KEY_FILE (g_key_file_get_type ()) - -/** - * G_TYPE_MAPPED_FILE: - * - * The #GType for a boxed type holding a #GMappedFile. - * - * Since: 2.40 - */ -#define G_TYPE_MAPPED_FILE (g_mapped_file_get_type ()) - -/** - * G_TYPE_THREAD: - * - * The #GType for a boxed type holding a #GThread. - * - * Since: 2.36 - */ -#define G_TYPE_THREAD (g_thread_get_type ()) - -/** - * G_TYPE_CHECKSUM: - * - * The #GType for a boxed type holding a #GChecksum. - * - * Since: 2.36 - */ -#define G_TYPE_CHECKSUM (g_checksum_get_type ()) - -/** - * G_TYPE_OPTION_GROUP: - * - * The #GType for a boxed type holding a #GOptionGroup. - * - * Since: 2.44 - */ -#define G_TYPE_OPTION_GROUP (g_option_group_get_type ()) - -/** - * G_TYPE_URI: - * - * The #GType for a boxed type holding a #GUri. - * - * Since: 2.66 - */ -#define G_TYPE_URI (g_uri_get_type ()) - -/** - * G_TYPE_TREE: - * - * The #GType for #GTree. - * - * Since: 2.68 - */ -#define G_TYPE_TREE (g_tree_get_type ()) - -GLIB_AVAILABLE_IN_ALL -GType g_date_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_strv_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_gstring_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_hash_table_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_array_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_byte_array_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_ptr_array_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_bytes_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_variant_type_get_gtype (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_regex_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_2_30 -GType g_match_info_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_error_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_date_time_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_time_zone_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_io_channel_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_io_condition_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_variant_builder_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_2_40 -GType g_variant_dict_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_key_file_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_2_30 -GType g_main_loop_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_2_30 -GType g_main_context_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_2_30 -GType g_source_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_2_36 -GType g_pollfd_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_2_36 -GType g_thread_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_2_36 -GType g_checksum_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_2_36 -GType g_markup_parse_context_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_2_40 -GType g_mapped_file_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_2_44 -GType g_option_group_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_2_66 -GType g_uri_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_2_68 -GType g_tree_get_type (void) G_GNUC_CONST; - -GLIB_DEPRECATED_FOR('G_TYPE_VARIANT') -GType g_variant_get_gtype (void) G_GNUC_CONST; - -G_END_DECLS - -#endif /* __GLIB_TYPES_H__ */ -#endif - -G_BEGIN_DECLS - -/* --- type macros --- */ -#define G_TYPE_IS_BOXED(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_BOXED) -/** - * G_VALUE_HOLDS_BOXED: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values derived - * from type %G_TYPE_BOXED. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_BOXED(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_BOXED)) - - -/* --- typedefs --- */ -/** - * GBoxedCopyFunc: - * @boxed: (not nullable): The boxed structure to be copied. - * - * This function is provided by the user and should produce a copy - * of the passed in boxed structure. - * - * Returns: (not nullable): The newly created copy of the boxed structure. - */ -typedef gpointer (*GBoxedCopyFunc) (gpointer boxed); - -/** - * GBoxedFreeFunc: - * @boxed: (not nullable): The boxed structure to be freed. - * - * This function is provided by the user and should free the boxed - * structure passed. - */ -typedef void (*GBoxedFreeFunc) (gpointer boxed); - - -/* --- prototypes --- */ -GLIB_AVAILABLE_IN_ALL -gpointer g_boxed_copy (GType boxed_type, - gconstpointer src_boxed); -GLIB_AVAILABLE_IN_ALL -void g_boxed_free (GType boxed_type, - gpointer boxed); -GLIB_AVAILABLE_IN_ALL -void g_value_set_boxed (GValue *value, - gconstpointer v_boxed); -GLIB_AVAILABLE_IN_ALL -void g_value_set_static_boxed (GValue *value, - gconstpointer v_boxed); -GLIB_AVAILABLE_IN_ALL -void g_value_take_boxed (GValue *value, - gconstpointer v_boxed); -GLIB_DEPRECATED_FOR(g_value_take_boxed) -void g_value_set_boxed_take_ownership (GValue *value, - gconstpointer v_boxed); -GLIB_AVAILABLE_IN_ALL -gpointer g_value_get_boxed (const GValue *value); -GLIB_AVAILABLE_IN_ALL -gpointer g_value_dup_boxed (const GValue *value); - - -/* --- convenience --- */ -GLIB_AVAILABLE_IN_ALL -GType g_boxed_type_register_static (const gchar *name, - GBoxedCopyFunc boxed_copy, - GBoxedFreeFunc boxed_free); - -/* --- GObject boxed types --- */ -/** - * G_TYPE_CLOSURE: - * - * The #GType for #GClosure. - */ -#define G_TYPE_CLOSURE (g_closure_get_type ()) - -/** - * G_TYPE_VALUE: - * - * The type ID of the "GValue" type which is a boxed type, - * used to pass around pointers to GValues. - */ -#define G_TYPE_VALUE (g_value_get_type ()) - -GLIB_AVAILABLE_IN_ALL -GType g_closure_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_value_get_type (void) G_GNUC_CONST; - -G_END_DECLS - -#endif /* __G_BOXED_H__ */ - -G_BEGIN_DECLS - -/* --- type macros --- */ -/** - * G_TYPE_IS_OBJECT: - * @type: Type id to check - * - * Check if the passed in type id is a %G_TYPE_OBJECT or derived from it. - * - * Returns: %FALSE or %TRUE, indicating whether @type is a %G_TYPE_OBJECT. - */ -#define G_TYPE_IS_OBJECT(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_OBJECT) -/** - * G_OBJECT: - * @object: Object which is subject to casting. - * - * Casts a #GObject or derived pointer into a (GObject*) pointer. - * Depending on the current debugging level, this function may invoke - * certain runtime checks to identify invalid casts. - */ -#define G_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject)) -/** - * G_OBJECT_CLASS: - * @class: a valid #GObjectClass - * - * Casts a derived #GObjectClass structure into a #GObjectClass structure. - */ -#define G_OBJECT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_OBJECT, GObjectClass)) -/** - * G_IS_OBJECT: - * @object: Instance to check for being a %G_TYPE_OBJECT. - * - * Checks whether a valid #GTypeInstance pointer is of type %G_TYPE_OBJECT. - */ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_42 -#define G_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE ((object), G_TYPE_OBJECT)) -#else -#define G_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_OBJECT)) -#endif -/** - * G_IS_OBJECT_CLASS: - * @class: a #GObjectClass - * - * Checks whether @class "is a" valid #GObjectClass structure of type - * %G_TYPE_OBJECT or derived. - */ -#define G_IS_OBJECT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_OBJECT)) -/** - * G_OBJECT_GET_CLASS: - * @object: a #GObject instance. - * - * Get the class structure associated to a #GObject instance. - * - * Returns: pointer to object class structure. - */ -#define G_OBJECT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_OBJECT, GObjectClass)) -/** - * G_OBJECT_TYPE: - * @object: Object to return the type id for. - * - * Get the type id of an object. - * - * Returns: Type id of @object. - */ -#define G_OBJECT_TYPE(object) (G_TYPE_FROM_INSTANCE (object)) -/** - * G_OBJECT_TYPE_NAME: - * @object: Object to return the type name for. - * - * Get the name of an object's type. - * - * Returns: Type name of @object. The string is owned by the type system and - * should not be freed. - */ -#define G_OBJECT_TYPE_NAME(object) (g_type_name (G_OBJECT_TYPE (object))) -/** - * G_OBJECT_CLASS_TYPE: - * @class: a valid #GObjectClass - * - * Get the type id of a class structure. - * - * Returns: Type id of @class. - */ -#define G_OBJECT_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class)) -/** - * G_OBJECT_CLASS_NAME: - * @class: a valid #GObjectClass - * - * Return the name of a class structure's type. - * - * Returns: Type name of @class. The string is owned by the type system and - * should not be freed. - */ -#define G_OBJECT_CLASS_NAME(class) (g_type_name (G_OBJECT_CLASS_TYPE (class))) -/** - * G_VALUE_HOLDS_OBJECT: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values derived from type %G_TYPE_OBJECT. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_OBJECT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_OBJECT)) - -/* --- type macros --- */ -/** - * G_TYPE_INITIALLY_UNOWNED: - * - * The type for #GInitiallyUnowned. - */ -#define G_TYPE_INITIALLY_UNOWNED (g_initially_unowned_get_type()) -/** - * G_INITIALLY_UNOWNED: - * @object: Object which is subject to casting. - * - * Casts a #GInitiallyUnowned or derived pointer into a (GInitiallyUnowned*) - * pointer. Depending on the current debugging level, this function may invoke - * certain runtime checks to identify invalid casts. - */ -#define G_INITIALLY_UNOWNED(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnowned)) -/** - * G_INITIALLY_UNOWNED_CLASS: - * @class: a valid #GInitiallyUnownedClass - * - * Casts a derived #GInitiallyUnownedClass structure into a - * #GInitiallyUnownedClass structure. - */ -#define G_INITIALLY_UNOWNED_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnownedClass)) -/** - * G_IS_INITIALLY_UNOWNED: - * @object: Instance to check for being a %G_TYPE_INITIALLY_UNOWNED. - * - * Checks whether a valid #GTypeInstance pointer is of type %G_TYPE_INITIALLY_UNOWNED. - */ -#define G_IS_INITIALLY_UNOWNED(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_INITIALLY_UNOWNED)) -/** - * G_IS_INITIALLY_UNOWNED_CLASS: - * @class: a #GInitiallyUnownedClass - * - * Checks whether @class "is a" valid #GInitiallyUnownedClass structure of type - * %G_TYPE_INITIALLY_UNOWNED or derived. - */ -#define G_IS_INITIALLY_UNOWNED_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_INITIALLY_UNOWNED)) -/** - * G_INITIALLY_UNOWNED_GET_CLASS: - * @object: a #GInitiallyUnowned instance. - * - * Get the class structure associated to a #GInitiallyUnowned instance. - * - * Returns: pointer to object class structure. - */ -#define G_INITIALLY_UNOWNED_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnownedClass)) -/* GInitiallyUnowned ia a GObject with initially floating reference count */ - - -/* --- typedefs & structures --- */ -typedef struct _GObject GObject; -typedef struct _GObjectClass GObjectClass; -typedef struct _GObject GInitiallyUnowned; -typedef struct _GObjectClass GInitiallyUnownedClass; -typedef struct _GObjectConstructParam GObjectConstructParam; -/** - * GObjectGetPropertyFunc: - * @object: a #GObject - * @property_id: the numeric id under which the property was registered with - * g_object_class_install_property(). - * @value: a #GValue to return the property value in - * @pspec: the #GParamSpec describing the property - * - * The type of the @get_property function of #GObjectClass. - */ -typedef void (*GObjectGetPropertyFunc) (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); -/** - * GObjectSetPropertyFunc: - * @object: a #GObject - * @property_id: the numeric id under which the property was registered with - * g_object_class_install_property(). - * @value: the new value for the property - * @pspec: the #GParamSpec describing the property - * - * The type of the @set_property function of #GObjectClass. - */ -typedef void (*GObjectSetPropertyFunc) (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -/** - * GObjectFinalizeFunc: - * @object: the #GObject being finalized - * - * The type of the @finalize function of #GObjectClass. - */ -typedef void (*GObjectFinalizeFunc) (GObject *object); -/** - * GWeakNotify: - * @data: data that was provided when the weak reference was established - * @where_the_object_was: the object being disposed - * - * A #GWeakNotify function can be added to an object as a callback that gets - * triggered when the object is finalized. Since the object is already being - * disposed when the #GWeakNotify is called, there's not much you could do - * with the object, apart from e.g. using its address as hash-index or the like. - */ -typedef void (*GWeakNotify) (gpointer data, - GObject *where_the_object_was); -/** - * GObject: - * - * All the fields in the GObject structure are private - * to the #GObject implementation and should never be accessed directly. - */ -struct _GObject -{ - GTypeInstance g_type_instance; - - /*< private >*/ - guint ref_count; /* (atomic) */ - GData *qdata; -}; -/** - * GObjectClass: - * @g_type_class: the parent class - * @constructor: the @constructor function is called by g_object_new () to - * complete the object initialization after all the construction properties are - * set. The first thing a @constructor implementation must do is chain up to the - * @constructor of the parent class. Overriding @constructor should be rarely - * needed, e.g. to handle construct properties, or to implement singletons. - * @set_property: the generic setter for all properties of this type. Should be - * overridden for every type with properties. If implementations of - * @set_property don't emit property change notification explicitly, this will - * be done implicitly by the type system. However, if the notify signal is - * emitted explicitly, the type system will not emit it a second time. - * @get_property: the generic getter for all properties of this type. Should be - * overridden for every type with properties. - * @dispose: the @dispose function is supposed to drop all references to other - * objects, but keep the instance otherwise intact, so that client method - * invocations still work. It may be run multiple times (due to reference - * loops). Before returning, @dispose should chain up to the @dispose method - * of the parent class. - * @finalize: instance finalization function, should finish the finalization of - * the instance begun in @dispose and chain up to the @finalize method of the - * parent class. - * @dispatch_properties_changed: emits property change notification for a bunch - * of properties. Overriding @dispatch_properties_changed should be rarely - * needed. - * @notify: the class closure for the notify signal - * @constructed: the @constructed function is called by g_object_new() as the - * final step of the object creation process. At the point of the call, all - * construction properties have been set on the object. The purpose of this - * call is to allow for object initialisation steps that can only be performed - * after construction properties have been set. @constructed implementors - * should chain up to the @constructed call of their parent class to allow it - * to complete its initialisation. - * - * The class structure for the GObject type. - * - * |[ - * // Example of implementing a singleton using a constructor. - * static MySingleton *the_singleton = NULL; - * - * static GObject* - * my_singleton_constructor (GType type, - * guint n_construct_params, - * GObjectConstructParam *construct_params) - * { - * GObject *object; - * - * if (!the_singleton) - * { - * object = G_OBJECT_CLASS (parent_class)->constructor (type, - * n_construct_params, - * construct_params); - * the_singleton = MY_SINGLETON (object); - * } - * else - * object = g_object_ref (G_OBJECT (the_singleton)); - * - * return object; - * } - * ]| - */ -struct _GObjectClass -{ - GTypeClass g_type_class; - - /*< private >*/ - GSList *construct_properties; - - /*< public >*/ - /* seldom overridden */ - GObject* (*constructor) (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties); - /* overridable methods */ - void (*set_property) (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); - void (*get_property) (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); - void (*dispose) (GObject *object); - void (*finalize) (GObject *object); - /* seldom overridden */ - void (*dispatch_properties_changed) (GObject *object, - guint n_pspecs, - GParamSpec **pspecs); - /* signals */ - void (*notify) (GObject *object, - GParamSpec *pspec); - - /* called when done constructing */ - void (*constructed) (GObject *object); - - /*< private >*/ - gsize flags; - - /* padding */ - gpointer pdummy[6]; -}; -/** - * GObjectConstructParam: - * @pspec: the #GParamSpec of the construct parameter - * @value: the value to set the parameter to - * - * The GObjectConstructParam struct is an auxiliary - * structure used to hand #GParamSpec/#GValue pairs to the @constructor of - * a #GObjectClass. - */ -struct _GObjectConstructParam -{ - GParamSpec *pspec; - GValue *value; -}; - -/** - * GInitiallyUnowned: - * - * All the fields in the GInitiallyUnowned structure - * are private to the #GInitiallyUnowned implementation and should never be - * accessed directly. - */ -/** - * GInitiallyUnownedClass: - * - * The class structure for the GInitiallyUnowned type. - */ - - -/* --- prototypes --- */ -GLIB_AVAILABLE_IN_ALL -GType g_initially_unowned_get_type (void); -GLIB_AVAILABLE_IN_ALL -void g_object_class_install_property (GObjectClass *oclass, - guint property_id, - GParamSpec *pspec); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_object_class_find_property (GObjectClass *oclass, - const gchar *property_name); -GLIB_AVAILABLE_IN_ALL -GParamSpec**g_object_class_list_properties (GObjectClass *oclass, - guint *n_properties); -GLIB_AVAILABLE_IN_ALL -void g_object_class_override_property (GObjectClass *oclass, - guint property_id, - const gchar *name); -GLIB_AVAILABLE_IN_ALL -void g_object_class_install_properties (GObjectClass *oclass, - guint n_pspecs, - GParamSpec **pspecs); - -GLIB_AVAILABLE_IN_ALL -void g_object_interface_install_property (gpointer g_iface, - GParamSpec *pspec); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_object_interface_find_property (gpointer g_iface, - const gchar *property_name); -GLIB_AVAILABLE_IN_ALL -GParamSpec**g_object_interface_list_properties (gpointer g_iface, - guint *n_properties_p); - -GLIB_AVAILABLE_IN_ALL -GType g_object_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gpointer g_object_new (GType object_type, - const gchar *first_property_name, - ...); -GLIB_AVAILABLE_IN_2_54 -GObject* g_object_new_with_properties (GType object_type, - guint n_properties, - const char *names[], - const GValue values[]); - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -GLIB_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties) -gpointer g_object_newv (GType object_type, - guint n_parameters, - GParameter *parameters); - -G_GNUC_END_IGNORE_DEPRECATIONS - -GLIB_AVAILABLE_IN_ALL -GObject* g_object_new_valist (GType object_type, - const gchar *first_property_name, - va_list var_args); -GLIB_AVAILABLE_IN_ALL -void g_object_set (gpointer object, - const gchar *first_property_name, - ...) G_GNUC_NULL_TERMINATED; -GLIB_AVAILABLE_IN_ALL -void g_object_get (gpointer object, - const gchar *first_property_name, - ...) G_GNUC_NULL_TERMINATED; -GLIB_AVAILABLE_IN_ALL -gpointer g_object_connect (gpointer object, - const gchar *signal_spec, - ...) G_GNUC_NULL_TERMINATED; -GLIB_AVAILABLE_IN_ALL -void g_object_disconnect (gpointer object, - const gchar *signal_spec, - ...) G_GNUC_NULL_TERMINATED; -GLIB_AVAILABLE_IN_2_54 -void g_object_setv (GObject *object, - guint n_properties, - const gchar *names[], - const GValue values[]); -GLIB_AVAILABLE_IN_ALL -void g_object_set_valist (GObject *object, - const gchar *first_property_name, - va_list var_args); -GLIB_AVAILABLE_IN_2_54 -void g_object_getv (GObject *object, - guint n_properties, - const gchar *names[], - GValue values[]); -GLIB_AVAILABLE_IN_ALL -void g_object_get_valist (GObject *object, - const gchar *first_property_name, - va_list var_args); -GLIB_AVAILABLE_IN_ALL -void g_object_set_property (GObject *object, - const gchar *property_name, - const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_object_get_property (GObject *object, - const gchar *property_name, - GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_object_freeze_notify (GObject *object); -GLIB_AVAILABLE_IN_ALL -void g_object_notify (GObject *object, - const gchar *property_name); -GLIB_AVAILABLE_IN_ALL -void g_object_notify_by_pspec (GObject *object, - GParamSpec *pspec); -GLIB_AVAILABLE_IN_ALL -void g_object_thaw_notify (GObject *object); -GLIB_AVAILABLE_IN_ALL -gboolean g_object_is_floating (gpointer object); -GLIB_AVAILABLE_IN_ALL -gpointer g_object_ref_sink (gpointer object); -GLIB_AVAILABLE_IN_ALL -gpointer g_object_ref (gpointer object); -GLIB_AVAILABLE_IN_ALL -void g_object_unref (gpointer object); -GLIB_AVAILABLE_IN_ALL -void g_object_weak_ref (GObject *object, - GWeakNotify notify, - gpointer data); -GLIB_AVAILABLE_IN_ALL -void g_object_weak_unref (GObject *object, - GWeakNotify notify, - gpointer data); -GLIB_AVAILABLE_IN_ALL -void g_object_add_weak_pointer (GObject *object, - gpointer *weak_pointer_location); -GLIB_AVAILABLE_IN_ALL -void g_object_remove_weak_pointer (GObject *object, - gpointer *weak_pointer_location); - -#if defined(glib_typeof) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56 -/* Make reference APIs type safe with macros */ -#undef g_object_ref -#define g_object_ref(Obj) ((glib_typeof (Obj)) (_frida_g_object_ref) (Obj)) -#undef g_object_ref_sink -#define g_object_ref_sink(Obj) ((glib_typeof (Obj)) (_frida_g_object_ref_sink) (Obj)) -#endif - -/** - * GToggleNotify: - * @data: Callback data passed to g_object_add_toggle_ref() - * @object: The object on which g_object_add_toggle_ref() was called. - * @is_last_ref: %TRUE if the toggle reference is now the - * last reference to the object. %FALSE if the toggle - * reference was the last reference and there are now other - * references. - * - * A callback function used for notification when the state - * of a toggle reference changes. See g_object_add_toggle_ref(). - */ -typedef void (*GToggleNotify) (gpointer data, - GObject *object, - gboolean is_last_ref); - -GLIB_AVAILABLE_IN_ALL -void g_object_add_toggle_ref (GObject *object, - GToggleNotify notify, - gpointer data); -GLIB_AVAILABLE_IN_ALL -void g_object_remove_toggle_ref (GObject *object, - GToggleNotify notify, - gpointer data); - -GLIB_AVAILABLE_IN_ALL -gpointer g_object_get_qdata (GObject *object, - GQuark quark); -GLIB_AVAILABLE_IN_ALL -void g_object_set_qdata (GObject *object, - GQuark quark, - gpointer data); -GLIB_AVAILABLE_IN_ALL -void g_object_set_qdata_full (GObject *object, - GQuark quark, - gpointer data, - GDestroyNotify destroy); -GLIB_AVAILABLE_IN_ALL -gpointer g_object_steal_qdata (GObject *object, - GQuark quark); - -GLIB_AVAILABLE_IN_2_34 -gpointer g_object_dup_qdata (GObject *object, - GQuark quark, - GDuplicateFunc dup_func, - gpointer user_data); -GLIB_AVAILABLE_IN_2_34 -gboolean g_object_replace_qdata (GObject *object, - GQuark quark, - gpointer oldval, - gpointer newval, - GDestroyNotify destroy, - GDestroyNotify *old_destroy); - -GLIB_AVAILABLE_IN_ALL -gpointer g_object_get_data (GObject *object, - const gchar *key); -GLIB_AVAILABLE_IN_ALL -void g_object_set_data (GObject *object, - const gchar *key, - gpointer data); -GLIB_AVAILABLE_IN_ALL -void g_object_set_data_full (GObject *object, - const gchar *key, - gpointer data, - GDestroyNotify destroy); -GLIB_AVAILABLE_IN_ALL -gpointer g_object_steal_data (GObject *object, - const gchar *key); - -GLIB_AVAILABLE_IN_2_34 -gpointer g_object_dup_data (GObject *object, - const gchar *key, - GDuplicateFunc dup_func, - gpointer user_data); -GLIB_AVAILABLE_IN_2_34 -gboolean g_object_replace_data (GObject *object, - const gchar *key, - gpointer oldval, - gpointer newval, - GDestroyNotify destroy, - GDestroyNotify *old_destroy); - - -GLIB_AVAILABLE_IN_ALL -void g_object_watch_closure (GObject *object, - GClosure *closure); -GLIB_AVAILABLE_IN_ALL -GClosure* g_cclosure_new_object (GCallback callback_func, - GObject *object); -GLIB_AVAILABLE_IN_ALL -GClosure* g_cclosure_new_object_swap (GCallback callback_func, - GObject *object); -GLIB_AVAILABLE_IN_ALL -GClosure* g_closure_new_object (guint sizeof_closure, - GObject *object); -GLIB_AVAILABLE_IN_ALL -void g_value_set_object (GValue *value, - gpointer v_object); -GLIB_AVAILABLE_IN_ALL -gpointer g_value_get_object (const GValue *value); -GLIB_AVAILABLE_IN_ALL -gpointer g_value_dup_object (const GValue *value); -GLIB_AVAILABLE_IN_ALL -gulong g_signal_connect_object (gpointer instance, - const gchar *detailed_signal, - GCallback c_handler, - gpointer gobject, - GConnectFlags connect_flags); - -/*< protected >*/ -GLIB_AVAILABLE_IN_ALL -void g_object_force_floating (GObject *object); -GLIB_AVAILABLE_IN_ALL -void g_object_run_dispose (GObject *object); - - -GLIB_AVAILABLE_IN_ALL -void g_value_take_object (GValue *value, - gpointer v_object); -GLIB_DEPRECATED_FOR(g_value_take_object) -void g_value_set_object_take_ownership (GValue *value, - gpointer v_object); - -GLIB_DEPRECATED -gsize g_object_compat_control (gsize what, - gpointer data); - -/* --- implementation macros --- */ -#define G_OBJECT_WARN_INVALID_PSPEC(object, pname, property_id, pspec) \ -G_STMT_START { \ - GObject *_glib__object = (GObject*) (object); \ - GParamSpec *_glib__pspec = (GParamSpec*) (pspec); \ - guint _glib__property_id = (property_id); \ - g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'", \ - __FILE__, __LINE__, \ - (pname), \ - _glib__property_id, \ - _glib__pspec->name, \ - g_type_name (G_PARAM_SPEC_TYPE (_glib__pspec)), \ - G_OBJECT_TYPE_NAME (_glib__object)); \ -} G_STMT_END -/** - * G_OBJECT_WARN_INVALID_PROPERTY_ID: - * @object: the #GObject on which set_property() or get_property() was called - * @property_id: the numeric id of the property - * @pspec: the #GParamSpec of the property - * - * This macro should be used to emit a standard warning about unexpected - * properties in set_property() and get_property() implementations. - */ -#define G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec) \ - G_OBJECT_WARN_INVALID_PSPEC ((object), "property", (property_id), (pspec)) - -GLIB_AVAILABLE_IN_ALL -void g_clear_object (GObject **object_ptr); -#undef g_clear_object -#define g_clear_object(object_ptr) g_clear_pointer ((object_ptr), g_object_unref) - -/** - * g_set_object: (skip) - * @object_ptr: (inout) (not optional) (nullable): a pointer to a #GObject reference - * @new_object: (nullable) (transfer none): a pointer to the new #GObject to - * assign to @object_ptr, or %NULL to clear the pointer - * - * Updates a #GObject pointer to refer to @new_object. It increments the - * reference count of @new_object (if non-%NULL), decrements the reference - * count of the current value of @object_ptr (if non-%NULL), and assigns - * @new_object to @object_ptr. The assignment is not atomic. - * - * @object_ptr must not be %NULL, but can point to a %NULL value. - * - * A macro is also included that allows this function to be used without - * pointer casts. The function itself is static inline, so its address may vary - * between compilation units. - * - * One convenient usage of this function is in implementing property setters: - * |[ - * void - * foo_set_bar (Foo *foo, - * Bar *new_bar) - * { - * g_return_if_fail (IS_FOO (foo)); - * g_return_if_fail (new_bar == NULL || IS_BAR (new_bar)); - * - * if (g_set_object (&foo->bar, new_bar)) - * g_object_notify (foo, "bar"); - * } - * ]| - * - * Returns: %TRUE if the value of @object_ptr changed, %FALSE otherwise - * - * Since: 2.44 - */ -static inline gboolean -(g_set_object) (GObject **object_ptr, - GObject *new_object) -{ - GObject *old_object = *object_ptr; - - /* rely on g_object_[un]ref() to check the pointers are actually GObjects; - * elide a (object_ptr != NULL) check because most of the time we will be - * operating on struct members with a constant offset, so a NULL check would - * not catch bugs - */ - - if (old_object == new_object) - return FALSE; - - if (new_object != NULL) - g_object_ref (new_object); - - *object_ptr = new_object; - - if (old_object != NULL) - g_object_unref (old_object); - - return TRUE; -} - -/* We need GCC for __extension__, which we need to sort out strict aliasing of @object_ptr */ -#if defined(__GNUC__) - -#define g_set_object(object_ptr, new_object) \ - (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof *(object_ptr) == sizeof (new_object)); \ - /* Only one access, please; work around type aliasing */ \ - union { char *in; GObject **out; } _object_ptr; \ - _object_ptr.in = (char *) (object_ptr); \ - /* Check types match */ \ - (void) (0 ? *(object_ptr) = (new_object), FALSE : FALSE); \ - (g_set_object) (_object_ptr.out, (GObject *) new_object); \ - })) \ - GLIB_AVAILABLE_MACRO_IN_2_44 - -#else /* if !defined(__GNUC__) */ - -#define g_set_object(object_ptr, new_object) \ - (/* Check types match. */ \ - 0 ? *(object_ptr) = (new_object), FALSE : \ - (g_set_object) ((GObject **) (object_ptr), (GObject *) (new_object)) \ - ) - -#endif /* !defined(__GNUC__) */ - -/** - * g_assert_finalize_object: (skip) - * @object: (transfer full) (type GObject.Object): an object - * - * Assert that @object is non-%NULL, then release one reference to it with - * g_object_unref() and assert that it has been finalized (i.e. that there - * are no more references). - * - * If assertions are disabled via `G_DISABLE_ASSERT`, - * this macro just calls g_object_unref() without any further checks. - * - * This macro should only be used in regression tests. - * - * Since: 2.62 - */ -static inline void -(g_assert_finalize_object) (GObject *object) -{ - gpointer weak_pointer = object; - - g_assert_true (G_IS_OBJECT (weak_pointer)); - g_object_add_weak_pointer (object, &weak_pointer); - g_object_unref (weak_pointer); - g_assert_null (weak_pointer); -} - -#ifdef G_DISABLE_ASSERT -#define g_assert_finalize_object(object) g_object_unref (object) -#else -#define g_assert_finalize_object(object) (g_assert_finalize_object ((GObject *) object)) -#endif - -/** - * g_clear_weak_pointer: (skip) - * @weak_pointer_location: The memory address of a pointer - * - * Clears a weak reference to a #GObject. - * - * @weak_pointer_location must not be %NULL. - * - * If the weak reference is %NULL then this function does nothing. - * Otherwise, the weak reference to the object is removed for that location - * and the pointer is set to %NULL. - * - * A macro is also included that allows this function to be used without - * pointer casts. The function itself is static inline, so its address may vary - * between compilation units. - * - * Since: 2.56 - */ -static inline void -(g_clear_weak_pointer) (gpointer *weak_pointer_location) -{ - GObject *object = (GObject *) *weak_pointer_location; - - if (object != NULL) - { - g_object_remove_weak_pointer (object, weak_pointer_location); - *weak_pointer_location = NULL; - } -} - -#define g_clear_weak_pointer(weak_pointer_location) \ - (/* Check types match. */ \ - (g_clear_weak_pointer) ((gpointer *) (weak_pointer_location)) \ - ) - -/** - * g_set_weak_pointer: (skip) - * @weak_pointer_location: the memory address of a pointer - * @new_object: (nullable) (transfer none): a pointer to the new #GObject to - * assign to it, or %NULL to clear the pointer - * - * Updates a pointer to weakly refer to @new_object. It assigns @new_object - * to @weak_pointer_location and ensures that @weak_pointer_location will - * automatically be set to %NULL if @new_object gets destroyed. The assignment - * is not atomic. The weak reference is not thread-safe, see - * g_object_add_weak_pointer() for details. - * - * @weak_pointer_location must not be %NULL. - * - * A macro is also included that allows this function to be used without - * pointer casts. The function itself is static inline, so its address may vary - * between compilation units. - * - * One convenient usage of this function is in implementing property setters: - * |[ - * void - * foo_set_bar (Foo *foo, - * Bar *new_bar) - * { - * g_return_if_fail (IS_FOO (foo)); - * g_return_if_fail (new_bar == NULL || IS_BAR (new_bar)); - * - * if (g_set_weak_pointer (&foo->bar, new_bar)) - * g_object_notify (foo, "bar"); - * } - * ]| - * - * Returns: %TRUE if the value of @weak_pointer_location changed, %FALSE otherwise - * - * Since: 2.56 - */ -static inline gboolean -(g_set_weak_pointer) (gpointer *weak_pointer_location, - GObject *new_object) -{ - GObject *old_object = (GObject *) *weak_pointer_location; - - /* elide a (weak_pointer_location != NULL) check because most of the time we - * will be operating on struct members with a constant offset, so a NULL - * check would not catch bugs - */ - - if (old_object == new_object) - return FALSE; - - if (old_object != NULL) - g_object_remove_weak_pointer (old_object, weak_pointer_location); - - *weak_pointer_location = new_object; - - if (new_object != NULL) - g_object_add_weak_pointer (new_object, weak_pointer_location); - - return TRUE; -} - -#define g_set_weak_pointer(weak_pointer_location, new_object) \ - (/* Check types match. */ \ - 0 ? *(weak_pointer_location) = (new_object), FALSE : \ - (g_set_weak_pointer) ((gpointer *) (weak_pointer_location), (GObject *) (new_object)) \ - ) - -typedef struct { - /**/ - union { gpointer p; } priv; -} GWeakRef; - -GLIB_AVAILABLE_IN_ALL -void g_weak_ref_init (GWeakRef *weak_ref, - gpointer object); -GLIB_AVAILABLE_IN_ALL -void g_weak_ref_clear (GWeakRef *weak_ref); -GLIB_AVAILABLE_IN_ALL -gpointer g_weak_ref_get (GWeakRef *weak_ref); -GLIB_AVAILABLE_IN_ALL -void g_weak_ref_set (GWeakRef *weak_ref, - gpointer object); - -G_END_DECLS - -#endif /* __G_OBJECT_H__ */ - -G_BEGIN_DECLS - -#define G_TYPE_BINDING_FLAGS (g_binding_flags_get_type ()) - -#define G_TYPE_BINDING (g_binding_get_type ()) -#define G_BINDING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_BINDING, GBinding)) -#define G_IS_BINDING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_BINDING)) - -/** - * GBinding: - * - * GBinding is an opaque structure whose members - * cannot be accessed directly. - * - * Since: 2.26 - */ -typedef struct _GBinding GBinding; - -/** - * GBindingTransformFunc: - * @binding: a #GBinding - * @from_value: the #GValue containing the value to transform - * @to_value: the #GValue in which to store the transformed value - * @user_data: data passed to the transform function - * - * A function to be called to transform @from_value to @to_value. If - * this is the @transform_to function of a binding, then @from_value - * is the @source_property on the @source object, and @to_value is the - * @target_property on the @target object. If this is the - * @transform_from function of a %G_BINDING_BIDIRECTIONAL binding, - * then those roles are reversed. - * - * Returns: %TRUE if the transformation was successful, and %FALSE - * otherwise - * - * Since: 2.26 - */ -typedef gboolean (* GBindingTransformFunc) (GBinding *binding, - const GValue *from_value, - GValue *to_value, - gpointer user_data); - -/** - * GBindingFlags: - * @G_BINDING_DEFAULT: The default binding; if the source property - * changes, the target property is updated with its value. - * @G_BINDING_BIDIRECTIONAL: Bidirectional binding; if either the - * property of the source or the property of the target changes, - * the other is updated. - * @G_BINDING_SYNC_CREATE: Synchronize the values of the source and - * target properties when creating the binding; the direction of - * the synchronization is always from the source to the target. - * @G_BINDING_INVERT_BOOLEAN: If the two properties being bound are - * booleans, setting one to %TRUE will result in the other being - * set to %FALSE and vice versa. This flag will only work for - * boolean properties, and cannot be used when passing custom - * transformation functions to g_object_bind_property_full(). - * - * Flags to be passed to g_object_bind_property() or - * g_object_bind_property_full(). - * - * This enumeration can be extended at later date. - * - * Since: 2.26 - */ -typedef enum { /*< prefix=G_BINDING >*/ - G_BINDING_DEFAULT = 0, - - G_BINDING_BIDIRECTIONAL = 1 << 0, - G_BINDING_SYNC_CREATE = 1 << 1, - G_BINDING_INVERT_BOOLEAN = 1 << 2 -} GBindingFlags; - -GLIB_AVAILABLE_IN_ALL -GType g_binding_flags_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -GType g_binding_get_type (void) G_GNUC_CONST; - -GLIB_AVAILABLE_IN_ALL -GBindingFlags g_binding_get_flags (GBinding *binding); -GLIB_DEPRECATED_IN_2_68_FOR(g_binding_dup_source) -GObject * g_binding_get_source (GBinding *binding); -GLIB_AVAILABLE_IN_2_68 -GObject * g_binding_dup_source (GBinding *binding); -GLIB_DEPRECATED_IN_2_68_FOR(g_binding_dup_target) -GObject * g_binding_get_target (GBinding *binding); -GLIB_AVAILABLE_IN_2_68 -GObject * g_binding_dup_target (GBinding *binding); -GLIB_AVAILABLE_IN_ALL -const gchar * g_binding_get_source_property (GBinding *binding); -GLIB_AVAILABLE_IN_ALL -const gchar * g_binding_get_target_property (GBinding *binding); -GLIB_AVAILABLE_IN_2_38 -void g_binding_unbind (GBinding *binding); - -GLIB_AVAILABLE_IN_ALL -GBinding *g_object_bind_property (gpointer source, - const gchar *source_property, - gpointer target, - const gchar *target_property, - GBindingFlags flags); -GLIB_AVAILABLE_IN_ALL -GBinding *g_object_bind_property_full (gpointer source, - const gchar *source_property, - gpointer target, - const gchar *target_property, - GBindingFlags flags, - GBindingTransformFunc transform_to, - GBindingTransformFunc transform_from, - gpointer user_data, - GDestroyNotify notify); -GLIB_AVAILABLE_IN_ALL -GBinding *g_object_bind_property_with_closures (gpointer source, - const gchar *source_property, - gpointer target, - const gchar *target_property, - GBindingFlags flags, - GClosure *transform_to, - GClosure *transform_from); - -G_END_DECLS - -#endif /* __G_BINDING_H__ */ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ -#ifndef __G_ENUMS_H__ -#define __G_ENUMS_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/* --- type macros --- */ -/** - * G_TYPE_IS_ENUM: - * @type: a #GType ID. - * - * Checks whether @type "is a" %G_TYPE_ENUM. - * - * Returns: %TRUE if @type "is a" %G_TYPE_ENUM. - */ -#define G_TYPE_IS_ENUM(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_ENUM) -/** - * G_ENUM_CLASS: - * @class: a valid #GEnumClass - * - * Casts a derived #GEnumClass structure into a #GEnumClass structure. - */ -#define G_ENUM_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_ENUM, GEnumClass)) -/** - * G_IS_ENUM_CLASS: - * @class: a #GEnumClass - * - * Checks whether @class "is a" valid #GEnumClass structure of type %G_TYPE_ENUM - * or derived. - */ -#define G_IS_ENUM_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_ENUM)) -/** - * G_ENUM_CLASS_TYPE: - * @class: a #GEnumClass - * - * Get the type identifier from a given #GEnumClass structure. - * - * Returns: the #GType - */ -#define G_ENUM_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class)) -/** - * G_ENUM_CLASS_TYPE_NAME: - * @class: a #GEnumClass - * - * Get the static type name from a given #GEnumClass structure. - * - * Returns: the type name. - */ -#define G_ENUM_CLASS_TYPE_NAME(class) (g_type_name (G_ENUM_CLASS_TYPE (class))) - - -/** - * G_TYPE_IS_FLAGS: - * @type: a #GType ID. - * - * Checks whether @type "is a" %G_TYPE_FLAGS. - * - * Returns: %TRUE if @type "is a" %G_TYPE_FLAGS. - */ -#define G_TYPE_IS_FLAGS(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_FLAGS) -/** - * G_FLAGS_CLASS: - * @class: a valid #GFlagsClass - * - * Casts a derived #GFlagsClass structure into a #GFlagsClass structure. - */ -#define G_FLAGS_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_FLAGS, GFlagsClass)) -/** - * G_IS_FLAGS_CLASS: - * @class: a #GFlagsClass - * - * Checks whether @class "is a" valid #GFlagsClass structure of type %G_TYPE_FLAGS - * or derived. - */ -#define G_IS_FLAGS_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_FLAGS)) -/** - * G_FLAGS_CLASS_TYPE: - * @class: a #GFlagsClass - * - * Get the type identifier from a given #GFlagsClass structure. - * - * Returns: the #GType - */ -#define G_FLAGS_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class)) -/** - * G_FLAGS_CLASS_TYPE_NAME: - * @class: a #GFlagsClass - * - * Get the static type name from a given #GFlagsClass structure. - * - * Returns: the type name. - */ -#define G_FLAGS_CLASS_TYPE_NAME(class) (g_type_name (G_FLAGS_CLASS_TYPE (class))) - - -/** - * G_VALUE_HOLDS_ENUM: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values derived from type %G_TYPE_ENUM. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_ENUM(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_ENUM)) -/** - * G_VALUE_HOLDS_FLAGS: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values derived from type %G_TYPE_FLAGS. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_FLAGS(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLAGS)) - - -/* --- enum/flag values & classes --- */ -typedef struct _GEnumClass GEnumClass; -typedef struct _GFlagsClass GFlagsClass; -typedef struct _GEnumValue GEnumValue; -typedef struct _GFlagsValue GFlagsValue; - -/** - * GEnumClass: - * @g_type_class: the parent class - * @minimum: the smallest possible value. - * @maximum: the largest possible value. - * @n_values: the number of possible values. - * @values: an array of #GEnumValue structs describing the - * individual values. - * - * The class of an enumeration type holds information about its - * possible values. - */ -struct _GEnumClass -{ - GTypeClass g_type_class; - - /*< public >*/ - gint minimum; - gint maximum; - guint n_values; - GEnumValue *values; -}; -/** - * GFlagsClass: - * @g_type_class: the parent class - * @mask: a mask covering all possible values. - * @n_values: the number of possible values. - * @values: an array of #GFlagsValue structs describing the - * individual values. - * - * The class of a flags type holds information about its - * possible values. - */ -struct _GFlagsClass -{ - GTypeClass g_type_class; - - /*< public >*/ - guint mask; - guint n_values; - GFlagsValue *values; -}; -/** - * GEnumValue: - * @value: the enum value - * @value_name: the name of the value - * @value_nick: the nickname of the value - * - * A structure which contains a single enum value, its name, and its - * nickname. - */ -struct _GEnumValue -{ - gint value; - const gchar *value_name; - const gchar *value_nick; -}; -/** - * GFlagsValue: - * @value: the flags value - * @value_name: the name of the value - * @value_nick: the nickname of the value - * - * A structure which contains a single flags value, its name, and its - * nickname. - */ -struct _GFlagsValue -{ - guint value; - const gchar *value_name; - const gchar *value_nick; -}; - - -/* --- prototypes --- */ -GLIB_AVAILABLE_IN_ALL -GEnumValue* g_enum_get_value (GEnumClass *enum_class, - gint value); -GLIB_AVAILABLE_IN_ALL -GEnumValue* g_enum_get_value_by_name (GEnumClass *enum_class, - const gchar *name); -GLIB_AVAILABLE_IN_ALL -GEnumValue* g_enum_get_value_by_nick (GEnumClass *enum_class, - const gchar *nick); -GLIB_AVAILABLE_IN_ALL -GFlagsValue* g_flags_get_first_value (GFlagsClass *flags_class, - guint value); -GLIB_AVAILABLE_IN_ALL -GFlagsValue* g_flags_get_value_by_name (GFlagsClass *flags_class, - const gchar *name); -GLIB_AVAILABLE_IN_ALL -GFlagsValue* g_flags_get_value_by_nick (GFlagsClass *flags_class, - const gchar *nick); -GLIB_AVAILABLE_IN_2_54 -gchar *g_enum_to_string (GType g_enum_type, - gint value); -GLIB_AVAILABLE_IN_2_54 -gchar *g_flags_to_string (GType flags_type, - guint value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_enum (GValue *value, - gint v_enum); -GLIB_AVAILABLE_IN_ALL -gint g_value_get_enum (const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_flags (GValue *value, - guint v_flags); -GLIB_AVAILABLE_IN_ALL -guint g_value_get_flags (const GValue *value); - - - -/* --- registration functions --- */ -/* const_static_values is a NULL terminated array of enum/flags - * values that is taken over! - */ -GLIB_AVAILABLE_IN_ALL -GType g_enum_register_static (const gchar *name, - const GEnumValue *const_static_values); -GLIB_AVAILABLE_IN_ALL -GType g_flags_register_static (const gchar *name, - const GFlagsValue *const_static_values); -/* functions to complete the type information - * for enums/flags implemented by plugins - */ -GLIB_AVAILABLE_IN_ALL -void g_enum_complete_type_info (GType g_enum_type, - GTypeInfo *info, - const GEnumValue *const_values); -GLIB_AVAILABLE_IN_ALL -void g_flags_complete_type_info (GType g_flags_type, - GTypeInfo *info, - const GFlagsValue *const_values); - -G_END_DECLS - -#endif /* __G_ENUMS_H__ */ - -/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */ - -#ifndef __GOBJECT_ENUM_TYPES_H__ -#define __GOBJECT_ENUM_TYPES_H__ - - -G_BEGIN_DECLS - -/* enumerations from "../../../deps/glib/gobject/../glib/gunicode.h" */ -GLIB_AVAILABLE_IN_2_60 GType g_unicode_type_get_type (void) G_GNUC_CONST; -#define G_TYPE_UNICODE_TYPE (g_unicode_type_get_type ()) -GLIB_AVAILABLE_IN_2_60 GType g_unicode_break_type_get_type (void) G_GNUC_CONST; -#define G_TYPE_UNICODE_BREAK_TYPE (g_unicode_break_type_get_type ()) -GLIB_AVAILABLE_IN_2_60 GType g_unicode_script_get_type (void) G_GNUC_CONST; -#define G_TYPE_UNICODE_SCRIPT (g_unicode_script_get_type ()) -GLIB_AVAILABLE_IN_2_60 GType g_normalize_mode_get_type (void) G_GNUC_CONST; -#define G_TYPE_NORMALIZE_MODE (g_normalize_mode_get_type ()) -G_END_DECLS - -#endif /* __GOBJECT_ENUM_TYPES_H__ */ - -/* Generated data ends here */ - -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - * - * gparamspecs.h: GLib default param specs - */ -#ifndef __G_PARAMSPECS_H__ -#define __G_PARAMSPECS_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/* --- type macros --- */ -/** - * G_TYPE_PARAM_CHAR: - * - * The #GType of #GParamSpecChar. - */ -#define G_TYPE_PARAM_CHAR (g_param_spec_types[0]) -/** - * G_IS_PARAM_SPEC_CHAR: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_CHAR. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_CHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CHAR)) -/** - * G_PARAM_SPEC_CHAR: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecChar. - */ -#define G_PARAM_SPEC_CHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CHAR, GParamSpecChar)) - -/** - * G_TYPE_PARAM_UCHAR: - * - * The #GType of #GParamSpecUChar. - */ -#define G_TYPE_PARAM_UCHAR (g_param_spec_types[1]) -/** - * G_IS_PARAM_SPEC_UCHAR: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UCHAR. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_UCHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UCHAR)) -/** - * G_PARAM_SPEC_UCHAR: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecUChar. - */ -#define G_PARAM_SPEC_UCHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UCHAR, GParamSpecUChar)) - -/** - * G_TYPE_PARAM_BOOLEAN: - * - * The #GType of #GParamSpecBoolean. - */ -#define G_TYPE_PARAM_BOOLEAN (g_param_spec_types[2]) -/** - * G_IS_PARAM_SPEC_BOOLEAN: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_BOOLEAN. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_BOOLEAN(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOOLEAN)) -/** - * G_PARAM_SPEC_BOOLEAN: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecBoolean. - */ -#define G_PARAM_SPEC_BOOLEAN(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOOLEAN, GParamSpecBoolean)) - -/** - * G_TYPE_PARAM_INT: - * - * The #GType of #GParamSpecInt. - */ -#define G_TYPE_PARAM_INT (g_param_spec_types[3]) -/** - * G_IS_PARAM_SPEC_INT: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_INT. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_INT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT)) -/** - * G_PARAM_SPEC_INT: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecInt. - */ -#define G_PARAM_SPEC_INT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT, GParamSpecInt)) - -/** - * G_TYPE_PARAM_UINT: - * - * The #GType of #GParamSpecUInt. - */ -#define G_TYPE_PARAM_UINT (g_param_spec_types[4]) -/** - * G_IS_PARAM_SPEC_UINT: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UINT. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_UINT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT)) -/** - * G_PARAM_SPEC_UINT: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecUInt. - */ -#define G_PARAM_SPEC_UINT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT, GParamSpecUInt)) - -/** - * G_TYPE_PARAM_LONG: - * - * The #GType of #GParamSpecLong. - */ -#define G_TYPE_PARAM_LONG (g_param_spec_types[5]) -/** - * G_IS_PARAM_SPEC_LONG: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_LONG. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_LONG(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_LONG)) -/** - * G_PARAM_SPEC_LONG: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecLong. - */ -#define G_PARAM_SPEC_LONG(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_LONG, GParamSpecLong)) - -/** - * G_TYPE_PARAM_ULONG: - * - * The #GType of #GParamSpecULong. - */ -#define G_TYPE_PARAM_ULONG (g_param_spec_types[6]) -/** - * G_IS_PARAM_SPEC_ULONG: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_ULONG. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_ULONG(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ULONG)) -/** - * G_PARAM_SPEC_ULONG: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecULong. - */ -#define G_PARAM_SPEC_ULONG(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ULONG, GParamSpecULong)) - -/** - * G_TYPE_PARAM_INT64: - * - * The #GType of #GParamSpecInt64. - */ -#define G_TYPE_PARAM_INT64 (g_param_spec_types[7]) -/** - * G_IS_PARAM_SPEC_INT64: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_INT64. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_INT64(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT64)) -/** - * G_PARAM_SPEC_INT64: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecInt64. - */ -#define G_PARAM_SPEC_INT64(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT64, GParamSpecInt64)) - -/** - * G_TYPE_PARAM_UINT64: - * - * The #GType of #GParamSpecUInt64. - */ -#define G_TYPE_PARAM_UINT64 (g_param_spec_types[8]) -/** - * G_IS_PARAM_SPEC_UINT64: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UINT64. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_UINT64(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT64)) -/** - * G_PARAM_SPEC_UINT64: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecUInt64. - */ -#define G_PARAM_SPEC_UINT64(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT64, GParamSpecUInt64)) - -/** - * G_TYPE_PARAM_UNICHAR: - * - * The #GType of #GParamSpecUnichar. - */ -#define G_TYPE_PARAM_UNICHAR (g_param_spec_types[9]) -/** - * G_PARAM_SPEC_UNICHAR: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecUnichar. - */ -#define G_PARAM_SPEC_UNICHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UNICHAR, GParamSpecUnichar)) -/** - * G_IS_PARAM_SPEC_UNICHAR: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UNICHAR. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_UNICHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UNICHAR)) - -/** - * G_TYPE_PARAM_ENUM: - * - * The #GType of #GParamSpecEnum. - */ -#define G_TYPE_PARAM_ENUM (g_param_spec_types[10]) -/** - * G_IS_PARAM_SPEC_ENUM: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_ENUM. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ENUM)) -/** - * G_PARAM_SPEC_ENUM: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecEnum. - */ -#define G_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ENUM, GParamSpecEnum)) - -/** - * G_TYPE_PARAM_FLAGS: - * - * The #GType of #GParamSpecFlags. - */ -#define G_TYPE_PARAM_FLAGS (g_param_spec_types[11]) -/** - * G_IS_PARAM_SPEC_FLAGS: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_FLAGS. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLAGS)) -/** - * G_PARAM_SPEC_FLAGS: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecFlags. - */ -#define G_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLAGS, GParamSpecFlags)) - -/** - * G_TYPE_PARAM_FLOAT: - * - * The #GType of #GParamSpecFloat. - */ -#define G_TYPE_PARAM_FLOAT (g_param_spec_types[12]) -/** - * G_IS_PARAM_SPEC_FLOAT: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_FLOAT. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLOAT)) -/** - * G_PARAM_SPEC_FLOAT: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecFloat. - */ -#define G_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLOAT, GParamSpecFloat)) - -/** - * G_TYPE_PARAM_DOUBLE: - * - * The #GType of #GParamSpecDouble. - */ -#define G_TYPE_PARAM_DOUBLE (g_param_spec_types[13]) -/** - * G_IS_PARAM_SPEC_DOUBLE: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_DOUBLE. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_DOUBLE)) -/** - * G_PARAM_SPEC_DOUBLE: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecDouble. - */ -#define G_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_DOUBLE, GParamSpecDouble)) - -/** - * G_TYPE_PARAM_STRING: - * - * The #GType of #GParamSpecString. - */ -#define G_TYPE_PARAM_STRING (g_param_spec_types[14]) -/** - * G_IS_PARAM_SPEC_STRING: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_STRING. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_STRING)) -/** - * G_PARAM_SPEC_STRING: - * @pspec: a valid #GParamSpec instance - * - * Casts a #GParamSpec instance into a #GParamSpecString. - */ -#define G_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_STRING, GParamSpecString)) - -/** - * G_TYPE_PARAM_PARAM: - * - * The #GType of #GParamSpecParam. - */ -#define G_TYPE_PARAM_PARAM (g_param_spec_types[15]) -/** - * G_IS_PARAM_SPEC_PARAM: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_PARAM. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_PARAM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_PARAM)) -/** - * G_PARAM_SPEC_PARAM: - * @pspec: a valid #GParamSpec instance - * - * Casts a #GParamSpec instance into a #GParamSpecParam. - */ -#define G_PARAM_SPEC_PARAM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_PARAM, GParamSpecParam)) - -/** - * G_TYPE_PARAM_BOXED: - * - * The #GType of #GParamSpecBoxed. - */ -#define G_TYPE_PARAM_BOXED (g_param_spec_types[16]) -/** - * G_IS_PARAM_SPEC_BOXED: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_BOXED. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOXED)) -/** - * G_PARAM_SPEC_BOXED: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecBoxed. - */ -#define G_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOXED, GParamSpecBoxed)) - -/** - * G_TYPE_PARAM_POINTER: - * - * The #GType of #GParamSpecPointer. - */ -#define G_TYPE_PARAM_POINTER (g_param_spec_types[17]) -/** - * G_IS_PARAM_SPEC_POINTER: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_POINTER. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_POINTER(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_POINTER)) -/** - * G_PARAM_SPEC_POINTER: - * @pspec: a valid #GParamSpec instance - * - * Casts a #GParamSpec instance into a #GParamSpecPointer. - */ -#define G_PARAM_SPEC_POINTER(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_POINTER, GParamSpecPointer)) - -/** - * G_TYPE_PARAM_VALUE_ARRAY: - * - * The #GType of #GParamSpecValueArray. - * - * Deprecated: 2.32: Use #GArray instead of #GValueArray - */ -#define G_TYPE_PARAM_VALUE_ARRAY (g_param_spec_types[18]) GLIB_DEPRECATED_MACRO_IN_2_32 -/** - * G_IS_PARAM_SPEC_VALUE_ARRAY: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_VALUE_ARRAY. - * - * Returns: %TRUE on success. - * - * Deprecated: 2.32: Use #GArray instead of #GValueArray - */ -#define G_IS_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VALUE_ARRAY)) GLIB_DEPRECATED_MACRO_IN_2_32 -/** - * G_PARAM_SPEC_VALUE_ARRAY: - * @pspec: a valid #GParamSpec instance - * - * Cast a #GParamSpec instance into a #GParamSpecValueArray. - * - * Deprecated: 2.32: Use #GArray instead of #GValueArray - */ -#define G_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VALUE_ARRAY, GParamSpecValueArray)) GLIB_DEPRECATED_MACRO_IN_2_32 - -/** - * G_TYPE_PARAM_OBJECT: - * - * The #GType of #GParamSpecObject. - */ -#define G_TYPE_PARAM_OBJECT (g_param_spec_types[19]) -/** - * G_IS_PARAM_SPEC_OBJECT: - * @pspec: a valid #GParamSpec instance - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_OBJECT. - * - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OBJECT)) -/** - * G_PARAM_SPEC_OBJECT: - * @pspec: a valid #GParamSpec instance - * - * Casts a #GParamSpec instance into a #GParamSpecObject. - */ -#define G_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OBJECT, GParamSpecObject)) - -/** - * G_TYPE_PARAM_OVERRIDE: - * - * The #GType of #GParamSpecOverride. - * - * Since: 2.4 - */ -#define G_TYPE_PARAM_OVERRIDE (g_param_spec_types[20]) -/** - * G_IS_PARAM_SPEC_OVERRIDE: - * @pspec: a #GParamSpec - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_OVERRIDE. - * - * Since: 2.4 - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_OVERRIDE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OVERRIDE)) -/** - * G_PARAM_SPEC_OVERRIDE: - * @pspec: a #GParamSpec - * - * Casts a #GParamSpec into a #GParamSpecOverride. - * - * Since: 2.4 - */ -#define G_PARAM_SPEC_OVERRIDE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OVERRIDE, GParamSpecOverride)) - -/** - * G_TYPE_PARAM_GTYPE: - * - * The #GType of #GParamSpecGType. - * - * Since: 2.10 - */ -#define G_TYPE_PARAM_GTYPE (g_param_spec_types[21]) -/** - * G_IS_PARAM_SPEC_GTYPE: - * @pspec: a #GParamSpec - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_GTYPE. - * - * Since: 2.10 - * Returns: %TRUE on success. - */ -#define G_IS_PARAM_SPEC_GTYPE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_GTYPE)) -/** - * G_PARAM_SPEC_GTYPE: - * @pspec: a #GParamSpec - * - * Casts a #GParamSpec into a #GParamSpecGType. - * - * Since: 2.10 - */ -#define G_PARAM_SPEC_GTYPE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_GTYPE, GParamSpecGType)) - -/** - * G_TYPE_PARAM_VARIANT: - * - * The #GType of #GParamSpecVariant. - * - * Since: 2.26 - */ -#define G_TYPE_PARAM_VARIANT (g_param_spec_types[22]) -/** - * G_IS_PARAM_SPEC_VARIANT: - * @pspec: a #GParamSpec - * - * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_VARIANT. - * - * Returns: %TRUE on success - * - * Since: 2.26 - */ -#define G_IS_PARAM_SPEC_VARIANT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VARIANT)) -/** - * G_PARAM_SPEC_VARIANT: - * @pspec: a #GParamSpec - * - * Casts a #GParamSpec into a #GParamSpecVariant. - * - * Since: 2.26 - */ -#define G_PARAM_SPEC_VARIANT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VARIANT, GParamSpecVariant)) - -/* --- typedefs & structures --- */ -typedef struct _GParamSpecChar GParamSpecChar; -typedef struct _GParamSpecUChar GParamSpecUChar; -typedef struct _GParamSpecBoolean GParamSpecBoolean; -typedef struct _GParamSpecInt GParamSpecInt; -typedef struct _GParamSpecUInt GParamSpecUInt; -typedef struct _GParamSpecLong GParamSpecLong; -typedef struct _GParamSpecULong GParamSpecULong; -typedef struct _GParamSpecInt64 GParamSpecInt64; -typedef struct _GParamSpecUInt64 GParamSpecUInt64; -typedef struct _GParamSpecUnichar GParamSpecUnichar; -typedef struct _GParamSpecEnum GParamSpecEnum; -typedef struct _GParamSpecFlags GParamSpecFlags; -typedef struct _GParamSpecFloat GParamSpecFloat; -typedef struct _GParamSpecDouble GParamSpecDouble; -typedef struct _GParamSpecString GParamSpecString; -typedef struct _GParamSpecParam GParamSpecParam; -typedef struct _GParamSpecBoxed GParamSpecBoxed; -typedef struct _GParamSpecPointer GParamSpecPointer; -typedef struct _GParamSpecValueArray GParamSpecValueArray; -typedef struct _GParamSpecObject GParamSpecObject; -typedef struct _GParamSpecOverride GParamSpecOverride; -typedef struct _GParamSpecGType GParamSpecGType; -typedef struct _GParamSpecVariant GParamSpecVariant; - -/** - * GParamSpecChar: - * @parent_instance: private #GParamSpec portion - * @minimum: minimum value for the property specified - * @maximum: maximum value for the property specified - * @default_value: default value for the property specified - * - * A #GParamSpec derived structure that contains the meta data for character properties. - */ -struct _GParamSpecChar -{ - GParamSpec parent_instance; - - gint8 minimum; - gint8 maximum; - gint8 default_value; -}; -/** - * GParamSpecUChar: - * @parent_instance: private #GParamSpec portion - * @minimum: minimum value for the property specified - * @maximum: maximum value for the property specified - * @default_value: default value for the property specified - * - * A #GParamSpec derived structure that contains the meta data for unsigned character properties. - */ -struct _GParamSpecUChar -{ - GParamSpec parent_instance; - - guint8 minimum; - guint8 maximum; - guint8 default_value; -}; -/** - * GParamSpecBoolean: - * @parent_instance: private #GParamSpec portion - * @default_value: default value for the property specified - * - * A #GParamSpec derived structure that contains the meta data for boolean properties. - */ -struct _GParamSpecBoolean -{ - GParamSpec parent_instance; - - gboolean default_value; -}; -/** - * GParamSpecInt: - * @parent_instance: private #GParamSpec portion - * @minimum: minimum value for the property specified - * @maximum: maximum value for the property specified - * @default_value: default value for the property specified - * - * A #GParamSpec derived structure that contains the meta data for integer properties. - */ -struct _GParamSpecInt -{ - GParamSpec parent_instance; - - gint minimum; - gint maximum; - gint default_value; -}; -/** - * GParamSpecUInt: - * @parent_instance: private #GParamSpec portion - * @minimum: minimum value for the property specified - * @maximum: maximum value for the property specified - * @default_value: default value for the property specified - * - * A #GParamSpec derived structure that contains the meta data for unsigned integer properties. - */ -struct _GParamSpecUInt -{ - GParamSpec parent_instance; - - guint minimum; - guint maximum; - guint default_value; -}; -/** - * GParamSpecLong: - * @parent_instance: private #GParamSpec portion - * @minimum: minimum value for the property specified - * @maximum: maximum value for the property specified - * @default_value: default value for the property specified - * - * A #GParamSpec derived structure that contains the meta data for long integer properties. - */ -struct _GParamSpecLong -{ - GParamSpec parent_instance; - - glong minimum; - glong maximum; - glong default_value; -}; -/** - * GParamSpecULong: - * @parent_instance: private #GParamSpec portion - * @minimum: minimum value for the property specified - * @maximum: maximum value for the property specified - * @default_value: default value for the property specified - * - * A #GParamSpec derived structure that contains the meta data for unsigned long integer properties. - */ -struct _GParamSpecULong -{ - GParamSpec parent_instance; - - gulong minimum; - gulong maximum; - gulong default_value; -}; -/** - * GParamSpecInt64: - * @parent_instance: private #GParamSpec portion - * @minimum: minimum value for the property specified - * @maximum: maximum value for the property specified - * @default_value: default value for the property specified - * - * A #GParamSpec derived structure that contains the meta data for 64bit integer properties. - */ -struct _GParamSpecInt64 -{ - GParamSpec parent_instance; - - gint64 minimum; - gint64 maximum; - gint64 default_value; -}; -/** - * GParamSpecUInt64: - * @parent_instance: private #GParamSpec portion - * @minimum: minimum value for the property specified - * @maximum: maximum value for the property specified - * @default_value: default value for the property specified - * - * A #GParamSpec derived structure that contains the meta data for unsigned 64bit integer properties. - */ -struct _GParamSpecUInt64 -{ - GParamSpec parent_instance; - - guint64 minimum; - guint64 maximum; - guint64 default_value; -}; -/** - * GParamSpecUnichar: - * @parent_instance: private #GParamSpec portion - * @default_value: default value for the property specified - * - * A #GParamSpec derived structure that contains the meta data for unichar (unsigned integer) properties. - */ -struct _GParamSpecUnichar -{ - GParamSpec parent_instance; - - gunichar default_value; -}; -/** - * GParamSpecEnum: - * @parent_instance: private #GParamSpec portion - * @enum_class: the #GEnumClass for the enum - * @default_value: default value for the property specified - * - * A #GParamSpec derived structure that contains the meta data for enum - * properties. - */ -struct _GParamSpecEnum -{ - GParamSpec parent_instance; - - GEnumClass *enum_class; - gint default_value; -}; -/** - * GParamSpecFlags: - * @parent_instance: private #GParamSpec portion - * @flags_class: the #GFlagsClass for the flags - * @default_value: default value for the property specified - * - * A #GParamSpec derived structure that contains the meta data for flags - * properties. - */ -struct _GParamSpecFlags -{ - GParamSpec parent_instance; - - GFlagsClass *flags_class; - guint default_value; -}; -/** - * GParamSpecFloat: - * @parent_instance: private #GParamSpec portion - * @minimum: minimum value for the property specified - * @maximum: maximum value for the property specified - * @default_value: default value for the property specified - * @epsilon: values closer than @epsilon will be considered identical - * by g_param_values_cmp(); the default value is 1e-30. - * - * A #GParamSpec derived structure that contains the meta data for float properties. - */ -struct _GParamSpecFloat -{ - GParamSpec parent_instance; - - gfloat minimum; - gfloat maximum; - gfloat default_value; - gfloat epsilon; -}; -/** - * GParamSpecDouble: - * @parent_instance: private #GParamSpec portion - * @minimum: minimum value for the property specified - * @maximum: maximum value for the property specified - * @default_value: default value for the property specified - * @epsilon: values closer than @epsilon will be considered identical - * by g_param_values_cmp(); the default value is 1e-90. - * - * A #GParamSpec derived structure that contains the meta data for double properties. - */ -struct _GParamSpecDouble -{ - GParamSpec parent_instance; - - gdouble minimum; - gdouble maximum; - gdouble default_value; - gdouble epsilon; -}; -/** - * GParamSpecString: - * @parent_instance: private #GParamSpec portion - * @default_value: default value for the property specified - * @cset_first: a string containing the allowed values for the first byte - * @cset_nth: a string containing the allowed values for the subsequent bytes - * @substitutor: the replacement byte for bytes which don't match @cset_first or @cset_nth. - * @null_fold_if_empty: replace empty string by %NULL - * @ensure_non_null: replace %NULL strings by an empty string - * - * A #GParamSpec derived structure that contains the meta data for string - * properties. - */ -struct _GParamSpecString -{ - GParamSpec parent_instance; - - gchar *default_value; - gchar *cset_first; - gchar *cset_nth; - gchar substitutor; - guint null_fold_if_empty : 1; - guint ensure_non_null : 1; -}; -/** - * GParamSpecParam: - * @parent_instance: private #GParamSpec portion - * - * A #GParamSpec derived structure that contains the meta data for %G_TYPE_PARAM - * properties. - */ -struct _GParamSpecParam -{ - GParamSpec parent_instance; -}; -/** - * GParamSpecBoxed: - * @parent_instance: private #GParamSpec portion - * - * A #GParamSpec derived structure that contains the meta data for boxed properties. - */ -struct _GParamSpecBoxed -{ - GParamSpec parent_instance; -}; -/** - * GParamSpecPointer: - * @parent_instance: private #GParamSpec portion - * - * A #GParamSpec derived structure that contains the meta data for pointer properties. - */ -struct _GParamSpecPointer -{ - GParamSpec parent_instance; -}; -/** - * GParamSpecValueArray: - * @parent_instance: private #GParamSpec portion - * @element_spec: a #GParamSpec describing the elements contained in arrays of this property, may be %NULL - * @fixed_n_elements: if greater than 0, arrays of this property will always have this many elements - * - * A #GParamSpec derived structure that contains the meta data for #GValueArray properties. - */ -struct _GParamSpecValueArray -{ - GParamSpec parent_instance; - GParamSpec *element_spec; - guint fixed_n_elements; -}; -/** - * GParamSpecObject: - * @parent_instance: private #GParamSpec portion - * - * A #GParamSpec derived structure that contains the meta data for object properties. - */ -struct _GParamSpecObject -{ - GParamSpec parent_instance; -}; -/** - * GParamSpecOverride: - * - * This is a type of #GParamSpec type that simply redirects operations to - * another paramspec. All operations other than getting or - * setting the value are redirected, including accessing the nick and - * blurb, validating a value, and so forth. See - * g_param_spec_get_redirect_target() for retrieving the overridden - * property. #GParamSpecOverride is used in implementing - * g_object_class_override_property(), and will not be directly useful - * unless you are implementing a new base type similar to GObject. - * - * Since: 2.4 - */ -struct _GParamSpecOverride -{ - /*< private >*/ - GParamSpec parent_instance; - GParamSpec *overridden; -}; -/** - * GParamSpecGType: - * @parent_instance: private #GParamSpec portion - * @is_a_type: a #GType whose subtypes can occur as values - * - * A #GParamSpec derived structure that contains the meta data for #GType properties. - * - * Since: 2.10 - */ -struct _GParamSpecGType -{ - GParamSpec parent_instance; - GType is_a_type; -}; -/** - * GParamSpecVariant: - * @parent_instance: private #GParamSpec portion - * @type: a #GVariantType, or %NULL - * @default_value: a #GVariant, or %NULL - * - * A #GParamSpec derived structure that contains the meta data for #GVariant properties. - * - * When comparing values with g_param_values_cmp(), scalar values with the same - * type will be compared with g_variant_compare(). Other non-%NULL variants will - * be checked for equality with g_variant_equal(), and their sort order is - * otherwise undefined. %NULL is ordered before non-%NULL variants. Two %NULL - * values compare equal. - * - * Since: 2.26 - */ -struct _GParamSpecVariant -{ - GParamSpec parent_instance; - GVariantType *type; - GVariant *default_value; - - /*< private >*/ - gpointer padding[4]; -}; - -/* --- GParamSpec prototypes --- */ -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_char (const gchar *name, - const gchar *nick, - const gchar *blurb, - gint8 minimum, - gint8 maximum, - gint8 default_value, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_uchar (const gchar *name, - const gchar *nick, - const gchar *blurb, - guint8 minimum, - guint8 maximum, - guint8 default_value, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_boolean (const gchar *name, - const gchar *nick, - const gchar *blurb, - gboolean default_value, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_int (const gchar *name, - const gchar *nick, - const gchar *blurb, - gint minimum, - gint maximum, - gint default_value, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_uint (const gchar *name, - const gchar *nick, - const gchar *blurb, - guint minimum, - guint maximum, - guint default_value, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_long (const gchar *name, - const gchar *nick, - const gchar *blurb, - glong minimum, - glong maximum, - glong default_value, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_ulong (const gchar *name, - const gchar *nick, - const gchar *blurb, - gulong minimum, - gulong maximum, - gulong default_value, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_int64 (const gchar *name, - const gchar *nick, - const gchar *blurb, - gint64 minimum, - gint64 maximum, - gint64 default_value, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_uint64 (const gchar *name, - const gchar *nick, - const gchar *blurb, - guint64 minimum, - guint64 maximum, - guint64 default_value, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_unichar (const gchar *name, - const gchar *nick, - const gchar *blurb, - gunichar default_value, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_enum (const gchar *name, - const gchar *nick, - const gchar *blurb, - GType enum_type, - gint default_value, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_flags (const gchar *name, - const gchar *nick, - const gchar *blurb, - GType flags_type, - guint default_value, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_float (const gchar *name, - const gchar *nick, - const gchar *blurb, - gfloat minimum, - gfloat maximum, - gfloat default_value, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_double (const gchar *name, - const gchar *nick, - const gchar *blurb, - gdouble minimum, - gdouble maximum, - gdouble default_value, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_string (const gchar *name, - const gchar *nick, - const gchar *blurb, - const gchar *default_value, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_param (const gchar *name, - const gchar *nick, - const gchar *blurb, - GType param_type, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_boxed (const gchar *name, - const gchar *nick, - const gchar *blurb, - GType boxed_type, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_pointer (const gchar *name, - const gchar *nick, - const gchar *blurb, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_value_array (const gchar *name, - const gchar *nick, - const gchar *blurb, - GParamSpec *element_spec, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_object (const gchar *name, - const gchar *nick, - const gchar *blurb, - GType object_type, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_override (const gchar *name, - GParamSpec *overridden); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_gtype (const gchar *name, - const gchar *nick, - const gchar *blurb, - GType is_a_type, - GParamFlags flags); -GLIB_AVAILABLE_IN_ALL -GParamSpec* g_param_spec_variant (const gchar *name, - const gchar *nick, - const gchar *blurb, - const GVariantType *type, - GVariant *default_value, - GParamFlags flags); - -/* --- internal --- */ -/* We prefix variable declarations so they can - * properly get exported in windows dlls. - */ -#ifndef GOBJECT_VAR -# ifdef G_PLATFORM_WIN32 -# ifdef GOBJECT_STATIC_COMPILATION -# define GOBJECT_VAR extern -# else /* !GOBJECT_STATIC_COMPILATION */ -# ifdef GOBJECT_COMPILATION -# ifdef DLL_EXPORT -# define GOBJECT_VAR extern __declspec(dllexport) -# else /* !DLL_EXPORT */ -# define GOBJECT_VAR extern -# endif /* !DLL_EXPORT */ -# else /* !GOBJECT_COMPILATION */ -# define GOBJECT_VAR extern __declspec(dllimport) -# endif /* !GOBJECT_COMPILATION */ -# endif /* !GOBJECT_STATIC_COMPILATION */ -# else /* !G_PLATFORM_WIN32 */ -# define GOBJECT_VAR _GLIB_EXTERN -# endif /* !G_PLATFORM_WIN32 */ -#endif /* GOBJECT_VAR */ - -GOBJECT_VAR GType *g_param_spec_types; - -G_END_DECLS - -#endif /* __G_PARAMSPECS_H__ */ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 2001 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ -#ifndef __G_SOURCECLOSURE_H__ -#define __G_SOURCECLOSURE_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -GLIB_AVAILABLE_IN_ALL -void g_source_set_closure (GSource *source, - GClosure *closure); - -GLIB_AVAILABLE_IN_ALL -void g_source_set_dummy_callback (GSource *source); - -G_END_DECLS - -#endif /* __G_SOURCECLOSURE_H__ */ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 2000 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ -#ifndef __G_TYPE_MODULE_H__ -#define __G_TYPE_MODULE_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -typedef struct _GTypeModule GTypeModule; -typedef struct _GTypeModuleClass GTypeModuleClass; - -#define G_TYPE_TYPE_MODULE (g_type_module_get_type ()) -#define G_TYPE_MODULE(module) (G_TYPE_CHECK_INSTANCE_CAST ((module), G_TYPE_TYPE_MODULE, GTypeModule)) -#define G_TYPE_MODULE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TYPE_MODULE, GTypeModuleClass)) -#define G_IS_TYPE_MODULE(module) (G_TYPE_CHECK_INSTANCE_TYPE ((module), G_TYPE_TYPE_MODULE)) -#define G_IS_TYPE_MODULE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TYPE_MODULE)) -#define G_TYPE_MODULE_GET_CLASS(module) (G_TYPE_INSTANCE_GET_CLASS ((module), G_TYPE_TYPE_MODULE, GTypeModuleClass)) - -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTypeModule, g_object_unref) - -/** - * GTypeModule: - * @name: the name of the module - * - * The members of the GTypeModule structure should not - * be accessed directly, except for the @name field. - */ -struct _GTypeModule -{ - GObject parent_instance; - - guint use_count; - GSList *type_infos; - GSList *interface_infos; - - /*< public >*/ - gchar *name; -}; - -/** - * GTypeModuleClass: - * @parent_class: the parent class - * @load: loads the module and registers one or more types using - * g_type_module_register_type(). - * @unload: unloads the module - * - * In order to implement dynamic loading of types based on #GTypeModule, - * the @load and @unload functions in #GTypeModuleClass must be implemented. - */ -struct _GTypeModuleClass -{ - GObjectClass parent_class; - - /*< public >*/ - gboolean (* load) (GTypeModule *module); - void (* unload) (GTypeModule *module); - - /*< private >*/ - /* Padding for future expansion */ - void (*reserved1) (void); - void (*reserved2) (void); - void (*reserved3) (void); - void (*reserved4) (void); -}; - -/** - * G_DEFINE_DYNAMIC_TYPE: - * @TN: The name of the new type, in Camel case. - * @t_n: The name of the new type, in lowercase, with words - * separated by '_'. - * @T_P: The #GType of the parent type. - * - * A convenience macro for dynamic type implementations, which declares a - * class initialization function, an instance initialization function (see - * #GTypeInfo for information about these) and a static variable named - * `t_n`_parent_class pointing to the parent class. Furthermore, - * it defines a `*_get_type()` and a static `*_register_type()` functions - * for use in your `module_init()`. - * - * See G_DEFINE_DYNAMIC_TYPE_EXTENDED() for an example. - * - * Since: 2.14 - */ -#define G_DEFINE_DYNAMIC_TYPE(TN, t_n, T_P) G_DEFINE_DYNAMIC_TYPE_EXTENDED (TN, t_n, T_P, 0, {}) -/** - * G_DEFINE_DYNAMIC_TYPE_EXTENDED: - * @TypeName: The name of the new type, in Camel case. - * @type_name: The name of the new type, in lowercase, with words - * separated by '_'. - * @TYPE_PARENT: The #GType of the parent type. - * @flags: #GTypeFlags to pass to g_type_module_register_type() - * @CODE: Custom code that gets inserted in the *_get_type() function. - * - * A more general version of G_DEFINE_DYNAMIC_TYPE() which - * allows to specify #GTypeFlags and custom code. - * - * |[ - * G_DEFINE_DYNAMIC_TYPE_EXTENDED (GtkGadget, - * gtk_gadget, - * GTK_TYPE_THING, - * 0, - * G_IMPLEMENT_INTERFACE_DYNAMIC (TYPE_GIZMO, - * gtk_gadget_gizmo_init)); - * ]| - * expands to - * |[ - * static void gtk_gadget_init (GtkGadget *self); - * static void gtk_gadget_class_init (GtkGadgetClass *klass); - * static void gtk_gadget_class_finalize (GtkGadgetClass *klass); - * - * static gpointer gtk_gadget_parent_class = NULL; - * static GType gtk_gadget_type_id = 0; - * - * static void gtk_gadget_class_intern_init (gpointer klass) - * { - * gtk_gadget_parent_class = g_type_class_peek_parent (klass); - * gtk_gadget_class_init ((GtkGadgetClass*) klass); - * } - * - * GType - * gtk_gadget_get_type (void) - * { - * return gtk_gadget_type_id; - * } - * - * static void - * gtk_gadget_register_type (GTypeModule *type_module) - * { - * const GTypeInfo g_define_type_info = { - * sizeof (GtkGadgetClass), - * (GBaseInitFunc) NULL, - * (GBaseFinalizeFunc) NULL, - * (GClassInitFunc) gtk_gadget_class_intern_init, - * (GClassFinalizeFunc) gtk_gadget_class_finalize, - * NULL, // class_data - * sizeof (GtkGadget), - * 0, // n_preallocs - * (GInstanceInitFunc) gtk_gadget_init, - * NULL // value_table - * }; - * gtk_gadget_type_id = g_type_module_register_type (type_module, - * GTK_TYPE_THING, - * "GtkGadget", - * &g_define_type_info, - * (GTypeFlags) flags); - * { - * const GInterfaceInfo g_implement_interface_info = { - * (GInterfaceInitFunc) gtk_gadget_gizmo_init - * }; - * g_type_module_add_interface (type_module, g_define_type_id, TYPE_GIZMO, &g_implement_interface_info); - * } - * } - * ]| - * - * Since: 2.14 - */ -#define G_DEFINE_DYNAMIC_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, flags, CODE) \ -static void type_name##_init (TypeName *self); \ -static void type_name##_class_init (TypeName##Class *klass); \ -static void type_name##_class_finalize (TypeName##Class *klass); \ -static gpointer type_name##_parent_class = NULL; \ -static GType type_name##_type_id = 0; \ -static gint TypeName##_private_offset; \ -\ -_G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \ -\ -G_GNUC_UNUSED \ -static inline gpointer \ -type_name##_get_instance_private (TypeName *self) \ -{ \ - return (G_STRUCT_MEMBER_P (self, TypeName##_private_offset)); \ -} \ -\ -GType \ -type_name##_get_type (void) \ -{ \ - return type_name##_type_id; \ -} \ -static void \ -type_name##_register_type (GTypeModule *type_module) \ -{ \ - GType g_define_type_id G_GNUC_UNUSED; \ - const GTypeInfo g_define_type_info = { \ - sizeof (TypeName##Class), \ - (GBaseInitFunc) NULL, \ - (GBaseFinalizeFunc) NULL, \ - (GClassInitFunc)(void (*)(void)) type_name##_class_intern_init, \ - (GClassFinalizeFunc)(void (*)(void)) type_name##_class_finalize, \ - NULL, /* class_data */ \ - sizeof (TypeName), \ - 0, /* n_preallocs */ \ - (GInstanceInitFunc)(void (*)(void)) type_name##_init, \ - NULL /* value_table */ \ - }; \ - type_name##_type_id = g_type_module_register_type (type_module, \ - TYPE_PARENT, \ - #TypeName, \ - &g_define_type_info, \ - (GTypeFlags) flags); \ - g_define_type_id = type_name##_type_id; \ - { CODE ; } \ -} - -/** - * G_IMPLEMENT_INTERFACE_DYNAMIC: - * @TYPE_IFACE: The #GType of the interface to add - * @iface_init: The interface init function - * - * A convenience macro to ease interface addition in the @_C_ section - * of G_DEFINE_DYNAMIC_TYPE_EXTENDED(). See G_DEFINE_DYNAMIC_TYPE_EXTENDED() - * for an example. - * - * Note that this macro can only be used together with the - * G_DEFINE_DYNAMIC_TYPE_EXTENDED macros, since it depends on variable - * names from that macro. - * - * Since: 2.24 - */ -#define G_IMPLEMENT_INTERFACE_DYNAMIC(TYPE_IFACE, iface_init) { \ - const GInterfaceInfo g_implement_interface_info = { \ - (GInterfaceInitFunc)(void (*)(void)) iface_init, NULL, NULL \ - }; \ - g_type_module_add_interface (type_module, g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \ -} - -/** - * G_ADD_PRIVATE_DYNAMIC: - * @TypeName: the name of the type in CamelCase - * - * A convenience macro to ease adding private data to instances of a new dynamic - * type in the @_C_ section of G_DEFINE_DYNAMIC_TYPE_EXTENDED(). See - * G_ADD_PRIVATE() for details, it is similar but for static types. - * - * Note that this macro can only be used together with the - * G_DEFINE_DYNAMIC_TYPE_EXTENDED macros, since it depends on variable - * names from that macro. - * - * Since: 2.38 - */ -#define G_ADD_PRIVATE_DYNAMIC(TypeName) { \ - TypeName##_private_offset = sizeof (TypeName##Private); \ -} - -GLIB_AVAILABLE_IN_ALL -GType g_type_module_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -gboolean g_type_module_use (GTypeModule *module); -GLIB_AVAILABLE_IN_ALL -void g_type_module_unuse (GTypeModule *module); -GLIB_AVAILABLE_IN_ALL -void g_type_module_set_name (GTypeModule *module, - const gchar *name); -GLIB_AVAILABLE_IN_ALL -GType g_type_module_register_type (GTypeModule *module, - GType parent_type, - const gchar *type_name, - const GTypeInfo *type_info, - GTypeFlags flags); -GLIB_AVAILABLE_IN_ALL -void g_type_module_add_interface (GTypeModule *module, - GType instance_type, - GType interface_type, - const GInterfaceInfo *interface_info); -GLIB_AVAILABLE_IN_ALL -GType g_type_module_register_enum (GTypeModule *module, - const gchar *name, - const GEnumValue *const_static_values); -GLIB_AVAILABLE_IN_ALL -GType g_type_module_register_flags (GTypeModule *module, - const gchar *name, - const GFlagsValue *const_static_values); - -G_END_DECLS - -#endif /* __G_TYPE_MODULE_H__ */ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 2000 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ -#ifndef __G_TYPE_PLUGIN_H__ -#define __G_TYPE_PLUGIN_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/* --- type macros --- */ -#define G_TYPE_TYPE_PLUGIN (g_type_plugin_get_type ()) -#define G_TYPE_PLUGIN(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TYPE_PLUGIN, GTypePlugin)) -#define G_TYPE_PLUGIN_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), G_TYPE_TYPE_PLUGIN, GTypePluginClass)) -#define G_IS_TYPE_PLUGIN(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TYPE_PLUGIN)) -#define G_IS_TYPE_PLUGIN_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), G_TYPE_TYPE_PLUGIN)) -#define G_TYPE_PLUGIN_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_TYPE_PLUGIN, GTypePluginClass)) - - -/* --- typedefs & structures --- */ -typedef struct _GTypePluginClass GTypePluginClass; -/** - * GTypePluginUse: - * @plugin: the #GTypePlugin whose use count should be increased - * - * The type of the @use_plugin function of #GTypePluginClass, which gets called - * to increase the use count of @plugin. - */ -typedef void (*GTypePluginUse) (GTypePlugin *plugin); -/** - * GTypePluginUnuse: - * @plugin: the #GTypePlugin whose use count should be decreased - * - * The type of the @unuse_plugin function of #GTypePluginClass. - */ -typedef void (*GTypePluginUnuse) (GTypePlugin *plugin); -/** - * GTypePluginCompleteTypeInfo: - * @plugin: the #GTypePlugin - * @g_type: the #GType whose info is completed - * @info: the #GTypeInfo struct to fill in - * @value_table: the #GTypeValueTable to fill in - * - * The type of the @complete_type_info function of #GTypePluginClass. - */ -typedef void (*GTypePluginCompleteTypeInfo) (GTypePlugin *plugin, - GType g_type, - GTypeInfo *info, - GTypeValueTable *value_table); -/** - * GTypePluginCompleteInterfaceInfo: - * @plugin: the #GTypePlugin - * @instance_type: the #GType of an instantiatable type to which the interface - * is added - * @interface_type: the #GType of the interface whose info is completed - * @info: the #GInterfaceInfo to fill in - * - * The type of the @complete_interface_info function of #GTypePluginClass. - */ -typedef void (*GTypePluginCompleteInterfaceInfo) (GTypePlugin *plugin, - GType instance_type, - GType interface_type, - GInterfaceInfo *info); -/** - * GTypePlugin: - * - * The GTypePlugin typedef is used as a placeholder - * for objects that implement the GTypePlugin interface. - */ -/** - * GTypePluginClass: - * @use_plugin: Increases the use count of the plugin. - * @unuse_plugin: Decreases the use count of the plugin. - * @complete_type_info: Fills in the #GTypeInfo and - * #GTypeValueTable structs for the type. The structs are initialized - * with `memset(s, 0, sizeof (s))` before calling this function. - * @complete_interface_info: Fills in missing parts of the #GInterfaceInfo - * for the interface. The structs is initialized with - * `memset(s, 0, sizeof (s))` before calling this function. - * - * The #GTypePlugin interface is used by the type system in order to handle - * the lifecycle of dynamically loaded types. - */ -struct _GTypePluginClass -{ - /*< private >*/ - GTypeInterface base_iface; - - /*< public >*/ - GTypePluginUse use_plugin; - GTypePluginUnuse unuse_plugin; - GTypePluginCompleteTypeInfo complete_type_info; - GTypePluginCompleteInterfaceInfo complete_interface_info; -}; - - -/* --- prototypes --- */ -GLIB_AVAILABLE_IN_ALL -GType g_type_plugin_get_type (void) G_GNUC_CONST; -GLIB_AVAILABLE_IN_ALL -void g_type_plugin_use (GTypePlugin *plugin); -GLIB_AVAILABLE_IN_ALL -void g_type_plugin_unuse (GTypePlugin *plugin); -GLIB_AVAILABLE_IN_ALL -void g_type_plugin_complete_type_info (GTypePlugin *plugin, - GType g_type, - GTypeInfo *info, - GTypeValueTable *value_table); -GLIB_AVAILABLE_IN_ALL -void g_type_plugin_complete_interface_info (GTypePlugin *plugin, - GType instance_type, - GType interface_type, - GInterfaceInfo *info); - -G_END_DECLS - -#endif /* __G_TYPE_PLUGIN_H__ */ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 2001 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - * - * gvaluearray.h: GLib array type holding GValues - */ -#ifndef __G_VALUE_ARRAY_H__ -#define __G_VALUE_ARRAY_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/** - * G_TYPE_VALUE_ARRAY: - * - * The type ID of the "GValueArray" type which is a boxed type, - * used to pass around pointers to GValueArrays. - * - * Deprecated: 2.32: Use #GArray instead of #GValueArray - */ -#define G_TYPE_VALUE_ARRAY (g_value_array_get_type ()) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(G_TYPE_ARRAY) - -/* --- typedefs & structs --- */ -typedef struct _GValueArray GValueArray; -/** - * GValueArray: - * @n_values: number of values contained in the array - * @values: array of values - * - * A #GValueArray contains an array of #GValue elements. - */ -struct _GValueArray -{ - guint n_values; - GValue *values; - - /*< private >*/ - guint n_prealloced; -}; - -/* --- prototypes --- */ -GLIB_DEPRECATED_IN_2_32_FOR(GArray) -GType g_value_array_get_type (void) G_GNUC_CONST; - -GLIB_DEPRECATED_IN_2_32_FOR(GArray) -GValue* g_value_array_get_nth (GValueArray *value_array, - guint index_); - -GLIB_DEPRECATED_IN_2_32_FOR(GArray) -GValueArray* g_value_array_new (guint n_prealloced); - -GLIB_DEPRECATED_IN_2_32_FOR(GArray) -void g_value_array_free (GValueArray *value_array); - -GLIB_DEPRECATED_IN_2_32_FOR(GArray) -GValueArray* g_value_array_copy (const GValueArray *value_array); - -GLIB_DEPRECATED_IN_2_32_FOR(GArray) -GValueArray* g_value_array_prepend (GValueArray *value_array, - const GValue *value); - -GLIB_DEPRECATED_IN_2_32_FOR(GArray) -GValueArray* g_value_array_append (GValueArray *value_array, - const GValue *value); - -GLIB_DEPRECATED_IN_2_32_FOR(GArray) -GValueArray* g_value_array_insert (GValueArray *value_array, - guint index_, - const GValue *value); - -GLIB_DEPRECATED_IN_2_32_FOR(GArray) -GValueArray* g_value_array_remove (GValueArray *value_array, - guint index_); - -GLIB_DEPRECATED_IN_2_32_FOR(GArray) -GValueArray* g_value_array_sort (GValueArray *value_array, - GCompareFunc compare_func); - -GLIB_DEPRECATED_IN_2_32_FOR(GArray) -GValueArray* g_value_array_sort_with_data (GValueArray *value_array, - GCompareDataFunc compare_func, - gpointer user_data); - - -G_END_DECLS - -#endif /* __G_VALUE_ARRAY_H__ */ -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - * - * gvaluetypes.h: GLib default values - */ -#ifndef __G_VALUETYPES_H__ -#define __G_VALUETYPES_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - - -G_BEGIN_DECLS - -/* --- type macros --- */ -/** - * G_VALUE_HOLDS_CHAR: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values of type %G_TYPE_CHAR. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_CHAR(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_CHAR)) -/** - * G_VALUE_HOLDS_UCHAR: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values of type %G_TYPE_UCHAR. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_UCHAR(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UCHAR)) -/** - * G_VALUE_HOLDS_BOOLEAN: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values of type %G_TYPE_BOOLEAN. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_BOOLEAN(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_BOOLEAN)) -/** - * G_VALUE_HOLDS_INT: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values of type %G_TYPE_INT. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_INT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT)) -/** - * G_VALUE_HOLDS_UINT: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values of type %G_TYPE_UINT. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_UINT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UINT)) -/** - * G_VALUE_HOLDS_LONG: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values of type %G_TYPE_LONG. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_LONG(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_LONG)) -/** - * G_VALUE_HOLDS_ULONG: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values of type %G_TYPE_ULONG. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_ULONG(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_ULONG)) -/** - * G_VALUE_HOLDS_INT64: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values of type %G_TYPE_INT64. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_INT64(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT64)) -/** - * G_VALUE_HOLDS_UINT64: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values of type %G_TYPE_UINT64. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_UINT64(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UINT64)) -/** - * G_VALUE_HOLDS_FLOAT: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values of type %G_TYPE_FLOAT. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_FLOAT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLOAT)) -/** - * G_VALUE_HOLDS_DOUBLE: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values of type %G_TYPE_DOUBLE. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_DOUBLE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_DOUBLE)) -/** - * G_VALUE_HOLDS_STRING: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values of type %G_TYPE_STRING. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_STRING(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_STRING)) -/** - * G_VALUE_IS_INTERNED_STRING: - * @value: a valid #GValue structure - * - * Checks whether @value contains a string which is canonical. - * - * Returns: %TRUE if the value contains a string in its canonical - * representation, as returned by g_intern_string(). See also - * g_value_set_interned_string(). - * - * Since: 2.66 - */ -#define G_VALUE_IS_INTERNED_STRING(value) (G_VALUE_HOLDS_STRING (value) && ((value)->data[1].v_uint & G_VALUE_INTERNED_STRING)) GLIB_AVAILABLE_MACRO_IN_2_66 -/** - * G_VALUE_HOLDS_POINTER: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values of type %G_TYPE_POINTER. - * - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_POINTER(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_POINTER)) -/** - * G_TYPE_GTYPE: - * - * The type for #GType. - */ -#define G_TYPE_GTYPE (g_gtype_get_type()) -/** - * G_VALUE_HOLDS_GTYPE: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values of type %G_TYPE_GTYPE. - * - * Since: 2.12 - * Returns: %TRUE on success. - */ -#define G_VALUE_HOLDS_GTYPE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_GTYPE)) -/** - * G_VALUE_HOLDS_VARIANT: - * @value: a valid #GValue structure - * - * Checks whether the given #GValue can hold values of type %G_TYPE_VARIANT. - * - * Returns: %TRUE on success. - * - * Since: 2.26 - */ -#define G_VALUE_HOLDS_VARIANT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_VARIANT)) - - -/* --- prototypes --- */ -GLIB_DEPRECATED_IN_2_32_FOR(g_value_set_schar) -void g_value_set_char (GValue *value, - gchar v_char); -GLIB_DEPRECATED_IN_2_32_FOR(g_value_get_schar) -gchar g_value_get_char (const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_schar (GValue *value, - gint8 v_char); -GLIB_AVAILABLE_IN_ALL -gint8 g_value_get_schar (const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_uchar (GValue *value, - guchar v_uchar); -GLIB_AVAILABLE_IN_ALL -guchar g_value_get_uchar (const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_boolean (GValue *value, - gboolean v_boolean); -GLIB_AVAILABLE_IN_ALL -gboolean g_value_get_boolean (const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_int (GValue *value, - gint v_int); -GLIB_AVAILABLE_IN_ALL -gint g_value_get_int (const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_uint (GValue *value, - guint v_uint); -GLIB_AVAILABLE_IN_ALL -guint g_value_get_uint (const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_long (GValue *value, - glong v_long); -GLIB_AVAILABLE_IN_ALL -glong g_value_get_long (const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_ulong (GValue *value, - gulong v_ulong); -GLIB_AVAILABLE_IN_ALL -gulong g_value_get_ulong (const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_int64 (GValue *value, - gint64 v_int64); -GLIB_AVAILABLE_IN_ALL -gint64 g_value_get_int64 (const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_uint64 (GValue *value, - guint64 v_uint64); -GLIB_AVAILABLE_IN_ALL -guint64 g_value_get_uint64 (const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_float (GValue *value, - gfloat v_float); -GLIB_AVAILABLE_IN_ALL -gfloat g_value_get_float (const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_double (GValue *value, - gdouble v_double); -GLIB_AVAILABLE_IN_ALL -gdouble g_value_get_double (const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_string (GValue *value, - const gchar *v_string); -GLIB_AVAILABLE_IN_ALL -void g_value_set_static_string (GValue *value, - const gchar *v_string); -GLIB_AVAILABLE_IN_2_66 -void g_value_set_interned_string (GValue *value, - const gchar *v_string); -GLIB_AVAILABLE_IN_ALL -const gchar * g_value_get_string (const GValue *value); -GLIB_AVAILABLE_IN_ALL -gchar* g_value_dup_string (const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_pointer (GValue *value, - gpointer v_pointer); -GLIB_AVAILABLE_IN_ALL -gpointer g_value_get_pointer (const GValue *value); -GLIB_AVAILABLE_IN_ALL -GType g_gtype_get_type (void); -GLIB_AVAILABLE_IN_ALL -void g_value_set_gtype (GValue *value, - GType v_gtype); -GLIB_AVAILABLE_IN_ALL -GType g_value_get_gtype (const GValue *value); -GLIB_AVAILABLE_IN_ALL -void g_value_set_variant (GValue *value, - GVariant *variant); -GLIB_AVAILABLE_IN_ALL -void g_value_take_variant (GValue *value, - GVariant *variant); -GLIB_AVAILABLE_IN_ALL -GVariant* g_value_get_variant (const GValue *value); -GLIB_AVAILABLE_IN_ALL -GVariant* g_value_dup_variant (const GValue *value); - - -/* Convenience for registering new pointer types */ -GLIB_AVAILABLE_IN_ALL -GType g_pointer_type_register_static (const gchar *name); - -/* debugging aid, describe value contents as string */ -GLIB_AVAILABLE_IN_ALL -gchar* g_strdup_value_contents (const GValue *value); - - -GLIB_AVAILABLE_IN_ALL -void g_value_take_string (GValue *value, - gchar *v_string); -GLIB_DEPRECATED_FOR(g_value_take_string) -void g_value_set_string_take_ownership (GValue *value, - gchar *v_string); - - -/* humpf, need a C representable type name for G_TYPE_STRING */ -/** - * gchararray: - * - * A C representable type name for #G_TYPE_STRING. - */ -typedef gchar* gchararray; - - -G_END_DECLS - -#endif /* __G_VALUETYPES_H__ */ - -/* - * Copyright © 2015 Canonical Limited - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - * - * Author: Ryan Lortie - */ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GClosure, g_closure_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GEnumClass, g_type_class_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFlagsClass, g_type_class_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GObject, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInitiallyUnowned, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GParamSpec, g_param_spec_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTypeClass, g_type_class_unref) -G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GValue, g_value_unset) - -#undef __GLIB_GOBJECT_H_INSIDE__ - -GLIB_AVAILABLE_IN_2_68 -void gobject_init (void); - -#endif /* __GLIB_GOBJECT_H__ */ - -G_BEGIN_DECLS - -/* Enumerations from "gumdarwinmodule.h" */ -GType gum_darwin_module_flags_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_DARWIN_MODULE_FLAGS (gum_darwin_module_flags_get_type ()) - -/* Enumerations from "gumdefs.h" */ -GType gum_cpu_type_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_CPU_TYPE (gum_cpu_type_get_type ()) - -/* Enumerations from "guminterceptor.h" */ -GType gum_attach_return_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ATTACH_RETURN (gum_attach_return_get_type ()) -GType gum_replace_return_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_REPLACE_RETURN (gum_replace_return_get_type ()) - -/* Enumerations from "gumprocess.h" */ -GType gum_code_signing_policy_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_CODE_SIGNING_POLICY (gum_code_signing_policy_get_type ()) -G_END_DECLS - -#endif /* __GUM_ENUM_TYPES_H__ */ - -/* Generated data ends here */ - - -#if !defined (GUM_STATIC) && defined (G_OS_WIN32) -# ifdef GUM_EXPORTS -# define GUM_API __declspec(dllexport) -# else -# define GUM_API __declspec(dllimport) -# endif -#else -# define GUM_API -#endif - -#if !defined (__arm__) && !defined (__aarch64__) -# if GLIB_SIZEOF_VOID_P == 4 -# define GUM_NATIVE_CPU GUM_CPU_IA32 -# else -# define GUM_NATIVE_CPU GUM_CPU_AMD64 -# endif -#elif defined (__arm__) || defined (__aarch64__) -# if GLIB_SIZEOF_VOID_P == 4 -# define GUM_NATIVE_CPU GUM_CPU_ARM -# else -# define GUM_NATIVE_CPU GUM_CPU_ARM64 -# endif -#elif defined (__mips__) -# define GUM_NATIVE_CPU GUM_CPU_MIPS -#endif -#ifdef G_OS_WIN32 -# define GUM_NATIVE_ABI GUM_ABI_WINDOWS -# define GUM_NATIVE_ABI_IS_WINDOWS 1 -# define GUM_NATIVE_ABI_IS_UNIX 0 -#else -# define GUM_NATIVE_ABI GUM_ABI_UNIX -# define GUM_NATIVE_ABI_IS_WINDOWS 0 -# define GUM_NATIVE_ABI_IS_UNIX 1 -#endif - -G_BEGIN_DECLS - -typedef guint64 GumAddress; -#define GUM_ADDRESS(a) ((GumAddress) (guintptr) (a)) -#define GUM_TYPE_ADDRESS (gum_address_get_type ()) -typedef guint GumOS; -typedef guint GumCallingConvention; -typedef guint GumAbiType; -typedef guint GumCpuFeatures; -typedef guint GumInstructionEncoding; -typedef guint GumArgType; -typedef struct _GumArgument GumArgument; -typedef guint GumBranchHint; -typedef struct _GumIA32CpuContext GumIA32CpuContext; -typedef struct _GumX64CpuContext GumX64CpuContext; -typedef struct _GumArmCpuContext GumArmCpuContext; -typedef struct _GumArm64CpuContext GumArm64CpuContext; -typedef struct _GumMipsCpuContext GumMipsCpuContext; -/* - * The only non-legacy big-endian configuration on 32-bit ARM systems is BE8. - * In this configuration, whilst the data is in big-endian, the code stream is - * still in little-endian. Since Capstone is disassembling the code stream, it - * should work in little-endian even on BE8 systems. - */ -#if G_BYTE_ORDER == G_LITTLE_ENDIAN || defined (__arm__) -# define GUM_DEFAULT_CS_ENDIAN CS_MODE_LITTLE_ENDIAN -#else -# define GUM_DEFAULT_CS_ENDIAN CS_MODE_BIG_ENDIAN -#endif -#if !defined (__arm__) && !defined (__aarch64__) && !defined (__mips__) -# define GUM_DEFAULT_CS_ARCH CS_ARCH_X86 -# if GLIB_SIZEOF_VOID_P == 4 -/** - * GUM_DEFAULT_CS_MODE: (skip) - */ -# define GUM_DEFAULT_CS_MODE CS_MODE_32 -typedef GumIA32CpuContext GumCpuContext; -# else -/** - * GUM_DEFAULT_CS_MODE: (skip) - */ -# define GUM_DEFAULT_CS_MODE CS_MODE_64 -typedef GumX64CpuContext GumCpuContext; -# endif -#elif defined (__arm__) && !defined (__aarch64__) -# define GUM_DEFAULT_CS_ARCH CS_ARCH_ARM -/** - * GUM_DEFAULT_CS_MODE: (skip) - */ -# define GUM_DEFAULT_CS_MODE \ - ((cs_mode) (CS_MODE_ARM | CS_MODE_V8 | GUM_DEFAULT_CS_ENDIAN)) -# define GUM_PSR_T_BIT 0x20 -typedef GumArmCpuContext GumCpuContext; -#elif defined (__aarch64__) -# define GUM_DEFAULT_CS_ARCH CS_ARCH_ARM64 -/** - * GUM_DEFAULT_CS_MODE: (skip) - */ -# define GUM_DEFAULT_CS_MODE GUM_DEFAULT_CS_ENDIAN -typedef GumArm64CpuContext GumCpuContext; -#elif defined (__mips__) -# define GUM_DEFAULT_CS_ARCH CS_ARCH_MIPS -# if GLIB_SIZEOF_VOID_P == 4 -/** - * GUM_DEFAULT_CS_MODE: (skip) - */ -# define GUM_DEFAULT_CS_MODE ((cs_mode) \ - (CS_MODE_MIPS32 | GUM_DEFAULT_CS_ENDIAN)) -# else -/** - * GUM_DEFAULT_CS_MODE: (skip) - */ -# define GUM_DEFAULT_CS_MODE ((cs_mode) \ - (CS_MODE_MIPS64 | GUM_DEFAULT_CS_ENDIAN)) -# endif -typedef GumMipsCpuContext GumCpuContext; -#endif -typedef guint GumRelocationScenario; - -enum _GumOS -{ - GUM_OS_WINDOWS, - GUM_OS_MACOS, - GUM_OS_LINUX, - GUM_OS_IOS, - GUM_OS_ANDROID, - GUM_OS_QNX -}; - -enum _GumCallingConvention -{ - GUM_CALL_CAPI, - GUM_CALL_SYSAPI -}; - -enum _GumAbiType -{ - GUM_ABI_UNIX, - GUM_ABI_WINDOWS -}; - -typedef enum { - GUM_CPU_INVALID, - GUM_CPU_IA32, - GUM_CPU_AMD64, - GUM_CPU_ARM, - GUM_CPU_ARM64, - GUM_CPU_MIPS -} GumCpuType; - -enum _GumCpuFeatures -{ - GUM_CPU_AVX2 = 1 << 0, - GUM_CPU_VFP2 = 1 << 1, - GUM_CPU_VFP3 = 1 << 2, - GUM_CPU_PTRAUTH = 1 << 3, -}; - -enum _GumInstructionEncoding -{ - GUM_INSTRUCTION_DEFAULT, - GUM_INSTRUCTION_SPECIAL -}; - -enum _GumArgType -{ - GUM_ARG_ADDRESS, - GUM_ARG_REGISTER -}; - -struct _GumArgument -{ - GumArgType type; - - union - { - GumAddress address; - gint reg; - } value; -}; - -enum _GumBranchHint -{ - GUM_NO_HINT, - GUM_LIKELY, - GUM_UNLIKELY -}; - -struct _GumIA32CpuContext -{ - guint32 eip; - - guint32 edi; - guint32 esi; - guint32 ebp; - guint32 esp; - guint32 ebx; - guint32 edx; - guint32 ecx; - guint32 eax; -}; - -struct _GumX64CpuContext -{ - guint64 rip; - - guint64 r15; - guint64 r14; - guint64 r13; - guint64 r12; - guint64 r11; - guint64 r10; - guint64 r9; - guint64 r8; - - guint64 rdi; - guint64 rsi; - guint64 rbp; - guint64 rsp; - guint64 rbx; - guint64 rdx; - guint64 rcx; - guint64 rax; -}; - -struct _GumArmCpuContext -{ - guint32 cpsr; - guint32 pc; - guint32 sp; - - guint32 r8; - guint32 r9; - guint32 r10; - guint32 r11; - guint32 r12; - - guint32 r[8]; - guint32 lr; -}; - -struct _GumArm64CpuContext -{ - guint64 pc; - guint64 sp; - - guint64 x[29]; - guint64 fp; - guint64 lr; - guint8 q[128]; -}; - -struct _GumMipsCpuContext -{ - /* - * This structure represents the register state pushed onto the stack by the - * trampoline which allows us to vector from the original minimal assembly - * hook to architecture agnostic C code inside frida-gum. These registers are - * natively sized. Even if some have not been expanded to 64-bits from the - * MIPS32 architecture MIPS can only perform aligned data access and as such - * pushing zero extended values is simpler than attempting to push minimally - * sized data types. - */ - gsize pc; - - gsize gp; - gsize sp; - gsize fp; - gsize ra; - - gsize hi; - gsize lo; - - gsize at; - - gsize v0; - gsize v1; - - gsize a0; - gsize a1; - gsize a2; - gsize a3; - - gsize t0; - gsize t1; - gsize t2; - gsize t3; - gsize t4; - gsize t5; - gsize t6; - gsize t7; - gsize t8; - gsize t9; - - gsize s0; - gsize s1; - gsize s2; - gsize s3; - gsize s4; - gsize s5; - gsize s6; - gsize s7; - - gsize k0; - gsize k1; -}; - -enum _GumRelocationScenario -{ - GUM_SCENARIO_OFFLINE, - GUM_SCENARIO_ONLINE -}; - -#ifndef __arm__ -# if GLIB_SIZEOF_VOID_P == 8 -# define GUM_CPU_CONTEXT_XAX(c) ((c)->rax) -# define GUM_CPU_CONTEXT_XCX(c) ((c)->rcx) -# define GUM_CPU_CONTEXT_XDX(c) ((c)->rdx) -# define GUM_CPU_CONTEXT_XBX(c) ((c)->rbx) -# define GUM_CPU_CONTEXT_XSP(c) ((c)->rsp) -# define GUM_CPU_CONTEXT_XBP(c) ((c)->rbp) -# define GUM_CPU_CONTEXT_XSI(c) ((c)->rsi) -# define GUM_CPU_CONTEXT_XDI(c) ((c)->rdi) -# define GUM_CPU_CONTEXT_XIP(c) ((c)->rip) -# define GUM_CPU_CONTEXT_OFFSET_XAX (G_STRUCT_OFFSET (GumCpuContext, rax)) -# define GUM_CPU_CONTEXT_OFFSET_XCX (G_STRUCT_OFFSET (GumCpuContext, rcx)) -# define GUM_CPU_CONTEXT_OFFSET_XDX (G_STRUCT_OFFSET (GumCpuContext, rdx)) -# define GUM_CPU_CONTEXT_OFFSET_XBX (G_STRUCT_OFFSET (GumCpuContext, rbx)) -# define GUM_CPU_CONTEXT_OFFSET_XSP (G_STRUCT_OFFSET (GumCpuContext, rsp)) -# define GUM_CPU_CONTEXT_OFFSET_XBP (G_STRUCT_OFFSET (GumCpuContext, rbp)) -# define GUM_CPU_CONTEXT_OFFSET_XSI (G_STRUCT_OFFSET (GumCpuContext, rsi)) -# define GUM_CPU_CONTEXT_OFFSET_XDI (G_STRUCT_OFFSET (GumCpuContext, rdi)) -# define GUM_CPU_CONTEXT_OFFSET_XIP (G_STRUCT_OFFSET (GumCpuContext, rip)) -# else -# define GUM_CPU_CONTEXT_XAX(c) ((c)->eax) -# define GUM_CPU_CONTEXT_XCX(c) ((c)->ecx) -# define GUM_CPU_CONTEXT_XDX(c) ((c)->edx) -# define GUM_CPU_CONTEXT_XBX(c) ((c)->ebx) -# define GUM_CPU_CONTEXT_XSP(c) ((c)->esp) -# define GUM_CPU_CONTEXT_XBP(c) ((c)->ebp) -# define GUM_CPU_CONTEXT_XSI(c) ((c)->esi) -# define GUM_CPU_CONTEXT_XDI(c) ((c)->edi) -# define GUM_CPU_CONTEXT_XIP(c) ((c)->eip) -# define GUM_CPU_CONTEXT_OFFSET_XAX (G_STRUCT_OFFSET (GumCpuContext, eax)) -# define GUM_CPU_CONTEXT_OFFSET_XCX (G_STRUCT_OFFSET (GumCpuContext, ecx)) -# define GUM_CPU_CONTEXT_OFFSET_XDX (G_STRUCT_OFFSET (GumCpuContext, edx)) -# define GUM_CPU_CONTEXT_OFFSET_XBX (G_STRUCT_OFFSET (GumCpuContext, ebx)) -# define GUM_CPU_CONTEXT_OFFSET_XSP (G_STRUCT_OFFSET (GumCpuContext, esp)) -# define GUM_CPU_CONTEXT_OFFSET_XBP (G_STRUCT_OFFSET (GumCpuContext, ebp)) -# define GUM_CPU_CONTEXT_OFFSET_XSI (G_STRUCT_OFFSET (GumCpuContext, esi)) -# define GUM_CPU_CONTEXT_OFFSET_XDI (G_STRUCT_OFFSET (GumCpuContext, edi)) -# define GUM_CPU_CONTEXT_OFFSET_XIP (G_STRUCT_OFFSET (GumCpuContext, eip)) -# endif -#endif - -#define GUM_MAX_PATH 260 -#define GUM_MAX_TYPE_NAME 16 -#define GUM_MAX_SYMBOL_NAME 2048 - -#define GUM_MAX_THREADS 768 -#define GUM_MAX_CALL_DEPTH 32 -#define GUM_MAX_BACKTRACE_DEPTH 16 -#define GUM_MAX_WORST_CASE_INFO_SIZE 128 - -#define GUM_MAX_LISTENERS_PER_FUNCTION 2 -#define GUM_MAX_LISTENER_DATA 512 - -#define GUM_MAX_THREAD_RANGES 2 - -#if GLIB_SIZEOF_VOID_P == 8 -#define GUM_CPU_MODE CS_MODE_64 -#define GUM_THUNK -#else -#define GUM_CPU_MODE CS_MODE_32 -#define GUM_THUNK GUM_FASTCALL -#endif -#if !defined (G_OS_WIN32) && GLIB_SIZEOF_VOID_P == 8 -# define GUM_THUNK_REG_ARG0 GUM_REG_XDI -# define GUM_THUNK_REG_ARG1 GUM_REG_XSI -#else -# define GUM_THUNK_REG_ARG0 GUM_REG_XCX -# define GUM_THUNK_REG_ARG1 GUM_REG_XDX -#endif -#define GUM_RED_ZONE_SIZE 128 - -#ifdef _MSC_VER -# define GUM_CDECL __cdecl -# define GUM_STDCALL __stdcall -# define GUM_FASTCALL __fastcall -# define GUM_NOINLINE __declspec (noinline) -#else -# ifndef __arm__ -# if GLIB_SIZEOF_VOID_P == 4 -# define GUM_CDECL __attribute__((cdecl)) -# define GUM_STDCALL __attribute__((stdcall)) -# else -# define GUM_CDECL -# define GUM_STDCALL -# endif -# define GUM_FASTCALL __attribute__((fastcall)) -# else -# define GUM_CDECL -# define GUM_STDCALL -# define GUM_FASTCALL -# endif -# define GUM_NOINLINE __attribute__((noinline)) -#endif - -#define GUM_ALIGN_POINTER(t, p, b) \ - ((t) GSIZE_TO_POINTER (((GPOINTER_TO_SIZE (p) + ((gsize) (b - 1))) & \ - ~((gsize) (b - 1))))) -#define GUM_ALIGN_SIZE(s, b) \ - ((((gsize) s) + ((gsize) (b - 1))) & ~((gsize) (b - 1))) - -#define GUM_FUNCPTR_TO_POINTER(f) (GSIZE_TO_POINTER (f)) -#define GUM_POINTER_TO_FUNCPTR(t, p) ((t) GPOINTER_TO_SIZE (p)) - -#define GUM_INT2_MASK 0x00000003U -#define GUM_INT4_MASK 0x0000000fU -#define GUM_INT5_MASK 0x0000001fU -#define GUM_INT6_MASK 0x0000003fU -#define GUM_INT8_MASK 0x000000ffU -#define GUM_INT10_MASK 0x000003ffU -#define GUM_INT11_MASK 0x000007ffU -#define GUM_INT12_MASK 0x00000fffU -#define GUM_INT14_MASK 0x00003fffU -#define GUM_INT16_MASK 0x0000ffffU -#define GUM_INT18_MASK 0x0003ffffU -#define GUM_INT19_MASK 0x0007ffffU -#define GUM_INT24_MASK 0x00ffffffU -#define GUM_INT26_MASK 0x03ffffffU -#define GUM_INT28_MASK 0x0fffffffU -#define GUM_INT32_MASK 0xffffffffU - -#define GUM_IS_WITHIN_UINT7_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (0) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (127)) -#define GUM_IS_WITHIN_UINT8_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (0) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (255)) -#define GUM_IS_WITHIN_INT8_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-128) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (127)) -#define GUM_IS_WITHIN_INT11_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-1024) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (1023)) -#define GUM_IS_WITHIN_INT14_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-8192) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (8191)) -#define GUM_IS_WITHIN_INT16_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-32768) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (32767)) -#define GUM_IS_WITHIN_INT18_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-131072) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (131071)) -#define GUM_IS_WITHIN_INT19_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-262144) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (262143)) -#define GUM_IS_WITHIN_INT20_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-524288) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (524287)) -#define GUM_IS_WITHIN_INT21_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-1048576) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (1048575)) -#define GUM_IS_WITHIN_INT24_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-8388608) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (8388607)) -#define GUM_IS_WITHIN_INT26_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-33554432) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (33554431)) -#define GUM_IS_WITHIN_INT28_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-134217728) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (134217727)) -#define GUM_IS_WITHIN_INT32_RANGE(i) \ - (((gint64) (i)) >= (gint64) G_MININT32 && \ - ((gint64) (i)) <= (gint64) G_MAXINT32) - -GUM_API GumCpuFeatures gum_query_cpu_features (void); - -GUM_API gpointer gum_cpu_context_get_nth_argument (GumCpuContext * self, - guint n); -GUM_API void gum_cpu_context_replace_nth_argument (GumCpuContext * self, - guint n, gpointer value); -GUM_API gpointer gum_cpu_context_get_return_value (GumCpuContext * self); -GUM_API void gum_cpu_context_replace_return_value (GumCpuContext * self, - gpointer value); - -GUM_API GType gum_address_get_type (void) G_GNUC_CONST; - -G_END_DECLS - -#endif - -/* - * Copyright (C) 2016-2018 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_API_RESOLVER_H__ -#define __GUM_API_RESOLVER_H__ - - -G_BEGIN_DECLS - -#define GUM_TYPE_API_RESOLVER (gum_api_resolver_get_type ()) -G_DECLARE_INTERFACE (GumApiResolver, gum_api_resolver, GUM, API_RESOLVER, - GObject) - -typedef struct _GumApiDetails GumApiDetails; - -typedef gboolean (* GumFoundApiFunc) (const GumApiDetails * details, - gpointer user_data); - -struct _GumApiResolverInterface -{ - GTypeInterface parent; - - void (* enumerate_matches) (GumApiResolver * self, const gchar * query, - GumFoundApiFunc func, gpointer user_data, GError ** error); -}; - -struct _GumApiDetails -{ - const gchar * name; - GumAddress address; -}; - -GUM_API GumApiResolver * gum_api_resolver_make (const gchar * type); - -GUM_API void gum_api_resolver_enumerate_matches (GumApiResolver * self, - const gchar * query, GumFoundApiFunc func, gpointer user_data, - GError ** error); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2008-2018 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_BACKTRACER_H__ -#define __GUM_BACKTRACER_H__ - -/* - * Copyright (C) 2008-2010 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_RETURN_ADDRESS_H__ -#define __GUM_RETURN_ADDRESS_H__ - - -typedef struct _GumReturnAddressDetails GumReturnAddressDetails; -typedef gpointer GumReturnAddress; -typedef struct _GumReturnAddressArray GumReturnAddressArray; - -struct _GumReturnAddressDetails -{ - GumReturnAddress address; - gchar module_name[GUM_MAX_PATH + 1]; - gchar function_name[GUM_MAX_SYMBOL_NAME + 1]; - gchar file_name[GUM_MAX_PATH + 1]; - guint line_number; -}; - -struct _GumReturnAddressArray -{ - guint len; - GumReturnAddress items[GUM_MAX_BACKTRACE_DEPTH]; -}; - -G_BEGIN_DECLS - -GUM_API gboolean gum_return_address_details_from_address ( - GumReturnAddress address, GumReturnAddressDetails * details); - -GUM_API gboolean gum_return_address_array_is_equal ( - const GumReturnAddressArray * array1, - const GumReturnAddressArray * array2); - -G_END_DECLS - -#endif - -G_BEGIN_DECLS - -#define GUM_TYPE_BACKTRACER (gum_backtracer_get_type ()) -G_DECLARE_INTERFACE (GumBacktracer, gum_backtracer, GUM, BACKTRACER, GObject) - -struct _GumBacktracerInterface -{ - GTypeInterface parent; - - void (* generate) (GumBacktracer * self, const GumCpuContext * cpu_context, - GumReturnAddressArray * return_addresses); -}; - -GUM_API GumBacktracer * gum_backtracer_make_accurate (void); -GUM_API GumBacktracer * gum_backtracer_make_fuzzy (void); - -GUM_API void gum_backtracer_generate (GumBacktracer * self, - const GumCpuContext * cpu_context, - GumReturnAddressArray * return_addresses); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2017-2018 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_CLOAK_H__ -#define __GUM_CLOAK_H__ - -/* - * Copyright (C) 2008-2020 Ole André Vadla Ravnås - * Copyright (C) 2008 Christian Berentsen - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_MEMORY_H__ -#define __GUM_MEMORY_H__ - - -#define GUM_TYPE_MEMORY_RANGE (gum_memory_range_get_type ()) -#define GUM_MEMORY_RANGE_INCLUDES(r, a) ((a) >= (r)->base_address && \ - (a) < ((r)->base_address + (r)->size)) - -#define GUM_PAGE_RW ((GumPageProtection) (GUM_PAGE_READ | GUM_PAGE_WRITE)) -#define GUM_PAGE_RX ((GumPageProtection) (GUM_PAGE_READ | GUM_PAGE_EXECUTE)) -#define GUM_PAGE_RWX ((GumPageProtection) (GUM_PAGE_READ | GUM_PAGE_WRITE | \ - GUM_PAGE_EXECUTE)) - -G_BEGIN_DECLS - -typedef guint GumPtrauthSupport; -typedef guint GumRwxSupport; -typedef guint GumMemoryOperation; -typedef guint GumPageProtection; -typedef struct _GumAddressSpec GumAddressSpec; -typedef struct _GumMemoryRange GumMemoryRange; -typedef struct _GumMatchPattern GumMatchPattern; - -typedef gboolean (* GumMemoryIsNearFunc) (gpointer memory, gpointer address); - -enum _GumPtrauthSupport -{ - GUM_PTRAUTH_INVALID, - GUM_PTRAUTH_UNSUPPORTED, - GUM_PTRAUTH_SUPPORTED -}; - -enum _GumRwxSupport -{ - GUM_RWX_NONE, - GUM_RWX_ALLOCATIONS_ONLY, - GUM_RWX_FULL -}; - -enum _GumMemoryOperation -{ - GUM_MEMOP_INVALID, - GUM_MEMOP_READ, - GUM_MEMOP_WRITE, - GUM_MEMOP_EXECUTE -}; - -enum _GumPageProtection -{ - GUM_PAGE_NO_ACCESS = 0, - GUM_PAGE_READ = (1 << 0), - GUM_PAGE_WRITE = (1 << 1), - GUM_PAGE_EXECUTE = (1 << 2), -}; - -struct _GumAddressSpec -{ - gpointer near_address; - gsize max_distance; -}; - -struct _GumMemoryRange -{ - GumAddress base_address; - gsize size; -}; - -typedef void (* GumMemoryPatchApplyFunc) (gpointer mem, gpointer user_data); -typedef gboolean (* GumMemoryScanMatchFunc) (GumAddress address, gsize size, - gpointer user_data); - -GUM_API void gum_internal_heap_ref (void); -GUM_API void gum_internal_heap_unref (void); - -GUM_API gpointer gum_sign_code_pointer (gpointer value); -GUM_API gpointer gum_strip_code_pointer (gpointer value); -GUM_API GumAddress gum_sign_code_address (GumAddress value); -GUM_API GumAddress gum_strip_code_address (GumAddress value); -GUM_API GumPtrauthSupport gum_query_ptrauth_support (void); -GUM_API guint gum_query_page_size (void); -GUM_API gboolean gum_query_is_rwx_supported (void); -GUM_API GumRwxSupport gum_query_rwx_support (void); -GUM_API gboolean gum_memory_is_readable (gconstpointer address, gsize len); -GUM_API guint8 * gum_memory_read (gconstpointer address, gsize len, - gsize * n_bytes_read); -GUM_API gboolean gum_memory_write (gpointer address, const guint8 * bytes, - gsize len); -GUM_API gboolean gum_memory_patch_code (gpointer address, gsize size, - GumMemoryPatchApplyFunc apply, gpointer apply_data); -GUM_API gboolean gum_memory_mark_code (gpointer address, gsize size); - -GUM_API void gum_memory_scan (const GumMemoryRange * range, - const GumMatchPattern * pattern, GumMemoryScanMatchFunc func, - gpointer user_data); - -GUM_API GumMatchPattern * gum_match_pattern_new_from_string ( - const gchar * match_combined_str); -GUM_API void gum_match_pattern_free (GumMatchPattern * pattern); - -GUM_API void gum_ensure_code_readable (gconstpointer address, gsize size); - -GUM_API void gum_mprotect (gpointer address, gsize size, - GumPageProtection page_prot); -GUM_API gboolean gum_try_mprotect (gpointer address, gsize size, - GumPageProtection page_prot); - -GUM_API void gum_clear_cache (gpointer address, gsize size); - -#define gum_new(struct_type, n_structs) \ - ((struct_type *) gum_malloc (n_structs * sizeof (struct_type))) -#define gum_new0(struct_type, n_structs) \ - ((struct_type *) gum_malloc0 (n_structs * sizeof (struct_type))) - -GUM_API guint gum_peek_private_memory_usage (void); - -GUM_API gpointer gum_malloc (gsize size); -GUM_API gpointer gum_malloc0 (gsize size); -GUM_API gsize gum_malloc_usable_size (gconstpointer mem); -GUM_API gpointer gum_calloc (gsize count, gsize size); -GUM_API gpointer gum_realloc (gpointer mem, gsize size); -GUM_API gpointer gum_memalign (gsize alignment, gsize size); -GUM_API gpointer gum_memdup (gconstpointer mem, gsize byte_size); -GUM_API void gum_free (gpointer mem); - -GUM_API gpointer gum_alloc_n_pages (guint n_pages, GumPageProtection page_prot); -GUM_API gpointer gum_try_alloc_n_pages (guint n_pages, - GumPageProtection page_prot); -GUM_API gpointer gum_alloc_n_pages_near (guint n_pages, - GumPageProtection page_prot, const GumAddressSpec * address_spec); -GUM_API gpointer gum_try_alloc_n_pages_near (guint n_pages, - GumPageProtection page_prot, const GumAddressSpec * address_spec); -GUM_API void gum_query_page_allocation_range (gconstpointer mem, guint size, - GumMemoryRange * range); -GUM_API void gum_free_pages (gpointer mem); - -GUM_API gpointer gum_memory_allocate (gpointer address, gsize size, - gsize alignment, GumPageProtection page_prot); -GUM_API gboolean gum_memory_free (gpointer address, gsize size); -GUM_API gboolean gum_memory_release (gpointer address, gsize size); -GUM_API gboolean gum_memory_commit (gpointer address, gsize size, - GumPageProtection page_prot); -GUM_API gboolean gum_memory_decommit (gpointer address, gsize size); - -GUM_API GType gum_memory_range_get_type (void) G_GNUC_CONST; -GUM_API GumMemoryRange * gum_memory_range_copy (const GumMemoryRange * range); -GUM_API void gum_memory_range_free (GumMemoryRange * range); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2008-2020 Ole André Vadla Ravnås - * Copyright (C) 2020 Francesco Tamagni - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_PROCESS_H__ -#define __GUM_PROCESS_H__ - - -#define GUM_THREAD_ID_INVALID ((GumThreadId) -1) - -#define GUM_TYPE_MODULE_DETAILS (gum_module_details_get_type ()) - -G_BEGIN_DECLS - -typedef guint GumProcessId; -typedef gsize GumThreadId; -typedef guint GumThreadState; -typedef struct _GumThreadDetails GumThreadDetails; -typedef struct _GumModuleDetails GumModuleDetails; -typedef guint GumImportType; -typedef guint GumExportType; -typedef guint GumSymbolType; -typedef struct _GumImportDetails GumImportDetails; -typedef struct _GumExportDetails GumExportDetails; -typedef struct _GumSymbolDetails GumSymbolDetails; -typedef struct _GumSymbolSection GumSymbolSection; -typedef struct _GumRangeDetails GumRangeDetails; -typedef struct _GumFileMapping GumFileMapping; -typedef struct _GumMallocRangeDetails GumMallocRangeDetails; - -typedef enum { - GUM_CODE_SIGNING_OPTIONAL, - GUM_CODE_SIGNING_REQUIRED -} GumCodeSigningPolicy; - -enum _GumThreadState -{ - GUM_THREAD_RUNNING = 1, - GUM_THREAD_STOPPED, - GUM_THREAD_WAITING, - GUM_THREAD_UNINTERRUPTIBLE, - GUM_THREAD_HALTED -}; - -struct _GumThreadDetails -{ - GumThreadId id; - GumThreadState state; - GumCpuContext cpu_context; -}; - -struct _GumModuleDetails -{ - const gchar * name; - const GumMemoryRange * range; - const gchar * path; -}; - -enum _GumImportType -{ - GUM_IMPORT_UNKNOWN, - GUM_IMPORT_FUNCTION, - GUM_IMPORT_VARIABLE -}; - -enum _GumExportType -{ - GUM_EXPORT_FUNCTION = 1, - GUM_EXPORT_VARIABLE -}; - -enum _GumSymbolType -{ - /* Common */ - GUM_SYMBOL_UNKNOWN, - GUM_SYMBOL_SECTION, - - /* Mach-O */ - GUM_SYMBOL_UNDEFINED, - GUM_SYMBOL_ABSOLUTE, - GUM_SYMBOL_PREBOUND_UNDEFINED, - GUM_SYMBOL_INDIRECT, - - /* ELF */ - GUM_SYMBOL_OBJECT, - GUM_SYMBOL_FUNCTION, - GUM_SYMBOL_FILE, - GUM_SYMBOL_COMMON, - GUM_SYMBOL_TLS, -}; - -struct _GumImportDetails -{ - GumImportType type; - const gchar * name; - const gchar * module; - GumAddress address; - GumAddress slot; -}; - -struct _GumExportDetails -{ - GumExportType type; - const gchar * name; - GumAddress address; -}; - -struct _GumSymbolDetails -{ - gboolean is_global; - GumSymbolType type; - const GumSymbolSection * section; - const gchar * name; - GumAddress address; - gssize size; -}; - -struct _GumSymbolSection -{ - const gchar * id; - GumPageProtection protection; -}; - -struct _GumRangeDetails -{ - const GumMemoryRange * range; - GumPageProtection protection; - const GumFileMapping * file; -}; - -struct _GumFileMapping -{ - const gchar * path; - guint64 offset; - gsize size; -}; - -struct _GumMallocRangeDetails -{ - const GumMemoryRange * range; -}; - -typedef void (* GumModifyThreadFunc) (GumThreadId thread_id, - GumCpuContext * cpu_context, gpointer user_data); -typedef gboolean (* GumFoundThreadFunc) (const GumThreadDetails * details, - gpointer user_data); -typedef gboolean (* GumFoundModuleFunc) (const GumModuleDetails * details, - gpointer user_data); -typedef gboolean (* GumFoundImportFunc) (const GumImportDetails * details, - gpointer user_data); -typedef gboolean (* GumFoundExportFunc) (const GumExportDetails * details, - gpointer user_data); -typedef gboolean (* GumFoundSymbolFunc) (const GumSymbolDetails * details, - gpointer user_data); -typedef gboolean (* GumFoundRangeFunc) (const GumRangeDetails * details, - gpointer user_data); -typedef gboolean (* GumFoundMallocRangeFunc) ( - const GumMallocRangeDetails * details, gpointer user_data); - -GUM_API GumOS gum_process_get_native_os (void); -GUM_API GumCodeSigningPolicy gum_process_get_code_signing_policy (void); -GUM_API void gum_process_set_code_signing_policy (GumCodeSigningPolicy policy); -GUM_API const gchar * gum_process_query_libc_name (void); -GUM_API gboolean gum_process_is_debugger_attached (void); -GUM_API GumProcessId gum_process_get_id (void); -GUM_API GumThreadId gum_process_get_current_thread_id (void); -GUM_API gboolean gum_process_has_thread (GumThreadId thread_id); -GUM_API gboolean gum_process_modify_thread (GumThreadId thread_id, - GumModifyThreadFunc func, gpointer user_data); -GUM_API void gum_process_enumerate_threads (GumFoundThreadFunc func, - gpointer user_data); -GUM_API void gum_process_enumerate_modules (GumFoundModuleFunc func, - gpointer user_data); -GUM_API void gum_process_enumerate_ranges (GumPageProtection prot, - GumFoundRangeFunc func, gpointer user_data); -GUM_API void gum_process_enumerate_malloc_ranges ( - GumFoundMallocRangeFunc func, gpointer user_data); -GUM_API guint gum_thread_try_get_ranges (GumMemoryRange * ranges, - guint max_length); -GUM_API gint gum_thread_get_system_error (void); -GUM_API void gum_thread_set_system_error (gint value); -GUM_API gboolean gum_module_load (const gchar * module_name, GError ** error); -GUM_API gboolean gum_module_ensure_initialized (const gchar * module_name); -GUM_API void gum_module_enumerate_imports (const gchar * module_name, - GumFoundImportFunc func, gpointer user_data); -GUM_API void gum_module_enumerate_exports (const gchar * module_name, - GumFoundExportFunc func, gpointer user_data); -GUM_API void gum_module_enumerate_symbols (const gchar * module_name, - GumFoundSymbolFunc func, gpointer user_data); -GUM_API void gum_module_enumerate_ranges (const gchar * module_name, - GumPageProtection prot, GumFoundRangeFunc func, gpointer user_data); -GUM_API GumAddress gum_module_find_base_address (const gchar * module_name); -GUM_API GumAddress gum_module_find_export_by_name (const gchar * module_name, - const gchar * symbol_name); -GUM_API GumAddress gum_module_find_symbol_by_name (const gchar * module_name, - const gchar * symbol_name); - -GUM_API const gchar * gum_code_signing_policy_to_string ( - GumCodeSigningPolicy policy); - -GUM_API GType gum_module_details_get_type (void) G_GNUC_CONST; -GUM_API GumModuleDetails * gum_module_details_copy ( - const GumModuleDetails * module); -GUM_API void gum_module_details_free (GumModuleDetails * module); - -GUM_API const gchar * gum_symbol_type_to_string (GumSymbolType type); - -G_END_DECLS - -#endif - -G_BEGIN_DECLS - -typedef gboolean (* GumCloakFoundThreadFunc) (GumThreadId id, - gpointer user_data); -typedef gboolean (* GumCloakFoundRangeFunc) (const GumMemoryRange * range, - gpointer user_data); -typedef gboolean (* GumCloakFoundFDFunc) (gint fd, gpointer user_data); - -GUM_API void gum_cloak_add_thread (GumThreadId id); -GUM_API void gum_cloak_remove_thread (GumThreadId id); -GUM_API gboolean gum_cloak_has_thread (GumThreadId id); -GUM_API void gum_cloak_enumerate_threads (GumCloakFoundThreadFunc func, - gpointer user_data); - -GUM_API void gum_cloak_add_range (const GumMemoryRange * range); -GUM_API void gum_cloak_remove_range (const GumMemoryRange * range); -GUM_API GArray * gum_cloak_clip_range (const GumMemoryRange * range); -GUM_API void gum_cloak_enumerate_ranges (GumCloakFoundRangeFunc func, - gpointer user_data); - -GUM_API void gum_cloak_add_file_descriptor (gint fd); -GUM_API void gum_cloak_remove_file_descriptor (gint fd); -GUM_API gboolean gum_cloak_has_file_descriptor (gint fd); -GUM_API void gum_cloak_enumerate_file_descriptors (GumCloakFoundFDFunc func, - gpointer user_data); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2010 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_CODE_ALLOCATOR_H__ -#define __GUM_CODE_ALLOCATOR_H__ - - -typedef struct _GumCodeAllocator GumCodeAllocator; -typedef struct _GumCodeSlice GumCodeSlice; -typedef struct _GumCodeDeflector GumCodeDeflector; - -struct _GumCodeAllocator -{ - gsize slice_size; - gsize pages_per_batch; - gsize slices_per_batch; - gsize pages_metadata_size; - - GSList * uncommitted_pages; - GHashTable * dirty_pages; - GList * free_slices; - - GSList * dispatchers; -}; - -struct _GumCodeSlice -{ - gpointer data; - gsize size; -}; - -struct _GumCodeDeflector -{ - gpointer return_address; - gpointer target; - gpointer trampoline; -}; - -void gum_code_allocator_init (GumCodeAllocator * allocator, gsize slice_size); -void gum_code_allocator_free (GumCodeAllocator * allocator); - -GumCodeSlice * gum_code_allocator_alloc_slice (GumCodeAllocator * self); -GumCodeSlice * gum_code_allocator_try_alloc_slice_near (GumCodeAllocator * self, - const GumAddressSpec * spec, gsize alignment); -void gum_code_allocator_commit (GumCodeAllocator * self); -void gum_code_slice_free (GumCodeSlice * slice); - -GumCodeDeflector * gum_code_allocator_alloc_deflector (GumCodeAllocator * self, - const GumAddressSpec * caller, gpointer return_address, gpointer target, - gboolean dedicated); -void gum_code_deflector_free (GumCodeDeflector * deflector); - -#endif -/* - * Copyright (C) 2016-2019 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_CODE_SEGMENT_H__ -#define __GUM_CODE_SEGMENT_H__ - - -G_BEGIN_DECLS - -typedef struct _GumCodeSegment GumCodeSegment; - -GUM_API gboolean gum_code_segment_is_supported (void); - -GUM_API GumCodeSegment * gum_code_segment_new (gsize size, - const GumAddressSpec * spec); -GUM_API void gum_code_segment_free (GumCodeSegment * segment); - -GUM_API gpointer gum_code_segment_get_address (GumCodeSegment * self); -GUM_API gsize gum_code_segment_get_size (GumCodeSegment * self); -GUM_API gsize gum_code_segment_get_virtual_size (GumCodeSegment * self); - -GUM_API void gum_code_segment_realize (GumCodeSegment * self); -GUM_API void gum_code_segment_map (GumCodeSegment * self, gsize source_offset, - gsize source_size, gpointer target_address); - -GUM_API gboolean gum_code_segment_mark (gpointer code, gsize size, - GError ** error); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2015-2020 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_DARWIN_MODULE_H__ -#define __GUM_DARWIN_MODULE_H__ - - -#define GUM_DARWIN_EXPORT_SYMBOL_FLAGS_KIND_ABSOLUTE 2 - -G_BEGIN_DECLS - -#define GUM_TYPE_DARWIN_MODULE (gum_darwin_module_get_type ()) -G_DECLARE_FINAL_TYPE (GumDarwinModule, gum_darwin_module, GUM_DARWIN, MODULE, - GObject) - -#define GUM_DARWIN_PORT_NULL 0 -#define GUM_DARWIN_EXPORT_KIND_MASK 3 - -typedef guint GumDarwinModuleFiletype; -typedef gint GumDarwinCpuType; -typedef gint GumDarwinCpuSubtype; - -typedef struct _GumDarwinModuleImage GumDarwinModuleImage; - -typedef struct _GumDarwinModuleImageSegment GumDarwinModuleImageSegment; -typedef struct _GumDarwinSectionDetails GumDarwinSectionDetails; -typedef struct _GumDarwinChainedFixupsDetails GumDarwinChainedFixupsDetails; -typedef struct _GumDarwinRebaseDetails GumDarwinRebaseDetails; -typedef struct _GumDarwinBindDetails GumDarwinBindDetails; -typedef struct _GumDarwinThreadedItem GumDarwinThreadedItem; -typedef struct _GumDarwinInitPointersDetails GumDarwinInitPointersDetails; -typedef struct _GumDarwinInitOffsetsDetails GumDarwinInitOffsetsDetails; -typedef struct _GumDarwinTermPointersDetails GumDarwinTermPointersDetails; -typedef struct _GumDarwinSegment GumDarwinSegment; -typedef struct _GumDarwinExportDetails GumDarwinExportDetails; -typedef struct _GumDarwinSymbolDetails GumDarwinSymbolDetails; - -typedef guint8 GumDarwinRebaseType; -typedef guint8 GumDarwinBindType; -typedef guint8 GumDarwinThreadedItemType; -typedef gint GumDarwinBindOrdinal; -typedef guint8 GumDarwinBindSymbolFlags; -typedef guint8 GumDarwinExportSymbolKind; -typedef guint8 GumDarwinExportSymbolFlags; - -typedef guint GumDarwinPort; -typedef gint GumDarwinPageProtection; - -typedef gboolean (* GumFoundDarwinExportFunc) ( - const GumDarwinExportDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinSymbolFunc) ( - const GumDarwinSymbolDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinSectionFunc) ( - const GumDarwinSectionDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinChainedFixupsFunc) ( - const GumDarwinChainedFixupsDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinRebaseFunc) ( - const GumDarwinRebaseDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinBindFunc) ( - const GumDarwinBindDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinInitPointersFunc) ( - const GumDarwinInitPointersDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinInitOffsetsFunc) ( - const GumDarwinInitOffsetsDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinTermPointersFunc) ( - const GumDarwinTermPointersDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinDependencyFunc) (const gchar * path, - gpointer user_data); - -typedef struct _GumDyldInfoCommand GumDyldInfoCommand; -typedef struct _GumSymtabCommand GumSymtabCommand; -typedef struct _GumDysymtabCommand GumDysymtabCommand; - -typedef enum { - GUM_DARWIN_MODULE_FLAGS_NONE = 0, - GUM_DARWIN_MODULE_FLAGS_HEADER_ONLY = (1 << 0), -} GumDarwinModuleFlags; - -struct _GumDarwinModule -{ - GObject parent; - - GumDarwinModuleFiletype filetype; - gchar * name; - gchar * uuid; - - GumDarwinPort task; - gboolean is_local; - gboolean is_kernel; - GumCpuType cpu_type; - GumPtrauthSupport ptrauth_support; - gsize pointer_size; - GumAddress base_address; - gchar * source_path; - GBytes * source_blob; - GumDarwinModuleFlags flags; - - GumDarwinModuleImage * image; - - const GumDyldInfoCommand * info; - const GumSymtabCommand * symtab; - const GumDysymtabCommand * dysymtab; - - GumAddress preferred_address; - - GArray * segments; - GArray * text_ranges; - - const guint8 * rebases; - const guint8 * rebases_end; - gpointer rebases_malloc_data; - - const guint8 * binds; - const guint8 * binds_end; - gpointer binds_malloc_data; - - const guint8 * lazy_binds; - const guint8 * lazy_binds_end; - gpointer lazy_binds_malloc_data; - - const guint8 * exports; - const guint8 * exports_end; - gpointer exports_malloc_data; - - GPtrArray * dependencies; - GPtrArray * reexports; -}; - -enum _GumDarwinModuleFiletype -{ - GUM_DARWIN_MODULE_FILETYPE_OBJECT = 1, - GUM_DARWIN_MODULE_FILETYPE_EXECUTE, - GUM_DARWIN_MODULE_FILETYPE_FVMLIB, - GUM_DARWIN_MODULE_FILETYPE_CORE, - GUM_DARWIN_MODULE_FILETYPE_PRELOAD, - GUM_DARWIN_MODULE_FILETYPE_DYLIB, - GUM_DARWIN_MODULE_FILETYPE_DYLINKER, - GUM_DARWIN_MODULE_FILETYPE_BUNDLE, - GUM_DARWIN_MODULE_FILETYPE_DYLIB_STUB, - GUM_DARWIN_MODULE_FILETYPE_DSYM, - GUM_DARWIN_MODULE_FILETYPE_KEXT_BUNDLE, - GUM_DARWIN_MODULE_FILETYPE_FILESET, -}; - -enum _GumDarwinCpuArchType -{ - GUM_DARWIN_CPU_ARCH_ABI64 = 0x01000000, - GUM_DARWIN_CPU_ARCH_ABI64_32 = 0x02000000, -}; - -enum _GumDarwinCpuType -{ - GUM_DARWIN_CPU_X86 = 7, - GUM_DARWIN_CPU_X86_64 = 7 | GUM_DARWIN_CPU_ARCH_ABI64, - GUM_DARWIN_CPU_ARM = 12, - GUM_DARWIN_CPU_ARM64 = 12 | GUM_DARWIN_CPU_ARCH_ABI64, - GUM_DARWIN_CPU_ARM64_32 = 12 | GUM_DARWIN_CPU_ARCH_ABI64_32, -}; - -enum _GumDarwinCpuSubtype -{ - GUM_DARWIN_CPU_SUBTYPE_ARM64E = 2, - - GUM_DARWIN_CPU_SUBTYPE_MASK = 0x00ffffff, -}; - -struct _GumDarwinModuleImage -{ - gpointer data; - guint64 size; - gconstpointer linkedit; - - guint64 source_offset; - guint64 source_size; - guint64 shared_offset; - guint64 shared_size; - GArray * shared_segments; - - GBytes * bytes; - gpointer malloc_data; -}; - -struct _GumDarwinModuleImageSegment -{ - guint64 offset; - guint64 size; - GumDarwinPageProtection protection; -}; - -struct _GumDarwinSectionDetails -{ - gchar segment_name[17]; - gchar section_name[17]; - GumAddress vm_address; - guint64 size; - GumDarwinPageProtection protection; - guint32 file_offset; - guint32 flags; -}; - -struct _GumDarwinChainedFixupsDetails -{ - GumAddress vm_address; - guint64 file_offset; - guint32 size; -}; - -struct _GumDarwinRebaseDetails -{ - const GumDarwinSegment * segment; - guint64 offset; - GumDarwinRebaseType type; - GumAddress slide; -}; - -struct _GumDarwinBindDetails -{ - const GumDarwinSegment * segment; - guint64 offset; - GumDarwinBindType type; - GumDarwinBindOrdinal library_ordinal; - const gchar * symbol_name; - GumDarwinBindSymbolFlags symbol_flags; - gint64 addend; - guint16 threaded_table_size; -}; - -struct _GumDarwinThreadedItem -{ - gboolean is_authenticated; - GumDarwinThreadedItemType type; - guint16 delta; - guint8 key; - gboolean has_address_diversity; - guint16 diversity; - - guint16 bind_ordinal; - - GumAddress rebase_address; -}; - -struct _GumDarwinInitPointersDetails -{ - GumAddress address; - guint64 count; -}; - -struct _GumDarwinInitOffsetsDetails -{ - GumAddress address; - guint64 count; -}; - -struct _GumDarwinTermPointersDetails -{ - GumAddress address; - guint64 count; -}; - -struct _GumDarwinSegment -{ - gchar name[17]; - GumAddress vm_address; - guint64 vm_size; - guint64 file_offset; - guint64 file_size; - GumDarwinPageProtection protection; -}; - -struct _GumDarwinExportDetails -{ - const gchar * name; - guint64 flags; - - union - { - struct - { - guint64 offset; - }; - - struct - { - guint64 stub; - guint64 resolver; - }; - - struct - { - gint reexport_library_ordinal; - const gchar * reexport_symbol; - }; - }; -}; - -struct _GumDarwinSymbolDetails -{ - const gchar * name; - GumAddress address; - - /* These map 1:1 to their struct nlist / nlist_64 equivalents. */ - guint8 type; - guint8 section; - guint16 description; -}; - -enum _GumDarwinRebaseType -{ - GUM_DARWIN_REBASE_POINTER = 1, - GUM_DARWIN_REBASE_TEXT_ABSOLUTE32, - GUM_DARWIN_REBASE_TEXT_PCREL32, -}; - -enum _GumDarwinBindType -{ - GUM_DARWIN_BIND_POINTER = 1, - GUM_DARWIN_BIND_TEXT_ABSOLUTE32, - GUM_DARWIN_BIND_TEXT_PCREL32, - GUM_DARWIN_BIND_THREADED_TABLE, - GUM_DARWIN_BIND_THREADED_ITEMS, -}; - -enum _GumDarwinThreadedItemType -{ - GUM_DARWIN_THREADED_REBASE, - GUM_DARWIN_THREADED_BIND -}; - -enum _GumDarwinBindOrdinal -{ - GUM_DARWIN_BIND_SELF = 0, - GUM_DARWIN_BIND_MAIN_EXECUTABLE = -1, - GUM_DARWIN_BIND_FLAT_LOOKUP = -2, - GUM_DARWIN_BIND_WEAK_LOOKUP = -3, -}; - -enum _GumDarwinBindSymbolFlags -{ - GUM_DARWIN_BIND_WEAK_IMPORT = 0x1, - GUM_DARWIN_BIND_NON_WEAK_DEFINITION = 0x8, -}; - -enum _GumDarwinExportSymbolKind -{ - GUM_DARWIN_EXPORT_REGULAR, - GUM_DARWIN_EXPORT_THREAD_LOCAL, - GUM_DARWIN_EXPORT_ABSOLUTE -}; - -enum _GumDarwinExportSymbolFlags -{ - GUM_DARWIN_EXPORT_WEAK_DEFINITION = 0x04, - GUM_DARWIN_EXPORT_REEXPORT = 0x08, - GUM_DARWIN_EXPORT_STUB_AND_RESOLVER = 0x10, -}; - -GUM_API GumDarwinModule * gum_darwin_module_new_from_file (const gchar * path, - GumCpuType cpu_type, GumPtrauthSupport ptrauth_support, - GumDarwinModuleFlags flags, GError ** error); -GUM_API GumDarwinModule * gum_darwin_module_new_from_blob (GBytes * blob, - GumCpuType cpu_type, GumPtrauthSupport ptrauth_support, - GumDarwinModuleFlags flags, GError ** error); -GUM_API GumDarwinModule * gum_darwin_module_new_from_memory (const gchar * name, - GumDarwinPort task, GumAddress base_address, GumDarwinModuleFlags flags, - GError ** error); - -GUM_API gboolean gum_darwin_module_resolve_export (GumDarwinModule * self, - const gchar * symbol, GumDarwinExportDetails * details); -GUM_API GumAddress gum_darwin_module_resolve_symbol_address ( - GumDarwinModule * self, const gchar * symbol); -GUM_API gboolean gum_darwin_module_get_lacks_exports_for_reexports ( - GumDarwinModule * self); -GUM_API void gum_darwin_module_enumerate_imports (GumDarwinModule * self, - GumFoundImportFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_exports (GumDarwinModule * self, - GumFoundDarwinExportFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_symbols (GumDarwinModule * self, - GumFoundDarwinSymbolFunc func, gpointer user_data); -GUM_API GumAddress gum_darwin_module_get_slide (GumDarwinModule * self); -GUM_API const GumDarwinSegment * gum_darwin_module_get_nth_segment ( - GumDarwinModule * self, gsize index); -GUM_API void gum_darwin_module_enumerate_sections (GumDarwinModule * self, - GumFoundDarwinSectionFunc func, gpointer user_data); -GUM_API gboolean gum_darwin_module_is_address_in_text_section ( - GumDarwinModule * self, GumAddress address); -GUM_API void gum_darwin_module_enumerate_chained_fixups (GumDarwinModule * self, - GumFoundDarwinChainedFixupsFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_rebases (GumDarwinModule * self, - GumFoundDarwinRebaseFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_binds (GumDarwinModule * self, - GumFoundDarwinBindFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_lazy_binds (GumDarwinModule * self, - GumFoundDarwinBindFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_init_pointers (GumDarwinModule * self, - GumFoundDarwinInitPointersFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_init_offsets (GumDarwinModule * self, - GumFoundDarwinInitOffsetsFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_term_pointers (GumDarwinModule * self, - GumFoundDarwinTermPointersFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_dependencies (GumDarwinModule * self, - GumFoundDarwinDependencyFunc func, gpointer user_data); -GUM_API const gchar * gum_darwin_module_get_dependency_by_ordinal ( - GumDarwinModule * self, gint ordinal); - -GUM_API void gum_darwin_threaded_item_parse (guint64 value, - GumDarwinThreadedItem * result); - -GUM_API GumDarwinModuleImage * gum_darwin_module_image_new (void); -GUM_API GumDarwinModuleImage * gum_darwin_module_image_dup ( - const GumDarwinModuleImage * other); -GUM_API void gum_darwin_module_image_free (GumDarwinModuleImage * image); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2009 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_EVENT_H__ -#define __GUM_EVENT_H__ - - -G_BEGIN_DECLS - -typedef guint GumEventType; - -typedef union _GumEvent GumEvent; - -typedef struct _GumAnyEvent GumAnyEvent; -typedef struct _GumCallEvent GumCallEvent; -typedef struct _GumRetEvent GumRetEvent; -typedef struct _GumExecEvent GumExecEvent; -typedef struct _GumBlockEvent GumBlockEvent; -typedef struct _GumCompileEvent GumCompileEvent; - -enum _GumEventType -{ - GUM_NOTHING = 0, - GUM_CALL = 1 << 0, - GUM_RET = 1 << 1, - GUM_EXEC = 1 << 2, - GUM_BLOCK = 1 << 3, - GUM_COMPILE = 1 << 4, -}; - -struct _GumAnyEvent -{ - GumEventType type; -}; - -struct _GumCallEvent -{ - GumEventType type; - - gpointer location; - gpointer target; - gint depth; -}; - -struct _GumRetEvent -{ - GumEventType type; - - gpointer location; - gpointer target; - gint depth; -}; - -struct _GumExecEvent -{ - GumEventType type; - - gpointer location; -}; - -struct _GumBlockEvent -{ - GumEventType type; - - gpointer begin; - gpointer end; -}; - -struct _GumCompileEvent -{ - GumEventType type; - - gpointer begin; - gpointer end; -}; - -union _GumEvent -{ - GumEventType type; - - GumAnyEvent any; - GumCallEvent call; - GumRetEvent ret; - GumExecEvent exec; - GumBlockEvent block; - GumCompileEvent compile; -}; - -G_END_DECLS - -#endif -/* - * Copyright (C) 2009-2020 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_EVENT_SINK_H__ -#define __GUM_EVENT_SINK_H__ - - -G_BEGIN_DECLS - -#define GUM_TYPE_EVENT_SINK (gum_event_sink_get_type ()) -G_DECLARE_INTERFACE (GumEventSink, gum_event_sink, GUM, EVENT_SINK, GObject) - -#define GUM_TYPE_DEFAULT_EVENT_SINK (gum_default_event_sink_get_type ()) -G_DECLARE_FINAL_TYPE (GumDefaultEventSink, gum_default_event_sink, GUM, - DEFAULT_EVENT_SINK, GObject) - -struct _GumEventSinkInterface -{ - GTypeInterface parent; - - GumEventType (* query_mask) (GumEventSink * self); - void (* start) (GumEventSink * self); - void (* process) (GumEventSink * self, const GumEvent * event, - GumCpuContext * cpu_context); - void (* flush) (GumEventSink * self); - void (* stop) (GumEventSink * self); -}; - -GUM_API GumEventType gum_event_sink_query_mask (GumEventSink * self); -GUM_API void gum_event_sink_start (GumEventSink * self); -GUM_API void gum_event_sink_process (GumEventSink * self, - const GumEvent * event, GumCpuContext * cpu_context); -GUM_API void gum_event_sink_flush (GumEventSink * self); -GUM_API void gum_event_sink_stop (GumEventSink * self); - -GUM_API GumEventSink * gum_event_sink_make_default (void); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2015-2018 Ole André Vadla Ravnås - * Copyright (C) 2020 Francesco Tamagni - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_EXCEPTOR_H__ -#define __GUM_EXCEPTOR_H__ - -#include - -G_BEGIN_DECLS - -#define GUM_TYPE_EXCEPTOR (gum_exceptor_get_type ()) -G_DECLARE_FINAL_TYPE (GumExceptor, gum_exceptor, GUM, EXCEPTOR, GObject) - -#if defined (G_OS_WIN32) || defined (__APPLE__) -# define GUM_NATIVE_SETJMP(env) setjmp (env) -# define GUM_NATIVE_LONGJMP longjmp - typedef jmp_buf GumExceptorNativeJmpBuf; -#else -# define GUM_NATIVE_SETJMP(env) sigsetjmp (env, TRUE) -# define GUM_NATIVE_LONGJMP siglongjmp -# if !defined (GUM_GIR_COMPILATION) - typedef sigjmp_buf GumExceptorNativeJmpBuf; -# endif -#endif - -typedef struct _GumExceptionDetails GumExceptionDetails; -typedef guint GumExceptionType; -typedef struct _GumExceptionMemoryDetails GumExceptionMemoryDetails; -typedef gboolean (* GumExceptionHandler) (GumExceptionDetails * details, - gpointer user_data); - -typedef struct _GumExceptorScope GumExceptorScope; - -enum _GumExceptionType -{ - GUM_EXCEPTION_ABORT = 1, - GUM_EXCEPTION_ACCESS_VIOLATION, - GUM_EXCEPTION_GUARD_PAGE, - GUM_EXCEPTION_ILLEGAL_INSTRUCTION, - GUM_EXCEPTION_STACK_OVERFLOW, - GUM_EXCEPTION_ARITHMETIC, - GUM_EXCEPTION_BREAKPOINT, - GUM_EXCEPTION_SINGLE_STEP, - GUM_EXCEPTION_SYSTEM -}; - -struct _GumExceptionMemoryDetails -{ - GumMemoryOperation operation; - gpointer address; -}; - -struct _GumExceptionDetails -{ - GumThreadId thread_id; - GumExceptionType type; - gpointer address; - GumExceptionMemoryDetails memory; - GumCpuContext context; - gpointer native_context; -}; - -struct _GumExceptorScope -{ - GumExceptionDetails exception; - - /*< private */ - gboolean exception_occurred; - gpointer padding[2]; - jmp_buf env; -#ifdef __ANDROID__ - sigset_t mask; -#endif - - GumExceptorScope * next; -}; - -GUM_API GumExceptor * gum_exceptor_obtain (void); - -GUM_API void gum_exceptor_add (GumExceptor * self, GumExceptionHandler func, - gpointer user_data); -GUM_API void gum_exceptor_remove (GumExceptor * self, GumExceptionHandler func, - gpointer user_data); - -#if defined (_MSC_VER) && GLIB_SIZEOF_VOID_P == 8 -/* - * On MSVC/64-bit setjmp() is actually an intrinsic that calls _setjmp() with a - * a hidden second argument specifying the frame pointer. This makes sense when - * the longjmp() is guaranteed to happen from code we control, but is not - * reliable otherwise. - */ -# define gum_exceptor_try(self, scope) ( \ - _gum_exceptor_prepare_try (self, scope), \ - ((int (*) (jmp_buf env, void * frame_pointer)) _setjmp) ( \ - (scope)->env, NULL) == 0) -#else -# define gum_exceptor_try(self, scope) ( \ - _gum_exceptor_prepare_try (self, scope), \ - GUM_NATIVE_SETJMP ((scope)->env) == 0) -#endif -GUM_API gboolean gum_exceptor_catch (GumExceptor * self, - GumExceptorScope * scope); -GUM_API gboolean gum_exceptor_has_scope (GumExceptor * self, - GumThreadId thread_id); - -GUM_API gchar * gum_exception_details_to_string ( - const GumExceptionDetails * details); - -GUM_API void _gum_exceptor_prepare_try (GumExceptor * self, - GumExceptorScope * scope); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2009 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_FUNCTION_H__ -#define __GUM_FUNCTION_H__ - -G_BEGIN_DECLS - -typedef struct _GumFunctionDetails GumFunctionDetails; - -struct _GumFunctionDetails -{ - const gchar * name; - gpointer address; - gint num_arguments; -}; - -G_END_DECLS - -#endif -/* - * Copyright (C) 2008-2019 Ole André Vadla Ravnås - * Copyright (C) 2008 Christian Berentsen - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_INTERCEPTOR_H__ -#define __GUM_INTERCEPTOR_H__ - -/* - * Copyright (C) 2008-2018 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_INVOCATION_LISTENER_H__ -#define __GUM_INVOCATION_LISTENER_H__ - -/* - * Copyright (C) 2008-2019 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_INVOCATION_CONTEXT_H__ -#define __GUM_INVOCATION_CONTEXT_H__ - - - -#define GUM_IC_GET_THREAD_DATA(context, data_type) \ - ((data_type *) gum_invocation_context_get_listener_thread_data (context, \ - sizeof (data_type))) -#define GUM_IC_GET_FUNC_DATA(context, data_type) \ - ((data_type) gum_invocation_context_get_listener_function_data (context)) -#define GUM_IC_GET_INVOCATION_DATA(context, data_type) \ - ((data_type *) \ - gum_invocation_context_get_listener_invocation_data (context,\ - sizeof (data_type))) - -#define GUM_IC_GET_REPLACEMENT_DATA(ctx, data_type) \ - ((data_type) gum_invocation_context_get_replacement_data (ctx)) - -typedef struct _GumInvocationBackend GumInvocationBackend; -typedef struct _GumInvocationContext GumInvocationContext; -typedef guint GumPointCut; - -struct _GumInvocationBackend -{ - GumPointCut (* get_point_cut) (GumInvocationContext * context); - - GumThreadId (* get_thread_id) (GumInvocationContext * context); - guint (* get_depth) (GumInvocationContext * context); - - gpointer (* get_listener_thread_data) (GumInvocationContext * context, - gsize required_size); - gpointer (* get_listener_function_data) (GumInvocationContext * context); - gpointer (* get_listener_invocation_data) ( - GumInvocationContext * context, gsize required_size); - - gpointer (* get_replacement_data) (GumInvocationContext * context); - - gpointer state; - gpointer data; -}; - -struct _GumInvocationContext -{ - GCallback function; - GumCpuContext * cpu_context; - gint system_error; - - /*< private */ - GumInvocationBackend * backend; -}; - -enum _GumPointCut -{ - GUM_POINT_ENTER, - GUM_POINT_LEAVE -}; - -G_BEGIN_DECLS - -GUM_API GumPointCut gum_invocation_context_get_point_cut ( - GumInvocationContext * context); - -GUM_API gpointer gum_invocation_context_get_nth_argument ( - GumInvocationContext * context, guint n); -GUM_API void gum_invocation_context_replace_nth_argument ( - GumInvocationContext * context, guint n, gpointer value); -GUM_API gpointer gum_invocation_context_get_return_value ( - GumInvocationContext * context); -GUM_API void gum_invocation_context_replace_return_value ( - GumInvocationContext * context, gpointer value); - -GUM_API gpointer gum_invocation_context_get_return_address ( - GumInvocationContext * context); - -GUM_API guint gum_invocation_context_get_thread_id ( - GumInvocationContext * context); -GUM_API guint gum_invocation_context_get_depth ( - GumInvocationContext * context); - -GUM_API gpointer gum_invocation_context_get_listener_thread_data ( - GumInvocationContext * context, gsize required_size); -GUM_API gpointer gum_invocation_context_get_listener_function_data ( - GumInvocationContext * context); -GUM_API gpointer gum_invocation_context_get_listener_invocation_data ( - GumInvocationContext * context, gsize required_size); - -GUM_API gpointer gum_invocation_context_get_replacement_data ( - GumInvocationContext * context); - -G_END_DECLS - -#endif - -G_BEGIN_DECLS - -#define GUM_TYPE_INVOCATION_LISTENER (gum_invocation_listener_get_type ()) -G_DECLARE_INTERFACE (GumInvocationListener, gum_invocation_listener, GUM, - INVOCATION_LISTENER, GObject) - -struct _GumInvocationListenerInterface -{ - GTypeInterface parent; - - void (* on_enter) (GumInvocationListener * self, - GumInvocationContext * context); - void (* on_leave) (GumInvocationListener * self, - GumInvocationContext * context); -}; - -GUM_API void gum_invocation_listener_on_enter (GumInvocationListener * self, - GumInvocationContext * context); -GUM_API void gum_invocation_listener_on_leave (GumInvocationListener * self, - GumInvocationContext * context); - -G_END_DECLS - -#endif - -G_BEGIN_DECLS - -#define GUM_TYPE_INTERCEPTOR (gum_interceptor_get_type ()) -G_DECLARE_FINAL_TYPE (GumInterceptor, gum_interceptor, GUM, INTERCEPTOR, - GObject) - -typedef GArray GumInvocationStack; -typedef guint GumInvocationState; - -typedef enum -{ - GUM_ATTACH_OK = 0, - GUM_ATTACH_WRONG_SIGNATURE = -1, - GUM_ATTACH_ALREADY_ATTACHED = -2, - GUM_ATTACH_POLICY_VIOLATION = -3 -} GumAttachReturn; - -typedef enum -{ - GUM_REPLACE_OK = 0, - GUM_REPLACE_WRONG_SIGNATURE = -1, - GUM_REPLACE_ALREADY_REPLACED = -2, - GUM_REPLACE_POLICY_VIOLATION = -3 -} GumReplaceReturn; - -GUM_API GumInterceptor * gum_interceptor_obtain (void); - -GUM_API GumAttachReturn gum_interceptor_attach (GumInterceptor * self, - gpointer function_address, GumInvocationListener * listener, - gpointer listener_function_data); -GUM_API void gum_interceptor_detach (GumInterceptor * self, - GumInvocationListener * listener); - -GUM_API GumReplaceReturn gum_interceptor_replace (GumInterceptor * self, - gpointer function_address, gpointer replacement_function, - gpointer replacement_data); -GUM_API void gum_interceptor_revert (GumInterceptor * self, - gpointer function_address); - -GUM_API void gum_interceptor_begin_transaction (GumInterceptor * self); -GUM_API void gum_interceptor_end_transaction (GumInterceptor * self); -GUM_API gboolean gum_interceptor_flush (GumInterceptor * self); - -GUM_API GumInvocationContext * gum_interceptor_get_current_invocation (void); -GUM_API GumInvocationStack * gum_interceptor_get_current_stack (void); - -GUM_API void gum_interceptor_ignore_current_thread (GumInterceptor * self); -GUM_API void gum_interceptor_unignore_current_thread (GumInterceptor * self); - -GUM_API void gum_interceptor_ignore_other_threads (GumInterceptor * self); -GUM_API void gum_interceptor_unignore_other_threads (GumInterceptor * self); - -GUM_API gpointer gum_invocation_stack_translate (GumInvocationStack * self, - gpointer return_address); - -GUM_API void gum_interceptor_save (GumInvocationState * state); -GUM_API void gum_interceptor_restore (GumInvocationState * state); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2015 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_KERNEL_H__ -#define __GUM_KERNEL_H__ - - -G_BEGIN_DECLS - -typedef struct _GumKernelModuleRangeDetails GumKernelModuleRangeDetails; - -struct _GumKernelModuleRangeDetails -{ - gchar name[48]; - GumAddress address; - guint64 size; - GumPageProtection protection; -}; - -typedef gboolean (* GumFoundKernelModuleRangeFunc) ( - const GumKernelModuleRangeDetails * details, gpointer user_data); - -GUM_API gboolean gum_kernel_api_is_available (void); -GUM_API guint gum_kernel_query_page_size (void); -GUM_API GumAddress gum_kernel_alloc_n_pages (guint n_pages); -GUM_API void gum_kernel_free_pages (GumAddress mem); -GUM_API gboolean gum_kernel_try_mprotect (GumAddress address, gsize size, - GumPageProtection page_prot); -GUM_API guint8 * gum_kernel_read (GumAddress address, gsize len, - gsize * n_bytes_read); -GUM_API gboolean gum_kernel_write (GumAddress address, const guint8 * bytes, - gsize len); -GUM_API void gum_kernel_scan (const GumMemoryRange * range, - const GumMatchPattern * pattern, GumMemoryScanMatchFunc func, - gpointer user_data); -GUM_API void gum_kernel_enumerate_ranges (GumPageProtection prot, - GumFoundRangeFunc func, gpointer user_data); -GUM_API void gum_kernel_enumerate_module_ranges (const gchar * module_name, - GumPageProtection prot, GumFoundKernelModuleRangeFunc func, - gpointer user_data); -GUM_API void gum_kernel_enumerate_modules (GumFoundModuleFunc func, - gpointer user_data); -GUM_API GumAddress gum_kernel_find_base_address (void); -GUM_API void gum_kernel_set_base_address (GumAddress base); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2015 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_LIBC_H__ -#define __GUM_LIBC_H__ - - -G_BEGIN_DECLS - -G_GNUC_INTERNAL gpointer gum_memset (gpointer dst, gint c, gsize n); -G_GNUC_INTERNAL gpointer gum_memcpy (gpointer dst, gconstpointer src, gsize n); -G_GNUC_INTERNAL gpointer gum_memmove (gpointer dst, gconstpointer src, gsize n); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2010-2018 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_MEMORY_ACCESS_MONITOR_H__ -#define __GUM_MEMORY_ACCESS_MONITOR_H__ - - -G_BEGIN_DECLS - -#define GUM_TYPE_MEMORY_ACCESS_MONITOR (gum_memory_access_monitor_get_type ()) -G_DECLARE_FINAL_TYPE (GumMemoryAccessMonitor, gum_memory_access_monitor, GUM, - MEMORY_ACCESS_MONITOR, GObject) - -typedef struct _GumMemoryAccessDetails GumMemoryAccessDetails; - -typedef void (* GumMemoryAccessNotify) (GumMemoryAccessMonitor * monitor, - const GumMemoryAccessDetails * details, gpointer user_data); - -struct _GumMemoryAccessDetails -{ - GumMemoryOperation operation; - gpointer from; - gpointer address; - - guint range_index; - guint page_index; - guint pages_completed; - guint pages_total; -}; - -GUM_API GumMemoryAccessMonitor * gum_memory_access_monitor_new ( - const GumMemoryRange * ranges, guint num_ranges, - GumPageProtection access_mask, gboolean auto_reset, - GumMemoryAccessNotify func, gpointer data, - GDestroyNotify data_destroy); - -GUM_API gboolean gum_memory_access_monitor_enable ( - GumMemoryAccessMonitor * self, GError ** error); -GUM_API void gum_memory_access_monitor_disable (GumMemoryAccessMonitor * self); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2013-2018 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_MEMORY_MAP_H__ -#define __GUM_MEMORY_MAP_H__ - - -G_BEGIN_DECLS - -#define GUM_TYPE_MEMORY_MAP (gum_memory_map_get_type ()) -G_DECLARE_FINAL_TYPE (GumMemoryMap, gum_memory_map, GUM, MEMORY_MAP, GObject) - -GUM_API GumMemoryMap * gum_memory_map_new (GumPageProtection prot); - -GUM_API gboolean gum_memory_map_contains (GumMemoryMap * self, - const GumMemoryRange * range); - -GUM_API void gum_memory_map_update (GumMemoryMap * self); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2017-2019 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_METAL_ARRAY_H__ -#define __GUM_METAL_ARRAY_H__ - - -typedef struct _GumMetalArray GumMetalArray; - -struct _GumMetalArray -{ - gpointer data; - guint length; - guint capacity; - - guint element_size; -}; - -G_BEGIN_DECLS - -GUM_API void gum_metal_array_init (GumMetalArray * array, guint element_size); -GUM_API void gum_metal_array_free (GumMetalArray * array); - -GUM_API gpointer gum_metal_array_element_at (GumMetalArray * self, - guint index_); -GUM_API gpointer gum_metal_array_insert_at (GumMetalArray * self, guint index_); -GUM_API void gum_metal_array_remove_at (GumMetalArray * self, guint index_); -GUM_API void gum_metal_array_remove_all (GumMetalArray * self); -GUM_API gpointer gum_metal_array_append (GumMetalArray * self); - -GUM_API void gum_metal_array_get_extents (GumMetalArray * self, - gpointer * start, gpointer * end); -GUM_API void gum_metal_array_ensure_capacity (GumMetalArray * self, - guint capacity); - -G_END_DECLS - -#endif -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __GUM_METAL_HASH_H__ -#define __GUM_METAL_HASH_H__ - - -G_BEGIN_DECLS - -typedef struct _GumMetalHashTable GumMetalHashTable; -typedef struct _GumMetalHashTableIter GumMetalHashTableIter; - -struct _GumMetalHashTableIter -{ - gpointer dummy1; - gpointer dummy2; - gpointer dummy3; - int dummy4; - gboolean dummy5; - gpointer dummy6; -}; - -GUM_API GumMetalHashTable * gum_metal_hash_table_new (GHashFunc hash_func, - GEqualFunc key_equal_func); -GUM_API GumMetalHashTable * gum_metal_hash_table_new_full (GHashFunc hash_func, - GEqualFunc key_equal_func, GDestroyNotify key_destroy_func, - GDestroyNotify value_destroy_func); -GUM_API void gum_metal_hash_table_destroy (GumMetalHashTable * hash_table); -GUM_API gboolean gum_metal_hash_table_insert (GumMetalHashTable * hash_table, - gpointer key, gpointer value); -GUM_API gboolean gum_metal_hash_table_replace (GumMetalHashTable * hash_table, - gpointer key, gpointer value); -GUM_API gboolean gum_metal_hash_table_add (GumMetalHashTable * hash_table, - gpointer key); -GUM_API gboolean gum_metal_hash_table_remove (GumMetalHashTable * hash_table, - gconstpointer key); -GUM_API void gum_metal_hash_table_remove_all (GumMetalHashTable * hash_table); -GUM_API gboolean gum_metal_hash_table_steal (GumMetalHashTable * hash_table, - gconstpointer key); -GUM_API void gum_metal_hash_table_steal_all (GumMetalHashTable * hash_table); -GUM_API gpointer gum_metal_hash_table_lookup (GumMetalHashTable * hash_table, - gconstpointer key); -GUM_API gboolean gum_metal_hash_table_contains (GumMetalHashTable * hash_table, - gconstpointer key); -GUM_API gboolean gum_metal_hash_table_lookup_extended ( - GumMetalHashTable * hash_table, gconstpointer lookup_key, - gpointer * orig_key, gpointer * value); -GUM_API void gum_metal_hash_table_foreach (GumMetalHashTable * hash_table, - GHFunc func, gpointer user_data); -GUM_API gpointer gum_metal_hash_table_find (GumMetalHashTable * hash_table, - GHRFunc predicate, gpointer user_data); -GUM_API guint gum_metal_hash_table_foreach_remove ( - GumMetalHashTable * hash_table, GHRFunc func, gpointer user_data); -GUM_API guint gum_metal_hash_table_foreach_steal (GumMetalHashTable * hash_table, - GHRFunc func, gpointer user_data); -GUM_API guint gum_metal_hash_table_size (GumMetalHashTable * hash_table); - -GUM_API void gum_metal_hash_table_iter_init (GumMetalHashTableIter * iter, - GumMetalHashTable * hash_table); -GUM_API gboolean gum_metal_hash_table_iter_next (GumMetalHashTableIter * iter, - gpointer * key, gpointer * value); -GUM_API GumMetalHashTable* gum_metal_hash_table_iter_get_hash_table ( - GumMetalHashTableIter * iter); -GUM_API void gum_metal_hash_table_iter_remove (GumMetalHashTableIter * iter); -GUM_API void gum_metal_hash_table_iter_replace (GumMetalHashTableIter * iter, - gpointer value); -GUM_API void gum_metal_hash_table_iter_steal (GumMetalHashTableIter * iter); - -GUM_API GumMetalHashTable * gum_metal_hash_table_ref ( - GumMetalHashTable * hash_table); -GUM_API void gum_metal_hash_table_unref (GumMetalHashTable * hash_table); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2016 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_MODULE_API_RESOLVER_H__ -#define __GUM_MODULE_API_RESOLVER_H__ - - -G_BEGIN_DECLS - -#define GUM_TYPE_MODULE_API_RESOLVER (gum_module_api_resolver_get_type ()) -G_DECLARE_FINAL_TYPE (GumModuleApiResolver, gum_module_api_resolver, GUM, - MODULE_API_RESOLVER, GObject) - -GUM_API GumApiResolver * gum_module_api_resolver_new (void); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2015-2017 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_MODULE_MAP_H__ -#define __GUM_MODULE_MAP_H__ - - -G_BEGIN_DECLS - -#define GUM_TYPE_MODULE_MAP (gum_module_map_get_type ()) -G_DECLARE_FINAL_TYPE (GumModuleMap, gum_module_map, GUM, MODULE_MAP, GObject) - -typedef gboolean (* GumModuleMapFilterFunc) (const GumModuleDetails * details, - gpointer user_data); - -GUM_API GumModuleMap * gum_module_map_new (void); -GUM_API GumModuleMap * gum_module_map_new_filtered (GumModuleMapFilterFunc func, - gpointer data, GDestroyNotify data_destroy); - -GUM_API const GumModuleDetails * gum_module_map_find (GumModuleMap * self, - GumAddress address); - -GUM_API void gum_module_map_update (GumModuleMap * self); - -GUM_API GArray * gum_module_map_get_values (GumModuleMap * self); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2014 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_PRINTF_H__ -#define __GUM_PRINTF_H__ - - -G_BEGIN_DECLS - -gint gum_vsnprintf (gchar * str, gsize size, const gchar * format, - va_list args); -gint gum_snprintf (gchar * str, gsize size, const gchar * format, ...); -gint gum_vasprintf (gchar ** ret, const gchar * format, va_list ap); -gint gum_asprintf (gchar ** ret, const gchar * format, ...); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2010-2019 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_SPINLOCK_H__ -#define __GUM_SPINLOCK_H__ - - -#define GUM_SPINLOCK_INIT { NULL } - -G_BEGIN_DECLS - -typedef struct _GumSpinlock GumSpinlock; - -struct _GumSpinlock -{ - gpointer data; -}; - -void gum_spinlock_init (GumSpinlock * spinlock); - -void gum_spinlock_acquire (GumSpinlock * spinlock); -void gum_spinlock_release (GumSpinlock * spinlock); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2009-2018 Ole André Vadla Ravnås - * Copyright (C) 2010 Karl Trygve Kalleberg - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_STALKER_H__ -#define __GUM_STALKER_H__ - -#ifndef CAPSTONE_ENGINE_H -#define CAPSTONE_ENGINE_H - -/* Capstone Disassembly Engine */ -/* By Nguyen Anh Quynh , 2013-2016 */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#if defined(CAPSTONE_HAS_OSXKERNEL) -#include -#else -#include -#include -#endif - -/* Capstone Disassembly Engine */ -/* By Axel Souchet & Nguyen Anh Quynh, 2014 */ - -#ifndef CAPSTONE_PLATFORM_H -#define CAPSTONE_PLATFORM_H - - -// handle C99 issue (for pre-2013 VisualStudio) -#if !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__) && (defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64)) -// MSVC - -// stdbool.h -#if (_MSC_VER < 1800) || defined(_KERNEL_MODE) -// this system does not have stdbool.h -#ifndef __cplusplus -typedef unsigned char bool; -#define false 0 -#define true 1 -#endif // __cplusplus - -#else -// VisualStudio 2013+ -> C99 is supported -#include -#endif // (_MSC_VER < 1800) || defined(_KERNEL_MODE) - -#else -// not MSVC -> C99 is supported -#include -#endif // !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__) && (defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64)) - - -// handle inttypes.h / stdint.h compatibility -#if defined(_WIN32_WCE) && (_WIN32_WCE < 0x800) -#include "windowsce/stdint.h" -#endif // defined(_WIN32_WCE) && (_WIN32_WCE < 0x800) - -#if defined(CAPSTONE_HAS_OSXKERNEL) || (defined(_MSC_VER) && (_MSC_VER <= 1700 || defined(_KERNEL_MODE))) -// this system does not have inttypes.h - -#if defined(_MSC_VER) && (_MSC_VER <= 1600 || defined(_KERNEL_MODE)) -// this system does not have stdint.h -typedef signed char int8_t; -typedef signed short int16_t; -typedef signed int int32_t; -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -typedef signed long long int64_t; -typedef unsigned long long uint64_t; -#endif // defined(_MSC_VER) && (_MSC_VER <= 1600 || defined(_KERNEL_MODE)) - -#if defined(_MSC_VER) && (_MSC_VER < 1600 || defined(_KERNEL_MODE)) -#define INT8_MIN (-127i8 - 1) -#define INT16_MIN (-32767i16 - 1) -#define INT32_MIN (-2147483647i32 - 1) -#define INT64_MIN (-9223372036854775807i64 - 1) -#define INT8_MAX 127i8 -#define INT16_MAX 32767i16 -#define INT32_MAX 2147483647i32 -#define INT64_MAX 9223372036854775807i64 -#define UINT8_MAX 0xffui8 -#define UINT16_MAX 0xffffui16 -#define UINT32_MAX 0xffffffffui32 -#define UINT64_MAX 0xffffffffffffffffui64 -#endif // defined(_MSC_VER) && (_MSC_VER < 1600 || defined(_KERNEL_MODE)) - -#ifdef CAPSTONE_HAS_OSXKERNEL -// this system has stdint.h -#include -#endif - -#define __PRI_8_LENGTH_MODIFIER__ "hh" -#define __PRI_64_LENGTH_MODIFIER__ "ll" - -#define PRId8 __PRI_8_LENGTH_MODIFIER__ "d" -#define PRIi8 __PRI_8_LENGTH_MODIFIER__ "i" -#define PRIo8 __PRI_8_LENGTH_MODIFIER__ "o" -#define PRIu8 __PRI_8_LENGTH_MODIFIER__ "u" -#define PRIx8 __PRI_8_LENGTH_MODIFIER__ "x" -#define PRIX8 __PRI_8_LENGTH_MODIFIER__ "X" - -#define PRId16 "hd" -#define PRIi16 "hi" -#define PRIo16 "ho" -#define PRIu16 "hu" -#define PRIx16 "hx" -#define PRIX16 "hX" - -#if defined(_MSC_VER) && _MSC_VER <= 1700 -#define PRId32 "ld" -#define PRIi32 "li" -#define PRIo32 "lo" -#define PRIu32 "lu" -#define PRIx32 "lx" -#define PRIX32 "lX" -#else // OSX -#define PRId32 "d" -#define PRIi32 "i" -#define PRIo32 "o" -#define PRIu32 "u" -#define PRIx32 "x" -#define PRIX32 "X" -#endif // defined(_MSC_VER) && _MSC_VER <= 1700 - -#if defined(_MSC_VER) && _MSC_VER <= 1700 -// redefine functions from inttypes.h used in cstool -#define strtoull _strtoui64 -#endif - -#define PRId64 __PRI_64_LENGTH_MODIFIER__ "d" -#define PRIi64 __PRI_64_LENGTH_MODIFIER__ "i" -#define PRIo64 __PRI_64_LENGTH_MODIFIER__ "o" -#define PRIu64 __PRI_64_LENGTH_MODIFIER__ "u" -#define PRIx64 __PRI_64_LENGTH_MODIFIER__ "x" -#define PRIX64 __PRI_64_LENGTH_MODIFIER__ "X" - -#else -// this system has inttypes.h by default -#include -#endif // defined(CAPSTONE_HAS_OSXKERNEL) || (defined(_MSC_VER) && (_MSC_VER <= 1700 || defined(_KERNEL_MODE))) - -#endif - -#ifdef _MSC_VER -#pragma warning(disable:4201) -#pragma warning(disable:4100) -#define CAPSTONE_API __cdecl -#ifdef CAPSTONE_SHARED -#define CAPSTONE_EXPORT __declspec(dllexport) -#else // defined(CAPSTONE_STATIC) -#define CAPSTONE_EXPORT -#endif -#else -#define CAPSTONE_API -#if (defined(__GNUC__) || defined(__IBMC__)) && !defined(CAPSTONE_STATIC) -#define CAPSTONE_EXPORT __attribute__((visibility("default"))) -#else // defined(CAPSTONE_STATIC) -#define CAPSTONE_EXPORT -#endif -#endif - -#if (defined(__GNUC__) || defined(__IBMC__)) -#define CAPSTONE_DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) -#define CAPSTONE_DEPRECATED __declspec(deprecated) -#else -#pragma message("WARNING: You need to implement CAPSTONE_DEPRECATED for this compiler") -#define CAPSTONE_DEPRECATED -#endif - -// Capstone API version -#define CS_API_MAJOR 5 -#define CS_API_MINOR 0 - -// Version for bleeding edge code of the Github's "next" branch. -// Use this if you want the absolutely latest development code. -// This version number will be bumped up whenever we have a new major change. -#define CS_NEXT_VERSION 5 - -// Capstone package version -#define CS_VERSION_MAJOR CS_API_MAJOR -#define CS_VERSION_MINOR CS_API_MINOR -#define CS_VERSION_EXTRA 0 - -/// Macro to create combined version which can be compared to -/// result of cs_version() API. -#define CS_MAKE_VERSION(major, minor) ((major << 8) + minor) - -/// Maximum size of an instruction mnemonic string. -#define CS_MNEMONIC_SIZE 32 - -// Handle using with all API -typedef size_t csh; - -/// Architecture type -typedef enum cs_arch { - CS_ARCH_ARM = 0, ///< ARM architecture (including Thumb, Thumb-2) - CS_ARCH_ARM64, ///< ARM-64, also called AArch64 - CS_ARCH_MIPS, ///< Mips architecture - CS_ARCH_X86, ///< X86 architecture (including x86 & x86-64) - CS_ARCH_PPC, ///< PowerPC architecture - CS_ARCH_SPARC, ///< Sparc architecture - CS_ARCH_SYSZ, ///< SystemZ architecture - CS_ARCH_XCORE, ///< XCore architecture - CS_ARCH_M68K, ///< 68K architecture - CS_ARCH_TMS320C64X, ///< TMS320C64x architecture - CS_ARCH_M680X, ///< 680X architecture - CS_ARCH_EVM, ///< Ethereum architecture - CS_ARCH_MOS65XX, ///< MOS65XX architecture (including MOS6502) - CS_ARCH_WASM, ///< WebAssembly architecture - CS_ARCH_BPF, ///< Berkeley Packet Filter architecture (including eBPF) - CS_ARCH_RISCV, ///< RISCV architecture - CS_ARCH_MAX, - CS_ARCH_ALL = 0xFFFF, // All architectures - for cs_support() -} cs_arch; - -// Support value to verify diet mode of the engine. -// If cs_support(CS_SUPPORT_DIET) return True, the engine was compiled -// in diet mode. -#define CS_SUPPORT_DIET (CS_ARCH_ALL + 1) - -// Support value to verify X86 reduce mode of the engine. -// If cs_support(CS_SUPPORT_X86_REDUCE) return True, the engine was compiled -// in X86 reduce mode. -#define CS_SUPPORT_X86_REDUCE (CS_ARCH_ALL + 2) - -/// Mode type -typedef enum cs_mode { - CS_MODE_LITTLE_ENDIAN = 0, ///< little-endian mode (default mode) - CS_MODE_ARM = 0, ///< 32-bit ARM - CS_MODE_16 = 1 << 1, ///< 16-bit mode (X86) - CS_MODE_32 = 1 << 2, ///< 32-bit mode (X86) - CS_MODE_64 = 1 << 3, ///< 64-bit mode (X86, PPC) - CS_MODE_THUMB = 1 << 4, ///< ARM's Thumb mode, including Thumb-2 - CS_MODE_MCLASS = 1 << 5, ///< ARM's Cortex-M series - CS_MODE_V8 = 1 << 6, ///< ARMv8 A32 encodings for ARM - CS_MODE_MICRO = 1 << 4, ///< MicroMips mode (MIPS) - CS_MODE_MIPS3 = 1 << 5, ///< Mips III ISA - CS_MODE_MIPS32R6 = 1 << 6, ///< Mips32r6 ISA - CS_MODE_MIPS2 = 1 << 7, ///< Mips II ISA - CS_MODE_V9 = 1 << 4, ///< SparcV9 mode (Sparc) - CS_MODE_QPX = 1 << 4, ///< Quad Processing eXtensions mode (PPC) - CS_MODE_SPE = 1 << 5, ///< Signal Processing Engine mode (PPC) - CS_MODE_BOOKE = 1 << 6, ///< Book-E mode (PPC) - CS_MODE_M68K_000 = 1 << 1, ///< M68K 68000 mode - CS_MODE_M68K_010 = 1 << 2, ///< M68K 68010 mode - CS_MODE_M68K_020 = 1 << 3, ///< M68K 68020 mode - CS_MODE_M68K_030 = 1 << 4, ///< M68K 68030 mode - CS_MODE_M68K_040 = 1 << 5, ///< M68K 68040 mode - CS_MODE_M68K_060 = 1 << 6, ///< M68K 68060 mode - CS_MODE_BIG_ENDIAN = 1U << 31, ///< big-endian mode - CS_MODE_MIPS32 = CS_MODE_32, ///< Mips32 ISA (Mips) - CS_MODE_MIPS64 = CS_MODE_64, ///< Mips64 ISA (Mips) - CS_MODE_M680X_6301 = 1 << 1, ///< M680X Hitachi 6301,6303 mode - CS_MODE_M680X_6309 = 1 << 2, ///< M680X Hitachi 6309 mode - CS_MODE_M680X_6800 = 1 << 3, ///< M680X Motorola 6800,6802 mode - CS_MODE_M680X_6801 = 1 << 4, ///< M680X Motorola 6801,6803 mode - CS_MODE_M680X_6805 = 1 << 5, ///< M680X Motorola/Freescale 6805 mode - CS_MODE_M680X_6808 = 1 << 6, ///< M680X Motorola/Freescale/NXP 68HC08 mode - CS_MODE_M680X_6809 = 1 << 7, ///< M680X Motorola 6809 mode - CS_MODE_M680X_6811 = 1 << 8, ///< M680X Motorola/Freescale/NXP 68HC11 mode - CS_MODE_M680X_CPU12 = 1 << 9, ///< M680X Motorola/Freescale/NXP CPU12 - ///< used on M68HC12/HCS12 - CS_MODE_M680X_HCS08 = 1 << 10, ///< M680X Freescale/NXP HCS08 mode - CS_MODE_BPF_CLASSIC = 0, ///< Classic BPF mode (default) - CS_MODE_BPF_EXTENDED = 1 << 0, ///< Extended BPF mode - CS_MODE_RISCV32 = 1 << 0, ///< RISCV RV32G - CS_MODE_RISCV64 = 1 << 1, ///< RISCV RV64G - CS_MODE_RISCVC = 1 << 2, ///< RISCV compressed instructure mode - CS_MODE_MOS65XX_6502 = 1 << 1, ///< MOS65XXX MOS 6502 - CS_MODE_MOS65XX_65C02 = 1 << 2, ///< MOS65XXX WDC 65c02 - CS_MODE_MOS65XX_W65C02 = 1 << 3, ///< MOS65XXX WDC W65c02 - CS_MODE_MOS65XX_65816 = 1 << 4, ///< MOS65XXX WDC 65816, 8-bit m/x - CS_MODE_MOS65XX_65816_LONG_M = (1 << 5), ///< MOS65XXX WDC 65816, 16-bit m, 8-bit x - CS_MODE_MOS65XX_65816_LONG_X = (1 << 6), ///< MOS65XXX WDC 65816, 8-bit m, 16-bit x - CS_MODE_MOS65XX_65816_LONG_MX = CS_MODE_MOS65XX_65816_LONG_M | CS_MODE_MOS65XX_65816_LONG_X, -} cs_mode; - -typedef void* (CAPSTONE_API *cs_malloc_t)(size_t size); -typedef void* (CAPSTONE_API *cs_calloc_t)(size_t nmemb, size_t size); -typedef void* (CAPSTONE_API *cs_realloc_t)(void *ptr, size_t size); -typedef void (CAPSTONE_API *cs_free_t)(void *ptr); -typedef int (CAPSTONE_API *cs_vsnprintf_t)(char *str, size_t size, const char *format, va_list ap); - - -/// User-defined dynamic memory related functions: malloc/calloc/realloc/free/vsnprintf() -/// By default, Capstone uses system's malloc(), calloc(), realloc(), free() & vsnprintf(). -typedef struct cs_opt_mem { - cs_malloc_t malloc; - cs_calloc_t calloc; - cs_realloc_t realloc; - cs_free_t free; - cs_vsnprintf_t vsnprintf; -} cs_opt_mem; - -/// Customize mnemonic for instructions with alternative name. -/// To reset existing customized instruction to its default mnemonic, -/// call cs_option(CS_OPT_MNEMONIC) again with the same @id and NULL value -/// for @mnemonic. -typedef struct cs_opt_mnem { - /// ID of instruction to be customized. - unsigned int id; - /// Customized instruction mnemonic. - const char *mnemonic; -} cs_opt_mnem; - -/// Runtime option for the disassembled engine -typedef enum cs_opt_type { - CS_OPT_INVALID = 0, ///< No option specified - CS_OPT_SYNTAX, ///< Assembly output syntax - CS_OPT_DETAIL, ///< Break down instruction structure into details - CS_OPT_MODE, ///< Change engine's mode at run-time - CS_OPT_MEM, ///< User-defined dynamic memory related functions - CS_OPT_SKIPDATA, ///< Skip data when disassembling. Then engine is in SKIPDATA mode. - CS_OPT_SKIPDATA_SETUP, ///< Setup user-defined function for SKIPDATA option - CS_OPT_MNEMONIC, ///< Customize instruction mnemonic - CS_OPT_UNSIGNED, ///< print immediate operands in unsigned form -} cs_opt_type; - -/// Runtime option value (associated with option type above) -typedef enum cs_opt_value { - CS_OPT_OFF = 0, ///< Turn OFF an option - default for CS_OPT_DETAIL, CS_OPT_SKIPDATA, CS_OPT_UNSIGNED. - CS_OPT_ON = 3, ///< Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA). - CS_OPT_SYNTAX_DEFAULT = 0, ///< Default asm syntax (CS_OPT_SYNTAX). - CS_OPT_SYNTAX_INTEL, ///< X86 Intel asm syntax - default on X86 (CS_OPT_SYNTAX). - CS_OPT_SYNTAX_ATT, ///< X86 ATT asm syntax (CS_OPT_SYNTAX). - CS_OPT_SYNTAX_NOREGNAME, ///< Prints register name with only number (CS_OPT_SYNTAX) - CS_OPT_SYNTAX_MASM, ///< X86 Intel Masm syntax (CS_OPT_SYNTAX). - CS_OPT_SYNTAX_MOTOROLA, ///< MOS65XX use $ as hex prefix -} cs_opt_value; - -/// Common instruction operand types - to be consistent across all architectures. -typedef enum cs_op_type { - CS_OP_INVALID = 0, ///< uninitialized/invalid operand. - CS_OP_REG, ///< Register operand. - CS_OP_IMM, ///< Immediate operand. - CS_OP_MEM, ///< Memory operand. - CS_OP_FP, ///< Floating-Point operand. -} cs_op_type; - -/// Common instruction operand access types - to be consistent across all architectures. -/// It is possible to combine access types, for example: CS_AC_READ | CS_AC_WRITE -typedef enum cs_ac_type { - CS_AC_INVALID = 0, ///< Uninitialized/invalid access type. - CS_AC_READ = 1 << 0, ///< Operand read from memory or register. - CS_AC_WRITE = 1 << 1, ///< Operand write to memory or register. -} cs_ac_type; - -/// Common instruction groups - to be consistent across all architectures. -typedef enum cs_group_type { - CS_GRP_INVALID = 0, ///< uninitialized/invalid group. - CS_GRP_JUMP, ///< all jump instructions (conditional+direct+indirect jumps) - CS_GRP_CALL, ///< all call instructions - CS_GRP_RET, ///< all return instructions - CS_GRP_INT, ///< all interrupt instructions (int+syscall) - CS_GRP_IRET, ///< all interrupt return instructions - CS_GRP_PRIVILEGE, ///< all privileged instructions - CS_GRP_BRANCH_RELATIVE, ///< all relative branching instructions -} cs_group_type; - -/** - User-defined callback function for SKIPDATA option. - See tests/test_skipdata.c for sample code demonstrating this API. - - @code: the input buffer containing code to be disassembled. - This is the same buffer passed to cs_disasm(). - @code_size: size (in bytes) of the above @code buffer. - @offset: the position of the currently-examining byte in the input - buffer @code mentioned above. - @user_data: user-data passed to cs_option() via @user_data field in - cs_opt_skipdata struct below. - - @return: return number of bytes to skip, or 0 to immediately stop disassembling. -*/ -typedef size_t (CAPSTONE_API *cs_skipdata_cb_t)(const uint8_t *code, size_t code_size, size_t offset, void *user_data); - -/// User-customized setup for SKIPDATA option -typedef struct cs_opt_skipdata { - /// Capstone considers data to skip as special "instructions". - /// User can specify the string for this instruction's "mnemonic" here. - /// By default (if @mnemonic is NULL), Capstone use ".byte". - const char *mnemonic; - - /// User-defined callback function to be called when Capstone hits data. - /// If the returned value from this callback is positive (>0), Capstone - /// will skip exactly that number of bytes & continue. Otherwise, if - /// the callback returns 0, Capstone stops disassembling and returns - /// immediately from cs_disasm() - /// NOTE: if this callback pointer is NULL, Capstone would skip a number - /// of bytes depending on architectures, as following: - /// Arm: 2 bytes (Thumb mode) or 4 bytes. - /// Arm64: 4 bytes. - /// Mips: 4 bytes. - /// M680x: 1 byte. - /// PowerPC: 4 bytes. - /// Sparc: 4 bytes. - /// SystemZ: 2 bytes. - /// X86: 1 bytes. - /// XCore: 2 bytes. - /// EVM: 1 bytes. - /// RISCV: 4 bytes. - /// WASM: 1 bytes. - /// MOS65XX: 1 bytes. - /// BPF: 8 bytes. - cs_skipdata_cb_t callback; // default value is NULL - - /// User-defined data to be passed to @callback function pointer. - void *user_data; -} cs_opt_skipdata; - - -#ifndef CAPSTONE_ARM_H -#define CAPSTONE_ARM_H - -/* Capstone Disassembly Engine */ -/* By Nguyen Anh Quynh , 2013-2015 */ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif - -/// ARM shift type -typedef enum arm_shifter { - ARM_SFT_INVALID = 0, - ARM_SFT_ASR, ///< shift with immediate const - ARM_SFT_LSL, ///< shift with immediate const - ARM_SFT_LSR, ///< shift with immediate const - ARM_SFT_ROR, ///< shift with immediate const - ARM_SFT_RRX, ///< shift with immediate const - ARM_SFT_ASR_REG, ///< shift with register - ARM_SFT_LSL_REG, ///< shift with register - ARM_SFT_LSR_REG, ///< shift with register - ARM_SFT_ROR_REG, ///< shift with register - ARM_SFT_RRX_REG, ///< shift with register -} arm_shifter; - -/// ARM condition code -typedef enum arm_cc { - ARM_CC_INVALID = 0, - ARM_CC_EQ, ///< Equal Equal - ARM_CC_NE, ///< Not equal Not equal, or unordered - ARM_CC_HS, ///< Carry set >, ==, or unordered - ARM_CC_LO, ///< Carry clear Less than - ARM_CC_MI, ///< Minus, negative Less than - ARM_CC_PL, ///< Plus, positive or zero >, ==, or unordered - ARM_CC_VS, ///< Overflow Unordered - ARM_CC_VC, ///< No overflow Not unordered - ARM_CC_HI, ///< Unsigned higher Greater than, or unordered - ARM_CC_LS, ///< Unsigned lower or same Less than or equal - ARM_CC_GE, ///< Greater than or equal Greater than or equal - ARM_CC_LT, ///< Less than Less than, or unordered - ARM_CC_GT, ///< Greater than Greater than - ARM_CC_LE, ///< Less than or equal <, ==, or unordered - ARM_CC_AL ///< Always (unconditional) Always (unconditional) -} arm_cc; - -typedef enum arm_sysreg { - /// Special registers for MSR - ARM_SYSREG_INVALID = 0, - - // SPSR* registers can be OR combined - ARM_SYSREG_SPSR_C = 1, - ARM_SYSREG_SPSR_X = 2, - ARM_SYSREG_SPSR_S = 4, - ARM_SYSREG_SPSR_F = 8, - - // CPSR* registers can be OR combined - ARM_SYSREG_CPSR_C = 16, - ARM_SYSREG_CPSR_X = 32, - ARM_SYSREG_CPSR_S = 64, - ARM_SYSREG_CPSR_F = 128, - - // independent registers - ARM_SYSREG_APSR = 256, - ARM_SYSREG_APSR_G, - ARM_SYSREG_APSR_NZCVQ, - ARM_SYSREG_APSR_NZCVQG, - - ARM_SYSREG_IAPSR, - ARM_SYSREG_IAPSR_G, - ARM_SYSREG_IAPSR_NZCVQG, - ARM_SYSREG_IAPSR_NZCVQ, - - ARM_SYSREG_EAPSR, - ARM_SYSREG_EAPSR_G, - ARM_SYSREG_EAPSR_NZCVQG, - ARM_SYSREG_EAPSR_NZCVQ, - - ARM_SYSREG_XPSR, - ARM_SYSREG_XPSR_G, - ARM_SYSREG_XPSR_NZCVQG, - ARM_SYSREG_XPSR_NZCVQ, - - ARM_SYSREG_IPSR, - ARM_SYSREG_EPSR, - ARM_SYSREG_IEPSR, - - ARM_SYSREG_MSP, - ARM_SYSREG_PSP, - ARM_SYSREG_PRIMASK, - ARM_SYSREG_BASEPRI, - ARM_SYSREG_BASEPRI_MAX, - ARM_SYSREG_FAULTMASK, - ARM_SYSREG_CONTROL, - ARM_SYSREG_MSPLIM, - ARM_SYSREG_PSPLIM, - ARM_SYSREG_MSP_NS, - ARM_SYSREG_PSP_NS, - ARM_SYSREG_MSPLIM_NS, - ARM_SYSREG_PSPLIM_NS, - ARM_SYSREG_PRIMASK_NS, - ARM_SYSREG_BASEPRI_NS, - ARM_SYSREG_FAULTMASK_NS, - ARM_SYSREG_CONTROL_NS, - ARM_SYSREG_SP_NS, - - // Banked Registers - ARM_SYSREG_R8_USR, - ARM_SYSREG_R9_USR, - ARM_SYSREG_R10_USR, - ARM_SYSREG_R11_USR, - ARM_SYSREG_R12_USR, - ARM_SYSREG_SP_USR, - ARM_SYSREG_LR_USR, - ARM_SYSREG_R8_FIQ, - ARM_SYSREG_R9_FIQ, - ARM_SYSREG_R10_FIQ, - ARM_SYSREG_R11_FIQ, - ARM_SYSREG_R12_FIQ, - ARM_SYSREG_SP_FIQ, - ARM_SYSREG_LR_FIQ, - ARM_SYSREG_LR_IRQ, - ARM_SYSREG_SP_IRQ, - ARM_SYSREG_LR_SVC, - ARM_SYSREG_SP_SVC, - ARM_SYSREG_LR_ABT, - ARM_SYSREG_SP_ABT, - ARM_SYSREG_LR_UND, - ARM_SYSREG_SP_UND, - ARM_SYSREG_LR_MON, - ARM_SYSREG_SP_MON, - ARM_SYSREG_ELR_HYP, - ARM_SYSREG_SP_HYP, - - ARM_SYSREG_SPSR_FIQ, - ARM_SYSREG_SPSR_IRQ, - ARM_SYSREG_SPSR_SVC, - ARM_SYSREG_SPSR_ABT, - ARM_SYSREG_SPSR_UND, - ARM_SYSREG_SPSR_MON, - ARM_SYSREG_SPSR_HYP, -} arm_sysreg; - -/// The memory barrier constants map directly to the 4-bit encoding of -/// the option field for Memory Barrier operations. -typedef enum arm_mem_barrier { - ARM_MB_INVALID = 0, - ARM_MB_RESERVED_0, - ARM_MB_OSHLD, - ARM_MB_OSHST, - ARM_MB_OSH, - ARM_MB_RESERVED_4, - ARM_MB_NSHLD, - ARM_MB_NSHST, - ARM_MB_NSH, - ARM_MB_RESERVED_8, - ARM_MB_ISHLD, - ARM_MB_ISHST, - ARM_MB_ISH, - ARM_MB_RESERVED_12, - ARM_MB_LD, - ARM_MB_ST, - ARM_MB_SY, -} arm_mem_barrier; - -/// Operand type for instruction's operands -typedef enum arm_op_type { - ARM_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - ARM_OP_REG, ///< = CS_OP_REG (Register operand). - ARM_OP_IMM, ///< = CS_OP_IMM (Immediate operand). - ARM_OP_MEM, ///< = CS_OP_MEM (Memory operand). - ARM_OP_FP, ///< = CS_OP_FP (Floating-Point operand). - ARM_OP_CIMM = 64, ///< C-Immediate (coprocessor registers) - ARM_OP_PIMM, ///< P-Immediate (coprocessor registers) - ARM_OP_SETEND, ///< operand for SETEND instruction - ARM_OP_SYSREG, ///< MSR/MRS special register operand -} arm_op_type; - -/// Operand type for SETEND instruction -typedef enum arm_setend_type { - ARM_SETEND_INVALID = 0, ///< Uninitialized. - ARM_SETEND_BE, ///< BE operand. - ARM_SETEND_LE, ///< LE operand -} arm_setend_type; - -typedef enum arm_cpsmode_type { - ARM_CPSMODE_INVALID = 0, - ARM_CPSMODE_IE = 2, - ARM_CPSMODE_ID = 3 -} arm_cpsmode_type; - -/// Operand type for SETEND instruction -typedef enum arm_cpsflag_type { - ARM_CPSFLAG_INVALID = 0, - ARM_CPSFLAG_F = 1, - ARM_CPSFLAG_I = 2, - ARM_CPSFLAG_A = 4, - ARM_CPSFLAG_NONE = 16, ///< no flag -} arm_cpsflag_type; - -/// Data type for elements of vector instructions. -typedef enum arm_vectordata_type { - ARM_VECTORDATA_INVALID = 0, - - // Integer type - ARM_VECTORDATA_I8, - ARM_VECTORDATA_I16, - ARM_VECTORDATA_I32, - ARM_VECTORDATA_I64, - - // Signed integer type - ARM_VECTORDATA_S8, - ARM_VECTORDATA_S16, - ARM_VECTORDATA_S32, - ARM_VECTORDATA_S64, - - // Unsigned integer type - ARM_VECTORDATA_U8, - ARM_VECTORDATA_U16, - ARM_VECTORDATA_U32, - ARM_VECTORDATA_U64, - - // Data type for VMUL/VMULL - ARM_VECTORDATA_P8, - - // Floating type - ARM_VECTORDATA_F16, - ARM_VECTORDATA_F32, - ARM_VECTORDATA_F64, - - // Convert float <-> float - ARM_VECTORDATA_F16F64, // f16.f64 - ARM_VECTORDATA_F64F16, // f64.f16 - ARM_VECTORDATA_F32F16, // f32.f16 - ARM_VECTORDATA_F16F32, // f32.f16 - ARM_VECTORDATA_F64F32, // f64.f32 - ARM_VECTORDATA_F32F64, // f32.f64 - - // Convert integer <-> float - ARM_VECTORDATA_S32F32, // s32.f32 - ARM_VECTORDATA_U32F32, // u32.f32 - ARM_VECTORDATA_F32S32, // f32.s32 - ARM_VECTORDATA_F32U32, // f32.u32 - ARM_VECTORDATA_F64S16, // f64.s16 - ARM_VECTORDATA_F32S16, // f32.s16 - ARM_VECTORDATA_F64S32, // f64.s32 - ARM_VECTORDATA_S16F64, // s16.f64 - ARM_VECTORDATA_S16F32, // s16.f64 - ARM_VECTORDATA_S32F64, // s32.f64 - ARM_VECTORDATA_U16F64, // u16.f64 - ARM_VECTORDATA_U16F32, // u16.f32 - ARM_VECTORDATA_U32F64, // u32.f64 - ARM_VECTORDATA_F64U16, // f64.u16 - ARM_VECTORDATA_F32U16, // f32.u16 - ARM_VECTORDATA_F64U32, // f64.u32 - ARM_VECTORDATA_F16U16, // f16.u16 - ARM_VECTORDATA_U16F16, // u16.f16 - ARM_VECTORDATA_F16U32, // f16.u32 - ARM_VECTORDATA_U32F16, // u32.f16 -} arm_vectordata_type; - -/// ARM registers -typedef enum arm_reg { - ARM_REG_INVALID = 0, - ARM_REG_APSR, - ARM_REG_APSR_NZCV, - ARM_REG_CPSR, - ARM_REG_FPEXC, - ARM_REG_FPINST, - ARM_REG_FPSCR, - ARM_REG_FPSCR_NZCV, - ARM_REG_FPSID, - ARM_REG_ITSTATE, - ARM_REG_LR, - ARM_REG_PC, - ARM_REG_SP, - ARM_REG_SPSR, - ARM_REG_D0, - ARM_REG_D1, - ARM_REG_D2, - ARM_REG_D3, - ARM_REG_D4, - ARM_REG_D5, - ARM_REG_D6, - ARM_REG_D7, - ARM_REG_D8, - ARM_REG_D9, - ARM_REG_D10, - ARM_REG_D11, - ARM_REG_D12, - ARM_REG_D13, - ARM_REG_D14, - ARM_REG_D15, - ARM_REG_D16, - ARM_REG_D17, - ARM_REG_D18, - ARM_REG_D19, - ARM_REG_D20, - ARM_REG_D21, - ARM_REG_D22, - ARM_REG_D23, - ARM_REG_D24, - ARM_REG_D25, - ARM_REG_D26, - ARM_REG_D27, - ARM_REG_D28, - ARM_REG_D29, - ARM_REG_D30, - ARM_REG_D31, - ARM_REG_FPINST2, - ARM_REG_MVFR0, - ARM_REG_MVFR1, - ARM_REG_MVFR2, - ARM_REG_Q0, - ARM_REG_Q1, - ARM_REG_Q2, - ARM_REG_Q3, - ARM_REG_Q4, - ARM_REG_Q5, - ARM_REG_Q6, - ARM_REG_Q7, - ARM_REG_Q8, - ARM_REG_Q9, - ARM_REG_Q10, - ARM_REG_Q11, - ARM_REG_Q12, - ARM_REG_Q13, - ARM_REG_Q14, - ARM_REG_Q15, - ARM_REG_R0, - ARM_REG_R1, - ARM_REG_R2, - ARM_REG_R3, - ARM_REG_R4, - ARM_REG_R5, - ARM_REG_R6, - ARM_REG_R7, - ARM_REG_R8, - ARM_REG_R9, - ARM_REG_R10, - ARM_REG_R11, - ARM_REG_R12, - ARM_REG_S0, - ARM_REG_S1, - ARM_REG_S2, - ARM_REG_S3, - ARM_REG_S4, - ARM_REG_S5, - ARM_REG_S6, - ARM_REG_S7, - ARM_REG_S8, - ARM_REG_S9, - ARM_REG_S10, - ARM_REG_S11, - ARM_REG_S12, - ARM_REG_S13, - ARM_REG_S14, - ARM_REG_S15, - ARM_REG_S16, - ARM_REG_S17, - ARM_REG_S18, - ARM_REG_S19, - ARM_REG_S20, - ARM_REG_S21, - ARM_REG_S22, - ARM_REG_S23, - ARM_REG_S24, - ARM_REG_S25, - ARM_REG_S26, - ARM_REG_S27, - ARM_REG_S28, - ARM_REG_S29, - ARM_REG_S30, - ARM_REG_S31, - - ARM_REG_ENDING, // <-- mark the end of the list or registers - - // alias registers - ARM_REG_R13 = ARM_REG_SP, - ARM_REG_R14 = ARM_REG_LR, - ARM_REG_R15 = ARM_REG_PC, - - ARM_REG_SB = ARM_REG_R9, - ARM_REG_SL = ARM_REG_R10, - ARM_REG_FP = ARM_REG_R11, - ARM_REG_IP = ARM_REG_R12, -} arm_reg; - -/// Instruction's operand referring to memory -/// This is associated with ARM_OP_MEM operand type above -typedef struct arm_op_mem { - arm_reg base; ///< base register - arm_reg index; ///< index register - int scale; ///< scale for index register (can be 1, or -1) - int disp; ///< displacement/offset value - /// left-shift on index register, or 0 if irrelevant - /// NOTE: this value can also be fetched via operand.shift.value - int lshift; -} arm_op_mem; - -/// Instruction operand -typedef struct cs_arm_op { - int vector_index; ///< Vector Index for some vector operands (or -1 if irrelevant) - - struct { - arm_shifter type; - unsigned int value; - } shift; - - arm_op_type type; ///< operand type - - union { - int reg; ///< register value for REG/SYSREG operand - int32_t imm; ///< immediate value for C-IMM, P-IMM or IMM operand - double fp; ///< floating point value for FP operand - arm_op_mem mem; ///< base/index/scale/disp value for MEM operand - arm_setend_type setend; ///< SETEND instruction's operand type - }; - - /// in some instructions, an operand can be subtracted or added to - /// the base register, - /// if TRUE, this operand is subtracted. otherwise, it is added. - bool subtracted; - - /// How is this operand accessed? (READ, WRITE or READ|WRITE) - /// This field is combined of cs_ac_type. - /// NOTE: this field is irrelevant if engine is compiled in DIET mode. - uint8_t access; - - /// Neon lane index for NEON instructions (or -1 if irrelevant) - int8_t neon_lane; -} cs_arm_op; - -/// Instruction structure -typedef struct cs_arm { - bool usermode; ///< User-mode registers to be loaded (for LDM/STM instructions) - int vector_size; ///< Scalar size for vector instructions - arm_vectordata_type vector_data; ///< Data type for elements of vector instructions - arm_cpsmode_type cps_mode; ///< CPS mode for CPS instruction - arm_cpsflag_type cps_flag; ///< CPS mode for CPS instruction - arm_cc cc; ///< conditional code for this insn - bool update_flags; ///< does this insn update flags? - bool writeback; ///< does this insn write-back? - arm_mem_barrier mem_barrier; ///< Option for some memory barrier instructions - - /// Number of operands of this instruction, - /// or 0 when instruction has no operand. - uint8_t op_count; - - cs_arm_op operands[36]; ///< operands for this instruction. -} cs_arm; - -/// ARM instruction -typedef enum arm_insn { - ARM_INS_INVALID = 0, - - ARM_INS_ADC, - ARM_INS_ADD, - ARM_INS_ADDW, - ARM_INS_ADR, - ARM_INS_AESD, - ARM_INS_AESE, - ARM_INS_AESIMC, - ARM_INS_AESMC, - ARM_INS_AND, - ARM_INS_ASR, - ARM_INS_B, - ARM_INS_BFC, - ARM_INS_BFI, - ARM_INS_BIC, - ARM_INS_BKPT, - ARM_INS_BL, - ARM_INS_BLX, - ARM_INS_BLXNS, - ARM_INS_BX, - ARM_INS_BXJ, - ARM_INS_BXNS, - ARM_INS_CBNZ, - ARM_INS_CBZ, - ARM_INS_CDP, - ARM_INS_CDP2, - ARM_INS_CLREX, - ARM_INS_CLZ, - ARM_INS_CMN, - ARM_INS_CMP, - ARM_INS_CPS, - ARM_INS_CRC32B, - ARM_INS_CRC32CB, - ARM_INS_CRC32CH, - ARM_INS_CRC32CW, - ARM_INS_CRC32H, - ARM_INS_CRC32W, - ARM_INS_CSDB, - ARM_INS_DBG, - ARM_INS_DCPS1, - ARM_INS_DCPS2, - ARM_INS_DCPS3, - ARM_INS_DFB, - ARM_INS_DMB, - ARM_INS_DSB, - ARM_INS_EOR, - ARM_INS_ERET, - ARM_INS_ESB, - ARM_INS_FADDD, - ARM_INS_FADDS, - ARM_INS_FCMPZD, - ARM_INS_FCMPZS, - ARM_INS_FCONSTD, - ARM_INS_FCONSTS, - ARM_INS_FLDMDBX, - ARM_INS_FLDMIAX, - ARM_INS_FMDHR, - ARM_INS_FMDLR, - ARM_INS_FMSTAT, - ARM_INS_FSTMDBX, - ARM_INS_FSTMIAX, - ARM_INS_FSUBD, - ARM_INS_FSUBS, - ARM_INS_HINT, - ARM_INS_HLT, - ARM_INS_HVC, - ARM_INS_ISB, - ARM_INS_IT, - ARM_INS_LDA, - ARM_INS_LDAB, - ARM_INS_LDAEX, - ARM_INS_LDAEXB, - ARM_INS_LDAEXD, - ARM_INS_LDAEXH, - ARM_INS_LDAH, - ARM_INS_LDC, - ARM_INS_LDC2, - ARM_INS_LDC2L, - ARM_INS_LDCL, - ARM_INS_LDM, - ARM_INS_LDMDA, - ARM_INS_LDMDB, - ARM_INS_LDMIB, - ARM_INS_LDR, - ARM_INS_LDRB, - ARM_INS_LDRBT, - ARM_INS_LDRD, - ARM_INS_LDREX, - ARM_INS_LDREXB, - ARM_INS_LDREXD, - ARM_INS_LDREXH, - ARM_INS_LDRH, - ARM_INS_LDRHT, - ARM_INS_LDRSB, - ARM_INS_LDRSBT, - ARM_INS_LDRSH, - ARM_INS_LDRSHT, - ARM_INS_LDRT, - ARM_INS_LSL, - ARM_INS_LSR, - ARM_INS_MCR, - ARM_INS_MCR2, - ARM_INS_MCRR, - ARM_INS_MCRR2, - ARM_INS_MLA, - ARM_INS_MLS, - ARM_INS_MOV, - ARM_INS_MOVS, - ARM_INS_MOVT, - ARM_INS_MOVW, - ARM_INS_MRC, - ARM_INS_MRC2, - ARM_INS_MRRC, - ARM_INS_MRRC2, - ARM_INS_MRS, - ARM_INS_MSR, - ARM_INS_MUL, - ARM_INS_MVN, - ARM_INS_NEG, - ARM_INS_NOP, - ARM_INS_ORN, - ARM_INS_ORR, - ARM_INS_PKHBT, - ARM_INS_PKHTB, - ARM_INS_PLD, - ARM_INS_PLDW, - ARM_INS_PLI, - ARM_INS_POP, - ARM_INS_PUSH, - ARM_INS_QADD, - ARM_INS_QADD16, - ARM_INS_QADD8, - ARM_INS_QASX, - ARM_INS_QDADD, - ARM_INS_QDSUB, - ARM_INS_QSAX, - ARM_INS_QSUB, - ARM_INS_QSUB16, - ARM_INS_QSUB8, - ARM_INS_RBIT, - ARM_INS_REV, - ARM_INS_REV16, - ARM_INS_REVSH, - ARM_INS_RFEDA, - ARM_INS_RFEDB, - ARM_INS_RFEIA, - ARM_INS_RFEIB, - ARM_INS_ROR, - ARM_INS_RRX, - ARM_INS_RSB, - ARM_INS_RSC, - ARM_INS_SADD16, - ARM_INS_SADD8, - ARM_INS_SASX, - ARM_INS_SBC, - ARM_INS_SBFX, - ARM_INS_SDIV, - ARM_INS_SEL, - ARM_INS_SETEND, - ARM_INS_SETPAN, - ARM_INS_SEV, - ARM_INS_SEVL, - ARM_INS_SG, - ARM_INS_SHA1C, - ARM_INS_SHA1H, - ARM_INS_SHA1M, - ARM_INS_SHA1P, - ARM_INS_SHA1SU0, - ARM_INS_SHA1SU1, - ARM_INS_SHA256H, - ARM_INS_SHA256H2, - ARM_INS_SHA256SU0, - ARM_INS_SHA256SU1, - ARM_INS_SHADD16, - ARM_INS_SHADD8, - ARM_INS_SHASX, - ARM_INS_SHSAX, - ARM_INS_SHSUB16, - ARM_INS_SHSUB8, - ARM_INS_SMC, - ARM_INS_SMLABB, - ARM_INS_SMLABT, - ARM_INS_SMLAD, - ARM_INS_SMLADX, - ARM_INS_SMLAL, - ARM_INS_SMLALBB, - ARM_INS_SMLALBT, - ARM_INS_SMLALD, - ARM_INS_SMLALDX, - ARM_INS_SMLALTB, - ARM_INS_SMLALTT, - ARM_INS_SMLATB, - ARM_INS_SMLATT, - ARM_INS_SMLAWB, - ARM_INS_SMLAWT, - ARM_INS_SMLSD, - ARM_INS_SMLSDX, - ARM_INS_SMLSLD, - ARM_INS_SMLSLDX, - ARM_INS_SMMLA, - ARM_INS_SMMLAR, - ARM_INS_SMMLS, - ARM_INS_SMMLSR, - ARM_INS_SMMUL, - ARM_INS_SMMULR, - ARM_INS_SMUAD, - ARM_INS_SMUADX, - ARM_INS_SMULBB, - ARM_INS_SMULBT, - ARM_INS_SMULL, - ARM_INS_SMULTB, - ARM_INS_SMULTT, - ARM_INS_SMULWB, - ARM_INS_SMULWT, - ARM_INS_SMUSD, - ARM_INS_SMUSDX, - ARM_INS_SRSDA, - ARM_INS_SRSDB, - ARM_INS_SRSIA, - ARM_INS_SRSIB, - ARM_INS_SSAT, - ARM_INS_SSAT16, - ARM_INS_SSAX, - ARM_INS_SSUB16, - ARM_INS_SSUB8, - ARM_INS_STC, - ARM_INS_STC2, - ARM_INS_STC2L, - ARM_INS_STCL, - ARM_INS_STL, - ARM_INS_STLB, - ARM_INS_STLEX, - ARM_INS_STLEXB, - ARM_INS_STLEXD, - ARM_INS_STLEXH, - ARM_INS_STLH, - ARM_INS_STM, - ARM_INS_STMDA, - ARM_INS_STMDB, - ARM_INS_STMIB, - ARM_INS_STR, - ARM_INS_STRB, - ARM_INS_STRBT, - ARM_INS_STRD, - ARM_INS_STREX, - ARM_INS_STREXB, - ARM_INS_STREXD, - ARM_INS_STREXH, - ARM_INS_STRH, - ARM_INS_STRHT, - ARM_INS_STRT, - ARM_INS_SUB, - ARM_INS_SUBS, - ARM_INS_SUBW, - ARM_INS_SVC, - ARM_INS_SWP, - ARM_INS_SWPB, - ARM_INS_SXTAB, - ARM_INS_SXTAB16, - ARM_INS_SXTAH, - ARM_INS_SXTB, - ARM_INS_SXTB16, - ARM_INS_SXTH, - ARM_INS_TBB, - ARM_INS_TBH, - ARM_INS_TEQ, - ARM_INS_TRAP, - ARM_INS_TSB, - ARM_INS_TST, - ARM_INS_TT, - ARM_INS_TTA, - ARM_INS_TTAT, - ARM_INS_TTT, - ARM_INS_UADD16, - ARM_INS_UADD8, - ARM_INS_UASX, - ARM_INS_UBFX, - ARM_INS_UDF, - ARM_INS_UDIV, - ARM_INS_UHADD16, - ARM_INS_UHADD8, - ARM_INS_UHASX, - ARM_INS_UHSAX, - ARM_INS_UHSUB16, - ARM_INS_UHSUB8, - ARM_INS_UMAAL, - ARM_INS_UMLAL, - ARM_INS_UMULL, - ARM_INS_UQADD16, - ARM_INS_UQADD8, - ARM_INS_UQASX, - ARM_INS_UQSAX, - ARM_INS_UQSUB16, - ARM_INS_UQSUB8, - ARM_INS_USAD8, - ARM_INS_USADA8, - ARM_INS_USAT, - ARM_INS_USAT16, - ARM_INS_USAX, - ARM_INS_USUB16, - ARM_INS_USUB8, - ARM_INS_UXTAB, - ARM_INS_UXTAB16, - ARM_INS_UXTAH, - ARM_INS_UXTB, - ARM_INS_UXTB16, - ARM_INS_UXTH, - ARM_INS_VABA, - ARM_INS_VABAL, - ARM_INS_VABD, - ARM_INS_VABDL, - ARM_INS_VABS, - ARM_INS_VACGE, - ARM_INS_VACGT, - ARM_INS_VACLE, - ARM_INS_VACLT, - ARM_INS_VADD, - ARM_INS_VADDHN, - ARM_INS_VADDL, - ARM_INS_VADDW, - ARM_INS_VAND, - ARM_INS_VBIC, - ARM_INS_VBIF, - ARM_INS_VBIT, - ARM_INS_VBSL, - ARM_INS_VCADD, - ARM_INS_VCEQ, - ARM_INS_VCGE, - ARM_INS_VCGT, - ARM_INS_VCLE, - ARM_INS_VCLS, - ARM_INS_VCLT, - ARM_INS_VCLZ, - ARM_INS_VCMLA, - ARM_INS_VCMP, - ARM_INS_VCMPE, - ARM_INS_VCNT, - ARM_INS_VCVT, - ARM_INS_VCVTA, - ARM_INS_VCVTB, - ARM_INS_VCVTM, - ARM_INS_VCVTN, - ARM_INS_VCVTP, - ARM_INS_VCVTR, - ARM_INS_VCVTT, - ARM_INS_VDIV, - ARM_INS_VDUP, - ARM_INS_VEOR, - ARM_INS_VEXT, - ARM_INS_VFMA, - ARM_INS_VFMS, - ARM_INS_VFNMA, - ARM_INS_VFNMS, - ARM_INS_VHADD, - ARM_INS_VHSUB, - ARM_INS_VINS, - ARM_INS_VJCVT, - ARM_INS_VLD1, - ARM_INS_VLD2, - ARM_INS_VLD3, - ARM_INS_VLD4, - ARM_INS_VLDMDB, - ARM_INS_VLDMIA, - ARM_INS_VLDR, - ARM_INS_VLLDM, - ARM_INS_VLSTM, - ARM_INS_VMAX, - ARM_INS_VMAXNM, - ARM_INS_VMIN, - ARM_INS_VMINNM, - ARM_INS_VMLA, - ARM_INS_VMLAL, - ARM_INS_VMLS, - ARM_INS_VMLSL, - ARM_INS_VMOV, - ARM_INS_VMOVL, - ARM_INS_VMOVN, - ARM_INS_VMOVX, - ARM_INS_VMRS, - ARM_INS_VMSR, - ARM_INS_VMUL, - ARM_INS_VMULL, - ARM_INS_VMVN, - ARM_INS_VNEG, - ARM_INS_VNMLA, - ARM_INS_VNMLS, - ARM_INS_VNMUL, - ARM_INS_VORN, - ARM_INS_VORR, - ARM_INS_VPADAL, - ARM_INS_VPADD, - ARM_INS_VPADDL, - ARM_INS_VPMAX, - ARM_INS_VPMIN, - ARM_INS_VPOP, - ARM_INS_VPUSH, - ARM_INS_VQABS, - ARM_INS_VQADD, - ARM_INS_VQDMLAL, - ARM_INS_VQDMLSL, - ARM_INS_VQDMULH, - ARM_INS_VQDMULL, - ARM_INS_VQMOVN, - ARM_INS_VQMOVUN, - ARM_INS_VQNEG, - ARM_INS_VQRDMLAH, - ARM_INS_VQRDMLSH, - ARM_INS_VQRDMULH, - ARM_INS_VQRSHL, - ARM_INS_VQRSHRN, - ARM_INS_VQRSHRUN, - ARM_INS_VQSHL, - ARM_INS_VQSHLU, - ARM_INS_VQSHRN, - ARM_INS_VQSHRUN, - ARM_INS_VQSUB, - ARM_INS_VRADDHN, - ARM_INS_VRECPE, - ARM_INS_VRECPS, - ARM_INS_VREV16, - ARM_INS_VREV32, - ARM_INS_VREV64, - ARM_INS_VRHADD, - ARM_INS_VRINTA, - ARM_INS_VRINTM, - ARM_INS_VRINTN, - ARM_INS_VRINTP, - ARM_INS_VRINTR, - ARM_INS_VRINTX, - ARM_INS_VRINTZ, - ARM_INS_VRSHL, - ARM_INS_VRSHR, - ARM_INS_VRSHRN, - ARM_INS_VRSQRTE, - ARM_INS_VRSQRTS, - ARM_INS_VRSRA, - ARM_INS_VRSUBHN, - ARM_INS_VSDOT, - ARM_INS_VSELEQ, - ARM_INS_VSELGE, - ARM_INS_VSELGT, - ARM_INS_VSELVS, - ARM_INS_VSHL, - ARM_INS_VSHLL, - ARM_INS_VSHR, - ARM_INS_VSHRN, - ARM_INS_VSLI, - ARM_INS_VSQRT, - ARM_INS_VSRA, - ARM_INS_VSRI, - ARM_INS_VST1, - ARM_INS_VST2, - ARM_INS_VST3, - ARM_INS_VST4, - ARM_INS_VSTMDB, - ARM_INS_VSTMIA, - ARM_INS_VSTR, - ARM_INS_VSUB, - ARM_INS_VSUBHN, - ARM_INS_VSUBL, - ARM_INS_VSUBW, - ARM_INS_VSWP, - ARM_INS_VTBL, - ARM_INS_VTBX, - ARM_INS_VTRN, - ARM_INS_VTST, - ARM_INS_VUDOT, - ARM_INS_VUZP, - ARM_INS_VZIP, - ARM_INS_WFE, - ARM_INS_WFI, - ARM_INS_YIELD, - - ARM_INS_ENDING, // <-- mark the end of the list of instructions -} arm_insn; - -/// Group of ARM instructions -typedef enum arm_insn_group { - ARM_GRP_INVALID = 0, ///< = CS_GRP_INVALID - - // Generic groups - // all jump instructions (conditional+direct+indirect jumps) - ARM_GRP_JUMP, ///< = CS_GRP_JUMP - ARM_GRP_CALL, ///< = CS_GRP_CALL - ARM_GRP_INT = 4, ///< = CS_GRP_INT - ARM_GRP_PRIVILEGE = 6, ///< = CS_GRP_PRIVILEGE - ARM_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE - - // Architecture-specific groups - ARM_GRP_CRYPTO = 128, - ARM_GRP_DATABARRIER, - ARM_GRP_DIVIDE, - ARM_GRP_FPARMV8, - ARM_GRP_MULTPRO, - ARM_GRP_NEON, - ARM_GRP_T2EXTRACTPACK, - ARM_GRP_THUMB2DSP, - ARM_GRP_TRUSTZONE, - ARM_GRP_V4T, - ARM_GRP_V5T, - ARM_GRP_V5TE, - ARM_GRP_V6, - ARM_GRP_V6T2, - ARM_GRP_V7, - ARM_GRP_V8, - ARM_GRP_VFP2, - ARM_GRP_VFP3, - ARM_GRP_VFP4, - ARM_GRP_ARM, - ARM_GRP_MCLASS, - ARM_GRP_NOTMCLASS, - ARM_GRP_THUMB, - ARM_GRP_THUMB1ONLY, - ARM_GRP_THUMB2, - ARM_GRP_PREV8, - ARM_GRP_FPVMLX, - ARM_GRP_MULOPS, - ARM_GRP_CRC, - ARM_GRP_DPVFP, - ARM_GRP_V6M, - ARM_GRP_VIRTUALIZATION, - - ARM_GRP_ENDING, -} arm_insn_group; - -#ifdef __cplusplus -} -#endif - -#endif -#ifndef CAPSTONE_ARM64_H -#define CAPSTONE_ARM64_H - -/* Capstone Disassembly Engine */ -/* By Nguyen Anh Quynh , 2013-2015 */ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif - -/// ARM64 shift type -typedef enum arm64_shifter { - ARM64_SFT_INVALID = 0, - ARM64_SFT_LSL = 1, - ARM64_SFT_MSL = 2, - ARM64_SFT_LSR = 3, - ARM64_SFT_ASR = 4, - ARM64_SFT_ROR = 5, -} arm64_shifter; - -/// ARM64 extender type -typedef enum arm64_extender { - ARM64_EXT_INVALID = 0, - ARM64_EXT_UXTB = 1, - ARM64_EXT_UXTH = 2, - ARM64_EXT_UXTW = 3, - ARM64_EXT_UXTX = 4, - ARM64_EXT_SXTB = 5, - ARM64_EXT_SXTH = 6, - ARM64_EXT_SXTW = 7, - ARM64_EXT_SXTX = 8, -} arm64_extender; - -/// ARM64 condition code -typedef enum arm64_cc { - ARM64_CC_INVALID = 0, - ARM64_CC_EQ = 1, ///< Equal - ARM64_CC_NE = 2, ///< Not equal: Not equal, or unordered - ARM64_CC_HS = 3, ///< Unsigned higher or same: >, ==, or unordered - ARM64_CC_LO = 4, ///< Unsigned lower or same: Less than - ARM64_CC_MI = 5, ///< Minus, negative: Less than - ARM64_CC_PL = 6, ///< Plus, positive or zero: >, ==, or unordered - ARM64_CC_VS = 7, ///< Overflow: Unordered - ARM64_CC_VC = 8, ///< No overflow: Ordered - ARM64_CC_HI = 9, ///< Unsigned higher: Greater than, or unordered - ARM64_CC_LS = 10, ///< Unsigned lower or same: Less than or equal - ARM64_CC_GE = 11, ///< Greater than or equal: Greater than or equal - ARM64_CC_LT = 12, ///< Less than: Less than, or unordered - ARM64_CC_GT = 13, ///< Signed greater than: Greater than - ARM64_CC_LE = 14, ///< Signed less than or equal: <, ==, or unordered - ARM64_CC_AL = 15, ///< Always (unconditional): Always (unconditional) - ARM64_CC_NV = 16, ///< Always (unconditional): Always (unconditional) - //< Note the NV exists purely to disassemble 0b1111. Execution is "always". -} arm64_cc; - -/// System registers -typedef enum arm64_sysreg { - // System registers for MRS - ARM64_SYSREG_INVALID = 0, - - ARM64_SYSREG_MDCCSR_EL0 = 0x9808, - ARM64_SYSREG_DBGDTRRX_EL0 = 0x9828, - ARM64_SYSREG_MDRAR_EL1 = 0x8080, - ARM64_SYSREG_OSLSR_EL1 = 0x808C, - ARM64_SYSREG_DBGAUTHSTATUS_EL1 = 0x83F6, - ARM64_SYSREG_PMCEID0_EL0 = 0xDCE6, - ARM64_SYSREG_PMCEID1_EL0 = 0xDCE7, - ARM64_SYSREG_MIDR_EL1 = 0xC000, - ARM64_SYSREG_CCSIDR_EL1 = 0xC800, - ARM64_SYSREG_CCSIDR2_EL1 = 0xC802, - ARM64_SYSREG_CLIDR_EL1 = 0xC801, - ARM64_SYSREG_CTR_EL0 = 0xD801, - ARM64_SYSREG_MPIDR_EL1 = 0xC005, - ARM64_SYSREG_REVIDR_EL1 = 0xC006, - ARM64_SYSREG_AIDR_EL1 = 0xC807, - ARM64_SYSREG_DCZID_EL0 = 0xD807, - ARM64_SYSREG_ID_PFR0_EL1 = 0xC008, - ARM64_SYSREG_ID_PFR1_EL1 = 0xC009, - ARM64_SYSREG_ID_DFR0_EL1 = 0xC00A, - ARM64_SYSREG_ID_AFR0_EL1 = 0xC00B, - ARM64_SYSREG_ID_MMFR0_EL1 = 0xC00C, - ARM64_SYSREG_ID_MMFR1_EL1 = 0xC00D, - ARM64_SYSREG_ID_MMFR2_EL1 = 0xC00E, - ARM64_SYSREG_ID_MMFR3_EL1 = 0xC00F, - ARM64_SYSREG_ID_ISAR0_EL1 = 0xC010, - ARM64_SYSREG_ID_ISAR1_EL1 = 0xC011, - ARM64_SYSREG_ID_ISAR2_EL1 = 0xC012, - ARM64_SYSREG_ID_ISAR3_EL1 = 0xC013, - ARM64_SYSREG_ID_ISAR4_EL1 = 0xC014, - ARM64_SYSREG_ID_ISAR5_EL1 = 0xC015, - ARM64_SYSREG_ID_ISAR6_EL1 = 0xC017, - ARM64_SYSREG_ID_AA64PFR0_EL1 = 0xC020, - ARM64_SYSREG_ID_AA64PFR1_EL1 = 0xC021, - ARM64_SYSREG_ID_AA64DFR0_EL1 = 0xC028, - ARM64_SYSREG_ID_AA64DFR1_EL1 = 0xC029, - ARM64_SYSREG_ID_AA64AFR0_EL1 = 0xC02C, - ARM64_SYSREG_ID_AA64AFR1_EL1 = 0xC02D, - ARM64_SYSREG_ID_AA64ISAR0_EL1 = 0xC030, - ARM64_SYSREG_ID_AA64ISAR1_EL1 = 0xC031, - ARM64_SYSREG_ID_AA64MMFR0_EL1 = 0xC038, - ARM64_SYSREG_ID_AA64MMFR1_EL1 = 0xC039, - ARM64_SYSREG_ID_AA64MMFR2_EL1 = 0xC03A, - ARM64_SYSREG_MVFR0_EL1 = 0xC018, - ARM64_SYSREG_MVFR1_EL1 = 0xC019, - ARM64_SYSREG_MVFR2_EL1 = 0xC01A, - ARM64_SYSREG_RVBAR_EL1 = 0xC601, - ARM64_SYSREG_RVBAR_EL2 = 0xE601, - ARM64_SYSREG_RVBAR_EL3 = 0xF601, - ARM64_SYSREG_ISR_EL1 = 0xC608, - ARM64_SYSREG_CNTPCT_EL0 = 0xDF01, - ARM64_SYSREG_CNTVCT_EL0 = 0xDF02, - ARM64_SYSREG_ID_MMFR4_EL1 = 0xC016, - ARM64_SYSREG_TRCSTATR = 0x8818, - ARM64_SYSREG_TRCIDR8 = 0x8806, - ARM64_SYSREG_TRCIDR9 = 0x880E, - ARM64_SYSREG_TRCIDR10 = 0x8816, - ARM64_SYSREG_TRCIDR11 = 0x881E, - ARM64_SYSREG_TRCIDR12 = 0x8826, - ARM64_SYSREG_TRCIDR13 = 0x882E, - ARM64_SYSREG_TRCIDR0 = 0x8847, - ARM64_SYSREG_TRCIDR1 = 0x884F, - ARM64_SYSREG_TRCIDR2 = 0x8857, - ARM64_SYSREG_TRCIDR3 = 0x885F, - ARM64_SYSREG_TRCIDR4 = 0x8867, - ARM64_SYSREG_TRCIDR5 = 0x886F, - ARM64_SYSREG_TRCIDR6 = 0x8877, - ARM64_SYSREG_TRCIDR7 = 0x887F, - ARM64_SYSREG_TRCOSLSR = 0x888C, - ARM64_SYSREG_TRCPDSR = 0x88AC, - ARM64_SYSREG_TRCDEVAFF0 = 0x8BD6, - ARM64_SYSREG_TRCDEVAFF1 = 0x8BDE, - ARM64_SYSREG_TRCLSR = 0x8BEE, - ARM64_SYSREG_TRCAUTHSTATUS = 0x8BF6, - ARM64_SYSREG_TRCDEVARCH = 0x8BFE, - ARM64_SYSREG_TRCDEVID = 0x8B97, - ARM64_SYSREG_TRCDEVTYPE = 0x8B9F, - ARM64_SYSREG_TRCPIDR4 = 0x8BA7, - ARM64_SYSREG_TRCPIDR5 = 0x8BAF, - ARM64_SYSREG_TRCPIDR6 = 0x8BB7, - ARM64_SYSREG_TRCPIDR7 = 0x8BBF, - ARM64_SYSREG_TRCPIDR0 = 0x8BC7, - ARM64_SYSREG_TRCPIDR1 = 0x8BCF, - ARM64_SYSREG_TRCPIDR2 = 0x8BD7, - ARM64_SYSREG_TRCPIDR3 = 0x8BDF, - ARM64_SYSREG_TRCCIDR0 = 0x8BE7, - ARM64_SYSREG_TRCCIDR1 = 0x8BEF, - ARM64_SYSREG_TRCCIDR2 = 0x8BF7, - ARM64_SYSREG_TRCCIDR3 = 0x8BFF, - ARM64_SYSREG_ICC_IAR1_EL1 = 0xC660, - ARM64_SYSREG_ICC_IAR0_EL1 = 0xC640, - ARM64_SYSREG_ICC_HPPIR1_EL1 = 0xC662, - ARM64_SYSREG_ICC_HPPIR0_EL1 = 0xC642, - ARM64_SYSREG_ICC_RPR_EL1 = 0xC65B, - ARM64_SYSREG_ICH_VTR_EL2 = 0xE659, - ARM64_SYSREG_ICH_EISR_EL2 = 0xE65B, - ARM64_SYSREG_ICH_ELRSR_EL2 = 0xE65D, - ARM64_SYSREG_ID_AA64ZFR0_EL1 = 0xC024, - ARM64_SYSREG_LORID_EL1 = 0xC527, - ARM64_SYSREG_ERRIDR_EL1 = 0xC298, - ARM64_SYSREG_ERXFR_EL1 = 0xC2A0, - ARM64_SYSREG_DBGDTRTX_EL0 = 0x9828, - ARM64_SYSREG_OSLAR_EL1 = 0x8084, - ARM64_SYSREG_PMSWINC_EL0 = 0xDCE4, - ARM64_SYSREG_TRCOSLAR = 0x8884, - ARM64_SYSREG_TRCLAR = 0x8BE6, - ARM64_SYSREG_ICC_EOIR1_EL1 = 0xC661, - ARM64_SYSREG_ICC_EOIR0_EL1 = 0xC641, - ARM64_SYSREG_ICC_DIR_EL1 = 0xC659, - ARM64_SYSREG_ICC_SGI1R_EL1 = 0xC65D, - ARM64_SYSREG_ICC_ASGI1R_EL1 = 0xC65E, - ARM64_SYSREG_ICC_SGI0R_EL1 = 0xC65F, - ARM64_SYSREG_OSDTRRX_EL1 = 0x8002, - ARM64_SYSREG_OSDTRTX_EL1 = 0x801A, - ARM64_SYSREG_TEECR32_EL1 = 0x9000, - ARM64_SYSREG_MDCCINT_EL1 = 0x8010, - ARM64_SYSREG_MDSCR_EL1 = 0x8012, - ARM64_SYSREG_DBGDTR_EL0 = 0x9820, - ARM64_SYSREG_OSECCR_EL1 = 0x8032, - ARM64_SYSREG_DBGVCR32_EL2 = 0xA038, - ARM64_SYSREG_DBGBVR0_EL1 = 0x8004, - ARM64_SYSREG_DBGBVR1_EL1 = 0x800C, - ARM64_SYSREG_DBGBVR2_EL1 = 0x8014, - ARM64_SYSREG_DBGBVR3_EL1 = 0x801C, - ARM64_SYSREG_DBGBVR4_EL1 = 0x8024, - ARM64_SYSREG_DBGBVR5_EL1 = 0x802C, - ARM64_SYSREG_DBGBVR6_EL1 = 0x8034, - ARM64_SYSREG_DBGBVR7_EL1 = 0x803C, - ARM64_SYSREG_DBGBVR8_EL1 = 0x8044, - ARM64_SYSREG_DBGBVR9_EL1 = 0x804C, - ARM64_SYSREG_DBGBVR10_EL1 = 0x8054, - ARM64_SYSREG_DBGBVR11_EL1 = 0x805C, - ARM64_SYSREG_DBGBVR12_EL1 = 0x8064, - ARM64_SYSREG_DBGBVR13_EL1 = 0x806C, - ARM64_SYSREG_DBGBVR14_EL1 = 0x8074, - ARM64_SYSREG_DBGBVR15_EL1 = 0x807C, - ARM64_SYSREG_DBGBCR0_EL1 = 0x8005, - ARM64_SYSREG_DBGBCR1_EL1 = 0x800D, - ARM64_SYSREG_DBGBCR2_EL1 = 0x8015, - ARM64_SYSREG_DBGBCR3_EL1 = 0x801D, - ARM64_SYSREG_DBGBCR4_EL1 = 0x8025, - ARM64_SYSREG_DBGBCR5_EL1 = 0x802D, - ARM64_SYSREG_DBGBCR6_EL1 = 0x8035, - ARM64_SYSREG_DBGBCR7_EL1 = 0x803D, - ARM64_SYSREG_DBGBCR8_EL1 = 0x8045, - ARM64_SYSREG_DBGBCR9_EL1 = 0x804D, - ARM64_SYSREG_DBGBCR10_EL1 = 0x8055, - ARM64_SYSREG_DBGBCR11_EL1 = 0x805D, - ARM64_SYSREG_DBGBCR12_EL1 = 0x8065, - ARM64_SYSREG_DBGBCR13_EL1 = 0x806D, - ARM64_SYSREG_DBGBCR14_EL1 = 0x8075, - ARM64_SYSREG_DBGBCR15_EL1 = 0x807D, - ARM64_SYSREG_DBGWVR0_EL1 = 0x8006, - ARM64_SYSREG_DBGWVR1_EL1 = 0x800E, - ARM64_SYSREG_DBGWVR2_EL1 = 0x8016, - ARM64_SYSREG_DBGWVR3_EL1 = 0x801E, - ARM64_SYSREG_DBGWVR4_EL1 = 0x8026, - ARM64_SYSREG_DBGWVR5_EL1 = 0x802E, - ARM64_SYSREG_DBGWVR6_EL1 = 0x8036, - ARM64_SYSREG_DBGWVR7_EL1 = 0x803E, - ARM64_SYSREG_DBGWVR8_EL1 = 0x8046, - ARM64_SYSREG_DBGWVR9_EL1 = 0x804E, - ARM64_SYSREG_DBGWVR10_EL1 = 0x8056, - ARM64_SYSREG_DBGWVR11_EL1 = 0x805E, - ARM64_SYSREG_DBGWVR12_EL1 = 0x8066, - ARM64_SYSREG_DBGWVR13_EL1 = 0x806E, - ARM64_SYSREG_DBGWVR14_EL1 = 0x8076, - ARM64_SYSREG_DBGWVR15_EL1 = 0x807E, - ARM64_SYSREG_DBGWCR0_EL1 = 0x8007, - ARM64_SYSREG_DBGWCR1_EL1 = 0x800F, - ARM64_SYSREG_DBGWCR2_EL1 = 0x8017, - ARM64_SYSREG_DBGWCR3_EL1 = 0x801F, - ARM64_SYSREG_DBGWCR4_EL1 = 0x8027, - ARM64_SYSREG_DBGWCR5_EL1 = 0x802F, - ARM64_SYSREG_DBGWCR6_EL1 = 0x8037, - ARM64_SYSREG_DBGWCR7_EL1 = 0x803F, - ARM64_SYSREG_DBGWCR8_EL1 = 0x8047, - ARM64_SYSREG_DBGWCR9_EL1 = 0x804F, - ARM64_SYSREG_DBGWCR10_EL1 = 0x8057, - ARM64_SYSREG_DBGWCR11_EL1 = 0x805F, - ARM64_SYSREG_DBGWCR12_EL1 = 0x8067, - ARM64_SYSREG_DBGWCR13_EL1 = 0x806F, - ARM64_SYSREG_DBGWCR14_EL1 = 0x8077, - ARM64_SYSREG_DBGWCR15_EL1 = 0x807F, - ARM64_SYSREG_TEEHBR32_EL1 = 0x9080, - ARM64_SYSREG_OSDLR_EL1 = 0x809C, - ARM64_SYSREG_DBGPRCR_EL1 = 0x80A4, - ARM64_SYSREG_DBGCLAIMSET_EL1 = 0x83C6, - ARM64_SYSREG_DBGCLAIMCLR_EL1 = 0x83CE, - ARM64_SYSREG_CSSELR_EL1 = 0xD000, - ARM64_SYSREG_VPIDR_EL2 = 0xE000, - ARM64_SYSREG_VMPIDR_EL2 = 0xE005, - ARM64_SYSREG_CPACR_EL1 = 0xC082, - ARM64_SYSREG_SCTLR_EL1 = 0xC080, - ARM64_SYSREG_SCTLR_EL2 = 0xE080, - ARM64_SYSREG_SCTLR_EL3 = 0xF080, - ARM64_SYSREG_ACTLR_EL1 = 0xC081, - ARM64_SYSREG_ACTLR_EL2 = 0xE081, - ARM64_SYSREG_ACTLR_EL3 = 0xF081, - ARM64_SYSREG_HCR_EL2 = 0xE088, - ARM64_SYSREG_SCR_EL3 = 0xF088, - ARM64_SYSREG_MDCR_EL2 = 0xE089, - ARM64_SYSREG_SDER32_EL3 = 0xF089, - ARM64_SYSREG_CPTR_EL2 = 0xE08A, - ARM64_SYSREG_CPTR_EL3 = 0xF08A, - ARM64_SYSREG_HSTR_EL2 = 0xE08B, - ARM64_SYSREG_HACR_EL2 = 0xE08F, - ARM64_SYSREG_MDCR_EL3 = 0xF099, - ARM64_SYSREG_TTBR0_EL1 = 0xC100, - ARM64_SYSREG_TTBR0_EL2 = 0xE100, - ARM64_SYSREG_TTBR0_EL3 = 0xF100, - ARM64_SYSREG_TTBR1_EL1 = 0xC101, - ARM64_SYSREG_TCR_EL1 = 0xC102, - ARM64_SYSREG_TCR_EL2 = 0xE102, - ARM64_SYSREG_TCR_EL3 = 0xF102, - ARM64_SYSREG_VTTBR_EL2 = 0xE108, - ARM64_SYSREG_VTCR_EL2 = 0xE10A, - ARM64_SYSREG_DACR32_EL2 = 0xE180, - ARM64_SYSREG_SPSR_EL1 = 0xC200, - ARM64_SYSREG_SPSR_EL2 = 0xE200, - ARM64_SYSREG_SPSR_EL3 = 0xF200, - ARM64_SYSREG_ELR_EL1 = 0xC201, - ARM64_SYSREG_ELR_EL2 = 0xE201, - ARM64_SYSREG_ELR_EL3 = 0xF201, - ARM64_SYSREG_SP_EL0 = 0xC208, - ARM64_SYSREG_SP_EL1 = 0xE208, - ARM64_SYSREG_SP_EL2 = 0xF208, - ARM64_SYSREG_SPSEL = 0xC210, - ARM64_SYSREG_NZCV = 0xDA10, - ARM64_SYSREG_DAIF = 0xDA11, - ARM64_SYSREG_CURRENTEL = 0xC212, - ARM64_SYSREG_SPSR_IRQ = 0xE218, - ARM64_SYSREG_SPSR_ABT = 0xE219, - ARM64_SYSREG_SPSR_UND = 0xE21A, - ARM64_SYSREG_SPSR_FIQ = 0xE21B, - ARM64_SYSREG_FPCR = 0xDA20, - ARM64_SYSREG_FPSR = 0xDA21, - ARM64_SYSREG_DSPSR_EL0 = 0xDA28, - ARM64_SYSREG_DLR_EL0 = 0xDA29, - ARM64_SYSREG_IFSR32_EL2 = 0xE281, - ARM64_SYSREG_AFSR0_EL1 = 0xC288, - ARM64_SYSREG_AFSR0_EL2 = 0xE288, - ARM64_SYSREG_AFSR0_EL3 = 0xF288, - ARM64_SYSREG_AFSR1_EL1 = 0xC289, - ARM64_SYSREG_AFSR1_EL2 = 0xE289, - ARM64_SYSREG_AFSR1_EL3 = 0xF289, - ARM64_SYSREG_ESR_EL1 = 0xC290, - ARM64_SYSREG_ESR_EL2 = 0xE290, - ARM64_SYSREG_ESR_EL3 = 0xF290, - ARM64_SYSREG_FPEXC32_EL2 = 0xE298, - ARM64_SYSREG_FAR_EL1 = 0xC300, - ARM64_SYSREG_FAR_EL2 = 0xE300, - ARM64_SYSREG_FAR_EL3 = 0xF300, - ARM64_SYSREG_HPFAR_EL2 = 0xE304, - ARM64_SYSREG_PAR_EL1 = 0xC3A0, - ARM64_SYSREG_PMCR_EL0 = 0xDCE0, - ARM64_SYSREG_PMCNTENSET_EL0 = 0xDCE1, - ARM64_SYSREG_PMCNTENCLR_EL0 = 0xDCE2, - ARM64_SYSREG_PMOVSCLR_EL0 = 0xDCE3, - ARM64_SYSREG_PMSELR_EL0 = 0xDCE5, - ARM64_SYSREG_PMCCNTR_EL0 = 0xDCE8, - ARM64_SYSREG_PMXEVTYPER_EL0 = 0xDCE9, - ARM64_SYSREG_PMXEVCNTR_EL0 = 0xDCEA, - ARM64_SYSREG_PMUSERENR_EL0 = 0xDCF0, - ARM64_SYSREG_PMINTENSET_EL1 = 0xC4F1, - ARM64_SYSREG_PMINTENCLR_EL1 = 0xC4F2, - ARM64_SYSREG_PMOVSSET_EL0 = 0xDCF3, - ARM64_SYSREG_MAIR_EL1 = 0xC510, - ARM64_SYSREG_MAIR_EL2 = 0xE510, - ARM64_SYSREG_MAIR_EL3 = 0xF510, - ARM64_SYSREG_AMAIR_EL1 = 0xC518, - ARM64_SYSREG_AMAIR_EL2 = 0xE518, - ARM64_SYSREG_AMAIR_EL3 = 0xF518, - ARM64_SYSREG_VBAR_EL1 = 0xC600, - ARM64_SYSREG_VBAR_EL2 = 0xE600, - ARM64_SYSREG_VBAR_EL3 = 0xF600, - ARM64_SYSREG_RMR_EL1 = 0xC602, - ARM64_SYSREG_RMR_EL2 = 0xE602, - ARM64_SYSREG_RMR_EL3 = 0xF602, - ARM64_SYSREG_CONTEXTIDR_EL1 = 0xC681, - ARM64_SYSREG_TPIDR_EL0 = 0xDE82, - ARM64_SYSREG_TPIDR_EL2 = 0xE682, - ARM64_SYSREG_TPIDR_EL3 = 0xF682, - ARM64_SYSREG_TPIDRRO_EL0 = 0xDE83, - ARM64_SYSREG_TPIDR_EL1 = 0xC684, - ARM64_SYSREG_CNTFRQ_EL0 = 0xDF00, - ARM64_SYSREG_CNTVOFF_EL2 = 0xE703, - ARM64_SYSREG_CNTKCTL_EL1 = 0xC708, - ARM64_SYSREG_CNTHCTL_EL2 = 0xE708, - ARM64_SYSREG_CNTP_TVAL_EL0 = 0xDF10, - ARM64_SYSREG_CNTHP_TVAL_EL2 = 0xE710, - ARM64_SYSREG_CNTPS_TVAL_EL1 = 0xFF10, - ARM64_SYSREG_CNTP_CTL_EL0 = 0xDF11, - ARM64_SYSREG_CNTHP_CTL_EL2 = 0xE711, - ARM64_SYSREG_CNTPS_CTL_EL1 = 0xFF11, - ARM64_SYSREG_CNTP_CVAL_EL0 = 0xDF12, - ARM64_SYSREG_CNTHP_CVAL_EL2 = 0xE712, - ARM64_SYSREG_CNTPS_CVAL_EL1 = 0xFF12, - ARM64_SYSREG_CNTV_TVAL_EL0 = 0xDF18, - ARM64_SYSREG_CNTV_CTL_EL0 = 0xDF19, - ARM64_SYSREG_CNTV_CVAL_EL0 = 0xDF1A, - ARM64_SYSREG_PMEVCNTR0_EL0 = 0xDF40, - ARM64_SYSREG_PMEVCNTR1_EL0 = 0xDF41, - ARM64_SYSREG_PMEVCNTR2_EL0 = 0xDF42, - ARM64_SYSREG_PMEVCNTR3_EL0 = 0xDF43, - ARM64_SYSREG_PMEVCNTR4_EL0 = 0xDF44, - ARM64_SYSREG_PMEVCNTR5_EL0 = 0xDF45, - ARM64_SYSREG_PMEVCNTR6_EL0 = 0xDF46, - ARM64_SYSREG_PMEVCNTR7_EL0 = 0xDF47, - ARM64_SYSREG_PMEVCNTR8_EL0 = 0xDF48, - ARM64_SYSREG_PMEVCNTR9_EL0 = 0xDF49, - ARM64_SYSREG_PMEVCNTR10_EL0 = 0xDF4A, - ARM64_SYSREG_PMEVCNTR11_EL0 = 0xDF4B, - ARM64_SYSREG_PMEVCNTR12_EL0 = 0xDF4C, - ARM64_SYSREG_PMEVCNTR13_EL0 = 0xDF4D, - ARM64_SYSREG_PMEVCNTR14_EL0 = 0xDF4E, - ARM64_SYSREG_PMEVCNTR15_EL0 = 0xDF4F, - ARM64_SYSREG_PMEVCNTR16_EL0 = 0xDF50, - ARM64_SYSREG_PMEVCNTR17_EL0 = 0xDF51, - ARM64_SYSREG_PMEVCNTR18_EL0 = 0xDF52, - ARM64_SYSREG_PMEVCNTR19_EL0 = 0xDF53, - ARM64_SYSREG_PMEVCNTR20_EL0 = 0xDF54, - ARM64_SYSREG_PMEVCNTR21_EL0 = 0xDF55, - ARM64_SYSREG_PMEVCNTR22_EL0 = 0xDF56, - ARM64_SYSREG_PMEVCNTR23_EL0 = 0xDF57, - ARM64_SYSREG_PMEVCNTR24_EL0 = 0xDF58, - ARM64_SYSREG_PMEVCNTR25_EL0 = 0xDF59, - ARM64_SYSREG_PMEVCNTR26_EL0 = 0xDF5A, - ARM64_SYSREG_PMEVCNTR27_EL0 = 0xDF5B, - ARM64_SYSREG_PMEVCNTR28_EL0 = 0xDF5C, - ARM64_SYSREG_PMEVCNTR29_EL0 = 0xDF5D, - ARM64_SYSREG_PMEVCNTR30_EL0 = 0xDF5E, - ARM64_SYSREG_PMCCFILTR_EL0 = 0xDF7F, - ARM64_SYSREG_PMEVTYPER0_EL0 = 0xDF60, - ARM64_SYSREG_PMEVTYPER1_EL0 = 0xDF61, - ARM64_SYSREG_PMEVTYPER2_EL0 = 0xDF62, - ARM64_SYSREG_PMEVTYPER3_EL0 = 0xDF63, - ARM64_SYSREG_PMEVTYPER4_EL0 = 0xDF64, - ARM64_SYSREG_PMEVTYPER5_EL0 = 0xDF65, - ARM64_SYSREG_PMEVTYPER6_EL0 = 0xDF66, - ARM64_SYSREG_PMEVTYPER7_EL0 = 0xDF67, - ARM64_SYSREG_PMEVTYPER8_EL0 = 0xDF68, - ARM64_SYSREG_PMEVTYPER9_EL0 = 0xDF69, - ARM64_SYSREG_PMEVTYPER10_EL0 = 0xDF6A, - ARM64_SYSREG_PMEVTYPER11_EL0 = 0xDF6B, - ARM64_SYSREG_PMEVTYPER12_EL0 = 0xDF6C, - ARM64_SYSREG_PMEVTYPER13_EL0 = 0xDF6D, - ARM64_SYSREG_PMEVTYPER14_EL0 = 0xDF6E, - ARM64_SYSREG_PMEVTYPER15_EL0 = 0xDF6F, - ARM64_SYSREG_PMEVTYPER16_EL0 = 0xDF70, - ARM64_SYSREG_PMEVTYPER17_EL0 = 0xDF71, - ARM64_SYSREG_PMEVTYPER18_EL0 = 0xDF72, - ARM64_SYSREG_PMEVTYPER19_EL0 = 0xDF73, - ARM64_SYSREG_PMEVTYPER20_EL0 = 0xDF74, - ARM64_SYSREG_PMEVTYPER21_EL0 = 0xDF75, - ARM64_SYSREG_PMEVTYPER22_EL0 = 0xDF76, - ARM64_SYSREG_PMEVTYPER23_EL0 = 0xDF77, - ARM64_SYSREG_PMEVTYPER24_EL0 = 0xDF78, - ARM64_SYSREG_PMEVTYPER25_EL0 = 0xDF79, - ARM64_SYSREG_PMEVTYPER26_EL0 = 0xDF7A, - ARM64_SYSREG_PMEVTYPER27_EL0 = 0xDF7B, - ARM64_SYSREG_PMEVTYPER28_EL0 = 0xDF7C, - ARM64_SYSREG_PMEVTYPER29_EL0 = 0xDF7D, - ARM64_SYSREG_PMEVTYPER30_EL0 = 0xDF7E, - ARM64_SYSREG_TRCPRGCTLR = 0x8808, - ARM64_SYSREG_TRCPROCSELR = 0x8810, - ARM64_SYSREG_TRCCONFIGR = 0x8820, - ARM64_SYSREG_TRCAUXCTLR = 0x8830, - ARM64_SYSREG_TRCEVENTCTL0R = 0x8840, - ARM64_SYSREG_TRCEVENTCTL1R = 0x8848, - ARM64_SYSREG_TRCSTALLCTLR = 0x8858, - ARM64_SYSREG_TRCTSCTLR = 0x8860, - ARM64_SYSREG_TRCSYNCPR = 0x8868, - ARM64_SYSREG_TRCCCCTLR = 0x8870, - ARM64_SYSREG_TRCBBCTLR = 0x8878, - ARM64_SYSREG_TRCTRACEIDR = 0x8801, - ARM64_SYSREG_TRCQCTLR = 0x8809, - ARM64_SYSREG_TRCVICTLR = 0x8802, - ARM64_SYSREG_TRCVIIECTLR = 0x880A, - ARM64_SYSREG_TRCVISSCTLR = 0x8812, - ARM64_SYSREG_TRCVIPCSSCTLR = 0x881A, - ARM64_SYSREG_TRCVDCTLR = 0x8842, - ARM64_SYSREG_TRCVDSACCTLR = 0x884A, - ARM64_SYSREG_TRCVDARCCTLR = 0x8852, - ARM64_SYSREG_TRCSEQEVR0 = 0x8804, - ARM64_SYSREG_TRCSEQEVR1 = 0x880C, - ARM64_SYSREG_TRCSEQEVR2 = 0x8814, - ARM64_SYSREG_TRCSEQRSTEVR = 0x8834, - ARM64_SYSREG_TRCSEQSTR = 0x883C, - ARM64_SYSREG_TRCEXTINSELR = 0x8844, - ARM64_SYSREG_TRCCNTRLDVR0 = 0x8805, - ARM64_SYSREG_TRCCNTRLDVR1 = 0x880D, - ARM64_SYSREG_TRCCNTRLDVR2 = 0x8815, - ARM64_SYSREG_TRCCNTRLDVR3 = 0x881D, - ARM64_SYSREG_TRCCNTCTLR0 = 0x8825, - ARM64_SYSREG_TRCCNTCTLR1 = 0x882D, - ARM64_SYSREG_TRCCNTCTLR2 = 0x8835, - ARM64_SYSREG_TRCCNTCTLR3 = 0x883D, - ARM64_SYSREG_TRCCNTVR0 = 0x8845, - ARM64_SYSREG_TRCCNTVR1 = 0x884D, - ARM64_SYSREG_TRCCNTVR2 = 0x8855, - ARM64_SYSREG_TRCCNTVR3 = 0x885D, - ARM64_SYSREG_TRCIMSPEC0 = 0x8807, - ARM64_SYSREG_TRCIMSPEC1 = 0x880F, - ARM64_SYSREG_TRCIMSPEC2 = 0x8817, - ARM64_SYSREG_TRCIMSPEC3 = 0x881F, - ARM64_SYSREG_TRCIMSPEC4 = 0x8827, - ARM64_SYSREG_TRCIMSPEC5 = 0x882F, - ARM64_SYSREG_TRCIMSPEC6 = 0x8837, - ARM64_SYSREG_TRCIMSPEC7 = 0x883F, - ARM64_SYSREG_TRCRSCTLR2 = 0x8890, - ARM64_SYSREG_TRCRSCTLR3 = 0x8898, - ARM64_SYSREG_TRCRSCTLR4 = 0x88A0, - ARM64_SYSREG_TRCRSCTLR5 = 0x88A8, - ARM64_SYSREG_TRCRSCTLR6 = 0x88B0, - ARM64_SYSREG_TRCRSCTLR7 = 0x88B8, - ARM64_SYSREG_TRCRSCTLR8 = 0x88C0, - ARM64_SYSREG_TRCRSCTLR9 = 0x88C8, - ARM64_SYSREG_TRCRSCTLR10 = 0x88D0, - ARM64_SYSREG_TRCRSCTLR11 = 0x88D8, - ARM64_SYSREG_TRCRSCTLR12 = 0x88E0, - ARM64_SYSREG_TRCRSCTLR13 = 0x88E8, - ARM64_SYSREG_TRCRSCTLR14 = 0x88F0, - ARM64_SYSREG_TRCRSCTLR15 = 0x88F8, - ARM64_SYSREG_TRCRSCTLR16 = 0x8881, - ARM64_SYSREG_TRCRSCTLR17 = 0x8889, - ARM64_SYSREG_TRCRSCTLR18 = 0x8891, - ARM64_SYSREG_TRCRSCTLR19 = 0x8899, - ARM64_SYSREG_TRCRSCTLR20 = 0x88A1, - ARM64_SYSREG_TRCRSCTLR21 = 0x88A9, - ARM64_SYSREG_TRCRSCTLR22 = 0x88B1, - ARM64_SYSREG_TRCRSCTLR23 = 0x88B9, - ARM64_SYSREG_TRCRSCTLR24 = 0x88C1, - ARM64_SYSREG_TRCRSCTLR25 = 0x88C9, - ARM64_SYSREG_TRCRSCTLR26 = 0x88D1, - ARM64_SYSREG_TRCRSCTLR27 = 0x88D9, - ARM64_SYSREG_TRCRSCTLR28 = 0x88E1, - ARM64_SYSREG_TRCRSCTLR29 = 0x88E9, - ARM64_SYSREG_TRCRSCTLR30 = 0x88F1, - ARM64_SYSREG_TRCRSCTLR31 = 0x88F9, - ARM64_SYSREG_TRCSSCCR0 = 0x8882, - ARM64_SYSREG_TRCSSCCR1 = 0x888A, - ARM64_SYSREG_TRCSSCCR2 = 0x8892, - ARM64_SYSREG_TRCSSCCR3 = 0x889A, - ARM64_SYSREG_TRCSSCCR4 = 0x88A2, - ARM64_SYSREG_TRCSSCCR5 = 0x88AA, - ARM64_SYSREG_TRCSSCCR6 = 0x88B2, - ARM64_SYSREG_TRCSSCCR7 = 0x88BA, - ARM64_SYSREG_TRCSSCSR0 = 0x88C2, - ARM64_SYSREG_TRCSSCSR1 = 0x88CA, - ARM64_SYSREG_TRCSSCSR2 = 0x88D2, - ARM64_SYSREG_TRCSSCSR3 = 0x88DA, - ARM64_SYSREG_TRCSSCSR4 = 0x88E2, - ARM64_SYSREG_TRCSSCSR5 = 0x88EA, - ARM64_SYSREG_TRCSSCSR6 = 0x88F2, - ARM64_SYSREG_TRCSSCSR7 = 0x88FA, - ARM64_SYSREG_TRCSSPCICR0 = 0x8883, - ARM64_SYSREG_TRCSSPCICR1 = 0x888B, - ARM64_SYSREG_TRCSSPCICR2 = 0x8893, - ARM64_SYSREG_TRCSSPCICR3 = 0x889B, - ARM64_SYSREG_TRCSSPCICR4 = 0x88A3, - ARM64_SYSREG_TRCSSPCICR5 = 0x88AB, - ARM64_SYSREG_TRCSSPCICR6 = 0x88B3, - ARM64_SYSREG_TRCSSPCICR7 = 0x88BB, - ARM64_SYSREG_TRCPDCR = 0x88A4, - ARM64_SYSREG_TRCACVR0 = 0x8900, - ARM64_SYSREG_TRCACVR1 = 0x8910, - ARM64_SYSREG_TRCACVR2 = 0x8920, - ARM64_SYSREG_TRCACVR3 = 0x8930, - ARM64_SYSREG_TRCACVR4 = 0x8940, - ARM64_SYSREG_TRCACVR5 = 0x8950, - ARM64_SYSREG_TRCACVR6 = 0x8960, - ARM64_SYSREG_TRCACVR7 = 0x8970, - ARM64_SYSREG_TRCACVR8 = 0x8901, - ARM64_SYSREG_TRCACVR9 = 0x8911, - ARM64_SYSREG_TRCACVR10 = 0x8921, - ARM64_SYSREG_TRCACVR11 = 0x8931, - ARM64_SYSREG_TRCACVR12 = 0x8941, - ARM64_SYSREG_TRCACVR13 = 0x8951, - ARM64_SYSREG_TRCACVR14 = 0x8961, - ARM64_SYSREG_TRCACVR15 = 0x8971, - ARM64_SYSREG_TRCACATR0 = 0x8902, - ARM64_SYSREG_TRCACATR1 = 0x8912, - ARM64_SYSREG_TRCACATR2 = 0x8922, - ARM64_SYSREG_TRCACATR3 = 0x8932, - ARM64_SYSREG_TRCACATR4 = 0x8942, - ARM64_SYSREG_TRCACATR5 = 0x8952, - ARM64_SYSREG_TRCACATR6 = 0x8962, - ARM64_SYSREG_TRCACATR7 = 0x8972, - ARM64_SYSREG_TRCACATR8 = 0x8903, - ARM64_SYSREG_TRCACATR9 = 0x8913, - ARM64_SYSREG_TRCACATR10 = 0x8923, - ARM64_SYSREG_TRCACATR11 = 0x8933, - ARM64_SYSREG_TRCACATR12 = 0x8943, - ARM64_SYSREG_TRCACATR13 = 0x8953, - ARM64_SYSREG_TRCACATR14 = 0x8963, - ARM64_SYSREG_TRCACATR15 = 0x8973, - ARM64_SYSREG_TRCDVCVR0 = 0x8904, - ARM64_SYSREG_TRCDVCVR1 = 0x8924, - ARM64_SYSREG_TRCDVCVR2 = 0x8944, - ARM64_SYSREG_TRCDVCVR3 = 0x8964, - ARM64_SYSREG_TRCDVCVR4 = 0x8905, - ARM64_SYSREG_TRCDVCVR5 = 0x8925, - ARM64_SYSREG_TRCDVCVR6 = 0x8945, - ARM64_SYSREG_TRCDVCVR7 = 0x8965, - ARM64_SYSREG_TRCDVCMR0 = 0x8906, - ARM64_SYSREG_TRCDVCMR1 = 0x8926, - ARM64_SYSREG_TRCDVCMR2 = 0x8946, - ARM64_SYSREG_TRCDVCMR3 = 0x8966, - ARM64_SYSREG_TRCDVCMR4 = 0x8907, - ARM64_SYSREG_TRCDVCMR5 = 0x8927, - ARM64_SYSREG_TRCDVCMR6 = 0x8947, - ARM64_SYSREG_TRCDVCMR7 = 0x8967, - ARM64_SYSREG_TRCCIDCVR0 = 0x8980, - ARM64_SYSREG_TRCCIDCVR1 = 0x8990, - ARM64_SYSREG_TRCCIDCVR2 = 0x89A0, - ARM64_SYSREG_TRCCIDCVR3 = 0x89B0, - ARM64_SYSREG_TRCCIDCVR4 = 0x89C0, - ARM64_SYSREG_TRCCIDCVR5 = 0x89D0, - ARM64_SYSREG_TRCCIDCVR6 = 0x89E0, - ARM64_SYSREG_TRCCIDCVR7 = 0x89F0, - ARM64_SYSREG_TRCVMIDCVR0 = 0x8981, - ARM64_SYSREG_TRCVMIDCVR1 = 0x8991, - ARM64_SYSREG_TRCVMIDCVR2 = 0x89A1, - ARM64_SYSREG_TRCVMIDCVR3 = 0x89B1, - ARM64_SYSREG_TRCVMIDCVR4 = 0x89C1, - ARM64_SYSREG_TRCVMIDCVR5 = 0x89D1, - ARM64_SYSREG_TRCVMIDCVR6 = 0x89E1, - ARM64_SYSREG_TRCVMIDCVR7 = 0x89F1, - ARM64_SYSREG_TRCCIDCCTLR0 = 0x8982, - ARM64_SYSREG_TRCCIDCCTLR1 = 0x898A, - ARM64_SYSREG_TRCVMIDCCTLR0 = 0x8992, - ARM64_SYSREG_TRCVMIDCCTLR1 = 0x899A, - ARM64_SYSREG_TRCITCTRL = 0x8B84, - ARM64_SYSREG_TRCCLAIMSET = 0x8BC6, - ARM64_SYSREG_TRCCLAIMCLR = 0x8BCE, - ARM64_SYSREG_ICC_BPR1_EL1 = 0xC663, - ARM64_SYSREG_ICC_BPR0_EL1 = 0xC643, - ARM64_SYSREG_ICC_PMR_EL1 = 0xC230, - ARM64_SYSREG_ICC_CTLR_EL1 = 0xC664, - ARM64_SYSREG_ICC_CTLR_EL3 = 0xF664, - ARM64_SYSREG_ICC_SRE_EL1 = 0xC665, - ARM64_SYSREG_ICC_SRE_EL2 = 0xE64D, - ARM64_SYSREG_ICC_SRE_EL3 = 0xF665, - ARM64_SYSREG_ICC_IGRPEN0_EL1 = 0xC666, - ARM64_SYSREG_ICC_IGRPEN1_EL1 = 0xC667, - ARM64_SYSREG_ICC_IGRPEN1_EL3 = 0xF667, - ARM64_SYSREG_ICC_SEIEN_EL1 = 0xC668, - ARM64_SYSREG_ICC_AP0R0_EL1 = 0xC644, - ARM64_SYSREG_ICC_AP0R1_EL1 = 0xC645, - ARM64_SYSREG_ICC_AP0R2_EL1 = 0xC646, - ARM64_SYSREG_ICC_AP0R3_EL1 = 0xC647, - ARM64_SYSREG_ICC_AP1R0_EL1 = 0xC648, - ARM64_SYSREG_ICC_AP1R1_EL1 = 0xC649, - ARM64_SYSREG_ICC_AP1R2_EL1 = 0xC64A, - ARM64_SYSREG_ICC_AP1R3_EL1 = 0xC64B, - ARM64_SYSREG_ICH_AP0R0_EL2 = 0xE640, - ARM64_SYSREG_ICH_AP0R1_EL2 = 0xE641, - ARM64_SYSREG_ICH_AP0R2_EL2 = 0xE642, - ARM64_SYSREG_ICH_AP0R3_EL2 = 0xE643, - ARM64_SYSREG_ICH_AP1R0_EL2 = 0xE648, - ARM64_SYSREG_ICH_AP1R1_EL2 = 0xE649, - ARM64_SYSREG_ICH_AP1R2_EL2 = 0xE64A, - ARM64_SYSREG_ICH_AP1R3_EL2 = 0xE64B, - ARM64_SYSREG_ICH_HCR_EL2 = 0xE658, - ARM64_SYSREG_ICH_MISR_EL2 = 0xE65A, - ARM64_SYSREG_ICH_VMCR_EL2 = 0xE65F, - ARM64_SYSREG_ICH_VSEIR_EL2 = 0xE64C, - ARM64_SYSREG_ICH_LR0_EL2 = 0xE660, - ARM64_SYSREG_ICH_LR1_EL2 = 0xE661, - ARM64_SYSREG_ICH_LR2_EL2 = 0xE662, - ARM64_SYSREG_ICH_LR3_EL2 = 0xE663, - ARM64_SYSREG_ICH_LR4_EL2 = 0xE664, - ARM64_SYSREG_ICH_LR5_EL2 = 0xE665, - ARM64_SYSREG_ICH_LR6_EL2 = 0xE666, - ARM64_SYSREG_ICH_LR7_EL2 = 0xE667, - ARM64_SYSREG_ICH_LR8_EL2 = 0xE668, - ARM64_SYSREG_ICH_LR9_EL2 = 0xE669, - ARM64_SYSREG_ICH_LR10_EL2 = 0xE66A, - ARM64_SYSREG_ICH_LR11_EL2 = 0xE66B, - ARM64_SYSREG_ICH_LR12_EL2 = 0xE66C, - ARM64_SYSREG_ICH_LR13_EL2 = 0xE66D, - ARM64_SYSREG_ICH_LR14_EL2 = 0xE66E, - ARM64_SYSREG_ICH_LR15_EL2 = 0xE66F, - ARM64_SYSREG_PAN = 0xC213, - ARM64_SYSREG_LORSA_EL1 = 0xC520, - ARM64_SYSREG_LOREA_EL1 = 0xC521, - ARM64_SYSREG_LORN_EL1 = 0xC522, - ARM64_SYSREG_LORC_EL1 = 0xC523, - ARM64_SYSREG_TTBR1_EL2 = 0xE101, - ARM64_SYSREG_CONTEXTIDR_EL2 = 0xE681, - ARM64_SYSREG_CNTHV_TVAL_EL2 = 0xE718, - ARM64_SYSREG_CNTHV_CVAL_EL2 = 0xE71A, - ARM64_SYSREG_CNTHV_CTL_EL2 = 0xE719, - ARM64_SYSREG_SCTLR_EL12 = 0xE880, - ARM64_SYSREG_CPACR_EL12 = 0xE882, - ARM64_SYSREG_TTBR0_EL12 = 0xE900, - ARM64_SYSREG_TTBR1_EL12 = 0xE901, - ARM64_SYSREG_TCR_EL12 = 0xE902, - ARM64_SYSREG_AFSR0_EL12 = 0xEA88, - ARM64_SYSREG_AFSR1_EL12 = 0xEA89, - ARM64_SYSREG_ESR_EL12 = 0xEA90, - ARM64_SYSREG_FAR_EL12 = 0xEB00, - ARM64_SYSREG_MAIR_EL12 = 0xED10, - ARM64_SYSREG_AMAIR_EL12 = 0xED18, - ARM64_SYSREG_VBAR_EL12 = 0xEE00, - ARM64_SYSREG_CONTEXTIDR_EL12 = 0xEE81, - ARM64_SYSREG_CNTKCTL_EL12 = 0xEF08, - ARM64_SYSREG_CNTP_TVAL_EL02 = 0xEF10, - ARM64_SYSREG_CNTP_CTL_EL02 = 0xEF11, - ARM64_SYSREG_CNTP_CVAL_EL02 = 0xEF12, - ARM64_SYSREG_CNTV_TVAL_EL02 = 0xEF18, - ARM64_SYSREG_CNTV_CTL_EL02 = 0xEF19, - ARM64_SYSREG_CNTV_CVAL_EL02 = 0xEF1A, - ARM64_SYSREG_SPSR_EL12 = 0xEA00, - ARM64_SYSREG_ELR_EL12 = 0xEA01, - ARM64_SYSREG_UAO = 0xC214, - ARM64_SYSREG_PMBLIMITR_EL1 = 0xC4D0, - ARM64_SYSREG_PMBPTR_EL1 = 0xC4D1, - ARM64_SYSREG_PMBSR_EL1 = 0xC4D3, - ARM64_SYSREG_PMBIDR_EL1 = 0xC4D7, - ARM64_SYSREG_PMSCR_EL2 = 0xE4C8, - ARM64_SYSREG_PMSCR_EL12 = 0xECC8, - ARM64_SYSREG_PMSCR_EL1 = 0xC4C8, - ARM64_SYSREG_PMSICR_EL1 = 0xC4CA, - ARM64_SYSREG_PMSIRR_EL1 = 0xC4CB, - ARM64_SYSREG_PMSFCR_EL1 = 0xC4CC, - ARM64_SYSREG_PMSEVFR_EL1 = 0xC4CD, - ARM64_SYSREG_PMSLATFR_EL1 = 0xC4CE, - ARM64_SYSREG_PMSIDR_EL1 = 0xC4CF, - ARM64_SYSREG_ERRSELR_EL1 = 0xC299, - ARM64_SYSREG_ERXCTLR_EL1 = 0xC2A1, - ARM64_SYSREG_ERXSTATUS_EL1 = 0xC2A2, - ARM64_SYSREG_ERXADDR_EL1 = 0xC2A3, - ARM64_SYSREG_ERXMISC0_EL1 = 0xC2A8, - ARM64_SYSREG_ERXMISC1_EL1 = 0xC2A9, - ARM64_SYSREG_DISR_EL1 = 0xC609, - ARM64_SYSREG_VDISR_EL2 = 0xE609, - ARM64_SYSREG_VSESR_EL2 = 0xE293, - ARM64_SYSREG_APIAKEYLO_EL1 = 0xC108, - ARM64_SYSREG_APIAKEYHI_EL1 = 0xC109, - ARM64_SYSREG_APIBKEYLO_EL1 = 0xC10A, - ARM64_SYSREG_APIBKEYHI_EL1 = 0xC10B, - ARM64_SYSREG_APDAKEYLO_EL1 = 0xC110, - ARM64_SYSREG_APDAKEYHI_EL1 = 0xC111, - ARM64_SYSREG_APDBKEYLO_EL1 = 0xC112, - ARM64_SYSREG_APDBKEYHI_EL1 = 0xC113, - ARM64_SYSREG_APGAKEYLO_EL1 = 0xC118, - ARM64_SYSREG_APGAKEYHI_EL1 = 0xC119, - ARM64_SYSREG_VSTCR_EL2 = 0xE132, - ARM64_SYSREG_VSTTBR_EL2 = 0xE130, - ARM64_SYSREG_CNTHVS_TVAL_EL2 = 0xE720, - ARM64_SYSREG_CNTHVS_CVAL_EL2 = 0xE722, - ARM64_SYSREG_CNTHVS_CTL_EL2 = 0xE721, - ARM64_SYSREG_CNTHPS_TVAL_EL2 = 0xE728, - ARM64_SYSREG_CNTHPS_CVAL_EL2 = 0xE72A, - ARM64_SYSREG_CNTHPS_CTL_EL2 = 0xE729, - ARM64_SYSREG_SDER32_EL2 = 0xE099, - ARM64_SYSREG_ERXPFGCTL_EL1 = 0xC2A5, - ARM64_SYSREG_ERXPFGCDN_EL1 = 0xC2A6, - ARM64_SYSREG_ERXTS_EL1 = 0xC2AF, - ARM64_SYSREG_ERXMISC2_EL1 = 0xC2AA, - ARM64_SYSREG_ERXMISC3_EL1 = 0xC2AB, - ARM64_SYSREG_ERXPFGF_EL1 = 0xC2A4, - ARM64_SYSREG_MPAM0_EL1 = 0xC529, - ARM64_SYSREG_MPAM1_EL1 = 0xC528, - ARM64_SYSREG_MPAM2_EL2 = 0xE528, - ARM64_SYSREG_MPAM3_EL3 = 0xF528, - ARM64_SYSREG_MPAM1_EL12 = 0xED28, - ARM64_SYSREG_MPAMHCR_EL2 = 0xE520, - ARM64_SYSREG_MPAMVPMV_EL2 = 0xE521, - ARM64_SYSREG_MPAMVPM0_EL2 = 0xE530, - ARM64_SYSREG_MPAMVPM1_EL2 = 0xE531, - ARM64_SYSREG_MPAMVPM2_EL2 = 0xE532, - ARM64_SYSREG_MPAMVPM3_EL2 = 0xE533, - ARM64_SYSREG_MPAMVPM4_EL2 = 0xE534, - ARM64_SYSREG_MPAMVPM5_EL2 = 0xE535, - ARM64_SYSREG_MPAMVPM6_EL2 = 0xE536, - ARM64_SYSREG_MPAMVPM7_EL2 = 0xE537, - ARM64_SYSREG_MPAMIDR_EL1 = 0xC524, - ARM64_SYSREG_AMCR_EL0 = 0xDE90, - ARM64_SYSREG_AMCFGR_EL0 = 0xDE91, - ARM64_SYSREG_AMCGCR_EL0 = 0xDE92, - ARM64_SYSREG_AMUSERENR_EL0 = 0xDE93, - ARM64_SYSREG_AMCNTENCLR0_EL0 = 0xDE94, - ARM64_SYSREG_AMCNTENSET0_EL0 = 0xDE95, - ARM64_SYSREG_AMEVCNTR00_EL0 = 0xDEA0, - ARM64_SYSREG_AMEVCNTR01_EL0 = 0xDEA1, - ARM64_SYSREG_AMEVCNTR02_EL0 = 0xDEA2, - ARM64_SYSREG_AMEVCNTR03_EL0 = 0xDEA3, - ARM64_SYSREG_AMEVTYPER00_EL0 = 0xDEB0, - ARM64_SYSREG_AMEVTYPER01_EL0 = 0xDEB1, - ARM64_SYSREG_AMEVTYPER02_EL0 = 0xDEB2, - ARM64_SYSREG_AMEVTYPER03_EL0 = 0xDEB3, - ARM64_SYSREG_AMCNTENCLR1_EL0 = 0xDE98, - ARM64_SYSREG_AMCNTENSET1_EL0 = 0xDE99, - ARM64_SYSREG_AMEVCNTR10_EL0 = 0xDEE0, - ARM64_SYSREG_AMEVCNTR11_EL0 = 0xDEE1, - ARM64_SYSREG_AMEVCNTR12_EL0 = 0xDEE2, - ARM64_SYSREG_AMEVCNTR13_EL0 = 0xDEE3, - ARM64_SYSREG_AMEVCNTR14_EL0 = 0xDEE4, - ARM64_SYSREG_AMEVCNTR15_EL0 = 0xDEE5, - ARM64_SYSREG_AMEVCNTR16_EL0 = 0xDEE6, - ARM64_SYSREG_AMEVCNTR17_EL0 = 0xDEE7, - ARM64_SYSREG_AMEVCNTR18_EL0 = 0xDEE8, - ARM64_SYSREG_AMEVCNTR19_EL0 = 0xDEE9, - ARM64_SYSREG_AMEVCNTR110_EL0 = 0xDEEA, - ARM64_SYSREG_AMEVCNTR111_EL0 = 0xDEEB, - ARM64_SYSREG_AMEVCNTR112_EL0 = 0xDEEC, - ARM64_SYSREG_AMEVCNTR113_EL0 = 0xDEED, - ARM64_SYSREG_AMEVCNTR114_EL0 = 0xDEEE, - ARM64_SYSREG_AMEVCNTR115_EL0 = 0xDEEF, - ARM64_SYSREG_AMEVTYPER10_EL0 = 0xDEF0, - ARM64_SYSREG_AMEVTYPER11_EL0 = 0xDEF1, - ARM64_SYSREG_AMEVTYPER12_EL0 = 0xDEF2, - ARM64_SYSREG_AMEVTYPER13_EL0 = 0xDEF3, - ARM64_SYSREG_AMEVTYPER14_EL0 = 0xDEF4, - ARM64_SYSREG_AMEVTYPER15_EL0 = 0xDEF5, - ARM64_SYSREG_AMEVTYPER16_EL0 = 0xDEF6, - ARM64_SYSREG_AMEVTYPER17_EL0 = 0xDEF7, - ARM64_SYSREG_AMEVTYPER18_EL0 = 0xDEF8, - ARM64_SYSREG_AMEVTYPER19_EL0 = 0xDEF9, - ARM64_SYSREG_AMEVTYPER110_EL0 = 0xDEFA, - ARM64_SYSREG_AMEVTYPER111_EL0 = 0xDEFB, - ARM64_SYSREG_AMEVTYPER112_EL0 = 0xDEFC, - ARM64_SYSREG_AMEVTYPER113_EL0 = 0xDEFD, - ARM64_SYSREG_AMEVTYPER114_EL0 = 0xDEFE, - ARM64_SYSREG_AMEVTYPER115_EL0 = 0xDEFF, - ARM64_SYSREG_TRFCR_EL1 = 0xC091, - ARM64_SYSREG_TRFCR_EL2 = 0xE091, - ARM64_SYSREG_TRFCR_EL12 = 0xE891, - ARM64_SYSREG_DIT = 0xDA15, - ARM64_SYSREG_VNCR_EL2 = 0xE110, - ARM64_SYSREG_ZCR_EL1 = 0xC090, - ARM64_SYSREG_ZCR_EL2 = 0xE090, - ARM64_SYSREG_ZCR_EL3 = 0xF090, - ARM64_SYSREG_ZCR_EL12 = 0xE890, - ARM64_SYSREG_CPM_IOACC_CTL_EL3 = 0xFF90, -} arm64_sysreg; - -/// System PState Field (MSR instruction) -typedef enum arm64_pstate { - ARM64_PSTATE_INVALID = 0, - ARM64_PSTATE_SPSEL = 0x05, - ARM64_PSTATE_DAIFSET = 0x1e, - ARM64_PSTATE_DAIFCLR = 0x1f, - ARM64_PSTATE_PAN = 0x4, - ARM64_PSTATE_UAO = 0x3, - ARM64_PSTATE_DIT = 0x1a, -} arm64_pstate; - -/// Vector arrangement specifier (for FloatingPoint/Advanced SIMD insn) -typedef enum arm64_vas { - ARM64_VAS_INVALID = 0, - ARM64_VAS_16B, - ARM64_VAS_8B, - ARM64_VAS_4B, - ARM64_VAS_1B, - ARM64_VAS_8H, - ARM64_VAS_4H, - ARM64_VAS_2H, - ARM64_VAS_1H, - ARM64_VAS_4S, - ARM64_VAS_2S, - ARM64_VAS_1S, - ARM64_VAS_2D, - ARM64_VAS_1D, - ARM64_VAS_1Q, -} arm64_vas; - -/// Memory barrier operands -typedef enum arm64_barrier_op { - ARM64_BARRIER_INVALID = 0, - ARM64_BARRIER_OSHLD = 0x1, - ARM64_BARRIER_OSHST = 0x2, - ARM64_BARRIER_OSH = 0x3, - ARM64_BARRIER_NSHLD = 0x5, - ARM64_BARRIER_NSHST = 0x6, - ARM64_BARRIER_NSH = 0x7, - ARM64_BARRIER_ISHLD = 0x9, - ARM64_BARRIER_ISHST = 0xa, - ARM64_BARRIER_ISH = 0xb, - ARM64_BARRIER_LD = 0xd, - ARM64_BARRIER_ST = 0xe, - ARM64_BARRIER_SY = 0xf -} arm64_barrier_op; - -/// Operand type for instruction's operands -typedef enum arm64_op_type { - ARM64_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - ARM64_OP_REG, ///< = CS_OP_REG (Register operand). - ARM64_OP_IMM, ///< = CS_OP_IMM (Immediate operand). - ARM64_OP_MEM, ///< = CS_OP_MEM (Memory operand). - ARM64_OP_FP, ///< = CS_OP_FP (Floating-Point operand). - ARM64_OP_CIMM = 64, ///< C-Immediate - ARM64_OP_REG_MRS, ///< MRS register operand. - ARM64_OP_REG_MSR, ///< MSR register operand. - ARM64_OP_PSTATE, ///< PState operand. - ARM64_OP_SYS, ///< SYS operand for IC/DC/AT/TLBI instructions. - ARM64_OP_PREFETCH, ///< Prefetch operand (PRFM). - ARM64_OP_BARRIER, ///< Memory barrier operand (ISB/DMB/DSB instructions). -} arm64_op_type; - -/// TLBI operations -typedef enum arm64_tlbi_op { - ARM64_TLBI_INVALID = 0, - - ARM64_TLBI_IPAS2E1IS, - ARM64_TLBI_IPAS2LE1IS, - ARM64_TLBI_VMALLE1IS, - ARM64_TLBI_ALLE2IS, - ARM64_TLBI_ALLE3IS, - ARM64_TLBI_VAE1IS, - ARM64_TLBI_VAE2IS, - ARM64_TLBI_VAE3IS, - ARM64_TLBI_ASIDE1IS, - ARM64_TLBI_VAAE1IS, - ARM64_TLBI_ALLE1IS, - ARM64_TLBI_VALE1IS, - ARM64_TLBI_VALE2IS, - ARM64_TLBI_VALE3IS, - ARM64_TLBI_VMALLS12E1IS, - ARM64_TLBI_VAALE1IS, - ARM64_TLBI_IPAS2E1, - ARM64_TLBI_IPAS2LE1, - ARM64_TLBI_VMALLE1, - ARM64_TLBI_ALLE2, - ARM64_TLBI_ALLE3, - ARM64_TLBI_VAE1, - ARM64_TLBI_VAE2, - ARM64_TLBI_VAE3, - ARM64_TLBI_ASIDE1, - ARM64_TLBI_VAAE1, - ARM64_TLBI_ALLE1, - ARM64_TLBI_VALE1, - ARM64_TLBI_VALE2, - ARM64_TLBI_VALE3, - ARM64_TLBI_VMALLS12E1, - ARM64_TLBI_VAALE1, - ARM64_TLBI_VMALLE1OS, - ARM64_TLBI_VAE1OS, - ARM64_TLBI_ASIDE1OS, - ARM64_TLBI_VAAE1OS, - ARM64_TLBI_VALE1OS, - ARM64_TLBI_VAALE1OS, - ARM64_TLBI_IPAS2E1OS, - ARM64_TLBI_IPAS2LE1OS, - ARM64_TLBI_VAE2OS, - ARM64_TLBI_VALE2OS, - ARM64_TLBI_VMALLS12E1OS, - ARM64_TLBI_VAE3OS, - ARM64_TLBI_VALE3OS, - ARM64_TLBI_ALLE2OS, - ARM64_TLBI_ALLE1OS, - ARM64_TLBI_ALLE3OS, - ARM64_TLBI_RVAE1, - ARM64_TLBI_RVAAE1, - ARM64_TLBI_RVALE1, - ARM64_TLBI_RVAALE1, - ARM64_TLBI_RVAE1IS, - ARM64_TLBI_RVAAE1IS, - ARM64_TLBI_RVALE1IS, - ARM64_TLBI_RVAALE1IS, - ARM64_TLBI_RVAE1OS, - ARM64_TLBI_RVAAE1OS, - ARM64_TLBI_RVALE1OS, - ARM64_TLBI_RVAALE1OS, - ARM64_TLBI_RIPAS2E1IS, - ARM64_TLBI_RIPAS2LE1IS, - ARM64_TLBI_RIPAS2E1, - ARM64_TLBI_RIPAS2LE1, - ARM64_TLBI_RIPAS2E1OS, - ARM64_TLBI_RIPAS2LE1OS, - ARM64_TLBI_RVAE2, - ARM64_TLBI_RVALE2, - ARM64_TLBI_RVAE2IS, - ARM64_TLBI_RVALE2IS, - ARM64_TLBI_RVAE2OS, - ARM64_TLBI_RVALE2OS, - ARM64_TLBI_RVAE3, - ARM64_TLBI_RVALE3, - ARM64_TLBI_RVAE3IS, - ARM64_TLBI_RVALE3IS, - ARM64_TLBI_RVAE3OS, - ARM64_TLBI_RVALE3OS, -} arm64_tlbi_op; - -/// AT operations -typedef enum arm64_at_op { - ARM64_AT_S1E1R, - ARM64_AT_S1E2R, - ARM64_AT_S1E3R, - ARM64_AT_S1E1W, - ARM64_AT_S1E2W, - ARM64_AT_S1E3W, - ARM64_AT_S1E0R, - ARM64_AT_S1E0W, - ARM64_AT_S12E1R, - ARM64_AT_S12E1W, - ARM64_AT_S12E0R, - ARM64_AT_S12E0W, - ARM64_AT_S1E1RP, - ARM64_AT_S1E1WP, -} arm64_at_op; - -/// DC operations -typedef enum arm64_dc_op { - ARM64_DC_INVALID = 0, - ARM64_DC_ZVA, - ARM64_DC_IVAC, - ARM64_DC_ISW, - ARM64_DC_CVAC, - ARM64_DC_CSW, - ARM64_DC_CVAU, - ARM64_DC_CIVAC, - ARM64_DC_CISW, - ARM64_DC_CVAP, -} arm64_dc_op; - -/// IC operations -typedef enum arm64_ic_op { - ARM64_IC_INVALID = 0, - ARM64_IC_IALLUIS, - ARM64_IC_IALLU, - ARM64_IC_IVAU, -} arm64_ic_op; - -/// Prefetch operations (PRFM) -typedef enum arm64_prefetch_op { - ARM64_PRFM_INVALID = 0, - ARM64_PRFM_PLDL1KEEP = 0x00 + 1, - ARM64_PRFM_PLDL1STRM = 0x01 + 1, - ARM64_PRFM_PLDL2KEEP = 0x02 + 1, - ARM64_PRFM_PLDL2STRM = 0x03 + 1, - ARM64_PRFM_PLDL3KEEP = 0x04 + 1, - ARM64_PRFM_PLDL3STRM = 0x05 + 1, - ARM64_PRFM_PLIL1KEEP = 0x08 + 1, - ARM64_PRFM_PLIL1STRM = 0x09 + 1, - ARM64_PRFM_PLIL2KEEP = 0x0a + 1, - ARM64_PRFM_PLIL2STRM = 0x0b + 1, - ARM64_PRFM_PLIL3KEEP = 0x0c + 1, - ARM64_PRFM_PLIL3STRM = 0x0d + 1, - ARM64_PRFM_PSTL1KEEP = 0x10 + 1, - ARM64_PRFM_PSTL1STRM = 0x11 + 1, - ARM64_PRFM_PSTL2KEEP = 0x12 + 1, - ARM64_PRFM_PSTL2STRM = 0x13 + 1, - ARM64_PRFM_PSTL3KEEP = 0x14 + 1, - ARM64_PRFM_PSTL3STRM = 0x15 + 1, -} arm64_prefetch_op; - -/// ARM64 registers -typedef enum arm64_reg { - ARM64_REG_INVALID = 0, - - ARM64_REG_FFR = 1, - ARM64_REG_FP = 2, - ARM64_REG_LR = 3, - ARM64_REG_NZCV = 4, - ARM64_REG_SP = 5, - ARM64_REG_WSP = 6, - ARM64_REG_WZR = 7, - ARM64_REG_XZR = 8, - ARM64_REG_B0 = 9, - ARM64_REG_B1 = 10, - ARM64_REG_B2 = 11, - ARM64_REG_B3 = 12, - ARM64_REG_B4 = 13, - ARM64_REG_B5 = 14, - ARM64_REG_B6 = 15, - ARM64_REG_B7 = 16, - ARM64_REG_B8 = 17, - ARM64_REG_B9 = 18, - ARM64_REG_B10 = 19, - ARM64_REG_B11 = 20, - ARM64_REG_B12 = 21, - ARM64_REG_B13 = 22, - ARM64_REG_B14 = 23, - ARM64_REG_B15 = 24, - ARM64_REG_B16 = 25, - ARM64_REG_B17 = 26, - ARM64_REG_B18 = 27, - ARM64_REG_B19 = 28, - ARM64_REG_B20 = 29, - ARM64_REG_B21 = 30, - ARM64_REG_B22 = 31, - ARM64_REG_B23 = 32, - ARM64_REG_B24 = 33, - ARM64_REG_B25 = 34, - ARM64_REG_B26 = 35, - ARM64_REG_B27 = 36, - ARM64_REG_B28 = 37, - ARM64_REG_B29 = 38, - ARM64_REG_B30 = 39, - ARM64_REG_B31 = 40, - ARM64_REG_D0 = 41, - ARM64_REG_D1 = 42, - ARM64_REG_D2 = 43, - ARM64_REG_D3 = 44, - ARM64_REG_D4 = 45, - ARM64_REG_D5 = 46, - ARM64_REG_D6 = 47, - ARM64_REG_D7 = 48, - ARM64_REG_D8 = 49, - ARM64_REG_D9 = 50, - ARM64_REG_D10 = 51, - ARM64_REG_D11 = 52, - ARM64_REG_D12 = 53, - ARM64_REG_D13 = 54, - ARM64_REG_D14 = 55, - ARM64_REG_D15 = 56, - ARM64_REG_D16 = 57, - ARM64_REG_D17 = 58, - ARM64_REG_D18 = 59, - ARM64_REG_D19 = 60, - ARM64_REG_D20 = 61, - ARM64_REG_D21 = 62, - ARM64_REG_D22 = 63, - ARM64_REG_D23 = 64, - ARM64_REG_D24 = 65, - ARM64_REG_D25 = 66, - ARM64_REG_D26 = 67, - ARM64_REG_D27 = 68, - ARM64_REG_D28 = 69, - ARM64_REG_D29 = 70, - ARM64_REG_D30 = 71, - ARM64_REG_D31 = 72, - ARM64_REG_H0 = 73, - ARM64_REG_H1 = 74, - ARM64_REG_H2 = 75, - ARM64_REG_H3 = 76, - ARM64_REG_H4 = 77, - ARM64_REG_H5 = 78, - ARM64_REG_H6 = 79, - ARM64_REG_H7 = 80, - ARM64_REG_H8 = 81, - ARM64_REG_H9 = 82, - ARM64_REG_H10 = 83, - ARM64_REG_H11 = 84, - ARM64_REG_H12 = 85, - ARM64_REG_H13 = 86, - ARM64_REG_H14 = 87, - ARM64_REG_H15 = 88, - ARM64_REG_H16 = 89, - ARM64_REG_H17 = 90, - ARM64_REG_H18 = 91, - ARM64_REG_H19 = 92, - ARM64_REG_H20 = 93, - ARM64_REG_H21 = 94, - ARM64_REG_H22 = 95, - ARM64_REG_H23 = 96, - ARM64_REG_H24 = 97, - ARM64_REG_H25 = 98, - ARM64_REG_H26 = 99, - ARM64_REG_H27 = 100, - ARM64_REG_H28 = 101, - ARM64_REG_H29 = 102, - ARM64_REG_H30 = 103, - ARM64_REG_H31 = 104, - ARM64_REG_P0 = 105, - ARM64_REG_P1 = 106, - ARM64_REG_P2 = 107, - ARM64_REG_P3 = 108, - ARM64_REG_P4 = 109, - ARM64_REG_P5 = 110, - ARM64_REG_P6 = 111, - ARM64_REG_P7 = 112, - ARM64_REG_P8 = 113, - ARM64_REG_P9 = 114, - ARM64_REG_P10 = 115, - ARM64_REG_P11 = 116, - ARM64_REG_P12 = 117, - ARM64_REG_P13 = 118, - ARM64_REG_P14 = 119, - ARM64_REG_P15 = 120, - ARM64_REG_Q0 = 121, - ARM64_REG_Q1 = 122, - ARM64_REG_Q2 = 123, - ARM64_REG_Q3 = 124, - ARM64_REG_Q4 = 125, - ARM64_REG_Q5 = 126, - ARM64_REG_Q6 = 127, - ARM64_REG_Q7 = 128, - ARM64_REG_Q8 = 129, - ARM64_REG_Q9 = 130, - ARM64_REG_Q10 = 131, - ARM64_REG_Q11 = 132, - ARM64_REG_Q12 = 133, - ARM64_REG_Q13 = 134, - ARM64_REG_Q14 = 135, - ARM64_REG_Q15 = 136, - ARM64_REG_Q16 = 137, - ARM64_REG_Q17 = 138, - ARM64_REG_Q18 = 139, - ARM64_REG_Q19 = 140, - ARM64_REG_Q20 = 141, - ARM64_REG_Q21 = 142, - ARM64_REG_Q22 = 143, - ARM64_REG_Q23 = 144, - ARM64_REG_Q24 = 145, - ARM64_REG_Q25 = 146, - ARM64_REG_Q26 = 147, - ARM64_REG_Q27 = 148, - ARM64_REG_Q28 = 149, - ARM64_REG_Q29 = 150, - ARM64_REG_Q30 = 151, - ARM64_REG_Q31 = 152, - ARM64_REG_S0 = 153, - ARM64_REG_S1 = 154, - ARM64_REG_S2 = 155, - ARM64_REG_S3 = 156, - ARM64_REG_S4 = 157, - ARM64_REG_S5 = 158, - ARM64_REG_S6 = 159, - ARM64_REG_S7 = 160, - ARM64_REG_S8 = 161, - ARM64_REG_S9 = 162, - ARM64_REG_S10 = 163, - ARM64_REG_S11 = 164, - ARM64_REG_S12 = 165, - ARM64_REG_S13 = 166, - ARM64_REG_S14 = 167, - ARM64_REG_S15 = 168, - ARM64_REG_S16 = 169, - ARM64_REG_S17 = 170, - ARM64_REG_S18 = 171, - ARM64_REG_S19 = 172, - ARM64_REG_S20 = 173, - ARM64_REG_S21 = 174, - ARM64_REG_S22 = 175, - ARM64_REG_S23 = 176, - ARM64_REG_S24 = 177, - ARM64_REG_S25 = 178, - ARM64_REG_S26 = 179, - ARM64_REG_S27 = 180, - ARM64_REG_S28 = 181, - ARM64_REG_S29 = 182, - ARM64_REG_S30 = 183, - ARM64_REG_S31 = 184, - ARM64_REG_W0 = 185, - ARM64_REG_W1 = 186, - ARM64_REG_W2 = 187, - ARM64_REG_W3 = 188, - ARM64_REG_W4 = 189, - ARM64_REG_W5 = 190, - ARM64_REG_W6 = 191, - ARM64_REG_W7 = 192, - ARM64_REG_W8 = 193, - ARM64_REG_W9 = 194, - ARM64_REG_W10 = 195, - ARM64_REG_W11 = 196, - ARM64_REG_W12 = 197, - ARM64_REG_W13 = 198, - ARM64_REG_W14 = 199, - ARM64_REG_W15 = 200, - ARM64_REG_W16 = 201, - ARM64_REG_W17 = 202, - ARM64_REG_W18 = 203, - ARM64_REG_W19 = 204, - ARM64_REG_W20 = 205, - ARM64_REG_W21 = 206, - ARM64_REG_W22 = 207, - ARM64_REG_W23 = 208, - ARM64_REG_W24 = 209, - ARM64_REG_W25 = 210, - ARM64_REG_W26 = 211, - ARM64_REG_W27 = 212, - ARM64_REG_W28 = 213, - ARM64_REG_W29 = 214, - ARM64_REG_W30 = 215, - ARM64_REG_X0 = 216, - ARM64_REG_X1 = 217, - ARM64_REG_X2 = 218, - ARM64_REG_X3 = 219, - ARM64_REG_X4 = 220, - ARM64_REG_X5 = 221, - ARM64_REG_X6 = 222, - ARM64_REG_X7 = 223, - ARM64_REG_X8 = 224, - ARM64_REG_X9 = 225, - ARM64_REG_X10 = 226, - ARM64_REG_X11 = 227, - ARM64_REG_X12 = 228, - ARM64_REG_X13 = 229, - ARM64_REG_X14 = 230, - ARM64_REG_X15 = 231, - ARM64_REG_X16 = 232, - ARM64_REG_X17 = 233, - ARM64_REG_X18 = 234, - ARM64_REG_X19 = 235, - ARM64_REG_X20 = 236, - ARM64_REG_X21 = 237, - ARM64_REG_X22 = 238, - ARM64_REG_X23 = 239, - ARM64_REG_X24 = 240, - ARM64_REG_X25 = 241, - ARM64_REG_X26 = 242, - ARM64_REG_X27 = 243, - ARM64_REG_X28 = 244, - ARM64_REG_Z0 = 245, - ARM64_REG_Z1 = 246, - ARM64_REG_Z2 = 247, - ARM64_REG_Z3 = 248, - ARM64_REG_Z4 = 249, - ARM64_REG_Z5 = 250, - ARM64_REG_Z6 = 251, - ARM64_REG_Z7 = 252, - ARM64_REG_Z8 = 253, - ARM64_REG_Z9 = 254, - ARM64_REG_Z10 = 255, - ARM64_REG_Z11 = 256, - ARM64_REG_Z12 = 257, - ARM64_REG_Z13 = 258, - ARM64_REG_Z14 = 259, - ARM64_REG_Z15 = 260, - ARM64_REG_Z16 = 261, - ARM64_REG_Z17 = 262, - ARM64_REG_Z18 = 263, - ARM64_REG_Z19 = 264, - ARM64_REG_Z20 = 265, - ARM64_REG_Z21 = 266, - ARM64_REG_Z22 = 267, - ARM64_REG_Z23 = 268, - ARM64_REG_Z24 = 269, - ARM64_REG_Z25 = 270, - ARM64_REG_Z26 = 271, - ARM64_REG_Z27 = 272, - ARM64_REG_Z28 = 273, - ARM64_REG_Z29 = 274, - ARM64_REG_Z30 = 275, - ARM64_REG_Z31 = 276, - - ARM64_REG_V0, - ARM64_REG_V1, - ARM64_REG_V2, - ARM64_REG_V3, - ARM64_REG_V4, - ARM64_REG_V5, - ARM64_REG_V6, - ARM64_REG_V7, - ARM64_REG_V8, - ARM64_REG_V9, - ARM64_REG_V10, - ARM64_REG_V11, - ARM64_REG_V12, - ARM64_REG_V13, - ARM64_REG_V14, - ARM64_REG_V15, - ARM64_REG_V16, - ARM64_REG_V17, - ARM64_REG_V18, - ARM64_REG_V19, - ARM64_REG_V20, - ARM64_REG_V21, - ARM64_REG_V22, - ARM64_REG_V23, - ARM64_REG_V24, - ARM64_REG_V25, - ARM64_REG_V26, - ARM64_REG_V27, - ARM64_REG_V28, - ARM64_REG_V29, - ARM64_REG_V30, - ARM64_REG_V31, - - ARM64_REG_ENDING, // <-- mark the end of the list of registers - - // alias registers - ARM64_REG_IP0 = ARM64_REG_X16, - ARM64_REG_IP1 = ARM64_REG_X17, - ARM64_REG_X29 = ARM64_REG_FP, - ARM64_REG_X30 = ARM64_REG_LR, -} arm64_reg; - -/// Instruction's operand referring to memory -/// This is associated with ARM64_OP_MEM operand type above -typedef struct arm64_op_mem { - arm64_reg base; ///< base register - arm64_reg index; ///< index register - int32_t disp; ///< displacement/offset value -} arm64_op_mem; - -/// Instruction operand -typedef struct cs_arm64_op { - int vector_index; ///< Vector Index for some vector operands (or -1 if irrelevant) - arm64_vas vas; ///< Vector Arrangement Specifier - struct { - arm64_shifter type; ///< shifter type of this operand - unsigned int value; ///< shifter value of this operand - } shift; - arm64_extender ext; ///< extender type of this operand - arm64_op_type type; ///< operand type - union { - arm64_reg reg; ///< register value for REG operand - int64_t imm; ///< immediate value, or index for C-IMM or IMM operand - double fp; ///< floating point value for FP operand - arm64_op_mem mem; ///< base/index/scale/disp value for MEM operand - arm64_pstate pstate; ///< PState field of MSR instruction. - unsigned int sys; ///< IC/DC/AT/TLBI operation (see arm64_ic_op, arm64_dc_op, arm64_at_op, arm64_tlbi_op) - arm64_prefetch_op prefetch; ///< PRFM operation. - arm64_barrier_op barrier; ///< Memory barrier operation (ISB/DMB/DSB instructions). - }; - - /// How is this operand accessed? (READ, WRITE or READ|WRITE) - /// This field is combined of cs_ac_type. - /// NOTE: this field is irrelevant if engine is compiled in DIET mode. - uint8_t access; -} cs_arm64_op; - -/// Instruction structure -typedef struct cs_arm64 { - arm64_cc cc; ///< conditional code for this insn - bool update_flags; ///< does this insn update flags? - bool writeback; ///< does this insn request writeback? 'True' means 'yes' - - /// Number of operands of this instruction, - /// or 0 when instruction has no operand. - uint8_t op_count; - - cs_arm64_op operands[8]; ///< operands for this instruction. -} cs_arm64; - -/// ARM64 instruction -typedef enum arm64_insn { - ARM64_INS_INVALID = 0, - - ARM64_INS_ABS, - ARM64_INS_ADC, - ARM64_INS_ADCS, - ARM64_INS_ADD, - ARM64_INS_ADDHN, - ARM64_INS_ADDHN2, - ARM64_INS_ADDP, - ARM64_INS_ADDPL, - ARM64_INS_ADDS, - ARM64_INS_ADDV, - ARM64_INS_ADDVL, - ARM64_INS_ADR, - ARM64_INS_ADRP, - ARM64_INS_AESD, - ARM64_INS_AESE, - ARM64_INS_AESIMC, - ARM64_INS_AESMC, - ARM64_INS_AND, - ARM64_INS_ANDS, - ARM64_INS_ANDV, - ARM64_INS_ASR, - ARM64_INS_ASRD, - ARM64_INS_ASRR, - ARM64_INS_ASRV, - ARM64_INS_AUTDA, - ARM64_INS_AUTDB, - ARM64_INS_AUTDZA, - ARM64_INS_AUTDZB, - ARM64_INS_AUTIA, - ARM64_INS_AUTIA1716, - ARM64_INS_AUTIASP, - ARM64_INS_AUTIAZ, - ARM64_INS_AUTIB, - ARM64_INS_AUTIB1716, - ARM64_INS_AUTIBSP, - ARM64_INS_AUTIBZ, - ARM64_INS_AUTIZA, - ARM64_INS_AUTIZB, - ARM64_INS_B, - ARM64_INS_BCAX, - ARM64_INS_BFM, - ARM64_INS_BIC, - ARM64_INS_BICS, - ARM64_INS_BIF, - ARM64_INS_BIT, - ARM64_INS_BL, - ARM64_INS_BLR, - ARM64_INS_BLRAA, - ARM64_INS_BLRAAZ, - ARM64_INS_BLRAB, - ARM64_INS_BLRABZ, - ARM64_INS_BR, - ARM64_INS_BRAA, - ARM64_INS_BRAAZ, - ARM64_INS_BRAB, - ARM64_INS_BRABZ, - ARM64_INS_BRK, - ARM64_INS_BRKA, - ARM64_INS_BRKAS, - ARM64_INS_BRKB, - ARM64_INS_BRKBS, - ARM64_INS_BRKN, - ARM64_INS_BRKNS, - ARM64_INS_BRKPA, - ARM64_INS_BRKPAS, - ARM64_INS_BRKPB, - ARM64_INS_BRKPBS, - ARM64_INS_BSL, - ARM64_INS_CAS, - ARM64_INS_CASA, - ARM64_INS_CASAB, - ARM64_INS_CASAH, - ARM64_INS_CASAL, - ARM64_INS_CASALB, - ARM64_INS_CASALH, - ARM64_INS_CASB, - ARM64_INS_CASH, - ARM64_INS_CASL, - ARM64_INS_CASLB, - ARM64_INS_CASLH, - ARM64_INS_CASP, - ARM64_INS_CASPA, - ARM64_INS_CASPAL, - ARM64_INS_CASPL, - ARM64_INS_CBNZ, - ARM64_INS_CBZ, - ARM64_INS_CCMN, - ARM64_INS_CCMP, - ARM64_INS_CFINV, - ARM64_INS_CINC, - ARM64_INS_CINV, - ARM64_INS_CLASTA, - ARM64_INS_CLASTB, - ARM64_INS_CLREX, - ARM64_INS_CLS, - ARM64_INS_CLZ, - ARM64_INS_CMEQ, - ARM64_INS_CMGE, - ARM64_INS_CMGT, - ARM64_INS_CMHI, - ARM64_INS_CMHS, - ARM64_INS_CMLE, - ARM64_INS_CMLO, - ARM64_INS_CMLS, - ARM64_INS_CMLT, - ARM64_INS_CMN, - ARM64_INS_CMP, - ARM64_INS_CMPEQ, - ARM64_INS_CMPGE, - ARM64_INS_CMPGT, - ARM64_INS_CMPHI, - ARM64_INS_CMPHS, - ARM64_INS_CMPLE, - ARM64_INS_CMPLO, - ARM64_INS_CMPLS, - ARM64_INS_CMPLT, - ARM64_INS_CMPNE, - ARM64_INS_CMTST, - ARM64_INS_CNEG, - ARM64_INS_CNOT, - ARM64_INS_CNT, - ARM64_INS_CNTB, - ARM64_INS_CNTD, - ARM64_INS_CNTH, - ARM64_INS_CNTP, - ARM64_INS_CNTW, - ARM64_INS_COMPACT, - ARM64_INS_CPY, - ARM64_INS_CRC32B, - ARM64_INS_CRC32CB, - ARM64_INS_CRC32CH, - ARM64_INS_CRC32CW, - ARM64_INS_CRC32CX, - ARM64_INS_CRC32H, - ARM64_INS_CRC32W, - ARM64_INS_CRC32X, - ARM64_INS_CSDB, - ARM64_INS_CSEL, - ARM64_INS_CSET, - ARM64_INS_CSETM, - ARM64_INS_CSINC, - ARM64_INS_CSINV, - ARM64_INS_CSNEG, - ARM64_INS_CTERMEQ, - ARM64_INS_CTERMNE, - ARM64_INS_DCPS1, - ARM64_INS_DCPS2, - ARM64_INS_DCPS3, - ARM64_INS_DECB, - ARM64_INS_DECD, - ARM64_INS_DECH, - ARM64_INS_DECP, - ARM64_INS_DECW, - ARM64_INS_DMB, - ARM64_INS_DRPS, - ARM64_INS_DSB, - ARM64_INS_DUP, - ARM64_INS_DUPM, - ARM64_INS_EON, - ARM64_INS_EOR, - ARM64_INS_EOR3, - ARM64_INS_EORS, - ARM64_INS_EORV, - ARM64_INS_ERET, - ARM64_INS_ERETAA, - ARM64_INS_ERETAB, - ARM64_INS_ESB, - ARM64_INS_EXT, - ARM64_INS_EXTR, - ARM64_INS_FABD, - ARM64_INS_FABS, - ARM64_INS_FACGE, - ARM64_INS_FACGT, - ARM64_INS_FACLE, - ARM64_INS_FACLT, - ARM64_INS_FADD, - ARM64_INS_FADDA, - ARM64_INS_FADDP, - ARM64_INS_FADDV, - ARM64_INS_FCADD, - ARM64_INS_FCCMP, - ARM64_INS_FCCMPE, - ARM64_INS_FCMEQ, - ARM64_INS_FCMGE, - ARM64_INS_FCMGT, - ARM64_INS_FCMLA, - ARM64_INS_FCMLE, - ARM64_INS_FCMLT, - ARM64_INS_FCMNE, - ARM64_INS_FCMP, - ARM64_INS_FCMPE, - ARM64_INS_FCMUO, - ARM64_INS_FCPY, - ARM64_INS_FCSEL, - ARM64_INS_FCVT, - ARM64_INS_FCVTAS, - ARM64_INS_FCVTAU, - ARM64_INS_FCVTL, - ARM64_INS_FCVTL2, - ARM64_INS_FCVTMS, - ARM64_INS_FCVTMU, - ARM64_INS_FCVTN, - ARM64_INS_FCVTN2, - ARM64_INS_FCVTNS, - ARM64_INS_FCVTNU, - ARM64_INS_FCVTPS, - ARM64_INS_FCVTPU, - ARM64_INS_FCVTXN, - ARM64_INS_FCVTXN2, - ARM64_INS_FCVTZS, - ARM64_INS_FCVTZU, - ARM64_INS_FDIV, - ARM64_INS_FDIVR, - ARM64_INS_FDUP, - ARM64_INS_FEXPA, - ARM64_INS_FJCVTZS, - ARM64_INS_FMAD, - ARM64_INS_FMADD, - ARM64_INS_FMAX, - ARM64_INS_FMAXNM, - ARM64_INS_FMAXNMP, - ARM64_INS_FMAXNMV, - ARM64_INS_FMAXP, - ARM64_INS_FMAXV, - ARM64_INS_FMIN, - ARM64_INS_FMINNM, - ARM64_INS_FMINNMP, - ARM64_INS_FMINNMV, - ARM64_INS_FMINP, - ARM64_INS_FMINV, - ARM64_INS_FMLA, - ARM64_INS_FMLS, - ARM64_INS_FMOV, - ARM64_INS_FMSB, - ARM64_INS_FMSUB, - ARM64_INS_FMUL, - ARM64_INS_FMULX, - ARM64_INS_FNEG, - ARM64_INS_FNMAD, - ARM64_INS_FNMADD, - ARM64_INS_FNMLA, - ARM64_INS_FNMLS, - ARM64_INS_FNMSB, - ARM64_INS_FNMSUB, - ARM64_INS_FNMUL, - ARM64_INS_FRECPE, - ARM64_INS_FRECPS, - ARM64_INS_FRECPX, - ARM64_INS_FRINTA, - ARM64_INS_FRINTI, - ARM64_INS_FRINTM, - ARM64_INS_FRINTN, - ARM64_INS_FRINTP, - ARM64_INS_FRINTX, - ARM64_INS_FRINTZ, - ARM64_INS_FRSQRTE, - ARM64_INS_FRSQRTS, - ARM64_INS_FSCALE, - ARM64_INS_FSQRT, - ARM64_INS_FSUB, - ARM64_INS_FSUBR, - ARM64_INS_FTMAD, - ARM64_INS_FTSMUL, - ARM64_INS_FTSSEL, - ARM64_INS_HINT, - ARM64_INS_HLT, - ARM64_INS_HVC, - ARM64_INS_INCB, - ARM64_INS_INCD, - ARM64_INS_INCH, - ARM64_INS_INCP, - ARM64_INS_INCW, - ARM64_INS_INDEX, - ARM64_INS_INS, - ARM64_INS_INSR, - ARM64_INS_ISB, - ARM64_INS_LASTA, - ARM64_INS_LASTB, - ARM64_INS_LD1, - ARM64_INS_LD1B, - ARM64_INS_LD1D, - ARM64_INS_LD1H, - ARM64_INS_LD1R, - ARM64_INS_LD1RB, - ARM64_INS_LD1RD, - ARM64_INS_LD1RH, - ARM64_INS_LD1RQB, - ARM64_INS_LD1RQD, - ARM64_INS_LD1RQH, - ARM64_INS_LD1RQW, - ARM64_INS_LD1RSB, - ARM64_INS_LD1RSH, - ARM64_INS_LD1RSW, - ARM64_INS_LD1RW, - ARM64_INS_LD1SB, - ARM64_INS_LD1SH, - ARM64_INS_LD1SW, - ARM64_INS_LD1W, - ARM64_INS_LD2, - ARM64_INS_LD2B, - ARM64_INS_LD2D, - ARM64_INS_LD2H, - ARM64_INS_LD2R, - ARM64_INS_LD2W, - ARM64_INS_LD3, - ARM64_INS_LD3B, - ARM64_INS_LD3D, - ARM64_INS_LD3H, - ARM64_INS_LD3R, - ARM64_INS_LD3W, - ARM64_INS_LD4, - ARM64_INS_LD4B, - ARM64_INS_LD4D, - ARM64_INS_LD4H, - ARM64_INS_LD4R, - ARM64_INS_LD4W, - ARM64_INS_LDADD, - ARM64_INS_LDADDA, - ARM64_INS_LDADDAB, - ARM64_INS_LDADDAH, - ARM64_INS_LDADDAL, - ARM64_INS_LDADDALB, - ARM64_INS_LDADDALH, - ARM64_INS_LDADDB, - ARM64_INS_LDADDH, - ARM64_INS_LDADDL, - ARM64_INS_LDADDLB, - ARM64_INS_LDADDLH, - ARM64_INS_LDAPR, - ARM64_INS_LDAPRB, - ARM64_INS_LDAPRH, - ARM64_INS_LDAPUR, - ARM64_INS_LDAPURB, - ARM64_INS_LDAPURH, - ARM64_INS_LDAPURSB, - ARM64_INS_LDAPURSH, - ARM64_INS_LDAPURSW, - ARM64_INS_LDAR, - ARM64_INS_LDARB, - ARM64_INS_LDARH, - ARM64_INS_LDAXP, - ARM64_INS_LDAXR, - ARM64_INS_LDAXRB, - ARM64_INS_LDAXRH, - ARM64_INS_LDCLR, - ARM64_INS_LDCLRA, - ARM64_INS_LDCLRAB, - ARM64_INS_LDCLRAH, - ARM64_INS_LDCLRAL, - ARM64_INS_LDCLRALB, - ARM64_INS_LDCLRALH, - ARM64_INS_LDCLRB, - ARM64_INS_LDCLRH, - ARM64_INS_LDCLRL, - ARM64_INS_LDCLRLB, - ARM64_INS_LDCLRLH, - ARM64_INS_LDEOR, - ARM64_INS_LDEORA, - ARM64_INS_LDEORAB, - ARM64_INS_LDEORAH, - ARM64_INS_LDEORAL, - ARM64_INS_LDEORALB, - ARM64_INS_LDEORALH, - ARM64_INS_LDEORB, - ARM64_INS_LDEORH, - ARM64_INS_LDEORL, - ARM64_INS_LDEORLB, - ARM64_INS_LDEORLH, - ARM64_INS_LDFF1B, - ARM64_INS_LDFF1D, - ARM64_INS_LDFF1H, - ARM64_INS_LDFF1SB, - ARM64_INS_LDFF1SH, - ARM64_INS_LDFF1SW, - ARM64_INS_LDFF1W, - ARM64_INS_LDLAR, - ARM64_INS_LDLARB, - ARM64_INS_LDLARH, - ARM64_INS_LDNF1B, - ARM64_INS_LDNF1D, - ARM64_INS_LDNF1H, - ARM64_INS_LDNF1SB, - ARM64_INS_LDNF1SH, - ARM64_INS_LDNF1SW, - ARM64_INS_LDNF1W, - ARM64_INS_LDNP, - ARM64_INS_LDNT1B, - ARM64_INS_LDNT1D, - ARM64_INS_LDNT1H, - ARM64_INS_LDNT1W, - ARM64_INS_LDP, - ARM64_INS_LDPSW, - ARM64_INS_LDR, - ARM64_INS_LDRAA, - ARM64_INS_LDRAB, - ARM64_INS_LDRB, - ARM64_INS_LDRH, - ARM64_INS_LDRSB, - ARM64_INS_LDRSH, - ARM64_INS_LDRSW, - ARM64_INS_LDSET, - ARM64_INS_LDSETA, - ARM64_INS_LDSETAB, - ARM64_INS_LDSETAH, - ARM64_INS_LDSETAL, - ARM64_INS_LDSETALB, - ARM64_INS_LDSETALH, - ARM64_INS_LDSETB, - ARM64_INS_LDSETH, - ARM64_INS_LDSETL, - ARM64_INS_LDSETLB, - ARM64_INS_LDSETLH, - ARM64_INS_LDSMAX, - ARM64_INS_LDSMAXA, - ARM64_INS_LDSMAXAB, - ARM64_INS_LDSMAXAH, - ARM64_INS_LDSMAXAL, - ARM64_INS_LDSMAXALB, - ARM64_INS_LDSMAXALH, - ARM64_INS_LDSMAXB, - ARM64_INS_LDSMAXH, - ARM64_INS_LDSMAXL, - ARM64_INS_LDSMAXLB, - ARM64_INS_LDSMAXLH, - ARM64_INS_LDSMIN, - ARM64_INS_LDSMINA, - ARM64_INS_LDSMINAB, - ARM64_INS_LDSMINAH, - ARM64_INS_LDSMINAL, - ARM64_INS_LDSMINALB, - ARM64_INS_LDSMINALH, - ARM64_INS_LDSMINB, - ARM64_INS_LDSMINH, - ARM64_INS_LDSMINL, - ARM64_INS_LDSMINLB, - ARM64_INS_LDSMINLH, - ARM64_INS_LDTR, - ARM64_INS_LDTRB, - ARM64_INS_LDTRH, - ARM64_INS_LDTRSB, - ARM64_INS_LDTRSH, - ARM64_INS_LDTRSW, - ARM64_INS_LDUMAX, - ARM64_INS_LDUMAXA, - ARM64_INS_LDUMAXAB, - ARM64_INS_LDUMAXAH, - ARM64_INS_LDUMAXAL, - ARM64_INS_LDUMAXALB, - ARM64_INS_LDUMAXALH, - ARM64_INS_LDUMAXB, - ARM64_INS_LDUMAXH, - ARM64_INS_LDUMAXL, - ARM64_INS_LDUMAXLB, - ARM64_INS_LDUMAXLH, - ARM64_INS_LDUMIN, - ARM64_INS_LDUMINA, - ARM64_INS_LDUMINAB, - ARM64_INS_LDUMINAH, - ARM64_INS_LDUMINAL, - ARM64_INS_LDUMINALB, - ARM64_INS_LDUMINALH, - ARM64_INS_LDUMINB, - ARM64_INS_LDUMINH, - ARM64_INS_LDUMINL, - ARM64_INS_LDUMINLB, - ARM64_INS_LDUMINLH, - ARM64_INS_LDUR, - ARM64_INS_LDURB, - ARM64_INS_LDURH, - ARM64_INS_LDURSB, - ARM64_INS_LDURSH, - ARM64_INS_LDURSW, - ARM64_INS_LDXP, - ARM64_INS_LDXR, - ARM64_INS_LDXRB, - ARM64_INS_LDXRH, - ARM64_INS_LSL, - ARM64_INS_LSLR, - ARM64_INS_LSLV, - ARM64_INS_LSR, - ARM64_INS_LSRR, - ARM64_INS_LSRV, - ARM64_INS_MAD, - ARM64_INS_MADD, - ARM64_INS_MLA, - ARM64_INS_MLS, - ARM64_INS_MNEG, - ARM64_INS_MOV, - ARM64_INS_MOVI, - ARM64_INS_MOVK, - ARM64_INS_MOVN, - ARM64_INS_MOVPRFX, - ARM64_INS_MOVS, - ARM64_INS_MOVZ, - ARM64_INS_MRS, - ARM64_INS_MSB, - ARM64_INS_MSR, - ARM64_INS_MSUB, - ARM64_INS_MUL, - ARM64_INS_MVN, - ARM64_INS_MVNI, - ARM64_INS_NAND, - ARM64_INS_NANDS, - ARM64_INS_NEG, - ARM64_INS_NEGS, - ARM64_INS_NGC, - ARM64_INS_NGCS, - ARM64_INS_NOP, - ARM64_INS_NOR, - ARM64_INS_NORS, - ARM64_INS_NOT, - ARM64_INS_NOTS, - ARM64_INS_ORN, - ARM64_INS_ORNS, - ARM64_INS_ORR, - ARM64_INS_ORRS, - ARM64_INS_ORV, - ARM64_INS_PACDA, - ARM64_INS_PACDB, - ARM64_INS_PACDZA, - ARM64_INS_PACDZB, - ARM64_INS_PACGA, - ARM64_INS_PACIA, - ARM64_INS_PACIA1716, - ARM64_INS_PACIASP, - ARM64_INS_PACIAZ, - ARM64_INS_PACIB, - ARM64_INS_PACIB1716, - ARM64_INS_PACIBSP, - ARM64_INS_PACIBZ, - ARM64_INS_PACIZA, - ARM64_INS_PACIZB, - ARM64_INS_PFALSE, - ARM64_INS_PFIRST, - ARM64_INS_PMUL, - ARM64_INS_PMULL, - ARM64_INS_PMULL2, - ARM64_INS_PNEXT, - ARM64_INS_PRFB, - ARM64_INS_PRFD, - ARM64_INS_PRFH, - ARM64_INS_PRFM, - ARM64_INS_PRFUM, - ARM64_INS_PRFW, - ARM64_INS_PSB, - ARM64_INS_PTEST, - ARM64_INS_PTRUE, - ARM64_INS_PTRUES, - ARM64_INS_PUNPKHI, - ARM64_INS_PUNPKLO, - ARM64_INS_RADDHN, - ARM64_INS_RADDHN2, - ARM64_INS_RAX1, - ARM64_INS_RBIT, - ARM64_INS_RDFFR, - ARM64_INS_RDFFRS, - ARM64_INS_RDVL, - ARM64_INS_RET, - ARM64_INS_RETAA, - ARM64_INS_RETAB, - ARM64_INS_REV, - ARM64_INS_REV16, - ARM64_INS_REV32, - ARM64_INS_REV64, - ARM64_INS_REVB, - ARM64_INS_REVH, - ARM64_INS_REVW, - ARM64_INS_RMIF, - ARM64_INS_ROR, - ARM64_INS_RORV, - ARM64_INS_RSHRN, - ARM64_INS_RSHRN2, - ARM64_INS_RSUBHN, - ARM64_INS_RSUBHN2, - ARM64_INS_SABA, - ARM64_INS_SABAL, - ARM64_INS_SABAL2, - ARM64_INS_SABD, - ARM64_INS_SABDL, - ARM64_INS_SABDL2, - ARM64_INS_SADALP, - ARM64_INS_SADDL, - ARM64_INS_SADDL2, - ARM64_INS_SADDLP, - ARM64_INS_SADDLV, - ARM64_INS_SADDV, - ARM64_INS_SADDW, - ARM64_INS_SADDW2, - ARM64_INS_SBC, - ARM64_INS_SBCS, - ARM64_INS_SBFM, - ARM64_INS_SCVTF, - ARM64_INS_SDIV, - ARM64_INS_SDIVR, - ARM64_INS_SDOT, - ARM64_INS_SEL, - ARM64_INS_SETF16, - ARM64_INS_SETF8, - ARM64_INS_SETFFR, - ARM64_INS_SEV, - ARM64_INS_SEVL, - ARM64_INS_SHA1C, - ARM64_INS_SHA1H, - ARM64_INS_SHA1M, - ARM64_INS_SHA1P, - ARM64_INS_SHA1SU0, - ARM64_INS_SHA1SU1, - ARM64_INS_SHA256H, - ARM64_INS_SHA256H2, - ARM64_INS_SHA256SU0, - ARM64_INS_SHA256SU1, - ARM64_INS_SHA512H, - ARM64_INS_SHA512H2, - ARM64_INS_SHA512SU0, - ARM64_INS_SHA512SU1, - ARM64_INS_SHADD, - ARM64_INS_SHL, - ARM64_INS_SHLL, - ARM64_INS_SHLL2, - ARM64_INS_SHRN, - ARM64_INS_SHRN2, - ARM64_INS_SHSUB, - ARM64_INS_SLI, - ARM64_INS_SM3PARTW1, - ARM64_INS_SM3PARTW2, - ARM64_INS_SM3SS1, - ARM64_INS_SM3TT1A, - ARM64_INS_SM3TT1B, - ARM64_INS_SM3TT2A, - ARM64_INS_SM3TT2B, - ARM64_INS_SM4E, - ARM64_INS_SM4EKEY, - ARM64_INS_SMADDL, - ARM64_INS_SMAX, - ARM64_INS_SMAXP, - ARM64_INS_SMAXV, - ARM64_INS_SMC, - ARM64_INS_SMIN, - ARM64_INS_SMINP, - ARM64_INS_SMINV, - ARM64_INS_SMLAL, - ARM64_INS_SMLAL2, - ARM64_INS_SMLSL, - ARM64_INS_SMLSL2, - ARM64_INS_SMNEGL, - ARM64_INS_SMOV, - ARM64_INS_SMSUBL, - ARM64_INS_SMULH, - ARM64_INS_SMULL, - ARM64_INS_SMULL2, - ARM64_INS_SPLICE, - ARM64_INS_SQABS, - ARM64_INS_SQADD, - ARM64_INS_SQDECB, - ARM64_INS_SQDECD, - ARM64_INS_SQDECH, - ARM64_INS_SQDECP, - ARM64_INS_SQDECW, - ARM64_INS_SQDMLAL, - ARM64_INS_SQDMLAL2, - ARM64_INS_SQDMLSL, - ARM64_INS_SQDMLSL2, - ARM64_INS_SQDMULH, - ARM64_INS_SQDMULL, - ARM64_INS_SQDMULL2, - ARM64_INS_SQINCB, - ARM64_INS_SQINCD, - ARM64_INS_SQINCH, - ARM64_INS_SQINCP, - ARM64_INS_SQINCW, - ARM64_INS_SQNEG, - ARM64_INS_SQRDMLAH, - ARM64_INS_SQRDMLSH, - ARM64_INS_SQRDMULH, - ARM64_INS_SQRSHL, - ARM64_INS_SQRSHRN, - ARM64_INS_SQRSHRN2, - ARM64_INS_SQRSHRUN, - ARM64_INS_SQRSHRUN2, - ARM64_INS_SQSHL, - ARM64_INS_SQSHLU, - ARM64_INS_SQSHRN, - ARM64_INS_SQSHRN2, - ARM64_INS_SQSHRUN, - ARM64_INS_SQSHRUN2, - ARM64_INS_SQSUB, - ARM64_INS_SQXTN, - ARM64_INS_SQXTN2, - ARM64_INS_SQXTUN, - ARM64_INS_SQXTUN2, - ARM64_INS_SRHADD, - ARM64_INS_SRI, - ARM64_INS_SRSHL, - ARM64_INS_SRSHR, - ARM64_INS_SRSRA, - ARM64_INS_SSHL, - ARM64_INS_SSHLL, - ARM64_INS_SSHLL2, - ARM64_INS_SSHR, - ARM64_INS_SSRA, - ARM64_INS_SSUBL, - ARM64_INS_SSUBL2, - ARM64_INS_SSUBW, - ARM64_INS_SSUBW2, - ARM64_INS_ST1, - ARM64_INS_ST1B, - ARM64_INS_ST1D, - ARM64_INS_ST1H, - ARM64_INS_ST1W, - ARM64_INS_ST2, - ARM64_INS_ST2B, - ARM64_INS_ST2D, - ARM64_INS_ST2H, - ARM64_INS_ST2W, - ARM64_INS_ST3, - ARM64_INS_ST3B, - ARM64_INS_ST3D, - ARM64_INS_ST3H, - ARM64_INS_ST3W, - ARM64_INS_ST4, - ARM64_INS_ST4B, - ARM64_INS_ST4D, - ARM64_INS_ST4H, - ARM64_INS_ST4W, - ARM64_INS_STADD, - ARM64_INS_STADDB, - ARM64_INS_STADDH, - ARM64_INS_STADDL, - ARM64_INS_STADDLB, - ARM64_INS_STADDLH, - ARM64_INS_STCLR, - ARM64_INS_STCLRB, - ARM64_INS_STCLRH, - ARM64_INS_STCLRL, - ARM64_INS_STCLRLB, - ARM64_INS_STCLRLH, - ARM64_INS_STEOR, - ARM64_INS_STEORB, - ARM64_INS_STEORH, - ARM64_INS_STEORL, - ARM64_INS_STEORLB, - ARM64_INS_STEORLH, - ARM64_INS_STLLR, - ARM64_INS_STLLRB, - ARM64_INS_STLLRH, - ARM64_INS_STLR, - ARM64_INS_STLRB, - ARM64_INS_STLRH, - ARM64_INS_STLUR, - ARM64_INS_STLURB, - ARM64_INS_STLURH, - ARM64_INS_STLXP, - ARM64_INS_STLXR, - ARM64_INS_STLXRB, - ARM64_INS_STLXRH, - ARM64_INS_STNP, - ARM64_INS_STNT1B, - ARM64_INS_STNT1D, - ARM64_INS_STNT1H, - ARM64_INS_STNT1W, - ARM64_INS_STP, - ARM64_INS_STR, - ARM64_INS_STRB, - ARM64_INS_STRH, - ARM64_INS_STSET, - ARM64_INS_STSETB, - ARM64_INS_STSETH, - ARM64_INS_STSETL, - ARM64_INS_STSETLB, - ARM64_INS_STSETLH, - ARM64_INS_STSMAX, - ARM64_INS_STSMAXB, - ARM64_INS_STSMAXH, - ARM64_INS_STSMAXL, - ARM64_INS_STSMAXLB, - ARM64_INS_STSMAXLH, - ARM64_INS_STSMIN, - ARM64_INS_STSMINB, - ARM64_INS_STSMINH, - ARM64_INS_STSMINL, - ARM64_INS_STSMINLB, - ARM64_INS_STSMINLH, - ARM64_INS_STTR, - ARM64_INS_STTRB, - ARM64_INS_STTRH, - ARM64_INS_STUMAX, - ARM64_INS_STUMAXB, - ARM64_INS_STUMAXH, - ARM64_INS_STUMAXL, - ARM64_INS_STUMAXLB, - ARM64_INS_STUMAXLH, - ARM64_INS_STUMIN, - ARM64_INS_STUMINB, - ARM64_INS_STUMINH, - ARM64_INS_STUMINL, - ARM64_INS_STUMINLB, - ARM64_INS_STUMINLH, - ARM64_INS_STUR, - ARM64_INS_STURB, - ARM64_INS_STURH, - ARM64_INS_STXP, - ARM64_INS_STXR, - ARM64_INS_STXRB, - ARM64_INS_STXRH, - ARM64_INS_SUB, - ARM64_INS_SUBHN, - ARM64_INS_SUBHN2, - ARM64_INS_SUBR, - ARM64_INS_SUBS, - ARM64_INS_SUNPKHI, - ARM64_INS_SUNPKLO, - ARM64_INS_SUQADD, - ARM64_INS_SVC, - ARM64_INS_SWP, - ARM64_INS_SWPA, - ARM64_INS_SWPAB, - ARM64_INS_SWPAH, - ARM64_INS_SWPAL, - ARM64_INS_SWPALB, - ARM64_INS_SWPALH, - ARM64_INS_SWPB, - ARM64_INS_SWPH, - ARM64_INS_SWPL, - ARM64_INS_SWPLB, - ARM64_INS_SWPLH, - ARM64_INS_SXTB, - ARM64_INS_SXTH, - ARM64_INS_SXTL, - ARM64_INS_SXTL2, - ARM64_INS_SXTW, - ARM64_INS_SYS, - ARM64_INS_SYSL, - ARM64_INS_TBL, - ARM64_INS_TBNZ, - ARM64_INS_TBX, - ARM64_INS_TBZ, - ARM64_INS_TRN1, - ARM64_INS_TRN2, - ARM64_INS_TSB, - ARM64_INS_TST, - ARM64_INS_UABA, - ARM64_INS_UABAL, - ARM64_INS_UABAL2, - ARM64_INS_UABD, - ARM64_INS_UABDL, - ARM64_INS_UABDL2, - ARM64_INS_UADALP, - ARM64_INS_UADDL, - ARM64_INS_UADDL2, - ARM64_INS_UADDLP, - ARM64_INS_UADDLV, - ARM64_INS_UADDV, - ARM64_INS_UADDW, - ARM64_INS_UADDW2, - ARM64_INS_UBFM, - ARM64_INS_UCVTF, - ARM64_INS_UDIV, - ARM64_INS_UDIVR, - ARM64_INS_UDOT, - ARM64_INS_UHADD, - ARM64_INS_UHSUB, - ARM64_INS_UMADDL, - ARM64_INS_UMAX, - ARM64_INS_UMAXP, - ARM64_INS_UMAXV, - ARM64_INS_UMIN, - ARM64_INS_UMINP, - ARM64_INS_UMINV, - ARM64_INS_UMLAL, - ARM64_INS_UMLAL2, - ARM64_INS_UMLSL, - ARM64_INS_UMLSL2, - ARM64_INS_UMNEGL, - ARM64_INS_UMOV, - ARM64_INS_UMSUBL, - ARM64_INS_UMULH, - ARM64_INS_UMULL, - ARM64_INS_UMULL2, - ARM64_INS_UQADD, - ARM64_INS_UQDECB, - ARM64_INS_UQDECD, - ARM64_INS_UQDECH, - ARM64_INS_UQDECP, - ARM64_INS_UQDECW, - ARM64_INS_UQINCB, - ARM64_INS_UQINCD, - ARM64_INS_UQINCH, - ARM64_INS_UQINCP, - ARM64_INS_UQINCW, - ARM64_INS_UQRSHL, - ARM64_INS_UQRSHRN, - ARM64_INS_UQRSHRN2, - ARM64_INS_UQSHL, - ARM64_INS_UQSHRN, - ARM64_INS_UQSHRN2, - ARM64_INS_UQSUB, - ARM64_INS_UQXTN, - ARM64_INS_UQXTN2, - ARM64_INS_URECPE, - ARM64_INS_URHADD, - ARM64_INS_URSHL, - ARM64_INS_URSHR, - ARM64_INS_URSQRTE, - ARM64_INS_URSRA, - ARM64_INS_USHL, - ARM64_INS_USHLL, - ARM64_INS_USHLL2, - ARM64_INS_USHR, - ARM64_INS_USQADD, - ARM64_INS_USRA, - ARM64_INS_USUBL, - ARM64_INS_USUBL2, - ARM64_INS_USUBW, - ARM64_INS_USUBW2, - ARM64_INS_UUNPKHI, - ARM64_INS_UUNPKLO, - ARM64_INS_UXTB, - ARM64_INS_UXTH, - ARM64_INS_UXTL, - ARM64_INS_UXTL2, - ARM64_INS_UXTW, - ARM64_INS_UZP1, - ARM64_INS_UZP2, - ARM64_INS_WFE, - ARM64_INS_WFI, - ARM64_INS_WHILELE, - ARM64_INS_WHILELO, - ARM64_INS_WHILELS, - ARM64_INS_WHILELT, - ARM64_INS_WRFFR, - ARM64_INS_XAR, - ARM64_INS_XPACD, - ARM64_INS_XPACI, - ARM64_INS_XPACLRI, - ARM64_INS_XTN, - ARM64_INS_XTN2, - ARM64_INS_YIELD, - ARM64_INS_ZIP1, - ARM64_INS_ZIP2, - - // alias insn - ARM64_INS_SBFIZ, - ARM64_INS_UBFIZ, - ARM64_INS_SBFX, - ARM64_INS_UBFX, - ARM64_INS_BFI, - ARM64_INS_BFXIL, - ARM64_INS_IC, - ARM64_INS_DC, - ARM64_INS_AT, - ARM64_INS_TLBI, - - ARM64_INS_ENDING, // <-- mark the end of the list of insn -} arm64_insn; - -/// Group of ARM64 instructions -typedef enum arm64_insn_group { - ARM64_GRP_INVALID = 0, ///< = CS_GRP_INVALID - - // Generic groups - // all jump instructions (conditional+direct+indirect jumps) - ARM64_GRP_JUMP, ///< = CS_GRP_JUMP - ARM64_GRP_CALL, - ARM64_GRP_RET, - ARM64_GRP_INT, - ARM64_GRP_PRIVILEGE = 6, ///< = CS_GRP_PRIVILEGE - ARM64_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE - ARM64_GRP_PAC, - - // Architecture-specific groups - ARM64_GRP_CRYPTO = 128, - ARM64_GRP_FPARMV8, - ARM64_GRP_NEON, - ARM64_GRP_CRC, - ARM64_GRP_AES, - ARM64_GRP_DOTPROD, - ARM64_GRP_FULLFP16, - ARM64_GRP_LSE, - ARM64_GRP_RCPC, - ARM64_GRP_RDM, - ARM64_GRP_SHA2, - ARM64_GRP_SHA3, - ARM64_GRP_SM4, - ARM64_GRP_SVE, - ARM64_GRP_V8_1A, - ARM64_GRP_V8_3A, - ARM64_GRP_V8_4A, - - ARM64_GRP_ENDING, // <-- mark the end of the list of groups -} arm64_insn_group; - -#ifdef __cplusplus -} -#endif - -#endif -#ifndef CAPSTONE_M68K_H -#define CAPSTONE_M68K_H - -/* Capstone Disassembly Engine */ -/* By Daniel Collin , 2015-2016 */ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif - -#define M68K_OPERAND_COUNT 4 - -/// M68K registers and special registers -typedef enum m68k_reg { - M68K_REG_INVALID = 0, - - M68K_REG_D0, - M68K_REG_D1, - M68K_REG_D2, - M68K_REG_D3, - M68K_REG_D4, - M68K_REG_D5, - M68K_REG_D6, - M68K_REG_D7, - - M68K_REG_A0, - M68K_REG_A1, - M68K_REG_A2, - M68K_REG_A3, - M68K_REG_A4, - M68K_REG_A5, - M68K_REG_A6, - M68K_REG_A7, - - M68K_REG_FP0, - M68K_REG_FP1, - M68K_REG_FP2, - M68K_REG_FP3, - M68K_REG_FP4, - M68K_REG_FP5, - M68K_REG_FP6, - M68K_REG_FP7, - - M68K_REG_PC, - - M68K_REG_SR, - M68K_REG_CCR, - M68K_REG_SFC, - M68K_REG_DFC, - M68K_REG_USP, - M68K_REG_VBR, - M68K_REG_CACR, - M68K_REG_CAAR, - M68K_REG_MSP, - M68K_REG_ISP, - M68K_REG_TC, - M68K_REG_ITT0, - M68K_REG_ITT1, - M68K_REG_DTT0, - M68K_REG_DTT1, - M68K_REG_MMUSR, - M68K_REG_URP, - M68K_REG_SRP, - - M68K_REG_FPCR, - M68K_REG_FPSR, - M68K_REG_FPIAR, - - M68K_REG_ENDING, // <-- mark the end of the list of registers -} m68k_reg; - -/// M68K Addressing Modes -typedef enum m68k_address_mode { - M68K_AM_NONE = 0, ///< No address mode. - - M68K_AM_REG_DIRECT_DATA, ///< Register Direct - Data - M68K_AM_REG_DIRECT_ADDR, ///< Register Direct - Address - - M68K_AM_REGI_ADDR, ///< Register Indirect - Address - M68K_AM_REGI_ADDR_POST_INC, ///< Register Indirect - Address with Postincrement - M68K_AM_REGI_ADDR_PRE_DEC, ///< Register Indirect - Address with Predecrement - M68K_AM_REGI_ADDR_DISP, ///< Register Indirect - Address with Displacement - - M68K_AM_AREGI_INDEX_8_BIT_DISP, ///< Address Register Indirect With Index- 8-bit displacement - M68K_AM_AREGI_INDEX_BASE_DISP, ///< Address Register Indirect With Index- Base displacement - - M68K_AM_MEMI_POST_INDEX, ///< Memory indirect - Postindex - M68K_AM_MEMI_PRE_INDEX, ///< Memory indirect - Preindex - - M68K_AM_PCI_DISP, ///< Program Counter Indirect - with Displacement - - M68K_AM_PCI_INDEX_8_BIT_DISP, ///< Program Counter Indirect with Index - with 8-Bit Displacement - M68K_AM_PCI_INDEX_BASE_DISP, ///< Program Counter Indirect with Index - with Base Displacement - - M68K_AM_PC_MEMI_POST_INDEX, ///< Program Counter Memory Indirect - Postindexed - M68K_AM_PC_MEMI_PRE_INDEX, ///< Program Counter Memory Indirect - Preindexed - - M68K_AM_ABSOLUTE_DATA_SHORT, ///< Absolute Data Addressing - Short - M68K_AM_ABSOLUTE_DATA_LONG, ///< Absolute Data Addressing - Long - M68K_AM_IMMEDIATE, ///< Immediate value - - M68K_AM_BRANCH_DISPLACEMENT, ///< Address as displacement from (PC+2) used by branches -} m68k_address_mode; - -/// Operand type for instruction's operands -typedef enum m68k_op_type { - M68K_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - M68K_OP_REG, ///< = CS_OP_REG (Register operand). - M68K_OP_IMM, ///< = CS_OP_IMM (Immediate operand). - M68K_OP_MEM, ///< = CS_OP_MEM (Memory operand). - M68K_OP_FP_SINGLE, ///< single precision Floating-Point operand - M68K_OP_FP_DOUBLE, ///< double precision Floating-Point operand - M68K_OP_REG_BITS, ///< Register bits move - M68K_OP_REG_PAIR, ///< Register pair in the same op (upper 4 bits for first reg, lower for second) - M68K_OP_BR_DISP, ///< Branch displacement -} m68k_op_type; - -/// Instruction's operand referring to memory -/// This is associated with M68K_OP_MEM operand type above -typedef struct m68k_op_mem { - m68k_reg base_reg; ///< base register (or M68K_REG_INVALID if irrelevant) - m68k_reg index_reg; ///< index register (or M68K_REG_INVALID if irrelevant) - m68k_reg in_base_reg; ///< indirect base register (or M68K_REG_INVALID if irrelevant) - uint32_t in_disp; ///< indirect displacement - uint32_t out_disp; ///< other displacement - int16_t disp; ///< displacement value - uint8_t scale; ///< scale for index register - uint8_t bitfield; ///< set to true if the two values below should be used - uint8_t width; ///< used for bf* instructions - uint8_t offset; ///< used for bf* instructions - uint8_t index_size; ///< 0 = w, 1 = l -} m68k_op_mem; - -/// Operand type for instruction's operands -typedef enum m68k_op_br_disp_size { - M68K_OP_BR_DISP_SIZE_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - M68K_OP_BR_DISP_SIZE_BYTE = 1, ///< signed 8-bit displacement - M68K_OP_BR_DISP_SIZE_WORD = 2, ///< signed 16-bit displacement - M68K_OP_BR_DISP_SIZE_LONG = 4, ///< signed 32-bit displacement -} m68k_op_br_disp_size; - -typedef struct m68k_op_br_disp { - int32_t disp; ///< displacement value - uint8_t disp_size; ///< Size from m68k_op_br_disp_size type above -} m68k_op_br_disp; - -/// Register pair in one operand. -typedef struct cs_m68k_op_reg_pair { - m68k_reg reg_0; - m68k_reg reg_1; -} cs_m68k_op_reg_pair; - -/// Instruction operand -typedef struct cs_m68k_op { - union { - uint64_t imm; ///< immediate value for IMM operand - double dimm; ///< double imm - float simm; ///< float imm - m68k_reg reg; ///< register value for REG operand - cs_m68k_op_reg_pair reg_pair; ///< register pair in one operand - }; - - m68k_op_mem mem; ///< data when operand is targeting memory - m68k_op_br_disp br_disp; ///< data when operand is a branch displacement - uint32_t register_bits; ///< register bits for movem etc. (always in d0-d7, a0-a7, fp0 - fp7 order) - m68k_op_type type; - m68k_address_mode address_mode; ///< M68K addressing mode for this op -} cs_m68k_op; - -/// Operation size of the CPU instructions -typedef enum m68k_cpu_size { - M68K_CPU_SIZE_NONE = 0, ///< unsized or unspecified - M68K_CPU_SIZE_BYTE = 1, ///< 1 byte in size - M68K_CPU_SIZE_WORD = 2, ///< 2 bytes in size - M68K_CPU_SIZE_LONG = 4, ///< 4 bytes in size -} m68k_cpu_size; - -/// Operation size of the FPU instructions (Notice that FPU instruction can also use CPU sizes if needed) -typedef enum m68k_fpu_size { - M68K_FPU_SIZE_NONE = 0, ///< unsized like fsave/frestore - M68K_FPU_SIZE_SINGLE = 4, ///< 4 byte in size (single float) - M68K_FPU_SIZE_DOUBLE = 8, ///< 8 byte in size (double) - M68K_FPU_SIZE_EXTENDED = 12, ///< 12 byte in size (extended real format) -} m68k_fpu_size; - -/// Type of size that is being used for the current instruction -typedef enum m68k_size_type { - M68K_SIZE_TYPE_INVALID = 0, - - M68K_SIZE_TYPE_CPU, - M68K_SIZE_TYPE_FPU, -} m68k_size_type; - -/// Operation size of the current instruction (NOT the actually size of instruction) -typedef struct m68k_op_size { - m68k_size_type type; - union { - m68k_cpu_size cpu_size; - m68k_fpu_size fpu_size; - }; -} m68k_op_size; - -/// The M68K instruction and it's operands -typedef struct cs_m68k { - // Number of operands of this instruction or 0 when instruction has no operand. - cs_m68k_op operands[M68K_OPERAND_COUNT]; ///< operands for this instruction. - m68k_op_size op_size; ///< size of data operand works on in bytes (.b, .w, .l, etc) - uint8_t op_count; ///< number of operands for the instruction -} cs_m68k; - -/// M68K instruction -typedef enum m68k_insn { - M68K_INS_INVALID = 0, - - M68K_INS_ABCD, - M68K_INS_ADD, - M68K_INS_ADDA, - M68K_INS_ADDI, - M68K_INS_ADDQ, - M68K_INS_ADDX, - M68K_INS_AND, - M68K_INS_ANDI, - M68K_INS_ASL, - M68K_INS_ASR, - M68K_INS_BHS, - M68K_INS_BLO, - M68K_INS_BHI, - M68K_INS_BLS, - M68K_INS_BCC, - M68K_INS_BCS, - M68K_INS_BNE, - M68K_INS_BEQ, - M68K_INS_BVC, - M68K_INS_BVS, - M68K_INS_BPL, - M68K_INS_BMI, - M68K_INS_BGE, - M68K_INS_BLT, - M68K_INS_BGT, - M68K_INS_BLE, - M68K_INS_BRA, - M68K_INS_BSR, - M68K_INS_BCHG, - M68K_INS_BCLR, - M68K_INS_BSET, - M68K_INS_BTST, - M68K_INS_BFCHG, - M68K_INS_BFCLR, - M68K_INS_BFEXTS, - M68K_INS_BFEXTU, - M68K_INS_BFFFO, - M68K_INS_BFINS, - M68K_INS_BFSET, - M68K_INS_BFTST, - M68K_INS_BKPT, - M68K_INS_CALLM, - M68K_INS_CAS, - M68K_INS_CAS2, - M68K_INS_CHK, - M68K_INS_CHK2, - M68K_INS_CLR, - M68K_INS_CMP, - M68K_INS_CMPA, - M68K_INS_CMPI, - M68K_INS_CMPM, - M68K_INS_CMP2, - M68K_INS_CINVL, - M68K_INS_CINVP, - M68K_INS_CINVA, - M68K_INS_CPUSHL, - M68K_INS_CPUSHP, - M68K_INS_CPUSHA, - M68K_INS_DBT, - M68K_INS_DBF, - M68K_INS_DBHI, - M68K_INS_DBLS, - M68K_INS_DBCC, - M68K_INS_DBCS, - M68K_INS_DBNE, - M68K_INS_DBEQ, - M68K_INS_DBVC, - M68K_INS_DBVS, - M68K_INS_DBPL, - M68K_INS_DBMI, - M68K_INS_DBGE, - M68K_INS_DBLT, - M68K_INS_DBGT, - M68K_INS_DBLE, - M68K_INS_DBRA, - M68K_INS_DIVS, - M68K_INS_DIVSL, - M68K_INS_DIVU, - M68K_INS_DIVUL, - M68K_INS_EOR, - M68K_INS_EORI, - M68K_INS_EXG, - M68K_INS_EXT, - M68K_INS_EXTB, - M68K_INS_FABS, - M68K_INS_FSABS, - M68K_INS_FDABS, - M68K_INS_FACOS, - M68K_INS_FADD, - M68K_INS_FSADD, - M68K_INS_FDADD, - M68K_INS_FASIN, - M68K_INS_FATAN, - M68K_INS_FATANH, - M68K_INS_FBF, - M68K_INS_FBEQ, - M68K_INS_FBOGT, - M68K_INS_FBOGE, - M68K_INS_FBOLT, - M68K_INS_FBOLE, - M68K_INS_FBOGL, - M68K_INS_FBOR, - M68K_INS_FBUN, - M68K_INS_FBUEQ, - M68K_INS_FBUGT, - M68K_INS_FBUGE, - M68K_INS_FBULT, - M68K_INS_FBULE, - M68K_INS_FBNE, - M68K_INS_FBT, - M68K_INS_FBSF, - M68K_INS_FBSEQ, - M68K_INS_FBGT, - M68K_INS_FBGE, - M68K_INS_FBLT, - M68K_INS_FBLE, - M68K_INS_FBGL, - M68K_INS_FBGLE, - M68K_INS_FBNGLE, - M68K_INS_FBNGL, - M68K_INS_FBNLE, - M68K_INS_FBNLT, - M68K_INS_FBNGE, - M68K_INS_FBNGT, - M68K_INS_FBSNE, - M68K_INS_FBST, - M68K_INS_FCMP, - M68K_INS_FCOS, - M68K_INS_FCOSH, - M68K_INS_FDBF, - M68K_INS_FDBEQ, - M68K_INS_FDBOGT, - M68K_INS_FDBOGE, - M68K_INS_FDBOLT, - M68K_INS_FDBOLE, - M68K_INS_FDBOGL, - M68K_INS_FDBOR, - M68K_INS_FDBUN, - M68K_INS_FDBUEQ, - M68K_INS_FDBUGT, - M68K_INS_FDBUGE, - M68K_INS_FDBULT, - M68K_INS_FDBULE, - M68K_INS_FDBNE, - M68K_INS_FDBT, - M68K_INS_FDBSF, - M68K_INS_FDBSEQ, - M68K_INS_FDBGT, - M68K_INS_FDBGE, - M68K_INS_FDBLT, - M68K_INS_FDBLE, - M68K_INS_FDBGL, - M68K_INS_FDBGLE, - M68K_INS_FDBNGLE, - M68K_INS_FDBNGL, - M68K_INS_FDBNLE, - M68K_INS_FDBNLT, - M68K_INS_FDBNGE, - M68K_INS_FDBNGT, - M68K_INS_FDBSNE, - M68K_INS_FDBST, - M68K_INS_FDIV, - M68K_INS_FSDIV, - M68K_INS_FDDIV, - M68K_INS_FETOX, - M68K_INS_FETOXM1, - M68K_INS_FGETEXP, - M68K_INS_FGETMAN, - M68K_INS_FINT, - M68K_INS_FINTRZ, - M68K_INS_FLOG10, - M68K_INS_FLOG2, - M68K_INS_FLOGN, - M68K_INS_FLOGNP1, - M68K_INS_FMOD, - M68K_INS_FMOVE, - M68K_INS_FSMOVE, - M68K_INS_FDMOVE, - M68K_INS_FMOVECR, - M68K_INS_FMOVEM, - M68K_INS_FMUL, - M68K_INS_FSMUL, - M68K_INS_FDMUL, - M68K_INS_FNEG, - M68K_INS_FSNEG, - M68K_INS_FDNEG, - M68K_INS_FNOP, - M68K_INS_FREM, - M68K_INS_FRESTORE, - M68K_INS_FSAVE, - M68K_INS_FSCALE, - M68K_INS_FSGLDIV, - M68K_INS_FSGLMUL, - M68K_INS_FSIN, - M68K_INS_FSINCOS, - M68K_INS_FSINH, - M68K_INS_FSQRT, - M68K_INS_FSSQRT, - M68K_INS_FDSQRT, - M68K_INS_FSF, - M68K_INS_FSBEQ, - M68K_INS_FSOGT, - M68K_INS_FSOGE, - M68K_INS_FSOLT, - M68K_INS_FSOLE, - M68K_INS_FSOGL, - M68K_INS_FSOR, - M68K_INS_FSUN, - M68K_INS_FSUEQ, - M68K_INS_FSUGT, - M68K_INS_FSUGE, - M68K_INS_FSULT, - M68K_INS_FSULE, - M68K_INS_FSNE, - M68K_INS_FST, - M68K_INS_FSSF, - M68K_INS_FSSEQ, - M68K_INS_FSGT, - M68K_INS_FSGE, - M68K_INS_FSLT, - M68K_INS_FSLE, - M68K_INS_FSGL, - M68K_INS_FSGLE, - M68K_INS_FSNGLE, - M68K_INS_FSNGL, - M68K_INS_FSNLE, - M68K_INS_FSNLT, - M68K_INS_FSNGE, - M68K_INS_FSNGT, - M68K_INS_FSSNE, - M68K_INS_FSST, - M68K_INS_FSUB, - M68K_INS_FSSUB, - M68K_INS_FDSUB, - M68K_INS_FTAN, - M68K_INS_FTANH, - M68K_INS_FTENTOX, - M68K_INS_FTRAPF, - M68K_INS_FTRAPEQ, - M68K_INS_FTRAPOGT, - M68K_INS_FTRAPOGE, - M68K_INS_FTRAPOLT, - M68K_INS_FTRAPOLE, - M68K_INS_FTRAPOGL, - M68K_INS_FTRAPOR, - M68K_INS_FTRAPUN, - M68K_INS_FTRAPUEQ, - M68K_INS_FTRAPUGT, - M68K_INS_FTRAPUGE, - M68K_INS_FTRAPULT, - M68K_INS_FTRAPULE, - M68K_INS_FTRAPNE, - M68K_INS_FTRAPT, - M68K_INS_FTRAPSF, - M68K_INS_FTRAPSEQ, - M68K_INS_FTRAPGT, - M68K_INS_FTRAPGE, - M68K_INS_FTRAPLT, - M68K_INS_FTRAPLE, - M68K_INS_FTRAPGL, - M68K_INS_FTRAPGLE, - M68K_INS_FTRAPNGLE, - M68K_INS_FTRAPNGL, - M68K_INS_FTRAPNLE, - M68K_INS_FTRAPNLT, - M68K_INS_FTRAPNGE, - M68K_INS_FTRAPNGT, - M68K_INS_FTRAPSNE, - M68K_INS_FTRAPST, - M68K_INS_FTST, - M68K_INS_FTWOTOX, - M68K_INS_HALT, - M68K_INS_ILLEGAL, - M68K_INS_JMP, - M68K_INS_JSR, - M68K_INS_LEA, - M68K_INS_LINK, - M68K_INS_LPSTOP, - M68K_INS_LSL, - M68K_INS_LSR, - M68K_INS_MOVE, - M68K_INS_MOVEA, - M68K_INS_MOVEC, - M68K_INS_MOVEM, - M68K_INS_MOVEP, - M68K_INS_MOVEQ, - M68K_INS_MOVES, - M68K_INS_MOVE16, - M68K_INS_MULS, - M68K_INS_MULU, - M68K_INS_NBCD, - M68K_INS_NEG, - M68K_INS_NEGX, - M68K_INS_NOP, - M68K_INS_NOT, - M68K_INS_OR, - M68K_INS_ORI, - M68K_INS_PACK, - M68K_INS_PEA, - M68K_INS_PFLUSH, - M68K_INS_PFLUSHA, - M68K_INS_PFLUSHAN, - M68K_INS_PFLUSHN, - M68K_INS_PLOADR, - M68K_INS_PLOADW, - M68K_INS_PLPAR, - M68K_INS_PLPAW, - M68K_INS_PMOVE, - M68K_INS_PMOVEFD, - M68K_INS_PTESTR, - M68K_INS_PTESTW, - M68K_INS_PULSE, - M68K_INS_REMS, - M68K_INS_REMU, - M68K_INS_RESET, - M68K_INS_ROL, - M68K_INS_ROR, - M68K_INS_ROXL, - M68K_INS_ROXR, - M68K_INS_RTD, - M68K_INS_RTE, - M68K_INS_RTM, - M68K_INS_RTR, - M68K_INS_RTS, - M68K_INS_SBCD, - M68K_INS_ST, - M68K_INS_SF, - M68K_INS_SHI, - M68K_INS_SLS, - M68K_INS_SCC, - M68K_INS_SHS, - M68K_INS_SCS, - M68K_INS_SLO, - M68K_INS_SNE, - M68K_INS_SEQ, - M68K_INS_SVC, - M68K_INS_SVS, - M68K_INS_SPL, - M68K_INS_SMI, - M68K_INS_SGE, - M68K_INS_SLT, - M68K_INS_SGT, - M68K_INS_SLE, - M68K_INS_STOP, - M68K_INS_SUB, - M68K_INS_SUBA, - M68K_INS_SUBI, - M68K_INS_SUBQ, - M68K_INS_SUBX, - M68K_INS_SWAP, - M68K_INS_TAS, - M68K_INS_TRAP, - M68K_INS_TRAPV, - M68K_INS_TRAPT, - M68K_INS_TRAPF, - M68K_INS_TRAPHI, - M68K_INS_TRAPLS, - M68K_INS_TRAPCC, - M68K_INS_TRAPHS, - M68K_INS_TRAPCS, - M68K_INS_TRAPLO, - M68K_INS_TRAPNE, - M68K_INS_TRAPEQ, - M68K_INS_TRAPVC, - M68K_INS_TRAPVS, - M68K_INS_TRAPPL, - M68K_INS_TRAPMI, - M68K_INS_TRAPGE, - M68K_INS_TRAPLT, - M68K_INS_TRAPGT, - M68K_INS_TRAPLE, - M68K_INS_TST, - M68K_INS_UNLK, - M68K_INS_UNPK, - M68K_INS_ENDING, // <-- mark the end of the list of instructions -} m68k_insn; - -/// Group of M68K instructions -typedef enum m68k_group_type { - M68K_GRP_INVALID = 0, ///< CS_GRUP_INVALID - M68K_GRP_JUMP, ///< = CS_GRP_JUMP - M68K_GRP_RET = 3, ///< = CS_GRP_RET - M68K_GRP_IRET = 5, ///< = CS_GRP_IRET - M68K_GRP_BRANCH_RELATIVE = 7, ///< = CS_GRP_BRANCH_RELATIVE - - M68K_GRP_ENDING,// <-- mark the end of the list of groups -} m68k_group_type; - -#ifdef __cplusplus -} -#endif - -#endif -#ifndef CAPSTONE_MIPS_H -#define CAPSTONE_MIPS_H - -/* Capstone Disassembly Engine */ -/* By Nguyen Anh Quynh , 2013-2015 */ - -#ifdef __cplusplus -extern "C" { -#endif - - -// GCC MIPS toolchain has a default macro called "mips" which breaks -// compilation -#undef mips - -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif - -/// Operand type for instruction's operands -typedef enum mips_op_type { - MIPS_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - MIPS_OP_REG, ///< = CS_OP_REG (Register operand). - MIPS_OP_IMM, ///< = CS_OP_IMM (Immediate operand). - MIPS_OP_MEM, ///< = CS_OP_MEM (Memory operand). -} mips_op_type; - -/// MIPS registers -typedef enum mips_reg { - MIPS_REG_INVALID = 0, - // General purpose registers - MIPS_REG_PC, - - MIPS_REG_0, - MIPS_REG_1, - MIPS_REG_2, - MIPS_REG_3, - MIPS_REG_4, - MIPS_REG_5, - MIPS_REG_6, - MIPS_REG_7, - MIPS_REG_8, - MIPS_REG_9, - MIPS_REG_10, - MIPS_REG_11, - MIPS_REG_12, - MIPS_REG_13, - MIPS_REG_14, - MIPS_REG_15, - MIPS_REG_16, - MIPS_REG_17, - MIPS_REG_18, - MIPS_REG_19, - MIPS_REG_20, - MIPS_REG_21, - MIPS_REG_22, - MIPS_REG_23, - MIPS_REG_24, - MIPS_REG_25, - MIPS_REG_26, - MIPS_REG_27, - MIPS_REG_28, - MIPS_REG_29, - MIPS_REG_30, - MIPS_REG_31, - - // DSP registers - MIPS_REG_DSPCCOND, - MIPS_REG_DSPCARRY, - MIPS_REG_DSPEFI, - MIPS_REG_DSPOUTFLAG, - MIPS_REG_DSPOUTFLAG16_19, - MIPS_REG_DSPOUTFLAG20, - MIPS_REG_DSPOUTFLAG21, - MIPS_REG_DSPOUTFLAG22, - MIPS_REG_DSPOUTFLAG23, - MIPS_REG_DSPPOS, - MIPS_REG_DSPSCOUNT, - - // ACC registers - MIPS_REG_AC0, - MIPS_REG_AC1, - MIPS_REG_AC2, - MIPS_REG_AC3, - - // COP registers - MIPS_REG_CC0, - MIPS_REG_CC1, - MIPS_REG_CC2, - MIPS_REG_CC3, - MIPS_REG_CC4, - MIPS_REG_CC5, - MIPS_REG_CC6, - MIPS_REG_CC7, - - // FPU registers - MIPS_REG_F0, - MIPS_REG_F1, - MIPS_REG_F2, - MIPS_REG_F3, - MIPS_REG_F4, - MIPS_REG_F5, - MIPS_REG_F6, - MIPS_REG_F7, - MIPS_REG_F8, - MIPS_REG_F9, - MIPS_REG_F10, - MIPS_REG_F11, - MIPS_REG_F12, - MIPS_REG_F13, - MIPS_REG_F14, - MIPS_REG_F15, - MIPS_REG_F16, - MIPS_REG_F17, - MIPS_REG_F18, - MIPS_REG_F19, - MIPS_REG_F20, - MIPS_REG_F21, - MIPS_REG_F22, - MIPS_REG_F23, - MIPS_REG_F24, - MIPS_REG_F25, - MIPS_REG_F26, - MIPS_REG_F27, - MIPS_REG_F28, - MIPS_REG_F29, - MIPS_REG_F30, - MIPS_REG_F31, - - MIPS_REG_FCC0, - MIPS_REG_FCC1, - MIPS_REG_FCC2, - MIPS_REG_FCC3, - MIPS_REG_FCC4, - MIPS_REG_FCC5, - MIPS_REG_FCC6, - MIPS_REG_FCC7, - - // AFPR128 - MIPS_REG_W0, - MIPS_REG_W1, - MIPS_REG_W2, - MIPS_REG_W3, - MIPS_REG_W4, - MIPS_REG_W5, - MIPS_REG_W6, - MIPS_REG_W7, - MIPS_REG_W8, - MIPS_REG_W9, - MIPS_REG_W10, - MIPS_REG_W11, - MIPS_REG_W12, - MIPS_REG_W13, - MIPS_REG_W14, - MIPS_REG_W15, - MIPS_REG_W16, - MIPS_REG_W17, - MIPS_REG_W18, - MIPS_REG_W19, - MIPS_REG_W20, - MIPS_REG_W21, - MIPS_REG_W22, - MIPS_REG_W23, - MIPS_REG_W24, - MIPS_REG_W25, - MIPS_REG_W26, - MIPS_REG_W27, - MIPS_REG_W28, - MIPS_REG_W29, - MIPS_REG_W30, - MIPS_REG_W31, - - MIPS_REG_HI, - MIPS_REG_LO, - - MIPS_REG_P0, - MIPS_REG_P1, - MIPS_REG_P2, - - MIPS_REG_MPL0, - MIPS_REG_MPL1, - MIPS_REG_MPL2, - - MIPS_REG_ENDING, // <-- mark the end of the list or registers - - // alias registers - MIPS_REG_ZERO = MIPS_REG_0, - MIPS_REG_AT = MIPS_REG_1, - MIPS_REG_V0 = MIPS_REG_2, - MIPS_REG_V1 = MIPS_REG_3, - MIPS_REG_A0 = MIPS_REG_4, - MIPS_REG_A1 = MIPS_REG_5, - MIPS_REG_A2 = MIPS_REG_6, - MIPS_REG_A3 = MIPS_REG_7, - MIPS_REG_T0 = MIPS_REG_8, - MIPS_REG_T1 = MIPS_REG_9, - MIPS_REG_T2 = MIPS_REG_10, - MIPS_REG_T3 = MIPS_REG_11, - MIPS_REG_T4 = MIPS_REG_12, - MIPS_REG_T5 = MIPS_REG_13, - MIPS_REG_T6 = MIPS_REG_14, - MIPS_REG_T7 = MIPS_REG_15, - MIPS_REG_S0 = MIPS_REG_16, - MIPS_REG_S1 = MIPS_REG_17, - MIPS_REG_S2 = MIPS_REG_18, - MIPS_REG_S3 = MIPS_REG_19, - MIPS_REG_S4 = MIPS_REG_20, - MIPS_REG_S5 = MIPS_REG_21, - MIPS_REG_S6 = MIPS_REG_22, - MIPS_REG_S7 = MIPS_REG_23, - MIPS_REG_T8 = MIPS_REG_24, - MIPS_REG_T9 = MIPS_REG_25, - MIPS_REG_K0 = MIPS_REG_26, - MIPS_REG_K1 = MIPS_REG_27, - MIPS_REG_GP = MIPS_REG_28, - MIPS_REG_SP = MIPS_REG_29, - MIPS_REG_FP = MIPS_REG_30, MIPS_REG_S8 = MIPS_REG_30, - MIPS_REG_RA = MIPS_REG_31, - - MIPS_REG_HI0 = MIPS_REG_AC0, - MIPS_REG_HI1 = MIPS_REG_AC1, - MIPS_REG_HI2 = MIPS_REG_AC2, - MIPS_REG_HI3 = MIPS_REG_AC3, - - MIPS_REG_LO0 = MIPS_REG_HI0, - MIPS_REG_LO1 = MIPS_REG_HI1, - MIPS_REG_LO2 = MIPS_REG_HI2, - MIPS_REG_LO3 = MIPS_REG_HI3, -} mips_reg; - -/// Instruction's operand referring to memory -/// This is associated with MIPS_OP_MEM operand type above -typedef struct mips_op_mem { - mips_reg base; ///< base register - int64_t disp; ///< displacement/offset value -} mips_op_mem; - -/// Instruction operand -typedef struct cs_mips_op { - mips_op_type type; ///< operand type - union { - mips_reg reg; ///< register id for REG operand - int64_t imm; ///< immediate value for IMM operand - mips_op_mem mem; ///< base/index/scale/disp value for MEM operand - }; -} cs_mips_op; - -/// Instruction structure -typedef struct cs_mips { - /// Number of operands of this instruction, - /// or 0 when instruction has no operand. - uint8_t op_count; - cs_mips_op operands[10]; ///< operands for this instruction. -} cs_mips; - -/// MIPS instruction -typedef enum mips_insn { - MIPS_INS_INVALID = 0, - - MIPS_INS_ABSQ_S, - MIPS_INS_ADD, - MIPS_INS_ADDIUPC, - MIPS_INS_ADDIUR1SP, - MIPS_INS_ADDIUR2, - MIPS_INS_ADDIUS5, - MIPS_INS_ADDIUSP, - MIPS_INS_ADDQH, - MIPS_INS_ADDQH_R, - MIPS_INS_ADDQ, - MIPS_INS_ADDQ_S, - MIPS_INS_ADDSC, - MIPS_INS_ADDS_A, - MIPS_INS_ADDS_S, - MIPS_INS_ADDS_U, - MIPS_INS_ADDU16, - MIPS_INS_ADDUH, - MIPS_INS_ADDUH_R, - MIPS_INS_ADDU, - MIPS_INS_ADDU_S, - MIPS_INS_ADDVI, - MIPS_INS_ADDV, - MIPS_INS_ADDWC, - MIPS_INS_ADD_A, - MIPS_INS_ADDI, - MIPS_INS_ADDIU, - MIPS_INS_ALIGN, - MIPS_INS_ALUIPC, - MIPS_INS_AND, - MIPS_INS_AND16, - MIPS_INS_ANDI16, - MIPS_INS_ANDI, - MIPS_INS_APPEND, - MIPS_INS_ASUB_S, - MIPS_INS_ASUB_U, - MIPS_INS_AUI, - MIPS_INS_AUIPC, - MIPS_INS_AVER_S, - MIPS_INS_AVER_U, - MIPS_INS_AVE_S, - MIPS_INS_AVE_U, - MIPS_INS_B16, - MIPS_INS_BADDU, - MIPS_INS_BAL, - MIPS_INS_BALC, - MIPS_INS_BALIGN, - MIPS_INS_BBIT0, - MIPS_INS_BBIT032, - MIPS_INS_BBIT1, - MIPS_INS_BBIT132, - MIPS_INS_BC, - MIPS_INS_BC0F, - MIPS_INS_BC0FL, - MIPS_INS_BC0T, - MIPS_INS_BC0TL, - MIPS_INS_BC1EQZ, - MIPS_INS_BC1F, - MIPS_INS_BC1FL, - MIPS_INS_BC1NEZ, - MIPS_INS_BC1T, - MIPS_INS_BC1TL, - MIPS_INS_BC2EQZ, - MIPS_INS_BC2F, - MIPS_INS_BC2FL, - MIPS_INS_BC2NEZ, - MIPS_INS_BC2T, - MIPS_INS_BC2TL, - MIPS_INS_BC3F, - MIPS_INS_BC3FL, - MIPS_INS_BC3T, - MIPS_INS_BC3TL, - MIPS_INS_BCLRI, - MIPS_INS_BCLR, - MIPS_INS_BEQ, - MIPS_INS_BEQC, - MIPS_INS_BEQL, - MIPS_INS_BEQZ16, - MIPS_INS_BEQZALC, - MIPS_INS_BEQZC, - MIPS_INS_BGEC, - MIPS_INS_BGEUC, - MIPS_INS_BGEZ, - MIPS_INS_BGEZAL, - MIPS_INS_BGEZALC, - MIPS_INS_BGEZALL, - MIPS_INS_BGEZALS, - MIPS_INS_BGEZC, - MIPS_INS_BGEZL, - MIPS_INS_BGTZ, - MIPS_INS_BGTZALC, - MIPS_INS_BGTZC, - MIPS_INS_BGTZL, - MIPS_INS_BINSLI, - MIPS_INS_BINSL, - MIPS_INS_BINSRI, - MIPS_INS_BINSR, - MIPS_INS_BITREV, - MIPS_INS_BITSWAP, - MIPS_INS_BLEZ, - MIPS_INS_BLEZALC, - MIPS_INS_BLEZC, - MIPS_INS_BLEZL, - MIPS_INS_BLTC, - MIPS_INS_BLTUC, - MIPS_INS_BLTZ, - MIPS_INS_BLTZAL, - MIPS_INS_BLTZALC, - MIPS_INS_BLTZALL, - MIPS_INS_BLTZALS, - MIPS_INS_BLTZC, - MIPS_INS_BLTZL, - MIPS_INS_BMNZI, - MIPS_INS_BMNZ, - MIPS_INS_BMZI, - MIPS_INS_BMZ, - MIPS_INS_BNE, - MIPS_INS_BNEC, - MIPS_INS_BNEGI, - MIPS_INS_BNEG, - MIPS_INS_BNEL, - MIPS_INS_BNEZ16, - MIPS_INS_BNEZALC, - MIPS_INS_BNEZC, - MIPS_INS_BNVC, - MIPS_INS_BNZ, - MIPS_INS_BOVC, - MIPS_INS_BPOSGE32, - MIPS_INS_BREAK, - MIPS_INS_BREAK16, - MIPS_INS_BSELI, - MIPS_INS_BSEL, - MIPS_INS_BSETI, - MIPS_INS_BSET, - MIPS_INS_BZ, - MIPS_INS_BEQZ, - MIPS_INS_B, - MIPS_INS_BNEZ, - MIPS_INS_BTEQZ, - MIPS_INS_BTNEZ, - MIPS_INS_CACHE, - MIPS_INS_CEIL, - MIPS_INS_CEQI, - MIPS_INS_CEQ, - MIPS_INS_CFC1, - MIPS_INS_CFCMSA, - MIPS_INS_CINS, - MIPS_INS_CINS32, - MIPS_INS_CLASS, - MIPS_INS_CLEI_S, - MIPS_INS_CLEI_U, - MIPS_INS_CLE_S, - MIPS_INS_CLE_U, - MIPS_INS_CLO, - MIPS_INS_CLTI_S, - MIPS_INS_CLTI_U, - MIPS_INS_CLT_S, - MIPS_INS_CLT_U, - MIPS_INS_CLZ, - MIPS_INS_CMPGDU, - MIPS_INS_CMPGU, - MIPS_INS_CMPU, - MIPS_INS_CMP, - MIPS_INS_COPY_S, - MIPS_INS_COPY_U, - MIPS_INS_CTC1, - MIPS_INS_CTCMSA, - MIPS_INS_CVT, - MIPS_INS_C, - MIPS_INS_CMPI, - MIPS_INS_DADD, - MIPS_INS_DADDI, - MIPS_INS_DADDIU, - MIPS_INS_DADDU, - MIPS_INS_DAHI, - MIPS_INS_DALIGN, - MIPS_INS_DATI, - MIPS_INS_DAUI, - MIPS_INS_DBITSWAP, - MIPS_INS_DCLO, - MIPS_INS_DCLZ, - MIPS_INS_DDIV, - MIPS_INS_DDIVU, - MIPS_INS_DERET, - MIPS_INS_DEXT, - MIPS_INS_DEXTM, - MIPS_INS_DEXTU, - MIPS_INS_DI, - MIPS_INS_DINS, - MIPS_INS_DINSM, - MIPS_INS_DINSU, - MIPS_INS_DIV, - MIPS_INS_DIVU, - MIPS_INS_DIV_S, - MIPS_INS_DIV_U, - MIPS_INS_DLSA, - MIPS_INS_DMFC0, - MIPS_INS_DMFC1, - MIPS_INS_DMFC2, - MIPS_INS_DMOD, - MIPS_INS_DMODU, - MIPS_INS_DMTC0, - MIPS_INS_DMTC1, - MIPS_INS_DMTC2, - MIPS_INS_DMUH, - MIPS_INS_DMUHU, - MIPS_INS_DMUL, - MIPS_INS_DMULT, - MIPS_INS_DMULTU, - MIPS_INS_DMULU, - MIPS_INS_DOTP_S, - MIPS_INS_DOTP_U, - MIPS_INS_DPADD_S, - MIPS_INS_DPADD_U, - MIPS_INS_DPAQX_SA, - MIPS_INS_DPAQX_S, - MIPS_INS_DPAQ_SA, - MIPS_INS_DPAQ_S, - MIPS_INS_DPAU, - MIPS_INS_DPAX, - MIPS_INS_DPA, - MIPS_INS_DPOP, - MIPS_INS_DPSQX_SA, - MIPS_INS_DPSQX_S, - MIPS_INS_DPSQ_SA, - MIPS_INS_DPSQ_S, - MIPS_INS_DPSUB_S, - MIPS_INS_DPSUB_U, - MIPS_INS_DPSU, - MIPS_INS_DPSX, - MIPS_INS_DPS, - MIPS_INS_DROTR, - MIPS_INS_DROTR32, - MIPS_INS_DROTRV, - MIPS_INS_DSBH, - MIPS_INS_DSHD, - MIPS_INS_DSLL, - MIPS_INS_DSLL32, - MIPS_INS_DSLLV, - MIPS_INS_DSRA, - MIPS_INS_DSRA32, - MIPS_INS_DSRAV, - MIPS_INS_DSRL, - MIPS_INS_DSRL32, - MIPS_INS_DSRLV, - MIPS_INS_DSUB, - MIPS_INS_DSUBU, - MIPS_INS_EHB, - MIPS_INS_EI, - MIPS_INS_ERET, - MIPS_INS_EXT, - MIPS_INS_EXTP, - MIPS_INS_EXTPDP, - MIPS_INS_EXTPDPV, - MIPS_INS_EXTPV, - MIPS_INS_EXTRV_RS, - MIPS_INS_EXTRV_R, - MIPS_INS_EXTRV_S, - MIPS_INS_EXTRV, - MIPS_INS_EXTR_RS, - MIPS_INS_EXTR_R, - MIPS_INS_EXTR_S, - MIPS_INS_EXTR, - MIPS_INS_EXTS, - MIPS_INS_EXTS32, - MIPS_INS_ABS, - MIPS_INS_FADD, - MIPS_INS_FCAF, - MIPS_INS_FCEQ, - MIPS_INS_FCLASS, - MIPS_INS_FCLE, - MIPS_INS_FCLT, - MIPS_INS_FCNE, - MIPS_INS_FCOR, - MIPS_INS_FCUEQ, - MIPS_INS_FCULE, - MIPS_INS_FCULT, - MIPS_INS_FCUNE, - MIPS_INS_FCUN, - MIPS_INS_FDIV, - MIPS_INS_FEXDO, - MIPS_INS_FEXP2, - MIPS_INS_FEXUPL, - MIPS_INS_FEXUPR, - MIPS_INS_FFINT_S, - MIPS_INS_FFINT_U, - MIPS_INS_FFQL, - MIPS_INS_FFQR, - MIPS_INS_FILL, - MIPS_INS_FLOG2, - MIPS_INS_FLOOR, - MIPS_INS_FMADD, - MIPS_INS_FMAX_A, - MIPS_INS_FMAX, - MIPS_INS_FMIN_A, - MIPS_INS_FMIN, - MIPS_INS_MOV, - MIPS_INS_FMSUB, - MIPS_INS_FMUL, - MIPS_INS_MUL, - MIPS_INS_NEG, - MIPS_INS_FRCP, - MIPS_INS_FRINT, - MIPS_INS_FRSQRT, - MIPS_INS_FSAF, - MIPS_INS_FSEQ, - MIPS_INS_FSLE, - MIPS_INS_FSLT, - MIPS_INS_FSNE, - MIPS_INS_FSOR, - MIPS_INS_FSQRT, - MIPS_INS_SQRT, - MIPS_INS_FSUB, - MIPS_INS_SUB, - MIPS_INS_FSUEQ, - MIPS_INS_FSULE, - MIPS_INS_FSULT, - MIPS_INS_FSUNE, - MIPS_INS_FSUN, - MIPS_INS_FTINT_S, - MIPS_INS_FTINT_U, - MIPS_INS_FTQ, - MIPS_INS_FTRUNC_S, - MIPS_INS_FTRUNC_U, - MIPS_INS_HADD_S, - MIPS_INS_HADD_U, - MIPS_INS_HSUB_S, - MIPS_INS_HSUB_U, - MIPS_INS_ILVEV, - MIPS_INS_ILVL, - MIPS_INS_ILVOD, - MIPS_INS_ILVR, - MIPS_INS_INS, - MIPS_INS_INSERT, - MIPS_INS_INSV, - MIPS_INS_INSVE, - MIPS_INS_J, - MIPS_INS_JAL, - MIPS_INS_JALR, - MIPS_INS_JALRS16, - MIPS_INS_JALRS, - MIPS_INS_JALS, - MIPS_INS_JALX, - MIPS_INS_JIALC, - MIPS_INS_JIC, - MIPS_INS_JR, - MIPS_INS_JR16, - MIPS_INS_JRADDIUSP, - MIPS_INS_JRC, - MIPS_INS_JALRC, - MIPS_INS_LB, - MIPS_INS_LBU16, - MIPS_INS_LBUX, - MIPS_INS_LBU, - MIPS_INS_LD, - MIPS_INS_LDC1, - MIPS_INS_LDC2, - MIPS_INS_LDC3, - MIPS_INS_LDI, - MIPS_INS_LDL, - MIPS_INS_LDPC, - MIPS_INS_LDR, - MIPS_INS_LDXC1, - MIPS_INS_LH, - MIPS_INS_LHU16, - MIPS_INS_LHX, - MIPS_INS_LHU, - MIPS_INS_LI16, - MIPS_INS_LL, - MIPS_INS_LLD, - MIPS_INS_LSA, - MIPS_INS_LUXC1, - MIPS_INS_LUI, - MIPS_INS_LW, - MIPS_INS_LW16, - MIPS_INS_LWC1, - MIPS_INS_LWC2, - MIPS_INS_LWC3, - MIPS_INS_LWL, - MIPS_INS_LWM16, - MIPS_INS_LWM32, - MIPS_INS_LWPC, - MIPS_INS_LWP, - MIPS_INS_LWR, - MIPS_INS_LWUPC, - MIPS_INS_LWU, - MIPS_INS_LWX, - MIPS_INS_LWXC1, - MIPS_INS_LWXS, - MIPS_INS_LI, - MIPS_INS_MADD, - MIPS_INS_MADDF, - MIPS_INS_MADDR_Q, - MIPS_INS_MADDU, - MIPS_INS_MADDV, - MIPS_INS_MADD_Q, - MIPS_INS_MAQ_SA, - MIPS_INS_MAQ_S, - MIPS_INS_MAXA, - MIPS_INS_MAXI_S, - MIPS_INS_MAXI_U, - MIPS_INS_MAX_A, - MIPS_INS_MAX, - MIPS_INS_MAX_S, - MIPS_INS_MAX_U, - MIPS_INS_MFC0, - MIPS_INS_MFC1, - MIPS_INS_MFC2, - MIPS_INS_MFHC1, - MIPS_INS_MFHI, - MIPS_INS_MFLO, - MIPS_INS_MINA, - MIPS_INS_MINI_S, - MIPS_INS_MINI_U, - MIPS_INS_MIN_A, - MIPS_INS_MIN, - MIPS_INS_MIN_S, - MIPS_INS_MIN_U, - MIPS_INS_MOD, - MIPS_INS_MODSUB, - MIPS_INS_MODU, - MIPS_INS_MOD_S, - MIPS_INS_MOD_U, - MIPS_INS_MOVE, - MIPS_INS_MOVEP, - MIPS_INS_MOVF, - MIPS_INS_MOVN, - MIPS_INS_MOVT, - MIPS_INS_MOVZ, - MIPS_INS_MSUB, - MIPS_INS_MSUBF, - MIPS_INS_MSUBR_Q, - MIPS_INS_MSUBU, - MIPS_INS_MSUBV, - MIPS_INS_MSUB_Q, - MIPS_INS_MTC0, - MIPS_INS_MTC1, - MIPS_INS_MTC2, - MIPS_INS_MTHC1, - MIPS_INS_MTHI, - MIPS_INS_MTHLIP, - MIPS_INS_MTLO, - MIPS_INS_MTM0, - MIPS_INS_MTM1, - MIPS_INS_MTM2, - MIPS_INS_MTP0, - MIPS_INS_MTP1, - MIPS_INS_MTP2, - MIPS_INS_MUH, - MIPS_INS_MUHU, - MIPS_INS_MULEQ_S, - MIPS_INS_MULEU_S, - MIPS_INS_MULQ_RS, - MIPS_INS_MULQ_S, - MIPS_INS_MULR_Q, - MIPS_INS_MULSAQ_S, - MIPS_INS_MULSA, - MIPS_INS_MULT, - MIPS_INS_MULTU, - MIPS_INS_MULU, - MIPS_INS_MULV, - MIPS_INS_MUL_Q, - MIPS_INS_MUL_S, - MIPS_INS_NLOC, - MIPS_INS_NLZC, - MIPS_INS_NMADD, - MIPS_INS_NMSUB, - MIPS_INS_NOR, - MIPS_INS_NORI, - MIPS_INS_NOT16, - MIPS_INS_NOT, - MIPS_INS_OR, - MIPS_INS_OR16, - MIPS_INS_ORI, - MIPS_INS_PACKRL, - MIPS_INS_PAUSE, - MIPS_INS_PCKEV, - MIPS_INS_PCKOD, - MIPS_INS_PCNT, - MIPS_INS_PICK, - MIPS_INS_POP, - MIPS_INS_PRECEQU, - MIPS_INS_PRECEQ, - MIPS_INS_PRECEU, - MIPS_INS_PRECRQU_S, - MIPS_INS_PRECRQ, - MIPS_INS_PRECRQ_RS, - MIPS_INS_PRECR, - MIPS_INS_PRECR_SRA, - MIPS_INS_PRECR_SRA_R, - MIPS_INS_PREF, - MIPS_INS_PREPEND, - MIPS_INS_RADDU, - MIPS_INS_RDDSP, - MIPS_INS_RDHWR, - MIPS_INS_REPLV, - MIPS_INS_REPL, - MIPS_INS_RINT, - MIPS_INS_ROTR, - MIPS_INS_ROTRV, - MIPS_INS_ROUND, - MIPS_INS_SAT_S, - MIPS_INS_SAT_U, - MIPS_INS_SB, - MIPS_INS_SB16, - MIPS_INS_SC, - MIPS_INS_SCD, - MIPS_INS_SD, - MIPS_INS_SDBBP, - MIPS_INS_SDBBP16, - MIPS_INS_SDC1, - MIPS_INS_SDC2, - MIPS_INS_SDC3, - MIPS_INS_SDL, - MIPS_INS_SDR, - MIPS_INS_SDXC1, - MIPS_INS_SEB, - MIPS_INS_SEH, - MIPS_INS_SELEQZ, - MIPS_INS_SELNEZ, - MIPS_INS_SEL, - MIPS_INS_SEQ, - MIPS_INS_SEQI, - MIPS_INS_SH, - MIPS_INS_SH16, - MIPS_INS_SHF, - MIPS_INS_SHILO, - MIPS_INS_SHILOV, - MIPS_INS_SHLLV, - MIPS_INS_SHLLV_S, - MIPS_INS_SHLL, - MIPS_INS_SHLL_S, - MIPS_INS_SHRAV, - MIPS_INS_SHRAV_R, - MIPS_INS_SHRA, - MIPS_INS_SHRA_R, - MIPS_INS_SHRLV, - MIPS_INS_SHRL, - MIPS_INS_SLDI, - MIPS_INS_SLD, - MIPS_INS_SLL, - MIPS_INS_SLL16, - MIPS_INS_SLLI, - MIPS_INS_SLLV, - MIPS_INS_SLT, - MIPS_INS_SLTI, - MIPS_INS_SLTIU, - MIPS_INS_SLTU, - MIPS_INS_SNE, - MIPS_INS_SNEI, - MIPS_INS_SPLATI, - MIPS_INS_SPLAT, - MIPS_INS_SRA, - MIPS_INS_SRAI, - MIPS_INS_SRARI, - MIPS_INS_SRAR, - MIPS_INS_SRAV, - MIPS_INS_SRL, - MIPS_INS_SRL16, - MIPS_INS_SRLI, - MIPS_INS_SRLRI, - MIPS_INS_SRLR, - MIPS_INS_SRLV, - MIPS_INS_SSNOP, - MIPS_INS_ST, - MIPS_INS_SUBQH, - MIPS_INS_SUBQH_R, - MIPS_INS_SUBQ, - MIPS_INS_SUBQ_S, - MIPS_INS_SUBSUS_U, - MIPS_INS_SUBSUU_S, - MIPS_INS_SUBS_S, - MIPS_INS_SUBS_U, - MIPS_INS_SUBU16, - MIPS_INS_SUBUH, - MIPS_INS_SUBUH_R, - MIPS_INS_SUBU, - MIPS_INS_SUBU_S, - MIPS_INS_SUBVI, - MIPS_INS_SUBV, - MIPS_INS_SUXC1, - MIPS_INS_SW, - MIPS_INS_SW16, - MIPS_INS_SWC1, - MIPS_INS_SWC2, - MIPS_INS_SWC3, - MIPS_INS_SWL, - MIPS_INS_SWM16, - MIPS_INS_SWM32, - MIPS_INS_SWP, - MIPS_INS_SWR, - MIPS_INS_SWXC1, - MIPS_INS_SYNC, - MIPS_INS_SYNCI, - MIPS_INS_SYSCALL, - MIPS_INS_TEQ, - MIPS_INS_TEQI, - MIPS_INS_TGE, - MIPS_INS_TGEI, - MIPS_INS_TGEIU, - MIPS_INS_TGEU, - MIPS_INS_TLBP, - MIPS_INS_TLBR, - MIPS_INS_TLBWI, - MIPS_INS_TLBWR, - MIPS_INS_TLT, - MIPS_INS_TLTI, - MIPS_INS_TLTIU, - MIPS_INS_TLTU, - MIPS_INS_TNE, - MIPS_INS_TNEI, - MIPS_INS_TRUNC, - MIPS_INS_V3MULU, - MIPS_INS_VMM0, - MIPS_INS_VMULU, - MIPS_INS_VSHF, - MIPS_INS_WAIT, - MIPS_INS_WRDSP, - MIPS_INS_WSBH, - MIPS_INS_XOR, - MIPS_INS_XOR16, - MIPS_INS_XORI, - - //> some alias instructions - MIPS_INS_NOP, - MIPS_INS_NEGU, - - //> special instructions - MIPS_INS_JALR_HB, // jump and link with Hazard Barrier - MIPS_INS_JR_HB, // jump register with Hazard Barrier - - MIPS_INS_ENDING, -} mips_insn; - -/// Group of MIPS instructions -typedef enum mips_insn_group { - MIPS_GRP_INVALID = 0, ///< = CS_GRP_INVALID - - // Generic groups - // all jump instructions (conditional+direct+indirect jumps) - MIPS_GRP_JUMP, ///< = CS_GRP_JUMP - // all call instructions - MIPS_GRP_CALL, ///< = CS_GRP_CALL - // all return instructions - MIPS_GRP_RET, ///< = CS_GRP_RET - // all interrupt instructions (int+syscall) - MIPS_GRP_INT, ///< = CS_GRP_INT - // all interrupt return instructions - MIPS_GRP_IRET, ///< = CS_GRP_IRET - // all privileged instructions - MIPS_GRP_PRIVILEGE, ///< = CS_GRP_PRIVILEGE - // all relative branching instructions - MIPS_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE - - // Architecture-specific groups - MIPS_GRP_BITCOUNT = 128, - MIPS_GRP_DSP, - MIPS_GRP_DSPR2, - MIPS_GRP_FPIDX, - MIPS_GRP_MSA, - MIPS_GRP_MIPS32R2, - MIPS_GRP_MIPS64, - MIPS_GRP_MIPS64R2, - MIPS_GRP_SEINREG, - MIPS_GRP_STDENC, - MIPS_GRP_SWAP, - MIPS_GRP_MICROMIPS, - MIPS_GRP_MIPS16MODE, - MIPS_GRP_FP64BIT, - MIPS_GRP_NONANSFPMATH, - MIPS_GRP_NOTFP64BIT, - MIPS_GRP_NOTINMICROMIPS, - MIPS_GRP_NOTNACL, - MIPS_GRP_NOTMIPS32R6, - MIPS_GRP_NOTMIPS64R6, - MIPS_GRP_CNMIPS, - MIPS_GRP_MIPS32, - MIPS_GRP_MIPS32R6, - MIPS_GRP_MIPS64R6, - MIPS_GRP_MIPS2, - MIPS_GRP_MIPS3, - MIPS_GRP_MIPS3_32, - MIPS_GRP_MIPS3_32R2, - MIPS_GRP_MIPS4_32, - MIPS_GRP_MIPS4_32R2, - MIPS_GRP_MIPS5_32R2, - MIPS_GRP_GP32BIT, - MIPS_GRP_GP64BIT, - - MIPS_GRP_ENDING, -} mips_insn_group; - -#ifdef __cplusplus -} -#endif - -#endif -#ifndef CAPSTONE_PPC_H -#define CAPSTONE_PPC_H - -/* Capstone Disassembly Engine */ -/* By Nguyen Anh Quynh , 2013-2015 */ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif - -/// PPC branch codes for some branch instructions -typedef enum ppc_bc { - PPC_BC_INVALID = 0, - PPC_BC_LT = (0 << 5) | 12, - PPC_BC_LE = (1 << 5) | 4, - PPC_BC_EQ = (2 << 5) | 12, - PPC_BC_GE = (0 << 5) | 4, - PPC_BC_GT = (1 << 5) | 12, - PPC_BC_NE = (2 << 5) | 4, - PPC_BC_UN = (3 << 5) | 12, - PPC_BC_NU = (3 << 5) | 4, - - // extra conditions - PPC_BC_SO = (4 << 5) | 12, ///< summary overflow - PPC_BC_NS = (4 << 5) | 4, ///< not summary overflow -} ppc_bc; - -/// PPC branch hint for some branch instructions -typedef enum ppc_bh { - PPC_BH_INVALID = 0, ///< no hint - PPC_BH_PLUS, ///< PLUS hint - PPC_BH_MINUS, ///< MINUS hint -} ppc_bh; - -/// Operand type for instruction's operands -typedef enum ppc_op_type { - PPC_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - PPC_OP_REG, ///< = CS_OP_REG (Register operand). - PPC_OP_IMM, ///< = CS_OP_IMM (Immediate operand). - PPC_OP_MEM, ///< = CS_OP_MEM (Memory operand). - PPC_OP_CRX = 64, ///< Condition Register field -} ppc_op_type; - -/// PPC registers -typedef enum ppc_reg { - PPC_REG_INVALID = 0, - - PPC_REG_CARRY = 2, - PPC_REG_CTR = 3, - PPC_REG_LR = 5, - PPC_REG_RM = 6, - PPC_REG_VRSAVE = 8, - PPC_REG_XER = 9, - PPC_REG_ZERO = 10, - PPC_REG_CR0 = 12, - PPC_REG_CR1 = 13, - PPC_REG_CR2 = 14, - PPC_REG_CR3 = 15, - PPC_REG_CR4 = 16, - PPC_REG_CR5 = 17, - PPC_REG_CR6 = 18, - PPC_REG_CR7 = 19, - PPC_REG_CTR8 = 20, - PPC_REG_F0 = 21, - PPC_REG_F1 = 22, - PPC_REG_F2 = 23, - PPC_REG_F3 = 24, - PPC_REG_F4 = 25, - PPC_REG_F5 = 26, - PPC_REG_F6 = 27, - PPC_REG_F7 = 28, - PPC_REG_F8 = 29, - PPC_REG_F9 = 30, - PPC_REG_F10 = 31, - PPC_REG_F11 = 32, - PPC_REG_F12 = 33, - PPC_REG_F13 = 34, - PPC_REG_F14 = 35, - PPC_REG_F15 = 36, - PPC_REG_F16 = 37, - PPC_REG_F17 = 38, - PPC_REG_F18 = 39, - PPC_REG_F19 = 40, - PPC_REG_F20 = 41, - PPC_REG_F21 = 42, - PPC_REG_F22 = 43, - PPC_REG_F23 = 44, - PPC_REG_F24 = 45, - PPC_REG_F25 = 46, - PPC_REG_F26 = 47, - PPC_REG_F27 = 48, - PPC_REG_F28 = 49, - PPC_REG_F29 = 50, - PPC_REG_F30 = 51, - PPC_REG_F31 = 52, - PPC_REG_LR8 = 54, - PPC_REG_Q0 = 55, - PPC_REG_Q1 = 56, - PPC_REG_Q2 = 57, - PPC_REG_Q3 = 58, - PPC_REG_Q4 = 59, - PPC_REG_Q5 = 60, - PPC_REG_Q6 = 61, - PPC_REG_Q7 = 62, - PPC_REG_Q8 = 63, - PPC_REG_Q9 = 64, - PPC_REG_Q10 = 65, - PPC_REG_Q11 = 66, - PPC_REG_Q12 = 67, - PPC_REG_Q13 = 68, - PPC_REG_Q14 = 69, - PPC_REG_Q15 = 70, - PPC_REG_Q16 = 71, - PPC_REG_Q17 = 72, - PPC_REG_Q18 = 73, - PPC_REG_Q19 = 74, - PPC_REG_Q20 = 75, - PPC_REG_Q21 = 76, - PPC_REG_Q22 = 77, - PPC_REG_Q23 = 78, - PPC_REG_Q24 = 79, - PPC_REG_Q25 = 80, - PPC_REG_Q26 = 81, - PPC_REG_Q27 = 82, - PPC_REG_Q28 = 83, - PPC_REG_Q29 = 84, - PPC_REG_Q30 = 85, - PPC_REG_Q31 = 86, - PPC_REG_R0 = 87, - PPC_REG_R1 = 88, - PPC_REG_R2 = 89, - PPC_REG_R3 = 90, - PPC_REG_R4 = 91, - PPC_REG_R5 = 92, - PPC_REG_R6 = 93, - PPC_REG_R7 = 94, - PPC_REG_R8 = 95, - PPC_REG_R9 = 96, - PPC_REG_R10 = 97, - PPC_REG_R11 = 98, - PPC_REG_R12 = 99, - PPC_REG_R13 = 100, - PPC_REG_R14 = 101, - PPC_REG_R15 = 102, - PPC_REG_R16 = 103, - PPC_REG_R17 = 104, - PPC_REG_R18 = 105, - PPC_REG_R19 = 106, - PPC_REG_R20 = 107, - PPC_REG_R21 = 108, - PPC_REG_R22 = 109, - PPC_REG_R23 = 110, - PPC_REG_R24 = 111, - PPC_REG_R25 = 112, - PPC_REG_R26 = 113, - PPC_REG_R27 = 114, - PPC_REG_R28 = 115, - PPC_REG_R29 = 116, - PPC_REG_R30 = 117, - PPC_REG_R31 = 118, - PPC_REG_V0 = 151, - PPC_REG_V1 = 152, - PPC_REG_V2 = 153, - PPC_REG_V3 = 154, - PPC_REG_V4 = 155, - PPC_REG_V5 = 156, - PPC_REG_V6 = 157, - PPC_REG_V7 = 158, - PPC_REG_V8 = 159, - PPC_REG_V9 = 160, - PPC_REG_V10 = 161, - PPC_REG_V11 = 162, - PPC_REG_V12 = 163, - PPC_REG_V13 = 164, - PPC_REG_V14 = 165, - PPC_REG_V15 = 166, - PPC_REG_V16 = 167, - PPC_REG_V17 = 168, - PPC_REG_V18 = 169, - PPC_REG_V19 = 170, - PPC_REG_V20 = 171, - PPC_REG_V21 = 172, - PPC_REG_V22 = 173, - PPC_REG_V23 = 174, - PPC_REG_V24 = 175, - PPC_REG_V25 = 176, - PPC_REG_V26 = 177, - PPC_REG_V27 = 178, - PPC_REG_V28 = 179, - PPC_REG_V29 = 180, - PPC_REG_V30 = 181, - PPC_REG_V31 = 182, - PPC_REG_VS0 = 215, - PPC_REG_VS1 = 216, - PPC_REG_VS2 = 217, - PPC_REG_VS3 = 218, - PPC_REG_VS4 = 219, - PPC_REG_VS5 = 220, - PPC_REG_VS6 = 221, - PPC_REG_VS7 = 222, - PPC_REG_VS8 = 223, - PPC_REG_VS9 = 224, - PPC_REG_VS10 = 225, - PPC_REG_VS11 = 226, - PPC_REG_VS12 = 227, - PPC_REG_VS13 = 228, - PPC_REG_VS14 = 229, - PPC_REG_VS15 = 230, - PPC_REG_VS16 = 231, - PPC_REG_VS17 = 232, - PPC_REG_VS18 = 233, - PPC_REG_VS19 = 234, - PPC_REG_VS20 = 235, - PPC_REG_VS21 = 236, - PPC_REG_VS22 = 237, - PPC_REG_VS23 = 238, - PPC_REG_VS24 = 239, - PPC_REG_VS25 = 240, - PPC_REG_VS26 = 241, - PPC_REG_VS27 = 242, - PPC_REG_VS28 = 243, - PPC_REG_VS29 = 244, - PPC_REG_VS30 = 245, - PPC_REG_VS31 = 246, - PPC_REG_VS32 = 247, - PPC_REG_VS33 = 248, - PPC_REG_VS34 = 249, - PPC_REG_VS35 = 250, - PPC_REG_VS36 = 251, - PPC_REG_VS37 = 252, - PPC_REG_VS38 = 253, - PPC_REG_VS39 = 254, - PPC_REG_VS40 = 255, - PPC_REG_VS41 = 256, - PPC_REG_VS42 = 257, - PPC_REG_VS43 = 258, - PPC_REG_VS44 = 259, - PPC_REG_VS45 = 260, - PPC_REG_VS46 = 261, - PPC_REG_VS47 = 262, - PPC_REG_VS48 = 263, - PPC_REG_VS49 = 264, - PPC_REG_VS50 = 265, - PPC_REG_VS51 = 266, - PPC_REG_VS52 = 267, - PPC_REG_VS53 = 268, - PPC_REG_VS54 = 269, - PPC_REG_VS55 = 270, - PPC_REG_VS56 = 271, - PPC_REG_VS57 = 272, - PPC_REG_VS58 = 273, - PPC_REG_VS59 = 274, - PPC_REG_VS60 = 275, - PPC_REG_VS61 = 276, - PPC_REG_VS62 = 277, - PPC_REG_VS63 = 278, - - PPC_REG_CR0EQ = 312, - PPC_REG_CR1EQ = 313, - PPC_REG_CR2EQ = 314, - PPC_REG_CR3EQ = 315, - PPC_REG_CR4EQ = 316, - PPC_REG_CR5EQ = 317, - PPC_REG_CR6EQ = 318, - PPC_REG_CR7EQ = 319, - PPC_REG_CR0GT = 320, - PPC_REG_CR1GT = 321, - PPC_REG_CR2GT = 322, - PPC_REG_CR3GT = 323, - PPC_REG_CR4GT = 324, - PPC_REG_CR5GT = 325, - PPC_REG_CR6GT = 326, - PPC_REG_CR7GT = 327, - PPC_REG_CR0LT = 328, - PPC_REG_CR1LT = 329, - PPC_REG_CR2LT = 330, - PPC_REG_CR3LT = 331, - PPC_REG_CR4LT = 332, - PPC_REG_CR5LT = 333, - PPC_REG_CR6LT = 334, - PPC_REG_CR7LT = 335, - PPC_REG_CR0UN = 336, - PPC_REG_CR1UN = 337, - PPC_REG_CR2UN = 338, - PPC_REG_CR3UN = 339, - PPC_REG_CR4UN = 340, - PPC_REG_CR5UN = 341, - PPC_REG_CR6UN = 342, - PPC_REG_CR7UN = 343, - - PPC_REG_ENDING, // <-- mark the end of the list of registers -} ppc_reg; - -/// Instruction's operand referring to memory -/// This is associated with PPC_OP_MEM operand type above -typedef struct ppc_op_mem { - ppc_reg base; ///< base register - int32_t disp; ///< displacement/offset value -} ppc_op_mem; - -typedef struct ppc_op_crx { - unsigned int scale; - ppc_reg reg; - ppc_bc cond; -} ppc_op_crx; - -/// Instruction operand -typedef struct cs_ppc_op { - ppc_op_type type; ///< operand type - union { - ppc_reg reg; ///< register value for REG operand - int64_t imm; ///< immediate value for IMM operand - ppc_op_mem mem; ///< base/disp value for MEM operand - ppc_op_crx crx; ///< operand with condition register - }; -} cs_ppc_op; - -/// Instruction structure -typedef struct cs_ppc { - /// branch code for branch instructions - ppc_bc bc; - - /// branch hint for branch instructions - ppc_bh bh; - - /// if update_cr0 = True, then this 'dot' insn updates CR0 - bool update_cr0; - - /// Number of operands of this instruction, - /// or 0 when instruction has no operand. - uint8_t op_count; - cs_ppc_op operands[8]; ///< operands for this instruction. -} cs_ppc; - -/// PPC instruction -typedef enum ppc_insn { - PPC_INS_INVALID = 0, - - PPC_INS_ADD, - PPC_INS_ADDC, - PPC_INS_ADDE, - PPC_INS_ADDI, - PPC_INS_ADDIC, - PPC_INS_ADDIS, - PPC_INS_ADDME, - PPC_INS_ADDPCIS, - PPC_INS_ADDZE, - PPC_INS_AND, - PPC_INS_ANDC, - PPC_INS_ANDI, - PPC_INS_ANDIS, - PPC_INS_ATTN, - PPC_INS_B, - PPC_INS_BA, - PPC_INS_BC, - PPC_INS_BCA, - PPC_INS_BCCTR, - PPC_INS_BCCTRL, - PPC_INS_BCDCFN, - PPC_INS_BCDCFSQ, - PPC_INS_BCDCFZ, - PPC_INS_BCDCPSGN, - PPC_INS_BCDCTN, - PPC_INS_BCDCTSQ, - PPC_INS_BCDCTZ, - PPC_INS_BCDS, - PPC_INS_BCDSETSGN, - PPC_INS_BCDSR, - PPC_INS_BCDTRUNC, - PPC_INS_BCDUS, - PPC_INS_BCDUTRUNC, - PPC_INS_BCL, - PPC_INS_BCLA, - PPC_INS_BCLR, - PPC_INS_BCLRL, - PPC_INS_BCTR, - PPC_INS_BCTRL, - PPC_INS_BDNZ, - PPC_INS_BDNZA, - PPC_INS_BDNZF, - PPC_INS_BDNZFA, - PPC_INS_BDNZFL, - PPC_INS_BDNZFLA, - PPC_INS_BDNZFLR, - PPC_INS_BDNZFLRL, - PPC_INS_BDNZL, - PPC_INS_BDNZLA, - PPC_INS_BDNZLR, - PPC_INS_BDNZLRL, - PPC_INS_BDNZT, - PPC_INS_BDNZTA, - PPC_INS_BDNZTL, - PPC_INS_BDNZTLA, - PPC_INS_BDNZTLR, - PPC_INS_BDNZTLRL, - PPC_INS_BDZ, - PPC_INS_BDZA, - PPC_INS_BDZF, - PPC_INS_BDZFA, - PPC_INS_BDZFL, - PPC_INS_BDZFLA, - PPC_INS_BDZFLR, - PPC_INS_BDZFLRL, - PPC_INS_BDZL, - PPC_INS_BDZLA, - PPC_INS_BDZLR, - PPC_INS_BDZLRL, - PPC_INS_BDZT, - PPC_INS_BDZTA, - PPC_INS_BDZTL, - PPC_INS_BDZTLA, - PPC_INS_BDZTLR, - PPC_INS_BDZTLRL, - PPC_INS_BEQ, - PPC_INS_BEQA, - PPC_INS_BEQCTR, - PPC_INS_BEQCTRL, - PPC_INS_BEQL, - PPC_INS_BEQLA, - PPC_INS_BEQLR, - PPC_INS_BEQLRL, - PPC_INS_BF, - PPC_INS_BFA, - PPC_INS_BFCTR, - PPC_INS_BFCTRL, - PPC_INS_BFL, - PPC_INS_BFLA, - PPC_INS_BFLR, - PPC_INS_BFLRL, - PPC_INS_BGE, - PPC_INS_BGEA, - PPC_INS_BGECTR, - PPC_INS_BGECTRL, - PPC_INS_BGEL, - PPC_INS_BGELA, - PPC_INS_BGELR, - PPC_INS_BGELRL, - PPC_INS_BGT, - PPC_INS_BGTA, - PPC_INS_BGTCTR, - PPC_INS_BGTCTRL, - PPC_INS_BGTL, - PPC_INS_BGTLA, - PPC_INS_BGTLR, - PPC_INS_BGTLRL, - PPC_INS_BL, - PPC_INS_BLA, - PPC_INS_BLE, - PPC_INS_BLEA, - PPC_INS_BLECTR, - PPC_INS_BLECTRL, - PPC_INS_BLEL, - PPC_INS_BLELA, - PPC_INS_BLELR, - PPC_INS_BLELRL, - PPC_INS_BLR, - PPC_INS_BLRL, - PPC_INS_BLT, - PPC_INS_BLTA, - PPC_INS_BLTCTR, - PPC_INS_BLTCTRL, - PPC_INS_BLTL, - PPC_INS_BLTLA, - PPC_INS_BLTLR, - PPC_INS_BLTLRL, - PPC_INS_BNE, - PPC_INS_BNEA, - PPC_INS_BNECTR, - PPC_INS_BNECTRL, - PPC_INS_BNEL, - PPC_INS_BNELA, - PPC_INS_BNELR, - PPC_INS_BNELRL, - PPC_INS_BNG, - PPC_INS_BNGA, - PPC_INS_BNGCTR, - PPC_INS_BNGCTRL, - PPC_INS_BNGL, - PPC_INS_BNGLA, - PPC_INS_BNGLR, - PPC_INS_BNGLRL, - PPC_INS_BNL, - PPC_INS_BNLA, - PPC_INS_BNLCTR, - PPC_INS_BNLCTRL, - PPC_INS_BNLL, - PPC_INS_BNLLA, - PPC_INS_BNLLR, - PPC_INS_BNLLRL, - PPC_INS_BNS, - PPC_INS_BNSA, - PPC_INS_BNSCTR, - PPC_INS_BNSCTRL, - PPC_INS_BNSL, - PPC_INS_BNSLA, - PPC_INS_BNSLR, - PPC_INS_BNSLRL, - PPC_INS_BNU, - PPC_INS_BNUA, - PPC_INS_BNUCTR, - PPC_INS_BNUCTRL, - PPC_INS_BNUL, - PPC_INS_BNULA, - PPC_INS_BNULR, - PPC_INS_BNULRL, - PPC_INS_BPERMD, - PPC_INS_BRINC, - PPC_INS_BSO, - PPC_INS_BSOA, - PPC_INS_BSOCTR, - PPC_INS_BSOCTRL, - PPC_INS_BSOL, - PPC_INS_BSOLA, - PPC_INS_BSOLR, - PPC_INS_BSOLRL, - PPC_INS_BT, - PPC_INS_BTA, - PPC_INS_BTCTR, - PPC_INS_BTCTRL, - PPC_INS_BTL, - PPC_INS_BTLA, - PPC_INS_BTLR, - PPC_INS_BTLRL, - PPC_INS_BUN, - PPC_INS_BUNA, - PPC_INS_BUNCTR, - PPC_INS_BUNCTRL, - PPC_INS_BUNL, - PPC_INS_BUNLA, - PPC_INS_BUNLR, - PPC_INS_BUNLRL, - PPC_INS_CLRBHRB, - PPC_INS_CLRLDI, - PPC_INS_CLRLSLDI, - PPC_INS_CLRLSLWI, - PPC_INS_CLRLWI, - PPC_INS_CLRRDI, - PPC_INS_CLRRWI, - PPC_INS_CMP, - PPC_INS_CMPB, - PPC_INS_CMPD, - PPC_INS_CMPDI, - PPC_INS_CMPEQB, - PPC_INS_CMPI, - PPC_INS_CMPL, - PPC_INS_CMPLD, - PPC_INS_CMPLDI, - PPC_INS_CMPLI, - PPC_INS_CMPLW, - PPC_INS_CMPLWI, - PPC_INS_CMPRB, - PPC_INS_CMPW, - PPC_INS_CMPWI, - PPC_INS_CNTLZD, - PPC_INS_CNTLZW, - PPC_INS_CNTTZD, - PPC_INS_CNTTZW, - PPC_INS_COPY, - PPC_INS_COPY_FIRST, - PPC_INS_CP_ABORT, - PPC_INS_CRAND, - PPC_INS_CRANDC, - PPC_INS_CRCLR, - PPC_INS_CREQV, - PPC_INS_CRMOVE, - PPC_INS_CRNAND, - PPC_INS_CRNOR, - PPC_INS_CRNOT, - PPC_INS_CROR, - PPC_INS_CRORC, - PPC_INS_CRSET, - PPC_INS_CRXOR, - PPC_INS_DARN, - PPC_INS_DCBA, - PPC_INS_DCBF, - PPC_INS_DCBFEP, - PPC_INS_DCBFL, - PPC_INS_DCBFLP, - PPC_INS_DCBI, - PPC_INS_DCBST, - PPC_INS_DCBSTEP, - PPC_INS_DCBT, - PPC_INS_DCBTCT, - PPC_INS_DCBTDS, - PPC_INS_DCBTEP, - PPC_INS_DCBTST, - PPC_INS_DCBTSTCT, - PPC_INS_DCBTSTDS, - PPC_INS_DCBTSTEP, - PPC_INS_DCBTSTT, - PPC_INS_DCBTT, - PPC_INS_DCBZ, - PPC_INS_DCBZEP, - PPC_INS_DCBZL, - PPC_INS_DCBZLEP, - PPC_INS_DCCCI, - PPC_INS_DCI, - PPC_INS_DIVD, - PPC_INS_DIVDE, - PPC_INS_DIVDEU, - PPC_INS_DIVDU, - PPC_INS_DIVW, - PPC_INS_DIVWE, - PPC_INS_DIVWEU, - PPC_INS_DIVWU, - PPC_INS_DSS, - PPC_INS_DSSALL, - PPC_INS_DST, - PPC_INS_DSTST, - PPC_INS_DSTSTT, - PPC_INS_DSTT, - PPC_INS_EFDABS, - PPC_INS_EFDADD, - PPC_INS_EFDCFS, - PPC_INS_EFDCFSF, - PPC_INS_EFDCFSI, - PPC_INS_EFDCFSID, - PPC_INS_EFDCFUF, - PPC_INS_EFDCFUI, - PPC_INS_EFDCFUID, - PPC_INS_EFDCMPEQ, - PPC_INS_EFDCMPGT, - PPC_INS_EFDCMPLT, - PPC_INS_EFDCTSF, - PPC_INS_EFDCTSI, - PPC_INS_EFDCTSIDZ, - PPC_INS_EFDCTSIZ, - PPC_INS_EFDCTUF, - PPC_INS_EFDCTUI, - PPC_INS_EFDCTUIDZ, - PPC_INS_EFDCTUIZ, - PPC_INS_EFDDIV, - PPC_INS_EFDMUL, - PPC_INS_EFDNABS, - PPC_INS_EFDNEG, - PPC_INS_EFDSUB, - PPC_INS_EFDTSTEQ, - PPC_INS_EFDTSTGT, - PPC_INS_EFDTSTLT, - PPC_INS_EFSABS, - PPC_INS_EFSADD, - PPC_INS_EFSCFD, - PPC_INS_EFSCFSF, - PPC_INS_EFSCFSI, - PPC_INS_EFSCFUF, - PPC_INS_EFSCFUI, - PPC_INS_EFSCMPEQ, - PPC_INS_EFSCMPGT, - PPC_INS_EFSCMPLT, - PPC_INS_EFSCTSF, - PPC_INS_EFSCTSI, - PPC_INS_EFSCTSIZ, - PPC_INS_EFSCTUF, - PPC_INS_EFSCTUI, - PPC_INS_EFSCTUIZ, - PPC_INS_EFSDIV, - PPC_INS_EFSMUL, - PPC_INS_EFSNABS, - PPC_INS_EFSNEG, - PPC_INS_EFSSUB, - PPC_INS_EFSTSTEQ, - PPC_INS_EFSTSTGT, - PPC_INS_EFSTSTLT, - PPC_INS_EIEIO, - PPC_INS_EQV, - PPC_INS_EVABS, - PPC_INS_EVADDIW, - PPC_INS_EVADDSMIAAW, - PPC_INS_EVADDSSIAAW, - PPC_INS_EVADDUMIAAW, - PPC_INS_EVADDUSIAAW, - PPC_INS_EVADDW, - PPC_INS_EVAND, - PPC_INS_EVANDC, - PPC_INS_EVCMPEQ, - PPC_INS_EVCMPGTS, - PPC_INS_EVCMPGTU, - PPC_INS_EVCMPLTS, - PPC_INS_EVCMPLTU, - PPC_INS_EVCNTLSW, - PPC_INS_EVCNTLZW, - PPC_INS_EVDIVWS, - PPC_INS_EVDIVWU, - PPC_INS_EVEQV, - PPC_INS_EVEXTSB, - PPC_INS_EVEXTSH, - PPC_INS_EVFSABS, - PPC_INS_EVFSADD, - PPC_INS_EVFSCFSF, - PPC_INS_EVFSCFSI, - PPC_INS_EVFSCFUF, - PPC_INS_EVFSCFUI, - PPC_INS_EVFSCMPEQ, - PPC_INS_EVFSCMPGT, - PPC_INS_EVFSCMPLT, - PPC_INS_EVFSCTSF, - PPC_INS_EVFSCTSI, - PPC_INS_EVFSCTSIZ, - PPC_INS_EVFSCTUI, - PPC_INS_EVFSDIV, - PPC_INS_EVFSMUL, - PPC_INS_EVFSNABS, - PPC_INS_EVFSNEG, - PPC_INS_EVFSSUB, - PPC_INS_EVFSTSTEQ, - PPC_INS_EVFSTSTGT, - PPC_INS_EVFSTSTLT, - PPC_INS_EVLDD, - PPC_INS_EVLDDX, - PPC_INS_EVLDH, - PPC_INS_EVLDHX, - PPC_INS_EVLDW, - PPC_INS_EVLDWX, - PPC_INS_EVLHHESPLAT, - PPC_INS_EVLHHESPLATX, - PPC_INS_EVLHHOSSPLAT, - PPC_INS_EVLHHOSSPLATX, - PPC_INS_EVLHHOUSPLAT, - PPC_INS_EVLHHOUSPLATX, - PPC_INS_EVLWHE, - PPC_INS_EVLWHEX, - PPC_INS_EVLWHOS, - PPC_INS_EVLWHOSX, - PPC_INS_EVLWHOU, - PPC_INS_EVLWHOUX, - PPC_INS_EVLWHSPLAT, - PPC_INS_EVLWHSPLATX, - PPC_INS_EVLWWSPLAT, - PPC_INS_EVLWWSPLATX, - PPC_INS_EVMERGEHI, - PPC_INS_EVMERGEHILO, - PPC_INS_EVMERGELO, - PPC_INS_EVMERGELOHI, - PPC_INS_EVMHEGSMFAA, - PPC_INS_EVMHEGSMFAN, - PPC_INS_EVMHEGSMIAA, - PPC_INS_EVMHEGSMIAN, - PPC_INS_EVMHEGUMIAA, - PPC_INS_EVMHEGUMIAN, - PPC_INS_EVMHESMF, - PPC_INS_EVMHESMFA, - PPC_INS_EVMHESMFAAW, - PPC_INS_EVMHESMFANW, - PPC_INS_EVMHESMI, - PPC_INS_EVMHESMIA, - PPC_INS_EVMHESMIAAW, - PPC_INS_EVMHESMIANW, - PPC_INS_EVMHESSF, - PPC_INS_EVMHESSFA, - PPC_INS_EVMHESSFAAW, - PPC_INS_EVMHESSFANW, - PPC_INS_EVMHESSIAAW, - PPC_INS_EVMHESSIANW, - PPC_INS_EVMHEUMI, - PPC_INS_EVMHEUMIA, - PPC_INS_EVMHEUMIAAW, - PPC_INS_EVMHEUMIANW, - PPC_INS_EVMHEUSIAAW, - PPC_INS_EVMHEUSIANW, - PPC_INS_EVMHOGSMFAA, - PPC_INS_EVMHOGSMFAN, - PPC_INS_EVMHOGSMIAA, - PPC_INS_EVMHOGSMIAN, - PPC_INS_EVMHOGUMIAA, - PPC_INS_EVMHOGUMIAN, - PPC_INS_EVMHOSMF, - PPC_INS_EVMHOSMFA, - PPC_INS_EVMHOSMFAAW, - PPC_INS_EVMHOSMFANW, - PPC_INS_EVMHOSMI, - PPC_INS_EVMHOSMIA, - PPC_INS_EVMHOSMIAAW, - PPC_INS_EVMHOSMIANW, - PPC_INS_EVMHOSSF, - PPC_INS_EVMHOSSFA, - PPC_INS_EVMHOSSFAAW, - PPC_INS_EVMHOSSFANW, - PPC_INS_EVMHOSSIAAW, - PPC_INS_EVMHOSSIANW, - PPC_INS_EVMHOUMI, - PPC_INS_EVMHOUMIA, - PPC_INS_EVMHOUMIAAW, - PPC_INS_EVMHOUMIANW, - PPC_INS_EVMHOUSIAAW, - PPC_INS_EVMHOUSIANW, - PPC_INS_EVMRA, - PPC_INS_EVMWHSMF, - PPC_INS_EVMWHSMFA, - PPC_INS_EVMWHSMI, - PPC_INS_EVMWHSMIA, - PPC_INS_EVMWHSSF, - PPC_INS_EVMWHSSFA, - PPC_INS_EVMWHUMI, - PPC_INS_EVMWHUMIA, - PPC_INS_EVMWLSMIAAW, - PPC_INS_EVMWLSMIANW, - PPC_INS_EVMWLSSIAAW, - PPC_INS_EVMWLSSIANW, - PPC_INS_EVMWLUMI, - PPC_INS_EVMWLUMIA, - PPC_INS_EVMWLUMIAAW, - PPC_INS_EVMWLUMIANW, - PPC_INS_EVMWLUSIAAW, - PPC_INS_EVMWLUSIANW, - PPC_INS_EVMWSMF, - PPC_INS_EVMWSMFA, - PPC_INS_EVMWSMFAA, - PPC_INS_EVMWSMFAN, - PPC_INS_EVMWSMI, - PPC_INS_EVMWSMIA, - PPC_INS_EVMWSMIAA, - PPC_INS_EVMWSMIAN, - PPC_INS_EVMWSSF, - PPC_INS_EVMWSSFA, - PPC_INS_EVMWSSFAA, - PPC_INS_EVMWSSFAN, - PPC_INS_EVMWUMI, - PPC_INS_EVMWUMIA, - PPC_INS_EVMWUMIAA, - PPC_INS_EVMWUMIAN, - PPC_INS_EVNAND, - PPC_INS_EVNEG, - PPC_INS_EVNOR, - PPC_INS_EVOR, - PPC_INS_EVORC, - PPC_INS_EVRLW, - PPC_INS_EVRLWI, - PPC_INS_EVRNDW, - PPC_INS_EVSEL, - PPC_INS_EVSLW, - PPC_INS_EVSLWI, - PPC_INS_EVSPLATFI, - PPC_INS_EVSPLATI, - PPC_INS_EVSRWIS, - PPC_INS_EVSRWIU, - PPC_INS_EVSRWS, - PPC_INS_EVSRWU, - PPC_INS_EVSTDD, - PPC_INS_EVSTDDX, - PPC_INS_EVSTDH, - PPC_INS_EVSTDHX, - PPC_INS_EVSTDW, - PPC_INS_EVSTDWX, - PPC_INS_EVSTWHE, - PPC_INS_EVSTWHEX, - PPC_INS_EVSTWHO, - PPC_INS_EVSTWHOX, - PPC_INS_EVSTWWE, - PPC_INS_EVSTWWEX, - PPC_INS_EVSTWWO, - PPC_INS_EVSTWWOX, - PPC_INS_EVSUBFSMIAAW, - PPC_INS_EVSUBFSSIAAW, - PPC_INS_EVSUBFUMIAAW, - PPC_INS_EVSUBFUSIAAW, - PPC_INS_EVSUBFW, - PPC_INS_EVSUBIFW, - PPC_INS_EVXOR, - PPC_INS_EXTLDI, - PPC_INS_EXTLWI, - PPC_INS_EXTRDI, - PPC_INS_EXTRWI, - PPC_INS_EXTSB, - PPC_INS_EXTSH, - PPC_INS_EXTSW, - PPC_INS_EXTSWSLI, - PPC_INS_FABS, - PPC_INS_FADD, - PPC_INS_FADDS, - PPC_INS_FCFID, - PPC_INS_FCFIDS, - PPC_INS_FCFIDU, - PPC_INS_FCFIDUS, - PPC_INS_FCMPU, - PPC_INS_FCPSGN, - PPC_INS_FCTID, - PPC_INS_FCTIDU, - PPC_INS_FCTIDUZ, - PPC_INS_FCTIDZ, - PPC_INS_FCTIW, - PPC_INS_FCTIWU, - PPC_INS_FCTIWUZ, - PPC_INS_FCTIWZ, - PPC_INS_FDIV, - PPC_INS_FDIVS, - PPC_INS_FMADD, - PPC_INS_FMADDS, - PPC_INS_FMR, - PPC_INS_FMSUB, - PPC_INS_FMSUBS, - PPC_INS_FMUL, - PPC_INS_FMULS, - PPC_INS_FNABS, - PPC_INS_FNEG, - PPC_INS_FNMADD, - PPC_INS_FNMADDS, - PPC_INS_FNMSUB, - PPC_INS_FNMSUBS, - PPC_INS_FRE, - PPC_INS_FRES, - PPC_INS_FRIM, - PPC_INS_FRIN, - PPC_INS_FRIP, - PPC_INS_FRIZ, - PPC_INS_FRSP, - PPC_INS_FRSQRTE, - PPC_INS_FRSQRTES, - PPC_INS_FSEL, - PPC_INS_FSQRT, - PPC_INS_FSQRTS, - PPC_INS_FSUB, - PPC_INS_FSUBS, - PPC_INS_FTDIV, - PPC_INS_FTSQRT, - PPC_INS_HRFID, - PPC_INS_ICBI, - PPC_INS_ICBIEP, - PPC_INS_ICBLC, - PPC_INS_ICBLQ, - PPC_INS_ICBT, - PPC_INS_ICBTLS, - PPC_INS_ICCCI, - PPC_INS_ICI, - PPC_INS_INSLWI, - PPC_INS_INSRDI, - PPC_INS_INSRWI, - PPC_INS_ISEL, - PPC_INS_ISYNC, - PPC_INS_LA, - PPC_INS_LBARX, - PPC_INS_LBEPX, - PPC_INS_LBZ, - PPC_INS_LBZCIX, - PPC_INS_LBZU, - PPC_INS_LBZUX, - PPC_INS_LBZX, - PPC_INS_LD, - PPC_INS_LDARX, - PPC_INS_LDAT, - PPC_INS_LDBRX, - PPC_INS_LDCIX, - PPC_INS_LDMX, - PPC_INS_LDU, - PPC_INS_LDUX, - PPC_INS_LDX, - PPC_INS_LFD, - PPC_INS_LFDEPX, - PPC_INS_LFDU, - PPC_INS_LFDUX, - PPC_INS_LFDX, - PPC_INS_LFIWAX, - PPC_INS_LFIWZX, - PPC_INS_LFS, - PPC_INS_LFSU, - PPC_INS_LFSUX, - PPC_INS_LFSX, - PPC_INS_LHA, - PPC_INS_LHARX, - PPC_INS_LHAU, - PPC_INS_LHAUX, - PPC_INS_LHAX, - PPC_INS_LHBRX, - PPC_INS_LHEPX, - PPC_INS_LHZ, - PPC_INS_LHZCIX, - PPC_INS_LHZU, - PPC_INS_LHZUX, - PPC_INS_LHZX, - PPC_INS_LI, - PPC_INS_LIS, - PPC_INS_LMW, - PPC_INS_LNIA, - PPC_INS_LSWI, - PPC_INS_LVEBX, - PPC_INS_LVEHX, - PPC_INS_LVEWX, - PPC_INS_LVSL, - PPC_INS_LVSR, - PPC_INS_LVX, - PPC_INS_LVXL, - PPC_INS_LWA, - PPC_INS_LWARX, - PPC_INS_LWAT, - PPC_INS_LWAUX, - PPC_INS_LWAX, - PPC_INS_LWBRX, - PPC_INS_LWEPX, - PPC_INS_LWSYNC, - PPC_INS_LWZ, - PPC_INS_LWZCIX, - PPC_INS_LWZU, - PPC_INS_LWZUX, - PPC_INS_LWZX, - PPC_INS_LXSD, - PPC_INS_LXSDX, - PPC_INS_LXSIBZX, - PPC_INS_LXSIHZX, - PPC_INS_LXSIWAX, - PPC_INS_LXSIWZX, - PPC_INS_LXSSP, - PPC_INS_LXSSPX, - PPC_INS_LXV, - PPC_INS_LXVB16X, - PPC_INS_LXVD2X, - PPC_INS_LXVDSX, - PPC_INS_LXVH8X, - PPC_INS_LXVL, - PPC_INS_LXVLL, - PPC_INS_LXVW4X, - PPC_INS_LXVWSX, - PPC_INS_LXVX, - PPC_INS_MADDHD, - PPC_INS_MADDHDU, - PPC_INS_MADDLD, - PPC_INS_MBAR, - PPC_INS_MCRF, - PPC_INS_MCRFS, - PPC_INS_MCRXRX, - PPC_INS_MFAMR, - PPC_INS_MFASR, - PPC_INS_MFBHRBE, - PPC_INS_MFBR0, - PPC_INS_MFBR1, - PPC_INS_MFBR2, - PPC_INS_MFBR3, - PPC_INS_MFBR4, - PPC_INS_MFBR5, - PPC_INS_MFBR6, - PPC_INS_MFBR7, - PPC_INS_MFCFAR, - PPC_INS_MFCR, - PPC_INS_MFCTR, - PPC_INS_MFDAR, - PPC_INS_MFDBATL, - PPC_INS_MFDBATU, - PPC_INS_MFDCCR, - PPC_INS_MFDCR, - PPC_INS_MFDEAR, - PPC_INS_MFDEC, - PPC_INS_MFDSCR, - PPC_INS_MFDSISR, - PPC_INS_MFESR, - PPC_INS_MFFPRD, - PPC_INS_MFFS, - PPC_INS_MFFSCDRN, - PPC_INS_MFFSCDRNI, - PPC_INS_MFFSCE, - PPC_INS_MFFSCRN, - PPC_INS_MFFSCRNI, - PPC_INS_MFFSL, - PPC_INS_MFIBATL, - PPC_INS_MFIBATU, - PPC_INS_MFICCR, - PPC_INS_MFLR, - PPC_INS_MFMSR, - PPC_INS_MFOCRF, - PPC_INS_MFPID, - PPC_INS_MFPMR, - PPC_INS_MFPVR, - PPC_INS_MFRTCL, - PPC_INS_MFRTCU, - PPC_INS_MFSDR1, - PPC_INS_MFSPEFSCR, - PPC_INS_MFSPR, - PPC_INS_MFSPRG, - PPC_INS_MFSPRG0, - PPC_INS_MFSPRG1, - PPC_INS_MFSPRG2, - PPC_INS_MFSPRG3, - PPC_INS_MFSPRG4, - PPC_INS_MFSPRG5, - PPC_INS_MFSPRG6, - PPC_INS_MFSPRG7, - PPC_INS_MFSR, - PPC_INS_MFSRIN, - PPC_INS_MFSRR0, - PPC_INS_MFSRR1, - PPC_INS_MFSRR2, - PPC_INS_MFSRR3, - PPC_INS_MFTB, - PPC_INS_MFTBHI, - PPC_INS_MFTBL, - PPC_INS_MFTBLO, - PPC_INS_MFTBU, - PPC_INS_MFTCR, - PPC_INS_MFVRD, - PPC_INS_MFVRSAVE, - PPC_INS_MFVSCR, - PPC_INS_MFVSRD, - PPC_INS_MFVSRLD, - PPC_INS_MFVSRWZ, - PPC_INS_MFXER, - PPC_INS_MODSD, - PPC_INS_MODSW, - PPC_INS_MODUD, - PPC_INS_MODUW, - PPC_INS_MR, - PPC_INS_MSGSYNC, - PPC_INS_MSYNC, - PPC_INS_MTAMR, - PPC_INS_MTASR, - PPC_INS_MTBR0, - PPC_INS_MTBR1, - PPC_INS_MTBR2, - PPC_INS_MTBR3, - PPC_INS_MTBR4, - PPC_INS_MTBR5, - PPC_INS_MTBR6, - PPC_INS_MTBR7, - PPC_INS_MTCFAR, - PPC_INS_MTCR, - PPC_INS_MTCRF, - PPC_INS_MTCTR, - PPC_INS_MTDAR, - PPC_INS_MTDBATL, - PPC_INS_MTDBATU, - PPC_INS_MTDCCR, - PPC_INS_MTDCR, - PPC_INS_MTDEAR, - PPC_INS_MTDEC, - PPC_INS_MTDSCR, - PPC_INS_MTDSISR, - PPC_INS_MTESR, - PPC_INS_MTFSB0, - PPC_INS_MTFSB1, - PPC_INS_MTFSF, - PPC_INS_MTFSFI, - PPC_INS_MTIBATL, - PPC_INS_MTIBATU, - PPC_INS_MTICCR, - PPC_INS_MTLR, - PPC_INS_MTMSR, - PPC_INS_MTMSRD, - PPC_INS_MTOCRF, - PPC_INS_MTPID, - PPC_INS_MTPMR, - PPC_INS_MTSDR1, - PPC_INS_MTSPEFSCR, - PPC_INS_MTSPR, - PPC_INS_MTSPRG, - PPC_INS_MTSPRG0, - PPC_INS_MTSPRG1, - PPC_INS_MTSPRG2, - PPC_INS_MTSPRG3, - PPC_INS_MTSPRG4, - PPC_INS_MTSPRG5, - PPC_INS_MTSPRG6, - PPC_INS_MTSPRG7, - PPC_INS_MTSR, - PPC_INS_MTSRIN, - PPC_INS_MTSRR0, - PPC_INS_MTSRR1, - PPC_INS_MTSRR2, - PPC_INS_MTSRR3, - PPC_INS_MTTBHI, - PPC_INS_MTTBL, - PPC_INS_MTTBLO, - PPC_INS_MTTBU, - PPC_INS_MTTCR, - PPC_INS_MTVRSAVE, - PPC_INS_MTVSCR, - PPC_INS_MTVSRD, - PPC_INS_MTVSRDD, - PPC_INS_MTVSRWA, - PPC_INS_MTVSRWS, - PPC_INS_MTVSRWZ, - PPC_INS_MTXER, - PPC_INS_MULHD, - PPC_INS_MULHDU, - PPC_INS_MULHW, - PPC_INS_MULHWU, - PPC_INS_MULLD, - PPC_INS_MULLI, - PPC_INS_MULLW, - PPC_INS_NAND, - PPC_INS_NAP, - PPC_INS_NEG, - PPC_INS_NOP, - PPC_INS_NOR, - PPC_INS_NOT, - PPC_INS_OR, - PPC_INS_ORC, - PPC_INS_ORI, - PPC_INS_ORIS, - PPC_INS_PASTE, - PPC_INS_PASTE_LAST, - PPC_INS_POPCNTB, - PPC_INS_POPCNTD, - PPC_INS_POPCNTW, - PPC_INS_PTESYNC, - PPC_INS_QVALIGNI, - PPC_INS_QVESPLATI, - PPC_INS_QVFABS, - PPC_INS_QVFADD, - PPC_INS_QVFADDS, - PPC_INS_QVFAND, - PPC_INS_QVFANDC, - PPC_INS_QVFCFID, - PPC_INS_QVFCFIDS, - PPC_INS_QVFCFIDU, - PPC_INS_QVFCFIDUS, - PPC_INS_QVFCLR, - PPC_INS_QVFCMPEQ, - PPC_INS_QVFCMPGT, - PPC_INS_QVFCMPLT, - PPC_INS_QVFCPSGN, - PPC_INS_QVFCTFB, - PPC_INS_QVFCTID, - PPC_INS_QVFCTIDU, - PPC_INS_QVFCTIDUZ, - PPC_INS_QVFCTIDZ, - PPC_INS_QVFCTIW, - PPC_INS_QVFCTIWU, - PPC_INS_QVFCTIWUZ, - PPC_INS_QVFCTIWZ, - PPC_INS_QVFEQU, - PPC_INS_QVFLOGICAL, - PPC_INS_QVFMADD, - PPC_INS_QVFMADDS, - PPC_INS_QVFMR, - PPC_INS_QVFMSUB, - PPC_INS_QVFMSUBS, - PPC_INS_QVFMUL, - PPC_INS_QVFMULS, - PPC_INS_QVFNABS, - PPC_INS_QVFNAND, - PPC_INS_QVFNEG, - PPC_INS_QVFNMADD, - PPC_INS_QVFNMADDS, - PPC_INS_QVFNMSUB, - PPC_INS_QVFNMSUBS, - PPC_INS_QVFNOR, - PPC_INS_QVFNOT, - PPC_INS_QVFOR, - PPC_INS_QVFORC, - PPC_INS_QVFPERM, - PPC_INS_QVFRE, - PPC_INS_QVFRES, - PPC_INS_QVFRIM, - PPC_INS_QVFRIN, - PPC_INS_QVFRIP, - PPC_INS_QVFRIZ, - PPC_INS_QVFRSP, - PPC_INS_QVFRSQRTE, - PPC_INS_QVFRSQRTES, - PPC_INS_QVFSEL, - PPC_INS_QVFSET, - PPC_INS_QVFSUB, - PPC_INS_QVFSUBS, - PPC_INS_QVFTSTNAN, - PPC_INS_QVFXMADD, - PPC_INS_QVFXMADDS, - PPC_INS_QVFXMUL, - PPC_INS_QVFXMULS, - PPC_INS_QVFXOR, - PPC_INS_QVFXXCPNMADD, - PPC_INS_QVFXXCPNMADDS, - PPC_INS_QVFXXMADD, - PPC_INS_QVFXXMADDS, - PPC_INS_QVFXXNPMADD, - PPC_INS_QVFXXNPMADDS, - PPC_INS_QVGPCI, - PPC_INS_QVLFCDUX, - PPC_INS_QVLFCDUXA, - PPC_INS_QVLFCDX, - PPC_INS_QVLFCDXA, - PPC_INS_QVLFCSUX, - PPC_INS_QVLFCSUXA, - PPC_INS_QVLFCSX, - PPC_INS_QVLFCSXA, - PPC_INS_QVLFDUX, - PPC_INS_QVLFDUXA, - PPC_INS_QVLFDX, - PPC_INS_QVLFDXA, - PPC_INS_QVLFIWAX, - PPC_INS_QVLFIWAXA, - PPC_INS_QVLFIWZX, - PPC_INS_QVLFIWZXA, - PPC_INS_QVLFSUX, - PPC_INS_QVLFSUXA, - PPC_INS_QVLFSX, - PPC_INS_QVLFSXA, - PPC_INS_QVLPCLDX, - PPC_INS_QVLPCLSX, - PPC_INS_QVLPCRDX, - PPC_INS_QVLPCRSX, - PPC_INS_QVSTFCDUX, - PPC_INS_QVSTFCDUXA, - PPC_INS_QVSTFCDUXI, - PPC_INS_QVSTFCDUXIA, - PPC_INS_QVSTFCDX, - PPC_INS_QVSTFCDXA, - PPC_INS_QVSTFCDXI, - PPC_INS_QVSTFCDXIA, - PPC_INS_QVSTFCSUX, - PPC_INS_QVSTFCSUXA, - PPC_INS_QVSTFCSUXI, - PPC_INS_QVSTFCSUXIA, - PPC_INS_QVSTFCSX, - PPC_INS_QVSTFCSXA, - PPC_INS_QVSTFCSXI, - PPC_INS_QVSTFCSXIA, - PPC_INS_QVSTFDUX, - PPC_INS_QVSTFDUXA, - PPC_INS_QVSTFDUXI, - PPC_INS_QVSTFDUXIA, - PPC_INS_QVSTFDX, - PPC_INS_QVSTFDXA, - PPC_INS_QVSTFDXI, - PPC_INS_QVSTFDXIA, - PPC_INS_QVSTFIWX, - PPC_INS_QVSTFIWXA, - PPC_INS_QVSTFSUX, - PPC_INS_QVSTFSUXA, - PPC_INS_QVSTFSUXI, - PPC_INS_QVSTFSUXIA, - PPC_INS_QVSTFSX, - PPC_INS_QVSTFSXA, - PPC_INS_QVSTFSXI, - PPC_INS_QVSTFSXIA, - PPC_INS_RFCI, - PPC_INS_RFDI, - PPC_INS_RFEBB, - PPC_INS_RFI, - PPC_INS_RFID, - PPC_INS_RFMCI, - PPC_INS_RLDCL, - PPC_INS_RLDCR, - PPC_INS_RLDIC, - PPC_INS_RLDICL, - PPC_INS_RLDICR, - PPC_INS_RLDIMI, - PPC_INS_RLWIMI, - PPC_INS_RLWINM, - PPC_INS_RLWNM, - PPC_INS_ROTLD, - PPC_INS_ROTLDI, - PPC_INS_ROTLW, - PPC_INS_ROTLWI, - PPC_INS_ROTRDI, - PPC_INS_ROTRWI, - PPC_INS_SC, - PPC_INS_SETB, - PPC_INS_SLBIA, - PPC_INS_SLBIE, - PPC_INS_SLBIEG, - PPC_INS_SLBMFEE, - PPC_INS_SLBMFEV, - PPC_INS_SLBMTE, - PPC_INS_SLBSYNC, - PPC_INS_SLD, - PPC_INS_SLDI, - PPC_INS_SLW, - PPC_INS_SLWI, - PPC_INS_SRAD, - PPC_INS_SRADI, - PPC_INS_SRAW, - PPC_INS_SRAWI, - PPC_INS_SRD, - PPC_INS_SRDI, - PPC_INS_SRW, - PPC_INS_SRWI, - PPC_INS_STB, - PPC_INS_STBCIX, - PPC_INS_STBCX, - PPC_INS_STBEPX, - PPC_INS_STBU, - PPC_INS_STBUX, - PPC_INS_STBX, - PPC_INS_STD, - PPC_INS_STDAT, - PPC_INS_STDBRX, - PPC_INS_STDCIX, - PPC_INS_STDCX, - PPC_INS_STDU, - PPC_INS_STDUX, - PPC_INS_STDX, - PPC_INS_STFD, - PPC_INS_STFDEPX, - PPC_INS_STFDU, - PPC_INS_STFDUX, - PPC_INS_STFDX, - PPC_INS_STFIWX, - PPC_INS_STFS, - PPC_INS_STFSU, - PPC_INS_STFSUX, - PPC_INS_STFSX, - PPC_INS_STH, - PPC_INS_STHBRX, - PPC_INS_STHCIX, - PPC_INS_STHCX, - PPC_INS_STHEPX, - PPC_INS_STHU, - PPC_INS_STHUX, - PPC_INS_STHX, - PPC_INS_STMW, - PPC_INS_STOP, - PPC_INS_STSWI, - PPC_INS_STVEBX, - PPC_INS_STVEHX, - PPC_INS_STVEWX, - PPC_INS_STVX, - PPC_INS_STVXL, - PPC_INS_STW, - PPC_INS_STWAT, - PPC_INS_STWBRX, - PPC_INS_STWCIX, - PPC_INS_STWCX, - PPC_INS_STWEPX, - PPC_INS_STWU, - PPC_INS_STWUX, - PPC_INS_STWX, - PPC_INS_STXSD, - PPC_INS_STXSDX, - PPC_INS_STXSIBX, - PPC_INS_STXSIHX, - PPC_INS_STXSIWX, - PPC_INS_STXSSP, - PPC_INS_STXSSPX, - PPC_INS_STXV, - PPC_INS_STXVB16X, - PPC_INS_STXVD2X, - PPC_INS_STXVH8X, - PPC_INS_STXVL, - PPC_INS_STXVLL, - PPC_INS_STXVW4X, - PPC_INS_STXVX, - PPC_INS_SUB, - PPC_INS_SUBC, - PPC_INS_SUBF, - PPC_INS_SUBFC, - PPC_INS_SUBFE, - PPC_INS_SUBFIC, - PPC_INS_SUBFME, - PPC_INS_SUBFZE, - PPC_INS_SUBI, - PPC_INS_SUBIC, - PPC_INS_SUBIS, - PPC_INS_SUBPCIS, - PPC_INS_SYNC, - PPC_INS_TABORT, - PPC_INS_TABORTDC, - PPC_INS_TABORTDCI, - PPC_INS_TABORTWC, - PPC_INS_TABORTWCI, - PPC_INS_TBEGIN, - PPC_INS_TCHECK, - PPC_INS_TD, - PPC_INS_TDEQ, - PPC_INS_TDEQI, - PPC_INS_TDGE, - PPC_INS_TDGEI, - PPC_INS_TDGT, - PPC_INS_TDGTI, - PPC_INS_TDI, - PPC_INS_TDLE, - PPC_INS_TDLEI, - PPC_INS_TDLGE, - PPC_INS_TDLGEI, - PPC_INS_TDLGT, - PPC_INS_TDLGTI, - PPC_INS_TDLLE, - PPC_INS_TDLLEI, - PPC_INS_TDLLT, - PPC_INS_TDLLTI, - PPC_INS_TDLNG, - PPC_INS_TDLNGI, - PPC_INS_TDLNL, - PPC_INS_TDLNLI, - PPC_INS_TDLT, - PPC_INS_TDLTI, - PPC_INS_TDNE, - PPC_INS_TDNEI, - PPC_INS_TDNG, - PPC_INS_TDNGI, - PPC_INS_TDNL, - PPC_INS_TDNLI, - PPC_INS_TDU, - PPC_INS_TDUI, - PPC_INS_TEND, - PPC_INS_TLBIA, - PPC_INS_TLBIE, - PPC_INS_TLBIEL, - PPC_INS_TLBIVAX, - PPC_INS_TLBLD, - PPC_INS_TLBLI, - PPC_INS_TLBRE, - PPC_INS_TLBREHI, - PPC_INS_TLBRELO, - PPC_INS_TLBSX, - PPC_INS_TLBSYNC, - PPC_INS_TLBWE, - PPC_INS_TLBWEHI, - PPC_INS_TLBWELO, - PPC_INS_TRAP, - PPC_INS_TRECHKPT, - PPC_INS_TRECLAIM, - PPC_INS_TSR, - PPC_INS_TW, - PPC_INS_TWEQ, - PPC_INS_TWEQI, - PPC_INS_TWGE, - PPC_INS_TWGEI, - PPC_INS_TWGT, - PPC_INS_TWGTI, - PPC_INS_TWI, - PPC_INS_TWLE, - PPC_INS_TWLEI, - PPC_INS_TWLGE, - PPC_INS_TWLGEI, - PPC_INS_TWLGT, - PPC_INS_TWLGTI, - PPC_INS_TWLLE, - PPC_INS_TWLLEI, - PPC_INS_TWLLT, - PPC_INS_TWLLTI, - PPC_INS_TWLNG, - PPC_INS_TWLNGI, - PPC_INS_TWLNL, - PPC_INS_TWLNLI, - PPC_INS_TWLT, - PPC_INS_TWLTI, - PPC_INS_TWNE, - PPC_INS_TWNEI, - PPC_INS_TWNG, - PPC_INS_TWNGI, - PPC_INS_TWNL, - PPC_INS_TWNLI, - PPC_INS_TWU, - PPC_INS_TWUI, - PPC_INS_VABSDUB, - PPC_INS_VABSDUH, - PPC_INS_VABSDUW, - PPC_INS_VADDCUQ, - PPC_INS_VADDCUW, - PPC_INS_VADDECUQ, - PPC_INS_VADDEUQM, - PPC_INS_VADDFP, - PPC_INS_VADDSBS, - PPC_INS_VADDSHS, - PPC_INS_VADDSWS, - PPC_INS_VADDUBM, - PPC_INS_VADDUBS, - PPC_INS_VADDUDM, - PPC_INS_VADDUHM, - PPC_INS_VADDUHS, - PPC_INS_VADDUQM, - PPC_INS_VADDUWM, - PPC_INS_VADDUWS, - PPC_INS_VAND, - PPC_INS_VANDC, - PPC_INS_VAVGSB, - PPC_INS_VAVGSH, - PPC_INS_VAVGSW, - PPC_INS_VAVGUB, - PPC_INS_VAVGUH, - PPC_INS_VAVGUW, - PPC_INS_VBPERMD, - PPC_INS_VBPERMQ, - PPC_INS_VCFSX, - PPC_INS_VCFUX, - PPC_INS_VCIPHER, - PPC_INS_VCIPHERLAST, - PPC_INS_VCLZB, - PPC_INS_VCLZD, - PPC_INS_VCLZH, - PPC_INS_VCLZLSBB, - PPC_INS_VCLZW, - PPC_INS_VCMPBFP, - PPC_INS_VCMPEQFP, - PPC_INS_VCMPEQUB, - PPC_INS_VCMPEQUD, - PPC_INS_VCMPEQUH, - PPC_INS_VCMPEQUW, - PPC_INS_VCMPGEFP, - PPC_INS_VCMPGTFP, - PPC_INS_VCMPGTSB, - PPC_INS_VCMPGTSD, - PPC_INS_VCMPGTSH, - PPC_INS_VCMPGTSW, - PPC_INS_VCMPGTUB, - PPC_INS_VCMPGTUD, - PPC_INS_VCMPGTUH, - PPC_INS_VCMPGTUW, - PPC_INS_VCMPNEB, - PPC_INS_VCMPNEH, - PPC_INS_VCMPNEW, - PPC_INS_VCMPNEZB, - PPC_INS_VCMPNEZH, - PPC_INS_VCMPNEZW, - PPC_INS_VCTSXS, - PPC_INS_VCTUXS, - PPC_INS_VCTZB, - PPC_INS_VCTZD, - PPC_INS_VCTZH, - PPC_INS_VCTZLSBB, - PPC_INS_VCTZW, - PPC_INS_VEQV, - PPC_INS_VEXPTEFP, - PPC_INS_VEXTRACTD, - PPC_INS_VEXTRACTUB, - PPC_INS_VEXTRACTUH, - PPC_INS_VEXTRACTUW, - PPC_INS_VEXTSB2D, - PPC_INS_VEXTSB2W, - PPC_INS_VEXTSH2D, - PPC_INS_VEXTSH2W, - PPC_INS_VEXTSW2D, - PPC_INS_VEXTUBLX, - PPC_INS_VEXTUBRX, - PPC_INS_VEXTUHLX, - PPC_INS_VEXTUHRX, - PPC_INS_VEXTUWLX, - PPC_INS_VEXTUWRX, - PPC_INS_VGBBD, - PPC_INS_VINSERTB, - PPC_INS_VINSERTD, - PPC_INS_VINSERTH, - PPC_INS_VINSERTW, - PPC_INS_VLOGEFP, - PPC_INS_VMADDFP, - PPC_INS_VMAXFP, - PPC_INS_VMAXSB, - PPC_INS_VMAXSD, - PPC_INS_VMAXSH, - PPC_INS_VMAXSW, - PPC_INS_VMAXUB, - PPC_INS_VMAXUD, - PPC_INS_VMAXUH, - PPC_INS_VMAXUW, - PPC_INS_VMHADDSHS, - PPC_INS_VMHRADDSHS, - PPC_INS_VMINFP, - PPC_INS_VMINSB, - PPC_INS_VMINSD, - PPC_INS_VMINSH, - PPC_INS_VMINSW, - PPC_INS_VMINUB, - PPC_INS_VMINUD, - PPC_INS_VMINUH, - PPC_INS_VMINUW, - PPC_INS_VMLADDUHM, - PPC_INS_VMR, - PPC_INS_VMRGEW, - PPC_INS_VMRGHB, - PPC_INS_VMRGHH, - PPC_INS_VMRGHW, - PPC_INS_VMRGLB, - PPC_INS_VMRGLH, - PPC_INS_VMRGLW, - PPC_INS_VMRGOW, - PPC_INS_VMSUMMBM, - PPC_INS_VMSUMSHM, - PPC_INS_VMSUMSHS, - PPC_INS_VMSUMUBM, - PPC_INS_VMSUMUHM, - PPC_INS_VMSUMUHS, - PPC_INS_VMUL10CUQ, - PPC_INS_VMUL10ECUQ, - PPC_INS_VMUL10EUQ, - PPC_INS_VMUL10UQ, - PPC_INS_VMULESB, - PPC_INS_VMULESH, - PPC_INS_VMULESW, - PPC_INS_VMULEUB, - PPC_INS_VMULEUH, - PPC_INS_VMULEUW, - PPC_INS_VMULOSB, - PPC_INS_VMULOSH, - PPC_INS_VMULOSW, - PPC_INS_VMULOUB, - PPC_INS_VMULOUH, - PPC_INS_VMULOUW, - PPC_INS_VMULUWM, - PPC_INS_VNAND, - PPC_INS_VNCIPHER, - PPC_INS_VNCIPHERLAST, - PPC_INS_VNEGD, - PPC_INS_VNEGW, - PPC_INS_VNMSUBFP, - PPC_INS_VNOR, - PPC_INS_VNOT, - PPC_INS_VOR, - PPC_INS_VORC, - PPC_INS_VPERM, - PPC_INS_VPERMR, - PPC_INS_VPERMXOR, - PPC_INS_VPKPX, - PPC_INS_VPKSDSS, - PPC_INS_VPKSDUS, - PPC_INS_VPKSHSS, - PPC_INS_VPKSHUS, - PPC_INS_VPKSWSS, - PPC_INS_VPKSWUS, - PPC_INS_VPKUDUM, - PPC_INS_VPKUDUS, - PPC_INS_VPKUHUM, - PPC_INS_VPKUHUS, - PPC_INS_VPKUWUM, - PPC_INS_VPKUWUS, - PPC_INS_VPMSUMB, - PPC_INS_VPMSUMD, - PPC_INS_VPMSUMH, - PPC_INS_VPMSUMW, - PPC_INS_VPOPCNTB, - PPC_INS_VPOPCNTD, - PPC_INS_VPOPCNTH, - PPC_INS_VPOPCNTW, - PPC_INS_VPRTYBD, - PPC_INS_VPRTYBQ, - PPC_INS_VPRTYBW, - PPC_INS_VREFP, - PPC_INS_VRFIM, - PPC_INS_VRFIN, - PPC_INS_VRFIP, - PPC_INS_VRFIZ, - PPC_INS_VRLB, - PPC_INS_VRLD, - PPC_INS_VRLDMI, - PPC_INS_VRLDNM, - PPC_INS_VRLH, - PPC_INS_VRLW, - PPC_INS_VRLWMI, - PPC_INS_VRLWNM, - PPC_INS_VRSQRTEFP, - PPC_INS_VSBOX, - PPC_INS_VSEL, - PPC_INS_VSHASIGMAD, - PPC_INS_VSHASIGMAW, - PPC_INS_VSL, - PPC_INS_VSLB, - PPC_INS_VSLD, - PPC_INS_VSLDOI, - PPC_INS_VSLH, - PPC_INS_VSLO, - PPC_INS_VSLV, - PPC_INS_VSLW, - PPC_INS_VSPLTB, - PPC_INS_VSPLTH, - PPC_INS_VSPLTISB, - PPC_INS_VSPLTISH, - PPC_INS_VSPLTISW, - PPC_INS_VSPLTW, - PPC_INS_VSR, - PPC_INS_VSRAB, - PPC_INS_VSRAD, - PPC_INS_VSRAH, - PPC_INS_VSRAW, - PPC_INS_VSRB, - PPC_INS_VSRD, - PPC_INS_VSRH, - PPC_INS_VSRO, - PPC_INS_VSRV, - PPC_INS_VSRW, - PPC_INS_VSUBCUQ, - PPC_INS_VSUBCUW, - PPC_INS_VSUBECUQ, - PPC_INS_VSUBEUQM, - PPC_INS_VSUBFP, - PPC_INS_VSUBSBS, - PPC_INS_VSUBSHS, - PPC_INS_VSUBSWS, - PPC_INS_VSUBUBM, - PPC_INS_VSUBUBS, - PPC_INS_VSUBUDM, - PPC_INS_VSUBUHM, - PPC_INS_VSUBUHS, - PPC_INS_VSUBUQM, - PPC_INS_VSUBUWM, - PPC_INS_VSUBUWS, - PPC_INS_VSUM2SWS, - PPC_INS_VSUM4SBS, - PPC_INS_VSUM4SHS, - PPC_INS_VSUM4UBS, - PPC_INS_VSUMSWS, - PPC_INS_VUPKHPX, - PPC_INS_VUPKHSB, - PPC_INS_VUPKHSH, - PPC_INS_VUPKHSW, - PPC_INS_VUPKLPX, - PPC_INS_VUPKLSB, - PPC_INS_VUPKLSH, - PPC_INS_VUPKLSW, - PPC_INS_VXOR, - PPC_INS_WAIT, - PPC_INS_WAITIMPL, - PPC_INS_WAITRSV, - PPC_INS_WRTEE, - PPC_INS_WRTEEI, - PPC_INS_XNOP, - PPC_INS_XOR, - PPC_INS_XORI, - PPC_INS_XORIS, - PPC_INS_XSABSDP, - PPC_INS_XSABSQP, - PPC_INS_XSADDDP, - PPC_INS_XSADDQP, - PPC_INS_XSADDQPO, - PPC_INS_XSADDSP, - PPC_INS_XSCMPEQDP, - PPC_INS_XSCMPEXPDP, - PPC_INS_XSCMPEXPQP, - PPC_INS_XSCMPGEDP, - PPC_INS_XSCMPGTDP, - PPC_INS_XSCMPODP, - PPC_INS_XSCMPOQP, - PPC_INS_XSCMPUDP, - PPC_INS_XSCMPUQP, - PPC_INS_XSCPSGNDP, - PPC_INS_XSCPSGNQP, - PPC_INS_XSCVDPHP, - PPC_INS_XSCVDPQP, - PPC_INS_XSCVDPSP, - PPC_INS_XSCVDPSPN, - PPC_INS_XSCVDPSXDS, - PPC_INS_XSCVDPSXWS, - PPC_INS_XSCVDPUXDS, - PPC_INS_XSCVDPUXWS, - PPC_INS_XSCVHPDP, - PPC_INS_XSCVQPDP, - PPC_INS_XSCVQPDPO, - PPC_INS_XSCVQPSDZ, - PPC_INS_XSCVQPSWZ, - PPC_INS_XSCVQPUDZ, - PPC_INS_XSCVQPUWZ, - PPC_INS_XSCVSDQP, - PPC_INS_XSCVSPDP, - PPC_INS_XSCVSPDPN, - PPC_INS_XSCVSXDDP, - PPC_INS_XSCVSXDSP, - PPC_INS_XSCVUDQP, - PPC_INS_XSCVUXDDP, - PPC_INS_XSCVUXDSP, - PPC_INS_XSDIVDP, - PPC_INS_XSDIVQP, - PPC_INS_XSDIVQPO, - PPC_INS_XSDIVSP, - PPC_INS_XSIEXPDP, - PPC_INS_XSIEXPQP, - PPC_INS_XSMADDADP, - PPC_INS_XSMADDASP, - PPC_INS_XSMADDMDP, - PPC_INS_XSMADDMSP, - PPC_INS_XSMADDQP, - PPC_INS_XSMADDQPO, - PPC_INS_XSMAXCDP, - PPC_INS_XSMAXDP, - PPC_INS_XSMAXJDP, - PPC_INS_XSMINCDP, - PPC_INS_XSMINDP, - PPC_INS_XSMINJDP, - PPC_INS_XSMSUBADP, - PPC_INS_XSMSUBASP, - PPC_INS_XSMSUBMDP, - PPC_INS_XSMSUBMSP, - PPC_INS_XSMSUBQP, - PPC_INS_XSMSUBQPO, - PPC_INS_XSMULDP, - PPC_INS_XSMULQP, - PPC_INS_XSMULQPO, - PPC_INS_XSMULSP, - PPC_INS_XSNABSDP, - PPC_INS_XSNABSQP, - PPC_INS_XSNEGDP, - PPC_INS_XSNEGQP, - PPC_INS_XSNMADDADP, - PPC_INS_XSNMADDASP, - PPC_INS_XSNMADDMDP, - PPC_INS_XSNMADDMSP, - PPC_INS_XSNMADDQP, - PPC_INS_XSNMADDQPO, - PPC_INS_XSNMSUBADP, - PPC_INS_XSNMSUBASP, - PPC_INS_XSNMSUBMDP, - PPC_INS_XSNMSUBMSP, - PPC_INS_XSNMSUBQP, - PPC_INS_XSNMSUBQPO, - PPC_INS_XSRDPI, - PPC_INS_XSRDPIC, - PPC_INS_XSRDPIM, - PPC_INS_XSRDPIP, - PPC_INS_XSRDPIZ, - PPC_INS_XSREDP, - PPC_INS_XSRESP, - PPC_INS_XSRQPI, - PPC_INS_XSRQPIX, - PPC_INS_XSRQPXP, - PPC_INS_XSRSP, - PPC_INS_XSRSQRTEDP, - PPC_INS_XSRSQRTESP, - PPC_INS_XSSQRTDP, - PPC_INS_XSSQRTQP, - PPC_INS_XSSQRTQPO, - PPC_INS_XSSQRTSP, - PPC_INS_XSSUBDP, - PPC_INS_XSSUBQP, - PPC_INS_XSSUBQPO, - PPC_INS_XSSUBSP, - PPC_INS_XSTDIVDP, - PPC_INS_XSTSQRTDP, - PPC_INS_XSTSTDCDP, - PPC_INS_XSTSTDCQP, - PPC_INS_XSTSTDCSP, - PPC_INS_XSXEXPDP, - PPC_INS_XSXEXPQP, - PPC_INS_XSXSIGDP, - PPC_INS_XSXSIGQP, - PPC_INS_XVABSDP, - PPC_INS_XVABSSP, - PPC_INS_XVADDDP, - PPC_INS_XVADDSP, - PPC_INS_XVCMPEQDP, - PPC_INS_XVCMPEQSP, - PPC_INS_XVCMPGEDP, - PPC_INS_XVCMPGESP, - PPC_INS_XVCMPGTDP, - PPC_INS_XVCMPGTSP, - PPC_INS_XVCPSGNDP, - PPC_INS_XVCPSGNSP, - PPC_INS_XVCVDPSP, - PPC_INS_XVCVDPSXDS, - PPC_INS_XVCVDPSXWS, - PPC_INS_XVCVDPUXDS, - PPC_INS_XVCVDPUXWS, - PPC_INS_XVCVHPSP, - PPC_INS_XVCVSPDP, - PPC_INS_XVCVSPHP, - PPC_INS_XVCVSPSXDS, - PPC_INS_XVCVSPSXWS, - PPC_INS_XVCVSPUXDS, - PPC_INS_XVCVSPUXWS, - PPC_INS_XVCVSXDDP, - PPC_INS_XVCVSXDSP, - PPC_INS_XVCVSXWDP, - PPC_INS_XVCVSXWSP, - PPC_INS_XVCVUXDDP, - PPC_INS_XVCVUXDSP, - PPC_INS_XVCVUXWDP, - PPC_INS_XVCVUXWSP, - PPC_INS_XVDIVDP, - PPC_INS_XVDIVSP, - PPC_INS_XVIEXPDP, - PPC_INS_XVIEXPSP, - PPC_INS_XVMADDADP, - PPC_INS_XVMADDASP, - PPC_INS_XVMADDMDP, - PPC_INS_XVMADDMSP, - PPC_INS_XVMAXDP, - PPC_INS_XVMAXSP, - PPC_INS_XVMINDP, - PPC_INS_XVMINSP, - PPC_INS_XVMOVDP, - PPC_INS_XVMOVSP, - PPC_INS_XVMSUBADP, - PPC_INS_XVMSUBASP, - PPC_INS_XVMSUBMDP, - PPC_INS_XVMSUBMSP, - PPC_INS_XVMULDP, - PPC_INS_XVMULSP, - PPC_INS_XVNABSDP, - PPC_INS_XVNABSSP, - PPC_INS_XVNEGDP, - PPC_INS_XVNEGSP, - PPC_INS_XVNMADDADP, - PPC_INS_XVNMADDASP, - PPC_INS_XVNMADDMDP, - PPC_INS_XVNMADDMSP, - PPC_INS_XVNMSUBADP, - PPC_INS_XVNMSUBASP, - PPC_INS_XVNMSUBMDP, - PPC_INS_XVNMSUBMSP, - PPC_INS_XVRDPI, - PPC_INS_XVRDPIC, - PPC_INS_XVRDPIM, - PPC_INS_XVRDPIP, - PPC_INS_XVRDPIZ, - PPC_INS_XVREDP, - PPC_INS_XVRESP, - PPC_INS_XVRSPI, - PPC_INS_XVRSPIC, - PPC_INS_XVRSPIM, - PPC_INS_XVRSPIP, - PPC_INS_XVRSPIZ, - PPC_INS_XVRSQRTEDP, - PPC_INS_XVRSQRTESP, - PPC_INS_XVSQRTDP, - PPC_INS_XVSQRTSP, - PPC_INS_XVSUBDP, - PPC_INS_XVSUBSP, - PPC_INS_XVTDIVDP, - PPC_INS_XVTDIVSP, - PPC_INS_XVTSQRTDP, - PPC_INS_XVTSQRTSP, - PPC_INS_XVTSTDCDP, - PPC_INS_XVTSTDCSP, - PPC_INS_XVXEXPDP, - PPC_INS_XVXEXPSP, - PPC_INS_XVXSIGDP, - PPC_INS_XVXSIGSP, - PPC_INS_XXBRD, - PPC_INS_XXBRH, - PPC_INS_XXBRQ, - PPC_INS_XXBRW, - PPC_INS_XXEXTRACTUW, - PPC_INS_XXINSERTW, - PPC_INS_XXLAND, - PPC_INS_XXLANDC, - PPC_INS_XXLEQV, - PPC_INS_XXLNAND, - PPC_INS_XXLNOR, - PPC_INS_XXLOR, - PPC_INS_XXLORC, - PPC_INS_XXLXOR, - PPC_INS_XXMRGHD, - PPC_INS_XXMRGHW, - PPC_INS_XXMRGLD, - PPC_INS_XXMRGLW, - PPC_INS_XXPERM, - PPC_INS_XXPERMDI, - PPC_INS_XXPERMR, - PPC_INS_XXSEL, - PPC_INS_XXSLDWI, - PPC_INS_XXSPLTD, - PPC_INS_XXSPLTIB, - PPC_INS_XXSPLTW, - PPC_INS_XXSWAPD, - PPC_INS_ENDING, // <-- mark the end of the list of instructions -} ppc_insn; - -/// Group of PPC instructions -typedef enum ppc_insn_group { - PPC_GRP_INVALID = 0, ///< = CS_GRP_INVALID - - // Generic groups - // all jump instructions (conditional+direct+indirect jumps) - PPC_GRP_JUMP, ///< = CS_GRP_JUMP - - // Architecture-specific groups - PPC_GRP_ALTIVEC = 128, - PPC_GRP_MODE32, - PPC_GRP_MODE64, - PPC_GRP_BOOKE, - PPC_GRP_NOTBOOKE, - PPC_GRP_SPE, - PPC_GRP_VSX, - PPC_GRP_E500, - PPC_GRP_PPC4XX, - PPC_GRP_PPC6XX, - PPC_GRP_ICBT, - PPC_GRP_P8ALTIVEC, - PPC_GRP_P8VECTOR, - PPC_GRP_QPX, - - PPC_GRP_ENDING, // <-- mark the end of the list of groups -} ppc_insn_group; - -#ifdef __cplusplus -} -#endif - -#endif -#ifndef CAPSTONE_SPARC_H -#define CAPSTONE_SPARC_H - -/* Capstone Disassembly Engine */ -/* By Nguyen Anh Quynh , 2014-2015 */ - -#ifdef __cplusplus -extern "C" { -#endif - - -// GCC SPARC toolchain has a default macro called "sparc" which breaks -// compilation -#undef sparc - -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif - -/// Enums corresponding to Sparc condition codes, both icc's and fcc's. -typedef enum sparc_cc { - SPARC_CC_INVALID = 0, ///< invalid CC (default) - // Integer condition codes - SPARC_CC_ICC_A = 8+256, ///< Always - SPARC_CC_ICC_N = 0+256, ///< Never - SPARC_CC_ICC_NE = 9+256, ///< Not Equal - SPARC_CC_ICC_E = 1+256, ///< Equal - SPARC_CC_ICC_G = 10+256, ///< Greater - SPARC_CC_ICC_LE = 2+256, ///< Less or Equal - SPARC_CC_ICC_GE = 11+256, ///< Greater or Equal - SPARC_CC_ICC_L = 3+256, ///< Less - SPARC_CC_ICC_GU = 12+256, ///< Greater Unsigned - SPARC_CC_ICC_LEU = 4+256, ///< Less or Equal Unsigned - SPARC_CC_ICC_CC = 13+256, ///< Carry Clear/Great or Equal Unsigned - SPARC_CC_ICC_CS = 5+256, ///< Carry Set/Less Unsigned - SPARC_CC_ICC_POS = 14+256, ///< Positive - SPARC_CC_ICC_NEG = 6+256, ///< Negative - SPARC_CC_ICC_VC = 15+256, ///< Overflow Clear - SPARC_CC_ICC_VS = 7+256, ///< Overflow Set - - // Floating condition codes - SPARC_CC_FCC_A = 8+16+256, ///< Always - SPARC_CC_FCC_N = 0+16+256, ///< Never - SPARC_CC_FCC_U = 7+16+256, ///< Unordered - SPARC_CC_FCC_G = 6+16+256, ///< Greater - SPARC_CC_FCC_UG = 5+16+256, ///< Unordered or Greater - SPARC_CC_FCC_L = 4+16+256, ///< Less - SPARC_CC_FCC_UL = 3+16+256, ///< Unordered or Less - SPARC_CC_FCC_LG = 2+16+256, ///< Less or Greater - SPARC_CC_FCC_NE = 1+16+256, ///< Not Equal - SPARC_CC_FCC_E = 9+16+256, ///< Equal - SPARC_CC_FCC_UE = 10+16+256, ///< Unordered or Equal - SPARC_CC_FCC_GE = 11+16+256, ///< Greater or Equal - SPARC_CC_FCC_UGE = 12+16+256, ///< Unordered or Greater or Equal - SPARC_CC_FCC_LE = 13+16+256, ///< Less or Equal - SPARC_CC_FCC_ULE = 14+16+256, ///< Unordered or Less or Equal - SPARC_CC_FCC_O = 15+16+256, ///< Ordered -} sparc_cc; - -/// Branch hint -typedef enum sparc_hint { - SPARC_HINT_INVALID = 0, ///< no hint - SPARC_HINT_A = 1 << 0, ///< annul delay slot instruction - SPARC_HINT_PT = 1 << 1, ///< branch taken - SPARC_HINT_PN = 1 << 2, ///< branch NOT taken -} sparc_hint; - -/// Operand type for instruction's operands -typedef enum sparc_op_type { - SPARC_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - SPARC_OP_REG, ///< = CS_OP_REG (Register operand). - SPARC_OP_IMM, ///< = CS_OP_IMM (Immediate operand). - SPARC_OP_MEM, ///< = CS_OP_MEM (Memory operand). -} sparc_op_type; - -/// SPARC registers -typedef enum sparc_reg { - SPARC_REG_INVALID = 0, - - SPARC_REG_F0, - SPARC_REG_F1, - SPARC_REG_F2, - SPARC_REG_F3, - SPARC_REG_F4, - SPARC_REG_F5, - SPARC_REG_F6, - SPARC_REG_F7, - SPARC_REG_F8, - SPARC_REG_F9, - SPARC_REG_F10, - SPARC_REG_F11, - SPARC_REG_F12, - SPARC_REG_F13, - SPARC_REG_F14, - SPARC_REG_F15, - SPARC_REG_F16, - SPARC_REG_F17, - SPARC_REG_F18, - SPARC_REG_F19, - SPARC_REG_F20, - SPARC_REG_F21, - SPARC_REG_F22, - SPARC_REG_F23, - SPARC_REG_F24, - SPARC_REG_F25, - SPARC_REG_F26, - SPARC_REG_F27, - SPARC_REG_F28, - SPARC_REG_F29, - SPARC_REG_F30, - SPARC_REG_F31, - SPARC_REG_F32, - SPARC_REG_F34, - SPARC_REG_F36, - SPARC_REG_F38, - SPARC_REG_F40, - SPARC_REG_F42, - SPARC_REG_F44, - SPARC_REG_F46, - SPARC_REG_F48, - SPARC_REG_F50, - SPARC_REG_F52, - SPARC_REG_F54, - SPARC_REG_F56, - SPARC_REG_F58, - SPARC_REG_F60, - SPARC_REG_F62, - SPARC_REG_FCC0, // Floating condition codes - SPARC_REG_FCC1, - SPARC_REG_FCC2, - SPARC_REG_FCC3, - SPARC_REG_FP, - SPARC_REG_G0, - SPARC_REG_G1, - SPARC_REG_G2, - SPARC_REG_G3, - SPARC_REG_G4, - SPARC_REG_G5, - SPARC_REG_G6, - SPARC_REG_G7, - SPARC_REG_I0, - SPARC_REG_I1, - SPARC_REG_I2, - SPARC_REG_I3, - SPARC_REG_I4, - SPARC_REG_I5, - SPARC_REG_I7, - SPARC_REG_ICC, // Integer condition codes - SPARC_REG_L0, - SPARC_REG_L1, - SPARC_REG_L2, - SPARC_REG_L3, - SPARC_REG_L4, - SPARC_REG_L5, - SPARC_REG_L6, - SPARC_REG_L7, - SPARC_REG_O0, - SPARC_REG_O1, - SPARC_REG_O2, - SPARC_REG_O3, - SPARC_REG_O4, - SPARC_REG_O5, - SPARC_REG_O7, - SPARC_REG_SP, - SPARC_REG_Y, - - // special register - SPARC_REG_XCC, - - SPARC_REG_ENDING, // <-- mark the end of the list of registers - - // extras - SPARC_REG_O6 = SPARC_REG_SP, - SPARC_REG_I6 = SPARC_REG_FP, -} sparc_reg; - -/// Instruction's operand referring to memory -/// This is associated with SPARC_OP_MEM operand type above -typedef struct sparc_op_mem { - uint8_t base; ///< base register, can be safely interpreted as - ///< a value of type `sparc_reg`, but it is only - ///< one byte wide - uint8_t index; ///< index register, same conditions apply here - int32_t disp; ///< displacement/offset value -} sparc_op_mem; - -/// Instruction operand -typedef struct cs_sparc_op { - sparc_op_type type; ///< operand type - union { - sparc_reg reg; ///< register value for REG operand - int64_t imm; ///< immediate value for IMM operand - sparc_op_mem mem; ///< base/disp value for MEM operand - }; -} cs_sparc_op; - -/// Instruction structure -typedef struct cs_sparc { - sparc_cc cc; ///< code condition for this insn - sparc_hint hint; ///< branch hint: encoding as bitwise OR of sparc_hint. - /// Number of operands of this instruction, - /// or 0 when instruction has no operand. - uint8_t op_count; - cs_sparc_op operands[4]; ///< operands for this instruction. -} cs_sparc; - -/// SPARC instruction -typedef enum sparc_insn { - SPARC_INS_INVALID = 0, - - SPARC_INS_ADDCC, - SPARC_INS_ADDX, - SPARC_INS_ADDXCC, - SPARC_INS_ADDXC, - SPARC_INS_ADDXCCC, - SPARC_INS_ADD, - SPARC_INS_ALIGNADDR, - SPARC_INS_ALIGNADDRL, - SPARC_INS_ANDCC, - SPARC_INS_ANDNCC, - SPARC_INS_ANDN, - SPARC_INS_AND, - SPARC_INS_ARRAY16, - SPARC_INS_ARRAY32, - SPARC_INS_ARRAY8, - SPARC_INS_B, - SPARC_INS_JMP, - SPARC_INS_BMASK, - SPARC_INS_FB, - SPARC_INS_BRGEZ, - SPARC_INS_BRGZ, - SPARC_INS_BRLEZ, - SPARC_INS_BRLZ, - SPARC_INS_BRNZ, - SPARC_INS_BRZ, - SPARC_INS_BSHUFFLE, - SPARC_INS_CALL, - SPARC_INS_CASX, - SPARC_INS_CAS, - SPARC_INS_CMASK16, - SPARC_INS_CMASK32, - SPARC_INS_CMASK8, - SPARC_INS_CMP, - SPARC_INS_EDGE16, - SPARC_INS_EDGE16L, - SPARC_INS_EDGE16LN, - SPARC_INS_EDGE16N, - SPARC_INS_EDGE32, - SPARC_INS_EDGE32L, - SPARC_INS_EDGE32LN, - SPARC_INS_EDGE32N, - SPARC_INS_EDGE8, - SPARC_INS_EDGE8L, - SPARC_INS_EDGE8LN, - SPARC_INS_EDGE8N, - SPARC_INS_FABSD, - SPARC_INS_FABSQ, - SPARC_INS_FABSS, - SPARC_INS_FADDD, - SPARC_INS_FADDQ, - SPARC_INS_FADDS, - SPARC_INS_FALIGNDATA, - SPARC_INS_FAND, - SPARC_INS_FANDNOT1, - SPARC_INS_FANDNOT1S, - SPARC_INS_FANDNOT2, - SPARC_INS_FANDNOT2S, - SPARC_INS_FANDS, - SPARC_INS_FCHKSM16, - SPARC_INS_FCMPD, - SPARC_INS_FCMPEQ16, - SPARC_INS_FCMPEQ32, - SPARC_INS_FCMPGT16, - SPARC_INS_FCMPGT32, - SPARC_INS_FCMPLE16, - SPARC_INS_FCMPLE32, - SPARC_INS_FCMPNE16, - SPARC_INS_FCMPNE32, - SPARC_INS_FCMPQ, - SPARC_INS_FCMPS, - SPARC_INS_FDIVD, - SPARC_INS_FDIVQ, - SPARC_INS_FDIVS, - SPARC_INS_FDMULQ, - SPARC_INS_FDTOI, - SPARC_INS_FDTOQ, - SPARC_INS_FDTOS, - SPARC_INS_FDTOX, - SPARC_INS_FEXPAND, - SPARC_INS_FHADDD, - SPARC_INS_FHADDS, - SPARC_INS_FHSUBD, - SPARC_INS_FHSUBS, - SPARC_INS_FITOD, - SPARC_INS_FITOQ, - SPARC_INS_FITOS, - SPARC_INS_FLCMPD, - SPARC_INS_FLCMPS, - SPARC_INS_FLUSHW, - SPARC_INS_FMEAN16, - SPARC_INS_FMOVD, - SPARC_INS_FMOVQ, - SPARC_INS_FMOVRDGEZ, - SPARC_INS_FMOVRQGEZ, - SPARC_INS_FMOVRSGEZ, - SPARC_INS_FMOVRDGZ, - SPARC_INS_FMOVRQGZ, - SPARC_INS_FMOVRSGZ, - SPARC_INS_FMOVRDLEZ, - SPARC_INS_FMOVRQLEZ, - SPARC_INS_FMOVRSLEZ, - SPARC_INS_FMOVRDLZ, - SPARC_INS_FMOVRQLZ, - SPARC_INS_FMOVRSLZ, - SPARC_INS_FMOVRDNZ, - SPARC_INS_FMOVRQNZ, - SPARC_INS_FMOVRSNZ, - SPARC_INS_FMOVRDZ, - SPARC_INS_FMOVRQZ, - SPARC_INS_FMOVRSZ, - SPARC_INS_FMOVS, - SPARC_INS_FMUL8SUX16, - SPARC_INS_FMUL8ULX16, - SPARC_INS_FMUL8X16, - SPARC_INS_FMUL8X16AL, - SPARC_INS_FMUL8X16AU, - SPARC_INS_FMULD, - SPARC_INS_FMULD8SUX16, - SPARC_INS_FMULD8ULX16, - SPARC_INS_FMULQ, - SPARC_INS_FMULS, - SPARC_INS_FNADDD, - SPARC_INS_FNADDS, - SPARC_INS_FNAND, - SPARC_INS_FNANDS, - SPARC_INS_FNEGD, - SPARC_INS_FNEGQ, - SPARC_INS_FNEGS, - SPARC_INS_FNHADDD, - SPARC_INS_FNHADDS, - SPARC_INS_FNOR, - SPARC_INS_FNORS, - SPARC_INS_FNOT1, - SPARC_INS_FNOT1S, - SPARC_INS_FNOT2, - SPARC_INS_FNOT2S, - SPARC_INS_FONE, - SPARC_INS_FONES, - SPARC_INS_FOR, - SPARC_INS_FORNOT1, - SPARC_INS_FORNOT1S, - SPARC_INS_FORNOT2, - SPARC_INS_FORNOT2S, - SPARC_INS_FORS, - SPARC_INS_FPACK16, - SPARC_INS_FPACK32, - SPARC_INS_FPACKFIX, - SPARC_INS_FPADD16, - SPARC_INS_FPADD16S, - SPARC_INS_FPADD32, - SPARC_INS_FPADD32S, - SPARC_INS_FPADD64, - SPARC_INS_FPMERGE, - SPARC_INS_FPSUB16, - SPARC_INS_FPSUB16S, - SPARC_INS_FPSUB32, - SPARC_INS_FPSUB32S, - SPARC_INS_FQTOD, - SPARC_INS_FQTOI, - SPARC_INS_FQTOS, - SPARC_INS_FQTOX, - SPARC_INS_FSLAS16, - SPARC_INS_FSLAS32, - SPARC_INS_FSLL16, - SPARC_INS_FSLL32, - SPARC_INS_FSMULD, - SPARC_INS_FSQRTD, - SPARC_INS_FSQRTQ, - SPARC_INS_FSQRTS, - SPARC_INS_FSRA16, - SPARC_INS_FSRA32, - SPARC_INS_FSRC1, - SPARC_INS_FSRC1S, - SPARC_INS_FSRC2, - SPARC_INS_FSRC2S, - SPARC_INS_FSRL16, - SPARC_INS_FSRL32, - SPARC_INS_FSTOD, - SPARC_INS_FSTOI, - SPARC_INS_FSTOQ, - SPARC_INS_FSTOX, - SPARC_INS_FSUBD, - SPARC_INS_FSUBQ, - SPARC_INS_FSUBS, - SPARC_INS_FXNOR, - SPARC_INS_FXNORS, - SPARC_INS_FXOR, - SPARC_INS_FXORS, - SPARC_INS_FXTOD, - SPARC_INS_FXTOQ, - SPARC_INS_FXTOS, - SPARC_INS_FZERO, - SPARC_INS_FZEROS, - SPARC_INS_JMPL, - SPARC_INS_LDD, - SPARC_INS_LD, - SPARC_INS_LDQ, - SPARC_INS_LDSB, - SPARC_INS_LDSH, - SPARC_INS_LDSW, - SPARC_INS_LDUB, - SPARC_INS_LDUH, - SPARC_INS_LDX, - SPARC_INS_LZCNT, - SPARC_INS_MEMBAR, - SPARC_INS_MOVDTOX, - SPARC_INS_MOV, - SPARC_INS_MOVRGEZ, - SPARC_INS_MOVRGZ, - SPARC_INS_MOVRLEZ, - SPARC_INS_MOVRLZ, - SPARC_INS_MOVRNZ, - SPARC_INS_MOVRZ, - SPARC_INS_MOVSTOSW, - SPARC_INS_MOVSTOUW, - SPARC_INS_MULX, - SPARC_INS_NOP, - SPARC_INS_ORCC, - SPARC_INS_ORNCC, - SPARC_INS_ORN, - SPARC_INS_OR, - SPARC_INS_PDIST, - SPARC_INS_PDISTN, - SPARC_INS_POPC, - SPARC_INS_RD, - SPARC_INS_RESTORE, - SPARC_INS_RETT, - SPARC_INS_SAVE, - SPARC_INS_SDIVCC, - SPARC_INS_SDIVX, - SPARC_INS_SDIV, - SPARC_INS_SETHI, - SPARC_INS_SHUTDOWN, - SPARC_INS_SIAM, - SPARC_INS_SLLX, - SPARC_INS_SLL, - SPARC_INS_SMULCC, - SPARC_INS_SMUL, - SPARC_INS_SRAX, - SPARC_INS_SRA, - SPARC_INS_SRLX, - SPARC_INS_SRL, - SPARC_INS_STBAR, - SPARC_INS_STB, - SPARC_INS_STD, - SPARC_INS_ST, - SPARC_INS_STH, - SPARC_INS_STQ, - SPARC_INS_STX, - SPARC_INS_SUBCC, - SPARC_INS_SUBX, - SPARC_INS_SUBXCC, - SPARC_INS_SUB, - SPARC_INS_SWAP, - SPARC_INS_TADDCCTV, - SPARC_INS_TADDCC, - SPARC_INS_T, - SPARC_INS_TSUBCCTV, - SPARC_INS_TSUBCC, - SPARC_INS_UDIVCC, - SPARC_INS_UDIVX, - SPARC_INS_UDIV, - SPARC_INS_UMULCC, - SPARC_INS_UMULXHI, - SPARC_INS_UMUL, - SPARC_INS_UNIMP, - SPARC_INS_FCMPED, - SPARC_INS_FCMPEQ, - SPARC_INS_FCMPES, - SPARC_INS_WR, - SPARC_INS_XMULX, - SPARC_INS_XMULXHI, - SPARC_INS_XNORCC, - SPARC_INS_XNOR, - SPARC_INS_XORCC, - SPARC_INS_XOR, - - // alias instructions - SPARC_INS_RET, - SPARC_INS_RETL, - - SPARC_INS_ENDING, // <-- mark the end of the list of instructions -} sparc_insn; - -/// Group of SPARC instructions -typedef enum sparc_insn_group { - SPARC_GRP_INVALID = 0, ///< = CS_GRP_INVALID - - // Generic groups - // all jump instructions (conditional+direct+indirect jumps) - SPARC_GRP_JUMP, ///< = CS_GRP_JUMP - - // Architecture-specific groups - SPARC_GRP_HARDQUAD = 128, - SPARC_GRP_V9, - SPARC_GRP_VIS, - SPARC_GRP_VIS2, - SPARC_GRP_VIS3, - SPARC_GRP_32BIT, - SPARC_GRP_64BIT, - - SPARC_GRP_ENDING, // <-- mark the end of the list of groups -} sparc_insn_group; - -#ifdef __cplusplus -} -#endif - -#endif -#ifndef CAPSTONE_SYSTEMZ_H -#define CAPSTONE_SYSTEMZ_H - -/* Capstone Disassembly Engine */ -/* By Nguyen Anh Quynh , 2014-2015 */ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif - -/// Enums corresponding to SystemZ condition codes -typedef enum sysz_cc { - SYSZ_CC_INVALID = 0, ///< invalid CC (default) - - SYSZ_CC_O, - SYSZ_CC_H, - SYSZ_CC_NLE, - SYSZ_CC_L, - SYSZ_CC_NHE, - SYSZ_CC_LH, - SYSZ_CC_NE, - SYSZ_CC_E, - SYSZ_CC_NLH, - SYSZ_CC_HE, - SYSZ_CC_NL, - SYSZ_CC_LE, - SYSZ_CC_NH, - SYSZ_CC_NO, -} sysz_cc; - -/// Operand type for instruction's operands -typedef enum sysz_op_type { - SYSZ_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - SYSZ_OP_REG, ///< = CS_OP_REG (Register operand). - SYSZ_OP_IMM, ///< = CS_OP_IMM (Immediate operand). - SYSZ_OP_MEM, ///< = CS_OP_MEM (Memory operand). - SYSZ_OP_ACREG = 64, ///< Access register operand. -} sysz_op_type; - -/// SystemZ registers -typedef enum sysz_reg { - SYSZ_REG_INVALID = 0, - - SYSZ_REG_0, - SYSZ_REG_1, - SYSZ_REG_2, - SYSZ_REG_3, - SYSZ_REG_4, - SYSZ_REG_5, - SYSZ_REG_6, - SYSZ_REG_7, - SYSZ_REG_8, - SYSZ_REG_9, - SYSZ_REG_10, - SYSZ_REG_11, - SYSZ_REG_12, - SYSZ_REG_13, - SYSZ_REG_14, - SYSZ_REG_15, - SYSZ_REG_CC, - SYSZ_REG_F0, - SYSZ_REG_F1, - SYSZ_REG_F2, - SYSZ_REG_F3, - SYSZ_REG_F4, - SYSZ_REG_F5, - SYSZ_REG_F6, - SYSZ_REG_F7, - SYSZ_REG_F8, - SYSZ_REG_F9, - SYSZ_REG_F10, - SYSZ_REG_F11, - SYSZ_REG_F12, - SYSZ_REG_F13, - SYSZ_REG_F14, - SYSZ_REG_F15, - - SYSZ_REG_R0L, - - SYSZ_REG_A0, - SYSZ_REG_A1, - SYSZ_REG_A2, - SYSZ_REG_A3, - SYSZ_REG_A4, - SYSZ_REG_A5, - SYSZ_REG_A6, - SYSZ_REG_A7, - SYSZ_REG_A8, - SYSZ_REG_A9, - SYSZ_REG_A10, - SYSZ_REG_A11, - SYSZ_REG_A12, - SYSZ_REG_A13, - SYSZ_REG_A14, - SYSZ_REG_A15, - SYSZ_REG_C0, - SYSZ_REG_C1, - SYSZ_REG_C2, - SYSZ_REG_C3, - SYSZ_REG_C4, - SYSZ_REG_C5, - SYSZ_REG_C6, - SYSZ_REG_C7, - SYSZ_REG_C8, - SYSZ_REG_C9, - SYSZ_REG_C10, - SYSZ_REG_C11, - SYSZ_REG_C12, - SYSZ_REG_C13, - SYSZ_REG_C14, - SYSZ_REG_C15, - SYSZ_REG_V0, - SYSZ_REG_V1, - SYSZ_REG_V2, - SYSZ_REG_V3, - SYSZ_REG_V4, - SYSZ_REG_V5, - SYSZ_REG_V6, - SYSZ_REG_V7, - SYSZ_REG_V8, - SYSZ_REG_V9, - SYSZ_REG_V10, - SYSZ_REG_V11, - SYSZ_REG_V12, - SYSZ_REG_V13, - SYSZ_REG_V14, - SYSZ_REG_V15, - SYSZ_REG_V16, - SYSZ_REG_V17, - SYSZ_REG_V18, - SYSZ_REG_V19, - SYSZ_REG_V20, - SYSZ_REG_V21, - SYSZ_REG_V22, - SYSZ_REG_V23, - SYSZ_REG_V24, - SYSZ_REG_V25, - SYSZ_REG_V26, - SYSZ_REG_V27, - SYSZ_REG_V28, - SYSZ_REG_V29, - SYSZ_REG_V30, - SYSZ_REG_V31, - SYSZ_REG_F16, - SYSZ_REG_F17, - SYSZ_REG_F18, - SYSZ_REG_F19, - SYSZ_REG_F20, - SYSZ_REG_F21, - SYSZ_REG_F22, - SYSZ_REG_F23, - SYSZ_REG_F24, - SYSZ_REG_F25, - SYSZ_REG_F26, - SYSZ_REG_F27, - SYSZ_REG_F28, - SYSZ_REG_F29, - SYSZ_REG_F30, - SYSZ_REG_F31, - SYSZ_REG_F0Q, - SYSZ_REG_F4Q, - - SYSZ_REG_ENDING, -} sysz_reg; - -/// Instruction's operand referring to memory -/// This is associated with SYSZ_OP_MEM operand type above -typedef struct sysz_op_mem { - uint8_t base; ///< base register, can be safely interpreted as - ///< a value of type `sysz_reg`, but it is only - ///< one byte wide - uint8_t index; ///< index register, same conditions apply here - uint64_t length; ///< BDLAddr operand - int64_t disp; ///< displacement/offset value -} sysz_op_mem; - -/// Instruction operand -typedef struct cs_sysz_op { - sysz_op_type type; ///< operand type - union { - sysz_reg reg; ///< register value for REG operand - int64_t imm; ///< immediate value for IMM operand - sysz_op_mem mem; ///< base/disp value for MEM operand - }; -} cs_sysz_op; - -// Instruction structure -typedef struct cs_sysz { - sysz_cc cc; ///< Code condition - /// Number of operands of this instruction, - /// or 0 when instruction has no operand. - uint8_t op_count; - cs_sysz_op operands[6]; ///< operands for this instruction. -} cs_sysz; - -/// SystemZ instruction -typedef enum sysz_insn { - SYSZ_INS_INVALID = 0, - - SYSZ_INS_A, - SYSZ_INS_ADB, - SYSZ_INS_ADBR, - SYSZ_INS_AEB, - SYSZ_INS_AEBR, - SYSZ_INS_AFI, - SYSZ_INS_AG, - SYSZ_INS_AGF, - SYSZ_INS_AGFI, - SYSZ_INS_AGFR, - SYSZ_INS_AGHI, - SYSZ_INS_AGHIK, - SYSZ_INS_AGR, - SYSZ_INS_AGRK, - SYSZ_INS_AGSI, - SYSZ_INS_AH, - SYSZ_INS_AHI, - SYSZ_INS_AHIK, - SYSZ_INS_AHY, - SYSZ_INS_AIH, - SYSZ_INS_AL, - SYSZ_INS_ALC, - SYSZ_INS_ALCG, - SYSZ_INS_ALCGR, - SYSZ_INS_ALCR, - SYSZ_INS_ALFI, - SYSZ_INS_ALG, - SYSZ_INS_ALGF, - SYSZ_INS_ALGFI, - SYSZ_INS_ALGFR, - SYSZ_INS_ALGHSIK, - SYSZ_INS_ALGR, - SYSZ_INS_ALGRK, - SYSZ_INS_ALHSIK, - SYSZ_INS_ALR, - SYSZ_INS_ALRK, - SYSZ_INS_ALY, - SYSZ_INS_AR, - SYSZ_INS_ARK, - SYSZ_INS_ASI, - SYSZ_INS_AXBR, - SYSZ_INS_AY, - SYSZ_INS_BCR, - SYSZ_INS_BRC, - SYSZ_INS_BRCL, - SYSZ_INS_CGIJ, - SYSZ_INS_CGRJ, - SYSZ_INS_CIJ, - SYSZ_INS_CLGIJ, - SYSZ_INS_CLGRJ, - SYSZ_INS_CLIJ, - SYSZ_INS_CLRJ, - SYSZ_INS_CRJ, - SYSZ_INS_BER, - SYSZ_INS_JE, - SYSZ_INS_JGE, - SYSZ_INS_LOCE, - SYSZ_INS_LOCGE, - SYSZ_INS_LOCGRE, - SYSZ_INS_LOCRE, - SYSZ_INS_STOCE, - SYSZ_INS_STOCGE, - SYSZ_INS_BHR, - SYSZ_INS_BHER, - SYSZ_INS_JHE, - SYSZ_INS_JGHE, - SYSZ_INS_LOCHE, - SYSZ_INS_LOCGHE, - SYSZ_INS_LOCGRHE, - SYSZ_INS_LOCRHE, - SYSZ_INS_STOCHE, - SYSZ_INS_STOCGHE, - SYSZ_INS_JH, - SYSZ_INS_JGH, - SYSZ_INS_LOCH, - SYSZ_INS_LOCGH, - SYSZ_INS_LOCGRH, - SYSZ_INS_LOCRH, - SYSZ_INS_STOCH, - SYSZ_INS_STOCGH, - SYSZ_INS_CGIJNLH, - SYSZ_INS_CGRJNLH, - SYSZ_INS_CIJNLH, - SYSZ_INS_CLGIJNLH, - SYSZ_INS_CLGRJNLH, - SYSZ_INS_CLIJNLH, - SYSZ_INS_CLRJNLH, - SYSZ_INS_CRJNLH, - SYSZ_INS_CGIJE, - SYSZ_INS_CGRJE, - SYSZ_INS_CIJE, - SYSZ_INS_CLGIJE, - SYSZ_INS_CLGRJE, - SYSZ_INS_CLIJE, - SYSZ_INS_CLRJE, - SYSZ_INS_CRJE, - SYSZ_INS_CGIJNLE, - SYSZ_INS_CGRJNLE, - SYSZ_INS_CIJNLE, - SYSZ_INS_CLGIJNLE, - SYSZ_INS_CLGRJNLE, - SYSZ_INS_CLIJNLE, - SYSZ_INS_CLRJNLE, - SYSZ_INS_CRJNLE, - SYSZ_INS_CGIJH, - SYSZ_INS_CGRJH, - SYSZ_INS_CIJH, - SYSZ_INS_CLGIJH, - SYSZ_INS_CLGRJH, - SYSZ_INS_CLIJH, - SYSZ_INS_CLRJH, - SYSZ_INS_CRJH, - SYSZ_INS_CGIJNL, - SYSZ_INS_CGRJNL, - SYSZ_INS_CIJNL, - SYSZ_INS_CLGIJNL, - SYSZ_INS_CLGRJNL, - SYSZ_INS_CLIJNL, - SYSZ_INS_CLRJNL, - SYSZ_INS_CRJNL, - SYSZ_INS_CGIJHE, - SYSZ_INS_CGRJHE, - SYSZ_INS_CIJHE, - SYSZ_INS_CLGIJHE, - SYSZ_INS_CLGRJHE, - SYSZ_INS_CLIJHE, - SYSZ_INS_CLRJHE, - SYSZ_INS_CRJHE, - SYSZ_INS_CGIJNHE, - SYSZ_INS_CGRJNHE, - SYSZ_INS_CIJNHE, - SYSZ_INS_CLGIJNHE, - SYSZ_INS_CLGRJNHE, - SYSZ_INS_CLIJNHE, - SYSZ_INS_CLRJNHE, - SYSZ_INS_CRJNHE, - SYSZ_INS_CGIJL, - SYSZ_INS_CGRJL, - SYSZ_INS_CIJL, - SYSZ_INS_CLGIJL, - SYSZ_INS_CLGRJL, - SYSZ_INS_CLIJL, - SYSZ_INS_CLRJL, - SYSZ_INS_CRJL, - SYSZ_INS_CGIJNH, - SYSZ_INS_CGRJNH, - SYSZ_INS_CIJNH, - SYSZ_INS_CLGIJNH, - SYSZ_INS_CLGRJNH, - SYSZ_INS_CLIJNH, - SYSZ_INS_CLRJNH, - SYSZ_INS_CRJNH, - SYSZ_INS_CGIJLE, - SYSZ_INS_CGRJLE, - SYSZ_INS_CIJLE, - SYSZ_INS_CLGIJLE, - SYSZ_INS_CLGRJLE, - SYSZ_INS_CLIJLE, - SYSZ_INS_CLRJLE, - SYSZ_INS_CRJLE, - SYSZ_INS_CGIJNE, - SYSZ_INS_CGRJNE, - SYSZ_INS_CIJNE, - SYSZ_INS_CLGIJNE, - SYSZ_INS_CLGRJNE, - SYSZ_INS_CLIJNE, - SYSZ_INS_CLRJNE, - SYSZ_INS_CRJNE, - SYSZ_INS_CGIJLH, - SYSZ_INS_CGRJLH, - SYSZ_INS_CIJLH, - SYSZ_INS_CLGIJLH, - SYSZ_INS_CLGRJLH, - SYSZ_INS_CLIJLH, - SYSZ_INS_CLRJLH, - SYSZ_INS_CRJLH, - SYSZ_INS_BLR, - SYSZ_INS_BLER, - SYSZ_INS_JLE, - SYSZ_INS_JGLE, - SYSZ_INS_LOCLE, - SYSZ_INS_LOCGLE, - SYSZ_INS_LOCGRLE, - SYSZ_INS_LOCRLE, - SYSZ_INS_STOCLE, - SYSZ_INS_STOCGLE, - SYSZ_INS_BLHR, - SYSZ_INS_JLH, - SYSZ_INS_JGLH, - SYSZ_INS_LOCLH, - SYSZ_INS_LOCGLH, - SYSZ_INS_LOCGRLH, - SYSZ_INS_LOCRLH, - SYSZ_INS_STOCLH, - SYSZ_INS_STOCGLH, - SYSZ_INS_JL, - SYSZ_INS_JGL, - SYSZ_INS_LOCL, - SYSZ_INS_LOCGL, - SYSZ_INS_LOCGRL, - SYSZ_INS_LOCRL, - SYSZ_INS_LOC, - SYSZ_INS_LOCG, - SYSZ_INS_LOCGR, - SYSZ_INS_LOCR, - SYSZ_INS_STOCL, - SYSZ_INS_STOCGL, - SYSZ_INS_BNER, - SYSZ_INS_JNE, - SYSZ_INS_JGNE, - SYSZ_INS_LOCNE, - SYSZ_INS_LOCGNE, - SYSZ_INS_LOCGRNE, - SYSZ_INS_LOCRNE, - SYSZ_INS_STOCNE, - SYSZ_INS_STOCGNE, - SYSZ_INS_BNHR, - SYSZ_INS_BNHER, - SYSZ_INS_JNHE, - SYSZ_INS_JGNHE, - SYSZ_INS_LOCNHE, - SYSZ_INS_LOCGNHE, - SYSZ_INS_LOCGRNHE, - SYSZ_INS_LOCRNHE, - SYSZ_INS_STOCNHE, - SYSZ_INS_STOCGNHE, - SYSZ_INS_JNH, - SYSZ_INS_JGNH, - SYSZ_INS_LOCNH, - SYSZ_INS_LOCGNH, - SYSZ_INS_LOCGRNH, - SYSZ_INS_LOCRNH, - SYSZ_INS_STOCNH, - SYSZ_INS_STOCGNH, - SYSZ_INS_BNLR, - SYSZ_INS_BNLER, - SYSZ_INS_JNLE, - SYSZ_INS_JGNLE, - SYSZ_INS_LOCNLE, - SYSZ_INS_LOCGNLE, - SYSZ_INS_LOCGRNLE, - SYSZ_INS_LOCRNLE, - SYSZ_INS_STOCNLE, - SYSZ_INS_STOCGNLE, - SYSZ_INS_BNLHR, - SYSZ_INS_JNLH, - SYSZ_INS_JGNLH, - SYSZ_INS_LOCNLH, - SYSZ_INS_LOCGNLH, - SYSZ_INS_LOCGRNLH, - SYSZ_INS_LOCRNLH, - SYSZ_INS_STOCNLH, - SYSZ_INS_STOCGNLH, - SYSZ_INS_JNL, - SYSZ_INS_JGNL, - SYSZ_INS_LOCNL, - SYSZ_INS_LOCGNL, - SYSZ_INS_LOCGRNL, - SYSZ_INS_LOCRNL, - SYSZ_INS_STOCNL, - SYSZ_INS_STOCGNL, - SYSZ_INS_BNOR, - SYSZ_INS_JNO, - SYSZ_INS_JGNO, - SYSZ_INS_LOCNO, - SYSZ_INS_LOCGNO, - SYSZ_INS_LOCGRNO, - SYSZ_INS_LOCRNO, - SYSZ_INS_STOCNO, - SYSZ_INS_STOCGNO, - SYSZ_INS_BOR, - SYSZ_INS_JO, - SYSZ_INS_JGO, - SYSZ_INS_LOCO, - SYSZ_INS_LOCGO, - SYSZ_INS_LOCGRO, - SYSZ_INS_LOCRO, - SYSZ_INS_STOCO, - SYSZ_INS_STOCGO, - SYSZ_INS_STOC, - SYSZ_INS_STOCG, - SYSZ_INS_BASR, - SYSZ_INS_BR, - SYSZ_INS_BRAS, - SYSZ_INS_BRASL, - SYSZ_INS_J, - SYSZ_INS_JG, - SYSZ_INS_BRCT, - SYSZ_INS_BRCTG, - SYSZ_INS_C, - SYSZ_INS_CDB, - SYSZ_INS_CDBR, - SYSZ_INS_CDFBR, - SYSZ_INS_CDGBR, - SYSZ_INS_CDLFBR, - SYSZ_INS_CDLGBR, - SYSZ_INS_CEB, - SYSZ_INS_CEBR, - SYSZ_INS_CEFBR, - SYSZ_INS_CEGBR, - SYSZ_INS_CELFBR, - SYSZ_INS_CELGBR, - SYSZ_INS_CFDBR, - SYSZ_INS_CFEBR, - SYSZ_INS_CFI, - SYSZ_INS_CFXBR, - SYSZ_INS_CG, - SYSZ_INS_CGDBR, - SYSZ_INS_CGEBR, - SYSZ_INS_CGF, - SYSZ_INS_CGFI, - SYSZ_INS_CGFR, - SYSZ_INS_CGFRL, - SYSZ_INS_CGH, - SYSZ_INS_CGHI, - SYSZ_INS_CGHRL, - SYSZ_INS_CGHSI, - SYSZ_INS_CGR, - SYSZ_INS_CGRL, - SYSZ_INS_CGXBR, - SYSZ_INS_CH, - SYSZ_INS_CHF, - SYSZ_INS_CHHSI, - SYSZ_INS_CHI, - SYSZ_INS_CHRL, - SYSZ_INS_CHSI, - SYSZ_INS_CHY, - SYSZ_INS_CIH, - SYSZ_INS_CL, - SYSZ_INS_CLC, - SYSZ_INS_CLFDBR, - SYSZ_INS_CLFEBR, - SYSZ_INS_CLFHSI, - SYSZ_INS_CLFI, - SYSZ_INS_CLFXBR, - SYSZ_INS_CLG, - SYSZ_INS_CLGDBR, - SYSZ_INS_CLGEBR, - SYSZ_INS_CLGF, - SYSZ_INS_CLGFI, - SYSZ_INS_CLGFR, - SYSZ_INS_CLGFRL, - SYSZ_INS_CLGHRL, - SYSZ_INS_CLGHSI, - SYSZ_INS_CLGR, - SYSZ_INS_CLGRL, - SYSZ_INS_CLGXBR, - SYSZ_INS_CLHF, - SYSZ_INS_CLHHSI, - SYSZ_INS_CLHRL, - SYSZ_INS_CLI, - SYSZ_INS_CLIH, - SYSZ_INS_CLIY, - SYSZ_INS_CLR, - SYSZ_INS_CLRL, - SYSZ_INS_CLST, - SYSZ_INS_CLY, - SYSZ_INS_CPSDR, - SYSZ_INS_CR, - SYSZ_INS_CRL, - SYSZ_INS_CS, - SYSZ_INS_CSG, - SYSZ_INS_CSY, - SYSZ_INS_CXBR, - SYSZ_INS_CXFBR, - SYSZ_INS_CXGBR, - SYSZ_INS_CXLFBR, - SYSZ_INS_CXLGBR, - SYSZ_INS_CY, - SYSZ_INS_DDB, - SYSZ_INS_DDBR, - SYSZ_INS_DEB, - SYSZ_INS_DEBR, - SYSZ_INS_DL, - SYSZ_INS_DLG, - SYSZ_INS_DLGR, - SYSZ_INS_DLR, - SYSZ_INS_DSG, - SYSZ_INS_DSGF, - SYSZ_INS_DSGFR, - SYSZ_INS_DSGR, - SYSZ_INS_DXBR, - SYSZ_INS_EAR, - SYSZ_INS_FIDBR, - SYSZ_INS_FIDBRA, - SYSZ_INS_FIEBR, - SYSZ_INS_FIEBRA, - SYSZ_INS_FIXBR, - SYSZ_INS_FIXBRA, - SYSZ_INS_FLOGR, - SYSZ_INS_IC, - SYSZ_INS_ICY, - SYSZ_INS_IIHF, - SYSZ_INS_IIHH, - SYSZ_INS_IIHL, - SYSZ_INS_IILF, - SYSZ_INS_IILH, - SYSZ_INS_IILL, - SYSZ_INS_IPM, - SYSZ_INS_L, - SYSZ_INS_LA, - SYSZ_INS_LAA, - SYSZ_INS_LAAG, - SYSZ_INS_LAAL, - SYSZ_INS_LAALG, - SYSZ_INS_LAN, - SYSZ_INS_LANG, - SYSZ_INS_LAO, - SYSZ_INS_LAOG, - SYSZ_INS_LARL, - SYSZ_INS_LAX, - SYSZ_INS_LAXG, - SYSZ_INS_LAY, - SYSZ_INS_LB, - SYSZ_INS_LBH, - SYSZ_INS_LBR, - SYSZ_INS_LCDBR, - SYSZ_INS_LCEBR, - SYSZ_INS_LCGFR, - SYSZ_INS_LCGR, - SYSZ_INS_LCR, - SYSZ_INS_LCXBR, - SYSZ_INS_LD, - SYSZ_INS_LDEB, - SYSZ_INS_LDEBR, - SYSZ_INS_LDGR, - SYSZ_INS_LDR, - SYSZ_INS_LDXBR, - SYSZ_INS_LDXBRA, - SYSZ_INS_LDY, - SYSZ_INS_LE, - SYSZ_INS_LEDBR, - SYSZ_INS_LEDBRA, - SYSZ_INS_LER, - SYSZ_INS_LEXBR, - SYSZ_INS_LEXBRA, - SYSZ_INS_LEY, - SYSZ_INS_LFH, - SYSZ_INS_LG, - SYSZ_INS_LGB, - SYSZ_INS_LGBR, - SYSZ_INS_LGDR, - SYSZ_INS_LGF, - SYSZ_INS_LGFI, - SYSZ_INS_LGFR, - SYSZ_INS_LGFRL, - SYSZ_INS_LGH, - SYSZ_INS_LGHI, - SYSZ_INS_LGHR, - SYSZ_INS_LGHRL, - SYSZ_INS_LGR, - SYSZ_INS_LGRL, - SYSZ_INS_LH, - SYSZ_INS_LHH, - SYSZ_INS_LHI, - SYSZ_INS_LHR, - SYSZ_INS_LHRL, - SYSZ_INS_LHY, - SYSZ_INS_LLC, - SYSZ_INS_LLCH, - SYSZ_INS_LLCR, - SYSZ_INS_LLGC, - SYSZ_INS_LLGCR, - SYSZ_INS_LLGF, - SYSZ_INS_LLGFR, - SYSZ_INS_LLGFRL, - SYSZ_INS_LLGH, - SYSZ_INS_LLGHR, - SYSZ_INS_LLGHRL, - SYSZ_INS_LLH, - SYSZ_INS_LLHH, - SYSZ_INS_LLHR, - SYSZ_INS_LLHRL, - SYSZ_INS_LLIHF, - SYSZ_INS_LLIHH, - SYSZ_INS_LLIHL, - SYSZ_INS_LLILF, - SYSZ_INS_LLILH, - SYSZ_INS_LLILL, - SYSZ_INS_LMG, - SYSZ_INS_LNDBR, - SYSZ_INS_LNEBR, - SYSZ_INS_LNGFR, - SYSZ_INS_LNGR, - SYSZ_INS_LNR, - SYSZ_INS_LNXBR, - SYSZ_INS_LPDBR, - SYSZ_INS_LPEBR, - SYSZ_INS_LPGFR, - SYSZ_INS_LPGR, - SYSZ_INS_LPR, - SYSZ_INS_LPXBR, - SYSZ_INS_LR, - SYSZ_INS_LRL, - SYSZ_INS_LRV, - SYSZ_INS_LRVG, - SYSZ_INS_LRVGR, - SYSZ_INS_LRVR, - SYSZ_INS_LT, - SYSZ_INS_LTDBR, - SYSZ_INS_LTEBR, - SYSZ_INS_LTG, - SYSZ_INS_LTGF, - SYSZ_INS_LTGFR, - SYSZ_INS_LTGR, - SYSZ_INS_LTR, - SYSZ_INS_LTXBR, - SYSZ_INS_LXDB, - SYSZ_INS_LXDBR, - SYSZ_INS_LXEB, - SYSZ_INS_LXEBR, - SYSZ_INS_LXR, - SYSZ_INS_LY, - SYSZ_INS_LZDR, - SYSZ_INS_LZER, - SYSZ_INS_LZXR, - SYSZ_INS_MADB, - SYSZ_INS_MADBR, - SYSZ_INS_MAEB, - SYSZ_INS_MAEBR, - SYSZ_INS_MDB, - SYSZ_INS_MDBR, - SYSZ_INS_MDEB, - SYSZ_INS_MDEBR, - SYSZ_INS_MEEB, - SYSZ_INS_MEEBR, - SYSZ_INS_MGHI, - SYSZ_INS_MH, - SYSZ_INS_MHI, - SYSZ_INS_MHY, - SYSZ_INS_MLG, - SYSZ_INS_MLGR, - SYSZ_INS_MS, - SYSZ_INS_MSDB, - SYSZ_INS_MSDBR, - SYSZ_INS_MSEB, - SYSZ_INS_MSEBR, - SYSZ_INS_MSFI, - SYSZ_INS_MSG, - SYSZ_INS_MSGF, - SYSZ_INS_MSGFI, - SYSZ_INS_MSGFR, - SYSZ_INS_MSGR, - SYSZ_INS_MSR, - SYSZ_INS_MSY, - SYSZ_INS_MVC, - SYSZ_INS_MVGHI, - SYSZ_INS_MVHHI, - SYSZ_INS_MVHI, - SYSZ_INS_MVI, - SYSZ_INS_MVIY, - SYSZ_INS_MVST, - SYSZ_INS_MXBR, - SYSZ_INS_MXDB, - SYSZ_INS_MXDBR, - SYSZ_INS_N, - SYSZ_INS_NC, - SYSZ_INS_NG, - SYSZ_INS_NGR, - SYSZ_INS_NGRK, - SYSZ_INS_NI, - SYSZ_INS_NIHF, - SYSZ_INS_NIHH, - SYSZ_INS_NIHL, - SYSZ_INS_NILF, - SYSZ_INS_NILH, - SYSZ_INS_NILL, - SYSZ_INS_NIY, - SYSZ_INS_NR, - SYSZ_INS_NRK, - SYSZ_INS_NY, - SYSZ_INS_O, - SYSZ_INS_OC, - SYSZ_INS_OG, - SYSZ_INS_OGR, - SYSZ_INS_OGRK, - SYSZ_INS_OI, - SYSZ_INS_OIHF, - SYSZ_INS_OIHH, - SYSZ_INS_OIHL, - SYSZ_INS_OILF, - SYSZ_INS_OILH, - SYSZ_INS_OILL, - SYSZ_INS_OIY, - SYSZ_INS_OR, - SYSZ_INS_ORK, - SYSZ_INS_OY, - SYSZ_INS_PFD, - SYSZ_INS_PFDRL, - SYSZ_INS_RISBG, - SYSZ_INS_RISBHG, - SYSZ_INS_RISBLG, - SYSZ_INS_RLL, - SYSZ_INS_RLLG, - SYSZ_INS_RNSBG, - SYSZ_INS_ROSBG, - SYSZ_INS_RXSBG, - SYSZ_INS_S, - SYSZ_INS_SDB, - SYSZ_INS_SDBR, - SYSZ_INS_SEB, - SYSZ_INS_SEBR, - SYSZ_INS_SG, - SYSZ_INS_SGF, - SYSZ_INS_SGFR, - SYSZ_INS_SGR, - SYSZ_INS_SGRK, - SYSZ_INS_SH, - SYSZ_INS_SHY, - SYSZ_INS_SL, - SYSZ_INS_SLB, - SYSZ_INS_SLBG, - SYSZ_INS_SLBR, - SYSZ_INS_SLFI, - SYSZ_INS_SLG, - SYSZ_INS_SLBGR, - SYSZ_INS_SLGF, - SYSZ_INS_SLGFI, - SYSZ_INS_SLGFR, - SYSZ_INS_SLGR, - SYSZ_INS_SLGRK, - SYSZ_INS_SLL, - SYSZ_INS_SLLG, - SYSZ_INS_SLLK, - SYSZ_INS_SLR, - SYSZ_INS_SLRK, - SYSZ_INS_SLY, - SYSZ_INS_SQDB, - SYSZ_INS_SQDBR, - SYSZ_INS_SQEB, - SYSZ_INS_SQEBR, - SYSZ_INS_SQXBR, - SYSZ_INS_SR, - SYSZ_INS_SRA, - SYSZ_INS_SRAG, - SYSZ_INS_SRAK, - SYSZ_INS_SRK, - SYSZ_INS_SRL, - SYSZ_INS_SRLG, - SYSZ_INS_SRLK, - SYSZ_INS_SRST, - SYSZ_INS_ST, - SYSZ_INS_STC, - SYSZ_INS_STCH, - SYSZ_INS_STCY, - SYSZ_INS_STD, - SYSZ_INS_STDY, - SYSZ_INS_STE, - SYSZ_INS_STEY, - SYSZ_INS_STFH, - SYSZ_INS_STG, - SYSZ_INS_STGRL, - SYSZ_INS_STH, - SYSZ_INS_STHH, - SYSZ_INS_STHRL, - SYSZ_INS_STHY, - SYSZ_INS_STMG, - SYSZ_INS_STRL, - SYSZ_INS_STRV, - SYSZ_INS_STRVG, - SYSZ_INS_STY, - SYSZ_INS_SXBR, - SYSZ_INS_SY, - SYSZ_INS_TM, - SYSZ_INS_TMHH, - SYSZ_INS_TMHL, - SYSZ_INS_TMLH, - SYSZ_INS_TMLL, - SYSZ_INS_TMY, - SYSZ_INS_X, - SYSZ_INS_XC, - SYSZ_INS_XG, - SYSZ_INS_XGR, - SYSZ_INS_XGRK, - SYSZ_INS_XI, - SYSZ_INS_XIHF, - SYSZ_INS_XILF, - SYSZ_INS_XIY, - SYSZ_INS_XR, - SYSZ_INS_XRK, - SYSZ_INS_XY, - SYSZ_INS_AD, - SYSZ_INS_ADR, - SYSZ_INS_ADTR, - SYSZ_INS_ADTRA, - SYSZ_INS_AE, - SYSZ_INS_AER, - SYSZ_INS_AGH, - SYSZ_INS_AHHHR, - SYSZ_INS_AHHLR, - SYSZ_INS_ALGSI, - SYSZ_INS_ALHHHR, - SYSZ_INS_ALHHLR, - SYSZ_INS_ALSI, - SYSZ_INS_ALSIH, - SYSZ_INS_ALSIHN, - SYSZ_INS_AP, - SYSZ_INS_AU, - SYSZ_INS_AUR, - SYSZ_INS_AW, - SYSZ_INS_AWR, - SYSZ_INS_AXR, - SYSZ_INS_AXTR, - SYSZ_INS_AXTRA, - SYSZ_INS_B, - SYSZ_INS_BAKR, - SYSZ_INS_BAL, - SYSZ_INS_BALR, - SYSZ_INS_BAS, - SYSZ_INS_BASSM, - SYSZ_INS_BC, - SYSZ_INS_BCT, - SYSZ_INS_BCTG, - SYSZ_INS_BCTGR, - SYSZ_INS_BCTR, - SYSZ_INS_BE, - SYSZ_INS_BH, - SYSZ_INS_BHE, - SYSZ_INS_BI, - SYSZ_INS_BIC, - SYSZ_INS_BIE, - SYSZ_INS_BIH, - SYSZ_INS_BIHE, - SYSZ_INS_BIL, - SYSZ_INS_BILE, - SYSZ_INS_BILH, - SYSZ_INS_BIM, - SYSZ_INS_BINE, - SYSZ_INS_BINH, - SYSZ_INS_BINHE, - SYSZ_INS_BINL, - SYSZ_INS_BINLE, - SYSZ_INS_BINLH, - SYSZ_INS_BINM, - SYSZ_INS_BINO, - SYSZ_INS_BINP, - SYSZ_INS_BINZ, - SYSZ_INS_BIO, - SYSZ_INS_BIP, - SYSZ_INS_BIZ, - SYSZ_INS_BL, - SYSZ_INS_BLE, - SYSZ_INS_BLH, - SYSZ_INS_BM, - SYSZ_INS_BMR, - SYSZ_INS_BNE, - SYSZ_INS_BNH, - SYSZ_INS_BNHE, - SYSZ_INS_BNL, - SYSZ_INS_BNLE, - SYSZ_INS_BNLH, - SYSZ_INS_BNM, - SYSZ_INS_BNMR, - SYSZ_INS_BNO, - SYSZ_INS_BNP, - SYSZ_INS_BNPR, - SYSZ_INS_BNZ, - SYSZ_INS_BNZR, - SYSZ_INS_BO, - SYSZ_INS_BP, - SYSZ_INS_BPP, - SYSZ_INS_BPR, - SYSZ_INS_BPRP, - SYSZ_INS_BRCTH, - SYSZ_INS_BRXH, - SYSZ_INS_BRXHG, - SYSZ_INS_BRXLE, - SYSZ_INS_BRXLG, - SYSZ_INS_BSA, - SYSZ_INS_BSG, - SYSZ_INS_BSM, - SYSZ_INS_BXH, - SYSZ_INS_BXHG, - SYSZ_INS_BXLE, - SYSZ_INS_BXLEG, - SYSZ_INS_BZ, - SYSZ_INS_BZR, - SYSZ_INS_CD, - SYSZ_INS_CDFBRA, - SYSZ_INS_CDFR, - SYSZ_INS_CDFTR, - SYSZ_INS_CDGBRA, - SYSZ_INS_CDGR, - SYSZ_INS_CDGTR, - SYSZ_INS_CDGTRA, - SYSZ_INS_CDLFTR, - SYSZ_INS_CDLGTR, - SYSZ_INS_CDPT, - SYSZ_INS_CDR, - SYSZ_INS_CDS, - SYSZ_INS_CDSG, - SYSZ_INS_CDSTR, - SYSZ_INS_CDSY, - SYSZ_INS_CDTR, - SYSZ_INS_CDUTR, - SYSZ_INS_CDZT, - SYSZ_INS_CE, - SYSZ_INS_CEDTR, - SYSZ_INS_CEFBRA, - SYSZ_INS_CEFR, - SYSZ_INS_CEGBRA, - SYSZ_INS_CEGR, - SYSZ_INS_CER, - SYSZ_INS_CEXTR, - SYSZ_INS_CFC, - SYSZ_INS_CFDBRA, - SYSZ_INS_CFDR, - SYSZ_INS_CFDTR, - SYSZ_INS_CFEBRA, - SYSZ_INS_CFER, - SYSZ_INS_CFXBRA, - SYSZ_INS_CFXR, - SYSZ_INS_CFXTR, - SYSZ_INS_CGDBRA, - SYSZ_INS_CGDR, - SYSZ_INS_CGDTR, - SYSZ_INS_CGDTRA, - SYSZ_INS_CGEBRA, - SYSZ_INS_CGER, - SYSZ_INS_CGIB, - SYSZ_INS_CGIBE, - SYSZ_INS_CGIBH, - SYSZ_INS_CGIBHE, - SYSZ_INS_CGIBL, - SYSZ_INS_CGIBLE, - SYSZ_INS_CGIBLH, - SYSZ_INS_CGIBNE, - SYSZ_INS_CGIBNH, - SYSZ_INS_CGIBNHE, - SYSZ_INS_CGIBNL, - SYSZ_INS_CGIBNLE, - SYSZ_INS_CGIBNLH, - SYSZ_INS_CGIT, - SYSZ_INS_CGITE, - SYSZ_INS_CGITH, - SYSZ_INS_CGITHE, - SYSZ_INS_CGITL, - SYSZ_INS_CGITLE, - SYSZ_INS_CGITLH, - SYSZ_INS_CGITNE, - SYSZ_INS_CGITNH, - SYSZ_INS_CGITNHE, - SYSZ_INS_CGITNL, - SYSZ_INS_CGITNLE, - SYSZ_INS_CGITNLH, - SYSZ_INS_CGRB, - SYSZ_INS_CGRBE, - SYSZ_INS_CGRBH, - SYSZ_INS_CGRBHE, - SYSZ_INS_CGRBL, - SYSZ_INS_CGRBLE, - SYSZ_INS_CGRBLH, - SYSZ_INS_CGRBNE, - SYSZ_INS_CGRBNH, - SYSZ_INS_CGRBNHE, - SYSZ_INS_CGRBNL, - SYSZ_INS_CGRBNLE, - SYSZ_INS_CGRBNLH, - SYSZ_INS_CGRT, - SYSZ_INS_CGRTE, - SYSZ_INS_CGRTH, - SYSZ_INS_CGRTHE, - SYSZ_INS_CGRTL, - SYSZ_INS_CGRTLE, - SYSZ_INS_CGRTLH, - SYSZ_INS_CGRTNE, - SYSZ_INS_CGRTNH, - SYSZ_INS_CGRTNHE, - SYSZ_INS_CGRTNL, - SYSZ_INS_CGRTNLE, - SYSZ_INS_CGRTNLH, - SYSZ_INS_CGXBRA, - SYSZ_INS_CGXR, - SYSZ_INS_CGXTR, - SYSZ_INS_CGXTRA, - SYSZ_INS_CHHR, - SYSZ_INS_CHLR, - SYSZ_INS_CIB, - SYSZ_INS_CIBE, - SYSZ_INS_CIBH, - SYSZ_INS_CIBHE, - SYSZ_INS_CIBL, - SYSZ_INS_CIBLE, - SYSZ_INS_CIBLH, - SYSZ_INS_CIBNE, - SYSZ_INS_CIBNH, - SYSZ_INS_CIBNHE, - SYSZ_INS_CIBNL, - SYSZ_INS_CIBNLE, - SYSZ_INS_CIBNLH, - SYSZ_INS_CIT, - SYSZ_INS_CITE, - SYSZ_INS_CITH, - SYSZ_INS_CITHE, - SYSZ_INS_CITL, - SYSZ_INS_CITLE, - SYSZ_INS_CITLH, - SYSZ_INS_CITNE, - SYSZ_INS_CITNH, - SYSZ_INS_CITNHE, - SYSZ_INS_CITNL, - SYSZ_INS_CITNLE, - SYSZ_INS_CITNLH, - SYSZ_INS_CKSM, - SYSZ_INS_CLCL, - SYSZ_INS_CLCLE, - SYSZ_INS_CLCLU, - SYSZ_INS_CLFDTR, - SYSZ_INS_CLFIT, - SYSZ_INS_CLFITE, - SYSZ_INS_CLFITH, - SYSZ_INS_CLFITHE, - SYSZ_INS_CLFITL, - SYSZ_INS_CLFITLE, - SYSZ_INS_CLFITLH, - SYSZ_INS_CLFITNE, - SYSZ_INS_CLFITNH, - SYSZ_INS_CLFITNHE, - SYSZ_INS_CLFITNL, - SYSZ_INS_CLFITNLE, - SYSZ_INS_CLFITNLH, - SYSZ_INS_CLFXTR, - SYSZ_INS_CLGDTR, - SYSZ_INS_CLGIB, - SYSZ_INS_CLGIBE, - SYSZ_INS_CLGIBH, - SYSZ_INS_CLGIBHE, - SYSZ_INS_CLGIBL, - SYSZ_INS_CLGIBLE, - SYSZ_INS_CLGIBLH, - SYSZ_INS_CLGIBNE, - SYSZ_INS_CLGIBNH, - SYSZ_INS_CLGIBNHE, - SYSZ_INS_CLGIBNL, - SYSZ_INS_CLGIBNLE, - SYSZ_INS_CLGIBNLH, - SYSZ_INS_CLGIT, - SYSZ_INS_CLGITE, - SYSZ_INS_CLGITH, - SYSZ_INS_CLGITHE, - SYSZ_INS_CLGITL, - SYSZ_INS_CLGITLE, - SYSZ_INS_CLGITLH, - SYSZ_INS_CLGITNE, - SYSZ_INS_CLGITNH, - SYSZ_INS_CLGITNHE, - SYSZ_INS_CLGITNL, - SYSZ_INS_CLGITNLE, - SYSZ_INS_CLGITNLH, - SYSZ_INS_CLGRB, - SYSZ_INS_CLGRBE, - SYSZ_INS_CLGRBH, - SYSZ_INS_CLGRBHE, - SYSZ_INS_CLGRBL, - SYSZ_INS_CLGRBLE, - SYSZ_INS_CLGRBLH, - SYSZ_INS_CLGRBNE, - SYSZ_INS_CLGRBNH, - SYSZ_INS_CLGRBNHE, - SYSZ_INS_CLGRBNL, - SYSZ_INS_CLGRBNLE, - SYSZ_INS_CLGRBNLH, - SYSZ_INS_CLGRT, - SYSZ_INS_CLGRTE, - SYSZ_INS_CLGRTH, - SYSZ_INS_CLGRTHE, - SYSZ_INS_CLGRTL, - SYSZ_INS_CLGRTLE, - SYSZ_INS_CLGRTLH, - SYSZ_INS_CLGRTNE, - SYSZ_INS_CLGRTNH, - SYSZ_INS_CLGRTNHE, - SYSZ_INS_CLGRTNL, - SYSZ_INS_CLGRTNLE, - SYSZ_INS_CLGRTNLH, - SYSZ_INS_CLGT, - SYSZ_INS_CLGTE, - SYSZ_INS_CLGTH, - SYSZ_INS_CLGTHE, - SYSZ_INS_CLGTL, - SYSZ_INS_CLGTLE, - SYSZ_INS_CLGTLH, - SYSZ_INS_CLGTNE, - SYSZ_INS_CLGTNH, - SYSZ_INS_CLGTNHE, - SYSZ_INS_CLGTNL, - SYSZ_INS_CLGTNLE, - SYSZ_INS_CLGTNLH, - SYSZ_INS_CLGXTR, - SYSZ_INS_CLHHR, - SYSZ_INS_CLHLR, - SYSZ_INS_CLIB, - SYSZ_INS_CLIBE, - SYSZ_INS_CLIBH, - SYSZ_INS_CLIBHE, - SYSZ_INS_CLIBL, - SYSZ_INS_CLIBLE, - SYSZ_INS_CLIBLH, - SYSZ_INS_CLIBNE, - SYSZ_INS_CLIBNH, - SYSZ_INS_CLIBNHE, - SYSZ_INS_CLIBNL, - SYSZ_INS_CLIBNLE, - SYSZ_INS_CLIBNLH, - SYSZ_INS_CLM, - SYSZ_INS_CLMH, - SYSZ_INS_CLMY, - SYSZ_INS_CLRB, - SYSZ_INS_CLRBE, - SYSZ_INS_CLRBH, - SYSZ_INS_CLRBHE, - SYSZ_INS_CLRBL, - SYSZ_INS_CLRBLE, - SYSZ_INS_CLRBLH, - SYSZ_INS_CLRBNE, - SYSZ_INS_CLRBNH, - SYSZ_INS_CLRBNHE, - SYSZ_INS_CLRBNL, - SYSZ_INS_CLRBNLE, - SYSZ_INS_CLRBNLH, - SYSZ_INS_CLRT, - SYSZ_INS_CLRTE, - SYSZ_INS_CLRTH, - SYSZ_INS_CLRTHE, - SYSZ_INS_CLRTL, - SYSZ_INS_CLRTLE, - SYSZ_INS_CLRTLH, - SYSZ_INS_CLRTNE, - SYSZ_INS_CLRTNH, - SYSZ_INS_CLRTNHE, - SYSZ_INS_CLRTNL, - SYSZ_INS_CLRTNLE, - SYSZ_INS_CLRTNLH, - SYSZ_INS_CLT, - SYSZ_INS_CLTE, - SYSZ_INS_CLTH, - SYSZ_INS_CLTHE, - SYSZ_INS_CLTL, - SYSZ_INS_CLTLE, - SYSZ_INS_CLTLH, - SYSZ_INS_CLTNE, - SYSZ_INS_CLTNH, - SYSZ_INS_CLTNHE, - SYSZ_INS_CLTNL, - SYSZ_INS_CLTNLE, - SYSZ_INS_CLTNLH, - SYSZ_INS_CMPSC, - SYSZ_INS_CP, - SYSZ_INS_CPDT, - SYSZ_INS_CPXT, - SYSZ_INS_CPYA, - SYSZ_INS_CRB, - SYSZ_INS_CRBE, - SYSZ_INS_CRBH, - SYSZ_INS_CRBHE, - SYSZ_INS_CRBL, - SYSZ_INS_CRBLE, - SYSZ_INS_CRBLH, - SYSZ_INS_CRBNE, - SYSZ_INS_CRBNH, - SYSZ_INS_CRBNHE, - SYSZ_INS_CRBNL, - SYSZ_INS_CRBNLE, - SYSZ_INS_CRBNLH, - SYSZ_INS_CRDTE, - SYSZ_INS_CRT, - SYSZ_INS_CRTE, - SYSZ_INS_CRTH, - SYSZ_INS_CRTHE, - SYSZ_INS_CRTL, - SYSZ_INS_CRTLE, - SYSZ_INS_CRTLH, - SYSZ_INS_CRTNE, - SYSZ_INS_CRTNH, - SYSZ_INS_CRTNHE, - SYSZ_INS_CRTNL, - SYSZ_INS_CRTNLE, - SYSZ_INS_CRTNLH, - SYSZ_INS_CSCH, - SYSZ_INS_CSDTR, - SYSZ_INS_CSP, - SYSZ_INS_CSPG, - SYSZ_INS_CSST, - SYSZ_INS_CSXTR, - SYSZ_INS_CU12, - SYSZ_INS_CU14, - SYSZ_INS_CU21, - SYSZ_INS_CU24, - SYSZ_INS_CU41, - SYSZ_INS_CU42, - SYSZ_INS_CUDTR, - SYSZ_INS_CUSE, - SYSZ_INS_CUTFU, - SYSZ_INS_CUUTF, - SYSZ_INS_CUXTR, - SYSZ_INS_CVB, - SYSZ_INS_CVBG, - SYSZ_INS_CVBY, - SYSZ_INS_CVD, - SYSZ_INS_CVDG, - SYSZ_INS_CVDY, - SYSZ_INS_CXFBRA, - SYSZ_INS_CXFR, - SYSZ_INS_CXFTR, - SYSZ_INS_CXGBRA, - SYSZ_INS_CXGR, - SYSZ_INS_CXGTR, - SYSZ_INS_CXGTRA, - SYSZ_INS_CXLFTR, - SYSZ_INS_CXLGTR, - SYSZ_INS_CXPT, - SYSZ_INS_CXR, - SYSZ_INS_CXSTR, - SYSZ_INS_CXTR, - SYSZ_INS_CXUTR, - SYSZ_INS_CXZT, - SYSZ_INS_CZDT, - SYSZ_INS_CZXT, - SYSZ_INS_D, - SYSZ_INS_DD, - SYSZ_INS_DDR, - SYSZ_INS_DDTR, - SYSZ_INS_DDTRA, - SYSZ_INS_DE, - SYSZ_INS_DER, - SYSZ_INS_DIAG, - SYSZ_INS_DIDBR, - SYSZ_INS_DIEBR, - SYSZ_INS_DP, - SYSZ_INS_DR, - SYSZ_INS_DXR, - SYSZ_INS_DXTR, - SYSZ_INS_DXTRA, - SYSZ_INS_ECAG, - SYSZ_INS_ECCTR, - SYSZ_INS_ECPGA, - SYSZ_INS_ECTG, - SYSZ_INS_ED, - SYSZ_INS_EDMK, - SYSZ_INS_EEDTR, - SYSZ_INS_EEXTR, - SYSZ_INS_EFPC, - SYSZ_INS_EPAIR, - SYSZ_INS_EPAR, - SYSZ_INS_EPCTR, - SYSZ_INS_EPSW, - SYSZ_INS_EREG, - SYSZ_INS_EREGG, - SYSZ_INS_ESAIR, - SYSZ_INS_ESAR, - SYSZ_INS_ESDTR, - SYSZ_INS_ESEA, - SYSZ_INS_ESTA, - SYSZ_INS_ESXTR, - SYSZ_INS_ETND, - SYSZ_INS_EX, - SYSZ_INS_EXRL, - SYSZ_INS_FIDR, - SYSZ_INS_FIDTR, - SYSZ_INS_FIER, - SYSZ_INS_FIXR, - SYSZ_INS_FIXTR, - SYSZ_INS_HDR, - SYSZ_INS_HER, - SYSZ_INS_HSCH, - SYSZ_INS_IAC, - SYSZ_INS_ICM, - SYSZ_INS_ICMH, - SYSZ_INS_ICMY, - SYSZ_INS_IDTE, - SYSZ_INS_IEDTR, - SYSZ_INS_IEXTR, - SYSZ_INS_IPK, - SYSZ_INS_IPTE, - SYSZ_INS_IRBM, - SYSZ_INS_ISKE, - SYSZ_INS_IVSK, - SYSZ_INS_JGM, - SYSZ_INS_JGNM, - SYSZ_INS_JGNP, - SYSZ_INS_JGNZ, - SYSZ_INS_JGP, - SYSZ_INS_JGZ, - SYSZ_INS_JM, - SYSZ_INS_JNM, - SYSZ_INS_JNP, - SYSZ_INS_JNZ, - SYSZ_INS_JP, - SYSZ_INS_JZ, - SYSZ_INS_KDB, - SYSZ_INS_KDBR, - SYSZ_INS_KDTR, - SYSZ_INS_KEB, - SYSZ_INS_KEBR, - SYSZ_INS_KIMD, - SYSZ_INS_KLMD, - SYSZ_INS_KM, - SYSZ_INS_KMA, - SYSZ_INS_KMAC, - SYSZ_INS_KMC, - SYSZ_INS_KMCTR, - SYSZ_INS_KMF, - SYSZ_INS_KMO, - SYSZ_INS_KXBR, - SYSZ_INS_KXTR, - SYSZ_INS_LAE, - SYSZ_INS_LAEY, - SYSZ_INS_LAM, - SYSZ_INS_LAMY, - SYSZ_INS_LASP, - SYSZ_INS_LAT, - SYSZ_INS_LCBB, - SYSZ_INS_LCCTL, - SYSZ_INS_LCDFR, - SYSZ_INS_LCDR, - SYSZ_INS_LCER, - SYSZ_INS_LCTL, - SYSZ_INS_LCTLG, - SYSZ_INS_LCXR, - SYSZ_INS_LDE, - SYSZ_INS_LDER, - SYSZ_INS_LDETR, - SYSZ_INS_LDXR, - SYSZ_INS_LDXTR, - SYSZ_INS_LEDR, - SYSZ_INS_LEDTR, - SYSZ_INS_LEXR, - SYSZ_INS_LFAS, - SYSZ_INS_LFHAT, - SYSZ_INS_LFPC, - SYSZ_INS_LGAT, - SYSZ_INS_LGG, - SYSZ_INS_LGSC, - SYSZ_INS_LLGFAT, - SYSZ_INS_LLGFSG, - SYSZ_INS_LLGT, - SYSZ_INS_LLGTAT, - SYSZ_INS_LLGTR, - SYSZ_INS_LLZRGF, - SYSZ_INS_LM, - SYSZ_INS_LMD, - SYSZ_INS_LMH, - SYSZ_INS_LMY, - SYSZ_INS_LNDFR, - SYSZ_INS_LNDR, - SYSZ_INS_LNER, - SYSZ_INS_LNXR, - SYSZ_INS_LOCFH, - SYSZ_INS_LOCFHE, - SYSZ_INS_LOCFHH, - SYSZ_INS_LOCFHHE, - SYSZ_INS_LOCFHL, - SYSZ_INS_LOCFHLE, - SYSZ_INS_LOCFHLH, - SYSZ_INS_LOCFHM, - SYSZ_INS_LOCFHNE, - SYSZ_INS_LOCFHNH, - SYSZ_INS_LOCFHNHE, - SYSZ_INS_LOCFHNL, - SYSZ_INS_LOCFHNLE, - SYSZ_INS_LOCFHNLH, - SYSZ_INS_LOCFHNM, - SYSZ_INS_LOCFHNO, - SYSZ_INS_LOCFHNP, - SYSZ_INS_LOCFHNZ, - SYSZ_INS_LOCFHO, - SYSZ_INS_LOCFHP, - SYSZ_INS_LOCFHR, - SYSZ_INS_LOCFHRE, - SYSZ_INS_LOCFHRH, - SYSZ_INS_LOCFHRHE, - SYSZ_INS_LOCFHRL, - SYSZ_INS_LOCFHRLE, - SYSZ_INS_LOCFHRLH, - SYSZ_INS_LOCFHRM, - SYSZ_INS_LOCFHRNE, - SYSZ_INS_LOCFHRNH, - SYSZ_INS_LOCFHRNHE, - SYSZ_INS_LOCFHRNL, - SYSZ_INS_LOCFHRNLE, - SYSZ_INS_LOCFHRNLH, - SYSZ_INS_LOCFHRNM, - SYSZ_INS_LOCFHRNO, - SYSZ_INS_LOCFHRNP, - SYSZ_INS_LOCFHRNZ, - SYSZ_INS_LOCFHRO, - SYSZ_INS_LOCFHRP, - SYSZ_INS_LOCFHRZ, - SYSZ_INS_LOCFHZ, - SYSZ_INS_LOCGHI, - SYSZ_INS_LOCGHIE, - SYSZ_INS_LOCGHIH, - SYSZ_INS_LOCGHIHE, - SYSZ_INS_LOCGHIL, - SYSZ_INS_LOCGHILE, - SYSZ_INS_LOCGHILH, - SYSZ_INS_LOCGHIM, - SYSZ_INS_LOCGHINE, - SYSZ_INS_LOCGHINH, - SYSZ_INS_LOCGHINHE, - SYSZ_INS_LOCGHINL, - SYSZ_INS_LOCGHINLE, - SYSZ_INS_LOCGHINLH, - SYSZ_INS_LOCGHINM, - SYSZ_INS_LOCGHINO, - SYSZ_INS_LOCGHINP, - SYSZ_INS_LOCGHINZ, - SYSZ_INS_LOCGHIO, - SYSZ_INS_LOCGHIP, - SYSZ_INS_LOCGHIZ, - SYSZ_INS_LOCGM, - SYSZ_INS_LOCGNM, - SYSZ_INS_LOCGNP, - SYSZ_INS_LOCGNZ, - SYSZ_INS_LOCGP, - SYSZ_INS_LOCGRM, - SYSZ_INS_LOCGRNM, - SYSZ_INS_LOCGRNP, - SYSZ_INS_LOCGRNZ, - SYSZ_INS_LOCGRP, - SYSZ_INS_LOCGRZ, - SYSZ_INS_LOCGZ, - SYSZ_INS_LOCHHI, - SYSZ_INS_LOCHHIE, - SYSZ_INS_LOCHHIH, - SYSZ_INS_LOCHHIHE, - SYSZ_INS_LOCHHIL, - SYSZ_INS_LOCHHILE, - SYSZ_INS_LOCHHILH, - SYSZ_INS_LOCHHIM, - SYSZ_INS_LOCHHINE, - SYSZ_INS_LOCHHINH, - SYSZ_INS_LOCHHINHE, - SYSZ_INS_LOCHHINL, - SYSZ_INS_LOCHHINLE, - SYSZ_INS_LOCHHINLH, - SYSZ_INS_LOCHHINM, - SYSZ_INS_LOCHHINO, - SYSZ_INS_LOCHHINP, - SYSZ_INS_LOCHHINZ, - SYSZ_INS_LOCHHIO, - SYSZ_INS_LOCHHIP, - SYSZ_INS_LOCHHIZ, - SYSZ_INS_LOCHI, - SYSZ_INS_LOCHIE, - SYSZ_INS_LOCHIH, - SYSZ_INS_LOCHIHE, - SYSZ_INS_LOCHIL, - SYSZ_INS_LOCHILE, - SYSZ_INS_LOCHILH, - SYSZ_INS_LOCHIM, - SYSZ_INS_LOCHINE, - SYSZ_INS_LOCHINH, - SYSZ_INS_LOCHINHE, - SYSZ_INS_LOCHINL, - SYSZ_INS_LOCHINLE, - SYSZ_INS_LOCHINLH, - SYSZ_INS_LOCHINM, - SYSZ_INS_LOCHINO, - SYSZ_INS_LOCHINP, - SYSZ_INS_LOCHINZ, - SYSZ_INS_LOCHIO, - SYSZ_INS_LOCHIP, - SYSZ_INS_LOCHIZ, - SYSZ_INS_LOCM, - SYSZ_INS_LOCNM, - SYSZ_INS_LOCNP, - SYSZ_INS_LOCNZ, - SYSZ_INS_LOCP, - SYSZ_INS_LOCRM, - SYSZ_INS_LOCRNM, - SYSZ_INS_LOCRNP, - SYSZ_INS_LOCRNZ, - SYSZ_INS_LOCRP, - SYSZ_INS_LOCRZ, - SYSZ_INS_LOCZ, - SYSZ_INS_LPCTL, - SYSZ_INS_LPD, - SYSZ_INS_LPDFR, - SYSZ_INS_LPDG, - SYSZ_INS_LPDR, - SYSZ_INS_LPER, - SYSZ_INS_LPP, - SYSZ_INS_LPQ, - SYSZ_INS_LPSW, - SYSZ_INS_LPSWE, - SYSZ_INS_LPTEA, - SYSZ_INS_LPXR, - SYSZ_INS_LRA, - SYSZ_INS_LRAG, - SYSZ_INS_LRAY, - SYSZ_INS_LRDR, - SYSZ_INS_LRER, - SYSZ_INS_LRVH, - SYSZ_INS_LSCTL, - SYSZ_INS_LTDR, - SYSZ_INS_LTDTR, - SYSZ_INS_LTER, - SYSZ_INS_LTXR, - SYSZ_INS_LTXTR, - SYSZ_INS_LURA, - SYSZ_INS_LURAG, - SYSZ_INS_LXD, - SYSZ_INS_LXDR, - SYSZ_INS_LXDTR, - SYSZ_INS_LXE, - SYSZ_INS_LXER, - SYSZ_INS_LZRF, - SYSZ_INS_LZRG, - SYSZ_INS_M, - SYSZ_INS_MAD, - SYSZ_INS_MADR, - SYSZ_INS_MAE, - SYSZ_INS_MAER, - SYSZ_INS_MAY, - SYSZ_INS_MAYH, - SYSZ_INS_MAYHR, - SYSZ_INS_MAYL, - SYSZ_INS_MAYLR, - SYSZ_INS_MAYR, - SYSZ_INS_MC, - SYSZ_INS_MD, - SYSZ_INS_MDE, - SYSZ_INS_MDER, - SYSZ_INS_MDR, - SYSZ_INS_MDTR, - SYSZ_INS_MDTRA, - SYSZ_INS_ME, - SYSZ_INS_MEE, - SYSZ_INS_MEER, - SYSZ_INS_MER, - SYSZ_INS_MFY, - SYSZ_INS_MG, - SYSZ_INS_MGH, - SYSZ_INS_MGRK, - SYSZ_INS_ML, - SYSZ_INS_MLR, - SYSZ_INS_MP, - SYSZ_INS_MR, - SYSZ_INS_MSC, - SYSZ_INS_MSCH, - SYSZ_INS_MSD, - SYSZ_INS_MSDR, - SYSZ_INS_MSE, - SYSZ_INS_MSER, - SYSZ_INS_MSGC, - SYSZ_INS_MSGRKC, - SYSZ_INS_MSRKC, - SYSZ_INS_MSTA, - SYSZ_INS_MVCDK, - SYSZ_INS_MVCIN, - SYSZ_INS_MVCK, - SYSZ_INS_MVCL, - SYSZ_INS_MVCLE, - SYSZ_INS_MVCLU, - SYSZ_INS_MVCOS, - SYSZ_INS_MVCP, - SYSZ_INS_MVCS, - SYSZ_INS_MVCSK, - SYSZ_INS_MVN, - SYSZ_INS_MVO, - SYSZ_INS_MVPG, - SYSZ_INS_MVZ, - SYSZ_INS_MXD, - SYSZ_INS_MXDR, - SYSZ_INS_MXR, - SYSZ_INS_MXTR, - SYSZ_INS_MXTRA, - SYSZ_INS_MY, - SYSZ_INS_MYH, - SYSZ_INS_MYHR, - SYSZ_INS_MYL, - SYSZ_INS_MYLR, - SYSZ_INS_MYR, - SYSZ_INS_NIAI, - SYSZ_INS_NTSTG, - SYSZ_INS_PACK, - SYSZ_INS_PALB, - SYSZ_INS_PC, - SYSZ_INS_PCC, - SYSZ_INS_PCKMO, - SYSZ_INS_PFMF, - SYSZ_INS_PFPO, - SYSZ_INS_PGIN, - SYSZ_INS_PGOUT, - SYSZ_INS_PKA, - SYSZ_INS_PKU, - SYSZ_INS_PLO, - SYSZ_INS_POPCNT, - SYSZ_INS_PPA, - SYSZ_INS_PPNO, - SYSZ_INS_PR, - SYSZ_INS_PRNO, - SYSZ_INS_PT, - SYSZ_INS_PTF, - SYSZ_INS_PTFF, - SYSZ_INS_PTI, - SYSZ_INS_PTLB, - SYSZ_INS_QADTR, - SYSZ_INS_QAXTR, - SYSZ_INS_QCTRI, - SYSZ_INS_QSI, - SYSZ_INS_RCHP, - SYSZ_INS_RISBGN, - SYSZ_INS_RP, - SYSZ_INS_RRBE, - SYSZ_INS_RRBM, - SYSZ_INS_RRDTR, - SYSZ_INS_RRXTR, - SYSZ_INS_RSCH, - SYSZ_INS_SAC, - SYSZ_INS_SACF, - SYSZ_INS_SAL, - SYSZ_INS_SAM24, - SYSZ_INS_SAM31, - SYSZ_INS_SAM64, - SYSZ_INS_SAR, - SYSZ_INS_SCCTR, - SYSZ_INS_SCHM, - SYSZ_INS_SCK, - SYSZ_INS_SCKC, - SYSZ_INS_SCKPF, - SYSZ_INS_SD, - SYSZ_INS_SDR, - SYSZ_INS_SDTR, - SYSZ_INS_SDTRA, - SYSZ_INS_SE, - SYSZ_INS_SER, - SYSZ_INS_SFASR, - SYSZ_INS_SFPC, - SYSZ_INS_SGH, - SYSZ_INS_SHHHR, - SYSZ_INS_SHHLR, - SYSZ_INS_SIE, - SYSZ_INS_SIGA, - SYSZ_INS_SIGP, - SYSZ_INS_SLA, - SYSZ_INS_SLAG, - SYSZ_INS_SLAK, - SYSZ_INS_SLDA, - SYSZ_INS_SLDL, - SYSZ_INS_SLDT, - SYSZ_INS_SLHHHR, - SYSZ_INS_SLHHLR, - SYSZ_INS_SLXT, - SYSZ_INS_SP, - SYSZ_INS_SPCTR, - SYSZ_INS_SPKA, - SYSZ_INS_SPM, - SYSZ_INS_SPT, - SYSZ_INS_SPX, - SYSZ_INS_SQD, - SYSZ_INS_SQDR, - SYSZ_INS_SQE, - SYSZ_INS_SQER, - SYSZ_INS_SQXR, - SYSZ_INS_SRDA, - SYSZ_INS_SRDL, - SYSZ_INS_SRDT, - SYSZ_INS_SRNM, - SYSZ_INS_SRNMB, - SYSZ_INS_SRNMT, - SYSZ_INS_SRP, - SYSZ_INS_SRSTU, - SYSZ_INS_SRXT, - SYSZ_INS_SSAIR, - SYSZ_INS_SSAR, - SYSZ_INS_SSCH, - SYSZ_INS_SSKE, - SYSZ_INS_SSM, - SYSZ_INS_STAM, - SYSZ_INS_STAMY, - SYSZ_INS_STAP, - SYSZ_INS_STCK, - SYSZ_INS_STCKC, - SYSZ_INS_STCKE, - SYSZ_INS_STCKF, - SYSZ_INS_STCM, - SYSZ_INS_STCMH, - SYSZ_INS_STCMY, - SYSZ_INS_STCPS, - SYSZ_INS_STCRW, - SYSZ_INS_STCTG, - SYSZ_INS_STCTL, - SYSZ_INS_STFL, - SYSZ_INS_STFLE, - SYSZ_INS_STFPC, - SYSZ_INS_STGSC, - SYSZ_INS_STIDP, - SYSZ_INS_STM, - SYSZ_INS_STMH, - SYSZ_INS_STMY, - SYSZ_INS_STNSM, - SYSZ_INS_STOCFH, - SYSZ_INS_STOCFHE, - SYSZ_INS_STOCFHH, - SYSZ_INS_STOCFHHE, - SYSZ_INS_STOCFHL, - SYSZ_INS_STOCFHLE, - SYSZ_INS_STOCFHLH, - SYSZ_INS_STOCFHM, - SYSZ_INS_STOCFHNE, - SYSZ_INS_STOCFHNH, - SYSZ_INS_STOCFHNHE, - SYSZ_INS_STOCFHNL, - SYSZ_INS_STOCFHNLE, - SYSZ_INS_STOCFHNLH, - SYSZ_INS_STOCFHNM, - SYSZ_INS_STOCFHNO, - SYSZ_INS_STOCFHNP, - SYSZ_INS_STOCFHNZ, - SYSZ_INS_STOCFHO, - SYSZ_INS_STOCFHP, - SYSZ_INS_STOCFHZ, - SYSZ_INS_STOCGM, - SYSZ_INS_STOCGNM, - SYSZ_INS_STOCGNP, - SYSZ_INS_STOCGNZ, - SYSZ_INS_STOCGP, - SYSZ_INS_STOCGZ, - SYSZ_INS_STOCM, - SYSZ_INS_STOCNM, - SYSZ_INS_STOCNP, - SYSZ_INS_STOCNZ, - SYSZ_INS_STOCP, - SYSZ_INS_STOCZ, - SYSZ_INS_STOSM, - SYSZ_INS_STPQ, - SYSZ_INS_STPT, - SYSZ_INS_STPX, - SYSZ_INS_STRAG, - SYSZ_INS_STRVH, - SYSZ_INS_STSCH, - SYSZ_INS_STSI, - SYSZ_INS_STURA, - SYSZ_INS_STURG, - SYSZ_INS_SU, - SYSZ_INS_SUR, - SYSZ_INS_SVC, - SYSZ_INS_SW, - SYSZ_INS_SWR, - SYSZ_INS_SXR, - SYSZ_INS_SXTR, - SYSZ_INS_SXTRA, - SYSZ_INS_TABORT, - SYSZ_INS_TAM, - SYSZ_INS_TAR, - SYSZ_INS_TB, - SYSZ_INS_TBDR, - SYSZ_INS_TBEDR, - SYSZ_INS_TBEGIN, - SYSZ_INS_TBEGINC, - SYSZ_INS_TCDB, - SYSZ_INS_TCEB, - SYSZ_INS_TCXB, - SYSZ_INS_TDCDT, - SYSZ_INS_TDCET, - SYSZ_INS_TDCXT, - SYSZ_INS_TDGDT, - SYSZ_INS_TDGET, - SYSZ_INS_TDGXT, - SYSZ_INS_TEND, - SYSZ_INS_THDER, - SYSZ_INS_THDR, - SYSZ_INS_TP, - SYSZ_INS_TPI, - SYSZ_INS_TPROT, - SYSZ_INS_TR, - SYSZ_INS_TRACE, - SYSZ_INS_TRACG, - SYSZ_INS_TRAP2, - SYSZ_INS_TRAP4, - SYSZ_INS_TRE, - SYSZ_INS_TROO, - SYSZ_INS_TROT, - SYSZ_INS_TRT, - SYSZ_INS_TRTE, - SYSZ_INS_TRTO, - SYSZ_INS_TRTR, - SYSZ_INS_TRTRE, - SYSZ_INS_TRTT, - SYSZ_INS_TS, - SYSZ_INS_TSCH, - SYSZ_INS_UNPK, - SYSZ_INS_UNPKA, - SYSZ_INS_UNPKU, - SYSZ_INS_UPT, - SYSZ_INS_VA, - SYSZ_INS_VAB, - SYSZ_INS_VAC, - SYSZ_INS_VACC, - SYSZ_INS_VACCB, - SYSZ_INS_VACCC, - SYSZ_INS_VACCCQ, - SYSZ_INS_VACCF, - SYSZ_INS_VACCG, - SYSZ_INS_VACCH, - SYSZ_INS_VACCQ, - SYSZ_INS_VACQ, - SYSZ_INS_VAF, - SYSZ_INS_VAG, - SYSZ_INS_VAH, - SYSZ_INS_VAP, - SYSZ_INS_VAQ, - SYSZ_INS_VAVG, - SYSZ_INS_VAVGB, - SYSZ_INS_VAVGF, - SYSZ_INS_VAVGG, - SYSZ_INS_VAVGH, - SYSZ_INS_VAVGL, - SYSZ_INS_VAVGLB, - SYSZ_INS_VAVGLF, - SYSZ_INS_VAVGLG, - SYSZ_INS_VAVGLH, - SYSZ_INS_VBPERM, - SYSZ_INS_VCDG, - SYSZ_INS_VCDGB, - SYSZ_INS_VCDLG, - SYSZ_INS_VCDLGB, - SYSZ_INS_VCEQ, - SYSZ_INS_VCEQB, - SYSZ_INS_VCEQBS, - SYSZ_INS_VCEQF, - SYSZ_INS_VCEQFS, - SYSZ_INS_VCEQG, - SYSZ_INS_VCEQGS, - SYSZ_INS_VCEQH, - SYSZ_INS_VCEQHS, - SYSZ_INS_VCGD, - SYSZ_INS_VCGDB, - SYSZ_INS_VCH, - SYSZ_INS_VCHB, - SYSZ_INS_VCHBS, - SYSZ_INS_VCHF, - SYSZ_INS_VCHFS, - SYSZ_INS_VCHG, - SYSZ_INS_VCHGS, - SYSZ_INS_VCHH, - SYSZ_INS_VCHHS, - SYSZ_INS_VCHL, - SYSZ_INS_VCHLB, - SYSZ_INS_VCHLBS, - SYSZ_INS_VCHLF, - SYSZ_INS_VCHLFS, - SYSZ_INS_VCHLG, - SYSZ_INS_VCHLGS, - SYSZ_INS_VCHLH, - SYSZ_INS_VCHLHS, - SYSZ_INS_VCKSM, - SYSZ_INS_VCLGD, - SYSZ_INS_VCLGDB, - SYSZ_INS_VCLZ, - SYSZ_INS_VCLZB, - SYSZ_INS_VCLZF, - SYSZ_INS_VCLZG, - SYSZ_INS_VCLZH, - SYSZ_INS_VCP, - SYSZ_INS_VCTZ, - SYSZ_INS_VCTZB, - SYSZ_INS_VCTZF, - SYSZ_INS_VCTZG, - SYSZ_INS_VCTZH, - SYSZ_INS_VCVB, - SYSZ_INS_VCVBG, - SYSZ_INS_VCVD, - SYSZ_INS_VCVDG, - SYSZ_INS_VDP, - SYSZ_INS_VEC, - SYSZ_INS_VECB, - SYSZ_INS_VECF, - SYSZ_INS_VECG, - SYSZ_INS_VECH, - SYSZ_INS_VECL, - SYSZ_INS_VECLB, - SYSZ_INS_VECLF, - SYSZ_INS_VECLG, - SYSZ_INS_VECLH, - SYSZ_INS_VERIM, - SYSZ_INS_VERIMB, - SYSZ_INS_VERIMF, - SYSZ_INS_VERIMG, - SYSZ_INS_VERIMH, - SYSZ_INS_VERLL, - SYSZ_INS_VERLLB, - SYSZ_INS_VERLLF, - SYSZ_INS_VERLLG, - SYSZ_INS_VERLLH, - SYSZ_INS_VERLLV, - SYSZ_INS_VERLLVB, - SYSZ_INS_VERLLVF, - SYSZ_INS_VERLLVG, - SYSZ_INS_VERLLVH, - SYSZ_INS_VESL, - SYSZ_INS_VESLB, - SYSZ_INS_VESLF, - SYSZ_INS_VESLG, - SYSZ_INS_VESLH, - SYSZ_INS_VESLV, - SYSZ_INS_VESLVB, - SYSZ_INS_VESLVF, - SYSZ_INS_VESLVG, - SYSZ_INS_VESLVH, - SYSZ_INS_VESRA, - SYSZ_INS_VESRAB, - SYSZ_INS_VESRAF, - SYSZ_INS_VESRAG, - SYSZ_INS_VESRAH, - SYSZ_INS_VESRAV, - SYSZ_INS_VESRAVB, - SYSZ_INS_VESRAVF, - SYSZ_INS_VESRAVG, - SYSZ_INS_VESRAVH, - SYSZ_INS_VESRL, - SYSZ_INS_VESRLB, - SYSZ_INS_VESRLF, - SYSZ_INS_VESRLG, - SYSZ_INS_VESRLH, - SYSZ_INS_VESRLV, - SYSZ_INS_VESRLVB, - SYSZ_INS_VESRLVF, - SYSZ_INS_VESRLVG, - SYSZ_INS_VESRLVH, - SYSZ_INS_VFA, - SYSZ_INS_VFADB, - SYSZ_INS_VFAE, - SYSZ_INS_VFAEB, - SYSZ_INS_VFAEBS, - SYSZ_INS_VFAEF, - SYSZ_INS_VFAEFS, - SYSZ_INS_VFAEH, - SYSZ_INS_VFAEHS, - SYSZ_INS_VFAEZB, - SYSZ_INS_VFAEZBS, - SYSZ_INS_VFAEZF, - SYSZ_INS_VFAEZFS, - SYSZ_INS_VFAEZH, - SYSZ_INS_VFAEZHS, - SYSZ_INS_VFASB, - SYSZ_INS_VFCE, - SYSZ_INS_VFCEDB, - SYSZ_INS_VFCEDBS, - SYSZ_INS_VFCESB, - SYSZ_INS_VFCESBS, - SYSZ_INS_VFCH, - SYSZ_INS_VFCHDB, - SYSZ_INS_VFCHDBS, - SYSZ_INS_VFCHE, - SYSZ_INS_VFCHEDB, - SYSZ_INS_VFCHEDBS, - SYSZ_INS_VFCHESB, - SYSZ_INS_VFCHESBS, - SYSZ_INS_VFCHSB, - SYSZ_INS_VFCHSBS, - SYSZ_INS_VFD, - SYSZ_INS_VFDDB, - SYSZ_INS_VFDSB, - SYSZ_INS_VFEE, - SYSZ_INS_VFEEB, - SYSZ_INS_VFEEBS, - SYSZ_INS_VFEEF, - SYSZ_INS_VFEEFS, - SYSZ_INS_VFEEH, - SYSZ_INS_VFEEHS, - SYSZ_INS_VFEEZB, - SYSZ_INS_VFEEZBS, - SYSZ_INS_VFEEZF, - SYSZ_INS_VFEEZFS, - SYSZ_INS_VFEEZH, - SYSZ_INS_VFEEZHS, - SYSZ_INS_VFENE, - SYSZ_INS_VFENEB, - SYSZ_INS_VFENEBS, - SYSZ_INS_VFENEF, - SYSZ_INS_VFENEFS, - SYSZ_INS_VFENEH, - SYSZ_INS_VFENEHS, - SYSZ_INS_VFENEZB, - SYSZ_INS_VFENEZBS, - SYSZ_INS_VFENEZF, - SYSZ_INS_VFENEZFS, - SYSZ_INS_VFENEZH, - SYSZ_INS_VFENEZHS, - SYSZ_INS_VFI, - SYSZ_INS_VFIDB, - SYSZ_INS_VFISB, - SYSZ_INS_VFKEDB, - SYSZ_INS_VFKEDBS, - SYSZ_INS_VFKESB, - SYSZ_INS_VFKESBS, - SYSZ_INS_VFKHDB, - SYSZ_INS_VFKHDBS, - SYSZ_INS_VFKHEDB, - SYSZ_INS_VFKHEDBS, - SYSZ_INS_VFKHESB, - SYSZ_INS_VFKHESBS, - SYSZ_INS_VFKHSB, - SYSZ_INS_VFKHSBS, - SYSZ_INS_VFLCDB, - SYSZ_INS_VFLCSB, - SYSZ_INS_VFLL, - SYSZ_INS_VFLLS, - SYSZ_INS_VFLNDB, - SYSZ_INS_VFLNSB, - SYSZ_INS_VFLPDB, - SYSZ_INS_VFLPSB, - SYSZ_INS_VFLR, - SYSZ_INS_VFLRD, - SYSZ_INS_VFM, - SYSZ_INS_VFMA, - SYSZ_INS_VFMADB, - SYSZ_INS_VFMASB, - SYSZ_INS_VFMAX, - SYSZ_INS_VFMAXDB, - SYSZ_INS_VFMAXSB, - SYSZ_INS_VFMDB, - SYSZ_INS_VFMIN, - SYSZ_INS_VFMINDB, - SYSZ_INS_VFMINSB, - SYSZ_INS_VFMS, - SYSZ_INS_VFMSB, - SYSZ_INS_VFMSDB, - SYSZ_INS_VFMSSB, - SYSZ_INS_VFNMA, - SYSZ_INS_VFNMADB, - SYSZ_INS_VFNMASB, - SYSZ_INS_VFNMS, - SYSZ_INS_VFNMSDB, - SYSZ_INS_VFNMSSB, - SYSZ_INS_VFPSO, - SYSZ_INS_VFPSODB, - SYSZ_INS_VFPSOSB, - SYSZ_INS_VFS, - SYSZ_INS_VFSDB, - SYSZ_INS_VFSQ, - SYSZ_INS_VFSQDB, - SYSZ_INS_VFSQSB, - SYSZ_INS_VFSSB, - SYSZ_INS_VFTCI, - SYSZ_INS_VFTCIDB, - SYSZ_INS_VFTCISB, - SYSZ_INS_VGBM, - SYSZ_INS_VGEF, - SYSZ_INS_VGEG, - SYSZ_INS_VGFM, - SYSZ_INS_VGFMA, - SYSZ_INS_VGFMAB, - SYSZ_INS_VGFMAF, - SYSZ_INS_VGFMAG, - SYSZ_INS_VGFMAH, - SYSZ_INS_VGFMB, - SYSZ_INS_VGFMF, - SYSZ_INS_VGFMG, - SYSZ_INS_VGFMH, - SYSZ_INS_VGM, - SYSZ_INS_VGMB, - SYSZ_INS_VGMF, - SYSZ_INS_VGMG, - SYSZ_INS_VGMH, - SYSZ_INS_VISTR, - SYSZ_INS_VISTRB, - SYSZ_INS_VISTRBS, - SYSZ_INS_VISTRF, - SYSZ_INS_VISTRFS, - SYSZ_INS_VISTRH, - SYSZ_INS_VISTRHS, - SYSZ_INS_VL, - SYSZ_INS_VLBB, - SYSZ_INS_VLC, - SYSZ_INS_VLCB, - SYSZ_INS_VLCF, - SYSZ_INS_VLCG, - SYSZ_INS_VLCH, - SYSZ_INS_VLDE, - SYSZ_INS_VLDEB, - SYSZ_INS_VLEB, - SYSZ_INS_VLED, - SYSZ_INS_VLEDB, - SYSZ_INS_VLEF, - SYSZ_INS_VLEG, - SYSZ_INS_VLEH, - SYSZ_INS_VLEIB, - SYSZ_INS_VLEIF, - SYSZ_INS_VLEIG, - SYSZ_INS_VLEIH, - SYSZ_INS_VLGV, - SYSZ_INS_VLGVB, - SYSZ_INS_VLGVF, - SYSZ_INS_VLGVG, - SYSZ_INS_VLGVH, - SYSZ_INS_VLIP, - SYSZ_INS_VLL, - SYSZ_INS_VLLEZ, - SYSZ_INS_VLLEZB, - SYSZ_INS_VLLEZF, - SYSZ_INS_VLLEZG, - SYSZ_INS_VLLEZH, - SYSZ_INS_VLLEZLF, - SYSZ_INS_VLM, - SYSZ_INS_VLP, - SYSZ_INS_VLPB, - SYSZ_INS_VLPF, - SYSZ_INS_VLPG, - SYSZ_INS_VLPH, - SYSZ_INS_VLR, - SYSZ_INS_VLREP, - SYSZ_INS_VLREPB, - SYSZ_INS_VLREPF, - SYSZ_INS_VLREPG, - SYSZ_INS_VLREPH, - SYSZ_INS_VLRL, - SYSZ_INS_VLRLR, - SYSZ_INS_VLVG, - SYSZ_INS_VLVGB, - SYSZ_INS_VLVGF, - SYSZ_INS_VLVGG, - SYSZ_INS_VLVGH, - SYSZ_INS_VLVGP, - SYSZ_INS_VMAE, - SYSZ_INS_VMAEB, - SYSZ_INS_VMAEF, - SYSZ_INS_VMAEH, - SYSZ_INS_VMAH, - SYSZ_INS_VMAHB, - SYSZ_INS_VMAHF, - SYSZ_INS_VMAHH, - SYSZ_INS_VMAL, - SYSZ_INS_VMALB, - SYSZ_INS_VMALE, - SYSZ_INS_VMALEB, - SYSZ_INS_VMALEF, - SYSZ_INS_VMALEH, - SYSZ_INS_VMALF, - SYSZ_INS_VMALH, - SYSZ_INS_VMALHB, - SYSZ_INS_VMALHF, - SYSZ_INS_VMALHH, - SYSZ_INS_VMALHW, - SYSZ_INS_VMALO, - SYSZ_INS_VMALOB, - SYSZ_INS_VMALOF, - SYSZ_INS_VMALOH, - SYSZ_INS_VMAO, - SYSZ_INS_VMAOB, - SYSZ_INS_VMAOF, - SYSZ_INS_VMAOH, - SYSZ_INS_VME, - SYSZ_INS_VMEB, - SYSZ_INS_VMEF, - SYSZ_INS_VMEH, - SYSZ_INS_VMH, - SYSZ_INS_VMHB, - SYSZ_INS_VMHF, - SYSZ_INS_VMHH, - SYSZ_INS_VML, - SYSZ_INS_VMLB, - SYSZ_INS_VMLE, - SYSZ_INS_VMLEB, - SYSZ_INS_VMLEF, - SYSZ_INS_VMLEH, - SYSZ_INS_VMLF, - SYSZ_INS_VMLH, - SYSZ_INS_VMLHB, - SYSZ_INS_VMLHF, - SYSZ_INS_VMLHH, - SYSZ_INS_VMLHW, - SYSZ_INS_VMLO, - SYSZ_INS_VMLOB, - SYSZ_INS_VMLOF, - SYSZ_INS_VMLOH, - SYSZ_INS_VMN, - SYSZ_INS_VMNB, - SYSZ_INS_VMNF, - SYSZ_INS_VMNG, - SYSZ_INS_VMNH, - SYSZ_INS_VMNL, - SYSZ_INS_VMNLB, - SYSZ_INS_VMNLF, - SYSZ_INS_VMNLG, - SYSZ_INS_VMNLH, - SYSZ_INS_VMO, - SYSZ_INS_VMOB, - SYSZ_INS_VMOF, - SYSZ_INS_VMOH, - SYSZ_INS_VMP, - SYSZ_INS_VMRH, - SYSZ_INS_VMRHB, - SYSZ_INS_VMRHF, - SYSZ_INS_VMRHG, - SYSZ_INS_VMRHH, - SYSZ_INS_VMRL, - SYSZ_INS_VMRLB, - SYSZ_INS_VMRLF, - SYSZ_INS_VMRLG, - SYSZ_INS_VMRLH, - SYSZ_INS_VMSL, - SYSZ_INS_VMSLG, - SYSZ_INS_VMSP, - SYSZ_INS_VMX, - SYSZ_INS_VMXB, - SYSZ_INS_VMXF, - SYSZ_INS_VMXG, - SYSZ_INS_VMXH, - SYSZ_INS_VMXL, - SYSZ_INS_VMXLB, - SYSZ_INS_VMXLF, - SYSZ_INS_VMXLG, - SYSZ_INS_VMXLH, - SYSZ_INS_VN, - SYSZ_INS_VNC, - SYSZ_INS_VNN, - SYSZ_INS_VNO, - SYSZ_INS_VNX, - SYSZ_INS_VO, - SYSZ_INS_VOC, - SYSZ_INS_VONE, - SYSZ_INS_VPDI, - SYSZ_INS_VPERM, - SYSZ_INS_VPK, - SYSZ_INS_VPKF, - SYSZ_INS_VPKG, - SYSZ_INS_VPKH, - SYSZ_INS_VPKLS, - SYSZ_INS_VPKLSF, - SYSZ_INS_VPKLSFS, - SYSZ_INS_VPKLSG, - SYSZ_INS_VPKLSGS, - SYSZ_INS_VPKLSH, - SYSZ_INS_VPKLSHS, - SYSZ_INS_VPKS, - SYSZ_INS_VPKSF, - SYSZ_INS_VPKSFS, - SYSZ_INS_VPKSG, - SYSZ_INS_VPKSGS, - SYSZ_INS_VPKSH, - SYSZ_INS_VPKSHS, - SYSZ_INS_VPKZ, - SYSZ_INS_VPOPCT, - SYSZ_INS_VPOPCTB, - SYSZ_INS_VPOPCTF, - SYSZ_INS_VPOPCTG, - SYSZ_INS_VPOPCTH, - SYSZ_INS_VPSOP, - SYSZ_INS_VREP, - SYSZ_INS_VREPB, - SYSZ_INS_VREPF, - SYSZ_INS_VREPG, - SYSZ_INS_VREPH, - SYSZ_INS_VREPI, - SYSZ_INS_VREPIB, - SYSZ_INS_VREPIF, - SYSZ_INS_VREPIG, - SYSZ_INS_VREPIH, - SYSZ_INS_VRP, - SYSZ_INS_VS, - SYSZ_INS_VSB, - SYSZ_INS_VSBCBI, - SYSZ_INS_VSBCBIQ, - SYSZ_INS_VSBI, - SYSZ_INS_VSBIQ, - SYSZ_INS_VSCBI, - SYSZ_INS_VSCBIB, - SYSZ_INS_VSCBIF, - SYSZ_INS_VSCBIG, - SYSZ_INS_VSCBIH, - SYSZ_INS_VSCBIQ, - SYSZ_INS_VSCEF, - SYSZ_INS_VSCEG, - SYSZ_INS_VSDP, - SYSZ_INS_VSEG, - SYSZ_INS_VSEGB, - SYSZ_INS_VSEGF, - SYSZ_INS_VSEGH, - SYSZ_INS_VSEL, - SYSZ_INS_VSF, - SYSZ_INS_VSG, - SYSZ_INS_VSH, - SYSZ_INS_VSL, - SYSZ_INS_VSLB, - SYSZ_INS_VSLDB, - SYSZ_INS_VSP, - SYSZ_INS_VSQ, - SYSZ_INS_VSRA, - SYSZ_INS_VSRAB, - SYSZ_INS_VSRL, - SYSZ_INS_VSRLB, - SYSZ_INS_VSRP, - SYSZ_INS_VST, - SYSZ_INS_VSTEB, - SYSZ_INS_VSTEF, - SYSZ_INS_VSTEG, - SYSZ_INS_VSTEH, - SYSZ_INS_VSTL, - SYSZ_INS_VSTM, - SYSZ_INS_VSTRC, - SYSZ_INS_VSTRCB, - SYSZ_INS_VSTRCBS, - SYSZ_INS_VSTRCF, - SYSZ_INS_VSTRCFS, - SYSZ_INS_VSTRCH, - SYSZ_INS_VSTRCHS, - SYSZ_INS_VSTRCZB, - SYSZ_INS_VSTRCZBS, - SYSZ_INS_VSTRCZF, - SYSZ_INS_VSTRCZFS, - SYSZ_INS_VSTRCZH, - SYSZ_INS_VSTRCZHS, - SYSZ_INS_VSTRL, - SYSZ_INS_VSTRLR, - SYSZ_INS_VSUM, - SYSZ_INS_VSUMB, - SYSZ_INS_VSUMG, - SYSZ_INS_VSUMGF, - SYSZ_INS_VSUMGH, - SYSZ_INS_VSUMH, - SYSZ_INS_VSUMQ, - SYSZ_INS_VSUMQF, - SYSZ_INS_VSUMQG, - SYSZ_INS_VTM, - SYSZ_INS_VTP, - SYSZ_INS_VUPH, - SYSZ_INS_VUPHB, - SYSZ_INS_VUPHF, - SYSZ_INS_VUPHH, - SYSZ_INS_VUPKZ, - SYSZ_INS_VUPL, - SYSZ_INS_VUPLB, - SYSZ_INS_VUPLF, - SYSZ_INS_VUPLH, - SYSZ_INS_VUPLHB, - SYSZ_INS_VUPLHF, - SYSZ_INS_VUPLHH, - SYSZ_INS_VUPLHW, - SYSZ_INS_VUPLL, - SYSZ_INS_VUPLLB, - SYSZ_INS_VUPLLF, - SYSZ_INS_VUPLLH, - SYSZ_INS_VX, - SYSZ_INS_VZERO, - SYSZ_INS_WCDGB, - SYSZ_INS_WCDLGB, - SYSZ_INS_WCGDB, - SYSZ_INS_WCLGDB, - SYSZ_INS_WFADB, - SYSZ_INS_WFASB, - SYSZ_INS_WFAXB, - SYSZ_INS_WFC, - SYSZ_INS_WFCDB, - SYSZ_INS_WFCEDB, - SYSZ_INS_WFCEDBS, - SYSZ_INS_WFCESB, - SYSZ_INS_WFCESBS, - SYSZ_INS_WFCEXB, - SYSZ_INS_WFCEXBS, - SYSZ_INS_WFCHDB, - SYSZ_INS_WFCHDBS, - SYSZ_INS_WFCHEDB, - SYSZ_INS_WFCHEDBS, - SYSZ_INS_WFCHESB, - SYSZ_INS_WFCHESBS, - SYSZ_INS_WFCHEXB, - SYSZ_INS_WFCHEXBS, - SYSZ_INS_WFCHSB, - SYSZ_INS_WFCHSBS, - SYSZ_INS_WFCHXB, - SYSZ_INS_WFCHXBS, - SYSZ_INS_WFCSB, - SYSZ_INS_WFCXB, - SYSZ_INS_WFDDB, - SYSZ_INS_WFDSB, - SYSZ_INS_WFDXB, - SYSZ_INS_WFIDB, - SYSZ_INS_WFISB, - SYSZ_INS_WFIXB, - SYSZ_INS_WFK, - SYSZ_INS_WFKDB, - SYSZ_INS_WFKEDB, - SYSZ_INS_WFKEDBS, - SYSZ_INS_WFKESB, - SYSZ_INS_WFKESBS, - SYSZ_INS_WFKEXB, - SYSZ_INS_WFKEXBS, - SYSZ_INS_WFKHDB, - SYSZ_INS_WFKHDBS, - SYSZ_INS_WFKHEDB, - SYSZ_INS_WFKHEDBS, - SYSZ_INS_WFKHESB, - SYSZ_INS_WFKHESBS, - SYSZ_INS_WFKHEXB, - SYSZ_INS_WFKHEXBS, - SYSZ_INS_WFKHSB, - SYSZ_INS_WFKHSBS, - SYSZ_INS_WFKHXB, - SYSZ_INS_WFKHXBS, - SYSZ_INS_WFKSB, - SYSZ_INS_WFKXB, - SYSZ_INS_WFLCDB, - SYSZ_INS_WFLCSB, - SYSZ_INS_WFLCXB, - SYSZ_INS_WFLLD, - SYSZ_INS_WFLLS, - SYSZ_INS_WFLNDB, - SYSZ_INS_WFLNSB, - SYSZ_INS_WFLNXB, - SYSZ_INS_WFLPDB, - SYSZ_INS_WFLPSB, - SYSZ_INS_WFLPXB, - SYSZ_INS_WFLRD, - SYSZ_INS_WFLRX, - SYSZ_INS_WFMADB, - SYSZ_INS_WFMASB, - SYSZ_INS_WFMAXB, - SYSZ_INS_WFMAXDB, - SYSZ_INS_WFMAXSB, - SYSZ_INS_WFMAXXB, - SYSZ_INS_WFMDB, - SYSZ_INS_WFMINDB, - SYSZ_INS_WFMINSB, - SYSZ_INS_WFMINXB, - SYSZ_INS_WFMSB, - SYSZ_INS_WFMSDB, - SYSZ_INS_WFMSSB, - SYSZ_INS_WFMSXB, - SYSZ_INS_WFMXB, - SYSZ_INS_WFNMADB, - SYSZ_INS_WFNMASB, - SYSZ_INS_WFNMAXB, - SYSZ_INS_WFNMSDB, - SYSZ_INS_WFNMSSB, - SYSZ_INS_WFNMSXB, - SYSZ_INS_WFPSODB, - SYSZ_INS_WFPSOSB, - SYSZ_INS_WFPSOXB, - SYSZ_INS_WFSDB, - SYSZ_INS_WFSQDB, - SYSZ_INS_WFSQSB, - SYSZ_INS_WFSQXB, - SYSZ_INS_WFSSB, - SYSZ_INS_WFSXB, - SYSZ_INS_WFTCIDB, - SYSZ_INS_WFTCISB, - SYSZ_INS_WFTCIXB, - SYSZ_INS_WLDEB, - SYSZ_INS_WLEDB, - SYSZ_INS_XSCH, - SYSZ_INS_ZAP, - - SYSZ_INS_ENDING, // <-- mark the end of the list of instructions -} sysz_insn; - -/// Group of SystemZ instructions -typedef enum sysz_insn_group { - SYSZ_GRP_INVALID = 0, ///< = CS_GRP_INVALID - - // Generic groups - // all jump instructions (conditional+direct+indirect jumps) - SYSZ_GRP_JUMP, ///< = CS_GRP_JUMP - - // Architecture-specific groups - SYSZ_GRP_DISTINCTOPS = 128, - SYSZ_GRP_FPEXTENSION, - SYSZ_GRP_HIGHWORD, - SYSZ_GRP_INTERLOCKEDACCESS1, - SYSZ_GRP_LOADSTOREONCOND, - SYSZ_GRP_DFPPACKEDCONVERSION, - SYSZ_GRP_DFPZONEDCONVERSION, - SYSZ_GRP_ENHANCEDDAT2, - SYSZ_GRP_EXECUTIONHINT, - SYSZ_GRP_GUARDEDSTORAGE, - SYSZ_GRP_INSERTREFERENCEBITSMULTIPLE, - SYSZ_GRP_LOADANDTRAP, - SYSZ_GRP_LOADANDZERORIGHTMOSTBYTE, - SYSZ_GRP_LOADSTOREONCOND2, - SYSZ_GRP_MESSAGESECURITYASSIST3, - SYSZ_GRP_MESSAGESECURITYASSIST4, - SYSZ_GRP_MESSAGESECURITYASSIST5, - SYSZ_GRP_MESSAGESECURITYASSIST7, - SYSZ_GRP_MESSAGESECURITYASSIST8, - SYSZ_GRP_MISCELLANEOUSEXTENSIONS, - SYSZ_GRP_MISCELLANEOUSEXTENSIONS2, - SYSZ_GRP_NOVECTOR, - SYSZ_GRP_POPULATIONCOUNT, - SYSZ_GRP_PROCESSORASSIST, - SYSZ_GRP_RESETREFERENCEBITSMULTIPLE, - SYSZ_GRP_TRANSACTIONALEXECUTION, - SYSZ_GRP_VECTOR, - SYSZ_GRP_VECTORENHANCEMENTS1, - SYSZ_GRP_VECTORPACKEDDECIMAL, - - SYSZ_GRP_ENDING, // <-- mark the end of the list of groups -} sysz_insn_group; - -#ifdef __cplusplus -} -#endif - -#endif -#ifndef CAPSTONE_X86_H -#define CAPSTONE_X86_H - -/* Capstone Disassembly Engine */ -/* By Nguyen Anh Quynh , 2013-2015 */ - -#ifdef __cplusplus -extern "C" { -#endif - - -/// Calculate relative address for X86-64, given cs_insn structure -#define X86_REL_ADDR(insn) (((insn).detail->x86.operands[0].type == X86_OP_IMM) \ - ? (uint64_t)((insn).detail->x86.operands[0].imm) \ - : (((insn).address + (insn).size) + (uint64_t)(insn).detail->x86.disp)) - -/// X86 registers -typedef enum x86_reg { - X86_REG_INVALID = 0, - X86_REG_AH, X86_REG_AL, X86_REG_AX, X86_REG_BH, X86_REG_BL, - X86_REG_BP, X86_REG_BPL, X86_REG_BX, X86_REG_CH, X86_REG_CL, - X86_REG_CS, X86_REG_CX, X86_REG_DH, X86_REG_DI, X86_REG_DIL, - X86_REG_DL, X86_REG_DS, X86_REG_DX, X86_REG_EAX, X86_REG_EBP, - X86_REG_EBX, X86_REG_ECX, X86_REG_EDI, X86_REG_EDX, X86_REG_EFLAGS, - X86_REG_EIP, X86_REG_EIZ, X86_REG_ES, X86_REG_ESI, X86_REG_ESP, - X86_REG_FPSW, X86_REG_FS, X86_REG_GS, X86_REG_IP, X86_REG_RAX, - X86_REG_RBP, X86_REG_RBX, X86_REG_RCX, X86_REG_RDI, X86_REG_RDX, - X86_REG_RIP, X86_REG_RIZ, X86_REG_RSI, X86_REG_RSP, X86_REG_SI, - X86_REG_SIL, X86_REG_SP, X86_REG_SPL, X86_REG_SS, X86_REG_CR0, - X86_REG_CR1, X86_REG_CR2, X86_REG_CR3, X86_REG_CR4, X86_REG_CR5, - X86_REG_CR6, X86_REG_CR7, X86_REG_CR8, X86_REG_CR9, X86_REG_CR10, - X86_REG_CR11, X86_REG_CR12, X86_REG_CR13, X86_REG_CR14, X86_REG_CR15, - X86_REG_DR0, X86_REG_DR1, X86_REG_DR2, X86_REG_DR3, X86_REG_DR4, - X86_REG_DR5, X86_REG_DR6, X86_REG_DR7, X86_REG_DR8, X86_REG_DR9, - X86_REG_DR10, X86_REG_DR11, X86_REG_DR12, X86_REG_DR13, X86_REG_DR14, - X86_REG_DR15, X86_REG_FP0, X86_REG_FP1, X86_REG_FP2, X86_REG_FP3, - X86_REG_FP4, X86_REG_FP5, X86_REG_FP6, X86_REG_FP7, - X86_REG_K0, X86_REG_K1, X86_REG_K2, X86_REG_K3, X86_REG_K4, - X86_REG_K5, X86_REG_K6, X86_REG_K7, X86_REG_MM0, X86_REG_MM1, - X86_REG_MM2, X86_REG_MM3, X86_REG_MM4, X86_REG_MM5, X86_REG_MM6, - X86_REG_MM7, X86_REG_R8, X86_REG_R9, X86_REG_R10, X86_REG_R11, - X86_REG_R12, X86_REG_R13, X86_REG_R14, X86_REG_R15, - X86_REG_ST0, X86_REG_ST1, X86_REG_ST2, X86_REG_ST3, - X86_REG_ST4, X86_REG_ST5, X86_REG_ST6, X86_REG_ST7, - X86_REG_XMM0, X86_REG_XMM1, X86_REG_XMM2, X86_REG_XMM3, X86_REG_XMM4, - X86_REG_XMM5, X86_REG_XMM6, X86_REG_XMM7, X86_REG_XMM8, X86_REG_XMM9, - X86_REG_XMM10, X86_REG_XMM11, X86_REG_XMM12, X86_REG_XMM13, X86_REG_XMM14, - X86_REG_XMM15, X86_REG_XMM16, X86_REG_XMM17, X86_REG_XMM18, X86_REG_XMM19, - X86_REG_XMM20, X86_REG_XMM21, X86_REG_XMM22, X86_REG_XMM23, X86_REG_XMM24, - X86_REG_XMM25, X86_REG_XMM26, X86_REG_XMM27, X86_REG_XMM28, X86_REG_XMM29, - X86_REG_XMM30, X86_REG_XMM31, X86_REG_YMM0, X86_REG_YMM1, X86_REG_YMM2, - X86_REG_YMM3, X86_REG_YMM4, X86_REG_YMM5, X86_REG_YMM6, X86_REG_YMM7, - X86_REG_YMM8, X86_REG_YMM9, X86_REG_YMM10, X86_REG_YMM11, X86_REG_YMM12, - X86_REG_YMM13, X86_REG_YMM14, X86_REG_YMM15, X86_REG_YMM16, X86_REG_YMM17, - X86_REG_YMM18, X86_REG_YMM19, X86_REG_YMM20, X86_REG_YMM21, X86_REG_YMM22, - X86_REG_YMM23, X86_REG_YMM24, X86_REG_YMM25, X86_REG_YMM26, X86_REG_YMM27, - X86_REG_YMM28, X86_REG_YMM29, X86_REG_YMM30, X86_REG_YMM31, X86_REG_ZMM0, - X86_REG_ZMM1, X86_REG_ZMM2, X86_REG_ZMM3, X86_REG_ZMM4, X86_REG_ZMM5, - X86_REG_ZMM6, X86_REG_ZMM7, X86_REG_ZMM8, X86_REG_ZMM9, X86_REG_ZMM10, - X86_REG_ZMM11, X86_REG_ZMM12, X86_REG_ZMM13, X86_REG_ZMM14, X86_REG_ZMM15, - X86_REG_ZMM16, X86_REG_ZMM17, X86_REG_ZMM18, X86_REG_ZMM19, X86_REG_ZMM20, - X86_REG_ZMM21, X86_REG_ZMM22, X86_REG_ZMM23, X86_REG_ZMM24, X86_REG_ZMM25, - X86_REG_ZMM26, X86_REG_ZMM27, X86_REG_ZMM28, X86_REG_ZMM29, X86_REG_ZMM30, - X86_REG_ZMM31, X86_REG_R8B, X86_REG_R9B, X86_REG_R10B, X86_REG_R11B, - X86_REG_R12B, X86_REG_R13B, X86_REG_R14B, X86_REG_R15B, X86_REG_R8D, - X86_REG_R9D, X86_REG_R10D, X86_REG_R11D, X86_REG_R12D, X86_REG_R13D, - X86_REG_R14D, X86_REG_R15D, X86_REG_R8W, X86_REG_R9W, X86_REG_R10W, - X86_REG_R11W, X86_REG_R12W, X86_REG_R13W, X86_REG_R14W, X86_REG_R15W, - X86_REG_BND0, X86_REG_BND1, X86_REG_BND2, X86_REG_BND3, - - X86_REG_ENDING // <-- mark the end of the list of registers -} x86_reg; - -// Sub-flags of EFLAGS -#define X86_EFLAGS_MODIFY_AF (1ULL << 0) -#define X86_EFLAGS_MODIFY_CF (1ULL << 1) -#define X86_EFLAGS_MODIFY_SF (1ULL << 2) -#define X86_EFLAGS_MODIFY_ZF (1ULL << 3) -#define X86_EFLAGS_MODIFY_PF (1ULL << 4) -#define X86_EFLAGS_MODIFY_OF (1ULL << 5) -#define X86_EFLAGS_MODIFY_TF (1ULL << 6) -#define X86_EFLAGS_MODIFY_IF (1ULL << 7) -#define X86_EFLAGS_MODIFY_DF (1ULL << 8) -#define X86_EFLAGS_MODIFY_NT (1ULL << 9) -#define X86_EFLAGS_MODIFY_RF (1ULL << 10) -#define X86_EFLAGS_PRIOR_OF (1ULL << 11) -#define X86_EFLAGS_PRIOR_SF (1ULL << 12) -#define X86_EFLAGS_PRIOR_ZF (1ULL << 13) -#define X86_EFLAGS_PRIOR_AF (1ULL << 14) -#define X86_EFLAGS_PRIOR_PF (1ULL << 15) -#define X86_EFLAGS_PRIOR_CF (1ULL << 16) -#define X86_EFLAGS_PRIOR_TF (1ULL << 17) -#define X86_EFLAGS_PRIOR_IF (1ULL << 18) -#define X86_EFLAGS_PRIOR_DF (1ULL << 19) -#define X86_EFLAGS_PRIOR_NT (1ULL << 20) -#define X86_EFLAGS_RESET_OF (1ULL << 21) -#define X86_EFLAGS_RESET_CF (1ULL << 22) -#define X86_EFLAGS_RESET_DF (1ULL << 23) -#define X86_EFLAGS_RESET_IF (1ULL << 24) -#define X86_EFLAGS_RESET_SF (1ULL << 25) -#define X86_EFLAGS_RESET_AF (1ULL << 26) -#define X86_EFLAGS_RESET_TF (1ULL << 27) -#define X86_EFLAGS_RESET_NT (1ULL << 28) -#define X86_EFLAGS_RESET_PF (1ULL << 29) -#define X86_EFLAGS_SET_CF (1ULL << 30) -#define X86_EFLAGS_SET_DF (1ULL << 31) -#define X86_EFLAGS_SET_IF (1ULL << 32) -#define X86_EFLAGS_TEST_OF (1ULL << 33) -#define X86_EFLAGS_TEST_SF (1ULL << 34) -#define X86_EFLAGS_TEST_ZF (1ULL << 35) -#define X86_EFLAGS_TEST_PF (1ULL << 36) -#define X86_EFLAGS_TEST_CF (1ULL << 37) -#define X86_EFLAGS_TEST_NT (1ULL << 38) -#define X86_EFLAGS_TEST_DF (1ULL << 39) -#define X86_EFLAGS_UNDEFINED_OF (1ULL << 40) -#define X86_EFLAGS_UNDEFINED_SF (1ULL << 41) -#define X86_EFLAGS_UNDEFINED_ZF (1ULL << 42) -#define X86_EFLAGS_UNDEFINED_PF (1ULL << 43) -#define X86_EFLAGS_UNDEFINED_AF (1ULL << 44) -#define X86_EFLAGS_UNDEFINED_CF (1ULL << 45) -#define X86_EFLAGS_RESET_RF (1ULL << 46) -#define X86_EFLAGS_TEST_RF (1ULL << 47) -#define X86_EFLAGS_TEST_IF (1ULL << 48) -#define X86_EFLAGS_TEST_TF (1ULL << 49) -#define X86_EFLAGS_TEST_AF (1ULL << 50) -#define X86_EFLAGS_RESET_ZF (1ULL << 51) -#define X86_EFLAGS_SET_OF (1ULL << 52) -#define X86_EFLAGS_SET_SF (1ULL << 53) -#define X86_EFLAGS_SET_ZF (1ULL << 54) -#define X86_EFLAGS_SET_AF (1ULL << 55) -#define X86_EFLAGS_SET_PF (1ULL << 56) -#define X86_EFLAGS_RESET_0F (1ULL << 57) -#define X86_EFLAGS_RESET_AC (1ULL << 58) - -#define X86_FPU_FLAGS_MODIFY_C0 (1ULL << 0) -#define X86_FPU_FLAGS_MODIFY_C1 (1ULL << 1) -#define X86_FPU_FLAGS_MODIFY_C2 (1ULL << 2) -#define X86_FPU_FLAGS_MODIFY_C3 (1ULL << 3) -#define X86_FPU_FLAGS_RESET_C0 (1ULL << 4) -#define X86_FPU_FLAGS_RESET_C1 (1ULL << 5) -#define X86_FPU_FLAGS_RESET_C2 (1ULL << 6) -#define X86_FPU_FLAGS_RESET_C3 (1ULL << 7) -#define X86_FPU_FLAGS_SET_C0 (1ULL << 8) -#define X86_FPU_FLAGS_SET_C1 (1ULL << 9) -#define X86_FPU_FLAGS_SET_C2 (1ULL << 10) -#define X86_FPU_FLAGS_SET_C3 (1ULL << 11) -#define X86_FPU_FLAGS_UNDEFINED_C0 (1ULL << 12) -#define X86_FPU_FLAGS_UNDEFINED_C1 (1ULL << 13) -#define X86_FPU_FLAGS_UNDEFINED_C2 (1ULL << 14) -#define X86_FPU_FLAGS_UNDEFINED_C3 (1ULL << 15) -#define X86_FPU_FLAGS_TEST_C0 (1ULL << 16) -#define X86_FPU_FLAGS_TEST_C1 (1ULL << 17) -#define X86_FPU_FLAGS_TEST_C2 (1ULL << 18) -#define X86_FPU_FLAGS_TEST_C3 (1ULL << 19) - - -/// Operand type for instruction's operands -typedef enum x86_op_type { - X86_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - X86_OP_REG, ///< = CS_OP_REG (Register operand). - X86_OP_IMM, ///< = CS_OP_IMM (Immediate operand). - X86_OP_MEM, ///< = CS_OP_MEM (Memory operand). -} x86_op_type; - -/// XOP Code Condition type -typedef enum x86_xop_cc { - X86_XOP_CC_INVALID = 0, ///< Uninitialized. - X86_XOP_CC_LT, - X86_XOP_CC_LE, - X86_XOP_CC_GT, - X86_XOP_CC_GE, - X86_XOP_CC_EQ, - X86_XOP_CC_NEQ, - X86_XOP_CC_FALSE, - X86_XOP_CC_TRUE, -} x86_xop_cc; - -/// AVX broadcast type -typedef enum x86_avx_bcast { - X86_AVX_BCAST_INVALID = 0, ///< Uninitialized. - X86_AVX_BCAST_2, ///< AVX512 broadcast type {1to2} - X86_AVX_BCAST_4, ///< AVX512 broadcast type {1to4} - X86_AVX_BCAST_8, ///< AVX512 broadcast type {1to8} - X86_AVX_BCAST_16, ///< AVX512 broadcast type {1to16} -} x86_avx_bcast; - -/// SSE Code Condition type -typedef enum x86_sse_cc { - X86_SSE_CC_INVALID = 0, ///< Uninitialized. - X86_SSE_CC_EQ, - X86_SSE_CC_LT, - X86_SSE_CC_LE, - X86_SSE_CC_UNORD, - X86_SSE_CC_NEQ, - X86_SSE_CC_NLT, - X86_SSE_CC_NLE, - X86_SSE_CC_ORD, -} x86_sse_cc; - -/// AVX Code Condition type -typedef enum x86_avx_cc { - X86_AVX_CC_INVALID = 0, ///< Uninitialized. - X86_AVX_CC_EQ, - X86_AVX_CC_LT, - X86_AVX_CC_LE, - X86_AVX_CC_UNORD, - X86_AVX_CC_NEQ, - X86_AVX_CC_NLT, - X86_AVX_CC_NLE, - X86_AVX_CC_ORD, - X86_AVX_CC_EQ_UQ, - X86_AVX_CC_NGE, - X86_AVX_CC_NGT, - X86_AVX_CC_FALSE, - X86_AVX_CC_NEQ_OQ, - X86_AVX_CC_GE, - X86_AVX_CC_GT, - X86_AVX_CC_TRUE, - X86_AVX_CC_EQ_OS, - X86_AVX_CC_LT_OQ, - X86_AVX_CC_LE_OQ, - X86_AVX_CC_UNORD_S, - X86_AVX_CC_NEQ_US, - X86_AVX_CC_NLT_UQ, - X86_AVX_CC_NLE_UQ, - X86_AVX_CC_ORD_S, - X86_AVX_CC_EQ_US, - X86_AVX_CC_NGE_UQ, - X86_AVX_CC_NGT_UQ, - X86_AVX_CC_FALSE_OS, - X86_AVX_CC_NEQ_OS, - X86_AVX_CC_GE_OQ, - X86_AVX_CC_GT_OQ, - X86_AVX_CC_TRUE_US, -} x86_avx_cc; - -/// AVX static rounding mode type -typedef enum x86_avx_rm { - X86_AVX_RM_INVALID = 0, ///< Uninitialized. - X86_AVX_RM_RN, ///< Round to nearest - X86_AVX_RM_RD, ///< Round down - X86_AVX_RM_RU, ///< Round up - X86_AVX_RM_RZ, ///< Round toward zero -} x86_avx_rm; - -/// Instruction prefixes - to be used in cs_x86.prefix[] -typedef enum x86_prefix { - X86_PREFIX_LOCK = 0xf0, ///< lock (cs_x86.prefix[0] - X86_PREFIX_REP = 0xf3, ///< rep (cs_x86.prefix[0] - X86_PREFIX_REPE = 0xf3, ///< repe/repz (cs_x86.prefix[0] - X86_PREFIX_REPNE = 0xf2, ///< repne/repnz (cs_x86.prefix[0] - - X86_PREFIX_CS = 0x2e, ///< segment override CS (cs_x86.prefix[1] - X86_PREFIX_SS = 0x36, ///< segment override SS (cs_x86.prefix[1] - X86_PREFIX_DS = 0x3e, ///< segment override DS (cs_x86.prefix[1] - X86_PREFIX_ES = 0x26, ///< segment override ES (cs_x86.prefix[1] - X86_PREFIX_FS = 0x64, ///< segment override FS (cs_x86.prefix[1] - X86_PREFIX_GS = 0x65, ///< segment override GS (cs_x86.prefix[1] - - X86_PREFIX_OPSIZE = 0x66, ///< operand-size override (cs_x86.prefix[2] - X86_PREFIX_ADDRSIZE = 0x67, ///< address-size override (cs_x86.prefix[3] -} x86_prefix; - -/// Instruction's operand referring to memory -/// This is associated with X86_OP_MEM operand type above -typedef struct x86_op_mem { - x86_reg segment; ///< segment register (or X86_REG_INVALID if irrelevant) - x86_reg base; ///< base register (or X86_REG_INVALID if irrelevant) - x86_reg index; ///< index register (or X86_REG_INVALID if irrelevant) - int scale; ///< scale for index register - int64_t disp; ///< displacement value -} x86_op_mem; - -/// Instruction operand -typedef struct cs_x86_op { - x86_op_type type; ///< operand type - union { - x86_reg reg; ///< register value for REG operand - int64_t imm; ///< immediate value for IMM operand - x86_op_mem mem; ///< base/index/scale/disp value for MEM operand - }; - - /// size of this operand (in bytes). - uint8_t size; - - /// How is this operand accessed? (READ, WRITE or READ|WRITE) - /// This field is combined of cs_ac_type. - /// NOTE: this field is irrelevant if engine is compiled in DIET mode. - uint8_t access; - - /// AVX broadcast type, or 0 if irrelevant - x86_avx_bcast avx_bcast; - - /// AVX zero opmask {z} - bool avx_zero_opmask; -} cs_x86_op; - -typedef struct cs_x86_encoding { - /// ModR/M offset, or 0 when irrelevant - uint8_t modrm_offset; - - /// Displacement offset, or 0 when irrelevant. - uint8_t disp_offset; - uint8_t disp_size; - - /// Immediate offset, or 0 when irrelevant. - uint8_t imm_offset; - uint8_t imm_size; -} cs_x86_encoding; - -/// Instruction structure -typedef struct cs_x86 { - /// Instruction prefix, which can be up to 4 bytes. - /// A prefix byte gets value 0 when irrelevant. - /// prefix[0] indicates REP/REPNE/LOCK prefix (See X86_PREFIX_REP/REPNE/LOCK above) - /// prefix[1] indicates segment override (irrelevant for x86_64): - /// See X86_PREFIX_CS/SS/DS/ES/FS/GS above. - /// prefix[2] indicates operand-size override (X86_PREFIX_OPSIZE) - /// prefix[3] indicates address-size override (X86_PREFIX_ADDRSIZE) - uint8_t prefix[4]; - - /// Instruction opcode, which can be from 1 to 4 bytes in size. - /// This contains VEX opcode as well. - /// An trailing opcode byte gets value 0 when irrelevant. - uint8_t opcode[4]; - - /// REX prefix: only a non-zero value is relevant for x86_64 - uint8_t rex; - - /// Address size, which can be overridden with above prefix[5]. - uint8_t addr_size; - - /// ModR/M byte - uint8_t modrm; - - /// SIB value, or 0 when irrelevant. - uint8_t sib; - - /// Displacement value, valid if encoding.disp_offset != 0 - int64_t disp; - - /// SIB index register, or X86_REG_INVALID when irrelevant. - x86_reg sib_index; - /// SIB scale, only applicable if sib_index is valid. - int8_t sib_scale; - /// SIB base register, or X86_REG_INVALID when irrelevant. - x86_reg sib_base; - - /// XOP Code Condition - x86_xop_cc xop_cc; - - /// SSE Code Condition - x86_sse_cc sse_cc; - - /// AVX Code Condition - x86_avx_cc avx_cc; - - /// AVX Suppress all Exception - bool avx_sae; - - /// AVX static rounding mode - x86_avx_rm avx_rm; - - - union { - /// EFLAGS updated by this instruction. - /// This can be formed from OR combination of X86_EFLAGS_* symbols in x86.h - uint64_t eflags; - /// FPU_FLAGS updated by this instruction. - /// This can be formed from OR combination of X86_FPU_FLAGS_* symbols in x86.h - uint64_t fpu_flags; - }; - - /// Number of operands of this instruction, - /// or 0 when instruction has no operand. - uint8_t op_count; - - cs_x86_op operands[8]; ///< operands for this instruction. - - cs_x86_encoding encoding; ///< encoding information -} cs_x86; - -/// X86 instructions -typedef enum x86_insn { - X86_INS_INVALID = 0, - - X86_INS_AAA, - X86_INS_AAD, - X86_INS_AAM, - X86_INS_AAS, - X86_INS_FABS, - X86_INS_ADC, - X86_INS_ADCX, - X86_INS_ADD, - X86_INS_ADDPD, - X86_INS_ADDPS, - X86_INS_ADDSD, - X86_INS_ADDSS, - X86_INS_ADDSUBPD, - X86_INS_ADDSUBPS, - X86_INS_FADD, - X86_INS_FIADD, - X86_INS_ADOX, - X86_INS_AESDECLAST, - X86_INS_AESDEC, - X86_INS_AESENCLAST, - X86_INS_AESENC, - X86_INS_AESIMC, - X86_INS_AESKEYGENASSIST, - X86_INS_AND, - X86_INS_ANDN, - X86_INS_ANDNPD, - X86_INS_ANDNPS, - X86_INS_ANDPD, - X86_INS_ANDPS, - X86_INS_ARPL, - X86_INS_BEXTR, - X86_INS_BLCFILL, - X86_INS_BLCI, - X86_INS_BLCIC, - X86_INS_BLCMSK, - X86_INS_BLCS, - X86_INS_BLENDPD, - X86_INS_BLENDPS, - X86_INS_BLENDVPD, - X86_INS_BLENDVPS, - X86_INS_BLSFILL, - X86_INS_BLSI, - X86_INS_BLSIC, - X86_INS_BLSMSK, - X86_INS_BLSR, - X86_INS_BNDCL, - X86_INS_BNDCN, - X86_INS_BNDCU, - X86_INS_BNDLDX, - X86_INS_BNDMK, - X86_INS_BNDMOV, - X86_INS_BNDSTX, - X86_INS_BOUND, - X86_INS_BSF, - X86_INS_BSR, - X86_INS_BSWAP, - X86_INS_BT, - X86_INS_BTC, - X86_INS_BTR, - X86_INS_BTS, - X86_INS_BZHI, - X86_INS_CALL, - X86_INS_CBW, - X86_INS_CDQ, - X86_INS_CDQE, - X86_INS_FCHS, - X86_INS_CLAC, - X86_INS_CLC, - X86_INS_CLD, - X86_INS_CLDEMOTE, - X86_INS_CLFLUSH, - X86_INS_CLFLUSHOPT, - X86_INS_CLGI, - X86_INS_CLI, - X86_INS_CLRSSBSY, - X86_INS_CLTS, - X86_INS_CLWB, - X86_INS_CLZERO, - X86_INS_CMC, - X86_INS_CMOVA, - X86_INS_CMOVAE, - X86_INS_CMOVB, - X86_INS_CMOVBE, - X86_INS_FCMOVBE, - X86_INS_FCMOVB, - X86_INS_CMOVE, - X86_INS_FCMOVE, - X86_INS_CMOVG, - X86_INS_CMOVGE, - X86_INS_CMOVL, - X86_INS_CMOVLE, - X86_INS_FCMOVNBE, - X86_INS_FCMOVNB, - X86_INS_CMOVNE, - X86_INS_FCMOVNE, - X86_INS_CMOVNO, - X86_INS_CMOVNP, - X86_INS_FCMOVNU, - X86_INS_FCMOVNP, - X86_INS_CMOVNS, - X86_INS_CMOVO, - X86_INS_CMOVP, - X86_INS_FCMOVU, - X86_INS_CMOVS, - X86_INS_CMP, - X86_INS_CMPPD, - X86_INS_CMPPS, - X86_INS_CMPSB, - X86_INS_CMPSD, - X86_INS_CMPSQ, - X86_INS_CMPSS, - X86_INS_CMPSW, - X86_INS_CMPXCHG16B, - X86_INS_CMPXCHG, - X86_INS_CMPXCHG8B, - X86_INS_COMISD, - X86_INS_COMISS, - X86_INS_FCOMP, - X86_INS_FCOMPI, - X86_INS_FCOMI, - X86_INS_FCOM, - X86_INS_FCOS, - X86_INS_CPUID, - X86_INS_CQO, - X86_INS_CRC32, - X86_INS_CVTDQ2PD, - X86_INS_CVTDQ2PS, - X86_INS_CVTPD2DQ, - X86_INS_CVTPD2PS, - X86_INS_CVTPS2DQ, - X86_INS_CVTPS2PD, - X86_INS_CVTSD2SI, - X86_INS_CVTSD2SS, - X86_INS_CVTSI2SD, - X86_INS_CVTSI2SS, - X86_INS_CVTSS2SD, - X86_INS_CVTSS2SI, - X86_INS_CVTTPD2DQ, - X86_INS_CVTTPS2DQ, - X86_INS_CVTTSD2SI, - X86_INS_CVTTSS2SI, - X86_INS_CWD, - X86_INS_CWDE, - X86_INS_DAA, - X86_INS_DAS, - X86_INS_DATA16, - X86_INS_DEC, - X86_INS_DIV, - X86_INS_DIVPD, - X86_INS_DIVPS, - X86_INS_FDIVR, - X86_INS_FIDIVR, - X86_INS_FDIVRP, - X86_INS_DIVSD, - X86_INS_DIVSS, - X86_INS_FDIV, - X86_INS_FIDIV, - X86_INS_FDIVP, - X86_INS_DPPD, - X86_INS_DPPS, - X86_INS_ENCLS, - X86_INS_ENCLU, - X86_INS_ENCLV, - X86_INS_ENDBR32, - X86_INS_ENDBR64, - X86_INS_ENTER, - X86_INS_EXTRACTPS, - X86_INS_EXTRQ, - X86_INS_F2XM1, - X86_INS_LCALL, - X86_INS_LJMP, - X86_INS_JMP, - X86_INS_FBLD, - X86_INS_FBSTP, - X86_INS_FCOMPP, - X86_INS_FDECSTP, - X86_INS_FDISI8087_NOP, - X86_INS_FEMMS, - X86_INS_FENI8087_NOP, - X86_INS_FFREE, - X86_INS_FFREEP, - X86_INS_FICOM, - X86_INS_FICOMP, - X86_INS_FINCSTP, - X86_INS_FLDCW, - X86_INS_FLDENV, - X86_INS_FLDL2E, - X86_INS_FLDL2T, - X86_INS_FLDLG2, - X86_INS_FLDLN2, - X86_INS_FLDPI, - X86_INS_FNCLEX, - X86_INS_FNINIT, - X86_INS_FNOP, - X86_INS_FNSTCW, - X86_INS_FNSTSW, - X86_INS_FPATAN, - X86_INS_FSTPNCE, - X86_INS_FPREM, - X86_INS_FPREM1, - X86_INS_FPTAN, - X86_INS_FRNDINT, - X86_INS_FRSTOR, - X86_INS_FNSAVE, - X86_INS_FSCALE, - X86_INS_FSETPM, - X86_INS_FSINCOS, - X86_INS_FNSTENV, - X86_INS_FXAM, - X86_INS_FXRSTOR, - X86_INS_FXRSTOR64, - X86_INS_FXSAVE, - X86_INS_FXSAVE64, - X86_INS_FXTRACT, - X86_INS_FYL2X, - X86_INS_FYL2XP1, - X86_INS_GETSEC, - X86_INS_GF2P8AFFINEINVQB, - X86_INS_GF2P8AFFINEQB, - X86_INS_GF2P8MULB, - X86_INS_HADDPD, - X86_INS_HADDPS, - X86_INS_HLT, - X86_INS_HSUBPD, - X86_INS_HSUBPS, - X86_INS_IDIV, - X86_INS_FILD, - X86_INS_IMUL, - X86_INS_IN, - X86_INS_INC, - X86_INS_INCSSPD, - X86_INS_INCSSPQ, - X86_INS_INSB, - X86_INS_INSERTPS, - X86_INS_INSERTQ, - X86_INS_INSD, - X86_INS_INSW, - X86_INS_INT, - X86_INS_INT1, - X86_INS_INT3, - X86_INS_INTO, - X86_INS_INVD, - X86_INS_INVEPT, - X86_INS_INVLPG, - X86_INS_INVLPGA, - X86_INS_INVPCID, - X86_INS_INVVPID, - X86_INS_IRET, - X86_INS_IRETD, - X86_INS_IRETQ, - X86_INS_FISTTP, - X86_INS_FIST, - X86_INS_FISTP, - X86_INS_JAE, - X86_INS_JA, - X86_INS_JBE, - X86_INS_JB, - X86_INS_JCXZ, - X86_INS_JECXZ, - X86_INS_JE, - X86_INS_JGE, - X86_INS_JG, - X86_INS_JLE, - X86_INS_JL, - X86_INS_JNE, - X86_INS_JNO, - X86_INS_JNP, - X86_INS_JNS, - X86_INS_JO, - X86_INS_JP, - X86_INS_JRCXZ, - X86_INS_JS, - X86_INS_KADDB, - X86_INS_KADDD, - X86_INS_KADDQ, - X86_INS_KADDW, - X86_INS_KANDB, - X86_INS_KANDD, - X86_INS_KANDNB, - X86_INS_KANDND, - X86_INS_KANDNQ, - X86_INS_KANDNW, - X86_INS_KANDQ, - X86_INS_KANDW, - X86_INS_KMOVB, - X86_INS_KMOVD, - X86_INS_KMOVQ, - X86_INS_KMOVW, - X86_INS_KNOTB, - X86_INS_KNOTD, - X86_INS_KNOTQ, - X86_INS_KNOTW, - X86_INS_KORB, - X86_INS_KORD, - X86_INS_KORQ, - X86_INS_KORTESTB, - X86_INS_KORTESTD, - X86_INS_KORTESTQ, - X86_INS_KORTESTW, - X86_INS_KORW, - X86_INS_KSHIFTLB, - X86_INS_KSHIFTLD, - X86_INS_KSHIFTLQ, - X86_INS_KSHIFTLW, - X86_INS_KSHIFTRB, - X86_INS_KSHIFTRD, - X86_INS_KSHIFTRQ, - X86_INS_KSHIFTRW, - X86_INS_KTESTB, - X86_INS_KTESTD, - X86_INS_KTESTQ, - X86_INS_KTESTW, - X86_INS_KUNPCKBW, - X86_INS_KUNPCKDQ, - X86_INS_KUNPCKWD, - X86_INS_KXNORB, - X86_INS_KXNORD, - X86_INS_KXNORQ, - X86_INS_KXNORW, - X86_INS_KXORB, - X86_INS_KXORD, - X86_INS_KXORQ, - X86_INS_KXORW, - X86_INS_LAHF, - X86_INS_LAR, - X86_INS_LDDQU, - X86_INS_LDMXCSR, - X86_INS_LDS, - X86_INS_FLDZ, - X86_INS_FLD1, - X86_INS_FLD, - X86_INS_LEA, - X86_INS_LEAVE, - X86_INS_LES, - X86_INS_LFENCE, - X86_INS_LFS, - X86_INS_LGDT, - X86_INS_LGS, - X86_INS_LIDT, - X86_INS_LLDT, - X86_INS_LLWPCB, - X86_INS_LMSW, - X86_INS_LOCK, - X86_INS_LODSB, - X86_INS_LODSD, - X86_INS_LODSQ, - X86_INS_LODSW, - X86_INS_LOOP, - X86_INS_LOOPE, - X86_INS_LOOPNE, - X86_INS_RETF, - X86_INS_RETFQ, - X86_INS_LSL, - X86_INS_LSS, - X86_INS_LTR, - X86_INS_LWPINS, - X86_INS_LWPVAL, - X86_INS_LZCNT, - X86_INS_MASKMOVDQU, - X86_INS_MAXPD, - X86_INS_MAXPS, - X86_INS_MAXSD, - X86_INS_MAXSS, - X86_INS_MFENCE, - X86_INS_MINPD, - X86_INS_MINPS, - X86_INS_MINSD, - X86_INS_MINSS, - X86_INS_CVTPD2PI, - X86_INS_CVTPI2PD, - X86_INS_CVTPI2PS, - X86_INS_CVTPS2PI, - X86_INS_CVTTPD2PI, - X86_INS_CVTTPS2PI, - X86_INS_EMMS, - X86_INS_MASKMOVQ, - X86_INS_MOVD, - X86_INS_MOVQ, - X86_INS_MOVDQ2Q, - X86_INS_MOVNTQ, - X86_INS_MOVQ2DQ, - X86_INS_PABSB, - X86_INS_PABSD, - X86_INS_PABSW, - X86_INS_PACKSSDW, - X86_INS_PACKSSWB, - X86_INS_PACKUSWB, - X86_INS_PADDB, - X86_INS_PADDD, - X86_INS_PADDQ, - X86_INS_PADDSB, - X86_INS_PADDSW, - X86_INS_PADDUSB, - X86_INS_PADDUSW, - X86_INS_PADDW, - X86_INS_PALIGNR, - X86_INS_PANDN, - X86_INS_PAND, - X86_INS_PAVGB, - X86_INS_PAVGW, - X86_INS_PCMPEQB, - X86_INS_PCMPEQD, - X86_INS_PCMPEQW, - X86_INS_PCMPGTB, - X86_INS_PCMPGTD, - X86_INS_PCMPGTW, - X86_INS_PEXTRW, - X86_INS_PHADDD, - X86_INS_PHADDSW, - X86_INS_PHADDW, - X86_INS_PHSUBD, - X86_INS_PHSUBSW, - X86_INS_PHSUBW, - X86_INS_PINSRW, - X86_INS_PMADDUBSW, - X86_INS_PMADDWD, - X86_INS_PMAXSW, - X86_INS_PMAXUB, - X86_INS_PMINSW, - X86_INS_PMINUB, - X86_INS_PMOVMSKB, - X86_INS_PMULHRSW, - X86_INS_PMULHUW, - X86_INS_PMULHW, - X86_INS_PMULLW, - X86_INS_PMULUDQ, - X86_INS_POR, - X86_INS_PSADBW, - X86_INS_PSHUFB, - X86_INS_PSHUFW, - X86_INS_PSIGNB, - X86_INS_PSIGND, - X86_INS_PSIGNW, - X86_INS_PSLLD, - X86_INS_PSLLQ, - X86_INS_PSLLW, - X86_INS_PSRAD, - X86_INS_PSRAW, - X86_INS_PSRLD, - X86_INS_PSRLQ, - X86_INS_PSRLW, - X86_INS_PSUBB, - X86_INS_PSUBD, - X86_INS_PSUBQ, - X86_INS_PSUBSB, - X86_INS_PSUBSW, - X86_INS_PSUBUSB, - X86_INS_PSUBUSW, - X86_INS_PSUBW, - X86_INS_PUNPCKHBW, - X86_INS_PUNPCKHDQ, - X86_INS_PUNPCKHWD, - X86_INS_PUNPCKLBW, - X86_INS_PUNPCKLDQ, - X86_INS_PUNPCKLWD, - X86_INS_PXOR, - X86_INS_MONITORX, - X86_INS_MONITOR, - X86_INS_MONTMUL, - X86_INS_MOV, - X86_INS_MOVABS, - X86_INS_MOVAPD, - X86_INS_MOVAPS, - X86_INS_MOVBE, - X86_INS_MOVDDUP, - X86_INS_MOVDIR64B, - X86_INS_MOVDIRI, - X86_INS_MOVDQA, - X86_INS_MOVDQU, - X86_INS_MOVHLPS, - X86_INS_MOVHPD, - X86_INS_MOVHPS, - X86_INS_MOVLHPS, - X86_INS_MOVLPD, - X86_INS_MOVLPS, - X86_INS_MOVMSKPD, - X86_INS_MOVMSKPS, - X86_INS_MOVNTDQA, - X86_INS_MOVNTDQ, - X86_INS_MOVNTI, - X86_INS_MOVNTPD, - X86_INS_MOVNTPS, - X86_INS_MOVNTSD, - X86_INS_MOVNTSS, - X86_INS_MOVSB, - X86_INS_MOVSD, - X86_INS_MOVSHDUP, - X86_INS_MOVSLDUP, - X86_INS_MOVSQ, - X86_INS_MOVSS, - X86_INS_MOVSW, - X86_INS_MOVSX, - X86_INS_MOVSXD, - X86_INS_MOVUPD, - X86_INS_MOVUPS, - X86_INS_MOVZX, - X86_INS_MPSADBW, - X86_INS_MUL, - X86_INS_MULPD, - X86_INS_MULPS, - X86_INS_MULSD, - X86_INS_MULSS, - X86_INS_MULX, - X86_INS_FMUL, - X86_INS_FIMUL, - X86_INS_FMULP, - X86_INS_MWAITX, - X86_INS_MWAIT, - X86_INS_NEG, - X86_INS_NOP, - X86_INS_NOT, - X86_INS_OR, - X86_INS_ORPD, - X86_INS_ORPS, - X86_INS_OUT, - X86_INS_OUTSB, - X86_INS_OUTSD, - X86_INS_OUTSW, - X86_INS_PACKUSDW, - X86_INS_PAUSE, - X86_INS_PAVGUSB, - X86_INS_PBLENDVB, - X86_INS_PBLENDW, - X86_INS_PCLMULQDQ, - X86_INS_PCMPEQQ, - X86_INS_PCMPESTRI, - X86_INS_PCMPESTRM, - X86_INS_PCMPGTQ, - X86_INS_PCMPISTRI, - X86_INS_PCMPISTRM, - X86_INS_PCONFIG, - X86_INS_PDEP, - X86_INS_PEXT, - X86_INS_PEXTRB, - X86_INS_PEXTRD, - X86_INS_PEXTRQ, - X86_INS_PF2ID, - X86_INS_PF2IW, - X86_INS_PFACC, - X86_INS_PFADD, - X86_INS_PFCMPEQ, - X86_INS_PFCMPGE, - X86_INS_PFCMPGT, - X86_INS_PFMAX, - X86_INS_PFMIN, - X86_INS_PFMUL, - X86_INS_PFNACC, - X86_INS_PFPNACC, - X86_INS_PFRCPIT1, - X86_INS_PFRCPIT2, - X86_INS_PFRCP, - X86_INS_PFRSQIT1, - X86_INS_PFRSQRT, - X86_INS_PFSUBR, - X86_INS_PFSUB, - X86_INS_PHMINPOSUW, - X86_INS_PI2FD, - X86_INS_PI2FW, - X86_INS_PINSRB, - X86_INS_PINSRD, - X86_INS_PINSRQ, - X86_INS_PMAXSB, - X86_INS_PMAXSD, - X86_INS_PMAXUD, - X86_INS_PMAXUW, - X86_INS_PMINSB, - X86_INS_PMINSD, - X86_INS_PMINUD, - X86_INS_PMINUW, - X86_INS_PMOVSXBD, - X86_INS_PMOVSXBQ, - X86_INS_PMOVSXBW, - X86_INS_PMOVSXDQ, - X86_INS_PMOVSXWD, - X86_INS_PMOVSXWQ, - X86_INS_PMOVZXBD, - X86_INS_PMOVZXBQ, - X86_INS_PMOVZXBW, - X86_INS_PMOVZXDQ, - X86_INS_PMOVZXWD, - X86_INS_PMOVZXWQ, - X86_INS_PMULDQ, - X86_INS_PMULHRW, - X86_INS_PMULLD, - X86_INS_POP, - X86_INS_POPAW, - X86_INS_POPAL, - X86_INS_POPCNT, - X86_INS_POPF, - X86_INS_POPFD, - X86_INS_POPFQ, - X86_INS_PREFETCH, - X86_INS_PREFETCHNTA, - X86_INS_PREFETCHT0, - X86_INS_PREFETCHT1, - X86_INS_PREFETCHT2, - X86_INS_PREFETCHW, - X86_INS_PREFETCHWT1, - X86_INS_PSHUFD, - X86_INS_PSHUFHW, - X86_INS_PSHUFLW, - X86_INS_PSLLDQ, - X86_INS_PSRLDQ, - X86_INS_PSWAPD, - X86_INS_PTEST, - X86_INS_PTWRITE, - X86_INS_PUNPCKHQDQ, - X86_INS_PUNPCKLQDQ, - X86_INS_PUSH, - X86_INS_PUSHAW, - X86_INS_PUSHAL, - X86_INS_PUSHF, - X86_INS_PUSHFD, - X86_INS_PUSHFQ, - X86_INS_RCL, - X86_INS_RCPPS, - X86_INS_RCPSS, - X86_INS_RCR, - X86_INS_RDFSBASE, - X86_INS_RDGSBASE, - X86_INS_RDMSR, - X86_INS_RDPID, - X86_INS_RDPKRU, - X86_INS_RDPMC, - X86_INS_RDRAND, - X86_INS_RDSEED, - X86_INS_RDSSPD, - X86_INS_RDSSPQ, - X86_INS_RDTSC, - X86_INS_RDTSCP, - X86_INS_REPNE, - X86_INS_REP, - X86_INS_RET, - X86_INS_REX64, - X86_INS_ROL, - X86_INS_ROR, - X86_INS_RORX, - X86_INS_ROUNDPD, - X86_INS_ROUNDPS, - X86_INS_ROUNDSD, - X86_INS_ROUNDSS, - X86_INS_RSM, - X86_INS_RSQRTPS, - X86_INS_RSQRTSS, - X86_INS_RSTORSSP, - X86_INS_SAHF, - X86_INS_SAL, - X86_INS_SALC, - X86_INS_SAR, - X86_INS_SARX, - X86_INS_SAVEPREVSSP, - X86_INS_SBB, - X86_INS_SCASB, - X86_INS_SCASD, - X86_INS_SCASQ, - X86_INS_SCASW, - X86_INS_SETAE, - X86_INS_SETA, - X86_INS_SETBE, - X86_INS_SETB, - X86_INS_SETE, - X86_INS_SETGE, - X86_INS_SETG, - X86_INS_SETLE, - X86_INS_SETL, - X86_INS_SETNE, - X86_INS_SETNO, - X86_INS_SETNP, - X86_INS_SETNS, - X86_INS_SETO, - X86_INS_SETP, - X86_INS_SETSSBSY, - X86_INS_SETS, - X86_INS_SFENCE, - X86_INS_SGDT, - X86_INS_SHA1MSG1, - X86_INS_SHA1MSG2, - X86_INS_SHA1NEXTE, - X86_INS_SHA1RNDS4, - X86_INS_SHA256MSG1, - X86_INS_SHA256MSG2, - X86_INS_SHA256RNDS2, - X86_INS_SHL, - X86_INS_SHLD, - X86_INS_SHLX, - X86_INS_SHR, - X86_INS_SHRD, - X86_INS_SHRX, - X86_INS_SHUFPD, - X86_INS_SHUFPS, - X86_INS_SIDT, - X86_INS_FSIN, - X86_INS_SKINIT, - X86_INS_SLDT, - X86_INS_SLWPCB, - X86_INS_SMSW, - X86_INS_SQRTPD, - X86_INS_SQRTPS, - X86_INS_SQRTSD, - X86_INS_SQRTSS, - X86_INS_FSQRT, - X86_INS_STAC, - X86_INS_STC, - X86_INS_STD, - X86_INS_STGI, - X86_INS_STI, - X86_INS_STMXCSR, - X86_INS_STOSB, - X86_INS_STOSD, - X86_INS_STOSQ, - X86_INS_STOSW, - X86_INS_STR, - X86_INS_FST, - X86_INS_FSTP, - X86_INS_SUB, - X86_INS_SUBPD, - X86_INS_SUBPS, - X86_INS_FSUBR, - X86_INS_FISUBR, - X86_INS_FSUBRP, - X86_INS_SUBSD, - X86_INS_SUBSS, - X86_INS_FSUB, - X86_INS_FISUB, - X86_INS_FSUBP, - X86_INS_SWAPGS, - X86_INS_SYSCALL, - X86_INS_SYSENTER, - X86_INS_SYSEXIT, - X86_INS_SYSEXITQ, - X86_INS_SYSRET, - X86_INS_SYSRETQ, - X86_INS_T1MSKC, - X86_INS_TEST, - X86_INS_TPAUSE, - X86_INS_FTST, - X86_INS_TZCNT, - X86_INS_TZMSK, - X86_INS_UCOMISD, - X86_INS_UCOMISS, - X86_INS_FUCOMPI, - X86_INS_FUCOMI, - X86_INS_FUCOMPP, - X86_INS_FUCOMP, - X86_INS_FUCOM, - X86_INS_UD0, - X86_INS_UD1, - X86_INS_UD2, - X86_INS_UMONITOR, - X86_INS_UMWAIT, - X86_INS_UNPCKHPD, - X86_INS_UNPCKHPS, - X86_INS_UNPCKLPD, - X86_INS_UNPCKLPS, - X86_INS_V4FMADDPS, - X86_INS_V4FMADDSS, - X86_INS_V4FNMADDPS, - X86_INS_V4FNMADDSS, - X86_INS_VADDPD, - X86_INS_VADDPS, - X86_INS_VADDSD, - X86_INS_VADDSS, - X86_INS_VADDSUBPD, - X86_INS_VADDSUBPS, - X86_INS_VAESDECLAST, - X86_INS_VAESDEC, - X86_INS_VAESENCLAST, - X86_INS_VAESENC, - X86_INS_VAESIMC, - X86_INS_VAESKEYGENASSIST, - X86_INS_VALIGND, - X86_INS_VALIGNQ, - X86_INS_VANDNPD, - X86_INS_VANDNPS, - X86_INS_VANDPD, - X86_INS_VANDPS, - X86_INS_VBLENDMPD, - X86_INS_VBLENDMPS, - X86_INS_VBLENDPD, - X86_INS_VBLENDPS, - X86_INS_VBLENDVPD, - X86_INS_VBLENDVPS, - X86_INS_VBROADCASTF128, - X86_INS_VBROADCASTF32X2, - X86_INS_VBROADCASTF32X4, - X86_INS_VBROADCASTF32X8, - X86_INS_VBROADCASTF64X2, - X86_INS_VBROADCASTF64X4, - X86_INS_VBROADCASTI128, - X86_INS_VBROADCASTI32X2, - X86_INS_VBROADCASTI32X4, - X86_INS_VBROADCASTI32X8, - X86_INS_VBROADCASTI64X2, - X86_INS_VBROADCASTI64X4, - X86_INS_VBROADCASTSD, - X86_INS_VBROADCASTSS, - X86_INS_VCMP, - X86_INS_VCMPPD, - X86_INS_VCMPPS, - X86_INS_VCMPSD, - X86_INS_VCMPSS, - X86_INS_VCOMISD, - X86_INS_VCOMISS, - X86_INS_VCOMPRESSPD, - X86_INS_VCOMPRESSPS, - X86_INS_VCVTDQ2PD, - X86_INS_VCVTDQ2PS, - X86_INS_VCVTPD2DQ, - X86_INS_VCVTPD2PS, - X86_INS_VCVTPD2QQ, - X86_INS_VCVTPD2UDQ, - X86_INS_VCVTPD2UQQ, - X86_INS_VCVTPH2PS, - X86_INS_VCVTPS2DQ, - X86_INS_VCVTPS2PD, - X86_INS_VCVTPS2PH, - X86_INS_VCVTPS2QQ, - X86_INS_VCVTPS2UDQ, - X86_INS_VCVTPS2UQQ, - X86_INS_VCVTQQ2PD, - X86_INS_VCVTQQ2PS, - X86_INS_VCVTSD2SI, - X86_INS_VCVTSD2SS, - X86_INS_VCVTSD2USI, - X86_INS_VCVTSI2SD, - X86_INS_VCVTSI2SS, - X86_INS_VCVTSS2SD, - X86_INS_VCVTSS2SI, - X86_INS_VCVTSS2USI, - X86_INS_VCVTTPD2DQ, - X86_INS_VCVTTPD2QQ, - X86_INS_VCVTTPD2UDQ, - X86_INS_VCVTTPD2UQQ, - X86_INS_VCVTTPS2DQ, - X86_INS_VCVTTPS2QQ, - X86_INS_VCVTTPS2UDQ, - X86_INS_VCVTTPS2UQQ, - X86_INS_VCVTTSD2SI, - X86_INS_VCVTTSD2USI, - X86_INS_VCVTTSS2SI, - X86_INS_VCVTTSS2USI, - X86_INS_VCVTUDQ2PD, - X86_INS_VCVTUDQ2PS, - X86_INS_VCVTUQQ2PD, - X86_INS_VCVTUQQ2PS, - X86_INS_VCVTUSI2SD, - X86_INS_VCVTUSI2SS, - X86_INS_VDBPSADBW, - X86_INS_VDIVPD, - X86_INS_VDIVPS, - X86_INS_VDIVSD, - X86_INS_VDIVSS, - X86_INS_VDPPD, - X86_INS_VDPPS, - X86_INS_VERR, - X86_INS_VERW, - X86_INS_VEXP2PD, - X86_INS_VEXP2PS, - X86_INS_VEXPANDPD, - X86_INS_VEXPANDPS, - X86_INS_VEXTRACTF128, - X86_INS_VEXTRACTF32X4, - X86_INS_VEXTRACTF32X8, - X86_INS_VEXTRACTF64X2, - X86_INS_VEXTRACTF64X4, - X86_INS_VEXTRACTI128, - X86_INS_VEXTRACTI32X4, - X86_INS_VEXTRACTI32X8, - X86_INS_VEXTRACTI64X2, - X86_INS_VEXTRACTI64X4, - X86_INS_VEXTRACTPS, - X86_INS_VFIXUPIMMPD, - X86_INS_VFIXUPIMMPS, - X86_INS_VFIXUPIMMSD, - X86_INS_VFIXUPIMMSS, - X86_INS_VFMADD132PD, - X86_INS_VFMADD132PS, - X86_INS_VFMADD132SD, - X86_INS_VFMADD132SS, - X86_INS_VFMADD213PD, - X86_INS_VFMADD213PS, - X86_INS_VFMADD213SD, - X86_INS_VFMADD213SS, - X86_INS_VFMADD231PD, - X86_INS_VFMADD231PS, - X86_INS_VFMADD231SD, - X86_INS_VFMADD231SS, - X86_INS_VFMADDPD, - X86_INS_VFMADDPS, - X86_INS_VFMADDSD, - X86_INS_VFMADDSS, - X86_INS_VFMADDSUB132PD, - X86_INS_VFMADDSUB132PS, - X86_INS_VFMADDSUB213PD, - X86_INS_VFMADDSUB213PS, - X86_INS_VFMADDSUB231PD, - X86_INS_VFMADDSUB231PS, - X86_INS_VFMADDSUBPD, - X86_INS_VFMADDSUBPS, - X86_INS_VFMSUB132PD, - X86_INS_VFMSUB132PS, - X86_INS_VFMSUB132SD, - X86_INS_VFMSUB132SS, - X86_INS_VFMSUB213PD, - X86_INS_VFMSUB213PS, - X86_INS_VFMSUB213SD, - X86_INS_VFMSUB213SS, - X86_INS_VFMSUB231PD, - X86_INS_VFMSUB231PS, - X86_INS_VFMSUB231SD, - X86_INS_VFMSUB231SS, - X86_INS_VFMSUBADD132PD, - X86_INS_VFMSUBADD132PS, - X86_INS_VFMSUBADD213PD, - X86_INS_VFMSUBADD213PS, - X86_INS_VFMSUBADD231PD, - X86_INS_VFMSUBADD231PS, - X86_INS_VFMSUBADDPD, - X86_INS_VFMSUBADDPS, - X86_INS_VFMSUBPD, - X86_INS_VFMSUBPS, - X86_INS_VFMSUBSD, - X86_INS_VFMSUBSS, - X86_INS_VFNMADD132PD, - X86_INS_VFNMADD132PS, - X86_INS_VFNMADD132SD, - X86_INS_VFNMADD132SS, - X86_INS_VFNMADD213PD, - X86_INS_VFNMADD213PS, - X86_INS_VFNMADD213SD, - X86_INS_VFNMADD213SS, - X86_INS_VFNMADD231PD, - X86_INS_VFNMADD231PS, - X86_INS_VFNMADD231SD, - X86_INS_VFNMADD231SS, - X86_INS_VFNMADDPD, - X86_INS_VFNMADDPS, - X86_INS_VFNMADDSD, - X86_INS_VFNMADDSS, - X86_INS_VFNMSUB132PD, - X86_INS_VFNMSUB132PS, - X86_INS_VFNMSUB132SD, - X86_INS_VFNMSUB132SS, - X86_INS_VFNMSUB213PD, - X86_INS_VFNMSUB213PS, - X86_INS_VFNMSUB213SD, - X86_INS_VFNMSUB213SS, - X86_INS_VFNMSUB231PD, - X86_INS_VFNMSUB231PS, - X86_INS_VFNMSUB231SD, - X86_INS_VFNMSUB231SS, - X86_INS_VFNMSUBPD, - X86_INS_VFNMSUBPS, - X86_INS_VFNMSUBSD, - X86_INS_VFNMSUBSS, - X86_INS_VFPCLASSPD, - X86_INS_VFPCLASSPS, - X86_INS_VFPCLASSSD, - X86_INS_VFPCLASSSS, - X86_INS_VFRCZPD, - X86_INS_VFRCZPS, - X86_INS_VFRCZSD, - X86_INS_VFRCZSS, - X86_INS_VGATHERDPD, - X86_INS_VGATHERDPS, - X86_INS_VGATHERPF0DPD, - X86_INS_VGATHERPF0DPS, - X86_INS_VGATHERPF0QPD, - X86_INS_VGATHERPF0QPS, - X86_INS_VGATHERPF1DPD, - X86_INS_VGATHERPF1DPS, - X86_INS_VGATHERPF1QPD, - X86_INS_VGATHERPF1QPS, - X86_INS_VGATHERQPD, - X86_INS_VGATHERQPS, - X86_INS_VGETEXPPD, - X86_INS_VGETEXPPS, - X86_INS_VGETEXPSD, - X86_INS_VGETEXPSS, - X86_INS_VGETMANTPD, - X86_INS_VGETMANTPS, - X86_INS_VGETMANTSD, - X86_INS_VGETMANTSS, - X86_INS_VGF2P8AFFINEINVQB, - X86_INS_VGF2P8AFFINEQB, - X86_INS_VGF2P8MULB, - X86_INS_VHADDPD, - X86_INS_VHADDPS, - X86_INS_VHSUBPD, - X86_INS_VHSUBPS, - X86_INS_VINSERTF128, - X86_INS_VINSERTF32X4, - X86_INS_VINSERTF32X8, - X86_INS_VINSERTF64X2, - X86_INS_VINSERTF64X4, - X86_INS_VINSERTI128, - X86_INS_VINSERTI32X4, - X86_INS_VINSERTI32X8, - X86_INS_VINSERTI64X2, - X86_INS_VINSERTI64X4, - X86_INS_VINSERTPS, - X86_INS_VLDDQU, - X86_INS_VLDMXCSR, - X86_INS_VMASKMOVDQU, - X86_INS_VMASKMOVPD, - X86_INS_VMASKMOVPS, - X86_INS_VMAXPD, - X86_INS_VMAXPS, - X86_INS_VMAXSD, - X86_INS_VMAXSS, - X86_INS_VMCALL, - X86_INS_VMCLEAR, - X86_INS_VMFUNC, - X86_INS_VMINPD, - X86_INS_VMINPS, - X86_INS_VMINSD, - X86_INS_VMINSS, - X86_INS_VMLAUNCH, - X86_INS_VMLOAD, - X86_INS_VMMCALL, - X86_INS_VMOVQ, - X86_INS_VMOVAPD, - X86_INS_VMOVAPS, - X86_INS_VMOVDDUP, - X86_INS_VMOVD, - X86_INS_VMOVDQA32, - X86_INS_VMOVDQA64, - X86_INS_VMOVDQA, - X86_INS_VMOVDQU16, - X86_INS_VMOVDQU32, - X86_INS_VMOVDQU64, - X86_INS_VMOVDQU8, - X86_INS_VMOVDQU, - X86_INS_VMOVHLPS, - X86_INS_VMOVHPD, - X86_INS_VMOVHPS, - X86_INS_VMOVLHPS, - X86_INS_VMOVLPD, - X86_INS_VMOVLPS, - X86_INS_VMOVMSKPD, - X86_INS_VMOVMSKPS, - X86_INS_VMOVNTDQA, - X86_INS_VMOVNTDQ, - X86_INS_VMOVNTPD, - X86_INS_VMOVNTPS, - X86_INS_VMOVSD, - X86_INS_VMOVSHDUP, - X86_INS_VMOVSLDUP, - X86_INS_VMOVSS, - X86_INS_VMOVUPD, - X86_INS_VMOVUPS, - X86_INS_VMPSADBW, - X86_INS_VMPTRLD, - X86_INS_VMPTRST, - X86_INS_VMREAD, - X86_INS_VMRESUME, - X86_INS_VMRUN, - X86_INS_VMSAVE, - X86_INS_VMULPD, - X86_INS_VMULPS, - X86_INS_VMULSD, - X86_INS_VMULSS, - X86_INS_VMWRITE, - X86_INS_VMXOFF, - X86_INS_VMXON, - X86_INS_VORPD, - X86_INS_VORPS, - X86_INS_VP4DPWSSDS, - X86_INS_VP4DPWSSD, - X86_INS_VPABSB, - X86_INS_VPABSD, - X86_INS_VPABSQ, - X86_INS_VPABSW, - X86_INS_VPACKSSDW, - X86_INS_VPACKSSWB, - X86_INS_VPACKUSDW, - X86_INS_VPACKUSWB, - X86_INS_VPADDB, - X86_INS_VPADDD, - X86_INS_VPADDQ, - X86_INS_VPADDSB, - X86_INS_VPADDSW, - X86_INS_VPADDUSB, - X86_INS_VPADDUSW, - X86_INS_VPADDW, - X86_INS_VPALIGNR, - X86_INS_VPANDD, - X86_INS_VPANDND, - X86_INS_VPANDNQ, - X86_INS_VPANDN, - X86_INS_VPANDQ, - X86_INS_VPAND, - X86_INS_VPAVGB, - X86_INS_VPAVGW, - X86_INS_VPBLENDD, - X86_INS_VPBLENDMB, - X86_INS_VPBLENDMD, - X86_INS_VPBLENDMQ, - X86_INS_VPBLENDMW, - X86_INS_VPBLENDVB, - X86_INS_VPBLENDW, - X86_INS_VPBROADCASTB, - X86_INS_VPBROADCASTD, - X86_INS_VPBROADCASTMB2Q, - X86_INS_VPBROADCASTMW2D, - X86_INS_VPBROADCASTQ, - X86_INS_VPBROADCASTW, - X86_INS_VPCLMULQDQ, - X86_INS_VPCMOV, - X86_INS_VPCMP, - X86_INS_VPCMPB, - X86_INS_VPCMPD, - X86_INS_VPCMPEQB, - X86_INS_VPCMPEQD, - X86_INS_VPCMPEQQ, - X86_INS_VPCMPEQW, - X86_INS_VPCMPESTRI, - X86_INS_VPCMPESTRM, - X86_INS_VPCMPGTB, - X86_INS_VPCMPGTD, - X86_INS_VPCMPGTQ, - X86_INS_VPCMPGTW, - X86_INS_VPCMPISTRI, - X86_INS_VPCMPISTRM, - X86_INS_VPCMPQ, - X86_INS_VPCMPUB, - X86_INS_VPCMPUD, - X86_INS_VPCMPUQ, - X86_INS_VPCMPUW, - X86_INS_VPCMPW, - X86_INS_VPCOM, - X86_INS_VPCOMB, - X86_INS_VPCOMD, - X86_INS_VPCOMPRESSB, - X86_INS_VPCOMPRESSD, - X86_INS_VPCOMPRESSQ, - X86_INS_VPCOMPRESSW, - X86_INS_VPCOMQ, - X86_INS_VPCOMUB, - X86_INS_VPCOMUD, - X86_INS_VPCOMUQ, - X86_INS_VPCOMUW, - X86_INS_VPCOMW, - X86_INS_VPCONFLICTD, - X86_INS_VPCONFLICTQ, - X86_INS_VPDPBUSDS, - X86_INS_VPDPBUSD, - X86_INS_VPDPWSSDS, - X86_INS_VPDPWSSD, - X86_INS_VPERM2F128, - X86_INS_VPERM2I128, - X86_INS_VPERMB, - X86_INS_VPERMD, - X86_INS_VPERMI2B, - X86_INS_VPERMI2D, - X86_INS_VPERMI2PD, - X86_INS_VPERMI2PS, - X86_INS_VPERMI2Q, - X86_INS_VPERMI2W, - X86_INS_VPERMIL2PD, - X86_INS_VPERMILPD, - X86_INS_VPERMIL2PS, - X86_INS_VPERMILPS, - X86_INS_VPERMPD, - X86_INS_VPERMPS, - X86_INS_VPERMQ, - X86_INS_VPERMT2B, - X86_INS_VPERMT2D, - X86_INS_VPERMT2PD, - X86_INS_VPERMT2PS, - X86_INS_VPERMT2Q, - X86_INS_VPERMT2W, - X86_INS_VPERMW, - X86_INS_VPEXPANDB, - X86_INS_VPEXPANDD, - X86_INS_VPEXPANDQ, - X86_INS_VPEXPANDW, - X86_INS_VPEXTRB, - X86_INS_VPEXTRD, - X86_INS_VPEXTRQ, - X86_INS_VPEXTRW, - X86_INS_VPGATHERDD, - X86_INS_VPGATHERDQ, - X86_INS_VPGATHERQD, - X86_INS_VPGATHERQQ, - X86_INS_VPHADDBD, - X86_INS_VPHADDBQ, - X86_INS_VPHADDBW, - X86_INS_VPHADDDQ, - X86_INS_VPHADDD, - X86_INS_VPHADDSW, - X86_INS_VPHADDUBD, - X86_INS_VPHADDUBQ, - X86_INS_VPHADDUBW, - X86_INS_VPHADDUDQ, - X86_INS_VPHADDUWD, - X86_INS_VPHADDUWQ, - X86_INS_VPHADDWD, - X86_INS_VPHADDWQ, - X86_INS_VPHADDW, - X86_INS_VPHMINPOSUW, - X86_INS_VPHSUBBW, - X86_INS_VPHSUBDQ, - X86_INS_VPHSUBD, - X86_INS_VPHSUBSW, - X86_INS_VPHSUBWD, - X86_INS_VPHSUBW, - X86_INS_VPINSRB, - X86_INS_VPINSRD, - X86_INS_VPINSRQ, - X86_INS_VPINSRW, - X86_INS_VPLZCNTD, - X86_INS_VPLZCNTQ, - X86_INS_VPMACSDD, - X86_INS_VPMACSDQH, - X86_INS_VPMACSDQL, - X86_INS_VPMACSSDD, - X86_INS_VPMACSSDQH, - X86_INS_VPMACSSDQL, - X86_INS_VPMACSSWD, - X86_INS_VPMACSSWW, - X86_INS_VPMACSWD, - X86_INS_VPMACSWW, - X86_INS_VPMADCSSWD, - X86_INS_VPMADCSWD, - X86_INS_VPMADD52HUQ, - X86_INS_VPMADD52LUQ, - X86_INS_VPMADDUBSW, - X86_INS_VPMADDWD, - X86_INS_VPMASKMOVD, - X86_INS_VPMASKMOVQ, - X86_INS_VPMAXSB, - X86_INS_VPMAXSD, - X86_INS_VPMAXSQ, - X86_INS_VPMAXSW, - X86_INS_VPMAXUB, - X86_INS_VPMAXUD, - X86_INS_VPMAXUQ, - X86_INS_VPMAXUW, - X86_INS_VPMINSB, - X86_INS_VPMINSD, - X86_INS_VPMINSQ, - X86_INS_VPMINSW, - X86_INS_VPMINUB, - X86_INS_VPMINUD, - X86_INS_VPMINUQ, - X86_INS_VPMINUW, - X86_INS_VPMOVB2M, - X86_INS_VPMOVD2M, - X86_INS_VPMOVDB, - X86_INS_VPMOVDW, - X86_INS_VPMOVM2B, - X86_INS_VPMOVM2D, - X86_INS_VPMOVM2Q, - X86_INS_VPMOVM2W, - X86_INS_VPMOVMSKB, - X86_INS_VPMOVQ2M, - X86_INS_VPMOVQB, - X86_INS_VPMOVQD, - X86_INS_VPMOVQW, - X86_INS_VPMOVSDB, - X86_INS_VPMOVSDW, - X86_INS_VPMOVSQB, - X86_INS_VPMOVSQD, - X86_INS_VPMOVSQW, - X86_INS_VPMOVSWB, - X86_INS_VPMOVSXBD, - X86_INS_VPMOVSXBQ, - X86_INS_VPMOVSXBW, - X86_INS_VPMOVSXDQ, - X86_INS_VPMOVSXWD, - X86_INS_VPMOVSXWQ, - X86_INS_VPMOVUSDB, - X86_INS_VPMOVUSDW, - X86_INS_VPMOVUSQB, - X86_INS_VPMOVUSQD, - X86_INS_VPMOVUSQW, - X86_INS_VPMOVUSWB, - X86_INS_VPMOVW2M, - X86_INS_VPMOVWB, - X86_INS_VPMOVZXBD, - X86_INS_VPMOVZXBQ, - X86_INS_VPMOVZXBW, - X86_INS_VPMOVZXDQ, - X86_INS_VPMOVZXWD, - X86_INS_VPMOVZXWQ, - X86_INS_VPMULDQ, - X86_INS_VPMULHRSW, - X86_INS_VPMULHUW, - X86_INS_VPMULHW, - X86_INS_VPMULLD, - X86_INS_VPMULLQ, - X86_INS_VPMULLW, - X86_INS_VPMULTISHIFTQB, - X86_INS_VPMULUDQ, - X86_INS_VPOPCNTB, - X86_INS_VPOPCNTD, - X86_INS_VPOPCNTQ, - X86_INS_VPOPCNTW, - X86_INS_VPORD, - X86_INS_VPORQ, - X86_INS_VPOR, - X86_INS_VPPERM, - X86_INS_VPROLD, - X86_INS_VPROLQ, - X86_INS_VPROLVD, - X86_INS_VPROLVQ, - X86_INS_VPRORD, - X86_INS_VPRORQ, - X86_INS_VPRORVD, - X86_INS_VPRORVQ, - X86_INS_VPROTB, - X86_INS_VPROTD, - X86_INS_VPROTQ, - X86_INS_VPROTW, - X86_INS_VPSADBW, - X86_INS_VPSCATTERDD, - X86_INS_VPSCATTERDQ, - X86_INS_VPSCATTERQD, - X86_INS_VPSCATTERQQ, - X86_INS_VPSHAB, - X86_INS_VPSHAD, - X86_INS_VPSHAQ, - X86_INS_VPSHAW, - X86_INS_VPSHLB, - X86_INS_VPSHLDD, - X86_INS_VPSHLDQ, - X86_INS_VPSHLDVD, - X86_INS_VPSHLDVQ, - X86_INS_VPSHLDVW, - X86_INS_VPSHLDW, - X86_INS_VPSHLD, - X86_INS_VPSHLQ, - X86_INS_VPSHLW, - X86_INS_VPSHRDD, - X86_INS_VPSHRDQ, - X86_INS_VPSHRDVD, - X86_INS_VPSHRDVQ, - X86_INS_VPSHRDVW, - X86_INS_VPSHRDW, - X86_INS_VPSHUFBITQMB, - X86_INS_VPSHUFB, - X86_INS_VPSHUFD, - X86_INS_VPSHUFHW, - X86_INS_VPSHUFLW, - X86_INS_VPSIGNB, - X86_INS_VPSIGND, - X86_INS_VPSIGNW, - X86_INS_VPSLLDQ, - X86_INS_VPSLLD, - X86_INS_VPSLLQ, - X86_INS_VPSLLVD, - X86_INS_VPSLLVQ, - X86_INS_VPSLLVW, - X86_INS_VPSLLW, - X86_INS_VPSRAD, - X86_INS_VPSRAQ, - X86_INS_VPSRAVD, - X86_INS_VPSRAVQ, - X86_INS_VPSRAVW, - X86_INS_VPSRAW, - X86_INS_VPSRLDQ, - X86_INS_VPSRLD, - X86_INS_VPSRLQ, - X86_INS_VPSRLVD, - X86_INS_VPSRLVQ, - X86_INS_VPSRLVW, - X86_INS_VPSRLW, - X86_INS_VPSUBB, - X86_INS_VPSUBD, - X86_INS_VPSUBQ, - X86_INS_VPSUBSB, - X86_INS_VPSUBSW, - X86_INS_VPSUBUSB, - X86_INS_VPSUBUSW, - X86_INS_VPSUBW, - X86_INS_VPTERNLOGD, - X86_INS_VPTERNLOGQ, - X86_INS_VPTESTMB, - X86_INS_VPTESTMD, - X86_INS_VPTESTMQ, - X86_INS_VPTESTMW, - X86_INS_VPTESTNMB, - X86_INS_VPTESTNMD, - X86_INS_VPTESTNMQ, - X86_INS_VPTESTNMW, - X86_INS_VPTEST, - X86_INS_VPUNPCKHBW, - X86_INS_VPUNPCKHDQ, - X86_INS_VPUNPCKHQDQ, - X86_INS_VPUNPCKHWD, - X86_INS_VPUNPCKLBW, - X86_INS_VPUNPCKLDQ, - X86_INS_VPUNPCKLQDQ, - X86_INS_VPUNPCKLWD, - X86_INS_VPXORD, - X86_INS_VPXORQ, - X86_INS_VPXOR, - X86_INS_VRANGEPD, - X86_INS_VRANGEPS, - X86_INS_VRANGESD, - X86_INS_VRANGESS, - X86_INS_VRCP14PD, - X86_INS_VRCP14PS, - X86_INS_VRCP14SD, - X86_INS_VRCP14SS, - X86_INS_VRCP28PD, - X86_INS_VRCP28PS, - X86_INS_VRCP28SD, - X86_INS_VRCP28SS, - X86_INS_VRCPPS, - X86_INS_VRCPSS, - X86_INS_VREDUCEPD, - X86_INS_VREDUCEPS, - X86_INS_VREDUCESD, - X86_INS_VREDUCESS, - X86_INS_VRNDSCALEPD, - X86_INS_VRNDSCALEPS, - X86_INS_VRNDSCALESD, - X86_INS_VRNDSCALESS, - X86_INS_VROUNDPD, - X86_INS_VROUNDPS, - X86_INS_VROUNDSD, - X86_INS_VROUNDSS, - X86_INS_VRSQRT14PD, - X86_INS_VRSQRT14PS, - X86_INS_VRSQRT14SD, - X86_INS_VRSQRT14SS, - X86_INS_VRSQRT28PD, - X86_INS_VRSQRT28PS, - X86_INS_VRSQRT28SD, - X86_INS_VRSQRT28SS, - X86_INS_VRSQRTPS, - X86_INS_VRSQRTSS, - X86_INS_VSCALEFPD, - X86_INS_VSCALEFPS, - X86_INS_VSCALEFSD, - X86_INS_VSCALEFSS, - X86_INS_VSCATTERDPD, - X86_INS_VSCATTERDPS, - X86_INS_VSCATTERPF0DPD, - X86_INS_VSCATTERPF0DPS, - X86_INS_VSCATTERPF0QPD, - X86_INS_VSCATTERPF0QPS, - X86_INS_VSCATTERPF1DPD, - X86_INS_VSCATTERPF1DPS, - X86_INS_VSCATTERPF1QPD, - X86_INS_VSCATTERPF1QPS, - X86_INS_VSCATTERQPD, - X86_INS_VSCATTERQPS, - X86_INS_VSHUFF32X4, - X86_INS_VSHUFF64X2, - X86_INS_VSHUFI32X4, - X86_INS_VSHUFI64X2, - X86_INS_VSHUFPD, - X86_INS_VSHUFPS, - X86_INS_VSQRTPD, - X86_INS_VSQRTPS, - X86_INS_VSQRTSD, - X86_INS_VSQRTSS, - X86_INS_VSTMXCSR, - X86_INS_VSUBPD, - X86_INS_VSUBPS, - X86_INS_VSUBSD, - X86_INS_VSUBSS, - X86_INS_VTESTPD, - X86_INS_VTESTPS, - X86_INS_VUCOMISD, - X86_INS_VUCOMISS, - X86_INS_VUNPCKHPD, - X86_INS_VUNPCKHPS, - X86_INS_VUNPCKLPD, - X86_INS_VUNPCKLPS, - X86_INS_VXORPD, - X86_INS_VXORPS, - X86_INS_VZEROALL, - X86_INS_VZEROUPPER, - X86_INS_WAIT, - X86_INS_WBINVD, - X86_INS_WBNOINVD, - X86_INS_WRFSBASE, - X86_INS_WRGSBASE, - X86_INS_WRMSR, - X86_INS_WRPKRU, - X86_INS_WRSSD, - X86_INS_WRSSQ, - X86_INS_WRUSSD, - X86_INS_WRUSSQ, - X86_INS_XABORT, - X86_INS_XACQUIRE, - X86_INS_XADD, - X86_INS_XBEGIN, - X86_INS_XCHG, - X86_INS_FXCH, - X86_INS_XCRYPTCBC, - X86_INS_XCRYPTCFB, - X86_INS_XCRYPTCTR, - X86_INS_XCRYPTECB, - X86_INS_XCRYPTOFB, - X86_INS_XEND, - X86_INS_XGETBV, - X86_INS_XLATB, - X86_INS_XOR, - X86_INS_XORPD, - X86_INS_XORPS, - X86_INS_XRELEASE, - X86_INS_XRSTOR, - X86_INS_XRSTOR64, - X86_INS_XRSTORS, - X86_INS_XRSTORS64, - X86_INS_XSAVE, - X86_INS_XSAVE64, - X86_INS_XSAVEC, - X86_INS_XSAVEC64, - X86_INS_XSAVEOPT, - X86_INS_XSAVEOPT64, - X86_INS_XSAVES, - X86_INS_XSAVES64, - X86_INS_XSETBV, - X86_INS_XSHA1, - X86_INS_XSHA256, - X86_INS_XSTORE, - X86_INS_XTEST, - - X86_INS_ENDING, // mark the end of the list of insn -} x86_insn; - -/// Group of X86 instructions -typedef enum x86_insn_group { - X86_GRP_INVALID = 0, ///< = CS_GRP_INVALID - - // Generic groups - // all jump instructions (conditional+direct+indirect jumps) - X86_GRP_JUMP, ///< = CS_GRP_JUMP - // all call instructions - X86_GRP_CALL, ///< = CS_GRP_CALL - // all return instructions - X86_GRP_RET, ///< = CS_GRP_RET - // all interrupt instructions (int+syscall) - X86_GRP_INT, ///< = CS_GRP_INT - // all interrupt return instructions - X86_GRP_IRET, ///< = CS_GRP_IRET - // all privileged instructions - X86_GRP_PRIVILEGE, ///< = CS_GRP_PRIVILEGE - // all relative branching instructions - X86_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE - - // Architecture-specific groups - X86_GRP_VM = 128, ///< all virtualization instructions (VT-x + AMD-V) - X86_GRP_3DNOW, - X86_GRP_AES, - X86_GRP_ADX, - X86_GRP_AVX, - X86_GRP_AVX2, - X86_GRP_AVX512, - X86_GRP_BMI, - X86_GRP_BMI2, - X86_GRP_CMOV, - X86_GRP_F16C, - X86_GRP_FMA, - X86_GRP_FMA4, - X86_GRP_FSGSBASE, - X86_GRP_HLE, - X86_GRP_MMX, - X86_GRP_MODE32, - X86_GRP_MODE64, - X86_GRP_RTM, - X86_GRP_SHA, - X86_GRP_SSE1, - X86_GRP_SSE2, - X86_GRP_SSE3, - X86_GRP_SSE41, - X86_GRP_SSE42, - X86_GRP_SSE4A, - X86_GRP_SSSE3, - X86_GRP_PCLMUL, - X86_GRP_XOP, - X86_GRP_CDI, - X86_GRP_ERI, - X86_GRP_TBM, - X86_GRP_16BITMODE, - X86_GRP_NOT64BITMODE, - X86_GRP_SGX, - X86_GRP_DQI, - X86_GRP_BWI, - X86_GRP_PFI, - X86_GRP_VLX, - X86_GRP_SMAP, - X86_GRP_NOVLX, - X86_GRP_FPU, - - X86_GRP_ENDING -} x86_insn_group; - -#ifdef __cplusplus -} -#endif - -#endif -#ifndef CAPSTONE_XCORE_H -#define CAPSTONE_XCORE_H - -/* Capstone Disassembly Engine */ -/* By Nguyen Anh Quynh , 2014-2015 */ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif - -/// Operand type for instruction's operands -typedef enum xcore_op_type { - XCORE_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - XCORE_OP_REG, ///< = CS_OP_REG (Register operand). - XCORE_OP_IMM, ///< = CS_OP_IMM (Immediate operand). - XCORE_OP_MEM, ///< = CS_OP_MEM (Memory operand). -} xcore_op_type; - -/// XCore registers -typedef enum xcore_reg { - XCORE_REG_INVALID = 0, - - XCORE_REG_CP, - XCORE_REG_DP, - XCORE_REG_LR, - XCORE_REG_SP, - XCORE_REG_R0, - XCORE_REG_R1, - XCORE_REG_R2, - XCORE_REG_R3, - XCORE_REG_R4, - XCORE_REG_R5, - XCORE_REG_R6, - XCORE_REG_R7, - XCORE_REG_R8, - XCORE_REG_R9, - XCORE_REG_R10, - XCORE_REG_R11, - - // pseudo registers - XCORE_REG_PC, ///< pc - - // internal thread registers - // see The-XMOS-XS1-Architecture(X7879A).pdf - XCORE_REG_SCP, ///< save pc - XCORE_REG_SSR, //< save status - XCORE_REG_ET, //< exception type - XCORE_REG_ED, //< exception data - XCORE_REG_SED, //< save exception data - XCORE_REG_KEP, //< kernel entry pointer - XCORE_REG_KSP, //< kernel stack pointer - XCORE_REG_ID, //< thread ID - - XCORE_REG_ENDING, // <-- mark the end of the list of registers -} xcore_reg; - -/// Instruction's operand referring to memory -/// This is associated with XCORE_OP_MEM operand type above -typedef struct xcore_op_mem { - uint8_t base; ///< base register, can be safely interpreted as - ///< a value of type `xcore_reg`, but it is only - ///< one byte wide - uint8_t index; ///< index register, same conditions apply here - int32_t disp; ///< displacement/offset value - int direct; ///< +1: forward, -1: backward -} xcore_op_mem; - -/// Instruction operand -typedef struct cs_xcore_op { - xcore_op_type type; ///< operand type - union { - xcore_reg reg; ///< register value for REG operand - int32_t imm; ///< immediate value for IMM operand - xcore_op_mem mem; ///< base/disp value for MEM operand - }; -} cs_xcore_op; - -/// Instruction structure -typedef struct cs_xcore { - /// Number of operands of this instruction, - /// or 0 when instruction has no operand. - uint8_t op_count; - cs_xcore_op operands[8]; ///< operands for this instruction. -} cs_xcore; - -/// XCore instruction -typedef enum xcore_insn { - XCORE_INS_INVALID = 0, - - XCORE_INS_ADD, - XCORE_INS_ANDNOT, - XCORE_INS_AND, - XCORE_INS_ASHR, - XCORE_INS_BAU, - XCORE_INS_BITREV, - XCORE_INS_BLA, - XCORE_INS_BLAT, - XCORE_INS_BL, - XCORE_INS_BF, - XCORE_INS_BT, - XCORE_INS_BU, - XCORE_INS_BRU, - XCORE_INS_BYTEREV, - XCORE_INS_CHKCT, - XCORE_INS_CLRE, - XCORE_INS_CLRPT, - XCORE_INS_CLRSR, - XCORE_INS_CLZ, - XCORE_INS_CRC8, - XCORE_INS_CRC32, - XCORE_INS_DCALL, - XCORE_INS_DENTSP, - XCORE_INS_DGETREG, - XCORE_INS_DIVS, - XCORE_INS_DIVU, - XCORE_INS_DRESTSP, - XCORE_INS_DRET, - XCORE_INS_ECALLF, - XCORE_INS_ECALLT, - XCORE_INS_EDU, - XCORE_INS_EEF, - XCORE_INS_EET, - XCORE_INS_EEU, - XCORE_INS_ENDIN, - XCORE_INS_ENTSP, - XCORE_INS_EQ, - XCORE_INS_EXTDP, - XCORE_INS_EXTSP, - XCORE_INS_FREER, - XCORE_INS_FREET, - XCORE_INS_GETD, - XCORE_INS_GET, - XCORE_INS_GETN, - XCORE_INS_GETR, - XCORE_INS_GETSR, - XCORE_INS_GETST, - XCORE_INS_GETTS, - XCORE_INS_INCT, - XCORE_INS_INIT, - XCORE_INS_INPW, - XCORE_INS_INSHR, - XCORE_INS_INT, - XCORE_INS_IN, - XCORE_INS_KCALL, - XCORE_INS_KENTSP, - XCORE_INS_KRESTSP, - XCORE_INS_KRET, - XCORE_INS_LADD, - XCORE_INS_LD16S, - XCORE_INS_LD8U, - XCORE_INS_LDA16, - XCORE_INS_LDAP, - XCORE_INS_LDAW, - XCORE_INS_LDC, - XCORE_INS_LDW, - XCORE_INS_LDIVU, - XCORE_INS_LMUL, - XCORE_INS_LSS, - XCORE_INS_LSUB, - XCORE_INS_LSU, - XCORE_INS_MACCS, - XCORE_INS_MACCU, - XCORE_INS_MJOIN, - XCORE_INS_MKMSK, - XCORE_INS_MSYNC, - XCORE_INS_MUL, - XCORE_INS_NEG, - XCORE_INS_NOT, - XCORE_INS_OR, - XCORE_INS_OUTCT, - XCORE_INS_OUTPW, - XCORE_INS_OUTSHR, - XCORE_INS_OUTT, - XCORE_INS_OUT, - XCORE_INS_PEEK, - XCORE_INS_REMS, - XCORE_INS_REMU, - XCORE_INS_RETSP, - XCORE_INS_SETCLK, - XCORE_INS_SET, - XCORE_INS_SETC, - XCORE_INS_SETD, - XCORE_INS_SETEV, - XCORE_INS_SETN, - XCORE_INS_SETPSC, - XCORE_INS_SETPT, - XCORE_INS_SETRDY, - XCORE_INS_SETSR, - XCORE_INS_SETTW, - XCORE_INS_SETV, - XCORE_INS_SEXT, - XCORE_INS_SHL, - XCORE_INS_SHR, - XCORE_INS_SSYNC, - XCORE_INS_ST16, - XCORE_INS_ST8, - XCORE_INS_STW, - XCORE_INS_SUB, - XCORE_INS_SYNCR, - XCORE_INS_TESTCT, - XCORE_INS_TESTLCL, - XCORE_INS_TESTWCT, - XCORE_INS_TSETMR, - XCORE_INS_START, - XCORE_INS_WAITEF, - XCORE_INS_WAITET, - XCORE_INS_WAITEU, - XCORE_INS_XOR, - XCORE_INS_ZEXT, - - XCORE_INS_ENDING, // <-- mark the end of the list of instructions -} xcore_insn; - -/// Group of XCore instructions -typedef enum xcore_insn_group { - XCORE_GRP_INVALID = 0, ///< = CS_GRP_INVALID - - // Generic groups - // all jump instructions (conditional+direct+indirect jumps) - XCORE_GRP_JUMP, ///< = CS_GRP_JUMP - - XCORE_GRP_ENDING, // <-- mark the end of the list of groups -} xcore_insn_group; - -#ifdef __cplusplus -} -#endif - -#endif -/* Capstone Disassembly Engine */ -/* TMS320C64x Backend by Fotis Loukos 2016 */ - -#ifndef CAPSTONE_TMS320C64X_H -#define CAPSTONE_TMS320C64X_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif - -typedef enum tms320c64x_op_type { - TMS320C64X_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - TMS320C64X_OP_REG, ///< = CS_OP_REG (Register operand). - TMS320C64X_OP_IMM, ///< = CS_OP_IMM (Immediate operand). - TMS320C64X_OP_MEM, ///< = CS_OP_MEM (Memory operand). - TMS320C64X_OP_REGPAIR = 64, ///< Register pair for double word ops -} tms320c64x_op_type; - -typedef enum tms320c64x_mem_disp { - TMS320C64X_MEM_DISP_INVALID = 0, - TMS320C64X_MEM_DISP_CONSTANT, - TMS320C64X_MEM_DISP_REGISTER, -} tms320c64x_mem_disp; - -typedef enum tms320c64x_mem_dir { - TMS320C64X_MEM_DIR_INVALID = 0, - TMS320C64X_MEM_DIR_FW, - TMS320C64X_MEM_DIR_BW, -} tms320c64x_mem_dir; - -typedef enum tms320c64x_mem_mod { - TMS320C64X_MEM_MOD_INVALID = 0, - TMS320C64X_MEM_MOD_NO, - TMS320C64X_MEM_MOD_PRE, - TMS320C64X_MEM_MOD_POST, -} tms320c64x_mem_mod; - -typedef struct tms320c64x_op_mem { - unsigned int base; ///< base register - unsigned int disp; ///< displacement/offset value - unsigned int unit; ///< unit of base and offset register - unsigned int scaled; ///< offset scaled - unsigned int disptype; ///< displacement type - unsigned int direction; ///< direction - unsigned int modify; ///< modification -} tms320c64x_op_mem; - -typedef struct cs_tms320c64x_op { - tms320c64x_op_type type; ///< operand type - union { - unsigned int reg; ///< register value for REG operand or first register for REGPAIR operand - int32_t imm; ///< immediate value for IMM operand - tms320c64x_op_mem mem; ///< base/disp value for MEM operand - }; -} cs_tms320c64x_op; - -typedef struct cs_tms320c64x { - uint8_t op_count; - cs_tms320c64x_op operands[8]; ///< operands for this instruction. - struct { - unsigned int reg; - unsigned int zero; - } condition; - struct { - unsigned int unit; - unsigned int side; - unsigned int crosspath; - } funit; - unsigned int parallel; -} cs_tms320c64x; - -typedef enum tms320c64x_reg { - TMS320C64X_REG_INVALID = 0, - - TMS320C64X_REG_AMR, - TMS320C64X_REG_CSR, - TMS320C64X_REG_DIER, - TMS320C64X_REG_DNUM, - TMS320C64X_REG_ECR, - TMS320C64X_REG_GFPGFR, - TMS320C64X_REG_GPLYA, - TMS320C64X_REG_GPLYB, - TMS320C64X_REG_ICR, - TMS320C64X_REG_IER, - TMS320C64X_REG_IERR, - TMS320C64X_REG_ILC, - TMS320C64X_REG_IRP, - TMS320C64X_REG_ISR, - TMS320C64X_REG_ISTP, - TMS320C64X_REG_ITSR, - TMS320C64X_REG_NRP, - TMS320C64X_REG_NTSR, - TMS320C64X_REG_REP, - TMS320C64X_REG_RILC, - TMS320C64X_REG_SSR, - TMS320C64X_REG_TSCH, - TMS320C64X_REG_TSCL, - TMS320C64X_REG_TSR, - TMS320C64X_REG_A0, - TMS320C64X_REG_A1, - TMS320C64X_REG_A2, - TMS320C64X_REG_A3, - TMS320C64X_REG_A4, - TMS320C64X_REG_A5, - TMS320C64X_REG_A6, - TMS320C64X_REG_A7, - TMS320C64X_REG_A8, - TMS320C64X_REG_A9, - TMS320C64X_REG_A10, - TMS320C64X_REG_A11, - TMS320C64X_REG_A12, - TMS320C64X_REG_A13, - TMS320C64X_REG_A14, - TMS320C64X_REG_A15, - TMS320C64X_REG_A16, - TMS320C64X_REG_A17, - TMS320C64X_REG_A18, - TMS320C64X_REG_A19, - TMS320C64X_REG_A20, - TMS320C64X_REG_A21, - TMS320C64X_REG_A22, - TMS320C64X_REG_A23, - TMS320C64X_REG_A24, - TMS320C64X_REG_A25, - TMS320C64X_REG_A26, - TMS320C64X_REG_A27, - TMS320C64X_REG_A28, - TMS320C64X_REG_A29, - TMS320C64X_REG_A30, - TMS320C64X_REG_A31, - TMS320C64X_REG_B0, - TMS320C64X_REG_B1, - TMS320C64X_REG_B2, - TMS320C64X_REG_B3, - TMS320C64X_REG_B4, - TMS320C64X_REG_B5, - TMS320C64X_REG_B6, - TMS320C64X_REG_B7, - TMS320C64X_REG_B8, - TMS320C64X_REG_B9, - TMS320C64X_REG_B10, - TMS320C64X_REG_B11, - TMS320C64X_REG_B12, - TMS320C64X_REG_B13, - TMS320C64X_REG_B14, - TMS320C64X_REG_B15, - TMS320C64X_REG_B16, - TMS320C64X_REG_B17, - TMS320C64X_REG_B18, - TMS320C64X_REG_B19, - TMS320C64X_REG_B20, - TMS320C64X_REG_B21, - TMS320C64X_REG_B22, - TMS320C64X_REG_B23, - TMS320C64X_REG_B24, - TMS320C64X_REG_B25, - TMS320C64X_REG_B26, - TMS320C64X_REG_B27, - TMS320C64X_REG_B28, - TMS320C64X_REG_B29, - TMS320C64X_REG_B30, - TMS320C64X_REG_B31, - TMS320C64X_REG_PCE1, - - TMS320C64X_REG_ENDING, // <-- mark the end of the list of registers - - // Alias registers - TMS320C64X_REG_EFR = TMS320C64X_REG_ECR, - TMS320C64X_REG_IFR = TMS320C64X_REG_ISR, -} tms320c64x_reg; - -typedef enum tms320c64x_insn { - TMS320C64X_INS_INVALID = 0, - - TMS320C64X_INS_ABS, - TMS320C64X_INS_ABS2, - TMS320C64X_INS_ADD, - TMS320C64X_INS_ADD2, - TMS320C64X_INS_ADD4, - TMS320C64X_INS_ADDAB, - TMS320C64X_INS_ADDAD, - TMS320C64X_INS_ADDAH, - TMS320C64X_INS_ADDAW, - TMS320C64X_INS_ADDK, - TMS320C64X_INS_ADDKPC, - TMS320C64X_INS_ADDU, - TMS320C64X_INS_AND, - TMS320C64X_INS_ANDN, - TMS320C64X_INS_AVG2, - TMS320C64X_INS_AVGU4, - TMS320C64X_INS_B, - TMS320C64X_INS_BDEC, - TMS320C64X_INS_BITC4, - TMS320C64X_INS_BNOP, - TMS320C64X_INS_BPOS, - TMS320C64X_INS_CLR, - TMS320C64X_INS_CMPEQ, - TMS320C64X_INS_CMPEQ2, - TMS320C64X_INS_CMPEQ4, - TMS320C64X_INS_CMPGT, - TMS320C64X_INS_CMPGT2, - TMS320C64X_INS_CMPGTU4, - TMS320C64X_INS_CMPLT, - TMS320C64X_INS_CMPLTU, - TMS320C64X_INS_DEAL, - TMS320C64X_INS_DOTP2, - TMS320C64X_INS_DOTPN2, - TMS320C64X_INS_DOTPNRSU2, - TMS320C64X_INS_DOTPRSU2, - TMS320C64X_INS_DOTPSU4, - TMS320C64X_INS_DOTPU4, - TMS320C64X_INS_EXT, - TMS320C64X_INS_EXTU, - TMS320C64X_INS_GMPGTU, - TMS320C64X_INS_GMPY4, - TMS320C64X_INS_LDB, - TMS320C64X_INS_LDBU, - TMS320C64X_INS_LDDW, - TMS320C64X_INS_LDH, - TMS320C64X_INS_LDHU, - TMS320C64X_INS_LDNDW, - TMS320C64X_INS_LDNW, - TMS320C64X_INS_LDW, - TMS320C64X_INS_LMBD, - TMS320C64X_INS_MAX2, - TMS320C64X_INS_MAXU4, - TMS320C64X_INS_MIN2, - TMS320C64X_INS_MINU4, - TMS320C64X_INS_MPY, - TMS320C64X_INS_MPY2, - TMS320C64X_INS_MPYH, - TMS320C64X_INS_MPYHI, - TMS320C64X_INS_MPYHIR, - TMS320C64X_INS_MPYHL, - TMS320C64X_INS_MPYHLU, - TMS320C64X_INS_MPYHSLU, - TMS320C64X_INS_MPYHSU, - TMS320C64X_INS_MPYHU, - TMS320C64X_INS_MPYHULS, - TMS320C64X_INS_MPYHUS, - TMS320C64X_INS_MPYLH, - TMS320C64X_INS_MPYLHU, - TMS320C64X_INS_MPYLI, - TMS320C64X_INS_MPYLIR, - TMS320C64X_INS_MPYLSHU, - TMS320C64X_INS_MPYLUHS, - TMS320C64X_INS_MPYSU, - TMS320C64X_INS_MPYSU4, - TMS320C64X_INS_MPYU, - TMS320C64X_INS_MPYU4, - TMS320C64X_INS_MPYUS, - TMS320C64X_INS_MVC, - TMS320C64X_INS_MVD, - TMS320C64X_INS_MVK, - TMS320C64X_INS_MVKL, - TMS320C64X_INS_MVKLH, - TMS320C64X_INS_NOP, - TMS320C64X_INS_NORM, - TMS320C64X_INS_OR, - TMS320C64X_INS_PACK2, - TMS320C64X_INS_PACKH2, - TMS320C64X_INS_PACKH4, - TMS320C64X_INS_PACKHL2, - TMS320C64X_INS_PACKL4, - TMS320C64X_INS_PACKLH2, - TMS320C64X_INS_ROTL, - TMS320C64X_INS_SADD, - TMS320C64X_INS_SADD2, - TMS320C64X_INS_SADDU4, - TMS320C64X_INS_SADDUS2, - TMS320C64X_INS_SAT, - TMS320C64X_INS_SET, - TMS320C64X_INS_SHFL, - TMS320C64X_INS_SHL, - TMS320C64X_INS_SHLMB, - TMS320C64X_INS_SHR, - TMS320C64X_INS_SHR2, - TMS320C64X_INS_SHRMB, - TMS320C64X_INS_SHRU, - TMS320C64X_INS_SHRU2, - TMS320C64X_INS_SMPY, - TMS320C64X_INS_SMPY2, - TMS320C64X_INS_SMPYH, - TMS320C64X_INS_SMPYHL, - TMS320C64X_INS_SMPYLH, - TMS320C64X_INS_SPACK2, - TMS320C64X_INS_SPACKU4, - TMS320C64X_INS_SSHL, - TMS320C64X_INS_SSHVL, - TMS320C64X_INS_SSHVR, - TMS320C64X_INS_SSUB, - TMS320C64X_INS_STB, - TMS320C64X_INS_STDW, - TMS320C64X_INS_STH, - TMS320C64X_INS_STNDW, - TMS320C64X_INS_STNW, - TMS320C64X_INS_STW, - TMS320C64X_INS_SUB, - TMS320C64X_INS_SUB2, - TMS320C64X_INS_SUB4, - TMS320C64X_INS_SUBAB, - TMS320C64X_INS_SUBABS4, - TMS320C64X_INS_SUBAH, - TMS320C64X_INS_SUBAW, - TMS320C64X_INS_SUBC, - TMS320C64X_INS_SUBU, - TMS320C64X_INS_SWAP4, - TMS320C64X_INS_UNPKHU4, - TMS320C64X_INS_UNPKLU4, - TMS320C64X_INS_XOR, - TMS320C64X_INS_XPND2, - TMS320C64X_INS_XPND4, - // Aliases - TMS320C64X_INS_IDLE, - TMS320C64X_INS_MV, - TMS320C64X_INS_NEG, - TMS320C64X_INS_NOT, - TMS320C64X_INS_SWAP2, - TMS320C64X_INS_ZERO, - - TMS320C64X_INS_ENDING, // <-- mark the end of the list of instructions -} tms320c64x_insn; - -typedef enum tms320c64x_insn_group { - TMS320C64X_GRP_INVALID = 0, ///< = CS_GRP_INVALID - - TMS320C64X_GRP_JUMP, ///< = CS_GRP_JUMP - - TMS320C64X_GRP_FUNIT_D = 128, - TMS320C64X_GRP_FUNIT_L, - TMS320C64X_GRP_FUNIT_M, - TMS320C64X_GRP_FUNIT_S, - TMS320C64X_GRP_FUNIT_NO, - - TMS320C64X_GRP_ENDING, // <-- mark the end of the list of groups -} tms320c64x_insn_group; - -typedef enum tms320c64x_funit { - TMS320C64X_FUNIT_INVALID = 0, - TMS320C64X_FUNIT_D, - TMS320C64X_FUNIT_L, - TMS320C64X_FUNIT_M, - TMS320C64X_FUNIT_S, - TMS320C64X_FUNIT_NO -} tms320c64x_funit; - -#ifdef __cplusplus -} -#endif - -#endif - -#ifndef CAPSTONE_M680X_H -#define CAPSTONE_M680X_H - -/* Capstone Disassembly Engine */ -/* M680X Backend by Wolfgang Schwotzer 2017 */ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif - -#define M680X_OPERAND_COUNT 9 - -/// M680X registers and special registers -typedef enum m680x_reg { - M680X_REG_INVALID = 0, - - M680X_REG_A, ///< M6800/1/2/3/9, HD6301/9 - M680X_REG_B, ///< M6800/1/2/3/9, HD6301/9 - M680X_REG_E, ///< HD6309 - M680X_REG_F, ///< HD6309 - M680X_REG_0, ///< HD6309 - - M680X_REG_D, ///< M6801/3/9, HD6301/9 - M680X_REG_W, ///< HD6309 - - M680X_REG_CC, ///< M6800/1/2/3/9, M6301/9 - M680X_REG_DP, ///< M6809/M6309 - M680X_REG_MD, ///< M6309 - - M680X_REG_HX, ///< M6808 - M680X_REG_H, ///< M6808 - M680X_REG_X, ///< M6800/1/2/3/9, M6301/9 - M680X_REG_Y, ///< M6809/M6309 - M680X_REG_S, ///< M6809/M6309 - M680X_REG_U, ///< M6809/M6309 - M680X_REG_V, ///< M6309 - - M680X_REG_Q, ///< M6309 - - M680X_REG_PC, ///< M6800/1/2/3/9, M6301/9 - - M680X_REG_TMP2, ///< CPU12 - M680X_REG_TMP3, ///< CPU12 - - M680X_REG_ENDING, ///< <-- mark the end of the list of registers -} m680x_reg; - -/// Operand type for instruction's operands -typedef enum m680x_op_type { - M680X_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - M680X_OP_REGISTER, ///< = Register operand. - M680X_OP_IMMEDIATE, ///< = Immediate operand. - M680X_OP_INDEXED, ///< = Indexed addressing operand. - M680X_OP_EXTENDED, ///< = Extended addressing operand. - M680X_OP_DIRECT, ///< = Direct addressing operand. - M680X_OP_RELATIVE, ///< = Relative addressing operand. - M680X_OP_CONSTANT, ///< = constant operand (Displayed as number only). - ///< Used e.g. for a bit index or page number. -} m680x_op_type; - -// Supported bit values for mem.idx.offset_bits -#define M680X_OFFSET_NONE 0 -#define M680X_OFFSET_BITS_5 5 -#define M680X_OFFSET_BITS_8 8 -#define M680X_OFFSET_BITS_9 9 -#define M680X_OFFSET_BITS_16 16 - -// Supported bit flags for mem.idx.flags -// These flags can be combined -#define M680X_IDX_INDIRECT 1 -#define M680X_IDX_NO_COMMA 2 -#define M680X_IDX_POST_INC_DEC 4 - -/// Instruction's operand referring to indexed addressing -typedef struct m680x_op_idx { - m680x_reg base_reg; ///< base register (or M680X_REG_INVALID if - ///< irrelevant) - m680x_reg offset_reg; ///< offset register (or M680X_REG_INVALID if - ///< irrelevant) - int16_t offset; ///< 5-,8- or 16-bit offset. See also offset_bits. - uint16_t offset_addr; ///< = offset addr. if base_reg == M680X_REG_PC. - ///< calculated as offset + PC - uint8_t offset_bits; ///< offset width in bits for indexed addressing - int8_t inc_dec; ///< inc. or dec. value: - ///< 0: no inc-/decrement - ///< 1 .. 8: increment by 1 .. 8 - ///< -1 .. -8: decrement by 1 .. 8 - ///< if flag M680X_IDX_POST_INC_DEC set it is post - ///< inc-/decrement otherwise pre inc-/decrement - uint8_t flags; ///< 8-bit flags (see above) -} m680x_op_idx; - -/// Instruction's memory operand referring to relative addressing (Bcc/LBcc) -typedef struct m680x_op_rel { - uint16_t address; ///< The absolute address. - ///< calculated as PC + offset. PC is the first - ///< address after the instruction. - int16_t offset; ///< the offset/displacement value -} m680x_op_rel; - -/// Instruction's operand referring to extended addressing -typedef struct m680x_op_ext { - uint16_t address; ///< The absolute address - bool indirect; ///< true if extended indirect addressing -} m680x_op_ext; - -/// Instruction operand -typedef struct cs_m680x_op { - m680x_op_type type; - union { - int32_t imm; ///< immediate value for IMM operand - m680x_reg reg; ///< register value for REG operand - m680x_op_idx idx; ///< Indexed addressing operand - m680x_op_rel rel; ///< Relative address. operand (Bcc/LBcc) - m680x_op_ext ext; ///< Extended address - uint8_t direct_addr; ///<, 2013-2018 */ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif - -/// Instruction structure -typedef struct cs_evm { - unsigned char pop; ///< number of items popped from the stack - unsigned char push; ///< number of items pushed into the stack - unsigned int fee; ///< gas fee for the instruction -} cs_evm; - -/// EVM instruction -typedef enum evm_insn { - EVM_INS_STOP = 0, - EVM_INS_ADD = 1, - EVM_INS_MUL = 2, - EVM_INS_SUB = 3, - EVM_INS_DIV = 4, - EVM_INS_SDIV = 5, - EVM_INS_MOD = 6, - EVM_INS_SMOD = 7, - EVM_INS_ADDMOD = 8, - EVM_INS_MULMOD = 9, - EVM_INS_EXP = 10, - EVM_INS_SIGNEXTEND = 11, - EVM_INS_LT = 16, - EVM_INS_GT = 17, - EVM_INS_SLT = 18, - EVM_INS_SGT = 19, - EVM_INS_EQ = 20, - EVM_INS_ISZERO = 21, - EVM_INS_AND = 22, - EVM_INS_OR = 23, - EVM_INS_XOR = 24, - EVM_INS_NOT = 25, - EVM_INS_BYTE = 26, - EVM_INS_SHA3 = 32, - EVM_INS_ADDRESS = 48, - EVM_INS_BALANCE = 49, - EVM_INS_ORIGIN = 50, - EVM_INS_CALLER = 51, - EVM_INS_CALLVALUE = 52, - EVM_INS_CALLDATALOAD = 53, - EVM_INS_CALLDATASIZE = 54, - EVM_INS_CALLDATACOPY = 55, - EVM_INS_CODESIZE = 56, - EVM_INS_CODECOPY = 57, - EVM_INS_GASPRICE = 58, - EVM_INS_EXTCODESIZE = 59, - EVM_INS_EXTCODECOPY = 60, - EVM_INS_RETURNDATASIZE = 61, - EVM_INS_RETURNDATACOPY = 62, - EVM_INS_BLOCKHASH = 64, - EVM_INS_COINBASE = 65, - EVM_INS_TIMESTAMP = 66, - EVM_INS_NUMBER = 67, - EVM_INS_DIFFICULTY = 68, - EVM_INS_GASLIMIT = 69, - EVM_INS_POP = 80, - EVM_INS_MLOAD = 81, - EVM_INS_MSTORE = 82, - EVM_INS_MSTORE8 = 83, - EVM_INS_SLOAD = 84, - EVM_INS_SSTORE = 85, - EVM_INS_JUMP = 86, - EVM_INS_JUMPI = 87, - EVM_INS_PC = 88, - EVM_INS_MSIZE = 89, - EVM_INS_GAS = 90, - EVM_INS_JUMPDEST = 91, - EVM_INS_PUSH1 = 96, - EVM_INS_PUSH2 = 97, - EVM_INS_PUSH3 = 98, - EVM_INS_PUSH4 = 99, - EVM_INS_PUSH5 = 100, - EVM_INS_PUSH6 = 101, - EVM_INS_PUSH7 = 102, - EVM_INS_PUSH8 = 103, - EVM_INS_PUSH9 = 104, - EVM_INS_PUSH10 = 105, - EVM_INS_PUSH11 = 106, - EVM_INS_PUSH12 = 107, - EVM_INS_PUSH13 = 108, - EVM_INS_PUSH14 = 109, - EVM_INS_PUSH15 = 110, - EVM_INS_PUSH16 = 111, - EVM_INS_PUSH17 = 112, - EVM_INS_PUSH18 = 113, - EVM_INS_PUSH19 = 114, - EVM_INS_PUSH20 = 115, - EVM_INS_PUSH21 = 116, - EVM_INS_PUSH22 = 117, - EVM_INS_PUSH23 = 118, - EVM_INS_PUSH24 = 119, - EVM_INS_PUSH25 = 120, - EVM_INS_PUSH26 = 121, - EVM_INS_PUSH27 = 122, - EVM_INS_PUSH28 = 123, - EVM_INS_PUSH29 = 124, - EVM_INS_PUSH30 = 125, - EVM_INS_PUSH31 = 126, - EVM_INS_PUSH32 = 127, - EVM_INS_DUP1 = 128, - EVM_INS_DUP2 = 129, - EVM_INS_DUP3 = 130, - EVM_INS_DUP4 = 131, - EVM_INS_DUP5 = 132, - EVM_INS_DUP6 = 133, - EVM_INS_DUP7 = 134, - EVM_INS_DUP8 = 135, - EVM_INS_DUP9 = 136, - EVM_INS_DUP10 = 137, - EVM_INS_DUP11 = 138, - EVM_INS_DUP12 = 139, - EVM_INS_DUP13 = 140, - EVM_INS_DUP14 = 141, - EVM_INS_DUP15 = 142, - EVM_INS_DUP16 = 143, - EVM_INS_SWAP1 = 144, - EVM_INS_SWAP2 = 145, - EVM_INS_SWAP3 = 146, - EVM_INS_SWAP4 = 147, - EVM_INS_SWAP5 = 148, - EVM_INS_SWAP6 = 149, - EVM_INS_SWAP7 = 150, - EVM_INS_SWAP8 = 151, - EVM_INS_SWAP9 = 152, - EVM_INS_SWAP10 = 153, - EVM_INS_SWAP11 = 154, - EVM_INS_SWAP12 = 155, - EVM_INS_SWAP13 = 156, - EVM_INS_SWAP14 = 157, - EVM_INS_SWAP15 = 158, - EVM_INS_SWAP16 = 159, - EVM_INS_LOG0 = 160, - EVM_INS_LOG1 = 161, - EVM_INS_LOG2 = 162, - EVM_INS_LOG3 = 163, - EVM_INS_LOG4 = 164, - EVM_INS_CREATE = 240, - EVM_INS_CALL = 241, - EVM_INS_CALLCODE = 242, - EVM_INS_RETURN = 243, - EVM_INS_DELEGATECALL = 244, - EVM_INS_CALLBLACKBOX = 245, - EVM_INS_STATICCALL = 250, - EVM_INS_REVERT = 253, - EVM_INS_SUICIDE = 255, - - EVM_INS_INVALID = 512, - EVM_INS_ENDING, // <-- mark the end of the list of instructions -} evm_insn; - -/// Group of EVM instructions -typedef enum evm_insn_group { - EVM_GRP_INVALID = 0, ///< = CS_GRP_INVALID - - EVM_GRP_JUMP, ///< all jump instructions - - EVM_GRP_MATH = 8, ///< math instructions - EVM_GRP_STACK_WRITE, ///< instructions write to stack - EVM_GRP_STACK_READ, ///< instructions read from stack - EVM_GRP_MEM_WRITE, ///< instructions write to memory - EVM_GRP_MEM_READ, ///< instructions read from memory - EVM_GRP_STORE_WRITE, ///< instructions write to storage - EVM_GRP_STORE_READ, ///< instructions read from storage - EVM_GRP_HALT, ///< instructions halt execution - - EVM_GRP_ENDING, ///< <-- mark the end of the list of groups -} evm_insn_group; - -#ifdef __cplusplus -} -#endif - -#endif -#ifndef CAPSTONE_RISCV_H -#define CAPSTONE_RISCV_H - -/* Capstone Disassembly Engine */ -/* RISC-V Backend By Rodrigo Cortes Porto & - Shawn Chang , HardenedLinux@2018 */ - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_MSC_VER) || !defined(_KERNEL_MODE) -#include -#endif - - -// GCC MIPS toolchain has a default macro called "mips" which breaks -// compilation -//#undef riscv - -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif - -//> Operand type for instruction's operands -typedef enum riscv_op_type { - RISCV_OP_INVALID = 0, // = CS_OP_INVALID (Uninitialized). - RISCV_OP_REG, // = CS_OP_REG (Register operand). - RISCV_OP_IMM, // = CS_OP_IMM (Immediate operand). - RISCV_OP_MEM, // = CS_OP_MEM (Memory operand). -} riscv_op_type; - -// Instruction's operand referring to memory -// This is associated with RISCV_OP_MEM operand type above -typedef struct riscv_op_mem { - unsigned int base; // base register - int64_t disp; // displacement/offset value -} riscv_op_mem; - -// Instruction operand -typedef struct cs_riscv_op { - riscv_op_type type; // operand type - union { - unsigned int reg; // register value for REG operand - int64_t imm; // immediate value for IMM operand - riscv_op_mem mem; // base/disp value for MEM operand - }; -} cs_riscv_op; - -// Instruction structure -typedef struct cs_riscv { - // Does this instruction need effective address or not. - bool need_effective_addr; - // Number of operands of this instruction, - // or 0 when instruction has no operand. - uint8_t op_count; - cs_riscv_op operands[8]; // operands for this instruction. -} cs_riscv; - -//> RISCV registers -typedef enum riscv_reg { - RISCV_REG_INVALID = 0, - //> General purpose registers - RISCV_REG_X0, // "zero" - RISCV_REG_ZERO = RISCV_REG_X0, // "zero" - RISCV_REG_X1, // "ra" - RISCV_REG_RA = RISCV_REG_X1, // "ra" - RISCV_REG_X2, // "sp" - RISCV_REG_SP = RISCV_REG_X2, // "sp" - RISCV_REG_X3, // "gp" - RISCV_REG_GP = RISCV_REG_X3, // "gp" - RISCV_REG_X4, // "tp" - RISCV_REG_TP = RISCV_REG_X4, // "tp" - RISCV_REG_X5, // "t0" - RISCV_REG_T0 = RISCV_REG_X5, // "t0" - RISCV_REG_X6, // "t1" - RISCV_REG_T1 = RISCV_REG_X6, // "t1" - RISCV_REG_X7, // "t2" - RISCV_REG_T2 = RISCV_REG_X7, // "t2" - RISCV_REG_X8, // "s0/fp" - RISCV_REG_S0 = RISCV_REG_X8, // "s0" - RISCV_REG_FP = RISCV_REG_X8, // "fp" - RISCV_REG_X9, // "s1" - RISCV_REG_S1 = RISCV_REG_X9, // "s1" - RISCV_REG_X10, // "a0" - RISCV_REG_A0 = RISCV_REG_X10, // "a0" - RISCV_REG_X11, // "a1" - RISCV_REG_A1 = RISCV_REG_X11, // "a1" - RISCV_REG_X12, // "a2" - RISCV_REG_A2 = RISCV_REG_X12, // "a2" - RISCV_REG_X13, // "a3" - RISCV_REG_A3 = RISCV_REG_X13, // "a3" - RISCV_REG_X14, // "a4" - RISCV_REG_A4 = RISCV_REG_X14, // "a4" - RISCV_REG_X15, // "a5" - RISCV_REG_A5 = RISCV_REG_X15, // "a5" - RISCV_REG_X16, // "a6" - RISCV_REG_A6 = RISCV_REG_X16, // "a6" - RISCV_REG_X17, // "a7" - RISCV_REG_A7 = RISCV_REG_X17, // "a7" - RISCV_REG_X18, // "s2" - RISCV_REG_S2 = RISCV_REG_X18, // "s2" - RISCV_REG_X19, // "s3" - RISCV_REG_S3 = RISCV_REG_X19, // "s3" - RISCV_REG_X20, // "s4" - RISCV_REG_S4 = RISCV_REG_X20, // "s4" - RISCV_REG_X21, // "s5" - RISCV_REG_S5 = RISCV_REG_X21, // "s5" - RISCV_REG_X22, // "s6" - RISCV_REG_S6 = RISCV_REG_X22, // "s6" - RISCV_REG_X23, // "s7" - RISCV_REG_S7 = RISCV_REG_X23, // "s7" - RISCV_REG_X24, // "s8" - RISCV_REG_S8 = RISCV_REG_X24, // "s8" - RISCV_REG_X25, // "s9" - RISCV_REG_S9 = RISCV_REG_X25, // "s9" - RISCV_REG_X26, // "s10" - RISCV_REG_S10 = RISCV_REG_X26, // "s10" - RISCV_REG_X27, // "s11" - RISCV_REG_S11 = RISCV_REG_X27, // "s11" - RISCV_REG_X28, // "t3" - RISCV_REG_T3 = RISCV_REG_X28, // "t3" - RISCV_REG_X29, // "t4" - RISCV_REG_T4 = RISCV_REG_X29, // "t4" - RISCV_REG_X30, // "t5" - RISCV_REG_T5 = RISCV_REG_X30, // "t5" - RISCV_REG_X31, // "t6" - RISCV_REG_T6 = RISCV_REG_X31, // "t6" - - //> Floating-point registers - RISCV_REG_F0_32, // "ft0" - RISCV_REG_F0_64, // "ft0" - RISCV_REG_F1_32, // "ft1" - RISCV_REG_F1_64, // "ft1" - RISCV_REG_F2_32, // "ft2" - RISCV_REG_F2_64, // "ft2" - RISCV_REG_F3_32, // "ft3" - RISCV_REG_F3_64, // "ft3" - RISCV_REG_F4_32, // "ft4" - RISCV_REG_F4_64, // "ft4" - RISCV_REG_F5_32, // "ft5" - RISCV_REG_F5_64, // "ft5" - RISCV_REG_F6_32, // "ft6" - RISCV_REG_F6_64, // "ft6" - RISCV_REG_F7_32, // "ft7" - RISCV_REG_F7_64, // "ft7" - RISCV_REG_F8_32, // "fs0" - RISCV_REG_F8_64, // "fs0" - RISCV_REG_F9_32, // "fs1" - RISCV_REG_F9_64, // "fs1" - RISCV_REG_F10_32, // "fa0" - RISCV_REG_F10_64, // "fa0" - RISCV_REG_F11_32, // "fa1" - RISCV_REG_F11_64, // "fa1" - RISCV_REG_F12_32, // "fa2" - RISCV_REG_F12_64, // "fa2" - RISCV_REG_F13_32, // "fa3" - RISCV_REG_F13_64, // "fa3" - RISCV_REG_F14_32, // "fa4" - RISCV_REG_F14_64, // "fa4" - RISCV_REG_F15_32, // "fa5" - RISCV_REG_F15_64, // "fa5" - RISCV_REG_F16_32, // "fa6" - RISCV_REG_F16_64, // "fa6" - RISCV_REG_F17_32, // "fa7" - RISCV_REG_F17_64, // "fa7" - RISCV_REG_F18_32, // "fs2" - RISCV_REG_F18_64, // "fs2" - RISCV_REG_F19_32, // "fs3" - RISCV_REG_F19_64, // "fs3" - RISCV_REG_F20_32, // "fs4" - RISCV_REG_F20_64, // "fs4" - RISCV_REG_F21_32, // "fs5" - RISCV_REG_F21_64, // "fs5" - RISCV_REG_F22_32, // "fs6" - RISCV_REG_F22_64, // "fs6" - RISCV_REG_F23_32, // "fs7" - RISCV_REG_F23_64, // "fs7" - RISCV_REG_F24_32, // "fs8" - RISCV_REG_F24_64, // "fs8" - RISCV_REG_F25_32, // "fs9" - RISCV_REG_F25_64, // "fs9" - RISCV_REG_F26_32, // "fs10" - RISCV_REG_F26_64, // "fs10" - RISCV_REG_F27_32, // "fs11" - RISCV_REG_F27_64, // "fs11" - RISCV_REG_F28_32, // "ft8" - RISCV_REG_F28_64, // "ft8" - RISCV_REG_F29_32, // "ft9" - RISCV_REG_F29_64, // "ft9" - RISCV_REG_F30_32, // "ft10" - RISCV_REG_F30_64, // "ft10" - RISCV_REG_F31_32, // "ft11" - RISCV_REG_F31_64, // "ft11" - - RISCV_REG_ENDING, // <-- mark the end of the list or registers -} riscv_reg; - -//> RISCV instruction -typedef enum riscv_insn { - RISCV_INS_INVALID = 0, - - RISCV_INS_ADD, - RISCV_INS_ADDI, - RISCV_INS_ADDIW, - RISCV_INS_ADDW, - RISCV_INS_AMOADD_D, - RISCV_INS_AMOADD_D_AQ, - RISCV_INS_AMOADD_D_AQ_RL, - RISCV_INS_AMOADD_D_RL, - RISCV_INS_AMOADD_W, - RISCV_INS_AMOADD_W_AQ, - RISCV_INS_AMOADD_W_AQ_RL, - RISCV_INS_AMOADD_W_RL, - RISCV_INS_AMOAND_D, - RISCV_INS_AMOAND_D_AQ, - RISCV_INS_AMOAND_D_AQ_RL, - RISCV_INS_AMOAND_D_RL, - RISCV_INS_AMOAND_W, - RISCV_INS_AMOAND_W_AQ, - RISCV_INS_AMOAND_W_AQ_RL, - RISCV_INS_AMOAND_W_RL, - RISCV_INS_AMOMAXU_D, - RISCV_INS_AMOMAXU_D_AQ, - RISCV_INS_AMOMAXU_D_AQ_RL, - RISCV_INS_AMOMAXU_D_RL, - RISCV_INS_AMOMAXU_W, - RISCV_INS_AMOMAXU_W_AQ, - RISCV_INS_AMOMAXU_W_AQ_RL, - RISCV_INS_AMOMAXU_W_RL, - RISCV_INS_AMOMAX_D, - RISCV_INS_AMOMAX_D_AQ, - RISCV_INS_AMOMAX_D_AQ_RL, - RISCV_INS_AMOMAX_D_RL, - RISCV_INS_AMOMAX_W, - RISCV_INS_AMOMAX_W_AQ, - RISCV_INS_AMOMAX_W_AQ_RL, - RISCV_INS_AMOMAX_W_RL, - RISCV_INS_AMOMINU_D, - RISCV_INS_AMOMINU_D_AQ, - RISCV_INS_AMOMINU_D_AQ_RL, - RISCV_INS_AMOMINU_D_RL, - RISCV_INS_AMOMINU_W, - RISCV_INS_AMOMINU_W_AQ, - RISCV_INS_AMOMINU_W_AQ_RL, - RISCV_INS_AMOMINU_W_RL, - RISCV_INS_AMOMIN_D, - RISCV_INS_AMOMIN_D_AQ, - RISCV_INS_AMOMIN_D_AQ_RL, - RISCV_INS_AMOMIN_D_RL, - RISCV_INS_AMOMIN_W, - RISCV_INS_AMOMIN_W_AQ, - RISCV_INS_AMOMIN_W_AQ_RL, - RISCV_INS_AMOMIN_W_RL, - RISCV_INS_AMOOR_D, - RISCV_INS_AMOOR_D_AQ, - RISCV_INS_AMOOR_D_AQ_RL, - RISCV_INS_AMOOR_D_RL, - RISCV_INS_AMOOR_W, - RISCV_INS_AMOOR_W_AQ, - RISCV_INS_AMOOR_W_AQ_RL, - RISCV_INS_AMOOR_W_RL, - RISCV_INS_AMOSWAP_D, - RISCV_INS_AMOSWAP_D_AQ, - RISCV_INS_AMOSWAP_D_AQ_RL, - RISCV_INS_AMOSWAP_D_RL, - RISCV_INS_AMOSWAP_W, - RISCV_INS_AMOSWAP_W_AQ, - RISCV_INS_AMOSWAP_W_AQ_RL, - RISCV_INS_AMOSWAP_W_RL, - RISCV_INS_AMOXOR_D, - RISCV_INS_AMOXOR_D_AQ, - RISCV_INS_AMOXOR_D_AQ_RL, - RISCV_INS_AMOXOR_D_RL, - RISCV_INS_AMOXOR_W, - RISCV_INS_AMOXOR_W_AQ, - RISCV_INS_AMOXOR_W_AQ_RL, - RISCV_INS_AMOXOR_W_RL, - RISCV_INS_AND, - RISCV_INS_ANDI, - RISCV_INS_AUIPC, - RISCV_INS_BEQ, - RISCV_INS_BGE, - RISCV_INS_BGEU, - RISCV_INS_BLT, - RISCV_INS_BLTU, - RISCV_INS_BNE, - RISCV_INS_CSRRC, - RISCV_INS_CSRRCI, - RISCV_INS_CSRRS, - RISCV_INS_CSRRSI, - RISCV_INS_CSRRW, - RISCV_INS_CSRRWI, - RISCV_INS_C_ADD, - RISCV_INS_C_ADDI, - RISCV_INS_C_ADDI16SP, - RISCV_INS_C_ADDI4SPN, - RISCV_INS_C_ADDIW, - RISCV_INS_C_ADDW, - RISCV_INS_C_AND, - RISCV_INS_C_ANDI, - RISCV_INS_C_BEQZ, - RISCV_INS_C_BNEZ, - RISCV_INS_C_EBREAK, - RISCV_INS_C_FLD, - RISCV_INS_C_FLDSP, - RISCV_INS_C_FLW, - RISCV_INS_C_FLWSP, - RISCV_INS_C_FSD, - RISCV_INS_C_FSDSP, - RISCV_INS_C_FSW, - RISCV_INS_C_FSWSP, - RISCV_INS_C_J, - RISCV_INS_C_JAL, - RISCV_INS_C_JALR, - RISCV_INS_C_JR, - RISCV_INS_C_LD, - RISCV_INS_C_LDSP, - RISCV_INS_C_LI, - RISCV_INS_C_LUI, - RISCV_INS_C_LW, - RISCV_INS_C_LWSP, - RISCV_INS_C_MV, - RISCV_INS_C_NOP, - RISCV_INS_C_OR, - RISCV_INS_C_SD, - RISCV_INS_C_SDSP, - RISCV_INS_C_SLLI, - RISCV_INS_C_SRAI, - RISCV_INS_C_SRLI, - RISCV_INS_C_SUB, - RISCV_INS_C_SUBW, - RISCV_INS_C_SW, - RISCV_INS_C_SWSP, - RISCV_INS_C_UNIMP, - RISCV_INS_C_XOR, - RISCV_INS_DIV, - RISCV_INS_DIVU, - RISCV_INS_DIVUW, - RISCV_INS_DIVW, - RISCV_INS_EBREAK, - RISCV_INS_ECALL, - RISCV_INS_FADD_D, - RISCV_INS_FADD_S, - RISCV_INS_FCLASS_D, - RISCV_INS_FCLASS_S, - RISCV_INS_FCVT_D_L, - RISCV_INS_FCVT_D_LU, - RISCV_INS_FCVT_D_S, - RISCV_INS_FCVT_D_W, - RISCV_INS_FCVT_D_WU, - RISCV_INS_FCVT_LU_D, - RISCV_INS_FCVT_LU_S, - RISCV_INS_FCVT_L_D, - RISCV_INS_FCVT_L_S, - RISCV_INS_FCVT_S_D, - RISCV_INS_FCVT_S_L, - RISCV_INS_FCVT_S_LU, - RISCV_INS_FCVT_S_W, - RISCV_INS_FCVT_S_WU, - RISCV_INS_FCVT_WU_D, - RISCV_INS_FCVT_WU_S, - RISCV_INS_FCVT_W_D, - RISCV_INS_FCVT_W_S, - RISCV_INS_FDIV_D, - RISCV_INS_FDIV_S, - RISCV_INS_FENCE, - RISCV_INS_FENCE_I, - RISCV_INS_FENCE_TSO, - RISCV_INS_FEQ_D, - RISCV_INS_FEQ_S, - RISCV_INS_FLD, - RISCV_INS_FLE_D, - RISCV_INS_FLE_S, - RISCV_INS_FLT_D, - RISCV_INS_FLT_S, - RISCV_INS_FLW, - RISCV_INS_FMADD_D, - RISCV_INS_FMADD_S, - RISCV_INS_FMAX_D, - RISCV_INS_FMAX_S, - RISCV_INS_FMIN_D, - RISCV_INS_FMIN_S, - RISCV_INS_FMSUB_D, - RISCV_INS_FMSUB_S, - RISCV_INS_FMUL_D, - RISCV_INS_FMUL_S, - RISCV_INS_FMV_D_X, - RISCV_INS_FMV_W_X, - RISCV_INS_FMV_X_D, - RISCV_INS_FMV_X_W, - RISCV_INS_FNMADD_D, - RISCV_INS_FNMADD_S, - RISCV_INS_FNMSUB_D, - RISCV_INS_FNMSUB_S, - RISCV_INS_FSD, - RISCV_INS_FSGNJN_D, - RISCV_INS_FSGNJN_S, - RISCV_INS_FSGNJX_D, - RISCV_INS_FSGNJX_S, - RISCV_INS_FSGNJ_D, - RISCV_INS_FSGNJ_S, - RISCV_INS_FSQRT_D, - RISCV_INS_FSQRT_S, - RISCV_INS_FSUB_D, - RISCV_INS_FSUB_S, - RISCV_INS_FSW, - RISCV_INS_JAL, - RISCV_INS_JALR, - RISCV_INS_LB, - RISCV_INS_LBU, - RISCV_INS_LD, - RISCV_INS_LH, - RISCV_INS_LHU, - RISCV_INS_LR_D, - RISCV_INS_LR_D_AQ, - RISCV_INS_LR_D_AQ_RL, - RISCV_INS_LR_D_RL, - RISCV_INS_LR_W, - RISCV_INS_LR_W_AQ, - RISCV_INS_LR_W_AQ_RL, - RISCV_INS_LR_W_RL, - RISCV_INS_LUI, - RISCV_INS_LW, - RISCV_INS_LWU, - RISCV_INS_MRET, - RISCV_INS_MUL, - RISCV_INS_MULH, - RISCV_INS_MULHSU, - RISCV_INS_MULHU, - RISCV_INS_MULW, - RISCV_INS_OR, - RISCV_INS_ORI, - RISCV_INS_REM, - RISCV_INS_REMU, - RISCV_INS_REMUW, - RISCV_INS_REMW, - RISCV_INS_SB, - RISCV_INS_SC_D, - RISCV_INS_SC_D_AQ, - RISCV_INS_SC_D_AQ_RL, - RISCV_INS_SC_D_RL, - RISCV_INS_SC_W, - RISCV_INS_SC_W_AQ, - RISCV_INS_SC_W_AQ_RL, - RISCV_INS_SC_W_RL, - RISCV_INS_SD, - RISCV_INS_SFENCE_VMA, - RISCV_INS_SH, - RISCV_INS_SLL, - RISCV_INS_SLLI, - RISCV_INS_SLLIW, - RISCV_INS_SLLW, - RISCV_INS_SLT, - RISCV_INS_SLTI, - RISCV_INS_SLTIU, - RISCV_INS_SLTU, - RISCV_INS_SRA, - RISCV_INS_SRAI, - RISCV_INS_SRAIW, - RISCV_INS_SRAW, - RISCV_INS_SRET, - RISCV_INS_SRL, - RISCV_INS_SRLI, - RISCV_INS_SRLIW, - RISCV_INS_SRLW, - RISCV_INS_SUB, - RISCV_INS_SUBW, - RISCV_INS_SW, - RISCV_INS_UNIMP, - RISCV_INS_URET, - RISCV_INS_WFI, - RISCV_INS_XOR, - RISCV_INS_XORI, - - RISCV_INS_ENDING, -} riscv_insn; - -//> Group of RISCV instructions -typedef enum riscv_insn_group { - RISCV_GRP_INVALID = 0, // = CS_GRP_INVALID - RISCV_GRP_JUMP, - - RISCV_GRP_ISRV32 = 128, - RISCV_GRP_ISRV64, - RISCV_GRP_HASSTDEXTA, - RISCV_GRP_HASSTDEXTC, - RISCV_GRP_HASSTDEXTD, - RISCV_GRP_HASSTDEXTF, - RISCV_GRP_HASSTDEXTM, - /* - RISCV_GRP_ISRVA, - RISCV_GRP_ISRVC, - RISCV_GRP_ISRVD, - RISCV_GRP_ISRVCD, - RISCV_GRP_ISRVF, - RISCV_GRP_ISRV32C, - RISCV_GRP_ISRV32CF, - RISCV_GRP_ISRVM, - RISCV_GRP_ISRV64A, - RISCV_GRP_ISRV64C, - RISCV_GRP_ISRV64D, - RISCV_GRP_ISRV64F, - RISCV_GRP_ISRV64M, - */ - RISCV_GRP_ENDING, -} riscv_insn_group; - -#ifdef __cplusplus -} -#endif - -#endif - -/* Capstone Disassembly Engine */ -/* By Spike , xwings 2019 */ - -#ifndef CAPSTONE_WASM_H -#define CAPSTONE_WASM_H - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif - -typedef enum wasm_op_type { - WASM_OP_INVALID = 0, - WASM_OP_NONE, - WASM_OP_INT7, - WASM_OP_VARUINT32, - WASM_OP_VARUINT64, - WASM_OP_UINT32, - WASM_OP_UINT64, - WASM_OP_IMM, - WASM_OP_BRTABLE, -} wasm_op_type; - -typedef struct cs_wasm_brtable { - uint32_t length; - uint64_t address; - uint32_t default_target; -} cs_wasm_brtable; - -typedef struct cs_wasm_op { - wasm_op_type type; - uint32_t size; - union { - int8_t int7; - uint32_t varuint32; - uint64_t varuint64; - uint32_t uint32; - uint64_t uint64; - uint32_t immediate[2]; - cs_wasm_brtable brtable; - }; -} cs_wasm_op; - -/// Instruction structure -typedef struct cs_wasm { - uint8_t op_count; - cs_wasm_op operands[2]; -} cs_wasm; - -/// WASM instruction -typedef enum wasm_insn { - WASM_INS_UNREACHABLE = 0x0, - WASM_INS_NOP = 0x1, - WASM_INS_BLOCK = 0x2, - WASM_INS_LOOP = 0x3, - WASM_INS_IF = 0x4, - WASM_INS_ELSE = 0x5, - WASM_INS_END = 0xb, - WASM_INS_BR = 0xc, - WASM_INS_BR_IF = 0xd, - WASM_INS_BR_TABLE = 0xe, - WASM_INS_RETURN = 0xf, - WASM_INS_CALL = 0x10, - WASM_INS_CALL_INDIRECT = 0x11, - WASM_INS_DROP = 0x1a, - WASM_INS_SELECT = 0x1b, - WASM_INS_GET_LOCAL = 0x20, - WASM_INS_SET_LOCAL = 0x21, - WASM_INS_TEE_LOCAL = 0x22, - WASM_INS_GET_GLOBAL = 0x23, - WASM_INS_SET_GLOBAL = 0x24, - WASM_INS_I32_LOAD = 0x28, - WASM_INS_I64_LOAD = 0x29, - WASM_INS_F32_LOAD = 0x2a, - WASM_INS_F64_LOAD = 0x2b, - WASM_INS_I32_LOAD8_S = 0x2c, - WASM_INS_I32_LOAD8_U = 0x2d, - WASM_INS_I32_LOAD16_S = 0x2e, - WASM_INS_I32_LOAD16_U = 0x2f, - WASM_INS_I64_LOAD8_S = 0x30, - WASM_INS_I64_LOAD8_U = 0x31, - WASM_INS_I64_LOAD16_S = 0x32, - WASM_INS_I64_LOAD16_U = 0x33, - WASM_INS_I64_LOAD32_S = 0x34, - WASM_INS_I64_LOAD32_U = 0x35, - WASM_INS_I32_STORE = 0x36, - WASM_INS_I64_STORE = 0x37, - WASM_INS_F32_STORE = 0x38, - WASM_INS_F64_STORE = 0x39, - WASM_INS_I32_STORE8 = 0x3a, - WASM_INS_I32_STORE16 = 0x3b, - WASM_INS_I64_STORE8 = 0x3c, - WASM_INS_I64_STORE16 = 0x3d, - WASM_INS_I64_STORE32 = 0x3e, - WASM_INS_CURRENT_MEMORY = 0x3f, - WASM_INS_GROW_MEMORY = 0x40, - WASM_INS_I32_CONST = 0x41, - WASM_INS_I64_CONST = 0x42, - WASM_INS_F32_CONST = 0x43, - WASM_INS_F64_CONST = 0x44, - WASM_INS_I32_EQZ = 0x45, - WASM_INS_I32_EQ = 0x46, - WASM_INS_I32_NE = 0x47, - WASM_INS_I32_LT_S = 0x48, - WASM_INS_I32_LT_U = 0x49, - WASM_INS_I32_GT_S = 0x4a, - WASM_INS_I32_GT_U = 0x4b, - WASM_INS_I32_LE_S = 0x4c, - WASM_INS_I32_LE_U = 0x4d, - WASM_INS_I32_GE_S = 0x4e, - WASM_INS_I32_GE_U = 0x4f, - WASM_INS_I64_EQZ = 0x50, - WASM_INS_I64_EQ = 0x51, - WASM_INS_I64_NE = 0x52, - WASM_INS_I64_LT_S = 0x53, - WASM_INS_I64_LT_U = 0x54, - WASN_INS_I64_GT_S = 0x55, - WASM_INS_I64_GT_U = 0x56, - WASM_INS_I64_LE_S = 0x57, - WASM_INS_I64_LE_U = 0x58, - WASM_INS_I64_GE_S = 0x59, - WASM_INS_I64_GE_U = 0x5a, - WASM_INS_F32_EQ = 0x5b, - WASM_INS_F32_NE = 0x5c, - WASM_INS_F32_LT = 0x5d, - WASM_INS_F32_GT = 0x5e, - WASM_INS_F32_LE = 0x5f, - WASM_INS_F32_GE = 0x60, - WASM_INS_F64_EQ = 0x61, - WASM_INS_F64_NE = 0x62, - WASM_INS_F64_LT = 0x63, - WASM_INS_F64_GT = 0x64, - WASM_INS_F64_LE = 0x65, - WASM_INS_F64_GE = 0x66, - WASM_INS_I32_CLZ = 0x67, - WASM_INS_I32_CTZ = 0x68, - WASM_INS_I32_POPCNT = 0x69, - WASM_INS_I32_ADD = 0x6a, - WASM_INS_I32_SUB = 0x6b, - WASM_INS_I32_MUL = 0x6c, - WASM_INS_I32_DIV_S = 0x6d, - WASM_INS_I32_DIV_U = 0x6e, - WASM_INS_I32_REM_S = 0x6f, - WASM_INS_I32_REM_U = 0x70, - WASM_INS_I32_AND = 0x71, - WASM_INS_I32_OR = 0x72, - WASM_INS_I32_XOR = 0x73, - WASM_INS_I32_SHL = 0x74, - WASM_INS_I32_SHR_S = 0x75, - WASM_INS_I32_SHR_U = 0x76, - WASM_INS_I32_ROTL = 0x77, - WASM_INS_I32_ROTR = 0x78, - WASM_INS_I64_CLZ = 0x79, - WASM_INS_I64_CTZ = 0x7a, - WASM_INS_I64_POPCNT = 0x7b, - WASM_INS_I64_ADD = 0x7c, - WASM_INS_I64_SUB = 0x7d, - WASM_INS_I64_MUL = 0x7e, - WASM_INS_I64_DIV_S = 0x7f, - WASM_INS_I64_DIV_U = 0x80, - WASM_INS_I64_REM_S = 0x81, - WASM_INS_I64_REM_U = 0x82, - WASM_INS_I64_AND = 0x83, - WASM_INS_I64_OR = 0x84, - WASM_INS_I64_XOR = 0x85, - WASM_INS_I64_SHL = 0x86, - WASM_INS_I64_SHR_S = 0x87, - WASM_INS_I64_SHR_U = 0x88, - WASM_INS_I64_ROTL = 0x89, - WASM_INS_I64_ROTR = 0x8a, - WASM_INS_F32_ABS = 0x8b, - WASM_INS_F32_NEG = 0x8c, - WASM_INS_F32_CEIL = 0x8d, - WASM_INS_F32_FLOOR = 0x8e, - WASM_INS_F32_TRUNC = 0x8f, - WASM_INS_F32_NEAREST = 0x90, - WASM_INS_F32_SQRT = 0x91, - WASM_INS_F32_ADD = 0x92, - WASM_INS_F32_SUB = 0x93, - WASM_INS_F32_MUL = 0x94, - WASM_INS_F32_DIV = 0x95, - WASM_INS_F32_MIN = 0x96, - WASM_INS_F32_MAX = 0x97, - WASM_INS_F32_COPYSIGN = 0x98, - WASM_INS_F64_ABS = 0x99, - WASM_INS_F64_NEG = 0x9a, - WASM_INS_F64_CEIL = 0x9b, - WASM_INS_F64_FLOOR = 0x9c, - WASM_INS_F64_TRUNC = 0x9d, - WASM_INS_F64_NEAREST = 0x9e, - WASM_INS_F64_SQRT = 0x9f, - WASM_INS_F64_ADD = 0xa0, - WASM_INS_F64_SUB = 0xa1, - WASM_INS_F64_MUL = 0xa2, - WASM_INS_F64_DIV = 0xa3, - WASM_INS_F64_MIN = 0xa4, - WASM_INS_F64_MAX = 0xa5, - WASM_INS_F64_COPYSIGN = 0xa6, - WASM_INS_I32_WARP_I64 = 0xa7, - WASP_INS_I32_TRUNC_S_F32 = 0xa8, - WASM_INS_I32_TRUNC_U_F32 = 0xa9, - WASM_INS_I32_TRUNC_S_F64 = 0xaa, - WASM_INS_I32_TRUNC_U_F64 = 0xab, - WASM_INS_I64_EXTEND_S_I32 = 0xac, - WASM_INS_I64_EXTEND_U_I32 = 0xad, - WASM_INS_I64_TRUNC_S_F32 = 0xae, - WASM_INS_I64_TRUNC_U_F32 = 0xaf, - WASM_INS_I64_TRUNC_S_F64 = 0xb0, - WASM_INS_I64_TRUNC_U_F64 = 0xb1, - WASM_INS_F32_CONVERT_S_I32 = 0xb2, - WASM_INS_F32_CONVERT_U_I32 = 0xb3, - WASM_INS_F32_CONVERT_S_I64 = 0xb4, - WASM_INS_F32_CONVERT_U_I64 = 0xb5, - WASM_INS_F32_DEMOTE_F64 = 0xb6, - WASM_INS_F64_CONVERT_S_I32 = 0xb7, - WASM_INS_F64_CONVERT_U_I32 = 0xb8, - WASM_INS_F64_CONVERT_S_I64 = 0xb9, - WASM_INS_F64_CONVERT_U_I64 = 0xba, - WASM_INS_F64_PROMOTE_F32 = 0xbb, - WASM_INS_I32_REINTERPRET_F32 = 0xbc, - WASM_INS_I64_REINTERPRET_F64 = 0xbd, - WASM_INS_F32_REINTERPRET_I32 = 0xbe, - WASM_INS_F64_REINTERPRET_I64 = 0xbf, - WASM_INS_INVALID = 512, - WASM_INS_ENDING, -} wasm_insn; - -/// Group of WASM instructions -typedef enum wasm_insn_group { - WASM_GRP_INVALID = 0, ///< = CS_GRP_INVALID - - WASM_GRP_NUMBERIC = 8, - WASM_GRP_PARAMETRIC, - WASM_GRP_VARIABLE, - WASM_GRP_MEMORY, - WASM_GRP_CONTROL, - - WASM_GRP_ENDING, ///< <-- mark the end of the list of groups -} wasm_insn_group; - -#ifdef __cplusplus -} -#endif - -#endif -#ifndef CAPSTONE_MOS65XX_H -#define CAPSTONE_MOS65XX_H - -/* Capstone Disassembly Engine */ -/* By Sebastian Macke , 2019 */ - -#ifndef CAPSTONE_BPF_H -#define CAPSTONE_BPF_H - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif - -/// Operand type for instruction's operands -typedef enum bpf_op_type { - BPF_OP_INVALID = 0, - - BPF_OP_REG, - BPF_OP_IMM, - BPF_OP_OFF, - BPF_OP_MEM, - BPF_OP_MMEM, ///< M[k] in cBPF - BPF_OP_MSH, ///< corresponds to cBPF's BPF_MSH mode - BPF_OP_EXT, ///< cBPF's extension (not eBPF) -} bpf_op_type; - -/// BPF registers -typedef enum bpf_reg { - BPF_REG_INVALID = 0, - - ///< cBPF - BPF_REG_A, - BPF_REG_X, - - ///< eBPF - BPF_REG_R0, - BPF_REG_R1, - BPF_REG_R2, - BPF_REG_R3, - BPF_REG_R4, - BPF_REG_R5, - BPF_REG_R6, - BPF_REG_R7, - BPF_REG_R8, - BPF_REG_R9, - BPF_REG_R10, - - BPF_REG_ENDING, -} bpf_reg; - -/// Instruction's operand referring to memory -/// This is associated with BPF_OP_MEM operand type above -typedef struct bpf_op_mem { - bpf_reg base; ///< base register - uint32_t disp; ///< offset value -} bpf_op_mem; - -typedef enum bpf_ext_type { - BPF_EXT_INVALID = 0, - - BPF_EXT_LEN, -} bpf_ext_type; - -/// Instruction operand -typedef struct cs_bpf_op { - bpf_op_type type; - union { - uint8_t reg; ///< register value for REG operand - uint64_t imm; ///< immediate value IMM operand - uint32_t off; ///< offset value, used in jump & call - bpf_op_mem mem; ///< base/disp value for MEM operand - /* cBPF only */ - uint32_t mmem; ///< M[k] in cBPF - uint32_t msh; ///< corresponds to cBPF's BPF_MSH mode - uint32_t ext; ///< cBPF's extension (not eBPF) - }; - - /// How is this operand accessed? (READ, WRITE or READ|WRITE) - /// This field is combined of cs_ac_type. - /// NOTE: this field is irrelevant if engine is compiled in DIET mode. - uint8_t access; -} cs_bpf_op; - -/// Instruction structure -typedef struct cs_bpf { - uint8_t op_count; - cs_bpf_op operands[4]; -} cs_bpf; - -/// BPF instruction -typedef enum bpf_insn { - BPF_INS_INVALID = 0, - - ///< ALU - BPF_INS_ADD, - BPF_INS_SUB, - BPF_INS_MUL, - BPF_INS_DIV, - BPF_INS_OR, - BPF_INS_AND, - BPF_INS_LSH, - BPF_INS_RSH, - BPF_INS_NEG, - BPF_INS_MOD, - BPF_INS_XOR, - BPF_INS_MOV, ///< eBPF only - BPF_INS_ARSH, ///< eBPF only - - ///< ALU64, eBPF only - BPF_INS_ADD64, - BPF_INS_SUB64, - BPF_INS_MUL64, - BPF_INS_DIV64, - BPF_INS_OR64, - BPF_INS_AND64, - BPF_INS_LSH64, - BPF_INS_RSH64, - BPF_INS_NEG64, - BPF_INS_MOD64, - BPF_INS_XOR64, - BPF_INS_MOV64, - BPF_INS_ARSH64, - - ///< Byteswap, eBPF only - BPF_INS_LE16, - BPF_INS_LE32, - BPF_INS_LE64, - BPF_INS_BE16, - BPF_INS_BE32, - BPF_INS_BE64, - - ///< Load - BPF_INS_LDW, ///< eBPF only - BPF_INS_LDH, - BPF_INS_LDB, - BPF_INS_LDDW, ///< eBPF only: load 64-bit imm - BPF_INS_LDXW, ///< eBPF only - BPF_INS_LDXH, ///< eBPF only - BPF_INS_LDXB, ///< eBPF only - BPF_INS_LDXDW, ///< eBPF only - - ///< Store - BPF_INS_STW, ///< eBPF only - BPF_INS_STH, ///< eBPF only - BPF_INS_STB, ///< eBPF only - BPF_INS_STDW, ///< eBPF only - BPF_INS_STXW, ///< eBPF only - BPF_INS_STXH, ///< eBPF only - BPF_INS_STXB, ///< eBPF only - BPF_INS_STXDW, ///< eBPF only - BPF_INS_XADDW, ///< eBPF only - BPF_INS_XADDDW, ///< eBPF only - - ///< Jump - BPF_INS_JMP, - BPF_INS_JEQ, - BPF_INS_JGT, - BPF_INS_JGE, - BPF_INS_JSET, - BPF_INS_JNE, ///< eBPF only - BPF_INS_JSGT, ///< eBPF only - BPF_INS_JSGE, ///< eBPF only - BPF_INS_CALL, ///< eBPF only - BPF_INS_EXIT, ///< eBPF only - BPF_INS_JLT, ///< eBPF only - BPF_INS_JLE, ///< eBPF only - BPF_INS_JSLT, ///< eBPF only - BPF_INS_JSLE, ///< eBPF only - - ///< Return, cBPF only - BPF_INS_RET, - - ///< Misc, cBPF only - BPF_INS_TAX, - BPF_INS_TXA, - - BPF_INS_ENDING, - - // alias instructions - BPF_INS_LD = BPF_INS_LDW, ///< cBPF only - BPF_INS_LDX = BPF_INS_LDXW, ///< cBPF only - BPF_INS_ST = BPF_INS_STW, ///< cBPF only - BPF_INS_STX = BPF_INS_STXW, ///< cBPF only -} bpf_insn; - -/// Group of BPF instructions -typedef enum bpf_insn_group { - BPF_GRP_INVALID = 0, ///< = CS_GRP_INVALID - - BPF_GRP_LOAD, - BPF_GRP_STORE, - BPF_GRP_ALU, - BPF_GRP_JUMP, - BPF_GRP_CALL, ///< eBPF only - BPF_GRP_RETURN, - BPF_GRP_MISC, ///< cBPF only - - BPF_GRP_ENDING, -} bpf_insn_group; - -#ifdef __cplusplus -} -#endif - -#endif - -/// NOTE: All information in cs_detail is only available when CS_OPT_DETAIL = CS_OPT_ON -/// Initialized as memset(., 0, offsetof(cs_detail, ARCH)+sizeof(cs_ARCH)) -/// by ARCH_getInstruction in arch/ARCH/ARCHDisassembler.c -/// if cs_detail changes, in particular if a field is added after the union, -/// then update arch/ARCH/ARCHDisassembler.c accordingly -typedef struct cs_detail { - uint16_t regs_read[16]; ///< list of implicit registers read by this insn - uint8_t regs_read_count; ///< number of implicit registers read by this insn - - uint16_t regs_write[20]; ///< list of implicit registers modified by this insn - uint8_t regs_write_count; ///< number of implicit registers modified by this insn - - uint8_t groups[8]; ///< list of group this instruction belong to - uint8_t groups_count; ///< number of groups this insn belongs to - - /// Architecture-specific instruction info - union { - cs_x86 x86; ///< X86 architecture, including 16-bit, 32-bit & 64-bit mode - cs_arm64 arm64; ///< ARM64 architecture (aka AArch64) - cs_arm arm; ///< ARM architecture (including Thumb/Thumb2) - cs_m68k m68k; ///< M68K architecture - cs_mips mips; ///< MIPS architecture - cs_ppc ppc; ///< PowerPC architecture - cs_sparc sparc; ///< Sparc architecture - cs_sysz sysz; ///< SystemZ architecture - cs_xcore xcore; ///< XCore architecture - cs_tms320c64x tms320c64x; ///< TMS320C64x architecture - cs_m680x m680x; ///< M680X architecture - cs_evm evm; ///< Ethereum architecture - cs_mos65xx mos65xx; ///< MOS65XX architecture (including MOS6502) - cs_wasm wasm; ///< Web Assembly architecture - cs_bpf bpf; ///< Berkeley Packet Filter architecture (including eBPF) - cs_riscv riscv; ///< RISCV architecture - }; -} cs_detail; - -/// Detail information of disassembled instruction -typedef struct cs_insn { - /// Instruction ID (basically a numeric ID for the instruction mnemonic) - /// Find the instruction id in the '[ARCH]_insn' enum in the header file - /// of corresponding architecture, such as 'arm_insn' in arm.h for ARM, - /// 'x86_insn' in x86.h for X86, etc... - /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF - /// NOTE: in Skipdata mode, "data" instruction has 0 for this id field. - unsigned int id; - - /// Address (EIP) of this instruction - /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF - uint64_t address; - - /// Size of this instruction - /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF - uint16_t size; - - /// Machine bytes of this instruction, with number of bytes indicated by @size above - /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF - uint8_t bytes[24]; - - /// Ascii text of instruction mnemonic - /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF - char mnemonic[CS_MNEMONIC_SIZE]; - - /// Ascii text of instruction operands - /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF - char op_str[160]; - - /// Pointer to cs_detail. - /// NOTE: detail pointer is only valid when both requirements below are met: - /// (1) CS_OP_DETAIL = CS_OPT_ON - /// (2) Engine is not in Skipdata mode (CS_OP_SKIPDATA option set to CS_OPT_ON) - /// - /// NOTE 2: when in Skipdata mode, or when detail mode is OFF, even if this pointer - /// is not NULL, its content is still irrelevant. - cs_detail *detail; -} cs_insn; - - -/// Calculate the offset of a disassembled instruction in its buffer, given its position -/// in its array of disassembled insn -/// NOTE: this macro works with position (>=1), not index -#define CS_INSN_OFFSET(insns, post) (insns[post - 1].address - insns[0].address) - - -/// All type of errors encountered by Capstone API. -/// These are values returned by cs_errno() -typedef enum cs_err { - CS_ERR_OK = 0, ///< No error: everything was fine - CS_ERR_MEM, ///< Out-Of-Memory error: cs_open(), cs_disasm(), cs_disasm_iter() - CS_ERR_ARCH, ///< Unsupported architecture: cs_open() - CS_ERR_HANDLE, ///< Invalid handle: cs_op_count(), cs_op_index() - CS_ERR_CSH, ///< Invalid csh argument: cs_close(), cs_errno(), cs_option() - CS_ERR_MODE, ///< Invalid/unsupported mode: cs_open() - CS_ERR_OPTION, ///< Invalid/unsupported option: cs_option() - CS_ERR_DETAIL, ///< Information is unavailable because detail option is OFF - CS_ERR_MEMSETUP, ///< Dynamic memory management uninitialized (see CS_OPT_MEM) - CS_ERR_VERSION, ///< Unsupported version (bindings) - CS_ERR_DIET, ///< Access irrelevant data in "diet" engine - CS_ERR_SKIPDATA, ///< Access irrelevant data for "data" instruction in SKIPDATA mode - CS_ERR_X86_ATT, ///< X86 AT&T syntax is unsupported (opt-out at compile time) - CS_ERR_X86_INTEL, ///< X86 Intel syntax is unsupported (opt-out at compile time) - CS_ERR_X86_MASM, ///< X86 Masm syntax is unsupported (opt-out at compile time) -} cs_err; - -/** - Return combined API version & major and minor version numbers. - - @major: major number of API version - @minor: minor number of API version - - @return hexical number as (major << 8 | minor), which encodes both - major & minor versions. - NOTE: This returned value can be compared with version number made - with macro CS_MAKE_VERSION - - For example, second API version would return 1 in @major, and 1 in @minor - The return value would be 0x0101 - - NOTE: if you only care about returned value, but not major and minor values, - set both @major & @minor arguments to NULL. -*/ -CAPSTONE_EXPORT -unsigned int CAPSTONE_API cs_version(int *major, int *minor); - - -/** - This API can be used to either ask for archs supported by this library, - or check to see if the library was compile with 'diet' option (or called - in 'diet' mode). - - To check if a particular arch is supported by this library, set @query to - arch mode (CS_ARCH_* value). - To verify if this library supports all the archs, use CS_ARCH_ALL. - - To check if this library is in 'diet' mode, set @query to CS_SUPPORT_DIET. - - @return True if this library supports the given arch, or in 'diet' mode. -*/ -CAPSTONE_EXPORT -bool CAPSTONE_API cs_support(int query); - -/** - Initialize CS handle: this must be done before any usage of CS. - - @arch: architecture type (CS_ARCH_*) - @mode: hardware mode. This is combined of CS_MODE_* - @handle: pointer to handle, which will be updated at return time - - @return CS_ERR_OK on success, or other value on failure (refer to cs_err enum - for detailed error). -*/ -CAPSTONE_EXPORT -cs_err CAPSTONE_API cs_open(cs_arch arch, cs_mode mode, csh *handle); - -/** - Close CS handle: MUST do to release the handle when it is not used anymore. - NOTE: this must be only called when there is no longer usage of Capstone, - not even access to cs_insn array. The reason is the this API releases some - cached memory, thus access to any Capstone API after cs_close() might crash - your application. - - In fact,this API invalidate @handle by ZERO out its value (i.e *handle = 0). - - @handle: pointer to a handle returned by cs_open() - - @return CS_ERR_OK on success, or other value on failure (refer to cs_err enum - for detailed error). -*/ -CAPSTONE_EXPORT -cs_err CAPSTONE_API cs_close(csh *handle); - -/** - Set option for disassembling engine at runtime - - @handle: handle returned by cs_open() - @type: type of option to be set - @value: option value corresponding with @type - - @return: CS_ERR_OK on success, or other value on failure. - Refer to cs_err enum for detailed error. - - NOTE: in the case of CS_OPT_MEM, handle's value can be anything, - so that cs_option(handle, CS_OPT_MEM, value) can (i.e must) be called - even before cs_open() -*/ -CAPSTONE_EXPORT -cs_err CAPSTONE_API cs_option(csh handle, cs_opt_type type, size_t value); - -/** - Report the last error number when some API function fail. - Like glibc's errno, cs_errno might not retain its old value once accessed. - - @handle: handle returned by cs_open() - - @return: error code of cs_err enum type (CS_ERR_*, see above) -*/ -CAPSTONE_EXPORT -cs_err CAPSTONE_API cs_errno(csh handle); - - -/** - Return a string describing given error code. - - @code: error code (see CS_ERR_* above) - - @return: returns a pointer to a string that describes the error code - passed in the argument @code -*/ -CAPSTONE_EXPORT -const char * CAPSTONE_API cs_strerror(cs_err code); - -/** - Disassemble binary code, given the code buffer, size, address and number - of instructions to be decoded. - This API dynamically allocate memory to contain disassembled instruction. - Resulting instructions will be put into @*insn - - NOTE 1: this API will automatically determine memory needed to contain - output disassembled instructions in @insn. - - NOTE 2: caller must free the allocated memory itself to avoid memory leaking. - - NOTE 3: for system with scarce memory to be dynamically allocated such as - OS kernel or firmware, the API cs_disasm_iter() might be a better choice than - cs_disasm(). The reason is that with cs_disasm(), based on limited available - memory, we have to calculate in advance how many instructions to be disassembled, - which complicates things. This is especially troublesome for the case @count=0, - when cs_disasm() runs uncontrollably (until either end of input buffer, or - when it encounters an invalid instruction). - - @handle: handle returned by cs_open() - @code: buffer containing raw binary code to be disassembled. - @code_size: size of the above code buffer. - @address: address of the first instruction in given raw code buffer. - @insn: array of instructions filled in by this API. - NOTE: @insn will be allocated by this function, and should be freed - with cs_free() API. - @count: number of instructions to be disassembled, or 0 to get all of them - - @return: the number of successfully disassembled instructions, - or 0 if this function failed to disassemble the given code - - On failure, call cs_errno() for error code. -*/ -CAPSTONE_EXPORT -size_t CAPSTONE_API cs_disasm(csh handle, - const uint8_t *code, size_t code_size, - uint64_t address, - size_t count, - cs_insn **insn); - -/** - Free memory allocated by cs_malloc() or cs_disasm() (argument @insn) - - @insn: pointer returned by @insn argument in cs_disasm() or cs_malloc() - @count: number of cs_insn structures returned by cs_disasm(), or 1 - to free memory allocated by cs_malloc(). -*/ -CAPSTONE_EXPORT -void CAPSTONE_API cs_free(cs_insn *insn, size_t count); - - -/** - Allocate memory for 1 instruction to be used by cs_disasm_iter(). - - @handle: handle returned by cs_open() - - NOTE: when no longer in use, you can reclaim the memory allocated for - this instruction with cs_free(insn, 1) -*/ -CAPSTONE_EXPORT -cs_insn * CAPSTONE_API cs_malloc(csh handle); - -/** - Fast API to disassemble binary code, given the code buffer, size, address - and number of instructions to be decoded. - This API puts the resulting instruction into a given cache in @insn. - See tests/test_iter.c for sample code demonstrating this API. - - NOTE 1: this API will update @code, @size & @address to point to the next - instruction in the input buffer. Therefore, it is convenient to use - cs_disasm_iter() inside a loop to quickly iterate all the instructions. - While decoding one instruction at a time can also be achieved with - cs_disasm(count=1), some benchmarks shown that cs_disasm_iter() can be 30% - faster on random input. - - NOTE 2: the cache in @insn can be created with cs_malloc() API. - - NOTE 3: for system with scarce memory to be dynamically allocated such as - OS kernel or firmware, this API is recommended over cs_disasm(), which - allocates memory based on the number of instructions to be disassembled. - The reason is that with cs_disasm(), based on limited available memory, - we have to calculate in advance how many instructions to be disassembled, - which complicates things. This is especially troublesome for the case - @count=0, when cs_disasm() runs uncontrollably (until either end of input - buffer, or when it encounters an invalid instruction). - - @handle: handle returned by cs_open() - @code: buffer containing raw binary code to be disassembled - @size: size of above code - @address: address of the first insn in given raw code buffer - @insn: pointer to instruction to be filled in by this API. - - @return: true if this API successfully decode 1 instruction, - or false otherwise. - - On failure, call cs_errno() for error code. -*/ -CAPSTONE_EXPORT -bool CAPSTONE_API cs_disasm_iter(csh handle, - const uint8_t **code, size_t *size, - uint64_t *address, cs_insn *insn); - -/** - Return friendly name of register in a string. - Find the instruction id from header file of corresponding architecture (arm.h for ARM, - x86.h for X86, ...) - - WARN: when in 'diet' mode, this API is irrelevant because engine does not - store register name. - - @handle: handle returned by cs_open() - @reg_id: register id - - @return: string name of the register, or NULL if @reg_id is invalid. -*/ -CAPSTONE_EXPORT -const char * CAPSTONE_API cs_reg_name(csh handle, unsigned int reg_id); - -/** - Return friendly name of an instruction in a string. - Find the instruction id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) - - WARN: when in 'diet' mode, this API is irrelevant because the engine does not - store instruction name. - - @handle: handle returned by cs_open() - @insn_id: instruction id - - @return: string name of the instruction, or NULL if @insn_id is invalid. -*/ -CAPSTONE_EXPORT -const char * CAPSTONE_API cs_insn_name(csh handle, unsigned int insn_id); - -/** - Return friendly name of a group id (that an instruction can belong to) - Find the group id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) - - WARN: when in 'diet' mode, this API is irrelevant because the engine does not - store group name. - - @handle: handle returned by cs_open() - @group_id: group id - - @return: string name of the group, or NULL if @group_id is invalid. -*/ -CAPSTONE_EXPORT -const char * CAPSTONE_API cs_group_name(csh handle, unsigned int group_id); - -/** - Check if a disassembled instruction belong to a particular group. - Find the group id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) - Internally, this simply verifies if @group_id matches any member of insn->groups array. - - NOTE: this API is only valid when detail option is ON (which is OFF by default). - - WARN: when in 'diet' mode, this API is irrelevant because the engine does not - update @groups array. - - @handle: handle returned by cs_open() - @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() - @group_id: group that you want to check if this instruction belong to. - - @return: true if this instruction indeed belongs to the given group, or false otherwise. -*/ -CAPSTONE_EXPORT -bool CAPSTONE_API cs_insn_group(csh handle, const cs_insn *insn, unsigned int group_id); - -/** - Check if a disassembled instruction IMPLICITLY used a particular register. - Find the register id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) - Internally, this simply verifies if @reg_id matches any member of insn->regs_read array. - - NOTE: this API is only valid when detail option is ON (which is OFF by default) - - WARN: when in 'diet' mode, this API is irrelevant because the engine does not - update @regs_read array. - - @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() - @reg_id: register that you want to check if this instruction used it. - - @return: true if this instruction indeed implicitly used the given register, or false otherwise. -*/ -CAPSTONE_EXPORT -bool CAPSTONE_API cs_reg_read(csh handle, const cs_insn *insn, unsigned int reg_id); - -/** - Check if a disassembled instruction IMPLICITLY modified a particular register. - Find the register id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) - Internally, this simply verifies if @reg_id matches any member of insn->regs_write array. - - NOTE: this API is only valid when detail option is ON (which is OFF by default) - - WARN: when in 'diet' mode, this API is irrelevant because the engine does not - update @regs_write array. - - @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() - @reg_id: register that you want to check if this instruction modified it. - - @return: true if this instruction indeed implicitly modified the given register, or false otherwise. -*/ -CAPSTONE_EXPORT -bool CAPSTONE_API cs_reg_write(csh handle, const cs_insn *insn, unsigned int reg_id); - -/** - Count the number of operands of a given type. - Find the operand type in header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) - - NOTE: this API is only valid when detail option is ON (which is OFF by default) - - @handle: handle returned by cs_open() - @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() - @op_type: Operand type to be found. - - @return: number of operands of given type @op_type in instruction @insn, - or -1 on failure. -*/ -CAPSTONE_EXPORT -int CAPSTONE_API cs_op_count(csh handle, const cs_insn *insn, unsigned int op_type); - -/** - Retrieve the position of operand of given type in .operands[] array. - Later, the operand can be accessed using the returned position. - Find the operand type in header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) - - NOTE: this API is only valid when detail option is ON (which is OFF by default) - - @handle: handle returned by cs_open() - @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() - @op_type: Operand type to be found. - @position: position of the operand to be found. This must be in the range - [1, cs_op_count(handle, insn, op_type)] - - @return: index of operand of given type @op_type in .operands[] array - in instruction @insn, or -1 on failure. -*/ -CAPSTONE_EXPORT -int CAPSTONE_API cs_op_index(csh handle, const cs_insn *insn, unsigned int op_type, - unsigned int position); - -/// Type of array to keep the list of registers -typedef uint16_t cs_regs[64]; - -/** - Retrieve all the registers accessed by an instruction, either explicitly or - implicitly. - - WARN: when in 'diet' mode, this API is irrelevant because engine does not - store registers. - - @handle: handle returned by cs_open() - @insn: disassembled instruction structure returned from cs_disasm() or cs_disasm_iter() - @regs_read: on return, this array contains all registers read by instruction. - @regs_read_count: number of registers kept inside @regs_read array. - @regs_write: on return, this array contains all registers written by instruction. - @regs_write_count: number of registers kept inside @regs_write array. - - @return CS_ERR_OK on success, or other value on failure (refer to cs_err enum - for detailed error). -*/ -CAPSTONE_EXPORT -cs_err CAPSTONE_API cs_regs_access(csh handle, const cs_insn *insn, - cs_regs regs_read, uint8_t *regs_read_count, - cs_regs regs_write, uint8_t *regs_write_count); - -#ifdef __cplusplus -} -#endif - -#endif -/* - * Copyright (C) 2009-2019 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_X86_WRITER_H__ -#define __GUM_X86_WRITER_H__ - - - -G_BEGIN_DECLS - -typedef struct _GumX86Writer GumX86Writer; -typedef guint GumCpuReg; -typedef guint GumPtrTarget; - -struct _GumX86Writer -{ - volatile gint ref_count; - - GumCpuType target_cpu; - GumAbiType target_abi; - - guint8 * base; - guint8 * code; - GumAddress pc; - - GumMetalHashTable * label_defs; - GumMetalArray label_refs; -}; - -enum _GumCpuReg -{ - /* 32 bit */ - GUM_REG_EAX = 0, - GUM_REG_ECX, - GUM_REG_EDX, - GUM_REG_EBX, - GUM_REG_ESP, - GUM_REG_EBP, - GUM_REG_ESI, - GUM_REG_EDI, - - GUM_REG_R8D, - GUM_REG_R9D, - GUM_REG_R10D, - GUM_REG_R11D, - GUM_REG_R12D, - GUM_REG_R13D, - GUM_REG_R14D, - GUM_REG_R15D, - - GUM_REG_EIP, - - /* 64 bit */ - GUM_REG_RAX, - GUM_REG_RCX, - GUM_REG_RDX, - GUM_REG_RBX, - GUM_REG_RSP, - GUM_REG_RBP, - GUM_REG_RSI, - GUM_REG_RDI, - - GUM_REG_R8, - GUM_REG_R9, - GUM_REG_R10, - GUM_REG_R11, - GUM_REG_R12, - GUM_REG_R13, - GUM_REG_R14, - GUM_REG_R15, - - GUM_REG_RIP, - - /* Meta */ - GUM_REG_XAX, - GUM_REG_XCX, - GUM_REG_XDX, - GUM_REG_XBX, - GUM_REG_XSP, - GUM_REG_XBP, - GUM_REG_XSI, - GUM_REG_XDI, - - GUM_REG_XIP, - - GUM_REG_NONE -}; - -enum _GumPtrTarget -{ - GUM_PTR_BYTE, - GUM_PTR_DWORD, - GUM_PTR_QWORD -}; - -GUM_API GumX86Writer * gum_x86_writer_new (gpointer code_address); -GUM_API GumX86Writer * gum_x86_writer_ref (GumX86Writer * writer); -GUM_API void gum_x86_writer_unref (GumX86Writer * writer); - -GUM_API void gum_x86_writer_init (GumX86Writer * writer, - gpointer code_address); -GUM_API void gum_x86_writer_clear (GumX86Writer * writer); - -GUM_API void gum_x86_writer_reset (GumX86Writer * writer, - gpointer code_address); -GUM_API void gum_x86_writer_set_target_cpu (GumX86Writer * self, - GumCpuType cpu_type); -GUM_API void gum_x86_writer_set_target_abi (GumX86Writer * self, - GumAbiType abi_type); - -GUM_API gpointer gum_x86_writer_cur (GumX86Writer * self); -GUM_API guint gum_x86_writer_offset (GumX86Writer * self); - -GUM_API gboolean gum_x86_writer_flush (GumX86Writer * self); - -GUM_API GumCpuReg gum_x86_writer_get_cpu_register_for_nth_argument ( - GumX86Writer * self, guint n); - -GUM_API gboolean gum_x86_writer_put_label (GumX86Writer * self, - gconstpointer id); - -GUM_API gboolean gum_x86_writer_can_branch_directly_between (GumAddress from, - GumAddress to); -GUM_API gboolean gum_x86_writer_put_call_address_with_arguments ( - GumX86Writer * self, GumCallingConvention conv, GumAddress func, - guint n_args, ...); -GUM_API gboolean gum_x86_writer_put_call_address_with_arguments_array ( - GumX86Writer * self, GumCallingConvention conv, GumAddress func, - guint n_args, const GumArgument * args); -GUM_API gboolean gum_x86_writer_put_call_address_with_aligned_arguments ( - GumX86Writer * self, GumCallingConvention conv, GumAddress func, - guint n_args, ...); -GUM_API gboolean gum_x86_writer_put_call_address_with_aligned_arguments_array ( - GumX86Writer * self, GumCallingConvention conv, GumAddress func, - guint n_args, const GumArgument * args); -GUM_API gboolean gum_x86_writer_put_call_reg_with_arguments ( - GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, - guint n_args, ...); -GUM_API gboolean gum_x86_writer_put_call_reg_with_arguments_array ( - GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, - guint n_args, const GumArgument * args); -GUM_API gboolean gum_x86_writer_put_call_reg_with_aligned_arguments ( - GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, - guint n_args, ...); -GUM_API gboolean gum_x86_writer_put_call_reg_with_aligned_arguments_array ( - GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, - guint n_args, const GumArgument * args); -GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr_with_arguments ( - GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, - gssize offset, guint n_args, ...); -GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr_with_arguments_array ( - GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, - gssize offset, guint n_args, const GumArgument * args); -GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr_with_aligned_arguments ( - GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, - gssize offset, guint n_args, ...); -GUM_API gboolean - gum_x86_writer_put_call_reg_offset_ptr_with_aligned_arguments_array ( - GumX86Writer * self, GumCallingConvention conv, GumCpuReg reg, - gssize offset, guint n_args, const GumArgument * args); -GUM_API gboolean gum_x86_writer_put_call_address (GumX86Writer * self, - GumAddress address); -GUM_API gboolean gum_x86_writer_put_call_reg (GumX86Writer * self, - GumCpuReg reg); -GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr (GumX86Writer * self, - GumCpuReg reg, gssize offset); -GUM_API gboolean gum_x86_writer_put_call_indirect (GumX86Writer * self, - GumAddress addr); -GUM_API gboolean gum_x86_writer_put_call_indirect_label (GumX86Writer * self, - gconstpointer label_id); -GUM_API void gum_x86_writer_put_call_near_label (GumX86Writer * self, - gconstpointer label_id); -GUM_API void gum_x86_writer_put_leave (GumX86Writer * self); -GUM_API void gum_x86_writer_put_ret (GumX86Writer * self); -GUM_API void gum_x86_writer_put_ret_imm (GumX86Writer * self, - guint16 imm_value); -GUM_API gboolean gum_x86_writer_put_jmp_address (GumX86Writer * self, - GumAddress address); -GUM_API void gum_x86_writer_put_jmp_short_label (GumX86Writer * self, - gconstpointer label_id); -GUM_API void gum_x86_writer_put_jmp_near_label (GumX86Writer * self, - gconstpointer label_id); -GUM_API gboolean gum_x86_writer_put_jmp_reg (GumX86Writer * self, - GumCpuReg reg); -GUM_API gboolean gum_x86_writer_put_jmp_reg_ptr (GumX86Writer * self, - GumCpuReg reg); -GUM_API gboolean gum_x86_writer_put_jmp_reg_offset_ptr (GumX86Writer * self, - GumCpuReg reg, gssize offset); -GUM_API gboolean gum_x86_writer_put_jmp_near_ptr (GumX86Writer * self, - GumAddress address); -GUM_API gboolean gum_x86_writer_put_jcc_short (GumX86Writer * self, - x86_insn instruction_id, gconstpointer target, GumBranchHint hint); -GUM_API gboolean gum_x86_writer_put_jcc_near (GumX86Writer * self, - x86_insn instruction_id, gconstpointer target, GumBranchHint hint); -GUM_API void gum_x86_writer_put_jcc_short_label (GumX86Writer * self, - x86_insn instruction_id, gconstpointer label_id, GumBranchHint hint); -GUM_API void gum_x86_writer_put_jcc_near_label (GumX86Writer * self, - x86_insn instruction_id, gconstpointer label_id, GumBranchHint hint); - -GUM_API gboolean gum_x86_writer_put_add_reg_imm (GumX86Writer * self, - GumCpuReg reg, gssize imm_value); -GUM_API gboolean gum_x86_writer_put_add_reg_reg (GumX86Writer * self, - GumCpuReg dst_reg, GumCpuReg src_reg); -GUM_API gboolean gum_x86_writer_put_add_reg_near_ptr (GumX86Writer * self, - GumCpuReg dst_reg, GumAddress src_address); -GUM_API gboolean gum_x86_writer_put_sub_reg_imm (GumX86Writer * self, - GumCpuReg reg, gssize imm_value); -GUM_API gboolean gum_x86_writer_put_sub_reg_reg (GumX86Writer * self, - GumCpuReg dst_reg, GumCpuReg src_reg); -GUM_API gboolean gum_x86_writer_put_sub_reg_near_ptr (GumX86Writer * self, - GumCpuReg dst_reg, GumAddress src_address); -GUM_API gboolean gum_x86_writer_put_inc_reg (GumX86Writer * self, - GumCpuReg reg); -GUM_API gboolean gum_x86_writer_put_dec_reg (GumX86Writer * self, - GumCpuReg reg); -GUM_API gboolean gum_x86_writer_put_inc_reg_ptr (GumX86Writer * self, - GumPtrTarget target, GumCpuReg reg); -GUM_API gboolean gum_x86_writer_put_dec_reg_ptr (GumX86Writer * self, - GumPtrTarget target, GumCpuReg reg); -GUM_API gboolean gum_x86_writer_put_lock_xadd_reg_ptr_reg (GumX86Writer * self, - GumCpuReg dst_reg, GumCpuReg src_reg); -GUM_API gboolean gum_x86_writer_put_lock_cmpxchg_reg_ptr_reg ( - GumX86Writer * self, GumCpuReg dst_reg, GumCpuReg src_reg); -GUM_API gboolean gum_x86_writer_put_lock_inc_imm32_ptr (GumX86Writer * self, - gpointer target); -GUM_API gboolean gum_x86_writer_put_lock_dec_imm32_ptr (GumX86Writer * self, - gpointer target); - -GUM_API gboolean gum_x86_writer_put_and_reg_reg (GumX86Writer * self, - GumCpuReg dst_reg, GumCpuReg src_reg); -GUM_API gboolean gum_x86_writer_put_and_reg_u32 (GumX86Writer * self, - GumCpuReg reg, guint32 imm_value); -GUM_API gboolean gum_x86_writer_put_shl_reg_u8 (GumX86Writer * self, - GumCpuReg reg, guint8 imm_value); -GUM_API gboolean gum_x86_writer_put_shr_reg_u8 (GumX86Writer * self, - GumCpuReg reg, guint8 imm_value); -GUM_API gboolean gum_x86_writer_put_xor_reg_reg (GumX86Writer * self, - GumCpuReg dst_reg, GumCpuReg src_reg); - -GUM_API gboolean gum_x86_writer_put_mov_reg_reg (GumX86Writer * self, - GumCpuReg dst_reg, GumCpuReg src_reg); -GUM_API gboolean gum_x86_writer_put_mov_reg_u32 (GumX86Writer * self, - GumCpuReg dst_reg, guint32 imm_value); -GUM_API gboolean gum_x86_writer_put_mov_reg_u64 (GumX86Writer * self, - GumCpuReg dst_reg, guint64 imm_value); -GUM_API void gum_x86_writer_put_mov_reg_address (GumX86Writer * self, - GumCpuReg dst_reg, GumAddress address); -GUM_API void gum_x86_writer_put_mov_reg_ptr_u32 (GumX86Writer * self, - GumCpuReg dst_reg, guint32 imm_value); -GUM_API gboolean gum_x86_writer_put_mov_reg_offset_ptr_u32 (GumX86Writer * self, - GumCpuReg dst_reg, gssize dst_offset, guint32 imm_value); -GUM_API void gum_x86_writer_put_mov_reg_ptr_reg (GumX86Writer * self, - GumCpuReg dst_reg, GumCpuReg src_reg); -GUM_API gboolean gum_x86_writer_put_mov_reg_offset_ptr_reg (GumX86Writer * self, - GumCpuReg dst_reg, gssize dst_offset, GumCpuReg src_reg); -GUM_API void gum_x86_writer_put_mov_reg_reg_ptr (GumX86Writer * self, - GumCpuReg dst_reg, GumCpuReg src_reg); -GUM_API gboolean gum_x86_writer_put_mov_reg_reg_offset_ptr (GumX86Writer * self, - GumCpuReg dst_reg, GumCpuReg src_reg, gssize src_offset); -GUM_API gboolean gum_x86_writer_put_mov_reg_base_index_scale_offset_ptr ( - GumX86Writer * self, GumCpuReg dst_reg, GumCpuReg base_reg, - GumCpuReg index_reg, guint8 scale, gssize offset); - -GUM_API gboolean gum_x86_writer_put_mov_reg_near_ptr (GumX86Writer * self, - GumCpuReg dst_reg, GumAddress src_address); -GUM_API gboolean gum_x86_writer_put_mov_near_ptr_reg (GumX86Writer * self, - GumAddress dst_address, GumCpuReg src_reg); - -GUM_API gboolean gum_x86_writer_put_mov_fs_u32_ptr_reg (GumX86Writer * self, - guint32 fs_offset, GumCpuReg src_reg); -GUM_API gboolean gum_x86_writer_put_mov_reg_fs_u32_ptr (GumX86Writer * self, - GumCpuReg dst_reg, guint32 fs_offset); -GUM_API gboolean gum_x86_writer_put_mov_gs_u32_ptr_reg (GumX86Writer * self, - guint32 fs_offset, GumCpuReg src_reg); -GUM_API gboolean gum_x86_writer_put_mov_reg_gs_u32_ptr (GumX86Writer * self, - GumCpuReg dst_reg, guint32 fs_offset); - -GUM_API void gum_x86_writer_put_movq_xmm0_esp_offset_ptr (GumX86Writer * self, - gint8 offset); -GUM_API void gum_x86_writer_put_movq_eax_offset_ptr_xmm0 (GumX86Writer * self, - gint8 offset); -GUM_API void gum_x86_writer_put_movdqu_xmm0_esp_offset_ptr (GumX86Writer * self, - gint8 offset); -GUM_API void gum_x86_writer_put_movdqu_eax_offset_ptr_xmm0 (GumX86Writer * self, - gint8 offset); - -GUM_API gboolean gum_x86_writer_put_lea_reg_reg_offset (GumX86Writer * self, - GumCpuReg dst_reg, GumCpuReg src_reg, gssize src_offset); - -GUM_API gboolean gum_x86_writer_put_xchg_reg_reg_ptr (GumX86Writer * self, - GumCpuReg left_reg, GumCpuReg right_reg); - -GUM_API void gum_x86_writer_put_push_u32 (GumX86Writer * self, - guint32 imm_value); -GUM_API gboolean gum_x86_writer_put_push_near_ptr (GumX86Writer * self, - GumAddress address); -GUM_API gboolean gum_x86_writer_put_push_reg (GumX86Writer * self, - GumCpuReg reg); -GUM_API gboolean gum_x86_writer_put_pop_reg (GumX86Writer * self, - GumCpuReg reg); -GUM_API void gum_x86_writer_put_push_imm_ptr (GumX86Writer * self, - gconstpointer imm_ptr); -GUM_API void gum_x86_writer_put_pushax (GumX86Writer * self); -GUM_API void gum_x86_writer_put_popax (GumX86Writer * self); -GUM_API void gum_x86_writer_put_pushfx (GumX86Writer * self); -GUM_API void gum_x86_writer_put_popfx (GumX86Writer * self); - -GUM_API gboolean gum_x86_writer_put_test_reg_reg (GumX86Writer * self, - GumCpuReg reg_a, GumCpuReg reg_b); -GUM_API gboolean gum_x86_writer_put_test_reg_u32 (GumX86Writer * self, - GumCpuReg reg, guint32 imm_value); -GUM_API gboolean gum_x86_writer_put_cmp_reg_i32 (GumX86Writer * self, - GumCpuReg reg, gint32 imm_value); -GUM_API gboolean gum_x86_writer_put_cmp_reg_offset_ptr_reg (GumX86Writer * self, - GumCpuReg reg_a, gssize offset, GumCpuReg reg_b); -GUM_API void gum_x86_writer_put_cmp_imm_ptr_imm_u32 (GumX86Writer * self, - gconstpointer imm_ptr, guint32 imm_value); -GUM_API gboolean gum_x86_writer_put_cmp_reg_reg (GumX86Writer * self, - GumCpuReg reg_a, GumCpuReg reg_b); -GUM_API void gum_x86_writer_put_clc (GumX86Writer * self); -GUM_API void gum_x86_writer_put_stc (GumX86Writer * self); -GUM_API void gum_x86_writer_put_cld (GumX86Writer * self); -GUM_API void gum_x86_writer_put_std (GumX86Writer * self); - -GUM_API void gum_x86_writer_put_cpuid (GumX86Writer * self); -GUM_API void gum_x86_writer_put_lfence (GumX86Writer * self); -GUM_API void gum_x86_writer_put_rdtsc (GumX86Writer * self); -GUM_API void gum_x86_writer_put_pause (GumX86Writer * self); -GUM_API void gum_x86_writer_put_nop (GumX86Writer * self); -GUM_API void gum_x86_writer_put_breakpoint (GumX86Writer * self); -GUM_API void gum_x86_writer_put_padding (GumX86Writer * self, guint n); -GUM_API void gum_x86_writer_put_nop_padding (GumX86Writer * self, guint n); - -GUM_API void gum_x86_writer_put_u8 (GumX86Writer * self, guint8 value); -GUM_API void gum_x86_writer_put_s8 (GumX86Writer * self, gint8 value); -GUM_API void gum_x86_writer_put_bytes (GumX86Writer * self, const guint8 * data, - guint n); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2010-2020 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_ARM_WRITER_H__ -#define __GUM_ARM_WRITER_H__ - - -#define GUM_ARM_B_MAX_DISTANCE 0x01fffffc - -G_BEGIN_DECLS - -typedef struct _GumArmWriter GumArmWriter; - -struct _GumArmWriter -{ - volatile gint ref_count; - - GumOS target_os; - - guint32 * base; - guint32 * code; - GumAddress pc; - - GumMetalHashTable * label_defs; - GumMetalArray label_refs; - GumMetalArray literal_refs; - const guint32 * earliest_literal_insn; -}; - -GUM_API GumArmWriter * gum_arm_writer_new (gpointer code_address); -GUM_API GumArmWriter * gum_arm_writer_ref (GumArmWriter * writer); -GUM_API void gum_arm_writer_unref (GumArmWriter * writer); - -GUM_API void gum_arm_writer_init (GumArmWriter * writer, gpointer code_address); -GUM_API void gum_arm_writer_clear (GumArmWriter * writer); - -GUM_API void gum_arm_writer_reset (GumArmWriter * writer, - gpointer code_address); -GUM_API void gum_arm_writer_set_target_os (GumArmWriter * self, GumOS os); - -GUM_API gpointer gum_arm_writer_cur (GumArmWriter * self); -GUM_API guint gum_arm_writer_offset (GumArmWriter * self); -GUM_API void gum_arm_writer_skip (GumArmWriter * self, guint n_bytes); - -GUM_API gboolean gum_arm_writer_flush (GumArmWriter * self); - -GUM_API gboolean gum_arm_writer_put_label (GumArmWriter * self, - gconstpointer id); - -GUM_API void gum_arm_writer_put_call_address_with_arguments ( - GumArmWriter * self, GumAddress func, guint n_args, ...); -GUM_API void gum_arm_writer_put_call_address_with_arguments_array ( - GumArmWriter * self, GumAddress func, guint n_args, - const GumArgument * args); - -GUM_API void gum_arm_writer_put_branch_address (GumArmWriter * self, - GumAddress address); - -GUM_API gboolean gum_arm_writer_can_branch_directly_between ( - GumArmWriter * self, GumAddress from, GumAddress to); -GUM_API gboolean gum_arm_writer_put_b_imm (GumArmWriter * self, - GumAddress target); -GUM_API gboolean gum_arm_writer_put_b_cond_imm (GumArmWriter * self, - arm_cc cc, GumAddress target); -GUM_API void gum_arm_writer_put_b_label (GumArmWriter * self, - gconstpointer label_id); -GUM_API void gum_arm_writer_put_b_cond_label (GumArmWriter * self, - arm_cc cc, gconstpointer label_id); -GUM_API gboolean gum_arm_writer_put_bl_imm (GumArmWriter * self, - GumAddress target); -GUM_API gboolean gum_arm_writer_put_blx_imm (GumArmWriter * self, - GumAddress target); -GUM_API void gum_arm_writer_put_bl_label (GumArmWriter * self, - gconstpointer label_id); -GUM_API void gum_arm_writer_put_bx_reg (GumArmWriter * self, arm_reg reg); -GUM_API void gum_arm_writer_put_blx_reg (GumArmWriter * self, arm_reg reg); -GUM_API void gum_arm_writer_put_ret (GumArmWriter * self); - -GUM_API void gum_arm_writer_put_push_registers (GumArmWriter * self, guint n, - ...); -GUM_API void gum_arm_writer_put_pop_registers (GumArmWriter * self, guint n, - ...); - -GUM_API gboolean gum_arm_writer_put_ldr_reg_address (GumArmWriter * self, - arm_reg reg, GumAddress address); -GUM_API gboolean gum_arm_writer_put_ldr_reg_u32 (GumArmWriter * self, - arm_reg reg, guint32 val); -GUM_API gboolean gum_arm_writer_put_ldr_reg_reg_offset (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg, gssize src_offset); -GUM_API gboolean gum_arm_writer_put_ldr_cond_reg_reg_offset ( - GumArmWriter * self, arm_cc cc, arm_reg dst_reg, arm_reg src_reg, - gssize src_offset); -GUM_API void gum_arm_writer_put_ldmia_reg_mask (GumArmWriter * self, - arm_reg reg, guint16 mask); -GUM_API gboolean gum_arm_writer_put_str_reg_reg_offset ( - GumArmWriter * self, arm_reg src_reg, arm_reg dst_reg, - gssize dst_offset); -GUM_API gboolean gum_arm_writer_put_str_cond_reg_reg_offset ( - GumArmWriter * self, arm_cc cc, arm_reg src_reg, - arm_reg dst_reg, gssize dst_offset); -GUM_API void gum_arm_writer_put_mov_reg_reg (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg); -GUM_API void gum_arm_writer_put_mov_reg_reg_shift (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg, arm_shifter shift, - guint16 shift_value); -GUM_API void gum_arm_writer_put_mov_reg_cpsr (GumArmWriter * self, arm_reg reg); -GUM_API void gum_arm_writer_put_mov_cpsr_reg (GumArmWriter * self, arm_reg reg); -GUM_API void gum_arm_writer_put_add_reg_u16 (GumArmWriter * self, - arm_reg dst_reg, guint16 val); -GUM_API void gum_arm_writer_put_add_reg_u32 (GumArmWriter * self, - arm_reg dst_reg, guint32 val); -GUM_API void gum_arm_writer_put_add_reg_reg_imm (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); -GUM_API void gum_arm_writer_put_add_reg_reg_reg (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg1, arm_reg src_reg2); -GUM_API void gum_arm_writer_put_add_reg_reg_reg_shift (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg1, arm_reg src_reg2, arm_shifter shift, - guint16 shift_value); -GUM_API void gum_arm_writer_put_sub_reg_u16 (GumArmWriter * self, - arm_reg dst_reg, guint16 val); -GUM_API void gum_arm_writer_put_sub_reg_u32 (GumArmWriter * self, - arm_reg dst_reg, guint32 val); -GUM_API void gum_arm_writer_put_sub_reg_reg_imm (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); -GUM_API void gum_arm_writer_put_sub_reg_reg_reg (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg1, arm_reg src_reg2); -GUM_API void gum_arm_writer_put_rsb_reg_reg_imm (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); -GUM_API void gum_arm_writer_put_ands_reg_reg_imm (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); -GUM_API void gum_arm_writer_put_cmp_reg_imm (GumArmWriter * self, - arm_reg dst_reg, guint32 imm_val); - -GUM_API void gum_arm_writer_put_nop (GumArmWriter * self); -GUM_API void gum_arm_writer_put_breakpoint (GumArmWriter * self); -GUM_API void gum_arm_writer_put_brk_imm (GumArmWriter * self, - guint16 imm); - -GUM_API void gum_arm_writer_put_instruction (GumArmWriter * self, guint32 insn); -GUM_API gboolean gum_arm_writer_put_bytes (GumArmWriter * self, - const guint8 * data, guint n); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2010-2019 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_THUMB_WRITER_H__ -#define __GUM_THUMB_WRITER_H__ - - -#define GUM_THUMB_B_MAX_DISTANCE 0x00fffffe - -G_BEGIN_DECLS - -typedef struct _GumThumbWriter GumThumbWriter; - -struct _GumThumbWriter -{ - volatile gint ref_count; - - GumOS target_os; - - guint16 * base; - guint16 * code; - GumAddress pc; - - GumMetalHashTable * label_defs; - GumMetalArray label_refs; - GumMetalArray literal_refs; - const guint16 * earliest_literal_insn; -}; - -GUM_API GumThumbWriter * gum_thumb_writer_new (gpointer code_address); -GUM_API GumThumbWriter * gum_thumb_writer_ref (GumThumbWriter * writer); -GUM_API void gum_thumb_writer_unref (GumThumbWriter * writer); - -GUM_API void gum_thumb_writer_init (GumThumbWriter * writer, - gpointer code_address); -GUM_API void gum_thumb_writer_clear (GumThumbWriter * writer); - -GUM_API void gum_thumb_writer_reset (GumThumbWriter * writer, - gpointer code_address); -GUM_API void gum_thumb_writer_set_target_os (GumThumbWriter * self, GumOS os); - -GUM_API gpointer gum_thumb_writer_cur (GumThumbWriter * self); -GUM_API guint gum_thumb_writer_offset (GumThumbWriter * self); -GUM_API void gum_thumb_writer_skip (GumThumbWriter * self, guint n_bytes); - -GUM_API gboolean gum_thumb_writer_flush (GumThumbWriter * self); - -GUM_API gboolean gum_thumb_writer_put_label (GumThumbWriter * self, - gconstpointer id); -GUM_API gboolean gum_thumb_writer_commit_label (GumThumbWriter * self, - gconstpointer id); - -GUM_API void gum_thumb_writer_put_call_address_with_arguments ( - GumThumbWriter * self, GumAddress func, guint n_args, ...); -GUM_API void gum_thumb_writer_put_call_address_with_arguments_array ( - GumThumbWriter * self, GumAddress func, guint n_args, - const GumArgument * args); -GUM_API void gum_thumb_writer_put_call_reg_with_arguments ( - GumThumbWriter * self, arm_reg reg, guint n_args, ...); -GUM_API void gum_thumb_writer_put_call_reg_with_arguments_array ( - GumThumbWriter * self, arm_reg reg, guint n_args, const GumArgument * args); - -GUM_API void gum_thumb_writer_put_branch_address (GumThumbWriter * self, - GumAddress address); - -GUM_API gboolean gum_thumb_writer_can_branch_directly_between ( - GumThumbWriter * self, GumAddress from, GumAddress to); -GUM_API void gum_thumb_writer_put_b_imm (GumThumbWriter * self, - GumAddress target); -GUM_API void gum_thumb_writer_put_b_label (GumThumbWriter * self, - gconstpointer label_id); -GUM_API void gum_thumb_writer_put_b_label_wide (GumThumbWriter * self, - gconstpointer label_id); -GUM_API void gum_thumb_writer_put_bx_reg (GumThumbWriter * self, arm_reg reg); -GUM_API void gum_thumb_writer_put_bl_imm (GumThumbWriter * self, - GumAddress target); -GUM_API void gum_thumb_writer_put_bl_label (GumThumbWriter * self, - gconstpointer label_id); -GUM_API void gum_thumb_writer_put_blx_imm (GumThumbWriter * self, - GumAddress target); -GUM_API void gum_thumb_writer_put_blx_reg (GumThumbWriter * self, arm_reg reg); -GUM_API void gum_thumb_writer_put_cmp_reg_imm (GumThumbWriter * self, - arm_reg reg, guint8 imm_value); -GUM_API void gum_thumb_writer_put_beq_label (GumThumbWriter * self, - gconstpointer label_id); -GUM_API void gum_thumb_writer_put_bne_label (GumThumbWriter * self, - gconstpointer label_id); -GUM_API void gum_thumb_writer_put_b_cond_label (GumThumbWriter * self, - arm_cc cc, gconstpointer label_id); -GUM_API void gum_thumb_writer_put_b_cond_label_wide (GumThumbWriter * self, - arm_cc cc, gconstpointer label_id); -GUM_API void gum_thumb_writer_put_cbz_reg_label (GumThumbWriter * self, - arm_reg reg, gconstpointer label_id); -GUM_API void gum_thumb_writer_put_cbnz_reg_label (GumThumbWriter * self, - arm_reg reg, gconstpointer label_id); - -GUM_API gboolean gum_thumb_writer_put_push_regs (GumThumbWriter * self, - guint n_regs, arm_reg first_reg, ...); -GUM_API gboolean gum_thumb_writer_put_push_regs_array (GumThumbWriter * self, - guint n_regs, const arm_reg * regs); -GUM_API gboolean gum_thumb_writer_put_pop_regs (GumThumbWriter * self, - guint n_regs, arm_reg first_reg, ...); -GUM_API gboolean gum_thumb_writer_put_pop_regs_array (GumThumbWriter * self, - guint n_regs, const arm_reg * regs); -GUM_API gboolean gum_thumb_writer_put_ldr_reg_address (GumThumbWriter * self, - arm_reg reg, GumAddress address); -GUM_API gboolean gum_thumb_writer_put_ldr_reg_u32 (GumThumbWriter * self, - arm_reg reg, guint32 val); -GUM_API void gum_thumb_writer_put_ldr_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_reg src_reg); -GUM_API gboolean gum_thumb_writer_put_ldr_reg_reg_offset (GumThumbWriter * self, - arm_reg dst_reg, arm_reg src_reg, gsize src_offset); -GUM_API void gum_thumb_writer_put_ldrb_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_reg src_reg); -void gum_thumb_writer_put_ldrh_reg_reg (GumThumbWriter * self, arm_reg dst_reg, - arm_reg src_reg); -GUM_API gboolean gum_thumb_writer_put_vldr_reg_reg_offset ( - GumThumbWriter * self, arm_reg dst_reg, arm_reg src_reg, gssize src_offset); -GUM_API void gum_thumb_writer_put_ldmia_reg_mask (GumThumbWriter * self, - arm_reg reg, guint16 mask); -GUM_API void gum_thumb_writer_put_str_reg_reg (GumThumbWriter * self, - arm_reg src_reg, arm_reg dst_reg); -GUM_API gboolean gum_thumb_writer_put_str_reg_reg_offset (GumThumbWriter * self, - arm_reg src_reg, arm_reg dst_reg, gsize dst_offset); -GUM_API void gum_thumb_writer_put_mov_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_reg src_reg); -GUM_API void gum_thumb_writer_put_mov_reg_u8 (GumThumbWriter * self, - arm_reg dst_reg, guint8 imm_value); -GUM_API void gum_thumb_writer_put_mov_reg_cpsr (GumThumbWriter * self, - arm_reg reg); -GUM_API void gum_thumb_writer_put_mov_cpsr_reg (GumThumbWriter * self, - arm_reg reg); -GUM_API gboolean gum_thumb_writer_put_add_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, gssize imm_value); -GUM_API void gum_thumb_writer_put_add_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_reg src_reg); -GUM_API void gum_thumb_writer_put_add_reg_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, arm_reg right_reg); -GUM_API gboolean gum_thumb_writer_put_add_reg_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, gssize right_value); -GUM_API gboolean gum_thumb_writer_put_sub_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, gssize imm_value); -GUM_API void gum_thumb_writer_put_sub_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_reg src_reg); -GUM_API void gum_thumb_writer_put_sub_reg_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, arm_reg right_reg); -GUM_API gboolean gum_thumb_writer_put_sub_reg_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, gssize right_value); -GUM_API gboolean gum_thumb_writer_put_and_reg_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, gssize right_value); -GUM_API gboolean gum_thumb_writer_put_or_reg_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, gssize right_value); -GUM_API gboolean gum_thumb_writer_put_lsl_reg_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, guint8 right_value); -GUM_API gboolean gum_thumb_writer_put_lsls_reg_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, guint8 right_value); -GUM_API gboolean gum_thumb_writer_put_lsrs_reg_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, guint8 right_value); -GUM_API gboolean gum_thumb_writer_put_mrs_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_sysreg src_reg); -GUM_API gboolean gum_thumb_writer_put_msr_reg_reg (GumThumbWriter * self, - arm_sysreg dst_reg, arm_reg src_reg); - -GUM_API void gum_thumb_writer_put_nop (GumThumbWriter * self); -GUM_API void gum_thumb_writer_put_bkpt_imm (GumThumbWriter * self, guint8 imm); -GUM_API void gum_thumb_writer_put_breakpoint (GumThumbWriter * self); - -GUM_API void gum_thumb_writer_put_instruction (GumThumbWriter * self, - guint16 insn); -GUM_API void gum_thumb_writer_put_instruction_wide (GumThumbWriter * self, - guint16 upper, guint16 lower); -GUM_API gboolean gum_thumb_writer_put_bytes (GumThumbWriter * self, - const guint8 * data, guint n); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2014-2020 Ole André Vadla Ravnås - * Copyright (C) 2017 Antonio Ken Iannillo - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_ARM64_WRITER_H__ -#define __GUM_ARM64_WRITER_H__ - - -#define GUM_ARM64_ADRP_MAX_DISTANCE 0xfffff000 -#define GUM_ARM64_B_MAX_DISTANCE 0x07fffffc - -G_BEGIN_DECLS - -typedef struct _GumArm64Writer GumArm64Writer; -typedef guint GumArm64IndexMode; - -struct _GumArm64Writer -{ - volatile gint ref_count; - - GumOS target_os; - GumPtrauthSupport ptrauth_support; - GumAddress (* sign) (GumAddress value); - - guint32 * base; - guint32 * code; - GumAddress pc; - - GumMetalHashTable * label_defs; - GumMetalArray label_refs; - GumMetalArray literal_refs; - const guint32 * earliest_literal_insn; -}; - -enum _GumArm64IndexMode -{ - GUM_INDEX_POST_ADJUST = 1, - GUM_INDEX_SIGNED_OFFSET = 2, - GUM_INDEX_PRE_ADJUST = 3, -}; - -GUM_API GumArm64Writer * gum_arm64_writer_new (gpointer code_address); -GUM_API GumArm64Writer * gum_arm64_writer_ref (GumArm64Writer * writer); -GUM_API void gum_arm64_writer_unref (GumArm64Writer * writer); - -GUM_API void gum_arm64_writer_init (GumArm64Writer * writer, - gpointer code_address); -GUM_API void gum_arm64_writer_clear (GumArm64Writer * writer); - -GUM_API void gum_arm64_writer_reset (GumArm64Writer * writer, - gpointer code_address); - -GUM_API gpointer gum_arm64_writer_cur (GumArm64Writer * self); -GUM_API guint gum_arm64_writer_offset (GumArm64Writer * self); -GUM_API void gum_arm64_writer_skip (GumArm64Writer * self, guint n_bytes); - -GUM_API gboolean gum_arm64_writer_flush (GumArm64Writer * self); - -GUM_API gboolean gum_arm64_writer_put_label (GumArm64Writer * self, - gconstpointer id); - -GUM_API void gum_arm64_writer_put_call_address_with_arguments ( - GumArm64Writer * self, GumAddress func, guint n_args, ...); -GUM_API void gum_arm64_writer_put_call_address_with_arguments_array ( - GumArm64Writer * self, GumAddress func, guint n_args, - const GumArgument * args); -GUM_API void gum_arm64_writer_put_call_reg_with_arguments ( - GumArm64Writer * self, arm64_reg reg, guint n_args, ...); -GUM_API void gum_arm64_writer_put_call_reg_with_arguments_array ( - GumArm64Writer * self, arm64_reg reg, guint n_args, - const GumArgument * args); - -GUM_API void gum_arm64_writer_put_branch_address (GumArm64Writer * self, - GumAddress address); - -GUM_API gboolean gum_arm64_writer_can_branch_directly_between ( - GumArm64Writer * self, GumAddress from, GumAddress to); -GUM_API gboolean gum_arm64_writer_put_b_imm (GumArm64Writer * self, - GumAddress address); -GUM_API void gum_arm64_writer_put_b_label (GumArm64Writer * self, - gconstpointer label_id); -GUM_API void gum_arm64_writer_put_b_cond_label (GumArm64Writer * self, - arm64_cc cc, gconstpointer label_id); -GUM_API gboolean gum_arm64_writer_put_bl_imm (GumArm64Writer * self, - GumAddress address); -GUM_API void gum_arm64_writer_put_bl_label (GumArm64Writer * self, - gconstpointer label_id); -GUM_API gboolean gum_arm64_writer_put_br_reg (GumArm64Writer * self, - arm64_reg reg); -GUM_API gboolean gum_arm64_writer_put_br_reg_no_auth (GumArm64Writer * self, - arm64_reg reg); -GUM_API gboolean gum_arm64_writer_put_blr_reg (GumArm64Writer * self, - arm64_reg reg); -GUM_API gboolean gum_arm64_writer_put_blr_reg_no_auth (GumArm64Writer * self, - arm64_reg reg); -GUM_API void gum_arm64_writer_put_ret (GumArm64Writer * self); -GUM_API void gum_arm64_writer_put_cbz_reg_label (GumArm64Writer * self, - arm64_reg reg, gconstpointer label_id); -GUM_API void gum_arm64_writer_put_cbnz_reg_label (GumArm64Writer * self, - arm64_reg reg, gconstpointer label_id); -GUM_API void gum_arm64_writer_put_tbz_reg_imm_label (GumArm64Writer * self, - arm64_reg reg, guint bit, gconstpointer label_id); -GUM_API void gum_arm64_writer_put_tbnz_reg_imm_label (GumArm64Writer * self, - arm64_reg reg, guint bit, gconstpointer label_id); - -GUM_API gboolean gum_arm64_writer_put_push_reg_reg (GumArm64Writer * self, - arm64_reg reg_a, arm64_reg reg_b); -GUM_API gboolean gum_arm64_writer_put_pop_reg_reg (GumArm64Writer * self, - arm64_reg reg_a, arm64_reg reg_b); -GUM_API void gum_arm64_writer_put_push_all_x_registers (GumArm64Writer * self); -GUM_API void gum_arm64_writer_put_pop_all_x_registers (GumArm64Writer * self); -GUM_API void gum_arm64_writer_put_push_all_q_registers (GumArm64Writer * self); -GUM_API void gum_arm64_writer_put_pop_all_q_registers (GumArm64Writer * self); - -GUM_API gboolean gum_arm64_writer_put_ldr_reg_address (GumArm64Writer * self, - arm64_reg reg, GumAddress address); -GUM_API gboolean gum_arm64_writer_put_ldr_reg_u64 (GumArm64Writer * self, - arm64_reg reg, guint64 val); -GUM_API guint gum_arm64_writer_put_ldr_reg_ref (GumArm64Writer * self, - arm64_reg reg); -GUM_API void gum_arm64_writer_put_ldr_reg_value (GumArm64Writer * self, - guint ref, GumAddress value); -GUM_API gboolean gum_arm64_writer_put_ldr_reg_reg_offset (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg src_reg, gsize src_offset); -GUM_API gboolean gum_arm64_writer_put_ldrsw_reg_reg_offset ( - GumArm64Writer * self, arm64_reg dst_reg, arm64_reg src_reg, - gsize src_offset); -GUM_API gboolean gum_arm64_writer_put_adrp_reg_address (GumArm64Writer * self, - arm64_reg reg, GumAddress address); -GUM_API gboolean gum_arm64_writer_put_str_reg_reg_offset (GumArm64Writer * self, - arm64_reg src_reg, arm64_reg dst_reg, gsize dst_offset); -GUM_API gboolean gum_arm64_writer_put_ldp_reg_reg_reg_offset ( - GumArm64Writer * self, arm64_reg reg_a, arm64_reg reg_b, arm64_reg reg_src, - gssize src_offset, GumArm64IndexMode mode); -GUM_API gboolean gum_arm64_writer_put_stp_reg_reg_reg_offset ( - GumArm64Writer * self, arm64_reg reg_a, arm64_reg reg_b, arm64_reg reg_dst, - gssize dst_offset, GumArm64IndexMode mode); -GUM_API gboolean gum_arm64_writer_put_mov_reg_reg (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg src_reg); -GUM_API gboolean gum_arm64_writer_put_uxtw_reg_reg (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg src_reg); -GUM_API gboolean gum_arm64_writer_put_add_reg_reg_imm (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg left_reg, gsize right_value); -GUM_API gboolean gum_arm64_writer_put_add_reg_reg_reg (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg left_reg, arm64_reg right_reg); -GUM_API gboolean gum_arm64_writer_put_sub_reg_reg_imm (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg left_reg, gsize right_value); -GUM_API gboolean gum_arm64_writer_put_sub_reg_reg_reg (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg left_reg, arm64_reg right_reg); -GUM_API gboolean gum_arm64_writer_put_and_reg_reg_imm (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg left_reg, gsize right_value); -GUM_API gboolean gum_arm64_writer_put_tst_reg_imm (GumArm64Writer * self, - arm64_reg reg, guint64 imm_value); -GUM_API gboolean gum_arm64_writer_put_cmp_reg_reg (GumArm64Writer * self, - arm64_reg reg_a, arm64_reg reg_b); - -GUM_API gboolean gum_arm64_writer_put_xpaci_reg (GumArm64Writer * self, - arm64_reg reg); - -GUM_API void gum_arm64_writer_put_nop (GumArm64Writer * self); -GUM_API void gum_arm64_writer_put_brk_imm (GumArm64Writer * self, guint16 imm); - -GUM_API void gum_arm64_writer_put_instruction (GumArm64Writer * self, - guint32 insn); -GUM_API gboolean gum_arm64_writer_put_bytes (GumArm64Writer * self, - const guint8 * data, guint n); - -GUM_API GumAddress gum_arm64_writer_sign (GumArm64Writer * self, - GumAddress value); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2014-2019 Ole André Vadla Ravnås - * Copyright (C) 2019 Jon Wilson - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_MIPS_WRITER_H__ -#define __GUM_MIPS_WRITER_H__ - - -#define GUM_MIPS_J_MAX_DISTANCE (1 << 28) - -G_BEGIN_DECLS - -typedef struct _GumMipsWriter GumMipsWriter; - -struct _GumMipsWriter -{ - volatile gint ref_count; - - guint32 * base; - guint32 * code; - GumAddress pc; - - GumMetalHashTable * label_defs; - GumMetalArray label_refs; -}; - -GUM_API GumMipsWriter * gum_mips_writer_new (gpointer code_address); -GUM_API GumMipsWriter * gum_mips_writer_ref (GumMipsWriter * writer); -GUM_API void gum_mips_writer_unref (GumMipsWriter * writer); - -GUM_API void gum_mips_writer_init (GumMipsWriter * writer, - gpointer code_address); -GUM_API void gum_mips_writer_clear (GumMipsWriter * writer); - -GUM_API void gum_mips_writer_reset (GumMipsWriter * writer, - gpointer code_address); - -GUM_API gpointer gum_mips_writer_cur (GumMipsWriter * self); -GUM_API guint gum_mips_writer_offset (GumMipsWriter * self); -GUM_API void gum_mips_writer_skip (GumMipsWriter * self, guint n_bytes); - -GUM_API gboolean gum_mips_writer_flush (GumMipsWriter * self); - -GUM_API gboolean gum_mips_writer_put_label (GumMipsWriter * self, - gconstpointer id); - -GUM_API void gum_mips_writer_put_call_address_with_arguments ( - GumMipsWriter * self, GumAddress func, guint n_args, ...); -GUM_API void gum_mips_writer_put_call_address_with_arguments_array ( - GumMipsWriter * self, GumAddress func, guint n_args, - const GumArgument * args); -GUM_API void gum_mips_writer_put_call_reg_with_arguments (GumMipsWriter * self, - mips_reg reg, guint n_args, ...); -GUM_API void gum_mips_writer_put_call_reg_with_arguments_array ( - GumMipsWriter * self, mips_reg reg, guint n_args, const GumArgument * args); - -GUM_API gboolean gum_mips_writer_can_branch_directly_between (GumAddress from, - GumAddress to); -GUM_API gboolean gum_mips_writer_put_j_address (GumMipsWriter * self, - GumAddress address); -GUM_API gboolean gum_mips_writer_put_j_address_without_nop ( - GumMipsWriter * self, GumAddress address); -GUM_API void gum_mips_writer_put_j_label (GumMipsWriter * self, - gconstpointer label_id); -GUM_API void gum_mips_writer_put_jr_reg (GumMipsWriter * self, mips_reg reg); -GUM_API void gum_mips_writer_put_jal_address (GumMipsWriter * self, - guint32 address); -GUM_API void gum_mips_writer_put_jalr_reg (GumMipsWriter * self, mips_reg reg); -GUM_API void gum_mips_writer_put_b_offset (GumMipsWriter * self, gint32 offset); -GUM_API void gum_mips_writer_put_beq_reg_reg_label (GumMipsWriter * self, - mips_reg right_reg, mips_reg left_reg, gconstpointer label_id); -GUM_API void gum_mips_writer_put_ret (GumMipsWriter * self); - -GUM_API void gum_mips_writer_put_la_reg_address (GumMipsWriter * self, - mips_reg reg, GumAddress address); -GUM_API void gum_mips_writer_put_lui_reg_imm (GumMipsWriter * self, - mips_reg reg, guint imm); -GUM_API void gum_mips_writer_put_dsll_reg_reg (GumMipsWriter * self, - mips_reg dst_reg, mips_reg src_reg, guint amount); -GUM_API void gum_mips_writer_put_ori_reg_reg_imm (GumMipsWriter * self, - mips_reg rt, mips_reg rs, guint imm); -GUM_API void gum_mips_writer_put_ld_reg_reg_offset (GumMipsWriter * self, - mips_reg dst_reg, mips_reg src_reg, gsize src_offset); -GUM_API void gum_mips_writer_put_lw_reg_reg_offset (GumMipsWriter * self, - mips_reg dst_reg, mips_reg src_reg, gsize src_offset); -GUM_API void gum_mips_writer_put_sw_reg_reg_offset (GumMipsWriter * self, - mips_reg src_reg, mips_reg dst_reg, gsize dst_offset); -GUM_API void gum_mips_writer_put_move_reg_reg (GumMipsWriter * self, - mips_reg dst_reg, mips_reg src_reg); -GUM_API void gum_mips_writer_put_addu_reg_reg_reg (GumMipsWriter * self, - mips_reg dst_reg, mips_reg left_reg, mips_reg right_reg); -GUM_API void gum_mips_writer_put_addi_reg_reg_imm (GumMipsWriter * self, - mips_reg dst_reg, mips_reg left_reg, gint32 imm); -GUM_API void gum_mips_writer_put_addi_reg_imm (GumMipsWriter * self, - mips_reg dst_reg, gint32 imm); -GUM_API void gum_mips_writer_put_sub_reg_reg_imm (GumMipsWriter * self, - mips_reg dst_reg, mips_reg left_reg, gint32 imm); - -GUM_API void gum_mips_writer_put_push_reg (GumMipsWriter * self, mips_reg reg); -GUM_API void gum_mips_writer_put_pop_reg (GumMipsWriter * self, mips_reg reg); - -GUM_API void gum_mips_writer_put_mfhi_reg (GumMipsWriter * self, mips_reg reg); -GUM_API void gum_mips_writer_put_mflo_reg (GumMipsWriter * self, mips_reg reg); -GUM_API void gum_mips_writer_put_mthi_reg (GumMipsWriter * self, mips_reg reg); -GUM_API void gum_mips_writer_put_mtlo_reg (GumMipsWriter * self, mips_reg reg); - -GUM_API void gum_mips_writer_put_nop (GumMipsWriter * self); -GUM_API void gum_mips_writer_put_break (GumMipsWriter * self); - -GUM_API void gum_mips_writer_put_prologue_trampoline (GumMipsWriter * self, - mips_reg reg, GumAddress address); - -GUM_API void gum_mips_writer_put_instruction (GumMipsWriter * self, - guint32 insn); -GUM_API gboolean gum_mips_writer_put_bytes (GumMipsWriter * self, - const guint8 * data, guint n); - -G_END_DECLS - -#endif - -G_BEGIN_DECLS - -#define GUM_TYPE_STALKER (gum_stalker_get_type ()) -G_DECLARE_FINAL_TYPE (GumStalker, gum_stalker, GUM, STALKER, GObject) - -#define GUM_TYPE_STALKER_TRANSFORMER (gum_stalker_transformer_get_type ()) -G_DECLARE_INTERFACE (GumStalkerTransformer, gum_stalker_transformer, GUM, - STALKER_TRANSFORMER, GObject) - -#define GUM_TYPE_DEFAULT_STALKER_TRANSFORMER \ - (gum_default_stalker_transformer_get_type ()) -G_DECLARE_FINAL_TYPE (GumDefaultStalkerTransformer, - gum_default_stalker_transformer, GUM, DEFAULT_STALKER_TRANSFORMER, - GObject) - -#define GUM_TYPE_CALLBACK_STALKER_TRANSFORMER \ - (gum_callback_stalker_transformer_get_type ()) -G_DECLARE_FINAL_TYPE (GumCallbackStalkerTransformer, - gum_callback_stalker_transformer, GUM, CALLBACK_STALKER_TRANSFORMER, - GObject) - -typedef struct _GumStalkerIterator GumStalkerIterator; -typedef struct _GumStalkerOutput GumStalkerOutput; -typedef union _GumStalkerWriter GumStalkerWriter; -typedef void (* GumStalkerTransformerCallback) (GumStalkerIterator * iterator, - GumStalkerOutput * output, gpointer user_data); -typedef void (* GumStalkerCallout) (GumCpuContext * cpu_context, - gpointer user_data); - -typedef guint GumProbeId; -typedef struct _GumCallSite GumCallSite; -typedef void (* GumCallProbeCallback) (GumCallSite * site, gpointer user_data); - -struct _GumStalkerTransformerInterface -{ - GTypeInterface parent; - - void (* transform_block) (GumStalkerTransformer * self, - GumStalkerIterator * iterator, GumStalkerOutput * output); -}; - -union _GumStalkerWriter -{ - gpointer instance; - GumX86Writer * x86; - GumArmWriter * arm; - GumThumbWriter * thumb; - GumArm64Writer * arm64; - GumMipsWriter * mips; -}; - -struct _GumStalkerOutput -{ - GumStalkerWriter writer; - GumInstructionEncoding encoding; -}; - -struct _GumCallSite -{ - gpointer block_address; - gpointer stack_data; - GumCpuContext * cpu_context; -}; - -GUM_API gboolean gum_stalker_is_supported (void); - -GUM_API GumStalker * gum_stalker_new (void); - -GUM_API void gum_stalker_exclude (GumStalker * self, - const GumMemoryRange * range); - -GUM_API gint gum_stalker_get_trust_threshold (GumStalker * self); -GUM_API void gum_stalker_set_trust_threshold (GumStalker * self, - gint trust_threshold); - -GUM_API void gum_stalker_flush (GumStalker * self); -GUM_API void gum_stalker_stop (GumStalker * self); -GUM_API gboolean gum_stalker_garbage_collect (GumStalker * self); - -GUM_API void gum_stalker_follow_me (GumStalker * self, - GumStalkerTransformer * transformer, GumEventSink * sink); -GUM_API void gum_stalker_unfollow_me (GumStalker * self); -GUM_API gboolean gum_stalker_is_following_me (GumStalker * self); - -GUM_API void gum_stalker_follow (GumStalker * self, GumThreadId thread_id, - GumStalkerTransformer * transformer, GumEventSink * sink); -GUM_API void gum_stalker_unfollow (GumStalker * self, GumThreadId thread_id); - -GUM_API void gum_stalker_activate (GumStalker * self, gconstpointer target); -GUM_API void gum_stalker_deactivate (GumStalker * self); - -GUM_API GumProbeId gum_stalker_add_call_probe (GumStalker * self, - gpointer target_address, GumCallProbeCallback callback, gpointer data, - GDestroyNotify notify); -GUM_API void gum_stalker_remove_call_probe (GumStalker * self, - GumProbeId id); - -#define gum_call_site_get_nth_argument(s, n) \ - gum_cpu_context_get_nth_argument ((s)->cpu_context, n) -#define gum_call_site_replace_nth_argument(s, n, v) \ - gum_cpu_context_replace_nth_argument ((s)->cpu_context, n, v) - -GUM_API GumStalkerTransformer * gum_stalker_transformer_make_default (void); -GUM_API GumStalkerTransformer * gum_stalker_transformer_make_from_callback ( - GumStalkerTransformerCallback callback, gpointer data, - GDestroyNotify data_destroy); - -GUM_API void gum_stalker_transformer_transform_block ( - GumStalkerTransformer * self, GumStalkerIterator * iterator, - GumStalkerOutput * output); - -GUM_API gboolean gum_stalker_iterator_next (GumStalkerIterator * self, - const cs_insn ** insn); -GUM_API void gum_stalker_iterator_keep (GumStalkerIterator * self); -GUM_API void gum_stalker_iterator_put_callout (GumStalkerIterator * self, - GumStalkerCallout callout, gpointer data, GDestroyNotify data_destroy); - -GUM_API void gum_stalker_set_counters_enabled (gboolean enabled); -GUM_API void gum_stalker_dump_counters (void); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2008-2010 Ole André Vadla Ravnås - * Copyright (C) 2008 Christian Berentsen - * Copyright (C) 2020 Matt Oh - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_SYMBOL_UTIL_H__ -#define __GUM_SYMBOL_UTIL_H__ - - -typedef struct _GumDebugSymbolDetails GumDebugSymbolDetails; - -struct _GumDebugSymbolDetails -{ - GumAddress address; - gchar module_name[GUM_MAX_PATH + 1]; - gchar symbol_name[GUM_MAX_SYMBOL_NAME + 1]; - gchar file_name[GUM_MAX_PATH + 1]; - guint line_number; -}; - -G_BEGIN_DECLS - -GUM_API gboolean gum_symbol_details_from_address (gpointer address, - GumDebugSymbolDetails * details); -GUM_API gchar * gum_symbol_name_from_address (gpointer address); - -GUM_API gpointer gum_find_function (const gchar * name); -GUM_API GArray * gum_find_functions_named (const gchar * name); -GUM_API GArray * gum_find_functions_matching (const gchar * str); -GUM_API gboolean gum_load_symbols (const gchar * path); - -G_END_DECLS - -#endif -/* - * Copyright (C) 2010-2014 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_SYS_INTERNALS_H__ -#define __GUM_SYS_INTERNALS_H__ - - -#ifdef G_OS_WIN32 - -# if GLIB_SIZEOF_VOID_P == 4 -# define GUM_TEB_OFFSET_SELF 0x0018 -# define GUM_TEB_OFFSET_TID 0x0024 -# else -# define GUM_TEB_OFFSET_SELF 0x0030 -# define GUM_TEB_OFFSET_TID 0x0048 -# endif - -#endif - -#endif -/* - * Copyright (C) 2010-2017 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_TLS_H__ -#define __GUM_TLS_H__ - - -G_BEGIN_DECLS - -typedef gsize GumTlsKey; - -GUM_API GumTlsKey gum_tls_key_new (void); -GUM_API void gum_tls_key_free (GumTlsKey key); - -GUM_API gpointer gum_tls_key_get_value (GumTlsKey key); -GUM_API void gum_tls_key_set_value (GumTlsKey key, gpointer value); - -G_END_DECLS - -#endif - -G_BEGIN_DECLS - -GUM_API void gum_init (void); -GUM_API void gum_shutdown (void); -GUM_API void gum_deinit (void); - -GUM_API void gum_init_embedded (void); -GUM_API void gum_deinit_embedded (void); - -GUM_API void gum_prepare_to_fork (void); -GUM_API void gum_recover_from_fork_in_parent (void); -GUM_API void gum_recover_from_fork_in_child (void); - -G_END_DECLS - -#endif diff --git a/utils/afl_frida/android/libfrida-gum.a b/utils/afl_frida/android/libfrida-gum.a deleted file mode 100644 index 2da655c8..00000000 Binary files a/utils/afl_frida/android/libfrida-gum.a and /dev/null differ -- cgit 1.4.1 From 9c393adbb953fe5bf6809e5b0feca7be2f52b7f8 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Tue, 26 Jan 2021 17:12:11 +0100 Subject: real fix plus code format --- include/android-ashmem.h | 84 +++++++++++++++++++++++---------------------- src/afl-fuzz-init.c | 28 +++++++++------ src/afl-fuzz-queue.c | 2 +- src/afl-fuzz.c | 2 +- src/afl-showmap.c | 24 ++++++++++--- utils/afl_frida/afl-frida.c | 78 ++++++++++++++++++++++------------------- 6 files changed, 125 insertions(+), 93 deletions(-) (limited to 'utils') diff --git a/include/android-ashmem.h b/include/android-ashmem.h index 6939e06d..91699b27 100644 --- a/include/android-ashmem.h +++ b/include/android-ashmem.h @@ -1,81 +1,83 @@ #ifdef __ANDROID__ -#ifndef _ANDROID_ASHMEM_H -#define _ANDROID_ASHMEM_H - -#include -#include -#include -#include - -#if __ANDROID_API__ >= 26 -#define shmat bionic_shmat -#define shmctl bionic_shmctl -#define shmdt bionic_shmdt -#define shmget bionic_shmget -#endif -#include -#undef shmat -#undef shmctl -#undef shmdt -#undef shmget -#include - -#define ASHMEM_DEVICE "/dev/ashmem" + #ifndef _ANDROID_ASHMEM_H + #define _ANDROID_ASHMEM_H + + #include + #include + #include + #include + + #if __ANDROID_API__ >= 26 + #define shmat bionic_shmat + #define shmctl bionic_shmctl + #define shmdt bionic_shmdt + #define shmget bionic_shmget + #endif + #include + #undef shmat + #undef shmctl + #undef shmdt + #undef shmget + #include + + #define ASHMEM_DEVICE "/dev/ashmem" int shmctl(int __shmid, int __cmd, struct shmid_ds *__buf) { + int ret = 0; if (__cmd == IPC_RMID) { - int length = ioctl(__shmid, ASHMEM_GET_SIZE, NULL); + + int length = ioctl(__shmid, ASHMEM_GET_SIZE, NULL); struct ashmem_pin pin = {0, length}; ret = ioctl(__shmid, ASHMEM_UNPIN, &pin); close(__shmid); + } return ret; + } int shmget(key_t __key, size_t __size, int __shmflg) { - (void) __shmflg; - int fd, ret; + + (void)__shmflg; + int fd, ret; char ourkey[11]; fd = open(ASHMEM_DEVICE, O_RDWR); - if (fd < 0) - return fd; + if (fd < 0) return fd; sprintf(ourkey, "%d", __key); ret = ioctl(fd, ASHMEM_SET_NAME, ourkey); - if (ret < 0) - goto error; + if (ret < 0) goto error; ret = ioctl(fd, ASHMEM_SET_SIZE, __size); - if (ret < 0) - goto error; + if (ret < 0) goto error; return fd; error: close(fd); return ret; + } void *shmat(int __shmid, const void *__shmaddr, int __shmflg) { - (void) __shmflg; - int size; + + (void)__shmflg; + int size; void *ptr; size = ioctl(__shmid, ASHMEM_GET_SIZE, NULL); - if (size < 0) { - return NULL; - } + if (size < 0) { return NULL; } ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, __shmid, 0); - if (ptr == MAP_FAILED) { - return NULL; - } + if (ptr == MAP_FAILED) { return NULL; } return ptr; + } -#endif /* !_ANDROID_ASHMEM_H */ -#endif /* !__ANDROID__ */ + #endif /* !_ANDROID_ASHMEM_H */ +#endif /* !__ANDROID__ */ + diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c index 2cb152a9..ed2010cd 100644 --- a/src/afl-fuzz-init.c +++ b/src/afl-fuzz-init.c @@ -1027,7 +1027,7 @@ void perform_dry_run(afl_state_t *afl) { struct queue_entry *p = afl->queue; - if (!p->disabled && !p->was_fuzzed) { + if (!p->was_fuzzed) { --afl->pending_not_fuzzed; --afl->active_paths; @@ -1128,16 +1128,6 @@ restart_outer_cull_loop: if (!p->cal_failed && p->exec_cksum == q->exec_cksum) { duplicates = 1; - if (!p->disabled && !q->disabled && !p->was_fuzzed && !q->was_fuzzed) { - - --afl->pending_not_fuzzed; - afl->active_paths--; - - } else { - - FATAL("disabled entry? this should not happen, please report!"); - - } // We do not remove any of the memory allocated because for // splicing the data might still be interesting. @@ -1147,6 +1137,14 @@ restart_outer_cull_loop: // we keep the shorter file if (p->len >= q->len) { + if (!p->was_fuzzed) { + + p->was_fuzzed = 1; + --afl->pending_not_fuzzed; + afl->active_paths--; + + } + p->disabled = 1; p->perf_score = 0; q->next = p->next; @@ -1154,6 +1152,14 @@ restart_outer_cull_loop: } else { + if (!q->was_fuzzed) { + + q->was_fuzzed = 1; + --afl->pending_not_fuzzed; + afl->active_paths--; + + } + q->disabled = 1; q->perf_score = 0; if (prev) diff --git a/src/afl-fuzz-queue.c b/src/afl-fuzz-queue.c index 90f969d9..4442b400 100644 --- a/src/afl-fuzz-queue.c +++ b/src/afl-fuzz-queue.c @@ -317,7 +317,7 @@ static u8 check_if_text(afl_state_t *afl, struct queue_entry *q) { if (q->len < AFL_TXT_MIN_LEN) return 0; - u8 *buf; + u8 * buf; int fd; u32 len = q->len, offset = 0, ascii = 0, utf8 = 0; ssize_t comp; diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index 9b62e961..ecf69728 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -339,7 +339,7 @@ int main(int argc, char **argv_orig, char **envp) { afl_state_init(afl, map_size); afl->debug = debug; afl_fsrv_init(&afl->fsrv); - if (debug) { afl->fsrv.debug = true ; } + if (debug) { afl->fsrv.debug = true; } read_afl_environment(afl, envp); if (afl->shm.map_size) { afl->fsrv.map_size = afl->shm.map_size; } diff --git a/src/afl-showmap.c b/src/afl-showmap.c index ab47c602..5a0b6ecf 100644 --- a/src/afl-showmap.c +++ b/src/afl-showmap.c @@ -317,8 +317,16 @@ static void showmap_run_target_forkserver(afl_forkserver_t *fsrv, u8 *mem, } - if (fsrv->trace_bits[0] == 1) { fsrv->trace_bits[0] = 0; have_coverage = 1; } - else { have_coverage = 0; } + if (fsrv->trace_bits[0] == 1) { + + fsrv->trace_bits[0] = 0; + have_coverage = 1; + + } else { + + have_coverage = 0; + + } if (!no_classify) { classify_counts(fsrv); } @@ -493,8 +501,16 @@ static void showmap_run_target(afl_forkserver_t *fsrv, char **argv) { } - if (fsrv->trace_bits[0] == 1) { fsrv->trace_bits[0] = 0; have_coverage = 1; } - else { have_coverage = 0; } + if (fsrv->trace_bits[0] == 1) { + + fsrv->trace_bits[0] = 0; + have_coverage = 1; + + } else { + + have_coverage = 0; + + } if (!no_classify) { classify_counts(fsrv); } diff --git a/utils/afl_frida/afl-frida.c b/utils/afl_frida/afl-frida.c index 087f18e8..bf39be1c 100644 --- a/utils/afl_frida/afl-frida.c +++ b/utils/afl_frida/afl-frida.c @@ -153,7 +153,7 @@ static int enumerate_ranges(const GumRangeDetails *details, } -int main(int argc, char** argv) { +int main(int argc, char **argv) { #ifndef __APPLE__ (void)personality(ADDR_NO_RANDOMIZE); // disable ASLR @@ -166,10 +166,15 @@ int main(int argc, char** argv) { void *dl = NULL; if (argc > 2) { + dl = dlopen(argv[1], RTLD_LAZY); + } else { + dl = dlopen(TARGET_LIBRARY, RTLD_LAZY); + } + if (!dl) { if (argc > 2) @@ -197,17 +202,18 @@ int main(int argc, char** argv) { // END STEP 2 if (!getenv("AFL_FRIDA_TEST_INPUT")) { + gum_init_embedded(); if (!gum_stalker_is_supported()) { - + gum_deinit_embedded(); return 1; - + } - + GumStalker *stalker = gum_stalker_new(); - - GumAddress base_address; + + GumAddress base_address; if (argc > 2) base_address = gum_module_find_base_address(argv[1]); else @@ -215,87 +221,89 @@ int main(int argc, char** argv) { GumMemoryRange code_range; if (argc > 2) gum_module_enumerate_ranges(argv[1], GUM_PAGE_RX, enumerate_ranges, - &code_range); + &code_range); else gum_module_enumerate_ranges(TARGET_LIBRARY, GUM_PAGE_RX, enumerate_ranges, - &code_range); - + &code_range); + guint64 code_start = code_range.base_address; guint64 code_end = code_range.base_address + code_range.size; range_t instr_range = {0, code_start, code_end}; - + printf("Frida instrumentation: base=0x%lx instrumenting=0x%lx-%lx\n", base_address, code_start, code_end); if (!code_start || !code_end) { - + if (argc > 2) fprintf(stderr, "Error: no valid memory address found for %s\n", - argv[1]); + argv[1]); else fprintf(stderr, "Error: no valid memory address found for %s\n", - TARGET_LIBRARY); + TARGET_LIBRARY); exit(-1); - + } - + GumStalkerTransformer *transformer = gum_stalker_transformer_make_from_callback(instr_basic_block, &instr_range, NULL); - + // to ensure that the signatures are not optimized out memcpy(__afl_area_ptr, (void *)AFL_PERSISTENT, sizeof(AFL_PERSISTENT) + 1); memcpy(__afl_area_ptr + 32, (void *)AFL_DEFER_FORKSVR, sizeof(AFL_DEFER_FORKSVR) + 1); __afl_manual_init(); - + // // any expensive target library initialization that has to be done just once // - put that here // - + gum_stalker_follow_me(stalker, transformer, NULL); - + while (__afl_persistent_loop(UINT32_MAX) != 0) { - + previous_pc = 0; // Required! - - #ifdef _DEBUG + +#ifdef _DEBUG fprintf(stderr, "CLIENT crc: %016llx len: %u\n", hash64(__afl_fuzz_ptr, *__afl_fuzz_len), *__afl_fuzz_len); fprintf(stderr, "RECV:"); for (int i = 0; i < *__afl_fuzz_len; i++) fprintf(stderr, "%02x", __afl_fuzz_ptr[i]); fprintf(stderr, "\n"); - #endif - +#endif + // STEP 3: ensure the minimum length is present and setup the target // function to fuzz. - + if (*__afl_fuzz_len > 0) { - + __afl_fuzz_ptr[*__afl_fuzz_len] = 0; // if you need to null terminate (*o_function)(__afl_fuzz_ptr, *__afl_fuzz_len); - + } - + // END STEP 3 - + } - + gum_stalker_unfollow_me(stalker); - + while (gum_stalker_garbage_collect(stalker)) g_usleep(10000); - + g_object_unref(stalker); g_object_unref(transformer); gum_deinit_embedded(); } else { - char buf[8*1024] = {0}; - int count = read(0, buf, sizeof(buf)); - buf[8*1024-1] = '\0'; + + char buf[8 * 1024] = {0}; + int count = read(0, buf, sizeof(buf)); + buf[8 * 1024 - 1] = '\0'; (*o_function)(buf, count); + } return 0; -- cgit 1.4.1 From 47f62eb0ca087bf26e79f2f0ce5935eda2599064 Mon Sep 17 00:00:00 2001 From: Joey Jiaojg <77719320+joeyjiaojg@users.noreply.github.com> Date: Thu, 28 Jan 2021 12:51:45 +0800 Subject: Fix dev branch for android (#710) * android: replace rindex with strrchr * android: support 64bit only due to 128bit integer not supported by 32bit system Co-authored-by: joeyjiaojg@qq.com --- Android.bp | 4 +++- src/afl-fuzz-init.c | 2 +- utils/afl_untracer/afl-untracer.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'utils') diff --git a/Android.bp b/Android.bp index 5d6f0433..ee076d1e 100644 --- a/Android.bp +++ b/Android.bp @@ -36,6 +36,7 @@ cc_defaults { cc_binary { name: "afl-fuzz", host_supported: true, + compile_multilib: "64", defaults: [ "afl-defaults", @@ -64,6 +65,7 @@ cc_binary { "src/afl-common.c", "src/afl-sharedmem.c", "src/afl-forkserver.c", + "src/afl-performance.c", ], } @@ -152,7 +154,7 @@ cc_binary_host { cc_library_static { name: "afl-llvm-rt", - compile_multilib: "both", + compile_multilib: "64", vendor_available: true, host_supported: true, recovery_available: true, diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c index a428923d..5f5e65cd 100644 --- a/src/afl-fuzz-init.c +++ b/src/afl-fuzz-init.c @@ -469,7 +469,7 @@ void read_foreign_testcases(afl_state_t *afl, int first) { if (first) ACTF("Scanning '%s'...", afl->foreign_syncs[iter].dir); time_t ctime_max = 0; - u8 * name = rindex(afl->foreign_syncs[iter].dir, '/'); + u8 * name = strrchr(afl->foreign_syncs[iter].dir, '/'); if (!name) { name = afl->foreign_syncs[iter].dir; } if (!strcmp(name, "queue") || !strcmp(name, "out") || !strcmp(name, "default")) { diff --git a/utils/afl_untracer/afl-untracer.c b/utils/afl_untracer/afl-untracer.c index 695f8dd1..f3894a06 100644 --- a/utils/afl_untracer/afl-untracer.c +++ b/utils/afl_untracer/afl-untracer.c @@ -143,7 +143,7 @@ void read_library_information(void) { b = buf; m = index(buf, '-'); e = index(buf, ' '); - if ((n = rindex(buf, '/')) == NULL) n = rindex(buf, ' '); + if ((n = strrchr(buf, '/')) == NULL) n = strrchr(buf, ' '); if (n && ((*n >= '0' && *n <= '9') || *n == '[' || *n == '{' || *n == '(')) n = NULL; -- cgit 1.4.1 From 1b557d1a7098519b5024179a65c5bea7adc24e92 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Sat, 30 Jan 2021 09:01:06 +0100 Subject: remove warnings --- utils/afl_frida/afl-frida.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'utils') diff --git a/utils/afl_frida/afl-frida.c b/utils/afl_frida/afl-frida.c index bf39be1c..85cf2e9d 100644 --- a/utils/afl_frida/afl-frida.c +++ b/utils/afl_frida/afl-frida.c @@ -78,11 +78,11 @@ extern unsigned int * __afl_fuzz_len; extern unsigned char *__afl_fuzz_ptr; // Notify AFL about persistent mode. -static volatile char AFL_PERSISTENT[] = "##SIG_AFL_PERSISTENT##"; +static volatile char AFL_PERSISTENT[] = "##SIG_AFL_PERSISTENT##\0"; int __afl_persistent_loop(unsigned int); // Notify AFL about deferred forkserver. -static volatile char AFL_DEFER_FORKSVR[] = "##SIG_AFL_DEFER_FORKSRV##"; +static volatile char AFL_DEFER_FORKSVR[] = "##SIG_AFL_DEFER_FORKSRV##\0"; void __afl_manual_init(); // Because we do our own logging. @@ -249,9 +249,9 @@ int main(int argc, char **argv) { &instr_range, NULL); // to ensure that the signatures are not optimized out - memcpy(__afl_area_ptr, (void *)AFL_PERSISTENT, sizeof(AFL_PERSISTENT) + 1); + memcpy(__afl_area_ptr, (void *)AFL_PERSISTENT, sizeof(AFL_PERSISTENT)); memcpy(__afl_area_ptr + 32, (void *)AFL_DEFER_FORKSVR, - sizeof(AFL_DEFER_FORKSVR) + 1); + sizeof(AFL_DEFER_FORKSVR)); __afl_manual_init(); // -- cgit 1.4.1 From 2f96f1e9204f60d0a1b91a01f5da34b64b29cf9b Mon Sep 17 00:00:00 2001 From: van Hauser Date: Sat, 30 Jan 2021 10:28:34 +0100 Subject: afl-frida faster for x86_x64 --- docs/Changelog.md | 6 ++-- utils/afl_frida/afl-frida.c | 87 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 89 insertions(+), 4 deletions(-) (limited to 'utils') diff --git a/docs/Changelog.md b/docs/Changelog.md index dd160b14..329b7520 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -38,10 +38,10 @@ sending a mail to . support (less performant than our own), GCC for old afl-gcc and CLANG for old afl-clang - qemuafl + - ported QASan to qemuafl! see qemu_mode/libqasan/README.md - solved some persistent mode bugs (thanks Dil4rd) - solved an issue when dumping the memory maps (thanks wizche) - - ported QASan to qemuafl - - ported the QASan runtime adding support for Android + - Android support for QASan - unicornafl - Substential speed gains in python bindings for certain use cases - Improved rust bindings @@ -51,7 +51,7 @@ sending a mail to . - LLVM mode is now compiled with -j4, unicorn with all cores. qemu was already building with all cores, the gcc plugin needs only one. - added dummy Makefile to instrumentation/ - - Updated utils/afl_frida to be 5% faster + - Updated utils/afl_frida to be 5% faster, 7% on x86_x64 - Added AFL_KILL_SIGNAL env variable (thanks @v-p-b) - @Edznux added a nice documentation on how to use rpc.statsd with afl++ in docs/rpc_statsd.md, thanks! diff --git a/utils/afl_frida/afl-frida.c b/utils/afl_frida/afl-frida.c index 85cf2e9d..711d8f33 100644 --- a/utils/afl_frida/afl-frida.c +++ b/utils/afl_frida/afl-frida.c @@ -94,6 +94,8 @@ typedef struct { GumAddress base_address; guint64 code_start, code_end; + GumAddress current_log_impl; + uint64_t afl_prev_loc; } range_t; @@ -109,12 +111,58 @@ inline static void afl_maybe_log(guint64 current_pc) { } +#if GUM_NATIVE_CPU == GUM_CPU_AMD64 + +static const guint8 afl_maybe_log_code[] = { + + 0x9c, // pushfq + 0x50, // push rax + 0x51, // push rcx + 0x52, // push rdx + 0x56, // push rsi + + 0x89, 0xf8, // mov eax, edi + 0xc1, 0xe0, 0x08, // shl eax, 8 + 0xc1, 0xef, 0x04, // shr edi, 4 + 0x31, 0xc7, // xor edi, eax + 0x0f, 0xb7, 0xc7, // movzx eax, di + 0x48, 0x8d, 0x0d, 0x30, 0x00, 0x00, 0x00, // lea rcx, sym._afl_area_ptr_ptr + 0x48, 0x8b, 0x09, // mov rcx, qword [rcx] + 0x48, 0x8b, 0x09, // mov rcx, qword [rcx] + 0x48, 0x8d, 0x15, 0x1b, 0x00, 0x00, 0x00, // lea rdx, sym._afl_prev_loc_ptr + 0x48, 0x8b, 0x32, // mov rsi, qword [rdx] + 0x48, 0x8b, 0x36, // mov rsi, qword [rsi] + 0x48, 0x31, 0xc6, // xor rsi, rax + 0xfe, 0x04, 0x31, // inc byte [rcx + rsi] + + 0x48, 0xd1, 0xe8, // shr rax, 1 + 0x48, 0x8b, 0x0a, // mov rcx, qword [rdx] + 0x48, 0x89, 0x01, // mov qword [rcx], rax + + 0x5e, // pop rsi + 0x5a, // pop rdx + 0x59, // pop rcx + 0x58, // pop rax + 0x9d, // popfq + + 0xc3, // ret + // Read-only data goes here: + // uint64_t* afl_prev_loc_ptr + // uint8_t** afl_area_ptr_ptr + // unsigned int afl_instr_rms + +}; + +#else + static void on_basic_block(GumCpuContext *context, gpointer user_data) { afl_maybe_log((guint64)user_data); } +#endif + void instr_basic_block(GumStalkerIterator *iterator, GumStalkerOutput *output, gpointer user_data) { @@ -129,8 +177,45 @@ void instr_basic_block(GumStalkerIterator *iterator, GumStalkerOutput *output, if (instr->address >= range->code_start && instr->address <= range->code_end) { +#if GUM_NATIVE_CPU == GUM_CPU_AMD64 + GumX86Writer *cw = output->writer.x86; + if (range->current_log_impl == 0 || + !gum_x86_writer_can_branch_directly_between( + cw->pc, range->current_log_impl) || + !gum_x86_writer_can_branch_directly_between( + cw->pc + 128, range->current_log_impl)) { + + gconstpointer after_log_impl = cw->code + 1; + + gum_x86_writer_put_jmp_near_label(cw, after_log_impl); + + range->current_log_impl = cw->pc; + gum_x86_writer_put_bytes(cw, afl_maybe_log_code, + sizeof(afl_maybe_log_code)); + + uint64_t *afl_prev_loc_ptr = &range->afl_prev_loc; + uint8_t **afl_area_ptr_ptr = &__afl_area_ptr; + gum_x86_writer_put_bytes(cw, (const guint8 *)&afl_prev_loc_ptr, + sizeof(afl_prev_loc_ptr)); + gum_x86_writer_put_bytes(cw, (const guint8 *)&afl_area_ptr_ptr, + sizeof(afl_area_ptr_ptr)); + gum_x86_writer_put_label(cw, after_log_impl); + + } + + gum_x86_writer_put_lea_reg_reg_offset(cw, GUM_REG_RSP, GUM_REG_RSP, + -GUM_RED_ZONE_SIZE); + gum_x86_writer_put_push_reg(cw, GUM_REG_RDI); + gum_x86_writer_put_mov_reg_address(cw, GUM_REG_RDI, + GUM_ADDRESS(instr->address)); + gum_x86_writer_put_call_address(cw, range->current_log_impl); + gum_x86_writer_put_pop_reg(cw, GUM_REG_RDI); + gum_x86_writer_put_lea_reg_reg_offset(cw, GUM_REG_RSP, GUM_REG_RSP, + GUM_RED_ZONE_SIZE); +#else gum_stalker_iterator_put_callout(iterator, on_basic_block, (gpointer)instr->address, NULL); +#endif begin = FALSE; } @@ -228,7 +313,7 @@ int main(int argc, char **argv) { guint64 code_start = code_range.base_address; guint64 code_end = code_range.base_address + code_range.size; - range_t instr_range = {0, code_start, code_end}; + range_t instr_range = {0, code_start, code_end, 0, 0}; printf("Frida instrumentation: base=0x%lx instrumenting=0x%lx-%lx\n", base_address, code_start, code_end); -- cgit 1.4.1 From e5116c6d55185177413104cad1232ca64e04b844 Mon Sep 17 00:00:00 2001 From: aflpp Date: Sun, 31 Jan 2021 17:29:37 +0100 Subject: fix -Z, remove q->next --- include/afl-fuzz.h | 4 +- include/xxhash.h | 2 +- instrumentation/compare-transform-pass.so.cc | 2 +- src/afl-fuzz-init.c | 102 +++++++++++---------------- src/afl-fuzz-one.c | 3 +- src/afl-fuzz-queue.c | 39 +++++----- src/afl-fuzz-stats.c | 10 +-- src/afl-fuzz.c | 65 +++++------------ utils/afl_untracer/afl-untracer.c | 2 +- utils/libtokencap/libtokencap.so.c | 10 +-- utils/persistent_mode/persistent_demo_new.c | 2 +- utils/persistent_mode/test-instr.c | 2 +- 12 files changed, 100 insertions(+), 143 deletions(-) (limited to 'utils') diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h index e8a21cb5..9b27606c 100644 --- a/include/afl-fuzz.h +++ b/include/afl-fuzz.h @@ -154,6 +154,7 @@ struct queue_entry { u8 *fname; /* File name for the test case */ u32 len; /* Input length */ + u32 id; /* entry number in queue_buf */ u8 colorized, /* Do not run redqueen stage again */ cal_failed; /* Calibration failed? */ @@ -191,8 +192,7 @@ struct queue_entry { u8 * cmplog_colorinput; /* the result buf of colorization */ struct tainted *taint; /* Taint information from CmpLog */ - struct queue_entry *mother, /* queue entry this based on */ - *next; /* Next element, if any */ + struct queue_entry *mother; /* queue entry this based on */ }; diff --git a/include/xxhash.h b/include/xxhash.h index 006d3f3d..3bd56d13 100644 --- a/include/xxhash.h +++ b/include/xxhash.h @@ -287,7 +287,7 @@ typedef uint32_t XXH32_hash_t; #else #include #if UINT_MAX == 0xFFFFFFFFUL -typedef unsigned int XXH32_hash_t; +typedef unsigned int XXH32_hash_t; #else #if ULONG_MAX == 0xFFFFFFFFUL typedef unsigned long XXH32_hash_t; diff --git a/instrumentation/compare-transform-pass.so.cc b/instrumentation/compare-transform-pass.so.cc index da5cf7e9..932540a7 100644 --- a/instrumentation/compare-transform-pass.so.cc +++ b/instrumentation/compare-transform-pass.so.cc @@ -68,7 +68,7 @@ class CompareTransform : public ModulePass { const char *getPassName() const override { #else - StringRef getPassName() const override { + StringRef getPassName() const override { #endif return "transforms compare functions"; diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c index 2a7864f9..56dae48c 100644 --- a/src/afl-fuzz-init.c +++ b/src/afl-fuzz-init.c @@ -817,12 +817,15 @@ void read_testcases(afl_state_t *afl, u8 *directory) { void perform_dry_run(afl_state_t *afl) { - struct queue_entry *q = afl->queue; - u32 cal_failures = 0; + struct queue_entry *q; + u32 cal_failures = 0, idx; u8 * skip_crashes = afl->afl_env.afl_skip_crashes; u8 * use_mem; - while (q) { + for (idx = 0; idx < afl->queued_paths; idx++) { + + q = afl->queue_buf[idx]; + if (unlikely(q->disabled)) { continue; } u8 res; s32 fd; @@ -1052,20 +1055,22 @@ void perform_dry_run(afl_state_t *afl) { p->disabled = 1; p->perf_score = 0; - while (p && p->next != q) - p = p->next; - if (p) - p->next = q->next; - else - afl->queue = q->next; + u32 i = 0; + while (unlikely(afl->queue_buf[i]->disabled)) { + + ++i; + + } + + afl->queue = afl->queue_buf[i]; afl->max_depth = 0; - p = afl->queue; - while (p) { + for (i = 0; i < afl->queued_paths; i++) { - if (p->depth > afl->max_depth) afl->max_depth = p->depth; - p = p->next; + if (!afl->queue_buf[i]->disabled && + afl->queue_buf[i]->depth > afl->max_depth) + afl->max_depth = afl->queue_buf[i]->depth; } @@ -1098,8 +1103,6 @@ void perform_dry_run(afl_state_t *afl) { } - q = q->next; - } if (cal_failures) { @@ -1125,31 +1128,23 @@ void perform_dry_run(afl_state_t *afl) { /* Now we remove all entries from the queue that have a duplicate trace map */ - q = afl->queue; - struct queue_entry *p, *prev = NULL; - int duplicates = 0; - -restart_outer_cull_loop: + u32 duplicates = 0, i; - while (q) { + for (idx = 0; idx < afl->queued_paths; idx++) { - if (q->cal_failed || !q->exec_cksum) { goto next_entry; } + q = afl->queue_buf[idx]; + if (q->disabled || q->cal_failed || !q->exec_cksum) { continue; } - restart_inner_cull_loop: + u32 done = 0; + for (i = idx + 1; i < afl->queued_paths && !done; i++) { - p = q->next; + struct queue_entry *p = afl->queue_buf[i]; + if (p->disabled || p->cal_failed || !p->exec_cksum) { continue; } - while (p) { - - if (!p->cal_failed && p->exec_cksum == q->exec_cksum) { + if (p->exec_cksum == q->exec_cksum) { duplicates = 1; - // We do not remove any of the memory allocated because for - // splicing the data might still be interesting. - // We only decouple them from the linked list. - // This will result in some leaks at exit, but who cares. - // we keep the shorter file if (p->len >= q->len) { @@ -1163,8 +1158,6 @@ restart_outer_cull_loop: p->disabled = 1; p->perf_score = 0; - q->next = p->next; - goto restart_inner_cull_loop; } else { @@ -1178,35 +1171,26 @@ restart_outer_cull_loop: q->disabled = 1; q->perf_score = 0; - if (prev) - prev->next = q = p; - else - afl->queue = q = p; - goto restart_outer_cull_loop; + + done = 1; } } - p = p->next; - } - next_entry: - - prev = q; - q = q->next; - } if (duplicates) { afl->max_depth = 0; - q = afl->queue; - while (q) { - if (q->depth > afl->max_depth) afl->max_depth = q->depth; - q = q->next; + for (idx = 0; idx < afl->queued_paths; idx++) { + + if (!afl->queue_buf[idx]->disabled && + afl->queue_buf[idx]->depth > afl->max_depth) + afl->max_depth = afl->queue_buf[idx]->depth; } @@ -1256,11 +1240,15 @@ static void link_or_copy(u8 *old_path, u8 *new_path) { void pivot_inputs(afl_state_t *afl) { struct queue_entry *q = afl->queue; - u32 id = 0; + u32 id = 0, i; ACTF("Creating hard links for all input files..."); - while (q) { + for (i = 0; i < afl->queued_paths; i++) { + + q = afl->queue_buf[i]; + + if (unlikely(q->disabled)) { continue; } u8 *nfn, *rsl = strrchr(q->fname, '/'); u32 orig_id; @@ -1288,19 +1276,14 @@ void pivot_inputs(afl_state_t *afl) { afl->resuming_fuzz = 1; nfn = alloc_printf("%s/queue/%s", afl->out_dir, rsl); - /* Since we're at it, let's also try to find parent and figure out the + /* Since we're at it, let's also get the parent and figure out the appropriate depth for this entry. */ src_str = strchr(rsl + 3, ':'); if (src_str && sscanf(src_str + 1, "%06u", &src_id) == 1) { - struct queue_entry *s = afl->queue; - while (src_id-- && s) { - - s = s->next; - - } + struct queue_entry *s = afl->queue_buf[src_id]; if (s) { q->depth = s->depth + 1; } @@ -1348,7 +1331,6 @@ void pivot_inputs(afl_state_t *afl) { if (q->passed_det) { mark_as_det_done(afl, q); } - q = q->next; ++id; } diff --git a/src/afl-fuzz-one.c b/src/afl-fuzz-one.c index 0cf889a8..18291fb7 100644 --- a/src/afl-fuzz-one.c +++ b/src/afl-fuzz-one.c @@ -544,7 +544,8 @@ u8 fuzz_one_original(afl_state_t *afl) { if (likely(!afl->old_seed_selection)) orig_perf = perf_score = afl->queue_cur->perf_score; else - orig_perf = perf_score = calculate_score(afl, afl->queue_cur); + afl->queue_cur->perf_score = orig_perf = perf_score = + calculate_score(afl, afl->queue_cur); if (unlikely(perf_score <= 0)) { goto abandon_entry; } diff --git a/src/afl-fuzz-queue.c b/src/afl-fuzz-queue.c index 4442b400..ad3e3b8e 100644 --- a/src/afl-fuzz-queue.c +++ b/src/afl-fuzz-queue.c @@ -143,7 +143,7 @@ void create_alias_table(afl_state_t *afl) { struct queue_entry *q = afl->queue_buf[i]; - if (!q->disabled) { q->perf_score = calculate_score(afl, q); } + if (likely(!q->disabled)) { q->perf_score = calculate_score(afl, q); } sum += q->perf_score; @@ -444,7 +444,6 @@ void add_to_queue(afl_state_t *afl, u8 *fname, u32 len, u8 passed_det) { if (afl->queue_top) { - afl->queue_top->next = q; afl->queue_top = q; } else { @@ -465,6 +464,7 @@ void add_to_queue(afl_state_t *afl, u8 *fname, u32 len, u8 passed_det) { AFL_BUF_PARAM(queue), afl->queued_paths * sizeof(struct queue_entry *)); if (unlikely(!queue_buf)) { PFATAL("alloc"); } queue_buf[afl->queued_paths - 1] = q; + q->id = afl->queued_paths - 1; afl->last_path_time = get_cur_time(); @@ -641,10 +641,9 @@ void cull_queue(afl_state_t *afl) { if (likely(!afl->score_changed || afl->non_instrumented_mode)) { return; } - struct queue_entry *q; - u32 len = (afl->fsrv.map_size >> 3); - u32 i; - u8 * temp_v = afl->map_tmp_buf; + u32 len = (afl->fsrv.map_size >> 3); + u32 i; + u8 *temp_v = afl->map_tmp_buf; afl->score_changed = 0; @@ -653,12 +652,9 @@ void cull_queue(afl_state_t *afl) { afl->queued_favored = 0; afl->pending_favored = 0; - q = afl->queue; - - while (q) { + for (i = 0; i < afl->queued_paths; i++) { - q->favored = 0; - q = q->next; + afl->queue_buf[i]->favored = 0; } @@ -697,12 +693,13 @@ void cull_queue(afl_state_t *afl) { } - q = afl->queue; + for (i = 0; i < afl->queued_paths; i++) { + + if (likely(!afl->queue_buf[i]->disabled)) { - while (q) { + mark_as_redundant(afl, afl->queue_buf[i], !afl->queue_buf[i]->favored); - mark_as_redundant(afl, q, !q->favored); - q = q->next; + } } @@ -852,13 +849,15 @@ u32 calculate_score(afl_state_t *afl, struct queue_entry *q) { // Don't modify perf_score for unfuzzed seeds if (q->fuzz_level == 0) break; - struct queue_entry *queue_it = afl->queue; - while (queue_it) { + u32 i; + for (i = 0; i < afl->queued_paths; i++) { - fuzz_mu += log2(afl->n_fuzz[q->n_fuzz_entry]); - n_paths++; + if (likely(!afl->queue_buf[i]->disabled)) { - queue_it = queue_it->next; + fuzz_mu += log2(afl->n_fuzz[afl->queue_buf[i]->n_fuzz_entry]); + n_paths++; + + } } diff --git a/src/afl-fuzz-stats.c b/src/afl-fuzz-stats.c index 82da8176..7e99bf8f 100644 --- a/src/afl-fuzz-stats.c +++ b/src/afl-fuzz-stats.c @@ -1014,8 +1014,8 @@ void show_stats(afl_state_t *afl) { void show_init_stats(afl_state_t *afl) { - struct queue_entry *q = afl->queue; - u32 min_bits = 0, max_bits = 0, max_len = 0, count = 0; + struct queue_entry *q; + u32 min_bits = 0, max_bits = 0, max_len = 0, count = 0, i; u64 min_us = 0, max_us = 0; u64 avg_us = 0; @@ -1028,7 +1028,10 @@ void show_init_stats(afl_state_t *afl) { } - while (q) { + for (i = 0; i < afl->queued_paths; i++) { + + q = afl->queue_buf[i]; + if (unlikely(q->disabled)) { continue; } if (!min_us || q->exec_us < min_us) { min_us = q->exec_us; } if (q->exec_us > max_us) { max_us = q->exec_us; } @@ -1039,7 +1042,6 @@ void show_init_stats(afl_state_t *afl) { if (q->len > max_len) { max_len = q->len; } ++count; - q = q->next; } diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index 9d9b0434..40d42c11 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -1558,45 +1558,6 @@ int main(int argc, char **argv_orig, char **envp) { perform_dry_run(afl); - /* - if (!user_set_cache && afl->q_testcase_max_cache_size) { - - / * The user defined not a fixed number of entries for the cache. - Hence we autodetect a good value. After the dry run inputs are - trimmed and we know the average and max size of the input seeds. - We use this information to set a fitting size to max entries - based on the cache size. * / - - struct queue_entry *q = afl->queue; - u64 size = 0, count = 0, avg = 0, max = 0; - - while (q) { - - ++count; - size += q->len; - if (max < q->len) { max = q->len; } - q = q->next; - - } - - if (count) { - - avg = size / count; - avg = ((avg + max) / 2) + 1; - - } - - if (avg < 10240) { avg = 10240; } - - afl->q_testcase_max_cache_entries = afl->q_testcase_max_cache_size / avg; - - if (afl->q_testcase_max_cache_entries > 32768) - afl->q_testcase_max_cache_entries = 32768; - - } - - */ - if (afl->q_testcase_max_cache_entries) { afl->q_testcase_cache = @@ -1668,7 +1629,10 @@ int main(int argc, char **argv_orig, char **envp) { if (unlikely(afl->old_seed_selection)) { afl->current_entry = 0; - afl->queue_cur = afl->queue; + while (unlikely(afl->queue_buf[afl->current_entry]->disabled)) { + ++afl->current_entry; + } + afl->queue_cur = afl->queue_buf[afl->current_entry]; if (unlikely(seek_to)) { @@ -1800,12 +1764,14 @@ int main(int argc, char **argv_orig, char **envp) { } - struct queue_entry *q = afl->queue; // we must recalculate the scores of all queue entries - while (q) { + for (i = 0; i < (s32)afl->queued_paths; i++) { + + if (likely(!afl->queue_buf[i]->disabled)) { - update_bitmap_score(afl, q); - q = q->next; + update_bitmap_score(afl, afl->queue_buf[i]); + + } } @@ -1847,8 +1813,15 @@ int main(int argc, char **argv_orig, char **envp) { if (unlikely(afl->old_seed_selection)) { - afl->queue_cur = afl->queue_cur->next; - ++afl->current_entry; + while (++afl->current_entry < afl->queued_paths && + afl->queue_buf[afl->current_entry]->disabled) + ; + if (unlikely(afl->current_entry >= afl->queued_paths || + afl->queue_buf[afl->current_entry] == NULL || + afl->queue_buf[afl->current_entry]->disabled)) + afl->queue_cur = NULL; + else + afl->queue_cur = afl->queue_buf[afl->current_entry]; } diff --git a/utils/afl_untracer/afl-untracer.c b/utils/afl_untracer/afl-untracer.c index f3894a06..d2bad0b9 100644 --- a/utils/afl_untracer/afl-untracer.c +++ b/utils/afl_untracer/afl-untracer.c @@ -284,7 +284,7 @@ library_list_t *find_library(char *name) { // this seems to work for clang too. nice :) requires gcc 4.4+ #pragma GCC push_options #pragma GCC optimize("O0") -void breakpoint(void) { +void breakpoint(void) { if (debug) fprintf(stderr, "Breakpoint function \"breakpoint\" reached.\n"); diff --git a/utils/libtokencap/libtokencap.so.c b/utils/libtokencap/libtokencap.so.c index 3629e804..26033b46 100644 --- a/utils/libtokencap/libtokencap.so.c +++ b/utils/libtokencap/libtokencap.so.c @@ -161,8 +161,8 @@ static void __tokencap_load_mappings(void) { #elif defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ - #if defined __FreeBSD__ - int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, __tokencap_pid}; + #if defined __FreeBSD__ + int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, __tokencap_pid}; #elif defined __OpenBSD__ int mib[] = {CTL_KERN, KERN_PROC_VMMAP, __tokencap_pid}; #elif defined __NetBSD__ @@ -177,7 +177,7 @@ static void __tokencap_load_mappings(void) { #if defined __FreeBSD__ || defined __NetBSD__ len = len * 4 / 3; - #elif defined __OpenBSD__ + #elif defined __OpenBSD__ len -= len % sizeof(struct kinfo_vmentry); #endif @@ -202,8 +202,8 @@ static void __tokencap_load_mappings(void) { #if defined __FreeBSD__ || defined __NetBSD__ - #if defined __FreeBSD__ - size_t size = region->kve_structsize; + #if defined __FreeBSD__ + size_t size = region->kve_structsize; if (size == 0) break; #elif defined __NetBSD__ diff --git a/utils/persistent_mode/persistent_demo_new.c b/utils/persistent_mode/persistent_demo_new.c index 7e694696..ca616236 100644 --- a/utils/persistent_mode/persistent_demo_new.c +++ b/utils/persistent_mode/persistent_demo_new.c @@ -51,7 +51,7 @@ __AFL_FUZZ_INIT(); /* To ensure checks are not optimized out it is recommended to disable code optimization for the fuzzer harness main() */ #pragma clang optimize off -#pragma GCC optimize("O0") +#pragma GCC optimize("O0") int main(int argc, char **argv) { diff --git a/utils/persistent_mode/test-instr.c b/utils/persistent_mode/test-instr.c index 6da511de..2c6b6d77 100644 --- a/utils/persistent_mode/test-instr.c +++ b/utils/persistent_mode/test-instr.c @@ -24,7 +24,7 @@ __AFL_FUZZ_INIT(); /* To ensure checks are not optimized out it is recommended to disable code optimization for the fuzzer harness main() */ #pragma clang optimize off -#pragma GCC optimize("O0") +#pragma GCC optimize("O0") int main(int argc, char **argv) { -- cgit 1.4.1 From cc0210426a5a31d56d8a0e850dcc00d90833afcd Mon Sep 17 00:00:00 2001 From: van Hauser Date: Sun, 31 Jan 2021 17:32:24 +0100 Subject: code-format --- docs/Changelog.md | 1 + include/xxhash.h | 2 +- instrumentation/compare-transform-pass.so.cc | 2 +- src/afl-fuzz.c | 3 +++ utils/afl_untracer/afl-untracer.c | 2 +- utils/libtokencap/libtokencap.so.c | 10 +++++----- utils/persistent_mode/persistent_demo_new.c | 2 +- utils/persistent_mode/test-instr.c | 2 +- 8 files changed, 14 insertions(+), 10 deletions(-) (limited to 'utils') diff --git a/docs/Changelog.md b/docs/Changelog.md index 99bc8b47..ff69c949 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -27,6 +27,7 @@ sending a mail to . - if determinstic mode is active (-D, or -M without -d) then we sync after every queue entry as this can take very long time otherwise - better detection if a target needs a large shared map + - fix for -Z - switched to an even faster RNG - added hghwng's patch for faster trace map analysis - afl-cc diff --git a/include/xxhash.h b/include/xxhash.h index 3bd56d13..006d3f3d 100644 --- a/include/xxhash.h +++ b/include/xxhash.h @@ -287,7 +287,7 @@ typedef uint32_t XXH32_hash_t; #else #include #if UINT_MAX == 0xFFFFFFFFUL -typedef unsigned int XXH32_hash_t; +typedef unsigned int XXH32_hash_t; #else #if ULONG_MAX == 0xFFFFFFFFUL typedef unsigned long XXH32_hash_t; diff --git a/instrumentation/compare-transform-pass.so.cc b/instrumentation/compare-transform-pass.so.cc index 932540a7..da5cf7e9 100644 --- a/instrumentation/compare-transform-pass.so.cc +++ b/instrumentation/compare-transform-pass.so.cc @@ -68,7 +68,7 @@ class CompareTransform : public ModulePass { const char *getPassName() const override { #else - StringRef getPassName() const override { + StringRef getPassName() const override { #endif return "transforms compare functions"; diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index 276074a4..f1f92717 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -1632,8 +1632,11 @@ int main(int argc, char **argv_orig, char **envp) { afl->current_entry = 0; while (unlikely(afl->queue_buf[afl->current_entry]->disabled)) { + ++afl->current_entry; + } + afl->queue_cur = afl->queue_buf[afl->current_entry]; if (unlikely(seek_to)) { diff --git a/utils/afl_untracer/afl-untracer.c b/utils/afl_untracer/afl-untracer.c index d2bad0b9..f3894a06 100644 --- a/utils/afl_untracer/afl-untracer.c +++ b/utils/afl_untracer/afl-untracer.c @@ -284,7 +284,7 @@ library_list_t *find_library(char *name) { // this seems to work for clang too. nice :) requires gcc 4.4+ #pragma GCC push_options #pragma GCC optimize("O0") -void breakpoint(void) { +void breakpoint(void) { if (debug) fprintf(stderr, "Breakpoint function \"breakpoint\" reached.\n"); diff --git a/utils/libtokencap/libtokencap.so.c b/utils/libtokencap/libtokencap.so.c index 26033b46..3629e804 100644 --- a/utils/libtokencap/libtokencap.so.c +++ b/utils/libtokencap/libtokencap.so.c @@ -161,8 +161,8 @@ static void __tokencap_load_mappings(void) { #elif defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ - #if defined __FreeBSD__ - int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, __tokencap_pid}; + #if defined __FreeBSD__ + int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, __tokencap_pid}; #elif defined __OpenBSD__ int mib[] = {CTL_KERN, KERN_PROC_VMMAP, __tokencap_pid}; #elif defined __NetBSD__ @@ -177,7 +177,7 @@ static void __tokencap_load_mappings(void) { #if defined __FreeBSD__ || defined __NetBSD__ len = len * 4 / 3; - #elif defined __OpenBSD__ + #elif defined __OpenBSD__ len -= len % sizeof(struct kinfo_vmentry); #endif @@ -202,8 +202,8 @@ static void __tokencap_load_mappings(void) { #if defined __FreeBSD__ || defined __NetBSD__ - #if defined __FreeBSD__ - size_t size = region->kve_structsize; + #if defined __FreeBSD__ + size_t size = region->kve_structsize; if (size == 0) break; #elif defined __NetBSD__ diff --git a/utils/persistent_mode/persistent_demo_new.c b/utils/persistent_mode/persistent_demo_new.c index ca616236..7e694696 100644 --- a/utils/persistent_mode/persistent_demo_new.c +++ b/utils/persistent_mode/persistent_demo_new.c @@ -51,7 +51,7 @@ __AFL_FUZZ_INIT(); /* To ensure checks are not optimized out it is recommended to disable code optimization for the fuzzer harness main() */ #pragma clang optimize off -#pragma GCC optimize("O0") +#pragma GCC optimize("O0") int main(int argc, char **argv) { diff --git a/utils/persistent_mode/test-instr.c b/utils/persistent_mode/test-instr.c index 2c6b6d77..6da511de 100644 --- a/utils/persistent_mode/test-instr.c +++ b/utils/persistent_mode/test-instr.c @@ -24,7 +24,7 @@ __AFL_FUZZ_INIT(); /* To ensure checks are not optimized out it is recommended to disable code optimization for the fuzzer harness main() */ #pragma clang optimize off -#pragma GCC optimize("O0") +#pragma GCC optimize("O0") int main(int argc, char **argv) { -- cgit 1.4.1 From e954c891a00eac190275417bf40f2eefb56399bb Mon Sep 17 00:00:00 2001 From: Tobias Mayer Date: Mon, 1 Feb 2021 17:32:45 +0100 Subject: Clarify usage of LD_LIBRARY_PATH in afl_frida This will help not *accidentally* trying to set the variable to the library's binary. --- utils/afl_frida/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils') diff --git a/utils/afl_frida/README.md b/utils/afl_frida/README.md index 7743479b..68b62009 100644 --- a/utils/afl_frida/README.md +++ b/utils/afl_frida/README.md @@ -20,7 +20,7 @@ search and edit the `STEP 1`, `STEP 2` and `STEP 3` locations. Example (after modifying afl-frida.c to your needs and compile it): ``` -LD_LIBRARY_PATH=/path/to/the/target/library afl-fuzz -i in -o out -- ./afl-frida +LD_LIBRARY_PATH=/path/to/the/target/library/ afl-fuzz -i in -o out -- ./afl-frida ``` (or even remote via afl-network-proxy). -- cgit 1.4.1 From 8bd70a50b1218f6fe8ff260acf766097190d6747 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Tue, 2 Feb 2021 23:03:52 +0000 Subject: afl-untracer: Mac M1 build update proposal. --- utils/afl_untracer/afl-untracer.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'utils') diff --git a/utils/afl_untracer/afl-untracer.c b/utils/afl_untracer/afl-untracer.c index f3894a06..1f1a10ea 100644 --- a/utils/afl_untracer/afl-untracer.c +++ b/utils/afl_untracer/afl-untracer.c @@ -56,9 +56,9 @@ #include #include #include -#include #if defined(__linux__) + #include #include #elif defined(__APPLE__) && defined(__LP64__) #include @@ -480,6 +480,9 @@ void setup_trap_instrumentation(void) { // Index into the coverage bitmap for the current trap instruction. #ifdef __aarch64__ uint64_t bitmap_index = 0; +#ifdef __APPLE__ + pthread_jit_write_protect_np(0); +#endif #else uint32_t bitmap_index = 0; #endif @@ -508,7 +511,6 @@ void setup_trap_instrumentation(void) { lib_size); lib_addr = (u8 *)lib_base->addr_start; - // Make library code writable. if (mprotect((void *)lib_addr, lib_size, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) @@ -625,8 +627,13 @@ static void sigtrap_handler(int signum, siginfo_t *si, void *context) { // Must re-execute the instruction, so decrement PC by one instruction. ucontext_t *ctx = (ucontext_t *)context; #if defined(__APPLE__) && defined(__LP64__) +#if defined(__x86_64__) ctx->uc_mcontext->__ss.__rip -= 1; addr = ctx->uc_mcontext->__ss.__rip; +#else + ctx->uc_mcontext->__ss.__pc -= 4; + addr = ctx->uc_mcontext->__ss.__pc; +#endif #elif defined(__linux__) #if defined(__x86_64__) || defined(__i386__) ctx->uc_mcontext.gregs[REG_RIP] -= 1; @@ -676,7 +683,9 @@ static void sigtrap_handler(int signum, siginfo_t *si, void *context) { /* the MAIN function */ int main(int argc, char *argv[]) { +#if defined(__linux__) (void)personality(ADDR_NO_RANDOMIZE); // disable ASLR +#endif pid = getpid(); if (getenv("AFL_DEBUG")) debug = 1; -- cgit 1.4.1 From d920104248a6c5387267561382636de404938675 Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Sat, 6 Feb 2021 12:26:35 +0100 Subject: remove compiler warnings --- instrumentation/afl-compiler-rt.o.c | 20 ++++++++++---------- src/afl-cc.c | 4 ++++ utils/aflpp_driver/aflpp_driver.c | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) (limited to 'utils') diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c index 905051c6..ceae15d1 100644 --- a/instrumentation/afl-compiler-rt.o.c +++ b/instrumentation/afl-compiler-rt.o.c @@ -368,8 +368,8 @@ static void __afl_map_shm(void) { if (__afl_map_size && __afl_map_size > MAP_SIZE) { - u8 *map_env = getenv("AFL_MAP_SIZE"); - if (!map_env || atoi(map_env) < MAP_SIZE) { + u8 *map_env = (u8 *)getenv("AFL_MAP_SIZE"); + if (!map_env || atoi((char *)map_env) < MAP_SIZE) { send_forkserver_error(FS_ERROR_MAP_SIZE); _exit(1); @@ -378,7 +378,7 @@ static void __afl_map_shm(void) { } - __afl_area_ptr = shmat(shm_id, (void *)__afl_map_addr, 0); + __afl_area_ptr = (u8 *)shmat(shm_id, (void *)__afl_map_addr, 0); /* Whooooops. */ @@ -405,9 +405,9 @@ static void __afl_map_shm(void) { __afl_map_addr) { - __afl_area_ptr = - mmap((void *)__afl_map_addr, __afl_map_size, PROT_READ | PROT_WRITE, - MAP_FIXED_NOREPLACE | MAP_SHARED | MAP_ANONYMOUS, -1, 0); + __afl_area_ptr = (u8 *)mmap( + (void *)__afl_map_addr, __afl_map_size, PROT_READ | PROT_WRITE, + MAP_FIXED_NOREPLACE | MAP_SHARED | MAP_ANONYMOUS, -1, 0); if (__afl_area_ptr == MAP_FAILED) { @@ -425,7 +425,7 @@ static void __afl_map_shm(void) { if (__afl_final_loc > MAP_INITIAL_SIZE) { - __afl_area_ptr = malloc(__afl_final_loc); + __afl_area_ptr = (u8 *)malloc(__afl_final_loc); } @@ -439,7 +439,7 @@ static void __afl_map_shm(void) { if (__afl_map_size > MAP_INITIAL_SIZE) { - __afl_area_ptr_dummy = malloc(__afl_map_size); + __afl_area_ptr_dummy = (u8 *)malloc(__afl_map_size); if (__afl_area_ptr_dummy) { @@ -505,7 +505,7 @@ static void __afl_map_shm(void) { #else u32 shm_id = atoi(id_str); - __afl_cmp_map = shmat(shm_id, NULL, 0); + __afl_cmp_map = (struct cmp_map *)shmat(shm_id, NULL, 0); #endif __afl_cmp_map_backup = __afl_cmp_map; @@ -1528,7 +1528,7 @@ void __sanitizer_cov_trace_switch(uint64_t val, uint64_t *cases) { // to avoid to call it on .text addresses static int area_is_mapped(void *ptr, size_t len) { - char *p = ptr; + char *p = (char *)ptr; char *page = (char *)((uintptr_t)p & ~(sysconf(_SC_PAGE_SIZE) - 1)); int r = msync(page, (p - page) + len, MS_ASYNC); diff --git a/src/afl-cc.c b/src/afl-cc.c index cf10d9a7..76f4a437 100644 --- a/src/afl-cc.c +++ b/src/afl-cc.c @@ -1840,6 +1840,8 @@ int main(int argc, char **argv, char **envp) { for (i = 0; i < argc; i++) SAYF(" '%s'", argv[i]); SAYF("\n"); + fflush(stdout); + fflush(stderr); } @@ -1880,6 +1882,8 @@ int main(int argc, char **argv, char **envp) { for (i = 0; i < (s32)cc_par_cnt; i++) SAYF(" '%s'", cc_params[i]); SAYF("\n"); + fflush(stdout); + fflush(stderr); } diff --git a/utils/aflpp_driver/aflpp_driver.c b/utils/aflpp_driver/aflpp_driver.c index 7bb929b2..6af79e14 100644 --- a/utils/aflpp_driver/aflpp_driver.c +++ b/utils/aflpp_driver/aflpp_driver.c @@ -173,7 +173,7 @@ size_t LLVMFuzzerMutate(uint8_t *Data, size_t Size, size_t MaxSize) { // Execute any files provided as parameters. static int ExecuteFilesOnyByOne(int argc, char **argv) { - unsigned char *buf = malloc(MAX_FILE); + unsigned char *buf = (unsigned char *)malloc(MAX_FILE); for (int i = 1; i < argc; i++) { int fd = open(argv[i], O_RDONLY); -- cgit 1.4.1 From 209c5ba4657b641bf261da7ac9ce7d3f809109c2 Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Sun, 7 Feb 2021 05:33:02 +0100 Subject: larger map, stats reload fix, code format --- docs/Changelog.md | 2 + instrumentation/afl-compiler-rt.o.c | 2 +- instrumentation/afl-llvm-lto-instrumentation.so.cc | 3 +- qemu_mode/libqasan/dlmalloc.c | 5 ++ src/afl-fuzz-bitmap.c | 3 +- src/afl-fuzz-statsd.c | 63 ++++++++++++---------- utils/afl_untracer/afl-untracer.c | 10 ++-- 7 files changed, 52 insertions(+), 36 deletions(-) (limited to 'utils') diff --git a/docs/Changelog.md b/docs/Changelog.md index e9efdf38..f2041917 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -26,6 +26,8 @@ sending a mail to . `-i` or resumes (as these have most likely already been done) - fix crash for very, very fast targets+systems (thanks to mhlakhani for reporting) + - on restarts (-i)/autoresume (AFL_AUTORESUME) the stats are now + reloaded and used, thanks to Vimal Joseph for this PR! - if determinstic mode is active (-D, or -M without -d) then we sync after every queue entry as this can take very long time otherwise - better detection if a target needs a large shared map diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c index 65a5d3d2..059691ec 100644 --- a/instrumentation/afl-compiler-rt.o.c +++ b/instrumentation/afl-compiler-rt.o.c @@ -70,7 +70,7 @@ run. It will end up as .comm, so it shouldn't be too wasteful. */ #if MAP_SIZE <= 65536 - #define MAP_INITIAL_SIZE 1048576 + #define MAP_INITIAL_SIZE 2097152 #else #define MAP_INITIAL_SIZE MAP_SIZE #endif diff --git a/instrumentation/afl-llvm-lto-instrumentation.so.cc b/instrumentation/afl-llvm-lto-instrumentation.so.cc index fa494f44..841d52e5 100644 --- a/instrumentation/afl-llvm-lto-instrumentation.so.cc +++ b/instrumentation/afl-llvm-lto-instrumentation.so.cc @@ -69,7 +69,8 @@ class AFLLTOPass : public ModulePass { if (getenv("AFL_DEBUG")) debug = 1; if ((ptr = getenv("AFL_LLVM_LTO_STARTID")) != NULL) - if ((afl_global_id = (uint32_t)atoi(ptr)) < 0 || afl_global_id >= MAP_SIZE) + if ((afl_global_id = (uint32_t)atoi(ptr)) < 0 || + afl_global_id >= MAP_SIZE) FATAL("AFL_LLVM_LTO_STARTID value of \"%s\" is not between 0 and %u\n", ptr, MAP_SIZE - 1); diff --git a/qemu_mode/libqasan/dlmalloc.c b/qemu_mode/libqasan/dlmalloc.c index 39ca4301..ce94451d 100644 --- a/qemu_mode/libqasan/dlmalloc.c +++ b/qemu_mode/libqasan/dlmalloc.c @@ -3907,6 +3907,7 @@ static void internal_malloc_stats(mstate m) { clear_smallmap(M, I); \ \ } else if (RTCHECK(B == smallbin_at(M, I) || \ + \ (ok_address(M, B) && B->fd == P))) { \ \ F->bk = B; \ @@ -4117,6 +4118,7 @@ static void internal_malloc_stats(mstate m) { XP->child[1] = R; \ \ } else \ + \ CORRUPTION_ERROR_ACTION(M); \ if (R != 0) { \ \ @@ -4132,6 +4134,7 @@ static void internal_malloc_stats(mstate m) { C0->parent = R; \ \ } else \ + \ CORRUPTION_ERROR_ACTION(M); \ \ } \ @@ -4143,11 +4146,13 @@ static void internal_malloc_stats(mstate m) { C1->parent = R; \ \ } else \ + \ CORRUPTION_ERROR_ACTION(M); \ \ } \ \ } else \ + \ CORRUPTION_ERROR_ACTION(M); \ \ } \ diff --git a/src/afl-fuzz-bitmap.c b/src/afl-fuzz-bitmap.c index 0c4a114e..4ed59364 100644 --- a/src/afl-fuzz-bitmap.c +++ b/src/afl-fuzz-bitmap.c @@ -325,7 +325,8 @@ u8 *describe_op(afl_state_t *afl, u8 new_bits, size_t max_description_len) { } - sprintf(ret + strlen(ret), ",time:%llu", get_cur_time() - afl->start_time); + sprintf(ret + strlen(ret), ",time:%llu", + get_cur_time() + afl->prev_run_time - afl->start_time); if (afl->current_custom_fuzz && afl->current_custom_fuzz->afl_custom_describe) { diff --git a/src/afl-fuzz-statsd.c b/src/afl-fuzz-statsd.c index 69cafd90..461bbbf6 100644 --- a/src/afl-fuzz-statsd.c +++ b/src/afl-fuzz-statsd.c @@ -1,3 +1,8 @@ +/* + * This implements rpc.statsd support, see docs/rpc_statsd.md + * + */ + #include #include #include @@ -226,37 +231,39 @@ int statsd_format_metric(afl_state_t *afl, char *buff, size_t bufflen) { */ if (afl->statsd_metric_format_type == STATSD_TAGS_TYPE_SUFFIX) { - snprintf(buff, bufflen, afl->statsd_metric_format, - afl->queue_cycle ? (afl->queue_cycle - 1) : 0, tags, - afl->cycles_wo_finds, tags, afl->fsrv.total_execs, tags, - afl->fsrv.total_execs / - ((double)(get_cur_time() - afl->start_time) / 1000), - tags, afl->queued_paths, tags, afl->queued_favored, tags, - afl->queued_discovered, tags, afl->queued_imported, tags, - afl->max_depth, tags, afl->current_entry, tags, - afl->pending_favored, tags, afl->pending_not_fuzzed, tags, - afl->queued_variable, tags, afl->unique_crashes, tags, - afl->unique_hangs, tags, afl->total_crashes, tags, - afl->slowest_exec_ms, tags, - count_non_255_bytes(afl, afl->virgin_bits), tags, - afl->var_byte_count, tags, afl->expand_havoc, tags); + snprintf( + buff, bufflen, afl->statsd_metric_format, + afl->queue_cycle ? (afl->queue_cycle - 1) : 0, tags, + afl->cycles_wo_finds, tags, afl->fsrv.total_execs, tags, + afl->fsrv.total_execs / + ((double)(get_cur_time() + afl->prev_run_time - afl->start_time) / + 1000), + tags, afl->queued_paths, tags, afl->queued_favored, tags, + afl->queued_discovered, tags, afl->queued_imported, tags, + afl->max_depth, tags, afl->current_entry, tags, afl->pending_favored, + tags, afl->pending_not_fuzzed, tags, afl->queued_variable, tags, + afl->unique_crashes, tags, afl->unique_hangs, tags, afl->total_crashes, + tags, afl->slowest_exec_ms, tags, + count_non_255_bytes(afl, afl->virgin_bits), tags, afl->var_byte_count, + tags, afl->expand_havoc, tags); } else if (afl->statsd_metric_format_type == STATSD_TAGS_TYPE_MID) { - snprintf(buff, bufflen, afl->statsd_metric_format, tags, - afl->queue_cycle ? (afl->queue_cycle - 1) : 0, tags, - afl->cycles_wo_finds, tags, afl->fsrv.total_execs, tags, - afl->fsrv.total_execs / - ((double)(get_cur_time() - afl->start_time) / 1000), - tags, afl->queued_paths, tags, afl->queued_favored, tags, - afl->queued_discovered, tags, afl->queued_imported, tags, - afl->max_depth, tags, afl->current_entry, tags, - afl->pending_favored, tags, afl->pending_not_fuzzed, tags, - afl->queued_variable, tags, afl->unique_crashes, tags, - afl->unique_hangs, tags, afl->total_crashes, tags, - afl->slowest_exec_ms, tags, - count_non_255_bytes(afl, afl->virgin_bits), tags, - afl->var_byte_count, tags, afl->expand_havoc); + snprintf( + buff, bufflen, afl->statsd_metric_format, tags, + afl->queue_cycle ? (afl->queue_cycle - 1) : 0, tags, + afl->cycles_wo_finds, tags, afl->fsrv.total_execs, tags, + afl->fsrv.total_execs / + ((double)(get_cur_time() + afl->prev_run_time - afl->start_time) / + 1000), + tags, afl->queued_paths, tags, afl->queued_favored, tags, + afl->queued_discovered, tags, afl->queued_imported, tags, + afl->max_depth, tags, afl->current_entry, tags, afl->pending_favored, + tags, afl->pending_not_fuzzed, tags, afl->queued_variable, tags, + afl->unique_crashes, tags, afl->unique_hangs, tags, afl->total_crashes, + tags, afl->slowest_exec_ms, tags, + count_non_255_bytes(afl, afl->virgin_bits), tags, afl->var_byte_count, + tags, afl->expand_havoc); } diff --git a/utils/afl_untracer/afl-untracer.c b/utils/afl_untracer/afl-untracer.c index 1f1a10ea..2baeb58d 100644 --- a/utils/afl_untracer/afl-untracer.c +++ b/utils/afl_untracer/afl-untracer.c @@ -480,9 +480,9 @@ void setup_trap_instrumentation(void) { // Index into the coverage bitmap for the current trap instruction. #ifdef __aarch64__ uint64_t bitmap_index = 0; -#ifdef __APPLE__ + #ifdef __APPLE__ pthread_jit_write_protect_np(0); -#endif + #endif #else uint32_t bitmap_index = 0; #endif @@ -627,13 +627,13 @@ static void sigtrap_handler(int signum, siginfo_t *si, void *context) { // Must re-execute the instruction, so decrement PC by one instruction. ucontext_t *ctx = (ucontext_t *)context; #if defined(__APPLE__) && defined(__LP64__) -#if defined(__x86_64__) + #if defined(__x86_64__) ctx->uc_mcontext->__ss.__rip -= 1; addr = ctx->uc_mcontext->__ss.__rip; -#else + #else ctx->uc_mcontext->__ss.__pc -= 4; addr = ctx->uc_mcontext->__ss.__pc; -#endif + #endif #elif defined(__linux__) #if defined(__x86_64__) || defined(__i386__) ctx->uc_mcontext.gregs[REG_RIP] -= 1; -- cgit 1.4.1 From cebde1f9e69170a27aacfed8befe8b62ac8c6858 Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Mon, 15 Feb 2021 13:52:23 +0100 Subject: ran black on python scripts --- unicorn_mode/helper_scripts/unicorn_dumper_gdb.py | 108 ++++++--- unicorn_mode/helper_scripts/unicorn_dumper_ida.py | 207 +++++++++++++----- unicorn_mode/helper_scripts/unicorn_dumper_lldb.py | 241 +++++++++++++-------- .../helper_scripts/unicorn_dumper_pwndbg.py | 143 +++++++----- .../samples/compcov_x64/compcov_test_harness.py | 76 +++++-- unicorn_mode/samples/simple/simple_test_harness.py | 79 +++++-- .../samples/simple/simple_test_harness_alt.py | 100 ++++++--- unicorn_mode/samples/speedtest/python/harness.py | 6 +- utils/afl_untracer/ida_get_patchpoints.py | 17 +- utils/custom_mutators/XmlMutatorMin.py | 110 ++++++---- utils/custom_mutators/common.py | 12 +- utils/custom_mutators/example.py | 13 +- utils/custom_mutators/simple-chunk-replace.py | 16 +- utils/custom_mutators/wrapper_afl_min.py | 13 +- 14 files changed, 746 insertions(+), 395 deletions(-) (limited to 'utils') diff --git a/unicorn_mode/helper_scripts/unicorn_dumper_gdb.py b/unicorn_mode/helper_scripts/unicorn_dumper_gdb.py index 8c8f9641..1ac4c9f3 100644 --- a/unicorn_mode/helper_scripts/unicorn_dumper_gdb.py +++ b/unicorn_mode/helper_scripts/unicorn_dumper_gdb.py @@ -45,30 +45,31 @@ MAX_SEG_SIZE = 128 * 1024 * 1024 INDEX_FILE_NAME = "_index.json" -#---------------------- -#---- Helper Functions +# ---------------------- +# ---- Helper Functions + def map_arch(): - arch = get_arch() # from GEF - if 'x86_64' in arch or 'x86-64' in arch: + arch = get_arch() # from GEF + if "x86_64" in arch or "x86-64" in arch: return "x64" - elif 'x86' in arch or 'i386' in arch: + elif "x86" in arch or "i386" in arch: return "x86" - elif 'aarch64' in arch or 'arm64' in arch: + elif "aarch64" in arch or "arm64" in arch: return "arm64le" - elif 'aarch64_be' in arch: + elif "aarch64_be" in arch: return "arm64be" - elif 'armeb' in arch: + elif "armeb" in arch: # check for THUMB mode - cpsr = get_register('$cpsr') - if (cpsr & (1 << 5)): + cpsr = get_register("$cpsr") + if cpsr & (1 << 5): return "armbethumb" else: return "armbe" - elif 'arm' in arch: + elif "arm" in arch: # check for THUMB mode - cpsr = get_register('$cpsr') - if (cpsr & (1 << 5)): + cpsr = get_register("$cpsr") + if cpsr & (1 << 5): return "armlethumb" else: return "armle" @@ -76,8 +77,9 @@ def map_arch(): return "" -#----------------------- -#---- Dumping functions +# ----------------------- +# ---- Dumping functions + def dump_arch_info(): arch_info = {} @@ -89,7 +91,7 @@ def dump_regs(): reg_state = {} for reg in current_arch.all_registers: reg_val = get_register(reg) - reg_state[reg.strip().strip('$')] = reg_val + reg_state[reg.strip().strip("$")] = reg_val return reg_state @@ -108,47 +110,76 @@ def dump_process_memory(output_dir): if entry.page_start == entry.page_end: continue - seg_info = {'start': entry.page_start, 'end': entry.page_end, 'name': entry.path, 'permissions': { - "r": entry.is_readable() > 0, - "w": entry.is_writable() > 0, - "x": entry.is_executable() > 0 - }, 'content_file': ''} + seg_info = { + "start": entry.page_start, + "end": entry.page_end, + "name": entry.path, + "permissions": { + "r": entry.is_readable() > 0, + "w": entry.is_writable() > 0, + "x": entry.is_executable() > 0, + }, + "content_file": "", + } # "(deleted)" may or may not be valid, but don't push it. - if entry.is_readable() and not '(deleted)' in entry.path: + if entry.is_readable() and not "(deleted)" in entry.path: try: # Compress and dump the content to a file seg_content = read_memory(entry.page_start, entry.size) - if(seg_content == None): - print("Segment empty: @0x{0:016x} (size:UNKNOWN) {1}".format(entry.page_start, entry.path)) + if seg_content == None: + print( + "Segment empty: @0x{0:016x} (size:UNKNOWN) {1}".format( + entry.page_start, entry.path + ) + ) else: - print("Dumping segment @0x{0:016x} (size:0x{1:x}): {2} [{3}]".format(entry.page_start, len(seg_content), entry.path, repr(seg_info['permissions']))) + print( + "Dumping segment @0x{0:016x} (size:0x{1:x}): {2} [{3}]".format( + entry.page_start, + len(seg_content), + entry.path, + repr(seg_info["permissions"]), + ) + ) compressed_seg_content = zlib.compress(seg_content) md5_sum = hashlib.md5(compressed_seg_content).hexdigest() + ".bin" seg_info["content_file"] = md5_sum # Write the compressed contents to disk - out_file = open(os.path.join(output_dir, md5_sum), 'wb') + out_file = open(os.path.join(output_dir, md5_sum), "wb") out_file.write(compressed_seg_content) out_file.close() except: - print("Exception reading segment ({}): {}".format(entry.path, sys.exc_info()[0])) + print( + "Exception reading segment ({}): {}".format( + entry.path, sys.exc_info()[0] + ) + ) else: - print("Skipping segment {0}@0x{1:016x}".format(entry.path, entry.page_start)) + print( + "Skipping segment {0}@0x{1:016x}".format(entry.path, entry.page_start) + ) # Add the segment to the list final_segment_list.append(seg_info) - return final_segment_list -#--------------------------------------------- -#---- ARM Extention (dump floating point regs) + +# --------------------------------------------- +# ---- ARM Extention (dump floating point regs) + def dump_float(rge=32): reg_convert = "" - if map_arch() == "armbe" or map_arch() == "armle" or map_arch() == "armbethumb" or map_arch() == "armbethumb": + if ( + map_arch() == "armbe" + or map_arch() == "armle" + or map_arch() == "armbethumb" + or map_arch() == "armbethumb" + ): reg_state = {} for reg_num in range(32): value = gdb.selected_frame().read_register("d" + str(reg_num)) @@ -158,8 +189,10 @@ def dump_float(rge=32): return reg_state -#---------- -#---- Main + +# ---------- +# ---- Main + def main(): print("----- Unicorn Context Dumper -----") @@ -175,7 +208,9 @@ def main(): try: # Create the output directory - timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y%m%d_%H%M%S') + timestamp = datetime.datetime.fromtimestamp(time.time()).strftime( + "%Y%m%d_%H%M%S" + ) output_path = "UnicornContext_" + timestamp if not os.path.exists(output_path): os.makedirs(output_path) @@ -190,7 +225,7 @@ def main(): } # Write the index file - index_file = open(os.path.join(output_path, INDEX_FILE_NAME), 'w') + index_file = open(os.path.join(output_path, INDEX_FILE_NAME), "w") index_file.write(json.dumps(context, indent=4)) index_file.close() print("Done.") @@ -198,5 +233,6 @@ def main(): except Exception as e: print("!!! ERROR:\n\t{}".format(repr(e))) + if __name__ == "__main__": main() diff --git a/unicorn_mode/helper_scripts/unicorn_dumper_ida.py b/unicorn_mode/helper_scripts/unicorn_dumper_ida.py index 3f955a5c..fa29fb90 100644 --- a/unicorn_mode/helper_scripts/unicorn_dumper_ida.py +++ b/unicorn_mode/helper_scripts/unicorn_dumper_ida.py @@ -31,8 +31,9 @@ MAX_SEG_SIZE = 128 * 1024 * 1024 # Name of the index file INDEX_FILE_NAME = "_index.json" -#---------------------- -#---- Helper Functions +# ---------------------- +# ---- Helper Functions + def get_arch(): if ph.id == PLFM_386 and ph.flag & PR_USE64: @@ -52,6 +53,7 @@ def get_arch(): else: return "" + def get_register_list(arch): if arch == "arm64le" or arch == "arm64be": arch = "arm64" @@ -59,84 +61,174 @@ def get_register_list(arch): arch = "arm" registers = { - "x64" : [ - "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "rbp", "rsp", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", - "rip", "rsp", "efl", - "cs", "ds", "es", "fs", "gs", "ss", + "x64": [ + "rax", + "rbx", + "rcx", + "rdx", + "rsi", + "rdi", + "rbp", + "rsp", + "r8", + "r9", + "r10", + "r11", + "r12", + "r13", + "r14", + "r15", + "rip", + "rsp", + "efl", + "cs", + "ds", + "es", + "fs", + "gs", + "ss", + ], + "x86": [ + "eax", + "ebx", + "ecx", + "edx", + "esi", + "edi", + "ebp", + "esp", + "eip", + "esp", + "efl", + "cs", + "ds", + "es", + "fs", + "gs", + "ss", ], - "x86" : [ - "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp", - "eip", "esp", "efl", - "cs", "ds", "es", "fs", "gs", "ss", - ], - "arm" : [ - "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", - "R8", "R9", "R10", "R11", "R12", "PC", "SP", "LR", + "arm": [ + "R0", + "R1", + "R2", + "R3", + "R4", + "R5", + "R6", + "R7", + "R8", + "R9", + "R10", + "R11", + "R12", + "PC", + "SP", + "LR", "PSR", ], - "arm64" : [ - "X0", "X1", "X2", "X3", "X4", "X5", "X6", "X7", - "X8", "X9", "X10", "X11", "X12", "X13", "X14", - "X15", "X16", "X17", "X18", "X19", "X20", "X21", - "X22", "X23", "X24", "X25", "X26", "X27", "X28", - "PC", "SP", "FP", "LR", "CPSR" + "arm64": [ + "X0", + "X1", + "X2", + "X3", + "X4", + "X5", + "X6", + "X7", + "X8", + "X9", + "X10", + "X11", + "X12", + "X13", + "X14", + "X15", + "X16", + "X17", + "X18", + "X19", + "X20", + "X21", + "X22", + "X23", + "X24", + "X25", + "X26", + "X27", + "X28", + "PC", + "SP", + "FP", + "LR", + "CPSR" # "NZCV", - ] + ], } - return registers[arch] + return registers[arch] + + +# ----------------------- +# ---- Dumping functions -#----------------------- -#---- Dumping functions def dump_arch_info(): arch_info = {} arch_info["arch"] = get_arch() return arch_info + def dump_regs(): reg_state = {} for reg in get_register_list(get_arch()): reg_state[reg] = GetRegValue(reg) return reg_state + def dump_process_memory(output_dir): # Segment information dictionary segment_list = [] - + # Loop over the segments, fill in the info dictionary for seg_ea in Segments(): seg_start = SegStart(seg_ea) seg_end = SegEnd(seg_ea) seg_size = seg_end - seg_start - + seg_info = {} - seg_info["name"] = SegName(seg_ea) + seg_info["name"] = SegName(seg_ea) seg_info["start"] = seg_start - seg_info["end"] = seg_end - + seg_info["end"] = seg_end + perms = getseg(seg_ea).perm seg_info["permissions"] = { - "r": False if (perms & SEGPERM_READ) == 0 else True, + "r": False if (perms & SEGPERM_READ) == 0 else True, "w": False if (perms & SEGPERM_WRITE) == 0 else True, - "x": False if (perms & SEGPERM_EXEC) == 0 else True, + "x": False if (perms & SEGPERM_EXEC) == 0 else True, } if (perms & SEGPERM_READ) and seg_size <= MAX_SEG_SIZE and isLoaded(seg_start): try: # Compress and dump the content to a file seg_content = get_many_bytes(seg_start, seg_end - seg_start) - if(seg_content == None): - print("Segment empty: {0}@0x{1:016x} (size:UNKNOWN)".format(SegName(seg_ea), seg_ea)) + if seg_content == None: + print( + "Segment empty: {0}@0x{1:016x} (size:UNKNOWN)".format( + SegName(seg_ea), seg_ea + ) + ) seg_info["content_file"] = "" else: - print("Dumping segment {0}@0x{1:016x} (size:{2})".format(SegName(seg_ea), seg_ea, len(seg_content))) + print( + "Dumping segment {0}@0x{1:016x} (size:{2})".format( + SegName(seg_ea), seg_ea, len(seg_content) + ) + ) compressed_seg_content = zlib.compress(seg_content) md5_sum = hashlib.md5(compressed_seg_content).hexdigest() + ".bin" seg_info["content_file"] = md5_sum - + # Write the compressed contents to disk - out_file = open(os.path.join(output_dir, md5_sum), 'wb') + out_file = open(os.path.join(output_dir, md5_sum), "wb") out_file.write(compressed_seg_content) out_file.close() except: @@ -145,12 +237,13 @@ def dump_process_memory(output_dir): else: print("Skipping segment {0}@0x{1:016x}".format(SegName(seg_ea), seg_ea)) seg_info["content_file"] = "" - + # Add the segment to the list - segment_list.append(seg_info) - + segment_list.append(seg_info) + return segment_list + """ TODO: FINISH IMPORT DUMPING def import_callback(ea, name, ord): @@ -169,41 +262,47 @@ def dump_imports(): return import_dict """ - -#---------- -#---- Main - + +# ---------- +# ---- Main + + def main(): try: print("----- Unicorn Context Dumper -----") print("You must be actively debugging before running this!") - print("If it fails, double check that you are actively debugging before running.") + print( + "If it fails, double check that you are actively debugging before running." + ) # Create the output directory - timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y%m%d_%H%M%S') + timestamp = datetime.datetime.fromtimestamp(time.time()).strftime( + "%Y%m%d_%H%M%S" + ) output_path = os.path.dirname(os.path.abspath(GetIdbPath())) output_path = os.path.join(output_path, "UnicornContext_" + timestamp) if not os.path.exists(output_path): os.makedirs(output_path) print("Process context will be output to {}".format(output_path)) - + # Get the context context = { "arch": dump_arch_info(), - "regs": dump_regs(), + "regs": dump_regs(), "segments": dump_process_memory(output_path), - #"imports": dump_imports(), + # "imports": dump_imports(), } # Write the index file - index_file = open(os.path.join(output_path, INDEX_FILE_NAME), 'w') + index_file = open(os.path.join(output_path, INDEX_FILE_NAME), "w") index_file.write(json.dumps(context, indent=4)) - index_file.close() + index_file.close() print("Done.") - + except Exception, e: print("!!! ERROR:\n\t{}".format(str(e))) - + + if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/unicorn_mode/helper_scripts/unicorn_dumper_lldb.py b/unicorn_mode/helper_scripts/unicorn_dumper_lldb.py index 3c019d77..179d062a 100644 --- a/unicorn_mode/helper_scripts/unicorn_dumper_lldb.py +++ b/unicorn_mode/helper_scripts/unicorn_dumper_lldb.py @@ -50,10 +50,11 @@ UNICORN_PAGE_SIZE = 0x1000 # Alignment functions to align all memory segments to Unicorn page boundaries (4KB pages only) ALIGN_PAGE_DOWN = lambda x: x & ~(UNICORN_PAGE_SIZE - 1) -ALIGN_PAGE_UP = lambda x: (x + UNICORN_PAGE_SIZE - 1) & ~(UNICORN_PAGE_SIZE-1) +ALIGN_PAGE_UP = lambda x: (x + UNICORN_PAGE_SIZE - 1) & ~(UNICORN_PAGE_SIZE - 1) + +# ---------------------- +# ---- Helper Functions -#---------------------- -#---- Helper Functions def overlap_alignments(segments, memory): final_list = [] @@ -61,33 +62,40 @@ def overlap_alignments(segments, memory): curr_end_addr = 0 curr_node = None current_segment = None - sorted_segments = sorted(segments, key=lambda k: (k['start'], k['end'])) + sorted_segments = sorted(segments, key=lambda k: (k["start"], k["end"])) if curr_seg_idx < len(sorted_segments): current_segment = sorted_segments[curr_seg_idx] - for mem in sorted(memory, key=lambda k: (k['start'], -k['end'])): + for mem in sorted(memory, key=lambda k: (k["start"], -k["end"])): if curr_node is None: - if current_segment is not None and current_segment['start'] == mem['start']: + if current_segment is not None and current_segment["start"] == mem["start"]: curr_node = deepcopy(current_segment) - curr_node['permissions'] = mem['permissions'] + curr_node["permissions"] = mem["permissions"] else: curr_node = deepcopy(mem) - curr_end_addr = curr_node['end'] - - while curr_end_addr <= mem['end']: - if curr_node['end'] == mem['end']: - if current_segment is not None and current_segment['start'] > curr_node['start'] and current_segment['start'] < curr_node['end']: - curr_node['end'] = current_segment['start'] - if(curr_node['end'] > curr_node['start']): + curr_end_addr = curr_node["end"] + + while curr_end_addr <= mem["end"]: + if curr_node["end"] == mem["end"]: + if ( + current_segment is not None + and current_segment["start"] > curr_node["start"] + and current_segment["start"] < curr_node["end"] + ): + curr_node["end"] = current_segment["start"] + if curr_node["end"] > curr_node["start"]: final_list.append(curr_node) curr_node = deepcopy(current_segment) - curr_node['permissions'] = mem['permissions'] - curr_end_addr = curr_node['end'] + curr_node["permissions"] = mem["permissions"] + curr_end_addr = curr_node["end"] else: - if(curr_node['end'] > curr_node['start']): + if curr_node["end"] > curr_node["start"]: final_list.append(curr_node) # if curr_node is a segment - if current_segment is not None and current_segment['end'] == mem['end']: + if ( + current_segment is not None + and current_segment["end"] == mem["end"] + ): curr_seg_idx += 1 if curr_seg_idx < len(sorted_segments): current_segment = sorted_segments[curr_seg_idx] @@ -98,50 +106,56 @@ def overlap_alignments(segments, memory): break # could only be a segment else: - if curr_node['end'] < mem['end']: + if curr_node["end"] < mem["end"]: # check for remaining segments and valid segments - if(curr_node['end'] > curr_node['start']): + if curr_node["end"] > curr_node["start"]: final_list.append(curr_node) - + curr_seg_idx += 1 if curr_seg_idx < len(sorted_segments): current_segment = sorted_segments[curr_seg_idx] else: current_segment = None - - if current_segment is not None and current_segment['start'] <= curr_end_addr and current_segment['start'] < mem['end']: + + if ( + current_segment is not None + and current_segment["start"] <= curr_end_addr + and current_segment["start"] < mem["end"] + ): curr_node = deepcopy(current_segment) - curr_node['permissions'] = mem['permissions'] + curr_node["permissions"] = mem["permissions"] else: # no more segments curr_node = deepcopy(mem) - - curr_node['start'] = curr_end_addr - curr_end_addr = curr_node['end'] - return final_list + curr_node["start"] = curr_end_addr + curr_end_addr = curr_node["end"] + + return final_list + # https://github.com/llvm-mirror/llvm/blob/master/include/llvm/ADT/Triple.h def get_arch(): - arch, arch_vendor, arch_os = lldb.target.GetTriple().split('-') - if arch == 'x86_64': + arch, arch_vendor, arch_os = lldb.target.GetTriple().split("-") + if arch == "x86_64": return "x64" - elif arch == 'x86' or arch == 'i386': + elif arch == "x86" or arch == "i386": return "x86" - elif arch == 'aarch64' or arch == 'arm64': + elif arch == "aarch64" or arch == "arm64": return "arm64le" - elif arch == 'aarch64_be': + elif arch == "aarch64_be": return "arm64be" - elif arch == 'armeb': + elif arch == "armeb": return "armbe" - elif arch == 'arm': + elif arch == "arm": return "armle" else: return "" -#----------------------- -#---- Dumping functions +# ----------------------- +# ---- Dumping functions + def dump_arch_info(): arch_info = {} @@ -152,56 +166,64 @@ def dump_arch_info(): def dump_regs(): reg_state = {} for reg_list in lldb.frame.GetRegisters(): - if 'general purpose registers' in reg_list.GetName().lower(): + if "general purpose registers" in reg_list.GetName().lower(): for reg in reg_list: reg_state[reg.GetName()] = int(reg.GetValue(), 16) return reg_state + def get_section_info(sec): - name = sec.name if sec.name is not None else '' + name = sec.name if sec.name is not None else "" if sec.GetParent().name is not None: - name = sec.GetParent().name + '.' + sec.name + name = sec.GetParent().name + "." + sec.name module_name = sec.addr.module.file.GetFilename() - module_name = module_name if module_name is not None else '' - long_name = module_name + '.' + name - + module_name = module_name if module_name is not None else "" + long_name = module_name + "." + name + return sec.addr.load_addr, (sec.addr.load_addr + sec.size), sec.size, long_name - + def dump_process_memory(output_dir): # Segment information dictionary raw_segment_list = [] raw_memory_list = [] - + # 1st pass: # Loop over the segments, fill in the segment info dictionary for module in lldb.target.module_iter(): for seg_ea in module.section_iter(): - seg_info = {'module': module.file.GetFilename() } - seg_info['start'], seg_info['end'], seg_size, seg_info['name'] = get_section_info(seg_ea) + seg_info = {"module": module.file.GetFilename()} + ( + seg_info["start"], + seg_info["end"], + seg_size, + seg_info["name"], + ) = get_section_info(seg_ea) # TODO: Ugly hack for -1 LONG address on 32-bit - if seg_info['start'] >= sys.maxint or seg_size <= 0: - print "Throwing away page: {}".format(seg_info['name']) + if seg_info["start"] >= sys.maxint or seg_size <= 0: + print "Throwing away page: {}".format(seg_info["name"]) continue # Page-align segment - seg_info['start'] = ALIGN_PAGE_DOWN(seg_info['start']) - seg_info['end'] = ALIGN_PAGE_UP(seg_info['end']) - print("Appending: {}".format(seg_info['name'])) + seg_info["start"] = ALIGN_PAGE_DOWN(seg_info["start"]) + seg_info["end"] = ALIGN_PAGE_UP(seg_info["end"]) + print ("Appending: {}".format(seg_info["name"])) raw_segment_list.append(seg_info) # Add the stack memory region (just hardcode 0x1000 around the current SP) sp = lldb.frame.GetSP() start_sp = ALIGN_PAGE_DOWN(sp) - raw_segment_list.append({'start': start_sp, 'end': start_sp + 0x1000, 'name': 'STACK'}) + raw_segment_list.append( + {"start": start_sp, "end": start_sp + 0x1000, "name": "STACK"} + ) # Write the original memory to file for debugging - index_file = open(os.path.join(output_dir, DEBUG_MEM_FILE_NAME), 'w') + index_file = open(os.path.join(output_dir, DEBUG_MEM_FILE_NAME), "w") index_file.write(json.dumps(raw_segment_list, indent=4)) - index_file.close() + index_file.close() - # Loop over raw memory regions + # Loop over raw memory regions mem_info = lldb.SBMemoryRegionInfo() start_addr = -1 next_region_addr = 0 @@ -218,15 +240,20 @@ def dump_process_memory(output_dir): end_addr = mem_info.GetRegionEnd() # Unknown region name - region_name = 'UNKNOWN' + region_name = "UNKNOWN" # Ignore regions that aren't even mapped if mem_info.IsMapped() and mem_info.IsReadable(): - mem_info_obj = {'start': start_addr, 'end': end_addr, 'name': region_name, 'permissions': { - "r": mem_info.IsReadable(), - "w": mem_info.IsWritable(), - "x": mem_info.IsExecutable() - }} + mem_info_obj = { + "start": start_addr, + "end": end_addr, + "name": region_name, + "permissions": { + "r": mem_info.IsReadable(), + "w": mem_info.IsWritable(), + "x": mem_info.IsExecutable(), + }, + } raw_memory_list.append(mem_info_obj) @@ -234,65 +261,89 @@ def dump_process_memory(output_dir): for seg_info in final_segment_list: try: - seg_info['content_file'] = '' - start_addr = seg_info['start'] - end_addr = seg_info['end'] - region_name = seg_info['name'] + seg_info["content_file"] = "" + start_addr = seg_info["start"] + end_addr = seg_info["end"] + region_name = seg_info["name"] # Compress and dump the content to a file err = lldb.SBError() - seg_content = lldb.process.ReadMemory(start_addr, end_addr - start_addr, err) - if(seg_content == None): - print("Segment empty: @0x{0:016x} (size:UNKNOWN) {1}".format(start_addr, region_name)) - seg_info['content_file'] = '' + seg_content = lldb.process.ReadMemory( + start_addr, end_addr - start_addr, err + ) + if seg_content == None: + print ( + "Segment empty: @0x{0:016x} (size:UNKNOWN) {1}".format( + start_addr, region_name + ) + ) + seg_info["content_file"] = "" else: - print("Dumping segment @0x{0:016x} (size:0x{1:x}): {2} [{3}]".format(start_addr, len(seg_content), region_name, repr(seg_info['permissions']))) + print ( + "Dumping segment @0x{0:016x} (size:0x{1:x}): {2} [{3}]".format( + start_addr, + len(seg_content), + region_name, + repr(seg_info["permissions"]), + ) + ) compressed_seg_content = zlib.compress(seg_content) md5_sum = hashlib.md5(compressed_seg_content).hexdigest() + ".bin" - seg_info['content_file'] = md5_sum - + seg_info["content_file"] = md5_sum + # Write the compressed contents to disk - out_file = open(os.path.join(output_dir, md5_sum), 'wb') + out_file = open(os.path.join(output_dir, md5_sum), "wb") out_file.write(compressed_seg_content) out_file.close() - + except: - print("Exception reading segment ({}): {}".format(region_name, sys.exc_info()[0])) - + print ( + "Exception reading segment ({}): {}".format( + region_name, sys.exc_info()[0] + ) + ) + return final_segment_list -#---------- -#---- Main - + +# ---------- +# ---- Main + + def main(): try: - print("----- Unicorn Context Dumper -----") - print("You must be actively debugging before running this!") - print("If it fails, double check that you are actively debugging before running.") - + print ("----- Unicorn Context Dumper -----") + print ("You must be actively debugging before running this!") + print ( + "If it fails, double check that you are actively debugging before running." + ) + # Create the output directory - timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y%m%d_%H%M%S') + timestamp = datetime.datetime.fromtimestamp(time.time()).strftime( + "%Y%m%d_%H%M%S" + ) output_path = "UnicornContext_" + timestamp if not os.path.exists(output_path): os.makedirs(output_path) - print("Process context will be output to {}".format(output_path)) - + print ("Process context will be output to {}".format(output_path)) + # Get the context context = { "arch": dump_arch_info(), - "regs": dump_regs(), + "regs": dump_regs(), "segments": dump_process_memory(output_path), } - + # Write the index file - index_file = open(os.path.join(output_path, INDEX_FILE_NAME), 'w') + index_file = open(os.path.join(output_path, INDEX_FILE_NAME), "w") index_file.write(json.dumps(context, indent=4)) - index_file.close() - print("Done.") - + index_file.close() + print ("Done.") + except Exception, e: - print("!!! ERROR:\n\t{}".format(repr(e))) - + print ("!!! ERROR:\n\t{}".format(repr(e))) + + if __name__ == "__main__": main() elif lldb.debugger: diff --git a/unicorn_mode/helper_scripts/unicorn_dumper_pwndbg.py b/unicorn_mode/helper_scripts/unicorn_dumper_pwndbg.py index dc56b2aa..eccbc8bf 100644 --- a/unicorn_mode/helper_scripts/unicorn_dumper_pwndbg.py +++ b/unicorn_mode/helper_scripts/unicorn_dumper_pwndbg.py @@ -59,45 +59,47 @@ MAX_SEG_SIZE = 128 * 1024 * 1024 # Name of the index file INDEX_FILE_NAME = "_index.json" -#---------------------- -#---- Helper Functions +# ---------------------- +# ---- Helper Functions + def map_arch(): - arch = pwndbg.arch.current # from PWNDBG - if 'x86_64' in arch or 'x86-64' in arch: + arch = pwndbg.arch.current # from PWNDBG + if "x86_64" in arch or "x86-64" in arch: return "x64" - elif 'x86' in arch or 'i386' in arch: + elif "x86" in arch or "i386" in arch: return "x86" - elif 'aarch64' in arch or 'arm64' in arch: + elif "aarch64" in arch or "arm64" in arch: return "arm64le" - elif 'aarch64_be' in arch: + elif "aarch64_be" in arch: return "arm64be" - elif 'arm' in arch: - cpsr = pwndbg.regs['cpsr'] - # check endianess - if pwndbg.arch.endian == 'big': + elif "arm" in arch: + cpsr = pwndbg.regs["cpsr"] + # check endianess + if pwndbg.arch.endian == "big": # check for THUMB mode - if (cpsr & (1 << 5)): + if cpsr & (1 << 5): return "armbethumb" else: return "armbe" else: # check for THUMB mode - if (cpsr & (1 << 5)): + if cpsr & (1 << 5): return "armlethumb" else: return "armle" - elif 'mips' in arch: - if pwndbg.arch.endian == 'little': - return 'mipsel' + elif "mips" in arch: + if pwndbg.arch.endian == "little": + return "mipsel" else: - return 'mips' + return "mips" else: return "" -#----------------------- -#---- Dumping functions +# ----------------------- +# ---- Dumping functions + def dump_arch_info(): arch_info = {} @@ -110,26 +112,26 @@ def dump_regs(): for reg in pwndbg.regs.all: reg_val = pwndbg.regs[reg] # current dumper script looks for register values to be hex strings -# reg_str = "0x{:08x}".format(reg_val) -# if "64" in get_arch(): -# reg_str = "0x{:016x}".format(reg_val) -# reg_state[reg.strip().strip('$')] = reg_str - reg_state[reg.strip().strip('$')] = reg_val + # reg_str = "0x{:08x}".format(reg_val) + # if "64" in get_arch(): + # reg_str = "0x{:016x}".format(reg_val) + # reg_state[reg.strip().strip('$')] = reg_str + reg_state[reg.strip().strip("$")] = reg_val return reg_state def dump_process_memory(output_dir): # Segment information dictionary final_segment_list = [] - + # PWNDBG: vmmap = pwndbg.vmmap.get() - + # Pointer to end of last dumped memory segment - segment_last_addr = 0x0; + segment_last_addr = 0x0 start = None - end = None + end = None if not vmmap: print("No address mapping information found") @@ -141,86 +143,107 @@ def dump_process_memory(output_dir): continue start = entry.start - end = entry.end + end = entry.end - if (segment_last_addr > entry.start): # indicates overlap - if (segment_last_addr > entry.end): # indicates complete overlap, so we skip the segment entirely + if segment_last_addr > entry.start: # indicates overlap + if ( + segment_last_addr > entry.end + ): # indicates complete overlap, so we skip the segment entirely continue - else: + else: start = segment_last_addr - - - seg_info = {'start': start, 'end': end, 'name': entry.objfile, 'permissions': { - "r": entry.read, - "w": entry.write, - "x": entry.execute - }, 'content_file': ''} + + seg_info = { + "start": start, + "end": end, + "name": entry.objfile, + "permissions": {"r": entry.read, "w": entry.write, "x": entry.execute}, + "content_file": "", + } # "(deleted)" may or may not be valid, but don't push it. - if entry.read and not '(deleted)' in entry.objfile: + if entry.read and not "(deleted)" in entry.objfile: try: # Compress and dump the content to a file seg_content = pwndbg.memory.read(start, end - start) - if(seg_content == None): - print("Segment empty: @0x{0:016x} (size:UNKNOWN) {1}".format(entry.start, entry.objfile)) + if seg_content == None: + print( + "Segment empty: @0x{0:016x} (size:UNKNOWN) {1}".format( + entry.start, entry.objfile + ) + ) else: - print("Dumping segment @0x{0:016x} (size:0x{1:x}): {2} [{3}]".format(entry.start, len(seg_content), entry.objfile, repr(seg_info['permissions']))) + print( + "Dumping segment @0x{0:016x} (size:0x{1:x}): {2} [{3}]".format( + entry.start, + len(seg_content), + entry.objfile, + repr(seg_info["permissions"]), + ) + ) compressed_seg_content = zlib.compress(str(seg_content)) md5_sum = hashlib.md5(compressed_seg_content).hexdigest() + ".bin" seg_info["content_file"] = md5_sum - + # Write the compressed contents to disk - out_file = open(os.path.join(output_dir, md5_sum), 'wb') + out_file = open(os.path.join(output_dir, md5_sum), "wb") out_file.write(compressed_seg_content) out_file.close() except Exception as e: traceback.print_exc() - print("Exception reading segment ({}): {}".format(entry.objfile, sys.exc_info()[0])) + print( + "Exception reading segment ({}): {}".format( + entry.objfile, sys.exc_info()[0] + ) + ) else: print("Skipping segment {0}@0x{1:016x}".format(entry.objfile, entry.start)) - + segment_last_addr = end # Add the segment to the list final_segment_list.append(seg_info) - return final_segment_list -#---------- -#---- Main - + +# ---------- +# ---- Main + + def main(): print("----- Unicorn Context Dumper -----") print("You must be actively debugging before running this!") print("If it fails, double check that you are actively debugging before running.") - + try: # Create the output directory - timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y%m%d_%H%M%S') + timestamp = datetime.datetime.fromtimestamp(time.time()).strftime( + "%Y%m%d_%H%M%S" + ) output_path = "UnicornContext_" + timestamp if not os.path.exists(output_path): os.makedirs(output_path) print("Process context will be output to {}".format(output_path)) - + # Get the context context = { "arch": dump_arch_info(), - "regs": dump_regs(), + "regs": dump_regs(), "segments": dump_process_memory(output_path), } # Write the index file - index_file = open(os.path.join(output_path, INDEX_FILE_NAME), 'w') + index_file = open(os.path.join(output_path, INDEX_FILE_NAME), "w") index_file.write(json.dumps(context, indent=4)) - index_file.close() + index_file.close() print("Done.") - + except Exception as e: print("!!! ERROR:\n\t{}".format(repr(e))) - + + if __name__ == "__main__" and pwndbg_loaded: main() - diff --git a/unicorn_mode/samples/compcov_x64/compcov_test_harness.py b/unicorn_mode/samples/compcov_x64/compcov_test_harness.py index b9ebb61d..f0749d1b 100644 --- a/unicorn_mode/samples/compcov_x64/compcov_test_harness.py +++ b/unicorn_mode/samples/compcov_x64/compcov_test_harness.py @@ -22,48 +22,81 @@ from unicornafl import * from unicornafl.x86_const import * # Path to the file containing the binary to emulate -BINARY_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'compcov_target.bin') +BINARY_FILE = os.path.join( + os.path.dirname(os.path.abspath(__file__)), "compcov_target.bin" +) # Memory map for the code to be tested -CODE_ADDRESS = 0x00100000 # Arbitrary address where code to test will be loaded +CODE_ADDRESS = 0x00100000 # Arbitrary address where code to test will be loaded CODE_SIZE_MAX = 0x00010000 # Max size for the code (64kb) STACK_ADDRESS = 0x00200000 # Address of the stack (arbitrarily chosen) -STACK_SIZE = 0x00010000 # Size of the stack (arbitrarily chosen) -DATA_ADDRESS = 0x00300000 # Address where mutated data will be placed +STACK_SIZE = 0x00010000 # Size of the stack (arbitrarily chosen) +DATA_ADDRESS = 0x00300000 # Address where mutated data will be placed DATA_SIZE_MAX = 0x00010000 # Maximum allowable size of mutated data try: # If Capstone is installed then we'll dump disassembly, otherwise just dump the binary. from capstone import * + cs = Cs(CS_ARCH_X86, CS_MODE_64) + def unicorn_debug_instruction(uc, address, size, user_data): mem = uc.mem_read(address, size) - for (cs_address, cs_size, cs_mnemonic, cs_opstr) in cs.disasm_lite(bytes(mem), size): + for (cs_address, cs_size, cs_mnemonic, cs_opstr) in cs.disasm_lite( + bytes(mem), size + ): print(" Instr: {:#016x}:\t{}\t{}".format(address, cs_mnemonic, cs_opstr)) + + except ImportError: + def unicorn_debug_instruction(uc, address, size, user_data): print(" Instr: addr=0x{0:016x}, size=0x{1:016x}".format(address, size)) + def unicorn_debug_block(uc, address, size, user_data): print("Basic Block: addr=0x{0:016x}, size=0x{1:016x}".format(address, size)) + def unicorn_debug_mem_access(uc, access, address, size, value, user_data): if access == UC_MEM_WRITE: - print(" >>> Write: addr=0x{0:016x} size={1} data=0x{2:016x}".format(address, size, value)) + print( + " >>> Write: addr=0x{0:016x} size={1} data=0x{2:016x}".format( + address, size, value + ) + ) else: print(" >>> Read: addr=0x{0:016x} size={1}".format(address, size)) + def unicorn_debug_mem_invalid_access(uc, access, address, size, value, user_data): if access == UC_MEM_WRITE_UNMAPPED: - print(" >>> INVALID Write: addr=0x{0:016x} size={1} data=0x{2:016x}".format(address, size, value)) + print( + " >>> INVALID Write: addr=0x{0:016x} size={1} data=0x{2:016x}".format( + address, size, value + ) + ) else: - print(" >>> INVALID Read: addr=0x{0:016x} size={1}".format(address, size)) + print( + " >>> INVALID Read: addr=0x{0:016x} size={1}".format(address, size) + ) + def main(): parser = argparse.ArgumentParser(description="Test harness for compcov_target.bin") - parser.add_argument('input_file', type=str, help="Path to the file containing the mutated input to load") - parser.add_argument('-t', '--trace', default=False, action="store_true", help="Enables debug tracing") + parser.add_argument( + "input_file", + type=str, + help="Path to the file containing the mutated input to load", + ) + parser.add_argument( + "-t", + "--trace", + default=False, + action="store_true", + help="Enables debug tracing", + ) args = parser.parse_args() # Instantiate a MIPS32 big endian Unicorn Engine instance @@ -73,13 +106,16 @@ def main(): uc.hook_add(UC_HOOK_BLOCK, unicorn_debug_block) uc.hook_add(UC_HOOK_CODE, unicorn_debug_instruction) uc.hook_add(UC_HOOK_MEM_WRITE | UC_HOOK_MEM_READ, unicorn_debug_mem_access) - uc.hook_add(UC_HOOK_MEM_WRITE_UNMAPPED | UC_HOOK_MEM_READ_INVALID, unicorn_debug_mem_invalid_access) + uc.hook_add( + UC_HOOK_MEM_WRITE_UNMAPPED | UC_HOOK_MEM_READ_INVALID, + unicorn_debug_mem_invalid_access, + ) - #--------------------------------------------------- + # --------------------------------------------------- # Load the binary to emulate and map it into memory print("Loading data input from {}".format(args.input_file)) - binary_file = open(BINARY_FILE, 'rb') + binary_file = open(BINARY_FILE, "rb") binary_code = binary_file.read() binary_file.close() @@ -93,11 +129,11 @@ def main(): uc.mem_write(CODE_ADDRESS, binary_code) # Set the program counter to the start of the code - start_address = CODE_ADDRESS # Address of entry point of main() - end_address = CODE_ADDRESS + 0x55 # Address of last instruction in main() + start_address = CODE_ADDRESS # Address of entry point of main() + end_address = CODE_ADDRESS + 0x55 # Address of last instruction in main() uc.reg_write(UC_X86_REG_RIP, start_address) - #----------------- + # ----------------- # Setup the stack uc.mem_map(STACK_ADDRESS, STACK_SIZE) @@ -106,8 +142,7 @@ def main(): # Mapping a location to write our buffer to uc.mem_map(DATA_ADDRESS, DATA_SIZE_MAX) - - #----------------------------------------------- + # ----------------------------------------------- # Load the mutated input and map it into memory def place_input_callback(uc, input, _, data): @@ -121,7 +156,7 @@ def main(): # Write the mutated command into the data buffer uc.mem_write(DATA_ADDRESS, input) - #------------------------------------------------------------ + # ------------------------------------------------------------ # Emulate the code, allowing it to process the mutated input print("Starting the AFL fuzz") @@ -129,8 +164,9 @@ def main(): input_file=args.input_file, place_input_callback=place_input_callback, exits=[end_address], - persistent_iters=1 + persistent_iters=1, ) + if __name__ == "__main__": main() diff --git a/unicorn_mode/samples/simple/simple_test_harness.py b/unicorn_mode/samples/simple/simple_test_harness.py index 4a673daf..cd04ad3a 100644 --- a/unicorn_mode/samples/simple/simple_test_harness.py +++ b/unicorn_mode/samples/simple/simple_test_harness.py @@ -22,48 +22,81 @@ from unicornafl import * from unicornafl.mips_const import * # Path to the file containing the binary to emulate -BINARY_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'simple_target.bin') +BINARY_FILE = os.path.join( + os.path.dirname(os.path.abspath(__file__)), "simple_target.bin" +) # Memory map for the code to be tested -CODE_ADDRESS = 0x00100000 # Arbitrary address where code to test will be loaded +CODE_ADDRESS = 0x00100000 # Arbitrary address where code to test will be loaded CODE_SIZE_MAX = 0x00010000 # Max size for the code (64kb) STACK_ADDRESS = 0x00200000 # Address of the stack (arbitrarily chosen) -STACK_SIZE = 0x00010000 # Size of the stack (arbitrarily chosen) -DATA_ADDRESS = 0x00300000 # Address where mutated data will be placed +STACK_SIZE = 0x00010000 # Size of the stack (arbitrarily chosen) +DATA_ADDRESS = 0x00300000 # Address where mutated data will be placed DATA_SIZE_MAX = 0x00010000 # Maximum allowable size of mutated data try: # If Capstone is installed then we'll dump disassembly, otherwise just dump the binary. from capstone import * + cs = Cs(CS_ARCH_MIPS, CS_MODE_MIPS32 + CS_MODE_BIG_ENDIAN) + def unicorn_debug_instruction(uc, address, size, user_data): mem = uc.mem_read(address, size) - for (cs_address, cs_size, cs_mnemonic, cs_opstr) in cs.disasm_lite(bytes(mem), size): + for (cs_address, cs_size, cs_mnemonic, cs_opstr) in cs.disasm_lite( + bytes(mem), size + ): print(" Instr: {:#016x}:\t{}\t{}".format(address, cs_mnemonic, cs_opstr)) + + except ImportError: + def unicorn_debug_instruction(uc, address, size, user_data): - print(" Instr: addr=0x{0:016x}, size=0x{1:016x}".format(address, size)) + print(" Instr: addr=0x{0:016x}, size=0x{1:016x}".format(address, size)) + def unicorn_debug_block(uc, address, size, user_data): print("Basic Block: addr=0x{0:016x}, size=0x{1:016x}".format(address, size)) - + + def unicorn_debug_mem_access(uc, access, address, size, value, user_data): if access == UC_MEM_WRITE: - print(" >>> Write: addr=0x{0:016x} size={1} data=0x{2:016x}".format(address, size, value)) + print( + " >>> Write: addr=0x{0:016x} size={1} data=0x{2:016x}".format( + address, size, value + ) + ) else: - print(" >>> Read: addr=0x{0:016x} size={1}".format(address, size)) + print(" >>> Read: addr=0x{0:016x} size={1}".format(address, size)) + def unicorn_debug_mem_invalid_access(uc, access, address, size, value, user_data): if access == UC_MEM_WRITE_UNMAPPED: - print(" >>> INVALID Write: addr=0x{0:016x} size={1} data=0x{2:016x}".format(address, size, value)) + print( + " >>> INVALID Write: addr=0x{0:016x} size={1} data=0x{2:016x}".format( + address, size, value + ) + ) else: - print(" >>> INVALID Read: addr=0x{0:016x} size={1}".format(address, size)) + print( + " >>> INVALID Read: addr=0x{0:016x} size={1}".format(address, size) + ) + def main(): parser = argparse.ArgumentParser(description="Test harness for simple_target.bin") - parser.add_argument('input_file', type=str, help="Path to the file containing the mutated input to load") - parser.add_argument('-t', '--trace', default=False, action="store_true", help="Enables debug tracing") + parser.add_argument( + "input_file", + type=str, + help="Path to the file containing the mutated input to load", + ) + parser.add_argument( + "-t", + "--trace", + default=False, + action="store_true", + help="Enables debug tracing", + ) args = parser.parse_args() # Instantiate a MIPS32 big endian Unicorn Engine instance @@ -73,13 +106,16 @@ def main(): uc.hook_add(UC_HOOK_BLOCK, unicorn_debug_block) uc.hook_add(UC_HOOK_CODE, unicorn_debug_instruction) uc.hook_add(UC_HOOK_MEM_WRITE | UC_HOOK_MEM_READ, unicorn_debug_mem_access) - uc.hook_add(UC_HOOK_MEM_WRITE_UNMAPPED | UC_HOOK_MEM_READ_INVALID, unicorn_debug_mem_invalid_access) + uc.hook_add( + UC_HOOK_MEM_WRITE_UNMAPPED | UC_HOOK_MEM_READ_INVALID, + unicorn_debug_mem_invalid_access, + ) - #--------------------------------------------------- + # --------------------------------------------------- # Load the binary to emulate and map it into memory print("Loading data input from {}".format(args.input_file)) - binary_file = open(BINARY_FILE, 'rb') + binary_file = open(BINARY_FILE, "rb") binary_code = binary_file.read() binary_file.close() @@ -93,11 +129,11 @@ def main(): uc.mem_write(CODE_ADDRESS, binary_code) # Set the program counter to the start of the code - start_address = CODE_ADDRESS # Address of entry point of main() - end_address = CODE_ADDRESS + 0xf4 # Address of last instruction in main() + start_address = CODE_ADDRESS # Address of entry point of main() + end_address = CODE_ADDRESS + 0xF4 # Address of last instruction in main() uc.reg_write(UC_MIPS_REG_PC, start_address) - #----------------- + # ----------------- # Setup the stack uc.mem_map(STACK_ADDRESS, STACK_SIZE) @@ -106,14 +142,14 @@ def main(): # reserve some space for data uc.mem_map(DATA_ADDRESS, DATA_SIZE_MAX) - #----------------------------------------------------- + # ----------------------------------------------------- # Set up a callback to place input data (do little work here, it's called for every single iteration) # We did not pass in any data and don't use persistent mode, so we can ignore these params. # Be sure to check out the docstrings for the uc.afl_* functions. def place_input_callback(uc, input, persistent_round, data): # Apply constraints to the mutated input if len(input) > DATA_SIZE_MAX: - #print("Test input is too long (> {} bytes)") + # print("Test input is too long (> {} bytes)") return False # Write the mutated command into the data buffer @@ -122,5 +158,6 @@ def main(): # Start the fuzzer. uc.afl_fuzz(args.input_file, place_input_callback, [end_address]) + if __name__ == "__main__": main() diff --git a/unicorn_mode/samples/simple/simple_test_harness_alt.py b/unicorn_mode/samples/simple/simple_test_harness_alt.py index 9c3dbc93..3249b13d 100644 --- a/unicorn_mode/samples/simple/simple_test_harness_alt.py +++ b/unicorn_mode/samples/simple/simple_test_harness_alt.py @@ -25,50 +25,79 @@ from unicornafl import * from unicornafl.mips_const import * # Path to the file containing the binary to emulate -BINARY_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'simple_target.bin') +BINARY_FILE = os.path.join( + os.path.dirname(os.path.abspath(__file__)), "simple_target.bin" +) # Memory map for the code to be tested -CODE_ADDRESS = 0x00100000 # Arbitrary address where code to test will be loaded +CODE_ADDRESS = 0x00100000 # Arbitrary address where code to test will be loaded CODE_SIZE_MAX = 0x00010000 # Max size for the code (64kb) STACK_ADDRESS = 0x00200000 # Address of the stack (arbitrarily chosen) -STACK_SIZE = 0x00010000 # Size of the stack (arbitrarily chosen) -DATA_ADDRESS = 0x00300000 # Address where mutated data will be placed +STACK_SIZE = 0x00010000 # Size of the stack (arbitrarily chosen) +DATA_ADDRESS = 0x00300000 # Address where mutated data will be placed DATA_SIZE_MAX = 0x00010000 # Maximum allowable size of mutated data try: # If Capstone is installed then we'll dump disassembly, otherwise just dump the binary. from capstone import * + cs = Cs(CS_ARCH_MIPS, CS_MODE_MIPS32 + CS_MODE_BIG_ENDIAN) + def unicorn_debug_instruction(uc, address, size, user_data): mem = uc.mem_read(address, size) - for (cs_address, cs_size, cs_mnemonic, cs_opstr) in cs.disasm_lite(bytes(mem), size): + for (cs_address, cs_size, cs_mnemonic, cs_opstr) in cs.disasm_lite( + bytes(mem), size + ): print(" Instr: {:#016x}:\t{}\t{}".format(address, cs_mnemonic, cs_opstr)) + + except ImportError: + def unicorn_debug_instruction(uc, address, size, user_data): - print(" Instr: addr=0x{0:016x}, size=0x{1:016x}".format(address, size)) + print(" Instr: addr=0x{0:016x}, size=0x{1:016x}".format(address, size)) + def unicorn_debug_block(uc, address, size, user_data): print("Basic Block: addr=0x{0:016x}, size=0x{1:016x}".format(address, size)) - + + def unicorn_debug_mem_access(uc, access, address, size, value, user_data): if access == UC_MEM_WRITE: - print(" >>> Write: addr=0x{0:016x} size={1} data=0x{2:016x}".format(address, size, value)) + print( + " >>> Write: addr=0x{0:016x} size={1} data=0x{2:016x}".format( + address, size, value + ) + ) else: - print(" >>> Read: addr=0x{0:016x} size={1}".format(address, size)) + print(" >>> Read: addr=0x{0:016x} size={1}".format(address, size)) + def unicorn_debug_mem_invalid_access(uc, access, address, size, value, user_data): if access == UC_MEM_WRITE_UNMAPPED: - print(" >>> INVALID Write: addr=0x{0:016x} size={1} data=0x{2:016x}".format(address, size, value)) + print( + " >>> INVALID Write: addr=0x{0:016x} size={1} data=0x{2:016x}".format( + address, size, value + ) + ) else: - print(" >>> INVALID Read: addr=0x{0:016x} size={1}".format(address, size)) + print( + " >>> INVALID Read: addr=0x{0:016x} size={1}".format(address, size) + ) + def force_crash(uc_error): # This function should be called to indicate to AFL that a crash occurred during emulation. # Pass in the exception received from Uc.emu_start() mem_errors = [ - UC_ERR_READ_UNMAPPED, UC_ERR_READ_PROT, UC_ERR_READ_UNALIGNED, - UC_ERR_WRITE_UNMAPPED, UC_ERR_WRITE_PROT, UC_ERR_WRITE_UNALIGNED, - UC_ERR_FETCH_UNMAPPED, UC_ERR_FETCH_PROT, UC_ERR_FETCH_UNALIGNED, + UC_ERR_READ_UNMAPPED, + UC_ERR_READ_PROT, + UC_ERR_READ_UNALIGNED, + UC_ERR_WRITE_UNMAPPED, + UC_ERR_WRITE_PROT, + UC_ERR_WRITE_UNALIGNED, + UC_ERR_FETCH_UNMAPPED, + UC_ERR_FETCH_PROT, + UC_ERR_FETCH_UNALIGNED, ] if uc_error.errno in mem_errors: # Memory error - throw SIGSEGV @@ -80,11 +109,22 @@ def force_crash(uc_error): # Not sure what happened - throw SIGABRT os.kill(os.getpid(), signal.SIGABRT) + def main(): parser = argparse.ArgumentParser(description="Test harness for simple_target.bin") - parser.add_argument('input_file', type=str, help="Path to the file containing the mutated input to load") - parser.add_argument('-d', '--debug', default=False, action="store_true", help="Enables debug tracing") + parser.add_argument( + "input_file", + type=str, + help="Path to the file containing the mutated input to load", + ) + parser.add_argument( + "-d", + "--debug", + default=False, + action="store_true", + help="Enables debug tracing", + ) args = parser.parse_args() # Instantiate a MIPS32 big endian Unicorn Engine instance @@ -94,13 +134,16 @@ def main(): uc.hook_add(UC_HOOK_BLOCK, unicorn_debug_block) uc.hook_add(UC_HOOK_CODE, unicorn_debug_instruction) uc.hook_add(UC_HOOK_MEM_WRITE | UC_HOOK_MEM_READ, unicorn_debug_mem_access) - uc.hook_add(UC_HOOK_MEM_WRITE_UNMAPPED | UC_HOOK_MEM_READ_INVALID, unicorn_debug_mem_invalid_access) + uc.hook_add( + UC_HOOK_MEM_WRITE_UNMAPPED | UC_HOOK_MEM_READ_INVALID, + unicorn_debug_mem_invalid_access, + ) - #--------------------------------------------------- + # --------------------------------------------------- # Load the binary to emulate and map it into memory print("Loading data input from {}".format(args.input_file)) - binary_file = open(BINARY_FILE, 'rb') + binary_file = open(BINARY_FILE, "rb") binary_code = binary_file.read() binary_file.close() @@ -114,11 +157,11 @@ def main(): uc.mem_write(CODE_ADDRESS, binary_code) # Set the program counter to the start of the code - start_address = CODE_ADDRESS # Address of entry point of main() - end_address = CODE_ADDRESS + 0xf4 # Address of last instruction in main() + start_address = CODE_ADDRESS # Address of entry point of main() + end_address = CODE_ADDRESS + 0xF4 # Address of last instruction in main() uc.reg_write(UC_MIPS_REG_PC, start_address) - #----------------- + # ----------------- # Setup the stack uc.mem_map(STACK_ADDRESS, STACK_SIZE) @@ -127,10 +170,10 @@ def main(): # reserve some space for data uc.mem_map(DATA_ADDRESS, DATA_SIZE_MAX) - #----------------------------------------------------- + # ----------------------------------------------------- # Kick off AFL's fork server - # THIS MUST BE DONE BEFORE LOADING USER DATA! - # If this isn't done every single run, the AFL fork server + # THIS MUST BE DONE BEFORE LOADING USER DATA! + # If this isn't done every single run, the AFL fork server # will not be started appropriately and you'll get erratic results! print("Starting the AFL forkserver") @@ -142,12 +185,12 @@ def main(): else: out = lambda x, y: print(x.format(y)) - #----------------------------------------------- + # ----------------------------------------------- # Load the mutated input and map it into memory # Load the mutated input from disk out("Loading data input from {}", args.input_file) - input_file = open(args.input_file, 'rb') + input_file = open(args.input_file, "rb") input = input_file.read() input_file.close() @@ -159,7 +202,7 @@ def main(): # Write the mutated command into the data buffer uc.mem_write(DATA_ADDRESS, input) - #------------------------------------------------------------ + # ------------------------------------------------------------ # Emulate the code, allowing it to process the mutated input out("Executing until a crash or execution reaches 0x{0:016x}", end_address) @@ -175,5 +218,6 @@ def main(): # UC_AFL_RET_FINISHED = 3 out("Done. AFL Mode is {}", afl_mode) + if __name__ == "__main__": main() diff --git a/unicorn_mode/samples/speedtest/python/harness.py b/unicorn_mode/samples/speedtest/python/harness.py index f72eb32b..801ef4d1 100644 --- a/unicorn_mode/samples/speedtest/python/harness.py +++ b/unicorn_mode/samples/speedtest/python/harness.py @@ -256,17 +256,17 @@ def main(): input_len = len(input) # global input_len if input_len > INPUT_MAX: - #print("Test input is too long (> {} bytes)") + # print("Test input is too long (> {} bytes)") return False # print(f"Placing input: {input} in round {persistent_round}") # Make sure the string is always 0-terminated (as it would be "in the wild") - input[-1] = b'\0' + input[-1] = b"\0" # Write the mutated command into the data buffer uc.mem_write(INPUT_ADDRESS, input) - #uc.reg_write(UC_X86_REG_RIP, main_offset) + # uc.reg_write(UC_X86_REG_RIP, main_offset) print(f"Starting to fuzz. Running from addr {main_offset} to one of {main_ends}") # Start the fuzzer. diff --git a/utils/afl_untracer/ida_get_patchpoints.py b/utils/afl_untracer/ida_get_patchpoints.py index 43cf6d89..807685b3 100644 --- a/utils/afl_untracer/ida_get_patchpoints.py +++ b/utils/afl_untracer/ida_get_patchpoints.py @@ -11,6 +11,7 @@ import idc # See https://www.hex-rays.com/products/ida/support/ida74_idapython_no_bc695_porting_guide.shtml from os.path import expanduser + home = expanduser("~") patchpoints = set() @@ -18,7 +19,7 @@ patchpoints = set() max_offset = 0 for seg_ea in idautils.Segments(): name = idc.get_segm_name(seg_ea) - #print("Segment: " + name) + # print("Segment: " + name) if name != "__text" and name != ".text": continue @@ -26,7 +27,7 @@ for seg_ea in idautils.Segments(): end = idc.get_segm_end(seg_ea) first = 0 subtract_addr = 0 - #print("Start: " + hex(start) + " End: " + hex(end)) + # print("Start: " + hex(start) + " End: " + hex(end)) for func_ea in idautils.Functions(start, end): f = idaapi.get_func(func_ea) if not f: @@ -37,10 +38,10 @@ for seg_ea in idautils.Segments(): if block.start_ea >= 0x1000: subtract_addr = 0x1000 first = 1 - + max_offset = max(max_offset, block.start_ea) patchpoints.add(block.start_ea - subtract_addr) - #else: + # else: # print("Warning: broken CFG?") # Round up max_offset to page size @@ -52,11 +53,11 @@ if rem != 0: print("Writing to " + home + "/Desktop/patches.txt") with open(home + "/Desktop/patches.txt", "w") as f: - f.write(ida_nalt.get_root_filename() + ':' + hex(size) + '\n') - f.write('\n'.join(map(hex, sorted(patchpoints)))) - f.write('\n') + f.write(ida_nalt.get_root_filename() + ":" + hex(size) + "\n") + f.write("\n".join(map(hex, sorted(patchpoints)))) + f.write("\n") print("Done, found {} patchpoints".format(len(patchpoints))) # For headless script running remove the comment from the next line -#ida_pro.qexit() +# ida_pro.qexit() diff --git a/utils/custom_mutators/XmlMutatorMin.py b/utils/custom_mutators/XmlMutatorMin.py index 4c80a2ba..3e6cd0ff 100644 --- a/utils/custom_mutators/XmlMutatorMin.py +++ b/utils/custom_mutators/XmlMutatorMin.py @@ -12,12 +12,13 @@ import random, re, io # The XmlMutatorMin class # ########################### + class XmlMutatorMin: """ - Optionals parameters: - seed Seed used by the PRNG (default: "RANDOM") - verbose Verbosity (default: False) + Optionals parameters: + seed Seed used by the PRNG (default: "RANDOM") + verbose Verbosity (default: False) """ def __init__(self, seed="RANDOM", verbose=False): @@ -41,7 +42,12 @@ class XmlMutatorMin: self.tree = None # High-level mutators (no database needed) - hl_mutators_delete = ["del_node_and_children", "del_node_but_children", "del_attribute", "del_content"] # Delete items + hl_mutators_delete = [ + "del_node_and_children", + "del_node_but_children", + "del_attribute", + "del_content", + ] # Delete items hl_mutators_fuzz = ["fuzz_attribute"] # Randomly change attribute values # Exposed mutators @@ -74,7 +80,9 @@ class XmlMutatorMin: """ Serialize a XML document. Basic wrapper around lxml.tostring() """ - return ET.tostring(tree, with_tail=False, xml_declaration=True, encoding=tree.docinfo.encoding) + return ET.tostring( + tree, with_tail=False, xml_declaration=True, encoding=tree.docinfo.encoding + ) def __ver(self, version): @@ -161,7 +169,7 @@ class XmlMutatorMin: # Randomly pick one the function calls (func, args) = random.choice(l) # Split by "," and randomly pick one of the arguments - value = random.choice(args.split(',')) + value = random.choice(args.split(",")) # Remove superfluous characters unclean_value = value value = value.strip(" ").strip("'") @@ -170,49 +178,49 @@ class XmlMutatorMin: value = attrib_value # For each type, define some possible replacement values - choices_number = ( \ - "0", \ - "11111", \ - "-128", \ - "2", \ - "-1", \ - "1/3", \ - "42/0", \ - "1094861636 idiv 1.0", \ - "-1123329771506872 idiv 3.8", \ - "17=$numericRTF", \ - str(3 + random.randrange(0, 100)), \ - ) - - choices_letter = ( \ - "P" * (25 * random.randrange(1, 100)), \ - "%s%s%s%s%s%s", \ - "foobar", \ - ) - - choices_alnum = ( \ - "Abc123", \ - "020F0302020204030204", \ - "020F0302020204030204" * (random.randrange(5, 20)), \ - ) + choices_number = ( + "0", + "11111", + "-128", + "2", + "-1", + "1/3", + "42/0", + "1094861636 idiv 1.0", + "-1123329771506872 idiv 3.8", + "17=$numericRTF", + str(3 + random.randrange(0, 100)), + ) + + choices_letter = ( + "P" * (25 * random.randrange(1, 100)), + "%s%s%s%s%s%s", + "foobar", + ) + + choices_alnum = ( + "Abc123", + "020F0302020204030204", + "020F0302020204030204" * (random.randrange(5, 20)), + ) # Fuzz the value - if random.choice((True,False)) and value == "": + if random.choice((True, False)) and value == "": # Empty new_value = value - elif random.choice((True,False)) and value.isdigit(): + elif random.choice((True, False)) and value.isdigit(): # Numbers new_value = random.choice(choices_number) - elif random.choice((True,False)) and value.isalpha(): + elif random.choice((True, False)) and value.isalpha(): # Letters new_value = random.choice(choices_letter) - elif random.choice((True,False)) and value.isalnum(): + elif random.choice((True, False)) and value.isalnum(): # Alphanumeric new_value = random.choice(choices_alnum) @@ -232,22 +240,25 @@ class XmlMutatorMin: # Log something if self.verbose: - print("Fuzzing attribute #%i '%s' of tag #%i '%s'" % (rand_attrib_id, rand_attrib, rand_elem_id, rand_elem.tag)) + print( + "Fuzzing attribute #%i '%s' of tag #%i '%s'" + % (rand_attrib_id, rand_attrib, rand_elem_id, rand_elem.tag) + ) # Modify the attribute rand_elem.set(rand_attrib, new_value.decode("utf-8")) def __del_node_and_children(self): - """ High-level minimizing mutator - Delete a random node and its children (i.e. delete a random tree) """ + """High-level minimizing mutator + Delete a random node and its children (i.e. delete a random tree)""" self.__del_node(True) def __del_node_but_children(self): - """ High-level minimizing mutator - Delete a random node but its children (i.e. link them to the parent of the deleted node) """ + """High-level minimizing mutator + Delete a random node but its children (i.e. link them to the parent of the deleted node)""" self.__del_node(False) @@ -270,7 +281,10 @@ class XmlMutatorMin: # Log something if self.verbose: but_or_and = "and" if delete_children else "but" - print("Deleting tag #%i '%s' %s its children" % (rand_elem_id, rand_elem.tag, but_or_and)) + print( + "Deleting tag #%i '%s' %s its children" + % (rand_elem_id, rand_elem.tag, but_or_and) + ) if delete_children is False: # Link children of the random (soon to be deleted) node to its parent @@ -282,8 +296,8 @@ class XmlMutatorMin: def __del_content(self): - """ High-level minimizing mutator - Delete the attributes and children of a random node """ + """High-level minimizing mutator + Delete the attributes and children of a random node""" # Select a node to modify (rand_elem_id, rand_elem) = self.__pick_element() @@ -297,8 +311,8 @@ class XmlMutatorMin: def __del_attribute(self): - """ High-level minimizing mutator - Delete a random attribute from a random node """ + """High-level minimizing mutator + Delete a random attribute from a random node""" # Select a node to modify (rand_elem_id, rand_elem) = self.__pick_element() @@ -318,7 +332,10 @@ class XmlMutatorMin: # Log something if self.verbose: - print("Deleting attribute #%i '%s' of tag #%i '%s'" % (rand_attrib_id, rand_attrib, rand_elem_id, rand_elem.tag)) + print( + "Deleting attribute #%i '%s' of tag #%i '%s'" + % (rand_attrib_id, rand_attrib, rand_elem_id, rand_elem.tag) + ) # Delete the attribute rand_elem.attrib.pop(rand_attrib) @@ -329,4 +346,3 @@ class XmlMutatorMin: # High-level mutation self.__exec_among(self, self.hl_mutators_all, min, max) - diff --git a/utils/custom_mutators/common.py b/utils/custom_mutators/common.py index 9a1ef0a3..44a5056a 100644 --- a/utils/custom_mutators/common.py +++ b/utils/custom_mutators/common.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # encoding: utf-8 -''' +""" Module containing functions shared between multiple AFL modules @author: Christian Holler (:decoder) @@ -12,7 +12,7 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. @contact: choller@mozilla.com -''' +""" from __future__ import print_function import random @@ -23,18 +23,18 @@ import re def randel(l): if not l: return None - return l[random.randint(0, len(l)-1)] + return l[random.randint(0, len(l) - 1)] def randel_pop(l): if not l: return None - return l.pop(random.randint(0, len(l)-1)) + return l.pop(random.randint(0, len(l) - 1)) def write_exc_example(data, exc): - exc_name = re.sub(r'[^a-zA-Z0-9]', '_', repr(exc)) + exc_name = re.sub(r"[^a-zA-Z0-9]", "_", repr(exc)) if not os.path.exists(exc_name): - with open(exc_name, 'w') as f: + with open(exc_name, "w") as f: f.write(data) diff --git a/utils/custom_mutators/example.py b/utils/custom_mutators/example.py index cf659e5a..3a6d22e4 100644 --- a/utils/custom_mutators/example.py +++ b/utils/custom_mutators/example.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # encoding: utf-8 -''' +""" Example Python Module for AFLFuzz @author: Christian Holler (:decoder) @@ -12,7 +12,7 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. @contact: choller@mozilla.com -''' +""" import random @@ -26,12 +26,12 @@ COMMANDS = [ def init(seed): - ''' + """ Called once when AFLFuzz starts up. Used to seed our RNG. @type seed: int @param seed: A 32-bit random value - ''' + """ random.seed(seed) @@ -40,7 +40,7 @@ def deinit(): def fuzz(buf, add_buf, max_size): - ''' + """ Called per fuzzing iteration. @type buf: bytearray @@ -55,13 +55,14 @@ def fuzz(buf, add_buf, max_size): @rtype: bytearray @return: A new bytearray containing the mutated data - ''' + """ ret = bytearray(100) ret[:3] = random.choice(COMMANDS) return ret + # Uncomment and implement the following methods if you want to use a custom # trimming algorithm. See also the documentation for a better API description. diff --git a/utils/custom_mutators/simple-chunk-replace.py b/utils/custom_mutators/simple-chunk-replace.py index df2f4ca7..c57218dd 100644 --- a/utils/custom_mutators/simple-chunk-replace.py +++ b/utils/custom_mutators/simple-chunk-replace.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # encoding: utf-8 -''' +""" Simple Chunk Cross-Over Replacement Module for AFLFuzz @author: Christian Holler (:decoder) @@ -12,24 +12,24 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. @contact: choller@mozilla.com -''' +""" import random def init(seed): - ''' + """ Called once when AFLFuzz starts up. Used to seed our RNG. @type seed: int @param seed: A 32-bit random value - ''' + """ # Seed our RNG random.seed(seed) def fuzz(buf, add_buf, max_size): - ''' + """ Called per fuzzing iteration. @type buf: bytearray @@ -44,7 +44,7 @@ def fuzz(buf, add_buf, max_size): @rtype: bytearray @return: A new bytearray containing the mutated data - ''' + """ # Make a copy of our input buffer for returning ret = bytearray(buf) @@ -58,7 +58,9 @@ def fuzz(buf, add_buf, max_size): rand_dst_idx = random.randint(0, len(buf)) # Make the chunk replacement - ret[rand_dst_idx:rand_dst_idx + fragment_len] = add_buf[rand_src_idx:rand_src_idx + fragment_len] + ret[rand_dst_idx : rand_dst_idx + fragment_len] = add_buf[ + rand_src_idx : rand_src_idx + fragment_len + ] # Return data return ret diff --git a/utils/custom_mutators/wrapper_afl_min.py b/utils/custom_mutators/wrapper_afl_min.py index ecb03b55..5cd60031 100644 --- a/utils/custom_mutators/wrapper_afl_min.py +++ b/utils/custom_mutators/wrapper_afl_min.py @@ -27,7 +27,7 @@ def log(text): def init(seed): """ - Called once when AFL starts up. Seed is used to identify the AFL instance in log files + Called once when AFL starts up. Seed is used to identify the AFL instance in log files """ global __mutator__ @@ -72,7 +72,10 @@ def fuzz(buf, add_buf, max_size): if via_buffer: try: __mutator__.init_from_string(buf_str) - log("fuzz(): Mutator successfully initialized with AFL buffer (%d bytes)" % len(buf_str)) + log( + "fuzz(): Mutator successfully initialized with AFL buffer (%d bytes)" + % len(buf_str) + ) except Exception: via_buffer = False log("fuzz(): Can't initialize mutator with AFL buffer") @@ -104,7 +107,7 @@ def fuzz(buf, add_buf, max_size): # Main (for debug) -if __name__ == '__main__': +if __name__ == "__main__": __log__ = True __log_file__ = "/dev/stdout" @@ -112,7 +115,9 @@ if __name__ == '__main__': init(__seed__) - in_1 = bytearray("ffffzzzzzzzzzzzz") + in_1 = bytearray( + "ffffzzzzzzzzzzzz" + ) in_2 = bytearray("") out = fuzz(in_1, in_2) print(out) -- cgit 1.4.1 From 79e02c2a9b2532624d7f187783ccbe9cbb04ce9b Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Fri, 26 Feb 2021 22:54:35 +0100 Subject: remove debug output --- utils/persistent_mode/persistent_demo_new.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils') diff --git a/utils/persistent_mode/persistent_demo_new.c b/utils/persistent_mode/persistent_demo_new.c index 7e694696..285f50aa 100644 --- a/utils/persistent_mode/persistent_demo_new.c +++ b/utils/persistent_mode/persistent_demo_new.c @@ -70,7 +70,7 @@ int main(int argc, char **argv) { len = __AFL_FUZZ_TESTCASE_LEN; // do not use the macro directly in a call! - fprintf(stderr, "input: %zd \"%s\"\n", len, buf); + // fprintf(stderr, "input: %zd \"%s\"\n", len, buf); /* do we have enough data? */ if (len < 8) continue; -- cgit 1.4.1 From f81ef4abf41184a24d24828841c82b98b9216ddc Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Sun, 28 Feb 2021 00:12:21 +0100 Subject: fix afl-common compile --- src/afl-common.c | 4 ++++ utils/afl_network_proxy/GNUmakefile | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'utils') diff --git a/src/afl-common.c b/src/afl-common.c index c341bb97..fa4aec7f 100644 --- a/src/afl-common.c +++ b/src/afl-common.c @@ -47,6 +47,10 @@ u8 be_quiet = 0; u8 *doc_path = ""; u8 last_intr = 0; +#ifndef AFL_PATH + #define AFL_PATH "/usr/local/lib/afl/" +#endif + void detect_file_args(char **argv, u8 *prog_in, bool *use_stdin) { u32 i = 0; diff --git a/utils/afl_network_proxy/GNUmakefile b/utils/afl_network_proxy/GNUmakefile index 25a3df82..0b55dc2c 100644 --- a/utils/afl_network_proxy/GNUmakefile +++ b/utils/afl_network_proxy/GNUmakefile @@ -1,5 +1,6 @@ PREFIX ?= /usr/local BIN_PATH = $(PREFIX)/bin +HELPER_PATH = $(PREFIX)/lib/afl DOC_PATH = $(PREFIX)/share/doc/afl PROGRAMS = afl-network-client afl-network-server @@ -31,7 +32,7 @@ afl-network-client: afl-network-client.c $(CC) $(CFLAGS) -I../../include -o afl-network-client afl-network-client.c $(LDFLAGS) afl-network-server: afl-network-server.c - $(CC) $(CFLAGS) -I../../include -o afl-network-server afl-network-server.c ../../src/afl-forkserver.c ../../src/afl-sharedmem.c ../../src/afl-common.c -DBIN_PATH=\"$(BIN_PATH)\" $(LDFLAGS) + $(CC) $(CFLAGS) -I../../include -o afl-network-server afl-network-server.c ../../src/afl-forkserver.c ../../src/afl-sharedmem.c ../../src/afl-common.c -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" $(LDFLAGS) clean: rm -f $(PROGRAMS) *~ core -- cgit 1.4.1 From db342c9c8126ec6dcef59b561a3b319951bbad08 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sat, 13 Mar 2021 11:03:08 +0100 Subject: doc: Clarify default value of N iterations in aflpp_driver --- utils/aflpp_driver/aflpp_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils') diff --git a/utils/aflpp_driver/aflpp_driver.c b/utils/aflpp_driver/aflpp_driver.c index 6af79e14..9c97607c 100644 --- a/utils/aflpp_driver/aflpp_driver.c +++ b/utils/aflpp_driver/aflpp_driver.c @@ -204,7 +204,7 @@ int main(int argc, char **argv) { "To fuzz with afl-fuzz execute this:\n" " afl-fuzz [afl-flags] -- %s [-N]\n" "afl-fuzz will run N iterations before re-spawning the process (default: " - "1000)\n" + "INT_MAX)\n" "======================================================\n", argv[0], argv[0]); -- cgit 1.4.1 From 01ad7610beaf772063c9011daae5fa3a3232494c Mon Sep 17 00:00:00 2001 From: realmadsci <71108352+realmadsci@users.noreply.github.com> Date: Mon, 15 Mar 2021 11:45:58 -0400 Subject: Remove AFL_PRELOAD and AFL_USE_QASAN handlers These are now processed in afl-qemu-trace so that the "copy+paste" code that is in all of the other AFL tools can be removed. This also allows the AFL_USE_QASAN flag to work the same when used with tools like afl-fuzz as it does with afl-qemu-trace. This is important in situations where loading the QASAN library changes the address of your desired entrypoint, or for crash validation using the same environment that afl-fuzz was using. With this change, the same set of environment variables can be used in exactly the same way between afl-fuzz, afl-showmap, and afl-qemu-trace, and you will get exactly the same guest environment. --- include/common.h | 1 - src/afl-analyze.c | 58 +-------------------------- src/afl-common.c | 60 ---------------------------- src/afl-fuzz.c | 59 +-------------------------- src/afl-showmap.c | 58 +-------------------------- src/afl-tmin.c | 58 +-------------------------- utils/afl_network_proxy/afl-network-server.c | 33 +-------------- 7 files changed, 5 insertions(+), 322 deletions(-) (limited to 'utils') diff --git a/include/common.h b/include/common.h index cd728536..b7adbaec 100644 --- a/include/common.h +++ b/include/common.h @@ -48,7 +48,6 @@ void argv_cpy_free(char **argv); char **get_qemu_argv(u8 *own_loc, u8 **target_path_p, int argc, char **argv); char **get_wine_argv(u8 *own_loc, u8 **target_path_p, int argc, char **argv); char * get_afl_env(char *env); -u8 * get_libqasan_path(u8 *own_loc); extern u8 be_quiet; extern u8 *doc_path; /* path to documentation dir */ diff --git a/src/afl-analyze.c b/src/afl-analyze.c index d46ecb8d..86b0f7e9 100644 --- a/src/afl-analyze.c +++ b/src/afl-analyze.c @@ -822,38 +822,7 @@ static void set_up_environment(void) { if (qemu_mode) { - u8 *qemu_preload = getenv("QEMU_SET_ENV"); - u8 *afl_preload = getenv("AFL_PRELOAD"); - u8 *buf; - - s32 i, afl_preload_size = strlen(afl_preload); - for (i = 0; i < afl_preload_size; ++i) { - - if (afl_preload[i] == ',') { - - PFATAL( - "Comma (',') is not allowed in AFL_PRELOAD when -Q is " - "specified!"); - - } - - } - - if (qemu_preload) { - - buf = alloc_printf("%s,LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", - qemu_preload, afl_preload, afl_preload); - - } else { - - buf = alloc_printf("LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", - afl_preload, afl_preload); - - } - - setenv("QEMU_SET_ENV", buf, 1); - - ck_free(buf); + /* afl-qemu-trace takes care of converting AFL_PRELOAD. */ } else { @@ -1079,31 +1048,6 @@ int main(int argc, char **argv_orig, char **envp) { if (optind == argc || !in_file) { usage(argv[0]); } - if (qemu_mode && getenv("AFL_USE_QASAN")) { - - u8 *preload = getenv("AFL_PRELOAD"); - u8 *libqasan = get_libqasan_path(argv_orig[0]); - - if (!preload) { - - setenv("AFL_PRELOAD", libqasan, 0); - - } else { - - u8 *result = ck_alloc(strlen(libqasan) + strlen(preload) + 2); - strcpy(result, libqasan); - strcat(result, " "); - strcat(result, preload); - - setenv("AFL_PRELOAD", result, 1); - ck_free(result); - - } - - ck_free(libqasan); - - } - map_size = get_map_size(); use_hex_offsets = !!get_afl_env("AFL_ANALYZE_HEX"); diff --git a/src/afl-common.c b/src/afl-common.c index 9f6eb564..5ac50595 100644 --- a/src/afl-common.c +++ b/src/afl-common.c @@ -338,66 +338,6 @@ char **get_wine_argv(u8 *own_loc, u8 **target_path_p, int argc, char **argv) { } -/* Get libqasan path. */ - -u8 *get_libqasan_path(u8 *own_loc) { - - if (!unlikely(own_loc)) { FATAL("BUG: param own_loc is NULL"); } - - u8 *tmp, *cp = NULL, *rsl, *own_copy; - - tmp = getenv("AFL_PATH"); - - if (tmp) { - - cp = alloc_printf("%s/libqasan.so", tmp); - - if (access(cp, X_OK)) { FATAL("Unable to find '%s'", tmp); } - - return cp; - - } - - own_copy = ck_strdup(own_loc); - rsl = strrchr(own_copy, '/'); - - if (rsl) { - - *rsl = 0; - - cp = alloc_printf("%s/libqasan.so", own_copy); - ck_free(own_copy); - - if (!access(cp, X_OK)) { return cp; } - - } else { - - ck_free(own_copy); - - } - - if (!access(AFL_PATH "/libqasan.so", X_OK)) { - - if (cp) { ck_free(cp); } - - return ck_strdup(AFL_PATH "/libqasan.so"); - - } - - SAYF("\n" cLRD "[-] " cRST - "Oops, unable to find the 'libqasan.so' binary. The binary must be " - "built\n" - " separately by following the instructions in " - "qemu_mode/libqasan/README.md. " - "If you\n" - " already have the binary installed, you may need to specify " - "AFL_PATH in the\n" - " environment.\n"); - - FATAL("Failed to locate 'libqasan.so'."); - -} - /* Find binary, used by analyze, showmap, tmin @returns the path, allocating the string */ diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index ff27048a..3ca377f6 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -1022,32 +1022,6 @@ int main(int argc, char **argv_orig, char **envp) { } - if (afl->fsrv.qemu_mode && getenv("AFL_USE_QASAN")) { - - u8 *preload = getenv("AFL_PRELOAD"); - u8 *libqasan = get_libqasan_path(argv_orig[0]); - - if (!preload) { - - setenv("AFL_PRELOAD", libqasan, 0); - - } else { - - u8 *result = ck_alloc(strlen(libqasan) + strlen(preload) + 2); - strcpy(result, libqasan); - strcat(result, " "); - strcat(result, preload); - - setenv("AFL_PRELOAD", result, 1); - ck_free(result); - - } - - afl->afl_env.afl_preload = (u8 *)getenv("AFL_PRELOAD"); - ck_free(libqasan); - - } - if (afl->fsrv.mem_limit && afl->shm.cmplog_mode) afl->fsrv.mem_limit += 260; OKF("afl++ is maintained by Marc \"van Hauser\" Heuse, Heiko \"hexcoder\" " @@ -1312,38 +1286,7 @@ int main(int argc, char **argv_orig, char **envp) { if (afl->fsrv.qemu_mode) { - u8 *qemu_preload = getenv("QEMU_SET_ENV"); - u8 *afl_preload = getenv("AFL_PRELOAD"); - u8 *buf; - - s32 j, afl_preload_size = strlen(afl_preload); - for (j = 0; j < afl_preload_size; ++j) { - - if (afl_preload[j] == ',') { - - PFATAL( - "Comma (',') is not allowed in AFL_PRELOAD when -Q is " - "specified!"); - - } - - } - - if (qemu_preload) { - - buf = alloc_printf("%s,LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", - qemu_preload, afl_preload, afl_preload); - - } else { - - buf = alloc_printf("LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", - afl_preload, afl_preload); - - } - - setenv("QEMU_SET_ENV", buf, 1); - - ck_free(buf); + /* afl-qemu-trace takes care of converting AFL_PRELOAD. */ } else { diff --git a/src/afl-showmap.c b/src/afl-showmap.c index 0fc76193..7bf5a9c7 100644 --- a/src/afl-showmap.c +++ b/src/afl-showmap.c @@ -599,38 +599,7 @@ static void set_up_environment(afl_forkserver_t *fsrv) { if (fsrv->qemu_mode) { - u8 *qemu_preload = getenv("QEMU_SET_ENV"); - u8 *afl_preload = getenv("AFL_PRELOAD"); - u8 *buf; - - s32 i, afl_preload_size = strlen(afl_preload); - for (i = 0; i < afl_preload_size; ++i) { - - if (afl_preload[i] == ',') { - - PFATAL( - "Comma (',') is not allowed in AFL_PRELOAD when -Q is " - "specified!"); - - } - - } - - if (qemu_preload) { - - buf = alloc_printf("%s,LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", - qemu_preload, afl_preload, afl_preload); - - } else { - - buf = alloc_printf("LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", - afl_preload, afl_preload); - - } - - setenv("QEMU_SET_ENV", buf, 1); - - ck_free(buf); + /* afl-qemu-trace takes care of converting AFL_PRELOAD. */ } else { @@ -946,31 +915,6 @@ int main(int argc, char **argv_orig, char **envp) { if (optind == argc || !out_file) { usage(argv[0]); } - if (fsrv->qemu_mode && getenv("AFL_USE_QASAN")) { - - u8 *preload = getenv("AFL_PRELOAD"); - u8 *libqasan = get_libqasan_path(argv_orig[0]); - - if (!preload) { - - setenv("AFL_PRELOAD", libqasan, 0); - - } else { - - u8 *result = ck_alloc(strlen(libqasan) + strlen(preload) + 2); - strcpy(result, libqasan); - strcat(result, " "); - strcat(result, preload); - - setenv("AFL_PRELOAD", result, 1); - ck_free(result); - - } - - ck_free(libqasan); - - } - if (in_dir) { if (!out_file && !collect_coverage) diff --git a/src/afl-tmin.c b/src/afl-tmin.c index 6d04c652..7ef8b9bf 100644 --- a/src/afl-tmin.c +++ b/src/afl-tmin.c @@ -753,38 +753,7 @@ static void set_up_environment(afl_forkserver_t *fsrv) { if (fsrv->qemu_mode) { - u8 *qemu_preload = getenv("QEMU_SET_ENV"); - u8 *afl_preload = getenv("AFL_PRELOAD"); - u8 *buf; - - s32 i, afl_preload_size = strlen(afl_preload); - for (i = 0; i < afl_preload_size; ++i) { - - if (afl_preload[i] == ',') { - - PFATAL( - "Comma (',') is not allowed in AFL_PRELOAD when -Q is " - "specified!"); - - } - - } - - if (qemu_preload) { - - buf = alloc_printf("%s,LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", - qemu_preload, afl_preload, afl_preload); - - } else { - - buf = alloc_printf("LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", - afl_preload, afl_preload); - - } - - setenv("QEMU_SET_ENV", buf, 1); - - ck_free(buf); + /* afl-qemu-trace takes care of converting AFL_PRELOAD. */ } else { @@ -1079,31 +1048,6 @@ int main(int argc, char **argv_orig, char **envp) { check_environment_vars(envp); setenv("AFL_NO_AUTODICT", "1", 1); - if (fsrv->qemu_mode && getenv("AFL_USE_QASAN")) { - - u8 *preload = getenv("AFL_PRELOAD"); - u8 *libqasan = get_libqasan_path(argv_orig[0]); - - if (!preload) { - - setenv("AFL_PRELOAD", libqasan, 0); - - } else { - - u8 *result = ck_alloc(strlen(libqasan) + strlen(preload) + 2); - strcpy(result, libqasan); - strcat(result, " "); - strcat(result, preload); - - setenv("AFL_PRELOAD", result, 1); - ck_free(result); - - } - - ck_free(libqasan); - - } - /* initialize cmplog_mode */ shm.cmplog_mode = 0; diff --git a/utils/afl_network_proxy/afl-network-server.c b/utils/afl_network_proxy/afl-network-server.c index fe225416..0dfae658 100644 --- a/utils/afl_network_proxy/afl-network-server.c +++ b/utils/afl_network_proxy/afl-network-server.c @@ -237,38 +237,7 @@ static void set_up_environment(afl_forkserver_t *fsrv) { if (fsrv->qemu_mode) { - u8 *qemu_preload = getenv("QEMU_SET_ENV"); - u8 *afl_preload = getenv("AFL_PRELOAD"); - u8 *buf; - - s32 i, afl_preload_size = strlen(afl_preload); - for (i = 0; i < afl_preload_size; ++i) { - - if (afl_preload[i] == ',') { - - PFATAL( - "Comma (',') is not allowed in AFL_PRELOAD when -Q is " - "specified!"); - - } - - } - - if (qemu_preload) { - - buf = alloc_printf("%s,LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", - qemu_preload, afl_preload, afl_preload); - - } else { - - buf = alloc_printf("LD_PRELOAD=%s,DYLD_INSERT_LIBRARIES=%s", - afl_preload, afl_preload); - - } - - setenv("QEMU_SET_ENV", buf, 1); - - afl_free(buf); + /* afl-qemu-trace takes care of converting AFL_PRELOAD. */ } else { -- cgit 1.4.1 From 862cb3217f5983e5cfff6568f6b31fcf1e960802 Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Tue, 16 Mar 2021 14:38:13 +0100 Subject: fix cmplog rtn --- include/envs.h | 1 + instrumentation/afl-compiler-rt.o.c | 10 +++++----- src/afl-common.c | 6 ++++-- utils/aflpp_driver/aflpp_driver.c | 10 ++++++++++ 4 files changed, 20 insertions(+), 7 deletions(-) (limited to 'utils') diff --git a/include/envs.h b/include/envs.h index e92bee2a..cfd73b68 100644 --- a/include/envs.h +++ b/include/envs.h @@ -50,6 +50,7 @@ static char *afl_environment_variables[] = { "AFL_FAST_CAL", "AFL_FORCE_UI", "AFL_FUZZER_ARGS", // oss-fuzz + "AFL_GDB", "AFL_GCC_ALLOWLIST", "AFL_GCC_DENYLIST", "AFL_GCC_BLOCKLIST", diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c index cca38cd0..32dbc53d 100644 --- a/instrumentation/afl-compiler-rt.o.c +++ b/instrumentation/afl-compiler-rt.o.c @@ -1730,18 +1730,18 @@ __attribute__((weak)) void *__asan_region_is_poisoned(void *beg, size_t size) { // to avoid to call it on .text addresses static int area_is_valid(void *ptr, size_t len) { - if (unlikely(__asan_region_is_poisoned(ptr, len))) { return 0; } + if (unlikely(!ptr || __asan_region_is_poisoned(ptr, len))) { return 0; } - long r = syscall(__afl_dummy_fd[1], SYS_write, ptr, len); + long r = syscall(SYS_write, __afl_dummy_fd[1], ptr, len); if (unlikely(r <= 0 || r > len)) { // fail - maybe hitting asan boundary? char *p = (char *)ptr; long page_size = sysconf(_SC_PAGE_SIZE); char *page = (char *)((uintptr_t)p & ~(page_size - 1)) + page_size; - if (page < p + len) { return 0; } // no isnt, return fail - len -= (p + len - page); - r = syscall(__afl_dummy_fd[1], SYS_write, p, len); + if (page >= p + len) { return 0; } // no isnt, return fail + len = page - p - len; + r = syscall(SYS_write, __afl_dummy_fd[1], p, len); } diff --git a/src/afl-common.c b/src/afl-common.c index bfb05a67..27b63434 100644 --- a/src/afl-common.c +++ b/src/afl-common.c @@ -150,10 +150,12 @@ void argv_cpy_free(char **argv) { char **get_qemu_argv(u8 *own_loc, u8 **target_path_p, int argc, char **argv) { if (unlikely(getenv("AFL_QEMU_CUSTOM_BIN"))) { + WARNF( - "AFL_QEMU_CUSTOM_BIN is enabled. " - "You must run your target under afl-qemu-trace on your own!"); + "AFL_QEMU_CUSTOM_BIN is enabled. " + "You must run your target under afl-qemu-trace on your own!"); return argv; + } if (!unlikely(own_loc)) { FATAL("BUG: param own_loc is NULL"); } diff --git a/utils/aflpp_driver/aflpp_driver.c b/utils/aflpp_driver/aflpp_driver.c index 9c97607c..f0f3a47d 100644 --- a/utils/aflpp_driver/aflpp_driver.c +++ b/utils/aflpp_driver/aflpp_driver.c @@ -208,6 +208,16 @@ int main(int argc, char **argv) { "======================================================\n", argv[0], argv[0]); + if (getenv("AFL_GDB")) { + + char cmd[64]; + snprintf(cmd, sizeof(cmd), "cat /proc/%d/maps", getpid()); + system(cmd); + fprintf(stderr, "DEBUG: aflpp_driver pid is %d\n", getpid()); + sleep(1); + + } + output_file = stderr; maybe_duplicate_stderr(); maybe_close_fd_mask(); -- cgit 1.4.1 From 6840e8fd2adfd8364787665b7df2fd7b742a580c Mon Sep 17 00:00:00 2001 From: hexcoder Date: Tue, 16 Mar 2021 22:58:10 +0100 Subject: fix two bugs in error message $1 and $2 have been modified here by two previous shift commands. --- utils/crash_triage/triage_crashes.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'utils') diff --git a/utils/crash_triage/triage_crashes.sh b/utils/crash_triage/triage_crashes.sh index bf763cba..4e8f09a0 100755 --- a/utils/crash_triage/triage_crashes.sh +++ b/utils/crash_triage/triage_crashes.sh @@ -60,12 +60,12 @@ if fi if [ ! -f "$BIN" -o ! -x "$BIN" ]; then - echo "[-] Error: binary '$2' not found or is not executable." 1>&2 + echo "[-] Error: binary '$BIN' not found or is not executable." 1>&2 exit 1 fi if [ ! -d "$DIR/queue" ]; then - echo "[-] Error: directory '$1' not found or not created by afl-fuzz." 1>&2 + echo "[-] Error: directory '$DIR/queue' not found or not created by afl-fuzz." 1>&2 exit 1 fi -- cgit 1.4.1 From a7797f0cb98fa372c0838053ae9e6fb7ff98b7d4 Mon Sep 17 00:00:00 2001 From: hexcoder Date: Wed, 17 Mar 2021 08:04:29 +0100 Subject: fix is now closer to original statement --- utils/crash_triage/triage_crashes.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils') diff --git a/utils/crash_triage/triage_crashes.sh b/utils/crash_triage/triage_crashes.sh index 4e8f09a0..a752458d 100755 --- a/utils/crash_triage/triage_crashes.sh +++ b/utils/crash_triage/triage_crashes.sh @@ -65,7 +65,7 @@ if [ ! -f "$BIN" -o ! -x "$BIN" ]; then fi if [ ! -d "$DIR/queue" ]; then - echo "[-] Error: directory '$DIR/queue' not found or not created by afl-fuzz." 1>&2 + echo "[-] Error: directory '$DIR' not found or not created by afl-fuzz." 1>&2 exit 1 fi -- cgit 1.4.1