Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
The GUI for my shell is developed but I got several questions for those of you with shell experience (or ice experience) regarding the mechanics of the shell.

1. How do you get the filename from a program using DetectVar. I know it would have to look somewhat like this:

Code:

sum(20,0,0,5)->B
sum(2,B,"r",5)->C

Its the part after that is hard to figure out.

2. How do you run a detected program in a shell
3. How do you save scanned for pointers to filenames of detected vars.

Thanks!
The REAL LAX18 wrote:
The GUI for my shell is developed but I got several questions for those of you with shell experience (or ice experience) regarding the mechanics of the shell.

1. How do you get the filename from a program using DetectVar. I know it would have to look somewhat like this:

Code:

sum(20,0,0,5)->B
sum(2,B,"r",5)->C

Its the part after that is hard to figure out.

2. How do you run a detected program in a shell
3. How do you save scanned for pointers to filenames of detected vars.

Thanks!

Fistly, sum(20 returns the file name as a string, so just do sum(1 if an appvar, or sum(2 if other. Just use the returned string to open it.
Secondly, you can't run a detected prgm, but you can move its contents to another, predefined prgm and just run that instead.
Thirdly, use sum(4,STRING,legth(STRING),1,SLOT
Hope this helps Smile
Also, useful types in fileIOC are:
5 prgm
6 protected prgm
7 temp prgm (I might be wrong on this one)
21 appvar
beckadamtheinventor wrote:
The REAL LAX18 wrote:
The GUI for my shell is developed but I got several questions for those of you with shell experience (or ice experience) regarding the mechanics of the shell.

1. How do you get the filename from a program using DetectVar. I know it would have to look somewhat like this:

Code:

sum(20,0,0,5)->B
sum(2,B,"r",5)->C

Its the part after that is hard to figure out.

2. How do you run a detected program in a shell
3. How do you save scanned for pointers to filenames of detected vars.

Thanks!

Fistly, sum(20 returns the file name as a string, so just do sum(1 if an appvar, or sum(2 if other. Just use the returned string to open it.
Secondly, you can't run a detected prgm, but you can move its contents to another, predefined prgm and just run that instead.
Thirdly, use sum(4,STRING,legth(STRING),1,SLOT
Hope this helps Smile
Also, useful types in fileIOC are:
5 prgm
6 protected prgm
7 temp prgm (I might be wrong on this one)
21 appvar


Ive tried opening this as a string, but I cannot figure out how to read the filename string.
1) USE SOURCECODER3!
2) It's said in the documentation, under Code Snippets
3) There is this code placed:

Code:
0->POS
While DetectVar(◦POS,0,5)→PROG
OpenVar(PROG,"r",5)→SLOT
...
End

4) No, you can't run BASIC programs, which names is stored in a string.
PT_ wrote:
1) USE SOURCECODER3!
2) It's said in the documentation, under Code Snippets
3) There is this code placed:

Code:
0->POS
While DetectVar(◦POS,0,5)→PROG
OpenVar(PROG,"r",5)→SLOT
...
End

4) No, you can't run BASIC programs, which names is stored in a string.

exept you can run basic programs... If you have the name written directly in the code, if im not mistaken, just by putting the contents of the prgm you want to run into a predefined file.

Code:

sum(2,FILENAME,"r",5→D
sum(2,"TEMPFILE","w",5→O
while sum(6,D→C
sum(7,C,O
End
sum(3,D
sum(3,O
prgmTEMPFILE
Maybe Im slow but what is the code to read the filename. I know DetectVar provides a pointer to the filename, bu I dont know how I can read the data that this directs to. I have tried the GetTokenString command, Ive tried opening the pointer as a string. What exactly am I doing wrong?
The REAL LAX18 wrote:
Maybe Im slow but what is the code to read the filename. I know DetectVar provides a pointer to the filename, bu I dont know how I can read the data that this directs to. I have tried the GetTokenString command, Ive tried opening the pointer as a string. What exactly am I doing wrong?


PT_ wrote:

Code:
While DetectVar(◦POS,0,5)→PROG
OpenVar(PROG,"r",5)→SLOT
PT_ wrote:
The REAL LAX18 wrote:
Maybe Im slow but what is the code to read the filename. I know DetectVar provides a pointer to the filename, bu I dont know how I can read the data that this directs to. I have tried the GetTokenString command, Ive tried opening the pointer as a string. What exactly am I doing wrong?


PT_ wrote:

Code:
While DetectVar(◦POS,0,5)→PROG
OpenVar(PROG,"r",5)→SLOT


The I would read it by:

Code:

sum(5,Str2,3,SIZE,SLOT)

Code:

0->POS
DetectVar(▫POS,0,5)->PROG
OpenVar(2,PROG,"r",5)->SLOT
Read(Str2,GetSize(SLOT),1,SLOT)
Disp Str2
Pause


Would this code work?
Also how can I tell how many "counts" the filename is before reading it to Str2?
The REAL LAX18 wrote:

Code:

0->POS
DetectVar(▫POS,0,5)->PROG
OpenVar(2,PROG,"r",5)->SLOT
Read(Str2,GetSize(SLOT),1,SLOT)
Disp Str2
Pause


Would this code work?
Also how can I tell how many "counts" the filename is before reading it to Str2?

length(PROG)

Code:

0->POS
DetectVar(°POS,0,5)->PROG
OpenVar(PROG,"r",5)->SLOT
GetSize(SLOT)->SIZE
Read(Str1,SIZE,1,SLOT)
Disp Str1
Pause
A few tips:
#1: variables in ICE are all numbers. To use more than three bytes (0 to 16777215, minimum and maximum numbers in ICE) in a variable, use strings,Data(),Alloc(),etc. This will return a number, which is used to get one, two, or three bytes from the data previously made. You can get the next bytes of the data by adding to the number returned by the creation of the variable.
#2: There is no structural differences between data types in ICE, aside from how they are read.

A few Routines:
String input routine (Call)
'I' is the input prompt
'R' is the default input, and the return variable

Code:

//first two lines are the key setup, having each character correspond to a key, using the asm key codes as indexes
" #wrmh ()vqlg :zupkfc ytojeb xsnida 'WRMH ?!VQLG ;ZUPKFC_YTOJEB XSNIDA +-*/^ ?369)$@.258(&'0147,][ >=<}{25→SMAP
35→SMAPLEN
Lbl INPUT
det(2,255
0→SEC
" [0]→S
Lbl INPUTR
det(36,X,Y,108,9
SEC→*{S+2
det(18,I+R+S,X,Y
Repeat getKey→K
End
*{SMAP+(K≥10 and K≤47)*(SMAPLEN*SEC+K-9→*{R+A
A+(K≥10 and K≤47)-(K=56 and A>0→A
*{R}*(K≠15→*{R
If K=54
1-SEC→SEC
End
If K=9 or K=15
Return
End
Goto INPUTR


Number Input routine (Call)
'N' is the number to start with, and the return variable

Code:

//first line is the key codes for 0-9
"21221A12231B13241C14→NMAP
Lbl NUMI
det(2,255
Lbl NUMIR
det(36,X,Y,56,9
det(19,X,Y
det(15,N,6
Repeat getKey→K
End
If K=56
N/10→N
Else
For(A,0,9
If K=*{NMAP+A
A→B
End
End
10*N+B-1→N
End
If K=9 or K=15
Return
End
Goto NUMIR


If any of this doesn't work, please let me know, and I will fix it.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement