text:
package main

import (
	"fmt"
	"strings"
	"strconv"
	"regexp"
	"os"
	"bufio"
	"sort"
	"math"
	"math/rand"
	"time"
)

var Ins = os.Stdin
var Outs = os.Stdout
var Errs = os.Stderr

var intre = regexp.MustCompile(`^-?[[:digit:]]+$`)
var splitre = regexp.MustCompile(`[[:space:]]+`)
var spacere = regexp.MustCompile(`^[[:space:]]+$`)
var digitre = regexp.MustCompile(`^[[:digit:]]+$`)
var alphare = regexp.MustCompile(`^[[:alpha:]]+$`)
var alnumre = regexp.MustCompile(`^[[:alnum:]]+$`)

type List []interface{}
type Dict map[interface{}]interface{}

type Scope struct {
	Names map[string]interface{}
	Parent *Scope

	continuing bool
	breaking bool
	returning bool

	test *bool
}

type Builtin struct {
	Arity int
	Code func (*Scope, ...interface{}) (interface{}, error)
}

type Closure struct {
	Arglist []string
	Code List
	*Scope
}

type Error struct {
	Data interface{}
}

func (self Error) Error() string {
	return fmt.Sprint(self.Data)
}

func FmtError(msg string, data interface{}) Error {
	return Error{fmt.Sprintf("%s %v", msg, data)}
}

func (self List) Len() int { return len(self) }
func (self List) Swap(a, b int) { self[a], self[b] = self[b], self[a] }
func (self List) Less(a, b int) bool {
	switch item1 := self[a].(type) {
	case bool:
		switch item2 := self[b].(type) {
			case bool: return (!item1) && item2
			default: panic(Error{fmt.Sprintf(
				"Can't compare %T to %T.", item1, item2)})
		}
	case int:
		switch item2 := self[b].(type) {
			case int: return item1 < item2
			case float64: return float64(item1) < item2
			default: panic(Error{fmt.Sprintf(
				"Can't compare %T to %T.", item1, item2)})
		}
	case float64:
		switch item2 := self[b].(type) {
			case int: return item1 < float64(item2)
			case float64: return item1 < item2
			default: panic(Error{fmt.Sprintf(
				"Can't compare %T to %T.", item1, item2)})
		}
	case string:
		switch item2 := self[b].(type) {
			case string: return item1 < item2
			default: panic(Error{fmt.Sprintf(
				"Can't compare %T to %T.", item1, item2)})
		}
	default:
		panic(Error{fmt.Sprintf(
			"No comparisons defined on %T.", item1)})
	}
}

// Equal complements sort.Interface to enable all comparison operators.
func (self List) Equal(a, b int) bool {
	if self[a] == nil && self[b] == nil { return true }
	if self[a] == nil || self[b] == nil { return false }
	switch item1 := self[a].(type) {
	case int:
		switch item2 := self[b].(type) {
			case int: return item1 == item2
			case float64: return float64(item1) == item2
			default: panic(Error{fmt.Sprintf(
				"Can't compare %T to %T.", item1, item2)})
		}
	case float64:
		switch item2 := self[b].(type) {
			case int: return item1 == float64(item2)
			case float64: return item1 == item2
			default: panic(Error{fmt.Sprintf(
				"Can't compare %T to %T.", item1, item2)})
		}
	default:
		return self[a] == self[b]
	}
}

func (self *Scope) Get(name string) (interface{}, error) {
	if value, ok := self.Names[name]; ok {
		return value, nil
	} else if self.Parent != nil {
		return self.Parent.Get(name)
	} else {
		return nil, Error{"Undefined variable: " + name}
	}
}

func (self *Scope) SafeGet(name string, fallback interface{}) interface{} {
	if value, ok := self.Names[name]; ok {
		return value
	} else if self.Parent != nil {
		return self.Parent.SafeGet(name, fallback)
	} else {
		return fallback
	}
}

func (self *Scope) Put(name string, value interface{}) {
	if _, ok := self.Names[name]; ok {
		self.Names[name] = value
	} else if self.Parent != nil {
		self.Parent.Put(name, value)
	} else {
		self.Names[name] = value
	}
}

func (self *Closure) Apply(args ...interface{})  (interface{}, error) {
	locals := Scope{Names: map[string]interface{}{}, Parent: self.Scope}
	if len(self.Arglist) != len(args) {
		return nil, Error{fmt.Sprintf(
			"%d arguments passed to function expecting %d.",
			len(args), len(self.Arglist))}
	}
	for i, n := range(self.Arglist) {
		locals.Names[n] = args[i]
	}
	return Run(self.Code, &locals)
}

func (self Closure) String() string {
	return fmt.Sprintf("fn %v do %v end", self.Arglist, self.Code)
}

func EvalNext(code List, cursor int, scope *Scope) (interface{}, int, error) {
	collectArgs := func (num int, msg string) (List, error) {
		args := make(List, num)
		for i := 0; i < num; i++ {
			if cursor >= len(code) {
				return args, Error{msg}
			}
			tmp, csr, err := EvalNext(code, cursor, scope)
			if err != nil {
				return args, err
			}
			args[i] = tmp
			cursor = csr
		}
		return args, nil
	}

	value := code[cursor]

	switch value := value.(type) {
	case Builtin:
		cursor++
		args, err := collectArgs(value.Arity, "Not enough arguments.")
		if err != nil {
			return nil, cursor, err
		}
		tmp, err := value.Code(scope, args...)
		return tmp, cursor, err
	case string:
		if value[0] == ':' {
			// Expect name to be already lowercased.
			tmp, err := scope.Get(value[1:])
			return tmp, cursor + 1, err
		} else if value == "do" {
			return ScanBlock(code, cursor + 1)
		} else {
			closure := scope.SafeGet(
				strings.ToLower(value), value)
			if closure, ok := closure.(Closure); ok {
				cursor++
				args, err := collectArgs(
					len(closure.Arglist),
					"Not enough arguments to " +
						strings.ToLower(value))
				if err != nil {
					return nil, cursor, err
				}
				tmp, err := closure.Apply(args...)
				return tmp, cursor, err
			} else {
				return value, cursor + 1, nil
			}
		}
	default:
		return value, cursor + 1, nil
	}
	return nil, 0, nil
}

func ScanBlock(code List, cursor int) (List, int, error) {
	block := make(List, 0, len(code) - cursor)
	for code[cursor] != "end" {
		if code[cursor] == "do" {
			tmp, csr, err := ScanBlock(code, cursor + 1)
			if err != nil {
				return block, csr, err
			}
			block = append(block, tmp)
			cursor = csr
		} else {
			block = append(block, code[cursor])
			cursor++
		}
		if cursor >= len(code) {
			return block, cursor, Error{
				"Unexpected end of input in block."}
		}
	}
	return block, cursor + 1, nil
}

func Parse(words []string, context map[string]Builtin) (List, error) {
	code := make([]interface{}, 0, len(words))
	var buf List = nil
	in_list := false
	for _, i := range(words) {
		lower := strings.ToLower(i)
		if in_list {
			if strings.HasSuffix(i, "]") {
				if len(i) > 1 {
					buf = append(buf, i[:len(i) - 1])
				}
				code = append(code, buf)
				in_list = false
			} else {
				buf = append(buf, i)
			}
		} else if i == "[]" {
			code = append(code, make(List, 0))
		} else if strings.HasPrefix(i, "[") {
			if strings.HasSuffix(i, "]") {
				code = append(code, List{i[1:len(i) - 1]})
			} else {
				buf = List(make([]interface{}, 0))
				if len(i) > 1 {
					buf = append(buf, i[1:])
				}
				in_list = true
			}
		} else if strings.HasPrefix(i, "--") {
			break
		} else if strings.HasPrefix(i, ":") {
			code = append(code, lower)
		} else if lower  == "do" || lower == "end" {
			code = append(code, lower)
		} else if lower == "true" {
			code = append(code, true)
		} else if lower == "false" {
			code = append(code, false)
		} else if lower == "nil" {
			code = append(code, nil)
		} else if proc, ok := context[lower]; ok {
			code = append(code, proc)
		} else if intre.MatchString(i) {
			value, err := strconv.Atoi(i)
			if err == nil {
				code = append(code, value)
			} else {
				code = append(code, 0)
			}
		} else {
			value, err := strconv.ParseFloat(i, 64)
			if err == nil {
				code = append(code, value)
			} else {
				code = append(code, i)
			}
		}
	}
	if in_list {
		return List(code), FmtError(
			"Unclosed list at end of line:", words)
	} else {
		return List(code), nil
	}
}

// Run underlies most other control structures.
func Run(code List, scope *Scope) (interface{}, error) {
	cursor := 0
	for cursor < len(code) {
		value, csr, err := EvalNext(code, cursor, scope)
		if err != nil {
			return nil, err
		} else if scope.continuing || scope.breaking {
			return nil, nil
		} else if scope.returning {
			return value, nil
		} else if value != nil {
			return value, FmtError(
				"You don't say what to do with:", value)
		}
		cursor = csr
	}
	return nil, nil
}

// Results underlies while, ifelse and the command line.
func Results(code List, scope *Scope) (List, error) {
	values := make([]interface{}, 0, len(code))
	cursor := 0
	for cursor < len(code) {
		val, csr, err := EvalNext(code, cursor, scope)
		if err != nil {
			return List(values), err
		} else if scope.returning {
			return List{val}, nil
		} else if scope.breaking || scope.continuing {
			break
		}
		values = append(values, val)
		cursor = csr
	}
	return List(values), nil
}

func Load(fn string, ctx map[string]Builtin, s *Scope) (interface{}, error) {
	code := make([]interface{}, 0)
	file, err := os.Open(fn)
	if err != nil { return nil, err }
	defer file.Close()
	scanner := bufio.NewScanner(file)
	for scanner.Scan() {
		line := strings.TrimSpace(scanner.Text())
		if len(line) == 0 { continue }
		words := splitre.Split(line, -1)
		tokens, err := Parse(words, ctx)
		if err != nil { return nil, err }
		code = append(code, tokens...)
	}
	if scanner.Err() == nil {
		return Run(List(code), s)
	} else {
		return nil, scanner.Err()
	}
}

// Catch runs some code and traps any regular error or panic in a variable.
func Catch(varname string, code List, scope *Scope) (interface{}, error) {
	varname = strings.ToLower(varname)
	defer func () {
		if err := recover(); err != nil {
			scope.Names[varname] = fmt.Sprint(err)
		}
	}()
	value, err := Run(code, scope)
	if err != nil {
		scope.Names[varname] = err.Error()
	} else {
		scope.Names[varname] = nil
	}
	if scope.returning {
		return value, nil
	} else {
		return nil, nil
	}
}

func PrintList(list List) {
	fmt.Fprintln(Outs, strings.Join(StringSlice(list), " "))
}

func TypeList(list List) {
	fmt.Fprint(Outs, strings.Join(StringSlice(list), " "))
}

