Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 01-22-2013, 08:36 AM   #91
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by stepk View Post
Define as local what for? I mean what's your concern if it isn't defined as local? IFS is a special shell variable, local or global it affects the way sh works. Note that json_parse sets it the resets to its default value when it's finished.
1) Keeps the changes to IFS local to the function ;
2) Does not assume an error-free code path ;
3) Is a matter of good style ;

4) You can drop that "resets it to the default value" thing ;
4.a) Which might be an error - a function can't be certain it was set to the default value on entry ;
4.b) The value of IFS will be the same on exit as on entry.
knc1 is offline   Reply With Quote
Old 01-22-2013, 08:50 AM   #92
stepk
Groupie
stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.
 
Posts: 165
Karma: 593460
Join Date: Oct 2012
Device: K5 B011 5.3.2.1
@twobob: working on your requested changes
@kc1: instead of dropping the reset to default value I'd rather save and restore the on-entry IFS value, just to bracket exactly the region where IFS=, needs to be in place. Any comments?
stepk is offline   Reply With Quote
Advert
Old 01-22-2013, 08:51 AM   #93
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by stepk View Post
@twobob: working on your requested changes
@kc1: instead of dropping the reset to default value I'd rather save and restore the on-entry IFS value, just to bracket exactly the region where IFS=, needs to be in place. Any comments?
That is exactly what:
local IFS
does for you - no need to add any executable statements.
knc1 is offline   Reply With Quote
Old 01-22-2013, 08:51 AM   #94
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Quote:
Originally Posted by stepk View Post
@twobob: working on your requested changes
@kc1: instead of dropping the reset to default value I'd rather save and restore the on-entry IFS value, just to bracket exactly the region where IFS=, needs to be in place. Any comments?
Superb.

Sound fine mate. Heroic even.
twobob is offline   Reply With Quote
Old 01-22-2013, 09:00 AM   #95
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
as a "use case"
Quote:
# create pretty label
make_label () {
echo -n "$json_name ¬$json_action $json_params"
## or echo -n "$xml_name ¬$json_action $json_params"
echo
}
would be a likely test...
twobob is offline   Reply With Quote
Advert
Old 01-22-2013, 09:14 AM   #96
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Sorry folks, not time to explain this morning, but . . . .

Another thing to control in the source is enable/disable "glob expansion" in the functions when using IFS and/or the built-in string operations.

Keeps the dumb-dumb scripting language from trying (first) to turn the word expansion into a path or file name on the storage media.
knc1 is offline   Reply With Quote
Old 01-22-2013, 09:16 AM   #97
stepk
Groupie
stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.
 
Posts: 165
Karma: 593460
Join Date: Oct 2012
Device: K5 B011 5.3.2.1
Quote:
Originally Posted by knc1 View Post
That is exactly what:
local IFS
does for you - no need to add any executable statements.
I didn't explain myself exactly. json_parse calls a user-provided function - make_label in this case. I want for the user-provided function to get an unmodified IFS. So I need to reset IFS before calling the user's function from within json_parse, don't I?
Code:
json_parse() {
local IFS0=$IFS IFS ... foo=$2
...
IFS=,
...
IFS=$IFS0
$foo
...
}
or is the local scoping not affecting called subs?
Also is it safe to save $IFS and declare it local in a single statement, or should I break it into two lines
Code:
local IFS0=$IFS
local IFS ...
thanks
stepk is offline   Reply With Quote
Old 01-22-2013, 09:28 AM   #98
stepk
Groupie
stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.
 
Posts: 165
Karma: 593460
Join Date: Oct 2012
Device: K5 B011 5.3.2.1
Quote:
Originally Posted by twobob View Post
as a "use case"

echo -n "$json_name ¬$json_action $json_params"

would be a likely test...
Done. Will attach soon, here's what I get on my extensions. Not too pretty in some cases. IMO you need to prefix $xml_name and condense some of the $json_name's... Give instructions, I will do
Spoiler:

