Exemplo n.º 1
0
str_t utf_convert(heap_t h, str_t src, int src_enc, int dest_enc) {
	str_t res = str_create(h, utf_length(src, src_enc)*4);
	str_it_t src_i = str_begin(src),
		src_e = str_end(src),
		res_i = str_begin(res);
	while(src_i<src_e) {
		long c = CHAR_TO_LONG(src_i, src_enc);
		src_i += CHAR_LEN(src_i, src_enc);
		res_i = LONG_TO_UTF(c, res_i, dest_enc);
	}
	res->length = res_i - str_begin(res);
	*res_i = 0;
	return res;
}
Exemplo n.º 2
0
Arquivo: utf.c Projeto: monkin/xcss
void *utf_convert(heap_t h, void *src, int src_enc, int dest_enc) {
	void *res;
	void *i;
	int len;
	if(!src)
		return 0;
	err_reset();
	len = utf_length(src, src_enc) + 1;
	i = res = heap_alloc(h, len*4);
	if(err())
		return 0;
	while(!CHAR_IS_LAST(src, src_enc)) {
		long c = CHAR_TO_LONG(src, src_enc);
		src = C_OFFSET(src, CHAR_LEN(src, src_enc));
		i = LONG_TO_UTF(c, i, dest_enc);
	}
	i = UTF_WRITE4(i, 0, 0, 0, 0);
	return res;
}
Exemplo n.º 3
0
int main(int argc, char ** argv){
  (void) argc;
  (void) argv;

  
  
  unsigned int i = 11;
  long best = 0;
  while(string[++i]){
    int j;
    long current = 1;
    for(j = 0; j < 13; j ++){
      current *= CHAR_TO_LONG(i - j);
    }
    if(current > best) best = current;
  }
  printf("Solution : %lu\n", best);
  return 0;
}