All pastes #839622 Raw Edit

Someone

public text v1 · immutable
#839622 ·published 2007-12-31 03:19 UTC
rendered paste body
	if (!(num_type = sdrl_find_binding(mach->type_env, "number"))
	|| !(str_type = sdrl_find_binding(mach->type_env, "string")))
		return(SDRL_ERROR(mach, SDRL_ES_HIGH, SDRL_ERR_NOT_FOUND, NULL));
	if (!(str = sdrl_next_arg_or_fail(mach, &value, str_type))
	|| !(index = sdrl_next_arg_or_fail(mach, &value, num_type)))
		return(mach->error->err);
	if ((index->data.num >= 0) && (index->data.num < strlen(str->data.str)))
		ret = str->data.str[ (int) index->data.num ];
	mach->ret = sdrl_make_value(mach->heap, num_type, (sdrl_data_t) ret, 0, NULL);
	return(0);



	if (!(num_type = sdrl_find_binding(mach->type_env, "number"))
	  || !(str_type = sdrl_find_binding(mach->type_env, "string")))
		return(SDRL_ERROR(mach, SDRL_ES_HIGH, SDRL_ERR_NOT_FOUND, NULL));
	if (!(str = sdrl_next_arg_or_fail(mach, &value, str_type))
	  || !(index = sdrl_next_arg_or_fail(mach, &value, num_type)))
		return(mach->error->err);
	if ((index->data.num >= 0) && (index->data.num < strlen(str->data.str)))
		ret = str->data.str[ (int) index->data.num ];
	mach->ret = sdrl_make_value(mach->heap, num_type, (sdrl_data_t) ret, 0, NULL);
	return(0);



	if (!(num_type = sdrl_find_binding(mach->type_env, "number"))
	    || !(str_type = sdrl_find_binding(mach->type_env, "string")))
		return(SDRL_ERROR(mach, SDRL_ES_HIGH, SDRL_ERR_NOT_FOUND, NULL));
	if (!(str = sdrl_next_arg_or_fail(mach, &value, str_type))
	    || !(index = sdrl_next_arg_or_fail(mach, &value, num_type)))
		return(mach->error->err);
	if ((index->data.num >= 0) && (index->data.num < strlen(str->data.str)))
		ret = str->data.str[ (int) index->data.num ];
	mach->ret = sdrl_make_value(mach->heap, num_type, (sdrl_data_t) ret, 0, NULL);
	return(0);