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

Function scan_proc

Singular/checklibs.c:59–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59void scan_proc(int *l)
60{
61 unsigned char *p;
62 while(1)
63 {
64 get_next(); (*l)++;
65 if (((p=strchr(buf,'('))!=NULL)&&(isalnum(*(--p))||(*p=='_')))
66 {
67 unsigned char *s=buf;
68 while(*s==' ') s++;
69 p++; (*p)='\0';
70 if ((((int)(long)(s-buf))>10)||(strchr(s,' ')!=NULL))
71 {
72 printf("warning: probably not a proc ? (%s)\n",s);
73 }
74 else
75 {
76 if (strlen(s)<4)
77 printf("error: minimal length of a procedure name is 4: %s\n",s);
78 proc[proc_cnt]=strdup(s); proc_cnt++;
79 }
80 }
81 else if (strstr(buf,"LIB ")!=NULL) break;
82 else if (strstr(buf,"LIB\"")!=NULL) break;
83 else if (strstr(buf,"proc ")!=NULL) break;
84 else if (strncmp(buf,"\";",2)==0) break; /* poor mans end-of-info*/
85 else if ((p=strstr(buf,":"))!=NULL)
86 { /* handles all capital letters + : */
87 /* SEE ALSO, KEYWORDS, NOTE, ... */
88 int ch;
89 unsigned char *pp=buf;
90 while((*pp==' ')||(*pp=='\t')) pp++;
91 ch=strspn(pp,"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
92 if ((ch>1)||(pp+ch==p))
93 {
94 break;
95 }
96 }
97 }
98 if (proc_cnt==0)
99 printf("warning: no proc found in the section PROCEDURES ?\n");
100 printf("\n# proc mentioned in the header: %d\n",proc_cnt);
101}
102
103void scan_keywords(int *l)
104{

Callers 1

scan_infoFunction · 0.85

Calls 1

get_nextFunction · 0.85

Tested by

no test coverage detected