fallout2-ce/src/sfall_arrays.h

35 lines
1.2 KiB
C
Raw Normal View History

2023-05-27 07:11:46 -07:00
#ifndef FALLOUT_SFALL_ARRAYS_H_
#define FALLOUT_SFALL_ARRAYS_H_
2023-04-19 16:23:33 -07:00
#include "interpreter.h"
namespace fallout {
#define SFALL_ARRAYFLAG_ASSOC (1) // is map
#define SFALL_ARRAYFLAG_CONSTVAL (2) // don't update value of key if the key exists in map
#define SFALL_ARRAYFLAG_RESERVED (4)
using ArrayId = unsigned int;
2023-05-27 07:11:46 -07:00
bool sfallArraysInit();
void sfallArraysReset();
void sfallArraysExit();
ArrayId CreateArray(int len, unsigned int flags);
ArrayId CreateTempArray(int len, unsigned int flags);
ProgramValue GetArrayKey(ArrayId arrayId, int index, Program* program);
int LenArray(ArrayId arrayId);
ProgramValue GetArray(ArrayId arrayId, const ProgramValue& key, Program* program);
void SetArray(ArrayId arrayId, const ProgramValue& key, const ProgramValue& val, bool allowUnset, Program* program);
void FreeArray(ArrayId arrayId);
2023-04-19 16:53:49 -07:00
void FixArray(ArrayId id);
2023-05-27 07:11:46 -07:00
void ResizeArray(ArrayId arrayId, int newLen);
2023-04-19 16:46:24 -07:00
void DeleteAllTempArrays();
2023-05-14 11:54:41 -07:00
int StackArray(const ProgramValue& key, const ProgramValue& val, Program* program);
2023-05-27 07:11:46 -07:00
ProgramValue ScanArray(ArrayId arrayId, const ProgramValue& val, Program* program);
2023-04-19 23:34:53 -07:00
2023-05-15 07:50:49 -07:00
ArrayId StringSplit(const char* str, const char* split);
2023-04-19 16:23:33 -07:00
}
2023-05-27 07:11:46 -07:00
#endif /* FALLOUT_SFALL_ARRAYS_H_ */