]> git.wh0rd.org - fontconfig.git/blobdiff - src/fcint.h
Forward port cworth's patch to branch.
[fontconfig.git] / src / fcint.h
index e077f408f1e656f1bce55b137244d4aa55840602..f29b459703ddc0a8dd4f40da0ebc714ce0765cdf 100644 (file)
@@ -41,6 +41,7 @@
 #include <config.h>
 #endif
 
+/* unused */
 typedef struct _FcSymbolic {
     const char *name;
     int                value;
@@ -100,29 +101,54 @@ typedef struct _FcSymbolic {
 #define FC_MEM_VSTACK      26
 #define FC_MEM_ATTR        27
 #define FC_MEM_PSTACK      28
+#define FC_MEM_STATICSTR    29
 
-#define FC_MEM_NUM         29
+#define FC_MEM_NUM         30
 
 typedef enum _FcValueBinding {
     FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame
 } FcValueBinding;
 
+typedef struct _FcStrSetPtr {
+    FcStorage               storage;
+    union {
+        int                stat;
+        struct _FcStrSet    *dyn;
+    } u;
+} FcStrSetPtr;
+
+typedef struct _FcValueListPtr {
+    FcStorage               storage;
+    union {
+        int                stat;
+        struct _FcValueList *dyn;
+    } u;
+} FcValueListPtr;
+
 typedef struct _FcValueList {
-    struct _FcValueList    *next;
+    FcValueListPtr         next;
+
     FcValue                value;
     FcValueBinding         binding;
 } FcValueList;
 
+typedef struct _FcPatternEltPtr {
+    FcStorage               storage;
+    union {
+        int                stat;
+        struct _FcPatternElt *dyn;
+    } u;
+} FcPatternEltPtr;
+
 typedef struct _FcPatternElt {
-    const char     *object;
-    FcValueList            *values;
+    FcObjectPtr             object;
+    FcValueListPtr          values;
 } FcPatternElt;
 
-
 struct _FcPattern {
     int                    num;
     int                    size;
-    FcPatternElt    *elts;
+    FcPatternEltPtr elts;
     int                    ref;
 };
 
@@ -196,15 +222,28 @@ typedef struct _FcCharLeaf {
 struct _FcCharSet {
     int                    ref;        /* reference count */
     int                    num;        /* size of leaves and numbers arrays */
-    FcCharLeaf     **leaves;
-    FcChar16       *numbers;
+    FcStorage      storage;
+    union {
+       struct {
+           FcCharLeaf  **leaves;
+           FcChar16    *numbers;
+       } dyn;
+       struct {
+           int         leafidx_offset;
+           int         numbers_offset;
+       } stat;
+    } u;
 };
 
 struct _FcStrSet {
     int                    ref;        /* reference count */
     int                    num;
     int                    size;
-    FcChar8        **strs;
+    FcStorage      storage;
+    union {
+       FcChar8     **strs;
+       int         stridx_offset;
+    } u;
 };
 
 struct _FcStrList {
@@ -230,6 +269,37 @@ typedef struct _FcGlyphName {
     FcChar8    name[1];        /* name extends beyond struct */
 } FcGlyphName;
 
+/*
+ * To perform case-insensitive string comparisons, a table
+ * is used which holds three different kinds of folding data.
+ * 
+ * The first is a range of upper case values mapping to a range
+ * of their lower case equivalents.  Within each range, the offset
+ * between upper and lower case is constant.
+ *
+ * The second is a range of upper case values which are interleaved
+ * with their lower case equivalents.
+ * 
+ * The third is a set of raw unicode values mapping to a list
+ * of unicode values for comparison purposes.  This allows conversion
+ * of ß to "ss" so that SS, ss and ß all match.  A separate array
+ * holds the list of unicode values for each entry.
+ *
+ * These are packed into a single table.  Using a binary search,
+ * the appropriate entry can be located.
+ */
+
+#define FC_CASE_FOLD_RANGE         0
+#define FC_CASE_FOLD_EVEN_ODD      1
+#define FC_CASE_FOLD_FULL          2
+
+typedef struct _FcCaseFold {
+    FcChar32   upper;
+    FcChar16   method : 2;
+    FcChar16   count : 14;
+    short      offset;     /* lower - upper for RANGE, table id for FULL */
+} FcCaseFold;
+
 #define FC_MAX_FILE_LEN            4096
 
 /*
@@ -495,9 +565,30 @@ FcNameParseCharSet (FcChar8 *string);
 FcCharLeaf *
 FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4);
 
+void
+FcCharSetPtrDestroy (FcCharSetPtr fcs);
+
+void
+FcCharSetClearStatic(void);
+
+FcBool
+FcCharSetPrepareSerialize(FcCharSet *c);
+
+FcCharSetPtr
+FcCharSetSerialize(FcCharSet *c);
+
+FcCharSetPtr
+FcCharSetPtrCreateDynamic(FcCharSet *c);
+
+FcCharLeaf *
+FcCharSetGetLeaf(const FcCharSet *c, int i);
+
+FcChar16 *
+FcCharSetGetNumbers(const FcCharSet *c);
+
 /* fcdbg.c */
 void
-FcValueListPrint (const FcValueList *l);
+FcValueListPrint (const FcValueListPtr l);
 
 void
 FcLangSetPrint (const FcLangSet *ls);
@@ -520,6 +611,9 @@ FcSubstPrint (const FcSubst *subst);
 int
 FcDebug (void);
 
+FcCharSet *
+FcCharSetPtrU (FcCharSetPtr mi);
+
 /* fcdir.c */
 
 FcBool
@@ -564,6 +658,16 @@ const FcCharMap *
 FcFreeTypeGetPrivateMap (FT_Encoding encoding);
     
 /* fcfs.c */
+
+void
+FcFontSetClearStatic (void);
+
+FcBool
+FcFontSetPrepareSerialize (FcFontSet * s);
+
+FcBool
+FcFontSetSerialize (FcFontSet * s);
+
 /* fcgram.y */
 int
 FcConfigparse (void);
@@ -577,13 +681,6 @@ FcConfigerror (char *fmt, ...);
 char *
 FcConfigSaveField (const char *field);
 
-FcTest *
-FcTestCreate (FcMatchKind   kind,
-             FcQual        qual,
-             const FcChar8 *field,
-             FcOp          compare,
-             FcExpr        *expr);
-
 void
 FcTestDestroy (FcTest *test);
 
@@ -617,9 +714,6 @@ FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right);
 void
 FcExprDestroy (FcExpr *e);
 
-FcEdit *
-FcEditCreate (const char *field, FcOp op, FcExpr *expr, FcValueBinding binding);
-
 void
 FcEditDestroy (FcEdit *e);
 
@@ -654,6 +748,24 @@ FcNameParseLangSet (const FcChar8 *string);
 FcBool
 FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls);
 
+void
+FcLangSetClearStatic (void);
+
+FcBool
+FcLangSetPrepareSerialize (FcLangSet *l);
+
+FcLangSetPtr
+FcLangSetSerialize (FcLangSet *l);
+
+FcLangSet *
+FcLangSetPtrU (FcLangSetPtr li);
+
+FcLangSetPtr
+FcLangSetPtrCreateDynamic (FcLangSet *l);
+
+void
+FcLangSetPtrDestroy (FcLangSetPtr li);
+
 /* fclist.c */
 
 FcBool
@@ -662,15 +774,27 @@ FcListPatternMatchAny (const FcPattern *p,
 
 /* fcmatch.c */
 
+/* fcmmap.c */
+
+void
+FcCacheClearStatic(void);
+
+FcBool
+FcCachePrepareSerialize(FcConfig * config);
+
+FcBool
+FcCacheSerialize (FcConfig * config);
+
+
 /* fcname.c */
 
 FcBool
-FcNameBool (FcChar8 *v, FcBool *result);
+FcNameBool (const FcChar8 *v, FcBool *result);
 
 /* fcpat.c */
 void
-FcValueListDestroy (FcValueList *l);
-    
+FcValueListDestroy (FcValueListPtr l);
+
 FcPatternElt *
 FcPatternFindElt (const FcPattern *p, const char *object);
 
@@ -688,24 +812,105 @@ FcPattern *
 FcPatternFreeze (FcPattern *p);
 
 void
-FcPatternThawAll (void);
+FcPatternFini (void);
 
 FcBool
 FcPatternAppend (FcPattern *p, FcPattern *s);
 
-const char *
+void
+FcObjectClearStatic(void);
+
+FcObjectPtr
 FcObjectStaticName (const char *name);
 
+FcBool
+FcObjectPrepareSerialize (FcObjectPtr si);
+
+const char *
+FcObjectPtrU (FcObjectPtr p);
+
+int
+FcObjectPtrCompare (FcObjectPtr a, FcObjectPtr b);
+
+FcObjectPtr
+FcObjectPtrCreateDynamic (const char * s);
+
+void
+FcObjectPtrDestroy (FcObjectPtr p);
+
+FcBool
+FcPatternPrepareSerialize (FcPattern *p);
+
+void
+FcValueListClearStatic (void);
+
+void
+FcPatternClearStatic (void);
+
+FcValueList * 
+FcValueListPtrU(FcValueListPtr p);
+
+FcPatternElt *
+FcPatternEltU (FcPatternEltPtr pei);
+
+FcValueListPtr
+FcValueListPtrCreateDynamic(FcValueList * p);
+
+FcBool
+FcValueListPrepareSerialize (FcValueList *p);
+
+FcValueListPtr
+FcValueListSerialize(FcValueList *pi);
+
+FcPattern *
+FcPatternSerialize (FcPattern * p);
+
 /* fcrender.c */
 
 /* fcmatrix.c */
 
-extern const FcMatrix    FcIdentityMatrix;
+extern const FcMatrixPtr    FcIdentityMatrix;
 
 void
 FcMatrixFree (FcMatrix *mat);
 
+void
+FcMatrixPtrDestroy (FcMatrixPtr mi);
+
+FcBool
+FcMatrixPrepareSerialize(FcMatrix *m);
+
+FcMatrixPtr
+FcMatrixSerialize(FcMatrix *m);
+
+FcMatrix *
+FcMatrixPtrU (FcMatrixPtr mi);
+
+FcMatrixPtr
+FcMatrixPtrCreateDynamic (FcMatrix *m);
+
+void 
+FcMatrixClearStatic (void);
+
 /* fcstr.c */
+FcStrSet *
+FcStrSetPtrU (const FcStrSetPtr set);
+
+FcStrSetPtr
+FcStrSetPtrCreateDynamic (const FcStrSet * set);
+
+void
+FcStrSetClearStatic (void);
+
+FcBool
+FcStrSetPrepareSerialize (const FcStrSet *set);
+
+void
+FcStrSetSort (FcStrSet * set);
+
+FcChar8 *
+FcStrSetGet (const FcStrSet *set, int i);
+
 FcChar8 *
 FcStrPlus (const FcChar8 *s1, const FcChar8 *s2);
     
@@ -730,6 +935,9 @@ FcStrBufString (FcStrBuf *buf, const FcChar8 *s);
 FcBool
 FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
 
+FcStrSetPtr
+FcStrSetSerialize (FcStrSet *set);
+
 int
 FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
 
@@ -745,4 +953,7 @@ FcStrUsesHome (const FcChar8 *s);
 FcChar8 *
 FcStrLastSlash (const FcChar8  *path);
 
+FcChar32
+FcStrHashIgnoreCase (const FcChar8 *s);
+
 #endif /* _FC_INT_H_ */