You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.7 KiB

25 years ago
  1. // Abstract class of integers.
  2. #ifndef _CL_INTEGER_CLASS_H
  3. #define _CL_INTEGER_CLASS_H
  4. #include "cl_number.h"
  5. #include "cl_rational_class.h"
  6. class cl_I : public cl_RA {
  7. public:
  8. // Default constructor.
  9. cl_I ();
  10. // Copy constructor.
  11. cl_I (const cl_I&);
  12. // Assignment operators.
  13. cl_I& operator= (const cl_I&);
  14. // Constructors and assignment operators from C numeric types.
  15. cl_I (const int); // |argument| must be < 2^29
  16. cl_I (const unsigned int); // argument must be < 2^29
  17. cl_I (const long);
  18. cl_I (const unsigned long);
  19. cl_I& operator= (const int); // |argument| must be < 2^29
  20. cl_I& operator= (const unsigned int); // argument must be < 2^29
  21. cl_I& operator= (const long);
  22. cl_I& operator= (const unsigned long);
  23. // Other constructors.
  24. cl_I (const char *);
  25. // Private constructor.
  26. cl_I (cl_private_thing);
  27. cl_I (struct cl_fixnum * /* NULL! */, cl_uint);
  28. cl_I (struct cl_heap_bignum *);
  29. public: // Ability to place an object at a given address.
  30. void* operator new (size_t size) { return cl_malloc_hook(size); }
  31. void* operator new (size_t size, cl_I* ptr) { (void)size; return ptr; }
  32. void operator delete (void* ptr) { cl_free_hook(ptr); }
  33. };
  34. // Private constructors.
  35. inline cl_I::cl_I (cl_private_thing ptr) : cl_RA (ptr) {}
  36. // The assignment operators:
  37. CL_DEFINE_ASSIGNMENT_OPERATOR(cl_I, cl_I)
  38. // The default constructors.
  39. inline cl_I::cl_I ()
  40. : cl_RA ((cl_private_thing) cl_combine(cl_FN_tag,0)) {}
  41. // The copy constructors.
  42. CL_DEFINE_COPY_CONSTRUCTOR2(cl_I,cl_RA)
  43. // Constructors and assignment operators from C numeric types.
  44. CL_DEFINE_INT_CONSTRUCTORS(cl_I)
  45. CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_I)
  46. CL_DEFINE_LONG_CONSTRUCTORS(cl_I)
  47. CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_I)
  48. #endif /* _CL_INTEGER_CLASS_H */