link-grammar-5.8.0/link-grammar/dict-common/print-dict.c
/**
 * Display the expressions associated with this dict node.
 */
Display the expressions associated with this dict node.
Display the expressions associated with this dict node .
static char *display_expr(Dictionary dict, const char *word, Dict_node *dn,
								  const void **arg)
{
	const char *flags = arg[1];
	const Parse_Options opts = (Parse_Options)arg[2];
	bool show_macros = ((flags != NULL) && (strchr(flags, 'm') != NULL));
	bool low_level = ((flags != NULL) && (strchr(flags, 'l') != NULL));
	Pool_desc *Exp_pool = pool_new(__func__, "Exp", 256,
	                               sizeof(Exp), false,
	                               false, false);
	dyn_str *s = dyn_str_new();
	dyn_strcat(s, "expressions:\n");
	for (; dn != NULL; dn = dn->right)
	{
		Exp *e = copy_Exp(dn->exp, Exp_pool, opts); 
		pool_reuse(Exp_pool);
		if (low_level)
		{
			append_string(s, "    %s\n", dn->string);
			prt_exp_all(s, e, 0, dict);
			dyn_strcat(s, "\n\n");
		}
		const char *expstr = lg_exp_stringify_with_tags(dict, e, show_macros);
		append_string(s, "    %-*s %s",
		              display_width(DJ_COL_WIDTH, dn->string), dn->string,
		              expstr);
		dyn_strcat(s, "\n\n");
	}
	if (Exp_pool != NULL) pool_delete(Exp_pool);
	return dyn_str_take(s);
}
static char * display_expr ( Dictionary dict , const char * word , Dict_node * dn , const void * * arg ) { const char * flags = arg [ 1 ] ; const Parse_Options opts = ( Parse_Options ) arg [ 2 ] ; bool show_macros = ( ( flags != NULL ) && ( strchr ( flags , ' ' ) != NULL ) ) ; bool low_level = ( ( flags != NULL ) && ( strchr ( flags , ' ' ) != NULL ) ) ; Pool_desc * Exp_pool = pool_new ( __func__ , " " , 256 , sizeof ( Exp ) , false , false , false ) ; dyn_str * s = dyn_str_new ( ) ; dyn_strcat ( s , " \n " ) ; for ( ; dn != NULL ; dn = dn -> right ) { Exp * e = copy_Exp ( dn -> exp , Exp_pool , opts ) ; pool_reuse ( Exp_pool ) ; if ( low_level ) { append_string ( s , " \n " , dn -> string ) ; prt_exp_all ( s , e , 0 , dict ) ; dyn_strcat ( s , " \n \n " ) ; } const char * expstr = lg_exp_stringify_with_tags ( dict , e , show_macros ) ; append_string ( s , " " , display_width ( DJ_COL_WIDTH , dn -> string ) , dn -> string , expstr ) ; dyn_strcat ( s , " \n \n " ) ; } if ( Exp_pool != NULL ) pool_delete ( Exp_pool ) ; return dyn_str_take ( s ) ; }
Display the expressions associated with this dict node.
Display the expressions associated with this dict node .
/* copy_Exp() needs an Exp memory pool. */ /*num_elements*/ /*zero_out*/ /*align*/ /*exact*/ /* assign dialect costs */