History

initial feature done

Ge Wang committed 3 years ago

Commit add40a01 parent dcebc368 files · +516 −193Browse files

Showing the changes to src/core/chuck.cpp (1 of 8 files). Show all

Unified · Split

src/core/chuck.cpp+23−40
@@ -630,7 +630,7 @@ t_CKBOOL ChucK::initChugins() · 629 unmodified lines
630630 // push indent level
631631 EM_pushlog();
632632 // load external libs
633− if( !compiler()->load_external_modules( ".chug", dl_search_path, named_dls ) )
633+ if( !compiler()->load_external_modules( ".chug", dl_search_path, named_dls, true ) )
634634 {
635635 // pop indent level
636636 EM_poplog();
@@ -722,11 +722,20 @@ error: // 1.4.1.0 (ge) added · 85 unmodified lines
722722 //-----------------------------------------------------------------------------
723723 void ChucK::probeChugins()
724724 {
725− Chuck_VM_Code * code = NULL;
726− Chuck_VM_Shred * shred = NULL;
725+ // ck files to pre load
726+ std::list<std::string> ck_libs_to_preload;
727727
728728 // print whether chugins enabled
729729 EM_log( CK_LOG_SYSTEM, "chugin system: %s", getParamInt( CHUCK_PARAM_CHUGIN_ENABLE ) ? "ON" : "OFF" );
730+ // print host version
731+ EM_log( CK_LOG_SYSTEM, "chuck host version: %d.%d", CK_DLL_VERSION_MAJOR, CK_DLL_VERSION_MINOR );
732+ // push
733+ EM_pushlog();
734+ // print host version
735+ EM_log( CK_LOG_SYSTEM, "chugin major version must == host major version" );
736+ EM_log( CK_LOG_SYSTEM, "chugin minor version must <= host major version" );
737+ // pop
738+ EM_poplog();
730739
731740 // chugin dur
732741 std::string chuginDir = getParamString( CHUCK_PARAM_CHUGIN_DIRECTORY );
@@ -741,61 +750,35 @@ void ChucK::probeChugins() · 8 unmodified lines
741750 std::list<std::string> named_dls = getParamStringList( CHUCK_PARAM_USER_CHUGINS );
742751
743752 // log
744− EM_log( CK_LOG_SYSTEM, "probing chugins..." );
753+ EM_log( CK_LOG_SYSTEM, "probing chugins (.chug)..." );
745754 // push indent level
746755 EM_pushlog();
747756 // load external libs
748− if(!compiler()->load_external_modules( ".chug", dl_search_path, named_dls ))
757+ if( !Chuck_Compiler::probe_external_modules( ".chug", dl_search_path, named_dls, TRUE, ck_libs_to_preload ) )
749758 {
750− // pop indent level
751− EM_poplog();
752− // clean up
753− // goto error;
759+ // warning
760+ EM_log( CK_LOG_SYSTEM, "error probing chugins..." );
754761 }
755762 // pop log
756763 EM_poplog();
757764
758765 // log
759− EM_log( CK_LOG_SYSTEM, "probing pre-loading ChucK libs..." );
766+ EM_log( CK_LOG_SYSTEM, "probing auto-load chuck files (.ck)..." );
760767 EM_pushlog();
761768
762769 // iterate over list of ck files that the compiler found
763− for( std::list<std::string>::iterator j =
764− compiler()->m_cklibs_to_preload.begin();
765− j != compiler()->m_cklibs_to_preload.end(); j++ )
770+ for( std::list<std::string>::iterator j = ck_libs_to_preload.begin();
771+ j != ck_libs_to_preload.end(); j++ )
766772 {
767773 // the filename
768774 std::string filename = *j;
769−
770775 // log
771− EM_log( CK_LOG_SEVERE, "preloading '%s'...", filename.c_str() );
772− // push indent
773− EM_pushlog();
774−
775− // SPENCERTODO: what to do for full path
776− std::string full_path = filename;
777−
778− // parse, type-check, and emit
779− if(compiler()->go( filename, NULL, NULL, full_path ))
780− {
781− // TODO: how to compilation handle?
782− //return 1;
783−
784− // get the code
785− code = compiler()->output();
786− // name it - TODO?
787− // code->name += string(argv[i]);
788−
789− // spork it
790− shred = vm()->spork( code, NULL, TRUE );
791− }
792−
793− // pop indent
794− EM_poplog();
776+ EM_log( CK_LOG_SYSTEM, "source '%s'...", filename.c_str() );
795777 }
796778
797− // clear the list of chuck files to preload
798− compiler()->m_cklibs_to_preload.clear();
779+ // check
780+ if( ck_libs_to_preload.size() == 0 )
781+ EM_log( CK_LOG_SYSTEM, "(none found)" );
799782
800783 // pop log
801784 EM_poplog();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t