Ejemplo n.º 1
0
term_t bif_embedded_module1(term_t Mod, process_t *ctx)
{
	xmod_bin_t *mp, *me;
	cstr_t *s;
	
	if (!is_atom(Mod))
		return A_BADARG;

	s = atoms_get(proc_atoms(ctx), index(Mod));
	
	mp = (xmod_bin_t *)module_bins->elts;
	me = mp + module_bins->nelts;
	while (mp < me)
	{
		if (scomp(mp->name, s))
		{
			term_t bin = make_binary(intnum(mp->size), mp->data, proc_gc_pool(ctx));
			result(make_tuple3(A_OK, bin, bool(mp->is_preloaded), proc_gc_pool(ctx)));
			return AI_OK;
		}
		mp++;
	}
	result(A_FALSE);
	return AI_OK;
}
Ejemplo n.º 2
0
int main(void) {
	char in = 0;
	int digit = 0;
	struct sint current;
	struct sint max;
	max.digits[0]=0;
	struct sint min;
	for (int i=0; i<51; i++){
		min.digits[i]='9';
	}
	struct sint acc;
	acc.digits[0]=0;
	
	while (scanf("%c", &in)!=EOF){
		if (in > '9' || in < '0'){
			current.digits[digit] = 0;
			acc = sadd(&current, &acc);
			if (scomp(&current, &max)==1) {
				max = current;
			}
			if (scomp(&min, &current)==1) {
				min = current;
			}
			digit = 0;
			for (int i=0; i<51; i++){
				current.digits[i]=0;
			}
		}
		else {
			current.digits[digit] = in;
			digit++;
		}
	}
	strim(&min);
	strim(&max);
	strim(&acc);
	printf("min:%s\n", min.digits);
	printf("max:%s\n", max.digits);
	printf("sum:%s\n", acc.digits);
}