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

Function newFile

Singular/fevoices.cc:129–164  ·  view source on GitHub ↗

2 * start the file 'fname' (STDIN is stdin) as a new voice (cf.VFile) * return FALSE on success, TRUE if an error occurs (file cannot be opened) */

Source from the content-addressed store, hash-verified

127* return FALSE on success, TRUE if an error occurs (file cannot be opened)
128*/
129BOOLEAN newFile(char *fname)
130{
131 currentVoice->Next();
132 //Print(":File%d(%s):%s(%x)\n",
133 // currentVoice->typ,BT_name[currentVoice->typ],fname,currentVoice);
134 currentVoice->filename = omStrDup(fname);
135 omMarkAsStaticAddr(currentVoice->filename);
136 if (strcmp(fname,"STDIN") == 0)
137 {
138 currentVoice->files = stdin;
139 currentVoice->sw = BI_stdin;
140 currentVoice->start_lineno = 1;
141 }
142 else
143 {
144 currentVoice->sw = BI_file; /* needed by exitVoice below */
145 currentVoice->files = feFopen(fname,"r",NULL,TRUE);
146 if (currentVoice->files==NULL)
147 {
148 exitVoice();
149 return TRUE;
150 }
151 currentVoice->start_lineno = 0;
152 }
153 yylineno=currentVoice->start_lineno;
154 //Voice *p=currentVoice;
155 //PrintS("-----------------\ncurr:");
156 //do
157 //{
158 //Print("voice fn:%s\n",p->filename);
159 //p=p->prev;
160 //}
161 //while (p!=NULL);
162 //PrintS("----------------\n");
163 return FALSE;
164}
165
166void newBuffer(char* s, feBufferTypes t, procinfo* pi, int lineno)
167{

Callers 3

grammar.ccFile · 0.85
mainFunction · 0.85
slGetDumpAsciiFunction · 0.85

Calls 4

omMarkAsStaticAddrFunction · 0.85
feFopenFunction · 0.85
exitVoiceFunction · 0.85
NextMethod · 0.45

Tested by 1

mainFunction · 0.68