SheerPower® 4GL
A Guide to the SheerPower Language


Previous Contents Index

1.2.2 Saving a Program in SheerPower

To SAVE your program in SheerPower Rapid Development Environment, click once on the Save icon in the SPDEV toolbar---the floppy disk icon.

You can also click on File in the SPDEV toolbar and select Save from the drop down menu.

If you have multiple files open in SheerPower Rapid Development Environment that you wish to save, click on the Save All icon in the SPDEV toolbar---the icon with three floppy discs together.

Each time you RUN a program file from SPDEV, SheerPower automatically SAVES it.

1.2.3 File Backup Versions

SPDEV has a built-in file backup feature that allows you to keep up to the last 10 versions of any file edited in SPDEV. Each time you save your file in SPDEV, the old version is saved with a version number behind it:


  myprogram.spsrc   <-- current version 
  myprogram.spsrc-1 <-- last saved version 
  myprogram.spsrc-2 <-- 2nd last saved version 
  myprogram.spsrc-3 <-- 3rd last saved version 

To choose the number of backup file versions for SPDEV to automatically save, click on Options in the SPDEV toolbar. Select Change System Settings, then enter in the Number of Backup File Versions to save (0-10).

1.2.4 Purge Old Backup Files

To delete any unwanted SPDEV backup files, click on the Purge icon in the SPDEV toolbar. The Purge Versions dialog box will appear.

Select the folder or files that you wish to purge in the Look in: field. You can choose to purge either SheerPower (.spsrc) files or all file types in the drop down list at the bottom of the dialog box.

A Purge Subfolders option is also available inside the Purge Versions dialogbox. Just place a check inside the checkbox if you want to purge backup files that are inside the subfolders of the directory you have selected.

Once you have selected the folder or files to purge, and the file type, click on the Purge Now button. You will be prompted to confirm that you want to purge the files in the selected path. Click on the OK button. The Purge Results window will appear containing a list of all the backup files purged. If no backup files were in the folder nothing will be purged.

The option to purge only the backup versions of the current file you are working in is also available. Click on File in the toolbar options, then select Purge Current File.

1.2.5 Deploying the Menu Program Example

Note

Keep Your Valuable Source Code Hidden From Prying Eyes! Optional SheerPower 4GL GOLD Licenses are available.

Royalty FREE distribution---you can always distribute SheerPower-based applications to others---royalty free! And, you can do so without the optional SheerPower 4GL License, but you must provide them with the source code to your application.

Visit our website for more information.

In the SPDEV toolbar, click on the DEPLOY icon.

This will bring up the Enter License Key dialog box. You can copy and paste your SheerPower 4GL license key information in here. Click on [OK] to proceed with the deployment of the program.

Note

You will see the Enter License Key dialog box the FIRST TIME you do a DEPLOY when newly running SPDEV. If you restarted SPDEV 5 times in a day, you would see the "Enter License Key" dialog box appear 5 times (providing you deployed each time).

The Deployment Properties dialog box will appear. You can now enter a Password to protect this program file.

This is an OPTIONAL PASSWORD used to PROTECT your program. This way, only someone who knows the passwordcan run the program.

So, you could post your .SPRUN file on the Internet---and anyone could download it. But, only those who have the PASSWORD could run it!!

Place a check in the box beside Don't show this dialog again if you do not want to be prompted to enter a password every time you click on the deploy icon.

Note

If you want to deploy a program with a password, you have to specify a password each time you deploy.

Click on the [OK] button to deploy the program.

You will now see in the bottom frame of the SPDEV window that deploying the program compiled it. You will also see the number of lines of code, file size, and whether or not it was a clean build or if there were any compile errors.

Look inside your SheerPower folder (c:\sheerpower is the default location). You will see that a file named menu.sprun has been created.

This .SPRUN file allows you to distribute applications without the recipients ever being able to see the source code.

Optional SheerPower 4GL Licenses Available

Royalty FREE distribution---you can always distribute SheerPower-based applications to others---royalty free! And, you can do so without the optional SheerPower 4GL Licenses, but you must provide them with the source code to your application.

1.3 Deploying and Running a Program in SheerPower

Note

The SheerPower DEPLOY feature is available by license only.

Once you have written a program you can DEPLOY it by clicking on the Deploy icon in the toolbar.

Note

If you are editing a file in SheerPower Rapid Development Environment that is not a program file, the Deploy and Run icons will be disabled (greyed out).

