Skip to content

Commit

Permalink
SDL2: Convert a bunch of MediaWiki tables to Markdown format.
Browse files Browse the repository at this point in the history
This is the perl script that did it:

```perl

use warnings;
use strict;

while (<>) {
    chomp;
    print("$_\n"), next if not /\A\{\|/;
    #next if not /\A\{\|/;

    # Convert mediawiki table...
    my $row = 0;
    my $col = 0;
    my @A = ();
    while (<>) {
        chomp;
        my $l = $_;
        if (/\A\|\-/) {
            $row++;
            $col = 0;
        } elsif (/\A\|\}/) {
            $row++;
            last;
        } else {
            $l =~ s/\A\|//;
            #print("\$a[$row][$col] = '$l'\n");
            push @A, $l;
            $col++;
        }
    }

    #print("------row=$row, col=$col\n\n\n");

    my @lengths = ();
    for (my $c = 0; $c < $col; $c++) {
        my $len = 0;
        for (my $r = 0; $r < $row; $r++) {
            my $str = $a[($r * $col) + $c];
            my $slen = length($str);
            $len = $slen if ($slen > $len);
        }

        push @lengths, $len;
    }

    print('|');
    for (my $c = 0; $c < $col; $c++) {
        print(' ' x ($lengths[$c] + 1));
        print(' |');
    }

    print("\n");
    print('|');
    for (my $c = 0; $c < $col; $c++) {
        print(' ');
        print('-' x $lengths[$c]);
        print(' |');
    }

    for (my $r = 0; $r < $row; $r++) {
        print("\n");
        print('|');
        for (my $c = 0; $c < $col; $c++) {
            my $str = $a[($r * $col) + $c];
            print(' ' . substr($str . ' ' x $lengths[$c], 0, $lengths[$c]));
            print(' |');
        }
    }

    print("\n");
}
```

...then this shell one-liner to run that perl on each file...

```bash
for x in *.md ; do echo $x ... ;  ../cvttab.pl <$x >$x.tmp ; mv $x.tmp $x ; done
```
  • Loading branch information
icculus committed Apr 23, 2024
1 parent 3db1c4b commit 7e2ddfc
Show file tree
Hide file tree
Showing 54 changed files with 510 additions and 1,660 deletions.
23 changes: 6 additions & 17 deletions SDL2/SDL_AudioDeviceEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,12 @@ typedef struct SDL_AudioDeviceEvent

## Data Fields

{|
|Uint32
|'''type'''
|SDL_AUDIODEVICEADDED, or SDL_AUDIODEVICEREMOVED
|-
|Uint32
|'''timestamp'''
|the timestamp of the event
|-
|Uint32
|'''which'''
|the audio device index for the SDL_AUDIODEVICEADDED event (valid until next [SDL_GetNumAudioDevices](SDL_GetNumAudioDevices)() call), SDL_AudioDeviceID for the SDL_AUDIODEVICEREMOVED event
|-
|Uint8
|'''iscapture'''
|zero if an audio output device, non-zero if an audio capture device
|}
| | | |
| ------ | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Uint32 | '''type''' | SDL_AUDIODEVICEADDED, or SDL_AUDIODEVICEREMOVED |
| Uint32 | '''timestamp''' | the timestamp of the event |
| Uint32 | '''which''' | the audio device index for the SDL_AUDIODEVICEADDED event (valid until next [SDL_GetNumAudioDevices](SDL_GetNumAudioDevices)() call), SDL_AudioDeviceID for the SDL_AUDIODEVICEREMOVED event |
| Uint8 | '''iscapture''' | zero if an audio output device, non-zero if an audio capture device |

## Related Enumerations

Expand Down
43 changes: 10 additions & 33 deletions SDL2/SDL_AudioSpec.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,39 +50,16 @@ dev = SDL_OpenAudioDevice(NULL, 0, &want, &have, SDL_AUDIO_ALLOW_FORMAT_CHANGE);
## Data Fields
{|
|int
|'''freq'''
|DSP frequency (samples per second); see Remarks for details
|-
|[SDL_AudioFormat](SDL_AudioFormat)
|'''format'''
|audio data format; see Remarks for details
|-
|Uint8
|'''channels'''
|number of separate sound channels: see Remarks for details
|-
|Uint8
|'''silence'''
|audio buffer silence value (calculated)
|-
|Uint16
|'''samples'''
|audio buffer size in samples (power of 2); see Remarks for details
|-
|Uint32
|'''size'''
|audio buffer size in bytes (calculated)
|-
|SDL_AudioCallback
|'''callback'''
|the function to call when the audio device needs more data; see Remarks for details
|-
|void*
|'''userdata'''
|a pointer that is passed to '''callback''' (otherwise ignored by SDL)
|}
| | | |
| ---------------------------------- | -------------- | ----------------------------------------------------------------------------------- |
| int | '''freq''' | DSP frequency (samples per second); see Remarks for details |
| [SDL_AudioFormat](SDL_AudioFormat) | '''format''' | audio data format; see Remarks for details |
| Uint8 | '''channels''' | number of separate sound channels: see Remarks for details |
| Uint8 | '''silence''' | audio buffer silence value (calculated) |
| Uint16 | '''samples''' | audio buffer size in samples (power of 2); see Remarks for details |
| Uint32 | '''size''' | audio buffer size in bytes (calculated) |
| SDL_AudioCallback | '''callback''' | the function to call when the audio device needs more data; see Remarks for details |
| void* | '''userdata''' | a pointer that is passed to '''callback''' (otherwise ignored by SDL) |
----
[CategoryAPI](CategoryAPI), [CategoryAPIStruct](CategoryAPIStruct), [CategoryStruct](CategoryStruct), [CategoryAudio](CategoryAudio)
Expand Down
23 changes: 6 additions & 17 deletions SDL2/SDL_Color.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,12 @@ typedef struct SDL_Color

