+/*
+ * An argpar iterator.
+ *
+ * Such a structure contains the state of an iterator between calls to
+ * argpar_iter_next().
+ */
+struct argpar_iter {
+ /*
+ * Data provided by the user to argpar_iter_create(); immutable
+ * afterwards.
+ */
+ unsigned int argc;
+ const char * const *argv;
+ const struct argpar_opt_descr *descrs;
+
+ /*
+ * Index of the argument to process in the next
+ * argpar_iter_next() call.
+ */
+ unsigned int i;
+
+ /* Counter of non-option arguments */
+ int non_opt_index;
+
+ /*
+ * Current character of the current short option group: if it's
+ * not `NULL`, the parser is in within a short option group,
+ * therefore it must resume there in the next
+ * argpar_iter_next() call.
+ */
+ const char *short_opt_ch;
+};
+
+/* Base parsing item */
+struct argpar_item {
+ enum argpar_item_type type;
+};
+
+/* Option parsing item */
+struct argpar_item_opt {
+ struct argpar_item base;
+
+ /* Corresponding descriptor */
+ const struct argpar_opt_descr *descr;
+
+ /* Argument, or `NULL` if none; owned by this */
+ char *arg;
+};
+
+/* Non-option parsing item */
+struct argpar_item_non_opt {
+ struct argpar_item base;
+
+ /*
+ * Complete argument, pointing to one of the entries of the
+ * original arguments (`argv`).
+ */
+ const char *arg;
+
+ /*
+ * Index of this argument amongst all original arguments
+ * (`argv`).
+ */
+ unsigned int orig_index;
+
+ /* Index of this argument amongst other non-option arguments */
+ unsigned int non_opt_index;
+};
+