Пример #1
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            EnterElement();
            ih.AppendLine("[");
            var lprops = _data.Attributes;

            for (var i = 0; i < lprops.Count; ++i)
            {
                ih.AppendLine("  " + lprops[i] + (i < (lprops.Count - 1) ? "," : ""));
            }
            ih.AppendLine("]");

            if (_ta.cImplTypes > 0)
            {
                _ti.GetRefTypeOfImplType(0, out var href);
                _ti.GetRefTypeInfo(href, out var ti2);
                ih.AddString($"{_data.Name} : ");
                ih.AddLink(ti2.GetName(), "i");
                ih.AppendLine(" {");
            }
            else
            {
                ih.AppendLine("interface " + _data.Name + " {");
            }
            using (new IDLHelperTab(ih))
            {
                Children.ForEach(x => x.BuildIDLInto(ih));
            }
            ih.AppendLine("};");
            ExitElement();
        }
Пример #2
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            EnterElement();
            var lprops = _data.Attributes;

            if (lprops.Count > 0)
            {
                ih.AddString("[" + string.Join(", ", lprops.ToArray()) + "] ");
            }
            var attr = _ti.GetTypeAttr();

            if (TypeAttr.TypeFlags.TYPEFLAG_FDUAL != (attr.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FDUAL) &&
                TypeAttr.TypeKind.TKIND_DISPATCH == (attr.typekind & TypeAttr.TypeKind.TKIND_DISPATCH))
            {
                ih.AddString("dispinterface ");
                ih.AddLink(_data.ShortName, "di");
            }
            else
            {
                ih.AddString("interface ");
                ih.AddLink(_data.ShortName, "i");
            }
            ih.AppendLine(";");

            ExitElement();
        }
Пример #3
0
        public void BuildIDLInto(IDLFormatter ih, bool embedded)
        {
            var memIdInSpecialRange = (_vd.memid >= 0x60000000 && _vd.memid < 0x60020000);
            var lprops = new List <string>();

            if (!memIdInSpecialRange)
            {
                lprops.Add("id(" + _vd.memid.PaddedHex() + ")");
            }
            var help = _ti.GetHelpDocumentationById(_vd.memid, out var context);

//            if (0 != (_vd.wFuncFlags & FuncDesc.FuncFlags.FUNCFLAG_FRESTRICTED)) lprops.Add("restricted");
//            if (0 != (_vd.wFuncFlags & FuncDesc.FuncFlags.FUNCFLAG_FHIDDEN)) lprops.Add("hidden");
            AddHelpStringAndContext(lprops, help, context);
            ih.AppendLine("[" + string.Join(", ", lprops.ToArray()) + "] ");
            // Prototype in a different line.
            var ed = _vd.elemDescVar;

            ed.tdesc.ComTypeNameAsString(_ti, ih);
//            if (memIdInSpecialRange)
//            {
//                ih.AddString(" " + _fd.callconv.ToString().Substring(2).ToLower());
//            }
            ih.AppendLine(" " + _name + ";");
        }
Пример #4
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            EnterElement();
            var tde = "typedef ";

            // If the enum has a uuid, or a version associate with it, we provide that information on the same line.
            if (_data.Attributes.Count > 0)
            {
                var lprops = _data.Attributes;
                if (_ta.guid == Guid.Empty)
                {
                    var rs = lprops.Where(p => p.StartsWith("uuid")).ToList();
                    foreach (var s in rs)
                    {
                        lprops.Remove(s);
                    }
                }
                tde += "[" + string.Join(",", lprops) + "]";
                ih.AppendLine(tde);
                tde = string.Empty;
            }

            ih.AppendLine(tde + "enum " + _data.ShortName + "{");
            using (new IDLHelperTab(ih))
            {
                var idx = 0;
                Children.ForEach(x => ((OWEnumValue)x).BuildIDLInto(ih, true, ++idx == _ta.cVars));
            }
            // Redundant but necessary to ensure MIDL will compile enum correctly without making up fake names that'll confuse object browsers
            ih.AppendLine("} " + _data.ShortName + ";");
            ExitElement();
        }
