00001 #include "sed_sedflux.h" 00002 00003 static gchar* order_str = NULL; 00004 00005 static GOptionEntry entries[] = 00006 { 00007 { "byte-order" , 'o' , 0 , G_OPTION_ARG_STRING , &order_str , "Byte order of output" , "STR" } , 00008 { NULL } 00009 }; 00010 00011 int main( int argc , char* argv[] ) 00012 { 00013 gssize n_bytes; 00014 gint byte_order; 00015 GError* error = NULL; 00016 GOptionContext* context; 00017 00018 eh_init_glib(); 00019 00020 context = g_option_context_new( "Write a Sed_column test file." ); 00021 g_option_context_add_main_entries( context , entries , NULL ); 00022 if ( !g_option_context_parse( context , &argc , &argv , &error ) ) 00023 eh_error( "Error parsing command line arguments: %s" , error->message ); 00024 00025 if ( !order_str ) 00026 byte_order = G_BYTE_ORDER; 00027 else if ( g_ascii_strcasecmp( order_str , "BIG-ENDIAN" ) ) 00028 byte_order = G_BIG_ENDIAN; 00029 else if ( g_ascii_strcasecmp( order_str , "LITTLE-ENDIAN" ) ) 00030 byte_order = G_LITTLE_ENDIAN; 00031 else 00032 eh_require_not_reached(); 00033 00034 sed_sediment_set_env( sed_sediment_scan(SED_SEDIMENT_TEST_FILE,NULL) ); 00035 00036 { 00037 Sed_column c = sed_column_new( 5 ); 00038 Sed_cell cell = sed_cell_new_classed( NULL , 23.1 , S_SED_TYPE_SAND|S_SED_TYPE_MUD ); 00039 00040 sed_column_add_cell( c , cell ); 00041 00042 sed_column_set_z_res ( c , 2.718 ); 00043 sed_column_set_x_position ( c , 3.14 ); 00044 sed_column_set_y_position ( c , 9.81 ); 00045 sed_column_set_base_height( c , 1.414 ); 00046 sed_column_set_age ( c , 33. ); 00047 00048 n_bytes = sed_column_write_to_byte_order( stdout , c , byte_order ); 00049 00050 sed_cell_destroy ( cell ); 00051 sed_column_destroy( c ); 00052 } 00053 00054 return 0; 00055 } 00056