In Dynamic C, a project is an environment that consists of opened source files, a BIOS file, available libraries, and the conditions under which the source files will be compiled. The File Open directory last used will be stored in the project filei. Projects allow different compilation environments to be separately maintained.
A project maintains a compilation environment in a file with the extension .dcp.
The environment originally shipped from the factory is kept in a project file named factory.dcp. If Dynamic C cannot find this file, it will be recreated automatically in the Dynamic C exe path. The factory project can be opened at any time and the environment changed and saved to another project name, but factory.dcp will not be changed by Dynamic C.
This default project file is originally a copy of factory.dcp and will be automatically recreated as such in the exe path if it cannot be found when Dynamic C opens. The default project will automatically become the active project with File | Project... | Close.
The default project is special in that the command line compiler will use it for default values unless another project file is specified with the -pf switch, in which case the settings from the indicated project will be used.
Please see Chapter 17 for more details on using the command line compiler.
Whenever a project is selected, the current project related data is saved to the closing project file, the new project settings become active, and the (possibly new) BIOS will automatically be recompiled prior to compiling a source file in the new environment.
The active project can be factory.dcp, default.dcp or any project you create with File | Project... | Save As... When Dynamic C opens, it retrieves the last used project, or the default project if being opened for the first time or if the last used project cannot be found.
If a project is closed with the File | Projects... | Close menu option, the default project, default.dcp, becomes the active project.
The active project file name, without path or extension, is always shown in the leftmost panel of the status bar at the bottom of the Dynamic C main window and is prepended to the Dynamic C version in the title bar except when the active project is the default project.
Changes made to the compilation environment of Dynamic C are automatically updated to the active project, unless the active project is factory.dcp.
Unless the active project is factory.dcp, changes made in the Project Options dialog will cause the active project file to be updated immediately:
Opening or closing files will not immediately update the active project file. The project file state of the recently used files appearing at the bottom of the File menu selection and any opened files in edit windows will only by updated when the project closes or when File | Projects... | Save is selected. The Message, Assembly, Memory Dump, Registers and Stack debug windows are not edit windows and will not be saved in the project file if you exit Dynamic C while debugging.
The menu selections for project files are available in the File menu. The choices are the familiar ones: Create..., Open..., Save, Save As... and Close.
Choosing File | Project | Open... will bring up a dialog box to select an existing project filename to become the active project. The environment of the previous project is saved to its project file before it is replaced (unless the previous project is factory.dcp). The BIOS will automatically be recompiled prior to the compilation of a source file within the new environment, which may have a different library directory file and/or a different BIOS file.
Choosing File | Project... | Save will save the state of the environment to the active project file, including the state of the recently used filelist and any files open in edit windows. This selection is greyed out if the active project is factory.dcp. This option is of limited use since any project changes will be updated immediately to the file and the state of the recently used filelist and open edit windows will be updated when the project is closed for any reason.
Choosing File | Project... | Save as... will bring up a dialog box to select a project file name. The file will be created or, if it exists, it will be overwritten with the current environment settings. This environment will also be saved to the active project file before it is closed and its copy (the newly created or overwritten project file) will become active.
Choosing File | Project... | Close first saves the environment to the active project file (unless the active project is factory.dcp) and then loads the Dynamic C default project, default.dcp, as the active project. As with Open..., the BIOS will automatically be recompiled prior to the compilation of a source file within the new environment. The new environment may have a different library directory file and/or a different BIOS file.
When using the command line compiler, dccl_cmp.exe, a project file is always read. The default project, default.dcp, is used automatically unless the project file switch, -pf, specifies another project file to use. The project settings are read by the command line compiler first even if a -pf switch comes after the use of other switches, and then all other switches used in the command line are read, which may modify any of the settings specified by the project file.
The default behavior given for each switch in the command line documentation is with reference to the factory.dcp settings, so the user must be aware of the default state the command line compiler will actually use. The settings of default.dcp can be shown by entering dccl_cmp alone on the command line. The defaults for any other project file can be shown by following dccl_cmp by a the project file switch without a source file. The command:
dccl_cmp
shows the current state of all default.dcp settings. The command:
dccl_cmp -pf myProject
shows the current state of all myProject.dcp settings. And the command:
dccl_cmp myProgram.c -ne 25 -pf myProject
reads myProject.dcp, then compiles and runs myProgram.c, showing a maximum of 25 errors.
The command line compiler, unlike Dynamic C, never updates the project file it uses. Any changes desired to a project file to be used by the command line compiler can be made within Dynamic C or changed by hand with an editor.
Making changes by hand should be done with caution. Use an editor that does not introduce carriage returns or line feeds with wordwrap, which may be a problem if the global defines or any file pathnames are lengthy strings. Be careful to not change any of the section names in brackets or any of the key phrases up to and including the “=.”
If a macro is defined on the command line with the -d switch, any value that may have been defined within the project file used will be overwritten without warning or error. Undefining a macro with the -d- switch has no consequence if it was not previously defined.
i. If DC is started with a cwd (current working directory) other than the exe directory, the cwd will be used instead of the one saved in the project file. This can happen if Dynamic C is started from a Windows shortcut with a specified “starts in” directory.