home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
basic
/
spllib.arc
/
SPLPRESS
< prev
next >
Wrap
Text File
|
1987-10-10
|
9KB
|
396 lines
FOR IMMEDIATE RELEASE 10/10/87
CONTACT Dennis Baer
516 694 5872
Software author Dennis Baer has released the Structured
Programming Language, (SPL) a free format block structured
programming language that runs on PCDOS and MSDOS operating
systems. SPL is an alternative to PASCAL and C.
SPL will also run on an AMIGA 2000 with an IBM bridge, AMIGA
1000 with the SIDECAR or the transformer IBM emulator, or other
micros that have IBM addons.
The SPL language is implemented by a translator which
converts SPL source code to a Microsoft BASIC program which can
then be compiled with Microsoft's Quick Basic, MS BASIC, IBM's
BASICA, or ported to machines such as AMIGA, MACINTOSH, ATARI ST,
or CP/M and compiled with the BASIC compiler for those machines.
SPL has been released as SHARE WARE and is available as file
SPLLIB.ARC on BIX, Compuserve, DELPHI, SOURCE, GENIE or on bbs
systems:
516 334 8221
516 367 9626
SPL is also available as volume 666 from PCSIG at 800 245 6717.
If you have any questions you may call me at 516-694-5872 from
Monday thru Friday from 10:00 am to 6:30 pm New York time.
Some major features and advantages of SPL
o SPL is an alternative to the PASCAL and C languages
o SPL programs can be run on MACINTOSH,AMIGA,ATARI ST,CP/M
o The SPL processor will run on MSDOS emulators on MACINTOSH,
AMIGA,ATARI ST
o PROCEDURES
o WHILE loops
o FOR loops with REAL and INTEGER indicies and increments
o REPEAT loops
1
o Powerful IF THEN ELSE constructs
o Powerful RANDOM and SEQUENTIAL INPUT/OUTPUT including
formatted OUTPUT
o GRAPHICS statements PSET DRAW LINE CIRCLE PRESET SCREEN .....
o BEGIN END blocks
o ERROR trapping
o Statement labels (multiple labels supported)
o Strong data types INTEGER REAL STRING scalars and arrays
o Names of variables and labels up to 40 characters upper and
lower case
o Supports mathematical functions SIN COS TAN LOG EXP .....
o STRING functions MID$ LEFT$ RIGHT$ STR$ VAL$ ASC$ .....
o Your compiled BASIC programs do not become obsolete link
them together
o SPL programs run faster than PASCAL programs
o SPL programs can take advantage of an entire 640k IBM PC
o The SPL processor will work on an IBM PCjr with 128k and
1 drive
2
This is a sample program written in the Structured Programming Language.
BEGIN
COMMENT
This program will plot a set of points in three
dimensions using the high resolution graphics. ;
REAL extent,vx,vy,topx,topy;
REAL ARRAY x(500),y(500),z(500);
INTEGER limit,i;
PROCEDURE Plotter;
BEGIN
COMMENT This procedure scales and plots the points on
the computer screen. ;
INTEGER i;
REAL maxx,maxy,minx,miny,difx,dify;
maxx := -1*10^30; maxy := maxx; minx := 1*10^30; miny := minx;
topx := 639; topy := 200;
FOR i := 1 STEP 1 UNTIL limit DO
BEGIN
IF x(i) >= maxx THEN maxx := x(i);
IF x(i) <= minx THEN minx := x(i);
IF y(i) >= maxy THEN maxy := y(i);
IF y(i) <= miny THEN miny := y(i);
END
COMMENT The maximum and minimum x and y values are computed. ;
difx := maxx-minx; dify := maxy-miny;
FOR i := 1 STEP 1 UNTIL limit DO
BEGIN
x(i) := ((x(i)-minx)/difx)*topx;
y(i) := ((y(i)-miny)/dify)*topy;
PSET(x(i),topy-y(i)),7;
END
END
PROCEDURE Convert_3D_to_2D;
BEGIN
COMMENT This procedure converts 3 dimensional coordinates to
2 dimensional coordinates. ;
REAL cosine_45,sine_45;
INTEGER i;
cosine_45 := COS((45.*3.14159)/180.);
sine_45 := SIN((45.*3.14159)/180.);
FOR i := 1 STEP 1 UNTIL limit DO
BEGIN
x(i) := x(i) + (extent-y(i))*cosine_45;
y(i) := z(i) + (extent-y(i))*sine_45;
END
END
COMMENT This is the start of the main program. ;
HOME; SCREEN 2;
Start_plot:
INPUT('Enter the scale factor:' @ extent); HOME;
OUTPUT('.... WAIT ....');
IF extent < 0 THEN GO Finish;
i:=1;
FOR vx := -1. STEP .1 UNTIL 1. DO
BEGIN
FOR vy := -1. STEP .1 UNTIL 1. DO
BEGIN
x(i) := vx; y(i) := vy; z(i) := SQR(2.-vx^2-vy^2); i := i+1;
END
END
COMMENT Points have been computed,now set up axes. ;
x(i+1) := extent; y(i+1) := 0; z(i+1) := 0;
x(i+2) := -extent; y(i+2) := 0; z(i+2) := 0;
x(i+3) := 0; y(i+3) := extent; z(i+3) := 0;
x(i+4) := 0; y(i+4) := -extent; z(i+4) := 0;
x(i+5) := 0; y(i+5) := 0; z(i+5) := extent;
x(i) := 0; y(i) := 0; z(i) := -extent;
limit := i+5;
Convert_3D_to_2D;
HOME;
Plotter;
OUTPUT( DATE$ + ' ' + TIME$ );
LINE (x(i+1),topy-y(i+1)) - (x(i+2),topy-y(i+2)),7;
LINE (x(i+3),topy-y(i+3)) - (x(i+4),topy-y(i+4)),7;
LINE (x(i),topy-y(i)) - (x(i+5),topy-y(i+5)),7;
Busy: IF INKEY$ = '' THEN GO TO Busy;
ELSE GO TO Start_plot;
Finish:
END
This is the resulting BASIC program after being sorted by the sort utility
SORT.EXE that is supplied with most MSDOS and PCDOS systems.
2 OPTION BASE 1
3 DIM AZ( 13 ),A%( 4 ),A$( 1 ),B$( 1 )
4 DIM AAZ(500)
5 DIM ABZ(500)
6 DIM ACZ(500)
503 COMMON AZ(),A%(),A$(),B$()
504 COMMON AAZ()
505 COMMON ABZ()
506 COMMON ACZ()
1001 GOTO 1045
1002 ::
1003 AZ(6)=-1*10^30
1004 AZ(7)=AZ(6)
1005 AZ(8)=1*10^30
1006 AZ(9)=AZ(8)
1007 AZ(4)=639
1008 AZ(5)=200
1009 FOR AA%=1 TO A%(1) STEP 1
1010 A%(3)=AA%
1011 IF AAZ(A%(3))>=AZ(6) THEN 1013
1012 GOTO 1015
1013 AZ(6)=AAZ(A%(3))
1014 GOTO 1016
1015 :
1016 :
1017 IF AAZ(A%(3))<=AZ(8) THEN 1019
1018 GOTO 1021
1019 AZ(8)=AAZ(A%(3))
1020 GOTO 1022
1021 :
1022 :
1023 IF ABZ(A%(3))>=AZ(7) THEN 1025
1024 GOTO 1027
1025 AZ(7)=ABZ(A%(3))
1026 GOTO 1028
1027 :
1028 :
1029 IF ABZ(A%(3))<=AZ(9) THEN 1031
1030 GOTO 1033
1031 AZ(9)=ABZ(A%(3))
1032 GOTO 1034
1033 :
1034 :
1035 NEXT
1036 AZ(10)=AZ(6)-AZ(8)
1037 AZ(11)=AZ(7)-AZ(9)
1038 FOR AB%=1 TO A%(1) STEP 1
1039 A%(3)=AB%
1040 AAZ(A%(3))=((AAZ(A%(3))-AZ(8))/AZ(10))*AZ(4)
1041 ABZ(A%(3))=((ABZ(A%(3))-AZ(9))/AZ(11))*AZ(5)
1042 PSET(AAZ(A%(3)),AZ(5)-ABZ(A%(3))),7
1043 NEXT
1044 RETURN
1045 :
1046 GOTO 1056
1047 ::
1048 AZ(12)=COS((45.*3.14159)/180.)
1049 AZ(13)=SIN((45.*3.14159)/180.)
1050 FOR AC%=1 TO A%(1) STEP 1
1051 A%(4)=AC%
1052 AAZ(A%(4))=AAZ(A%(4))+(AZ(1)-ABZ(A%(4)))*AZ(12)
1053 ABZ(A%(4))=ACZ(A%(4))+(AZ(1)-ABZ(A%(4)))*AZ(13)
1054 NEXT
1055 RETURN
1056 :
1057 CLS
1058 SCREEN 2
1059 :
1060 INPUT "Enter the scale factor:";AZ(1)
1061 CLS
1062 PRINT ".... WAIT ...."
1063 IF AZ(1)<0 THEN 1065
1064 GOTO 1067
1065 GOTO 1114
1066 GOTO 1068
1067 :
1068 :
1069 A%(2)=1
1070 FOR AD=-1. TO 1. STEP .1
1071 AZ(2)=AD
1072 FOR AE=-1. TO 1. STEP .1
1073 AZ(3)=AE
1074 AAZ(A%(2))=AZ(2)
1075 ABZ(A%(2))=AZ(3)
1076 ACZ(A%(2))=SQR(2.-AZ(2)^2-AZ(3)^2)
1077 A%(2)=A%(2)+1
1078 NEXT
1079 NEXT
1080 AAZ(A%(2)+1)=AZ(1)
1081 ABZ(A%(2)+1)=0
1082 ACZ(A%(2)+1)=0
1083 AAZ(A%(2)+2)=-AZ(1)
1084 ABZ(A%(2)+2)=0
1085 ACZ(A%(2)+2)=0
1086 AAZ(A%(2)+3)=0
1087 ABZ(A%(2)+3)=AZ(1)
1088 ACZ(A%(2)+3)=0
1089 AAZ(A%(2)+4)=0
1090 ABZ(A%(2)+4)=-AZ(1)
1091 ACZ(A%(2)+4)=0
1092 AAZ(A%(2)+5)=0
1093 ABZ(A%(2)+5)=0
1094 ACZ(A%(2)+5)=AZ(1)
1095 AAZ(A%(2))=0
1096 ABZ(A%(2))=0
1097 ACZ(A%(2))=-AZ(1)
1098 A%(1)=A%(2)+5
1099 GOSUB 1047
1100 CLS
1101 GOSUB 1002
1102 PRINT DATE$+" "+TIME$
1103 LINE (AAZ(A%(2)+1),AZ(5)-ABZ(A%(2)+1))-(AAZ(A%(2)+2),AZ(5)-ABZ(A%(2)+2)),7
1104 LINE (AAZ(A%(2)+3),AZ(5)-ABZ(A%(2)+3))-(AAZ(A%(2)+4),AZ(5)-ABZ(A%(2)+4)),7
1105 LINE (AAZ(A%(2)),AZ(5)-ABZ(A%(2)))-(AAZ(A%(2)+5),AZ(5)-ABZ(A%(2)+5)),7
1106 :
1107 IF INKEY$="" THEN 1109
1108 GOTO 1111
1109 GOTO 1106
1110 GOTO 1113
1111 :
1112 GOTO 1059
1113 :
1114 :