BibTeXq
query a bibtex file
|
Definitions for a BIBTEX entry data type. More...
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include "bibtex_entry.h"
Go to the source code of this file.
Functions | |
static void | remove_extra_spaces (char *str) |
Removes extra spaces, newlines, and tabs from a string. | |
static void | create_bibtex_field (Bibtex_field **field_out, const char *name, const char *value) |
Creates a Bibtex_field. | |
static void | free_bibtex_fields (Bibtex_field **fields, uint32_t num_fields) |
Frees an array of Bibtex_field. | |
void | create_bibtex_entry (Bibtex_entry **entry_out, const char *type, const char *key) |
Creates a Bibtex_entry. | |
void | free_bibtex_entry (Bibtex_entry *entry) |
Frees a Bibtex_entry. | |
void | add_field_to_bibtex_entry (Bibtex_entry *entry, const char *name, const char *value) |
Adds a field to a Bibtex_entry. | |
void | write_bibtex_entry (Bibtex_entry *entry, FILE *fp) |
Writes a Bibtex_entry to a file stream. |
Definitions for a BIBTEX entry data type.
Definition in file bibtex_entry.c.
static void remove_extra_spaces | ( | char * | str | ) | [static] |
Removes extra spaces, newlines, and tabs from a string.
Definition at line 63 of file bibtex_entry.c.
static void create_bibtex_field | ( | Bibtex_field ** | field_out, |
const char * | name, | ||
const char * | value | ||
) | [static] |
Creates a Bibtex_field.
Removes duplicate spaces, newlines, and tabs from the copies of name and value that are put in the created field.
field_out | Result parameter. If *field_out is NULL, a Bibtex_field is allocated; otherwise its space is re-used. |
name | Name of the field. |
value | Value of the field. |
Definition at line 134 of file bibtex_entry.c.
static void free_bibtex_fields | ( | Bibtex_field ** | fields, |
uint32_t | num_fields | ||
) | [static] |
Frees an array of Bibtex_field.
Frees each Bibtex_field in the array and the array of field pointers.
fields | Array to free. |
num_fields | Number of fields in the array. |
Definition at line 169 of file bibtex_entry.c.
void create_bibtex_entry | ( | Bibtex_entry ** | entry_out, |
const char * | type, | ||
const char * | key | ||
) |
Creates a Bibtex_entry.
If *entry_out is not NULL, then the Bibtex_entry::num_used_fields is set to 0.
entry_out | Result parameter. If *entry_out is NULL, a Bibtex_entry is allocated; otherwise its space is re-used. |
type | Type of entry. |
key | Unique entry key. |
Definition at line 199 of file bibtex_entry.c.
void free_bibtex_entry | ( | Bibtex_entry * | entry | ) |
Frees a Bibtex_entry.
entry | Bibtex_entry to free. |
Definition at line 232 of file bibtex_entry.c.
void add_field_to_bibtex_entry | ( | Bibtex_entry * | entry, |
const char * | name, | ||
const char * | value | ||
) |
Adds a field to a Bibtex_entry.
entry | Bibtex_entry to add the field to. |
name | Field name. |
value | Field value. |
Definition at line 251 of file bibtex_entry.c.
void write_bibtex_entry | ( | Bibtex_entry * | entry, |
FILE * | fp | ||
) |
Writes a Bibtex_entry to a file stream.
entry | Bibtex_entry to write. |
fp | File string to write to. |
Definition at line 281 of file bibtex_entry.c.