> NGRCalc 1.03  S 28-Feb-1997 v1.00 Program written by Len Killip, G0APZ, for his own interest. ( 2O 15-Oct-1999 v1.01 JGH: Tidied output slightly, QUITs on exit if possible, <0 windows not defined FN 18-Apr-2009 v1.02 JGH: UTM grid for Channel Islands, command line access PA 25-Jun-2009 v1.03 JGH: Works in interactive mode on Windows Z; Note: Some issues on SDL and Brandy d n Len's original comments x ----------------------- D This program converts National Grid References to latitude and I longitude, and calculates the deviation between true north and grid north.  E Also the reverse, lat and long to easting and northing and NGR. 1 Also the bearing and distance between NGRs. C The "mathematical engine" is derived from the Ordnance Survey < "Geodetic Information Paper No 1: 2/1996 (Version 2.0) C 10 and 8 figure as well as 6 figure NGRs may be entered. Also A Eastings and Northings (to nearest millimetre if desired!). G Using OS worked examples, eastings and northings entered directly A to the nearest millimetre(!) result agrees to within 0.0004 H seconds lat. and is exact to four decimal places of seconds long. B (Exact to four decimal places in both cases using BASIC VI). F Deviation checks correct at sheet corners, and exact at Caister. D Bearings checked on p19 Fram to Caister 7.488 seconds v. 7.487 "F Caister to Fram 10.833 seconds v. 10.832. I'll settle for these! ,: Scale factor for mid-point of that line also checks. 6: @2A$=OS_GetEnv:ver$="1.03": os%=32 *FLOAT 64 J A$<>"":cmd(A$):exit(0) T8 os%=32:ș "ShowWindow",@hwnd%,3:_setfocus(@hwnd%) ^: h 27+128 r border | error : constants_OSGB :  repeat=   choice1 repeat<>  :  choice1 4:'15)"GRID REFERENCE CONVERTOR"'15)24,"=")' !18)"CURRENT GRID: ";grid$'' ?5)"(A) CONVERT GRID REFERENCE TO LATITUDE AND LONGITUDE"' 65)"(B) BEARING AND DISTANCE BETWEEN TWO POINTS"' ?5)"(C) CONVERT LATITUDE AND LONGITUDE TO GRID REFERENCE"' !5)"(D) SELECT A BASE GRID"' &5)"(E) EXIT"' 05)"Press a key:"; :Ȏ answer("ABCDE") D 1 Nlatlongrepeat= Xȕ latlongrepeat= b :'' l latlong v  2 bdrepeat= ȕ bdrepeat=  :'' _bd   3  lltongr= ȕ lltongr=  :''  _lltongr   4 choosegrid   5 :quit%=: quit%=  quit%:Ș * 4 > H: Rchoosegrid \''5)"SELECT GRID:"' f05)"(A) OSGB - Great Britain & Isle of Man" p$5)"(B) UTM - Channel Islands" z'5)"(C) ITM - Ireland (new grid)" '5)"(D) OSI - Ireland (old grid)" '5)"Press a key:"; Ȏ answer("ABCD")  1:constants_OSGB  2:constants_UTM  3:constants_ITM  4:constants_OSI   :  latlong  choice2  :''  10)"GRID REFERENCE: "G$' _Mvrho(E,N)  _toll $ _C_EN .$output(lambda,phi,C):lldisplay 8< '10) "Do you want another Lat Long calculation? Y/N"; B& answer("YN")<>1 latlongrepeat= L V: ` _bd j 20)"FIRST POSITION"' t choice2 ~ E1=E:N1=N _Mvrho(E1,N1):y1%=y:F1=F  _toll  _C_EN  20)"SECOND POSITION"'  choice2  E2=E:N2=N _Mvrho(E2,N2):y2%=y:F2=F  _toll  Ȏ N2  N1  alpha=/2  alpha=((E2-E1)/(N2-N1))    Ȏ E2  E1 ( alpha=0 2 < N2N1 Zalpha=alpha+2* d n x%Nm=(N1+N2)/2:q=N1-N2:Em=(E1+E2)/2  y1%<0 y2%<0 alphasplit  _converge  _distance _bd_output 6 15)"Another bearing/dist calculation? Key Y/N"; ! answer("YN")<>1 bdrepeat=  : _lltongr 7 15)"Enter latitude north in form deg, min, sec"' 6 15)deg%, min%,sec':degN=deg%:minN=min%:secN=sec 7 15)"Enter longitude in form deg, min, sec, E/W"' ; 15)deg%, min%, sec,ew$':degE=deg%:minE=min%:secE=sec "4_lltoEN::''15)"Easting= ";E;" Northing= ";N' ,= 15) "Latitude "; degN; " Degs "; minN; " Mins "; secN; 6 " Secs North"' @> 15) "Longitude "; degE; " Degs "; minE; " Mins "; secE; J " Secs "; ew$' T_ENtongr(E,N) ^_ngrdisplay h r: | _lltoEN 7 On entry, degN, minN, secN = latitude north < degE, minE, secE, ew$ = longitude west/east +phi=convert(degN,minN,secN):phi=(phi) (v=A(phi):rho=B(phi):itasqd=v/rho-1 6lambda=convert(degE, minE, secE):lambda=(lambda) Lew$=ew$,1): ew$="W" ew$="w" lambda=-lambda:ew$="West" ew$="East" P=lambda-lambda0:phip=phi M=M(b,n,phip,phi0)  I=M+N0 II=(v/2)*(phi)*(phi) 8III=(v/24)*(phi)*((phi))^3*(5-((phi))^2+9*itasqd) @IIIA=(v/720)*(phi)*((phi)^5)*(61-58*((phi)^2)+((phi)^4)) N=I+P^2*II+P^4*III+P^6*IIIA IV=v*(phi) )V=(v/6)*((phi))^3*(v/rho-((phi)^2)) VI=(v/120) * ((phi)^5) &EVI=VI*(5-18*((phi)^2)+((phi)^4)+14*itasqd-58*((phi)^2)*itasqd) 0E=E0+P*IV+P^3*V+P^5*VI : D: N_ENtongr(E,N) Xgrid$="ITM":E=E+100000 b E<0:E=E+.1: IF E<0 E=E-1 l N<0:N=N+.1: IF N<0 N=N-1 ven_string(E)  east$=en$ en_string(N) north$=en$ : grid_letters : ,easting$=east$,5): northing$=north$,5)  E<0 (easting$=(1000000-(east$,2))),5)   N<0 )northing$=(500000-(north$,2))),5)  !NGR$=A$+B$+easting$+northing$   :  _ngrdisplay *6 15)"10-digit National Grid Reference is ";NGR$' 4curtail(easting$) >easting$=en$ Hcurtail(northing$) Rnorthing$=en$ \!NGR$=A$+B$+easting$+northing$ f5 15)"6-digit National Grid Reference is ";NGR$' pD 15)"4-digit National Grid Reference is ";NGR$,4);NGR$,6,2)' z: : '15)"Another lat/long to NGR calculation? Key Y/N"; :  answer("YN")<>1 lltongr=  : curtail(EN$) en%=((EN$)/100) en$="0000"+(en%),3)  :  choice2 $ 15)"DO YOU WISH TO ENTER AS"' , 15)"(A) NATIONAL GRID REFERENCE, OR"' & 15)"(B) EASTING AND NORTHING?"'  15)"KEY A OR B"' Ȏ answer("AB") $ 1 .? 2)"Enter the NGR, with grid letters, in 10, 8, 6 or 4 "; 8 "numeral form "' B 15) G$' Lngr V 2 `: 10) "ENTER FULL EASTING AND NORTHING, IN FORM E,N"' jF 5 ) "(six or seven figures in each, plus decimals if need be)"' t 20) E,N' ~G$=E+","+N   : - This puts NGR into easting and northing ngr  ( G$ 1)=1:G$="I"+G$ $ G$,1)>"`":G$=(G$-32)+G$,2) 1 G$,2,1)>"`":G$=G$,1)+(G$,2)-32)+G$,3) constants_OSGB  G$,1)="I":constants_ITM  G$,1)="W":constants_UTM : X% = ((G$) - 2) / 2 Y% = 10^(5-X%) !X$ = G$, 1): Y$ = G$, 2, 1) 1E = (G$, 3, X%)) * Y%: N = (G$, X%)) * Y% ( G$,1)="W" 2%a%=G$,2,1)&DF:a%="A":a%="W" 13 a%=a%-1 row%=a% 5: column%=a% 5 *E=E+(column%-c%)*m% : N=N+(r%-row%)*m%  : NݤA(phip)=a/(1-esqd*((phip))^2) : rad of curv of lat at lat phip KݤB(phip)=v*(1-esqd)/(1-esqd*((phip))^2) : same for long at lat phip : ݤM(b,n,phip,phi0)=b*(((1+n+(5/4)*n^2+(5/4)*n^3)*(phip-phi0))-((3*n+3*n^2+(21/8)*n^3)*(phip-phi0)*(phip+phi0))+(((15/8)*n^2+(15/8)*n^3)*(2*(phip-phi0))*(2*(phip+phi0)))-((35/24)*n^3*(3*(phip-phi0))*(3*(phip+phi0)))) "tmp=b * (((1+n+(5/4)*n^2+(5/4)*n^3)*(phip-phi0))-((3*n+3*n^2+(21/8)*n^3)*(phip-phi0)*(phip+phi0))+(((15/8)*n^2+(15/8)*n^3)*(2*(phip-phi0))*(2*(phip+phi0)))-((35/24)*n^3*(3*(phip-phi0))*(3*(phip+phi0)))) ,=tmp 6: @J This takes easting and northing, does iteration for M, returns phip, J v, rho, y, and itasqd. T: ^_Mvrho(E,N) h y=E-E0 rphip=(N-N0)/a+phi0 |M=M(b,n,phip,phi0)  phin=(N-N0-M)/a+phip phip=phin M=M(b,n,phip,phi0)  (N-N0-M)<.0015 : v=A(phip) rho=B(phip) itasqd=v/rho-1 _F  : G This contains equations leading to phi, lambda. For equation IX I D need to divide (720*rho*v^5) by v^2 to get within range, which I multiplies IX by v^2. So then divide IX by v^2. Similarly for XIIA; I v^7 outside number range. In XIIA reduce v^7 to v^3 and divide XIIA & by v^4 0: : _toll DVII=(phip)/(2*rho*v) NIVIII=((phip)/(24*rho*v^3))*(5+3*(phip)^2+itasqd-9*(phip)^2*itasqd) X>IX= ((phip)/(720*rho*v^3))*(61+90*(phip)^2+45*(phip)^4) b IX=IX/v^2 l$phi=phip-y^2*VII+y^4*VIII-y^6*IX vX=1/(v*(phip)) .XI=1/(6*v^3*(phip))*(v/rho+2*((phip))^2) ?XII=(1/(120*v^5*(phip)))*(5+28*((phip))^2+24*((phip))^4) UXIIA=(1/(5040*v^3*(phip)))*(61+662*((phip))^2+1320*((phip))^4+720*((phip))^6) XIIA=XIIA/v^4 2lambda=lambda0+y*X-y^3*XI+y^5*XII-y^5*XIIA*y^2 P=lambda-lambda0  : G This derives deviation (C) between true north and grid north from C phi and lambda (PROC_toll) and itasqd (PROC_Mvrho). When C is - negative, true N is East of grid north. _C XIII=(phi) 7XIV=(((phi)*((phi))^2)/3)*(1+3*itasqd+2*itasqd^2) .XV=(((phi)*((phi))^4)/15)*(2-((phi))^2) #C=(P*(XIII)+P^3*(XIV)+P^5*(XV))  *: 4- This derives deviation (C) from E and N > _C_EN HXVI=(phip)/v R8XVII=(phip)/(3*v^3)*(1+(phip)^2-itasqd-2*itasqd^2) \6XVIII=(phip)/(15*v^5)*(2+5*(phip)^2+3*(phip)^4) fC=y*XVI-y^3*XVII+y^5*XVIII p z: output(lambda,phi,C) lambda=(lambda): phi=(phi) ew$ = "East" * lambda <=0:ew$="West":lambda=-lambda degminsec(phi) degN=deg: minN=min: secN=sec degminsec(lambda) degE=deg: minE=min: secE=sec  : lldisplay D 10) "The Latitude is "; degN; " Degs "; minN; " Mins "; secN;  " Secs North"' E 10) "The Longitude is "; degE; " Degs "; minE; " Mins "; secE;  " Secs "; ew$'  C=(C) $% C>0 C$="West" C$="East": C=-C .degminsec(C) 8W 10) "True North is ";deg " Degs ";min " Mins ";sec;" Secs ";C$;" of grid North"' B( 10) "easting= ";E;" northing=";N' L V: `_bd_output jG=(alpha) tdegminsec(G) ~numplace(sec," ")  sec=num = 15)"Grid bearing is ";deg" deg ";min" min ";sec" sec"' ) C<0 alpha<=(C) alpha=alpha+2* TBg=(alpha+C-convangle) degminsec(TBg) numplace(sec," ")  sec=num > 15)"True bearing is ";deg;" deg ";min" min ";sec" sec"' numplace(s," ")  s=num * 15)"Grid distance is ";s;" metres"' numplace(dist," ")  dist=num  - 15)"True distance is ";dist;" metres"'  20)"Print vars? Y/N"; ! answer("YN")=1 _variables ( 2: < error F! =17 : REPORT:PRINT:END P3 IF ERL<>1240 THEN REPORT:PRINT" at line ";ERL Z d 13)"Press any key"; n x : 4 This draws yellow border, with blue background  border 119,0,4,0,0;19,3,3,0,0; : select yellow/blue + 0,0: 0,959: 1279,959 : draw border ! 1279,0: 0,0 : draw border . VDU 28,4,58,78,4 :REM set up text window 8 VDU 24,10;10;1269;949; :REM set up graphics window  : ݤanswer(alternatives$)  *FX 15,1  "A%=alternatives$, ( &DF))  A%>0 =A% ": ,; converts decimal degrees to degrees, minutes, seconds 6degminsec(theta) @6ang=theta*3600+0.0005 : sec=(ang*1000)60000 /1000 J+deg=ang 60 : min=deg 60 : deg=deg 60 T ^: h6 removes last j$ sig figs.Pass space string to j$ rnumplace(Y,j$) | num$=(Y)  num$)=j$ num=(num$)  : O Corrects for convergence as in navigation,and checks with OS calc page 18 _converge f=2*y1%+y2% _Mvrho(E1,Nm) XXIII=1/(6*rho*v) convangle=(f*q*XXIII)  : I Case when E1 and E2 opposite sides central meridian. Nc is point of  crossing central meridian alphasplit ratio=((y1%)/(E2-E1)) &Nc=N1+ratio*(N2-N1) 0 Nm1=(Nc+N1)/2: Nm2=(Nc+N2)/2 :Nm=Nm1: y2%=0: q=N1-Nc D_converge Nconvangle1=convangle X"Nm=Nm2:y1%=0:y2%=E2-E0:q=Nc-N2 b_converge lconvangle2=convangle v#convangle=convangle1+convangle2  : _F XXI=1/(2*rho*v) $XXII=(1-4*itasqd)/(24*rho^2*v^2) F=F0*(1+y^2*XXI+y^4*XXII)  : / s is grid distance; dist is True distance _distance s=((E2-E1)^2+(N2-N1)^2) _Mvrho(Em,Nm):Fm=F X=(1/6)*(1/F1+4/Fm+1/F2)  F=1/X  dist=s/F   : *_variables 4 "F= ";F >"phip= ";phip H "v= ";v R"rho= ";rho \"itasqd= ";itasqd f "M= ";M p "y= ";y z"VII= ";VII "VIII= ";VIII "IX= ";IX  "X= ";X "XI= ";XI "XII= ";XII "XIIA= ";XIIA "XIII= ";XIII "XIV= ";XIV "XV= ";XV "XXI= ";XXI "XXII= ";XXII "XXIII= ";XXIII  : 0ݤconvert(deg,min,sec)=(min*60+sec)/3600+deg : $grid_letters . grid$="OSGB" 8)first_letter(east$,north$) :A$=(a%) B)second_letter(east$,north$):B$=(a%) L V ` grid$="OSI" j0first_letter(east$,north$) :A$=(a%):A$="I" t)second_letter(east$,north$):B$=(a%) ~   grid$="ITM" 0first_letter(east$,north$) :A$=(a%):A$="I" )second_letter(east$,north$):B$=(a%)    grid$="UTM" A$=(north$,1)+34) B$=(north$,2)+32) ! B$>"V":B$=(north$,2)+10) north$=north$,2)    A$="?":B$="?"  : (first_letter(E$,N$) 2column=0:row=0 <column_row(E$) F E<0 Pcolumn=init 5 + 2 Z dcolumn=init 5 + 3 n xcolumn_row(N$)  N<0  row=4  row=3-init 5  read_letter  : second_letter(E$,N$) column_row(E$)  E<0 column=5+init 5  column=1+init 5  column_row(N$) " N<0 ,init=init+.1:N=N-.1 6 èN,2)<>"00":init=init-.1 @row= -init 5 J Trow=4-init 5 ^ hread_letter r |: C "column_row" returns the initial one or two numbers, with "-"  if present, as "init". : column_row(EN$) neg$=EN$,1)  M%=(EN$)  neg$="-"  M% =8 left(EN$,3)   M% =7 left(EN$,2)    M%=7 left(EN$,2) & 0 M%=6 :left(EN$,1) D N X b: lB Preserves leading zeros, and repositions "-" when necessary. ven_string(EN) EN$=(((EN+0.5)*10/10))  L%=(EN$)  EN<0  L%=L%-1  neg$="-"  L%>7 EN$=EN$,7) en$="0000000"+EN$,7)  EN$=EN$,L%) en$="000000"+EN$,6)  en$=("-"+en$)   EN>=0  L%>6  en$="0000000"+EN$,7) * 4en$="000000"+EN$,6) > H R \: fleft(x$,y) p (x$)<0 y=2 zinit=(x$,y))  : read_letter a%=5*row+column  a%<9 a%=a%-1  a%=a%+65  : constants_OSGB 8E0=400000: N0=-100000 : grid coords of True origin 3phi0=(49) : latitude of True origin =lambda0=(-2) : longitude of True origin (West -) 7F0=0.9996012717 : scale on central meridian Da=6375020.481 : semi-major axis in metres scaled by F0 9b=6353722.490 : semi-minor similarly scaled /esqd=0.006670539762 : e is eccentricity $Dn=(a-b)/(a+b) : 0.001673220250 : REM n is (a-b)/(a+b) .east%=0:grid$="OSGB" 8 B: Lconstants_OSI V8E0=200000: N0=250000 : grid coords of True origin `3phi0=(53.50) : latitude of True origin j=lambda0=(-8) : longitude of True origin (West -) t7F0=1.000035 : scale on central meridian ~Da=6377563.395906615 : semi-major axis in metres scaled by F0 9b=6356256.908205645 : semi-minor similarly scaled /esqd=0.00667054015 : e is eccentricity .n=(a-b)/(a+b) : n is (a-b)/(a+b) east%=0:grid$="OSI"  : constants_ITM 8E0=600000: N0=750000 : grid coords of True origin 3phi0=(53.50) : latitude of True origin =lambda0=(-8) : longitude of True origin (West -) 7F0=0.999820 : scale on central meridian Da=6376988.93534 : semi-major axis in metres scaled by F0 9b=6355608.0987234548 : semi-minor similarly scaled  /esqd=0.00669438002301 : e is eccentricity .n=(a-b)/(a+b) : n is (a-b)/(a+b) east%=0:grid$="ITM" ( 2: <constants_UTM F:E0=500000: N0=0 : grid coords of True origin P5phi0=(0) : latitude of True origin Z?lambda0=(-3) : longitude of True origin (West -) d9F0=0.9996 : scale on central meridian nFa=6378388.000 : semi-major axis in metres scaled by F0 x;b=6356911.946 : semi-minor similarly scaled 1esqd=0.0067226700223333 : e is eccentricity Fn=(a-b)/(a+b) : 0.0016863407 : REM n is (a-b)/(a+b) east%=0:grid$="UTM"  : #cmd(A$): Command line access " :Close_All::exit():  os%=32:Win_TextIO ,in$=cl("-i ",1): in$="":line input  :  line  cl("-?",0):syntax:  cl("-help",0):help: constants_OSGB  A$,1)>"@" "G$=cl("",0):comment$=A$ ,ngr 6_Mvrho(E,N):_toll:_C_EN @output(lambda,phi,C) J. comment$<>"": comment$;(16-comment$); T" ;degN;",";minN;",";secN;" "; ^. ;degE;",";minE;",";secE;",";ew$,1);" "; h r |$ cl("-osgb",0):constants_OSGB " cl("-osi",0):constants_OSI " cl("-itm",0):constants_ITM " cl("-utm",0):constants_UTM .lat$=cl("",0):long$=cl("",0):comment$=A$ 1degN=lat$:A%=lat$+",",","):lat$=lat$,A%+1) 1minN=lat$:A%=lat$+",",","):lat$=lat$,A%+1) 1secN=lat$:A%=lat$+",",","):lat$=lat$,A%+1) : 5degE=long$:A%=long$+",",","):long$=long$,A%+1) 5minE=long$:A%=long$+",",","):long$=long$,A%+1) 5secE=long$:A%=long$+",",","):long$=long$,A%+1)  ew$=long$ : _lltoEN:_ENtongr(E,N) : GL$=NGR$,2):NGR$=NGR$,3) &. comment$<>"": comment$;(16-comment$); 0 GL$;NGR$;" "; :" GL$;NGR$,4);NGR$,6,4);" "; D" GL$;NGR$,3);NGR$,6,3);" "; N" GL$;NGR$,2);NGR$,6,2);" "; X" GL$;NGR$,1);NGR$,6,1);" "; b GL$;" "; l ;east$;" ";north$;" "; v  :  :  input in%=(in$):in%=0:  ::A$=#in%:#in% A$<>""  A$<>"" A$,1)<>"#":line #in%:#in%:in%=0: : Jsyntax:"Syntax: NGRCalc [-i infile] [-help]":  help 9"NGRCalc ";ver$" - Convert National Grid References" 4" NGRCalc [-osgb -osi -itm -utm]"  L" Converts comma-seperated latitude and longitude to grid reference" ;" -osgb - Use OSGB (Great Britain) grid (default)"  ," -osi - Use OSI (old Irish) grid" *," -itm - Use ITM (new Irish) grid" 42" -utm - Use UTM (Channel Islands) grid" ><" Outputs space-seperated string of grid references" H" Examples:" R," Command: NGRCalc 50,0,0 3,0,0,W" \F" Output: SY2834011644 SY28341164 SY283116 SY2811 SY21 SY " f-" Command: NGRCalc 49,15,0 2,5,0,W" pF" Output: XD9393627793 XD93932779 XD939277 XD9327 XD92 XD " z2" Command: NGRCalc 49,15,0 2,5,0,w -utm" F" Output: WV6674157944 WV66745794 WV667579 WV6657 WV65 WV "  " NGRCalc " <" Converts grid reference to latitude and longitude" " Examples:" "" Command: NGRCalc NZ9011" ." Output: 54,29,10.375 0.36,38.071,W" "" Command: NGRCalc IN0050" #" Output: 53,30,0 8,0,0,W"  : + > BLib.Generic.ProgEnv 1.06 20Apr2020 :ݤOS_GetEnv:A$,A%,X%,Y%:X%=1:os%=((&FFF4)&FF00)256 N!=&D7C1C7C5:run$=ARGV$(0):A%=0ARGC:A$=A$+ARGV$(A%)+" "::=A$,run$+1) M How do I detect SDL *before* filtering out DOS which has no INKEY-256 ? = How do I detect that SDL is actually running on Unix-y? $Tos%>31:>&FFFFF:os%=32:X%256:ș"GetModuleFileName",0,X%,255:run$=$$X%:=@cmd$ .CA%=&600-&7B00*(>&8000)-&3F00*(>&C000):!(-&100)=@%:A%=-&300 8;?(P-3)=0:A%=&100:<&FFFF:A%=-&300:!(+512)=@%:A%= BcA$=$A%:=&8F00:run$=A$:ș16A$,,A%:ș72,"",A%:A$=A$,1+A$+" "," ",1+A$," "))):A$=0:A$=run$ LUY%=-10:A$=" "+A$:A$=A$,2):A$<>32:A$=34:A%=A$,"""",2)+1 A%=A$+" "," ") V9Y%:run$=A$,1-(A$=34),A%-1+2*(A$=34)):A$=A$,A%+1) ` :=A$ j#os(A$):A$=42:A$ A$:A$ t ~Fexit(A%):"FX1,"+(A%255):quit$=quit$:A$=quit$:quit$="":os(A$) >&FFFFF:Ș A%  : # > BLib.CmdLine 1.10 27Jul2009 cݤcl(l$,n%):l$="":A$=s(A$):A$=34:A%=A$+" "" ",""" ",2):l$=A$,2,A%-2):A$=s(A$,A%+1)):=l$ "":A%=A$,l$):A%:A$=s(A$,A%-1)+A$,A$," ",A%)+1))+" ":= n%=0:l$<>"":= %A%=" ",l$=32)+A$,l$):A%=0:="" 'A$=A$,A%-1)+s(A$,A$," ",A%)+1)) Cl$=32:l$=A$,A%):A$=A$,A%-1):=l$,1-(l$=34),l$+2*(l$=34)) PA$,A%,1)<>34:l$=A$,A%,A$+" "," ",A%)-A%):A$=A$,A%-1)+A$,A%+l$+1):=l$ Jl$=A$,A%+1,A$+""" ",""" ",A%+1)-A%-1):A$=A$,A%-1)+A$,A%+l$+3):=l$  /ݤs(A$):A$,1)=" ":A$=A$,2):A$,1)<>" " +A$,1)=" ":A$=A$,A$-1):A$,1)<>" " =A$ (: 2 > TextIO <Win_TextIO F0ș "GetStdHandle",-10 @hfile%(1):*INPUT 13 P1ș "GetStdHandle",-11 @hfile%(2):*OUTPUT 14 Z$ș "SetConsoleMode",@hfile%(1),0 d n: x! > BLib.Close 1.00 09Aug1998 Close_All:*EXEC "in%=in%:in%:A%=in%:in%=0:#A% 'out%=out%:out%:A%=out%:out%=0:#A%  :  WINLIB5.BBC Version 1.5 _setfocus(H%)  K%,M%,O%,P%  P% 30  [OPT 2 *.K% push H% : call "SetFocus" : ret 16 2.M% cmp dword [esp+8],&500 : jz K% : jmp [^O%] ] 'ș "GetWindowLong", @hwnd%, -4 O% &ș "SetWindowLong", @hwnd%, -4, M% (ș "SendMessage", @hwnd%, &500, 0, 0 "&ș "SetWindowLong", @hwnd%, -4, O% ,ș "Sleep", 0 6