[0001]
[0002]
[0003]
[0004]
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067]
[0068]
[0069]
[0070]
[0071]
[0072]
[0073]
[0074]
[0075]
[0076]
[0077]
[0078]
[0079]
[0080]
[0081]
[0082]
[0083]
[0084]
[0085]
[0086]
[0087]
[0088]
[0089]
[0090]
[0091]
[0092]
[0093]
[0094]
[0095]
[0096]
[0097]
[0098]
[0099]
[0100]
[0101]
[0102]
[0103]
[0104]
[0105]
[0106]
[0107]
[0108]
[0109]
[0110]
[0111]
[0112]
[0113]
[0114]
[0115]
[0116]
[0117]
[0118]
[0119]
[0120]
[0121]
[0122]
[0123]
[0124]
[0125]
[0126]
[0127]
[0128]
[0129]
[0130]
[0131]
[0132]
[0133]
[0134]
[0135]
[0136]
[0137]
[0138]
[0139]
[0140]
[0141]
[0142]
[0143]
[0144]
[0145]
[0146]
[0147]
[0148]
[0149]
[0150]
[0151]
[0152]
[0153]
[0154]
[0155]
[0156]
[0157]
[0158]
[0159]
[0160]
[0161]
[0162]
[0163]
[0164]
[0165]
[0166]
[0167]
[0168]
[0169]
[0170]
[0171]
[0172]
[0173]
[0174]
[0175]
[0176]
[0177]
[0178]
[0179]
[0180]
[0181]
[0182]
[0183]
[0184]
[0185]
[0186]
[0187]
[0188]
[0189]
[0190]
[0191]
[0192]
[0193]
[0194]
[0195]
[0196]
[0197]
[0198]
/*****************************************************************************/
/*
                                  SSI.h
*/
/*****************************************************************************/

#ifndef SSI_H_LOADED
#define SSI_H_LOADED 1

#include "wasd.h"

/* essentially depth of if-else-endif nesting */
#define SSI_MAX_FLOW_CONTROL 8

#define SSI_INCLUDE_PART_MAX 63

/* things like #echo and #set */
#define SSI_STRING_SIZE 2048

/**************/
/* structures */
/**************/

#pragma __member_alignment __save
#pragma member_alignment

typedef struct SsiTaskStruct SSI_TASK;

struct SsiTaskStruct
{
   LIST_ENTRY  SsiTaskList;

   SSI_TASK  *ParentDocumentTaskPtr,
             *RootDocumentTaskPtr;

   BOOL  /* access to be expressed at "1st", "2nd", etc. */
         AccessOrdinal,
         /* indexed by 'FlowControlIndex', flow has executed */
         FlowControlHasExecuted [SSI_MAX_FLOW_CONTROL],
         /* indexed by 'FlowControlIndex', flow is executing */
         FlowControlIsExecuting [SSI_MAX_FLOW_CONTROL],
         /* currently inside an "<--#ssi" statement */
         InsideSsiStatement,
         /* OSU SSI? (detected via "OSU" in content description) */
         OsuCompliant,
         /* record format is fixed or undefined (don't add newlines) */
         RecordFormatFixed,
         /* stop processing the virtual document */
         StopProcessing,
         /* suppress blank lines result of flow control directive lines */
         SuppressLine,
         /* OSU-specific, tag verification */
         TagVerify,
         /* when tracing used to know when to insert carriage-control */
         TraceOutput,
         /* trace on or off */
         TraceState;

   int  /* number of time file accessed */
        AccessCount,
        /* attempt to make behaviour backward compatible */
        ComplianceLevel,
        /* */
        FileDetailsItem,
        /* line number currently being parsed (for error information) */
        LineNumber,
        /* index into flow-control nesting arrays */
        FlowControlIndex,
        /* buffer for logical value */
        OutputBufferEscapeHtml,
        /* note when a search-list has been searched for the file */
        SearchListCount,
        /* line number where current directive began */
        StatementLineNumber,
        /* length of SSI statement ;^) */
        StatementLength;
        
   int  /* indexed by 'FlowControlIndex', series of flow control states */
        FlowControlState [SSI_MAX_FLOW_CONTROL];

   int64  /* stores the latest RDT of files during "#modified" */
          LastModifiedTime64,
          /* source ssi file CDT */
          FileCdtTime64,
          /* source ssi file RDT */
          FileRdtTime64;

   char  /* character overwriten by the end-of-statement terminating null */
         TerminatedChar;

