Post Reply 
Afiles and Avars commands
08-23-2015, 09:01 PM (This post was last modified: 08-23-2015 09:06 PM by Tim Wessman.)
Post: #5
RE: Afiles and Avars commands
(08-23-2015 08:25 PM)Giancarlo Wrote:  As a general approach do i have to save an existing app with a different name? Does it suffice to create a new app with its own folder where i can store all the different files like AVars, AFiles and icon.png?

AFiles and AVars create or access things within the current application. It doesn't matter if that is a copy of the base application, or a base application.

AFiles will store things to disk. You cannot directly use those items by name. Nor can they be directly accessed. They do not remain in RAM taking up space when not in use. They must be recalled into RAM before use. (similar to an item saved in a port on the 48/50 series calcs). Example:

Code:

AFiles("MyFile"):={1,2,3,4,5}  //stores to a file named "MyFile" inside the current app folder
L1:="MyFile" //would store into L1 the string "MyName" - not recall your file
L1:=AFiles("MyFile") //recalls content of file, and then store it into L1

AVars on the other had, creates a variable by name that can hold any object in the current application. They always remain in RAM like any other variable. This is like a normal variable accessed by the menu key in the 48/50 series.

Code:

AVars("MyVar"):={1,2,3,4,5}  //creates a variable named "MyFile" inside the current app
L1:=MyVar; //would store into L1

Note that the normal name resolution rules still apply. Unless MyVar has already been created, the program parser won't know what to do with it should you send that piece of code to someone.

Code:

MyVar; //I've declared this to be a variable

EXPORT Function()
BEGIN
  AVars("MyVar"):={1,2,3,4,5}  //creates a variable named "MyFile" inside the current app
  L1:=MyVar; //will always work
END;

Wheras:

Code:

EXPORT Function()
BEGIN
  AVars("MyVar"):={1,2,3,4,5}  //creates a variable named "MyFile" inside the current app
  L1:=MyVar; //will only work if you have *already* created this before, else on compile will error here
END;

Recommended uses for AFiles: archiving things - especially if they are large! You don't want your app to take up 5mb of space when not in use do you?

Recommended uses for AVars: variables in common use - especially those that will be smaller or used frequently. If your variable starts taking up lots of space, store it to a disk when not in use and clear that memory out to be courteous. Smile


A store into AFiles will happen immediately - e.g. on call it writes at that instant to disk. AVars will only be saved to disk when the application in memory is saved. Usually, this will be on the next off.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Afiles and Avars commands - Giancarlo - 08-23-2015, 04:00 PM
RE: Afiles and Avars commands - Marcel - 08-23-2015, 06:59 PM
RE: Afiles and Avars commands - Giancarlo - 08-23-2015, 08:25 PM
RE: Afiles and Avars commands - Tim Wessman - 08-23-2015 09:01 PM
RE: Afiles and Avars commands - Marcel - 08-23-2015, 08:44 PM
RE: Afiles and Avars commands - Giancarlo - 08-23-2015, 09:40 PM
RE: Afiles and Avars commands - bobkrohn - 08-29-2015, 10:26 PM



User(s) browsing this thread: 1 Guest(s)