Deploying your main source code before you run your program will tell you immediately if there are any compile errors in your code. Any errors will appear inside the bottom window frame of SheerPower Rapid Development Environment. If there are no compile errors, SheerPower will tell you that you have a clean build. The name of your file, the number of lines written, the speed it was compiled at, and the size of the file will also appear inside the SheerPower Rapid Development Environment bottom window frame.


Build of C:\SheerPower\test.spsrc 
Lines compiled: 58 (24800/min), code: 1KB 
Clean build for C:\SheerPower\test.sprun 

1.3.1 SheerPower Deployment of Portable Runnable Applications

The DEPLOY feature also creates a .SPRUN file---such as test.sprun. SPRUN files are useful in that:

Deployed applications can include the %COMPILE directive. The %COMPILE directive allows you to enter in up to 100 lines of text inside the .SPRUN file. This text cannot be altered or the application will not run. See Section 3.9.1,%COMPILE for details.

1.3.2 Running a SheerPower Program

At any time you can RUN your main source program. To run a program in SheerPower Rapid Development Environment, click on the Run icon in the toolbar---the running man.

You can also Run a SheerPower program by double-clicking on its name using Windows Explorer. Both SPSRC and SPRUN program files can be run in this way. You can also DRAG-and-DROP either SPSRC or SPRUN program files onto the DESKTOP---then double-click to run the program.

How to Run a SheerPower Program on Another Computer

To run a SheerPower program on another computer:

Temp Folders and Security in SheerPower 4GL

As a security feature, SheerPower programs cannot be run if they are inside of any temporary folder.

This prevents users from accidently running malicious code written in SheerPower that a hacker might place into an email or webpage.

1.4 Program Examples

In the program examples, keywords in SheerPower statements and commands are in bold, and information you (the user) supply is in regular text. The program examples are designed so that they can be typed, or copied and pasted into the SheerPower Rapid Development Environment and run. Below each example, the results are shown.

SheerPower Coding Standards

All examples shown in this manual conform to SheerPower coding standards. This includes all code being typed in lower-case and with proper line indentation. For more information on coding standards in SheerPower, please refer to the SheerPower Coding Standards manual and Appendix A, Coding Principles and Standards.

To assist you, SheerPower tries to automatically indent code according to the statement last typed in.

*The double quote (") can be used in place of the single quote (') as long as they are paired.

Try the following examples:

Example 1-2 Menu Program

  do
    line input menu '"calculator" = calc,"DOS prompt" = dos,"exit"': ans$ 
    if  _exit  then  exit do
    select case ans$ 
    case 'CALC' 
      pass nowait: 'calc' 
    case 'DOS' 
      pass nowait: '$$' 
    end select
  loop
  end

Example 1-3 Quiz Program Example

// A simple quiz program 
 
  woodpecker$ = 'sheerpower:samples\woodpecker.jpg' 
  
  quiz_form$ = '<sheerpower persist><title>Quiz</title><form>' + 
               '<center><h3>Skill Testing Question</center></h3>' + 
               '<img src="' + woodpecker$ + '" border=3 align=middle>' 
  quiz_form$ = quiz_form$ + '<font color=green> ' + 
               '<b>What type of woodpecker' + 
               ' is in this photograph?</b></font><p>' 
  quiz_form$ = quiz_form$ + '<input type=radio name=birdname ' + 
               'value="Pileated Woodpecker"> ' + 
               '<i>Pileated Woodpecker<p>'  
  quiz_form$ = quiz_form$ + '<input type=radio name=birdname ' + 
               'value="Hairy Woodpecker"> Hairy Woodpecker<p>' 
  quiz_form$ = quiz_form$ + '<input type=radio name=birdname ' + 
               'value="Redheaded Woodpecker"> ' + 
               'Redheaded Woodpecker</i></b>'  
  quiz_form$ = quiz_form$ + '<p><input type=submit name=submit value="Submit">' + 
                            '<input type=submit name=exit>' + 
                            '</form>' 
  correct$ = 'Hairy Woodpecker' 
  good$ = '<sheerpower width=500 height=300 color=green>' + 
          '<form><h1>Congratulations!!  ' + 
          correct$ + ' is the correct answer!!</h1>' + 
          '<p><center><input type=submit></center></form>'    
      
  do
    line input dialogbox quiz_form$: ans$ 
    if _exit then stop
    z0$ = element$(ans$, 1, chr$(26)) // get the first response 
    value$ = element$(z0$, 2, '=')    // get the the value  (name=value) 
    if value$ = correct$  then exit do
    message error: "Sorry, this is not a ";value$ 
  loop
  line input dialogbox good$: ans$ 
  end


Previous Next Contents Index