   char  /* scratch space */
         AccessSinceText [128],
         /* OSU-compliant #include part for current document */
         CurrentPart [SSI_INCLUDE_PART_MAX+1],
         /* OSU-compliant #include part for about-to-be included document */
         IncludePart [SSI_INCLUDE_PART_MAX+1],
         /* for #include, etc., file names */
         ScratchFileName [ODS_MAX_FILE_NAME_LENGTH+1],
         /* scratch space to hold a format string */
         FormatString [64],
         /* result of sys$parse(), values from, #include, #created, etc. */
         TheFileNameVar [ODS_MAX_FILE_NAME_LENGTH+1];

   char  /* points to the list of CGI variables */
         *CgiBufferPtr,
         /* string containing document depth number */
         *DocumentDepthPtr,
         /* root of document URI */
         *DocumentRootPtr,
         /* message string when generating an SSI error */
         *ErrMsgPtr,
         /* current character position when parsing the buffer */
         *ParsePtr,
         /* pointer to storage allocated for size format string */
         *SizeFmtPtr,
         /* start of "<!--" or "#" */
         *StatementBeginPtr,
         /* end at "-->" or next "#" */
         *StatementEndPtr,
         /* points to char overwriten by the end-of-statement null */
         *TerminatedPtr,
         /* pointer to storage allocated for time format string */
         *TimeFmtPtr;
                                    
   /* structure for ACP info */
   FILE_QIO  FileAcpData;

   /* structures for file access */
   ODS_STRUCT  DetailsOds;

   /* access counter does not need to be ODS-5 aware (no NAM block) */
   struct FAB  AccessFab;
   struct RAB  AccessRab;
   struct XABDAT  AccessXabDat;
   struct XABPRO  AccessXabPro;

   /* pointer to function, used for specifying the next task */
   REQUEST_AST  AccessAstFunction;

   /* user variable dictionary */
   DICT_STRUCT  *UserDictPtr;

   /* structure for receiving the file's contents in-memory */
   FILE_CONTENT  *FileContentPtr;
};

#pragma member_alignment __restore

/***********************/
/* function prototypes */
/***********************/

SsiAccessesClose (struct FAB*);
SsiAccessesConnectAst (struct RAB*);
SsiAccessesFileClosed (struct FAB*);
SsiAccessesGetAst (struct RAB*);
SsiAccessesOpen (REQUEST_STRUCT*);
SsiAccessesOpenAst (struct FAB*);
SsiAccessesOutput (REQUEST_STRUCT*);
SsiAccessesParseAst (struct FAB*);
SsiAccessesUpdateAst (struct RAB*);
SsiBegin (REQUEST_STRUCT*);
SsiDoAccesses (REQUEST_STRUCT*);
SsiDoDcl (REQUEST_STRUCT*);
SsiDoDir (REQUEST_STRUCT*);
SsiDoEcho (REQUEST_STRUCT*);
SsiDoElif (REQUEST_STRUCT*);
SsiDoElse (REQUEST_STRUCT*);
SsiDoEnd (REQUEST_STRUCT*);
SsiDoEndif (REQUEST_STRUCT*);
SsiDoIf (REQUEST_STRUCT*);
SsiDoInclude (REQUEST_STRUCT*);
SsiDoPrintEnv (REQUEST_STRUCT*);
SsiDoSet (REQUEST_STRUCT*);
SsiDoTrace (REQUEST_STRUCT*);
SsiEnd (REQUEST_STRUCT*);
SsiFileDetails (REQUEST_STRUCT*, int);
SsiFileDetailsParseAst (REQUEST_STRUCT*);
SsiFileDetailsAcpInfoAst (REQUEST_STRUCT*);
SsiGetFileSpec (REQUEST_STRUCT*, char*, char*, int);
SsiIncludeError (REQUEST_STRUCT*);
SsiNextRecord (REQUEST_STRUCT*);
SsiNextRecordAst (struct RAB*);
SsiParse (REQUEST_STRUCT*);
SsiProblem (REQUEST_STRUCT*, ...);
SsiStatement (REQUEST_STRUCT*);
SsiTraceGetVar (REQUEST_STRUCT*, char*, char*);
SsiTraceLine (REQUEST_STRUCT*, char*);
SsiTraceSetVar (REQUEST_STRUCT*, char*, char*);
char* SsiGetVar (REQUEST_STRUCT*, char*, char*, BOOL);
char* SsiGetCgiVar (REQUEST_STRUCT*, char*);
char* SsiGetServerVar (REQUEST_STRUCT*, char*, char*);
char* SsiGetUserVar (REQUEST_STRUCT*, char*);
int SsiTimeString (REQUEST_STRUCT*, ulong*, char*, char*, int);

#endif /* SSI_H_LOADED */

/*****************************************************************************/