Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

563665 views
1
#include "typedef.h"
2
#include "tools.h"
3
#include"getput.h"
4
#include"datei.h"
5
#include "matrix.h"
6
7
/**************************************************************************\
8
@---------------------------------------------------------------------------
9
@---------------------------------------------------------------------------
10
@ FILE: get_zentr.c
11
@---------------------------------------------------------------------------
12
@---------------------------------------------------------------------------
13
@
14
\**************************************************************************/
15
16
/**************************************************************************\
17
@---------------------------------------------------------------------------
18
@ void get_zentr(B)
19
@ symbol_out *B;
20
@
21
@ Another function for the 'Datei' programm.
22
@ It reads matrices form the file 'B->fn' and
23
@ stores them in 'B->zentr'.
24
@ Reads additionally a filename stated beyond the matrices
25
@ and stores it in B->fn.
26
@---------------------------------------------------------------------------
27
@
28
\**************************************************************************/
29
void get_zentr(B)
30
symbol_out *B;
31
{
32
33
char *file_name;
34
boolean header = FALSE;
35
char st;
36
char *fn,
37
*old_fn; /* the pointer fn is modified via fn++, old_fn
38
just makes it possible to free it */
39
FILE *infile;
40
int anz;
41
int k ;
42
43
file_name = B->fn;
44
B->fn = NULL;
45
/*------------------------------------------------------------*\
46
| Open input file |
47
\*------------------------------------------------------------*/
48
if ( file_name == NULL )
49
infile = stdin;
50
else
51
if ( (infile = fopen (file_name, "r")) == NULL ) {
52
fprintf (stderr, "get_zentr: Could not open input-file %s\n", file_name);
53
exit (4);
54
}
55
fscanf (infile, "%*[ \t\n\r]");
56
st = getc(infile);
57
if ( st != '#' ) {
58
anz = 1;
59
ungetc(st,infile);
60
}
61
else
62
fscanf (infile, "%u", &anz);
63
/*--------------------------------------------------------------------*\
64
| read the matrices |
65
\*--------------------------------------------------------------------*/
66
if(anz != 0)
67
B->grp->zentr = (matrix_TYP **)malloc(anz*sizeof(matrix_TYP *));
68
B->grp->zentr_no = anz;
69
for ( k = 0; k < anz; k++) {
70
B->grp->zentr[k] = fget_mat(infile);
71
}
72
73
/*------------------------------------------------------------*\
74
| read file with other almost decomposable bravais-group |
75
\*------------------------------------------------------------*/
76
old_fn = fn = (char *) malloc(80 *sizeof(char));
77
fscanf (infile, "%[ \t\n]", fn);
78
fscanf (infile, "%[^\n]", fn);
79
while(fn != NULL && fn[0] == ' ')
80
fn++;
81
82
/* added free(old_fn), tilman 7/5/97 */
83
if(fn[0] == '\n' ||
84
fn[0] == '0' ||
85
fn[0] == EOF ||
86
fn[0] == '\t' ||
87
fn[0] == '%' ||
88
fn[0] == '\f' ||
89
fn[0] == '\r' ||
90
fn[0] == '\v'){
91
free(old_fn);
92
fn = NULL;
93
}
94
95
if(fn != NULL)
96
strtok (fn, "%");
97
if(fn != NULL)
98
{
99
B->fn = calloc( 80 , sizeof(char) );
100
strcat( B->fn, TABLES);
101
/***********************
102
strcat( B->fn, TOPDIR "/lib/");
103
***********************/
104
strcat(B->fn, fn);
105
free ( fn );
106
}
107
/*------------------------------------------------------------*\
108
| Close input file |
109
\*------------------------------------------------------------*/
110
if ( infile != stdin )
111
fclose (infile);
112
113
/* inserted tilman 7/5/97 */
114
if (file_name != NULL) free(file_name);
115
116
}
117
/*{{{}}}*/
118
119