Commit 4958d41d authored by Russ Cox's avatar Russ Cox

change from $$ to \n$$ for .6 meta section delimiter

R=r
DELTA=13  (5 added, 0 deleted, 8 changed)
OCL=18190
CL=18192
parent 2e90e542
...@@ -91,14 +91,16 @@ ldpkg(Biobuf *f, int64 len, char *filename) ...@@ -91,14 +91,16 @@ ldpkg(Biobuf *f, int64 len, char *filename)
return; return;
} }
// first $$ marks beginning of exports // first \n$$ marks beginning of exports - skip rest of line
p0 = strstr(data, "$$"); p0 = strstr(data, "\n$$");
if(p0 == nil) if(p0 == nil)
return; return;
p0 += 2; p0 += 3;
while(*p0 != '\n' && *p0 != '\0') while(*p0 != '\n' && *p0 != '\0')
p0++; p0++;
p1 = strstr(p0, "$$");
// second marks end of exports / beginning of local data
p1 = strstr(p0, "\n$$");
if(p1 == nil) { if(p1 == nil) {
fprint(2, "6l: cannot find end of exports in %s\n", filename); fprint(2, "6l: cannot find end of exports in %s\n", filename);
return; return;
...@@ -118,10 +120,13 @@ ldpkg(Biobuf *f, int64 len, char *filename) ...@@ -118,10 +120,13 @@ ldpkg(Biobuf *f, int64 len, char *filename)
loadpkgdata(filename, p0, p1 - p0); loadpkgdata(filename, p0, p1 - p0);
// local types begin where exports end. // local types begin where exports end.
p0 = p1; // skip rest of line after $$ we found above
p0 = p1 + 3;
while(*p0 != '\n' && *p0 != '\0') while(*p0 != '\n' && *p0 != '\0')
p0++; p0++;
p1 = strstr(p0, "$$");
// local types end at next \n$$.
p1 = strstr(p0, "\n$$");
if(p1 == nil) { if(p1 == nil) {
fprint(2, "6l: cannot find end of local types in %s\n", filename); fprint(2, "6l: cannot find end of local types in %s\n", filename);
return; return;
......
...@@ -701,7 +701,7 @@ foundstart: ...@@ -701,7 +701,7 @@ foundstart:
first = 0; first = 0;
continue; continue;
} }
if (strstrn(line, Blinelen(b), "$$")) if(line[0] == '$' && line[1] == '$')
goto foundend; goto foundend;
end = Boffset(b); // before closing $$ end = Boffset(b); // before closing $$
} }
......
...@@ -195,7 +195,7 @@ dumpexport(void) ...@@ -195,7 +195,7 @@ dumpexport(void)
lno = lineno; lno = lineno;
Bprint(bout, " import\n"); Bprint(bout, " import\n");
Bprint(bout, " $$ // exports\n"); Bprint(bout, "\n$$ // exports\n");
Bprint(bout, " package %s\n", package); Bprint(bout, " package %s\n", package);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment