soccer jersey forums.silverfrost.com :: View topic - Problems with %ss
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 

Problems with %ss

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: D�sseldorf, Germany

PostPosted: Wed Dec 05, 2012 10:05 am    Post subject: Problems with %ss Reply with quote

I tried to use the %ss option to save/restore settings from an INI file. If possible, please try the following (fixed format):

Code:
      program test

      IMPLICIT NONE
      INCLUDE <WINDOWS.INS>

      integer*4      j,A,B,C,D,E,F
      character*120  ifile,ofile

      ifile = ' '
      ofile = 'result'

      A = 0
      B = 1
      C = 0
      D = 0
      E = 1
      F = 0

      j = winio@('%ss[setup/start]&',1)

      j = winio@('%ca[Interpolation]%sy[3d_thin]%fn[MS SANS SERIF]%ts'
     *    //'%ob[named_l][Input image]%40rs%cb%ff%nl%ob[named_l][Para'
     *    //'meters]%3ga%rb[project limits]   %rb[actual model]   %rb'
     *    //'[all models]%ff%nlFilter%3ga  %rb[none]  %rb[mean]  %rb'
     *    //'[median]%cb%ff%nl%ob[named_l][Output image]%40rs%cb%ff%nl'
     *    //'%cn%`7bt[OK]%^7bt[Cancel]',
     *    .96D0,ifile,D,E,F,D,E,F,A,B,C,A,B,C,ofile,'EXIT')

      print*,A,B,C,D,E,F

      end


Start the small test programme and click onto "actual model" and "mean". Then start the programme again - now the options "all model" and "median" are selected. Don't know why ....

Regards - Wilfried
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Wed Dec 05, 2012 3:06 pm    Post subject: Reply with quote

Wilfred,
It is not as easy as that because only %rs, %rd & %rf formats can be used, despite the %rb appearing to work.
Here is a bit of code that does work, but it is a bit longwinded.
Code:
      winapp
      program test

      IMPLICIT NONE
      INCLUDE <WINDOWS.INS>

      integer*4      j,A,B,C,D,E,F,isave
      integer*4      jA,jB,jC,jD,jE,jF
      common/save_data/A,B,C,D,E,F,jA,jB,jC,jD,jE,jF,isave
      character*120  ifile,ofile
      external iclose,jsave

      ifile = ' '
      ofile = 'result'

      A = 0
      B = 1
      C = 0
      D = 0
      E = 1
      F = 0

      isave = 0

c
c read old via a disappearing window
      j = winio@('%ss[setup/start]&',isave)
      j = winio@('Image%rs&',ifile)
      j = winio@('%ffProject%rdCurrent%rdAll%rd&',D,E,F)
      j = winio@('%ffNone%rdMean%rdMedian%rd&',A,B,C)
      j = winio@('%ffOutput%rs&',ofile)
      j = winio@('%sc',iclose)

      print *,'D,E,F,A,B,C read from file'
      print*,D,E,F,A,B,C

      ja = a
      jb = b
      jc = c
      jd = d
      je = e
      jf = f
     

