code
stringlengths
10
1.34M
language
stringclasses
1 value
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package net // goLookupPort is the native Go implementation of LookupPort. func goLookupPort(network, service string) (port int, err error) { // TODO return ...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // (Raw) IP sockets stubs for Plan 9 package net import ( "syscall" "time" ) // IPConn is the implementation of the Conn and PacketConn // interfaces for ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin freebsd linux netbsd openbsd package net import ( "os" "syscall" ) func newFileFD(f *os.File) (*netFD, error) { fd, err := syscall.Dup(in...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Unix domain sockets package net // UnixAddr represents the address of a Unix domain socket end point. type UnixAddr struct { Name string Net string } ...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package url parses URLs and implements query escaping. // See RFC 3986. package url import ( "errors" "strconv" "strings" ) // Error reports an error an...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build !cgo helenos // Stub cgo routines for systems that do not use cgo to do network lookups. package net func cgoLookupHost(name string) (addrs []stri...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Sockets for Linux package net import "syscall" func maxListenerBacklog() int { fd, err := open("/proc/sys/net/core/somaxconn") if err != nil { return...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Simple file i/o and string manipulation, to avoid // depending on strconv and bufio and strings. package net import ( "io" "os" ) type file struct { fi...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // TCP for Plan 9 package net import ( "syscall" "time" ) // TCPConn is an implementation of the Conn interface // for TCP network connections. type TCPCo...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin freebsd linux package net /* #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <stdlib.h> #...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // UDP for Plan 9 package net import ( "errors" "os" "syscall" "time" ) // UDPConn is the implementation of the Conn and PacketConn // interfaces for UD...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package net import ( "errors" "os" "syscall" ) func query(filename, query string, bufSize int) (res []string, err error) { file, err := os.OpenFile(filen...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package net // LookupHost looks up the given host using the local resolver. // It returns an array of that host's addresses. func LookupHost(host string) (add...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Network interface identification for FreeBSD package net import ( "os" "syscall" ) // If the ifindex is zero, interfaceMulticastAddrTable returns // ad...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package rpc /* Some HTML presented at http://machine:port/debug/rpc Lists services, their methods, and some statistics, still rudimentary. */ import ( "fmt...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package jsonrpc import ( "encoding/json" "errors" "io" "net/rpc" "sync" ) type serverCodec struct { dec *json.Decoder // for reading JSON values enc *...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package jsonrpc implements a JSON-RPC ClientCodec and ServerCodec // for the rpc package. package jsonrpc import ( "encoding/json" "fmt" "io" "net" "n...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /* Package rpc provides access to the exported methods of an object across a network or other I/O connection. A server registers an object, making it visible...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package rpc import ( "bufio" "encoding/gob" "errors" "io" "log" "net" "net/http" "sync" ) // ServerError represents an error that has been returned fr...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin freebsd linux netbsd openbsd windows // TCP sockets package net import ( "io" "os" "syscall" "time" ) // BUG(rsc): On OpenBSD, listeni...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Socket options for Windows package net import ( "os" "syscall" ) func setDefaultSockopts(s syscall.Handle, f, t int, ipv6only bool) error { switch f {...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package smtp import ( "crypto/hmac" "crypto/md5" "errors" "fmt" ) // Auth is implemented by an SMTP authentication mechanism. type Auth interface { // St...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package smtp implements the Simple Mail Transfer Protocol as defined in RFC 5321. // It also implements the following extensions: // 8BITMIME RFC 1652 // AU...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package html provides functions for escaping and unescaping HTML text. package html import ( "bytes" "strings" "unicode/utf8" ) type writer interface { ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package template import ( "bytes" "strings" ) // transitionFunc is the array of context transition functions for text nodes. // A transition function takes ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package template import ( "bytes" "fmt" "unicode" "unicode/utf8" ) // endsWithCSSKeyword returns whether b ends with an ident that // case-insensitively m...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package template import ( "bytes" "fmt" "strings" ) // urlFilter returns its input unless it contains an unsafe protocol in which // case it defangs the en...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package template import ( "fmt" "reflect" ) // Strings of content from a trusted source. type ( // CSS encapsulates known safe content that matches any of:...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package template import ( "strings" ) // attrTypeMap[n] describes the value of the given attribute. // If an attribute affects (or can mask) the encoding or ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package template import ( "fmt" ) // Error describes a problem encountered during template Escaping. type Error struct { // ErrorCode describes the kind of ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package template import ( "bytes" "fmt" "html" "io" "text/template" "text/template/parse" ) // escapeTemplates rewrites the named templates, which must ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package template import ( "bytes" "encoding/json" "fmt" "reflect" "strings" "unicode/utf8" ) // nextJSCtx returns the context that determines whether a ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package template import ( "bytes" "fmt" "strings" "unicode/utf8" ) // htmlNospaceEscaper escapes for inclusion in unquoted attribute values. func htmlNosp...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package template import ( "fmt" ) // context describes the state an HTML parser must be in when it reaches the // portion of HTML produced by evaluating a pa...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package template import ( "fmt" "io" "io/ioutil" "path/filepath" "sync" "text/template" "text/template/parse" ) // Template is a specialized template.T...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /* Package template (html/template) implements data-driven templates for generating HTML output safe against code injection. It provides the same interface as p...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package html // All entities that do not end with ';' are 6 or fewer bytes long. const longestEntityWithoutSemicolon = 6 // entity is a map from HTML entity n...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package crc64 implements the 64-bit cyclic redundancy check, or CRC-64, // checksum. See http://en.wikipedia.org/wiki/Cyclic_redundancy_check for // informat...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package adler32 implements the Adler-32 checksum. // Defined in RFC 1950: // Adler-32 is composed of two sums accumulated per byte: s1 is // the sum of all b...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package hash provides interfaces for hash functions. package hash import "io" // Hash is the common interface implemented by all hash functions. type Hash ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package fnv implements FNV-1 and FNV-1a, non-cryptographic hash functions // created by Glenn Fowler, Landon Curt Noll, and Phong Vo. // See http://isthe.com...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package crc32 implements the 32-bit cyclic redundancy check, or CRC-32, // checksum. See http://en.wikipedia.org/wiki/Cyclic_redundancy_check for // informat...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build ignore package crc32 // This file contains the code to call the SSE 4.2 version of the Castagnoli // CRC. // haveSSE42 is defined in crc_amd64.s an...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package crc32 // The file contains the generic version of updateCastagnoli which just calls // the software implementation. func updateCastagnoli(crc uint32, ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /* Package builtin provides documentation for Go's predeclared identifiers. The items documented here are not actually in package builtin but their descripti...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package tar implements access to tar archives. // It aims to cover most of the variations, including those produced // by GNU and BSD tars. // // References:...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package tar // TODO(dsymonds): // - catch more errors (no first header, etc.) import ( "errors" "fmt" "io" "strconv" ) var ( ErrWriteTooLong = errors...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package tar // TODO(dsymonds): // - pax extensions import ( "bytes" "errors" "io" "io/ioutil" "os" "strconv" "time" ) var ( ErrHeader = errors.New(...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package zip import ( "bufio" "compress/flate" "encoding/binary" "errors" "hash" "hash/crc32" "io" ) // TODO(adg): support zip file comments // TODO(adg...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /* Package zip provides support for reading and writing ZIP archives. See: http://www.pkware.com/documents/casestudies/APPNOTE.TXT This package does not suppo...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package zip import ( "bufio" "compress/flate" "encoding/binary" "errors" "hash" "hash/crc32" "io" "io/ioutil" "os" ) var ( ErrFormat = errors.New...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package netchan import ( "encoding/gob" "errors" "io" "reflect" "sync" "time" ) // The direction of a connection from the client's perspective. type Dir...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package netchan import ( "errors" "io" "log" "net" "reflect" "sync" "time" ) // Import // impLog is a logging convenience function. The first argumen...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /* Package netchan implements type-safe networked channels: it allows the two ends of a channel to appear on different computers connected by a network. It ...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package regexp implements a simple regular expression library. // // The syntax of the regular expressions accepted is: // // regexp: // concatenation { '|'...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Code to execute a parsed template. package template import ( "bytes" "io" "reflect" "strings" ) // Internal state for executing a Template. As we eva...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Template library: default formatters package template import ( "bytes" "fmt" "io" ) // StringFormatter formats into the default string representation. ...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Code to parse a template. package template import ( "fmt" "io" "io/ioutil" "reflect" "strconv" "strings" "unicode" "unicode/utf8" ) // Errors retu...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /* Package template implements data-driven templates for generating textual output such as HTML. Templates are executed by applying them to a data structure...
Go
/* * jQuery File Upload Plugin GAE Go Example 2.1.3 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2011, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: * http://www.opensource.org/licenses/MIT */ package app import ( "appengine" "appengine/blobstore" "appengine/i...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package crypt provides simple, password-based encryption and decryption of data blobs. package crypt import ( "bytes" "crypto/aes" "crypto/cipher" "cry...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build ignore package main import ( "flag" "fmt" "io" "log" "os" "sort" "strings" "code.google.com/p/rsc/c2go" "code.google.com/p/rsc/cc" ) var...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "flag" "fmt" "log" "os" "regexp/syntax" "runtime/pprof" ) var maxState = flag.Int("m", 1e5, "maximum number of states to explore"...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Copy of code.google.com/p/codesearch/regexp/utf.go. package main import ( "regexp/syntax" "unicode" "unicode/utf8" ) const ( instFail = syntax.I...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Copied from code.google.com/p/codesearch/regexp/copy.go // and adapted for the problem of finding a matching string, not // testing whether a particular str...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Code to merge (join) multiple regexp progs into a single prog. // New code; not copied from anywhere. package main import "regexp/syntax" func joinProgs(...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Copied from code.google.com/p/codesearch/regexp/copy.go. // Copied from Go's regexp/syntax. // Formatters edited to handle instByteRange. package main im...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Copied from code.google.com/p/codesearch/sparse/set.go, // tweaked for better inlinability. package main // For comparison: running cindex over the Linux ...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Copy of go/src/pkg/sort/sort.go, specialized for []int // and to remove some array indexing. package main func min(a, b int) int { if a < b { return a ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package app import ( "fmt" "net/http" "strings" "time" "appengine" "appengine/memcache" "appengine/urlfetch" "code.google.com/p/rsc/appfs/fs" _ "co...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package plist implements parsing of Apple plist files. package plist import ( "bytes" "fmt" "reflect" "strconv" ) func next(data []byte) (skip, tag, r...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package gf256 implements arithmetic over the Galois Field GF(256). package gf256 import "strconv" // A Field represents an instance of GF(256) defined by ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package issue provides access to the Google Code Issue Tracker API. package issue import ( "encoding/xml" "fmt" "html" "io" "net/http" "net/url" "os...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build ignore package main import ( "log" "net/http" "code.google.com/p/rsc/appfs/fs" "code.google.com/p/rsc/issue/dashboard" ) func main() { log.S...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package dashboard implements the issue dashboard for an // upcoming Go release. package dashboard import ( "bytes" "encoding/json" "fmt" "html/template...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Simple demo of using package ext2. // +build ignore package main import ( "fmt" "io" "log" "os" "strings" "code.google.com/p/rsc/ext2" ) func mai...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package ext2 implements read-only access to EXT2 file systems. package ext2 import ( "bytes" "encoding/binary" "fmt" "io" "os" "reflect" "strconv" ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package cloudprint implements sending and receiving print jobs // using Google Cloud Print (https://developers.google.com/cloud-print/). package cloudprint ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // XMPP support for talking to Google Cloud Print (only). package cloudprint import ( "bufio" "bytes" "crypto/tls" "encoding/base64" "encoding/xml" "er...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cloudprint import ( "bytes" "crypto/rand" "encoding/json" "fmt" "io" "log" "mime/multipart" "net/http" "net/http/httptest" "os/exec" "strin...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cloudprint // defaultPPD is the default PPD (capabilities) for a new printer. var defaultPPD = `*PPD-Adobe: "4.3" *FormatVersion: "4.3" *FileVersion: ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package dbstore stores and retrieves Go data structures as rows in a SQL database. // // Each struct type is stored in its own table, and each field is a sep...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( // "flag" "bufio" "fmt" "log" "net" "net/rpc" "os" "strings" "syscall" "code.google.com/p/rsc/google" "code.google.com/p/rsc...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // TODO: Add ChatHangup. // TODO: Auto-hangup chats that are gone. package main import ( "fmt" "code.google.com/p/rsc/google" "code.google.com/p/rsc/xmpp...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // TODO: Something about redialing. package google import ( // "flag" "encoding/json" "fmt" "io/ioutil" "log" "net" "net/rpc" "os" "os/exec" "sysca...
Go
package main import ( "bufio" "bytes" "flag" "fmt" "io" "log" "os" "os/exec" "os/signal" "regexp" "sort" "strings" "syscall" "time" "code.google.com/p/rsc/google" "code.google.com/p/rsc/imap" ) var cmdtab = []struct { Name string Args int F func(*Cmd, *imap.MsgPart) *imap.MsgPart TF func(*Cm...
Go
package main import ( "bufio" "bytes" "encoding/base64" "flag" "fmt" "io" "net/smtp" "os" "regexp" "strings" "code.google.com/p/rsc/google" ) func enc(s string) string { // TODO =? .. ?= return s } type Addr struct { Name string Email string } func (a Addr) enc() string { if a.Name == "" { retur...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package google import "code.google.com/p/rsc/xmpp" type ChatID struct { ID string Email string Status xmpp.Status StatusMsg string } type ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main /* TODO: - Del of main window should move to other window. - Editing main window should update status on \n or something like that. - Make use...
Go
package main import ( "io/ioutil" "log" "os" "code.google.com/p/goprotobuf/proto" "code.google.com/p/rsc/gtfs" ) func main() { log.SetFlags(0) if len(os.Args) != 2 { log.Fatal("usage: mbta file.pb") } pb, err := ioutil.ReadFile(os.Args[1]) if err != nil { log.Fatal(err) } var feed gtfs.FeedMessage ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cc type Stmt struct { SyntaxInfo Op StmtOp Pre *Expr Expr *Expr Post *Expr Decl *Decl Body *Stmt Else *Stmt Block []*Stmt ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cc import ( "bytes" "fmt" "strings" ) type special int const ( indent special = iota unindent untab newline ) type Printer struct { buf ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cc import "fmt" // An Expr is a parsed C expression. type Expr struct { SyntaxInfo Op ExprOp // operator Left *Expr // left (or only) ope...
Go
package cc var hdr_u_h = ` typedef signed char schar; typedef unsigned char uchar; typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long ulong; typedef long long vlong; typedef unsigned long long uvlong; typedef schar int8; typedef uchar uint8; typedef short int16; typedef ushort uint16; typ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build ignore package main import ( "flag" "fmt" "log" "os" "code.google.com/p/rsc/cc" ) func main() { log.SetFlags(0) flag.Parse() args := flag...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cc import ( "fmt" "strings" ) var printf = fmt.Printf type Type struct { SyntaxInfo Kind TypeKind Qual TypeQual Base *Type Tag string D...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cc import ( "fmt" "io" "io/ioutil" "strings" ) func Read(name string, r io.Reader) (*Prog, error) { return ReadMany([]string{name}, []io.Reader{...
Go
//line cc.y:34 package cc import __yyfmt__ "fmt" //line cc.y:34 type typeClass struct { c Storage q TypeQual t *Type } type idecor struct { d func(*Type) (*Type, string) i *Init } //line cc.y:49 type yySymType struct { yys int abdecor func(*Type) *Type decl *Decl decls []*Decl decor func(*...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Scoping and type checking. // C99 standard: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf package cc import ( "fmt" "strconv" "strings" ) ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cc import ( "fmt" "io/ioutil" "os" "path/filepath" "sort" "strings" ) // A Syntax represents any syntax element. type Syntax interface { // Ge...
Go