// Readword returns a line of input from stdin without any processing.
func Readword() (string, error) {
	scanner := bufio.NewScanner(Ins)
	if scanner.Scan() {
		return scanner.Text(), nil
	} else if err := scanner.Err(); err != nil {
		return "", err
	} else {
		return "", bufio.ErrFinalToken
	}
}

// While loop.
func While(cond, code List, scope *Scope) (interface{}, error) {
	for {
		test, err := Results(cond, scope)
		if err != nil { return nil, err }
		if !ToBool(test[0]) { return nil, nil }

		value, err := Run(code, scope)
		if err != nil {
			return nil, err
		} else if scope.returning {
			return value, nil
		} else if scope.continuing {
			scope.continuing = false
		} else if scope.breaking {
			scope.breaking = false
			break
		}
	}
	return nil, nil
}

// For loop; the variable is always treated as local.
func For(v string, i, l, p float64, code List, s *Scope) (interface{}, error) {
	v = strings.ToLower(v)
	s.Names[v] = i
	if l >= i {
		for i <= l {
			value, err := Run(code, s)
			if err != nil {
				return nil, err
			} else if s.returning {
				return value, nil
			} else if s.continuing {
				s.continuing = false
			} else if s.breaking {
				s.breaking = false
				break
			}
			i += p
			s.Names[v] = i
		}
	} else {
		for i >= l {
			value, err := Run(code, s)
			if err != nil {
				return nil, err
			} else if s.returning {
				return value, nil
			} else if s.continuing {
				s.continuing = false
			} else if s.breaking {
				s.breaking = false
				break
			}
			i += p
			s.Names[v] = i
		}
	}
	return nil, nil
}

// Foreach loop; the variable is always treated as local.
func Foreach(v string, items, code List, s *Scope) (interface{}, error) {
	v = strings.ToLower(v)
	for _, i := range(items) {
		s.Names[v] = i
		value, err := Run(code, s)
		if err != nil {
			return nil, err
		} else if s.returning {
			return value, nil
		} else if s.continuing {
			s.continuing = false
		} else if s.breaking {
			s.breaking = false
			break
		}
	}
	return nil, nil
}

// Fn creates a closure over the current scope and returns it.
func Fn(arglist []string, code List, scope *Scope) Closure {
	for i, arg := range(arglist) {
		arglist[i] = strings.ToLower(arg)
	}
	return Closure{arglist, code, scope}
}

// Function defines a named function in the current scope.
func Function(name string, arglist []string, code List, scope *Scope) {
	scope.Names[strings.ToLower(name)] = Fn(arglist, code, scope)
}

// Map maps a user-defined function to the given argument list.
func Map(closure Closure, args List) (List, error) {
	results := List(make([]interface{}, len(args)))
	for i, arg := range(args) {
		val, err := closure.Apply(arg)
		if err != nil {
			return results, err
		} else {
			results[i] = val
		}
	}
	return results, nil
}

// Filter filters the given argument list by a user-defined function.
func Filter(closure Closure, args List) (List, error) {
	results := List(make([]interface{}, 0, len(args)))
	for _, arg := range(args) {
		val, err := closure.Apply(arg)
		if err != nil {
			return results, err
		} else if ToBool(val) {
			results = append(results, arg)
		}
	}
	return results, nil
}

// Add adds two numbers, preserving the type if at all possible.
func Add(a, b interface{}) interface{} {
	switch t1 := a.(type) {
	case int:
		switch t2 := b.(type) {
			case int: return t1 + t2
			case float64: return float64(t1) + t2
			default: return math.NaN()
		}
	case float64:
		switch t2 := b.(type) {
			case int: return t1 + float64(t2)
			case float64: return t1 + t2
			default: return math.NaN()
		}
	default:
		return math.NaN()
	}
}

// Sub subtracts two numbers, preserving the type if at all possible.
func Sub(a, b interface{}) interface{} {
	switch t1 := a.(type) {
	case int:
		switch t2 := b.(type) {
			case int: return t1 - t2
			case float64: return float64(t1) - t2
			default: return math.NaN()
		}
	case float64:
		switch t2 := b.(type) {
			case int: return t1 - float64(t2)
			case float64: return t1 - t2
			default: return math.NaN()
		}
	default:
		return math.NaN()
	}
}

// Mul multiplies two numbers, preserving the type if at all possible.
func Mul(a, b interface{}) interface{} {
	switch t1 := a.(type) {
	case int:
		switch t2 := b.(type) {
			case int: return t1 * t2
			case float64: return float64(t1) * t2
			default: return math.NaN()
		}
	case float64:
		switch t2 := b.(type) {
			case int: return t1 * float64(t2)
			case float64: return t1 * t2
			default: return math.NaN()
		}
	default:
		return math.NaN()
	}
}

func First(value interface{}) (interface{}, error) {
	switch seq := value.(type) {
	case List:
		if len(seq) > 0 {
			return seq[0], nil
		} else {
			return nil, Error{"First got an empty list."}
		}
	case string:
		if len(seq) > 0 {
			return seq[0:1], nil
		} else {
			return nil, Error{"First got an empty string."}
		}
	default:
		return nil, FmtError("First expects a sequence, got:", value)
	}
}

func Last(value interface{}) (interface{}, error) {
	switch seq := value.(type) {
	case List:
		if len(seq) > 0 {
			return seq[len(seq) - 1], nil
		} else {
			return nil, Error{"Last got an empty list."}
		}
	case string:
		if len(seq) > 0 {
			return seq[len(seq) - 1:len(seq)], nil
		} else {
			return nil, Error{"Last got an empty string."}
		}
	default:
		return nil, FmtError("Last expects a sequence, got:", value)
	}
}

func ButFirst(value interface{}) (interface{}, error) {
	switch seq := value.(type) {
	case List:
		if len(seq) > 0 {
			return seq[1:], nil
		} else {
			return nil, Error{"ButFirst got an empty list."}
		}
	case string:
		if len(seq) > 0 {
			return seq[1:], nil
		} else {
			return nil, Error{"ButFirst got an empty string."}
		}
	default:
		return nil, FmtError(
			"ButFirst expects a sequence, got:", value)
	}
}

func ButLast(value interface{}) (interface{}, error) {
	switch seq := value.(type) {
	case List:
		if len(seq) > 0 {
			return seq[0:len(seq) - 1], nil
		} else {
			return nil, Error{"ButLast got an empty list."}
		}
	case string:
		if len(seq) > 0 {
			return seq[0:len(seq) - 1], nil
		} else {
			return nil, Error{"ButLast got an empty string."}
		}
	default:
		return nil, FmtError(
			"ButLast expects a sequence, got:", value)
	}
}

func Sorted(seq List) List {
	sorted := List(make([]interface{}, len(seq)))
	copy(sorted, seq)
	sort.Sort(sorted)
	return sorted
}

func Fput(item interface{}, seq List) List {
	ext := List(make([]interface{}, 0, len(seq) + 1))
	ext = append(ext, item)
	ext = append(ext, seq...)
	return ext
}

func Lput(item interface{}, seq List) List {
	ext := List(make([]interface{}, len(seq) + 1))
	copy(ext, seq)
	ext[len(ext) -1] = item
	return ext
}

func Pick(value interface{}) (interface{}, error) {
	switch seq := value.(type) {
	case List:
		if len(seq) > 0 {
			return seq[rand.Intn(len(seq))], nil
		} else {
			return nil, Error{"Pick got an empty list."}
		}
	case string:
		if len(seq) > 0 {
			pos := rand.Intn(len(seq))
			return seq[pos:pos + 1], nil
		} else {
			return nil, Error{"Pick got an empty string."}
		}
	default:
		return nil, FmtError("Pick expects a sequence, got:", value)
	}
}

func SetItem(index int, seq List, item interface{}) {
	if index < 0 {
		index = len(seq) + index
	}
	seq[index] = item
}

func Split(word string) List {
	words := splitre.Split(strings.TrimSpace(word), -1)
	if len(words) == 1 && words[0] == "" {
		return List{}
	} else {
		return StringList(words)
	}
}

func Copy(a interface{}) interface{} {
	switch data := a.(type) {
	case List:
		cp := List(make([]interface{}, len(data)))
		copy(cp, data)
		return cp
	case Dict:
		cp := make(map[interface{}]interface{}, len(data))
		for k, v := range(data) {
			cp[k] = v
		}
		return Dict(cp)
	default: return data
	}
}

func Concat(seq1, seq2 List) List {
	cat := List(make([]interface{},
		len(seq1), len(seq1) + len(seq2)))
	copy(cat, seq1)
	cat = append(cat, seq2...)
	return cat
}

func Iseq(init, limit int) List {
	if init <= limit {
		seq := List(make([]interface{}, 0, limit - init + 1))
		for i := init; i <= limit; i++ {
			seq = append(seq, i)
		}
		return seq
	} else {
		seq := List(make([]interface{}, 0, init - limit + 1))
		for i := init; i >= limit; i-- {
			seq = append(seq, i)
		}
		return seq
	}
}

func ToBool(input interface{}) bool {
	if input == nil { return false }
	switch input := input.(type) {
		case bool: return input
		case int: return input != 0
		case float64: return input != 0
		default: panic(Error{fmt.Sprintf(
			"Can't convert %#v to bool.", input)})
	}
}

func ToString(input interface{}) string {
	switch input := input.(type) {
		case string: return input
		default: return fmt.Sprint(input)
	}
}

func ParseFloat(input interface{}) float64 {
	switch input := input.(type) {
		case float64: return float64(input)
		case int: return float64(input)
		case string:
			value, err := strconv.ParseFloat(input, 64)
			if err == nil {
				return value
			} else {
				return math.NaN()
			}
		default: return math.NaN()
	}
}

func ParseInt(input interface{}) int {
	switch input := input.(type) {
		case float64: return int(input)
		case int: return int(input)
		case string:
			value, err := strconv.Atoi(input)
			if err == nil {
				return value
			} else {
				panic(Error{fmt.Sprintf(
					"Can't convert %#v to int.", input)})
			}
		default: panic(Error{fmt.Sprintf(
			"Can't convert %#v to int.", input)})
	}
}

func StringSlice(input List) []string {
	if input == nil { return nil }
	output := make([]string, len(input))
	for i, val := range(input) {
		output[i] = ToString(val)
	}
	return output
}

func StringList(input []string) List {
	if input == nil { return nil }
	output := List(make([]interface{}, len(input)))
	for i, val := range(input) {
		output[i] = val
	}
	return output
}

func Substring(init, limit int, seq string) string {
	if limit < 0 {
		limit = len(seq) + limit
	}
	return seq[init:limit]
}

func Sublist(init, limit int, seq List) List {
	if limit < 0 {
		limit = len(seq) + limit
	}
	return seq[init:limit]
}

// NewDict returns a new dictionary off a list of alternating keys and values.
func NewDict(init List) Dict {
	dictionary := Dict{}
	i := 0
	for i < len(init) {
		key := init[i]
		i++
		if i < len(init) {
			dictionary[key] = init[i]
		} else {
			dictionary[key] = nil
		}
		i++
	}
	return dictionary
}

