How to create a new outputhandler

An outputhandler must be located in directory prolint/outputhandlers, and has to be listed in
file prolint/outputhandlers/choices.d.


Columns in file prolint/outputhandlers/choices.d:

  1. programname.
  2. minimum required Progress version (integer).

    only the main version, like 8 or 9, is supposed to be listed here.

    The outputhandler will not be run if this value is less than the current Progress version

  3. supported window-system.

    possible values:

    "GUI" this outputhandler will only run in a GUI session
    "TTY" this outputhandler will only run in a ChUI session
    "*" this outputhandler will run in any window-mode
    "" this outputhandler will only run in batch-mode
  4. short description (only one line)

Each outputhandler is loaded persistently by prolint.p, but prolint will never delete the procedure. The outputhandler has to delete itself when ready,
usually from within the event-procedure for event "Prolint_FinalizeResults".

The outputhandler subscribes to, and responds to (some) of the following published events:


PROCEDURE Prolint_InitializeResults :  
   DEFINE INPUT PARAMETER pClearOutput AS LOGICAL NO-UNDO.
END PROCEDURE.              

Event Prolint_InitializeResults is published when prolint.p starts.

This is the right moment to create an output stream or XML-document or temp-table, or whatever kind of output you want to create.

pClearOutput=TRUE indicates that the existing output (logfile) needs to be emptied or that a new output stream (logfile) should be started.


pClearOutput=FALSE indicates that new lint-results should be appended to existing output (logfile).


PROCEDURE Prolint_List_Rules :
  DEFINE INPUT PARAMETER pRuleList AS CHARACTER NO-UNDO.  /* comma-separated list of ruleid */
END PROCEDURE.
Event Prolint_List_Rules is published to let you know which rules are selected in the current profile. This is a comma-separated list, not including the semi rule-id's used for system warnings like "prolint,proparse,compiler". This event is published once, after InitializeResults and before the first Status_Filestart.
PROCEDURE Prolint_Status_FileStart :
  DEFINE INPUT PARAMETER pSourceFile AS CHAR NO-UNDO.
END PROCEDURE.
Event Prolint_Status_FileStart is published to notify you when prolint starts to work on a new sourcefile, or actually on a new compilation-unit.
Some possible uses for this event are: putting a break/header/paragraph in the output stream, start a new XML node,...
Logwin.w uses this event to delete old results for this sourcefile from the result list before new results may be added.
    
PROCEDURE Prolint_AddResult :
   DEFINE INPUT PARAMETER pCompilationUnit  AS CHARACTER NO-UNDO.  /* the sourcefile we're parsing          */
   DEFINE INPUT PARAMETER pSourcefile       AS CHARACTER NO-UNDO.  /* may be an includefile                 */
   DEFINE INPUT PARAMETER pLineNumber       AS INTEGER   NO-UNDO.  /* line number in pSourceFile            */
   DEFINE INPUT PARAMETER pDescription      AS CHARACTER NO-UNDO.  /* human-readable hint                   */
   DEFINE INPUT PARAMETER pRuleID           AS CHARACTER NO-UNDO.  /* defines rule-program and maps to help */
   DEFINE INPUT PARAMETER pSeverity         AS INTEGER   NO-UNDO.  /* importance of this rule, scale 0-9    */
END PROCEDURE.
Event Prolint_AddResult is published when prolint wants you to add something to the output (logfile).
I assume the parameters are sufficiently self-explaining.
PROCEDURE Prolint_Status_FileEnd :
END PROCEDURE.
Event Prolint_Status_FileEnd is published to notify you when prolint is done with the sourcefile that was earlier published in event Prolint_Status_FileStart.
You might want to use this event to write summary information, or close an XML node, whatever.
   
PROCEDURE Prolint_FinalizeResults :
END PROCEDURE.
Event Prolint_FinalizeResults is published when prolint is ready.
This is the perfect moment to close all opened resources, save the output (logfile) to disk,...., and finally to delete the procedure (this-procedure:handle).
                        
PROCEDURE Prolint_Status_Action :
  DEFINE INPUT PARAMETER pAction AS CHAR NO-UNDO.
END PROCEDURE.
Event Prolint_Status_Action is probably only useful for logwin.w; parameter pAction is the text to show in the second panel of the statusbar.
PROCEDURE Prolint_Status_Profile :
  DEFINE INPUT PARAMETER pProfile AS CHAR NO-UNDO.
END PROCEDURE.
Event Prolint_Status_Profile sends you the name of the configuration profile that is used by Prolint.
                                                                                                     
PROCEDURE Prolint_Status_StopTimer :
END PROCEDURE.
PROCEDURE Prolint_Status_StartTimer :
END PROCEDURE.
Events Prolint_Status_StopTimer and Prolint_Status_StartTimer are used for finding out how long it takes to run rules: event Prolint_Status_StopTimer is published before compilation and parsing begins, Prolint_Status_StartTimer is published when compilation and parsing are ready which is also the moment that the loop "for each rule: run value(rule)..." begins.