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

Function iiDeclCommand

Singular/ipshell.cc:1197–1257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1195}
1196
1197int iiDeclCommand(leftv sy, leftv name, int lev,int t, idhdl* root,BOOLEAN isring, BOOLEAN init_b)
1198{
1199 BOOLEAN res=FALSE;
1200 BOOLEAN is_qring=FALSE;
1201 const char *id = name->name;
1202
1203 sy->Init();
1204 if ((name->name==NULL)||(isdigit(name->name[0])))
1205 {
1206 WerrorS("object to declare is not a name");
1207 res=TRUE;
1208 }
1209 else
1210 {
1211 if (root==NULL) return TRUE;
1212 if (*root!=IDROOT)
1213 {
1214 if ((currRing==NULL) || (*root!=currRing->idroot))
1215 {
1216 Werror("can not define `%s` in other package",name->name);
1217 return TRUE;
1218 }
1219 }
1220 if (t==QRING_CMD)
1221 {
1222 t=RING_CMD; // qring is always RING_CMD
1223 is_qring=TRUE;
1224 }
1225
1226 if (TEST_V_ALLWARN
1227 && (name->rtyp!=0)
1228 && (name->rtyp!=IDHDL)
1229 && (currRingHdl!=NULL) && (IDLEV(currRingHdl)==myynest))
1230 {
1231 Warn("`%s` is %s in %s:%d:%s",name->name,Tok2Cmdname(name->rtyp),
1232 currentVoice->filename,yylineno,my_yylinebuf);
1233 }
1234 {
1235 sy->data = (char *)enterid(id,lev,t,root,init_b);
1236 }
1237 if (sy->data!=NULL)
1238 {
1239 sy->rtyp=IDHDL;
1240 currid=sy->name=IDID((idhdl)sy->data);
1241 if (is_qring)
1242 {
1243 IDFLAG((idhdl)sy->data)=sy->flag=Sy_bit(FLAG_QRING_DEF);
1244 }
1245 // name->name=NULL; /* used in enterid */
1246 //sy->e = NULL;
1247 if (name->next!=NULL)
1248 {
1249 sy->next=(leftv)omAllocBin(sleftv_bin);
1250 res=iiDeclCommand(sy->next,name->next,lev,t,root, isring);
1251 }
1252 }
1253 else res=TRUE;
1254 }

Callers 5

EvalMethod · 0.85
jiAssign_1Function · 0.85
ipassign.ccFile · 0.85
grammar.ccFile · 0.85
iiAssignCRFunction · 0.85

Calls 8

WerrorSFunction · 0.85
WerrorFunction · 0.85
WarnFunction · 0.85
enteridFunction · 0.85
omAllocBinFunction · 0.85
CleanUpMethod · 0.80
Tok2CmdnameFunction · 0.70
InitMethod · 0.45

Tested by

no test coverage detected