intended). This `outer' variable is given as a first argument to all
outer level functions.
+ The `RECODE_OUTER' structure is really meant to be initialised only
+once in the life of a program, and terminated with the program itself.
+Program interfaces should pay attention to initialise it only once,
+would it be only for speed considerations. A good deal of overhead goes
+to outer level initialization, and if the outer level was initialized
+afresh for each and every string translated, say, the Recode library
+would appear immensely much slower that it was meant to be!
+
+ Because outer level initialization is meant to be done only once,
+not so much attention has been paid to avoid memory leaks at this level
+within Recode. This is hardly a reason for not plugging such leaks at
+any level: in the long run, they should all be chased and repaired.
+
The `<recode.h>' header file uses the Boolean type setup by the
system header file `<stdbool.h>'. But this header file is still fairly
new in C standards, and likely does not exist everywhere. If you
The request level functions are meant to cover most recoding needs
programmers may have; they should provide all usual functionality.
-Their API is almost stable by now. To get started with request level
-functions, here is a full example of a program which sole job is to
-filter `ibmpc' code on its standard input into `latin1' code on its
-standard output.
+Their API is almost stable by now.
+
+ To get started with request level functions, here is a full example
+of a program which sole job is to filter `ibmpc' code on its standard
+input into `latin1' code on its standard output.
#include <stdio.h>
#include <stdbool.h>
program. This REQUEST variable is given as a first argument to all
request level functions, and in most cases, may be considered as opaque.
+ Suppose an application is doing a lot of recoding using only a few
+different requests. For speed considerations, the `RECODE_REQUEST'
+structure should ideally be cached for each kind of request, so the
+request level initialisation is not redone for each and every string
+translated. The speedup should be more apparent when Recode is able to
+optimize the work by building on the fly, within the structure, new
+specialized recoding steps and their associated data tables.
+
* Initialisation functions
RECODE_REQUEST recode_new_request (OUTER);
* ambiguous output, error message: Errors. (line 31)
* ASCII table, recreating with Recode: ASCII. (line 12)
* average number of recoding steps: Main flow. (line 40)
-* bool data type: Outer level. (line 31)
+* bool data type: Outer level. (line 44)
* box-drawing characters: Recoding. (line 16)
* bug reports, where to send: Contributing. (line 37)
* byte order mark: UCS-2. (line 12)
* implied surfaces: Requests. (line 69)
* impossible conversions: Charset overview. (line 33)
* information about charsets: Listings. (line 153)
-* initialisation functions, outer: Outer level. (line 84)
-* initialisation functions, request: Request level. (line 42)
+* initialisation functions, outer: Outer level. (line 97)
+* initialisation functions, request: Request level. (line 51)
* initialisation functions, task: Task level. (line 52)
* interface, with iconv library: iconv. (line 6)
* intermediate charsets: Requests. (line 23)
* LaTeX files: LaTeX. (line 6)
* Latin charsets: ISO 8859. (line 6)
* Latin-1 table, recreating with Recode: ISO 8859. (line 45)
+* leaks, memory: Outer level. (line 39)
* letter case, in charset and surface names: Requests. (line 93)
* libiconv: iconv. (line 6)
* library, iconv: iconv. (line 6)
* map filling: Reversibility. (line 98)
* map filling, disable: Reversibility. (line 48)
* markup language: HTML. (line 6)
+* memory leaks: Outer level. (line 39)
* memory sequencing: Sequencing. (line 23)
* MIME encodings: MIME. (line 6)
* misuse of recoding library, error message: Errors. (line 76)
* partial conversion: Mixed. (line 20)
* permutations of groups of bytes: Permutations. (line 6)
* pipe sequencing: Sequencing. (line 40)
-* program_name variable: Outer level. (line 137)
+* program_name variable: Outer level. (line 150)
* programming language support: Listings. (line 26)
* pseudo-charsets: Charset overview. (line 33)
* pure charset: Surface overview. (line 17)
* silent operation: Reversibility. (line 36)
* single step: Main flow. (line 17)
* source file generation: Listings. (line 26)
-* stdbool.h header: Outer level. (line 31)
+* speed considerations <1>: Request level. (line 43)
+* speed considerations: Outer level. (line 31)
+* stdbool.h header: Outer level. (line 44)
* strict operation: Reversibility. (line 48)
* string and comments conversion: Mixed. (line 39)
* structural surfaces: Surfaces. (line 44)
* Menu:
* abort_level: Task level. (line 198)
-* ascii_graphics: Request level. (line 101)
+* ascii_graphics: Request level. (line 110)
* byte_order_mark: Task level. (line 182)
* declare_step: New surfaces. (line 13)
* DEFAULT_CHARSET: Requests. (line 104)
-* diacritics_only: Request level. (line 92)
-* diaeresis_char: Request level. (line 76)
+* diacritics_only: Request level. (line 101)
+* diaeresis_char: Request level. (line 85)
* error_so_far: Task level. (line 210)
* fail_level: Task level. (line 188)
* file_one_to_many: New charsets. (line 70)
* list_all_charsets: Charset level. (line 15)
* list_concise_charset: Charset level. (line 15)
* list_full_charset: Charset level. (line 15)
-* make_header_flag: Request level. (line 83)
+* make_header_flag: Request level. (line 92)
* RECODE_AMBIGUOUS_OUTPUT: Errors. (line 31)
-* recode_buffer_to_buffer: Request level. (line 147)
-* recode_buffer_to_file: Request level. (line 147)
-* recode_delete_outer: Outer level. (line 89)
-* recode_delete_request: Request level. (line 47)
+* recode_buffer_to_buffer: Request level. (line 156)
+* recode_buffer_to_file: Request level. (line 156)
+* recode_delete_outer: Outer level. (line 102)
+* recode_delete_request: Request level. (line 56)
* recode_delete_task: Task level. (line 54)
-* recode_file_to_buffer: Request level. (line 147)
-* recode_file_to_file: Request level. (line 147)
+* recode_file_to_buffer: Request level. (line 156)
+* recode_file_to_file: Request level. (line 156)
* recode_filter_close: Task level. (line 217)
-* recode_filter_close, not available: Request level. (line 212)
+* recode_filter_close, not available: Request level. (line 221)
* recode_filter_open: Task level. (line 217)
-* recode_filter_open, not available: Request level. (line 212)
-* recode_format_table: Request level. (line 227)
+* recode_filter_open, not available: Request level. (line 221)
+* recode_format_table: Request level. (line 236)
* RECODE_INTERNAL_ERROR: Errors. (line 81)
* RECODE_INVALID_INPUT: Errors. (line 61)
* RECODE_MAXIMUM_ERROR <1>: Errors. (line 88)
* RECODE_MAXIMUM_ERROR: Task level. (line 198)
-* recode_new_outer: Outer level. (line 89)
-* recode_new_request: Request level. (line 47)
+* recode_new_outer: Outer level. (line 102)
+* recode_new_request: Request level. (line 56)
* recode_new_task: Task level. (line 54)
* RECODE_NO_ERROR: Errors. (line 16)
* RECODE_NOT_CANONICAL: Errors. (line 19)
* RECODE_OUTER structure: Outer level. (line 25)
* recode_perform_task: Task level. (line 217)
-* recode_request structure: Request level. (line 59)
-* RECODE_REQUEST structure: Request level. (line 37)
-* recode_scan_request: Request level. (line 111)
+* recode_request structure: Request level. (line 68)
+* RECODE_REQUEST structure: Request level. (line 38)
+* recode_scan_request: Request level. (line 120)
* RECODE_SEQUENCE_IN_MEMORY: Task level. (line 169)
* RECODE_SEQUENCE_WITH_FILES: Task level. (line 172)
* RECODE_SEQUENCE_WITH_PIPE: Task level. (line 175)
* RECODE_STRATEGY_UNDECIDED: Task level. (line 162)
-* recode_string: Request level. (line 140)
-* recode_string_to_buffer: Request level. (line 147)
-* recode_string_to_file: Request level. (line 147)
+* recode_string: Request level. (line 149)
+* recode_string_to_buffer: Request level. (line 156)
+* recode_string_to_file: Request level. (line 156)
* RECODE_SYSTEM_ERROR: Errors. (line 71)
* RECODE_TASK structure: Task level. (line 46)
* RECODE_UNTRANSLATABLE: Errors. (line 50)
* RECODE_USER_ERROR: Errors. (line 76)
* strategy: Task level. (line 162)
* task_request structure: Task level. (line 81)
-* verbose_flag: Request level. (line 71)
+* verbose_flag: Request level. (line 80)
\1f
File: recode.info, Node: Charset and Surface Index, Prev: Library Index, Up: Top
Node: Debugging\7f59695
Node: Library\7f63965
Node: Outer level\7f65319
-Node: Request level\7f71429
-Node: Task level\7f81896
-Node: Charset level\7f92318
-Node: Errors\7f93160
-Ref: Errors-Footnote-1\7f98006
-Ref: Errors-Footnote-2\7f98120
-Node: Universal\7f98481
-Ref: Universal-Footnote-1\7f101593
-Ref: Universal-Footnote-2\7f101659
-Node: UCS-2\7f101872
-Node: UCS-4\7f104398
-Node: UTF-7\7f104938
-Node: UTF-8\7f105533
-Node: UTF-16\7f109838
-Node: count-characters\7f110986
-Node: dump-with-names\7f111657
-Node: iconv\7f114206
-Node: Tabular\7f117637
-Node: ASCII misc\7f139850
-Node: ASCII\7f140216
-Node: ISO 8859\7f141032
-Node: ASCII-BS\7f143326
-Node: flat\7f145163
-Node: IBM and MS\7f145834
-Node: EBCDIC\7f146378
-Node: IBM-PC\7f148474
-Ref: IBM-PC-Footnote-1\7f150588
-Node: Icon-QNX\7f150747
-Node: CDC\7f151172
-Node: Display Code\7f152853
-Ref: Display Code-Footnote-1\7f155134
-Node: CDC-NOS\7f155339
-Node: Bang-Bang\7f157301
-Node: Micros\7f159230
-Node: Apple-Mac\7f159613
-Node: AtariST\7f161647
-Node: Miscellaneous\7f162633
-Node: HTML\7f163366
-Node: LaTeX\7f169355
-Node: Texinfo\7f170129
-Node: Vietnamese\7f170901
-Node: African\7f171877
-Node: Others\7f173227
-Node: Texte\7f174681
-Ref: Texte-Footnote-1\7f179231
-Ref: Texte-Footnote-2\7f179311
-Ref: Texte-Footnote-3\7f179786
-Node: Mule\7f179883
-Ref: Mule-Footnote-1\7f181664
-Node: Surfaces\7f182183
-Ref: Surfaces-Footnote-1\7f185602
-Node: Permutations\7f185706
-Node: End lines\7f186547
-Node: MIME\7f188748
-Node: Dump\7f189935
-Node: Test\7f194105
-Node: Internals\7f196583
-Node: Main flow\7f197811
-Node: New charsets\7f200914
-Node: New surfaces\7f205452
-Node: Design\7f206178
-Ref: Design-Footnote-1\7f215344
-Node: Concept Index\7f215448
-Node: Option Index\7f230191
-Node: Library Index\7f233044
-Node: Charset and Surface Index\7f237619
+Node: Request level\7f72193
+Node: Task level\7f83140
+Node: Charset level\7f93562
+Node: Errors\7f94404
+Ref: Errors-Footnote-1\7f99250
+Ref: Errors-Footnote-2\7f99364
+Node: Universal\7f99725
+Ref: Universal-Footnote-1\7f102837
+Ref: Universal-Footnote-2\7f102903
+Node: UCS-2\7f103116
+Node: UCS-4\7f105642
+Node: UTF-7\7f106182
+Node: UTF-8\7f106777
+Node: UTF-16\7f111082
+Node: count-characters\7f112230
+Node: dump-with-names\7f112901
+Node: iconv\7f115450
+Node: Tabular\7f118881
+Node: ASCII misc\7f141094
+Node: ASCII\7f141460
+Node: ISO 8859\7f142276
+Node: ASCII-BS\7f144570
+Node: flat\7f146407
+Node: IBM and MS\7f147078
+Node: EBCDIC\7f147622
+Node: IBM-PC\7f149718
+Ref: IBM-PC-Footnote-1\7f151832
+Node: Icon-QNX\7f151991
+Node: CDC\7f152416
+Node: Display Code\7f154097
+Ref: Display Code-Footnote-1\7f156378
+Node: CDC-NOS\7f156583
+Node: Bang-Bang\7f158545
+Node: Micros\7f160474
+Node: Apple-Mac\7f160857
+Node: AtariST\7f162891
+Node: Miscellaneous\7f163877
+Node: HTML\7f164610
+Node: LaTeX\7f170599
+Node: Texinfo\7f171373
+Node: Vietnamese\7f172145
+Node: African\7f173121
+Node: Others\7f174471
+Node: Texte\7f175925
+Ref: Texte-Footnote-1\7f180475
+Ref: Texte-Footnote-2\7f180555
+Ref: Texte-Footnote-3\7f181030
+Node: Mule\7f181127
+Ref: Mule-Footnote-1\7f182908
+Node: Surfaces\7f183427
+Ref: Surfaces-Footnote-1\7f186846
+Node: Permutations\7f186950
+Node: End lines\7f187791
+Node: MIME\7f189992
+Node: Dump\7f191179
+Node: Test\7f195349
+Node: Internals\7f197827
+Node: Main flow\7f199055
+Node: New charsets\7f202158
+Node: New surfaces\7f206696
+Node: Design\7f207422
+Ref: Design-Footnote-1\7f216588
+Node: Concept Index\7f216692
+Node: Option Index\7f231727
+Node: Library Index\7f234580
+Node: Charset and Surface Index\7f239155
\1f
End Tag Table
@section Outer level functions
@cindex outer level functions
+
The outer level functions mainly prepare the whole recoding library for
use, or do actions which are unrelated to specific recodings. Here is
an example of a program which does not really make anything useful.
intended). This @samp{outer} variable is given as a first argument to
all outer level functions.
+@cindex speed considerations
+The @code{RECODE_OUTER} structure is really meant to be initialised only
+once in the life of a program, and terminated with the program itself.
+Program interfaces should pay attention to initialise it only once,
+would it be only for speed considerations. A good deal of overhead goes
+to outer level initialization, and if the outer level was initialized
+afresh for each and every string translated, say, the Recode library
+would appear immensely much slower that it was meant to be!
+
+@cindex memory leaks
+@cindex leaks, memory
+Because outer level initialization is meant to be done only once, not so
+much attention has been paid to avoid memory leaks at this level within
+Recode. This is hardly a reason for not plugging such leaks at any
+level: in the long run, they should all be chased and repaired.
+
@cindex @code{stdbool.h} header
@cindex @code{bool} data type
The @code{<recode.h>} header file uses the Boolean type setup by the
@cindex request level functions
The request level functions are meant to cover most recoding needs
programmers may have; they should provide all usual functionality.
-Their API is almost stable by now. To get started with request level
-functions, here is a full example of a program which sole job is to filter
-@code{ibmpc} code on its standard input into @code{latin1} code on its
-standard output.
+Their API is almost stable by now.
+
+To get started with request level functions, here is a full example of
+a program which sole job is to filter @code{ibmpc} code on its standard
+input into @code{latin1} code on its standard output.
@example
@group
This @var{request} variable is given as a first argument to all request
level functions, and in most cases, may be considered as opaque.
+@cindex speed considerations
+Suppose an application is doing a lot of recoding using only a few
+different requests. For speed considerations, the @code{RECODE_REQUEST}
+structure should ideally be cached for each kind of request, so the
+request level initialisation is not redone for each and every string
+translated. The speedup should be more apparent when Recode is able
+to optimize the work by building on the fly, within the structure, new
+specialized recoding steps and their associated data tables.
+
@itemize @bullet
@item Initialisation functions
@cindex initialisation functions, request