|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Sat Jun 09, 2012 4:40 pm Post subject: |
|
|
Dan,
As always, food for thought. There is no end to it. For example, %ew is not really "exit Windows" it is in fact "execute this callback if the user exits Windows", or %etcbituew". Perhaps I just prefer the shorter form.
Just because you can do something doesn't mean that you should, or must, do it. A certain amount of pain has convinced me not to put too many Clearwin format codes in a single WINIO@ call. My rule is not more than one code that has a callback and/or grey code, but any number of %ff and %nl are OK. For controls that need qualifying (spinwheels etc) the codes for that can go in too. This simplifies putting in comments, which are an important part of programming.
For repetitive things such as setting background colours, etc, I put the WINIO@s in a subroutine. Finding that the WINIO@ calls could be spread over several subroutines was an early revelation to me. When creating a main window, I also have subroutines for the menu construction, the toolbars, any graphics area, startup and closedown. In the menu subroutine for example, the only format code is %mn, so it isn't very difficult to work out what it does in a subroutine called "BUILD_MENUS". This approach does require SAVE in each associated routine.
Some format codes are hardly memorable because they are only called once per program (e.g. %ew). But, in a routine called CLOSEDOWN_ACTIONS, containing only %cc and %ew, they aren't difficult to remember. (Same for STARTUP_ACTIONS with %sc and %dr etc).
Eddie |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2819 Location: South Pole, Antarctica
|
Posted: Sun Jun 10, 2012 3:36 am Post subject: |
|
|
Well, i see why you oppose, because you've already made steps to be more verbose then CWP is. I sometimes do program same way like you but mostly like in this example above, because my code i develop and improve 30+ yeas is already barely manageable. Alas all people are different as we know if you ever borrowed the notes of lessons from your university classmates. Paul was probably using shorthand at his time . For me these two-letter CWP codes are difficult in the sense that i always expect large field of possible decryptions - complication also comes if English was not your first language and you are using almost all possible CWP codes
And ultimately how many people would be here if our Fortran commands looked like this
CJ for CONJG
CN for COMMON
CE for Continue etc.etc.etc
CH
CL
CM
DA
DM
DO
DT
EQ
ED
EX
FL
FN
GO
IF
IM
IN
IX
LG
LN
MA
MI
ML
MV
ML
MO
OP
PG
PR
PS
RD
RL
RA
SB
SI
SQ
ST
TA
TH
WH
WR
and programmers always guessing:
RD is Real*8 or Read ?
PR - PARAMETER, PRINT or POINTER ?
FL - Float or Forall ?
MV - is MaxVal or MinVal ?
CO - CONTINUE, CONTAINS or CONJG ?
AB - ABS or ABORT ?
If seriously - the two-letter CWP codes was a good experiment. And i will tell you i love it. But as CWP matures its syntax should be changed to offer less cryptic language ideally keeping compatibility with the older one. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Sun Jun 10, 2012 8:54 am Post subject: |
|
|
Historical note: I did not design or write the original ClearWin+. However the format codes do make sense as an extension of the C function printf. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2819 Location: South Pole, Antarctica
|
Posted: Mon Jun 11, 2012 5:06 am Post subject: |
|
|
5% probably do, which with time will go to 0.5% as soon as all 26x26 symbols will be used. Also i'd not use word "extensions", because even C printf is much more verbose then CWP, the "shortcuts" or "abbreviations" are better words. They have some roots deep in the English language but generally they are just the two-letter codes, the words of lower level then anything ever existed before computer language. When you see C printf or Fortran WRITE even if you do not know language you do not need your brain translator
printf ("Float number: %F", pricetag);
write(*,'(F6.2)') pricetag
But let's those who do not know Clearwin+ tell even looking into manual which one below (or none of them) is used for the same purpose. Those who know CWP can also try to count the time they will need to decrypt.
i=winio@('Float number: %fl', pricetag)
i=winio@('Float number: %rf', pricetag)
i=winio@('Float number: %ps', pricetag)
i=winio@('Float number: %re', pricetag)
i=winio@('Float number: %gf', pricetag
i=winio@('Float number: %ft',pricetag
i=winio@('Float number: %if',pricetag |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2819 Location: South Pole, Antarctica
|
Posted: Thu Jun 28, 2012 1:09 am Post subject: |
|
|
Just for curious hopeless users the answer is
i=winio@('Float number: %rf', pricetag)
Surprised? By the way works even better then %wf allowing dynamic change with window_update@ .
/* Yea, we need more users of this compiler. |
|
Back to top |
|
|
|
|
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
|