c
c display options for changes to be made
      j = winio@('%ca[Interpolation]%sy[3d_thin]%fn[MS SANS SERIF]%ts'
     *    //'%ob[named_l][Input image]'
     *    //'Image%40rs%cb%ff%nl%ob[named_l][Parameters]&',.96D0,ifile)
      j = winio@('%3ga&',jD,jE,jF)
      j = winio@('Limits%ta%rb[Project] '
     *    //'%ta%rb[Current] '
     *    //'%ta%rb[All]&',jD,jE,jF)
      j = winio@('%ff%nlFilter%3ga&',jA,jB,jC)
      j = winio@('%ta%rb[None]'
     *    //'%ta%rb[Mean]'
     *    //'%ta%rb[Median]%cb&',jA,jB,jC)
      j = winio@('%ff%nl%ob[named_l][Output image]'
     *    //'Output%40rs%cb&',ofile)
      j = winio@('%ff%nl%cn%`7bt[OK]%^7bt[Cancel]','EXIT')

      print *,'D,E,F,A,B,C as updated'
      print*,jD,jE,jF,jA,jB,jC

c
c save new via a disappearing window which exists briefly but is invisible
      isave = 1
      j = winio@('%ww[invisible]&')
      j = winio@('%ss[setup/start]&',isave)
      j = winio@('Image%rs&',ifile)
      j = winio@('%ffProject%rdCurrent%rdAll%rd&',D,E,F)
      j = winio@('%ffNone%rdMean%rdMedian%rd&',A,B,C)
      j = winio@('%ffOutput%rs&',ofile)
      j = winio@('%sc%dl',jsave,0.1d0,iclose)
     

      print*,D,E,F,A,B,C

      end

     
      integer*4 function iclose()
      iclose = 0
      end

      integer*4 function jsave()

      integer*4      A,B,C,D,E,F,isave
      integer*4      jA,jB,jC,jD,jE,jF
      common/save_data/A,B,C,D,E,F,jA,jB,jC,jD,jE,jF,isave
      jsave = 1
      if(isave .eq. 1)then
        a = ja
        b = jb
        c = jc
        d = jd
        e = je
        f = jf

      endif
      end

It also appers that spaces are not removed from the %rb format codes. It is necessary to have some text before your %rs codes. It might also be a good idea to call the file something other than "Setup" as this is a very common name and you might conflict with something else which already exists.
Regards
Ian
Back to top
View user's profile Send private message Send e-mail
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: D�sseldorf, Germany

PostPosted: Wed Dec 05, 2012 4:40 pm    Post subject: Reply with quote

Thank you very much, Ian! Now I understand a bit more about %ss, and I think that I will not use it. Before testing that option, I used my own parameter files, and that gives more and better handling capabilities without longwinded workaround.

Regards - Wilfried
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2393
Location: Yateley, Hants, UK

PostPosted: Thu Dec 06, 2012 12:49 am    Post subject: Reply with quote

Wilfried,
I came to a similar conclusion myself. One or two things in Clearwin do seem a little primitive.
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Thu Dec 06, 2012 1:29 pm    Post subject: Reply with quote

Yes, and I understand a little more about it now as well. It is a shame that it can't place the set up files somewhere othere than in the C:\windows directory.
I wrote my own system years ago but if it worked and had options then who knows? (Rhetorical question!)
Ian
Back to top
View user's profile Send private message Send e-mail
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2393
Location: Yateley, Hants, UK

PostPosted: Thu Dec 06, 2012 3:43 pm    Post subject: Reply with quote

To both Ian and Wilfried,

Using an INI file (or whatever you want to call it) is an extremely logical and simple way of making various user-specified settings remain persistent between invocations of the program. If you follow the old Windows way of making these settings, the INI file was a 'plain text' file, with blocks labelled inside square brackets, with the settings themselves almost like a Namelist, e.g.

[Colours]
Boxes=blue
Lines=3

etc

Writing such a thing is simplicity itself with format statements, but when reading it, you have to be a bit careful as a user might edit the file, introducing (at the very least) some extra spaces, but sometimes re-ordering the entries, and in the worst case, providing invalid parameters or misspelled parameter names. Then you have to carefully parse each line, and respond sensibly to potential errors (including what to do if there is no INI file). INI files are best kept in your default application directory, and you can find what this is by calling GET_PROGRAM_NAME@ and chopping off the .EXE from the end, plus all the characters back to the first '\'.

Some Windows versions ago, the INI file appears to have gone out of favour, and user settings are now stored in the appropriate place in the Registry. Despite misgivings on the part of people like me who swore that the Registry would prove unstable, it all seems to work OK. The downside as far as I am concerned is that I have a great deal of confidence that if I experimented with writing to the Registry, I should almost certainly end up corrupting it! As a result, I read and write my own INI files still.

Eddie
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Thu Dec 06, 2012 9:52 pm    Post subject: Reply with quote

I usually read initial data using regular file OPEN/CLOSE with the characteristic name/extension (very many of them are used for something specific) before starting Clearwin window and save same data with OPEN/CLOSE at the beginning of a callback which is doing calculations every time i do anything within Clearwin.

Surprised that Win7 allowed %ss so easily save anything inside its C:\WINDOWS
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2393
Location: Yateley, Hants, UK

PostPosted: Fri Dec 07, 2012 11:09 am    Post subject: Reply with quote

Dan,

Surely that's the basic dataset for your application, and that definitely is a matter for OPEN/CLOSE and appropriate timing of when you do it. I should be interested to hear how you manage UNDO in the sequence you describe. (I always struggle with UNDO).
The point of an INI file is for user settings for the program (such as colours and fonts etc), and for that matter, the most-recently-used filenames.
However, the fact remains that for quite a while, INI files have been 'deprecated' and editing the registry has been 'preferred' by the Lords of Microsoft .... (tough on us poor mortals with a background in something other than computer science).

Eddie
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Fri Dec 07, 2012 6:23 pm    Post subject: Reply with quote

As computers support multiple users, the .ini file should not be store in the C:\windows directory as this only caters for one setup. The current user's application data would be a better place.
Ian
Back to top
View user's profile Send private message Send e-mail
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2393
Location: Yateley, Hants, UK

PostPosted: Fri Dec 07, 2012 7:00 pm    Post subject: Reply with quote

Also the program directory as a home for the INI file also only covers one setup.

However, the 'P' in 'PC' is 'personal', and everyone should have their own. This 'multiple users' thing is too promiscuous for me ...

Eddie
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Fri Dec 07, 2012 8:13 pm    Post subject: Reply with quote

Eddie,
That would be OK in an ideal world, but commercial companies and families minimise costs and PCs can be shared or transferred. Windows supports it and therefore so should SilverFrost, even if it is an option. When installing FTN95, the option is available for just one user or all users,so it is already acknowledged.
To have the option and not use it is better than not having the option.
It would be good to be allowed to choose how each .ini file is treated. There are directories already for individual users and all users and the %ss is a good concept but really only partially implemented. How about options such as:
winio@('%ss[filename/section][all_users]',ctrl)
winio@(%ss[filename/section][current_user]',ctrl)
winio@('%ss[filename/section][path]',ctrl,path)

This would store things in directories such as:
C:\Users\Ian\AppData\Local
or
C:\Users\Ian\AppData\Roaming
and within a specified sub directory of these relating to the program or the software house.

Additional options might be:
winio@(%ss[filename/section][all_users|current_user|path|start_in,roaming|local,purpose]',ctrl,path,purpose)
where "roaming" cannot be specified for "all_users", "path" or "start_in", the default being "local" in that case.
"purpose" would specify the sub-directory to be added to path or the directory structure defined as implied above.
Regards
Ian
PS Of course XP and Vista/7 use different directory structures for this purpose, but that should not be too difficult to achieve.
Back to top
View user's profile Send private message Send e-mail
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2393
Location: Yateley, Hants, UK

PostPosted: Fri Dec 07, 2012 9:05 pm    Post subject: Reply with quote

Ian,

You are taking me far more seriously than I intended (or deserve) in this particular case.

I agree that as implemented, %ss is rather minimal (although your post made me go and look at %ss again, and there is more to it than I remembered). Some of your options look interesting and useful. However, the big downside for me is that the parameters are specified as (%rd, %rf, %rs) and this means that a user could specify a parameter that was invalid - so a whole bunch of checks would be needed. %ls seemed a more sensible option, and would reduce the amount of checking needed. Also, all the parameters are needed in much the same place.

Eddie
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Sun Dec 09, 2012 6:02 am    Post subject: Reply with quote

Eddie,
Multiple UNDOs when you just sit and hit Ctrl-Z or back button are not implemented, in my case i'd die under complexity of that keeping track of 100s of settings in database-like manner... I can undo almost automatically only latest thing because previous is always saved in tmp file. This simple way can be a bit modernized by keeping ALL the changes in temporal files with automatic name change. So far I only done that for picture files and some othe minor things. For all other cases if i feel that this temporal variant i am working right now could be interesting i click Ctrl+S or do that via Menu and save it with comments into separate file with long long name containing this comment. That gives me simple way not to deal with databases or huge mess in the directory. The beauty of Windows GUI with Clearwin is that it always looks for these files (by their specific extensions) and lists them on the top of my working desktop. So, returning back to bookmarked this way variants is just one click away.

This idea was beautified further with CLearwin graphical ListView threads formations where you by mouse or keywords with minimal typing open new level in the sheet for something which you found important. With time this should become your world, your work tree with the branches to different directions of your research. Something resembling folder structure




As you can see this is much better then sumple UNDO. You could UNDO graphically into whatever you have done 4 or 20 years ago including wrong or dead end previous branches which you will find by some reason useful again - and do that just with the mouse clicks.
But this was not finished because when i was doing that Clearwin/FTN95 were buggy and crashed at some my introduced errors without comments so i gave up to find why. Now i found the bugs but lost interest - it is still very complex, and Clearwin can take not days or months or even years but DECADES of your life for improvements of the look and feel of your code
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 -> ClearWin+ 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