This example is defined in the directory: /home/lbesnard/Polychrony/V4.19/Linux/Examples/mouse/MouseProgram.
This directory contains the description in Signal of a mouse handler, which is a control example.
The directory contains the following files:
- VTMOUSE.gpk is the graphical source of the mouse program, embedded in its simulation context (the program reads X11 shared variables to detect external events);
- VTMOUSE.SIG is the textual source of VTMOUSE.gpk. It is produced by the graphical SIGNAL interface;
- VTMOUSE.PAR is the parameter file used by the compiler; the following parameters are needed: N is the period of the basic displayed unit of time (TICKs) M is the number of TICKs in an interval where CLICKs are monitored NUL_CODE and LIN_CODE are possible values (codes) of the period modification signals TICK_NUMBER is the maximal number of displayed TICKs FRONT_NUMBER is the duration of the striking (number of TICKs) TICK_HEIGHT is the maximal vertical size of the activity marks DELTA is (half of) the horizontal size between two consecutive activity marks TICK_WIDTH is the horizontal size of the activity marks
- MOUSE.gpk is the mouse program without the simulation context;
- MOUSE.SIG is the textual source of MOUSE.gpk;
- MOUSE.PAR is the parameter file for the MOUSE program.
Here follows a description of the mouse handler.
This process has two inputs:
- CLICK: a push-button,
- TICK: a clock signal.
The mouse handler has to repeatedly decide if, during some interval following an initial CLICK, some other CLICKs have been received; intervals are composed of a constant number M > 0 of TICKs and are disjoint. At the end of each such interval, the mouse emits a signal DOUBLE when another CLICK has been received since the initial one, a signal SINGLE otherwise.
The two following additional signals are displayed:
- START, which indicates the beginning of a new interval,
- RELAX, which indicates the end of the current interval.
To compile, add the $SignalLib_Graphical path to your SIGNAL_LIBRARY_PATH shell environment variable.
The command (batch SIGNAL compiler):
signal -tra -c VTMOUSE.SIG -par=VTMOUSE.PAR -lis
produces the following files (sub-directory VTMOUSE):
- VTMOUSE_io.c is the C input/output module
- VTMOUSE_main.c is the C main program
- VTMOUSE_body.c contains: VTMOUSE_initialize(): the start up routine VTMOUSE_step(): the routine called at each transition
- VTMOUSE_TRA.SIG is a file that contains a description of the set of clocks
- VTMOUSE_LIS.SIG is a file that contains messages from the compiler
The running program, VTMOUSE, is obtained by the command in the VTMOUSE sub-directory. The simultation is restricted to Unix .
This makefile references the file vtmouse.o defined in the Graphic sub-directory. Please, read the file VTMOUSE/Graphic/AAREADME.TXT for more details about the graphical simulation.
- VTMOUSE is a mouse handler running under X Window; it uses a PACE_MAKER (described in SIGNAL and integrated in the simulation environment) with the following buttons:
- AUTO/MANU + switches the mode (AUTOMATIC/MANUAL)
- TICK + gives the ticks in MANUAL mode and gives supplementary ticks in AUTOMATIC mode
- QUIT + quits the program in MANUAL mode
- + + decreases the period of the clock program (basic frequency in AUTOMATIC mode)
- - + increases the period of the clock program
- / + divides by 2 the period of the clock program
- * + doubles the period of the clock program (buttons +, -, /, * can be depressed in both AUTOMATIC and MANUAL modes)
The mouse itself uses the following button:
- CLICK + clicks on the mouse
To run the mouse, type:
The mouse (i.e. the PACE_MAKER of the mouse) is in MANUAL mode (the label AUTO is displayed on the AUTO/MANU button). You can put the mode in AUTO by depressing this button (the label MANU is then displayed on the AUTO/MANU button). You can click on the mouse by depressing the button CLICK.