]> Cypherpunks repositories - gostls13.git/commitdiff
change from $$ to \n$$ for .6 meta section delimiter
authorRuss Cox <rsc@golang.org>
Thu, 30 Oct 2008 23:33:50 +0000 (16:33 -0700)
committerRuss Cox <rsc@golang.org>
Thu, 30 Oct 2008 23:33:50 +0000 (16:33 -0700)
R=r
DELTA=13  (5 added, 0 deleted, 8 changed)
OCL=18190
CL=18192

src/cmd/6l/go.c
src/cmd/ar/ar.c
src/cmd/gc/export.c

index 7182cf00a98a73aae169f2848de9f208e03cf8e2..494b07bd00c6d78f51da0a33c29476c730890785 100644 (file)
@@ -91,14 +91,16 @@ ldpkg(Biobuf *f, int64 len, char *filename)
                return;
        }
 
-       // first $$ marks beginning of exports
-       p0 = strstr(data, "$$");
+       // first \n$$ marks beginning of exports - skip rest of line
+       p0 = strstr(data, "\n$$");
        if(p0 == nil)
                return;
-       p0 += 2;
+       p0 += 3;
        while(*p0 != '\n' && *p0 != '\0')
                p0++;
-       p1 = strstr(p0, "$$");
+
+       // second marks end of exports / beginning of local data
+       p1 = strstr(p0, "\n$$");
        if(p1 == nil) {
                fprint(2, "6l: cannot find end of exports in %s\n", filename);
                return;
@@ -118,10 +120,13 @@ ldpkg(Biobuf *f, int64 len, char *filename)
        loadpkgdata(filename, p0, p1 - p0);
 
        // local types begin where exports end.
-       p0 = p1;
+       // skip rest of line after $$ we found above
+       p0 = p1 + 3;
        while(*p0 != '\n' && *p0 != '\0')
                p0++;
-       p1 = strstr(p0, "$$");
+
+       // local types end at next \n$$.
+       p1 = strstr(p0, "\n$$");
        if(p1 == nil) {
                fprint(2, "6l: cannot find end of local types in %s\n", filename);
                return;
index 7b1db9676dadc2b1f549f80bf9e1325f9db496ec..cb6ae6d442ac92c8009ac9ca7727a91151e06d6a 100644 (file)
@@ -701,7 +701,7 @@ foundstart:
                        first = 0;
                        continue;
                }
-               if (strstrn(line, Blinelen(b), "$$"))
+               if(line[0] == '$' && line[1] == '$')
                        goto foundend;
                end = Boffset(b);  // before closing $$
        }
index 20fca3640b0498e2a049077f63b51b16278986f7..3498aa3dfa993cc23ea75a123efca64279ec5ee1 100644 (file)
@@ -195,7 +195,7 @@ dumpexport(void)
        lno = lineno;
 
        Bprint(bout, "   import\n");
-       Bprint(bout, "   $$  // exports\n");
+       Bprint(bout, "\n$$  // exports\n");
 
        Bprint(bout, "    package %s\n", package);