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. // 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
// 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. // Darwin system calls. // This file is compiled as ordinary Go code, // but it is also input to mksyscall, // which parses the //sys lines and generates system...
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 syscall func Getpagesize() int { return 4096 } func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } func NsecToTimesp...
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 syscall func Getpagesize() int { return 4096 } func NsecToTimeval(nsec int64) (tv Timeval) { tv.Sec = int32(nsec / 1e9); tv.Usec = int32(nsec % 1e9...
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. // Linux system calls. // This file is compiled as ordinary Go code, // but it is also input to mksyscall, // which parses the //sys lines and generates system ...
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 syscall //sys Chown(path string, uid int, gid int) (errno int) //sys Fchown(fd int, uid int, gid int) (errno int) //sys Fstat(fd int, stat *Stat_t) (er...
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 contains an interface to the low-level operating system // primitives. The details vary depending on the underlying system. // Its primary use ...
Go
// hand generated package syscall const ( SYS_SYSCALL_BASE = 0; SYS_RESTART_SYSCALL = (SYS_SYSCALL_BASE + 0); SYS_EXIT = (SYS_SYSCALL_BASE + 1); SYS_FORK = (SYS_SYSCALL_BASE + 2); SYS_READ = (SYS_SYSCALL_BASE + 3); SYS_WRITE = (SYS_SYSCALL_BASE + 4); SYS_OPEN = (SYS_SYSCALL_BASE + 5); SYS_CLOSE ...
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 syscall func Getpagesize() int { return 4096 } func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } func NsecToTimesp...
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 syscall import "unsafe" func Getpagesize() int { return 4096 } func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } ...
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 syscall func Getpagesize() int { return 4096 } func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } func NsecToTimesp...
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 syscall func str(val int) string { // do it here rather than with fmt to avoid dependency if val < 0 { return "-" + str(-val) } var buf [32]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. package os import ( "syscall"; ) // ForkExec forks the current process and invokes Exec with the file, arguments, // and environment specified by argv0, argv...
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 os import "syscall" // Time returns the current time, in whole seconds and // fractional nanoseconds, plus an Error if any. The current // time is 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. package os func Hostname() (name string, err Error) { return "nacl", nil }
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 os // MkdirAll creates a directory named path, // along with any necessary parents, and returns nil, // or else returns an error. // The permission bi...
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. // Process etc. package os import "syscall" var Args []string // provided by runtime var Envs []string // provided by runtime // Getuid returns the numeric...
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 os import "syscall" func isSymlink(stat *syscall.Stat_t) bool { return stat.Mode&syscall.S_IFMT == syscall.S_IFLNK } func dirFromStat(name string, d...
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. // Linux-specific package os // Hostname returns the host name reported by the kernel. func Hostname() (name string, err Error) { f, err := Open("/proc/sys/...
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 os import ( "syscall"; "unsafe"; ) const ( blockSize = 4096; // TODO(r): use statfs ) func clen(n []byte) int { for i := 0; i < len(n); i++ { 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 os import "syscall" // An operating-system independent representation of Unix data structures. // OS-specific routines in this directory convert the O...
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 os import "syscall" func isSymlink(stat *syscall.Stat_t) bool { return stat.Mode&syscall.S_IFMT == syscall.S_IFLNK } func dirFromStat(name string, d...
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. // Environment variables. package os import ( "once"; ) // ENOENV is the Error indicating that an environment variable does not exist. var ENOENV = NewError...
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 os import syscall "syscall" // An Error can represent any printable error condition. type Error interface { String() string; } // A helper type that...
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 os package provides a platform-independent interface to operating // system functionality. The design is Unix-like. package os import ( "syscall"; ) ...
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. // Darwin-specific package os import "syscall" func Hostname() (name string, err Error) { var errno int; name, errno = syscall.Sysctl("kern.hostname"); if...
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 os import "syscall" func isSymlink(stat *syscall.Stat_t) bool { return stat.Mode&syscall.S_IFMT == syscall.S_IFLNK } func dirFromStat(name string, d...
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 os import ( "syscall"; "unsafe"; ) const ( blockSize = 4096; // TODO(r): use statfs ) // Readdirnames reads the contents of the directory associat...
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 os import ( "syscall"; ) // Getwd returns a rooted path name corresponding to the // current directory. If the current directory can be // reached 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 os import ( "syscall"; "unsafe"; ) const ( blockSize = 4096; // TODO(r): use statfs ) func clen(n []byte) int { for i := 0; i < len(n); i++ { 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 image // TODO(nigeltao): Think about how floating-point color models work. // All Colors can convert themselves, with a possible loss of precision, to...
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 png import ( "bufio"; "compress/zlib"; "hash/crc32"; "image"; "io"; "os"; "strconv"; ) type encoder struct { w io.Writer; m image.Image; 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. // The png package implements a PNG image decoder and encoder. // // The PNG specification is at http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html 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. // The image package implements a basic 2-D image library. package image // An Image is a rectangular grid of Colors drawn from a ColorModel. type Image 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. package ebnf import ( "container/vector"; "go/scanner"; "go/token"; "os"; "strconv"; ) type parser struct { scanner.ErrorVector; scanner scanner.Scann...
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 library for EBNF grammars. The input is text ([]byte) satisfying // the following grammar (represented itself in EBNF): // // Production = name "=" Expres...
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 URLs (actually URIs, but that seems overly pedantic). // RFC 2396 package http import ( "os"; "strconv"; "strings"; ) // URLError reports an erro...
Go