mirror of
https://github.com/fluffos/fluffos
synced 2026-08-12 18:26:06 -04:00
Source resolution is now explicit-extension-exact: load_object("/foo.c")
probes only foo.c, never foo.lpc (and vice versa); extension-less names
prefer .lpc and fall back to .c. Object identity stays extension-blind:
object names carry no extension, any spelling finds a loaded object, and
the registry is consulted before the filesystem. The caller's raw
spelling now flows through find_object()/inherit/master/simul_efun loads
instead of being pre-stripped away.
- filename_to_obname and otable basename() strip .lpc too (children())
- save_object() strips either source extension before appending .o
- replace_program()/function_exists() handle both suffixes
- testsuite: all LPC sources renamed to .lpc; runner globs, master
get_include_path cases, and program-name assertions updated;
README.md rewritten with the extension rules and suite conventions
- new single/tests/efuns/dual_extension.lpc pins exact-pick, fallback,
no-crossover, identity, and registry-before-filesystem with .c/.lpc
fixture pairs in /clone
Verified: ctest 297/297 and driver-autotest x3 (ASan Debug) plus
RelWithDebInfo ctest + autotest.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
45 lines
1.3 KiB
Text
45 lines
1.3 KiB
Text
/**
|
|
* NAME: range
|
|
* SYNOPSIS: (int | float) range( int | float lower, int | float upper, int | float value )
|
|
* DESCRIPTION: Given a lower bound and upper bound, test the value. If the value is between
|
|
* the ranges, return the value. If value is less than or equal to the lower
|
|
* bound, return lower. If the value is greater than or equal to the upper
|
|
* bound, return upper.
|
|
*/
|
|
|
|
#include <lpctypes.h>
|
|
|
|
mixed range( mixed lower, mixed upper, mixed value )
|
|
{
|
|
mixed min, max ;
|
|
|
|
if(nullp(lower)) error("Missing argument 1.\n");
|
|
if(nullp(upper)) error("Missing argument 2.\n");
|
|
if(nullp(value)) error("Missing argument 3.\n");
|
|
|
|
if( typeof(lower) != INT && typeof(lower) != FLOAT )
|
|
{
|
|
error("Argument 1 must be of type int or float.\n") ;
|
|
}
|
|
if( typeof(upper) != INT && typeof(upper) != FLOAT )
|
|
{
|
|
error("Argument 2 must be of type int or float.\n") ;
|
|
}
|
|
if( typeof(value) != INT && typeof(value) != FLOAT )
|
|
{
|
|
error("Argument 3 must be of type int or float.\n") ;
|
|
}
|
|
|
|
if ( upper < value )
|
|
{
|
|
min = upper ;
|
|
max = value ;
|
|
}
|
|
else
|
|
{
|
|
min = value ;
|
|
max = upper ;
|
|
}
|
|
|
|
return lower < min ? min : (lower > max ? max : lower) ;
|
|
}
|