File tree Expand file tree Collapse file tree 1 file changed +22
-10
lines changed
Expand file tree Collapse file tree 1 file changed +22
-10
lines changed Original file line number Diff line number Diff line change 1- #ifndef PROX_VM_H
2- #define PROX_VM_H
1+ #ifndef PROXPL_VM_H
2+ #define PROXPL_VM_H
33
44#include "chunk.h"
55#include "value.h"
6+ #include "table.h" // Agar table.h nahi hai to isse hata dein, but usually chahiye hota hai
7+ #include "object.h"
68
79#define STACK_MAX 256
810
911typedef struct {
10- Chunk * chunk ;
11- u8 * ip ; // Instruction Pointer
12+ Chunk * chunk ;
13+ uint8_t * ip ;
1214 Value stack [STACK_MAX ];
13- Value * stackTop ;
15+ Value * stackTop ;
16+ Obj * objects ; // <--- YE MISSING THA (Bahut Zaroori)
17+ // Table strings; // Future ke liye
18+ // Table globals; // Future ke liye
1419} VM ;
1520
1621typedef enum {
@@ -19,10 +24,17 @@ typedef enum {
1924 INTERPRET_RUNTIME_ERROR
2025} InterpretResult ;
2126
22- void initVM (VM * vm );
23- void freeVM (VM * vm );
24- InterpretResult interpret (VM * vm , Chunk * chunk );
25- void push (VM * vm , Value value );
26- Value pop (VM * vm );
27+ // Global VM instance
28+ extern VM vm ;
29+
30+ void initVM ();
31+ void freeVM ();
32+ InterpretResult interpret (Chunk * chunk );
33+ void push (Value value );
34+ Value pop ();
35+
36+ // Native function definition (Needed for convert_native.c)
37+ void defineNative (VM * vm , const char * name , NativeFn function );
2738
2839#endif
40+
You can’t perform that action at this time.
0 commit comments