Searching \ for '[PIC]: coding style' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'coding style'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: coding style'
2002\06\18@035109 by Guillermo Rodriguez Garcia

flavicon
face
Hi all,

This may be a dumb question, but is there something like an
official coding style guide or so?

I mean, conventions on how to name variables, labels, etc.
(mixed uppercase, all lowercase with underscores, etc etc)

Thanks,
G.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\06\18@083024 by Olin Lathrop

face picon face
> This may be a dumb question, but is there something like an
> official coding style guide or so?

No.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\06\18@083432 by Tim McDonough

flavicon
face
On Tue, 18 Jun 2002 09:54:54 +0200, Guillermo Rodriguez Garcia wrote:

>This may be a dumb question, but is there something like an official
>coding style guide or so?
>
>I mean, conventions on how to name variables, labels, etc.
>(mixed uppercase, all lowercase with underscores, etc etc)

There's not any one single standard. Coding style is often a hotly
debated topic among programmers, maybe as much or more as which
programming language to use!

Jack Ganssle has an article on his web site regarding programming
conventions. I'm not saying it's perfect but it's an example of how
some people do things.

http://www.ganssle.com/articles.htm

The best advice is probably to develop a style that is understandable
to you and stick with it.

Tim

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\06\18@084057 by Erik Jacobs

flavicon
face
> > This may be a dumb question, but is there something like an
> > official coding style guide or so?

It depends.  If you are writing a PIC application for a large company and
you will be sending your source around, then the company itself may have
certain standards.  If you are writing in C and compiling to PIC, then you
should just follow C guidelines, which I'm sure there are scores of.  If
you're writing code for yourself and your own private projects, I wouldn't
think it matters at all.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\06\18@100132 by Guillermo Rodriguez Garcia

flavicon
face
At 07:27 18/06/2002 -0500, Tim McDonough wrote:
>On Tue, 18 Jun 2002 09:54:54 +0200, Guillermo Rodriguez Garcia wrote:
>
> >This may be a dumb question, but is there something like an official
> >coding style guide or so?
> >
> >I mean, conventions on how to name variables, labels, etc.
> >(mixed uppercase, all lowercase with underscores, etc etc)
>
>There's not any one single standard. Coding style is often a hotly
>debated topic among programmers, maybe as much or more as which
>programming language to use!
>
>Jack Ganssle has an article on his web site regarding programming
>conventions. I'm not saying it's perfect but it's an example of how
>some people do things.
>
>http://www.ganssle.com/articles.htm

That looks interesting (I guess you refer to fsm.doc) but it
doesn't cover PIC assembler, which is what I was after.

Thanks anyway,
G.


>The best advice is probably to develop a style that is understandable
>to you and stick with it.
>
>Tim
>
>--
>http://www.piclist.com hint: The PICList is archived three different
>ways.  See http://www.piclist.com/#archives for details.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\06\18@100139 by Guillermo Rodriguez Garcia

flavicon
face
At 08:40 18/06/2002 -0400, Erik Jacobs wrote:
> > > This may be a dumb question, but is there something like an
> > > official coding style guide or so?
>
>It depends.  If you are writing a PIC application for a large company and
>you will be sending your source around, then the company itself may have
>certain standards.

I'm writing PIC assembler for a small company (for which I work) but
we don't still have a coding standard for assembler. We do have one
for Java, and another one for C[/C++], but none for PIC assembler yet :)

Thanks anyway,
G.

>   If you are writing in C and compiling to PIC, then you
>should just follow C guidelines, which I'm sure there are scores of.  If
>you're writing code for yourself and your own private projects, I wouldn't
>think it matters at all.
>
>--
>http://www.piclist.com hint: The PICList is archived three different
>ways.  See http://www.piclist.com/#archives for details.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\06\18@101817 by Lawrence Lile

flavicon
face
part 1 1227 bytes content-type:text/plain; (decoded 7bit)

There IS an absolute, final authoritative style guide, written by one of the
most highly recognized, authoritative, obfuscatory and prevaricative experts
in the field, myself  (emphasis on the prevaricative title)  ;-)   It's
small enough to attach.

Seriously, a few searches should turn up a lot of opinions, mostly
conflicting, on C style.

--Lawrence

{Original Message removed}
part 2 3818 bytes content-type:application/x-zip-compressed; (decode)

part 3 131 bytes
--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\06\18@102913 by Jochen Feldhaar

flavicon
face
Hi Lawrence,

I printed it out the last time it was on the list.
Been pinned to my office wall ever since.
Although words like "obfusticated" tend to "obfusticate" the lecture, it
is still a good guide!

Jochen Feldhaar DH6FAZ

Lawrence Lile schrieb:
{Quote hidden}

> {Original Message removed}

2002\06\18@113107 by uter van ooijen & floortje hanneman

picon face
> This may be a dumb question, but is there something like an
> official coding style guide or so?

Of course there are such guides, which one do you want?

;) Wouter

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\06\18@122553 by Guillermo Rodriguez Garcia

flavicon
face
At 05:07 18/06/2002 +0200, wouter van ooijen & floortje hanneman wrote:
> > This may be a dumb question, but is there something like an
> > official coding style guide or so?
>
>Of course there are such guides, which one do you want?

