X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=chise.h;h=f6c55f5714d877e20b222538ad33088fd74e8a57;hb=af01d3b18af7248287f0cf59d33ec0d53873bf57;hp=fd1f77109e3608cee56e2b62bd8037f9df788343;hpb=46b45085c6c357fe33a22aa7f7f7b12d4e9437ea;p=chise%2Flibchise.git diff --git a/chise.h b/chise.h index fd1f771..f6c55f5 100644 --- a/chise.h +++ b/chise.h @@ -4,6 +4,8 @@ #include #include +extern const unsigned char chise_db_dir[]; + typedef enum CHISE_DS_Type { CHISE_DS_NONE, @@ -12,9 +14,16 @@ typedef enum CHISE_DS_Type typedef struct CHISE_DS CHISE_DS; -CHISE_DS* chise_open_data_source (CHISE_DS_Type type, char *location); +CHISE_DS* +CHISE_DS_open (CHISE_DS_Type type, const unsigned char *location, + int subtype, int modemask); + +int CHISE_DS_close (CHISE_DS *ds); -int chise_ds_close (CHISE_DS *ds); +int +chise_ds_foreach_char_feature_name (CHISE_DS *ds, + int (*func) (CHISE_DS *ds, + unsigned char *name)); typedef int CHISE_Char_ID; @@ -42,41 +51,85 @@ chise_value_to_c_string (const CHISE_Value *s) typedef struct CHISE_Feature_Table CHISE_Feature_Table; +typedef CHISE_Feature_Table* CHISE_Feature; + +CHISE_Feature +chise_ds_get_feature (CHISE_DS *ds, const unsigned char *name); + +static inline int +chise_ds_load_char_feature_value (CHISE_DS *ds, + CHISE_Char_ID cid, + const unsigned char *name, + CHISE_Value *valdatum); + +int chise_feature_setup_db (CHISE_Feature feature, int writable); + +int chise_feature_sync (CHISE_Feature feature); -CHISE_Feature_Table* -chise_ds_open_feature_table (CHISE_DS *ds, const char *feature, - DBTYPE real_subtype, - u_int32_t accessmask, int modemask); +int chise_char_set_feature_value (CHISE_Char_ID cid, + CHISE_Feature feature, + unsigned char *value); -int chise_ft_close (CHISE_Feature_Table *table); +int chise_char_load_feature_value (CHISE_Char_ID cid, + CHISE_Feature feature, + CHISE_Value *valdatum); -int chise_ft_get_value (CHISE_Feature_Table *table, - CHISE_Char_ID cid, CHISE_Value *valdatum); +static inline int +chise_ds_load_char_feature_value (CHISE_DS *ds, + CHISE_Char_ID cid, + const unsigned char *name, + CHISE_Value *valdatum) +{ + return + chise_char_load_feature_value (cid, chise_ds_get_feature (ds, name), + valdatum); +} + +unsigned char* +chise_char_gets_feature_value (CHISE_Char_ID cid, + CHISE_Feature feature, + unsigned char *dst, size_t size); -void -chise_ft_iterate (CHISE_Feature_Table *table, - int (*func) (CHISE_Feature_Table *table, - CHISE_Char_ID cid, CHISE_Value *valdatum)); +int +chise_feature_foreach_char_with_value (CHISE_Feature feature, + int (*func) (CHISE_Char_ID cid, + CHISE_Feature feature, + CHISE_Value *valdatum)); +#if 0 +int +chise_feature_foreach_char_with_str (CHISE_Feature feature, + int (*func) (CHISE_Char_ID cid, + CHISE_Feature feature, + unsigned char *str)); +#endif -typedef struct CHISE_Decoding_Table CHISE_Decoding_Table; -CHISE_Decoding_Table* -chise_ds_open_decoding_table (CHISE_DS *ds, const char *ccs, - DBTYPE real_subtype, - u_int32_t accessmask, int modemask); +typedef struct CHISE_CCS_Table CHISE_CCS_Table; +typedef CHISE_CCS_Table* CHISE_CCS; -int chise_dt_close (CHISE_Decoding_Table *table); +CHISE_CCS +chise_ds_get_ccs (CHISE_DS *ds, const unsigned char *name); -CHISE_Char_ID chise_dt_get_char (CHISE_Decoding_Table *table, int code_point); +static inline CHISE_Char_ID +chise_ds_decode_char (CHISE_DS *ds, + const unsigned char *ccs, int code_point); -int chise_dt_put_char (CHISE_Decoding_Table *table, - int code_point, CHISE_Char_ID cid); +int chise_ccs_setup_db (CHISE_CCS ccs, int writable); +int chise_ccs_sync (CHISE_CCS ccs); -CHISE_Char_ID chise_decode_char (CHISE_DS *ds, char *ccs, int code_point); +int chise_ccs_set_decoded_char (CHISE_CCS ccs, + int code_point, CHISE_Char_ID cid); -int chise_get_feature (CHISE_DS *ds, CHISE_Char_ID cid, - char *key, CHISE_Value *valdatum); +CHISE_Char_ID chise_ccs_decode (CHISE_CCS ccs, int code_point); + +static inline CHISE_Char_ID +chise_ds_decode_char (CHISE_DS *ds, + const unsigned char *name, int code_point) +{ + return + chise_ccs_decode (chise_ds_get_ccs (ds, name), code_point); +} #endif /* !_CHISE_H */