Post Reply 
ZIPP: G1CMZ's Immensely Practical Package
10-21-2015, 09:07 AM
Post: #1
ZIPP: G1CMZ's Immensely Practical Package
A collection of programs intended to be immediately practical -

The intention is
1 Results should be quick...
A thunderstorm calculation might ask for an estimate of air temperature: the user knows if its cold or warm. It won't ask for air density or composition. And don't expect meaningful results if you say the air temperature is absolute zero.
2 Results should be easily assimilated...
Expect results to be presented in km, not mm.
Though you can ask for more if you need it.
3 If you need software that can handle such extremes, ask about my technical version. Thunderstorm times for the arctic, or for Mars, anyone? I may need to tweak a few formula...

4 I've seen plenty of thunderstorm distance calculators, but this one helps you do the timing too. No, it doesn't need a datastream.

It does unit conversion too.

Stephen Lewkowicz (G1CMZ)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-21-2015, 09:08 AM
Post: #2
RE: ZIPP: G1CMZ's Immensely Practical Package
Version 0.1
Code:


#pragma mode( separator(.,;) integer(h32) )

 LOCAL ZIPPST:="ZIPP V 0.1 ";
 LOCAL SG:=" StephenG1CMZ";
 LOCAL CRID:=ZIPPST+"© 2015 "+SG;
 LOCAL NL:=CHAR(10);
 
 LOCAL CD2,CD1;
 EXPORT ZIPPRND;//USER ROUNDING

 LOCAL THSPD_M;
 LOCAL MEAS_INTERVAL_S;

 LOCAL TOMI:=1.60344;//MILES UK
 LOCAL TONM:=1.852;//NAUTI

 MSNK()
 BEGIN
   LOCAL SNK:=MOUSE();
 END;

 CONVERT_UNIT_GRP(unit,tname)
 BEGIN
  LOCAL x,menu,a1,a2,t;
  LOCAL HLP:=tname+":Enter value(s) using:";

  menu:=unit;//AUTO
  CHOOSE(CD2,"Units:"+tname,menu);
  IF CD2 THEN
   INPUT({{ x,[2],{45,20,3} }},"","Convert ",HLP+unit[CD2]);
   //DETECT ESC
   IF string(x,1) == "0" THEN RETURN; END;

   CHOOSE(CD1, "To Units:"+tname, menu);
   a2 := unit[CD2];
   a1 := unit[CD1];
   t := x + "*" + CONVERT(a2,a1);
   RETURN expr(t);
  END;
 END;

 EXPORT CONVERT_UNITS()
 BEGIN
  LOCAL CHSTYP;
  LOCAL TTL:="Unit types";
  LOCAL UTYP:={"Length","Area","Volume",
   "Time","Speed","Acceleration","Mass","Force",
   "Energy","Power","Pressure","Temperature:NO!",
   "Electricity","Light","Angle","Viscosity","Radiation"};

  LOCAL UL:={};

  CHOOSE(CHSTYP,TTL,UTYP); 
  CASE
   IF CHSTYP==1 THEN //LENGTH
    //CONVERT_Length();
    UL:={1_m,1_cm,1_mm,1_km,1_in,1_ft,1_yd,1_mile,1_nmi,1_au,1_lyr,1_pc,1_Å};
   END;
   IF CHSTYP==2 THEN //AREA
    UL:={1_(cm²),1_(m²),1_(km²),1_(in²),1_(ft²),1_(yd²),1_(mile²),1_(miUS²),1_a​cre,1_ha,1_a,1_b};//A:Are B:Barn
    //CONVERT_UNIT_GRP(UL);
   END;
   IF CHSTYP==3 THEN //VOLUME
    UL:={1_(cm^3),1_(m^3),1_ml,1_l,1_(in^3),1_(ft^3),1_(yd^3),1_ptUK,1_galUK,1_​galUS};
    //CONVERT_UNIT_GRP(UL);
   END;
   IF CHSTYP==4 THEN //TIME
    UL:={1_s,1_min,1_h,1_d,1_yr,1_Hz};
   END;
   IF CHSTYP==5 THEN //SPEED
    UL:={1_(cm/s),1_(m/s),1_kph,1_(km/h),1_(ft/s),1_mph,1_(mile/h),1_knot,1_(rad/s),1_(tr/min),1_(tr/s)};
   END;
   IF CHSTYP==6 THEN //ACCEL
    UL:={1_(m/s²),1_(ft/s²),1_grav,1_Gal,1_(rad/s²)};
   END;
   IF CHSTYP==7 THEN //MASS
    UL:={1_g,1_kg,1_oz,1_lb,1_tonUK,1_tonUS,1_mol,1_u,1_t};
   END;
   IF CHSTYP==8 THEN //FORCE
    UL:={1_(kg*m/s²),1_N,1_dyn,1_lbf,1_kip,1_gf,1_pdl};
   END;
   IF CHSTYP==9 THEN //ENERGY
    UL:={1_(kg*m²/s²),1_J,1_Wh,1_kWh,1_(ft*lbf),1_kcal,1_cal,1_eV,1_MeV,1_Btu,1_erg,1_thermUK,1_th​ermEC,1_thermUS};
   END;
   IF CHSTYP==10 THEN //POWER
    UL:={1_(kg*m²/s^3),1_W,1_MW,1_hp,1_(ft*lbf/s)};
   END;
   IF CHSTYP==11 THEN //PRESSURE
    UL:={1_(kg/(m*s²)),1_Pa,1_bar,1_atm,1_psi,1_torr,1_mmHg,1_inHg,1_inH2O};
   END;
   IF CHSTYP==13 THEN //ELEC
    UL:={1_A,1_V,1_C,1_Ohm,1_F,1_Fdy,1_Wb,1_H,1_mho,1_T,1_(A*h),1_S};
   END;
   IF CHSTYP==14 THEN //LIGHT:HP MISSING MOST UNITS
    UL:={1_cd,1_flam};
   END;
   IF CHSTYP==15 THEN //ANGL
    UL:={1_rad,1_deg,1_arcmin,1_arcs,1_tr};
   END;
   IF CHSTYP==16 THEN //VISCOSITY
    UL:={1_(m²/s),1_P,1_St};
   END;
   IF CHSTYP==17 THEN //RADIATION
    UL:={1_Bq,1_Ci,1_Gy,1_rd,1_rem,1_Sv,1_R};
   END;
   DEFAULT
    //DO NOT CONVERT_UNIT_GRP(UL);
  END;
  IF SIZE(UL)>0 THEN //AND CHSTYP>0
   MSGBOX(CONVERT_UNIT_GRP(UL,UTYP(CHSTYP)),1);
  END;
 END;


 INPUT_INTERVAL_H(TTL)
 BEGIN
  LOCAL HH,MM,SS;
  LOCAL LBL:={"HH","MM","SS"};
  LOCAL HLP:="HH MM SS:ETC";
  INPUT({HH,MM,SS},TTL,LBL,HLP,0,0);
  RETURN HH+(MM/60)+(SS/3600); 
 END;

 EXPORT MEASURE_INTERVAL_S()
 BEGIN
  LOCAL TICKB,TICKE,TICKL;
  LOCAL TS,KK;
  LOCAL MI:=0;
  LOCAL MST:="MEASURE SHORT INTERVAL"+NL;
  LOCAL MST1:="OK or Enter: Start"+NL;
  LOCAL MST2:="Enter:Enter HMS numerically"+NL;
  LOCAL MST3:="ANY KEY: End"+NL;
  //LOCAL CNW:="CONNECTIVITY:NO HP DATA";
  LOCAL ENINST:="Enter INTERVAL";
  
  TICKB:=MSGBOX(MST+MST1+MST2+MST3,1);
  IF TICKB THEN
   RECT();
   TICKB:=Ticks; TS:=Time;
   TICKL:=TICKB;
   REPEAT 
    MSNK;
    IF Ticks-TICKL≥1000 THEN
     TICKL:=Ticks;
     RECT();
     TEXTOUT_P(→HMS(ROUND((Ticks-TICKB)/1000,0)/3600),0,20);
     MSNK;
     TEXTOUT_P(TS+MST,0,180);
     TEXTOUT_P(MST2,0,200);
     TEXTOUT_P(MST3,0,220);

    END;
    WAIT(0.001);
    MSNK;
    KK:=GETKEY;
   UNTIL KK≥0;
   TICKE:=Ticks;
   MI:=(TICKE-TICKB)/1000;
   IF KK==30 THEN //ENTER
    MI:=3600*INPUT_INTERVAL_H(ENINST);
   END;
  END;
  RETURN MEAS_INTERVAL_S:=ROUND(MI,ZIPPRND);   
 END;

 THUNDER_DISTANCE_CALC_M(INTERVAL_S,TEMP_C)
 //INTERVAL
 //CENTIGRADE (NORMAL RANGE)
 BEGIN
  LOCAL DISTM;

  THSPD_M:=331.4+0.6*TEMP_C;//M/S
  DISTM:=INTERVAL_S*THSPD_M;
  RETURN ROUND(DISTM,ZIPPRND);
 END;

 EXPORT THUNDER_DISTANCE()
 BEGIN
  LOCAL OK;
  LOCAL THDST:={};
  LOCAL THDM,THDKM,THDMI,THDNM;
  LOCAL INTERVAL_S,TEMP_C;
  LOCAL TTL:="THUNDER DISTANCE"+SG;
  LOCAL LBL:={"Interval s","Temp C"};
  LOCAL HLP:={"Interval sound-light. (0:use measured value)","temp C eg 0..20:Ground −57: Aircraft"};
  OK:=INPUT({INTERVAL_S,TEMP_C},TTL,LBL,HLP,MEAS_INTERVAL_S,0);
  IF OK THEN
   IF INTERVAL_S≤0 THEN //IMPORT VALUE
    INTERVAL_S:=MEAS_INTERVAL_S;
   END;
   THDM:=THUNDER_DISTANCE_CALC_M(INTERVAL_S,TEMP_C);
   THDKM:=THDM/1000;
   THDMI:=THDKM/TOMI;
   THDNM:=THDKM/TONM;

   THDST(1):=ROUND(INTERVAL_S,0)+" s"+" @ "+ROUND(THSPD_M,ZIPPRND)+" m/s"+NL;
   THDST(2):=THDM+" m "+ROUND(THDKM,ZIPPRND)+" km"+NL;
   THDST(3):=ROUND(THDMI,ZIPPRND)+" milesUK"+NL;
   THDST(4):=ROUND(THDNM,ZIPPRND)+" Nautical Miles";
   MSGBOX(THDST(1)+THDST(2)+THDST(3)+THDST(4));
   RETURN THDST(2);
  END;
 END;

 ABOUT ()
 BEGIN
  LOCAL ST:="StephenG1CMZ is a programmer and can work to your requirements."+NL;
  LOCAL SZ:="ZIPP provides useful practical results.
Ask, if you need technical results."+NL;
  LOCAL THANX:="Thanks Han for the CONVERT syntax."+NL; 
  LOCAL LGL:="No liability is accepted.";
  PRINT(); PRINT(CRID);
  PRINT(ST+NL+SZ);
  PRINT(THANX);
  PRINT(LGL);
  WAIT;
 END;

 HELP ()
 BEGIN
  LOCAL ST:="To change the number of digits displayed:
 ZIPPRND:=n where n=−12..12"+NL;

  LOCAL CVT:="CONVERT
Note that not all units within a group can be converted.
Conversion between groups (eg length*length to area) is not implemented here."+NL;
  PRINT(); PRINT(CRID);
  PRINT(CVT+ST);
  WAIT;
 END;

 EXPORT G1CMZ_IMMENSELY_PRACTICAL_PACKAGE ()
 BEGIN
  LOCAL CHS;
  
  REPEAT 
   CHOOSE(CHS,CRID,{"ABOUT","HELP","CONVERT UNITS","MEASURE INTERVAL s","THUNDER DISTANCE","EXIT"});
   CASE
    IF CHS==1 THEN ABOUT() END;
    IF CHS==2 THEN HELP() END;
    IF CHS==3 THEN CONVERT_UNITS() END;
    IF CHS==4 THEN MSGBOX(MEASURE_INTERVAL_S()+" s",1) END;
    IF CHS==5 THEN THUNDER_DISTANCE() END;
    IF CHS==6 THEN CHS:=0 END;
    DEFAULT
   END;
   //WAIT;
  UNTIL CHS==0;

 END;

 EXPORT ZIPP()
 BEGIN
  G1CMZ_IMMENSELY_PRACTICAL_PACKAGE();
 END;

Stephen Lewkowicz (G1CMZ)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-22-2015, 11:00 PM
Post: #3
RE: ZIPP: G1CMZ's Immensely Practical Package
Version 0.2:
Now supports SI prefixes in unit conversions. User interface tweaked.
Code:


#pragma mode( separator(.,;) integer(h32) )

 LOCAL ZIPPST:="ZIPP V 0.2 ";
 LOCAL SG:=" StephenG1CMZ";
 LOCAL CRID:=ZIPPST+"© 2015 "+SG;
 LOCAL NL:=CHAR(10);
 
 LOCAL CDFROM,CDTO;
 EXPORT ZIPPROUND;//USER ROUNDING

 LOCAL THSPD_M;
 LOCAL MEAS_INTERVAL_S;

 LOCAL TOMI:=1.60344;//MILES UK
 LOCAL TONM:=1.852;//NAUTI

 //SI PREFIXES
 LOCAL YOTTA:=1ᴇ24;
 LOCAL ZETTA:=1ᴇ21;
 LOCAL EXA  :=1ᴇ18;
 LOCAL PETA :=1ᴇ15;
 LOCAL TERA :=1ᴇ12;
 LOCAL GIGA :=1ᴇ9;
 LOCAL MEGA :=1ᴇ6;
 LOCAL KILO :=1ᴇ3;
 LOCAL HECTO:=1ᴇ2;
 LOCAL DECA :=1ᴇ1;
 LOCAL DECI :=1ᴇ−1;
 LOCAL CENTI:=1ᴇ−2;
 LOCAL MILLI:=1ᴇ−3;
 LOCAL MICRO:=1ᴇ−6;
 LOCAL NANO :=1ᴇ−9;
 LOCAL PICO :=1ᴇ−12;
 LOCAL FEMTO:=1ᴇ−15;
 LOCAL ATTO :=1ᴇ−18;
 LOCAL ZEPTO:=1ᴇ−21;
 LOCAL YOCTO:=1ᴇ−24;


 MSNK()
 BEGIN
   LOCAL SNK:=MOUSE();
 END;

 CONVERT_UNIT_GRP(unit,tname)
 BEGIN
  LOCAL x,menu,a1,a2,t;
  LOCAL UF;
  LOCAL TTL:="TO USE SI PREFIXES: TYPE PREFIXNAME";
  LOCAL HLP:=tname+": Enter value(s) using: ";

  menu:=unit;//AUTO
  CHOOSE(CDFROM,"Units:"+tname,menu);
  IF CDFROM THEN
   UF:=MID(STRING(unit[CDFROM]),3);//REMOVE 1_
   INPUT({{ x,[2],{45,20,3} }},TTL,"Convert ",HLP+UF);
   //DETECT ESC
   IF string(x,1) == "0" THEN RETURN; END;
   
   CHOOSE(CDTO, "To Units:"+tname, menu);
   a2 := unit[CDFROM];
   a1 := unit[CDTO];
   t := x + "*" + CONVERT(a2,a1);
   RETURN expr(t);
  END;
 END;

 EXPORT CONVERT_UNITS()
 BEGIN
  LOCAL CHSTYP;
  LOCAL TTL:="Unit types";
  LOCAL UTYP:={"Length","Area","Volume",
   "Time","Speed","Acceleration","Mass","Force",
   "Energy","Power","Pressure","Temperature:NO!",
   "Electricity","Light","Angle","Viscosity","Radiation"};

  LOCAL UL:={};

  CHOOSE(CHSTYP,TTL,UTYP); 
  CASE
   IF CHSTYP==1 THEN //LENGTH
    //CONVERT_Length();
    UL:={1_m,1_cm,1_mm,1_km,1_in,1_ft,1_yd,1_mile,1_nmi,1_au,1_lyr,1_pc,1_Å};
   END;
   IF CHSTYP==2 THEN //AREA
    UL:={1_(cm²),1_(m²),1_(km²),1_(in²),1_(ft²),1_(yd²),1_(mile²),1_(miUS²),1_a​cre,1_ha,1_a,1_b};//A:Are B:Barn
    //CONVERT_UNIT_GRP(UL);
   END;
   IF CHSTYP==3 THEN //VOLUME
    UL:={1_(cm^3),1_(m^3),1_ml,1_l,1_(in^3),1_(ft^3),1_(yd^3),1_ptUK,1_galUK,1_​galUS};
    //CONVERT_UNIT_GRP(UL);
   END;
   IF CHSTYP==4 THEN //TIME
    UL:={1_s,1_min,1_h,1_d,1_yr,1_Hz};
   END;
   IF CHSTYP==5 THEN //SPEED
    UL:={1_(cm/s),1_(m/s),1_kph,1_(km/h),1_(ft/s),1_mph,1_(mile/h),1_knot,1_(rad/s),1_(tr/min),1_(tr/s)};
   END;
   IF CHSTYP==6 THEN //ACCEL
    UL:={1_(m/s²),1_(ft/s²),1_grav,1_Gal,1_(rad/s²)};
   END;
   IF CHSTYP==7 THEN //MASS
    UL:={1_g,1_kg,1_oz,1_lb,1_tonUK,1_tonUS,1_mol,1_u,1_t};
   END;
   IF CHSTYP==8 THEN //FORCE
    UL:={1_(kg*m/s²),1_N,1_dyn,1_lbf,1_kip,1_gf,1_pdl};
   END;
   IF CHSTYP==9 THEN //ENERGY
    UL:={1_(kg*m²/s²),1_J,1_Wh,1_kWh,1_(ft*lbf),1_kcal,1_cal,1_eV,1_MeV,1_Btu,1_erg,1_thermUK,1_th​ermEC,1_thermUS};
   END;
   IF CHSTYP==10 THEN //POWER
    UL:={1_(kg*m²/s^3),1_W,1_MW,1_hp,1_(ft*lbf/s)};
   END;
   IF CHSTYP==11 THEN //PRESSURE
    UL:={1_(kg/(m*s²)),1_Pa,1_bar,1_atm,1_psi,1_torr,1_mmHg,1_inHg,1_inH2O};
   END;
   IF CHSTYP==13 THEN //ELEC
    UL:={1_A,1_V,1_C,1_Ohm,1_F,1_Fdy,1_Wb,1_H,1_mho,1_T,1_(A*h),1_S};
   END;
   IF CHSTYP==14 THEN //LIGHT:HP MISSING MOST UNITS
    UL:={1_cd,1_flam};
   END;
   IF CHSTYP==15 THEN //ANGL
    UL:={1_rad,1_deg,1_arcmin,1_arcs,1_tr};
   END;
   IF CHSTYP==16 THEN //VISCOSITY
    UL:={1_(m²/s),1_P,1_St};
   END;
   IF CHSTYP==17 THEN //RADIATION
    UL:={1_Bq,1_Ci,1_Gy,1_rd,1_rem,1_Sv,1_R};
   END;
   DEFAULT
    //DO NOT CONVERT_UNIT_GRP(UL);
  END;
  IF SIZE(UL)>0 THEN //AND CHSTYP>0
   MSGBOX(CONVERT_UNIT_GRP(UL,UTYP(CHSTYP)),1);
  END;
 END;


 INPUT_INTERVAL_H(TTL)
 BEGIN
  LOCAL HH,MM,SS;
  LOCAL IV:="INTERVAL ";
  LOCAL LBL:={IV+"HH",IV+"MM",IV+"SS"};
  LOCAL HLP1:="Decimals & Fractions allowed";
  LOCAL HLP:={HLP1,HLP1,HLP1};

  INPUT({HH,MM,SS},TTL,LBL,HLP,0,0);
  RETURN HH+(MM/60)+(SS/3600); 
 END;

 EXPORT MEASURE_INTERVAL_S()
 BEGIN
  LOCAL TICKB,TICKE,TICKL;
  LOCAL TS,KK;
  LOCAL MI:=0;
  
  LOCAL MST:="MEASURE SHORT INTERVAL"+NL;
  LOCAL MST1:="OK or Enter: Start"+NL;
  LOCAL MST2:="Enter:Enter HMS numerically"+NL;
  LOCAL MST3:="ANY KEY: End"+NL;
  //LOCAL CNW:="CONNECTIVITY:NO HP DATA";
  LOCAL ENINST:="Enter INTERVAL";
  
  TICKB:=MSGBOX(MST+MST1+MST2+MST3,1);
  IF TICKB THEN
   RECT();
   TICKB:=Ticks; TS:=Time;
   TICKL:=TICKB;
   REPEAT 
    MSNK;
    IF Ticks-TICKL≥1000 THEN
     TICKL:=Ticks;
     RECT();
     TEXTOUT_P(→HMS(ROUND((Ticks-TICKB)/1000,0)/3600),0,20);
     MSNK;
     TEXTOUT_P(TS+MST,0,180);
     TEXTOUT_P(MST2,0,200);
     TEXTOUT_P(MST3,0,220);

    END;
    WAIT(0.001);
    MSNK;
    KK:=GETKEY;
   UNTIL KK≥0;
   TICKE:=Ticks;
   MI:=(TICKE-TICKB)/1000;
   IF KK==30 THEN //ENTER
    MI:=3600*INPUT_INTERVAL_H(ENINST);
   END;
  END;
  RETURN MEAS_INTERVAL_S:=ROUND(MI,ZIPPROUND);   
 END;

 THUNDER_DISTANCE_CALC_M(INTERVAL_S,TEMP_C)
 //INTERVAL
 //CENTIGRADE (NORMAL RANGE)
 BEGIN
  LOCAL DISTM;

  THSPD_M:=331.4+0.6*TEMP_C;//M/S
  DISTM:=INTERVAL_S*THSPD_M;
  RETURN ROUND(DISTM,ZIPPROUND);
 END;

 EXPORT THUNDER_DISTANCE()
 BEGIN
  LOCAL OK;
  LOCAL THDST:={};
  LOCAL THDM,THDKM,THDMI,THDNM;
  LOCAL INTERVAL_S,TEMP_C;
  LOCAL TTL:="THUNDER DISTANCE"+SG;
  LOCAL LBL:={"Interval s","Temp C"};
  LOCAL HLP:={"Interval sound-light. (0:use measured value)","temp C eg 0..20:Ground −57: Aircraft"};
  OK:=INPUT({INTERVAL_S,TEMP_C},TTL,LBL,HLP,MEAS_INTERVAL_S,0);
  IF OK THEN
   IF INTERVAL_S≤0 THEN //IMPORT VALUE
    INTERVAL_S:=MEAS_INTERVAL_S;
   END;
   THDM:=THUNDER_DISTANCE_CALC_M(INTERVAL_S,TEMP_C);
   THDKM:=THDM/1000;
   THDMI:=THDKM/TOMI;
   THDNM:=THDKM/TONM;

   THDST(1):=ROUND(INTERVAL_S,0)+" s"+" @ "+ROUND(THSPD_M,ZIPPROUND)+" m/s"+NL;
   THDST(2):=THDM+" m "+ROUND(THDKM,ZIPPROUND)+" km"+NL;
   THDST(3):=ROUND(THDMI,ZIPPROUND)+" milesUK"+NL;
   THDST(4):=ROUND(THDNM,ZIPPROUND)+" Nautical Miles";
   MSGBOX(THDST(1)+THDST(2)+THDST(3)+THDST(4));
   RETURN THDST(2);
  END;
 END;

 ABOUT ()
 BEGIN
  LOCAL ST:="StephenG1CMZ is a programmer and can work to your requirements."+NL;
  LOCAL SZ:="ZIPP provides useful practical results.
Ask, if you need technical results."+NL;
  LOCAL THANX:="Thanks Han for the CONVERT syntax."+NL; 
  LOCAL LGL:="No liability is accepted.";
  PRINT(); PRINT(CRID);
  PRINT(ST+NL+SZ);
  PRINT(THANX);
  PRINT(LGL);
  WAIT;
 END;

 HELP ()
 BEGIN
  LOCAL ST:="To change the number of digits displayed:
 ZIPPROUND:=n where n=−12..12"+NL;

  LOCAL CVT:="CONVERT
Note that not all units within a group can be converted. Conversion between groups (eg length*length to area) is not implemented here.
SI prefixes allowed, e.g. INPUT 1*NANO (Type it, Do not select from Prefix menu)"+NL ;

  PRINT(); PRINT(CRID);
  PRINT(CVT+ST);
  WAIT;
 END;

 EXPORT G1CMZ_IMMENSELY_PRACTICAL_PACKAGE ()
 BEGIN
  LOCAL CHS;
  
  REPEAT 
   CHOOSE(CHS,CRID,{"ABOUT","HELP","CONVERT UNITS","MEASURE INTERVAL s","THUNDER DISTANCE","EXIT"});
   CASE
    IF CHS==1 THEN ABOUT() END;
    IF CHS==2 THEN HELP() END;
    IF CHS==3 THEN CONVERT_UNITS() END;
    IF CHS==4 THEN MSGBOX(MEASURE_INTERVAL_S()+" s",1) END;
    IF CHS==5 THEN THUNDER_DISTANCE() END;
    IF CHS==6 THEN CHS:=0 END;
    DEFAULT
   END;
   //WAIT;
  UNTIL CHS==0;

 END;

 EXPORT ZIPP()
 BEGIN
  G1CMZ_IMMENSELY_PRACTICAL_PACKAGE();
 END;

Stephen Lewkowicz (G1CMZ)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-24-2015, 06:01 PM
Post: #4
RE: ZIPP: G1CMZ's Immensely Practical Package
Version 0.3:
User interface improved. Multilingual support added.
In English, et maintenant en francais aussi (translated with the help of Google).
Code:

