1 : /*
2 : * OpenBIOS - free your system!
3 : * ( FCode tokenizer )
4 : *
5 : * This program is part of a free implementation of the IEEE 1275-1994
6 : * Standard for Boot (Initialization Configuration) Firmware.
7 : *
8 : * Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
9 : *
10 : * This program is free software; you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License as published by
12 : * the Free Software Foundation; version 2 of the License.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program; if not, write to the Free Software
21 : * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
22 : *
23 : */
24 :
25 : /* **************************************************************************
26 : *
27 : * Command-Line Flags are used to control certain non-Standard
28 : * variant behaviors of the Tokenizer.
29 : * Support Functions for setting, clearing, displaying, etc.
30 : * Call them "Special-Feature Flags" in messages to the User
31 : *
32 : * (C) Copyright 2005 IBM Corporation. All Rights Reserved.
33 : * Module Author: David L. Paktor dlpaktor@us.ibm.com
34 : *
35 : **************************************************************************** */
36 :
37 : /* **************************************************************************
38 : *
39 : * For a given CLFlag name, the user may enter either:
40 : *
41 : * -f CLFlagName
42 : * or
43 : * -f noCLFlagName
44 : *
45 : * to either enable or disable the associated function
46 : *
47 : **************************************************************************** */
48 :
49 : /* **************************************************************************
50 : *
51 : * Functions Exported:
52 : * set_cl_flag Set (or clear) a CL Flag Variable
53 : * show_all_cl_flag_settings Show CL Flags' settings unconditionally.
54 : * list_cl_flag_settings Display CL Flags' settings if changed.
55 : * list_cl_flag_names Display just the names of the CL Flags.
56 : * cl_flags_help Help Message for CL Flags
57 : *
58 : **************************************************************************** */
59 :
60 : /* **************************************************************************
61 : *
62 : * Revision History:
63 : * Updated Mon, 08 Aug 2005 by David L. Paktor
64 : * They're not just for setting from the Command-Line anymore,
65 : * but let's still keep these names for internal use....
66 : *
67 : **************************************************************************** */
68 :
69 : /* **************************************************************************
70 : *
71 : * The CL_FLAGS data structure has a field for the CLFlagName,
72 : * one for a text explanation of the function it controls, and
73 : * one for the address of the boolean variable ("flag")
74 : *
75 : **************************************************************************** */
76 :
77 : #include <stdio.h>
78 : #include <stdlib.h>
79 : #include <string.h>
80 :
81 : #include "clflags.h"
82 : #include "errhandler.h"
83 :
84 :
85 : /* **************************************************************************
86 : *
87 : * Global Variables Exported
88 : * (The "flags" controlled by this means)
89 : *
90 : **************************************************************************** */
91 :
92 : bool ibm_locals = FALSE ;
93 : bool ibm_locals_legacy_separator = TRUE ;
94 : bool ibm_legacy_separator_message = TRUE ;
95 : bool enable_abort_quote = TRUE ;
96 : bool sun_style_abort_quote = TRUE ;
97 : bool abort_quote_throw = TRUE ;
98 : bool string_remark_escape = TRUE ;
99 : bool hex_remark_escape = TRUE ;
100 : bool c_style_string_escape = TRUE ;
101 : bool always_headers = FALSE ;
102 : bool always_external = FALSE ;
103 : bool verbose_dup_warning = TRUE ;
104 : bool obso_fcode_warning = TRUE ;
105 : bool trace_conditionals = FALSE ;
106 : bool big_end_pci_image_rev = FALSE ;
107 :
108 : /* And one to trigger a "help" message */
109 : bool clflag_help = FALSE;
110 :
111 : /* **************************************************************************
112 : *
113 : * The addition of the "upper/lower-case-tokens" flags introduces
114 : * some complications. These are the variables we will actually
115 : * be exporting:
116 : *
117 : **************************************************************************** */
118 :
119 : bool force_tokens_case = FALSE ;
120 : bool force_lower_case_tokens = FALSE ;
121 :
122 : /* **************************************************************************
123 : *
124 : * but we will be entering two static variables into the table,
125 : * and keep two more to detect when a change is made...
126 : *
127 : **************************************************************************** */
128 : static bool upper_case_tokens = FALSE ;
129 : static bool lower_case_tokens = FALSE ;
130 : static bool was_upper_case_tk = FALSE ;
131 : static bool was_lower_case_tk = FALSE ;
132 :
133 : /* **************************************************************************
134 : *
135 : * Internal Static Variables
136 : * cl_flag_change A change was made to any of the CL Flags
137 : * Internal Static Constants
138 : * cl_flags_list List of CL Flags and their data.
139 : *
140 : **************************************************************************** */
141 :
142 : static bool cl_flag_change = FALSE;
143 :
144 : static const cl_flag_t cl_flags_list[] = {
145 : /* The clflag_tabs field takes at least one tab.
146 : * If the name has fewer than 16 characters,
147 : * stick in an extra tab, and yet another tab
148 : * if the name is shorter than 8 characters
149 : * to make the formatting of the "explanation"
150 : * come out prettier.
151 : */
152 : { "Local-Values",
153 : &ibm_locals,
154 : "\t\t",
155 : "Support IBM-style Local Values (\"LV\"s)" } ,
156 :
157 : { "LV-Legacy-Separator",
158 : &ibm_locals_legacy_separator,
159 : "\t",
160 : "Allow Semicolon for Local Values Separator (\"Legacy\")" } ,
161 :
162 : { "LV-Legacy-Message",
163 : &ibm_legacy_separator_message,
164 : "\t",
165 : "Display a Message when Semicolon is used as the "
166 : "Local Values Separator" } ,
167 :
168 : { "ABORT-Quote",
169 : &enable_abort_quote,
170 : "\t\t",
171 : "Allow ABORT\" macro" } ,
172 :
173 : { "Sun-ABORT-Quote",
174 : &sun_style_abort_quote,
175 : "\t\t",
176 : "ABORT\" with implicit IF ... THEN" } ,
177 :
178 : { "ABORT-Quote-Throw",
179 : &abort_quote_throw,
180 : "\t",
181 : "Use -2 THROW in an Abort\" phrase, rather than ABORT" } ,
182 :
183 : { "String-remark-escape",
184 : &string_remark_escape,
185 : "\t",
186 : "Allow \"\\ (Quote-Backslash) to interrupt string parsing" } ,
187 :
188 : { "Hex-remark-escape",
189 : &hex_remark_escape,
190 : "\t",
191 : "Allow \\ (Backslash) to interrupt "
192 : "hex-sequence parsing within a string" } ,
193 :
194 : { "C-Style-string-escape",
195 : &c_style_string_escape ,
196 : "\t",
197 : "Allow \\n \\t and \\xx\\ for special chars in string parsing" } ,
198 :
199 : { "Always-Headers",
200 : &always_headers ,
201 : "\t\t",
202 : "Override \"headerless\" and force to \"headers\"" } ,
203 :
204 : { "Always-External",
205 : &always_external ,
206 : "\t\t",
207 : "Override \"headerless\" and \"headers\" and "
208 : "force to \"external\"" } ,
209 :
210 : { "Warn-if-Duplicate",
211 : &verbose_dup_warning ,
212 : "\t",
213 : "Display a WARNING message when a duplicate definition is made" } ,
214 :
215 : { "Obsolete-FCode-Warning",
216 : &obso_fcode_warning ,
217 : "\t",
218 : "Display a WARNING message when an \"obsolete\" "
219 : "(per the Standard) FCode is used" } ,
220 :
221 : { "Trace-Conditionals",
222 : &trace_conditionals,
223 : "\t",
224 : "Display ADVISORY messages about the state of "
225 : "Conditional Tokenization" } ,
226 :
227 : { "Upper-Case-Token-Names",
228 : &upper_case_tokens,
229 : "\t",
230 : "Convert Token-Names to UPPER-Case" } ,
231 :
232 :
233 : { "Lower-Case-Token-Names",
234 : &lower_case_tokens,
235 : "\t",
236 : "Convert Token-Names to lower-Case" } ,
237 :
238 :
239 : { "Big-End-PCI-Rev-Level",
240 : &big_end_pci_image_rev,
241 : "\t",
242 : "Save the Vendor's Rev Level field of the PCI Header"
243 : " in Big-Endian format" } ,
244 :
245 :
246 : /* Keep the "help" pseudo-flag last in the list */
247 : { "help",
248 : &clflag_help,
249 : /* Two extra tabs if the name is shorter than 8 chars */
250 : "\t\t\t",
251 : "Print this \"Help\" message for the Special-Feature Flags" }
252 :
253 : };
254 :
255 : static const int number_of_cl_flags =
256 : sizeof(cl_flags_list)/sizeof(cl_flag_t);
257 :
258 :
259 : /* **************************************************************************
260 : *
261 : * CL Flags whose settings are changed in the source file should
262 : * not stay in effect for the duration of the entire batch of
263 : * tokenizations (i.e., if multiple input files are named on
264 : * the command line) the way command-line settings should.
265 : * To accomplish this we will collect the state of the flags into
266 : * a bit-mapped variable after the command line has been parsed
267 : * and restore them to their collected saved state before an
268 : * input file is processed.
269 : *
270 : **************************************************************************** */
271 :
272 : static long int cl_flags_bit_map;
273 : /* If the number of CL Flags ever exceeds the number of bits in a long
274 : * (presently 32), we will need to change both this variable and
275 : * the routines that use it. Of course, if the number of CL Flags
276 : * ever gets that high, it will be *seriously* unwieldy... ;-}
277 : */
278 :
279 : /* **************************************************************************
280 : *
281 : * Function name: adjust_case_flags
282 : * Synopsis: If the last CL Flag Variable setting changed one of
283 : * the "upper/lower-case-tokens" flags, make the
284 : * appropriate adjustments.
285 : *
286 : * Inputs:
287 : * Parameters: NONE
288 : * Local Static Variables:
289 : * was_upper_case_tk State of "upper-case-tokens" flag before
290 : * last CL Flag Variable was processed
291 : * was_lower_case_tk State of "lower-case-tokens" flag, before
292 : * upper_case_tokens State of "upper-case-tokens" flag after
293 : * last CL Flag V'ble was processed
294 : * lower_case_tokens State of "lower-case-tokens" flag, after
295 : * Global Variables:
296 : *
297 : * Outputs:
298 : * Returned Value: NONE
299 : * Global Variables:
300 : * force_tokens_case TRUE if "upper/lower-case-tokens"
301 : * flag is in effect
302 : * force_lower_case_tokens If force_tokens_case is TRUE, then
303 : * this switches between "upper"
304 : * or "lower" case
305 : *
306 : * Process Explanation:
307 : * We cannot come out of this with both upper_case_tokens and
308 : * lower_case_tokens being TRUE, though they may both be FALSE.
309 : * If neither has changed state, we need not do anything here.
310 : * If one has gone to TRUE, we must force the other to FALSE and
311 : * we will set force_tokens_case to TRUE.
312 : * If one has gone to FALSE, turn force_tokens_case to FALSE.
313 : * If force_tokens_case is TRUE after all this, we must adjust
314 : * force_lower_case_tokens according to lower_case_tokens
315 : *
316 : **************************************************************************** */
317 :
318 : static void adjust_case_flags( void)
319 197 : {
320 : static bool *case_tokens[2] = { &upper_case_tokens, &lower_case_tokens };
321 : static bool *was_case_tk[2] = { &was_upper_case_tk, &was_lower_case_tk };
322 197 : int the_one = 0;
323 197 : int the_other = 1;
324 :
325 585 : for ( ; the_one < 2 ; the_one++ , the_other-- )
326 : {
327 : /* If one has changed state */
328 393 : if ( *(case_tokens[the_one]) != *(was_case_tk[the_one]) )
329 : {
330 5 : if ( *(case_tokens[the_one]) )
331 : {
332 : /* If it has gone to TRUE, force the other to FALSE. */
333 4 : *(case_tokens[the_other]) = FALSE;
334 : /* and set force_tokens_case to TRUE */
335 4 : force_tokens_case = TRUE;
336 : }else{
337 : /* If it has gone to FALSE turn force_tokens_case FALSE */
338 1 : force_tokens_case = FALSE;
339 : }
340 5 : if ( force_tokens_case )
341 : {
342 4 : force_lower_case_tokens = lower_case_tokens;
343 : }
344 : break; /* Only one can have changed state. */
345 : }
346 : }
347 197 : }
348 :
349 :
350 :
351 :
352 : /* **************************************************************************
353 : *
354 : * Function name: set_cl_flag
355 : * Synopsis: Set (or clear) the named CL Flag Variable
356 : *
357 : * Inputs:
358 : * Parameters:
359 : * flag_name The name as supplied by the user
360 : * from_src TRUE if called from source-input file
361 : * Static Constants:
362 : * cl_flags_list
363 : * number_of_cl_flags
364 : *
365 : * Outputs:
366 : * Returned Value: TRUE if supplied name is not valid
367 : * Global Variables:
368 : * The CL Flag Variable associated with the supplied name will
369 : * be set or cleared according to the leading "no"
370 : * Local Static Variables:
371 : * cl_flag_change TRUE if associated variable has changed
372 : * Printout:
373 : * If from_src is TRUE, print "En" or "Dis" abling:
374 : * followed by the explanation
375 : *
376 : * Error Detection:
377 : * If the supplied name is not a valid CL Flag name, or if
378 : * it's too short to be a valid CL Flag name, return TRUE.
379 : * Print a message; either a simple print if this function was
380 : * called from a command-line argument, or an ERROR if it
381 : * was called from a line in the from source-input file.
382 : *
383 : * Process Explanation:
384 : * Save the current state of the "upper/lower-case-tokens" flags
385 : * If the given name has a leading "no", make note of that fact
386 : * and remove the leading "no" from the comparison.
387 : * Compare with the list of valid CL Flag names.
388 : * If no match was found, Error. See under Error Detection.
389 : * If a match:
390 : * Change the associated variable according to the leading "no"
391 : * Set cl_flag_change to TRUE unless the variable is the one
392 : * associated with the "help" flag; this permits the
393 : * "Default" vs "Setting" part of cl_flags_help() to
394 : * work properly...
395 : * Do the conditional Printout (see above)
396 : * Adjust the "upper/lower-case-tokens" flags if one has changed.
397 : *
398 : **************************************************************************** */
399 : static bool first_err_msg = TRUE; /* Need extra carr-ret for first err msg */
400 : bool set_cl_flag(char *flag_name, bool from_src)
401 197 : {
402 197 : bool retval = TRUE;
403 :
404 197 : was_upper_case_tk = upper_case_tokens;
405 197 : was_lower_case_tk = lower_case_tokens;
406 :
407 197 : if ( strlen(flag_name) > 3 )
408 : {
409 : int indx;
410 197 : bool flagval = TRUE;
411 197 : char *compar = flag_name;
412 :
413 197 : if ( strncasecmp( flag_name, "no", 2) == 0 )
414 : {
415 94 : flagval = FALSE;
416 94 : compar += 2;
417 : }
418 1538 : for ( indx = 0 ; indx < number_of_cl_flags ; indx++ )
419 : {
420 1529 : if ( strcasecmp( compar, cl_flags_list[indx].clflag_name ) == 0 )
421 : {
422 188 : retval = FALSE;
423 188 : *(cl_flags_list[indx].flag_var) = flagval;
424 :
425 : /* The "help" flag is the last one in the list */
426 188 : if ( indx != number_of_cl_flags - 1 )
427 : {
428 176 : cl_flag_change = TRUE;
429 : }
430 188 : if ( from_src )
431 : {
432 125 : tokenization_error(INFO,
433 : "%sabling: %s\n",
434 : flagval ? "En" : "Dis", cl_flags_list[indx].clflag_expln);
435 : }
436 : break;
437 : }
438 : }
439 : }
440 :
441 197 : if ( retval )
442 : {
443 9 : const char* msg_txt = "Unknown Special-Feature Flag: %s\n" ;
444 9 : if ( from_src )
445 : {
446 6 : tokenization_error( TKERROR, (char *)msg_txt, flag_name);
447 : }else{
448 3 : if ( first_err_msg )
449 : {
450 1 : printf( "\n");
451 1 : first_err_msg = FALSE;
452 : }
453 3 : printf( msg_txt, flag_name);
454 : }
455 : }
456 :
457 197 : adjust_case_flags();
458 :
459 197 : return ( retval );
460 : }
461 :
462 : /* **************************************************************************
463 : *
464 : * Function name: show_all_cl_flag_settings
465 : * Synopsis: Display the settings of the CL Flags, (except "help")
466 : * regardless of whether they have been changed.
467 : *
468 : * Associated Tokenizer directive(s): [FLAGS]
469 : * #FLAGS
470 : * [#FLAGS]
471 : * SHOW-FLAGS
472 : * This routine may also be invoked by a combination of
473 : * options on the command-line.
474 : *
475 : * Inputs:
476 : * Parameters:
477 : * from_src TRUE if called from source-input file
478 : * Macro:
479 : * ERRMSG_DESTINATION Error message destination;
480 : * (Development-time switch)
481 : * Static Constants:
482 : * cl_flags_list
483 : * number_of_cl_flags
484 : *
485 : * Outputs:
486 : * Returned Value: NONE
487 : * Printout: Directed to stdout or to stderr
488 : * (see definition of ERRMSG_DESTINATION)
489 : * A header line, followed by the names of the CL Flags,
490 : * with "No" preceding name if value is FALSE, one to a line.
491 : *
492 : * Process Explanation:
493 : * If from_src is TRUE, print the header line as a Message, and
494 : * then direct output to ERRMSG_DESTINATION .
495 : * Don't print the "help" trigger (the last flag in the array).
496 : *
497 : **************************************************************************** */
498 :
499 : void show_all_cl_flag_settings(bool from_src)
500 60 : {
501 60 : const char* hdr_txt = "Special-Feature Flag settings:" ;
502 : int indx;
503 :
504 60 : if ( from_src )
505 : {
506 12 : tokenization_error(MESSAGE, (char *)hdr_txt);
507 : }else{
508 48 : printf("\n%s\n", hdr_txt);
509 : }
510 :
511 1080 : for ( indx = 0 ; indx < (number_of_cl_flags - 1) ; indx++ )
512 : {
513 1020 : fprintf( from_src ? ERRMSG_DESTINATION : stdout ,
514 : "\t%s%s\n",
515 : *(cl_flags_list[indx].flag_var) ? " " : "No" ,
516 : cl_flags_list[indx].clflag_name );
517 : }
518 60 : if ( from_src ) fprintf( ERRMSG_DESTINATION, "\n");
519 60 : }
520 :
521 : /* **************************************************************************
522 : *
523 : * Function name: list_cl_flag_settings
524 : * Synopsis: Display the settings of the CL Flags, (except "help")
525 : * if any of them have been changed
526 : *
527 : * Inputs:
528 : * Parameters: NONE
529 : * Local Static Variables:
530 : * cl_flag_change TRUE if a Flag setting has been changed.
531 : *
532 : * Outputs:
533 : * Returned Value: NONE
534 : * Printout:
535 : * Settings of the CL Flags. See show_all_cl_flag_settings()
536 : *
537 : * Process Explanation:
538 : * Don't print anything if cl_flag_change is not TRUE
539 : *
540 : **************************************************************************** */
541 :
542 : void list_cl_flag_settings(void)
543 153 : {
544 :
545 153 : if ( cl_flag_change )
546 : {
547 48 : show_all_cl_flag_settings( FALSE);
548 : }
549 153 : }
550 :
551 :
552 : /* **************************************************************************
553 : *
554 : * Function name: list_cl_flag_names
555 : * Synopsis: Display just the names of the CL Flags
556 : * for the Usage message
557 : *
558 : * Inputs:
559 : * Parameters: NONE
560 : * Static Constants:
561 : * cl_flags_list
562 : * number_of_cl_flags
563 : *
564 : * Outputs:
565 : * Returned Value: NONE
566 : * Printout:
567 : * A header line, followed by the names of the CL Flags,
568 : *
569 : **************************************************************************** */
570 :
571 : void list_cl_flag_names(void)
572 2 : {
573 : int indx;
574 :
575 2 : printf("Valid Special-Feature Flags are:\n");
576 38 : for ( indx = 0 ; indx < number_of_cl_flags ; indx++ )
577 : {
578 36 : printf("\t%s\n", cl_flags_list[indx].clflag_name );
579 : }
580 2 : }
581 :
582 : /* **************************************************************************
583 : *
584 : * Function name: cl_flags_help
585 : * Synopsis: Display Usage of the CL Flags and their defaults
586 : *
587 : *
588 : * Inputs:
589 : * Parameters:: NONE
590 : * Static Constants:
591 : * cl_flags_list
592 : * number_of_cl_flags
593 : * Local Static Variables:
594 : * cl_flag_change TRUE if setting has been changed.
595 : *
596 : * Outputs:
597 : * Returned Value: NONE
598 : * Printout:
599 : * A few lines of header, followed by the default, the name
600 : * and the "explanation" of each of the CL Flags, one to a line.
601 : *
602 : * Extraneous Remarks:
603 : * We take advantage of the facts that this routine is called
604 : * (1) only from the command-line, before any settings
605 : * have been changed, and (2) via changing the flag for
606 : * "help" to TRUE. (Technically, I suppose, the default
607 : * for the "help" feature is "no", but showing will, I
608 : * think be more confusing than enlightening to the user.)
609 : * Also, I suppose a perverse user could change setting(s) on
610 : * the same command-line with a "-f help" request; we cannot
611 : * stop users from aiming at their boot and pulling the
612 : * trigger. As my buddies in Customer Support would say:
613 : * "KMAC YOYO" (Approximately, "You're On Your Own, Clown")...
614 : *
615 : * Revision History:
616 : * Oh, all right. If the user changed setting(s), we can do
617 : * them the minor courtesy of printing "Setting" instead
618 : * of "Default".
619 : *
620 : *
621 : **************************************************************************** */
622 :
623 : void cl_flags_help(void )
624 4 : {
625 : int indx;
626 :
627 4 : printf("\n"
628 : "Special-Feature Flags usage:\n"
629 : " -f FlagName to enable the feature associated with FlagName,\n"
630 : "or\n"
631 : " -f noFlagName to disable the feature.\n\n"
632 : "%s Flag-Name\t\t Feature:\n\n",
633 : cl_flag_change ? "Setting" : "Default" );
634 :
635 76 : for ( indx = 0 ; indx < number_of_cl_flags ; indx++ )
636 : {
637 72 : printf(" %s %s%s%s\n",
638 : *(cl_flags_list[indx].flag_var) ? " " : "no" ,
639 : cl_flags_list[indx].clflag_name,
640 : cl_flags_list[indx].clflag_tabs,
641 : cl_flags_list[indx].clflag_expln);
642 : }
643 :
644 4 : }
645 :
646 :
647 :
648 : /* **************************************************************************
649 : *
650 : * Function name: save_cl_flags
651 : * Synopsis: Collect the state of the CL Flags
652 : *
653 : * Inputs:
654 : * Parameters: NONE
655 : * Local Static Variables:
656 : * cl_flags_list
657 : * Static Constants:
658 : * number_of_cl_flags
659 : *
660 : * Outputs:
661 : * Returned Value: NONE
662 : * Local Static Variables:
663 : * cl_flags_bit_map Will be set to reflect the state
664 : * of the CL Flags in the list.
665 : *
666 : * Process Explanation:
667 : * The correspondence of bits to the list is that the first item
668 : * in the list corresponds to the low-order bit, and so on
669 : * moving toward the high-order with each successive item.
670 : * Do not save the "help" flag (last item on the list).
671 : * This routine is called after the command line has been parsed.
672 : *
673 : **************************************************************************** */
674 :
675 : void save_cl_flags(void)
676 154 : {
677 : int indx;
678 154 : long int moving_bit = 1;
679 :
680 154 : cl_flags_bit_map = 0;
681 2772 : for ( indx = 0 ; indx < (number_of_cl_flags - 1) ; indx++ )
682 : {
683 2618 : if ( *(cl_flags_list[indx].flag_var) )
684 : {
685 1563 : cl_flags_bit_map |= moving_bit; /* The moving finger writes, */
686 : }
687 2618 : moving_bit <<= 1; /* and having writ, moves on. */
688 : }
689 154 : }
690 :
691 : /* **************************************************************************
692 : *
693 : * Function name: reset_cl_flags
694 : * Synopsis: Restore the CL Flags to the state that was saved.
695 : *
696 : * Inputs:
697 : * Parameters: NONE
698 : * Local Static Variables:
699 : * cl_flags_bit_map Reflects the state of the CL Flags
700 : * Static Constants:
701 : * number_of_cl_flags
702 : *
703 : * Outputs:
704 : * Returned Value: NONE
705 : * Local Static Variables:
706 : * cl_flags_list
707 : * Global Variables:
708 : * The CL Flag Variables will be set or cleared
709 : * to their saved state
710 : *
711 : * Process Explanation:
712 : * This routine is called before starting a new input file.
713 : * Any changes made in the source file will not stay
714 : * in effect for the next tokenization.
715 : *
716 : **************************************************************************** */
717 :
718 : void reset_cl_flags(void)
719 165 : {
720 : int indx;
721 165 : long int moving_bit = 1;
722 :
723 2970 : for ( indx = 0 ; indx < (number_of_cl_flags - 1) ; indx++ )
724 : {
725 2805 : *(cl_flags_list[indx].flag_var) =
726 : BOOLVAL( cl_flags_bit_map & moving_bit) ;
727 2805 : moving_bit <<= 1;
728 : }
729 165 : }
|