-/* Copyright (C) 2003,2004,2005,2006 MORIOKA Tomohiko
+/* Copyright (C) 2003, 2004, 2005, 2006, 2011, 2013 MORIOKA Tomohiko
This file is part of the CONCORD Library.
The CONCORD Library is free software; you can redistribute it and/or
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
#include "sysdep.h"
#include "concord.h"
+#include "cos-i.h"
#include "concord-name.h"
#include "concord-bdb.h"
CONCORD_Genre concord_ds_open_genre (CONCORD_DS ds, const char* name);
-int concord_close_genre (CONCORD_Genre genre);
-
CONCORD_Feature
concord_genre_open_feature (CONCORD_Genre genre, const char* name);
-int concord_close_feature (CONCORD_Feature feature);
-
CONCORD_INDEX
concord_genre_open_index (CONCORD_Genre genre, const char* index);
CONCORD_Feature
concord_genre_get_feature_0 (CONCORD_Genre genre, const char* name);
-int concord_close_index (CONCORD_INDEX table);
-
CONCORD_Object
concord_default_read_object (const unsigned char* string, size_t length);
-struct CONCORD_DS_Table
+struct COS_DS_ent
{
+ COS_Object_Header header;
CONCORD_Backend_Type type;
char *location;
CONCORD_NAME_TABLE* genre_names;
return NULL;
strncpy ((char*)buf, (char*)str, length);
buf[length] = '\0';
- return buf;
+ return (CONCORD_Object)buf;
}
CONCORD_DS
concord_open_ds (CONCORD_Backend_Type type, const char* location,
int subtype, int modemask)
{
- CONCORD_DS ds = (CONCORD_DS)malloc (sizeof (CONCORD_DS_Table));
+ CONCORD_DS ds = COS_ALLOCATE_OBJECT (DS);
size_t len = strlen (location);
if (ds == NULL)
}
-struct CONCORD_Genre_Table
+struct COS_Genre_ent
{
+ COS_Object_Header header;
CONCORD_DS ds;
char *name;
CONCORD_NAME_TABLE* feature_names;
if (ds == NULL)
return NULL;
- genre = (CONCORD_Genre)malloc (sizeof (CONCORD_Genre_Table));
+ genre = COS_ALLOCATE_OBJECT (Genre);
if (genre == NULL)
return NULL;
}
-struct CONCORD_Feature_Table
+struct COS_Feature_ent
{
+ COS_Object_Header header;
CONCORD_Genre genre;
char* name;
DB* db;
if (genre == NULL)
return NULL;
- table = (CONCORD_Feature)malloc (sizeof (CONCORD_Feature_Table));
+ table = COS_ALLOCATE_OBJECT (Feature);
if (table == NULL)
return NULL;
}
-struct CONCORD_INDEX_Table
+struct COS_Feature_INDEX_ent
{
+ COS_Object_Header header;
CONCORD_Genre genre;
char *name;
DB* db;
if (genre == NULL)
return NULL;
- table = (CONCORD_INDEX)malloc (sizeof (CONCORD_INDEX_Table));
+ table = COS_ALLOCATE_OBJECT (Feature_INDEX);
if (table == NULL)
return NULL;
return status;
}
+char*
+concord_index_get_name (CONCORD_INDEX index)
+{
+ return index->name;
+}
+
+CONCORD_Genre
+concord_index_get_genre (CONCORD_INDEX index)
+{
+ return index->genre;
+}
+
int
concord_index_setup_db (CONCORD_INDEX index, int writable)
{