home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume27 / conv123 / part01 / lotus.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-05  |  13.2 KB  |  501 lines

  1. /* @(#) $Revision: 1.0 */      
  2.  
  3. /*
  4.  * Definitions for .wks types of records, as structures
  5.  * All elements are type char, even when numeric...
  6.  * That's because they must be byte-aligned (and, by the
  7.  * way, byte-swapped) in the .wks file.
  8.  */
  9.  
  10. typedef struct  {
  11.     char    opcode[2];        /* 02h (02d) */
  12.     char    record_length[2];    /* 2d */
  13.     char    ff_version[2];        /* file format version (0404h,1028d) */
  14. } BOF;
  15.  
  16. typedef struct  {
  17.     char    opcode[2];        /* 06h (06d) */
  18.     char    record_length[2];    /* 8d */
  19.     char    start_column[2];
  20.     char    start_row[2];
  21.     char    end_column[2];
  22.     char    end_row[2];
  23. } RANGE;
  24.  
  25. typedef struct  {
  26.     char    opcode[2];        /* 96h (150d) */
  27.     char    record_length[2];    /* variable */
  28.     char    column_number[2];
  29.     char    lowest_row[2];        /* lowest row number of active cell */
  30.     char    highest_row[2];        /* highest row number of active cell */
  31. } CPI;
  32.  
  33. typedef struct  {
  34.     char    opcode[2];        /* 2Fh (47d) */
  35.     char    record_length[2];    /* 1d */
  36.     char    iteration_count[1];
  37. } CALCCOUNT;
  38.  
  39. typedef struct  {
  40.     char    opcode[2];        /* 02h (02d) */
  41.     char    record_length[2];    /* 1d */
  42.     char    recalculation[1];    /* 00h is manual, FFh is automatic */
  43. } CALCMODE;
  44.  
  45. typedef struct  {
  46.     char    opcode[2];        /* 03h (03d) */
  47.     char    record_length[2];    /* 1d */
  48.     char    calc_order[1];        /* 00h is natural recalc order */
  49.                     /* 01h is recalculation by column */
  50.                     /* FFh is recalculation by row */
  51. } CALCORDER;
  52.  
  53. typedef struct  {
  54.     char    opcode[2];        /* 04h (04d) */
  55.     char    record_length[2];    /* 1d */
  56.     char    window_split[1];    /* 00h is not split */
  57.                     /* 01h is vertical split */
  58.                     /* FFh is horizontal split */
  59. } SPLIT;
  60.  
  61. typedef struct  {
  62.     char    opcode[2];        /* 05h (05d) */
  63.     char    record_length[2];    /* 1d */
  64.     char    window_sync[1];        /* 00h is not synchronized */
  65.                     /* FFh is window synchronized */
  66. } SYNC;
  67.  
  68. typedef struct  {
  69.     char    opcode[2];        /* 07h (07d) */
  70.     char    record_length[2];    /* 32d */
  71.     char    cc_column[2];        /* current cursor column */
  72.     char    cc_row[2];        /* current cursor row */
  73.     char    cell_format[1];
  74.     char    unused1[1];        /* must be 00h ? */
  75.     char    column_width[2];
  76.     char    ncol_on_screen[2];    /* number of columns on screen */
  77.     char    nrow_on_screen[2];    /* number of rows on screen */
  78.     char    leftmost_column[2];
  79.     char    top_row[2];
  80.     char    ntitle_col[2];        /* number of title columns */
  81.     char    ntitle_row[2];        /* number of title rows */
  82.     char    ltitle_col[2];        /* left title column */
  83.     char    ttitle_row[2];        /* top title row */
  84.     char    borderwd_col[2];    /* border width column */
  85.     char    borderwd_row[2];    /* border width row */
  86.     char    window_width[2];
  87.     char    unused2[1];        /* must be 00h */
  88.     char    unused3[1];        /* this spot was undocumented */
  89. } WINDOW1;
  90.  
  91. typedef struct  {
  92.     char    opcode[2];        /* 08h (08d) */
  93.     char    record_length[2];    /* 3d */
  94.     char    column_number[2];
  95.     char    column_width[1];
  96. } COLW1;
  97.  
  98. typedef struct  {
  99.     char    opcode[2];        /* 31h (49d) */
  100.     char    record_length[2];    /* 1d */
  101.     char    cursor_window[1];    /* 01h is cursor in window 1 */
  102.                     /* 02h is cursor in window 2 */
  103. } CURSORW12;
  104.  
  105. typedef struct  {
  106.     char    opcode[2];        /* 0Bh (11d) */
  107.     char    record_length[2];    /* 24d */
  108.     char    range_name[16];
  109.     char    start_column[2];
  110.     char    start_row[2];
  111.     char    end_column[2];
  112.     char    end_row[2];
  113. } RNAME;
  114.  
  115. typedef struct {
  116.     char    y_start_col[2];        /* y-range start column */
  117.     char    y_start_row[2];        /* y-range start row */
  118.     char    y_end_col[2];        /* y-range end column */
  119.     char    y_end_row[2];        /* y-range end row */
  120. } grange;
  121.  
  122. typedef struct  {
  123.     char    opcode[2];        /* 2Eh (45d) */
  124.     char    record_length[2];    /* 453d */
  125.     char    graph_name[16];        /* null-terminated */
  126.     char    x_start_col[2];        /* x-range start column */
  127.     char    x_start_row[2];        /* x-range start row */
  128.     char    x_end_col[2];        /* x-range end column */
  129.     char    x_end_row[2];        /* x-range end row */
  130.     grange    yd_range[6];        /* y-range structures (data) */
  131.     grange    yl_range[6];        /* y-range structures (labels) */
  132.     char    graph_type[1];        /* 0=XY, 1=bar, 2=pie, 3=unused, */
  133.                     /* 4=line, 5=stacked bar      */
  134.     char    grid[1];        /* 0=none, 1=horizontal, 2=vertical */
  135.                     /* 3=both                */
  136.     char    color[1];        /* 0=b&w, FFh=color */
  137.     char    y_lformat[6];        /* y-range line formats */
  138.                     /* 0=none, 1=line, 2=symbol, */
  139.                     /* 3=line-symbol          */
  140.     char    y_dlalign[6];        /* y-range data label alignment */
  141.                     /* 0=center, 1=right, 2=below,  */
  142.                     /* 3=left, 4=above        */
  143.     char    x_scale[1];        /* 0=auto, 1=manual */
  144.     char    x_low_limit[8];        /* x-range lower limit (real) */
  145.     char    x_up_limit[8];        /* x-range upper limit (real) */
  146.     char    y_scale[1];        /* 0=auto, 1=manual */
  147.     char    y_low_limit[8];        /* y-range lower limit (real) */
  148.     char    y_up_limit[8];        /* y-range upper limit (real) */
  149.     char    first_title[40];    /* top of the graph */
  150.     char    second_title[40];    /* just below the first */
  151.     char    x_title[40];        /* bottom of the graph */
  152.     char    y_title[40];        /* side of the graph */
  153.     char    y_legend[6][20];
  154.     char    x_format[1];
  155.     char    y_format[1];
  156.     char    skip_factor[2];
  157.     char    unknown[2];
  158. } NGRAPH;
  159.  
  160. typedef struct  {
  161.     char    opcode[2];        /* 18h (24d) */
  162.     char    record_length[2];    /* 25d */
  163.     char    table_ind[1];        /* 00h is no table */
  164.                     /* 01h is table 1 */
  165.                     /* 02h is table 2 */
  166.     char    table_start_column[2];
  167.     char    table_start_row[2];
  168.     char    table_end_column[2];
  169.     char    table_end_row[2];
  170.     char    cell1_start_column[2];
  171.     char    cell1_start_row[2];
  172.     char    cell1_end_column[2];
  173.     char    cell1_end_row[2];
  174.     char    cell2_start_column[2];
  175.     char    cell2_start_row[2];
  176.     char    cell2_end_column[2];
  177.     char    cell2_end_row[2];
  178. } TABLE;
  179.  
  180. typedef struct  {
  181.     char    opcode[2];        /* 19h (25d) */
  182.     char    record_length[2];    /* 25d */
  183.     char    input_start_column[2];
  184.     char    input_start_row[2];
  185.     char    input_end_column[2];
  186.     char    input_end_row[2];
  187.     char    output_start_column[2];
  188.     char    output_start_row[2];
  189.     char    output_end_column[2];
  190.     char    output_end_row[2];
  191.     char    criteria_start_column[2];
  192.     char    criteria_start_row[2];
  193.     char    criteria_end_column[2];
  194.     char    criteria_end_row[2];
  195.     char    command[1];        /* 00h is no command */
  196.                     /* 01h is find */
  197.                     /* 02h is extract */
  198.                     /* 03h is delete */
  199.                     /* 04h is unique */
  200. } QRANGE; /* query range */
  201.  
  202. typedef struct  {
  203.     char    opcode[2];        /* 1Ah (26d) */
  204.     char    record_length[2];    /* 8d */
  205.     char    start_column[2];
  206.     char    start_row[2];
  207.     char    end_column[2];
  208.     char    end_row[2];
  209. } PRANGE; /* print range */
  210.  
  211. typedef struct  {
  212.     char    opcode[2];        /* h (d) */
  213.     char    record_length[2];    /* d */
  214. } FORMAT;
  215.  
  216. typedef struct  {
  217.     char    opcode[2];        /* 1Ch (28d) */
  218.     char    record_length[2];    /* 8d */
  219.     char    start_column[2];
  220.     char    start_row[2];
  221.     char    end_column[2];
  222.     char    end_row[2];
  223. } FRANGE; /* fill range */
  224.  
  225. typedef struct  {
  226.     char    opcode[2];        /* 1Bh (27d) */
  227.     char    record_length[2];    /* 8d */
  228.     char    start_column[2];
  229.     char    start_row[2];
  230.     char    end_column[2];
  231.     char    end_row[2];
  232. } SRANGE; /* sort range */
  233.  
  234. typedef struct  {
  235.     char    opcode[2];        /* 1Dh (29d) */
  236.     char    record_length[2];    /* 9d */
  237.     char    start_column[2];
  238.     char    start_row[2];
  239.     char    end_column[2];
  240.     char    end_row[2];
  241.     char    sort_order[1];        /* 00h is descending, FFh ascending */
  242. } KRANGE; /* primary sort key range */
  243.  
  244. typedef struct  {
  245.     char    opcode[2];        /* 23h (35d) */
  246.     char    record_length[2];    /* 9d */
  247.     char    start_column[2];
  248.     char    start_row[2];
  249.     char    end_column[2];
  250.     char    end_row[2];
  251.     char    sort_order[1];        /* 00h is descending, FFh ascending */
  252. } KRANGE2; /* secondary sort key range */
  253.  
  254.  
  255. typedef struct  {
  256.     char    opcode[2];        /* 67h (103d) */
  257.     char    record_length[2];    /* 25d */
  258.     char    depvar_start_column[2];
  259.     char    depvar_start_row[2];
  260.     char    depvar_end_column[2];
  261.     char    depvar_end_row[2];
  262.     char    indvar_start_column[2];
  263.     char    indvar_start_row[2];
  264.     char    invdar_end_column[2];
  265.     char    indvar_end_row[2];
  266.     char    output_start_column[2];
  267.     char    output_start_row[2];
  268.     char    output_end_column[2];
  269.     char    output_end_row[2];
  270.     char    zero_intercept[1];    /* 00h is not forced */
  271.                     /* -1 is forced intercept at origin */
  272. } RRANGES; /* linear regression ranges */
  273.  
  274. typedef struct  {
  275.     char    opcode[2];        /* 20h (32d) */
  276.     char    record_length[2];    /* 16d */
  277.     char    values_start_column[2];
  278.     char    values_start_row[2];
  279.     char    values_end_column[2];
  280.     char    values_end_row[2];
  281.     char    bin_start_column[2];
  282.     char    bin_start_row[2];
  283.     char    bin_end_column[2];
  284.     char    bin_end_row[2];
  285. } HRANGE; /* distribution range */
  286.  
  287. typedef struct  {
  288.     char    opcode[2];        /* 24h (36d) */
  289.     char    record_length[2];    /* 1d */
  290.     char    protection[1];        /* 00h is global off, 01h is on */
  291. } PROTECT; /* global protection */
  292.  
  293. typedef struct  {
  294.     char    opcode[2];        /* 25h (37d) */
  295.     char    record_length[2];    /* 242d */
  296.     char    footer_string[242];    /* NULL terminated ASCII */
  297. } FOOTER; /* print footer */
  298.  
  299. typedef struct  {
  300.     char    opcode[2];        /* 26h (38d) */
  301.     char    record_length[2];    /* 242d */
  302.     char    header_string[242];    /* NULL terminated ASCII */
  303. } HEADER; /* print header */
  304.  
  305. typedef struct  {
  306.     char    opcode[2];        /* 27h (39d) */
  307.     char    record_length[2];    /* 40d */
  308.     char    setup_string[40];    /* NULL terminated ASCII */
  309. } SETUP; /* print setup string */
  310.  
  311. typedef struct  {
  312.     char    opcode[2];        /* 28h (40d) */
  313.     char    record_length[2];    /* 10d */
  314.     char    left_margin[2];
  315.     char    right_margin[2];
  316.     char    page_length[2];
  317.     char    top_margin[2];
  318.     char    bottom_margin[2];
  319. } MARGINS;
  320.  
  321. typedef struct  {
  322.     char    opcode[2];        /* 29h (41d) */
  323.     char    record_length[2];    /* 1d */
  324.     char    label_alignment[1];    /* 27h is left */
  325.                     /* 22h is right */
  326.                     /* 5Eh is center */
  327. } LABELFMT;
  328.  
  329. typedef struct  {
  330.     char    opcode[2];        /* 2Ah (42d) */
  331.     char    record_length[2];    /* 16d */
  332.     char    border_start_column[2];
  333.     char    border_start_row[2];
  334.     char    border_end_column[2];
  335.     char    border_end_row[2];
  336.     char    col_start_column[2];
  337.     char    col_start_row[2];
  338.     char    col_end_column[2];
  339.     char    col_end_row[2];
  340. } TITLES; /* print borders */
  341.  
  342. /***********************************************/
  343. /* Cell definitions                            */
  344. /***********************************************/
  345.  
  346. typedef struct  {
  347.     char    opcode[2];        /* 0Ch (12d) */
  348.     char    record_length[2];    /* 5d */
  349.     char    format[1];
  350.     char    column[2];
  351.     char    row[2];
  352. } BLANK; /* blank cell */
  353.  
  354. typedef struct  {
  355.     char    opcode[2];        /* 0Dh (13d) */
  356.     char    record_length[2];    /* 7d */
  357.     char    format[1];
  358.     char    column[2];
  359.     char    row[2];
  360.     char    value[2];
  361. } INTEGER;
  362.  
  363. typedef struct  {
  364.     char    opcode[2];        /* 0Eh (14d) */
  365.     char    record_length[2];    /* 13d */
  366.     char    format[1];
  367.     char    column[2];
  368.     char    row[2];
  369.     char    value[8];
  370. } NUMBER;
  371.  
  372. typedef struct  {
  373.     char    opcode[2];        /* 0Fh (15d) */
  374.     char    record_length[2];    /* variable */
  375.     char    format[1];
  376.     char    column[2];
  377.     char    row[2];
  378.     char    position[1];
  379.     char    string[239];        /* NULL terminated ASCII */
  380. } LABEL;
  381.  
  382. typedef struct  {
  383.     char    opcode[2];        /* 10h (16d) */
  384.     char    record_length[2];    /* variable to 2064 */
  385.     char    format[1];
  386.     char    column[2];
  387.     char    row[2];
  388.     char    value[8];
  389.     char    formula_size[2];
  390.     char    formula_code[256];    /* NOTE: Lotus allows up to 2048! */
  391. } FORMULA;
  392.  
  393.  
  394. typedef struct  {
  395.     char    opcode[2];        /* 01h (01d) */
  396.     char    record_length[2];    /* 0d */
  397. } LEOF;  /* changed name to avoid using standard EOF */
  398.  
  399. /**************************************/
  400. /* opcode value definitions           */
  401. /**************************************/
  402.  
  403. #define BOF_op ((unsigned short)0x00)
  404. #define BOF_len ((unsigned short)2)
  405.  
  406. #define LEOF_op ((unsigned short)0x01)
  407. #define LEOF_len ((unsigned short)0)
  408.  
  409. #define CALCMODE_op ((unsigned short)0x02)
  410. #define CALCMODE_len ((unsigned short)1)
  411.  
  412. #define CALCORDER_op ((unsigned short)0x03)
  413. #define CALCORDER_len ((unsigned short)1)
  414.  
  415. #define SPLIT_op ((unsigned short)0x04)
  416. #define SPLIT_len ((unsigned short)1)
  417.  
  418. #define SYNC_op ((unsigned short)0x05)
  419. #define SYNC_len ((unsigned short)1)
  420.  
  421. #define RANGE_op ((unsigned short)0x06)
  422. #define RANGE_len ((unsigned short)8)
  423.  
  424. #define WINDOW1_op ((unsigned short)0x07)
  425. #define WINDOW1_len ((unsigned short)32)
  426.  
  427. #define COLW1_op ((unsigned short)0x08)
  428. #define COLW1_len ((unsigned short)3)
  429.  
  430. #define NGRAPH_op ((unsigned short)0x2E)
  431. #define NGRAPH_len ((unsigned short)455)
  432.  
  433. #define RNAME_op ((unsigned short)0x0B)
  434. #define RNAME_len ((unsigned short)24)
  435.  
  436. #define BLANK_op ((unsigned short)0x0C)
  437. #define BLANK_len ((unsigned short)5)
  438.  
  439. #define INTEGER_op ((unsigned short)0x0D)
  440. #define INTEGER_len ((unsigned short)7)
  441.  
  442. #define NUMBER_op ((unsigned short)0x0E)
  443. #define NUMBER_len ((unsigned short)13)
  444.  
  445. #define LABEL_op ((unsigned short)0x0F)
  446. /* #define LABEL_len ((unsigned short)) variable */
  447.  
  448. #define FORMULA_op ((unsigned short)0x10)
  449. /* #define FORMULA_len ((unsigned short)) variable */
  450.  
  451. #define TABLE_op ((unsigned short)0x18)
  452. #define TABLE_len ((unsigned short)25)
  453.  
  454. #define QRANGE_op ((unsigned short)0x19)
  455. #define QRANGE_len ((unsigned short)25)
  456.  
  457. #define PRANGE_op ((unsigned short)0x1A)
  458. #define PRANGE_len ((unsigned short)8)
  459.  
  460. #define SRANGE_op ((unsigned short)0x1B)
  461. #define SRANGE_len ((unsigned short)8)
  462.  
  463. #define FRANGE_op ((unsigned short)0x1C)
  464. #define FRANGE_len ((unsigned short)8)
  465.  
  466. #define KRANGE_op ((unsigned short)0x1D)
  467. #define KRANGE_len ((unsigned short)9)
  468.  
  469. #define HRANGE_op ((unsigned short)0x20)
  470. #define HRANGE_len ((unsigned short)16)
  471.  
  472. #define PROTECT_op ((unsigned short)0x24)
  473. #define PROTECT_len ((unsigned short)1)
  474.  
  475. #define FOOTER_op ((unsigned short)0x25)
  476. #define FOOTER_len ((unsigned short)242)
  477.  
  478. #define HEADER_op ((unsigned short)0x26)
  479. #define HEADER_len ((unsigned short)242)
  480.  
  481. #define SETUP_op ((unsigned short)0x27)
  482. #define SETUP_len ((unsigned short)40)
  483.  
  484. #define MARGINS_op ((unsigned short)0x28)
  485. #define MARGINS_len ((unsigned short)10)
  486.  
  487. #define LABELFMT_op ((unsigned short)0x29)
  488. #define LABELFMT_len ((unsigned short)1)
  489.  
  490. #define TITLES_op ((unsigned short)0x2A)
  491. #define TITLES_len ((unsigned short)16)
  492.  
  493. #define CALCCOUNT_op ((unsigned short)0x2F)
  494. #define CALCCOUNT_len ((unsigned short)1)
  495.  
  496. #define UNFORMATTED_op ((unsigned short)0x30)
  497. #define UNFORMATTED_len ((unsigned short)1)
  498.  
  499. #define CURSORW12_op ((unsigned short)0x31)
  500. #define CURSORW12_len ((unsigned short)1)
  501.