get rid of EOL spaces
[pandora-libraries.git] / include / pnd_pndfiles.h
1
2 #ifndef h_pnd_pndfiles_h
3 #define h_pnd_pndfiles_h
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 // the filename of PND files must end with a well defined (case insensitive!) extension
10 #define PND_PACKAGE_FILEEXT ".pnd" /* case insensitive due to SD FAT fs */
11
12 // when seeking the PXML appended (or embedded within if they forgot to append it)
13 // to a PND file, this buffer size will be used in the seek. It'll actually under-seek
14 // a bit, so in the odd chance the "<PXML>" tag borders right on the window size, we'll
15 // still find it.
16 //   Being SD reads, it might be nice to pick a decent size .. SD is constant read regardless
17 // of read size for certain sizes, but of course strstr() within a giant buffer is no good
18 // either if the goods are near the end. How big is an average .png for an average icon
19 // size?
20 #define PND_PXML_WINDOW_SIZE 4096
21 #define PND_PXML_WINDOW_FRACTIONAL ( PND_PXML_WINDOW_SIZE - 10 )
22
23 // pnd_seek_pxml should vaguely work like fseek, trying to position at begin of the appended/found PXML
24 // On return of 0, assuming nothing.
25 // On 1, assume that the FILE pointer is positioned for next read to pull in the PXML line by line
26 unsigned char pnd_pnd_seek_pxml ( FILE *f );
27
28 // accrue_pxml will read through the given FILE * until it finds </PXML> (case insensitively)
29 // Returns 1 on success (</PXML> found), leaving file pointer after the </PXML>\n
30 // Returns 0 on failure (likely file pointer is at the end of the file, having sought out the </PXML>
31 unsigned char pnd_pnd_accrue_pxml ( FILE *f, char *target, unsigned int maxlen );
32
33 // pnd_match_binbuf will find a case insensitve string within a binary buffer (ie: strcasestr will
34 // only work in a non-binary buffer.) Brute force zombies ahead!
35 char *pnd_match_binbuf ( char *haystack, unsigned int maxlen, char *needle );
36
37 // pnd_mount() is for mounting a .pnd or PXML-app into the filesystem without running the app; for
38 // instance, should you want to browse screenshots (listed from PXML say?), you might want to
39 // pnd_mount(), lurk around in the mount, and then pnd_unmount() to release it
40 // On success, _mount and _unmount return >0
41 unsigned char pnd_pnd_mount ( char *pndrun, char *fullpath, char *unique_id );
42 unsigned char pnd_pnd_unmount ( char *pndrun, char *fullpath, char *unique_id );
43
44 #ifdef __cplusplus
45 } /* "C" */
46 #endif
47
48 #endif