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

Refresh examples #384

Merged
merged 36 commits into from
Nov 5, 2022
Merged

Refresh examples #384

merged 36 commits into from
Nov 5, 2022

Conversation

plicease
Copy link
Member

@plicease plicease commented Oct 28, 2022

Big Example Refresh PR

This is for #383 but we will also hopefully touch on other documentation PRs as we work on this.

Order

  • The examples should be reordered from least to most complicated, finishing with a full dist example. Some of the examples are already appropriately placed, but some are totally wrong.
  • Integer example
  • String argument example
  • String return example (possibly more than one, owned, unowned, static, etc)
  • Pointers
  • Opaque (objects)
  • Opaques (malloc/free, buffers, strdup)
  • Arrays
  • Pointers as arrays
  • Unix GUI (libnotify)
  • Windows GUI (MessageBoxW)
  • FFI::C
  • Record
  • Buffers (FFI::Platypus::Buffer)
  • Window (FFI::Platypus::Buffer::window)
  • OO opaque (libarchive)
  • OO integer (unix open)
  • variadic functions (libcurl)
  • Callback
  • Bundle code

Format

  • New format: each example should include these sections (some are optional):
  1. C API (for external libraries) this can be a link to the appropriate documentation
  2. C Source (for bundled examples)
  3. Perl Source
  4. Execute
  5. Discussion

Pictures

  • GUI stuff should have images in the HTML. This should live in the Execute section. In think there are only two examples so far:
  • libnotify
  • MessageBoxW

Rework stuff removed in these refactors

Testing

  • examples should be easily tested
  • using prove
  • and CI
  • examples that cannot easily be tested in at least CI should be removed (possibly exception: GUI examples)

Unfortunately this removes examples that use the standard C library
so we have to build our own C code, but I think they are much stronger
than the examples in strtok (which is a bad function anyway), and
the integer.pl example which was highly contrived.
@plicease plicease marked this pull request as ready for review November 5, 2022 12:53
@plicease plicease merged commit fd70cc6 into main Nov 5, 2022
@plicease plicease deleted the graham/revisit-doco branch November 5, 2022 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant