Showing the changes to src/core/chuck.cpp (1 of 8 files). Show all
Unified · Split
| @@ -630,7 +630,7 @@ t_CKBOOL ChucK::initChugins() · 629 unmodified lines | ||
| 630 | 630 | // push indent level |
| 631 | 631 | EM_pushlog(); |
| 632 | 632 | // 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 | 635 | // pop indent level |
| 636 | 636 | EM_poplog(); |
| @@ -722,11 +722,20 @@ error: // 1.4.1.0 (ge) added · 85 unmodified lines | ||
| 722 | 722 | //----------------------------------------------------------------------------- |
| 723 | 723 | void ChucK::probeChugins() |
| 724 | 724 | { |
| 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; | |
| 727 | 727 | |
| 728 | 728 | // print whether chugins enabled |
| 729 | 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 | 740 | // chugin dur |
| 732 | 741 | std::string chuginDir = getParamString( CHUCK_PARAM_CHUGIN_DIRECTORY ); |
| @@ -741,61 +750,35 @@ void ChucK::probeChugins() · 8 unmodified lines | ||
| 741 | 750 | std::list<std::string> named_dls = getParamStringList( CHUCK_PARAM_USER_CHUGINS ); |
| 742 | 751 | |
| 743 | 752 | // log |
| 744 | − EM_log( CK_LOG_SYSTEM, "probing chugins..." ); | |
| 753 | + EM_log( CK_LOG_SYSTEM, "probing chugins (.chug)..." ); | |
| 745 | 754 | // push indent level |
| 746 | 755 | EM_pushlog(); |
| 747 | 756 | // 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 level | |
| 751 | − EM_poplog(); | |
| 752 | − // clean up | |
| 753 | − // goto error; | |
| 759 | + // warning | |
| 760 | + EM_log( CK_LOG_SYSTEM, "error probing chugins..." ); | |
| 754 | 761 | } |
| 755 | 762 | // pop log |
| 756 | 763 | EM_poplog(); |
| 757 | 764 | |
| 758 | 765 | // 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 | 767 | EM_pushlog(); |
| 761 | 768 | |
| 762 | 769 | // 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++ ) | |
| 766 | 772 | { |
| 767 | 773 | // the filename |
| 768 | 774 | std::string filename = *j; |
| 769 | − | |
| 770 | 775 | // 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() ); | |
| 795 | 777 | } |
| 796 | 778 | |
| 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)" ); | |
| 799 | 782 | |
| 800 | 783 | // pop log |
| 801 | 784 | EM_poplog(); |