1.1 --- a/bookloupe/counters.h Mon Sep 23 21:18:27 2013 +0100
1.2 +++ b/bookloupe/counters.h Sun Oct 20 21:31:51 2013 +0100
1.3 @@ -3,18 +3,42 @@
1.4
1.5 #include <glib.h>
1.6
1.7 +#define COUNTERS_ERROR counters_error_quark()
1.8 +
1.9 +typedef enum
1.10 +{
1.11 + COUNTERS_ERROR_FAILED, /* Generic failure */
1.12 +} CountersError;
1.13 +
1.14 /* Special counters live in the private use area */
1.15 enum {
1.16 COUNTER_ILLUSTRATION=0xE000,
1.17 NO_SPECIAL_COUNTERS
1.18 };
1.19
1.20 +typedef enum {
1.21 + OPENING_QUOTE,
1.22 + CLOSING_QUOTE,
1.23 + NEUTRAL_QUOTE,
1.24 + INVALID_QUOTE
1.25 +} QuoteClass;
1.26 +
1.27 +#define QUOTE_CLASS(c) \
1.28 + (((c)==CHAR_RD_QUOTE || (c)==CHAR_RS_QUOTE)?CLOSING_QUOTE: \
1.29 + ((c)==CHAR_LD_QUOTE || (c)==CHAR_LS_QUOTE || (c)==CHAR_OPEN_SQUOTE)?\
1.30 + OPENING_QUOTE:((c)==CHAR_DQUOTE || (c)==CHAR_SQUOTE)?NEUTRAL_QUOTE:\
1.31 + INVALID_QUOTE)
1.32 +
1.33 struct counters {
1.34 GTree *matching;
1.35 - long quot;
1.36 int c_unders;
1.37 + GSList *open_quotes;
1.38 };
1.39
1.40 +GQuark counters_error_quark(void);
1.41 +gboolean innermost_quote_matches(struct counters *counters,gunichar ch);
1.42 +gboolean count_quote(struct counters *counters,gunichar ch,QuoteClass klass,
1.43 + GError **err);
1.44 void increment_matching(struct counters *counters,gunichar ch,gboolean open);
1.45 int matching_count(const struct counters *counters,gunichar ch,gboolean open);
1.46 int matching_difference(const struct counters *counters,gunichar ch);