TYPEDEF-IF: and USE-IF: words; ptrdiff_t C type moved to alien.c-types and special-cased for win64
parent
606b0be95b
commit
4044cd293a
|
@ -358,4 +358,7 @@ M: long-long-type box-return ( type -- )
|
||||||
"ushort*" define-primitive-type
|
"ushort*" define-primitive-type
|
||||||
|
|
||||||
[ string>u16-alien ] "ushort*" c-type set-c-type-prep
|
[ string>u16-alien ] "ushort*" c-type set-c-type-prep
|
||||||
|
|
||||||
|
win64? "longlong" "long" ? "ptrdiff_t" typedef
|
||||||
|
|
||||||
] with-compilation-unit
|
] with-compilation-unit
|
||||||
|
|
|
@ -49,8 +49,14 @@ $nl
|
||||||
|
|
||||||
HELP: TYPEDEF:
|
HELP: TYPEDEF:
|
||||||
{ $syntax "TYPEDEF: old new" }
|
{ $syntax "TYPEDEF: old new" }
|
||||||
{ $values { "old" "a C type" } { "new" "a C type" } }
|
{ $values { "word" "a word with stack effect " { $snippet "( -- ? )" } } { "old" "a C type" } { "new" "a C type" } }
|
||||||
{ $description "Alises the C type " { $snippet "old" } " under the name " { $snippet "new" } "." }
|
{ $description "Alises the C type " { $snippet "old" } " under the name " { $snippet "new" } " if ." }
|
||||||
|
{ $notes "This word differs from " { $link typedef } " in that it runs at parse time, to ensure correct ordering of operations when loading source files. Words defined in source files are compiled before top-level forms are run, so if a source file defines C binding words and uses " { $link typedef } ", the type alias won't be available at compile time." } ;
|
||||||
|
|
||||||
|
HELP: TYPEDEF-IF:
|
||||||
|
{ $syntax "TYPEDEF-IF: word old new" }
|
||||||
|
{ $values { "word" "a word with stack effect " { $snippet "( -- ? )" } } { "old" "a C type" } { "new" "a C type" } }
|
||||||
|
{ $description "Alises the C type " { $snippet "old" } " under the name " { $snippet "new" } " if " { $snippet "word" } " evaluates to a true value." }
|
||||||
{ $notes "This word differs from " { $link typedef } " in that it runs at parse time, to ensure correct ordering of operations when loading source files. Words defined in source files are compiled before top-level forms are run, so if a source file defines C binding words and uses " { $link typedef } ", the type alias won't be available at compile time." } ;
|
{ $notes "This word differs from " { $link typedef } " in that it runs at parse time, to ensure correct ordering of operations when loading source files. Words defined in source files are compiled before top-level forms are run, so if a source file defines C binding words and uses " { $link typedef } ", the type alias won't be available at compile time." } ;
|
||||||
|
|
||||||
HELP: C-STRUCT:
|
HELP: C-STRUCT:
|
||||||
|
|
|
@ -46,6 +46,9 @@ PRIVATE>
|
||||||
: TYPEDEF:
|
: TYPEDEF:
|
||||||
scan scan typedef ; parsing
|
scan scan typedef ; parsing
|
||||||
|
|
||||||
|
: TYPEDEF-IF:
|
||||||
|
scan-word execute scan scan rot [ typedef ] [ 2drop ] if ; parsing
|
||||||
|
|
||||||
: C-STRUCT:
|
: C-STRUCT:
|
||||||
scan in get
|
scan in get
|
||||||
parse-definition
|
parse-definition
|
||||||
|
|
|
@ -363,6 +363,12 @@ HELP: USE:
|
||||||
{ $description "Adds a new vocabulary at the front of the search path. Subsequent word lookups by the parser will search this vocabulary first." }
|
{ $description "Adds a new vocabulary at the front of the search path. Subsequent word lookups by the parser will search this vocabulary first." }
|
||||||
{ $errors "Throws an error if the vocabulary does not exist." } ;
|
{ $errors "Throws an error if the vocabulary does not exist." } ;
|
||||||
|
|
||||||
|
HELP: USE-IF:
|
||||||
|
{ $syntax "USE-IF: word vocabulary" }
|
||||||
|
{ $values { "word" "a word with stack effect " { $snippet "( -- ? )" } } { "vocabulary" "a vocabulary name" } }
|
||||||
|
{ $description "Adds " { $snippet "vocabulary" } " at the front of the search path if " { $snippet "word" } " evaluates to a true value." }
|
||||||
|
{ $errors "Throws an error if the vocabulary does not exist." } ;
|
||||||
|
|
||||||
HELP: USING:
|
HELP: USING:
|
||||||
{ $syntax "USING: vocabularies... ;" }
|
{ $syntax "USING: vocabularies... ;" }
|
||||||
{ $values { "vocabularies" "a list of vocabulary names" } }
|
{ $values { "vocabularies" "a list of vocabulary names" } }
|
||||||
|
|
|
@ -46,6 +46,7 @@ IN: bootstrap.syntax
|
||||||
] define-syntax
|
] define-syntax
|
||||||
|
|
||||||
"USE:" [ scan use+ ] define-syntax
|
"USE:" [ scan use+ ] define-syntax
|
||||||
|
"USE-IF:" [ scan-word execute scan swap [ use+ ] [ drop ] if ] define-syntax
|
||||||
|
|
||||||
"USING:" [ ";" parse-tokens add-use ] define-syntax
|
"USING:" [ ";" parse-tokens add-use ] define-syntax
|
||||||
|
|
||||||
|
|
|
@ -1469,8 +1469,6 @@ GL-FUNCTION: void glWindowPos3sv ( GLshort* p ) ;
|
||||||
: GL_SRC2_ALPHA GL_SOURCE2_ALPHA ; inline
|
: GL_SRC2_ALPHA GL_SOURCE2_ALPHA ; inline
|
||||||
: GL_SRC2_RGB GL_SOURCE2_RGB ; inline
|
: GL_SRC2_RGB GL_SOURCE2_RGB ; inline
|
||||||
|
|
||||||
TYPEDEF: long ptrdiff_t
|
|
||||||
|
|
||||||
TYPEDEF: ptrdiff_t GLsizeiptr
|
TYPEDEF: ptrdiff_t GLsizeiptr
|
||||||
TYPEDEF: ptrdiff_t GLintptr
|
TYPEDEF: ptrdiff_t GLintptr
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,4 @@ USING: alien.syntax kernel syntax words ;
|
||||||
|
|
||||||
IN: opengl.gl.unix
|
IN: opengl.gl.unix
|
||||||
|
|
||||||
: GL-FUNCTION: \ FUNCTION: word-def call ; parsing
|
: GL-FUNCTION: POSTPONE: FUNCTION: ; parsing
|
||||||
|
|
Loading…
Reference in New Issue