mirror of https://github.com/mgba-emu/mgba.git
Util: Add some base vector implementations
This commit is contained in:
parent
7824a317ae
commit
62c84ab815
|
@ -97,8 +97,16 @@ CXX_GUARD_START
|
||||||
dest->size = src->size; \
|
dest->size = src->size; \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
DECLARE_VECTOR(StringList, char*);
|
|
||||||
DECLARE_VECTOR(IntList, int);
|
DECLARE_VECTOR(IntList, int);
|
||||||
|
DECLARE_VECTOR(SInt8List, int8_t);
|
||||||
|
DECLARE_VECTOR(SInt16List, int16_t);
|
||||||
|
DECLARE_VECTOR(SInt32List, int32_t);
|
||||||
|
DECLARE_VECTOR(SIntPtrList, intptr_t);
|
||||||
|
DECLARE_VECTOR(UInt8List, uint8_t);
|
||||||
|
DECLARE_VECTOR(UInt16List, uint16_t);
|
||||||
|
DECLARE_VECTOR(UInt32List, uint32_t);
|
||||||
|
DECLARE_VECTOR(UIntPtrList, uintptr_t);
|
||||||
|
DECLARE_VECTOR(StringList, char*);
|
||||||
|
|
||||||
CXX_GUARD_END
|
CXX_GUARD_END
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
|
|
||||||
DEFINE_VECTOR(LexVector, struct Token);
|
DEFINE_VECTOR(LexVector, struct Token);
|
||||||
|
|
||||||
DEFINE_VECTOR(IntList, int32_t);
|
|
||||||
|
|
||||||
enum LexState {
|
enum LexState {
|
||||||
LEX_ERROR = -1,
|
LEX_ERROR = -1,
|
||||||
LEX_ROOT = 0,
|
LEX_ROOT = 0,
|
||||||
|
|
|
@ -8,6 +8,7 @@ set(BASE_SOURCE_FILES
|
||||||
hash.c
|
hash.c
|
||||||
string.c
|
string.c
|
||||||
table.c
|
table.c
|
||||||
|
vector.c
|
||||||
vfs.c)
|
vfs.c)
|
||||||
|
|
||||||
set(SOURCE_FILES
|
set(SOURCE_FILES
|
||||||
|
|
|
@ -5,12 +5,8 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
#include <mgba-util/string.h>
|
#include <mgba-util/string.h>
|
||||||
|
|
||||||
#include <mgba-util/vector.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
DEFINE_VECTOR(StringList, char*);
|
|
||||||
|
|
||||||
#ifndef HAVE_STRNDUP
|
#ifndef HAVE_STRNDUP
|
||||||
char* strndup(const char* start, size_t len) {
|
char* strndup(const char* start, size_t len) {
|
||||||
// This is suboptimal, but anything recent should have strndup
|
// This is suboptimal, but anything recent should have strndup
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
/* Copyright (c) 2013-2023 Jeffrey Pfau
|
||||||
|
*
|
||||||
|
* 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/. */
|
||||||
|
#include <mgba-util/vector.h>
|
||||||
|
|
||||||
|
DEFINE_VECTOR(IntList, int);
|
||||||
|
DEFINE_VECTOR(SInt8List, int8_t);
|
||||||
|
DEFINE_VECTOR(SInt16List, int16_t);
|
||||||
|
DEFINE_VECTOR(SInt32List, int32_t);
|
||||||
|
DEFINE_VECTOR(SIntPtrList, intptr_t);
|
||||||
|
DEFINE_VECTOR(UInt8List, uint8_t);
|
||||||
|
DEFINE_VECTOR(UInt16List, uint16_t);
|
||||||
|
DEFINE_VECTOR(UInt32List, uint32_t);
|
||||||
|
DEFINE_VECTOR(UIntPtrList, uintptr_t);
|
||||||
|
DEFINE_VECTOR(StringList, char*);
|
Loading…
Reference in New Issue