Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/linux-sunxi/sunxi-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Mery <amery@geeks.cl>2012-05-04 12:06:14 +0400
committerAlejandro Mery <amery@geeks.cl>2012-05-04 12:06:14 +0400
commit0dd7e13abae9198bfd27c63922dfe91d8f924f33 (patch)
tree5c2b26f9594c433742331ee793e0ab11dda918f3 /script.h
parent5a970809f3af5e350badbe92c9c8eb32178f1ec3 (diff)
script: getting started with the script tree
Diffstat (limited to 'script.h')
-rw-r--r--script.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/script.h b/script.h
new file mode 100644
index 0000000..c43ab79
--- /dev/null
+++ b/script.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 Alejandro Mery <amery@geeks.cl>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _SUNXI_TOOLS_SCRIPT_H
+#define _SUNXI_TOOLS_SCRIPT_H
+
+/** head of the data tree */
+struct script {
+ struct list_entry sections;
+};
+
+/** head of each section */
+struct script_section {
+ char name[32];
+
+ struct list_entry sections;
+ struct list_entry entries;
+};
+
+/** types of values */
+enum script_value_type {
+ SCRIPT_VALUE_TYPE_SINGLE_WORD = 1,
+ SCRIPT_VALUE_TYPE_STRING,
+ SCRIPT_VALUE_TYPE_MULTI_WORD,
+ SCRIPT_VALUE_TYPE_GPIO,
+ SCRIPT_VALUE_TYPE_NULL,
+};
+
+/** generic entry */
+struct script_entry {
+ char name[32];
+ enum script_value_type type;
+
+ struct list_entry entries;
+};
+
+/** null entry */
+struct script_null_entry {
+ struct script_entry entry;
+};
+
+/** create a new script tree */
+struct script *script_new(void);
+
+/** create a new section appended to a given tree */
+struct script_section *script_section_append(struct script *script,
+ const char *name);
+
+/** create a new empty/null entry appended to the last section of a tree */
+struct script_null_entry *script_null_entry_append(struct script *script,
+ const char *name);
+
+#endif