/* This file was generated by "mtxrun --script "mtx-wtoc.lua" from the metapost cweb files but now maintained as C file. */ # ifndef MPSTRINGS_H # define MPSTRINGS_H 1 # include "mp.h" extern void *mp_aux_copy_strings_entry (const void *p); extern char *mp_strdup (const char *s); extern char *mp_strndup (const char *s, size_t l); /* int mp_strcmp (const char *a, const char *b); */ extern void mp_initialize_strings (MP mp); extern void mp_free_strings (MP mp); /* char *mp_str (MP mp, mp_string s); */ extern mp_string mp_rtsl (MP mp, const char *s, size_t l); extern mp_string mp_rts (MP mp, const char *s); extern mp_string mp_make_string (MP mp); extern void mp_append_char (MP mp, unsigned char c); extern void mp_append_str (MP mp, const char *s); extern void mp_str_room (MP mp, int wsize); extern void mp_reset_cur_string (MP mp); extern void mp_flush_string (MP mp, mp_string s); extern mp_string mp_intern (MP mp, const char *s); extern mp_string mp_make_string (MP mp); extern int mp_str_vs_str (MP mp, mp_string s, mp_string t); extern mp_string mp_cat (MP mp, mp_string a, mp_string b); extern mp_string mp_chop_string (MP mp, mp_string s, int a, int b); static inline char *mp_str (MP mp, mp_string ss) { (void) mp; return (char *) ss->str; } static inline int mp_strcmp (const char *a, const char *b) { return a == NULL ? (b == NULL ? 0 : -1) : (b == NULL ? 1 : strcmp(a, b)); } /*tex As soon as we have more than |MAX_STR_REF| references we assume that the string is persistent and that there is no need to ever free it. */ # define MAX_STR_REF 127 extern void mp_add_string_reference (MP mp, mp_string s); extern void mp_delete_string_reference (MP mp, mp_string s); # endif