Mintoris Forum

Author Topic: Source Formatter  (Read 3200 times)

BillK

  • Full Member
  • ***
  • Posts: 26
Source Formatter
« on: Apr 14, 2011, 07:25 PM »
Here is a utility for formatting Basic source code.  You can set indention from 1 to 4 spaces, delete all blank lines or just extra blank lines, and an option to indent after line labels. There is an option to make a backup of the original file (encouraged), as well as options for displaying the formatted file.

The main file is SrcFormat.bas. This is a GUI front-end for selecting the source file and setting options. It will save your settings in an INI file in the /Data directory.  The attached Zip file has the following files:
  SrcFormat.bas      ( Main Basic file )
  BK_SrcFormat.inc   ( does the actual work. Change the backup directory path in this file if you don't want it to go to "Mintoris.Basic/BUDir/" )
  BK_INIfileInc.bas  ( writes to and reads from INI files )
  BK_FileListInc.bas ( presents a list of source files to format )
  Also, there are some button include files that have been posted in previous posts:
  BK_BtnComInc.bas
  BK_ChkBoxInc.bas
  BK_PushBtnInc.bas
  BK_RadioBtnInc.bas

This was a fun project to work on.  Hope you find it useful. Released to the public domain by the author. Use at your own risk. The author takes no responsibility for any damage to your files, so please make a backup.  Feedback is welcome‼

 
« Last Edit: Apr 14, 2011, 07:28 PM by BillK »

Jesse

  • Sr. Member
  • ****
  • Posts: 126
  • If life throws a planet at you, pull your ripcord‼
Re: Source Formatter
« Reply #1 on: Apr 19, 2011, 01:42 PM »
Bill, good work‼ Could you post the basic include file that works with ini files in the Include Files forum? Thanks‼

BillK

  • Full Member
  • ***
  • Posts: 26
Re: Source Formatter
« Reply #2 on: Apr 20, 2011, 03:35 AM »
Thanks, Jesse‼ … posted.
/ Bill

wills

  • Full Member
  • ***
  • Posts: 34
Re: Source Formatter
« Reply #3 on: Jan 15, 2013, 01:10 AM »
Bill, I extracted the files into the Mintoris.Basic directory but when I try to run the program I get this error. RUNTIME ERROR

Invalid array index. The index specified is outside the size of the array.

BKRAD(Temp,BKCHKD)=1

Did I put the files in the wrong directory?

Bill, what I found was that that Dim BKRAD(6,BKRADPROPS) but the ini for blanks was set to 10 so that
Temp=Val(BKGetINI$(INI$(),"[BLANKS]"))
BKRAD(Temp,BKCHKD)=1
DelBlanks=Temp-4
 
was invalid.

I also added a setscale to make it fit to my screen.  (I have an A500 tablet) I am new to this so I'm not sure that's how it should be done.

The formatted files look great.
Thanks

« Last Edit: Feb 01, 2013, 01:39 AM by wills »