[model2blk] Use scicos_block4 typedef and avoid long use instead of int. 96/12196/2
Bruno JOFRET [Tue, 30 Jul 2013 13:34:56 +0000 (15:34 +0200)]
Change-Id: I5ccabeae66c6a8fee6d2b7794419316692386591

scilab/modules/scicos/sci_gateway/c/sci_model2blk.c
scilab/modules/scicos/src/c/extractblklist.c

index f7333d6..5e71de1 100644 (file)
@@ -111,8 +111,8 @@ int sci_model2blk(char *fname, unsigned long fname_len)
     unsigned char *ptr_uc = NULL;
     short *ptr_s = NULL;
     unsigned short *ptr_us = NULL;
-    long *ptr_l = NULL;
-    unsigned long *ptr_ul = NULL;
+    SCSINT32_COP *ptr_l = NULL;
+    SCSUINT32_COP *ptr_ul = NULL;
     int nblklst = 40;
 
     scicos_block Block;
@@ -427,8 +427,8 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                     }
                     break;
                 case 84  :
-                    if ((Block.inptr[i] = (long *) \
-                                          MALLOC(Block.insz[i] * Block.insz[Block.nin + i] * sizeof(long))) == NULL)
+                    if ((Block.inptr[i] = (SCSINT32_COP *) \
+                                          MALLOC(Block.insz[i] * Block.insz[Block.nin + i] * sizeof(SCSINT32_COP))) == NULL)
                     {
                         for (j = 0; j < i; j++)
                         {
@@ -439,7 +439,7 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                         Scierror(888, _("%s : Allocation error.\n"), fname);
                         return 0;
                     }
-                    ptr_l = (long *) Block.inptr[i];
+                    ptr_l = (SCSINT32_COP *) Block.inptr[i];
                     for (j = 0; j < Block.insz[i]*Block.insz[Block.nin + i]; j++)
                     {
                         ptr_l[j] = 0;
@@ -484,8 +484,8 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                     }
                     break;
                 case 814 :
-                    if ((Block.inptr[i] = (unsigned long *) \
-                                          MALLOC(Block.insz[i] * Block.insz[Block.nin + i] * sizeof(unsigned long))) == NULL)
+                    if ((Block.inptr[i] = (SCSUINT32_COP *) \
+                                          MALLOC(Block.insz[i] * Block.insz[Block.nin + i] * sizeof(SCSUINT32_COP))) == NULL)
                     {
                         for (j = 0; j < i; j++)
                         {
@@ -496,7 +496,7 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                         Scierror(888, _("%s : Allocation error.\n"), fname);
                         return 0;
                     }
-                    ptr_ul = (unsigned long *) Block.inptr[i];
+                    ptr_ul = (SCSUINT32_COP *) Block.inptr[i];
                     for (j = 0; j < Block.insz[i]*Block.insz[Block.nin + i]; j++)
                     {
                         ptr_ul[j] = 0;
@@ -747,8 +747,8 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                     }
                     break;
                 case 84  :
-                    if ((Block.outptr[i] = (long *) \
-                                           MALLOC(Block.outsz[i] * Block.outsz[Block.nout + i] * sizeof(long))) == NULL)
+                    if ((Block.outptr[i] = (SCSINT32_COP *) \
+                                           MALLOC(Block.outsz[i] * Block.outsz[Block.nout + i] * sizeof(SCSINT32_COP))) == NULL)
                     {
                         for (j = 0; j < Block.nin; j++)
                         {
@@ -765,7 +765,7 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                         Scierror(888, _("%s : Allocation error.\n"), fname);
                         return 0;
                     }
-                    ptr_l = (long *) Block.outptr[i];
+                    ptr_l = (SCSINT32_COP *) Block.outptr[i];
                     for (j = 0; j < Block.outsz[i]*Block.outsz[Block.nout + i]; j++)
                     {
                         ptr_l[j] = 0;
@@ -822,8 +822,8 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                     }
                     break;
                 case 814 :
-                    if ((Block.outptr[i] = (unsigned long *) \
-                                           MALLOC(Block.outsz[i] * Block.outsz[Block.nout + i] * sizeof(unsigned long))) == NULL)
+                    if ((Block.outptr[i] = (SCSUINT32_COP *) \
+                                           MALLOC(Block.outsz[i] * Block.outsz[Block.nout + i] * sizeof(SCSUINT32_COP))) == NULL)
                     {
                         for (j = 0; j < Block.nin; j++)
                         {
@@ -840,7 +840,7 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                         Scierror(888, _("%s : Allocation error.\n"), fname);
                         return 0;
                     }
-                    ptr_ul = (unsigned long *) Block.outptr[i];
+                    ptr_ul = (SCSUINT32_COP *) Block.outptr[i];
                     for (j = 0; j < Block.outsz[i]*Block.outsz[Block.nout + i]; j++)
                     {
                         ptr_ul[j] = 0;
@@ -1288,7 +1288,7 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                 if (ilh2[3] == 4)
                 {
                     Block.oztyp[i] = 84;
-                    if ((Block.ozptr[i] = (long *) MALLOC(mh2 * nh2 * sizeof(long))) == NULL)
+                    if ((Block.ozptr[i] = (SCSINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSINT32_COP))) == NULL)
                     {
                         for (j = 0; j < Block.nin; j++)
                         {
@@ -1317,10 +1317,10 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                         Scierror(888, _("%s : Allocation error.\n"), fname);
                         return 0;
                     }
-                    ptr_l = (long *) Block.ozptr[i];
+                    ptr_l = (SCSINT32_COP *) Block.ozptr[i];
                     for (j = 0; j < mh2 * nh2; j++)
                     {
-                        ptr_l[j] = *((long *)(&ilh2[4]) + j);
+                        ptr_l[j] = *((SCSINT32_COP *)(&ilh2[4]) + j);
                     }
                 }
                 else if (ilh2[3] == 2)
@@ -1402,7 +1402,7 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                 else if (ilh2[3] == 14)
                 {
                     Block.oztyp[i] = 814;
-                    if ((Block.ozptr[i] = (unsigned long *) MALLOC(mh2 * nh2 * sizeof(unsigned long))) == NULL)
+                    if ((Block.ozptr[i] = (SCSUINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSUINT32_COP))) == NULL)
                     {
                         for (j = 0; j < Block.nin; j++)
                         {
@@ -1431,10 +1431,10 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                         Scierror(888, _("%s : Allocation error.\n"), fname);
                         return 0;
                     }
-                    ptr_ul = (unsigned long *) Block.ozptr[i];
+                    ptr_ul = (SCSUINT32_COP *) Block.ozptr[i];
                     for (j = 0; j < mh2 * nh2; j++)
                     {
-                        ptr_ul[j] = *((unsigned long *)(&ilh2[4]) + j);
+                        ptr_ul[j] = *((SCSUINT32_COP *)(&ilh2[4]) + j);
                     }
                 }
                 else if (ilh2[3] == 12)
@@ -1828,7 +1828,7 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                 if (ilh2[3] == 4)
                 {
                     Block.opartyp[i] = 84;
-                    if ((Block.oparptr[i] = (long *) MALLOC(mh2 * nh2 * sizeof(long))) == NULL)
+                    if ((Block.oparptr[i] = (SCSINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSINT32_COP))) == NULL)
                     {
                         for (j = 0; j < Block.nin; j++)
                         {
@@ -1865,10 +1865,10 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                         Scierror(888, _("%s : Allocation error.\n"), fname);
                         return 0;
                     }
-                    ptr_l = (long *) Block.oparptr[i];
+                    ptr_l = (SCSINT32_COP *) Block.oparptr[i];
                     for (j = 0; j < mh2 * nh2; j++)
                     {
-                        ptr_l[j] = *((long *)(&ilh2[4]) + j);
+                        ptr_l[j] = *((SCSINT32_COP *)(&ilh2[4]) + j);
                     }
                 }
                 else if (ilh2[3] == 2)
@@ -1966,7 +1966,7 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                 else if (ilh2[3] == 14)
                 {
                     Block.opartyp[i] = 814;
-                    if ((Block.oparptr[i] = (unsigned long *) MALLOC(mh2 * nh2 * sizeof(unsigned long))) == NULL)
+                    if ((Block.oparptr[i] = (SCSUINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSUINT32_COP))) == NULL)
                     {
                         for (j = 0; j < Block.nin; j++)
                         {
@@ -2003,10 +2003,10 @@ int sci_model2blk(char *fname, unsigned long fname_len)
                         Scierror(888, _("%s : Allocation error.\n"), fname);
                         return 0;
                     }
-                    ptr_ul = (unsigned long *) Block.oparptr[i];
+                    ptr_ul = (SCSUINT32_COP *) Block.oparptr[i];
                     for (j = 0; j < mh2 * nh2; j++)
                     {
-                        ptr_ul[j] = *((unsigned long *)(&ilh2[4]) + j);
+                        ptr_ul[j] = *((SCSUINT32_COP *)(&ilh2[4]) + j);
                     }
                 }
                 else if (ilh2[3] == 12)
index 5b77cda..51ce644 100644 (file)
@@ -275,7 +275,7 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                     break;
 
                 case 84  :
-                    if ((Block->ozptr[i] = (long *) MALLOC(mh2 * nh2 * sizeof(long))) == NULL)
+                    if ((Block->ozptr[i] = (SCSINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSINT32_COP))) == NULL)
                     {
                         FREE(Block->z);
                         FREE(Block->ozsz);
@@ -287,9 +287,9 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                         *ierr = -39;
                         return 0;
                     }
-                    memcpy((long *)Block->ozptr[i], \
-                           (long *)(&ilh2[4]), \
-                           mh2 * nh2 * sizeof(long));
+                    memcpy((SCSINT32_COP *)Block->ozptr[i], \
+                           (SCSINT32_COP *)(&ilh2[4]), \
+                           mh2 * nh2 * sizeof(SCSINT32_COP));
                     break;
 
                 case 82  :
@@ -329,7 +329,7 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                     break;
 
                 case 814 :
-                    if ((Block->ozptr[i] = (unsigned long *) MALLOC(mh2 * nh2 * sizeof(unsigned long))) == NULL)
+                    if ((Block->ozptr[i] = (SCSUINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSUINT32_COP))) == NULL)
                     {
                         FREE(Block->z);
                         FREE(Block->ozsz);
@@ -341,9 +341,9 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                         *ierr = -39;
                         return 0;
                     }
-                    memcpy((unsigned long *)Block->ozptr[i], \
-                           (unsigned long *)(&ilh2[4]), \
-                           mh2 * nh2 * sizeof(unsigned long));
+                    memcpy((SCSUINT32_COP *)Block->ozptr[i], \
+                           (SCSUINT32_COP *)(&ilh2[4]), \
+                           mh2 * nh2 * sizeof(SCSUINT32_COP));
                     break;
 
                 case 812 :
@@ -706,7 +706,7 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                     break;
 
                 case 84  :
-                    if ((Block->inptr[i] = (long *) MALLOC(mh2 * nh2 * sizeof(long))) == NULL)
+                    if ((Block->inptr[i] = (SCSINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSINT32_COP))) == NULL)
                     {
                         FREE(Block->z);
                         FREE(Block->ozsz);
@@ -727,9 +727,9 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                         *ierr = -39;
                         return 0;
                     }
-                    memcpy((long *)Block->inptr[i], \
-                           (long *)(&ilh2[4]), \
-                           mh2 * nh2 * sizeof(long));
+                    memcpy((SCSINT32_COP *)Block->inptr[i], \
+                           (SCSINT32_COP *)(&ilh2[4]), \
+                           mh2 * nh2 * sizeof(SCSINT32_COP));
                     break;
 
                 case 82  :
@@ -787,7 +787,7 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                     break;
 
                 case 814 :
-                    if ((Block->inptr[i] = (unsigned long *) MALLOC(mh2 * nh2 * sizeof(unsigned long))) == NULL)
+                    if ((Block->inptr[i] = (SCSUINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSUINT32_COP))) == NULL)
                     {
                         FREE(Block->z);
                         FREE(Block->ozsz);
@@ -808,9 +808,9 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                         *ierr = -39;
                         return 0;
                     }
-                    memcpy((unsigned long *)Block->inptr[i], \
-                           (unsigned long *)(&ilh2[4]), \
-                           mh2 * nh2 * sizeof(unsigned long));
+                    memcpy((SCSUINT32_COP *)Block->inptr[i], \
+                           (SCSUINT32_COP *)(&ilh2[4]), \
+                           mh2 * nh2 * sizeof(SCSUINT32_COP));
                     break;
 
                 case 812 :
@@ -1088,7 +1088,7 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                     break;
 
                 case 84  :
-                    if ((Block->outptr[i] = (long *) MALLOC(mh2 * nh2 * sizeof(long))) == NULL)
+                    if ((Block->outptr[i] = (SCSINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSINT32_COP))) == NULL)
                     {
                         FREE(Block->z);
                         FREE(Block->ozsz);
@@ -1115,9 +1115,9 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                         *ierr = -39;
                         return 0;
                     }