## Data Fields

{|
|Uint8
|'''r'''
|the red component in the range 0-255
|-
|Uint8
|'''g'''
|the green component in the range 0-255
|-
|Uint8
|'''b'''
|the blue component in the range 0-255
|-
|Uint8
|'''a'''
|the alpha component in the range 0-255
|}
| | | |
| ----- | ------- | -------------------------------------- |
| Uint8 | '''r''' | the red component in the range 0-255 |
| Uint8 | '''g''' | the green component in the range 0-255 |
| Uint8 | '''b''' | the blue component in the range 0-255 |
| Uint8 | '''a''' | the alpha component in the range 0-255 |

## Related Structures

Expand Down
28 changes: 7 additions & 21 deletions SDL2/SDL_ControllerAxisEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,13 @@ typedef struct SDL_ControllerAxisEvent

## Data Fields

{|
|Uint32
|'''type'''
|SDL_CONTROLLERAXISMOTION
|-
|Uint32
|'''timestamp'''
|the timestamp of the event
|-
|SDL_JoystickID
|'''which'''
|the joystick instance id
|-
|Uint8
|'''axis'''
|the controller axis ([SDL_GameControllerAxis](SDL_GameControllerAxis))
|-
|Sint16
|'''value'''
|the axis value (range: -32768 to 32767)
|}
| | | |
| -------------- | --------------- | ---------------------------------------------------------------------- |
| Uint32 | '''type''' | SDL_CONTROLLERAXISMOTION |
| Uint32 | '''timestamp''' | the timestamp of the event |
| SDL_JoystickID | '''which''' | the joystick instance id |
| Uint8 | '''axis''' | the controller axis ([SDL_GameControllerAxis](SDL_GameControllerAxis)) |
| Sint16 | '''value''' | the axis value (range: -32768 to 32767) |

## Related Enumerations

Expand Down
28 changes: 7 additions & 21 deletions SDL2/SDL_ControllerButtonEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,13 @@ typedef struct SDL_ControllerButtonEvent

## Data Fields

{|
|Uint32
|'''type'''
|SDL_CONTROLLERBUTTONDOWN or SDL_CONTROLLERBUTTONUP
|-
|Uint32
|'''timestamp'''
|the timestamp of the event
|-
|SDL_JoystickID
|'''which'''
|the joystick instance id
|-
|Uint8
|'''button'''
|the controller button ([SDL_GameControllerButton](SDL_GameControllerButton))
|-
|Uint8
|'''state'''
|SDL_PRESSED or SDL_RELEASED
|}
| | | |
| -------------- | --------------- | ---------------------------------------------------------------------------- |
| Uint32 | '''type''' | SDL_CONTROLLERBUTTONDOWN or SDL_CONTROLLERBUTTONUP |
| Uint32 | '''timestamp''' | the timestamp of the event |
| SDL_JoystickID | '''which''' | the joystick instance id |
| Uint8 | '''button''' | the controller button ([SDL_GameControllerButton](SDL_GameControllerButton)) |
| Uint8 | '''state''' | SDL_PRESSED or SDL_RELEASED |

## Related Enumerations

Expand Down
18 changes: 5 additions & 13 deletions SDL2/SDL_ControllerDeviceEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,11 @@ typedef struct SDL_ControllerDeviceEvent

## Data Fields

{|
|Uint32
|'''type'''
|SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED or SDL_CONTROLLERDEVICEREMAPPED
|-
|Uint32
|'''timestamp'''
|the timestamp of the event
|-
|Sint32
|'''which'''
|the joystick device index for the SDL_CONTROLLERDEVICEADDED event or instance id for the SDL_CONTROLLERDEVICEREMOVED or SDL_CONTROLLERDEVICEREMAPPED event
|}
| | | |
| ------ | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Uint32 | '''type''' | SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED or SDL_CONTROLLERDEVICEREMAPPED |
| Uint32 | '''timestamp''' | the timestamp of the event |
| Sint32 | '''which''' | the joystick device index for the SDL_CONTROLLERDEVICEADDED event or instance id for the SDL_CONTROLLERDEVICEREMOVED or SDL_CONTROLLERDEVICEREMAPPED event |

## Related Enumerations

Expand Down
28 changes: 7 additions & 21 deletions SDL2/SDL_DisplayMode.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,27 +65,13 @@ for (i = 0; i < display_mode_count; ++i) {
## Data Fields
{|
|Uint32
|'''format'''
|one of the [SDL_PixelFormatEnum](SDL_PixelFormatEnum) values
|-
|int
|'''w'''
|width, in screen coordinates
|-
|int
|'''h'''
|height, in screen coordinates
|-
|int
|'''refresh_rate'''
|refresh rate (in Hz), or 0 for unspecified
|-
|void*
|'''driverdata'''
|driver-specific data, initialize to 0
|}
| | | |
| ------ | ------------------ | ------------------------------------------------------------ |
| Uint32 | '''format''' | one of the [SDL_PixelFormatEnum](SDL_PixelFormatEnum) values |
| int | '''w''' | width, in screen coordinates |
| int | '''h''' | height, in screen coordinates |
| int | '''refresh_rate''' | refresh rate (in Hz), or 0 for unspecified |
| void* | '''driverdata''' | driver-specific data, initialize to 0 |
----
[CategoryAPI](CategoryAPI), [CategoryAPIStruct](CategoryAPIStruct), [CategoryStruct](CategoryStruct), [CategoryVideo](CategoryVideo)
Expand Down
43 changes: 10 additions & 33 deletions SDL2/SDL_DollarGestureEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,16 @@ typedef struct SDL_DollarGestureEvent

## Data Fields

{|
|Uint32
|'''type'''
|SDL_DOLLARGESTURE or SDL_DOLLARRECORD
|-
|Uint32
|'''timestamp'''
|timestamp of the event
|-
|SDL_TouchID
|'''touchId'''
|the touch device id
|-
|SDL_GestureID
|'''gestureId'''
|the unique id of the closest gesture to the performed stroke
|-
|Uint32
|'''numFingers'''
|the number of fingers used to draw the stroke
|-
|float
|'''error'''
|the difference between the gesture template and the actual performed gesture (lower error is a better match)
|-
|float
|'''x'''
|the normalized center of gesture
|-
|float
|'''y'''
|the normalized center of gesture
|}
| | | |
| ------------- | ---------------- | ------------------------------------------------------------------------------------------------------------ |
| Uint32 | '''type''' | SDL_DOLLARGESTURE or SDL_DOLLARRECORD |
| Uint32 | '''timestamp''' | timestamp of the event |
| SDL_TouchID | '''touchId''' | the touch device id |
| SDL_GestureID | '''gestureId''' | the unique id of the closest gesture to the performed stroke |
| Uint32 | '''numFingers''' | the number of fingers used to draw the stroke |
| float | '''error''' | the difference between the gesture template and the actual performed gesture (lower error is a better match) |
| float | '''x''' | the normalized center of gesture |
| float | '''y''' | the normalized center of gesture |

<!-- <span style="color: green;">Worth changing touchId and gestureId to touchID and gestureID for consistency?</span> -->

Expand Down
23 changes: 6 additions & 17 deletions SDL2/SDL_DropEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,12 @@ int main(int argc, char *argv[]) {
## Data Fields
{|
|Uint32
|'''type'''
|the event type; SDL_DROPFILE, SDL_DROPTEXT, SDL_DROPBEGIN, or SDL_DROPCOMPLETE
|-
|Uint32
|'''timestamp'''
|timestamp of the event
|-
|char*
|'''file'''
|the file name, which should be freed with SDL_free(), is NULL on BEGIN/COMPLETE
|-
|Uint32
|'''windowID'''
|the window that was dropped on, if any
|}
| | | |
| ------ | --------------- | ------------------------------------------------------------------------------- |
| Uint32 | '''type''' | the event type; SDL_DROPFILE, SDL_DROPTEXT, SDL_DROPBEGIN, or SDL_DROPCOMPLETE |
| Uint32 | '''timestamp''' | timestamp of the event |
| char* | '''file''' | the file name, which should be freed with SDL_free(), is NULL on BEGIN/COMPLETE |
| Uint32 | '''windowID''' | the window that was dropped on, if any |
## Related Enumerations
Expand Down
Loading

0 comments on commit 7e2ddfc

Please sign in to comment.