#!/bin/sh # MetaCard 2.0 stack # The following is not ASCII text, # so now would be a good time to q out of more exec mc $0 "$@" Calculator,calc.mc  Calculator `7BlackÀÀÀÀÀÀ††EEEEÿÿÿÿÿÿWhiteBlackXÐÀ YMPCFOWAê PÔ# handle keystrokes and button presses on operator which #supress leading 0 if field "Display" is "0" then put empty into field "Display" if which is "=" then put value(field "Display") into field "Display" else if which is "C" then put 0 into field "Display" else if which is "BS" then delete last char of field "Display" else put which after field "Display" #put 0 back into display if needed if field "Display" is empty then put 0 into field "Display" end operator on returnKey operator "=" end returnKey on enterKey operator "=" end enterKey on deleteKey operator "BS" end deleteKey on backSpaceKey operator "BS" end backSpaceKey on keyDown whichkey #make sure user pressed a valid key if whichkey is in ".0123456789+-*/=C" then operator whichkey else beep 1 end keyDown #since the buttons don't have scripts, all the mouseUp messages #end up here. Do the operation specified by that button (the short #name is the text displayed on the button). First, check to make sure #that user clicked on a button and not the card or "Display" field on mouseUp if word 1 of the target is "button" then operator the short name of the target end mouseUp ÐÀëìíîþ÷ïðñùøòóôûúõöÿüý ëDisplay `óóÚÚ©©È$ 0ì7àE‹`,($ í8àE‹`,,($ î9àE‹`T,($ ï4àE‹`P($ ð5àE‹`,P($ ñ6àE‹`TP($ ò1àE‹`t($ ó2àE‹`,t($ ô3àE‹`Tt($ õ0àE‹`˜($ ö.àE‹`,˜($ ÷CàE‹`ÿÿ€€¤,($ ø/àE‹`òòÓÓÈȤP($ ù*àE‹`òòÓÓÈÈ|P($ ú-àE‹`òòÓÓÈȤt($ û+àE‹`òòÓÓÈÈ|t($ ü(àE‹`òòÓÓÈÈ|˜($ ý)àE‹`òòÓÓÈȤ˜($ þBSàE‹`ÿÿ€€|,($ ÿ=àE‹`CCÆÆÛÛ turquoiseT˜($