Bílý vrch
icon TrekBuddy
www.trekbuddy.net
Outdoor companion.
  • internal / bluetooth / simulator GPS
  • offline raster maps
  • smart GPX / raw NMEA logs
  • waypoints and simple navigation
  • custom views
  • MIDP and Symbian phones
  • Blackberry
  • Android
Visit wiki to see all features, guides and howtos. Project tracker.

Partners:    (Polish/Polski)(Polski) Compass mapy      (Polish/Polski)(Polski) Galileos mapy      (Polish/Polski)(Polski) CartoMedia      (Czech/Èesky)(Èesky) Eaglesoft trasy      (Polish/Polski)(Polski) ExpressMap     

 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
HECL question

 
Post new topic   Reply to topic    TrekBuddy Forum Index -> General discussion
View previous topic :: View next topic  
Author Message
JNT



Joined: 10 Jan 2009
Posts: 413
Location: Sweden

PostPosted: Fri Mar 18, 2016 8:15 pm    Post subject: HECL question Reply with quote

Now I am very puzzled... Confused

I calculate the value of $car::target-rtc. (Say I get 32)

Then I do:

Code:
          set car::disp1b $car::target-rtc;
          append $car::disp1b "°";


Then both $car::disp1b and $car::target-rtc become 32°.

Why?! Shocked

I expected $car::disp1b to become 32° and $car::target-rtc to stay 32.
Back to top
View user's profile Send private message
kruch
Site Admin


Joined: 02 Jul 2006
Posts: 5660

PostPosted: Fri Mar 18, 2016 9:14 pm    Post subject: Reply with quote

HECL doc says that "dollar sign returns a reference to the value of a variable"

so, with

Code:
set car::disp1b $car::target-rtc


you create just another reference to the same HECL value.

I think you want to create deep copy of value

Code:
set car::disp1b [copy $car::target-rtc]


http://www.hecl.org/docs/copy.html

I guess for primitive types (integers etc), it would work like you expected, but strings are reference variables.


Last edited by kruch on Fri Mar 18, 2016 9:24 pm; edited 1 time in total
Back to top
View user's profile Send private message
JNT



Joined: 10 Jan 2009
Posts: 413
Location: Sweden

PostPosted: Fri Mar 18, 2016 9:23 pm    Post subject: Reply with quote

kruch wrote:
you create just another reference to the same HECL value.


OK, that would explain the behaviour. Thanks!

kruch wrote:

I think you want to create deep copy of value

Code:
set car::disp1b [copy $car::target-rtc]



Perhaps it's time I read all the bloody HECL documents again...

Wink
Back to top
View user's profile Send private message
JNT



Joined: 10 Jan 2009
Posts: 413
Location: Sweden

PostPosted: Fri Mar 18, 2016 9:58 pm    Post subject: Reply with quote

kruch wrote:
And I should make progress with replacing HECL with Lua Embarassed


Is Lua better than JavaScript?
Back to top
View user's profile Send private message
kruch
Site Admin


Joined: 02 Jul 2006
Posts: 5660

PostPosted: Sat Mar 19, 2016 7:43 am    Post subject: Reply with quote

You are fast Smile Still not sure...

I found 3 JS engines for j2me, but development stopped long time ago, was not very active and there is no feedback. Which is also true for HECL Wink

Luaj (sourceforge project) has impressive rating, active development, it just seems so mature. But - Lua just isn't as intuitive as JS to me. And I also do not feel like learning another scripting language.

So, I will try JS first.
Back to top
View user's profile Send private message
JNT



Joined: 10 Jan 2009
Posts: 413
Location: Sweden

PostPosted: Sat Mar 19, 2016 9:26 am    Post subject: Reply with quote

kruch wrote:
You are fast Smile


Sometimes I am just at the right place at the wrong time... (or is it the wrong place at the right time?) Wink

Seems like a tough call... pity there is no obvious best choice.

Does Android support JS natively? Guess you need a solution that will work on all platforms.
Back to top
View user's profile Send private message
JNT



Joined: 10 Jan 2009
Posts: 413
Location: Sweden

PostPosted: Sat Mar 19, 2016 2:43 pm    Post subject: Reply with quote

One more HECL related question. What exactly happens when I have 2 hecl files in the ui-profiles directory? Does Trekbuddy only load the first one it finds?
Back to top
View user's profile Send private message
kruch
Site Admin


Joined: 02 Jul 2006
Posts: 5660

PostPosted: Sat Mar 19, 2016 2:59 pm    Post subject: Reply with quote

All of them. But order is unspecified in current TB version.
Back to top
View user's profile Send private message
JNT



Joined: 10 Jan 2009
Posts: 413
Location: Sweden

PostPosted: Sat Mar 19, 2016 3:49 pm    Post subject: Reply with quote

kruch wrote:
All of them. But order is unspecified in current TB version.

Can it handle and successfully execute 2 hecl files? If so, under what conditions ? (Having both the car and sail hecl files in the same folder, only the car is working for me)
Back to top
View user's profile Send private message
kruch
Site Admin


Joined: 02 Jul 2006
Posts: 5660

PostPosted: Sat Mar 19, 2016 7:24 pm    Post subject: Reply with quote

Can you send them to me? Thanks.
Back to top
View user's profile Send private message
JNT



Joined: 10 Jan 2009
Posts: 413
Location: Sweden

PostPosted: Sat Mar 19, 2016 8:11 pm    Post subject: Reply with quote

Thanks for pointing out the duplicate name. Now they work together. Smile

I have too many versions floating around... I have now fixed that mistake twice already! (Also updated the latest files uploaded in Themes)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    TrekBuddy Forum Index -> General discussion All times are GMT
Page 1 of 1

 
Jump to:  
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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group