[model2blk] Use scicos_block4 typedef and avoid long use instead of int.
[scilab.git] / scilab / modules / scicos / src / c / extractblklist.c
1 /*  Scicos
2 *
3 *  Copyright (C) INRIA - Alan LAYEC
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 * See the file ./license.txt
20 */
21 /*--------------------------------------------------------------------------*/
22 #include <string.h>
23 #include "machine.h" /* C2F */
24 #include "extractblklist.h"
25 #include "MlistGetFieldNumber.h"
26 #include "cvstr.h"
27 #include "MALLOC.h"
28 /*--------------------------------------------------------------------------*/
29 extern int *listentry(int *header, int i);
30 /*--------------------------------------------------------------------------*/
31 int extractblklist(int *il, scicos_block *Block, int *ierr)
32 {
33     /*
34     * error table :
35     *  ierr = 0    : no errors
36     *  ierr = -39 : allocation error
37     *  ierr = 98  : invalid field name
38     *
39     */
40
41     /* variables for scilab stack */
42     int *ilh = NULL;
43     int mh = 0, nh = 0;
44     int *ilh2 = NULL;
45     int mh2 = 0, nh2 = 0;
46     int len_str = 0;
47
48     /* local counter variables */
49     int n = 0;
50     int i = 0, j = 0;
51
52     *ierr = 0;
53
54     /* 2 - nevprt */
55     n            = MlistGetFieldNumber(il, "nevprt");
56     if (n == -1)
57     {
58         *ierr = 98;
59         return 0;
60     }
61     ilh           = (int *) (listentry(il, n));
62     mh            = ilh[1];
63     nh            = ilh[2];
64     Block->nevprt = (int) * ((double *)(&ilh[4]));
65
66     /* 3 - funpt */
67     n            = MlistGetFieldNumber(il, "funpt");
68     if (n == -1)
69     {
70         *ierr = 98;
71         return 0;
72     }
73     ilh           = (int *) (listentry(il, n));
74     mh            = ilh[1];
75     nh            = ilh[2];
76     // pointer value is stored on double values, restoring as a copy will take
77     // care of alignement issues and pointer size issues.
78     memcpy(&Block->funpt, &ilh[4], sizeof(voidg));
79
80     /* 4 - type */
81     n            = MlistGetFieldNumber(il, "type");
82     if (n == -1)
83     {
84         *ierr = 98;
85         return 0;
86     }
87     ilh           = (int *) (listentry(il, n));
88     mh            = ilh[1];
89     nh            = ilh[2];
90     Block->type   = (int) * ((double *)(&ilh[4]));
91
92     /* 5 - scsptr */
93     n            = MlistGetFieldNumber(il, "scsptr");
94     if (n == -1)
95     {
96         *ierr = 98;
97         return 0;
98     }
99     ilh           = (int *) (listentry(il, n));
100     mh            = ilh[1];
101     nh            = ilh[2];
102     Block->scsptr = (int) * ((double *)(&ilh[4]));
103
104     /* 6 - nz */
105     n            = MlistGetFieldNumber(il, "nz");
106     if (n == -1)
107     {
108         *ierr = 98;
109         return 0;
110     }
111     ilh           = (int *) (listentry(il, n));
112     mh            = ilh[1];
113     nh            = ilh[2];
114     Block->nz     = (int) * ((double *)(&ilh[4]));
115
116     /* 7 - z */
117     n            = MlistGetFieldNumber(il, "z");
118     if (n == -1)
119     {
120         *ierr = 98;
121         return 0;
122     }
123     ilh           = (int *) (listentry(il, n));
124     mh            = ilh[1];
125     nh            = ilh[2];
126     Block->z      = NULL;
127     if (mh*nh != 0)
128     {
129         if ((Block->z = (double *) MALLOC(Block->nz * sizeof(double))) == NULL)
130         {
131             *ierr = -39;
132             return 0;
133         }
134         for (j = 0; j < Block->nz; j++)
135         {
136             Block->z[j] = *((double *)(&ilh[4]) + j);
137         }
138     }
139
140     /* 8 - noz */
141     n            = MlistGetFieldNumber(il, "noz");
142     if (n == -1)
143     {
144         FREE(Block->z);
145         *ierr = 98;
146         return 0;
147     }
148     ilh           = (int *) (listentry(il, n));
149     mh            = ilh[1];
150     nh            = ilh[2];
151     Block->noz    = (int) * ((double *)(&ilh[4]));
152
153     /* 9 - ozsz */
154     n            = MlistGetFieldNumber(il, "ozsz");
155     if (n == -1)
156     {
157         FREE(Block->z);
158         *ierr = 98;
159         return 0;
160     }
161     ilh           = (int *) (listentry(il, n));
162     mh            = ilh[1];
163     nh            = ilh[2];
164     Block->ozsz   = NULL;
165     if (mh*nh != 0)
166     {
167         if ((Block->ozsz = (int *) MALLOC(2 * Block->noz * sizeof(int))) == NULL)
168         {
169             FREE(Block->z);
170             *ierr = -39;
171             return 0;
172         }
173     }
174
175     for (j = 0; j < 2 * Block->noz; j++)
176     {
177         Block->ozsz[j] = (int) * ((double *)(&ilh[4]) + j);
178     }
179
180     /* 10 - oztyp */
181     n            = MlistGetFieldNumber(il, "oztyp");
182     if (n == -1)
183     {
184         FREE(Block->z);
185         FREE(Block->ozsz);
186         *ierr = 98;
187         return 0;
188     }
189     ilh           = (int *) (listentry(il, n));
190     mh            = ilh[1];
191     nh            = ilh[2];
192     Block->oztyp  = NULL;
193     if (mh*nh != 0)
194     {
195         if ((Block->oztyp = (int *) MALLOC(Block->noz * sizeof(int))) == NULL)
196         {
197             FREE(Block->z);
198             FREE(Block->ozsz);
199             *ierr = -39;
200             return 0;
201         }
202     }
203     for (j = 0; j < Block->noz; j++)
204     {
205         Block->oztyp[j] = (int) * ((double *)(&ilh[4]) + j);
206     }
207
208     /* 11 - oz */
209     n            = MlistGetFieldNumber(il, "oz");
210     if (n == -1)
211     {
212         FREE(Block->z);
213         FREE(Block->ozsz);
214         FREE(Block->oztyp);
215         *ierr = 98;
216         return 0;
217     }
218     ilh           = (int *) (listentry(il, n));
219     mh            = ilh[1];
220     nh            = ilh[2];
221     Block->ozptr  = NULL;
222     if (Block->noz != 0)
223     {
224         if ((Block->ozptr = (void **) MALLOC(Block->noz * sizeof(void *))) == NULL)
225         {
226             FREE(Block->z);
227             FREE(Block->ozsz);
228             FREE(Block->oztyp);
229             *ierr = -39;
230             return 0;
231         }
232
233         for (i = 0; i < Block->noz; i++)
234         {
235             ilh2 = (int *) (listentry(ilh, i + 1));
236             mh2  = ilh2[1];
237             nh2  = ilh2[2];
238             Block->ozptr[i] = NULL;
239             switch (Block->oztyp[i])
240             {
241                 case 10  :
242                     if ((Block->ozptr[i] = (double *) MALLOC(mh2 * nh2 * sizeof(double))) == NULL)
243                     {
244                         FREE(Block->z);
245                         FREE(Block->ozsz);
246                         FREE(Block->oztyp);
247                         for (j = 0; j < i; j++)
248                         {
249                             FREE(Block->ozptr[j]);
250                         }
251                         *ierr = -39;
252                         return 0;
253                     }
254                     memcpy((double *)Block->ozptr[i], \
255                            (double *)(&ilh2[4]), \
256                            mh2 * nh2 * sizeof(double));
257                     break;
258
259                 case 11  :
260                     if ((Block->ozptr[i] = (double *) MALLOC(2 * mh2 * nh2 * sizeof(double))) == NULL)
261                     {
262                         FREE(Block->z);
263                         FREE(Block->ozsz);
264                         FREE(Block->oztyp);
265                         for (j = 0; j < i; j++)
266                         {
267                             FREE(Block->ozptr[j]);
268                         }
269                         *ierr = -39;
270                         return 0;
271                     }
272                     memcpy((double *)Block->ozptr[i], \
273                            (double *)(&ilh2[4]), \
274                            2 * mh2 * nh2 * sizeof(double));
275                     break;
276
277                 case 84  :
278                     if ((Block->ozptr[i] = (SCSINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSINT32_COP))) == NULL)
279                     {
280                         FREE(Block->z);
281                         FREE(Block->ozsz);
282                         FREE(Block->oztyp);
283                         for (j = 0; j < i; j++)
284                         {
285                             FREE(Block->ozptr[j]);
286                         }
287                         *ierr = -39;
288                         return 0;
289                     }
290                     memcpy((SCSINT32_COP *)Block->ozptr[i], \
291                            (SCSINT32_COP *)(&ilh2[4]), \
292                            mh2 * nh2 * sizeof(SCSINT32_COP));
293                     break;
294
295                 case 82  :
296                     if ((Block->ozptr[i] = (short *) MALLOC(mh2 * nh2 * sizeof(short))) == NULL)
297                     {
298                         FREE(Block->z);
299                         FREE(Block->ozsz);
300                         FREE(Block->oztyp);
301                         for (j = 0; j < i; j++)
302                         {
303                             FREE(Block->ozptr[j]);
304                         }
305                         *ierr = -39;
306                         return 0;
307                     }
308                     memcpy((short *)Block->ozptr[i], \
309                            (short *)(&ilh2[4]), \
310                            mh2 * nh2 * sizeof(short));
311                     break;
312
313                 case 81  :
314                     if ((Block->ozptr[i] = (char *) MALLOC(mh2 * nh2 * sizeof(char))) == NULL)
315                     {
316                         FREE(Block->z);
317                         FREE(Block->ozsz);
318                         FREE(Block->oztyp);
319                         for (j = 0; j < i; j++)
320                         {
321                             FREE(Block->ozptr[j]);
322                         }
323                         *ierr = -39;
324                         return 0;
325                     }
326                     memcpy((char *)Block->ozptr[i], \
327                            (char *)(&ilh2[4]), \
328                            mh2 * nh2 * sizeof(char));
329                     break;
330
331                 case 814 :
332                     if ((Block->ozptr[i] = (SCSUINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSUINT32_COP))) == NULL)
333                     {
334                         FREE(Block->z);
335                         FREE(Block->ozsz);
336                         FREE(Block->oztyp);
337                         for (j = 0; j < i; j++)
338                         {
339                             FREE(Block->ozptr[j]);
340                         }
341                         *ierr = -39;
342                         return 0;
343                     }
344                     memcpy((SCSUINT32_COP *)Block->ozptr[i], \
345                            (SCSUINT32_COP *)(&ilh2[4]), \
346                            mh2 * nh2 * sizeof(SCSUINT32_COP));
347                     break;
348
349                 case 812 :
350                     if ((Block->ozptr[i] = (unsigned short *) MALLOC(mh2 * nh2 * sizeof(unsigned short))) == NULL)
351                     {
352                         FREE(Block->z);
353                         FREE(Block->ozsz);
354                         FREE(Block->oztyp);
355                         for (j = 0; j < i; j++)
356                         {
357                             FREE(Block->ozptr[j]);
358                         }
359                         *ierr = -39;
360                         return 0;
361                     }
362                     memcpy((unsigned short *)Block->ozptr[i], \
363                            (unsigned short *)(&ilh2[4]), \
364                            mh2 * nh2 * sizeof(unsigned short));
365                     break;
366
367                 case 811 :
368                     if ((Block->ozptr[i] = (unsigned char *) MALLOC(mh2 * nh2 * sizeof(unsigned char))) == NULL)
369                     {
370                         FREE(Block->z);
371                         FREE(Block->ozsz);
372                         FREE(Block->oztyp);
373                         for (j = 0; j < i; j++)
374                         {
375                             FREE(Block->ozptr[j]);
376                         }
377                         *ierr = -39;
378                         return 0;
379                     }
380                     memcpy((unsigned char *)Block->ozptr[i], \
381                            (unsigned char *)(&ilh2[4]), \
382                            mh2 * nh2 * sizeof(unsigned char));
383                     break;
384             }
385         }
386     }
387
388     /* 12 - nx */
389     n            = MlistGetFieldNumber(il, "nx");
390     if (n == -1)
391     {
392         FREE(Block->z);
393         FREE(Block->ozsz);
394         FREE(Block->oztyp);
395         for (j = 0; j < Block->noz; j++)
396         {
397             FREE(Block->ozptr[j]);
398         }
399         FREE(Block->ozptr);
400         *ierr = 98;
401         return 0;
402     }
403     ilh           = (int *) (listentry(il, n));
404     mh            = ilh[1];
405     nh            = ilh[2];
406     Block->nx     = (int) * ((double *)(&ilh[4]));
407
408     /* 13 - x */
409     n            = MlistGetFieldNumber(il, "x");
410     if (n == -1)
411     {
412         FREE(Block->z);
413         FREE(Block->ozsz);
414         FREE(Block->oztyp);
415         for (j = 0; j < Block->noz; j++)
416         {
417             FREE(Block->ozptr[j]);
418         }
419         FREE(Block->ozptr);
420         *ierr = 98;
421         return 0;
422     }
423     ilh           = (int *) (listentry(il, n));
424     mh            = ilh[1];
425     nh            = ilh[2];
426     Block->x      = NULL;
427     if (mh*nh != 0)
428     {
429         if ((Block->x = (double *) MALLOC((mh * nh) * sizeof(double))) == NULL)
430         {
431             FREE(Block->z);
432             FREE(Block->ozsz);
433             FREE(Block->oztyp);
434             for (j = 0; j < Block->noz; j++)
435             {
436                 FREE(Block->ozptr[j]);
437             }
438             FREE(Block->ozptr);
439             *ierr = -39;
440             return 0;
441         }
442     }
443     for (j = 0; j < (mh * nh); j++)
444     {
445         Block->x[j] = *((double *)(&ilh[4]) + j);
446     }
447
448     /* 14 - xd */
449     n            = MlistGetFieldNumber(il, "xd");
450     if (n == -1)
451     {
452         FREE(Block->z);
453         FREE(Block->ozsz);
454         FREE(Block->oztyp);
455         for (j = 0; j < Block->noz; j++)
456         {
457             FREE(Block->ozptr[j]);
458         }
459         FREE(Block->ozptr);
460         FREE(Block->x);
461         *ierr = 98;
462         return 0;
463     }
464     ilh           = (int *) (listentry(il, n));
465     mh            = ilh[1];
466     nh            = ilh[2];
467     Block->xd     = NULL;
468     if (mh*nh != 0)
469     {
470         if ((Block->xd = (double *) MALLOC((mh * nh) * sizeof(double))) == NULL)
471         {
472             FREE(Block->z);
473             FREE(Block->ozsz);
474             FREE(Block->oztyp);
475             for (j = 0; j < Block->noz; j++)
476             {
477                 FREE(Block->ozptr[j]);
478             }
479             FREE(Block->ozptr);
480             FREE(Block->x);
481             *ierr = -39;
482             return 0;
483         }
484     }
485     for (j = 0; j < (mh * nh); j++)
486     {
487         Block->xd[j] = *((double *)(&ilh[4]) + j);
488     }
489
490     /* 15 - res */
491     n            = MlistGetFieldNumber(il, "res");
492     if (n == -1)
493     {
494         FREE(Block->z);
495         FREE(Block->ozsz);
496         FREE(Block->oztyp);
497         for (j = 0; j < Block->noz; j++)
498         {
499             FREE(Block->ozptr[j]);
500         }
501         FREE(Block->ozptr);
502         FREE(Block->x);
503         FREE(Block->xd);
504         *ierr = 98;
505         return 0;
506     }
507     ilh           = (int *) (listentry(il, n));
508     mh            = ilh[1];
509     nh            = ilh[2];
510     Block->res    = NULL;
511     if (mh*nh != 0)
512     {
513         if ((Block->res = (double *) MALLOC((mh * nh) * sizeof(double))) == NULL)
514         {
515             FREE(Block->z);
516             FREE(Block->ozsz);
517             FREE(Block->oztyp);
518             for (j = 0; j < Block->noz; j++)
519             {
520                 FREE(Block->ozptr[j]);
521             }
522             FREE(Block->ozptr);
523             FREE(Block->x);
524             FREE(Block->xd);
525             *ierr = -39;
526             return 0;
527         }
528     }
529
530     for (j = 0; j < (mh * nh); j++)
531     {
532         Block->res[j] = *((double *)(&ilh[4]) + j);
533     }
534
535     /* 16 - nin */
536     n            = MlistGetFieldNumber(il, "nin");
537     if (n == -1)
538     {
539         FREE(Block->z);
540         FREE(Block->ozsz);
541         FREE(Block->oztyp);
542         for (j = 0; j < Block->noz; j++)
543         {
544             FREE(Block->ozptr[j]);
545         }
546         FREE(Block->ozptr);
547         FREE(Block->x);
548         FREE(Block->xd);
549         FREE(Block->res);
550         *ierr = 98;
551         return 0;
552     }
553     ilh           = (int *) (listentry(il, n));
554     mh            = ilh[1];
555     nh            = ilh[2];
556     Block->nin    = (int) * ((double *)(&ilh[4]));
557
558     /* 17 - insz */
559     n            = MlistGetFieldNumber(il, "insz");
560     if (n == -1)
561     {
562         FREE(Block->z);
563         FREE(Block->ozsz);
564         FREE(Block->oztyp);
565         for (j = 0; j < Block->noz; j++)
566         {
567             FREE(Block->ozptr[j]);
568         }
569         FREE(Block->ozptr);
570         FREE(Block->x);
571         FREE(Block->xd);
572         FREE(Block->res);
573         *ierr = 98;
574         return 0;
575     }
576     ilh           = (int *) (listentry(il, n));
577     mh            = ilh[1];
578     nh            = ilh[2];
579     Block->insz   = NULL;
580     if (mh*nh != 0)
581     {
582         if ((Block->insz = (int *) MALLOC(3 * Block->nin * sizeof(int))) == NULL)
583         {
584             FREE(Block->z);
585             FREE(Block->ozsz);
586             FREE(Block->oztyp);
587             for (j = 0; j < Block->noz; j++)
588             {
589                 FREE(Block->ozptr[j]);
590             }
591             FREE(Block->ozptr);
592             FREE(Block->x);
593             FREE(Block->xd);
594             FREE(Block->res);
595             *ierr = -39;
596             return 0;
597         }
598     }
599     for (j = 0; j < 3 * Block->nin; j++)
600     {
601         Block->insz[j] = (int) * ((double *)(&ilh[4]) + j);
602     }
603
604     /* 18 - inptr */
605     n            = MlistGetFieldNumber(il, "inptr");
606     if (n == -1)
607     {
608         FREE(Block->z);
609         FREE(Block->ozsz);
610         FREE(Block->oztyp);
611         for (j = 0; j < Block->noz; j++)
612         {
613             FREE(Block->ozptr[j]);
614         }
615         FREE(Block->ozptr);
616         FREE(Block->x);
617         FREE(Block->xd);
618         FREE(Block->res);
619         FREE(Block->insz);
620         *ierr = 98;
621         return 0;
622     }
623     ilh           = (int *) (listentry(il, n));
624     mh            = ilh[1];
625     nh            = ilh[2];
626     Block->inptr  = NULL;
627     if (Block->nin != 0)
628     {
629         if ((Block->inptr = (void **) MALLOC(Block->nin * sizeof(void *))) == NULL)
630         {
631             FREE(Block->z);
632             FREE(Block->ozsz);
633             FREE(Block->oztyp);
634             for (j = 0; j < Block->noz; j++)
635             {
636                 FREE(Block->ozptr[j]);
637             }
638             FREE(Block->ozptr);
639             FREE(Block->x);
640             FREE(Block->xd);
641             FREE(Block->res);
642             FREE(Block->insz);
643             *ierr = -39;
644             return 0;
645         }
646         for (i = 0; i < Block->nin; i++)
647         {
648             ilh2 = (int *) (listentry(ilh, i + 1));
649             mh2  = ilh2[1];
650             nh2  = ilh2[2];
651             Block->inptr[i] = NULL;
652             switch (Block->insz[2 * Block->nin + i])
653             {
654                 case 10  :
655                     if ((Block->inptr[i] = (double *) MALLOC(mh2 * nh2 * sizeof(double))) == NULL)
656                     {
657                         FREE(Block->z);
658                         FREE(Block->ozsz);
659                         FREE(Block->oztyp);
660                         for (j = 0; j < Block->noz; j++)
661                         {
662                             FREE(Block->ozptr[j]);
663                         }
664                         FREE(Block->ozptr);
665                         FREE(Block->x);
666                         FREE(Block->xd);
667                         FREE(Block->res);
668                         FREE(Block->insz);
669                         for (j = 0; j < i; j++)
670                         {
671                             FREE(Block->inptr[j]);
672                         }
673                         *ierr = -39;
674                         return 0;
675                     }
676                     memcpy((double *)Block->inptr[i], \
677                            (double *)(&ilh2[4]), \
678                            mh2 * nh2 * sizeof(double));
679                     break;
680
681                 case 11  :
682                     if ((Block->inptr[i] = (double *) MALLOC(2 * mh2 * nh2 * sizeof(double))) == NULL)
683                     {
684                         FREE(Block->z);
685                         FREE(Block->ozsz);
686                         FREE(Block->oztyp);
687                         for (j = 0; j < Block->noz; j++)
688                         {
689                             FREE(Block->ozptr[j]);
690                         }
691                         FREE(Block->ozptr);
692                         FREE(Block->x);
693                         FREE(Block->xd);
694                         FREE(Block->res);
695                         FREE(Block->insz);
696                         for (j = 0; j < i; j++)
697                         {
698                             FREE(Block->inptr[j]);
699                         }
700                         *ierr = -39;
701                         return 0;
702                     }
703                     memcpy((double *)Block->inptr[i], \
704                            (double *)(&ilh2[4]), \
705                            2 * mh2 * nh2 * sizeof(double));
706                     break;
707
708                 case 84  :
709                     if ((Block->inptr[i] = (SCSINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSINT32_COP))) == NULL)
710                     {
711                         FREE(Block->z);
712                         FREE(Block->ozsz);
713                         FREE(Block->oztyp);
714                         for (j = 0; j < Block->noz; j++)
715                         {
716                             FREE(Block->ozptr[j]);
717                         }
718                         FREE(Block->ozptr);
719                         FREE(Block->x);
720                         FREE(Block->xd);
721                         FREE(Block->res);
722                         FREE(Block->insz);
723                         for (j = 0; j < i; j++)
724                         {
725                             FREE(Block->inptr[j]);
726                         }
727                         *ierr = -39;
728                         return 0;
729                     }
730                     memcpy((SCSINT32_COP *)Block->inptr[i], \
731                            (SCSINT32_COP *)(&ilh2[4]), \
732                            mh2 * nh2 * sizeof(SCSINT32_COP));
733                     break;
734
735                 case 82  :
736                     if ((Block->inptr[i] = (short *) MALLOC(mh2 * nh2 * sizeof(short))) == NULL)
737                     {
738                         FREE(Block->z);
739                         FREE(Block->ozsz);
740                         FREE(Block->oztyp);
741                         for (j = 0; j < Block->noz; j++)
742                         {
743                             FREE(Block->ozptr[j]);
744                         }
745                         FREE(Block->ozptr);
746                         FREE(Block->x);
747                         FREE(Block->xd);
748                         FREE(Block->res);
749                         FREE(Block->insz);
750                         for (j = 0; j < i; j++)
751                         {
752                             FREE(Block->inptr[j]);
753                         }
754                         *ierr = -39;
755                         return 0;
756                     }
757                     memcpy((short *)Block->inptr[i], \
758                            (short *)(&ilh2[4]), \
759                            mh2 * nh2 * sizeof(short));
760                     break;
761
762                 case 81  :
763                     if ((Block->inptr[i] = (char *) MALLOC(mh2 * nh2 * sizeof(char))) == NULL)
764                     {
765                         FREE(Block->z);
766                         FREE(Block->ozsz);
767                         FREE(Block->oztyp);
768                         for (j = 0; j < Block->noz; j++)
769                         {
770                             FREE(Block->ozptr[j]);
771                         }
772                         FREE(Block->ozptr);
773                         FREE(Block->x);
774                         FREE(Block->xd);
775                         FREE(Block->res);
776                         FREE(Block->insz);
777                         for (j = 0; j < i; j++)
778                         {
779                             FREE(Block->inptr[j]);
780                         }
781                         *ierr = -39;
782                         return 0;
783                     }
784                     memcpy((char *)Block->inptr[i], \
785                            (char *)(&ilh2[4]), \
786                            mh2 * nh2 * sizeof(char));
787                     break;
788
789                 case 814 :
790                     if ((Block->inptr[i] = (SCSUINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSUINT32_COP))) == NULL)
791                     {
792                         FREE(Block->z);
793                         FREE(Block->ozsz);
794                         FREE(Block->oztyp);
795                         for (j = 0; j < Block->noz; j++)
796                         {
797                             FREE(Block->ozptr[j]);
798                         }
799                         FREE(Block->ozptr);
800                         FREE(Block->x);
801                         FREE(Block->xd);
802                         FREE(Block->res);
803                         FREE(Block->insz);
804                         for (j = 0; j < i; j++)
805                         {
806                             FREE(Block->inptr[j]);
807                         }
808                         *ierr = -39;
809                         return 0;
810                     }
811                     memcpy((SCSUINT32_COP *)Block->inptr[i], \
812                            (SCSUINT32_COP *)(&ilh2[4]), \
813                            mh2 * nh2 * sizeof(SCSUINT32_COP));
814                     break;
815
816                 case 812 :
817                     if ((Block->inptr[i] = (unsigned short *) MALLOC(mh2 * nh2 * sizeof(unsigned short))) == NULL)
818                     {
819                         FREE(Block->z);
820                         FREE(Block->ozsz);
821                         FREE(Block->oztyp);
822                         for (j = 0; j < Block->noz; j++)
823                         {
824                             FREE(Block->ozptr[j]);
825                         }
826                         FREE(Block->ozptr);
827                         FREE(Block->x);
828                         FREE(Block->xd);
829                         FREE(Block->res);
830                         FREE(Block->insz);
831                         for (j = 0; j < i; j++)
832                         {
833                             FREE(Block->inptr[j]);
834                         }
835                         *ierr = -39;
836                         return 0;
837                     }
838                     memcpy((unsigned short *)Block->inptr[i], \
839                            (unsigned short *)(&ilh2[4]), \
840                            mh2 * nh2 * sizeof(unsigned short));
841                     break;
842
843                 case 811 :
844                     if ((Block->inptr[i] = (unsigned char *) MALLOC(mh2 * nh2 * sizeof(unsigned char))) == NULL)
845                     {
846                         FREE(Block->z);
847                         FREE(Block->ozsz);
848                         FREE(Block->oztyp);
849                         for (j = 0; j < Block->noz; j++)
850                         {
851                             FREE(Block->ozptr[j]);
852                         }
853                         FREE(Block->ozptr);
854                         FREE(Block->x);
855                         FREE(Block->xd);
856                         FREE(Block->res);
857                         FREE(Block->insz);
858                         for (j = 0; j < i; j++)
859                         {
860                             FREE(Block->inptr[j]);
861                         }
862                         *ierr = -39;
863                         return 0;
864                     }
865                     memcpy((unsigned char *)Block->inptr[i], \
866                            (unsigned char *)(&ilh2[4]), \
867                            mh2 * nh2 * sizeof(unsigned char));
868                     break;
869             }
870         }
871     }
872
873     /* 19 - nout */
874     n            = MlistGetFieldNumber(il, "nout");
875     if (n == -1)
876     {
877         FREE(Block->z);
878         FREE(Block->ozsz);
879         FREE(Block->oztyp);
880         for (j = 0; j < Block->noz; j++)
881         {
882             FREE(Block->ozptr[j]);
883         }
884         FREE(Block->ozptr);
885         FREE(Block->x);
886         FREE(Block->xd);
887         FREE(Block->res);
888         FREE(Block->insz);
889         for (j = 0; j < Block->nin; j++)
890         {
891             FREE(Block->inptr[j]);
892         }
893         FREE(Block->inptr);
894         *ierr = 98;
895         return 0;
896     }
897     ilh           = (int *) (listentry(il, n));
898     mh            = ilh[1];
899     nh            = ilh[2];
900     Block->nout   = (int) * ((double *)(&ilh[4]));
901
902     /* 20 - outsz */
903     n            = MlistGetFieldNumber(il, "outsz");
904     if (n == -1)
905     {
906         FREE(Block->z);
907         FREE(Block->ozsz);
908         FREE(Block->oztyp);
909         for (j = 0; j < Block->noz; j++)
910         {
911             FREE(Block->ozptr[j]);
912         }
913         FREE(Block->ozptr);
914         FREE(Block->x);
915         FREE(Block->xd);
916         FREE(Block->res);
917         FREE(Block->insz);
918         for (j = 0; j < Block->nin; j++)
919         {
920             FREE(Block->inptr[j]);
921         }
922         FREE(Block->inptr);
923         *ierr = 98;
924         return 0;
925     }
926
927     ilh           = (int *) (listentry(il, n));
928     mh            = ilh[1];
929     nh            = ilh[2];
930     Block->outsz   = NULL;
931     if (mh*nh != 0)
932     {
933         if ((Block->outsz = (int *) MALLOC(3 * Block->nout * sizeof(int))) == NULL)
934         {
935             FREE(Block->z);
936             FREE(Block->ozsz);
937             FREE(Block->oztyp);
938             for (j = 0; j < Block->noz; j++)
939             {
940                 FREE(Block->ozptr[j]);
941             }
942             FREE(Block->ozptr);
943             FREE(Block->x);
944             FREE(Block->xd);
945             FREE(Block->res);
946             FREE(Block->insz);
947             for (j = 0; j < Block->nin; j++)
948             {
949                 FREE(Block->inptr[j]);
950             }
951             FREE(Block->inptr);
952             *ierr = -39;
953             return 0;
954         }
955     }
956
957     for (j = 0; j < 3 * Block->nout; j++)
958     {
959         Block->outsz[j] = (int) * ((double *)(&ilh[4]) + j);
960     }
961
962     /* 21 - outptr */
963     n            = MlistGetFieldNumber(il, "outptr");
964     if (n == -1)
965     {
966         FREE(Block->z);
967         FREE(Block->ozsz);
968         FREE(Block->oztyp);
969         for (j = 0; j < Block->noz; j++)
970         {
971             FREE(Block->ozptr[j]);
972         }
973         FREE(Block->ozptr);
974         FREE(Block->x);
975         FREE(Block->xd);
976         FREE(Block->res);
977         FREE(Block->insz);
978         for (j = 0; j < Block->nin; j++)
979         {
980             FREE(Block->inptr[j]);
981         }
982         FREE(Block->inptr);
983         FREE(Block->outsz);
984         *ierr = 98;
985         return 0;
986     }
987     ilh           = (int *) (listentry(il, n));
988     mh            = ilh[1];
989     nh            = ilh[2];
990     Block->outptr = NULL;
991     if (Block->nout != 0)
992     {
993         if ((Block->outptr = (void **) MALLOC(Block->nout * sizeof(void *))) == NULL)
994         {
995             FREE(Block->z);
996             FREE(Block->ozsz);
997             FREE(Block->oztyp);
998             for (j = 0; j < Block->noz; j++)
999             {
1000                 FREE(Block->ozptr[j]);
1001             }
1002             FREE(Block->ozptr);
1003             FREE(Block->x);
1004             FREE(Block->xd);
1005             FREE(Block->res);
1006             FREE(Block->insz);
1007             for (j = 0; j < Block->nin; j++)
1008             {
1009                 FREE(Block->inptr[j]);
1010             }
1011             FREE(Block->inptr);
1012             FREE(Block->outsz);
1013             *ierr = -39;
1014             return 0;
1015         }
1016         for (i = 0; i < Block->nout; i++)
1017         {
1018             ilh2 = (int *) (listentry(ilh, i + 1));
1019             mh2  = ilh2[1];
1020             nh2  = ilh2[2];
1021             Block->outptr[i] = NULL;
1022             switch (Block->outsz[2 * Block->nout + i])
1023             {
1024                 case 10  :
1025                     if ((Block->outptr[i] = (double *) MALLOC(mh2 * nh2 * sizeof(double))) == NULL)
1026                     {
1027                         FREE(Block->z);
1028                         FREE(Block->ozsz);
1029                         FREE(Block->oztyp);
1030                         for (j = 0; j < Block->noz; j++)
1031                         {
1032                             FREE(Block->ozptr[j]);
1033                         }
1034                         FREE(Block->ozptr);
1035                         FREE(Block->x);
1036                         FREE(Block->xd);
1037                         FREE(Block->res);
1038                         FREE(Block->insz);
1039                         for (j = 0; j < Block->nin; j++)
1040                         {
1041                             FREE(Block->inptr[j]);
1042                         }
1043                         FREE(Block->inptr);
1044                         FREE(Block->outsz);
1045                         for (j = 0; j < i; j++)
1046                         {
1047                             FREE(Block->outptr[j]);
1048                         }
1049                         *ierr = -39;
1050                         return 0;
1051                     }
1052                     memcpy((double *)Block->outptr[i], \
1053                            (double *)(&ilh2[4]), \
1054                            mh2 * nh2 * sizeof(double));
1055                     break;
1056
1057                 case 11  :
1058                     if ((Block->outptr[i] = (double *) MALLOC(2 * mh2 * nh2 * sizeof(double))) == NULL)
1059                     {
1060                         FREE(Block->z);
1061                         FREE(Block->ozsz);
1062                         FREE(Block->oztyp);
1063                         for (j = 0; j < Block->noz; j++)
1064                         {
1065                             FREE(Block->ozptr[j]);
1066                         }
1067                         FREE(Block->ozptr);
1068                         FREE(Block->x);
1069                         FREE(Block->xd);
1070                         FREE(Block->res);
1071                         FREE(Block->insz);
1072                         for (j = 0; j < Block->nin; j++)
1073                         {
1074                             FREE(Block->inptr[j]);
1075                         }
1076                         FREE(Block->inptr);
1077                         FREE(Block->outsz);
1078                         for (j = 0; j < i; j++)
1079                         {
1080                             FREE(Block->outptr[j]);
1081                         }
1082                         *ierr = -39;
1083                         return 0;
1084                     }
1085                     memcpy((double *)Block->outptr[i], \
1086                            (double *)(&ilh2[4]), \
1087                            2 * mh2 * nh2 * sizeof(double));
1088                     break;
1089
1090                 case 84  :
1091                     if ((Block->outptr[i] = (SCSINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSINT32_COP))) == NULL)
1092                     {
1093                         FREE(Block->z);
1094                         FREE(Block->ozsz);
1095                         FREE(Block->oztyp);
1096                         for (j = 0; j < Block->noz; j++)
1097                         {
1098                             FREE(Block->ozptr[j]);
1099                         }
1100                         FREE(Block->ozptr);
1101                         FREE(Block->x);
1102                         FREE(Block->xd);
1103                         FREE(Block->res);
1104                         FREE(Block->insz);
1105                         for (j = 0; j < Block->nin; j++)
1106                         {
1107                             FREE(Block->inptr[j]);
1108                         }
1109                         FREE(Block->inptr);
1110                         FREE(Block->outsz);
1111                         for (j = 0; j < i; j++)
1112                         {
1113                             FREE(Block->outptr[j]);
1114                         }
1115                         *ierr = -39;
1116                         return 0;
1117                     }
1118                     memcpy((SCSINT32_COP *)Block->outptr[i], \
1119                            (SCSINT32_COP *)(&ilh2[4]), \
1120                            mh2 * nh2 * sizeof(SCSINT32_COP));
1121                     break;
1122
1123                 case 82  :
1124                     if ((Block->outptr[i] = (short *) MALLOC(mh2 * nh2 * sizeof(short))) == NULL)
1125                     {
1126                         FREE(Block->z);
1127                         FREE(Block->ozsz);
1128                         FREE(Block->oztyp);
1129                         for (j = 0; j < Block->noz; j++)
1130                         {
1131                             FREE(Block->ozptr[j]);
1132                         }
1133                         FREE(Block->ozptr);
1134                         FREE(Block->x);
1135                         FREE(Block->xd);
1136                         FREE(Block->res);
1137                         FREE(Block->insz);
1138                         for (j = 0; j < Block->nin; j++)
1139                         {
1140                             FREE(Block->inptr[j]);
1141                         }
1142                         FREE(Block->inptr);
1143                         FREE(Block->outsz);
1144                         for (j = 0; j < i; j++)
1145                         {
1146                             FREE(Block->outptr[j]);
1147                         }
1148                         *ierr = -39;
1149                         return 0;
1150                     }
1151                     memcpy((short *)Block->outptr[i], \
1152                            (short *)(&ilh2[4]), \
1153                            mh2 * nh2 * sizeof(short));
1154                     break;
1155
1156                 case 81  :
1157                     if ((Block->outptr[i] = (char *) MALLOC(mh2 * nh2 * sizeof(char))) == NULL)
1158                     {
1159                         FREE(Block->z);
1160                         FREE(Block->ozsz);
1161                         FREE(Block->oztyp);
1162                         for (j = 0; j < Block->noz; j++)
1163                         {
1164                             FREE(Block->ozptr[j]);
1165                         }
1166                         FREE(Block->ozptr);
1167                         FREE(Block->x);
1168                         FREE(Block->xd);
1169                         FREE(Block->res);
1170                         FREE(Block->insz);
1171                         for (j = 0; j < Block->nin; j++)
1172                         {
1173                             FREE(Block->inptr[j]);
1174                         }
1175                         FREE(Block->inptr);
1176                         FREE(Block->outsz);
1177                         for (j = 0; j < i; j++)
1178                         {
1179                             FREE(Block->outptr[j]);
1180                         }
1181                         *ierr = -39;
1182                         return 0;
1183                     }
1184                     memcpy((char *)Block->outptr[i], \
1185                            (char *)(&ilh2[4]), \
1186                            mh2 * nh2 * sizeof(char));
1187                     break;
1188
1189                 case 814 :
1190                     if ((Block->outptr[i] = (SCSUINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSUINT32_COP))) == NULL)
1191                     {
1192                         FREE(Block->z);
1193                         FREE(Block->ozsz);
1194                         FREE(Block->oztyp);
1195                         for (j = 0; j < Block->noz; j++)
1196                         {
1197                             FREE(Block->ozptr[j]);
1198                         }
1199                         FREE(Block->ozptr);
1200                         FREE(Block->x);
1201                         FREE(Block->xd);
1202                         FREE(Block->res);
1203                         FREE(Block->insz);
1204                         for (j = 0; j < Block->nin; j++)
1205                         {
1206                             FREE(Block->inptr[j]);
1207                         }
1208                         FREE(Block->inptr);
1209                         FREE(Block->outsz);
1210                         for (j = 0; j < i; j++)
1211                         {
1212                             FREE(Block->outptr[j]);
1213                         }
1214                         *ierr = -39;
1215                         return 0;
1216                     }
1217                     memcpy((SCSUINT32_COP *)Block->outptr[i], \
1218                            (SCSUINT32_COP *)(&ilh2[4]), \
1219                            mh2 * nh2 * sizeof(SCSUINT32_COP));
1220                     break;
1221
1222                 case 812 :
1223                     if ((Block->outptr[i] = (unsigned short *) MALLOC(mh2 * nh2 * sizeof(unsigned short))) == NULL)
1224                     {
1225                         FREE(Block->z);
1226                         FREE(Block->ozsz);
1227                         FREE(Block->oztyp);
1228                         for (j = 0; j < Block->noz; j++)
1229                         {
1230                             FREE(Block->ozptr[j]);
1231                         }
1232                         FREE(Block->ozptr);
1233                         FREE(Block->x);
1234                         FREE(Block->xd);
1235                         FREE(Block->res);
1236                         FREE(Block->insz);
1237                         for (j = 0; j < Block->nin; j++)
1238                         {
1239                             FREE(Block->inptr[j]);
1240                         }
1241                         FREE(Block->inptr);
1242                         FREE(Block->outsz);
1243                         for (j = 0; j < i; j++)
1244                         {
1245                             FREE(Block->outptr[j]);
1246                         }
1247                         *ierr = -39;
1248                         return 0;
1249                     }
1250                     memcpy((unsigned short *)Block->outptr[i], \
1251                            (unsigned short *)(&ilh2[4]), \
1252                            mh2 * nh2 * sizeof(unsigned short));
1253                     break;
1254
1255                 case 811 :
1256                     if ((Block->outptr[i] = (unsigned char *) MALLOC(mh2 * nh2 * sizeof(unsigned char))) == NULL)
1257                     {
1258                         FREE(Block->z);
1259                         FREE(Block->ozsz);
1260                         FREE(Block->oztyp);
1261                         for (j = 0; j < Block->noz; j++)
1262                         {
1263                             FREE(Block->ozptr[j]);
1264                         }
1265                         FREE(Block->ozptr);
1266                         FREE(Block->x);
1267                         FREE(Block->xd);
1268                         FREE(Block->res);
1269                         FREE(Block->insz);
1270                         for (j = 0; j < Block->nin; j++)
1271                         {
1272                             FREE(Block->inptr[j]);
1273                         }
1274                         FREE(Block->inptr);
1275                         FREE(Block->outsz);
1276                         for (j = 0; j < i; j++)
1277                         {
1278                             FREE(Block->outptr[j]);
1279                         }
1280                         *ierr = -39;
1281                         return 0;
1282                     }
1283                     memcpy((unsigned char *)Block->outptr[i], \
1284                            (unsigned char *)(&ilh2[4]), \
1285                            mh2 * nh2 * sizeof(unsigned char));
1286                     break;
1287             }
1288         }
1289     }
1290
1291     /* 22 - nevout */
1292     n            = MlistGetFieldNumber(il, "nevout");
1293     if (n == -1)
1294     {
1295         FREE(Block->z);
1296         FREE(Block->ozsz);
1297         FREE(Block->oztyp);
1298         for (j = 0; j < Block->noz; j++)
1299         {
1300             FREE(Block->ozptr[j]);
1301         }
1302         FREE(Block->ozptr);
1303         FREE(Block->x);
1304         FREE(Block->xd);
1305         FREE(Block->res);
1306         FREE(Block->insz);
1307         for (j = 0; j < Block->nin; j++)
1308         {
1309             FREE(Block->inptr[j]);
1310         }
1311         FREE(Block->inptr);
1312         FREE(Block->outsz);
1313         for (j = 0; j < Block->nout; j++)
1314         {
1315             FREE(Block->outptr[j]);
1316         }
1317         FREE(Block->outptr);
1318         *ierr = 98;
1319         return 0;
1320     }
1321     ilh           = (int *) (listentry(il, n));
1322     mh            = ilh[1];
1323     nh            = ilh[2];
1324     Block->nevout = (int) * ((double *)(&ilh[4]));
1325
1326     /* 23 - evout */
1327     n            = MlistGetFieldNumber(il, "evout");
1328     if (n == -1)
1329     {
1330         FREE(Block->z);
1331         FREE(Block->ozsz);
1332         FREE(Block->oztyp);
1333         for (j = 0; j < Block->noz; j++)
1334         {
1335             FREE(Block->ozptr[j]);
1336         }
1337         FREE(Block->ozptr);
1338         FREE(Block->x);
1339         FREE(Block->xd);
1340         FREE(Block->res);
1341         FREE(Block->insz);
1342         for (j = 0; j < Block->nin; j++)
1343         {
1344             FREE(Block->inptr[j]);
1345         }
1346         FREE(Block->inptr);
1347         FREE(Block->outsz);
1348         for (j = 0; j < Block->nout; j++)
1349         {
1350             FREE(Block->outptr[j]);
1351         }
1352         FREE(Block->outptr);
1353         *ierr = 98;
1354         return 0;
1355     }
1356     ilh           = (int *) (listentry(il, n));
1357     mh            = ilh[1];
1358     nh            = ilh[2];
1359     Block->evout  = NULL;
1360     if (mh*nh != 0)
1361     {
1362         if ((Block->evout = (double *) MALLOC((mh * nh) * sizeof(double))) == NULL)
1363         {
1364             FREE(Block->z);
1365             FREE(Block->ozsz);
1366             FREE(Block->oztyp);
1367             for (j = 0; j < Block->noz; j++)
1368             {
1369                 FREE(Block->ozptr[j]);
1370             }
1371             FREE(Block->ozptr);
1372             FREE(Block->x);
1373             FREE(Block->xd);
1374             FREE(Block->res);
1375             FREE(Block->insz);
1376             for (j = 0; j < Block->nin; j++)
1377             {
1378                 FREE(Block->inptr[j]);
1379             }
1380             FREE(Block->inptr);
1381             FREE(Block->outsz);
1382             for (j = 0; j < Block->nout; j++)
1383             {
1384                 FREE(Block->outptr[j]);
1385             }
1386             FREE(Block->outptr);
1387             *ierr = -39;
1388             return 0;
1389         }
1390     }
1391
1392     for (j = 0; j < (mh * nh); j++)
1393     {
1394         Block->evout[j] = *((double *)(&ilh[4]) + j);
1395     }
1396
1397     /* 24 - nrpar */
1398     n            = MlistGetFieldNumber(il, "nrpar");
1399     if (n == -1)
1400     {
1401         FREE(Block->z);
1402         FREE(Block->ozsz);
1403         FREE(Block->oztyp);
1404         for (j = 0; j < Block->noz; j++)
1405         {
1406             FREE(Block->ozptr[j]);
1407         }
1408         FREE(Block->ozptr);
1409         FREE(Block->x);
1410         FREE(Block->xd);
1411         FREE(Block->res);
1412         FREE(Block->insz);
1413         for (j = 0; j < Block->nin; j++)
1414         {
1415             FREE(Block->inptr[j]);
1416         }
1417         FREE(Block->inptr);
1418         FREE(Block->outsz);
1419         for (j = 0; j < Block->nout; j++)
1420         {
1421             FREE(Block->outptr[j]);
1422         }
1423         FREE(Block->outptr);
1424         FREE(Block->evout);
1425         *ierr = 98;
1426         return 0;
1427     }
1428     ilh           = (int *) (listentry(il, n));
1429     mh            = ilh[1];
1430     nh            = ilh[2];
1431     Block->nrpar  = (int) * ((double *)(&ilh[4]));
1432
1433     /* 25 - rpar */
1434     n            = MlistGetFieldNumber(il, "rpar");
1435     if (n == -1)
1436     {
1437         FREE(Block->z);
1438         FREE(Block->ozsz);
1439         FREE(Block->oztyp);
1440         for (j = 0; j < Block->noz; j++)
1441         {
1442             FREE(Block->ozptr[j]);
1443         }
1444         FREE(Block->ozptr);
1445         FREE(Block->x);
1446         FREE(Block->xd);
1447         FREE(Block->res);
1448         FREE(Block->insz);
1449         for (j = 0; j < Block->nin; j++)
1450         {
1451             FREE(Block->inptr[j]);
1452         }
1453         FREE(Block->inptr);
1454         FREE(Block->outsz);
1455         for (j = 0; j < Block->nout; j++)
1456         {
1457             FREE(Block->outptr[j]);
1458         }
1459         FREE(Block->outptr);
1460         FREE(Block->evout);
1461         *ierr = 98;
1462         return 0;
1463     }
1464     ilh           = (int *) (listentry(il, n));
1465     mh            = ilh[1];
1466     nh            = ilh[2];
1467     Block->rpar   = NULL;
1468     if (mh * nh != 0)
1469     {
1470         if ((Block->rpar = (double *) MALLOC((mh * nh) * sizeof(double))) == NULL)
1471         {
1472             FREE(Block->z);
1473             FREE(Block->ozsz);
1474             FREE(Block->oztyp);
1475             for (j = 0; j < Block->noz; j++)
1476             {
1477                 FREE(Block->ozptr[j]);
1478             }
1479             FREE(Block->ozptr);
1480             FREE(Block->x);
1481             FREE(Block->xd);
1482             FREE(Block->res);
1483             FREE(Block->insz);
1484             for (j = 0; j < Block->nin; j++)
1485             {
1486                 FREE(Block->inptr[j]);
1487             }
1488             FREE(Block->inptr);
1489             FREE(Block->outsz);
1490             for (j = 0; j < Block->nout; j++)
1491             {
1492                 FREE(Block->outptr[j]);
1493             }
1494             FREE(Block->outptr);
1495             FREE(Block->evout);
1496             *ierr = -39;
1497             return 0;
1498         }
1499     }
1500
1501     for (j = 0; j < (mh * nh); j++)
1502     {
1503         Block->rpar[j] = *((double *)(&ilh[4]) + j);
1504     }
1505
1506     /* 26 - nipar */
1507     n            = MlistGetFieldNumber(il, "nipar");
1508     if (n == -1)
1509     {
1510         FREE(Block->z);
1511         FREE(Block->ozsz);
1512         FREE(Block->oztyp);
1513         for (j = 0; j < Block->noz; j++)
1514         {
1515             FREE(Block->ozptr[j]);
1516         }
1517         FREE(Block->ozptr);
1518         FREE(Block->x);
1519         FREE(Block->xd);
1520         FREE(Block->res);
1521         FREE(Block->insz);
1522         for (j = 0; j < Block->nin; j++)
1523         {
1524             FREE(Block->inptr[j]);
1525         }
1526         FREE(Block->inptr);
1527         FREE(Block->outsz);
1528         for (j = 0; j < Block->nout; j++)
1529         {
1530             FREE(Block->outptr[j]);
1531         }
1532         FREE(Block->outptr);
1533         FREE(Block->evout);
1534         FREE(Block->rpar);
1535         *ierr = 98;
1536         return 0;
1537     }
1538     ilh           = (int *) (listentry(il, n));
1539     mh            = ilh[1];
1540     nh            = ilh[2];
1541     Block->nipar  = (int) * ((double *)(&ilh[4]));
1542
1543     /* 27 - ipar */
1544     n            = MlistGetFieldNumber(il, "ipar");
1545     if (n == -1)
1546     {
1547         FREE(Block->z);
1548         FREE(Block->ozsz);
1549         FREE(Block->oztyp);
1550         for (j = 0; j < Block->noz; j++)
1551         {
1552             FREE(Block->ozptr[j]);
1553         }
1554         FREE(Block->ozptr);
1555         FREE(Block->x);
1556         FREE(Block->xd);
1557         FREE(Block->res);
1558         FREE(Block->insz);
1559         for (j = 0; j < Block->nin; j++)
1560         {
1561             FREE(Block->inptr[j]);
1562         }
1563         FREE(Block->inptr);
1564         FREE(Block->outsz);
1565         for (j = 0; j < Block->nout; j++)
1566         {
1567             FREE(Block->outptr[j]);
1568         }
1569         FREE(Block->outptr);
1570         FREE(Block->evout);
1571         FREE(Block->rpar);
1572         *ierr = 98;
1573         return 0;
1574     }
1575     ilh           = (int *) (listentry(il, n));
1576     mh            = ilh[1];
1577     nh            = ilh[2];
1578     Block->ipar   = NULL;
1579     if (mh*nh != 0)
1580     {
1581         if ((Block->ipar = (int *) MALLOC((mh * nh) * sizeof(int))) == NULL)
1582         {
1583             FREE(Block->z);
1584             FREE(Block->ozsz);
1585             FREE(Block->oztyp);
1586             for (j = 0; j < Block->noz; j++)
1587             {
1588                 FREE(Block->ozptr[j]);
1589             }
1590             FREE(Block->ozptr);
1591             FREE(Block->x);
1592             FREE(Block->xd);
1593             FREE(Block->res);
1594             FREE(Block->insz);
1595             for (j = 0; j < Block->nin; j++)
1596             {
1597                 FREE(Block->inptr[j]);
1598             }
1599             FREE(Block->inptr);
1600             FREE(Block->outsz);
1601             for (j = 0; j < Block->nout; j++)
1602             {
1603                 FREE(Block->outptr[j]);
1604             }
1605             FREE(Block->outptr);
1606             FREE(Block->evout);
1607             FREE(Block->rpar);
1608             *ierr = -39;
1609             return 0;
1610         }
1611     }
1612     for (j = 0; j < (mh * nh); j++)
1613     {
1614         Block->ipar[j] = (int) * ((double *)(&ilh[4]) + j);
1615     }
1616
1617     /* 28 - nopar */
1618     n            = MlistGetFieldNumber(il, "nopar");
1619     if (n == -1)
1620     {
1621         FREE(Block->z);
1622         FREE(Block->ozsz);
1623         FREE(Block->oztyp);
1624         for (j = 0; j < Block->noz; j++)
1625         {
1626             FREE(Block->ozptr[j]);
1627         }
1628         FREE(Block->ozptr);
1629         FREE(Block->x);
1630         FREE(Block->xd);
1631         FREE(Block->res);
1632         FREE(Block->insz);
1633         for (j = 0; j < Block->nin; j++)
1634         {
1635             FREE(Block->inptr[j]);
1636         }
1637         FREE(Block->inptr);
1638         FREE(Block->outsz);
1639         for (j = 0; j < Block->nout; j++)
1640         {
1641             FREE(Block->outptr[j]);
1642         }
1643         FREE(Block->outptr);
1644         FREE(Block->evout);
1645         FREE(Block->rpar);
1646         FREE(Block->ipar);
1647         *ierr = 98;
1648         return 0;
1649     }
1650     ilh           = (int *) (listentry(il, n));
1651     mh            = ilh[1];
1652     nh            = ilh[2];
1653     Block->nopar  = (int) * ((double *)(&ilh[4]));
1654
1655     /* 29 - oparsz */
1656     n            = MlistGetFieldNumber(il, "oparsz");
1657     if (n == -1)
1658     {
1659         FREE(Block->z);
1660         FREE(Block->ozsz);
1661         FREE(Block->oztyp);
1662         for (j = 0; j < Block->noz; j++)
1663         {
1664             FREE(Block->ozptr[j]);
1665         }
1666         FREE(Block->ozptr);
1667         FREE(Block->x);
1668         FREE(Block->xd);
1669         FREE(Block->res);
1670         FREE(Block->insz);
1671         for (j = 0; j < Block->nin; j++)
1672         {
1673             FREE(Block->inptr[j]);
1674         }
1675         FREE(Block->inptr);
1676         FREE(Block->outsz);
1677         for (j = 0; j < Block->nout; j++)
1678         {
1679             FREE(Block->outptr[j]);
1680         }
1681         FREE(Block->outptr);
1682         FREE(Block->evout);
1683         FREE(Block->rpar);
1684         FREE(Block->ipar);
1685         *ierr = 98;
1686         return 0;
1687     }
1688     ilh           = (int *) (listentry(il, n));
1689     mh            = ilh[1];
1690     nh            = ilh[2];
1691     Block->oparsz = NULL;
1692     if (mh*nh != 0)
1693     {
1694         if ((Block->oparsz = (int *) MALLOC(2 * Block->nopar * sizeof(int))) == NULL)
1695         {
1696             FREE(Block->z);
1697             FREE(Block->ozsz);
1698             FREE(Block->oztyp);
1699             for (j = 0; j < Block->noz; j++)
1700             {
1701                 FREE(Block->ozptr[j]);
1702             }
1703             FREE(Block->ozptr);
1704             FREE(Block->x);
1705             FREE(Block->xd);
1706             FREE(Block->res);
1707             FREE(Block->insz);
1708             for (j = 0; j < Block->nin; j++)
1709             {
1710                 FREE(Block->inptr[j]);
1711             }
1712             FREE(Block->inptr);
1713             FREE(Block->outsz);
1714             for (j = 0; j < Block->nout; j++)
1715             {
1716                 FREE(Block->outptr[j]);
1717             }
1718             FREE(Block->outptr);
1719             FREE(Block->evout);
1720             FREE(Block->rpar);
1721             FREE(Block->ipar);
1722             *ierr = -39;
1723             return 0;
1724         }
1725     }
1726
1727     for (j = 0; j < 2 * Block->nopar; j++)
1728     {
1729         Block->oparsz[j] = (int) * ((double *)(&ilh[4]) + j);
1730     }
1731
1732     /* 30 - opartyp */
1733     n            = MlistGetFieldNumber(il, "opartyp");
1734     if (n == -1)
1735     {
1736         FREE(Block->z);
1737         FREE(Block->ozsz);
1738         FREE(Block->oztyp);
1739         for (j = 0; j < Block->noz; j++)
1740         {
1741             FREE(Block->ozptr[j]);
1742         }
1743         FREE(Block->ozptr);
1744         FREE(Block->x);
1745         FREE(Block->xd);
1746         FREE(Block->res);
1747         FREE(Block->insz);
1748         for (j = 0; j < Block->nin; j++)
1749         {
1750             FREE(Block->inptr[j]);
1751         }
1752         FREE(Block->inptr);
1753         FREE(Block->outsz);
1754         for (j = 0; j < Block->nout; j++)
1755         {
1756             FREE(Block->outptr[j]);
1757         }
1758         FREE(Block->outptr);
1759         FREE(Block->evout);
1760         FREE(Block->rpar);
1761         FREE(Block->ipar);
1762         FREE(Block->oparsz);
1763         *ierr = 98;
1764         return 0;
1765     }
1766     ilh           = (int *) (listentry(il, n));
1767     mh            = ilh[1];
1768     nh            = ilh[2];
1769     Block->opartyp = NULL;
1770     if (mh*nh != 0)
1771     {
1772         if ((Block->opartyp = (int *) MALLOC(Block->nopar * sizeof(int))) == NULL)
1773         {
1774             FREE(Block->z);
1775             FREE(Block->ozsz);
1776             FREE(Block->oztyp);
1777             for (j = 0; j < Block->noz; j++)
1778             {
1779                 FREE(Block->ozptr[j]);
1780             }
1781             FREE(Block->ozptr);
1782             FREE(Block->x);
1783             FREE(Block->xd);
1784             FREE(Block->res);
1785             FREE(Block->insz);
1786             for (j = 0; j < Block->nin; j++)
1787             {
1788                 FREE(Block->inptr[j]);
1789             }
1790             FREE(Block->inptr);
1791             FREE(Block->outsz);
1792             for (j = 0; j < Block->nout; j++)
1793             {
1794                 FREE(Block->outptr[j]);
1795             }
1796             FREE(Block->outptr);
1797             FREE(Block->evout);
1798             FREE(Block->rpar);
1799             FREE(Block->ipar);
1800             FREE(Block->oparsz);
1801             *ierr = -39;
1802             return 0;
1803         }
1804     }
1805
1806     for (j = 0; j < Block->nopar; j++)
1807     {
1808         Block->opartyp[j] = (int) * ((double *)(&ilh[4]) + j);
1809     }
1810
1811     /* 31 - opar */
1812     n            = MlistGetFieldNumber(il, "opar");
1813     if (n == -1)
1814     {
1815         FREE(Block->z);
1816         FREE(Block->ozsz);
1817         FREE(Block->oztyp);
1818         for (j = 0; j < Block->noz; j++)
1819         {
1820             FREE(Block->ozptr[j]);
1821         }
1822         FREE(Block->ozptr);
1823         FREE(Block->x);
1824         FREE(Block->xd);
1825         FREE(Block->res);
1826         FREE(Block->insz);
1827         for (j = 0; j < Block->nin; j++)
1828         {
1829             FREE(Block->inptr[j]);
1830         }
1831         FREE(Block->inptr);
1832         FREE(Block->outsz);
1833         for (j = 0; j < Block->nout; j++)
1834         {
1835             FREE(Block->outptr[j]);
1836         }
1837         FREE(Block->outptr);
1838         FREE(Block->evout);
1839         FREE(Block->rpar);
1840         FREE(Block->ipar);
1841         FREE(Block->oparsz);
1842         FREE(Block->opartyp);
1843         *ierr = 98;
1844         return 0;
1845     }
1846     ilh            = (int *) (listentry(il, n));
1847     mh             = ilh[1];
1848     nh             = ilh[2];
1849     Block->oparptr = NULL;
1850     if (Block->nopar != 0)
1851     {
1852         if ((Block->oparptr = (void **) MALLOC(Block->nopar * sizeof(void *))) == NULL)
1853         {
1854             FREE(Block->z);
1855             FREE(Block->ozsz);
1856             FREE(Block->oztyp);
1857             for (j = 0; j < Block->noz; j++)
1858             {
1859                 FREE(Block->ozptr[j]);
1860             }
1861             FREE(Block->ozptr);
1862             FREE(Block->x);
1863             FREE(Block->xd);
1864             FREE(Block->res);
1865             FREE(Block->insz);
1866             for (j = 0; j < Block->nin; j++)
1867             {
1868                 FREE(Block->inptr[j]);
1869             }
1870             FREE(Block->inptr);
1871             FREE(Block->outsz);
1872             for (j = 0; j < Block->nout; j++)
1873             {
1874                 FREE(Block->outptr[j]);
1875             }
1876             FREE(Block->outptr);
1877             FREE(Block->evout);
1878             FREE(Block->rpar);
1879             FREE(Block->ipar);
1880             FREE(Block->oparsz);
1881             FREE(Block->opartyp);
1882             *ierr = -39;
1883             return 0;
1884         }
1885
1886         for (i = 0; i < Block->nopar; i++)
1887         {
1888             ilh2 = (int *) (listentry(ilh, i + 1));
1889             mh2  = ilh2[1];
1890             nh2  = ilh2[2];
1891             Block->oparptr[i] = NULL;
1892             switch (Block->opartyp[i])
1893             {
1894                 case 10  :
1895                     if ((Block->oparptr[i] = (double *) MALLOC(mh2 * nh2 * sizeof(double))) == NULL)
1896                     {
1897                         FREE(Block->z);
1898                         FREE(Block->ozsz);
1899                         FREE(Block->oztyp);
1900                         for (j = 0; j < Block->noz; j++)
1901                         {
1902                             FREE(Block->ozptr[j]);
1903                         }
1904                         FREE(Block->ozptr);
1905                         FREE(Block->x);
1906                         FREE(Block->xd);
1907                         FREE(Block->res);
1908                         FREE(Block->insz);
1909                         for (j = 0; j < Block->nin; j++)
1910                         {
1911                             FREE(Block->inptr[j]);
1912                         }
1913                         FREE(Block->inptr);
1914                         FREE(Block->outsz);
1915                         for (j = 0; j < Block->nout; j++)
1916                         {
1917                             FREE(Block->outptr[j]);
1918                         }
1919                         FREE(Block->outptr);
1920                         FREE(Block->evout);
1921                         FREE(Block->rpar);
1922                         FREE(Block->ipar);
1923                         FREE(Block->oparsz);
1924                         FREE(Block->opartyp);
1925                         for (j = 0; j < i; j++)
1926                         {
1927                             FREE(Block->oparptr[j]);
1928                         }
1929                         *ierr = -39;
1930                         return 0;
1931                     }
1932                     memcpy((double *)Block->oparptr[i], \
1933                            (double *)(&ilh2[4]), \
1934                            mh2 * nh2 * sizeof(double));
1935                     break;
1936
1937                 case 11  :
1938                     if ((Block->oparptr[i] = (double *) MALLOC(2 * mh2 * nh2 * sizeof(double))) == NULL)
1939                     {
1940                         FREE(Block->z);
1941                         FREE(Block->ozsz);
1942                         FREE(Block->oztyp);
1943                         for (j = 0; j < Block->noz; j++)
1944                         {
1945                             FREE(Block->ozptr[j]);
1946                         }
1947                         FREE(Block->ozptr);
1948                         FREE(Block->x);
1949                         FREE(Block->xd);
1950                         FREE(Block->res);
1951                         FREE(Block->insz);
1952                         for (j = 0; j < Block->nin; j++)
1953                         {
1954                             FREE(Block->inptr[j]);
1955                         }
1956                         FREE(Block->inptr);
1957                         FREE(Block->outsz);
1958                         for (j = 0; j < Block->nout; j++)
1959                         {
1960                             FREE(Block->outptr[j]);
1961                         }
1962                         FREE(Block->outptr);
1963                         FREE(Block->evout);
1964                         FREE(Block->rpar);
1965                         FREE(Block->ipar);
1966                         FREE(Block->oparsz);
1967                         FREE(Block->opartyp);
1968                         for (j = 0; j < i; j++)
1969                         {
1970                             FREE(Block->oparptr[j]);
1971                         }
1972                         *ierr = -39;
1973                         return 0;
1974                     }
1975                     memcpy((double *)Block->oparptr[i], \
1976                            (double *)(&ilh2[4]), \
1977                            2 * mh2 * nh2 * sizeof(double));
1978                     break;
1979
1980                 case 84  :
1981                     if ((Block->oparptr[i] = (SCSINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSINT32_COP))) == NULL)
1982                     {
1983                         FREE(Block->z);
1984                         FREE(Block->ozsz);
1985                         FREE(Block->oztyp);
1986                         for (j = 0; j < Block->noz; j++)
1987                         {
1988                             FREE(Block->ozptr[j]);
1989                         }
1990                         FREE(Block->ozptr);
1991                         FREE(Block->x);
1992                         FREE(Block->xd);
1993                         FREE(Block->res);
1994                         FREE(Block->insz);
1995                         for (j = 0; j < Block->nin; j++)
1996                         {
1997                             FREE(Block->inptr[j]);
1998                         }
1999                         FREE(Block->inptr);
2000                         FREE(Block->outsz);
2001                         for (j = 0; j < Block->nout; j++)
2002                         {
2003                             FREE(Block->outptr[j]);
2004                         }
2005                         FREE(Block->outptr);
2006                         FREE(Block->evout);
2007                         FREE(Block->rpar);
2008                         FREE(Block->ipar);
2009                         FREE(Block->oparsz);
2010                         FREE(Block->opartyp);
2011                         for (j = 0; j < i; j++)
2012                         {
2013                             FREE(Block->oparptr[j]);
2014                         }
2015                         *ierr = -39;
2016                         return 0;
2017                     }
2018                     memcpy((SCSINT32_COP *)Block->oparptr[i], \
2019                            (SCSINT32_COP *)(&ilh2[4]), \
2020                            mh2 * nh2 * sizeof(SCSINT32_COP));
2021                     break;
2022
2023                 case 82  :
2024                     if ((Block->oparptr[i] = (short *) MALLOC(mh2 * nh2 * sizeof(short))) == NULL)
2025                     {
2026                         FREE(Block->z);
2027                         FREE(Block->ozsz);
2028                         FREE(Block->oztyp);
2029                         for (j = 0; j < Block->noz; j++)
2030                         {
2031                             FREE(Block->ozptr[j]);
2032                         }
2033                         FREE(Block->ozptr);
2034                         FREE(Block->x);
2035                         FREE(Block->xd);
2036                         FREE(Block->res);
2037                         FREE(Block->insz);
2038                         for (j = 0; j < Block->nin; j++)
2039                         {
2040                             FREE(Block->inptr[j]);
2041                         }
2042                         FREE(Block->inptr);
2043                         FREE(Block->outsz);
2044                         for (j = 0; j < Block->nout; j++)
2045                         {
2046                             FREE(Block->outptr[j]);
2047                         }
2048                         FREE(Block->outptr);
2049                         FREE(Block->evout);
2050                         FREE(Block->rpar);
2051                         FREE(Block->ipar);
2052                         FREE(Block->oparsz);
2053                         FREE(Block->opartyp);
2054                         for (j = 0; j < i; j++)
2055                         {
2056                             FREE(Block->oparptr[j]);
2057                         }
2058                         *ierr = -39;
2059                         return 0;
2060                     }
2061                     memcpy((short *)Block->oparptr[i], \
2062                            (short *)(&ilh2[4]), \
2063                            mh2 * nh2 * sizeof(short));
2064                     break;
2065
2066                 case 81  :
2067                     if ((Block->oparptr[i] = (char *) MALLOC(mh2 * nh2 * sizeof(char))) == NULL)
2068                     {
2069                         FREE(Block->z);
2070                         FREE(Block->ozsz);
2071                         FREE(Block->oztyp);
2072                         for (j = 0; j < Block->noz; j++)
2073                         {
2074                             FREE(Block->ozptr[j]);
2075                         }
2076                         FREE(Block->ozptr);
2077                         FREE(Block->x);
2078                         FREE(Block->xd);
2079                         FREE(Block->res);
2080                         FREE(Block->insz);
2081                         for (j = 0; j < Block->nin; j++)
2082                         {
2083                             FREE(Block->inptr[j]);
2084                         }
2085                         FREE(Block->inptr);
2086                         FREE(Block->outsz);
2087                         for (j = 0; j < Block->nout; j++)
2088                         {
2089                             FREE(Block->outptr[j]);
2090                         }
2091                         FREE(Block->outptr);
2092                         FREE(Block->evout);
2093                         FREE(Block->rpar);
2094                         FREE(Block->ipar);
2095                         FREE(Block->oparsz);
2096                         FREE(Block->opartyp);
2097                         for (j = 0; j < i; j++)
2098                         {
2099                             FREE(Block->oparptr[j]);
2100                         }
2101                         *ierr = -39;
2102                         return 0;
2103                     }
2104                     memcpy((char *)Block->oparptr[i], \
2105                            (char *)(&ilh2[4]), \
2106                            mh2 * nh2 * sizeof(char));
2107                     break;
2108
2109                 case 814 :
2110                     if ((Block->oparptr[i] = (SCSUINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSUINT32_COP))) == NULL)
2111                     {
2112                         FREE(Block->z);
2113                         FREE(Block->ozsz);
2114                         FREE(Block->oztyp);
2115                         for (j = 0; j < Block->noz; j++)
2116                         {
2117                             FREE(Block->ozptr[j]);
2118                         }
2119                         FREE(Block->ozptr);
2120                         FREE(Block->x);
2121                         FREE(Block->xd);
2122                         FREE(Block->res);
2123                         FREE(Block->insz);
2124                         for (j = 0; j < Block->nin; j++)
2125                         {
2126                             FREE(Block->inptr[j]);
2127                         }
2128                         FREE(Block->inptr);
2129                         FREE(Block->outsz);
2130                         for (j = 0; j < Block->nout; j++)
2131                         {
2132                             FREE(Block->outptr[j]);
2133                         }
2134                         FREE(Block->outptr);
2135                         FREE(Block->evout);
2136                         FREE(Block->rpar);
2137                         FREE(Block->ipar);
2138                         FREE(Block->oparsz);
2139                         FREE(Block->opartyp);
2140                         for (j = 0; j < i; j++)
2141                         {
2142                             FREE(Block->oparptr[j]);
2143                         }
2144                         *ierr = -39;
2145                         return 0;
2146                     }
2147                     memcpy((SCSUINT32_COP *)Block->oparptr[i], \
2148                            (SCSUINT32_COP *)(&ilh2[4]), \
2149                            mh2 * nh2 * sizeof(SCSUINT32_COP));
2150                     break;
2151
2152                 case 812 :
2153                     if ((Block->oparptr[i] = (unsigned short *) MALLOC(mh2 * nh2 * sizeof(unsigned short))) == NULL)
2154                     {
2155                         FREE(Block->z);
2156                         FREE(Block->ozsz);
2157                         FREE(Block->oztyp);
2158                         for (j = 0; j < Block->noz; j++)
2159                         {
2160                             FREE(Block->ozptr[j]);
2161                         }
2162                         FREE(Block->ozptr);
2163                         FREE(Block->x);
2164                         FREE(Block->xd);
2165                         FREE(Block->res);
2166                         FREE(Block->insz);
2167                         for (j = 0; j < Block->nin; j++)
2168                         {
2169                             FREE(Block->inptr[j]);
2170                         }
2171                         FREE(Block->inptr);
2172                         FREE(Block->outsz);
2173                         for (j = 0; j < Block->nout; j++)
2174                         {
2175                             FREE(Block->outptr[j]);
2176                         }
2177                         FREE(Block->outptr);
2178                         FREE(Block->evout);
2179                         FREE(Block->rpar);
2180                         FREE(Block->ipar);
2181                         FREE(Block->oparsz);
2182                         FREE(Block->opartyp);
2183                         for (j = 0; j < i; j++)
2184                         {
2185                             FREE(Block->oparptr[j]);
2186                         }
2187                         *ierr = -39;
2188                         return 0;
2189                     }
2190                     memcpy((unsigned short *)Block->oparptr[i], \
2191                            (unsigned short *)(&ilh2[4]), \
2192                            mh2 * nh2 * sizeof(unsigned short));
2193                     break;
2194
2195                 case 811 :
2196                     if ((Block->oparptr[i] = (unsigned char *) MALLOC(mh2 * nh2 * sizeof(unsigned char))) == NULL)
2197                     {
2198                         FREE(Block->z);
2199                         FREE(Block->ozsz);
2200                         FREE(Block->oztyp);
2201                         for (j = 0; j < Block->noz; j++)
2202                         {
2203                             FREE(Block->ozptr[j]);
2204                         }
2205                         FREE(Block->ozptr);
2206                         FREE(Block->x);
2207                         FREE(Block->xd);
2208                         FREE(Block->res);
2209                         FREE(Block->insz);
2210                         for (j = 0; j < Block->nin; j++)
2211                         {
2212                             FREE(Block->inptr[j]);
2213                         }
2214                         FREE(Block->inptr);
2215                         FREE(Block->outsz);
2216                         for (j = 0; j < Block->nout; j++)
2217                         {
2218                             FREE(Block->outptr[j]);
2219                         }
2220                         FREE(Block->outptr);
2221                         FREE(Block->evout);
2222                         FREE(Block->rpar);
2223                         FREE(Block->ipar);
2224                         FREE(Block->oparsz);
2225                         FREE(Block->opartyp);
2226                         for (j = 0; j < i; j++)
2227                         {
2228                             FREE(Block->oparptr[j]);
2229                         }
2230                         *ierr = -39;
2231                         return 0;
2232                     }
2233                     memcpy((unsigned char *)Block->oparptr[i], \
2234                            (unsigned char *)(&ilh2[4]), \
2235                            mh2 * nh2 * sizeof(unsigned char));
2236                     break;
2237             }
2238         }
2239     }
2240
2241     /* 32 - ng */
2242     n            = MlistGetFieldNumber(il, "ng");
2243     if (n == -1)
2244     {
2245         FREE(Block->z);
2246         FREE(Block->ozsz);
2247         FREE(Block->oztyp);
2248         for (j = 0; j < Block->noz; j++)
2249         {
2250             FREE(Block->ozptr[j]);
2251         }
2252         FREE(Block->ozptr);
2253         FREE(Block->x);
2254         FREE(Block->xd);
2255         FREE(Block->res);
2256         FREE(Block->insz);
2257         for (j = 0; j < Block->nin; j++)
2258         {
2259             FREE(Block->inptr[j]);
2260         }
2261         FREE(Block->inptr);
2262         FREE(Block->outsz);
2263         for (j = 0; j < Block->nout; j++)
2264         {
2265             FREE(Block->outptr[j]);
2266         }
2267         FREE(Block->outptr);
2268         FREE(Block->evout);
2269         FREE(Block->rpar);
2270         FREE(Block->ipar);
2271         FREE(Block->oparsz);
2272         FREE(Block->opartyp);
2273         for (j = 0; j < Block->nopar; j++)
2274         {
2275             FREE(Block->oparptr[j]);
2276         }
2277         FREE(Block->oparptr);
2278         *ierr = 98;
2279         return 0;
2280     }
2281     ilh           = (int *) (listentry(il, n));
2282     mh            = ilh[1];
2283     nh            = ilh[2];
2284     Block->ng     = (int) * ((double *)(&ilh[4]));
2285
2286     /* 33 - g */
2287     n            = MlistGetFieldNumber(il, "g");
2288     if (n == -1)
2289     {
2290         FREE(Block->z);
2291         FREE(Block->ozsz);
2292         FREE(Block->oztyp);
2293         for (j = 0; j < Block->noz; j++)
2294         {
2295             FREE(Block->ozptr[j]);
2296         }
2297         FREE(Block->ozptr);
2298         FREE(Block->x);
2299         FREE(Block->xd);
2300         FREE(Block->res);
2301         FREE(Block->insz);
2302         for (j = 0; j < Block->nin; j++)
2303         {
2304             FREE(Block->inptr[j]);
2305         }
2306         FREE(Block->inptr);
2307         FREE(Block->outsz);
2308         for (j = 0; j < Block->nout; j++)
2309         {
2310             FREE(Block->outptr[j]);
2311         }
2312         FREE(Block->outptr);
2313         FREE(Block->evout);
2314         FREE(Block->rpar);
2315         FREE(Block->ipar);
2316         FREE(Block->oparsz);
2317         FREE(Block->opartyp);
2318         for (j = 0; j < Block->nopar; j++)
2319         {
2320             FREE(Block->oparptr[j]);
2321         }
2322         FREE(Block->oparptr);
2323         *ierr = 98;
2324         return 0;
2325     }
2326     ilh           = (int *) (listentry(il, n));
2327     mh            = ilh[1];
2328     nh            = ilh[2];
2329     Block->g      = NULL;
2330     if (mh*nh != 0)
2331     {
2332         if ((Block->g = (double *) MALLOC((mh * nh) * sizeof(double))) == NULL)
2333         {
2334             FREE(Block->z);
2335             FREE(Block->ozsz);
2336             FREE(Block->oztyp);
2337             for (j = 0; j < Block->noz; j++)
2338             {
2339                 FREE(Block->ozptr[j]);
2340             }
2341             FREE(Block->ozptr);
2342             FREE(Block->x);
2343             FREE(Block->xd);
2344             FREE(Block->res);
2345             FREE(Block->insz);
2346             for (j = 0; j < Block->nin; j++)
2347             {
2348                 FREE(Block->inptr[j]);
2349             }
2350             FREE(Block->inptr);
2351             FREE(Block->outsz);
2352             for (j = 0; j < Block->nout; j++)
2353             {
2354                 FREE(Block->outptr[j]);
2355             }
2356             FREE(Block->outptr);
2357             FREE(Block->evout);
2358             FREE(Block->rpar);
2359             FREE(Block->ipar);
2360             FREE(Block->oparsz);
2361             FREE(Block->opartyp);
2362             for (j = 0; j < Block->nopar; j++)
2363             {
2364                 FREE(Block->oparptr[j]);
2365             }
2366             FREE(Block->oparptr);
2367             *ierr = -39;
2368             return 0;
2369         }
2370     }
2371
2372     for (j = 0; j < (mh * nh); j++)
2373     {
2374         Block->g[j] = *((double *)(&ilh[4]) + j);
2375     }
2376
2377     /* 34 - ztyp */
2378     n            = MlistGetFieldNumber(il, "ztyp");
2379     if (n == -1)
2380     {
2381         FREE(Block->z);
2382         FREE(Block->ozsz);
2383         FREE(Block->oztyp);
2384         for (j = 0; j < Block->noz; j++)
2385         {
2386             FREE(Block->ozptr[j]);
2387         }
2388         FREE(Block->ozptr);
2389         FREE(Block->x);
2390         FREE(Block->xd);
2391         FREE(Block->res);
2392         FREE(Block->insz);
2393         for (j = 0; j < Block->nin; j++)
2394         {
2395             FREE(Block->inptr[j]);
2396         }
2397         FREE(Block->inptr);
2398         FREE(Block->outsz);
2399         for (j = 0; j < Block->nout; j++)
2400         {
2401             FREE(Block->outptr[j]);
2402         }
2403         FREE(Block->outptr);
2404         FREE(Block->evout);
2405         FREE(Block->rpar);
2406         FREE(Block->ipar);
2407         FREE(Block->oparsz);
2408         FREE(Block->opartyp);
2409         for (j = 0; j < Block->nopar; j++)
2410         {
2411             FREE(Block->oparptr[j]);
2412         }
2413         FREE(Block->oparptr);
2414         FREE(Block->g);
2415         *ierr = 98;
2416         return 0;
2417     }
2418     ilh           = (int *) (listentry(il, n));
2419     mh            = ilh[1];
2420     nh            = ilh[2];
2421     Block->ztyp   = (int) * ((double *)(&ilh[4]));
2422
2423     /* 35 - jroot */
2424     n            = MlistGetFieldNumber(il, "jroot");
2425     if (n == -1)
2426     {
2427         FREE(Block->z);
2428         FREE(Block->ozsz);
2429         FREE(Block->oztyp);
2430         for (j = 0; j < Block->noz; j++)
2431         {
2432             FREE(Block->ozptr[j]);
2433         }
2434         FREE(Block->ozptr);
2435         FREE(Block->x);
2436         FREE(Block->xd);
2437         FREE(Block->res);
2438         FREE(Block->insz);
2439         for (j = 0; j < Block->nin; j++)
2440         {
2441             FREE(Block->inptr[j]);
2442         }
2443         FREE(Block->inptr);
2444         FREE(Block->outsz);
2445         for (j = 0; j < Block->nout; j++)
2446         {
2447             FREE(Block->outptr[j]);
2448         }
2449         FREE(Block->outptr);
2450         FREE(Block->evout);
2451         FREE(Block->rpar);
2452         FREE(Block->ipar);
2453         FREE(Block->oparsz);
2454         FREE(Block->opartyp);
2455         for (j = 0; j < Block->nopar; j++)
2456         {
2457             FREE(Block->oparptr[j]);
2458         }
2459         FREE(Block->oparptr);
2460         FREE(Block->g);
2461         *ierr = 98;
2462         return 0;
2463     }
2464     ilh           = (int *) (listentry(il, n));
2465     mh            = ilh[1];
2466     nh            = ilh[2];
2467     Block->jroot  = NULL;
2468     if (mh*nh != 0)
2469     {
2470         if ((Block->jroot = (int *) MALLOC((mh * nh) * sizeof(int))) == NULL)
2471         {
2472             FREE(Block->z);
2473             FREE(Block->ozsz);
2474             FREE(Block->oztyp);
2475             for (j = 0; j < Block->noz; j++)
2476             {
2477                 FREE(Block->ozptr[j]);
2478             }
2479             FREE(Block->ozptr);
2480             FREE(Block->x);
2481             FREE(Block->xd);
2482             FREE(Block->res);
2483             FREE(Block->insz);
2484             for (j = 0; j < Block->nin; j++)
2485             {
2486                 FREE(Block->inptr[j]);
2487             }
2488             FREE(Block->inptr);
2489             FREE(Block->outsz);
2490             for (j = 0; j < Block->nout; j++)
2491             {
2492                 FREE(Block->outptr[j]);
2493             }
2494             FREE(Block->outptr);
2495             FREE(Block->evout);
2496             FREE(Block->rpar);
2497             FREE(Block->ipar);
2498             FREE(Block->oparsz);
2499             FREE(Block->opartyp);
2500             for (j = 0; j < Block->nopar; j++)
2501             {
2502                 FREE(Block->oparptr[j]);
2503             }
2504             FREE(Block->oparptr);
2505             FREE(Block->g);
2506             *ierr = -39;
2507             return 0;
2508         }
2509     }
2510
2511     for (j = 0; j < (mh * nh); j++)
2512     {
2513         Block->jroot[j] = (int) * ((double *)(&ilh[4]) + j);
2514     }
2515
2516     /* 36 - label */
2517     n            = MlistGetFieldNumber(il, "label");
2518     if (n == -1)
2519     {
2520         FREE(Block->z);
2521         FREE(Block->ozsz);
2522         FREE(Block->oztyp);
2523         for (j = 0; j < Block->noz; j++)
2524         {
2525             FREE(Block->ozptr[j]);
2526         }
2527         FREE(Block->ozptr);
2528         FREE(Block->x);
2529         FREE(Block->xd);
2530         FREE(Block->res);
2531         FREE(Block->insz);
2532         for (j = 0; j < Block->nin; j++)
2533         {
2534             FREE(Block->inptr[j]);
2535         }
2536         FREE(Block->inptr);
2537         FREE(Block->outsz);
2538         for (j = 0; j < Block->nout; j++)
2539         {
2540             FREE(Block->outptr[j]);
2541         }
2542         FREE(Block->outptr);
2543         FREE(Block->evout);
2544         FREE(Block->rpar);
2545         FREE(Block->ipar);
2546         FREE(Block->oparsz);
2547         FREE(Block->opartyp);
2548         for (j = 0; j < Block->nopar; j++)
2549         {
2550             FREE(Block->oparptr[j]);
2551         }
2552         FREE(Block->oparptr);
2553         FREE(Block->g);
2554         FREE(Block->jroot);
2555         *ierr = 98;
2556         return 0;
2557     }
2558     ilh           = (int *) (listentry(il, n));
2559     mh            = ilh[1];
2560     nh            = ilh[2];
2561     Block->label  = "";
2562     if (mh*nh != 0)
2563     {
2564         len_str  = ilh[5] - 1;
2565         if (len_str != 0)
2566         {
2567             if ((Block->label = (char *) MALLOC((len_str + 1) * sizeof(char))) == NULL)
2568             {
2569                 FREE(Block->z);
2570                 FREE(Block->ozsz);
2571                 FREE(Block->oztyp);
2572                 for (j = 0; j < Block->noz; j++)
2573                 {
2574                     FREE(Block->ozptr[j]);
2575                 }
2576                 FREE(Block->ozptr);
2577                 FREE(Block->x);
2578                 FREE(Block->xd);
2579                 FREE(Block->res);
2580                 FREE(Block->insz);
2581                 for (j = 0; j < Block->nin; j++)
2582                 {
2583                     FREE(Block->inptr[j]);
2584                 }
2585                 FREE(Block->inptr);
2586                 FREE(Block->outsz);
2587                 for (j = 0; j < Block->nout; j++)
2588                 {
2589                     FREE(Block->outptr[j]);
2590                 }
2591                 FREE(Block->outptr);
2592                 FREE(Block->evout);
2593                 FREE(Block->rpar);
2594                 FREE(Block->ipar);
2595                 FREE(Block->oparsz);
2596                 FREE(Block->opartyp);
2597                 for (j = 0; j < Block->nopar; j++)
2598                 {
2599                     FREE(Block->oparptr[j]);
2600                 }
2601                 FREE(Block->oparptr);
2602                 FREE(Block->g);
2603                 FREE(Block->jroot);
2604                 *ierr = -39;
2605                 return 0;
2606             }
2607             Block->label[len_str] = '\0';
2608             C2F(cvstr)(&len_str, &ilh[6], Block->label, (j = 1, &j), len_str);
2609         }
2610     }
2611
2612     /* 37 - work*/
2613     n            = MlistGetFieldNumber(il, "work");
2614     if (n == -1)
2615     {
2616         FREE(Block->z);
2617         FREE(Block->ozsz);
2618         FREE(Block->oztyp);
2619         for (j = 0; j < Block->noz; j++)
2620         {
2621             FREE(Block->ozptr[j]);
2622         }
2623         FREE(Block->ozptr);
2624         FREE(Block->x);
2625         FREE(Block->xd);
2626         FREE(Block->res);
2627         FREE(Block->insz);
2628         for (j = 0; j < Block->nin; j++)
2629         {
2630             FREE(Block->inptr[j]);
2631         }
2632         FREE(Block->inptr);
2633         FREE(Block->outsz);
2634         for (j = 0; j < Block->nout; j++)
2635         {
2636             FREE(Block->outptr[j]);
2637         }
2638         FREE(Block->outptr);
2639         FREE(Block->evout);
2640         FREE(Block->rpar);
2641         FREE(Block->ipar);
2642         FREE(Block->oparsz);
2643         FREE(Block->opartyp);
2644         for (j = 0; j < Block->nopar; j++)
2645         {
2646             FREE(Block->oparptr[j]);
2647         }
2648         FREE(Block->oparptr);
2649         FREE(Block->g);
2650         FREE(Block->jroot);
2651         if (len_str != 0)
2652         {
2653             FREE(Block->label);
2654         }
2655         *ierr = 98;
2656         return 0;
2657     }
2658     ilh           = (int *) (listentry(il, n));
2659     mh            = ilh[1];
2660     nh            = ilh[2];
2661     Block->work = (void**) ((int) * ((double *)(&ilh[4])));
2662
2663     /* 38 - nmode*/
2664     n            = MlistGetFieldNumber(il, "nmode");
2665     if (n == -1)
2666     {
2667         FREE(Block->z);
2668         FREE(Block->ozsz);
2669         FREE(Block->oztyp);
2670         for (j = 0; j < Block->noz; j++)
2671         {
2672             FREE(Block->ozptr[j]);
2673         }
2674         FREE(Block->ozptr);
2675         FREE(Block->x);
2676         FREE(Block->xd);
2677         FREE(Block->res);
2678         FREE(Block->insz);
2679         for (j = 0; j < Block->nin; j++)
2680         {
2681             FREE(Block->inptr[j]);
2682         }
2683         FREE(Block->inptr);
2684         FREE(Block->outsz);
2685         for (j = 0; j < Block->nout; j++)
2686         {
2687             FREE(Block->outptr[j]);
2688         }
2689         FREE(Block->outptr);
2690         FREE(Block->evout);
2691         FREE(Block->rpar);
2692         FREE(Block->ipar);
2693         FREE(Block->oparsz);
2694         FREE(Block->opartyp);
2695         for (j = 0; j < Block->nopar; j++)
2696         {
2697             FREE(Block->oparptr[j]);
2698         }
2699         FREE(Block->oparptr);
2700         FREE(Block->g);
2701         FREE(Block->jroot);
2702         if (len_str != 0)
2703         {
2704             FREE(Block->label);
2705         }
2706         *ierr = 98;
2707         return 0;
2708     }
2709     ilh           = (int *) (listentry(il, n));
2710     mh            = ilh[1];
2711     nh            = ilh[2];
2712     Block->nmode  = (int) * ((double *)(&ilh[4]));
2713
2714     /* 39 - mode */
2715     n            = MlistGetFieldNumber(il, "mode");
2716     if (n == -1)
2717     {
2718         FREE(Block->z);
2719         FREE(Block->ozsz);
2720         FREE(Block->oztyp);
2721         for (j = 0; j < Block->noz; j++)
2722         {
2723             FREE(Block->ozptr[j]);
2724         }
2725         FREE(Block->ozptr);
2726         FREE(Block->x);
2727         FREE(Block->xd);
2728         FREE(Block->res);
2729         FREE(Block->insz);
2730         for (j = 0; j < Block->nin; j++)
2731         {
2732             FREE(Block->inptr[j]);
2733         }
2734         FREE(Block->inptr);
2735         FREE(Block->outsz);
2736         for (j = 0; j < Block->nout; j++)
2737         {
2738             FREE(Block->outptr[j]);
2739         }
2740         FREE(Block->outptr);
2741         FREE(Block->evout);
2742         FREE(Block->rpar);
2743         FREE(Block->ipar);
2744         FREE(Block->oparsz);
2745         FREE(Block->opartyp);
2746         for (j = 0; j < Block->nopar; j++)
2747         {
2748             FREE(Block->oparptr[j]);
2749         }
2750         FREE(Block->oparptr);
2751         FREE(Block->g);
2752         FREE(Block->jroot);
2753         if (len_str != 0)
2754         {
2755             FREE(Block->label);
2756         }
2757         *ierr = 98;
2758         return 0;
2759     }
2760     ilh           = (int *) (listentry(il, n));
2761     mh            = ilh[1];
2762     nh            = ilh[2];
2763     Block->mode   = NULL;
2764     if (mh*nh != 0)
2765     {
2766         if ((Block->mode = (int *) MALLOC((mh * nh) * sizeof(int))) == NULL)
2767         {
2768             FREE(Block->z);
2769             FREE(Block->ozsz);
2770             FREE(Block->oztyp);
2771             for (j = 0; j < Block->noz; j++)
2772             {
2773                 FREE(Block->ozptr[j]);
2774             }
2775             FREE(Block->ozptr);
2776             FREE(Block->x);
2777             FREE(Block->xd);
2778             FREE(Block->res);
2779             FREE(Block->insz);
2780             for (j = 0; j < Block->nin; j++)
2781             {
2782                 FREE(Block->inptr[j]);
2783             }
2784             FREE(Block->inptr);
2785             FREE(Block->outsz);
2786             for (j = 0; j < Block->nout; j++)
2787             {
2788                 FREE(Block->outptr[j]);
2789             }
2790             FREE(Block->outptr);
2791             FREE(Block->evout);
2792             FREE(Block->rpar);
2793             FREE(Block->ipar);
2794             FREE(Block->oparsz);
2795             FREE(Block->opartyp);
2796             for (j = 0; j < Block->nopar; j++)
2797             {
2798                 FREE(Block->oparptr[j]);
2799             }
2800             FREE(Block->oparptr);
2801             FREE(Block->g);
2802             FREE(Block->jroot);
2803             if (len_str != 0)
2804             {
2805                 FREE(Block->label);
2806             }
2807             *ierr = -39;
2808             return 0;
2809         }
2810     }
2811
2812     for (j = 0; j < (mh * nh); j++)
2813     {
2814         Block->mode[j] = (int) * ((double *)(&ilh[4]) + j);
2815     }
2816
2817     /* 40 - xprop */
2818     n            = MlistGetFieldNumber(il, "xprop");
2819     if (n == -1)
2820     {
2821         FREE(Block->z);
2822         FREE(Block->ozsz);
2823         FREE(Block->oztyp);
2824         for (j = 0; j < Block->noz; j++)
2825         {
2826             FREE(Block->ozptr[j]);
2827         }
2828         FREE(Block->ozptr);
2829         FREE(Block->x);
2830         FREE(Block->xd);
2831         FREE(Block->res);
2832         FREE(Block->insz);
2833         for (j = 0; j < Block->nin; j++)
2834         {
2835             FREE(Block->inptr[j]);
2836         }
2837         FREE(Block->inptr);
2838         FREE(Block->outsz);
2839         for (j = 0; j < Block->nout; j++)
2840         {
2841             FREE(Block->outptr[j]);
2842         }
2843         FREE(Block->outptr);
2844         FREE(Block->evout);
2845         FREE(Block->rpar);
2846         FREE(Block->ipar);
2847         FREE(Block->oparsz);
2848         FREE(Block->opartyp);
2849         for (j = 0; j < Block->nopar; j++)
2850         {
2851             FREE(Block->oparptr[j]);
2852         }
2853         FREE(Block->oparptr);
2854         FREE(Block->g);
2855         FREE(Block->jroot);
2856         if (len_str != 0)
2857         {
2858             FREE(Block->label);
2859         }
2860         FREE(Block->mode);
2861         *ierr = 98;
2862         return 0;
2863     }
2864     ilh           = (int *) (listentry(il, n));
2865     mh            = ilh[1];
2866     nh            = ilh[2];
2867     Block->xprop  = NULL;
2868     if (mh*nh != 0)
2869     {
2870         if ((Block->xprop = (int *) MALLOC((mh * nh) * sizeof(int))) == NULL)
2871         {
2872             FREE(Block->z);
2873             FREE(Block->ozsz);
2874             FREE(Block->oztyp);
2875             for (j = 0; j < Block->noz; j++)
2876             {
2877                 FREE(Block->ozptr[j]);
2878             }
2879             FREE(Block->ozptr);
2880             FREE(Block->x);
2881             FREE(Block->xd);
2882             FREE(Block->res);
2883             FREE(Block->insz);
2884             for (j = 0; j < Block->nin; j++)
2885             {
2886                 FREE(Block->inptr[j]);
2887             }
2888             FREE(Block->inptr);
2889             FREE(Block->outsz);
2890             for (j = 0; j < Block->nout; j++)
2891             {
2892                 FREE(Block->outptr[j]);
2893             }
2894             FREE(Block->outptr);
2895             FREE(Block->evout);
2896             FREE(Block->rpar);
2897             FREE(Block->ipar);
2898             FREE(Block->oparsz);
2899             FREE(Block->opartyp);
2900             for (j = 0; j < Block->nopar; j++)
2901             {
2902                 FREE(Block->oparptr[j]);
2903             }
2904             FREE(Block->oparptr);
2905             FREE(Block->g);
2906             FREE(Block->jroot);
2907             if (len_str != 0)
2908             {
2909                 FREE(Block->label);
2910             }
2911             FREE(Block->mode);
2912             *ierr = -39;
2913             return 0;
2914         }
2915     }
2916
2917     for (j = 0; j < (mh * nh); j++)
2918     {
2919         Block->xprop[j] = (int) * ((double *)(&ilh[4]) + j);
2920     }
2921
2922     return 0;
2923 }
2924 /*--------------------------------------------------------------------------*/