File: Raw.h

package info (click to toggle)
pymol 1.7.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 42,668 kB
  • ctags: 25,775
  • sloc: ansic: 494,779; python: 75,446; cpp: 20,088; makefile: 351; sh: 172; csh: 21
file content (77 lines) | stat: -rw-r--r-- 2,085 bytes parent folder | download | duplicates (2)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77


/* 
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* Copyright (c) Schrodinger, LLC. 
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information. 
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-* 
-* 
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_Raw
#define _H_Raw

#include"PyMOLGlobals.h"


/* interface class for device-independent, raw binary I/O */

typedef struct {
  PyMOLGlobals *G;
  int mode;
  FILE *f;
  char *bufVLA;
  int swap;
  int header[4];
} CRaw;


/* object types */

#define cRaw_EOF                     0
#define cRaw_AtomInfo1               1
#define cRaw_Coords1                 2
#define cRaw_Spheroid1               3
#define cRaw_SpheroidNormals1        4
#define cRaw_SpheroidInfo1           5
#define cRaw_Bonds1                  6


/* FYI: file format;

4 byte magic for determining endianess 0x04030201

followed by any number of records with the following header...

4 bytes (record length, less header) 
4 bytes (record type)
4 bytes (program version)
4 bytes (serial number)
...

*/

CRaw *RawOpenRead(PyMOLGlobals * G, char *fname);
CRaw *RawOpenWrite(PyMOLGlobals * G, char *fname);
CRaw *RawOpenAppend(PyMOLGlobals * G, char *fname);
void RawFree(CRaw * I);

int RawWrite(CRaw * I, int type, unsigned int size, int serial, char *bytes);

int RawGetNext(CRaw * I, int *size, int *version);

char *RawRead(CRaw * I, int *type, unsigned int *size, int *serial);
char *RawReadPtr(CRaw * I, int type, int *size);
char *RawReadVLA(CRaw * I, int type, unsigned int rec_size, int grow_factor,
                 int auto_zero);
int RawReadInto(CRaw * I, int type, unsigned int size, char *buffer);
int RawReadSkip(CRaw * I);

#endif