Programming style

In this chapter we suggest a few guidelines about how a Proteus program should be formatted to increase readability, comprehensibility and portability. Obviously, you are free to follow or not these suggestions: however, if you follow them it will be easier for people that have read this manual to understand your programs.

Formatting rules:

WHILE test
  method
  ..
LOOP
REPEAT
  method
  ..
UNTIL test
FOR id = v1 TO v2
  method
  ..
NEXT
IF test
  method
  ..
ELSE
  method
  ..
FI
!ifdef MS_DOS
   !include "dosspec.prt"
!else
   !include "unxspec.prt"
!endif
SWITCH exp [func]
  ON v1[, v2..]
    method
    ..
  ONC v3[, v4..]
    method
    ..
  OTHER
    method
    ..
OFF
FUNCTION FuncName(par..)

  method
  ..
RETURN exp
!ifdef ITALIANO

  CONST DEF_DAYS = "Dom Lun Mar Mer Gio Ven Sab"
  CONST DEF_MONTHS = "Gen Feb Mar Apr Mag Giu Lug Ago Set Ott Nov Dic"
  CONST TODAY_IS = "Oggi è: "

!else

  CONST DEF_DAYS = "Sun Mon Tue Wed Thu Fri Sat"
  CONST DEF_MONTHS = "Jan Feb Mar Apr May Jun Jul Ago Sep Oct Nov Dec"
  CONST TODAY_IS = "Today is: "

!endif
FUNCTION DayMonthYear(date)
RETURN CDOW(date) " " DAY(date) CMONTH(date) " " YEAR(date)

Today = DATE()

DAYS = DEF_DAYS
MONTHS = DEF_MONTHS
CONSOLELN TODAY_IS DayMonthYear(Today)

The example protform.prt can be used to correctly format any Proteus program according to the rules above.

Naming conventions

Whenever distinguishing the type of each variable becomes crucial, it is reccomended to start the name of the variable with a letter identifying its type, according to the following table:

N integer number A AVL tree
F floating point number M character to character mapping
C string K handle returned by a static tokenizer
H file handle D date
Q queue T time
V array L logical value
P stack Y directory handle
B bit map R simple regular expression
S hash set X extended regular expression
O socket handle W Windows™ generic handle
E pipe handle U DAO database handle
Z DAO recordset handle G DAO bookmark handle

 

Start of page Next topic Previous topic Contents Index
Midnight Lake iPhone Case Black Women Shoes Black Flat Shoes Leather Flats Black Patent Ballerinas Black Ballet Shoes Casual Shoes Black Shoes Women Balle Record Player Cufflinks Best iPhone XR Clear Cases iPhone XS/XS Max Leather Cases Sale Best iPhone 8/8 Plus Silicone Cases iPhone 7/7 Plus Cases & Screen Protector New Cases For iPhone 6/6 Plus iPhone 8 Case Sale iPhone Xr Case Online iPhone 7 Case UK Online iPhone X Case UK Sale iPhone X Case Deals iPhone Xs Case New Case For iPhone Xr UK Online Case For iPhone 8 UK Outlet Fashion Silver Cufflinks For Men Best Mens Cufflinks Outlet Online The Gold Cufflinks Shop Online Cheap Shirt Cufflinks On Sale Nice Wedding Cufflinks UK Online Top Black Cufflinks UK Online Mens Cufflinks Online Silver Cufflinks For Men Men Cufflinks UK Sale Gold Cufflinks UK Online Gold Cufflinks UK Silver Cufflinks UK Shirt Cufflinks Discount Online Mens Cufflinks Deals & Sales Girls Shoes For Dance Fashion Ballet Dance Shoes Best Ballet Flats Shoes UK Online Cheap Ballet Pointe Shoes UK Online Best Ballet Shoes Outlet Best Dance Shoes Sale Cheap Ballet Flats Sale UK Best Pointe Shoes Online UK Ballet Dance Shoes UK Shoes For Dance UK Best Ballet Slippers Shop Best Yoga Shoes Hotsell