home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p115 / 10.ddi / GCD4 / UPL / TABLE.UPL < prev    next >
Encoding:
Text File  |  1987-05-05  |  1.7 KB  |  78 lines

  1. --  This program creates a tabulation block.  You enter the number of rows,
  2. --  number of columns, spacing between rows, spacing of each column, 
  3. --  and color of lines.
  4.  
  5. PROC MAIN
  6.  
  7. INTEGER NC,I,NR,NDIGS,C
  8. REAL HS(25),VS,VL,HL
  9. COORD POS,END1,END2
  10. STRING WT:1
  11.  
  12. BREAK_CHAR = 3
  13. CLEAR 1
  14.  
  15. HL = 0.0
  16.  
  17. ECHO OFF; SEND; SEND "SET SCROLL 10"; ECHO ON
  18.  
  19. PRINT "This UPL program creates a tabulation block.  You enter: "
  20. PRINT
  21. PRINT "     1) the number of columns"
  22. PRINT "     2) the horizontal spacing for each column"
  23. PRINT "     3) the number of rows"
  24. PRINT "     4) the vertical spacing of the rows"
  25. PRINT "     5) the color of the lines "
  26. PRINT 
  27. PRINT "press a key to continue ..."
  28.  
  29. ACCEPT WT, NEWLINE
  30.  
  31. ECHO OFF; SEND; SEND "SET SCROLL 3"; ECHO ON
  32.  
  33. LOOP
  34.     ACCEPT NC PROMPT('Enter # of columns (min=1, max=25):  '), NEWLINE
  35.     EXIT WHEN  NC <= 25 AND NC > 0
  36.     PRINT "You must enter a number between 1 and 25, try again ..."
  37. END LOOP
  38.  
  39. CLEAR 1
  40.  
  41. LOOP I = 1 TO NC
  42.    PRINT "Enter horizontal spacing for column ",I,":  ",
  43.    ACCEPT HS(I), NEWLINE
  44. END_LOOP
  45.  
  46. ACCEPT NR PROMPT('Enter number of rows: '), NEWLINE
  47. ACCEPT VS PROMPT('Enter vertical spacing: '), NEWLINE
  48. ACCEPT C PROMPT('Enter color (integer only): '), NEWLINE
  49.  
  50. PRINT "Digitize lower left corner of table: ",
  51. GETDIG(1,1,NDIGS,POS)
  52.  
  53. CLEAR 1
  54.  
  55. VL = VS*REAL(NR)
  56.  
  57. LOOP I = 1 TO NC
  58.    HL = HL+HS(I)
  59. END_LOOP
  60.  
  61. END1 = POS
  62. END2 = POS; END2.X = END2.X+HL
  63.  
  64. LOOP I = 1 TO NR+1
  65.    INSERT LINE COLOR(C) ENDS(END1,END2), RPNT(TRUE)
  66.    END1.Y = END1.Y+VS; END2.Y = END2.Y+VS
  67. END_LOOP
  68.  
  69. END1 = POS
  70. END2 = POS; END2.Y = END2.X+VL
  71.  
  72. LOOP I = 1 TO NC+1
  73.    INSERT LINE ENDS(END1,END2), RPNT(TRUE)
  74.    END1.X = END1.X+HS(I); END2.X = END2.X+HS(I)
  75. END_LOOP
  76.  
  77. END PROC
  78.