// Register a chroma.Style.
322118
func Register(style *chroma.Style) *chroma.Style {
	Registry[style.Name] = style
	return style
}
394527
func (kv *KV) Register(table []byte) error {
	if len(table) == 0 {
		return gkv.ErrTableName
	}
	kv.table = table
	_, err := kv.db.Exec(fmt.Sprintf(`
PRAGMA foreign_keys = FALSE;
CREATE TABLE IF NOT EXISTS %s (
	id VARCHAR(34) NOT NULL,
	k TEXT NOT NULL,
	v TEXT NOT NULL,
	PRIMARY KEY (id)
);
PRAGMA foreign_keys = TRUE;
`, string(table)))
	return err
}
1206232
func (c *Component) Register(name string) *Component {
	vue.Call("component", name, c)
	return c
}
841218
func register(qid uint16, c chan *RawPacket) {
	_dispatcher.Lock()
	_dispatcher.queues[qid] = c
	_dispatcher.Unlock()
}
222915
func Register(name string, t Tokenizer) {
	if tokenizers == nil {
		tokenizers = map[string]Tokenizer{}
	}
	tokenizers[name] = t
}
898153
func (dec *Decoder) RegisterCustomType(fn DecodeCustomTypeFunc, types []interface{}, fields []interface{}) *Decoder {
	if dec.customTypes == nil {
		dec.customTypes = make(map[reflect.Type]*decodeCustomType, 100)
	}
	lenFields := len(fields)
	for i := range types {
		typ := reflect.TypeOf(types[i])
		if dec.customTypes[typ] == nil {
			dec.customTypes[typ] = &decodeCustomType{fun: fn, fields: make([]*decodeCustomTypeField, 0, lenFields)}
		}
		if lenFields > 0 {
			for j := range fields {
				val := reflect.ValueOf(fields[j])
				field := &decodeCustomTypeField{field: val, fun: fn}
				dec.customTypes[typ].fields = append(dec.customTypes[typ].fields, field)
			}
		}
	}
	return dec
}
1346627
func RegisterCodec(codecs ...Codec) {
	for _, codec := range codecs {
		fmt.Printf("Found codec: %v\n", codec.Name())
		allCodecs[codec.Name()] = codec
	}
}
310239
func colorCode(style string) *bytes.Buffer {
	buf := bytes.NewBufferString("")
	if plain || style == "" {
		return buf
	}
	if style == "reset" {
		buf.WriteString(Reset)
		return buf
	} else if style == "off" {
		return buf
	}

	foregroundBackground := strings.Split(style, ":")
	foreground := strings.Split(foregroundBackground[0], "+")
	fgKey := foreground[0]
	fg := Colors[fgKey]
	fgStyle := ""
	if len(foreground) > 1 {
		fgStyle = foreground[1]
	}

	bg, bgStyle := "", ""

	if len(foregroundBackground) > 1 {
		background := strings.Split(foregroundBackground[1], "+")
		bg = background[0]
		if len(background) > 1 {
			bgStyle = background[1]
		}
	}

	buf.WriteString(start)
	base := normalIntensityFG
	if len(fgStyle) > 0 {
		if strings.Contains(fgStyle, "b") {
			buf.WriteString(bold)
		}
		if strings.Contains(fgStyle, "B") {
			buf.WriteString(blink)
		}
		if strings.Contains(fgStyle, "u") {
			buf.WriteString(underline)
		}
		if strings.Contains(fgStyle, "i") {
			buf.WriteString(inverse)
		}
		if strings.Contains(fgStyle, "s") {
			buf.WriteString(strikethrough)
		}
		if strings.Contains(fgStyle, "h") {
			base = highIntensityFG
		}
	}

	// if 256-color
	n, err := strconv.Atoi(fgKey)
	if err == nil {
		fmt.Fprintf(buf, "38;5;%d;", n)
	} else {
		fmt.Fprintf(buf, "%d;", base+fg)
	}

	base = normalIntensityBG
	if len(bg) > 0 {
		if strings.Contains(bgStyle, "h") {
			base = highIntensityBG
		}
		// if 256-color
		n, err := strconv.Atoi(bg)
		if err == nil {
			fmt.Fprintf(buf, "48;5;%d;", n)
		} else {
			fmt.Fprintf(buf, "%d;", base+Colors[bg])
		}
	}

	// remove last ";"
	buf.Truncate(buf.Len() - 1)
	buf.WriteRune('m')
	return buf
}
1149152
func (s *resourceServiceImpl) Register(ctx context.Context, resourceTypeName string, resourceID, parentResourceID *string, identityID *uuid.UUID) (*resource.Resource, error) {

	var res *resource.Resource

	err := s.ExecuteInTransaction(func() error {

		// Lookup the resource type
		resourceType, err := s.Repositories().ResourceTypeRepository().Lookup(ctx, resourceTypeName)
		if err != nil {
			return errors.NewBadParameterErrorFromString("type", resourceTypeName, err.Error())
		}

		// Lookup the parent resource if it's specified
		var parentResource *resource.Resource

		if parentResourceID != nil {
			parentResource, err = s.Repositories().ResourceRepository().Load(ctx, *parentResourceID)
			if err != nil {
				return errors.NewBadParameterErrorFromString("parent resource ID", *parentResourceID, err.Error())
			}
		}

		var rID string
		if resourceID != nil {
			rID = *resourceID
		} else {
			rID = uuid.NewV4().String()
		}

		// Create a new resource instance
		res = &resource.Resource{
			ResourceID:       rID,
			ParentResourceID: parentResourceID,
			ResourceType:     *resourceType,
			ResourceTypeID:   resourceType.ResourceTypeID,
			ParentResource:   parentResource,
		}

		// Persist the resource
		err = s.Repositories().ResourceRepository().Create(ctx, res)
		if err != nil {
			return err
		}

		// Search for any default role mappings for the resource type
		defaultRoleMappings, err := s.Repositories().DefaultRoleMappingRepository().FindForResourceType(ctx, resourceType.ResourceTypeID)
		if err != nil {
			return err
		}

		// For each default role mapping for the same resource type, create a role mapping for the resource
		for _, m := range defaultRoleMappings {
			roleMapping := &repository.RoleMapping{
				ResourceID: rID,
				FromRoleID: m.FromRoleID,
				ToRoleID:   m.ToRoleID,
			}

			err = s.Repositories().RoleMappingRepository().Create(ctx, roleMapping)
			if err != nil {
				return err
			}
		}

		if identityID != nil {
			err = s.Repositories().Identities().CheckExists(ctx, (*identityID).String())
			if err != nil {
				return err
			}
			if resourceType.DefaultRoleID != nil {
				defaultRole, err := s.Repositories().RoleRepository().Load(ctx, *resourceType.DefaultRoleID)
				if err != nil {
					return err
				}
				if defaultRole != nil {
					err = s.Services().RoleManagementService().ForceAssign(ctx, *identityID, defaultRole.Name, *res)
					if err != nil {
						return err
					}
				}

			}
		}
		return nil
	})

	return res, err
}
1145306
func (s *Schema) Register(t GraphQLType) {
	typeInfo := t.GraphQLTypeInfo()
	s.registeredTypes[t.GraphQLTypeInfo().Name] = typeInfo
	// TODO(tmc): collision handling
	for name, fieldSpec := range typeInfo.Fields {
		if fieldSpec.IsRoot {
			s.rootFields[name] = fieldSpec
		}
	}
}
4607
func (decoder *HTTPDecoder) Register(f DecoderFunc, contentTypes ...string) {
	p := newDecodePool(f)

	for _, contentType := range contentTypes {
		mediaType, _, err := mime.ParseMediaType(contentType)
		if err != nil {
			mediaType = contentType
		}
		decoder.pools[mediaType] = p
	}
}
122929
func (v *Validate) RegisterCustomTypeFunc(fn CustomTypeFunc, types ...interface{}) {

	if v.customFuncs == nil {
		v.customFuncs = make(map[reflect.Type]CustomTypeFunc)
	}

	for _, t := range types {
		v.customFuncs[reflect.TypeOf(t)] = fn
	}

	v.hasCustomFuncs = true
}
131913
func Register(mimeType string, format string) {
	mime.AddExtensionType("."+strings.TrimPrefix(format, "."), mimeType)
}
37469
func Register(name string, init WriterInitializer) bool {
	if _, found := funs[name]; found {
		return false
	}

	funs[name] = init
	return true
}
401737
func Register(proto interface{}, alias string, tag ...string) {
	structType := reflect.TypeOf(proto)
	if structType.Kind() == reflect.Ptr {
		structType = structType.Elem()
	}
	if structType.Kind() != reflect.Struct {
		panic("invalid type: " + structType.String())
	}
	structTypesLocker.Lock()
	structTypes[alias] = structType
	structTypesLocker.Unlock()

	structTypeCacheLocker.Lock()
	cache := &structCache{Alias: alias}
	if len(tag) == 1 {
		cache.Tag = tag[0]
	}
	cache.Fields = getFields(structType, cache.Tag)
	initStructCacheData(cache)
	structTypeCache[(*emptyInterface)(unsafe.Pointer(&structType)).ptr] = cache
	structTypeCacheLocker.Unlock()
}
662418
func (m *Mgr) Register(ledgerid string, l ChaincodeLifecycleEventListener) {
	// write lock to synchronize concurrent 'chaincode install' operations with ledger creation/open
	m.rwlock.Lock()
	defer m.rwlock.Unlock()
	m.ccLifecycleListeners[ledgerid] = append(m.ccLifecycleListeners[ledgerid], l)
}
75635
func (s *LocalSupervisor) RegisterFunc(name string, fn ServiceFunc) {
	s.Register(&LocalService{Function: fn, ServiceName: name})
}