home *** CD-ROM | disk | FTP | other *** search
- ToolLibrary V 2.06
- ⌐ by Rⁿdiger Dreier 1988/9/90
- Plotter is FREEWARE.
-
-
- THE AUTHOR UNDERTAKES NO LIABILITY FOR ANY DAMAGE CAUSED BY THE APPROPRIATE
- OR NOT APPROPRIATE USE OF THIS PROGRAM !
- THE AUTHOR UNDERTAKES NO LIABILITY FOR THE FAULTLESSNESS OF THIS PROGRAM !
- USE IT AT YOUR OWN RISK !
-
- The tool.library is a shared library for the Amiga. Copy it to your LIBS:.
- You also need mathieeedoubbas.library and mathieeedoubtrans.library in
- LIBS:.
-
- Open the library:
- struct ToolBase *ToolBase; /* Global */
-
- ToolBase=(struct ToolBase *)OpenLibrary("tool.library,0");
-
- Struct ToolBase contains pointers to the four libraries IntuitionBase,
- GfxBase and the two MathIeee.....Base's. So, if a program uses
- tool.library, you can get access to these other libraries like this:
- IntuitionBase=ToolBase->IntuitionBase;
- You need not to open them. Perhaps that is not legal, but tool.library
- opens this libraries, so they are in memory. It works and should work with
- newer versions of Kickstart, too.
-
- A short description of the functions:
-
- STRINGS:
- VOID left (char *Dest,char *Source,LONG Number)(a0,a1,d0)
- VOID right(char *Dest,char *Source,LONG Number)(a0,a1,d0)
- VOID mid (char *Dest,char *Source,LONG Start,LONG Number)(a0,a1,d0,d1)
-
- These three functions are similar to those in Basic. Dest must be big
- enough.
-
- VOID copy(LONG start,LONG Number,char *Dest,char *source)(d0,d1,d2,d3)
-
- This function is similar to mid, it is here cause of compatibility.
-
-
- LONGcheck (LONG Char1,LONG Char2,LONG Start,LONG End,char *String)
- (d0,d1,d2,d3,a0)
- LONG checkback(LONG Char1, LONG Char2, LONG Start, LONG End, char *String)
- (d0,d1,d2,d3,a0)
-
- This two functions are quite difficult to explain. They search for the
- first appearance of the two chars (Char1 and Char2). Therefore, they are
- aware of the brackets. Checkback begins at the end of the string, check at
- the beginning. Example:
- string: 1+(2-4) Start:0 End:6
- The - sign is not found, because of the brackets.
- string: 1+(2-4) Start:3 End:5
- The - sign is found, a 4 is returned.
-
-
- LONG AnzahlKlammern(char *String)(a0)
-
- (Numberofbrackets) Returns the number of open brackets:
- Returns: 0: there is exactly one ( for every )
- <0: too much )
- >0: too much (
-
-
- HELP FOR INTUITION AND GRAPHIC
-
- LONG request(char *yes,char *no,char *body)(d0,d1,d2)
-
- Opens an autorequester on the actual screen.
-
- LONG NewRequest( struct Window *Window,
- char *yes,
- char *no,
- char *body)(a0,d0,d1,d2)
- The same as before, but here you can decide for which window the requester
- appears.
-
-
- LONG EventAbfrage(struct Window *Window,struct info *msginfo)(a0,a1)
-
- You can use this function instead of GetMsg();ReplyMsg();
-
-
- VOID Print(struct RastPort *RP,
- char *text,
- LONG col,
- LONG xpos,
- LONG ypos)(a1,a0,d0,d1,d2)
-
- Displays a text on the RastPort.
-
-
- VOID Center(struct Window *Window,
- char *text,
- LONG Farbe,
- LONG yPos)(a1,a0,d0,d1)
-
- The same, but here the text is automatically centered.
-
-
- VOID Box(struct RastPort *RP,
- LONG x1,y1,x2,y2)(a1,d0,d1,d2,d3)
-
- Draws a box on the RastPort.
-
-
- VOID Gadget_On (struct Gadget *Gadget,struct Window *Window)(a0,a1)
- VOID Gadget_Off(struct Gadget *Gadget,struct Window *Window)(a0,a1)
-
- These two functions can be used instead of GadgetOn/Off (from Intuition.
- library). Gadget_On makes sure that the Gadget is not only active but also
- correctly drawn.
-
-
- LONG GetPropPosH(struct Gadget *Gadget,LONG MaxPos)(a0,d0)
- LONG GetPropPosV(struct Gadget *Gadget,LONG MaxPos)(a0,d0)
- VOID SetPropPosH( struct Gadget *Gadget,
- struct Window *Window,
- LONG MaxPos,
- LONG Step,
- LONG NewPos)(a0,a1,d0,d1,d2)
- VOID SetPropPosV( struct Gadget *Gadget,
- struct Window *Window,
- LONG MaxPos,
- LONG Step,
- LONG NewPos)(a0,a1,d0,d1,d2)
-
- These four functions are for easier use of the propgadgets.
- MaxPos: maximum number of positions for this gadget
- Step : number of positions, the knob moves when clicking in the gadget
- NewPos: the new position.
-
-
- LONG PrepareTmpRas(struct RastPort *RP)(a1)
- VOID ClearTmpRas (struct RastPort *RP)(a1)
-
- To prepare a RastPort for the use of the Flood-function, use
- PrepareTmpRas. It returns 0 when there was not enough memory or the TmpRas
- was already installed. Before exit, you should call ClearTmpRas to free
- memory.
-
-
- LONG PrepareArea(struct RastPort *RP,LONG MaxPoints)(a1,d0)
- VOID ClearArea (struct RastPort *RP)(a1)
-
- The Area-functions need a bit more of work. So if you want to use them,
- call PrepareArea. Do NOT call PrepareTmpRas first ! This call is part of
- PrepareArea. It returns 0 if it failed. To free memory, call ClearArea.
-
-
- To get simple menus very fast, use the following functions:
- DO NOT USE ANY STATIC MENUS !
- struct Menu *AddMenu(struct Menu *menu,
- char *Title,
- unsigned short Flags);
-
- This function adds a menu to the list. For the first call, menu must be
- ZERO ! The return value of the first call is the "menu" argument for all
- other calls to any of the Add..functions ! So you have to save it
- somewhere. You do not need the return value of the other calls.
-
- struct Item *AddItem(struct Menu *menu,
- char *Title,
- unsigned short Flags,
- char HotKey);
-
- This function adds an item to the last menu in the list. If Title is a
- pointer to char, INTUITEXT must be set in Flags. Otherwise, Title is
- interpreted as pointer to a Image-struct and an image is displayed. If you
- want to use a HotKey, also COMMSEQ must be set in Flags. The memory for
- the item (and if needed) the intuitext is allocated. BackPen, FrontPen and
- DrawMode are set by using the values from the first item of the first menu
- (if there is one). Otherwise some standart values are taken. To change
- e.g. the BackPen, use the following:
- struct Item *item;
- struct IntuiText *IT;
- item=AddItem(menu,"TestItem",INTUITEXT,0);
- IT=(struct IntuiText *)item->ItemFill;
- IT->BackPen=....;
- If this item is the first item of the first menu, this value will be used
- for all items and subitems.
- THERE IS NO MEMORY ALLOCATED FOR THE STRING, FREEING THE MEMORY OF THE
- STRING MAY CAUSE A GURU !
-
-
- struct Item *AddSub(struct Menu *menu,
- char *Title,
- unsigned short Flags,
- char HotKey);
-
- Add a subitem to the last defined item.
-
-
- VOID NewSetMenuStrip(struct Window *Window,struct Menu *menu);
-
- To make the menu active, use this command instead of SetMenuStrip();
-
-
- VOID ClearMenu(struct Menu *menu);
-
- To free the memory of the menu, use this function. You MUST call
- ClearMenuStrip(); first !!!!!
-
-
- struct Menu *LastMenu(struct Menu *menu);
- struct MenuItem *LastItem(struct Menu *menu);
- struct MenuItem *LastSub(struct Menu *menu);
- struct Menu *FreeMenu(struct Menu *menu);
- struct MenuItem *FreeItem(struct MenuItem *item);
-
- These functions are used by the other function. If you need them.......
-
-
- MATHEMATICAL FUNCTIONS
-
- VOID UmwFtoS(char *Dest,DOUBLE *Number,LONG Nachkomma)(a0,a1,d0)
-
- Converts a DOUBLE to a string. Example:
- DOUBLE a=5.34524352;
- char string[50];
- UmwFtoS(string,&a,3); -> string: 5.345
- UmwFtoS(string,&a,5); -> string: 5.34524
-
-
- VOID UmwStoF(DOUBLE *Dest,char *Source)(a0,a1)
-
- And vice versa.......
-
-
- VOID Fak(DOUBLE *Dest,LONG a)(a0,d0)
- VOID NuK(DOUBLE *Dest,LONG a,LONG b)(a0,d0,d1)
-
- Fak calculates a!, NuK calculates a!/(b!*(b-a)!)
-
-
- APTR Init_Konst()()
-
- Allocates memory for 26 DOUBLEs.
-
-
- LONG Set_Konst_P(APTR Zeiger,LONG Nummer,DOUBLE *Wert)(a0,d0,d1)
-
- You can set one of these 26 DOUBLE to Wert.
-
- VOID GetKonst_P(DOUBLE *Dest,APTR Zeiger,LONG Nummer)(a0,a1,d1)
-
- And read them again...
-
- VOID Free_Konst(APTR Zeiger)(a0)
-
- To free the memory....
-
-
- struct Block *Init_Mem(char *Zeiger)(a0)
- LONG Init_Block(struct Block *Zeiger)(a0)
- LONG PreCalc(struct Block *Zeiger,APTR Konstanten)(d0,d1)
- LONG Calc_P(DOUBLE *Dest,struct Block *Zeiger,DOUBLE *Wert)(a0,a1,a2)
- VOID Free_Block(struct Block *Zeiger)(a0)
-
- Difficult. Let's say you have a string STRING="sin(x)". Now you want to
- know the "value" of the string for x=3. So:
- Call Init_Mem: Start=Init_Mem(STRING);
- Start should be a pointer to Block.
- Then: Init_Block(Start);
- After this, STRING is no longer used. Init_Mem allocates the memory for
- the first "Block" and Init_Block calculates a tree according to the
- function in STRING.
- Then: PreCalc(Start,Const);
- Const should be the pointer you get from Init_Konst() or NULL;
- To get the value of sin(x) for x=3 :
- DOUBLE x=3.0,Dest;
- Calc_P(&Dest,Start,&x);
- Now you have the value in Dest. If you now want to know the same for
- x=3.1: x=3.1;
- Calc_P(&Dest,Start,&x);
- Easy, isn't it ?
- To free the memory, call Free_Block(Start);
- Three of these functions return a LONG, it is an error code. It is
- explained in tool.h.
-
- The string may consist of: +-*/^, e(2.7..), pi(3.14..), a-z (exept e),
- ((a)sin, (a)cos, (a)tan), log, ln, abs (Absolut), sgn (sign), int and sqr
- and numbers (1; 1.0; .1;1e5;-3d-5). All characters must be lower case !
- Constants must be set with the _Konst functions. If you change a constant,
- you must call PreCalc again.
-
-
- VOID berechnen(DOUBLE *Dest,char *string,
- DOUBLE *x,
- struct Konstanten *konstanten,
- LONG *fehler)(a0,d0,d1,d2,d3)
-
- If you only want to calculate one value, use this function: It needs the
- same parameters and does everything that is needed. But if you want to
- calculate more values for the same function, the long way is faster.
-
-
- If you have hints, questions (please add postage for the answer),
- bug-reports or money for me, here is my address:
-
- Rⁿdiger Dreier
- Gustav-Winkler Str. 40
- D-4800 Bielefeld 18
- West Germany
-
-
-
-
-
-
-
-
-
-
-
-