#pragma mode( separator(.,;) integer(h32) )

 LOCAL ZIPPST:="ZIPP V 0.3 ";
 LOCAL SG:=" StephenG1CMZ";
 LOCAL CRID:=ZIPPST+"© 2015 "+SG;
 LOCAL NL:=CHAR(10);
 LOCAL SL:=1;

 LOCAL CDFROM,CDTO;
 EXPORT ZIPPROUND;//USER ROUNDING

 LOCAL THSPD_M;
 LOCAL MEAS_INTERVAL_S;

 LOCAL TOMI:=1.60344;//MILES UK
 LOCAL TONM:=1.852;//NAUTI

 //SI PREFIXES
 LOCAL YOTTA:=1ᴇ24;
 LOCAL ZETTA:=1ᴇ21;
 LOCAL EXA  :=1ᴇ18;
 LOCAL PETA :=1ᴇ15;
 LOCAL TERA :=1ᴇ12;
 LOCAL GIGA :=1ᴇ9;
 LOCAL MEGA :=1ᴇ6;
 LOCAL KILO :=1ᴇ3;
 LOCAL HECTO:=1ᴇ2;
 LOCAL DECA :=1ᴇ1;
 LOCAL DECI :=1ᴇ−1;
 LOCAL CENTI:=1ᴇ−2;
 LOCAL MILLI:=1ᴇ−3;
 LOCAL MICRO:=1ᴇ−6;
 LOCAL NANO :=1ᴇ−9;
 LOCAL PICO :=1ᴇ−12;
 LOCAL FEMTO:=1ᴇ−15;
 LOCAL ATTO :=1ᴇ−18;
 LOCAL ZEPTO:=1ᴇ−21;
 LOCAL YOCTO:=1ᴇ−24;

 LOCAL NMST:={" Nautical Miles"," Miles Nautique"};
 LOCAL LANGS:={"English","Français"};
 //e233

 
 LOCAL CHOICES:={{"ABOUT","HELP","CONVERT UNITS","MEASURE INTERVAL s","THUNDER DISTANCE","EXIT",LANGS},
 {"SUR","AIDEZ","CONVERTIR DES UNITÉS","INTERVALLE DE MESURE s","DISTANCEdeTONNERRE","AU REVOIR",LANGS}};

 EXPORT ABOUT ()
 BEGIN
  LOCAL ST:="StephenG1CMZ is a programmer and can work to your requirements."+NL;
  LOCAL SZ:="ZIPP provides useful practical results.
