mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 19:42:50 -06:00
gu_string_buf -> gu_new_string_buf in libgu
This commit is contained in:
@@ -50,7 +50,7 @@ gu_string_buf_end(GuOutStream* stream, size_t sz, GuExn* err)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GuStringBuf*
|
GuStringBuf*
|
||||||
gu_string_buf(GuPool* pool)
|
gu_new_string_buf(GuPool* pool)
|
||||||
{
|
{
|
||||||
GuStringBuf* sbuf = gu_new(GuStringBuf, pool);
|
GuStringBuf* sbuf = gu_new(GuStringBuf, pool);
|
||||||
sbuf->stream.output = gu_string_buf_output;
|
sbuf->stream.output = gu_string_buf_output;
|
||||||
@@ -152,7 +152,7 @@ GuString
|
|||||||
gu_format_string_v(const char* fmt, va_list args, GuPool* pool)
|
gu_format_string_v(const char* fmt, va_list args, GuPool* pool)
|
||||||
{
|
{
|
||||||
GuPool* tmp_pool = gu_local_pool();
|
GuPool* tmp_pool = gu_local_pool();
|
||||||
GuStringBuf* sb = gu_string_buf(tmp_pool);
|
GuStringBuf* sb = gu_new_string_buf(tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sb);
|
GuOut* out = gu_string_buf_out(sb);
|
||||||
gu_vprintf(fmt, args, out, NULL);
|
gu_vprintf(fmt, args, out, NULL);
|
||||||
gu_out_flush(out, NULL);
|
gu_out_flush(out, NULL);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ gu_string_in(GuString string, GuPool* pool);
|
|||||||
typedef struct GuStringBuf GuStringBuf;
|
typedef struct GuStringBuf GuStringBuf;
|
||||||
|
|
||||||
GuStringBuf*
|
GuStringBuf*
|
||||||
gu_string_buf(GuPool* pool);
|
gu_new_string_buf(GuPool* pool);
|
||||||
|
|
||||||
GuOut*
|
GuOut*
|
||||||
gu_string_buf_out(GuStringBuf* sb);
|
gu_string_buf_out(GuStringBuf* sb);
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ pgf_align_words(PgfConcr* concr, PgfExpr expr,
|
|||||||
.parent_current = gu_new_buf(int, tmp_pool),
|
.parent_current = gu_new_buf(int, tmp_pool),
|
||||||
.phrases = phrases,
|
.phrases = phrases,
|
||||||
.last_phrase = NULL,
|
.last_phrase = NULL,
|
||||||
.sbuf = gu_string_buf(tmp_pool),
|
.sbuf = gu_new_string_buf(tmp_pool),
|
||||||
.n_matches = 0,
|
.n_matches = 0,
|
||||||
.err = err,
|
.err = err,
|
||||||
.bind = true,
|
.bind = true,
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ pgf_expr_parser_token(PgfExprParser* parser)
|
|||||||
case '\'':
|
case '\'':
|
||||||
pgf_expr_parser_getc(parser);
|
pgf_expr_parser_getc(parser);
|
||||||
|
|
||||||
GuStringBuf* chars = gu_string_buf(parser->tmp_pool);
|
GuStringBuf* chars = gu_new_string_buf(parser->tmp_pool);
|
||||||
while (parser->ch != '\'' && parser->ch != EOF) {
|
while (parser->ch != '\'' && parser->ch != EOF) {
|
||||||
if (parser->ch == '\\') {
|
if (parser->ch == '\\') {
|
||||||
pgf_expr_parser_getc(parser);
|
pgf_expr_parser_getc(parser);
|
||||||
@@ -366,7 +366,7 @@ pgf_expr_parser_token(PgfExprParser* parser)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
GuStringBuf* chars = gu_string_buf(parser->tmp_pool);
|
GuStringBuf* chars = gu_new_string_buf(parser->tmp_pool);
|
||||||
|
|
||||||
if (pgf_is_ident_first(parser->ch)) {
|
if (pgf_is_ident_first(parser->ch)) {
|
||||||
do {
|
do {
|
||||||
|
|||||||
@@ -460,7 +460,7 @@ pgf_cnc_resolve(PgfCnc* cnc,
|
|||||||
|
|
||||||
GuPool* tmp_pool = gu_local_pool();
|
GuPool* tmp_pool = gu_local_pool();
|
||||||
GuExn* err = gu_new_exn(tmp_pool);
|
GuExn* err = gu_new_exn(tmp_pool);
|
||||||
GuStringBuf* sbuf = gu_string_buf(tmp_pool);
|
GuStringBuf* sbuf = gu_new_string_buf(tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
|
|
||||||
gu_putc('[', out, err);
|
gu_putc('[', out, err);
|
||||||
@@ -1209,7 +1209,7 @@ pgf_get_tokens(PgfSymbols* syms, uint16_t sym_idx, GuPool* pool)
|
|||||||
{
|
{
|
||||||
GuPool* tmp_pool = gu_new_pool();
|
GuPool* tmp_pool = gu_new_pool();
|
||||||
GuExn* err = gu_new_exn(tmp_pool);
|
GuExn* err = gu_new_exn(tmp_pool);
|
||||||
GuStringBuf* sbuf = gu_string_buf(tmp_pool);
|
GuStringBuf* sbuf = gu_new_string_buf(tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
|
|
||||||
PgfSimpleLin flin = {
|
PgfSimpleLin flin = {
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ pgf_match_name_lit(PgfLiteralCallback* self, PgfConcr* concr,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
GuPool* tmp_pool = gu_local_pool();
|
GuPool* tmp_pool = gu_local_pool();
|
||||||
GuStringBuf *sbuf = gu_string_buf(tmp_pool);
|
GuStringBuf *sbuf = gu_new_string_buf(tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
GuExn* err = gu_new_exn(tmp_pool);
|
GuExn* err = gu_new_exn(tmp_pool);
|
||||||
|
|
||||||
@@ -361,7 +361,7 @@ pgf_match_unknown_lit(PgfLiteralCallback* self, PgfConcr* concr,
|
|||||||
GuUCS ucs = gu_utf8_decode(&p);
|
GuUCS ucs = gu_utf8_decode(&p);
|
||||||
if (!gu_ucs_is_upper(ucs)) {
|
if (!gu_ucs_is_upper(ucs)) {
|
||||||
GuPool* tmp_pool = gu_local_pool();
|
GuPool* tmp_pool = gu_local_pool();
|
||||||
GuStringBuf *sbuf = gu_string_buf(tmp_pool);
|
GuStringBuf *sbuf = gu_new_string_buf(tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
GuExn* err = gu_new_exn(tmp_pool);
|
GuExn* err = gu_new_exn(tmp_pool);
|
||||||
|
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ pgf_parseval(PgfConcr* concr, PgfExpr expr, PgfType* type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GuStringBuf* sbuf =
|
GuStringBuf* sbuf =
|
||||||
gu_string_buf(pool);
|
gu_new_string_buf(pool);
|
||||||
|
|
||||||
PgfMetricsLznState state;
|
PgfMetricsLznState state;
|
||||||
state.bind = true;
|
state.bind = true;
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ pgf_tc_mk_print_context(PgfTypeChecker* checker, PgfContext* ctxt)
|
|||||||
static void
|
static void
|
||||||
pgf_tc_err_cannot_infer(PgfTypeChecker* checker, PgfContext* ctxt, PgfExpr e)
|
pgf_tc_err_cannot_infer(PgfTypeChecker* checker, PgfContext* ctxt, PgfExpr e)
|
||||||
{
|
{
|
||||||
GuStringBuf* sbuf = gu_string_buf(checker->tmp_pool);
|
GuStringBuf* sbuf = gu_new_string_buf(checker->tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
GuExn* err = gu_exn(checker->tmp_pool);
|
GuExn* err = gu_exn(checker->tmp_pool);
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ static void
|
|||||||
pgf_tc_err_exp_fun_type_1(PgfTypeChecker* checker, PgfContext* ctxt,
|
pgf_tc_err_exp_fun_type_1(PgfTypeChecker* checker, PgfContext* ctxt,
|
||||||
PgfExpr e, PgfType* ty)
|
PgfExpr e, PgfType* ty)
|
||||||
{
|
{
|
||||||
GuStringBuf* sbuf = gu_string_buf(checker->tmp_pool);
|
GuStringBuf* sbuf = gu_new_string_buf(checker->tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
GuExn* err = gu_exn(checker->tmp_pool);
|
GuExn* err = gu_exn(checker->tmp_pool);
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ static void
|
|||||||
pgf_tc_err_exp_fun_type_2(PgfTypeChecker* checker, PgfContext* ctxt,
|
pgf_tc_err_exp_fun_type_2(PgfTypeChecker* checker, PgfContext* ctxt,
|
||||||
PgfExpr e, PgfType* ty)
|
PgfExpr e, PgfType* ty)
|
||||||
{
|
{
|
||||||
GuStringBuf* sbuf = gu_string_buf(checker->tmp_pool);
|
GuStringBuf* sbuf = gu_new_string_buf(checker->tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
GuExn* err = gu_exn(checker->tmp_pool);
|
GuExn* err = gu_exn(checker->tmp_pool);
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ pgf_tc_err_type_mismatch(PgfTypeChecker* checker,
|
|||||||
PgfContext* ctxt,
|
PgfContext* ctxt,
|
||||||
PgfExpr e, PgfCFType ty1, PgfCFType ty2)
|
PgfExpr e, PgfCFType ty1, PgfCFType ty2)
|
||||||
{
|
{
|
||||||
GuStringBuf* sbuf = gu_string_buf(checker->tmp_pool);
|
GuStringBuf* sbuf = gu_new_string_buf(checker->tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
GuExn* err = gu_exn(checker->tmp_pool);
|
GuExn* err = gu_exn(checker->tmp_pool);
|
||||||
|
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ gu_exn_type_PgfTypeError = Ptr "PgfTypeError"# :: CString
|
|||||||
foreign import ccall "gu/string.h gu_string_in"
|
foreign import ccall "gu/string.h gu_string_in"
|
||||||
gu_string_in :: CString -> Ptr GuPool -> IO (Ptr GuIn)
|
gu_string_in :: CString -> Ptr GuPool -> IO (Ptr GuIn)
|
||||||
|
|
||||||
foreign import ccall "gu/string.h gu_string_buf"
|
foreign import ccall "gu/string.h gu_new_string_buf"
|
||||||
gu_string_buf :: Ptr GuPool -> IO (Ptr GuStringBuf)
|
gu_new_string_buf :: Ptr GuPool -> IO (Ptr GuStringBuf)
|
||||||
|
|
||||||
foreign import ccall "gu/string.h gu_string_buf_out"
|
foreign import ccall "gu/string.h gu_string_buf_out"
|
||||||
gu_string_buf_out :: Ptr GuStringBuf -> IO (Ptr GuOut)
|
gu_string_buf_out :: Ptr GuStringBuf -> IO (Ptr GuOut)
|
||||||
@@ -97,7 +97,7 @@ withGuPool f = bracket gu_new_pool gu_pool_free f
|
|||||||
|
|
||||||
newOut :: Ptr GuPool -> IO (Ptr GuStringBuf, Ptr GuOut)
|
newOut :: Ptr GuPool -> IO (Ptr GuStringBuf, Ptr GuOut)
|
||||||
newOut pool =
|
newOut pool =
|
||||||
do sb <- gu_string_buf pool
|
do sb <- gu_new_string_buf pool
|
||||||
out <- gu_string_buf_out sb
|
out <- gu_string_buf_out sb
|
||||||
return (sb,out)
|
return (sb,out)
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ Expr_repr(ExprObject *self)
|
|||||||
GuPool* tmp_pool = gu_local_pool();
|
GuPool* tmp_pool = gu_local_pool();
|
||||||
|
|
||||||
GuExn* err = gu_exn(tmp_pool);
|
GuExn* err = gu_exn(tmp_pool);
|
||||||
GuStringBuf* sbuf = gu_string_buf(tmp_pool);
|
GuStringBuf* sbuf = gu_new_string_buf(tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
|
|
||||||
pgf_print_expr(self->expr, NULL, 0, out, err);
|
pgf_print_expr(self->expr, NULL, 0, out, err);
|
||||||
@@ -876,7 +876,7 @@ Type_repr(TypeObject *self)
|
|||||||
GuPool* tmp_pool = gu_local_pool();
|
GuPool* tmp_pool = gu_local_pool();
|
||||||
|
|
||||||
GuExn* err = gu_exn(tmp_pool);
|
GuExn* err = gu_exn(tmp_pool);
|
||||||
GuStringBuf* sbuf = gu_string_buf(tmp_pool);
|
GuStringBuf* sbuf = gu_new_string_buf(tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
|
|
||||||
pgf_print_type(self->type, NULL, 0, out, err);
|
pgf_print_type(self->type, NULL, 0, out, err);
|
||||||
@@ -1377,7 +1377,7 @@ pypgf_literal_callback_match(PgfLiteralCallback* self, PgfConcr* concr,
|
|||||||
GuPool* tmp_pool = gu_local_pool();
|
GuPool* tmp_pool = gu_local_pool();
|
||||||
|
|
||||||
GuExn* err = gu_exn(tmp_pool);
|
GuExn* err = gu_exn(tmp_pool);
|
||||||
GuStringBuf* sbuf = gu_string_buf(tmp_pool);
|
GuStringBuf* sbuf = gu_new_string_buf(tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
|
|
||||||
pgf_print_expr(ep->expr, NULL, 0, out, err);
|
pgf_print_expr(ep->expr, NULL, 0, out, err);
|
||||||
@@ -1658,7 +1658,7 @@ Concr_linearize(ConcrObject* self, PyObject *args)
|
|||||||
|
|
||||||
GuPool* tmp_pool = gu_local_pool();
|
GuPool* tmp_pool = gu_local_pool();
|
||||||
GuExn* err = gu_exn(tmp_pool);
|
GuExn* err = gu_exn(tmp_pool);
|
||||||
GuStringBuf* sbuf = gu_string_buf(tmp_pool);
|
GuStringBuf* sbuf = gu_new_string_buf(tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
|
|
||||||
pgf_linearize(self->concr, pyexpr->expr, out, err);
|
pgf_linearize(self->concr, pyexpr->expr, out, err);
|
||||||
@@ -1693,7 +1693,7 @@ Iter_fetch_linearization(IterObject* self)
|
|||||||
GuExn* err = gu_new_exn(tmp_pool);
|
GuExn* err = gu_new_exn(tmp_pool);
|
||||||
|
|
||||||
restart:;
|
restart:;
|
||||||
GuStringBuf* sbuf = gu_string_buf(tmp_pool);
|
GuStringBuf* sbuf = gu_new_string_buf(tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
|
|
||||||
|
|
||||||
@@ -1823,7 +1823,7 @@ Concr_tabularLinearize(ConcrObject* self, PyObject *args)
|
|||||||
pgf_lzr_get_table(self->concr, ctree, &n_lins, &labels);
|
pgf_lzr_get_table(self->concr, ctree, &n_lins, &labels);
|
||||||
|
|
||||||
for (size_t lin_idx = 0; lin_idx < n_lins; lin_idx++) {
|
for (size_t lin_idx = 0; lin_idx < n_lins; lin_idx++) {
|
||||||
GuStringBuf* sbuf = gu_string_buf(tmp_pool);
|
GuStringBuf* sbuf = gu_new_string_buf(tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
|
|
||||||
pgf_lzr_linearize_simple(self->concr, ctree, lin_idx, out, err, tmp_pool);
|
pgf_lzr_linearize_simple(self->concr, ctree, lin_idx, out, err, tmp_pool);
|
||||||
@@ -2209,7 +2209,7 @@ Concr_graphvizParseTree(ConcrObject* self, PyObject *args) {
|
|||||||
|
|
||||||
GuPool* tmp_pool = gu_local_pool();
|
GuPool* tmp_pool = gu_local_pool();
|
||||||
GuExn* err = gu_exn(tmp_pool);
|
GuExn* err = gu_exn(tmp_pool);
|
||||||
GuStringBuf* sbuf = gu_string_buf(tmp_pool);
|
GuStringBuf* sbuf = gu_new_string_buf(tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
|
|
||||||
pgf_graphviz_parse_tree(self->concr, pyexpr->expr, out, err);
|
pgf_graphviz_parse_tree(self->concr, pyexpr->expr, out, err);
|
||||||
@@ -2996,7 +2996,7 @@ PGF_graphvizAbstractTree(PGFObject* self, PyObject *args) {
|
|||||||
|
|
||||||
GuPool* tmp_pool = gu_local_pool();
|
GuPool* tmp_pool = gu_local_pool();
|
||||||
GuExn* err = gu_new_exn(tmp_pool);
|
GuExn* err = gu_new_exn(tmp_pool);
|
||||||
GuStringBuf* sbuf = gu_string_buf(tmp_pool);
|
GuStringBuf* sbuf = gu_new_string_buf(tmp_pool);
|
||||||
GuOut* out = gu_string_buf_out(sbuf);
|
GuOut* out = gu_string_buf_out(sbuf);
|
||||||
|
|
||||||
pgf_graphviz_abstract_tree(self->pgf, pyexpr->expr, out, err);
|
pgf_graphviz_abstract_tree(self->pgf, pyexpr->expr, out, err);
|
||||||
|
|||||||
Reference in New Issue
Block a user