[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.] The MyC project contributes a reference-based project to the environment that is a more specialized project than Basic Project Sample. The MyC project expands upon the fundamental features of Basic Project by providing a new type of project item: the .myc source file that consists of code for a language called MyC. The MyC language represents a small subset of the C language. A .myc source file is compiled with the Myce compiler provided with the sample. Property pages contain information passed to the Myce compiler. The pages identify which .myc file to build and which options to pass to the Myce compiler.
Note |
|---|
| The My C Project sample contains some working source files with which you can test the My C compiler. The default location of the source files is <drive>:\Program Files\Visual Studio 2005 SDK\<build number>\VisualStudioIntegration\Archive\MyCPkgs\MyCC\Tests. |
Security Note |
|---|
| This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended. |
The MyC project demonstrates integration of a language service into Visual Studio using the default implementation of the IBabelService Interface. To customize the language service, the default implementation only requires lexical and grammar specifications for the language.
To build the MyC language service part of the sample, you must use version 1.24 or later of Bison and version 2.5.4a or later of Flex. For more information about Babel, see Using the Babel Package.
The MyC project includes the expression evaluator (MyCEE) part of the sample. It is located in MyCPkgs\MyCEE. The sample parts for MyCEE are:
-
MyCPrj - a reference-based project
-
MyC compiler (placed in MyCPkgs\Mycc)
-
MyCEE - MyC Expression Evaluator
In addition, a language service (based on Babel) for MyC language is provided in babel\MyCLangService. For a Language Specification and a Backus-Naur Form (BNF) grammar of the MyC language, see the <drive>:\Program Files\Microsoft Visual Studio\FrameworkSDK\Tool Developers Guide\Samples\Myc\Doc folder on the VSIP CD-ROM.
To see the language service, go to <drive>:\Program Files\Visual Studio 2005 SDK\<build number>\VisualStudioIntegration\Archive\Babel\Samples\MyCLangService, open bservice.sln, and build it. Building the MyCPkgs sample solution does not build or register the language service, by design.
You must provide your own lex/yacc-compatible tools. They are not included in the VSIP builds and the language service project will not build without them.
The sample also enables debugging of the generated executable. Support for debugging is part of the Visual Studio Debugging SDK.
This sample depends on the implementation helper HierUtil7.
Note |
|---|
| The default location of the MyCPkgs sample is <drive>:\Program Files\Visual Studio 2005 SDK\<build number>\VisualStudioIntegration\Archive\MyCPkgs. |
To build this sample
-
Start Visual Studio. Type devenv.exe at the command line.
-
Open the MyCPkgs.sln within Visual Studio.
-
On the Build menu, choose Rebuild Solution.
-
Run devenv.exe /setup /rootsuffix exp at the command line to merge the command bars and other UI items.
To run this sample
-
Start Visual Studio using the experimental build by typing devenv.exe /rootsuffix exp at the command line.
-
On the File menu, select New, and then click Project.
-
Expand the Other Projects node in the New Project dialog box.
-
Select MyC Project and click OK to open the project.
Once you have built the sample, you can:
-
Create MyC Project files (.mycp).
-
Expose a hierarchy of buildable project items.
-
Add new project items (.myc files) through the Add Item dialog box.
-
Open and persist project items.
-
Cut, copy, and paste items into the project hierarchy.
-
Drag items to the project.
-
Use the Context menu.
-
View project items in the Properties window.
-
Change project configuration settings by clicking Property Pages on the View menu, or by clicking Properties in the Project Context menu.
-
Proffer an automation model for the MyC VSPackage, thus enabling writing macros or add-ins against the project items as well as against the Build, Run, and Deploy configuration options.
-
Persist state information for Visual Studio.
-
Work seamlessly with other projects through the solution.
-
Build a .myc file with the Myce compiler according to the options specified in the Configuration property pages.
Note |
|---|
| The My C Project sample contains some working source files with which you can test the My C compiler. The default location of the source files is <drive>:\Program Files\Visual Studio 2005 SDK\<build number>\VisualStudioIntegration\Archive\MyCPkgs\MyCC\Tests. |
-
Debug the generated executable.
-
Enable project configurations you define that allow the user to add, remove, and rename a project configuration.
-
Participate in deployment operations.
-
Implement project startup services that allow a third-party VSPackage to delay loading.
Note |
|---|
| MyC Package does not support a project-specific editor. Instead, it opens items in accord with the appropriate project independent editor for a file type. |
The following table lists the interfaces that are implemented by the sample.
|
Implemented Interfaces
|
| IDataObject |
| IDispatch |
| IEnumProjectStartupServices |
| IOleCommandTarget |
| IPersistFileFormat |
| IPropertyPage |
| IServiceProvider |
| ISpecifyPropertyPages |
| IVsBuildableProjectCfg |
| IVsCfg |
| IVsCfgProvider2 |
| IVsDebuggableProjectCfg |
| IVsEnumOutputs |
| IVsGetCfgProvider |
| IVsHierarchy |
| IVsHierarchyDeleteHandler |
| IVsHierarchyDropDataSource |
| IVsHierarchyDropDataTarget |
| IVsHierarchyEvents |
| IVsLaunchPadEvents |
| IVsLibrary |
| IVsLibraryMgr |
| IVsLiteTreeList |
| IVsObjectList |
| IVsOutput2 |
| IVsOutputGroup |
| IVsPackage |
| IVsPersistHierarchyItem |
| IVsProject |
| IVsProjectCfg2 |
| IVsProjectCfgProvider |
| IVsProjectFactory |
| IVsProjectStartupServices |
| IVsSccProject2 |
| IVsSolutionEvents |
| IVsUIHierWinClipboardHelperEvents |
| IVsUIHiearchy |
The following table lists the interfaces that are called by the sample and their associated services.
|
Called Interfaces
|
Associated Services
|
| IOleCommandTarget | SUIHostCommandDispatcher |
| IVsAddProjectItemDlg | SVsAddProjectItemDlg |
| IVsBuildStatusCallback | |
| IVsCodeWindow | |
| IVsDebugger | SVsShellDebugger |
| IVsExtensibility | SVsExtensibility |
| IVsHierarchy | |
| IVsLaunchPad | SVsLaunchPadFactory |
| IVsMonitorSelection | SVsShellMonitorSelection |
| IVsMultiItemSelect | |
| IVsObjectBrowserDescription2 | |
| IVsObjectManager | SVsObjectManager |
| IVsOutputWindowPane | |
| IVsProject3 | |
| IVsPropertyFileIn | |
| IVsPropertyFileOut | |
| IVsPropertyStreamIn | |
| IVsPropertyStreamOut | |
| IVsRegisterProjectTypes | SVsRegisterProjectTypes |
| IVsRunningDocumentTable | SVsRunningDocumentTable |
| IVsSccManager2 | SVsSccManager |
| IVsShell | SVsShell |
| IVsSolution | SVsSolution |
| IVsSolutionDebuggingAssistant2 | SVsSolutionDebuggingAssistant2 |
| IVsStatusbar | SVsStatusbar |
| IVsStructuredFileIO | SVsStructuredFileIO |
| IVsTextView | |
| IVsTrackProjectDocuments | SVsTrackProjectDocuments |
| IVsQueryEditQuerySave | SVsQueryEditQuerySave |
| IVsUIHierarchy | |
| IVsUIHierarchyWindow | |
| IVsUIHierWinClipboardHelper | SVsUIHierWinClipboardHelper |
| IVsUIShell | SVsUIShell |
| IVsUIShellOpenDocument | SVsUIShellOpenDocument |
| IVsWindowFrame | |
The following table lists the important MyCPrj files.
|
Source File
|
Description
|
| Browser.cpp | Class view and object browser support |
| BuildPPG.cpp | Build property page implementation |
| BuildPPG.rgs | Build property page registration |
| CfgProvider.cpp | IVsProjectCfgProvider and IVsCfgProvider2 implementation |
| DebugPPG.cpp | Debug property page implementation |
| DebugPPG.rgs | Debug property page registration |
| VsEnumOutputs.cpp | IVsEnumOutputs implementation |
| VsLibrary.cpp | IVsLibrary implementation |
| VsLibraryMgr.cpp | IVsLibraryMgr implementation |
| VsObjectList.cpp | IVsObjectList implementation |
| VsOutput.cpp | IVsOutput and IVsOutput2 implementation |
| VsOutputGroup.cpp | IVsOutputGroup implementation |
| VsProjectStartupServices.cpp | IVsProjectStartupServices implementation |
See Also