issue when cancelling INPUT
|
09-28-2015, 08:22 PM
Post: #1
|
|||
|
|||
issue when cancelling INPUT
Hello,
I saw complex usage of INPUT command in this forum, but I have an issue with a quite simple INPUT usage, I'm surprised nobody reported it already. (I searched but I may missed) I simply try to cancel an INPUT with the cancel soft key (or by pressing ON key, result is the same btw) I made the INPUT as simple as possible, one argument. I usually cover all cases (like cancelling), then I started to check INPUT return as stated in builtin help (it's supposed to return 0 on cancellation). Here is the program : And here is what's happend when canceled : Please can you check if your behave like mine ? Code: EXPORT failure() Firmware 8151, I tested with EXPORTed var, without the KILL, in every case it behave like this, is it a bug ? Thank you, Best Regards. primer |
|||
09-28-2015, 10:23 PM
(This post was last modified: 09-28-2015 10:29 PM by Helge Gabert.)
Post: #2
|
|||
|
|||
RE: issue when cancelling INPUT
With odd characters appearing, you could have a memory corruption issue. You might want to do a hard (paperclip) reset, and reformat.
Anyway, my program runs fine, but I only use lower case variables as local variables in my programs, because single, upper case, letters are reserved for global reals. EXPORT FAILURE() BEGIN LOCAL a; INPUT(a); IF a==0 THEN KILL; END; RETURN a; END; Does this work for you? |
|||
09-28-2015, 10:27 PM
Post: #3
|
|||
|
|||
RE: issue when cancelling INPUT
On the Android version I just see <name of program> Program Interrupted.
Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
09-29-2015, 05:57 AM
(This post was last modified: 09-29-2015 06:18 AM by primer.)
Post: #4
|
|||
|
|||
RE: issue when cancelling INPUT
(09-28-2015 10:23 PM)Helge Gabert Wrote: With odd characters appearing, you could have a memory corruption issue. You might want to do a hard (paperclip) reset, and reformat.I already paperclip on real prime. But now I perform test on virtual, I reseted it too. Is it possible that both have memory corruption ? (09-28-2015 10:23 PM)Helge Gabert Wrote: because single, upper case, letters are reserved for global reals.yes I know, it's reserved, but : First : being reserved does not mean you are not allowed to use it on program without a crash, Second : I'm not using the reserved variaible because I declared locally a variable. It's a different variable. Nevertheless, I did perform all tests I could : "LOCAL a" , "EXPORT a", "LOCAL ABC", "EXPORT ABC", also using reserved var (without "LOCAL A")... in every case it fails when cancelled. (09-28-2015 10:23 PM)Helge Gabert Wrote: Does this work for you?no. I mean, program *does* work, but when you cancel INPUT in this program, it behaves wrongly. Btw, sorry but I think you misuse the input check in your program, you are not checking user cancellation with your : INPUT(a); IF a==0 THEN You are only checking "does user filled 0 ?", which is not the same... as checking cancellation. In builtin-help, it's written : "If user press cancel menu key, var is not updated and 0 is returned", did you read it ? Regards primer |
|||
09-29-2015, 10:54 AM
(This post was last modified: 09-29-2015 11:05 AM by Tyann.)
Post: #5
|
|||
|
|||
RE: issue when cancelling INPUT
Bonjour
Je viens de tester vôtre code, sur ma machine cela fonctionne bien. Les signes bizarres apparaîssent lorsque le KILL est exécuté. Essayez ceci: Code:
E vaut 1 Si vous selectionner Annule E vaut 0 Hello I just tested your code on my machine at IT Works well . The bizarre signs appear When the KILL is executed. Try this: Code:
E is 1 If you select Cancel E is 0 Sorry for my english |
|||
09-29-2015, 11:25 AM
Post: #6
|
|||
|
|||
RE: issue when cancelling INPUT
(09-29-2015 10:54 AM)Tyann Wrote: The bizarre signs appear When the KILL is executed.Yes, it's not linked to the INPUT but to the KILL instruction, for example with the following code Cancel works fine and returns 0, but OK returns the Chinese characters as it executes KILL: Code: EXPORT failure() |
|||
09-29-2015, 02:33 PM
Post: #7
|
|||
|
|||
RE: issue when cancelling INPUT
In testing only with emu, I have been unable to see this at all with any version of the programs posted.
Has anyone other then the OP seen this yet? (either hw/emu or both) TW Although I work for HP, the views and opinions I post here are my own. |
|||
09-29-2015, 02:55 PM
Post: #8
|
|||
|
|||
RE: issue when cancelling INPUT
(09-29-2015 02:33 PM)Tim Wessman Wrote: In testing only with emu, I have been unable to see this at all with any version of the programs posted. Yes, with the program I posted just above, here is what I get: first line returning 0 is with [Cancel] second line returning Chinese characters is with an input value of 5 followed by [OK] |
|||
09-29-2015, 04:13 PM
Post: #9
|
|||
|
|||
RE: issue when cancelling INPUT
Hello,
I've figured it out. What you are actually seeing is the Chinese translation for "Program Interrupted" that is accidentally in the french strings! TW Although I work for HP, the views and opinions I post here are my own. |
|||
09-29-2015, 04:14 PM
(This post was last modified: 09-29-2015 04:17 PM by Helge Gabert.)
Post: #10
|
|||
|
|||
RE: issue when cancelling INPUT | |||
09-29-2015, 07:30 PM
(This post was last modified: 09-29-2015 07:34 PM by primer.)
Post: #11
|
|||
|
|||
RE: issue when cancelling INPUT
(09-29-2015 04:14 PM)Helge Gabert Wrote: But Tim figured it out - - a language problem!That's nice the issue is identified, thank you. hopefully is was only a language issue. Then I discover that KILL does leave a message "program interrupted", I was expecting it behave like good old exit() from C, without a message. Is it possible to exit silently ? (by using an argument to KILL maybe) Do you know if it's possible ? RETURN is not a great solution, as it only ends current function. Thank you. Regards primer |
|||
09-29-2015, 08:27 PM
Post: #12
|
|||
|
|||
RE: issue when cancelling INPUT
KILL doesn't seem to accept any arguments, otherwise you could pass " ". Maybe someone else knows?
|
|||
09-29-2015, 10:23 PM
(This post was last modified: 09-29-2015 10:49 PM by Tim Wessman.)
Post: #13
|
|||
|
|||
RE: issue when cancelling INPUT
(09-29-2015 07:30 PM)primer Wrote: Then I discover that KILL does leave a message "program interrupted", Ah, but it isn't actually returning a message. Rather, it is returning an error object which is going to display (nicely) with text. :-) You can use an error trap to catch an interruption if you'd like. Look at the IFERR error catching stuff. TW Although I work for HP, the views and opinions I post here are my own. |
|||
09-30-2015, 05:17 AM
Post: #14
|
|||
|
|||
RE: issue when cancelling INPUT
Bonjour
Il manque une instruction STOP qui met fin au programme n'importe où sans erreur. Hello It lacks a STOP statement which terminates the program anywhere without error. Sorry for my english |
|||
09-30-2015, 06:49 AM
Post: #15
|
|||
|
|||
RE: issue when cancelling INPUT
(09-29-2015 10:23 PM)Tim Wessman Wrote: You can use an error trap to catch an interruption if you'd like. Look at the IFERR error catching stuff.Indeed, but if you have to catch the error to avoid the error message, you are not stopping anymore your program... Code:
primer |
|||
09-30-2015, 01:56 PM
Post: #16
|
|||
|
|||
RE: issue when cancelling INPUT
One of the primary issues here is that *every* function needs to return something. If you don't return anything, the last command or argument left on the runtime stack will be returned. There really isn't the concept of a void function in PPL...
TW Although I work for HP, the views and opinions I post here are my own. |
|||
09-30-2015, 03:01 PM
Post: #17
|
|||
|
|||
RE: issue when cancelling INPUT
(09-29-2015 07:30 PM)primer Wrote:(09-29-2015 04:14 PM)Helge Gabert Wrote: But Tim figured it out - - a language problem!That's nice the issue is identified, thank you. hopefully is was only a language issue. In which case do you need the EXIT? Could you make a program that follows a sequence that exits naturally? As an example, with BASIC you could redirect your program execution pointer using GOTO, but this is completely avoidable using proper sequences. My website: ried.cl |
|||
09-30-2015, 08:41 PM
(This post was last modified: 09-30-2015 08:44 PM by primer.)
Post: #18
|
|||
|
|||
RE: issue when cancelling INPUT
(09-30-2015 01:56 PM)Tim Wessman Wrote: ... There really isn't the concept of a void function in PPL...Ok I understand. life is life. Btw, because it's treated as "error", your KILL command is closer from an exception than of a classic exit mechanism. (09-30-2015 03:01 PM)eried Wrote: As an example, with BASIC you could redirect your program execution pointer using GOTO, but this is completely avoidable using proper sequences.Indeed basic from 80's abused the evil GOTO, I was here, but it makes more than 30 years normal people avoid it. But it's nothing compared to exit() or throwing/catching an exception, theses are perfectly legit. "30 years" of computering... wow, I'm geting old Thank all of you for your remarks and advices. Best Regards. primer |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)