Exemple #1
0
void fxBuildError(txMachine* the)
{
	txSlot* slot;
	mxPush(mxObjectPrototype);
	slot = fxLastProperty(the, fxNewObjectInstance(the));
	slot = fxNextHostFunctionProperty(the, slot, fx_Error_toString, 0, mxID(_toLocaleString), XS_DONT_ENUM_FLAG);
	slot = fxNextHostFunctionProperty(the, slot, fx_Error_toString, 0, mxID(_toString), XS_DONT_ENUM_FLAG);
	slot = fxNextStringProperty(the, slot, "Error", mxID(_name), XS_DONT_ENUM_FLAG);
	slot = fxNextStringProperty(the, slot, "", mxID(_message), XS_DONT_ENUM_FLAG);
	mxErrorPrototype = *the->stack;
	fxNewHostConstructorGlobal(the, fx_Error, 0, mxID(_Error), XS_GET_ONLY);
	the->stack++;
	mxPush(mxErrorPrototype);
	slot = fxLastProperty(the, fxNewObjectInstance(the));
	slot = fxNextStringProperty(the, slot, "EvalError", mxID(_name), XS_DONT_ENUM_FLAG);
	mxEvalErrorPrototype = *the->stack;
	fxNewHostConstructorGlobal(the, fx_EvalError, 1, mxID(_EvalError), XS_GET_ONLY);
	the->stack++;
	mxPush(mxErrorPrototype);
	slot = fxLastProperty(the, fxNewObjectInstance(the));
	slot = fxNextStringProperty(the, slot, "RangeError", mxID(_name), XS_DONT_ENUM_FLAG);
	mxRangeErrorPrototype = *the->stack;
	fxNewHostConstructorGlobal(the, fx_RangeError, 1, mxID(_RangeError), XS_GET_ONLY);
	the->stack++;
	mxPush(mxErrorPrototype);
	slot = fxLastProperty(the, fxNewObjectInstance(the));
	slot = fxNextStringProperty(the, slot, "ReferenceError", mxID(_name), XS_DONT_ENUM_FLAG);
	mxReferenceErrorPrototype = *the->stack;
	fxNewHostConstructorGlobal(the, fx_ReferenceError, 1, mxID(_ReferenceError), XS_GET_ONLY);
	the->stack++;
	mxPush(mxErrorPrototype);
	slot = fxLastProperty(the, fxNewObjectInstance(the));
	slot = fxNextStringProperty(the, slot, "SyntaxError", mxID(_name), XS_DONT_ENUM_FLAG);
	mxSyntaxErrorPrototype = *the->stack;
	fxNewHostConstructorGlobal(the, fx_SyntaxError, 1, mxID(_SyntaxError), XS_GET_ONLY);
	the->stack++;
	mxPush(mxErrorPrototype);
	slot = fxLastProperty(the, fxNewObjectInstance(the));
	slot = fxNextStringProperty(the, slot, "TypeError", mxID(_name), XS_DONT_ENUM_FLAG);
	mxTypeErrorPrototype = *the->stack;
	fxNewHostConstructorGlobal(the, fx_TypeError, 1, mxID(_TypeError), XS_GET_ONLY);
	the->stack++;
	mxPush(mxErrorPrototype);
	slot = fxLastProperty(the, fxNewObjectInstance(the));
	slot = fxNextStringProperty(the, slot, "URIError", mxID(_name), XS_DONT_ENUM_FLAG);
	mxURIErrorPrototype = *the->stack;
	fxNewHostConstructorGlobal(the, fx_URIError, 1, mxID(_URIError), XS_GET_ONLY);
	the->stack++;
}
Exemple #2
0
void fxBuildBoolean(txMachine* the)
{
    static const txHostFunctionBuilder gx_Boolean_prototype_builders[] = {
		{ fx_Boolean_prototype_toString, 0, _toString },
		{ fx_Boolean_prototype_valueOf, 0, _valueOf },
 		{ C_NULL, 0, 0 },
   };
    const txHostFunctionBuilder* builder;
	txSlot* slot;
	mxPush(mxObjectPrototype);
	slot = fxLastProperty(the, fxNewBooleanInstance(the));
	for (builder = gx_Boolean_prototype_builders; builder->callback; builder++)
		slot = fxNextHostFunctionProperty(the, slot, builder->callback, builder->length, mxID(builder->id), XS_DONT_ENUM_FLAG);
	mxBooleanPrototype = *the->stack;
	fxNewHostConstructorGlobal(the, fx_Boolean, 1, mxID(_Boolean), XS_DONT_ENUM_FLAG);
	the->stack++;
}
Exemple #3
0
void fxBuildFunction(txMachine* the)
{
    static const txHostFunctionBuilder gx_Function_prototype_builders[] = {
        { fx_Function_prototype_apply, 2, _apply },
        { fx_Function_prototype_bind, 1, _bind },
        { fx_Function_prototype_call, 1, _call },
        { fx_Function_prototype_hasInstance, 1, _Symbol_hasInstance },
        { C_NULL, 0, 0 },
    };
    const txHostFunctionBuilder* builder;
    txSlot* slot;
    mxPush(mxFunctionPrototype);
    slot = fxLastProperty(the, the->stack->value.reference);
    slot = fxNextHostAccessorProperty(the, slot, fx_Function_prototype_get_length, fx_Function_prototype_set_length, mxID(_length), XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
    slot = fxNextHostAccessorProperty(the, slot, fx_Function_prototype_get_name, fx_Function_prototype_set_name, mxID(_name), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
    slot = fxNextHostAccessorProperty(the, slot, fx_Function_prototype_get_prototype, fx_Function_prototype_set_prototype, mxID(_prototype), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG);
    for (builder = gx_Function_prototype_builders; builder->callback; builder++)
        slot = fxNextHostFunctionProperty(the, slot, builder->callback, builder->length, mxID(builder->id), XS_DONT_ENUM_FLAG);
    slot = fxNextStringProperty(the, slot, "Function", mxID(_Symbol_toStringTag), XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
    slot = fxNewHostConstructorGlobal(the, fx_Function, 1, mxID(_Function), XS_GET_ONLY);
    the->stack++;
}
Exemple #4
0
void fxBuildSymbol(txMachine* the)
{
    static const txHostFunctionBuilder gx_Symbol_prototype_builders[] = {
        { fx_Symbol_prototype_toString, 0, _toString },
        { fx_Symbol_prototype_valueOf, 0, _valueOf },
        { C_NULL, 0, 0 },
    };
    static const txHostFunctionBuilder gx_Symbol_builders[] = {
        { fx_Symbol_for, 1, _for },
        { fx_Symbol_keyFor, 1, _keyFor },
        { C_NULL, 0, 0 },
    };
    const txHostFunctionBuilder* builder;
    txSlot* slot;
    mxPush(mxObjectPrototype);
    slot = fxLastProperty(the, fxNewSymbolInstance(the));
    for (builder = gx_Symbol_prototype_builders; builder->callback; builder++)
        slot = fxNextHostFunctionProperty(the, slot, builder->callback, builder->length, mxID(builder->id), XS_DONT_ENUM_FLAG);
    slot = fxNextHostFunctionProperty(the, slot, fx_Symbol_prototype_toPrimitive, 1, mxID(_Symbol_toPrimitive), XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
    slot = fxNextStringProperty(the, slot, "Symbol", mxID(_Symbol_toStringTag), XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
    mxSymbolPrototype = *the->stack;
    slot = fxLastProperty(the, fxNewHostConstructorGlobal(the, fx_Symbol, 0, mxID(_Symbol), XS_DONT_ENUM_FLAG));
    for (builder = gx_Symbol_builders; builder->callback; builder++)
        slot = fxNextHostFunctionProperty(the, slot, builder->callback, builder->length, mxID(builder->id), XS_DONT_ENUM_FLAG);
    slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_hasInstance), mxID(_hasInstance), XS_GET_ONLY);
    slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_isConcatSpreadable), mxID(_isConcatSpreadable), XS_GET_ONLY);
    slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_iterator), mxID(_iterator), XS_GET_ONLY);
    slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_match), mxID(_match), XS_GET_ONLY);
    slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_replace), mxID(_replace), XS_GET_ONLY);
    slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_search), mxID(_search), XS_GET_ONLY);
    slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_species), mxID(_species), XS_GET_ONLY);
    slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_split), mxID(_split), XS_GET_ONLY);
    slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_toPrimitive), mxID(_toPrimitive), XS_GET_ONLY);
    slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_toStringTag), mxID(_toStringTag), XS_GET_ONLY);
    slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_unscopables), mxID(_unscopables), XS_GET_ONLY);
    the->stack++;
}
Exemple #5
0
void fxBuildDate(txMachine* the)
{
    static const txHostFunctionBuilder gx_Date_prototype_builders[] = {
		{ fx_Date_prototype_getMilliseconds, 0, _getMilliseconds },
		{ fx_Date_prototype_getSeconds, 0, _getSeconds },
		{ fx_Date_prototype_getMinutes, 0, _getMinutes },
		{ fx_Date_prototype_getHours, 0, _getHours },
		{ fx_Date_prototype_getDay, 0, _getDay },
		{ fx_Date_prototype_getDate, 0, _getDate },
		{ fx_Date_prototype_getMonth, 0, _getMonth },
		{ fx_Date_prototype_getYear, 0, _getYear },
		{ fx_Date_prototype_getFullYear, 0, _getFullYear },
		{ fx_Date_prototype_getUTCMilliseconds, 0, _getUTCMilliseconds },
		{ fx_Date_prototype_getUTCSeconds, 0, _getUTCSeconds },
		{ fx_Date_prototype_getUTCMinutes, 0, _getUTCMinutes },
		{ fx_Date_prototype_getUTCHours, 0, _getUTCHours },
		{ fx_Date_prototype_getUTCDay, 0, _getUTCDay },
		{ fx_Date_prototype_getUTCDate, 0, _getUTCDate },
		{ fx_Date_prototype_getUTCMonth, 0, _getUTCMonth },
		{ fx_Date_prototype_getUTCFullYear, 0, _getUTCFullYear },
		{ fx_Date_prototype_valueOf, 0, _getTime },
		{ fx_Date_prototype_getTimezoneOffset, 0, _getTimezoneOffset },
		{ fx_Date_prototype_setMilliseconds, 1, _setMilliseconds },
		{ fx_Date_prototype_setSeconds, 1, _setSeconds },
		{ fx_Date_prototype_setMinutes, 1, _setMinutes },
		{ fx_Date_prototype_setHours, 1, _setHours },
		{ fx_Date_prototype_setDate, 1, _setDate },
		{ fx_Date_prototype_setMonth, 1, _setMonth },
		{ fx_Date_prototype_setYear, 1, _setYear },
		{ fx_Date_prototype_setFullYear, 1, _setFullYear },
		{ fx_Date_prototype_setTime, 1, _setTime },
		{ fx_Date_prototype_setUTCMilliseconds, 1, _setUTCMilliseconds },
		{ fx_Date_prototype_setUTCSeconds, 1, _setUTCSeconds },
		{ fx_Date_prototype_setUTCMinutes, 1, _setUTCMinutes },
		{ fx_Date_prototype_setUTCHours, 1, _setUTCHours },
		{ fx_Date_prototype_setUTCDate, 1, _setUTCDate },
		{ fx_Date_prototype_setUTCMonth, 1, _setUTCMonth },
		{ fx_Date_prototype_setUTCFullYear, 1, _setUTCFullYear },
		{ fx_Date_prototype_toDateString, 0, _toDateString },
		{ fx_Date_prototype_toUTCString, 0, _toGMTString },
		{ fx_Date_prototype_toISOString, 0, _toISOString },
		{ fx_Date_prototype_toJSON, 1, _toJSON },
		{ fx_Date_prototype_toDateString, 0, _toLocaleDateString },
		{ fx_Date_prototype_toString, 0, _toLocaleString },
		{ fx_Date_prototype_toTimeString, 0, _toLocaleTimeString },
		{ fx_Date_prototype_toPrimitive, 0, _Symbol_toPrimitive },
		{ fx_Date_prototype_toString, 0, _toString },
		{ fx_Date_prototype_toTimeString, 0, _toTimeString },
		{ fx_Date_prototype_toUTCString, 0, _toUTCString },
		{ fx_Date_prototype_valueOf, 0, _valueOf },
		{ C_NULL, 0, 0 },
    };
    static const txHostFunctionBuilder gx_Date_builders[] = {
		{ fx_Date_now, 0, _now },
		{ fx_Date_parse, 1, _parse },
		{ fx_Date_UTC, 2, _UTC },
		{ C_NULL, 0, 0 },
    };
    const txHostFunctionBuilder* builder;
	txSlot* slot;
	txTimeDescription td;
	mxPush(mxObjectPrototype);
	slot = fxLastProperty(the, fxNewDateInstance(the));
	for (builder = gx_Date_prototype_builders; builder->callback; builder++)
		slot = fxNextHostFunctionProperty(the, slot, builder->callback, builder->length, mxID(builder->id), XS_DONT_ENUM_FLAG);
	slot = fxNextStringProperty(the, slot, "Date", mxID(_Symbol_toStringTag), XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	mxDatePrototype = *the->stack;
	slot = fxLastProperty(the, fxNewHostConstructorGlobal(the, fx_Date, 1, mxID(_Date), XS_GET_ONLY));
	for (builder = gx_Date_builders; builder->callback; builder++)
		slot = fxNextHostFunctionProperty(the, slot, builder->callback, builder->length, mxID(builder->id), XS_DONT_ENUM_FLAG);
	the->stack++;
	c_memset(&td, 0, sizeof(txTimeDescription));
    td.tm.tm_mday = 2;
    td.tm.tm_year = 70;
	td.tm.tm_isdst = -1;
	gxDeltaTime = 1000.0 * ((long)c_mktime(&(td.tm)) - (24L * 3600L));
	gxMaxTime = TIME_2100; //extend from LONG_MAX to this number to support year upto 2099
	gxMinTime = LONG_MIN;
}
Exemple #6
0
void fxBuildArray(txMachine* the)
{
    static const txHostFunctionBuilder gx_Array_prototype_builders[] = {
		{ fx_Array_prototype_concat, 1, _concat },
		{ fx_Array_prototype_copyWithin, 2, _copyWithin },
		{ fx_Array_prototype_entries, 0, _entries },
		{ fx_Array_prototype_every, 1, _every },
		{ fx_Array_prototype_fill, 1, _fill },
		{ fx_Array_prototype_filter, 1, _filter },
		{ fx_Array_prototype_find, 1, _find },
		{ fx_Array_prototype_findIndex, 1, _findIndex },
		{ fx_Array_prototype_forEach, 1, _forEach },
		{ fx_Array_prototype_indexOf, 1, _indexOf },
		{ fx_Array_prototype_join, 1, _join },
		{ fx_Array_prototype_keys, 0, _keys },
		{ fx_Array_prototype_lastIndexOf, 1, _lastIndexOf },
		{ fx_Array_prototype_map, 1, _map },
		{ fx_Array_prototype_pop, 0, _pop },
		{ fx_Array_prototype_push, 1, _push },
		{ fx_Array_prototype_reduce, 1, _reduce },
		{ fx_Array_prototype_reduceRight, 1, _reduceRight },
		{ fx_Array_prototype_reverse, 0, _reverse },
		{ fx_Array_prototype_shift, 0, _shift },
		{ fx_Array_prototype_slice, 2, _slice },
		{ fx_Array_prototype_some, 1, _some },
		{ fx_Array_prototype_sort, 1, _sort },
		{ fx_Array_prototype_splice, 2, _splice },
		{ fx_Array_prototype_join, 0, _toString },
		{ fx_Array_prototype_join, 0, _toLocaleString },
		{ fx_Array_prototype_unshift, 1, _unshift },
		{ fx_Array_prototype_values, 0, _values },
		{ fx_Array_prototype_values, 0, _Symbol_iterator },
		{ C_NULL, 0, 0 },
    };
    static const txHostFunctionBuilder gx_Array_builders[] = {
		{ fx_Array_from, 1, _from },
		{ fx_Array_isArray, 1, _isArray },
		{ fx_Array_of, 1, _of },
		{ C_NULL, 0, 0 },
    };
    const txHostFunctionBuilder* builder;
	txSlot* slot;
	txSlot* unscopable;
	mxPush(mxObjectPrototype);
	slot = fxLastProperty(the, fxNewArrayInstance(the));
	slot = fxNextHostAccessorProperty(the, slot, fx_Array_prototype_length_get, fx_Array_prototype_length_set, mxID(_length), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG);
	for (builder = gx_Array_prototype_builders; builder->callback; builder++)
		slot = fxNextHostFunctionProperty(the, slot, builder->callback, builder->length, mxID(builder->id), XS_DONT_ENUM_FLAG);
	slot = fxNextBooleanProperty(the, slot, 1, mxID(_Symbol_isConcatSpreadable), XS_DONT_ENUM_FLAG);
	slot = fxNextStringProperty(the, slot, "Array", mxID(_Symbol_toStringTag), XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	mxPush(mxObjectPrototype);
	unscopable = fxLastProperty(the, fxNewObjectInstance(the));
	unscopable = fxNextBooleanProperty(the, unscopable, 1, mxID(_find), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	unscopable = fxNextBooleanProperty(the, unscopable, 1, mxID(_findIndex), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	unscopable = fxNextBooleanProperty(the, unscopable, 1, mxID(_fill), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	unscopable = fxNextBooleanProperty(the, unscopable, 1, mxID(_copyWithin), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	unscopable = fxNextBooleanProperty(the, unscopable, 1, mxID(_entries), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	unscopable = fxNextBooleanProperty(the, unscopable, 1, mxID(_keys), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	unscopable = fxNextBooleanProperty(the, unscopable, 1, mxID(_values), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	slot = fxNextSlotProperty(the, slot, the->stack++, mxID(_Symbol_unscopables), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	mxArrayPrototype = *the->stack;
	slot = fxLastProperty(the, fxNewHostConstructorGlobal(the, fx_Array, 1, mxID(_Array), XS_GET_ONLY));
	for (builder = gx_Array_builders; builder->callback; builder++)
		slot = fxNextHostFunctionProperty(the, slot, builder->callback, builder->length, mxID(builder->id), XS_DONT_ENUM_FLAG);
	slot = fxNextHostAccessorProperty(the, slot, fx_species_get, C_NULL, mxID(_Symbol_species), XS_DONT_ENUM_FLAG);
	the->stack++;
	
	mxPush(mxIteratorPrototype);
	slot = fxLastProperty(the, fxNewObjectInstance(the));
	slot = fxNextHostFunctionProperty(the, slot, fx_Array_prototype_entries_next, 0, mxID(_next), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG);
	slot = fxNextStringProperty(the, slot, "Array Iterator", mxID(_Symbol_toStringTag), XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	mxPull(mxArrayEntriesIteratorPrototype);
	mxPush(mxIteratorPrototype);
	slot = fxLastProperty(the, fxNewObjectInstance(the));
	slot = fxNextHostFunctionProperty(the, slot, fx_Array_prototype_keys_next, 0, mxID(_next), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG);
	slot = fxNextStringProperty(the, slot, "Array Iterator", mxID(_Symbol_toStringTag), XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	mxPull(mxArrayKeysIteratorPrototype);
	mxPush(mxIteratorPrototype);
	slot = fxLastProperty(the, fxNewObjectInstance(the));
	slot = fxNextHostFunctionProperty(the, slot, fx_Array_prototype_values_next, 0, mxID(_next), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG);
	slot = fxNextStringProperty(the, slot, "Array Iterator", mxID(_Symbol_toStringTag), XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	mxPull(mxArrayValuesIteratorPrototype);
	
	mxPush(mxObjectPrototype);
	slot = fxLastProperty(the, fxNewObjectInstance(the));
	slot = fxNextStringProperty(the, slot, "Arguments", mxID(_Symbol_toStringTag), XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	mxParametersPrototype = *the->stack;
	the->stack++;
	
	mxPush(mxObjectPrototype);
	slot = fxLastProperty(the, fxNewObjectInstance(the));
	slot = fxNextHostAccessorProperty(the, slot, fx_Arguments_prototype_callee, fx_Arguments_prototype_callee, mxID(_callee), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	slot = fxNextHostAccessorProperty(the, slot, fx_Arguments_prototype_caller, fx_Arguments_prototype_caller, mxID(_caller), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	slot = fxNextHostFunctionProperty(the, slot, fx_Array_prototype_values, 0, mxID(_Symbol_iterator), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG);
	slot = fxNextStringProperty(the, slot, "Arguments", mxID(_Symbol_toStringTag), XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	mxArgumentsStrictPrototype = *the->stack;
	the->stack++;
}
Exemple #7
0
void fxBuildNumber(txMachine* the)
{
    static const txHostFunctionBuilder gx_global_builders[] = {
		{ fx_isFinite, 1, _isFinite },
		{ fx_isNaN, 1, _isNaN },
		{ fx_parseFloat, 1, _parseFloat },
		{ fx_parseInt, 2, _parseInt },
		{ C_NULL, 0, 0 },
    };
  	static const txHostFunctionBuilder gx_Number_prototype_builders[] = {
		{ fx_Number_prototype_toExponential, 1, _toExponential },
		{ fx_Number_prototype_toFixed, 1, _toFixed },
		{ fx_Number_prototype_toString, 0, _toLocaleString },
		{ fx_Number_prototype_toPrecision, 1, _toPrecision },
		{ fx_Number_prototype_toString, 1, _toString },
		{ fx_Number_prototype_valueOf, 0, _valueOf },
		{ C_NULL, 0, 0 },
    };
    static const txHostFunctionBuilder gx_Number_builders[] = {
		{ fx_Number_isFinite, 1, _isFinite },
		{ fx_Number_isInteger, 1, _isInteger },
		{ fx_Number_isNaN, 1, _isNaN },
		{ fx_Number_isSafeInteger, 1, _isSafeInteger },
		{ fx_parseFloat, 1, _parseFloat },
		{ fx_parseInt, 1, _parseInt },
		{ C_NULL, 0, 0 },
    };
	const txHostFunctionBuilder* builder;
	txSlot* slot;
	
	for (builder = gx_global_builders; builder->callback; builder++) {
		fxNewHostFunctionGlobal(the, builder->callback, builder->length, mxID(builder->id), XS_DONT_ENUM_FLAG);
		the->stack++;
	}
	slot = fxSetGlobalProperty(the, mxGlobal.value.reference, mxID(_Infinity), C_NULL);
	slot->flag = XS_GET_ONLY;
	slot->kind = XS_NUMBER_KIND;
	slot->value.number = (txNumber)C_INFINITY;
	slot = fxSetGlobalProperty(the, mxGlobal.value.reference, mxID(_NaN), C_NULL);
	slot->flag = XS_GET_ONLY;
	slot->kind = XS_NUMBER_KIND;
	slot->value.number = C_NAN;

	mxPush(mxObjectPrototype);
	slot = fxLastProperty(the, fxNewNumberInstance(the));
	for (builder = gx_Number_prototype_builders; builder->callback; builder++)
		slot = fxNextHostFunctionProperty(the, slot, builder->callback, builder->length, mxID(builder->id), XS_DONT_ENUM_FLAG);
	mxNumberPrototype = *the->stack;
	slot = fxLastProperty(the, fxNewHostConstructorGlobal(the, fx_Number, 1, mxID(_Number), XS_DONT_ENUM_FLAG));
	for (builder = gx_Number_builders; builder->callback; builder++)
		slot = fxNextHostFunctionProperty(the, slot, builder->callback, builder->length, mxID(builder->id), XS_DONT_ENUM_FLAG);
	slot = fxNextNumberProperty(the, slot, C_EPSILON, mxID(_EPSILON), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	slot = fxNextNumberProperty(the, slot, C_MAX_SAFE_INTEGER, mxID(_MAX_SAFE_INTEGER), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	slot = fxNextNumberProperty(the, slot, C_DBL_MAX, mxID(_MAX_VALUE), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	slot = fxNextNumberProperty(the, slot, C_MIN_SAFE_INTEGER, mxID(_MIN_SAFE_INTEGER), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	slot = fxNextNumberProperty(the, slot, C_DBL_MIN, mxID(_MIN_VALUE), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	slot = fxNextNumberProperty(the, slot, C_NAN, mxID(_NaN), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	slot = fxNextNumberProperty(the, slot, -((txNumber)C_INFINITY), mxID(_NEGATIVE_INFINITY), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	slot = fxNextNumberProperty(the, slot, (txNumber)C_INFINITY, mxID(_POSITIVE_INFINITY), XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
	the->stack++;
}