Пример #5
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            EnterElement();
            ih.AppendLine("[");
            var lprops = _data.Attributes;

            for (var i = 0; i < lprops.Count; ++i)
            {
                ih.AppendLine("  " + lprops[i] + (i < (lprops.Count - 1) ? "," : ""));
            }
            ih.AppendLine("]");

            ih.AppendLine(_data.Name + " {");

            //if (_ta.cFuncs > 0 || _ta.cVars > 0)
            //{
            // Naughty, but rely on side effect of verifying children.
            using (new IDLHelperTab(ih))
            {
                _propChildren.BuildIDLInto(ih);
                _methodChildren.BuildIDLInto(ih);
            }
            //}
            ih.AppendLine("};");
            ExitElement();
        }
Пример #6
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            EnterElement();
            ih.AppendLine("[");
            var lprops = _data.Attributes;

            for (var i = 0; i < lprops.Count; ++i)
            {
                ih.AppendLine("  " + lprops[i] + (i < (lprops.Count - 1) ? "," : ""));
            }
            ih.AppendLine("]");
            ih.AppendLine(_data.Name + " {");
            using (new IDLHelperTab(ih))
            {
                for (var x = 0; x < _ta.cImplTypes; ++x)
                {
                    _ti.GetRefTypeOfImplType(x, out var href);
                    _ti.GetRefTypeInfo(href, out var ti2);
                    _ti.GetImplTypeFlags(x, out var itypflags);

                    var memInterface = new OWCoClassInterface(this, ti2, itypflags);
                    memInterface.BuildIDLInto(ih);
                }
            }
            ih.AppendLine("};");
            ExitElement();
        }
Пример #7
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            EnterElement();
            var lprops = _data.Attributes;

            ih.AppendLine("typedef [" + string.Join(", ", lprops.ToArray()) + "] " + _data.ShortName + ";");
            ExitElement();
        }
Пример #8
0
 public override void BuildIDLInto(IDLFormatter ih)
 {
     ih.AppendLine("typedef struct tag" + _name + " {");
     using (new IDLHelperTab(ih))
     {
         Children.ForEach(x => x.BuildIDLInto(ih));
     }
     ih.AppendLine("} " + _name + ";");
 }
Пример #9
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            var meths = Children.Select(x => x as OWMethod).ToList();

            ih.AppendLine("methods:");
            if (meths.Count > 0)
            {
                using (new IDLHelperTab(ih)) meths.ForEach(x => x.BuildIDLInto(ih, true));
            }
        }
Пример #10
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            var props = Children.ToList().ConvertAll(x => x as OWDispProperty);

            ih.AppendLine("properties:");
            if (props.Count > 0)
            {
                using (new IDLHelperTab(ih)) props.ForEach(x => x.BuildIDLInto(ih, true));
            }
        }
Пример #11
0
 public override void BuildIDLInto(IDLFormatter ih)
 {
     EnterElement();
     ih.AppendLine(_data.Name + " {");
     using (new IDLHelperTab(ih))
     {
         Children.ForEach(x => x.BuildIDLInto(ih));
     }
     ih.AppendLine("} " + _data.ShortName + ";");
     ExitElement();
 }
Пример #12
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            ih.AppendLine("[");
            var lprops = new List <string> {
                $"uuid({_ta.guid})"
            };
            var help = _ti.GetHelpDocumentationById(-1, out var context);

            AddHelpStringAndContext(lprops, help, context);
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FHIDDEN))
            {
                lprops.Add("hidden");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FDUAL))
            {
                lprops.Add("dual");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FRESTRICTED))
            {
                lprops.Add("restricted");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FNONEXTENSIBLE))
            {
                lprops.Add("nonextensible");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FOLEAUTOMATION))
            {
                lprops.Add("oleautomation");
            }
            for (var i = 0; i < lprops.Count; ++i)
            {
                ih.AppendLine("  " + lprops[i] + (i < (lprops.Count - 1) ? "," : ""));
            }
            ih.AppendLine("]");

            if (_ta.cImplTypes > 0)
            {
                _ti.GetRefTypeOfImplType(0, out var href);
                _ti.GetRefTypeInfo(href, out var ti2);
                ih.AddString($"interface {_name} : ");
                ih.AddLink(ti2.GetName(), "i");
                ih.AppendLine(" {");
            }
            else
            {
                ih.AppendLine("interface " + _name + " {");
            }
            using (new IDLHelperTab(ih))
            {
                Children.ForEach(x => x.BuildIDLInto(ih));
            }
            ih.AppendLine("};");
        }
