Chameleon

Chameleon Svn Source Tree

Root/branches/azimutz/Chazi/i386/libsaio/aml_generator.h

1/*
2 * aml_generator.h
3 * Chameleon
4 *
5 * Created by Mozodojo on 20/07/10.
6 * Copyright 2010 mozo. All rights reserved.
7 *
8 */
9
10#ifndef __LIBSAIO_AML_GENERATOR_H
11#define __LIBSAIO_AML_GENERATOR_H
12
13//#include "libsaio.h"
14#include "libsa.h"
15#include "saio_internal.h"
16
17#defineAML_CHUNK_NONE0xff
18#defineAML_CHUNK_ZERO0x00
19#defineAML_CHUNK_ONE0x01
20#defineAML_CHUNK_ALIAS0x06
21#defineAML_CHUNK_NAME0x08
22#defineAML_CHUNK_BYTE0x0A
23#defineAML_CHUNK_WORD0x0B
24#defineAML_CHUNK_DWORD0x0C
25#defineAML_CHUNK_STRING0x0D
26#defineAML_CHUNK_QWORD0x0E
27#defineAML_CHUNK_SCOPE0x10
28#defineAML_CHUNK_PACKAGE0x12
29
30struct aml_chunk
31{
32unsigned charType;
33unsigned intLength;
34char*Buffer;
35
36unsigned intSize;
37
38struct aml_chunk*Next;
39struct aml_chunk*First;
40struct aml_chunk*Last;
41};
42
43static inline bool aml_isvalidchar(char c)
44{
45return isupper(c) || isdigit(c) || c == '_';
46};
47
48bool aml_add_to_parent(struct aml_chunk* parent, struct aml_chunk* node);
49struct aml_chunk* aml_create_node(struct aml_chunk* parent);
50void aml_destroy_node(struct aml_chunk* node);
51struct aml_chunk* aml_add_buffer(struct aml_chunk* parent, const char* buffer, unsigned int size);
52struct aml_chunk* aml_add_byte(struct aml_chunk* parent, unsigned char value);
53struct aml_chunk* aml_add_word(struct aml_chunk* parent, unsigned int value);
54struct aml_chunk* aml_add_dword(struct aml_chunk* parent, unsigned long value);
55struct aml_chunk* aml_add_qword(struct aml_chunk* parent, unsigned long long value);
56struct aml_chunk* aml_add_scope(struct aml_chunk* parent, const char* name);
57struct aml_chunk* aml_add_name(struct aml_chunk* parent, const char* name);
58struct aml_chunk* aml_add_package(struct aml_chunk* parent);
59struct aml_chunk* aml_add_alias(struct aml_chunk* parent, const char* name1, const char* name2);
60unsigned int aml_calculate_size(struct aml_chunk* node);
61unsigned int aml_write_node(struct aml_chunk* node, char* buffer, unsigned int offset);
62
63#endif /* !__LIBSAIO_AML_GENERATOR_H */

Archive Download this file

Revision: 840