1202719Sgabor/* $FreeBSD$ */ 2202719Sgabor/* $OpenBSD: extern.h,v 1.3 2006/01/16 08:09:25 otto Exp $ */ 3202719Sgabor 4202719Sgabor/* 5202719Sgabor * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net> 6202719Sgabor * 7202719Sgabor * Permission to use, copy, modify, and distribute this software for any 8202719Sgabor * purpose with or without fee is hereby granted, provided that the above 9202719Sgabor * copyright notice and this permission notice appear in all copies. 10202719Sgabor * 11202719Sgabor * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12202719Sgabor * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13202719Sgabor * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14202719Sgabor * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15202719Sgabor * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16202719Sgabor * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17202719Sgabor * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18202719Sgabor */ 19202719Sgabor 20202719Sgabor#include <stdbool.h> 21202719Sgabor#include "bcode.h" 22202719Sgabor 23202719Sgabor 24202719Sgabor/* inout.c */ 25202719Sgaborvoid src_setstream(struct source *, FILE *); 26202719Sgaborvoid src_setstring(struct source *, char *); 27202719Sgaborstruct number *readnumber(struct source *, u_int); 28202719Sgaborvoid printnumber(FILE *, const struct number *, u_int); 29202719Sgaborchar *read_string(struct source *); 30202719Sgaborvoid print_value(FILE *, const struct value *, const char *, u_int); 31202719Sgaborvoid print_ascii(FILE *, const struct number *); 32202719Sgabor 33202719Sgabor/* mem.c */ 34202719Sgaborstruct number *new_number(void); 35202719Sgaborvoid free_number(struct number *); 36202719Sgaborstruct number *dup_number(const struct number *); 37202719Sgaborvoid *bmalloc(size_t); 38202719Sgaborvoid *brealloc(void *, size_t); 39202719Sgaborchar *bstrdup(const char *p); 40202719Sgaborvoid bn_check(int); 41202719Sgaborvoid bn_checkp(const void *); 42202719Sgabor 43202719Sgabor/* stack.c */ 44202719Sgaborvoid stack_init(struct stack *); 45202719Sgaborvoid stack_free_value(struct value *); 46202719Sgaborstruct value *stack_dup_value(const struct value *, struct value *); 47202719Sgaborvoid stack_swap(struct stack *); 48202719Sgaborsize_t stack_size(const struct stack *); 49202719Sgaborvoid stack_dup(struct stack *); 50202719Sgaborvoid stack_pushnumber(struct stack *, struct number *); 51202719Sgaborvoid stack_pushstring(struct stack *stack, char *); 52202719Sgaborvoid stack_push(struct stack *, struct value *); 53202719Sgaborvoid stack_set_tos(struct stack *, struct value *); 54202719Sgaborstruct value *stack_tos(const struct stack *); 55202719Sgaborstruct value *stack_pop(struct stack *); 56202719Sgaborstruct number *stack_popnumber(struct stack *); 57202719Sgaborchar *stack_popstring(struct stack *); 58202719Sgaborvoid stack_clear(struct stack *); 59202719Sgaborvoid stack_print(FILE *, const struct stack *, const char *, 60202719Sgabor u_int base); 61202719Sgaborvoid frame_assign(struct stack *, size_t, const struct value *); 62202719Sgaborstruct value *frame_retrieve(const struct stack *, size_t); 63202719Sgabor/* void frame_free(struct stack *); */ 64