forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

*?#^ing ENVIRONMENT VARIABLES

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Tue Nov 12, 2019 7:17 pm    Post subject: *?#^ing ENVIRONMENT VARIABLES Reply with quote

OK guys, give me a lesson on changing ENVIRONMENT VARIABLES please.
(A general one, not specifically FTN95)

I always struggle with these which is why I don't touch unless absolutely necessary.

If I understand corrrectly there are 3 ways of adding/changing them:-

a) via the Windows menu system
b) via command line and SET
c) directly via the registry

What isn't clear is why if you use method a), only 1 appears e.g. for PATH and if you modify it it deletes all the others !!! (Proven by experience alas Sad )
same for command line using SET doesn't ADD it replaces.

Anyone a link of a VERY good comprehensive description of all methods and their pitfalls ?
_________________
''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Tue Nov 12, 2019 10:07 pm    Post subject: Reply with quote

John Campbell is a pro to change that dynamically. I usually go to Windows system and change (add) it there. Never had any issues. Be particularly careful and do not forget to click Apply at the end

Admittedly i never do that lately. You need that more often when you start using different versions of the same software or too much 3rd party apps.
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Wed Nov 13, 2019 3:42 am    Post subject: Reply with quote

I modify environment variables to modify the PATH or create parameters in .bat batch files and used in .bat or interrogated in my fortran programs.

I only use two approaches.

1) to modify the "pre-existing" or new environment variables, I use :
Control Panel > System > Advanced system settings > Advanced > Environment Variables...
In this you have "User variables for ..." or "System variables" where I always use "System variables".
I will modify existing, eg PATH or add new ones and reference the new ones, eg my PATH is:
%gcc_path%;%ftn95_path%;%orig_path%;c:\utils
If using bbb=%aaa%;%aa1%, then there is a limitation that the variables are processed in name sort order, so %aa2%=%bbb%;%aa1% does not work as bbb may not be defined.
At startup, the order of processing environment variables is important. It is a single pass and sort order for _ or blank can be different between Win_7 and Win_10.
A lot of program installs (eg Adobe, Java and FTN95) modify the PATH and other variables, so they need to be checked after install.

2) the other method I use is in a .bat file by using SET var=... then referencing via %var%. I find this very useful for controlling program builds and running programs. I can generate days of runs with a hierarchy of .bat files.

I do not modify directly via the registry, as I am not familiar with this and the other options work for me. (If you have examples of this approach I would be interested)

My approach came from having multiple compilers and multiple versions installed and by using a set of environment variables, I can easily change versions or install alternatives.

For FTN95 I have:

set f95.ver=8.40F

set f95_dir=C:\Program Files (x86)\Silverfrost\ftn95_%f95.ver%
set f95include=%f95_dir%\include
set mod_path=%f95_dir%\include
set f95_path=%f95_dir%

For gFortran (and to overcome variable order problems) I have:

set _gcc.ver=8.3.0
set _gcc_dir=C:\Program Files (x86)\gcc_eq\gcc_%_gcc.ver%

set gcc_path=%_gcc_dir%\bin;%_gcc_dir%\libexec\gcc\x86_64-w64-mingw32\%_gcc.ver%
set EQ_LIBRARY_PATH=%_gcc_dir%\x86_64-w64-mingw32\lib

set gcc.ver=%_gcc.ver%
set gcc_dir=%_gcc_dir%

By just changing f95.ver or _gcc.ver in approach 1, I can change the default compiler for all cmd.exe boxes or Plato.

I also have PROCESSOR_DESCRIPTION as an environment variable, as environment variables are much easier to access in Fortran than using the registry

(I have all these variables as pre-defined in approach 1 above)
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Wed Nov 13, 2019 9:27 am    Post subject: Reply with quote

that's one great summary, thanks for sharing your experience JohnC.

in particular, your comment about the importance of order is interesting, and unseen on my forageing around the google-shere, and may have something to do with the problem I'm encountering, I'll check it out.

btw, hope you're in no danger from the wildfires wherever you are stationed in Sydney, hopefully not in what's being constantly being referred to by the BBC as the 'at risk' zone on the outskirts. They kep saying 'the worst is yet to come', here's hoping for a sudden drop in the aussie winds
_________________
''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... Smile "
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Thu Nov 14, 2019 11:45 pm    Post subject: Reply with quote

John,

Thanks for your comments about the fires. I am in suburban Sydney, away from national parks, so not directly affected by fires. At the moment, you have to check fire conditions along the highways before driving to other cities; new local knowledge for tourists, apart from snakes/fires in the bush and swimming between the flags !! ( forget about sharks, all tourists to Australia should do a training course on how to swim at the beach )
The major problem is the low rainfall / drought in most of Australia, so most areas are unusually dry and there is a lot of very dry fuel source. Fires are only in a few areas but most of Australia is unusually dry and everyone is aware of the increased risk and the consequences of a fire ignition. Fires can travel very fast with a strong breeze.
There have been complaints about lack of burn-off prior to the start of the fire season, but this year the fire season has started early and you can't really burn the whole of Australia in early spring. We need some rain !
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Fri Nov 15, 2019 9:53 am    Post subject: Reply with quote

In our place in California which lately is suffering from the grass fires we got saved probably by the nearby farmer who has cows which took almost all the grass on the hills.

There exist environmentally protected areas though where you can not touch the grass except 10 feet from the home fence. Allowed only to cut this grass and the low lying branches of the trees and just hope this kind of fury will not touch us. On the hills the most danger is associated with the winds more than 30-40 miles per hours. When fires start the smell is everywhere in California.

Fun is i have cameras with smog and fire detection and usual smog detectors everywhere inside the house. Totally probably 20 of them. I thought they will give us a warning if outside fire and smog will come close. But recently cooking something in the stove i completely forgot about it and fell asleep. 3-4 hours later our cat gave me a warning that the terrible thick smog is in the house. But not a single, not a single camera or detector gave any warning!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
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


Powered by phpBB © 2001, 2005 phpBB Group