예제 #1
0
void construct_refined_hash_tab()
{
	int i;
	for(i=2;i<30;i++)
	{
		int* temp_array  = (int *) malloc(sizeof(int)*10000);
		int temp_used = 0;		
		struct object* obj = hash_tab[i];
		while(obj!=NULL)
		{
			int k=0,f = -1;
			while(k<temp_used && f!=1)
			{
				if(temp_array[k]==obj->ascii_sum)
					f=1;
				k++;
			}
			if(f!=1)
			{
				temp_array[temp_used] = obj->ascii_sum;
				append_object(refined_hash_tab,str_len(obj->str),obj->str,obj->pos,obj->ascii_sum,f);
				temp_used++;
			}
			else
				if(!isadded_str(refined_hash_tab[str_len(obj->str)],obj->str,obj->ascii_sum))
					append_object(refined_hash_tab,str_len(obj->str),obj->str,obj->pos,obj->ascii_sum,f);
			obj=obj->next;
		}
		refined_hash_tab[i] = rip_sword_hash_tab(refined_hash_tab[i]);
	}
}
예제 #2
0
 std::pair<size_t, bool> StreamWriter<StreamType>::append_value(const Value& v)
 {
     std::pair<size_t, bool> k(0, false);
     if(v.isNull())
         k = append_null();
     else if(v.isBool())
         k = append_bool(v);
     else if(v.isChar())
         k = append_char(v);
     else if(v.isSignedInteger())
         k = append_signedInt(v);
     else if(v.isUnsignedInteger())
         k = append_unsignedInt(v);
     else if(v.isFloat())
         k = append_float(v);
     else if(v.isString())
         k = append_string(v);
     //else if(v.isBinary())
     //    k = append_binary(v); //currently not supported
     else if(v.isArray())
         k = append_array(v);
     else if(v.isObject())
         k = append_object(v);
     return k;
 }
예제 #3
0
void construct_hash_tab()
{
	int i = 0;
	while(text[i]!='\0')
	{		
		if(text[i]!='$')
		{			
			char *temp_string;
			temp_string = (char *)malloc(30*sizeof(char));
			int ascii_sum = 0,ascii_prod = 1,pos = i;			
			while(text[i]!='$')
			{				
				temp_string[i-pos] = text[i];
				ascii_sum+=(int)text[i];
				i++;
			}
			temp_string[i-pos] = '\0';
			append_object(hash_tab,i-pos,temp_string,pos,ascii_sum,0);
		}
		else 
			i++;
	}
}