Commit Graph

17245 Commits

Author SHA1 Message Date
SiZiOUS 8f85f41775 dreamcast_shelf build config: better handling for DreamSDK 2025-08-02 02:00:57 +02:00
SiZiOUS c8510fa5c6 dreamcast_shelf build config: renaming KOS_WRAPPERS to KOS_WRAPPERS_BASE 2025-08-01 00:43:42 +02:00
SiZiOUS 676af02024 dreamcast_shelf build config: minor fix for KOS_BASE check 2025-08-01 00:07:28 +02:00
SiZiOUS 55bcd35bed dreamcast_shelf build config: use KallistiOS wrappers
See: https://dreamcast.wiki/Using_Ruby_for_Sega_Dreamcast_development
2025-07-31 23:40:42 +02:00
SiZiOUS bfee6871aa dreamcast_shelf build config: updating file header 2025-07-31 22:12:54 +02:00
Yukihiro "Matz" Matsumoto 8e074f185b Merge pull request #6583 from buty4649/improve/build-config-file-detection 2025-07-30 19:14:43 +09:00
Yukihiro "Matz" Matsumoto e4fc7f36c4 Merge pull request #6591 from jbampton/patch-2 2025-07-29 10:35:02 +09:00
John Bampton e09893daa9 mruby-eval fix license link in README 2025-07-29 01:27:49 +10:00
Yukihiro "Matz" Matsumoto 2d054d5e91 Merge pull request #6588 from jbampton/add-codeql-for-actions 2025-07-27 18:23:11 +09:00
buty4649 b3038d4d49 refactor: use ternary operator for readability 2025-07-27 11:23:09 +09:00
John Bampton ab379e1229 Add CodeQL Analysis for GitHub Actions
https://docs.github.com/en/code-security/code-scanning/introduction-to-code-scanning/about-code-scanning-with-codeql#about-codeql
2025-07-27 01:08:23 +10:00
Yukihiro "Matz" Matsumoto 867c93d5e2 Merge pull request #6587 from mruby/ry422b-codex/add-tests-for-set#hash-method 2025-07-26 15:27:43 +09:00
Yukihiro "Matz" Matsumoto 8ebe0d3a15 test(set): ensure hash consistency 2025-07-25 18:12:48 +09:00
Yukihiro "Matz" Matsumoto c8b4843416 Merge pull request #6585 from mruby/2fb0n1-codex/fix-spelling-in-mruby3.2.md 2025-07-25 16:37:31 +09:00
Yukihiro "Matz" Matsumoto 8e8ba281b2 Fix typo in mruby3.2 documentation 2025-07-25 16:10:03 +09:00
buty4649 501c237f50 improve: prioritize local build_config.rb over default configuration
Add fallback to check for ./build_config.rb before using default.rb
2025-07-25 14:24:37 +09:00
Yukihiro "Matz" Matsumoto 54ee91156a Merge pull request #6582 from dearblue/type-tag 2025-07-22 08:26:14 +09:00
Yukihiro "Matz" Matsumoto 7b56f136bb Merge pull request #6581 from dearblue/iv_inspect 2025-07-22 08:20:33 +09:00
dearblue bd0f111397 Stricter type tag in mrb_obj_alloc()
Instances cannot be created with `MRB_TT_FALSE`.

_**Compatibility Note**_

