// See: http://duktape.org/api.html#duk_put_prop_index
503600
func (d *Context) PutPropIndex(objIndex int, arrIndex uint) bool {
	return int(C.duk_put_prop_index(d.duk_context, C.duk_idx_t(objIndex), C.duk_uarridx_t(arrIndex))) == 1
}
1143781
func (d *Context) Copy(fromIndex int, toIndex int) {
	C.duk_copy(d.duk_context, C.duk_idx_t(fromIndex), C.duk_idx_t(toIndex))
}
1142904
func (eng *engine) AddIndex(index Index) {
	tableName := index.TableMeta().Name()
	idx, ok := eng.indexes[tableName]
	if !ok {
		idx = make(map[string]Index)
		eng.indexes[tableName] = idx
	}
	indexName := index.Name()
	if _, exist := idx[indexName]; exist {
		panic("index " + indexName + " existed on table " + tableName)
	}
	idx[indexName] = index
}
958940
func (d *Context) Remove(index int) {
	C.duk_remove(d.duk_context, C.duk_idx_t(index))
}
790582
func PutPropertyRef(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT, err error) {
	return disp.InvokeWithOptionalArgs(name, ole.DISPATCH_PROPERTYPUTREF, params)
}
1141721
func (d *Context) ToInt(index int) int {
	return int(C.duk_to_int(d.duk_context, C.duk_idx_t(index)))
}
66473
func (d *Context) Swap(index1 int, index2 int) {
	C.duk_swap(d.duk_context, C.duk_idx_t(index1), C.duk_idx_t(index2))
}
1371132
func (d *Context) Insert(toIndex int) {
	C.duk_insert(d.duk_context, C.duk_idx_t(toIndex))
}
1160350
func (d decl) indexOfReplacementStart(idents []string) int {

	l := len(idents)

	if l == 0 {
		return -1
	}

	if l == 1 {
		first := idents[0]
		if first == "" || first == paramsIdentifier || first[0] == '$' {
			// This can not be a Params.x
			return -1
		}
	}

	var lookFurther bool
	var needsVarExpansion bool
	for _, ident := range idents {
		if ident[0] == '$' {
			lookFurther = true
			needsVarExpansion = true
			break
		} else if ident == paramsIdentifier {
			lookFurther = true
			break
		}
	}

	if !lookFurther {
		return -1
	}

	var resolvedIdents []string

	if !needsVarExpansion {
		resolvedIdents = idents
	} else {
		var ok bool
		resolvedIdents, ok = d.resolveVariables(idents)
		if !ok {
			return -1
		}
	}

	var paramFound bool
	for i, ident := range resolvedIdents {
		if ident == paramsIdentifier {
			if i > 0 {
				container := resolvedIdents[i-1]
				if reservedContainers[container] {
					// .Data.Params.someKey
					return -1
				}
			}

			paramFound = true
			break
		}
	}

	if !paramFound {
		return -1
	}

	var paramSeen bool
	idx := -1
	for i, ident := range idents {
		if ident == "" || ident[0] == '$' {
			continue
		}

		if ident == paramsIdentifier {
			paramSeen = true
			idx = -1

		} else {
			if paramSeen {
				return i
			}
			if idx == -1 {
				idx = i
			}
		}
	}
	return idx

}
23151
func (d *Context) PcallProp(objIndex int, nargs int) int {
	return int(C.duk_pcall_prop(d.duk_context, C.duk_idx_t(objIndex), C.duk_idx_t(nargs)))
}
1053418
func (d *Context) NormalizeIndex(index int) int {
	return int(C.duk_normalize_index(d.duk_context, C.duk_idx_t(index)))
}
1636
func (g *Group) IndexFunc(f func(*Group)) *Statement {
	s := IndexFunc(f)
	g.items = append(g.items, s)
	return s
}
895407
func setIndex(resp http.ResponseWriter, index uint64) {
	resp.Header().Set("X-Nomad-Index", strconv.FormatUint(index, 10))
}
814012
func (fs *FSObjects) PutObject(ctx context.Context, bucket string, object string, r *PutObjReader, opts ObjectOptions) (objInfo ObjectInfo, retErr error) {
	if err := checkPutObjectArgs(ctx, bucket, object, fs, r.Size()); err != nil {
		return ObjectInfo{}, err
	}
	// Lock the object.
	objectLock := fs.nsMutex.NewNSLock(bucket, object)
	if err := objectLock.GetLock(globalObjectTimeout); err != nil {
		logger.LogIf(ctx, err)
		return objInfo, err
	}
	defer objectLock.Unlock()
	return fs.putObject(ctx, bucket, object, r, opts)
}
1169700
func (d *Context) Pcompile(flags uint) error {
	result := int(C._duk_pcompile(d.duk_context, C.duk_uint_t(flags)))
	return d.castStringToError(result)
}
147206
func (d *Context) Replace(toIndex int) {
	C.duk_replace(d.duk_context, C.duk_idx_t(toIndex))
}
1341680
func (v *IDispatch) PutProperty(name string, params ...interface{}) (*VARIANT, error) {
	return v.InvokeWithOptionalArgs(name, DISPATCH_PROPERTYPUT, params)
}