add public.h

This commit is contained in:
blueloveTH 2024-06-16 22:22:44 +08:00
parent ea269686b5
commit 17d0c87c96
4 changed files with 26 additions and 13 deletions

View File

@ -7,20 +7,12 @@
#include "string.h"
#include "pocketpy/common/utils.h"
#include "pocketpy/objects/public.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef int16_t pkpy_Type;
typedef struct PyObject PyObject;
typedef struct pkpy_VM pkpy_VM;
struct pkpy_G {
pkpy_VM* vm;
} extern pkpy_g;
typedef struct PyVar{
pkpy_Type type;
bool is_ptr;
@ -77,10 +69,6 @@ PK_INLINE bool PyVar__IS_OP(const PyVar* a, const PyVar* b){
extern PyVar pkpy_NULL, pkpy_OP_CALL, pkpy_OP_YIELD;
bool py_eq(const PyVar*, const PyVar*);
bool py_le(const PyVar*, const PyVar*);
int64_t py_hash(const PyVar*);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,24 @@
#pragma once
#include "stdint.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef int16_t pkpy_Type;
typedef struct PyObject PyObject;
typedef struct PyVar PyVar;
typedef struct pkpy_VM pkpy_VM;
struct pkpy_G {
pkpy_VM* vm;
} extern pkpy_g;
bool py_eq(const PyVar*, const PyVar*);
bool py_le(const PyVar*, const PyVar*);
int64_t py_hash(const PyVar*);
#ifdef __cplusplus
}
#endif

View File

@ -3,6 +3,7 @@
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "pocketpy/objects/public.h"
#define DICT_MAX_LOAD 0.75
#define DICT_HASH_NEXT(h) ((h) * 5 + 1)