Skip to content

Commit

Permalink
bump version to 1.5.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gewang committed Oct 26, 2024
1 parent 9016dd3 commit 81d8b72
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 40 deletions.
14 changes: 10 additions & 4 deletions VERSIONS
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
ChucK VERSIONS log
------------------

1.5.3.3
1.5.4.0 (October 2024)
=======
***************** new language feature ***************
- (added) chuck @import system for .ck and .chug files
- for language specification and examples regarding @import, see:
********** new language feature ************
@import system for .ck and .chug files
********************************************
- for language specification and examples regarding @import:
***************************************************
https://chuck.stanford.edu/doc/language/import.html
***************************************************
Expand Down Expand Up @@ -35,6 +36,11 @@ ChucK VERSIONS log
- @import can work recursively; can @import files that @import other files
- @import has built-in cycle-detection; if an @import cycle is detected, a compiler error
will be issued and that compilation will be failed
******************************************************
- (updated behavior) the one-public-class-per-file restriction has been lifted; i.e., it is
now possible to define more than one public class in a single .ck file; this update is
intended to give programmers and library creators more flexibility in organizing their
public class definiition
- (updated behavior) .ck files found in chugin/import search paths (e.g., ~/.chuck/lib) NO
LONGER automatically loads; instead these now must be explicitly @imported to be used (FYI
just the file name will suffice, assuming there are no filename conflicts elsewhere in the
Expand Down
4 changes: 2 additions & 2 deletions src/core/chuck_compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ struct Chuck_Compiler
Chuck_VM * vm() const { return m_carrier->vm; }
// REFACTOR-2017: get associated, per-compiler carrier
Chuck_Carrier * carrier() const { return m_carrier; }
// get import registry | 1.5.3.5 (ge)
// get import registry | 1.5.4.0 (ge)
Chuck_ImportRegistry * imports() { return &m_importRegistry; }
// set carrier
t_CKBOOL setCarrier( Chuck_Carrier * c ) { m_carrier = c; return TRUE; }
Expand Down Expand Up @@ -301,7 +301,7 @@ struct Chuck_Compiler
t_CKBOOL importChugin( const std::string & path, const std::string & name = "" );

public:
// compile a target | 1.5.3.5 (ge)
// compile a target | 1.5.4.0 (ge)
// NOTE: this function will memory-manage `target`
// (do not access or delete `target` after function call)
t_CKBOOL compile( Chuck_CompileTarget * target );
Expand Down
2 changes: 1 addition & 1 deletion src/core/chuck_emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ Chuck_VM_Code * emit_engine_emit_prog( Chuck_Emitter * emit, a_Program prog,
case ae_section_class: // class definition
// 1.5.2.5 (ge) check the compilation criteria
// if( !howMuch_criteria_match( how_much, prog->section->class_def ) ) break;
// 1.5.3.5 (ge) commented out (see type_engine_prog0_scan() for explanation)
// 1.5.4.0 (ge) commented out (see type_engine_prog0_scan() for explanation)

// emit class definition
ret = emit_engine_emit_class_def( emit, prog->section->class_def );
Expand Down
4 changes: 2 additions & 2 deletions src/core/chuck_errmsg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ using namespace std;
t_CKINT EM_tokPos = 0;
t_CKINT EM_lineNum = 1;

// current per-file error message context | 1.5.3.5 (ge)
// current per-file error message context | 1.5.4.0 (ge)
static Chuck_CompileTarget * the_compileTarget = NULL;
// current filename
static const char * the_filename = "";
Expand Down Expand Up @@ -1047,7 +1047,7 @@ const char * EM_lasterror()

//-----------------------------------------------------------------------------
// name: EM_setCurrentTarget()
// desc: set current compile compilation target | 1.5.3.5 (ge)
// desc: set current compile compilation target | 1.5.4.0 (ge)
//-----------------------------------------------------------------------------
void EM_setCurrentTarget( Chuck_CompileTarget * target )
{
Expand Down
4 changes: 2 additions & 2 deletions src/core/chuck_errmsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ extern "C++"

// class forward reference | 1.5.0.5 (ge) added
class ChucK;
// struct forward reference | 1.5.3.5 (ge) added
// struct forward reference | 1.5.4.0 (ge) added
struct Chuck_CompileTarget;

// set current compile compilation target; used for state | 1.5.3.5 (ge)
// set current compile compilation target; used for state | 1.5.4.0 (ge)
void EM_setCurrentTarget( Chuck_CompileTarget * target );


Expand Down
4 changes: 2 additions & 2 deletions src/core/chuck_instr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6269,7 +6269,7 @@ void Chuck_Instr_Array_Init_Literal::execute( Chuck_VM * vm, Chuck_VM_Shred * sh
// reg stack pointer
t_CKUINT *& reg_sp = (t_CKUINT *&)shred->reg->sp;

// amalgamating array type | 1.5.3.5 (ge, nick, andrew) added after a wild yak hunt
// amalgamating array type | 1.5.4.0 (ge, nick, andrew) added after a wild yak hunt
Chuck_Type * arrayType = vm->env()->get_array_type( vm->env()->ckt_array, m_type_ref->array_depth+1, m_type_ref );

// allocate the array
Expand All @@ -6287,7 +6287,7 @@ void Chuck_Instr_Array_Init_Literal::execute( Chuck_VM * vm, Chuck_VM_Shred * sh
// initialize object
// should it be this??? initialize_object( array, m_type_ref );
// should it be this??? initialize_object( array, vm->env()->ckt_array, shred, vm );
// neither! behold -- the amalgamated array type... | 1.5.3.5 (ge, nick, andrew)
// neither! behold -- the amalgamated array type... | 1.5.4.0 (ge, nick, andrew)
initialize_object( array, arrayType, shred, vm );

// set size
Expand Down
2 changes: 1 addition & 1 deletion src/core/chuck_oo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ void Chuck_ArrayInt::sort()
// check size
if( size() == 0 ) return;

// if object references | 1.5.3.5 (azaday) added
// if object references | 1.5.4.0 (azaday) added
if( m_is_obj )
{
// if this is a string[]
Expand Down
2 changes: 1 addition & 1 deletion src/core/chuck_otf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ t_CKUINT otf_process_msg( Chuck_VM * vm, Chuck_Compiler * compiler,
// (added 1.3.5.2)
std::string full_path = get_full_path( msg->buffer );

// construct a target to be compiled | 1.5.3.5 (ge)
// construct a target to be compiled | 1.5.4.0 (ge)
Chuck_CompileTarget * target = new Chuck_CompileTarget();
// set file descriptor
target->fd2parse = fd;
Expand Down
2 changes: 1 addition & 1 deletion src/core/chuck_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ t_CKBOOL chuck_parse( Chuck_CompileTarget * target )
// check for conflict
if( fd && target->codeLiteral != "" )
{
// no warning... quietly let the code literal take precedence | 1.5.3.5 (ge)
// no warning... quietly let the code literal take precedence | 1.5.4.0 (ge)
// CK_FPRINTF_STDERR( "[chuck](parser): (internal) code and FILE descriptor both present!\n" );
// CK_FPRINTF_STDERR( "[chuck](parser): |- ignoring FILE descriptor...\n" );
}
Expand Down
12 changes: 6 additions & 6 deletions src/core/chuck_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ t_CKBOOL type_engine_scan0_prog( Chuck_Env * env, a_Program prog,
// 1.5.2.5 (ge) check the compilation criteria
// if( !howMuch_criteria_match( how_much, prog->section->class_def ) ) break;
// -----------------------------------------
// 1.5.3.5 (ge) commented out above howMuch_criteria_match()
// 1.5.4.0 (ge) commented out above howMuch_criteria_match()
// * go ahead and compile all classes (public or non-public) even if import_only
// ...there is logic within to further sort out public vs. non-public classes
// * this is needed because public classes could make use of non-public classes
Expand All @@ -174,7 +174,7 @@ t_CKBOOL type_engine_scan0_prog( Chuck_Env * env, a_Program prog,
// make global, if marked public
if( prog->section->class_def->decl == ae_key_public )
{
// 1.5.3.5 (ge) removing restriction of one public class per file
// 1.5.4.0 (ge) removing restriction of one public class per file
// ---------------- legacy note ------------
// make sure the context has no public class
// if( env->context->public_class_def != NULL )
Expand Down Expand Up @@ -279,7 +279,7 @@ t_CKBOOL type_engine_scan0_class_def( Chuck_Env * env, a_Class_Def class_def )
the_class->info = env->context->new_Chuck_Namespace();
CK_SAFE_ADD_REF( the_class->info );
the_class->info->name = the_class->base_name;
// public? | 1.5.3.5 (ge) added
// public? | 1.5.4.0 (ge) added
the_class->is_public = (class_def->decl == ae_key_public);
// if public class, then set parent to context
// ... allowing the class to address current context
Expand Down Expand Up @@ -323,7 +323,7 @@ t_CKBOOL type_engine_scan0_class_def( Chuck_Env * env, a_Class_Def class_def )
break;

case ae_section_class:
// check for public | 1.5.3.5 (ge) added
// check for public | 1.5.4.0 (ge) added
if( body->section->class_def->decl == ae_key_public )
{
EM_error2( class_def->where,
Expand Down Expand Up @@ -437,7 +437,7 @@ t_CKBOOL type_engine_scan1_prog( Chuck_Env * env, a_Program prog,
case ae_section_class:
// 1.5.2.5 (ge) check the compilation criteria
// if( !howMuch_criteria_match( how_much, prog->section->class_def ) ) break;
// 1.5.3.5 (ge) commented out (see type_engine_prog0_scan() for explanation)
// 1.5.4.0 (ge) commented out (see type_engine_prog0_scan() for explanation)

// scan the class definition
ret = type_engine_scan1_class_def( env, prog->section->class_def );
Expand Down Expand Up @@ -1708,7 +1708,7 @@ t_CKBOOL type_engine_scan2_prog( Chuck_Env * env, a_Program prog,
case ae_section_class:
// 1.5.2.5 (ge) check the compilation criteria
// if( !howMuch_criteria_match( how_much, prog->section->class_def ) ) break;
// 1.5.3.5 (ge) commented out (see type_engine_prog0_scan() for explanation)
// 1.5.4.0 (ge) commented out (see type_engine_prog0_scan() for explanation)

// scan the class definition
ret = type_engine_scan2_class_def( env, prog->section->class_def );
Expand Down
16 changes: 8 additions & 8 deletions src/core/chuck_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ t_CKBOOL type_engine_init( Chuck_Carrier * carrier )
EM_pushlog();

//-------------------------
// disable array type cache until ckt_array is initialized | 1.5.3.5 (ge) added
// disable array type cache until ckt_array is initialized | 1.5.4.0 (ge) added
env->arrayTypeCache()->enable( FALSE );
// special: Object and Type, whose initializations mutually depend
init_class_object( env, env->ckt_object );
Expand All @@ -570,7 +570,7 @@ t_CKBOOL type_engine_init( Chuck_Carrier * carrier )
// initialize of Object's and @array's Type objects are deferred until after init_class_type()
type_engine_init_special( env, env->ckt_object );
type_engine_init_special( env, env->ckt_array );
// enable array type cache now that ckt_array is initialized | 1.5.3.5 (ge) added
// enable array type cache now that ckt_array is initialized | 1.5.4.0 (ge) added
env->arrayTypeCache()->enable( TRUE );
//-------------------------

Expand Down Expand Up @@ -898,7 +898,7 @@ t_CKBOOL type_engine_check_context( Chuck_Env * env,
case ae_section_class:
// 1.5.2.5 (ge) check the compilation criteria
// if( !howMuch_criteria_match( how_much, prog->section->class_def ) ) break;
// 1.5.3.5 (ge) commented out (see type_engine_prog0_scan() for explanation)
// 1.5.4.0 (ge) commented out (see type_engine_prog0_scan() for explanation)

// check the class definition
ret = type_engine_check_class_def( env, prog->section->class_def );
Expand Down Expand Up @@ -3445,7 +3445,7 @@ t_CKTYPE type_engine_check_exp_primary( Chuck_Env * env, a_Exp_Primary exp )
"undefined variable/function '%s' in class/namespace '%s'",
S_name(exp->var), env->class_def->base_name.c_str() );

// check if we are being imported | 1.5.3.5 (ge) added
// check if we are being imported | 1.5.4.0 (ge) added
if( env->context->progress == Chuck_Context::P_IMPORTING )
{
// more info / a hint
Expand Down Expand Up @@ -5824,7 +5824,7 @@ t_CKBOOL isa_levels( const Chuck_Type & lhs, const Chuck_Type & rhs, t_CKUINT &
// if lhs is null and rhs isa Object
if( (lhs == *(lhs.env()->ckt_null)) && (rhs <= *(rhs.env()->ckt_object)) ) return TRUE;
//--------------------------------------------
// all arrays isa base @array type | 1.5.3.5 (ge & nick) added
// all arrays isa base @array type | 1.5.4.0 (ge & nick) added
if( lhs.array_depth > 0 && (rhs == *(rhs.env()->ckt_array) ) ) return TRUE;
// all arrays or base @array type isa Object
if( (lhs.array_depth > 0 || (lhs == *(lhs.env()->ckt_array))) && (rhs == *(rhs.env()->ckt_object) ) ) return TRUE;
Expand Down Expand Up @@ -7937,7 +7937,7 @@ Chuck_Namespace * Chuck_Context::new_Chuck_Namespace()

//-----------------------------------------------------------------------------
// name: get_array_type()
// desc: retrieve array type based on parameters | 1.5.3.5 (ge, nick, andrew) added
// desc: retrieve array type based on parameters | 1.5.4.0 (ge, nick, andrew) added
//-----------------------------------------------------------------------------
Chuck_Type * Chuck_Env::get_array_type( Chuck_Type * array_parent,
t_CKUINT depth, Chuck_Type * base_type /*,
Expand Down Expand Up @@ -7994,7 +7994,7 @@ void Chuck_ArrayTypeCache::clear()


//-----------------------------------------------------------------------------
// name: getOrCreate() | 1.5.3.5 (ge, nick, andrew) added
// name: getOrCreate() | 1.5.4.0 (ge, nick, andrew) added
// desc: lookup an array type; if not already cached, create and insert
//-----------------------------------------------------------------------------
Chuck_Type * Chuck_ArrayTypeCache::getOrCreate( Chuck_Env * env,
Expand Down Expand Up @@ -8058,7 +8058,7 @@ Chuck_Type * create_new_array_type( Chuck_Env * env, Chuck_Type * array_parent,

// 1.4.1.1 (nshaheed) added to allow declaring arrays with subclasses as elements (PR #211)
// example: [ new SinOsc, new Sinosc ] @=> Osc arr[]; // this previously would fail type check
// 1.5.3.5 (ge & nick) this is now handled in isa_levels()
// 1.5.4.0 (ge & nick) this is now handled in isa_levels()

// parent type
t->parent = array_parent;
Expand Down
12 changes: 6 additions & 6 deletions src/core/chuck_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ typedef enum { te_globalTypeNone,
//-----------------------------------------------------------------------------
typedef enum {
te_do_all = 0,
te_do_import_only, // attend only to things to be imported | 1.5.3.5 (ge)
te_skip_import, // do everything except things to be imported | 1.5.3.5 (ge)
te_do_import_only, // attend only to things to be imported | 1.5.4.0 (ge)
te_skip_import, // do everything except things to be imported | 1.5.4.0 (ge)
} te_HowMuch;

// function to if a function matches a particular criteria
Expand Down Expand Up @@ -651,7 +651,7 @@ struct Chuck_Op_Overload

//-----------------------------------------------------------------------------
// name: struct Chuck_ArrayTypeKey
// desc: a 4-tuple key | 1.5.3.5 (ge & nick) added
// desc: a 4-tuple key | 1.5.4.0 (ge & nick) added
//-----------------------------------------------------------------------------
struct Chuck_ArrayTypeKey
{
Expand All @@ -677,7 +677,7 @@ struct Chuck_ArrayTypeKeyCmp

//-----------------------------------------------------------------------------
// name: struct Chuck_ArrayTypeCache
// desc: cache for array types | 1.5.3.5 (ge & nick & andrew) added
// desc: cache for array types | 1.5.4.0 (ge & nick & andrew) added
//-----------------------------------------------------------------------------
struct Chuck_ArrayTypeCache
{
Expand Down Expand Up @@ -753,7 +753,7 @@ struct Chuck_Env : public Chuck_VM_Object
public:
// array type cache
Chuck_ArrayTypeCache * arrayTypeCache() { return &array_types; }
// retrieve array type based on parameters | 1.5.3.5 (ge, nick, andrew) added
// retrieve array type based on parameters | 1.5.4.0 (ge, nick, andrew) added
Chuck_Type * get_array_type( Chuck_Type * array_parent,
t_CKUINT depth, Chuck_Type * base_type /*,
Chuck_Namespace * owner_nspc */ );
Expand Down Expand Up @@ -996,7 +996,7 @@ struct Chuck_Type : public Chuck_Object
Chuck_Func * func;
// ugen
Chuck_UGen_Info * ugen_info;
// is public class | 1.5.3.5 (ge) added
// is public class | 1.5.4.0 (ge) added
t_CKBOOL is_public;
// copy
t_CKBOOL is_copy;
Expand Down
4 changes: 2 additions & 2 deletions src/core/util_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ std::string extract_filepath_file( const std::string & filepath )


//-----------------------------------------------------------------------------
// name: extract_filepath_ext() | 1.5.3.5 (ge) added
// name: extract_filepath_ext() | 1.5.4.0 (ge) added
// desc: return the extension portion of a file path, including the .
//-----------------------------------------------------------------------------
std::string extract_filepath_ext( const std::string & filepath )
Expand Down Expand Up @@ -1265,7 +1265,7 @@ std::string autoFilename( const std::string & prefix, const std::string & fileEx
#endif
//-----------------------------------------------------------------------------
// name: file_last_write_time()
// desc: unformatted last-write timestamp of a file | 1.5.3.5 (ge)
// desc: unformatted last-write timestamp of a file | 1.5.4.0 (ge)
//-----------------------------------------------------------------------------
time_t file_last_write_time( const std::string & filename )
{
Expand Down
4 changes: 2 additions & 2 deletions src/core/util_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ std::string extract_filepath_dir( const std::string & filepath );
// get filename portion of a filepath (minus the directory portion) | 1.5.2.5 (ge) added
std::string extract_filepath_file( const std::string & filepath );

// get extension portion of a filepath (minus the directory and file portions) | 1.5.3.5 (ge) added
// get extension portion of a filepath (minus the directory and file portions) | 1.5.4.0 (ge) added
std::string extract_filepath_ext( const std::string & filepath );

// desc: create absolute path using existing filepath and incoming path
Expand Down Expand Up @@ -158,7 +158,7 @@ t_CKBOOL subdir_ok2recurse( const std::string & dirName,
// get formatted timestamp of current system time; no new line
std::string timestamp_formatted(); // e.g., "Sat Jun 24 04:18:42 2023"

// unformatted last-write timestamp of a file | 1.5.3.5 (ge)
// unformatted last-write timestamp of a file | 1.5.4.0 (ge)
time_t file_last_write_time( const std::string & filename );

// tokenize a string into a vector of strings, by delimiters
Expand Down

0 comments on commit 81d8b72

Please sign in to comment.