-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonty.h
More file actions
82 lines (68 loc) · 2.36 KB
/
Copy pathmonty.h
File metadata and controls
82 lines (68 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef _MONTY_H_
#define _MONTY_H
#include <stddef.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#define _GNU_SOURCE
extern unsigned int count_line;
extern unsigned int status;
/**
* struct stack_s - doubly linked list representation of a stack (or queue)
* @n: integer
* @prev: points to the previous element of the stack (or queue)
* @next: points to the next element of the stack (or queue)
*
* Description: doubly linked list node structure
* for stack, queues, LIFO, FIFO
*/
typedef struct stack_s
{
int n;
struct stack_s *prev;
struct stack_s *next;
} stack_t;
/**
* struct instruction_s - opcode and its function
* @opcode: the opcode
* @f: function to handle the opcode
*
* Description: opcode and its function
* for stack, queues, LIFO, FIFO
*/
typedef struct instruction_s
{
char *opcode;
void (*f)(stack_t **stack, unsigned int line_number);
} instruction_t;
/***************push_and_pall.c************/
void _pall(stack_t **list, unsigned int count);
void _push(stack_t **list, unsigned int count);
/***************opcode.c*******************/
void call(char **opcode_tokens, stack_t **stack);
void is_token(char **opcode_tokens, stack_t **stack);
/**************strtok.c********************/
char **strtok_opcode(char *str);
/*************free_stack.c***************/
void free_stack(stack_t **stack);
/************pop_pint_swap_add.c*********/
void _pop(stack_t **stack, unsigned int number);
void _pint(stack_t **stack, unsigned int number);
void _swap(stack_t **stack, unsigned int count_line);
void _add(stack_t **stack, unsigned int count_line);
/**************sub_div_mul_mod.c*********/
void _sub(stack_t **stack, unsigned int count_line);
void _div(stack_t **stack, unsigned int count_line);
void _mul(stack_t **stack, unsigned int count_line);
void _mod(stack_t **stack, unsigned int count_line);
/**************pchar_pstr.c**************************/
void _pchar(stack_t **stack, unsigned int count_line);
void _pstr(stack_t **stack, unsigned int count_line);
/*************rotl_and_rotr.c*********************/
void _rotl(stack_t **stack, unsigned int count_line);
void _rotr(stack_t **stack, unsigned int count_line);
/*************stack_queue.c*********************/
void _stack(stack_t **stack, unsigned int count_line);
void _queue(stack_t **stack, unsigned int count_line);
#endif