Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.9 KiB

  1. /************************************************************************/
  2. /* */
  3. /* RCPP - Resource Compiler Pre-Processor for NT system */
  4. /* */
  5. /* P0KEYS.C - Keycode stuff */
  6. /* */
  7. /* 06-Dec-90 w-BrianM Update for NT from PM SDK RCPP */
  8. /* */
  9. /************************************************************************/
  10. #include <stdio.h>
  11. #include <string.h>
  12. #include "rcpptype.h"
  13. #include "rcppdecl.h"
  14. #include "rcppext.h"
  15. #include "p0defs.h"
  16. /************************************************************************/
  17. /* table for preprocessor id's */
  18. /************************************************************************/
  19. char * Pkeyw_Table[] = {
  20. #include "pkeyw.key"
  21. };
  22. char Pkeyw_Index[] = {
  23. #include "pkeyw.ind"
  24. };
  25. struct s_pkinfo {
  26. token_t s_info;
  27. } Pkeyw_Info[] = {
  28. #include "pkeyw.inf"
  29. };
  30. /************************************************************************/
  31. /* is_pkeyword : finds the token for the id if it's a preprocessor keyword.*/
  32. /* P0_NOTOKEN if not found. */
  33. /************************************************************************/
  34. token_t is_pkeyword(char *id)
  35. {
  36. REG char **start;
  37. REG char **stop;
  38. char *pi;
  39. if( (*id) < '_') {
  40. return(P0_NOTOKEN);
  41. }
  42. /*
  43. ** the indx table tells us the start of
  44. ** the words which begin with the first char if the id.
  45. ** the 'stop' is the index of the word which does not have the
  46. ** give char as it's first.
  47. ** we can start checking after the first char since, we *know* that
  48. ** they match (hence the additions 'id++' and (*start) + 1
  49. */
  50. pi = &Pkeyw_Index[((*id) - '_')];
  51. for(start = &Pkeyw_Table[*pi++], stop = &Pkeyw_Table[*pi], id++;
  52. start != stop;
  53. start++
  54. ) {
  55. if(strcmp(*start, id) == 0) {
  56. return(Pkeyw_Info[(start - &Pkeyw_Table[0])].s_info);
  57. }
  58. }
  59. return(P0_NOTOKEN);
  60. }