dtinfo subtree DtMmdb
This commit is contained in:
committed by
Jon Trulson
parent
b92cf08899
commit
8c8363f4a5
@@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb/<subdir>/Imakefile
|
||||
#define LargePICTable YES
|
||||
|
||||
#define CplusplusSource YES
|
||||
DEPEND_DEFINES = $(CXXDEPENDINCLUDES)
|
||||
DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES)
|
||||
|
||||
XCOMM In DtMmdb we compile as C_API sources.
|
||||
DEFINES = -DC_API -DPORTABLE_DB
|
||||
|
||||
@@ -140,7 +140,8 @@ h_convertor(pms.v_n, 128, rnd)
|
||||
{
|
||||
v_bucket_array = new bucketPtr[v_no_buckets];
|
||||
|
||||
for ( int i=0; i<v_no_buckets; v_bucket_array[i++] = 0);
|
||||
int i;
|
||||
for ( i=0; i<v_no_buckets; v_bucket_array[i++] = 0);
|
||||
|
||||
//debug(cerr, pms);
|
||||
|
||||
@@ -234,7 +235,8 @@ void buckets::sort_by_size()
|
||||
{
|
||||
//MESSAGE(cerr, "sort()");
|
||||
int* links = new int[v_no_buckets];
|
||||
for ( int i=0; i<v_no_buckets; links[i++]=-1 );
|
||||
int i;
|
||||
for ( i=0; i<v_no_buckets; links[i++]=-1 );
|
||||
|
||||
int* sizes = new int[v_max_bucket_sz+1];
|
||||
for ( i=0; i<v_max_bucket_sz+1; sizes[i++]=-1 );
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
//compute_a_mphf(char* key_file, params& pms, char* mphf_spec_file)
|
||||
|
||||
compute_a_mphf(char** keys, params& pms, buffer& mphf_buffer)
|
||||
int compute_a_mphf(char** keys, params& pms, buffer& mphf_buffer)
|
||||
{
|
||||
mphf_hash_table ht(pms);
|
||||
|
||||
@@ -98,7 +98,7 @@ compute_a_mphf(char** keys, params& pms, buffer& mphf_buffer)
|
||||
return 1;
|
||||
}
|
||||
|
||||
search(buckets& bs, mphf_hash_table& ht, params& pms)
|
||||
int search(buckets& bs, mphf_hash_table& ht, params& pms)
|
||||
{
|
||||
int i = 0,
|
||||
fails = 0,
|
||||
@@ -158,7 +158,7 @@ search(buckets& bs, mphf_hash_table& ht, params& pms)
|
||||
return ( patternFit >= 0 ) ? 0 : -1;
|
||||
}
|
||||
|
||||
verify(buckets& bs, mphf_hash_table& ht, params& pms)
|
||||
int verify(buckets& bs, mphf_hash_table& ht, params& pms)
|
||||
{
|
||||
int i;
|
||||
int_pattern new_pattern(bs.max_bucket_sz());
|
||||
@@ -246,7 +246,7 @@ int write_spec(buckets& bs, params& pms, buffer& mphf_buffer)
|
||||
mphf_buffer.put((char*)c_array, g_array_bytes); mphf_buffer.put('\n');
|
||||
*/
|
||||
|
||||
ostrstream fout(mphf_buffer.get_base(), mphf_buffer.buf_sz(), ios::out);
|
||||
ostringstream fout(mphf_buffer.get_base(), ios::out);
|
||||
|
||||
fout << pms.v_n << "\n";
|
||||
fout << pms.v_b << "\n";
|
||||
@@ -267,6 +267,7 @@ int write_spec(buckets& bs, params& pms, buffer& mphf_buffer)
|
||||
|
||||
|
||||
mphf_buffer.set_content_sz(spec_bytes);
|
||||
memcpy(mphf_buffer.get_base(), fout.str().c_str(), spec_bytes);
|
||||
|
||||
delete c_array;
|
||||
|
||||
|
||||
@@ -53,9 +53,9 @@
|
||||
#define _mphf_funcs_h 1
|
||||
|
||||
#ifdef C_API
|
||||
#include "utility/c_strstream.h"
|
||||
#include "utility/c_stringstream.h"
|
||||
#else
|
||||
#include <strstream.h>
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
#include "utility/funcs.h"
|
||||
|
||||
@@ -152,10 +152,10 @@ int mphf_hash_table::fit_hash_table(int_pattern& pat)
|
||||
{
|
||||
int i, j;
|
||||
for ( i=0; i<pat.no_elmts(); i++ ) {
|
||||
if ( v_rep[int(pat[i])] != (int) NULL ) {
|
||||
if ( v_rep[int(pat[i])] != (int) 0 ) {
|
||||
|
||||
for ( j=0; j<=i; j++ )
|
||||
v_rep[int(pat[j])] = (int) NULL;
|
||||
v_rep[int(pat[j])] = (int) 0;
|
||||
|
||||
v_num_filled_slots -= i+1;
|
||||
return -1;
|
||||
|
||||
@@ -62,7 +62,8 @@ struct partition_t {
|
||||
|
||||
void params::select_value(float bts)
|
||||
{
|
||||
for ( int i=0; ; i++ ) {
|
||||
int i;
|
||||
for ( i=0; ; i++ ) {
|
||||
if ( v_n <= partition_tbl[i].upper_bound )
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,12 @@
|
||||
#ifndef _params_h
|
||||
#define _params_h 1
|
||||
|
||||
#include <limits.h>
|
||||
#if defined(CSRG_BASED)
|
||||
#define MAXINT INT_MAX
|
||||
#else
|
||||
#include <values.h>
|
||||
#endif
|
||||
#include "utility/funcs.h"
|
||||
|
||||
class params
|
||||
|
||||
@@ -78,7 +78,8 @@ void sorter::_init(istream& in)
|
||||
{
|
||||
v_bucket_array = new bucketPtr[NUM_BUCKETS];
|
||||
|
||||
for ( int i=0; i<NUM_BUCKETS; v_bucket_array[i++] = 0);
|
||||
int i;
|
||||
for ( i=0; i<NUM_BUCKETS; v_bucket_array[i++] = 0);
|
||||
|
||||
char key_buf[LBUFSIZ];
|
||||
|
||||
@@ -105,7 +106,8 @@ void sorter::_init(istream& in)
|
||||
|
||||
sorter::~sorter()
|
||||
{
|
||||
for ( int i=0; i<NUM_BUCKETS; delete v_bucket_array[i++] );
|
||||
int i;
|
||||
for ( i=0; i<NUM_BUCKETS; delete v_bucket_array[i++] );
|
||||
delete v_bucket_array;
|
||||
|
||||
for ( i=0; i<v_no_unique_keys; delete v_unique_keys[i++] );
|
||||
@@ -117,7 +119,8 @@ void sorter::filter_by_hash()
|
||||
// a small hash table for keys to map to
|
||||
v_map_table = new charPtr[2*v_max_bucket_sz];
|
||||
|
||||
for ( int i=0; i<2*v_max_bucket_sz; v_map_table[i++] = 0 );
|
||||
int i;
|
||||
for ( i=0; i<2*v_max_bucket_sz; v_map_table[i++] = 0 );
|
||||
|
||||
// an int table remembering slots in the v_map_table
|
||||
// that have been mapped.
|
||||
@@ -283,7 +286,8 @@ void sorter::remove_keys(bucketPtr bkt, char* key, slist_void_ptr_cell* lp)
|
||||
|
||||
void sorter::assemble_unique_keys()
|
||||
{
|
||||
for ( int i=0; i<NUM_BUCKETS; i++ ) {
|
||||
int i;
|
||||
for ( i=0; i<NUM_BUCKETS; i++ ) {
|
||||
if ( v_bucket_array[i] ) {
|
||||
v_no_unique_keys += v_bucket_array[i] -> v_no_keys;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,12 @@
|
||||
#ifndef _sorter_h
|
||||
#define _sorter_h 1
|
||||
|
||||
#include <limits.h>
|
||||
#if defined(CSRG_BASED)
|
||||
#define MAXINT INT_MAX
|
||||
#else
|
||||
#include <values.h>
|
||||
#endif
|
||||
#include "utility/funcs.h"
|
||||
#include "utility/atoi_fast.h"
|
||||
#include "hmphf/buckets.h"
|
||||
|
||||
Reference in New Issue
Block a user