Skip to content

Commit

Permalink
[Unix] Convert System.Console
Browse files Browse the repository at this point in the history
  • Loading branch information
elinor-fung committed May 19, 2021
1 parent cce2b43 commit 74dc0e2
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal static partial class Interop
{
internal static partial class Sys
{
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Close", SetLastError = true)]
internal static extern int Close(IntPtr fd);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Close", SetLastError = true)]
internal static partial int Close(IntPtr fd);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal static partial class Interop
{
internal static partial class Sys
{
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Dup", SetLastError = true)]
internal static extern SafeFileHandle Dup(SafeFileHandle oldfd);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Dup", SetLastError = true)]
internal static partial SafeFileHandle Dup(SafeFileHandle oldfd);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ internal enum LockOperations : int
LOCK_UN = 8, /* unlock */
}

[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FLock", SetLastError = true)]
internal static extern int FLock(SafeFileHandle fd, LockOperations operation);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FLock", SetLastError = true)]
internal static partial int FLock(SafeFileHandle fd, LockOperations operation);

/// <summary>
/// Exposing this for SafeFileHandle.ReleaseHandle() to call.
/// Normal callers should use FLock(SafeFileHandle fd).
/// </summary>
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FLock", SetLastError = true)]
internal static extern int FLock(IntPtr fd, LockOperations operation);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FLock", SetLastError = true)]
internal static partial int FLock(IntPtr fd, LockOperations operation);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ internal static partial class Interop
{
internal static partial class Sys
{
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetControlCharacters")]
internal static extern void GetControlCharacters(
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetControlCharacters")]
internal static partial void GetControlCharacters(
ControlCharacterNames[] controlCharacterNames, byte[] controlCharacterValues, int controlCharacterLength,
out byte posixDisableValue);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ internal unsafe struct Passwd
internal byte* Shell;
}

[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPwUidR", SetLastError = false)]
internal static extern unsafe int GetPwUidR(uint uid, out Passwd pwd, byte* buf, int bufLen);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPwUidR", SetLastError = false)]
internal static unsafe partial int GetPwUidR(uint uid, out Passwd pwd, byte* buf, int bufLen);

[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPwNamR", SetLastError = false)]
internal static extern unsafe int GetPwNamR(string name, out Passwd pwd, byte* buf, int bufLen);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPwNamR", SetLastError = false, CharSet = CharSet.Ansi)]
internal static unsafe partial int GetPwNamR(string name, out Passwd pwd, byte* buf, int bufLen);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal struct WinSize
internal ushort YPixel;
};

[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetWindowSize", SetLastError = true)]
internal static extern int GetWindowSize(out WinSize winSize);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetWindowSize", SetLastError = true)]
internal static partial int GetWindowSize(out WinSize winSize);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ internal static partial class Interop
{
internal static partial class Sys
{
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_InitializeTerminalAndSignalHandling", SetLastError = true)]
internal static extern bool InitializeTerminalAndSignalHandling();
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_InitializeTerminalAndSignalHandling", SetLastError = true)]
internal static partial bool InitializeTerminalAndSignalHandling();

[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SetKeypadXmit")]
internal static extern void SetKeypadXmit(string terminfoString);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SetKeypadXmit", CharSet = CharSet.Ansi)]
internal static partial void SetKeypadXmit(string terminfoString);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal static partial class Interop
{
internal static partial class Sys
{
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_IsATty", SetLastError = true)]
internal static extern bool IsATty(SafeFileHandle fd);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_IsATty", SetLastError = true)]
internal static partial bool IsATty(SafeFileHandle fd);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal enum SeekWhence
SEEK_END = 2
}

[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LSeek", SetLastError = true)]
internal static extern long LSeek(SafeFileHandle fd, long offset, SeekWhence whence);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LSeek", SetLastError = true)]
internal static partial long LSeek(SafeFileHandle fd, long offset, SeekWhence whence);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal static partial class Interop
{
internal static partial class Sys
{
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Open", SetLastError = true)]
internal static extern SafeFileHandle Open(string filename, OpenFlags flags, int mode);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Open", SetLastError = true, CharSet = CharSet.Ansi)]
internal static partial SafeFileHandle Open(string filename, OpenFlags flags, int mode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal static partial class Sys
/// Returns the number of bytes read on success; otherwise, -1 is returned
/// Note - on fail. the position of the stream may change depending on the platform; consult man 2 read for more info
/// </returns>
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Read", SetLastError = true)]
internal static extern unsafe int Read(SafeHandle fd, byte* buffer, int count);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Read", SetLastError = true)]
internal static unsafe partial int Read(SafeHandle fd, byte* buffer, int count);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ internal static partial class Interop
{
internal static partial class Sys
{
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ReadStdin", SetLastError = true)]
internal static extern unsafe int ReadStdin(byte* buffer, int bufferSize);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ReadStdin", SetLastError = true)]
internal static unsafe partial int ReadStdin(byte* buffer, int bufferSize);

[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_InitializeConsoleBeforeRead")]
internal static extern void InitializeConsoleBeforeRead(byte minChars = 1, byte decisecondsTimeout = 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ internal static partial class Sys
/// success; if the return value is equal to the size then the result may have been truncated.
/// On failure, returns a negative value.
/// </returns>
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SNPrintF", SetLastError = true)]
internal static extern unsafe int SNPrintF(byte* str, int size, string format, string arg1);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SNPrintF", SetLastError = true, CharSet = CharSet.Ansi)]
internal static unsafe partial int SNPrintF(byte* str, int size, string format, string arg1);

/// <summary>
/// Takes a string and applies a formatting to it to transform
Expand All @@ -47,7 +47,7 @@ internal static partial class Sys
/// success; if the return value is equal to the size then the result may have been truncated.
/// On failure, returns a negative value.
/// </returns>
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SNPrintF", SetLastError = true)]
internal static extern unsafe int SNPrintF(byte* str, int size, string format, int arg1);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SNPrintF", SetLastError = true, CharSet = CharSet.Ansi)]
internal static unsafe partial int SNPrintF(byte* str, int size, string format, int arg1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal static partial class Interop
{
internal static partial class Sys
{
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_StdinReady")]
internal static extern bool StdinReady();
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_StdinReady")]
internal static partial bool StdinReady();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ internal static partial class Sys
/// <returns>
/// Returns the number of bytes written on success; otherwise, returns -1 and sets errno
/// </returns>
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Write", SetLastError = true)]
internal static extern unsafe int Write(SafeHandle fd, byte* buffer, int bufferSize);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Write", SetLastError = true)]
internal static unsafe partial int Write(SafeHandle fd, byte* buffer, int bufferSize);

[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Write", SetLastError = true)]
internal static extern unsafe int Write(IntPtr fd, byte* buffer, int bufferSize);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Write", SetLastError = true)]
internal static unsafe partial int Write(IntPtr fd, byte* buffer, int bufferSize);
}
}

0 comments on commit 74dc0e2

Please sign in to comment.