mirror of https://github.com/golang/go.git
autolib (#pragma lib)
added to 6g to autoload the included import files. SVN=124759
This commit is contained in:
parent
3311e1b673
commit
e90ae879d6
|
|
@ -28,7 +28,6 @@ compile(Node *fn)
|
||||||
return;
|
return;
|
||||||
lno = dynlineno;
|
lno = dynlineno;
|
||||||
|
|
||||||
|
|
||||||
curfn = fn;
|
curfn = fn;
|
||||||
dynlineno = curfn->lineno; // for diagnostics
|
dynlineno = curfn->lineno; // for diagnostics
|
||||||
dowidth(curfn->type);
|
dowidth(curfn->type);
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,8 @@ importfile(Val *f)
|
||||||
yyerror("import statement not a string");
|
yyerror("import statement not a string");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// BOTCH need to get .8 from backend
|
|
||||||
|
// BOTCH need to get .6 from backend
|
||||||
snprint(namebuf, sizeof(namebuf), "%Z.6", f->sval);
|
snprint(namebuf, sizeof(namebuf), "%Z.6", f->sval);
|
||||||
file = strdup(namebuf);
|
file = strdup(namebuf);
|
||||||
linehist(file, 0);
|
linehist(file, 0);
|
||||||
|
|
@ -126,6 +127,7 @@ importfile(Val *f)
|
||||||
imp = Bopen(file, OREAD);
|
imp = Bopen(file, OREAD);
|
||||||
if(imp == nil)
|
if(imp == nil)
|
||||||
fatal("cant open import: %s", namebuf);
|
fatal("cant open import: %s", namebuf);
|
||||||
|
linehist(file, -1); // acts as #pragma lib
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* position the input right
|
* position the input right
|
||||||
|
|
|
||||||
|
|
@ -64,13 +64,23 @@ void
|
||||||
linehist(char *file, long off)
|
linehist(char *file, long off)
|
||||||
{
|
{
|
||||||
Hist *h;
|
Hist *h;
|
||||||
|
char *cp;
|
||||||
|
|
||||||
if(debug['i'])
|
if(debug['i'])
|
||||||
if(file != nil)
|
if(file != nil) {
|
||||||
print("%L: import %s\n", file);
|
if(off < 0)
|
||||||
else
|
print("%L: pragma %s\n", file);
|
||||||
|
else
|
||||||
|
print("%L: import %s\n", file);
|
||||||
|
} else
|
||||||
print("%L: <eof>\n");
|
print("%L: <eof>\n");
|
||||||
|
|
||||||
|
if(off < 0 && file[0] != '/') {
|
||||||
|
cp = mal(strlen(file) + strlen(pathname) + 2);
|
||||||
|
sprint(cp, "%s/%s", pathname, file);
|
||||||
|
file = cp;
|
||||||
|
}
|
||||||
|
|
||||||
h = alloc(sizeof(Hist));
|
h = alloc(sizeof(Hist));
|
||||||
h->name = file;
|
h->name = file;
|
||||||
h->line = lineno;
|
h->line = lineno;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue