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. // Binary to decimal floating point conversion. // Algorithm: // 1) store mantissa in multiprecision decimal // 2) shift decimal by exponent // 3) read di...
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. // Multiprecision decimal numbers. // For floating-point formatting only; not general purpose. // Only operations are assign and (binary) left/right shift. // C...
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 strconv // Uitob64 returns the string representation of i in the given base. func Uitob64(u uint64, base uint) string { if u == 0 { return "0" } ...
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 strconv import ( "bytes"; "os"; "strings"; "unicode"; "utf8"; ) const lowerhex = "0123456789abcdef" // Quote returns a double-quoted Go string l...
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. // decimal to binary floating point conversion. // Algorithm: // 1) Store input in multiprecision decimal. // 2) Multiply/divide decimal by powers of two un...
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 strconv import "os" type NumError struct { Num string; Error os.Error; } func (e *NumError) String() string { return "parsing " + e.Num + ": " + e....
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. // The tar package implements access to tar archives. // It aims to cover most of the variations, including those produced // by GNU and BSD tars. // // Referen...
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, write after close, etc.) import ( "bytes"; "io"; "os"; "strconv"; "strings"; ) v...
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"; "io"; "os"; "strconv"; ) var ( HeaderError os.Error = os.ErrorString("invalid tar...
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. // This file contains operations on unsigned multi-precision integers. // These are the building blocks for the operations on signed integers // and rationals. ...
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. // This file provides Go implementations of elementary multi-precision // arithmetic operations on word vectors. Needed for platforms without // assembly implem...
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. // This file implements signed multi-precision integers. package big // An Int represents a signed multi-precision integer. // The zero value for an Int repre...
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. // Deep equality test via reflection package reflect // During deepValueEqual, must keep track of checks that are // in progress. The comparison algorithm a...
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. // The reflect package implements run-time reflection, allowing a program to // manipulate objects with arbitrary types. The typical use is to take a // value ...
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 reflect import ( "runtime"; "unsafe"; ) const ptrSize = uintptr(unsafe.Sizeof((*byte)(nil))) const cannotSet = "cannot set value obtained via unexpo...
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 strings import "os" // A Reader satisfies calls to Read and ReadByte by // reading from a string. type Reader string func (r *Reader) Read(b []byte) ...
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. // A package of simple functions to manipulate strings. package strings import ( "unicode"; "utf8"; ) // explode splits s into an array of UTF-8 sequences, ...
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. // Go declarations for malloc. // The actual functions are written in C // and part of the runtime library. // The malloc package exposes statistics and other ...
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. // A package for arbitrary precision arithmethic. // It implements the following numeric types: // // - Natural unsigned integers // - Integer signed integers /...
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. // Integer numbers // // Integers are normalized if the mantissa is normalized and the sign is // false for mant == 0. Use MakeInt to create normalized Integers...
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. // Fast versions of the routines in this file are in fast.arith.s. // Simply replace this file with arith.s (renamed from fast.arith.s) // and the bignum packag...
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. // Rational numbers package bignum import "fmt" // Rational represents a quotient a/b of arbitrary precision. // type Rational struct { a *Integer; // nume...
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. // The sort package provides primitives for sorting arrays // and user-defined collections. package sort // A type, typically a collection, that satisfies sort...
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. // The tabwriter package implements a write filter (tabwriter.Writer) // that translates tabbed columns in input into properly aligned text. // // The package i...
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 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. // The sync package provides basic synchronization primitives // such as mutual exclusion locks. These are intended for use // by low-level library routines. ...
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. // This package provides heap operations for any type that implements // heap.Interface. // package heap import "sort" // Any type that implements heap.Interf...
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. // The ring package implements operations on circular lists. package ring // A Ring is an element of a circular list, or ring. // Rings do not have a beginning...
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. // The vector package implements an efficient container for managing // linear arrays of elements. Unlike arrays, vectors can change size dynamically. package ...
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 vector // StringVector is a specialization of Vector that hides the wrapping of Elements around strings. type StringVector struct { Vector; } // Ini...
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 vector // IntVector is a specialization of Vector that hides the wrapping of Elements around ints. type IntVector struct { Vector; } // Init initia...
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. // The list package implements a doubly linked list. package list // Element is an element in the linked list. type Element struct { // Next and previous poin...
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. // This package provides a single function, Do, to run a function // exactly once, usually used as part of initialization. package once import "sync" type job...
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"; "gob"; "http"; "io"; "log"; "net"; "os"; "sync"; ) // Call represents an active RPC. type Call struct { ServiceMethod s...
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 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. /* The rpc package provides access to the public methods of an object across a network or other I/O connection. A server registers an object, making it visib...
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. // This package implements hexadecimal encoding and decoding. package hex import ( "os"; "strconv"; "strings"; ) const hextable = "0123456789abcdef" // En...
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. // This package implements translation between // unsigned integer values and byte sequences. package binary import ( "math"; "io"; "os"; "reflect"; ) //...
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 ascii85 implements the ascii85 data encoding // as used in the btoa tool and Adobe's PostScript and PDF document formats. package ascii85 import ( ...
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 base64 implements base64 encoding as specified by RFC 4648. package base64 import ( "bytes"; "io"; "os"; "strconv"; ) /* * Encodings */ // A...
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 git85 implements the radix 85 data encoding // used in the Git version control system. package git85 import ( "bytes"; "io"; "os"; "strconv"; )...
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. // This package implements the PEM data encoding, which originated in Privacy // Enhanced Mail. The most common use of PEM encoding today is in TLS keys and // ...
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 math // Floor returns the greatest integer value less than or equal to x. func Floor(x float64) float64 { if x < 0 { d, fract := Modf(-x); if fra...
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 math // Pow returns x**y, the base-x exponential of y. func Pow(x, y float64) float64 { // TODO: x or y NaN, ±Inf, maybe ±0. switch { case y == 0: ...
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 math import "unsafe" // Float32bits returns the IEEE 754 binary representation of f. func Float32bits(f float32) uint32 { return *(*uint32)(unsafe.Poi...
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 math // The original C code, the long comment, and the constants // below are from FreeBSD's /usr/src/lib/msun/src/e_exp.c // and came with this notic...
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 math func sinus(x float64, quad int) float64 { // Coefficients are #3370 from Hart & Cheney (18.80D). const ( P0 = .1357884097877375669092680e8; ...
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 math /* * Sinh(x) returns the hyperbolic sine of x * * The exponential func is called for arguments * greater in magnitude than 0.5. * * A serie...
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 math const ( uvnan = 0x7FF0000000000001; uvinf = 0x7FF0000000000000; uvneginf = 0xFFF0000000000000; mask = 0x7FF; shift = 64 - 11 - 1; bias ...
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 math // Fabs returns the absolute value of x. func Fabs(x float64) float64 { if x < 0 { return -x } return x; }
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 math /* * tanh(x) computes the hyperbolic tangent of its floating * point argument. * * sinh and cosh are called except for large arguments, which...
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 math /* * floating point tangent */ // Tan returns the tangent of x. func Tan(x float64) float64 { // Coefficients are #4285 from Hart & Cheney. (...
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 math /* * sqrt returns the square root of its floating * point argument. Newton's method. * * calls frexp */ // Sqrt returns the square root of ...
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 math // The original C code, the long comment, and the constants // below are from FreeBSD's /usr/src/lib/msun/src/e_log.c // and came with this notic...
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 math /* * floating-point mod func without infinity or NaN checking */ // Fmod returns the floating-point remainder of x/y. func Fmod(x, y float64) ...
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 math /* * hypot -- sqrt(p*p + q*q), but overflows only if the result does. * See Cleve Moler and Donald Morrison, * Replacing Square Roots by Pythag...
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. // The math package provides basic constants and mathematical functions. package math // Mathematical constants. // Reference: http://www.research.att.com/~nja...
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 math func Sqrt(x float64) float64
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 math /* * floating-point arctangent * * atan returns the value of the arctangent of its * argument in the range [-pi/2,pi/2]. * there are no erro...
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 math /* * asin(arg) and acos(arg) return the arcsin, arccos, * respectively of their arguments. * * Arctan is called after appropriate range reduc...
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 math /* * this table might overflow 127-bit exponent representations. * in that case, truncate it after 1.0e38. * it is important to get all one can...
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 math // Atan returns the arc tangent of y/x, using // the signs of the two to determine the quadrant // of the return value. func Atan2(x, y float64) ...
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 xml import ( "bytes"; "io"; "os"; "reflect"; "strings"; ) // BUG(rsc): Mapping between XML elements and data structures is inherently flawed: //...
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 xml implements a simple XML 1.0 parser that // understands XML name spaces. package xml // References: // Annotated XML spec: http://www.xml.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. /* The flag package implements command-line flag parsing. Usage: 1) Define flags using flag.String(), Bool(), Int(), etc. Example: import "flag" var ip...
Go
package patch import ( "bytes"; "os"; ) type TextDiff []TextChunk // A TextChunk specifies an edit to a section of a file: // the text beginning at Line, which should be exactly Old, // is to be replaced with New. type TextChunk struct { Line int; Old []byte; New []byte; } func ParseTextDiff(raw []byte) (TextD...
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 patch implements parsing and execution of the textual and // binary patch descriptions used by version control tools such as // CVS, Git, Mercurial,...
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 patch import "os" // An Op is a single operation to execute to apply a patch. type Op struct { Verb Verb; // action Src string; // source file Dst...
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 patch import ( "bytes"; "compress/zlib"; "crypto/sha1"; "encoding/git85"; "fmt"; "io"; "os"; ) func gitSHA1(data []byte) []byte { if len(data...
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. // The time package provides functionality for measuring and // displaying time. package time import ( "os"; ) // Seconds reports the number of seconds since...
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 time import ( "os"; "syscall"; ) // Sleep pauses the current goroutine for ns nanoseconds. // It returns os.EINTR if interrupted. func Sleep(ns int6...
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 time // TODO(rsc): This implementation of Tick is a // simple placeholder. Eventually, there will need to be // a single central time server no matter...
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. // Parse "zoneinfo" time zone file. // This is a fairly standard file format used on OS X, Linux, BSD, Sun, and others. // See tzfile(5), http://en.wikipedia.or...
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. // Marshalling and unmarshalling of // JSON data into Go structs using reflection. package json import ( "reflect"; "strings"; ) type structBuilder struct ...
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. // JSON (JavaScript Object Notation) parser. // See http://www.json.org/ // The json package implements a simple parser and // representation for JSON (JavaScr...
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. // Generic representation of JSON objects. package json import ( "container/vector"; "fmt"; "math"; "strconv"; "strings"; ) // Integers identifying the ...
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 package net import ( "os"; "reflect"; "syscall"; ) // Boolean to int. func boolint(b bool) int { if b { return 1 } return 0; } // Generi...
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 net import ( "os"; "syscall"; ) type pollster struct{} func newpollster() (p *pollster, err os.Error) { return nil, os.NewSyscallError("networking...
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 sockets package net import ( "os"; "syscall"; ) func sockaddrToTCP(sa syscall.Sockaddr) Addr { switch sa := sa.(type) { case *syscall.SockaddrIne...
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 sockets package net import ( "os"; "syscall"; ) func sockaddrToUDP(sa syscall.Sockaddr) Addr { switch sa := sa.(type) { case *syscall.SockaddrIne...
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. // Read system port mappings from /etc/services package net import ( "once"; "os"; ) var services map[string]map[string]int var servicesError os.Error fun...
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. // IP sockets package net import ( "os"; "syscall"; ) // Should we try to use the IPv4 socket interface if we're // only dealing with IPv4 sockets? As lo...
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. // Read system DNS config from /etc/resolv.conf package net import "os" type _DNS_Config struct { servers []string; // servers to use search []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. // Waiting for FDs via epoll(7). package net import ( "os"; "syscall"; ) const ( readFlags = syscall.EPOLLIN | syscall.EPOLLRDHUP; writeFlags = syscall.E...
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. // Waiting for FDs via kqueue/kevent. package net import ( "os"; "syscall"; ) type pollster struct { kq int; eventbuf [10]syscall.Kevent_t; events []s...
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 { ...
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. // DNS client: see RFC 1035. // Has to be linked into package net for Dial. // TODO(rsc): // Check periodically whether /etc/resolv.conf has changed. // Could ...
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. // The net package provides a portable interface to Unix // networks sockets, including TCP/IP, UDP, domain name // resolution, and Unix domain sockets. package...
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. // DNS packet assembly. See RFC 1035. // // This is intended to support name resolution during net.Dial. // It doesn't have to be blazing fast. // // Rather th...
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. // TODO(rsc): All the prints in this file should go to standard error. package net import ( "once"; "os"; "sync"; "syscall"; ) // Network file descriptor...
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. // IP address manipulations // // IPv4 addresses are 4 bytes; IPv6 addresses are 16 bytes. // An IPv4 address can be converted to an IPv6 address by // adding a...
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 import ( "os"; "syscall"; ) func unixSocket(net string, laddr, raddr *UnixAddr, mode string) (fd *netFD, err os.Error) ...
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. // The asn1 package implements parsing of DER-encoded ASN.1 data structures, // as defined in ITU-T Rec X.690. // // See also ``A Layman's Guide to a Subset of ...
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. // The path package implements utility routines for manipulating // slash-separated filename paths. package path import ( "io"; "os"; "strings"; ) // Clean...
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. // This package provides data and functions to test some properties of Unicode code points. package unicode const ( MaxRune = 0x10FFFF; // Maximum valid Unic...
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 unicode // IsDigit reports whether the rune is a decimal digit. func IsDigit(rune int) bool { if rune < 0x100 { // quick ASCII (Latin-1, really) check...
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. // Unicode table generator. // Data read from the web. package main import ( "bufio"; "flag"; "fmt"; "http"; "log"; "os"; "sort"; "strconv"; "strings...
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. /* * Runtime type representation. * * The following files know the exact layout of these * data structures and must be kept in sync with this file: * * .....
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. /* The runtime package contains operations that interact with Go's runtime system, such as functions to control goroutines. */ package runtime // These funct...
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. // Fork, exec, wait, etc. package syscall import ( "sync"; "unsafe"; ) // Lock synchronizing creation of new file descriptors with fork. // // We want the ...
Go