home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 August / PCWorld_2000-08_cd.bin / Software / TemaCD / xbasic / xbpro.exe / xb / amath.x < prev    next >
Text File  |  1996-01-19  |  56KB  |  1,466 lines

  1. '
  2. ' ####################
  3. ' #####  PROLOG  #####
  4. ' ####################
  5. '
  6. PROGRAM    "amath"
  7. VERSION    "0.0009"
  8. '
  9. IMPORT    "xma"
  10. IMPORT    "xst"
  11. IMPORT    "xgr"
  12. IMPORT    "xui"
  13. '
  14. '
  15. '    ***********************************
  16. '    *****  Application Functions  *****
  17. '    ***********************************
  18. '
  19. DECLARE  FUNCTION  Entry         ()
  20. INTERNAL FUNCTION  InitGui       ()
  21. INTERNAL FUNCTION  InitProgram   ()
  22. INTERNAL FUNCTION  CreateWindows ()
  23. INTERNAL FUNCTION  InitWindows   ()
  24. INTERNAL FUNCTION  Math          (grid, message, v0, v1, v2, v3, r0, ANY)
  25. INTERNAL FUNCTION  MathCode      (grid, message, v0, v1, v2, v3, kid, ANY)
  26. '
  27. '
  28. ' ######################
  29. ' #####  Entry ()  #####
  30. ' ######################
  31. '
  32. FUNCTION  Entry ()
  33.     SHARED  terminateProgram
  34. '
  35.     InitGui ()                                        ' initialize messages
  36.     InitProgram ()                                ' initialize this program
  37.     CreateWindows ()                            ' create main window and others
  38.     InitWindows ()                                ' initialize windows
  39. '
  40.     DO                                                        ' the message loop
  41.         XgrProcessMessages (1)            ' process one message
  42.     LOOP UNTIL terminateProgram        ' and repeats until program is terminated
  43. END FUNCTION
  44. '
  45. '
  46. ' ########################
  47. ' #####  InitGui ()  #####
  48. ' ########################
  49. '
  50. ' InitGui() initializes cursor, icon, message, and display variables.
  51. ' Programs can reference these variables, but must never change them.
  52. '
  53. FUNCTION  InitGui ()
  54. '
  55. ' ***************************************
  56. ' *****  Register Standard Cursors  *****
  57. ' ***************************************
  58. '
  59.     XgrRegisterCursor (@"Arrow",            @#cursorArrow)
  60.     XgrRegisterCursor (@"UpArrow",        @#cursorArrowN)
  61.     XgrRegisterCursor (@"Arrow",            @#cursorArrowNW)
  62.     XgrRegisterCursor (@"SizeNS",            @#cursorArrowsNS)
  63.     XgrRegisterCursor (@"SizeWE",            @#cursorArrowsWE)
  64.     XgrRegisterCursor (@"SizeNWSE",        @#cursorArrowsNWSE)
  65.     XgrRegisterCursor (@"SizeNESW",        @#cursorArrowsNESW)
  66.     XgrRegisterCursor (@"SizeAll",        @#cursorArrowsAll)
  67.     XgrRegisterCursor (@"CrossHair",    @#cursorCrosshair)
  68.     XgrRegisterCursor (@"Arrow",            @#cursorDefault)
  69.     XgrRegisterCursor (@"Wait",                @#cursorHourglass)
  70.     XgrRegisterCursor (@"Insert",            @#cursorInsert)
  71.     XgrRegisterCursor (@"No",                    @#cursorNo)
  72.     XgrRegisterCursor (@"Arrow",            @#defaultCursor)
  73. '
  74. '
  75. ' ********************************************
  76. ' *****  Register Standard Window Icons  *****
  77. ' ********************************************
  78. '
  79.     XgrRegisterIcon (@"hand",                    @#iconHand)
  80.     XgrRegisterIcon (@"asterisk",            @#iconAsterisk)
  81.     XgrRegisterIcon (@"question",            @#iconQuestion)
  82.     XgrRegisterIcon (@"exclamation",    @#iconExclamation)
  83.     XgrRegisterIcon (@"application",    @#iconApplication)
  84. '
  85.     XgrRegisterIcon (@"hand",                    @#iconStop)                        ' alias
  86.     XgrRegisterIcon (@"asterisk",            @#iconInformation)        ' alias
  87.     XgrRegisterIcon (@"application",  @#iconBlank)                    ' alias
  88. '
  89.     XgrRegisterIcon (@"window",                @#iconWindow)                    ' custom
  90. '
  91. '
  92. ' ******************************
  93. ' *****  Register Messages *****  Create message numbers for message names
  94. ' ******************************
  95. '
  96.     XgrRegisterMessage (@"Blowback",                                        @#Blowback)
  97.     XgrRegisterMessage (@"Callback",                                        @#Callback)
  98.     XgrRegisterMessage (@"Cancel",                                            @#Cancel)
  99.     XgrRegisterMessage (@"Change",                                            @#Change)
  100.     XgrRegisterMessage (@"CloseWindow",                                    @#CloseWindow)
  101.     XgrRegisterMessage (@"ContextChange",                                @#ContextChange)
  102.     XgrRegisterMessage (@"Create",                                            @#Create)
  103.     XgrRegisterMessage (@"CreateValueArray",                        @#CreateValueArray)
  104.     XgrRegisterMessage (@"CreateWindow",                                @#CreateWindow)
  105.     XgrRegisterMessage (@"CursorH",                                            @#CursorH)
  106.     XgrRegisterMessage (@"CursorV",                                            @#CursorV)
  107.     XgrRegisterMessage (@"Deselected",                                    @#Deselected)
  108.     XgrRegisterMessage (@"Destroy",                                            @#Destroy)
  109.     XgrRegisterMessage (@"Destroyed",                                        @#Destroyed)
  110.     XgrRegisterMessage (@"DestroyWindow",                                @#DestroyWindow)
  111.     XgrRegisterMessage (@"Disable",                                            @#Disable)
  112.     XgrRegisterMessage (@"Disabled",                                        @#Disabled)
  113.     XgrRegisterMessage (@"Displayed",                                        @#Displayed)
  114.     XgrRegisterMessage (@"DisplayWindow",                                @#DisplayWindow)
  115.     XgrRegisterMessage (@"Enable",                                            @#Enable)
  116.     XgrRegisterMessage (@"Enabled",                                            @#Enabled)
  117.     XgrRegisterMessage (@"Enter",                                                @#Enter)
  118.     XgrRegisterMessage (@"ExitMessageLoop",                            @#ExitMessageLoop)
  119.     XgrRegisterMessage (@"Find",                                                @#Find)
  120.     XgrRegisterMessage (@"FindForward",                                    @#FindForward)
  121.     XgrRegisterMessage (@"FindReverse",                                    @#FindReverse)
  122.     XgrRegisterMessage (@"Forward",                                            @#Forward)
  123.     XgrRegisterMessage (@"GetAlign",                                        @#GetAlign)
  124.     XgrRegisterMessage (@"GetBorder",                                        @#GetBorder)
  125.     XgrRegisterMessage (@"GetBorderOffset",                            @#GetBorderOffset)
  126.     XgrRegisterMessage (@"GetCallback",                                    @#GetCallback)
  127.     XgrRegisterMessage (@"GetCallbackArgs",                            @#GetCallbackArgs)
  128.     XgrRegisterMessage (@"GetCan",                                            @#GetCan)
  129.     XgrRegisterMessage (@"GetCharacterMapArray",                @#GetCharacterMapArray)
  130.     XgrRegisterMessage (@"GetClipGrid",                                    @#GetClipGrid)
  131.     XgrRegisterMessage (@"GetColor",                                        @#GetColor)
  132.     XgrRegisterMessage (@"GetColorExtra",                                @#GetColorExtra)
  133.     XgrRegisterMessage (@"GetCursor",                                        @#GetCursor)
  134.     XgrRegisterMessage (@"GetCursorXY",                                    @#GetCursorXY)
  135.     XgrRegisterMessage (@"GetDisplay",                                    @#GetDisplay)
  136.     XgrRegisterMessage (@"GetEnclosedGrids",                        @#GetEnclosedGrids)
  137.     XgrRegisterMessage (@"GetEnclosingGrid",                        @#GetEnclosingGrid)
  138.     XgrRegisterMessage (@"GetFocusColor",                                @#GetFocusColor)
  139.     XgrRegisterMessage (@"GetFocusColorExtra",                    @#GetFocusColorExtra)
  140.     XgrRegisterMessage (@"GetFont",                                            @#GetFont)
  141.     XgrRegisterMessage (@"GetFontNumber",                                @#GetFontNumber)
  142.     XgrRegisterMessage (@"GetGridFunction",                            @#GetGridFunction)
  143.     XgrRegisterMessage (@"GetGridFunctionName",                    @#GetGridFunctionName)
  144.     XgrRegisterMessage (@"GetGridName",                                    @#GetGridName)
  145.     XgrRegisterMessage (@"GetGridNumber",                                @#GetGridNumber)
  146.     XgrRegisterMessage (@"GetGridType",                                    @#GetGridType)
  147.     XgrRegisterMessage (@"GetGridTypeName",                            @#GetGridTypeName)
  148.     XgrRegisterMessage (@"GetGroup",                                        @#GetGroup)
  149.     XgrRegisterMessage (@"GetHelp",                                            @#GetHelp)
  150.     XgrRegisterMessage (@"GetHelpFile",                                    @#GetHelpFile)
  151.     XgrRegisterMessage (@"GetHelpString",                                @#GetHelpString)
  152.     XgrRegisterMessage (@"GetHelpStrings",                            @#GetHelpStrings)
  153.     XgrRegisterMessage (@"GetHintString",                                @#GetHintString)
  154.     XgrRegisterMessage (@"GetImage",                                        @#GetImage)
  155.     XgrRegisterMessage (@"GetImageCoords",                            @#GetImageCoords)
  156.     XgrRegisterMessage (@"GetIndent",                                        @#GetIndent)
  157.     XgrRegisterMessage (@"GetInfo",                                            @#GetInfo)
  158.     XgrRegisterMessage (@"GetJustify",                                    @#GetJustify)
  159.     XgrRegisterMessage (@"GetKeyboardFocus",                        @#GetKeyboardFocus)
  160.     XgrRegisterMessage (@"GetKeyboardFocusGrid",                @#GetKeyboardFocusGrid)
  161.     XgrRegisterMessage (@"GetKidNumber",                                @#GetKidNumber)
  162.     XgrRegisterMessage (@"GetKids",                                            @#GetKids)
  163.     XgrRegisterMessage (@"GetKidArray",                                    @#GetKidArray)
  164.     XgrRegisterMessage (@"GetKind",                                            @#GetKind)
  165.     XgrRegisterMessage (@"GetMaxMinSize",                                @#GetMaxMinSize)
  166.     XgrRegisterMessage (@"GetMessageFunc",                            @#GetMessageFunc)
  167.     XgrRegisterMessage (@"GetMessageFuncArray",                    @#GetMessageFuncArray)
  168.     XgrRegisterMessage (@"GetMessageSub",                                @#GetMessageSub)
  169.     XgrRegisterMessage (@"GetMessageSubArray",                    @#GetMessageSubArray)
  170.     XgrRegisterMessage (@"GetModalInfo",                                @#GetModalInfo)
  171.     XgrRegisterMessage (@"GetModalWindow",                            @#GetModalWindow)
  172.     XgrRegisterMessage (@"GetParent",                                        @#GetParent)
  173.     XgrRegisterMessage (@"GetPosition",                                    @#GetPosition)
  174.     XgrRegisterMessage (@"GetProtoInfo",                                @#GetProtoInfo)
  175.     XgrRegisterMessage (@"GetRedrawFlags",                            @#GetRedrawFlags)
  176.     XgrRegisterMessage (@"GetSize",                                            @#GetSize)
  177.     XgrRegisterMessage (@"GetSmallestSize",                            @#GetSmallestSize)
  178.     XgrRegisterMessage (@"GetState",                                        @#GetState)
  179.     XgrRegisterMessage (@"GetStyle",                                        @#GetStyle)
  180.     XgrRegisterMessage (@"GetTabArray",                                    @#GetTabArray)
  181.     XgrRegisterMessage (@"GetTabWidth",                                    @#GetTabWidth)
  182.     XgrRegisterMessage (@"GetTextArray",                                @#GetTextArray)
  183.     XgrRegisterMessage (@"GetTextArrayBounds",                    @#GetTextArrayBounds)
  184.     XgrRegisterMessage (@"GetTextArrayLine",                        @#GetTextArrayLine)
  185.     XgrRegisterMessage (@"GetTextArrayLines",                        @#GetTextArrayLines)
  186.     XgrRegisterMessage (@"GetTextCursor",                                @#GetTextCursor)
  187.     XgrRegisterMessage (@"GetTextFilename",                            @#GetTextFilename)
  188.     XgrRegisterMessage (@"GetTextPosition",                            @#GetTextPosition)
  189.     XgrRegisterMessage (@"GetTextSelection",                        @#GetTextSelection)
  190.     XgrRegisterMessage (@"GetTextString",                                @#GetTextString)
  191.     XgrRegisterMessage (@"GetTextStrings",                            @#GetTextStrings)
  192.     XgrRegisterMessage (@"GetTexture",                                    @#GetTexture)
  193.     XgrRegisterMessage (@"GetTimer",                                        @#GetTimer)
  194.     XgrRegisterMessage (@"GetValue",                                        @#GetValue)
  195.     XgrRegisterMessage (@"GetValues",                                        @#GetValues)
  196.     XgrRegisterMessage (@"GetValueArray",                                @#GetValueArray)
  197.     XgrRegisterMessage (@"GetWindow",                                        @#GetWindow)
  198.     XgrRegisterMessage (@"GetWindowFunction",                        @#GetWindowFunction)
  199.     XgrRegisterMessage (@"GetWindowGrid",                                @#GetWindowGrid)
  200.     XgrRegisterMessage (@"GetWindowIcon",                                @#GetWindowIcon)
  201.     XgrRegisterMessage (@"GetWindowSize",                                @#GetWindowSize)
  202.     XgrRegisterMessage (@"GetWindowTitle",                            @#GetWindowTitle)
  203.     XgrRegisterMessage (@"GotKeyboardFocus",                        @#GotKeyboardFocus)
  204.     XgrRegisterMessage (@"GrabArray",                                        @#GrabArray)
  205.     XgrRegisterMessage (@"GrabTextArray",                                @#GrabTextArray)
  206.     XgrRegisterMessage (@"GrabTextString",                            @#GrabTextString)
  207.     XgrRegisterMessage (@"GrabValueArray",                            @#GrabValueArray)
  208.     XgrRegisterMessage (@"Help",                                                @#Help)
  209.     XgrRegisterMessage (@"Hidden",                                            @#Hidden)
  210.     XgrRegisterMessage (@"HideTextCursor",                            @#HideTextCursor)
  211.     XgrRegisterMessage (@"HideWindow",                                    @#HideWindow)
  212.     XgrRegisterMessage (@"Initialize",                                    @#Initialize)
  213.     XgrRegisterMessage (@"Initialized",                                    @#Initialized)
  214.     XgrRegisterMessage (@"Inline",                                            @#Inline)
  215.     XgrRegisterMessage (@"InquireText",                                    @#InquireText)
  216.     XgrRegisterMessage (@"KeyboardFocusBackward",                @#KeyboardFocusBackward)
  217.     XgrRegisterMessage (@"KeyboardFocusForward",                @#KeyboardFocusForward)
  218.     XgrRegisterMessage (@"KeyDown",                                            @#KeyDown)
  219.     XgrRegisterMessage (@"KeyUp",                                                @#KeyUp)
  220.     XgrRegisterMessage (@"LostKeyboardFocus",                        @#LostKeyboardFocus)
  221.     XgrRegisterMessage (@"LostTextSelection",                        @#LostTextSelection)
  222.     XgrRegisterMessage (@"Maximized",                                        @#Maximized)
  223.     XgrRegisterMessage (@"MaximizeWindow",                            @#MaximizeWindow)
  224.     XgrRegisterMessage (@"Maximum",                                            @#Maximum)
  225.     XgrRegisterMessage (@"Minimized",                                        @#Minimized)
  226.     XgrRegisterMessage (@"MinimizeWindow",                            @#MinimizeWindow)
  227.     XgrRegisterMessage (@"Minimum",                                            @#Minimum)
  228.     XgrRegisterMessage (@"MonitorContext",                            @#MonitorContext)
  229.     XgrRegisterMessage (@"MonitorHelp",                                    @#MonitorHelp)
  230.     XgrRegisterMessage (@"MonitorKeyboard",                            @#MonitorKeyboard)
  231.     XgrRegisterMessage (@"MonitorMouse",                                @#MonitorMouse)
  232.     XgrRegisterMessage (@"MouseDown",                                        @#MouseDown)
  233.     XgrRegisterMessage (@"MouseDrag",                                        @#MouseDrag)
  234.     XgrRegisterMessage (@"MouseEnter",                                    @#MouseEnter)
  235.     XgrRegisterMessage (@"MouseExit",                                        @#MouseExit)
  236.     XgrRegisterMessage (@"MouseMove",                                        @#MouseMove)
  237.     XgrRegisterMessage (@"MouseUp",                                            @#MouseUp)
  238.     XgrRegisterMessage (@"MuchLess",                                        @#MuchLess)
  239.     XgrRegisterMessage (@"MuchMore",                                        @#MuchMore)
  240.     XgrRegisterMessage (@"OneLess",                                            @#OneLess)
  241.     XgrRegisterMessage (@"OneMore",                                            @#OneMore)
  242.     XgrRegisterMessage (@"PokeArray",                                        @#PokeArray)
  243.     XgrRegisterMessage (@"PokeTextArray",                                @#PokeTextArray)
  244.     XgrRegisterMessage (@"PokeTextString",                            @#PokeTextString)
  245.     XgrRegisterMessage (@"PokeValueArray",                            @#PokeValueArray)
  246.     XgrRegisterMessage (@"Print",                                                @#Print)
  247.     XgrRegisterMessage (@"Redraw",                                            @#Redraw)
  248.     XgrRegisterMessage (@"RedrawGrid",                                    @#RedrawGrid)
  249.     XgrRegisterMessage (@"RedrawLines",                                    @#RedrawLines)
  250.     XgrRegisterMessage (@"RedrawText",                                    @#RedrawText)
  251.     XgrRegisterMessage (@"RedrawWindow",                                @#RedrawWindow)
  252.     XgrRegisterMessage (@"Replace",                                            @#Replace)
  253.     XgrRegisterMessage (@"ReplaceForward",                            @#ReplaceForward)
  254.     XgrRegisterMessage (@"ReplaceReverse",                            @#ReplaceReverse)
  255.     XgrRegisterMessage (@"Reset",                                                @#Reset)
  256.     XgrRegisterMessage (@"Resize",                                            @#Resize)
  257.     XgrRegisterMessage (@"Resized",                                            @#Resized)
  258.     XgrRegisterMessage (@"ResizeNot",                                        @#ResizeNot)
  259.     XgrRegisterMessage (@"ResizeWindow",                                @#ResizeWindow)
  260.     XgrRegisterMessage (@"ResizeWindowToGrid",                    @#ResizeWindowToGrid)
  261.     XgrRegisterMessage (@"Resized",                                            @#Resized)
  262.     XgrRegisterMessage (@"Reverse",                                            @#Reverse)
  263.     XgrRegisterMessage (@"ScrollH",                                            @#ScrollH)
  264.     XgrRegisterMessage (@"ScrollV",                                            @#ScrollV)
  265.     XgrRegisterMessage (@"Select",                                            @#Select)
  266.     XgrRegisterMessage (@"Selected",                                        @#Selected)
  267.     XgrRegisterMessage (@"Selection",                                        @#Selection)
  268.     XgrRegisterMessage (@"SelectWindow",                                @#SelectWindow)
  269.     XgrRegisterMessage (@"SetAlign",                                        @#SetAlign)
  270.     XgrRegisterMessage (@"SetBorder",                                        @#SetBorder)
  271.     XgrRegisterMessage (@"SetBorderOffset",                            @#SetBorderOffset)
  272.     XgrRegisterMessage (@"SetCallback",                                    @#SetCallback)
  273.     XgrRegisterMessage (@"SetCan",                                            @#SetCan)
  274.     XgrRegisterMessage (@"SetCharacterMapArray",                @#SetCharacterMapArray)
  275.     XgrRegisterMessage (@"SetClipGrid",                                    @#SetClipGrid)
  276.     XgrRegisterMessage (@"SetColor",                                        @#SetColor)
  277.     XgrRegisterMessage (@"SetColorAll",                                    @#SetColorAll)
  278.     XgrRegisterMessage (@"SetColorExtra",                                @#SetColorExtra)
  279.     XgrRegisterMessage (@"SetColorExtraAll",                        @#SetColorExtraAll)
  280.     XgrRegisterMessage (@"SetCursor",                                        @#SetCursor)
  281.     XgrRegisterMessage (@"SetCursorXY",                                    @#SetCursorXY)
  282.     XgrRegisterMessage (@"SetDisplay",                                    @#SetDisplay)
  283.     XgrRegisterMessage (@"SetFocusColor",                                @#SetFocusColor)
  284.     XgrRegisterMessage (@"SetFocusColorExtra",                    @#SetFocusColorExtra)
  285.     XgrRegisterMessage (@"SetFont",                                            @#SetFont)
  286.     XgrRegisterMessage (@"SetFontNumber",                                @#SetFontNumber)
  287.     XgrRegisterMessage (@"SetGridFunction",                            @#SetGridFunction)
  288.     XgrRegisterMessage (@"SetGridFunctionName",                    @#SetGridFunctionName)
  289.     XgrRegisterMessage (@"SetGridName",                                    @#SetGridName)
  290.     XgrRegisterMessage (@"SetGridType",                                    @#SetGridType)
  291.     XgrRegisterMessage (@"SetGridTypeName",                            @#SetGridTypeName)
  292.     XgrRegisterMessage (@"SetGroup",                                        @#SetGroup)
  293.     XgrRegisterMessage (@"SetHelp",                                            @#SetHelp)
  294.     XgrRegisterMessage (@"SetHelpFile",                                    @#SetHelpFile)
  295.     XgrRegisterMessage (@"SetHelpString",                                @#SetHelpString)
  296.     XgrRegisterMessage (@"SetHelpStrings",                            @#SetHelpStrings)
  297.     XgrRegisterMessage (@"SetHintString",                                @#SetHintString)
  298.     XgrRegisterMessage (@"SetImage",                                        @#SetImage)
  299.     XgrRegisterMessage (@"SetImageCoords",                            @#SetImageCoords)
  300.     XgrRegisterMessage (@"SetIndent",                                        @#SetIndent)
  301.     XgrRegisterMessage (@"SetInfo",                                            @#SetInfo)
  302.     XgrRegisterMessage (@"SetJustify",                                    @#SetJustify)
  303.     XgrRegisterMessage (@"SetKeyboardFocus",                        @#SetKeyboardFocus)
  304.     XgrRegisterMessage (@"SetKeyboardFocusGrid",                @#SetKeyboardFocusGrid)
  305.     XgrRegisterMessage (@"SetMaxMinSize",                                @#SetMaxMinSize)
  306.     XgrRegisterMessage (@"SetMessageFunc",                            @#SetMessageFunc)
  307.     XgrRegisterMessage (@"SetMessageFuncArray",                    @#SetMessageFuncArray)
  308.     XgrRegisterMessage (@"SetMessageSub",                                @#SetMessageSub)
  309.     XgrRegisterMessage (@"SetMessageSubArray",                    @#SetMessageSubArray)
  310.     XgrRegisterMessage (@"SetModalWindow",                            @#SetModalWindow)
  311.     XgrRegisterMessage (@"SetParent",                                        @#SetParent)
  312.     XgrRegisterMessage (@"SetPosition",                                    @#SetPosition)
  313.     XgrRegisterMessage (@"SetRedrawFlags",                            @#SetRedrawFlags)
  314.     XgrRegisterMessage (@"SetSize",                                            @#SetSize)
  315.     XgrRegisterMessage (@"SetState",                                        @#SetState)
  316.     XgrRegisterMessage (@"SetStyle",                                        @#SetStyle)
  317.     XgrRegisterMessage (@"SetTabArray",                                    @#SetTabArray)
  318.     XgrRegisterMessage (@"SetTabWidth",                                    @#SetTabWidth)
  319.     XgrRegisterMessage (@"SetTextArray",                                @#SetTextArray)
  320.     XgrRegisterMessage (@"SetTextArrayLine",                        @#SetTextArrayLine)
  321.     XgrRegisterMessage (@"SetTextArrayLines",                        @#SetTextArrayLines)
  322.     XgrRegisterMessage (@"SetTextCursor",                                @#SetTextCursor)
  323.     XgrRegisterMessage (@"SetTextFilename",                            @#SetTextFilename)
  324.     XgrRegisterMessage (@"SetTextSelection",                        @#SetTextSelection)
  325.     XgrRegisterMessage (@"SetTextString",                                @#SetTextString)
  326.     XgrRegisterMessage (@"SetTextStrings",                            @#SetTextStrings)
  327.     XgrRegisterMessage (@"SetTexture",                                    @#SetTexture)
  328.     XgrRegisterMessage (@"SetTimer",                                        @#SetTimer)
  329.     XgrRegisterMessage (@"SetValue",                                        @#SetValue)
  330.     XgrRegisterMessage (@"SetValues",                                        @#SetValues)
  331.     XgrRegisterMessage (@"SetValueArray",                                @#SetValueArray)
  332.     XgrRegisterMessage (@"SetWindowFunction",                        @#SetWindowFunction)
  333.     XgrRegisterMessage (@"SetWindowIcon",                                @#SetWindowIcon)
  334.     XgrRegisterMessage (@"SetWindowTitle",                            @#SetWindowTitle)
  335.     XgrRegisterMessage (@"ShowTextCursor",                            @#ShowTextCursor)
  336.     XgrRegisterMessage (@"ShowWindow",                                    @#ShowWindow)
  337.     XgrRegisterMessage (@"SomeLess",                                        @#SomeLess)
  338.     XgrRegisterMessage (@"SomeMore",                                        @#SomeMore)
  339.     XgrRegisterMessage (@"StartTimer",                                    @#StartTimer)
  340.     XgrRegisterMessage (@"SystemMessage",                                @#SystemMessage)
  341.     XgrRegisterMessage (@"TextDelete",                                    @#TextDelete)
  342.     XgrRegisterMessage (@"TextEvent",                                        @#TextEvent)
  343.     XgrRegisterMessage (@"TextInsert",                                    @#TextInsert)
  344.     XgrRegisterMessage (@"TextModified",                                @#TextModified)
  345.     XgrRegisterMessage (@"TextReplace",                                    @#TextReplace)
  346.     XgrRegisterMessage (@"TimeOut",                                            @#TimeOut)
  347.     XgrRegisterMessage (@"Update",                                            @#Update)
  348.     XgrRegisterMessage (@"WindowClose",                                    @#WindowClose)
  349.     XgrRegisterMessage (@"WindowCreate",                                @#WindowCreate)
  350.     XgrRegisterMessage (@"WindowDeselected",                        @#WindowDeselected)
  351.     XgrRegisterMessage (@"WindowDestroy",                                @#WindowDestroy)
  352.     XgrRegisterMessage (@"WindowDestroyed",                            @#WindowDestroyed)
  353.     XgrRegisterMessage (@"WindowDisplay",                                @#WindowDisplay)
  354.     XgrRegisterMessage (@"WindowDisplayed",                            @#WindowDisplayed)
  355.     XgrRegisterMessage (@"WindowGetDisplay",                        @#WindowGetDisplay)
  356.     XgrRegisterMessage (@"WindowGetFunction",                        @#WindowGetFunction)
  357.     XgrRegisterMessage (@"WindowGetIcon",                                @#WindowGetIcon)
  358.     XgrRegisterMessage (@"WindowGetKeyboardFocusGrid",    @#WindowGetKeyboardFocusGrid)
  359.     XgrRegisterMessage (@"WindowGetSelectedWindow",            @#WindowGetSelectedWindow)
  360.     XgrRegisterMessage (@"WindowGetSize",                                @#WindowGetSize)
  361.     XgrRegisterMessage (@"WindowGetTitle",                            @#WindowGetTitle)
  362.     XgrRegisterMessage (@"WindowHelp",                                    @#WindowHelp)
  363.     XgrRegisterMessage (@"WindowHide",                                    @#WindowHide)
  364.     XgrRegisterMessage (@"WindowHidden",                                @#WindowHidden)
  365.     XgrRegisterMessage (@"WindowKeyDown",                                @#WindowKeyDown)
  366.     XgrRegisterMessage (@"WindowKeyUp",                                    @#WindowKeyUp)
  367.     XgrRegisterMessage (@"WindowMaximize",                            @#WindowMaximize)
  368.     XgrRegisterMessage (@"WindowMaximized",                            @#WindowMaximized)
  369.     XgrRegisterMessage (@"WindowMinimize",                            @#WindowMinimize)
  370.     XgrRegisterMessage (@"WindowMinimized",                            @#WindowMinimized)
  371.     XgrRegisterMessage (@"WindowMonitorContext",                @#WindowMonitorContext)
  372.     XgrRegisterMessage (@"WindowMonitorHelp",                        @#WindowMonitorHelp)
  373.     XgrRegisterMessage (@"WindowMonitorKeyboard",                @#WindowMonitorKeyboard)
  374.     XgrRegisterMessage (@"WindowMonitorMouse",                    @#WindowMonitorMouse)
  375.     XgrRegisterMessage (@"WindowMouseDown",                            @#WindowMouseDown)
  376.     XgrRegisterMessage (@"WindowMouseDrag",                            @#WindowMouseDrag)
  377.     XgrRegisterMessage (@"WindowMouseEnter",                        @#WindowMouseEnter)
  378.     XgrRegisterMessage (@"WindowMouseExit",                            @#WindowMouseExit)
  379.     XgrRegisterMessage (@"WindowMouseMove",                            @#WindowMouseMove)
  380.     XgrRegisterMessage (@"WindowMouseUp",                                @#WindowMouseUp)
  381.     XgrRegisterMessage (@"WindowRedraw",                                @#WindowRedraw)
  382.     XgrRegisterMessage (@"WindowRegister",                            @#WindowRegister)
  383.     XgrRegisterMessage (@"WindowResize",                                @#WindowResize)
  384.     XgrRegisterMessage (@"WindowResized",                                @#WindowResized)
  385.     XgrRegisterMessage (@"WindowResizeToGrid",                    @#WindowResizeToGrid)
  386.     XgrRegisterMessage (@"WindowSelect",                                @#WindowSelect)
  387.     XgrRegisterMessage (@"WindowSelected",                            @#WindowSelected)
  388.     XgrRegisterMessage (@"WindowSetFunction",                        @#WindowSetFunction)
  389.     XgrRegisterMessage (@"WindowSetIcon",                                @#WindowSetIcon)
  390.     XgrRegisterMessage (@"WindowSetKeyboardFocusGrid",    @#WindowSetKeyboardFocusGrid)
  391.     XgrRegisterMessage (@"WindowSetTitle",                            @#WindowSetTitle)
  392.     XgrRegisterMessage (@"WindowShow",                                    @#WindowShow)
  393.     XgrRegisterMessage (@"WindowSystemMessage",                    @#WindowSystemMessage)
  394.     XgrRegisterMessage (@"LastMessage",                                    @#LastMessage)
  395. '
  396.     XgrGetDisplaySize ("", @#displayWidth, @#displayHeight, @#windowBorderWidth, @#windowTitleHeight)
  397. END FUNCTION
  398. '
  399. '
  400. ' ############################
  401. ' #####  InitProgram ()  #####
  402. ' ############################
  403. '
  404. FUNCTION  InitProgram ()
  405. '        Initialize everything your program needs to initialize
  406. END FUNCTION
  407. '
  408. '
  409. ' ##############################
  410. ' #####  CreateWindows ()  #####
  411. ' ##############################
  412. '
  413. FUNCTION  CreateWindows ()
  414.     SHARED  Math
  415. '
  416.   Math           (@Math, #CreateWindow, 0, 0, 0, 0, 0, 0)
  417.   XuiSendMessage ( Math, #SetCallback, Math, &MathCode(), -1, -1, -1, -1)
  418.   XuiSendMessage ( Math, #SetHelpFile, 0, 0, 0, 0, 0, @"Math.hlp")
  419.   XuiSendMessage ( Math, #DisplayWindow, 0, 0, 0, 0, 0, 0)
  420. END FUNCTION
  421. '
  422. '
  423. ' ############################
  424. ' #####  InitWindows ()  #####
  425. ' ############################
  426. '
  427. FUNCTION  InitWindows ()
  428.     SHARED  Math
  429. '
  430.   XuiSendMessage ( Math, #MouseDown, 0, 0, 0, 0, 23, 0)
  431. END FUNCTION
  432. '
  433. '
  434. ' #####################
  435. ' #####  Math ()  #####
  436. ' #####################
  437. '
  438. FUNCTION  Math (grid, message, v0, v1, v2, v3, r0, (r1, r1$, r1[], r1$[]))
  439.     STATIC    designX,  designY,  designWidth,  designHeight
  440.   STATIC    SUBADDR  sub[]
  441.   STATIC    upperMessage
  442.   STATIC    Math
  443. '
  444.   $Math     =  0  ' kid  0 grid type = Math
  445.   $SIN      =  1  ' kid  1 grid type = XuiRadioButton
  446.   $ASIN     =  2  ' kid  2 grid type = XuiRadioButton
  447.   $Graphic  =  3  ' kid  3 grid type = XuiLabel
  448.   $Graph    =  4  ' kid  4 grid type = XuiLabel
  449.   $COS      =  5  ' kid  5 grid type = XuiRadioButton
  450.   $ACOS     =  6  ' kid  6 grid type = XuiRadioButton
  451.   $TAN      =  7  ' kid  7 grid type = XuiRadioButton
  452.   $ATAN     =  8  ' kid  8 grid type = XuiRadioButton
  453.   $COT      =  9  ' kid  9 grid type = XuiRadioButton
  454.   $ACOT     = 10  ' kid 10 grid type = XuiRadioButton
  455.   $SEC      = 11  ' kid 11 grid type = XuiRadioButton
  456.   $ASEC     = 12  ' kid 12 grid type = XuiRadioButton
  457.   $CSC      = 13  ' kid 13 grid type = XuiRadioButton
  458.   $ACSC     = 14  ' kid 14 grid type = XuiRadioButton
  459.   $SINH     = 15  ' kid 15 grid type = XuiRadioButton
  460.   $ASINH    = 16  ' kid 16 grid type = XuiRadioButton
  461.   $COSH     = 17  ' kid 17 grid type = XuiRadioButton
  462.   $ACOSH    = 18  ' kid 18 grid type = XuiRadioButton
  463.   $TANH     = 19  ' kid 19 grid type = XuiRadioButton
  464.   $ATANH    = 20  ' kid 20 grid type = XuiRadioButton
  465.   $COTH     = 21  ' kid 21 grid type = XuiRadioButton
  466.   $ACOTH    = 22  ' kid 22 grid type = XuiRadioButton
  467.   $SECH     = 23  ' kid 23 grid type = XuiRadioButton
  468.   $ASECH    = 24  ' kid 24 grid type = XuiRadioButton
  469.   $CSCH     = 25  ' kid 25 grid type = XuiRadioButton
  470.   $ACSCH    = 26  ' kid 26 grid type = XuiRadioButton
  471.   $SQRT     = 27  ' kid 27 grid type = XuiRadioButton
  472.   $POWER    = 28  ' kid 28 grid type = XuiRadioButton
  473.   $Range    = 29  ' kid 29 grid type = XuiLabel
  474.   $LOG      = 30  ' kid 30 grid type = XuiRadioButton
  475.   $EXP      = 31  ' kid 31 grid type = XuiRadioButton
  476.   $Maximum  = 32  ' kid 32 grid type = XuiLabel
  477.   $LOG10    = 33  ' kid 33 grid type = XuiRadioButton
  478.   $EXP10    = 34  ' kid 34 grid type = XuiRadioButton
  479.   $Minimum  = 35  ' kid 35 grid type = XuiLabel
  480.   $CLEAR    = 36  ' kid 36 grid type = XuiRadioButton
  481.   $QUIT     = 37  ' kid 37 grid type = XuiRadioButton
  482.   $Comment  = 38  ' kid 38 grid type = XuiLabel
  483. '
  484.   IFZ sub[] THEN GOSUB Initialize
  485. '    XuiReportMessage (grid, message, v0, v1, v2, v3, r0, r1)
  486.   IF XuiProcessMessage (grid, message, @v0, @v1, @v2, @v3, @r0, @r1, Math) THEN RETURN
  487.   IF (message <= upperMessage) THEN GOSUB @sub[message]
  488.   RETURN
  489. '
  490. '
  491. ' *****  Callback  *****  message = Callback : r1 = original message
  492. '
  493. SUB Callback
  494.   message = r1
  495.   IF (message <= upperMessage) THEN GOSUB @sub[message]
  496. END SUB
  497. '
  498. '
  499. ' *****  Create  *****  v0123 = xywh : r0 = window : r1 = parent
  500. '
  501. SUB Create
  502.   IF (v0 <= 0) THEN v0 = 0
  503.   IF (v1 <= 0) THEN v1 = 0
  504.   IF (v2 <= 0) THEN v2 = designWidth
  505.   IF (v3 <= 0) THEN v3 = designHeight
  506.   XuiCreateGrid (@grid, Math, @v0, @v1, @v2, @v3, r0, r1, &Math())
  507.     XuiSendMessage ( grid, #SetGridName, 0, 0, 0, 0, 0, @"Math")
  508.   XuiRadioButton (@g, #Create, 4, 4, 64, 20, r0, grid)
  509.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $SIN, grid)
  510.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"SIN")
  511.   XuiSendMessage ( g, #SetColor, 18, 0, 0, 124, 0, 0)
  512.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"SIN")
  513.   XuiRadioButton (@g, #Create, 68, 4, 64, 20, r0, grid)
  514.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $ASIN, grid)
  515.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"ASIN")
  516.   XuiSendMessage ( g, #SetColor, 16, 0, 0, 124, 0, 0)
  517.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"ASIN")
  518.   XuiLabel       (@g, #Create, 132, 4, 248, 248, r0, grid)
  519.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"Graphic")
  520.   XuiSendMessage ( g, #SetColor, 7, 0, 0, 124, 0, 0)
  521.   XuiLabel       (@g, #Create, 140, 12, 232, 232, r0, grid)
  522.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"Graph")
  523.   XuiSendMessage ( g, #SetColor, 0, 0, 0, 124, 0, 0)
  524.   XuiSendMessage ( g, #SetBorder, $$BorderHiLine1, $$BorderHiLine1, $$BorderRaise1, -1, 0, 0)
  525.     XuiSendMessage ( g, #SetMessageFunc, #RedrawGrid, &MathCode(), 0, 0, 0, 0)
  526.   XuiRadioButton (@g, #Create, 4, 24, 64, 20, r0, grid)
  527.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $COS, grid)
  528.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"COS")
  529.   XuiSendMessage ( g, #SetColor, 18, 0, 0, 124, 0, 0)
  530.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"COS")
  531.   XuiRadioButton (@g, #Create, 68, 24, 64, 20, r0, grid)
  532.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $ACOS, grid)
  533.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"ACOS")
  534.   XuiSendMessage ( g, #SetColor, 16, 0, 0, 124, 0, 0)
  535.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"ACOS")
  536.   XuiRadioButton (@g, #Create, 4, 44, 64, 20, r0, grid)
  537.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $TAN, grid)
  538.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"TAN")
  539.   XuiSendMessage ( g, #SetColor, 18, 0, 0, 124, 0, 0)
  540.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"TAN")
  541.   XuiRadioButton (@g, #Create, 68, 44, 64, 20, r0, grid)
  542.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $ATAN, grid)
  543.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"ATAN")
  544.   XuiSendMessage ( g, #SetColor, 16, 0, 0, 124, 0, 0)
  545.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"ATAN")
  546.   XuiRadioButton (@g, #Create, 4, 64, 64, 20, r0, grid)
  547.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $COT, grid)
  548.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"COT")
  549.   XuiSendMessage ( g, #SetColor, 18, 0, 0, 124, 0, 0)
  550.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"COT")
  551.   XuiRadioButton (@g, #Create, 68, 64, 64, 20, r0, grid)
  552.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $ACOT, grid)
  553.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"ACOT")
  554.   XuiSendMessage ( g, #SetColor, 16, 0, 0, 124, 0, 0)
  555.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"ACOT")
  556.   XuiRadioButton (@g, #Create, 4, 84, 64, 20, r0, grid)
  557.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $SEC, grid)
  558.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"SEC")
  559.   XuiSendMessage ( g, #SetColor, 18, 0, 0, 124, 0, 0)
  560.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"SEC")
  561.   XuiRadioButton (@g, #Create, 68, 84, 64, 20, r0, grid)
  562.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $ASEC, grid)
  563.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"ASEC")
  564.   XuiSendMessage ( g, #SetColor, 16, 0, 0, 124, 0, 0)
  565.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"ASEC")
  566.   XuiRadioButton (@g, #Create, 4, 104, 64, 20, r0, grid)
  567.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $CSC, grid)
  568.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"CSC")
  569.   XuiSendMessage ( g, #SetColor, 18, 0, 0, 124, 0, 0)
  570.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"CSC")
  571.   XuiRadioButton (@g, #Create, 68, 104, 64, 20, r0, grid)
  572.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $ACSC, grid)
  573.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"ACSC")
  574.   XuiSendMessage ( g, #SetColor, 16, 0, 0, 124, 0, 0)
  575.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"ACSC")
  576.   XuiRadioButton (@g, #Create, 4, 132, 64, 20, r0, grid)
  577.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $SINH, grid)
  578.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"SINH")
  579.   XuiSendMessage ( g, #SetColor, 18, 0, 0, 124, 0, 0)
  580.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"SINH")
  581.   XuiRadioButton (@g, #Create, 68, 132, 64, 20, r0, grid)
  582.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $ASINH, grid)
  583.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"ASINH")
  584.   XuiSendMessage ( g, #SetColor, 16, 0, 0, 124, 0, 0)
  585.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"ASINH")
  586.   XuiRadioButton (@g, #Create, 4, 152, 64, 20, r0, grid)
  587.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $COSH, grid)
  588.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"COSH")
  589.   XuiSendMessage ( g, #SetColor, 18, 0, 0, 124, 0, 0)
  590.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"COSH")
  591.   XuiRadioButton (@g, #Create, 68, 152, 64, 20, r0, grid)
  592.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $ACOSH, grid)
  593.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"ACOSH")
  594.   XuiSendMessage ( g, #SetColor, 16, 0, 0, 124, 0, 0)
  595.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"ACOSH")
  596.   XuiRadioButton (@g, #Create, 4, 172, 64, 20, r0, grid)
  597.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $TANH, grid)
  598.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"TANH")
  599.   XuiSendMessage ( g, #SetColor, 18, 0, 0, 124, 0, 0)
  600.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"TANH")
  601.   XuiRadioButton (@g, #Create, 68, 172, 64, 20, r0, grid)
  602.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $ATANH, grid)
  603.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"ATANH")
  604.   XuiSendMessage ( g, #SetColor, 16, 0, 0, 124, 0, 0)
  605.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"ATANH")
  606.   XuiRadioButton (@g, #Create, 4, 192, 64, 20, r0, grid)
  607.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $COTH, grid)
  608.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"COTH")
  609.   XuiSendMessage ( g, #SetColor, 18, 0, 0, 124, 0, 0)
  610.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"COTH")
  611.   XuiRadioButton (@g, #Create, 68, 192, 64, 20, r0, grid)
  612.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $ACOTH, grid)
  613.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"ACOTH")
  614.   XuiSendMessage ( g, #SetColor, 16, 0, 0, 124, 0, 0)
  615.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"ACOTH")
  616.   XuiRadioButton (@g, #Create, 4, 212, 64, 20, r0, grid)
  617.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $SECH, grid)
  618.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"SECH")
  619.   XuiSendMessage ( g, #SetColor, 18, 0, 0, 124, 0, 0)
  620.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"SECH")
  621.   XuiRadioButton (@g, #Create, 68, 212, 64, 20, r0, grid)
  622.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $ASECH, grid)
  623.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"ASECH")
  624.   XuiSendMessage ( g, #SetColor, 16, 0, 0, 124, 0, 0)
  625.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"ASECH")
  626.   XuiRadioButton (@g, #Create, 4, 232, 64, 20, r0, grid)
  627.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $CSCH, grid)
  628.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"CSCH")
  629.   XuiSendMessage ( g, #SetColor, 18, 0, 0, 124, 0, 0)
  630.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"CSCH")
  631.   XuiRadioButton (@g, #Create, 68, 232, 64, 20, r0, grid)
  632.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $ACSCH, grid)
  633.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"ACSCH")
  634.   XuiSendMessage ( g, #SetColor, 16, 0, 0, 124, 0, 0)
  635.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"ACSCH")
  636.   XuiRadioButton (@g, #Create, 4, 260, 64, 20, r0, grid)
  637.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $SQRT, grid)
  638.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"SQRT")
  639.   XuiSendMessage ( g, #SetColor, 18, 0, 0, 124, 0, 0)
  640.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"SQRT")
  641.   XuiRadioButton (@g, #Create, 68, 260, 64, 20, r0, grid)
  642.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $POWER, grid)
  643.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"POWER")
  644.   XuiSendMessage ( g, #SetColor, 16, 0, 0, 124, 0, 0)
  645.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"POWER")
  646.   XuiLabel       (@g, #Create, 132, 260, 248, 20, r0, grid)
  647.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"Range")
  648.   XuiSendMessage ( g, #SetColor, 61, 0, 0, 124, 0, 0)
  649.   XuiSendMessage ( g, #SetAlign, $$AlignMiddleLeft, -1, 4, 0, 0, 0)
  650.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"Range:")
  651.   XuiRadioButton (@g, #Create, 4, 280, 64, 20, r0, grid)
  652.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $LOG, grid)
  653.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"LOG")
  654.   XuiSendMessage ( g, #SetColor, 18, 0, 0, 124, 0, 0)
  655.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"LOG")
  656.   XuiRadioButton (@g, #Create, 68, 280, 64, 20, r0, grid)
  657.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $EXP, grid)
  658.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"EXP")
  659.   XuiSendMessage ( g, #SetColor, 16, 0, 0, 124, 0, 0)
  660.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"EXP")
  661.   XuiLabel       (@g, #Create, 132, 280, 248, 20, r0, grid)
  662.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"Maximum")
  663.   XuiSendMessage ( g, #SetColor, 56, 0, 0, 124, 0, 0)
  664.   XuiSendMessage ( g, #SetAlign, $$AlignMiddleLeft, -1, 4, 0, 0, 0)
  665.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"Maximum:")
  666.   XuiRadioButton (@g, #Create, 4, 300, 64, 20, r0, grid)
  667.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $LOG10, grid)
  668.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"LOG10")
  669.   XuiSendMessage ( g, #SetColor, 18, 0, 0, 124, 0, 0)
  670.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"LOG10")
  671.   XuiRadioButton (@g, #Create, 68, 300, 64, 20, r0, grid)
  672.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $EXP10, grid)
  673.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"EXP10")
  674.   XuiSendMessage ( g, #SetColor, 16, 0, 0, 124, 0, 0)
  675.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"EXP10")
  676.   XuiLabel       (@g, #Create, 132, 300, 248, 20, r0, grid)
  677.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"Minimum")
  678.   XuiSendMessage ( g, #SetColor, 56, 0, 0, 124, 0, 0)
  679.   XuiSendMessage ( g, #SetAlign, $$AlignMiddleLeft, -1, 4, 0, 0, 0)
  680.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"Minimum:")
  681.   XuiRadioButton (@g, #Create, 4, 320, 64, 20, r0, grid)
  682.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $CLEAR, grid)
  683.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"CLEAR")
  684.   XuiSendMessage ( g, #SetColor, 15, 0, 0, 124, 0, 0)
  685.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"CLEAR")
  686.   XuiRadioButton (@g, #Create, 68, 320, 64, 20, r0, grid)
  687.   XuiSendMessage ( g, #SetCallback, grid, &Math(), -1, -1, $QUIT, grid)
  688.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"QUIT")
  689.   XuiSendMessage ( g, #SetColor, 78, 0, 0, 124, 0, 0)
  690.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"QUIT")
  691.     XuiSendMessage ( g, #SetTexture, $$TextureShadow, $$TextureShadow, 0, 0, 0, 0)
  692.   XuiLabel       (@g, #Create, 132, 320, 248, 20, r0, grid)
  693.   XuiSendMessage ( g, #SetGridName, 0, 0, 0, 0, 0, @"Comment")
  694.   XuiSendMessage ( g, #SetColor, 57, 0, 0, 124, 0, 0)
  695.   XuiSendMessage ( g, #SetAlign, $$AlignMiddleLeft, -1, 4, 0, 0, 0)
  696.   XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"Comment:")
  697.   GOSUB Resize
  698. END SUB
  699. '
  700. '
  701. ' *****  CreateWindow  *****  v0123 = xywh : r0 = windowType : r1$ = display$
  702. '
  703. SUB CreateWindow
  704.   IF (v0  = 0) THEN v0 = designX
  705.   IF (v1  = 0) THEN v1 = designY
  706.   IF (v2 <= 0) THEN v2 = designWidth
  707.   IF (v3 <= 0) THEN v3 = designHeight
  708.   XuiWindow (@window, #WindowCreate, v0, v1, v2, v3, r0, @r1$)
  709.   v0 = 0 : v1 = 0 : r0 = window : ATTACH r1$ TO display$
  710.   GOSUB Create
  711.     r1 = 0 : ATTACH display$ TO r1$
  712.   XuiWindow (window, #WindowRegister, grid, -1, v2, v3, @r0, @"Math")
  713. END SUB
  714. '
  715. '
  716. ' *****  GetSmallestSize  *****
  717. '
  718. SUB GetSmallestSize
  719. END SUB
  720. '
  721. '
  722. ' *****  Resize  *****
  723. '
  724. SUB Resize
  725. END SUB
  726. '
  727. '
  728. ' *****  Selection  *****
  729. '
  730. SUB Selection
  731. END SUB
  732. '
  733. '
  734. ' *****  Initialize  *****
  735. '
  736. SUB Initialize
  737.   XuiGetDefaultMessageFuncArray (@func[])
  738.   XgrMessageNameToNumber (@"LastMessage", @upperMessage)
  739. '
  740.   func[#Callback]           = &XuiCallback()
  741.   func[#Resize]             = &XuiResizeNot()
  742. '
  743.   DIM sub[upperMessage]
  744.   sub[#Create]              = SUBADDRESS (Create)
  745.   sub[#CreateWindow]        = SUBADDRESS (CreateWindow)
  746. '
  747.   IF sub[0] THEN PRINT "First(): Initialize: Error::: Undefined Message"
  748.   IF func[0] THEN PRINT "First(): Initialize: Error::: Undefined Message"
  749.   XuiRegisterGridType (@Math, "Math", &Math(), @func[], @sub[])
  750. '
  751.   designX = 768
  752.   designY = 23
  753.   designWidth = 384
  754.   designHeight = 344
  755. '
  756.   gridType = Math
  757.   XuiSetGridTypeValue (gridType, @"x",                designX)
  758.   XuiSetGridTypeValue (gridType, @"y",                designY)
  759.   XuiSetGridTypeValue (gridType, @"width",            designWidth)
  760.   XuiSetGridTypeValue (gridType, @"height",           designHeight)
  761.   XuiSetGridTypeValue (gridType, @"maxWidth",         designWidth)
  762.   XuiSetGridTypeValue (gridType, @"maxHeight",        designHeight)
  763.   XuiSetGridTypeValue (gridType, @"minWidth",         designWidth)
  764.   XuiSetGridTypeValue (gridType, @"minHeight",        designHeight)
  765.   XuiSetGridTypeValue (gridType, @"border",           $$BorderFrame)
  766.   XuiSetGridTypeValue (gridType, @"can",              $$Respond OR $$Callback)
  767.   IFZ message THEN RETURN
  768. END SUB
  769. END FUNCTION
  770. '
  771. '
  772. ' #########################
  773. ' #####  MathCode ()  #####
  774. ' #########################
  775. '
  776. FUNCTION  MathCode (grid, message, v0, v1, v2, v3, r0, r1)
  777.     STATIC    graph
  778.     STATIC  func
  779. '
  780.   $Math     =  0  ' kid  0 grid type = Math
  781.   $SIN      =  1  ' kid  1 grid type = XuiRadioButton
  782.   $ASIN     =  2  ' kid  2 grid type = XuiRadioButton
  783.   $Graphic  =  3  ' kid  3 grid type = XuiLabel
  784.   $Graph    =  4  ' kid  4 grid type = XuiLabel
  785.   $COS      =  5  ' kid  5 grid type = XuiRadioButton
  786.   $ACOS     =  6  ' kid  6 grid type = XuiRadioButton
  787.   $TAN      =  7  ' kid  7 grid type = XuiRadioButton
  788.   $ATAN     =  8  ' kid  8 grid type = XuiRadioButton
  789.   $COT      =  9  ' kid  9 grid type = XuiRadioButton
  790.   $ACOT     = 10  ' kid 10 grid type = XuiRadioButton
  791.   $SEC      = 11  ' kid 11 grid type = XuiRadioButton
  792.   $ASEC     = 12  ' kid 12 grid type = XuiRadioButton
  793.   $CSC      = 13  ' kid 13 grid type = XuiRadioButton
  794.   $ACSC     = 14  ' kid 14 grid type = XuiRadioButton
  795.   $SINH     = 15  ' kid 15 grid type = XuiRadioButton
  796.   $ASINH    = 16  ' kid 16 grid type = XuiRadioButton
  797.   $COSH     = 17  ' kid 17 grid type = XuiRadioButton
  798.   $ACOSH    = 18  ' kid 18 grid type = XuiRadioButton
  799.   $TANH     = 19  ' kid 19 grid type = XuiRadioButton
  800.   $ATANH    = 20  ' kid 20 grid type = XuiRadioButton
  801.   $COTH     = 21  ' kid 21 grid type = XuiRadioButton
  802.   $ACOTH    = 22  ' kid 22 grid type = XuiRadioButton
  803.   $SECH     = 23  ' kid 23 grid type = XuiRadioButton
  804.   $ASECH    = 24  ' kid 24 grid type = XuiRadioButton
  805.   $CSCH     = 25  ' kid 25 grid type = XuiRadioButton
  806.   $ACSCH    = 26  ' kid 26 grid type = XuiRadioButton
  807.   $SQRT     = 27  ' kid 27 grid type = XuiRadioButton
  808.   $POWER    = 28  ' kid 28 grid type = XuiRadioButton
  809.   $Range    = 29  ' kid 29 grid type = XuiLabel
  810.   $LOG      = 30  ' kid 30 grid type = XuiRadioButton
  811.   $EXP      = 31  ' kid 31 grid type = XuiRadioButton
  812.   $Maximum  = 32  ' kid 32 grid type = XuiLabel
  813.   $LOG10    = 33  ' kid 33 grid type = XuiRadioButton
  814.   $EXP10    = 34  ' kid 34 grid type = XuiRadioButton
  815.   $Minimum  = 35  ' kid 35 grid type = XuiLabel
  816.   $CLEAR    = 36  ' kid 36 grid type = XuiRadioButton
  817.   $QUIT     = 37  ' kid 37 grid type = XuiRadioButton
  818.   $Comment  = 38  ' kid 38 grid type = XuiLabel
  819. '
  820.     IFZ graph THEN GOSUB Initialize
  821. '    XuiReportMessage (grid, message, v0, v1, v2, v3, r0, r1)
  822.     IF (message = #Callback) THEN message = r1
  823. '
  824.     SELECT CASE message
  825. '   CASE #Help                :    GOSUB Help        ' callback when help requested
  826.         CASE #CloseWindow    : GOSUB CloseWindow    ' system menu close window
  827.         CASE #RedrawGrid    :    GOSUB RedrawGrid    ' redraw math function
  828.     CASE #Selection        :    GOSUB Selection   ' common callback message
  829. '   CASE #TextEvent        :    GOSUB TextEvent   ' from TextArea and TextLine
  830.     END SELECT
  831. '
  832. '
  833. ' *****  CloseWindow  *****
  834. '
  835. SUB CloseWindow
  836.     PRINT "CloseWindow"
  837.     XuiSendMessage (grid, #MinimizeWindow, 0, 0, 0, 0, 0, 0)
  838. END SUB
  839. '
  840. '
  841. ' *****  RedrawGrid  *****
  842. '
  843. SUB RedrawGrid
  844.     XuiRedrawGrid (grid, #RedrawGrid, 0, 0, 0, 0, 0, 0)
  845.     v0 = $$TRUE
  846.     r0 = func
  847.     GOSUB Selection
  848. END SUB
  849. '
  850. '
  851. ' *****  Selection  *****
  852. '
  853. SUB Selection
  854.     IFZ v0 THEN EXIT SUB
  855.     SELECT CASE r0
  856.         CASE $SIN        : GOSUB PlotSIN
  857.         CASE $COS        : GOSUB PlotCOS
  858.         CASE $TAN        : GOSUB PlotTAN
  859.         CASE $COT        : GOSUB PlotCOT
  860.         CASE $SEC        : GOSUB PlotSEC
  861.         CASE $CSC        : GOSUB PlotCSC
  862. '
  863.         CASE $ASIN    : GOSUB PlotASIN
  864.         CASE $ACOS    : GOSUB PlotACOS
  865.         CASE $ATAN    : GOSUB PlotATAN
  866.         CASE $ACOT    : GOSUB PlotACOT
  867.         CASE $ASEC    : GOSUB PlotASEC
  868.         CASE $ACSC    : GOSUB PlotACSC
  869. '
  870.         CASE $SINH    : GOSUB PlotSINH
  871.         CASE $COSH    : GOSUB PlotCOSH
  872.         CASE $TANH    : GOSUB PlotTANH
  873.         CASE $COTH    : GOSUB PlotCOTH
  874.         CASE $SECH    : GOSUB PlotSECH
  875.         CASE $CSCH    : GOSUB PlotCSCH
  876. '
  877.         CASE $ASINH    : GOSUB PlotASINH
  878.         CASE $ACOSH    : GOSUB PlotACOSH
  879.         CASE $ATANH    : GOSUB PlotATANH
  880.         CASE $ACOTH    : GOSUB PlotACOTH
  881.         CASE $ASECH    : GOSUB PlotASECH
  882.         CASE $ACSCH    : GOSUB PlotACSCH
  883. '
  884.         CASE $SQRT    : GOSUB PlotSQRT
  885.         CASE $POWER    :    GOSUB PlotPOWER
  886.         CASE $LOG        : GOSUB PlotLOG
  887.         CASE $EXP        : GOSUB PlotEXP
  888.         CASE $LOG10    : GOSUB PlotLOG10
  889.         CASE $EXP10    : GOSUB PlotEXP10
  890. '
  891.         CASE $CLEAR    :    XgrClearGrid (graph, -1) : GOSUB DrawAxes
  892.         CASE $QUIT    :    QUIT(0)
  893.     END SELECT
  894.     func = r0
  895. END SUB
  896. '
  897. '
  898. ' *****  DrawAxes  *****
  899. '
  900. SUB DrawAxes
  901.     XgrClearGrid (graph, -1)
  902.     XgrSetGridBoxScaled (graph, -1#, -1#, +1#, +1#)
  903.     XgrDrawLineScaled (graph, $$Green, -1#, 0#, +1#, 0#)
  904.     XgrDrawLineScaled (graph, $$Green, 0#, +1#, 0#, -1#)
  905.     XgrDrawBoxScaled (graph, $$BrightGreen, -1#, -1#, +1#, +1#)
  906.     XuiSendMessage (grid, #SetTextString, 0, 0, 0, 0, $Range,   "Range::: " + range$)
  907.     XuiSendMessage (grid, #SetTextString, 0, 0, 0, 0, $Minimum, "Minumum: " + minimum$)
  908.     XuiSendMessage (grid, #SetTextString, 0, 0, 0, 0, $Maximum, "Maximum: " + maximum$)
  909.     XuiSendMessage (grid, #SetTextString, 0, 0, 0, 0, $Comment, "Comment: " + comment$)
  910.     XuiSendMessage (grid, #Redraw, 0, 0, 0, 0, $Range, 0)
  911.     XuiSendMessage (grid, #Redraw, 0, 0, 0, 0, $Minimum, 0)
  912.     XuiSendMessage (grid, #Redraw, 0, 0, 0, 0, $Maximum, 0)
  913.     XuiSendMessage (grid, #Redraw, 0, 0, 0, 0, $Comment, 0)
  914.     range$ = ""
  915.     minimum$ = ""
  916.     maximum$ = ""
  917.     comment$ = ""
  918. END SUB
  919. '
  920. '
  921. ' *****  PlotSIN  *****
  922. '
  923. SUB PlotSIN
  924.     range$ = "-2PI to +2PI"
  925.     minimum$ = "-1"
  926.     maximum$ = "+1"
  927.     comment$ = "SIN()"
  928.     GOSUB DrawAxes
  929.     XgrSetGridBoxScaled (graph, -$$TWOPI, 1#, $$TWOPI, -1#)
  930.     x# = -$$TWOPI
  931.     y# = SIN (x#)
  932.     XgrMoveToScaled (graph, x#, y#)
  933.     FOR x# = -$$TWOPI TO $$TWOPI STEP ($$PI/64#)
  934.         y# = SIN(x#)
  935.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  936.     NEXT x#
  937. END SUB
  938. '
  939. SUB PlotCOS
  940.     range$ = "-2PI to +2PI"
  941.     minimum$ = "-1"
  942.     maximum$ = "+1"
  943.     comment$ = "COS()"
  944.     GOSUB DrawAxes
  945.     XgrSetGridBoxScaled (graph, -$$TWOPI, 1#, $$TWOPI, -1#)
  946.     x# = -$$TWOPI
  947.     y# = COS (x#)
  948.     XgrMoveToScaled (graph, x#, y#)
  949.     FOR x# = -$$TWOPI TO $$TWOPI STEP ($$PI/64#)
  950.         y# = COS (x#)
  951.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  952.     NEXT x#
  953. END SUB
  954. '
  955. SUB PlotTAN
  956.     range$ = "-2PI to +2PI"
  957.     minimum$ = "-4"
  958.     maximum$ = "+4"
  959.     comment$ = "TAN()"
  960.     GOSUB DrawAxes
  961.     XgrSetGridBoxScaled (graph, -$$TWOPI, 4#, $$TWOPI, -4#)
  962.     x# = -$$TWOPI
  963.     y# = TAN (x#)
  964.     XgrMoveToScaled (graph, x#, y#)
  965.     FOR x# = -$$TWOPI TO $$TWOPI STEP ($$PI/64#)
  966.         y# = TAN (x#)
  967.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  968.     NEXT x#
  969. END SUB
  970. '
  971. SUB PlotCOT
  972.     range$ = "-2PI to +2PI"
  973.     minimum$ = "-4"
  974.     maximum$ = "+4"
  975.     comment$ = "COT()"
  976.     GOSUB DrawAxes
  977.     XgrSetGridBoxScaled (graph, -$$TWOPI, 4#, $$TWOPI, -4#)
  978.     x# = -$$TWOPI
  979.     y# = COT (x#)
  980.     XgrMoveToScaled (graph, x#, y#)
  981.     FOR x# = -$$TWOPI TO $$TWOPI STEP ($$PI/64#)
  982.         y# = COT (x#)
  983.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  984.     NEXT x#
  985. END SUB
  986. '
  987. SUB PlotSEC
  988.     range$ = "-2PI to +2PI"
  989.     minimum$ = "-4"
  990.     maximum$ = "+4"
  991.     comment$ = "SEC()"
  992.     GOSUB DrawAxes
  993.     XgrSetGridBoxScaled (graph, -$$TWOPI, 4#, $$TWOPI, -4#)
  994.     x# = -$$TWOPI
  995.     y# = SEC (x#)
  996.     XgrMoveToScaled (graph, x#, y#)
  997.     FOR x# = -$$TWOPI TO $$TWOPI STEP ($$PI/64#)
  998.         y# = SEC (x#)
  999.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1000.     NEXT x#
  1001. END SUB
  1002. '
  1003. SUB PlotCSC
  1004.     range$ = "-2PI to +2PI"
  1005.     minimum$ = "-4"
  1006.     maximum$ = "+4"
  1007.     comment$ = "CSC()"
  1008.     GOSUB DrawAxes
  1009.     XgrSetGridBoxScaled (graph, -$$TWOPI, 4#, $$TWOPI, -4#)
  1010.     x# = -$$TWOPI
  1011.     y# = CSC (x#)
  1012.     XgrMoveToScaled (graph, x#, y#)
  1013.     FOR x# = -$$TWOPI TO $$TWOPI STEP ($$PI/64#)
  1014.         y# = CSC (x#)
  1015.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1016.     NEXT x#
  1017. END SUB
  1018. '
  1019. '
  1020. ' *****  PlotASIN  *****
  1021. '
  1022. SUB PlotASIN
  1023.     range$ = "-1 to +1"
  1024.     minimum$ = "-PI/2"
  1025.     maximum$ = "+PI/2"
  1026.     comment$ = "ASIN()"
  1027.     GOSUB DrawAxes
  1028.     XgrSetGridBoxScaled (graph, -1#, +$$PIDIV2, +1#, -$$PIDIV2)
  1029.     x# = -1#
  1030.     y# = ASIN (x#)
  1031.     XgrMoveToScaled (graph, x#, y#)
  1032.     FOR x# = -1# TO +1# STEP (1#/64#)
  1033.         y# = ASIN(x#)
  1034.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1035.     NEXT x#
  1036. END SUB
  1037. '
  1038. SUB PlotACOS
  1039.     range$ = "-1 to +1"
  1040.     minimum$ = "-PI"
  1041.     maximum$ = "+PI"
  1042.     comment$ = "ACOS()"
  1043.     GOSUB DrawAxes
  1044.     XgrSetGridBoxScaled (graph, -1#, +$$PI, +1#, -$$PI)
  1045.     x# = -1#
  1046.     y# = ACOS (x#)
  1047.     XgrMoveToScaled (graph, x#, y#)
  1048.     FOR x# = -1# TO +1# STEP (1#/64#)
  1049.         y# = ACOS (x#)
  1050.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1051.     NEXT x#
  1052. END SUB
  1053. '
  1054. SUB PlotATAN
  1055.     range$ = "-8 to +8"
  1056.     minimum$ = "-PI/2"
  1057.     maximum$ = "+PI/2"
  1058.     comment$ = "ATAN()"
  1059.     GOSUB DrawAxes
  1060.     XgrSetGridBoxScaled (graph, -8#, +$$PIDIV2, +8#, -$$PIDIV2)
  1061.     x# = -8#
  1062.     y# = ATAN (x#)
  1063.     XgrMoveToScaled (graph, x#, y#)
  1064.     FOR x# = -8# TO +8# STEP (1#/16#)
  1065.         y# = ATAN (x#)
  1066.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1067.     NEXT x#
  1068. END SUB
  1069. '
  1070. SUB PlotACOT
  1071.     range$ = "-4 to +4"
  1072.     minimum$ = "-PI"
  1073.     maximum$ = "+PI"
  1074.     comment$ = "ACOT()"
  1075.     GOSUB DrawAxes
  1076.     XgrSetGridBoxScaled (graph, -4#, +$$PI, 4#, -$$PI)
  1077.     x# = -4#
  1078.     y# = ACOT (x#)
  1079.     XgrMoveToScaled (graph, x#, y#)
  1080.     FOR x# = -4# TO 4# STEP (1#/16#)
  1081.         y# = ACOT (x#)
  1082.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1083.     NEXT x#
  1084. END SUB
  1085. '
  1086. SUB PlotASEC
  1087.     range$ = "-16 to -1 : +1 to +16"
  1088.     minimum$ = "-PI"
  1089.     maximum$ = "+PI"
  1090.     comment$ = "ASEC()"
  1091.     GOSUB DrawAxes
  1092.     XgrSetGridBoxScaled (graph, -16#, +$$PI, +16#, -$$PI)
  1093.     x# = -16#
  1094.     y# = ASEC (x#)
  1095.     XgrMoveToScaled (graph, x#, y#)
  1096.     FOR x# = -16# TO -1# STEP (.5#)
  1097.         y# = ASEC (x#)
  1098.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1099.     NEXT x#
  1100.     x# = +1#
  1101.     y# = ASEC (x#)
  1102.     XgrMoveToScaled (graph, x#, y#)
  1103.     FOR x# = +1# TO +16# STEP (.5#)
  1104.         y# = ASEC (x#)
  1105.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1106.     NEXT x#
  1107. END SUB
  1108. '
  1109. SUB PlotACSC
  1110.     range$ = "-16 to -1 : +1 to +16"
  1111.     minimum$ = "-PI"
  1112.     maximum$ = "+PI"
  1113.     comment$ = "ACSC()"
  1114.     GOSUB DrawAxes
  1115.     XgrSetGridBoxScaled (graph, -16#, +$$PI, +16#, -$$PI)
  1116.     x# = -16#
  1117.     y# = ACSC (x#)
  1118.     XgrMoveToScaled (graph, x#, y#)
  1119.     FOR x# = -16# TO -1# STEP (.5#)
  1120.         y# = ACSC (x#)
  1121.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1122.     NEXT x#
  1123.     x# = +1#
  1124.     y# = ACSC (x#)
  1125.     XgrMoveToScaled (graph, x#, y#)
  1126.     FOR x# = +1# TO +16# STEP (.5#)
  1127.         y# = ACSC (x#)
  1128.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1129.     NEXT x#
  1130. END SUB
  1131. '
  1132. '
  1133. ' *****  PlotSINH  *****
  1134. '
  1135. SUB PlotSINH
  1136.     range$ = "-2 to +2"
  1137.     minimum$ = "-2"
  1138.     maximum$ = "+2"
  1139.     comment$ = "SINH()"
  1140.     GOSUB DrawAxes
  1141.     XgrSetGridBoxScaled (graph, -2#, +2#, +2#, -2#)
  1142.     x# = -2#
  1143.     y# = SINH (x#)
  1144.     XgrMoveToScaled (graph, x#, y#)
  1145.     FOR x# = -2# TO +2# STEP (.0625#)
  1146.         y# = SINH (x#)
  1147.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1148.     NEXT x#
  1149. END SUB
  1150. '
  1151. SUB PlotCOSH
  1152.     range$ = "-4 to +4"
  1153.     minimum$ = "-16"
  1154.     maximum$ = "+16"
  1155.     comment$ = "COSH()"
  1156.     GOSUB DrawAxes
  1157.     XgrSetGridBoxScaled (graph, -4#, +16#, +4#, -16#)
  1158.     x# = -4#
  1159.     y# = COSH (x#)
  1160.     XgrMoveToScaled (graph, x#, y#)
  1161.     FOR x# = -4# TO +4# STEP (.0625#)
  1162.         y# = COSH (x#)
  1163.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1164.     NEXT x#
  1165. END SUB
  1166. '
  1167. SUB PlotTANH
  1168.     range$ = "-PI to +PI"
  1169.     minimum$ = "-1"
  1170.     maximum$ = "+1"
  1171.     comment$ = "TANH()"
  1172.     GOSUB DrawAxes
  1173.     XgrSetGridBoxScaled (graph, -$$PI, +1#, +$$PI, -1#)
  1174.     x# = -$$PI
  1175.     y# = TANH (x#)
  1176.     XgrMoveToScaled (graph, x#, y#)
  1177.     FOR x# = -$$PI TO +$$PI STEP ($$PI/64#)
  1178.         y# = TANH (x#)
  1179.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1180.     NEXT x#
  1181. END SUB
  1182. '
  1183. SUB PlotCOTH
  1184.     range$ = "-2 to +2"
  1185.     minimum$ = "-16"
  1186.     maximum$ = "+16"
  1187.     comment$ = "COTH()"
  1188.     GOSUB DrawAxes
  1189.     XgrSetGridBoxScaled (graph, -2#, +16#, +2#, -16#)
  1190.     x# = -2#
  1191.     y# = COTH (x#)
  1192.     XgrMoveToScaled (graph, x#, y#)
  1193.     FOR x# = -2# TO -.01# STEP (.0625#)
  1194.         y# = COTH (x#)
  1195.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1196.     NEXT x#
  1197.     x# = .01#
  1198.     y# = COTH (x#)
  1199.     XgrMoveToScaled (graph, x#, y#)
  1200.     FOR x# = .01# TO +2# STEP (.0625#)
  1201.         y# = COTH (x#)
  1202.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1203.     NEXT x#
  1204. END SUB
  1205. '
  1206. SUB PlotSECH
  1207.     range$ = "-2PI to +2PI"
  1208.     minimum$ = "-1"
  1209.     maximum$ = "+1"
  1210.     comment$ = "SECH()"
  1211.     GOSUB DrawAxes
  1212.     XgrSetGridBoxScaled (graph, -$$TWOPI, 1#, $$TWOPI, -1#)
  1213.     x# = -$$TWOPI
  1214.     y# = SECH (x#)
  1215.     XgrMoveToScaled (graph, x#, y#)
  1216.     FOR x# = -$$TWOPI TO $$TWOPI STEP ($$PI/64#)
  1217.         y# = SECH (x#)
  1218.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1219.     NEXT x#
  1220. END SUB
  1221. '
  1222. SUB PlotCSCH
  1223.     range$ = "-2 to +2"
  1224.     minimum$ = "-16"
  1225.     maximum$ = "+16"
  1226.     comment$ = "CSCH()"
  1227.     GOSUB DrawAxes
  1228.     XgrSetGridBoxScaled (graph, -2#, +16#, +2#, -16#)
  1229.     x# = -2#
  1230.     y# = CSCH (x#)
  1231.     XgrMoveToScaled (graph, x#, y#)
  1232.     FOR x# = -2# TO -.01# STEP (.0625#)
  1233.         y# = CSCH (x#)
  1234.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1235.     NEXT x#
  1236.     x# = +.01#
  1237.     y# = CSCH (x#)
  1238.     XgrMoveToScaled (graph, x#, y#)
  1239.     FOR x# = .01# TO +2# STEP (.0625#)
  1240.         y# = CSCH (x#)
  1241.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1242.     NEXT x#
  1243. END SUB
  1244. '
  1245. '
  1246. ' *****  PlotASINH  *****
  1247. '
  1248. SUB PlotASINH
  1249.     range$ = "-16 to +16"
  1250.     minimum$ = "-4"
  1251.     maximum$ = "+4"
  1252.     comment$ = "ASINH()"
  1253.     GOSUB DrawAxes
  1254.     XgrSetGridBoxScaled (graph, -16#, +4#, +16#, -4#)
  1255.     x# = -16#
  1256.     y# = ASINH (x#)
  1257.     XgrMoveToScaled (graph, x#, y#)
  1258.     FOR x# = -16# TO +16# STEP (.25#)
  1259.         y# = ASINH (x#)
  1260.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1261.     NEXT x#
  1262. END SUB
  1263. '
  1264. SUB PlotACOSH
  1265.     range$ = "-16 to +16"
  1266.     minimum$ = "-4"
  1267.     maximum$ = "+4"
  1268.     comment$ = "ACOSH()"
  1269.     GOSUB DrawAxes
  1270.     XgrSetGridBoxScaled (graph, -16#, +4#, +16#, -4#)
  1271.     x# = +1#
  1272.     y# = ACOSH (x#)
  1273.     XgrMoveToScaled (graph, x#, y#)
  1274.     FOR x# = +1# TO +16# STEP (.25#)
  1275.         y# = ACOSH (x#)
  1276.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1277.     NEXT x#
  1278. END SUB
  1279. '
  1280. SUB PlotATANH
  1281.     range$ = "-1 to +1"
  1282.     minimum$ = "-2"
  1283.     maximum$ = "+2"
  1284.     comment$ = "ATANH()"
  1285.     GOSUB DrawAxes
  1286.     XgrSetGridBoxScaled (graph, -1#, +2#, +1#, -2#)
  1287.     x# = -.99#
  1288.     y# = ATANH (x#)
  1289.     XgrMoveToScaled (graph, x#, y#)
  1290.     FOR x# = -.99# TO +.99# STEP (1#/64#)
  1291.         y# = ATANH (x#)
  1292.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1293.     NEXT x#
  1294. END SUB
  1295. '
  1296. SUB PlotACOTH
  1297.     range$ = "-4 to +4"
  1298.     minimum$ = "-4"
  1299.     maximum$ = "+4"
  1300.     comment$ = "ACOTH()"
  1301.     GOSUB DrawAxes
  1302.     XgrSetGridBoxScaled (graph, -4#, +4#, +4#, -4#)
  1303.     x# = -4#
  1304.     y# = ACOTH (x#)
  1305.     XgrMoveToScaled (graph, x#, y#)
  1306.     FOR x# = -4# TO -1.01# STEP (.0625#)
  1307.         y# = ACOTH (x#)
  1308.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1309.     NEXT x#
  1310.     x# = +1.01#
  1311.     y# = ACOTH (x#)
  1312.     XgrMoveToScaled (graph, x#, y#)
  1313.     FOR x# = +1.01# TO +4# STEP (.0625#)
  1314.         y# = ACOTH (x#)
  1315.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1316.     NEXT x#
  1317. END SUB
  1318. '
  1319. SUB PlotASECH
  1320.     range$ = "-1 to +1"
  1321.     minimum$ = "-4"
  1322.     maximum$ = "+4"
  1323.     comment$ = "ASECH()"
  1324.     GOSUB DrawAxes
  1325.     XgrSetGridBoxScaled (graph, -1#, +4#, +1#, -4#)
  1326.     x# = .01#
  1327.     y# = ASECH (x#)
  1328.     XgrMoveToScaled (graph, x#, y#)
  1329.     FOR x# = .01# TO 1# STEP (.0625#)
  1330.         y# = ASECH (x#)
  1331.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1332.     NEXT x#
  1333. END SUB
  1334. '
  1335. SUB PlotACSCH
  1336.     range$ = "-4 to +4"
  1337.     minimum$ = "-4"
  1338.     maximum$ = "+4"
  1339.     comment$ = "ACSCH()"
  1340.     GOSUB DrawAxes
  1341.     XgrSetGridBoxScaled (graph, -4#, +4#, +4#, -4#)
  1342.     x# = -4#
  1343.     y# = ACSCH (x#)
  1344.     XgrMoveToScaled (graph, x#, y#)
  1345.     FOR x# = -4# TO -.01# STEP (.0625#)
  1346.         y# = ACSCH (x#)
  1347.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1348.     NEXT x#
  1349.     x# = .01#
  1350.     y# = ACSCH (x#)
  1351.     XgrMoveToScaled (graph, x#, y#)
  1352.     FOR x# = .01# TO +4# STEP (.0625#)
  1353.         y# = ACSCH (x#)
  1354.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1355.     NEXT x#
  1356. END SUB
  1357. '
  1358. '
  1359. ' *****  PlotSQRT  *****
  1360. '
  1361. SUB PlotSQRT
  1362.     range$ = "-1 to +1"
  1363.     minimum$ = "-1"
  1364.     maximum$ = "+1"
  1365.     comment$ = "SQRT()"
  1366.     GOSUB DrawAxes
  1367.     XgrSetGridBoxScaled (graph, -1#, +1#, +1#, -1#)
  1368.     x# = 0#
  1369.     y# = SQRT (x#)
  1370.     XgrMoveToScaled (graph, x#, y#)
  1371.     FOR x# = 0# TO +1# STEP (1#/64#)
  1372.         y# = SQRT (x#)
  1373.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1374.     NEXT x#
  1375. END SUB
  1376. '
  1377. SUB PlotPOWER
  1378.     range$ = "-2 to +2"
  1379.     minimum$ = "-4"
  1380.     maximum$ = "+4"
  1381.     comment$ = "x ** x  (x to the x)"
  1382.     GOSUB DrawAxes
  1383.     XgrSetGridBoxScaled (graph, -2#, +4#, +2#, -4#)
  1384.     x# = .01#
  1385.     y# = POWER (x#, x#)
  1386.     XgrMoveToScaled (graph, x#, y#)
  1387.     FOR x# = .01# TO +2# STEP (1#/64#)
  1388.         y# = POWER (x#, x#)
  1389.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1390.     NEXT x#
  1391. END SUB
  1392. '
  1393. SUB PlotLOG
  1394.     range$ = "-4 to +4"
  1395.     minimum$ = "-4"
  1396.     maximum$ = "+4"
  1397.     comment$ = "LOG()"
  1398.     GOSUB DrawAxes
  1399.     XgrSetGridBoxScaled (graph, -4#, +4#, +4#, -4#)
  1400.     x# = .01#
  1401.     y# = LOG (x#)
  1402.     XgrMoveToScaled (graph, x#, y#)
  1403.     FOR x# = .01# TO +4# STEP (1#/64#)
  1404.         y# = LOG (x#)
  1405.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1406.     NEXT x#
  1407. END SUB
  1408. '
  1409. SUB PlotEXP
  1410.     range$ = "-2 to +2"
  1411.     minimum$ = "-8"
  1412.     maximum$ = "+8"
  1413.     comment$ = "EXP()"
  1414.     GOSUB DrawAxes
  1415.     XgrSetGridBoxScaled (graph, -2#, +8#, +2#, -8#)
  1416.     x# = -2#
  1417.     y# = EXP (x#)
  1418.     XgrMoveToScaled (graph, x#, y#)
  1419.     FOR x# = -2# TO +2# STEP (1#/64#)
  1420.         y# = EXP (x#)
  1421.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1422.     NEXT x#
  1423. END SUB
  1424. '
  1425. SUB PlotLOG10
  1426.     range$ = "-4 to +4"
  1427.     minimum$ = "-4"
  1428.     maximum$ = "+4"
  1429.     comment$ = "LOG10()"
  1430.     GOSUB DrawAxes
  1431.     XgrSetGridBoxScaled (graph, -4#, +4#, +4#, -4#)
  1432.     x# = .01#
  1433.     y# = LOG10 (x#)
  1434.     XgrMoveToScaled (graph, x#, y#)
  1435.     FOR x# = .01# TO +4# STEP (1#/64#)
  1436.         y# = LOG10 (x#)
  1437.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1438.     NEXT x#
  1439. END SUB
  1440. '
  1441. SUB PlotEXP10
  1442.     range$ = "-1 to +1"
  1443.     minimum$ = "-4"
  1444.     maximum$ = "+4"
  1445.     comment$ = "EXP10()"
  1446.     GOSUB DrawAxes
  1447.     XgrSetGridBoxScaled (graph, -1#, +4#, +1#, -4#)
  1448.     x# = -1#
  1449.     y# = EXP10 (x#)
  1450.     XgrMoveToScaled (graph, x#, y#)
  1451.     FOR x# = -1# TO +1# STEP (1#/64#)
  1452.         y# = EXP10 (x#)
  1453.         XgrDrawLineToScaled (graph, $$Yellow, x#, y#)
  1454.     NEXT x#
  1455. END SUB
  1456. '
  1457. '
  1458. ' *****  Initialize  *****
  1459. '
  1460. SUB Initialize
  1461.     XuiSendMessage (grid, #GetGridNumber, @graph, 0, 0, 0, $Graph, 0)
  1462.     XgrSetGridClip (graph, graph)
  1463. END SUB
  1464. END FUNCTION
  1465. END PROGRAM
  1466.