GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_io_parser.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later
2/*
3 * Copyright (C) 2009-2025 Cyril Hrubis <metan@ucw.cz>
4 */
5
11#ifndef LOADERS_GP_IO_PARSER_H
12#define LOADERS_GP_IO_PARSER_H
13
14#include <loaders/gp_io.h>
15
29 GP_IO_CONST = 0x0000,
31 GP_IO_BYTE = 0x0100,
38 GP_IO_L2 = 0x0200,
45 GP_IO_L4 = 0x0300,
52 GP_IO_B2 = 0x0400,
59 GP_IO_B4 = 0x0500,
61 GP_IO_ARRAY = 0x0600,
63 GP_IO_IGN = 0x0700,
81 GP_IO_PPSTR = 0x0800,
87 GP_IO_END = 0xff00,
88};
89
90#define GP_IO_TYPE_MASK 0xff00
91
124int gp_io_readf(gp_io *self, const uint16_t *types, ...);
125
150int gp_io_writef(gp_io *self, const uint16_t *types, ...);
151
163int gp_io_read_b4(gp_io *self, uint32_t *val);
164
176int gp_io_read_b2(gp_io *self, uint16_t *val);
177
188char *gp_io_read_b2_utf16(gp_io *io, size_t nchars);
189
190#endif /* LOADERS_GP_IO_PARSER_H */
I/O abstraction for gfxprim loaders.
int gp_io_readf(gp_io *self, const uint16_t *types,...)
Parses a data accodingly to the array of types.
int gp_io_read_b4(gp_io *self, uint32_t *val)
Reads a single 32bit big endian integer.
gp_io_fmt_types
Formatted binary read and write types.
@ GP_IO_CONST
A constant byte in lower half of the 16bit integer.
@ GP_IO_L2
Reads or writes two bytes in a little endian order.
@ GP_IO_L4
Reads or writes four bytes in a little endian order.
@ GP_IO_B2
Reads or writes two bytes in a big endian order.
@ GP_IO_IGN
Ignore bytes on read, size in lower half.
@ GP_IO_BYTE
Reads or writes a single byte.
@ GP_IO_ARRAY
Pointer to byte array, size in lower half.
@ GP_IO_B4
Reads or writes four bytes in a big endian order.
@ GP_IO_I1
Ignore single byte on read.
@ GP_IO_I2
Ignore two bytes on read.
@ GP_IO_I3
Ignore three bytes on read.
@ GP_IO_I4
Ignore four bytes on read.
@ GP_IO_PPSTR
A photoshop pascal string.
@ GP_IO_END
End of the types array.
int gp_io_writef(gp_io *self, const uint16_t *types,...)
Writes a data accodingly to the array of types.
char * gp_io_read_b2_utf16(gp_io *io, size_t nchars)
Reads unicode string stored in big endian utf16 format.
int gp_io_read_b2(gp_io *self, uint16_t *val)
Reads a single 16bit big endian integer.
An I/O abstraction.
Definition gp_io.h:23