From 7140daa6109d22f72b3dd28a6c53d88a00a85f55 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Pinard?= Date: Sun, 24 Feb 2008 13:25:53 -0500 Subject: [PATCH] Cosmetics --- python/Recode.pyx | 52 ++++++++++++++++++++++++-------------------- src/names.c | 3 +-- src/request.c | 8 +++---- tests/t90_bigauto.py | 2 +- 4 files changed, 34 insertions(+), 31 deletions(-) diff --git a/python/Recode.pyx b/python/Recode.pyx index 798f17c..2fea722 100644 --- a/python/Recode.pyx +++ b/python/Recode.pyx @@ -13,6 +13,15 @@ cdef extern from "config.h": cdef extern from "common.h": + ## Forwarded declarations. + + cdef struct recode_outer + ctypedef recode_outer *RECODE_OUTER + ctypedef recode_outer *RECODE_CONST_OUTER + + cdef struct recode_single + ctypedef recode_single *RECODE_SINGLE + ## Symbols. enum recode_symbol_type: @@ -32,8 +41,8 @@ cdef extern from "common.h": char *name recode_data_type data_type void *data - void *resurfacer # really: recode_single * - void *unsurfacer # really: recode_single * + RECODE_SINGLE resurfacer + RECODE_SINGLE unsurfacer recode_symbol_type type bool ignore ctypedef recode_symbol *RECODE_SYMBOL @@ -72,8 +81,8 @@ cdef extern from "common.h": ctypedef recode_option_list *RECODE_CONST_OPTION_LIST #typedef bool (*Recode_init)(RECODE_STEP, RECODE_CONST_REQUEST, - # RECODE_CONST_OPTION_LIST, - # RECODE_CONST_OPTION_LIST) + # RECODE_CONST_OPTION_LIST, + # RECODE_CONST_OPTION_LIST) #typedef bool (*Recode_term)(RECODE_STEP, RECODE_CONST_REQUEST) #typedef bool (*Recode_transform)(RECODE_SUBTASK) #typedef bool (*Recode_fallback)(RECODE_SUBTASK, unsigned) @@ -88,7 +97,6 @@ cdef extern from "common.h": #Recode_init init_routine #Recode_transform transform_routine #Recode_fallback fallback_routine - ctypedef recode_single *RECODE_SINGLE enum recode_step_type: RECODE_NO_STEP_TABLE @@ -117,7 +125,7 @@ cdef extern from "common.h": ## Requests. struct recode_request: - void *outer # really: RECODE_OUTER + RECODE_OUTER outer bool verbose_flag char diaeresis_char bool make_header_flag @@ -156,7 +164,7 @@ cdef extern from "common.h": RECODE_SWAP_NO RECODE_SWAP_YES - enum recode_error: + enum recode_error_ 'recode_error': RECODE_NO_ERROR RECODE_NOT_CANONICAL RECODE_AMBIGUOUS_OUTPUT @@ -174,9 +182,9 @@ cdef extern from "common.h": recode_sequence_strategy strategy bool byte_order_mark recode_swap_input swap_input - recode_error fail_level - recode_error abort_level - recode_error error_so_far + recode_error_ fail_level + recode_error_ abort_level + recode_error_ error_so_far RECODE_CONST_STEP error_at_step ctypedef recode_task *RECODE_TASK ctypedef recode_task *RECODE_CONST_TASK @@ -192,9 +200,9 @@ cdef extern from "common.h": int get_byte(RECODE_SUBTASK) void put_byte(int, RECODE_SUBTASK) - void SET_SUBTASK_ERROR(recode_error, RECODE_SUBTASK) + void SET_SUBTASK_ERROR(recode_error_, RECODE_SUBTASK) bool SUBTASK_RETURN(RECODE_SUBTASK) - void RETURN_IF_NOGO(recode_error, RECODE_SUBTASK) + void RETURN_IF_NOGO(recode_error_, RECODE_SUBTASK) void GOT_CHARACTER(RECODE_SUBTASK) void GOT_NEWLINE(RECODE_SUBTASK) @@ -236,8 +244,6 @@ cdef extern from "common.h": recode_quality quality_variable_to_byte recode_quality quality_variable_to_ucs2 recode_quality quality_variable_to_variable - ctypedef recode_outer *RECODE_OUTER - ctypedef recode_outer *RECODE_CONST_OUTER ## Miscellaneous. @@ -287,8 +293,8 @@ cdef extern from "common.h": # (Count) * sizeof(Type)), \ # Variable) - #void recode_error(RECODE_OUTER, char *, ...) - #void recode_perror(RECODE_OUTER, char *, ...) + void recode_error(RECODE_OUTER, char *, ...) + void recode_perror(RECODE_OUTER, char *, ...) void *recode_malloc(RECODE_OUTER, size_t) void *recode_realloc(RECODE_OUTER, void *, size_t) @@ -327,9 +333,9 @@ cdef extern from "common.h": # combine.c - #enum: # a few #define's, in fact - # DONE - # ELSE # ELSE is reserved in Pyrex + enum: # a few #define's, in fact + DONE + ELSE_ 'ELSE' bool init_explode(RECODE_STEP, RECODE_CONST_REQUEST, RECODE_CONST_OPTION_LIST, RECODE_CONST_OPTION_LIST) @@ -362,8 +368,7 @@ cdef extern from "common.h": bool reversibility(RECODE_SUBTASK, unsigned) #RECODE_SINGLE declare_single - # (RECODE_OUTER, char *, char *, - # struct recode_quality, + # (RECODE_OUTER, char *, char *, struct recode_quality, # bool (*) (RECODE_STEP, RECODE_CONST_REQUEST, # RECODE_CONST_OPTION_LIST, RECODE_CONST_OPTION_LIST), # bool (*) (RECODE_SUBTASK)) @@ -387,7 +392,7 @@ cdef extern from "common.h": int get_byte_helper(RECODE_SUBTASK) void put_byte_helper(int, RECODE_SUBTASK) - bool recode_if_nogo(recode_error, RECODE_SUBTASK) + bool recode_if_nogo(recode_error_, RECODE_SUBTASK) bool transform_byte_to_byte(RECODE_SUBTASK) bool transform_byte_to_variable(RECODE_SUBTASK) @@ -538,7 +543,7 @@ cdef class Request: def format_table(self, int language, char *charset): cdef RECODE_OUTER outer cdef bool saved - outer = self.request[0].outer + outer = self.request.outer saved = outer.libiconv_pivot.ignore outer.libiconv_pivot.ignore = true ok = recode_format_table( @@ -569,7 +574,6 @@ cdef class Request: # Lazy, all in one call. global_outer = Outer() -#global_outer.set_libiconv(False) def recode(char *text, char *string): request = Request(global_outer) diff --git a/src/names.c b/src/names.c index 42f0840..637c4b8 100644 --- a/src/names.c +++ b/src/names.c @@ -645,8 +645,7 @@ list_symbols_walker_2 (void *void_alias, void *void_walk) } bool -list_all_symbols (RECODE_OUTER outer, - RECODE_CONST_SYMBOL after) +list_all_symbols (RECODE_OUTER outer, RECODE_CONST_SYMBOL after) { struct list_symbols_walk walk; /* wanderer's data */ RECODE_ALIAS alias; /* cursor into sorted array */ diff --git a/src/request.c b/src/request.c index 3e995db..8204090 100644 --- a/src/request.c +++ b/src/request.c @@ -554,9 +554,9 @@ simplify_sequence (RECODE_REQUEST request) RECODE_OUTER outer = request->outer; unsigned saved_steps; /* number of saved steps */ - RECODE_STEP in; /* next studied sequence step */ - RECODE_STEP out; /* next rewritten sequence step */ - RECODE_STEP limit; /* last value for IN */ + RECODE_STEP in; /* next studied sequence step */ + RECODE_STEP out; /* next rewritten sequence step */ + RECODE_STEP limit; /* last value for IN */ unsigned char *accum; /* byte_to_byte accumulated recoding */ const char **string; /* byte_to_variable recoding */ unsigned char temp[256]; /* temporary value for accum array */ @@ -721,7 +721,7 @@ simplify_sequence (RECODE_REQUEST request) return true; } -/* Decoging step sequence parameters. */ +/* Decoding step sequence parameters. */ /*-------------------------------------. | Scan next name into SCANNED_STRING. | diff --git a/tests/t90_bigauto.py b/tests/t90_bigauto.py index 466a0bf..36afebd 100644 --- a/tests/t90_bigauto.py +++ b/tests/t90_bigauto.py @@ -55,7 +55,7 @@ class Test: # As a compromise between being too terse or too verbose, we # consider as a single test, one "before" against all "after"s. # However, without a Recode module, we do not know how many - # "before"s exist, and the skip count is then be rather small. + # "before"s exist, and the skip count is then rather small. print before for after in self.charsets: if after is not before: -- 2.40.0