Files in directory pending/sandbox/bibtex from the latest check-in of branch trunk
- archive
- examples
- src
- test
- assemble_header.tcl
- bibtex.h
- CMakeLists.txt
- Makefile
- README.md
BibTeX Parser
Simple, singler-header (bibtex.h) BibTeX file parser. The header file includes documentation and usage examples.
Limitations
For simplicity this library avoids string allocation and copying whenever possible, as a result of this it has the following limitations (most of which can be handled by clients of this library):
- Does not trim spaces or newlines on string entries.
- Does not process brackets embedded in string entries.
Usage
#include <stdio.h>
#define BIBTEX_INCLUDE_IMPLEMENTATION
#include "bibtex.h"
int
main(int argc, char** argv)
{
Bibtex_Entry *entry;
Bibtex_Reader reader;
Bibtex_Result *result;
result = bibtex_reader_load_file(&reader, argv[1]);
if (result->error)
{
fprintf(stderr, "error: %s\n", result->message);
return(1);
}
while (bibtex_reader_is_valid(&reader))
{
result = bibtex_reader_next(&reader, &entry);
if (result->error)
{
fprintf(stderr, "error: %s\n", result->message);
return(1);
}
if (entry != NULL)
{
/* do something with the next bibtex entry */
}
}
bibtex_reader_destroy(&reader);
return(0);
}