home *** CD-ROM | disk | FTP | other *** search
- /* look at this */
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
- /* */
- /* Prototype HP15C Calculator */
- /* James C. Ullrey */
- /* INRESCO */
- /* © 1990 */
- /* Version 13.97a */
- /* */
- /* FILE SEGMENT */
- /* */
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
-
-
-
- /*****************************************************************/
- /* I N C L U D E S */
- /*****************************************************************/
-
- #include "TE32K.h"
- #ifndef __C14__
- #include "C14 Calculator.h"
- #endif
- #include "Globals.h"
- #include "calc_matrix_functions.h"
- #include <Lists.h>
- #include "C14CalculatorData.h"
- #include "calc_files.h"
- #include "ResourceDefs.h"
- #include "calc_dipshit.h"
-
-
- /********************************************************************
- /* G L O B A L V A R I A B L E D E C L A R A T I O N S
- /********************************************************************/
- extern Boolean newCreated;
- extern Boolean preRegistered;
- extern WindowPtr gMy_windows[];
- extern long gState;
- extern long gsState;
- extern long sto;
- extern long rcl;
- /*extern long gNewNum;*/
- /*extern long canClear;*/
- /*extern long gRoll;*/
- extern long wait;
- extern long gFlag;
- extern long fFlag;
- extern long sWait;
- extern long rWait;
- extern long lblWait;
- extern long plus;
- extern long minus;
- extern long timesF;
- extern long divide;
- extern long gDot;
- /*extern long rsFlag;*/
- extern long gDigits;
- /*extern long runMode;*/
- /*extern long gsbWait;*/
- extern long gtoWait;
- extern short qRefNum;
- extern short pRefNum;
- extern short SRcount;
- extern Boolean hasPlot;
-
- /*****************************************************************/
- /* P R O T O T Y P E S
- /*****************************************************************/
- ListHandle CreateList ( WindowPtr theWindow,
- short rowInt,
- short colInt);
-
- void IndexDeparse ( short i);
- short do_save_file (WindowPtr wPtr, short do_sfput);
-
- void close_the_window (WindowPtr wPtr);
-
- OSErr get_c_filespec (short wd_refnum, long *dir_id, short *vol_refnum);
-
- /*****************************************************************/
- /*****************************************************************/
- /*
- /* R O U T I N E S
- /*
- /*****************************************************************/
- /*****************************************************************/
-
-
- void file_seg() {} /* for reference in "UnloadSeg()" calls */
-
-
- /********************** SetUpFile ************************/
- //void SetUpFile( fn, prn, refNum ) /* called from main() */
- void SetUpFile( Str255 *fn, Str255 *prn, short *refNum ) /* called from main() */
- //Str255 *fn; /* data filename */
- //Str255 *prn; /* program filename */
- //short *refNum; /* Volume ID (or working dir) of open System file */
- {
- short io;
- short i;
- short notDone = 1;
- long count,fcount;
- Str255 sresult;
- SFReply reply;
- OSErr error;
-
- /*newCreated = FALSE;*/
- count = sizeof(map);
- while(notDone)
- {
- error = FSOpen(*fn, *refNum,&qRefNum); /* II-91, IV-109 */
- if(error == fnfErr || error == bdNamErr)
- {
- error = Create( *fn, *refNum, 'INRS', 'INRC'); /* II-90, IV-112 */
- error = FSOpen(*fn, *refNum,&qRefNum);
- /*newCreated = TRUE;*/
- InitMapData(fn,*refNum,qRefNum); /* in C14CalculatorData.c */
- }
- else
- {
- error = SetFPos(qRefNum,1,0); /* II-93, IV-110 */
- error = FSRead(qRefNum,&count,&map); /* II-92, IV-109 */
- if(map.regstat == 0 && map.memstat == 0)
- {
- map.memstat = 19;
- map.regstat = 65 - map.memstat - map.memcom;
- }
- }
- /*error = FSClose(qRefNum);*/ /* II-94, IV-112 */
- if(!error)
- notDone = 0;
- }
- notDone = 1;
- fcount = sizeof(frog);
- while(notDone)
- {
- /* |-------------------------------- file name */
- /* | |------------------------ dir ref no */
- /* | | |------------ file ref no */
- /* v v v */
- error = FSOpen(*prn, *refNum, &pRefNum); /* II-91, IV-109 */
- if(error == fnfErr || error == bdNamErr)
- {
- error = Create( *prn, *refNum, 'INRS', 'INRP'); /* II-90, IV-112 */
- frog.PC = 0;
- frog.tPC = 0;
- frog.SP = 0;
- frog.END = 1;
- frog.breakout = 0x0000;
- SRcount = 0;
-
- }
- else
- {
- /* */
- /* |-- 1: from start; 2: from end; 3: from mark */
- /* | |------ offset */
- /* v v */
- error = SetFPos(pRefNum,1,0); /* II-93, IV-110 */
- error = FSRead(pRefNum,&fcount,&frog); /* II-92, IV-109 */
- }
- /*error = FSClose(qRefNum);*/ /* II-94, IV-112 */
- if(!error)
- notDone = 0;
- }
- }
-
- void save_window(WindowPtr wPtr)
- {
- short user_response = 0;
- char w_title[255];
- WObjsHandle w_objs_hndl;
- short the_object;
-
-
- /***
- First, check if the window pointer is a valid one for the application.
- If so, check to see if the window has been written to but not saved.
- ***/
-
-
- if(!one_of_mine(wPtr)) return;
-
- w_objs_hndl = (WObjsHandle)GetWRefCon(wPtr);
- if(w_objs_hndl == NIL) return;
-
- /*w_objs_hndl=(WObjs**)GetWRefCon(wPtr);*/
- the_object = (**w_objs_hndl).paletteSetting;
-
-
- if(the_object == PLOT_OBJ)
- {
- hasPlot = FALSE; /* reset hasPlot */
- /*DeleteMenu( PLOT_MENU_ID );*/
- DeleteMenu( PlotID );
- DrawMenuBar();
- }
-
-
-
- if((**w_objs_hndl).dirty)
- {
- GetWTitle(wPtr, (StringPtr)w_title);
- ParamText((StringPtr)w_title, "\p", "\p", "\p");
-
- #ifdef powerc
- user_response = CautionAlert(SAVE_CHANGES, (UniversalProcPtr)NIL);
- #else
- user_response = CautionAlert(SAVE_CHANGES, NIL);
- #endif /* powerc */
-
- switch(user_response)
- {
- case SAVE_YES:
- #ifdef powerc
- StopAlert (UNDER_CONSTRUCTION, (UniversalProcPtr)NIL);
- #else
- StopAlert (UNDER_CONSTRUCTION, NIL);
- #endif /* powerc */
- if(do_save_file(wPtr, DO_SAVE) == SUCCESS)
- close_the_window(wPtr);
- else
- gDone = FALSE;
- break;
-
- case SAVE_NO:
- close_the_window(wPtr);
- break;
-
- case SAVE_CANCEL:
- gDone = false; /* if "Cancel", stop any "quit" operation */
- break;
-
- } /* end of switch */
-
- } /* end of if(**w_objs_hndl).dirty) */
-
-
- else close_the_window(wPtr);
-
-
- } /* end of "save_window()" */
-
-
- void close_the_window(WindowPtr wPtr)
- {
- short n;
- WObjsHandle w_objs_hndl;
-
-
-
- /************* If it isn't one of our windows, skip it! ******************/
-
-
- if( !(n = one_of_mine(wPtr)) ) return;
-
-
-
- /***** Else dispose the controls and window, and clear our list **********/
-
-
- w_objs_hndl = (WObjsHandle)GetWRefCon(wPtr);
- if(w_objs_hndl != NIL)
- {
- HLock((Handle)w_objs_hndl);
- /* look at this */
- if((**w_objs_hndl).prInfoHndl) DisposHandle((Handle)(**w_objs_hndl).prInfoHndl);
- DisposHandle((Handle)w_objs_hndl);
- }
-
- DisposeWindow(gMy_windows[n]); /* also does a "KillControls()" */
-
- gMy_windows[n] = NIL;
-
-
- } /* end of close_the_window() */
-
-
- short do_save_file(WindowPtr wPtr,short do_what)
- //WindowPtr wPtr;
- //short do_what;
-
- {
- short file_ref_num, wd_refnum, vol_refnum;
- Point where;
- long count, dir_id;
- OSErr error_code;
- OSType the_creator, our_type;
- char local_str[256], window_name[256];
- char *srce_ptr, *dest_ptr;
- char **dlog_str_hndl;
- Ptr data_ptr;
- WObjsHandle w_objs_hndl;
- THPrint pr_info_hndl;
-
-
-
- /********* If our window data structure is absent, don't even start this! **********/
-
-
- w_objs_hndl = (WObjsHandle)GetWRefCon(wPtr);
-
- if(w_objs_hndl == NIL) return(FILE_ERROR);
-
-
-
- /************* Set up some initial values and lock our window data **********/
-
-
- count = 0;
- the_creator = CREATOR_CODE; /* our "creator type" */
- our_type = TYPE_CODE; /* our "file type" */
- SetPt(&where, 100, 80); /* where to put the file dialog boxes */
-
- MoveHHi((Handle)w_objs_hndl);
- HLock ((Handle)w_objs_hndl);
-
-
- /**
- Note:
-
- The "findFile" element of the window data structure is of type SFReply.
- The structure of the SFReply record is as follows:
-
- typedef struct
- {
- Boolean good;
- Boolean copy;
- fType OSType;
- short vrefNum;
- short version;
- char fName[255];
- }SFReply;
- **/
-
-
- /********* Build up the dialog prompt: "Save (filename) as:" **********/
-
- /**
- Use strings save in 'STR " resources named "Save" and "As",
- and the file name from the "findFile" item in the window info record.
- **/
-
-
- local_str[0] = 0;
- dest_ptr = local_str;
-
- dlog_str_hndl = (char**)GetString(SAVE_ID);
- MoveHHi(dlog_str_hndl);
- HLock (dlog_str_hndl);
-
- srce_ptr = (char*)*dlog_str_hndl;
- cat_strings(srce_ptr, dest_ptr, 255);
-
- HUnlock(dlog_str_hndl);
-
- GetWTitle(wPtr, (StringPtr)window_name);
-
- srce_ptr = window_name;
- cat_strings(srce_ptr, dest_ptr, 255);
-
-
- dlog_str_hndl = (char**)GetString(AS_ID);
- MoveHHi(dlog_str_hndl);
- HLock (dlog_str_hndl);
-
- srce_ptr = (char*)*dlog_str_hndl;
- cat_strings(srce_ptr, dest_ptr, 255);
-
- HUnlock(dlog_str_hndl);
-
-
-
- /***
- If we need to specify a file name, do SFPut thing...
- ***/
-
-
- if( (do_what == DO_SFPUT) ||
- ((**w_objs_hndl).hasRealName == FALSE) )
- {
- InitCursor();
- #ifdef powerc
- SFPutFile( where,
- (StringPtr)local_str,
- (StringPtr)window_name,
- (UniversalProcPtr)NIL,
- &(**w_objs_hndl).findFile);
- #else
- SFPutFile( where,
- (StringPtr)local_str,
- (StringPtr)window_name,
- NIL,
- &(**w_objs_hndl).findFile);
- #endif
- /***
- If the user cancelled the operation, restore the window name
- ***/
-
- if ((**w_objs_hndl).findFile.good == FALSE)
- {
- dest_ptr = (char*)((**w_objs_hndl).findFile.fName);
- (**w_objs_hndl).findFile.fName[0] = 0;
- cat_strings(window_name, dest_ptr, 255);
-
- HUnlock((Handle)w_objs_hndl);
- return(CANCELED);
- }
-
-
- /***
- Otherwise, get the vol_refnum and create the file
- ***/
-
- else
- {
- wd_refnum = (**w_objs_hndl).findFile.vRefNum;
-
- error_code = get_c_filespec(wd_refnum, &dir_id, &vol_refnum);
- if(error_code != noErr) return(FILE_ERROR);
-
- error_code = Create(
- (**w_objs_hndl).findFile.fName,
- wd_refnum,
- the_creator,
- our_type);
-
- if( (error_code != noErr) &&
- (error_code != dupFNErr) )
- {
- #ifdef powerc
- StopAlert(CREATE_ERR, (UniversalProcPtr)NIL);
- #else
- StopAlert(CREATE_ERR, NIL);
- #endif /* powerc */
- HUnlock((Handle)w_objs_hndl);
- return(CREATE_ERR);
- }
- else (**w_objs_hndl).hasRealName = TRUE;
- }
- }
-
-
-
- /************* Save the data in the specified file **********/
-
-
- /*** a) open the file ***/
-
- if( (do_what == DO_SFPUT) ||
- (do_what == DO_SAVE) )
- {
- wd_refnum = (**w_objs_hndl).findFile.vRefNum;
-
- error_code = get_c_filespec(wd_refnum, &dir_id, &vol_refnum);
- if(error_code != noErr) return(FILE_ERROR);
-
- error_code = FSOpen(
- (**w_objs_hndl).findFile.fName,
- wd_refnum,
- &file_ref_num);
-
- if ((error_code != noErr) || (file_ref_num == 0) )
- {
- StopAlert(OPEN_ERR,0);
- HUnlock((Handle)w_objs_hndl);
- return(CANCELED);
- }
-
-
-
- /*** b) check to see that there's disc space ***/
-
- count = sizeof(fileDataRecord);
- error_code = SetEOF(file_ref_num, count);
-
- if (error_code != noErr)
- {
- StopAlert(WRITE_ERR,0);
- HUnlock((Handle)w_objs_hndl);
- return(CANCELED);
- }
-
-
-
-
- /************* c) write the data to the file **********/
-
- /***
- Note: we are only writing that portion of the WObjs Record
- that includes the object-count and the objects themselves.
- We have intentionally positioned these items together at
- the end (bottom) of the definition of the WObjsRecord.
-
- Thus, by pointing to (**w_objs_hndl).vDocLimit and
- supplying a byte count equal to the size of this portion
- of the data structure, we can write just the data we want
- to the file without having to gather it together from
- separate places into a single block before writing.
- ***/
-
- /***
- Note: before writing the data out, copy the print info record from
- the heap into the window objects record.
- ***/
-
- //pr_info_hndl = (**w_objs_hndl).prInfoHndl;
- //(**w_objs_hndl).printInfo = **pr_info_hndl;
-
-
- data_ptr = (Ptr)(&(**w_objs_hndl).vDocLimit);
-
- error_code = FSWrite(file_ref_num, &count, data_ptr);
- if (error_code != noErr)
- {
- StopAlert(WRITE_ERR,0);
- HUnlock((Handle)w_objs_hndl);
- return(CANCELED);
- }
-
-
- /********* d) close the file **********/
-
-
- error_code = FSClose(file_ref_num);
-
- if (error_code != noErr)
- {
- StopAlert(WRITE_ERR,0);
- HUnlock((Handle)w_objs_hndl);
- return(CANCELED);
- }
-
-
- /************* e) post the data to the disc **********/
-
- error_code = FlushVol(0, vol_refnum);
-
- if (error_code != noErr)
- {
- StopAlert(WRITE_ERR,0);
- HUnlock((Handle)w_objs_hndl);
- return(CANCELED);
- }
-
- } /* end of do_what = SFPUT || do_what == DO_SAVE */
-
-
-
- /***
- we made it!
- ***/
-
-
- HUnlock((Handle)w_objs_hndl);
-
- (**w_objs_hndl).dirty = FALSE;
-
- return(SUCCESS);
-
- } /* end of do_save_file() */
-
- OSErr get_c_filespec(short wd_refnum,long *dir_id,short *vol_refnum)
-
- {
- WDPBRec pb_rec;
- OSErr err;
-
-
- pb_rec.ioNamePtr = NIL;
- pb_rec.ioWDProcID = 0L;
- pb_rec.ioWDIndex = 0;
- pb_rec.ioVRefNum = wd_refnum;
-
- err = PBGetWDInfo(&pb_rec, FALSE);
-
- if(err == noErr)
- {
- *dir_id = pb_rec.ioWDDirID;
- *vol_refnum = pb_rec.ioWDVRefNum;
- }
-
- return(err);
- }
-
-
-
- /********************* RestoreMatLists **********************/
- void RestoreMatLists(void)
- {
- short i,j;
- short rowInt,colInt,howMuch,matFirstReg;
- WindowPtr theWindow;
- Rect rView;
- Rect rDataBnds;
- Point cellSize;
- short procID;
- Boolean drawIt,hasGrow,scrollHoriz,scrollVert;
- Ptr dataPtr;
- Cell theCell;
- short dataLen;
- short fxLen,flLen;
-
- for( i = 1; i <= 5; i++)
- {
- switch(i)
- {
- case 1:
- matFirstReg = map.matA.firstreg;
- if( matFirstReg != 70)
- {
- theWindow = gMatAWindow;
- rowInt = map.matA.row;
- colInt = map.matA.col;
- matAList = CreateList(theWindow,rowInt,colInt);
- howMuch = rowInt * colInt;
- for( j = matFirstReg; j > matFirstReg - howMuch; j--)
- {
- ResultDeParse(map.reg[j].real,&fxLen,&flLen);
- if(gF.style == 0) dataLen = flLen;
- else if(gF.style == 1) dataLen = fxLen;
- //dataLen = gResultString[0];
- theCell.v = (matFirstReg - j) / colInt;
- theCell.h = (matFirstReg - j) % colInt;
- LSetCell(&gResultString[0],dataLen,theCell,matAList);
- }
- }
- break;
- case 2:
- matFirstReg = map.matB.firstreg;
- if( matFirstReg != 70)
- {
- theWindow = gMatBWindow;
- rowInt = map.matB.row;
- colInt = map.matB.col;
- matBList = CreateList(theWindow,rowInt,colInt);
- howMuch = rowInt * colInt;
- for( j = matFirstReg; j > matFirstReg - howMuch; j--)
- {
- ResultDeParse(map.reg[j].real,&fxLen,&flLen);
- if(gF.style == 0) dataLen = flLen;
- else if(gF.style == 1) dataLen = fxLen;
- //dataLen = gResultString[0];
- theCell.v = (matFirstReg - j) / colInt;
- theCell.h = (matFirstReg - j) % colInt;
- LSetCell(&gResultString[0],dataLen,theCell,matBList);
- }
- }
- break;
- case 3:
- matFirstReg = map.matC.firstreg;
- if( matFirstReg != 70)
- {
- theWindow = gMatCWindow;
- rowInt = map.matC.row;
- colInt = map.matC.col;
- matCList = CreateList(theWindow,rowInt,colInt);
- howMuch = rowInt * colInt;
- for( j = matFirstReg; j > matFirstReg - howMuch; j--)
- {
- ResultDeParse(map.reg[j].real,&fxLen,&flLen);
- if(gF.style == 0) dataLen = flLen;
- else if(gF.style == 1) dataLen = fxLen;
- //dataLen = gResultString[0];
- theCell.v = (matFirstReg - j) / colInt;
- theCell.h = (matFirstReg - j) % colInt;
- LSetCell(&gResultString[0],dataLen,theCell,matCList);
- }
- }
- break;
- case 4:
- matFirstReg = map.matD.firstreg;
- if( matFirstReg != 70)
- {
- theWindow = gMatDWindow;
- rowInt = map.matD.row;
- colInt = map.matD.col;
- matDList = CreateList(theWindow,rowInt,colInt);
- howMuch = rowInt * colInt;
- for( j = matFirstReg; j > matFirstReg - howMuch; j--)
- {
- ResultDeParse(map.reg[j].real,&fxLen,&flLen);
- if(gF.style == 0) dataLen = flLen;
- else if(gF.style == 1) dataLen = fxLen;
- //dataLen = gResultString[0];
- theCell.v = (matFirstReg - j) / colInt;
- theCell.h = (matFirstReg - j) % colInt;
- LSetCell(&gResultString[0],dataLen,theCell,matDList);
- }
- }
- break;
- case 5:
- matFirstReg = map.matE.firstreg;
- if( matFirstReg != 70)
- {
- theWindow = gMatEWindow;
- rowInt = map.matE.row;
- colInt = map.matE.col;
- matEList = CreateList(theWindow,rowInt,colInt);
- howMuch = rowInt * colInt;
- for( j = matFirstReg; j > matFirstReg - howMuch; j--)
- {
- ResultDeParse(map.reg[j].real,&fxLen,&flLen);
- if(gF.style == 0) dataLen = flLen;
- else if(gF.style == 1) dataLen = fxLen;
- //dataLen = gResultString[0];
- theCell.v = (matFirstReg - j) / colInt;
- theCell.h = (matFirstReg - j) % colInt;
- LSetCell(&gResultString[0],dataLen,theCell,matEList);
- }
- }
- break;
- }
- }
- }
- /********************* RestoreRegLists **********************/
- void RestoreRegLists(void)
- {
- WindowPtr theWindow;
- Point nCellSize;
- Point dCellSize;
- short range,range2;
- Rect r1nView;
- Rect r1dView;
- Rect r1nDataBnds;
- Rect r1dDataBnds;
- Rect r2nView;
- Rect r2dView;
- Rect r2nDataBnds;
- Rect r2dDataBnds;
- Rect r3nView;
- Rect r3dView;
- Rect r3nDataBnds;
- Rect r3dDataBnds;
- Rect r4nView;
- Rect r4dView;
- Rect r4nDataBnds;
- Rect r4dDataBnds;
- Cell theCell;
- short nDataLen;
- short dDataLen;
- short i,dataLen;
- short fxLen,flLen;
-
- /******** work site ********/
- theWindow = gSRegWindow;
- nCellSize.h = 20;
- nCellSize.v = 10;
- dCellSize.h = 80;
- dCellSize.v = nCellSize.v;
- if(map.memcom <= 20)
- SizeWindow(theWindow,nCellSize.h + dCellSize.h,map.memcom * nCellSize.v,TRUE);
- else if (map.memcom > 20 && map.memcom <= 40)
- SizeWindow(theWindow,2 * nCellSize.h + 2 * dCellSize.h,20 * nCellSize.v,TRUE);
- else if (map.memcom > 40 && map.memcom <= 60)
- SizeWindow(theWindow,3 * (nCellSize.h + dCellSize.h) + 1,20 * nCellSize.v,TRUE);
- else if (map.memcom > 60)
- SizeWindow(theWindow,4 * (nCellSize.h + dCellSize.h) + 1,20 * nCellSize.v,TRUE);
-
- if(map.memcom <= 20)
- {
- range = 65 - map.memcom;
- SetRect(&r1nView,0,0,nCellSize.h,map.memcom * nCellSize.v);
- SetRect(&r1dView,nCellSize.h + 1,0,nCellSize.h + dCellSize.h + 1,map.memcom * nCellSize.v);
- SetRect(&r1nDataBnds,0,0,1,map.memcom);
- SetRect(&r1dDataBnds,0,0,1,map.memcom);
- /* SizeWindow(theWindow,nCellSize.h + dCellSize.h,map.memcom * nCellSize.v,TRUE);*/
- }
- else
- {
- range = 65 - 20;
- SetRect(&r1nView,0,0,nCellSize.h,20 * nCellSize.v);
- SetRect(&r1dView,nCellSize.h + 1,0,nCellSize.h + dCellSize.h + 1,20 * nCellSize.v);
- SetRect(&r1nDataBnds,0,0,1,20);
- SetRect(&r1dDataBnds,0,0,1,20);
- }
- /*if(!SRegListn1)*/
- SRegListn1 = LNew( &r1nView,
- &r1nDataBnds, /* (0,0,0,0) */
- nCellSize, /* (0,0)(0,0) */
- 0, /* procID */
- theWindow,
- 1, /* drawIt */
- 0, /* hasGrow */
- 0, /* scrollHoriz */
- 0 /* scrollVert */
- );
- /*if(!SRegListd1)*/
- SRegListd1 = LNew( &r1dView,
- &r1dDataBnds, /* (0,0,0,0) */
- dCellSize, /* (0,0)(0,0) */
- 0, /* procID */
- theWindow,
- 1, /* drawIt */
- 0, /* hasGrow */
- 0, /* scrollHoriz */
- 0 /* scrollVert */
- );
- theCell.h = 0;
- nDataLen = 2;
- for(i = 65; i > range; i--)
- {
- IndexDeparse(i);
- theCell.v = 65 - i;
- LSetCell(&gIndexString[0],nDataLen,theCell,SRegListn1);
- ResultDeParse(map.reg[i].real,&fxLen,&flLen);
- if(gF.style == 0) dDataLen = flLen;
- else if(gF.style == 1) dDataLen = fxLen;
- //dDataLen = gResultString[0];
- LSetCell(&gResultString[0],dDataLen,theCell,SRegListd1);
- }
-
-
- /*if(map.memcom > 20 && map.memcom <= 40)*/
- if(map.memcom > 20) /* range = 65 - map.memcom; */
- {
- SetRect(&r2nView,nCellSize.h + dCellSize.h + 1,0,2 * nCellSize.h + dCellSize.h,20 * nCellSize.v);
- SetRect(&r2dView,2 * nCellSize.h + dCellSize.h + 1,0,2 * nCellSize.h + 2 * dCellSize.h,20 * nCellSize.v);
- SetRect(&r2nDataBnds,0,0,1,map.memcom);
- SetRect(&r2dDataBnds,0,0,1,map.memcom);
- /* SizeWindow(theWindow,2 * nCellSize.h + 2 * dCellSize.h,20 * nCellSize.v,TRUE);*/
- SRegListn2 = LNew( &r2nView,
- &r2nDataBnds, /* (0,0,0,0) */
- nCellSize, /* (0,0)(0,0) */
- 0, /* procID */
- theWindow,
- 1, /* drawIt */
- 0, /* hasGrow */
- 0, /* scrollHoriz */
- 0 /* scrollVert */
- );
- SRegListd2 = LNew( &r2dView,
- &r2dDataBnds, /* (0,0,0,0) */
- dCellSize, /* (0,0)(0,0) */
- 0, /* procID */
- theWindow,
- 1, /* drawIt */
- 0, /* hasGrow */
- 0, /* scrollHoriz */
- 0 /* scrollVert */
- );
- if(map.memcom > 20 && map.memcom < 40)
- {
- range2 = 65 - map.memcom;
- }
- else
- {
- range2 = 25;
- }
- for(i = 45; i > range2; i--)
- {
- IndexDeparse(i);
- theCell.v = 45 - i;
- LSetCell(&gIndexString[0],nDataLen,theCell,SRegListn2);
- ResultDeParse(map.reg[i].real,&fxLen,&flLen);
- if(gF.style == 0) dDataLen = flLen;
- else if(gF.style == 1) dDataLen = fxLen;
- //dDataLen = gResultString[0];
- LSetCell(&gResultString[0],dDataLen,theCell,SRegListd2);
- }
- }
- /*if(map.memcom > 40 && map.memcom <= 60)*/
- if(map.memcom > 40)
- {
- SetRect(&r3nView,2 * (nCellSize.h + dCellSize.h) + 1,0,3 * nCellSize.h + 2 * dCellSize.h,20 * nCellSize.v);
-
- SetRect(&r3dView,3 * nCellSize.h + 2 * dCellSize.h + 1,0,3 * (nCellSize.h + dCellSize.h) + 1,20 * nCellSize.v);
-
- SetRect(&r3nDataBnds,0,0,1,map.memcom);
- SetRect(&r3dDataBnds,0,0,1,map.memcom);
- /* SizeWindow(theWindow,3 * (nCellSize.h + dCellSize.h) + 1,20 * nCellSize.v,TRUE);*/
- SRegListn3 = LNew( &r3nView,
- &r3nDataBnds, /* (0,0,0,0) */
- nCellSize, /* (0,0)(0,0) */
- 0, /* procID */
- theWindow,
- 1, /* drawIt */
- 0, /* hasGrow */
- 0, /* scrollHoriz */
- 0 /* scrollVert */
- );
- SRegListd3 = LNew( &r3dView,
- &r3dDataBnds, /* (0,0,0,0) */
- dCellSize, /* (0,0)(0,0) */
- 0, /* procID */
- theWindow,
- 1, /* drawIt */
- 0, /* hasGrow */
- 0, /* scrollHoriz */
- 0 /* scrollVert */
- );
- if(map.memcom > 40 && map.memcom < 60)
- {
- range2 = 65 - map.memcom;
- }
- else
- {
- range2 = 5;
- }
- for(i = 25; i > range2; i--)
- {
- IndexDeparse(i);
- theCell.v = 25 - i;
- LSetCell(&gIndexString[0],nDataLen,theCell,SRegListn3);
- ResultDeParse(map.reg[i].real,&fxLen,&flLen);
- if(gF.style == 0) dDataLen = flLen;
- else if(gF.style == 1) dDataLen = fxLen;
- //dDataLen = gResultString[0];
- LSetCell(&gResultString[0],dDataLen,theCell,SRegListd3);
- }
- }
- if(map.memcom > 60)
- {
- SetRect(&r4nView,3 * (nCellSize.h + dCellSize.h) + 1,0,4 * nCellSize.h + 3 * dCellSize.h + 1,20 * nCellSize.v);
-
- SetRect(&r4dView,4 * nCellSize.h + 3 * dCellSize.h + 1,0,4 * (nCellSize.h + dCellSize.h) + 1,20 * nCellSize.v);
-
- SetRect(&r4nDataBnds,0,0,1,map.memcom);
- SetRect(&r4dDataBnds,0,0,1,map.memcom);
- /* SizeWindow(theWindow,4 * (nCellSize.h + dCellSize.h) + 1,20 * nCellSize.v,TRUE);*/
- SRegListn4 = LNew( &r4nView,
- &r4nDataBnds, /* (0,0,0,0) */
- nCellSize, /* (0,0)(0,0) */
- 0, /* procID */
- theWindow,
- 1, /* drawIt */
- 0, /* hasGrow */
- 0, /* scrollHoriz */
- 0 /* scrollVert */
- );
- SRegListd4 = LNew( &r4dView,
- &r4dDataBnds, /* (0,0,0,0) */
- dCellSize, /* (0,0)(0,0) */
- 0, /* procID */
- theWindow,
- 1, /* drawIt */
- 0, /* hasGrow */
- 0, /* scrollHoriz */
- 0 /* scrollVert */
- );
- for(i = 5; i > 65 - map.memcom; i--)
- {
- IndexDeparse(i);
- theCell.v = 5 - i;
- LSetCell(&gIndexString[0],nDataLen,theCell,SRegListn4);
- ResultDeParse(map.reg[i].real,&fxLen,&flLen);
- if(gF.style == 0) dDataLen = flLen;
- else if(gF.style == 1) dDataLen = fxLen;
- //dDataLen = gResultString[0];
- LSetCell(&gResultString[0],dDataLen,theCell,SRegListd4);
- }
-
-
- }
- if(preRegistered) DipShit();
-
- }
- /********************* IndexDeparse **********************/
- void IndexDeparse(short i) /* this is used at launch time to read register values into the */
- //short i; /* registers list */
- {
- decimal result;
- double_t temp;
- Str255 sresult;
-
- gF.style = 1; /*1 is for fixed point*/
- gF.digits = 2; /*10 - (log(map.stk1.real))/(log(10));*/ /* Fixed point */
- temp = i;
- num2dec(&gF,temp,&result);
- //x96tox80(&temp,&result);
- //num2str( &gF, result, &gIndexString );
- //num2str( &gF, temp, &gIndexString );
- //sprintf(gIndexString,"%f",temp);
- dec2str(&gF,&result,gIndexString);
- }
-
- /********************** CreateList ***********************/
- ListHandle CreateList(WindowPtr theWindow,short rowInt,short colInt)
- //WindowPtr theWindow;
- //short rowInt;
- //short colInt;
- {
- ListHandle theList;
- Rect rView;
- Rect rDataBnds;
- Point cellSize;
- short procID;
- Boolean drawIt,hasGrow,scrollHoriz,scrollVert;
- Ptr dataPtr;
-
- //SetRect(&rView,0,0,colInt*100,rowInt*15);
- SetRect(&rView,0,0,colInt*120,rowInt*15);
- SetRect(&rDataBnds,0,0,colInt,rowInt);
- cellSize.h = 80;
- //cellSize.h = 100;
- cellSize.v = 10;
- theList = LNew( &rView,
- &rDataBnds, /* (0,0,0,0) the rect is cells, not pixels*/
- cellSize, /* (0,0)(0,0) */
- 0, /* procID */
- theWindow,
- 1, /* drawIt */
- 0, /* hasGrow */
- 0, /* scrollHoriz */
- 0 /* scrollVert */
- );
- SizeWindow( theWindow,colInt*80,rowInt*10,TRUE);
- //SizeWindow( theWindow,colInt*100,rowInt*10,TRUE);
- return theList;
- }
-
- /*********************** FillList ************************/
-
- /* from where is this called? */ /* <------look at this! */
-
- //void FillList(short rowInt,short colInt,WindowPtr theWindow,short matFirstReg)
- //short rowInt;
- //short colInt;
- //WindowPtr theWindow;
- //short matFirstReg;
- //{
- // ListHandle theList;
- // short j,howMuch;
- // Cell theCell;
- // short dataLen;
- // short fxLen,flLen;
-
- // howMuch = rowInt * colInt;
- // for( j = matFirstReg; j >= howMuch; j--)
- // {
- // ResultDeParse(map.reg[j].real,&fxLen,&flLen);
- // if(gF.style == 0) dataLen = flLen;
- // else if(gF.style == 1) dataLen = fxLen;
- // //dataLen = gResultString[0];
- // theCell.v = (matFirstReg - j) / colInt;
- // theCell.h = (matFirstReg - j) % colInt;
- // LSetCell(&gResultString[0],dataLen,theCell,theList);
- // }
- //}
-