MCPcopy Create free account
hub / github.com/Singular/Singular / IsCmd

Function IsCmd

Singular/iparith.cc:9760–9813  ·  view source on GitHub ↗

=================== general utilities ============================*/

Source from the content-addressed store, hash-verified

9758
9759/*=================== general utilities ============================*/
9760int IsCmd(const char *n, int & tok)
9761{
9762 int i;
9763 int an=1;
9764 int en=sArithBase.nLastIdentifier;
9765
9766 loop
9767 //for(an=0; an<sArithBase.nCmdUsed; )
9768 {
9769 if(an>=en-1)
9770 {
9771 if (strcmp(n, sArithBase.sCmds[an].name) == 0)
9772 {
9773 i=an;
9774 break;
9775 }
9776 else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
9777 {
9778 i=en;
9779 break;
9780 }
9781 else
9782 {
9783 // -- blackbox extensions:
9784 // return 0;
9785 return blackboxIsCmd(n,tok);
9786 }
9787 }
9788 i=(an+en)/2;
9789 if (*n < *(sArithBase.sCmds[i].name))
9790 {
9791 en=i-1;
9792 }
9793 else if (*n > *(sArithBase.sCmds[i].name))
9794 {
9795 an=i+1;
9796 }
9797 else
9798 {
9799 int v=strcmp(n,sArithBase.sCmds[i].name);
9800 if(v<0)
9801 {
9802 en=i-1;
9803 }
9804 else if(v>0)
9805 {
9806 an=i+1;
9807 }
9808 else /*v==0*/
9809 {
9810 break;
9811 }
9812 }
9813 }
9814 lastreserved=sArithBase.sCmds[i].name;
9815 tok=sArithBase.sCmds[i].tokval;
9816 if(sArithBase.sCmds[i].alias==2)

Callers 8

scanNewstructFromStringFunction · 0.85
newstruct_set_procFunction · 0.85
scanner.ccFile · 0.85
iiAddCprocFunction · 0.85
load_modules_auxFunction · 0.85
iiBranchToFunction · 0.85
is_builtinFunction · 0.85

Calls 2

blackboxIsCmdFunction · 0.85
ifFunction · 0.50

Tested by

no test coverage detected