ccd.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. filesummary.CH: 作用类似于unistd.h或windows.h,提供一些与C Code Develop和运行环境相关的API
  3. filesummary.EN: Like unistd.h or windows.h, provide some C Code Develop and runtime related APIs
  4. CH: 表示一个计时器(StopWatch)
  5. EN: Representation a StopWatch
  6. */
  7. typedef builtin ccdsw;
  8. /*
  9. CH: 表示一个函数引用
  10. EN: Representation a function
  11. */
  12. typedef builtin sect;
  13. /*
  14. CH: 表示最大Heap空间
  15. EN: Get the maxium heap space
  16. */
  17. unsigned int ccd_heap_maxmem();
  18. /*
  19. CH: 表示当前已使用的Heap空间
  20. EN: Get the current used heap space
  21. */
  22. unsigned int ccd_heap_usedmem();
  23. /*
  24. CH: 开启一个计时器
  25. EN: Start a stopwatch
  26. */
  27. ccdsw ccd_stopwatch_begin();
  28. /*
  29. CH: 停止指定的计时器,并返回经过的时间
  30. EN: End specified stopwatch and return the time between start and end
  31. sw.CH: 计时器实例
  32. sw.EN: Stopwatch Instance
  33. */
  34. double ccd_stopwatch_end(ccdsw sw);
  35. /*
  36. CH: 输出计时器时间
  37. EN: Display specified stopwatch time between start and end
  38. sw.CH: 计时器实例
  39. sw.EN: Stopwatch Instance
  40. msg.CH: 附加消息
  41. msg.EN: Extra message
  42. */
  43. double ccd_stopwatch_disp(ccdsw sw, char *msg);
  44. /*
  45. Deprecated from V3.0
  46. */
  47. int ccd_io_fexts(char *file, unsigned int path);
  48. /*
  49. Deprecated from V3.0
  50. */
  51. int ccd_io_write(char *file, unsigned int path, void *data, int len);
  52. /*
  53. CH: 获取函数的sect引用
  54. EN: Get the sect reference of specified function
  55. funcName.CH: 函数名
  56. funcName.EN: Function Name
  57. */
  58. sect selector(char *funcName);
  59. /*
  60. CH: 调用函数引用
  61. EN: Call function reference
  62. sel.CH: sect引用
  63. sel.EN: sect reference
  64. arg.CH: 参数
  65. arg.EN: argument for calling function
  66. */
  67. void performSelector(sect sel, void *arg);
  68. /*
  69. CH: 执行字符串中的C语言代码
  70. EN: Running C code in given string
  71. c_code.CH: 包含C代码的字符串
  72. c_code.EN: String contains C code
  73. */
  74. void exec(char *c_code);
  75. /*
  76. CH: 阻塞当前线程
  77. EN: Block current thread for seconds
  78. second.CH: 时间(秒)
  79. second.EN: Time in seconds
  80. */
  81. void sleep(unsigned int second);
  82. /*
  83. CH: 阻塞当前线程
  84. EN: Block current thread for u-seconds
  85. second.CH: 时间(微秒)
  86. second.EN: Time in u-second
  87. */
  88. int usleep(unsigned int usecond);