File: loadsave.h

package info (click to toggle)
xmorph 1%3A20050408b
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 5,712 kB
  • ctags: 2,109
  • sloc: ansic: 24,471; sh: 11,182; cpp: 1,546; makefile: 954; sed: 16
file content (44 lines) | stat: -rw-r--r-- 855 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

/* load/save hooks  */ 

gboolean save_session(int lp,
		      const char *file);

gboolean load_session(int lp,
		      const char *file);

gboolean load_image_from_file(int lp,
			      const char *file);

gboolean save_as_ppm(gchar *file,GdkPixbuf * pb);

gboolean save_image_to_file(int lp,
			    const char *file);

gboolean save_mesh_to_file(int lp, const char * file);

gboolean load_mesh_from_file(int lp, const char * file);



static inline gchar *extension(const gchar *file )
{
  int len=strlen(file);
  len--;
  while(len>0) {
    if(file[len]=='.')      
      return ((gchar *)file)+len+1;
    len--;
  }
  return NULL;
}
static inline int cmp_extension(const gchar *file,
				const gchar *ext)
{
  int len=strlen(file), l=strlen(ext);
  if(len<l)
    return 2;
  if(file[len-l-1] != '.')
    return 3;
  return strcmp(file+len-l,ext);
}