-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
632 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Documentation: https://github.com/JuliaCI/Appveyor.jl | ||
environment: | ||
matrix: | ||
- julia_version: 1.0 | ||
- julia_version: 1.5 | ||
- julia_version: nightly | ||
platform: | ||
- x64 | ||
- x86 | ||
cache: | ||
- '%USERPROFILE%\.julia\artifacts' | ||
matrix: | ||
allow_failures: | ||
- julia_version: nightly | ||
branches: | ||
only: | ||
- master | ||
- /release-.*/ | ||
notifications: | ||
- provider: Email | ||
on_build_success: false | ||
on_build_failure: false | ||
on_build_status_changed: false | ||
install: | ||
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1")) | ||
build_script: | ||
- echo "%JL_BUILD_SCRIPT%" | ||
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%" | ||
test_script: | ||
- echo "%JL_TEST_SCRIPT%" | ||
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Documentation | ||
on: | ||
- push | ||
- pull_request | ||
jobs: | ||
docs: | ||
name: Documentation | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: '1' | ||
- run: | | ||
julia --project=docs -e ' | ||
using Pkg | ||
Pkg.develop(PackageSpec(path=pwd())) | ||
Pkg.instantiate()' | ||
- run: julia --project=docs docs/make.jl | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Documentation: http://docs.travis-ci.com/user/languages/julia | ||
language: julia | ||
notifications: | ||
email: false | ||
julia: | ||
- 1.0 | ||
- 1.5 | ||
- nightly | ||
os: | ||
- linux | ||
- osx | ||
- windows | ||
arch: | ||
- x64 | ||
cache: | ||
directories: | ||
- ~/.julia/artifacts | ||
jobs: | ||
fast_finish: true | ||
allow_failures: | ||
- julia: nightly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,53 @@ | ||
# WinTypes | ||
|
||
This package defines aliases to [Windows Data types](https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types). | ||
|
||
|
||
## Why? | ||
|
||
This makes it easier to translate Windows function from MSDN documentation and | ||
increases readability. | ||
|
||
Here's an example comparing calling Windows API functions with and without `WinTypes`: | ||
|
||
With `WinTypes` a Windows API call would look something like: | ||
```julia | ||
using WinTypes: HANDLE, DWORD, BOOL | ||
|
||
function get_console_mode() | ||
STD_OUTPUT_HANDLE = -11 | ||
hOutput = ccall(:GetStdHandle, stdcall, HANDLE, (DWORD,), STD_OUTPUT_HANDLE % DWORD) | ||
dwMode = Ref{DWORD}() | ||
ccall(:GetConsoleMode, stdcall, BOOL, (HANDLE, Ref{DWORD}), hOutput, dwMode) | ||
return dwMode[] | ||
end | ||
``` | ||
Now, compare this to the call without this package: | ||
```julia | ||
|
||
function get_console_mode() | ||
STD_OUTPUT_HANDLE = -11 | ||
hOutput = ccall(:GetStdHandle, stdcall, Ptr{Cvoid}, (UInt32,), STD_OUTPUT_HANDLE % UInt32) | ||
dwMode = Ref{UInt32}() | ||
ccall(:GetConsoleMode, stdcall, Int32, (Ref{Cvoid}, Ref{UInt32}), hOutput, dwMode) | ||
return dwMode[] | ||
end | ||
``` | ||
|
||
Finally, here are the corresponding Windows API function syntax definitions in `C`: | ||
|
||
``` | ||
HANDLE WINAPI GetStdHandle( | ||
_In_ DWORD nStdHandle | ||
); | ||
``` | ||
|
||
``` | ||
BOOL WINAPI GetConsoleMode( | ||
_In_ HANDLE hConsoleHandle, | ||
_Out_ LPDWORD lpMode | ||
); | ||
``` | ||
|
||
As you can see, the call to these APIs using `WinTypes` is easier to translate and | ||
directly translatable without manually looking up the myriad Windows data types. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
WinTypes = "7ce832dc-6953-4c0f-9163-51fbd0dcbc24" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using WinTypes | ||
using Documenter | ||
|
||
makedocs(; | ||
modules=[WinTypes], | ||
authors="Mustafa Mohamad <[email protected]> and contributors", | ||
repo="https://github.com/musm/WinTypes.jl/blob/{commit}{path}#L{line}", | ||
sitename="WinTypes.jl", | ||
format=Documenter.HTML(; | ||
prettyurls=get(ENV, "CI", "false") == "true", | ||
canonical="https://musm.github.io/WinTypes.jl", | ||
assets=String[], | ||
), | ||
pages=[ | ||
"Home" => "index.md", | ||
], | ||
) | ||
|
||
deploydocs(; | ||
repo="github.com/musm/WinTypes.jl.git", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
```@meta | ||
CurrentModule = WinTypes | ||
``` | ||
|
||
# WinTypes | ||
|
||
## Usage | ||
|
||
First install the package: | ||
```julia | ||
]add WinTypes | ||
``` | ||
|
||
Here's an example comparing calling Windows API functions with and without `WinTypes`: | ||
|
||
With `WinTypes` a Windows API call would look something like: | ||
```julia | ||
using WinTypes: HANDLE, DWORD, BOOL | ||
|
||
function get_console_mode() | ||
STD_OUTPUT_HANDLE = -11 | ||
hOutput = ccall(:GetStdHandle, stdcall, HANDLE, (DWORD,), STD_OUTPUT_HANDLE % DWORD) | ||
dwMode = Ref{DWORD}() | ||
ccall(:GetConsoleMode, stdcall, BOOL, (HANDLE, Ref{DWORD}), hOutput, dwMode) | ||
return dwMode[] | ||
end | ||
``` | ||
Now, compare this to the call without this package: | ||
```julia | ||
|
||
function get_console_mode() | ||
STD_OUTPUT_HANDLE = -11 | ||
hOutput = ccall(:GetStdHandle, stdcall, Ptr{Cvoid}, (UInt32,), STD_OUTPUT_HANDLE % UInt32) | ||
dwMode = Ref{UInt32}() | ||
ccall(:GetConsoleMode, stdcall, Int32, (Ref{Cvoid}, Ref{UInt32}), hOutput, dwMode) | ||
return dwMode[] | ||
end | ||
``` | ||
|
||
Finally, here are the corresponding Windows API function syntax definitions in `C`: | ||
|
||
``` | ||
HANDLE WINAPI GetStdHandle( | ||
_In_ DWORD nStdHandle | ||
); | ||
``` | ||
|
||
``` | ||
BOOL WINAPI GetConsoleMode( | ||
_In_ HANDLE hConsoleHandle, | ||
_Out_ LPDWORD lpMode | ||
); | ||
``` | ||
|
||
As you can see, the call to these APIs using `WinTypes` is easier to translate and | ||
directly translatable without manually looking up the myriad Windows data types. | ||
|
||
|
||
## Alias List | ||
|
||
The following aliases are defined: | ||
``` | ||
FALSE = Cint(0) | ||
TRUE = Cint(1) | ||
BOOL = Cint | ||
BOOLEAN = BYTE | ||
BYTE = Cuchar | ||
CCHAR = Cchar | ||
CHAR = Cchar | ||
COLORREF = DWORD | ||
DWORD = Culong | ||
DWORDLONG = UInt64 | ||
DWORD32 = UInt32 | ||
DWORD64 = UInt64 | ||
FLOAT = Cfloat | ||
HACCEL = HANDLE | ||
HANDLE = Ptr{Cvoid} | ||
HBITMAP = HANDLE | ||
HBRUSH = HANDLE | ||
HCOLORSPACE = HANDLE | ||
HCONV = HANDLE | ||
HCONVLIST = HANDLE | ||
HCURSOR = HICON | ||
HDC = HANDLE | ||
HDDEDATA = HANDLE | ||
HDESK = HANDLE | ||
HDROP = HANDLE | ||
HDWP = HANDLE | ||
HENHMETAFILE = HANDLE | ||
HFILE = Cint | ||
HFONT = HANDLE | ||
HGDIOBJ = HANDLE | ||
HGLOBAL = HANDLE | ||
HHOOK = HANDLE | ||
HICON = HANDLE | ||
HINSTANCE = HANDLE | ||
HKEY = HANDLE | ||
HKL = HANDLE | ||
HLOCAL = HANDLE | ||
HMENU = HANDLE | ||
HMETAFILE = HANDLE | ||
HMODULE = HANDLE | ||
HMONITOR = HANDLE | ||
HPALETTE = HANDLE | ||
HPEN = HANDLE | ||
HRESULT = Clong | ||
HRGN = HANDLE | ||
HRSRC = HANDLE | ||
HSZ = HANDLE | ||
HWINSTA = HANDLE | ||
HWND = HANDLE | ||
INT = Cint | ||
PHANDLE = Ptr{HANDLE} | ||
PVOID = Ptr{Cvoid} | ||
LPVOID = Ptr{Cvoid} | ||
SHORT = Cshort | ||
UCHAR = Cuchar | ||
USHORT = Cushort | ||
VOID = Cvoid | ||
WCHAR = Cwchar_t | ||
WORD = Cushort | ||
PWCHAR = Ptr{WCHAR} | ||
PWORD = Ptr{WORD} | ||
LPWORD = Ptr{WORD} | ||
PDWORD = Ptr{DWORD} | ||
LPDWORD = Ptr{DWORD} | ||
PSTR = Ptr{CHAR} # char* | ||
LPSTR = Ptr{CHAR} # char* | ||
PCSTR = Ptr{CHAR} # char* | ||
LPCSTR = Ptr{CHAR} # char* | ||
PWSTR = Ptr{WCHAR} # wchar_t* | ||
LPWSTR = Ptr{WCHAR} # wchar_t* | ||
PCWSTR = Ptr{WCHAR} # wchar_t* | ||
LPCWSTR = Ptr{WCHAR} # const wchar_t* | ||
``` | ||
|
||
|
||
# Detailed References | ||
|
||
Below we include detailed documentation for some of the aliases defined in this package. | ||
We refer to | ||
[https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types](https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types) | ||
for those not included below. | ||
|
||
```@autodocs | ||
Modules = [WinTypes] | ||
``` |
Oops, something went wrong.