31 {
"7",
"char",
"short",
"int",
"long",
"float",
"double",
"string"},
33 {
"5",
"array",
"vector",
"matrix",
"list",
"tensor"},
45 FILE *
t_fopen(
const char *name,
const char *mode)
64 if((fp=fopen(name,mode))==NULL){
66 t_error(
" The specified file could not be opened ");
87 printf(
" An attemp was made to close an already closed file ");
109 long count=0,i,tmp=0;
110 const char ascii[2]=
"a",binary[2]=
"b";
113 t_error(
"The input file was not opened properly or is not allocated");
114 }
else if (v==NULL || v->
co==NULL || (v->
isdynamic)!=1){
115 t_error(
"The vector was not allocated properly");
116 }
else if(v->
nl > v->
nh){
117 t_error(
"The vector has no proper dimensions");
118 }
else if(strcmp(mode,ascii)==0){
120 for(i=v->
nl;i<=v->nh;i++){
121 tmp=fscanf(input,
"%hd",&(v->
co[i]));
125 printf(
"Error in stored data::Unespected End of file encountered");
126 printf(
" after position %ld\n",count);
130 }
else if(strcmp(mode,binary)){
131 count=fread((
short *)&(v->
co[v->
nl]),
sizeof(
short),v->
nh-v->
nl+1,input);
133 t_error(
"Error in reading mode::Mode not supported");
136 if(count!=(v->
nh-v->
nl+1)){
137 printf(
"Error in stored data::Stored data number does not match the request");
155 t_error(
"The input file was not opened properly");
156 }
else if (v==NULL || v->
co==NULL || v->
isdynamic !=1){
157 t_error(
"The vector was not allocated properly");
158 }
else if(v->
nl > v->
nh ){
159 t_error(
"The vector has no proper dimensions");
162 for(i=v->
nl;i<=v->nh;i++){
163 tmp=fprintf(output,
"%d ",v->
co[i]);
164 if(i%maxcols==0 && i!=(v->
nh)) putc(
'\n',output);
166 printf(
"Error in storing data::Unespected End of file encountered\n");
192 t_error(
"The input file was not opened properly");
193 }
else if (v==NULL || v->
co==NULL || v->
isdynamic !=1){
194 t_error(
"The vector was not allocated properly");
195 }
else if(v->
nl > v->
nh ){
196 t_error(
"The vector has no proper dimensions");
198 tmp=fwrite((
short *)&(v->
co[v->
nl]),
sizeof(
short),v->
nh-v->
nl+1,output);
202 printf(
"Error in stored data::Unespected End of file encountered");
203 printf(
"after position %ld\n",count);
209 if(count!=(v->
nh-v->
nl+1)){
210 printf(
"Error in stored data::Stored data number does not match the request");
231 t_error(
"The vector was not allocated properly");
232 }
else if(v->
nl > v->
nh ){
233 t_error(
"The vector has no proper dimensions");
236 for(i=v->
nl;i<=v->nh;i++){
237 printf(
"%hd ",v->
co[i]);
238 if(i%maxcols==0 && i!=(v->
nh)) putchar(
'\n');
259 const char ascii[2]=
"a",binary[2]=
"b";
262 t_error(
"The input file was not opened properly or is not allocated");
263 }
else if (v==NULL || v->
co==NULL || (v->
isdynamic)!=1){
264 t_error(
"The vector was not allocated properly");
265 }
else if(v->
nl > v->
nh){
266 t_error(
"The vector has no proper dimensions");
267 }
else if(strcmp(mode,ascii)==0){
269 for(i=v->
nl;i<=v->nh;i++){
270 tmp=fscanf(input,
"%d",&(v->
co[i]));
274 printf(
"Error in stored data::Unespected End of file encountered");
275 printf(
" after position %ld\n",count);
279 }
else if(strcmp(mode,binary)){
280 count=fread((
int *)&(v->
co[v->
nl]),
sizeof(
int),v->
nh-v->
nl+1,input);
282 t_error(
"Error in reading mode::Mode not supported");
285 if(count!=(v->
nh-v->
nl+1)){
286 printf(
"Error in stored data::Stored data number does not match the request");
305 t_error(
"The input file was not opened properly");
306 }
else if (v==NULL || v->
co==NULL || v->
isdynamic !=1){
307 t_error(
"The vector was not allocated properly");
308 }
else if(v->
nl > v->
nh ){
309 t_error(
"The vector has no proper dimensions");
312 for(i=v->
nl;i<=v->nh;i++){
313 tmp=fprintf(output,
"%d ",v->
co[i]);
314 if(i%maxcols==0 && i!=(v->
nh)) putc(
'\n',output);
316 printf(
"Error in storing data::Unespected End of file encountered\n");
345 t_error(
"The input file was not opened properly");
346 }
else if (v==NULL || v->
co==NULL || v->
isdynamic !=1){
347 t_error(
"The vector was not allocated properly");
348 }
else if(v->
nl > v->
nh ){
349 t_error(
"The vector has no proper dimensions");
351 tmp=fwrite((
int *)&(v->
co[v->
nl]),
sizeof(
int),v->
nh-v->
nl+1,output);
355 printf(
"Error in stored data::Unespected End of file encountered");
356 printf(
"after position %ld\n",count);
362 if(count!=(v->
nh-v->
nl+1)){
363 printf(
"Error in stored data::Stored data number does not match the request");
384 t_error(
"The vector was not allocated properly");
385 }
else if(v->
nl > v->
nh ){
386 t_error(
"The vector has no proper dimensions");
389 for(i=v->
nl;i<=v->nh;i++){
390 printf(
"%d ",v->
co[i]);
391 if(i%maxcols==0 && i!=(v->
nh)) putchar(
'\n');
412 const char ascii[2]=
"a",binary[2]=
"b";
415 t_error(
"The input file was not opened properly or is not allocated");
416 }
else if (v==NULL || v->
co==NULL || (v->
isdynamic)!=1){
417 t_error(
"The vector was not allocated properly");
418 }
else if(v->
nl > v->
nh){
419 t_error(
"The vector has no proper dimensions");
420 }
else if(strcmp(mode,ascii)==0){
422 for(i=v->
nl;i<=v->nh;i++){
423 tmp=fscanf(input,
"%ld",&(v->
co[i]));
427 printf(
"Error in stored data::Unespected End of file encountered");
428 printf(
" after position %ld\n",count);
432 }
else if(strcmp(mode,binary)){
433 count=fread((
long *)&(v->
co[v->
nl]),
sizeof(
long),v->
nh-v->
nl+1,input);
435 t_error(
"Error in reading mode::Mode not supported");
438 if(count!=(v->
nh-v->
nl+1)){
439 printf(
"Error in stored data::Stored data number does not match the request");
457 t_error(
"The input file was not opened properly");
458 }
else if (v==NULL || v->
co==NULL || v->
isdynamic !=1){
459 t_error(
"The vector was not allocated properly");
460 }
else if(v->
nl > v->
nh ){
461 t_error(
"The vector has no proper dimensions");
464 for(i=v->
nl;i<=v->nh;i++){
465 tmp=fprintf(output,
"%ld ",v->
co[i]);
466 if(i%maxcols==0 && i!=(v->
nh)) putc(
'\n',output);
468 printf(
"Error in storing data::Unespected End of file encountered\n");
496 t_error(
"The input file was not opened properly");
497 }
else if (v==NULL || v->
co==NULL || v->
isdynamic !=1){
498 t_error(
"The vector was not allocated properly");
499 }
else if(v->
nl > v->
nh ){
500 t_error(
"The vector has no proper dimensions");
502 tmp=fwrite((
long *)&(v->
co[v->
nl]),
sizeof(
long),v->
nh-v->
nl+1,output);
506 printf(
"Error in stored data::Unespected End of file encountered");
507 printf(
"after position %ld\n",count);
513 if(count!=(v->
nh-v->
nl+1)){
514 printf(
"Error in stored data::Stored data number does not match the request");
535 t_error(
"The vector was not allocated properly");
536 }
else if(v->
nl > v->
nh ){
537 t_error(
"The vector has no proper dimensions");
540 for(i=v->
nl;i<=v->nh;i++){
541 printf(
"%ld ",v->
co[i]);
542 if(i%maxcols==0 && i!=(v->
nh)) putchar(
'\n');
563 const char ascii[2]=
"a",binary[2]=
"b";
566 t_error(
"The input file was not opened properly or is not allocated");
567 }
else if (v==NULL || v->
co==NULL || (v->
isdynamic)!=1){
568 t_error(
"The vector was not allocated properly");
569 }
else if(v->
nl > v->
nh){
570 t_error(
"The vector has no proper dimensions");
571 }
else if(strcmp(mode,ascii)==0){
573 for(i=v->
nl;i<=v->nh;i++){
574 tmp=fscanf(input,
"%f",&(v->
co[i]));
578 printf(
"Error in stored data::Unespected End of file encountered");
579 printf(
" after position %ld\n",count);
583 }
else if(strcmp(mode,binary)){
584 count=fread((
float *)&(v->
co[v->
nl]),
sizeof(
float),v->
nh-v->
nl+1,input);
586 t_error(
"Error in reading mode::Mode not supported");
589 if(count!=(v->
nh-v->
nl+1)){
590 printf(
"Error in stored data::Stored data number does not match the request");
608 t_error(
"The input file was not opened properly");
609 }
else if (v==NULL || v->
co==NULL || v->
isdynamic !=1){
610 t_error(
"The vector was not allocated properly");
611 }
else if(v->
nl > v->
nh ){
612 t_error(
"The vector has no proper dimensions");
615 for(i=v->
nl;i<=v->nh;i++){
616 tmp=fprintf(output,
"%f ",v->
co[i]);
617 if(i%maxcols==0 && i!=(v->
nh)) putc(
'\n',output);
619 printf(
"Error in storing data::Unespected End of file encountered\n");
646 t_error(
"The input file was not opened properly");
647 }
else if (v==NULL || v->
co==NULL || v->
isdynamic !=1){
648 t_error(
"The vector was not allocated properly");
649 }
else if(v->
nl > v->
nh ){
650 t_error(
"The vector has no proper dimensions");
652 tmp=fwrite((
float *)&(v->
co[v->
nl]),
sizeof(
float),v->
nh-v->
nl+1,output);
656 printf(
"Error in stored data::Unespected End of file encountered");
657 printf(
"after position %ld\n",count);
663 if(count!=(v->
nh-v->
nl+1)){
664 printf(
"Error in stored data::Stored data number does not match the request");
685 t_error(
"The vector was not allocated properly");
686 }
else if(v->
nl > v->
nh ){
687 t_error(
"The vector has no proper dimensions");
690 for(i=v->
nl;i<=v->nh;i++){
691 printf(
"%f ",v->
co[i]);
692 if(i%maxcols==0 && i!=(v->
nh)) putchar(
'\n');
713 const char ascii[2]=
"a",binary[2]=
"b";
716 t_error(
"The input file was not opened properly or is not allocated");
717 }
else if (v==NULL || v->
co==NULL || (v->
isdynamic)!=1){
718 t_error(
"The vector was not allocated properly");
719 }
else if(v->
nl > v->
nh){
720 t_error(
"The vector has no proper dimensions");
721 }
else if(strcmp(mode,ascii)==0){
723 for(i=v->
nl;i<=v->nh;i++){
724 tmp=fscanf(input,
"%lf",&(v->
co[i]));
728 printf(
"Error in stored data::Unespected End of file encountered");
729 printf(
" after position %ld\n",count);
733 }
else if(strcmp(mode,binary)){
734 count=fread((
double *)&(v->
co[v->
nl]),
sizeof(
double),v->
nh-v->
nl+1,input);
736 t_error(
"Error in reading mode::Mode not supported");
739 if(count!=(v->
nh-v->
nl+1)){
740 printf(
"Error in stored data::Stored data number does not match the request");
758 t_error(
"The input file was not opened properly");
759 }
else if (v==NULL || v->
co==NULL || v->
isdynamic !=1){
760 t_error(
"The vector was not allocated properly");
761 }
else if(v->
nl > v->
nh ){
762 t_error(
"The vector has no proper dimensions");
765 for(i=v->
nl;i<=v->nh;i++){
766 tmp=fprintf(output,
"%f ",v->
co[i]);
767 if(i%maxcols==0 && i!=(v->
nh)) putc(
'\n',output);
769 printf(
"Error in storing data::Unespected End of file encountered\n");
797 t_error(
"The input file was not opened properly");
798 }
else if (v==NULL || v->
co==NULL || v->
isdynamic !=1){
799 t_error(
"The vector was not allocated properly");
800 }
else if(v->
nl > v->
nh ){
801 t_error(
"The vector has no proper dimensions");
803 tmp=fwrite((
double *)&(v->
co[v->
nl]),
sizeof(
double),v->
nh-v->
nl+1,output);
807 printf(
"Error in stored data::Unespected End of file encountered");
808 printf(
"after position %ld\n",count);
814 if(count!=(v->
nh-v->
nl+1)){
815 printf(
"Error in stored data::Stored data number does not match the request");
836 t_error(
"The vector was not allocated properly");
837 }
else if(v->
nl > v->
nh ){
838 t_error(
"The vector has no proper dimensions");
841 for(i=v->
nl;i<=v->nh;i++){
842 printf(
"%f ",v->
co[i]);
843 if(i%maxcols==0 && i!=(v->
nh)) putchar(
'\n');
864 const char ascii[2]=
"a",binary[2]=
"b";
867 t_error(
"The input file was not opened properly or is not allocated");
868 }
else if (v==NULL || v->
co==NULL || (v->
isdynamic)!=1){
869 t_error(
"The vector was not allocated properly");
870 }
else if(v->
nl > v->
nh){
871 t_error(
"The vector has no proper dimensions");
872 }
else if(strcmp(mode,ascii)==0){
873 for(i=v->
nl;i<=v->nh;i++){
875 tmp=fscanf(input,
"%c",&(v->
co[i]));
879 printf(
"Error in stored data::Unespected End of file encountered");
880 printf(
" after position %ld\n",count);
884 }
else if(strcmp(mode,binary)){
885 count=fread((
char *)&(v->
co[v->
nl]),
sizeof(
char),v->
nh-v->
nl+1,input);
887 t_error(
"Error in reading mode::Mode not supported");
890 if(count!=(v->
nh-v->
nl+1)){
891 printf(
"Error in stored data::Stored data number does not match the request");
909 t_error(
"The input file was not opened properly");
910 }
else if (v==NULL || v->
co==NULL || v->
isdynamic !=1){
911 t_error(
"The vector was not allocated properly");
912 }
else if(v->
nl > v->
nh ){
913 t_error(
"The vector has no proper dimensions");
916 for(i=v->
nl;i<=v->nh;i++){
917 tmp=fprintf(output,
"%c ",v->
co[i]);
918 if(i%maxcols==0 && i!=(v->
nh)) putc(
'\n',output);
920 printf(
"Error in storing data::Unespected End of file encountered\n");
948 t_error(
"The input file was not opened properly");
949 }
else if (v==NULL || v->
co==NULL || v->
isdynamic !=1){
950 t_error(
"The vector was not allocated properly");
951 }
else if(v->
nl > v->
nh ){
952 t_error(
"The vector has no proper dimensions");
954 tmp=fwrite((
char *)&(v->
co[v->
nl]),
sizeof(
char),v->
nh-v->
nl+1,output);
958 printf(
"Error in stored data::Unespected End of file encountered");
959 printf(
"after position %ld\n",count);
965 if(count!=(v->
nh-v->
nl+1)){
966 printf(
"Error in stored data::Stored data number does not match the request");
987 t_error(
"The vector was not allocated properly");
988 }
else if(v->
nl > v->
nh ){
989 t_error(
"The vector has no proper dimensions");
992 for(i=v->
nl;i<=v->nh;i++){
993 printf(
"%c ",v->
co[i]);
994 if(i%maxcols==0 && i!=(v->
nh)) putchar(
'\n');
1018 const char ascii[2]=
"a",binary[2]=
"b";
1024 t_error(
"The input file was not opened properly");
1025 }
else if (m==NULL || m->
co==NULL || (m->
isdynamic)!=1){
1026 t_error(
"The matrix was not allocated properly");
1028 t_error(
"The matrix has no proper dimensions");
1029 }
else if(strcmp(mode,ascii)==0){
1031 for(i=m->
nrl;i<=m->nrh;i++){
1032 for(j=m->
ncl;j<=m->nch;j++){
1033 tmp=fscanf(input,
"%hd",&(m->
co[i][j]));
1037 printf(
"Error in stored data::Unexpected End of File encountered\n");
1038 printf(
" after position %ld\n",count);
1044 }
else if(strcmp(mode,binary)==0){
1046 for(i=m->
nrl;i<=m->nrh;i++){
1047 tmp=fread((
short *)&(m->
co[i][m->
ncl]),
sizeof(
short),m->
nch-m->
ncl+1,input);
1051 printf(
"Error in stored data::Unexpected End of File encountered\n");
1052 printf(
" after position %ld\n",count);
1057 t_error(
"Error in reading mode::Mode not supported");
1061 printf(
"Error in stored data::Stored data number does not match the request");
1081 t_error(
"The input file was not opened properly");
1082 }
else if (m==NULL || m->
co==NULL || m->
isdynamic !=1){
1083 t_error(
"The matrix was not allocated properly");
1085 t_error(
"The matrix has no proper dimensions");
1088 for(i=m->
nrl;i<=m->nrh;i++){
1089 for(j=m->
ncl;j<=m->nch;j++){
1090 tmp=fprintf(output,
"%hd\t ",m->
co[i][j]);
1092 printf(
"Error in storing data::Unespected End of file encountered\n");
1096 if(j%maxcols==0 && j!=m->
nch) putc(
'\n',output);
1121 t_error(
"The input file was not opened properly");
1122 }
else if (m==NULL || m->
co==NULL || m->
isdynamic !=1){
1123 t_error(
"The vector was not allocated properly");
1125 t_error(
"The matrix has no proper dimensions");
1127 for(i=m->
nrl;i<=m->nrh;i++){
1128 tmp=fwrite((
short *)&(m->
co[i][m->
nrl]),
sizeof(
short),m->
nch-m->
ncl+1,output);
1132 printf(
"Error in stored data::Unespected End of file encountered");
1133 printf(
"after position %ld\n",count);
1141 printf(
"Error in stored data::Stored data number does not match the request");
1161 t_error(
"The matrix was not allocated properly");
1163 t_error(
"The matrix has no proper dimensions");
1166 for(i=m->
nrl;i<=m->nrh;i++){
1167 for(j=m->
ncl;j<=m->nch;j++){
1168 printf(
"%hd ",m->
co[i][j]);
1169 if(j%maxcols==0 && j!=m->
nch) putchar(
'\n');
1191 const char ascii[2]=
"a",binary[2]=
"b";
1197 t_error(
"The input file was not opened properly");
1198 }
else if (m==NULL || m->
co==NULL || (m->
isdynamic)!=1){
1199 t_error(
"The matrix was not allocated properly");
1201 t_error(
"The matrix has no proper dimensions");
1202 }
else if(strcmp(mode,ascii)==0){
1204 for(i=m->
nrl;i<=m->nrh;i++){
1205 for(j=m->
ncl;j<=m->nch;j++){
1206 tmp=fscanf(input,
"%d",&(m->
co[i][j]));
1210 printf(
"Error in stored data::Unexpected End of File encountered\n");
1211 printf(
" after position %ld\n",count);
1217 }
else if(strcmp(mode,binary)==0){
1219 for(i=m->
nrl;i<=m->nrh;i++){
1220 tmp=fread((
int *)&(m->
co[i][m->
ncl]),
sizeof(
int),m->
nch-m->
ncl+1,input);
1224 printf(
"Error in stored data::Unexpected End of File encountered\n");
1225 printf(
" after position %ld\n",count);
1230 t_error(
"Error in reading mode::Mode not supported");
1234 printf(
"Error in stored data::Stored data number does not match the request");
1253 t_error(
"The input file was not opened properly");
1254 }
else if (m==NULL || m->
co==NULL || m->
isdynamic !=1){
1255 t_error(
"The matrix was not allocated properly");
1257 t_error(
"The matrix has no proper dimensions");
1260 for(i=m->
nrl;i<=m->nrh;i++){
1261 for(j=m->
ncl;j<=m->nch;j++){
1262 tmp=fprintf(output,
"%d ",m->
co[i][j]);
1264 printf(
"Error in storing data::Unespected End of file encountered\n");
1268 if(j%maxcols==0 && j!=m->
nch) putc(
'\n',output);
1292 t_error(
"The input file was not opened properly");
1293 }
else if (m==NULL || m->
co==NULL || m->
isdynamic !=1){
1294 t_error(
"The vector was not allocated properly");
1296 t_error(
"The matrix has no proper dimensions");
1298 for(i=m->
nrl;i<=m->nrh;i++){
1299 tmp=fwrite((
int *)&(m->
co[i][m->
nrl]),
sizeof(
int),m->
nch-m->
ncl+1,output);
1303 printf(
"Error in stored data::Unespected End of file encountered");
1304 printf(
"after position %ld\n",count);
1312 printf(
"Error in stored data::Stored data number does not match the request");
1332 t_error(
"The matrix was not allocated properly");
1334 t_error(
"The matrix has no proper dimensions");
1337 for(i=m->
nrl;i<=m->nrh;i++){
1338 for(j=m->
ncl;j<=m->nch;j++){
1339 printf(
"%d ",m->
co[i][j]);
1340 if(j%maxcols==0 && j!=m->
nch) putchar(
'\n');
1361 const char ascii[2]=
"a",binary[2]=
"b";
1365 t_error(
"The input file was not opened properly");
1366 }
else if (m==NULL || m->
co==NULL || (m->
isdynamic)!=1){
1367 t_error(
"The matrix was not allocated properly");
1369 t_error(
"The matrix has no proper dimensions");
1370 }
else if(strcmp(mode,ascii)==0){
1372 for(i=m->
nrl;i<=m->nrh;i++){
1373 for(j=m->
ncl;j<=m->nch;j++){
1374 tmp=fscanf(input,
"%ld",&(m->
co[i][j]));
1382 printf(
"Error in stored data::Unexpected End of File encountered\n");
1383 printf(
" after position %ld\n",count);
1389 }
else if(strcmp(mode,binary)==0){
1391 for(i=m->
nrl;i<=m->nrh;i++){
1392 tmp=fread((
long *)&(m->
co[i][m->
ncl]),
sizeof(
long),m->
nch-m->
ncl+1,input);
1396 printf(
"Error in stored data::Unexpected End of File encountered\n");
1397 printf(
" after position %ld\n",count);
1402 t_error(
"Error in reading mode::Mode not supported");
1407 printf(
"Error in stored data::Stored data number does not match the request");
1427 t_error(
"The input file was not opened properly");
1428 }
else if (m==NULL || m->
co==NULL || m->
isdynamic !=1){
1429 t_error(
"The matrix was not allocated properly");
1431 t_error(
"The matrix has no proper dimensions");
1434 for(i=m->
nrl;i<=m->nrh;i++){
1435 for(j=m->
ncl;j<=m->nch;j++){
1437 tmp=fprintf(output,
"%ld ",m->
co[i][j]);
1439 printf(
"Error in storing data::Unespected End of file encountered\n");
1443 if(j%maxcols==0 && j!=m->
nch) putc(
'\n',output);
1466 t_error(
"The input file was not opened properly");
1467 }
else if (m==NULL || m->
co==NULL || m->
isdynamic !=1){
1468 t_error(
"The vector was not allocated properly");
1470 t_error(
"The matrix has no proper dimensions");
1472 for(i=m->
nrl;i<=m->nrh;i++){
1473 tmp=fwrite((
long *)&(m->
co[i][m->
nrl]),
sizeof(
long),m->
nch-m->
ncl+1,output);
1477 printf(
"Error in stored data::Unespected End of file encountered");
1478 printf(
"after position %ld\n",count);
1486 printf(
"Error in stored data::Stored data number does not match the request");
1506 t_error(
"The matrix was not allocated properly");
1508 t_error(
"The matrix has no proper dimensions");
1511 for(i=m->
nrl;i<=m->nrh;i++){
1512 for(j=m->
ncl;j<=m->nch;j++){
1513 printf(
"%ld ",m->
co[i][j]);
1514 if(j%maxcols==0 && j!=m->
nch) putchar(
'\n');
1542 const char ascii[2]=
"a",binary[2]=
"b";
1548 t_error(
"The input file was not opened properly");
1549 }
else if (m==NULL || m->
co==NULL || (m->
isdynamic)!=1){
1550 t_error(
"The matrix was not allocated properly");
1552 t_error(
"The matrix has no proper dimensions");
1553 }
else if(strcmp(mode,ascii)==0){
1555 for(i=m->
nrl;i<=m->nrh;i++){
1556 for(j=m->
ncl;j<=m->nch;j++){
1557 tmp=fscanf(input,
"%f",&(m->
co[i][j]));
1561 printf(
"Error in stored data::Unexpected End of File encountered\n");
1562 printf(
" after position %ld\n",count);
1568 }
else if(strcmp(mode,binary)==0){
1570 for(i=m->
nrl;i<=m->nrh;i++){
1571 tmp=fread((
float *)&(m->
co[i][m->
ncl]),
sizeof(
float),m->
nch-m->
ncl+1,input);
1575 printf(
"Error in stored data::Unexpected End of File encountered\n");
1576 printf(
" after position %ld\n",count);
1581 t_error(
"Error in reading mode::Mode not supported");
1585 printf(
"Error in stored data::Stored data number does not match the request");
1603 t_error(
"The input file was not opened properly");
1604 }
else if (m==NULL || m->
co==NULL || m->
isdynamic !=1){
1605 t_error(
"The matrix was not allocated properly");
1607 t_error(
"The matrix has no proper dimensions");
1610 for(i=m->
nrl;i<=m->nrh;i++){
1611 for(j=m->
ncl;j<=m->nch;j++){
1612 tmp=fprintf(output,
"%f ",m->
co[i][j]);
1614 printf(
"Error in storing data::Unespected End of file encountered\n");
1618 if(j%maxcols==0 && j!=m->
nch) putc(
'\n',output);
1643 t_error(
"The input file was not opened properly");
1644 }
else if (m==NULL || m->
co==NULL || m->
isdynamic !=1){
1645 t_error(
"The vector was not allocated properly");
1647 t_error(
"The matrix has no proper dimensions");
1649 for(i=m->
nrl;i<=m->nrh;i++){
1650 tmp=fwrite((
float *)&(m->
co[i][m->
nrl]),
sizeof(
float),m->
nch-m->
ncl+1,output);
1654 printf(
"Error in stored data::Unexpected End of file encountered");
1655 printf(
"after position %ld\n",count);
1663 printf(
"Error in stored data::Stored data number does not match the request");
1683 t_error(
"The matrix was not allocated properly");
1685 t_error(
"The matrix has no proper dimensions");
1688 for(i=m->
nrl;i<=m->nrh;i++){
1689 for(j=m->
ncl;j<=m->nch;j++){
1690 printf(
"%f ",m->
co[i][j]);
1691 if(j%maxcols==0 && j!=m->
nch) putchar(
'\n');
1711 const char ascii[2]=
"a",binary[2]=
"b";
1717 t_error(
"The input file was not opened properly");
1718 }
else if (m==NULL || m->
co==NULL || (m->
isdynamic)!=1){
1719 t_error(
"The matrix was not allocated properly");
1721 t_error(
"The matrix has no proper dimensions");
1722 }
else if(strcmp(mode,ascii)==0){
1724 for(i=m->
nrl;i<=m->nrh;i++){
1725 for(j=m->
ncl;j<=m->nch;j++){
1726 tmp=fscanf(input,
"%lf",&(m->
co[i][j]));
1730 printf(
"Error in stored data::Unexpected End of File encountered\n");
1731 printf(
" after position %ld\n",count);
1737 }
else if(strcmp(mode,binary)==0){
1739 for(i=m->
nrl;i<=m->nrh;i++){
1740 tmp=fread((
double *)&(m->
co[i][m->
ncl]),
sizeof(
double),m->
nch-m->
ncl+1,input);
1744 printf(
"Error in stored data::Unexpected End of File encountered\n");
1745 printf(
" after position %ld\n",count);
1750 t_error(
"Error in reading mode::Mode not supported");
1754 printf(
"Error in stored data::Stored data number does not match the request");
1774 t_error(
"The input file was not opened properly");
1775 }
else if (m==NULL || m->
co==NULL || m->
isdynamic !=1){
1776 t_error(
"The matrix was not allocated properly");
1778 t_error(
"The matrix has no proper dimensions");
1781 for(i=m->
nrl;i<=m->nrh;i++){
1782 for(j=m->
ncl;j<=m->nch;j++){
1783 tmp=fprintf(output,
"%g\t",m->
co[i][j]);
1785 printf(
"Error in storing data::Unespected End of file encountered\n");
1789 if(j%maxcols==0 && j!= m->
ncl) putc(
'\n',output);
1809 long i,tmp=0,count=0;
1814 t_error(
"The input file was not opened properly");
1815 }
else if (m==NULL || m->
co==NULL || m->
isdynamic !=1){
1816 t_error(
"The vector was not allocated properly");
1818 t_error(
"The matrix has no proper dimensions");
1820 for(i=m->
nrl;i<=m->nrh;i++){
1821 tmp=fwrite((
double *)&(m->
co[i][m->
nrl]),
sizeof(
double),m->
nch-m->
ncl+1,output);
1825 printf(
"Error in stored data::Unespected End of file encountered");
1826 printf(
"after position %ld\n",count);
1834 printf(
"Error in stored data::Stored data number does not match the request");
1854 t_error(
"The matrix was not allocated properly");
1856 t_error(
"The matrix has no proper dimensions");
1859 for(i=m->
nrl;i<=m->nrh;i++){
1860 for(j=m->
ncl;j<=m->nch;j++){
1861 printf(
"%f ",m->
co[i][j]);
1862 if(j%maxcols==0 && j!= m->
nch) putchar(
'\n');
1880 long i,j,tmp=0,count=0,chksum=0;
1881 const char ascii[2]=
"a",binary[2]=
"b";
1885 t_error(
"The input file was not opened properly");
1887 t_error(
"The bin was not allocated properly");
1889 }
else if(strcmp(mode,ascii)==0){
1891 for(i=1;i<=(l->
index)->nh;i++){
1893 for(j=1;j<=(l->
index)->
co[i];j++){
1895 tmp=fscanf(input,
"%d",&(l->
co[i][j]));
1899 printf(
"Error in stored data::Unespected End of file encountered");
1900 printf(
"after position %ld\n",count);
1911 }
else if(strcmp(mode,binary)==0){
1913 for(i=1;i<=(l->
index)->nh;i++){
1915 tmp=fread((
int *)&(l->
co[i][1]),
sizeof(
int),l->
index->
co[i],input);
1919 printf(
"Error in stored data::Unexpected End of File encountered");
1920 printf(
" after position %ld\n",count);
1928 t_error(
"Error in reading mode::Mode not supported");
1932 printf(
"Error in stored data::Stored data number does not match the request");
1948 long i,j,tmp=0,chksum=0;
1953 t_error(
"The output file was not opened properly");
1955 t_error(
"The bin was not allocated properly");
1958 for(i=1;i<=(l->
index)->nh;i++){
1960 for(j=1;j<=(l->
index)->
co[i];j++){
1961 tmp=fprintf(output,
"%d ",l->
co[i][j]);
1963 printf(
"Error in storing data::Unespected End of file encountered");
1966 if(j%maxcols==0 && j!=(l->
index)->co[i]) putc(
'\n',output);
1987 long i,tmp=0,count=0,chksum=0;
1992 t_error(
"The output file was not opened properly");
1994 t_error(
"The bin was not allocated properly");
1997 for(i=1;i<=(l->
index)->nh;i++){
1999 tmp=fwrite((
int *)&(l->
co[i][1]),
sizeof(
int),l->
index->
co[i],output);
2003 printf(
"Error in storing data::Unespected End of file encountered");
2004 printf(
"after position %ld\n",count);
2013 printf(
"Error in stored data::Stored data number does not match the request");
2038 t_error(
"The bin was not allocated properly");
2041 for(i=1;i<=(l->
index)->nh;i++){
2042 for(j=1;j<=(l->
index)->
co[i];j++){
2044 printf(
"%d ",l->
co[i][j]);
2045 if(j%maxcols==0 && j!=(l->
index)->co[i]) putchar(
'\n');
2061 long i,j,tmp=0,count=0,chksum=0;
2062 const char ascii[2]=
"a",binary[2]=
"b";
2066 t_error(
"The input file was not opened properly");
2068 t_error(
"The bin was not allocated properly");
2070 }
else if(strcmp(mode,ascii)==0){
2072 for(i=1;i<=(l->
index)->nh;i++){
2074 for(j=1;j<=(l->
index)->
co[i];j++){
2076 tmp=fscanf(input,
"%hd",&(l->
co[i][j]));
2080 printf(
"Error in stored data::Unespected End of file encountered");
2081 printf(
"after position %ld\n",count);
2092 }
else if(strcmp(mode,binary)==0){
2094 for(i=1;i<=(l->
index)->nh;i++){
2096 tmp=fread((
short *)&(l->
co[i][1]),
sizeof(
short),l->
index->
co[i],input);
2100 printf(
"Error in stored data::Unexpected End of File encountered");
2101 printf(
" after position %ld\n",count);
2109 t_error(
"Error in reading mode::Mode not supported");
2113 printf(
"Error in stored data::Stored data number does not match the request");
2129 long i,j,tmp=0,chksum=0;
2134 t_error(
"The output file was not opened properly");
2136 t_error(
"The bin was not allocated properly");
2139 for(i=1;i<=(l->
index)->nh;i++){
2141 for(j=1;j<=(l->
index)->
co[i];j++){
2142 tmp=fprintf(output,
"%hd ",l->
co[i][j]);
2144 printf(
"Error in storing data::Unespected End of file encountered");
2147 if(j%maxcols==0 && j!=(l->
index)->co[i]) putc(
'\n',output);
2168 long i,tmp=0,count=0,chksum=0;
2173 t_error(
"The output file was not opened properly");
2175 t_error(
"The bin was not allocated properly");
2178 for(i=1;i<=(l->
index)->nh;i++){
2180 tmp=fwrite((
short *)&(l->
co[i][1]),
sizeof(
short),l->
index->
co[i],output);
2184 printf(
"Error in storing data::Unespected End of file encountered");
2185 printf(
"after position %ld\n",count);
2194 printf(
"Error in stored data::Stored data number does not match the request");
2219 t_error(
"The bin was not allocated properly");
2222 for(i=1;i<=(l->
index)->nh;i++){
2223 for(j=1;j<=(l->
index)->
co[i];j++){
2225 printf(
"%d ",l->
co[i][j]);
2226 if(j%maxcols==0 && j!=(l->
index)->co[i]) putchar(
'\n');
2242 long i,j,tmp=0,count=0,chksum=0;
2243 const char ascii[2]=
"a",binary[2]=
"b";
2247 t_error(
"The input file was not opened properly");
2249 t_error(
"The bin was not allocated properly");
2251 }
else if(strcmp(mode,ascii)==0){
2253 for(i=1;i<=(l->
index)->nh;i++){
2255 for(j=1;j<=(l->
index)->
co[i];j++){
2257 tmp=fscanf(input,
"%ld",&(l->
co[i][j]));
2261 printf(
"Error in stored data::Unespected End of file encountered");
2262 printf(
"after position %ld\n",count);
2273 }
else if(strcmp(mode,binary)==0){
2275 for(i=1;i<=(l->
index)->nh;i++){
2277 tmp=fread((
long *)&(l->
co[i][1]),
sizeof(
long),l->
index->
co[i],input);
2281 printf(
"Error in stored data::Unexpected End of File encountered");
2282 printf(
" after position %ld\n",count);
2290 t_error(
"Error in reading mode::Mode not supported");
2294 printf(
"Error in stored data::Stored data number does not match the request");
2310 long i,j,tmp=0,chksum=0;
2315 t_error(
"The output file was not opened properly");
2317 t_error(
"The bin was not allocated properly");
2320 for(i=1;i<=(l->
index)->nh;i++){
2322 for(j=1;j<=(l->
index)->
co[i];j++){
2323 tmp=fprintf(output,
"%ld ",l->
co[i][j]);
2325 printf(
"Error in storing data::Unespected End of file encountered");
2328 if(j%maxcols==0 && j!=(l->
index)->co[i]) putc(
'\n',output);
2349 long i,tmp=0,count=0,chksum=0;
2354 t_error(
"The output file was not opened properly");
2356 t_error(
"The bin was not allocated properly");
2359 for(i=1;i<=(l->
index)->nh;i++){
2361 tmp=fwrite((
long *)&(l->
co[i][1]),
sizeof(
long),l->
index->
co[i],output);
2365 printf(
"Error in storing data::Unespected End of file encountered");
2366 printf(
"after position %ld\n",count);
2375 printf(
"Error in stored data::Stored data number does not match the request");
2400 t_error(
"The bin was not allocated properly");
2403 for(i=1;i<=(l->
index)->nh;i++){
2404 for(j=1;j<=(l->
index)->
co[i];j++){
2406 printf(
"%ld ",l->
co[i][j]);
2407 if(j%maxcols==0 && j!=(l->
index)->co[i]) putchar(
'\n');
2423 long i,j,tmp=0,count=0,chksum=0;
2424 const char ascii[2]=
"a",binary[2]=
"b";
2428 t_error(
"The input file was not opened properly");
2430 t_error(
"The bin was not allocated properly");
2432 }
else if(strcmp(mode,ascii)==0){
2434 for(i=1;i<=(l->
index)->nh;i++){
2436 for(j=1;j<=(l->
index)->
co[i];j++){
2438 tmp=fscanf(input,
"%lf",&(l->
co[i][j]));
2442 printf(
"Error in stored data::Unespected End of file encountered");
2443 printf(
"after position %ld\n",count);
2454 }
else if(strcmp(mode,binary)==0){
2456 for(i=1;i<=(l->
index)->nh;i++){
2458 tmp=fread((
double *)&(l->
co[i][1]),
sizeof(
double),l->
index->
co[i],input);
2462 printf(
"Error in stored data::Unexpected End of File encountered");
2463 printf(
" after position %ld\n",count);
2471 t_error(
"Error in reading mode::Mode not supported");
2475 printf(
"Error in stored data::Stored data number does not match the request");
2491 long i,j,tmp=0,chksum=0;
2496 t_error(
"The output file was not opened properly");
2498 t_error(
"The bin was not allocated properly");
2501 for(i=1;i<=(l->
index)->nh;i++){
2503 for(j=1;j<=(l->
index)->
co[i];j++){
2504 tmp=fprintf(output,
"%lf ",l->
co[i][j]);
2506 printf(
"Error in storing data::Unespected End of file encountered");
2509 if(j%maxcols==0 && j!=(l->
index)->co[i]) putc(
'\n',output);
2530 long i,tmp=0,count=0,chksum=0;
2535 t_error(
"The output file was not opened properly");
2537 t_error(
"The bin was not allocated properly");
2540 for(i=1;i<=(l->
index)->nh;i++){
2542 tmp=fwrite((
double *)&(l->
co[i][1]),
sizeof(
double),l->
index->
co[i],output);
2546 printf(
"Error in storing data::Unespected End of file encountered");
2547 printf(
"after position %ld\n",count);
2556 printf(
"Error in stored data::Stored data number does not match the request");
2581 t_error(
"The bin was not allocated properly");
2584 for(i=1;i<=(l->
index)->nh;i++){
2585 for(j=1;j<=(l->
index)->
co[i];j++){
2587 printf(
"%f ",l->
co[i][j]);
2588 if(j%maxcols==0 && j!=(l->
index)->co[i]) putchar(
'\n');
2608 long count=0, ll=0, df;
2612 long int buffer_index=0, buffer_size=0;
2626 buffer=(
char *)malloc((buffer_size+1)*
sizeof(char));
2630 t_error(
"Cannot allocate the buffer");
2636 buffer[buffer_size]=
'\0';
2639 if(buffer_index < buffer_size){
2641 buffer[buffer_index]=fgetc(inputfile);
2643 if(isspace(buffer[buffer_index])){
2670 if(buffer_size==maxbuffersize){
2672 printf(
"Warning::A very long string has exceeded the maximum buffer size\n");
2682 printf (
"Warning::missing part of string %ld and other %ld strings\n",count,df);
2688 buffer[buffer_size-1]=getc(inputfile);
2690 }
while(buffer[buffer_size-1]!=EOF);
2693 buffer[buffer_size-1]=
' ';
2702 buffer_size=maxbuffersize;
2704 buffer=(
char *)realloc(buffer,(buffer_size+1)*
sizeof(char));
2708 t_error(
"Cannot expand the buffer");
2712 buffer[buffer_size]=
'\0';
2718 buffer=(
char *)realloc(buffer,(buffer_size+1)*
sizeof(char));
2722 t_error(
"Cannot expand the buffer");
2726 buffer[buffer_size]=
'\0';
2734 }
while(count < length && buffer[buffer_index-1]!=EOF);
2736 if(buffer[buffer_index-1]==EOF){
2738 t_error(
"Unespected End of file");
2765 long i,j,tmp=0,chksum=0;
2769 t_error(
"The output file was not opened properly");
2771 t_error(
"The bin was not allocated properly");
2774 for(i=1;i<=(l->
index)->nh;i++){
2776 for(j=1;j<=(l->
index)->
co[i];j++){
2777 tmp=fprintf(output,
"%c",l->
co[i][j]);
2779 printf(
"Error in storing data::Unespected End of file encountered");
2782 if(j%maxcols==0 && j!=(l->
index)->co[i]-1) putc(
'\n',output);
2811 t_error(
"The bin was not allocated properly");
2814 for(i=1;i<=(l->
index)->nh;i++){
2816 for(j=1;j<(l->
index)->
co[i];j++){
2818 printf(
"%c",l->
co[i][j]);
2819 if(j%maxcols==0 && j!=(l->
index)->co[i]-1) putchar(
'\n');
2842 t_error(
"The bin was not allocated properly");
2844 }
else if(buffer==NULL){
2845 t_error(
"The buffer is NULL");
2847 for(i=1;i<=(l->
index)->nh;i++){
2848 for(j=1;j<(l->
index)->
co[i];j++){
2849 if(buffer[count]!=
'\0'){
2850 l->
co[i][j]=buffer[count];
2853 t_error(
"Unespected end of buffer::The buffer has been scanned completely ");
2856 if(isspace(buffer[count])) {
2892 for(i=1;i<=A->
nh; i++){
2894 if(A->
co[i]!=B->
co[i]){
2917 whitespace=fgetc(inputfile);
2918 if(whitespace==EOF) printf(
"\nWarning::Unespected End of File encountered\n");
2919 }
while(isspace(whitespace) || iscntrl(whitespace));
2921 ctmp=ungetc(whitespace,inputfile);
2941 whitespace=fgetc(inputfile);
2943 if(whitespace==EOF)
break;
2945 }
while(isspace(whitespace));
2947 ctmp=ungetc(whitespace,inputfile);
2964 long buffer_index=0, pos;
2967 pos=ftell(inputfile);
2969 while(buffer_index<3){
2971 buffer[buffer_index]=fgetc(inputfile);
2976 buffer[buffer_index]=
'\0';
2979 if(strcmp(buffer,
"/**")!=0) {
2980 fseek(inputfile,pos,SEEK_SET);
2981 return buffer_index=0;
2985 return buffer_index;
2996 char buffer[64*FILENAME_MAX],*bf,*pathfile=
"$WorkingPath";
3001 istream=fopen(pathfile,
"r");
3007 bf = (
char *) malloc(
sizeof(
char));
3009 bf = (
char *)realloc(bf,(i+1)*
sizeof(char));
3011 bf[i]=fgetc(istream);
3012 if(bf[i]==10 || bf[i]==-1){
3021 printf(
"ENTER THE WORKING DIRECTORY PATH:\n");
3023 len=64*FILENAME_MAX;
3025 if(len > (64*FILENAME_MAX)){
3026 t_error(
"Maximum path length exceeded");
3028 bf=(
char *)malloc(len*
sizeof(
char));
3048 len+=strlen(second)+2;
3049 string=(
char *)malloc(len*
sizeof(
char));
3050 string=strcpy(
string,first);
3051 string=strcat(
string,second);
3062 char *name=
"\0",*fullname=
"\0",*pathfile=
"\0",*S=
".inpts";
3072 istream=fopen(pathfile,
"r");
3080 name=(
char *)malloc(FILENAME_MAX*
sizeof(
char));
3081 if(!name)
t_error(
"There was no allocation space");
3096 name=(
char *)malloc(FILENAME_MAX*
sizeof(
char));
3097 if(!name)
t_error(
"There was no allocation space");
3103 }
else if(IO_FILES_COUNTER < strg->index->nh){
3108 name=(
char *)malloc(FILENAME_MAX*
sizeof(
char));
3109 if(!name)
t_error(
"There was no allocation space");
3115 printf(
"%s\n",fullname);
3116 if(sign==1) free(name);
3130 char *pathfile=
"\0",*S=
".inpts";
3140 istream=fopen(pathfile,
"r");
3154 scanf(
" %lf",¶meter);
3156 }
else if(IO_PARMS_COUNTER < s->nh){
3160 scanf(
" %lf",¶meter);
3162 printf(
"%f\n",parameter);
3174 char *name=
"\0",*pathfile=
"\0",*S=
".inpts";
3182 istream=fopen(pathfile,
"r");
3190 name=(
char *)malloc(FILENAME_MAX*
sizeof(
char));
3191 if(!name)
t_error(
"There was no allocation space");
3205 name=(
char *)malloc(FILENAME_MAX*
sizeof(
char));
3206 if(!name)
t_error(
"There was no allocation space");
3212 }
else if(IO_FILES_COUNTER < s->index->nh){
3216 name=(
char *)malloc(FILENAME_MAX*
sizeof(
char));
3217 if(!name)
t_error(
"There was no allocation space");
3223 printf(
"%s\n",name);
3240 if(pos==-1)
t_error(
"string not found");
3244 t_error(
"File does not exist");
3247 for(i=1;i<=strg->
index->
nh;i++){
3265 if(pos==-1)
t_error(
"string not found");
3269 t_error(
"File does not exist");
3285 static char *label=NULL;
3286 long i=0,label_size=0;
3291 label=(
char *)malloc(label_size*
sizeof(
char));
3295 t_error(
"Cannot allocate the label");
3305 if(i< label_size-1) {
3308 label[i]=fgetc(inputfile);
3312 t_error(
"Unespected End Of File");
3323 printf(
"\nWarning:: the name of the stored data exceeded the LABELSIZE\n");
3325 printf(
"Warning:: flushing the rest of the name\n");
3329 ch=fgetc(inputfile);
3331 }
while(ch!=ocurl && ch!=EOF);
3335 t_error(
"Unespected End Of File");
3345 label=(
char *)realloc(label,label_size*
sizeof(
char));
3349 t_error(
"Cannot expand the label");
3360 label=(
char *)realloc(label,label_size*
sizeof(
char));
3364 t_error(
"Cannot expand the label");
3371 }
while(label[i-1]!=EOF && label[i-1]!=ocurl);
3373 ungetc(label[i-1],inputfile);
3374 label[i]=label[i-1]=
'\0';
3377 while(isspace(label[i])){
3408 static char *label=NULL,ch;
3410 long i=0,label_size=0;
3415 label=(
char *)malloc(label_size*
sizeof(
char));
3419 t_error(
"Cannot allocate the label");
3429 if(i< label_size-1) {
3431 label[i]=fgetc(inputfile);
3435 t_error(
"Unespected End Of File");
3446 printf(
"\nWarning:: the name of the stored data exceeded the LABELSIZE\n");
3448 printf(
"Warning:: flushing the rest of the name\n");
3452 ch=fgetc(inputfile);
3454 }
while(ch!=EOF && ch!=separator);
3458 t_error(
"Unespected End Of File");
3469 label=(
char *)realloc(label,label_size*
sizeof(
char));
3473 t_error(
"Cannot expand the label");
3484 label=(
char *)realloc(label,label_size*
sizeof(
char));
3488 t_error(
"Cannot expand the label");
3497 }
while(label[i-1]!=EOF && label[i-1]!=separator);
3534 pos=ftell(inputfile);
3540 for(i=0;i<=len-1;i++){
3542 keyword[i]=fgetc(inputfile);
3549 if(strcmp(token,keyword)!=0){
3551 fseek(inputfile,pos,SEEK_SET);
3585 long int buffer_index=0, buffer_size=0;
3591 if(inputfile==NULL){
3595 t_error(
"You tried to read from a closed file ");
3609 buffer=(
char *)malloc(buffer_size*
sizeof(
char));
3617 t_error(
"Cannot allocate the buffer");
3627 buffer[buffer_size-1]=
'\0';
3628 buffer[0]=buffer[1]=buffer[2]=
'\0';
3635 buffer_index=
iscomment(buffer,inputfile);
3643 buffer[0]=
'/'; buffer[1]=
'*'; buffer[2]=
'*';
3655 if (buffer_index==0){
3657 printf(
"\nWarning:: no comment found\n");
3670 if(buffer_index < buffer_size-2){
3676 buffer[buffer_index]=fgetc(inputfile);
3680 if(buffer[buffer_index]==
'*'){
3688 buffer[buffer_index]=fgetc(inputfile);
3692 if(buffer[buffer_index]==
'/'){
3700 buffer[buffer_index]=
'\0';
3736 if(buffer_size==maxbuffersize){
3742 printf(
"\nWarning::A very long comment has exceeded the maximum buffer size\n");
3746 printf(
"\nWarnin::Flushing the rest of the comment \n" );
3750 buffer[buffer_size-8]=
' ';
3754 buffer[buffer_size-7]=
'.';
3758 buffer[buffer_size-6]=
'.';
3762 buffer[buffer_size-5]=
'.';
3766 buffer[buffer_size-4]=
' ';
3776 buffer[buffer_size-3]=getc(inputfile);
3780 }
while(buffer[buffer_size-3]!=
'*');
3784 buffer[buffer_size-2]=getc(inputfile);
3788 }
while(buffer[buffer_size-2] !=
'/');
3792 if(buffer[buffer_size-2]==EOF){
3796 t_error(
"Unespected end of file: comment closed by End of file");
3816 buffer_size=maxbuffersize;
3820 buffer=(
char *)realloc(buffer,buffer_size*
sizeof(
char));
3828 t_error(
"Cannot expand the buffer");
3836 buffer[buffer_size-1]=
'\0';
3848 buffer=(
char *)realloc(buffer,buffer_size*
sizeof(
char));
3856 t_error(
"Cannot expand the buffer");
3864 buffer[buffer_size-1]=
'\0';
3874 }
while( buffer[buffer_index-1]!=EOF );
3880 if(buffer[buffer_index-1]==EOF ){
3884 t_error(
"Unespected end of file: comment closed by End of file");
3894 if(print) printf(
"\n%s\n",buffer);
3902 return buffer_index;
3934 long int buffer_index=0, buffer_size=0;
3940 if(inputfile==NULL){
3944 t_error(
"You tried to read from a closed file ");
3958 buffer=(
char *)malloc(buffer_size*
sizeof(
char));
3966 t_error(
"Cannot allocate the buffer");
3976 buffer[buffer_size-1]=
'\0';
3984 buffer_index=
iscomment(buffer,inputfile);
3992 buffer[0]=
'/'; buffer[1]=
'*'; buffer[2]=
'*';
4014 if(buffer_index < buffer_size-2){
4020 buffer[buffer_index]=fgetc(inputfile);
4024 if(buffer[buffer_index]==
'*'){
4032 buffer[buffer_index]=fgetc(inputfile);
4036 if(buffer[buffer_index]==
'/'){
4044 buffer[buffer_index]=
'\0';
4080 if(buffer_size==maxbuffersize){
4086 printf(
"\nWarning::A very long comment has exceeded the maximum buffer size\n");
4090 printf(
"\nWarnin::Flushing the rest of the comment \n" );
4094 buffer[buffer_size-8]=
' ';
4098 buffer[buffer_size-7]=
'.';
4102 buffer[buffer_size-6]=
'.';
4106 buffer[buffer_size-5]=
'.';
4110 buffer[buffer_size-4]=
' ';
4120 buffer[buffer_size-3]=getc(inputfile);
4124 }
while(buffer[buffer_size-3]!=
'*');
4128 buffer[buffer_size-2]=getc(inputfile);
4132 }
while(buffer[buffer_size-2] !=
'/');
4136 if(buffer[buffer_size-2]==EOF){
4140 t_error(
"Unespected end of file: comment closed by End of file");
4160 buffer_size=maxbuffersize;
4164 buffer=(
char *)realloc(buffer,buffer_size*
sizeof(
char));
4172 t_error(
"Cannot expand the buffer");
4180 buffer[buffer_size-1]=
'\0';
4192 buffer=(
char *)realloc(buffer,buffer_size*
sizeof(
char));
4200 t_error(
"Cannot expand the buffer");
4208 buffer[buffer_size-1]=
'\0';
4218 }
while( buffer[buffer_index-1]!=EOF );
4224 if(buffer[buffer_index-1]==EOF ){
4228 t_error(
"Unespected end of file: comment closed by End of file");
4268 long int buffer_index=0, buffer_size=0,h;
4271 printf(
"\nWarning::BUFFERINCREMENT is larger than MAXBUFFERSIZE\n");
4272 buffer_size=maxbuffersize;
4278 bffr=(
char *)malloc(buffer_size*
sizeof(
char));
4281 t_error(
"Cannot allocate the buffer");
4286 bffr[buffer_size-1]=
'\0';
4298 while(!(bffr[0]==
'/' && bffr[1]==
'*' && bffr[2]==
'*')){
4302 printf(
"TO START A COMMENT DIGIT '/**' OTHERWISE 'N' \n");
4323 }
while(bffr[0]!=
'/');
4342 if(buffer_index < buffer_size-1){
4344 bffr[buffer_index]=getchar();
4352 if(buffer_size==maxbuffersize){
4354 printf(
"\nWarning::A very long comment has exceeded the maximum buffer size\n");
4356 printf(
"Warning::Closing the comment\n");
4358 bffr[buffer_index-2]=
'\n';
4360 bffr[buffer_index-3]=
' ';
4362 bffr[buffer_index-4]=
'.';
4364 bffr[buffer_index-5]=
'.';
4366 bffr[buffer_index-6]=
'.';
4368 bffr[buffer_index-7]=
' ';
4376 buffer_size=maxbuffersize;
4378 bffr=(
char *)realloc(bffr,buffer_size*
sizeof(
char));
4382 t_error(
"Cannot expand the buffer");
4390 bffr[buffer_size-1]=
'\0';
4400 bffr=(
char *)realloc(bffr,buffer_size*
sizeof(
char));
4404 t_error(
"Cannot expand the buffer");
4412 bffr[buffer_size-1]=
'\0';
4422 }
while( !(bffr[buffer_index-1]==
'\n' && bffr[buffer_index-2]==
'/' && bffr[buffer_index-3]==
'*') );
4426 bffr[buffer_index-3]=
'\0';
4446 char buffer[FILENAME_MAX],curl,ocurl=
'{',ccurl=
'}';
4447 long buffer_index=0,pos=0;
4450 if(inputfile==NULL){
4451 t_error(
"You tried to read from a closed file ");
4458 pos=ftell(inputfile);
4464 curl=fgetc(inputfile);
4467 t_error(
"A non expected character found");
4470 fscanf(inputfile,
"%ld",&blocks);
4474 buffer[buffer_index]=fgetc(inputfile);
4477 if(buffer[buffer_index-1]==
','){
4480 buffer[buffer_index]=fgetc(inputfile);
4482 }
while(buffer_index < FILENAME_MAX && buffer[buffer_index-1]!=ccurl);
4485 if(buffer[buffer_index-1]!=ccurl){
4486 t_error(
"Missing closing curl");
4488 buffer[buffer_index-1]=
'\0';
4489 if(print) printf(
"\nTHIS FILE TYPE %s\n\n",buffer);
4492 printf(
"No blocks specified. One asci block assumed. \n");
4530 t_error(
"This header was not allocated");
4544 pos=ftell(inputfile);
4546 fscanf(inputfile,
"%ld %c",&(h->
number),&semicolon);
4553 fseek(inputfile,pos,SEEK_SET);
4559 pos=ftell(inputfile);
4583 ch=fgetc(inputfile);
4594 ch=fgetc(inputfile);
4600 }
while(!isspace(ch) && ch!=ocurl);
4642 }
while(strcmp(T_KEYWORDS.
gender[j],keyword)!=0 && j <=len);
4686 pos=ftell(inputfile);
4694 ch=fgetc(inputfile);
4704 ch=fgetc(inputfile);
4710 }
while(!isspace(ch) && ch!=ocurl );
4750 }
while(strcmp(T_KEYWORDS.
type[j],keyword)!=0 && j <=len);
4798 pos=ftell(inputfile);
4806 ch=fgetc(inputfile);
4820 ch=fgetc(inputfile);
4828 }
while(!isspace(ch) && ch!=ocurl);
4869 }
while(strcmp(T_KEYWORDS.
category[j],keyword)!=0 && j <=len);
4909 fseek(inputfile,pos,SEEK_SET);
4917 ungetc(ch,inputfile);
4955 if(a==NULL || b==NULL){
4959 t_error(
"At least one of the headers was not allocated");
5041 const char ocurl=
'{', ccurl=
'}';
5047 long buffer_size=0,i, jj;
5057 if(inputfile==NULL){
5061 t_error(
"You tried to read from a closed file ");
5087 printf(
"\nWarning::the data being read are not stored as an array of long\n");
5094 curl=fgetc(inputfile);
5102 t_error(
"A non expected character found");
5122 numbers=(
long *)malloc(buffer_size*
sizeof(
long));
5130 t_error(
"Cannot allocate the buffer");
5146 if(i< buffer_size) {
5152 fscanf(inputfile,
"%ld ",&numbers[i]);
5156 ch=fgetc(inputfile);
5164 t_error(
"Unespected End Of File");
5186 printf(
" A very long array has exceeded the maximum buffer size\n");
5190 printf(
" Flushing the rest of the array \n" );
5202 }
while(ch!=ccurl && ch!=EOF);
5212 t_error(
"Unespected end of file: comment closed by End of file");
5236 numbers=(
long *)realloc(numbers,buffer_size*
sizeof(
long));
5244 t_error(
"Cannot expand the buffer");
5252 numbers[buffer_size-1]=0;
5264 numbers=(
long *)realloc(numbers,buffer_size*
sizeof(
long));
5272 t_error(
"Cannot expand the buffer");
5280 numbers[buffer_size-1]=0;
5292 }
while(ch !=EOF && ch!=ccurl );
5302 t_error(
"Empty array body was encountered");
5316 for(jj=0;jj<i;jj++){
5318 vec->
co[jj+1]=numbers[jj];
5362 const char ocurl=
'{', ccurl=
'}';
5366 long buffer_size=0,i, jj;
5377 if(inputfile==NULL){
5381 t_error(
"You tried to read from a closed file ");
5409 printf(
"\nWarning::the data being read are not stored as an array of float\n");
5420 curl=fgetc(inputfile);
5428 t_error(
"A non expected character found");
5448 numbers=(
float *)malloc(buffer_size*
sizeof(
float));
5456 t_error(
"Cannot allocate the buffer");
5472 if(i< buffer_size) {
5478 fscanf(inputfile,
"%f ",&numbers[i]);
5482 ch=fgetc(inputfile);
5489 t_error(
"Unespected End Of File");
5511 printf(
" A very long array has exceeded the maximum buffer size\n");
5515 printf(
" Flushing the rest of the array \n" );
5527 }
while(ch!=ccurl && ch!=EOF);
5537 t_error(
"Unespected end of file: comment closed by End of file");
5561 numbers=(
float *)realloc(numbers,buffer_size*
sizeof(
float));
5569 t_error(
"Cannot expand the buffer");
5577 numbers[buffer_size-1]=0;
5589 numbers=(
float *)realloc(numbers,buffer_size*
sizeof(
float));
5597 t_error(
"Cannot expand the buffer");
5605 numbers[buffer_size-1]=0;
5617 }
while(ch !=EOF && ch!=ccurl );
5627 t_error(
"Empty array body was encountered");
5641 for(jj=0;jj<i;jj++){
5643 vec->
co[jj+1]=numbers[jj];
5685 const char ocurl=
'{', ccurl=
'}';
5689 long buffer_size=0,i, jj;
5699 if(inputfile==NULL){
5703 t_error(
"You tried to read from a closed file ");
5729 printf(
"\nWarning::the data being read are not stored as an array of double\n");
5740 curl=fgetc(inputfile);
5748 t_error(
"A non expected character found");
5768 numbers=(
double *)malloc(buffer_size*
sizeof(
double));
5776 t_error(
"Cannot allocate the buffer");
5792 if(i< buffer_size) {
5798 fscanf(inputfile,
"%lf ",&numbers[i]);
5802 ch=fgetc(inputfile);
5810 t_error(
"Unespected End Of File");
5832 printf(
" A very long array has exceeded the maximum buffer size\n");
5836 printf(
" Flushing the rest of the array \n" );
5848 }
while(ch!=ccurl && ch!=EOF);
5858 t_error(
"Unespected end of file: comment closed by End of file");
5882 numbers=(
double *)realloc(numbers,buffer_size*
sizeof(
double));
5890 t_error(
"Cannot expand the buffer");
5898 numbers[buffer_size-1]=0;
5910 numbers=(
double *)realloc(numbers,buffer_size*
sizeof(
double));
5918 t_error(
"Cannot expand the buffer");
5926 numbers[buffer_size-1]=0;
5938 }
while(ch !=EOF && ch!=ccurl );
5948 t_error(
"Empty array body was encountered");
5962 for(jj=0;jj<i;jj++){
5964 vec->
co[jj+1]=numbers[jj];
5993 const char ocurl=
'{', ccurl=
'}';
5995 long buffer_size=0,i,jj;
6000 if(inputfile==NULL){
6001 t_error(
"You tried to read from a closed file ");
6011 printf(
"\nWarning::the data being read are not stored as an array of short\n");
6015 curl=fgetc(inputfile);
6018 t_error(
"A non expected character found");
6023 numbers=(
short *)malloc(buffer_size*
sizeof(
short));
6025 t_error(
"Cannot allocate the buffer");
6031 if(i< buffer_size) {
6032 fscanf(inputfile,
"%hd",&numbers[i]);
6033 ch=fgetc(inputfile);
6035 t_error(
"Unespected End Of File");
6040 printf(
" A very long array has exceeded the maximum buffer size\n");
6041 printf(
" Flushing the rest of the array \n" );
6044 }
while(ch!=ccurl && ch!=EOF);
6046 t_error(
"Unespected end of file: comment closed by End of file");
6052 numbers=(
short *)realloc(numbers,buffer_size*
sizeof(
short));
6054 t_error(
"Cannot expand the buffer");
6056 numbers[buffer_size-1]=0;
6059 numbers=(
short *)realloc(numbers,buffer_size*
sizeof(
short));
6061 t_error(
"Cannot expand the buffer");
6063 numbers[buffer_size-1]=0;
6066 }
while(ch !=EOF && ch!=ccurl );
6069 t_error(
"Empty array body was encountered");
6076 for(jj=0;jj<i;jj++){
6077 vec->
co[jj+1]=numbers[jj];
6106 const char ocurl=
'{', ccurl=
'}';
6110 long strings_size=0,char_counter=0,strings_counter=0;
6112 long numbers_size=0;
6116 long *numbers,iu,ju,sum=0;
6129 if(inputfile==NULL){
6133 t_error(
"You tried to read from a closed file ");
6158 printf(
"\nWarning::the data being read are not stored as an array of strings\n");
6169 curl=fgetc(inputfile);
6177 t_error(
"A non expected character found");
6199 strings=(
char *)malloc((strings_size+1)*
sizeof(char));
6201 numbers=(
long *)malloc(numbers_size*
sizeof(
long));
6205 if(numbers==NULL || strings==NULL){
6209 t_error(
"Cannot allocate the buffers");
6221 strings[strings_size-1]=
'\0';
6229 if(char_counter< strings_size-1 && strings_counter < numbers_size-1) {
6235 strings[char_counter]=fgetc(inputfile);
6237 if(strings[char_counter]==EOF){
6241 t_error(
"Unespected End Of File");
6245 }
else if (strings[char_counter]==
','){
6249 while(strings[char_counter-1]==
' '){
6257 numbers[strings_counter]=char_counter;
6281 }
else if(strings_counter >= numbers_size-1){
6287 numbers=(
long *)realloc(numbers,numbers_size*
sizeof(
long));
6293 t_error(
"Cannot expand the buffer");
6303 printf(
"\nWarning::A very long array has exceeded the maximum buffer size\n");
6307 printf(
"Warning::Flushing the rest of the array \n" );
6319 }
while(ch!=ccurl && ch!=EOF);
6329 t_error(
"Unespected end of file: comment closed by End of file");
6337 strings[char_counter-1]=ch;
6357 strings=(
char *)realloc(strings,(strings_size+1)*
sizeof(char));
6365 t_error(
"Cannot expand the buffer");
6387 strings=(
char *)realloc(strings,(strings_size+1)*
sizeof(char));
6395 t_error(
"Cannot expand the buffer");
6403 strings[strings_size-1]=
'\0';
6409 }
while(strings[char_counter-1] !=EOF && strings[char_counter-1]!=ccurl );
6423 if(char_counter==0){
6428 printf(
"\nWarning :: Empty array body was encountered\n");
6432 }
else if( strings[char_counter]==ccurl){
6436 numbers[strings_counter]=char_counter;
6438 if(char_counter >1){
6439 while(char_counter >0 && isspace(strings[char_counter-1])){
6443 strings[char_counter]=
'\0';
6451 t_error(
"Unespected End of File Encountered");
6467 vec->
co[1]=numbers[0]+1;
6471 for(iu=1;iu<=strings_counter;iu++){
6473 vec->
co[iu+1]=numbers[iu]-numbers[iu-1]+1;
6495 for(iu=1;iu<=(ST->
index)->nh;iu++){
6501 for(ju=1;ju< (ST->
index)->
co[iu];ju++){
6505 ST->
co[iu][ju]=strings[sum];
6515 ST->
co[iu][ju]=
'\0';
6551 const char ocurl=
'{', ccurl=
'}';
6555 if(inputfile==NULL){
6556 t_error(
"You tried to read from a closed file ");
6562 t_error(
"This vector was not properly allocated");
6573 printf(
"\nWarning::the data being read cannot be stored as an array of long\n");
6577 curl=fgetc(inputfile);
6579 t_error(
"A non expected character found");
6581 for(i=1;i<=vec->
nh;i++){
6583 ch=fscanf(inputfile,
" %ld %c",&(vec->
co[i]),&curl);
6589 t_error(
"Closing bracket not found");
6592 t_error(
"Unespected End of file");
6605 const char ocurl=
'{', ccurl=
'}';
6609 if(inputfile==NULL){
6610 t_error(
"You tried to read from a closed file ");
6614 t_error(
"This vector was not properly allocated");
6623 printf(
"\nWarning::the data being read cannot be stored as an array of long\n");
6626 curl=fgetc(inputfile);
6628 t_error(
"A non expected character found");
6630 for(i=1;i<=vec->
nh;i++){
6631 ch=fscanf(inputfile,
" %f %c",&(vec->
co[i]),&curl);
6634 t_error(
"Closing bracket not found");
6636 t_error(
"Unespected End of file");
6650 if(inputfile==NULL){
6651 t_error(
"You tried to read from a closed file ");
6659 printf(
"\nWarning::the data being read are not stored as a matrix of float\n");
6665 t_error(
"It is not permitted to have more than one external file open");
6671 printf(
"\nWarning::The external file could open in a wrong position\n");
6683 t_error(
"External data file does not match the request ");
6717 const char ocurl=
'{', ccurl=
'}';
6721 if(inputfile==NULL){
6722 t_error(
"You tried to read from a closed file ");
6728 t_error(
"This vector was not properly allocated");
6739 printf(
"\nWarning::the data being read are not stored as an array of char\n");
6742 curl=fgetc(inputfile);
6744 t_error(
"A non expected character found");
6746 for(i=1;i<=vec->
nh;i++){
6748 ch=fscanf(inputfile,
" %c %c",&(vec->
co[i]),&curl);
6754 t_error(
"Closing bracket not found");
6757 t_error(
"Unespected End of file");
6787 const char ocurl=
'{', ccurl=
'}';
6795 if(inputfile==NULL){
6799 t_error(
"You tried to read from a closed file ");
6807 t_error(
"You addresses a null header ");
6833 curl=fgetc(inputfile);
6841 t_error(
"A non expected character found");
6849 fscanf(inputfile,
" %ld ",&(h->
dimensions[1]));
6861 curl=fgetc(inputfile);
6867 t_error(
"Closing delimiter not found");
6903 const char ocurl=
'{', ccurl=
'}';
6917 if(inputfile==NULL){
6921 t_error(
"You tried to read from a closed file ");
6929 t_error(
"You addressed a null header ");
6944 curl=fgetc(inputfile);
6952 t_error(
"A non expected character found");
6970 curl=fgetc(inputfile);
6976 t_error(
"Closing delimiter not found");
7008 if(inputfile==NULL){
7012 t_error(
"You tried to read from a closed file ");
7029 if(h.
category!=2 || h.
type!=1) printf(
"\nWarning::the data being read are not stored as a vector of char\n");
7046 t_error(
"It is not permitted to have more than one external file open");
7071 printf(
"\nWarning::The external file could open in a wrong position\n");
7114 t_error(
"External data file does not match the request ");
7229 if(inputfile==NULL){
7233 t_error(
"You tried to read from a closed file ");
7250 if(h.
category!=2 || h.
type!=2) printf(
"\nWarning::the data being read are not stored as an vector of short\n");
7269 t_error(
"It is not permitted to have more than one external file open");
7295 printf(
"\nWarning::The external file could open in a wrong position\n");
7339 t_error(
"External data file does not match the request ");
7457 if(inputfile==NULL){
7461 t_error(
"You tried to read from a closed file ");
7473 printf(
"Dimensions: %ld \n",h.
dimensions[1]);
7477 if(h.
category!=2 || h.
type!=3) printf(
"\nWarning::the data being read are not stored as a vector of int\n");
7496 t_error(
"It is not permitted to have more than one external file open");
7522 printf(
"\nWarning::The external file could open in a wrong position\n");
7565 t_error(
"External data file does not match the request ");
7683 if(inputfile==NULL){
7687 t_error(
"You tried to read from a closed file ");
7711 printf(
"Dimensions: %ld \n",h.
dimensions[1]);
7716 printf(
"\nWarning::the data being read are not stored as a vector of long\n");
7735 t_error(
"It is not permitted to have more than one external file open");
7761 printf(
"\nWarning::The external file could open in a wrong position\n");
7804 t_error(
"External data file does not match the request ");
7924 if(inputfile==NULL){
7928 t_error(
"You tried to read from a closed file ");
7941 printf(
"Dimensions: %ld \n",h.
dimensions[1]);
7946 printf(
"\nWarning::the data being read are not stored as a vector of float\n");
7965 t_error(
"It is not permitted to have more than one external file open");
7991 printf(
"\nWarning::The external file could open in a wrong position\n");
8034 t_error(
"External data file does not match the request ");
8156 if(inputfile==NULL){
8160 t_error(
"You tried to read from a closed file ");
8177 printf(
"\nWarning::the data being read are not stored as a vector of double\n");
8196 t_error(
"It is not permitted to have more than one external file open");
8222 printf(
"\nWarning::The external file could open in a wrong position\n");
8265 t_error(
"External data file does not match the request ");
8389 if(inputfile==NULL){
8393 t_error(
"You tried to read from a closed file ");
8411 printf(
"\nWarning::the data being read are not stored as a matrix of short\n");
8430 t_error(
"It is not permitted to have more than one external file open");
8458 printf(
"\nWarning::The external file could open in a wrong position\n");
8503 t_error(
"External data file does not match the request ");
8633 if(inputfile==NULL){
8637 t_error(
"You tried to read from a closed file ");
8656 printf(
"\nWarning::the data being read are not stored as a matrix of int\n");
8676 t_error(
"It is not permitted to have more than one external file open");
8704 printf(
"\nWarning::The external file could open in a wrong position\n");
8749 t_error(
"External data file does not match the request ");
8871 if(inputfile==NULL){
8875 t_error(
"You tried to read from a closed file ");
8893 printf(
"\nWarning::the data being read are not stored as a matrix of long\n");
8913 t_error(
"It is not permitted to have more than one external file open");
8935 printf(
"\nWarning::The external file could open in a wrong position\n");
8983 t_error(
"External data file does not match the request ");
9102 if(inputfile==NULL){
9103 t_error(
"You tried to read from a closed file ");
9111 printf(
"\nWarning::the data being read are not stored as a matrix of float\n");
9117 t_error(
"It is not permitted to have more than one external file open");
9123 printf(
"\nWarning::The external file could open in a wrong position\n");
9135 t_error(
"External data file does not match the request ");
9175 if(inputfile==NULL){
9176 t_error(
"You tried to read from a closed file ");
9185 printf(
"\nWarning::the data being read are not stored as a matrix of double\n");
9192 t_error(
"It is not permitted to have more than one external file open");
9200 printf(
"\nWarning::The external file could open in a wrong position\n");
9216 t_error(
"External data file does not match the request ");
9269 if(inputfile==NULL){
9273 t_error(
"You tried to read from a closed file ");
9301 t_error(
"It is not permitted to have more than one external file open");
9327 printf(
"\nWarning::The external file could open in a wrong position\n");
9368 t_error(
"External data file does not match the request ");
9487 if(inputfile==NULL){
9491 t_error(
"You tried to read from a closed file ");
9522 t_error(
"It is not permitted to have more than one external file open");
9548 printf(
"\nWarning::The external file could open in a wrong position\n");
9589 t_error(
"External data file does not match the request ");
9710 if(inputfile==NULL){
9714 t_error(
"You tried to read from a closed file ");
9745 t_error(
"It is not permitted to have more than one external file open");
9771 printf(
"\nWarning::The external file could open in a wrong position\n");
9813 t_error(
"External data file does not match the request ");
9935 if(inputfile==NULL){
9939 t_error(
"You tried to read from a closed file ");
9970 t_error(
"It is not permitted to have more than one external file open");
9996 printf(
"\nWarning::The external file could open in a wrong position\n");
10038 t_error(
"External data file does not match the request ");
10165 t_error(
"The vector was not allocated properly");
10167 }
else if(V->
nl > V->
nh ){
10169 t_error(
"The vector has no proper dimensions");
10175 fprintf(outputfile,
"{");
10179 for(i=V->
nl;i<V->nh;i++){
10181 fprintf(outputfile,
"%hd,",V->
co[i]);
10183 if(i%columns==0) putchar(
'\n');
10189 fprintf(outputfile,
"%hd}\n",V->
co[i]);
10233 t_error(
"The vector was not allocated properly");
10235 }
else if(V->
nl > V->
nh ){
10237 t_error(
"The vector has no proper dimensions");
10243 fprintf(outputfile,
"{");
10247 for(i=V->
nl;i<V->nh;i++){
10249 fprintf(outputfile,
"%d,",V->
co[i]);
10251 if(i%columns==0) putchar(
'\n');
10257 fprintf(outputfile,
"%d}\n",V->
co[i]);
10303 t_error(
"The vector was not allocated properly");
10305 }
else if(V->
nl > V->
nh ){
10307 t_error(
"The vector has no proper dimensions");
10313 fprintf(outputfile,
"{");
10317 for(i=V->
nl;i<V->nh;i++){
10319 fprintf(outputfile,
"%ld,",V->
co[i]);
10321 if(i%columns==0) putchar(
'\n');
10327 fprintf(outputfile,
"%ld}\n",V->
co[i]);
10371 t_error(
"The vector was not allocated properly");
10373 }
else if(V->
nl > V->
nh ){
10375 t_error(
"The vector has no proper dimensions");
10381 fprintf(outputfile,
"{");
10385 for(i=V->
nl;i<V->nh;i++){
10387 fprintf(outputfile,
"%f,",V->
co[i]);
10389 if(i%columns==0) putchar(
'\n');
10395 fprintf(outputfile,
"%f}\n",V->
co[i]);
10437 t_error(
"The vector was not allocated properly");
10439 }
else if(V->
nl > V->
nh ){
10441 t_error(
"The vector has no proper dimensions");
10447 fprintf(outputfile,
"{");
10451 for(i=V->
nl;i<V->nh;i++){
10453 fprintf(outputfile,
"%lf,",V->
co[i]);
10455 if(i%columns==0) putchar(
'\n');
10461 fprintf(outputfile,
"%lf}\n",V->
co[i]);
10505 t_error(
"The vector was not allocated properly");
10507 }
else if(V->
nl > V->
nh ){
10509 t_error(
"The vector has no proper dimensions");
10515 fprintf(outputfile,
"{");
10519 for(i=V->
nl;i<V->nh;i++){
10521 fprintf(outputfile,
"%c,",V->
co[i]);
10523 if(i%columns==0) putchar(
'\n');
10529 fprintf(outputfile,
"%c}\n",V->
co[i]);
10571 t_error(
"The vector was not allocated properly");
10577 fprintf(outputfile,
"{");
10583 fprintf(outputfile,
"%s,\n",V->
co[i]);
10589 fprintf(outputfile,
"%s}\n",V->
co[i]);
10630 printf(
"\nBlock number: %ld.\nType: %s %s %s\nName: %s\n",\
10644 printf(
"\nWarning::This header was not allocated\n");
10666 if(outputfile==NULL || H==NULL || H->
name==NULL ){
10670 t_error(
"An attempt was made to write on a not opened file or a NULL vector");
10680 fprintf(outputfile,
"%ld: %s %s %s %s ",\
10698 fprintf(outputfile,
"%s",T_KEYWORDS.
delimiter[1]);
10706 fprintf(outputfile,
"%ld,",H->
dimensions[i]);
10748 if(outputfile==NULL){
10752 t_error(
"An attempt was made towrite on a not opened file");
10756 }
else if(inputs ==NULL && creator==NULL) {
10759 fprintf(outputfile,
"%3s %21s created on %s at %s %2s \n",\
10761 "/**",
"This_is_a_turtle_file",__DATE__,__TIME__,
"*/");
10764 }
else if(inputs ==NULL) {
10767 fprintf(outputfile,
"%3s %21s created on %s at %s by %s %2s\n",\
10769 "/**",
"This_is_a_turtle_file",__DATE__,__TIME__,creator,
"*/");
10772 }
else if(creator==NULL) {
10775 fprintf(outputfile,
"%3s %21s created on %s at %s\n inputs processed: %s %2s\n",\
10777 "/**",
"This_is_a_turtle_file",__DATE__,__TIME__,inputs,
"*/");
10783 fprintf(outputfile,
"%3s %21s created on %s at %s by %s \n inputs processed :%s %s\n",\
10785 "/**",
"This_is_a_turtle_file",__DATE__,__TIME__,creator,inputs,
"*/");
10806 const char opening[5]=
"/** ",closing[4]=
" */";
10812 if(outputfile==NULL){
10816 t_error(
"An attempt was made to write on a not opened file");
10820 }
else if(comment!=NULL) {
10824 len=strlen(comment);
10830 putc(
'\n',outputfile);
10832 fprintf(outputfile,
"%s",opening);
10836 for(i=0;i<len;i++){
10844 if( comment[i]!=
'\n' && comment[i]!=
'\t'){
10846 putc(comment[i],outputfile);
10852 putc(
' ',outputfile);
10868 if(j == columns && !isspace(comment[i-1])){
10872 putc(
'-',outputfile);
10876 putc(
'\n',outputfile);
10894 if( j+2 < columns){
10896 fprintf(outputfile,closing);
10900 putc(
'\n',outputfile);
10902 fprintf(outputfile,closing);
10908 putc(
'\n',outputfile);
10924 long tmp=0,count=0;
10926 const char ascii[2]=
"a",binary[2]=
"b";
10932 t_error(
"The input file was not opened properly");
10933 }
else if (m==NULL || m->
co==NULL || (m->
isdynamic)!=1){
10934 t_error(
"The tensor was not allocated properly");
10936 t_error(
"The tensor has no proper dimensions");
10937 }
else if(strcmp(mode,ascii)==0){
10939 for(k=m->
ndl;k<=m->ndh;k++){
10940 for(i=m->
nrl;i<=m->nrh;i++){
10941 for(j=m->
ncl;j<=m->nch;j++){
10942 tmp=fscanf(input,
"%lf",&(m->
co[k][i][j]));
10946 printf(
"Error in stored data::Unexpected End of File encountered\n");
10947 printf(
" after position %ld\n",count);
10954 }
else if(strcmp(mode,binary)==0){
10955 t_error(
"Error in reading mode::Mode not yet implemented");
10957 t_error(
"Error in reading mode::Mode not supported");
10961 printf(
"Error in stored data::Stored data number does not match the request");
10982 t_error(
"The input file was not opened properly");
10983 }
else if (m==NULL || m->
co==NULL || m->
isdynamic !=1){
10984 t_error(
"The tensor was not allocated properly");
10986 t_error(
"The tensor has no proper dimensions");
10989 for(k=m->
ndl;k<=m->ndh;k++){
10990 for(i=m->
nrl;i<=m->nrh;i++){
10991 for(j=m->
ncl;j<=m->nch;j++){
10992 tmp=fprintf(output,
"%f ",m->
co[k][i][j]);
10994 printf(
"Error in storing data::Unespected End of file encountered\n");
10999 if(j%maxcols==0 && j!= m->
ncl) putc(
'\n',output);
11024 t_error(
"The matrix was not allocated properly");
11026 t_error(
"The matrix has no proper dimensions");
11029 for(k=m->
ndl;k<=m->ndh;k++){
11030 for(i=m->
nrl;i<=m->nrh;i++){
11031 for(j=m->
ncl;j<=m->nch;j++){
11032 printf(
"%f ",m->
co[k][i][j]);
11033 if(j%maxcols==0 && j!= m->
nch) putchar(
'\n');
11063 if(inputfile==NULL){
11064 t_error(
"You tried to read from a closed file ");
11075 printf(
"\nWarning::the data being read are not stored as a tensor of double\n");
11080 t_error(
"It is not permitted to have more than one external file open");
11087 printf(
"\nWarning::The external file could open in a wrong position\n");
11101 t_error(
"External data file does not match the request ");
11155 const char ocurl=
'{', ccurl=
'}';
11163 if(inputfile==NULL){
11164 t_error(
"You tried to read from a closed file ");
11165 }
else if(h==NULL){
11166 t_error(
"You addressed a null header ");
11170 curl=fgetc(inputfile);
11172 t_error(
"A non expected character found");
11178 curl=fgetc(inputfile);
11180 t_error(
"Closing delimiter not found");