Print this page
make: use the more modern wchar routines, not widec.h


  60 
  61 /*
  62  *      get_char_semantics_entry(ch)
  63  *
  64  *      Return value:
  65  *              The slot number in the array for special make chars,
  66  *              else the slot number of the last array entry.
  67  *
  68  *      Parameters:
  69  *              ch              The wide character
  70  *
  71  *      Global variables used:
  72  *              char_semantics_char[]   array of special wchar_t chars
  73  *                                      "&*@`\\|[]:$=!>-\n#()%?;^<'\""
  74  */
  75 int
  76 get_char_semantics_entry(wchar_t ch)
  77 {
  78         wchar_t         *char_sem_char;
  79 
  80         char_sem_char = (wchar_t *) wschr(char_semantics_char, ch);
  81         if (char_sem_char == NULL) {
  82                 /*
  83                  * Return the integer entry for the last slot,
  84                  * whose content is empty.
  85                  */
  86                 return (CHAR_SEMANTICS_ENTRIES - 1);
  87         } else {
  88                 return (char_sem_char - char_semantics_char);
  89         }
  90 }
  91 


  60 
  61 /*
  62  *      get_char_semantics_entry(ch)
  63  *
  64  *      Return value:
  65  *              The slot number in the array for special make chars,
  66  *              else the slot number of the last array entry.
  67  *
  68  *      Parameters:
  69  *              ch              The wide character
  70  *
  71  *      Global variables used:
  72  *              char_semantics_char[]   array of special wchar_t chars
  73  *                                      "&*@`\\|[]:$=!>-\n#()%?;^<'\""
  74  */
  75 int
  76 get_char_semantics_entry(wchar_t ch)
  77 {
  78         wchar_t         *char_sem_char;
  79 
  80         char_sem_char = (wchar_t *) wcschr(char_semantics_char, ch);
  81         if (char_sem_char == NULL) {
  82                 /*
  83                  * Return the integer entry for the last slot,
  84                  * whose content is empty.
  85                  */
  86                 return (CHAR_SEMANTICS_ENTRIES - 1);
  87         } else {
  88                 return (char_sem_char - char_semantics_char);
  89         }
  90 }
  91