Пример #1
0
SQString *SQVM::PrintObjVal(const SQObject &o)
{
	switch(type(o)) {
	case OT_STRING: return _string(o);
	case OT_INTEGER:
		scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)), _SC("%d"), _integer(o));
		return SQString::Create(_ss(this), _spval);
		break;
	case OT_FLOAT:
		scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)), _SC("%.14g"), _float(o));
		return SQString::Create(_ss(this), _spval);
		break;
	default:
		return SQString::Create(_ss(this), GetTypeName(o));
	}
}
Пример #2
0
void SQVM::Raise_Error(const SQChar *s, ...)
{
	va_list vl;
	va_start(vl, s);
	scvsprintf(_sp(rsl((SQInteger)scstrlen(s)+(NUMBER_MAX_CHAR*2))), s, vl);
	va_end(vl);
	_lasterror = SQString::Create(_ss(this),_spval,-1);
}
Пример #3
0
void armv7a::arm_add_sp_plus_reg(armv7a_ir& inst)
{
    inst.print_inst("arm_add_sp_plus_reg");
    inst.check(27, 21, B(100));
    inst.check(19, 16, B(1101));
    inst.check(4, 0);

    if(rf.condition_passed(inst.cond()))
    {
        uint32_t s = inst(20);
        uint32_t rd = inst(15, 12);
        uint32_t imm5 = inst(11, 7);
        uint32_t type = inst(6, 5);
        uint32_t rm = inst(3, 0);

        if((rd == B(1111) && (s == 1)))
        {
            printb(d_inst, "arm_add_sp_plus_reg SUBS PC, LR");
        }

        uint32_t d = rd;
        uint32_t m = rm;
        bool setflags = s == 1;
        sr_type shift_t;
        uint32_t shift_n;
        decode_imm_shift(&shift_t, &shift_n, type, imm5);
        //ESO
        bits shifted;
        bits _rm(rf.r_read(m), 32);
        shift(&shifted, _rm, shift_t, shift_n, rf.cpsr_C());
        bits result;
        uint32_t carry;
        uint32_t overflow;
        bits _sp(rf.r_read(SP), 32);
        add_with_carry(&result, &carry, &overflow, _sp, shifted, 0);

        if(d == 15)
        {
            rf.alu_write_pc(result.val);
        }

        else
        {
            rf.r_write(d, result.val);
            uint32_t tmp = rf.r_read(d);
            printd(d_inst, "shifted:%X result:%X R%d:%X", shifted.val, result.val, d, tmp);

            if(setflags)
            {
                rf.cpsr_N(result(31));
                rf.cpsr_Z(is_zero_bit(result));
                rf.cpsr_C(carry);
                rf.cpsr_V(overflow);
            }
        }
    }
}
Пример #4
0
SQString *SQVM::PrintObjVal(const SQObject &o)
{
	switch(type(o)) {
	case OT_STRING: return _string(o);
	case OT_INTEGER:
		// C::B patch: Support for Windows 64 bit
		#if defined(_WIN64)
		scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)), _SC("%I64d"), _integer(o));
		// C::B patch: Support for Linux 64 bit
		#elif defined(_SQ64)
		scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)), _SC("%ld"), _integer(o));
		#else
		scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)), _SC("%d"), _integer(o));
		#endif
		return SQString::Create(_ss(this), _spval);
		break;
	case OT_FLOAT:
		scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)), _SC("%.14g"), _float(o));
		return SQString::Create(_ss(this), _spval);
		break;
	default:
		return SQString::Create(_ss(this), GetTypeName(o));
	}
}
Пример #5
0
void armv7a::arm_sub_sp_minus_imm(armv7a_ir& inst)
{
    inst.print_inst("arm_sub_sp_minus_reg");
    inst.check(27, 21, B(001 0010));
    inst.check(19, 16, B(1101));

    if(rf.condition_passed(inst.cond()))
    {
        uint32_t s = inst(20);
        uint32_t rd = inst(15, 12);
        bits imm12(inst(11, 0), 12);

        if((rd == B(1111) & (s == 1)))
        {
            printb(d_inst, "arm_sub_sp_minus_reg SUBS PC LR");
        }

        uint32_t d = rd;
        bool setflags = s == 1;
        bits imm32;
        arm_expand_imm(&imm32, imm12);
        //ESO
        bits result;
        uint32_t carry;
        uint32_t overflow;
        bits _sp(rf.r_read(SP), 32);
        bits not_imm32(~imm32.val, 32);
        add_with_carry(&result, &carry, &overflow, _sp, not_imm32, 1);

        if(d == 15)
        {
            rf.alu_write_pc(result.val);
        }

        else
        {
            rf.r_write(d, result.val);

            if(setflags)
            {
                rf.cpsr_N(result(31));
                rf.cpsr_Z(is_zero_bit(result));
                rf.cpsr_C(carry);
                rf.cpsr_V(overflow);
            }
        }
    }
}
Пример #6
0
int main ( int argc, char * * argv ) {
	rdfstore * me;
	DBT key, data, data1;
	int i;
	int test;
		
	test = -1234568;

	memset(&key, 0, sizeof(key));
        memset(&data, 0, sizeof(data));
        memset(&data1, 0, sizeof(data1));

	rdfstore_connect( &me, "cooltest", 0, 0, 0, 0, NULL,0,NULL,NULL,NULL,NULL );

	/* store */
        key.data = "memyselfI";
        key.size = sizeof("memyselfI");
        data.data = "Albe";
        data.size = strlen("Albe")+1;

	if( (rdfstore_flat_store_store( me->model, key, data )) != 0 )
		printf("Cannot store %s = %d\n",_sp(key),_si(data));

	if(rdfstore_flat_store_exists( me->model, key ) == 0 ) {
		printf("Ok key %s does exist\n",_sp(key));
	} else {
		printf("Ok key %s does NOT exist\n",_sp(key));
	};

	/* fetch */
	if( (rdfstore_flat_store_fetch( me->model, key, &data1 )) != 0 ) {
		printf("Cannot fetch %s \n",_sp(key));
	} else {
		RDFSTORE_FREE( data1.data ) ;
		};

	printf("Fetched '%s'\n",_sp(data1));

        key.data = "you";
        key.size = sizeof("you");
        data.data = "Albe";
        data.size = strlen("Albe")+1;

	if( (rdfstore_flat_store_store( me->model, key, data )) != 0 )
		printf("Cannot store %s = %d\n",_sp(key),_si(data));

        key.data = "counter";
        key.size = sizeof("counter");
        data.data = "0";
        data.size = strlen("0")+1;

	if( (rdfstore_flat_store_store( me->model, key, data )) != 0 )
		printf("Cannot store %s = %d\n",_sp(key),_si(data));

	/* fetch */
	if( (rdfstore_flat_store_fetch( me->model, key, &data1 )) != 0 ) {
		printf("Cannot fetch %s \n",_sp(key));
	} else {
		RDFSTORE_FREE( data1.data ) ;
		};

	printf("Fetched '%s'\n",_sp(data1));

	for ( i = 0; i <10000 ; i++ ) {
		/* inc */
		if( (rdfstore_flat_store_inc( me->model, key, &data1 )) != 0 ) {
			printf("Cannot inc %s \n",_sp(key));
		} else {
			RDFSTORE_FREE( data1.data ) ;
			};
	};

	/* fetch */
	if( (rdfstore_flat_store_fetch( me->model, key, &data1 )) != 0 ) {
		printf("Cannot fetch %s \n",_sp(key));
	} else {
		RDFSTORE_FREE( data1.data ) ;
		};

	printf("Fetched '%s'\n",_sp(data1));

	for ( i = 0; i <9999 ; i++ ) {
		/* dec */
		if( (rdfstore_flat_store_dec( me->model, key, &data1 )) != 0 ) {
			printf("Cannot dec %s \n",_sp(key));
		} else {
			RDFSTORE_FREE( data1.data ) ;
			};
	};

	/* NOTE: garbage collection of first and next is not done here */
	/* first */
	if( (rdfstore_flat_store_first( me->model, &data1 )) != 0 ) {
		printf("Cannot first \n");
		};

	/* next */
	while (rdfstore_flat_store_next( me->model, data1, &data ) == 0 ) {
		printf("GOT %s\n",_sp(data));
	};

	if(rdfstore_flat_store_exists( me->model, key ) == 0 ) {
		printf("Ok key %s does exist\n",_sp(key));
	} else {
		printf("Ok key %s does NOT exist\n",_sp(key));
	};

	/* delete */
	if( rdfstore_flat_store_delete ( me->model, key ) != 0 )
		printf("Cannot delete %s \n",_sp(key));

	if( rdfstore_flat_store_clear ( me->model ) != 0 )
		printf("Cannot clear \n");

        key.data = "you";
        key.size = sizeof("you");
	if(rdfstore_flat_store_exists( me->model, key ) == 0 ) {
		printf("Ok key %s does exist\n",_sp(key));
	} else {
		printf("Ok key %s does NOT exist\n",_sp(key));
	};

	if( rdfstore_flat_store_sync ( me->model ) != 0 )
		printf("Cannot sync \n");

	rdfstore_disconnect( me );

	return 0;
};
Пример #7
0
void SQVM::Raise_ErrorV(const SQChar *s, va_list &vl)
{
	scvsprintf(_sp(rsl((SQInteger)scstrlen(s)+(NUMBER_MAX_CHAR*2))), s, vl);
	Raise_Error(_spval);
}
Пример #8
0
/* print some stats (nibbles/bytes) for each index table concerning the compression algorithm used */
int main ( int argc, char * argv[]) {
	rdfstore * me;
	FLATDB  * db;
	DBT key, data, key1, data1;
	static unsigned char bits[RDFSTORE_MAXRECORDS_BYTES_SIZE];
	unsigned int outsize1=0;
	int i, items, s1,s2;
	long global_bytes_stats[256];
	long bytes_stats[256];
	long global_nibbles_stats[16];
	long nibbles_stats[16];
	char * host=NULL;
	int port=0;
	char * name=NULL;
	rdfstore_iterator * results=NULL;
	RDF_Node * node;
	char * buff;

	for( i=1; i<argc; i++) {
                if ((!strcmp(argv[i],"-port")) && (i+1<argc)) {
			port=atoi(argv[++i]);
                        if (port<=1) {
                                fprintf(stderr,"Aborted: You really want a port number >1.\n");
                                exit(1);
                                };
                } else {
			if ((!strcmp(argv[i],"-host")) && (i+1<argc)) {
				host = argv[++i];
                	} else {
				if (!strcmp(argv[i],"-v")) {
					fprintf(stderr,"Not implemented yet :)\n");
					exit(1);
				} else {
					char * cc;
					if ( (!strcmp(argv[i],"-h")) || ( (cc=strchr(argv[i],'-')) && (cc!=NULL) && (cc==argv[i]) ) ) {
						fprintf(stderr,"Syntax: %s [-host <dbms server name>] [-port <port>] databasename \n",argv[0]);
						exit(1);
					} else {
						/* rest is DB name */
						name = argv[i];
						};
                			};
				};
			};
		};
	
	memset(&key, 0, sizeof(key));
	memset(&key1, 0, sizeof(key1));
        memset(&data, 0, sizeof(data));
        memset(&data1, 0, sizeof(data1));

	if ( rdfstore_connect( &me, name, 1, 0, 0, (port || (host!=NULL)) ? 1 : 0, host,port,NULL,NULL,NULL,NULL ) != 0 ) {
		printf("Cannot connect to %s\n",name);
		return -1;
		};

	results = (rdfstore_iterator *) RDFSTORE_MALLOC(sizeof(rdfstore_iterator));
        if (results == NULL)
		return -1;
        results->store = me;
        results->remove_holes = 0;
	results->st_counter = 0;
	results->pos = 0;
	results->ids_size = 0;
	results->size = 1; /* just want the first one each time i.e. key ;) */

	/* subjects */
	db = me->subjects;

	for ( i=0; i<256; i++ ) {
		global_bytes_stats[i]=0;
		};
	for ( i=0; i<16; i++ ) {
		global_nibbles_stats[i]=0;
		};
	/* NOTE: garbage collection of first, fetch and next is not done here */
	if ( rdfstore_flat_store_first( db, &key ) == 0 ) {
        	do {
                	if ( rdfstore_flat_store_fetch( db, key, &data )) {
                        	outsize1=0;
				printf("subjects: LENGTH ZERO\n");
				continue;
                        	};

			/* Decode bit array */
                       	me->func_decode( data.size, data.data, &outsize1, bits);

			/* hack ;) */
			memcpy(results->ids, bits, outsize1);
			results->ids_size = outsize1;

			if((node=rdfstore_iterator_first_subject(results))!=NULL) {
				buff=rdfstore_ntriples_node( node );
				printf("subjects: key=%s\n",buff);
				RDFSTORE_FREE( buff );
				RDFSTORE_FREE( node->value.resource.identifier );
				RDFSTORE_FREE( node );
			} else {
				if (key.size == 4) 
					printf("subjects: key=%x (hex, 4byte int)\n",*(unsigned int *)(key.data));
				else
					printf("subjects: key=\"%s\" (len %d)'\n",_sp(key),key.size);
				};

			items ++;
			s1 += data.size;
			s2 += outsize1;

			for ( i=0; i<256; i++ ) {
				bytes_stats[i]=0;
				};
			for ( i=0; i<16; i++ ) {
				nibbles_stats[i]=0;
				};
			for ( i=0; i<outsize1; i++ ) {
				global_bytes_stats[bits[i]]++;
				bytes_stats[bits[i]]++;
				};

			printf("subjects: val_len_comp   = %d\n",(int)data.size);
			printf("subjects: val_len_decomp = %d\n",outsize1);
			printf("subjects: ratio = %f\n",(double)data.size/(double)outsize1);
			printf("subjects: byte symbols:\n");
			for ( i=0; i<256; i++ ) {
				if(bytes_stats[i]>0) {
					printf("\tb %02X = %d\n",i,(int)bytes_stats[i]);
					};
				};
			for ( i=0; i<outsize1; i++ ) {
				global_nibbles_stats[bits[i] & 0x0f]++;
				global_nibbles_stats[bits[i] >> 4]++;
				nibbles_stats[bits[i] & 0x0f]++;
				nibbles_stats[bits[i] >> 4]++;
				};
			printf("subjects: nibble symbols:\n");
			for ( i=0; i<16; i++ ) {
				if(nibbles_stats[i]>0) {
					printf("\tn %0X = %d\n",i,(int)nibbles_stats[i]);
					};
				};
			printf("-----------------------------\n");
        	} while ( rdfstore_flat_store_next( db, key, &key ) == 0 );
		printf("subjects: Global byte symbols:\n");
		for ( i=0; i<256; i++ ) {
			if(global_bytes_stats[i]>0) {
				printf("\tgb %02X = %d\n",i,(int)global_bytes_stats[i]);
				};
			};
		printf("subjects: Global nibble symbols:\n");
		for ( i=0; i<16; i++ ) {
			if(global_nibbles_stats[i]>0) {
				printf("\tgn %0X = %d\n",i,(int)global_nibbles_stats[i]);
				};
			};

		printf("Items in subjects: %d\n",items);
 		printf("Total size of subjects: %d (uncompressed %d)\n",s1,s2);

        	};

	/* predicates */
	db = me->predicates;

	for ( i=0; i<256; i++ ) {
		global_bytes_stats[i]=0;
		};
	for ( i=0; i<16; i++ ) {
		global_nibbles_stats[i]=0;
		};
	/* NOTE: garbage collection of first, fetch and next is not done here */
	if ( rdfstore_flat_store_first( db, &key ) == 0 ) {
        	do {
                	if ( rdfstore_flat_store_fetch( db, key, &data )) {
                        	outsize1=0;
				printf("predicates: LENGTH ZERO\n");
				continue;
                        	};

			/* Decode bit array */
                       	me->func_decode( data.size, data.data, &outsize1, bits);

			/* hack ;) */
                        memcpy(results->ids, bits, outsize1);
                        results->ids_size = outsize1;

                        if((node=rdfstore_iterator_first_predicate(results))!=NULL) {
				buff=rdfstore_ntriples_node( node );               
                                printf("predicates: key=%s\n",buff);                               
                                RDFSTORE_FREE( buff );
				RDFSTORE_FREE( node->value.resource.identifier );
                                RDFSTORE_FREE( node );
                        } else {
                                if (key.size == 4)
                                        printf("predicates: key=%x (hex, 4byte int)\n",*(unsigned int *)(key.data));
                                else
                                        printf("predicates: key=\"%s\" (len %d)'\n",_sp(key),key.size);
                                };

			items ++;
			s1 += data.size;
			s2 += outsize1;

			for ( i=0; i<256; i++ ) {
				bytes_stats[i]=0;
				};
			for ( i=0; i<16; i++ ) {
				nibbles_stats[i]=0;
				};
			for ( i=0; i<outsize1; i++ ) {
				global_bytes_stats[bits[i]]++;
				bytes_stats[bits[i]]++;
				};

			printf("predicates: val_len_comp   = %d\n",(int)data.size);
			printf("predicates: val_len_decomp = %d\n",outsize1);
			printf("predicates: ratio = %f\n",(double)data.size/(double)outsize1);
			printf("predicates: byte symbols:\n");
			for ( i=0; i<256; i++ ) {
				if(bytes_stats[i]>0) {
					printf("\tb %02X = %d\n",i,(int)bytes_stats[i]);
					};
				};
			for ( i=0; i<outsize1; i++ ) {
				global_nibbles_stats[bits[i] & 0x0f]++;
				global_nibbles_stats[bits[i] >> 4]++;
				nibbles_stats[bits[i] & 0x0f]++;
				nibbles_stats[bits[i] >> 4]++;
				};
			printf("predicates: nibble symbols:\n");
			for ( i=0; i<16; i++ ) {
				if(nibbles_stats[i]>0) {
					printf("\tn %0X = %d\n",i,(int)nibbles_stats[i]);
					};
				};
			printf("-----------------------------\n");
        	} while ( rdfstore_flat_store_next( db, key, &key ) == 0 );
		printf("predicates: Global byte symbols:\n");
		for ( i=0; i<256; i++ ) {
			if(global_bytes_stats[i]>0) {
				printf("\tgb %02X = %d\n",i,(int)global_bytes_stats[i]);
				};
			};
		printf("predicates: Global nibble symbols:\n");
		for ( i=0; i<16; i++ ) {
			if(global_nibbles_stats[i]>0) {
				printf("\tgn %0X = %d\n",i,(int)global_nibbles_stats[i]);
				};
			};

		printf("Items in predicates: %d\n",items);
 		printf("Total size of predicates: %d (uncompressed %d)\n",s1,s2);

        	};

	/* objects */
	db = me->objects;

	for ( i=0; i<256; i++ ) {
		global_bytes_stats[i]=0;
		};
	for ( i=0; i<16; i++ ) {
		global_nibbles_stats[i]=0;
		};
	/* NOTE: garbage collection of first, fetch and next is not done here */
	if ( rdfstore_flat_store_first( db, &key ) == 0 ) {
        	do {
                	if ( rdfstore_flat_store_fetch( db, key, &data )) {
                        	outsize1=0;
				printf("objects: LENGTH ZERO\n");
				continue;
                        	};

			/* Decode bit array */
                       	me->func_decode( data.size, data.data, &outsize1, bits);

			/* hack ;) */
                        memcpy(results->ids, bits, outsize1);
                        results->ids_size = outsize1;

                        if((node=rdfstore_iterator_first_object(results))!=NULL) {
				buff=rdfstore_ntriples_node( node );
				printf("objects: key=%s\n",buff);
				RDFSTORE_FREE( buff );
				if ( node->type == 1 ) {
					if ( node->value.literal.dataType != NULL )
						RDFSTORE_FREE( node->value.literal.dataType );
                        		RDFSTORE_FREE( node->value.literal.string );
                		} else {
					RDFSTORE_FREE( node->value.resource.identifier );
                        		};	
                                RDFSTORE_FREE( node );
                        } else {
                                if (key.size == 4)
                                        printf("objects: key=%x (hex, 4byte int)\n",*(unsigned int *)(key.data));
                                else
                                        printf("objects: key=\"%s\" (len %d)'\n",_sp(key),key.size);
                                };

			items ++;
			s1 += data.size;
			s2 += outsize1;

			for ( i=0; i<256; i++ ) {
				bytes_stats[i]=0;
				};
			for ( i=0; i<16; i++ ) {
				nibbles_stats[i]=0;
				};
			for ( i=0; i<outsize1; i++ ) {
				global_bytes_stats[bits[i]]++;
				bytes_stats[bits[i]]++;
				};

			printf("objects: val_len_comp   = %d\n",(int)data.size);
			printf("objects: val_len_decomp = %d\n",outsize1);
			printf("objects: ratio = %f\n",(double)data.size/(double)outsize1);
			printf("objects: byte symbols:\n");
			for ( i=0; i<256; i++ ) {
				if(bytes_stats[i]>0) {
					printf("\tb %02X = %d\n",i,(int)bytes_stats[i]);
					};
				};
			for ( i=0; i<outsize1; i++ ) {
				global_nibbles_stats[bits[i] & 0x0f]++;
				global_nibbles_stats[bits[i] >> 4]++;
				nibbles_stats[bits[i] & 0x0f]++;
				nibbles_stats[bits[i] >> 4]++;
				};
			printf("objects: nibble symbols:\n");
			for ( i=0; i<16; i++ ) {
				if(nibbles_stats[i]>0) {
					printf("\tn %0X = %d\n",i,(int)nibbles_stats[i]);
					};
				};
			printf("-----------------------------\n");
        	} while ( rdfstore_flat_store_next( db, key, &key ) == 0 );
		printf("objects: Global byte symbols:\n");
		for ( i=0; i<256; i++ ) {
			if(global_bytes_stats[i]>0) {
				printf("\tgb %02X = %d\n",i,(int)global_bytes_stats[i]);
				};
			};
		printf("objects: Global nibble symbols:\n");
		for ( i=0; i<16; i++ ) {
			if(global_nibbles_stats[i]>0) {
				printf("\tgn %0X = %d\n",i,(int)global_nibbles_stats[i]);
				};
			};

		printf("Items in objects: %d\n",items);
 		printf("Total size of objects: %d (uncompressed %d)\n",s1,s2);

        	};

	/* contexts */
	items=s1=s2=0;
	db = me->contexts;

	for ( i=0; i<256; i++ ) {
		global_bytes_stats[i]=0;
		};
	for ( i=0; i<16; i++ ) {
		global_nibbles_stats[i]=0;
		};

	/* NOTE: garbage collection of first, fetch and next is not done here */
	if ( rdfstore_flat_store_first( db, &key ) == 0 ) {
        	do {
                	if ( rdfstore_flat_store_fetch( db, key, &data ) == 0 ) {
                        	me->func_decode( data.size, data.data, &outsize1, bits);
                	} else {
                        	outsize1=0;
				printf("contexts: LENGTH ZERO\n");
				continue;
                        	};

			/* hack ;) */
                        memcpy(results->ids, bits, outsize1);
                        results->ids_size = outsize1;

                        if((node=rdfstore_iterator_first_context(results))!=NULL) {
				buff=rdfstore_ntriples_node( node );               
                                printf("contexts: key=%s\n",buff);                               
                                RDFSTORE_FREE( buff );
                                RDFSTORE_FREE( node->value.resource.identifier );
                                RDFSTORE_FREE( node );
                        } else {
                                if (key.size == 4)
                                        printf("contexts: key=%x (hex, 4byte int)\n",*(unsigned int *)(key.data));
                                else
                                        printf("contexts: key=\"%s\" (len %d)'\n",_sp(key),key.size);
                                };

			items ++;
			s1 += data.size;
			s2 += outsize1;

			for ( i=0; i<256; i++ ) {
				bytes_stats[i]=0;
				};
			for ( i=0; i<16; i++ ) {
				nibbles_stats[i]=0;
				};
			for ( i=0; i<outsize1; i++ ) {
				global_bytes_stats[bits[i]]++;
				bytes_stats[bits[i]]++;
				};
			printf("contexts: val_len_comp   = %d\n",(int)data.size);
			printf("contexts: val_len_decomp = %d\n",outsize1);
			printf("contexts: ratio = %f\n",(double)data.size/(double)outsize1);
			printf("contexts: byte symbols:\n");
			for ( i=0; i<256; i++ ) {
				if(bytes_stats[i]>0) {
					printf("\tb %02X = %d\n",i,(int)bytes_stats[i]);
					};
				};
			for ( i=0; i<outsize1; i++ ) {
				global_nibbles_stats[bits[i] & 0x0f]++;
				global_nibbles_stats[bits[i] >> 4]++;
				nibbles_stats[bits[i] & 0x0f]++;
				nibbles_stats[bits[i] >> 4]++;
				};
			printf("contexts: nibble symbols:\n");
			for ( i=0; i<16; i++ ) {
				if(nibbles_stats[i]>0) {
					printf("\tn %0X = %d\n",i,(int)nibbles_stats[i]);
					};
				};
			printf("-----------------------------\n");
        	} while ( rdfstore_flat_store_next( db, key, &key ) == 0 );
		printf("contexts: Global byte symbols:\n");
		for ( i=0; i<256; i++ ) {
			if(global_bytes_stats[i]>0) {
				printf("\tgb %02X = %d\n",i,(int)global_bytes_stats[i]);
				};
			};
		printf("contexts: Global nibble symbols:\n");
		for ( i=0; i<16; i++ ) {
			if(global_nibbles_stats[i]>0) {
				printf("\tgn %0X = %d\n",i,(int)global_nibbles_stats[i]);
				};
			};

		printf("Items in contexts: %d\n",items);
        	printf("Total size of contexts: %d (uncompressed %d)\n",s1,s2);
        };

	if(me->windex != NULL) {

	/* windex */
	items=s1=s2=0;
	db = me->windex;

	for ( i=0; i<256; i++ ) {
		global_bytes_stats[i]=0;
		};
	for ( i=0; i<16; i++ ) {
		global_nibbles_stats[i]=0;
		};
	/* NOTE: garbage collection of first, fetch and next is not done here */
	if ( rdfstore_flat_store_first( db, &key ) == 0 ) {
        	do {
			if (key.size == 4)
                                printf("windex: key=%x (hex, 4byte int) ",*(unsigned int *)(key.data));
                        else
                                printf("windex: key=\"%s\" (len %d)'",_sp(key),key.size);

                	if ( rdfstore_flat_store_fetch( db, key, &data ) == 0 ) {
                        	me->func_decode( data.size, data.data, &outsize1, bits);
                	} else {
                        	outsize1=0;
				printf("windex: LENGTH ZERO\n");
				continue;
                        	};

			items ++;
			s1 += data.size;
			s2 += outsize1;

			for ( i=0; i<256; i++ ) {
				bytes_stats[i]=0;
				};
			for ( i=0; i<16; i++ ) {
				nibbles_stats[i]=0;
				};
			for ( i=0; i<outsize1; i++ ) {
				global_bytes_stats[bits[i]]++;
				bytes_stats[bits[i]]++;
				};
			printf("windex: val_len_comp   = %d\n",(int)data.size);
			printf("windex: val_len_decomp = %d\n",outsize1);
			printf("windex: ratio = %f\n",(double)data.size/(double)outsize1);
			printf("windex: byte symbols:\n");
			for ( i=0; i<256; i++ ) {
				if(bytes_stats[i]>0) {
					printf("\tb %02X = %d\n",i,(int)bytes_stats[i]);
					};
				};
			for ( i=0; i<outsize1; i++ ) {
				global_nibbles_stats[bits[i] & 0x0f]++;
				global_nibbles_stats[bits[i] >> 4]++;
				nibbles_stats[bits[i] & 0x0f]++;
				nibbles_stats[bits[i] >> 4]++;
				};
			printf("windex: nibble symbols:\n");
			for ( i=0; i<16; i++ ) {
				if(nibbles_stats[i]>0) {
					printf("\tn %0X = %d\n",i,(int)nibbles_stats[i]);
					};
				};
			printf("-----------------------------\n");
        	} while ( rdfstore_flat_store_next( db, key, &key ) == 0 );

		printf("windex: Global byte symbols:\n");
		for ( i=0; i<256; i++ ) {
			if(global_bytes_stats[i]>0) {
				printf("\tgb %02X = %d\n",i,(int)global_bytes_stats[i]);
				};
			};
		printf("windex: Global nibble symbols:\n");
		for ( i=0; i<16; i++ ) {
			if(global_nibbles_stats[i]>0) {
				printf("\tgn %0X = %d\n",i,(int)global_nibbles_stats[i]);
				};
			};

		printf("Items in windex: %d\n",items);
        	printf("Total size of windex: %d (uncompressed %d)\n",s1,s2);

        	};
	};