One that helps ? :)


>;) Wouter
>
>--
>http://www.piclist.com hint: The PICList is archived three different
>ways.  See http://www.piclist.com/#archives for details.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\06\18@132303 by uter van ooijen & floortje hanneman

picon face
> One that helps ? :)

Insufficient specification. Helps in which direction? Obfusciation,
readability, compilation speed, readability for non-cumpter geeks (try
cobol!), small source files, ....

;) Wouter

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\06\18@140923 by jamesnewton

face picon face
source= http://www.piclist.com/postbot.asp?id=piclist\2002\06\18\035109a

The wonderful thing about standards is that there are so many to choose
from... <GRIN>

I personally try to use all lower case for keywords, Underscores in
variables, All uppercase for defines or constants.

Type of variable as first part of variable name, Since labels are variable
of type "address" I try to use "at" or "a" as the first letter of labels,
but they also denote the start of functions or procedures so sometimes I use
"f" or "p" or even "s" or "sub."

Actually, when I'm writing code for someone else, I try to find out what
language standards they follow. If the boss knows asm I try to get a look at
his code, If he or she knows Pascal I use that style, if it's BASIC
(shudder) I use that style. I even define macros to make some of the more
obvious commands match the "language" I'm trying to look like. Macros are
great for making code easy to understand.... if the macros make sense.

And as Olin will probably say, comments are the best coding style. I don't
comment every single line, but I write the program in pseudo code comments
first and then "compile" each comment line into the ASM code that does what
the comment says. No more than a few lines of ASM per line of comments. The
tricky part is not changing the ASM code without updating the comments. I
also keep a log of the design decisions at the start of the file with the
date and what we were thinking at that point.

---
James Newton: PICList.com webmaster, former Admin #3
spam_OUTjamesnewtonTakeThisOuTspampiclist.com  1-619-652-0593 phone
http://www.piclist.com/member/JMN-EFP-786
PIC/PICList FAQ: http://www.piclist.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\06\18@153618 by Guillermo Rodriguez Garcia

flavicon
face
At 07:07 18/06/2002 +0200, wouter van ooijen & floortje hanneman wrote:
> > One that helps ? :)
>
>Insufficient specification. Helps in which direction? Obfusciation,
>readability, compilation speed, readability for non-cumpter geeks (try
>cobol!), small source files, ....

Readability and maintainability, anti-obfuscation, don't care about
compilation speed or size source files.

Better now? :)

G.


>;) Wouter
>
>--
>http://www.piclist.com hint: The PICList is archived three different
>ways.  See http://www.piclist.com/#archives for details.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\06\18@183932 by Guillermo Rodriguez Garcia

flavicon
face
James,

Thanks a lot! This is the kind of advice I was after :)

At 11:05 18/06/2002 -0700, James Newton. Admin 3 wrote:
>The wonderful thing about standards is that there are so many to choose
>from... <GRIN>

:))

>I personally try to use all lower case for keywords, Underscores in
>variables, All uppercase for defines or constants.
>
>Type of variable as first part of variable name, Since labels are variable
>of type "address" I try to use "at" or "a" as the first letter of labels,
>but they also denote the start of functions or procedures so sometimes I use
>"f" or "p" or even "s" or "sub."

At the end I think I'm going to adopt the following:

- only tabs, no spaces. 4-spaces per indentation level.

- one-character extra indentation for "bit-skip"-like operations.

- C-style all-lowercase names for variables, with underscores separating
  words:

  timestamp
  sigA_count
  sigA_time
  adc_ch1
  adc_ch2
  ...

- Same for 'higher-level' labels (i.e. function names or entry points
  for high-level blocks)

- Preceding underscore helps distinguish local labels within a function
  or block:

  _skip_hi
        [...]
  _skip_lo
        [...]

- All uppercase for constants:

  SPI_PACKET_LEN
  PROTOCOL_ID
  PROTOCOL_VERSION

- And of course all uppercase for PIC registers.


{Quote hidden}

Very good advice, thanks!

G.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\06\18@185315 by Lawrence Lile

flavicon
face
Here's a small addition to this (finally) serious list:

The first line of my C or ASM file is a title, with the name of the file.

Then the author, date, and purpose of the code

Next (as James Mentioned) is a series of comments identifying each revision
level and why the revision was made and by whom, for instance:

1    LL   1 Jun 2002        New Program
2    LL   2 Jun 2002        Found bug in rs232() function
3.   RW  3 jun  2002       Fixed bug introduce in fixing the last bug
4.   LL    4 jun 2002        Found another bug that was introduced in fixing
the second bug which fixed the first bug  etc. etc.

Each revision is saved in a separate file, in case I need to refer to it
later.  I save a revision each morning first thing before I work on any
code, and then every time I do anything that either 1. works or 2. took a
long time to code.

Then I always clearly identify all I/O points near the top of the file, and
keep this list up to date

// PORTB
#byte PORTB  = 0x06
#define  Relay    0        // Relay on RB0    etc. etc.

ASM files are usually commented with Pseudocode as well as clear
descrtiptions of what is trying to be accomplished

C files are more readable, so I just try to de-obfuscate the code a little.

--Lawrence

{Original Message removed}

2002\06\18@190801 by Scott Dattalo

face
flavicon
face
On Wed, 19 Jun 2002, Guillermo Rodriguez Garcia wrote:

<snip>

> At the end I think I'm going to adopt the following:

And now I think you'll see the opinions come spewing in from all angles...

> - only tabs, no spaces. 4-spaces per indentation level.

I personally prefer spaces and no tabs. Why? because there is no standard
tab spacing, but 8 is the most common. However, if you display your
4-space tabs as 8-space tabs, the document will look very messy. (Not to
mention, the piclist archive of your tabbed files will look horrible).

OTOH, If I know your files are formatted with tab equal to 8 spaces, I can
run expand/unexpand (unix utilities) to fix it.

Scott

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\06\18@191813 by Andrew Warren

flavicon
face
Lawrence Lile <.....PICLISTKILLspamspam@spam@mitvma.mit.edu> wrote:

> I always clearly identify all I/O points near the top of the file,
> and keep this list up to date
>
> // PORTB
> #byte PORTB  = 0x06
> #define  Relay    0        // Relay on RB0    etc. etc.

   ... and then, later in your code, you mistakenly write:

       BSF PORTA,Relay    ;Turn on the relay
       or
       PORTA.Relay = 1;   // Turn on the relay.

   You can eliminate this common source of errors by including the
   port name in your #define:

       #define Relay PORTB,0
       or
       #define Relay PORTB.0

   then:

       BSF Relay          ;Turn on the relay in assembly.
       or
       Relay = 1;         // Turn on the relay in C.

   -Andy

=== Andrew Warren -- aiwspamKILLspamcypress.com
=== Principal Design Engineer
=== Cypress Semiconductor Corporation
===
=== Opinions expressed above do not
=== necessarily represent those of
=== Cypress Semiconductor Corporation

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\06\19@043946 by Michael Rigby-Jones

flavicon
face
{Quote hidden}

Another one of those things that has arguments for and against I guess, but
I prefer tabs simply because it's so much faster to tidy up any indenting
and generaly moving the cursor around.  Any decent editor should let you set
the number of "spaces" per tab, although I would have to agree about the
archive problem.  8 space tabs are way too large IMO and make the program
messier rather than neater and easier to follow,  3 or 4 spaces seems a good
compromise.

Regards

Mike

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@050236 by Peter Tiang

flavicon
face
You can make use of the GNU indent tools to format
your C source file.

I personally use indent.exe with the following options:

indent -bap -bbb -bl -bli0 -bls -cbi0 -ci4 -cli4 -i4 -ip0 -lp -nbad -nbbo -n
bc -ncs -ncdb -nhnl -npcs -nprs -npsl -sob -ts4 %1

Rgds,
Peter

----- Original Message -----
From: "Michael Rigby-Jones" <@spam@mrjonesKILLspamspamNORTELNETWORKS.COM>
To: <KILLspamPICLISTKILLspamspamMITVMA.MIT.EDU>
Sent: Wednesday, June 19, 2002 4:39 PM
Subject: Re: [PIC]: coding style


> > {Original Message removed}

2002\06\19@055736 by Guillermo Rodriguez Garcia

flavicon
face
At 17:52 18/06/2002 -0500, Lawrence Lile wrote:
>Here's a small addition to this (finally) serious list:
>
>The first line of my C or ASM file is a title, with the name of the file.
>
>Then the author, date, and purpose of the code
>
>Next (as James Mentioned) is a series of comments identifying each revision
>level and why the revision was made and by whom, for instance:
>
>1    LL   1 Jun 2002        New Program
>2    LL   2 Jun 2002        Found bug in rs232() function
>3.   RW  3 jun  2002       Fixed bug introduce in fixing the last bug
>4.   LL    4 jun 2002        Found another bug that was introduced in fixing
>the second bug which fixed the first bug  etc. etc.
>
>Each revision is saved in a separate file, in case I need to refer to it
>later.  I save a revision each morning first thing before I work on any
>code, and then every time I do anything that either 1. works or 2. took a
>long time to code.

Well, all of the above is nicely managed by CVS automatically:
author, date, version history, etc. plus you can check out any
version from any date, etc.

If you don't already use CVS (or any other version control system)
I recommend to have a look, even if it is only to keep track of
changes in source code in a single machine.

Thanks!
G.

{Quote hidden}

>{Original Message removed}

2002\06\19@055750 by Guillermo Rodriguez Garcia

flavicon
face
At 16:07 18/06/2002 -0700, Scott Dattalo wrote:
>On Wed, 19 Jun 2002, Guillermo Rodriguez Garcia wrote:
>
><snip>
>
> > At the end I think I'm going to adopt the following:
>
>And now I think you'll see the opinions come spewing in from all angles...

That's what I wanted :))


> > - only tabs, no spaces. 4-spaces per indentation level.
>
>I personally prefer spaces and no tabs. Why? because there is no standard

In fact I made a mistake above. What I actually meant is only
spaces, no tabs. Tabs may look different according to the settings
everyone has and I don't want to depend on that.

