What is the difference between an APL socket created in the 32 bit Classic V12 and a 64 bit TCP socket of style APL?
I have a 32 bit application that I had done in C++ and I do a mapping of the values using the quadAV character set. Everything works well with the 32bit v12 but with the 64bit v12, I am getting an error.
Thanks.
Dyalog v12 32bit vs 64 bit TCPSockets
-
- Posts: 43
- Joined: Wed May 13, 2009 12:36 pm
Re: Dyalog v12 32bit vs 64 bit TCPSockets
The communication of APL arrays down sockets is based on "sender sends native", "receiver translates". Thus a 64 bit big endian version sends arrays with 64 bit length, zones, shape. If the receiver is 32 little endian it has to do the translation and the re-ordering. There is a header on the transmission that tells you what architecture the sender is using. The header uses "network byte order" which happens to be big-endian. The first 32 bits are the length of the communication. The second 32 bits specify the architecture although only 7 are used.
There is an exception for this, the TCPSocket object can take a parameter that forces "classic" or "unicode". This was to support the new unicode versions talking to old classic versions that didn't yet know about unicode.
This fragment is taken from d_machin.h which is issued with Dyalog APL as part of the support for AP development:
#define ARCH_LITTLE 0x80
#define ARCH_DEXTEND 0x40
#define ARCH_64BIT 0x20
#define ARCH_DALIGN 0x10
#define ARCH_MACH 0x08 // not an ARCH this one is MACHINETYPE
#define ARCH_UNICODE 0x04
#define ARCH_IALIGN 0x02 //need this to distinguish ARM from INTEL
#define ARCH_SPARE 0x01
From a socket point of view you should worry about ARCH_LITTLE which is set for little endian; ARCH_64BIT which indicates that the sender is a 64 bit platform; ARCH_UNICODE which is sent if the platform is Unicode or the "Encoding" property has forced Unicode.
If you are only sending arrays and not ⎕OR's or namespaces then ARCH_UNICODE probably doesn't worry you. The Unicode character arrays have a different ELTYPE coded in the array itself. So ELTYPE 0 is a classic array; ELTYPE 7 is UCS-1; ELTYPE 8 is UCS-2; ELTYPE 9 is UCS-4. If you want to be forward thinking then version 13 will add ELTYPE 10 for complex numbers and ELTYPE 12 for decimal floating point in DPD format.
ARCH_MACH is for backwards compatibility on component files so you can ignore it. ARCH_IALIGN is for workspaces and doesn't affect sockets. ARCH_DEXTEND has not been used yet on any of our interpreters.
There is an exception for this, the TCPSocket object can take a parameter that forces "classic" or "unicode". This was to support the new unicode versions talking to old classic versions that didn't yet know about unicode.
This fragment is taken from d_machin.h which is issued with Dyalog APL as part of the support for AP development:
#define ARCH_LITTLE 0x80
#define ARCH_DEXTEND 0x40
#define ARCH_64BIT 0x20
#define ARCH_DALIGN 0x10
#define ARCH_MACH 0x08 // not an ARCH this one is MACHINETYPE
#define ARCH_UNICODE 0x04
#define ARCH_IALIGN 0x02 //need this to distinguish ARM from INTEL
#define ARCH_SPARE 0x01
From a socket point of view you should worry about ARCH_LITTLE which is set for little endian; ARCH_64BIT which indicates that the sender is a 64 bit platform; ARCH_UNICODE which is sent if the platform is Unicode or the "Encoding" property has forced Unicode.
If you are only sending arrays and not ⎕OR's or namespaces then ARCH_UNICODE probably doesn't worry you. The Unicode character arrays have a different ELTYPE coded in the array itself. So ELTYPE 0 is a classic array; ELTYPE 7 is UCS-1; ELTYPE 8 is UCS-2; ELTYPE 9 is UCS-4. If you want to be forward thinking then version 13 will add ELTYPE 10 for complex numbers and ELTYPE 12 for decimal floating point in DPD format.
ARCH_MACH is for backwards compatibility on component files so you can ignore it. ARCH_IALIGN is for workspaces and doesn't affect sockets. ARCH_DEXTEND has not been used yet on any of our interpreters.
-
- Posts: 43
- Joined: Wed May 13, 2009 12:36 pm
Re: Dyalog v12 32bit vs 64 bit TCPSockets
This link covers the introduction of 64 bit to Dyalog APL. Some of it is relevant to the socket issue. http://www.dyalog.com/uploads/conferenc ... /64bit.pdf
"Geoff Streeter: 64-bit Dyalog APL"
"Geoff Streeter: 64-bit Dyalog APL"
Re: Dyalog v12 32bit vs 64 bit TCPSockets
Thanks, Geoff. I will review the material.