Пример #13
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            ih.AppendLine("[");
            var lprops = new List <string> {
                "uuid(" + _ta.guid + ")"
            };
            var help = _ti.GetHelpDocumentationById(-1, out var context);

            AddHelpStringAndContext(lprops, help, context);
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FHIDDEN))
            {
                lprops.Add("hidden");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FDUAL))
            {
                lprops.Add("dual");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FRESTRICTED))
            {
                lprops.Add("restricted");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FNONEXTENSIBLE))
            {
                lprops.Add("nonextensible");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FOLEAUTOMATION))
            {
                lprops.Add("oleautomation");
            }
            for (var i = 0; i < lprops.Count; ++i)
            {
                ih.AppendLine("  " + lprops[i] + (i < (lprops.Count - 1) ? "," : ""));
            }
            ih.AppendLine("]");

            ih.AppendLine("dispinterface " + _name + " {");

            if (_ta.cFuncs > 0 || _ta.cVars > 0)
            {
                // Naughty, but rely on side effect of verifying children.
                using (new IDLHelperTab(ih))
                {
                    _propChildren?.BuildIDLInto(ih);
                    _methodChildren?.BuildIDLInto(ih);
                }
            }
            ih.AppendLine("};");
        }
Пример #14
0
        public void BuildIDLInto(IDLFormatter ih, bool embedded, bool islast)
        {
            var desc = "";

            //int cnt = 0;
            //String help = _ti.GetHelpDocumentationById(_idx, out cnt);
            //List<String> props = new List<string>();
            //AddHelpStringAndContext(props, help, cnt);
            //if (props.Count > 0)
            //{
            //    desc += "[" + String.Join(",", props.ToArray()) + "] ";
            //}
            desc += _val is int i?negStr(i) : _val.ToString();

            ih.AppendLine("const " + _name + " = " + desc + (embedded ? (islast ? "" : ",") : ";"));
        }
Пример #15
0
        public void BuildIDLInto(IDLFormatter ih, bool embedded)
        {
            EnterElement();
            var lprops = _data.Attributes;

            ih.AppendLine("[" + string.Join(", ", lprops.ToArray()) + "] ");
            // Prototype in a different line.
            var ed = _vd.elemDescVar;

            ed.tdesc.ComTypeNameAsString(_ti, ih);
//            if (memIdInSpecialRange)
//            {
//                ih.AddString(" " + _fd.callconv.ToString().Substring(2).ToLower());
//            }
            ih.AppendLine(" " + _data.Name + ";");
            ExitElement();
        }
Пример #16
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            ih.AppendLine("[");
            var lprops = new List <string> {
                $"uuid({_ta.guid})"
            };
            var help = _ti.GetHelpDocumentationById(-1, out var context);

            AddHelpStringAndContext(lprops, help, context);
            for (var i = 0; i < lprops.Count; ++i)
            {
                ih.AppendLine("  " + lprops[i] + (i < (lprops.Count - 1) ? "," : ""));
            }
            ih.AppendLine("]");
            ih.AppendLine("coclass " + _name + " {");
            using (new IDLHelperTab(ih))
            {
                for (var x = 0; x < _ta.cImplTypes; ++x)
                {
                    _ti.GetRefTypeOfImplType(x, out var href);
                    _ti.GetRefTypeInfo(href, out var ti2);
                    _ti.GetImplTypeFlags(x, out var itypflags);
                    var res = new List <string>();
                    if (0 != (itypflags & IMPLTYPEFLAGS.IMPLTYPEFLAG_FDEFAULT))
                    {
                        res.Add("default");
                    }
                    if (0 != (itypflags & IMPLTYPEFLAGS.IMPLTYPEFLAG_FSOURCE))
                    {
                        res.Add("source");
                    }

                    if (res.Count > 0)
                    {
                        ih.AddString("[" + string.Join(", ", res.ToArray()) + "] ");
                    }
                    ih.AddString("interface ");
                    ih.AddLink(ti2.GetName(), "i");
                    ih.AppendLine(";");
                }
            }
            ih.AppendLine("};");
        }
Пример #17
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            var tde = "typedef ";

            // If the enum has a uuid, or a version associate with it, we provide that information on the same line.

            if (!_ta.guid.Equals(Guid.Empty))
            {
                tde += "[uuid(" + _ta.guid + "), version(" + _ta.wMajorVerNum + "." + _ta.wMinorVerNum + ")]";
                ih.AppendLine(tde);
                tde = "";
            }
            ih.AppendLine(tde + "enum {");
            using (new IDLHelperTab(ih))
            {
                var idx = 0;
                Children.ForEach(x => ((OWEnumValue)x).BuildIDLInto(ih, true, ++idx == _ta.cVars));
            }
            ih.AppendLine("} " + _name + ";");
        }
Пример #18
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            if (_ta.cFuncs == 0)
            {
                ih.AppendLine("// NOTE: This module has no entry points. There is no way to");
                ih.AppendLine("//       extract the dllname of a module with no entry points!");
                ih.AppendLine("// ");
            }
            ih.AppendLine("[");
            var liba = new List <string>
            {
                "dllname(\"" + (string.IsNullOrEmpty(_dllname) ? "<no entry points>" : _dllname) + "\")"
            };

            if (_ta.guid != Guid.Empty)
            {
                liba.Add("uuid(" + _ta.guid + ")");
            }
            var help = _ti.GetHelpDocumentationById(-1, out var cnt);

            if (!string.IsNullOrEmpty(help))
            {
                liba.Add("helpstring(\"" + help + "\")");
            }
            if (cnt != 0)
            {
                liba.Add("helpcontext(" + cnt.PaddedHex() + ")");
            }

            cnt = 0;
            liba.ForEach(x => ih.AppendLine("  " + x + (++cnt == liba.Count ? "" : ",")));
            ih.AppendLine("]");
            ih.AppendLine("module " + _name + " {");
            using (new IDLHelperTab(ih))
            {
                Children.ForEach(x => x.BuildIDLInto(ih));
            }
            ih.AppendLine("};");
        }
Пример #19
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            EnterElement();
            if (_ta.cFuncs == 0)
            {
                ih.AppendLine("// NOTE: This module has no entry points. There is no way to");
                ih.AppendLine("//       extract the dllname of a module with no entry points!");
                ih.AppendLine("// ");
            }
            ih.AppendLine("[");
            var liba = _data.Attributes;
            var cnt  = 0;

            liba.ForEach(x => ih.AppendLine("  " + x + (++cnt == liba.Count ? "" : ",")));
            ih.AppendLine("]");
            ih.AppendLine(_data.Name + " {");
            using (new IDLHelperTab(ih))
            {
                Children.ForEach(x => x.BuildIDLInto(ih));
            }
            ih.AppendLine("};");
            ExitElement();
        }
Пример #20
0
 public override void BuildIDLInto(IDLFormatter ih)
 {
     ih.AppendLine("");
 }
Пример #21
0
        public void BuildIDLInto(IDLFormatter ih, bool bAsDispatch)
        {
            EnterElement();
            var lprops = _data.Attributes;

            ih.AppendLine("[" + string.Join(", ", lprops.ToArray()) + "] ");
            // Prototype in a different line.
            var ed = _fd.elemdescFunc;

            Action <int> paramtextgen   = null;
            ElemDesc     elast          = null;
            var          bRetvalPresent = false;

            if (_fd.cParams > 0)
            {
                var names = _fd.GetNames(_ti);
                var edps  = _fd.elemdescParams;
                if (edps.Length > 0)
                {
                    elast = edps[edps.Length - 1];
                }
                if (bAsDispatch && elast != null && 0 != (elast.paramdesc.wParamFlags & ParamDesc.ParamFlags.PARAMFLG_FRETVAL))
                {
                    bRetvalPresent = true;
                }
                // ReSharper disable once UnusedVariable
                var maxCnt = (bAsDispatch && bRetvalPresent) ? _fd.cParams - 1 : _fd.cParams;

                paramtextgen = x =>
                {
                    var paramname = names[x + 1] ?? "rhs";
                    var edp       = edps[x];
                    ih.AddString(ParamFlagsDescription(edp.paramdesc) + " ");
                    edp.tdesc.ComTypeNameAsString(_ti, ih);
                    ih.AddString(" " + paramname);
                };
            }
            (bRetvalPresent ? elast : ed).tdesc.ComTypeNameAsString(_ti, ih);
            if (MemIdInSpecialRange)
            {
                ih.AddString(" " + _fd.callconv.ToString().Substring(2).ToLower());
            }
            ih.AddString($" {_data.Name}");
            switch (_fd.cParams)
            {
            case 0:
                ih.AppendLine("();");
                break;

            case 1:
                ih.AddString("(");
                paramtextgen?.Invoke(0);
                ih.AppendLine(");");
                break;

            default:
                ih.AppendLine("(");
                using (new IDLHelperTab(ih))
                {
                    for (var y = 0; y < _fd.cParams; ++y)
                    {
                        paramtextgen?.Invoke(y);
                        ih.AppendLine(y == _fd.cParams - 1 ? "" : ",");
                    }
                }
                ih.AppendLine(");");
                break;
            }
            ExitElement();
        }