>tab spacing, but 8 is the most common. However, if you display your
>4-space tabs as 8-space tabs, the document will look very messy. (Not to
>mention, the piclist archive of your tabbed files will look horrible).

:)

Thanks!
G.


>OTOH, If I know your files are formatted with tab equal to 8 spaces, I can
>run expand/unexpand (unix utilities) to fix it.
>
>Scott
>
>--
>http://www.piclist.com hint: The PICList is archived three different
>ways.  See http://www.piclist.com/#archives for details.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@055916 by Guillermo Rodriguez Garcia

flavicon
face
At 09:39 19/06/2002 +0100, Michael Rigby-Jones wrote:
{Quote hidden}

Uhm.. any decent editor also provides facilities to tidy up indenting
_even if you don't use tabs_. EditPlus can indent or de-intent blocks
of data with a single keypress, regardless of whether you use tabs or
spaces, also allows you to do vertical selection, etc. :)

G.

{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservEraseMEspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@073357 by Dave Tweed

face
flavicon
face
Lawrence Lile <EraseMEllilespamTOASTMASTER.COM> wrote:

> Here's a small addition to this (finally) serious list:
>
> The first line of my C or ASM file is a title, with the name of the file.

Yes - when printed, it's good to know exactly which file it is.

> Then the author, date, and purpose of the code

The date should be handled as the first revision, below. Putting it here
is just redundant.

> Next (as James Mentioned) is a series of comments identifying each revision
> level and why the revision was made and by whom, for instance:
>
> 1    LL   1 Jun 2002        New Program
> 2    LL   2 Jun 2002        Found bug in rs232() function
> 3.   RW  3 jun  2002       Fixed bug introduce in fixing the last bug
> 4.   LL    4 jun 2002        Found another bug that was introduced in fixing
> the second bug which fixed the first bug  etc. etc.

Yes, except put the newest line first, as it's generally the most important
one.

> Each revision is saved in a separate file, in case I need to refer to it
> later.  I save a revision each morning first thing before I work on any
> code, and then every time I do anything that either 1. works or 2. took a
> long time to code.

This quickly gets out of hand. Once you get to this level, you should be
using a revision-control system such as RCS, CVS, etc.

Such tools also enforce the creation of revision dates/comments (above),
but to be honest, I still tend to put them in the file as well, because I
can edit them there at the same time that I'm making the actual changes.
The RCS comments get put in only at the end, when checking in new versions,
and I tend to be in a hurry at that time, and produce very short and cryptic
descriptions.

"Guillermo Rodriguez Garcia" <RemoveMEguilleEraseMEspamEraseMEIIES.ES> wrote:
> - only tabs, no spaces. 4-spaces per indentation level.

I have to second the comment about hard tabs with nonstandard widths.
Just use spaces, then no one will have to guess what your tab width is.
I've seen 2, 3, 4, and 8, and it's a real pain when you try to edit someone
else's code.

-- Dave Tweed

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservspam_OUTspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@075316 by Olin Lathrop

face picon face
> - only tabs, no spaces. 4-spaces per indentation level.

Bad idea.  You have no way of knowing how other people's tab stops are set,
so this will pretty much guarantee your code will look like crap when other
people view it.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservTakeThisOuTspamspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@081347 by Olin Lathrop

face picon face
>     ... and then, later in your code, you mistakenly write:
>
>         BSF PORTA,Relay    ;Turn on the relay
>         or
>         PORTA.Relay = 1;   // Turn on the relay.
>
>     You can eliminate this common source of errors by including the
>     port name in your #define:
>
>         #define Relay PORTB,0
>         or
>         #define Relay PORTB.0
>
>     then:
>
>         BSF Relay          ;Turn on the relay in assembly.
>         or
>         Relay = 1;         // Turn on the relay in C.

This works fine for addressing the individual port bit, but does not help
you if you need to access the whole register containing the bit, or need to
use the bit number other than with the port register.

A better way it to use my /INBIT and /OUTBIT preprocessor directives.  The
project include file would contain:

/outbit  relay    porta 0 0   ;relay on when 1, off when 0

This automatically causes a bunch of assembler constants to be defined.
Here are some example instructions that could be found in a module using the
include file.  These are just code snippets not meant to be useful code:

        dbankif  relay_reg   ;set banks for access to RELAY port reg
        bsf      relay_pin   ;turn on the relay
        .
        .
        bsf      shadow, relay_bit ;enable relay in the shadow copy
        .
        .
        dbankif  relay_tris
        bsf      relay_tris, relay_bit ;float the relay output pin

There is a lot more to the preprocessor.  All the details can be found at
http://www.embedinc.com/pic/.  You can follow the links to download your own
copy of all the PIC development tools.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspamspamspamBeGonemitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@102956 by Guillermo Rodriguez Garcia

flavicon
face
At 04:32 19/06/2002 -0700, Dave Tweed wrote:
{Quote hidden}

And before getting to that level as well :) CVS can make your
life so much easier..

{Quote hidden}

Yes, I also second that comment :) My original text was wrong,
my bad. I never use tabs.

G.

