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 

print special characters
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
LitusSaxonicum



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

PostPosted: Sat Jun 09, 2012 4:40 pm    Post subject: Reply with quote

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
View user's profile Send private message
DanRRight



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

PostPosted: Sun Jun 10, 2012 3:36 am    Post subject: Reply with quote

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 Smile. 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 Smile

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 ? Smile

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7924
Location: Salford, UK

PostPosted: Sun Jun 10, 2012 8:54 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Mon Jun 11, 2012 5:06 am    Post subject: Reply with quote

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
View user's profile Send private message
DanRRight



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

PostPosted: Thu Jun 28, 2012 1:09 am    Post subject: Reply with quote

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
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
Goto page Previous  1, 2
Page 2 of 2

 
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