| OCR Text |
Show 4.3.3 Filter Directors can provide filters that throw away uninteresting events. Filters are compiled object files in host code that include functions with predetermined names. Directors use several routines that deal with filters. Routine dsldf ilter loads an object file with filter functions in the interpreter. Routine dsrmf ilter removes a filter object file from the interpreter. Many filters can be loaded, but only one is active at any moment. Filter files are kept in a stack. Routines deal with the topmost filter with a given name. Routine dssetf ilter sets the active filter to an already loaded file. A filter object file must provide two functions: • initfilter0, • eventf ilterO. Routine initf ilter is used to initialize internal filter data. This routine is called automatically by the interpreter after the filter file is loaded or explicitly by the director calling ds initf ilter. If a director is connected to the execution stream, routine eventf ilter is called for each interpreted instruction. Routine eventf ilter evaluates conditions on the event describing the interpreted instruction. The event structure is shown in Figure 4.3. Routine eventf ilter returns a one word result. If the result is different from zero, the event is passed to the director. There are two predefined names for filters that do not require an object file. Filter ALL reports all events. This filter is used for a complete tracing of the executor. Filter ZERO reports no events. This filter is used to quickly switch off events. An alternative implementation supports interpreted filters. The functionality of these filters is easier to change dynamically by the director than the functionality of compiled filters. An algorithm to evaluate Boolean expressions in software, called 78 |