OLD | NEW |
1 #region Copyright notice and license | |
2 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
3 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
4 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
5 // | 4 // |
6 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
7 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
8 // met: | 7 // met: |
9 // | 8 // |
10 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
11 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
12 // * Redistributions in binary form must reproduce the above | 11 // * Redistributions in binary form must reproduce the above |
13 // copyright notice, this list of conditions and the following disclaimer | 12 // copyright notice, this list of conditions and the following disclaimer |
14 // in the documentation and/or other materials provided with the | 13 // in the documentation and/or other materials provided with the |
15 // distribution. | 14 // distribution. |
16 // * Neither the name of Google Inc. nor the names of its | 15 // * Neither the name of Google Inc. nor the names of its |
17 // contributors may be used to endorse or promote products derived from | 16 // contributors may be used to endorse or promote products derived from |
18 // this software without specific prior written permission. | 17 // this software without specific prior written permission. |
19 // | 18 // |
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
31 #endregion | |
32 | 30 |
33 using System.Reflection; | 31 #include <google/protobuf/pyext/message.h> |
34 using System.Runtime.CompilerServices; | |
35 using System.Security; | |
36 | 32 |
37 // General Information about an assembly is controlled through the following | 33 static const char module_docstring[] = |
38 // set of attributes. Change these attribute values to modify the information | 34 "python-proto2 is a module that can be used to enhance proto2 Python API\n" |
39 // associated with an assembly. | 35 "performance.\n" |
| 36 "\n" |
| 37 "It provides access to the protocol buffers C++ reflection API that\n" |
| 38 "implements the basic protocol buffer functions."; |
40 | 39 |
41 [assembly: AssemblyTitle("Google.Protobuf")] | 40 static PyMethodDef ModuleMethods[] = { |
42 [assembly: AssemblyDescription("")] | 41 {"SetAllowOversizeProtos", |
43 [assembly: AssemblyConfiguration("")] | 42 (PyCFunction)google::protobuf::python::cmessage::SetAllowOversizeProtos, |
44 [assembly: AssemblyCompany("")] | 43 METH_O, "Enable/disable oversize proto parsing."}, |
45 [assembly: AssemblyProduct("Google.Protobuf")] | 44 { NULL, NULL} |
46 [assembly: AssemblyCopyright("Copyright © 2015")] | 45 }; |
47 [assembly: AssemblyTrademark("")] | |
48 [assembly: AssemblyCulture("")] | |
49 | 46 |
50 #if !NCRUNCH | 47 #if PY_MAJOR_VERSION >= 3 |
51 [assembly: AllowPartiallyTrustedCallers] | 48 static struct PyModuleDef _module = { |
| 49 PyModuleDef_HEAD_INIT, |
| 50 "_message", |
| 51 module_docstring, |
| 52 -1, |
| 53 ModuleMethods, /* m_methods */ |
| 54 NULL, |
| 55 NULL, |
| 56 NULL, |
| 57 NULL |
| 58 }; |
| 59 #define INITFUNC PyInit__message |
| 60 #define INITFUNC_ERRORVAL NULL |
| 61 #else // Python 2 |
| 62 #define INITFUNC init_message |
| 63 #define INITFUNC_ERRORVAL |
52 #endif | 64 #endif |
53 | 65 |
54 #if SIGNED | 66 extern "C" { |
55 [assembly: InternalsVisibleTo("Google.Protobuf.Test, PublicKey=" + | 67 PyMODINIT_FUNC INITFUNC(void) { |
56 "002400000480000094000000060200000024000052534131000400000100010025800fbcfc6
3a1" + | 68 PyObject* m; |
57 "7c66b303aae80b03a6beaa176bb6bef883be436f2a1579edd80ce23edf151a1f4ced97af83a
bcd" + | 69 #if PY_MAJOR_VERSION >= 3 |
58 "981207041fd5b2da3b498346fcfcd94910d52f25537c4a43ce3fbe17dc7d43e6cbdb4d8f124
2dc" + | 70 m = PyModule_Create(&_module); |
59 "b6bd9b5906be74da8daa7d7280f97130f318a16c07baf118839b156299a48522f9fae2371c9
665" + | |
60 "c5ae9cb6")] | |
61 #else | 71 #else |
62 [assembly: InternalsVisibleTo("Google.Protobuf.Test")] | 72 m = Py_InitModule3("_message", ModuleMethods, |
| 73 module_docstring); |
63 #endif | 74 #endif |
| 75 if (m == NULL) { |
| 76 return INITFUNC_ERRORVAL; |
| 77 } |
64 | 78 |
65 [assembly: AssemblyVersion("3.0.0.0")] | 79 if (!google::protobuf::python::InitProto2MessageModule(m)) { |
66 [assembly: AssemblyFileVersion("3.0.0.0")] | 80 Py_DECREF(m); |
67 [assembly: AssemblyInformationalVersion("3.0.0-beta3")] | 81 return INITFUNC_ERRORVAL; |
| 82 } |
| 83 |
| 84 #if PY_MAJOR_VERSION >= 3 |
| 85 return m; |
| 86 #endif |
| 87 } |
| 88 } |
OLD | NEW |