File: file.h

package info (click to toggle)
gdis 0.90-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 10,332 kB
  • ctags: 9,022
  • sloc: ansic: 71,121; perl: 298; sh: 123; python: 115; makefile: 69; xml: 26
file content (189 lines) | stat: -rw-r--r-- 6,699 bytes parent folder | download | duplicates (4)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/*
Copyright (C) 2003 by Sean David Fleming

sean@ivec.org

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

The GNU GPL can also be found at http://www.gnu.org
*/

#ifdef __WIN32
#define DIR_SEP "\\"
#else
#define DIR_SEP "/"
#endif

#define KEYWORD_LEN 10

/* FORTRAN ugliness */
#define READ_RECORD fread(&sysenv.fortran_buffer, sizeof(int), 1, fp)
#define WRITE_RECORD fwrite(&sysenv.fortran_buffer, sizeof(int), 1, fp)

/* enumerated types for POV-Ray colour-style selection */
enum {HSV,	  			/*Colour-wheel style red-green-blue */
	  REDWHITEBLUE		/* Red-fades to white-fades to blue */
};

struct keyword_pak
{
gchar *label;
gint code;
};

extern struct keyword_pak keywords[];

/* main */
void file_init(void);
void file_free(void);
gint fgetline(FILE *, gchar *);
gchar *file_read_line(FILE *);
void file_skip_comment(gint);

gint set_path(const gchar *);
GSList *file_dir_list(const gchar *, gint);
GSList *file_dir_list_pattern(const gchar *, const gchar *);

struct file_pak *get_file_info(gpointer, gint);
void file_load(gchar *, struct model_pak *);
void file_save(void);
gint file_save_as(gchar *, struct model_pak *);
gchar *gun(const gchar *);
gchar *format_value_and_units(gchar *, gint);
gint file_extension_valid(const gchar *);
gchar *file_extension_get(const gchar *);
gint file_byte_size(const gchar *);
gchar *file_find_program(const gchar *);

/* dialog control */
void file_dialog(gchar *, gchar *, gint, 
                 gpointer (gchar *,  struct model_pak *), gint);
void file_load_dialog(void);
void file_save_dialog(void);

/* file writing routines */
gint write_arc(gchar *, struct model_pak *);
gint write_cif(gchar *, struct model_pak *);
gint write_fdf(gchar *, struct model_pak *);
gint write_gulp(gchar *, struct model_pak *);
gint write_gmf(gchar *, struct model_pak *);
gint write_planes(gchar *, struct model_pak *);
gint write_marvin(gchar *, struct model_pak *);
gint write_xml(gchar *, struct model_pak *);
gint write_xtl(gchar *, struct model_pak *);
gint write_xyz(gchar *, struct model_pak *);
gint write_gms(gchar *, struct model_pak *);
gint write_diffax(gchar *, struct model_pak *);
gint write_povray(gchar *, struct model_pak *);
gint write_pdb(gchar *, struct model_pak *);
gint write_gauss(gchar *, struct model_pak *);
gint write_cssr(gchar *, struct model_pak *); 
gint write_dmol(gchar *, struct model_pak *);
gint write_dlpoly(gchar *, struct model_pak *);
gint write_bgf(gchar *, struct model_pak *);
gint write_cgf(gchar *, struct model_pak *);
gint write_dlp(gchar *, struct model_pak *);
gint write_gromacs(gchar *, struct model_pak *);
gint write_castep_cell(gchar *, struct model_pak *);
gint write_meta(gchar *, struct model_pak *);

void write_povray_colour_textures(FILE *, struct model_pak *, int);
void write_sfc_data(FILE *);

gint write_arc_header(FILE *, struct model_pak *);
gint write_arc_frame(FILE *, struct model_pak *);
gint write_trj_header(FILE *, struct model_pak *);
gint write_trj_frame(FILE *, struct model_pak *);

/* file reading routines */
gint read_arc(gchar *, struct model_pak *);
gint read_cif(gchar *, struct model_pak *);
gint read_fdf(gchar *, struct model_pak *);
gint read_gulp(gchar *, struct model_pak *);
gint read_gulp_output(gchar *, struct model_pak *);
gint read_gmf(gchar *, struct model_pak *);
gint read_planes(gchar *, struct model_pak *);
gint read_marvin(gchar *, struct model_pak *);
gint read_mvnout(gchar *, struct model_pak *);
gint read_sout(gchar *, struct model_pak *);
gint read_xml(gchar *, struct model_pak *);
gint read_xtl(gchar *, struct model_pak *);
gint read_xyz(gchar *, struct model_pak *);
gint read_using_babel(gchar *, struct model_pak *);
gint read_gms(gchar *, struct model_pak *);
gint read_gms_out(gchar *, struct model_pak *);
gint read_diffax(gchar *, struct model_pak *);
gint read_about(gchar *, struct model_pak *);
gint read_nw(gchar *, struct model_pak *);
gint read_nwout(gchar *, struct model_pak *);
gint read_pdb(gchar *, struct model_pak *);
gint read_castep_out(gchar *, struct model_pak *);
gint read_gauss(gchar *, struct model_pak *);
gint read_gauss_out(gchar *, struct model_pak *);
gint read_rietica(gchar *, struct model_pak *);
gint read_off(gchar *, struct model_pak *);
gint read_moldy(gchar *, struct model_pak *);
gint read_moldy_restart(gchar *, struct model_pak *);
gint read_cssr(gchar *, struct model_pak *);
gint read_cel(gchar *, struct model_pak *);
gint read_dmol(gchar *, struct model_pak *);
gint read_dlpoly(gchar *, struct model_pak *);
gint read_bgf(gchar *, struct model_pak *);
gint read_cgf(gchar *, struct model_pak *);
gint read_dlp(gchar *, struct model_pak *);
gint read_gromacs_gro(gchar *, struct model_pak *);

gint project_read(gchar *, struct model_pak *);

gint read_trj_header(FILE *, struct model_pak *);
gint read_trj_frame(FILE *, struct model_pak *, gint);
gint read_arc_frame(FILE *, struct model_pak *);
gint read_sout_frame(FILE *, struct model_pak *);
gint read_gms_out_frame(FILE *, struct model_pak *);
gint read_about_frame(FILE *, struct model_pak *);
gint read_nwout_frame(FILE *, struct model_pak *);
gint read_pdb_frame(FILE *, struct model_pak *);
gint read_castep_out_frame(FILE *, struct model_pak *);
gint read_gauss_out_frame(FILE *, struct model_pak *);
gint read_xyz_frame(FILE *, struct model_pak *);
gint read_dlpoly_frame(FILE *, struct model_pak *);
gint read_dmol_frame(FILE *, struct model_pak *);

gint load_planes(gchar *, struct model_pak *);

gint mark_trj_frames(struct model_pak *);

void import_planes(gchar *);

void swap_bytes(void *, const gint);

void gdis_blurb(FILE *);

/* parsing */
void capitals(gchar *, gchar *);
gchar **get_tokenized_line(FILE *, gint *);
gint get_keyword_code(const gchar *);

gint read_frame(FILE *, gint, struct model_pak *);
gint read_raw_frame(FILE *, gint, struct model_pak *);
gint add_frame_offset(FILE *, struct model_pak *);

gint hash_strcmp(gconstpointer, gconstpointer);

GSList *fdf_species_build(struct model_pak *);
gint fdf_species_index(gchar *, GSList *);

GSList *gromacs_read_ff(const gchar *);