<!--
  ~ RedGL - MIT License
  ~ Copyright (c) 2018 - 2019 By RedCamel(webseon@gmail.com)
  ~ https://github.com/redcamel/RedGL2/blob/dev/LICENSE
  ~ Last modification time of this file - 2019.7.8 15:8
  -->

<!DOCTYPE html>
<html lang="ko">

<head>
    <meta charset="UTF-8">
    <meta name="keywords" content="RedGL,webgl,demo">
    <title>RedGL Example - RedLine</title>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi"
    />
    <link rel="stylesheet" href="../example.css">

    <script src="../dat.gui.min.js"></script>
    <script src="../baseTestUI.js"></script>
    <script src="../../release/RedGL.min.js"></script>
</head>

<body>
<script id='testSource'>
	var testUI;
	var canvas;
	var assetPath = '../../asset/'
	canvas = document.createElement('canvas');
	document.body.appendChild(canvas);
	RedGL(canvas, function (v) {
		if (v) {
			console.log('초기화 성공!');
			var tWorld, tView, tScene, tController, tRenderer;
			var setBase = function (redGL) {
				// 월드 생성
				redGL['world'] = tWorld = RedWorld();
				// 씬 생성
				tScene = RedScene(redGL);
				// 카메라 생성
				tController = RedObitController(redGL);
				tController.pan = 45;
				tController.tilt = -45;
				tController.distance = 20;
				// 렌더러 생성
				tRenderer = RedRenderer();
				// 뷰생성 및 적용
				tView = RedView(redGL, tScene, tController);
				tWorld.addView(tView);
				// 그리드 설정
				tScene['grid'] = RedGrid(redGL);
				// 렌더시작
				tRenderer.start(redGL, function (time) {
				});
				// 렌더 디버거 활성화
				tRenderer.setDebugButton();

			};
			setBase(this);
			// tLine 생성 함수 정의
			var addLine_random, addLine_circle;
			// 60번 포인트를 랜덤으로 정의하고 라인추가
			addLine_random = function (redGL) {
				var tLine;
				var tX, tY, tZ;
				var i = 60;
				// 라인객체 생성
				tLine = RedLine(redGL, RedColorMaterial(redGL));
				tScene.addChild(tLine);
				tX = tY = tZ = 0
				while (i--) {
					tX += Math.random() - 0.5;
					tY += Math.random() - 0.5;
					tZ += Math.random() - 0.5;
					// 라인에 포인트 추가
					tLine.addPoint(tX, tY, tZ);
				}
			};
			// 60번 포인트로 원을 정의하는 함수
			addLine_circle = function (redGL, drawMode) {
				var tLine;
				var tX, tY, tZ;
				var startRadian;
				var i = 60
				tLine = RedLine(redGL, RedColorMaterial(redGL, drawMode == redGL.gl.LINES ? '#ff00ff' : '#00ff00'))
				tScene.addChild(tLine)
				tX = tY = tZ = 0;
				startRadian = Math.random() * Math.PI * 2;
				while (i--) {
					tX += Math.sin(i / 60 * Math.PI * 2 + startRadian);
					tY += Math.cos(i / 60 * Math.PI * 2 + startRadian);
					tZ += Math.sin(i / 60 * Math.PI * 2 + startRadian);
					// 라인에 포인트 추가
					tLine.addPoint(tX, tY, tZ);
				}
				tLine.rotationX = tLine.rotationY = tLine.rotationZ = Math.random() * 360;
				tLine.drawMode = drawMode
			};
			addLine_random(this);
			addLine_circle(this, this.gl.LINES);
			// Test UI
			testUI(this, tView, addLine_random, addLine_circle)
		} else {
			console.log('초기화 실패!');
		}
	});
	testUI = function (redGL, view1, addLine_random, addLine_circle) {
		var gui = new baseTestUI(redGL);
		gui.initCamera(view1['camera']);
		gui.initScene(view1['scene']);
		var t0 = gui['gui'].addFolder('Line Test');
		var test = {
			addLine_random: function () {
				addLine_random(redGL, redGL.gl.LINES);
			},
			addLine_circle1: function () {
				addLine_circle(redGL, redGL.gl.LINES);
			},
			addLine_circle2: function () {
				addLine_circle(redGL, redGL.gl.LINE_LOOP);
			}
		};
		t0.open();
		t0.add(test, 'addLine_random').name('addLine_random');
		t0.add(test, 'addLine_circle1').name('addLine_circle(redGL.gl.LINES)');
		t0.add(test, 'addLine_circle2').name('addLine_circle(redGL.gl.LINE_LOOP)');
	}
</script>
</body>

</html>


/*
Copyright 2019 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/*

NOTE: the contents of this file has been copied from k8s.io/kubernetes/pkg/controller
and k8s.io/kubernetes/pkg/util/taints. The reason for duplicating this code is to remove
dependencies to k8s.io/kubernetes in all the cloud providers. Once k8s.io/kubernetes/pkg/util/taints
is moved to an external repository, this file should be removed and replaced with that one.
*/

package helpers

import (
	"context"
	"encoding/json"
	"fmt"
	"time"

	"k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/equality"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/types"
	"k8s.io/apimachinery/pkg/util/strategicpatch"
	"k8s.io/apimachinery/pkg/util/wait"
	clientset "k8s.io/client-go/kubernetes"
	clientretry "k8s.io/client-go/util/retry"
)

var updateTaintBackoff = wait.Backoff{
	Steps:    5,
	Duration: 100 * time.Millisecond,
	Jitter:   1.0,
}

// AddOrUpdateTaintOnNode add taints to the node. If taint was added into node, it'll issue API calls
// to update nodes; otherwise, no API calls. Return error if any.
func AddOrUpdateTaintOnNode(c clientset.Interface, nodeName string, taints ...*v1.Taint) error {
	if len(taints) == 0 {
		return nil
	}
	firstTry := true
	return clientretry.RetryOnConflict(updateTaintBackoff, func() error {
		var err error
		var oldNode *v1.Node
		// First we try getting node from the API server cache, as it's cheaper. If it fails
		// we get it from etcd to be sure to have fresh data.
		if firstTry {
			oldNode, err = c.CoreV1().Nodes().Get(context.TODO(), nodeName, metav1.GetOptions{ResourceVersion: "0"})
			firstTry = false
		} else {
			oldNode, err = c.CoreV1().Nodes().Get(context.TODO(), nodeName, metav1.GetOptions{})
		}
		if err != nil {
			return err
		}

		var newNode *v1.Node
		oldNodeCopy := oldNode
		updated := false
		for _, taint := range taints {
			curNewNode, ok, err := addOrUpdateTaint(oldNodeCopy, taint)
			if err != nil {
				return fmt.Errorf("failed to update taint of node")
			}
			updated = updated || ok
			newNode = curNewNode
			oldNodeCopy = curNewNode
		}
		if !updated {
			return nil
		}
		return PatchNodeTaints(c, nodeName, oldNode, newNode)
	})
}

// PatchNodeTaints patches node's taints.
func PatchNodeTaints(c clientset.Interface, nodeName string, oldNode *v1.Node, newNode *v1.Node) error {
	oldData, err := json.Marshal(oldNode)
	if err != nil {
		return fmt.Errorf("failed to marshal old node %#v for node %q: %v", oldNode, nodeName, err)
	}

	newTaints := newNode.Spec.Taints
	newNodeClone := oldNode.DeepCopy()
	newNodeClone.Spec.Taints = newTaints
	newData, err := json.Marshal(newNodeClone)
	if err != nil {
		return fmt.Errorf("failed to marshal new node %#v for node %q: %v", newNodeClone, nodeName, err)
	}

	patchBytes, err := strategicpatch.CreateTwoWayMergePatch(oldData, newData, v1.Node{})
	if err != nil {
		return fmt.Errorf("failed to create patch for node %q: %v", nodeName, err)
	}

	_, err = c.CoreV1().Nodes().Patch(context.TODO(), nodeName, types.StrategicMergePatchType, patchBytes, metav1.PatchOptions{})
	return err
}

// addOrUpdateTaint tries to add a taint to annotations list. Returns a new copy of updated Node and true if something was updated
// false otherwise.
func addOrUpdateTaint(node *v1.Node, taint *v1.Taint) (*v1.Node, bool, error) {
	newNode := node.DeepCopy()
	nodeTaints := newNode.Spec.Taints

	var newTaints []v1.Taint
	updated := false
	for i := range nodeTaints {
		if taint.MatchTaint(&nodeTaints[i]) {
			if equality.Semantic.DeepEqual(*taint, nodeTaints[i]) {
				return newNode, false, nil
			}
			newTaints = append(newTaints, *taint)
			updated = true
			continue
		}

		newTaints = append(newTaints, nodeTaints[i])
	}

	if !updated {
		newTaints = append(newTaints, *taint)
	}

	newNode.Spec.Taints = newTaints
	return newNode, true, nil
}

// RemoveTaintOffNode is for cleaning up taints temporarily added to node,
// won't fail if target taint doesn't exist or has been removed.
// If passed a node it'll check if there's anything to be done, if taint is not present it won't issue
// any API calls.
func RemoveTaintOffNode(c clientset.Interface, nodeName string, node *v1.Node, taints ...*v1.Taint) error {
	if len(taints) == 0 {
		return nil
	}
	// Short circuit for limiting amount of API calls.
	if node != nil {
		match := false
		for _, taint := range taints {
			if taintExists(node.Spec.Taints, taint) {
				match = true
				break
			}
		}
		if !match {
			return nil
		}
	}

	firstTry := true
	return clientretry.RetryOnConflict(updateTaintBackoff, func() error {
		var err error
		var oldNode *v1.Node
		// First we try getting node from the API server cache, as it's cheaper. If it fails
		// we get it from etcd to be sure to have fresh data.
		if firstTry {
			oldNode, err = c.CoreV1().Nodes().Get(context.TODO(), nodeName, metav1.GetOptions{ResourceVersion: "0"})
			firstTry = false
		} else {
			oldNode, err = c.CoreV1().Nodes().Get(context.TODO(), nodeName, metav1.GetOptions{})
		}
		if err != nil {
			return err
		}

		var newNode *v1.Node
		oldNodeCopy := oldNode
		updated := false
		for _, taint := range taints {
			curNewNode, ok, err := removeTaint(oldNodeCopy, taint)
			if err != nil {
				return fmt.Errorf("failed to remove taint of node")
			}
			updated = updated || ok
			newNode = curNewNode
			oldNodeCopy = curNewNode
		}
		if !updated {
			return nil
		}
		return PatchNodeTaints(c, nodeName, oldNode, newNode)
	})
}

// taintExists checks if the given taint exists in list of taints. Returns true if exists false otherwise.
func taintExists(taints []v1.Taint, taintToFind *v1.Taint) bool {
	for _, taint := range taints {
		if taint.MatchTaint(taintToFind) {
			return true
		}
	}
	return false
}

