home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 161_01 / idris.d < prev    next >
Text File  |  1985-11-26  |  6KB  |  306 lines

  1. ###alltyp.sh
  2. goto next
  3. : next
  4. cc -o groups groups.c libtim
  5.  
  6. Makex dadd; groups <dadd.out >dadd.grp
  7. Makex dand; groups <dand.out >dand.grp
  8. Makex dban; groups <dban.out >dban.grp
  9. Makex dbor; groups <dbor.out >dbor.grp
  10. Makex ddiv; groups <ddiv.out >ddiv.grp
  11. Makex deor; groups <deor.out >deor.grp
  12. Makex deq; groups <deq.out >deq.grp
  13. Makex dlsh; groups <dlsh.out >dlsh.grp
  14. Makex dlt; groups <dlt.out >dlt.grp
  15. Makex dmul; groups <dmul.out >dmul.grp
  16. Makex drem; groups <drem.out >drem.grp
  17. Makex drsh; groups <drsh.out >drsh.grp
  18. Makex dsub; groups <dsub.out >dsub.grp
  19. Makex uinc; groups <uinc.out >uinc.grp
  20. Makex uneg; groups <uneg.out >uneg.grp
  21. Makex upin; groups <upin.out >upin.grp
  22. ###do_all.sh
  23. goto next
  24. : next
  25. sh -e Install.sh
  26. sh -e Mkavg.sh
  27. sh -e Runmost.sh
  28. sh -e Alltyp.sh
  29. sh -e Runmost2.sh
  30. ###install.sh
  31. goto next
  32. : next
  33.  
  34. cc +o  \
  35.     begint.c \
  36.     cputim.c \
  37.     returnp.c \
  38.     fround.c \
  39.  
  40. lib libtim -c begint.o cputim.o returnp.o fround.o
  41. cc -o calib.x calib.c libtim
  42. calib.x > parms.dat
  43.  
  44. Makex intreg
  45. Makex sstat
  46. Makex lauto
  47. Makex sauto
  48. Makex dauto
  49. Makex cauto
  50. Makex fauto
  51.  
  52. cc -o fmttbl fmttbl.c
  53. fmttbl intreg.out sstat.out sauto.out lauto.out dauto.out
  54. ###makex.
  55. cc -o $1.x $1.c libtim
  56. echo $1:
  57. $1.x >$1.out
  58. mv $1.x Previous.x
  59. mv $1.o Previous.o
  60. ###mkavg.sh
  61. goto next
  62. : next
  63.  
  64. : after running install.bat you can run mkavg.bat to compute averages
  65. cc -o avg avg.c libtim
  66.  
  67. avg intreg.out 8 >intreg.avg
  68. avg sstat.out 10 >sstat.avg
  69. avg sauto.out 10 >sauto.avg
  70. avg lauto.out 50 >lauto.avg
  71. avg dauto.out 400 >dauto.avg
  72. avg cauto.out 10 >cauto.avg
  73. avg fauto.out 400 >fauto.avg
  74. ###runmost.sh
  75. goto next
  76. : next
  77. Makex fncall
  78. Makex loops1
  79. Makex loops2
  80. Makex 102
  81. Makex 104
  82. Makex 105
  83. Makex 106
  84. Makex 401
  85. Makex 402
  86. Makex 403
  87. Makex 405
  88. Makex 411
  89. Makex 413
  90. Makex 501
  91. Makex 503
  92. Makex 504
  93. Makex 505
  94. Makex 506
  95. Makex 507
  96. Makex 508
  97. Makex 601
  98. ###runmost2.sh
  99. Makex switch
  100.  
  101. Makex ctypelib
  102. Makex fdlib
  103. Makex mathlib
  104. Makex strlib
  105. Makex stdlib
  106. Makex stdiolib
  107.  
  108. cc -o harness1.x harness1.c; echo harness1; time harness1.x
  109. cc -o harness2.x harness2.c; echo harness2; time harness2.x
  110. cc -o harness3.x harness3.c; echo harness3; time harness3.x
  111. cc -o harness4.x harness4.c libtim; echo harness4; time harness4.x
  112.  
  113. Makex optimtst
  114. ###testloop.out
  115. 104
  116. 100
  117. 100
  118. 100
  119. 100
  120. 100
  121. 100
  122. 101
  123. 101
  124. 100
  125. 101
  126. 102
  127. 101
  128. 101
  129. 100
  130. 100
  131. 100
  132. 100
  133. 101
  134. 101
  135. 101
  136. 101
  137. 100
  138. 100
  139. 100
  140. 101
  141. 101
  142. 101
  143. 100
  144. 100
  145. 100
  146. 100
  147. 101
  148. 101
  149. 100
  150. 100
  151. 101
  152. 101
  153. 100
  154. 100
  155. ###testloop.sh
  156. testloop 39
  157. testloop 39
  158. testloop 39
  159. testloop 39
  160. testloop 39
  161. testloop 39
  162. testloop 39
  163. testloop 39
  164. testloop 39
  165. testloop 39
  166. testloop 39
  167. testloop 39
  168. testloop 39
  169. testloop 39
  170. testloop 39
  171. testloop 39
  172. testloop 39
  173. testloop 39
  174. testloop 39
  175. testloop 39
  176. testloop 39
  177. testloop 39
  178. testloop 39
  179. testloop 39
  180. testloop 39
  181. testloop 39
  182. testloop 39
  183. testloop 39
  184. testloop 39
  185. testloop 39
  186. testloop 39
  187. testloop 39
  188. testloop 39
  189. testloop 39
  190. testloop 39
  191. testloop 39
  192. testloop 39
  193. testloop 39
  194. testloop 39
  195. testloop 39
  196. ###config.h
  197. /* config.h - configuration data for each environment
  198.  *        This file should either be customized to the intended
  199.  *        compiler/machine environment, or parameterized via -D flags
  200.  *        on the compile step:
  201.  *        -D USHORT    if compiler supports unsigned short
  202.  *        -D UTINY    if compiler supports unsigned char
  203.  *        -D VOID        if compiler supports void
  204.  *        -D ULONG    if compiler supports unsigned LONG
  205.  */
  206. #define UTINY    /* Idris 11 2.3 WSL */
  207. #define USHORT    /* Idris 11 2.3 WSL */
  208. #define ULONG    /* Idris 11 2.3 WSL */
  209. /* no VOID Idris 11 2.3 WSL */
  210. #ifdef USHORT
  211. typedef unsigned short ushort;
  212. #else
  213. typedef unsigned ushort;    /* assumes short == int */
  214. #endif
  215. #ifdef UTINY
  216. typedef unsigned char utiny;
  217. #endif
  218. #ifdef ULONG
  219. typedef unsigned long ulong;
  220. #endif
  221. #ifndef VOID
  222. #define void int
  223. #endif
  224. #define MINSAM 2e6        /* minimum timing sample (usec) */
  225. #define NTRY 100        /* maximum no of code excerpts per file */
  226. #define FR_ANCHOR arg1    /* what is the "frame anchor": arg1 or var1 */
  227. #define RETOFFSET (-1)    /* offset of return pointer
  228.                            relative to frame anchor */
  229. #define JUNKFILE "/dev/null"
  230.  
  231. /* circumvent c 2.3 bug - no ULONG on right-shift */
  232. #ifdef DRSH
  233. #undef ULONG
  234. #endif
  235. ###cputim.c
  236. /* cputim - Idris version
  237.  */
  238. #include <stdio.h>
  239.  
  240. #define STRUCTASST(a, b) cpybuf(&a, &b, sizeof(a))
  241. typedef unsigned short  ushort;
  242.  
  243. #define UTIME (tbufb.ut - tbufa.ut + tbufb.cut - tbufa.cut)
  244. #define STIME (tbufb.st - tbufa.st + tbufb.cst - tbufa.cst)
  245.  
  246. typedef struct tbuf {    /* UNIX V6  Idris */
  247.     ushort ut, st;
  248.     long cut, cst;
  249. } TBUF;
  250.  
  251. long times();
  252.  
  253. /*
  254.  * cputim - return (in ticks) CPU time since last call
  255.  */
  256. long cputim()
  257. {
  258.     long ret;
  259.     long ut1, st1, i;
  260.     static TBUF tbufa = {0, 0, 0, 0};
  261.     static TBUF tbufb = {0, 0, 0, 0};
  262.  
  263.     times(&tbufb);
  264.     ut1 = UTIME;
  265.     st1 = STIME;
  266.     ret = (ut1 + st1);
  267.  
  268.     STRUCTASST(tbufa, tbufb);
  269.     return (ret);
  270. }
  271. ###cputim.h
  272. /* cputim.h */
  273. #ifndef TIME_H
  274. #define TIME_H
  275. #define CLOCK_TICKS_PER_SECOND 60
  276. typedef long cputim_t;
  277. extern cputim_t cputim();
  278. #endif
  279. ###testloop.c
  280. #include <stdio.h>
  281. main(ac, av)
  282.     int ac;
  283.     char *av[];
  284.     {
  285.     long atol();
  286.     long cputim();
  287.     long limit = atol(av[1]);
  288.     long i;
  289.     long j;
  290.  
  291.     cputim();
  292.     for (i = 0; i < limit; ++i)
  293.         for (j = 0; j < 1000; ++j)
  294.             ;
  295.     printf("%ld\n", cputim());
  296.     }
  297. ###do-all.sh
  298. goto next
  299. : next
  300. sh -e Install.sh
  301. sh -e Mkavg.sh
  302. sh -e Runmost.sh
  303. sh -e Alltyp.sh
  304. sh -e Runmost2.sh
  305. ###EOF
  306.