Objects

Top  Previous  Next

Creating files

 

Creating a new file

You can create a new file by right-clicking a task or library and selecting Create file.

 

Importing a file

You can copy one or more existing files into your project by right-clicking a task or library and selecting Add existing files. Adding source files makes them candidates for building with the appropriate tools (compiler for .c and assembler for .asm, for example). Object files and libraries imported into the task are4 included in the relevant link step for the task.

 

References

Rather than have many copies of an object (for example, a file) being held in a project, the IDE allows you to create multiple references to a single instance of the object. That instance is held initially in a place corresponding to the structure within which the object was created. Changing an object via a reference  changes the single instance and the changes visible to all references.

 

Creating references

You can create a reference by pressing Ctrl and Shift together when you drag and drop the object in the source view. When an object is referenced in more than one place, its icon includes a small arrow.

 

Deleting references

Objects are deleted by right-clicking them in the Diamond source view and selecting delete. If the object being deleted is referenced more than once it is deleted silently; you can always create another reference from any of the remaining ones. The IDE requests confirmation if you ask to delete the final reference to an object, as this will remove the only instance. Whenever only one reference to an object remains, the IDE silently moves the actual instance into a place corresponding to the location of that final reference.

 

Localizing references

On some occasions you may with to replace a reference to an object with a copy of the object. You can do this by right-clicking the reference and selecting Make local.

 

Shared archives

A shared archive is a mechanism for grouping components of a project in a way that can be easily shared amongst other projects. Shared archives may contain files, libraries, tasks, and local archives. You create a shared archive by right-clicking blank space in the Diamond source view and selecting Create shared archive.

 

Local archives

A local archive is a mechanism for grouping files. It has no other significance than to allow you to hold a number of files in one place and deal with them as a unit, for example, to copy them or to make references to them. You can create one by right-clicking a task, library or other archive and selecting Create local archive.

 

Options

You can set options that are specific to a file by right-clicking the file name and selecting Options. The available options depend on the type of the file. For a C source file you can give a string that is added to the end of the compiler's command line each time the file is compiled. This is most often used to define macros.

FileOptionsDialog

Note that these options are technology-dependent; moving the file to a different type of processor gives you a new set of options.