Sindbad~EG File Manager
/* M. Beeson, for Mathpert.
Original date 5.31.94
Last modified 4.7.96
10.7.04 added "problemnumbers" to doc data.
1.18.06 added the papyrus field to the document
1.19.06 pasted papyrus.h into this file
3.17.06 removed repeated typedef short coord
Specification of the data private to a Mathpert document.
There are two types of documents: graph documents and symbol documents.
However, since we need all the symbolic apparatus while making
graphs, in order to calculate singularities for example, we
use only one type of document data structure.
*/
#ifndef COORD
typedef short coord;
#define COORD
#endif
#define MAXDOCUMENTS 6 /* maximum number of simultaneously-open documents */
#define GRAPHDOC 0
#define SYMBOLDOC 1
#define GRAPHDOC3D 2
#define MAXGRAPHS 6 /* maximum number of graph lines */
#define MAXHWFILES 8 /* max number of user files or textbooks
that can be open at any one time */
#define MAXHOMEWORKS (MAXDOCUMENTS + MAXHWFILES +1)
#define NFINDITFAST 5 /* dimension of the find-it-fast menu */
/*_______________________________________________________________________*/
/* The following data structure (Papyrus) is associated to a symbolic
document, but is not saved when the document is saved. When a saved
document is opened, this structure must be created again; it may
be different if the document is opened on a different machine or
even in a different window. */
/* First we need a structure to specify the location of a single line.
The YPAIRs specify the top and bottom of the components of the line
in papyrus coordinates */
typedef struct { coord x;
coord y;
} YPAIR;
typedef struct { YPAIR formula;
YPAIR reasonrect;
YPAIR comment;
} line; /* 12 bytes per line */
typedef struct
{ int cxChar; /* horizontal pixels corresponding to 16 papyrus coordinate units */
int cyChar; /* height of current font in pixels */
/* That is, pixels corresponding to 16 vertical papyrus coordinate units */
short width; /* of papyrus, in papyrus coordinates */
short height; /* of papyrus, in papyrus coordinates. Measures area on which lines are written,
not including any blank area below the solution-so-far. */
short top; /* of window, in papyrus coordinates */
short left; /* of window, in papyrus coordinates */
short right; /* of window, in papyrus coordinates */
short bottom; /* of window, in papyrus coordinates. Note this corresponds to
the bottom of the window, not the bottom of the window
minus the bottommargin. */
short clientRight; /* client coordinates of the right of the solution window */
short clientBottom; /* the top and left will always be zero */
short leftmargin;/* x coordinate at which formulas begin */
short rightmargin; /* how far left of pPapyrus->right the formulas will break;
but + signs in a sum can occur to the right of here */
short topmargin; /* y coordinate at which formulas begin */
short bottommargin; /* leave this much room at the bottom of the window below the
last displayed formula. */
short reasons; /* x-coordinate at which justifications begin */
line *lines; /* array of pointers to line, of dimension nlines*/
short nlines; /* dimension of the lines array */
void *selected; /* linked list of subterms of the active line currently selected by user */
/* making it void * enables compiling without lterm.h */
int selectedline; /* history[selectedline] is the line from which the
selected terms are chosen */
} Papyrus;
#define REASONLINE 29 /* papyrus->reasons is set to start reasons
this multiple of 16 from the right of the papyrus. */
typedef struct
{ unsigned char *reason;
unsigned char *comment;
unsigned char controlflags;
unsigned short eigenindex; /* index of eigenvariable in varlist */
} linedata;
/*_______________________________________________________________________*/
typedef struct
{ unsigned mathmode:3;
unsigned display_on:1; /* zero means display is off, e.g. for think_ahead */
unsigned memoryflag:1; /* whether display of available heap is on */
unsigned complex_frozen:1; /* can user turn complex on/off? */
unsigned checksolutionsflag:1;
unsigned substitutionflag:1;
unsigned logcollectflag:1;
unsigned comdenomflag:1; /* documented in autosimp.c */
unsigned linebreaks:1; /* set if linebreaks are desired */
unsigned nfailedops:2; /* number of valid entries in failedops array */
int radicalflag:3; /* documented in autosimp.c */
unsigned finishedflag:1; /* means automode can't do more */
unsigned assumptions_visible:1;
unsigned definitions_visible:1;
int expandflag;
int trigexpandflag; /* documented in autosimp.c */
int factorflag; /* controls factoring in auto mode; defined in automode.c */
int selected_equation;
int problemtype;
int currenttopic;
term minmax_interval;
assumption *pending; /* used in integration by subst */
hashbucket model[HASHPRIME]; /* user model for this document */
inhibition *inhibitions; /* header of the linked list of inhibitions */
int successivefailures; /* number of wrong operator choices in a row
without success either in menu or auto mode */
int localfailures; /* number of wrong operator choices on this problem */
int autosteps; /* count successive steps in automode */
operation *opseq; /* history of operator use */
actualop failedops[4];
linedata *linedatahistory; /* reason, comment, and control flag history */
unsigned nlinedata; /* dimension of the above array */
operation plan[NFINDITFAST]; /* operators automode thinks should be used next */
unsigned long hwnd; /* handle of the document window */
int showstepflag; /* set to 1 while showstep is running */
} controldata;
/*_______________________________________________________________________*/
typedef struct /* data local to a document */
{ /* Document control________________________________________*/
unsigned kind:2; /* SYMBOLDOC, GRAPHDOC, 3DGRAPHDOC */
unsigned problemsource:6; /* SOURCE_MATHPERT, SOURCE_USER, SOURCE_FILE, SOURCE_TEXTBOOK */
/* further values of problemsource will refer to 'other textbooks' */
int docnumber;
int problemtype;
int currenttopic;
int originaltopic; /* see wfile.c */
int version; /* 102 for version 1.02 */
unsigned long hwnd; /* handle of the document window */
Papyrus *papyrus; /* structure that assists in display of formulas */
unsigned long brotherdoc; /* handle of the associated graph window of
a symbol document, or the document that
gave rise to this graph window, if any */
unsigned long progresshwnd; /* handle of the display_progress dialog box */
int magnification; /* scale factor for font size, 16 is normal */
unsigned long backgroundcolor;
unsigned long textcolor;
unsigned long highlightcolor;
unsigned long reasoncolor;
unsigned long selectioncolor; /* for terms selected with the mouse */
int backgroundpattern; /* if nonzero, then this is
an index of a bitmap to use for a background */
unsigned textweight:1; /* 1 means boldface */
unsigned initialized:1; /* set when the document has been initialized */
unsigned justsaved:1; /* 1 means the document has just been saved to disk
so you don't need confirmation to close it. */
unsigned problemready:1;
char *saveas; /* filename if this document is saved */
/* Control variables--these control auto mode_____________ */
controldata DocControlData;
/* Polyval control flags __________________________________*/
polyflags DocPolyData; /* see polyval.h */
/* including infractionflag, arithflag, complex, orderflag */
/* Display data___________________________________________*/
unsigned anddisplay:2;
unsigned ordisplay:2;
unsigned falsedisplay:1; /* 0 means 'false', 1 means 'No solution' */
coord breakcol;
coord maxfract;
/* Memory management_______________________________________*/
unit *heap;
unsigned heapsize; /* in 'units', see heap.c */
/* Variables________________________________________________*/
vardata DocVarData;
/* varlist, varinfo, parameters, defns,
nvariables, eigenvariable, maxvariables;
nparameters, maxparameters, maxdefns, nextdefn;
currentline
*/
/* Homework file_____________________________________________*/
int homework[MAXHOMEWORKS]; /* indices of the homework structures
to use with each choice of 'source' */
/* homework structures are defined in wfile.h */
int problemnumbers[MAXHOMEWORKS]; /* problem numbers in each homework structure */
/* Assumptions and theorems_________________________________*/
proverdata DocProverData;
/* assumptions, maxassumptions, nextassumption,
theorems, maxtheorems, nexttheorem,
history, maxhistory, (but not currentline)
succedent, workspace, maxworkspace, nextworkspace,
and solver (function pointer to a equation solver)
*/
/*Graphs____________________________________________________*/
int mainchoice;/* which type of graph(s) to draw */
/* possible values of mainchoice are in mainchoi.h */
int active_parameter; /* which parameter will respond to +/- */
term function; /* function or functions to be graphed;
if there are several this will be a
term with functor AND */
graph *graphs[MAXGRAPHS]; /* One for each graph line */
long display3d; /* RenderLib display for 3d graphs */
long viewport3d; /* RenderLib viewport for 3d graphs */
int ngraphs; /* used dimension of the graphs array */
/* User-defined functions____________________________________*/
/* These are shared between documents but still need to be saved */
int nuserfunctions;
char **defns; /* array of nuserfunctions definitions, each of form lhs = rhs */
} DOCDATA;
typedef DOCDATA *PDOCDATA;
#define PGRAPHDATA PDOCDATA
#define PSYMBOLDATA PDOCDATA
#define SYMBOLDATA DOCDATA
#define GRAPHDATA DOCDATA
/* Each document gets an identifying number, stored in the
docnumber field. These are never re-used in a given session,
even if documents are closed. When a document is restored
from disk, it is given a new document number. */
/* 'ringflag' controls what kind of factors will be sought in auto mode.
Do we want: (bit 0 = 0) integer factors (clearing denoms first)
(bit 0 = 1) rational factors ok
(bit 4 = 0) complex factors not wanted
(bit 4 = 1) complex factors ok
(bit 8 = 0) algebraic factors like (x-�3) not wanted
(bit 8 = 1) algebraic factors ok
The following #-defined constants are used to set the value of ringflag:
*/
#define INTRING 0x0000
#define RATRING 0x0001
#define GAUSSINT 0x0010
#define GAUSSRAT 0x0011
#define ALGINT 0x0100
#define REALRING 0x0101
#define COMPLEXALGINT 0x0110
#define COMPLEXRING 0x0111
/*_______________________________________________________________________*/
/* Mathpert has global variables corresponding to the fields of a
document. These are called 'document globals'. The functions
active and deactivate translate between these
variables and the 'document internals', or fields of the document
data structure. */
void activate(PDOCDATA); /* called under WM_MDIACTIVATE */
void deactivate(PDOCDATA); /* called under WM_MDIACTIVATE when deactivating */
void activate_by_hwnd(unsigned long); /* called under WM_PAINT */
/* In Windows the arg of activate_by_hwnd is an HWND */
int init_doc_data(int, PDOCDATA);
#define ASCENDING 1
#define DESCENDING 0 /* values of 'orderflag' */
#define VISIBLESUBS 1 /* values of substitutionflag */
#define INVISIBLESUBS 0
MEXPORT_AUTOMODE void set_controldata(controldata *); /* defined in cflags.c */
MEXPORT_AUTOMODE void get_controldata(controldata *);
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists