{"size": 2059, "ext": "scrbl", "max_stars_repo_path": "configs/templates/structs.scrbl", "max_stars_repo_name": "eutro/racket-raylib", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "configs/templates/structs.scrbl", "max_issues_repo_name": "eutro/racket-raylib", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "configs/templates/structs.scrbl", "max_forks_repo_name": "eutro/racket-raylib", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.5972222222, "max_line_length": 80, "alphanum_fraction": 0.5599805731}
#lang scribble/text

@(require racket/match
          raylib/codegen/objects
          raylib/codegen/util
          "common.rkt")
@(provide generate-structs)

@(define (generate-structs
          structs-parsed
          typedefs-parsed
          function-typedefs-parsed
          #:module this-mod)

@list{
#lang scribble/manual

@"@"(require (for-label @|this-mod| raylib/support ffi/unsafe racket/base))

@"@"title{Structs}

@"@"table-of-contents[]

@"@"defmodule[@|this-mod|]
@"@"section{Struct types}
@(for/list ([struct-parsed (in-list structs-parsed)])
   (match-define (api-struct name desc fields) struct-parsed)
@list{
@(void)
@"@"deftogether[(@block{
                 @"@"defthing[_@|name| ctype?]
                 @"@"defstruct[@block{
                               @|name|
                               (@block{
@(add-newlines
  (for/list ([struct-field (in-list fields)])
    (match-define (api-field names _field-desc field-type) struct-field)
    (add-newlines
     #:sep " "
     (for/list ([name (in-list names)])
       (define-values (name* type) (parse-type name field-type))
       @list{[@|name*| @|type|]}))))})
                               #:constructor-name make-@|name|}]})]{
@|desc|
}
@(void)})
@"@"section{Type aliases}
@"@"deftogether[(@block{
                 @(add-newlines
                   (for/list ([typedef-parsed (in-list typedefs-parsed)])
                     (match-define (api-typedef name _desc type) typedef-parsed)
                     @list{@"@"defthing[_@|name| ctype? #:value _@|type|]}))})]{
Aliases for some struct types.
}

@"@"section{Callback function types}
@"@"deftogether[(@block{
@(add-newlines
  (for/list ([function-parsed (in-list function-typedefs-parsed)])
    (match-define (api-callback-typedef name _desc ret-type params)
      function-parsed)
    @list{
@"@"defthing[@block{
             _@|name| ctype?
             #:value
             (_fun
              @(generate-params params)
              -> @(parse-type* ret-type))}]}))})]{
Types for certain callback functions.
}
@(void)})
