Provided by: aolserver4-dev_4.5.1-16_amd64
Ns_AdpRegisterParser, Ns_AdpRequest - Create and use ADP parsers
#include "ns.h" int Ns_AdpRegisterParser(char *extension, Ns_AdpParserProc *newParserProc) int Ns_AdpRequest(arg, arg) _________________________________________________________________
These functions register new ADP parsers and run ADP requests. Ns_AdpRegisterParser(extension, newParserProc) Registers a new, named ADP parser procedure with the name given in extension. You can tie a file extension to a particular named parser in the nsd.tcl file. The newParserProc will be called when an ADP with the associated file extension needs to be parsed. If a file extension is registered as an ADP in the nsd.tcl but no parser is associated with that file extension, the default ADP parser is used. The newParserProc must accept two arguments: typedef void (Ns_AdpParserProc)(Ns_DString *out, char *in); The ADP input is pointed to by in. Your parser must process the content of in and append the parsed output to out. 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 returned directly 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" Ns_AdpRequest(conn, file) Parse and evaluate an ADP file.