I am trying a different approach for this program... that should make it more compatible.
Just one measure unit conversion function implemented... so many job to be done... /* Copyright 2024 Paul Dufresne (dufres...@zoho.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* This program is written in REXX... see https://rexxinfo.org/reference/index_reference.html for more information about this programming language. */ call makeTopMenu call showMenu select when RESULT='SPEED' then do call makeSpeedMenu,'' call showMenu fromUnit=RESULT call MakeSpeedMenu fromUnit call showMenu toUnit=RESULT call convert fromUnit,toUnit end when RESULT='DISTANCE' then do call makeDistanceMenu,'' call showMenu fromUnit=RESULT call MakeDistanceMenu fromUnit call showMenu toUnit=RESULT call convert fromUnit,toUnit end when RESULT='VOLUME' then do call makeVolumeMenu,'' call showMenu fromUnit=RESULT call MakeVolumeMenu fromUnit call showMenu toUnit=RESULT call convert fromUnit,toUnit end when RESULT='AREA' then do call makeAreaMenu,'' call showMenu fromUnit=RESULT call MakeAreaMenu fromUnit call showMenu toUnit=RESULT call convert fromUnit,toUnit end when RESULT='WEIGHT' then do call makeWeightMenu,'' call showMenu fromUnit=RESULT call MakeWeightMenu fromUnit call showMenu toUnit=RESULT call convert fromUnit,toUnit end otherwise say 'Unknown choice!' end exit 0 makeTopMenu: queue 'SPEED' queue 'DISTANCE' queue 'AREA' queue 'VOLUME' queue 'POWER' return queueIf: parse arg element,avoid if element <> avoid then queue element return showMenu: drop menu. number = queued() Do i=1 to number PULL element SAY i'. 'element menu.i=element END pull answer return menu.answer makeSpeedMenu: parse arg avoid call queueIf 'MPH',avoid call queueIf 'KMH',avoid call queueIf 'MPS',avoid call queueIf 'KN',avoid return makeDistanceMenu: parse arg avoid call queueIf 'MILIMETER',avoid call queueIf 'CENTIMETER',avoid call queueIf 'METER',avoid call queueIf 'KM',avoid call queueIf 'YARD',avoid call queueIf 'FOOT',avoid call queueIf 'INCH',avoid call queueIf 'MILES',avoid return makeVolumeMenu: parse arg avoid call queueIf 'CUBEMETER',avoid call queueIf 'CENTILITER',avoid call queueIf 'LITER',avoid call queueIf 'DECILITER',avoid call queueIF 'MILIMETER',avoid call queueIF 'GAL',avoid call queueIF 'PT',avoid call queueIF 'FLOZ',avoid return makeAreaMenu: parse arg avoid call queueIf 'M2',avoid call queueIf 'KM2',avoid call queueIf 'CM2',avoid call queueIf 'MM2',avoid call queueIf 'MI2',avoid call queueIf 'YD2',avoid call queueIf 'FT2',avoid call queueIf 'IN2',avoid return makeWeightMenu: parse arg avoid call queueIf 'GRAM',avoid call queueIf 'KG',avoid call queueIf 'LB',avoid call queueIf 'OZ',avoid return convert: parse arg fromUnits,toUnits say 'Enter amount of 'fromUnits pull amount function=fromUnits"2"toUnits callLine="call "function" "amount interpret callLine say 'give 'RESULT' 'toUnits say 'again?' pull yesNo if yesNo == 'Y' | yesNo == 'YES' then call convert fromUnits,toUnits return MPH2KMH: parse arg MPH return 1.60934*MPH KMH2MPH: parse arg KMH if KMH <> 0 then return KMH/1.60934 else return 0 _______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel