gen

package
v0.0.0-...-d539043 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2015 License: ISC Imports: 11 Imported by: 0

Documentation

Overview

Package gen contains common code for the various code generation tools in the text repository. Its usage ensures consistency between tools.

This package defines command line flags that are common to most generation tools. The flags allow for specifying specific Unicode and CLDR versions in the public Unicode data repository (http://www.unicode.org/Public).

A local Unicode data mirror can be set through the flag -local or the environment variable UNICODE_DIR. The former takes precedence. The local directory should follow the same structure as the public repository.

IANA data can also optionally be mirrored by putting it in the iana directory rooted at the top of the local mirror. Beware, though, that IANA data is not versioned. So it is up to the developer to use the right version.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CLDRVersion

func CLDRVersion() string

UnicodeVersion reports the requested CLDR version.

func Init

func Init()

Init performs common initialization for a gen command. It parses the flags and sets up the standard logging parameters.

func IsLocal

func IsLocal() bool

IsLocal reports whether the user specified a local directory.

func Open

func Open(urlRoot, subdir, path string) io.ReadCloser

Open opens subdir/path if a local directory is specified and the file exists, where subdir is a directory relative to the local root, or fetches it from urlRoot/path otherwise. It will call log.Fatal if there are any errors.

func OpenCLDRCoreZip

func OpenCLDRCoreZip() io.ReadCloser

OpenCLDRCoreZip opens the CLDR core zip file. It will call log.Fatal if there are any errors.

func OpenIANAFile

func OpenIANAFile(path string) io.ReadCloser

OpenIANAFile opens the requested IANA file. The file is specified relative to the IANA root, which is typically either http://www.iana.org or the iana directory in the local mirror. It will call log.Fatal if there are any errors.

func OpenUCDFile

func OpenUCDFile(file string) io.ReadCloser

OpenUCDFile opens the requested UCD file. The file is specified relative to the public Unicode root directory. It will call log.Fatal if there are any errors.

func OpenUnicodeFile

func OpenUnicodeFile(category, version, file string) io.ReadCloser

OpenUnicodeFile opens the requested file of the requested category from the root of the Unicode data archive. The file is specified relative to the public Unicode root directory. If version is "", it will use the default Unicode version. It will call log.Fatal if there are any errors.

func UnicodeVersion

func UnicodeVersion() string

UnicodeVersion reports the requested Unicode version.

func WriteCLDRVersion

func WriteCLDRVersion(w io.Writer)

WriteCLDRVersion writes a constant for the CLDR version from which the tables are generated.

func WriteGoFile

func WriteGoFile(filename, pkg string, b []byte)

WriteGoFiles prepends a standard file comment and package statement to the given bytes, applies gofmt, and writes them to a file with the given name. It will call log.Fatal if there are any errors.

func WriteUnicodeVersion

func WriteUnicodeVersion(w io.Writer)

WriteUnicodeVersion writes a constant for the Unicode version from which the tables are generated.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL