Skip to content

Commit c116562

Browse files
authored
Merge pull request #609 from potassco/typo-fixes
minor fixes
2 parents 0ffd5d5 + d2e7a04 commit c116562

File tree

11 files changed

+33
-41
lines changed

11 files changed

+33
-41
lines changed

lib/c-api/include/clingo/ast.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_string(clingo_ast_t *ast
302302

303303
//! Get the value of a string array attribute.
304304
//!
305-
//! @note The the required size of the array can be queried setting value to NULL.
305+
//! @note The required size of the array can be queried setting value to NULL.
306306
//!
307307
//! @param[in] ast the target AST
308308
//! @param[in] attribute the target attribute
@@ -315,7 +315,7 @@ CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_string_array(clingo_ast_
315315

316316
//! Get the value of a symbol array attribute.
317317
//!
318-
//! @note The the required size of the array can be queried setting value to NULL.
318+
//! @note The required size of the array can be queried setting value to NULL.
319319
//!
320320
//! @param[in] ast the target AST
321321
//! @param[in] attribute the target attribute
@@ -363,7 +363,7 @@ CLINGO_VISIBILITY_DEFAULT char const *clingo_ast_type_info_yaml(void);
363363

364364
//! A callback to intercept ast's.
365365
//!
366-
//! @param[in] ast the paresd ast
366+
//! @param[in] ast the parsed ast
367367
//! @param[in] data the user data of the callback
368368
//! @return whether the call was successful
369369
typedef bool (*clingo_ast_callback_t)(clingo_ast_t *ast, void *data);
@@ -525,7 +525,7 @@ CLINGO_VISIBILITY_DEFAULT bool clingo_program_add(clingo_program_t *program, cli
525525

526526
//! @}
527527

528-
//! Extend the control objects's program with the given one.
528+
//! Extend the control object's program with the given one.
529529
//!
530530
//! After extending the logic program, the corresponding program parts are typically grounded with
531531
//! ::clingo_control_ground.

lib/c-api/include/clingo/base.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ typedef struct clingo_theory_base clingo_theory_base_t;
104104
//! @return whether the call was successful
105105
CLINGO_VISIBILITY_DEFAULT bool clingo_base_is_fact(clingo_base_t const *atoms, clingo_literal_t literal, bool *is_fact);
106106

107-
//! Check whether an literal is external.
107+
//! Check whether a literal is external.
108108
//!
109109
//! A literal is external if it has been defined using an external directive and
110110
//! has not been released or defined by a rule.
@@ -116,7 +116,7 @@ CLINGO_VISIBILITY_DEFAULT bool clingo_base_is_fact(clingo_base_t const *atoms, c
116116
CLINGO_VISIBILITY_DEFAULT bool clingo_base_is_external(clingo_base_t const *atoms, clingo_literal_t literal,
117117
bool *is_external);
118118

119-
//! Check whether an literal is shown.
119+
//! Check whether a literal is shown.
120120
//!
121121
//! A literal is shown if it has been shown by a show directive.
122122
//!
@@ -129,7 +129,7 @@ CLINGO_VISIBILITY_DEFAULT bool clingo_base_is_shown(clingo_base_t const *atoms,
129129

130130
//! Check whether a literal is subject to projection.
131131
//!
132-
//! An literal is subject to projection if it occurred in a project directive.
132+
//! A literal is subject to projection if it occurred in a project directive.
133133
//!
134134
//! @param[in] atoms the target
135135
//! @param[in] literal the index of the literal
@@ -277,7 +277,7 @@ CLINGO_VISIBILITY_DEFAULT bool clingo_term_base_symbol(clingo_term_base_t const
277277
//! of conjunctions.
278278
//!
279279
//! @param[in] terms the term base
280-
//! @param[in] index the index of the show diriective
280+
//! @param[in] index the index of the show directive
281281
//! @param[out] sizes the sizes of the conjunctions
282282
//! @param[out] literals the target literals
283283
//! @param[out] size the size of the disjunction
@@ -405,7 +405,7 @@ CLINGO_VISIBILITY_DEFAULT bool clingo_theory_base_element_to_string(clingo_theor
405405
//! @name Theory Atom Inspection
406406
//! @{
407407

408-
//! Get the total number of theory theory.
408+
//! Get the total number of theory atoms.
409409
//!
410410
//! @param[in] theory the target
411411
//! @param[out] size the resulting number

lib/c-api/include/clingo/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ CLINGO_VISIBILITY_DEFAULT bool clingo_config_value_get(clingo_config_t const *co
222222
CLINGO_VISIBILITY_DEFAULT bool clingo_config_value_set(clingo_config_t *config, clingo_id_t key, char const *value,
223223
size_t size);
224224

225-
//! Get the string representation of the given theory element.
225+
//! Get the string representation of the given configuration element.
226226
//!
227227
//! @param[in] config the target configuration
228228
//! @param[in] key the key

lib/c-api/include/clingo/control.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ enum clingo_mode_e {
4444
//! The corresponding type to ::clingo_mode_e.
4545
typedef int clingo_mode_t;
4646

47-
//! A map from constantns to their values.
47+
//! A map from constants to their values.
4848
typedef struct clingo_const_map clingo_const_map_t;
4949

5050
//! Get the constant with the given name.
@@ -58,10 +58,10 @@ typedef struct clingo_const_map clingo_const_map_t;
5858
CLINGO_VISIBILITY_DEFAULT bool clingo_const_map_find(clingo_const_map_t const *map, char const *name, size_t name_size,
5959
clingo_symbol_t *symbol, bool *found);
6060

61-
//! Get the name and value of the contstant at the given index.
61+
//! Get the name and value of the contestant at the given index.
6262
//!
6363
//! @param[in] map the target
64-
//! @param[in] index the index of the elemnt
64+
//! @param[in] index the index of the element
6565
//! @param[out] name the name of the constant
6666
//! @param[out] symbol the value of the constant
6767
//! @return whether the call was successful

lib/c-api/include/clingo/core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ CLINGO_VISIBILITY_DEFAULT void clingo_lib_acquire(clingo_lib_t *lib);
239239
//! @param[in] lib the target
240240
CLINGO_VISIBILITY_DEFAULT void clingo_lib_release(clingo_lib_t *lib);
241241

242-
//! Report a message via the libraries logger.
242+
//! Report a message via the library’s logger.
243243
//!
244244
//! @param[in] lib the library
245245
//! @param[in] code associated code

lib/c-api/include/clingo/observe.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <clingo/base.h>
55
#include <clingo/core.h>
66
#include <clingo/shared.h>
7-
#include <clingo/symbol.h>
87

98
#ifdef __cplusplus
109
extern "C" {

lib/c-api/include/clingo/solve.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ typedef unsigned clingo_solve_result_bitset_t;
6262

6363
//! Enumeration of solve modes.
6464
enum clingo_solve_mode_e {
65-
clingo_solve_mode_default = 0, //!< The defalut solve mode.
65+
clingo_solve_mode_default = 0, //!< The default solve mode.
6666
clingo_solve_mode_async = 1, //!< Enable non-blocking search.
6767
clingo_solve_mode_yield = 2, //!< Yield models in calls to clingo_solve_handle_model.
6868
clingo_solve_mode_lock = 4, //!< Ensure callbacks are executed in lock-step.
@@ -79,7 +79,7 @@ typedef struct clingo_solve_event_handler {
7979
//! @param goon whether to stop or continue
8080
//! @return whether the call was successful
8181
bool (*model)(clingo_model_t *model, void *data, bool *goon);
82-
//! Callback to interept lower bounds.
82+
//! Callback to intercept lower bounds.
8383
//!
8484
//! @param values the values of the current lower bound
8585
//! @param size the number of values in the lower bound

lib/c-api/include/clingo/theory.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ typedef struct clingo_theory {
126126
bool (*on_stats)(void *self, clingo_stats_t *stats);
127127
//! Get the integer index of a symbol assigned by the theory when a model is found.
128128
//!
129-
//! Using indices allows for efficent retrieval of values.
129+
//! Using indices allows for efficient retrieval of values.
130130
//!
131131
//! @param[in] self the self pointer
132132
//! @param[in] symbol the symbol to lookup
@@ -163,7 +163,7 @@ typedef struct clingo_theory {
163163
bool (*assignment_get_value)(void *self, uint32_t thread_id, size_t index, clingo_symbol_t *symbol,
164164
clingo_theory_value_t *value, bool *has_value);
165165

166-
//! The userdata for the first value to the callabcks in this struct.
166+
//! The userdata for the first value to the callbacks in this struct.
167167
void *self;
168168
} clingo_theory_t;
169169

lib/c-api/src/base.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -606,10 +606,8 @@ extern "C" auto clingo_theory_base_atom_guard(clingo_theory_base_t const *theory
606606
return fail_with(clingo_result_runtime, "guard expected");
607607
}
608608
auto str = std::string_view{get_theory(theory).getTerm(*guard).symbol()};
609-
if (connective != nullptr) {
610-
connective->data = str.data();
611-
connective->size = str.size();
612-
}
609+
connective->data = str.data();
610+
connective->size = str.size();
613611
}
614612
if (term != nullptr) {
615613
auto const *rhs = x.rhs();

lib/c-api/src/core.cc

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,20 @@ extern "C" auto clingo_lib_new(clingo_lib_flags_t flags, clingo_log_level_t leve
9393
void *data, size_t limit, clingo_lib_t **lib) -> bool {
9494
try {
9595
*lib = nullptr;
96-
struct LH {
97-
clingo_logger_t log;
98-
void *data;
99-
~LH() {
100-
if (log.free != nullptr) {
101-
log.free(data);
102-
}
103-
}
104-
};
105-
std::shared_ptr<LH> lh;
10696
CppClingo::Logger::Printer prt = nullptr;
107-
if (logger != nullptr) {
108-
lh = std::make_shared<LH>(*logger, data);
109-
if (logger->log != nullptr) {
110-
prt = [lh](CppClingo::MessageCode code, std::string_view msg) {
111-
lh->log.log(static_cast<clingo_message_t>(code), msg.data(), msg.size(), lh->data);
112-
};
113-
}
97+
if (logger != nullptr && logger->log != nullptr) {
98+
struct LH {
99+
clingo_logger_t log;
100+
void *data;
101+
~LH() {
102+
if (log.free != nullptr) {
103+
log.free(data);
104+
}
105+
}
106+
};
107+
prt = [lh = std::make_shared<LH>(*logger, data)](CppClingo::MessageCode code, std::string_view msg) {
108+
lh->log.log(static_cast<clingo_message_t>(code), msg.data(), msg.size(), lh->data);
109+
};
114110
}
115111
*lib = std::make_unique<clingo_lib>(CppClingo::Logger{std::move(prt), limit},
116112
CppClingo::make_symbol_store((flags & clingo_lib_flags_slotted) != 0,

0 commit comments

Comments
 (0)