Subversion Repositories pentevo

Rev

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

  1. #ifndef _STRCOMP_H
  2. #define _STRCOMP_H
  3. /* strcomp.h */
  4. /*****************************************************************************/
  5. /* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only                     */
  6. /*                                                                           */
  7. /* Macro Assembler AS                                                        */
  8. /*                                                                           */
  9. /* Definition of a source line's component present after parsing             */
  10. /*                                                                           */
  11. /*****************************************************************************/
  12.  
  13. #include <stddef.h>
  14. #include "dynstr.h"
  15.  
  16. typedef char *StringPtr;
  17.  
  18. struct sLineComp
  19. {
  20.   int StartCol;
  21.   unsigned Len;
  22. };
  23. typedef struct sLineComp tLineComp;
  24.  
  25. struct sStrComp
  26. {
  27.   tLineComp Pos;
  28.   as_dynstr_t str;
  29. };
  30. typedef struct sStrComp tStrComp;
  31.  
  32. extern void StrCompAlloc(tStrComp *pComp, size_t Capacity);
  33. extern void StrCompFree(tStrComp *pComp);
  34.  
  35. extern void StrCompReset(tStrComp *pComp);
  36. extern void LineCompReset(tLineComp *pComp);
  37.  
  38. extern void StrCompMkTemp(tStrComp *pComp, char *pStr, size_t Capacity);
  39.  
  40. extern void StrCompRefRight(tStrComp *pDest, const tStrComp *pSrc, size_t StartOffs);
  41.  
  42. extern void StrCompCopy(tStrComp *pDest, const tStrComp *pSrc);
  43.  
  44. extern void StrCompCopySub(tStrComp *pDest, const tStrComp *pSrc, size_t Start, size_t Count);
  45.  
  46. extern void StrCompSplitRight(tStrComp *pSrc, tStrComp *pDest, char *pSrcSplitPos);
  47.  
  48. extern void StrCompSplitLeft(tStrComp *pSrc, tStrComp *pDest, char *pSrcSplitPos);
  49.  
  50. extern void StrCompSplitCopy(tStrComp *pLeft, tStrComp *pRight, const tStrComp *pSrc, char *pSplitPos);
  51. extern char StrCompSplitRef(tStrComp *pLeft, tStrComp *pRight, const tStrComp *pSrc, char *pSplitPos);
  52.  
  53. extern void StrCompShorten(struct sStrComp *pComp, size_t Delta);
  54.  
  55. extern size_t StrCompCutLeft(struct sStrComp *pComp, size_t Delta);
  56. extern void StrCompIncRefLeft(struct sStrComp *pComp, size_t Delta);
  57.  
  58. extern void KillPrefBlanksStrComp(struct sStrComp *pComp);
  59. extern void KillPrefBlanksStrCompRef(struct sStrComp *pComp);
  60.  
  61. extern void KillPostBlanksStrComp(struct sStrComp *pComp);
  62.  
  63. extern void DumpStrComp(const char *pTitle, const struct sStrComp *pComp);
  64.  
  65. #endif /* _STRCOMP_H */
  66.