2 '**********************************************************************
8 ' Macros for Microsoft Visual Studio.
10 ' @comm To install this file go to Tools->Customize->Macro Files->Browse...
12 '**********************************************************************
16 '@bsub Add an IDL file into all build projects in the current workspace.
17 '@comm This routine also sets up the custom build options require for the TAO
18 'CORBA implementation. The use can select to create a new file or just add a reference
19 'to the project (e.g. if a file already exists).If a new file is created, then a
20 'basic outline for an OMG module or interface declaration is inserted. Note that the inline
21 'file extension is defined by INLINE_EXTENSION.
24 'DESCRIPTION: Add new IDL File with TAO custom build entries to all build projects in the workspace.
28 'Define the extension used for inline files here
29 INLINE_EXTENSION = "inl"
31 WkSpaceDir = Application.CurrentDirectory
32 ModuleName = InputBox("module (namespace or extensionless IDL filename):")
34 WkSpaceDir=InputBox("Directory for IDL file: ","Output Directory",WkSpaceDir)
40 if Right(WkSpaceDir,1) <> "\" then
41 WkSpaceDir=WkSpaceDir+"\"
44 IDLFile = WkSpaceDir+FileName +".idl"
46 'Try to a file with this path/name
47 Documents.Open IDLFile
49 'If such a file already exists then it should now be the active doc
50 if ActiveDocument.Fullname = IDLFile then
52 if msgbox("Overwrite the existing file ?",vbYesNo) = vbNo then
55 'Close the file before we modify it
63 'If NewFile is set to 1 then create the outline for a OMG IDL module
65 InterfaceName = InputBox("interface:")
67 if msgbox("Include a module ("+ ModuleName+") declaration",vbYesNo) = vbYes then
68 Descr = vbLF + vbLF + "#if !defined (_" + UCase(ModuleName) + "_IDL)" + vbLF + _
69 "#define _" + UCase(ModuleName) + "_IDL" + vbLF +vbLF + _
70 "//"+vbLF+"//" +vbLF + "module " + ModuleName + " {" +vbLF + _
72 " interface " + InterfaceName + "{"+vbLF + _
73 " //Definitions"+ vbLF + vbLF+ vbLF + _
74 " //Operations"+ vbLF + vbLF+ vbLF + _
75 " //Properties"+ vbLF+ vbLF + _
76 " };"+vbLF + "};"+vbLF +vbLF + _
77 "#endif /* _"+ UCase(ModuleName) +"_IDL */"+vbLF
79 Descr = vbLF + vbLF + "#if !defined (_" + UCase(ModuleName) + "_IDL)" + vbLF + _
80 "#define _" + UCase(ModuleName) + "_IDL" + vbLF +vbLF + _
83 " interface " + InterfaceName + "{"+vbLF + _
84 " //Definitions"+ vbLF + vbLF+ vbLF + _
85 " //Operations"+ vbLF + vbLF+ vbLF + _
86 " //Properties"+ vbLF+ vbLF + _
88 "#endif /* _"+ UCase(ModuleName) +"_IDL */"+vbLF
91 CreateCppFile IDLFile, Descr
95 ' Add the files to each project
96 'Note that the inline files do not need to be added
97 for each proj in Projects
98 if msgbox("Add "+ IDLFile +" and the IDL compiler output files to "+ proj +" ?",vbYesNo) = vbYes then
99 ProjectPath= Left(proj.FullName,InStrRev(proj.FullName,"\")-1)
102 proj.AddFile WkSpaceDir+ModuleName + "C.cpp"
103 proj.AddFile WkSpaceDir+ModuleName + "C.h"
104 proj.AddFile WkSpaceDir+ModuleName + "S.cpp"
105 proj.AddFile WkSpaceDir+ModuleName + "S.h"
106 proj.AddFile WkSpaceDir+ModuleName + "S_T.cpp"
107 proj.AddFile WkSpaceDir+ModuleName + "S_T.h"
110 ' Add the custom build for each configuration in each project
111 If proj.Type = "Build" Then
112 Commands="%ACE_ROOT%\bin\tao_idl.exe -ci C."+ INLINE_EXTENSION +" -si S.inl -st S_T."+ INLINE_EXTENSION +" " + IDLFile
113 Output = "$(InputName)C.cpp" + vbLF + _
114 "$(InputName)C.h" + vbLF + _
115 "$(InputName)C."+ INLINE_EXTENSION +"" + vbLF + _
116 "$(InputName)S.cpp" + vbLF + _
117 "$(InputName)S.h" + vbLF + _
118 "$(InputName)S."+ INLINE_EXTENSION +"" + vbLF + _
119 "$(InputName)S_T.cpp" + vbLF + _
120 "$(InputName)S_T.h" + vbLF + _
121 "$(InputName)S_T."+ INLINE_EXTENSION +""
123 for each cfg in proj.Configurations
124 cfg.AddCustomBuildStepToFile IDLFile, Commands, Output, "Running the TAO IDL Compiler on $(InputPath)..."
135 '@bsub Creates a C/C++ file.
136 '@comm This routine will create a C or C++ source file f, with content c.
137 'The new file will become the active doc.
139 Function CreateCppFile(byval f, byval c)
140 'DESCRIPTION: Creates a .cpp file.
144 ActiveDocument.Language = "C/C++"
145 ActiveDocument.Selection = c
146 ActiveDocument.Selection.NewLine
147 ActiveDocument.Save f