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.

173 lines
8.8 KiB

  1. /*++
  2. Copyright (c) 1988-1999 Microsoft Corporation
  3. Module Name:
  4. ctable.c
  5. Abstract:
  6. Command dispatch
  7. --*/
  8. /*** Operator and Command Jump Table
  9. *
  10. * This file is included by cmd.c and contains the operator and command jump
  11. * table. Every command and operator has an entry in the table. The correct
  12. * entry in the table can be found in two ways. The first way is to loop
  13. * through the table and search for the operator or command name you want.
  14. * The second way is to use the xxxTYP variables which are defined in cmd.h.
  15. * (xxx is an abbreviation of the name of the operator/command you want.)
  16. * These variables can be used as indexes into the table.
  17. *
  18. */
  19. /* Each entry in the table is made up of one of the following structures.
  20. * The fields are:
  21. * name - the name of the operator/command
  22. * func - the function which executes the operator/command or NULL if ignore
  23. * flags - bit 0 == 1 if the drives of the arguments should be checked
  24. */
  25. struct ocentry {
  26. TCHAR *name ;
  27. int (*func)(struct cmdnode *) ;
  28. TCHAR flags ;
  29. ULONG msgno; // # used in printing help message
  30. ULONG extmsgno; // # of additional help text when extensions enabled
  31. ULONG noextramsg; //
  32. } ;
  33. /* The follow functions are the functions that execute operators and commands.
  34. * The letter "e" has been prepended to all of the function names to keep the
  35. * names from conflicting with the names of library routines and keywords.
  36. */
  37. /* M000 - Removed declaration for eExport() from the collection below
  38. * M002 - Removed declaration for eRem() from below
  39. */
  40. int eBreak(struct cmdnode *n);
  41. int eDirectory(), eRename(), eDelete(), eType(), eCopy(), ePause() ;
  42. int eTime(), eVersion(), eVolume(), eChdir(), eMkdir(), eRmdir() ;
  43. int eVerify(), eSet(), ePrompt(), ePath(), eExit(), eEcho() ;
  44. int eGoto(), eShift(), eIf(), eFor(), eCls(), eComSep(), eOr(), eAnd() ;
  45. int ePipe(), eParen(), eDate(), eErrorLevel(), eCmdExtVer(), eDefined() ;
  46. int eExist(), eNot(), eStrCmp(), eSetlocal(), eEndlocal() ; /* M000 */
  47. int eCall() ; /* M001 - Added this one */
  48. int eExtproc() ; /* M002 - Added this one */
  49. int eTitle();
  50. int eStart() ; /* START @@*/
  51. int eAppend() ; /* APPEND @@ */
  52. int eKeys() ; /* KEYS @@5 */
  53. int eMove() ; /* MOVE @@5 */
  54. int eSpecialHelp();
  55. int eColor(struct cmdnode *);
  56. /* The following external definitions are for the strings which contain the
  57. * names of the commands.
  58. */
  59. /* M000 - Removed definition for ExpStr (EXPORT command) from below
  60. */
  61. #if 1
  62. extern TCHAR BreakStr[];
  63. #endif
  64. extern TCHAR DirStr[], RenamStr[], RenStr[], EraStr[], DelStr[], TypStr[], RemStr[] ;
  65. extern TCHAR CopyStr[], PausStr[], TimStr[], VerStr[], VolStr[], CdStr[], ChdirStr[] ;
  66. extern TCHAR MdStr[], MkdirStr[], RdStr[], RmdirStr[], VeriStr[], SetStr[] ;
  67. extern TCHAR CPromptStr[], CPathStr[], ExitStr[], EchoStr[], GotoStr[] ;
  68. extern TCHAR ShiftStr[], IfStr[], ForStr[], ClsStr[], DatStr[] ;
  69. extern TCHAR ErrStr[], ExsStr[], NotStr[], SetlocalStr[], EndlocalStr[] ; /* M000 */
  70. extern TCHAR CmdExtVerStr[], DefinedStr[] ;
  71. extern TCHAR CallStr[] ; /* M001 - Added */
  72. extern TCHAR ExtprocStr[] ; /* M002 - Added */
  73. // extern TCHAR ChcpStr[] ; /* CHCP @@*/
  74. extern TCHAR TitleStr[];
  75. extern TCHAR StartStr[] ; /* START @@*/
  76. extern TCHAR AppendStr[] ; /* APPEND @@ */
  77. extern TCHAR KeysStr[] ; /* KEYS @@5 */
  78. extern TCHAR MovStr[] ; /* MOVE @@5 */
  79. extern TCHAR ColorStr[];
  80. extern TCHAR PushDirStr[], PopDirStr[], AssocStr[], FTypeStr[];
  81. /* JumpTable - operator and command jump table
  82. * There is an entry in it for every operator and command. Those commands
  83. * which have two names have two entries.
  84. *
  85. * ***NOTE: The order of the entries in this table corresponds to the defines
  86. * mentioned earlier which are used to index into this table. They MUST
  87. * be kept in sync!!
  88. */
  89. typedef int (*PCN)(struct cmdnode *);
  90. struct ocentry JumpTable[] = {
  91. {DirStr, eDirectory, NOFLAGS , MSG_HELP_DIR, 0, 0},
  92. {EraStr, eDelete, NOFLAGS , MSG_HELP_DEL_ERASE, MSG_HELP_DEL_ERASE_X, 0},
  93. {DelStr, eDelete, NOFLAGS , MSG_HELP_DEL_ERASE, MSG_HELP_DEL_ERASE_X, 0},
  94. {TypStr, eType, NOSWITCHES , MSG_HELP_TYPE, 0, 0},
  95. {CopyStr, eCopy, CHECKDRIVES , MSG_HELP_COPY, 0, 0},
  96. {CdStr, eChdir, CHECKDRIVES , MSG_HELP_CHDIR, MSG_HELP_CHDIR_X, 0},
  97. {ChdirStr, eChdir, CHECKDRIVES , MSG_HELP_CHDIR, MSG_HELP_CHDIR_X, 0},
  98. {RenamStr, eRename, CHECKDRIVES|NOSWITCHES, MSG_HELP_RENAME, 0, 0},
  99. {RenStr, eRename, CHECKDRIVES|NOSWITCHES, MSG_HELP_RENAME, 0, 0},
  100. {EchoStr, eEcho, NOFLAGS , MSG_HELP_ECHO, 0, 0},
  101. {SetStr, eSet, NOFLAGS , MSG_HELP_SET, MSG_HELP_SET_X, 3},
  102. {PausStr, ePause, NOFLAGS , MSG_HELP_PAUSE, 0, 0},
  103. {DatStr, eDate, NOFLAGS , MSG_HELP_DATE, MSG_HELP_DATE_X, 0},
  104. {TimStr, eTime, NOFLAGS , MSG_HELP_TIME, MSG_HELP_TIME_X, 0},
  105. {CPromptStr, ePrompt, NOFLAGS , MSG_HELP_PROMPT, MSG_HELP_PROMPT_X, 0},
  106. {MdStr, eMkdir, NOSWITCHES , MSG_HELP_MKDIR, MSG_HELP_MKDIR_X, 0},
  107. {MkdirStr, eMkdir, NOSWITCHES , MSG_HELP_MKDIR, MSG_HELP_MKDIR_X, 0},
  108. {RdStr, eRmdir, NOFLAGS , MSG_HELP_RMDIR, 0, 0},
  109. {RmdirStr, eRmdir, NOFLAGS , MSG_HELP_RMDIR, 0, 0},
  110. {CPathStr, ePath, NOFLAGS , MSG_HELP_PATH, 0, 0},
  111. {GotoStr, eGoto, NOFLAGS , MSG_HELP_GOTO, MSG_HELP_GOTO_X, 0},
  112. {ShiftStr, eShift, NOFLAGS , MSG_HELP_SHIFT, MSG_HELP_SHIFT_X, 0},
  113. {ClsStr, eCls, NOSWITCHES , MSG_HELP_CLS, 0, 0},
  114. {CallStr, eCall, NOFLAGS , MSG_HELP_CALL, MSG_HELP_CALL_X, 1},
  115. {VeriStr, eVerify, NOSWITCHES , MSG_HELP_VERIFY, 0, 0},
  116. {VerStr, eVersion, NOSWITCHES , MSG_HELP_VER, 0, 0},
  117. {VolStr, eVolume, NOSWITCHES , MSG_HELP_VOL, 0, 0},
  118. {ExitStr, eExit, NOFLAGS , MSG_HELP_EXIT, 0, 0},
  119. {SetlocalStr, eSetlocal, NOFLAGS , MSG_HELP_SETLOCAL, MSG_HELP_SETLOCAL_X, 0},
  120. {EndlocalStr, eEndlocal, NOFLAGS , MSG_HELP_ENDLOCAL, MSG_HELP_ENDLOCAL_X, 0},
  121. {TitleStr, eTitle, NOFLAGS , MSG_HELP_TITLE, 0, 0},
  122. {StartStr, eStart, NOFLAGS , MSG_HELP_START, MSG_HELP_START_X, 0},
  123. {AppendStr, eAppend, NOFLAGS , MSG_HELP_APPEND, 0, 0},
  124. {KeysStr, eKeys, NOSWITCHES , MSG_HELP_KEYS, 0, 0},
  125. {MovStr, eMove, CHECKDRIVES , MSG_HELP_MOVE, 0, 0},
  126. {PushDirStr, ePushDir, CHECKDRIVES|NOSWITCHES, MSG_HELP_PUSHDIR, MSG_HELP_PUSHDIR_X, 0},
  127. {PopDirStr, ePopDir, CHECKDRIVES|NOSWITCHES, MSG_HELP_POPDIR, MSG_HELP_POPDIR_X, 0},
  128. {AssocStr, eAssoc, EXTENSCMD , 0, MSG_HELP_ASSOC, 0},
  129. {FTypeStr, eFType, EXTENSCMD , 0, MSG_HELP_FTYPE, 0},
  130. {BreakStr, eBreak, NOFLAGS , MSG_HELP_BREAK, MSG_HELP_BREAK_X, 0},
  131. {ColorStr, eColor, EXTENSCMD , 0, MSG_HELP_COLOR, 0},
  132. {ForStr, (PCN)eFor, NOFLAGS , MSG_HELP_FOR, MSG_HELP_FOR_X, 3},
  133. {IfStr, (PCN)eIf, NOFLAGS , MSG_HELP_IF, MSG_HELP_IF_X, 1},
  134. {RemStr, NULL, NOFLAGS , MSG_HELP_REM, 0, 0},
  135. {NULL, (PCN)eComSep,NOFLAGS , 0, 0, 0}, // LFTYP
  136. {NULL, (PCN)eComSep,NOFLAGS , 0, 0, 0}, // CSTYP
  137. {NULL, (PCN)eOr, NOFLAGS , 0, 0, 0}, // ORTYP
  138. {NULL, (PCN)eAnd, NOFLAGS , 0, 0, 0}, // ANDTYP
  139. {NULL, (PCN)ePipe, NOFLAGS , 0, 0, 0}, // PIPTYP
  140. {NULL, (PCN)eParen, NOFLAGS , 0, 0, 0}, // PARTYP
  141. {CmdExtVerStr, eCmdExtVer, EXTENSCMD , 0, 0, 0}, // CMDVERTYP
  142. {ErrStr, eErrorLevel, NOFLAGS , 0, 0, 0}, // ERRTYP
  143. {DefinedStr, eDefined, EXTENSCMD , 0, 0, 0}, // DEFTYP
  144. {ExsStr, eExist, NOFLAGS , 0, 0, 0}, // EXSTYP
  145. {NotStr, eNot, NOFLAGS , 0, 0, 0}, // NOTTYP
  146. {NULL, eStrCmp, NOFLAGS , 0, 0, 0}, // STRTYP
  147. {NULL, eGenCmp, NOFLAGS , 0, 0, 0}, // CMPTYP
  148. {NULL, (PCN)eParen, NOFLAGS , 0, 0, 0}, // SILTYP
  149. {NULL, (PCN)eSpecialHelp, NOFLAGS , 0, 0, 0} // HELPTYP
  150. } ;