>Just use spaces, then no one will have to guess what your tab width is.
>I've seen 2, 3, 4, and 8, and it's a real pain when you try to edit someone
>else's code.
>
>-- Dave Tweed
>
>--
>http://www.piclist.com#nomail Going offline? Don't AutoReply us!
>email spamBeGonelistservSTOPspamspamEraseMEmitvma.mit.edu with SET PICList DIGEST in the body

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email KILLspamlistservspamBeGonespammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@105932 by Lawrence Lile

flavicon
face
What are RVS and CVS?

--Lawrence
----- Original Message -----
From: "Guillermo Rodriguez Garcia" <EraseMEguillespamEraseMEIIES.ES>
To: <@spam@PICLIST@spam@spamspam_OUTMITVMA.MIT.EDU>
Sent: Wednesday, June 19, 2002 9:25 AM
Subject: Re: [PIC]: coding style


> At 04:32 19/06/2002 -0700, Dave Tweed wrote:
> >Lawrence Lile <spamBeGonellilespamKILLspamTOASTMASTER.COM> wrote:
> >
> > > Here's a small addition to this (finally) serious list:
> > >
> > > The first line of my C or ASM file is a title, with the name of the
file.
> >
> >Yes - when printed, it's good to know exactly which file it is.
> >
> > > Then the author, date, and purpose of the code
> >
> >The date should be handled as the first revision, below. Putting it here
> >is just redundant.
> >
> > > Next (as James Mentioned) is a series of comments identifying each
revision
> > > level and why the revision was made and by whom, for instance:
> > >
> > > 1    LL   1 Jun 2002        New Program
> > > 2    LL   2 Jun 2002        Found bug in rs232() function
> > > 3.   RW  3 jun  2002       Fixed bug introduce in fixing the last bug
> > > 4.   LL    4 jun 2002        Found another bug that was introduced in
> > fixing
> > > the second bug which fixed the first bug  etc. etc.
> >
> >Yes, except put the newest line first, as it's generally the most
important
> >one.
> >
> > > Each revision is saved in a separate file, in case I need to refer to
it
> > > later.  I save a revision each morning first thing before I work on
any
> > > code, and then every time I do anything that either 1. works or 2.
took a
{Quote hidden}

versions,
> >and I tend to be in a hurry at that time, and produce very short and
cryptic
{Quote hidden}

someone
{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservspamRemoveMEmitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@113102 by Guillermo Rodriguez Garcia

flavicon
face
Version control systems. See http://www.cvshome.org/ for
more details. RCS is the precursor of CVS.

At 09:59 19/06/2002 -0500, Lawrence Lile wrote:
>What are RVS and CVS?
>
>--Lawrence
>{Original Message removed}

2002\06\19@132417 by Lawrence Lile

flavicon
face
Yow! - CVS looks complex and smells like it has security issues.  Do I
understand correctly that it stores your project documents on somebody
else's server?   This gives me the shivers.  If I was doing a far-flung GNU
project with a bunch of volunteer programmers this might be a good system to
use.

I think I'll stick to revision notes at the beginning of my C source file,
that's pretty simple.

--Lawrence

{Original Message removed}

2002\06\19@133306 by Eoin Ross

flavicon
face
It depends on how you want to set it up ...
http://www.cvshome.org/new_users.html

"Individual developers who want the safety net of a version control system can run one on their local machines. Development teams, however, need a central server all members can access to serve as the repository for their code. In an office, that's no problem -- just stick the repository on a server on the local network. For open-source projects...well, it's still no problem, thanks to the Internet. CVS has built-in client-server access methods so that any developer who can connect to the Internet can access files on a CVS server."

Eoin

>>> RemoveMEllilespamspamBeGoneTOASTMASTER.COM 06/19/02 01:23PM >>>
Yow! - CVS looks complex and smells like it has security issues.  Do I
understand correctly that it stores your project documents on somebody
else's server?   This gives me the shivers.  If I was doing a far-flung GNU
project with a bunch of volunteer programmers this might be a good system to
use.

I think I'll stick to revision notes at the beginning of my C source file,
that's pretty simple.

--Lawrence

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spamBeGonelistserv@spam@spamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@133338 by Dale Botkin

flavicon
face
On Wed, 19 Jun 2002, Lawrence Lile wrote:

> Yow! - CVS looks complex and smells like it has security issues.  Do I
> understand correctly that it stores your project documents on somebody
> else's server?   This gives me the shivers.  If I was doing a far-flung GNU
> project with a bunch of volunteer programmers this might be a good system to
> use.

Though it can be very complex in full blown use, it can also be pretty
simple.  I have CVS set up on my own local Linux system and only I use it
for my own projects.  It's been a godsend...  you can produce a complete
history of changes, revert back to the last working version, all kinds of
things you wish you could do when you accidentally step on something.  It
takes a little while to learn (couple hours or so), and I still have not
been able to make heads or tails of the Winows CVS client, though I'm sure
it's simpler than I'm making it.

If you have a UNIX system of some sort around, I highly recommend it -
even for a single person.

Dale

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email TakeThisOuTlistservspamspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@135048 by Pic Dude

flavicon
face
Unfortunately, with programming teams of a few or more,
it becomes very difficult to maintain control of the code,
and without a system such as this, there will usually be
lost code due to 2 or more people modifying a piece of
code at the same time, and not coordinating properly. CVS
et al handle this coordination for you really well.

There are 2 general flavors of SCCSes (Source Code Control
Systems) that I've run into ... the library system (such as
CVS) and the versioning system (such as Envy). The first
let's one person check out a file at a time while others can
only have it read-only. The other lets multiple people have
write access, but will put a separate version ID on each in a
special format, so that it is evident at build/compile time
that multiple changes had been made and need to be
merged". Each has its pros & cons.

