/*
 * Exported Functions
 */
// Pure Functions
559904
func Init(app_name string) bool {
	papp_name := C.CString(app_name)
	defer C.free(unsafe.Pointer(papp_name))

	return bool(C.notify_init(papp_name) != 0)
}
722017
func exportedType(typ types.Type) bool {
	switch T := typ.(type) {
	case *types.Named:
		// Builtin types have no package.
		return T.Obj().Pkg() == nil || T.Obj().Exported()
	case *types.Map:
		return exportedType(T.Key()) && exportedType(T.Elem())
	case interface {
		Elem() types.Type
	}: // array, slice, pointer, chan
		return exportedType(T.Elem())
	}
	// Be conservative about other types, such as struct, interface, etc.
	return true
}
1248696
func (d *Debugger) Functions(filter string) ([]string, error) {
	d.processMutex.Lock()
	defer d.processMutex.Unlock()

	return regexFilterFuncs(filter, d.target.BinInfo().Functions)
}
1052655
func functions(decl *cc.Declarator) bool {
	if !strings.HasPrefix(bindgen.NameOf(decl), "cudnn") {
		return false
	}
	if decl.Type.Kind() == cc.Function {
		return true
	}
	return false

}
1297865
func allExportedOrBuiltin(types []reflect.Type) bool {
	for _, typ := range types {
		for typ.Kind() == reflect.Ptr {
			typ = typ.Elem()
		}
		// PkgPath will be non-empty even for an exported type,
		// so we need to check the type name as well.
		if !isExported(typ.Name()) && typ.PkgPath() != "" {
			return false
		}
	}
	return true
}
190884
func CoreFunctions() map[string]ZlispUserFunction {
	return map[string]ZlispUserFunction{
		"pretty":    SetPrettyPrintFlag,
		"<":         CompareFunction,
		">":         CompareFunction,
		"<=":        CompareFunction,
		">=":        CompareFunction,
		"==":        CompareFunction,
		"!=":        CompareFunction,
		"isnan":     IsNaNFunction,
		"isNaN":     IsNaNFunction,
		"sll":       BinaryIntFunction,
		"sra":       BinaryIntFunction,
		"srl":       BinaryIntFunction,
		"mod":       BinaryIntFunction,
		"+":         NumericFunction,
		"-":         NumericFunction,
		"*":         PointerOrNumericFunction,
		"**":        NumericFunction,
		"/":         NumericFunction,
		"bitAnd":    BitwiseFunction,
		"bitOr":     BitwiseFunction,
		"bitXor":    BitwiseFunction,
		"bitNot":    ComplementFunction,
		"read":      ReadFunction,
		"cons":      ConsFunction,
		"first":     FirstFunction,
		"second":    SecondFunction,
		"rest":      RestFunction,
		"car":       FirstFunction,
		"cdr":       RestFunction,
		"type?":     TypeQueryFunction,
		"list?":     TypeQueryFunction,
		"null?":     TypeQueryFunction,
		"array?":    TypeQueryFunction,
		"hash?":     TypeQueryFunction,
		"number?":   TypeQueryFunction,
		"int?":      TypeQueryFunction,
		"float?":    TypeQueryFunction,
		"char?":     TypeQueryFunction,
		"symbol?":   TypeQueryFunction,
		"string?":   TypeQueryFunction,
		"zero?":     TypeQueryFunction,
		"empty?":    TypeQueryFunction,
		"func?":     TypeQueryFunction,
		"not":       NotFunction,
		"apply":     ApplyFunction,
		"map":       MapFunction,
		"makeArray": MakeArrayFunction,
		"aget":      ArrayAccessFunction,
		"aset":      ArrayAccessFunction,
		"sget":      SgetFunction,
		"hget":      GenericAccessFunction, // handles arrays or hashes
		//":":          ColonAccessFunction,
		"hset":        HashAccessFunction,
		"hdel":        HashAccessFunction,
		"keys":        HashAccessFunction,
		"hpair":       GenericHpairFunction,
		"slice":       SliceFunction,
		"len":         LenFunction,
		"append":      AppendFunction,
		"appendslice": AppendFunction,
		"concat":      ConcatFunction,
		"field":       ConstructorFunction,
		"struct":      ConstructorFunction,
		"array":       ConstructorFunction,
		"list":        ConstructorFunction,
		"hash":        ConstructorFunction,
		"raw":         ConstructorFunction,
		"str":         StringifyFunction,
		"->":          ThreadMapFunction,
		"flatten":     FlattenToWordsFunction,
		"quotelist":   QuoteListFunction,
		"=":           AssignmentFunction,
		":=":          AssignmentFunction,
		"fieldls":     GoFieldListFunction,
		"defined?":    DefinedFunction,
		"stop":        StopFunction,
		"joinsym":     JoinSymFunction,
		"GOOS":        GOOSFunction,
		"&":           AddressOfFunction,
		"derefSet":    DerefFunction,
		"deref":       DerefFunction,
		".":           DotFunction,
		"arrayidx":    ArrayIndexFunction,
		"hashidx":     HashIndexFunction,
		"asUint64":    AsUint64Function,
	}
}
903649
func BuildWindowFunctions(ctx sessionctx.Context, windowFuncDesc *aggregation.AggFuncDesc, ordinal int, orderByCols []*expression.Column) AggFunc {
	switch windowFuncDesc.Name {
	case ast.WindowFuncRank:
		return buildRank(ordinal, orderByCols, false)
	case ast.WindowFuncDenseRank:
		return buildRank(ordinal, orderByCols, true)
	case ast.WindowFuncRowNumber:
		return buildRowNumber(windowFuncDesc, ordinal)
	case ast.WindowFuncFirstValue:
		return buildFirstValue(windowFuncDesc, ordinal)
	case ast.WindowFuncLastValue:
		return buildLastValue(windowFuncDesc, ordinal)
	case ast.WindowFuncCumeDist:
		return buildCumeDist(ordinal, orderByCols)
	case ast.WindowFuncNthValue:
		return buildNthValue(windowFuncDesc, ordinal)
	case ast.WindowFuncNtile:
		return buildNtile(windowFuncDesc, ordinal)
	case ast.WindowFuncPercentRank:
		return buildPercenRank(ordinal, orderByCols)
	case ast.WindowFuncLead:
		return buildLead(windowFuncDesc, ordinal)
	case ast.WindowFuncLag:
		return buildLag(windowFuncDesc, ordinal)
	default:
		return Build(ctx, windowFuncDesc, ordinal)
	}
}
1308165
func (fn _bindFunctionObject) construct(argumentList []Value) Value {
	object := fn.target
	switch value := object.value.(type) {
	case _nativeFunctionObject:
		return value.construct(object, fn.argumentList)
	case _nodeFunctionObject:
		argumentList = append(fn.argumentList, argumentList...)
		return object.construct(argumentList)
	}
	panic(fn.target.runtime.panicTypeError())
}
1229007
function exportPkg(pkg, isChild, pkgName, externImports) {
    var keys = Object.keys(pkg);
    var imports = externImports || [];

    var topLevels = [];
    var children = keys.map(function (name) {
        if (isString(pkg[name])) {
            var className = name.substring(0, name.indexOf('$'));
            if (topLevelClasses.find(function (item) {
                return pkg[name].indexOf(item) >= 0;
            })) {
                topLevels.push(name);
            }
            // a class, not a packagge
            imports.push(pkg[name]);
            if (pkgName) {
                // export as a child class in package
                // indentation + (key : value)
                return (isChild ? '        '  : '    ') + className + ' : ' + name;
            }
            else {
                // export as a class at root level
                return `export { ${name} as ${className} };`;
            }
        }
        else {
            // export as a child package
            return exportPkg(pkg[name], pkgName && true, name, imports);
        }
    });

    var importCode = (externImports ? '' : imports.join('\n') + '\n\n');
    var exportCode;
    if (pkgName) {
        if (isChild) {
            // export as a grand-child package
            exportCode = `    ${pkgName} : {\n${children.join(',\n')}\n    }`;
        }
        else {
            // export as a package at root level
            exportCode = `\nvar ${pkgName} = {\n${children.join(',\n')}\n};\nexport { ${pkgName} };\n`;
        }
    }
    else {
        // export child classes
        exportCode = children.join('\n');
    }

    topLevels.forEach(function (name) {
        var className = name.substring(0, name.indexOf('$'));
        exportCode += `export { ${name} as ${className} };\n`;
    });

    return importCode  + exportCode;
}
723446
func interpolationFuncLower() ast.Function {
	return ast.Function{
		ArgTypes:   []ast.Type{ast.TypeString},
		ReturnType: ast.TypeString,
		Callback: func(args []interface{}) (interface{}, error) {
			toLower := args[0].(string)
			return strings.ToLower(toLower), nil
		},
	}
}
452194
function getCommentedFunctionNode(node) {
    if (!node.leadingComments) {
        // JSDoc comments are always before the function, so if there is
        // nothing here, we ain't interested.
        return null;
    }
    // console.log("=================");
    // console.log("type: " + node.type);
    // console.log(util.inspect(node));
    /*
     * We handle the following function representations:
     *
     *     Type               Path to Function              Example
     * ==========================================================================================
     * FunctionDeclaration           -                  function foo(bar) {}
     * VariableDeclaration   .declarations[0].init      var foo = function(bar) {}
     * ExpressionStatement   .expression.right          ObjClass.prototype.foo = function(bar) {}
     * MethodDefinition      .value                     class ObjClass { foo(bar) {} }
     * Property              .value                     var obj = { key: function(bar) {} }
     * ReturnStatement       .argument                  return function(foo, bar) {}
     * ArrowFunctionExpression       -                  (foo, bar) => {}
     * ExportNamedDeclaration .declaration              export function foo(bar) {}
     *
     */
    var nodeTypes = [
        "FunctionDeclaration", "ExpressionStatement", "VariableDeclaration",
        "MethodDefinition", "Property", "ReturnStatement", "ArrowFunctionExpression",
        "ExportNamedDeclaration"
    ];
    if (nodeTypes.indexOf(node.type) === -1) {
        return null;
    }
    var funcNode = null;
    switch (node.type) {
        case "FunctionDeclaration":
        case "ArrowFunctionExpression":
            funcNode = node;
            break;
        case "VariableDeclaration":
            funcNode = node.declarations[0].init;
            break;
        case "ExpressionStatement":
            funcNode = node.expression.right;
            break;
        case "MethodDefinition":
            funcNode = node.value;
            break;
        case "Property":
            funcNode = node.value;
            break;
        case "ReturnStatement":
            funcNode = node.argument;
            break;
        case "ExportNamedDeclaration":
            var declaration = node.declaration;
            if (declaration.type === 'VariableDeclaration') {
                funcNode = declaration.declarations[0].init;
            } else {
                funcNode = declaration
            }
            break;
    }
    var funcNodeTypes = ["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"];
    if (!funcNode || funcNodeTypes.indexOf(funcNode.type) === -1) {
        // We can't find a function here which can map to leadingComments.
        return null;
    }
    var funcDocs = null;
    for (var i=0; i<node.leadingComments.length; i++) {
        // Block comments are either JSDoc or flow-jsdoc specific in-inline syntax
        if (node.leadingComments[i].type === "Block") {
            funcDocs = extractJsdoc(node.leadingComments[i].value);
            if (funcDocs) { break; }
            // may be inline form with /* */
            funcDocs = extractInlineAnnotations(funcNode, node.leadingComments[i].value);
            if (funcDocs) {
                node.leadingComments[i].update("");
                break;
            }
        }
        else if (node.leadingComments[i].type === "Line") {
            // Line comments can only be flow-jsdoc specific in-line syntax.
            funcDocs = extractInlineAnnotations(funcNode, node.leadingComments[i].value);
            if (funcDocs) {
                node.leadingComments[i].update("");
                break;
            }
        }
    }

    return {
        node: funcNode,
        jsdoc: funcDocs
    };
}
599894
func (process *TeleportProcess) ExportFileDescriptors() ([]FileDescriptor, error) {
	var out []FileDescriptor
	process.Lock()
	defer process.Unlock()
	for _, r := range process.registeredListeners {
		file, err := utils.GetListenerFile(r.Listener)
		if err != nil {
			return nil, trace.Wrap(err)
		}
		out = append(out, FileDescriptor{File: file, Type: r.Type, Address: r.Address})
	}
	return out, nil
}
728714
function globals() {
		extend(window, {
			console: {
				log: function() {},
				debug: function() {},
				warn: function() {},
				error: function() {}
			},
			Map: (function() {
				function Map() {
					this._map = Object.create(null);
				}
				Map.prototype = {
					isNative: false,
					get: function get(key) {
						return this._map[key];
					},
					set: function set(key, val) {
						this._map[key] = val;
					},
					has: function has(key) {
						return this._map[key] !== undefined;
					},
					"delete": function get(key) {
						delete this._map[key];
					},
					size: function() {
						return Object.keys(this._map).length;
					}
				};
				return Map;
			})(),
			Set: (function() {
				function Set() {
					this._map = Object.create(null);
				}
				Set.prototype = {
					isNative: false,
					add: function set(key) {
						this._map[key] = true;
					},
					has: function has(key) {
						return this._map[key] === true;
					},
					"delete": function get(key) {
						delete this._map[key];
					},
					size: function() {
						return Object.keys(this._map).length;
					}
				};
				return Set;
			})(),
			WeakMap: (function() { // TODO: clean this up
				function WeakMap() {
					var keys = [],
						values = [];

					function del(key) {
						if (has(key)) {
							keys.splice(i, 1);
							values.splice(i, 1);
						}
						return -1 < i;
					}

					function get(key, d3fault) {
						return has(key) ? values[i] : d3fault;
					}

					function has(key) {
						i = indexOf.call(keys, key);
						return -1 < i;
					}

					function set(key, value) {
						if (has(key)) {
							values[i] = value;
						} else {
							values[keys.push(key) - 1] = value;
						}
					}
					return create(WeakMapPrototype, {
						isNative: {
							value: false
						},
						"delete": {
							value: del
						},
						del: {
							value: del
						},
						get: {
							value: get
						},
						has: {
							value: has
						},
						set: {
							value: set
						}
					});
				}

				function WeakMapInstance() {}
				var WeakMapPrototype = WeakMap.prototype,
					create = Object.create,
					indexOf = [].indexOf,
					i;
				// used to follow FF behavior where WeakMap.prototype is WeakMap itself
				WeakMap.prototype = 
					WeakMapInstance.prototype = 
					WeakMapPrototype = 
					new WeakMap();
				return WeakMap;
			})()
		});
	}
