+/* Types used by pack/unpack */
+typedef enum {
+ e_no_len, /* no length */
+ e_number, /* number, [] */
+ e_star /* asterisk */
+} howlen_t;
+
+typedef struct tempsym {
+ const char* patptr; /* current template char */
+ const char* patend; /* one after last char */
+ const char* grpbeg; /* 1st char of ()-group */
+ const char* grpend; /* end of ()-group */
+ I32 code; /* template code (!<>) */
+ I32 length; /* length/repeat count */
+ howlen_t howlen; /* how length is given */
+ int level; /* () nesting level */
+ U32 flags; /* /=4, comma=2, pack=1 */
+ /* and group modifiers */
+ STRLEN strbeg; /* offset of group start */
+ struct tempsym *previous; /* previous group */
+} tempsym_t;
+
+#define TEMPSYM_INIT(symptr, p, e, f) \
+ STMT_START { \
+ (symptr)->patptr = (p); \
+ (symptr)->patend = (e); \
+ (symptr)->grpbeg = NULL; \
+ (symptr)->grpend = NULL; \
+ (symptr)->grpend = NULL; \
+ (symptr)->code = 0; \
+ (symptr)->length = 0; \
+ (symptr)->howlen = 0; \
+ (symptr)->level = 0; \
+ (symptr)->flags = (f); \
+ (symptr)->strbeg = 0; \
+ (symptr)->previous = NULL; \
+ } STMT_END
+