finalize changes around int and long long in mget(i) and mput(i) 02/12602/2
Antoine ELIAS [Thu, 19 Sep 2013 16:32:43 +0000 (18:32 +0200)]
Change-Id: I68bba4216520e1ab9c42f1492fcdd55d590ae70f

12 files changed:
scilab/modules/fileio/src/c/convert_tools.c
scilab/modules/fileio/src/c/convert_tools.h
scilab/modules/fileio/src/c/mgeti.c
scilab/modules/fileio/src/c/mgeti.h
scilab/modules/fileio/src/c/mputi.c
scilab/modules/fileio/src/c/mputi.h
scilab/modules/fileio/tests/unit_tests/mgeti.dia.ref
scilab/modules/fileio/tests/unit_tests/mgeti.tst
scilab/modules/fileio/tests/unit_tests/mputi.dia.ref
scilab/modules/fileio/tests/unit_tests/mputi.tst
scilab/modules/integer/src/c/tpconv.c
scilab/modules/integer/src/fortran/i_mput.f

index 6d8f924..b893744 100644 (file)
@@ -34,6 +34,13 @@ int swap_int(int _val)
     return res;
 }
 /*--------------------------------------------------------------------------*/
+long long swap_long_long(long long _val)
+{
+    long long res = 0;
+    swap_generic((char*)&_val, (char*)&res, sizeof(long long));
+    return res;
+}
+/*--------------------------------------------------------------------------*/
 char swap_char(char _val)
 {
     return _val;
@@ -51,6 +58,18 @@ void writeInt(int _val, FILE* _pF, int _iEndian)
     fwrite(&newVal, sizeof(unsigned char), sizeof(int), _pF);
 }
 /*--------------------------------------------------------------------------*/
+void writeLongLong(long long _val, FILE* _pF, int _iEndian)
+{
+    //reverse _val bytes and write
+    long long newVal = _val;
+    if (_iEndian == BIG_ENDIAN)
+    {
+        newVal = swap_long_long(_val);
+    }
+
+    fwrite(&newVal, sizeof(unsigned char), sizeof(long long), _pF);
+}
+/*--------------------------------------------------------------------------*/
 void writeShort(short _val, FILE* _pF, int _iEndian)
 {
     //reverse _val bytes and write
@@ -83,6 +102,20 @@ int readInt(FILE* _pF, int _iEndian)
     }
 }
 /*--------------------------------------------------------------------------*/
