allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (11/27/89)
Posting-number: Volume 9, Issue 8 Submitted-by: gunnaro@hafro.is (Gunnar Orvarsson) Archive-name: map_go/part02 map program : no. 2 of 2 This shell archive contains the source code for the map program. Unwrap no. 1 first. #---------------------------------- cut here ---------------------------------- # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by Gunnar Orvarsson <gunnaro@gst> on Mon Nov 20 15:50:11 1989 # # This archive contains: # Map/Src # # Error checking via wc(1) will be performed. LANG=""; export LANG echo mkdir - Map/Src mkdir Map/Src echo x - Map/Src/Makefile cat >Map/Src/Makefile <<'@EOF' INSDIR=/usr/local/bin LIBES=-lm # Choose the appropriate plot library by switching the comment # sign between the two different definitions. #PLOTLIBRARY=-lplot PLOTLIBRARY=plotlib.o BINARIES=map course station value symbol shade GENOBJ=geoposi.o mercator.o linetype.o wincol.o MAPOBJ=map.o iniparms.o getargs.o setenv.o setup.o option.o border.o \ tic.o label.o comment.o frame.o gtermcap.o $(GENOBJ) $(PLOTLIBRARY) SHADEOBJ=shade.o minmax.o $(GENOBJ) $(PLOTLIBRARY) STATIONOBJ=station.o minmax.o $(GENOBJ) $(PLOTLIBRARY) VALUEOBJ=value.o minmax.o $(GENOBJ) $(PLOTLIBRARY) SYMBOLOBJ=symbol.o minmax.o $(GENOBJ) $(PLOTLIBRARY) COURSEOBJ=course.o $(GENOBJ) $(PLOTLIBRARY) OBJECTS=$(MAPOBJ) minmax.o shade.o station.o value.o symbol.o course.o all : $(BINARIES) touch all map : $(MAPOBJ) cc -o map $(MAPOBJ) $(LIBES) $(MAPOBJ) : types.h shade: $(SHADEOBJ) cc -o shade $(SHADEOBJ) $(LIBES) $(SHADEOBJ) : types.h station : $(STATIONOBJ) cc -o station $(STATIONOBJ) $(LIBES) $(STATIONOBJ) : types.h value : $(VALUEOBJ) cc -o value $(VALUEOBJ) $(LIBES) $(VALUEOBJ) : types.h symbol : $(SYMBOLOBJ) cc -o symbol $(SYMBOLOBJ) $(LIBES) $(SYMBOLOBJ) : types.h course : $(COURSEOBJ) cc -o course $(COURSEOBJ) $(LIBES) $(COURSEOBJ) : types.h install : all cp $(BINARIES) $(INSDIR) clean : rm -f $(OBJECTS) $(BINARIES) @EOF set `wc -lwc <Map/Src/Makefile` if test $1$2$3 != 651541434 then echo ERROR: wc results of Map/Src/Makefile are $* should be 65 154 1434 fi chmod 777 Map/Src/Makefile echo x - Map/Src/Makefile.old cat >Map/Src/Makefile.old <<'@EOF' all : map course station value symbol shade iceline map : map.o iniparms.o getargs.o setenv.o setup.o option.o border.o tic.o label.o comment.o frame.o geoposi.o mercator.o linetype.o gtermcap.o wincol.o cc -o map map.o iniparms.o getargs.o setenv.o setup.o option.o border.o tic.o label.o comment.o frame.o geoposi.o mercator.o linetype.o gtermcap.o wincol.o -lm -lplot map.o iniparms.o getargs.o setenv.o setup.o option.o border.o tic.o label.o comment.o frame.o geoposi.o mercator.o linetype.o gtermcap.o wincol.o : types.h shade : shade.o geoposi.o mercator.o linetype.o minmax.o wincol.o cc -o shade shade.o geoposi.o mercator.o linetype.o minmax.o wincol.o -lm -lplot shade.o geoposi.o mercator.o linetype.o minmax.o wincol.o : types.h station : station.o geoposi.o mercator.o linetype.o minmax.o wincol.o cc -o station station.o geoposi.o mercator.o linetype.o minmax.o wincol.o -lm -lplot station.o geoposi.o mercator.o linetype.o minmax.o wincol.o : types.h value : value.o geoposi.o mercator.o linetype.o minmax.o wincol.o cc -o value value.o geoposi.o mercator.o linetype.o minmax.o wincol.o -lm -lplot value.o geoposi.o mercator.o linetype.o minmax.o wincol.o : types.h symbol : symbol.o geoposi.o mercator.o linetype.o minmax.o wincol.o cc -o symbol symbol.o geoposi.o mercator.o linetype.o minmax.o wincol.o -lm -lplot symbol.o geoposi.o mercator.o linetype.o minmax.o wincol.o : types.h course : course.o geoposi.o mercator.o linetype.o wincol.o cc -o course course.o geoposi.o mercator.o linetype.o wincol.o -lm -lplot course.o geoposi.o mercator.o linetype.o wincol.o : types.h @EOF set `wc -lwc <Map/Src/Makefile.old` if test $1$2$3 != 191981618 then echo ERROR: wc results of Map/Src/Makefile.old are $* should be 19 198 1618 fi chmod 777 Map/Src/Makefile.old rm -f /tmp/uud$$ (echo "begin 777 /tmp/uud$$\n \nend" | uudecode) >/dev/null 2>&1 if [ -f /tmp/uud$$ ] then rm -f /tmp/uud$$ unpacker=uudecode else echo Compiling unpacker for non-ascii files pwd=`pwd`; cd /tmp cat >unpack$$.c <<-'EOF' #include <stdio.h> #define DEC(c) (((c) - ' ') & 077) main() { int n; char dest[128], a,b,c,d; scanf("begin %o ", &n); gets(dest); if (freopen(dest, "w", stdout) == NULL) { perror(dest); exit(1); } while ((n=getchar()) != EOF && (n=DEC(n))!=0) { while (n>0) { a = DEC(getchar()); b = DEC(getchar()); c = DEC(getchar()); d = DEC(getchar()); if (n-- > 0) putchar(a << 2 | b >> 4); if (n-- > 0) putchar(b << 4 | c >> 2); if (n-- > 0) putchar(c << 6 | d); } n=getchar(); } exit(0); } EOF cc -o unpack$$ unpack$$.c rm unpack$$.c cd $pwd unpacker=/tmp/unpack$$ fi echo x - Map/Src/axes.c '[non-ascii]' $unpacker <<'@eof' begin 777 Map/Src/axes.c M(VEN8VQU9&4@/&UA=&@N:#X*(VEN8VQU9&4@/'-T9&EO+F@^"@IM86EN*"D* M>PH):6YT"4D["@H)9&]U8FQE"4UE<F-A=&]R*"D["@H)9&]U8FQE"5!O:6YT M.PH)9&]U8FQE"41I<W1A;F-E.PH)9&]U8FQE"4)A<V5$:7-T86YC93L*"@ED M;W5B;&4)0F%S92 ](#8S+C P,#L*"61O=6)L90E4;W @(#T@-C@N,# P.PH* M"6]P96YP;"@I.PH)<W!A8V4H,"PP+#4P,"PU,# I.PH*"6UO=F4H,"PP*3L* M"6-O;G0H,"PT-3@I.PH)8V]N="@V.#0L-#4X*3L*"6-O;G0H-C@T+# I.PH) M8V]N="@P+# I.PH*"4)A<V5$:7-T86YC92 ]($UE<F-A=&]R*%1O<"DM365R M8V%T;W(H0F%S92D["@H)9F]R("A)(#T@," [($D@/" Q,2 [($DK*RD*"7L* M"0E0;VEN=#TH0F%S92LH22HP+C4I*3L*"0E$:7-T86YC93TH365R8V%T;W(H M4&]I;G0I+4UE<F-A=&]R*$)A<V4I*2]"87-E1&ES=&%N8V4["@D);6]V92@P M+"@H:6YT*2A$:7-T86YC92HT-3@I*2D["@D)8V]N="@T+"@H:6YT*2A$:7-T M86YC92HT-3@I*2D["@E]"@E"87-E1&ES=&%N8V4@/2 R."XP("T@,3 N,#L* M"69O<B H22 ](# @.R!)(#P@,C<@.R!)*RLI"@E["@D);6]V92@H22HS."DL M-#4X*3L*"0EC;VYT*"A)*C,X*2PT-30I.PH)?0H*"6-L;W-E<&PH*3L*"65X M:70H,"D["GT*"@ID;W5B;&4)365R8V%T;W(H4&]S:71I;VXI"F1O=6)L90E0 M;W-I=&EO;CL*>PH)9&]U8FQE"5)A9"@I.PH)9&]U8FQE"4-O;G-T86YT(#T@ M,"XP,3<T-3,S.PH)9&]U8FQE"49O=7)T>49I=F4@/2 T-2XP.PH*"7)E='5R M;BAL;V<Q,"AT86XH4F%D*$9O=7)T>49I=F4I*U)A9"A0;W-I=&EO;B\R+C I M*2DI.PI]"@H*9&]U8FQE"5)A9"A$96=R965S*0ID;W5B;&4)1&5G<F5E<SL* M>PH)9&]U8FQE"5!I(#T@,RXQ-#$U,SL*"@ER971U<FXH4&DJ*$1E9W)E97,O *,3@P+C I*3L*?5!I end @eof set `wc -lwc <Map/Src/axes.c` if test $1$2$3 != 63100910 then echo ERROR: wc results of Map/Src/axes.c are $* should be 63 100 910 fi chmod 777 Map/Src/axes.c echo x - Map/Src/border.c cat >Map/Src/border.c <<'@EOF' #include <stdio.h> #include "types.h" double strtodouble(); Border(ARE,GEO,BP) TypOfSpaceDefinition ARE; TypOfGeographicalDefinition GEO; TypOfBorderParameters BP; { FILE *FPtr; TypOfDouble Mercator(); TypOfFloat FactorX; TypOfFloat FactorY; TypOfInt DeltaX; TypOfInt DeltaY; TypOfDouble DeltaLongitude; TypOfDouble DeltaLatitude; TypOfDouble Longitude; TypOfDouble Latitude; TypOfInt PenPos; TypOfInt X; TypOfInt Y; TypOfChar StrLatitude[10]; TypOfChar StrLongitude[10]; TypOfDouble GeoPosition(); TypOfChar InputLine[MAXTEXTLEN]; TypOfChar HeaderLine[MAXTEXTLEN]; TypOfChar LineMode[15]; FPtr = fopen(BP.BorderDataFile,"r"); if(FPtr == NULL) { fprintf(stderr,"Error: Cannot open data file %s\n",BP.BorderDataFile); exit(ERROR); } else { LineType(BP.BorderPattern/10,LineMode); linemod(LineMode); color(BP.BorderPattern%10); window(ARE.MinX,ARE.MinY,ARE.MaxX,ARE.MaxY); DeltaX = ARE.MaxX - ARE.MinX; DeltaLongitude = GEO.MaxLongitude - GEO.MinLongitude; FactorX = DeltaX/DeltaLongitude; DeltaY = ARE.MaxY - ARE.MinY; DeltaLatitude = Mercator(GEO.MaxLatitude) - Mercator(GEO.MinLatitude); FactorY = DeltaY/DeltaLatitude; fgets(HeaderLine,MAXTEXTLEN,FPtr); fgets(HeaderLine,MAXTEXTLEN,FPtr); if (fscanf(FPtr,"%s %s %d",StrLatitude,StrLongitude,&PenPos) != EOF) { if (StrLatitude[2] != '.') { Latitude = GeoPosition(StrLatitude); Longitude = GeoPosition(StrLongitude); X = (FactorX*(GEO.MaxLongitude-Longitude))+ARE.MinX; Y = (FactorY*(Mercator(Latitude)-Mercator(GEO.MinLatitude)))+ARE.MinY; if (PenPos == UP) move(X,Y); else cont(X,Y); while(fscanf(FPtr,"%s %s %d",StrLatitude,StrLongitude,&PenPos) != EOF) { Latitude = GeoPosition(StrLatitude); Longitude = GeoPosition(StrLongitude); X = (FactorX*(GEO.MaxLongitude-Longitude))+ARE.MinX; Y = (FactorY*(Mercator(Latitude)-Mercator(GEO.MinLatitude)))+ARE.MinY; if (PenPos == UP) move(X,Y); else cont(X,Y); } } else { Latitude=strtodouble(StrLatitude); Longitude=strtodouble(StrLongitude); X = (FactorX*(GEO.MaxLongitude-Longitude))+ARE.MinX; Y = (FactorY*(Mercator(Latitude)-Mercator(GEO.MinLatitude)))+ARE.MinY; if (PenPos == UP) move(X,Y); else cont(X,Y); while(fscanf(FPtr,"%lf %lf %d",&Latitude,&Longitude,&PenPos) != EOF) { X = (FactorX*(GEO.MaxLongitude-Longitude))+ARE.MinX; Y = (FactorY*(Mercator(Latitude)-Mercator(GEO.MinLatitude)))+ARE.MinY; if (PenPos == UP) move(X,Y); else cont(X,Y); } } } } fclose(FPtr); fflush(stdout); return(OK); } double strtodouble(s) char s[]; { double val,power; int i,sign; for(i=0;s[i]==' ' || s[i]=='\n' || s[i]=='\t'; i++) ; sign=1; if (s[i]=='+' || s[i]=='-') sign= (s[i++]=='+') ? 1 : -1; for (val=0;s[i]>='0' && s[i]<='9';i++) val=10*val+s[i]-'0'; if (s[i]=='.') i++; for (power=1; s[i]>='0' && s[i]<='9'; i++) { val=10*val+s[i]-'0'; power *=10; } return (sign*val/power); } @EOF set `wc -lwc <Map/Src/border.c` if test $1$2$3 != 1392533297 then echo ERROR: wc results of Map/Src/border.c are $* should be 139 253 3297 fi chmod 777 Map/Src/border.c echo x - Map/Src/box.c cat >Map/Src/box.c <<'@EOF' main() { openpl(); space(0,0,500,500); move(0,0); cont(0,500); cont(500,500); cont(500,0); cont(0,0); move(250,250); label("0123456789"); closepl(); exit(0); } @EOF set `wc -lwc <Map/Src/box.c` if test $1$2$3 != 1414172 then echo ERROR: wc results of Map/Src/box.c are $* should be 14 14 172 fi chmod 777 Map/Src/box.c echo x - Map/Src/comment.c cat >Map/Src/comment.c <<'@EOF' #include <stdio.h> #include "types.h" TypOfInt Comment(WIN,ARE,CHA,CP) TypOfSpaceDefinition WIN; TypOfSpaceDefinition ARE; TypOfFontDefinition CHA; TypOfCommentParameters CP; { TypOfInt X; TypOfInt Y; TypOfInt NumLines(); TypOfInt LineCount; TypOfPtrToChar ComLine(); TypOfChar CommentLine[MAXTEXTLEN]; TypOfChar LineMode[15]; window(WIN.MinX-10,WIN.MinY-10,WIN.MaxX+10,WIN.MaxY+10); LineType(CP.CommentPattern/10,LineMode); linemod(LineMode); color(CP.CommentPattern%10); for(LineCount = 1; LineCount <= NumLines(CP.CommentText); LineCount++) { strcpy(CommentLine,ComLine(CP.CommentText,LineCount)); X = ((WIN.MaxX-WIN.MinX)/2.0)-(CHA.CharWidth*(strlen(CommentLine)/2.0)); Y = ARE.MinY-((LineCount+1)*CHA.LineHeight); move(X,Y); label(CommentLine); } fflush(stdout); return(OK); } TypOfInt NumLines(Text) TypOfPtrToChar Text; { TypOfInt LineCount; TypOfPtrToChar LineIndex; LineIndex = Text; LineCount = 1; while(index(LineIndex,LINEBREAK) != 0) { LineCount++; LineIndex = index(LineIndex,LINEBREAK); LineIndex++; } return(LineCount); } TypOfPtrToChar ComLine(String,LineNumber) TypOfPtrToChar String; TypOfInt LineNumber; { TypOfInt LineCount; TypOfInt NumLines(); TypOfChar WorkString[MAXTEXTLEN]; TypOfPtrToChar StrBegin; TypOfPtrToChar StrEnd; strcpy(WorkString,String); StrBegin = WorkString; StrEnd = index(WorkString,'\0'); for(LineCount = 1; LineCount < LineNumber; LineCount++) { StrBegin = index(StrBegin,LINEBREAK); StrBegin++; } if(index(StrBegin,LINEBREAK) != 0) StrEnd = index(StrBegin,LINEBREAK); *StrEnd = '\0'; strcpy(WorkString,StrBegin); return(WorkString); } @EOF set `wc -lwc <Map/Src/comment.c` if test $1$2$3 != 931301924 then echo ERROR: wc results of Map/Src/comment.c are $* should be 93 130 1924 fi chmod 666 Map/Src/comment.c echo x - Map/Src/compbmax.c '[non-ascii]' $unpacker <<'@eof' begin 777 Map/Src/compbmax.c M(VEN8VQU9&4@/'-T9&EO+F@^"B-I;F-L=61E(#QM871H+F@^"@IM86EN"2AA M<F=C+&%R9W8I"FEN= EA<F=C.PIC:&%R"2IA<F=V6UT["GL*"6EN= E).PH) M9&]U8FQE"51E;7 Q.PH)9&]U8FQE"51E;7 R.PH*"61O=6)L90E,36EN.PH) M9&]U8FQE"4Q-87@["@ED;W5B;&4)0DUI;CL*"61O=6)L90E"36%X.PH)9&]U M8FQE"4Q.=6T["@ED;W5B;&4)65-I>F5&86-T;W(["@H)9&]U8FQE"4UE<F-A M=&]R*"D["@ED;W5B;&4)26YV97)S94UE<F-A=&]R*"D["@H)<W-C86YF*&%R M9W9;,5TL(B5L9B(L)DQ-87@I.PH)<W-C86YF*&%R9W9;,ETL(B5L9B(L)D)- M:6XI.PH)<W-C86YF*&%R9W9;,UTL(B5L9B(L)DQ.=6TI.PH)<W-C86YF*&%R M9W9;-%TL(B5L9B(L)EE3:7IE1F%C=&]R*3L*"@E,36EN(#T@3$UA>"U,3G5M M.PH)5&5M<#$@/2!-97)C871O<B@H9&]U8FQE*2 Q+C I.PH)0DUA>" ]($EN M=F5R<V5-97)C871O<BA-97)C871O<BA"36EN*2M94VEZ949A8W1O<BI,3G5M M*E1E;7 Q*3L*"@EP<FEN=&8H(B5F("5F(%QN(BQ,36%X+$)-:6XI.PH)<')I M;G1F*"(E9B E9B!<;B(L3$UI;BQ"36%X*3L*"0H)97AI="@P*3L*?0H*"F1O M=6)L90E-97)C871O<BA0;W-I=&EO;BD*9&]U8FQE"5!O<VET:6]N.PI["@ED M;W5B;&4)4F%D:6%N<R@I.PH)9&]U8FQE"49O=7)T>49I=F4@/2 T-2XP.PH* M"7)E='5R;BAL;V<H=&%N*%)A9&EA;G,H1F]U<G1Y1FEV92DK4F%D:6%N<RA0 M;W-I=&EO;B\R+C I*2DI.PI]"@H*9&]U8FQE"4EN=F5R<V5-97)C871O<BA9 M3&]C871I;VXI"F1O=6)L90E93&]C871I;VX["GL*"61O=6)L90E$96=R965S M*"D["@ED;W5B;&4)1F]U<G1Y1FEV92 ](#0U+C ["@H)<F5T=7)N*#(N,"HH M1&5G<F5E<RAA=&%N*&5X<"A93&]C871I;VXI*2DM1F]U<G1Y1FEV92DI.PI] M"@H*9&]U8FQE"5)A9&EA;G,H1&5G<F5E<RD*9&]U8FQE"41E9W)E97,["GL* M"61O=6)L90E0:2 ](#,N,30Q-3D["@H)<F5T=7)N*%!I*BA$96=R965S+S$X M,"XP*2D["GT*"@ID;W5B;&4)1&5G<F5E<RA2861I86YS*0ID;W5B;&4)4F%D M:6%N<SL*>PH)9&]U8FQE"5!I(#T@,RXQ-#$U.3L*"@ER971U<FXH,3@P+C J 0*%)A9&EA;G,O4&DI*3L*?5!I end @eof set `wc -lwc <Map/Src/compbmax.c` if test $1$2$3 != 721031096 then echo ERROR: wc results of Map/Src/compbmax.c are $* should be 72 103 1096 fi chmod 777 Map/Src/compbmax.c echo x - Map/Src/complmax.c '[non-ascii]' $unpacker <<'@eof' begin 777 Map/Src/complmax.c M(VEN8VQU9&4@/'-T9&EO+F@^"B-I;F-L=61E(#QM871H+F@^"@IM86EN"2AA M<F=C+&%R9W8I"FEN= EA<F=C.PIC:&%R"2IA<F=V6UT["GL*"6EN= E).PH) M9&]U8FQE"51E;7 Q.PH)9&]U8FQE"51E;7 R.PH*"61O=6)L90E,36EN.PH) M9&]U8FQE"4Q-87@["@ED;W5B;&4)0DUI;CL*"61O=6)L90E"36%X.PH)9&]U M8FQE"4).=6T["@ED;W5B;&4)65-I>F5&86-T;W(["@H)9&]U8FQE"4UE<F-A M=&]R*"D["@ED;W5B;&4)26YV97)S94UE<F-A=&]R*"D["@H)<W-C86YF*&%R M9W9;,5TL(B5L9B(L)DQ-:6XI.PH)<W-C86YF*&%R9W9;,ETL(B5L9B(L)D)- M:6XI.PH)<W-C86YF*&%R9W9;,UTL(B5L9B(L)D).=6TI.PH)<W-C86YF*&%R M9W9;-%TL(B5L9B(L)EE3:7IE1F%C=&]R*3L*"@E,36EN(#T@3$UA>"U,3G5M M.PH)5&5M<#$@/2!-97)C871O<B@H9&]U8FQE*2 Q+C I.PH)0DUA>" ]($EN M=F5R<V5-97)C871O<BA-97)C871O<BA"36EN*2M94VEZ949A8W1O<BI,3G5M M*E1E;7 Q*3L*"@EP<FEN=&8H(B5F("5F(%QN(BQ,36%X+$)-:6XI.PH)<')I M;G1F*"(E9B E9B!<;B(L3$UI;BQ"36%X*3L*"0H)97AI="@P*3L*?0H*"F1O M=6)L90E-97)C871O<BA0;W-I=&EO;BD*9&]U8FQE"5!O<VET:6]N.PI["@ED M;W5B;&4)4F%D:6%N<R@I.PH)9&]U8FQE"49O=7)T>49I=F4@/2 T-2XP.PH* M"7)E='5R;BAL;V<H=&%N*%)A9&EA;G,H1F]U<G1Y1FEV92DK4F%D:6%N<RA0 M;W-I=&EO;B\R+C I*2DI.PI]"@H*9&]U8FQE"4EN=F5R<V5-97)C871O<BA9 M3&]C871I;VXI"F1O=6)L90E93&]C871I;VX["GL*"61O=6)L90E$96=R965S M*"D["@ED;W5B;&4)1F]U<G1Y1FEV92 ](#0U+C ["@H)<F5T=7)N*#(N,"HH M1&5G<F5E<RAA=&%N*&5X<"A93&]C871I;VXI*2DM1F]U<G1Y1FEV92DI.PI] M"@H*9&]U8FQE"5)A9&EA;G,H1&5G<F5E<RD*9&]U8FQE"41E9W)E97,["GL* M"61O=6)L90E0:2 ](#,N,30Q-3D["@H)<F5T=7)N*%!I*BA$96=R965S+S$X M,"XP*2D["GT*"@ID;W5B;&4)1&5G<F5E<RA2861I86YS*0ID;W5B;&4)4F%D M:6%N<SL*>PH)9&]U8FQE"5!I(#T@,RXQ-#$U.3L*"@ER971U<FXH,3@P+C J 0*%)A9&EA;G,O4&DI*3L*?5!I end @eof set `wc -lwc <Map/Src/complmax.c` if test $1$2$3 != 721031096 then echo ERROR: wc results of Map/Src/complmax.c are $* should be 72 103 1096 fi chmod 777 Map/Src/complmax.c echo x - Map/Src/convert.c cat >Map/Src/convert.c <<'@EOF' #include <stdio.h> main() { int Pen = 1; int Old = 0; double X,Y; while(scanf("%lf %lf %d",&X,&Y,&Pen) != EOF) { if (Old == 0) printf("%f %f %d \n",X,Y,Old); else if (Pen != 0) printf("%f %f %d \n",X,Y,Pen); Old = Pen; } exit(0); } @EOF set `wc -lwc <Map/Src/convert.c` if test $1$2$3 != 1643247 then echo ERROR: wc results of Map/Src/convert.c are $* should be 16 43 247 fi chmod 777 Map/Src/convert.c echo x - Map/Src/course.c cat >Map/Src/course.c <<'@EOF' #include <stdio.h> #include "types.h" main(ArgC,ArgV) TypOfInt ArgC; TypOfPtrToChar ArgV[]; { TypOfSpaceDefinition WOR; TypOfSpaceDefinition WIN; TypOfSpaceDefinition ARE; TypOfFontDefinition CHA; TypOfGeographicalDefinition GEO; TypOfInt PAT; TypOfDouble Mercator(); TypOfFloat FactorX; TypOfFloat FactorY; TypOfInt DeltaX; TypOfInt DeltaY; TypOfDouble DeltaLongitude; TypOfDouble DeltaLatitude; TypOfDouble Longitude; TypOfDouble Latitude; TypOfInt X; TypOfInt Y; TypOfChar InputLine[MAXTEXTLEN]; TypOfChar StrLatitude[10]; TypOfChar StrLongitude[10]; TypOfDouble GeoPosition(); TypOfChar LineMode[15]; GetArguments(ArgC,ArgV,&WOR,&WIN,&ARE,&CHA,&GEO,&PAT); window(ARE.MinX,ARE.MinY,ARE.MaxX,ARE.MaxY); LineType(PAT/10,LineMode); linemod(LineMode); color(PAT%10); DeltaX = ARE.MaxX - ARE.MinX; DeltaLongitude = GEO.MaxLongitude - GEO.MinLongitude; FactorX = DeltaX/DeltaLongitude; DeltaY = ARE.MaxY - ARE.MinY; DeltaLatitude = Mercator(GEO.MaxLatitude) - Mercator(GEO.MinLatitude); FactorY = DeltaY/DeltaLatitude; gets(InputLine); gets(InputLine); if(gets(InputLine) == NULL) { fprintf(stderr,"Error: Input file for \"course\" is empty\n"); exit(ERROR); } else { sscanf(InputLine,"%s %s",StrLatitude,StrLongitude); Latitude = GeoPosition(StrLatitude); Longitude = GeoPosition(StrLongitude); X = (FactorX*(GEO.MaxLongitude-Longitude))+ARE.MinX; Y = (FactorY*(Mercator(Latitude)-Mercator(GEO.MinLatitude)))+ARE.MinY; move(X,Y); while(gets(InputLine) != NULL) { sscanf(InputLine,"%s %s",StrLatitude,StrLongitude); Latitude = GeoPosition(StrLatitude); Longitude = GeoPosition(StrLongitude); X = (FactorX*(GEO.MaxLongitude-Longitude))+ARE.MinX; Y = (FactorY*(Mercator(Latitude)-Mercator(GEO.MinLatitude)))+ARE.MinY; cont(X,Y); } } fflush(stdout); exit(OK); } TypOfInt GetArguments(ArgC,ArgV,WOR,WIN,ARE,CHA,GEO,PAT) TypOfInt ArgC; TypOfPtrToChar ArgV[]; TypOfSpaceDefinition *WOR; TypOfSpaceDefinition *WIN; TypOfSpaceDefinition *ARE; TypOfFontDefinition *CHA; TypOfGeographicalDefinition *GEO; TypOfInt *PAT; { sscanf(ArgV[1],"%d",&((*WOR).MinX)); sscanf(ArgV[2],"%d",&((*WOR).MaxX)); sscanf(ArgV[3],"%d",&((*WOR).MinY)); sscanf(ArgV[4],"%d",&((*WOR).MaxY)); sscanf(ArgV[5],"%d",&((*WIN).MinX)); sscanf(ArgV[6],"%d",&((*WIN).MaxX)); sscanf(ArgV[7],"%d",&((*WIN).MinY)); sscanf(ArgV[8],"%d",&((*WIN).MaxY)); sscanf(ArgV[9],"%d",&((*ARE).MinX)); sscanf(ArgV[10],"%d",&((*ARE).MaxX)); sscanf(ArgV[11],"%d",&((*ARE).MinY)); sscanf(ArgV[12],"%d",&((*ARE).MaxY)); sscanf(ArgV[13],"%d",&((*CHA).CharWidth)); sscanf(ArgV[14],"%d",&((*CHA).CharHeight)); sscanf(ArgV[15],"%d",&((*CHA).LineHeight)); sscanf(ArgV[16],"%lf",&((*GEO).MinLongitude)); sscanf(ArgV[17],"%lf",&((*GEO).MaxLongitude)); sscanf(ArgV[18],"%lf",&((*GEO).MinLatitude)); sscanf(ArgV[19],"%lf",&((*GEO).MaxLatitude)); sscanf(ArgV[20],"%d",PAT); return; } @EOF set `wc -lwc <Map/Src/course.c` if test $1$2$3 != 1351823266 then echo ERROR: wc results of Map/Src/course.c are $* should be 135 182 3266 fi chmod 777 Map/Src/course.c echo x - Map/Src/degtoddmmss.c cat >Map/Src/degtoddmmss.c <<'@EOF' #include <stdio.h> #include "types.h" main() { TypOfInt Pen; TypOfDouble Latitude; TypOfDouble Longitude; TypOfInt dd; TypOfInt mm; TypOfInt ss; while(scanf("%lf %lf %d",&Longitude,&Latitude,&Pen) != EOF) { dd = Latitude; Latitude = Latitude-((int) Latitude); mm = Latitude*100*0.6; Latitude = (Latitude*100)-((int) (Latitude*100)); ss = Latitude*100*0.6; printf("%02d%02d%02d ",dd,mm,ss); dd = Longitude; Longitude = Longitude-((int) Longitude); mm = Longitude*100*0.6; Longitude = (Longitude*100)-((int) (Longitude*100)); ss = Longitude*100*0.6; printf("%02d%02d%02d ",dd,mm,ss); printf("%d\n",Pen); } } @EOF set `wc -lwc <Map/Src/degtoddmmss.c` if test $1$2$3 != 4065670 then echo ERROR: wc results of Map/Src/degtoddmmss.c are $* should be 40 65 670 fi chmod 777 Map/Src/degtoddmmss.c echo x - Map/Src/draw.c '[non-ascii]' $unpacker <<'@eof' begin 777 Map/Src/draw.c M(VEN8VQU9&4@/'-T9&EO+F@^"@IM86EN*"D*>PH):6YT"5@["@EI;G0)63L* M"6EN= E836EN(#T@,#L*"6EN= E936EN(#T@,#L*"6EN= E836%X(#T@-3 P M.PH):6YT"5E-87@@/2 U,# ["@H):6YT"5!E;CL*"@EF;&]A= E84V-A;&4@ M/2 Q+C0R.PH)9FQO870)65-C86QE(#T@,2XP,#L*"@ED;W5B;&4)6$-O;W)D M:6YA=&4["@ED;W5B;&4)64-O;W)D:6YA=&4["@H);W!E;G!L*"D["@EE<F%S M92@I.PH)<W!A8V4H,"PP+#4P,"PU,# I.PH);6]V92@Q+#$I.PH)8V]N="@Q M+#0W-2D["@EC;VYT*#8Y-2PT-S4I.PH)8V]N="@V.34L,2D["@EC;VYT*#$L M,2D["@H)=VAI;&4H<V-A;F8H(B5L9B E;&8@)60B+"980V]O<F1I;F%T92PF M64-O;W)D:6YA=&4L)E!E;BD@(3T@14]&*0H)>PH)"5@@/2!80V]O<F1I;F%T M92HV.30K,3L*"0E9(#T@64-O;W)D:6YA=&4J-#<T*S$["@D):68@*%!E;B ] M/2 @,"D@;6]V92A8+%DI.PH)"65L<V4@8V]N="A8+%DI.PH)?0H*"6-L;W-E 1<&PH*3L*"65X:70H,"D["GT) end @eof set `wc -lwc <Map/Src/draw.c` if test $1$2$3 != 3869512 then echo ERROR: wc results of Map/Src/draw.c are $* should be 38 69 512 fi chmod 777 Map/Src/draw.c echo x - Map/Src/frame.c sed 's/^@//' >Map/Src/frame.c <<'@EOF' #include <stdio.h> #include "types.h" Frame(WIN,FP) TypOfSpaceDefinition WIN; TypOfFrameParameters FP; { TypOfChar LineMode[15]; move(0,0); LineType(FP.FramePattern/10,LineMode); linemod(LineMode); color(FP.FramePattern%10); window(WIN.MinX-10,WIN.MinY-10,WIN.MaxX+10,WIN.MaxY+10); box(WIN.MinX,WIN.MinY,WIN.MaxX,WIN.MaxY); move(0,0); return(OK); } @EOF set `wc -lwc <Map/Src/frame.c` if test $1$2$3 != 2121400 then echo ERROR: wc results of Map/Src/frame.c are $* should be 21 21 400 fi chmod 777 Map/Src/frame.c echo x - Map/Src/geoposi.c cat >Map/Src/geoposi.c <<'@EOF' #include <stdio.h> #include "types.h" TypOfDouble GeoPosition(String) TypOfPtrToChar String; { TypOfInt Degrees; TypOfInt Minutes; TypOfInt Seconds; sscanf(String,"%2d%2d%2d",&Degrees,&Minutes,&Seconds); return(Degrees+(Minutes/60.0)+(Seconds/3600.0)); } @EOF set `wc -lwc <Map/Src/geoposi.c` if test $1$2$3 != 1718300 then echo ERROR: wc results of Map/Src/geoposi.c are $* should be 17 18 300 fi chmod 777 Map/Src/geoposi.c echo x - Map/Src/getargs.c cat >Map/Src/getargs.c <<'@EOF' #include <stdio.h> #include "types.h" TypOfInt GetArguments(ArgC,ArgV,EP,MP,OP,BP,TP,LP,CP,FP) TypOfInt ArgC; TypOfPtrToChar ArgV[]; TypOfEnvironmentParameters *EP; TypOfMapParameters *MP; TypOfOptionParameters *OP; TypOfBorderParameters *BP; TypOfTicParameters *TP; TypOfLabelParameters *LP; TypOfCommentParameters *CP; TypOfFrameParameters *FP; { TypOfInt ArgN; ArgC--; ArgN = 1; while(ArgN <= ArgC) { switch(ArgV[ArgN][1]) { case 'r': GetRegionArguments(ArgV,&ArgN,EP); break; case 'b': GetBorderArguments(ArgV,&ArgN,MP,BP); break; case 't': GetTicArguments(ArgV,&ArgN,MP,TP); break; case 'l': GetLabelArguments(ArgV,&ArgN,MP,LP); break; case 'o': GetOptionArguments(ArgV,&ArgN,MP,OP); break; case 'w': GetWindowArguments(ArgV,&ArgN,EP); break; case 'e': GetEraseArguments(MP); break; case 'f': GetFrameArguments(MP); break; case 'c': GetCommentArguments(ArgV,&ArgN,MP,CP); break; case 'p': GetPatternArguments(ArgV,&ArgN,OP,BP,TP,LP,CP,FP); break; } ArgN++; } return; } TypOfInt GetRegionArguments(ArgV,ArgN,EP) TypOfPtrToChar ArgV[]; TypOfInt *ArgN; TypOfEnvironmentParameters *EP; { TypOfDouble GeoPosition(); (*ArgN)++; (*EP).EnvMinLatitude = GeoPosition(ArgV[*ArgN]); (*ArgN)++; (*EP).EnvMaxLatitude = GeoPosition(ArgV[*ArgN]); (*ArgN)++; (*EP).EnvMinLongitude = GeoPosition(ArgV[*ArgN]); (*ArgN)++; (*EP).EnvMaxLongitude = GeoPosition(ArgV[*ArgN]); return; } TypOfInt GetOptionArguments(ArgV,ArgN,MP,OP) TypOfPtrToChar ArgV[]; TypOfInt *ArgN; TypOfMapParameters *MP; TypOfOptionParameters *OP; { TypOfPtrToChar NewNodePtr; (*MP).OptionSelected = YES; NewNodePtr = malloc(sizeof(TypOfNodeForOptionParameters)); if((*OP).CountOfOptionList == 0) { (*OP).HeadOfOptionList = NewNodePtr; (*OP).TailOfOptionList = NewNodePtr; } else { (*(*OP).TailOfOptionList).OptionNextPointer = NewNodePtr; (*OP).TailOfOptionList = NewNodePtr; } ((*OP).CountOfOptionList)++; (*ArgN)++; sscanf(ArgV[*ArgN],"%s",(*(*OP).TailOfOptionList).OptionName); (*ArgN)++; strcpy((*(*OP).TailOfOptionList).OptionArgumentString,ArgV[*ArgN]); (*(*OP).TailOfOptionList).OptionPattern = (*OP).DefaultOptionPattern; (*(*OP).TailOfOptionList).OptionNextPointer = NULL; return; } TypOfInt GetBorderArguments(ArgV,ArgN,MP,BP) TypOfPtrToChar ArgV[]; TypOfInt *ArgN; TypOfMapParameters *MP; TypOfBorderParameters *BP; { (*MP).BorderSelected = YES; (*ArgN)++; strcpy((*BP).BorderDataFile,ArgV[*ArgN]); return; } TypOfInt GetTicArguments(ArgV,ArgN,MP,TP) TypOfPtrToChar ArgV[]; TypOfInt *ArgN; TypOfMapParameters *MP; TypOfTicParameters *TP; { TypOfDouble GeoPosition(); (*MP).TicSelected = YES; (*ArgN)++; (*TP).TicLatitudinalIncrement = GeoPosition(ArgV[*ArgN]); (*ArgN)++; (*TP).TicLongitudinalIncrement = GeoPosition(ArgV[*ArgN]); return; } TypOfInt GetLabelArguments(ArgV,ArgN,MP,LP) TypOfPtrToChar ArgV[]; TypOfInt *ArgN; TypOfMapParameters *MP; TypOfLabelParameters *LP; { TypOfDouble GeoPosition(); (*MP).LabelSelected = YES; (*ArgN)++; (*LP).LabelLatitudinalInterval = GeoPosition(ArgV[*ArgN]); (*ArgN)++; (*LP).LabelLongitudinalInterval = GeoPosition(ArgV[*ArgN]); return; } TypOfInt GetCommentArguments(ArgV,ArgN,MP,CP) TypOfPtrToChar ArgV[]; TypOfInt *ArgN; TypOfMapParameters *MP; TypOfCommentParameters *CP; { (*MP).CommentSelected = YES; (*ArgN)++; strcpy((*CP).CommentText,ArgV[*ArgN]); return; } TypOfInt GetWindowArguments(ArgV,ArgN,EP) TypOfPtrToChar ArgV[]; TypOfInt *ArgN; TypOfEnvironmentParameters *EP; { (*ArgN)++; sscanf(ArgV[*ArgN],"%f",&((*EP).EnvMinX)); (*ArgN)++; sscanf(ArgV[*ArgN],"%f",&((*EP).EnvMaxX)); (*ArgN)++; sscanf(ArgV[*ArgN],"%f",&((*EP).EnvMinY)); (*ArgN)++; sscanf(ArgV[*ArgN],"%f",&((*EP).EnvMaxY)); return; } TypOfInt GetEraseArguments(MP) TypOfMapParameters *MP; { (*MP).EraseSelected = YES; return; } TypOfInt GetFrameArguments(MP) TypOfMapParameters *MP; { (*MP).FrameSelected = YES; return; } TypOfInt GetPatternArguments(ArgV,ArgN,OP,BP,TP,LP,CP,FP) TypOfPtrToChar ArgV[]; TypOfInt *ArgN; TypOfOptionParameters *OP; TypOfBorderParameters *BP; TypOfTicParameters *TP; TypOfLabelParameters *LP; TypOfCommentParameters *CP; TypOfFrameParameters *FP; { switch(ArgV[*ArgN][2]) { case 'o': (*ArgN)++; sscanf(ArgV[*ArgN],"%d",&((*OP).DefaultOptionPattern)); break; case 'b': (*ArgN)++; sscanf(ArgV[*ArgN],"%d",&((*BP).BorderPattern)); break; case 't': (*ArgN)++; sscanf(ArgV[*ArgN],"%d",&((*TP).TicPattern)); break; case 'l': (*ArgN)++; sscanf(ArgV[*ArgN],"%d",&((*LP).LabelPattern)); break; case 'c': (*ArgN)++; sscanf(ArgV[*ArgN],"%d",&((*CP).CommentPattern)); break; case 'f': (*ArgN)++; sscanf(ArgV[*ArgN],"%d",&((*FP).FramePattern)); break; } return; } /* TypOfDouble GeoPosition(String) TypOfPtrToChar String; { TypOfInt Degrees; TypOfInt Minutes; TypOfInt Seconds; sscanf(String,"%2d%2d%2d",&Degrees,&Minutes,&Seconds); return(Degrees+(Minutes/60.0)+(Seconds/3600.0)); } */ @EOF set `wc -lwc <Map/Src/getargs.c` if test $1$2$3 != 3213625756 then echo ERROR: wc results of Map/Src/getargs.c are $* should be 321 362 5756 fi chmod 777 Map/Src/getargs.c echo x - Map/Src/gtermcap '[non-ascii]' $unpacker <<'@eof' begin 777 Map/Src/gtermcap M:61S?" Z8W<].2 Z8V@],3 @.FQH/3$X(#IM=STW.3D@.G-W/38S.2 Z<V@] M-C,Y(#IS=#TQ(#IF;#TQ(#IC;#TP(#HA"F5P<WP@.F-W/3D@.F-H/3$P(#IL M:#TQ." Z;7<]-S$Y(#IS=STU.3D@.G-H/30W.2 Z<W0],2 Z9FP],2 Z8VP] M," Z(0ID96-\(#IC=STY(#IC:#TQ," Z;&@],3@@.FUW/38S.2 Z<W<]-#@P M(#IS:#TY-3D@.G-T/3$@.F9L/3$@.F-L/3 @.B$*-# Q-'P@.F-W/34S(#IC M:#TU.2 Z;&@]-S@@.FUW/30P-38@.G-W/3,Q,C @.G-H/3,Q,C @.G-T/3$@ M.F9L/3 @.F-L/3 @.B$*<&-\(#IC=STX(#IC:#TX(#IL:#TQ," Z;7<]-C(P M(#IS=STT.# @.G-H/3(P," Z<W0],2 Z9FP],2 Z8VP]," Z(0IC<&-\(#IC M=STX(#IC:#TX(#IL:#TQ," Z;7<],S$P(#IS=STR-# @.G-H/3(P," Z<W0] M,2 Z9FP],2 Z8VP],2 Z(0IG;V=O?" Z8W<],30@.F-H/3(T(#IL:#TS," Z M;7<],3 R,R Z<W<]-3$R(#IS:#TU,3(@.G-T/3$@.F9L/3$@.F-L/3 @.B$* M<')O?" Z8W<],3(@.F-H/3<@.FQH/3$P(#IM=STY-C @.G-W/38T," Z<V@] M,C,Y(#IS=#TQ(#IF;#TQ(#IC;#TP(#HA"F-P<F]\(#IC=STQ,B Z8V@]-R Z M;&@],3 @.FUW/3DV," Z<W<]-C0P(#IS:#TR,SD@.G-T/3$@.F9L/3$@.F-L M/3$@.B$*:'!\(#IC=STX(#IC:#TX(#IL:#TQ-2 Z;7<]-S$T(#IS=STU,# @ M.G-H/34P," Z<W0]," Z9FP]," Z8VP],2 Z(0IL<'9\(#IC=STX(#IC:#TX M(#IL:#TQ-2 Z;7<]-S$T(#IS=STU,# @.G-H/34P," Z<W0]," Z9FP]," Z M8VP],2 Z(0IR8FAC?" Z8W<]." Z8V@]." Z;&@],3 @.FUW/3@S.2 Z<W<] M-#@P(#IS:#TR-# @.G-T/3$@.F9L/3$@.F-L/3$@.B$*<F)H9WP@.F-W/3@@ M.F-H/3@@.FQH/3$P(#IM=STX,SD@.G-W/30X," Z<V@],C0P(#IS=#TQ(#IF M;#TQ(#IC;#TQ(#HA"G)B:&U\(#IC=STX(#IC:#TX(#IL:#TQ," Z;7<].#,Y M(#IS=STT.# @.G-H/3(T," Z<W0],2 Z9FP],2 Z8VP]," Z(0IR8FQC?" Z M8W<]." Z8V@]." Z;&@],3 @.FUW/3,X,R Z<W<],C0P(#IS:#TR-# @.G-T M/3$@.F9L/3$@.F-L/3$@.B$*<F)L9WP@.F-W/3@@.F-H/3@@.FQH/3$P(#IM M=STS.#,@.G-W/3(T," Z<V@],C0P(#IS=#TQ(#IF;#TQ(#IC;#TQ(#HA"G)B M;&U\(#IC=STX(#IC:#TX(#IL:#TQ," Z;7<],S@S(#IS=STR-# @.G-H/3(T M," Z<W0],2 Z9FP],2 Z8VP]," Z(0IX?" Z8W<].2 Z8V@],3 @.FQH/3$X M(#IM=STW.3D@.G-W/38S.2 Z<V@]-C,Y(#IS=#TQ(#IF;#TQ(#IC;#TQ(#HA M"G-U;GP@.F-W/3D@.F-H/3$P(#IL:#TQ." Z;7<]-C,Y(#IS=STV,SD@.G-H 9/38S.2 Z<W0],2 Z9FP],2 Z8VP],2 Z(2 Z end @eof set `wc -lwc <Map/Src/gtermcap` if test $1$2$3 != 182091330 then echo ERROR: wc results of Map/Src/gtermcap are $* should be 18 209 1330 fi chmod 777 Map/Src/gtermcap echo x - Map/Src/gtermcap.c cat >Map/Src/gtermcap.c <<'@EOF' #include <stdio.h> #include "types.h" extern TypOfPtrToChar environ[]; TypOfGraphicsTerminalCapabilities GraphicsTerminalCapabilities() { FILE *Ptr; FILE *fopen(); TypOfPtrToChar F0 = " %s"; TypOfPtrToChar F1 = " :cw=%d :ch=%d :lh=%d"; TypOfPtrToChar F2 = " :mw=%d :sw=%d :sh=%d"; TypOfPtrToChar F3 = " :st=%d :fl=%d :cl=%d"; TypOfPtrToChar F4 = " %*s"; TypOfPtrToChar getenv(); TypOfPtrToChar GTEnvVar = "GTERM"; TypOfPtrToChar GTCFName = "/usr/hafdjup/jvts/mappro/gtermcap"; TypOfPtrToChar CTN; TypOfChar TN[FNAMELEN]; TypOfInt CW,CH,LH,MW,SW,SH,ST,FL,CL; TypOfInt Status; TypOfGraphicsTerminalCapabilities TempGTC; CTN = getenv(GTEnvVar); if (CTN == NULL) { fprintf(stderr,"Error: cannot read %s ",GTEnvVar); exit(ERROR); } else { Ptr = fopen(GTCFName,"r"); if (Ptr == NULL) { fprintf(stderr,"Error: cannot open %s\n",GTCFName); exit(ERROR); } else { Status = fscanf(Ptr,F0,TN); while((Status == 1) && (strncmp(TN,CTN,strlen(CTN)) != 0)) { fscanf(Ptr,F1,&CW,&CH,&LH); fscanf(Ptr,F2,&MW,&SW,&SH); fscanf(Ptr,F3,&ST,&FL,&CL); fscanf(Ptr,F4); Status = fscanf(Ptr,F0,TN); } if (Status == EOF) { fprintf(stderr,"Error: missing device description "); fprintf(stderr,"for %s ",CTN); fprintf(stderr,"in file %s\n",GTCFName); exit(ERROR); } else if (Status == NULL) { fprintf(stderr,"Error: an error occurred "); fprintf(stderr,"while reading the file "); fprintf(stderr,"%s\n",GTCFName); exit(ERROR); } else { fscanf(Ptr,F1,&CW,&CH,&LH); fscanf(Ptr,F2,&MW,&SW,&SH); fscanf(Ptr,F3,&ST,&FL,&CL); fscanf(Ptr,F4); TempGTC.ChrWidth = CW; TempGTC.ChrHeight = CH; TempGTC.LinHeight = LH; TempGTC.ScrMaxWidth = MW; TempGTC.ScrWidth = SW; TempGTC.ScrHeight = SH; TempGTC.RasterSupport = ST; TempGTC.FillSupport = FL; TempGTC.ColorSupport = CL; } } } fclose(Ptr); return(TempGTC); } @EOF set `wc -lwc <Map/Src/gtermcap.c` if test $1$2$3 != 971932071 then echo ERROR: wc results of Map/Src/gtermcap.c are $* should be 97 193 2071 fi chmod 777 Map/Src/gtermcap.c echo x - Map/Src/iniparms.c cat >Map/Src/iniparms.c <<'@EOF' #include <stdio.h> #include "types.h" TypOfInt InitParameters(EP,MP,OP,BP,TP,LP,CP,FP) TypOfEnvironmentParameters *EP; TypOfMapParameters *MP; TypOfOptionParameters *OP; TypOfBorderParameters *BP; TypOfTicParameters *TP; TypOfLabelParameters *LP; TypOfCommentParameters *CP; TypOfFrameParameters *FP; { InitEnvironmentParameters(EP); InitMapParameters(MP); InitOptionParameters(OP); InitBorderParameters(BP); InitTicParameters(TP); InitLabelParameters(LP); InitCommentParameters(CP); InitFrameParameters(FP); return(OK); } TypOfInt InitEnvironmentParameters(EP) TypOfEnvironmentParameters *EP; { (*EP).EnvMinX = 0.0; (*EP).EnvMinY = 0.0; (*EP).EnvMaxX = 1.0; (*EP).EnvMaxY = 1.0; (*EP).EnvMinLongitude = 10.000; (*EP).EnvMaxLongitude = 28.000; (*EP).EnvMinLatitude = 62.000; (*EP).EnvMaxLatitude = 68.000; return; } TypOfInt InitMapParameters(MP) TypOfMapParameters *MP; { (*MP).EraseSelected = NO; (*MP).OptionSelected = NO; (*MP).BorderSelected = NO; (*MP).TicSelected = NO; (*MP).LabelSelected = NO; (*MP).CommentSelected = NO; (*MP).FrameSelected = NO; return; } TypOfInt InitOptionParameters(OP) TypOfOptionParameters *OP; { (*OP).HeadOfOptionList = NULL; (*OP).TailOfOptionList = NULL; (*OP).CountOfOptionList = 0; (*OP).DefaultOptionPattern = 0; return; } TypOfInt InitBorderParameters(BP) TypOfBorderParameters *BP; { (*BP).BorderPattern = 0; return; } TypOfInt InitTicParameters(TP) TypOfTicParameters *TP; { (*TP).TicPattern = 0; return; } TypOfInt InitLabelParameters(LP) TypOfLabelParameters *LP; { (*LP).LabelPattern = 0; return; } TypOfInt InitCommentParameters(CP) TypOfCommentParameters *CP; { (*CP).CommentPattern = 0; return; } TypOfInt InitFrameParameters(FP) TypOfFrameParameters *FP; { (*FP).FramePattern = 0; return; } @EOF set `wc -lwc <Map/Src/iniparms.c` if test $1$2$3 != 1321611994 then echo ERROR: wc results of Map/Src/iniparms.c are $* should be 132 161 1994 fi chmod 777 Map/Src/iniparms.c echo x - Map/Src/label.c cat >Map/Src/label.c <<'@EOF' #include <stdio.h> #include "types.h" Label(WIN,ARE,CHA,GEO,LB) TypOfSpaceDefinition WIN; TypOfSpaceDefinition ARE; TypOfFontDefinition CHA; TypOfGeographicalDefinition GEO; TypOfLabelParameters LB; { TypOfDouble Mercator(); TypOfInt DeltaX; TypOfInt DeltaY; TypOfFloat DeltaLongitude; TypOfFloat DeltaLatitude; TypOfFloat FactorX; TypOfFloat FactorY; TypOfInt LongitudeLabelNum; TypOfInt LatitudeLabelNum; TypOfDouble LabelLongitude; TypOfDouble LabelLatitude; TypOfInt X; TypOfInt Y; TypOfInt NumDigits(); TypOfInt XLabelLength; TypOfInt YLabelLength; TypOfChar LString[30]; TypOfChar LineMode[15]; window(WIN.MinX,WIN.MinY,WIN.MaxX,WIN.MaxY); LineType(LB.LabelPattern/10,LineMode); linemod(LineMode); color(LB.LabelPattern%10); DeltaX = ARE.MaxX - ARE.MinX; DeltaLongitude = GEO.MaxLongitude - GEO.MinLongitude; FactorX = DeltaX/DeltaLongitude; DeltaY = ARE.MaxY - ARE.MinY; DeltaLatitude = Mercator(GEO.MaxLatitude) - Mercator(GEO.MinLatitude); FactorY = DeltaY/DeltaLatitude; XLabelLength = NumDigits(LB.LabelLongitudinalInterval); LongitudeLabelNum = (GEO.MinLongitude / LB.LabelLongitudinalInterval) + 1; while(LongitudeLabelNum * LB.LabelLongitudinalInterval < GEO.MaxLongitude) { LabelLongitude = LongitudeLabelNum * LB.LabelLongitudinalInterval; X = (FactorX*(GEO.MaxLongitude-LabelLongitude)); X = X+ARE.MinX-CHA.CharWidth*(XLabelLength/2); Y = ARE.MaxY+(0.5*CHA.CharHeight); move(X,Y); LabelString(LString,LabelLongitude,XLabelLength); label(LString); LongitudeLabelNum++; } YLabelLength = NumDigits(LB.LabelLatitudinalInterval); LatitudeLabelNum = (GEO.MinLatitude / LB.LabelLatitudinalInterval) + 1; while(LatitudeLabelNum * LB.LabelLatitudinalInterval < GEO.MaxLatitude) { LabelLatitude = LatitudeLabelNum * LB.LabelLatitudinalInterval; Y = FactorY*(Mercator(LabelLatitude)-Mercator(GEO.MinLatitude)); X = ARE.MinX-(CHA.CharWidth*(YLabelLength+0.5)); Y = Y+ARE.MinY-(CHA.CharWidth*0.5); move(X,Y); LabelString(LString,LabelLatitude,YLabelLength); label(LString); LatitudeLabelNum++; } fflush(stdout); return(OK); } LabelString(LString,Number,Length) TypOfPtrToChar LString; TypOfDouble Number; TypOfInt Length; { TypOfLong Integer; TypOfChar String[10]; switch(Length) { case 2: Integer = Number; sprintf(String,"%2ld\0",Integer); break; case 4: Integer = 100*((int) Number)+60*(Number-((int) Number)); sprintf(String,"%4ld\0",Integer); break; case 6: Integer = 10000*((int) Number)+3600*(Number-((int) Number)); sprintf(String,"%6ld\0",Integer); break; } strcpy(LString,String); } TypOfInt NumDigits(Increment) TypOfDouble Increment; { TypOfInt Number; if(Increment < 0.06) { Number = 6; } else { if(Increment < 1.0) { Number = 4; } else { Number = 2; } } return(Number); } @EOF set `wc -lwc <Map/Src/label.c` if test $1$2$3 != 1432313357 then echo ERROR: wc results of Map/Src/label.c are $* should be 143 231 3357 fi chmod 777 Map/Src/label.c echo x - Map/Src/lbxy.c '[non-ascii]' $unpacker <<'@eof' begin 777 Map/Src/lbxy.c M(VEN8VQU9&4@/'-T9&EO+F@^"B-I;F-L=61E(#QM871H+F@^"@IM86EN*"D* M>PH):6YT"5!E;CL*"@ED;W5B;&4)6#L*"61O=6)L90E9.PH*"61O=6)L90E- M97)C871O<B@I.PH*"61O=6)L90E,36EN+"!"36EN.PH)9&]U8FQE"4Q-87@L M($)-87@["@ED;W5B;&4)3$QO8RP@0DQO8SL*"61O=6)L90E,4W!A;BP@0E-P M86X["@H)0DUI;B ](#8R+C<U,# P.PH)3$UI;B ](#$P+C P,# P.PH)0DUA M>" ](#8X+C P,# P.PH)3$UA>" ](#(X+C P,# P.PH)3%-P86X@/2!,36%X M+4Q-:6X["@E"4W!A;B ]($UE<F-A=&]R*$)-87@I+4UE<F-A=&]R*$)-:6XI M.PH*( EW:&EL92AS8V%N9B@B)6QF("5L9B E9"(L("9,3&]C+" F0DQO8RP@ M)E!E;BD@(3T@14]&*0H)>PH)"5@@/2 Q+C M*"A,3&]C+4Q-:6XI+TQ3<&%N M*3L*"0E9(#T@*$UE<F-A=&]R*$),;V,I+4UE<F-A=&]R*$)-:6XI*2]"4W!A M;CL*"0EP<FEN=&8H(B5F("5F("5D(%QN(BQ8+%DL(%!E;BD["@E]"@EE>&ET M*# I.PI]"@H@"F1O=6)L92!-97)C871O<BA0;W-I=&EO;BD*9&]U8FQE"5!O M<VET:6]N.PI["@ED;W5B;&4)4F%D*"D["@ED;W5B;&4)1F]U<G1Y1FEV92 ] M(#0U+C ["@ED;W5B;&4)0V]N<W1A;G0@/2 P+C Q-S0U,S,["@H)<F5T=7)N M*#(N,"HR+C,P,C8J=&%N*%)A9"A0;W-I=&EO;B\R+C I*2D["B\J"7)E='5R M;BAL;V<Q,"AT86XH4F%D*$9O=7)T>49I=F4I*U)A9"A0;W-I=&EO;B\R+C I M*2DI.PDJ+PI]"@D*"F1O=6)L92!2860H1&5G<F5E<RD*9&]U8FQE"41E9W)E M97,["GL*"61O=6)L90E0:2 ](#,N,30Q-3D["@H)<F5T=7)N*%!I*BA$96=R .965S+S$X,"XP*2D["GU0 end @eof set `wc -lwc <Map/Src/lbxy.c` if test $1$2$3 != 5298824 then echo ERROR: wc results of Map/Src/lbxy.c are $* should be 52 98 824 fi chmod 777 Map/Src/lbxy.c echo x - Map/Src/linetype.c cat >Map/Src/linetype.c <<'@EOF' #include "types.h" void LineType(Selector,TempLineType) TypOfInt Selector; TypOfPtrToChar TempLineType; { switch(Selector%5) { case 0: strcpy(TempLineType,"solid"); break; case 1: strcpy(TempLineType,"dotted"); break; case 2: strcpy(TempLineType,"longdashed"); break; case 3: strcpy(TempLineType,"shortdashed"); break; case 4: strcpy(TempLineType,"dotdashed"); break; } } @EOF set `wc -lwc <Map/Src/linetype.c` if test $1$2$3 != 2833450 then echo ERROR: wc results of Map/Src/linetype.c are $* should be 28 33 450 fi chmod 777 Map/Src/linetype.c echo x - Map/Src/map.c sed 's/^@//' >Map/Src/map.c <<'@EOF' /* Program:@\MAP Author:@\HugH~nnun s.f. Purpose:@\To draw a map with the options selected by the user. Parameters:@\The VENIX operating system supplies this program with two parameters: (1) the number of arguments specified on the command line when this program was executed; and (2) an array containing a copy of the arguments specified. A detailed description of this can be found in chapter two of 'VENIX PROGRAMMING GUIDE'. Description:@\This program calls a variety of external functions. Some are always called, and some are only called if the user has specified that particular option. An example is the 'tic' function, which is only called when the user wants to make ticmarks on the map's edges. The following external functions are available to this program: @@\@W( InitParameters initializes parameter packets) @@\@W( GetArguments gets and processes user arguments) @@\@W( SetEnvironment sets up the drawing environment) @@\@W( SetUpPlotter initializes the plotter and draws a box) @@\@W( Frame draws a frame arround the whole map) @@\@W( Border draws coastal outlines) @@\@W( Tic draws lati- and longitudinal ticmarks) @@\@W( Label draws lati- and longitudinal lables) @@\@W( Comment inserts comment text below map) @@\@W( Option calls the special options selected) @@\@W( Finish */ #include <stdio.h> #include "types.h" main(Argc,Argv) TypOfInt Argc; TypOfPtrToChar Argv[]; { TypOfEnvironmentParameters EP; TypOfMapParameters MP; TypOfOptionParameters OP; TypOfBorderParameters BP; TypOfTicParameters TP; TypOfLabelParameters LP; TypOfCommentParameters CP; TypOfFrameParameters FP; TypOfSpaceDefinition WOR; TypOfSpaceDefinition WIN; TypOfSpaceDefinition ARE; TypOfFontDefinition CHA; TypOfGeographicalDefinition GEO; InitParameters(&EP,&MP,&OP,&BP,&TP,&LP,&CP,&FP); GetArguments(Argc,Argv,&EP,&MP,&OP,&BP,&TP,&LP,&CP,&FP); SetEnvironment(EP,MP,LP,CP,&WOR,&WIN,&ARE,&CHA,&GEO); openpl(); SetUpPlotter(WIN,ARE,MP.EraseSelected); if (MP.FrameSelected == YES) Frame(WIN,FP); if (MP.TicSelected == YES) Tic(ARE,GEO,TP); if (MP.LabelSelected == YES) Label(WIN,ARE,CHA,GEO,LP); if (MP.BorderSelected == YES) Border(ARE,GEO,BP); if (MP.CommentSelected == YES) Comment(WIN,ARE,CHA,CP); if (MP.OptionSelected == YES) Option(WOR,WIN,ARE,CHA,GEO,OP); closepl(); exit(OK); } @EOF set `wc -lwc <Map/Src/map.c` if test $1$2$3 != 782682448 then echo ERROR: wc results of Map/Src/map.c are $* should be 78 268 2448 fi chmod 777 Map/Src/map.c echo x - Map/Src/mercator.c '[non-ascii]' $unpacker <<'@eof' begin 777 Map/Src/mercator.c M(VEN8VQU9&4@/&UA=&@N:#X*"F1O=6)L90E-97)C871O<BA0;W-I=&EO;BD* M9&]U8FQE"5!O<VET:6]N.PI["@ED;W5B;&4)4F%D:6%N<R@I.PH)9&]U8FQE M"49O=7)T>49I=F4@/2 T-2XP.PH*"7)E='5R;BAL;V<H=&%N*%)A9&EA;G,H M1F]U<G1Y1FEV92DK4F%D:6%N<RA0;W-I=&EO;B\R+C I*2DI.PI]"@H*9&]U M8FQE"4EN=F5R<V5-97)C871O<BA93&]C871I;VXI"F1O=6)L90E93&]C871I M;VX["GL*"61O=6)L90E$96=R965S*"D["@ED;W5B;&4)1F]U<G1Y1FEV92 ] M(#0U+C ["@H)<F5T=7)N*#(N,"HH1&5G<F5E<RAA=&%N*&5X<"A93&]C871I M;VXI*2DM1F]U<G1Y1FEV92DI.PI]"@H*9&]U8FQE"5)A9&EA;G,H1&5G<F5E M<RD*9&]U8FQE"41E9W)E97,["GL*"61O=6)L90E0:2 ](#,N,30Q-3D["@H) M<F5T=7)N*%!I*BA$96=R965S+S$X,"XP*2D["GT*"@ID;W5B;&4)1&5G<F5E M<RA2861I86YS*0ID;W5B;&4)4F%D:6%N<SL*>PH)9&]U8FQE"5!I(#T@,RXQ E-#$U.3L*"@ER971U<FXH,3@P+C J*%)A9&EA;G,O4&DI*3L*?5!I end @eof set `wc -lwc <Map/Src/mercator.c` if test $1$2$3 != 3750532 then echo ERROR: wc results of Map/Src/mercator.c are $* should be 37 50 532 fi chmod 777 Map/Src/mercator.c echo x - Map/Src/minmax.c cat >Map/Src/minmax.c <<'@EOF' #include <stdio.h> #include "types.h" TypOfInt Minimum(Num1,Num2) TypOfInt Num1; TypOfInt Num2; { if(Num2 < Num1) Num1 = Num2; return(Num1); } TypOfInt Maximum(Num1,Num2) TypOfInt Num1; TypOfInt Num2; { if(Num2 > Num1) Num1 = Num2; return(Num1); } @EOF set `wc -lwc <Map/Src/minmax.c` if test $1$2$3 != 2534307 then echo ERROR: wc results of Map/Src/minmax.c are $* should be 25 34 307 fi chmod 777 Map/Src/minmax.c echo x - Map/Src/op.c cat >Map/Src/op.c <<'@EOF' #include <stdio.h> main(argc,argv) int argc; char *argv[]; { int c; fprintf(stderr,"her er eg i op\n"); while((c = getchar()) != EOF) putchar(c); exit(0); } @EOF set `wc -lwc <Map/Src/op.c` if test $1$2$3 != 1423190 then echo ERROR: wc results of Map/Src/op.c are $* should be 14 23 190 fi chmod 777 Map/Src/op.c echo x - Map/Src/option.c '[non-ascii]' $unpacker <<'@eof' begin 777 Map/Src/option.c M(VEN8VQU9&4@/'-T9&EO+F@^"B-I;F-L=61E(")T>7!E<RYH(@H)"@I4>7!/ M9DEN="!/<'1I;VXH5T]2+%=)3BQ!4D4L0TA!+$=%3RQ/4"D*"@E4>7!/9E-P M86-E1&5F:6YI=&EO;@D)"0D)"0E73U(["@E4>7!/9E-P86-E1&5F:6YI=&EO M;@D)"0D)"0E724X["@E4>7!/9E-P86-E1&5F:6YI=&EO;@D)"0D)"0E!4D4[ M"@E4>7!/9D9O;G1$969I;FET:6]N"0D)"0D)"0E#2$$["@E4>7!/9D=E;V=R M87!H:6-A;$1E9FEN:71I;VX)"0D)1T5/.PH)5'EP3V9/<'1I;VY087)A;65T M97)S"0D)"0D)"4]0.PH*"7L*"0E4>7!/9D-H87()"0D)"0D)"0D)"0E3>7-3 M=');34%85$585$Q%3ET["@H)"51Y<$]F26YT"0D)"0D)"0D)"0D)3W!T:6]N M3G5M.PH)"51Y<$]F3F]D949O<D]P=&EO;E!A<F%M971E<G,)"2I#=7)R96YT M3W!T:6]N.PH*"@D)9F]R*$]P=&EO;DYU;2 ](#$[($]P=&EO;DYU;2 \/2!/ M4"Y#;W5N=$]F3W!T:6]N3&ES=#L@3W!T:6]N3G5M*RLI"@D)>PH)"0E#=7)R M96YT3W!T:6]N(#T@3U N2&5A9$]F3W!T:6]N3&ES=#L*"0D)3U N2&5A9$]F M3W!T:6]N3&ES=" ]("@J0W5R<F5N=$]P=&EO;BDN3W!T:6]N3F5X=%!O:6YT M97(["@D)"7-P<FEN=&8H4WES4W1R+"(E<R E9" E9" E9" E9" E9" E9" E M9" E9" E9" E9" E9" E9" E9" E9" E9" E9B E9B E9B E9B E9" E<UQN M7# B+"@J0W5R<F5N=$]P=&EO;BDN3W!T:6]N3F%M92Q73U(N36EN6"Q73U(N M36%X6"Q73U(N36EN62Q73U(N36%X62Q724XN36EN6"Q724XN36%X6"Q724XN M36EN62Q724XN36%X62Q!4D4N36EN6"Q!4D4N36%X6"Q!4D4N36EN62Q!4D4N M36%X62Q#2$$N0VAA<E=I9'1H+$-(02Y#:&%R2&5I9VAT+$-(02Y,:6YE2&5I M9VAT+$=%3RY-:6Y,;VYG:71U9&4L1T5/+DUA>$QO;F=I='5D92Q'14\N36EN M3&%T:71U9&4L1T5/+DUA>$QA=&ET=61E+"@J0W5R<F5N=$]P=&EO;BDN3W!T M:6]N4&%T=&5R;BPH*D-U<G)E;G1/<'1I;VXI+D]P=&EO;D%R9W5M96YT4W1R M:6YG*3L*"0ES>7-T96TH4WES4W1R*3L*"0E]"@H)"7)E='5R;BA/2RD["@E] !"FYG end @eof set `wc -lwc <Map/Src/option.c` if test $1$2$3 != 30651036 then echo ERROR: wc results of Map/Src/option.c are $* should be 30 65 1036 fi chmod 777 Map/Src/option.c echo x - Map/Src/plotlib.c cat >Map/Src/plotlib.c <<'@EOF' /* A plot(5) library, customised for use with the map program. */ #include <stdio.h> /* index: Returns pointer to s, where t occurs in it. */ char *index(s,t) char *s, t; { if(t == '\0' && *s == t) return(s); if(*s == '\0') return(NULL); if(*s == t) return(s); return(index(s+1,t)); } /* putsi: Writes an integer stored in two ascii bytes to standard output. */ putsi(x) int x; { unsigned short b, b1, b2; b1 = (unsigned short) x; b2 = (unsigned short) x; b1 = b1 << 8; b2 = b2 >> 8; b = b1 | b2; write(1,&b,2); } openpl(){ } closepl(){ } char text[256]; /* The plot(5) library consists of the following routines. */ move(x,y) int x,y; { fprintf(stdout,"m"); fflush(stdout); putsi(x); putsi(y); } cont(x,y) int x,y; { fprintf(stdout,"n"); fflush(stdout); putsi(x); putsi(y); } point(x,y) int x,y; { fprintf(stdout,"p"); fflush(stdout); putsi(x); putsi(y); } line(x0,y0,x1,y1) int x0,y0,x1,y1; { fprintf(stdout,"l"); fflush(stdout); putsi(x0); putsi(y0); putsi(x1); putsi(y1); } label(s) char *s; { strcpy(text,s); strcat(text,"\n"); fprintf(stdout,"t"); fprintf(stdout,"%s",text); fflush(stdout); } arc(x0,y0,x1,y1,x2,y2) int x0,y0,x1,y1,x2,y2; { fprintf(stdout,"a"); fflush(stdout); putsi(x0); putsi(y0); putsi(x1); putsi(y1); putsi(x2); putsi(y2); } circle(x0,y0,r) int x0,y0,r; { fprintf(stdout,"c"); fflush(stdout); putsi(x0); putsi(y0); putsi(r); } erase(){ fprintf(stdout,"e"); fflush(stdout); } linemod(s) char *s; { strcpy(text,s); strcat(text,"\n"); fprintf(stdout,"f"); fprintf(stdout,"%s",text); fflush(stdout); } space(x0,y0,x1,y1) int x0,y0,x1,y1; { fprintf(stdout,"s"); fflush(stdout); putsi(x0); putsi(y0); putsi(x1); putsi(y1); } box(x0,y0,x1,y1) int x0,y0,x1,y1; { fprintf(stdout,"b"); fflush(stdout); putsi(x0); putsi(y0); putsi(x1); putsi(y1); } labelrotation(s) char *s; { strcpy(text,s); strcat(text,"\n"); fprintf(stdout,"r"); fprintf(stdout,"%s",text); fflush(stdout); } labelplace(s) char *s; { strcpy(text,s); strcat(text,"\n"); fprintf(stdout,"u"); fprintf(stdout,"%s",text); fflush(stdout); } linewid(x) int x; { fprintf(stdout,"w"); fflush(stdout); putsi(x); } @EOF set `wc -lwc <Map/Src/plotlib.c` if test $1$2$3 != 1962512479 then echo ERROR: wc results of Map/Src/plotlib.c are $* should be 196 251 2479 fi chmod 666 Map/Src/plotlib.c echo x - Map/Src/qgraph.c cat >Map/Src/qgraph.c <<'@EOF' #include <stdio.h> main(argc,argv) int argc; char *argv[]; { int size; int xcoordinate; int ycoordinate; float x,minx,maxx,xrange; float y,miny,maxy,yrange; char string[100]; if(argc == 5) { sscanf(argv[1],"%f",&minx); sscanf(argv[2],"%f",&maxx); sscanf(argv[3],"%f",&miny); sscanf(argv[4],"%f",&maxy); xrange = maxx - minx; yrange = maxy - miny; openpl(); space(0,0,1000,1000); window(0,0,1000,1000); gets(string); gets(string); while(scanf("%f %f",&x,&y) != EOF) { xcoordinate = ((x-minx)/xrange)*996+2; ycoordinate = ((y-miny)/yrange)*996+2; move(xcoordinate-2,ycoordinate); cont(xcoordinate+2,ycoordinate); move(xcoordinate,ycoordinate-2); cont(xcoordinate,ycoordinate+2); } box(0,0,1000,1000); closepl(); exit(0); } else { fprintf(stderr,"Illegal number of parameters\n"); fprintf(stderr,"Usage is: \"qgraph xmin xmax ymin ymax\"\n"); } } @EOF set `wc -lwc <Map/Src/qgraph.c` if test $1$2$3 != 5078925 then echo ERROR: wc results of Map/Src/qgraph.c are $* should be 50 78 925 fi chmod 777 Map/Src/qgraph.c echo x - Map/Src/setenv.c cat >Map/Src/setenv.c <<'@EOF' #include <stdio.h> #include "types.h" TypOfInt SetEnvironment(EP,MP,LP,CP,WOR,WIN,ARE,CHA,GEO) TypOfEnvironmentParameters EP; TypOfMapParameters MP; TypOfLabelParameters LP; TypOfCommentParameters CP; TypOfSpaceDefinition *WOR; TypOfSpaceDefinition *WIN; TypOfSpaceDefinition *ARE; TypOfFontDefinition *CHA; TypOfGeographicalDefinition *GEO; { SetWorld(WOR); SetCharacterFont(CHA); SetGeographicalRegion(EP,GEO); SetWindow(EP,*WOR,WIN); SetArea(*WIN,*CHA,*GEO,MP,LP,CP,ARE); return(OK); } TypOfInt SetWorld(WOR) TypOfSpaceDefinition *WOR; { TypOfGraphicsTerminalCapabilities GTC; TypOfGraphicsTerminalCapabilities GraphicsTerminalCapabilities(); GTC = GraphicsTerminalCapabilities(); (*WOR).MinX = 0; (*WOR).MinY = 0; (*WOR).MaxX = GTC.ScrMaxWidth/((float) GTC.ScrWidth)*XNUMCOORDINATES/2; (*WOR).MaxY = XNUMCOORDINATES; return; } TypOfInt SetWindow(EP,WOR,WIN) TypOfEnvironmentParameters EP; TypOfSpaceDefinition WOR; TypOfSpaceDefinition *WIN; { (*WIN).MinX = WOR.MaxY*EP.EnvMinX; (*WIN).MaxX = WOR.MaxY*EP.EnvMaxX; (*WIN).MinY = WOR.MaxY*EP.EnvMinY; (*WIN).MaxY = WOR.MaxY*EP.EnvMaxY; return; } TypOfInt SetCharacterFont(CHA) TypOfFontDefinition *CHA; { TypOfGraphicsTerminalCapabilities GTC; TypOfGraphicsTerminalCapabilities GraphicsTerminalCapabilities(); GTC = GraphicsTerminalCapabilities(); (*CHA).CharWidth = GTC.ChrWidth*XNUMCOORDINATES/((float) GTC.ScrWidth); (*CHA).CharHeight = GTC.ChrHeight*XNUMCOORDINATES/((float) GTC.ScrHeight); (*CHA).LineHeight = GTC.LinHeight*XNUMCOORDINATES/((float) GTC.ScrHeight); return; } TypOfInt SetGeographicalRegion(EP,GEO) TypOfEnvironmentParameters EP; TypOfGeographicalDefinition *GEO; { (*GEO).MinLongitude = EP.EnvMinLongitude; (*GEO).MaxLongitude = EP.EnvMaxLongitude; (*GEO).MinLatitude = EP.EnvMinLatitude; (*GEO).MaxLatitude = EP.EnvMaxLatitude; return; } TypOfInt SetArea(WIN,CHA,GEO,MP,LP,CP,ARE) TypOfSpaceDefinition WIN; TypOfFontDefinition CHA; TypOfGeographicalDefinition GEO; TypOfMapParameters MP; TypOfLabelParameters LP; TypOfCommentParameters CP; TypOfSpaceDefinition *ARE; { TypOfInt LeftMargin(); TypOfInt RightMargin(); TypOfInt BottomMargin(); TypOfInt TopMargin(); TypOfFloat Scale(); TypOfFloat ScalingFactor; TypOfInt Delta; (*ARE).MinX = WIN.MinX+LeftMargin(CHA,MP,LP); (*ARE).MaxX = WIN.MaxX-RightMargin(CHA,MP); (*ARE).MinY = WIN.MinY+BottomMargin(CHA,MP,CP); (*ARE).MaxY = WIN.MaxY-TopMargin(CHA,MP); ScalingFactor = Scale(GEO); if (((*ARE).MaxY-(*ARE).MinY) < (ScalingFactor*((*ARE).MaxX-(*ARE).MinX))) { Delta = ((*ARE).MaxY - (*ARE).MinY) / ScalingFactor; (*ARE).MinX = (*ARE).MinX+(((*ARE).MaxX-(*ARE).MinX)-Delta)/2; (*ARE).MaxX = (*ARE).MinX+Delta; } else { Delta = ((*ARE).MaxX - (*ARE).MinX) * ScalingFactor; (*ARE).MinY = (*ARE).MinY+(((*ARE).MaxY-(*ARE).MinY)-Delta)/2; (*ARE).MaxY = (*ARE).MinY+Delta; } return; } TypOfInt LeftMargin(CHA,MP,LP) TypOfFontDefinition CHA; TypOfMapParameters MP; TypOfLabelParameters LP; { TypOfInt M; if(MP.LabelSelected == YES) { M = CHA.CharWidth*(NumDigits(LP.LabelLatitudinalInterval)+1.5); } else { M = 0; } return(M); } TypOfInt RightMargin(CHA,MP) TypOfFontDefinition CHA; TypOfMapParameters MP; { TypOfInt M; M = 0; if(MP.LabelSelected == YES) M = CHA.CharWidth; return(M); } TypOfInt TopMargin(CHA,MP) TypOfFontDefinition CHA; TypOfMapParameters MP; { TypOfInt M; M = 0; if(MP.LabelSelected == YES) M += CHA.CharHeight+CHA.LineHeight; return(M); } TypOfInt BottomMargin(CHA,MP,CP) TypOfFontDefinition CHA; TypOfMapParameters MP; TypOfCommentParameters CP; { TypOfInt M; TypOfInt NumLines(); M = 0; if(MP.LabelSelected == YES) M += CHA.CharHeight; if(MP.CommentSelected == YES) M += (NumLines(CP.CommentText)+1)*CHA.LineHeight; return(M); } TypOfFloat Scale(GEO) TypOfGeographicalDefinition GEO; { TypOfDouble Mercator(); TypOfDouble MinX; TypOfDouble MaxX; TypOfDouble MinY; TypOfDouble MaxY; MinY = Mercator(GEO.MinLatitude); MaxY = Mercator(GEO.MaxLatitude); MinX = GEO.MinLongitude*Mercator((double) 1.0); MaxX = GEO.MaxLongitude*Mercator((double) 1.0); return((MaxY-MinY)/((float) (MaxX-MinX))); } @EOF set `wc -lwc <Map/Src/setenv.c` if test $1$2$3 != 2293414647 then echo ERROR: wc results of Map/Src/setenv.c are $* should be 229 341 4647 fi chmod 777 Map/Src/setenv.c echo x - Map/Src/setup.c cat >Map/Src/setup.c <<'@EOF' #include <stdio.h> #include "types.h" TypOfInt SetUpPlotter(WIN,ARE,ERASE) TypOfSpaceDefinition WIN; TypOfSpaceDefinition ARE; TypOfInt ERASE; { /* -100 og +250 sett til ad baeta utskrift. Breytist af vild */ space(-150,0,XNUMCOORDINATES+250,YNUMCOORDINATES); if(ERASE == YES) erase(); window(WIN.MinX,WIN.MinY,WIN.MaxX,WIN.MaxY); box(ARE.MinX,ARE.MinY,ARE.MaxX,ARE.MaxY); fflush(stdout); return; } @EOF set `wc -lwc <Map/Src/setup.c` if test $1$2$3 != 2136452 then echo ERROR: wc results of Map/Src/setup.c are $* should be 21 36 452 fi chmod 777 Map/Src/setup.c echo x - Map/Src/shade.c cat >Map/Src/shade.c <<'@EOF' #include <stdio.h> #include "types.h" typedef struct StrOfDataForBreakNode { TypOfDouble BreakValue; TypOfDouble ShadeFactor; TypOfInt ShadeType; TypOfPtrToChar NextBreak; } TypOfDataForBreakNode; typedef struct StrOfBreakList { TypOfPtrToChar HeadOfBreakList; TypOfPtrToChar TailOfBreakList; } TypOfBreakList; main(ArgC,ArgV) TypOfInt ArgC; TypOfPtrToChar ArgV[]; { TypOfSpaceDefinition WOR; TypOfSpaceDefinition WIN; TypOfSpaceDefinition ARE; TypOfFontDefinition CHA; TypOfGeographicalDefinition GEO; TypOfInt PAT; TypOfBreakList BLIST; TypOfDouble Mercator(); TypOfDouble GeoPosition(); TypOfFloat FactorX; TypOfFloat FactorY; TypOfInt DeltaX; TypOfInt DeltaY; TypOfDouble DeltaLongitude; TypOfDouble DeltaLatitude; TypOfDouble LoLong; TypOfDouble HiLong; TypOfDouble LoLat; TypOfDouble HiLat; TypOfInt X; TypOfInt Y; TypOfSpaceDefinition S; TypOfDouble Value; TypOfChar InputLine[MAXTEXTLEN]; TypOfChar StrLoLat[10]; TypOfChar StrHiLat[10]; TypOfChar StrLoLong[10]; TypOfChar StrHiLong[10]; TypOfChar LineMode[15]; GetArguments(ArgC,ArgV,&WOR,&WIN,&ARE,&CHA,&GEO,&PAT,&BLIST); window(ARE.MinX,ARE.MinY,ARE.MaxX,ARE.MaxY); LineType(PAT/10,LineMode); linemod(LineMode); color(PAT%10); DeltaX = ARE.MaxX - ARE.MinX; DeltaLongitude = GEO.MaxLongitude - GEO.MinLongitude; FactorX = DeltaX/DeltaLongitude; DeltaY = ARE.MaxY - ARE.MinY; DeltaLatitude = Mercator(GEO.MaxLatitude) - Mercator(GEO.MinLatitude); FactorY = DeltaY/DeltaLatitude; gets(InputLine); gets(InputLine); while(gets(InputLine) != NULL) { sscanf(InputLine,"%s %s",StrLoLat,StrHiLat); LoLat = GeoPosition(StrLoLat); HiLat = GeoPosition(StrHiLat); sscanf(InputLine,"%*s %*s %s %s",StrLoLong,StrHiLong); LoLong = GeoPosition(StrLoLong); HiLong = GeoPosition(StrHiLong); sscanf(InputLine,"%*s %*s %*s %*s %lf",&Value); S.MinX = (FactorX*(GEO.MaxLongitude-HiLong))+ARE.MinX; S.MaxX = (FactorX*(GEO.MaxLongitude-LoLong))+ARE.MinX; S.MinY = (FactorY*(Mercator(LoLat)-Mercator(GEO.MinLatitude)))+ARE.MinY; S.MaxY = (FactorY*(Mercator(HiLat)-Mercator(GEO.MinLatitude)))+ARE.MinY; ShadeArea(WOR,ARE,S,Value,BLIST); } fflush(stdout); exit(OK); } TypOfInt GetArguments(ArgC,ArgV,WOR,WIN,ARE,CHA,GEO,PAT,BLIST) TypOfInt ArgC; TypOfPtrToChar ArgV[]; TypOfSpaceDefinition *WOR; TypOfSpaceDefinition *WIN; TypOfSpaceDefinition *ARE; TypOfFontDefinition *CHA; TypOfGeographicalDefinition *GEO; TypOfInt *PAT; TypOfBreakList *BLIST; { TypOfInt Count; TypOfInt Offset; TypOfPtrToChar PtrToBreakNode; sscanf(ArgV[1],"%d",&((*WOR).MinX)); sscanf(ArgV[2],"%d",&((*WOR).MaxX)); sscanf(ArgV[3],"%d",&((*WOR).MinY)); sscanf(ArgV[4],"%d",&((*WOR).MaxY)); sscanf(ArgV[5],"%d",&((*WIN).MinX)); sscanf(ArgV[6],"%d",&((*WIN).MaxX)); sscanf(ArgV[7],"%d",&((*WIN).MinY)); sscanf(ArgV[8],"%d",&((*WIN).MaxY)); sscanf(ArgV[9],"%d",&((*ARE).MinX)); sscanf(ArgV[10],"%d",&((*ARE).MaxX)); sscanf(ArgV[11],"%d",&((*ARE).MinY)); sscanf(ArgV[12],"%d",&((*ARE).MaxY)); sscanf(ArgV[13],"%d",&((*CHA).CharWidth)); sscanf(ArgV[14],"%d",&((*CHA).CharHeight)); sscanf(ArgV[15],"%d",&((*CHA).LineHeight)); sscanf(ArgV[16],"%lf",&((*GEO).MinLongitude)); sscanf(ArgV[17],"%lf",&((*GEO).MaxLongitude)); sscanf(ArgV[18],"%lf",&((*GEO).MinLatitude)); sscanf(ArgV[19],"%lf",&((*GEO).MaxLatitude)); sscanf(ArgV[20],"%d",&(*PAT)); PtrToBreakNode = malloc(sizeof(TypOfDataForBreakNode)); (*BLIST).HeadOfBreakList = PtrToBreakNode; (*BLIST).TailOfBreakList = PtrToBreakNode; (*(*BLIST).TailOfBreakList).NextBreak = NULL; sscanf(ArgV[21],"%lf",&((*(*BLIST).TailOfBreakList).BreakValue)); sscanf(ArgV[22],"%d",&((*(*BLIST).TailOfBreakList).ShadeType)); sscanf(ArgV[23],"%lf",&((*(*BLIST).TailOfBreakList).ShadeFactor)); for(Count = 1; Count < ((ArgC-21)/3); Count++) { PtrToBreakNode = malloc(sizeof(TypOfDataForBreakNode)); (*(*BLIST).TailOfBreakList).NextBreak = PtrToBreakNode; (*BLIST).TailOfBreakList = PtrToBreakNode; (*(*BLIST).TailOfBreakList).NextBreak = NULL; Offset = 21+(Count*3); sscanf(ArgV[Offset+0],"%lf",&((*(*BLIST).TailOfBreakList).BreakValue)); sscanf(ArgV[Offset+1],"%d",&((*(*BLIST).TailOfBreakList).ShadeType)); sscanf(ArgV[Offset+2],"%lf",&((*(*BLIST).TailOfBreakList).ShadeFactor)); } return; } TypOfInt ShadeArea(WOR,ARE,Square,Value,BLIST) TypOfSpaceDefinition WOR; TypOfSpaceDefinition ARE; TypOfSpaceDefinition Square; TypOfDouble Value; TypOfBreakList BLIST; { TypOfInt Type; TypOfInt Increment; TypOfDataForBreakNode *Default; TypOfDataForBreakNode *CurrentNode; CurrentNode = BLIST.HeadOfBreakList; while((CurrentNode != NULL) && ((*CurrentNode).BreakValue < Value)) { CurrentNode = (*CurrentNode).NextBreak; } if(CurrentNode == NULL) { fprintf(stderr,"Error: The value %f is greater than the ",Value); fprintf(stderr,"highest breakpoint; it has been ignored\n"); exit(ERROR); } else { if((*CurrentNode).BreakValue == 0.0) { return; } else { Type = (*CurrentNode).ShadeType; Increment = WOR.MaxY/((float ) (*CurrentNode).ShadeFactor)+0.5; box(Square.MinX,Square.MinY,Square.MaxX,Square.MaxY); if((Type/1000) == 1) Vertical(ARE,Square,Increment); if(((Type%1000)/100) == 1) Horizontal(ARE,Square,Increment); if((((Type%1000)%100)/10) == 1) Right(ARE,Square,Increment); if(((((Type%1000)%100)%10)/1) == 1) Left(Square,Increment); } } return; } TypOfInt Vertical(ARE,Square,Increment) TypOfSpaceDefinition ARE; TypOfSpaceDefinition Square; TypOfInt Increment; { TypOfInt Offset; Offset = 0; while(Square.MinX+Offset <= Square.MaxX) { move(Square.MinX+Offset,Square.MinY); cont(Square.MinX+Offset,Square.MaxY); Offset += Increment; } } TypOfInt Horizontal(ARE,Square,Increment) TypOfSpaceDefinition ARE; TypOfSpaceDefinition Square; TypOfInt Increment; { TypOfInt Offset; Offset = 0; while(Square.MinY+Offset <= Square.MaxY) { move(Square.MinX,Square.MinY+Offset); cont(Square.MaxX,Square.MinY+Offset); Offset += Increment; } return; } TypOfInt Right(ARE,Square,Increment) TypOfSpaceDefinition ARE; TypOfSpaceDefinition Square; TypOfInt Increment; { TypOfInt DeltaX; TypOfInt DeltaY; TypOfInt Offset; TypOfDouble sqrt(); Increment = Increment*sqrt((double) 2.0)+0.5; DeltaX = Square.MaxX-Square.MinX; DeltaY = Square.MaxY-Square.MinY; Offset = 0; while(((Offset-DeltaY) < DeltaX) && ((Offset-DeltaX) < DeltaY)) { if(Offset > DeltaX) { move(Square.MinX,Square.MinY+(Offset-DeltaX)); } else { move(Square.MaxX-Offset,Square.MinY); } if(Offset > DeltaY) { cont(Square.MaxX-(Offset-DeltaY),Square.MaxY); } else { cont(Square.MaxX,Square.MinY+Offset); } Offset += Increment; } return; } TypOfInt Left(ARE,Square,Increment) TypOfSpaceDefinition ARE; TypOfSpaceDefinition Square; TypOfInt Increment; { TypOfInt DeltaX; TypOfInt DeltaY; TypOfInt Offset; TypOfDouble sqrt(); Increment = Increment*sqrt((double) 2.0)+0.5; DeltaX = Square.MaxX-Square.MinX; DeltaY = Square.MaxY-Square.MinY; Offset = 0; while(((Offset-DeltaY) < DeltaX) && ((Offset-DeltaX) < DeltaY)) { if(Offset > DeltaX) { move(Square.MaxX,Square.MinY+(Offset-DeltaX)); } else { move(Square.MinX+Offset,Square.MinY); } if(Offset > DeltaY) { cont(Square.MinX+(Offset-DeltaY),Square.MaxY); } else { cont(Square.MinX,Square.MinY+Offset); } Offset += Increment; } return; } @EOF set `wc -lwc <Map/Src/shade.c` if test $1$2$3 != 3715358150 then echo ERROR: wc results of Map/Src/shade.c are $* should be 371 535 8150 fi chmod 777 Map/Src/shade.c echo x - Map/Src/station.c cat >Map/Src/station.c <<'@EOF' #include <stdio.h> #include "types.h" main(ArgC,ArgV) TypOfInt ArgC; TypOfPtrToChar ArgV[]; { TypOfSpaceDefinition WOR; TypOfSpaceDefinition WIN; TypOfSpaceDefinition ARE; TypOfFontDefinition CHA; TypOfGeographicalDefinition GEO; TypOfInt PAT; TypOfDouble Mercator(); TypOfFloat FactorX; TypOfFloat FactorY; TypOfInt DeltaX; TypOfInt DeltaY; TypOfDouble DeltaLongitude; TypOfDouble DeltaLatitude; TypOfDouble Longitude; TypOfDouble Latitude; TypOfInt X; TypOfInt Y; TypOfInt Delta; TypOfInt Minimum(); TypOfChar InputLine[MAXTEXTLEN]; TypOfChar StrLatitude[10]; TypOfChar StrLongitude[10]; TypOfDouble GeoPosition(); TypOfInt Symbol; TypOfInt Z; TypOfInt y; TypOfFloat dev; TypOfChar LineMode[15]; GetArguments(ArgC,ArgV,&WOR,&WIN,&ARE,&CHA,&GEO,&PAT); window(ARE.MinX,ARE.MinY,ARE.MaxX,ARE.MaxY); LineType(PAT/10,LineMode); linemod(LineMode); color(PAT%10); DeltaX = ARE.MaxX - ARE.MinX; DeltaLongitude = GEO.MaxLongitude - GEO.MinLongitude; FactorX = DeltaX/DeltaLongitude; DeltaY = ARE.MaxY - ARE.MinY; DeltaLatitude = Mercator(GEO.MaxLatitude) - Mercator(GEO.MinLatitude); FactorY = DeltaY/DeltaLatitude; gets(InputLine); gets(InputLine); if(gets(InputLine) == NULL) { fprintf(stderr,"Error: Input file for \"%s\" is empty\n",ArgV[0]); exit(ERROR); } else { do { sscanf(InputLine,"%s %s %d",StrLatitude,StrLongitude,&Symbol); Latitude = GeoPosition(StrLatitude); Longitude = GeoPosition(StrLongitude); X = (FactorX*(GEO.MaxLongitude-Longitude))+ARE.MinX; Y = (FactorY*(Mercator(Latitude)-Mercator(GEO.MinLatitude)))+ARE.MinY; Delta = SYMBOLSIZE*Minimum((ARE.MaxX-ARE.MinX),(ARE.MaxY-ARE.MinY)); Z = Delta/2; switch(Symbol){ case 1: line(X-Z,Y-Z,X,Y+Z); /*triangle*/ line(X,Y+Z,X+Z,Y-Z); line(X+Z,Y-Z,X-Z,Y-Z); break; case 2: dev = 0.0; /*filled triangle*/ for(y=Y-Z;y<=Y+Z;y++){ line(X-Z+(int)dev,y,X+Z-(int)dev,y); dev+=0.5; } point(X,Y+Z); break; case 3: line(X,Y-Z,X,Y+Z); /*plus*/ line(X-Z,Y,X+Z,Y); break; case 4: line(X-Z,Y+Z,X-Z,Y-Z); /*box*/ line(X-Z,Y-Z,X+Z,Y-Z); line(X+Z,Y-Z,X+Z,Y+Z); line(X+Z,Y+Z,X-Z,Y+Z); break; case 5: for(y=Y-Z;y<=Y+Z;y++) /*filled box*/ line(X-Z,y,X+Z,y); break; case 6: circle(X,Y,Z); /*circle*/ break; case 7: line(X-Z,Y,X,Y-Z); /*diamond*/ line(X,Y-Z,X+Z,Y); line(X+Z,Y,X,Y+Z); line(X,Y+Z,X-Z,Y); break; case 8: line(X-Z,Y-Z,X+Z,Y+Z); /* x */ line(X-Z,Y+Z,X+Z,Y-Z); break; default: line(X,Y-Z,X,Y+Z); /*plus*/ line(X-Z,Y,X+Z,Y); break; } } while(gets(InputLine) != NULL); } fflush(stdout); exit(OK); } TypOfInt GetArguments(ArgC,ArgV,WOR,WIN,ARE,CHA,GEO,PAT) TypOfInt ArgC; TypOfPtrToChar ArgV[]; TypOfSpaceDefinition *WOR; TypOfSpaceDefinition *WIN; TypOfSpaceDefinition *ARE; TypOfFontDefinition *CHA; TypOfGeographicalDefinition *GEO; TypOfInt *PAT; { sscanf(ArgV[1],"%d",&((*WOR).MinX)); sscanf(ArgV[2],"%d",&((*WOR).MaxX)); sscanf(ArgV[3],"%d",&((*WOR).MinY)); sscanf(ArgV[4],"%d",&((*WOR).MaxY)); sscanf(ArgV[5],"%d",&((*WIN).MinX)); sscanf(ArgV[6],"%d",&((*WIN).MaxX)); sscanf(ArgV[7],"%d",&((*WIN).MinY)); sscanf(ArgV[8],"%d",&((*WIN).MaxY)); sscanf(ArgV[9],"%d",&((*ARE).MinX)); sscanf(ArgV[10],"%d",&((*ARE).MaxX)); sscanf(ArgV[11],"%d",&((*ARE).MinY)); sscanf(ArgV[12],"%d",&((*ARE).MaxY)); sscanf(ArgV[13],"%d",&((*CHA).CharWidth)); sscanf(ArgV[14],"%d",&((*CHA).CharHeight)); sscanf(ArgV[15],"%d",&((*CHA).LineHeight)); sscanf(ArgV[16],"%lf",&((*GEO).MinLongitude)); sscanf(ArgV[17],"%lf",&((*GEO).MaxLongitude)); sscanf(ArgV[18],"%lf",&((*GEO).MinLatitude)); sscanf(ArgV[19],"%lf",&((*GEO).MaxLatitude)); sscanf(ArgV[20],"%d",PAT); return; } @EOF set `wc -lwc <Map/Src/station.c` if test $1$2$3 != 1742555648 then echo ERROR: wc results of Map/Src/station.c are $* should be 174 255 5648 fi chmod 777 Map/Src/station.c echo x - Map/Src/symbol.c cat >Map/Src/symbol.c <<'@EOF' #include <stdio.h> #include "types.h" main(ArgC,ArgV) TypOfInt ArgC; TypOfPtrToChar ArgV[]; { TypOfSpaceDefinition WOR; TypOfSpaceDefinition WIN; TypOfSpaceDefinition ARE; TypOfFontDefinition CHA; TypOfGeographicalDefinition GEO; TypOfInt PAT; TypOfInt PlotSymbol(); TypOfDouble Mercator(); TypOfDouble GeoPosition(); TypOfFloat FactorX; TypOfFloat FactorY; TypOfInt DeltaX; TypOfInt DeltaY; TypOfDouble DeltaLongitude; TypOfDouble DeltaLatitude; TypOfDouble Longitude; TypOfDouble Latitude; TypOfInt X; TypOfInt Y; TypOfInt StationType; TypOfChar InputLine[MAXTEXTLEN]; TypOfChar StrLatitude[10]; TypOfChar StrLongitude[10]; TypOfChar LineMode[15]; GetArguments(ArgC,ArgV,&WOR,&WIN,&ARE,&CHA,&GEO,&PAT); window(ARE.MinX,ARE.MinY,ARE.MaxX,ARE.MaxY); LineType(PAT/10,LineMode); linemod(LineMode); color(PAT%10); DeltaX = ARE.MaxX - ARE.MinX; DeltaLongitude = GEO.MaxLongitude - GEO.MinLongitude; FactorX = DeltaX/DeltaLongitude; DeltaY = ARE.MaxY - ARE.MinY; DeltaLatitude = Mercator(GEO.MaxLatitude) - Mercator(GEO.MinLatitude); FactorY = DeltaY/DeltaLatitude; gets(InputLine); gets(InputLine); while(gets(InputLine) != NULL) { sscanf(InputLine,"%s %s",StrLatitude,StrLongitude); Latitude = GeoPosition(StrLatitude); Longitude = GeoPosition(StrLongitude); StationType = 0; sscanf(InputLine,"%*s %*s %d",&StationType); X = (FactorX*(GEO.MaxLongitude-Longitude))+ARE.MinX; Y = (FactorY*(Mercator(Latitude)-Mercator(GEO.MinLatitude)))+ARE.MinY; PlotSymbol(ARE,X,Y,StationType); } fflush(stdout); exit(OK); } TypOfInt GetArguments(ArgC,ArgV,WOR,WIN,ARE,CHA,GEO,PAT) TypOfInt ArgC; TypOfPtrToChar ArgV[]; TypOfSpaceDefinition *WOR; TypOfSpaceDefinition *WIN; TypOfSpaceDefinition *ARE; TypOfFontDefinition *CHA; TypOfGeographicalDefinition *GEO; TypOfInt *PAT; { sscanf(ArgV[1],"%d",&((*WOR).MinX)); sscanf(ArgV[2],"%d",&((*WOR).MaxX)); sscanf(ArgV[3],"%d",&((*WOR).MinY)); sscanf(ArgV[4],"%d",&((*WOR).MaxY)); sscanf(ArgV[5],"%d",&((*WIN).MinX)); sscanf(ArgV[6],"%d",&((*WIN).MaxX)); sscanf(ArgV[7],"%d",&((*WIN).MinY)); sscanf(ArgV[8],"%d",&((*WIN).MaxY)); sscanf(ArgV[9],"%d",&((*ARE).MinX)); sscanf(ArgV[10],"%d",&((*ARE).MaxX)); sscanf(ArgV[11],"%d",&((*ARE).MinY)); sscanf(ArgV[12],"%d",&((*ARE).MaxY)); sscanf(ArgV[13],"%d",&((*CHA).CharWidth)); sscanf(ArgV[14],"%d",&((*CHA).CharHeight)); sscanf(ArgV[15],"%d",&((*CHA).LineHeight)); sscanf(ArgV[16],"%lf",&((*GEO).MinLongitude)); sscanf(ArgV[17],"%lf",&((*GEO).MaxLongitude)); sscanf(ArgV[18],"%lf",&((*GEO).MinLatitude)); sscanf(ArgV[19],"%lf",&((*GEO).MaxLatitude)); sscanf(ArgV[20],"%d",PAT); return; } TypOfInt PlotSymbol(ARE,X,Y,Type) TypOfSpaceDefinition ARE; TypOfInt X; TypOfInt Y; TypOfInt Type; { TypOfInt Minimum(); TypOfInt XOffset; TypOfInt YOffset; TypOfInt Offset; TypOfInt Delta; TypOfDouble Sinus; TypOfDouble sqrt(); TypOfDouble asin(); TypOfDouble cos(); Delta = SYMBOLSIZE*Minimum((ARE.MaxX-ARE.MinX),(ARE.MaxY-ARE.MinY)); switch(Type) { case 1 : Delta = Delta*sqrt((double) 2.0)+0.5; move(X-(Delta/2),Y); cont(X,Y+(Delta/2)); cont(X+(Delta/2),Y); cont(X,Y-(Delta/2)); cont(X-(Delta/2),Y); for(Offset = 1; Offset < (Delta/2); Offset++) { move(X-(Delta/2)+Offset,Y+Offset); cont(X+(Delta/2)-Offset,Y+Offset); } break; case 2 : Delta = Delta*sqrt((double) 2.0)+0.5; move(X-(Delta/2),Y); cont(X,Y+(Delta/2)); cont(X+(Delta/2),Y); cont(X,Y-(Delta/2)); cont(X-(Delta/2),Y); for(Offset = 1; Offset < (Delta/2); Offset++) { move(X-(Delta/2)+Offset,Y-Offset); cont(X+(Delta/2)-Offset,Y-Offset); } break; case 3 : line(X-(Delta/2),Y-(Delta/2),X+(Delta/2),Y+(Delta/2)); line(X-(Delta/2),Y+(Delta/2),X+(Delta/2),Y-(Delta/2)); break; case 4 : box(X-(Delta/2),Y-(Delta/2),X+(Delta/2),Y+(Delta/2)); break; case 5 : box(X-(Delta/2),Y-(Delta/2),X+(Delta/2),Y+(Delta/2)); circle(X,Y,(Delta/2)); break; case 6 : circle(X,Y,(Delta/2)); break; case 7 : circle(X,Y,(Delta/2)); YOffset = -(Delta/2)+1; while(YOffset < (Delta/2)) { Sinus = YOffset/((double) (Delta/2)); XOffset = (Delta/2)*cos(asin(Sinus)); move(X-XOffset,Y+YOffset); cont(X+XOffset,Y+YOffset); YOffset++; } break; case 8 : line(X-(Delta/2),Y,X+(Delta/2),Y); line(X,Y-(Delta/2),X,Y+(Delta/2)); break; default : break; } return(OK); } @EOF set `wc -lwc <Map/Src/symbol.c` if test $1$2$3 != 2083005053 then echo ERROR: wc results of Map/Src/symbol.c are $* should be 208 300 5053 fi chmod 777 Map/Src/symbol.c echo x - Map/Src/test.c cat >Map/Src/test.c <<'@EOF' main() { openpl(); space(0,0,1000,1000); move(10,10); label("01234567890123456789"); move(10,10); cont((int (1000/(float 640))*12) ,10); closepl(); } @EOF set `wc -lwc <Map/Src/test.c` if test $1$2$3 != 1113158 then echo ERROR: wc results of Map/Src/test.c are $* should be 11 13 158 fi chmod 777 Map/Src/test.c echo x - Map/Src/tic.c cat >Map/Src/tic.c <<'@EOF' #include <stdio.h> #include "types.h" TypOfInt Tic(ARE,GEO,TP) TypOfSpaceDefinition ARE; TypOfGeographicalDefinition GEO; TypOfTicParameters TP; { TypOfDouble Mercator(); TypOfInt DeltaX; TypOfInt DeltaY; TypOfFloat DeltaLongitude; TypOfFloat DeltaLatitude; TypOfFloat FactorX; TypOfFloat FactorY; TypOfInt LongitudeTicNum; TypOfInt LatitudeTicNum; TypOfDouble TicLongitude; TypOfDouble TicLatitude; TypOfInt X; TypOfInt Y; TypOfChar LineMode[15]; window(ARE.MinX-10,ARE.MinY-10,ARE.MaxX+10,ARE.MaxY+10); LineType(TP.TicPattern/10,LineMode); linemod(LineMode); color(TP.TicPattern%10); DeltaX = ARE.MaxX - ARE.MinX; DeltaLongitude = GEO.MaxLongitude - GEO.MinLongitude; FactorX = DeltaX/DeltaLongitude; DeltaY = ARE.MaxY - ARE.MinY; DeltaLatitude = Mercator(GEO.MaxLatitude) - Mercator(GEO.MinLatitude); FactorY = DeltaY/DeltaLatitude; LongitudeTicNum = (GEO.MinLongitude / TP.TicLongitudinalIncrement) + 1; while(LongitudeTicNum * TP.TicLongitudinalIncrement < GEO.MaxLongitude) { TicLongitude = LongitudeTicNum * TP.TicLongitudinalIncrement; X = FactorX * (GEO.MaxLongitude - TicLongitude); move(X+ARE.MinX,ARE.MinY); cont(X+ARE.MinX,ARE.MinY+TICSIZE); LongitudeTicNum++; } LatitudeTicNum = (GEO.MinLatitude / TP.TicLatitudinalIncrement) + 1; while(LatitudeTicNum * TP.TicLatitudinalIncrement < GEO.MaxLatitude) { TicLatitude = LatitudeTicNum * TP.TicLatitudinalIncrement; Y = FactorY * (Mercator(TicLatitude) - Mercator(GEO.MinLatitude)); move(ARE.MinX,Y+ARE.MinY); cont(ARE.MinX+TICSIZE,Y+ARE.MinY); LatitudeTicNum++; } LongitudeTicNum--; while(LongitudeTicNum * TP.TicLongitudinalIncrement > GEO.MinLongitude) { TicLongitude = LongitudeTicNum * TP.TicLongitudinalIncrement; X = FactorX * (GEO.MaxLongitude - TicLongitude); move(X+ARE.MinX,ARE.MaxY); cont(X+ARE.MinX,ARE.MaxY-TICSIZE); LongitudeTicNum--; } LatitudeTicNum--; while(LatitudeTicNum * TP.TicLatitudinalIncrement > GEO.MinLatitude) { TicLatitude = LatitudeTicNum * TP.TicLatitudinalIncrement; Y = FactorY * (Mercator(TicLatitude) - Mercator(GEO.MinLatitude)); move(ARE.MaxX,Y+ARE.MinY); cont(ARE.MaxX-TICSIZE,Y+ARE.MinY); LatitudeTicNum--; } fflush(stdout); return(OK); } @EOF set `wc -lwc <Map/Src/tic.c` if test $1$2$3 != 921782481 then echo ERROR: wc results of Map/Src/tic.c are $* should be 92 178 2481 fi chmod 777 Map/Src/tic.c echo x - Map/Src/transform.c cat >Map/Src/transform.c <<'@EOF' #include <stdio.h> #include "types.h" TypOfDouble GeoPosition(); TypOfChar HeaderLine[MAXTEXTLEN]; TypOfChar StrLatitude[10]; TypOfChar StrLongitude[10]; TypOfDouble Longitude; TypOfDouble Latitude; int PenPos; void main() { FILE *IN,*OUT; char filename1[80],filename2[80]; printf("\nEnter file to transfer: "); scanf("%s",filename1); printf("\nEnter file to transfer to: "); scanf("%s",filename2); IN = fopen(filename1,"r"); if(IN == NULL) { fprintf(stderr,"Error: Cannot open data file %s\n",filename1); exit(-1); } OUT = fopen(filename2,"w"); if(OUT == NULL) { fprintf(stderr,"Error: Cannot open data file %s\n",filename2); exit(ERROR); } fgets(HeaderLine,MAXTEXTLEN,IN); fgets(HeaderLine,MAXTEXTLEN,IN); fprintf(OUT,"lat\tlong\tpen\n"); fprintf(OUT,"---\t----\t---\n"); while(fscanf(IN,"%s %s %d",StrLatitude,StrLongitude,&PenPos) != EOF) { Latitude = GeoPosition(StrLatitude); Longitude = GeoPosition(StrLongitude); fprintf(OUT,"%f\t%f\t%d\n",Latitude,Longitude,PenPos); } fclose(IN); fclose(OUT); } TypOfDouble GeoPosition(String) TypOfPtrToChar String; { TypOfInt Degrees; TypOfInt Minutes; TypOfInt Seconds; sscanf(String,"%2d%2d%2d",&Degrees,&Minutes,&Seconds); return(Degrees+(Minutes/60.0)+(Seconds/3600.0)); } @EOF set `wc -lwc <Map/Src/transform.c` if test $1$2$3 != 631031466 then echo ERROR: wc results of Map/Src/transform.c are $* should be 63 103 1466 fi chmod 777 Map/Src/transform.c echo x - Map/Src/transform.info '[non-ascii]' $unpacker <<'@eof' begin 777 Map/Src/transform.info M"E1204Y31D]233H*+2TM+2TM+2TM"@H)5')A;G-F;W)M(&ES(&$@<VEM<&QE M('!R;V=R86T@=&\@8V]P>2!D871A(&EN"@D*"6QA=" @("!L;VYG(" @<&5N M"0D);&%T( EL;VYG"7!E;@H),3(S-#4V(#$R,S0U-B Q(" @(" @(" @(&9O M<FUA="!I;G1O(" @(#$R+C,T-38@,3(N,S0U-B Q(" @(" @(&9O<FUA="X* G"@ET;R!U<V4@:G5S="!T>7!E.B!T<F%N<V9O<FTN"@H*"0D)"0D) end @eof set `wc -lwc <Map/Src/transform.info` if test $1$2$3 != 1231219 then echo ERROR: wc results of Map/Src/transform.info are $* should be 12 31 219 fi chmod 777 Map/Src/transform.info echo x - Map/Src/transformback.c cat >Map/Src/transformback.c <<'@EOF' #include <stdio.h> #include "types.h" int GeoPosition(); TypOfChar HeaderLine[MAXTEXTLEN]; TypOfChar StrLatitude[10]; TypOfChar StrLongitude[10]; int Longitude; int Latitude; int PenPos; void main() { FILE *IN,*OUT; char filename1[80],filename2[80]; printf("\nEnter file to transfer: "); scanf("%s",filename1); printf("\nEnter file to transfer to: "); scanf("%s",filename2); IN = fopen(filename1,"r"); if(IN == NULL) { fprintf(stderr,"Error: Cannot open data file %s\n",filename1); exit(-1); } OUT = fopen(filename2,"w"); if(OUT == NULL) { fprintf(stderr,"Error: Cannot open data file %s\n",filename2); exit(ERROR); } fgets(HeaderLine,MAXTEXTLEN,IN); fgets(HeaderLine,MAXTEXTLEN,IN); fprintf(OUT,"lat\tlong\tpen\n"); fprintf(OUT,"---\t----\t---\n"); while(fscanf(IN,"%s %s %d",StrLatitude,StrLongitude,&PenPos) != EOF) { Latitude = GeoPosition(StrLatitude); Longitude = GeoPosition(StrLongitude); fprintf(OUT,"%d\t%d\t%d\n",Latitude,Longitude,PenPos); } fclose(IN); fclose(OUT); } int GeoPosition(String) TypOfPtrToChar String; { double num; int res,res2,res3; sscanf(String,"%lf",&num); res=(int) (num); num=num-res; res=res*10000; num=num*60; res2=(int)(num); num=num-res2; res2=res2*100; num=num*60; res3=(int)(num+.5); return(res+res2+res3); } @EOF set `wc -lwc <Map/Src/transformback.c` if test $1$2$3 != 751111494 then echo ERROR: wc results of Map/Src/transformback.c are $* should be 75 111 1494 fi chmod 777 Map/Src/transformback.c echo x - Map/Src/types.h cat >Map/Src/types.h <<'@EOF' #define YES 1 #define NO 0 #define FALSE 0 #define TRUE 1 #define UP 0 #define DOWN 1 #define OK 0 #define ERROR 1 #define LESS -1 #define EQUAL 0 #define GREATER +1 #define LINEBREAK '^' #define TICSIZE 10 #define SYMBOLSIZE 0.0125 #define FNAMELEN 64 #define MAXTEXTLEN 512 #define XNUMCOORDINATES 1500 #define YNUMCOORDINATES 1024 typedef int TypOfInt; typedef long TypOfLong; typedef char TypOfChar; typedef char * TypOfPtrToChar; typedef float TypOfFloat; typedef double TypOfDouble; typedef struct StrOfGraphicsTerminalCapabilites { TypOfInt ChrWidth; TypOfInt ChrHeight; TypOfInt LinHeight; TypOfInt ScrMaxWidth; TypOfInt ScrWidth; TypOfInt ScrHeight; TypOfInt RasterSupport; TypOfInt FillSupport; TypOfInt ColorSupport; } TypOfGraphicsTerminalCapabilities; typedef struct StrOfSpaceDefinition { TypOfInt MinX; TypOfInt MaxX; TypOfInt MinY; TypOfInt MaxY; } TypOfSpaceDefinition; typedef struct StrOfFontDefinition { TypOfInt CharWidth; TypOfInt CharHeight; TypOfInt LineHeight; } TypOfFontDefinition; typedef struct StrOfGeographicalDefinition { TypOfDouble MinLongitude; TypOfDouble MaxLongitude; TypOfDouble MinLatitude; TypOfDouble MaxLatitude; } TypOfGeographicalDefinition; typedef struct StrOfEnvironmentParameters { TypOfDouble EnvMinLongitude; TypOfDouble EnvMaxLongitude; TypOfDouble EnvMinLatitude; TypOfDouble EnvMaxLatitude; TypOfFloat EnvMinX; TypOfFloat EnvMaxX; TypOfFloat EnvMinY; TypOfFloat EnvMaxY; } TypOfEnvironmentParameters; typedef struct StrOfOptionParameters { TypOfPtrToChar HeadOfOptionList; TypOfPtrToChar TailOfOptionList; TypOfInt CountOfOptionList; TypOfInt DefaultOptionPattern; } TypOfOptionParameters; typedef struct StrOfNodeForOptionParameters { TypOfChar OptionName[FNAMELEN]; TypOfChar OptionArgumentString[MAXTEXTLEN]; TypOfInt OptionPattern; TypOfPtrToChar OptionNextPointer; } TypOfNodeForOptionParameters; typedef struct StrOfMapParameters { TypOfInt EraseSelected; TypOfInt OptionSelected; TypOfInt BorderSelected; TypOfInt TicSelected; TypOfInt LabelSelected; TypOfInt CommentSelected; TypOfInt FrameSelected; } TypOfMapParameters; typedef struct StrOfBorderParameters { TypOfChar BorderDataFile[FNAMELEN]; TypOfInt BorderPattern; } TypOfBorderParameters; typedef struct StrOfTicParameters { TypOfInt TicPattern; TypOfDouble TicLongitudinalIncrement; TypOfDouble TicLatitudinalIncrement; } TypOfTicParameters; typedef struct StrOfLabelParameters { TypOfInt LabelPattern; TypOfDouble LabelLongitudinalInterval; TypOfDouble LabelLatitudinalInterval; } TypOfLabelParameters; typedef struct StrOfCommentParameters { TypOfInt CommentPattern; TypOfChar CommentText[MAXTEXTLEN]; } TypOfCommentParameters; typedef struct StrOfFrameParameters { TypOfInt FramePattern; } TypOfFrameParameters; @EOF set `wc -lwc <Map/Src/types.h` if test $1$2$3 != 1922593154 then echo ERROR: wc results of Map/Src/types.h are $* should be 192 259 3154 fi chmod 777 Map/Src/types.h echo x - Map/Src/value.c cat >Map/Src/value.c <<'@EOF' #include <stdio.h> #include "types.h" main(ArgC,ArgV) TypOfInt ArgC; TypOfPtrToChar ArgV[]; { TypOfSpaceDefinition WOR; TypOfSpaceDefinition WIN; TypOfSpaceDefinition ARE; TypOfFontDefinition CHA; TypOfGeographicalDefinition GEO; TypOfInt PAT; TypOfDouble Mercator(); TypOfFloat FactorX; TypOfFloat FactorY; TypOfInt DeltaX; TypOfInt DeltaY; TypOfDouble DeltaLongitude; TypOfDouble DeltaLatitude; TypOfDouble Longitude; TypOfDouble Latitude; TypOfInt X; TypOfInt Y; TypOfInt Delta; TypOfInt Minimum(); TypOfChar InputLine[MAXTEXTLEN]; TypOfChar ValueString[MAXTEXTLEN]; TypOfChar StrLatitude[10]; TypOfChar StrLongitude[10]; TypOfDouble GeoPosition(); TypOfChar LineMode[15]; GetArguments(ArgC,ArgV,&WOR,&WIN,&ARE,&CHA,&GEO,&PAT); window(ARE.MinX,ARE.MinY,ARE.MaxX,ARE.MaxY); LineType(PAT/10,LineMode); linemod(LineMode); color(PAT%10); DeltaX = ARE.MaxX - ARE.MinX; DeltaLongitude = GEO.MaxLongitude - GEO.MinLongitude; FactorX = DeltaX/DeltaLongitude; DeltaY = ARE.MaxY - ARE.MinY; DeltaLatitude = Mercator(GEO.MaxLatitude) - Mercator(GEO.MinLatitude); FactorY = DeltaY/DeltaLatitude; gets(InputLine); gets(InputLine); if(gets(InputLine) == NULL) { fprintf(stderr,"Error: Input file for \"%s\" is empty\n",ArgV[0]); exit(ERROR); } else { do { sscanf(InputLine,"%s %s",StrLatitude,StrLongitude); Latitude = GeoPosition(StrLatitude); Longitude = GeoPosition(StrLongitude); sscanf(InputLine,"%*s %*s %[^\0]s",ValueString); X = (FactorX*(GEO.MaxLongitude-Longitude))+ARE.MinX; Y = (FactorY*(Mercator(Latitude)-Mercator(GEO.MinLatitude)))+ARE.MinY; Delta = SYMBOLSIZE*Minimum((ARE.MaxX-ARE.MinX),(ARE.MaxY-ARE.MinY)); move(X,Y); label(ValueString); } while(gets(InputLine) != NULL); } fflush(stdout); exit(OK); } TypOfInt GetArguments(ArgC,ArgV,WOR,WIN,ARE,CHA,GEO,PAT) TypOfInt ArgC; TypOfPtrToChar ArgV[]; TypOfSpaceDefinition *WOR; TypOfSpaceDefinition *WIN; TypOfSpaceDefinition *ARE; TypOfFontDefinition *CHA; TypOfGeographicalDefinition *GEO; TypOfInt *PAT; { sscanf(ArgV[1],"%d",&((*WOR).MinX)); sscanf(ArgV[2],"%d",&((*WOR).MaxX)); sscanf(ArgV[3],"%d",&((*WOR).MinY)); sscanf(ArgV[4],"%d",&((*WOR).MaxY)); sscanf(ArgV[5],"%d",&((*WIN).MinX)); sscanf(ArgV[6],"%d",&((*WIN).MaxX)); sscanf(ArgV[7],"%d",&((*WIN).MinY)); sscanf(ArgV[8],"%d",&((*WIN).MaxY)); sscanf(ArgV[9],"%d",&((*ARE).MinX)); sscanf(ArgV[10],"%d",&((*ARE).MaxX)); sscanf(ArgV[11],"%d",&((*ARE).MinY)); sscanf(ArgV[12],"%d",&((*ARE).MaxY)); sscanf(ArgV[13],"%d",&((*CHA).CharWidth)); sscanf(ArgV[14],"%d",&((*CHA).CharHeight)); sscanf(ArgV[15],"%d",&((*CHA).LineHeight)); sscanf(ArgV[16],"%lf",&((*GEO).MinLongitude)); sscanf(ArgV[17],"%lf",&((*GEO).MaxLongitude)); sscanf(ArgV[18],"%lf",&((*GEO).MinLatitude)); sscanf(ArgV[19],"%lf",&((*GEO).MaxLatitude)); sscanf(ArgV[20],"%d",PAT); return; } @EOF set `wc -lwc <Map/Src/value.c` if test $1$2$3 != 1361813230 then echo ERROR: wc results of Map/Src/value.c are $* should be 136 181 3230 fi chmod 777 Map/Src/value.c echo x - Map/Src/wincol.c cat >Map/Src/wincol.c <<'@EOF' #include <stdio.h> #include "types.h" extern int minx,miny,maxx,maxy; extern TypOfFloat scalingfactor; void window(a,b,c,d) TypOfInt a, b, c, d; { fprintf(stdout,"w"); fflush(stdout); putsi(a); putsi(b); putsi(c); putsi(d); return; } void color(b) TypOfInt b; { fprintf(stdout,"z"); fflush(stdout); putsi(b); return; } @EOF set `wc -lwc <Map/Src/wincol.c` if test $1$2$3 != 2836368 then echo ERROR: wc results of Map/Src/wincol.c are $* should be 28 36 368 fi chmod 777 Map/Src/wincol.c chmod 777 Map/Src rm -f /tmp/unpack$$ exit 0