mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 01:41:18 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96c0883549 | ||
|
|
60b980b3bb | ||
|
|
3c84401ec8 | ||
|
|
44162b8a8b | ||
|
|
355944f0d6 | ||
|
|
9f4a644133 | ||
|
|
c83b0a3f98 | ||
|
|
b7422c2c22 | ||
|
|
c9e78b5322 | ||
|
|
7898a926f0 | ||
|
|
a3000fbb7f | ||
|
|
df4669b216 | ||
|
|
76db8b168c | ||
|
|
0f76c2acec | ||
|
|
1a431e6183 | ||
|
|
0e86b9e40b | ||
|
|
ce75ab6aed | ||
|
|
75367e0413 | ||
|
|
044b7d4ac8 | ||
|
|
707e9c6b03 | ||
|
|
ce9765ffe0 | ||
|
|
85d51db4f0 | ||
|
|
af502ec4df | ||
|
|
b72ef417bc | ||
|
|
bc699443c1 | ||
|
|
addce38b83 | ||
|
|
b2250d8ecf | ||
|
|
cfe2428963 | ||
|
|
e51d521ff9 | ||
|
|
d5885b1996 | ||
|
|
b429bfe794 | ||
|
|
48e94bd5f6 | ||
|
|
726b2befe9 | ||
|
|
bff4165b8d | ||
|
|
b4ec38c280 | ||
|
|
d5cfcd6b2a | ||
|
|
1ee454fce3 | ||
|
|
24775d13d4 | ||
|
|
934465474b | ||
|
|
8c1b959850 | ||
|
|
26c39f88fb | ||
|
|
92f7d7ac14 | ||
|
|
2636235a82 | ||
|
|
5267bcb2b7 | ||
|
|
d03c1a55e0 | ||
|
|
63798ae475 | ||
|
|
31c099d7ca | ||
|
|
ad9daeaf58 | ||
|
|
829534374f | ||
|
|
6ce90d742b | ||
|
|
28dcb2abb3 | ||
|
|
1438e3a015 | ||
|
|
b403e9b528 | ||
|
|
f02e94d25c | ||
|
|
c93b4d1722 | ||
|
|
5d37aa59b9 | ||
|
|
3c7e98aa62 | ||
|
|
0e2248ca22 | ||
|
|
ec43cc1dc4 | ||
|
|
3cd2ccce57 | ||
|
|
eaff739a03 | ||
|
|
742e703eb4 | ||
|
|
fe214b46bd | ||
|
|
c843b3f25f | ||
|
|
b5e1cb7236 | ||
|
|
47f6b08657 | ||
|
|
1d8c43241a | ||
|
|
90be24e928 | ||
|
|
34a97709ce | ||
|
|
632c5e8e1c | ||
|
|
b0527fafe3 | ||
|
|
e3a2754a33 | ||
|
|
0deb1fd312 | ||
|
|
3ffbfe94c9 | ||
|
|
51599d15b2 | ||
|
|
68fc0a509f | ||
|
|
6eaec1bb59 | ||
|
|
de06b9c866 | ||
|
|
ec16c55370 | ||
|
|
dcc1d41ffb | ||
|
|
d6af8351b4 | ||
|
|
c3c06baf61 | ||
|
|
c5a0d0e011 | ||
|
|
5e8d4de0f7 | ||
|
|
b4632e0789 | ||
|
|
141d8fafaa | ||
|
|
259864a1d3 | ||
|
|
3eb8d6d178 | ||
|
|
3deebbf487 | ||
|
|
0e486b814f | ||
|
|
04f45d88f9 | ||
|
|
fdd7beb707 | ||
|
|
0ec03cb37c | ||
|
|
03298038d7 | ||
|
|
310bba2a01 | ||
|
|
db62348438 | ||
|
|
f5040c4e67 | ||
|
|
1d366da8f0 | ||
|
|
ed0f1b4992 | ||
|
|
e9f63bbd97 | ||
|
|
640748df04 | ||
|
|
3f3e41781e | ||
|
|
74a8e56233 | ||
|
|
0e38c766cc | ||
|
|
73d4810c70 | ||
|
|
15bd67a390 | ||
|
|
6af040720f | ||
|
|
d7767d7f41 | ||
|
|
ba0a5b09ae | ||
|
|
94d9ccc8b7 | ||
|
|
759ae465ea | ||
|
|
c4c358fcb3 | ||
|
|
a88a2802d8 | ||
|
|
884e4bffa0 | ||
|
|
9417be0f11 | ||
|
|
c212bccc3d | ||
|
|
1dd426f94b | ||
|
|
fe021658d9 |
No files matched your search
+4
-10
@@ -1,6 +1,3 @@
|
||||
# diff settings
|
||||
*.cs diff=csharp
|
||||
|
||||
# ensure LF endings on all checkouts
|
||||
configure.ac crlf=input
|
||||
config.rpath crlf=input
|
||||
@@ -10,20 +7,17 @@ mkinstalldirs crlf=input
|
||||
*.sources crlf=input
|
||||
.gitattributes crlf=input
|
||||
*akefile* crlf=input
|
||||
m4/mono-output.m4 crlf=input
|
||||
|
||||
# ensure native line endings on checkout
|
||||
*.c crlf
|
||||
*.h crlf
|
||||
*.cs crlf
|
||||
*.il crlf
|
||||
*.sln crlf
|
||||
*.*proj* crlf
|
||||
|
||||
*.bat text eol=crlf
|
||||
*.cmd text eol=crlf
|
||||
|
||||
# don't do anything to line-endings. Let CRLFs/LFs go into the repo, and CRLF/LFs on checkout
|
||||
# don't do anything to line-endings. Let CRLFs go into the repo, and CRLF on checkout
|
||||
*.bat -crlf
|
||||
*.sln -crlf
|
||||
*.*proj* -crlf
|
||||
*.xml -crlf
|
||||
|
||||
# CRLF Handling
|
||||
|
||||
@@ -1,162 +0,0 @@
|
||||
# Mono Code Owners File
|
||||
#
|
||||
# GitHub uses this file to determine who to assign for reviews
|
||||
# on pull requests. Please keep this file alphabetically sorted.
|
||||
#
|
||||
# References:
|
||||
#
|
||||
# https://github.com/blog/2392-introducing-code-owners
|
||||
# https://help.github.com/articles/about-codeowners
|
||||
|
||||
|
||||
# These owners will be the default owners for everything in the repo.
|
||||
* @marek-safar
|
||||
|
||||
# Order is important. The last matching pattern has the most precedence.
|
||||
|
||||
/acceptance-tests @akoeplinger @kg
|
||||
/acceptance-tests/profiler-stress* @BrzVlad @akoeplinger
|
||||
|
||||
/data @directhex @akoeplinger
|
||||
/data/gdb @vargaz
|
||||
/data/lldb @vargaz
|
||||
|
||||
/docs @marek-safar @akoeplinger
|
||||
/docs/riscv.md @alexrp
|
||||
/docs/sources/mono-api-profiler.html @BrzVlad
|
||||
|
||||
/external @akoeplinger @marek-safar
|
||||
/external/api-snapshot @marek-safar @akoeplinger
|
||||
/external/binary-reference-assemblies @marek-safar @akoeplinger
|
||||
/external/bockbuild @akoeplinger @alexischr
|
||||
/external/boringssl @baulig
|
||||
/external/cecil @marek-safar @akoeplinger
|
||||
/external/corefx @akoeplinger @marek-safar @egorbo @steveisok
|
||||
/external/corert @akoeplinger @marek-safar @egorbo @steveisok
|
||||
/external/linker @marek-safar
|
||||
/external/llvm-project @SamMonoRT @vargaz @imhameed
|
||||
/external/nuget-buildtasks @radical @akoeplinger
|
||||
/external/roslyn-binaries @kg @marek-safar @akoeplinger @lewing
|
||||
|
||||
/libgc @BrzVlad @vargaz @naricc
|
||||
|
||||
/llvm @vargaz @SamMonoRT @imhameed
|
||||
|
||||
/man @marek-safar @miguel
|
||||
/man/*prof* @BrzVlad
|
||||
|
||||
/mcs @marek-safar @akoeplinger @egorbo
|
||||
|
||||
/mcs/build @marek-safar @akoeplinger
|
||||
|
||||
/mcs/class @steveisok @akoeplinger
|
||||
/mcs/class/corlib/System.Reflection*/ @vargaz @lambdageek
|
||||
/mcs/class/corlib/System.Security.Cryptography.X509Certificates @baulig @steveisok
|
||||
/mcs/class/Mono.Btls.Interface @baulig @steveisok
|
||||
/mcs/class/Mono.Data.Tds @egorbo
|
||||
/mcs/class/Mono.Debugger.Soft @vargaz @thaystg
|
||||
/mcs/class/Mono.Options @jonpryor @marek-safar
|
||||
/mcs/class/Mono.Profiler.Log @lambdageek
|
||||
/mcs/class/Mono.Security/Mono.Security/Interface @baulig @steveisok
|
||||
/mcs/class/System/Mono.AppleTls @baulig @rolf
|
||||
/mcs/class/System/Mono.Btls @baulig @marek-safar
|
||||
/mcs/class/System/Mono.Net.Security @baulig @steveisok
|
||||
/mcs/class/System/Mono.Security.Interface @baulig @steveisok
|
||||
/mcs/class/System/System.Security.Cryptography.X509Certificates @baulig @steveisok
|
||||
/mcs/class/System.Data* @egorbo @steveisok
|
||||
|
||||
/mcs/errors @marek-safar
|
||||
/mcs/ilasm @marek-safar
|
||||
/mcs/jay @marek-safar
|
||||
/mcs/mcs @marek-safar
|
||||
/mcs/tests @marek-safar
|
||||
|
||||
/mcs/tools @marek-safar @akoeplinger @steveisok
|
||||
/mcs/tools/gensources @kg @akoeplinger
|
||||
/mcs/tools/resx2sr @baulig
|
||||
/mcs/tools/upload-to-sentry @directhex @akoeplinger
|
||||
|
||||
/mono/arch @vargaz
|
||||
|
||||
/mono/btls @baulig @marek-safar
|
||||
/mono/dis @lambdageek @vargaz
|
||||
/mono/eglib @vargaz @lambdageek
|
||||
|
||||
/mono/benchmark @SamMonoRT
|
||||
|
||||
/mono/metadata @vargaz @lambdageek @thaystg
|
||||
/mono/metadata/*profiler* @lambdageek
|
||||
/mono/metadata/handle* @lambdageek @vargaz
|
||||
/mono/metadata/monitor* @brzvlad @vargaz
|
||||
/mono/metadata/sgen* @brzvlad @vargaz @naricc
|
||||
/mono/metadata/thread* @lateralusX @lambdageek
|
||||
/mono/metadata/w32* @lateralusX @lambdageek
|
||||
/mono/metadata/*-win* @lateralusX @lambdageek
|
||||
/mono/metadata/appdomain* @vargaz @lambdageek @CoffeeFlux
|
||||
/mono/metadata/assembly* @vargaz @lambdageek @CoffeeFlux
|
||||
/mono/metadata/domain* @vargaz @lambdageek @CoffeeFlux
|
||||
/mono/metadata/loader* @vargaz @lambdageek @CoffeeFlux
|
||||
/mono/metadata/native-library* @vargaz @lambdageek @CoffeeFlux
|
||||
/mono/metadata/*-unix* @lambdageek @CoffeeFlux
|
||||
|
||||
/mono/mini @vargaz @lambdageek @SamMonoRT
|
||||
/mono/mini/*cfgdump* @vargaz
|
||||
/mono/mini/*exceptions* @vargaz @BrzVlad
|
||||
/mono/mini/*ppc* @lewurm @vargaz
|
||||
/mono/mini/*riscv* @alexrp @lewurm
|
||||
/mono/mini/*type-check* @lambdageek
|
||||
/mono/mini/*llvm* @vargaz @imhameed
|
||||
/mono/mini/interp/* @BrzVlad
|
||||
/mono/mini/*profiler* @BrzVlad @lambdageek
|
||||
/mono/mini/debugger-agent.c @vargaz @thaystg @DavidKarlas @lambdageek
|
||||
|
||||
/mono/native @baulig @egorbo @alexischr @marek-safar
|
||||
|
||||
/mono/profiler @BrzVlad @lambdageek
|
||||
|
||||
/mono/sgen @BrzVlad @lambdageek
|
||||
|
||||
/mono/tools/offsets-tool @rolfbjarne
|
||||
|
||||
/mono/utils @vargaz @lambdageek
|
||||
/mono/utils/atomic* @vargaz
|
||||
/mono/utils/mono-hwcap* @vargaz
|
||||
/mono/utils/mono-mem* @vargaz
|
||||
/mono/utils/mono-merp* @alexischr @lambdageek
|
||||
/mono/utils/mono-state* @alexischr @lambdageek
|
||||
/mono/utils/mono-threads* @lambdageek @vargaz
|
||||
/mono/utils/*-win* @lateralusX @lambdageek
|
||||
|
||||
/msvc @lateralusX @kg @akoeplinger
|
||||
/msvc/scripts @akoeplinger @kg
|
||||
|
||||
/netcore @marek-safar @akoeplinger @egorbo @vargaz @steveisok
|
||||
|
||||
/packaging @alexischr @akoeplinger @directhex
|
||||
/packaging/MacSDK/msbuild.py @radical @akoeplinger
|
||||
|
||||
/runtime @akoeplinger @marek-safar
|
||||
|
||||
/samples @lambdageek
|
||||
/samples/profiler @BrzVlad @lambdageek
|
||||
/samples/size @alexrp @lambdageek
|
||||
|
||||
/scripts @akoeplinger @directhex
|
||||
/scripts/ci @akoeplinger @directhex
|
||||
|
||||
/sdks @marek-safar @vargaz @lambdageek
|
||||
/sdks/builds/android* @alexischr @jonpryor
|
||||
/sdks/builds/mxe* @alexischr @jonpryor
|
||||
/sdks/builds/ios* @vargaz @rolfbjarne
|
||||
/sdks/builds/wasm* @vargaz @kjpou1 @lewing
|
||||
/sdks/wasm @vargaz @kjpou1 @kg @lewing
|
||||
/sdks/ios @vargaz @rolfbjarne
|
||||
/sdks/android @alexischr @jonpryor
|
||||
|
||||
/support @lambdageek @vargaz
|
||||
|
||||
/tools @lambdageek @vargaz
|
||||
/tools/locale-builder @marek-safar @egorbo
|
||||
/tools/nuget-hash-extractor @marek-safar @radical @akoeplinger
|
||||
/tools/pedump @lambdageek
|
||||
/tools/sgen @brzvlad @vargaz @naricc
|
||||
@@ -1,47 +0,0 @@
|
||||
<!--
|
||||
If you are new to the project get yourself familiar with https://www.mono-project.com/community/bugs/make-a-good-bug-report/ before filling the issue
|
||||
-->
|
||||
|
||||
## Steps to Reproduce
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
<!--
|
||||
You may drag & drop the attachment (repro code/solution, screenshot, etc.) onto the issue.
|
||||
-->
|
||||
|
||||
### Current Behavior
|
||||
|
||||
<!--
|
||||
What is the current behavior?
|
||||
-->
|
||||
|
||||
### Expected Behavior
|
||||
|
||||
<!--
|
||||
Please describe the behavior you are expecting
|
||||
-->
|
||||
|
||||
## On which platforms did you notice this
|
||||
|
||||
[ ] macOS
|
||||
[ ] Linux
|
||||
[ ] Windows
|
||||
|
||||
**Version Used**:
|
||||
|
||||
<!--
|
||||
You can use `mono --version` or About dialog to obtain this information.
|
||||
-->
|
||||
|
||||
## Stacktrace
|
||||
|
||||
```
|
||||
Please paste the stack trace here if available.
|
||||
```
|
||||
|
||||
<!--
|
||||
You can join us on Discord (https://aka.ms/dotnet-discord) in the #monovm channel to discuss your reported issue
|
||||
-->
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
|
||||
<!--
|
||||
Thank you for your Pull Request!
|
||||
|
||||
If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.
|
||||
|
||||
Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
|
||||
-->
|
||||
+1
-20
@@ -18,13 +18,13 @@
|
||||
*.vssscc
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.mdb
|
||||
*.ncb
|
||||
*.suo
|
||||
*.tlb
|
||||
*.tlh
|
||||
*.bak
|
||||
*.ilk
|
||||
*.log
|
||||
*.lib
|
||||
*.sbr
|
||||
*.sdf
|
||||
@@ -40,12 +40,10 @@ Ankh.NoLoad
|
||||
*.gpState
|
||||
.vscode/
|
||||
*.exp
|
||||
.vs/
|
||||
|
||||
# Tooling
|
||||
_ReSharper*/
|
||||
*.resharper
|
||||
.idea/*
|
||||
[Tt]est[Rr]esult*
|
||||
*.orig
|
||||
*.rej
|
||||
@@ -89,9 +87,7 @@ stamp-h.in
|
||||
*~
|
||||
*.swp
|
||||
*.o
|
||||
*.dylib
|
||||
.deps
|
||||
.libs
|
||||
|
||||
# Libtool
|
||||
libtool.m4
|
||||
@@ -129,22 +125,7 @@ docs/perlmod*
|
||||
compile
|
||||
mono.h
|
||||
mono-*.tar.*
|
||||
mono_crash*
|
||||
tmpinst-dir.stamp
|
||||
msvc/scripts/inputs/
|
||||
extensions-config.h
|
||||
*.dylib.dSYM
|
||||
*.mlpd
|
||||
llvm/build/
|
||||
llvm/usr/
|
||||
sdks/builds/llvm-*/
|
||||
sdks/builds/android-*/
|
||||
mcs/build/compiler-server.log
|
||||
|
||||
##############################################################################
|
||||
# Arcade output directories
|
||||
##############################################################################
|
||||
|
||||
.packages
|
||||
artifacts
|
||||
.dotnet
|
||||
-13
@@ -58,16 +58,3 @@
|
||||
[submodule "external/api-snapshot"]
|
||||
path = external/api-snapshot
|
||||
url = git://github.com/mono/api-snapshot.git
|
||||
[submodule "external/helix-binaries"]
|
||||
path = external/helix-binaries
|
||||
url = git://github.com/mono/helix-binaries.git
|
||||
[submodule "external/illinker-test-assets"]
|
||||
path = external/illinker-test-assets
|
||||
url = git://github.com/mono/illinker-test-assets.git
|
||||
[submodule "external/llvm-project"]
|
||||
path = external/llvm-project
|
||||
url = git://github.com/dotnet/llvm-project.git
|
||||
branch = release/6.x
|
||||
[submodule "external/bdwgc"]
|
||||
path = external/bdwgc
|
||||
url = git://github.com/Unity-Technologies/bdwgc.git
|
||||
Vendored
-90
@@ -1,90 +0,0 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Mac",
|
||||
"includePath": [
|
||||
"${default}",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}",
|
||||
"${workspaceRoot}/mono",
|
||||
"${workspaceRoot}/mono/eglib",
|
||||
"${workspaceRoot}/support"
|
||||
],
|
||||
"defines": [],
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"${default}",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}",
|
||||
"${workspaceRoot}/mono",
|
||||
"${workspaceRoot}/mono/eglib",
|
||||
"${workspaceRoot}/support"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
},
|
||||
"macFrameworkPath": [
|
||||
"${default}",
|
||||
"/System/Library/Frameworks",
|
||||
"/Library/Frameworks"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${default}",
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}",
|
||||
"${workspaceRoot}/mono",
|
||||
"${workspaceRoot}/mono/eglib",
|
||||
"${workspaceRoot}/support"
|
||||
],
|
||||
"defines": [],
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"${default}",
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}",
|
||||
"${workspaceRoot}/mono",
|
||||
"${workspaceRoot}/mono/eglib",
|
||||
"${workspaceRoot}/support"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Win32",
|
||||
"includePath": [
|
||||
"${default}",
|
||||
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include",
|
||||
"${workspaceRoot}",
|
||||
"${workspaceRoot}/mono",
|
||||
"${workspaceRoot}/mono/eglib",
|
||||
"${workspaceRoot}/support"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE"
|
||||
],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"${default}",
|
||||
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*",
|
||||
"${workspaceRoot}",
|
||||
"${workspaceRoot}/mono",
|
||||
"${workspaceRoot}/mono/eglib",
|
||||
"${workspaceRoot}/support"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
# Mono Code Owners File
|
||||
#
|
||||
# GitHub uses this file to determine who to ping for reviews on pull requests.
|
||||
# If you're the primary maintainer of an area of Mono and you don't mind
|
||||
# reviewing pull requests, please add yourself to this file. You may want to
|
||||
# avoid adding entries for commonly changed or automatically generated files
|
||||
# (e.g. stuff in external/, or various generated *.csproj files) so as not to
|
||||
# get spammed with emails.
|
||||
#
|
||||
# Note that if two patterns match a file, the later pattern takes precedence.
|
||||
#
|
||||
# Please keep this file alphabetically sorted.
|
||||
#
|
||||
# Reference:
|
||||
#
|
||||
# https://github.com/blog/2392-introducing-code-owners
|
||||
# https://help.github.com/articles/about-codeowners
|
||||
|
||||
acceptance-tests/* @akoeplinger
|
||||
acceptance-tests/profiler-stress* @alexrp
|
||||
docs/sources/mono-api-profiler.html @alexrp
|
||||
man/mprof-report.1 @alexrp
|
||||
mcs/build @marek-safar
|
||||
mcs/class @marek-safar
|
||||
mcs/errors @marek-safar
|
||||
mcs/mcs @marek-safar
|
||||
mcs/tests @marek-safar
|
||||
mcs/class/corlib/System.Reflection*/ @vargaz @lambdageek
|
||||
mcs/class/Mono.Btls.Interface @baulig
|
||||
mcs/class/Mono.Data.Tds @egorbo
|
||||
mcs/class/Mono.Debugger.Soft @vargaz
|
||||
mcs/class/Mono.Options @jonpryor
|
||||
mcs/class/Mono.Profiler.Log @alexrp
|
||||
mcs/class/Mono.Security/Mono.Security/Interface @baulig
|
||||
mcs/class/System/Mono.AppleTls @baulig
|
||||
mcs/class/System/Mono.Btls @baulig
|
||||
mcs/class/System/Mono.Net.Security @baulig
|
||||
mcs/class/System/Mono.Security.Interface @baulig
|
||||
mcs/class/System.Data @egorbo
|
||||
mono/metadata/*profiler* @alexrp
|
||||
mono/metadata/monitor* @brzvlad
|
||||
mono/metadata/sgen* @brzvlad
|
||||
mono/metadata/threads* @luhenry @kumpera
|
||||
mono/metadata/threadpool* @luhenry
|
||||
mono/metadata/w32* @luhenry
|
||||
mono/mini/*profiler* @alexrp
|
||||
mono/profiler @alexrp
|
||||
mono/sgen @brzvlad
|
||||
mono/utils/atomic* @alexrp
|
||||
mono/utils/mono-hwcap* @alexrp
|
||||
mono/utils/mono-mem* @alexrp
|
||||
mono/utils/mono-threads* @luhenry @kumpera
|
||||
msvc/*profiler* @alexrp
|
||||
msvc/scripts @akoeplinger
|
||||
packaging/Windows @akoeplinger
|
||||
samples/profiler @alexrp
|
||||
samples/size @alexrp
|
||||
scripts/ci/run-jenkins.sh @akoeplinger
|
||||
scripts/ci/run-test-acceptance-tests.sh @akoeplinger
|
||||
scripts/ci/run-test-default.sh @akoeplinger
|
||||
scripts/ci/run-test-profiler-stress-tests.sh @alexrp
|
||||
scripts/ci/util.sh @akoeplinger
|
||||
@@ -32,12 +32,7 @@ file in this directory.
|
||||
CLA
|
||||
=======
|
||||
|
||||
Contributions are now taken under the [.NET Foundation CLA](https://cla.dotnetfoundation.org/).
|
||||
|
||||
Code Review
|
||||
=======
|
||||
We are requiring code reviews before merging a pull request.
|
||||
GitHub won't let you merge a PR until someone from the Mono team approves it.
|
||||
Contributions are now taken under the [.NET Foundation CLA](https://cla2.dotnetfoundation.org/).
|
||||
|
||||
Testing
|
||||
=======
|
||||
@@ -28,6 +28,8 @@ Mono itself, and does not end up in the redistributable part of Mono:
|
||||
|
||||
* mcs/jay: 4-clause BSD licensed
|
||||
|
||||
* mcs/nunit24: MS-PL
|
||||
|
||||
* mcs/class/I18N/mklist.sh, tools/cvt.sh: GNU GPLv2
|
||||
|
||||
Runtime Code
|
||||
@@ -44,7 +46,7 @@ embeddable runtime:
|
||||
|
||||
* mono/utils/bsearch.c: BSD license.
|
||||
|
||||
* mono/metadata/w32file-unix-glob.c, w32file-unix-glob.h: BSD license
|
||||
* mono/io-layer/wapi_glob.h, wapi_glob.c: BSD license
|
||||
|
||||
Class Library code
|
||||
==================
|
||||
@@ -76,7 +78,7 @@ The Licenses
|
||||
|
||||
These are the licenses used in Mono, the files are located:
|
||||
|
||||
### MIT License
|
||||
### MIT X11 License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
+62
-42
@@ -2,16 +2,24 @@ ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
AM_CFLAGS = $(WERROR_CFLAGS)
|
||||
|
||||
SUBDIRS = @MONO_SUBDIRS@
|
||||
noinst_SUBDIRS = @MONO_NOINST_SUBDIRS@
|
||||
DIST_SUBDIRS = $(SUBDIRS) m4 netcore
|
||||
MONOTOUCH_SUBDIRS = $(libgc_dir) eglib/src mono
|
||||
|
||||
if !ENABLE_NETCORE
|
||||
# Some tools might not build when cross-compiling
|
||||
if CROSS_COMPILING
|
||||
tools_dir =
|
||||
else
|
||||
tools_dir = tools
|
||||
endif
|
||||
|
||||
all: $(update_submodules)
|
||||
SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm
|
||||
# Keep in sync with SUBDIRS
|
||||
DIST_SUBDIRS = m4 po $(libgc_dir) eglib mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm
|
||||
|
||||
all: update_submodules
|
||||
|
||||
SUBMODULE_ERROR='Could not recursively update all git submodules. You may experience compilation problems if some submodules are out of date'
|
||||
update_submodules:
|
||||
@cd $(srcdir) && scripts/update_submodules.sh
|
||||
@$(srcdir)/scripts/update_submodules.sh
|
||||
|
||||
.PHONY: update_submodules
|
||||
|
||||
@@ -24,10 +32,9 @@ EXTRA_DIST= \
|
||||
winconfig.h \
|
||||
code_of_conduct.md \
|
||||
external \
|
||||
netcore/Makefile \
|
||||
mcs/class/referencesource
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS = EXTERNAL_RUNTIME=false
|
||||
DISTCHECK_CONFIGURE_FLAGS = EXTERNAL_MCS=false EXTERNAL_RUNTIME=false
|
||||
|
||||
# Distribute the 'mcs' tree too
|
||||
GIT_DIR ?= $(srcdir)/.git
|
||||
@@ -35,19 +42,8 @@ dist-hook:
|
||||
test -d $(distdir)/mcs || mkdir $(distdir)/mcs
|
||||
d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) distdir=$$d dist-recursive
|
||||
rm -rf `find $(top_distdir)/external -path '*\.git'`
|
||||
rm -rf `find $(top_distdir)/external -path '*\.libs'`
|
||||
rm -rf `find $(top_distdir)/external -path '*\.deps'`
|
||||
rm -f `find $(top_distdir)/external -path '*\.o'`
|
||||
rm -f `find $(top_distdir)/external -path '*\.so'`
|
||||
rm -f `find $(top_distdir)/external -path '*\.lo'`
|
||||
rm -f `find $(top_distdir)/external -path '*\.Plo'`
|
||||
rm -f `find $(top_distdir)/external -name '\.dirstamp'`
|
||||
rm -f `find $(top_distdir)/external -path '*\.exe' -not -path '*/roslyn-binaries/*'`
|
||||
rm -f `find $(top_distdir)/external -path '*\.dll' -not -path '*/binary-reference-assemblies/*' -not -path '*/roslyn-binaries/*' -not -path '*/helix-binaries/*'`
|
||||
rm -rf "$(top_distdir)/external/linker/test"
|
||||
rm -rf "$(top_distdir)/external/llvm-project/lldb/test"
|
||||
rm -rf "$(top_distdir)/external/llvm-project/libcxx/test"
|
||||
rm -rf "$(top_distdir)/external/llvm-project/clang/test"
|
||||
rm -f `find $(top_distdir)/external -path '*\.dll' -not -path '*/binary-reference-assemblies/*' -not -path '*/roslyn-binaries/*'`
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
noinst_DATA = mono-uninstalled.pc
|
||||
@@ -62,15 +58,9 @@ if BITCODE
|
||||
BITCODE_CHECK=yes
|
||||
endif
|
||||
|
||||
if DEFAULT_TESTS
|
||||
CI_TEST_SCRIPT=$(srcdir)/scripts/ci/run-test-default.sh
|
||||
else
|
||||
CI_TEST_SCRIPT=$(srcdir)/scripts/ci/run-test-$(TEST_PROFILE).sh
|
||||
endif
|
||||
|
||||
.PHONY: check-ci
|
||||
check-ci:
|
||||
MONO_LLVMONLY=$(BITCODE_CHECK) $(CI_TEST_SCRIPT)
|
||||
MONO_LLVMONLY=$(BITCODE_CHECK) $(srcdir)/scripts/ci/run-test-$(TEST_PROFILE).sh
|
||||
|
||||
.PHONY: validate do-build-mono-mcs mcs-do-clean mcs-do-tests
|
||||
validate: do-build-mono-mcs
|
||||
@@ -94,17 +84,54 @@ mcs-do-compiler-tests:
|
||||
bootstrap-world: compiler-tests
|
||||
$(MAKE) install
|
||||
|
||||
install:
|
||||
for mydir in $(filter-out $(noinst_SUBDIRS),$(SUBDIRS)); do \
|
||||
(cd $${mydir} && ${MAKE} install) \
|
||||
done
|
||||
if INSTALL_MONOTOUCH
|
||||
monotouch-do-build: config.h
|
||||
@list='$(MONOTOUCH_SUBDIRS)'; for subdir in $$list; do \
|
||||
case "x$$subdir" in \
|
||||
xmono ) target="monotouch-do-build";; \
|
||||
* ) target="all";; \
|
||||
esac; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
|
||||
done;
|
||||
(cd runtime && $(MAKE) $(AM_MAKEFLAGS) monotouch-do-build)
|
||||
|
||||
monotouch-do-clean:
|
||||
@list='$(MONOTOUCH_SUBDIRS)'; for subdir in $$list; do \
|
||||
case "x$$subdir" in \
|
||||
xmono ) target="monotouch-do-clean";; \
|
||||
* ) target="clean";; \
|
||||
esac; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
|
||||
done;
|
||||
(cd runtime && $(MAKE) $(AM_MAKEFLAGS) monotouch-do-clean)
|
||||
|
||||
endif
|
||||
|
||||
win32getdeps:
|
||||
wget http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip
|
||||
wget http://www.go-mono.com/archive/glib-2.0.4-20020703.zip
|
||||
wget http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip
|
||||
wget http://www.go-mono.com/archive/libiconv-1.7.zip
|
||||
wget http://www.go-mono.com/archive/libiconv-dev-1.7.zip
|
||||
wget http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip
|
||||
unzip -n -d / pkgconfig-0.11-20020310.zip
|
||||
unzip -n -d / glib-2.0.4-20020703.zip
|
||||
unzip -n -d / glib-dev-2.0.4-20020703.zip
|
||||
unzip -n -d / libiconv-1.7.zip
|
||||
unzip -n -d / libiconv-dev-1.7.zip
|
||||
unzip -n -d / libintl-0.10.40-20020101.zip
|
||||
|
||||
win32setup:
|
||||
makensis /DMILESTONE=$(VERSION) /DSOURCE_INSTALL_DIR=$(SOURCE_INSTALL_DIR) /DBUILDNUM=$(BUILDNUM) monowiz.win32.nsi
|
||||
|
||||
update-csproj:
|
||||
-rm msvc/scripts/order
|
||||
-rm msvc/scripts/order.xml
|
||||
-rm -rf msvc/scripts/inputs
|
||||
-mkdir msvc/scripts/inputs
|
||||
(cd runtime; $(MAKE) V=1 extra_targets=csproj-local)
|
||||
(cd runtime; make V=1 extra_targets=csproj-local)
|
||||
|
||||
package-inputs:
|
||||
echo '<?xml version="1.0" encoding="utf-8"?>' > msvc/scripts/order.xml
|
||||
@@ -115,7 +142,6 @@ package-inputs:
|
||||
(echo " <project dir=\"$$1\" library=\"$$2\">"; \
|
||||
read boot; echo " <boot>$$boot</boot>"; \
|
||||
read flags; echo " <flags>$$flags</flags>"; \
|
||||
read sources;echo " <sources>$$sources</sources>"; \
|
||||
read output; echo " <output>$$output</output>"; \
|
||||
read built; echo " <built_sources>`echo $$built | sed 's/\\\/\\\\/g'`</built_sources>"; \
|
||||
read libou; echo " <library_output>$$libou</library_output>"; \
|
||||
@@ -134,12 +160,6 @@ update-llvm-version:
|
||||
|
||||
|
||||
update-solution-files:
|
||||
cd msvc/scripts && $(MAKE) genproj.exe || exit $$?;
|
||||
$(MAKE) update-csproj
|
||||
$(MAKE) package-inputs
|
||||
(cd msvc/scripts; mono --debug genproj.exe $(GENPROJ_ARGS))
|
||||
|
||||
update-solution-files-with-tests:
|
||||
$(MAKE) "GENPROJ_ARGS=2012 true true" update-solution-files
|
||||
|
||||
endif
|
||||
make update-csproj
|
||||
make package-inputs
|
||||
(cd msvc/scripts; make genproj.exe; mono genproj.exe)
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
@@ -3,15 +3,9 @@ create cross platform applications. It is an open source
|
||||
implementation of Microsoft's .NET Framework based on the ECMA
|
||||
standards for C# and the Common Language Runtime.
|
||||
|
||||
The Mono project is part of the [.NET Foundation](https://www.dotnetfoundation.org/)
|
||||
The Mono project is part of the [.NET Foundation](http://www.dotnetfoundation.org/)
|
||||
|
||||
Join us on [Discord](https://aka.ms/dotnet-discord) in the `#monovm` channel:
|
||||
|
||||
<a href="https://aka.ms/dotnet-discord">
|
||||
<img src="https://img.shields.io/discord/732297728826277939?style=flat-square&label=Discord&logo=discord&logoColor=white&color=7289DA">
|
||||
</a>
|
||||
|
||||
### Contents
|
||||
[](https://gitter.im/mono/mono?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
1. [Compilation and Installation](#compilation-and-installation)
|
||||
2. [Using Mono](#using-mono)
|
||||
@@ -25,32 +19,30 @@ Join us on [Discord](https://aka.ms/dotnet-discord) in the `#monovm` channel:
|
||||
|
||||
| OS | Architecture | Status |
|
||||
|--------------|--------------------|------------------------------|
|
||||
| Debian 9 | amd64 | [![debian-9-amd64][1]][2] |
|
||||
| Debian 9 | i386 | [![debian-9-i386][3]][4] |
|
||||
| Debian 9 | armel | [![debian-9-armel][5]][6] |
|
||||
| Debian 9 | armhf | [![debian-9-armhf][7]][8] |
|
||||
| Debian 9 | arm64 | [![debian-9-arm64][9]][10] |
|
||||
| Ubuntu 14.04 | amd64 | [![ubuntu-1404-amd64][1]][2] |
|
||||
| Ubuntu 14.04 | i386 | [![ubuntu-1404-i386][3]][4] |
|
||||
| Debian 8 | armel | [![debian-8-armel][5]][6] |
|
||||
| Debian 8 | armhf | [![debian-8-armhf][7]][8] |
|
||||
| Debian 8 | arm64 | [![debian-8-arm64][9]][10] |
|
||||
| OS X | amd64 | [![osx-amd64][11]][12] |
|
||||
| OS X | i386 | [![osx-i386][13]][14] |
|
||||
| Windows | amd64 | [![windows-amd64][15]][16] |
|
||||
| Windows | i386 | [![windows-i386][17]][18] |
|
||||
| Windows | i386 | [![windows-amd64][17]][18] |
|
||||
| CentOS | s390x (cs) | [![centos-s390x][19]][20] |
|
||||
| Debian 9 | ppc64el (cs) | [![debian-9-ppc64el][21]][22]|
|
||||
| AIX 6.1 | ppc64 (cs) | [![aix-ppc64][23]][24] |
|
||||
| FreeBSD 12 | amd64 (cs) | [![freebsd-amd64][25]][26] |
|
||||
| Debian 8 | ppc64el (cs) | [![debian-8-ppc64el][21]][22]|
|
||||
|
||||
_(cs) = community supported architecture_
|
||||
|
||||
[1]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64/badge/icon
|
||||
[2]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64
|
||||
[3]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/badge/icon
|
||||
[4]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/
|
||||
[5]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/badge/icon
|
||||
[6]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/
|
||||
[7]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/badge/icon
|
||||
[8]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/
|
||||
[9]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/badge/icon
|
||||
[10]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/
|
||||
[1]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-amd64/badge/icon
|
||||
[2]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-amd64
|
||||
[3]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-i386/badge/icon
|
||||
[4]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-i386/
|
||||
[5]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armel/badge/icon
|
||||
[6]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armel/
|
||||
[7]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armhf/badge/icon
|
||||
[8]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armhf/
|
||||
[9]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/badge/icon
|
||||
[10]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/
|
||||
[11]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/badge/icon
|
||||
[12]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/
|
||||
[13]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/badge/icon
|
||||
@@ -61,12 +53,8 @@ _(cs) = community supported architecture_
|
||||
[18]: https://jenkins.mono-project.com/job/z/label=w32/
|
||||
[19]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x/badge/icon
|
||||
[20]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x
|
||||
[21]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el/badge/icon
|
||||
[22]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el
|
||||
[23]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64/badge/icon
|
||||
[24]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64
|
||||
[25]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=freebsd-12-amd64/badge/icon
|
||||
[26]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=freebsd-12-amd64
|
||||
[21]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-8-ppc64el/badge/icon
|
||||
[22]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-8-ppc64el
|
||||
|
||||
Compilation and Installation
|
||||
============================
|
||||
@@ -75,15 +63,15 @@ Building the Software
|
||||
---------------------
|
||||
|
||||
Please see our guides for building Mono on
|
||||
[Mac OS X](https://www.mono-project.com/docs/compiling-mono/mac/),
|
||||
[Linux](https://www.mono-project.com/docs/compiling-mono/linux/) and
|
||||
[Windows](https://www.mono-project.com/docs/compiling-mono/windows/).
|
||||
[Mac OS X](http://www.mono-project.com/docs/compiling-mono/mac/),
|
||||
[Linux](http://www.mono-project.com/docs/compiling-mono/linux/) and
|
||||
[Windows](http://www.mono-project.com/docs/compiling-mono/windows/).
|
||||
|
||||
Note that building from Git assumes that you already have Mono installed,
|
||||
so please download and [install the latest Mono release](https://www.mono-project.com/download/)
|
||||
so please download and [install the latest Mono release](http://www.mono-project.com/download/)
|
||||
before trying to build from Git. This is required because the Mono build
|
||||
relies on a working Mono C# compiler to compile itself
|
||||
(also known as [bootstrapping](https://en.wikipedia.org/wiki/Bootstrapping_(compilers))).
|
||||
(also known as [bootstrapping](http://en.wikipedia.org/wiki/Bootstrapping_(compilers))).
|
||||
|
||||
If you don't have a working Mono installation
|
||||
---------------------------------------------
|
||||
@@ -123,7 +111,7 @@ Once you have installed the software, you can run a few programs:
|
||||
|
||||
* `mono program.exe` runtime engine
|
||||
|
||||
* `mcs program.cs` C# compiler
|
||||
* `mcs program.cs` C# compiler
|
||||
|
||||
* `monodis program.exe` CIL Disassembler
|
||||
|
||||
@@ -140,14 +128,6 @@ Directory Roadmap
|
||||
|
||||
* `external/` - Git submodules for external libraries (Newtonsoft.Json, ikvm, etc).
|
||||
|
||||
* `ikvm-native/` - Glue code for ikvm.
|
||||
|
||||
* `libgc/` - The (deprecated) Boehm GC implementation.
|
||||
|
||||
* `llvm/` - Utility Makefiles for integrating the Mono LLVM fork.
|
||||
|
||||
* `m4/` - General utility Makefiles.
|
||||
|
||||
* `man/` - Manual pages for the various Mono commands and programs.
|
||||
|
||||
* `mcs/` - The class libraries, compiler and tools
|
||||
@@ -162,69 +142,44 @@ Directory Roadmap
|
||||
|
||||
* `arch/` - Architecture specific portions.
|
||||
|
||||
* `benchmark/` - A collection of benchmarks.
|
||||
|
||||
* `btls/` - Build files for the BTLS library which incorporates BoringSSL.
|
||||
|
||||
* `cil/` - Common Intermediate Representation, XML
|
||||
definition of the CIL bytecodes.
|
||||
|
||||
* `dis/` - CIL executable Disassembler.
|
||||
* `dis/` - CIL executable Disassembler
|
||||
|
||||
* `eglib/` - Independent implementation of the glib API.
|
||||
* `io-layer/` - The I/O layer and system abstraction for
|
||||
emulating the .NET IO model.
|
||||
|
||||
* `metadata/` - The object system and metadata reader.
|
||||
|
||||
* `mini/` - The Just in Time Compiler.
|
||||
|
||||
* `profiler/` - The profiler implementation.
|
||||
|
||||
* `sgen/` - The SGen Garbage Collector implementation.
|
||||
|
||||
* `tests/` - The main runtime tests.
|
||||
|
||||
* `unit-tests/` - Additional runtime unit tests.
|
||||
|
||||
* `utils/` - Utility functions used across the runtime codebase.
|
||||
|
||||
* `msvc/` - Logic for the MSVC / Visual Studio based runtime and BCL build system.
|
||||
The latter is experimental at the moment.
|
||||
|
||||
* `packaging/` - Packaging logic for the OS X and Windows Mono packages.
|
||||
|
||||
* `po/` - Translation files.
|
||||
|
||||
* `runtime/` - A directory that contains the Makefiles that link the
|
||||
mono/ and mcs/ build systems.
|
||||
|
||||
* `samples/` - Some simple sample programs on uses of the Mono
|
||||
runtime as an embedded library.
|
||||
* `samples/` -Some simple sample programs on uses of the Mono
|
||||
runtime as an embedded library.
|
||||
|
||||
* `scripts/` - Scripts used to invoke Mono and the corresponding program.
|
||||
|
||||
* `sdks/` - A new way of embedding Mono into Xamarin.iOS, Xamarin.Android and other products.
|
||||
|
||||
* `support/` - Various support libraries.
|
||||
|
||||
* `tools/` - A collection of tools, mostly used during Mono development.
|
||||
|
||||
Contributing to Mono
|
||||
====================
|
||||
|
||||
Before submitting changes to Mono, please review the [contribution
|
||||
guidelines](https://www.mono-project.com/community/contributing/).
|
||||
guidelines](http://www.mono-project.com/community/contributing/).
|
||||
Please pay particular attention to the [Important
|
||||
Rules](https://www.mono-project.com/community/contributing/#important-rules)
|
||||
Rules](http://www.mono-project.com/community/contributing/#important-rules)
|
||||
section.
|
||||
|
||||
Reporting bugs
|
||||
==============
|
||||
|
||||
To submit bug reports, please [open an issue on the mono GitHub repo](https://github.com/mono/mono/issues/new).
|
||||
To submit bug reports, please use [Xamarin's
|
||||
Bugzilla](https://bugzilla.xamarin.com/)
|
||||
|
||||
Please use the search facility to ensure the same bug hasn't already
|
||||
been submitted and follow our
|
||||
[guidelines](https://www.mono-project.com/community/bugs/make-a-good-bug-report/)
|
||||
[guidelines](http://www.mono-project.com/community/bugs/make-a-good-bug-report/)
|
||||
on how to make a good bug report.
|
||||
|
||||
Configuration Options
|
||||
@@ -253,12 +208,12 @@ Disables the inclusion of a Boehm garbage collector.
|
||||
|
||||
* This defaults to `included`.
|
||||
|
||||
* `--enable-cooperative-suspend`
|
||||
* `--with-cooperative-gc`
|
||||
|
||||
* If you pass this flag the Mono runtime is configured to only use
|
||||
the cooperative mode of the garbage collector. If you do not pass
|
||||
this flag, then you can control at runtime the use of the
|
||||
cooperative GC mode by setting the `MONO_ENABLE_COOP_SUSPEND` flag.
|
||||
cooperative GC mode by setting the `MONO_ENABLE_COOP` flag.
|
||||
|
||||
* `--with-tls=__thread,pthread`
|
||||
|
||||
@@ -315,9 +270,6 @@ faster under the Xen virtualization system.
|
||||
|
||||
* `--with-large-heap=yes,no` - Enable support for GC heaps larger than 3GB.
|
||||
|
||||
* This only applies only to the Boehm garbage collector, the SGen garbage
|
||||
collector does not use this configuration option.
|
||||
|
||||
* This defaults to `no`.
|
||||
|
||||
* `--enable-small-config=yes,no` - Enable some tweaks to reduce memory usage
|
||||
@@ -356,6 +308,16 @@ should be used.
|
||||
|
||||
* Or you can specify a path to a libgdiplus.
|
||||
|
||||
* `--disable-shared-memory`
|
||||
|
||||
* Use this option to disable the use of shared memory in
|
||||
Mono (this is equivalent to setting the MONO_DISABLE_SHM
|
||||
environment variable, although this removes the feature
|
||||
completely).
|
||||
|
||||
* Disabling the shared memory support will disable certain
|
||||
features like cross-process named mutexes.
|
||||
|
||||
* `--enable-minimal=LIST`
|
||||
|
||||
* Use this feature to specify optional runtime
|
||||
@@ -440,18 +402,23 @@ Disables compilation for the SSA optimization
|
||||
framework, and the various SSA-based optimizations.
|
||||
|
||||
* `--enable-llvm`
|
||||
* `--enable-loadedllvm`
|
||||
|
||||
* This enables the use of LLVM as a code generation engine
|
||||
for Mono. The LLVM code generator and optimizer will be
|
||||
used instead of Mono's built-in code generator for both
|
||||
Just in Time and Ahead of Time compilations.
|
||||
|
||||
* See https://www.mono-project.com/docs/advanced/mono-llvm/ for the
|
||||
* See http://www.mono-project.com/docs/advanced/mono-llvm/ for the
|
||||
full details and up-to-date information on this feature.
|
||||
|
||||
* You will need to have an LLVM built that Mono can link
|
||||
against.
|
||||
|
||||
* The `--enable-loadedllvm` variant will make the LLVM backend
|
||||
into a runtime-loadable module instead of linking it directly
|
||||
into the main mono binary.
|
||||
|
||||
* `--enable-big-arrays` - Enable use of arrays with indexes larger
|
||||
than Int32.MaxValue.
|
||||
|
||||
@@ -511,21 +478,11 @@ also, see the man page.
|
||||
|
||||
* This configures the Mono compiler to generate code
|
||||
suitable to be used by Google's Native Client:
|
||||
https://code.google.com/p/nativeclient/
|
||||
http://code.google.com/p/nativeclient/
|
||||
|
||||
* Currently this is used with Mono's AOT engine as
|
||||
Native Client does not support JIT engines yet.
|
||||
|
||||
* `--enable-wasm`
|
||||
|
||||
* Use this option to configure mono to run on WebAssembly. It will
|
||||
set both host and target to the WebAssembly triplet. This overrides
|
||||
the values passed to `--host` or `--target` and ignored what config.sub guesses.
|
||||
|
||||
This is a workaround to enable usage of old automake versions that don't
|
||||
recognize the wasm triplet.
|
||||
|
||||
|
||||
Working With Submodules
|
||||
=======================
|
||||
|
||||
@@ -585,7 +542,7 @@ file for information about Microsoft's patent grant.
|
||||
Mono Trademark Use Policy
|
||||
=========================
|
||||
|
||||
The use of trademarks and logos for Mono can be found [here](https://www.dotnetfoundation.org/legal/mono-tm).
|
||||
The use of trademarks and logos for Mono can be found [here] (http://www.dotnetfoundation.org/legal/mono-tm).
|
||||
|
||||
Maintaining the Class Library Solution Files
|
||||
============================================
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
|
||||
Mono uses third-party libraries or other resources that may be
|
||||
distributed under licenses different than the Mono software.
|
||||
|
||||
Attributions and license notices for test cases originally authored by
|
||||
third parties can be found in the respective test directories.
|
||||
|
||||
In the event that we accidentally failed to list a required notice, please
|
||||
bring it to our attention. Post an issue or email us:
|
||||
|
||||
[email protected]
|
||||
|
||||
The attached notices are provided for information only.
|
||||
|
||||
License notice for Mono
|
||||
-----------------------
|
||||
|
||||
Note: multiple license notices are provided that occure in source code.
|
||||
They are equivalent forms of the the MIT license from various copyright holders.
|
||||
|
||||
// Dual licensed under the terms of the MIT X11 or GNU GPL
|
||||
// Copyright 2003-2011 Novell, Inc.
|
||||
// Copyright 2011 Xamarin Inc
|
||||
|
||||
/**
|
||||
*
|
||||
* Copyright 2001-2003 Ximian, Inc
|
||||
* Copyright 2003-2010 Novell, Inc.
|
||||
* Copyright (C) 2012 Xamarin Inc
|
||||
*
|
||||
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* The MIT License
|
||||
* Copyright (c) 2003 Novell Inc. www.novell.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the Software), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*******************************************************************************/
|
||||
|
||||
License notice for Apple
|
||||
-------------------------
|
||||
Content: https://github.com/mono/mono/blob/435f968102d0820ca65d63e1e741e4130b4d1303/support/ios/net/route.h
|
||||
License: https://opensource.apple.com/apsl/
|
||||
|
||||
License for GCC
|
||||
---------------
|
||||
|
||||
License: http://gcc.gnu.org/onlinedocs/gcc-4.6.4/libstdc++/manual/manual/license.html
|
||||
Content: https://github.com/mono/mono/blob/c398e19d3515c6bbb6046ed014b2095594a15229/mono/mini
|
||||
Example: https://github.com/mono/mono/blob/c398e19d3515c6bbb6046ed014b2095594a15229/mono/mini/decompose.c#L967
|
||||
|
||||
GCC RUNTIME LIBRARY EXCEPTION
|
||||
|
||||
Version 3.1, 31 March 2009
|
||||
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
This GCC Runtime Library Exception ("Exception") is an additional
|
||||
permission under section 7 of the GNU General Public License, version
|
||||
3 ("GPLv3"). It applies to a given file (the "Runtime Library") that
|
||||
bears a notice placed by the copyright holder of the file stating that
|
||||
the file is governed by GPLv3 along with this Exception.
|
||||
|
||||
When you use GCC to compile a program, GCC may combine portions of
|
||||
certain GCC header files and runtime libraries with the compiled
|
||||
program. The purpose of this Exception is to allow compilation of
|
||||
non-GPL (including proprietary) programs to use, in this way, the
|
||||
header files and runtime libraries covered by this Exception.
|
||||
|
||||
0. Definitions.
|
||||
|
||||
A file is an "Independent Module" if it either requires the Runtime
|
||||
Library for execution after a Compilation Process, or makes use of an
|
||||
interface provided by the Runtime Library, but is not otherwise based
|
||||
on the Runtime Library.
|
||||
|
||||
"GCC" means a version of the GNU Compiler Collection, with or without
|
||||
modifications, governed by version 3 (or a specified later version) of
|
||||
the GNU General Public License (GPL) with the option of using any
|
||||
subsequent versions published by the FSF.
|
||||
|
||||
"GPL-compatible Software" is software whose conditions of propagation,
|
||||
modification and use would permit combination with GCC in accord with
|
||||
the license of GCC.
|
||||
|
||||
"Target Code" refers to output from any compiler for a real or virtual
|
||||
target processor architecture, in executable form or suitable for
|
||||
input to an assembler, loader, linker and/or execution
|
||||
phase. Notwithstanding that, Target Code does not include data in any
|
||||
format that is used as a compiler intermediate representation, or used
|
||||
for producing a compiler intermediate representation.
|
||||
|
||||
The "Compilation Process" transforms code entirely represented in
|
||||
non-intermediate languages designed for human-written code, and/or in
|
||||
Java Virtual Machine byte code, into Target Code. Thus, for example,
|
||||
use of source code generators and preprocessors need not be considered
|
||||
part of the Compilation Process, since the Compilation Process can be
|
||||
understood as starting with the output of the generators or
|
||||
preprocessors.
|
||||
|
||||
A Compilation Process is "Eligible" if it is done using GCC, alone or
|
||||
with other GPL-compatible software, or if it is done without using any
|
||||
work based on GCC. For example, using non-GPL-compatible Software to
|
||||
optimize any GCC intermediate representations would not qualify as an
|
||||
Eligible Compilation Process.
|
||||
|
||||
1. Grant of Additional Permission.
|
||||
|
||||
You have permission to propagate a work of Target Code formed by
|
||||
combining the Runtime Library with Independent Modules, even if such
|
||||
propagation would otherwise violate the terms of GPLv3, provided that
|
||||
all Target Code was generated by Eligible Compilation Processes. You
|
||||
may then convey such a combination under terms of your choice,
|
||||
consistent with the licensing of the Independent Modules.
|
||||
|
||||
2. No Weakening of GCC Copyleft.
|
||||
|
||||
The availability of this Exception does not imply any general
|
||||
presumption that third-party software is unaffected by the copyleft
|
||||
requirements of the license of GCC.
|
||||
|
||||
|
||||
Hopefully that text is self-explanatory. If it isn't, you need to speak to your lawyer, or the Free Software Foundation.
|
||||
|
||||
License notice for Silicon Graphics and HP
|
||||
------------------------------------------
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-1997
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* Copyright (c) 2002
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This implements standard-conforming allocators that interact with
|
||||
* the garbage collector. Gc_alloctor<T> allocates garbage-collectable
|
||||
* objects of type T. Traceable_allocator<T> allocates objects that
|
||||
* are not temselves garbage collected, but are scanned by the
|
||||
* collector for pointers to collectable objects. Traceable_alloc
|
||||
* should be used for explicitly managed STL containers that may
|
||||
* point to collectable objects.
|
||||
*
|
||||
* This code was derived from an earlier version of the GNU C++ standard
|
||||
* library, which itself was derived from the SGI STL implementation.
|
||||
*/
|
||||
|
||||
Content: https://github.com/mono/mono/blob/d58dfa185af1d48fb93efdef1d046762f214f0a7/libgc/include/gc_allocator.h
|
||||
@@ -4,4 +4,3 @@ Makefile
|
||||
*.dll
|
||||
*.mdb
|
||||
coreclr-testlist.txt
|
||||
microbench-perf.sh
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace System.Runtime.Loader
|
||||
{
|
||||
public static class AssemblyExtensions
|
||||
{
|
||||
public static Type[] GetTypes(this Assembly assembly)
|
||||
{
|
||||
return assembly.GetTypes ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,9 @@ BENCHMARKER_PATH=$(ACCEPTANCE_TESTS_PATH)/benchmarker
|
||||
ROSLYN_PATH=$(ACCEPTANCE_TESTS_PATH)/roslyn
|
||||
CORECLR_PATH=$(ACCEPTANCE_TESTS_PATH)/coreclr
|
||||
MSTESTSUITE_PATH=$(ACCEPTANCE_TESTS_PATH)/ms-test-suite
|
||||
DEBIANSHOOTOUTMONO_PATH=$(ACCEPTANCE_TESTS_PATH)/DebianShootoutMono
|
||||
|
||||
CLEANFILES = *.dll *.exe *.mdb
|
||||
EXTRA_DIST=README.md SUBMODULES.json microbench.mk versions.mk profiler-stress.mk roslyn.mk coreclr.mk ms-test-suite.mk
|
||||
EXTRA_DIST=README.md SUBMODULES.json versions.mk roslyn.mk coreclr.mk ms-test-suite.mk
|
||||
|
||||
CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
|
||||
TOOLS_CLASS=$(mcs_topdir)/class/lib/build
|
||||
@@ -15,10 +14,8 @@ RUNTIME = MONO_PATH=$(CLASS) $(abs_top_builddir)/runtime/mono-wrapper --debug
|
||||
TOOLS_RUNTIME = MONO_PATH=$(TOOLS_CLASS) $(abs_top_builddir)/runtime/mono-wrapper --debug
|
||||
MCS = $(TOOLS_RUNTIME) $(CSC) -nologo -noconfig -lib:$(CLASS) -r:System.dll -r:System.Core.dll -r:System.Xml.dll -r:Microsoft.CSharp.dll
|
||||
ILASM = $(TOOLS_RUNTIME) $(TOOLS_CLASS)/ilasm.exe
|
||||
XUNIT = $(RUNTIME) $(abs_top_builddir)/external/xunit-binaries/xunit.console.exe
|
||||
|
||||
include versions.mk
|
||||
include microbench.mk
|
||||
include profiler-stress.mk
|
||||
include roslyn.mk
|
||||
include coreclr.mk
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
[
|
||||
{
|
||||
"name": "roslyn",
|
||||
"url": "git://github.com/mono/roslyn.git",
|
||||
"rev": "6bfcd4e770609a38b8523e83ce1ec943162f30bb",
|
||||
"remote-branch": "origin/mono-testing",
|
||||
"branch": "mono-testing",
|
||||
"url": "git://github.com/dotnet/roslyn.git",
|
||||
"rev": "322bd5b2bbf07df6a67de35cbcb2365484412f70",
|
||||
"remote-branch": "origin/master",
|
||||
"branch": "master",
|
||||
"directory": "roslyn"
|
||||
},
|
||||
{
|
||||
"name": "coreclr",
|
||||
"url": "git://github.com/mono/coreclr.git",
|
||||
"rev": "90f7060935732bb624e1f325d23f63072433725f",
|
||||
"rev": "c7da48acf72c40c0c0ed1a80ebfacea21bb3a271",
|
||||
"remote-branch": "origin/mono",
|
||||
"branch": "mono",
|
||||
"directory": "coreclr"
|
||||
@@ -18,7 +18,7 @@
|
||||
{
|
||||
"name": "ms-test-suite",
|
||||
"url": "[email protected]:xamarin/ms-test-suite.git",
|
||||
"rev": "39b1b222e8a3690a1b8ea018ce54d2a826f5246e",
|
||||
"rev": "73c155f76b55839f26ba707d6d40091060e4f5d8",
|
||||
"remote-branch": "origin/master",
|
||||
"branch": "master",
|
||||
"directory": "ms-test-suite"
|
||||
@@ -30,13 +30,5 @@
|
||||
"remote-branch": "origin/master",
|
||||
"branch": "master",
|
||||
"directory": "benchmarker"
|
||||
},
|
||||
{
|
||||
"name": "DebianShootoutMono",
|
||||
"url": "https://github.com/alexanderkyte/DebianShootoutMono.git",
|
||||
"rev": "3fde2ced806c1fe7eed81120a40d99474fa009f0",
|
||||
"remote-branch": "origin/release_11_15_2018",
|
||||
"branch": "release_11_15_2018",
|
||||
"directory": "DebianShootoutMono"
|
||||
}
|
||||
]
|
||||
]
|
||||
+12
-13
@@ -32,7 +32,7 @@ coreclr-runtest-coremanglib: coreclr-validate test-runner.exe $(CORECLR_COREMANG
|
||||
check-coreclr: coreclr-compile-tests coreclr-runtest-basic coreclr-runtest-coremanglib
|
||||
|
||||
coreclr-gcstress: coreclr-validate GCStressTests.exe $(CORECLR_STRESSTESTSI_CS)
|
||||
BVT_ROOT=$(realpath $(CORECLR_PATH)/tests/src/GC/Stress/Tests) $(RUNTIME) GCStressTests.exe $(CORECLR_PATH)/tests/src/GC/Stress/$(if $(CI_PR),testmix_gc_pr.config,testmix_gc.config); if [ $$? -ne 100 ]; then exit 1; fi
|
||||
BVT_ROOT=$(realpath $(CORECLR_PATH)/tests/src/GC/Stress/Tests) $(RUNTIME) GCStressTests.exe $(CORECLR_PATH)/tests/src/GC/Stress/testmix_gc.config; if [ $$? -ne 100 ]; then exit 1; fi
|
||||
|
||||
# Output a variable in $(2) to the file $(1), separated by newline characters
|
||||
# we need to do it in groups of 100 entries to make sure we don't exceed shell char limits
|
||||
@@ -2162,6 +2162,7 @@ CORECLR_COREMANGLIB_TEST_CS_SRC= \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleepsilon.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleequals1.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleequals2.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doublegethashcode.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleiconvertibletoboolean.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleiconvertibletobyte.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleiconvertibletodatetime.cs \
|
||||
@@ -2216,6 +2217,7 @@ CORECLR_COREMANGLIB_TEST_CS_SRC= \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcgettotalmemory.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gckeepalive.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcmaxgeneration.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcsuppressfinalize.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcwaitforpendingfinalizers.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/globalization/calendarweekrule/calendarweekrulefirstday.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/globalization/calendarweekrule/calendarweekrulefirstfourdayweek.cs \
|
||||
@@ -3175,6 +3177,7 @@ CORECLR_COREMANGLIB_TEST_CS_SRC= \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/runtime/interopservices/inattribute/inattributector.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/runtime/interopservices/layoutkind/layoutkindauto.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/runtime/interopservices/layoutkind/layoutkindsequential.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/runtime/interopservices/marshal/marshalgetlastwin32error.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/runtime/interopservices/marshal/marshalreadint641.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/runtime/interopservices/marshal/marshalsizeof1.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/runtime/interopservices/marshalasattribute/marshalasattributearraysubtype.cs \
|
||||
@@ -3240,6 +3243,7 @@ CORECLR_COREMANGLIB_TEST_CS_SRC= \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/security/securityexception/securityexceptionctor3.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/security/securityexception/securityexceptiontostring.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/single/singleepsilon.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/single/singlegethashcode.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/single/singleisinfinity.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/single/singleisnan.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/single/singleisnegativeinfinity.cs \
|
||||
@@ -3688,8 +3692,9 @@ CORECLR_STRESSTEST_RUNNER_CS_SRC= \
|
||||
$(CORECLR_PATH)/tests/src/GC/Stress/Framework/RFLogging.cs \
|
||||
$(CORECLR_PATH)/tests/src/GC/Stress/Framework/DetourHelpers.cs \
|
||||
$(CORECLR_PATH)/tests/src/GC/Stress/Framework/LoaderClass.cs \
|
||||
GCStressTests/AssemblyLoadContext.cs
|
||||
|
||||
GCStressTests/AssemblyLoadContext.cs \
|
||||
GCStressTests/AssemblyExtensions.cs
|
||||
|
||||
CORECLR_TESTLIBRARY_CS_SRC = \
|
||||
$(CORECLR_PATH)/tests/src/Common/CoreCLRTestLibrary/TestFramework.cs \
|
||||
$(CORECLR_PATH)/tests/src/Common/CoreCLRTestLibrary/Utilities.cs \
|
||||
@@ -3711,7 +3716,7 @@ CORECLR_DISABLED_TEST_CS_SRC += \
|
||||
CORECLR_DISABLED_TEST_CS_SRC += \
|
||||
$(CORECLR_PATH)/tests/src/readytorun/main.cs \
|
||||
$(CORECLR_PATH)/tests/src/readytorun/test.cs
|
||||
|
||||
|
||||
# relies on a referenced managed or native assembly, to complicated here:
|
||||
CORECLR_DISABLED_TEST_CS_SRC += \
|
||||
$(CORECLR_PATH)/tests/src/Regressions/assemblyref/assem.cs \
|
||||
@@ -3851,7 +3856,7 @@ CORECLR_DISABLED_TEST_CS_SRC += \
|
||||
CORECLR_DISABLED_TEST_CS_SRC += \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/datetime/cfdatetimetools.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/datetime/datetimeisdaylightsavingtime.cs
|
||||
|
||||
|
||||
# relies on delegatedefinitions.cs helper
|
||||
CORECLR_DISABLED_TEST_CS_SRC += \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/multicastdelegate/multicastdelegatector.cs \
|
||||
@@ -3959,7 +3964,7 @@ CORECLR_DISABLED_TEST_CS_SRC += \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/system/delegate/threatmodel/public/testclass.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/system/delegate/threatmodel/tests/bindingtarget.cs \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/system/delegate/threatmodel/tests/testclass.cs
|
||||
|
||||
|
||||
# samples (should probably be removed upstream)
|
||||
CORECLR_DISABLED_TEST_CS_SRC += \
|
||||
$(CORECLR_PATH)/tests/src/hosting/samples/hosting/usercode/usercode.cs \
|
||||
@@ -3977,10 +3982,6 @@ CORECLR_DISABLED_TEST_CS_SRC += \
|
||||
$(CORECLR_PATH)/tests/src/JIT/Directed/newarr/newarr.cs \
|
||||
$(CORECLR_PATH)/tests/src/baseservices/exceptions/sharedexceptions/emptystacktrace/oomexception01.cs
|
||||
|
||||
# https://github.com/mono/mono/issues/7432
|
||||
CORECLR_DISABLED_TEST_CS_SRC += \
|
||||
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcsuppressfinalize.cs
|
||||
|
||||
CORECLR_TEST_IL_SRC = \
|
||||
$(CORECLR_PATH)/tests/src/JIT/BBT/Scenario4/Not-Int32.il \
|
||||
$(CORECLR_PATH)/tests/src/JIT/Directed/Convert/implicitConv.il \
|
||||
@@ -4965,6 +4966,7 @@ CORECLR_TEST_IL_SRC = \
|
||||
$(CORECLR_PATH)/tests/src/JIT/jit64/opt/regress/vswhidbey/223862/rem.il \
|
||||
$(CORECLR_PATH)/tests/src/JIT/jit64/opt/regress/vswhidbey/228572/conv.il \
|
||||
$(CORECLR_PATH)/tests/src/JIT/jit64/opt/regress/vswhidbey/481244/foo.il \
|
||||
$(CORECLR_PATH)/tests/src/JIT/jit64/opt/regress/vswhidbey/481244/foo2.il \
|
||||
$(CORECLR_PATH)/tests/src/JIT/jit64/regress/ddb/118414/118414.il \
|
||||
$(CORECLR_PATH)/tests/src/JIT/jit64/regress/ddb/127931/127931.il \
|
||||
$(CORECLR_PATH)/tests/src/JIT/jit64/regress/vsw/102974/test.il \
|
||||
@@ -5056,9 +5058,6 @@ CORECLR_DISABLED_TEST_IL_SRC += \
|
||||
CORECLR_DISABLED_TEST_IL_SRC += \
|
||||
$(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/lcliimpl.il
|
||||
|
||||
# We use an r4 for r4-r8 stack merge so it loses precision
|
||||
CORECLR_DISABLED_TEST_IL_SRC += \
|
||||
$(CORECLR_PATH)/tests/src/JIT/jit64/opt/regress/vswhidbey/481244/foo2.il
|
||||
|
||||
# FIXME: these tests are baselined, i.e. we don't have time to investigate
|
||||
# them right now but want to make sure we don't introduce new regressions
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#! /bin/sh
|
||||
r='@mono_build_root@'
|
||||
aotpattern="--aot="
|
||||
|
||||
# if this is an aot invoke
|
||||
if [[ $@ =~ $aotpattern ]];
|
||||
then
|
||||
# just aot the code
|
||||
echo "$r/runtime/mono-wrapper $@"
|
||||
exec $r/runtime/mono-wrapper $@
|
||||
else
|
||||
# else run it under perf
|
||||
echo "$MONO_PERF_BINARY record -o $r/acceptance-tests/perf.data -v -s -g -- $r/mono/mini/mono-sgen $@"
|
||||
exec $MONO_PERF_BINARY record -o $r/acceptance-tests/perf.data -v -s -g $r/mono/mini/mono-sgen $@
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
check-microbench: DebianShootoutMono.stamp
|
||||
@$(MAKE) test-run-microbench
|
||||
|
||||
DebianShootoutMono.stamp:
|
||||
@$(MAKE) validate-DebianShootoutMono RESET_VERSIONS=1
|
||||
@$(MAKE) prepare-dlls
|
||||
@touch $@
|
||||
|
||||
abs_top_srcdir = $(abspath $(top_srcdir))
|
||||
TEST_EXE_PATH=$(abs_top_srcdir)/acceptance-tests/external/DebianShootoutMono/release/
|
||||
NET_4_X_RUNTIME=MONO_PATH=$(TEST_EXE_PATH):$(abs_top_srcdir)/mcs/class/lib/net_4_x $(abs_top_srcdir)/runtime/mono-wrapper
|
||||
FULL_AOT_RUNTIME=MONO_PATH=$(abs_top_srcdir)/mcs/class/lib/testing_aot_full $(abs_top_srcdir)/runtime/mono-wrapper
|
||||
|
||||
PERF_BINARY=$(if $(MONO_PERF_BINARY),$(MONO_PERF_BINARY),perf)
|
||||
PERF_RUNTIME=$(abs_top_srcdir)/acceptance-tests/microbench-perf.sh
|
||||
|
||||
define BenchmarkDotNetTemplate
|
||||
|
||||
run-microbench-$(1):: DebianShootoutMono.stamp
|
||||
MONO_BENCH_AOT_RUN="$(AOT_RUN_FLAGS)" \
|
||||
MONO_BENCH_AOT_BUILD="$(AOT_BUILD_FLAGS)" \
|
||||
MONO_BENCH_EXECUTABLE="$(abs_top_srcdir)/runtime/mono-wrapper" \
|
||||
MONO_BENCH_PATH="$(abs_top_srcdir)/mcs/class/lib/$(TEST_PROFILE)" \
|
||||
MONO_BENCH_INPUT="$(2)" \
|
||||
$(NET_4_X_RUNTIME) \
|
||||
$(TEST_EXE_PATH)/DebianShootoutMono.exe $(1)
|
||||
|
||||
test-run-microbench:: run-microbench-$(1)
|
||||
|
||||
run-microbench-debug-$(1):: DebianShootoutMono.stamp
|
||||
echo MONO_PATH="$(abs_top_srcdir)/mcs/class/lib/$(TEST_PROFILE)" $(abs_top_srcdir)/runtime/mono-wrapper $(AOT_BUILD_FLAGS) $(TEST_EXE_PATH)/DebianShootoutMono.exe
|
||||
MONO_BENCH_INPUT="$(2)" \
|
||||
MONO_PATH="$(abs_top_srcdir)/mcs/class/lib/$(TEST_PROFILE)" \
|
||||
$(abs_top_srcdir)/runtime/mono-wrapper $(AOT_RUN_FLAGS) $(TEST_EXE_PATH)/DebianShootoutMono.exe Run $(1)
|
||||
|
||||
test-run-microbench-debug:: run-microbench-debug-$(1)
|
||||
|
||||
if HOST_LINUX
|
||||
run-microbench-profiled-$(1):: microbench-results/$(1).perf.data
|
||||
|
||||
microbench-results/$(1).perf.data: DebianShootoutMono.stamp
|
||||
mkdir -p microbench-results
|
||||
MONO_PERF_BINARY="$(PERF_BINARY)" \
|
||||
MONO_BENCH_EXECUTABLE="$(PERF_RUNTIME)" \
|
||||
MONO_BENCH_AOT_RUN="$(AOT_RUN_FLAGS)"\
|
||||
MONO_BENCH_AOT_BUILD="$(AOT_BUILD_FLAGS)"\
|
||||
MONO_BENCH_PATH="$(abs_top_srcdir)/mcs/class/lib/$(TEST_PROFILE)" \
|
||||
MONO_BENCH_INPUT="$(2)" \
|
||||
$(NET_4_X_RUNTIME) \
|
||||
$(TEST_EXE_PATH)/DebianShootoutMono.exe $(1) $(2)
|
||||
mv perf.data microbench-results/$(1).perf.data
|
||||
|
||||
microbench-results/$(1).tmp.perf: microbench-results/$(1).perf.data
|
||||
$(PERF_BINARY) script -i microbench-results/$(1).perf.data > microbench-results/$(1).tmp.perf
|
||||
|
||||
microbench-results/$(1).perf-flame.svg: microbench-results/$(1).tmp.perf
|
||||
cat microbench-results/$(1).tmp.perf | ./external/DebianShootoutMono/FlameGraph/stackcollapse-perf.pl > microbench-results/$(1).perf-folded
|
||||
./external/DebianShootoutMono/FlameGraph/flamegraph.pl microbench-results/$(1).perf-folded > microbench-results/$(1).perf-flame.svg
|
||||
rm microbench-results/$(1).tmp.perf
|
||||
rm microbench-results/$(1).perf-folded
|
||||
|
||||
MONO_PERF_FLAGS=--show-cpu-utilization -n --hierarchy -T $(MONO_PERF_ADDITIONAL_FLAGS)
|
||||
|
||||
microbench-results/$(1).perf.report: microbench-results/$(1).perf.data
|
||||
$(PERF_BINARY) report -i microbench-results/$(1).perf.data $(MONO_PERF_FLAGS) > microbench-results/$(1).perf.report
|
||||
|
||||
test-run-microbench-profiled:: run-microbench-profiled-$(1)
|
||||
|
||||
test-run-microbench-publish-collect:: microbench-results/$(1).perf.data microbench-results/$(1).perf.report microbench-results/$(1).perf-flame.svg
|
||||
|
||||
endif
|
||||
|
||||
endef
|
||||
|
||||
if HOST_LINUX
|
||||
|
||||
test-run-microbench-perf-check:
|
||||
$(PERF_BINARY) record -a -o perf.data -- echo "testing"
|
||||
rm perf.data
|
||||
|
||||
microbench-results/perf-data.zip:
|
||||
zip microbench-results/perf-data.zip microbench-results/*.perf.data
|
||||
rm microbench-results/*.perf.data
|
||||
|
||||
perf-report: microbench-results/perf-data.zip
|
||||
|
||||
perf-report-total: test-run-microbench-publish-collect
|
||||
@$(MAKE) perf-report
|
||||
|
||||
endif
|
||||
|
||||
.PHONY: prepare-dlls
|
||||
|
||||
if FULL_AOT_TESTS
|
||||
prepare-dlls:
|
||||
$(FULL_AOT_RUNTIME) $(AOT_BUILD_FLAGS) $(TEST_EXE_PATH)/*.{dll,exe}
|
||||
|
||||
else
|
||||
|
||||
prepare-dlls:
|
||||
|
||||
endif
|
||||
|
||||
FIXTURE_DIR=$(abs_top_srcdir)/acceptance-tests/external/DebianShootoutMono/fixtures
|
||||
|
||||
$(eval $(call BenchmarkDotNetTemplate,Mandelbrot,))
|
||||
$(eval $(call BenchmarkDotNetTemplate,RegexRedux,$(FIXTURE_DIR)/regexredux-input.txt))
|
||||
$(eval $(call BenchmarkDotNetTemplate,KNucleotide,$(FIXTURE_DIR)/knucleotide-input.txt))
|
||||
|
||||
$(eval $(call BenchmarkDotNetTemplate,BinaryTrees,))
|
||||
$(eval $(call BenchmarkDotNetTemplate,NBodyTest,))
|
||||
$(eval $(call BenchmarkDotNetTemplate,SpectralNorm,))
|
||||
$(eval $(call BenchmarkDotNetTemplate,Fannkuchredux,))
|
||||
$(eval $(call BenchmarkDotNetTemplate,Fasta,))
|
||||
|
||||
$(eval $(call BenchmarkDotNetTemplate,RevComp,$(FIXTURE_DIR)/revcomp-input.txt))
|
||||
|
||||
#$(eval $(call BenchmarkDotNetTemplate,GistBenchmark,$(MONO_BENCH_GIST_URL))) broken in BDN, bug filed
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
check-ms-test-suite: $(CLASS)/nunitlite.dll
|
||||
@if $(MAKE) validate-ms-test-suite RESET_VERSIONS=1; then \
|
||||
$(MAKE) -C $(MSTESTSUITE_PATH)/conformance build MCS="$(MCS) -debug:portable -t:library -warn:1 -r:$(CLASS)/nunitlite.dll" && \
|
||||
$(MAKE) -C $(MSTESTSUITE_PATH)/systemruntimebringup build MCS="$(MCS) -debug:portable -t:library -warn:1 -r:$(CLASS)/nunitlite.dll" && \
|
||||
$(MAKE) -C $(MSTESTSUITE_PATH)/System.Linq.Expressions build MCS="$(MCS) -debug:portable -t:library -warn:1 -r:$(CLASS)/nunitlite.dll" && \
|
||||
$(MAKE) -C $(MSTESTSUITE_PATH)/conformance run NUNIT-CONSOLE="$(RUNTIME) $(CLASS)/nunit-lite-console.exe -exclude=MonoBug,BadTest -format:nunit2" NUNIT_XML_RESULT="-result:$(abs_top_builddir)/acceptance-tests/TestResult-ms-test-suite-conformance.xml" || EXIT_CODE=1; \
|
||||
$(MAKE) -C $(MSTESTSUITE_PATH)/systemruntimebringup run NUNIT-CONSOLE="$(RUNTIME) $(CLASS)/nunit-lite-console.exe -exclude=MonoBug,BadTest -format:nunit2" NUNIT_XML_RESULT="-result:$(abs_top_builddir)/acceptance-tests/TestResult-ms-test-suite-systemruntimebringup.xml" || EXIT_CODE=1; \
|
||||
$(MAKE) -C $(MSTESTSUITE_PATH)/System.Linq.Expressions run NUNIT-CONSOLE="$(RUNTIME) $(CLASS)/nunit-lite-console.exe -exclude=MonoBug,BadTest -format:nunit2" NUNIT_XML_RESULT="-result:$(abs_top_builddir)/acceptance-tests/TestResult-ms-test-suite-systemlinqexpressions.xml" || EXIT_CODE=1; \
|
||||
$(MAKE) -C $(MSTESTSUITE_PATH)/systemruntimebringup build MCS="$(MCS) -debug:portable -warn:1" && \
|
||||
$(MAKE) -C $(MSTESTSUITE_PATH)/systemruntimebringup run MONO="$(RUNTIME)" || EXIT_CODE=1; \
|
||||
exit $$EXIT_CODE; \
|
||||
else \
|
||||
echo "*** [ms-test-suite] Getting the repository failed, you probably don't have access to this Xamarin-internal resource. Skipping."; \
|
||||
|
||||
@@ -57,21 +57,21 @@ namespace Mono.Profiling.Tests.Stress {
|
||||
"jit",
|
||||
};
|
||||
|
||||
static readonly TimeSpan _timeout = TimeSpan.FromHours (6);
|
||||
|
||||
const RegexOptions _regexOptions = RegexOptions.Compiled | RegexOptions.Singleline;
|
||||
static readonly TimeSpan _timeout = TimeSpan.FromHours (8);
|
||||
|
||||
static readonly Dictionary<string, Predicate<Benchmark>> _filters = new Dictionary<string, Predicate<Benchmark>> {
|
||||
{ "ironjs-v8", FilterNotOnArm },
|
||||
{ "msbiology", FilterNever },
|
||||
{ "ironjs-v8", FilterArmArchitecture },
|
||||
};
|
||||
|
||||
static bool FilterNever (Benchmark benchmark)
|
||||
{
|
||||
return false;
|
||||
static readonly Dictionary<string, Action<TestResult>> _processors = new Dictionary<string, Action<TestResult>> {
|
||||
{ "msbiology", Process32BitOutOfMemory },
|
||||
};
|
||||
|
||||
static string FilterInvalidXmlChars (string text) {
|
||||
return Regex.Replace (text, @"[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]", string.Empty);
|
||||
}
|
||||
|
||||
static bool FilterNotOnArm (Benchmark benchmark)
|
||||
static bool FilterArmArchitecture (Benchmark benchmark)
|
||||
{
|
||||
#if ARCH_arm || ARCH_arm64
|
||||
return false;
|
||||
@@ -80,66 +80,45 @@ namespace Mono.Profiling.Tests.Stress {
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Process32BitOutOfMemory (TestResult result)
|
||||
{
|
||||
if (Environment.Is64BitProcess)
|
||||
return;
|
||||
|
||||
if (result.ExitCode == null || result.ExitCode == 0)
|
||||
return;
|
||||
|
||||
if (result.StandardError.Contains ("OutOfMemoryException"))
|
||||
result.ExitCode = 0;
|
||||
}
|
||||
|
||||
static bool IsSupported (Benchmark benchmark)
|
||||
{
|
||||
return _filters.TryGetValue (benchmark.Name, out var filter) ? filter (benchmark) : true;
|
||||
}
|
||||
|
||||
static string ReplaceInvalidXmlChars (string text) {
|
||||
return Regex.Replace (text, @"[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]", string.Empty);
|
||||
}
|
||||
|
||||
static int Main ()
|
||||
{
|
||||
var regex = new Regex (".*", _regexOptions);
|
||||
|
||||
if (Environment.GetEnvironmentVariable ("MONO_PROFILER_STRESS_REGEX") is string envRegex)
|
||||
regex = new Regex (envRegex, _regexOptions);
|
||||
|
||||
var depDir = Path.Combine ("..", "external", "benchmarker");
|
||||
var benchDir = Path.Combine (depDir, "benchmarks");
|
||||
var testDir = Path.Combine (depDir, "tests");
|
||||
|
||||
var benchmarks = Directory.EnumerateFiles (benchDir, "*.benchmark")
|
||||
.Select (Benchmark.Load)
|
||||
.Where (b => !b.OnlyExplicit && b.ClientCommandLine == null && IsSupported (b) && regex.IsMatch (b.Name))
|
||||
.Where (b => !b.OnlyExplicit && b.ClientCommandLine == null && IsSupported (b))
|
||||
.OrderBy (b => b.Name)
|
||||
.ToArray ();
|
||||
|
||||
var monoPath = Path.GetFullPath (Path.Combine ("..", "..", "runtime", "mono-wrapper"));
|
||||
var classDir = Path.GetFullPath (Path.Combine ("..", "..", "mcs", "class", "lib", "net_4_x"));
|
||||
|
||||
var seed = Environment.TickCount;
|
||||
|
||||
if (Environment.GetEnvironmentVariable ("MONO_PROFILER_STRESS_SEED") is string envSeed)
|
||||
seed = int.Parse (envSeed);
|
||||
|
||||
var timeout = (int) _timeout.TotalMilliseconds;
|
||||
|
||||
if (Environment.GetEnvironmentVariable ("MONO_PROFILER_STRESS_TIMEOUT") is string envTimeout)
|
||||
timeout = (int) TimeSpan.Parse (envTimeout).TotalMilliseconds;
|
||||
|
||||
string options = null;
|
||||
|
||||
if (Environment.GetEnvironmentVariable ("MONO_PROFILER_STRESS_OPTIONS") is string envOptions)
|
||||
options = envOptions;
|
||||
|
||||
var suspend = false;
|
||||
|
||||
if (Environment.GetEnvironmentVariable ("MONO_PROFILER_STRESS_SUSPEND") is string envSuspend)
|
||||
suspend = bool.Parse (envSuspend);
|
||||
|
||||
var rand = new Random (seed);
|
||||
var rand = new Random ();
|
||||
var cpus = Environment.ProcessorCount;
|
||||
|
||||
var sw = Stopwatch.StartNew ();
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Magenta;
|
||||
Console.WriteLine ($"[{sw.Elapsed.ToString ("G")}] Starting test session with seed: {seed}");
|
||||
Console.ResetColor ();
|
||||
|
||||
var results = new List<TestResult> (benchmarks.Length);
|
||||
|
||||
var sw = Stopwatch.StartNew ();
|
||||
|
||||
for (var i = 0; i < benchmarks.Length; i++) {
|
||||
var bench = benchmarks [i];
|
||||
|
||||
@@ -148,24 +127,17 @@ namespace Mono.Profiling.Tests.Stress {
|
||||
var maxSamples = rand.Next (0, cpus * 2000 + 1);
|
||||
var heapShotFreq = rand.Next (-10, 11);
|
||||
var maxFrames = rand.Next (0, 33);
|
||||
var flags = _options.ToDictionary (x => x, _ => rand.Next (0, 2) == 1)
|
||||
.Select (x => (x.Value ? string.Empty : "no") + x.Key)
|
||||
.ToArray ();
|
||||
var options = _options.ToDictionary (x => x, _ => rand.Next (0, 2) == 1)
|
||||
.Select (x => (x.Value ? string.Empty : "no") + x.Key)
|
||||
.ToArray ();
|
||||
|
||||
var profOptions = "nodefaults,output=/dev/null,";
|
||||
var profOptions = $"maxframes={maxFrames},{string.Join (",", options)},output=/dev/null";
|
||||
|
||||
if (options == null) {
|
||||
profOptions += $"maxframes={maxFrames},";
|
||||
if (sampleFreq > 0)
|
||||
profOptions += $",sample{sampleMode}={sampleFreq},maxsamples={maxSamples}";
|
||||
|
||||
if (sampleFreq > 0)
|
||||
profOptions += $"sample{sampleMode}={sampleFreq},maxsamples={maxSamples},";
|
||||
|
||||
if (heapShotFreq > 0)
|
||||
profOptions += $"heapshot={heapShotFreq}gc,";
|
||||
|
||||
profOptions += string.Join (",", flags);
|
||||
} else
|
||||
profOptions += options;
|
||||
if (heapShotFreq > 0)
|
||||
profOptions += $",heapshot={heapShotFreq}gc";
|
||||
|
||||
var info = new ProcessStartInfo {
|
||||
UseShellExecute = false,
|
||||
@@ -179,9 +151,6 @@ namespace Mono.Profiling.Tests.Stress {
|
||||
info.EnvironmentVariables.Clear ();
|
||||
info.EnvironmentVariables.Add ("MONO_PATH", classDir);
|
||||
|
||||
if (suspend)
|
||||
info.EnvironmentVariables.Add ("MONO_DEBUG", "suspend-on-native-crash,suspend-on-unhandled");
|
||||
|
||||
var progress = $"({i + 1}/{benchmarks.Length})";
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Blue;
|
||||
@@ -218,7 +187,7 @@ namespace Mono.Profiling.Tests.Stress {
|
||||
proc.BeginOutputReadLine ();
|
||||
proc.BeginErrorReadLine ();
|
||||
|
||||
if (!proc.WaitForExit (timeout)) {
|
||||
if (!proc.WaitForExit ((int) _timeout.TotalMilliseconds)) {
|
||||
// Force a thread dump.
|
||||
Syscall.kill (proc.Id, Signum.SIGQUIT);
|
||||
Thread.Sleep (1000);
|
||||
@@ -258,6 +227,9 @@ namespace Mono.Profiling.Tests.Stress {
|
||||
Console.WriteLine (result.StandardError);
|
||||
}
|
||||
|
||||
if (_processors.TryGetValue (bench.Name, out var processor))
|
||||
processor (result);
|
||||
|
||||
results.Add (result);
|
||||
}
|
||||
|
||||
@@ -274,7 +246,7 @@ namespace Mono.Profiling.Tests.Stress {
|
||||
|
||||
using (var writer = XmlWriter.Create ("TestResult-profiler-stress.xml", settings)) {
|
||||
writer.WriteStartDocument ();
|
||||
writer.WriteComment ($"This file represents the results of running a test suite (seed: {seed})");
|
||||
writer.WriteComment ("This file represents the results of running a test suite");
|
||||
|
||||
writer.WriteStartElement ("test-results");
|
||||
writer.WriteAttributeString ("name", "profiler-stress-tests.dummy");
|
||||
@@ -335,11 +307,11 @@ namespace Mono.Profiling.Tests.Stress {
|
||||
writer.WriteStartElement ("failure");
|
||||
|
||||
writer.WriteStartElement ("message");
|
||||
writer.WriteCData (ReplaceInvalidXmlChars (result.StandardOutput));
|
||||
writer.WriteCData (FilterInvalidXmlChars (result.StandardOutput));
|
||||
writer.WriteEndElement ();
|
||||
|
||||
writer.WriteStartElement ("stack-trace");
|
||||
writer.WriteCData (ReplaceInvalidXmlChars (result.StandardError));
|
||||
writer.WriteCData (FilterInvalidXmlChars (result.StandardError));
|
||||
writer.WriteEndElement ();
|
||||
|
||||
writer.WriteEndElement ();
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
check-roslyn:
|
||||
@echo "Runnning roslyn tests using mono from PATH:"
|
||||
mono --version
|
||||
@$(MAKE) validate-roslyn RESET_VERSIONS=1
|
||||
@if [ -z $$PREFIX ]; then echo "You need to set PREFIX to the prefix of the Mono installation that should be used for testing Roslyn." && exit 1; fi
|
||||
sed -i -e 's/\\4.5-api"/\\4.5"/g' $$PREFIX/lib/mono/xbuild-frameworks/.NETFramework/v4.5/RedistList/FrameworkList.xml; \
|
||||
export MSBuildExtensionsPath=$$PREFIX/lib/mono/xbuild; \
|
||||
MONO_DOTNET_PORTABLE_DIR=$$PREFIX/lib/mono/xbuild-frameworks/.NETPortable/; \
|
||||
if [ ! -d "$$MONO_DOTNET_PORTABLE_DIR/v4.6" ]; then \
|
||||
mkdir -p $$MONO_DOTNET_PORTABLE_DIR; \
|
||||
curl -SL "http://download.mono-project.com/third-party/RoslynBuildDependencies.zip" > /tmp/RoslynBuildDependencies.zip; \
|
||||
unzip -o /tmp/RoslynBuildDependencies.zip -d /tmp/RoslynBuildDependencies; \
|
||||
cp -r /tmp/RoslynBuildDependencies/PortableReferenceAssemblies/* $$MONO_DOTNET_PORTABLE_DIR; \
|
||||
fi; \
|
||||
cd $(ROSLYN_PATH); \
|
||||
./build.sh --restore --build --test --mono || exit; \
|
||||
echo "done"
|
||||
sed -i -e 'N; s/bootstrapArg=".*\n.*"/bootstrapArg=""/g' cibuild.sh; \
|
||||
sed -i -e 's#-xml Binaries/\$$BUILD_CONFIGURATION/xUnitResults/#-nunit $(abs_top_builddir)/acceptance-tests/TestResult-#g' cibuild.sh; \
|
||||
./cibuild.sh --mono-path $$PREFIX/bin || EXIT_CODE=1; \
|
||||
sed -i -e 's/\\4.5"/\\4.5-api"/g' $$PREFIX/lib/mono/xbuild-frameworks/.NETFramework/v4.5/RedistList/FrameworkList.xml; \
|
||||
exit $$EXIT_CODE
|
||||
@@ -7,7 +7,6 @@ $(eval $(call ValidateVersionTemplate,benchmarker,BENCHMARKER))
|
||||
$(eval $(call ValidateVersionTemplate,roslyn,ROSLYN))
|
||||
$(eval $(call ValidateVersionTemplate,coreclr,CORECLR))
|
||||
$(eval $(call ValidateVersionTemplate,ms-test-suite,MSTESTSUITE))
|
||||
$(eval $(call ValidateVersionTemplate,DebianShootoutMono,DEBIANSHOOTOUTMONO))
|
||||
|
||||
# Bump the given submodule to the revision given by the REV make variable
|
||||
# If COMMIT is 1, commit the change
|
||||
@@ -15,7 +14,6 @@ bump-benchmarker: __bump-benchmarker
|
||||
bump-roslyn: __bump-version-roslyn
|
||||
bump-coreclr: __bump-version-coreclr
|
||||
bump-ms-test-suite: __bump-version-ms-test-suite
|
||||
bump-DebianShootoutMono: __bump-version-DebianShootoutMono
|
||||
|
||||
# Bump the given submodule to the branch given by the BRANCH/REMOTE_BRANCH make variables
|
||||
# If COMMIT is 1, commit the change
|
||||
@@ -23,7 +21,6 @@ bump-branch-benchmarker: __bump-branch-benchmarker
|
||||
bump-branch-roslyn: __bump-branch-roslyn
|
||||
bump-branch-coreclr: __bump-branch-coreclr
|
||||
bump-branch-ms-test-suite: __bump-branch-ms-test-suite
|
||||
bump-branch-DebianShootoutMono: __bump-branch-DebianShootoutMono
|
||||
|
||||
# Bump the given submodule to its current GIT version
|
||||
# If COMMIT is 1, commit the change
|
||||
@@ -31,7 +28,6 @@ bump-current-benchmarker: __bump-current-benchmarker
|
||||
bump-current-roslyn: __bump-current-version-roslyn
|
||||
bump-current-coreclr: __bump-current-version-coreclr
|
||||
bump-current-ms-test-suite: __bump-current-version-ms-test-suite
|
||||
bump-current-DebianShootoutMono: __bump-current-version-DebianShootoutMono
|
||||
|
||||
commit-bump-benchmarker:
|
||||
$(MAKE) bump-benchmarker COMMIT=1
|
||||
@@ -45,9 +41,6 @@ commit-bump-coreclr:
|
||||
commit-bump-ms-test-suite:
|
||||
$(MAKE) bump-ms-test-suite COMMIT=1
|
||||
|
||||
commit-bump-DebianShootoutMono:
|
||||
$(MAKE) bump-DebianShootoutMono COMMIT=1
|
||||
|
||||
commit-bump-current-benchmarker:
|
||||
$(MAKE) bump-current-benchmarker COMMIT=1
|
||||
|
||||
@@ -59,6 +52,3 @@ commit-bump-current-coreclr:
|
||||
|
||||
commit-bump-current-ms-test-suite:
|
||||
$(MAKE) bump-current-ms-test-suite COMMIT=1
|
||||
|
||||
commit-bump-current-DebianShootoutMono:
|
||||
$(MAKE) bump-current-DebianShootoutMono COMMIT=1
|
||||
+13
-36
@@ -89,11 +89,9 @@ if test x$NOCONFIGURE = x && test -z "$*"; then
|
||||
echo
|
||||
fi
|
||||
|
||||
am_opt="--add-missing --copy --gnu -Wno-portability -Wno-obsolete"
|
||||
|
||||
case $CC in
|
||||
xlc )
|
||||
am_opt="$am_opt --include-deps";;
|
||||
am_opt=--include-deps;;
|
||||
esac
|
||||
|
||||
|
||||
@@ -104,10 +102,12 @@ if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Parse parameters
|
||||
|
||||
#
|
||||
# Plug in the extension module
|
||||
#
|
||||
has_ext_mod=false
|
||||
ext_mod_args=''
|
||||
has_disable_boehm=false
|
||||
for PARAM; do
|
||||
if [[ $PARAM =~ "--enable-extension-module" ]] ; then
|
||||
has_ext_mod=true
|
||||
@@ -115,16 +115,10 @@ for PARAM; do
|
||||
ext_mod_args=`echo $PARAM | cut -d= -f2`
|
||||
fi
|
||||
fi
|
||||
if [[ $PARAM =~ "--disable-boehm" ]] ; then
|
||||
has_disable_boehm=true
|
||||
fi
|
||||
done
|
||||
|
||||
#
|
||||
# Plug in the extension module
|
||||
#
|
||||
if test x$has_ext_mod = xtrue; then
|
||||
pushd $top_srcdir../mono-extensions/scripts
|
||||
pushd ../mono-extensions/scripts
|
||||
sh ./prepare-repo.sh $ext_mod_args || exit 1
|
||||
popd
|
||||
else
|
||||
@@ -148,40 +142,23 @@ if grep "^AC_CONFIG_HEADERS" configure.ac >/dev/null; then
|
||||
autoheader || { echo "**Error**: autoheader failed."; exit 1; }
|
||||
fi
|
||||
|
||||
echo "Running automake $am_opt ..."
|
||||
automake $am_opt ||
|
||||
echo "Running automake --gnu $am_opt ..."
|
||||
automake --add-missing --gnu -Wno-portability -Wno-obsolete $am_opt ||
|
||||
{ echo "**Error**: automake failed."; exit 1; }
|
||||
echo "Running autoconf ..."
|
||||
autoconf || { echo "**Error**: autoconf failed."; exit 1; }
|
||||
|
||||
# Update all submodules recursively to ensure everything is checked out
|
||||
if test -e $srcdir/scripts/update_submodules.sh; then
|
||||
(cd $srcdir && scripts/update_submodules.sh)
|
||||
fi
|
||||
|
||||
if test x$has_disable_boehm = xfalse -a -d $srcdir/external/bdwgc; then
|
||||
echo Running external/bdwgc/autogen.sh ...
|
||||
(cd $srcdir/external/bdwgc ; NOCONFIGURE=1 ./autogen.sh "$@")
|
||||
echo Done running external/bdwgc/autogen.sh ...
|
||||
if test -d $srcdir/libgc; then
|
||||
echo Running libgc/autogen.sh ...
|
||||
(cd $srcdir/libgc ; NOCONFIGURE=1 ./autogen.sh "$@")
|
||||
echo Done running libgc/autogen.sh ...
|
||||
fi
|
||||
|
||||
if test x$MONO_EXTRA_CONFIGURE_FLAGS != x; then
|
||||
echo "MONO_EXTRA_CONFIGURE_FLAGS is $MONO_EXTRA_CONFIGURE_FLAGS"
|
||||
fi
|
||||
|
||||
host_conf_flag=
|
||||
build_uname_all=`(uname -a) 2>/dev/null`
|
||||
case "$build_uname_all" in
|
||||
CYGWIN*)
|
||||
if [[ "$@" != *"--host="* ]]; then
|
||||
echo "Missing --host parameter, configure using ./configure --host=i686-w64-mingw32 or --host=x86_64-w64-mingw32"
|
||||
echo "Falling back using --host=x86_64-w64-mingw32 as default."
|
||||
host_conf_flag="--host=x86_64-w64-mingw32"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
conf_flags="$MONO_EXTRA_CONFIGURE_FLAGS --enable-maintainer-mode --enable-compile-warnings $host_conf_flag" #--enable-iso-c
|
||||
conf_flags="$MONO_EXTRA_CONFIGURE_FLAGS --enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
|
||||
|
||||
if test x$NOCONFIGURE = x; then
|
||||
echo Running $srcdir/configure $conf_flags "$@" ...
|
||||
|
||||
+48
-4
@@ -1,6 +1,50 @@
|
||||
# Code of Conduct
|
||||
# Contributor Code of Conduct
|
||||
|
||||
This project has adopted the code of conduct defined by the Contributor Covenant
|
||||
to clarify expected behavior in our community.
|
||||
As contributors and maintainers of this project, and in the interest of
|
||||
fostering an open and welcoming community, we pledge to respect all people who
|
||||
contribute through reporting issues, posting feature requests, updating
|
||||
documentation, submitting pull requests or patches, and other activities.
|
||||
|
||||
For more information, see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).
|
||||
We are committed to making participation in this project a harassment-free
|
||||
experience for everyone, regardless of level of experience, gender, gender
|
||||
identity and expression, sexual orientation, disability, personal appearance,
|
||||
body size, race, ethnicity, age, religion, or nationality.
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery
|
||||
* Personal attacks
|
||||
* Trolling or insulting/derogatory comments
|
||||
* Public or private harassment
|
||||
* Publishing other's private information, such as physical or electronic
|
||||
addresses, without explicit permission
|
||||
* Other unethical or unprofessional conduct
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
By adopting this Code of Conduct, project maintainers commit themselves to
|
||||
fairly and consistently applying these principles to every aspect of managing
|
||||
this project. Project maintainers who do not follow or enforce the Code of
|
||||
Conduct may be permanently removed from the project team.
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting a project maintainer at miguel@xamarin.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. Maintainers are
|
||||
obligated to maintain confidentiality with regard to the reporter of an
|
||||
incident.
|
||||
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 1.3.0, available at
|
||||
[http://contributor-covenant.org/version/1/3/0/][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/3/0/
|
||||
+882
-3282
File diff suppressed because it is too large.
Load diff
+3
-3
@@ -7,7 +7,7 @@ EXTRA_DIST = \
|
||||
config.in \
|
||||
browscap.ini mono.supp mono.d README \
|
||||
mono.pc.in mono-2.pc.in monosgen-2.pc.in mint.pc.in dotnet.pc.in dotnet35.pc.in wcf.pc.in monodoc.pc.in \
|
||||
mono-cairo.pc.in mono-options.pc.in cecil.pc.in \
|
||||
mono-nunit.pc.in mono-cairo.pc.in mono-options.pc.in cecil.pc.in \
|
||||
mono-lineeditor.pc.in system.web.extensions_1.0.pc.in system.web.extensions.design_1.0.pc.in\
|
||||
dtrace-prelink.sh system.web.mvc.pc.in system.web.mvc2.pc.in system.web.mvc3.pc.in aspnetwebstack.pc.in \
|
||||
reactive.pc.in xbuild12.pc \
|
||||
@@ -25,10 +25,10 @@ else
|
||||
SGENPCFILE=
|
||||
endif
|
||||
|
||||
pkgconfig_DATA= mono.pc mono-2.pc dotnet.pc dotnet35.pc wcf.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
|
||||
pkgconfig_DATA= mono.pc mono-2.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
|
||||
system.web.extensions.design_1.0.pc system.web.mvc.pc system.web.mvc2.pc system.web.mvc3.pc aspnetwebstack.pc reactive.pc xbuild12.pc $(SGENPCFILE)
|
||||
|
||||
DISTCLEANFILES= mono-2.pc mono.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
|
||||
DISTCLEANFILES= mono-2.pc mono.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
|
||||
system.web.extensions.design_1.0.pc system.web.mvc.pc system.web.mvc2.pc system.web.mvc3.pc aspnetwebstack.pc reactive.pc $(SGENPCFILE) mono-sgen-gdb.py
|
||||
|
||||
mono_DATA = config \
|
||||
|
||||
+1
-4
@@ -6,14 +6,11 @@
|
||||
<dllmap dll="libintl" name="bind_textdomain_codeset" target="@LIBC@" os="solaris"/>
|
||||
<dllmap dll="libintl" target="@INTL@" os="!windows"/>
|
||||
<dllmap dll="i:libxslt.dll" target="libxslt@libsuffix@" os="!windows"/>
|
||||
<dllmap dll="i:odbc32.dll" target="@ODBC@" os="!windows"/>
|
||||
<dllmap dll="i:odbc32.dll" target="libodbc@libsuffix@" os="!windows"/>
|
||||
<dllmap dll="i:odbc32.dll" target="libiodbc.dylib" os="osx"/>
|
||||
<dllmap dll="oci" target="libclntsh@libsuffix@" os="!windows"/>
|
||||
<dllmap dll="db2cli" target="libdb2_36@libsuffix@" os="!windows"/>
|
||||
<dllmap dll="MonoPosixHelper" target="$mono_libdir/libMonoPosixHelper@libsuffix@" os="!windows" />
|
||||
<dllmap dll="System.Native" target="$mono_libdir/@MONO_NATIVE_LIBRARY_NAME@@libsuffix@" os="!windows" />
|
||||
<dllmap dll="System.Net.Security.Native" target="$mono_libdir/@MONO_NATIVE_LIBRARY_NAME@@libsuffix@" os="!windows" />
|
||||
<dllmap dll="System.Security.Cryptography.Native.Apple" target="$mono_libdir/@MONO_NATIVE_LIBRARY_NAME@@libsuffix@" os="osx" />
|
||||
<dllmap dll="libmono-btls-shared" target="$mono_libdir/libmono-btls-shared@libsuffix@" os="!windows" />
|
||||
<dllmap dll="i:msvcrt" target="@LIBC@" os="!windows"/>
|
||||
<dllmap dll="i:msvcrt.dll" target="@LIBC@" os="!windows"/>
|
||||
|
||||
Executable → Regular
File mode changed.
+12
-12
@@ -53,7 +53,7 @@ def stringify_class_name(ns, name):
|
||||
if ns == "":
|
||||
return name
|
||||
else:
|
||||
return "{0}.{1}".format (ns, name)
|
||||
return "{}.{}".format (ns, name)
|
||||
|
||||
class ArrayPrinter:
|
||||
"Print a C# array"
|
||||
@@ -66,7 +66,7 @@ class ArrayPrinter:
|
||||
def to_string(self):
|
||||
obj = self.val.cast (gdb.lookup_type ("MonoArray").pointer ()).dereference ()
|
||||
length = obj ['max_length']
|
||||
return "{0} [{1}]".format (stringify_class_name (self.class_ns, self.class_name [0:len (self.class_name) - 2]), int (length))
|
||||
return "{} [{}]".format (stringify_class_name (self.class_ns, self.class_name [0:len (self.class_name) - 2]), int (length))
|
||||
|
||||
class ObjectPrinter:
|
||||
"Print a C# object"
|
||||
@@ -96,7 +96,7 @@ class ObjectPrinter:
|
||||
return (field.name, self.obj [field.name])
|
||||
except:
|
||||
# Superclass
|
||||
return (field.name, self.obj.cast (gdb.lookup_type ("{0}".format (field.name))))
|
||||
return (field.name, self.obj.cast (gdb.lookup_type ("{}".format (field.name))))
|
||||
|
||||
def children(self):
|
||||
# FIXME: It would be easier if gdb.Value would support iteration itself
|
||||
@@ -109,7 +109,7 @@ class ObjectPrinter:
|
||||
class_name = obj ['vtable'].dereference ()['klass'].dereference ()['name'].string ()
|
||||
if class_name [-2:len(class_name)] == "[]":
|
||||
return {}.__iter__ ()
|
||||
gdb_type = gdb.lookup_type ("struct {0}_{1}".format (class_ns.replace (".", "_"), class_name))
|
||||
gdb_type = gdb.lookup_type ("struct {}_{}".format (class_ns.replace (".", "_"), class_name))
|
||||
return self._iterator(obj.cast (gdb_type))
|
||||
except:
|
||||
print (sys.exc_info ()[0])
|
||||
@@ -129,12 +129,12 @@ class ObjectPrinter:
|
||||
return ArrayPrinter (self.val,class_ns,class_name).to_string ()
|
||||
if class_ns != "":
|
||||
try:
|
||||
gdb_type = gdb.lookup_type ("struct {0}.{1}".format (class_ns, class_name))
|
||||
gdb_type = gdb.lookup_type ("struct {}.{}".format (class_ns, class_name))
|
||||
except:
|
||||
# Maybe there is no debug info for that type
|
||||
return "{0}.{1}".format (class_ns, class_name)
|
||||
return "{}.{}".format (class_ns, class_name)
|
||||
#return obj.cast (gdb_type)
|
||||
return "{0}.{1}".format (class_ns, class_name)
|
||||
return "{}.{}".format (class_ns, class_name)
|
||||
return class_name
|
||||
except:
|
||||
print (sys.exc_info ()[0])
|
||||
@@ -154,9 +154,9 @@ class MonoMethodPrinter:
|
||||
val = self.val.dereference ()
|
||||
klass = val ["klass"].dereference ()
|
||||
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
|
||||
return "\"{0}:{1} ()\"".format (class_name, val ["name"].string ())
|
||||
return "\"{}:{} ()\"".format (class_name, val ["name"].string ())
|
||||
# This returns more info but requires calling into the inferior
|
||||
#return "\"{0}\"".format (gdb.parse_and_eval ("mono_method_full_name ({0}, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
|
||||
#return "\"{}\"".format (gdb.parse_and_eval ("mono_method_full_name ({}, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
|
||||
|
||||
class MonoClassPrinter:
|
||||
"Print a MonoClass structure"
|
||||
@@ -169,9 +169,9 @@ class MonoClassPrinter:
|
||||
return "0x0"
|
||||
klass = self.val.dereference ()
|
||||
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
|
||||
return "\"{0}\"".format (class_name)
|
||||
return "\"{}\"".format (class_name)
|
||||
# This returns more info but requires calling into the inferior
|
||||
#return "\"{0}\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*){0})->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
|
||||
#return "\"{}\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*){})->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
|
||||
|
||||
def lookup_pretty_printer(val):
|
||||
t = str (val.type)
|
||||
@@ -245,4 +245,4 @@ exec_file = gdb.current_objfile ().filename
|
||||
if os.stat (exec_file).st_size != os.lstat (exec_file).st_size:
|
||||
exec_file = os.readlink (exec_file)
|
||||
exec_dir = os.path.dirname (exec_file)
|
||||
gdb.execute ("source {0}/{1}-gdbinit".format (exec_dir, os.path.basename (exec_file)))
|
||||
gdb.execute ("source {}/{}-gdbinit".format (exec_dir, os.path.basename (exec_file)))
|
||||
+16
-16
@@ -48,7 +48,7 @@ def stringify_class_name(ns, name):
|
||||
if ns == "":
|
||||
return name
|
||||
else:
|
||||
return "{0}.{1}".format (ns, name)
|
||||
return "{}.{}".format (ns, name)
|
||||
|
||||
class ArrayPrinter:
|
||||
"Print a C# array"
|
||||
@@ -61,7 +61,7 @@ class ArrayPrinter:
|
||||
def to_string(self):
|
||||
obj = self.val.cast (gdb.lookup_type ("MonoArray").pointer ()).dereference ()
|
||||
length = obj ['max_length']
|
||||
return "{0} [{1}]".format (stringify_class_name (self.class_ns, self.class_name [0:len(self.class_name) - 2]), int(length))
|
||||
return "{} [{}]".format (stringify_class_name (self.class_ns, self.class_name [0:len(self.class_name) - 2]), int(length))
|
||||
|
||||
class ObjectPrinter:
|
||||
"Print a C# object"
|
||||
@@ -91,7 +91,7 @@ class ObjectPrinter:
|
||||
return (field.name, self.obj [field.name])
|
||||
except:
|
||||
# Superclass
|
||||
return (field.name, self.obj.cast (gdb.lookup_type ("{0}".format (field.name))))
|
||||
return (field.name, self.obj.cast (gdb.lookup_type ("{}".format (field.name))))
|
||||
|
||||
def children(self):
|
||||
# FIXME: It would be easier if gdb.Value would support iteration itself
|
||||
@@ -105,7 +105,7 @@ class ObjectPrinter:
|
||||
if class_name [-2:len(class_name)] == "[]":
|
||||
return {}.__iter__ ()
|
||||
try:
|
||||
gdb_type = gdb.lookup_type ("struct {0}_{1}".format (class_ns.replace (".", "_"), class_name))
|
||||
gdb_type = gdb.lookup_type ("struct {}_{}".format (class_ns.replace (".", "_"), class_name))
|
||||
return self._iterator(obj.cast (gdb_type))
|
||||
except:
|
||||
return {}.__iter__ ()
|
||||
@@ -127,12 +127,12 @@ class ObjectPrinter:
|
||||
return ArrayPrinter (self.val,class_ns,class_name).to_string ()
|
||||
if class_ns != "":
|
||||
try:
|
||||
gdb_type = gdb.lookup_type ("struct {0}.{1}".format (class_ns, class_name))
|
||||
gdb_type = gdb.lookup_type ("struct {}.{}".format (class_ns, class_name))
|
||||
except:
|
||||
# Maybe there is no debug info for that type
|
||||
return "{0}.{1}".format (class_ns, class_name)
|
||||
return "{}.{}".format (class_ns, class_name)
|
||||
#return obj.cast (gdb_type)
|
||||
return "{0}.{1}".format (class_ns, class_name)
|
||||
return "{}.{}".format (class_ns, class_name)
|
||||
return class_name
|
||||
except:
|
||||
print (sys.exc_info ()[0])
|
||||
@@ -152,9 +152,9 @@ class MonoMethodPrinter:
|
||||
val = self.val.dereference ()
|
||||
klass = val ["klass"].dereference ()
|
||||
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
|
||||
return "\"{0}:{1} ()\"".format (class_name, val ["name"].string ())
|
||||
return "\"{}:{} ()\"".format (class_name, val ["name"].string ())
|
||||
# This returns more info but requires calling into the inferior
|
||||
#return "\"{0}\"".format (gdb.parse_and_eval ("mono_method_full_name ({0}, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
|
||||
#return "\"{}\"".format (gdb.parse_and_eval ("mono_method_full_name ({}, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
|
||||
|
||||
class MonoClassPrinter:
|
||||
"Print a MonoClass structure"
|
||||
@@ -168,11 +168,11 @@ class MonoClassPrinter:
|
||||
klass = self.val.dereference ()
|
||||
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
|
||||
if add_quotes:
|
||||
return "\"{0}\"".format (class_name)
|
||||
return "\"{}\"".format (class_name)
|
||||
else:
|
||||
return class_name
|
||||
# This returns more info but requires calling into the inferior
|
||||
#return "\"{0}\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*){0})->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
|
||||
#return "\"{}\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*){})->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
|
||||
|
||||
def to_string(self):
|
||||
try:
|
||||
@@ -220,7 +220,7 @@ class MonoGenericClassPrinter:
|
||||
method_inst_str = ""
|
||||
if int(method_inst.cast (gdb.lookup_type ("guint64"))) != 0:
|
||||
method_inst_str = str(method_inst)
|
||||
return "{0}, [{1}], [{2}]>".format (container_str, class_inst_str, method_inst_str)
|
||||
return "{}, [{}], [{}]>".format (container_str, class_inst_str, method_inst_str)
|
||||
|
||||
def to_string(self):
|
||||
try:
|
||||
@@ -250,9 +250,9 @@ class MonoTypePrinter:
|
||||
info = str(t ["data"]["generic_class"])
|
||||
|
||||
if info != "":
|
||||
return "{{{0}, {1}}}".format (kind, info)
|
||||
return "{{{}, {}}}".format (kind, info)
|
||||
else:
|
||||
return "{{{0}}}".format (kind)
|
||||
return "{{{}}}".format (kind)
|
||||
except:
|
||||
#print (sys.exc_info ()[0])
|
||||
#print (sys.exc_info ()[1])
|
||||
@@ -281,7 +281,7 @@ class MonoMethodRgctxPrinter:
|
||||
if i > 0:
|
||||
inst_str = inst_str + ", "
|
||||
inst_str = inst_str + type_printer.to_string ()
|
||||
return "MRGCTX[{0}, [{1}]]".format (klass_printer.to_string(), inst_str)
|
||||
return "MRGCTX[{}, [{}]]".format (klass_printer.to_string(), inst_str)
|
||||
|
||||
class MonoVTablePrinter:
|
||||
"Print a MonoVTable structure"
|
||||
@@ -296,7 +296,7 @@ class MonoVTablePrinter:
|
||||
klass = vtable ["klass"]
|
||||
klass_printer = MonoClassPrinter (klass)
|
||||
|
||||
return "vtable({0})".format (klass_printer.to_string ())
|
||||
return "vtable({})".format (klass_printer.to_string ())
|
||||
|
||||
def lookup_pretty_printer(val):
|
||||
t = str (val.type)
|
||||
|
||||
+15
-15
@@ -1,9 +1,8 @@
|
||||
import lldb
|
||||
import traceback
|
||||
|
||||
def print_frames(thread, num_frames, current_thread):
|
||||
# TODO: Make output header similar to bt.
|
||||
print('%c thread #%i' % ('*' if current_thread else ' ', thread.idx))
|
||||
print '%c thread #%i' % ('*' if current_thread else ' ', thread.idx)
|
||||
|
||||
if current_thread:
|
||||
selected_frame = thread.GetSelectedFrame()
|
||||
@@ -12,19 +11,20 @@ def print_frames(thread, num_frames, current_thread):
|
||||
pc = str(frame.addr)
|
||||
var = frame
|
||||
function_name = frame.GetFunctionName()
|
||||
if function_name == "interp_exec_method_full":
|
||||
if function_name == "ves_exec_method_with_context":
|
||||
try:
|
||||
s = 'frame->imethod->method'
|
||||
methoddesc = frame.EvaluateExpression('(char*) mono_method_full_name (' + s + ', 1)').summary[1:-1]
|
||||
s = 'frame->runtime_method->method'
|
||||
klassname = frame.EvaluateExpression('(char*) ' + s + '->klass->name').summary[1:-1]
|
||||
methodname = frame.EvaluateExpression('(char*) ' + s + '->name').summary[1:-1]
|
||||
|
||||
ipoffset = frame.EvaluateExpression('ip').GetValueAsUnsigned()
|
||||
insn = ''
|
||||
if ipoffset != 0:
|
||||
ipoffset -= frame.EvaluateExpression('frame->imethod->code').GetValueAsUnsigned()
|
||||
insn = "\"" + frame.EvaluateExpression('mono_interp_opname (*ip)').summary[1:-1] + "\""
|
||||
var = '%s @ %d %s || %s' % (methoddesc, ipoffset, insn, frame)
|
||||
ipoffset -= frame.EvaluateExpression('rtm->code').GetValueAsUnsigned()
|
||||
insn = "\"" + frame.EvaluateExpression('mono_interp_opname [*ip]').summary[1:-1] + "\""
|
||||
var = '%s::%s @ %d %s || %s' % (klassname, methodname, ipoffset, insn, frame)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
print "DBG: execfail:" + str(e)
|
||||
elif function_name == "mono_interp_transform_method":
|
||||
try:
|
||||
s = 'runtime_method->method'
|
||||
@@ -32,7 +32,7 @@ def print_frames(thread, num_frames, current_thread):
|
||||
methodname = frame.EvaluateExpression('(char*) ' + s + '->name').summary[1:-1]
|
||||
var = 'transforming %s::%s || %s' % (klassname, methodname, frame)
|
||||
except Exception as e:
|
||||
print("DBG: transformfail:" + str(e))
|
||||
print "DBG: transformfail:" + str(e)
|
||||
elif pc[0] == '0':
|
||||
try:
|
||||
framestr = frame.EvaluateExpression('(char*)mono_pmip((void*)%s)' % pc).summary[1:-1]
|
||||
@@ -40,7 +40,7 @@ def print_frames(thread, num_frames, current_thread):
|
||||
except:
|
||||
pass
|
||||
|
||||
print(' %c %s' % ('*' if current_thread and frame.idx == selected_frame.idx else ' ', var))
|
||||
print ' %c %s' % ('*' if current_thread and frame.idx == selected_frame.idx else ' ', var)
|
||||
|
||||
def monobt(debugger, command, result, dict):
|
||||
opts = {'all_bt': False, 'num_frames': None}
|
||||
@@ -50,20 +50,20 @@ def monobt(debugger, command, result, dict):
|
||||
elif command.isdigit():
|
||||
opts['num_frames'] = int(command)
|
||||
elif command != '':
|
||||
print('error: monobt [<number>|all]')
|
||||
print 'error: monobt [<number>|all]'
|
||||
return
|
||||
|
||||
target = debugger.GetSelectedTarget()
|
||||
process = target.process
|
||||
|
||||
if not process.IsValid():
|
||||
print('error: invalid process')
|
||||
print 'error: invalid process'
|
||||
return
|
||||
|
||||
if opts['all_bt']:
|
||||
for thread in process.threads:
|
||||
print_frames(thread, len(thread), process.selected_thread == thread)
|
||||
print('')
|
||||
print ''
|
||||
else:
|
||||
thread = process.selected_thread
|
||||
num_frames = len(thread) if opts['num_frames'] is None else opts['num_frames']
|
||||
@@ -76,4 +76,4 @@ def __lldb_init_module (debugger, dict):
|
||||
# Add any commands contained in this module to LLDB
|
||||
debugger.HandleCommand('command script add -f monobt.monobt monobt')
|
||||
debugger.HandleCommand('command alias mbt monobt')
|
||||
print('"monobt" command installed')
|
||||
print '"monobt" command installed'
|
||||
@@ -0,0 +1,9 @@
|
||||
prefix=${pcfiledir}/../..
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
|
||||
Name: Mono NUnit
|
||||
Description: Mono's version of NUnit
|
||||
Version: @VERSION@
|
||||
Libs: -r:${libdir}/mono/4.5/nunit.core.dll -r:${libdir}/mono/4.5/nunit.core.interfaces.dll -r:${libdir}/mono/4.5/nunit.core.extensions.dll -r:${libdir}/mono/4.5/nunit.framework.dll -r:${libdir}/mono/4.5/nunit.framework.extensions.dll -r:${libdir}/mono/4.5/nunit.mocks.dll -r:${libdir}/mono/4.5/nunit.util.dll -r:${libdir}/mono/4.5/nunit-console-runner.dll
|
||||
@@ -116,7 +116,7 @@
|
||||
<add prefix="http" type="System.Net.HttpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="https" type="System.Net.HttpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="ftp" type="System.Net.FtpWebRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</webRequestModules>
|
||||
</system.net>
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
<add prefix="http" type="System.Net.HttpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="https" type="System.Net.HttpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="ftp" type="System.Net.FtpWebRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</webRequestModules>
|
||||
<settings>
|
||||
<ipv6 enabled="false"/>
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
<add prefix="http" type="System.Net.HttpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="https" type="System.Net.HttpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="ftp" type="System.Net.FtpWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</webRequestModules>
|
||||
</system.net>
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
<section name="assemblyBinding" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false" />
|
||||
<section name="satelliteassemblies" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false" />
|
||||
<section name="startup" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false"/>
|
||||
<section name="system.codedom" type="System.CodeDom.Compiler.CodeDomConfigurationHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="system.data" type="System.Data.Common.DbProviderFactoriesConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="system.diagnostics" type="System.Diagnostics.SystemDiagnosticsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="system.runtime.remoting" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowLocation="false"/>
|
||||
<section name="system.windows.forms" type="System.Windows.Forms.WindowsFormsSection, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="system.codedom" type="System.CodeDom.Compiler.CodeDomConfigurationHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="windows" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false" />
|
||||
<section name="strongNames" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowLocation="false"/>
|
||||
<sectionGroup name="system.runtime.serialization" type="System.Runtime.Serialization.Configuration.SerializationSectionGroup, System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
@@ -136,7 +136,7 @@
|
||||
<add prefix="http" type="System.Net.HttpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="https" type="System.Net.HttpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="ftp" type="System.Net.FtpWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
</webRequestModules>
|
||||
</system.net>
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace HtmlAgilityPack
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks for existence of attribute with given name
|
||||
/// Checks for existance of attribute with given name
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
+2
-3
@@ -52,8 +52,7 @@ EXTRA_DIST = \
|
||||
|
||||
-include $(mcs_topdir)/build/config.make
|
||||
|
||||
DOC_PROFILE:=net_4_x
|
||||
CLASS=$(mcs_topdir)/class/lib/$(DOC_PROFILE)
|
||||
CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
|
||||
|
||||
dist-hook:
|
||||
$(mkdir_p) $(distdir)/sources
|
||||
@@ -69,7 +68,7 @@ clean-local:
|
||||
-rm -f deploy/* convert.exe* AgilityPack.dll*
|
||||
-rm -f $(ASSEMBLED_DOCS)
|
||||
|
||||
TOOL_MAKE=$(MAKE) -f $(srcdir)/docs.make topdir=$(srcdir)/../mcs srcdir=$(srcdir) PROFILE=$(DOC_PROFILE)
|
||||
TOOL_MAKE=$(MAKE) -f $(srcdir)/docs.make topdir=$(srcdir)/../mcs srcdir=$(srcdir)
|
||||
|
||||
monoapi.zip: monoapi.tree
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ Layout
|
||||
as well as the upcoming Monodoc tools and index creation
|
||||
tools).
|
||||
|
||||
The files can contain any amount of extra information.
|
||||
The files can contain any ammount of extra information.
|
||||
|
||||
The documentation from the source code is then merged with
|
||||
these files and the header/footer information to produce
|
||||
|
||||
@@ -43,16 +43,6 @@
|
||||
line-height: 0px;
|
||||
}
|
||||
|
||||
.mapi-codeblock {
|
||||
display: block;
|
||||
padding: 5pt 5pt;
|
||||
margin: 10pt;
|
||||
white-space: pre;
|
||||
font-family: monospace;
|
||||
border: 1px solid rgba(233,233,233,1);
|
||||
background-color: rgba(249,249,249,1);
|
||||
}
|
||||
|
||||
.mapi-entry code {
|
||||
border: none;
|
||||
background-color: transparent;
|
||||
|
||||
+2
-25
@@ -13,31 +13,10 @@ ASSEMBLED_DOCS = \
|
||||
monoapi.tree monoapi.zip
|
||||
|
||||
convert.exe: $(srcdir)/convert.cs AgilityPack.dll
|
||||
$(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Xml.dll -out:$@ $< -r:AgilityPack.dll
|
||||
$(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/System.Xml.dll -out:$@ $< -r:AgilityPack.dll
|
||||
|
||||
AgilityPack.dll:
|
||||
$(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Xml.dll -target:library -out:$@ $(srcdir)/HtmlAgilityPack/*.cs
|
||||
|
||||
ifdef MCS_MODE
|
||||
monoapi.zip:
|
||||
touch $@
|
||||
|
||||
monoapi.tree: monoapi.zip
|
||||
touch $@
|
||||
|
||||
mono-tools.zip:
|
||||
touch $@
|
||||
|
||||
mono-tools.tree: mono-tools.zip
|
||||
touch $@
|
||||
|
||||
mono-file-formats.zip:
|
||||
touch $@
|
||||
|
||||
mono-file-formats.tree: mono-file-formats.zip
|
||||
touch $@
|
||||
|
||||
else
|
||||
$(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/System.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Xml.dll -target:library -out:$@ $(srcdir)/HtmlAgilityPack/*.cs
|
||||
|
||||
monoapi.zip: monoapi.tree
|
||||
@test -f $@ || { rm -f $< && $(MAKE) $<; }
|
||||
@@ -57,7 +36,5 @@ mono-file-formats.zip: mono-file-formats.tree
|
||||
mono-file-formats.tree: $(srcdir)/mono-file-formats.config $(srcdir)/docs.make
|
||||
$(MDOC) assemble -o mono-file-formats -f man $<
|
||||
|
||||
endif
|
||||
|
||||
.doc-stamp:
|
||||
|
||||
+1
-1
@@ -69,5 +69,5 @@ object for filters is passed in a local variable (cfg->exvar).
|
||||
throw: we first save all regs into a sigcontext struct and then call the stack
|
||||
unwinding code.
|
||||
|
||||
catch handler: catch handlers are always called from the stack unwinding
|
||||
catch handler: catch hanlders are always called from the stack unwinding
|
||||
code. The exception object is passed in a local variable (cfg->exvar).
|
||||
+4
-20
@@ -124,7 +124,6 @@ sub process_function {
|
||||
my $body = '';
|
||||
my $returns = '';
|
||||
my $prototype = '';
|
||||
my $codeblock = 'false';
|
||||
|
||||
while (<$file>) {
|
||||
|
||||
@@ -157,6 +156,7 @@ sub process_function {
|
||||
if (defined($deprecated)) {
|
||||
process_formatting(\$deprecated, $file_path, $.);
|
||||
}
|
||||
$body =~ s/\n/ /g;
|
||||
|
||||
if (exists($docs->{body}->{$name})) {
|
||||
my $origin = $docs->{origin}->{$name};
|
||||
@@ -180,16 +180,8 @@ sub process_function {
|
||||
chomp;
|
||||
s/^ +\*//;
|
||||
|
||||
if (/\s*\\code$/) {
|
||||
$codeblock = 'true';
|
||||
} elsif (/\s*\\endcode$/) {
|
||||
$codeblock = 'false';
|
||||
}
|
||||
|
||||
# Replace blank lines with paragraph breaks if we're not in a code block.
|
||||
if (/^\s*$/) {
|
||||
$_ = '<p>' if $codeblock eq 'false';
|
||||
}
|
||||
# Replace blank lines with paragraph breaks.
|
||||
$_ = '<p>' if /^\s*$/;
|
||||
|
||||
if ($section == $PARAMETER_SECTION) {
|
||||
if (/\s*\\param +(\w+)(.*)/) {
|
||||
@@ -218,7 +210,7 @@ sub process_function {
|
||||
$returns = "\t$_\n";
|
||||
$section = $RETURN_SECTION;
|
||||
} else {
|
||||
$body .= "\n$_";
|
||||
$body .= "\n\t$_";
|
||||
}
|
||||
} elsif ($section == $RETURN_SECTION) {
|
||||
$returns .= "\n\t$_";
|
||||
@@ -235,12 +227,6 @@ sub process_formatting {
|
||||
my ($content, $file_path, $current_line) = @_;
|
||||
$_ = $$content;
|
||||
|
||||
# General formatting
|
||||
s{\\b +(\w+)}{<strong>$1</strong>}g;
|
||||
s{\\a +(\w+)}{<i>$1</i>}g;
|
||||
s{\\e +(\w+)}{<i>$1</i>}g;
|
||||
s{\\em +(\w+)}{<i>$1</i>}g;
|
||||
|
||||
# Constants
|
||||
s{NULL}{<code>NULL</code>}g;
|
||||
s{TRUE}{<code>TRUE</code>}g;
|
||||
@@ -257,8 +243,6 @@ sub process_formatting {
|
||||
warn "$file_path:$current_line: Old-style monodoc notation '`code`' used\n"
|
||||
if s{\`((?!api:)[:.\w\*]+)\`}{<code>$1</code>}g && $WARNINGS;
|
||||
s{\\c +(\S+(?<![.,:;]))}{<code>$1</code>}g;
|
||||
s{\\code}{<pre><code class="mapi-codeblock">}g;
|
||||
s{\\endcode}{</code></pre>}g;
|
||||
|
||||
$$content = $_;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
<manpage name="mono-xmltool(1)" page="../man/mono-xmltool.1" />
|
||||
<manpage name="mozroots(1)" page="../man/mozroots.1" />
|
||||
<manpage name="permview(1)" page="../man/permview.1" />
|
||||
<manpage name="prj2make(1)" page="../man/prj2make.1" />
|
||||
<manpage name="resgen(1)" page="../man/resgen.1" />
|
||||
<manpage name="secutil(1)" page="../man/secutil.1" />
|
||||
<manpage name="setreg(1)" page="../man/setreg.1" />
|
||||
|
||||
-138
@@ -1,138 +0,0 @@
|
||||
# Mono RISC-V Port
|
||||
|
||||
These are some useful links and notes pertaining to the RISC-V port of Mono.
|
||||
|
||||
## Useful RISC-V documentation
|
||||
|
||||
* [RISC-V User-Level ISA Specification](https://riscv.org/specifications)
|
||||
* [RISC-V Privileged ISA Specification](https://riscv.org/specifications/privileged-isa)
|
||||
* [RISC-V Debug Specification](https://riscv.org/specifications/debug-specification)
|
||||
* [RISC-V ELF psABI Specification](https://github.com/riscv/riscv-elf-psabi-doc)
|
||||
* [RISC-V C API Specification](https://github.com/riscv/riscv-c-api-doc)
|
||||
* [RISC-V Toolchain Conventions](https://github.com/riscv/riscv-toolchain-conventions)
|
||||
* [RISC-V Assembly Programmer's Manual](https://github.com/riscv/riscv-asm-manual)
|
||||
|
||||
## Useful RISC-V repositories
|
||||
|
||||
* [RISC-V Organization](https://github.com/riscv)
|
||||
* [RISC-V GNU Toolchain](https://github.com/riscv/riscv-gnu-toolchain)
|
||||
* [RISC-V Binutils](https://github.com/riscv/riscv-binutils-gdb)
|
||||
* [RISC-V GCC](https://github.com/riscv/riscv-gcc)
|
||||
* [RISC-V Glibc](https://github.com/riscv/riscv-glibc)
|
||||
* [RISC-V Newlib](https://github.com/riscv/riscv-newlib)
|
||||
* [RISC-V Tools](https://github.com/riscv/riscv-tools)
|
||||
* [RISC-V Opcodes](https://github.com/riscv/riscv-opcodes)
|
||||
* [RISC-V Tests](https://github.com/riscv/riscv-tests)
|
||||
|
||||
## Setting up a cross environment
|
||||
|
||||
### Debian/Ubuntu packages
|
||||
|
||||
This is the most painless way of getting a functional toolchain installed. Note
|
||||
that these packages may not be available on older distributions; this is tested
|
||||
on Ubuntu 19.04.
|
||||
|
||||
First, add this to your `$HOME/.bashrc` (or some other script that you run):
|
||||
|
||||
```bash
|
||||
export RISCV=$HOME/riscv
|
||||
export PATH=$RISCV/bin:$PATH
|
||||
export QEMU_LD_PREFIX=/usr/riscv64-linux-gnu
|
||||
```
|
||||
|
||||
Next, install the toolchain packages like so:
|
||||
|
||||
```bash
|
||||
# apt install autoconf automake binutils-riscv64-linux-gnu build-essential gcc-riscv64-linux-gnu gdb-multiarch g++-riscv64-linux-gnu libtool qemu qemu-system-misc qemu-user qemu-user-static
|
||||
```
|
||||
|
||||
You will now have all the toolchain binaries in `/usr/bin`.
|
||||
|
||||
### Building manually
|
||||
|
||||
This approach may be somewhat unstable since you will be using the latest
|
||||
versions of the various parts of the toolchain.
|
||||
|
||||
First, add this to your `$HOME/.bashrc` (or some other script that you run):
|
||||
|
||||
```bash
|
||||
export RISCV=$HOME/riscv
|
||||
export PATH=$RISCV/bin:$PATH
|
||||
export QEMU_LD_PREFIX=$RISCV/sysroot
|
||||
```
|
||||
|
||||
Next, install some dependencies needed to build the toolchain:
|
||||
|
||||
```console
|
||||
# apt install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev
|
||||
```
|
||||
|
||||
Finally, build the toolchain:
|
||||
|
||||
```console
|
||||
$ git clone --recursive [email protected]:riscv/riscv-gnu-toolchain.git
|
||||
$ cd riscv-gnu-toolchain
|
||||
$ ./configure --prefix=$RISCV --enable-linux --enable-multilib --with-arch=rv64imafdc --with-abi=lp64d
|
||||
$ make linux
|
||||
```
|
||||
|
||||
This will install the built toolchain binaries in `$RISCV/bin`.
|
||||
|
||||
## Building Mono with a cross toolchain
|
||||
|
||||
Building Mono is quite straightforward:
|
||||
|
||||
```console
|
||||
$ ./autogen.sh --prefix=$RISCV/sysroot --host=riscv64-linux-gnu
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
||||
(Note: You may need to use `--host=riscv64-unknown-linux-gnu` instead if you
|
||||
built the toolchain manually.)
|
||||
|
||||
You can set `CFLAGS` as appropriate to change the RISC-V options, such as which
|
||||
standard extensions and ABI to use. For example, to use the 64-bit soft float
|
||||
ABI:
|
||||
|
||||
```console
|
||||
$ CFLAGS="-mabi=lp64" ./autogen.sh --prefix=$RISCV/sysroot --host=riscv64-linux-gnu
|
||||
```
|
||||
|
||||
Note that, since this is a cross build, the `mcs` directory won't be built. You
|
||||
will have to build the managed libraries and tools through a native build of
|
||||
Mono and copy them into `$RISCV/sysroot`.
|
||||
|
||||
You can run Mono with QEMU like this:
|
||||
|
||||
```console
|
||||
$ qemu-riscv64 ./mono/mini/mono hello.exe
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
Debugging with GDB currently requires a manually built toolchain.
|
||||
|
||||
It can be done like so:
|
||||
|
||||
```console
|
||||
$ qemu-riscv64 -g 12345 ./mono/mini/mono --interp basic.exe &
|
||||
$ riscv64-unknown-elf-gdb -ex 'target remote localhost:12345' -ex 'b main' -ex 'c' ./mono/mini/mono
|
||||
```
|
||||
|
||||
## Things to be done
|
||||
|
||||
Things that need to be done beyond the basic 64-bit port, in no particular
|
||||
order:
|
||||
|
||||
* Complete the soft float port.
|
||||
* Complete the 32-bit port.
|
||||
* Add unwind info to trampolines.
|
||||
* Implement AOT support.
|
||||
* Implement interpreter support.
|
||||
* Implement LLVM support.
|
||||
* Implement SDB support.
|
||||
* Implement `dyn_call` support.
|
||||
* Ensure all runtime tests pass.
|
||||
* Ensure all corlib tests pass.
|
||||
* Set up CI on Jenkins.
|
||||
@@ -109,12 +109,6 @@ typedef struct {
|
||||
|
||||
<h3>Write Barriers</h3>
|
||||
|
||||
<p>SGen is a concurrent and generational GC, features which require
|
||||
tracking changes to the state of the heap. This is achieved through
|
||||
write barriers. Whenever native code is changing the state of the
|
||||
heap by storing references into another managed object, it needs to
|
||||
do it using this write barrier API.
|
||||
|
||||
<h4><a name="api:mono_gc_wbarrier_arrayref_copy">mono_gc_wbarrier_arrayref_copy</a></h4>
|
||||
<h4><a name="api:mono_gc_wbarrier_generic_nostore">mono_gc_wbarrier_generic_nostore</a></h4>
|
||||
<h4><a name="api:mono_gc_wbarrier_generic_store">mono_gc_wbarrier_generic_store</a></h4>
|
||||
|
||||
@@ -1,193 +1,73 @@
|
||||
<h1>Runtime Profiler API</h1>
|
||||
<h1>Profiling Interface</h1>
|
||||
|
||||
<p>The profiler API can be used by dynamically loaded profiler
|
||||
modules to monitor different aspects of a running program. The
|
||||
API is also usable by embedders without having to compile a
|
||||
profiler module.
|
||||
<h3>Profiler Operation</h3>
|
||||
|
||||
<h2>Profiler Modules</h2>
|
||||
<p>The following methods can be used by dynamic profiler
|
||||
methods to monitor different aspects of the program.
|
||||
|
||||
<p>A profiler module is simply a shared library with a single
|
||||
exported function which is the entry point that Mono calls at
|
||||
startup. It must have the following signature:
|
||||
<p>A custom profiler will have one public method defined in
|
||||
the shared library which is the entry point that Mono calls at
|
||||
startup, it has the following signature:
|
||||
|
||||
<pre><code class="mapi-codeblock">
|
||||
void mono_profiler_startup_example (const char *desc)
|
||||
</code></pre>
|
||||
<pre>
|
||||
void mono_profiler_startup (const char *desc)
|
||||
</pre>
|
||||
|
||||
<p>Here, the <code>example</code> portion of the function name is
|
||||
the name of the profiler module. It must match the shared library
|
||||
name (i.e. <code>libmono-profiler-example.so</code>). <i>desc</i>
|
||||
is the set of arguments that were passed from the command line.
|
||||
<p>Where "desc" is the set of arguments that were passed from
|
||||
the command line. This routine will call
|
||||
<tt>mono_profiler_install</tt> to activate the profiler and
|
||||
will install one or more filters (one of the various
|
||||
<tt>mono_profiler_install_</tt> functions).
|
||||
|
||||
<p>For example, a bare bones profiler module might look like this
|
||||
(<code>example.c</code>):
|
||||
<p>In addition, a profiler developer will typically call
|
||||
<tt>mono_profiler_set_events</tt> to register which kinds of
|
||||
traces should be enabled, these can be an OR-ed combination of
|
||||
the following:
|
||||
|
||||
<pre><code class="mapi-codeblock">
|
||||
#include <mono/metadata/profiler.h>
|
||||
#include <stdio.h>
|
||||
<pre>
|
||||
MONO_PROFILE_NONE
|
||||
MONO_PROFILE_APPDOMAIN_EVENTS
|
||||
MONO_PROFILE_ASSEMBLY_EVENTS
|
||||
MONO_PROFILE_MODULE_EVENTS
|
||||
MONO_PROFILE_CLASS_EVENTS
|
||||
MONO_PROFILE_JIT_COMPILATION
|
||||
MONO_PROFILE_INLINING
|
||||
MONO_PROFILE_EXCEPTIONS
|
||||
MONO_PROFILE_ALLOCATIONS
|
||||
MONO_PROFILE_GC
|
||||
MONO_PROFILE_THREADS
|
||||
MONO_PROFILE_REMOTING
|
||||
MONO_PROFILE_TRANSITIONS
|
||||
MONO_PROFILE_ENTER_LEAVE
|
||||
MONO_PROFILE_COVERAGE
|
||||
MONO_PROFILE_INS_COVERAGE
|
||||
MONO_PROFILE_STATISTICAL
|
||||
</pre>
|
||||
|
||||
struct _MonoProfiler {
|
||||
int dummy;
|
||||
}
|
||||
<p>Developers can change the set of monitored events at
|
||||
runtime by calling <tt>mono_profiler_set_events</tt>.
|
||||
|
||||
<h4><a name="api:mono_profiler_install">mono_profiler_install</a></h4>
|
||||
<h4><a name="api:mono_profiler_install_allocation">mono_profiler_install_allocation</a></h4>
|
||||
<h4><a name="api:mono_profiler_install_appdomain">mono_profiler_install_appdomain</a></h4>
|
||||
<h4><a name="api:mono_profiler_install_assembly">mono_profiler_install_assembly</a></h4>
|
||||
<h4><a name="api:mono_profiler_install_class">mono_profiler_install_class</a></h4>
|
||||
<h4><a name="api:mono_profiler_install_coverage_filter">mono_profiler_install_coverage_filter</a></h4>
|
||||
<h4><a name="api:mono_profiler_install_enter_leave">mono_profiler_install_enter_leave</a></h4>
|
||||
<h4><a name="api:mono_profiler_install_jit_compile">mono_profiler_install_jit_compile</a></h4>
|
||||
<h4><a name="api:mono_profiler_install_module">mono_profiler_install_module</a></h4>
|
||||
<h4><a name="api:mono_profiler_install_thread">mono_profiler_install_thread</a></h4>
|
||||
<h4><a name="api:mono_profiler_install_transition">mono_profiler_install_transition</a></h4>
|
||||
<h4><a name="api:mono_profiler_install_gc">mono_profiler_install_gc</a></h4>
|
||||
<h4><a name="api:mono_profiler_install_statistical">mono_profiler_install_statistical</a></h4>
|
||||
<h4><a name="api:mono_profiler_set_events">mono_profiler_set_events</a></h4>
|
||||
<h4><a name="api:mono_profiler_get_events">mono_profiler_get_events</a></h4>
|
||||
|
||||
static MonoProfiler profiler;
|
||||
<h3>Coverage</h3>
|
||||
|
||||
static void
|
||||
runtime_inited (MonoProfiler *prof)
|
||||
{
|
||||
printf ("Hello World");
|
||||
}
|
||||
<p>To support profiling modules that need to do code coverage
|
||||
analysis, the following routines is provided:
|
||||
|
||||
<h4><a name="api:mono_profiler_coverage_get">mono_profiler_coverage_get</a></h4>
|
||||
|
||||
void
|
||||
mono_profiler_init_example (const char *desc)
|
||||
{
|
||||
MonoProfilerHandle handle = mono_profiler_create (&profiler);
|
||||
mono_profiler_set_runtime_initialized_callback (handle, runtime_inited);
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<p>To compile this module, a C compiler must be invoked in a
|
||||
similar fashion to this, on Linux:
|
||||
|
||||
<pre><code class="mapi-codeblock">
|
||||
gcc -fPIC -shared -o libmono-profiler-example.so example.c `pkg-config --cflags mono-2`
|
||||
</code></pre>
|
||||
|
||||
<p>Or on OS X:
|
||||
|
||||
<pre><code class="mapi-codeblock">
|
||||
gcc -undefined suppress -flat_namespace -o libmono-profiler-example.so example.c `pkg-config --cflags mono-2`
|
||||
</code></pre>
|
||||
|
||||
<p>You can then load the module using:
|
||||
|
||||
<pre><code class="mapi-codeblock">
|
||||
mono --profile=example hello.exe
|
||||
</code></pre>
|
||||
|
||||
<p>(Note that adjusting <code>LD_LIBRARY_PATH</code> may be
|
||||
necessary in order for the dynamic linker to find the module.)
|
||||
|
||||
<h2>Profiler Functions</h2>
|
||||
|
||||
<p>These are the functions usable for profiling programs.
|
||||
|
||||
<p>Each function has a note indicating whether they're async
|
||||
safe. An async safe function can be invoked in a signal handler
|
||||
or when the world is stopped by the GC. Conversely, a function
|
||||
that is not async safe must not be invoked in such a context or
|
||||
undefined behavior can occur (crashes, deadlocks, etc).
|
||||
|
||||
<p>Some functions may only be invoked from a profiler module's
|
||||
init function (or prior to running managed code in the case of
|
||||
embedding). This is noted explicitly only if applicable to a
|
||||
function.
|
||||
|
||||
<h3>Basic Functions</h3>
|
||||
|
||||
<p>These functions are used to load and install profilers.
|
||||
|
||||
<h4><a name="api:mono_profiler_load">mono_profiler_load</a></h4>
|
||||
<h4><a name="api:mono_profiler_create">mono_profiler_create</a></h4>
|
||||
<h4><a name="api:mono_profiler_set_cleanup_callback">mono_profiler_set_cleanup_callback</a></h4>
|
||||
|
||||
<h3>Code Coverage</h3>
|
||||
|
||||
<p>These functions provide access to the JIT compiler's code
|
||||
coverage support. This functionality can be used to collect
|
||||
information about how many times certain code paths have been
|
||||
executed.
|
||||
|
||||
<h4><a name="api:mono_profiler_enable_coverage">mono_profiler_enable_coverage</a></h4>
|
||||
<h4><a name="api:mono_profiler_set_coverage_filter_callback">mono_profiler_set_coverage_filter_callback</a></h4>
|
||||
<h4><a name="api:mono_profiler_get_coverage_data">mono_profiler_get_coverage_data</a></h4>
|
||||
|
||||
<h3>Statistical Sampling</h3>
|
||||
|
||||
<p>Statistical sampling can be used to interrupt managed threads
|
||||
based on a certain mode and frequency for the purpose of
|
||||
collecting data about their current work.
|
||||
|
||||
<p>One common use case for this functionality, usually referred
|
||||
to as call sampling, is to collect a backtrace from every thread
|
||||
when a sampling hit event arrives. This data can then be compiled
|
||||
into a report indicating where a program spends most of its time.
|
||||
|
||||
<h4><a name="api:mono_profiler_enable_sampling">mono_profiler_enable_sampling</a></h4>
|
||||
<h4><a name="api:mono_profiler_set_sample_mode">mono_profiler_set_sample_mode</a></h4>
|
||||
<h4><a name="api:mono_profiler_get_sample_mode">mono_profiler_get_sample_mode</a></h4>
|
||||
|
||||
<p>A callback must be registered to receive sample hit events.
|
||||
Please see the <i>Callback Registration</i> section below.
|
||||
|
||||
<h3>GC Allocations</h3>
|
||||
|
||||
<p>Profilers can be notified about all GC allocations performed
|
||||
by a program or the Mono runtime.
|
||||
|
||||
<h4><a name="api:mono_profiler_enable_allocations">mono_profiler_enable_allocations</a></h4>
|
||||
|
||||
<p>A callback must be registered to receive allocation events.
|
||||
Please see the <i>Callback Registration</i> section below.
|
||||
|
||||
<h3>Call Instrumentation</h3>
|
||||
|
||||
<p>The JIT compiler supports instrumenting managed method entry
|
||||
and exit points so that a profiler callback will be invoked.
|
||||
|
||||
<p>While such callbacks by themselves have traditionally only
|
||||
been useful for call count profiling and the like, Mono gives
|
||||
these callbacks access to the arguments, locals, and return
|
||||
value of instrumented methods (together referred to as the 'call
|
||||
context'). This enables many profiling scenarios that would
|
||||
otherwise have required explicit hooks in the base class
|
||||
libraries.
|
||||
|
||||
<h4><a name="api:mono_profiler_set_call_instrumentation_filter_callback">mono_profiler_set_call_instrumentation_filter_callback</a></h4>
|
||||
<h4><a name="api:mono_profiler_enable_call_context_introspection">mono_profiler_enable_call_context_introspection</a></h4>
|
||||
<h4><a name="api:mono_profiler_call_context_get_this">mono_profiler_call_context_get_this</a></h4>
|
||||
<h4><a name="api:mono_profiler_call_context_get_argument">mono_profiler_call_context_get_argument</a></h4>
|
||||
<h4><a name="api:mono_profiler_call_context_get_local">mono_profiler_call_context_get_local</a></h4>
|
||||
<h4><a name="api:mono_profiler_call_context_get_result">mono_profiler_call_context_get_result</a></h4>
|
||||
<h4><a name="api:mono_profiler_call_context_free_buffer">mono_profiler_call_context_free_buffer</a></h4>
|
||||
|
||||
<p>Callbacks must be registered to receive method entry and exit
|
||||
events. Please see the <i>Callback Registration</i> section
|
||||
below.
|
||||
|
||||
<h3>Callback Registration</h3>
|
||||
|
||||
<p>In addition to the above functions, there's a large set of
|
||||
functions for installing generic profiler event callbacks. These
|
||||
are generated from C macros and so are not documented here.
|
||||
Please refer to the <code>mono/metadata/profiler.h</code> and
|
||||
<code>mono/metadata/profiler-events.h</code> headers for a full
|
||||
listing of these.
|
||||
|
||||
<p>Callback registration functions are all async safe and can be
|
||||
safely invoked from multiple threads at the same time, with the
|
||||
caveat that altering a registered callback from one thread will
|
||||
not immediately affect another thread that is already invoking
|
||||
the current callback.
|
||||
|
||||
<h2>API Stability</h2>
|
||||
|
||||
<p>The profiler API does not have the same API stability
|
||||
garantees that the rest of the Mono embedding API does. While
|
||||
a breaking change to the profiler API is extremely rare, it has
|
||||
happened in the past when changing the API in a backwards
|
||||
compatible way was deemed to be too much work for too little
|
||||
gain.
|
||||
|
||||
<p>Therefore, developers of profiler modules may rarely need to
|
||||
update their code to work with new versions of the profiler API.
|
||||
|
||||
<p>Developers who wish to support older versions of the API can
|
||||
perform a compile time check of the
|
||||
<code>MONO_PROFILER_API_VERSION</code> macro and maintain code
|
||||
for both old and new versions.
|
||||
|
||||
<p>To aid with transitioning to a new version of the profiler
|
||||
API, the Mono runtime will detect and reject loading profiler
|
||||
modules which were compiled against older profiler API versions.
|
||||
@@ -0,0 +1,22 @@
|
||||
/
|
||||
/depcomp
|
||||
/config.guess
|
||||
/config.sub
|
||||
/ltmain.sh
|
||||
/eglib-*.tar.gz
|
||||
/missing
|
||||
/install-sh
|
||||
/compile
|
||||
/Makefile
|
||||
/Makefile.in
|
||||
/stamp-h1
|
||||
/config.h.in
|
||||
/libtool
|
||||
/autom4te.cache
|
||||
/aclocal.m4
|
||||
/config.log
|
||||
/configure
|
||||
/config.h
|
||||
/config.status
|
||||
/INSTALL
|
||||
dolt*
|
||||
File renamed without changes.
@@ -0,0 +1,17 @@
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
@@ -0,0 +1,5 @@
|
||||
AM_CFLAGS = $(WERROR_CFLAGS)
|
||||
|
||||
SUBDIRS = src
|
||||
|
||||
EXTRA_DIST = README NEWS AUTHORS winconfig.h
|
||||
@@ -0,0 +1,3 @@
|
||||
Release notes for Mono are hosted on the web, please see:
|
||||
|
||||
http://www.mono-project.com/docs/about-mono/releases/
|
||||
@@ -0,0 +1,54 @@
|
||||
|
||||
The purpose of eglib is to be an X11-licensed subset of glib that can
|
||||
be used with Mono when the Mono runtime is explicitly relicensed under
|
||||
a different license by Novell.
|
||||
|
||||
The implementation is done from the public documentation available here:
|
||||
|
||||
http://developer.gnome.org/doc/API/2.0/glib/
|
||||
|
||||
Currently this is only being built standalone, use:
|
||||
|
||||
./autogen.sh --prefix=/tmp/test
|
||||
|
||||
Currently all the definitions go into a single file: glib.h, there are
|
||||
no separate files, please try to follow the convetions in the source code
|
||||
|
||||
* Tests
|
||||
|
||||
Please read the README in tests/
|
||||
|
||||
* Features
|
||||
|
||||
The source code is designed to allow for different operating
|
||||
system builds of the eglib code.
|
||||
|
||||
Files in src that:
|
||||
|
||||
* Have a plain name: are cross platform, and should work on
|
||||
every operating system.
|
||||
|
||||
* That end in -unix.c: These files contain Unix specific code.
|
||||
|
||||
* That end in -win32.c: These files contain Win32 specific code.
|
||||
|
||||
* That end in -posix.c: Will work on both Windows and Unix,
|
||||
but should not be included for other operating systems.
|
||||
|
||||
* Plans: short and long term.
|
||||
|
||||
The short term plans for eglib is to allow Mono to optionally
|
||||
build with it instead of using glib, gmodule and gthread, but
|
||||
the default build will continue to be done against glib 2.0.
|
||||
|
||||
In the long-term we are considering dropping glib as a
|
||||
dependency, considering that Mono requires a modern Unix
|
||||
system to run anyways (for its thread support) it would allow
|
||||
us to fix some of the glib API limitations we have to live
|
||||
with (explicit thread support for example), rework the API to
|
||||
use types from stdint.h and we would be able to drop three
|
||||
external shared libraries.
|
||||
|
||||
This would reduce memory usage for the handful of routines
|
||||
that we use from glib, dynamic linker overhead for those and
|
||||
would allow us to tune the implementation to Mono's needs.
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
* Missing code
|
||||
|
||||
* Process launching
|
||||
3 g_shell_quote
|
||||
1 g_shell_unquote
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
* Should implement, for better performance:
|
||||
|
||||
Macros:
|
||||
6 G_UNLIKELY
|
||||
4 G_LIKELY
|
||||
|
||||
* Unimplemented, not supported currently:
|
||||
|
||||
(none as yet.)
|
||||
|
||||
* Dead Code
|
||||
|
||||
The GMainLoop code was no longer in use in Mono.
|
||||
|
||||
* Windows implementations needed
|
||||
|
||||
Directory, File manipulation:
|
||||
|
||||
g_dir_open, g_dir_close, g_dir_read_name
|
||||
|
||||
We're missing a native windows implementation. The unix one is in place.
|
||||
|
||||
* Information retrieval
|
||||
1 g_win32_getlocale
|
||||
|
||||
File renamed without changes.
@@ -0,0 +1,65 @@
|
||||
noinst_LTLIBRARIES = libeglib.la
|
||||
|
||||
AM_CFLAGS = $(WERROR_CFLAGS)
|
||||
|
||||
win_files = \
|
||||
eglib-config.hw \
|
||||
gdate-win32.c gdir-win32.c gfile-win32.c gmisc-win32.c \
|
||||
gmodule-win32.c gmodule-win32-internals.h gtimer-win32.c gunicode-win32.c
|
||||
|
||||
unix_files = \
|
||||
gdate-unix.c gdir-unix.c gfile-unix.c gmisc-unix.c \
|
||||
gmodule-unix.c gtimer-unix.c
|
||||
|
||||
if HOST_WIN32
|
||||
os_files = $(win_files)
|
||||
else
|
||||
os_files = $(unix_files)
|
||||
endif
|
||||
|
||||
libeglib_la_SOURCES = \
|
||||
eglib-remap.h \
|
||||
sort.frag.h \
|
||||
glib.h \
|
||||
garray.c \
|
||||
gbytearray.c \
|
||||
gerror.c \
|
||||
ghashtable.c \
|
||||
giconv.c \
|
||||
gmem.c \
|
||||
gmodule.h \
|
||||
goutput.c \
|
||||
gqsort.c \
|
||||
gstr.c \
|
||||
gslist.c \
|
||||
gstring.c \
|
||||
gptrarray.c \
|
||||
glist.c \
|
||||
gqueue.c \
|
||||
gpath.c \
|
||||
gshell.c \
|
||||
gspawn.c \
|
||||
gfile.c \
|
||||
gfile-posix.c \
|
||||
gpattern.c \
|
||||
gmarkup.c \
|
||||
gutf8.c \
|
||||
gunicode.c \
|
||||
unicode-data.h \
|
||||
$(os_files)
|
||||
|
||||
libeglib_la_CFLAGS = -g -Wall -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
|
||||
|
||||
AM_CPPFLAGS = -I$(srcdir)
|
||||
|
||||
if HOST_WIN32
|
||||
libeglib_la_LIBADD = -lm $(LIBICONV) -lpsapi
|
||||
else
|
||||
if PLATFORM_ANDROID
|
||||
libeglib_la_LIBADD = -llog
|
||||
endif
|
||||
endif
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
EXTRA_DIST = eglib-config.h.in $(win_files) $(unix_files)
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef __EGLIB_CONFIG_H
|
||||
#define __EGLIB_CONFIG_H
|
||||
|
||||
/*
|
||||
* System-dependent settings
|
||||
*/
|
||||
#define G_GNUC_PRETTY_FUNCTION @GNUC_PRETTY@
|
||||
#define G_GNUC_UNUSED @GNUC_UNUSED@
|
||||
#define G_BYTE_ORDER @ORDER@
|
||||
#define G_GNUC_NORETURN @GNUC_NORETURN@
|
||||
#define G_SEARCHPATH_SEPARATOR_S "@SEARCHSEP@"
|
||||
#define G_SEARCHPATH_SEPARATOR '@SEARCHSEP@'
|
||||
#define G_DIR_SEPARATOR '@PATHSEP@'
|
||||
#define G_DIR_SEPARATOR_S "@PATHSEP@"
|
||||
#define G_BREAKPOINT() @BREAKPOINT@
|
||||
#define G_OS_@OS@
|
||||
#define GPOINTER_TO_INT(ptr) @GPOINTER_TO_INT@
|
||||
#define GPOINTER_TO_UINT(ptr) @GPOINTER_TO_UINT@
|
||||
#define GINT_TO_POINTER(v) @GINT_TO_POINTER@
|
||||
#define GUINT_TO_POINTER(v) @GUINT_TO_POINTER@
|
||||
|
||||
#if @HAVE_ALLOCA_H@ == 1
|
||||
#define G_HAVE_ALLOCA_H
|
||||
#endif
|
||||
|
||||
typedef unsigned @GSIZE@ gsize;
|
||||
typedef signed @GSIZE@ gssize;
|
||||
|
||||
#define G_GSIZE_FORMAT @GSIZE_FORMAT@
|
||||
|
||||
#if @G_HAVE_ISO_VARARGS@ == 1
|
||||
#define G_HAVE_ISO_VARARGS
|
||||
#endif
|
||||
|
||||
#if defined (HOST_WATCHOS)
|
||||
#undef G_BREAKPOINT
|
||||
#define G_BREAKPOINT()
|
||||
#endif
|
||||
|
||||
typedef @PIDTYPE@ GPid;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
#ifndef __EGLIB_CONFIG_H
|
||||
#define __EGLIB_CONFIG_H
|
||||
|
||||
/*
|
||||
* System-dependent settings
|
||||
*/
|
||||
#define G_OS_WIN32 1
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#include <io.h>
|
||||
|
||||
#define G_GNUC_PRETTY_FUNCTION __FUNCTION__
|
||||
#define G_GNUC_UNUSED
|
||||
#define G_BYTE_ORDER 1234
|
||||
#define G_GNUC_NORETURN
|
||||
#define G_BREAKPOINT() __debugbreak()
|
||||
#define MAXPATHLEN 242
|
||||
|
||||
typedef uintptr_t gsize;
|
||||
typedef intptr_t gssize;
|
||||
typedef int pid_t;
|
||||
|
||||
#define G_DIR_SEPARATOR '\\'
|
||||
#define G_DIR_SEPARATOR_S "\\"
|
||||
#define G_SEARCHPATH_SEPARATOR_S ";"
|
||||
#define G_SEARCHPATH_SEPARATOR ';'
|
||||
#define G_GSIZE_FORMAT "d"
|
||||
#define GPOINTER_TO_INT(ptr) ((gint)(intptr_t) (ptr))
|
||||
#define GPOINTER_TO_UINT(ptr) ((guint)(intptr_t) (ptr))
|
||||
#define GINT_TO_POINTER(v) ((gpointer)(intptr_t) (v))
|
||||
#define GUINT_TO_POINTER(v) ((gpointer)(intptr_t) (v))
|
||||
|
||||
#define STDOUT_FILENO (int)(intptr_t)stdout
|
||||
#define STDERR_FILENO (int)(intptr_t)stderr
|
||||
|
||||
/* FIXME: what should this be ?*/
|
||||
#define X_OK 4 /* This is really read */
|
||||
#define WNOHANG 1
|
||||
#define F_SETFD 1
|
||||
#define FD_CLOEXEC 1
|
||||
|
||||
#undef inline
|
||||
#define inline __inline
|
||||
|
||||
#define strtok_r strtok_s
|
||||
|
||||
#undef G_HAVE_UNISTD_H
|
||||
#undef G_HAVE_SYS_TIME_H
|
||||
#undef G_HAVE_SYS_WAIT_H
|
||||
#undef G_HAVE_PWD_H
|
||||
#undef G_HAVE_STRNDUP
|
||||
#define G_HAVE_GETOPT_H 1
|
||||
|
||||
/* disable the following warnings
|
||||
* C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored.
|
||||
* C4127: conditional expression is constant
|
||||
*/
|
||||
#pragma warning(disable:4100 4127)
|
||||
#endif
|
||||
|
||||
typedef void * GPid;
|
||||
#endif
|
||||
@@ -1,11 +1,3 @@
|
||||
#undef g_malloc
|
||||
#undef g_realloc
|
||||
#undef g_malloc0
|
||||
#undef g_calloc
|
||||
#undef g_try_malloc
|
||||
#undef g_try_realloc
|
||||
#undef g_memdup
|
||||
|
||||
#define g_array_append monoeg_g_array_append
|
||||
#define g_array_append_vals monoeg_g_array_append_vals
|
||||
#define g_array_free monoeg_g_array_free
|
||||
@@ -16,7 +8,6 @@
|
||||
#define g_array_set_size monoeg_g_array_set_size
|
||||
#define g_array_sized_new monoeg_g_array_sized_new
|
||||
#define g_ascii_strdown monoeg_g_ascii_strdown
|
||||
#define g_ascii_strdown_no_alloc monoeg_g_ascii_strdown_no_alloc
|
||||
#define g_ascii_strncasecmp monoeg_g_ascii_strncasecmp
|
||||
#define g_ascii_tolower monoeg_g_ascii_tolower
|
||||
#define g_ascii_xdigit_value monoeg_g_ascii_xdigit_value
|
||||
@@ -68,7 +59,6 @@
|
||||
#define g_hash_table_foreach_steal monoeg_g_hash_table_foreach_steal
|
||||
#define g_hash_table_get_keys monoeg_g_hash_table_get_keys
|
||||
#define g_hash_table_get_values monoeg_g_hash_table_get_values
|
||||
#define g_hash_table_contains monoeg_g_hash_table_contains
|
||||
#define g_hash_table_insert_replace monoeg_g_hash_table_insert_replace
|
||||
#define g_hash_table_lookup monoeg_g_hash_table_lookup
|
||||
#define g_hash_table_lookup_extended monoeg_g_hash_table_lookup_extended
|
||||
@@ -122,9 +112,7 @@
|
||||
#define g_markup_parse_context_parse monoeg_g_markup_parse_context_parse
|
||||
#define g_memdup monoeg_g_memdup
|
||||
#define g_mem_set_vtable monoeg_g_mem_set_vtable
|
||||
#define g_mem_get_vtable monoeg_g_mem_get_vtable
|
||||
#define g_mkdtemp monoeg_g_mkdtemp
|
||||
#define g_module_address monoeg_g_module_address
|
||||
#define g_module_build_path monoeg_g_module_build_path
|
||||
#define g_module_close monoeg_g_module_close
|
||||
#define g_module_error monoeg_g_module_error
|
||||
@@ -136,18 +124,11 @@
|
||||
#define g_pattern_match_string monoeg_g_pattern_match_string
|
||||
#define g_pattern_spec_free monoeg_g_pattern_spec_free
|
||||
#define g_pattern_spec_new monoeg_g_pattern_spec_new
|
||||
#define g_async_safe_fgets monoeg_g_async_safe_fgets
|
||||
#define g_async_safe_fprintf monoeg_g_async_safe_fprintf
|
||||
#define g_async_safe_vfprintf monoeg_g_async_safe_vfprintf
|
||||
#define g_async_safe_printf monoeg_g_async_safe_printf
|
||||
#define g_async_safe_vprintf monoeg_g_async_safe_vprintf
|
||||
#define g_print monoeg_g_print
|
||||
#define g_printf monoeg_g_printf
|
||||
#define g_printv monoeg_g_printv
|
||||
#define g_printerr monoeg_g_printerr
|
||||
#define g_propagate_error monoeg_g_propagate_error
|
||||
#define g_ptr_array_add monoeg_g_ptr_array_add
|
||||
#define g_ptr_array_capacity monoeg_g_ptr_array_capacity
|
||||
#define g_ptr_array_foreach monoeg_g_ptr_array_foreach
|
||||
#define g_ptr_array_free monoeg_g_ptr_array_free
|
||||
#define g_ptr_array_new monoeg_g_ptr_array_new
|
||||
@@ -159,7 +140,6 @@
|
||||
#define g_ptr_array_sized_new monoeg_g_ptr_array_sized_new
|
||||
#define g_ptr_array_sort monoeg_g_ptr_array_sort
|
||||
#define g_ptr_array_sort_with_data monoeg_g_ptr_array_sort_with_data
|
||||
#define g_ptr_array_find monoeg_g_ptr_array_find
|
||||
#define g_qsort_with_data monoeg_g_qsort_with_data
|
||||
#define g_queue_free monoeg_g_queue_free
|
||||
#define g_queue_is_empty monoeg_g_queue_is_empty
|
||||
@@ -224,9 +204,12 @@
|
||||
#define g_string_append_unichar monoeg_g_string_append_unichar
|
||||
#define g_string_append_printf monoeg_g_string_append_printf
|
||||
#define g_string_append_vprintf monoeg_g_string_append_vprintf
|
||||
#define g_string_erase monoeg_g_string_erase
|
||||
#define g_string_free monoeg_g_string_free
|
||||
#define g_string_insert monoeg_g_string_insert
|
||||
#define g_string_new monoeg_g_string_new
|
||||
#define g_string_new_len monoeg_g_string_new_len
|
||||
#define g_string_prepend monoeg_g_string_prepend
|
||||
#define g_string_printf monoeg_g_string_printf
|
||||
#define g_string_set_size monoeg_g_string_set_size
|
||||
#define g_string_sized_new monoeg_g_string_sized_new
|
||||
@@ -236,8 +219,6 @@
|
||||
#define g_strlcpy monoeg_g_strlcpy
|
||||
#define g_strndup monoeg_g_strndup
|
||||
#define g_strnfill monoeg_g_strnfill
|
||||
#define g_strnlen monoeg_g_strnlen
|
||||
#define g_str_from_file_region monoeg_g_str_from_file_region
|
||||
#define g_strreverse monoeg_g_strreverse
|
||||
#define g_strsplit monoeg_g_strsplit
|
||||
#define g_strsplit_set monoeg_g_strsplit_set
|
||||
@@ -261,9 +242,6 @@
|
||||
#define g_usleep monoeg_g_usleep
|
||||
#define g_utf16_to_ucs4 monoeg_g_utf16_to_ucs4
|
||||
#define g_utf16_to_utf8 monoeg_g_utf16_to_utf8
|
||||
#define g_utf16_ascii_equal monoeg_g_utf16_ascii_equal
|
||||
#define g_utf16_asciiz_equal monoeg_g_utf16_asciiz_equal
|
||||
#define g_utf8_jump_table monoeg_g_utf8_jump_table
|
||||
#define g_utf8_get_char monoeg_g_utf8_get_char
|
||||
#define g_utf8_offset_to_pointer monoeg_g_utf8_offset_to_pointer
|
||||
#define g_utf8_pointer_to_offset monoeg_g_utf8_pointer_to_offset
|
||||
@@ -281,10 +259,7 @@
|
||||
#define g_utf8_to_ucs4_fast monoeg_g_utf8_to_ucs4_fast
|
||||
#define g_vasprintf monoeg_g_vasprintf
|
||||
#define g_win32_getlocale monoeg_g_win32_getlocale
|
||||
#define g_assertion_disable_global monoeg_assertion_disable_global
|
||||
#define g_assert_abort monoeg_assert_abort
|
||||
#define g_assertion_message monoeg_assertion_message
|
||||
#define g_get_assertion_message monoeg_get_assertion_message
|
||||
#define g_malloc monoeg_malloc
|
||||
#define g_malloc0 monoeg_malloc0
|
||||
#define g_ptr_array_grow monoeg_ptr_array_grow
|
||||
@@ -294,7 +269,6 @@
|
||||
#define g_strdup monoeg_strdup
|
||||
#define g_ucs4_to_utf16_len monoeg_ucs4_to_utf16_len
|
||||
#define g_utf16_to_ucs4_len monoeg_utf16_to_ucs4_len
|
||||
#define g_utf16_len monoeg_utf16_len
|
||||
|
||||
#define g_ascii_strcasecmp monoeg_ascii_strcasecmp
|
||||
#define g_ascii_strup monoeg_ascii_strup
|
||||
@@ -302,7 +276,9 @@
|
||||
#define g_unichar_break_type monoeg_unichar_break_type
|
||||
#define g_unichar_isspace monoeg_unichar_isspace
|
||||
#define g_unichar_to_utf16 monoeg_unichar_to_utf16
|
||||
#define g_utf8_find_prev_char monoeg_utf8_find_prev_char
|
||||
#define g_utf8_get_char_validated monoeg_utf8_get_char_validated
|
||||
#define g_utf8_prev_char monoeg_utf8_prev_char
|
||||
#define g_utf8_to_ucs4 monoeg_utf8_to_ucs4
|
||||
|
||||
|
||||
@@ -310,8 +286,3 @@
|
||||
#define g_log_set_default_handler monoeg_log_set_default_handler
|
||||
#define g_set_print_handler monoeg_set_print_handler
|
||||
#define g_set_printerr_handler monoeg_set_printerr_handler
|
||||
|
||||
#define g_size_to_int monoeg_size_to_int
|
||||
#define g_ascii_charcmp monoeg_ascii_charcmp
|
||||
#define g_ascii_charcasecmp monoeg_ascii_charcasecmp
|
||||
#define g_warning_d monoeg_warning_d
|
||||
@@ -25,7 +25,7 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
|
||||
GByteArray *
|
||||
g_byte_array_new (void)
|
||||
g_byte_array_new ()
|
||||
{
|
||||
return (GByteArray *) g_array_new (FALSE, TRUE, 1);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* gdate-unix.c: Date and time utility functions.
|
||||
*
|
||||
* Author:
|
||||
* Gonzalo Paniagua Javier ([email protected]
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
void
|
||||
g_get_current_time (GTimeVal *result)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
g_return_if_fail (result != NULL);
|
||||
gettimeofday (&tv, NULL);
|
||||
result->tv_sec = tv.tv_sec;
|
||||
result->tv_usec = tv.tv_usec;
|
||||
}
|
||||
|
||||
void
|
||||
g_usleep (gulong microseconds)
|
||||
{
|
||||
struct timespec req, rem;
|
||||
|
||||
req.tv_sec = microseconds / 1000000;
|
||||
req.tv_nsec = (microseconds % 1000000) * 1000;
|
||||
|
||||
while (nanosleep (&req, &rem) == -1 && errno == EINTR)
|
||||
req = rem;
|
||||
}
|
||||
@@ -25,7 +25,6 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
|
||||
@@ -25,12 +25,10 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include "../utils/mono-errno.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
@@ -44,20 +42,20 @@ struct _GDir {
|
||||
};
|
||||
|
||||
GDir *
|
||||
g_dir_open (const gchar *path, guint flags, GError **gerror)
|
||||
g_dir_open (const gchar *path, guint flags, GError **error)
|
||||
{
|
||||
GDir *dir;
|
||||
|
||||
g_return_val_if_fail (path != NULL, NULL);
|
||||
g_return_val_if_fail (gerror == NULL || *gerror == NULL, NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
(void) flags; /* this is not used */
|
||||
dir = g_new (GDir, 1);
|
||||
dir->dir = opendir (path);
|
||||
if (dir->dir == NULL) {
|
||||
if (gerror) {
|
||||
if (error) {
|
||||
gint err = errno;
|
||||
*gerror = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err));
|
||||
*error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err));
|
||||
}
|
||||
g_free (dir);
|
||||
return NULL;
|
||||
@@ -114,7 +112,7 @@ g_mkdir_with_parents (const gchar *pathname, int mode)
|
||||
int rv;
|
||||
|
||||
if (!pathname || *pathname == '\0') {
|
||||
mono_set_errno (EINVAL);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -43,7 +42,7 @@ struct _GDir {
|
||||
};
|
||||
|
||||
GDir *
|
||||
g_dir_open (const gchar *path, guint flags, GError **gerror)
|
||||
g_dir_open (const gchar *path, guint flags, GError **error)
|
||||
{
|
||||
GDir *dir;
|
||||
gunichar2* path_utf16;
|
||||
@@ -51,19 +50,19 @@ g_dir_open (const gchar *path, guint flags, GError **gerror)
|
||||
WIN32_FIND_DATAW find_data;
|
||||
|
||||
g_return_val_if_fail (path != NULL, NULL);
|
||||
g_return_val_if_fail (gerror == NULL || *gerror == NULL, NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
dir = g_new0 (GDir, 1);
|
||||
path_utf16 = u8to16 (path);
|
||||
path_utf16_search = g_malloc ((wcslen(path_utf16) + 3)*sizeof(gunichar2));
|
||||
path_utf16_search = g_malloc ((wcslen((wchar_t *) path_utf16) + 3)*sizeof(gunichar2));
|
||||
wcscpy (path_utf16_search, path_utf16);
|
||||
wcscat (path_utf16_search, L"\\*");
|
||||
|
||||
dir->handle = FindFirstFileW (path_utf16_search, &find_data);
|
||||
if (dir->handle == INVALID_HANDLE_VALUE) {
|
||||
if (gerror) {
|
||||
if (error) {
|
||||
gint err = errno;
|
||||
*gerror = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err));
|
||||
*error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err));
|
||||
}
|
||||
g_free (path_utf16_search);
|
||||
g_free (path_utf16);
|
||||
@@ -73,11 +72,11 @@ g_dir_open (const gchar *path, guint flags, GError **gerror)
|
||||
g_free (path_utf16_search);
|
||||
g_free (path_utf16);
|
||||
|
||||
while ((wcscmp (find_data.cFileName, L".") == 0) || (wcscmp (find_data.cFileName, L"..") == 0)) {
|
||||
while ((wcscmp ((wchar_t *) find_data.cFileName, L".") == 0) || (wcscmp ((wchar_t *) find_data.cFileName, L"..") == 0)) {
|
||||
if (!FindNextFileW (dir->handle, &find_data)) {
|
||||
if (gerror) {
|
||||
if (error) {
|
||||
gint err = errno;
|
||||
*gerror = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err));
|
||||
*error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err));
|
||||
}
|
||||
g_free (dir);
|
||||
return NULL;
|
||||
@@ -112,7 +111,7 @@ g_dir_read_name (GDir *dir)
|
||||
dir->next = NULL;
|
||||
return dir->current;
|
||||
}
|
||||
} while ((wcscmp (find_data.cFileName, L".") == 0) || (wcscmp (find_data.cFileName, L"..") == 0));
|
||||
} while ((wcscmp ((wchar_t *) find_data.cFileName, L".") == 0) || (wcscmp ((wchar_t *) find_data.cFileName, L"..") == 0));
|
||||
|
||||
dir->next = u16to8 (find_data.cFileName);
|
||||
return dir->current;
|
||||
@@ -62,22 +62,21 @@ g_error_vnew (gpointer domain, gint code, const char *format, va_list ap)
|
||||
}
|
||||
|
||||
void
|
||||
g_clear_error (GError **gerror)
|
||||
g_clear_error (GError **error)
|
||||
{
|
||||
if (gerror && *gerror) {
|
||||
g_error_free (*gerror);
|
||||
*gerror = NULL;
|
||||
if (error && *error) {
|
||||
g_error_free (*error);
|
||||
*error = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
g_error_free (GError *gerror)
|
||||
g_error_free (GError *error)
|
||||
{
|
||||
if (!gerror)
|
||||
return;
|
||||
g_return_if_fail (error != NULL);
|
||||
|
||||
g_free (gerror->message);
|
||||
g_free (gerror);
|
||||
g_free (error->message);
|
||||
g_free (error);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -50,7 +50,7 @@ int mkstemp (char *tmp_template);
|
||||
#define OPEN_FLAGS (O_RDONLY | O_LARGEFILE)
|
||||
#endif
|
||||
gboolean
|
||||
g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **gerror)
|
||||
g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **error)
|
||||
{
|
||||
gchar *str;
|
||||
int fd;
|
||||
@@ -60,7 +60,7 @@ g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GEr
|
||||
|
||||
g_return_val_if_fail (filename != NULL, FALSE);
|
||||
g_return_val_if_fail (contents != NULL, FALSE);
|
||||
g_return_val_if_fail (gerror == NULL || *gerror == NULL, FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
*contents = NULL;
|
||||
if (length)
|
||||
@@ -68,17 +68,17 @@ g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GEr
|
||||
|
||||
fd = open (filename, OPEN_FLAGS);
|
||||
if (fd == -1) {
|
||||
if (gerror != NULL) {
|
||||
if (error != NULL) {
|
||||
int err = errno;
|
||||
*gerror = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error opening file");
|
||||
*error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error opening file");
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (fstat (fd, &st) != 0) {
|
||||
if (gerror != NULL) {
|
||||
if (error != NULL) {
|
||||
int err = errno;
|
||||
*gerror = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error in fstat()");
|
||||
*error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error in fstat()");
|
||||
}
|
||||
close (fd);
|
||||
return FALSE;
|
||||
@@ -94,61 +94,50 @@ g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GEr
|
||||
} while ((nread > 0 && offset < st.st_size) || (nread == -1 && errno == EINTR));
|
||||
|
||||
close (fd);
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
// Windows defaults to O_TEXT for opened files, meaning that st_size can be larger than
|
||||
// what's actually read into str due to new line conversion.
|
||||
g_assert (offset <= st.st_size);
|
||||
str [offset] = '\0';
|
||||
if (length)
|
||||
*length = offset;
|
||||
#else
|
||||
str [st.st_size] = '\0';
|
||||
if (length) {
|
||||
*length = st.st_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
*contents = str;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gint
|
||||
g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **gerror)
|
||||
g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error)
|
||||
{
|
||||
const static gchar *default_tmpl = ".XXXXXX";
|
||||
gchar *t;
|
||||
gint fd;
|
||||
size_t len;
|
||||
|
||||
g_return_val_if_fail (gerror == NULL || *gerror == NULL, -1);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, -1);
|
||||
|
||||
if (tmpl == NULL)
|
||||
tmpl = default_tmpl;
|
||||
|
||||
if (strchr (tmpl, G_DIR_SEPARATOR) != NULL) {
|
||||
if (gerror) {
|
||||
*gerror = g_error_new (G_LOG_DOMAIN, 24, "Template should not have any " G_DIR_SEPARATOR_S);
|
||||
if (error) {
|
||||
*error = g_error_new (G_LOG_DOMAIN, 24, "Template should not have any " G_DIR_SEPARATOR_S);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
len = strlen (tmpl);
|
||||
if (len < 6 || strcmp (tmpl + len - 6, "XXXXXX")) {
|
||||
if (gerror) {
|
||||
*gerror = g_error_new (G_LOG_DOMAIN, 24, "Template should end with XXXXXX");
|
||||
if (error) {
|
||||
*error = g_error_new (G_LOG_DOMAIN, 24, "Template should end with XXXXXX");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
t = g_build_filename (g_get_tmp_dir (), tmpl, (const char*)NULL);
|
||||
t = g_build_filename (g_get_tmp_dir (), tmpl, NULL);
|
||||
|
||||
fd = mkstemp (t);
|
||||
|
||||
if (fd == -1) {
|
||||
if (gerror) {
|
||||
if (error) {
|
||||
int err = errno;
|
||||
*gerror = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error in mkstemp()");
|
||||
*error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error in mkstemp()");
|
||||
}
|
||||
g_free (t);
|
||||
return -1;
|
||||
@@ -179,7 +168,7 @@ g_get_current_dir (void)
|
||||
} while (fail);
|
||||
|
||||
/* On amd64 sometimes the bottom 32-bits of r == the bottom 32-bits of buffer
|
||||
* but the top 32-bits of r have overflown to 0xffffffff (seriously, getcwd
|
||||
* but the top 32-bits of r have overflown to 0xffffffff (seriously wtf getcwd
|
||||
* so we return the buffer here since it has a pointer to the valid string
|
||||
*/
|
||||
return buffer;
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* File utility functions.
|
||||
*
|
||||
* Author:
|
||||
* Gonzalo Paniagua Javier ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <config.h>
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
g_file_test (const gchar *filename, GFileTest test)
|
||||
{
|
||||
struct stat st;
|
||||
gboolean have_stat;
|
||||
|
||||
if (filename == NULL || test == 0)
|
||||
return FALSE;
|
||||
|
||||
have_stat = FALSE;
|
||||
|
||||
if ((test & G_FILE_TEST_EXISTS) != 0) {
|
||||
if (access (filename, F_OK) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ((test & G_FILE_TEST_IS_EXECUTABLE) != 0) {
|
||||
if (access (filename, X_OK) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
if ((test & G_FILE_TEST_IS_SYMLINK) != 0) {
|
||||
have_stat = (lstat (filename, &st) == 0);
|
||||
if (have_stat && S_ISLNK (st.st_mode))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ((test & G_FILE_TEST_IS_REGULAR) != 0) {
|
||||
if (!have_stat)
|
||||
have_stat = (stat (filename, &st) == 0);
|
||||
if (have_stat && S_ISREG (st.st_mode))
|
||||
return TRUE;
|
||||
}
|
||||
if ((test & G_FILE_TEST_IS_DIR) != 0) {
|
||||
if (!have_stat)
|
||||
have_stat = (stat (filename, &st) == 0);
|
||||
if (have_stat && S_ISDIR (st.st_mode))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_mkdtemp (char *tmp_template)
|
||||
{
|
||||
#ifdef HAVE_MKDTEMP
|
||||
char *template_copy = g_strdup (tmp_template);
|
||||
|
||||
return mkdtemp (template_copy);
|
||||
#else
|
||||
g_error("Function not supported");
|
||||
#endif
|
||||
}
|
||||
@@ -88,6 +88,10 @@ g_mkdtemp (char *tmp_template)
|
||||
g_free (utf16_template);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4701)
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
g_file_test (const gchar *filename, GFileTest test)
|
||||
@@ -110,8 +114,11 @@ g_file_test (const gchar *filename, GFileTest test)
|
||||
}
|
||||
|
||||
if ((test & G_FILE_TEST_IS_EXECUTABLE) != 0) {
|
||||
/* Testing executable permission on Windows is hard, and this is unused, treat as EXISTS for now. */
|
||||
return TRUE;
|
||||
size_t len = strlen (filename);
|
||||
if (len > 4 && strcmp (filename + len-3, "exe"))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((test & G_FILE_TEST_IS_REGULAR) != 0) {
|
||||
@@ -36,7 +36,7 @@
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
static gpointer error_quark = (gpointer)"FileError";
|
||||
static gpointer error_quark = "FileError";
|
||||
|
||||
gpointer
|
||||
g_file_error_quark (void)
|
||||
@@ -123,7 +123,7 @@ g_file_set_contents (const gchar *filename, const gchar *contents, gssize length
|
||||
else
|
||||
name++;
|
||||
|
||||
path = g_strdup_printf (TMP_FILE_FORMAT, (int)(name - filename), filename, name);
|
||||
path = g_strdup_printf (TMP_FILE_FORMAT, name - filename, filename, name);
|
||||
if (!(fp = fopen (path, "wb"))) {
|
||||
g_set_error (err, G_FILE_ERROR, g_file_error_from_errno (errno), "%s", g_strerror (errno));
|
||||
g_free (path);
|
||||
@@ -25,11 +25,9 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <glib.h>
|
||||
#include <eglib-remap.h> // Remove the cast macros and restore the rename macros.
|
||||
|
||||
typedef struct _Slot Slot;
|
||||
|
||||
@@ -305,14 +303,6 @@ g_hash_table_size (GHashTable *hash)
|
||||
return hash->in_use;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_hash_table_contains (GHashTable *hash, gconstpointer key)
|
||||
{
|
||||
g_return_val_if_fail (key != NULL, FALSE);
|
||||
|
||||
return g_hash_table_lookup_extended (hash, key, NULL, NULL);
|
||||
}
|
||||
|
||||
gpointer
|
||||
g_hash_table_lookup (GHashTable *hash, gconstpointer key)
|
||||
{
|
||||
@@ -555,9 +545,8 @@ void
|
||||
g_hash_table_destroy (GHashTable *hash)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!hash)
|
||||
return;
|
||||
|
||||
g_return_if_fail (hash != NULL);
|
||||
|
||||
for (i = 0; i < hash->table_size; i++){
|
||||
Slot *s, *next;
|
||||
@@ -666,7 +655,7 @@ g_int_hash (gconstpointer v1)
|
||||
gboolean
|
||||
g_str_equal (gconstpointer v1, gconstpointer v2)
|
||||
{
|
||||
return v1 == v2 || strcmp ((const char*)v1, (const char*)v2) == 0;
|
||||
return strcmp (v1, v2) == 0;
|
||||
}
|
||||
|
||||
guint
|
||||
@@ -22,14 +22,17 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_ICONV_H
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include "../utils/mono-errno.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define FORCE_INLINE(RET_TYPE) __forceinline RET_TYPE
|
||||
@@ -48,7 +51,7 @@ struct _GIConv {
|
||||
Decoder decode;
|
||||
Encoder encode;
|
||||
gunichar c;
|
||||
#ifdef HAVE_LIBICONV
|
||||
#ifdef HAVE_ICONV
|
||||
iconv_t cd;
|
||||
#endif
|
||||
};
|
||||
@@ -109,7 +112,7 @@ static struct {
|
||||
GIConv
|
||||
g_iconv_open (const char *to_charset, const char *from_charset)
|
||||
{
|
||||
#ifdef HAVE_LIBICONV
|
||||
#ifdef HAVE_ICONV
|
||||
iconv_t icd = (iconv_t) -1;
|
||||
#endif
|
||||
Decoder decoder = NULL;
|
||||
@@ -118,7 +121,7 @@ g_iconv_open (const char *to_charset, const char *from_charset)
|
||||
guint i;
|
||||
|
||||
if (!to_charset || !from_charset || !to_charset[0] || !from_charset[0]) {
|
||||
mono_set_errno (EINVAL);
|
||||
errno = EINVAL;
|
||||
|
||||
return (GIConv) -1;
|
||||
}
|
||||
@@ -132,11 +135,11 @@ g_iconv_open (const char *to_charset, const char *from_charset)
|
||||
}
|
||||
|
||||
if (!encoder || !decoder) {
|
||||
#ifdef HAVE_LIBICONV
|
||||
#ifdef HAVE_ICONV
|
||||
if ((icd = iconv_open (to_charset, from_charset)) == (iconv_t) -1)
|
||||
return (GIConv) -1;
|
||||
#else
|
||||
mono_set_errno (EINVAL);
|
||||
errno = EINVAL;
|
||||
|
||||
return (GIConv) -1;
|
||||
#endif
|
||||
@@ -147,7 +150,7 @@ g_iconv_open (const char *to_charset, const char *from_charset)
|
||||
cd->encode = encoder;
|
||||
cd->c = -1;
|
||||
|
||||
#ifdef HAVE_LIBICONV
|
||||
#ifdef HAVE_ICONV
|
||||
cd->cd = icd;
|
||||
#endif
|
||||
|
||||
@@ -157,7 +160,7 @@ g_iconv_open (const char *to_charset, const char *from_charset)
|
||||
int
|
||||
g_iconv_close (GIConv cd)
|
||||
{
|
||||
#ifdef HAVE_LIBICONV
|
||||
#ifdef HAVE_ICONV
|
||||
if (cd->cd != (iconv_t) -1)
|
||||
iconv_close (cd->cd);
|
||||
#endif
|
||||
@@ -176,7 +179,7 @@ g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft,
|
||||
gunichar c;
|
||||
int rc = 0;
|
||||
|
||||
#ifdef HAVE_LIBICONV
|
||||
#ifdef HAVE_ICONV
|
||||
if (cd->cd != (iconv_t) -1) {
|
||||
/* Note: gsize may have a different size than size_t, so we need to
|
||||
remap inbytesleft and outbytesleft to size_t's. */
|
||||
@@ -196,8 +199,7 @@ g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft,
|
||||
} else {
|
||||
outleftptr = NULL;
|
||||
}
|
||||
// AIX needs this for C++ and GNU iconv
|
||||
#if defined(__NetBSD__) || defined(_AIX)
|
||||
#if defined(__NetBSD__)
|
||||
return iconv (cd->cd, (const gchar **)inbytes, inleftptr, outbytes, outleftptr);
|
||||
#else
|
||||
return iconv (cd->cd, inbytes, inleftptr, outbytes, outleftptr);
|
||||
@@ -252,32 +254,24 @@ g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft,
|
||||
* Unicode encoders and decoders
|
||||
*/
|
||||
|
||||
static FORCE_INLINE (uint32_t)
|
||||
read_uint32_endian (unsigned char *inptr, unsigned endian)
|
||||
{
|
||||
if (endian == G_LITTLE_ENDIAN)
|
||||
return (inptr[3] << 24) | (inptr[2] << 16) | (inptr[1] << 8) | inptr[0];
|
||||
return (inptr[0] << 24) | (inptr[1] << 16) | (inptr[2] << 8) | inptr[3];
|
||||
}
|
||||
|
||||
static int
|
||||
decode_utf32_endian (char *inbuf, size_t inleft, gunichar *outchar, unsigned endian)
|
||||
decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar)
|
||||
{
|
||||
unsigned char *inptr = (unsigned char *) inbuf;
|
||||
gunichar c;
|
||||
|
||||
if (inleft < 4) {
|
||||
mono_set_errno (EINVAL);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = read_uint32_endian (inptr, endian);
|
||||
c = (inptr[0] << 24) | (inptr[1] << 16) | (inptr[2] << 8) | inptr[3];
|
||||
|
||||
if (c >= 0xd800 && c < 0xe000) {
|
||||
mono_set_errno (EILSEQ);
|
||||
errno = EILSEQ;
|
||||
return -1;
|
||||
} else if (c >= 0x110000) {
|
||||
mono_set_errno (EILSEQ);
|
||||
errno = EILSEQ;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -286,16 +280,30 @@ decode_utf32_endian (char *inbuf, size_t inleft, gunichar *outchar, unsigned end
|
||||
return 4;
|
||||
}
|
||||
|
||||
static int
|
||||
decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar)
|
||||
{
|
||||
return decode_utf32_endian (inbuf, inleft, outchar, G_BIG_ENDIAN);
|
||||
}
|
||||
|
||||
static int
|
||||
decode_utf32le (char *inbuf, size_t inleft, gunichar *outchar)
|
||||
{
|
||||
return decode_utf32_endian (inbuf, inleft, outchar, G_LITTLE_ENDIAN);
|
||||
unsigned char *inptr = (unsigned char *) inbuf;
|
||||
gunichar c;
|
||||
|
||||
if (inleft < 4) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = (inptr[3] << 24) | (inptr[2] << 16) | (inptr[1] << 8) | inptr[0];
|
||||
|
||||
if (c >= 0xd800 && c < 0xe000) {
|
||||
errno = EILSEQ;
|
||||
return -1;
|
||||
} else if (c >= 0x110000) {
|
||||
errno = EILSEQ;
|
||||
return -1;
|
||||
}
|
||||
|
||||
*outchar = c;
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -304,7 +312,7 @@ encode_utf32be (gunichar c, char *outbuf, size_t outleft)
|
||||
unsigned char *outptr = (unsigned char *) outbuf;
|
||||
|
||||
if (outleft < 4) {
|
||||
mono_set_errno (E2BIG);
|
||||
errno = E2BIG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -322,7 +330,7 @@ encode_utf32le (gunichar c, char *outbuf, size_t outleft)
|
||||
unsigned char *outptr = (unsigned char *) outbuf;
|
||||
|
||||
if (outleft < 4) {
|
||||
mono_set_errno (E2BIG);
|
||||
errno = E2BIG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -334,27 +342,19 @@ encode_utf32le (gunichar c, char *outbuf, size_t outleft)
|
||||
return 4;
|
||||
}
|
||||
|
||||
static FORCE_INLINE (uint16_t)
|
||||
read_uint16_endian (unsigned char *inptr, unsigned endian)
|
||||
{
|
||||
if (endian == G_LITTLE_ENDIAN)
|
||||
return (inptr[1] << 8) | inptr[0];
|
||||
return (inptr[0] << 8) | inptr[1];
|
||||
}
|
||||
|
||||
static FORCE_INLINE (int)
|
||||
decode_utf16_endian (char *inbuf, size_t inleft, gunichar *outchar, unsigned endian)
|
||||
static int
|
||||
decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar)
|
||||
{
|
||||
unsigned char *inptr = (unsigned char *) inbuf;
|
||||
gunichar2 c;
|
||||
gunichar u;
|
||||
|
||||
if (inleft < 2) {
|
||||
mono_set_errno (E2BIG);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
u = read_uint16_endian (inptr, endian);
|
||||
u = (inptr[0] << 8) | inptr[1];
|
||||
|
||||
if (u < 0xd800) {
|
||||
/* 0x0000 -> 0xd7ff */
|
||||
@@ -363,14 +363,14 @@ decode_utf16_endian (char *inbuf, size_t inleft, gunichar *outchar, unsigned end
|
||||
} else if (u < 0xdc00) {
|
||||
/* 0xd800 -> 0xdbff */
|
||||
if (inleft < 4) {
|
||||
mono_set_errno (EINVAL);
|
||||
errno = EINVAL;
|
||||
return -2;
|
||||
}
|
||||
|
||||
c = read_uint16_endian (inptr + 2, endian);
|
||||
c = (inptr[2] << 8) | inptr[3];
|
||||
|
||||
if (c < 0xdc00 || c > 0xdfff) {
|
||||
mono_set_errno (EILSEQ);
|
||||
errno = EILSEQ;
|
||||
return -2;
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ decode_utf16_endian (char *inbuf, size_t inleft, gunichar *outchar, unsigned end
|
||||
return 4;
|
||||
} else if (u < 0xe000) {
|
||||
/* 0xdc00 -> 0xdfff */
|
||||
mono_set_errno (EILSEQ);
|
||||
errno = EILSEQ;
|
||||
return -1;
|
||||
} else {
|
||||
/* 0xe000 -> 0xffff */
|
||||
@@ -390,31 +390,54 @@ decode_utf16_endian (char *inbuf, size_t inleft, gunichar *outchar, unsigned end
|
||||
}
|
||||
|
||||
static int
|
||||
decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar)
|
||||
decode_utf16le (char *inbuf, size_t inleft, gunichar *outchar)
|
||||
{
|
||||
return decode_utf16_endian (inbuf, inleft, outchar, G_BIG_ENDIAN);
|
||||
unsigned char *inptr = (unsigned char *) inbuf;
|
||||
gunichar2 c;
|
||||
gunichar u;
|
||||
|
||||
if (inleft < 2) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
u = (inptr[1] << 8) | inptr[0];
|
||||
|
||||
if (u < 0xd800) {
|
||||
/* 0x0000 -> 0xd7ff */
|
||||
*outchar = u;
|
||||
return 2;
|
||||
} else if (u < 0xdc00) {
|
||||
/* 0xd800 -> 0xdbff */
|
||||
if (inleft < 4) {
|
||||
errno = EINVAL;
|
||||
return -2;
|
||||
}
|
||||
|
||||
c = (inptr[3] << 8) | inptr[2];
|
||||
|
||||
if (c < 0xdc00 || c > 0xdfff) {
|
||||
errno = EILSEQ;
|
||||
return -2;
|
||||
}
|
||||
|
||||
u = ((u - 0xd800) << 10) + (c - 0xdc00) + 0x0010000UL;
|
||||
*outchar = u;
|
||||
|
||||
return 4;
|
||||
} else if (u < 0xe000) {
|
||||
/* 0xdc00 -> 0xdfff */
|
||||
errno = EILSEQ;
|
||||
return -1;
|
||||
} else {
|
||||
/* 0xe000 -> 0xffff */
|
||||
*outchar = u;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
decode_utf16le (char *inbuf, size_t inleft, gunichar *outchar)
|
||||
{
|
||||
return decode_utf16_endian (inbuf, inleft, outchar, G_LITTLE_ENDIAN);
|
||||
}
|
||||
|
||||
static FORCE_INLINE (void)
|
||||
write_uint16_endian (unsigned char *outptr, uint16_t c, unsigned endian)
|
||||
{
|
||||
if (endian == G_LITTLE_ENDIAN) {
|
||||
outptr[0] = c & 0xff;
|
||||
outptr[1] = (c >> 8) & 0xff;
|
||||
return;
|
||||
}
|
||||
outptr[0] = (c >> 8) & 0xff;
|
||||
outptr[1] = c & 0xff;
|
||||
}
|
||||
|
||||
static FORCE_INLINE (int)
|
||||
encode_utf16_endian (gunichar c, char *outbuf, size_t outleft, unsigned endian)
|
||||
encode_utf16be (gunichar c, char *outbuf, size_t outleft)
|
||||
{
|
||||
unsigned char *outptr = (unsigned char *) outbuf;
|
||||
gunichar2 ch;
|
||||
@@ -422,39 +445,69 @@ encode_utf16_endian (gunichar c, char *outbuf, size_t outleft, unsigned endian)
|
||||
|
||||
if (c < 0x10000) {
|
||||
if (outleft < 2) {
|
||||
mono_set_errno (E2BIG);
|
||||
errno = E2BIG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
write_uint16_endian (outptr, c, endian);
|
||||
outptr[0] = (c >> 8) & 0xff;
|
||||
outptr[1] = c & 0xff;
|
||||
|
||||
return 2;
|
||||
} else {
|
||||
if (outleft < 4) {
|
||||
mono_set_errno (E2BIG);
|
||||
errno = E2BIG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c2 = c - 0x10000;
|
||||
|
||||
ch = (gunichar2) ((c2 >> 10) + 0xd800);
|
||||
write_uint16_endian (outptr, ch, endian);
|
||||
|
||||
outptr[0] = (ch >> 8) & 0xff;
|
||||
outptr[1] = ch & 0xff;
|
||||
|
||||
ch = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
|
||||
write_uint16_endian (outptr + 2, ch, endian);
|
||||
outptr[2] = (ch >> 8) & 0xff;
|
||||
outptr[3] = ch & 0xff;
|
||||
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
encode_utf16be (gunichar c, char *outbuf, size_t outleft)
|
||||
{
|
||||
return encode_utf16_endian (c, outbuf, outleft, G_BIG_ENDIAN);
|
||||
}
|
||||
|
||||
static int
|
||||
encode_utf16le (gunichar c, char *outbuf, size_t outleft)
|
||||
{
|
||||
return encode_utf16_endian (c, outbuf, outleft, G_LITTLE_ENDIAN);
|
||||
unsigned char *outptr = (unsigned char *) outbuf;
|
||||
gunichar2 ch;
|
||||
gunichar c2;
|
||||
|
||||
if (c < 0x10000) {
|
||||
if (outleft < 2) {
|
||||
errno = E2BIG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
outptr[0] = c & 0xff;
|
||||
outptr[1] = (c >> 8) & 0xff;
|
||||
|
||||
return 2;
|
||||
} else {
|
||||
if (outleft < 4) {
|
||||
errno = E2BIG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c2 = c - 0x10000;
|
||||
|
||||
ch = (gunichar2) ((c2 >> 10) + 0xd800);
|
||||
outptr[0] = ch & 0xff;
|
||||
outptr[1] = (ch >> 8) & 0xff;
|
||||
|
||||
ch = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
|
||||
outptr[2] = ch & 0xff;
|
||||
outptr[3] = (ch >> 8) & 0xff;
|
||||
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
static FORCE_INLINE (int)
|
||||
@@ -471,7 +524,7 @@ decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar)
|
||||
*outchar = u;
|
||||
return 1;
|
||||
} else if (u < 0xc2) {
|
||||
mono_set_errno (EILSEQ);
|
||||
errno = EILSEQ;
|
||||
return -1;
|
||||
} else if (u < 0xe0) {
|
||||
u &= 0x1f;
|
||||
@@ -489,12 +542,12 @@ decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar)
|
||||
u &= 0x01;
|
||||
n = 6;
|
||||
} else {
|
||||
mono_set_errno (EILSEQ);
|
||||
errno = EILSEQ;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (n > inleft) {
|
||||
mono_set_errno (EINVAL);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -543,7 +596,7 @@ encode_utf8 (gunichar c, char *outbuf, size_t outleft)
|
||||
}
|
||||
|
||||
if (outleft < n) {
|
||||
mono_set_errno (E2BIG);
|
||||
errno = E2BIG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -579,12 +632,12 @@ static int
|
||||
encode_latin1 (gunichar c, char *outbuf, size_t outleft)
|
||||
{
|
||||
if (outleft < 1) {
|
||||
mono_set_errno (E2BIG);
|
||||
errno = E2BIG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (c > 0xff) {
|
||||
mono_set_errno (EILSEQ);
|
||||
errno = EILSEQ;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -598,7 +651,7 @@ encode_latin1 (gunichar c, char *outbuf, size_t outleft)
|
||||
* Simple conversion API
|
||||
*/
|
||||
|
||||
static gpointer error_quark = (gpointer)"ConvertError";
|
||||
static gpointer error_quark = "ConvertError";
|
||||
|
||||
gpointer
|
||||
g_convert_error_quark (void)
|
||||
@@ -831,7 +884,7 @@ g_utf8_to_ucs4_fast (const gchar *str, glong len, glong *items_written)
|
||||
}
|
||||
|
||||
static gunichar2 *
|
||||
eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong *items_written, gboolean include_nuls, gboolean replace_invalid_codepoints, GError **err)
|
||||
eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong *items_written, gboolean include_nuls, GError **err)
|
||||
{
|
||||
gunichar2 *outbuf, *outptr;
|
||||
size_t outlen = 0;
|
||||
@@ -862,12 +915,8 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
|
||||
break;
|
||||
|
||||
if ((u = g_unichar_to_utf16 (c, NULL)) < 0) {
|
||||
if (replace_invalid_codepoints) {
|
||||
u = 2;
|
||||
} else {
|
||||
mono_set_errno (EILSEQ);
|
||||
goto error;
|
||||
}
|
||||
errno = EILSEQ;
|
||||
goto error;
|
||||
}
|
||||
|
||||
outlen += u;
|
||||
@@ -892,14 +941,7 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
|
||||
if (c == 0 && !include_nuls)
|
||||
break;
|
||||
|
||||
u = g_unichar_to_utf16 (c, outptr);
|
||||
if ((u < 0) && replace_invalid_codepoints) {
|
||||
outptr[0] = 0xFFFD;
|
||||
outptr[1] = 0xFFFD;
|
||||
u = 2;
|
||||
}
|
||||
|
||||
outptr += u;
|
||||
outptr += g_unichar_to_utf16 (c, outptr);
|
||||
inleft -= n;
|
||||
inptr += n;
|
||||
}
|
||||
@@ -931,19 +973,13 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
|
||||
gunichar2 *
|
||||
g_utf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err)
|
||||
{
|
||||
return eg_utf8_to_utf16_general (str, len, items_read, items_written, FALSE, FALSE, err);
|
||||
return eg_utf8_to_utf16_general (str, len, items_read, items_written, FALSE, err);
|
||||
}
|
||||
|
||||
gunichar2 *
|
||||
eg_utf8_to_utf16_with_nuls (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err)
|
||||
{
|
||||
return eg_utf8_to_utf16_general (str, len, items_read, items_written, TRUE, FALSE, err);
|
||||
}
|
||||
|
||||
gunichar2 *
|
||||
eg_wtf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err)
|
||||
{
|
||||
return eg_utf8_to_utf16_general (str, len, items_read, items_written, TRUE, TRUE, err);
|
||||
return eg_utf8_to_utf16_general (str, len, items_read, items_written, TRUE, err);
|
||||
}
|
||||
|
||||
gunichar *
|
||||
+1079
File diff suppressed because it is too large.
Load diff
@@ -26,17 +26,16 @@
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
|
||||
GList*
|
||||
g_list_alloc (void)
|
||||
g_list_alloc ()
|
||||
{
|
||||
return g_new0 (GList, 1);
|
||||
}
|
||||
|
||||
static GList*
|
||||
static inline GList*
|
||||
new_node (GList *prev, gpointer data, GList *next)
|
||||
{
|
||||
GList *node = g_list_alloc ();
|
||||
@@ -50,7 +49,7 @@ new_node (GList *prev, gpointer data, GList *next)
|
||||
return node;
|
||||
}
|
||||
|
||||
static GList*
|
||||
static inline GList*
|
||||
disconnect_node (GList *node)
|
||||
{
|
||||
if (node->next)
|
||||
@@ -39,12 +39,11 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <glib.h>
|
||||
|
||||
#define set_error(msg, ...) do { if (gerror != NULL) *gerror = g_error_new (GINT_TO_POINTER (1), 1, msg, __VA_ARGS__); } while (0);
|
||||
#define set_error(msg, ...) do { if (error != NULL) *error = g_error_new (GINT_TO_POINTER (1), 1, msg, __VA_ARGS__); } while (0);
|
||||
|
||||
typedef enum {
|
||||
START,
|
||||
@@ -54,13 +53,13 @@ typedef enum {
|
||||
CLOSING_ELEMENT,
|
||||
COMMENT,
|
||||
SKIP_XML_DECLARATION
|
||||
} MonoGMarkupParseState;
|
||||
} ParseState;
|
||||
|
||||
struct _GMarkupParseContext {
|
||||
GMarkupParser parser;
|
||||
gpointer user_data;
|
||||
GDestroyNotify user_data_dnotify;
|
||||
MonoGMarkupParseState state;
|
||||
ParseState state;
|
||||
|
||||
/* Stores the name of the current element, so we can issue the end_element */
|
||||
GSList *level;
|
||||
@@ -128,24 +127,6 @@ my_isalpha (char c)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
my_isnamestartchar (char c)
|
||||
{
|
||||
/* NameStartChar from https://www.w3.org/TR/xml/#sec-common-syn excluding non-ASCII and ':' */
|
||||
if (my_isalpha (c) || c == '_')
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
my_isnamechar (char c)
|
||||
{
|
||||
/* NameChar from https://www.w3.org/TR/xml/#sec-common-syn excluding non-ASCII and ':' */
|
||||
if (my_isalnum (c) || c == '_' || c == '-' || c == '.')
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static const char *
|
||||
skip_space (const char *p, const char *end)
|
||||
{
|
||||
@@ -155,7 +136,7 @@ skip_space (const char *p, const char *end)
|
||||
}
|
||||
|
||||
static const char *
|
||||
parse_value (const char *p, const char *end, char **value, GError **gerror)
|
||||
parse_value (const char *p, const char *end, char **value, GError **error)
|
||||
{
|
||||
const char *start;
|
||||
int l;
|
||||
@@ -185,9 +166,8 @@ parse_name (const char *p, const char *end, char **value)
|
||||
const char *start = p;
|
||||
int l;
|
||||
|
||||
if (p < end && my_isnamestartchar (*p))
|
||||
for (; p < end && my_isnamechar (*p); p++)
|
||||
;
|
||||
for (; p < end && my_isalnum (*p); p++)
|
||||
;
|
||||
if (p == end)
|
||||
return end;
|
||||
|
||||
@@ -201,7 +181,7 @@ parse_name (const char *p, const char *end, char **value)
|
||||
}
|
||||
|
||||
static const char *
|
||||
parse_attributes (const char *p, const char *end, char ***names, char ***values, GError **gerror, int *full_stop, int state)
|
||||
parse_attributes (const char *p, const char *end, char ***names, char ***values, GError **error, int *full_stop, int state)
|
||||
{
|
||||
int nnames = 0;
|
||||
|
||||
@@ -246,7 +226,7 @@ parse_attributes (const char *p, const char *end, char ***names, char ***values,
|
||||
return end;
|
||||
}
|
||||
|
||||
p = parse_value (p, end, &value, gerror);
|
||||
p = parse_value (p, end, &value, error);
|
||||
if (p == end){
|
||||
g_free (name);
|
||||
return p;
|
||||
@@ -281,7 +261,7 @@ destroy_parse_state (GMarkupParseContext *context)
|
||||
gboolean
|
||||
g_markup_parse_context_parse (GMarkupParseContext *context,
|
||||
const gchar *text, gssize text_len,
|
||||
GError **gerror)
|
||||
GError **error)
|
||||
{
|
||||
const char *p, *end;
|
||||
|
||||
@@ -329,12 +309,12 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
|
||||
break;
|
||||
}
|
||||
|
||||
if (!my_isnamestartchar (*p)){
|
||||
if (!my_isalpha (*p)){
|
||||
set_error ("%s", "Expected an element name");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (++p; p < end && my_isnamechar (*p); p++)
|
||||
for (++p; p < end && (my_isalnum (*p) || (*p == '.')); p++)
|
||||
;
|
||||
if (p == end){
|
||||
set_error ("%s", "Expected an element");
|
||||
@@ -348,14 +328,14 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
|
||||
set_error ("%s", "Unfinished element");
|
||||
goto fail;
|
||||
}
|
||||
p = parse_attributes (p, end, &names, &values, gerror, &full_stop, context->state);
|
||||
p = parse_attributes (p, end, &names, &values, error, &full_stop, context->state);
|
||||
if (p == end){
|
||||
if (names != NULL) {
|
||||
g_strfreev (names);
|
||||
g_strfreev (values);
|
||||
}
|
||||
/* Only set the error if parse_attributes did not */
|
||||
if (gerror != NULL && *gerror == NULL)
|
||||
if (error != NULL && *error == NULL)
|
||||
set_error ("%s", "Unfinished sequence");
|
||||
goto fail;
|
||||
}
|
||||
@@ -371,22 +351,22 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
|
||||
context->parser.start_element (context, ename,
|
||||
(const gchar **) names,
|
||||
(const gchar **) values,
|
||||
context->user_data, gerror);
|
||||
context->user_data, error);
|
||||
|
||||
if (names != NULL){
|
||||
g_strfreev (names);
|
||||
g_strfreev (values);
|
||||
}
|
||||
|
||||
if (gerror != NULL && *gerror != NULL){
|
||||
if (error != NULL && *error != NULL){
|
||||
g_free (ename);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (full_stop){
|
||||
if (context->parser.end_element != NULL && context->state == START_ELEMENT){
|
||||
context->parser.end_element (context, ename, context->user_data, gerror);
|
||||
if (gerror != NULL && *gerror != NULL){
|
||||
context->parser.end_element (context, ename, context->user_data, error);
|
||||
if (error != NULL && *error != NULL){
|
||||
g_free (ename);
|
||||
goto fail;
|
||||
}
|
||||
@@ -426,8 +406,8 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
|
||||
case FLUSH_TEXT:
|
||||
if (context->parser.text != NULL && context->text != NULL){
|
||||
context->parser.text (context, context->text->str, context->text->len,
|
||||
context->user_data, gerror);
|
||||
if (gerror != NULL && *gerror != NULL)
|
||||
context->user_data, error);
|
||||
if (error != NULL && *error != NULL)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -448,10 +428,10 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
text = (char*)current->data;
|
||||
text = current->data;
|
||||
if (context->parser.end_element != NULL){
|
||||
context->parser.end_element (context, text, context->user_data, gerror);
|
||||
if (gerror != NULL && *gerror != NULL){
|
||||
context->parser.end_element (context, text, context->user_data, error);
|
||||
if (error != NULL && *error != NULL){
|
||||
g_free (text);
|
||||
goto fail;
|
||||
}
|
||||
@@ -473,15 +453,15 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
|
||||
|
||||
return TRUE;
|
||||
fail:
|
||||
if (context->parser.error && gerror != NULL && *gerror)
|
||||
context->parser.error (context, *gerror, context->user_data);
|
||||
if (context->parser.error && error != NULL && *error)
|
||||
context->parser.error (context, *error, context->user_data);
|
||||
|
||||
destroy_parse_state (context);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_markup_parse_context_end_parse (GMarkupParseContext *context, GError **gerror)
|
||||
g_markup_parse_context_end_parse (GMarkupParseContext *context, GError **error)
|
||||
{
|
||||
g_return_val_if_fail (context != NULL, FALSE);
|
||||
|
||||
@@ -29,11 +29,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include <eglib-remap.h> // Remove the cast macros and restore the rename macros.
|
||||
#undef malloc
|
||||
#undef realloc
|
||||
#undef free
|
||||
#undef calloc
|
||||
|
||||
#if defined (ENABLE_OVERRIDABLE_ALLOCATORS)
|
||||
|
||||
@@ -48,24 +43,12 @@ g_mem_set_vtable (GMemVTable* vtable)
|
||||
sGMemVTable.free = vtable->free ? vtable->free : free;
|
||||
}
|
||||
|
||||
void
|
||||
g_mem_get_vtable (GMemVTable* vtable)
|
||||
{
|
||||
*vtable = sGMemVTable;
|
||||
}
|
||||
|
||||
#define G_FREE_INTERNAL sGMemVTable.free
|
||||
#define G_REALLOC_INTERNAL sGMemVTable.realloc
|
||||
#define G_CALLOC_INTERNAL sGMemVTable.calloc
|
||||
#define G_MALLOC_INTERNAL sGMemVTable.malloc
|
||||
#else
|
||||
|
||||
void
|
||||
g_mem_get_vtable (GMemVTable* vtable)
|
||||
{
|
||||
memset (vtable, 0, sizeof (*vtable));
|
||||
}
|
||||
|
||||
void
|
||||
g_mem_set_vtable (GMemVTable* vtable)
|
||||
{
|
||||
@@ -128,7 +111,7 @@ gpointer g_calloc (gsize n, gsize x)
|
||||
gpointer ptr;
|
||||
if (!x || !n)
|
||||
return 0;
|
||||
ptr = G_CALLOC_INTERNAL (n, x);
|
||||
ptr = G_CALLOC_INTERNAL (n, x);
|
||||
if (ptr)
|
||||
return ptr;
|
||||
g_error ("Could not allocate %i (%i * %i) bytes", x*n, n, x);
|
||||
@@ -169,7 +169,7 @@ g_get_home_dir (void)
|
||||
return home_dir;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
const char *
|
||||
g_get_user_name (void)
|
||||
{
|
||||
get_pw_data ();
|
||||
File renamed without changes.
@@ -53,8 +53,7 @@ g_getenv(const gchar *variable)
|
||||
gint32 buffer_size = 1024;
|
||||
gint32 retval;
|
||||
var = u8to16(variable);
|
||||
// FIXME This should loop in case another thread is growing the data.
|
||||
buffer = g_new (gunichar2, buffer_size);
|
||||
buffer = g_malloc(buffer_size*sizeof(gunichar2));
|
||||
retval = GetEnvironmentVariableW (var, buffer, buffer_size);
|
||||
if (retval != 0) {
|
||||
if (retval > buffer_size) {
|
||||
@@ -134,12 +133,7 @@ g_get_known_folder_path (void)
|
||||
{
|
||||
gchar *folder_path = NULL;
|
||||
PWSTR profile_path = NULL;
|
||||
#ifdef __cplusplus
|
||||
REFGUID folderid = FOLDERID_Profile;
|
||||
#else
|
||||
REFGUID folderid = &FOLDERID_Profile;
|
||||
#endif
|
||||
HRESULT hr = SHGetKnownFolderPath (folderid, KF_FLAG_DEFAULT, NULL, &profile_path);
|
||||
HRESULT hr = SHGetKnownFolderPath (&FOLDERID_Profile, KF_FLAG_DEFAULT, NULL, &profile_path);
|
||||
if (SUCCEEDED(hr)) {
|
||||
folder_path = u16to8 (profile_path);
|
||||
CoTaskMemFree (profile_path);
|
||||
@@ -150,7 +144,7 @@ g_get_known_folder_path (void)
|
||||
|
||||
#else
|
||||
|
||||
static gchar *
|
||||
static inline gchar *
|
||||
g_get_known_folder_path (void)
|
||||
{
|
||||
return NULL;
|
||||
@@ -176,14 +170,14 @@ g_get_home_dir (void)
|
||||
sprintf (home_dir, "%s%s", drive, path);
|
||||
}
|
||||
}
|
||||
g_free ((void*)drive);
|
||||
g_free ((void*)path);
|
||||
g_free (drive);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
return home_dir;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
const char *
|
||||
g_get_user_name (void)
|
||||
{
|
||||
const char * retName = g_getenv ("USER");
|
||||
@@ -80,49 +80,6 @@ g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
|
||||
return (*symbol != NULL);
|
||||
}
|
||||
|
||||
#if defined(HAVE_DLADDR)
|
||||
gboolean
|
||||
g_module_address (void *addr, char *file_name, size_t file_name_len,
|
||||
void **file_base, char *sym_name, size_t sym_name_len,
|
||||
void **sym_addr)
|
||||
{
|
||||
Dl_info dli;
|
||||
int ret = dladdr(addr, &dli);
|
||||
/* This zero-on-failure is unlike other Unix APIs. */
|
||||
if (ret == 0)
|
||||
return FALSE;
|
||||
/*
|
||||
* AIX/Win32 return non-const, so we use caller-allocated bufs instead
|
||||
*/
|
||||
if (file_name != NULL && file_name_len >= 1) {
|
||||
if (dli.dli_fname)
|
||||
g_strlcpy(file_name, dli.dli_fname, file_name_len);
|
||||
else
|
||||
file_name [0] = '\0';
|
||||
}
|
||||
if (file_base != NULL)
|
||||
*file_base = dli.dli_fbase;
|
||||
if (sym_name != NULL && sym_name_len >= 1) {
|
||||
if (dli.dli_sname)
|
||||
g_strlcpy (sym_name, dli.dli_sname, sym_name_len);
|
||||
else
|
||||
sym_name [0] = '\0';
|
||||
}
|
||||
if (sym_addr != NULL)
|
||||
*sym_addr = dli.dli_saddr;
|
||||
return TRUE;
|
||||
}
|
||||
#elif !defined(_AIX)
|
||||
/* AIX has its own implementation that is long enough to be its own file. */
|
||||
gboolean
|
||||
g_module_address (void *addr, char *file_name, size_t file_name_len,
|
||||
void **file_base, char *sym_name, size_t sym_name_len,
|
||||
void **sym_addr)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
const gchar *
|
||||
g_module_error (void)
|
||||
{
|
||||
@@ -143,9 +100,6 @@ g_module_close (GModule *module)
|
||||
}
|
||||
|
||||
#elif defined (G_OS_WIN32)
|
||||
#ifndef PSAPI_VERSION
|
||||
#define PSAPI_VERSION 2 // Use the Windows 7 or newer version more directly.
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
|
||||
@@ -319,7 +273,7 @@ g_module_close (GModule *module)
|
||||
gchar *
|
||||
g_module_build_path (const gchar *directory, const gchar *module_name)
|
||||
{
|
||||
const char *lib_prefix = "";
|
||||
char *lib_prefix = "";
|
||||
|
||||
if (module_name == NULL)
|
||||
return NULL;
|
||||
@@ -327,8 +281,10 @@ g_module_build_path (const gchar *directory, const gchar *module_name)
|
||||
if (strncmp (module_name, "lib", 3) != 0)
|
||||
lib_prefix = LIBPREFIX;
|
||||
|
||||
if (directory && *directory)
|
||||
if (directory && *directory){
|
||||
|
||||
return g_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
|
||||
}
|
||||
return g_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name);
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
* gmodule.c: dl* functions, glib style
|
||||
*
|
||||
* Author:
|
||||
* Gonzalo Paniagua Javier ([email protected])
|
||||
* Jonathan Chambers ([email protected])
|
||||
* Robert Jordan ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
* (C) 2006 Jonathan Chambers
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <config.h>
|
||||
#include <glib.h>
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#include <gmodule-win32-internals.h>
|
||||
|
||||
#define LIBSUFFIX ".dll"
|
||||
#define LIBPREFIX ""
|
||||
|
||||
struct _GModule {
|
||||
HMODULE handle;
|
||||
int main_module;
|
||||
};
|
||||
|
||||
GModule *
|
||||
g_module_open (const gchar *file, GModuleFlags flags)
|
||||
{
|
||||
GModule *module;
|
||||
module = g_malloc (sizeof (GModule));
|
||||
if (module == NULL)
|
||||
return NULL;
|
||||
|
||||
if (file != NULL) {
|
||||
gunichar2 *file16;
|
||||
file16 = u8to16(file);
|
||||
module->main_module = FALSE;
|
||||
module->handle = LoadLibraryW (file16);
|
||||
g_free(file16);
|
||||
if (!module->handle) {
|
||||
g_free (module);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} else {
|
||||
module->main_module = TRUE;
|
||||
module->handle = GetModuleHandle (NULL);
|
||||
}
|
||||
|
||||
return module;
|
||||
}
|
||||
|
||||
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
|
||||
gpointer
|
||||
w32_find_symbol (const gchar *symbol_name)
|
||||
{
|
||||
HMODULE *modules;
|
||||
DWORD buffer_size = sizeof (HMODULE) * 1024;
|
||||
DWORD needed, i;
|
||||
|
||||
modules = (HMODULE *) g_malloc (buffer_size);
|
||||
|
||||
if (modules == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!EnumProcessModules (GetCurrentProcess (), modules,
|
||||
buffer_size, &needed)) {
|
||||
g_free (modules);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* check whether the supplied buffer was too small, realloc, retry */
|
||||
if (needed > buffer_size) {
|
||||
g_free (modules);
|
||||
|
||||
buffer_size = needed;
|
||||
modules = (HMODULE *) g_malloc (buffer_size);
|
||||
|
||||
if (modules == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!EnumProcessModules (GetCurrentProcess (), modules,
|
||||
buffer_size, &needed)) {
|
||||
g_free (modules);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < needed / sizeof (HANDLE); i++) {
|
||||
gpointer proc = (gpointer)(intptr_t)GetProcAddress (modules [i], symbol_name);
|
||||
if (proc != NULL) {
|
||||
g_free (modules);
|
||||
return proc;
|
||||
}
|
||||
}
|
||||
|
||||
g_free (modules);
|
||||
return NULL;
|
||||
}
|
||||
#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
|
||||
|
||||
gboolean
|
||||
g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
|
||||
{
|
||||
if (module == NULL || symbol_name == NULL || symbol == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (module->main_module) {
|
||||
*symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
|
||||
if (*symbol != NULL)
|
||||
return TRUE;
|
||||
|
||||
*symbol = w32_find_symbol (symbol_name);
|
||||
return *symbol != NULL;
|
||||
} else {
|
||||
*symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
|
||||
return *symbol != NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
|
||||
const gchar *
|
||||
g_module_error (void)
|
||||
{
|
||||
gchar* ret = NULL;
|
||||
TCHAR* buf = NULL;
|
||||
DWORD code = GetLastError ();
|
||||
|
||||
/* FIXME: buf must not be NULL! */
|
||||
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
|
||||
code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 0, NULL);
|
||||
|
||||
ret = u16to8 (buf);
|
||||
LocalFree(buf);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
|
||||
|
||||
gboolean
|
||||
g_module_close (GModule *module)
|
||||
{
|
||||
HMODULE handle;
|
||||
int main_module;
|
||||
|
||||
if (module == NULL || module->handle == NULL)
|
||||
return FALSE;
|
||||
|
||||
handle = module->handle;
|
||||
main_module = module->main_module;
|
||||
module->handle = NULL;
|
||||
g_free (module);
|
||||
return (main_module ? 1 : (0 == FreeLibrary (handle)));
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_module_build_path (const gchar *directory, const gchar *module_name)
|
||||
{
|
||||
char *lib_prefix = "";
|
||||
|
||||
if (module_name == NULL)
|
||||
return NULL;
|
||||
|
||||
if (strncmp (module_name, "lib", 3) != 0)
|
||||
lib_prefix = LIBPREFIX;
|
||||
|
||||
if (directory && *directory){
|
||||
|
||||
return g_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
|
||||
}
|
||||
return g_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef __GLIB_GMODULE_H
|
||||
#define __GLIB_GMODULE_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#define G_MODULE_IMPORT extern
|
||||
#ifdef G_OS_WIN32
|
||||
#define G_MODULE_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define G_MODULE_EXPORT
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Modules
|
||||
*/
|
||||
typedef enum {
|
||||
G_MODULE_BIND_LAZY = 0x01,
|
||||
G_MODULE_BIND_LOCAL = 0x02,
|
||||
G_MODULE_BIND_MASK = 0x03
|
||||
} GModuleFlags;
|
||||
typedef struct _GModule GModule;
|
||||
|
||||
GModule *g_module_open (const gchar *file, GModuleFlags flags);
|
||||
gboolean g_module_symbol (GModule *module, const gchar *symbol_name,
|
||||
gpointer *symbol);
|
||||
const gchar *g_module_error (void);
|
||||
gboolean g_module_close (GModule *module);
|
||||
gchar * g_module_build_path (const gchar *directory, const gchar *module_name);
|
||||
|
||||
extern char *gmodule_libprefix;
|
||||
extern char *gmodule_libsuffix;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,276 @@
|
||||
/*
|
||||
* Output and debugging functions
|
||||
*
|
||||
* Author:
|
||||
* Miguel de Icaza ([email protected])
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
* Copyright 2011 Xamarin Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
|
||||
/* The current fatal levels, error is always fatal */
|
||||
static GLogLevelFlags fatal = G_LOG_LEVEL_ERROR;
|
||||
static GLogFunc default_log_func;
|
||||
static gpointer default_log_func_user_data;
|
||||
static GPrintFunc stdout_handler, stderr_handler;
|
||||
|
||||
static void default_stdout_handler (const gchar *string);
|
||||
static void default_stderr_handler (const gchar *string);
|
||||
|
||||
void
|
||||
g_print (const gchar *format, ...)
|
||||
{
|
||||
char *msg;
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
if (g_vasprintf (&msg, format, args) < 0) {
|
||||
va_end (args);
|
||||
return;
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
if (!stdout_handler)
|
||||
stdout_handler = default_stdout_handler;
|
||||
|
||||
stdout_handler (msg);
|
||||
g_free (msg);
|
||||
}
|
||||
|
||||
void
|
||||
g_printerr (const gchar *format, ...)
|
||||
{
|
||||
char *msg;
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
if (g_vasprintf (&msg, format, args) < 0) {
|
||||
va_end (args);
|
||||
return;
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
if (!stderr_handler)
|
||||
stderr_handler = default_stderr_handler;
|
||||
|
||||
stderr_handler (msg);
|
||||
g_free (msg);
|
||||
}
|
||||
|
||||
GLogLevelFlags
|
||||
g_log_set_always_fatal (GLogLevelFlags fatal_mask)
|
||||
{
|
||||
GLogLevelFlags old_fatal = fatal;
|
||||
|
||||
fatal |= fatal_mask;
|
||||
|
||||
return old_fatal;
|
||||
}
|
||||
|
||||
GLogLevelFlags
|
||||
g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask)
|
||||
{
|
||||
/*
|
||||
* Mono does not use a G_LOG_DOMAIN currently, so we just assume things are fatal
|
||||
* if we decide to set G_LOG_DOMAIN (we probably should) we should implement
|
||||
* this.
|
||||
*/
|
||||
return fatal_mask;
|
||||
}
|
||||
|
||||
void
|
||||
g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args)
|
||||
{
|
||||
char *msg;
|
||||
|
||||
if (!default_log_func)
|
||||
default_log_func = g_log_default_handler;
|
||||
|
||||
if (g_vasprintf (&msg, format, args) < 0)
|
||||
return;
|
||||
|
||||
default_log_func (log_domain, log_level, msg, default_log_func_user_data);
|
||||
g_free (msg);
|
||||
}
|
||||
|
||||
void
|
||||
g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
g_logv (log_domain, log_level, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
g_assertion_message (const gchar *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
|
||||
va_end (args);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#if PLATFORM_ANDROID
|
||||
#include <android/log.h>
|
||||
|
||||
static android_LogPriority
|
||||
to_android_priority (GLogLevelFlags log_level)
|
||||
{
|
||||
switch (log_level & G_LOG_LEVEL_MASK)
|
||||
{
|
||||
case G_LOG_LEVEL_ERROR: return ANDROID_LOG_FATAL;
|
||||
case G_LOG_LEVEL_CRITICAL: return ANDROID_LOG_ERROR;
|
||||
case G_LOG_LEVEL_WARNING: return ANDROID_LOG_WARN;
|
||||
case G_LOG_LEVEL_MESSAGE: return ANDROID_LOG_INFO;
|
||||
case G_LOG_LEVEL_INFO: return ANDROID_LOG_DEBUG;
|
||||
case G_LOG_LEVEL_DEBUG: return ANDROID_LOG_VERBOSE;
|
||||
}
|
||||
return ANDROID_LOG_UNKNOWN;
|
||||
}
|
||||
|
||||
void
|
||||
g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data)
|
||||
{
|
||||
__android_log_write (to_android_priority (log_level), log_domain, message);
|
||||
if (log_level & fatal)
|
||||
abort ();
|
||||
}
|
||||
|
||||
static void
|
||||
default_stdout_handler (const gchar *message)
|
||||
{
|
||||
/* TODO: provide a proper app name */
|
||||
__android_log_write (ANDROID_LOG_ERROR, "mono", message);
|
||||
}
|
||||
|
||||
static void
|
||||
default_stderr_handler (const gchar *message)
|
||||
{
|
||||
/* TODO: provide a proper app name */
|
||||
__android_log_write (ANDROID_LOG_ERROR, "mono", message);
|
||||
}
|
||||
|
||||
|
||||
#elif defined(HOST_IOS)
|
||||
#include <asl.h>
|
||||
|
||||
static int
|
||||
to_asl_priority (GLogLevelFlags log_level)
|
||||
{
|
||||
switch (log_level & G_LOG_LEVEL_MASK)
|
||||
{
|
||||
case G_LOG_LEVEL_ERROR: return ASL_LEVEL_CRIT;
|
||||
case G_LOG_LEVEL_CRITICAL: return ASL_LEVEL_ERR;
|
||||
case G_LOG_LEVEL_WARNING: return ASL_LEVEL_WARNING;
|
||||
case G_LOG_LEVEL_MESSAGE: return ASL_LEVEL_NOTICE;
|
||||
case G_LOG_LEVEL_INFO: return ASL_LEVEL_INFO;
|
||||
case G_LOG_LEVEL_DEBUG: return ASL_LEVEL_DEBUG;
|
||||
}
|
||||
return ASL_LEVEL_ERR;
|
||||
}
|
||||
|
||||
void
|
||||
g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data)
|
||||
{
|
||||
asl_log (NULL, NULL, to_asl_priority (log_level), "%s", message);
|
||||
if (log_level & fatal)
|
||||
abort ();
|
||||
}
|
||||
|
||||
static void
|
||||
default_stdout_handler (const gchar *message)
|
||||
{
|
||||
asl_log (NULL, NULL, ASL_LEVEL_WARNING, "%s", message);
|
||||
}
|
||||
|
||||
static void
|
||||
default_stderr_handler (const gchar *message)
|
||||
{
|
||||
asl_log (NULL, NULL, ASL_LEVEL_WARNING, "%s", message);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void
|
||||
g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data)
|
||||
{
|
||||
FILE *target = stdout;
|
||||
|
||||
fprintf (target, "%s%s%s\n",
|
||||
log_domain != NULL ? log_domain : "",
|
||||
log_domain != NULL ? ": " : "",
|
||||
message);
|
||||
|
||||
if (log_level & fatal) {
|
||||
fflush (stdout);
|
||||
fflush (stderr);
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
default_stdout_handler (const gchar *string)
|
||||
{
|
||||
fprintf (stdout, "%s", string);
|
||||
}
|
||||
|
||||
static void
|
||||
default_stderr_handler (const gchar *string)
|
||||
{
|
||||
fprintf (stderr, "%s", string);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
GLogFunc
|
||||
g_log_set_default_handler (GLogFunc log_func, gpointer user_data)
|
||||
{
|
||||
GLogFunc old = default_log_func;
|
||||
default_log_func = log_func;
|
||||
default_log_func_user_data = user_data;
|
||||
return old;
|
||||
}
|
||||
|
||||
GPrintFunc
|
||||
g_set_print_handler (GPrintFunc func)
|
||||
{
|
||||
GPrintFunc old = stdout_handler;
|
||||
stdout_handler = func;
|
||||
return old;
|
||||
}
|
||||
|
||||
GPrintFunc
|
||||
g_set_printerr_handler (GPrintFunc func)
|
||||
{
|
||||
GPrintFunc old = stderr_handler;
|
||||
stderr_handler = func;
|
||||
return old;
|
||||
}
|
||||
|
||||
@@ -97,9 +97,9 @@ strrchr_seperator (const gchar* filename)
|
||||
#endif
|
||||
char *p;
|
||||
|
||||
p = (char*)strrchr (filename, G_DIR_SEPARATOR);
|
||||
p = strrchr (filename, G_DIR_SEPARATOR);
|
||||
#ifdef G_OS_WIN32
|
||||
p2 = (char*)strrchr (filename, '/');
|
||||
p2 = strrchr (filename, '/');
|
||||
if (p2 > p)
|
||||
p = p2;
|
||||
#endif
|
||||
@@ -160,8 +160,7 @@ g_path_get_basename (const char *filename)
|
||||
return g_strdup (&r[1]);
|
||||
}
|
||||
|
||||
//wasm does have strtok_r even though autoconf fails to find
|
||||
#if !defined (HAVE_STRTOK_R) && !defined (HOST_WASM)
|
||||
#ifndef HAVE_STRTOK_R
|
||||
// This is from BSD's strtok_r
|
||||
|
||||
char *
|
||||
@@ -224,13 +223,13 @@ g_find_program_in_path (const gchar *program)
|
||||
char *save = NULL;
|
||||
#ifdef G_OS_WIN32
|
||||
char *program_exe;
|
||||
static char const * const suffix_list[5] = {".exe",".cmd",".bat",".com",NULL};
|
||||
char *suffix_list[5] = {".exe",".cmd",".bat",".com",NULL};
|
||||
int listx;
|
||||
gboolean hasSuffix;
|
||||
#endif
|
||||
|
||||
g_return_val_if_fail (program != NULL, NULL);
|
||||
x = p = g_getenv ("PATH");
|
||||
x = p = g_strdup (g_getenv ("PATH"));
|
||||
|
||||
if (x == NULL || *x == '\0') {
|
||||
curdir = g_get_current_dir ();
|
||||
@@ -251,13 +250,11 @@ g_find_program_in_path (const gchar *program)
|
||||
|
||||
x = NULL;
|
||||
probe_path = g_build_path (G_DIR_SEPARATOR_S, l, program, NULL);
|
||||
#ifdef HAVE_ACCESS
|
||||
if (g_access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read permissions test */
|
||||
if (access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read permissions test */
|
||||
g_free (curdir);
|
||||
g_free (p);
|
||||
return probe_path;
|
||||
}
|
||||
#endif
|
||||
g_free (probe_path);
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
@@ -265,16 +262,14 @@ g_find_program_in_path (const gchar *program)
|
||||
if (!hasSuffix) {
|
||||
listx = 0;
|
||||
while (suffix_list[listx]) {
|
||||
program_exe = g_strjoin (NULL, program, suffix_list [listx], (const char*)NULL);
|
||||
probe_path = g_build_path (G_DIR_SEPARATOR_S, l, program_exe, (const char*)NULL);
|
||||
#ifdef HAVE_ACCESS
|
||||
if (g_access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read permissions test */
|
||||
program_exe = g_strjoin(NULL,program,suffix_list[listx],NULL);
|
||||
probe_path = g_build_path (G_DIR_SEPARATOR_S, l, program_exe, NULL);
|
||||
if (access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read permissions test */
|
||||
g_free (curdir);
|
||||
g_free (p);
|
||||
g_free (program_exe);
|
||||
return probe_path;
|
||||
}
|
||||
#endif
|
||||
listx++;
|
||||
g_free (probe_path);
|
||||
g_free (program_exe);
|
||||
@@ -337,6 +332,7 @@ g_ensure_directory_exists (const gchar *filename)
|
||||
}
|
||||
|
||||
while (1) {
|
||||
gboolean bRet = FALSE;
|
||||
p = wcschr (p, '\\');
|
||||
if (p)
|
||||
*p = '\0';
|
||||
@@ -25,7 +25,6 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -27,7 +27,7 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
|
||||
@@ -40,9 +40,10 @@ typedef struct _GPtrArrayPriv {
|
||||
static void
|
||||
g_ptr_array_grow(GPtrArrayPriv *array, guint length)
|
||||
{
|
||||
g_assert (array);
|
||||
guint new_length = array->len + length;
|
||||
|
||||
g_return_if_fail(array != NULL);
|
||||
|
||||
if(new_length <= array->size) {
|
||||
return;
|
||||
}
|
||||
@@ -83,8 +84,8 @@ gpointer *
|
||||
g_ptr_array_free(GPtrArray *array, gboolean free_seg)
|
||||
{
|
||||
gpointer *data = NULL;
|
||||
|
||||
g_assert (array);
|
||||
|
||||
g_return_val_if_fail(array != NULL, NULL);
|
||||
|
||||
if(free_seg) {
|
||||
g_free(array->pdata);
|
||||
@@ -100,7 +101,7 @@ g_ptr_array_free(GPtrArray *array, gboolean free_seg)
|
||||
void
|
||||
g_ptr_array_set_size(GPtrArray *array, gint length)
|
||||
{
|
||||
g_assert (array);
|
||||
g_return_if_fail(array != NULL);
|
||||
|
||||
if((size_t)length > array->len) {
|
||||
g_ptr_array_grow((GPtrArrayPriv *)array, length);
|
||||
@@ -114,7 +115,7 @@ g_ptr_array_set_size(GPtrArray *array, gint length)
|
||||
void
|
||||
g_ptr_array_add(GPtrArray *array, gpointer data)
|
||||
{
|
||||
g_assert (array);
|
||||
g_return_if_fail(array != NULL);
|
||||
g_ptr_array_grow((GPtrArrayPriv *)array, 1);
|
||||
array->pdata[array->len++] = data;
|
||||
}
|
||||
@@ -123,8 +124,8 @@ gpointer
|
||||
g_ptr_array_remove_index(GPtrArray *array, guint index)
|
||||
{
|
||||
gpointer removed_node;
|
||||
|
||||
g_assert (array);
|
||||
|
||||
g_return_val_if_fail(array != NULL, NULL);
|
||||
g_return_val_if_fail(index < array->len, NULL);
|
||||
|
||||
removed_node = array->pdata[index];
|
||||
@@ -145,7 +146,7 @@ g_ptr_array_remove_index_fast(GPtrArray *array, guint index)
|
||||
{
|
||||
gpointer removed_node;
|
||||
|
||||
g_assert (array);
|
||||
g_return_val_if_fail(array != NULL, NULL);
|
||||
g_return_val_if_fail(index < array->len, NULL);
|
||||
|
||||
removed_node = array->pdata[index];
|
||||
@@ -166,7 +167,7 @@ g_ptr_array_remove(GPtrArray *array, gpointer data)
|
||||
{
|
||||
guint i;
|
||||
|
||||
g_assert (array);
|
||||
g_return_val_if_fail(array != NULL, FALSE);
|
||||
|
||||
for(i = 0; i < array->len; i++) {
|
||||
if(array->pdata[i] == data) {
|
||||
@@ -183,7 +184,7 @@ g_ptr_array_remove_fast(GPtrArray *array, gpointer data)
|
||||
{
|
||||
guint i;
|
||||
|
||||
g_assert (array);
|
||||
g_return_val_if_fail(array != NULL, FALSE);
|
||||
|
||||
for(i = 0; i < array->len; i++) {
|
||||
if(array->pdata[i] == data) {
|
||||
@@ -212,35 +213,15 @@ g_ptr_array_foreach(GPtrArray *array, GFunc func, gpointer user_data)
|
||||
void
|
||||
g_ptr_array_sort(GPtrArray *array, GCompareFunc compare)
|
||||
{
|
||||
g_assert (array);
|
||||
mono_qsort (array->pdata, array->len, sizeof(gpointer), compare);
|
||||
g_return_if_fail(array != NULL);
|
||||
qsort(array->pdata, array->len, sizeof(gpointer), compare);
|
||||
}
|
||||
|
||||
void
|
||||
g_ptr_array_sort_with_data (GPtrArray *array, GCompareDataFunc compare, gpointer user_data)
|
||||
{
|
||||
g_assert (array);
|
||||
g_return_if_fail (array != NULL);
|
||||
|
||||
g_qsort_with_data (array->pdata, array->len, sizeof (gpointer), compare, user_data);
|
||||
}
|
||||
|
||||
guint
|
||||
g_ptr_array_capacity (GPtrArray *array)
|
||||
{
|
||||
return ((GPtrArrayPriv *)array)->size;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_ptr_array_find (GPtrArray *array, gconstpointer needle, guint *index)
|
||||
{
|
||||
g_assert (array);
|
||||
for (int i = 0; i < array->len; i++) {
|
||||
if (array->pdata [i] == needle) {
|
||||
if (index)
|
||||
*index = i;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
|
||||
@@ -40,14 +40,14 @@ typedef struct _QSortStack {
|
||||
size_t count;
|
||||
} QSortStack;
|
||||
|
||||
#define QSORT_PUSH(sp, a, c) ((sp)->array = (char*)(a), (sp)->count = (c), (sp)++)
|
||||
#define QSORT_POP(sp, a, c) ((sp)--, (a) = (sp)->array, (c) = (sp)->count)
|
||||
#define QSORT_PUSH(sp, a, c) (sp->array = a, sp->count = c, sp++)
|
||||
#define QSORT_POP(sp, a, c) (sp--, a = sp->array, c = sp->count)
|
||||
|
||||
#define SWAPTYPE(TYPE, a, b) { \
|
||||
gssize __n = size / sizeof (TYPE); \
|
||||
TYPE *__a = (TYPE *) (a); \
|
||||
TYPE *__b = (TYPE *) (b); \
|
||||
TYPE t; \
|
||||
long __n = size / sizeof (TYPE); \
|
||||
register TYPE *__a = (TYPE *) (a); \
|
||||
register TYPE *__b = (TYPE *) (b); \
|
||||
register TYPE t; \
|
||||
\
|
||||
do { \
|
||||
t = *__a; \
|
||||
@@ -69,7 +69,7 @@ void
|
||||
g_qsort_with_data (gpointer base, size_t nmemb, size_t size, GCompareDataFunc compare, gpointer user_data)
|
||||
{
|
||||
QSortStack stack[STACK_SIZE], *sp;
|
||||
char *i, *k, *mid;
|
||||
register char *i, *k, *mid;
|
||||
size_t n, n1, n2;
|
||||
char *lo, *hi;
|
||||
int swaplong;
|
||||
@@ -27,7 +27,7 @@
|
||||
* Copyright (c) 2006-2009 Novell, Inc.
|
||||
*
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
|
||||
@@ -25,12 +25,11 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
|
||||
static int
|
||||
split_cmdline (const gchar *cmdline, GPtrArray *array, GError **gerror)
|
||||
split_cmdline (const gchar *cmdline, GPtrArray *array, GError **error)
|
||||
{
|
||||
gchar *ptr;
|
||||
gchar c;
|
||||
@@ -62,7 +61,7 @@ split_cmdline (const gchar *cmdline, GPtrArray *array, GError **gerror)
|
||||
g_ptr_array_add (array, g_string_free (str, FALSE));
|
||||
str = g_string_new ("");
|
||||
}
|
||||
} else if (c == '\\' && quote_char == '\"'){
|
||||
} else if (c == '\\'){
|
||||
escaped = TRUE;
|
||||
} else
|
||||
g_string_append_c (str, c);
|
||||
@@ -82,15 +81,15 @@ split_cmdline (const gchar *cmdline, GPtrArray *array, GError **gerror)
|
||||
}
|
||||
|
||||
if (escaped) {
|
||||
if (gerror)
|
||||
*gerror = g_error_new (G_LOG_DOMAIN, 0, "Unfinished escape.");
|
||||
if (error)
|
||||
*error = g_error_new (G_LOG_DOMAIN, 0, "Unfinished escape.");
|
||||
g_string_free (str, TRUE);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (quote_char) {
|
||||
if (gerror)
|
||||
*gerror = g_error_new (G_LOG_DOMAIN, 0, "Unfinished quote.");
|
||||
if (error)
|
||||
*error = g_error_new (G_LOG_DOMAIN, 0, "Unfinished quote.");
|
||||
g_string_free (str, TRUE);
|
||||
return -1;
|
||||
}
|
||||
@@ -105,17 +104,17 @@ split_cmdline (const gchar *cmdline, GPtrArray *array, GError **gerror)
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GError **gerror)
|
||||
g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GError **error)
|
||||
{
|
||||
GPtrArray *array;
|
||||
gint argc;
|
||||
gchar **argv;
|
||||
|
||||
g_return_val_if_fail (command_line, FALSE);
|
||||
g_return_val_if_fail (gerror == NULL || *gerror == NULL, FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
array = g_ptr_array_new();
|
||||
if (split_cmdline (command_line, array, gerror)) {
|
||||
if (split_cmdline (command_line, array, error)) {
|
||||
g_ptr_array_add (array, NULL);
|
||||
g_strfreev ((gchar **) array->pdata);
|
||||
g_ptr_array_free (array, FALSE);
|
||||
@@ -161,7 +160,7 @@ g_shell_quote (const gchar *unquoted_string)
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_shell_unquote (const gchar *quoted_string, GError **gerror)
|
||||
g_shell_unquote (const gchar *quoted_string, GError **error)
|
||||
{
|
||||
GString *result;
|
||||
const char *p;
|
||||
@@ -193,7 +192,7 @@ g_shell_unquote (const gchar *quoted_string, GError **gerror)
|
||||
g_string_append_c (result, *p);
|
||||
}
|
||||
if (!*p){
|
||||
g_set_error (gerror, 0, 0, "Open quote");
|
||||
g_set_error (error, 0, 0, "Open quote");
|
||||
return NULL;
|
||||
}
|
||||
} else if (*p == '"'){
|
||||
@@ -204,7 +203,7 @@ g_shell_unquote (const gchar *quoted_string, GError **gerror)
|
||||
if (*p == '\\'){
|
||||
p++;
|
||||
if (*p == 0){
|
||||
g_set_error (gerror, 0, 0, "Open quote");
|
||||
g_set_error (error, 0, 0, "Open quote");
|
||||
return NULL;
|
||||
}
|
||||
switch (*p){
|
||||
@@ -221,7 +220,7 @@ g_shell_unquote (const gchar *quoted_string, GError **gerror)
|
||||
g_string_append_c (result, *p);
|
||||
}
|
||||
if (!*p){
|
||||
g_set_error (gerror, 0, 0, "Open quote");
|
||||
g_set_error (error, 0, 0, "Open quote");
|
||||
return NULL;
|
||||
}
|
||||
} else if (*p == '\\'){
|
||||
@@ -26,7 +26,7 @@
|
||||
*
|
||||
* (C) 2006 Novell, Inc.
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
|
||||
@@ -63,7 +63,7 @@ g_slist_prepend (GSList *list, gpointer data)
|
||||
* Insert the given data in a new node after the current node.
|
||||
* Return new node.
|
||||
*/
|
||||
static GSList *
|
||||
static inline GSList *
|
||||
insert_after (GSList *list, gpointer data)
|
||||
{
|
||||
list->next = g_slist_prepend (list->next, data);
|
||||
@@ -75,7 +75,7 @@ insert_after (GSList *list, gpointer data)
|
||||
* If the list is empty, or the first node contains 'data', return NULL.
|
||||
* If no node contains 'data', return the last node.
|
||||
*/
|
||||
static GSList*
|
||||
static inline GSList*
|
||||
find_prev (GSList *list, gconstpointer data)
|
||||
{
|
||||
GSList *prev = NULL;
|
||||
@@ -89,7 +89,7 @@ find_prev (GSList *list, gconstpointer data)
|
||||
}
|
||||
|
||||
/* like 'find_prev', but searches for node 'link' */
|
||||
static GSList*
|
||||
static inline GSList*
|
||||
find_prev_link (GSList *list, GSList *link)
|
||||
{
|
||||
GSList *prev = NULL;
|
||||
@@ -68,19 +68,11 @@
|
||||
#define pipe(x) _pipe(x, 256, 0)
|
||||
#endif
|
||||
|
||||
#if HAVE_G_SPAWN
|
||||
|
||||
#define set_error(msg, ...) do { if (gerror != NULL) *gerror = g_error_new (G_LOG_DOMAIN, 1, msg, __VA_ARGS__); } while (0)
|
||||
#define set_error_cond(cond,msg, ...) do { if ((cond) && gerror != NULL) *gerror = g_error_new (G_LOG_DOMAIN, 1, msg, __VA_ARGS__); } while (0)
|
||||
#define set_error_status(status,msg, ...) do { if (gerror != NULL) *gerror = g_error_new (G_LOG_DOMAIN, status, msg, __VA_ARGS__); } while (0)
|
||||
#define set_error(msg, ...) do { if (error != NULL) *error = g_error_new (G_LOG_DOMAIN, 1, msg, __VA_ARGS__); } while (0)
|
||||
#define set_error_cond(cond,msg, ...) do { if ((cond) && error != NULL) *error = g_error_new (G_LOG_DOMAIN, 1, msg, __VA_ARGS__); } while (0)
|
||||
#define set_error_status(status,msg, ...) do { if (error != NULL) *error = g_error_new (G_LOG_DOMAIN, status, msg, __VA_ARGS__); } while (0)
|
||||
#define NO_INTR(var,cmd) do { (var) = (cmd); } while ((var) == -1 && errno == EINTR)
|
||||
|
||||
static void
|
||||
mono_close_pipe (int p [2])
|
||||
{
|
||||
close (p [0]);
|
||||
close (p [1]);
|
||||
}
|
||||
#define CLOSE_PIPE(p) do { close (p [0]); close (p [1]); } while (0)
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#if defined (TARGET_OSX)
|
||||
@@ -88,9 +80,7 @@ mono_close_pipe (int p [2])
|
||||
* arm-apple-darwin9. We'll manually define the symbol on Apple as it does
|
||||
* in fact exist on all implementations (so far)
|
||||
*/
|
||||
G_BEGIN_DECLS
|
||||
gchar ***_NSGetEnviron(void);
|
||||
G_END_DECLS
|
||||
#define environ (*_NSGetEnviron())
|
||||
#else
|
||||
static char *mono_environ[1] = { NULL };
|
||||
@@ -99,13 +89,12 @@ static char *mono_environ[1] = { NULL };
|
||||
#elif defined(_MSC_VER)
|
||||
/* MS defines this in stdlib.h */
|
||||
#else
|
||||
G_BEGIN_DECLS
|
||||
extern char **environ;
|
||||
G_END_DECLS
|
||||
#endif
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
static int
|
||||
safe_read (int fd, gchar *buffer, gint count, GError **gerror)
|
||||
safe_read (int fd, gchar *buffer, gint count, GError **error)
|
||||
{
|
||||
int res;
|
||||
|
||||
@@ -115,7 +104,7 @@ safe_read (int fd, gchar *buffer, gint count, GError **gerror)
|
||||
}
|
||||
|
||||
static int
|
||||
read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **gerror)
|
||||
read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **error)
|
||||
{
|
||||
fd_set rfds;
|
||||
int res;
|
||||
@@ -142,18 +131,27 @@ read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **ger
|
||||
if (out_closed && err_closed)
|
||||
break;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4389)
|
||||
#endif
|
||||
|
||||
FD_ZERO (&rfds);
|
||||
if (!out_closed && outfd >= 0)
|
||||
FD_SET (outfd, &rfds);
|
||||
if (!err_closed && errfd >= 0)
|
||||
FD_SET (errfd, &rfds);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
res = select (MAX (outfd, errfd) + 1, &rfds, NULL, NULL, NULL);
|
||||
if (res > 0) {
|
||||
if (buffer == NULL)
|
||||
buffer = g_malloc (1024);
|
||||
if (!out_closed && FD_ISSET (outfd, &rfds)) {
|
||||
nread = safe_read (outfd, buffer, 1024, gerror);
|
||||
nread = safe_read (outfd, buffer, 1024, error);
|
||||
if (nread < 0) {
|
||||
close (errfd);
|
||||
close (outfd);
|
||||
@@ -167,7 +165,7 @@ read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **ger
|
||||
}
|
||||
|
||||
if (!err_closed && FD_ISSET (errfd, &rfds)) {
|
||||
nread = safe_read (errfd, buffer, 1024, gerror);
|
||||
nread = safe_read (errfd, buffer, 1024, error);
|
||||
if (nread < 0) {
|
||||
close (errfd);
|
||||
close (outfd);
|
||||
@@ -193,7 +191,7 @@ read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **ger
|
||||
}
|
||||
|
||||
static gboolean
|
||||
create_pipe (int *fds, GError **gerror)
|
||||
create_pipe (int *fds, GError **error)
|
||||
{
|
||||
if (pipe (fds) == -1) {
|
||||
set_error ("%s", "Error creating pipe.");
|
||||
@@ -201,6 +199,7 @@ create_pipe (int *fds, GError **gerror)
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* G_OS_WIN32 */
|
||||
|
||||
static int
|
||||
write_all (int fd, const void *vbuf, size_t n)
|
||||
@@ -223,9 +222,7 @@ write_all (int fd, const void *vbuf, size_t n)
|
||||
return nwritten;
|
||||
}
|
||||
|
||||
#endif // HAVE_G_SPAWN
|
||||
|
||||
#if !defined(G_OS_WIN32) && defined(HAVE_GETDTABLESIZE)
|
||||
#ifndef G_OS_WIN32
|
||||
int
|
||||
eg_getdtablesize (void)
|
||||
{
|
||||
@@ -248,15 +245,18 @@ eg_getdtablesize (void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_G_SPAWN
|
||||
|
||||
gboolean
|
||||
g_spawn_command_line_sync (const gchar *command_line,
|
||||
gchar **standard_output,
|
||||
gchar **standard_error,
|
||||
gint *exit_status,
|
||||
GError **gerror)
|
||||
GError **error)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
#elif !defined (HAVE_FORK) || !defined (HAVE_EXECV)
|
||||
fprintf (stderr, "g_spawn_command_line_sync not supported on this platform\n");
|
||||
return FALSE;
|
||||
#else
|
||||
pid_t pid;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
@@ -265,15 +265,15 @@ g_spawn_command_line_sync (const gchar *command_line,
|
||||
int status;
|
||||
int res;
|
||||
|
||||
if (!g_shell_parse_argv (command_line, &argc, &argv, gerror))
|
||||
if (!g_shell_parse_argv (command_line, &argc, &argv, error))
|
||||
return FALSE;
|
||||
|
||||
if (standard_output && !create_pipe (stdout_pipe, gerror))
|
||||
if (standard_output && !create_pipe (stdout_pipe, error))
|
||||
return FALSE;
|
||||
|
||||
if (standard_error && !create_pipe (stderr_pipe, gerror)) {
|
||||
if (standard_error && !create_pipe (stderr_pipe, error)) {
|
||||
if (standard_output) {
|
||||
mono_close_pipe (stdout_pipe);
|
||||
CLOSE_PIPE (stdout_pipe);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -317,7 +317,7 @@ g_spawn_command_line_sync (const gchar *command_line,
|
||||
close (stderr_pipe [1]);
|
||||
|
||||
if (standard_output || standard_error) {
|
||||
res = read_pipes (stdout_pipe [0], standard_output, stderr_pipe [0], standard_error, gerror);
|
||||
res = read_pipes (stdout_pipe [0], standard_output, stderr_pipe [0], standard_error, error);
|
||||
if (res) {
|
||||
waitpid (pid, &status, WNOHANG); /* avoid zombie */
|
||||
return FALSE;
|
||||
@@ -330,6 +330,7 @@ g_spawn_command_line_sync (const gchar *command_line,
|
||||
if (WIFEXITED (status) && exit_status) {
|
||||
*exit_status = WEXITSTATUS (status);
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -348,8 +349,13 @@ g_spawn_async_with_pipes (const gchar *working_directory,
|
||||
gint *standard_input,
|
||||
gint *standard_output,
|
||||
gint *standard_error,
|
||||
GError **gerror)
|
||||
GError **error)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
#elif !defined (HAVE_FORK) || !defined (HAVE_EXECVE)
|
||||
fprintf (stderr, "g_spawn_async_with_pipes is not supported on this platform\n");
|
||||
return FALSE;
|
||||
#else
|
||||
pid_t pid;
|
||||
int info_pipe [2];
|
||||
int in_pipe [2] = { -1, -1 };
|
||||
@@ -359,33 +365,33 @@ g_spawn_async_with_pipes (const gchar *working_directory,
|
||||
|
||||
g_return_val_if_fail (argv != NULL, FALSE); /* Only mandatory arg */
|
||||
|
||||
if (!create_pipe (info_pipe, gerror))
|
||||
if (!create_pipe (info_pipe, error))
|
||||
return FALSE;
|
||||
|
||||
if (standard_output && !create_pipe (out_pipe, gerror)) {
|
||||
mono_close_pipe (info_pipe);
|
||||
if (standard_output && !create_pipe (out_pipe, error)) {
|
||||
CLOSE_PIPE (info_pipe);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (standard_error && !create_pipe (err_pipe, gerror)) {
|
||||
mono_close_pipe (info_pipe);
|
||||
mono_close_pipe (out_pipe);
|
||||
if (standard_error && !create_pipe (err_pipe, error)) {
|
||||
CLOSE_PIPE (info_pipe);
|
||||
CLOSE_PIPE (out_pipe);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (standard_input && !create_pipe (in_pipe, gerror)) {
|
||||
mono_close_pipe (info_pipe);
|
||||
mono_close_pipe (out_pipe);
|
||||
mono_close_pipe (err_pipe);
|
||||
if (standard_input && !create_pipe (in_pipe, error)) {
|
||||
CLOSE_PIPE (info_pipe);
|
||||
CLOSE_PIPE (out_pipe);
|
||||
CLOSE_PIPE (err_pipe);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pid = fork ();
|
||||
if (pid == -1) {
|
||||
mono_close_pipe (info_pipe);
|
||||
mono_close_pipe (out_pipe);
|
||||
mono_close_pipe (err_pipe);
|
||||
mono_close_pipe (in_pipe);
|
||||
CLOSE_PIPE (info_pipe);
|
||||
CLOSE_PIPE (out_pipe);
|
||||
CLOSE_PIPE (err_pipe);
|
||||
CLOSE_PIPE (in_pipe);
|
||||
set_error ("%s", "Error in fork ()");
|
||||
return FALSE;
|
||||
}
|
||||
@@ -471,8 +477,7 @@ g_spawn_async_with_pipes (const gchar *working_directory,
|
||||
}
|
||||
|
||||
execve (arg0, actual_args, envp);
|
||||
int const err = errno;
|
||||
write_all (info_pipe [1], &err, sizeof (int));
|
||||
write_all (info_pipe [1], &errno, sizeof (int));
|
||||
exit (0);
|
||||
}
|
||||
} else if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
|
||||
@@ -480,10 +485,10 @@ g_spawn_async_with_pipes (const gchar *working_directory,
|
||||
/* Wait for the first child if two are created */
|
||||
NO_INTR (w, waitpid (pid, &status, 0));
|
||||
if (status == 1 || w == -1) {
|
||||
mono_close_pipe (info_pipe);
|
||||
mono_close_pipe (out_pipe);
|
||||
mono_close_pipe (err_pipe);
|
||||
mono_close_pipe (in_pipe);
|
||||
CLOSE_PIPE (info_pipe);
|
||||
CLOSE_PIPE (out_pipe);
|
||||
CLOSE_PIPE (err_pipe);
|
||||
CLOSE_PIPE (in_pipe);
|
||||
set_error ("Error in fork (): %d", status);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -518,12 +523,8 @@ g_spawn_async_with_pipes (const gchar *working_directory,
|
||||
*standard_output = out_pipe [0];
|
||||
if (standard_error)
|
||||
*standard_error = err_pipe [0];
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif // HAVE_G_SPAWN
|
||||
|
||||
#define MONO_EMPTY_SOURCE_FILE(x) extern const char mono_quash_linker_empty_file_warning_ ## x; \
|
||||
const char mono_quash_linker_empty_file_warning_ ## x = 0;
|
||||
|
||||
MONO_EMPTY_SOURCE_FILE (gspawn);
|
||||
@@ -205,13 +205,6 @@ Last this was checked was June-2017.
|
||||
|
||||
Apple is at 106.
|
||||
Android is at 133.
|
||||
|
||||
Haiku starts numbering at 0x8000_7000 (like HRESULT on Win32) for POSIX errno,
|
||||
but errors from BeAPI or custom user libraries could be lower or higher.
|
||||
(Technically, this is C and old POSIX compliant, but not new POSIX compliant.)
|
||||
The big problem with this is that it effectively means errors start at a
|
||||
negative offset. As such, disable the whole strerror caching mechanism.
|
||||
|
||||
*/
|
||||
#define MONO_ERRNO_MAX 200
|
||||
#define str(s) #s
|
||||
@@ -220,14 +213,6 @@ negative offset. As such, disable the whole strerror caching mechanism.
|
||||
static pthread_mutex_t strerror_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
#endif
|
||||
|
||||
#if defined(__HAIKU__)
|
||||
const gchar *
|
||||
g_strerror (gint errnum)
|
||||
{
|
||||
/* returns a const char* on Haiku */
|
||||
return strerror(errnum);
|
||||
}
|
||||
#else
|
||||
static char *error_messages [MONO_ERRNO_MAX];
|
||||
|
||||
const gchar *
|
||||
@@ -246,11 +231,10 @@ g_strerror (gint errnum)
|
||||
#ifdef HAVE_STRERROR_R
|
||||
char tmp_buff [128]; //Quite arbitrary, should be large enough
|
||||
char *buff = tmp_buff;
|
||||
size_t buff_len = sizeof (tmp_buff);
|
||||
int buff_len = sizeof (tmp_buff);
|
||||
int r;
|
||||
buff [0] = 0;
|
||||
|
||||
#ifndef STRERROR_R_CHAR_P
|
||||
int r;
|
||||
while ((r = strerror_r (errnum, buff, buff_len - 1))) {
|
||||
if (r != ERANGE) {
|
||||
buff = g_strdup_printf ("Invalid Error code '%d'", errnum);
|
||||
@@ -267,16 +251,10 @@ g_strerror (gint errnum)
|
||||
error_messages [errnum] = g_strdup (buff);
|
||||
if (buff != tmp_buff)
|
||||
g_free (buff);
|
||||
#else /* STRERROR_R_CHAR_P */
|
||||
buff = strerror_r (errnum, buff, buff_len);
|
||||
if (!error_messages [errnum])
|
||||
error_messages [errnum] = g_strdup (buff);
|
||||
#endif /* STRERROR_R_CHAR_P */
|
||||
|
||||
#else /* HAVE_STRERROR_R */
|
||||
#else
|
||||
if (!error_messages [errnum])
|
||||
error_messages [errnum] = g_strdup_printf ("Error code '%d'", errnum);
|
||||
#endif /* HAVE_STRERROR_R */
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
@@ -286,34 +264,31 @@ g_strerror (gint errnum)
|
||||
}
|
||||
return error_messages [errnum];
|
||||
}
|
||||
#endif
|
||||
|
||||
gchar *
|
||||
g_strconcat (const gchar *first, ...)
|
||||
{
|
||||
va_list args;
|
||||
size_t total = 0;
|
||||
char *s, *ret;
|
||||
g_return_val_if_fail (first != NULL, NULL);
|
||||
|
||||
size_t len = strlen (first);
|
||||
total += strlen (first);
|
||||
va_start (args, first);
|
||||
for (s = va_arg (args, char *); s != NULL; s = va_arg(args, char *)){
|
||||
len += strlen (s);
|
||||
total += strlen (s);
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
ret = (char*)g_malloc (len + 1);
|
||||
ret = g_malloc (total + 1);
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
|
||||
ret [len] = 0;
|
||||
len = strlen (first);
|
||||
memcpy (ret, first, len);
|
||||
ret [total] = 0;
|
||||
strcpy (ret, first);
|
||||
va_start (args, first);
|
||||
first = ret; // repurpose first as cursor
|
||||
for (s = va_arg (args, char *); s != NULL; s = va_arg(args, char *)){
|
||||
first += len;
|
||||
memcpy ((char*)first, s, len = strlen (s));
|
||||
strcat (ret, s);
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
@@ -530,7 +505,7 @@ g_strjoin (const gchar *separator, ...)
|
||||
if (slen > 0 && len > 0)
|
||||
len -= slen;
|
||||
|
||||
res = (char*)g_malloc (len + 1);
|
||||
res = g_malloc (len + 1);
|
||||
va_start (args, separator);
|
||||
s = va_arg (args, char *);
|
||||
r = g_stpcpy (res, s);
|
||||
@@ -610,6 +585,19 @@ g_strchomp (gchar *str)
|
||||
return str;
|
||||
}
|
||||
|
||||
gint
|
||||
g_printf(gchar const *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
gint ret;
|
||||
|
||||
va_start(args, format);
|
||||
ret = vprintf(format, args);
|
||||
va_end(args);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gint
|
||||
g_fprintf(FILE *file, gchar const *format, ...)
|
||||
{
|
||||
@@ -667,7 +655,7 @@ char_needs_encoding (char c)
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **gerror)
|
||||
g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error)
|
||||
{
|
||||
size_t n;
|
||||
char *ret, *rp;
|
||||
@@ -684,8 +672,8 @@ g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **gerror
|
||||
g_warning ("%s", "eglib: g_filename_to_uri: hostname not handled");
|
||||
|
||||
if (!g_path_is_absolute (filename)){
|
||||
if (gerror != NULL)
|
||||
*gerror = g_error_new (NULL, 2, "Not an absolute filename");
|
||||
if (error != NULL)
|
||||
*error = g_error_new (NULL, 2, "Not an absolute filename");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -729,15 +717,15 @@ decode (char p)
|
||||
if (p >= '0' && p <= '9')
|
||||
return p - '0';
|
||||
if (p >= 'A' && p <= 'F')
|
||||
return (p - 'A') + 10;
|
||||
return p - 'A';
|
||||
if (p >= 'a' && p <= 'f')
|
||||
return (p - 'a') + 10;
|
||||
return p - 'a';
|
||||
g_assert_not_reached ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_filename_from_uri (const gchar *uri, gchar **hostname, GError **gerror)
|
||||
g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error)
|
||||
{
|
||||
const char *p;
|
||||
char *r, *result;
|
||||
@@ -749,8 +737,8 @@ g_filename_from_uri (const gchar *uri, gchar **hostname, GError **gerror)
|
||||
g_warning ("%s", "eglib: g_filename_from_uri: hostname not handled");
|
||||
|
||||
if (strncmp (uri, "file:///", 8) != 0){
|
||||
if (gerror != NULL)
|
||||
*gerror = g_error_new (NULL, 2, "URI does not start with the file: scheme");
|
||||
if (error != NULL)
|
||||
*error = g_error_new (NULL, 2, "URI does not start with the file: scheme");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -759,8 +747,8 @@ g_filename_from_uri (const gchar *uri, gchar **hostname, GError **gerror)
|
||||
if (p [1] && p [2] && isxdigit (p [1]) && isxdigit (p [2])){
|
||||
p += 2;
|
||||
} else {
|
||||
if (gerror != NULL)
|
||||
*gerror = g_error_new (NULL, 2, "URI contains an invalid escape sequence");
|
||||
if (error != NULL)
|
||||
*error = g_error_new (NULL, 2, "URI contains an invalid escape sequence");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -808,20 +796,11 @@ g_ascii_tolower (gchar c)
|
||||
return c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c;
|
||||
}
|
||||
|
||||
void
|
||||
g_ascii_strdown_no_alloc (char* dst, const char* src, gsize len)
|
||||
{
|
||||
// dst can equal src. no_alloc means this function does no
|
||||
// allocation; caller may very well.
|
||||
|
||||
for (gsize i = 0; i < len; ++i)
|
||||
dst [i] = g_ascii_tolower (src [i]);
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_ascii_strdown (const gchar *str, gssize len)
|
||||
{
|
||||
char *ret;
|
||||
int i;
|
||||
|
||||
g_return_val_if_fail (str != NULL, NULL);
|
||||
|
||||
@@ -829,8 +808,9 @@ g_ascii_strdown (const gchar *str, gssize len)
|
||||
len = strlen (str);
|
||||
|
||||
ret = g_malloc (len + 1);
|
||||
g_ascii_strdown_no_alloc (ret, str, len);
|
||||
ret [len] = 0;
|
||||
for (i = 0; i < len; i++)
|
||||
ret [i] = (guchar) g_ascii_tolower (str [i]);
|
||||
ret [i] = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -854,50 +834,26 @@ g_ascii_strup (const gchar *str, gssize len)
|
||||
|
||||
ret = g_malloc (len + 1);
|
||||
for (i = 0; i < len; i++)
|
||||
ret [i] = g_ascii_toupper (str [i]);
|
||||
ret [i] = (guchar) g_ascii_toupper (str [i]);
|
||||
ret [i] = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
g_ascii_charcmp (char c1, char c2)
|
||||
{
|
||||
// Do not subtract, to avoid overflow.
|
||||
// Use unsigned to mimic strcmp, and so
|
||||
// shorter strings compare as less.
|
||||
|
||||
const guchar u1 = (guchar)c1;
|
||||
const guchar u2 = (guchar)c2;
|
||||
return (u1 < u2) ? -1 : (u1 > u2) ? 1 : 0;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
g_ascii_charcasecmp (char c1, char c2)
|
||||
{
|
||||
return g_ascii_charcmp (g_ascii_tolower (c1), g_ascii_tolower (c2));
|
||||
}
|
||||
|
||||
gint
|
||||
g_ascii_strncasecmp (const gchar *s1, const gchar *s2, gsize n)
|
||||
{
|
||||
// Unlike strncmp etc. this function does not stop at nul,
|
||||
// unless there is a mismatch.
|
||||
|
||||
if (s1 == s2)
|
||||
return 0;
|
||||
|
||||
gsize i;
|
||||
|
||||
|
||||
g_return_val_if_fail (s1 != NULL, 0);
|
||||
g_return_val_if_fail (s2 != NULL, 0);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
const int j = g_ascii_charcasecmp (*s1++, *s2++);
|
||||
if (j)
|
||||
return j;
|
||||
gchar c1 = g_ascii_tolower (*s1++);
|
||||
gchar c2 = g_ascii_tolower (*s2++);
|
||||
|
||||
if (c1 != c2)
|
||||
return c1 - c2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -906,71 +862,44 @@ g_ascii_strncasecmp (const gchar *s1, const gchar *s2, gsize n)
|
||||
gint
|
||||
g_ascii_strcasecmp (const gchar *s1, const gchar *s2)
|
||||
{
|
||||
if (s1 == s2)
|
||||
return 0;
|
||||
|
||||
const char *sp1 = s1;
|
||||
const char *sp2 = s2;
|
||||
|
||||
g_return_val_if_fail (s1 != NULL, 0);
|
||||
g_return_val_if_fail (s2 != NULL, 0);
|
||||
|
||||
char c1;
|
||||
|
||||
while ((c1 = *s1)) {
|
||||
++s1;
|
||||
const int j = g_ascii_charcasecmp (c1, *s2++);
|
||||
if (j)
|
||||
return j;
|
||||
|
||||
while (*sp1 != '\0') {
|
||||
char c1 = g_ascii_tolower (*sp1++);
|
||||
char c2 = g_ascii_tolower (*sp2++);
|
||||
|
||||
if (c1 != c2)
|
||||
return c1 - c2;
|
||||
}
|
||||
|
||||
return g_ascii_charcmp (0, *s2);
|
||||
|
||||
return (*sp1) - (*sp2);
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_utf16_ascii_equal (const gunichar2 *utf16, size_t ulen, const char *ascii, size_t alen)
|
||||
{
|
||||
size_t i;
|
||||
if (ulen != alen)
|
||||
return FALSE;
|
||||
for (i = 0; i < ulen; ++i) {
|
||||
if (utf16[i] != ascii[i])
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_utf16_asciiz_equal (const gunichar2 *utf16, const char *ascii)
|
||||
// z for zero means null terminated
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
char a = *ascii++;
|
||||
gunichar2 u = *utf16++;
|
||||
if (a != u)
|
||||
return FALSE;
|
||||
if (a == 0)
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
g_strdelimit (gchar *string, gchar delimiter, gchar new_delimiter)
|
||||
gchar *
|
||||
g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter)
|
||||
{
|
||||
gchar *ptr;
|
||||
|
||||
g_return_if_fail (string != NULL);
|
||||
g_return_val_if_fail (string != NULL, NULL);
|
||||
|
||||
if (delimiters == NULL)
|
||||
delimiters = G_STR_DELIMITERS;
|
||||
|
||||
for (ptr = string; *ptr; ptr++) {
|
||||
if (delimiter == *ptr)
|
||||
if (strchr (delimiters, *ptr))
|
||||
*ptr = new_delimiter;
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
gsize
|
||||
g_strlcpy (gchar *dest, const gchar *src, gsize dest_size)
|
||||
{
|
||||
g_assert (src);
|
||||
g_assert (dest);
|
||||
|
||||
#ifdef HAVE_STRLCPY
|
||||
return strlcpy (dest, src, dest_size);
|
||||
#else
|
||||
@@ -978,6 +907,9 @@ g_strlcpy (gchar *dest, const gchar *src, gsize dest_size)
|
||||
const gchar *s;
|
||||
gchar c;
|
||||
gsize len;
|
||||
|
||||
g_return_val_if_fail (src != NULL, 0);
|
||||
g_return_val_if_fail (dest != NULL, 0);
|
||||
|
||||
len = dest_size;
|
||||
if (len == 0)
|
||||
@@ -1094,56 +1026,3 @@ g_strnfill (gsize length, gchar fill_char)
|
||||
ret [length] = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t
|
||||
g_utf16_len (const gunichar2 *a)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
return wcslen (a);
|
||||
#else
|
||||
size_t length = 0;
|
||||
while (a [length])
|
||||
++length;
|
||||
return length;
|
||||
#endif
|
||||
}
|
||||
|
||||
gsize
|
||||
g_strnlen (const char* s, gsize n)
|
||||
{
|
||||
gsize i;
|
||||
for (i = 0; i < n && s [i]; ++i) ;
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a chunk of data from the file pointed to by the
|
||||
* @fd starting at the file offset @offset for @size bytes
|
||||
* and returns an allocated version of that string, or NULL
|
||||
* on error.
|
||||
*/
|
||||
char *
|
||||
g_str_from_file_region (int fd, guint64 offset, gsize size)
|
||||
{
|
||||
char *buffer;
|
||||
off_t loc;
|
||||
int status;
|
||||
|
||||
do {
|
||||
loc = lseek (fd, offset, SEEK_SET);
|
||||
} while (loc == -1 && errno == EINTR);
|
||||
if (loc == -1)
|
||||
return NULL;
|
||||
buffer = (char *)g_malloc (size + 1);
|
||||
if (buffer == NULL)
|
||||
return NULL;
|
||||
buffer [size] = 0;
|
||||
do {
|
||||
status = read (fd, buffer, size);
|
||||
} while (status == -1 && errno == EINTR);
|
||||
if (status == -1){
|
||||
g_free (buffer);
|
||||
return NULL;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
@@ -26,7 +26,6 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
|
||||
@@ -147,6 +146,41 @@ g_string_append_unichar (GString *string, gunichar c)
|
||||
return g_string_append_len (string, utf8, len);
|
||||
}
|
||||
|
||||
GString *
|
||||
g_string_prepend (GString *string, const gchar *val)
|
||||
{
|
||||
gssize len;
|
||||
|
||||
g_return_val_if_fail (string != NULL, string);
|
||||
g_return_val_if_fail (val != NULL, string);
|
||||
|
||||
len = strlen (val);
|
||||
|
||||
GROW_IF_NECESSARY(string, len);
|
||||
memmove(string->str + len, string->str, string->len + 1);
|
||||
memcpy(string->str, val, len);
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
GString *
|
||||
g_string_insert (GString *string, gssize pos, const gchar *val)
|
||||
{
|
||||
gssize len;
|
||||
|
||||
g_return_val_if_fail (string != NULL, string);
|
||||
g_return_val_if_fail (val != NULL, string);
|
||||
g_return_val_if_fail (pos <= string->len, string);
|
||||
|
||||
len = strlen (val);
|
||||
|
||||
GROW_IF_NECESSARY(string, len);
|
||||
memmove(string->str + pos + len, string->str + pos, string->len - pos - len + 1);
|
||||
memcpy(string->str + pos, val, len);
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
void
|
||||
g_string_append_printf (GString *string, const gchar *format, ...)
|
||||
{
|
||||
@@ -220,3 +254,23 @@ g_string_set_size (GString *string, gsize len)
|
||||
string->str[len] = 0;
|
||||
return string;
|
||||
}
|
||||
|
||||
GString *
|
||||
g_string_erase (GString *string, gssize pos, gssize len)
|
||||
{
|
||||
g_return_val_if_fail (string != NULL, string);
|
||||
|
||||
/* Silent return */
|
||||
if (pos >= string->len)
|
||||
return string;
|
||||
|
||||
if (len == -1 || (pos + len) >= string->len) {
|
||||
string->str[pos] = 0;
|
||||
}
|
||||
else {
|
||||
memmove (string->str + pos, string->str + pos + len, string->len - (pos + len) + 1);
|
||||
string->len -= len;
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
@@ -25,7 +25,6 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <glib.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
Loaded 100 of 10569 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user