Ask, if you need technical results."+NL;
  LOCAL THANX:="Thanks Han for the CONVERT syntax."+NL; 
  LOCAL LGL:="No liability is accepted.";
  PRINT(); PRINT(CRID);
  PRINT(ST+NL+SZ);
  PRINT(THANX);
  PRINT(LGL);
  WAIT;
 END;

 MSNK()
 BEGIN
   LOCAL SNK:=MOUSE();
 END;

 TRIMMENU(INL)
 BEGIN
  LOCAL II;
  LOCAL OUTL:={};

  FOR II FROM 1 TO SIZE(INL)  DO
   OUTL(II):=REPLACE(STRING(INL(II)),"1_","");
  END;
  RETURN OUTL;  
 END;

 CONVERT_UNIT_GRP(unit,tname)
 BEGIN
  LOCAL x,menu,a1,a2,t;
  LOCAL UF;
  LOCAL TTL:={"To use SI prefixes: INPUT PREFIXNAME",
    "SI préfixe: Saisissez le nom du préfixe"};
  
  LOCAL EVUST:={
   ": Enter value(s) using: ",
   ": Entrez le(s) valeur(s) à l aide: "};
  LOCAL HLP:=tname+EVUST(SL);
  LOCAL UST:={"Units:","Unités:"};
  LOCAL TOST:={"To ","À "};
  LOCAL CNVRT:={"Convert","Convertir"};

  menu:=TRIMMENU(unit);//AUTO
  CHOOSE(CDFROM,UST(SL)+tname,menu);
  IF CDFROM THEN
   UF:=REPLACE(STRING(unit[CDFROM]),"1_",""); //TRIM 1_
   INPUT({{ x,[2],{45,20,3} }},TTL(SL),CNVRT(SL),HLP+UF);
   //DETECT ESC
   IF string(x,1) == "0" THEN RETURN; END;
   
   CHOOSE(CDTO, TOST(SL)+UST(SL)+tname, menu);
   a2 := unit[CDFROM];
   a1 := unit[CDTO];
   t := x + "*" + CONVERT(a2,a1);
   RETURN expr(t);
  END;
 END;

 EXPORT CONVERT_UNITS()
 BEGIN
  LOCAL CHSTYP;
  LOCAL TTL:={"Unit types","Types d unités"};
  LOCAL UTYP:={"Length","Area","Volume",
   "Time","Speed","Acceleration","Mass","Force",
   "Energy","Power","Pressure","Temperature:NO!",
   "Electricity","Light","Angle","Viscosity","Radiation"};

  LOCAL UL:={};

  CHOOSE(CHSTYP,TTL(SL),UTYP); 
  CASE
   IF CHSTYP==1 THEN //LENGTH
    //CONVERT_Length();
    UL:={1_m,1_cm,1_mm,1_km,1_in,1_ft,1_yd,1_mile,1_nmi,1_au,1_lyr,1_pc,1_Å};
   END;
   IF CHSTYP==2 THEN //AREA
    UL:={1_(cm²),1_(m²),1_(km²),1_(in²),1_(ft²),1_(yd²),1_(mile²),1_(miUS²),1_a​cre,1_ha,1_a,1_b};//A:Are B:Barn
    //CONVERT_UNIT_GRP(UL);
   END;
   IF CHSTYP==3 THEN //VOLUME
    UL:={1_(cm^3),1_(m^3),1_ml,1_l,1_(in^3),1_(ft^3),1_(yd^3),1_ptUK,1_galUK,1_​galUS};
    //CONVERT_UNIT_GRP(UL);
   END;
   IF CHSTYP==4 THEN //TIME
    UL:={1_s,1_min,1_h,1_d,1_yr,1_Hz};
   END;
   IF CHSTYP==5 THEN //SPEED
    UL:={1_(cm/s),1_(m/s),1_kph,1_(km/h),1_(ft/s),1_mph,1_(mile/h),1_knot,1_(rad/s),1_(tr/min),1_(tr/s)};
   END;
   IF CHSTYP==6 THEN //ACCEL
    UL:={1_(m/s²),1_(ft/s²),1_grav,1_Gal,1_(rad/s²)};
   END;
   IF CHSTYP==7 THEN //MASS
    UL:={1_g,1_kg,1_oz,1_lb,1_tonUK,1_tonUS,1_mol,1_u,1_t};
   END;
   IF CHSTYP==8 THEN //FORCE
    UL:={1_(kg*m/s²),1_N,1_dyn,1_lbf,1_kip,1_gf,1_pdl};
   END;
   IF CHSTYP==9 THEN //ENERGY
    UL:={1_(kg*m²/s²),1_J,1_Wh,1_kWh,1_(ft*lbf),1_kcal,1_cal,1_eV,1_MeV,1_Btu,1_erg,1_thermUK,1_th​ermEC,1_thermUS};
   END;
   IF CHSTYP==10 THEN //POWER
    UL:={1_(kg*m²/s^3),1_W,1_MW,1_hp,1_(ft*lbf/s)};
   END;
   IF CHSTYP==11 THEN //PRESSURE
    UL:={1_(kg/(m*s²)),1_Pa,1_bar,1_atm,1_psi,1_torr,1_mmHg,1_inHg,1_inH2O};
   END;
   IF CHSTYP==13 THEN //ELEC
    UL:={1_A,1_V,1_C,1_Ohm,1_F,1_Fdy,1_Wb,1_H,1_mho,1_T,1_(A*h),1_S};
   END;
   IF CHSTYP==14 THEN //LIGHT:HP MISSING MOST UNITS
    UL:={1_cd,1_flam};
   END;
   IF CHSTYP==15 THEN //ANGL
    UL:={1_rad,1_deg,1_arcmin,1_arcs,1_tr};
   END;
   IF CHSTYP==16 THEN //VISCOSITY
    UL:={1_(m²/s),1_P,1_St};
   END;
   IF CHSTYP==17 THEN //RADIATION
    UL:={1_Bq,1_Ci,1_Gy,1_rd,1_rem,1_Sv,1_R};
   END;
   DEFAULT
  END;
  IF SIZE(UL)>0 THEN //AND CHSTYP>0
   MSGBOX(CONVERT_UNIT_GRP(UL,UTYP(CHSTYP)),1);
  END;
 END;


 INPUT_INTERVAL_H(TTL)
 BEGIN
  LOCAL HH,MM,SS;
  LOCAL IV:={"Interval ","Intervalle "};
  LOCAL LBL:={IV(SL)+"HH",IV(SL)+"MM",IV(SL)+"SS"};
  LOCAL HLP1:={"Decimals & Fractions allowed",
    "Décimaux et les fractions permis"};
  LOCAL HLP:={HLP1(SL),HLP1(SL),HLP1(SL)};

  INPUT({HH,MM,SS},TTL,LBL,HLP,0,0);
  RETURN HH+(MM/60)+(SS/3600); 
 END;

 EXPORT MEASURE_INTERVAL_S()
 BEGIN
  LOCAL TICKB,TICKE,TICKL;
  LOCAL TS,KK;
  LOCAL MI:=0;
  
  LOCAL MST:={"MEASURE SHORT INTERVAL"+NL,
   "MESURE COURT INTERVALLE"+NL};
  LOCAL MST1:={"OK or Enter: Start"+NL,
   "OK ou Entrer: Commencez"+NL};
  LOCAL MST2:={"Enter:Enter HMS numerically"+NL,
   "Entrer: Entrez HMS numeriquement"+NL};
  LOCAL MST3:={"ANY KEY: End"+NL,
   "N importe quelle clé: Terminer"+NL};
  //LOCAL CNW:="CONNECTIVITY:NO HP DATA";
  LOCAL ENINST:={"Enter INTERVAL","Entrez INTERVALLE"};
  
  TICKB:=MSGBOX(MST(SL)+MST1(SL)+MST2(SL)+MST3(SL),1);
  IF TICKB THEN
   RECT();
   TICKB:=Ticks; TS:=Time;
   TICKL:=TICKB;
   REPEAT 
    MSNK;
    IF Ticks-TICKL≥1000 THEN
     TICKL:=Ticks;
     RECT();
     TEXTOUT_P(→HMS(ROUND((Ticks-TICKB)/1000,0)/3600),0,20);
     MSNK;
     TEXTOUT_P(TS+MST(SL),0,180);
     TEXTOUT_P(MST2(SL),0,200);
     TEXTOUT_P(MST3(SL),0,220);

    END;
    WAIT(0.001);
    MSNK;
    KK:=GETKEY;
   UNTIL KK≥0;
   TICKE:=Ticks;
   MI:=(TICKE-TICKB)/1000;
   IF KK==30 THEN //ENTER
    MI:=3600*INPUT_INTERVAL_H(ENINST(SL));
   END;
  END;
  RETURN MEAS_INTERVAL_S:=ROUND(MI,ZIPPROUND);   
 END;

 THUNDER_DISTANCE_CALC_M(INTERVAL_S,TEMP_C)
 //INTERVAL
 //CENTIGRADE (NORMAL RANGE)
 BEGIN
  LOCAL DISTM;

  THSPD_M:=331.4+0.6*TEMP_C;//M/S
  DISTM:=INTERVAL_S*THSPD_M;
  RETURN ROUND(DISTM,ZIPPROUND);
 END;

 EXPORT THUNDER_DISTANCE()
 BEGIN
  LOCAL OK;
  LOCAL THDST:={};
  LOCAL THDM,THDKM,THDMI,THDNM;
  LOCAL INTERVAL_S,TEMP_C;

  LOCAL TTL:=CHOICES(SL,5)+SG;
  LOCAL LBL:={{"Interval s","Temp C"},
   {"Intervalle s","Temp C"}};
  LOCAL HLP:={{"Interval sound-light. (0:use measured value)","Temp C eg 0..20:Ground −57: Aircraft"},
   {"Intervalle sonner-lumière. 0:La valeur de mesure","Temp C eg 0..20:Terre −57:Avion"}};
  OK:=INPUT({INTERVAL_S,TEMP_C},TTL,LBL(SL),HLP(SL),MEAS_INTERVAL_S,0);
  IF OK THEN
   IF INTERVAL_S≤0 THEN //IMPORT VALUE
    INTERVAL_S:=MEAS_INTERVAL_S;
   END;
   THDM:=THUNDER_DISTANCE_CALC_M(INTERVAL_S,TEMP_C);
   THDKM:=THDM/1000;
   THDMI:=THDKM/TOMI;
   THDNM:=THDKM/TONM;

   THDST(1):=ROUND(INTERVAL_S,0)+" s"+" @ "+ROUND(THSPD_M,ZIPPROUND)+" m/s"+NL;
   THDST(2):=THDM+" m "+ROUND(THDKM,ZIPPROUND)+" km"+NL;
   THDST(3):=ROUND(THDMI,ZIPPROUND)+" milesUK"+NL;
   THDST(4):=ROUND(THDNM,ZIPPROUND)+NMST(SL);
   MSGBOX(THDST(1)+THDST(2)+THDST(3)+THDST(4));
   RETURN THDST(2);
  END;
 END;

 
 ZIPP_HELP ()
 BEGIN
  LOCAL CHS;
  LOCAL HLPST:={"HELP","AIDEZ"};
  LOCAL PFXS:={"PREFIXES","PRÉFIXES"};
  LOCAL HLPCHO:={"SI "+PFXS(SL),"VARIABLES"};
  LOCAL HC:=CONCAT(HLPCHO,CHOICES(SL));

  LOCAL SIPRFX:={"
ENTER IN UPPERCASE
YOU GET WHAT YOU SAY 
Selecting Units/Prefix (Shift C) will not work."+NL,
"Entrez en majuscule
VOUS OBTENEZ QUEL CE VOUS DEMANDEZ
Selection Unites/Prefixe (Decalage C) ne marchant pas."+NL};
 LOCAL SIPRFXEG:="
3MILLI _m
3MILLI _cm 
3MILLI _inch"; 
  LOCAL ST:={"
To change the number of digits displayed:","
Pour changez l arondissement:"};
  LOCAL STEG:="
@Home:
 ZIPPROUND:=n  [n=−12..12]"+NL;

  LOCAL CVT:={"
Note that not all units within a group can be converted. Conversion between groups (eg length*length to area) is not implemented here.
SI prefixes OK.
Lists and variables OK."+NL, "
Notez que toutes les unités d un groupe ne_peuvent pas etre convertis.
SI préfixes OK.
Listes et variables OK"+NL};
  
  PRINT(); PRINT(CRID);
  CHOOSE(CHS,HLPST(SL),HC);
  IF CHS THEN
   PRINT(HC(CHS));
   CASE
    IF CHS==5 THEN PRINT(CVT(SL))  END;
    IF CHS==1 THEN PRINT(SIPRFX(SL)+SIPRFXEG) END;
    IF CHS==2 THEN PRINT(ST(SL)+STEG) END;
    IF CHS==3 THEN ABOUT() END;
    DEFAULT
   END;
   WAIT;
  END;
 END;

 SELECT_LANGUAGE()
 BEGIN
  LOCAL CHS;
  CHOOSE(CHS,LANGS(SL),LANGS);//CURRENT
  IF CHS THEN
   SL:=CHS;
  END; 
 END;


 EXPORT G1CMZ_IMMENSELY_PRACTICAL_PACKAGE ()
 BEGIN
  LOCAL CHS;
  
  REPEAT 
   CHOOSE(CHS,CRID,CHOICES(SL));
   CASE
    IF CHS==1 THEN ABOUT() END;
    IF CHS==2 THEN ZIPP_HELP() END;
    IF CHS==3 THEN CONVERT_UNITS() END;
    IF CHS==4 THEN MSGBOX(MEASURE_INTERVAL_S()+" s",1) END;
    IF CHS==5 THEN THUNDER_DISTANCE() END;
    IF CHS==6 THEN CHS:=0 END;
    IF CHS==7 THEN SELECT_LANGUAGE() END;
    DEFAULT
   END;
   //WAIT;
  UNTIL CHS==0;

 END;

 EXPORT ZIPP()
 BEGIN
  G1CMZ_IMMENSELY_PRACTICAL_PACKAGE();
 END;

Stephen Lewkowicz (G1CMZ)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-28-2015, 10:53 PM (This post was last modified: 10-29-2015 10:46 PM by StephenG1CMZ.)
Post: #5
RE: ZIPP: G1CMZ's Immensely Practical Package
Version 0.4:
All functions improved, new functionality added and translations improved.
You will need to create an empty procedure (or comment out the call). - this procedure will be uploaded as a separate program in the next few days.
(Update: Z LIGHTS is now available, so you can install this instead of creating an empty procedure)
Code:


#pragma mode( separator(.,;) integer(h32) )
 
 LOCAL ZIPPST:="ZIPP V 0.4 ";
 LOCAL SG:=" StephenG1CMZ";
 LOCAL CRID:=ZIPPST+"© 2015 "+SG;
 LOCAL NL:=CHAR(10);
 LOCAL SL:=1;

 //IMPORT Z_LIGHTS();

 LOCAL CDFROM,CDTO;
 EXPORT ZIPPROUND;//USER ROUNDING

 LOCAL THSPD_M;
 LOCAL MEAS_INTERVAL_S;

 LOCAL TOMI:=1.60344;//MILES UK
 LOCAL TONM:=1.852;//NAUTI

 //SI PREFIXES
 LOCAL YOTTA:=1ᴇ24;
 LOCAL ZETTA:=1ᴇ21;
 LOCAL EXA  :=1ᴇ18;
 LOCAL PETA :=1ᴇ15;
 LOCAL TERA :=1ᴇ12;
 LOCAL GIGA :=1ᴇ9;
 LOCAL MEGA :=1ᴇ6;
 LOCAL KILO :=1ᴇ3;
 LOCAL HECTO:=1ᴇ2;
 LOCAL DECA :=1ᴇ1;
 LOCAL DECI :=1ᴇ−1;
 LOCAL CENTI:=1ᴇ−2;
 LOCAL MILLI:=1ᴇ−3;
 LOCAL MICRO:=1ᴇ−6;
 LOCAL NANO :=1ᴇ−9;
 LOCAL PICO :=1ᴇ−12;
 LOCAL FEMTO:=1ᴇ−15;
 LOCAL ATTO :=1ᴇ−18;
 LOCAL ZEPTO:=1ᴇ−21;
 LOCAL YOCTO:=1ᴇ−24;

 //UNITS
 LOCAL NMST:={" Nautical Miles"," Miles Nautique"};
 LOCAL TKINDL:={"Celcius (Centigrade)","Fahrenheit","kelvin"};
 LOCAL LANGS:={"English","Français"};
 LOCAL EN:=1; LOCAL FR:=2;
 //e233

 //WORDS
 LOCAL WENTERZ:={"Enter","Entrez"};
 LOCAL WHELP:={"Help","Aide"};
 LOCAL WINTERVAL:={"Interval","Intervalle"};
 LOCAL WLIGHTS:={"Lights","Lumières"};
 LOCAL WUNITS:={"Units","Unités"};
 LOCAL WTEMPE:={"Temperature","Température"};
 LOCAL WCNVTT:={"Convert "+WTEMPE(EN),"Convertir la "+WTEMPE(FR)};
 LOCAL WCNVTU:={"Convert Units","Convertir des Unités"};

 LOCAL CHOICES:={{"ABOUT/"+WHELP(EN),WCNVTU(EN),WLIGHTS(EN),"Measure Interval s","Thunder Distance",LANGS,"EXIT"},
 {"A PROPOS/"+WHELP(FR),WCNVTU(FR),WLIGHTS(FR),"Intervalle de Mesure s","Distance de Tonnere",LANGS,"QUITTER"}};//FR:P

 EXPORT ABOUT ()
 BEGIN
  LOCAL ST:="StephenG1CMZ is a programmer and can work to your requirements."+NL;
  LOCAL SZ:="ZIPP provides useful practical results.
Ask, if you need technical results."+NL;
  LOCAL THANX:="Thanks Han for the CONVERT syntax.
Thanks Primer."+NL; 
  LOCAL LGL:="No liability is accepted.";
  PRINT(); PRINT(CRID);
  PRINT(ST+NL+SZ);
  PRINT(THANX);
  PRINT(LGL);
  WAIT;
 END;

 TEMP_F2C (FF)
 BEGIN
  RETURN (FF-32)*5/9;
 END;
 TEMP_C2F(CC)
 BEGIN
  RETURN (9/5)*CC+32;
 END;

 TEMP_K2C(KK)
 BEGIN
   RETURN KK-273.15;
 END;
 TEMP_C2K(CC)
 BEGIN
  RETURN CC+273.15;
 END;

 CONVERT_TEMP ()
 BEGIN
  LOCAL OK,TKIND;
  LOCAL TEMP,TEMP_C,TEMP_F,TEMP_K; 
  LOCAL TTL:=WCNVTT(SL);
  LOCAL LBL:={WUNITS(SL),WTEMPE(SL)};
  LOCAL HLP:=""; 
  
  OK:=INPUT({{TKIND,TKINDL},TEMP},TTL,LBL,HLP,1,1);
  IF OK THEN
   CASE
    IF TKIND==1 THEN //C
     TEMP_C:=TEMP;
     TEMP_F:=TEMP_C2F(TEMP_C);
     TEMP_K:=TEMP_C2K(TEMP_C);
    END;
    IF TKIND==2 THEN //F
     TEMP_F:=TEMP;
     TEMP_C:=TEMP_F2C(TEMP_F);
     TEMP_K:=TEMP_C2K(TEMP_C);
    END;
    IF TKIND==3 THEN //K
     TEMP_K:=TEMP;
     TEMP_C:=TEMP_K2C(TEMP_K);
     TEMP_F:=TEMP_C2F(TEMP_C);
    END;
    DEFAULT
   END;

  END;

  RETURN {TEMP_C+TKINDL(1),TEMP_F+TKINDL(2),TEMP_K+TKINDL(3)};
 END;

 MSNK()
 BEGIN
   LOCAL SNK:=MOUSE();
 END;

 TRIMMENU(INL)
 BEGIN
  LOCAL II;
  LOCAL OUTL:={};

  FOR II FROM 1 TO SIZE(INL)  DO
   OUTL(II):=REPLACE(STRING(INL(II)),"1_","");
  END;
  RETURN OUTL;  
 END;

 CONVERT_UNIT_GRP(unit,tname)
 BEGIN
  LOCAL x,menu,a1,a2,t;
  LOCAL UF;
  LOCAL TTL:={"To use SI prefixes: INPUT PREFIXNAME",
    "SI préfixe: Saisissez le nom du préfixe"};
  
  LOCAL EVUST:={
   ": Enter value(s) in: ",
   ":Entrez la/les valeur(s) avec: "};//FR:P
  LOCAL HLP:=tname+EVUST(SL);
  LOCAL TOST:={"To ","À "};
  LOCAL CNVRT:={"Convert","Convertir"};

  menu:=TRIMMENU(unit);//AUTO
  CHOOSE(CDFROM,WUNITS(SL)+":"+tname,menu);
  IF CDFROM THEN
   UF:=REPLACE(STRING(unit[CDFROM]),"1_",""); //TRIM 1_
   INPUT({{ x,[2],{45,20,3} }},TTL(SL),CNVRT(SL),HLP+UF);
   //DETECT ESC
   IF string(x,1) == "0" THEN RETURN; END;
   
   CHOOSE(CDTO, TOST(SL)+WUNITS(SL)+":"+tname, menu);
   a2 := unit[CDFROM];
   a1 := unit[CDTO];
   t := x + "*" + CONVERT(a2,a1);
   
   RETURN expr(t);
  END;
 END;

 CONVERT_UNITS_HP()
 BEGIN
  LOCAL CHSTYP;
  LOCAL TTL:={"Unit types","Types d'unités"};
  LOCAL UTYP:={{"Length","Area","Volume",
   "Time","Speed","Acceleration","Mass","Force",
   "Energy","Power","Pressure","Temperature:NO!",
   "Electricity","Light","Angle","Viscosity","Radiation"},

 {"Longueur","Surface","Volume",
    "Heure","Vitesse","Accélération","Masse","Force",
    "Energie","Puissance","Pression","Température:NON!",
    "Electricité","Lumière","Angle","Viscosité","Radiation"}};
 //TESTING:PUISSANCE(POWER) IS LONGEST INPUT STRING

  LOCAL UL:={};

  CHOOSE(CHSTYP,TTL(SL),UTYP(SL)); 
  CASE
   IF CHSTYP==1 THEN //LENGTH
    //CONVERT_Length();
    UL:={1_m,1_cm,1_mm,1_km,1_in,1_ft,1_yd,1_mile,1_nmi,1_au,1_lyr,1_pc,1_Å};
   END;
   IF CHSTYP==2 THEN //AREA
    UL:={1_(cm²),1_(m²),1_(km²),1_(in²),1_(ft²),1_(yd²),1_(mile²),1_(miUS²),1_a​cre,1_ha,1_a,1_b};//A:Are B:Barn
    //CONVERT_UNIT_GRP(UL);
   END;
   IF CHSTYP==3 THEN //VOLUME
    UL:={1_(cm^3),1_(m^3),1_ml,1_l,1_(in^3),1_(ft^3),1_(yd^3),1_ptUK,1_galUK,1_​galUS};
    //CONVERT_UNIT_GRP(UL);
   END;
   IF CHSTYP==4 THEN //TIME
    UL:={1_s,1_min,1_h,1_d,1_yr,1_Hz};
   END;
   IF CHSTYP==5 THEN //SPEED
    UL:={1_(cm/s),1_(m/s),1_kph,1_(km/h),1_(ft/s),1_mph,1_(mile/h),1_knot,1_(rad/s),1_(tr/min),1_(tr/s)};
   END;
   IF CHSTYP==6 THEN //ACCEL
    UL:={1_(m/s²),1_(ft/s²),1_grav,1_Gal,1_(rad/s²)};
   END;
   IF CHSTYP==7 THEN //MASS
    UL:={1_g,1_kg,1_oz,1_lb,1_tonUK,1_tonUS,1_mol,1_u,1_t};
   END;
   IF CHSTYP==8 THEN //FORCE
    UL:={1_(kg*m/s²),1_N,1_dyn,1_lbf,1_kip,1_gf,1_pdl};
   END;
   IF CHSTYP==9 THEN //ENERGY
    UL:={1_(kg*m²/s²),1_J,1_Wh,1_kWh,1_(ft*lbf),1_kcal,1_cal,1_eV,1_MeV,1_Btu,1_erg,1_thermUK,1_th​ermEC,1_thermUS};
   END;
   IF CHSTYP==10 THEN //POWER
    UL:={1_(kg*m²/s^3),1_W,1_MW,1_hp,1_(ft*lbf/s)};
   END;
   IF CHSTYP==11 THEN //PRESSURE
    UL:={1_(kg/(m*s²)),1_Pa,1_bar,1_atm,1_psi,1_torr,1_mmHg,1_inHg,1_inH2O};
   END;
   IF CHSTYP==12 THEN //TEMP
    //UL:={1_K,1_°C,1_°F};
   END;
   IF CHSTYP==13 THEN //ELEC
    UL:={1_A,1_V,1_C,1_Ohm,1_F,1_Fdy,1_Wb,1_H,1_mho,1_T,1_(A*h),1_S};
   END;
   IF CHSTYP==14 THEN //LIGHT:HP MISSING MOST UNITS
    UL:={1_cd,1_flam};
   END;
   IF CHSTYP==15 THEN //ANGL
    UL:={1_rad,1_deg,1_arcmin,1_arcs,1_tr};
   END;
   IF CHSTYP==16 THEN //VISCOSITY
    UL:={1_(m²/s),1_P,1_St};
   END;
   IF CHSTYP==17 THEN //RADIATION
    UL:={1_Bq,1_Ci,1_Gy,1_rd,1_rem,1_Sv,1_R};
   END;
   DEFAULT
  END;
  IF SIZE(UL)>0 THEN //AND CHSTYP>0
    MSGBOX(CONVERT_UNIT_GRP(UL,UTYP(SL,CHSTYP)),1);
  END;
 END;

EXPORT CONVERT_UNITS ()
BEGIN
  LOCAL CHS;
  LOCAL TTL:=WCNVTU(SL)+SG;
  CHOOSE(CHS,TTL,{WCNVTT(SL),WCNVTU(SL)});
  IF CHS THEN
    CASE
     IF CHS==1 THEN MSGBOX(CONVERT_TEMP(),1); END;
     IF CHS==2 THEN CONVERT_UNITS_HP() END;
     DEFAULT
    END;
   END; 
 END;

 INPUT_INTERVAL_H(TTL)
 BEGIN
  LOCAL HH,MM,SS,OK;

  LOCAL LBL:={WINTERVAL(SL)+" HH",WINTERVAL(SL)+" MM",WINTERVAL(SL)+" SS"};
  LOCAL HLP1:={"Decimals & Fractions allowed",
    "Décimaux et fractions autorisés"};//FR:P
  LOCAL HLP:={HLP1(SL),HLP1(SL),HLP1(SL)};

  OK:=INPUT({HH,MM,SS},TTL,LBL,HLP,0,0);
  IF OK THEN
   RETURN HH+(MM/60)+(SS/3600); 
  ELSE
   RETURN 0; //CANCEL
   //HOW TO SIGNAL CANCEL?
  END;
 END;

 EXPORT MEASURE_INTERVAL_S()
 BEGIN
  LOCAL TICKB,TICKE,TICKL;
  LOCAL TS,KK;
  LOCAL MI:=0;
  
  LOCAL MST:={"MEASURE SHORT INTERVAL"+NL,
   "MESURE COURT INTERVALLE"+NL};
  LOCAL MST1:={"OK or Enter: Start"+NL,
   "OK ou Entrer: Commencez"+NL};
  LOCAL MST2:={"Enter:Enter HMS numerically"+NL,
   "Entrer: Entrez HMS numeriquement"+NL};
  LOCAL MST3:={"ANY KEY: End"+NL,
   "N importe quelle clé: Terminer"+NL};
  //LOCAL CNW:="CONNECTIVITY:NO HP DATA";
  
  TICKB:=MSGBOX(MST(SL)+MST1(SL)+MST2(SL)+MST3(SL),1);
  IF TICKB THEN
   RECT();
   TICKB:=Ticks; TS:=Time;
   TICKL:=TICKB;
   REPEAT 
    MSNK;
    IF Ticks-TICKL≥1000 THEN
     TICKL:=Ticks;
     RECT();
     TEXTOUT_P(→HMS(ROUND((Ticks-TICKB)/1000,0)/3600),0,20);
     MSNK;
     TEXTOUT_P(TS+MST(SL),0,180);
     TEXTOUT_P(MST2(SL),0,200);
     TEXTOUT_P(MST3(SL),0,220);

    END;
    WAIT(0.001);
    MSNK;
    KK:=GETKEY;
   UNTIL KK≥0;
   TICKE:=Ticks;
   MI:=(TICKE-TICKB)/1000;
   IF KK==30 THEN //ENTER
    MI:=3600*INPUT_INTERVAL_H(WENTERZ(SL)+" "+WINTERVAL(SL));
    //IDEALLY IF A CANCEL IS DETECTED
    //OUGHT TO RESUME MEASURED TIMING
   END;
  END;
  RETURN MEAS_INTERVAL_S:=ROUND(MI,ZIPPROUND);   
 END;

 THUNDER_DISTANCE_CALC_M(INTERVAL_S,TEMP_C)
 //INTERVAL
 //CELCIUS (NORMAL RANGE)
 BEGIN
  LOCAL DISTM;

  THSPD_M:=331.4+0.6*TEMP_C;//M/S
  DISTM:=INTERVAL_S*THSPD_M;
  RETURN ROUND(DISTM,ZIPPROUND);
 END;

 EXPORT THUNDER_DISTANCE()
 BEGIN
  LOCAL OK;
  LOCAL THDST:={};
  LOCAL THDM,THDKM,THDMI,THDNM;
  LOCAL INTERVAL_S,TEMP_C,TEMP;
  LOCAL TKIND;

  LOCAL TTL:=CHOICES(SL,5)+SG;
  LOCAL LBL:={WINTERVAL(SL)+" s",WUNITS(SL),WTEMPE(SL)};
  LOCAL HLP:={{"Interval sound-light. (0:use measured value)","","EG Temp C 0..20:Ground −57: Aircraft"},
   {"Intervalle son-lumière. 0:La valeur mesurée","","ex Temp C 0..20:Terre −57:Avion"}};//FR:P

  OK:=INPUT({INTERVAL_S,{TKIND,TKINDL},TEMP},TTL,LBL,HLP(SL),MEAS_INTERVAL_S,​0);
  
  IF OK THEN
   CASE 
    IF TKIND==1 THEN TEMP_C:=TEMP END;
    IF TKIND==2 THEN TEMP_C:=TEMP_F2C(TEMP) END;
    IF TKIND==3 THEN TEMP_C:=TEMP_K2C(TEMP) END;
    DEFAULT
   END;
   IF INTERVAL_S≤0 THEN //IMPORT VALUE
    INTERVAL_S:=MEAS_INTERVAL_S;
   END;
   THDM:=THUNDER_DISTANCE_CALC_M(INTERVAL_S,TEMP_C);
   THDKM:=THDM/1000;
   THDMI:=THDKM/TOMI;
   THDNM:=THDKM/TONM;

   THDST(1):=ROUND(INTERVAL_S,0)+" s"+" @ "+ROUND(THSPD_M,ZIPPROUND)+" m/s"+NL;
   THDST(2):=THDM+" m "+ROUND(THDKM,ZIPPROUND)+" km"+NL;
   THDST(3):=ROUND(THDMI,ZIPPROUND)+" milesUK"+NL;
   THDST(4):=ROUND(THDNM,ZIPPROUND)+NMST(SL);
   MSGBOX(THDST(1)+THDST(2)+THDST(3)+THDST(4));
   RETURN THDST(2);
  END;
 END;

 
 ZIPP_HELP ()
 BEGIN
  LOCAL CHS,OK;
  LOCAL HLPCHO:={"VARIABLES"};
  LOCAL HC:=CONCAT(CHOICES(SL),HLPCHO);
  
  LOCAL SIPRFX:={"
Values may include SI prefixes.
ENTER IN UPPERCASE: Selecting Units/Prefix (Shift C) will not work."+NL,
"Les valeurs peuvent inclure des SI préfixes. Entrez en majuscule: Selection Unites/Préfixe (Decalage C) ne marchant pas."+NL};
 LOCAL SIPRFXEG:="
3NANO _m
3MILLI _inch";
 
  LOCAL ST:={"
To change the number of digits displayed:","
Pour changez la précision affichée:"};//FR:P
  LOCAL STEG:="
@Home:
 ZIPPROUND:=n  [n=−12..12]"+NL;

  LOCAL CVT:={"
Note that not all units within a group can be converted. Conversion between groups (eg length*length to area) is not implemented here.
SI prefixes OK.
Lists and variables OK."+NL, "
Notez que toutes les unités d un groupe ne_peuvent pas etre convertis.
SI préfixes OK.
Listes et variables OK."+NL};
  LOCAL LIGHTSPROG:={"LIGHTS may be installed separately",
    "Lumières peut être installé séparément"};
  LOCAL TRBY:="Traduit par "+SG+" et ......";

  PRINT(); PRINT(CRID);
 
  OK:=CHOOSE(CHS,WHELP(SL),HC);
  IF CHS THEN
   PRINT(HC(CHS));
   CASE
    IF CHS==1 THEN ABOUT() END;
    IF CHS==2 THEN 
     PRINT(CVT(SL));WAIT;
     OK:=MSGBOX(SIPRFX(SL),1);
     OK:=MSGBOX(SIPRFXEG,1);
    END;
    IF CHS==3 THEN PRINT(LIGHTSPROG(SL)) END;
    IF CHS==6 THEN PRINT(TRBY) END;
    IF CHS==8 THEN PRINT(ST(SL)+STEG) END;
    DEFAULT
   END;
   WAIT;
  END;
 END;

 SELECT_LANGUAGE()
 BEGIN
  LOCAL CHS;
  CHOOSE(CHS,LANGS(SL),LANGS);//CURRENT
  IF CHS THEN
   SL:=CHS;
  END; 
 END;


 EXPORT G1CMZ_IMMENSELY_PRACTICAL_PACKAGE ()
 BEGIN
  LOCAL CHS;
  
  REPEAT 
   CHOOSE(CHS,CRID,CHOICES(SL));
   CASE
    IF CHS==1 THEN ZIPP_HELP() END;
    IF CHS==2 THEN CONVERT_UNITS() END;
    IF CHS==3 THEN Z_LIGHTS() END;
    IF CHS==4 THEN MSGBOX(MEASURE_INTERVAL_S()+" s",1) END;
    IF CHS==5 THEN THUNDER_DISTANCE() END;
    IF CHS==7 THEN CHS:=0 END;
    IF CHS==6 THEN SELECT_LANGUAGE() END;
    DEFAULT
   END;
   
  UNTIL CHS==0;

 END;

 EXPORT ZIPP()
 BEGIN
  G1CMZ_IMMENSELY_PRACTICAL_PACKAGE();
 END;

Stephen Lewkowicz (G1CMZ)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-29-2015, 10:07 AM
Post: #6
RE: ZIPP: G1CMZ's Immensely Practical Package
Dzien dobry Panu,

Super, naprawde fajnie ! To swietnie.
Bardzo dzienkuje.

Do zobaczenia !

Gérard.

Gérard.
Find all posts by this user
Quote this message in a reply
11-18-2015, 11:12 AM (This post was last modified: 11-30-2015 09:51 PM by StephenG1CMZ.)
Post: #7
RE: ZIPP: G1CMZ's Immensely Practical Package
Glad you like it Gerard.
If anyone would like to see a different approach to unit conversion, have a look at epp's CNV procedure.

Here is ZIPP Version 0.5. Now with data unit conversions and improvements to language setup.

Code:


#pragma mode( separator(.,;) integer(h32) )

 LOCAL ZIPPST:="ZIPP V 0.5 ";
 LOCAL SG:=" StephenG1CMZ";
 LOCAL CRID:=ZIPPST+"© 2015 "+SG;
 LOCAL NL:=CHAR(10);

 LOCAL DEFLT_LANG();
 LOCAL SL:=DEFLT_LANG();

 //IMPORT Z_LIGHTS();

 LOCAL CDFROM,CDTO;
 EXPORT ZIPPROUND;//USER ROUNDING

 LOCAL THSPD_M;
 LOCAL MEAS_INTERVAL_S;
 LOCAL VBITS,VBPS,VS;
 LOCAL TOMI:=1.60344;//MILES UK
 LOCAL TONM:=1.852;//NAUTI

 //SI PREFIXES
 LOCAL YOTTA:=1ᴇ24;
 LOCAL ZETTA:=1ᴇ21;
 LOCAL EXA  :=1ᴇ18;
 LOCAL PETA :=1ᴇ15;
 LOCAL TERA :=1ᴇ12;
 LOCAL GIGA :=1ᴇ9;
 LOCAL MEGA :=1ᴇ6;
 LOCAL KILO :=1ᴇ3;
 LOCAL HECTO:=1ᴇ2;
 LOCAL DECA :=1ᴇ1;
 LOCAL DECI :=1ᴇ−1;
 LOCAL CENTI:=1ᴇ−2;
 LOCAL MILLI:=1ᴇ−3;
 LOCAL MICRO:=1ᴇ−6;
 LOCAL NANO :=1ᴇ−9;
 LOCAL PICO :=1ᴇ−12;
 LOCAL FEMTO:=1ᴇ−15;
 LOCAL ATTO :=1ᴇ−18;
 LOCAL ZEPTO:=1ᴇ−21;
 LOCAL YOCTO:=1ᴇ−24;

 //DATA UNITS:CAPACITY
 LOCAL UBITS:="bits";
 LOCAL UBY:="Bytes";
 LOCAL UCH:="Characters";//Characters
 LOCAL UWD:="Words(−.)";
 LOCAL DATAS:={1,8,16}; //−1};
 //DATA UNITS:THROUGHPUT
 LOCAL UBPS:="bps";
 LOCAL UBYPS:="Byte/s";
 LOCAL UCPS:="CPS";
 LOCAL UWPM:="WPM(Morse)";
 LOCAL TML:={"s","s","s"};//SIZE MATCH
 
 //UNITS
 LOCAL NMST:={" Nautical Miles",""," Miles Nautique"};
 LOCAL TKINDL:={"Celcius (Centigrade)","Fahrenheit","kelvin"};
 
 LOCAL WSYS:={"System"};
 LOCAL LANGS:={"English","","Français"};
 LOCAL EN:=1; LOCAL FR:=3;
 //e233

 //WORDS
 LOCAL WCAPACITY:={"Capacity","","La Capacité"};
 LOCAL WRATE:={"Throughput","","Taux/Débit"};

 LOCAL WENTERZ:={"Enter","","Entrez"};
 LOCAL WHELP:={"Help","","Aide"};
 LOCAL WINTERVAL:={"Interval","","Intervalle"};
 LOCAL WLIGHTS:={"Lights","","Lumières","Światła"};
 LOCAL WTIME:={"Time","","Temps"};
 LOCAL WUNITS:={"Units","","Unités"};
 LOCAL WTEMPE:={"Temperature","","Température"};
 LOCAL WCNVTT:={"Convert "+WTEMPE(EN),"","Convertir la "+WTEMPE(FR)};
 LOCAL WCNVTU:={"Convert Units","","Convertir des Unités","Konwersja Jednowstek"};
 LOCAL WDATAU:={"Data Units","","Les unités de données"};
 LOCAL WSOLVE:={"Solve for","","Résoudre pour"};
 LOCAL WVALU:={"Value","","La valeur"};

 LOCAL CHOICES:={{"ABOUT/"+WHELP(EN),WCNVTU(EN),WLIGHTS(EN),"Measure Interval s","Thunder Distance",LANGS,"EXIT"},
 {},
 {"A PROPOS/"+WHELP(FR),WCNVTU(FR),WLIGHTS(FR),"Intervalle de Mesure s","Distance de Tonnere",LANGS,"QUITTER"}};//FR:P
 
 LOCAL DATATYPES:={{WCAPACITY(EN),WRATE(EN),WTIME(EN)},{"","",""},
 {WCAPACITY(FR),WRATE(FR),WTIME(FR)}};
 
 EXPORT ABOUT ()
 BEGIN
  LOCAL ST:="StephenG1CMZ is a programmer and can work to your requirements."+NL;
  LOCAL SZ:="ZIPP provides useful practical results.
Ask, if you need technical results."+NL;
  LOCAL THANX:="Thanks Han for the CONVERT syntax.
Thanks Primer."+NL; 
  LOCAL LGL:="No liability is accepted.";
  PRINT(); PRINT(CRID);
  PRINT(ST+NL+SZ);
  PRINT(THANX);
  PRINT(LGL);
  WAIT;
 END;

 TEMP_F2C (FF)
 BEGIN
  RETURN (FF-32)*5/9;
 END;
 TEMP_C2F(CC)
 BEGIN
  RETURN (9/5)*CC+32;
 END;

 TEMP_K2C(KK)
 BEGIN
   RETURN KK-273.15;
 END;
 TEMP_C2K(CC)
 BEGIN
  RETURN CC+273.15;
 END;

 CONVERT_TEMP ()
 BEGIN
  LOCAL OK,TKIND;
  LOCAL TEMP,TEMP_C,TEMP_F,TEMP_K; 
  LOCAL TTL:=WCNVTT(SL);
  LOCAL LBL:={WUNITS(SL),WTEMPE(SL)};
  LOCAL HLP:=""; 
  
  OK:=INPUT({{TKIND,TKINDL},TEMP},TTL,LBL,HLP,1,1);
  IF OK THEN
   CASE
    IF TKIND==1 THEN //C
     TEMP_C:=TEMP;
     TEMP_F:=TEMP_C2F(TEMP_C);
     TEMP_K:=TEMP_C2K(TEMP_C);
    END;
    IF TKIND==2 THEN //F
     TEMP_F:=TEMP;
     TEMP_C:=TEMP_F2C(TEMP_F);
     TEMP_K:=TEMP_C2K(TEMP_C);
    END;
    IF TKIND==3 THEN //K
     TEMP_K:=TEMP;
     TEMP_C:=TEMP_K2C(TEMP_K);
     TEMP_F:=TEMP_C2F(TEMP_C);
    END;
    DEFAULT
   END;
  //KNOWN BUG:
  //IF U ESCAPE 0C=0F=0K RETURNED 
  END;

  RETURN {TEMP_C+TKINDL(1),TEMP_F+TKINDL(2),TEMP_K+TKINDL(3)};
 END;

 MSNK()
 BEGIN
   LOCAL SNK:=MOUSE();
 END;

 DATA_UNITS()
 BEGIN
  LOCAL VH;
  LOCAL OK,CHS,TM,TMU,QTYU,THRU,VALU,SLV;
  LOCAL QTYTP:={UBITS,UBY,UCH}; //,UWD};//BUG:SIZES MUST MATCH
  LOCAL THRUTP:={UBPS,UBYPS,UCPS}; //,UWPM};
  LOCAL TTL:={"","",""};
  LOCAL LBL:=DATATYPES(1);//{WCAPACITY(1),WRATE(1),"TIME"};
  LOCAL HLP:={"","","Select to solve for this unit type BITS BPS S ONLY!"};
  LOCAL VALUES:={};

  REPEAT

   OK:=CHOOSE(CHS,WDATAU(SL)+SG,DATATYPES(SL));
   IF OK THEN
    LBL:={DATATYPES(SL,CHS),WVALU(SL),WSOLVE(SL)};
    CASE
     IF CHS==1  THEN //CAPACITY
      OK:=INPUT({{QTYU,QTYTP},VALU,{SLV,1}},TTL,LBL,HLP,1,1);
      IF OK THEN
       IF SLV THEN //B=BPS*S
        VBITS:=VS*VBPS;
       ELSE
        VBITS:=VALU*DATAS(QTYU);
       END;
       VALUES:=VBITS/{DATAS};
       MSGBOX(VALUES); 
      END;
     END;
     IF CHS==2  THEN //THROUGHPUT
      OK:=INPUT({{THRU,THRUTP},VALU,{SLV,1}},TTL,LBL,HLP,1,1);
      IF OK THEN
       IF SLV THEN //BPS=B/S
        VBPS:=VBITS/VS;
       ELSE
        VBPS:=VALU*DATAS(THRU);
       END;
       VALUES:=VBPS/{DATAS};
       MSGBOX(VALUES);    
      END;
     END;
     IF CHS==3 THEN //TIME
      OK:=INPUT({{TMU,TML},VALU,{SLV,1}},TTL,LBL,HLP,1,1);
      IF OK THEN
       IF SLV THEN //S=B/BPS
        //MSGBOX(VBITS);
        VS:=VBITS/VBPS;
       ELSE
        VS:=VALU;
       END;
       VH:=VS/60/60;
       MSGBOX({VS,→HMS(VH)});
      END;  
     END;
     DEFAULT
    END;
   
   END;
  UNTIL CHS==0;
 END;

TRIMMENU(INL)
 BEGIN
  LOCAL II;
  LOCAL OUTL:={};

  FOR II FROM 1 TO SIZE(INL)  DO
   OUTL(II):=REPLACE(STRING(INL(II)),"1_","");
  END;
  RETURN OUTL;  
 END;

 CONVERT_UNIT_GRP(unit,tname)
 BEGIN
  LOCAL x,menu,a1,a2,t;
  LOCAL UF;
  LOCAL TTL:={"To use SI prefixes: INPUT PREFIXNAME","",
    "SI préfixe: Saisissez le nom du préfixe"};
  
  LOCAL EVUST:={
   ": Enter value(s) in: ","",
   ":Entrez la/les valeur(s) avec: "};//FR:P
  LOCAL HLP:=tname+EVUST(SL);
  LOCAL TOST:={"To ","","À "};
  LOCAL CNVRT:={"Convert","","Convertir"};

  menu:=TRIMMENU(unit);//AUTO
  CHOOSE(CDFROM,WUNITS(SL)+":"+tname,menu);
  IF CDFROM THEN
   UF:=REPLACE(STRING(unit[CDFROM]),"1_",""); //TRIM 1_
   INPUT({{ x,[2],{45,20,3} }},TTL(SL),CNVRT(SL),HLP+UF);
   //DETECT ESC
   IF string(x,1) == "0" THEN RETURN; END;
   
   CHOOSE(CDTO, TOST(SL)+WUNITS(SL)+":"+tname, menu);
   a2 := unit[CDFROM];
   a1 := unit[CDTO];
   t := x + "*" + CONVERT(a2,a1);
   
   RETURN expr(t);
  END;
 END;

 CONVERT_UNITS_HP()
 BEGIN
  LOCAL CHSTYP;
  LOCAL TTL:={"Unit types","","Types d'unités"};
  LOCAL UTYP:={{"Length","Area","Volume",
   "Time","Speed","Acceleration","Mass","Force",
   "Energy","Power","Pressure","Temperature:NO!",
   "Electricity","Light","Angle","Viscosity","Radiation",
   "","Data Throughput"},
 {},
 {"Longueur","Surface","Volume",
    "Heure","Vitesse","Accélération","Masse","Force",
    "Energie","Puissance","Pression","Température:NON!",
    "Electricité","Lumière","Angle","Viscosité","Radiation"}};
 //TESTING:PUISSANCE(POWER) IS LONGEST INPUT STRING

  LOCAL UL:={};

  CHOOSE(CHSTYP,TTL(SL),UTYP(SL)); 
  CASE
   IF CHSTYP==1 THEN //LENGTH
    //CONVERT_Length();
    UL:={1_m,1_cm,1_mm,1_km,1_in,1_ft,1_yd,1_mile,1_nmi,1_au,1_lyr,1_pc,1_Å};
   END;
   IF CHSTYP==2 THEN //AREA
    UL:={1_(cm²),1_(m²),1_(km²),1_(in²),1_(ft²),1_(yd²),1_(mile²),1_(miUS²),1_a​cre,1_ha,1_a,1_b};//A:Are B:Barn
    //CONVERT_UNIT_GRP(UL);
   END;
   IF CHSTYP==3 THEN //VOLUME
    UL:={1_(cm^3),1_(m^3),1_ml,1_l,1_(in^3),1_(ft^3),1_(yd^3),1_ptUK,1_galUK,1_​galUS};
    //CONVERT_UNIT_GRP(UL);
   END;
   IF CHSTYP==4 THEN //TIME
    UL:={1_s,1_min,1_h,1_d,1_yr,1_Hz};
   END;
   IF CHSTYP==5 THEN //SPEED
    UL:={1_(cm/s),1_(m/s),1_kph,1_(km/h),1_(ft/s),1_mph,1_(mile/h),1_knot,1_(rad/s),1_(tr/min),1_(tr/s)};
   END;
   IF CHSTYP==6 THEN //ACCEL
    UL:={1_(m/s²),1_(ft/s²),1_grav,1_Gal,1_(rad/s²)};
   END;
   IF CHSTYP==7 THEN //MASS
    UL:={1_g,1_kg,1_oz,1_lb,1_tonUK,1_tonUS,1_mol,1_u,1_t};
   END;
   IF CHSTYP==8 THEN //FORCE
    UL:={1_(kg*m/s²),1_N,1_dyn,1_lbf,1_kip,1_gf,1_pdl};
   END;
   IF CHSTYP==9 THEN //ENERGY
    UL:={1_(kg*m²/s²),1_J,1_Wh,1_kWh,1_(ft*lbf),1_kcal,1_cal,1_eV,1_MeV,1_Btu,1_erg,1_thermUK,1_th​ermEC,1_thermUS};
   END;
   IF CHSTYP==10 THEN //POWER
    UL:={1_(kg*m²/s^3),1_W,1_MW,1_hp,1_(ft*lbf/s)};
   END;
   IF CHSTYP==11 THEN //PRESSURE
    UL:={1_(kg/(m*s²)),1_Pa,1_bar,1_atm,1_psi,1_torr,1_mmHg,1_inHg,1_inH2O};
   END;
   IF CHSTYP==12 THEN //TEMP
    //UL:={1_K,1_°C,1_°F};
   END;
   IF CHSTYP==13 THEN //ELEC
    UL:={1_A,1_V,1_C,1_Ohm,1_F,1_Fdy,1_Wb,1_H,1_mho,1_T,1_(A*h),1_S};
   END;
   IF CHSTYP==14 THEN //LIGHT:HP MISSING MOST UNITS
    UL:={1_cd,1_flam};
   END;
   IF CHSTYP==15 THEN //ANGL
    UL:={1_rad,1_deg,1_arcmin,1_arcs,1_tr};
   END;
   IF CHSTYP==16 THEN //VISCOSITY
    UL:={1_(m²/s),1_P,1_St};
   END;
   IF CHSTYP==17 THEN //RADIATION
    UL:={1_Bq,1_Ci,1_Gy,1_rd,1_rem,1_Sv,1_R};
   END;

   IF CHSTYP==19 THEN //DATA THROUGHPUT
    UL:={"BPS","bps"};
   END;
   DEFAULT
  END;
  IF SIZE(UL)>0 THEN //AND CHSTYP>0
    IF CHSTYP≤17 THEN //HP
     MSGBOX(CONVERT_UNIT_GRP(UL,UTYP(SL,CHSTYP)),1);
    //ELSE //SL
    // CONVERT_GRP_SL(UL,UTYP(SL,CHSTYP));
    END;
  END;
 END;

EXPORT CONVERT_UNITS ()
BEGIN
  LOCAL CHS;
  LOCAL TTL:=WCNVTU(SL)+SG;
  CHOOSE(CHS,TTL,{WCNVTT(SL),WCNVTU(SL),WDATAU(SL)});
  IF CHS THEN
    CASE
     IF CHS==1 THEN MSGBOX(CONVERT_TEMP(),1); END;
     IF CHS==2 THEN CONVERT_UNITS_HP() END;
     IF CHS==3 THEN DATA_UNITS() END;
     DEFAULT
    END;
   END; 
 END;

 INPUT_INTERVAL_H(TTL)
 BEGIN
  LOCAL HH,MM,SS,OK;

  LOCAL LBL:={WINTERVAL(SL)+" HH",WINTERVAL(SL)+" MM",WINTERVAL(SL)+" SS"};
  LOCAL HLP1:={"Decimals & Fractions allowed","",
    "Décimaux et fractions autorisés"};//FR:P
  LOCAL HLP:={HLP1(SL),HLP1(SL),HLP1(SL)};

  OK:=INPUT({HH,MM,SS},TTL,LBL,HLP,0,0);
  IF OK THEN
   RETURN HH+(MM/60)+(SS/3600); 
  ELSE
   RETURN 0; //CANCEL
   //HOW TO SIGNAL CANCEL?
  END;
 END;

 EXPORT MEASURE_INTERVAL_S()
 BEGIN
  LOCAL TICKB,TICKE,TICKL;
  LOCAL TS,KK;
  LOCAL MI:=0;
  
  LOCAL MST:={"MEASURE SHORT INTERVAL"+NL,"",
   "MESURE COURT INTERVALLE"+NL};
  LOCAL MST1:={"OK or Enter: Start"+NL,"",
   "OK ou Entrer: Commencez"+NL};
  LOCAL MST2:={"Enter:Enter HMS numerically"+NL,"",
   "Entrer: Entrez HMS numeriquement"+NL};
  LOCAL MST3:={"ANY KEY: End"+NL,"",
   "N importe quelle clé: Terminer"+NL};
  //LOCAL CNW:="CONNECTIVITY:NO HP DATA";
  
  TICKB:=MSGBOX(MST(SL)+MST1(SL)+MST2(SL)+MST3(SL),1);
  IF TICKB THEN
   RECT();
   TICKB:=Ticks; TS:=Time;
   TICKL:=TICKB;
   REPEAT 
    MSNK;
    IF Ticks-TICKL≥1000 THEN
     TICKL:=Ticks;
     RECT();
     TEXTOUT_P(→HMS(ROUND((Ticks-TICKB)/1000,0)/3600),0,20);
     MSNK;
     TEXTOUT_P(TS+MST(SL),0,180);
     TEXTOUT_P(MST2(SL),0,200);
     TEXTOUT_P(MST3(SL),0,220);

    END;
    WAIT(0.001);
    MSNK;
    KK:=GETKEY;
   UNTIL KK≥0;
   TICKE:=Ticks;
   MI:=(TICKE-TICKB)/1000;
   IF KK==30 THEN //ENTER
    MI:=3600*INPUT_INTERVAL_H(WENTERZ(SL)+" "+WINTERVAL(SL));
    //IDEALLY IF A CANCEL IS DETECTED
    //OUGHT TO RESUME MEASURED TIMING
   END;
  END;
  RETURN MEAS_INTERVAL_S:=ROUND(MI,ZIPPROUND);   
 END;

 THUNDER_DISTANCE_CALC_M(INTERVAL_S,TEMP_C)
 //INTERVAL
 //CELCIUS (NORMAL RANGE)
 BEGIN
  LOCAL DISTM;

  THSPD_M:=331.4+0.6*TEMP_C;//M/S
  DISTM:=INTERVAL_S*THSPD_M;
  RETURN ROUND(DISTM,ZIPPROUND);
 END;

 EXPORT THUNDER_DISTANCE()
 BEGIN
  LOCAL OK;
  LOCAL THDST:={};
  LOCAL THDM,THDKM,THDMI,THDNM;
  LOCAL INTERVAL_S,TEMP_C,TEMP;
  LOCAL TKIND;

  LOCAL TTL:=CHOICES(SL,5)+SG;
  LOCAL LBL:={WINTERVAL(SL)+" s",WUNITS(SL),WTEMPE(SL)};
  LOCAL HLP:={{"Interval sound-light. (0:use measured value)","","EG Temp C 0..20:Ground −57: Aircraft"},{},
   {"Intervalle son-lumière. 0:La valeur mesurée","","ex Temp C 0..20:Terre −57:Avion"}};//FR:P

  OK:=INPUT({INTERVAL_S,{TKIND,TKINDL},TEMP},TTL,LBL,HLP(SL),MEAS_INTERVAL_S,​0);
  
  IF OK THEN
   CASE 
    IF TKIND==1 THEN TEMP_C:=TEMP END;
    IF TKIND==2 THEN TEMP_C:=TEMP_F2C(TEMP) END;
    IF TKIND==3 THEN TEMP_C:=TEMP_K2C(TEMP) END;
    DEFAULT
   END;
   IF INTERVAL_S≤0 THEN //IMPORT VALUE
    INTERVAL_S:=MEAS_INTERVAL_S;
   END;
   THDM:=THUNDER_DISTANCE_CALC_M(INTERVAL_S,TEMP_C);
   THDKM:=THDM/1000;
   THDMI:=THDKM/TOMI;
   THDNM:=THDKM/TONM;

   THDST(1):=ROUND(INTERVAL_S,0)+" s"+" @ "+ROUND(THSPD_M,ZIPPROUND)+" m/s"+NL;
   THDST(2):=THDM+" m "+ROUND(THDKM,ZIPPROUND)+" km"+NL;
   THDST(3):=ROUND(THDMI,ZIPPROUND)+" milesUK"+NL;
   THDST(4):=ROUND(THDNM,ZIPPROUND)+NMST(SL);
   MSGBOX(THDST(1)+THDST(2)+THDST(3)+THDST(4));
   RETURN THDST(2);
  END;
 END;

 
 ZIPP_HELP ()
 BEGIN
  LOCAL CHS,OK;
  LOCAL HLPCHO:={"VARIABLES"};
  LOCAL HC:=CONCAT(CHOICES(SL),HLPCHO);
  
  LOCAL SIPRFX:={"
Values may include SI prefixes.
ENTER IN UPPERCASE: Selecting Units/Prefix (Shift C) will not work."+NL,"",
"Les valeurs peuvent inclure des SI préfixes. Entrez en majuscule: Selection Unites/Préfixe (Decalage C) ne marchant pas."+NL};
 LOCAL SIPRFXEG:="
3NANO _m
3MILLI _inch";
 
  LOCAL ST:={"
To change the number of digits displayed:","","
Pour changez la précision affichée:"};//FR:P
  LOCAL STEG:="
@Home:
 ZIPPROUND:=n  [n=−12..12]"+NL;

  LOCAL CVT:={"
Note that not all units within a group can be converted. Conversion between groups (eg length*length to area) is not implemented here.
SI prefixes OK.
Lists and variables OK."+NL,"", "
Notez que toutes les unités d un groupe ne_peuvent pas etre convertis.
SI préfixes OK.
Listes et variables OK."+NL};
  LOCAL LIGHTSPROG:={"LIGHTS may be installed separately","",
    "Lumières peut être installé séparément"};
  LOCAL TRBY:="Traduit par "+SG+" et ......";

  PRINT(); PRINT(CRID);
 
  OK:=CHOOSE(CHS,WHELP(SL),HC);
  IF CHS THEN
   PRINT(HC(CHS));
   CASE
    IF CHS==1 THEN ABOUT() END;
    IF CHS==2 THEN 
     PRINT(CVT(SL));WAIT;
     OK:=MSGBOX(SIPRFX(SL),1);
     OK:=MSGBOX(SIPRFXEG,1);
    END;
    IF CHS==3 THEN PRINT(LIGHTSPROG(SL)) END;
    IF CHS==6 THEN PRINT(TRBY) END;
    IF CHS==8 THEN PRINT(ST(SL)+STEG) END;
    DEFAULT
   END;
   WAIT;
  END;
 END;

 DEFLT_LANG()
 BEGIN
  LOCAL DEF:=1;//PROG DEFAULT
  IF Language==1  OR Language==3 THEN
   DEF:=Language;
  END;
  RETURN DEF;
 END;

 SELECT_LANGUAGE()
 BEGIN
  LOCAL CHS;
  //LOCAL DEF:=1;//PROG DEFAULT IF LANG UNKNOWN
  
  CHOOSE(CHS,LANGS(SL),CONCAT(LANGS,{WSYS(1)}));//CURRENT
  IF CHS AND CHS≠2 THEN
   SL:=CHS;
   IF CHS==4 THEN SL:=DEFLT_LANG(); END;
  END;
 END;

 EXPORT G1CMZ_IMMENSELY_PRACTICAL_PACKAGE ()
 BEGIN
  LOCAL CHS;

  SL:=DEFLT_LANG();
  REPEAT 
   CHOOSE(CHS,CRID,CHOICES(SL));
   CASE
    IF CHS==1 THEN ZIPP_HELP() END;
    IF CHS==2 THEN CONVERT_UNITS() END;
    IF CHS==3 THEN Z_LIGHTS() END;
    IF CHS==4 THEN MSGBOX(MEASURE_INTERVAL_S()+" s",1) END;
    IF CHS==5 THEN THUNDER_DISTANCE() END;
    IF CHS==7 THEN CHS:=0 END;
    IF CHS==6 THEN SELECT_LANGUAGE() END;
    DEFAULT
   END;
   
  UNTIL CHS==0;

 END;

 EXPORT ZIPP()
 BEGIN
  G1CMZ_IMMENSELY_PRACTICAL_PACKAGE();
 END;

Ignore the reference in input help to "solve for" only working in bit and bps - it should actually work in bytes etc. too.

Stephen Lewkowicz (G1CMZ)
Visit this user's website Find all posts by this user
Quote this message in a reply
11-30-2015, 09:57 PM
Post: #8
RE: ZIPP: G1CMZ's Immensely Practical Package
In ZIPP 0.6, the unit conversions are moved to a standalone program (Z UNITS), callable from ZIPP. Compiled using Android emulator 1.0.9.
Code:


#pragma mode( separator(.,;) integer(h32) )

 LOCAL ZIPPST:="ZIPP V 0.6 ";
 LOCAL SG:=" StephenG1CMZ";
 LOCAL CRID:=ZIPPST+"© 2015 "+SG;
 LOCAL NL:=CHAR(10);

 LOCAL DEFLT_LANG();
 LOCAL SL:=DEFLT_LANG();

 //IMPORT Z_LIGHTS();
 //IMPORT Z_UNITS();

 EXPORT ZIPPROUND;//USER ROUNDING

 LOCAL THSPD_M;
 LOCAL MEAS_INTERVAL_S;

 LOCAL TOMI:=1.60344;//MILES UK
 LOCAL TONM:=1.852;//NAUTI

 //SI PREFIXES:UNUSED
 LOCAL YOTTA:=1ᴇ24;
 LOCAL ZETTA:=1ᴇ21;
 LOCAL EXA  :=1ᴇ18;
 LOCAL PETA :=1ᴇ15;
 LOCAL TERA :=1ᴇ12;
 LOCAL GIGA :=1ᴇ9;
 LOCAL MEGA :=1ᴇ6;
 LOCAL KILO :=1ᴇ3;
 LOCAL HECTO:=1ᴇ2;
 LOCAL DECA :=1ᴇ1;
 LOCAL DECI :=1ᴇ−1;
 LOCAL CENTI:=1ᴇ−2;
 LOCAL MILLI:=1ᴇ−3;
 LOCAL MICRO:=1ᴇ−6;
 LOCAL NANO :=1ᴇ−9;
 LOCAL PICO :=1ᴇ−12;
 LOCAL FEMTO:=1ᴇ−15;
 LOCAL ATTO :=1ᴇ−18;
 LOCAL ZEPTO:=1ᴇ−21;
 LOCAL YOCTO:=1ᴇ−24;

 
 //UNITS
 LOCAL NMST:={" Nautical Miles",""," Miles Nautique"};
 LOCAL TKINDL:={"Celcius (Centigrade)","Fahrenheit","kelvin"};
 
 LOCAL WSYS:={"System","","Système"};
 LOCAL LANGS:={"English","","Français"};
 LOCAL EN:=1; LOCAL FR:=3;
 //e233

 //WORDS

 LOCAL WENTERZ:={"Enter","","Entrez"};
 LOCAL WHELP:={"Help","","Aide"};
 LOCAL WINTERVAL:={"Interval","","Intervalle"};
 LOCAL WLIGHTS:={"Lights","","Lumières","Światła"};
 LOCAL WTIME:={"Time","","Temps"};
 LOCAL WUNITS:={"Units","","Unités"};
 LOCAL WTEMPE:={"Temperature","","Température"};
 
 LOCAL WVALU:={"Value","","La valeur"};

 LOCAL CHOICES:={{"ABOUT/"+WHELP(EN),WLIGHTS(EN),"Measure Interval s","Thunder Distance",WUNITS(EN),LANGS,"EXIT"},
 {},
 {"A PROPOS/"+WHELP(FR),WLIGHTS(FR),"Intervalle de Mesure s","Distance de Tonnere",WUNITS(FR),LANGS,"QUITTER"}};//FR:P
 
 EXPORT ABOUT ()
 BEGIN
  LOCAL ST:="StephenG1CMZ is a programmer and can work to your requirements."+NL;
  LOCAL SZ:="ZIPP provides useful practical results.
Ask, if you need technical results."+NL;
  LOCAL THANX:="Thanks Primer."+NL; 
  LOCAL LGL:="No liability is accepted.";
  PRINT(); PRINT(CRID);
  PRINT(ST+NL+SZ);
  PRINT(THANX);
  PRINT(LGL);
  WAIT;
 END;

 TEMP_F2C (FF)
 BEGIN
  RETURN (FF-32)*5/9;
 END;
 TEMP_K2C(KK)
 BEGIN
   RETURN KK-273.15;
 END;

 MSNK()
 BEGIN
   LOCAL SNK:=MOUSE();
 END;

 INPUT_INTERVAL_H(TTL)
 BEGIN
  LOCAL HH,MM,SS,OK;

  LOCAL LBL:={WINTERVAL(SL)+" HH",WINTERVAL(SL)+" MM",WINTERVAL(SL)+" SS"};
  LOCAL HLP1:={"Decimals & Fractions allowed","",
    "Décimaux et fractions autorisés"};//FR:P
  LOCAL HLP:={HLP1(SL),HLP1(SL),HLP1(SL)};

  OK:=INPUT({HH,MM,SS},TTL,LBL,HLP,0,0);
  IF OK THEN
   RETURN HH+(MM/60)+(SS/3600); 
  ELSE
   RETURN 0; //CANCEL
   //HOW TO SIGNAL CANCEL?
  END;
 END;

 EXPORT MEASURE_INTERVAL_S()
 BEGIN
  LOCAL TICKB,TICKE,TICKL;
  LOCAL TS,KK;
  LOCAL MI:=0;
  
  LOCAL MST:={"MEASURE SHORT INTERVAL"+NL,"",
   "MESURE COURT INTERVALLE"+NL};
  LOCAL MST1:={"OK or Enter: Start"+NL,"",
   "OK ou Entrer: Commencez"+NL};
  LOCAL MST2:={"Enter:Enter HMS numerically"+NL,"",
   "Entrer: Entrez HMS numeriquement"+NL};
  LOCAL MST3:={"ANY KEY: End"+NL,"",
   "N importe quelle clé: Terminer"+NL};
  //LOCAL CNW:="CONNECTIVITY:NO HP DATA";
  
  TICKB:=MSGBOX(MST(SL)+MST1(SL)+MST2(SL)+MST3(SL),1);
  IF TICKB THEN
   RECT();
   TICKB:=Ticks; TS:=Time;
   TICKL:=TICKB;
   REPEAT 
    MSNK;
    IF Ticks-TICKL≥1000 THEN
     TICKL:=Ticks;
     RECT();
     TEXTOUT_P(→HMS(ROUND((Ticks-TICKB)/1000,0)/3600),0,20);
     MSNK;
     TEXTOUT_P(TS+MST(SL),0,180);
     TEXTOUT_P(MST2(SL),0,200);
     TEXTOUT_P(MST3(SL),0,220);

    END;
    WAIT(0.001);
    MSNK;
    KK:=GETKEY;
   UNTIL KK≥0;
   TICKE:=Ticks;
   MI:=(TICKE-TICKB)/1000;
   IF KK==30 THEN //ENTER
    MI:=3600*INPUT_INTERVAL_H(WENTERZ(SL)+" "+WINTERVAL(SL));
    //IDEALLY IF A CANCEL IS DETECTED
    //OUGHT TO RESUME MEASURED TIMING
   END;
  END;
  MEAS_INTERVAL_S:=MI;
  RETURN ROUND(MI,ZIPPROUND);   
 END;

 THUNDER_DISTANCE_CALC_M(INTERVAL_S,TEMP_C)
 //INTERVAL
 //CELCIUS (NORMAL RANGE)
 BEGIN
  LOCAL DISTM;

  THSPD_M:=331.4+0.6*TEMP_C;//M/S
  DISTM:=INTERVAL_S*THSPD_M;
  RETURN ROUND(DISTM,ZIPPROUND);
 END;

 EXPORT THUNDER_DISTANCE()
 BEGIN
  LOCAL OK;
  LOCAL THDST:={};
  LOCAL THDM,THDKM,THDMI,THDNM;
  LOCAL INTERVAL_S,TEMP_C,TEMP;
  LOCAL TKIND;

  LOCAL TTL:=CHOICES(SL,4)+SG;
  LOCAL LBL:={WINTERVAL(SL)+" s",WUNITS(SL),WTEMPE(SL)};
  LOCAL HLP:={{"Interval sound-light. (0:use measured value)","","EG Temp C 0..20:Ground −57: Aircraft"},{},
   {"Intervalle son-lumière. 0:La valeur mesurée","","ex Temp C 0..20:Terre −57:Avion"}};//FR:P

  OK:=INPUT({INTERVAL_S,{TKIND,TKINDL},TEMP},TTL,LBL,HLP(SL),MEAS_INTERVAL_S,​0);
  
  IF OK THEN
   CASE 
    IF TKIND==1 THEN TEMP_C:=TEMP END;
    IF TKIND==2 THEN TEMP_C:=TEMP_F2C(TEMP) END;
    IF TKIND==3 THEN TEMP_C:=TEMP_K2C(TEMP) END;
    DEFAULT
   END;
   IF INTERVAL_S≤0 THEN //IMPORT VALUE
    INTERVAL_S:=MEAS_INTERVAL_S;
   END;
   THDM:=THUNDER_DISTANCE_CALC_M(INTERVAL_S,TEMP_C);
   THDKM:=THDM/1000;
   THDMI:=THDKM/TOMI;
   THDNM:=THDKM/TONM;

   THDST(1):=ROUND(INTERVAL_S,0)+" s"+" @ "+ROUND(THSPD_M,ZIPPROUND)+" m/s"+NL;
   THDST(2):=THDM+" m "+ROUND(THDKM,ZIPPROUND)+" km"+NL;
   THDST(3):=ROUND(THDMI,ZIPPROUND)+" milesUK"+NL;
   THDST(4):=ROUND(THDNM,ZIPPROUND)+NMST(SL);
   MSGBOX(THDST(1)+THDST(2)+THDST(3)+THDST(4));
   RETURN THDST(2);
  END;
 END;

 
 ZIPP_HELP ()
 BEGIN
  LOCAL CHS,OK;
  LOCAL HLPCHO:={"VARIABLES"};
  LOCAL HC:=CONCAT(CHOICES(SL),HLPCHO);
  
  
 
  LOCAL ST:={"
To change the number of digits displayed:","","
Pour changez la précision affichée:"};//FR:P
  LOCAL STEG:="
@Home:
 ZIPPROUND:=n  [n=−12..12]"+NL;

  LOCAL MAYBIS:={" may be installed separately","",
    " peut être installé séparément"};
  LOCAL TRBY:="Traduit par "+SG+" et ......";
  REPEAT
   PRINT(); PRINT(CRID);
 
   OK:=CHOOSE(CHS,WHELP(SL),HC);
   IF CHS THEN
    PRINT(HC(CHS));
    CASE
     IF CHS==1 THEN ABOUT() END;
     IF CHS==2  OR CHS==5 THEN PRINT(MAYBIS(SL)) END;
     IF CHS==6 THEN PRINT(TRBY) END;
     IF CHS==8 THEN PRINT(ST(SL)+STEG) END;
     DEFAULT
    END;
    WAIT;
   END;
  UNTIL CHS==0;
 END;

 DEFLT_LANG()
 BEGIN
  LOCAL DEF:=1;//PROG DEFAULT
  IF Language==1  OR Language==3 THEN
   DEF:=Language;
  END;
  RETURN DEF;
 END;

 SELECT_LANGUAGE()
 BEGIN
  LOCAL CHS;
  //LOCAL DEF:=1;//PROG DEFAULT IF LANG UNKNOWN
  
  CHOOSE(CHS,LANGS(SL),CONCAT(LANGS,{WSYS(SL)}));//CURRENT
  IF CHS AND CHS≠2 THEN
   SL:=CHS;
   IF CHS==4 THEN SL:=DEFLT_LANG(); END;
  END;
 END;

 EXPORT G1CMZ_IMMENSELY_PRACTICAL_PACKAGE ()
 BEGIN
  LOCAL CHS;

  SL:=DEFLT_LANG();
  REPEAT 
   CHOOSE(CHS,CRID,CHOICES(SL));
   CASE
    IF CHS==1 THEN ZIPP_HELP() END;
    IF CHS==2 THEN Z_LIGHTS() END;
    IF CHS==3 THEN MSGBOX(MEASURE_INTERVAL_S()+" s",1) END;
    IF CHS==4 THEN THUNDER_DISTANCE() END;
    IF CHS==5 THEN Z_UNITS() END;
    IF CHS==7 THEN CHS:=0 END;
    IF CHS==6 THEN SELECT_LANGUAGE() END;
    DEFAULT
   END;
   
  UNTIL CHS==0;

 END;

 EXPORT ZIPP()
 BEGIN
  G1CMZ_IMMENSELY_PRACTICAL_PACKAGE();
 END;

Stephen Lewkowicz (G1CMZ)
Visit this user's website Find all posts by this user
Quote this message in a reply
03-04-2016, 03:27 AM
Post: #9
RE: ZIPP: G1CMZ's Immensely Practical Package
Dear friend,

I downloaded your app, but i cannot or maybe I dont know hot to install it. Sorry because I´m very new in this, but really before writting you I´ve tried a lot of things to do it but still haven´t found the way.

I´ll appreciate any help you can provide me.

I got a HP Prime.

Thanks in advance...
Find all posts by this user
Quote this message in a reply
03-20-2016, 09:47 PM (This post was last modified: 03-22-2016 12:18 AM by StephenG1CMZ.)
Post: #10
RE: ZIPP: G1CMZ's Immensely Practical Package
(03-04-2016 03:27 AM)meseguer24 Wrote:  Dear friend,

I downloaded your app, but i cannot or maybe I dont know hot to install it. Sorry because I´m very new in this, but really before writting you I´ve tried a lot of things to do it but still haven´t found the way.

I´ll appreciate any help you can provide me.

I got a HP Prime.

Thanks in advance...

Welcome.

The ZIPP program requires 2 external programs.
If you are getting a compilation error at Z_LIGHTS or Z_UNITS, this means that you must first install those programs - alternatively, insert // at the start of those lines to comment out those programs.

A compilation error anywhere else probably indicates a difficulty with the Unicode space character in cutting and pasting the source code. Try deleting a line and retyping it.

Note: These are programs. They do not need installing as apps.

If that does not help, could you give some indication of the error you are having.
If that solved it, please let me know.

Stephen Lewkowicz (G1CMZ)
Visit this user's website Find all posts by this user
Quote this message in a reply
02-06-2019, 09:26 PM
Post: #11
RE: ZIPP: G1CMZ's Immensely Practical Package
http://www.hpmuseum.org/forum/thread-12369.html
KeithB suggested that I mention that this program includes a timer that can be used as a simple stopwatch, to help anyone searching for "stopwatch"...
Though if you want a dedicated stopwatch, there is much scope for improvement.

Stephen Lewkowicz (G1CMZ)
Visit this user's website Find all posts by this user
Quote this message in a reply
02-07-2019, 10:30 AM
Post: #12
RE: ZIPP: G1CMZ's Immensely Practical Package
My short interval timer here currently relies upon TICKS.
In http://www.hpmuseum.org/forum/thread-12369.html Cyrille suggests that ticks can be less accurate than using time/date functions, so I might implement another timer later.

Stephen Lewkowicz (G1CMZ)
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)