[ Previous ] [ Contents ] [ Index ] [ Next ]

Ns_AdpParseFp

Overview

Parse an ADP file by file pointer

Syntax

    int Ns_AdpParseFp(
        Ns_DString *pds, 
        Ns_Conn    *conn,
        char       *dir,
        char       *filename,
        FILE       *fp,
        int        *fStream,
        int        fAllowStreaming,
        time_t     mtime,
        off_t      size,
        int        argc,
        char       **argv,
        int        fGlobal
    );

Description

This function parses an ADP from a file, given only a file pointer. The file will be added to the ADP cache if possible, although no attempt will be made to see if it is already cached. If the file cannot be read, then NS_ERROR is returned. Otherwise, NS_OK is returned.

The pds argument is a pointer to a dstring where the output of the ADP will go.

The conn argument is the current connection.

The dir argument is the directory of the ADP. Any ns_adp_include Tcl commands in the ADP will be processed in this directory. You can pass NULL into the dir argument, and ns_adp_dir will return "", and ns_adp_include will resolve relative pathnames in the process' current working directory.

The filename argument is used for debugging purposes. The specified filename will be given when an error is generated during processing of the ADP. This filename is also used as the cache key.

The fp argument is the FILE pointer of the ADP, which must already be opened for reading.

The fStream argument is set to 1 if streaming has been turned on by the ADP and 0 if it has not.

If fAllowStreaming is 0, this function processes the ADP read from fp and writes the result to the passed in dstring (pds). If fAllowStreaming is non-zero, and the ADP contains a script that turns on streaming, the results are written directly out to the conn.

The mtime argument is the file's modification time. This value is needed for caching purposes.

The size argument is an estimate of the size of the file. This value is needed for caching purposes.

The argc argument is the number of arguments that are to be passed to the ADP.

The argv argument is a list of the argument values to be passed to the ADP.

If fGlobal is set to true, any Tcl commands run in the ADP will be run with Tcl_GlobalEval. If set to false, Tcl commands are run with Tcl_Eval.

If this call is a nested ADP evaluation (where one ADP calls another), an error will be returned if the maximum number of nested ADP evaluations, determined by the MaxCallDepth parameter, has been exceeded.

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1996 America Online, Inc.