compile insert npHandler_Equates
/* 
   ** Copyright (C) 2013-2023 Revelation Software Inc. All Rights Reserved **
   
   Author   : Wile C Coyote - (Le Singe de Code)
   Date     : May 2015
   Purpose  : Constants for working with Non procedural event handlers
              (a.k.a QuickEvents)
   
   
   Comments
   ========
   
   This insert replaces the embedded constants in the GetNPHandler and 
   ExecNpHandler stored procedures.
   
   
   Amended  Date        Reason
   =======  ====        ======
   Mr C     06 Jan 23   Fxed sum shpelling mishtooks
   Mr C     18 Jun 20   Added NP_ALLMSGTYPES$
   Mr C     03 Jun 20   Added "Execute a Method" fields
   Mr C     30 May 18   Added "Get a Property" fields.
   Mr C     01 Sep 17   Added NP_PRIORITYFLAG$
   Mr C     31 Mar 16   Updated comments
   Mr C     29 May 15   Added CFG_RTI_IDE_QUICKEVENT_TYPES 
   Mr C     28 May 15   Added "Ignore if null" flags
*/
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#ifndef _NPHANDLER_EQUATES_
#define _NPHANDLER_EQUATES_
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

   // QuickEvent Types
   // 
   // "R" - Repository.  Execute a repository method on an entity
   // "E" - Event - send an event to a PS object
   // "G" - Get Property - get a PS object property
   // "P" - Set Property - set a PS object property
   // "M" - Exec_Method  - execute a PS object method
   // "X" - Execute a stored procedure
   // "N" - Not set
   
   equ NP_NOTSETMSGTYPE$          to "N"
   equ NP_REPOSMSGTYPE$           to "R"
   equ NP_EVENTMSGTYPE$           to "E"
   equ NP_GETPROPMSGTYPE$         to "G"
   equ NP_PROPMSGTYPE$            to "P"
   equ NP_PROCMSGTYPE$            to "X"
   equ NP_EXECMETHODMSGTYPE$      to "M"
   
   equ NP_ALLMSGTYPES$            to "N,R,E,G,P,X,M"
   
   // Descriptions for these codes can be found in the 
   // CFG_RTI_IDE_QUICKEVENT_TYPES record described below
   