-                    memcpy((long *)Block->outptr[i], \
-                           (long *)(&ilh2[4]), \
-                           mh2 * nh2 * sizeof(long));
+                    memcpy((SCSINT32_COP *)Block->outptr[i], \
+                           (SCSINT32_COP *)(&ilh2[4]), \
+                           mh2 * nh2 * sizeof(SCSINT32_COP));
                     break;
 
                 case 82  :
@@ -1187,7 +1187,7 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                     break;
 
                 case 814 :
-                    if ((Block->outptr[i] = (unsigned long *) MALLOC(mh2 * nh2 * sizeof(unsigned long))) == NULL)
+                    if ((Block->outptr[i] = (SCSUINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSUINT32_COP))) == NULL)
                     {
                         FREE(Block->z);
                         FREE(Block->ozsz);
@@ -1214,9 +1214,9 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                         *ierr = -39;
                         return 0;
                     }
-                    memcpy((unsigned long *)Block->outptr[i], \
-                           (unsigned long *)(&ilh2[4]), \
-                           mh2 * nh2 * sizeof(unsigned long));
+                    memcpy((SCSUINT32_COP *)Block->outptr[i], \
+                           (SCSUINT32_COP *)(&ilh2[4]), \
+                           mh2 * nh2 * sizeof(SCSUINT32_COP));
                     break;
 
                 case 812 :
