Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
8323 maxcodehac 1
/* -----------------------------------------------------------------------------
2
 * input.h
3
 *
4
 * Copyright (c) 2006, Vivek Mohan 
5
 * All rights reserved. See LICENSE
6
 * -----------------------------------------------------------------------------
7
 */
8
#ifndef UD_INPUT_H
9
#define UD_INPUT_H
10
 
11
#include "types.h"
12
 
13
uint8_t inp_next(struct ud*);
14
uint8_t inp_peek(struct ud*);
15
uint8_t inp_uint8(struct ud*);
16
uint16_t inp_uint16(struct ud*);
17
uint32_t inp_uint32(struct ud*);
18
uint64_t inp_uint64(struct ud*);
19
void inp_move(struct ud*, size_t);
20
void inp_back(struct ud*);
21
 
22
/* inp_init() - Initializes the input system. */
23
#define inp_init(u) \
24
do { \
25
  u->inp_curr = 0; \
26
  u->inp_fill = 0; \
27
  u->inp_ctr  = 0; \
28
  u->inp_end  = 0; \
29
} while (0)
30
 
31
/* inp_start() - Should be called before each de-code operation. */
32
#define inp_start(u) u->inp_ctr = 0
33
 
34
/* inp_back() - Resets the current pointer to its position before the current
35
 * instruction disassembly was started.
36
 */
37
#define inp_reset(u) \
38
do { \
39
  u->inp_curr -= u->inp_ctr; \
40
  u->inp_ctr = 0; \
41
} while (0)
42
 
43
/* inp_sess() - Returns the pointer to current session. */
44
#define inp_sess(u) (u->inp_sess)
45
 
46
/* inp_cur() - Returns the current input byte. */
47
#define inp_curr(u) ((u)->inp_cache[(u)->inp_curr])
48
 
49
#endif