| 
				
				
					
						
					
				
				
				 | 
			
			 | 
			
			@ -8,6 +8,10 @@ | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#define INK_ROUTINE_CAN_REUSE 32 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#define INK_ROUTINE_SUCCESS 1 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#ifdef __cplusplus | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			extern "C" { | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#endif | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			struct elem { | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int type; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int value; | 
			
		
		
	
	
		
			
				| 
				
				
				
					
						
					
				
				 | 
			
			 | 
			
			@ -19,74 +23,83 @@ struct stack_frame { | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			}; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			struct fn { | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				char* name; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				struct elem* things; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				char *name; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				struct elem *things; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int size; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			}; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			struct context; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			struct native_fn { | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				char* name; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				void(*value)(struct context*); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				char *name; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				void (*value)(struct context *); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			}; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			struct ink_routine { | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int panic; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				struct elem* stack; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				struct elem *stack; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int capacity; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int top; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				struct stack_frame* function_stack; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				struct stack_frame *function_stack; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int function_stack_capacity; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int function_stack_top; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				void* routine_userdata; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				void *routine_userdata; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			}; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			struct context { | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int panic; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				void*(*malloc)(size_t); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				void*(*realloc)(void*, size_t); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				void(*free)(void*); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int(*putchar)(int); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				struct ink_routine* routines; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				void *(*malloc)(size_t); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				void *(*realloc)(void *, size_t); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				void (*free)(void *); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int (*putchar)(int); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				struct ink_routine *routines; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int routines_capacity; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int routines_top; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int routine_current; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				struct native_fn* native_words; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				struct native_fn *native_words; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int native_words_capacity; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int native_words_top; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				struct fn* words; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				struct fn *words; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int words_capacity; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int words_top; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				char** lex_reserved_words; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				char **lex_reserved_words; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int lex_reserved_words_capacity; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				int lex_reserved_words_top; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				unsigned int steps; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				void* persistent_userdata; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
				void *persistent_userdata; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			}; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_make_routine(struct context* ctx); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_kill_routine(struct context* ctx, int routine); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_add_native(struct context* ctx, const char* name, void(*value)(struct context*)); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_push(struct context* ctx, struct elem value); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_push_fn(struct context* ctx, struct stack_frame value); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			struct context* ink_make_context(void*(*malloc)(size_t), void*(*realloc)(void*, size_t), void(*free)(void*), int(*putchar)(int)); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_make_routine(struct context *ctx); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_kill_routine(struct context *ctx, int routine); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_add_native(struct context *ctx, const char *name, void(*value)(struct context *)); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_push(struct context *ctx, struct elem value); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_push_fn(struct context *ctx, struct stack_frame value); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			struct context* ink_make_context(void *(*malloc)(size_t), void *(*realloc)(void *, size_t), void(*free)(void *), int(*putchar)(int)); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#ifndef NOSTDLIB | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			struct context* ink_make_default_context(); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#endif | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_step(struct context *pContext); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_can_run(struct context *pContext); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_step_everyone(struct context* pContext); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			void ink_compile(struct context *pContext, char* buffer); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_std_library(struct context* ctx); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			void ink_pop_fn(struct context* ctx); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			void ink_pop(struct context* ctx); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_step_everyone(struct context *pContext); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			void ink_compile(struct context *pContext, char *buffer); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			int ink_std_library(struct context *ctx); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			void ink_pop_fn(struct context *ctx); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			void ink_pop(struct context *ctx); | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			
 | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#ifdef __cplusplus | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			}; | 
			
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
			#endif |