// removeTaint tries to remove a taint from annotations list. Returns a new copy of updated Node and true if something was updated
// false otherwise.
func removeTaint(node *v1.Node, taint *v1.Taint) (*v1.Node, bool, error) {
	newNode := node.DeepCopy()
	nodeTaints := newNode.Spec.Taints
	if len(nodeTaints) == 0 {
		return newNode, false, nil
	}

	if !taintExists(nodeTaints, taint) {
		return newNode, false, nil
	}

	newTaints, _ := deleteTaint(nodeTaints, taint)
	newNode.Spec.Taints = newTaints
	return newNode, true, nil
}

// deleteTaint removes all the taints that have the same key and effect to given taintToDelete.
func deleteTaint(taints []v1.Taint, taintToDelete *v1.Taint) ([]v1.Taint, bool) {
	newTaints := []v1.Taint{}
	deleted := false
	for i := range taints {
		if taintToDelete.MatchTaint(&taints[i]) {
			deleted = true
			continue
		}
		newTaints = append(newTaints, taints[i])
	}
	return newTaints, deleted
}


// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Indexed binary package export.
// This file was derived from $GOROOT/src/cmd/compile/internal/gc/iexport.go;
// see that file for specification of the format.

package gcimporter

import (
	"bytes"
	"encoding/binary"
	"go/ast"
	"go/constant"
	"go/token"
	"go/types"
	"io"
	"math/big"
	"reflect"
	"sort"
)

// Current indexed export format version. Increase with each format change.
// 0: Go1.11 encoding
const iexportVersion = 0

// IExportData returns the binary export data for pkg.
//
// If no file set is provided, position info will be missing.
// The package path of the top-level package will not be recorded,
// so that calls to IImportData can override with a provided package path.
func IExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) {
	defer func() {
		if e := recover(); e != nil {
			if ierr, ok := e.(internalError); ok {
				err = ierr
				return
			}
			// Not an internal error; panic again.
			panic(e)
		}
	}()

	p := iexporter{
		out:         bytes.NewBuffer(nil),
		fset:        fset,
		allPkgs:     map[*types.Package]bool{},
		stringIndex: map[string]uint64{},
		declIndex:   map[types.Object]uint64{},
		typIndex:    map[types.Type]uint64{},
		localpkg:    pkg,
	}

	for i, pt := range predeclared() {
		p.typIndex[pt] = uint64(i)
	}
	if len(p.typIndex) > predeclReserved {
		panic(internalErrorf("too many predeclared types: %d > %d", len(p.typIndex), predeclReserved))
	}

	// Initialize work queue with exported declarations.
	scope := pkg.Scope()
	for _, name := range scope.Names() {
		if ast.IsExported(name) {
			p.pushDecl(scope.Lookup(name))
		}
	}

	// Loop until no more work.
	for !p.declTodo.empty() {
		p.doDecl(p.declTodo.popHead())
	}

	// Append indices to data0 section.
	dataLen := uint64(p.data0.Len())
	w := p.newWriter()
	w.writeIndex(p.declIndex)
	w.flush()

	// Assemble header.
	var hdr intWriter
	hdr.WriteByte('i')
	hdr.uint64(iexportVersion)
	hdr.uint64(uint64(p.strings.Len()))
	hdr.uint64(dataLen)

	// Flush output.
	io.Copy(p.out, &hdr)
	io.Copy(p.out, &p.strings)
	io.Copy(p.out, &p.data0)

	return p.out.Bytes(), nil
}

// writeIndex writes out an object index. mainIndex indicates whether
// we're writing out the main index, which is also read by
// non-compiler tools and includes a complete package description
// (i.e., name and height).
func (w *exportWriter) writeIndex(index map[types.Object]uint64) {
	// Build a map from packages to objects from that package.
	pkgObjs := map[*types.Package][]types.Object{}

	// For the main index, make sure to include every package that
	// we reference, even if we're not exporting (or reexporting)
	// any symbols from it.
	pkgObjs[w.p.localpkg] = nil
	for pkg := range w.p.allPkgs {
		pkgObjs[pkg] = nil
	}

	for obj := range index {
		pkgObjs[obj.Pkg()] = append(pkgObjs[obj.Pkg()], obj)
	}

	var pkgs []*types.Package
	for pkg, objs := range pkgObjs {
		pkgs = append(pkgs, pkg)

		sort.Slice(objs, func(i, j int) bool {
			return objs[i].Name() < objs[j].Name()
		})
	}

	sort.Slice(pkgs, func(i, j int) bool {
		return w.exportPath(pkgs[i]) < w.exportPath(pkgs[j])
	})

	w.uint64(uint64(len(pkgs)))
	for _, pkg := range pkgs {
		w.string(w.exportPath(pkg))
		w.string(pkg.Name())
		w.uint64(uint64(0)) // package height is not needed for go/types

		objs := pkgObjs[pkg]
		w.uint64(uint64(len(objs)))
		for _, obj := range objs {
			w.string(obj.Name())
			w.uint64(index[obj])
		}
	}
}

type iexporter struct {
	fset *token.FileSet
	out  *bytes.Buffer

	localpkg *types.Package

	// allPkgs tracks all packages that have been referenced by
	// the export data, so we can ensure to include them in the
	// main index.
	allPkgs map[*types.Package]bool

	declTodo objQueue

	strings     intWriter
	stringIndex map[string]uint64

	data0     intWriter
	declIndex map[types.Object]uint64
	typIndex  map[types.Type]uint64
}

// stringOff returns the offset of s within the string section.
// If not already present, it's added to the end.
func (p *iexporter) stringOff(s string) uint64 {
	off, ok := p.stringIndex[s]
	if !ok {
		off = uint64(p.strings.Len())
		p.stringIndex[s] = off

		p.strings.uint64(uint64(len(s)))
		p.strings.WriteString(s)
	}
	return off
}

// pushDecl adds n to the declaration work queue, if not already present.
func (p *iexporter) pushDecl(obj types.Object) {
	// Package unsafe is known to the compiler and predeclared.
	assert(obj.Pkg() != types.Unsafe)

	if _, ok := p.declIndex[obj]; ok {
		return
	}

	p.declIndex[obj] = ^uint64(0) // mark n present in work queue
	p.declTodo.pushTail(obj)
}

// exportWriter handles writing out individual data section chunks.
type exportWriter struct {
	p *iexporter

	data     intWriter
	currPkg  *types.Package
	prevFile string
	prevLine int64
}

func (w *exportWriter) exportPath(pkg *types.Package) string {
	if pkg == w.p.localpkg {
		return ""
	}
	return pkg.Path()
}

func (p *iexporter) doDecl(obj types.Object) {
	w := p.newWriter()
	w.setPkg(obj.Pkg(), false)

	switch obj := obj.(type) {
	case *types.Var:
		w.tag('V')
		w.pos(obj.Pos())
		w.typ(obj.Type(), obj.Pkg())

	case *types.Func:
		sig, _ := obj.Type().(*types.Signature)
		if sig.Recv() != nil {
			panic(internalErrorf("unexpected method: %v", sig))
		}
		w.tag('F')
		w.pos(obj.Pos())
		w.signature(sig)

	case *types.Const:
		w.tag('C')
		w.pos(obj.Pos())
		w.value(obj.Type(), obj.Val())

	case *types.TypeName:
		if obj.IsAlias() {
			w.tag('A')
			w.pos(obj.Pos())
			w.typ(obj.Type(), obj.Pkg())
			break
		}

		// Defined type.
		w.tag('T')
		w.pos(obj.Pos())

		underlying := obj.Type().Underlying()
		w.typ(underlying, obj.Pkg())

		t := obj.Type()
		if types.IsInterface(t) {
			break
		}

		named, ok := t.(*types.Named)
		if !ok {
			panic(internalErrorf("%s is not a defined type", t))
		}

		n := named.NumMethods()
		w.uint64(uint64(n))
		for i := 0; i < n; i++ {
			m := named.Method(i)
			w.pos(m.Pos())
			w.string(m.Name())
			sig, _ := m.Type().(*types.Signature)
			w.param(sig.Recv())
			w.signature(sig)
		}

	default:
		panic(internalErrorf("unexpected object: %v", obj))
	}

	p.declIndex[obj] = w.flush()
}

func (w *exportWriter) tag(tag byte) {
	w.data.WriteByte(tag)
}

func (w *exportWriter) pos(pos token.Pos) {
	if w.p.fset == nil {
		w.int64(0)
		return
	}

	p := w.p.fset.Position(pos)
	file := p.Filename
	line := int64(p.Line)

	// When file is the same as the last position (common case),
	// we can save a few bytes by delta encoding just the line
	// number.
	//
	// Note: Because data objects may be read out of order (or not
	// at all), we can only apply delta encoding within a single
	// object. This is handled implicitly by tracking prevFile and
	// prevLine as fields of exportWriter.

	if file == w.prevFile {
		delta := line - w.prevLine
		w.int64(delta)
		if delta == deltaNewFile {
			w.int64(-1)
		}
	} else {
		w.int64(deltaNewFile)
		w.int64(line) // line >= 0
		w.string(file)
		w.prevFile = file
	}
	w.prevLine = line
}

func (w *exportWriter) pkg(pkg *types.Package) {
	// Ensure any referenced packages are declared in the main index.
	w.p.allPkgs[pkg] = true

	w.string(w.exportPath(pkg))
}

func (w *exportWriter) qualifiedIdent(obj types.Object) {
	// Ensure any referenced declarations are written out too.
	w.p.pushDecl(obj)

	w.string(obj.Name())
	w.pkg(obj.Pkg())
}

func (w *exportWriter) typ(t types.Type, pkg *types.Package) {
	w.data.uint64(w.p.typOff(t, pkg))
}

func (p *iexporter) newWriter() *exportWriter {
	return &exportWriter{p: p}
}

func (w *exportWriter) flush() uint64 {
	off := uint64(w.p.data0.Len())
	io.Copy(&w.p.data0, &w.data)
	return off
}

func (p *iexporter) typOff(t types.Type, pkg *types.Package) uint64 {
	off, ok := p.typIndex[t]
	if !ok {
		w := p.newWriter()
		w.doTyp(t, pkg)
		off = predeclReserved + w.flush()
		p.typIndex[t] = off
	}
	return off
}

func (w *exportWriter) startType(k itag) {
	w.data.uint64(uint64(k))
}

