C API Reference -- Ns_AdpRegisterParser

### Ns_AdpRegisterParser

#### Overview

Register a parser for ADPs

#### Syntax

        int Ns_AdpRegisterParser (
        char *name,
        Ns_AdpParserProc *newParserProc
        );

        typedef void (Ns_AdpParserProc)(Ns_DString *out, char *in);

#### Description

This registers a new ADP parser with the name "name". The newParserProc will be called when an ADP is to be parsed. The content of the ADP will be in the "in" parameter. The parser should parse it and append appropriate output into the "out" parameter.

The output should be formatted as a series of concatenated "chunks". A chunk is a string of the format:

        <type character><string><null>
    where:

    <type character> = 't' or 's'. A 't' means what follows is HTML and should be returneddirectly to the browser. An 's' means what follows is Tcl and should be evaluated.

After the last chunk there should be an extra <null> character. For example, the "adp" parser will take a page like this:

        This is a test page<%ns_puts hi%>The end<%ns_puts bye%>

And create this output:

        "tThis is a test page\0sns_puts hi\0tThe end\0sns_puts bye\0\0"

Top of Page
Copyright © 1998-99 America Online, Inc.