Re: Style guide for IDL? [message #31775 is a reply to message #31770] |
Tue, 20 August 2002 11:42   |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Tue, 20 Aug 2002 07:49:36 -0700, David Fanning wrote:
> Andrew Nesbit (alnesbit@optushome.com.au) writes:
>
>> K&R style is arguably the most widely-seen coding style for C source
>> code. In an analogous way, does there exist some "standard" way of
>> writing IDL, and if so, where can I find descriptions/examples of it?
>
> The IDL Expert Programmer's Association commissioned a study on this
> very topic several years ago, and the general meeting we held to discuss
> the issue was the most explosive in memory. (The ballroom had to have
> extensive repairs and a complete paint job, as I recall.)
>
> There were at least 25 different opinions from the 15 members in
> attendance, although the group could generally be divided between the
> damned lowercase fraction and the mixed-case fraction. (The ALLCAPS
> people were banished to the bar at the start of the meeting and didn't
> really cause any problems the rest of the day!)
>
> In the end, we issued a report that said, in essence, "whatever works".
> It was the most disappointed I have ever been with the EPA, because, of
> course, I am a firm believer in the Coyote Way. :-(
>
> Cheers,
>
> David
>
> P.S. Let's just say I am currently working in a collaborative effort
> with one of those damned lowercase people and he is DRIVING ME CRAZY!!!
As one who is equally offended by the LOUD, PACKED WITH EXTRA
UPPERCASE CHARACTERS, AND TANTAMOUNT TO SHOUTING AT THE READER style
certain purveyors of the so-called truth are peddling, allow me to
present as postscript two exhibits for your consideration. For the
record, my ANSI-like preferences are automatically enabled using the
following settings with IDLWAVE:
idlwave-block-indent 3 ; Proper Indentation settings
;; Any self-respecting programmer indents his main block
idlwave-main-block-indent 2
idlwave-end-offset -3
idlwave-continuation-indent 3
idlwave-reserved-word-upcase nil ; Don't UPPERCASE reserved words
font-lock-maximum-decoration 3
Keywords, strings and other syntax elements should be set apart from
the main body of text with color, not with LOUD UPPERCASE EMPHASIS
WHICH REMINDS ME OF THE KIND OF EMAILS MY GRANDDAD USED TO SEND BEFORE
HE REALIZED HOW RUDE IT IS. For full effect, load these texts into a
colorizing editor like Emacs/IDLWAVE or the IDLDE.
JD
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++
FUNCTION FSC_PLOTWINDOW::InTarget, x, y, DIRECTION=direction
; Given a location of the cursor in the window returns the
; target location and the direction the window should be
; resized in. Have to be within 10% of window edge to be
; in moveable target.
IF xtest EQ 1 AND ytest EQ 1 THEN BEGIN
retVal = 'MOVE'
direction = 'MOVE'
ENDIF
IF xtest EQ 1 AND ytest EQ 2 THEN BEGIN
retVal = 'SIZE_NS'
direction = 'N'
ENDIF
IF xtest EQ 2 AND ytest EQ 0 THEN BEGIN
retVal = 'SIZE_SE'
direction = 'SE'
ENDIF
IF xtest EQ 2 AND ytest EQ 1 THEN BEGIN
retVal = 'SIZE_EW'
direction = 'E'
ENDIF
IF xtest EQ 2 AND ytest EQ 2 THEN BEGIN
retVal = 'SIZE_NE'
direction = 'NE'
ENDIF
alphaImage = Obj_New('IDLgrImage', alpha_image, $
Dimensions=[400,400], Interleave=0, $
Blend_Func=[3,4])
RETURN, retVal
END ;----------------------------------------------------------- -----------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++
vs.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++
function FSC_PlotWindow::InTarget, x, y, DIRECTION=direction
;; Given a location of the cursor in the window returns the
;; target location and the direction the window should be
;; resized in. Have to be within 10% of window edge to be
;; in moveable target.
if xtest EQ 1 AND ytest EQ 1 then begin
retVal='MOVE'
direction='MOVE'
endif
if xtest EQ 1 AND ytest EQ 2 then begin
retVal='SIZE_NS'
direction='N'
endif
if xtest EQ 2 AND ytest EQ 0 then begin
retVal='SIZE_SE'
direction='SE'
endif
if xtest EQ 2 AND ytest EQ 1 then begin
retVal='SIZE_EW'
direction='E'
endif
if xtest EQ 2 AND ytest EQ 2 then begin
retVal='SIZE_NE'
direction='NE'
endif
alphaImage=Obj_New('IDLgrImage', alpha_image, $
Dimensions=[400,400], Interleave=0, $
Blend_Func=[3,4])
return,retVal
end
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++
|
|
|