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