@@ -1978,7 +1978,7 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                     break;
 
                 case 84  :
-                    if ((Block->oparptr[i] = (long *) MALLOC(mh2 * nh2 * sizeof(long))) == NULL)
+                    if ((Block->oparptr[i] = (SCSINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSINT32_COP))) == NULL)
                     {
                         FREE(Block->z);
                         FREE(Block->ozsz);
@@ -2015,9 +2015,9 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                         *ierr = -39;
                         return 0;
                     }
-                    memcpy((long *)Block->oparptr[i], \
-                           (long *)(&ilh2[4]), \
-                           mh2 * nh2 * sizeof(long));
+                    memcpy((SCSINT32_COP *)Block->oparptr[i], \
+                           (SCSINT32_COP *)(&ilh2[4]), \
+                           mh2 * nh2 * sizeof(SCSINT32_COP));
                     break;
 
                 case 82  :
@@ -2107,7 +2107,7 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                     break;
 
                 case 814 :
-                    if ((Block->oparptr[i] = (unsigned long *) MALLOC(mh2 * nh2 * sizeof(unsigned long))) == NULL)
+                    if ((Block->oparptr[i] = (SCSUINT32_COP *) MALLOC(mh2 * nh2 * sizeof(SCSUINT32_COP))) == NULL)
                     {
                         FREE(Block->z);
                         FREE(Block->ozsz);
@@ -2144,9 +2144,9 @@ int extractblklist(int *il, scicos_block *Block, int *ierr)
                         *ierr = -39;
                         return 0;
                     }
-                    memcpy((unsigned long *)Block->oparptr[i], \
-                           (unsigned long *)(&ilh2[4]), \
-                           mh2 * nh2 * sizeof(unsigned long));
+                    memcpy((SCSUINT32_COP *)Block->oparptr[i], \
+                           (SCSUINT32_COP *)(&ilh2[4]), \
+                           mh2 * nh2 * sizeof(SCSUINT32_COP));
                     break;
 
                 case 812 :