Browse Source

Unify and export enum conversion in ptype

Wanted for better bindings.
Ingo Albrecht 3 years ago
parent
commit
885bed9290
3 changed files with 11 additions and 3 deletions
  1. 8 0
      clish/ptype.h
  2. 2 2
      clish/ptype/ptype.c
  3. 1 1
      clish/ptype/ptype_dump.c

+ 8 - 0
clish/ptype.h

@@ -99,4 +99,12 @@ _CLISH_GET(ptype, clish_ptype_method_e, method);
 void clish_ptype__set_pattern(clish_ptype_t * instance,
 	const char *pattern, clish_ptype_method_e method);
 
+const char *clish_ptype_method__get_name(clish_ptype_method_e
+	method);
+clish_ptype_method_e clish_ptype_method_resolve(const char *name);
+
+const char *clish_ptype_preprocess__get_name(clish_ptype_preprocess_e
+	preprocess);
+clish_ptype_preprocess_e clish_ptype_preprocess_resolve(const char *name);
+
 #endif	/* _clish_ptype_h */

+ 2 - 2
clish/ptype/ptype.c

@@ -222,7 +222,7 @@ static const char *method_names[] = {
 };
 
 /*--------------------------------------------------------- */
-const char *clish_ptype__get_method_name(clish_ptype_method_e method)
+const char *clish_ptype_method__get_name(clish_ptype_method_e method)
 {
 	if (method >= CLISH_PTYPE_METHOD_MAX)
 		return NULL;
@@ -252,7 +252,7 @@ static const char *preprocess_names[] = {
 };
 
 /*--------------------------------------------------------- */
-const char *clish_ptype__get_preprocess_name(clish_ptype_preprocess_e preprocess)
+const char *clish_ptype_preprocess__get_name(clish_ptype_preprocess_e preprocess)
 {
 	if (preprocess >= CLISH_PTYPE_PRE_MAX)
 		return NULL;

+ 1 - 1
clish/ptype/ptype_dump.c

@@ -15,7 +15,7 @@ void clish_ptype_dump(clish_ptype_t * this)
 	lub_dump_printf("text       : %s\n", LUB_DUMP_STR(clish_ptype__get_text(this)));
 	lub_dump_printf("pattern    : %s\n", LUB_DUMP_STR(this->pattern));
 	lub_dump_printf("method     : %s\n",
-		clish_ptype__get_method_name(this->method));
+		clish_ptype_method__get_name(this->method));
 	lub_dump_printf("postprocess: %s\n",
 		clish_ptype_preprocess__get_name(this->preprocess));
 	lub_dump_undent();