Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove c/winapi and rename some windows types #5448

Merged
merged 1 commit into from Jan 2, 2018

Conversation

RX14
Copy link
Contributor

@RX14 RX14 commented Dec 24, 2017

winapi.cr used old and outdated conventions regarding the windows porting effort. It is deleted, and the definitions in it which are used are moved to files corresponding to the windows header they are defined in.

Some windows types are also renamed to retain their capitalisation from Microsoft's headers.

@RX14 RX14 mentioned this pull request Dec 24, 2017
22 tasks
winapi.cr used old and outdated conventions regarding the windows porting
effort. It is deleted, and the definitions in it which are used are moved to
files corresponding to the windows header they are defined in.

Some windows types are also renamed to retain their capitalisation from
Microsoft's headers.
@@ -0,0 +1,3 @@
lib LibC
alias LPSTR = Char*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it wise to alias LPSTR as a pointer to Char?

In WinNT.h it is declared as a pointer of CHAR which is a 1-byte character only.
Reading a pointer of Char from windows API shouldn't be any issue but it will fail if it is populated from Crystal with multibyte characters.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should probably better be

alias CHAR = UInt8
alias LPSTR = CHAR*

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Char is LibC::Char which is UInt8...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I missed that. Still, would it make sense to add an uppercase alias CHAR as in WinNT.h?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not duplicate all the existing libc constants just in upper case just for windows.

@RX14
Copy link
Contributor Author

RX14 commented Dec 30, 2017

Ping, this is a really tiny change that affects only windows, this should be simple to review.

@RX14 RX14 added this to the Next milestone Jan 2, 2018
@RX14 RX14 merged commit 78ccf91 into crystal-lang:master Jan 2, 2018
lukeasrodgers pushed a commit to lukeasrodgers/crystal that referenced this pull request Jan 7, 2018
winapi.cr used old and outdated conventions regarding the windows porting
effort. It is deleted, and the definitions in it which are used are moved to
files corresponding to the windows header they are defined in.

Some windows types are also renamed to retain their capitalisation from
Microsoft's headers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants