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
630 // push indent level630 // push indent level
631 EM_pushlog();631 EM_pushlog();
632 // load external libs632 // 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 ) )
634 {634 {
635 // pop indent level635 // pop indent level
636 EM_poplog();636 EM_poplog();
@@ -722,11 +722,20 @@ error: // 1.4.1.0 (ge) added · 85 unmodified lines
722//-----------------------------------------------------------------------------722//-----------------------------------------------------------------------------
723void ChucK::probeChugins()723void ChucK::probeChugins()
724{724{
725 Chuck_VM_Code * code = NULL;725 // ck files to pre load
726 Chuck_VM_Shred * shred = NULL;726 std::list<std::string> ck_libs_to_preload;
727 727
728 // print whether chugins enabled728 // print whether chugins enabled
729 EM_log( CK_LOG_SYSTEM, "chugin system: %s", getParamInt( CHUCK_PARAM_CHUGIN_ENABLE ) ? "ON" : "OFF" );729 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();
730 739
731 // chugin dur740 // chugin dur
732 std::string chuginDir = getParamString( CHUCK_PARAM_CHUGIN_DIRECTORY );741 std::string chuginDir = getParamString( CHUCK_PARAM_CHUGIN_DIRECTORY );
@@ -741,61 +750,35 @@ void ChucK::probeChugins() · 8 unmodified lines
741 std::list<std::string> named_dls = getParamStringList( CHUCK_PARAM_USER_CHUGINS );750 std::list<std::string> named_dls = getParamStringList( CHUCK_PARAM_USER_CHUGINS );
742 751
743 // log752 // log
744 EM_log( CK_LOG_SYSTEM, "probing chugins..." );753 EM_log( CK_LOG_SYSTEM, "probing chugins (.chug)..." );
745 // push indent level754 // push indent level
746 EM_pushlog();755 EM_pushlog();
747 // load external libs756 // 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 ) )
749 {758 {
750 // pop indent level759 // warning
751 EM_poplog();760 EM_log( CK_LOG_SYSTEM, "error probing chugins..." );
752 // clean up
753 // goto error;
754 }761 }
755 // pop log762 // pop log
756 EM_poplog();763 EM_poplog();
757 764
758 // log765 // log
759 EM_log( CK_LOG_SYSTEM, "probing pre-loading ChucK libs..." );766 EM_log( CK_LOG_SYSTEM, "probing auto-load chuck files (.ck)..." );
760 EM_pushlog();767 EM_pushlog();
761 768
762 // iterate over list of ck files that the compiler found769 // iterate over list of ck files that the compiler found
763 for( std::list<std::string>::iterator j =770 for( std::list<std::string>::iterator j = ck_libs_to_preload.begin();
764 compiler()->m_cklibs_to_preload.begin();771 j != ck_libs_to_preload.end(); j++ )
765 j != compiler()->m_cklibs_to_preload.end(); j++ )
766 {772 {
767 // the filename773 // the filename
768 std::string filename = *j;774 std::string filename = *j;
769
770 // log775 // log
771 EM_log( CK_LOG_SEVERE, "preloading '%s'...", filename.c_str() );776 EM_log( CK_LOG_SYSTEM, "source '%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();
795 }777 }
796 778
797 // clear the list of chuck files to preload779 // check
798 compiler()->m_cklibs_to_preload.clear();780 if( ck_libs_to_preload.size() == 0 )
781 EM_log( CK_LOG_SYSTEM, "(none found)" );
799 782
800 // pop log783 // pop log
801 EM_poplog();784 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