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