LibreOffice Amiga

Posted by ALB42 on 31. Mai 20195 Comments

Long time before some people started to port OpenOffice/LibreOffice to Amiga OS4 (sadly only OS4). I saw some screenshots but that is also already a long time ago, seems that is a bit of a too big fish to fry.

Maybe a smarter way would be to just implement something like LibreOffice which can read files from LibreOffice. I gave it a go, and it was not that complicated as I thought it would be, at least if you are using the right language (FreePascal) and the right GUI set (MUIClass). The biggest problem is no usable table component in MUI (at least I know of, for all systems available). I had to implement one from scratch.

And this being FreePascal, of course it works on all Amiga Systems (not only OS4). I implemented only some styles/options (no font size and font name) but color and font styles are there, also left,center and right alignment. It even calculates cells. Funny tool, one could make a real LibreOffice Calc Viewer out of this.

Loaded LibreOffice File on AROS (lower window is the original LibreOffice View)
LibreOffice loaded in Amiga OS3
LibreOffice File loaded in MorphOS
LibreOffice loaded in AmigaOS4

5 comments to "LibreOffice Amiga"

  1. mmartinka sagt:

    This is amazing, thanks you for your excellent work for AROS and Amiga community…

    • ALB42 sagt:

      lol, not really I’m not a big fan of this Bounty business. Let’s say it that way, that bounty would be enough for me to stop the work on it immediately.

      But speaking of which TurboCalc Data? Is the TCD Format somewhere described? that would be nice… a TCD to LibreOffice converter (and vice versa), I would write that if someone give me the TCD description 😉

  2. Polluks sagt:

    /* ignition TurboCalc-I/O-Module
    *
    * Licensed under the terms of the GNU General Public License, version 3.
    */

    #ifdef __amigaos4__
    #include
    #include
    #else
    #include
    #endif

    #include “iotype.h”
    #include “turbocalc.h”

    extern APTR ioBase;

    #ifdef __amigaos4__
    #undef strlen
    #define strlen Strlen
    #endif

    const STRPTR __version = “$VER: turbocalc.io 0.3 (01.12.2014)”;

    #ifdef __amigaos4__
    #define bug DebugPrintF
    #define D(x) ;//x;
    //#define DEBUG_OS4
    #else
    /*extern sprintf(STRPTR,STRPTR,…);*/
    extern kprintf(STRPTR,…);

    #define bug kprintf
    #define D(x) ;
    #endif

    STRPTR
    MapTCFuncs(UBYTE n)
    {
    D(bug(“MapTCFuncs: %02X\n”, n));
    switch (n) {
    case 0x11: return(“ACS”);
    case 0x16: return(“SEL”);
    case 0x1a: return(“ABS”);
    case 0x25: return(“AVG”);
    //case 0x4a: return(“anzahl”);
    case 0x4b: return(“MIN”);
    case 0x4c: return(“MAX”);
    case 0x4e: return(“sum”);
    case 0x84: return(“GCD”);
    case 0xa0: return(“THR”);
    case 0xa1: return(“TMN”);
    case 0xa2: return(“TSC”);
    case 0x3d: return(“YER”);
    case 0x3e: return(“DAY”);
    case 0x3f: return(“MON”);
    case 0x7d: return(“VAR”);
    default: return(“NOP”);
    }
    return NULL;
    }

    void
    ConvertTCFormula(struct Cell *c,STRPTR t,long len)
    {
    long i = 0,col,row;
    BYTE a,b;
    STRPTR dest;

    D(bug(“ConvertTCFormula: len=%d\n”, t, len));
    if ((dest = AllocPooled(pool, len * 2)) != 0) {
    for(;i = 0x08 && *(t+i) c_Col)+col,b,(b ? 0 : c->c_Row)+row ));
    #ifdef __amigaos4__
    Strlcat(dest,Coord2String(a,(a ? 1 : c->c_Col)+col,b,(b ? 1 : c->c_Row)+row), len * 2);
    #else
    strcat(dest,Coord2String(a,(a ? 1 : c->c_Col)+col,b,(b ? 1 : c->c_Row)+row));
    #endif
    i += 4;
    } else if (*(t+i) == 0x04) {
    /* Function */
    if (MapTCFuncs(*(t+ ++i)))
    #ifdef __amigaos4__
    Strlcat(dest,MapTCFuncs(*(t+i)), len * 2);
    #else
    strcat(dest,MapTCFuncs(*(t+i)));
    #endif
    } else if (*(t+i) < ' ') {
    D(bug("unknown: %ld\n",*(t+i)));
    break;
    } else {
    /* standard text */
    dest[strlen(dest)] = *(t+i);
    D(bug("Text: \n”, dest));
    }
    }
    if (c->c_Text) {
    // bug(“ctcf: old text: ‘%s’\n”,c->c_Text);
    FreeString(c->c_Text);
    }
    c->c_Text = AllocString(dest);
    FreePooled(pool,dest,len*2);
    }
    }

    long PUBLIC
    load(REG(d0, BPTR dat), REG(a0, struct Mappe *mp))
    {
    struct Cell *c;
    struct Page *page;
    struct THeader th;
    struct TCell *tc;
    APTR buf = NULL;
    ULONG len = 0,size,l,col,row,*cols;
    char t[32];
    double d;
    UWORD w;
    UWORD cols_size = 0;
    UBYTE b,*cell,ieeemode,r,g;
    uint16 spos;//Stringstartposition der Strings in Dateiinfo
    char tabver[3] = {“XX\0”};
    struct ClockData cd;
    uint8 dateflag; //TC date is under 1.1.1978

    #ifdef __amigaos4__
    STRPTR sp;
    long i;
    #endif

    page = NewPage(mp);
    while (FRead(dat,&th,sizeof(struct THeader),1)) {
    size = (th.th_Size[0] << 16)+th.th_Size[1];
    if (len tv_Version > TC_VERSION || ((struct TVersion *)buf)->tv_Version == TC_VERSION&& ((struct TVersion *)buf)->tv_Revision > TC4_REVISION)
    // ReportError(“Warnung!\nDas Dateiformat ist neuer als das bekannte. (%d / %d)”, ((uint8 *)buf)[0], ((uint8 *)buf)[1]);
    break;
    case FILE_PASSWORD:
    D(bug(” Passwort.\n”));
    break;
    case FILE_OPT0:
    D(bug(” Optionen-0.\n”));
    break;
    case FILE_OPT1:
    D(bug(” Optionen-1.\n”));
    break;
    case FILE_WIDTH:
    D(bug(” File Width\n”));
    l = *(ULONG *)(cell = buf); w = *(UWORD *)(cell+4);
    SetTableSize(page,l+1,0);
    (page->pg_tfWidth+l)->ts_Pixel = w;
    (page->pg_tfWidth+l)->ts_mm = mm(page,w,TRUE);
    break;
    case FILE_HEIGHT:
    D(bug(” File height\n”));
    l = *(ULONG *)(cell = buf); w = *(UWORD *)(cell+4);
    SetTableSize(page,0,l+1);
    (page->pg_tfHeight+l)->ts_Pixel = w;
    (page->pg_tfHeight+l)->ts_mm = mm(page,w,FALSE);
    break;
    case FILE_CELL:
    case FILE_LCELL:
    #ifdef DEBUG_OS4
    DebugPrintF(“Type: %02d Size: %05d Data: “, th.th_Type, size);
    for(i = 0; i c_Text = AllocStringLength(cell,w);
    cell += w;
    c->c_Type = CT_TEXT;
    }
    else if (b != TCT_EMPTY)
    {
    D(bug(” not TCT_EMPTY\n”));
    if (/*ieeemode &&*/ b == TCT_FLOAT)
    cell += 4;
    d = *(double *)cell;
    l = *(long *)cell;
    cell += 8;
    }
    switch(b)
    {
    case TCT_TIME:
    D(bug(“TCT_TIME\n”));
    #ifdef __amigaos4__
    sp = ASPrintf(“%ld:%02ld:%02ld”,(l/3600),((l/60) % 60),(l % 60));
    c->c_Text = AllocString(sp);
    FreeVec(sp);
    #else
    sprintf(t,”%ld:%02ld:%02ld”,l/3600,(l/60) % 60,l % 60);
    c->c_Text = AllocString(t);
    #endif
    break;
    case TCT_FLOAT:
    D(bug(“TCT_FLOAT: %lf\n”, d));
    c->c_Text = AllocString(ita(d,-1,ITA_NONE));
    c->c_Type = CT_VALUE;
    break;
    case TCT_INT:
    D(bug(“TCT_INT\n”));
    #ifdef __amigaos4__
    sp = ASPrintf(“%ld”,l);
    c->c_Text = AllocString(sp);
    FreeVec(sp);
    #else
    sprintf(t,”%ld”,l);
    c->c_Text = AllocString(t);
    #endif
    break;
    case TCT_DATE:
    D(bug(“date: %ld\n”,l));

    if(l >= DATECORR)
    {
    l -= DATECORR;
    dateflag = 0;
    }
    else
    dateflag = 1;
    Amiga2Date(l * 24 * 60 * 60, &cd);
    D(bug(“Amiga2Date: %02d.%02d.%04d\n”, cd.mday, cd.month, cd.year));
    #ifdef __amigaos4__
    sp = ASPrintf(“%02ld.%02ld.%02ld”, (long)cd.mday, (long)cd.month, (long)(dateflag ? cd.year – 78 : cd.year));
    c->c_Text = AllocString(sp);
    FreeVec(sp);
    #else
    sprintf(t,”%02d.%02d.%04d”, cd.mday, cd.month, (dateflag ? cd.year -78 : cd.year));
    c->c_Text = AllocString(t);
    #endif
    c->c_Type = CT_TEXT;
    break;
    }
    D(bug(“Celltext: %s\n”,c->c_Text));
    if (b != TCT_EMPTY)
    {
    w = *(UWORD *)cell; cell += 2;
    D(bug(“Pos: %d\n”,(long)cell – (long)buf));
    ConvertTCFormula(c,cell,w);
    cell += w;
    }
    tc = (struct TCell *)cell;
    //Farben setzen
    col = FindColorPen(0,0,0);
    for(row = 0;row c_BorderColor[row] = col;
    c->c_APen = c->c_ReservedPen = tc->tc_Color1 & TC_COLOR_MASK;
    c->c_BPen = tc->tc_Color0 & TC_COLOR_MASK;
    //Rahmen bearbeiten
    if (tc->tc_Border & TC_BORDER_LEFT)
    c->c_Border[0] = (tc->tc_Border & TC_BORDER_LEFT) <tc_Border & TC_BORDER_RIGHT)
    c->c_Border[1] = (tc->tc_Border & TC_BORDER_RIGHT);
    if (tc->tc_Border & TC_BORDER_DOWN)
    c->c_Border[2] = (tc->tc_Border & TC_BORDER_DOWN) >> 6;
    if (tc->tc_Border & TC_BORDER_UP)
    c->c_Border[3] = (tc->tc_Border & TC_BORDER_UP) >> 3;
    //Schriftstile bearbeiten
    if (tc->tc_Font & TC_STYLE_MASK)
    {
    struct TagItem tags[2] = {{FA_Style, ((tc->tc_Font & (1 <tc_Font & (1 <tc_Font & (1 <c_FontInfo = ChangeFontInfoA(NULL, page->pg_DPI, tags, FALSE);
    }
    else
    {
    struct TagItem tags[2] = {{FA_Style, 0}, {TAG_END, 0}};
    c->c_FontInfo = ChangeFontInfoA(NULL, page->pg_DPI, tags, FALSE);
    }
    //Ausrichtung in der Zelle bearbeiten
    if(tc->tc_Flags)
    {
    uint8 va[4] = {0, CA_TOP, CA_VCENTER, CA_BOTTOM};

    c->c_Alignment = (tc->tc_Flags & TCF_ALIGNMENT);
    c->c_Alignment += va[(tc->tc_Flags & TCF_VALIGNMENT)>>3];
    }
    }//END if(c=NewCell
    D(bug(“End FILE_(L)CELL\n\n”));
    break;
    case FILE_NAME:
    w = *(UWORD *)(cell = buf); cell += 2;
    #ifdef DEBUG_OS4
    DebugPrintF(“Type: %02d Size: %05d Data: “, th.th_Type, size);
    for(i = 0; i < size; i++)
    DebugPrintF("%02X ", ((uint8 *)buf)[i]);
    DebugPrintF("\n");
    #endif
    D(bug(" Name: %s\n",cell));
    /* to be implemented… */
    break;
    case FILE_OPT2:
    D(bug(" Optionen-2.\n"));
    break;
    case FILE_WINDOW:
    D(bug(" Window.\n"));
    break;
    case FILE_FONTS:
    D(bug(" Fonts.\n"));
    break;
    case FILE_SCREEN:
    D(bug(" Screen.\n"));
    break;
    case FILE_COLOR:
    w = *(UWORD *)(cell = buf);
    #ifdef DEBUG_OS4
    DebugPrintF("Type: %02d Size: %05d Data: ", th.th_Type, w);
    for(i = 0; i > 8) | ((row & 0x0f00) >> 4);
    g = ((row & 0x00f0) >> 4) | (row & 0x00f0);
    b = ((row & 0x000f) <cp_ID;
    else
    cols[col] = 0;
    #endif
    }
    }
    break;
    case FILE_DIAGRAM:
    D(bug(” Diagram.\n”));
    break;
    case FILE_STDFONTS:
    D(bug(” Std-Fonts.\n”));
    break;
    case FILE_PATTERNS:
    D(bug(” Patterns.\n”));
    break;
    case FILE_COLUMNFLAGS:
    D(bug(” Column-Flags.\n”));
    break;
    case FILE_ROWFLAGS:
    D(bug(” Row-Flags.\n”));
    break;
    case FILE_SHEETSIZE:
    D(bug(” Sheet-Size.\n”));
    break;
    case FILE_SYSTEMFONTS:
    D(bug(” System-Fonts.\n”));
    break;
    case FILE_FROZEN:
    D(bug(” Frozen.\n”));
    break;
    case FILE_SAVEOPT:
    D(bug(” Save-Options.\n”));
    break;
    case FILE_CRYPT:
    D(bug(” Crypt.\n”));
    break;
    case FILE_DIAGRAM2:
    D(bug(” Diagram-2.\n”));
    break;
    case FILE_GLOBALFLAGS:
    D(bug(” Global-Flags.\n”));
    break;
    case FILE_OBJECT:
    D(bug(” Object.\n”));
    break;
    case FILE_STDCHART:
    D(bug(” Std-Chart.\n”));
    break;
    case FILE_OPT3:
    D(bug(” Optionen-3.\n”));
    break;
    case FILE_LASTFILES:
    D(bug(” Lastfiles.\n”));
    break;
    case FILE_CURSOR:
    D(bug(” Cursor.\n”));
    break;
    case FILE_STARTUPOPTIONS:
    D(bug(” Startup-Options.\n”));
    break;
    case FILE_TURBOCALCOWNER:
    D(bug(” TC-Owner.\n”));
    break;
    case FILE_FILEINFO:
    D(bug(” File-Info.\n”));
    #ifdef DEBUG_OS4
    DebugPrintF(“Type: %02d Size: %05d Data: “, th.th_Type, size);
    for(i = 0; i mp_Author = AllocString(&((uint8 *)buf)[spos]);
    spos += ((uint8 *)buf)[spos – 1] + 2;
    mp->mp_CatchWords = AllocString(&((uint8 *)buf)[spos]);
    spos += ((uint8 *)buf)[spos – 1] + 2;
    mp->mp_Note = AllocStringLength(&((uint8 *)buf)[spos], (uint8)((uint8 *)buf)[spos – 1]);
    tabver[0] = (uint8)((uint8 *)buf)[15] / 10 + 0x30;
    tabver[1] = (uint8)((uint8 *)buf)[15] % 10 + 0x30;
    mp->mp_Version = AllocString(tabver);
    break;

    default:
    D(bug(” UNKNOWN (%ld).\n”,th.th_Type));
    #ifdef DEBUG_OS4
    DebugPrintF(“Type: %02d Size: %05d Data: “, th.th_Type, size);
    for(i = 0; i mp_Pages,page) {
    foreach(&page->pg_Table,c) {
    if (c->c_APen)
    c->c_APen = c->c_ReservedPen = cols[c->c_APen];
    else
    c->c_APen = c->c_ReservedPen = page->pg_APen;
    if (c->c_BPen)
    c->c_BPen = cols[c->c_BPen];
    else
    c->c_BPen = page->pg_BPen;
    UpdateCellText(page,c);
    }
    }
    if(cols_size)
    FreePooled(pool,cols,cols_size);
    cols = NULL;
    return RETURN_OK;
    }

    long PUBLIC
    save(REG(d0, BPTR dat), REG(a0, struct Mappe *mp))
    {
    return RETURN_WARN;
    }

    void PUBLIC
    closePrefsGUI(void)
    {
    }

    void PUBLIC
    openPrefsGUI(REG(a0, struct Screen *scr))
    {
    }

    STRPTR PUBLIC
    getPrefs(void)
    {
    return NULL;
    }

    long PUBLIC
    setPrefs(REG(a0, STRPTR t))
    {
    return TRUE;
    }

    #if defined(__SASC)
    void STDARGS
    _XCEXIT(void)
    {
    }
    #endif

  3. Polluks sagt:

    /* ignition TurboCalc-IO-Modul
    *
    * Copyright 1996-2009 pinc Software. All Rights Reserved.
    * Licensed under the terms of the GNU General Public License, version 3.
    */
    #ifndef TURBOCALC_H
    #define TURBOCALC_H

    //Turbocalc starts with 1.1.1900 the utility-date-functions with 1.1.1978 this is the correction in day
    #define DATECORR 28489

    #define FA_PointHeight TAG_USER+100 /* Tags for SetFontInfo() */
    #define FA_Space TAG_USER+101
    #define FA_Style TAG_USER+102
    #define FA_Rotate TAG_USER+103
    #define FA_Kerning TAG_USER+104
    #define FA_Family TAG_USER+105
    #define FA_Shear TAG_USER+106
    #define FA_Embolden TAG_USER+107 /* not yet implemented */
    #define FA_Width TAG_USER+108 /* not yet implemented */

    struct THeader {
    UBYTE th_Type;
    UBYTE th_Size[2];
    };

    enum {
    FILE_END,
    FILE_START, /* 12:TURBOCALC\8, floatmode, 0.b */
    FILE_VERSION, /* 2:(version, revision): see above! */
    FILE_PASSWORD, /* flags.b (0: ask_password), flags2.b 2+3*txt
    * pwopenread_txt
    * pwwriteread_txt
    * pwchange_txt */
    FILE_OPT0, /* 6:stdwidth.w, stdheight.w, flags1.b 0.b */
    FILE_OPT1, /* 8+2_txt: decimalpoint.b, 1000sep.b, datumsep.b, waehrung.b
    * sheet_waehrungprefix_txt, sheet_waehrungsuffix_txt
    * dateorder.b, localeflags.b, 0.b, 0.b */
    FILE_WIDTH, /* x.l, width.w only if differs from std! */
    FILE_HEIGHT, /* y.l, height.w */
    FILE_CELL, /* x.w,y.w,
    * type.b,
    * ieee.l (only for type==FLOAT!) see note at the end
    * (data1.l, data2.l) – for type==TEXT: text_txt, (skipped for type==EMPTY)
    * formel_txt (not for type==EMPTY)
    * format.Format_Size */
    FILE_LCELL, /* dito, but x.l, y.l */
    FILE_NAME, /* name_txt
    * typ.b
    * TYPE_TEXT: text_txt
    * TYPE_FORMEL_x: formel_txt
    * else: data1.l, data2.l */
    FILE_OPT2, /* print options: 42+3*txt!
    * printflags.b, printflags2.b
    * printLM.w, RM.w, UM.w, BM.w
    * printwidth.w, printheight.w
    * printfile_txt, printheader_txt, printfooter_txt
    * sheet_titlex0.l, sheet_titlex1.l, sheet_titley0.l, sheet_titley1.l
    * printflags3.b, 0.b, 0.b, 0.b
    * scalex.w, scaley.w, 0.w, 0.w */
    FILE_WINDOW, /* add this at the end of the file!!!
    * 14.w: x1.w, y1.w, x2.w, y2.w
    * flags.b, pad.b, pad.l */
    FILE_FONTS, /* 31 times: (font_txt, size.w, pad.w | or 0.w for unused) */
    FILE_SCREEN, /* flag.b (0=off, 1=wb-clone, 2=on)
    * width.w,height.w, depth.w, id.l, smartrefresh, pad.b */
    FILE_COLOR, /* num.w
    * r.b,g.b,b.b,pad.b */
    FILE_DIAGRAM, /* (72+2*DIAGRAM_MAXY+(4+2*DIAGRAM_MAXY)_txt+6_fnt)
    * x1.w, <1.w, x2.w, y2.w – window-dim
    * winflags.b (bit0: hidden), pad.b
    * name_txt
    * x1.l, y1.l, x2.l, y2.l – data-range
    * type.b, realtype.b, flags2.b, flags.b
    * min.l, min2.l
    * printflags.b, printpad.b, printwidth.w, printheight.w
    * max.l, max2.l (sorry, min & max should be together, but…)
    **
    * titleflags.b, pad.b
    * title_txt, title_font style.b pad.b *3
    **
    * legendeflags.b, style.b legende_fnt
    * DIAGRAM_MAXY*legende_txt
    **
    * patternflags.b, pad.b
    * colorpattern.w * DIAGRAM_MAXY
    **
    * achseflags.b, style.b achse_fnt
    * DIAGRAM_MAXY*achse_txt
    **
    * yachseflags.b, yachsepad.b, yachse_fnt
    * yachseticknum.w, yachsesubticknum.w */
    FILE_STDFONTS, /* font_txt, size.w, pad.w | or 0.w for unused */
    FILE_PATTERNS, /* 4*PATTERNMAXSIZE +_txt
    * std_pfad_txt
    * pattern0.4*PATTERNMAXSIZE */
    FILE_COLUMNFLAGS,
    FILE_ROWFLAGS, /* 12,row/column.l, Format.Format_Size */
    FILE_SHEETSIZE, /* 12:sheet_limitx/y.l, pad.l */
    FILE_SYSTEMFONTS, /* font_txt, size.w, pad.w or 0.w for unused for text
    * font_txt, size.w, pad.w or 0.w for unused for menu */
    FILE_FROZEN, /* V3! – should be immedialty after FILE_WINDOW!!!
    * 24,freezex,freezey,freezepix,freezepiy,0,0 – all .l
    * this is only written, if there is freezing!!! */
    FILE_SAVEOPT, /* 20+txt,saveflags.b,0.b, 0.w autosavetime.w, 0.w, 0.l
    * sheet_autosavepath_txt, 0.l, 0.l */
    FILE_CRYPT, /* checkkey.w
    * flags0,1.b – reserved
    * long0,long1 for padding (filled with scratch!) */
    FILE_DIAGRAM2, /* dia_legendex1..y2 (16)
    * dia_achsex1..y2 (16)
    * symbolmode.b, pad.b, width.w height.w, pad.w (8)
    * kuchenexplode.b (MAXEXPLODE)
    * iffdepth/width/height.w (6)
    * refreshflags0/1.b (2)
    * 2*pad.l (8)
    ** 3.10: (FEATURE_CHARTXY)
    * xachseflags, xachsestyle, xachseticknum, xachsesubticknum (6)
    * xmin.l, xmin2.l, xmax.l, xmax2.l (16) */
    FILE_GLOBALFLAGS, /* GlobalFlags.l (0..3), GlobalFlags_autoopendir_txt, 0.w
    * Preview_flags.b 0.b, Preview_Width/Height/Depth.w, Preview_screenmode */
    FILE_OBJECT, /* (36+3*txt)
    * x1,y1,x2,y2.l (16)
    * objecttype.l (-1=extern) (4)
    * objectclass_txt, name_txt, macro_txt (3*txt)
    * backcolor, pattern, frame, pad.b (as long! 4)
    * flags0,1,2,3.b (as long! 4)
    * pad1.l, pad2.l (8) */
    FILE_STDCHART, /* (2+Stdchart_save_firstfont+3*fnt)
    * reserved.w (2)
    * StdChart (StdChart_save_firstfont)
    * fonts (3*fnt) */
    FILE_OPT3, /* (26)
    * sheet_printiffdept/with/height.w, undo_depth.w, printiff_scale (10)
    * 0.l, 0.l, 0.l, 0.l (16) */
    FILE_LASTFILES, /* only used for 'lastfiles'
    * flags0/1/2/3.b (4)
    * filename_txt */
    FILE_CURSOR, /* (28) immediatly after FILE_WINDOW (or _FROZEN)
    * cellx/y.l
    * blockx1/y1/x2/y2.l (if blockx1=-1.l, then no block selected!)
    * flags0,1,2,3.b (reserved) */
    FILE_STARTUPOPTIONS, /* these options *must* follow immediatly
    * after FILE_START & will be checked
    * by the File_CheckType-routine!
    * flags0-7 ; (8) reserved up to now! */
    FILE_TURBOCALCOWNER, /* (12+txt)
    * reserved.l (0) ;
    * tc-serial-id_txt[6] ; depends on TC-version!!!
    * username_txt ;
    * reserved.w (0) ; reserved for company-name! */
    FILE_FILEINFO, /* (20 + 4*txt)
    * reserved.l (0)
    * creation_date.l
    * creation_time.l
    * version.l
    * workingtime.l
    * author_txt
    * title_txt
    * subject_txt */
    } TCTypes;

    /*
    ** …_txt: num.w txt.num
    ** …_font: fontname_txt [size.w pad.w] (only if fontname-size0!)
    */

    /************************** FILE_CELL **************************/

    /*struct TCellHeader
    {
    UWORD tc_Col,tc_Row;
    UBYTE tc_Type;
    union
    {
    struct {
    UBYTE tc_TextLength[2];
    char tc_Text[0]
    };
    };
    UBYTE tc_FormelLength[2];
    char tc_Formel[0];
    };

    struct TLCellHeader
    {
    ULONG tc_Col,tc_Row;
    UBYTE tc_Type;
    };
    */
    struct TCell
    {
    UBYTE tc_Color0; /* 0 = std., values 1-63 */
    UBYTE tc_Color1; /* ” */
    UBYTE tc_Border;
    UBYTE tc_Font; /* 0 = std., bits 0-2: style, bits 3-7: font number, see FILE_FONTS */
    BYTE tc_TextFormat; /* 0 = std., -1 (only for row & column_format): invalid format! */
    UBYTE tc_Flags;
    UBYTE tc_Label[6]; /* ???? */
    };

    #define TC_COLOR_MASK 0x3f
    #define TC_PATTERN_MASK 0xc0
    #define TC_PATTERN_LSHIFT 6
    #define TC_BORDER_LEFT 0x03 /* 00=off, 01= thin, 10 = medium, 11= bold */
    #define TC_BORDER_RIGHT 0x0c
    #define TC_BORDER_UP 0x30
    #define TC_BORDER_DOWN 0xc0
    #define TC_FONT_LSHIFT 3
    #define TC_STYLE_ITALIC 2
    #define TC_STYLE_BOLD 1
    #define TC_STYLE_UNDERLINED 0
    #define TC_STYLE_MASK 0x07
    #define TCF_HIDDEN = 7
    #define TCF_PROTECTED = 6
    #define TCF_HIDEFORMEL = 5
    #define TCF_VALIGNMENT 0x18 /* 00=std, 01=upper, 10=mid, 11=lower */
    #define TCF_ALIGNMENT 0x07 /* 000=std (nums/date/time right, text left, others: centered)
    ** 001=left, 010=right, 011=centered
    ** 100=repeated(ni), 101/110/111=multiline_alignment!!! */

    #define TCT_EMPTY 0
    #define TCT_NO 1 /* empty cell */
    #define TCT_FLOAT 2
    #define TCT_NUM 3
    #define TCT_INT TCT_NUM
    #define TCT_DATE 4
    #define TCT_TIME 5
    #define TCT_BOOL 6
    #define TCT_TEXT 7 /* d0=*text (or 0, then is empty text!!!) */
    #define TCT_ERROR 9

    /******************************************************************
    **
    ** Note on ieee of FILE_CELL:
    **
    ** TurboCalc can use all of the Amiga’s float-formats.
    ** (Depending on floatmode in FILE_START)
    ** Thus TC stores floats in two ways:
    ** 1) as single ieee (32bit) [which can be converted by all float-formats]
    ** 2) and in the currently used float-format (double ieee, if available)
    ** This is always stored as 64 bit (data1/2)
    **
    ** floatmode==0 -> double ieee.
    ** floatmode0 -> use single ieee (as other format is less precise)
    **
    */

    /************************** FILE_VERSION **************************/

    struct TVersion
    {
    UBYTE tv_Version;
    UBYTE tv_Revision;
    };

    #define TC_VERSION 1
    #define TC4_REVISION 9
    #define TC5_REVISION 10

    #endif /* TURBOCALC_H */

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.