In any programming team, the server is usually local to the
group, so it's not a big security issue. And one DB for all
code makes backups sooooo much easier and transparent.

Cheers,
-Neil.



{Original Message removed}

2002\06\19@140936 by Peter L. Peres

picon face
> This may be a dumb question, but is there something like an
> official coding style guide or so?

No, but you can make up your own conventions and stick to them. Mine are:

Sub_routine
la_bel
Ffile_register
Bbit_in_same
CONSTANT

This is sort of like Hungarian notation. The S,F and B symbols appear
grouped in any symbol listing and are easy to read. It also reduces
confusions (is it a file? is it a constant?).

Peter

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservEraseMEspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@141346 by Lawrence Lile

flavicon
face
I notice it is GNU - is it free or do you have to pay for it?

--Lawrence

----- Original Message -----
From: "Dale Botkin" <RemoveMEdaleEraseMEspamspam_OUTBOTKIN.ORG>
To: <@spam@PICLISTRemoveMEspamEraseMEMITVMA.MIT.EDU>
Sent: Wednesday, June 19, 2002 12:33 PM
Subject: Re: [PIC]: coding style


> On Wed, 19 Jun 2002, Lawrence Lile wrote:
>
> > Yow! - CVS looks complex and smells like it has security issues.  Do I
> > understand correctly that it stores your project documents on somebody
> > else's server?   This gives me the shivers.  If I was doing a far-flung
GNU
> > project with a bunch of volunteer programmers this might be a good
system to
{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email @spam@listservspam_OUTspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@141606 by Paul Hutchinson

flavicon
face
I had about the same reaction to CVS when I was looking to implement better
revision control.

Someone else on the list recommended QVCS a while back. I tried it, bought
it, and now can't imagine developing software without it. Go to
http://www.qumasoft.com/ and check it out.

Paul

> {Original Message removed}

2002\06\19@144536 by Dipperstein, Michael

face picon face
All GNU source is free.  People can charge you for their packaging and other
"value added" things, but the source must always be free.

In the case of CVS, you can probably download everything you need from their web
site free of charge.

-Mike

{Original Message removed}

2002\06\19@144951 by Dale Botkin

flavicon
face
'Tis free, as are all things GNU.

Dale
--
"Curiosity is the very basis of education and if you tell me that
curiosity killed the cat, I say only the cat died nobly."
         - Arnold Edinborough


On Wed, 19 Jun 2002, Lawrence Lile wrote:

> I notice it is GNU - is it free or do you have to pay for it?

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spamBeGonelistservEraseMEspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@150439 by Guillermo Rodriguez Garcia

flavicon
face
At 12:23 19/06/2002 -0500, Lawrence Lile wrote:
>Yow! - CVS looks complex

It's not _that_ complex.

>  and smells like it has security issues.

Like?

>   Do I
>understand correctly that it stores your project documents on somebody
>else's server?

Not necessarily. It can be your corporate server, or it can
be your own local machine. It is more powerful when it is a central
server shared by several developers, but of course it can also be
installed locally on YOUR machine and then nobody needs to access
it at all.

G.

>    This gives me the shivers.  If I was doing a far-flung GNU
>project with a bunch of volunteer programmers this might be a good system to
>use.
>
>I think I'll stick to revision notes at the beginning of my C source file,
>that's pretty simple.
>
>--Lawrence
>
>{Original Message removed}

2002\06\19@150448 by Guillermo Rodriguez Garcia

flavicon
face
Free.

At 13:11 19/06/2002 -0500, Lawrence Lile wrote:
>I notice it is GNU - is it free or do you have to pay for it?
>
>--Lawrence
>
>{Original Message removed}

2002\06\19@150649 by Guillermo Rodriguez Garcia

flavicon
face
Thanks Peter! This will be useful.

G.

At 21:09 19/06/2002 +0300, Peter L. Peres wrote:
{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistserv@spam@spamspamBeGonemitvma.mit.edu with SET PICList DIGEST in the body


2002\06\20@124038 by Peter L. Peres

picon face
On Wed, 19 Jun 2002, Lawrence Lile wrote:

>Yow! - CVS looks complex and smells like it has security issues.  Do I
>understand correctly that it stores your project documents on somebody
>else's server?   This gives me the shivers.  If I was doing a far-flung GNU
>project with a bunch of volunteer programmers this might be a good system to
>use.
>
>I think I'll stick to revision notes at the beginning of my C source file,
>that's pretty simple.

RCS is the network-less version of CVS. You can use that in case of
paranoia. The CVS server can run ON YOUR OWN machine of course. You don't
need to run it on someone else's machine. In a normal environment it would
run on a server that serves all the developers on a project, on an
intranet. And it would be guarded like the proverbial crown jewels.

Peter

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-request@spam@spamEraseMEmitvma.mit.edu


2002\06\20@191739 by Jinx

face picon face
> I personally prefer spaces and no tabs. Why? because there is
> no standard tab spacing, but 8 is the most common. However,
> if you display your 4-space tabs as 8-space tabs, the document
> will look very messy. (Not to mention, the piclist archive of your
> tabbed files will look horrible)

Nothing more tedious than removing all the tabs from a piece of
someone's code so you can do a half-decent printout or fit the
routine into your own screen format

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestRemoveMEspammitvma.mit.edu


2002\06\20@193000 by Uri Sabadosh

flavicon
face
Use the Brief editor. It has a global (file scope) replace that accepts the
tab key as a character to replace. Replace with four space chars.

Uri


{Original Message removed}

2002\06\20@200026 by Dave Tweed

face
flavicon
face
Uri Sabadosh <.....uriSTOPspamspam@spam@LUXTRON.COM> wrote:
> Use the Brief editor. It has a global (file scope) replace that accepts the
> tab key as a character to replace. Replace with four space chars.

Most editors have that capability. Works fine as long as all tabs start at
the left edge. If you have any right-side comments, etc., lined up with
tabs, though, you'll still end up doing a lot of fixing-up by hand.

-- Dave Tweed

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestEraseMEspam@spam@mitvma.mit.edu


2002\06\20@201316 by Tony Nixon

flavicon
picon face
Uri Sabadosh wrote:
>
> Use the Brief editor. It has a global (file scope) replace that accepts the
> tab key as a character to replace. Replace with four space chars.
>
> Uri

You can do that with MPLAB or any editor with search and replace.

To select a tab, move the cursor to the start of a line where the first
character is a tab. Press shift and right arrow once to select the tab
character. Press CTRL Insert to capture the tab to the clipboard. In
MPLAB, press ALT E R. Then SHIFT Insert to paste the TAB character into
the Find What field. (It looks like a solid "I") Type as many spaces as
you need into the Replace With field. Press "Replace All".

--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
RemoveMEsalesspamspamBeGonebubblesoftonline.com

--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-requestKILLspamspam@spam@mitvma.mit.edu


2002\06\20@215054 by Spehro Pefhany

picon face
At 04:34 PM 6/20/02 -0700, you wrote:
>Use the Brief editor. It has a global (file scope) replace that accepts the
>tab key as a character to replace. Replace with four space chars.

That would make a royal mess of things in some cases.

I suggest using a nice editor such as the shareware Ultraedit.

http://www.ultraedit.com

Set the tab settings to the way the document was formatted, then use
Format->Tabs to Spaces

presto, change-o and it is formatted for universal consumption <cough>

Best regards,

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
speffspam_OUTspam@spam@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
9/11 United we Stand

--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-request@spam@spammitvma.mit.edu


2002\06\21@020710 by Tony Nixon

flavicon
picon face
Spehro Pefhany wrote:
>
> At 04:34 PM 6/20/02 -0700, you wrote:
> >Use the Brief editor. It has a global (file scope) replace that accepts the
> >tab key as a character to replace. Replace with four space chars.

I wrote a small utillity that tries to re-format ASM files.

It parses the text file, deletes all TABs and if it finds more than 1
consecutive space on a line, deletes them as well. It tags where each of
these conditions existed on the line and inserts spaces to pad the line
out to the column widths (max 4 allowed) which are user set from 4 edit
boxes on the screen.

I don't know how well it will work for every file though.

http://www.bubblesoftonline.com/demo/tabspc.zip

--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
RemoveMEsalesEraseMEspamKILLspambubblesoftonline.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\06\21@022843 by Dale Botkin

flavicon
face
Yeah, just what I need, one more editor.  Why not just use spaces in the
first place?

Dale
--
"Curiosity is the very basis of education and if you tell me that
curiosity killed the cat, I say only the cat died nobly."
         - Arnold Edinborough


On Thu, 20 Jun 2002, Uri Sabadosh wrote:

> Use the Brief editor. It has a global (file scope) replace that accepts the
> tab key as a character to replace. Replace with four space chars.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\06\21@023043 by Guillermo Rodriguez Garcia

flavicon
face
At 11:17 21/06/2002 +1200, Jinx wrote:
> > I personally prefer spaces and no tabs. Why? because there is
> > no standard tab spacing, but 8 is the most common. However,
> > if you display your 4-space tabs as 8-space tabs, the document
> > will look very messy. (Not to mention, the piclist archive of your
> > tabbed files will look horrible)
>
>Nothing more tedious than removing all the tabs from a piece of
>someone's code so you can do a half-decent printout or fit the
>routine into your own screen format

Nobody really uses decent editors? Any half-decent one should
have a function to replace tabs with [the selected number of]
spaces...

G.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\06\21@023712 by Dale Botkin

flavicon
face
Mine even lets me use the TAB key, but puts spaces in the text file.  I
find that works even better than trying to clean it up later.

Dale
--
"Curiosity is the very basis of education and if you tell me that
curiosity killed the cat, I say only the cat died nobly."
         - Arnold Edinborough


On Fri, 21 Jun 2002, Guillermo Rodriguez Garcia wrote:

> Nobody really uses decent editors? Any half-decent one should
> have a function to replace tabs with [the selected number of]
> spaces...

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\06\21@071301 by Spehro Pefhany

picon face
>Nobody really uses decent editors? Any half-decent one should
>have a function to replace tabs with [the selected number of]
>spaces...

This DOES NOT work to preserve formatting- the tabs are usually
in FIXED evenly-spaced positions across the line (in word-
processing programs you can usually make them non-evenly-spaced.

The tab character means to go to the next fixed position, which
may be one space or many. Replacing the tab character with a
fixed number of spaces will destroy the formatting in almost
every case (including PIC assembler code)

But, yes, a good editor should have commands for dealing with
that as well as *nix/PC issues etc. Vanilla IDE editors tend
not to, so you keep one good editor around, no big deal.

Best regards,

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
spamBeGonespeffspam_OUTspamRemoveMEinterlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
9/11 United we Stand

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\06\21@072357 by Guillermo Rodriguez Garcia
flavicon
face
At 07:17 21/06/2002 -0400, Spehro Pefhany wrote:
>>Nobody really uses decent editors? Any half-decent one should
>>have a function to replace tabs with [the selected number of]
>>spaces...
>
>This DOES NOT work to preserve formatting- the tabs are usually
>in FIXED evenly-spaced positions across the line (in word-
>processing programs you can usually make them non-evenly-spaced.
>
>The tab character means to go to the next fixed position, which
>may be one space or many. Replacing the tab character with a
>fixed number of spaces will destroy the formatting in almost
>every case (including PIC assembler code)

EditPlus can handle that nicely..


{Quote hidden}

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\06\21@072543 by Peter L. Peres

picon face
On Fri, 21 Jun 2002, Jinx wrote:

>> I personally prefer spaces and no tabs. Why? because there is
>> no standard tab spacing, but 8 is the most common. However,
>> if you display your 4-space tabs as 8-space tabs, the document
>> will look very messy. (Not to mention, the piclist archive of your
>> tabbed files will look horrible)
>
>Nothing more tedious than removing all the tabs from a piece of
>someone's code so you can do a half-decent printout or fit the
>routine into your own screen format

You should *really* get a copy of the GNU textutils compiled for
DOS/Win32. You want the programs expand and unexpand as Scott Dattalo has
said. Try to type 'unexpand.exe' into Google. Maybe it is floating
somewhere outside its original archive (which is large but worth your
while ...).

Peter

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\06\21@080308 by Olin Lathrop

face picon face
> Nothing more tedious than removing all the tabs from a piece of
> someone's code so you can do a half-decent printout or fit the
> routine into your own screen format

I use my COPYA program, which can be set to arbitrary tab stops and use them
to substitute spaces for tabs.  The COPYA tool is included in the "PIC
development tools" download at http://www.embedinc.com/pic/dload.htm.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\06\21@092557 by Peter L. Peres

picon face
On Thu, 20 Jun 2002, Dave Tweed wrote:

>Uri Sabadosh <urispam@spam@LUXTRON.COM> wrote:
>> Use the Brief editor. It has a global (file scope) replace that accepts the
>> tab key as a character to replace. Replace with four space chars.
>
>Most editors have that capability. Works fine as long as all tabs start at
>the left edge. If you have any right-side comments, etc., lined up with
>tabs, though, you'll still end up doing a lot of fixing-up by hand.

Or use an editor with regular expression capability where you can tell it
not to touch lines that are comments. Or use awk which can do the same.
Or use BAWK.ZIP which is awk for DOS/W32. Or run the file through the
assembler and then process the .lst file to extract rewritten source
lines. (I do not remember if MPASM rewrites the source lines - other
assemblers do at least align to the leading printable character in each
source line). In C use indent (also a GNU program). Some artifices may be
necessary to deal with non-ANSI microprocessor C constructs. indent is
excellent to turn spaghetti C into readable files imho.

Peter

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\06\23@022600 by Russell McMahon

face
flavicon
face
After having been bitten over the years (using a range of processors and
assemblers) by using a constant name as a variable "address" I now prefix
all constant names with "K". This makes obvious the presence of (stupid)
errors such as writing

       mov    a, upper_limit

when you meant to use

      mov    a, #upper_limit

Both do something but the wrong version is rather unuseful and VERY hard to
spot once you have done it due to "mental blinkers" which tend to stop you
seeing the obvious once you have approved of it once.
Writing

       mov    a,Kupper_limit

can be immediately seen to be wrong by inspection subsequently despite the
brains inbuilt error-protecting mechanisms.

The value of this depends on processor and mnemonics - some systems have
specific load-immediate mnemonics which tend to prevent this error.

One can extend this to using V prefix for variables, B for bit patterns etc
but use of K for constants shows the best return for me at least.


       Russell McMahon


> >I personally try to use all lower case for keywords, Underscores in
> >variables, All uppercase for defines or constants.
> >
> >Type of variable as first part of variable name, Since labels are
variable
> >of type "address" I try to use "at" or "a" as the first letter of labels,
> >but they also denote the start of functions or procedures so sometimes I
use
> >"f" or "p" or even "s" or "sub."

etc

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...