Tuxdo
FML 支持字段类型 Supported Field Types
[code lang="cpp"]
#define FLD_SHORT 0 /* short int */
#define FLD_LONG 1 /* long int */
#define FLD_CHAR 2 /* character */
#define FLD_FLOAT 3 /* single-precision float */
#define FLD_DOUBLE 4 /* double-precision float */
#define FLD_STRING 5 /* string - null terminated */
#define FLD_CARRAY 6 /* character array */
#define FLD_PTR 9 /* pointer to a buffer */
#define FLD_FML32 10 /* embedded FML32 buffer */
#define FLD_VIEW32 11 /* embedded VIEW32 buffer */
#define FLD_MBSTRING 12 /* multibyte character array */
[/code]
FML 字段ID的类型定义 FLDID32
[code lang="cpp"]
typedef TM32U FLDID32;
[/code]
32位无符号整型(4字节)
根据文档说明创建FML定义文件(Creating Field Table Files)时字段ID的索引值范围应控制在1-33554431
For FML32: between 1 and 33,554,431, inclusive
0x01FFFFFF==33554431
FLDID32说明32位(bit)中1-7位为类型,8-32位为索引值
[code lang="cpp"]
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]){
unsigned int nFid = 0;
unsigned int nID= 0;
unsigned int nType= 0;
nFid = 167782167;
nID = nFid & 0x01FFFFFF;
nType= nFid & 0xFE000000;
nType = htonl(nType);
printf("fidid:%u, type:%u, index:%u\n",nFid, nType >> 1, nID);
nFid = 33564440;
nID = nFid & 0x01FFFFFF;
nType= nFid & 0xFE000000;
nType = htonl(nType);
printf("fidid:%u, type:%u, index:%u\n",nFid, nType >> 1, nID);
return 0;
}
[/code]
文章评论