X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fdatabase.h;h=2fde364fef996445d5bbea66ec0c7528ba93ea1d;hb=ef71335ceb286b3669919046ebccfbdf8cea9819;hp=cafa4d319518191a24d4e3c8d0d2afd607a83030;hpb=97a01cbf0aa568427a25792d00cfd16c62b0c397;p=m17n%2Fm17n-lib.git diff --git a/src/database.h b/src/database.h index cafa4d3..2fde364 100644 --- a/src/database.h +++ b/src/database.h @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the m17n library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 02111-1307, USA. */ #ifndef _M17N_DATABASE_H_ @@ -27,13 +27,59 @@ #define M17NDIR "/usr/local/share/m17n" #endif -extern MPlist *mdatabase__dir_list; +#ifndef PATH_MAX +#define PATH_MAX 1024 +#endif + +#ifndef PATH_SEPARATOR +#define PATH_SEPARATOR '/' +#endif -extern MSymbol M_database_hook; +enum MDatabaseStatus + { + /* The database was defined automatically (from mdb.dir file(s)).*/ + MDB_STATUS_AUTO, + /* The database was defined explicitely (by mdatabase_define ()). */ + MDB_STATUS_EXPLICIT, + /* The databse is currently disabled. (usually because it is + deleted from mdb.dir file(s)). */ + MDB_STATUS_DISABLED, + MDB_STATUS_UPDATED, + MDB_STATUS_OUTDATED + }; + +typedef struct +{ + /* Name of the file containing the database. */ + char *filename; + /* Length of FILENAME. */ + int len; + /* Absolute path of filename. */ + char *absolute_filename; + /* The current status of the database. */ + enum MDatabaseStatus status; + /* When the database was loaded last. 0 if it has never been + loaded. */ + time_t time; + char *lock_file, *uniq_file; +} MDatabaseInfo; + +extern MPlist *mdatabase__dir_list; -typedef void (*MDatabaseHookFunc) (MSymbol tag0, MSymbol tag1, - MSymbol tag2, MSymbol tag3); +extern void mdatabase__update (void); extern MPlist *mdatabase__load_for_keys (MDatabase *mdb, MPlist *keys); +extern int mdatabase__check (MDatabase *mdb); + +extern char *mdatabase__find_file (char *filename); + +extern char *mdatabase__file (MDatabase *mdb); + +extern int mdatabase__lock (MDatabase *mdb); + +extern int mdatabase__save (MDatabase *mdb, MPlist *data); + +extern int mdatabase__unlock (MDatabase *mdb); + #endif /* not _M17N_DATABASE_H_ */