Changeset 471
- Timestamp:
- 01/16/07 19:23:06 (5 years ago)
- Files:
-
- sweep/branches/display-cache/include/sweep/sweep.h (modified) (1 diff)
- sweep/branches/display-cache/include/sweep/sweep_filter.h (modified) (1 diff)
- sweep/branches/display-cache/include/sweep/sweep_sample.h (modified) (4 diffs)
- sweep/branches/display-cache/include/sweep/sweep_selection.h (modified) (4 diffs)
- sweep/branches/display-cache/include/sweep/sweep_sounddata.h (modified) (2 diffs)
- sweep/branches/display-cache/include/sweep/sweep_typeconvert.h (modified) (1 diff)
- sweep/branches/display-cache/include/sweep/sweep_types.h (modified) (27 diffs)
- sweep/branches/display-cache/include/sweep/sweep_undo.h (modified) (2 diffs)
- sweep/branches/display-cache/intl/bindtextdom.c (modified) (12 diffs)
- sweep/branches/display-cache/intl/dcgettext.c (modified) (1 diff)
- sweep/branches/display-cache/intl/dcigettext.c (modified) (37 diffs)
- sweep/branches/display-cache/intl/eval-plural.h (modified) (2 diffs)
- sweep/branches/display-cache/intl/explodename.c (modified) (4 diffs)
- sweep/branches/display-cache/intl/finddomain.c (modified) (5 diffs)
- sweep/branches/display-cache/intl/gettextP.h (modified) (3 diffs)
- sweep/branches/display-cache/intl/gmo.h (modified) (2 diffs)
- sweep/branches/display-cache/intl/intl-compat.c (modified) (9 diffs)
- sweep/branches/display-cache/intl/l10nflist.c (modified) (7 diffs)
- sweep/branches/display-cache/intl/langprefs.c (modified) (4 diffs)
- sweep/branches/display-cache/intl/loadinfo.h (modified) (2 diffs)
- sweep/branches/display-cache/intl/loadmsgcat.c (modified) (27 diffs)
- sweep/branches/display-cache/intl/localcharset.c (modified) (6 diffs)
- sweep/branches/display-cache/intl/localcharset.h (modified) (3 diffs)
- sweep/branches/display-cache/intl/localealias.c (modified) (9 diffs)
- sweep/branches/display-cache/intl/localename.c (modified) (16 diffs)
- sweep/branches/display-cache/intl/log.c (modified) (1 diff)
- sweep/branches/display-cache/intl/os2compat.c (modified) (6 diffs)
- sweep/branches/display-cache/intl/plural-exp.c (modified) (2 diffs)
- sweep/branches/display-cache/intl/plural-exp.h (modified) (1 diff)
- sweep/branches/display-cache/intl/plural.c (modified) (35 diffs)
- sweep/branches/display-cache/intl/printf-args.c (modified) (2 diffs)
- sweep/branches/display-cache/intl/printf-args.h (modified) (3 diffs)
- sweep/branches/display-cache/intl/printf-parse.c (modified) (7 diffs)
- sweep/branches/display-cache/intl/printf-parse.h (modified) (2 diffs)
- sweep/branches/display-cache/intl/printf.c (modified) (16 diffs)
- sweep/branches/display-cache/intl/relocatable.c (modified) (7 diffs)
- sweep/branches/display-cache/intl/relocatable.h (modified) (4 diffs)
- sweep/branches/display-cache/intl/textdomain.c (modified) (3 diffs)
- sweep/branches/display-cache/intl/vasnprintf.c (modified) (14 diffs)
- sweep/branches/display-cache/intl/vasnprintf.h (modified) (4 diffs)
- sweep/branches/display-cache/intl/vasnwprintf.h (modified) (3 diffs)
- sweep/branches/display-cache/intl/wprintf-parse.h (modified) (2 diffs)
- sweep/branches/display-cache/intl/xsize.h (modified) (4 diffs)
- sweep/branches/display-cache/plugins/byenergy/byenergy.c (modified) (6 diffs)
- sweep/branches/display-cache/plugins/echo/echo.c (modified) (6 diffs)
- sweep/branches/display-cache/plugins/example/example.c (modified) (5 diffs)
- sweep/branches/display-cache/plugins/fade/fade.c (modified) (7 diffs)
- sweep/branches/display-cache/plugins/ladspa/ladspa.h (modified) (10 diffs)
- sweep/branches/display-cache/plugins/ladspa/ladspameta.c (modified) (24 diffs)
- sweep/branches/display-cache/plugins/normalise/normalise.c (modified) (4 diffs)
- sweep/branches/display-cache/plugins/reverse/reverse.c (modified) (8 diffs)
- sweep/branches/display-cache/po/fr.po (modified) (1 diff)
- sweep/branches/display-cache/po/pl.po (modified) (1 diff)
- sweep/branches/display-cache/src/about_dialog.c (modified) (3 diffs)
- sweep/branches/display-cache/src/about_dialog.h (modified) (1 diff)
- sweep/branches/display-cache/src/callbacks.c (modified) (81 diffs)
- sweep/branches/display-cache/src/callbacks.h (modified) (1 diff)
- sweep/branches/display-cache/src/channelops.c (modified) (35 diffs)
- sweep/branches/display-cache/src/channelops.h (modified) (1 diff)
- sweep/branches/display-cache/src/cursors.c (modified) (3 diffs)
- sweep/branches/display-cache/src/cursors.h (modified) (3 diffs)
- sweep/branches/display-cache/src/db_ruler.c (modified) (25 diffs)
- sweep/branches/display-cache/src/db_ruler.h (modified) (2 diffs)
- sweep/branches/display-cache/src/db_slider.c (modified) (12 diffs)
- sweep/branches/display-cache/src/db_slider.h (modified) (2 diffs)
- sweep/branches/display-cache/src/display-cache.c (modified) (3 diffs)
- sweep/branches/display-cache/src/display-cache.h (modified) (4 diffs)
- sweep/branches/display-cache/src/driver.c (modified) (22 diffs)
- sweep/branches/display-cache/src/driver.h (modified) (5 diffs)
- sweep/branches/display-cache/src/driver_alsa.c (modified) (20 diffs)
- sweep/branches/display-cache/src/driver_oss.c (modified) (18 diffs)
- sweep/branches/display-cache/src/driver_solaris.c (modified) (7 diffs)
- sweep/branches/display-cache/src/edit.c (modified) (84 diffs)
- sweep/branches/display-cache/src/edit.h (modified) (2 diffs)
- sweep/branches/display-cache/src/file_dialogs.c (modified) (29 diffs)
- sweep/branches/display-cache/src/file_dialogs.h (modified) (1 diff)
- sweep/branches/display-cache/src/file_mad.c (modified) (19 diffs)
- sweep/branches/display-cache/src/file_sndfile.h (modified) (1 diff)
- sweep/branches/display-cache/src/file_sndfile1.c (modified) (35 diffs)
- sweep/branches/display-cache/src/file_speex.c (modified) (90 diffs)
- sweep/branches/display-cache/src/file_vorbis.c (modified) (65 diffs)
- sweep/branches/display-cache/src/format.c (modified) (3 diffs)
- sweep/branches/display-cache/src/format.h (modified) (1 diff)
- sweep/branches/display-cache/src/head.c (modified) (45 diffs)
- sweep/branches/display-cache/src/head.h (modified) (1 diff)
- sweep/branches/display-cache/src/interface.c (modified) (15 diffs)
- sweep/branches/display-cache/src/interface.h (modified) (1 diff)
- sweep/branches/display-cache/src/levelmeter.c (modified) (12 diffs)
- sweep/branches/display-cache/src/levelmeter.h (modified) (3 diffs)
- sweep/branches/display-cache/src/main.c (modified) (7 diffs)
- sweep/branches/display-cache/src/notes.c (modified) (2 diffs)
- sweep/branches/display-cache/src/notes.h (modified) (1 diff)
- sweep/branches/display-cache/src/param.c (modified) (25 diffs)
- sweep/branches/display-cache/src/param.h (modified) (1 diff)
- sweep/branches/display-cache/src/paste_dialogs.c (modified) (15 diffs)
- sweep/branches/display-cache/src/paste_dialogs.h (modified) (1 diff)
- sweep/branches/display-cache/src/pcmio.h (modified) (1 diff)
- sweep/branches/display-cache/src/pixmaps.h (modified) (3 diffs)
- sweep/branches/display-cache/src/play.c (modified) (28 diffs)
- sweep/branches/display-cache/src/play.h (modified) (1 diff)
- sweep/branches/display-cache/src/plugin.c (modified) (4 diffs)
- sweep/branches/display-cache/src/plugin.h (modified) (1 diff)
- sweep/branches/display-cache/src/preferences.c (modified) (15 diffs)
- sweep/branches/display-cache/src/preferences.h (modified) (1 diff)
- sweep/branches/display-cache/src/print.c (modified) (4 diffs)
- sweep/branches/display-cache/src/print.h (modified) (1 diff)
- sweep/branches/display-cache/src/question_dialogs.c (modified) (12 diffs)
- sweep/branches/display-cache/src/question_dialogs.h (modified) (1 diff)
- sweep/branches/display-cache/src/record.c (modified) (20 diffs)
- sweep/branches/display-cache/src/record.h (modified) (1 diff)
- sweep/branches/display-cache/src/sample-display.c (modified) (68 diffs)
- sweep/branches/display-cache/src/sample-display.h (modified) (4 diffs)
- sweep/branches/display-cache/src/sample.c (modified) (19 diffs)
- sweep/branches/display-cache/src/sample.h (modified) (3 diffs)
- sweep/branches/display-cache/src/samplerate.c (modified) (36 diffs)
- sweep/branches/display-cache/src/scroll-pane.c (modified) (12 diffs)
- sweep/branches/display-cache/src/scroll-pane.h (modified) (3 diffs)
- sweep/branches/display-cache/src/sw_chooser.c (modified) (15 diffs)
- sweep/branches/display-cache/src/sw_chooser.h (modified) (2 diffs)
- sweep/branches/display-cache/src/sweep_app.h (modified) (11 diffs)
- sweep/branches/display-cache/src/sweep_filter.c (modified) (7 diffs)
- sweep/branches/display-cache/src/sweep_sample.c (modified) (102 diffs)
- sweep/branches/display-cache/src/sweep_selection.c (modified) (12 diffs)
- sweep/branches/display-cache/src/sweep_sounddata.c (modified) (14 diffs)
- sweep/branches/display-cache/src/sweep_typeconvert.c (modified) (4 diffs)
- sweep/branches/display-cache/src/sweep_undo.c (modified) (33 diffs)
- sweep/branches/display-cache/src/tdb/spinlock.c (modified) (6 diffs)
- sweep/branches/display-cache/src/tdb/spinlock.h (modified) (2 diffs)
- sweep/branches/display-cache/src/tdb/tdb.c (modified) (21 diffs)
- sweep/branches/display-cache/src/tdb/tdb.h (modified) (4 diffs)
- sweep/branches/display-cache/src/time_ruler.c (modified) (19 diffs)
- sweep/branches/display-cache/src/time_ruler.h (modified) (2 diffs)
- sweep/branches/display-cache/src/timeouts.c (modified) (6 diffs)
- sweep/branches/display-cache/src/undo_dialog.c (modified) (15 diffs)
- sweep/branches/display-cache/src/undo_dialog.h (modified) (1 diff)
- sweep/branches/display-cache/src/view.c (modified) (142 diffs)
- sweep/branches/display-cache/src/view.h (modified) (2 diffs)
- sweep/branches/display-cache/src/view_pixmaps.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sweep/branches/display-cache/include/sweep/sweep.h
r124 r471 33 33 #include <sweep/sweep_filter.h> 34 34 35 #endif /* __SWEEP_H__ */ 36 37 38 39 40 41 35 #endif /* __SWEEP_H__ */ sweep/branches/display-cache/include/sweep/sweep_filter.h
r124 r471 26 26 sw_framecount_t nr_frames, 27 27 sw_param_set pset, gpointer custom_data); 28 sw_op_instance * 29 perform_filter_region_op (sw_sample * sample, char * desc,30 SweepFilterRegion func,sw_param_set pset,31 gpointer custom_data);28 sw_op_instance *perform_filter_region_op (sw_sample * sample, char *desc, 29 SweepFilterRegion func, 30 sw_param_set pset, 31 gpointer custom_data); 32 32 33 sw_op_instance * 34 perform_filter_op (sw_sample * sample, char * desc, SweepFilter func,35 sw_param_set pset,gpointer custom_data);33 sw_op_instance *perform_filter_op (sw_sample * sample, char *desc, 34 SweepFilter func, sw_param_set pset, 35 gpointer custom_data); 36 36 37 37 sweep/branches/display-cache/include/sweep/sweep_sample.h
r124 r471 24 24 #include <sweep/sweep_types.h> 25 25 26 sw_sample * 27 sample_new_empty(char * pathname, gint nr_channels, gint sample_rate, 28 gint sample_length); 26 sw_sample *sample_new_empty (char *pathname, gint nr_channels, 27 gint sample_rate, gint sample_length); 29 28 30 sw_sample * 31 sample_new_copy(sw_sample * s); 29 sw_sample *sample_new_copy (sw_sample * s); 32 30 33 void 34 sample_destroy (sw_sample * s); 31 void sample_destroy (sw_sample * s); 35 32 36 sw_sounddata * 37 sample_get_sounddata (sw_sample * s); 33 sw_sounddata *sample_get_sounddata (sw_sample * s); 38 34 39 void 40 sample_set_file_format (sw_sample * s, sw_file_format_t file_format); 35 void sample_set_file_format (sw_sample * s, sw_file_format_t file_format); 41 36 42 void 43 sample_set_pathname (sw_sample * s, char * pathname); 37 void sample_set_pathname (sw_sample * s, char *pathname); 44 38 45 GList * 46 sample_bank_list_names (void); 39 GList *sample_bank_list_names (void); 47 40 48 sw_sample * 49 sample_bank_find_byname (const gchar * name); 41 sw_sample *sample_bank_find_byname (const gchar * name); 50 42 51 gboolean 52 sample_bank_contains (sw_sample *s); 43 gboolean sample_bank_contains (sw_sample * s); 53 44 54 void 55 sample_bank_add (sw_sample * s); 45 void sample_bank_add (sw_sample * s); 56 46 57 void 58 sample_bank_remove (sw_sample * s); 47 void sample_bank_remove (sw_sample * s); 59 48 60 void 61 sample_refresh_views (sw_sample * s); 49 void sample_refresh_views (sw_sample * s); 62 50 63 void 64 sample_start_marching_ants (sw_sample * s); 51 void sample_start_marching_ants (sw_sample * s); 65 52 66 void 67 sample_stop_marching_ants (sw_sample * s); 53 void sample_stop_marching_ants (sw_sample * s); 68 54 69 void 70 sample_set_edit_state (sw_sample * s, sw_edit_state edit_state); 55 void sample_set_edit_state (sw_sample * s, sw_edit_state edit_state); 71 56 72 void 73 sample_set_edit_mode (sw_sample * s, sw_edit_mode edit_mode); 57 void sample_set_edit_mode (sw_sample * s, sw_edit_mode edit_mode); 74 58 75 void 76 sample_refresh_playmode (sw_sample * s); 59 void sample_refresh_playmode (sw_sample * s); 77 60 78 void 79 sample_set_previewing (sw_sample * s, gboolean previewing); 61 void sample_set_previewing (sw_sample * s, gboolean previewing); 80 62 81 void 82 sample_set_stop_offset (sw_sample * s); 63 void sample_set_stop_offset (sw_sample * s); 83 64 84 65 void … … 86 67 gboolean by_user); 87 68 88 void 89 sample_set_rec_marker (sw_sample * s, sw_framecount_t offset); 69 void sample_set_rec_marker (sw_sample * s, sw_framecount_t offset); 90 70 91 void 92 sample_set_scrubbing (sw_sample * s, gboolean scrubbing); 71 void sample_set_scrubbing (sw_sample * s, gboolean scrubbing); 93 72 94 void 95 sample_set_looping (sw_sample * s, gboolean looping); 73 void sample_set_looping (sw_sample * s, gboolean looping); 96 74 97 void 98 sample_set_playrev (sw_sample * s, gboolean reverse); 75 void sample_set_playrev (sw_sample * s, gboolean reverse); 99 76 100 void 101 sample_set_mute (sw_sample * s, gboolean mute); 77 void sample_set_mute (sw_sample * s, gboolean mute); 102 78 103 void 104 sample_set_color (sw_sample * s, gint color); 79 void sample_set_color (sw_sample * s, gint color); 105 80 106 void 107 sample_set_progress_text (sw_sample * s, gchar * text); 81 void sample_set_progress_text (sw_sample * s, gchar * text); 108 82 109 void 110 sample_set_progress_percent (sw_sample * s, gint percent); 83 void sample_set_progress_percent (sw_sample * s, gint percent); 111 84 112 void 113 sample_refresh_progress_percent (sw_sample * s); 85 void sample_refresh_progress_percent (sw_sample * s); 114 86 115 int 116 sample_set_progress_ready (sw_sample * s); 87 int sample_set_progress_ready (sw_sample * s); 117 88 118 void 119 sample_set_tmp_message (sw_sample * s, const char * fmt, ...); 89 void sample_set_tmp_message (sw_sample * s, const char *fmt, ...); 120 90 121 91 /* … … 129 99 * 130 100 */ 131 void 132 sample_replace_throughout (sw_sample * os, sw_sample * s); 101 void sample_replace_throughout (sw_sample * os, sw_sample * s); 133 102 134 103 135 104 /* Selection handling */ 136 105 137 gboolean 138 sample_offset_in_sel (sw_sample * s, sw_framecount_t offset); 106 gboolean sample_offset_in_sel (sw_sample * s, sw_framecount_t offset); 139 107 140 guint 141 sample_sel_nr_regions (sw_sample * s); 108 guint sample_sel_nr_regions (sw_sample * s); 142 109 143 void 144 sample_clear_selection (sw_sample * s); 110 void sample_clear_selection (sw_sample * s); 145 111 146 void 147 sample_add_selection (sw_sample * s, sw_sel * sel); 112 void sample_add_selection (sw_sample * s, sw_sel * sel); 148 113 149 sw_sel * 150 sample_add_selection_1 (sw_sample * s, 151 sw_framecount_t start, sw_framecount_t end); 114 sw_sel *sample_add_selection_1 (sw_sample * s, 115 sw_framecount_t start, sw_framecount_t end); 152 116 153 void 154 sample_set_selection (sw_sample * s, GList * gl); 117 void sample_set_selection (sw_sample * s, GList * gl); 155 118 156 sw_sel * 157 sample_set_selection_1 (sw_sample * s, 158 sw_framecount_t start, sw_framecount_t end); 119 sw_sel *sample_set_selection_1 (sw_sample * s, 120 sw_framecount_t start, sw_framecount_t end); 159 121 160 122 … … 164 126 sw_framecount_t new_start, sw_framecount_t new_end); 165 127 166 void 167 sample_selection_invert (sw_sample * s); 128 void sample_selection_invert (sw_sample * s); 168 129 169 void 170 sample_selection_select_all (sw_sample * s); 130 void sample_selection_select_all (sw_sample * s); 171 131 172 void 173 sample_selection_select_none (sw_sample * s); 132 void sample_selection_select_none (sw_sample * s); 174 133 175 void 176 sample_selection_halve (sw_sample * s); 134 void sample_selection_halve (sw_sample * s); 177 135 178 void 179 sample_selection_double (sw_sample * s); 136 void sample_selection_double (sw_sample * s); 180 137 181 void 182 sample_selection_shift_left (sw_sample * s); 138 void sample_selection_shift_left (sw_sample * s); 183 139 184 void 185 sample_selection_shift_right (sw_sample * s); 140 void sample_selection_shift_right (sw_sample * s); 186 141 187 142 /* info dialog */ 188 void 189 sample_show_info_dialog (sw_sample * sample); 143 void sample_show_info_dialog (sw_sample * sample); 190 144 191 145 sweep/branches/display-cache/include/sweep/sweep_selection.h
r124 r471 22 22 #define __SWEEP_SELECTION_H__ 23 23 24 sw_sel * 25 sel_new (sw_framecount_t start, sw_framecount_t end); 24 sw_sel *sel_new (sw_framecount_t start, sw_framecount_t end); 26 25 27 sw_sel * 28 sel_copy (sw_sel * sel); 26 sw_sel *sel_copy (sw_sel * sel); 29 27 30 GList * 31 sels_add_selection (GList * sels, sw_sel * sel); 28 GList *sels_add_selection (GList * sels, sw_sel * sel); 32 29 33 GList * 34 sels_add_selection_1 (GList * sels, sw_framecount_t start,sw_framecount_t end);30 GList *sels_add_selection_1 (GList * sels, sw_framecount_t start, 31 sw_framecount_t end); 35 32 36 33 /* … … 40 37 * return > 0 if s1 comes after s2 in the sort order. 41 38 */ 42 gint 43 sel_cmp (sw_sel * s1, sw_sel * s2); 39 gint sel_cmp (sw_sel * s1, sw_sel * s2); 44 40 45 41 /* … … 48 44 * returns a copy of sels 49 45 */ 50 GList * 51 sels_copy (GList * sels); 46 GList *sels_copy (GList * sels); 52 47 53 48 /* … … 56 51 * inverts sels in place 57 52 */ 58 GList * 59 sels_invert (GList * sels, sw_framecount_t nr_frames); 53 GList *sels_invert (GList * sels, sw_framecount_t nr_frames); 60 54 61 sw_op_instance * 62 perform_selection_op (sw_sample * s, char * desc, SweepFilter func,63 sw_param_set pset,gpointer custom_data);55 sw_op_instance *perform_selection_op (sw_sample * s, char *desc, 56 SweepFilter func, sw_param_set pset, 57 gpointer custom_data); 64 58 65 59 #endif /* __SWEEP_SELECTION_H__ */ sweep/branches/display-cache/include/sweep/sweep_sounddata.h
r124 r471 22 22 #define __SWEEP_SOUNDDATA_H__ 23 23 24 sw_sounddata * 25 sounddata_new_empty(gint nr_channels, gint sample_rate,gint sample_length);24 sw_sounddata *sounddata_new_empty (gint nr_channels, gint sample_rate, 25 gint sample_length); 26 26 27 void 28 sounddata_destroy (sw_sounddata * sounddata); 27 void sounddata_destroy (sw_sounddata * sounddata); 29 28 30 void 31 sounddata_lock_selection (sw_sounddata * sounddata); 29 void sounddata_lock_selection (sw_sounddata * sounddata); 32 30 33 void 34 sounddata_unlock_selection (sw_sounddata * sounddata); 31 void sounddata_unlock_selection (sw_sounddata * sounddata); 35 32 36 void 37 sounddata_clear_selection (sw_sounddata * sounddata); 33 void sounddata_clear_selection (sw_sounddata * sounddata); 38 34 39 35 /* … … 44 40 */ 45 41 46 void 47 sounddata_normalise_selection (sw_sounddata * sounddata); 42 void sounddata_normalise_selection (sw_sounddata * sounddata); 48 43 49 void 50 sounddata_add_selection (sw_sounddata * sounddata, sw_sel * sel); 44 void sounddata_add_selection (sw_sounddata * sounddata, sw_sel * sel); 51 45 52 sw_sel * 53 sounddata_add_selection_1 (sw_sounddata * sounddata,54 sw_framecount_t start,sw_framecount_t end);46 sw_sel *sounddata_add_selection_1 (sw_sounddata * sounddata, 47 sw_framecount_t start, 48 sw_framecount_t end); 55 49 56 sw_sel * 57 sounddata_set_selection_1 (sw_sounddata * sounddata,58 sw_framecount_t start,sw_framecount_t end);50 sw_sel *sounddata_set_selection_1 (sw_sounddata * sounddata, 51 sw_framecount_t start, 52 sw_framecount_t end); 59 53 60 guint 61 sounddata_selection_nr_regions (sw_sounddata * sounddata); 54 guint sounddata_selection_nr_regions (sw_sounddata * sounddata); 62 55 63 gint 64 sounddata_selection_nr_frames (sw_sounddata * sounddata); 56 gint sounddata_selection_nr_frames (sw_sounddata * sounddata); 65 57 66 gint 67 sounddata_selection_width (sw_sounddata * sounddata); 58 gint sounddata_selection_width (sw_sounddata * sounddata); 68 59 69 void 70 sounddata_selection_translate (sw_sounddata * sounddata, gint delta); 60 void sounddata_selection_translate (sw_sounddata * sounddata, gint delta); 71 61 72 void 73 sounddata_selection_scale (sw_sounddata * sounddata, gfloat scale); 62 void sounddata_selection_scale (sw_sounddata * sounddata, gfloat scale); 74 63 75 64 /* sweep/branches/display-cache/include/sweep/sweep_typeconvert.h
r57 r471 26 26 * in a given format. 27 27 */ 28 glong 29 frames_to_samples (sw_format * format, sw_framecount_t nr_frames); 28 glong frames_to_samples (sw_format * format, sw_framecount_t nr_frames); 30 29 31 30 /* 32 31 * Determine the size in bytes of a number of frames of a given format. 33 32 */ 34 glong 35 frames_to_bytes (sw_format * format, sw_framecount_t nr_frames); 33 glong frames_to_bytes (sw_format * format, sw_framecount_t nr_frames); 36 34 37 35 /* 38 36 * Convert a number of frames to seconds 39 37 */ 40 sw_time_t 41 frames_to_time (sw_format * format, sw_framecount_t nr_frames); 38 sw_time_t frames_to_time (sw_format * format, sw_framecount_t nr_frames); 42 39 43 40 /* 44 41 * Convert seconds to frames 45 42 */ 46 sw_framecount_t 47 time_to_frames (sw_format * format, sw_time_t time); 43 sw_framecount_t time_to_frames (sw_format * format, sw_time_t time); 48 44 49 45 #endif /* __SWEEP_TYPE_CONVERT_H__ */ sweep/branches/display-cache/include/sweep/sweep_types.h
r304 r471 23 23 24 24 #include <glib.h> 25 #include <gdk/gdktypes.h> /* XXX: for GdkModifierType */26 #include <gtk/gtk.h> /* XXX: for info_clist widget */25 #include <gdk/gdktypes.h> /* XXX: for GdkModifierType */ 26 #include <gtk/gtk.h> /* XXX: for info_clist widget */ 27 27 28 28 #include <sys/types.h> … … 54 54 #if 0 55 55 56 #if (SIZEOF_OFF_T == 8) 56 #if (SIZEOF_OFF_T == 8) 57 57 /* For libsndfile version 1 */ 58 58 typedef off_t sw_framecount_t; … … 90 90 * 91 91 */ 92 struct _sw_sel { 92 struct _sw_sel 93 { 93 94 sw_framecount_t sel_start; 94 95 sw_framecount_t sel_end; … … 100 101 * Multichannel data is interleaved: Stereo is stored LR. 101 102 */ 102 struct _sw_format { 103 gint channels; /* nr channels per frame */ 104 gint rate; /* sampling rate (Hz) */ 105 }; 106 107 struct _sw_sounddata { 103 struct _sw_format 104 { 105 gint channels; /* nr channels per frame */ 106 gint rate; /* sampling rate (Hz) */ 107 }; 108 109 struct _sw_sounddata 110 { 108 111 int refcount; 109 112 110 sw_format * format;111 sw_framecount_t nr_frames; /* nr frames */113 sw_format *format; 114 sw_framecount_t nr_frames; /* nr frames */ 112 115 113 116 gpointer data; 114 GMutex * data_mutex;/* Mutex for access to sample data */115 116 GList * sels;/* selection: list of sw_sels */117 GMutex * sels_mutex;/* Mutex for access to sels */117 GMutex *data_mutex; /* Mutex for access to sample data */ 118 119 GList *sels; /* selection: list of sw_sels */ 120 GMutex *sels_mutex; /* Mutex for access to sels */ 118 121 }; 119 122 … … 121 124 122 125 123 typedef enum { 126 typedef enum 127 { 124 128 SWEEP_EDIT_MODE_READY, 125 SWEEP_EDIT_MODE_META, /* modifying metadata: sels etc. */129 SWEEP_EDIT_MODE_META, /* modifying metadata: sels etc. */ 126 130 SWEEP_EDIT_MODE_FILTER, 127 131 SWEEP_EDIT_MODE_ALLOC, 128 132 } sw_edit_mode; 129 133 130 typedef enum { 134 typedef enum 135 { 131 136 SWEEP_EDIT_STATE_IDLE, 132 137 SWEEP_EDIT_STATE_PENDING, … … 136 141 } sw_edit_state; 137 142 138 typedef enum { 143 typedef enum 144 { 139 145 SWEEP_TRANSPORT_STOP, 140 146 SWEEP_TRANSPORT_PLAY, … … 143 149 144 150 /* File formats */ 145 typedef enum { 146 SWEEP_FILE_FORMAT_NONE=0, 147 SWEEP_FILE_FORMAT_BY_EXTENSION=0, 151 typedef enum 152 { 153 SWEEP_FILE_FORMAT_NONE = 0, 154 SWEEP_FILE_FORMAT_BY_EXTENSION = 0, 148 155 SWEEP_FILE_FORMAT_RAW, 149 156 SWEEP_FILE_FORMAT_WAV, … … 165 172 * The length of data available *data is (end - start) 166 173 */ 167 struct _sw_edit_region { 174 struct _sw_edit_region 175 { 168 176 sw_framecount_t start; 169 177 sw_framecount_t end; … … 172 180 }; 173 181 174 struct _sw_edit_buffer { 175 sw_format * format; 176 GList * regions; 182 struct _sw_edit_buffer 183 { 184 sw_format *format; 185 GList *regions; 177 186 gint refcount; 178 187 }; … … 186 195 typedef struct _sw_op_instance sw_op_instance; 187 196 188 struct _sw_operation { 197 struct _sw_operation 198 { 189 199 sw_edit_mode edit_mode; 190 200 SweepCallback _do_; … … 196 206 }; 197 207 198 struct _sw_op_instance { 199 sw_sample * sample; 200 char * description; 201 sw_operation * op; 208 struct _sw_op_instance 209 { 210 sw_sample *sample; 211 char *description; 212 sw_operation *op; 202 213 gpointer do_data; 203 214 gpointer undo_data; … … 208 219 * Basic types for parameters 209 220 */ 210 typedef enum { 221 typedef enum 222 { 211 223 SWEEP_TYPE_BOOL = 0, 212 224 SWEEP_TYPE_INT, … … 218 230 typedef gint sw_int; 219 231 typedef gdouble sw_float; 220 typedef gchar * sw_string;232 typedef gchar *sw_string; 221 233 222 234 … … 225 237 */ 226 238 typedef union _sw_param sw_param; 227 typedef sw_param * sw_param_set; 228 229 union _sw_param { 239 typedef sw_param *sw_param_set; 240 241 union _sw_param 242 { 230 243 sw_bool b; 231 sw_int i;244 sw_int i; 232 245 sw_float f; 233 246 sw_string s; … … 243 256 * the usage of the sw_constraint. 244 257 */ 245 typedef enum { 258 typedef enum 259 { 246 260 /* 247 261 * SW_PARAM_CONSTRAINED_NOT indicates that the parameter is completely … … 253 267 * How free is its life, how wretched its lot! 254 268 */ 255 SW_PARAM_CONSTRAINED_NOT =0,269 SW_PARAM_CONSTRAINED_NOT = 0, 256 270 257 271 /* … … 303 317 #define SW_RANGE_STEP_VALID (1<<2) 304 318 305 #define SW_RANGE_ALL_VALID (SW_RANGE_LOWER_BOUND_VALID|SW_RANGE_UPPER_BOUND_VALID|SW_RANGE_STEP_VALID) 319 #define SW_RANGE_ALL_VALID (SW_RANGE_LOWER_BOUND_VALID|SW_RANGE_UPPER_BOUND_VALID|SW_RANGE_STEP_VALID) 306 320 307 321 /* … … 335 349 */ 336 350 #define SW_PARAM_HINT_FILENAME (1<<3) 337 351 338 352 339 353 typedef struct _sw_param_spec sw_param_spec; … … 355 369 * string parameters. 356 370 */ 357 struct _sw_param_range { 371 struct _sw_param_range 372 { 358 373 int valid_mask; 359 374 sw_param lower; … … 369 384 * All constraints are disregarded for boolean parameters. 370 385 */ 371 union _sw_constraint { 386 union _sw_constraint 387 { 372 388 /* 373 389 * param_list: Values are constrained to those within a list of … … 376 392 * ie. this length = constraint->param_list[0].i 377 393 */ 378 sw_param * list;394 sw_param *list; 379 395 380 396 /* 381 397 * param_range, as described above. 382 398 */ 383 sw_param_range * range;/* param range */399 sw_param_range *range; /* param range */ 384 400 }; 385 401 … … 388 404 * sw_param_spec: specification for a parameter. 389 405 */ 390 struct _sw_param_spec { 406 struct _sw_param_spec 407 { 391 408 /* A short name for this parameter */ 392 gchar * name;409 gchar *name; 393 410 394 411 /* A longer description of the parameter's purpose and usage */ 395 gchar * desc;412 gchar *desc; 396 413 397 414 /* The type of the parameter */ … … 414 431 typedef struct _sw_plugin sw_plugin; 415 432 416 struct _sw_procedure { 417 gchar * name; 418 gchar * description; 419 gchar * author; 420 gchar * copyright; 421 gchar * url; 422 423 gchar * identifier; 433 struct _sw_procedure 434 { 435 gchar *name; 436 gchar *description; 437 gchar *author; 438 gchar *copyright; 439 gchar *url; 440 441 gchar *identifier; 424 442 425 443 /* Key bindings */ … … 428 446 429 447 gint nr_params; 430 sw_param_spec * param_specs;448 sw_param_spec *param_specs; 431 449 432 450 /* suggest sets suggested values for the members of pset, … … 446 464 * If nr_params is 0 then this function will be passed a NULL pset. 447 465 */ 448 sw_op_instance * (*apply) (sw_sample * sample,449 sw_param_set pset, gpointer custom_data);466 sw_op_instance *(*apply) (sw_sample * sample, 467 sw_param_set pset, gpointer custom_data); 450 468 451 469 /* custom data to pass to the suggest and apply functions */ … … 453 471 }; 454 472 455 struct _sw_plugin { 473 struct _sw_plugin 474 { 456 475 /* plugin_init () returns a list of procedures */ 457 GList * (*plugin_init) (void);476 GList *(*plugin_init) (void); 458 477 459 478 /* plugin_cleanup() frees the plugin's private data structures */ … … 461 480 }; 462 481 463 typedef sw_sample * (*SweepFilter) (sw_sample * sample, 464 sw_param_set pset, 465 gpointer custom_data); 466 467 468 #endif /* __SWEEP_TYPES_H__ */ 469 470 471 472 473 474 482 typedef sw_sample *(*SweepFilter) (sw_sample * sample, 483 sw_param_set pset, gpointer custom_data); 484 485 486 #endif /* __SWEEP_TYPES_H__ */ sweep/branches/display-cache/include/sweep/sweep_undo.h
r124 r471 24 24 #include "sweep_types.h" 25 25 26 gint 27 update_edit_progress (gpointer data); 26 gint update_edit_progress (gpointer data); 28 27 29 sw_op_instance * 30 sw_op_instance_new (sw_sample * sample, char * description, 31 sw_operation * operation); 28 sw_op_instance *sw_op_instance_new (sw_sample * sample, char *description, 29 sw_operation * operation); 32 30 33 31 void 34 schedule_operation (sw_sample * sample, char * description,35 sw_operation * operation, void * do_data);32 schedule_operation (sw_sample * sample, char *description, 33 sw_operation * operation, void *do_data); 36 34 37 void 38 register_operation (sw_sample * s, sw_op_instance * inst); 35 void register_operation (sw_sample * s, sw_op_instance * inst); 39 36 40 void 41 trim_registered_ops (sw_sample * s, int length); 37 void trim_registered_ops (sw_sample * s, int length); 42 38 43 void 44 undo_current (sw_sample * s); 39 void undo_current (sw_sample * s); 45 40 46 void 47 redo_current (sw_sample * s); 41 void redo_current (sw_sample * s); 48 42 49 void 50 revert_op (sw_sample * sample, GList * op_gl); 43 void revert_op (sw_sample * sample, GList * op_gl); 51 44 52 void 53 set_active_op (sw_sample * s, sw_op_instance * inst); 45 void set_active_op (sw_sample * s, sw_op_instance * inst); 54 46 55 void 56 cancel_active_op (sw_sample * s); 47 void cancel_active_op (sw_sample * s); 57 48 58 49 /* Stock undo functions */ … … 61 52 typedef struct _replace_data replace_data; 62 53 63 struct _replace_data { 64 sw_sample * old_sample; 65 sw_sample * new_sample; 54 struct _replace_data 55 { 56 sw_sample *old_sample; 57 sw_sample *new_sample; 66 58 }; 67 59 68 replace_data * 69 replace_data_new (sw_sample * old_sample,sw_sample * new_sample);60 replace_data *replace_data_new (sw_sample * old_sample, 61 sw_sample * new_sample); 70 62 71 void 72 undo_by_replace (replace_data * r); 63 void undo_by_replace (replace_data * r); 73 64 74 void 75 redo_by_replace (replace_data * r); 65 void redo_by_replace (replace_data * r); 76 66 #endif 77 67 78 68 typedef struct _sounddata_replace_data sounddata_replace_data; 79 69 80 struct _sounddata_replace_data { 81 sw_sample * sample; 82 sw_sounddata * old_sounddata; 83 sw_sounddata * new_sounddata; 70 struct _sounddata_replace_data 71 { 72 sw_sample *sample; 73 sw_sounddata *old_sounddata; 74 sw_sounddata *new_sounddata; 84 75 }; 85 76 86 sounddata_replace_data * 87 sounddata_replace_data_new (sw_sample * sample, 88 sw_sounddata * old_sounddata, 89 sw_sounddata * new_sounddata); 77 sounddata_replace_data *sounddata_replace_data_new (sw_sample * sample, 78 sw_sounddata * 79 old_sounddata, 80 sw_sounddata * 81 new_sounddata); 90 82 91 void 92 sounddata_replace_data_destroy (sounddata_replace_data * sr); 83 void sounddata_replace_data_destroy (sounddata_replace_data * sr); 93 84 94 void 95 undo_by_sounddata_replace (sw_sample * s, sounddata_replace_data * sr); 85 void undo_by_sounddata_replace (sw_sample * s, sounddata_replace_data * sr); 96 86 97 void 98 redo_by_sounddata_replace (sw_sample * s, sounddata_replace_data * sr); 87 void redo_by_sounddata_replace (sw_sample * s, sounddata_replace_data * sr); 99 88 100 89 101 90 typedef struct _paste_over_data paste_over_data; 102 91 103 struct _paste_over_data { 104 sw_sample * sample; 105 sw_edit_buffer * old_eb; 106 sw_edit_buffer * new_eb; 92 struct _paste_over_data 93 { 94 sw_sample *sample; 95 sw_edit_buffer *old_eb; 96 sw_edit_buffer *new_eb; 107 97 }; 108 98 109 paste_over_data * 110 paste_over_data_new (sw_edit_buffer * old_eb,sw_edit_buffer * new_eb);99 paste_over_data *paste_over_data_new (sw_edit_buffer * old_eb, 100 sw_edit_buffer * new_eb); 111 101 112 void 113 paste_over_data_destroy (paste_over_data * p); 102 void paste_over_data_destroy (paste_over_data * p); 114 103 115 void 116 undo_by_paste_over (sw_sample * s, paste_over_data * p); 104 void undo_by_paste_over (sw_sample * s, paste_over_data * p); 117 105 118 void 119 redo_by_paste_over (sw_sample * s, paste_over_data * p); 106 void redo_by_paste_over (sw_sample * s, paste_over_data * p); 120 107 121 108 122 109 typedef struct _splice_data splice_data; 123 110 124 struct _splice_data { 125 sw_sample * sample; 126 sw_edit_buffer * eb; 127 GList * sels; /* Previous sels of sounddata */ 111 struct _splice_data 112 { 113 sw_sample *sample; 114 sw_edit_buffer *eb; 115 GList *sels; /* Previous sels of sounddata */ 128 116 }; 129 117 130 splice_data * 131 splice_data_new (sw_edit_buffer * eb, GList * sels); 118 splice_data *splice_data_new (sw_edit_buffer * eb, GList * sels); 132 119 133 void 134 splice_data_destroy (splice_data * s); 120 void splice_data_destroy (splice_data * s); 135 121 136 void 137 undo_by_splice_in (sw_sample * s, splice_data * sp); 122 void undo_by_splice_in (sw_sample * s, splice_data * sp); 138 123 139 void 140 redo_by_splice_out (sw_sample * s, splice_data * sp); 124 void redo_by_splice_out (sw_sample * s, splice_data * sp); 141 125 142 void 143 undo_by_splice_out (sw_sample * s, splice_data * sp); 126 void undo_by_splice_out (sw_sample * s, splice_data * sp); 144 127 145 void 146 redo_by_splice_in (sw_sample * s, splice_data * sp); 128 void redo_by_splice_in (sw_sample * s, splice_data * sp); 147 129 148 void 149 undo_by_splice_over (sw_sample * s, splice_data * sp); 130 void undo_by_splice_over (sw_sample * s, splice_data * sp); 150 131 151 void 152 redo_by_splice_over (sw_sample * s, splice_data * sp); 132 void redo_by_splice_over (sw_sample * s, splice_data * sp); 153 133 154 void 155 undo_by_crop_in (sw_sample * s, splice_data * sp); 134 void undo_by_crop_in (sw_sample * s, splice_data * sp); 156 135 157 void 158 redo_by_crop_out (sw_sample * s, splice_data * sp); 136 void redo_by_crop_out (sw_sample * s, splice_data * sp); 159 137 160 138 #endif /* __SWEEP_UNDO_H__ */ sweep/branches/display-cache/intl/bindtextdom.c
r183 r471 70 70 /* Lock variable to protect the global data in the gettext implementation. */ 71 71 __libc_rwlock_define (extern, _nl_state_lock attribute_hidden) 72 73 74 72 /* Names for the libintl functions are a problem. They must not clash 75 73 with existing names and they should follow ANSI C. But this source … … 86 84 # define BIND_TEXTDOMAIN_CODESET libintl_bind_textdomain_codeset 87 85 #endif 88 89 86 /* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP 90 87 to be used for the DOMAINNAME message catalog. … … 93 90 If DIRNAMEP or CODESETP is NULL, the corresponding attribute is neither 94 91 modified nor returned. */ 95 static void96 set_binding_values (const char *domainname,97 const char **dirnamep, const char **codesetp)92 static void 93 set_binding_values (const char *domainname, 94 const char **dirnamep, const char **codesetp) 98 95 { 99 96 struct binding *binding; … … 114 111 modified = 0; 115 112 116 for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) 113 for (binding = _nl_domain_bindings; binding != NULL; 114 binding = binding->next) 117 115 { 118 116 int compare = strcmp (domainname, binding->domainname); … … 140 138 { 141 139 /* The domain is already bound. If the new value and the old 142 one are equal we simply do nothing. Otherwise replace the143 old binding. */140 one are equal we simply do nothing. Otherwise replace the 141 old binding. */ 144 142 char *result = binding->dirname; 145 143 if (strcmp (dirname, result) != 0) 146 144 { 147 if (strcmp (dirname, INTUSE (_nl_default_dirname)) == 0)148 result = (char *) INTUSE (_nl_default_dirname);145 if (strcmp (dirname, INTUSE (_nl_default_dirname)) == 0) 146 result = (char *) INTUSE (_nl_default_dirname); 149 147 else 150 148 { … … 161 159 if (__builtin_expect (result != NULL, 1)) 162 160 { 163 if (binding->dirname != INTUSE (_nl_default_dirname))161 if (binding->dirname != INTUSE (_nl_default_dirname)) 164 162 free (binding->dirname); 165 163 … … 182 180 { 183 181 /* The domain is already bound. If the new value and the old 184 one are equal we simply do nothing. Otherwise replace the185 old binding. */182 one are equal we simply do nothing. Otherwise replace the 183 old binding. */ 186 184 char *result = binding->codeset; 187 185 if (result == NULL || strcmp (codeset, result) != 0) … … 215 213 /* Simply return the default values. */ 216 214 if (dirnamep) 217 *dirnamep = INTUSE (_nl_default_dirname);215 *dirnamep = INTUSE (_nl_default_dirname); 218 216 if (codesetp) 219 217 *codesetp = NULL; … … 224 222 size_t len = strlen (domainname) + 1; 225 223 struct binding *new_binding = 226 (struct binding *) malloc (offsetof (struct binding, domainname) + len); 224 (struct binding *) malloc (offsetof (struct binding, domainname) + 225 len); 227 226 228 227 if (__builtin_expect (new_binding == NULL, 0)) … … 237 236 if (dirname == NULL) 238 237 /* The default value. */ 239 dirname = INTUSE (_nl_default_dirname);238 dirname = INTUSE (_nl_default_dirname); 240 239 else 241 240 { 242 if (strcmp (dirname, INTUSE (_nl_default_dirname)) == 0)243 dirname = INTUSE (_nl_default_dirname);241 if (strcmp (dirname, INTUSE (_nl_default_dirname)) == 0) 242 dirname = INTUSE (_nl_default_dirname); 244 243 else 245 244 { … … 264 263 else 265 264 /* The default value. */ 266 new_binding->dirname = (char *) INTUSE (_nl_default_dirname);265 new_binding->dirname = (char *) INTUSE (_nl_default_dirname); 267 266 268 267 new_binding->codeset_cntr = 0; … … 320 319 { 321 320 failed_codeset: 322 if (new_binding->dirname != INTUSE (_nl_default_dirname))321 if (new_binding->dirname != INTUSE (_nl_default_dirname)) 323 322 free (new_binding->dirname); 324 323 failed_dirname: sweep/branches/display-cache/intl/dcgettext.c
r183 r471 52 52 #ifdef _LIBC 53 53 /* Alias for function name in GNU C Library. */ 54 INTDEF(__dcgettext) 55 weak_alias (__dcgettext, dcgettext); 54 INTDEF (__dcgettext) weak_alias (__dcgettext, dcgettext); 56 55 #endif sweep/branches/display-cache/intl/dcigettext.c
r183 r471 42 42 # else 43 43 # ifdef _AIX 44 #pragma alloca44 #pragma alloca 45 45 # else 46 46 # ifndef alloca … … 291 291 /* Value used as the default domain for gettext(3). */ 292 292 const char *_nl_current_default_domain attribute_hidden 293 = _nl_default_default_domain;293 = _nl_default_default_domain; 294 294 295 295 /* Contains the default location of the message catalogs. */ … … 300 300 INTVARDEF (_nl_default_dirname) 301 301 #endif 302 303 302 /* List with bindings of specific domains created by bindtextdomain() 304 303 calls. */ 305 struct binding *_nl_domain_bindings;304 struct binding *_nl_domain_bindings; 306 305 307 306 /* Prototypes for local functions. */ 308 static char *plural_lookup (struct loaded_l10nfile *domain,309 unsigned long int n,310 const char *translation, size_t translation_len)311 internal_function;312 static const char *guess_category_value (int category,313 const char *categoryname)314 internal_function;307 static char *plural_lookup (struct loaded_l10nfile *domain, 308 unsigned long int n, 309 const char *translation, 310 size_t translation_len) internal_function; 311 static const char *guess_category_value (int category, 312 const char *categoryname) 313 internal_function; 315 314 #ifdef _LIBC 316 315 # include "../locale/localeinfo.h" 317 316 # define category_to_name(category) _nl_category_names[category] 318 317 #else 319 static const char *category_to_name (int category) internal_function;318 static const char *category_to_name (int category) internal_function; 320 319 #endif 321 320 … … 325 324 #ifdef HAVE_ALLOCA 326 325 /* Nothing has to be done. */ 327 # define freea(p) /* nothing */328 # define ADD_BLOCK(list, address) /* nothing */329 # define FREE_BLOCKS(list) /* nothing */330 #else 331 struct block_list332 {333 void *address;334 struct block_list *next;335 };326 # define freea(p) /* nothing */ 327 # define ADD_BLOCK(list, address) /* nothing */ 328 # define FREE_BLOCKS(list) /* nothing */ 329 #else 330 struct block_list 331 { 332 void *address; 333 struct block_list *next; 334 }; 336 335 # define ADD_BLOCK(list, addr) \ 337 336 do { \ … … 357 356 # define alloca(size) (malloc (size)) 358 357 # define freea(p) free (p) 359 #endif /* have alloca */358 #endif /* have alloca */ 360 359 361 360 362 361 #ifdef _LIBC 363 362 /* List of blocks allocated for translations. */ 364 typedef struct transmem_list365 {366 struct transmem_list *next;367 char data[ZERO];368 } transmem_block_t;369 static struct transmem_list *transmem_list;370 #else 371 typedef unsigned char transmem_block_t;363 typedef struct transmem_list 364 { 365 struct transmem_list *next; 366 char data[ZERO]; 367 } transmem_block_t; 368 static struct transmem_list *transmem_list; 369 #else 370 typedef unsigned char transmem_block_t; 372 371 #endif 373 372 … … 387 386 __libc_rwlock_define_initialized (, _nl_state_lock attribute_hidden) 388 387 #endif 389 390 388 /* Checking whether the binaries runs SUID must be done and glibc provides 391 389 easier methods therefore we make a difference here. */ … … 406 404 # define getegid() getgid() 407 405 # endif 408 static int enable_secure;406 static int enable_secure; 409 407 # define ENABLE_SECURE (enable_secure == 1) 410 408 # define DETERMINE_SECURE \ … … 424 422 CATEGORY locale and, if PLURAL is nonzero, search over string 425 423 depending on the plural form determined by N. */ 426 char * 427 DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,428 int plural, unsigned long int n,int category)424 char *DCIGETTEXT (const char *domainname, const char *msgid1, 425 const char *msgid2, int plural, unsigned long int n, 426 int category) 429 427 { 430 428 #ifndef HAVE_ALLOCA … … 454 452 if (category < 0 || category >= __LC_LAST || category == LC_ALL) 455 453 /* Bogus. */ 456 return (plural == 0 457 ? (char *) msgid1 454 return (plural == 0 ? (char *) msgid1 458 455 /* Use the Germanic plural rule. */ 459 456 : n == 1 ? (char *) msgid1 : (char *) msgid2); … … 480 477 some time. */ 481 478 search = (struct known_translation_t *) 482 alloca (offsetof (struct known_translation_t, msgid) + msgid_len);479 alloca (offsetof (struct known_translation_t, msgid) + msgid_len); 483 480 memcpy (search->msgid, msgid1, msgid_len); 484 481 search->domainname = (char *) domainname; … … 508 505 509 506 /* First find matching binding. */ 510 for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) 507 for (binding = _nl_domain_bindings; binding != NULL; 508 binding = binding->next) 511 509 { 512 510 int compare = strcmp (domainname, binding->domainname); … … 523 521 524 522 if (binding == NULL) 525 dirname = (char *) INTUSE (_nl_default_dirname);523 dirname = (char *) INTUSE (_nl_default_dirname); 526 524 else if (IS_ABSOLUTE_PATH (binding->dirname)) 527 525 dirname = binding->dirname; … … 563 561 564 562 domainname_len = strlen (domainname); 565 xdomainname = (char *) alloca (strlen (categoryname) 566 + domainname_len + 5); 563 xdomainname = (char *) alloca (strlen (categoryname) + domainname_len + 5); 567 564 ADD_BLOCK (block_list, xdomainname); 568 565 569 566 stpcpy (mempcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"), 570 domainname, domainname_len), 571 ".mo"); 567 domainname, domainname_len), ".mo"); 572 568 573 569 /* Creating working area. */ … … 607 603 608 604 /* If the current locale value is C (or POSIX) we don't load a 609 domain. Return the MSGID. */605 domain. Return the MSGID. */ 610 606 if (strcmp (single_locale, "C") == 0 611 607 || strcmp (single_locale, "POSIX") == 0) … … 613 609 614 610 /* Find structure describing the message catalog matching the 615 DOMAINNAME and CATEGORY. */611 DOMAINNAME and CATEGORY. */ 616 612 domain = _nl_find_domain (dirname, single_locale, xdomainname, binding); 617 613 … … 640 636 { 641 637 /* Found the translation of MSGID1 in domain DOMAIN: 642 starting at RETVAL, RETLEN bytes. */638 starting at RETVAL, RETLEN bytes. */ 643 639 FREE_BLOCKS (block_list); 644 640 #if defined HAVE_TSEARCH || defined _LIBC … … 655 651 newp->domainname = 656 652 mempcpy (newp->msgid, msgid1, msgid_len); 657 memcpy (newp->domainname, domainname, domainname_len + 1); 653 memcpy (newp->domainname, domainname, 654 domainname_len + 1); 658 655 newp->category = category; 659 656 newp->counter = _nl_msg_cat_cntr; … … 692 689 } 693 690 694 return_untranslated:691 return_untranslated: 695 692 /* Return the untranslated MSGID. */ 696 693 FREE_BLOCKS (block_list); … … 701 698 extern void _nl_log_untranslated (const char *logfilename, 702 699 const char *domainname, 703 const char *msgid1, const char *msgid2,704 int plural);700 const char *msgid1, 701 const char *msgid2, int plural); 705 702 const char *logfilename = getenv ("GETTEXT_LOG_UNTRANSLATED"); 706 703 707 704 if (logfilename != NULL && logfilename[0] != '\0') 708 _nl_log_untranslated (logfilename, domainname, msgid1, msgid2, plural); 705 _nl_log_untranslated (logfilename, domainname, msgid1, msgid2, 706 plural); 709 707 } 710 708 #endif 711 709 __set_errno (saved_errno); 712 return (plural == 0 713 ? (char *) msgid1 710 return (plural == 0 ? (char *) msgid1 714 711 /* Use the Germanic plural rule. */ 715 712 : n == 1 ? (char *) msgid1 : (char *) msgid2); … … 717 714 718 715 719 char * 720 internal_function 716 char *internal_function 721 717 _nl_find_msg (struct loaded_l10nfile *domain_file, 722 718 struct binding *domainbinding, const char *msgid, 723 size_t * lengthp)719 size_t * lengthp) 724 720 { 725 721 struct loaded_domain *domain; … … 764 760 if (nstr < nstrings 765 761 ? W (domain->must_swap, domain->orig_tab[nstr].length) >= len 766 && (strcmp (msgid,767 domain->data + W (domain->must_swap,768 domain->orig_tab[nstr].offset))769 == 0)762 && (strcmp (msgid, 763 domain->data + W (domain->must_swap, 764 domain->orig_tab[nstr].offset)) 765 == 0) 770 766 : domain->orig_sysdep_tab[nstr - nstrings].length > len 771 && (strcmp (msgid,772 domain->orig_sysdep_tab[nstr - nstrings].pointer)773 == 0))767 && (strcmp (msgid, 768 domain->orig_sysdep_tab[nstr - nstrings].pointer) 769 == 0)) 774 770 { 775 771 act = nstr; … … 787 783 { 788 784 /* Try the default method: binary search in the sorted array of 789 messages. */785 messages. */ 790 786 size_t top, bottom; 791 787 … … 811 807 } 812 808 813 found:809 found: 814 810 /* The translation was found at index ACT. If we have to convert the 815 811 string to use a different character set, this is the time. */ … … 831 827 { 832 828 /* The domain's codeset has changed through bind_textdomain_codeset() 833 since the message catalog was initialized or last accessed. We834 have to reinitialize the converter. */829 since the message catalog was initialized or last accessed. We 830 have to reinitialize the converter. */ 835 831 _nl_free_domain_conv (domain); 836 832 _nl_init_domain_conv (domain_file, domain, domainbinding); … … 839 835 if ( 840 836 # ifdef _LIBC 841 domain->conv != (__gconv_t) -1837 domain->conv != (__gconv_t) - 1 842 838 # else 843 839 # if HAVE_ICONV 844 domain->conv != (iconv_t) -1840 domain->conv != (iconv_t) - 1 845 841 # endif 846 842 # endif 847 )843 ) 848 844 { 849 845 /* We are supposed to do a conversion. First allocate an 850 appropriate table with the same structure as the table851 of translations in the file, where we can put the pointers852 to the converted strings in.853 There is a slight complication with plural entries. They854 are represented by consecutive NUL terminated strings. We855 handle this case by converting RESULTLEN bytes, including856 NULs. */846 appropriate table with the same structure as the table 847 of translations in the file, where we can put the pointers 848 to the converted strings in. 849 There is a slight complication with plural entries. They 850 are represented by consecutive NUL terminated strings. We 851 handle this case by converting RESULTLEN bytes, including 852 NULs. */ 857 853 858 854 if (domain->conv_tab == NULL 859 855 && ((domain->conv_tab = 860 (char **) calloc (nstrings + domain->n_sysdep_strings, 861 sizeof (char *))) 862 == NULL)) 856 (char **) calloc (nstrings + domain->n_sysdep_strings, 857 sizeof (char *))) == NULL)) 863 858 /* Mark that we didn't succeed allocating a table. */ 864 859 domain->conv_tab = (char **) -1; … … 932 927 if (iconv (domain->conv, 933 928 (ICONV_CONST char **) &inptr, &inleft, 934 &outptr, &outleft) 935 != (size_t) (-1)) 929 &outptr, &outleft) != (size_t) (-1)) 936 930 { 937 931 outbuf = (unsigned char *) outptr; … … 982 976 # ifdef _LIBC 983 977 /* Add the block to the list of blocks we have to free 984 at some point. */978 at some point. */ 985 979 newmem->next = transmem_list; 986 980 transmem_list = newmem; … … 1004 998 freemem = outbuf; 1005 999 freemem += freemem_size & (alignof (size_t) - 1); 1006 freemem_size = freemem_size & ~ (alignof (size_t) - 1);1000 freemem_size = freemem_size & ~(alignof (size_t) - 1); 1007 1001 1008 1002 __libc_lock_unlock (lock); … … 1010 1004 1011 1005 /* Now domain->conv_tab[act] contains the translation of all 1012 the plural variants. */1006 the plural variants. */ 1013 1007 result = domain->conv_tab[act] + sizeof (size_t); 1014 1008 resultlen = *(size_t *) domain->conv_tab[act]; 1015 1009 } 1016 1010 1017 converted:1011 converted: 1018 1012 /* The result string is converted. */ 1019 1013 … … 1026 1020 1027 1021 /* Look up a plural variant. */ 1028 static char * 1029 internal_function 1022 static char *internal_function 1030 1023 plural_lookup (struct loaded_l10nfile *domain, unsigned long int n, 1031 1024 const char *translation, size_t translation_len) … … 1064 1057 #ifndef _LIBC 1065 1058 /* Return string representation of locale CATEGORY. */ 1066 static const char * 1067 internal_function 1059 static const char *internal_function 1068 1060 category_to_name (int category) 1069 1061 { … … 1071 1063 1072 1064 switch (category) 1073 {1065 { 1074 1066 #ifdef LC_COLLATE 1075 case LC_COLLATE:1076 retval = "LC_COLLATE";1077 break;1067 case LC_COLLATE: 1068 retval = "LC_COLLATE"; 1069 break; 1078 1070 #endif 1079 1071 #ifdef LC_CTYPE 1080 case LC_CTYPE:1081 retval = "LC_CTYPE";1082 break;1072 case LC_CTYPE: 1073 retval = "LC_CTYPE"; 1074 break; 1083 1075 #endif 1084 1076 #ifdef LC_MONETARY 1085 case LC_MONETARY:1086 retval = "LC_MONETARY";1087 break;1077 case LC_MONETARY: 1078 retval = "LC_MONETARY"; 1079 break; 1088 1080 #endif 1089 1081 #ifdef LC_NUMERIC 1090 case LC_NUMERIC:1091 retval = "LC_NUMERIC";1092 break;1082 case LC_NUMERIC: 1083 retval = "LC_NUMERIC"; 1084 break; 1093 1085 #endif 1094 1086 #ifdef LC_TIME 1095 case LC_TIME:1096 retval = "LC_TIME";1097 break;1087 case LC_TIME: 1088 retval = "LC_TIME"; 1089 break; 1098 1090 #endif 1099 1091 #ifdef LC_MESSAGES 1100 case LC_MESSAGES:1101 retval = "LC_MESSAGES";1102 break;1092 case LC_MESSAGES: 1093 retval = "LC_MESSAGES"; 1094 break; 1103 1095 #endif 1104 1096 #ifdef LC_RESPONSE 1105 case LC_RESPONSE:1106 retval = "LC_RESPONSE";1107 break;1097 case LC_RESPONSE: 1098 retval = "LC_RESPONSE"; 1099 break; 1108 1100 #endif 1109 1101 #ifdef LC_ALL 1110 case LC_ALL:1111 /* This might not make sense but is perhaps better than any other1112 value. */1113 retval = "LC_ALL";1114 break;1115 #endif 1116 default:1117 /* If you have a better idea for a default value let me know. */1118 retval = "LC_XXX";1119 }1102 case LC_ALL: 1103 /* This might not make sense but is perhaps better than any other 1104 value. */ 1105 retval = "LC_ALL"; 1106 break; 1107 #endif 1108 default: 1109 /* If you have a better idea for a default value let me know. */ 1110 retval = "LC_XXX"; 1111 } 1120 1112 1121 1113 return retval; … … 1125 1117 /* Guess value of current locale from value of the environment variables 1126 1118 or system-dependent defaults. */ 1127 static const char * 1128 internal_function 1119 static const char *internal_function 1129 1120 guess_category_value (int category, const char *categoryname) 1130 1121 { … … 1138 1129 /* We use the settings in the following order: 1139 1130 1. The value of the environment variable 'LANGUAGE'. This is a GNU 1140 extension. Its value can be a colon-separated list of locale names.1131 extension. Its value can be a colon-separated list of locale names. 1141 1132 2. The value of the environment variable 'LC_ALL', 'LC_xxx', or 'LANG'. 1142 More precisely, the first among these that is set to a non-empty value.1143 This is how POSIX specifies it. The value is a single locale name.1133 More precisely, the first among these that is set to a non-empty value. 1134 This is how POSIX specifies it. The value is a single locale name. 1144 1135 3. A system-dependent preference list of languages. Its value can be a 1145 colon-separated list of locale names.1136 colon-separated list of locale names. 1146 1137 4. A system-dependent default locale name. 1147 1138 This way: 1148 - System-dependent settings can be overridden by environment variables.1149 - If the system provides both a list of languages and a default locale,1150 the former is used. */1139 - System-dependent settings can be overridden by environment variables. 1140 - If the system provides both a list of languages and a default locale, 1141 the former is used. */ 1151 1142 1152 1143 /* Fetch the locale name, through the POSIX method of looking to `LC_ALL', … … 1168 1159 to "C" because 1169 1160 1. "C" locale usually uses the ASCII encoding, and most international 1170 messages use non-ASCII characters. These characters get displayed1171 as question marks (if using glibc's iconv()) or as invalid 8-bit1172 characters (because other iconv()s refuse to convert most non-ASCII1173 characters to ASCII). In any case, the output is ugly.1161 messages use non-ASCII characters. These characters get displayed 1162 as question marks (if using glibc's iconv()) or as invalid 8-bit 1163 characters (because other iconv()s refuse to convert most non-ASCII 1164 characters to ASCII). In any case, the output is ugly. 1174 1165 2. The precise output of some programs in the "C" locale is specified 1175 by POSIX and should not depend on environment variables like1176 "LANGUAGE" or system-dependent information. We allow such programs1177 to use gettext(). */1166 by POSIX and should not depend on environment variables like 1167 "LANGUAGE" or system-dependent information. We allow such programs 1168 to use gettext(). */ 1178 1169 if (strcmp (locale, "C") == 0) 1179 1170 return locale; … … 1191 1182 language_default = _nl_language_preferences_default (); 1192 1183 if (language_default != NULL) 1193 return language_default;1184 return language_default; 1194 1185 } 1195 1186 /* The least priority value is the locale name, if defaulted. */ … … 1234 1225 struct binding *oldp = _nl_domain_bindings; 1235 1226 _nl_domain_bindings = _nl_domain_bindings->next; 1236 if (oldp->dirname != INTUSE (_nl_default_dirname))1227 if (oldp->dirname != INTUSE (_nl_default_dirname)) 1237 1228 /* Yes, this is a pointer comparison. */ 1238 1229 free (oldp->dirname); sweep/branches/display-cache/intl/eval-plural.h
r183 r471 22 22 23 23 /* Evaluate the plural expression and return an index value. */ 24 STATIC 25 unsigned long int 26 internal_function 24 STATIC unsigned long int internal_function 27 25 plural_eval (struct expression *pexp, unsigned long int n) 28 26 { … … 45 43 /* pexp->operation must be lnot. */ 46 44 unsigned long int arg = plural_eval (pexp->val.args[0], n); 47 return ! arg;45 return !arg; 48 46 } 49 47 case 2: sweep/branches/display-cache/intl/explodename.c
r183 r471 56 56 const char **sponsor, const char **revision) 57 57 { 58 enum { undecided, xpg, cen } syntax; 58 enum 59 { undecided, xpg, cen } syntax; 59 60 char *cp; 60 61 int mask; … … 136 137 if (cp[0] == '+') 137 138 { 138 /* Next is special application (CEN syntax). */139 /* Next is special application (CEN syntax). */ 139 140 cp[0] = '\0'; 140 141 *special = ++cp; … … 148 149 if (cp[0] == ',') 149 150 { 150 /* Next is sponsor (CEN syntax). */151 /* Next is sponsor (CEN syntax). */ 151 152 cp[0] = '\0'; 152 153 *sponsor = ++cp; … … 160 161 if (cp[0] == '_') 161 162 { 162 /* Next is revision (CEN syntax). */163 /* Next is revision (CEN syntax). */ 163 164 cp[0] = '\0'; 164 165 *revision = ++cp; sweep/branches/display-cache/intl/finddomain.c
r183 r471 46 46 the DOMAINNAME and CATEGORY parameters with respect to the currently 47 47 established bindings. */ 48 struct loaded_l10nfile * 49 internal_function 48 struct loaded_l10nfile *internal_function 50 49 _nl_find_domain (const char *dirname, char *locale, 51 50 const char *domainname, struct binding *domainbinding) … … 65 64 /* LOCALE can consist of up to four recognized parts for the XPG syntax: 66 65 67 language[_territory[.codeset]][@modifier]66 language[_territory[.codeset]][@modifier] 68 67 69 68 and six parts for the CEN syntax: 70 69 71 language[_territory][+audience][+special][,[sponsor][_revision]]70 language[_territory][+audience][+special][,[sponsor][_revision]] 72 71 73 72 Beside the first part all of them are allowed to be missing. If … … 75 74 looked for. The various parts will be stripped off according to 76 75 the following order: 77 (1) revision78 (2) sponsor79 (3) special80 (4) codeset81 (5) normalized codeset82 (6) territory83 (7) audience/modifier76 (1) revision 77 (2) sponsor 78 (3) special 79 (4) codeset 80 (5) normalized codeset 81 (6) territory 82 (7) audience/modifier 84 83 */ 85 84 … … 113 112 114 113 /* See whether the locale value is an alias. If yes its value 115 *overwrites* the alias name. No test for the original value is116 done. */114 *overwrites* the alias name. No test for the original value is 115 done. */ 117 116 alias_value = _nl_expand_alias (locale); 118 117 if (alias_value != NULL) … … 142 141 generalization. */ 143 142 retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, 144 strlen (dirname) + 1, mask, language, territory, 145 codeset, normalized_codeset, modifier, special, 146 sponsor, revision, domainname, 1); 143 strlen (dirname) + 1, mask, language, 144 territory, codeset, normalized_codeset, 145 modifier, special, sponsor, revision, 146 domainname, 1); 147 147 if (retval == NULL) 148 148 /* This means we are out of core. */ sweep/branches/display-cache/intl/gettextP.h
r183 r471 141 141 struct binding *next; 142 142 char *dirname; 143 int codeset_cntr; /* Incremented each time codeset changes. */143 int codeset_cntr; /* Incremented each time codeset changes. */ 144 144 char *codeset; 145 145 char domainname[ZERO]; … … 158 158 #endif 159 159 160 struct loaded_l10nfile *_nl_find_domain (const char *__dirname, char *__locale, 161 const char *__domainname, 162 struct binding *__domainbinding) 163 internal_function; 164 void _nl_load_domain (struct loaded_l10nfile *__domain, 165 struct binding *__domainbinding) 166 internal_function; 167 void _nl_unload_domain (struct loaded_domain *__domain) 168 internal_function; 169 const char *_nl_init_domain_conv (struct loaded_l10nfile *__domain_file, 170 struct loaded_domain *__domain, 171 struct binding *__domainbinding) 172 internal_function; 173 void _nl_free_domain_conv (struct loaded_domain *__domain) 174 internal_function; 175 176 char *_nl_find_msg (struct loaded_l10nfile *domain_file, 177 struct binding *domainbinding, const char *msgid, 178 size_t *lengthp) 179 internal_function; 180 181 #ifdef _LIBC 182 extern char *__gettext (const char *__msgid); 183 extern char *__dgettext (const char *__domainname, const char *__msgid); 184 extern char *__dcgettext (const char *__domainname, const char *__msgid, 185 int __category); 186 extern char *__ngettext (const char *__msgid1, const char *__msgid2, 187 unsigned long int __n); 188 extern char *__dngettext (const char *__domainname, 189 const char *__msgid1, const char *__msgid2, 190 unsigned long int n); 191 extern char *__dcngettext (const char *__domainname, 192 const char *__msgid1, const char *__msgid2, 193 unsigned long int __n, int __category); 194 extern char *__dcigettext (const char *__domainname, 195 const char *__msgid1, const char *__msgid2, 196 int __plural, unsigned long int __n, 197 int __category); 198 extern char *__textdomain (const char *__domainname); 199 extern char *__bindtextdomain (const char *__domainname, 200 const char *__dirname); 201 extern char *__bind_textdomain_codeset (const char *__domainname, 202 const char *__codeset); 160 struct loaded_l10nfile * 161 _nl_find_domain (const char *__dirname, char *__locale, 162 const char *__domainname, struct binding *__domainbinding) 163 internal_function; 164 void _nl_load_domain (struct loaded_l10nfile *__domain, 165 struct binding *__domainbinding) internal_function; 166 void _nl_unload_domain (struct loaded_domain *__domain) 167 internal_function; 168 const char *_nl_init_domain_conv (struct loaded_l10nfile *__domain_file, 169 struct loaded_domain *__domain, 170 struct binding *__domainbinding) 171 internal_function; 172 void _nl_free_domain_conv (struct loaded_domain *__domain) 173 internal_function; 174 175 char *_nl_find_msg (struct loaded_l10nfile *domain_file, 176 struct binding *domainbinding, const char *msgid, 177 size_t * lengthp) internal_function; 178 179 #ifdef _LIBC 180 extern char *__gettext (const char *__msgid); 181 extern char *__dgettext (const char *__domainname, const char *__msgid); 182 extern char *__dcgettext (const char *__domainname, const char *__msgid, 183 int __category); 184 extern char *__ngettext (const char *__msgid1, const char *__msgid2, 185 unsigned long int __n); 186 extern char *__dngettext (const char *__domainname, 187 const char *__msgid1, const char *__msgid2, 188 unsigned long int n); 189 extern char *__dcngettext (const char *__domainname, 190 const char *__msgid1, const char *__msgid2, 191 unsigned long int __n, int __category); 192 extern char *__dcigettext (const char *__domainname, 193 const char *__msgid1, const char *__msgid2, 194 int __plural, unsigned long int __n, 195 int __category); 196 extern char *__textdomain (const char *__domainname); 197 extern char *__bindtextdomain (const char *__domainname, 198 const char *__dirname); 199 extern char *__bind_textdomain_codeset (const char *__domainname, 200 const char *__codeset); 203 201 #else 204 202 /* Declare the exported libintl_* functions, in a way that allows us to … … 208 206 # define _INTL_REDIRECT_MACROS 209 207 # include "libgnuintl.h" 210 extern char *libintl_dcigettext (const char *__domainname,211 const char *__msgid1, const char *__msgid2,212 int __plural, unsigned long int __n,213 int __category);208 extern char *libintl_dcigettext (const char *__domainname, 209 const char *__msgid1, 210 const char *__msgid2, int __plural, 211 unsigned long int __n, int __category); 214 212 #endif 215 213 sweep/branches/display-cache/intl/gmo.h
r183 r471 64 64 /* The following line is intended to throw an error. Using #error is 65 65 not portable enough. */ 66 "Cannot determine unsigned 32-bit data type."66 "Cannot determine unsigned 32-bit data type." 67 67 # endif 68 68 # endif 69 69 #endif 70 71 72 70 /* Header for binary .mo file format. */ 73 struct mo_file_header71 struct mo_file_header 74 72 { 75 73 /* The magic number. */ … … 147 145 /* @@ begin of epilog @@ */ 148 146 149 #endif /* gettext.h */147 #endif /* gettext.h */ sweep/branches/display-cache/intl/intl-compat.c
r183 r471 57 57 58 58 59 DLL_EXPORTED 60 char * 59 DLL_EXPORTED char * 61 60 gettext (const char *msgid) 62 61 { … … 65 64 66 65 67 DLL_EXPORTED 68 char * 66 DLL_EXPORTED char * 69 67 dgettext (const char *domainname, const char *msgid) 70 68 { … … 73 71 74 72 75 DLL_EXPORTED 76 char * 73 DLL_EXPORTED char * 77 74 dcgettext (const char *domainname, const char *msgid, int category) 78 75 { … … 81 78 82 79 83 DLL_EXPORTED 84 char * 80 DLL_EXPORTED char * 85 81 ngettext (const char *msgid1, const char *msgid2, unsigned long int n) 86 82 { … … 89 85 90 86 91 DLL_EXPORTED 92 char * 87 DLL_EXPORTED char * 93 88 dngettext (const char *domainname, 94 89 const char *msgid1, const char *msgid2, unsigned long int n) … … 98 93 99 94 100 DLL_EXPORTED 101 char * 95 DLL_EXPORTED char * 102 96 dcngettext (const char *domainname, 103 97 const char *msgid1, const char *msgid2, unsigned long int n, … … 108 102 109 103 110 DLL_EXPORTED 111 char * 104 DLL_EXPORTED char * 112 105 textdomain (const char *domainname) 113 106 { … … 116 109 117 110 118 DLL_EXPORTED 119 char * 111 DLL_EXPORTED char * 120 112 bindtextdomain (const char *domainname, const char *dirname) 121 113 { … … 124 116 125 117 126 DLL_EXPORTED 127 char * 118 DLL_EXPORTED char * 128 119 bind_textdomain_codeset (const char *domainname, const char *codeset) 129 120 { sweep/branches/display-cache/intl/l10nflist.c
r183 r471 98 98 return count; 99 99 } 100 100 101 # undef __argz_count 101 102 # define __argz_count(argz, len) argz_count__ (argz, len) … … 104 105 # define __argz_count(argz, len) INTUSE(__argz_count) (argz, len) 105 106 # endif 106 #endif /* !_LIBC && !HAVE___ARGZ_COUNT */107 #endif /* !_LIBC && !HAVE___ARGZ_COUNT */ 107 108 108 109 #if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY … … 121 122 } 122 123 } 124 123 125 # undef __argz_stringify 124 126 # define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep) … … 128 130 INTUSE(__argz_stringify) (argz, len, sep) 129 131 # endif 130 #endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */132 #endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */ 131 133 132 134 #if !defined _LIBC && !defined HAVE___ARGZ_NEXT … … 137 139 { 138 140 if (entry < argz + argz_len) 139 entry = strchr (entry, '\0') + 1;141 entry = strchr (entry, '\0') + 1; 140 142 141 143 return entry >= argz + argz_len ? NULL : (char *) entry; 142 144 } 145 else if (argz_len > 0) 146 return argz; 143 147 else 144 if (argz_len > 0) 145 return argz; 146 else 147 return 0; 148 } 148 return 0; 149 } 150 149 151 # undef __argz_next 150 152 # define __argz_next(argz, len, entry) argz_next__ (argz, len, entry) 151 #endif /* !_LIBC && !HAVE___ARGZ_NEXT */153 #endif /* !_LIBC && !HAVE___ARGZ_NEXT */ 152 154 153 155 … … 164 166 return x; 165 167 } 166 167 168 169 168 170 struct loaded_l10nfile * 169 171 _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list, … … 243 245 { 244 246 /* This component can be part of both syntaces but has different 245 leading characters. For CEN we use `+', else `@'. */247 leading characters. For CEN we use `+', else `@'. */ 246 248 *cp++ = (mask & CEN_AUDIENCE) != 0 ? '+' : '@'; 247 249 cp = stpcpy (cp, modifier); sweep/branches/display-cache/intl/langprefs.c
r183 r471 44 44 _nl_language_preferences_default (void) 45 45 { 46 #if HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.2 or newer */46 #if HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.2 or newer */ 47 47 { 48 48 /* Cache the preferences list, since CoreFoundation calls are expensive. */ … … 58 58 && CFGetTypeID (preferences) == CFArrayGetTypeID ()) 59 59 { 60 CFArrayRef prefArray = (CFArrayRef) preferences;60 CFArrayRef prefArray = (CFArrayRef) preferences; 61 61 int n = CFArrayGetCount (prefArray); 62 62 char buf[256]; … … 69 69 if (element != NULL 70 70 && CFGetTypeID (element) == CFStringGetTypeID () 71 && CFStringGetCString ((CFStringRef) element,71 && CFStringGetCString ((CFStringRef) element, 72 72 buf, sizeof (buf), 73 73 kCFStringEncodingASCII)) … … 99 99 CFArrayGetValueAtIndex (prefArray, i); 100 100 if (element != NULL 101 && CFGetTypeID (element) == CFStringGetTypeID ()102 && CFStringGetCString ((CFStringRef) element,101 && CFGetTypeID (element) == CFStringGetTypeID () 102 && CFStringGetCString ((CFStringRef) element, 103 103 buf, sizeof (buf), 104 104 kCFStringEncodingASCII)) sweep/branches/display-cache/intl/loadinfo.h
r183 r471 99 99 furthermore its ->successor[] field contains a list of other lookup 100 100 results from which this lookup result inherits. */ 101 extern struct loaded_l10nfile * 102 _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list, 103 const char *dirlist, size_t dirlist_len, int mask, 104 const char *language, const char *territory, 105 const char *codeset, const char *normalized_codeset, 106 const char *modifier, const char *special, 107 const char *sponsor, const char *revision, 108 const char *filename, int do_allocate); 101 extern struct loaded_l10nfile *_nl_make_l10nflist (struct loaded_l10nfile 102 **l10nfile_list, 103 const char *dirlist, 104 size_t dirlist_len, 105 int mask, 106 const char *language, 107 const char *territory, 108 const char *codeset, 109 const char 110 *normalized_codeset, 111 const char *modifier, 112 const char *special, 113 const char *sponsor, 114 const char *revision, 115 const char *filename, 116 int do_allocate); 109 117 110 118 /* Lookup the real locale name for a locale alias NAME, or NULL if … … 143 151 extern char *_nl_find_language (const char *name); 144 152 145 #endif /* loadinfo.h */153 #endif /* loadinfo.h */ sweep/branches/display-cache/intl/loadmsgcat.c
r183 r471 47 47 # else 48 48 # ifdef _AIX 49 #pragma alloca49 #pragma alloca 50 50 # else 51 51 # ifndef alloca … … 468 468 some additional code emulating it. */ 469 469 #ifdef HAVE_ALLOCA 470 # define freea(p) /* nothing */470 # define freea(p) /* nothing */ 471 471 #else 472 472 # define alloca(n) malloc (n) … … 754 754 #if defined _LIBC || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) 755 755 /* The 'I' flag, in numeric format directives, replaces ASCII digits 756 with the 'outdigits' defined in the LC_CTYPE locale facet. This is757 used for Farsi (Persian) and maybe Arabic. */756 with the 'outdigits' defined in the LC_CTYPE locale facet. This is 757 used for Farsi (Persian) and maybe Arabic. */ 758 758 return "I"; 759 759 #else … … 767 767 /* Initialize the codeset dependent parts of an opened message catalog. 768 768 Return the header entry. */ 769 const char * 770 internal_function 769 const char *internal_function 771 770 _nl_init_domain_conv (struct loaded_l10nfile *domain_file, 772 771 struct loaded_domain *domain, … … 785 784 (domainbinding != NULL ? domainbinding->codeset_cntr : 0); 786 785 #ifdef _LIBC 787 domain->conv = (__gconv_t) - 1;786 domain->conv = (__gconv_t) - 1; 788 787 #else 789 788 # if HAVE_ICONV 790 domain->conv = (iconv_t) - 1;789 domain->conv = (iconv_t) - 1; 791 790 # endif 792 791 #endif … … 847 846 charset = norm_add_slashes (charset, NULL); 848 847 if (__gconv_open (outcharset, charset, &domain->conv, 849 GCONV_AVOID_NOCONV) 850 != __GCONV_OK) 851 domain->conv = (__gconv_t) -1; 848 GCONV_AVOID_NOCONV) != __GCONV_OK) 849 domain->conv = (__gconv_t) - 1; 852 850 # else 853 851 # if HAVE_ICONV … … 885 883 886 884 /* Frees the codeset dependent parts of an opened message catalog. */ 887 void 888 internal_function 885 void internal_function 889 886 _nl_free_domain_conv (struct loaded_domain *domain) 890 887 { … … 893 890 894 891 #ifdef _LIBC 895 if (domain->conv != (__gconv_t) - 1)892 if (domain->conv != (__gconv_t) - 1) 896 893 __gconv_close (domain->conv); 897 894 #else 898 895 # if HAVE_ICONV 899 if (domain->conv != (iconv_t) - 1)896 if (domain->conv != (iconv_t) - 1) 900 897 iconv_close (domain->conv); 901 898 # endif … … 905 902 /* Load the message catalogs specified by FILENAME. If it is no valid 906 903 message catalog do nothing. */ 907 void 908 internal_function 904 void internal_function 909 905 _nl_load_domain (struct loaded_l10nfile *domain_file, 910 906 struct binding *domainbinding) … … 945 941 if ( 946 942 #ifdef _LIBC 947 __builtin_expect (fstat64 (fd, &st) != 0, 0)943 __builtin_expect (fstat64 (fd, &st) != 0, 0) 948 944 #else 949 __builtin_expect (fstat (fd, &st) != 0, 0)950 #endif 951 || __builtin_expect ((size = (size_t) st.st_size) != st.st_size, 0)952 || __builtin_expect (size < sizeof (struct mo_file_header), 0))945 __builtin_expect (fstat (fd, &st) != 0, 0) 946 #endif 947 || __builtin_expect ((size = (size_t) st.st_size) != st.st_size, 0) 948 || __builtin_expect (size < sizeof (struct mo_file_header), 0)) 953 949 { 954 950 /* Something went wrong. */ … … 1006 1002 /* Using the magic number we can test whether it really is a message 1007 1003 catalog file. */ 1008 if (__builtin_expect (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED,1009 0))1004 if (__builtin_expect 1005 (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED, 0)) 1010 1006 { 1011 1007 /* The magic number is wrong: not a message catalog file. */ … … 1046 1042 (domain->hash_size > 2 1047 1043 ? (const nls_uint32 *) 1048 ((char *) data + W (domain->must_swap, data->hash_tab_offset))1044 ((char *) data + W (domain->must_swap, data->hash_tab_offset)) 1049 1045 : NULL); 1050 1046 domain->must_swap_hash_tab = domain->must_swap; … … 1067 1063 goto invalid; 1068 1064 1069 n_sysdep_strings = 1070 W (domain->must_swap, data->n_sysdep_strings); 1065 n_sysdep_strings = W (domain->must_swap, data->n_sysdep_strings); 1071 1066 if (n_sysdep_strings > 0) 1072 1067 { … … 1106 1101 } 1107 1102 1108 sysdep_segment_values[i] = get_sysdep_segment_value (name); 1103 sysdep_segment_values[i] = 1104 get_sysdep_segment_value (name); 1109 1105 } 1110 1106 … … 1131 1127 const struct sysdep_string *sysdep_string = 1132 1128 (const struct sysdep_string *) 1133 ((char *) data 1134 + W (domain->must_swap, 1135 j == 0 1136 ? orig_sysdep_tab[i] 1137 : trans_sysdep_tab[i])); 1129 ((char *) data + W (domain->must_swap, 1130 j == 0 1131 ? orig_sysdep_tab[i] 1132 : trans_sysdep_tab[i])); 1138 1133 size_t need = 0; 1139 const struct segment_pair *p = sysdep_string->segments; 1140 1141 if (W (domain->must_swap, p->sysdepref) != SEGMENTS_END) 1134 const struct segment_pair *p = 1135 sysdep_string->segments; 1136 1137 if (W (domain->must_swap, p->sysdepref) != 1138 SEGMENTS_END) 1142 1139 for (p = sysdep_string->segments;; p++) 1143 1140 { … … 1164 1161 } 1165 1162 1166 need += strlen (sysdep_segment_values[sysdepref]); 1163 need += 1164 strlen (sysdep_segment_values[sysdepref]); 1167 1165 } 1168 1166 … … 1179 1177 } 1180 1178 memneed += 2 * n_inmem_sysdep_strings 1181 * sizeof (struct sysdep_string_desc);1179 * sizeof (struct sysdep_string_desc); 1182 1180 1183 1181 if (n_inmem_sysdep_strings > 0) … … 1193 1191 inmem_orig_sysdep_tab = (struct sysdep_string_desc *) mem; 1194 1192 mem += n_inmem_sysdep_strings 1195 * sizeof (struct sysdep_string_desc); 1196 inmem_trans_sysdep_tab = (struct sysdep_string_desc *) mem; 1197 mem += n_inmem_sysdep_strings 1198 * sizeof (struct sysdep_string_desc); 1193 * sizeof (struct sysdep_string_desc); 1194 inmem_trans_sysdep_tab = 1195 (struct sysdep_string_desc *) mem; 1196 mem += 1197 n_inmem_sysdep_strings * 1198 sizeof (struct sysdep_string_desc); 1199 1199 inmem_hash_tab = (nls_uint32 *) mem; 1200 1200 mem += domain->hash_size * sizeof (nls_uint32); … … 1210 1210 const struct sysdep_string *sysdep_string = 1211 1211 (const struct sysdep_string *) 1212 ((char *) data 1213 + W (domain->must_swap, 1214 j == 0 1215 ? orig_sysdep_tab[i] 1216 : trans_sysdep_tab[i])); 1212 ((char *) data + W (domain->must_swap, 1213 j == 0 1214 ? orig_sysdep_tab[i] 1215 : trans_sysdep_tab[i])); 1217 1216 const struct segment_pair *p = 1218 1217 sysdep_string->segments; … … 1229 1228 break; 1230 1229 1231 if (sysdep_segment_values[sysdepref] == NULL) 1230 if (sysdep_segment_values[sysdepref] == 1231 NULL) 1232 1232 { 1233 1233 /* This particular string pair is 1234 invalid. */1234 invalid. */ 1235 1235 valid = 0; 1236 1236 break; … … 1248 1248 const struct sysdep_string *sysdep_string = 1249 1249 (const struct sysdep_string *) 1250 ((char *) data 1251 + W (domain->must_swap, 1252 j == 0 1253 ? orig_sysdep_tab[i] 1254 : trans_sysdep_tab[i])); 1250 ((char *) data + W (domain->must_swap, 1251 j == 0 1252 ? orig_sysdep_tab[i] 1253 : trans_sysdep_tab[i])); 1255 1254 const char *static_segments = 1256 1255 (char *) data 1257 + W (domain->must_swap, sysdep_string->offset); 1256 + W (domain->must_swap, 1257 sysdep_string->offset); 1258 1258 const struct segment_pair *p = 1259 1259 sysdep_string->segments; … … 1266 1266 (j == 0 1267 1267 ? inmem_orig_sysdep_tab 1268 : inmem_trans_sysdep_tab) 1269 + k; 1268 : inmem_trans_sysdep_tab) + k; 1270 1269 1271 1270 if (W (domain->must_swap, p->sysdepref) … … 1275 1274 inmem_tab_entry->length = 1276 1275 W (domain->must_swap, p->segsize); 1277 inmem_tab_entry->pointer = static_segments; 1276 inmem_tab_entry->pointer = 1277 static_segments; 1278 1278 } 1279 1279 else … … 1291 1291 if (segsize > 0) 1292 1292 { 1293 memcpy (mem, static_segments, segsize); 1293 memcpy (mem, static_segments, 1294 segsize); 1294 1295 mem += segsize; 1295 1296 static_segments += segsize; … … 1299 1300 break; 1300 1301 1301 n = strlen (sysdep_segment_values[sysdepref]); 1302 memcpy (mem, sysdep_segment_values[sysdepref], n); 1302 n = 1303 strlen (sysdep_segment_values 1304 [sysdepref]); 1305 memcpy (mem, 1306 sysdep_segment_values 1307 [sysdepref], n); 1303 1308 mem += n; 1304 1309 } … … 1332 1337 { 1333 1338 /* Hash table entry is empty. Use it. */ 1334 inmem_hash_tab[idx] = 1 + domain->nstrings + i; 1339 inmem_hash_tab[idx] = 1340 1 + domain->nstrings + i; 1335 1341 break; 1336 1342 } … … 1397 1403 1398 1404 #ifdef _LIBC 1399 void 1400 internal_function 1405 void internal_function 1401 1406 _nl_unload_domain (struct loaded_domain *domain) 1402 1407 { sweep/branches/display-cache/intl/localcharset.c
r409 r471 42 42 43 43 #if defined _WIN32 || defined __WIN32__ 44 # undef WIN32 /* avoid warning on mingw32 */44 # undef WIN32 /* avoid warning on mingw32 */ 45 45 # define WIN32 46 46 #endif … … 99 99 are atomic. But I don't know what will happen if the two assignments mix. */ 100 100 #if __STDC__ != 1 101 # define volatile /* empty */101 # define volatile /* empty */ 102 102 #endif 103 103 /* Pointer to the contents of the charset.alias file, if it has already been 104 104 read, else NULL. Its format is: 105 105 ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */ 106 static const char * volatile charset_aliases;106 static const char *volatile charset_aliases; 107 107 108 108 /* Return a pointer to the contents of the charset.alias file. */ … … 122 122 123 123 /* Make it possible to override the charset.alias location. This is 124 necessary for running the testsuite before "make install". */124 necessary for running the testsuite before "make install". */ 125 125 dir = getenv ("CHARSETALIASDIR"); 126 126 if (dir == NULL || dir[0] == '\0') … … 154 154 { 155 155 int c; 156 char buf1[50 +1];157 char buf2[50 +1];156 char buf1[50 + 1]; 157 char buf2[50 + 1]; 158 158 size_t l1, l2; 159 159 char *old_res_ptr; … … 218 218 # if defined VMS 219 219 /* To avoid the troubles of an extra file charset.alias_vms in the 220 sources of many GNU packages, simply inline the aliases here. */220 sources of many GNU packages, simply inline the aliases here. */ 221 221 /* The list of encodings is taken from the OpenVMS 7.3-1 documentation 222 "Compaq C Run-Time Library Reference Manual for OpenVMS systems"223 section 10.7 "Handling Different Character Sets". */222 "Compaq C Run-Time Library Reference Manual for OpenVMS systems" 223 section 10.7 "Handling Different Character Sets". */ 224 224 cp = "ISO8859-1" "\0" "ISO-8859-1" "\0" 225 "ISO8859-2" "\0" "ISO-8859-2" "\0" 226 "ISO8859-5" "\0" "ISO-8859-5" "\0" 227 "ISO8859-7" "\0" "ISO-8859-7" "\0" 228 "ISO8859-8" "\0" "ISO-8859-8" "\0" 229 "ISO8859-9" "\0" "ISO-8859-9" "\0" 230 /* Japanese */ 231 "eucJP" "\0" "EUC-JP" "\0" 232 "SJIS" "\0" "SHIFT_JIS" "\0" 233 "DECKANJI" "\0" "DEC-KANJI" "\0" 234 "SDECKANJI" "\0" "EUC-JP" "\0" 235 /* Chinese */ 236 "eucTW" "\0" "EUC-TW" "\0" 237 "DECHANYU" "\0" "DEC-HANYU" "\0" 238 "DECHANZI" "\0" "GB2312" "\0" 239 /* Korean */ 240 "DECKOREAN" "\0" "EUC-KR" "\0"; 225 "ISO8859-2" "\0" "ISO-8859-2" "\0" 226 "ISO8859-5" "\0" "ISO-8859-5" "\0" 227 "ISO8859-7" "\0" "ISO-8859-7" "\0" 228 "ISO8859-8" "\0" "ISO-8859-8" "\0" "ISO8859-9" "\0" "ISO-8859-9" "\0" 229 /* Japanese */ 230 "eucJP" "\0" "EUC-JP" "\0" 231 "SJIS" "\0" "SHIFT_JIS" "\0" 232 "DECKANJI" "\0" "DEC-KANJI" "\0" "SDECKANJI" "\0" "EUC-JP" "\0" 233 /* Chinese */ 234 "eucTW" "\0" "EUC-TW" "\0" 235 "DECHANYU" "\0" "DEC-HANYU" "\0" "DECHANZI" "\0" "GB2312" "\0" 236 /* Korean */ 237 "DECKOREAN" "\0" "EUC-KR" "\0"; 241 238 # endif 242 239 243 240 # if defined WIN32 244 241 /* To avoid the troubles of installing a separate file in the same 245 directory as the DLL and of retrieving the DLL's directory at246 runtime, simply inline the aliases here. */242 directory as the DLL and of retrieving the DLL's directory at 243 runtime, simply inline the aliases here. */ 247 244 248 245 cp = "CP936" "\0" "GBK" "\0" 249 "CP1361" "\0" "JOHAB" "\0" 250 "CP20127" "\0" "ASCII" "\0" 251 "CP20866" "\0" "KOI8-R" "\0" 252 "CP21866" "\0" "KOI8-RU" "\0" 253 "CP28591" "\0" "ISO-8859-1" "\0" 254 "CP28592" "\0" "ISO-8859-2" "\0" 255 "CP28593" "\0" "ISO-8859-3" "\0" 256 "CP28594" "\0" "ISO-8859-4" "\0" 257 "CP28595" "\0" "ISO-8859-5" "\0" 258 "CP28596" "\0" "ISO-8859-6" "\0" 259 "CP28597" "\0" "ISO-8859-7" "\0" 260 "CP28598" "\0" "ISO-8859-8" "\0" 261 "CP28599" "\0" "ISO-8859-9" "\0" 262 "CP28605" "\0" "ISO-8859-15" "\0"; 246 "CP1361" "\0" "JOHAB" "\0" 247 "CP20127" "\0" "ASCII" "\0" 248 "CP20866" "\0" "KOI8-R" "\0" 249 "CP21866" "\0" "KOI8-RU" "\0" 250 "CP28591" "\0" "ISO-8859-1" "\0" 251 "CP28592" "\0" "ISO-8859-2" "\0" 252 "CP28593" "\0" "ISO-8859-3" "\0" 253 "CP28594" "\0" "ISO-8859-4" "\0" 254 "CP28595" "\0" "ISO-8859-5" "\0" 255 "CP28596" "\0" "ISO-8859-6" "\0" 256 "CP28597" "\0" "ISO-8859-7" "\0" 257 "CP28598" "\0" "ISO-8859-8" "\0" 258 "CP28599" "\0" "ISO-8859-9" "\0" "CP28605" "\0" "ISO-8859-15" "\0"; 263 259 # endif 264 260 #endif … … 363 359 { 364 360 memcpy (buf, dot, modifier - dot); 365 buf [modifier - dot] = '\0';361 buf[modifier - dot] = '\0'; 366 362 return buf; 367 363 } sweep/branches/display-cache/intl/localcharset.h
r183 r471 23 23 24 24 #ifdef __cplusplus 25 extern "C" { 25 extern "C" 26 { 26 27 #endif 27 28 … … 32 33 If the canonical name cannot be determined, the result is a non-canonical 33 34 name. */ 34 extern const char *locale_charset (void);35 extern const char *locale_charset (void); 35 36 36 37 … … 40 41 41 42 42 #endif /* _LOCALCHARSET_H */43 #endif /* _LOCALCHARSET_H */ sweep/branches/display-cache/intl/localealias.c
r183 r471 48 48 # else 49 49 # ifdef _AIX 50 #pragma alloca50 #pragma alloca 51 51 # else 52 52 # ifndef alloca … … 105 105 some additional code emulating it. */ 106 106 #ifdef HAVE_ALLOCA 107 # define freea(p) /* nothing */107 # define freea(p) /* nothing */ 108 108 #else 109 109 # define alloca(n) malloc (n) … … 141 141 142 142 /* Prototypes for local functions. */ 143 static size_t read_alias_file (const char *fname, int fname_len)144 internal_function; 145 static int extend_alias_table (void);146 static int alias_compare (const struct alias_map *map1, 147 const struct alias_map *map2); 148 149 150 const char * 151 _nl_expand_alias (const char *name)143 static size_t 144 read_alias_file (const char *fname, int fname_len) 145 internal_function; 146 static int extend_alias_table (void); 147 static int alias_compare (const struct alias_map *map1, 148 const struct alias_map *map2); 149 150 151 const char *_nl_expand_alias (const char *name) 152 152 { 153 153 static const char *locale_alias_path; … … 172 172 retval = (struct alias_map *) bsearch (&item, map, nmap, 173 173 sizeof (struct alias_map), 174 (int (*) (const void *,175 const void *)176 )alias_compare);174 (int (*)(const void *, 175 const void *)) 176 alias_compare); 177 177 else 178 178 retval = NULL; … … 213 213 214 214 215 static size_t 216 internal_function 215 static size_t internal_function 217 216 read_alias_file (const char *fname, int fname_len) 218 217 { … … 245 244 { 246 245 /* It is a reasonable approach to use a fix buffer here because 247 a) we are only interested in the first two fields248 b) these fields must be usable as file names and so must not249 be that long250 We avoid a multi-kilobyte buffer here since this would use up251 stack space which we might not have if the program ran out of252 memory. */246 a) we are only interested in the first two fields 247 b) these fields must be usable as file names and so must not 248 be that long 249 We avoid a multi-kilobyte buffer here since this would use up 250 stack space which we might not have if the program ran out of 251 memory. */ 253 252 char buf[400]; 254 253 char *alias; … … 345 344 346 345 /* Possibly not the whole line fits into the buffer. Ignore 347 the rest of the line. */346 the rest of the line. */ 348 347 while (strchr (buf, '\n') == NULL) 349 348 if (FGETS (buf, sizeof buf, fp) == NULL) … … 359 358 if (added > 0) 360 359 qsort (map, nmap, sizeof (struct alias_map), 361 (int (*) (const void *, const void *)) alias_compare);360 (int (*)(const void *, const void *)) alias_compare); 362 361 363 362 return added; … … 400 399 { 401 400 /* I know this seems to be odd but the tolower() function in 402 some systems libc cannot handle nonalpha characters. */401 some systems libc cannot handle nonalpha characters. */ 403 402 c1 = isupper (*p1) ? tolower (*p1) : *p1; 404 403 c2 = isupper (*p2) ? tolower (*p2) : *p2; sweep/branches/display-cache/intl/localename.c
r183 r471 39 39 40 40 #if defined _WIN32 || defined __WIN32__ 41 # undef WIN32 /* avoid warning on mingw32 */41 # undef WIN32 /* avoid warning on mingw32 */ 42 42 # define WIN32 43 43 #endif … … 714 714 MacOS X 10.3.8 function 715 715 CFLocaleCreateCanonicalLocaleIdentifierFromString(). */ 716 typedef struct { const char legacy[21+1]; const char unixy[5+1]; } 717 legacy_entry; 716 typedef struct 717 { 718 const char legacy[21 + 1]; 719 const char unixy[5 + 1]; 720 } 721 legacy_entry; 718 722 static const legacy_entry legacy_table[] = { 719 { "Afrikaans", "af"},720 { "Albanian", "sq"},721 { "Amharic", "am"},722 { "Arabic", "ar"},723 { "Armenian", "hy"},724 { "Assamese", "as"},725 { "Aymara", "ay"},726 { "Azerbaijani", "az"},727 { "Basque", "eu"},728 { "Belarusian", "be"},729 { "Belorussian", "be"},730 { "Bengali", "bn"},731 { "Brazilian Portugese", "pt_BR"},732 { "Brazilian Portuguese", "pt_BR"},733 { "Breton", "br"},734 { "Bulgarian", "bg"},735 { "Burmese", "my"},736 { "Byelorussian", "be"},737 { "Catalan", "ca"},738 { "Chewa", "ny"},739 { "Chichewa", "ny"},740 { "Chinese", "zh"},741 { "Chinese, Simplified", "zh_CN"},742 { "Chinese, Traditional", "zh_TW"},743 { "Chinese, Tradtional", "zh_TW"},744 { "Croatian", "hr"},745 { "Czech", "cs"},746 { "Danish", "da"},747 { "Dutch", "nl"},748 { "Dzongkha", "dz"},749 { "English", "en"},750 { "Esperanto", "eo"},751 { "Estonian", "et"},752 { "Faroese", "fo"},753 { "Farsi", "fa"},754 { "Finnish", "fi"},755 { "Flemish", "nl_BE"},756 { "French", "fr"},757 { "Galician", "gl"},758 { "Gallegan", "gl"},759 { "Georgian", "ka"},760 { "German", "de"},761 { "Greek", "el"},762 { "Greenlandic", "kl"},763 { "Guarani", "gn"},764 { "Gujarati", "gu"},765 { "Hawaiian", "haw" },/* Yes, "haw", not "cpe". */766 { "Hebrew", "he"},767 { "Hindi", "hi"},768 { "Hungarian", "hu"},769 { "Icelandic", "is"},770 { "Indonesian", "id"},771 { "Inuktitut", "iu"},772 { "Irish", "ga"},773 { "Italian", "it"},774 { "Japanese", "ja"},775 { "Javanese", "jv"},776 { "Kalaallisut", "kl"},777 { "Kannada", "kn"},778 { "Kashmiri", "ks"},779 { "Kazakh", "kk"},780 { "Khmer", "km"},781 { "Kinyarwanda", "rw"},782 { "Kirghiz", "ky"},783 { "Korean", "ko"},784 { "Kurdish", "ku"},785 { "Latin", "la"},786 { "Latvian", "lv"},787 { "Lithuanian", "lt"},788 { "Macedonian", "mk"},789 { "Malagasy", "mg"},790 { "Malay", "ms"},791 { "Malayalam", "ml"},792 { "Maltese", "mt"},793 { "Manx", "gv"},794 { "Marathi", "mr"},795 { "Moldavian", "mo"},796 { "Mongolian", "mn"},797 { "Nepali", "ne"},798 { "Norwegian", "nb" },/* Yes, "nb", not the obsolete "no". */799 { "Nyanja", "ny"},800 { "Nynorsk", "nn"},801 { "Oriya", "or"},802 { "Oromo", "om"},803 { "Panjabi", "pa"},804 { "Pashto", "ps"},805 { "Persian", "fa"},806 { "Polish", "pl"},807 { "Portuguese", "pt"},808 { "Portuguese, Brazilian", "pt_BR"},809 { "Punjabi", "pa"},810 { "Pushto", "ps"},811 { "Quechua", "qu"},812 { "Romanian", "ro"},813 { "Ruanda", "rw"},814 { "Rundi", "rn"},815 { "Russian", "ru"},816 { "Sami", "se_NO" },/* Not just "se". */817 { "Sanskrit", "sa"},818 { "Scottish", "gd"},819 { "Serbian", "sr"},820 { "Simplified Chinese", "zh_CN"},821 { "Sindhi", "sd"},822 { "Sinhalese", "si"},823 { "Slovak", "sk"},824 { "Slovenian", "sl"},825 { "Somali", "so"},826 { "Spanish", "es"},827 { "Sundanese", "su"},828 { "Swahili", "sw"},829 { "Swedish", "sv"},830 { "Tagalog", "tl"},831 { "Tajik", "tg"},832 { "Tajiki", "tg"},833 { "Tamil", "ta"},834 { "Tatar", "tt"},835 { "Telugu", "te"},836 { "Thai", "th"},837 { "Tibetan", "bo"},838 { "Tigrinya", "ti"},839 { "Tongan", "to"},840 { "Traditional Chinese", "zh_TW"},841 { "Turkish", "tr"},842 { "Turkmen", "tk"},843 { "Uighur", "ug"},844 { "Ukrainian", "uk"},845 { "Urdu", "ur"},846 { "Uzbek", "uz"},847 { "Vietnamese", "vi"},848 { "Welsh", "cy"},849 { "Yiddish", "yi"}723 {"Afrikaans", "af"}, 724 {"Albanian", "sq"}, 725 {"Amharic", "am"}, 726 {"Arabic", "ar"}, 727 {"Armenian", "hy"}, 728 {"Assamese", "as"}, 729 {"Aymara", "ay"}, 730 {"Azerbaijani", "az"}, 731 {"Basque", "eu"}, 732 {"Belarusian", "be"}, 733 {"Belorussian", "be"}, 734 {"Bengali", "bn"}, 735 {"Brazilian Portugese", "pt_BR"}, 736 {"Brazilian Portuguese", "pt_BR"}, 737 {"Breton", "br"}, 738 {"Bulgarian", "bg"}, 739 {"Burmese", "my"}, 740 {"Byelorussian", "be"}, 741 {"Catalan", "ca"}, 742 {"Chewa", "ny"}, 743 {"Chichewa", "ny"}, 744 {"Chinese", "zh"}, 745 {"Chinese, Simplified", "zh_CN"}, 746 {"Chinese, Traditional", "zh_TW"}, 747 {"Chinese, Tradtional", "zh_TW"}, 748 {"Croatian", "hr"}, 749 {"Czech", "cs"}, 750 {"Danish", "da"}, 751 {"Dutch", "nl"}, 752 {"Dzongkha", "dz"}, 753 {"English", "en"}, 754 {"Esperanto", "eo"}, 755 {"Estonian", "et"}, 756 {"Faroese", "fo"}, 757 {"Farsi", "fa"}, 758 {"Finnish", "fi"}, 759 {"Flemish", "nl_BE"}, 760 {"French", "fr"}, 761 {"Galician", "gl"}, 762 {"Gallegan", "gl"}, 763 {"Georgian", "ka"}, 764 {"German", "de"}, 765 {"Greek", "el"}, 766 {"Greenlandic", "kl"}, 767 {"Guarani", "gn"}, 768 {"Gujarati", "gu"}, 769 {"Hawaiian", "haw"}, /* Yes, "haw", not "cpe". */ 770 {"Hebrew", "he"}, 771 {"Hindi", "hi"}, 772 {"Hungarian", "hu"}, 773 {"Icelandic", "is"}, 774 {"Indonesian", "id"}, 775 {"Inuktitut", "iu"}, 776 {"Irish", "ga"}, 777 {"Italian", "it"}, 778 {"Japanese", "ja"}, 779 {"Javanese", "jv"}, 780 {"Kalaallisut", "kl"}, 781 {"Kannada", "kn"}, 782 {"Kashmiri", "ks"}, 783 {"Kazakh", "kk"}, 784 {"Khmer", "km"}, 785 {"Kinyarwanda", "rw"}, 786 {"Kirghiz", "ky"}, 787 {"Korean", "ko"}, 788 {"Kurdish", "ku"}, 789 {"Latin", "la"}, 790 {"Latvian", "lv"}, 791 {"Lithuanian", "lt"}, 792 {"Macedonian", "mk"}, 793 {"Malagasy", "mg"}, 794 {"Malay", "ms"}, 795 {"Malayalam", "ml"}, 796 {"Maltese", "mt"}, 797 {"Manx", "gv"}, 798 {"Marathi", "mr"}, 799 {"Moldavian", "mo"}, 800 {"Mongolian", "mn"}, 801 {"Nepali", "ne"}, 802 {"Norwegian", "nb"}, /* Yes, "nb", not the obsolete "no". */ 803 {"Nyanja", "ny"}, 804 {"Nynorsk", "nn"}, 805 {"Oriya", "or"}, 806 {"Oromo", "om"}, 807 {"Panjabi", "pa"}, 808 {"Pashto", "ps"}, 809 {"Persian", "fa"}, 810 {"Polish", "pl"}, 811 {"Portuguese", "pt"}, 812 {"Portuguese, Brazilian", "pt_BR"}, 813 {"Punjabi", "pa"}, 814 {"Pushto", "ps"}, 815 {"Quechua", "qu"}, 816 {"Romanian", "ro"}, 817 {"Ruanda", "rw"}, 818 {"Rundi", "rn"}, 819 {"Russian", "ru"}, 820 {"Sami", "se_NO"}, /* Not just "se". */ 821 {"Sanskrit", "sa"}, 822 {"Scottish", "gd"}, 823 {"Serbian", "sr"}, 824 {"Simplified Chinese", "zh_CN"}, 825 {"Sindhi", "sd"}, 826 {"Sinhalese", "si"}, 827 {"Slovak", "sk"}, 828 {"Slovenian", "sl"}, 829 {"Somali", "so"}, 830 {"Spanish", "es"}, 831 {"Sundanese", "su"}, 832 {"Swahili", "sw"}, 833 {"Swedish", "sv"}, 834 {"Tagalog", "tl"}, 835 {"Tajik", "tg"}, 836 {"Tajiki", "tg"}, 837 {"Tamil", "ta"}, 838 {"Tatar", "tt"}, 839 {"Telugu", "te"}, 840 {"Thai", "th"}, 841 {"Tibetan", "bo"}, 842 {"Tigrinya", "ti"}, 843 {"Tongan", "to"}, 844 {"Traditional Chinese", "zh_TW"}, 845 {"Turkish", "tr"}, 846 {"Turkmen", "tk"}, 847 {"Uighur", "ug"}, 848 {"Ukrainian", "uk"}, 849 {"Urdu", "ur"}, 850 {"Uzbek", "uz"}, 851 {"Vietnamese", "vi"}, 852 {"Welsh", "cy"}, 853 {"Yiddish", "yi"} 850 854 }; 851 855 852 856 /* Convert new-style locale names with language tags (ISO 639 and ISO 15924) 853 857 to Unix (ISO 639 and ISO 3166) names. */ 854 typedef struct { const char langtag[7+1]; const char unixy[12+1]; } 855 langtag_entry; 858 typedef struct 859 { 860 const char langtag[7 + 1]; 861 const char unixy[12 + 1]; 862 } 863 langtag_entry; 856 864 static const langtag_entry langtag_table[] = { 857 865 /* MacOS X has "az-Arab", "az-Cyrl", "az-Latn". 858 866 The default script for az on Unix is Latin. */ 859 { "az-Latn", "az"},867 {"az-Latn", "az"}, 860 868 /* MacOS X has "ga-dots". Does not yet exist on Unix. */ 861 { "ga-dots", "ga"},869 {"ga-dots", "ga"}, 862 870 /* MacOS X has "kk-Cyrl". Does not yet exist on Unix. */ 863 871 /* MacOS X has "mn-Cyrl", "mn-Mong". 864 872 The default script for mn on Unix is Cyrillic. */ 865 { "mn-Cyrl", "mn"},873 {"mn-Cyrl", "mn"}, 866 874 /* MacOS X has "ms-Arab", "ms-Latn". 867 875 The default script for ms on Unix is Latin. */ 868 { "ms-Latn", "ms"},876 {"ms-Latn", "ms"}, 869 877 /* MacOS X has "tg-Cyrl". 870 878 The default script for tg on Unix is Cyrillic. */ 871 { "tg-Cyrl", "tg"},879 {"tg-Cyrl", "tg"}, 872 880 /* MacOS X has "tk-Cyrl". Does not yet exist on Unix. */ 873 881 /* MacOS X has "tt-Cyrl". 874 882 The default script for tt on Unix is Cyrillic. */ 875 { "tt-Cyrl", "tt"},883 {"tt-Cyrl", "tt"}, 876 884 /* MacOS X has "zh-Hans", "zh-Hant". 877 885 Country codes are used to distinguish these on Unix. */ 878 { "zh-Hans", "zh_CN"},879 { "zh-Hant", "zh_TW"}886 {"zh-Hans", "zh_CN"}, 887 {"zh-Hant", "zh_TW"} 880 888 }; 881 889 882 890 /* Convert script names (ISO 15924) to Unix conventions. 883 891 See http://www.unicode.org/iso15924/iso15924-codes.html */ 884 typedef struct { const char script[4+1]; const char unixy[9+1]; } 885 script_entry; 892 typedef struct 893 { 894 const char script[4 + 1]; 895 const char unixy[9 + 1]; 896 } 897 script_entry; 886 898 static const script_entry script_table[] = { 887 { "Arab", "arabic"},888 { "Cyrl", "cyrillic"},889 { "Mong", "mongolian"}899 {"Arab", "arabic"}, 900 {"Cyrl", "cyrillic"}, 901 {"Mong", "mongolian"} 890 902 }; 891 903 … … 1017 1029 /* POSIX:2001 says: 1018 1030 "All implementations shall define a locale as the default locale, to be 1019 invoked when no environment variables are set, or set to the empty1020 string. This default locale can be the POSIX locale or any other1021 implementation-defined locale. Some implementations may provide1022 facilities for local installation administrators to set the default1023 locale, customizing it for each location. POSIX:2001 does not require1024 such a facility. */1031 invoked when no environment variables are set, or set to the empty 1032 string. This default locale can be the POSIX locale or any other 1033 implementation-defined locale. Some implementations may provide 1034 facilities for local installation administrators to set the default 1035 locale, customizing it for each location. POSIX:2001 does not require 1036 such a facility. */ 1025 1037 1026 1038 #if !(HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE || defined(WIN32)) … … 1046 1058 { 1047 1059 char namebuf[256]; 1048 # if HAVE_CFLOCALECOPYCURRENT /* MacOS X 10.3 or newer */1060 # if HAVE_CFLOCALECOPYCURRENT /* MacOS X 10.3 or newer */ 1049 1061 CFLocaleRef locale = CFLocaleCopyCurrent (); 1050 1062 CFStringRef name = CFLocaleGetIdentifier (locale); 1051 1063 1052 if (CFStringGetCString (name, namebuf, sizeof (namebuf),1064 if (CFStringGetCString (name, namebuf, sizeof (namebuf), 1053 1065 kCFStringEncodingASCII)) 1054 1066 { … … 1057 1069 } 1058 1070 CFRelease (locale); 1059 # elif HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.2 or newer */ 1060 CFTypeRef value = 1061 CFPreferencesCopyAppValue (CFSTR ("AppleLocale"), 1062 kCFPreferencesCurrentApplication); 1071 # elif HAVE_CFPREFERENCESCOPYAPPVALUE /* MacOS X 10.2 or newer */ 1072 CFTypeRef value = CFPreferencesCopyAppValue (CFSTR ("AppleLocale"), 1073 kCFPreferencesCurrentApplication); 1063 1074 if (value != NULL 1064 1075 && CFGetTypeID (value) == CFStringGetTypeID () 1065 && CFStringGetCString ((CFStringRef) value, namebuf, sizeof(namebuf),1066 kCFStringEncodingASCII))1076 && CFStringGetCString ((CFStringRef) value, namebuf, 1077 sizeof (namebuf), kCFStringEncodingASCII)) 1067 1078 { 1068 1079 _nl_locale_name_canonicalize (namebuf); … … 1078 1089 # endif 1079 1090 1080 # if defined(WIN32) /* WIN32 */1091 # if defined(WIN32) /* WIN32 */ 1081 1092 { 1082 1093 LCID lcid; … … 1099 1110 switch (primary) 1100 1111 { 1101 case LANG_AFRIKAANS: return "af_ZA"; 1102 case LANG_ALBANIAN: return "sq_AL"; 1103 case LANG_AMHARIC: return "am_ET"; 1112 case LANG_AFRIKAANS: 1113 return "af_ZA"; 1114 case LANG_ALBANIAN: 1115 return "sq_AL"; 1116 case LANG_AMHARIC: 1117 return "am_ET"; 1104 1118 case LANG_ARABIC: 1105 1119 switch (sub) 1106 1120 { 1107 case SUBLANG_ARABIC_SAUDI_ARABIA: return "ar_SA"; 1108 case SUBLANG_ARABIC_IRAQ: return "ar_IQ"; 1109 case SUBLANG_ARABIC_EGYPT: return "ar_EG"; 1110 case SUBLANG_ARABIC_LIBYA: return "ar_LY"; 1111 case SUBLANG_ARABIC_ALGERIA: return "ar_DZ"; 1112 case SUBLANG_ARABIC_MOROCCO: return "ar_MA"; 1113 case SUBLANG_ARABIC_TUNISIA: return "ar_TN"; 1114 case SUBLANG_ARABIC_OMAN: return "ar_OM"; 1115 case SUBLANG_ARABIC_YEMEN: return "ar_YE"; 1116 case SUBLANG_ARABIC_SYRIA: return "ar_SY"; 1117 case SUBLANG_ARABIC_JORDAN: return "ar_JO"; 1118 case SUBLANG_ARABIC_LEBANON: return "ar_LB"; 1119 case SUBLANG_ARABIC_KUWAIT: return "ar_KW"; 1120 case SUBLANG_ARABIC_UAE: return "ar_AE"; 1121 case SUBLANG_ARABIC_BAHRAIN: return "ar_BH"; 1122 case SUBLANG_ARABIC_QATAR: return "ar_QA"; 1121 case SUBLANG_ARABIC_SAUDI_ARABIA: 1122 return "ar_SA"; 1123 case SUBLANG_ARABIC_IRAQ: 1124 return "ar_IQ"; 1125 case SUBLANG_ARABIC_EGYPT: 1126 return "ar_EG"; 1127 case SUBLANG_ARABIC_LIBYA: 1128 return "ar_LY"; 1129 case SUBLANG_ARABIC_ALGERIA: 1130 return "ar_DZ"; 1131 case SUBLANG_ARABIC_MOROCCO: 1132 return "ar_MA"; 1133 case SUBLANG_ARABIC_TUNISIA: 1134 return "ar_TN"; 1135 case SUBLANG_ARABIC_OMAN: 1136 return "ar_OM"; 1137 case SUBLANG_ARABIC_YEMEN: 1138 return "ar_YE"; 1139 case SUBLANG_ARABIC_SYRIA: 1140 return "ar_SY"; 1141 case SUBLANG_ARABIC_JORDAN: 1142 return "ar_JO"; 1143 case SUBLANG_ARABIC_LEBANON: 1144 return "ar_LB"; 1145 case SUBLANG_ARABIC_KUWAIT: 1146 return "ar_KW"; 1147 case SUBLANG_ARABIC_UAE: 1148 return "ar_AE"; 1149 case SUBLANG_ARABIC_BAHRAIN: 1150 return "ar_BH"; 1151 case SUBLANG_ARABIC_QATAR: 1152 return "ar_QA"; 1123 1153 } 1124 1154 return "ar"; 1125 case LANG_ARMENIAN: return "hy_AM"; 1126 case LANG_ASSAMESE: return "as_IN"; 1155 case LANG_ARMENIAN: 1156 return "hy_AM"; 1157 case LANG_ASSAMESE: 1158 return "as_IN"; 1127 1159 case LANG_AZERI: 1128 1160 switch (sub) 1129 1161 { 1130 /* FIXME: Adjust this when Azerbaijani locales appear on Unix. */ 1131 case SUBLANG_AZERI_LATIN: return "az_AZ@latin"; 1132 case SUBLANG_AZERI_CYRILLIC: return "az_AZ@cyrillic"; 1162 /* FIXME: Adjust this when Azerbaijani locales appear on Unix. */ 1163 case SUBLANG_AZERI_LATIN: 1164 return "az_AZ@latin"; 1165 case SUBLANG_AZERI_CYRILLIC: 1166 return "az_AZ@cyrillic"; 1133 1167 } 1134 1168 return "az"; … … 1136 1170 switch (sub) 1137 1171 { 1138 case SUBLANG_DEFAULT: return "eu_ES"; 1139 } 1140 return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR". */ 1141 case LANG_BELARUSIAN: return "be_BY"; 1172 case SUBLANG_DEFAULT: 1173 return "eu_ES"; 1174 } 1175 return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR". */ 1176 case LANG_BELARUSIAN: 1177 return "be_BY"; 1142 1178 case LANG_BENGALI: 1143 1179 switch (sub) 1144 1180 { 1145 case SUBLANG_BENGALI_INDIA: return "bn_IN"; 1146 case SUBLANG_BENGALI_BANGLADESH: return "bn_BD"; 1181 case SUBLANG_BENGALI_INDIA: 1182 return "bn_IN"; 1183 case SUBLANG_BENGALI_BANGLADESH: 1184 return "bn_BD"; 1147 1185 } 1148 1186 return "bn"; 1149 case LANG_BULGARIAN: return "bg_BG"; 1150 case LANG_BURMESE: return "my_MM"; 1151 case LANG_CAMBODIAN: return "km_KH"; 1152 case LANG_CATALAN: return "ca_ES"; 1153 case LANG_CHEROKEE: return "chr_US"; 1187 case LANG_BULGARIAN: 1188 return "bg_BG"; 1189 case LANG_BURMESE: 1190 return "my_MM"; 1191 case LANG_CAMBODIAN: 1192 return "km_KH"; 1193 case LANG_CATALAN: 1194 return "ca_ES"; 1195 case LANG_CHEROKEE: 1196 return "chr_US"; 1154 1197 case LANG_CHINESE: 1155 1198 switch (sub) 1156 1199 { 1157 case SUBLANG_CHINESE_TRADITIONAL: return "zh_TW"; 1158 case SUBLANG_CHINESE_SIMPLIFIED: return "zh_CN"; 1159 case SUBLANG_CHINESE_HONGKONG: return "zh_HK"; 1160 case SUBLANG_CHINESE_SINGAPORE: return "zh_SG"; 1161 case SUBLANG_CHINESE_MACAU: return "zh_MO"; 1200 case SUBLANG_CHINESE_TRADITIONAL: 1201 return "zh_TW"; 1202 case SUBLANG_CHINESE_SIMPLIFIED: 1203 return "zh_CN"; 1204 case SUBLANG_CHINESE_HONGKONG: 1205 return "zh_HK"; 1206 case SUBLANG_CHINESE_SINGAPORE: 1207 return "zh_SG"; 1208 case SUBLANG_CHINESE_MACAU: 1209 return "zh_MO"; 1162 1210 } 1163 1211 return "zh"; 1164 case LANG_CROATIAN: /* LANG_CROATIAN == LANG_SERBIAN1212 case LANG_CROATIAN: /* LANG_CROATIAN == LANG_SERBIAN 1165 1213 * What used to be called Serbo-Croatian 1166 1214 * should really now be two separate … … 1172 1220 switch (sub) 1173 1221 { 1174 case SUBLANG_DEFAULT: return "hr_HR"; 1175 case SUBLANG_SERBIAN_LATIN: return "sr_CS"; 1176 case SUBLANG_SERBIAN_CYRILLIC: return "sr_CS@cyrillic"; 1222 case SUBLANG_DEFAULT: 1223 return "hr_HR"; 1224 case SUBLANG_SERBIAN_LATIN: 1225 return "sr_CS"; 1226 case SUBLANG_SERBIAN_CYRILLIC: 1227 return "sr_CS@cyrillic"; 1177 1228 } 1178 1229 return "hr"; 1179 case LANG_CZECH: return "cs_CZ"; 1180 case LANG_DANISH: return "da_DK"; 1181 case LANG_DIVEHI: return "dv_MV"; 1230 case LANG_CZECH: 1231 return "cs_CZ"; 1232 case LANG_DANISH: 1233 return "da_DK"; 1234 case LANG_DIVEHI: 1235 return "dv_MV"; 1182 1236 case LANG_DUTCH: 1183 1237 switch (sub) 1184 1238 { 1185 case SUBLANG_DUTCH: return "nl_NL"; 1186 case SUBLANG_DUTCH_BELGIAN: /* FLEMISH, VLAAMS */ return "nl_BE"; 1239 case SUBLANG_DUTCH: 1240 return "nl_NL"; 1241 case SUBLANG_DUTCH_BELGIAN: /* FLEMISH, VLAAMS */ 1242 return "nl_BE"; 1187 1243 } 1188 1244 return "nl"; 1189 case LANG_EDO: return "bin_NG"; 1245 case LANG_EDO: 1246 return "bin_NG"; 1190 1247 case LANG_ENGLISH: 1191 1248 switch (sub) 1192 1249 { 1193 /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought 1194 * English was the language spoken in England. 1195 * Oh well. 1196 */ 1197 case SUBLANG_ENGLISH_US: return "en_US"; 1198 case SUBLANG_ENGLISH_UK: return "en_GB"; 1199 case SUBLANG_ENGLISH_AUS: return "en_AU"; 1200 case SUBLANG_ENGLISH_CAN: return "en_CA"; 1201 case SUBLANG_ENGLISH_NZ: return "en_NZ"; 1202 case SUBLANG_ENGLISH_EIRE: return "en_IE"; 1203 case SUBLANG_ENGLISH_SOUTH_AFRICA: return "en_ZA"; 1204 case SUBLANG_ENGLISH_JAMAICA: return "en_JM"; 1205 case SUBLANG_ENGLISH_CARIBBEAN: return "en_GD"; /* Grenada? */ 1206 case SUBLANG_ENGLISH_BELIZE: return "en_BZ"; 1207 case SUBLANG_ENGLISH_TRINIDAD: return "en_TT"; 1208 case SUBLANG_ENGLISH_ZIMBABWE: return "en_ZW"; 1209 case SUBLANG_ENGLISH_PHILIPPINES: return "en_PH"; 1210 case SUBLANG_ENGLISH_INDONESIA: return "en_ID"; 1211 case SUBLANG_ENGLISH_HONGKONG: return "en_HK"; 1212 case SUBLANG_ENGLISH_INDIA: return "en_IN"; 1213 case SUBLANG_ENGLISH_MALAYSIA: return "en_MY"; 1214 case SUBLANG_ENGLISH_SINGAPORE: return "en_SG"; 1250 /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought 1251 * English was the language spoken in England. 1252 * Oh well. 1253 */ 1254 case SUBLANG_ENGLISH_US: 1255 return "en_US"; 1256 case SUBLANG_ENGLISH_UK: 1257 return "en_GB"; 1258 case SUBLANG_ENGLISH_AUS: 1259 return "en_AU"; 1260 case SUBLANG_ENGLISH_CAN: 1261 return "en_CA"; 1262 case SUBLANG_ENGLISH_NZ: 1263 return "en_NZ"; 1264 case SUBLANG_ENGLISH_EIRE: 1265 return "en_IE"; 1266 case SUBLANG_ENGLISH_SOUTH_AFRICA: 1267 return "en_ZA"; 1268 case SUBLANG_ENGLISH_JAMAICA: 1269 return "en_JM"; 1270 case SUBLANG_ENGLISH_CARIBBEAN: 1271 return "en_GD"; /* Grenada? */ 1272 case SUBLANG_ENGLISH_BELIZE: 1273 return "en_BZ"; 1274 case SUBLANG_ENGLISH_TRINIDAD: 1275 return "en_TT"; 1276 case SUBLANG_ENGLISH_ZIMBABWE: 1277 return "en_ZW"; 1278 case SUBLANG_ENGLISH_PHILIPPINES: 1279 return "en_PH"; 1280 case SUBLANG_ENGLISH_INDONESIA: 1281 return "en_ID"; 1282 case SUBLANG_ENGLISH_HONGKONG: 1283 return "en_HK"; 1284 case SUBLANG_ENGLISH_INDIA: 1285 return "en_IN"; 1286 case SUBLANG_ENGLISH_MALAYSIA: 1287 return "en_MY"; 1288 case SUBLANG_ENGLISH_SINGAPORE: 1289 return "en_SG"; 1215 1290 } 1216 1291 return "en"; 1217 case LANG_ESTONIAN: return "et_EE"; 1218 case LANG_FAEROESE: return "fo_FO"; 1219 case LANG_FARSI: return "fa_IR"; 1220 case LANG_FINNISH: return "fi_FI"; 1292 case LANG_ESTONIAN: 1293 return "et_EE"; 1294 case LANG_FAEROESE: 1295 return "fo_FO"; 1296 case LANG_FARSI: 1297 return "fa_IR"; 1298 case LANG_FINNISH: 1299 return "fi_FI"; 1221 1300 case LANG_FRENCH: 1222 1301 switch (sub) 1223 1302 { 1224 case SUBLANG_FRENCH: return "fr_FR"; 1225 case SUBLANG_FRENCH_BELGIAN: /* WALLOON */ return "fr_BE"; 1226 case SUBLANG_FRENCH_CANADIAN: return "fr_CA"; 1227 case SUBLANG_FRENCH_SWISS: return "fr_CH"; 1228 case SUBLANG_FRENCH_LUXEMBOURG: return "fr_LU"; 1229 case SUBLANG_FRENCH_MONACO: return "fr_MC"; 1230 case SUBLANG_FRENCH_WESTINDIES: return "fr"; /* Caribbean? */ 1231 case SUBLANG_FRENCH_REUNION: return "fr_RE"; 1232 case SUBLANG_FRENCH_CONGO: return "fr_CG"; 1233 case SUBLANG_FRENCH_SENEGAL: return "fr_SN"; 1234 case SUBLANG_FRENCH_CAMEROON: return "fr_CM"; 1235 case SUBLANG_FRENCH_COTEDIVOIRE: return "fr_CI"; 1236 case SUBLANG_FRENCH_MALI: return "fr_ML"; 1237 case SUBLANG_FRENCH_MOROCCO: return "fr_MA"; 1238 case SUBLANG_FRENCH_HAITI: return "fr_HT"; 1303 case SUBLANG_FRENCH: 1304 return "fr_FR"; 1305 case SUBLANG_FRENCH_BELGIAN: /* WALLOON */ 1306 return "fr_BE"; 1307 case SUBLANG_FRENCH_CANADIAN: 1308 return "fr_CA"; 1309 case SUBLANG_FRENCH_SWISS: 1310 return "fr_CH"; 1311 case SUBLANG_FRENCH_LUXEMBOURG: 1312 return "fr_LU"; 1313 case SUBLANG_FRENCH_MONACO: 1314 return "fr_MC"; 1315 case SUBLANG_FRENCH_WESTINDIES: 1316 return "fr"; /* Caribbean? */ 1317 case SUBLANG_FRENCH_REUNION: 1318 return "fr_RE"; 1319 case SUBLANG_FRENCH_CONGO: 1320 return "fr_CG"; 1321 case SUBLANG_FRENCH_SENEGAL: 1322 return "fr_SN"; 1323 case SUBLANG_FRENCH_CAMEROON: 1324 return "fr_CM"; 1325 case SUBLANG_FRENCH_COTEDIVOIRE: 1326 return "fr_CI"; 1327 case SUBLANG_FRENCH_MALI: 1328 return "fr_ML"; 1329 case SUBLANG_FRENCH_MOROCCO: 1330 return "fr_MA"; 1331 case SUBLANG_FRENCH_HAITI: 1332 return "fr_HT"; 1239 1333 } 1240 1334 return "fr"; 1241 case LANG_FRISIAN: return "fy_NL"; 1335 case LANG_FRISIAN: 1336 return "fy_NL"; 1242 1337 case LANG_FULFULDE: 1243 1338 /* Spoken in Nigeria, Guinea, Senegal, Mali, Niger, Cameroon, Benin. */ … … 1246 1341 switch (sub) 1247 1342 { 1248 case 0x01: /* SCOTTISH */ return "gd_GB"; 1249 case 0x02: /* IRISH */ return "ga_IE"; 1343 case 0x01: /* SCOTTISH */ 1344 return "gd_GB"; 1345 case 0x02: /* IRISH */ 1346 return "ga_IE"; 1250 1347 } 1251 1348 return "C"; 1252 case LANG_GALICIAN: return "gl_ES"; 1253 case LANG_GEORGIAN: return "ka_GE"; 1349 case LANG_GALICIAN: 1350 return "gl_ES"; 1351 case LANG_GEORGIAN: 1352 return "ka_GE"; 1254 1353 case LANG_GERMAN: 1255 1354 switch (sub) 1256 1355 { 1257 case SUBLANG_GERMAN: return "de_DE"; 1258 case SUBLANG_GERMAN_SWISS: return "de_CH"; 1259 case SUBLANG_GERMAN_AUSTRIAN: return "de_AT"; 1260 case SUBLANG_GERMAN_LUXEMBOURG: return "de_LU"; 1261 case SUBLANG_GERMAN_LIECHTENSTEIN: return "de_LI"; 1356 case SUBLANG_GERMAN: 1357 return "de_DE"; 1358 case SUBLANG_GERMAN_SWISS: 1359 return "de_CH"; 1360 case SUBLANG_GERMAN_AUSTRIAN: 1361 return "de_AT"; 1362 case SUBLANG_GERMAN_LUXEMBOURG: 1363 return "de_LU"; 1364 case SUBLANG_GERMAN_LIECHTENSTEIN: 1365 return "de_LI"; 1262 1366 } 1263 1367 return "de"; 1264 case LANG_GREEK: return "el_GR"; 1265 case LANG_GUARANI: return "gn_PY"; 1266 case LANG_GUJARATI: return "gu_IN"; 1267 case LANG_HAUSA: return "ha_NG"; 1368 case LANG_GREEK: 1369 return "el_GR"; 1370 case LANG_GUARANI: 1371 return "gn_PY"; 1372 case LANG_GUJARATI: 1373 return "gu_IN"; 1374 case LANG_HAUSA: 1375 return "ha_NG"; 1268 1376 case LANG_HAWAIIAN: 1269 1377 /* FIXME: Do they mean Hawaiian ("haw_US", 1000 speakers) 1270 1378 or Hawaii Creole English ("cpe_US", 600000 speakers)? */ 1271 1379 return "cpe_US"; 1272 case LANG_HEBREW: return "he_IL"; 1273 case LANG_HINDI: return "hi_IN"; 1274 case LANG_HUNGARIAN: return "hu_HU"; 1275 case LANG_IBIBIO: return "nic_NG"; 1276 case LANG_ICELANDIC: return "is_IS"; 1277 case LANG_IGBO: return "ig_NG"; 1278 case LANG_INDONESIAN: return "id_ID"; 1279 case LANG_INUKTITUT: return "iu_CA"; 1380 case LANG_HEBREW: 1381 return "he_IL"; 1382 case LANG_HINDI: 1383 return "hi_IN"; 1384 case LANG_HUNGARIAN: 1385 return "hu_HU"; 1386 case LANG_IBIBIO: 1387 return "nic_NG"; 1388 case LANG_ICELANDIC: 1389 return "is_IS"; 1390 case LANG_IGBO: 1391 return "ig_NG"; 1392 case LANG_INDONESIAN: 1393 return "id_ID"; 1394 case LANG_INUKTITUT: 1395 return "iu_CA"; 1280 1396 case LANG_ITALIAN: 1281 1397 switch (sub) 1282 1398 { 1283 case SUBLANG_ITALIAN: return "it_IT"; 1284 case SUBLANG_ITALIAN_SWISS: return "it_CH"; 1399 case SUBLANG_ITALIAN: 1400 return "it_IT"; 1401 case SUBLANG_ITALIAN_SWISS: 1402 return "it_CH"; 1285 1403 } 1286 1404 return "it"; 1287 case LANG_JAPANESE: return "ja_JP"; 1288 case LANG_KANNADA: return "kn_IN"; 1289 case LANG_KANURI: return "kr_NG"; 1405 case LANG_JAPANESE: 1406 return "ja_JP"; 1407 case LANG_KANNADA: 1408 return "kn_IN"; 1409 case LANG_KANURI: 1410 return "kr_NG"; 1290 1411 case LANG_KASHMIRI: 1291 1412 switch (sub) 1292 1413 { 1293 case SUBLANG_DEFAULT: return "ks_PK"; 1294 case SUBLANG_KASHMIRI_INDIA: return "ks_IN"; 1414 case SUBLANG_DEFAULT: 1415 return "ks_PK"; 1416 case SUBLANG_KASHMIRI_INDIA: 1417 return "ks_IN"; 1295 1418 } 1296 1419 return "ks"; 1297 case LANG_KAZAK: return "kk_KZ"; 1420 case LANG_KAZAK: 1421 return "kk_KZ"; 1298 1422 case LANG_KONKANI: 1299 1423 /* FIXME: Adjust this when such locales appear on Unix. */ 1300 1424 return "kok_IN"; 1301 case LANG_KOREAN: return "ko_KR"; 1302 case LANG_KYRGYZ: return "ky_KG"; 1303 case LANG_LAO: return "lo_LA"; 1304 case LANG_LATIN: return "la_VA"; 1305 case LANG_LATVIAN: return "lv_LV"; 1306 case LANG_LITHUANIAN: return "lt_LT"; 1307 case LANG_MACEDONIAN: return "mk_MK"; 1425 case LANG_KOREAN: 1426 return "ko_KR"; 1427 case LANG_KYRGYZ: 1428 return "ky_KG"; 1429 case LANG_LAO: 1430 return "lo_LA"; 1431 case LANG_LATIN: 1432 return "la_VA"; 1433 case LANG_LATVIAN: 1434 return "lv_LV"; 1435 case LANG_LITHUANIAN: 1436 return "lt_LT"; 1437 case LANG_MACEDONIAN: 1438 return "mk_MK"; 1308 1439 case LANG_MALAY: 1309 1440 switch (sub) 1310 1441 { 1311 case SUBLANG_MALAY_MALAYSIA: return "ms_MY"; 1312 case SUBLANG_MALAY_BRUNEI_DARUSSALAM: return "ms_BN"; 1442 case SUBLANG_MALAY_MALAYSIA: 1443 return "ms_MY"; 1444 case SUBLANG_MALAY_BRUNEI_DARUSSALAM: 1445 return "ms_BN"; 1313 1446 } 1314 1447 return "ms"; 1315 case LANG_MALAYALAM: return "ml_IN"; 1316 case LANG_MALTESE: return "mt_MT"; 1448 case LANG_MALAYALAM: 1449 return "ml_IN"; 1450 case LANG_MALTESE: 1451 return "mt_MT"; 1317 1452 case LANG_MANIPURI: 1318 1453 /* FIXME: Adjust this when such locales appear on Unix. */ 1319 1454 return "mni_IN"; 1320 case LANG_MARATHI: return "mr_IN"; 1455 case LANG_MARATHI: 1456 return "mr_IN"; 1321 1457 case LANG_MONGOLIAN: 1322 1458 switch (sub) 1323 1459 { 1324 case SUBLANG_DEFAULT: return "mn_MN"; 1325 } 1326 return "mn"; /* Ambiguous: could be "mn_CN" or "mn_MN". */ 1460 case SUBLANG_DEFAULT: 1461 return "mn_MN"; 1462 } 1463 return "mn"; /* Ambiguous: could be "mn_CN" or "mn_MN". */ 1327 1464 case LANG_NEPALI: 1328 1465 switch (sub) 1329 1466 { 1330 case SUBLANG_DEFAULT: return "ne_NP"; 1331 case SUBLANG_NEPALI_INDIA: return "ne_IN"; 1467 case SUBLANG_DEFAULT: 1468 return "ne_NP"; 1469 case SUBLANG_NEPALI_INDIA: 1470 return "ne_IN"; 1332 1471 } 1333 1472 return "ne"; … … 1335 1474 switch (sub) 1336 1475 { 1337 case SUBLANG_NORWEGIAN_BOKMAL: return "nb_NO"; 1338 case SUBLANG_NORWEGIAN_NYNORSK: return "nn_NO"; 1476 case SUBLANG_NORWEGIAN_BOKMAL: 1477 return "nb_NO"; 1478 case SUBLANG_NORWEGIAN_NYNORSK: 1479 return "nn_NO"; 1339 1480 } 1340 1481 return "no"; 1341 case LANG_ORIYA: return "or_IN"; 1342 case LANG_OROMO: return "om_ET"; 1343 case LANG_PAPIAMENTU: return "pap_AN"; 1482 case LANG_ORIYA: 1483 return "or_IN"; 1484 case LANG_OROMO: 1485 return "om_ET"; 1486 case LANG_PAPIAMENTU: 1487 return "pap_AN"; 1344 1488 case LANG_PASHTO: 1345 return "ps"; /* Ambiguous: could be "ps_PK" or "ps_AF". */ 1346 case LANG_POLISH: return "pl_PL"; 1489 return "ps"; /* Ambiguous: could be "ps_PK" or "ps_AF". */ 1490 case LANG_POLISH: 1491 return "pl_PL"; 1347 1492 case LANG_PORTUGUESE: 1348 1493 switch (sub) 1349 1494 { 1350 case SUBLANG_PORTUGUESE: return "pt_PT"; 1351 /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT. 1352 Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */ 1353 case SUBLANG_PORTUGUESE_BRAZILIAN: return "pt_BR"; 1495 case SUBLANG_PORTUGUESE: 1496 return "pt_PT"; 1497 /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT. 1498 Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */ 1499 case SUBLANG_PORTUGUESE_BRAZILIAN: 1500 return "pt_BR"; 1354 1501 } 1355 1502 return "pt"; … … 1357 1504 switch (sub) 1358 1505 { 1359 case SUBLANG_PUNJABI_INDIA: return "pa_IN"; /* Gurmukhi script */ 1360 case SUBLANG_PUNJABI_PAKISTAN: return "pa_PK"; /* Arabic script */ 1506 case SUBLANG_PUNJABI_INDIA: 1507 return "pa_IN"; /* Gurmukhi script */ 1508 case SUBLANG_PUNJABI_PAKISTAN: 1509 return "pa_PK"; /* Arabic script */ 1361 1510 } 1362 1511 return "pa"; 1363 case LANG_RHAETO_ROMANCE: return "rm_CH"; 1512 case LANG_RHAETO_ROMANCE: 1513 return "rm_CH"; 1364 1514 case LANG_ROMANIAN: 1365 1515 switch (sub) 1366 1516 { 1367 case SUBLANG_ROMANIAN_ROMANIA: return "ro_RO"; 1368 case SUBLANG_ROMANIAN_MOLDOVA: return "ro_MD"; 1517 case SUBLANG_ROMANIAN_ROMANIA: 1518 return "ro_RO"; 1519 case SUBLANG_ROMANIAN_MOLDOVA: 1520 return "ro_MD"; 1369 1521 } 1370 1522 return "ro"; … … 1372 1524 switch (sub) 1373 1525 { 1374 case SUBLANG_DEFAULT: return "ru_RU"; 1375 } 1376 return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA" or "ru_MD". */ 1377 case LANG_SAAMI: /* actually Northern Sami */ return "se_NO"; 1378 case LANG_SANSKRIT: return "sa_IN"; 1526 case SUBLANG_DEFAULT: 1527 return "ru_RU"; 1528 } 1529 return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA" or "ru_MD". */ 1530 case LANG_SAAMI: /* actually Northern Sami */ 1531 return "se_NO"; 1532 case LANG_SANSKRIT: 1533 return "sa_IN"; 1379 1534 case LANG_SINDHI: 1380 1535 switch (sub) 1381 1536 { 1382 case SUBLANG_SINDHI_INDIA: return "sd_IN"; 1383 case SUBLANG_SINDHI_PAKISTAN: return "sd_PK"; 1537 case SUBLANG_SINDHI_INDIA: 1538 return "sd_IN"; 1539 case SUBLANG_SINDHI_PAKISTAN: 1540 return "sd_PK"; 1384 1541 } 1385 1542 return "sd"; 1386 case LANG_SINHALESE: return "si_LK"; 1387 case LANG_SLOVAK: return "sk_SK"; 1388 case LANG_SLOVENIAN: return "sl_SI"; 1389 case LANG_SOMALI: return "so_SO"; 1543 case LANG_SINHALESE: 1544 return "si_LK"; 1545 case LANG_SLOVAK: 1546 return "sk_SK"; 1547 case LANG_SLOVENIAN: 1548 return "sl_SI"; 1549 case LANG_SOMALI: 1550 return "so_SO"; 1390 1551 case LANG_SORBIAN: 1391 1552 /* FIXME: Adjust this when such locales appear on Unix. */ … … 1394 1555 switch (sub) 1395 1556 { 1396 case SUBLANG_SPANISH: return "es_ES"; 1397 case SUBLANG_SPANISH_MEXICAN: return "es_MX"; 1557 case SUBLANG_SPANISH: 1558 return "es_ES"; 1559 case SUBLANG_SPANISH_MEXICAN: 1560 return "es_MX"; 1398 1561 case SUBLANG_SPANISH_MODERN: 1399 1562 return "es_ES@modern"; /* not seen on Unix */ 1400 case SUBLANG_SPANISH_GUATEMALA: return "es_GT"; 1401 case SUBLANG_SPANISH_COSTA_RICA: return "es_CR"; 1402 case SUBLANG_SPANISH_PANAMA: return "es_PA"; 1403 case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: return "es_DO"; 1404 case SUBLANG_SPANISH_VENEZUELA: return "es_VE"; 1405 case SUBLANG_SPANISH_COLOMBIA: return "es_CO"; 1406 case SUBLANG_SPANISH_PERU: return "es_PE"; 1407 case SUBLANG_SPANISH_ARGENTINA: return "es_AR"; 1408 case SUBLANG_SPANISH_ECUADOR: return "es_EC"; 1409 case SUBLANG_SPANISH_CHILE: return "es_CL"; 1410 case SUBLANG_SPANISH_URUGUAY: return "es_UY"; 1411 case SUBLANG_SPANISH_PARAGUAY: return "es_PY"; 1412 case SUBLANG_SPANISH_BOLIVIA: return "es_BO"; 1413 case SUBLANG_SPANISH_EL_SALVADOR: return "es_SV"; 1414 case SUBLANG_SPANISH_HONDURAS: return "es_HN"; 1415 case SUBLANG_SPANISH_NICARAGUA: return "es_NI"; 1416 case SUBLANG_SPANISH_PUERTO_RICO: return "es_PR"; 1563 case SUBLANG_SPANISH_GUATEMALA: 1564 return "es_GT"; 1565 case SUBLANG_SPANISH_COSTA_RICA: 1566 return "es_CR"; 1567 case SUBLANG_SPANISH_PANAMA: 1568 return "es_PA"; 1569 case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: 1570 return "es_DO"; 1571 case SUBLANG_SPANISH_VENEZUELA: 1572 return "es_VE"; 1573 case SUBLANG_SPANISH_COLOMBIA: 1574 return "es_CO"; 1575 case SUBLANG_SPANISH_PERU: 1576 return "es_PE"; 1577 case SUBLANG_SPANISH_ARGENTINA: 1578 return "es_AR"; 1579 case SUBLANG_SPANISH_ECUADOR: 1580 return "es_EC"; 1581 case SUBLANG_SPANISH_CHILE: 1582 return "es_CL"; 1583 case SUBLANG_SPANISH_URUGUAY: 1584 return "es_UY"; 1585 case SUBLANG_SPANISH_PARAGUAY: 1586 return "es_PY"; 1587 case SUBLANG_SPANISH_BOLIVIA: 1588 return "es_BO"; 1589 case SUBLANG_SPANISH_EL_SALVADOR: 1590 return "es_SV"; 1591 case SUBLANG_SPANISH_HONDURAS: 1592 return "es_HN"; 1593 case SUBLANG_SPANISH_NICARAGUA: 1594 return "es_NI"; 1595 case SUBLANG_SPANISH_PUERTO_RICO: 1596 return "es_PR"; 1417 1597 } 1418 1598 return "es"; 1419 case LANG_SUTU: return "bnt_TZ"; /* or "st_LS" or "nso_ZA"? */ 1420 case LANG_SWAHILI: return "sw_KE"; 1599 case LANG_SUTU: 1600 return "bnt_TZ"; /* or "st_LS" or "nso_ZA"? */ 1601 case LANG_SWAHILI: 1602 return "sw_KE"; 1421 1603 case LANG_SWEDISH: 1422 1604 switch (sub) 1423 1605 { 1424 case SUBLANG_DEFAULT: return "sv_SE"; 1425 case SUBLANG_SWEDISH_FINLAND: return "sv_FI"; 1606 case SUBLANG_DEFAULT: 1607 return "sv_SE"; 1608 case SUBLANG_SWEDISH_FINLAND: 1609 return "sv_FI"; 1426 1610 } 1427 1611 return "sv"; 1428 case LANG_SYRIAC: return "syr_TR"; /* An extinct language. */ 1429 case LANG_TAGALOG: return "tl_PH"; 1430 case LANG_TAJIK: return "tg_TJ"; 1612 case LANG_SYRIAC: 1613 return "syr_TR"; /* An extinct language. */ 1614 case LANG_TAGALOG: 1615 return "tl_PH"; 1616 case LANG_TAJIK: 1617 return "tg_TJ"; 1431 1618 <
