My Project
util.h
Go to the documentation of this file.
1 #ifndef __UTIL_H__
2 #define __UTIL_H__
3 
4 /*
5  * "Copyright (c) 2012 by Fritz Sieker."
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation for any purpose, without fee, and without written
9  * agreement is hereby granted, provided that the above copyright notice
10  * and the following two paragraphs appear in all copies of this software,
11  * that the files COPYING and NO_WARRANTY are included verbatim with
12  * any distribution, and that the contents of the file README are included
13  * verbatim as part of a file named README with any distribution.
14  *
15  * IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT,
16  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
17  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHOR
18  * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19  *
20  * THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22  * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
23  * BASIS, AND THE AUTHOR NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
24  * UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
25  */
26 
37 #include <stdbool.h>
38 
40 typedef struct name_val {
41  char* name;
42  int val;
43 } name_val_t;
44 
54 name_val_t* util_bin_search (name_val_t map[], int numNames, const char* name);
55 
61 int util_get_opcode (const char* name);
62 
69 int util_is_valid_label(const char* s);
70 
78 int util_get_reg (const char* regStr);
79 
89 int util_parse_cond (const char* condCodeStr);
90 
99 bool util_get_int (const char* token, int* value);
100 
101 #endif
int util_get_reg(const char *regStr)
Definition: util.c:65
struct name_val name_val_t
int util_get_opcode(const char *name)
Definition: util.c:38
Definition: util.h:40
int util_is_valid_label(const char *s)
Definition: util.c:43
int util_parse_cond(const char *condCodeStr)
Definition: util.c:71
name_val_t * util_bin_search(name_val_t map[], int numNames, const char *name)
Definition: util.c:33
char * name
Definition: util.h:41
int val
Definition: util.h:42
bool util_get_int(const char *token, int *value)
Definition: util.c:76