home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / SHSUCD11.ZIP / TYPES.ADS < prev    next >
Encoding:
Text File  |  1995-06-29  |  2.5 KB  |  63 lines

  1. --************************************************************************
  2. --
  3. --  TYPES.ADS               Version 3.0
  4. --
  5. --  A copyright-reserved, free use program.
  6. --  (c)John H. McCoy, 1994, 1995, Sam Houston St. Univ., TX 77341-2206
  7. --************************************************************************
  8.  
  9. with system, memory;
  10. with calendar;
  11. with unchecked_conversion, unchecked_deallocation;
  12.  
  13. package Types is
  14.  
  15. type byte is range 0..255;
  16. type word is range 0..65_535;
  17.  
  18. --  The following types and functions are declared for use instead of
  19. --  words, and system.address to avoid "alignment holes" in record
  20. --  declarations.  This may not be a problem with other than Meridian's
  21. --  implementation fo ADA.
  22.  
  23. type bytes is array (word range <>) of byte;
  24. type words is array (word range <>) of word;
  25. subtype  W is bytes(1..2);
  26. subtype DW is bytes(1..4);
  27. function W_to_Word is new unchecked_conversion(W, Word);
  28. function DW_to_SA is new unchecked_conversion(DW, system.address);
  29. function DW_to_Long is new unchecked_conversion(DW, Long_Integer);
  30. function Word_to_W is new unchecked_conversion(Word, W);
  31. function SA_to_DW is new unchecked_conversion(system.address, DW);
  32. function Long_to_DW is new unchecked_conversion(Long_Integer, DW);
  33.  
  34. type bytesAccess is access bytes;
  35. function SA_to_BytesAccess is new unchecked_conversion(system.address, bytesAccess);
  36. function BytesAccess_to_SA is new unchecked_conversion(bytesAccess, system.address);
  37. function DW_to_BytesAccess is new unchecked_conversion(DW, bytesAccess);
  38. function BytesAccess_to_DW is new unchecked_conversion(bytesAccess, DW);
  39. procedure ZapBytes is new unchecked_deallocation(bytes,bytesAccess);
  40. function bytes_to_string is new unchecked_conversion(bytes, string);
  41. function string_to_bytes is new unchecked_conversion(string, bytes);
  42.  
  43.  
  44. subtype string5  is string(1..5);
  45. subtype string8  is string(1..8);
  46. subtype string11 is string(1..11);
  47. subtype string16 is string(1..16);
  48.  
  49.  
  50. function "+"(left, right: byte) return byte;
  51. function "OR"(left, right: byte) return byte;
  52. function "AND"(left, right: byte) return byte;
  53. function "+"(left, right: word) return word;
  54. function "OR"(left, right: word) return word;
  55. function "AND"(left, right: word) return word;
  56. function "+"(left, right: W) return W;
  57. function "OR"(left, right: W) return W;
  58. function "AND"(left, right: W) return W;
  59.  
  60. function TOD (Date: calendar.time) return string5;
  61. function MDY (Date: calendar.time) return string8;
  62.  
  63. end Types;