func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) {
	switch t := t.(type) {
	case *types.Named:
		w.startType(definedType)
		w.qualifiedIdent(t.Obj())

	case *types.Pointer:
		w.startType(pointerType)
		w.typ(t.Elem(), pkg)

	case *types.Slice:
		w.startType(sliceType)
		w.typ(t.Elem(), pkg)

	case *types.Array:
		w.startType(arrayType)
		w.uint64(uint64(t.Len()))
		w.typ(t.Elem(), pkg)

	case *types.Chan:
		w.startType(chanType)
		// 1 RecvOnly; 2 SendOnly; 3 SendRecv
		var dir uint64
		switch t.Dir() {
		case types.RecvOnly:
			dir = 1
		case types.SendOnly:
			dir = 2
		case types.SendRecv:
			dir = 3
		}
		w.uint64(dir)
		w.typ(t.Elem(), pkg)

	case *types.Map:
		w.startType(mapType)
		w.typ(t.Key(), pkg)
		w.typ(t.Elem(), pkg)

	case *types.Signature:
		w.startType(signatureType)
		w.setPkg(pkg, true)
		w.signature(t)

	case *types.Struct:
		w.startType(structType)
		w.setPkg(pkg, true)

		n := t.NumFields()
		w.uint64(uint64(n))
		for i := 0; i < n; i++ {
			f := t.Field(i)
			w.pos(f.Pos())
			w.string(f.Name())
			w.typ(f.Type(), pkg)
			w.bool(f.Anonymous())
			w.string(t.Tag(i)) // note (or tag)
		}

	case *types.Interface:
		w.startType(interfaceType)
		w.setPkg(pkg, true)

		n := t.NumEmbeddeds()
		w.uint64(uint64(n))
		for i := 0; i < n; i++ {
			f := t.Embedded(i)
			w.pos(f.Obj().Pos())
			w.typ(f.Obj().Type(), f.Obj().Pkg())
		}

		n = t.NumExplicitMethods()
		w.uint64(uint64(n))
		for i := 0; i < n; i++ {
			m := t.ExplicitMethod(i)
			w.pos(m.Pos())
			w.string(m.Name())
			sig, _ := m.Type().(*types.Signature)
			w.signature(sig)
		}

	default:
		panic(internalErrorf("unexpected type: %v, %v", t, reflect.TypeOf(t)))
	}
}

func (w *exportWriter) setPkg(pkg *types.Package, write bool) {
	if write {
		w.pkg(pkg)
	}

	w.currPkg = pkg
}

func (w *exportWriter) signature(sig *types.Signature) {
	w.paramList(sig.Params())
	w.paramList(sig.Results())
	if sig.Params().Len() > 0 {
		w.bool(sig.Variadic())
	}
}

func (w *exportWriter) paramList(tup *types.Tuple) {
	n := tup.Len()
	w.uint64(uint64(n))
	for i := 0; i < n; i++ {
		w.param(tup.At(i))
	}
}

func (w *exportWriter) param(obj types.Object) {
	w.pos(obj.Pos())
	w.localIdent(obj)
	w.typ(obj.Type(), obj.Pkg())
}

func (w *exportWriter) value(typ types.Type, v constant.Value) {
	w.typ(typ, nil)

	switch v.Kind() {
	case constant.Bool:
		w.bool(constant.BoolVal(v))
	case constant.Int:
		var i big.Int
		if i64, exact := constant.Int64Val(v); exact {
			i.SetInt64(i64)
		} else if ui64, exact := constant.Uint64Val(v); exact {
			i.SetUint64(ui64)
		} else {
			i.SetString(v.ExactString(), 10)
		}
		w.mpint(&i, typ)
	case constant.Float:
		f := constantToFloat(v)
		w.mpfloat(f, typ)
	case constant.Complex:
		w.mpfloat(constantToFloat(constant.Real(v)), typ)
		w.mpfloat(constantToFloat(constant.Imag(v)), typ)
	case constant.String:
		w.string(constant.StringVal(v))
	case constant.Unknown:
		// package contains type errors
	default:
		panic(internalErrorf("unexpected value %v (%T)", v, v))
	}
}

// constantToFloat converts a constant.Value with kind constant.Float to a
// big.Float.
func constantToFloat(x constant.Value) *big.Float {
	assert(x.Kind() == constant.Float)
	// Use the same floating-point precision (512) as cmd/compile
	// (see Mpprec in cmd/compile/internal/gc/mpfloat.go).
	const mpprec = 512
	var f big.Float
	f.SetPrec(mpprec)
	if v, exact := constant.Float64Val(x); exact {
		// float64
		f.SetFloat64(v)
	} else if num, denom := constant.Num(x), constant.Denom(x); num.Kind() == constant.Int {
		// TODO(gri): add big.Rat accessor to constant.Value.
		n := valueToRat(num)
		d := valueToRat(denom)
		f.SetRat(n.Quo(n, d))
	} else {
		// Value too large to represent as a fraction => inaccessible.
		// TODO(gri): add big.Float accessor to constant.Value.
		_, ok := f.SetString(x.ExactString())
		assert(ok)
	}
	return &f
}

// mpint exports a multi-precision integer.
//
// For unsigned types, small values are written out as a single
// byte. Larger values are written out as a length-prefixed big-endian
// byte string, where the length prefix is encoded as its complement.
// For example, bytes 0, 1, and 2 directly represent the integer
// values 0, 1, and 2; while bytes 255, 254, and 253 indicate a 1-,
// 2-, and 3-byte big-endian string follow.
//
// Encoding for signed types use the same general approach as for
// unsigned types, except small values use zig-zag encoding and the
// bottom bit of length prefix byte for large values is reserved as a
// sign bit.
//
// The exact boundary between small and large encodings varies
// according to the maximum number of bytes needed to encode a value
// of type typ. As a special case, 8-bit types are always encoded as a
// single byte.
//
// TODO(mdempsky): Is this level of complexity really worthwhile?
func (w *exportWriter) mpint(x *big.Int, typ types.Type) {
	basic, ok := typ.Underlying().(*types.Basic)
	if !ok {
		panic(internalErrorf("unexpected type %v (%T)", typ.Underlying(), typ.Underlying()))
	}

	signed, maxBytes := intSize(basic)

	negative := x.Sign() < 0
	if !signed && negative {
		panic(internalErrorf("negative unsigned integer; type %v, value %v", typ, x))
	}

	b := x.Bytes()
	if len(b) > 0 && b[0] == 0 {
		panic(internalErrorf("leading zeros"))
	}
	if uint(len(b)) > maxBytes {
		panic(internalErrorf("bad mpint length: %d > %d (type %v, value %v)", len(b), maxBytes, typ, x))
	}

	maxSmall := 256 - maxBytes
	if signed {
		maxSmall = 256 - 2*maxBytes
	}
	if maxBytes == 1 {
		maxSmall = 256
	}

	// Check if x can use small value encoding.
	if len(b) <= 1 {
		var ux uint
		if len(b) == 1 {
			ux = uint(b[0])
		}
		if signed {
			ux <<= 1
			if negative {
				ux--
			}
		}
		if ux < maxSmall {
			w.data.WriteByte(byte(ux))
			return
		}
	}

	n := 256 - uint(len(b))
	if signed {
		n = 256 - 2*uint(len(b))
		if negative {
			n |= 1
		}
	}
	if n < maxSmall || n >= 256 {
		panic(internalErrorf("encoding mistake: %d, %v, %v => %d", len(b), signed, negative, n))
	}

	w.data.WriteByte(byte(n))
	w.data.Write(b)
}

// mpfloat exports a multi-precision floating point number.
//
// The number's value is decomposed into mantissa × 2**exponent, where
// mantissa is an integer. The value is written out as mantissa (as a
// multi-precision integer) and then the exponent, except exponent is
// omitted if mantissa is zero.
func (w *exportWriter) mpfloat(f *big.Float, typ types.Type) {
	if f.IsInf() {
		panic("infinite constant")
	}

	// Break into f = mant × 2**exp, with 0.5 <= mant < 1.
	var mant big.Float
	exp := int64(f.MantExp(&mant))

	// Scale so that mant is an integer.
	prec := mant.MinPrec()
	mant.SetMantExp(&mant, int(prec))
	exp -= int64(prec)

	manti, acc := mant.Int(nil)
	if acc != big.Exact {
		panic(internalErrorf("mantissa scaling failed for %f (%s)", f, acc))
	}
	w.mpint(manti, typ)
	if manti.Sign() != 0 {
		w.int64(exp)
	}
}

func (w *exportWriter) bool(b bool) bool {
	var x uint64
	if b {
		x = 1
	}
	w.uint64(x)
	return b
}

func (w *exportWriter) int64(x int64)   { w.data.int64(x) }
func (w *exportWriter) uint64(x uint64) { w.data.uint64(x) }
func (w *exportWriter) string(s string) { w.uint64(w.p.stringOff(s)) }

func (w *exportWriter) localIdent(obj types.Object) {
	// Anonymous parameters.
	if obj == nil {
		w.string("")
		return
	}

	name := obj.Name()
	if name == "_" {
		w.string("_")
		return
	}

	w.string(name)
}

type intWriter struct {
	bytes.Buffer
}

func (w *intWriter) int64(x int64) {
	var buf [binary.MaxVarintLen64]byte
	n := binary.PutVarint(buf[:], x)
	w.Write(buf[:n])
}

func (w *intWriter) uint64(x uint64) {
	var buf [binary.MaxVarintLen64]byte
	n := binary.PutUvarint(buf[:], x)
	w.Write(buf[:n])
}

func assert(cond bool) {
	if !cond {
		panic("internal error: assertion failed")
	}
}

// The below is copied from go/src/cmd/compile/internal/gc/syntax.go.

// objQueue is a FIFO queue of types.Object. The zero value of objQueue is
// a ready-to-use empty queue.
type objQueue struct {
	ring       []types.Object
	head, tail int
}

// empty returns true if q contains no Nodes.
func (q *objQueue) empty() bool {
	return q.head == q.tail
}

// pushTail appends n to the tail of the queue.
func (q *objQueue) pushTail(obj types.Object) {
	if len(q.ring) == 0 {
		q.ring = make([]types.Object, 16)
	} else if q.head+len(q.ring) == q.tail {
		// Grow the ring.
		nring := make([]types.Object, len(q.ring)*2)
		// Copy the old elements.
		part := q.ring[q.head%len(q.ring):]
		if q.tail-q.head <= len(part) {
			part = part[:q.tail-q.head]
			copy(nring, part)
		} else {
			pos := copy(nring, part)
			copy(nring[pos:], q.ring[:q.tail%len(q.ring)])
		}
		q.ring, q.head, q.tail = nring, 0, q.tail-q.head
	}

	q.ring[q.tail%len(q.ring)] = obj
	q.tail++
}

// popHead pops a node from the head of the queue. It panics if q is empty.
func (q *objQueue) popHead() types.Object {
	if q.empty() {
		panic("dequeue empty")
	}
	obj := q.ring[q.head%len(q.ring)]
	q.head++
	return obj
}


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Parsed via PacketSamurai AionGer-Edtion - [Thu Sep 06 10:47:28 CEST 2018] -->
<spawns>
	<!-- Kromede's Trial -->
	<spawn_map map_id="300230000">
		<!-- IDCromede_Invisible_NPC ||| IDCromede_Invisible_NPC -->
		<spawn npc_id="282083">
			<spot x="710.0" y="629.0" z="198.0" h="0"/>
		</spawn>
		<!-- IDCromede_Invisible_NPC5 ||| IDCromede_Invisible_NPC5 -->
		<spawn npc_id="282087">
			<spot x="654.7493" y="561.4789" z="205.21887" h="0"/>
		</spawn>
		<!-- IDCromede_Invisible_NPC9 ||| IDCromede_Invisible_NPC9 -->
		<spawn npc_id="282091">
			<spot x="365.45166" y="183.65565" z="146.83829" h="76"/>
		</spawn>
		<!-- Altar of Healing ||| IDCromede_Invisible_NPC10 -->
		<spawn npc_id="282092">
			<spot x="643.9172" y="753.299" z="216.15863" h="30"/>
			<spot x="643.935" y="795.35126" z="216.15862" h="30"/>
		</spawn>
		<!-- Mana Relic ||| IDCromede_Relic_Blue -->
		<spawn npc_id="282093">
			<spot x="661.2224" y="767.6592" z="216.23439" h="0" static_id="87"/>
		</spawn>
		<!-- Strength Relic ||| IDCromede_Relic_Red -->
		<spawn npc_id="282095">
			<spot x="662.2582" y="782.54895" z="216.23434" h="0" static_id="84"/>
		</spawn>
		<!-- Stone of Vitality ||| IDCromede_RedStone -->
		<spawn npc_id="282103">
			<spot x="358.44" y="172.71" z="147.38" h="0"/>
			<spot x="349.71683" y="188.79349" z="146.22021" h="0"/>
		</spawn>
		<!-- Life Stone ||| IDCromede_BlueStone -->
		<spawn npc_id="282104">
			<spot x="354.7" y="176.5" z="147.38" h="0"/>
		</spawn>
		<!-- Altar of Healing ||| IDCromede_Invisible_NPC11 -->
		<spawn npc_id="282111">
			<spot x="643.92" y="753.3" z="216.15863" h="30"/>
			<spot x="643.9378" y="795.35223" z="216.15862" h="30"/>
		</spawn>
		<!-- IDCromede_Invisible_NPC15 ||| IDCromede_Invisible_NPC15 -->
		<spawn npc_id="282115">
			<spot x="568.19" y="833.13" z="226.33" h="0"/>
		</spawn>
		<!-- Robstin ||| IDCromede_Invisible_NPC16 -->
		<spawn npc_id="282116">
			<spot x="677.8253" y="584.14044" z="210.46408" h="0"/>
		</spawn>
		<!-- IDCromede_Invisible_NPC17 ||| IDCromede_Invisible_NPC17 -->
		<spawn npc_id="282117">
			<spot x="656.92" y="585.74" z="199.04" h="0"/>
		</spawn>
		<!-- IDCromede_Invisible_NPC19 ||| IDCromede_Invisible_NPC19 -->
		<spawn npc_id="282119">
			<spot x="585.92944" y="774.2844" z="215.57028" h="60"/>
		</spawn>
		<!-- Votaic Column ||| IDCromede_Invisible_NPC20 -->
		<spawn npc_id="282120">
			<spot x="638.7864" y="774.4301" z="215.58362" h="45"/>
		</spawn>
		<!-- Ancient Temple Nagolem ||| IDCromede_StatueM_38_An -->
		<spawn npc_id="282124">
			<spot x="633.67" y="791.59" z="216.14" h="0"/>
			<spot x="633.67" y="756.79" z="216.14" h="0"/>
			<spot x="633.67" y="791.59" z="216.14" h="0"/>
			<spot x="633.67" y="756.79" z="216.14" h="0"/>
		</spawn>
		<!-- Ancient Temple Nagolem ||| IDCromede_UnAttack_StatueM_38_An -->
		<spawn npc_id="282126">
			<spot x="633.68335" y="754.7949" z="216.09479" h="30"/>
			<spot x="653.92175" y="754.7974" z="216.09479" h="30"/>
			<spot x="613.90295" y="754.87146" z="216.09479" h="30"/>
			<spot x="613.88916" y="793.7428" z="216.0948" h="90"/>
			<spot x="623.78314" y="754.7766" z="216.09479" h="30"/>
			<spot x="623.76935" y="793.64795" z="216.0948" h="90"/>
			<spot x="633.66956" y="793.66626" z="216.0948" h="90"/>
			<spot x="653.90796" y="793.66876" z="216.0948" h="90"/>
		</spawn>
		<!-- Troll Lookout ||| IDCromede_01_Troll_38_An -->
		<spawn npc_id="653330">
			<spot x="307.76007" y="261.66068" z="187.20868" h="16"/>
			<spot x="299.0732" y="248.95984" z="187.4869" h="16"/>
		</spawn>
		<!-- Trollkin Lookout ||| IDCromede_01_trollkin_38_An -->
		<spawn npc_id="653331">
			<spot x="287.5675" y="241.6895" z="188.21785" h="90"/>
			<spot x="315.2513" y="288.56268" z="192.7124" h="60"/>
		</spawn>
		<!-- Watching Kalgolem ||| IDCromede_01_SouledStone_38_An -->
		<spawn npc_id="653332">
			<spot x="484.51202" y="363.04913" z="171.83458" h="47"/>
		</spawn>
		<!-- Net Arachna ||| IDCromede_01_Octaside_38_An -->
		<spawn npc_id="653333">
			<spot x="414.94025" y="319.4674" z="175.90968" h="71"/>
			<spot x="560.92065" y="264.82007" z="150.75479" h="34"/>
		</spawn>
		<!-- Temple Mugolem ||| IDCromede_01_SAM_Divine_38_An -->
		<spawn npc_id="653334">
			<spot x="358.5196" y="190.82436" z="146.71289" h="106"/>
			<spot x="414.91324" y="246.48947" z="140.60265" h="17"/>
			<spot x="372.9814" y="176.13734" z="146.71289" h="46"/>
			<spot x="427.23492" y="234.25061" z="140.60265" h="17"/>
			<spot x="472.12955" y="353.38046" z="170.9699" h="73"/>
			<spot x="514.88696" y="237.74126" z="142.42914" h="40"/>
		</spawn>
		<!-- Faithful Temple Nagolem ||| IDCromede_01_Statue_M_Divine_38_An -->
		<spawn npc_id="653335">
			<spot x="347.78094" y="180.34946" z="145.89189" h="39"/>
			<spot x="469.75717" y="257.19095" z="138.69754" h="54"/>
			<spot x="503.592" y="253.75116" z="141.56602" h="35"/>
			<spot x="509.37164" y="217.20876" z="144.96463" h="116"/>
			<spot x="358.55695" y="167.30272" z="145.89182" h="112"/>
		</spawn>
		<!-- Petrahulk Gatekeeper ||| IDCromede_01_Key_Cyclops_worker_38_An -->
		<spawn npc_id="653336">
			<spot x="392.14615" y="209.72995" z="145.85693" h="15"/>
		</spawn>
		<!-- Divine Hisen ||| IDCromede_01_Named_Hierarch_38_An -->
		<spawn npc_id="653337">
			<spot x="352.21" y="170.31" z="146.22023" h="16"/>
		</spawn>
		<!-- Captive ||| IDCromede_2low_PrisonerWoman1_38_An -->
		<spawn npc_id="653338">
			<spot x="646.1768" y="615.59393" z="201.19109" h="10"/>
			<spot x="645.52496" y="656.3329" z="201.19107" h="10"/>
		</spawn>
		<!-- Prisoner ||| IDCromede_2low_PrisonerMan2_38_An -->
		<spawn npc_id="653339">
			<spot x="649.30664" y="594.8346" z="201.19109" h="55"/>
			<spot x="662.98846" y="597.07477" z="201.19109" h="6"/>
			<spot x="642.6354" y="600.21155" z="201.19109" h="15"/>
			<spot x="651.7999" y="653.3091" z="201.19107" h="6"/>
		</spawn>
		<!-- Captive ||| IDCromede_2low_PrisonerWoman2_38_An -->
		<spawn npc_id="653340">
			<spot x="666.6195" y="596.9176" z="201.19109" h="53"/>
			<spot x="642.1069" y="665.2642" z="201.19107" h="0"/>
			<spot x="655.0497" y="656.039" z="201.19107" h="53"/>
		</spawn>
		<!-- Dungeon Guard ||| IDCromede_2low_Mguard1_38_An -->
		<spawn npc_id="653341">
			<spot x="730.8758" y="546.46655" z="198.53853" h="80"/>
			<spot x="687.91974" y="505.86328" z="197.9006" h="0"/>
		</spawn>
		<!-- Dungeon Sentry ||| IDCromede_2low_Rguard1_38_An -->
		<spawn npc_id="653342">
			<spot x="729.61957" y="544.4907" z="198.53853" h="20"/>
			<spot x="723.33594" y="524.7021" z="197.87419" h="96"/>
		</spawn>
		<!-- Dungeon Guard ||| IDCromede_2low_Mguard2_38_An -->
		<spawn npc_id="653343">
			<spot x="709.93384" y="523.45703" z="197.88683" h="80"/>
		</spawn>
		<!-- Dungeon Sentry ||| IDCromede_2low_Rguard2_38_An -->
		<spawn npc_id="653344">
			<spot x="710.0457" y="543.24805" z="197.88681" h="80"/>
		</spawn>
		<!-- Dungeon Servant ||| IDCromede_2low_ServantMan_38_An -->
		<spawn npc_id="653345">
			<spot x="702.3464" y="548.3079" z="197.8742" h="65"/>
			<spot x="727.1314" y="528.9071" z="197.88681" h="34"/>
		</spawn>
		<!-- Dungeon Maid ||| IDCromede_2low_ServantWoman_38_An -->
		<spawn npc_id="653346">
			<spot x="740.66095" y="518.0343" z="198.73694" h="113"/>
		</spawn>
		<!-- Shadow Executor Asusin ||| IDCromede_2low_Manager_38_An -->
		<spawn npc_id="653347">
			<spot x="544.4814" y="639.7813" z="215.35608" h="60"/>
		</spawn>
		<!-- Warden Baal ||| IDCromede_2low_Key_PrisonGuards_38_An -->
		<spawn npc_id="653348">
			<spot x="688.7367" y="613.2802" z="200.11989" h="91"/>
		</spawn>
		<!-- Manor Guard Captain ||| IDCromede_2low_Key_GuardBoss_38_An -->
		<spawn npc_id="653349">
			<spot x="739.61774" y="532.05804" z="199.31773" h="60"/>
		</spawn>
		<!-- Hamam the Torturer ||| IDCromede_2low_Trigger_Torture_38_An -->
		<spawn npc_id="653350">
			<spot x="750.3141" y="625.1159" z="197.54472" h="105"/>
		</spawn>
		<!-- Manor Servant ||| IDCromede_2up_ServantManA_38_An -->
		<spawn npc_id="653351">
			<spot x="578.0825" y="638.90796" z="208.13933" h="91"/>
			<spot x="507.19702" y="589.25476" z="215.5286" h="0"/>
			<spot x="518.9381" y="685.5721" z="215.5286" h="9"/>
			<spot x="535.16394" y="702.71405" z="215.55" h="75"/>
			<spot x="507.04413" y="780.74365" z="215.97673" h="81"/>
		</spawn>
		<!-- Manor Maid ||| IDCromede_2up_ServantWomanA_38_An -->
		<spawn npc_id="653352">
			<spot x="518.13245" y="589.2094" z="215.5286" h="60"/>
			<spot x="497.86356" y="685.2856" z="215.5286" h="101"/>
			<spot x="494.2564" y="683.2696" z="215.5286" h="15"/>
			<spot x="517.9326" y="780.4086" z="215.97672" h="100"/>
		</spawn>
		<!-- Manor Servant ||| IDCromede_2up_ServantManB_38_An -->
		<spawn npc_id="653353">
			<spot x="599.7364" y="663.8879" z="208.98871" h="59"/>
			<spot x="580.6339" y="634.3646" z="208.13835" h="30"/>
			<spot x="581.51105" y="620.227" z="208.98555" h="86"/>
			<spot x="541.5023" y="626.9278" z="201.58124" h="30"/>
		</spawn>
		<!-- Manor Guest ||| IDCromede_2up_Mguard1_38_An -->
		<spawn npc_id="653354">
			<spot x="513.9531" y="611.61304" z="214.99913" h="60"/>
			<spot x="559.3185" y="688.80927" z="215.5286" h="0"/>
			<spot x="513.8508" y="670.2219" z="214.99915" h="60"/>
			<spot x="535.15436" y="721.2572" z="215.5286" h="46"/>
			<spot x="494.78812" y="702.2527" z="215.54999" h="90"/>
		</spawn>
		<!-- Manor Scribe ||| IDCromede_2up_Rguard1_38_An -->
		<spawn npc_id="653355">
			<spot x="557.71" y="754.99786" z="225.77342" h="90"/>
			<spot x="571.5245" y="769.92267" z="215.56648" h="90"/>
			<spot x="555.9373" y="785.5314" z="215.88853" h="95"/>
			<spot x="576.3942" y="827.4632" z="225.78215" h="61"/>
		</spawn>
		<!-- Manor Guard ||| IDCromede_2up_Mguard2_38_An -->
		<spawn npc_id="653356">
			<spot x="525.2485" y="756.3972" z="215.5286" h="60"/>
			<spot x="500.90088" y="754.3457" z="215.5286" h="6"/>
			<spot x="524.2423" y="771.226" z="215.5286" h="80"/>
			<spot x="501.83328" y="770.1322" z="215.5286" h="106"/>
		</spawn>
		<!-- Manor Defender ||| IDCromede_2up_Rguard2_38_An -->
		<spawn npc_id="653357">
			<spot x="504.0414" y="765.1647" z="215.5286" h="30"/>
		</spawn>
		<!-- Manor Gardener ||| IDCromede_2up_Gardener1_38_An -->
		<spawn npc_id="653358">
			<spot x="529.7593" y="652.9267" z="201.66309" h="87"/>
			<spot x="492.27322" y="631.6106" z="201.50711" h="90"/>
			<spot x="496.48264" y="657.78125" z="201.71332" h="46"/>
		</spawn>
		<!-- Manor Gardener ||| IDCromede_2up_Gardener2_38_An -->
		<spawn npc_id="653359">
			<spot x="533.51984" y="627.2393" z="201.62213" h="90"/>
			<spot x="506.16187" y="619.0201" z="201.48782" h="52"/>
			<spot x="515.2463" y="655.51306" z="201.52678" h="0"/>
		</spawn>
		<!-- Yulina ||| IDCromede_2up_Chef1_38_An -->
		<spawn npc_id="653360">
			<spot x="513.5668" y="742.6286" z="215.52861" h="91"/>
		</spawn>
		<!-- Kiernook ||| IDCromede_2up_Chef2_38_An -->
		<spawn npc_id="653361">
			<spot x="511.7998" y="742.7413" z="215.52861" h="91"/>
		</spawn>
		<!-- Manor Kitchen Maid ||| IDCromede_2up_Housemaid_38_An -->
		<spawn npc_id="653362">
			<spot x="606.8903" y="631.6085" z="208.98668" h="15"/>
		</spawn>
		<!-- Pet Tog ||| IDCromede_2up_Tog_38_An -->
		<spawn npc_id="653363">
			<spot x="528.5049" y="648.1431" z="201.58102" h="98"/>
		</spawn>
		<!-- Jeeves ||| IDCromede_2up_Key_Butler_38_An -->
		<spawn npc_id="653364">
			<spot x="585.9432" y="774.20966" z="215.57028" h="0"/>
		</spawn>
		<!-- Lady Angerr ||| IDCromede_2up_Trigger_Wife_38_An -->
		<spawn npc_id="653365">
			<spot x="512.4925" y="571.4596" z="216.88846" h="30"/>
		</spawn>
		<!-- Justicetaker Wyr ||| IDCromede_2up_Trigger_AssiJudge_38_An -->
		<spawn npc_id="653366">
			<spot x="567.989" y="835.77356" z="225.82626" h="30"/>
		</spawn>
		<!-- Kaliga the Unjust ||| IDCromede_2up_Named_Angry_Judge_38_An -->
		<spawn npc_id="653367">
			<spot x="668.5679" y="774.37366" z="216.88036" h="60"/>
		</spawn>
		<!-- Crazy Prisoner ||| IDCromede_2low_PrisonerMan3_38_An -->
		<spawn npc_id="653368">
			<spot x="657.8109" y="607.86615" z="201.19109" h="99"/>
			<spot x="655.5525" y="648.0692" z="201.19107" h="0"/>
			<spot x="645.3802" y="646.1737" z="201.19109" h="0"/>
			<spot x="663.6772" y="645.438" z="201.19107" h="0"/>
		</spawn>
		<!-- Crazy Captive ||| IDCromede_2low_PrisonerWoman3_38_An -->
		<spawn npc_id="653369">
			<spot x="645.6742" y="603.3673" z="201.19109" h="0"/>
			<spot x="662.55554" y="611.8932" z="201.19109" h="23"/>
			<spot x="662.4405" y="658.7458" z="201.19107" h="23"/>
		</spawn>
		<!-- Dungeon Guard ||| IDCromede_2low_Mguard3_38_An -->
		<spawn npc_id="653370">
			<spot x="675.49927" y="606.51917" z="201.19107" h="0"/>
			<spot x="687.9887" y="592.9692" z="200.1199" h="30"/>
			<spot x="679.1647" y="629.1043" z="201.05255" h="0"/>
			<spot x="673.8558" y="651.0355" z="201.19107" h="60"/>
			<spot x="638.4705" y="588.0557" z="209.04085" h="90"/>
			<spot x="693.0561" y="530.60706" z="197.90057" h="60"/>
		</spawn>
		<!-- Dungeon Sentry ||| IDCromede_2low_Rguard3_38_An -->
		<spawn npc_id="653371">
			<spot x="694.7556" y="623.90607" z="200.1199" h="45"/>
			<spot x="688.908" y="555.0045" z="197.90062" h="30"/>
		</spawn>
		<!-- Guard Bitin ||| IDCromede_2low_PrisonGuards_38_An -->
		<spawn npc_id="653372">
			<spot x="655.15314" y="581.5869" z="198.92433" h="20"/>
		</spawn>
		<!-- Manor Maid ||| IDCromede_2up_ServantWomanC_38_An -->
		<spawn npc_id="653373">
			<spot x="606.0431" y="624.0882" z="208.98907" h="73"/>
			<spot x="605.8997" y="656.4058" z="208.98906" h="73"/>
			<spot x="576.1228" y="646.4518" z="208.14114" h="90"/>
			<spot x="591.7659" y="577.93414" z="208.99332" h="15"/>
		</spawn>
		<!-- Manor Visitor ||| IDCromede_2up_Mguard3_38_An -->
		<spawn npc_id="653374">
			<spot x="511.56604" y="611.6482" z="214.99913" h="0"/>
			<spot x="561.2292" y="688.76465" z="215.5286" h="60"/>
			<spot x="511.46375" y="670.2571" z="214.99915" h="0"/>
			<spot x="533.195" y="723.0609" z="215.5286" h="106"/>
			<spot x="494.79144" y="699.9309" z="215.54999" h="30"/>
		</spawn>
		<!-- Manor Librarian ||| IDCromede_2up_Rguard3_38_An -->
		<spawn npc_id="653375">
			<spot x="581.6463" y="757.73334" z="215.5348" h="90"/>
			<spot x="577.5688" y="776.33923" z="215.56647" h="106"/>
			<spot x="571.1133" y="798.0519" z="215.5348" h="90"/>
			<spot x="579.7739" y="797.6218" z="225.77344" h="90"/>
			<spot x="572.52563" y="809.30304" z="225.84941" h="70"/>
			<spot x="556.6964" y="817.423" z="225.78215" h="46"/>
			<spot x="585.65393" y="808.6282" z="225.78215" h="60"/>
		</spawn>
		<!-- Manor Guard ||| IDCromede_2up_Mguard4_38_An -->
		<spawn npc_id="653376">
			<spot x="595.1304" y="639.506" z="208.44666" h="30"/>
			<spot x="611.6034" y="640.54956" z="208.98796" h="60"/>
			<spot x="596.19135" y="589.3804" z="208.9933" h="30"/>
			<spot x="560.4048" y="616.83154" z="215.3561" h="30"/>
			<spot x="544.87335" y="641.5685" z="215.35608" h="60"/>
			<spot x="546.372" y="656.987" z="215.3561" h="113"/>
			<spot x="506.9939" y="612.23285" z="201.58508" h="0"/>
			<spot x="525.1887" y="668.46765" z="201.62233" h="0"/>
		</spawn>
		<!-- Manor Defender ||| IDCromede_2up_Rguard4_38_An -->
		<spawn npc_id="653377">
			<spot x="595.12244" y="641.4727" z="208.44672" h="90"/>
			<spot x="611.1449" y="583.80804" z="208.9933" h="0"/>
			<spot x="546.25287" y="623.72266" z="215.35608" h="6"/>
			<spot x="563.5663" y="662.7957" z="215.35606" h="75"/>
			<spot x="484.72723" y="632.094" z="201.59547" h="91"/>
		</spawn>
		<!-- Scared Prisoner ||| IDCromede_2low_PrisonerMan4_38_An -->
		<spawn npc_id="653378">
			<spot x="668.36786" y="628.76514" z="201.19107" h="0"/>
			<spot x="659.34796" y="634.1241" z="201.19107" h="10"/>
		</spawn>
		<!-- Scared Captive ||| IDCromede_2low_PrisonerWoman4_38_An -->
		<spawn npc_id="653379">
			<spot x="650.2802" y="630.0307" z="201.19109" h="110"/>
			<spot x="662.3082" y="622.4972" z="201.19107" h="73"/>
		</spawn>
		<!-- Torture Tog ||| IDCromede_2low_Tog_38_An -->
		<spawn npc_id="653380">
			<spot x="732.48895" y="635.6784" z="196.77103" h="66"/>
			<spot x="723.59" y="633.545" z="196.77457" h="36"/>
			<spot x="738.7905" y="623.0411" z="196.77457" h="103"/>
		</spawn>
		<!-- Manor Visitor ||| IDCromede_2up_Mguard5_38_An -->
		<spawn npc_id="653381">
			<spot x="512.0968" y="697.0641" z="215.55974" h="30"/>
			<spot x="512.1932" y="706.12494" z="215.55974" h="90"/>
		</spawn>
		<!-- Manor Guest ||| IDCromede_2up_Rguard5_38_An -->
		<spawn npc_id="653382">
			<spot x="518.1245" y="701.69336" z="215.55972" h="60"/>
		</spawn>
		<!-- Relic Guardian ||| IDCromede_2up_Mguard6_38_An -->
		<spawn npc_id="653384">
			<spot x="609.2937" y="770.66235" z="215.58362" h="60"/>
			<spot x="609.304" y="778.09906" z="215.58362" h="60"/>
		</spawn>
		<!-- Watchdog Tog ||| IDCromede_2low_PetTog_38_An -->
		<spawn npc_id="653385">
			<spot x="689.6037" y="593.73804" z="200.1199" h="30"/>
			<spot x="689.9725" y="505.8838" z="197.9006" h="60"/>
		</spawn>
		<!-- Dungeon Guard ||| IDCromede_2low_Mguard4_38_An -->
		<spawn npc_id="653386">
			<spot x="685.169" y="661.9395" z="200.11993" h="33"/>
		</spawn>
		<!-- Dungeon Sentry ||| IDCromede_2low_Rguard4_38_An -->
		<spawn npc_id="653387">
			<spot x="689.8362" y="661.17645" z="200.11993" h="26"/>
		</spawn>
		<!-- Dungeon Bloodwing ||| IDCromede_2low_Bat_38_An -->
		<spawn npc_id="656241">
			<spot x="638.6416" y="588.05536" z="209.04085" h="0"/>
			<spot x="638.6416" y="588.05536" z="209.04085" h="0"/>
			<spot x="638.6416" y="588.05536" z="209.04085" h="0"/>
			<spot x="638.6416" y="588.05536" z="209.04085" h="0"/>
			<spot x="638.6416" y="588.05536" z="209.04085" h="0"/>
			<spot x="638.6416" y="588.05536" z="209.04085" h="0"/>
		</spawn>
		<!-- Bloodlust Dionae ||| IDCromede_2up_Dionaea_38_An -->
		<spawn npc_id="656249">
			<spot x="493.77383" y="632.5344" z="201.51845" h="0"/>
		</spawn>
		<!-- Sealed Stone Door ||| IDCromede_Stone_Door -->
		<spawn npc_id="700835">
			<spot x="502.4092" y="345.9964" z="168.90407" h="0" static_id="3"/>
		</spawn>
		<!-- Torture Chamber Door ||| IDCromede_torture_door -->
		<spawn npc_id="700922">
			<spot x="711.5991" y="629.3586" z="196.82828" h="0" static_id="320"/>
		</spawn>
		<!-- Secret Safe Door ||| IDCromede_bookcase_door_in -->
		<spawn npc_id="700924">
			<spot x="587.6711" y="774.232" z="215.59996" h="60" static_id="5"/>
		</spawn>
		<!-- Emergency Exit ||| IDCromede_escape_door -->
		<spawn npc_id="700928">
			<spot x="680.7784" y="774.01013" z="216.88036" h="0" static_id="105"/>
		</spawn>
		<!-- Robstin's Corpse ||| IDCromede_body -->
		<spawn npc_id="700939">
			<spot x="656.92" y="585.74" z="199.14" h="0"/>
		</spawn>
		<!-- Tortured Captive ||| IDCromede_PrisonerMan -->
		<spawn npc_id="700946">
			<spot x="757.08905" y="621.9651" z="197.54472" h="30"/>
			<spot x="754.037" y="622.71857" z="197.54472" h="53"/>
		</spawn>
		<!-- Tortured Prisoner ||| IDCromede_PrisonerWoman -->
		<spawn npc_id="700947">
			<spot x="752.76105" y="620.35547" z="197.54472" h="30"/>
			<spot x="754.3646" y="617.89075" z="197.17696" h="43"/>
		</spawn>
		<!-- Dream Boundary ||| IDCromede_entrance_out -->
		<spawn npc_id="700949">
			<spot x="229.35812" y="252.25693" z="191.16841" h="110"/>
		</spawn>
		<!-- Grave Robber's Corpse ||| IDCromede_Rotan_body -->
		<spawn npc_id="700961">
			<spot x="467.18765" y="351.88593" z="170.32787" h="66" static_id="56"/>
		</spawn>
		<!-- Shadow Executor Asusin ||| IDCromede_NPC_Manager -->
		<spawn npc_id="700964">
			<spot x="237.68486" y="249.01709" z="189.8725" h="113"/>
		</spawn>
		<!-- Robstin ||| IDCromede_NPC_Robstin -->
		<spawn npc_id="700965">
			<spot x="657.20074" y="585.7778" z="199.04715" h="113"/>
		</spawn>
		<!-- Maga's Potion ||| IDCromede_FOBJ_Q18603 -->
		<spawn npc_id="730308">
			<spot x="350.28397" y="169.9596" z="146.34906" h="0" static_id="6"/>
		</spawn>
		<!-- Lost Rotan ||| IDCromede_Statue_Q18604 -->
		<spawn npc_id="730309">
			<spot x="469.09833" y="353.68143" z="170.7925" h="79"/>
		</spawn>
		<!-- Sleep Flower ||| IDCromede_flower_skill -->
		<spawn npc_id="730325">
			<spot x="492.22452" y="628.73303" z="201.67583" h="90" static_id="79"/>
		</spawn>
		<!-- Kaliga's Sword Rack ||| IDCromede_sword -->
		<spawn npc_id="730326">
			<spot x="644.2064" y="763.19867" z="216.10056" h="0" static_id="206"/>
		</spawn>
		<!-- Kaliga's Greatsword Rack ||| IDCromede_2hsword -->
		<spawn npc_id="730327">
			<spot x="613.7907" y="784.8866" z="216.10056" h="0" static_id="13"/>
		</spawn>
		<!-- Kaliga's Dagger Rack ||| IDCromede_dagger -->
		<spawn npc_id="730328">
			<spot x="644.24994" y="784.97345" z="216.10056" h="0" static_id="197"/>
		</spawn>
		<!-- Kaliga's Polearm Rack ||| IDCromede_polearm -->
		<spawn npc_id="730329">
			<spot x="653.3656" y="784.7784" z="216.10056" h="0" static_id="200"/>
		</spawn>
		<!-- Kaliga's Bow Rack ||| IDCromede_bow -->
		<spawn npc_id="730330">
			<spot x="634.26746" y="785.09186" z="216.10056" h="0" static_id="195"/>
		</spawn>
		<!-- Kaliga's Mace Rack ||| IDCromede_mace -->
		<spawn npc_id="730331">
			<spot x="653.2491" y="763.3508" z="216.10056" h="0" static_id="202"/>
		</spawn>
		<!-- Kaliga's Staff Rack ||| IDCromede_staff -->
		<spawn npc_id="730332">
			<spot x="623.64386" y="763.16016" z="216.10056" h="0" static_id="260"/>
		</spawn>
		<!-- Kaliga's Spellbook Rack ||| IDCromede_book -->
		<spawn npc_id="730333">
			<spot x="623.59906" y="784.95026" z="216.10056" h="0" static_id="193"/>
		</spawn>
		<!-- Kaliga's Orb Rack ||| IDCromede_orb -->
		<spawn npc_id="730334">
			<spot x="634.11365" y="763.34265" z="216.10056" h="0" static_id="208"/>
		</spawn>
		<!-- Kaliga's Shield Rack ||| IDCromede_shield -->
		<spawn npc_id="730335">
			<spot x="613.6698" y="763.2537" z="216.10056" h="0" static_id="268"/>
		</spawn>
		<!-- Garden Fountain ||| IDCromede_buff_fountain -->
		<spawn npc_id="730336">
			<spot x="512.25446" y="640.27" z="202.50072" h="0" static_id="14"/>
		</spawn>
		<!-- Fruit Basket ||| IDCromede_buff_basket -->
		<spawn npc_id="730337">
			<spot x="522.8628" y="755.2494" z="216.63828" h="0" static_id="70"/>
		</spawn>
		<!-- Porgus Barbecue ||| IDCromede_buff_dish -->
		<spawn npc_id="730338">
			<spot x="503.46967" y="769.13153" z="216.6719" h="0" static_id="69"/>
		</spawn>
		<!-- Prophet's Tower ||| IDCromede_buff_statue -->
		<spawn npc_id="730339">
			<spot x="591.2065" y="640.5705" z="208.67542" h="0" static_id="15"/>
		</spawn>
		<!-- Old Relic Chest ||| IDCromede_box_skill -->
		<spawn npc_id="730340">
			<spot x="741.7551" y="530.59705" z="199.31775" h="60" static_id="319"/>
		</spawn>
		<!-- Maga's Potion ||| IDCromede_potion_skill -->
		<spawn npc_id="730341">
			<spot x="542.481" y="641.3745" z="217.48947" h="100" static_id="553"/>
		</spawn>
		<!-- Kaliga's Aether revolver display case ||| IDCromede_gun -->
		<spawn npc_id="730775">
			<spot x="613.879" y="789.6061" z="216.11526" h="0" static_id="978"/>
		</spawn>
		<!-- Kaliga's Aether cannon display box ||| IDCromede_cannon -->
		<spawn npc_id="730776">
			<spot x="623.7448" y="789.6008" z="216.12526" h="0" static_id="979"/>
		</spawn>
		<!-- Kaliga's stringed instrument display box ||| IDCromede_harp -->
		<spawn npc_id="730777">
			<spot x="613.7713" y="758.7706" z="216.11046" h="0" static_id="980"/>
		</spawn>
		<!-- Kaliga's Aether Key display box ||| IDCromede_keyblade -->
		<spawn npc_id="730887">
			<spot x="623.67926" y="758.8569" z="216.11046" h="0" static_id="984"/>
		</spawn>
		<!-- Silver Blade Rotan ||| Summon_Cromede_SDamage -->
		<spawn npc_id="749210">
			<spot x="485.39844" y="346.5547" z="170.33995" h="119"/>
		</spawn>
	</spawn_map>
</spawns>


# list are ordered
a = ['foo', 'bar', 'baz', 'qux']
b = ['baz', 'qux', 'bar', 'foo']

print(a == b)
print(a is b)
print([1, 2, 3, 4] == [4, 1, 3, 2])

#Lists Can Contain Arbitrary Objects
a = [21.42, 'foobar', 3, 4, 'bark', False, 3.14159]

# declare empty list
my_list = []

# declare list of integers
my_list = [1, 2, 3, 4]

# declare list of mixed datatypes
my_list = [1, 'mystring', 3.4, True]

# Lists Can Be Nested
# declare a nested list
my_list = [9, 'mystring',[1,2,3],['hi','there','my']]

# List Elements Can Be Accessed by Index
# INDEXING LIST

# declare list of integers
my_list = [1, 2, 3, 4]

my_first_element = my_list[0]
#returns 1
my_second_element = my_list[1]
#returns 2
my_third_element = my_list[2]
#returns 3

# returns error, we can only use integers for indexing.
# my_third_element = my_list[2.0]

# returns error, we only have 4 elements. This is accessing a fifth element.
# my_third_element = my_list[4]

# declare nested list of integers
my_list = [[1,2,3],[4,5,6],[7,8,9]]

my_first_element = my_list[0][0]
#returns 1
my_second_element = my_list[1][2]
#returns 6
my_third_element = my_list[2][1]
#returns 8

# SLICING LIST

my_list = ['y','o','d','a']

zero_to_one = my_list[0:1]
two_to_end = my_list[2:]
two_to_first = my_list[:-2]

print(two_to_first)

# CHANGING & ADDING ELEMENTS

my_list = [3, 4, 5, 6]

# change the first element
my_list[0] = 1

# change elements 2 to 3
my_list[2:3] = [7,8]

# add new item to end of the list
my_list.append(9)

# add several new item to the list
my_list.extend([10, 11, 12])

# using the '+' operator
my_list = my_list + [10,10,10]

# using the '*' operator
print(['myName' * 3])

# insert 6 in position 1
my_list.insert(1,6)

# insert 5 & 6 at position 3
my_list[3:3] = [5,6]

# DELETING ELEMENTS

my_list = [1, 2, 3, 4, 5]

# delete the second position
del my_list[2]

# delete multiple items
del my_list [0:1]

# delete the entire list
del my_list

# remove e from the list
my_list = ['m','a','c','e','w','i','n','d','u']
my_list.remove('e')

# remove the item at position 1
my_list.pop(1)

# remove the item at the last position
my_list.pop()

# remove the all the items in a list
my_list.clear()

# find the index of a particular item
fruit_list = ['Apple', 'Oranges','Pears']
print(fruit_list.index('Oranges'))

my_list.sort()
my_list.reverse()
my_new_list = my_list.copy()

# define list with fruits in it
fruit_list = ['Apple', 'Oranges','Pears']

# check if Value exist in List
if 'Apple' in fruit_list:
    print('The fruit exist.')

# loop through list
for fruit in fruit_list:
    print(fruit)

# count the number of items in a list
num_of_items = len(fruit_list)

num_list = [10, 8, 2]

# get the largest number in a list.
max_item = max(num_list)

# get the smallest number in a list.
min_item = min(num_list)
print(max_item)
print(min_item)

# create an enumeration object with an index and value.
print(enumerate(num_list))

# sum all the numbers in a list.
print(sum(num_list))


/* crypto/cms/cms_lcl.h */
/*
 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
 * project.
 */
/* ====================================================================
 * Copyright (c) 2008 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
 *
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please contact
 *    licensing@OpenSSL.org.
 *
 * 5. Products derived from this software may not be called "OpenSSL"
 *    nor may "OpenSSL" appear in their names without prior written
 *    permission of the OpenSSL Project.
 *
 * 6. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
 *
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 */

#ifndef HEADER_CMS_LCL_H
# define HEADER_CMS_LCL_H

#ifdef __cplusplus
extern "C" {
#endif

# include <openssl/x509.h>

/*
 * Cryptographic message syntax (CMS) structures: taken from RFC3852
 */

/* Forward references */

typedef struct CMS_IssuerAndSerialNumber_st CMS_IssuerAndSerialNumber;
typedef struct CMS_EncapsulatedContentInfo_st CMS_EncapsulatedContentInfo;
typedef struct CMS_SignerIdentifier_st CMS_SignerIdentifier;
typedef struct CMS_SignedData_st CMS_SignedData;
typedef struct CMS_OtherRevocationInfoFormat_st CMS_OtherRevocationInfoFormat;
typedef struct CMS_OriginatorInfo_st CMS_OriginatorInfo;
typedef struct CMS_EncryptedContentInfo_st CMS_EncryptedContentInfo;
typedef struct CMS_EnvelopedData_st CMS_EnvelopedData;
typedef struct CMS_DigestedData_st CMS_DigestedData;
typedef struct CMS_EncryptedData_st CMS_EncryptedData;
typedef struct CMS_AuthenticatedData_st CMS_AuthenticatedData;
typedef struct CMS_CompressedData_st CMS_CompressedData;
typedef struct CMS_OtherCertificateFormat_st CMS_OtherCertificateFormat;
typedef struct CMS_KeyTransRecipientInfo_st CMS_KeyTransRecipientInfo;
typedef struct CMS_OriginatorPublicKey_st CMS_OriginatorPublicKey;
typedef struct CMS_OriginatorIdentifierOrKey_st CMS_OriginatorIdentifierOrKey;
typedef struct CMS_KeyAgreeRecipientInfo_st CMS_KeyAgreeRecipientInfo;
typedef struct CMS_RecipientKeyIdentifier_st CMS_RecipientKeyIdentifier;
typedef struct CMS_KeyAgreeRecipientIdentifier_st
    CMS_KeyAgreeRecipientIdentifier;
typedef struct CMS_KEKIdentifier_st CMS_KEKIdentifier;
typedef struct CMS_KEKRecipientInfo_st CMS_KEKRecipientInfo;
typedef struct CMS_PasswordRecipientInfo_st CMS_PasswordRecipientInfo;
typedef struct CMS_OtherRecipientInfo_st CMS_OtherRecipientInfo;
typedef struct CMS_ReceiptsFrom_st CMS_ReceiptsFrom;

struct CMS_ContentInfo_st {
    ASN1_OBJECT *contentType;
    union {
        ASN1_OCTET_STRING *data;
        CMS_SignedData *signedData;
        CMS_EnvelopedData *envelopedData;
        CMS_DigestedData *digestedData;
        CMS_EncryptedData *encryptedData;
        CMS_AuthenticatedData *authenticatedData;
        CMS_CompressedData *compressedData;
        ASN1_TYPE *other;
        /* Other types ... */
        void *otherData;
    } d;
};

struct CMS_SignedData_st {
    long version;
    STACK_OF(X509_ALGOR) *digestAlgorithms;
    CMS_EncapsulatedContentInfo *encapContentInfo;
    STACK_OF(CMS_CertificateChoices) *certificates;
    STACK_OF(CMS_RevocationInfoChoice) *crls;
    STACK_OF(CMS_SignerInfo) *signerInfos;
};

struct CMS_EncapsulatedContentInfo_st {
    ASN1_OBJECT *eContentType;
    ASN1_OCTET_STRING *eContent;
    /* Set to 1 if incomplete structure only part set up */
    int partial;
};

struct CMS_SignerInfo_st {
    long version;
    CMS_SignerIdentifier *sid;
    X509_ALGOR *digestAlgorithm;
    STACK_OF(X509_ATTRIBUTE) *signedAttrs;
    X509_ALGOR *signatureAlgorithm;
    ASN1_OCTET_STRING *signature;
    STACK_OF(X509_ATTRIBUTE) *unsignedAttrs;
    /* Signing certificate and key */
    X509 *signer;
    EVP_PKEY *pkey;
    /* Digest and public key context for alternative parameters */
    EVP_MD_CTX mctx;
    EVP_PKEY_CTX *pctx;
};

struct CMS_SignerIdentifier_st {
    int type;
    union {
        CMS_IssuerAndSerialNumber *issuerAndSerialNumber;
        ASN1_OCTET_STRING *subjectKeyIdentifier;
    } d;
};

struct CMS_EnvelopedData_st {
    long version;
    CMS_OriginatorInfo *originatorInfo;
    STACK_OF(CMS_RecipientInfo) *recipientInfos;
    CMS_EncryptedContentInfo *encryptedContentInfo;
    STACK_OF(X509_ATTRIBUTE) *unprotectedAttrs;
};

struct CMS_OriginatorInfo_st {
    STACK_OF(CMS_CertificateChoices) *certificates;
    STACK_OF(CMS_RevocationInfoChoice) *crls;
};

struct CMS_EncryptedContentInfo_st {
    ASN1_OBJECT *contentType;
    X509_ALGOR *contentEncryptionAlgorithm;
    ASN1_OCTET_STRING *encryptedContent;
    /* Content encryption algorithm and key */
    const EVP_CIPHER *cipher;
    unsigned char *key;
    size_t keylen;
    /* Set to 1 if we are debugging decrypt and don't fake keys for MMA */
    int debug;
};

struct CMS_RecipientInfo_st {
    int type;
    union {
        CMS_KeyTransRecipientInfo *ktri;
        CMS_KeyAgreeRecipientInfo *kari;
        CMS_KEKRecipientInfo *kekri;
        CMS_PasswordRecipientInfo *pwri;
        CMS_OtherRecipientInfo *ori;
    } d;
};

typedef CMS_SignerIdentifier CMS_RecipientIdentifier;

struct CMS_KeyTransRecipientInfo_st {
    long version;
    CMS_RecipientIdentifier *rid;
    X509_ALGOR *keyEncryptionAlgorithm;
    ASN1_OCTET_STRING *encryptedKey;
    /* Recipient Key and cert */
    X509 *recip;
    EVP_PKEY *pkey;
    /* Public key context for this operation */
    EVP_PKEY_CTX *pctx;
};

struct CMS_KeyAgreeRecipientInfo_st {
    long version;
    CMS_OriginatorIdentifierOrKey *originator;
    ASN1_OCTET_STRING *ukm;
    X509_ALGOR *keyEncryptionAlgorithm;
    STACK_OF(CMS_RecipientEncryptedKey) *recipientEncryptedKeys;
    /* Public key context associated with current operation */
    EVP_PKEY_CTX *pctx;
    /* Cipher context for CEK wrapping */
    EVP_CIPHER_CTX ctx;
};

struct CMS_OriginatorIdentifierOrKey_st {
    int type;
    union {
        CMS_IssuerAndSerialNumber *issuerAndSerialNumber;
        ASN1_OCTET_STRING *subjectKeyIdentifier;
        CMS_OriginatorPublicKey *originatorKey;
    } d;
};

struct CMS_OriginatorPublicKey_st {
    X509_ALGOR *algorithm;
    ASN1_BIT_STRING *publicKey;
};

struct CMS_RecipientEncryptedKey_st {
    CMS_KeyAgreeRecipientIdentifier *rid;
    ASN1_OCTET_STRING *encryptedKey;
    /* Public key associated with this recipient */
    EVP_PKEY *pkey;
};

struct CMS_KeyAgreeRecipientIdentifier_st {
    int type;
    union {
        CMS_IssuerAndSerialNumber *issuerAndSerialNumber;
        CMS_RecipientKeyIdentifier *rKeyId;
    } d;
};

struct CMS_RecipientKeyIdentifier_st {
    ASN1_OCTET_STRING *subjectKeyIdentifier;
    ASN1_GENERALIZEDTIME *date;
    CMS_OtherKeyAttribute *other;
};

struct CMS_KEKRecipientInfo_st {
    long version;
    CMS_KEKIdentifier *kekid;
    X509_ALGOR *keyEncryptionAlgorithm;
    ASN1_OCTET_STRING *encryptedKey;
    /* Extra info: symmetric key to use */
    unsigned char *key;
    size_t keylen;
};

struct CMS_KEKIdentifier_st {
    ASN1_OCTET_STRING *keyIdentifier;
    ASN1_GENERALIZEDTIME *date;
    CMS_OtherKeyAttribute *other;
};

struct CMS_PasswordRecipientInfo_st {
    long version;
    X509_ALGOR *keyDerivationAlgorithm;
    X509_ALGOR *keyEncryptionAlgorithm;
    ASN1_OCTET_STRING *encryptedKey;
    /* Extra info: password to use */
    unsigned char *pass;
    size_t passlen;
};

struct CMS_OtherRecipientInfo_st {
    ASN1_OBJECT *oriType;
    ASN1_TYPE *oriValue;
};

struct CMS_DigestedData_st {
    long version;
    X509_ALGOR *digestAlgorithm;
    CMS_EncapsulatedContentInfo *encapContentInfo;
    ASN1_OCTET_STRING *digest;
};

struct CMS_EncryptedData_st {
    long version;
    CMS_EncryptedContentInfo *encryptedContentInfo;
    STACK_OF(X509_ATTRIBUTE) *unprotectedAttrs;
};

struct CMS_AuthenticatedData_st {
    long version;
    CMS_OriginatorInfo *originatorInfo;
    STACK_OF(CMS_RecipientInfo) *recipientInfos;
    X509_ALGOR *macAlgorithm;
    X509_ALGOR *digestAlgorithm;
    CMS_EncapsulatedContentInfo *encapContentInfo;
    STACK_OF(X509_ATTRIBUTE) *authAttrs;
    ASN1_OCTET_STRING *mac;
    STACK_OF(X509_ATTRIBUTE) *unauthAttrs;
};

struct CMS_CompressedData_st {
    long version;
    X509_ALGOR *compressionAlgorithm;
    STACK_OF(CMS_RecipientInfo) *recipientInfos;
    CMS_EncapsulatedContentInfo *encapContentInfo;
};

struct CMS_RevocationInfoChoice_st {
    int type;
    union {
        X509_CRL *crl;
        CMS_OtherRevocationInfoFormat *other;
    } d;
};

# define CMS_REVCHOICE_CRL               0
# define CMS_REVCHOICE_OTHER             1

struct CMS_OtherRevocationInfoFormat_st {
    ASN1_OBJECT *otherRevInfoFormat;
    ASN1_TYPE *otherRevInfo;
};

struct CMS_CertificateChoices {
    int type;
    union {
        X509 *certificate;
        ASN1_STRING *extendedCertificate; /* Obsolete */
        ASN1_STRING *v1AttrCert; /* Left encoded for now */
        ASN1_STRING *v2AttrCert; /* Left encoded for now */
        CMS_OtherCertificateFormat *other;
    } d;
};

# define CMS_CERTCHOICE_CERT             0
# define CMS_CERTCHOICE_EXCERT           1
# define CMS_CERTCHOICE_V1ACERT          2
# define CMS_CERTCHOICE_V2ACERT          3
# define CMS_CERTCHOICE_OTHER            4

struct CMS_OtherCertificateFormat_st {
    ASN1_OBJECT *otherCertFormat;
    ASN1_TYPE *otherCert;
};

/*
 * This is also defined in pkcs7.h but we duplicate it to allow the CMS code
 * to be independent of PKCS#7
 */

struct CMS_IssuerAndSerialNumber_st {
    X509_NAME *issuer;
    ASN1_INTEGER *serialNumber;
};

struct CMS_OtherKeyAttribute_st {
    ASN1_OBJECT *keyAttrId;
    ASN1_TYPE *keyAttr;
};

/* ESS structures */

# ifdef HEADER_X509V3_H

struct CMS_ReceiptRequest_st {
    ASN1_OCTET_STRING *signedContentIdentifier;
    CMS_ReceiptsFrom *receiptsFrom;
    STACK_OF(GENERAL_NAMES) *receiptsTo;
};

struct CMS_ReceiptsFrom_st {
    int type;
    union {
        long allOrFirstTier;
        STACK_OF(GENERAL_NAMES) *receiptList;
    } d;
};
# endif

struct CMS_Receipt_st {
    long version;
    ASN1_OBJECT *contentType;
    ASN1_OCTET_STRING *signedContentIdentifier;
    ASN1_OCTET_STRING *originatorSignatureValue;
};

DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
DECLARE_ASN1_ITEM(CMS_SignerInfo)
DECLARE_ASN1_ITEM(CMS_IssuerAndSerialNumber)
DECLARE_ASN1_ITEM(CMS_Attributes_Sign)
DECLARE_ASN1_ITEM(CMS_Attributes_Verify)
DECLARE_ASN1_ITEM(CMS_RecipientInfo)
DECLARE_ASN1_ITEM(CMS_PasswordRecipientInfo)
DECLARE_ASN1_ALLOC_FUNCTIONS(CMS_IssuerAndSerialNumber)

# define CMS_SIGNERINFO_ISSUER_SERIAL    0
# define CMS_SIGNERINFO_KEYIDENTIFIER    1

# define CMS_RECIPINFO_ISSUER_SERIAL     0
# define CMS_RECIPINFO_KEYIDENTIFIER     1

# define CMS_REK_ISSUER_SERIAL           0
# define CMS_REK_KEYIDENTIFIER           1

# define CMS_OIK_ISSUER_SERIAL           0
# define CMS_OIK_KEYIDENTIFIER           1
# define CMS_OIK_PUBKEY                  2

BIO *cms_content_bio(CMS_ContentInfo *cms);

CMS_ContentInfo *cms_Data_create(void);

CMS_ContentInfo *cms_DigestedData_create(const EVP_MD *md);
BIO *cms_DigestedData_init_bio(CMS_ContentInfo *cms);
int cms_DigestedData_do_final(CMS_ContentInfo *cms, BIO *chain, int verify);

BIO *cms_SignedData_init_bio(CMS_ContentInfo *cms);
int cms_SignedData_final(CMS_ContentInfo *cms, BIO *chain);
int cms_set1_SignerIdentifier(CMS_SignerIdentifier *sid, X509 *cert,
                              int type);
int cms_SignerIdentifier_get0_signer_id(CMS_SignerIdentifier *sid,
                                        ASN1_OCTET_STRING **keyid,
                                        X509_NAME **issuer,
                                        ASN1_INTEGER **sno);
int cms_SignerIdentifier_cert_cmp(CMS_SignerIdentifier *sid, X509 *cert);

CMS_ContentInfo *cms_CompressedData_create(int comp_nid);
BIO *cms_CompressedData_init_bio(CMS_ContentInfo *cms);

void cms_DigestAlgorithm_set(X509_ALGOR *alg, const EVP_MD *md);
BIO *cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm);
int cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain,
                                 X509_ALGOR *mdalg);

int cms_ias_cert_cmp(CMS_IssuerAndSerialNumber *ias, X509 *cert);
int cms_keyid_cert_cmp(ASN1_OCTET_STRING *keyid, X509 *cert);
int cms_set1_ias(CMS_IssuerAndSerialNumber **pias, X509 *cert);
int cms_set1_keyid(ASN1_OCTET_STRING **pkeyid, X509 *cert);

BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec);
BIO *cms_EncryptedData_init_bio(CMS_ContentInfo *cms);
int cms_EncryptedContent_init(CMS_EncryptedContentInfo *ec,
                              const EVP_CIPHER *cipher,
                              const unsigned char *key, size_t keylen);

int cms_Receipt_verify(CMS_ContentInfo *cms, CMS_ContentInfo *req_cms);
int cms_msgSigDigest_add1(CMS_SignerInfo *dest, CMS_SignerInfo *src);
ASN1_OCTET_STRING *cms_encode_Receipt(CMS_SignerInfo *si);

BIO *cms_EnvelopedData_init_bio(CMS_ContentInfo *cms);
CMS_EnvelopedData *cms_get0_enveloped(CMS_ContentInfo *cms);
int cms_env_asn1_ctrl(CMS_RecipientInfo *ri, int cmd);
int cms_pkey_get_ri_type(EVP_PKEY *pk);
/* KARI routines */
int cms_RecipientInfo_kari_init(CMS_RecipientInfo *ri, X509 *recip,
                                EVP_PKEY *pk, unsigned int flags);
int cms_RecipientInfo_kari_encrypt(CMS_ContentInfo *cms,
                                   CMS_RecipientInfo *ri);

/* PWRI routines */
int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
                                 int en_de);

#ifdef  __cplusplus
}
#endif
#endif


<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema

    Version 2.0

    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.

    Example:

    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>

    There are any number of "resheader" rows that contain simple
    name/value pairs.

    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.

    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:

    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.

    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <data name="SplitButtonSecondaryButtonName" xml:space="preserve">
    <value>Mais Opções</value>
    <comment>Automation name for the secondary button.</comment>
  </data>
</root>


---
title: LSet allowed only on strings and user-defined types
keywords: vblr6.chm1011214
f1_keywords:
- vblr6.chm1011214
ms.prod: office
ms.assetid: 6e641999-66f1-46fb-869f-369d3f5274b8
ms.date: 06/08/2017
localization_priority: Normal
---

# LSet allowed only on strings and user-defined types

 **LSet** is used to left align data within strings and [variables](../../Glossary/vbe-glossary.md#variable) of[user-defined type](../../Glossary/vbe-glossary.md#user-defined-type). This error has the following causes and solutions:

- The specified variable isn't a string or user-defined type. If you are trying to block assign one array to another, **LSet** does not work. You must use a loop to assign each element individually.

- You tried to use **LSet** with an object. **LSet** can also be used to assign the elements of a user-defined type variable to the elements of a different, but compatible, user-defined type. Although objects are similar to user-defined types, you can't use **LSet** on them. Similarly, you can't use **LSet** on variables of user-defined types that contain strings, objects, or variants.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

[!include[Support and feedback](~/includes/feedback-boilerplate.md)]


// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package ipv6

import (
	"net"

	"golang.org/x/net/internal/socket"
)

// BUG(mikio): On Windows, the ControlMessage for ReadFrom and WriteTo
// methods of PacketConn is not implemented.

// A payloadHandler represents the IPv6 datagram payload handler.
type payloadHandler struct {
	net.PacketConn
	*socket.Conn
	rawOpt
}

func (c *payloadHandler) ok() bool { return c != nil && c.PacketConn != nil && c.Conn != nil }


/***************************************************************************
Copyright (c) 2019, Xilinx, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

***************************************************************************/
/* SAD window size must be an odd number and it must be less than minimum of image height and width and less than the tested size '21' */

#define SAD_WINDOW_SIZE		5

/* NO_OF_DISPARITIES must be greater than '0' and less than the image width */

#define NO_OF_DISPARITIES	16

/* NO_OF_DISPARITIES must not be lesser than PARALLEL_UNITS and NO_OF_DISPARITIES/PARALLEL_UNITS must be a non-fractional number */

#define PARALLEL_UNITS		2

//#define XF_USE_URAM false


See [lexi-lambda/mtl-style-example.git](https://github.com/lexi-lambda/mtl-style-example/).