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

Function newstruct_set_proc

Singular/newstruct.cc:857–950  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

855}
856
857BOOLEAN newstruct_set_proc(const char *bbname,const char *func, int args,procinfov pr)
858{
859 int id=0;
860 blackboxIsCmd(bbname,id);
861 if (id<MAX_TOK)
862 {
863 Werror(">>%s<< is not a newstruct type",bbname);
864 return TRUE;
865 }
866 blackbox *bb=getBlackboxStuff(id);
867 newstruct_desc desc=(newstruct_desc)bb->data;
868 newstruct_proc p=(newstruct_proc)omAlloc(sizeof(*p));
869 p->next=desc->procs; desc->procs=p;
870
871 idhdl save_ring=currRingHdl;
872 currRingHdl=(idhdl)1; // fake ring detection
873
874 int tt;
875 if(!(tt=IsCmd(func,p->t)))
876 {
877 int t;
878 if((t=iiOpsTwoChar(func))!=0)
879 {
880 p->t=t;
881 tt=CMD_2; /* ..,::, ==, <=, <>, >= !=i and +,-,*,/,%,.... */
882 if ((t==PLUSPLUS)
883 ||(t==MINUSMINUS)
884 ||(t=='='))
885 tt=CMD_1; /* ++,--,= */
886 else if (t=='(') /* proc call */
887 tt=CMD_M;
888 else if (t=='-') /* unary and binary - */
889 tt=CMD_12;
890 }
891 else
892 {
893 desc->procs=p->next;
894 omFreeSize(p,sizeof(*p));
895 Werror(">>%s<< is not a kernel command",func);
896 currRingHdl = save_ring;
897 return TRUE;
898 }
899 }
900 switch(tt)
901 {
902 // type conversions:
903 case BIGINTMAT_CMD:
904 case MATRIX_CMD:
905 case INTMAT_CMD:
906 case RING_CMD:
907 case RING_DECL:
908 case ROOT_DECL:
909 // operations:
910 case CMD_1:
911 if(args!=1) { Warn("args must be 1 for %s in %s",func,my_yylinebuf);args=1;}
912 break;
913 case CMD_2:
914 if(args!=2) { Warn("args must be 2 in %s",my_yylinebuf);args=2;}

Callers 1

jjSYSTEMFunction · 0.85

Calls 6

blackboxIsCmdFunction · 0.85
WerrorFunction · 0.85
getBlackboxStuffFunction · 0.85
IsCmdFunction · 0.85
iiOpsTwoCharFunction · 0.85
WarnFunction · 0.85

Tested by

no test coverage detected