// defJPverb is a synthdef that exposes the fields of the JPverb ugen.
331178
func defJPverb(params Params) Ugen {
	var (
		in        = params.Add("in", 0)
		out       = params.Add("out", 0)
		t60       = params.Add("t60", 1)
		damp      = params.Add("damp", 0)
		size      = params.Add("size", 1)
		earlyDiff = params.Add("earlyDiff", 0.707)
		modDepth  = params.Add("modDepth", 0.1)
		modFreq   = params.Add("modFreq", 2)
		low       = params.Add("low", 1)
		mid       = params.Add("mid", 1)
		high      = params.Add("high", 1)
		lowcut    = params.Add("lowcut", 500)
		highcut   = params.Add("highcut", 2000)
	)
	return Out{
		Bus: out,
		Channels: JPverb{
			In: In{
				Bus:         in,
				NumChannels: 2,
			}.Rate(AR),
			T60:       t60,
			Damp:      damp,
			Size:      size,
			EarlyDiff: earlyDiff,
			ModDepth:  modDepth,
			ModFreq:   modFreq,
			Low:       low,
			Mid:       mid,
			High:      high,
			LowCut:    lowcut,
			HighCut:   highcut,
		}.Rate(AR),
	}.Rate(AR)
}
515628
func (p *parser) parseObj() (string, objType, string) {
	p.skipWhitespace()
	c := p.c()
	if c[0] == '"' || c[0] == '\'' {
		i := 1
	For:
		for ; i < len(c); i++ {
			switch c[i] {
			case '\\':
				i++
			case c[0]:
				break For
			}
		}
		p.i += i + 1

		s := "\"" + string(c[1:i]) + "\""
		json.Unmarshal([]byte(s), &s)
		lang := ""
		if c[i+1] == '@' {
			c = p.c()
			i := bytes.IndexAny(c, stopRunes)
			if c[i-1] == '.' {
				i--
			}
			p.i += i
			lang = string(c[1:i])
		} else if bytes.Equal(c[i+1:i+3], []byte("^^")) {
			// TODO(d4l3k): Implement RDF types.
		}
		return s, typeString, lang
	} else if bytes.HasPrefix(c, []byte("<")) {
		i := bytes.IndexRune(c, '>')
		p.i += i + 1
		url := string(c[1:i])
		if !strings.Contains(url, "://") {
			url = p.base + url
		}
		return url, typeIRI, ""
	} else if bytes.HasPrefix(c, []byte(".")) {
		p.i += 1
		return ".", typeEnd, ""
	} else if bytes.HasPrefix(c, []byte(";")) {
		p.i += 1
		return ";", typePred, ""
	} else if bytes.HasPrefix(c, []byte(",")) {
		p.i += 1
		return ",", typeObj, ""
	} else {
		i := bytes.IndexAny(c, stopRunes)
		if c[i-1] == '.' {
			i--
		}
		p.i += i
		obj := string(c[:i])
		psym := strings.IndexRune(obj, ':')
		if psym != -1 {
			if psym == len(obj)-1 {
				return obj, typePrefix, ""
			}
			prefix := obj[:psym+1]
			if expand, ok := p.prefix[prefix]; ok {
				return expand + obj[psym+1:], typeIRI, ""
			}
		}
		return obj, typeUnknown, ""
	}
}
266604
func (t Tags) HasVerb(verb string) bool {
	if len(t.SkipVerbs) == 0 {
		return true
	}
	for _, s := range t.SkipVerbs {
		if verb == s {
			return false
		}
	}
	return true
}
105283
func (b *Builder) abbrevFor(tag tagDescr) byte {
	for abbrev, descr := range b.abbrevs {
		if sameTagDescr(descr, tag) {
			return byte(abbrev + 1)
		}
	}

	b.abbrevs = append(b.abbrevs, tag)
	return byte(len(b.abbrevs))
}
703749
func DefinedFunction(env *Zlisp, name string, args []Sexp) (Sexp, error) {
	//P("in DefinedFunction, args = '%#v'", args)
	narg := len(args)
	if narg != 1 {
		return SexpNull, WrongNargs
	}

	var checkme string
	switch nm := args[0].(type) {
	case *SexpStr:
		checkme = nm.S
	case *SexpSymbol:
		checkme = nm.name
	case *SexpFunction:
		return &SexpBool{Val: true}, nil
	default:
		return &SexpBool{Val: false}, nil
	}

	_, err, _ := env.LexicalLookupSymbol(env.MakeSymbol(checkme), nil)
	if err != nil {
		return &SexpBool{Val: false}, nil
	}
	return &SexpBool{Val: true}, nil
}
917808
func Deferred(key string, f func() string) Loggable {
	function := func() map[string]interface{} {
		return map[string]interface{}{
			key: f(),
		}
	}
	return LoggableF(function)
}
768103
func (req *Request) ParseForm() (e error) {
	if req.Form == nil {
		req.Form, e = req.GetForm()
	}
	return
}
261979
func SpecFromStructReflect(fname string, args reflect.Type, rets reflect.Type) *FunctionSpec {
	s := FunctionSpec{
		Inputs:  make([]Argument, args.NumField()),
		Outputs: make([]Argument, rets.NumField()),
	}
	for i := 0; i < args.NumField(); i++ {
		f := args.Field(i)
		a := EVMTypeFromReflect(f.Type)
		a.Name = f.Name
		s.Inputs[i] = a
	}
	for i := 0; i < rets.NumField(); i++ {
		f := rets.Field(i)
		a := EVMTypeFromReflect(f.Type)
		a.Name = f.Name
		s.Outputs[i] = a
	}
	s.SetFunctionID(fname)

	return &s
}
480787
func (f *DeltaFIFO) KeyOf(obj interface{}) (string, error) {
	if d, ok := obj.(Deltas); ok {
		if len(d) == 0 {
			return "", KeyError{obj, ErrZeroLengthDeltasObject}
		}
		obj = d.Newest().Object
	}
	if d, ok := obj.(DeletedFinalStateUnknown); ok {
		return d.Key, nil
	}
	return f.keyFunc(obj)
}
1185069
func parseFieldDefinition(parser *Parser) (interface{}, error) {
	start := parser.Token.Start
	description, err := parseDescription(parser)
	if err != nil {
		return nil, err
	}
	name, err := parseName(parser)
	if err != nil {
		return nil, err
	}
	args, err := parseArgumentDefs(parser)
	if err != nil {
		return nil, err
	}
	_, err = expect(parser, lexer.COLON)
	if err != nil {
		return nil, err
	}
	ttype, err := parseType(parser)
	if err != nil {
		return nil, err
	}
	directives, err := parseDirectives(parser)
	if err != nil {
		return nil, err
	}
	return ast.NewFieldDefinition(&ast.FieldDefinition{
		Name:        name,
		Description: description,
		Arguments:   args,
		Type:        ttype,
		Directives:  directives,
		Loc:         loc(parser, start),
	}), nil
}
113916
func ObjectComprehensionTerm(key, value *Term, body Body) *Term {
	return &Term{
		Value: &ObjectComprehension{
			Key:   key,
			Value: value,
			Body:  body,
		},
	}
}
1362183
func parseIfNameFromIPCmd(routeOut string) [][]string {
	lines := strings.Split(routeOut, "\n")
	re := whitespaceRE.Copy()
	parsedLines := make([][]string, 0, len(lines))
	for _, line := range lines {
		kvs := re.Split(line, -1)
		if len(kvs) < 5 {
			continue
		}
		parsedLines = append(parsedLines, kvs)
	}
	return parsedLines
}
1231424
func withProtocol(protocol, framework string, spec labels.Func, gen chain) chain {
	return func(records ...string) {
		protocol = spec(protocol)
		if protocol != protocolNone {
			for i := range records {
				records[i] += "._" + protocol + "." + framework
			}
		} else {
			records = append(records, records...)
			for i, j := 0, len(records)/2; j < len(records); {
				records[i] += "._tcp." + framework
				records[j] += "._udp." + framework
				i++
				j++
			}
		}
		gen(records...)
	}
}
1076615
func (ctx *Context) JSONPBlob(code int, callback string, buf []byte) error {
	ctx.Type(MIMEApplicationJavaScriptCharsetUTF8)
	ctx.SetHeader(HeaderXContentTypeOptions, "nosniff")
	// the /**/ is a specific security mitigation for "Rosetta Flash JSONP abuse"
	// @see http://miki.it/blog/2014/7/8/abusing-jsonp-with-rosetta-flash/
	// the typeof check is just to reduce client error noise
	b := []byte(fmt.Sprintf(`/**/ typeof %s === "function" && %s(`, callback, callback))
	b = append(b, buf...)
	return ctx.End(code, append(b, ')', ';'))
}
651043
func GenerateProtobufDefinition(w io.Writer, types []interface{}, enumMap EnumMap, renamer GeneratorNamer) (err error) {
	defer func() {
		if e := recover(); e != nil {
			err = errors.New(e.(string))
		}
	}()
	enums := enumTypeMap{}
	for name, value := range enumMap {
		v := reflect.ValueOf(value)
		t := v.Type()
		if t.Kind() != reflect.Uint32 {
			return fmt.Errorf("enum type aliases must be uint32")
		}
		if t.Name() == "uint32" {
			return fmt.Errorf("enum value must be a type alias, but got uint32")
		}
		enums[t.Name()] = append(enums[t.Name()], enumValue{name, Enum(v.Uint())})
	}
	for _, values := range enums {
		sort.Sort(values)
	}
	rt := reflectedTypes{}
	for _, t := range types {
		typ := reflect.Indirect(reflect.ValueOf(t)).Type()
		if typ.Kind() != reflect.Struct {
			continue
		}
		rt = append(rt, typ)
	}
	sort.Sort(rt)
	if renamer == nil {
		renamer = &DefaultGeneratorNamer{}
	}
	t := template.Must(template.New("protobuf").Funcs(template.FuncMap{
		"Fields":   ProtoFields,
		"TypeName": func(f ProtoField) string { return typeName(f, enums, renamer) },
		"Options":  options,
	}).Delims("[[", "]]").Parse(protoTemplate))
	return t.Execute(w, map[string]interface{}{
		"Renamer": renamer,
		"Enums":   enums,
		"Types":   rt,
		"Ptr":     reflect.Ptr,
		"Slice":   reflect.Slice,
		"Map":     reflect.Map,
	})
}
716926
func (def *Synthdef) flattenInput(params Params, ugen *Ugen, input Input) {
	switch v := input.(type) {
	case *Ugen:
		_, idx, _ := def.addUgen(v)

		// In has different behavior than other ugens when it is multichannel expanded.
		// Each channel of its output gets mapped to a single channel of the expression
		// tree above it. [briansorahan]
		if v.Name == "In" {
			ugen.Inputs = append(ugen.Inputs, UgenInput{
				UgenIndex:   int32(idx),
				OutputIndex: int32(def.inidx),
			})
			def.inidx++
			break
		}
		for outputIndex := range v.Outputs {
			ugen.Inputs = append(ugen.Inputs, UgenInput{
				UgenIndex:   int32(idx),
				OutputIndex: int32(outputIndex),
			})
		}
	case C:
		idx := def.addConstant(v)
		ugen.Inputs = append(ugen.Inputs, UgenInput{
			UgenIndex:   -1,
			OutputIndex: int32(idx),
		})
	case *param:
		idx := v.Index()
		ugen.Inputs = append(ugen.Inputs, UgenInput{
			UgenIndex:   0,
			OutputIndex: idx,
		})
	case MultiInput:
		for _, min := range v.InputArray() {
			switch x := min.(type) {
			case *Ugen:
				_, idx, _ := def.addUgen(x)
				// will we ever need to use a different output index? [bps]
				for outputIndex := range x.Outputs {
					ugen.Inputs = append(ugen.Inputs, UgenInput{
						UgenIndex:   int32(idx),
						OutputIndex: int32(outputIndex),
					})
				}
			case C:
				ugen.Inputs = append(ugen.Inputs, UgenInput{
					UgenIndex:   -1,
					OutputIndex: int32(def.addConstant(x)),
				})
			case *param:
				ugen.Inputs = append(ugen.Inputs, UgenInput{
					UgenIndex:   0,
					OutputIndex: x.Index(),
				})
			}
		}
	}
}
949466
func (d *Context) PutPropString(objIndex int, key string) bool {
	__key__ := C.CString(key)
	result := int(C.duk_put_prop_string(d.duk_context, C.duk_idx_t(objIndex), __key__)) == 1
	C.free(unsafe.Pointer(__key__))
	return result
}