|
funkalicious 0.1
|
#include <glib-2.0/glib.h>#include <gio/gio.h>#include <libpostproc/postproc_generic.h>
Include dependency graph for write_ascii_slice.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Functions | |
| GError * | postproc_write_ascii_slice (int Nd, const int *sizes, enum postproc_type t, const void *buffer, enum postproc_coord coord, int value, GFile *base) |
| GError* postproc_write_ascii_slice | ( | int | Nd, |
| const int * | sizes, | ||
| enum postproc_type | t, | ||
| const void * | buffer, | ||
| enum postproc_coord | coord, | ||
| int | value, | ||
| GFile * | base | ||
| ) |
Definition at line 35 of file write_ascii_slice.c.
References e, LIBPOSTPROC_WRITE_ASCII_SLICE_DOMAIN, POSTPROC_X, POSTPROC_Y, POSTPROC_Z, and str.
Referenced by main().
{
if(Nd != 3) {
return g_error_new(LIBPOSTPROC_WRITE_ASCII_SLICE_DOMAIN, 1, "libpostproc::write_ascii_slice.c::postproc_write_ascii_slice: Dimensions other then 3 not supported.");
}
GError *e = NULL;
GError *err;
GString *s = g_string_new("gridslice_");;
switch(coord) {
case POSTPROC_X:
g_string_append_printf(s, "X=%d.pdata", coord);
break;
case POSTPROC_Y:
g_string_append_printf(s, "Y=%d.pdata", coord);
break;
case POSTPROC_Z:
g_string_append_printf(s, "Z=%d.pdata", coord);
break;
}
GFile* f;
if(base == NULL) {
f = g_file_new_for_path(s->str);
}else{
f = g_file_resolve_relative_path(base, s->str);
}
GFileIOStream *gfos = g_file_create_readwrite(f, G_FILE_CREATE_REPLACE_DESTINATION, NULL, &e);
if(e != NULL) {
return e;
}
GOutputStream *os = g_io_stream_get_output_stream((GIOStream*)gfos);
GDataOutputStream *dos = g_data_output_stream_new(os);
g_string_printf(s, "#index\tmaterial\n");
e=NULL;
char *str;
g_data_output_stream_put_string(dos, s->str, NULL, &e);
if(e != NULL) {
err = e;
g_string_free(s, TRUE);
e=NULL;
g_io_stream_close((GIOStream*)gfos, NULL, &e);
if(e != NULL) {
err = g_error_new(LIBPOSTPROC_WRITE_ASCII_SLICE_DOMAIN, 1, "libpostprocess::write_ascii_slice.c::write_ascii_slice: had an error (%s) while writing string (%s), but had another error (%s) while closing the file (%s)!\n", (err)->message, s->str, e->message, str=g_file_get_uri(f));
g_free(str);
}
return err;
}
return NULL;
}
Here is the caller graph for this function: