numbers.h File Reference

Go to the source code of this file.

Classes

class   Double
class   Integer
class   Integer64
class   IntegerPtr

Defines

#define  FLOAT_CACHE_SIZE   1024
#define  DOUBLE_CACHE_SIZE   512
#define  INT_CACHE_SIZE   512
#define  INT64_CACHE_SIZE   128
#define  LOW_INT_RANGE   100
#define  is_integer_number(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Integer) || (v)->tag == class_tag(Integer64) || (v)->tag == class_tag(IntegerPtr))
#define  is_float_number(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Float) || (v)->tag == class_tag(Double))
#define  is_number(o)   (is_integer_number(o) || is_float_number(o))
#define  is_double(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Double))
#define  is_integer(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Integer))
#define  is_integer64(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Integer64))
#define  is_integerptr(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(IntegerPtr))
#define  is_float(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Float))
#define  is_double(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Double))
#define  is_int(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Integer))
#define  is_int64(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Integer64))
#define  is_intptr(v)   ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(IntegerPtr))

Functions

  visible_class_debug_ok (Number) class Number
  applyable_class_debug_ok (Float) applyable_class_debug_ok(Double) applyable_class_debug_ok(Integer) applyable_class_debug_ok(Integer64) applyable_class_debug_ok(IntegerPtr) class Float

Variables

Float *  float_cache []
Double double_cache []
Integer int_cache []
Integer64 int64_cache []

Define Documentation

#define FLOAT_CACHE_SIZE   1024

Definition at line 21 of file numbers.h.

#define DOUBLE_CACHE_SIZE   512

Definition at line 22 of file numbers.h.

#define INT_CACHE_SIZE   512

Definition at line 23 of file numbers.h.

#define INT64_CACHE_SIZE   128

Definition at line 24 of file numbers.h.

#define LOW_INT_RANGE   100

Definition at line 25 of file numbers.h.

#define is_integer_number (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Integer) || (v)->tag == class_tag(Integer64) || (v)->tag == class_tag(IntegerPtr))
#define is_float_number (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Float) || (v)->tag == class_tag(Double))
#define is_number (   o )    (is_integer_number(o) || is_float_number(o))
#define is_double (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Double))

Definition at line 124 of file numbers.h.

#define is_integer (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Integer))
#define is_integer64 (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Integer64))
#define is_integerptr (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(IntegerPtr))
#define is_float (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Float))
#define is_double (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Double))

Definition at line 124 of file numbers.h.

#define is_int (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Integer))

Definition at line 167 of file numbers.h.

#define is_int64 (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Integer64))

Definition at line 206 of file numbers.h.

#define is_intptr (   v )    ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(IntegerPtr))

Definition at line 250 of file numbers.h.


Function Documentation

visible_class_debug_ok ( Number  )

Define an equal operator (i.e. '==') for maxscript visible values.

Define a NOT equal operator (i.e. '!=') for maxscript visible values.

Definition at line 32 of file numbers.h.

             : public Value
{
public:
#  define  is_integer_number(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Integer) || (v)->tag == class_tag(Integer64) || (v)->tag == class_tag(IntegerPtr))
#  define  is_float_number(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Float) || (v)->tag == class_tag(Double))
#  define  is_number(o) (is_integer_number(o) || is_float_number(o))
            classof_methods (Number, Value);

    static   Value* read(MCHAR* str, bool heapAlloc = false);
    static   void setup();

#include "..\macros\define_implementations.h"
    def_generic( coerce, "coerce");
    def_generic( copy,   "copy");
};
applyable_class_debug_ok ( Float  )

Define an equal operator (i.e. '==') for maxscript visible values.

Define a NOT equal operator (i.e. '!=') for maxscript visible values.

Definition at line 50 of file numbers.h.

            : public Number
{
public:
    float value;

    ENABLE_STACK_ALLOCATE(Float);

                   Float() { }
    ScripterExport Float(float init_val);

    static ScripterExport Value* intern(float init_val) { return new Float (init_val); }  // hey!! no longer interns, stack alloc'd instead
    static ScripterExport Value* heap_intern(float init_val);

    classof_methods (Float, Number);
#  define  is_float(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == class_tag(Float))
    void  collect() { delete this; }
    ScripterExport void  sprin1(CharStream* s);

    /* include all the protocol declarations */

#include "..\macros\define_implementations.h"
#  include "..\protocols\math.inl"

    float    to_float() { return value; }
    double   to_double() { return static_cast<double>(value); }
    int      to_int();
    INT64    to_int64() { return static_cast<INT64>(value); }
    INT_PTR  to_intptr()
    {
#ifndef _WIN64
        return to_int();
#else
        return to_int64();
#endif
    }
    TimeValue to_timevalue() { return (TimeValue)(value * GetTicksPerFrame()); }  // numbers used as times are in frames
    void  to_fpvalue(FPValue& v) { v.f = to_float(); v.type = (ParamType2)TYPE_FLOAT; }

    Value*   widen_to(Value* arg, Value** arg_list);
    BOOL  comparable(Value* arg) { return (is_number(arg) || is_time(arg)); }

    // scene I/O 
    IOResult Save(ISave* isave);
    static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};

Variable Documentation