scope.red 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. module scope; % Header module for SCOPE package.
  2. % ------------------------------------------------------------------- ;
  3. % Copyright : J.A. van Hulzen, Twente University, Dept. of Computer ;
  4. % Science, P.O.Box 217, 7500 AE Enschede, the Netherlands.;
  5. % Authors : J.A. van Hulzen, B.J.A. Hulshof, W.N. Borst, M.C. ;
  6. % van Heerwaarden, J.B. van Veelen. ;
  7. % ------------------------------------------------------------------- ;
  8. create!-package('(scope codctl restore minlngth codmat codopt codad1
  9. codad2 coddec codpri codgen codhrn codstr coddom),
  10. % ghorner
  11. '(contrib scope));
  12. % Smacro definitions for access functions.
  13. % ------------------------------------------------------------------- ;
  14. % Access functions for the incidence matrix ;
  15. % ------------------------------------------------------------------- ;
  16. global '(codmat maxvar)$
  17. define lenrow=8,lencol=4;
  18. % ------------------------------------------------------------------- ;
  19. % Length of the rows and the columns ;
  20. % ------------------------------------------------------------------- ;
  21. symbolic smacro procedure row x$
  22. getv(codmat,maxvar+x)$
  23. symbolic smacro procedure free x$
  24. getv(row x,0)$
  25. symbolic smacro procedure wght x$
  26. getv(row x,1)$
  27. symbolic smacro procedure awght x$
  28. caar(wght x)$
  29. symbolic smacro procedure mwght x$
  30. cdar(wght x)$
  31. symbolic smacro procedure hwght x$
  32. cdr(wght x)$
  33. symbolic smacro procedure opval x$
  34. getv(row x,2)$
  35. symbolic smacro procedure farvar x$
  36. getv(row x,3)$
  37. symbolic smacro procedure zstrt x$
  38. getv(row x,4)$
  39. symbolic smacro procedure chrow x$
  40. getv(row x,5)$
  41. symbolic smacro procedure expcof x$
  42. getv(row x,6)$
  43. symbolic smacro procedure hir x$
  44. getv(row x,7)$
  45. symbolic smacro procedure phir x$
  46. car(hir x)$
  47. symbolic smacro procedure nhir x$
  48. cdr(hir x)$
  49. % ------------------------------------------------------------------- ;
  50. % Assignments in the incidence matrix ;
  51. % ------------------------------------------------------------------- ;
  52. symbolic smacro procedure fillrow(x,v)$
  53. putv(codmat,maxvar+x,v)$
  54. symbolic smacro procedure setoccup x$
  55. putv(row x,0,nil)$
  56. symbolic smacro procedure setfree x$
  57. putv(row x,0,t)$
  58. symbolic smacro procedure setwght(x,v)$
  59. putv(row x,1,v)$
  60. symbolic smacro procedure setopval(x,v)$
  61. putv(row x,2,v)$
  62. symbolic smacro procedure setfarvar(x,v)$
  63. putv(row x,3,v)$
  64. symbolic smacro procedure setzstrt(x,v)$
  65. putv(row x,4,v)$
  66. symbolic smacro procedure setchrow(x,v)$
  67. putv(row x,5,v)$
  68. symbolic smacro procedure setexpcof(x,v)$
  69. putv(row x,6,v)$
  70. symbolic smacro procedure sethir(x,v)$
  71. putv(row x,7,v)$
  72. symbolic smacro procedure setphir(x,v)$
  73. rplaca(hir x,v)$
  74. symbolic smacro procedure setnhir(x,v)$
  75. rplacd(hir x,v)$
  76. % ------------------------------------------------------------------- ;
  77. % Access functions for Z elements ;
  78. % ------------------------------------------------------------------- ;
  79. symbolic smacro procedure xind z$
  80. car z$
  81. symbolic smacro procedure yind z$
  82. car z$
  83. symbolic smacro procedure val z$
  84. cdr z$
  85. symbolic smacro procedure ival z$
  86. car val z$
  87. symbolic smacro procedure bval z$
  88. cdr val z$
  89. % ------------------------------------------------------------------- ;
  90. % Assignment functions for Z elements ;
  91. % ------------------------------------------------------------------- ;
  92. symbolic smacro procedure setival(z,v)$
  93. rplaca(val z,v)$
  94. symbolic smacro procedure setbval(z,v)$
  95. rplacd(val z,v)$
  96. symbolic smacro procedure mkzel(n,iv);
  97. if idp(iv) or constp(iv) then n.(iv.nil) else n.iv$
  98. % --------------------------------------------------------------- ;
  99. % Distinguish between atom and non atom for IVAL and BVAL. ;
  100. % --------------------------------------------------------------- ;
  101. % ------------------------------------------------------------------- ;
  102. % Access functions for ordening subexpressions ;
  103. % ------------------------------------------------------------------- ;
  104. symbolic smacro procedure ordr x$
  105. getv(row x,8)$
  106. symbolic smacro procedure setordr(x,l)$
  107. putv(row x,8,l)$
  108. % ------------------------------------------------------------------- ;
  109. % Access functions for Histogram ;
  110. % ------------------------------------------------------------------- ;
  111. global '(codhisto)$
  112. codhisto:=nil;
  113. define histolen=200$
  114. symbolic smacro procedure histo x$
  115. getv(codhisto,x)$
  116. symbolic smacro procedure sethisto(x,v)$
  117. putv(codhisto,x,v)$
  118. endmodule;
  119. end$