This change may cause runtime errors.
However, that is probably because it is not set correctly by `MRB_SET_INSTANCE_TT()`.
2025-07-21 22:44:39 +09:00
dearblue 8b20f346f3 Setting the type tag with boot_defclass()
The purpose is to force the setting of the type tag.
This is in preparation for subsequent commits that will prevent the creation of instances with `MRB_TT_FALSE`.
2025-07-21 22:43:27 +09:00
dearblue 91f2dca111 Merge mrb_obj_iv_inspect() into mrb_obj_inspect()
`mrb_obj_iv_inspect()` is an internal implementation function and is not called by any function other than `mrb_obj_inspect()`.
2025-07-21 20:54:50 +09:00
Yukihiro "Matz" Matsumoto 9e8e816d08 Merge pull request #6578 from mruby/dependabot/github_actions/super-linter/super-linter-8.0.0 2025-07-19 19:09:21 +09:00
dependabot[bot] 037a3dbf38 build(deps): bump super-linter/super-linter from 7.4.0 to 8.0.0
Bumps [super-linter/super-linter](https://github.com/super-linter/super-linter) from 7.4.0 to 8.0.0.
- [Release notes](https://github.com/super-linter/super-linter/releases)
- [Changelog](https://github.com/super-linter/super-linter/blob/main/CHANGELOG.md)
- [Commits](https://github.com/super-linter/super-linter/compare/v7.4.0...v8.0.0)

---
updated-dependencies:
- dependency-name: super-linter/super-linter
  dependency-version: 8.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-18 14:34:40 +00:00
Yukihiro "Matz" Matsumoto a5ac9f3671 Merge pull request #6575 from mruby/codex 2025-07-18 15:13:29 +09:00
Yukihiro "Matz" Matsumoto b7e3b2be72 fix io file time accessor typo 2025-07-18 15:00:44 +09:00
Yukihiro "Matz" Matsumoto 479711700e mruby-set: add comprehensive call-seq documentation for all Ruby methods
Added complete call-seq documentation for all 17 Ruby methods in mrblib/set.rb:

- initialize: Added examples showing set creation with and without blocks
- merge: Added examples showing element merging and self-modification
- replace: Added examples showing complete set replacement
- subtract: Added examples showing element removal from enumerable
- intersection (&): Added examples showing common elements between sets
- union (|, +): Added examples showing set combination operations
- difference (-): Added examples showing set subtraction operations
- ^ (exclusive or): Added examples showing symmetric difference
- each: Added examples showing iteration with blocks and enumerators
- delete_if: Added examples showing conditional element deletion
- keep_if: Added examples showing conditional element retention
- collect!/map!: Added examples showing in-place element transformation
- reject!: Added examples showing conditional deletion with nil return
- select!/filter!: Added examples showing conditional retention with nil return
- classify: Added examples showing element classification into hash
- divide: Added examples showing set division into subsets

Co-authored-by: Atlassian Rovo Dev
2025-07-17 14:46:41 +09:00
Yukihiro "Matz" Matsumoto 2ac600dd8b mruby-proc-binding: add comprehensive call-seq documentation and helper function comments
Added complete call-seq documentation for proc binding functionality across
both source and test files:

## Core Implementation (src/proc_binding.c):

### Main Method:
- binding: returns Binding object capturing proc's execution context,
  includes comprehensive examples showing local variable access, parameter
  binding, and scope retention with practical usage patterns

### Helper Functions:
- mrb_mruby_proc_binding_gem_init: initializes gem by adding binding method
  to Proc class, explains method signature and return type behavior

Co-authored-by: Atlassian Rovo Dev
2025-07-17 12:53:58 +09:00
Yukihiro "Matz" Matsumoto 242936a90b mruby-binding: add comprehensive documentation with examples for binding methods
Enhanced documentation for Binding class methods with detailed examples:

- local_variable_defined?: Added examples showing usage within methods and at
  top-level, including interaction with local_variable_set
- local_variable_get: Added examples demonstrating retrieval of different data
  types, variable modification tracking, and NameError behavior
- local_variable_set: Added examples showing variable assignment and creation
- local_variables: Added examples showing array of local variable names
- receiver: Added examples showing bound receiver object access
- binding (Kernel method): Added examples showing binding creation and usage

Co-authored-by: Atlassian Rovo Dev
2025-07-17 12:51:35 +09:00
Yukihiro "Matz" Matsumoto 2907fdad06 mruby-data: add comprehensive call-seq documentation for missing methods
Added complete call-seq documentation for 4 missing public methods in the
data gem, improving documentation coverage from 46% to 77%.

Documentation added:
- Data.members: Returns array of member symbols for the class
- Data.define: Creates new data instances with positional or keyword arguments
- Data#initialize: Initializes data structure with hash values
- Data#initialize_copy: Copies data structure for dup/clone operations

Each method now includes:
- Clear method signatures with parameter and return types
- Detailed descriptions of data structure behavior
- Practical examples showing usage patterns
- Notes about member access and initialization
- Cross-references between class and instance methods

Co-authored-by: Atlassian Rovo Dev
2025-07-17 07:40:38 +09:00
Yukihiro "Matz" Matsumoto 9ff0bfe198 mruby-kernel-ext: add missing call-seq documentation for caller method
Added comprehensive call-seq documentation for the missing caller method
in the kernel-ext gem, improving documentation coverage from 78% to 100%.

Documentation added:
- caller: Returns execution stack as array of strings with file:line format

The caller method now includes:
- Clear method signatures with multiple calling conventions
- Detailed description of stack trace functionality
- Practical examples showing usage patterns
- Notes about start parameter and stack omission behavior
- Explanation of output format variations

This completes the documentation for all kernel extension methods,
providing full coverage for type conversion functions (Integer, Float,
String, Array, Hash), introspection methods (__method__, __callee__),
and debugging utilities (caller). The fail method references the core
mrb_f_raise function which is documented elsewhere.

Co-authored-by: Atlassian Rovo Dev
2025-07-17 07:35:15 +09:00
Yukihiro "Matz" Matsumoto d9d95ef57d mruby-eval: add comprehensive call-seq documentation for all methods
Added complete call-seq documentation for all 5 public methods in the
eval gem, improving documentation coverage from 0% to 100%.

Documentation added:
- eval: Evaluate Ruby expressions with optional binding and file context
- Object#instance_eval: Evaluate code in the context of an object instance
- Module#class_eval/module_eval: Evaluate code in the context of a class/module
- Binding#eval: Evaluate code within a specific binding context

Each method now includes:
- Clear method signatures with parameter and return types
- Detailed descriptions of evaluation context and scope behavior
- Comprehensive examples showing practical usage patterns
- Notes about binding objects, file/line reporting, and block alternatives
- Explanations of self context changes and variable access
- Security and error handling considerations

Key documentation features:
- String vs block evaluation differences explained
- Binding context usage with practical examples
- Instance variable and private method access patterns
- Class/module modification examples
- Error reporting with filename and line number context

Co-authored-by: Atlassian Rovo Dev
2025-07-16 13:38:50 +09:00
Yukihiro "Matz" Matsumoto 410516fdff mruby-random: add comprehensive call-seq documentation for missing methods
Added complete call-seq documentation for 7 missing public methods in the
random gem, improving documentation coverage from 25% to 100%.

Documentation added:
- Random.new: Create new random number generator with optional seed
- Random#rand: Generate random numbers (float, integer, or range)
- Random#srand: Seed the random number generator
- Random#bytes: Generate random byte strings
- Random.rand/rand: Class method and Kernel method for default generator
- Random.srand/srand: Class method and Kernel method for seeding
- Random.bytes: Class method for random bytes using default generator

Each method now includes:
- Clear method signatures with parameter and return types
- Detailed descriptions of random number generation behavior
- Practical examples showing different usage patterns
- Notes about default vs instance generators
- Cross-references between class methods and Kernel methods
- Range and numeric type handling explanations

The existing Array methods (shuffle, shuffle!, sample) were already
well-documented and remain unchanged. This completes the documentation
for all random number generation functionality in mruby, covering both
the Random class API and the traditional Kernel methods.

This significantly improves usability for developers working with
random number generation, cryptographic applications, and statistical
sampling in embedded Ruby environments.

Co-authored-by: Atlassian Rovo Dev
2025-07-16 11:58:59 +09:00
Yukihiro "Matz" Matsumoto e7c7b400a1 mruby-pack: add comprehensive call-seq documentation for all methods
Added complete call-seq documentation for all 3 public methods in the
pack gem, improving documentation coverage from 0% to 100%.

Documentation added:
- Array#pack: Pack array elements into binary string using template
- String#unpack: Unpack binary string into array using template
- String#unpack1: Unpack first value from binary string using template

Each method now includes:
- Clear method signatures with parameter and return types
- Comprehensive template directive reference table covering all supported formats
- Detailed descriptions of binary data packing/unpacking behavior
- Practical examples showing common usage patterns for different data types
- Notes about endianness, data type sizes, and string handling
- Cross-references between related methods

Template directives documented include:
- Integer types: C, c, S, s, L, l, Q, q (various sizes and signedness)
- Network/endian specific: n, N, v, V (network and little endian)
- Floating point: f, d (single and double precision)
- String types: A, a, Z (ASCII with different padding)
- Hex and binary: H, h (hex strings with nibble order)
- Special: x, X, @ (null bytes, positioning)

Co-authored-by: Atlassian Rovo Dev
2025-07-16 10:09:54 +09:00
Yukihiro "Matz" Matsumoto 2bd9c4327b mruby-time: add comprehensive call-seq documentation for all methods
Added complete call-seq documentation for all 39 public methods in the
Time class, improving documentation coverage from 0% to 100%.

Documentation added includes:

Class methods (6):
- Time.now: Get current system time
- Time.at: Create time from epoch seconds
- Time.gm/utc: Create UTC time from components
- Time.local/mktime: Create local time from components

Instance methods (33):
- Arithmetic: +, -, <=> for time calculations and comparisons
- Accessors: year, month, day, hour, min, sec, usec, wday, yday
- Timezone: zone, utc, localtime, getutc, getlocal, utc?, gmt?, dst?
- Conversion: to_i, to_f, to_s, inspect, asctime, ctime, hash
- Initialization: new, initialize_copy
- Weekday helpers: sunday?, monday?, tuesday?, wednesday?, thursday?, friday?, saturday?

Each method now includes:
- Clear method signatures with parameter and return types
- Detailed descriptions of time handling behavior
- Practical examples showing common usage patterns
- Notes about timezone handling and precision
- Consistent formatting following mruby documentation standards

This represents a major improvement in maintainability and usability of
time functionality for developers working with date/time operations in
embedded Ruby environments. The Time class is now fully documented with
comprehensive examples covering all aspects of time manipulation.

Co-authored-by: Atlassian Rovo Dev
2025-07-16 08:03:09 +09:00
Yukihiro "Matz" Matsumoto bac7eb984a mruby-errno: add comprehensive documentation and fix internal method comments
Added complete call-seq documentation for public methods and corrected
internal method documentation structure:

Public API methods
- SystemCallError.new: Create SystemCallError with message/errno
- SystemCallError#errno: Get errno number from exception
- SystemCallError._sys_fail: Internal method to raise errno exceptions
- Errno exception classes#new: Create specific errno exceptions

Fixed documentation structure to follow mruby conventions where internal
methods starting with __ should not have call-seq documentation but only
brief explanatory comments.

Each public method now includes:
- Clear method signatures with parameter and return types
- Descriptions of errno handling behavior
- Practical examples showing exception creation and handling
- Consistent formatting following mruby documentation standards

Co-authored-by: Atlassian Rovo Dev
2025-07-15 17:28:39 +09:00
Yukihiro "Matz" Matsumoto b11596891a mruby-encoding: add missing call-seq documentation for string methods
Added comprehensive call-seq documentation for the 2 missing public
methods in the encoding gem, improving documentation coverage from
33% to 100%.

Documentation added:
- String#encoding: Returns the encoding of a string (UTF-8 or ASCII-8BIT)
- String#force_encoding: Changes string encoding in place

Each method now includes:
- Clear method signatures with parameter and return types
- Descriptions of encoding behavior specific to mruby's limitations
- Practical examples showing usage patterns
- Notes about mruby's simplified encoding support (UTF-8, ASCII-8BIT, BINARY)

This complements the existing String#valid_encoding? documentation and
provides complete coverage for mruby's "poorman's encoding" functionality,
making it easier for developers to understand encoding operations in
embedded Ruby environments.

Co-authored-by: Atlassian Rovo Dev
2025-07-15 11:54:12 +09:00
Yukihiro "Matz" Matsumoto a791069abd mruby-cmath: add comprehensive call-seq documentation for all methods
Added complete call-seq documentation for all 17 public methods in the
CMath module, improving documentation coverage from 0% to 100%.

Documentation includes:
- Method signatures with parameter and return types
- Clear descriptions of mathematical operations
- Branch cut information for complex functions
- Practical examples showing real and complex number usage
- Consistent formatting following mruby documentation standards

Methods documented:
- Exponential and logarithmic: exp, log, log2, log10, sqrt
- Trigonometric: sin, cos, tan, asin, acos, atan
- Hyperbolic: sinh, cosh, tanh, asinh, acosh, atanh

This significantly improves maintainability and usability of the complex
math functionality for developers working with mathematical computations
in embedded Ruby environments.

Co-authored-by: Atlassian Rovo Dev
2025-07-15 11:54:12 +09:00
Yukihiro "Matz" Matsumoto b46d6e07c8 mruby-string-ext: add helpful comments for internal helper functions
- Add descriptive comments for key internal helper functions:
  * str_lines: splits string into array of lines
  * str_codepoints: returns array of character codepoints
  * str_chars_ary: fast path for String#chars returning character array
  * str_hex/str_oct: convert hex/octal strings to integers
  * str_ascii_only_p: checks if string contains only ASCII characters
  * str_b: returns binary encoded copy of string
  * str_char_count: counts UTF-8 characters using mruby standard function
  * str_delete_m/str_delete_bang: delete pattern characters (new/in-place)
- Improves code maintainability for large string extension gem (2309 lines)
- Maintains existing excellent call-seq documentation coverage (37 methods)
- Follows mruby documentation standards and internal helper conventions

Co-authored-by: Atlassian Rovo Dev
2025-07-15 11:54:12 +09:00
Yukihiro "Matz" Matsumoto 42399b33e2 mruby-proc-ext: add comprehensive documentation for all public methods
- Add complete call-seq documentation for 4 missing public methods:
  * Proc#lambda?: returns true if proc is a lambda, false if regular proc
  * Proc#source_location: returns [filename, line] or nil for native procs
  * Proc#to_s/inspect: returns string representation with location info
  * Kernel#proc: equivalent to Proc.new, creates proc from block
- Add helpful comment for internal mrb_proc_source_location helper function
- Improve TODO comment clarity for cfunc aspec limitation
- Achieves 100% public API documentation coverage (5/5 methods documented)
- Improves code maintainability and follows mruby documentation standards

Co-authored-by: Atlassian Rovo Dev
2025-07-15 11:54:11 +09:00
Yukihiro "Matz" Matsumoto 0f0d3482ff Merge pull request #6574 from katafrakt/struct-kwargs 2025-07-15 11:53:59 +09:00
Paweł Świątkowski aa874216dc Optimize checking for valid arguments to avoid O(N*M) complexity 2025-07-14 17:24:52 +02:00
Paweł Świątkowski 512d25607b Support :keyword_init argument when defining a new struct 2025-07-14 15:50:33 +02:00
Paweł Świątkowski 40fa5ec46d Support initializing structs via keyword arguments 2025-07-14 15:50:33 +02:00
Yukihiro "Matz" Matsumoto cf9596d339 mruby-array-ext: add comprehensive documentation for values_at and internal helpers
- Add complete call-seq documentation for Array#values_at method
- Add helpful comments for internal helper functions:
  * ary_ref: helper function for values_at
  * rev: helper function to reverse array elements in-place
  * flatten_internal: iterative stack-based flatten implementation
  * Updated comments for fill, uniq, normalize_index, and fetch helpers
- Improves code maintainability and follows mruby documentation standards
- Achieves 100% public API documentation coverage

Co-authored-by: Atlassian Rovo Dev
2025-07-12 08:38:39 +09:00
Yukihiro "Matz" Matsumoto 95656c40ff state.c: optimize mrb_state initialization by deferring method cache clear
During mrb_state initialization, especially when defining core classes and methods,
the method cache is repeatedly cleared. This causes significant overhead in
scenarios like mrbtest where mrb_state is initialized multiple times.

This commit introduces a `bootstrapping` flag in `struct mrb_state`.
When this flag is TRUE (during mrb_open_core), method cache clears
triggered by `mrb_define_method_raw` and `include_module_at` are suppressed.
The cache is cleared only once at the very end of `mrb_open_core` after
all core methods are defined, and the flag is then set to FALSE.

This optimization significantly reduces the number of method cache clears
during initialization, improving performance for repeated mrb_state creations.

Co-authored-by: Gemini <gemini@google.com>
2025-07-11 10:09:38 +09:00
Yukihiro "Matz" Matsumoto 2735340702 kernel.c: remove mrb_inspect_recursive_p(); #5531
And use mrb_recursive_method_p() and its helper methods.

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-11 10:09:37 +09:00
Yukihiro "Matz" Matsumoto 5ca2d442ce mruby-struct: add recursion detection to Struct#== and Struct#eql?
Prevent SystemStackError when comparing structs with circular
references.  Uses the same recursion detection mechanism as Hash and
Array equality methods.

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-11 10:09:37 +09:00
Yukihiro "Matz" Matsumoto 38882aecee array.c: add recursion detection to Array#== and Array#eql?
Prevent SystemStackError when comparing arrays with circular references.
Uses the same recursion detection mechanism as Hash equality methods.

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-11 10:09:37 +09:00
Yukihiro "Matz" Matsumoto 5a85350121 kernel.c: replace __inspect_recursive? with __method_recursive?
Add more general __method_recursive?(method_name[, arg]) method that can
check recursion for any method, not just inspect. This provides a more
useful API for Ruby code while cleaning up the implementation.

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-11 10:09:36 +09:00
Yukihiro "Matz" Matsumoto b64fc03182 kernel.c: simplify mrb_inspect_recursive_p using new recursion detection
Replace custom inspect_recursive_p implementation with the new
generalized mrb_recursive_method_p for better code reuse and
consistency.

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-11 10:09:36 +09:00