func DictKeys(dict Dict) List {
	keys := List(make([]interface{}, 0, len(dict)))
	for i := range(dict) {
		keys = append(keys, i)
	}
	return keys
}

var Procedures = map[string]Builtin {
	"run": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		if code, ok := a[0].(List); ok {
			return Run(code, s)
		} else {
			return nil, FmtError(
				"Run expects a list, found:", a[0])
		}
	}},
	"results": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		if code, ok := a[0].(List); ok {
			return Results(code, s)
		} else {
			return nil, FmtError(
				"Results expects a list, found:", a[0])
		}
	}},
	"ignore": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		if s.returning {
			return a[0], nil
		} else {
			return nil, nil
		}
	}},

	"catch": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		code := a[1].(List)
		return Catch(ToString(a[0]), code, s)
	}},
	"throw": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		return nil, Error{a[0]}
	}},

	"break": {0, func (s *Scope, a ...interface{}) (interface{}, error) {
		s.breaking = true
		return nil, nil
	}},
	"continue": {0,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		s.continuing = true
		return nil, nil
	}},
	"return": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		s.returning = true
		return a[0], nil
	}},

	"print": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		switch value := a[0].(type) {
			case List: PrintList(value)
			default: fmt.Fprintln(Outs, value)
		}
		return nil, nil
	}},
	"type": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		switch value := a[0].(type) {
			case List: TypeList(value)
			default: fmt.Fprint(Outs, value)
		}
		return nil, nil
	}},
	"show": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		fmt.Fprintln(Outs, a[0])
		return nil, nil
	}},

	"readword": {0,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		word, err := Readword()
		if err == bufio.ErrFinalToken {
			return nil, nil
		} else {
			return word, err
		}
	}},
	"readlist": {0,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		word, err := Readword()
		if err == bufio.ErrFinalToken {
			return nil, nil
		} else if err == nil {
			return Split(word), nil
		} else {
			return List{}, err
		}
	}},

	"make": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		varname := ToString(a[0])
		s.Put(strings.ToLower(varname), a[1])
		return nil, nil
	}},
	"local": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		switch name := a[0].(type) {
		case List:
			for _, i := range(name) {
				tmp := strings.ToLower(ToString(i))
				s.Names[tmp] = nil
			}
		default: s.Names[strings.ToLower(ToString(name))] = nil
		}
		return nil, nil
	}},
	"localmake": {2,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		varname := ToString(a[0])
		s.Names[strings.ToLower(varname)] = a[1]
		return nil, nil
	}},
	"thing": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		varname := ToString(a[0])
		return s.Get(strings.ToLower(varname))
	}},

	"if": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		cond := ToBool(a[0])
		if code, ok := a[1].(List); ok {
			if cond {
				return Run(code, s)
			} else {
				return nil, nil
			}
		} else {
			return nil, FmtError("If expects a list, got:", a[1])
		}
	}},
	"test": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		s.test = new(bool)
		*s.test = ToBool(a[0])
		return nil, nil
	}},
	"iftrue": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		if s.test == nil {
			return nil, Error{"Iftrue without test."}
		} else if *s.test {
			return Run(a[0].(List), s)
		} else {
			return nil, nil
		}
	}},
	"iffalse": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		if s.test == nil {
			return nil, Error{"Iffalse without test."}
		} else if !*s.test {
			return Run(a[0].(List), s)
		} else {
			return nil, nil
		}
	}},

	"for": {5, func (s *Scope, a ...interface{}) (interface{}, error) {
		varname := ToString(a[0])
		init := ParseFloat(a[1])
		limit := ParseFloat(a[2])
		step := ParseFloat(a[3])
		code := a[4].(List)
		return For(varname, init, limit, step, code, s)
	}},
	"foreach": {3,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		varname := ToString(a[0])
		items := a[1].(List)
		code := a[2].(List)
		return Foreach(varname, items, code, s)
	}},

	"function": {3,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		args := StringSlice(a[1].(List))
		code := a[2].(List)
		Function(ToString(a[0]), args, code, s)
		return nil, nil
	}},
	"fn": {2,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		args := StringSlice(a[0].(List))
		code := a[1].(List)
		return Fn(args, code, s), nil
	}},
	"apply": {2,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		closure := a[0].(Closure)
		args := a[1].(List)
		return closure.Apply(args...)
	}},
	"map": {2,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		closure := a[0].(Closure)
		args := a[1].(List)
		return Map(closure, args)
	}},
	"filter": {2,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		closure := a[0].(Closure)
		args := a[1].(List)
		return Filter(closure, args)
	}},
	"arity": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		switch proc := a[0].(type) {
			case Closure: return len(proc.Arglist), nil
			case Builtin: return proc.Arity, nil
			default: return nil, FmtError(
				"Arity expects fn or procedure, got:", a[0])
		}
	}},

	"add": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return Add(a[0], a[1]), nil
	}},
	"sub": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return Sub(a[0], a[1]), nil
	}},
	"mul": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return Mul(a[0], a[1]), nil
	}},
	"div": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return ParseFloat(a[0]) / ParseFloat(a[1]), nil
	}},
	"mod": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return ParseInt(a[0]) % ParseInt(a[1]), nil
	}},
	"pow": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return math.Pow(ParseFloat(a[0]), ParseFloat(a[1])), nil
	}},
	"abs": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		switch n := a[0].(type) {
			case int:
				if n < 1 {
					return -n, nil
				} else {
					return n, nil
				}
			case float64: return math.Abs(n), nil
			default: return math.NaN(), nil
		}
	}},
	"minus": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		switch n := a[0].(type) {
			case int: return -n, nil
			case float64: return -n, nil
			default: return math.NaN(), nil
		}
	}},
	"int": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		switch n := a[0].(type) {
			case int: return n, nil
			case float64: return math.Trunc(n), nil
			default: return math.NaN(), nil
		}
	}},

	"pi": {0, func (s *Scope, a ...interface{}) (interface{}, error) {
		return math.Pi, nil
	}},
	"sqrt": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		return math.Sqrt(ParseFloat(a[0])), nil
	}},
	"sin": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		return math.Sin(ParseFloat(a[0])), nil
	}},
	"cos": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		return math.Cos(ParseFloat(a[0])), nil
	}},
	"rad": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		return ParseFloat(a[0]) * (math.Pi / 180), nil
	}},
	"deg": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		return ParseFloat(a[0]) * (180 / math.Pi), nil
	}},
	"hypot": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return math.Hypot(ParseFloat(a[0]), ParseFloat(a[1])), nil
	}},

	"min": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		if List(a).Less(0, 1) {
			return a[0], nil
		} else {
			return a[1], nil
		}
	}},
	"max": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		if List(a).Less(0, 1) {
			return a[1], nil
		} else {
			return a[0], nil
		}
	}},

	"lt": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return List(a).Less(0, 1), nil
	}},
	"lte": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return List(a).Less(0, 1) || List(a).Equal(0, 1), nil
	}},
	"eq": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return List(a).Equal(0, 1), nil
	}},
	"neq": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return !List(a).Equal(0, 1), nil
	}},
	"gt": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return !(List(a).Less(0, 1) || List(a).Equal(0, 1)), nil
	}},
	"gte": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return !List(a).Less(0, 1), nil
	}},

	"and": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return ToBool(a[0]) && ToBool(a[1]), nil
	}},
	"or": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return ToBool(a[0]) || ToBool(a[1]), nil
	}},
	"not": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		return !ToBool(a[0]), nil
	}},

	"first": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		return First(a[0])
	}},
	"last": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		return Last(a[0])
	}},
	"butfirst": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return ButFirst(a[0])
	}},
	"butlast": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return ButLast(a[0])
	}},
	"count": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		switch seq := a[0].(type) {
			case List: return len(seq), nil
			case Dict: return len(seq), nil
			case string: return len(seq), nil
			default: return nil, FmtError(
				"Count expects a list or string, got:", a[0])
		}
	}},
	"sorted": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return Sorted(a[0].(List)), nil
	}},

	"list": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return List{a[0], a[1]}, nil
	}},
	"fput": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return Fput(a[0], a[1].(List)), nil
	}},
	"lput": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return Lput(a[0], a[1].(List)), nil
	}},
	"item": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		index := ParseInt(a[0])
		switch seq := a[1].(type) {
		case List:
			if index < 0 {
				index = len(seq) + index
			}
			return seq[index], nil
		case string:
			if index < 0 {
				index = len(seq) + index
			}
			return seq[index:index + 1], nil
		default: return nil, FmtError(
			"Item expects a sequence, got:", a[0])
		}
	}},
	"iseq": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return Iseq(ParseInt(a[0]), ParseInt(a[1])), nil
	}},

	"array": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return List(make([]interface{}, ParseInt(a[0]))), nil
	}},
	"copy": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return Copy(a[0]), nil
	}},
	"concat": {2,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return Concat(a[0].(List), a[1].(List)), nil
	}},
	"slice": {3,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		init := ParseInt(a[0])
		limit := ParseInt(a[1])
		switch seq := a[2].(type) {
			case List: return Sublist(init, limit, seq), nil
			case string: return Substring(init, limit, seq), nil
			default: return nil, FmtError(
				"Slice expects a list or string, got:", a[2])
		}
	}},
	"setitem": {3,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		index := ParseInt(a[0])
		seq := a[1].(List)
		SetItem(index, seq, a[2])
		return nil, nil
	}},

	"lowercase": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return strings.ToLower(ToString(a[0])), nil
	}},
	"uppercase": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return strings.ToUpper(ToString(a[0])), nil
	}},
	"trim": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		return strings.TrimSpace(ToString(a[0])), nil
	}},
	"ltrim": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		return strings.TrimLeft(ToString(a[0]), " \t\r\n\v"), nil
	}},
	"rtrim": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		return strings.TrimRight(ToString(a[0]), " \t\r\n\v"), nil
	}},

	"empty": {0, func (s *Scope, a ...interface{}) (interface{}, error) {
		return "", nil
	}},
	"space": {0, func (s *Scope, a ...interface{}) (interface{}, error) {
		return " ", nil
	}},
	"tab": {0, func (s *Scope, a ...interface{}) (interface{}, error) {
		return "\t", nil
	}},
	"cr": {0, func (s *Scope, a ...interface{}) (interface{}, error) {
		return "\r", nil
	}},
	"lf": {0, func (s *Scope, a ...interface{}) (interface{}, error) {
		return "\n", nil
	}},

	"split": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		return Split(ToString(a[0])), nil
	}},
	"join": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		switch seq := a[0].(type) {
		case List: return strings.Join(StringSlice(seq), " "), nil
		default: return nil, FmtError(
			"Join expects a list, got:", a[0])
		}
	}},
	"split-by": {2,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return strings.Split(ToString(a[1]), ToString(a[0])), nil
	}},
	"join-by": {2,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		switch seq := a[1].(type) {
		case List: return strings.Join(
			StringSlice(seq), ToString(a[0])), nil
		default: return nil, FmtError(
			"Join-by expects a list, got:", a[1])
		}
	}},
	"word": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		return ToString(a[0]) + ToString(a[1]), nil
	}},

	"starts-with": {2,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return strings.HasPrefix(
			ToString(a[1]), ToString(a[0])), nil
	}},
	"ends-with": {2,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return strings.HasSuffix(
			ToString(a[1]), ToString(a[0])), nil
	}},

	"to-string": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return ToString(a[0]), nil
	}},
	"parse-int": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return ParseInt(a[0]), nil
	}},
	"parse-float": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return ParseFloat(a[0]), nil
	}},

	"is-string": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		_, ok := a[0].(string)
		return ok, nil
	}},
	"is-bool": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		_, ok := a[0].(bool)
		return ok, nil
	}},
	"is-int": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		_, ok := a[0].(int)
		return ok, nil
	}},
	"is-float": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		_, ok := a[0].(float64)
		return ok, nil
	}},
	"is-list": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		_, ok := a[0].(List)
		return ok, nil
	}},
	"is-dict": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		_, ok := a[0].(Dict)
		return ok, nil
	}},
	"is-fn": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		_, ok := a[0].(Closure)
		return ok, nil
	}},
	"is-proc": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		_, ok := a[0].(Builtin)
		return ok, nil
	}},

	"is-space": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return spacere.MatchString(ToString(a[0])), nil
	}},
	"is-alpha": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return alphare.MatchString(ToString(a[0])), nil
	}},
	"is-alnum": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return alnumre.MatchString(ToString(a[0])), nil
	}},
	"is-digit": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		return digitre.MatchString(ToString(a[0])), nil
	}},

	"dict": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		switch seq := a[0].(type) {
			case List: return NewDict(seq), nil
			default: return nil, FmtError(
				"Dict expects a list, got:", a[0])
		}
	}},
	"get": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		if dict, ok := a[0].(Dict); ok {
			return dict[a[1]], nil
		} else {
			return  nil, FmtError(
				"Get expects a dictionary, got:", a[0])
		}
	}},
	"put": {3, func (s *Scope, a ...interface{}) (interface{}, error) {
		if dict, ok := a[0].(Dict); ok {
			dict[a[1]] = a[2]
			return nil, nil
		} else {
			return  nil, FmtError(
				"Put expects a dictionary, got:", a[0])
		}
	}},
	"del": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		if dict, ok := a[0].(Dict); ok {
			delete(dict, ToString(a[1]))
			return nil, nil
		} else {
			return  nil, FmtError(
				"Del expects a dictionary, got:", a[0])
		}
	}},
	"keys": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		return DictKeys(a[0].(Dict)), nil
	}},

	"rnd": {0, func (s *Scope, a ...interface{}) (interface{}, error) {
		return rand.Float64(), nil
	}},
	"random": {2, func (s *Scope, a ...interface{}) (interface{}, error) {
		low := ParseInt(a[0])
		high := ParseInt(a[1])
		return rand.Intn(high - low + 1) + low, nil
	}},
	"rerandom": {1,
	func (s *Scope, a ...interface{}) (interface{}, error) {
		rand.Seed(int64(ParseFloat(a[0])))
		return nil, nil
	}},
	"pick": {1, func (s *Scope, a ...interface{}) (interface{}, error) {
		return Pick(a[0])
	}},

	"timer": {0, func (s *Scope, a ...interface{}) (interface{}, error) {
		return float64(
			time.Now().UnixNano()) / (1000 * 1000 * 1000), nil
	}},
}

func init() {
	tmp := func (s *Scope, a ...interface{}) (interface{}, error) {
		return Load(ToString(a[0]), Procedures, s)
	}
	Procedures["load"] = Builtin{1, tmp}

	tmp = func (s *Scope, a ...interface{}) (interface{}, error) {
		if words, ok := a[0].(List); ok {
			return Parse(StringSlice(words), Procedures)
		} else {
			return nil, FmtError(
				"Parse expects a list, found:", a[0])
		}
	}
	Procedures["parse"] = Builtin{1, tmp}

	tmp = func (s *Scope, a ...interface{}) (interface{}, error) {
		// The condition must be a literal list.
		cond := a[0].(List)
		code := a[1].(List)
		pcond, err := Parse(StringSlice(cond), Procedures)
		if err != nil {
			return nil, err
		} else {
			return While(pcond, code, s)
		}
	}
	Procedures["while"] = Builtin{2, tmp}

	tmp = func (s *Scope, a ...interface{}) (interface{}, error) {
		cond := ToBool(a[0])
		iftrue := a[1].(List)
		iffalse := a[2].(List)
		if cond {
			code, err := Parse(StringSlice(iftrue), Procedures)
			if err != nil {
				return nil, err
			} else {
				res, err := Results(code, s)
				return res[0], err
			}
		} else {
			code, err := Parse(StringSlice(iffalse), Procedures)
			if err != nil {
				return nil, err
			} else {
				res, err := Results(code, s)
				return res[0], err
			}
		}
	}
	Procedures["ifelse"] = Builtin{3, tmp}

	tmp = func (s *Scope, a ...interface{}) (interface{}, error) {
		names := make([]interface{}, 0, len(Procedures))
		for i := range(Procedures) {
			names = append(names, i)
		}
		return List(names), nil
	}
	Procedures["procedures"] = Builtin{0, tmp}
}

func main() {
	if len(os.Args) > 1 {
		rand.Seed(time.Now().UnixNano())
		defer func () {
			if err := recover(); err != nil {
				fmt.Println(err)
			}
		}()
		toplevel := Scope{Names: map[string]interface{}{}}
		code, err := Parse(os.Args[1:], Procedures)
		if err == nil {
			results, err2 := Results(code, &toplevel)
			if err2 == nil {
				for _, i := range(results) {
					if i != nil {
						fmt.Println(i)
					}
				}
			} else {
				fmt.Fprintln(Errs, err2)
			}
		} else {
			fmt.Fprintln(Errs, err)
		}
	} else {
		fmt.Println("Lunar Logo beta, 2017-02-09")
		fmt.Println("Usage:\n\tlunar [logo code...]")
		fmt.Println("\tlunar load <filename>")
	}
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

	 <meta name="description" content="FLOGGING -- Fortran logging system with MPI support">

    <meta name="author" content="Chris MacMackin" >
    <link rel="icon" href="../favicon.png">

    <title>
All Modules – flogging
</title>

    <link href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../css/pygments.css" rel="stylesheet">
    <link href="../css/font-awesome.min.css" rel="stylesheet">
    <link href="../css/local.css" rel="stylesheet">

    <link  href="../tipuesearch/tipuesearch.css" rel="stylesheet">

          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            Toggle navigation

          </button>
          flogging

Source Files

Modules

Procedures

        <form action="../search.html" class="navbar-form navbar-right" role="search">

          <input type="text" class="form-control" placeholder="Search" name="q" id="tipue_search_input" autocomplete="off" required>

        </form>

Modules

Module	Source File	Description

flogging	flogging.f90
 Settings functions (public)
 Logging functions (public)
** Utility functions (private)

vt100	vt100.f90

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg id="modulegraphModuleGraph" width="185pt" height="74pt"
 viewBox="0.00 0.00 185.00 74.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="module~~graph~~ModuleGraph" class="graph" transform="scale(1 1) rotate(0) translate(4 70)">
<title>module~~graph~~ModuleGraph</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-70 181,-70 181,4 -4,4"/>

<g id="module~~graph~~ModuleGraph_node1" class="node"><title>module~flogging</title>
<g id="a_module~~graph~~ModuleGraph_node1">
<polygon fill="#337ab7" stroke="#337ab7" points="177,-45 123,-45 123,-21 177,-21 177,-45"/>
<text text-anchor="middle" x="150" y="-30.6" font-family="Helvetica,sans-Serif" font-size="10.50" fill="white">flogging</text>

</g>
</g>

<g id="module~~graph~~ModuleGraph_node2" class="node"><title>module~vt100</title>
<g id="a_module~~graph~~ModuleGraph_node2">
<polygon fill="#337ab7" stroke="#337ab7" points="70.5,-66 16.5,-66 16.5,-42 70.5,-42 70.5,-66"/>
<text text-anchor="middle" x="43.5" y="-51.6" font-family="Helvetica,sans-Serif" font-size="10.50" fill="white">vt100</text>

</g>
</g>

<g id="module~~graph~~ModuleGraph_edge2" class="edge"><title>module~vt100->module~flogging</title>
<path fill="none" stroke="#ff0000" stroke-dasharray="5,2" d="M70.6002,-48.755C83.3181,-46.1992 98.8209,-43.0838 112.673,-40.3002"/>
<polygon fill="#ff0000" stroke="#ff0000" points="113.756,-43.6526 122.87,-38.2509 112.377,-36.7898 113.756,-43.6526"/>
</g>

<g id="module~~graph~~ModuleGraph_node3" class="node"><title>iso_fortran_env</title>
<g id="a_module~~graph~~ModuleGraph_node3">
<polygon fill="#337ab7" stroke="#337ab7" points="87,-24 0,-24 0,-0 87,-0 87,-24"/>
<text text-anchor="middle" x="43.5" y="-9.6" font-family="Helvetica,sans-Serif" font-size="10.50" fill="white">iso_fortran_env</text>

</g>
</g>

<g id="module~~graph~~ModuleGraph_edge1" class="edge"><title>iso_fortran_env->module~flogging</title>
<path fill="none" stroke="#ff0000" stroke-dasharray="5,2" d="M87.0042,-20.5415C95.6011,-22.2691 104.563,-24.0701 112.914,-25.7482"/>
<polygon fill="#ff0000" stroke="#ff0000" points="112.238,-29.1823 122.731,-27.7211 113.617,-22.3195 112.238,-29.1823"/>
</g>
</g>
</svg>

Help

                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

Graph Key

Nodes of different colours represent the following:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="641pt" height="26pt"
 viewBox="0.00 0.00 641.00 25.98" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(0.811906 0.811906) rotate(0) translate(4 28)">
<title>Graph Key</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-28 785.5,-28 785.5,4 -4,4"/>

<g id="node1" class="node"><title>Module</title>
<polygon fill="#337ab7" stroke="#337ab7" points="54,-24 0,-24 0,-0 54,-0 54,-24"/>
<text text-anchor="middle" x="27" y="-9.6" font-family="Helvetica,sans-Serif" font-size="10.50" fill="white">Module</text>
</g>

<g id="node2" class="node"><title>Submodule</title>
<polygon fill="#5bc0de" stroke="#5bc0de" points="139.5,-24 72.5,-24 72.5,-0 139.5,-0 139.5,-24"/>
<text text-anchor="middle" x="106" y="-9.6" font-family="Helvetica,sans-Serif" font-size="10.50" fill="white">Submodule</text>
</g>

<g id="node3" class="node"><title>Type</title>
<polygon fill="#5cb85c" stroke="#5cb85c" points="212,-24 158,-24 158,-0 212,-0 212,-24"/>
<text text-anchor="middle" x="185" y="-9.6" font-family="Helvetica,sans-Serif" font-size="10.50" fill="white">Type</text>
</g>

<g id="node4" class="node"><title>Subroutine</title>
<polygon fill="#d9534f" stroke="#d9534f" points="294,-24 230,-24 230,-0 294,-0 294,-24"/>
<text text-anchor="middle" x="262" y="-9.6" font-family="Helvetica,sans-Serif" font-size="10.50" fill="white">Subroutine</text>
</g>

<g id="node5" class="node"><title>Function</title>
<polygon fill="#d94e8f" stroke="#d94e8f" points="366,-24 312,-24 312,-0 366,-0 366,-24"/>
<text text-anchor="middle" x="339" y="-9.6" font-family="Helvetica,sans-Serif" font-size="10.50" fill="white">Function</text>
</g>

<g id="node6" class="node"><title>Interface</title>
<polygon fill="#a7506f" stroke="#a7506f" points="439.5,-24 384.5,-24 384.5,-0 439.5,-0 439.5,-24"/>
<text text-anchor="middle" x="412" y="-9.6" font-family="Helvetica,sans-Serif" font-size="10.50" fill="white">Interface</text>
</g>

<g id="node7" class="node"><title>Unknown Procedure Type</title>
<polygon fill="#777777" stroke="#777777" points="594,-24 458,-24 458,-0 594,-0 594,-24"/>
<text text-anchor="middle" x="526" y="-9.6" font-family="Helvetica,sans-Serif" font-size="10.50" fill="white">Unknown Procedure Type</text>
</g>

<g id="node8" class="node"><title>Program</title>
<polygon fill="#f0ad4e" stroke="#f0ad4e" points="666,-24 612,-24 612,-0 666,-0 666,-24"/>
<text text-anchor="middle" x="639" y="-9.6" font-family="Helvetica,sans-Serif" font-size="10.50" fill="white">Program</text>
</g>

<g id="node9" class="node"><title>This Page's Entity</title>
<polygon fill="none" stroke="black" points="781.5,-24 684.5,-24 684.5,-0 781.5,-0 781.5,-24"/>
<text text-anchor="middle" x="733" y="-9.6" font-family="Helvetica,sans-Serif" font-size="10.50">This Page's Entity</text>
</g>
</g>
</svg>

Where possible, edges connecting nodes are given different colours to make them
easier to distinguish in large graphs.

Module Graph

Solid arrows point from a parent (sub)module to the submodule which is
descended from it. Dashed arrows point from a module being used to the
module using it.

Type Graph

Solid arrows point from one derived type to another which extends
(inherits from) it. Dashed arrows point from a derived type to another
type containing it as a components, with a label listing the name(s) of
said component(s).

Call Graph

Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.

© 2016

 flogging was developed by Daan van Vugt

            Documentation generated by
            FORD

redpajama_set_name: RedPajamaGithub


text:
@interface HWCacheManager : NSObject
+ (nullable instancetype)manager;

- (void)cacheObjectWithHWClient:(nonnull HWBaseClient *)client cacheobject:(nonnull id<NSCoding>)caCheobject;

- (nullable id)cacheObjectWithHWClient:(nonnull HWBaseClient *)client;

- (void)removeAllCache;
@end


text:
package annis.visualizers.component.tree.backends.staticimg;

import annis.visualizers.component.tree.GraphicsItem;
import java.awt.Graphics2D;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public abstract class AbstractImageGraphicsItem implements GraphicsItem {
	private List<AbstractImageGraphicsItem> children = new ArrayList<AbstractImageGraphicsItem>();
	private int zValue;

	public void addChildItem(AbstractImageGraphicsItem childItem) {
		children.add(childItem);
	}

	public abstract void draw(Graphics2D canvas);

	@Override
	public void setParentItem(GraphicsItem parent) {
		((AbstractImageGraphicsItem)parent).addChildItem(this);
	}

	@Override
	public void setZValue(int newZValue) {
		zValue = newZValue;
	}

	public int getZValue() {
		return zValue;
	}

	public Collection<AbstractImageGraphicsItem> getChildren() {
		return children;
	}

	public void getAllChildren(List<AbstractImageGraphicsItem> outputList) {
		outputList.addAll(children);
		for (AbstractImageGraphicsItem child: children) {
			child.getAllChildren(outputList);
		}
	}
}


text:
var airkit = require('airkit/gulp/compilejs');
var config = require('../config');

module.exports = function() {
  return airkit.compilejs(
      config.JS_SOURCES, config.JS_OUT_DIR, config.JS_OUT_FILE,
      config.JS_OPTIONS);
};


text:
<?php

Class Stacey {

  static $version = '2.2.2';

  var $route;

  function handle_redirects() {
    # rewrite any calls to /index or /app back to /
    if(preg_match('/^\/?(index|app)\/?$/', $_SERVER['REQUEST_URI'])) {
      header('HTTP/1.1 301 Moved Permanently');
      header('Location: ../');
      return true;
    }
    # add trailing slash if required
    if(!preg_match('/\/$/', $_SERVER['REQUEST_URI']) && !preg_match('/\./', $_SERVER['REQUEST_URI'])) {
      header('HTTP/1.1 301 Moved Permanently');
      header('Location:'.$_SERVER['REQUEST_URI'].'/');
      return true;
    }
    return false;
  }

  function php_fixes() {
    # in PHP/5.3.0 they added a requisite for setting a default timezone, this should be handled via the php.ini, but as we cannot rely on this, we have to set a default timezone ourselves
    if(function_exists('date_default_timezone_set')) date_default_timezone_set('Australia/Melbourne');
  }

  function set_content_type($template_file) {
    # split by file extension
    preg_match('/\.([\w\d]+?)$/', $template_file, $split_path);

    switch ($split_path[1]) {
      case 'txt':
        # set text/utf-8 charset header
        header("Content-type: text/plain; charset=utf-8");
        break;
      case 'atom':
        # set atom+xml/utf-8 charset header
        header("Content-type: application/atom+xml; charset=utf-8");
        break;
      case 'rss':
        # set rss+xml/utf-8 charset header
        header("Content-type: application/rss+xml; charset=utf-8");
        break;
      case 'rdf':
        # set rdf+xml/utf-8 charset header
        header("Content-type: application/rdf+xml; charset=utf-8");
        break;
      case 'xml':
        # set xml/utf-8 charset header
        header("Content-type: text/xml; charset=utf-8");
        break;
      case 'json':
        # set json/utf-8 charset header
        header('Content-type: application/json; charset=utf-8');
        break;
      case 'css':
        # set text/css charset header
        header('Content-type: text/css; charset=utf-8');
        break;
      default:
        # set html/utf-8 charset header
        header("Content-type: text/html; charset=utf-8");
    }
  }

  function etag_expired($cache) {
    header('Etag: "'.$cache->hash.'"');
    if(isset($_SERVER['HTTP_IF_NONE_MATCH']) && stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) == '"'.$cache->hash.'"') {
      # local cache is still fresh, so return 304
      header("HTTP/1.0 304 Not Modified");
      header('Content-Length: 0');
      return false;
    } else {
      return true;
    }
  }

  function render($file_path, $template_file) {
    $cache = new Cache($file_path, $template_file);
    # set any custom headers
    $this->set_content_type($template_file);
    # if etag is still fresh, return 304 and don't render anything
    if(!$this->etag_expired($cache)) return;
    # if cache has expired
    if($cache->expired()) {
      # render page & create new cache
      echo $cache->create($this->route);
    } else {
      # render the existing cache
      echo $cache->render();
    }
  }

  function create_page($file_path) {
    # return a 404 if a matching folder doesn't exist
    if(!file_exists($file_path)) throw new Exception('404');

    # register global for the path to the page which is currently being viewed
    global $current_page_file_path;
    $current_page_file_path = $file_path;

    # register global for the template for the page which is currently being viewed
    global $current_page_template_file;
    $template_name = Page::template_name($file_path);
    $current_page_template_file = Page::template_file($template_name);

    # error out if template file doesn't exist (or glob returns an error)
    if(empty($template_name)) throw new Exception('404');

    if(!$current_page_template_file) {
      throw new Exception('A template named \''.$template_name.'\' could not be found in the \'/templates\' folder');
    }
    # render page
    $this->render($file_path, $current_page_template_file);
  }

  function __construct($get) {
    # sometimes when PHP release a new version, they do silly things - this function is here to fix them
    $this->php_fixes();
    # it's easier to handle some redirection through php rather than relying on a more complex .htaccess file to do all the work
    if($this->handle_redirects()) return;

    # strip any leading or trailing slashes from the passed url
    $key = preg_replace(array('/\/$/', '/^\//'), '', key($get));
    # store file path for this current page
    $this->route = isset($key) ? $key : 'index';
    $file_path = Helpers::url_to_file_path($this->route);

    try {
      # create and render the current page
      $this->create_page($file_path);
    } catch(Exception $e) {
      if($e->getMessage() == "404") {
        # return 404 headers
        header('HTTP/1.0 404 Not Found');
        if(file_exists('./content/404')) {
          $this->create_page('./content/404', '404');
        }
        else if(file_exists('./public/404.html')) {
          echo file_get_contents('./public/404.html');
        }
        else {
          echo '
404

Page could not be found.

Unfortunately, the page you were looking for does not exist here.
';
        }

      } else {
        echo '
'.$e->getMessage().'
';
      }
    }
  }

}

?>


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Diplodia circinans Berk. & Broome, 1875

### Remarks
null


text:
package com.amazonaws.services.pricing.model;

import java.io.Serializable;
import javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;

/**
 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetProductsRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     *

     * The code for the service whose products you want to retrieve.
     *

     */
    private String serviceCode;
    /**
     *

     * The list of filters that limit the returned products. only products that match all filters are returned.
     *

     */
    private java.util.List<Filter> filters;
    /**
     *

     * The format version that you want the response to be in.
     *

     *

     * Valid values are: aws_v1
     *

     */
    private String formatVersion;
    /**
     *

     * The pagination token that indicates the next set of results that you want to retrieve.
     *

     */
    private String nextToken;
    /**
     *

     * The maximum number of results to return in the response.
     *

     */
    private Integer maxResults;

    /**
     *

     * The code for the service whose products you want to retrieve.
     *

     *
     * @param serviceCode
     *        The code for the service whose products you want to retrieve.
     */

    public void setServiceCode(String serviceCode) {
        this.serviceCode = serviceCode;
    }

    /**
     *

     * The code for the service whose products you want to retrieve.
     *

     *
     * @return The code for the service whose products you want to retrieve.
     */

    public String getServiceCode() {
        return this.serviceCode;
    }

    /**
     *

     * The code for the service whose products you want to retrieve.
     *

     *
     * @param serviceCode
     *        The code for the service whose products you want to retrieve.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetProductsRequest withServiceCode(String serviceCode) {
        setServiceCode(serviceCode);
        return this;
    }

    /**
     *

     * The list of filters that limit the returned products. only products that match all filters are returned.
     *

     *
     * @return The list of filters that limit the returned products. only products that match all filters are returned.
     */

    public java.util.List<Filter> getFilters() {
        return filters;
    }

    /**
     *

     * The list of filters that limit the returned products. only products that match all filters are returned.
     *

     *
     * @param filters
     *        The list of filters that limit the returned products. only products that match all filters are returned.
     */

    public void setFilters(java.util.Collection<Filter> filters) {
        if (filters == null) {
            this.filters = null;
            return;
        }

        this.filters = new java.util.ArrayList<Filter>(filters);
    }

    /**
     *

     * The list of filters that limit the returned products. only products that match all filters are returned.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setFilters(java.util.Collection)} or {@link #withFilters(java.util.Collection)} if you want to override
     * the existing values.
     *

     *
     * @param filters
     *        The list of filters that limit the returned products. only products that match all filters are returned.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetProductsRequest withFilters(Filter... filters) {
        if (this.filters == null) {
            setFilters(new java.util.ArrayList<Filter>(filters.length));
        }
        for (Filter ele : filters) {
            this.filters.add(ele);
        }
        return this;
    }

    /**
     *

     * The list of filters that limit the returned products. only products that match all filters are returned.
     *

     *
     * @param filters
     *        The list of filters that limit the returned products. only products that match all filters are returned.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetProductsRequest withFilters(java.util.Collection<Filter> filters) {
        setFilters(filters);
        return this;
    }

    /**
     *

     * The format version that you want the response to be in.
     *

     *

     * Valid values are: aws_v1
     *

     *
     * @param formatVersion
     *        The format version that you want the response to be in.

     *

     *        Valid values are: aws_v1
     */

    public void setFormatVersion(String formatVersion) {
        this.formatVersion = formatVersion;
    }

    /**
     *

     * The format version that you want the response to be in.
     *

     *

     * Valid values are: aws_v1
     *

     *
     * @return The format version that you want the response to be in.

     *

     *         Valid values are: aws_v1
     */

    public String getFormatVersion() {
        return this.formatVersion;
    }

    /**
     *

     * The format version that you want the response to be in.
     *

     *

     * Valid values are: aws_v1
     *

     *
     * @param formatVersion
     *        The format version that you want the response to be in.

     *

     *        Valid values are: aws_v1
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetProductsRequest withFormatVersion(String formatVersion) {
        setFormatVersion(formatVersion);
        return this;
    }

    /**
     *

     * The pagination token that indicates the next set of results that you want to retrieve.
     *

     *
     * @param nextToken
     *        The pagination token that indicates the next set of results that you want to retrieve.
     */

    public void setNextToken(String nextToken) {
        this.nextToken = nextToken;
    }

    /**
     *

     * The pagination token that indicates the next set of results that you want to retrieve.
     *

     *
     * @return The pagination token that indicates the next set of results that you want to retrieve.
     */

    public String getNextToken() {
        return this.nextToken;
    }

    /**
     *

     * The pagination token that indicates the next set of results that you want to retrieve.
     *

     *
     * @param nextToken
     *        The pagination token that indicates the next set of results that you want to retrieve.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetProductsRequest withNextToken(String nextToken) {
        setNextToken(nextToken);
        return this;
    }

    /**
     *

     * The maximum number of results to return in the response.
     *

     *
     * @param maxResults
     *        The maximum number of results to return in the response.
     */

    public void setMaxResults(Integer maxResults) {
        this.maxResults = maxResults;
    }

    /**
     *

     * The maximum number of results to return in the response.
     *

     *
     * @return The maximum number of results to return in the response.
     */

    public Integer getMaxResults() {
        return this.maxResults;
    }

    /**
     *

     * The maximum number of results to return in the response.
     *

     *
     * @param maxResults
     *        The maximum number of results to return in the response.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetProductsRequest withMaxResults(Integer maxResults) {
        setMaxResults(maxResults);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getServiceCode() != null)
            sb.append("ServiceCode: ").append(getServiceCode()).append(",");
        if (getFilters() != null)
            sb.append("Filters: ").append(getFilters()).append(",");
        if (getFormatVersion() != null)
            sb.append("FormatVersion: ").append(getFormatVersion()).append(",");
        if (getNextToken() != null)
            sb.append("NextToken: ").append(getNextToken()).append(",");
        if (getMaxResults() != null)
            sb.append("MaxResults: ").append(getMaxResults());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof GetProductsRequest == false)
            return false;
        GetProductsRequest other = (GetProductsRequest) obj;
        if (other.getServiceCode() == null ^ this.getServiceCode() == null)
            return false;
        if (other.getServiceCode() != null && other.getServiceCode().equals(this.getServiceCode()) == false)
            return false;
        if (other.getFilters() == null ^ this.getFilters() == null)
            return false;
        if (other.getFilters() != null && other.getFilters().equals(this.getFilters()) == false)
            return false;
        if (other.getFormatVersion() == null ^ this.getFormatVersion() == null)
            return false;
        if (other.getFormatVersion() != null && other.getFormatVersion().equals(this.getFormatVersion()) == false)
            return false;
        if (other.getNextToken() == null ^ this.getNextToken() == null)
            return false;
        if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false)
            return false;
        if (other.getMaxResults() == null ^ this.getMaxResults() == null)
            return false;
        if (other.getMaxResults() != null && other.getMaxResults().equals(this.getMaxResults()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getServiceCode() == null) ? 0 : getServiceCode().hashCode());
        hashCode = prime * hashCode + ((getFilters() == null) ? 0 : getFilters().hashCode());
        hashCode = prime * hashCode + ((getFormatVersion() == null) ? 0 : getFormatVersion().hashCode());
        hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode());
        hashCode = prime * hashCode + ((getMaxResults() == null) ? 0 : getMaxResults().hashCode());
        return hashCode;
    }

    @Override
    public GetProductsRequest clone() {
        return (GetProductsRequest) super.clone();
    }

}


text:
module.exports = function(context){
  var error = "context is safe",
    context = context.bot;

  // Check for context
  if( typeof context !== 'object' ){
    error = "The context argument needs to be an object";
    throw error;
  }
  // Check for a message object
  if( !context.message ){
    error = "Missing message: A messege to read needs to be available";
    throw error;
  // Check if the message is a string
  } else if( typeof context.message !== 'string' ){
    error = "The message prop on context needs to be a string";
    throw error;
  }
  // Check for a responseList
  if( !context.responseList ){
    error = "Missing responseList: A list of possible responses needs to be available";
    throw error;
  } else if( context.responseList && context.responseList.constructor !== Array){
    error = "The responseList prop needs to be an array of objects";
    throw error;
  }

  return error;
}// exports


text:
package org.apache.http.impl.nio.codecs;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.WritableByteChannel;

import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.impl.io.HttpTransportMetricsImpl;
import org.apache.http.nio.FileContentEncoder;
import org.apache.http.nio.reactor.SessionOutputBuffer;
import org.apache.http.util.Args;

/**
 * Content encoder that cuts off after a defined number of bytes. This class
 * is used to send content of HTTP messages where the end of the content entity
 * is determined by the value of the Content-Length header.
 * Entities transferred using this stream can be maximum {@link Long#MAX_VALUE}
 * long.
 *

 * This decoder is optimized to transfer data directly from
 * a {@link FileChannel} to the underlying I/O session's channel whenever
 * possible avoiding intermediate buffering in the session buffer.
 *
 * @since 4.0
 */
@NotThreadSafe
public class LengthDelimitedEncoder extends AbstractContentEncoder
        implements FileContentEncoder {

    private final long contentLength;
    private final int fragHint;

    private long remaining;

    /**
     * @since 4.3
     *
     * @param channel underlying channel.
     * @param buffer  session buffer.
     * @param metrics transport metrics.
     * @param contentLength content length.
     * @param fragementSizeHint fragment size hint defining an minimal size of a fragment
     *   that should be written out directly to the channel bypassing the session buffer.
     *   Value 0 disables fragment buffering.
     */
    public LengthDelimitedEncoder(
            final WritableByteChannel channel,
            final SessionOutputBuffer buffer,
            final HttpTransportMetricsImpl metrics,
            final long contentLength,
            final int fragementSizeHint) {
        super(channel, buffer, metrics);
        Args.notNegative(contentLength, "Content length");
        this.contentLength = contentLength;
        this.fragHint = fragementSizeHint > 0 ? fragementSizeHint : 0;
        this.remaining = contentLength;
    }

    public LengthDelimitedEncoder(
            final WritableByteChannel channel,
            final SessionOutputBuffer buffer,
            final HttpTransportMetricsImpl metrics,
            final long contentLength) {
        this(channel, buffer, metrics, contentLength, 0);
    }

    private int nextChunk(final ByteBuffer src) {
        return (int) Math.min(Math.min(this.remaining, Integer.MAX_VALUE), src.remaining());
    }

    public int write(final ByteBuffer src) throws IOException {
        if (src == null) {
            return 0;
        }
        assertNotCompleted();

        int total = 0;
        while (src.hasRemaining() && this.remaining > 0) {
            if (this.buffer.hasData() || this.fragHint > 0) {
                final int chunk = nextChunk(src);
                if (chunk <= this.fragHint) {
                    final int capacity = this.fragHint - this.buffer.length();
                    if (capacity > 0) {
                        final int limit = Math.min(capacity, chunk);
                        final int bytesWritten = writeToBuffer(src, limit);
                        this.remaining -= bytesWritten;
                        total += bytesWritten;
                    }
                }
            }
            if (this.buffer.hasData()) {
                final int chunk = nextChunk(src);
                if (this.buffer.length() >= this.fragHint || chunk > 0) {
                    final int bytesWritten = flushToChannel();
                    if (bytesWritten == 0) {
                        break;
                    }
                }
            }
            if (!this.buffer.hasData()) {
                final int chunk = nextChunk(src);
                if (chunk > this.fragHint) {
                    final int bytesWritten = writeToChannel(src, chunk);
                    this.remaining -= bytesWritten;
                    total += bytesWritten;
                    if (bytesWritten == 0) {
                        break;
                    }
                }
            }
        }
        if (this.remaining <= 0) {
            super.complete();
        }
        return total;
    }

    public long transfer(
            final FileChannel src,
            final long position,
            final long count) throws IOException {

        if (src == null) {
            return 0;
        }
        assertNotCompleted();

        flushToChannel();
        if (this.buffer.hasData()) {
            return 0;
        }

        final long chunk = Math.min(this.remaining, count);
        final long bytesWritten = src.transferTo(position, chunk, this.channel);
        if (bytesWritten > 0) {
            this.metrics.incrementBytesTransferred(bytesWritten);
        }
        this.remaining -= bytesWritten;
        if (this.remaining <= 0) {
            super.complete();
        }
        return bytesWritten;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("[content length: ");
        sb.append(this.contentLength);
        sb.append("; pos: ");
        sb.append(this.contentLength - this.remaining);
        sb.append("; completed: ");
        sb.append(isCompleted());
        sb.append("]");
        return sb.toString();
    }

}


