Descent XML
An XML Parser Helper Library
Loading...
Searching...
No Matches
Typedefs | Functions | Variables
classifier.h File Reference
#include <stddef.h>
Include dependency graph for classifier.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void descent_xml_classifier_void_fn(void)
 
typedef descent_xml_classifier_void_fndescent_xml_classifier_fn(wchar_t input)
 

Functions

descent_xml_classifier_void_fndescent_xml_classifier_start (wchar_t input)
 

Variables

descent_xml_classifier_fn *const descent_xml_classifier_unexpected
 
descent_xml_classifier_fn *const descent_xml_classifier_eof
 

Detailed Description

This file defines a finite state machine, where each state is a function. The state takes an input character and returns a pointer to the next function in the state machine.

If a state receives an input it's not expecting, the descent_xml_classifier_unexpected state is returned. Check for this as an error value. Calling it is an error and will call abort().

If a state correctly reaches the end-of-file state, the descent_xml_classifier_eof state is returned. This means the state machine ran to completion correctly. Check for this to terminate your loop. Calling it is an error and will call abort().

Typedef Documentation

◆ descent_xml_classifier_fn

typedef descent_xml_classifier_void_fn * descent_xml_classifier_fn(wchar_t input)

Type definition for a classifier function.

A classifier function is a function receiving an input character and returning a pointer to the next classifier function.

◆ descent_xml_classifier_void_fn

typedef void descent_xml_classifier_void_fn(void)

Type definition for a "void function".

A pointer-to-void-function should be treated the same as a pointer-to-void: the only meaningful way to use it is to pass it as a parameter to something else, or to cast it to a more meaningful type.

Function Documentation

◆ descent_xml_classifier_start()

descent_xml_classifier_void_fn * descent_xml_classifier_start ( wchar_t  input)

Entry point for a script.

Expected to be fed the beginning of the file. This state will stay in this state for all whitespace encountered, until an element beginning '<' is encountered. If any other character is encountered, it returns descent_xml_classifier_unexpected.

Variable Documentation

◆ descent_xml_classifier_eof

descent_xml_classifier_fn* const descent_xml_classifier_eof
extern

Return value indicating the classifier function received an end-of-file (legitimately).

◆ descent_xml_classifier_unexpected

descent_xml_classifier_fn* const descent_xml_classifier_unexpected
extern

Error value, indicating the classifier function encountered an unexpected input.