/usr/include/cg3.h is in libcg3-dev 1.0.0~r12254-1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | /*
* Copyright (C) 2007-2017, GrammarSoft ApS
* Developed by Tino Didriksen <mail@tinodidriksen.com>
* Design by Eckhard Bick <eckhard.bick@mail.dk>, Tino Didriksen <mail@tinodidriksen.com>
*
* This file is part of VISL CG-3
*
* VISL CG-3 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VISL CG-3 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VISL CG-3. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef c6d28b7452ec699b_CG3_H
#define c6d28b7452ec699b_CG3_H
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void cg3_grammar;
typedef void cg3_applicator;
typedef void cg3_sentence;
typedef void cg3_cohort;
typedef void cg3_reading;
typedef void cg3_tag;
typedef enum {
CG3_ERROR = 0,
CG3_SUCCESS = 1
} cg3_status;
typedef enum {
CG3F_ORDERED = (1 << 0),
CG3F_UNSAFE = (1 << 1),
CG3F_NO_MAPPINGS = (1 << 2),
CG3F_NO_CORRECTIONS = (1 << 3),
CG3F_NO_BEFORE_SECTIONS = (1 << 4),
CG3F_NO_SECTIONS = (1 << 5),
CG3F_NO_AFTER_SECTIONS = (1 << 6),
CG3F_TRACE = (1 << 7),
CG3F_SINGLE_RUN = (1 << 8),
CG3F_ALWAYS_SPAN = (1 << 9),
CG3F_DEP_ALLOW_LOOPS = (1 << 10),
CG3F_DEP_NO_CROSSING = (1 << 11),
CG3F_NO_PASS_ORIGIN = (1 << 13)
} cg3_flags;
typedef enum {
CG3O_SECTIONS = 1,
CG3O_SECTIONS_TEXT = 2
} cg3_option;
// Default usage: if (!cg3_init(stdin, stdout, stderr)) { exit(1); }
cg3_status cg3_init(FILE *in, FILE *out, FILE *err);
// Default usage: cg3_cleanup();
cg3_status cg3_cleanup(void);
cg3_grammar *cg3_grammar_load(const char *filename);
void cg3_grammar_free(cg3_grammar *grammar);
cg3_applicator *cg3_applicator_create(cg3_grammar *grammar);
// Pass in OR'ed values from cg3_flags; each call resets flags, so set all needed ones in a single call.
void cg3_applicator_setflags(cg3_applicator *applicator, uint32_t flags);
/*
Valid signatures:
- cg3_applicator_setoption(aplc, CG3O_SECTIONS, uint32_t*);
Pointer to an uint32_t stating the max section to run; akin to --sections 6
- cg3_applicator_setoption(aplc, CG3O_SECTIONS_TEXT, const char*);
Pointer to cstring with ranges; akin to --sections "2,4-6,8-9"
//*/
void cg3_applicator_setoption(cg3_applicator *applicator, cg3_option option, void *value);
void cg3_applicator_free(cg3_applicator *applicator);
cg3_sentence *cg3_sentence_new(cg3_applicator *applicator);
cg3_sentence *cg3_sentence_copy(cg3_sentence *from, cg3_applicator *to);
void cg3_sentence_runrules(cg3_applicator *applicator, cg3_sentence *sentence);
// The Sentence takes ownership of the Cohort here.
void cg3_sentence_addcohort(cg3_sentence *sentence, cg3_cohort *cohort);
size_t cg3_sentence_numcohorts(cg3_sentence *sentence);
cg3_cohort *cg3_sentence_getcohort(cg3_sentence *sentence, size_t which);
void cg3_sentence_free(cg3_sentence *sentence);
cg3_cohort *cg3_cohort_create(cg3_sentence *sentence);
void cg3_cohort_setwordform(cg3_cohort *cohort, cg3_tag *wordform);
cg3_tag *cg3_cohort_getwordform(cg3_cohort *cohort);
uint32_t cg3_cohort_getid(cg3_cohort *cohort);
void cg3_cohort_setdependency(cg3_cohort *cohort, uint32_t dep_self, uint32_t dep_parent);
void cg3_cohort_getdependency(cg3_cohort *cohort, uint32_t *dep_self, uint32_t *dep_parent);
// The Cohort takes ownership of the Reading here.
void cg3_cohort_addreading(cg3_cohort *cohort, cg3_reading *reading);
size_t cg3_cohort_numreadings(cg3_cohort *cohort);
cg3_reading *cg3_cohort_getreading(cg3_cohort *cohort, size_t which);
// This is usually not to be used. The Sentence will take ownership of the Cohort and free it on destruction
void cg3_cohort_free(cg3_cohort *cohort);
cg3_reading *cg3_reading_create(cg3_cohort *cohort);
cg3_status cg3_reading_addtag(cg3_reading *reading, cg3_tag *tag);
size_t cg3_reading_numtags(cg3_reading *reading);
cg3_tag *cg3_reading_gettag(cg3_reading *reading, size_t which);
size_t cg3_reading_numtraces(cg3_reading *reading);
uint32_t cg3_reading_gettrace(cg3_reading *reading, size_t which);
// This is usually not to be used. The Cohort will take ownership of the Reading and free it on destruction
void cg3_reading_free(cg3_reading *reading);
cg3_reading *cg3_subreading_create(cg3_reading *reading);
// The Reading takes ownership of the Sub-Reading here.
cg3_status cg3_reading_setsubreading(cg3_reading *reading, cg3_reading *subreading);
size_t cg3_reading_numsubreadings(cg3_reading *reading);
cg3_reading *cg3_reading_getsubreading(cg3_reading *reading, size_t which);
// This is usually not to be used. The Reading will take ownership of the Sub-Reading and free it on destruction
void cg3_subreading_free(cg3_reading *subreading);
#ifdef U_ICU_VERSION_MAJOR_NUM
cg3_tag *cg3_tag_create_u(cg3_applicator *applicator, const UChar *text);
#endif
cg3_tag *cg3_tag_create_u8(cg3_applicator *applicator, const char *text);
cg3_tag *cg3_tag_create_u16(cg3_applicator *applicator, const uint16_t *text);
cg3_tag *cg3_tag_create_u32(cg3_applicator *applicator, const uint32_t *text);
cg3_tag *cg3_tag_create_w(cg3_applicator *applicator, const wchar_t *text);
#ifdef U_ICU_VERSION_MAJOR_NUM
const UChar *cg3_tag_gettext_u(cg3_tag *tag);
#endif
const char *cg3_tag_gettext_u8(cg3_tag *tag);
const uint16_t *cg3_tag_gettext_u16(cg3_tag *tag);
const uint32_t *cg3_tag_gettext_u32(cg3_tag *tag);
const wchar_t *cg3_tag_gettext_w(cg3_tag *tag);
// These 3 from Paul Meurer <paul.meurer@uni.no>
size_t cg3_cohort_numdelreadings(cg3_cohort *cohort);
cg3_reading *cg3_cohort_getdelreading(cg3_cohort *cohort, size_t which);
size_t cg3_reading_gettrace_ruletype(cg3_reading *reading_, size_t which);
#ifdef __cplusplus
}
#endif
#endif
|