+long long readLongLong(FILE* _pF, int _iEndian)
+{
+    long long val = 0;
+    fread(&val, sizeof(long long), 1, _pF);
+    if (_iEndian == BIG_ENDIAN)
+    {
+        return swap_long_long(val);
+    }
+    else
+    {
+        return val;
+    }
+}
+/*--------------------------------------------------------------------------*/
 short readShort(FILE* _pF, int _iEndian)
 {
     short val = 0;
@@ -106,9 +139,14 @@ char readChar(FILE* _pF, int _iEndian)
 /*--------------------------------------------------------------------------*/
 int checkType(char _type)
 {
-    if (_type == 'l' || _type == 'i')
+    if (_type == 'l')
+    {
+        return TYPE_LONG_LONG;
+    }
+
+    if (_type == 'i')
     {
-        return TYPE_LONG;
+        return TYPE_INT;
     }
 
     if (_type == 's')
index f1a230b..98ce6b7 100644 (file)
@@ -20,7 +20,8 @@
 #define LITTLE_ENDIAN   1
 #define BIG_ENDIAN      -1
 
-#define TYPE_LONG       4
+#define TYPE_LONG_LONG  8
+#define TYPE_INT       4
 #define TYPE_SHORT      2
 #define TYPE_CHAR       1
 
@@ -28,12 +29,15 @@ void swap_generic(char* _in, char* _out, int _len);
 short swap_short(short _val);
 int swap_int(int _val);
 char swap_char(char _val);
+long long swap_long_long(long long _val);
 
 void writeInt(int _val, FILE* _pF, int _iEndian);
+void writeLongLong(long long _val, FILE* _pF, int _iEndian);
 void writeShort(short _val, FILE* _pF, int _iEndian);
 void writeChar(short _val, FILE* _pF, int _iEndian);
 
 int readInt(FILE* _pF, int _iEndian);
+long long readLongLong(FILE* _pF, int _iEndian);
 short readShort(FILE* _pF, int _iEndian);
 char readChar(FILE* _pF, int _iEndian);
 
index 0a3218f..99749f0 100644 (file)
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#ifndef _MSC_VER
-#include <stdint.h>
-#else
-#define int32_t int
-#define uint32_t unsigned int
-#endif
 #include "mgeti.h"
 #include "sciprint.h"
 #include "filesmanagement.h"
@@ -30,7 +24,7 @@
 * read n items of type type
 * if read fails *ierr contains the number of properly read items
 ****************************************************************/
-void C2F(mgeti)(int* _pF, int* _pVal, int* _iSize, char* _iOpt, int* _iErr)
+void C2F(mgeti)(int* _pF, long long* _pVal, int* _iSize, char* _iOpt, int* _iErr)
 {
     int iType = 0;
     int iUnsigned = 0;
@@ -42,7 +36,7 @@ void C2F(mgeti)(int* _pF, int* _pVal, int* _iSize, char* _iOpt, int* _iErr)
     FILE *fa = NULL;
 
     unsigned char *RES_uc   = (unsigned char *)_pVal;
-    uint32_t *RES_ul        = (uint32_t *)_pVal;
+    unsigned int *RES_ui    = (unsigned int*)_pVal;
     unsigned short *RES_us  = (unsigned short *)_pVal;
 
     fa = GetFileOpenedInScilab(*_pF);
@@ -120,10 +114,25 @@ void C2F(mgeti)(int* _pF, int* _pVal, int* _iSize, char* _iOpt, int* _iErr)
 
     switch (iType)
     {
-        case TYPE_LONG :
+        case TYPE_LONG_LONG :
             for (i = 0 ; i < *_iSize ; i++)
             {
-                uint32_t val;
+                unsigned long long val;
+                val = readLongLong(fa, iEndian);
+                if (feof(fa))
+                {
+                    iCount = i;
+                    break;
+                }
+
+                //be careful, only because scilab 5 does not manage int64
+                *RES_ui++ = (unsigned int)val;
+            }
+            break;
+        case TYPE_INT :
+            for (i = 0 ; i < *_iSize ; i++)
+            {
+                unsigned int val;
                 val = readInt(fa, iEndian);
                 if (feof(fa))
                 {
@@ -131,7 +140,7 @@ void C2F(mgeti)(int* _pF, int* _pVal, int* _iSize, char* _iOpt, int* _iErr)
                     break;
                 }
 
-                *RES_ul++ = val;
+                *RES_ui++ = val;
             }
             break;
         case TYPE_SHORT :
index 5795032..e2fc34b 100644 (file)
@@ -35,7 +35,7 @@ int SWAP(char type[], int *fd);
  * @param char type[]
  * @param ierr
  */
-FILEIO_IMPEXP void C2F(mgeti) (int *fd, int *res, int *n, char type[], int *ierr);
+FILEIO_IMPEXP void C2F(mgeti) (int *fd, long long *res, int *n, char type[], int *ierr);
 
 #endif /* __MGETI_H__ */
 
index be3f4db..beb2162 100644 (file)
 */
 
 #include <string.h>
-#ifndef _MSC_VER
-#include <stdint.h>
-#else
-#define int32_t int
-#define uint32_t unsigned int
-#endif
 
 #include "mputi.h"
 #include "sciprint.h"
@@ -26,7 +20,7 @@
 #include "convert_tools.h"
 
 
-void C2F(mputi)(int* _pF, int* _pVal, int* _iSize, char* _iOpt, int* _iErr)
+void C2F(mputi)(int* _pF, long long* _pVal, int* _iSize, char* _iOpt, int* _iErr)
 {
     int iType = 0;
     int iUnsigned = 0;
@@ -36,9 +30,9 @@ void C2F(mputi)(int* _pF, int* _pVal, int* _iSize, char* _iOpt, int* _iErr)
     int i;
     FILE *fa = NULL;
 
-    unsigned char *RES_uc   = (unsigned char *)_pVal;
-    uint32_t *RES_ul        = (uint32_t *)_pVal;
-    unsigned short *RES_us  = (unsigned short *)_pVal;
+    unsigned char *RES_uc   = (unsigned char*)_pVal;
+    unsigned short *RES_us  = (unsigned short*)_pVal;
+    unsigned int *RES_ui    = (unsigned int*)_pVal;
 
     fa = GetFileOpenedInScilab(*_pF);
     if (fa == NULL)
@@ -114,11 +108,19 @@ void C2F(mputi)(int* _pF, int* _pVal, int* _iSize, char* _iOpt, int* _iErr)
 
     switch (iType)
     {
-        case TYPE_LONG :
+        case TYPE_LONG_LONG :
             for (i = 0; i < *_iSize ; i++)
             {
-                uint32_t val;
-                val = *(uint32_t*)RES_ul++;
+                unsigned long long val;
+                val = *(_pVal + i);
+                writeLongLong(val, fa, iEndian);
+            }
+            break;
+        case TYPE_INT :
+            for (i = 0; i < *_iSize ; i++)
+            {
+                unsigned int val;
+                val = *(RES_ui + i);
                 writeInt(val, fa, iEndian);
             }
             break;
@@ -126,7 +128,7 @@ void C2F(mputi)(int* _pF, int* _pVal, int* _iSize, char* _iOpt, int* _iErr)
             for (i = 0; i < *_iSize ; i++)
             {
                 unsigned short val;
-                val = *(unsigned short*)RES_us++;
+                val = *(RES_us + i);
                 writeShort(val, fa, iEndian);
             }
             break;
@@ -134,7 +136,7 @@ void C2F(mputi)(int* _pF, int* _pVal, int* _iSize, char* _iOpt, int* _iErr)
             for (i = 0; i < *_iSize ; i++)
             {
                 unsigned char val;
-                val = *(unsigned char*)RES_uc++;
+                val = *(RES_uc + i);
                 writeChar(val, fa, iEndian);
             }
             break;
index 37d4b1e..de19dc8 100644 (file)
@@ -27,7 +27,7 @@
  * @param char type[]
  * @param ierr
  */
-FILEIO_IMPEXP void C2F(mputi) (int *fd, int *res, int *n, char type[], int *ierr);
+FILEIO_IMPEXP void C2F(mputi) (int *fd, long long *res, int *n, char type[], int *ierr);
 
 #endif /* __MPUTI_H__ */
 
index c161b9f..9b99634 100644 (file)
@@ -34,17 +34,17 @@ s2      = int16(-23456);//0xA460
 s3      = int16(-123456);//0xFFFE1DC0
 s3t     = int16(7616);//0x1DC0
 //unsigned long big endian
-writedata("ulb", ["00" "00" "00" "7B" "00" "00" "B2" "6E" "00" "01" "E2" "40"]);
+writedata("ulb", ["00" "00" "00" "00" "00" "00" "00" "7B" "00" "00" "00" "00" "00" "00" "B2" "6E" "00" "00" "00" "00" "00" "01" "E2" "40"]);
 //unsigned long little endian
-writedata("ull", ["7B" "00" "00" "00" "6E" "B2" "00" "00" "40" "E2" "01" "00"]);
+writedata("ull", ["7B" "00" "00" "00" "00" "00" "00" "00" "6E" "B2" "00" "00" "00" "00" "00" "00" "40" "E2" "01" "00" "00" "00" "00" "00"]);
 //unsigned short big endian
 writedata("usb", ["00" "7B" "B2" "6E" "E2" "40"]);
 //unsigned short little endian
 writedata("usl", ["7B" "00" "6E" "B2" "40" "E2"]);
 //long big endian
-writedata("lb", ["FF" "FF" "FF" "85" "FF" "FF" "A4" "60" "FF" "FE" "1D" "C0"]);
+writedata("lb", ["FF" "FF" "FF" "FF" "FF" "FF" "FF" "85" "FF" "FF" "FF" "FF" "FF" "FF" "A4" "60" "FF" "FF" "FF" "FF" "FF" "FE" "1D" "C0"]);
 //long little endian
-writedata("ll", ["85" "FF" "FF" "FF" "60" "A4" "FF" "FF" "C0" "1D" "FE" "FF"]);
+writedata("ll", ["85" "FF" "FF" "FF" "FF" "FF" "FF" "FF" "60" "A4" "FF" "FF" "FF" "FF" "FF" "FF" "C0" "1D" "FE" "FF" "FF" "FF" "FF" "FF"]);
 //short big endian
 writedata("sb", ["FF" "85" "A4" "60" "1D" "C0"]);
 //short little endian
index d607ec1..b56512e 100644 (file)
@@ -40,18 +40,18 @@ s3      = int16(-123456);//0xFFFE1DC0
 s3t     = int16(7616);//0x1DC0
 
 //unsigned long big endian
-writedata("ulb", ["00" "00" "00" "7B" "00" "00" "B2" "6E" "00" "01" "E2" "40"]);
+writedata("ulb", ["00" "00" "00" "00" "00" "00" "00" "7B" "00" "00" "00" "00" "00" "00" "B2" "6E" "00" "00" "00" "00" "00" "01" "E2" "40"]);
 //unsigned long little endian
-writedata("ull", ["7B" "00" "00" "00" "6E" "B2" "00" "00" "40" "E2" "01" "00"]);
+writedata("ull", ["7B" "00" "00" "00" "00" "00" "00" "00" "6E" "B2" "00" "00" "00" "00" "00" "00" "40" "E2" "01" "00" "00" "00" "00" "00"]);
 //unsigned short big endian
 writedata("usb", ["00" "7B" "B2" "6E" "E2" "40"]);
 //unsigned short little endian
 writedata("usl", ["7B" "00" "6E" "B2" "40" "E2"]);
 
 //long big endian
-writedata("lb", ["FF" "FF" "FF" "85" "FF" "FF" "A4" "60" "FF" "FE" "1D" "C0"]);
+writedata("lb", ["FF" "FF" "FF" "FF" "FF" "FF" "FF" "85" "FF" "FF" "FF" "FF" "FF" "FF" "A4" "60" "FF" "FF" "FF" "FF" "FF" "FE" "1D" "C0"]);
 //long little endian
-writedata("ll", ["85" "FF" "FF" "FF" "60" "A4" "FF" "FF" "C0" "1D" "FE" "FF"]);
+writedata("ll", ["85" "FF" "FF" "FF" "FF" "FF" "FF" "FF" "60" "A4" "FF" "FF" "FF" "FF" "FF" "FF" "C0" "1D" "FE" "FF" "FF" "FF" "FF" "FF"]);
 //short big endian
 writedata("sb", ["FF" "85" "A4" "60" "1D" "C0"]);
 //short little endian
index 524652b..b4a7621 100644 (file)
@@ -23,63 +23,75 @@ u32 = uint32(123456);//0x0001E240
 s8 = int8(-123); //0x85
 s16 = int16(-23456);//0xA460
 s32 = int32(-123456);//0xFFFE1DC0
-ref_l   = hex2dec(["85" "FF" "FF" "FF" "60" "A4" "FF" "FF" "C0" "1D" "FE" "FF"]);
-ref_ll  = hex2dec(["85" "FF" "FF" "FF" "60" "A4" "FF" "FF" "C0" "1D" "FE" "FF"]);
+ref_l   = hex2dec(["85" "FF" "FF" "FF" "FF" "FF" "FF" "FF" "60" "A4" "FF" "FF" "FF" "FF" "FF" "FF" "C0" "1D" "FE" "FF" "FF" "FF" "FF" "FF"]);
+ref_ll  = hex2dec(["85" "FF" "FF" "FF" "FF" "FF" "FF" "FF" "60" "A4" "FF" "FF" "FF" "FF" "FF" "FF" "C0" "1D" "FE" "FF" "FF" "FF" "FF" "FF"]);
+ref_i   = hex2dec(["85" "FF" "FF" "FF" "60" "A4" "FF" "FF" "C0" "1D" "FE" "FF"]);
+ref_il  = hex2dec(["85" "FF" "FF" "FF" "60" "A4" "FF" "FF" "C0" "1D" "FE" "FF"]);
 ref_s   = hex2dec(["85" "FF" "60" "A4" "C0" "1D"]);
 ref_sl  = hex2dec(["85" "FF" "60" "A4" "C0" "1D"]);
-ref_ul  = hex2dec(["7B" "00" "00" "00" "6E" "B2" "00" "00" "40" "E2" "01" "00"]);
+ref_ul  = hex2dec(["7B" "00" "00" "00" "00" "00" "00" "00" "6E" "B2" "00" "00" "00" "00" "00" "00" "40" "E2" "01" "00" "00" "00" "00" "00"]);
+ref_ui  = hex2dec(["7B" "00" "00" "00" "6E" "B2" "00" "00" "40" "E2" "01" "00"]);
 ref_us  = hex2dec(["7B" "00" "6E" "B2" "40" "E2"]);
-ref_lb  = hex2dec(["FF" "FF" "FF" "85" "FF" "FF" "A4" "60" "FF" "FE" "1D" "C0"]);
+ref_lb  = hex2dec(["FF" "FF" "FF" "FF" "FF" "FF" "FF" "85" "FF" "FF" "FF" "FF" "FF" "FF" "A4" "60" "FF" "FF" "FF" "FF" "FF" "FE" "1D" "C0"]);
+ref_ib  = hex2dec(["FF" "FF" "FF" "85" "FF" "FF" "A4" "60" "FF" "FE" "1D" "C0"]);
 ref_sb  = hex2dec(["FF" "85" "A4" "60" "1D" "C0"]);
-ref_ulb = hex2dec(["00" "00" "00" "7B" "00" "00" "B2" "6E" "00" "01" "E2" "40"]);
+ref_ulb = hex2dec(["00" "00" "00" "00" "00" "00" "00" "7B" "00" "00" "00" "00" "00" "00" "B2" "6E" "00" "00" "00" "00" "00" "01" "E2" "40"]);
+ref_uib = hex2dec(["00" "00" "00" "7B" "00" "00" "B2" "6E" "00" "01" "E2" "40"]);
 ref_usb = hex2dec(["00" "7B" "B2" "6E" "E2" "40"]);
-ref_ull = hex2dec(["7B" "00" "00" "00" "6E" "B2" "00" "00" "40" "E2" "01" "00"]);
+ref_ull = hex2dec(["7B" "00" "00" "00" "00" "00" "00" "00" "6E" "B2" "00" "00" "00" "00" "00" "00" "40" "E2" "01" "00" "00" "00" "00" "00"]);
+ref_uil = hex2dec(["7B" "00" "00" "00" "6E" "B2" "00" "00" "40" "E2" "01" "00"]);
 ref_usl = hex2dec(["7B" "00" "6E" "B2" "40" "E2"]);
-//integer in long ( little endian )
+//integer in long long ( little endian )
 writedata("l", list(s8, s16, s32));
-assert_checkequal(readdata("l", 12), ref_l);
+assert_checkequal(readdata("l", 24), ref_l);
+//integer in int ( little endian )
 writedata("i", list(s8, s16, s32));
-assert_checkequal(readdata("i", 12), ref_l);
-//integer in little endian long
+assert_checkequal(readdata("i", 24), ref_i);
+//integer in little endian long long
 writedata("ll", list(s8, s16, s32));
-assert_checkequal(readdata("ll", 12), ref_ll);
+assert_checkequal(readdata("ll", 24), ref_ll);
+//integer in little endian int
 writedata("il", list(s8, s16, s32));
-assert_checkequal(readdata("il", 12), ref_ll);
+assert_checkequal(readdata("il", 24), ref_il);
 //integer in short
 writedata("s", list(s8, s16, s32));
 assert_checkequal(readdata("s", 6), ref_s);
 //integer in little endian short
 writedata("sl", list(s8, s16, s32));
 assert_checkequal(readdata("sl", 6), ref_sl);
-//integer in unsigned long
+//integer in unsigned long long
 writedata("ul", list(u8, u16, u32));
-assert_checkequal(readdata("ul", 12), ref_ul);
+assert_checkequal(readdata("ul", 24), ref_ul);
+//integer in unsigned int
 writedata("ui", list(u8, u16, u32));
-assert_checkequal(readdata("ui", 12), ref_ul);
+assert_checkequal(readdata("ui", 12), ref_ui);
 //integer in unsigned short
 writedata("us", list(u8, u16, u32));
 assert_checkequal(readdata("us", 6), ref_us);
-//integer in big endian long
+//integer in big endian long long
 writedata("lb", list(s8, s16, s32));
-assert_checkequal(readdata("lb", 12), ref_lb);
+assert_checkequal(readdata("lb", 24), ref_lb);
+//integer in big endian int
 writedata("ib", list(s8, s16, s32));
-assert_checkequal(readdata("ib", 12), ref_lb);
+assert_checkequal(readdata("ib", 12), ref_ib);
 //integer in big endian short
 writedata("sb", list(s8, s16, s32));
 assert_checkequal(readdata("sb", 6), ref_sb);
-//unsigned integer in unsigned big endian long
+//unsigned integer in unsigned big endian long long
 writedata("ulb", list(u8, u16, u32));
-assert_checkequal(readdata("ulb", 12), ref_ulb);
+assert_checkequal(readdata("ulb", 24), ref_ulb);
+//unsigned integer in unsigned big endian int
 writedata("uib", list(u8, u16, u32));
-assert_checkequal(readdata("uib", 12), ref_ulb);
+assert_checkequal(readdata("uib", 12), ref_uib);
 //unsigned integer in unsigned big endian short
 writedata("usb", list(u8, u16, u32));
 assert_checkequal(readdata("usb", 6), ref_usb);
-//unsigned integer in unsigned little endian long
+//unsigned integer in unsigned little endian long long
 writedata("ull", list(u8, u16, u32));
-assert_checkequal(readdata("ull", 12), ref_ull);
+assert_checkequal(readdata("ull", 24), ref_ull);
+//unsigned integer in unsigned little endian long long
 writedata("uil", list(u8, u16, u32));
-assert_checkequal(readdata("uil", 12), ref_ull);
+assert_checkequal(readdata("uil", 12), ref_uil);
 //unsigned integer in unsigned little endian short
 writedata("usl", list(u8, u16, u32));
 assert_checkequal(readdata("usl", 6), ref_usl);
index 834ca54..1c695e1 100644 (file)
@@ -28,30 +28,40 @@ s8 = int8(-123); //0x85
 s16 = int16(-23456);//0xA460
 s32 = int32(-123456);//0xFFFE1DC0
 
-ref_l   = hex2dec(["85" "FF" "FF" "FF" "60" "A4" "FF" "FF" "C0" "1D" "FE" "FF"]);
-ref_ll  = hex2dec(["85" "FF" "FF" "FF" "60" "A4" "FF" "FF" "C0" "1D" "FE" "FF"]);
+ref_l   = hex2dec(["85" "FF" "FF" "FF" "FF" "FF" "FF" "FF" "60" "A4" "FF" "FF" "FF" "FF" "FF" "FF" "C0" "1D" "FE" "FF" "FF" "FF" "FF" "FF"]);
+ref_ll  = hex2dec(["85" "FF" "FF" "FF" "FF" "FF" "FF" "FF" "60" "A4" "FF" "FF" "FF" "FF" "FF" "FF" "C0" "1D" "FE" "FF" "FF" "FF" "FF" "FF"]);
+ref_i   = hex2dec(["85" "FF" "FF" "FF" "60" "A4" "FF" "FF" "C0" "1D" "FE" "FF"]);
+ref_il  = hex2dec(["85" "FF" "FF" "FF" "60" "A4" "FF" "FF" "C0" "1D" "FE" "FF"]);
 ref_s   = hex2dec(["85" "FF" "60" "A4" "C0" "1D"]);
 ref_sl  = hex2dec(["85" "FF" "60" "A4" "C0" "1D"]);
-ref_ul  = hex2dec(["7B" "00" "00" "00" "6E" "B2" "00" "00" "40" "E2" "01" "00"]);
+ref_ul  = hex2dec(["7B" "00" "00" "00" "00" "00" "00" "00" "6E" "B2" "00" "00" "00" "00" "00" "00" "40" "E2" "01" "00" "00" "00" "00" "00"]);
+ref_ui  = hex2dec(["7B" "00" "00" "00" "6E" "B2" "00" "00" "40" "E2" "01" "00"]);
 ref_us  = hex2dec(["7B" "00" "6E" "B2" "40" "E2"]);
-ref_lb  = hex2dec(["FF" "FF" "FF" "85" "FF" "FF" "A4" "60" "FF" "FE" "1D" "C0"]);
+ref_lb  = hex2dec(["FF" "FF" "FF" "FF" "FF" "FF" "FF" "85" "FF" "FF" "FF" "FF" "FF" "FF" "A4" "60" "FF" "FF" "FF" "FF" "FF" "FE" "1D" "C0"]);
+ref_ib  = hex2dec(["FF" "FF" "FF" "85" "FF" "FF" "A4" "60" "FF" "FE" "1D" "C0"]);
 ref_sb  = hex2dec(["FF" "85" "A4" "60" "1D" "C0"]);
-ref_ulb = hex2dec(["00" "00" "00" "7B" "00" "00" "B2" "6E" "00" "01" "E2" "40"]);
+ref_ulb = hex2dec(["00" "00" "00" "00" "00" "00" "00" "7B" "00" "00" "00" "00" "00" "00" "B2" "6E" "00" "00" "00" "00" "00" "01" "E2" "40"]);
+ref_uib = hex2dec(["00" "00" "00" "7B" "00" "00" "B2" "6E" "00" "01" "E2" "40"]);
 ref_usb = hex2dec(["00" "7B" "B2" "6E" "E2" "40"]);
-ref_ull = hex2dec(["7B" "00" "00" "00" "6E" "B2" "00" "00" "40" "E2" "01" "00"]);
+ref_ull = hex2dec(["7B" "00" "00" "00" "00" "00" "00" "00" "6E" "B2" "00" "00" "00" "00" "00" "00" "40" "E2" "01" "00" "00" "00" "00" "00"]);
+ref_uil = hex2dec(["7B" "00" "00" "00" "6E" "B2" "00" "00" "40" "E2" "01" "00"]);
 ref_usl = hex2dec(["7B" "00" "6E" "B2" "40" "E2"]);
 
-//integer in long ( little endian )
+//integer in long long ( little endian )
 writedata("l", list(s8, s16, s32));
-assert_checkequal(readdata("l", 12), ref_l);
+assert_checkequal(readdata("l", 24), ref_l);
+
+//integer in int ( little endian )
 writedata("i", list(s8, s16, s32));
-assert_checkequal(readdata("i", 12), ref_l);
+assert_checkequal(readdata("i", 24), ref_i);
 
-//integer in little endian long
+//integer in little endian long long
 writedata("ll", list(s8, s16, s32));
-assert_checkequal(readdata("ll", 12), ref_ll);
+assert_checkequal(readdata("ll", 24), ref_ll);
+
+//integer in little endian int
 writedata("il", list(s8, s16, s32));
-assert_checkequal(readdata("il", 12), ref_ll);
+assert_checkequal(readdata("il", 24), ref_il);
 
 //integer in short
 writedata("s", list(s8, s16, s32));
@@ -61,41 +71,49 @@ assert_checkequal(readdata("s", 6), ref_s);
 writedata("sl", list(s8, s16, s32));
 assert_checkequal(readdata("sl", 6), ref_sl);
 
-//integer in unsigned long
+//integer in unsigned long long
 writedata("ul", list(u8, u16, u32));
-assert_checkequal(readdata("ul", 12), ref_ul);
+assert_checkequal(readdata("ul", 24), ref_ul);
+
+//integer in unsigned int
 writedata("ui", list(u8, u16, u32));
-assert_checkequal(readdata("ui", 12), ref_ul);
+assert_checkequal(readdata("ui", 12), ref_ui);
 
 //integer in unsigned short
 writedata("us", list(u8, u16, u32));
 assert_checkequal(readdata("us", 6), ref_us);
 
-//integer in big endian long
+//integer in big endian long long
 writedata("lb", list(s8, s16, s32));
-assert_checkequal(readdata("lb", 12), ref_lb);
+assert_checkequal(readdata("lb", 24), ref_lb);
+
+//integer in big endian int
 writedata("ib", list(s8, s16, s32));
-assert_checkequal(readdata("ib", 12), ref_lb);
+assert_checkequal(readdata("ib", 12), ref_ib);
 
 //integer in big endian short
 writedata("sb", list(s8, s16, s32));
 assert_checkequal(readdata("sb", 6), ref_sb);
 
-//unsigned integer in unsigned big endian long
+//unsigned integer in unsigned big endian long long
 writedata("ulb", list(u8, u16, u32));
-assert_checkequal(readdata("ulb", 12), ref_ulb);
+assert_checkequal(readdata("ulb", 24), ref_ulb);
+
+//unsigned integer in unsigned big endian int
 writedata("uib", list(u8, u16, u32));
-assert_checkequal(readdata("uib", 12), ref_ulb);
+assert_checkequal(readdata("uib", 12), ref_uib);
 
 //unsigned integer in unsigned big endian short
 writedata("usb", list(u8, u16, u32));
 assert_checkequal(readdata("usb", 6), ref_usb);
 
-//unsigned integer in unsigned little endian long
+//unsigned integer in unsigned little endian long long
 writedata("ull", list(u8, u16, u32));
-assert_checkequal(readdata("ull", 12), ref_ull);
+assert_checkequal(readdata("ull", 24), ref_ull);
+
+//unsigned integer in unsigned little endian long long
 writedata("uil", list(u8, u16, u32));
-assert_checkequal(readdata("uil", 12), ref_ull);
+assert_checkequal(readdata("uil", 12), ref_uil);
 
 //unsigned integer in unsigned little endian short
 writedata("usl", list(u8, u16, u32));
index fbf4afa..be39d34 100644 (file)
@@ -62,6 +62,9 @@ int C2F(tpconv)(int *xtyp, int *ytyp, int *n, void *dx, int *incx, void *dy, int
                 case 4:
                     TCONV(double, integer);
                     break;
+                case 8:
+                    TCONV(double, long long);
+                    break;
                 case 11:
                     TCONV(double, unsigned char);
                     break;
@@ -71,6 +74,9 @@ int C2F(tpconv)(int *xtyp, int *ytyp, int *n, void *dx, int *incx, void *dy, int
                 case 14:
                     TCONV(double, unsigned int);
                     break;
+                case 18:
+                    TCONV(double, unsigned long long);
+                    break;
             }
             break;
         case 1:
@@ -88,6 +94,9 @@ int C2F(tpconv)(int *xtyp, int *ytyp, int *n, void *dx, int *incx, void *dy, int
                 case 4:
                     TCONV(integer1, integer);
                     break;
+                case 8:
+                    TCONV(integer1, long long);
+                    break;
                 case 11:
                     TCONV(integer1, unsigned char);
                     break;
@@ -97,6 +106,9 @@ int C2F(tpconv)(int *xtyp, int *ytyp, int *n, void *dx, int *incx, void *dy, int
                 case 14:
                     TCONV(integer1, unsigned int);
                     break;
+                case 18:
+                    TCONV(integer1, unsigned long long);
+                    break;
             }
             break;
         case 2:
@@ -114,6 +126,9 @@ int C2F(tpconv)(int *xtyp, int *ytyp, int *n, void *dx, int *incx, void *dy, int
                 case 4:
                     TCONV(integer2, integer);
                     break;
+                case 8:
+                    TCONV(integer2, long long);
+                    break;
                 case 11:
                     TCONV(integer2, unsigned char);
                     break;
@@ -123,6 +138,9 @@ int C2F(tpconv)(int *xtyp, int *ytyp, int *n, void *dx, int *incx, void *dy, int
                 case 14:
                     TCONV(integer2, unsigned int);
                     break;
+                case 18:
+                    TCONV(integer2, unsigned long long);
+                    break;
             }
             break;
         case 4:
@@ -140,6 +158,9 @@ int C2F(tpconv)(int *xtyp, int *ytyp, int *n, void *dx, int *incx, void *dy, int
                 case 4:
                     TCONV(integer, integer);
                     break;
+                case 8:
+                    TCONV(integer, long long);
+                    break;
                 case 11:
                     TCONV(integer, unsigned char);
                     break;
@@ -149,6 +170,41 @@ int C2F(tpconv)(int *xtyp, int *ytyp, int *n, void *dx, int *incx, void *dy, int
                 case 14:
                     TCONV(integer, unsigned int);
                     break;
+                case 18:
+                    TCONV(integer, unsigned long long);
+                    break;
+            }
+            break;
+        case 8:
+            switch (*ytyp)
+            {
+                case 0:
+                    TCONV(long long, double);
+                    break;
+                case 1:
+                    TCONV(long long, integer1);
+                    break;
+                case 2:
+                    TCONV(long long, integer2);
+                    break;
+                case 4:
+                    TCONV(long long, integer);
+                    break;
+                case 8:
+                    TCONV(long long, long long);
+                    break;
+                case 11:
+                    TCONV(long long, unsigned char);
+                    break;
+                case 12:
+                    TCONV(long long, unsigned short);
+                    break;
+                case 14:
+                    TCONV(long long, unsigned int);
+                    break;
+                case 18:
+                    TCONV(long long, unsigned long long);
+                    break;
             }
             break;
         case 11:
@@ -166,6 +222,9 @@ int C2F(tpconv)(int *xtyp, int *ytyp, int *n, void *dx, int *incx, void *dy, int
                 case 4:
                     TCONV(unsigned char, integer);
                     break;
+                case 8:
+                    TCONV(unsigned char, long long);
+                    break;
                 case 11:
                     TCONV(unsigned char, unsigned char);
                     break;
@@ -175,6 +234,9 @@ int C2F(tpconv)(int *xtyp, int *ytyp, int *n, void *dx, int *incx, void *dy, int
                 case 14:
                     TCONV(unsigned char, unsigned int);
                     break;
+                case 18:
+                    TCONV(unsigned char, unsigned long long);
+                    break;
             }
             break;
         case 12:
@@ -192,6 +254,9 @@ int C2F(tpconv)(int *xtyp, int *ytyp, int *n, void *dx, int *incx, void *dy, int
                 case 4:
                     TCONV(unsigned short, integer);
                     break;
+                case 8:
+                    TCONV(unsigned short, long long);
+                    break;
                 case 11:
                     TCONV(unsigned short, unsigned char);
                     break;
@@ -201,6 +266,9 @@ int C2F(tpconv)(int *xtyp, int *ytyp, int *n, void *dx, int *incx, void *dy, int
                 case 14:
                     TCONV(unsigned short, unsigned int);
                     break;
+                case 18:
+                    TCONV(unsigned short, unsigned long long);
+                    break;
             }
             break;
         case 14:
@@ -218,6 +286,9 @@ int C2F(tpconv)(int *xtyp, int *ytyp, int *n, void *dx, int *incx, void *dy, int
                 case 4:
                     TCONV(unsigned int, integer);
                     break;
+                case 8:
+                    TCONV(unsigned int, long long);
+                    break;
                 case 11:
                     TCONV(unsigned int, unsigned char);
                     break;
@@ -227,6 +298,41 @@ int C2F(tpconv)(int *xtyp, int *ytyp, int *n, void *dx, int *incx, void *dy, int
                 case 14:
                     TCONV(unsigned int, unsigned int);
                     break;
+                case 18:
+                    TCONV(unsigned int, unsigned long long);
+                    break;
+            }
+            break;
+        case 18:
+            switch (*ytyp)
+            {
+                case 0:
+                    TCONV(unsigned long long, double);
+                    break;
+                case 1:
+                    TCONV(unsigned long long, integer1);
+                    break;
+                case 2:
+                    TCONV(unsigned long long, integer2);
+                    break;
+                case 4:
+                    TCONV(unsigned long long, integer);
+                    break;
+                case 8:
+                    TCONV(unsigned long long, long long);
+                    break;
+                case 11:
+                    TCONV(unsigned long long, unsigned char);
+                    break;
+                case 12:
+                    TCONV(unsigned long long, unsigned short);
+                    break;
+                case 14:
+                    TCONV(unsigned long long, unsigned int);
+                    break;
+                case 18:
+                    TCONV(unsigned long long, unsigned long long);
+                    break;
             }
             break;
     }
index 0bdfdbe..4659b97 100644 (file)
@@ -13,6 +13,7 @@ c
        integer topk,rhsk,fd
        logical checkrhs,checklhs,getsmat,checkval,getscalar
        character*4 ityp
+       INTEGER*8 val
 
        include 'stack.h'
 c
@@ -73,7 +74,7 @@ c       if(nlr2.eq.3) ik=3
       elseif(ityp(ik:ik).eq.'i') then
           it1=it1+4
        elseif(ityp(ik:ik).eq.'l') then
-          it1=it1+4
+          it1=it1+8
        else
           buf='Incorrect integer type: '//ityp
           call error(9991)