Note: This has been updated and edited slightly; correct paths to refs are given below. If you browse, I would appreciate error reports. Thanks




Yüklə 21.22 Kb.
tarix27.02.2016
ölçüsü21.22 Kb.
01f523 - Assignments 3 & 4a - due Oct 31/ Nov 7/Nov 14:

RJLRef; ~/01f522/01f522asgnt3and4.txt (-->.doc)

NOTE: This has been updated and edited slightly; correct paths to refs are given below. If you browse, I would appreciate error reports. Thanks.

More details on bde and state models are in ~/01f522/MoreOnAsgnts3and4.txt.


Preparation: Please review these files in $CASE/bde: or at my home page:

//www.cs.uml.edu/~lechner/bdeUG_2000/bdeUG_2000.htm)

  • bde source code for canvas drawing actions at $CASE/bde/src/*ops.cc

  • bde's database schema in $CASE/bde/schema/94sbde_schema.sch

  • bde canvas state list in $CASE/bde/include/state.h

This problem concerns BDE's menu organization, which is symmetric between object types and operations, rather than a tree with class--> operation or operation -> class levels.

This amounts to specifying the direct product of two State machines: one for class selection, another for operations. These two state machines operate in parallel, each acting like radio push-buttons which select any one of (five or six) options.
The file $CASE/bde/include/states.h #defines all the relevant states of this menu pair plus other successor states for operations that require memory, of which there are many: (e.g. was the last mouse event down or up or move? / inside what object type? / in the same or a different object? /should the same operation be repeated?
Windows GUI's (MS or X11) listen for and manage a que of mouse, keyboard and window border-crossing events. They dispatch one event at a time, by calling user-defined functions known as callbacks. Calback functions are registered with X11 by calls in a window initialization phase of bde . (Bde's biggest modules define menu window layouts and manage user dialog with them.).
Bde's drawing actions occur in the canvas sub-window. dobutton is a single callback for all button events. These are named MB1up/MB1down/MB1move on STD's, and BUTTON_UP/BUTTON_DOWN/BUTTON_MOVED in switch(button_op) cases. MB1 is the only button that should affect bde. MB2 and MB3 can be used by the X11 server.

The real decision about how to respond to a mouse event cannot be decided until we identify the object that the mouse points to. This object must be consistent with the OO MENU's pre-selected class and operation. Objects can touch each other but not overlap.

RJLRef: ~/01f522/01f522asgnt3and4.doc page 2 of 4
ASSIGNMENTS 3 AND 4:

Assignments 3 and 4 concern state models for bde's object and operation menus. These state actions are simply to identify and highlight one newly selected button and define an initial state for a sub-machine that will perform the selected operation in response to MB-events. The sub-machine actions are already defined as switch cases in *ops.cc, which act on a mouse-selected canvas drawing object (graph, caption, node, link, bendpoint, text). The sub-machine's initial state is entered by switch(menuState) in the smselect.cc function do_button_event, and is part of the *ops.cc file corresponding to the drawing object type (its menu selection).



[Please note: Submit a DRAFT, regardless of its condition, to pace your work and to get my feedback. It can only favorably affect your grade, which is based on the final submission.]
Assignment 3: Draft due Wed Oct 31 (50%): Final version due Wed. Nov 7 (50%).
Do the analysis and design of the OO MENU state models, with two separate state diagrams AND define the state actions which update the global state variable. (The STD's are trivial because in the radio button protocol, a new current state can be selected only by 'clicking' inside any one of its menu buttons, regardless of their machine's prior state.)
Deliverables: For each (Class or Operation) Menu:

  • 3A: State Diagram (STD),

  • 3B: EventType List (ETList);

  • 3C: State Transition Table (STT).


References: the OLC text and examples in the SIS project report.doc class handout.
Assignment 4: Draft due Wed. Nov 7 (50%); Final version due Wed Nov. 14. (50%).
Write the menu operation code file which includes a switch to embedded state machine labels and events following the style of *ops.cc with its submachine state labels and switches. This code should be entered from the same do_button_event function that works in the canvas, or a similar function that works on the object X operation menus.
Deliverables: For the pair of Object and Operation menus (to left of bde canvas window):

  • 4A: New file menuOps.cc of compilable source code

  • 4B: A short writeup (discuss how your code might fit into bde's current menuops.cc & other files.

  • 4C: Script that captures a compilation run (save with >& not > to capture stderr and stdout)

References: $CASE/bde/include/state.h and bde/src/*ops.cc file examples.
RJLRef: ~/01f522/01f522asgnt3and4.doc page 3 of 4
Note 1: The major responsibility of the do_button_event callback function and its menuOps.cc actions is to select the submachine to enter (by updating bde's global state variable). Each sub-machine makes transitions among its one, two or three states, perhaps repeating its operation on multiple objects of that type. Inside each submachine are a switch(state) and a nested switch(button_op). Each nested switch case executes a single state action and may change the state. [State labels are identified in *ops.cc files by case labels. Do 'grep changeState' *ops.cc to see the state changes that implement non-cyclic transitions.]
Note 2: Values of the switch(state) case labels are currently #defined in state.h which is #included in each *ops.cc file There are several versions of state.h that evolve torward easy separation of the state into object and operation and substate-within-operation parts. Be sure to ue the latest version when assigning initial submachine state(object, operation) from the menu state machines. A new version is needed that has non-dense three hex-digit encoding and subsumes the statename[] array that is now indexd by state.
More info on menu operations: which bde/src/*.cc files mention the string "menu"?

(1) 186 lines in files *.cc contain "menu":

---------------

saturn.cs.uml.edu(95)> pwd

/usr/proj3/case/95s523/95sbde/bde/src

saturn.cs.uml.edu(96)> grep menu *.cc | wc

186 1130 11949

---------------

(2) Exactly 10 *.cc files (out of 29) contain string "menu":

--------------

saturn.cs.uml.edu(93)> grep menu *.cc|awk -F : '{printf("%s\n", $1)}'|sort -u

fileio.cc

fprint.cc

init.cc


leftmenu.cc

leftmenu_cb.cc

log_menu.cc

menubar.cc

menubar_cb.cc

msgBox.cc

smselect.cc
RJLRef: ~/01f522/01f522asgnt3and4.doc page 4 of 4
(3) Here are the sizes of files on the list above:

-------------------

saturn.cs.uml.edu(116)> grep menu *.cc | \

awk -F : '{printf("wc %s\n", $1)}' | sort -u > filesizes.txt

saturn.cs.uml.edu(117)> sh filesizes.txt

2058 8484 68692 fileio.cc

1081 4980 36120 fprint.cc

519 2073 19602 init.cc

228 692 8669 leftmenu.cc

1023 3696 36858 leftmenu_cb.cc

40 134 1105 log_menu.cc

218 776 7456 menubar.cc

223 670 6961 menubar_cb.cc

222 692 7175 msgBox.cc

626 2292 23171 smselect.cc

364 1402 11690 text.cc

--------------------
Fileio.cc is the largest file in bde/src (2K lines).

To get a (partial) list of (void) functions defined there,

grep on '^void' and on '^ * Description:'

--------------

saturn.cs.uml.edu(137)> grep '^ \* Description: [A-Z]' fileio.cc | wc

9 106 671

saturn.cs.uml.edu(138)> grep '^void' fileio.cc | wc

37 181 1755

saturn.cs.uml.edu(136)> grep '^ \* Description: [A-Z]|^void' fileio.cc | wc

46 287 2426

---------------

The last command merges Description lines and the (void-returning)



function names they describe, if any (pipe to more to see them).


Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azrefs.org 2016
rəhbərliyinə müraciət

    Ana səhifə