Esempio n. 1
0
/*
C implementation of super::B::(super::A::id)

Imported methods signatures:
	void NativeString_to_s( char * str ) for string::NativeString::to_s
	char * String_to_cstring( String recv ) for string::String::to_cstring
	String B_id___super( B recv ) to call super
*/
String B_id___impl( B recv )
{
	char *new_name;
	char *prefix = "B special ";
	char *super_name = String_to_cstring( B_id___super( recv ) );

	new_name = calloc( strlen( prefix )+strlen( super_name )+1, sizeof(char) );
	strcpy( new_name, prefix );
	strcpy( new_name+strlen( prefix ), super_name );
	new_name[ strlen( prefix )+strlen( super_name ) ] = '\0';

	return NativeString_to_s( new_name );
}
Esempio n. 2
0
/*
C implementation of string::String::to_f

Imported methods signatures:
	char * String_to_cstring( String recv ) for string::String::to_cstring
*/
float String_to_f___impl( String recv )
{
    float value;
    char *str;
    int read;

    str = String_to_cstring( recv );

    read = sscanf( str, "%f", &value );

    if ( read <= 0 )
    {
        fprintf( stderr, "Failed to convert string \"\" to float." );
        abort();
    }

    return value;
}
Esempio n. 3
0
/*
C implementation of md5::String::md5_digest

Imported methods signatures:
	char * String_to_cstring( String recv ) for string::String::to_cstring
	String new_String_from_cstring( char * str ) for string::String::from_cstring
*/
String String_md5___impl( String recv )
{
	md5_state_t state;
	md5_byte_t digest[16]; /* result */
	char *hex_output = malloc( 33*sizeof( char ) );
	int di;
	char *in_text;

	in_text = String_to_cstring( recv );

	md5_init(&state);
	md5_append(&state, (const md5_byte_t *)in_text, strlen(in_text) );
	md5_finish(&state, digest);

	for (di = 0; di < 16; ++di)
		sprintf(hex_output + di * 2, "%02x", digest[di]);
	hex_output[ 32 ] = '\0';

	return new_String_from_cstring( hex_output );
}
Esempio n. 4
0
/*
C implementation of curses::Window::mvaddstr

Imported methods signatures:
	char * String_to_cstring( String recv ) for string::String::to_cstring
*/
void Window_mvaddstr___impl( Window recv, bigint y, bigint x, String str )
{
	char *c_string = String_to_cstring( str );
	mvaddstr(y, x, c_string);
}
Esempio n. 5
0
struct passwd* posix___new_Passwd_from_name___impl( String name )
{
#line 60 "/home/ouajdi/Desktop/nit/lib/standard/posix.nit"

 return getpwnam( String_to_cstring(name) ); }
Esempio n. 6
0
struct group* posix___new_Group_from_name___impl( String name )
{
#line 87 "/home/ouajdi/Desktop/nit/lib/standard/posix.nit"

 return getgrnam( String_to_cstring(name) ); }
Esempio n. 7
0
/*
C implementation of test_ni_strings::A::get_nstr_from_str

Imported methods signatures:
	char * String_to_cstring( String recv ) for string::String::to_cstring
*/
char * A_get_nstr_from_str___impl( A recv, String str )
{
	return String_to_cstring( str );
}