summaryrefslogtreecommitdiffstats
path: root/atoms.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:12:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:12:14 +0000
commit4b8a0f3f3dcf60dac2ce308ea08d413a535af29f (patch)
tree0f09c0ad2a4d0f535d89040a63dc3a866a6606e6 /atoms.h
parentInitial commit. (diff)
downloadreprepro-4b8a0f3f3dcf60dac2ce308ea08d413a535af29f.tar.xz
reprepro-4b8a0f3f3dcf60dac2ce308ea08d413a535af29f.zip
Adding upstream version 5.4.4.upstream/5.4.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'atoms.h')
-rw-r--r--atoms.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/atoms.h b/atoms.h
new file mode 100644
index 0000000..660adb4
--- /dev/null
+++ b/atoms.h
@@ -0,0 +1,75 @@
+#ifndef REPREPRO_ATOMS_H
+#define REPREPRO_ATOMS_H
+
+typedef int atom_t;
+typedef atom_t architecture_t;
+typedef atom_t component_t;
+typedef atom_t packagetype_t;
+typedef atom_t command_t;
+
+enum atom_type { at_architecture, at_component, at_packagetype, at_command };
+
+#define atom_unknown ((atom_t)0)
+
+#define architecture_source ((architecture_t)1)
+#define architecture_all ((architecture_t)2)
+
+#define component_strange ((component_t)1)
+
+#define pt_dsc ((packagetype_t)1)
+#define pt_deb ((packagetype_t)2)
+#define pt_udeb ((packagetype_t)3)
+#define pt_ddeb ((packagetype_t)4)
+
+#define atom_defined(a) ((a) > (atom_t)0)
+
+extern const char **atomtypes, **atoms_architectures, **atoms_components, **atoms_packagetypes, **atoms_commands;
+
+retvalue atoms_init(int command_count);
+
+retvalue architecture_intern(const char *, /*@out@*/architecture_t *);
+architecture_t architecture_find(const char *);
+architecture_t architecture_find_l(const char *, size_t);
+retvalue component_intern(const char *, /*@out@*/component_t *);
+component_t component_find(const char *);
+component_t component_find_l(const char *, size_t);
+component_t components_count(void);
+packagetype_t packagetype_find(const char *);
+packagetype_t packagetype_find_l(const char *, size_t);
+
+atom_t atom_find(enum atom_type, const char *);
+retvalue atom_intern(enum atom_type, const char *, /*@out@*/atom_t *);
+
+#define limitation_missed(a, b) ((atom_defined(a) && (a) != (b)))
+#define limitations_missed(a, b) ((a) != NULL && !atomlist_in(a, b))
+
+
+struct atomlist {
+ atom_t *atoms;
+ int count, size;
+};
+
+void atomlist_init(/*@out@*/struct atomlist *);
+void atomlist_done(/*@special@*/struct atomlist *atomlist) /*@releases atomlist->values @*/;
+
+/* add a atom uniquely (not sorted, component guessing might not like it),
+ * RET_NOTHING when already there */
+retvalue atomlist_add_uniq(struct atomlist *, atom_t);
+/* always add to the end */
+retvalue atomlist_add(struct atomlist *, atom_t);
+
+/* replace the contents of dest with those from orig, which get emptied */
+void atomlist_move(/*@out@*/struct atomlist *, /*@special@*/struct atomlist *orig) /*@releases orig->values @*/;
+
+bool atomlist_hasexcept(const struct atomlist *, atom_t);
+bool atomlist_in(const struct atomlist *, atom_t);
+int atomlist_ofs(const struct atomlist *, atom_t);
+
+/* if missing != NULL And subset no subset of atomlist, set *missing to the first missing one */
+bool atomlist_subset(const struct atomlist *, const struct atomlist * /*subset*/, /*@null@*/atom_t * /*missing*/ );
+
+/* print a space separated list of elements */
+retvalue atomlist_fprint(FILE *, enum atom_type, const struct atomlist *);
+
+retvalue atomlist_filllist(enum atom_type, /*@out@*/struct atomlist *, char * /*string*/, /*@out@*/const char ** /*missing*/);
+#endif