Chameleon

Chameleon Svn Source Tree

Root/branches/Kabyl/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
15#defineAML_CHUNK_NONE0xff
16#defineAML_CHUNK_ZERO0x00
17#defineAML_CHUNK_ONE0x01
18#defineAML_CHUNK_ALIAS0x06
19#defineAML_CHUNK_NAME0x08
20#defineAML_CHUNK_BYTE0x0A
21#defineAML_CHUNK_WORD0x0B
22#defineAML_CHUNK_DWORD0x0C
23#defineAML_CHUNK_STRING0x0D
24#defineAML_CHUNK_QWORD0x0E
25#defineAML_CHUNK_SCOPE0x10
26#defineAML_CHUNK_PACKAGE0x12
27
28struct aml_chunk
29{
30unsigned charType;
31unsigned intLength;
32char*Buffer;
33
34unsigned intSize;
35
36struct aml_chunk*Next;
37struct aml_chunk*First;
38struct aml_chunk*Last;
39};
40
41static inline bool aml_isvalidchar(char c)
42{
43return isupper(c) || isdigit(c) || c == '_';
44};
45
46bool aml_add_to_parent(struct aml_chunk* parent, struct aml_chunk* node);
47struct aml_chunk* aml_create_node(struct aml_chunk* parent);
48void aml_destroy_node(struct aml_chunk* node);
49struct aml_chunk* aml_add_buffer(struct aml_chunk* parent, const char* buffer, unsigned int size);
50struct aml_chunk* aml_add_byte(struct aml_chunk* parent, unsigned char value);
51struct aml_chunk* aml_add_word(struct aml_chunk* parent, unsigned int value);
52struct aml_chunk* aml_add_dword(struct aml_chunk* parent, unsigned long value);
53struct aml_chunk* aml_add_qword(struct aml_chunk* parent, unsigned long long value);
54struct aml_chunk* aml_add_scope(struct aml_chunk* parent, const char* name);
55struct aml_chunk* aml_add_name(struct aml_chunk* parent, const char* name);
56struct aml_chunk* aml_add_package(struct aml_chunk* parent);
57struct aml_chunk* aml_add_alias(struct aml_chunk* parent, const char* name1, const char* name2);
58unsigned int aml_calculate_size(struct aml_chunk* node);
59unsigned int aml_write_node(struct aml_chunk* node, char* buffer, unsigned int offset);
60
61#endif /* !__LIBSAIO_AML_GENERATOR_H */

Archive Download this file

Revision: 673