Browse Source

Use static locals in utf_mapper.h

Scott Lahteine 9 years ago
parent
commit
d5b7c595ae
1 changed files with 14 additions and 11 deletions
  1. 14
    11
      Marlin/utf_mapper.h

+ 14
- 11
Marlin/utf_mapper.h View File

130
   }
130
   }
131
 
131
 
132
 #elif ENABLED(MAPPER_C2C3)
132
 #elif ENABLED(MAPPER_C2C3)
133
-  uint8_t utf_hi_char; // UTF-8 high part
134
-  bool seen_c2 = false;
135
-  char charset_mapper(char c){
133
+
134
+  char charset_mapper(char c) {
135
+    static uint8_t utf_hi_char; // UTF-8 high part
136
+    static bool seen_c2 = false;
136
     uint8_t d = c;
137
     uint8_t d = c;
137
     if ( d >= 0x80 ) { // UTF-8 handling
138
     if ( d >= 0x80 ) { // UTF-8 handling
138
       if ( (d >= 0xc0) && (!seen_c2) ) {
139
       if ( (d >= 0xc0) && (!seen_c2) ) {
160
   }
161
   }
161
 
162
 
162
 #elif ENABLED(MAPPER_D0D1_MOD)
163
 #elif ENABLED(MAPPER_D0D1_MOD)
163
-  uint8_t utf_hi_char; // UTF-8 high part
164
-  bool seen_d5 = false;
165
 
164
 
166
   char charset_mapper(char c) {
165
   char charset_mapper(char c) {
167
     // it is a Russian alphabet translation
166
     // it is a Russian alphabet translation
168
     // except 0401 --> 0xa2 = Ё, 0451 --> 0xb5 = ё
167
     // except 0401 --> 0xa2 = Ё, 0451 --> 0xb5 = ё
168
+    static uint8_t utf_hi_char; // UTF-8 high part
169
+    static bool seen_d5 = false;
169
     uint8_t d = c;
170
     uint8_t d = c;
170
     if (d >= 0x80) { // UTF-8 handling
171
     if (d >= 0x80) { // UTF-8 handling
171
       if (d >= 0xd0 && !seen_d5) {
172
       if (d >= 0xd0 && !seen_d5) {
197
   }
198
   }
198
 
199
 
199
 #elif ENABLED(MAPPER_D0D1)
200
 #elif ENABLED(MAPPER_D0D1)
200
-  uint8_t utf_hi_char; // UTF-8 high part
201
-  bool seen_d5 = false;
201
+
202
   char charset_mapper(char c) {
202
   char charset_mapper(char c) {
203
+    static uint8_t utf_hi_char; // UTF-8 high part
204
+    static bool seen_d5 = false;
203
     uint8_t d = c;
205
     uint8_t d = c;
204
     if (d >= 0x80u) { // UTF-8 handling
206
     if (d >= 0x80u) { // UTF-8 handling
205
       if (d >= 0xd0u && !seen_d5) {
207
       if (d >= 0xd0u && !seen_d5) {
227
   }
229
   }
228
 
230
 
229
 #elif ENABLED(MAPPER_E382E383)
231
 #elif ENABLED(MAPPER_E382E383)
230
-  uint8_t utf_hi_char; // UTF-8 high part
231
-  bool seen_e3 = false;
232
-  bool seen_82_83 = false;
233
-  char charset_mapper(char c){
232
+
233
+  char charset_mapper(char c) {
234
+    static uint8_t utf_hi_char; // UTF-8 high part
235
+    static bool seen_e3 = false;
236
+    static bool seen_82_83 = false;
234
     uint8_t d = c;
237
     uint8_t d = c;
235
     if (d >= 0x80) { // UTF-8 handling
238
     if (d >= 0x80) { // UTF-8 handling
236
       if (d == 0xe3 && !seen_e3) {
239
       if (d == 0xe3 && !seen_e3) {

Loading…
Cancel
Save