// Var returns an expvar variable that shows all the current configuration variables and their
// current value
499718
func (c *Distconf) Var() expvar.Var {
	return expvar.Func(func() interface{} {
		c.varsMutex.Lock()
		defer c.varsMutex.Unlock()

		m := make(map[string]interface{}, len(c.registeredVars))
		for name, v := range c.registeredVars {
			m[name] = v.distvar.GenericGet()
		}
		return m
	})
}
572083
func GetGlobalSystemVar(s *variable.SessionVars, key string) (string, error) {
	key = strings.ToLower(key)
	sysVar := variable.SysVars[key]
	if sysVar == nil {
		return "", variable.UnknownSystemVar
	}
	if sysVar.Scope == variable.ScopeSession {
		return "", variable.ErrIncorrectScope
	} else if sysVar.Scope == variable.ScopeNone {
		return sysVar.Value, nil
	}
	return s.GlobalVarsAccessor.GetGlobalSysVar(key)
}
1307618
func (c *Distconf) Info() expvar.Var {
	return expvar.Func(func() interface{} {
		c.infoMutex.RLock()
		defer c.infoMutex.RUnlock()

		m := make(map[string]DistInfo, len(c.distInfos))
		for k, i := range c.distInfos {
			v, ok := c.registeredVars[k]
			if ok {
				v := DistInfo{
					File:         i.File,
					Line:         i.Line,
					DefaultValue: v.distvar.GenericGetDefault(),
					DistType:     v.distvar.Type(),
				}
				m[k] = v
			}
		}
		return m
	})
}
949043
func Uint64Var(p *uint64, name string, value uint64, usage string) {
	CommandLine.Var(newUint64Value(value, p), name, usage)
}
730011
func Variables(dwarf *dwarf.Data, off dwarf.Offset, pc RelAddr, line int, onlyVisible bool) *VariableReader {
	reader := dwarf.Reader()
	reader.Seek(off)
	return &VariableReader{dwarf: dwarf, reader: reader, entry: nil, depth: 0, onlyVisible: onlyVisible, pc: uint64(pc), line: line, err: nil}
}
725593
func (c *Config) EnvVars() map[string]string {
	vars := make(map[string]string, len(c.Params))
	for _, p := range c.Params {
		k, v := p.EnvVars()
		vars[k] = v
	}
	return vars
}
1057150
func ValueBindVariable(v Value) *querypb.BindVariable {
	return &querypb.BindVariable{Type: v.typ, Value: v.val}
}
1183721
func jsonnet_ext_var(vmRef *C.struct_JsonnetVm, key, value *C.char) {
	vm := getVM(vmRef)
	vm.ExtVar(C.GoString(key), C.GoString(value))
}
415079
func getCEnvVariable(name string) string {

	val := C.getenv(C.CString(name))
	if val == nil {
		return ""
	}

	return C.GoString(val)
}
463339
func lookupVar(v string) (string, bool) {
	// TODO: optimize if the number of variable names grows
	switch v {
	case "FABRIC_SDK_GO_PROJECT_PATH":
		return metadata.GetProjectPath(), true
	case "GOPATH":
		return goPath(), true
	case "CRYPTOCONFIG_FIXTURES_PATH":
		return metadata.CryptoConfigPath, true
	}
	return os.LookupEnv(v)
}
330009
func expvarHandler(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "application/json; charset=utf-8")
	fmt.Fprintf(w, "{\n")
	first := true
	expvar.Do(func(kv expvar.KeyValue) {
		if !first {
			fmt.Fprintf(w, ",\n")
		}
		first = false
		fmt.Fprintf(w, "%q: %s", kv.Key, kv.Value)
	})
	fmt.Fprintf(w, "\n}\n")
}
1074883
func (s *Adaptor) Variable(name string) (result string, err error) {
	url := fmt.Sprintf("%v/%s?access_token=%s", s.deviceURL(), name, s.AccessToken)
	resp, err := s.request("GET", url, nil)

	if err != nil {
		return
	}

	val := resp["result"]
	switch val.(type) {
	case bool:
		result = strconv.FormatBool(val.(bool))
	case float64:
		result = strconv.FormatFloat(val.(float64), 'f', -1, 64)
	case string:
		result = val.(string)
	}

	return
}
845373
func (d *Debugger) LocalVariables(scope api.EvalScope, cfg proc.LoadConfig) ([]api.Variable, error) {
	d.processMutex.Lock()
	defer d.processMutex.Unlock()

	s, err := proc.ConvertEvalScope(d.target, scope.GoroutineID, scope.Frame, scope.DeferredCall)
	if err != nil {
		return nil, err
	}
	pv, err := s.LocalVariables(cfg)
	if err != nil {
		return nil, err
	}
	return convertVars(pv), err
}
17211
func (s *scope) makevar(varname string) string {
	s.n++
	var genName = varname + strconv.Itoa(s.n)
	s.stack[len(s.stack)-1][varname] = genName
	return genName
}
870365
func (cmd *Cmd) ChangeVar(k string, v interface{}) {
	var oldv interface{} = NoVar
	if cur, ok := cmd.context.GetVar(k); ok {
		oldv = cur
	}
	if newv := cmd.OnChange(k, oldv, v); newv == NoVar {
		cmd.context.UnsetVar(k, internal.LocalScope)
	} else {
		cmd.context.SetVar(k, newv, internal.LocalScope)
	}
}
1095763
func (m ModuleInstance) InputVariable(name string) AbsInputVariableInstance {
	return AbsInputVariableInstance{
		Module: m,
		Variable: InputVariable{
			Name: name,
		},
	}
}
661657
func (q TemplateQuery) Var(name string, value interface{}) TemplateQuery {
	q.vars[name] = value
	return q
}