diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-11-02 18:21:49 +0100 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-11-12 00:47:10 +0100 |
| commit | b16e2f67e7d392890c6835f98ca9b2a7bb44fe2e (patch) | |
| tree | cf07afb610395dd182e1f243ffccf2a55a13effe /types.h | |
Diffstat (limited to 'types.h')
| -rw-r--r-- | types.h | 74 |
1 files changed, 74 insertions, 0 deletions
@@ -0,0 +1,74 @@ +/* + * wadb, a WebAssembly debugger + * Copyright (C) 2025 Xavier Del Campo Romero + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#ifndef TYPES_H +#define TYPES_H + +#include <stdbool.h> +#include <stddef.h> +#include <stdint.h> +#include <stdio.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +enum +{ + SECTION_CUSTOM, + SECTION_TYPE, + SECTION_IMPORT, + SECTION_FUNCTION, + SECTION_TABLE, + SECTION_MEMORY, + SECTION_GLOBAL, + SECTION_EXPORT, + SECTION_START, + SECTION_ELEMENT, + SECTION_CODE, + SECTION_DATA +}; + +typedef bool varint1; +typedef bool varuint1; +typedef signed char varint7; +typedef short varint16; +typedef long varint32; +typedef long long varint64; +typedef unsigned char varuint7; +typedef unsigned short varuint16; +typedef unsigned long varuint32; +typedef unsigned long long varuint64; +typedef varint7 value_type; + +int read_varint1(FILE *f, varint1 *out); +int read_varint7(FILE *f, varint7 *out); +int read_varint32(FILE *f, varint32 *out); +int read_varint64(FILE *f, varint64 *out); +int read_varuint1(FILE *f, varuint1 *out); +int read_varuint7(FILE *f, varuint7 *out); +int read_varuint32(FILE *f, varuint32 *out); +int read_varuint64(FILE *f, varuint64 *out); +int read_value_type(FILE *f, value_type *out); + +#ifdef __cplusplus +} +#endif + +#endif |
