From: Dmitriy Vyukov Date: Sat, 4 Aug 2012 12:11:53 +0000 (+0400) Subject: cmd/cc: allow to call nested packages from within C code X-Git-Tag: go1.1rc2~2705 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8be5e8a419d12185b410e881271875a2612dd2d5;p=gostls13.git cmd/cc: allow to call nested packages from within C code E.g. sync/atomic.LoadInt32() can be called as sync»atomic·LoadInt32() R=rsc CC=golang-dev https://golang.org/cl/6448057 --- diff --git a/src/cmd/cc/lex.c b/src/cmd/cc/lex.c index ac190a8cb1..653c298a24 100644 --- a/src/cmd/cc/lex.c +++ b/src/cmd/cc/lex.c @@ -377,11 +377,16 @@ lookup(void) symb[1] = '"'; } - // turn · into . for(r=w=symb; *r; r++) { + // turn · (U+00B7) into . + // turn ∕ (U+2215) into / if((uchar)*r == 0xc2 && (uchar)*(r+1) == 0xb7) { *w++ = '.'; r++; + }else if((uchar)*r == 0xe2 && (uchar)*(r+1) == 0x88 && (uchar)*(r+2) == 0x95) { + *w++ = '/'; + r++; + r++; }else *w++ = *r; } diff --git a/src/cmd/cc/lexbody b/src/cmd/cc/lexbody index 51d2e9396a..4cc9c73d9d 100644 --- a/src/cmd/cc/lexbody +++ b/src/cmd/cc/lexbody @@ -251,11 +251,16 @@ lookup(void) symb[1] = '"'; } - // turn · into . for(r=w=symb; *r; r++) { + // turn · (U+00B7) into . + // turn ∕ (U+2215) into / if((uchar)*r == 0xc2 && (uchar)*(r+1) == 0xb7) { *w++ = '.'; r++; + }else if((uchar)*r == 0xe2 && (uchar)*(r+1) == 0x88 && (uchar)*(r+2) == 0x95) { + *w++ = '/'; + r++; + r++; }else *w++ = *r; }