Run Gray Install:| BEGIN ¬/mnt/us/extensions/systemic/bin/start_update.sh
ScreenSaver:| STOP ¬/mnt/us/extensions/systemic/bin/ssprevent.sh
ScreenSaver:| ALLOW ¬/mnt/us/extensions/systemic/bin/ssallow.sh
Cursor:| SHOW ¬/mnt/us/extensions/systemic/bin/cursorsallow.sh
Cursor:| HIDE ¬/mnt/us/extensions/systemic/bin/cursorsprevent.sh
Cursor Toggle:| INSTALL ** ¬/mnt/us/extensions/systemic/bin/installer.sh
Cursor Toggle:| REMOVE ** ¬/mnt/us/extensions/systemic/bin/uninstaller.sh
411 (Other Info) ¬/mnt/us/extensions/systemic/bin/411.sh 411
711 (Device & Network Info) ¬/mnt/us/extensions/systemic/bin/411.sh 711
Run Komic ¬/mnt/us/extensions/komic/bin/resource/Scripts/start.sh
Decompress CBZs and CBRs ¬/mnt/us/extensions/komic/bin/resource/Scripts/decompress.sh
Rename files ¬/mnt/us/extensions/komic/bin/resource/Scripts/rename.sh
Delete scheduled folders ¬/mnt/us/extensions/komic/bin/resource/Scripts/delete.sh
Move and rename screenshots ¬/mnt/us/extensions/komic/bin/resource/Scripts/movescreenshots.sh
Check for updates ¬/mnt/us/extensions/komic/bin/resource/Scripts/checkupdate.sh
Disable sounds ¬/mnt/us/extensions/komic/bin/resource/Scripts/sounds.sh
HackedUpReader ¬/mnt/us/hackedupreader/bin/cr3
BEGIN:Run Grayed Install ¬/mnt/us/extensions/helper/bin/start_update.sh
BEGIN:USBNETWORKING ¬/mnt/us/extensions/helper/bin/usbnetwork.sh
PREVENT:ScreenSavers ¬/mnt/us/extensions/helper/bin/ssprevent.sh
ALLOW:ScreenSaver: ¬/mnt/us/extensions/helper/bin/ssallow.sh
411 PageOther Info) ¬/mnt/us/extensions/helper/bin/411.sh 411
KILL:kterms ¬/mnt/us/extensions/helper/bin/kill-kterm.sh 411
Start Usbnetwork ¬/mnt/us/extensions/usbnetwork/bin/usbnetwork.sh
kterm ¬/mnt/us/extensions/kterm/bin/kterm
Portrait ¬/mnt/us/extensions/orientation/bin/setorientation.sh U
Portrait Inverted ¬/mnt/us/extensions/orientation/bin/setorientation.sh D
Landscape Left ¬/mnt/us/extensions/orientation/bin/setorientation.sh L
Landscape Right ¬/mnt/us/extensions/orientation/bin/setorientation.sh R
SkipStone ¬/mnt/us/extensions/skipstone/bin/skipstone.sh
Leafpad ¬/mnt/us/extensions/leafpad/bin/leafpad.sh
Start XTerm ¬/mnt/us/extensions/xterm/bin/xterm.sh

edit: the forum is hiding multiple spaces in '| Run Gray' and similar labels...
stepk is offline   Reply With Quote
Old 01-22-2013, 09:51 AM   #99
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Yeah. EDIT -> GO ADVANCED -> and like # (code blocks)

[code] stuff [/ code]


As to your suggestions on name creation, feel free to implement your own suggestions.
This is still just in the "testing" phase. I'm happy to take on suggestions, no doubt Ixtab would think the same thing.

Thanks : )
twobob is offline   Reply With Quote
Old 01-22-2013, 09:57 AM   #100
stepk
Groupie
stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.
 
Posts: 165
Karma: 593460
Join Date: Oct 2012
Device: K5 B011 5.3.2.1
Quote:
Originally Posted by knc1 View Post
Sorry folks, not time to explain this morning, but . . . .

Another thing to control in the source is enable/disable "glob expansion" in the functions when using IFS and/or the built-in string operations.