text:
using System.Diagnostics;
using Microsoft.CSharp.RuntimeBinder.Errors;
using Microsoft.CSharp.RuntimeBinder.Syntax;

namespace Microsoft.CSharp.RuntimeBinder.Semantics
{
    internal class LangCompiler :
         CSemanticChecker,
         IErrorSink
    {
        private SymbolLoader _symbolLoader;
        private CController _pController;   // This is our parent "controller"
        private ErrorHandling _errorContext;
        private GlobalSymbolContext _globalSymbolContext;
        private UserStringBuilder _userStringBuilder;

        ////////////////////////////////////////////////////////////////////////////////
        // Construct a compiler. All the real work is done in the Init() routine. This
        // primary initializes all the sub-components.

        public LangCompiler(CController pCtrl, NameManager pNameMgr)
        {
            Debug.Assert(pCtrl != null);

            _pController = pCtrl;
            _globalSymbolContext = new GlobalSymbolContext(pNameMgr);
            _userStringBuilder = new UserStringBuilder(_globalSymbolContext);
            _errorContext = new ErrorHandling(_userStringBuilder, this, pCtrl.GetErrorFactory());
            _symbolLoader = new SymbolLoader(_globalSymbolContext, null, _errorContext);
        }

        public new ErrorHandling GetErrorContext()
        {
            return _errorContext;
        }

        public override SymbolLoader SymbolLoader { get { return _symbolLoader; } }
        public override SymbolLoader GetSymbolLoader() { return _symbolLoader; }

        ////////////////////////////////////////////////////////////////////////////////
        // Searches the class [atsSearch] to see if it contains a method which is
        // sufficient to implement [mwt]. Does not search base classes. [mwt] is
        // typically a method in some interface.  We may be implementing this interface
        // at some particular type, e.g. IList<String>, and so the required signature is
        // the instantiation (i.e. substitution) of [mwt] for that instance. Similarly,
        // the implementation may be provided by some base class that exists via
        // polymorphic inheritance, e.g. Foo : List<String>, and so we must instantiate
        // the parameters for each potential implementation. [atsSearch] may thus be an
        // instantiated type.
        //
        // If fOverride is true, this checks for a method with swtSlot set to the
        // particular method.
        public void SubmitError(CParameterizedError error)
        {
            CError pError = GetErrorContext().RealizeError(error);

            if (pError == null)
            {
                return;
            }
            _pController.SubmitError(pError);
        }

        public int ErrorCount()
        {
            return 0;
        }
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Welcome to django-listable's documentation! — django-listable 0.2.4 documentation</title>

    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />

    <link rel="top" title="django-listable 0.2.4 documentation" href="#" />
    <link rel="next" title="Contributing" href="contributing.html" />

Navigation

          index

          next |

django-listable 0.2.4 documentation »

Welcome to django-listable’s documentation!¶

Contents:

Contributing

Types of Contributions

Report Bugs

Fix Bugs

Implement Features

Write Documentation

Submit Feedback

Get Started!

Pull Request Guidelines

Tips

Credits

Development Lead

Contributors

History

0.2.0 (2014-10-29)

0.1.2 (2014-07-09)

0.1.0 (2013-08-15)

TODO

About¶

Listable is a Django package to make the integration of your Django
models with Datatables.js easy.

Django-listable was motivated by my repeated need to generate sortable
and filterable tables from my Django models for CRUD apps.

The idea is that you should easily be able to go from a model like this:

class Staff(models.Model):

    first_name = models.CharField(max_length=255, help_text=_("Enter the name of the staff being rounded"))
    last_name = models.CharField(max_length=255, help_text=_("Enter the name of the staff being rounded"))
    active = models.CharField(max_length=10, choices = ACTIVE_CHOICES)

    position = models.ForeignKey(Position)
    department = models.ForeignKey(Department)

    limit = models.Q(app_label='staff', model='genericmodela') | models.Q(app_label='staff', model='genericmodelb')
    content_type = models.ForeignKey(ContentType, limit_choices_to=limit)
    object_id = models.PositiveIntegerField()
    generic_object = generic.GenericForeignKey("content_type", "object_id")

to a filterable/orderable table in a template like this with as little code as possible:

There are a couple of other similar projects worth checking out to see if they fit your
needs better:

django-datatables-view

django-datatables

django-eztables

Installation¶

$ pip install django-listable

Settings¶

Listable currently has 4 settings you can configure to be used
as default values for your table (they can be overriden in the listable template tag).

LISTABLE_DOM

Default datatables sDOM parameter to use. By default listable uses the Bootstrap 3 dom below.:

# bootstrap 2
# LISTABLE_DOM = '<"row-fluid"<"span6"ir><"span6"p>>rt<"row-fluid"<"span12"lp>>'

#boostrap 3
LISTABLE_DOM =  '<"row"<"col-sm-6"i><"col-sm-6"rp>>rt<"row"<"col-sm-12"lp>>'

LISTABLE_PAGINATION_TYPE

# pagination types -> bootstrap2, bootstrap3, two_button, full_numbers
LISTABLE_PAGINATION_TYPE = "full_numbers"

LISTABLE_STATE_SAVE

Enable sticky filters by default.:

LISTABLE_STATE_SAVE = True

LISTABLE_PAGINATE_BY

Default page size.:

LISTABLE_PAGINATE_BY = 10

Usage¶

There’s four steps to using django-listable

Including listable in your settings.INSTALLED_APPS

Create a view by subclassing listable.views.BaseListableView

Connect the view to a url pattern in your apps urls.py

Include the listable template tag in a template

These steps will demonstrated below assuming we have
a Django application called staff and we want to create a page on our
site with a list of staff and the department and business they belong to.

with the following models defined:

class Business(models.Model):

    name = models.CharField(max_length=255)

class Department(models.Model):

    name = models.CharField(max_length=255)
    business = models.ForeignKey(Business)

class Staff(models.Model):

    first_name = models.CharField(max_length=255, help_text=_("Enter the name of the staff being rounded"))
    last_name = models.CharField(max_length=255, help_text=_("Enter the name of the staff being rounded"))
    active = models.CharField(max_length=10, choices = ACTIVE_CHOICES)

    department = models.ForeignKey(Department)

    def name(self):
        return "%s, %s" % (self.last_name, self.first_name)

    def status(self):
        return self.get_active_display()

A full functional example can be found in the demo app included with
django-listable.

Adding listable to settings.INSTALLED_APPS¶

To start using django-listable add listable to your INSTALLED_APPS:

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',

    'staff',
    'listable',
    ...
)

Defining a Listable view¶

To define a listable view, sublcass listable.views.BaseListableView
and set the model  that is to be used as the source of data:

from listable.views import BaseListableView
from models import Staff

class StaffList(BaseListableView):

    model = models.Staff

    ...

Defining Columns for your table¶

Every listable view must define one or more fields to be displayed as columns in the table.
listable fields are defined in a manner similar to ModelForms:

class StaffList(BaseListableView):

    model = models.Staff

    fields = (...)
    widgets = {...} # optional
    search_fields = {...} # optional
    order_fields = {...} # optional
    headers = {...} # optional
    select_related = (...) # optional
    prefetch_related = (...) # optional
    order_by = (..) # optional

fields

Fields defines an iterable of the columns that you want to display in the table,
these fields can either be fields on your model, foreign key lookups, the name
of a callable on your view, the name of a callable on your model or the result of an extra
query.

widgets

Widgets is a dictionary mapping a field to a search widget type. Currently you can use
either text (default) or select inputs. For example:

from listable.views import BaseListableView, SELECT

from . import models

class StaffList(BaseListableView):

    model = models.Staff

    fields = ("id", "name", "active", "department__name",)

    widgets = {
        "department__name": SELECT,
        "active": SELECT,
    }

The choices available in a select widget are currently automatically
populated although this will change to allow manual configuration of choices
in the future. The choices are populated based on either the choices option
for a model field or in the case of a foreign key all the values of the foreign
key lookup. (I hope to make this more flexible in the future)

search_fields (optional)

Search fields are a mapping of field names to the django filter syntax that should
be used for searching the table.  This can either be a string, an iterable of
strings or a falsy value to disable searching on that field.  For example:

search_fields = {
    "name": ("first_name__icontains", "last_name__icontains",),
    "last_name": "last_name__exact",
    "genericname": "genericname__icontains",
    "department__name": False,
}

if a field is not declared in search_field’s it a filter using icontains is assumed.

order_fields (optional)

Order fields allows you to define how a column should be ordered (similar to
Django’s ordering or order_by).  For example:

order_fields = {
    "name": ("last_name", "first_name",),
}

headers (optional)

Headers is a mapping of field names to the column name to be displayed. For example by default
a field name of department__business__name would be converted to “Department Business Name” but that
could be overriden like so:

headers = {
    "department__business__name": _("Business"),
}

select_related

Allows you to use Django’s queryset select_related option for reducing database queries. e.g:

select_related = ("department", "position", "department__business",)

prefetch_related

Allows you to use Django’s queryset prefetch_related option for reducing database queries. e.g:

prefetch_related = ("some_fk__some_field",)

get_extra

Due to a bug with pagination, using an extra query will result in your entire table being loaded into memory before
being paginated :(

You may define a callable get_extra method on your view that should return a dictionary suitable
for use in the Django queryset’s extra method.  For example:

def get_extra(self):
    return {select: {'is_recent': "pub_date > '2006-01-01'"}}

A more complex example is given in the “Complete Example” sample below.

order_by

Allows you to set the default ordering for a view:

order_by = ("position", "name",,)

Formatting fields¶

The order in which listable tries to find a method for formatting a field for display is as follows:

A method on the actual view:

class StaffList(BaseListableView):

    model = models.Staff

    fields = (..., "name",...)
    def name(self, staff):
        return staff.name()

A get_{field}_display callable on the model.

A callable on the model:

class Staff(Model):
    ...
    def staff_name(self):
        return "{0} {1}".format(self.first_name, self.last_name)

class StaffList(BaseListableView):

    model = models.Staff

    fields = (..., "staff_name",...)

A field on the model.

A listable column is defined using the listable.views.Column data structure.
A Column is essentially a namedtuple with the following fields (detailed descriptions below):

Including the listable template tag in a template¶

To include listable in your templates you need to load the listable template
tags and include the listable_css, a placeholder for the listable table
and the listable tag which tells the template the name of the view to wire the table to.:

{% extends 'base.html' %}

{% load listable %}

{% block extra_css %}
    {% listable_css %}
{% endblock extra_css %}

{% block content %}
    {{listable_table}}
{% endblock %}

{% block extra_js %}
{% listable 'staff-list'%}
{% endblock extra_js %}

with the example above requiring a url something like:

urlpatterns = patterns('',
    url('staff-list/$', views.StaffList.as_view(), name="staff-list"),
)

Arguments to the listable tag¶

The listable tag currently has 1 required argument and five optional keyword args.
A full example of the listable template tag looks like:

{% listable 'staff-list' dom="", save_state=False, pagination_type="", css_table_class="", css_input_class="" %}

dom

Overrides the default Datatables sDOM parameter to use.

{% listable 'staff-list' dom='<"row-fluid"<"span6"ir><"span6"p>>rt<"row-fluid"<"span12"lp>>' %}

pagination_type

Overrides the default Datatables sDOM parameter to use.

{% listable 'staff-list' pagination_type='bootstrap3' %}

save_state

Save state enables/disables sticky filters in DataTables.:

{% listable 'staff-list' save_state=False %}

css_table_class

Add a css class to your datatables table e.g.:

{% listable 'staff-list' css_table_class="striped compact" %}

css_input_class

Add a css class to the datatables column filter inputs e.g.:

{% listable 'staff-list' css_table_class="input-sm" %}

A Complete Example¶

This is a complete example of a django-listable table. It is included
as a demo app under the django-listable/listable-demo/

models.py¶

ACTIVE = 'active'
INACTIVE = 'inactive'
TERMINATED = 'terminated'

ACTIVE_CHOICES = (
    (ACTIVE, "Active"),
    (INACTIVE, "Inactive"),
    (TERMINATED, "Terminated"),
)

ACTIVE_CHOICES_DISPLAY = dict(ACTIVE_CHOICES)

class Business(models.Model):

    name = models.CharField(max_length=255)
    business_type = models.IntegerField(choices=zip(range(5), range(5)), default=1)

    class Meta:
        verbose_name_plural = "Businesses"

    def __unicode__(self):
        return self.name

class Department(models.Model):

    name = models.CharField(max_length=255)
    business = models.ForeignKey(Business)

    def __unicode__(self):
        return self.name

class Position(models.Model):

    name = models.CharField(max_length=255)

    def __unicode__(self):
        return self.name

class AbstractGeneric(models.Model):

    name = models.CharField(max_length=255)
    description = models.TextField()

    staff = generic.GenericRelation(
        "Staff",
        content_type_field="content_type",
        object_id_field="object_id",
    )

    class Meta:
        abstract = True

class GenericModelA(AbstractGeneric):

    class Meta:
        verbose_name_plural = "Generic Model A's"

    def __unicode__(self):
        return self.name

class GenericModelB(AbstractGeneric):

    class Meta:
        verbose_name_plural = "Generic Model B's"

    def __unicode__(self):
        return self.name

class Staff(models.Model):

    first_name = models.CharField(max_length=255, help_text=_("Enter the name of the staff being rounded"))
    last_name = models.CharField(max_length=255, help_text=_("Enter the name of the staff being rounded"))
    active = models.CharField(max_length=10, choices=ACTIVE_CHOICES)

    position = models.ForeignKey(Position)
    department = models.ForeignKey(Department)

    limit = models.Q(app_label='staff', model='genericmodela') | models.Q(app_label='staff', model='genericmodelb')
    content_type = models.ForeignKey(ContentType, limit_choices_to=limit)
    object_id = models.PositiveIntegerField()
    generic_object = generic.GenericForeignKey("content_type", "object_id")

    class Meta:
        verbose_name_plural = "staff"
        ordering = ("last_name", "first_name",)

    def name(self):
        return "%s, %s" % (self.last_name, self.first_name)

    def status(self):
        return ACTIVE_CHOICES_DISPLAY[self.active]

    def __unicode__(self):
        return self.name()

views.py¶

class StaffList(BaseListableView):

    model = models.Staff

    fields = (
        "id",
        "name",
        "active",
        "department__name",
        "position__name",
        "department__business__name",
        "department__business__business_type",
        "genericname",
    )

    widgets = {
        "department__business__name": SELECT,
        "department__business__business_type": SELECT,
        "position__name": SELECT,
        "choices": SELECT,
        "active": SELECT,
    }

    search_fields = {
        "name": ("first_name__icontains", "last_name__icontains",),
        "last_name": "last_name__exact",
        "genericname": "genericname__icontains",
        "department__name": "department__name__icontains",
    }

    order_fields = {
        "name": ("last_name", "first_name",),
    }

    headers = {
        "position__name": _("Position"),
        "department__business__name": _("Business"),
        "department__business__business_type": _("Business Type"),
    }

    select_related = ("department", "position", "department__business",)

    def generic(self, obj):
        return obj.generic_object.name

    def name(self, staff):
        return staff.name()

    def get_extra(self):
        cta = ContentType.objects.get_for_model(models.GenericModelA)
        ctb = ContentType.objects.get_for_model(models.GenericModelB)

        extraq = """
        CASE
            WHEN content_type_id = {0}
                THEN (SELECT name from staff_genericmodela WHERE object_id = staff_genericmodela.id)
            WHEN content_type_id = {1}
                THEN (SELECT name from staff_genericmodelb WHERE object_id = staff_genericmodelb.id)
        END
        """.format(cta.pk, ctb.pk)

        return {"select": {'genericname': extraq}}

staff_list.html¶

{% extends 'base.html' %}

{% load listable %}

{% block extra_css %}
    {% listable_css %}
{% endblock extra_css %}

{% block content %}
    {{listable_table}}
{% endblock %}

{% block extra_js %}
{% listable 'staff-list' save_state=True %}
{% endblock extra_js %}

Table Of Contents

Welcome to django-listable’s documentation!

About

Installation

Settings

Usage

Adding listable to settings.INSTALLED_APPS

Defining a Listable view

Defining Columns for your table

Formatting fields

Including the listable template tag in a template

Arguments to the listable tag

A Complete Example

models.py

views.py

staff_list.html

Next topic

Contributing

This Page

Show Source

Quick search

    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

Navigation

          index

          next |

django-listable 0.2.4 documentation »

        © Copyright 2013, Randle Taylor.
      Created using Sphinx 1.2.3.


text:
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:task="http://www.springframework.org/schema/task"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
	     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
	     http://www.springframework.org/schema/context
	     http://www.springframework.org/schema/context/spring-context-3.0.xsd
	     http://www.springframework.org/schema/aop
	     http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
	     http://www.springframework.org/schema/task
	     http://www.springframework.org/schema/task/spring-task-3.0.xsd
	     http://www.springframework.org/schema/tx
	     http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

    <aop:aspectj-autoproxy/>

    <!-- Our Data Source -->
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
        <property name="url" value="jdbc:derby:memory:touchpoint_dev;create=true"/>
        <property name="username" value=""/>
        <property name="password" value=""/>
    </bean>

    <!-- Hibernate SessionFactory -->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource">
            <ref bean="dataSource"/>
        </property>
        <property name="configLocation" value="classpath:hibernate-mapping.cfg.xml"/>
        <property name="mappingResources" value="hibernate-named-queries.xml"/>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.DerbyTenSevenDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.format_sql">true</prop>
                <prop key="hibernate.use_sql_comments">false</prop>
                <prop key="hibernate.default_batch_fetch_size">32</prop>
                <prop key="hibernate.generate_statistics">true</prop>
                <!-- Encoding -->
                <prop key="hibernate.connection.useUnicode">true</prop>
                <prop key="hibernate.connection.characterEncoding">UTF-8</prop>
                <!-- Initialization -->
                <prop key="hibernate.hbm2ddl.auto">create</prop>
                <prop key="hibernate.generateDdl">true</prop>
            </props>
        </property>
    </bean>

    <!-- ***************************** -->
    <!-- Operational Related Aspects   -->
    <!-- ***************************** -->

    <!-- Aspectj Use autoproxy Creator -->
    <aop:aspectj-autoproxy/>

    <!-- Aspect Configuration -->
    <aop:config proxy-target-class="false">
        <!-- Define Transactional Point Cuts within Application -->
        <aop:pointcut id="tp_tx_dao"
                      expression="( execution(* jeffaschenk.commons.touchpoint.model.dao..*.*(..)) )"/>
        <!-- Weave Transactional Support -->
        <aop:advisor advice-ref="tp_txAdvice" pointcut-ref="tp_tx_dao" order="200"/>
    </aop:config>

    <!-- Transactional Advice -->
    <tx:advice id="tp_txAdvice" transaction-manager="tp_transactionManager">
        <!-- Transactional semantics -->
        <tx:attributes>
            <!-- all methods starting with 'get','contains','list','lookup','read','search' are read-only -->
            <tx:method name="get*" read-only="true" timeout="40" propagation="REQUIRED"/>
            <tx:method name="contains*" read-only="true" timeout="40" propagation="REQUIRED"/>
            <tx:method name="find*" read-only="true" timeout="40" propagation="REQUIRED"/>
            <tx:method name="list*" read-only="true" timeout="40" propagation="REQUIRED"/>
            <tx:method name="lookup*" read-only="true" timeout="40" propagation="REQUIRED"/>
            <tx:method name="read*" read-only="true" timeout="40" propagation="REQUIRED"/>
            <tx:method name="search*" read-only="true" timeout="40" propagation="REQUIRED"/>
            <tx:method name="validate*" read-only="true" timeout="40" propagation="REQUIRED"/>
            <!-- all other methods use the default transaction settings, basically read-write semantics, 600 second timeout -->
            <tx:method name="*" read-only="false" rollback-for="Throwable" propagation="REQUIRED"/>
        </tx:attributes>
    </tx:advice>

    <!-- Allowing Persistent Translation using @Repository Annotation within DAO Layer, Jeff Schenk. -->
    <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>

    <!-- AOP to ensure Transactional Annotation is Applied -->
    <bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/>

    <!-- Use Additional Transaction Manager Annotations -->
    <tx:annotation-driven order="190" transaction-manager="tp_transactionManager"/>

    <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
    <bean id="tp_transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory"/>
        <property name="failEarlyOnGlobalRollbackOnly" value="true"/>
        <property name="defaultTimeout" value="600"/>
        <!--
                This is excellent to use during development, to make sure all transactions are aligned.
                <property name="validateExistingTransaction" value="true"/>

                 <property name="defaultTimeout" value="${transaction.timeout.default}"/>
        -->

    </bean>

    <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
        <property name="basenames">
            <list>
                <value>errors</value>
                <value>messages</value>
            </list>
        </property>
    </bean>

    <!-- Active Thread Pool for Asynchronous Background Task Executions -->
    <bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
        <property name="corePoolSize" value="4"/>
        <property name="maxPoolSize" value="16"/>
        <property name="queueCapacity" value="32"/>
        <property name="allowCoreThreadTimeOut" value="false"/>
        <property name="threadGroupName" value="TOUCHPOINT_THREAD_GROUP"/>
        <property name="threadNamePrefix" value="TP_T_"/>
        <property name="waitForTasksToCompleteOnShutdown" value="true"/>
    </bean>

    <!-- task Scheduler, used to schedule Tasks from Web or Admin Command Interface. -->
    <task:scheduler id="taskScheduler" pool-size="64"/>

    <!-- Component Scan Paths -->
    <context:component-scan base-package="jeffaschenk.commons.touchpoint"/>
    <context:component-scan base-package="jeffaschenk.commons"/>

</beans>