openstandards
Nick Demou
ndemou at gmail.com
Thu Jul 19 17:54:17 EEST 2007
On 7/19/07, Christos Ricudis <ricudis at komodino.itc.auth.gr> wrote:
> Nick Demou wrote:
> [...]
> >
> > [off topic note] να σημειώσω πως το opensource δεν συνεπάγεται μεν
> > ακριβώς open standard αλλά είναι αρκετά κοντά: το καλύτερο
> > documentation είναι ο κώδικας όπως λένε.
>
> O kwdikas den einai *POTE* to kalytero documentation.
>
> [...]
όπα - όπα πήρες φόρα χωρίς λόγο. Συμφωνώ μαζί σου. Γιαυτό γράφω "ΔΕΝ
συνεπάγεται μεν αλλά είναι αρκετά ΚΟΝΤΑ" (και ίσως και το αρκετά να
είναι υπερβολικό). Αν πίστευα ότι ο κώδικάς είναι επαρκές
documentation δεν θα ήμουν τόσο μετριοπαθής. Απλά από το τίποτα είναι
σαφώς προτιμότερο να έχεις τουλάχιστον την υλοποίηση σε μορφή πηγαίου
κώδικα.
Η ατάκα "το καλύτερο documentation είναι ο κώδικας" συμπεριλήφθηκε
-κακώς- επειδή είναι διάσημη.
Για να με πιστέψεις ορίστε και ένα απόσπασμα απο κώδικα που έχω
γράψει. Aν πίστευα ότι ο κώδικας είναι επαρκές documentation δεν θα
ήταν έτσι:
/*
PART OF THE MAIN LOOP:
WHAT TO DO IN IF MOTOR SHOULD BE MOVING
i.e. this code is executed
either while the motor is moving
or if the motor is currently stoped but should just start
*/
IF I_ATLEVEL = 0 AND ((I_TOP = 0 AND goingUP) OR (I_BOTTOM = 0
AND goingUP = 0)) THEN DO;
/* Big-Fucking ERROR!!!, wants to start going off limits */
DoERR 21 ERROR;/* anounce ERROR! Was to crash! */
goingUP = NOT(goingUP); /* corect direction */
SLOW=0; /* make sure to start at high speed */
/* corect position ...: */
IF I_TOP = 0 THEN POS8 = shl(maxLEVELcode,3); ELSE POS8 = 0;
disable; intPOS8 = POS8; MidlePoint = 0; IntMP = 0; enable;
/* why do i reset SLOW? well that's why:
supose that a passanger presses stop while aproching
the upper limit with slow speed and that the elev.
stops just upon the limit switch. After the stop is
released the elev. will try to continue going up but
then this code will determine that it's going off
limits and will switch the direction. the elev should
now go down for about one level distance with slow
speed (because the speed information is preserved
durring the stop phase).
That wouldn't be good at all! */
ENDIF;
ENDIF; /* motor has just started */
/* control outputs so that the motor runs at proper direction - speed */
IF I_ATLEVEL=0 and SLOW THEN DO;
/* [το σχόλιο που ακολουθεί αφορά την παραπάνω και μόνο γραμμή]
A level stop was reached while going with low speed,so WE MUST STOP
1) in most situations we just set ReachedLevel flag
in order to stop imidiately
2) but if going up and TupHold is not 0 we setup timerup,
(if we haven't allready done so*) in order to stop after a while
(*:
this section of code will be executed many times until motorisrolling
will turn FALSE and that is why we check if TimerUp is 0. The 1st
time I_ATLEVEL is detected to be LOW TimerUp will surely be 0
so we load it and wait for it to get 0 again. All following times
that this code executes it will find TimerUp<>0 and will not reload it
There is however the possiblity that it will execute just after
the timer interupt has executed and turned TimerUp to 0. This is not
critical because ReachedLevel would also have been set so the code
following next will surely execute, stop the motor and clear TimerUp
)
*/
[...]
More information about the Linux-greek-users
mailing list