///////////////////////////////////////////////////////////////////////////////

   // Quickevent structure. 
   //
   // Quickevents are stored in a pair of @svm-delimited values forming an 
   // AMV in the SYSREPOSWINS structure:
   //
   // (From OIWIN_EQUATES)
   //
   //    equ POS_EVENT_HANDLER$  to 18  <- QE structures
   //    equ POS_QEVENTS$        to 19  <- QE Names
   //
   // (For some reason each of these values has a trailing @svm)
   //
   // In the SYSREPOSWINEXES structure they are stored in the Semantics
   // block instead, still as an AMV pair of @svm delimited lists, again 
   // with a trailing @svm
   //
   //   equ CS_EVENTS$           to 8 <- QE Names
   //   equ CS_EVENT_HDLR$       to 9 <- QE structure
   // 
   // Prior to v10 the QE structure was a set of up to 6 @tm delimited values
   // but with v10 we have extended this to:
   // 
   //    <0,0,0,1>  Type
   //    <0,0,0,2>  Message
   //    <0,0,0,3>  Target
   //    <0,0,0,4>  Parameters (@stm delimited)
   //    <0,0,0,5>  Return Target
   //    <0,0,0,6>  Return Message
   //    <0,0,0,7>  Return Type (defaults to "P" for property)
   //    <0,0,0,8>  Return Parameters (@stm delimited)
   //    <0,0,0,9>  Return Flags (@stm delimited)
   //       <0,0,0,9,1> Ignore if RetVal is null
   //    <0,0,0,10>  Final Type
   //    <0,0,0,11> Final Message
   //    <0,0,0,12> Final Target
   //    <0,0,0,13> Final Parameters (@stm delimited)
   //    <0,0,0,14>  Return Flags (@stm delimited)
   //       <0,0,0,14,1> Ignore if RetVal is null
   //    <0,0,0,15> QuickEvent ID (for when it's reloaded back into the designer) - 
   
   equ NP_MSGTYPE$           to 1
   equ NP_MSG$               to 2
   equ NP_TARGET$            to 3  ; // was NP_RECIPIENT$ pre-v10
   equ NP_ARGS$              to 4
   equ NP_RETTARGET$         to 5  ; // was NP_RETCTRL$ pre-v10
   equ NP_RETMSG$            to 6  ; // was NP_RETPROP$ pre-v10
   equ NP_RETTYPE$           to 7
   equ NP_RETARGS$           to 8
   equ NP_RETFLAGS$          to 9
   equ NP_FINALTYPE$         to 10
   equ NP_FINALMSG$          to 11
   equ NP_FINALTARGET$       to 12
   equ NP_FINALARGS$         to 13
   equ NP_FINALFLAGS$        to 14
   equ NP_ID$                to 15
   equ NP_PRIORITYFLAG$      to 16
   
   // QE Action Flags - these are @stm delimited
   //
   //   <0,0,0,0,1> If TRUE$ then skip the action if the returned value is null
   
   equ NP_FL_IGNOREIFNULL$   to 1

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

   // QuickEvent config records
   //
   // These are stored in the SYSENV table with an appID-based key like so:
   //
   //    CFG_RTI_IDE_QUICKEVENTS*<appid>
   //
   // Each record forms a AMV group with the following structure:
   //
   //    <1>  QuickEvent ID
   //    <2>  QuickName Name (display name)
   //
   //    <4>  Allowed Types
   //    <5>  Allowed Messages
   //    <6>  Allowed Targets
   //    <7>  Default Params
   //    <8>  Config flags:
   //       <8,n,1> Types is ReadOnly
   //       <8,n,2> Targets is ReadOnly
   //       <8,n,3> Params is ReadOnly
   //
   //    <12> Default Return Types
   //    <13> Default Return Messages
   //    <14> Default Return Targets
   //    <15> Default Return Params
   //    <16> Return Config flags:
   //       <16,n,1> Return Types is ReadOnly
   //       <16,n,2> Return Targets is ReadOnly
   //       <16,n,3> Return Params is ReadOnly
   //       <16,n,4> Ignore if return value is null
   //
   //    <20> Default Final Types
   //    <21> Default Final Messages
   //    <22> Default Final Targets
   //    <23> Default Final Params
   //    <24> Final Config flags:
   //       <24,n,1> Final Types is ReadOnly
   //       <24,n,2> Final Targets is ReadOnly
   //       <24,n,3> Final Params is ReadOnly
   
   equ NP_CFG_TABLE$                to "SYSENV"
   equ NP_CFG_ID_PREFIX$            to "CFG_RTI_IDE_QUICKEVENTS*"

   equ NP_CFGPOS_ID$                to 1
   equ NP_CFGPOS_NAME$              to 2
   
   equ NP_CFGPOS_TYPES$             to 4 ; // Allowed types (R,E,G,P,X)
   equ NP_CFGPOS_MESSAGES$          to 5 ; // Property for "P" type
   equ NP_CFGPOS_TARGETS$           to 6
   equ NP_CFGPOS_PARAMS$            to 7
   equ NP_CFGPOS_FLAGS$             to 8
   
   equ NP_CFGPOS_RETTYPE$           to 12 ; // Default type (R,E,G,P,X)
   equ NP_CFGPOS_RETMESSAGES$       to 13 ; // Property for "P" type
   equ NP_CFGPOS_RETTARGETS$        to 14
   equ NP_CFGPOS_RETPARAMS$         to 15
   equ NP_CFGPOS_RETFLAGS$          to 16
   
   equ NP_CFGPOS_FINTYPES$          to 20 ; // Default type (R,E,G,P,X)
   equ NP_CFGPOS_FINMESSAGES$       to 21 ; // Property for "P" type
   equ NP_CFGPOS_FINTARGETS$        to 22
   equ NP_CFGPOS_FINPARAMS$         to 23
   equ NP_CFGPOS_FINFLAGS$          to 24
   
   equ NP_CFGPOS_AMV_FIRST$         to NP_CFGPOS_ID$
   equ NP_CFGPOS_AMV_LAST$          to NP_CFGPOS_FINFLAGS$
   
   // Flags
   
   equ NP_CFG_FPOS_TYPES_READONLY$  to 1
   equ NP_CFG_FPOS_MSG_READONLY$    to 2
   equ NP_CFG_FPOS_TARGET_READONLY$ to 3
   equ NP_CFG_FPOS_PARAMS_READONLY$ to 4
   equ NP_CFG_FPOS_IGNOREIFNULL$    to 5
   
   // There are three sections to a quickevent config:
   //
   //    Event Action  - Starts at field<4>  (NP_CFGPOS_TYPES$)
   //    Return Value  - Starts at field<12> (NP_CFGPOS_RETTYPE$)
   //    Final Action  - Starts at field<20> (NP_CFGPOS_FINTYPES$)
   //
   // Each section has 5 parts that may be set:
   //
   //    Type
   //    Target
   //    Message
   //    Params
   //    Flags
   
   equ NP_CFG_SECTIONS$              to 3
   equ NP_CFG_ITEMSPERSECTION$       to 8  ; // 5 fields used, but 8 available
   equ NP_CFG_SECTIONS_START$        to NP_CFGPOS_TYPES$
   
   // Offsets into each section for each part
   equ NP_CFG_SECT_TYPE$             to 0
   equ NP_CFG_SECT_MESSAGE$          to 1
   equ NP_CFG_SECT_TARGET$           to 2
   equ NP_CFG_SECT_PARAMS$           to 3
   equ NP_CFG_SECT_FLAGS$            to 4
   
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

   // QuickEvent TYPE config record
   //
   // This record is stored in the SYSENV table with a key of:
   //
   //    CFG_RTI_IDE_QUICKEVENT_TYPES
   //
   // This record describes the default properties to apply to the Target,
   // Message and Params, along with a textual description of the type
   //
   // It is an AMV structured like so:
   // 
   //  <1> Type        : ( "R","E","P","G","M" or"X" )
   //  <2> Description : ( "Execute a repository method", "Send An Event" etc )
   //  <3> Message     : ( "EXECUTE", or a property name for a "P" type, an event name for an "E" type etc )
   //  <4> Target      :
   //  <5> Params      : 
   //  <6> Flags       : @svm'd list of flags
   //    <6,n,1> Types is ReadOnly
   //    <6,n,2> Target is ReadOnly
   //    <6,n,3> Params is ReadOnly
   
   equ NP_TYPECFG_TABLE$             to "SYSENV"
   equ NP_TYPECFG_ID$                to "CFG_RTI_IDE_QUICKEVENT_TYPES"  
   
   equ NP_CFG_TPOS_TYPES$            to 1 ; // "R","E","G,","P","X"
   equ NP_CFG_TPOS_DESCS$            to 2 ; // "Execute a repository method", "Send An Event" etc
   equ NP_CFG_TPOS_MESSAGES$         to 3 ; //
   equ NP_CFG_TPOS_TARGETS$          to 4 ; // 
   equ NP_CFG_TPOS_PARAMS$           to 5 ; // 
   equ NP_CFG_TPOS_FLAGS$            to 6 ; // 
   
   // Flags (NP_CFG_TPOS_FLAGS$ - @svm delimited)
   
   equ NP_CFG_TFPOS_TYPES_READONLY$   to 1
   equ NP_CFG_TFPOS_TARGETS_READONLY$ to 2
   equ NP_CFG_TFPOS_MSGS_READONLY$    to 3
   equ NP_CFG_TFPOS_PARAMS_READONLY$  to 4
   equ NP_CFG_TFPOS_IGNOREIFNULL$     to 5

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#endif
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////


