Subversion Repositories pentevo

Rev

Blame | Last modification | View Log | Download | RSS feed | ?url?

  1. #ifndef _TEMPRESULT_H
  2. #define _TEMPRESULT_H
  3. /* tempresult.h */
  4. /*****************************************************************************/
  5. /* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only                     */
  6. /*                                                                           */
  7. /* AS-Portierung                                                             */
  8. /*                                                                           */
  9. /* internal holder for int/float/string                                      */
  10. /*                                                                           */
  11. /*****************************************************************************/
  12.  
  13. #include <stddef.h>
  14.  
  15. #include "datatypes.h"
  16. #include "nonzstring.h"
  17. #include "symflags.h"
  18. #include "symbolsize.h"
  19.  
  20. typedef enum
  21. {
  22.   TempNone = 0,
  23.   TempInt = 1,
  24.   TempFloat = 2,
  25.   TempString = 4,
  26.   TempReg = 8,
  27.   TempAll = 15
  28. } TempType;
  29.  
  30. struct sRelocEntry;
  31. struct as_dynstr;
  32.  
  33. typedef unsigned tRegInt;
  34.  
  35. typedef void (*DissectRegProc)(
  36. #ifdef __PROTOS__
  37. char *pDest, size_t DestSize, tRegInt Value, tSymbolSize InpSize
  38. #endif
  39. );
  40.  
  41. typedef int (*compare_reg_fnc_t)(
  42. #ifdef __PROTOS__
  43. tRegInt value1, tSymbolSize reg_size1, tRegInt value2, tSymbolSize reg_size2
  44. #endif
  45. );
  46.  
  47. /*
  48.  * Used in register's number to signify a built in alternate name
  49.  * for the same register, e.g. SP=A7 on 68K.  Registers will compare
  50.  * equal, but will be printed with individual name in the symbol table:
  51.  */
  52.  
  53. #define REGSYM_FLAG_ALIAS 0x80
  54.  
  55. typedef struct sRegDescr
  56. {
  57.   DissectRegProc Dissect;
  58.   compare_reg_fnc_t compare;
  59.   tRegInt Reg;
  60. } tRegDescr;
  61.  
  62. struct sTempResult
  63. {
  64.   TempType Typ;
  65.   tSymbolFlags Flags;
  66.   unsigned AddrSpaceMask;
  67.   tSymbolSize DataSize;
  68.   struct sRelocEntry *Relocs;
  69.   union
  70.   {
  71.     LargeInt Int;
  72.     Double Float;
  73.     as_nonz_dynstr_t str;
  74.     tRegDescr RegDescr;
  75.   } Contents;
  76. };
  77. typedef struct sTempResult TempResult;
  78.  
  79. extern void as_tempres_ini(TempResult *p_res);
  80.  
  81. extern void as_tempres_free(TempResult *p_res);
  82.  
  83. extern void as_tempres_set_none(TempResult *p_res);
  84.  
  85. extern void as_tempres_set_int(TempResult *p_res, LargeInt value);
  86.  
  87. extern void as_tempres_set_float(TempResult *p_res, Double value);
  88.  
  89. extern void as_tempres_set_str(TempResult *p_res, const as_nonz_dynstr_t *p_value);
  90.  
  91. extern void as_tempres_set_str_raw(TempResult *p_res, const char *p_value, size_t len);
  92.  
  93. extern void as_tempres_set_c_str(TempResult *p_res, const char *p_value);
  94.  
  95. extern void as_tempres_set_reg(TempResult *p_res, const tRegDescr *p_value);
  96.  
  97. void as_tempres_copy_value(TempResult *p_dest, const TempResult *p_src);
  98.  
  99. extern void as_tempres_copy(TempResult *p_dest, const TempResult *p_src);
  100.  
  101. extern int as_tempres_cmp(const TempResult *p_res1, const TempResult *p_res2);
  102.  
  103. extern int TempResultToFloat(TempResult *pResult);
  104.  
  105. extern int as_tempres_append_dynstr(struct as_dynstr *p_dest, const TempResult *pResult);
  106.  
  107. #endif /* _TEMPRESULT_H */
  108.