Source code of Windows XP (NT5)
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.

63 lines
2.2 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 "rc.h"
  11. /************************************************************************/
  12. /* table for preprocessor id's */
  13. /************************************************************************/
  14. WCHAR * Pkeyw_Table[] = {
  15. #include "pkeyw.key"
  16. };
  17. char Pkeyw_Index[] = {
  18. #include "pkeyw.ind"
  19. };
  20. struct s_pkinfo {
  21. token_t s_info;
  22. } Pkeyw_Info[] = {
  23. #include "pkeyw.inf"
  24. };
  25. /************************************************************************/
  26. /* is_pkeyword : finds the token for the id if it's a preprocessor keyword.*/
  27. /* P0_NOTOKEN if not found. */
  28. /************************************************************************/
  29. token_t
  30. is_pkeyword(
  31. WCHAR *id
  32. )
  33. {
  34. REG WCHAR **start;
  35. REG WCHAR **stop;
  36. PUCHAR pi;
  37. if( (*id) < L'_') {
  38. return(P0_NOTOKEN);
  39. }
  40. /*
  41. ** the indx table tells us the start of
  42. ** the words which begin with the first char if the id.
  43. ** the 'stop' is the index of the word which does not have the
  44. ** give char as it's first.
  45. ** we can start checking after the first char since, we *know* that
  46. ** they match (hence the additions 'id++' and (*start) + 1
  47. */
  48. pi = (PUCHAR) &Pkeyw_Index[((*id) - L'_')];
  49. for(start = &Pkeyw_Table[*pi++], stop = &Pkeyw_Table[*pi], id++;
  50. start != stop;
  51. start++
  52. ) {
  53. if(wcscmp(*start, id) == 0) {
  54. return(Pkeyw_Info[(start - &Pkeyw_Table[0])].s_info);
  55. }
  56. }
  57. return(P0_NOTOKEN);
  58. }