]> git.wh0rd.org - fontconfig.git/blobdiff - src/fcint.h
When fc-cache is run without --force, use directory cache files to speed up
[fontconfig.git] / src / fcint.h
index 529548c20eb47e49e4a6065dc7881418872a00f1..1dec72a34897129cde48092d1364af0e921ee0ce 100644 (file)
 #include <config.h>
 #endif
 
-/* unused */
-typedef struct _FcSymbolic {
-    const char *name;
-    int                value;
-} FcSymbolic;
-
 #ifndef FC_CONFIG_PATH
 #define FC_CONFIG_PATH "fonts.conf"
 #endif
@@ -251,16 +245,16 @@ typedef struct _FcStrBuf {
 } FcStrBuf;
 
 typedef struct _FcCache {
-    int            magic;
-    int            count;
-    int     bank;
-    int     pattern_count;
-    int     patternelt_count;
-    int     valuelist_count;
-    int     str_count;
-    int            langset_count;
-    int     charset_count;
-    int     charset_numbers_count;
+    int            magic;              /* 0xFC02FC02 */
+    int            count;              /* number of bytes of data in block */
+    int     bank;               /* bank ID */
+    int     pattern_count;      /* number of FcPatterns */
+    int     patternelt_count;   /* number of FcPatternElts */
+    int     valuelist_count;    /* number of FcValueLists */
+    int     str_count;          /* size of strings appearing as FcValues */
+    int            langset_count;      /* number of FcLangSets */
+    int     charset_count;      /* number of FcCharSets */
+    int     charset_numbers_count; 
     int     charset_leaf_count;
     int     charset_leaf_idx_count;
 } FcCache;
@@ -323,45 +317,22 @@ typedef struct _FcCaseFold {
  * cache which is then rewritten to the users home directory
  */
 
-#define FC_CACHE_MAGIC 0x12345678
-#define FC_GLOBAL_CACHE_DIR_HASH_SIZE      37
-#define FC_GLOBAL_CACHE_FILE_HASH_SIZE     67
-
-typedef struct _FcGlobalCacheInfo {
-    unsigned int               hash;
-    FcChar8                    *file;
-    time_t                     time;
-    FcBool                     referenced;
-} FcGlobalCacheInfo;
-
-typedef struct _FcGlobalCacheFile {
-    struct _FcGlobalCacheFile  *next;
-    FcGlobalCacheInfo          info;
-    int                                id;
-    FcChar8                    *name;
-} FcGlobalCacheFile;
+#define FC_CACHE_MAGIC 0xFC02FC02
 
 typedef struct _FcGlobalCacheDir FcGlobalCacheDir;
 
-typedef struct _FcGlobalCacheSubdir {
-    struct _FcGlobalCacheSubdir        *next;
-    FcGlobalCacheDir           *ent;
-} FcGlobalCacheSubdir;
-
 struct _FcGlobalCacheDir {
     struct _FcGlobalCacheDir   *next;
-    FcGlobalCacheInfo          info;
-    int                                len;
-    FcGlobalCacheFile          *ents[FC_GLOBAL_CACHE_FILE_HASH_SIZE];
-    FcGlobalCacheSubdir                *subdirs;
+    char                       *name;
+    FcCache                    metadata;
+    off_t                      offset;
+    void                       *ent;
 };
 
 typedef struct _FcGlobalCache {
-    FcGlobalCacheDir           *ents[FC_GLOBAL_CACHE_DIR_HASH_SIZE];
+    FcGlobalCacheDir           *dirs;
     FcBool                     updated;
-    FcBool                     broken;
-    int                                entries;
-    int                                referenced;
+    int                                fd;
 } FcGlobalCache;
 
 struct _FcAtomic {
@@ -441,26 +412,41 @@ typedef struct _FcCharMap FcCharMap;
 
 /* fccache.c */
 
+FcGlobalCache *
+FcGlobalCacheCreate (void);
+
 void
-FcCacheForce(FcBool force);
+FcGlobalCacheDestroy (FcGlobalCache *cache);
 
 FcBool
-FcCacheSerialize (int bank, FcConfig * config);
+FcGlobalCacheReadDir (FcFontSet     *set, 
+                     FcStrSet      *dirs, 
+                     FcGlobalCache *cache, 
+                     const char    *dir, 
+                     FcConfig      *config);
 
-FcFontSet *
-FcCacheRead (FcConfig *config);
+void
+FcGlobalCacheLoad (FcGlobalCache    *cache,
+                   FcStrSet        *staleDirs,
+                  const FcChar8    *cache_file);
 
 FcBool
-FcDirCacheRead (FcFontSet * set, const FcChar8 *dir);
+FcGlobalCacheUpdate (FcGlobalCache  *cache,
+                    const char     *file,
+                    FcFontSet      *set);
 
 FcBool
-FcDirCacheWrite (int bank, FcFontSet *set, const FcChar8 *dir);
+FcGlobalCacheSave (FcGlobalCache    *cache,
+                  const FcChar8    *cache_file);
 
-int
-FcCacheBankCount (void);
+FcFontSet *
+FcCacheRead (FcConfig *config, FcGlobalCache * cache);
 
 FcBool
-FcCacheHaveBank (int bank);
+FcDirCacheWrite (FcFontSet *set, FcStrSet * dirs, const FcChar8 *dir);
+
+FcBool
+FcDirCacheRead (FcFontSet * set, FcStrSet * dirs, const FcChar8 *dir);
 
 int
 FcCacheBankToIndex (int bank);
@@ -757,9 +743,6 @@ FcListPatternMatchAny (const FcPattern *p,
 FcBool
 FcNameBool (const FcChar8 *v, FcBool *result);
 
-void
-FcObjectNewBank(void);
-
 void *
 FcObjectDistributeBytes (FcCache * metadata,
                         void * block_ptr);
@@ -768,13 +751,22 @@ FcObjectPtr
 FcObjectToPtr (const char * si);
 
 int
-FcObjectNeededBytes (FcObjectPtr p);
+FcObjectNeededBytes (void);
+
+void *
+FcObjectUnserialize (FcCache metadata, void *block_ptr);
 
 void
-FcObjectUnserialize (FcCache metadata, FcConfig * config, void *block_ptr);
+FcObjectSerialize (void);
 
-FcObjectPtr
-FcObjectSerialize (FcObjectPtr s);
+const char *
+FcObjectPtrU (FcObjectPtr p);
+
+int
+FcObjectPtrCompare (FcObjectPtr a, FcObjectPtr b);
+
+void
+FcObjectStaticNameFini (void);
 
 /* fcpat.c */
 
@@ -806,14 +798,11 @@ FcPatternFini (void);
 FcBool
 FcPatternAppend (FcPattern *p, FcPattern *s);
 
-const char *
-FcObjectStaticName (const char *name);
-
-const char *
-FcObjectPtrU (FcObjectPtr p);
+const FcChar8 *
+FcStrStaticName (const FcChar8 *name);
 
-int
-FcObjectPtrCompare (FcObjectPtr a, FcObjectPtr b);
+FcChar32
+FcStringHash (const FcChar8 *s);
 
 void
 FcPatternNewBank (void);
@@ -836,7 +825,7 @@ FcValueListPtrCreateDynamic(FcValueList * p);
 FcPattern *
 FcPatternSerialize (int bank, FcPattern * p);
 
-FcPattern *
+void *
 FcPatternUnserialize (FcCache metadata, void *block_ptr);
 
 /* fcrender.c */