Contents of Article


STATE and the File Type

STATE Integrity

STATE Command Options

Displaying the STATE setting in the Profile

Where is the STATE saved ?

When is STATE data saved?


Introduction


When working on a file, particularly files such as source files, a fair amount of effort may be expended on establishing line-labels to act as bookmarks, setting line tags to mark particular lines and excluding various ranges of lines so that only the current pertinent lines are visible and being worked on. As well, you may have added NOTE lines to the file.


Your work on a large source program might continue over an extended period of many days. But every time you close the editor, all that effort noted above would normally be lost, and has to be re-established the next time the file is loaded for edit.


SPFLite can now save all the above as STATE information and automatically re-establish the session when the file is loaded back to its status when closed. Line labels, line tags, NOTE lines, excluded line ranges and current top of screen location are all retained on close and recreated when the file is opened. The file is redisplayed exactly as you left it at close time.


This action is often called "reestablishing the session context". By doing this, it eliminates the work of you having to do all of that manually, and will greatly aid your productivity. You'll spend less time going, "where was I, what was I doing?" and you'll be able to resume your work much more quickly.


STATE and the File Type


So for source files, STATE seems a nice feature, and since STATE is a setting maintained in the file type Profile, you can have STATE set ON for source file types where it is appropriate, and OFF for file types where it would provide no benefit.


You can now also have selective STATE processing within a single file type. Continue reading and pay attention to STATE Setting Options below. 


STATE Integrity


In order to make sure the saved STATE information is properly synchronized with the file it's associated with, the line count when the STATE data is created is matched against the line count when the file is loaded. If the validation fails when the file is opened, the STATE information will not be used, and you will receive an error message.


This can happen if you use an external program to modify the file. An invalid STATE condition can happen if you restore or copy a file from another location, such as a backup, or download a copy from a web site. When SPFLite detects this, it will not use any saved STATE information.


SPFLite Backup / Restore Support


The built in Backup/Restore support in SPFLite will create backups which combine the Date and STATE files together to maintain integrity between the files. See "Working with BACKUP & RESTORE" for details.



STATE Command Options


STATE now supports multiple operand options to allow you to customize how STATE processing is handled. These operands are:


STATE ON        This indicates that you would like all files controlled by this Profile to be processed by STATE.


STATE OFF         This indicates that no files controlled by this Profile are to be handled by STATE.


STATE MOST        This is similar to STATE ON. If you take no specific action for a specific file, then it acts just like STATE ON, all files will be processed by STATE. However it supports allowing you can exempt specific files, see STATE DELETE below.


STATE FEW        This is similar to STATE OFF. If you take no specific action for a specific file, then it acts just like STATE OFF, all files will not be processed by STATE. However you can exempt specific files, see STATE CREATE below.


STATE DELETE        This command would be issued while editing a specific file and STATE MOST has been set. In fact, it will be rejected if these conditions are not met. Since STATE MOST, by default, will have created active STATE data for this file, the STATE DELETE will remove this active data and setup an indicator so that no future STATE processing for this file will occur.


STATE CREATE        This command would be issued while editing a specific file and STATE FEW has been set. In fact, it will be rejected if these conditions are not met. Since STATE FEW, by default, will not have created any active STATE data for this file, the STATE CREATE will cause this active data to be created the next time the file is saved, and will setup an indicator so that STATE processing will continue for this file in future edits.


STATE SAVE        This command will immediately create / update the STATE information for the current file. It will be performed regardless of the current setting of the STATE flag (ON, OFF, etc.)


Displaying the STATE setting in the Profile


Whether or not your editing context is saved for you or not is controlled by a Profile setting called STATE. If you issue a PROFILE (or just PRO) command, here is what the display might look like:



Notice the =PROF> line that says STATE ON. In this example, this means that for files of type TXT, state information will be saved. Note also that S+ appears in the Status Bar indicating that an active STATE file exists for this file.


When STATE is ON, the state of your excluded lines, User Lines, labels and tags will be saved when you close your file, and restored when you reopen it.


NOTE and xNOTE lines require STATE ON to be in effect if you wish these lines to be retained between edit sessions. 


Some (but but not all) options of START (which relies on a persistent label of .START) also require STATE ON.


Where is the STATE saved ?


The state information for a given file is saved in a separate file within the STATE folder in the SPFLite data directory. Since STATE data is normally related to your current work with a file, STATE files which have not been updated for 180 days will be automatically removed from the STATE folder. This will prevent the accumulation of obsolete STATE files which are no longer of any use.


When is STATE data saved?


The STATE data is saved a) whenever the actual data is Saved and b) when the session is closed with an END command and the data is in un-modified state.  This saving at END time is done for all session types (Edit, Browse and View)


If the session is closed with a CANCEL, no STATE data is saved.


Created with the Personal Edition of HelpNDoc: Effortlessly Create High-Quality Documentation with a Help Authoring Tool