libcm is a C development framework with an emphasis on audio signal processing applications.
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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //| Copyright: (C) 2009-2020 Kevin Larke <contact AT larke DOT org>
  2. //| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file.
  3. #ifndef cmSymTbl_h
  4. #define cmSymTbl_h
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. //( { file_desc:"Symbol table object." kw:[base] }
  9. typedef cmHandle_t cmSymTblH_t;
  10. extern cmSymTblH_t cmSymTblNullHandle;
  11. // Create a new symbol table.
  12. // 'parentH' is a parent table embedded in this table and is optional. Set this
  13. // value to 'cmSymTblNullHandle'. if the table does not have a parent.
  14. //
  15. // All symbol searches will include this table however all symbols registered with
  16. // this table will be inserted in this table not the parent.
  17. //
  18. // 'baseSymId' is the minimum symbol id used by this table and will be returned
  19. // as the value of the first symbol registered with this table. Subsequent symbols
  20. // will increment this value. Internal assertions prevent the symbol id range
  21. // of this table from overlapping with its parent.
  22. cmSymTblH_t cmSymTblCreate( cmSymTblH_t parentH, unsigned baseSymId, cmCtx_t* ctx );
  23. // Destroy and release the resources associated with a symbol table created by
  24. // an earlier call to cmSymTblCreate().
  25. void cmSymTblDestroy( cmSymTblH_t* hp );
  26. // Register a symbol label. Set 'staticFl' to true if the label is allocated statically.
  27. unsigned cmSymTblRegister( cmSymTblH_t h, const char* label, bool staticFl );
  28. unsigned cmSymTblRegisterSymbol( cmSymTblH_t h, const char* label );
  29. unsigned cmSymTblRegisterStaticSymbol( cmSymTblH_t h, const char* label );
  30. unsigned cmSymTblRegisterVFmt( cmSymTblH_t h, const cmChar_t* fmt, va_list vl );
  31. unsigned cmSymTblRegisterFmt( cmSymTblH_t h, const cmChar_t* fmt, ... );
  32. bool cmSymTblRemove( cmSymTblH_t h, unsigned symId );
  33. // Given a symbol id return the associated label.
  34. const char* cmSymTblLabel( cmSymTblH_t h, unsigned symId );
  35. // Given a symbol label return the associated id or cmInvalidId if the symbol could not be found.
  36. unsigned cmSymTblId( cmSymTblH_t h, const char* label );
  37. // Returns true if the symbol table handle is not valid otherwise returns false.
  38. bool cmSymTblIsValid( cmSymTblH_t h );
  39. // Returns true if 'symId' is stored in this symbol table or its parent otherwise returns false.
  40. bool cmSymTblIsValidId( cmSymTblH_t h, unsigned symId );
  41. // Print thes symbol table (but not its parent).
  42. void cmSymTblReport( cmSymTblH_t h );
  43. // Symbol table test stub.
  44. void cmSymTblTest(cmCtx_t* ctx);
  45. //)
  46. #ifdef __cplusplus
  47. }
  48. #endif
  49. #endif