Home | History | Annotate | Line # | Download | only in dc
      1  1.1  christos /*	$OpenBSD: extern.h,v 1.5 2015/10/10 19:28:54 deraadt Exp $	*/
      2  1.1  christos 
      3  1.1  christos /*
      4  1.1  christos  * Copyright (c) 2003, Otto Moerbeek <otto (at) drijf.net>
      5  1.1  christos  *
      6  1.1  christos  * Permission to use, copy, modify, and distribute this software for any
      7  1.1  christos  * purpose with or without fee is hereby granted, provided that the above
      8  1.1  christos  * copyright notice and this permission notice appear in all copies.
      9  1.1  christos  *
     10  1.1  christos  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     11  1.1  christos  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     12  1.1  christos  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     13  1.1  christos  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     14  1.1  christos  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     15  1.1  christos  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     16  1.1  christos  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     17  1.1  christos  */
     18  1.1  christos 
     19  1.1  christos #include <stdbool.h>
     20  1.1  christos #include "bcode.h"
     21  1.1  christos 
     22  1.1  christos 
     23  1.1  christos /* inout.c */
     24  1.1  christos void		src_setstream(struct source *, FILE *);
     25  1.1  christos void		src_setstring(struct source *, char *);
     26  1.1  christos struct number	*readnumber(struct source *, u_int);
     27  1.1  christos void		printnumber(FILE *, const struct number *, u_int);
     28  1.1  christos char		*read_string(struct source *);
     29  1.1  christos void		print_value(FILE *, const struct value *, const char *, u_int);
     30  1.1  christos void		print_ascii(FILE *, const struct number *);
     31  1.1  christos 
     32  1.1  christos /* mem.c */
     33  1.1  christos struct number	*new_number(void);
     34  1.1  christos void		free_number(struct number *);
     35  1.1  christos struct number	*dup_number(const struct number *);
     36  1.1  christos void		*bmalloc(size_t);
     37  1.1  christos void		*breallocarray(void *, size_t, size_t);
     38  1.1  christos char		*bstrdup(const char *p);
     39  1.1  christos void		bn_check(int);
     40  1.1  christos void		bn_checkp(const void *);
     41  1.1  christos 
     42  1.1  christos /* stack.c */
     43  1.1  christos void		stack_init(struct stack *);
     44  1.1  christos void		stack_free_value(struct value *);
     45  1.1  christos struct value	*stack_dup_value(const struct value *, struct value *);
     46  1.1  christos void		stack_swap(struct stack *);
     47  1.1  christos size_t		stack_size(const struct stack *);
     48  1.1  christos void		stack_dup(struct stack *);
     49  1.1  christos void		stack_pushnumber(struct stack *, struct number *);
     50  1.1  christos void		stack_pushstring(struct stack *stack, char *);
     51  1.1  christos void		stack_push(struct stack *, struct value *);
     52  1.1  christos void		stack_set_tos(struct stack *, struct value *);
     53  1.1  christos struct value	*stack_tos(const struct stack *);
     54  1.1  christos struct value	*stack_pop(struct stack *);
     55  1.1  christos struct number	*stack_popnumber(struct stack *);
     56  1.1  christos char *		stack_popstring(struct stack *);
     57  1.1  christos void		stack_clear(struct stack *);
     58  1.1  christos void		stack_print(FILE *, const struct stack *, const char *,
     59  1.1  christos 		    u_int base);
     60  1.1  christos void		frame_assign(struct stack *, size_t, const struct value *);
     61  1.1  christos struct value *	frame_retrieve(const struct stack *, size_t);
     62  1.1  christos /* void		frame_free(struct stack *); */
     63  1.1  christos 
     64  1.1  christos int		dc_main(int, char **);
     65