Post Reply 
Question about user mode key definitions.
09-05-2017, 06:05 AM (This post was last modified: 09-05-2017 06:06 AM by leprechaun.)
Post: #8
RE: Question about user mode key definitions.
Quote:I want to have this program run when I hit shift-base and change the input line to the appropriate base.

I miss this possibility, too. There will be reasons why such little things are or had been ignored. These little feature improve the usability very much.
My approach is something like that. (SoftMenu() is a menu-laucher that returns the softkey id) The additional two ENTERs seem to be unavoidable. Is it possible to take input from the command line instead of the stack? so purge a number from input and save ENTERing it to the stack.

  LOCAL base_key := Base+1;
  LOCAL btn:=SoftMenu({{"bin","oct","dec","hex","","2Real"},base_key});

    IF btn==1 THEN   Base:=0;IFTE(Entry==2,"INT_BIN","INT_BIN(Ans)"); END;   //2D  : Entry==0
    IF btn==2 THEN   Base:=1;IFTE(Entry==2,"INT_OCT","INT_OCT(Ans)"); END;
    IF btn==3 THEN   Base:=2;IFTE(Entry==2,"INT_DEC","INT_DEC(Ans)"); END;
    IF btn==4 THEN   Base:=3;IFTE(Entry==2,"INT_HEX","INT_HEX(Ans)"); END;
   // IF btn=5 THEN RETURN " R→B(1)"; END;
    IF btn=6 THEN RETURN " B→R()"; END;
    DEFAULT "";

  LOCAL str;
    IF TYPE(X)==0 THEN R→B(X,32,4); END;
    IF TYPE(X)==1 THEN SETBASE(X,4); END; //Base is already set to 3 
    IF TYPE(X)==2 THEN X:=UCase(X);  str:="#"+X+"h"; R→B(expr(str)); END;
//    IF TYPE(X)==2 THEN  str:="#"+X+"h"; R→B(approx(str)); END;
 //   IF TYPE(X)==2 THEN str:="#"+X+"h";  INT_HEX( CAS(str)); END;
    DEFAULT "";
 // R→B(X,32,4);

Prime and I are a love-hate. I dig out the prime occasionally but only for playing with it. The productivity level is frustratingly low for me.
Maybe that is because I work as a hardware designer with lowest level firmware on the software side. Script-languages and HPPPL seem to be too complicated for me.
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: Question about user mode key definitions. - leprechaun - 09-05-2017 06:05 AM

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