337616
func (t *FunctionType) FlatTypes() Types {
	retVal := BorrowTypes(8) // start with 8. Can always grow
	retVal = retVal[:0]

	if a, ok := t.a.(*FunctionType); ok {
		ft := a.FlatTypes()
		retVal = append(retVal, ft...)
		ReturnTypes(ft)
	} else {
		retVal = append(retVal, t.a)
	}

	if b, ok := t.b.(*FunctionType); ok {
		ft := b.FlatTypes()
		retVal = append(retVal, ft...)
		ReturnTypes(ft)
	} else {
		retVal = append(retVal, t.b)
	}
	return retVal
}
1178371
func (p *gc_parser) parse_export(callback func(string, ast.Decl)) {
	p.expect_keyword("package")
	p.pfc.defalias = p.expect(scanner.Ident)
	if p.tok != '\n' {
		p.expect_keyword("safe")
	}
	p.expect('\n')

	for p.tok != '$' && p.tok != scanner.EOF {
		pkg, decl := p.parse_decl()
		if decl != nil {
			callback(pkg, decl)
		}
	}
}
1174788
func Funcs() map[string]ast.Function {
	return map[string]ast.Function{
		"abs":          interpolationFuncAbs(),
		"basename":     interpolationFuncBasename(),
		"base64decode": interpolationFuncBase64Decode(),
		"base64encode": interpolationFuncBase64Encode(),
		"base64gzip":   interpolationFuncBase64Gzip(),
		"base64sha256": interpolationFuncBase64Sha256(),
		"base64sha512": interpolationFuncBase64Sha512(),
		"bcrypt":       interpolationFuncBcrypt(),
		"ceil":         interpolationFuncCeil(),
		"chomp":        interpolationFuncChomp(),
		"cidrhost":     interpolationFuncCidrHost(),
		"cidrnetmask":  interpolationFuncCidrNetmask(),
		"cidrsubnet":   interpolationFuncCidrSubnet(),
		"coalesce":     interpolationFuncCoalesce(),
		"coalescelist": interpolationFuncCoalesceList(),
		"compact":      interpolationFuncCompact(),
		"concat":       interpolationFuncConcat(),
		"contains":     interpolationFuncContains(),
		"dirname":      interpolationFuncDirname(),
		"distinct":     interpolationFuncDistinct(),
		"element":      interpolationFuncElement(),
		"chunklist":    interpolationFuncChunklist(),
		"file":         interpolationFuncFile(),
		"matchkeys":    interpolationFuncMatchKeys(),
		"flatten":      interpolationFuncFlatten(),
		"floor":        interpolationFuncFloor(),
		"format":       interpolationFuncFormat(),
		"formatlist":   interpolationFuncFormatList(),
		"indent":       interpolationFuncIndent(),
		"index":        interpolationFuncIndex(),
		"join":         interpolationFuncJoin(),
		"jsonencode":   interpolationFuncJSONEncode(),
		"length":       interpolationFuncLength(),
		"list":         interpolationFuncList(),
		"log":          interpolationFuncLog(),
		"lower":        interpolationFuncLower(),
		"map":          interpolationFuncMap(),
		"max":          interpolationFuncMax(),
		"md5":          interpolationFuncMd5(),
		"merge":        interpolationFuncMerge(),
		"min":          interpolationFuncMin(),
		"pathexpand":   interpolationFuncPathExpand(),
		"pow":          interpolationFuncPow(),
		"uuid":         interpolationFuncUUID(),
		"replace":      interpolationFuncReplace(),
		"reverse":      interpolationFuncReverse(),
		"rsadecrypt":   interpolationFuncRsaDecrypt(),
		"sha1":         interpolationFuncSha1(),
		"sha256":       interpolationFuncSha256(),
		"sha512":       interpolationFuncSha512(),
		"signum":       interpolationFuncSignum(),
		"slice":        interpolationFuncSlice(),
		"sort":         interpolationFuncSort(),
		"split":        interpolationFuncSplit(),
		"substr":       interpolationFuncSubstr(),
		"timestamp":    interpolationFuncTimestamp(),
		"timeadd":      interpolationFuncTimeAdd(),
		"title":        interpolationFuncTitle(),
		"transpose":    interpolationFuncTranspose(),
		"trimspace":    interpolationFuncTrimSpace(),
		"upper":        interpolationFuncUpper(),
		"urlencode":    interpolationFuncURLEncode(),
		"zipmap":       interpolationFuncZipMap(),
	}
}
1335083
func functionParams(g Generator, f *compile.FunctionSpec) (string, error) {
	return g.TextTemplate(
		`
		<- $params := newNamespace ->
		<- range .ArgsSpec>
			<- if .Required>
				<$params.NewName .Name> <typeReference .Type>,
			<- else>
				<$params.NewName .Name> <typeReferencePtr .Type>,
			<- end ->
		<end>
		`, f)
}