LibDocument

image-alt

Document and Trie Processing.


document.h

Version: 0.1.1

Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016 CODAMONO, Ontario, Canada
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at: http://mozilla.org/MPL/2.0/
7  */
8 
62 #ifndef __ldoc__document__
63 #define __ldoc__document__
64 
65 #include <stdbool.h>
66 #include <stdint.h>
67 #include <stdio.h>
68 #include <stdlib.h>
69 #include <string.h>
70 #include <sys/queue.h>
71 
72 #ifndef LDOC_NOPYTHON
73 #include <Python.h>
74 #endif // #ifndef LDOC_NOPYTHON
75 
76 #include "trie.h"
77 
78 #ifdef __cplusplus
79 extern "C" {
80 #endif
81 
82 #define LDOC_QSTK_FULL(qstk) (qstk->wptr + 1) % qstk->max == qstk->rptr
83 #define LDOC_QSTK_NDE_ADDR(qstk, n) sizeof(ldoc_nde_t*) * (n)
84 
91 typedef enum
92 {
121 } ldoc_struct_t;
122 
130 typedef enum
131 {
153 
159 typedef struct ldoc_raw_t
160 {
164  uint8_t* pld;
168  uint64_t len;
169 } ldoc_raw_t;
170 
176 typedef union
177 {
181  bool bl;
185  char* str;
191 
197 typedef struct ldoc_doc_anno_t
198 {
208 
209 #ifndef LDOC_NOPYTHON
210 
218 typedef struct ldoc_py_t
219 {
223  PyObject* dtm;
227  PyObject* anno;
228 } ldoc_py_t;
229 
230 #endif // #ifndef LDOC_NOPYTHON
231 
237 typedef union
238 {
242  bool bl;
246  char* str;
255 #ifndef LDOC_NOPYTHON
256 
260 #endif // #ifndef LDOC_NOPYTHON
261 } ldoc_pld_t;
262 
268 typedef enum
269 {
298 } ldoc_serpld_t;
299 
305 typedef struct ldoc_ser_t
306 {
315 } ldoc_ser_t;
316 
328 typedef struct ldoc_nde_t
329 {
333  struct ldoc_nde_t* prnt;
345  uint32_t lpth;
349  uint32_t ent_cnt;
353  uint32_t dsc_cnt;
357  TAILQ_HEAD(ldoc_nde_list, ldoc_nde_t) dscs;
361  TAILQ_HEAD(ldoc_ent_list, ldoc_ent_t) ents;
365  TAILQ_ENTRY(ldoc_nde_t) ldoc_nde_entries;
366 } ldoc_nde_t;
367 
374 typedef struct ldoc_nde_qstk_t
375 {
379  size_t rptr;
383  size_t wptr;
387  size_t max;
391  size_t inc;
397 
409 typedef struct ldoc_ent_t
410 {
426  TAILQ_ENTRY(ldoc_ent_t) ldoc_ent_entries;
427 } ldoc_ent_t;
428 
432 typedef struct ldoc_doc_t
433 {
438 } ldoc_doc_t;
439 
446 typedef struct ldoc_pos_t
447 {
455  uint64_t nde_off;
459  uint64_t off;
460 } ldoc_pos_t;
461 
465 typedef union
466 {
469 } ldoc_info_t;
470 
474 typedef struct ldoc_res_t
475 {
476  bool nde;
478 } ldoc_res_t;
479 
486 typedef struct ldoc_coord_t
487 {
491  uint32_t lvl;
495  uint32_t pln;
496 } ldoc_coord_t;
497 
505 typedef struct ldoc_vis_nde_t
506 {
510  ldoc_ser_t* (*vis_rt)(ldoc_nde_t* nde, ldoc_coord_t* coord);
514  ldoc_ser_t* (*vis_ua)(ldoc_nde_t* nde, ldoc_coord_t* coord);
518  ldoc_ser_t* (*vis_par)(ldoc_nde_t* nde, ldoc_coord_t* coord);
522  ldoc_ser_t* (*vis_ul)(ldoc_nde_t* nde, ldoc_coord_t* coord);
526  ldoc_ser_t* (*vis_ol)(ldoc_nde_t* nde, ldoc_coord_t* coord);
530  ldoc_ser_t* (*vis_anc)(ldoc_nde_t* nde, ldoc_coord_t* coord);
534  ldoc_ser_t* (*vis_nn)(ldoc_nde_t* nde, ldoc_coord_t* coord);
538  ldoc_ser_t* (*vis_oo)(ldoc_nde_t* nde, ldoc_coord_t* coord);
542  ldoc_ser_t* (*vis_h1)(ldoc_nde_t* nde, ldoc_coord_t* coord);
546  ldoc_ser_t* (*vis_h2)(ldoc_nde_t* nde, ldoc_coord_t* coord);
550  ldoc_ser_t* (*vis_h3)(ldoc_nde_t* nde, ldoc_coord_t* coord);
554  ldoc_ser_t* (*vis_h4)(ldoc_nde_t* nde, ldoc_coord_t* coord);
558  ldoc_ser_t* (*vis_h5)(ldoc_nde_t* nde, ldoc_coord_t* coord);
562  ldoc_ser_t* (*vis_h6)(ldoc_nde_t* nde, ldoc_coord_t* coord);
564 
568 typedef struct ldoc_vis_nde_ord_t
569 {
573  ldoc_ser_t* (*vis_setup)(void);
577  ldoc_ser_t* (*vis_teardown)(void);
591 
599 typedef struct ldoc_vis_ent_t
600 {
604  ldoc_ser_t* (*vis_bl)(ldoc_nde_t* nde, ldoc_ent_t* ent, ldoc_coord_t* coord);
608  ldoc_ser_t* (*vis_br)(ldoc_nde_t* nde, ldoc_ent_t* ent, ldoc_coord_t* coord);
612  ldoc_ser_t* (*vis_em1)(ldoc_nde_t* nde, ldoc_ent_t* ent, ldoc_coord_t* coord);
616  ldoc_ser_t* (*vis_em2)(ldoc_nde_t* nde, ldoc_ent_t* ent, ldoc_coord_t* coord);
620  ldoc_ser_t* (*vis_uri)(ldoc_nde_t* nde, ldoc_ent_t* ent, ldoc_coord_t* coord);
624  ldoc_ser_t* (*vis_ref)(ldoc_nde_t* nde, ldoc_ent_t* ent, ldoc_coord_t* coord);
628  ldoc_ser_t* (*vis_num)(ldoc_nde_t* nde, ldoc_ent_t* ent, ldoc_coord_t* coord);
632  ldoc_ser_t* (*vis_nr)(ldoc_nde_t* nde, ldoc_ent_t* ent, ldoc_coord_t* coord);
636  ldoc_ser_t* (*vis_or)(ldoc_nde_t* nde, ldoc_ent_t* ent, ldoc_coord_t* coord);
640  ldoc_ser_t* (*vis_txt)(ldoc_nde_t* nde, ldoc_ent_t* ent, ldoc_coord_t* coord);
642 
646 extern ldoc_doc_t* LDOC_DOC_NULL;
650 extern ldoc_ser_t* LDOC_SER_NULL;
654 extern ldoc_pos_t* LDOC_POS_NULL;
658 extern ldoc_nde_t* LDOC_NDE_NULL;
662 extern ldoc_ent_t* LDOC_ENT_NULL;
666 extern ldoc_res_t* LDOC_RES_NULL;
671 
672 #ifndef LDOC_NOPYTHON
673 
682 char* ldoc_py2str(PyObject* obj);
683 
692 ldoc_doc_t* ldoc_pydict2doc(PyObject* dict);
693 
694 #endif // #ifndef LDOC_NOPYTHON
695 
703 
709 void ldoc_ser_free(ldoc_ser_t* ser);
710 
717 
724 
731 
737 void ldoc_vis_ent_free(ldoc_vis_ent_t* vis_ent);
738 
745 void ldoc_vis_nde_uni(ldoc_vis_nde_t* vis, ldoc_ser_t* (*vis_uni)(ldoc_nde_t* nde, ldoc_coord_t* coord));
746 
753 void ldoc_vis_ent_uni(ldoc_vis_ent_t* vis, ldoc_ser_t* (*vis_uni)(ldoc_nde_t* nde, ldoc_ent_t* ent, ldoc_coord_t* coord));
754 
763 ldoc_pos_t* ldoc_pos_new(ldoc_nde_t* nde, uint64_t nde_off, uint64_t off);
764 
770 void ldoc_pos_free(ldoc_pos_t* pos);
771 
778 
784 void ldoc_doc_free(ldoc_doc_t* doc);
785 
793 
801 void ldoc_ent_free(ldoc_ent_t* ent);
802 
810 
818 void ldoc_nde_free(ldoc_nde_t* nde);
819 
826 void ldoc_nde_ent_push(ldoc_nde_t* nde, ldoc_ent_t* ent);
827 
837 
841 void ldoc_nde_ent_shift(ldoc_nde_t* nde, ldoc_ent_t* ent);
842 
852 
861 void ldoc_nde_ent_ins(ldoc_ent_t* ent, ldoc_ent_t* ent_ref);
862 
868 void ldoc_ent_rm(ldoc_ent_t* ent);
869 
876 void ldoc_nde_dsc_push(ldoc_nde_t* nde, ldoc_nde_t* dsc);
877 
887 
891 void ldoc_nde_dsc_shift(ldoc_nde_t* nde, ldoc_nde_t* dsc);
892 
902 
911 void ldoc_nde_dsc_ins(ldoc_nde_t* dsc, ldoc_nde_t* nde_ref);
912 
918 void ldoc_nde_rm(ldoc_nde_t* nde);
919 
928 uint16_t ldoc_nde_lvl(ldoc_nde_t* nde);
929 
939 
947 
962 ldoc_res_t* ldoc_find_anno_ent(ldoc_nde_t* nde, char* leaf);
963 
980 ldoc_res_t* ldoc_find_anno_nde(ldoc_nde_t* nde, char** pth, size_t plen);
981 
998 ldoc_res_t* ldoc_find_anno(ldoc_doc_t* doc, char** pth, size_t plen);
999 
1005 void ldoc_res_free(ldoc_res_t* res);
1006 
1025 ldoc_pos_t* ldoc_find_pos(ldoc_doc_t* doc, uint64_t off);
1026 
1040 ldoc_pos_t* ldoc_find_kw(ldoc_doc_t* doc, uint64_t off, char* str);
1041 
1042 //
1043 // HTML
1044 //
1045 
1052 
1059 
1068 
1077 
1086 
1096 
1097 //
1098 // JSON
1099 //
1100 
1107 
1114 
1123 
1132 
1141 
1151 
1152 //
1153 // Python
1154 //
1155 
1162 
1169 
1178 
1187 
1196 
1206 
1207 #ifdef __cplusplus
1208 } /* extern "C" */
1209 #endif
1210 
1211 #endif /* defined(__ldoc__document__) */
ldoc_ser_t * ldoc_vis_nde_pre_py(ldoc_nde_t *nde, ldoc_coord_t *coord)
Node visitor for Python object serialization (prefix traversal).
A "header 6", sixth largest header, smallest header.
Definition: document.h:108
Definition: document.h:281
void ldoc_nde_free(ldoc_nde_t *nde)
Deletes a node, its associated entities, and its descendant nodes.
uint64_t nde_off
Definition: document.h:455
ldoc_nde_t * LDOC_NDE_NULL
Null pointer for node objects.
Most general entity type; plain text.
Definition: document.h:133
ldoc_ent_t * ent
Definition: document.h:468
A "boolean reference" (for example, "citation": true).
Definition: document.h:147
ldoc_struct_t tpe
Definition: document.h:337
void ldoc_vis_ent_free(ldoc_vis_ent_t *vis_ent)
Frees the memory of an entity visitor object.
Payload data types for datums.
Definition: document.h:237
ldoc_pos_t * ldoc_find_pos(ldoc_doc_t *doc, uint64_t off)
Given a null-based cursor position that is counted from the beginning of a document, returns the document node and offset within the node that entails the cursor position.
Entity or node returned by a search for a specific annotation.
Definition: document.h:474
void ldoc_vis_ent_uni(ldoc_vis_ent_t *vis, ldoc_ser_t *(*vis_uni)(ldoc_nde_t *nde, ldoc_ent_t *ent, ldoc_coord_t *coord))
Uniformly populates an entity visitor object with a single visitor function.
Definition: document.h:297
A "named node".
Definition: document.h:118
ldoc_nde_t * nde
Definition: document.h:451
void ldoc_nde_dsc_ins(ldoc_nde_t *dsc, ldoc_nde_t *nde_ref)
Insert a node before another entity in a node's descendant list.
uint32_t pln
Definition: document.h:495
ldoc_raw_t raw
Definition: document.h:250
ldoc_vis_nde_t post
Definition: document.h:589
void ldoc_ser_free(ldoc_ser_t *ser)
Frees the memory of a serialization object.
ldoc_anno_pld_t dtm
Definition: document.h:202
TAILQ_ENTRY(ldoc_nde_t) ldoc_nde_entries
struct ldoc_raw_t ldoc_raw_t
Raw data structure (payload pointer and data length).
ldoc_ent_t * ldoc_nde_ent_pop(ldoc_nde_t *nde)
Remove an entity at the end of a node's entity list.
char * str
Definition: document.h:246
ldoc_nde_t * ldoc_nde_dsc_unshift(ldoc_nde_t *nde)
Remove a node from the beginning of a node's descendant list.
char * ldoc_py2str(PyObject *obj)
Returns a string representation of a Python object (Python call "str(obj)").
ldoc_ser_t * ldoc_vis_nde_infx_html(ldoc_nde_t *nde, ldoc_coord_t *coord)
Node visitor for HTML serialization (infix traversal).
ldoc_pos_t * LDOC_POS_NULL
Null pointer for cursor objects.
size_t wptr
Definition: document.h:383
A "boolean"; truth value.
Definition: document.h:145
ldoc_content_t tpe
Definition: document.h:418
Emphasized text (type 2 of 2).
Definition: document.h:137
void ldoc_pos_free(ldoc_pos_t *pos)
Definition: document.h:285
void ldoc_ent_free(ldoc_ent_t *ent)
Frees the memory of an entity object.
ldoc_doc_t * LDOC_DOC_NULL
Null pointer for document objects.
A node visitor object calls the given visitor functions based on node type.
Definition: document.h:505
ldoc_ser_t * ldoc_vis_nde_post_html(ldoc_nde_t *nde, ldoc_coord_t *coord)
Node visitor for HTML serialization (postfix traversal).
ldoc_vis_nde_t infx
Definition: document.h:585
ldoc_ser_t * ldoc_vis_ent_html(ldoc_nde_t *nde, ldoc_ent_t *ent, ldoc_coord_t *coord)
Entity visitor for HTML serialization.
Document structure.
Definition: document.h:432
A "number"; integer, real, or floating point.
Definition: document.h:143
bool bl
Definition: document.h:181
Serialization data structure.
Definition: document.h:305
Definition: document.h:293
An "unassigned" node type; for use when no other node type fits.
Definition: document.h:96
A "reference", points to an anchor node (LDOC_NDE_ANC).
Definition: document.h:141
Coordinate with in a document.
Definition: document.h:486
ldoc_struct_t
Node types denoting the document content hierarchy and atomic concepts.
Definition: document.h:91
An "anchor" within a document that is named by a single entity; linked to by a reference entity (LDOC...
Definition: document.h:116
void ldoc_ent_rm(ldoc_ent_t *ent)
Remove an entity from a document tree.
ldoc_ser_t * ldoc_vis_teardown_py(void)
Setup for Python object serialization.
ldoc_ser_t * ldoc_vis_ent_py(ldoc_nde_t *nde, ldoc_ent_t *ent, ldoc_coord_t *coord)
Entity visitor for Python object serialization.
ldoc_doc_anno_t pair
Definition: document.h:254
ldoc_nde_t * ldoc_nde_dsc_pop(ldoc_nde_t *nde)
Remove a node at the end of a node's descendant list.
void ldoc_nde_rm(ldoc_nde_t *nde)
Remove a node and its descendants from a document tree.
Document annotations (payloads of datum and annotation assignments).
Definition: document.h:197
ldoc_nde_t ** nds
Definition: document.h:395
struct ldoc_pos_t ldoc_pos_t
A cursor position within a node.
A "header 2", second largest header.
Definition: document.h:100
ldoc_pos_t * ldoc_pos_new(ldoc_nde_t *nde, uint64_t nde_off, uint64_t off)
Creates a new position object.
struct ldoc_coord_t ldoc_coord_t
Coordinate with in a document.
ldoc_ser_t * ldoc_vis_nde_post_json(ldoc_nde_t *nde, ldoc_coord_t *coord)
Node visitor for JSON serialization (postfix traversal).
ldoc_doc_anno_t LDOC_ANNO_NULL
Null pointer for annotation objects.
An "ordered list".
Definition: document.h:114
ldoc_ser_t * ldoc_vis_setup_html(void)
Setup for HTML serialization.
void ldoc_doc_free(ldoc_doc_t *doc)
Releases all allocated memory of a document (including nodes and entities).
ldoc_ser_t * ldoc_vis_nde_post_py(ldoc_nde_t *nde, ldoc_coord_t *coord)
Node visitor for Python object serialization (postfix traversal).
ldoc_serpld_t tpe
Definition: document.h:310
ldoc_ser_t * ldoc_vis_nde_pre_json(ldoc_nde_t *nde, ldoc_coord_t *coord)
Node visitor for JSON serialization (prefix traversal).
Document entity: a concrete piece of data that is part of a document.
Definition: document.h:409
struct ldoc_nde_qstk_t ldoc_nde_qstk_t
Node quick-stack for efficiently handing node allocations/deallocations.
uint64_t off
Definition: document.h:459
ldoc_ent_t * ldoc_ent_new(ldoc_content_t tpe)
Creates a new entity object.
ldoc_res_t * ldoc_find_anno(ldoc_doc_t *doc, char **pth, size_t plen)
Find a node or entity in a document based on a given search path.
PyObject * dtm
Definition: document.h:223
A "header 1", top-most header, largest header.
Definition: document.h:98
uint32_t lvl
Definition: document.h:491
ldoc_serpld_t
Serialization payload types.
Definition: document.h:268
ldoc_py_t py
Definition: document.h:259
void ldoc_vis_nde_ord_free(ldoc_vis_nde_ord_t *vis_nde)
Frees the memory of a node visitor object.
A "numbered reference" (for example, "citation": 12).
Definition: document.h:149
ldoc_content_t
Entity types denoting sequentially ordered, but essentially "flat", node contents.
Definition: document.h:130
struct ldoc_doc_anno_t ldoc_doc_anno_t
Document annotations (payloads of datum and annotation assignments).
void ldoc_vis_nde_uni(ldoc_vis_nde_t *vis, ldoc_ser_t *(*vis_uni)(ldoc_nde_t *nde, ldoc_coord_t *coord))
Uniformly populates a node visitor object with a single visitor function.
void ldoc_nde_ent_ins(ldoc_ent_t *ent, ldoc_ent_t *ent_ref)
Insert an entity before another entity in a node's entity list.
ldoc_nde_t * rt
Definition: document.h:437
ldoc_pld_t pld
Definition: document.h:314
An "ontology object"; resolves ontology references (LDOC_ENT_OR).
Definition: document.h:120
ldoc_ent_t * ldoc_nde_ent_unshift(ldoc_nde_t *nde)
Remove an entity from the beginning of a node's entity list.
ldoc_res_t * ldoc_find_anno_ent(ldoc_nde_t *nde, char *leaf)
Find an entity object based on its annotation.
struct ldoc_vis_ent_t ldoc_vis_ent_t
An entity visitor object calls the given visitor functions based on entity type.
Raw data structure (payload pointer and data length).
Definition: document.h:159
struct ldoc_ser_t ldoc_ser_t
Serialization data structure.
ldoc_nde_t * prnt
Definition: document.h:414
Functions and data structures for CRUD operations on tries (prefix trees).
struct ldoc_py_t ldoc_py_t
Python representation of ldoc_doc_anno_t.
ldoc_info_t info
Definition: document.h:477
ldoc_vis_nde_t pre
Definition: document.h:581
An "ontology reference"; base determined by an ontology object node (LDOC_NDE_OO).
Definition: document.h:151
TAILQ_HEAD(ldoc_nde_list, ldoc_nde_t) dscs
size_t max
Definition: document.h:387
ldoc_ent_t * LDOC_ENT_NULL
Null pointer for entity objects.
ldoc_ser_t * ldoc_vis_teardown_html(void)
Teardown for HTML serialization.
ldoc_nde_t * ldoc_nde_new(ldoc_struct_t tpe)
Creates a new node object.
Ordered visitor structure for setting up serialization, tearing it down, and pre-, in-, and postfix visits.
Definition: document.h:568
uint16_t ldoc_nde_lvl(ldoc_nde_t *nde)
Returns the level at which a node is located at.
uint32_t dsc_cnt
Definition: document.h:353
ldoc_ser_t * ldoc_vis_nde_infx_json(ldoc_nde_t *nde, ldoc_coord_t *coord)
Node visitor for JSON serialization (infix traversal).
PyObject * anno
Definition: document.h:227
ldoc_anno_pld_t anno
Definition: document.h:206
void ldoc_res_free(ldoc_res_t *res)
Frees a result object.
ldoc_raw_t raw
Definition: document.h:189
bool bl
Definition: document.h:242
char * str
Definition: document.h:185
struct ldoc_vis_nde_ord_t ldoc_vis_nde_ord_t
Ordered visitor structure for setting up serialization, tearing it down, and pre-, in-, and postfix visits.
ldoc_ser_t * ldoc_vis_setup_json(void)
Setup for JSON serialization.
Definition: document.h:289
Payload data types for annotations.
Definition: document.h:176
Definition: document.h:273
ldoc_vis_ent_t * ldoc_vis_ent_new()
Allocates a new entity visitor object.
ldoc_ser_t * ldoc_vis_nde_infx_py(ldoc_nde_t *nde, ldoc_coord_t *coord)
Node visitor for Python object serialization (infix traversal).
ldoc_nde_t * nde
Definition: document.h:467
ldoc_doc_t * ldoc_pydict2doc(PyObject *dict)
Turns a Python dictionary into a LibDocument document.
A document node.
Definition: document.h:328
ldoc_ser_t * ldoc_vis_teardown_json(void)
Teardown for JSON serialization.
ldoc_res_t * ldoc_find_anno_nde(ldoc_nde_t *nde, char **pth, size_t plen)
Find a node or entity based on a given search path.
uint32_t lpth
Definition: document.h:345
An entity visitor object calls the given visitor functions based on entity type.
Definition: document.h:599
Node quick-stack for efficiently handing node allocations/deallocations.
Definition: document.h:374
struct ldoc_doc_t ldoc_doc_t
Document structure.
size_t rptr
Definition: document.h:379
void ldoc_nde_dsc_shift(ldoc_nde_t *nde, ldoc_nde_t *dsc)
Add an entity to the beginning of a node's descendant list.
ldoc_res_t * LDOC_RES_NULL
Null pointer for result objects.
A "header 3", third largest header.
Definition: document.h:102
ldoc_pld_t pld
Definition: document.h:422
ldoc_ser_t * ldoc_format(ldoc_doc_t *doc, ldoc_vis_nde_ord_t *vis_nde, ldoc_vis_ent_t *vis_ent)
Formats (serializes) a document using a set of node and entity visitors.
ldoc_ser_t * ldoc_vis_nde_pre_html(ldoc_nde_t *nde, ldoc_coord_t *coord)
Node visitor for HTML serialization (prefix traversal).
Definition: document.h:277
Information carrying types in a document: nodes and entities.
Definition: document.h:465
uint8_t * pld
Definition: document.h:164
A cursor position within a node.
Definition: document.h:446
A "header 4", fourth largest header.
Definition: document.h:104
An "unordered list".
Definition: document.h:112
struct ldoc_vis_nde_t ldoc_vis_nde_t
A node visitor object calls the given visitor functions based on node type.
ldoc_doc_t * ldoc_doc_new()
Create a new document.
A node that denotes a "paragraph".
Definition: document.h:110
ldoc_pos_t * ldoc_find_kw(ldoc_doc_t *doc, uint64_t off, char *str)
Given a null-based cursor position that is counted from the beginning of a document as well as a sear...
uint32_t ent_cnt
Definition: document.h:349
ldoc_ser_t * ldoc_vis_ent_json(ldoc_nde_t *nde, ldoc_ent_t *ent, ldoc_coord_t *coord)
Entity visitor for JSON serialization.
ldoc_ser_t * ldoc_vis_setup_py(void)
Setup for Python object serialization.
Python representation of ldoc_doc_anno_t.
Definition: document.h:218
struct ldoc_res_t ldoc_res_t
Entity or node returned by a search for a specific annotation.
A "header 5", fifth largest header .
Definition: document.h:106
void ldoc_nde_dsc_push(ldoc_nde_t *nde, ldoc_nde_t *dsc)
Add a node to the end of a node's descendant list.
bool nde
Definition: document.h:476
Emphasized text (type 1 of 2).
Definition: document.h:135
void ldoc_nde_ent_push(ldoc_nde_t *nde, ldoc_ent_t *ent)
Add an entity to the end of a node's entity list.
An arbitrary URI.
Definition: document.h:139
Document "root", cannot be instantiated manually.
Definition: document.h:94
ldoc_ser_t * ldoc_ser_new(ldoc_serpld_t tpe)
Allocates a new serialization object.
ldoc_ser_t * ldoc_format_json(ldoc_doc_t *doc)
Format a document as an object in JSON.
ldoc_ser_t * LDOC_SER_NULL
Null pointer for serialization objects.
struct ldoc_nde_t * prnt
Definition: document.h:333
ldoc_vis_nde_ord_t * ldoc_vis_nde_ord_new()
Allocates a new node visitor object.
void ldoc_nde_ent_shift(ldoc_nde_t *nde, ldoc_ent_t *ent)
Add an entity to the beginning of a node's entity list.
uint64_t len
Definition: document.h:168
size_t inc
Definition: document.h:391
ldoc_doc_anno_t mkup
Definition: document.h:341