Пример #22
0
 public override void BuildIDLInto(IDLFormatter ih)
 {
     BuildIDLInto(ih, false);
 }
Пример #23
0
 public override void BuildIDLInto(IDLFormatter ih)
 {
     Children.ForEach(x => x.BuildIDLInto(ih));
 }
Пример #24
0
 public abstract void BuildIDLInto(IDLFormatter ih);
Пример #25
0
 public override void BuildIDLInto(IDLFormatter ih)
 {
     EnterElement();
     BuildIDLInto(ih, false, false);
     ExitElement();
 }
Пример #26
0
 public override void BuildIDLInto(IDLFormatter ih)
 {
     EnterElement();
     Children.ForEach(x => x.BuildIDLInto(ih));
     ExitElement();
 }
Пример #27
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            // Header for type library, followed by a first pass to pre-declare
            // interfaces.
            // dispinterfaces aren't shown seperately.

            ih.AppendLine("// Generated .IDL file (by OleWoo)");
            ih.AppendLine("[");
            var liba = new List <string>();

            using (var tla = new TypeLibAttr(_tlib))
            {
                liba.Add($"uuid({tla.guid})");
                liba.Add($"version({tla.wMajorVerNum}.{tla.wMinorVerNum})");
            }
            var cds = new CustomDatas(_tlib as ITypeLib2);
            {
                foreach (var cd in cds.Items)
                {
                    liba.Add("custom(" + cd.guid + ", " + ITypeInfoXtra.QuoteString(cd.varValue) + ")");
                }
            }
            var help = _tlib.GetHelpDocumentation(out var cnt);

            if (!string.IsNullOrEmpty(help))
            {
                liba.Add($"helpstring(\"{help}\")");
            }
            if (cnt != 0)
            {
                liba.Add($"helpcontext({cnt.PaddedHex()})");
            }

            cnt = 0;
            liba.ForEach(x => ih.AppendLine("  " + x + (++cnt == liba.Count ? "" : ",")));
            ih.AppendLine("]");
            ih.AppendLine("library " + ShortName);
            ih.AppendLine("{");
            using (new IDLHelperTab(ih))
            {
                // How do I know I'm importing stdole2??!
                // Forward declare all interfaces.
                ih.AppendLine("// Forward declare all types defined in this typelib");

                /*
                 * Need to collect all dumpable interface names, in case we have dispinterfaces which don't have
                 * top level interfaces.  In THIS case, we'd dump the dispinterface.
                 */
                var interfaceNames = Children.Aggregate <ITlibNode, ICollection <string> >(new HashSet <string>(),
                                                                                           (x, y) =>
                {
                    if ((y as OWInterface) != null)
                    {
                        x.Add(y.ShortName);
                    }
                    return(x);
                });
                Children.FindAll(x => ((x as OWInterface) != null || (x as OWDispInterface) != null)).ForEach(
                    x => ih.AppendLine(x.Name)
                    );
                Children.FindAll(x => x.DisplayAtTLBLevel(interfaceNames)).ForEach(
                    x => { x.BuildIDLInto(ih); ih.AppendLine(""); }
                    );
            }
            ih.AppendLine("};");
        }
Пример #28
0
 public void BuildIDLInto(IDLFormatter ih, bool embedded, bool islast)
 {
     ih.AppendLine("const int " + _ti.GetDocumentationById(_vd.memid) + " = " + negStr(_val) + (embedded ? (islast ? "" : ",") : ";"));
 }
Пример #29
0
 public override void BuildIDLInto(IDLFormatter ih)
 {
     EnterElement();
     ih.AppendLine("");
     ExitElement();
 }
Пример #30
0
 public override void BuildIDLInto(IDLFormatter ih)
 {
     ih.AppendLine("typedef [public] " + _name + ";");
 }