Keeps the dumb-dumb scripting language from trying (first) to turn the word expansion into a path or file name on the storage media.
Will do, thanks. I'm puzzled
Code:
x=${s/[ \t][ \t]/ }
KT sh seems to think that "\t " means a t followed by a space/t while I intended \t as the tab character. Isn't \t a recognized escape? If not, how can I specify tab in that context? ... going to study

edit: comes back... got it from your minimodding guide; use $'\t' instead of \t.

Last edited by stepk; 01-22-2013 at 10:21 AM. Reason: SOLVED \t
stepk is offline   Reply With Quote
Old 01-22-2013, 10:06 AM   #101
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by stepk View Post
I didn't explain myself exactly. json_parse calls a user-provided function - make_label in this case. I want for the user-provided function to get an unmodified IFS. So I need to reset IFS before calling the user's function from within json_parse, don't I?
Code:
json_parse() {
local IFS0=$IFS IFS ... foo=$2
...
IFS=,
...
IFS=$IFS0
$foo
...
}
or is the local scoping not affecting called subs?
Also is it safe to save $IFS and declare it local in a single statement, or should I break it into two lines
Code:
local IFS0=$IFS
local IFS ...
thanks
Yes, you want that - since you shouldn't guess a what an external function might expect.

I really must run (car keys in hand) - but . . . .
Here is a (somewhat large) example (in BASH!) of the handling of a lot of those issues:
http://hg.minimodding.com/repos/cats/shacat.hg/

In particular the topmost defines for the IFS strings.
That way a reader will get a clue as to what is happening at each step along the way.
knc1 is offline   Reply With Quote
Old 01-22-2013, 10:09 AM   #102
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
if it isn't on this page? http://linux.about.com/library/cmd/blcmdl1_ash.htm
Then I probably don't know it. Since my knowledge of scripting is postage stamp sized and my knowledge of ash is covered by that page.
I too however am diving into some more docs.

I'll give http://hg.minimodding.com/repos/cats...3/sha1cat.bash a look too
twobob is offline   Reply With Quote
Old 01-22-2013, 10:24 AM   #103
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
err... is it like $'\t' ( so maybe something to do with the context of the escaping?)

[root@kindle extensions]# echo "Hey$'\t'You!" <- nope
Quote:
Hey'\t'You!
[root@kindle extensions]# echo Hey$'\t'You! <- yep?
Quote:
Hey You!

EDIT: LOL! I see you found it.

Last edited by twobob; 01-22-2013 at 10:30 AM.
twobob is offline   Reply With Quote
Old 01-22-2013, 10:25 AM   #104
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by twobob View Post
That program is three lines long + one line to output all failure messages. (see tail end of the script)

The fact that it takes 1200+ lines of supporting functions...
Well, whatever.

It can (has done) 1Tbyte disk drives with things nested in arbitrary order. (zips of tars of gzips of whatever).
Any combination of the expand_<thing> that is posssible.

I.E: My "Declarative Programming in Bash" example first published in the ABS Guide ten years ago.
knc1 is offline   Reply With Quote
Old 01-22-2013, 11:10 AM   #105
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Quote:
Originally Posted by knc1 View Post
...first published in the ABS Guide ten years ago.
Old != Bad
twobob is offline   Reply With Quote
Reply

Tags
kindle touch, kindle touch hacks, kindlet, kual, launcher, launcher add-ons, paperwhite, sqlite, unified

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Launcher icon for KUAL? Aeris Kindle Developer's Corner 32 04-01-2021 07:57 PM
kite: kindle 3 application launcher fbdev Kindle Developer's Corner 86 10-18-2017 10:19 AM
[KUAL]Kindle reflective screen loader icantbebothered Kindle Developer's Corner 26 10-27-2013 09:08 AM
Kual shortcut for hidden image viewer (Kindle Touch & PW) Aeris Kindle Developer's Corner 0 10-12-2013 05:09 AM
application launcher for kindle 3 (kite) fbdev Kindle Developer's Corner 21 05-04-2012 06:02 PM


All times are GMT -4. The time now is 01:51 AM.


MobileRead.com is a privately owned, operated and funded community.