typeof env_ref=Env;; defcom Smain=main I;; /* $iri flags for the check of the Scol extensions */ var MASTER_CHECK_CRITICAL = 0;; var MASTER_CHECK_IMPORTANT = 1;; var MASTER_CHECK_OPTIONAL = 2;; var MASTER_CHECK_SUCCESS = 0;; var MASTER_CHECK_FAILURE = 1;; proto guiCLmain = fun [[[S I I S] r1] I] I;; /* fun [[S r1] I] I return MASTER_CHECK_SUCCESS if all functions in the list are loaded otherwise MASTER_CHECK_FAILURE is returned */ fun master_checkLibraries3 (listIn, number)= if (listIn == nil) || (number < 0) then MASTER_CHECK_SUCCESS else let nth_list listIn number -> funName in let if funName == nil then 1 else _test_exist funName -> res in if res == 1 then master_checkLibraries3 listIn number-1 else MASTER_CHECK_FAILURE;; /* fun [[[[S S S] S I] r1] I] [[S I I S] r1] call the check function for each group and build the resluted list */ fun master_checkLibraries2 (listIn, number)= if listIn == nil then nil else let hd listIn -> [[f1 f2 f3] desc flag name] in let [desc flag master_checkLibraries3 f1 :: f2 :: f3 :: nil number name] -> listRes in listRes :: master_checkLibraries2 tl listIn number;; /* fun [] [[S I I S] r1] return a list with, for each group, its name, its flag, its loading (ok or ko) and the library name */ fun master_checkLibraries ()= // 3d legacy engine let [["MX3createSession" "M3blitTexture16" "M3chgMaterialTexture"] "legacy 3d engine" MASTER_CHECK_OPTIONAL "zoogl24"] :: // 3d engine (SO3Engine) [["SO3SceneCreate" "SO3ViewportCreate" "SO3BufferCreate"] "3d engine (SO3Engine)" MASTER_CHECK_IMPORTANT "so3ngine"] :: // 2d graphics [["_CRcontainerFromObjWin" "_CRcompBitmap" "_DScompText"] "2d graphics" MASTER_CHECK_CRITICAL "lib2d24"] :: // SQL [["SqlCreate" "SqlParam" "SqlCreateEx"] "SQL / (unix)ODBC" MASTER_CHECK_IMPORTANT "scolsql"] :: // SQLite3 [["_sqliteClose" "_sqliteOpenMemory" "_sqliteVersion"] "SQLite3 support" MASTER_CHECK_OPTIONAL "libsqlite3"] :: // Multimedia [["_CRmulti" "_QTPlayMovie" "REALcreateFromFile"] "Multimedia" MASTER_CHECK_IMPORTANT "mmedia24"] :: // SVLC (iri) [["vlcNew" "vlcStop" "vlcPlay"] "Scol VLC (svlc)" MASTER_CHECK_OPTIONAL "libsvlc"] :: // Speech (from SAPI) [["_CBSpeechWord" "_DSSpeech" "_SetSpeechRate"] "Speech from SAPI (MS Windows only)" MASTER_CHECK_IMPORTANT "speech"] :: // OS 2d [["_CRalphaBitmap" "_GETpixel24" "_keybdstate"] "OS 2D" MASTER_CHECK_CRITICAL "libos2d24"] :: // BitmapToolkit / OpenCV [["_BTBLURbitmap" "_CRarCameraParam" "_SETcaptureSize"] "BitmapToolkit / OpenCV" MASTER_CHECK_IMPORTANT "bitmaptoolkit"] :: // GTK+ [["_gtkButtonNew" "_gtkWindowAddChild" "_gtkWidgetCB"] "GTK+" MASTER_CHECK_OPTIONAL "2dgtk"] :: // SYSPACK [["DictGetNth" "scolAllFunsWithType" "_FILECloseTemp"] "Syspack (System pack)" MASTER_CHECK_OPTIONAL "syspack"] :: // ActiveX [["_AXCallFunc" "_AXGetInterfaceInfo" "_GETactiveXWindow"] "ActiveX support (MS Windows only)" MASTER_CHECK_CRITICAL "xtension"] :: // Kinect / OpenNi [["CBKinectUserHandFound" "_DSKinectDevice" "_SETKinectDeviceDetectionAngle"] "OpenNi (Kinect)" MASTER_CHECK_OPTIONAL nil] :: // USB-UIRT [["_CRusbUIRT" "_DSusbUIRT" "_SendUsbUIRTData"] "USB-UIRT" MASTER_CHECK_OPTIONAL nil] :: // Wiimote [["_CBwiiBalanceBoard" "_CloseWiiDevice" "_OpenWiiDevice"] "Wiimote support" MASTER_CHECK_OPTIONAL "wiimote"] :: // SerialIO [["_openSIO" "_closeSIO" "_writeSIO"] "Serial Communication" MASTER_CHECK_OPTIONAL "serialio"] :: // X10 protocol [["X10allLightsOn" "_X10unitBright" "_X10unitOff"] "X10 protocol" MASTER_CHECK_OPTIONAL "x10"] :: // Glove5td [["_CBGloveHand" "_GetSerialNumber" "_CBGloveHand"] "Glove5TD support" MASTER_CHECK_OPTIONAL "fgloved"] :: // Neurosky [["_CBNeuroskyConnected" "CRNeurosky" "SetNeuroskyBaudrate"] "Neurosky model support" MASTER_CHECK_OPTIONAL "neurosky"] :: // Emotic Epoc [["_CBEpocCognitivTrainingErased" "_CBEpocConnected" "_CREpoc"] "Emotic Epoc support" MASTER_CHECK_OPTIONAL nil] :: // Nonin [["_CBNoninHR" "_CBNoninSNSA" "_CRNonin"] "Nonin medical support" MASTER_CHECK_OPTIONAL nil] :: // Optitrack camera [["_CROptitrackCamera" "_DSOptitrackCamera" "_OptitrackCameraSetExposure"] "Optitrack camera" MASTER_CHECK_OPTIONAL nil] :: // VLC Stream (arkeon) [["_enableVlmStream" "_pauseVlmStream" "_seekVlmStream"] "VLC Stream" MASTER_CHECK_OPTIONAL "scolvlc"] :: // Space Point Fusion [["_CBFusionConnected" "_CBFusionOrientationData" "_CloseFusionDevice"] "Space Point Fusion support" MASTER_CHECK_OPTIONAL nil] :: // SMI RED [["_CBSmiNewSample" "_OpenSmiDevice" "_ShowEyes"] "SMI RED support" MASTER_CHECK_OPTIONAL nil] :: // Security [["_RSAgetKeyPair" "_AESgetKey" "_AESdecryptMessage"] "Security (AES & RSA algorythm support)" MASTER_CHECK_IMPORTANT "security"] :: // Audio [["_AudioPlay3d" "_AudioGetPosition" "_CBAudioEnd"] "Audio based on OpenAl" MASTER_CHECK_IMPORTANT "audio"] :: // Joypad [["_OpenJoypad" "_CloseJoypad" nil] "Joypad" MASTER_CHECK_OPTIONAL "joypad"] :: // WSystem [["_SystemPowerState" "_SystemShutDown" nil] "Power for MS Windows system only" MASTER_CHECK_OPTIONAL nil] :: // Science [["_scienceDateLeapYear" "_scienceMathsEquation2nd" "_scienceWeatherMetarDatasSet"] "Scientific functions" MASTER_CHECK_OPTIONAL "libscience"] :: nil -> list in let hd switchstri strextr _loadusmini nil "checkLibraryNumber" -> szNumber in let if (szNumber == nil) then 0 else let atoi szNumber -> iNumber in if iNumber > 3 then 2 else if iNumber > 0 then iNumber-1 else 0 -> number in master_checkLibraries2 list number;; fun masterNextFinish (p)= _script mkscript Smain [p];; fun mainNextCommon ()= _load "locked/update.pkg"; _load "locked/masterse.pkg"; _load "locked/lib/_mlistlib.pkg"; _load "locked/lib/stdlib.pkg"; 0;; fun mainNextFull ()= mainNextCommon; _load "locked/voyager/settings.pkg"; _load "locked/voyager/addressbar.pkg"; 0;; fun mainInit ()= _load "locked/var.pkg"; _load "locked/common.pkg"; 0;; /* _isFirstScol Main function called by the VM, after its loading */ fun main(p)= set env_ref = _envchannel _channel; mainInit; /* $iri toggle : - mini voyager if one or several libraries are missing - full voyager if all library seem ok */ let hd switchstri strextr _loadusmini nil "checkLibrary" -> szLibray in if ((szLibray != nil) && ((atoi szLibray) == 1)) then ( _load "locked/voyager/guiCheckLibraries.pkg"; guiCLmain master_checkLibraries p; 0 ) else ( mainNextFull; masterNextFinish p ); 0;; fun master_cancel ()= _closemachine;; fun master_chgusm2 (l, key, b, s, k)= if l==nil then if k then s::nil else nil else let l->[ll n] in let hd strextr ll -> [h [hh _]] in if (!strcmpi h key)&&((b==nil)||(!strcmpi b substr hh 0 strlen b)) then s::master_chgusm2 n key b s 0 else ll::master_chgusm2 n key b s k;; fun master_chgusm(list, usm, key)= if list == nil then 0 else let hd list -> line in ( _saveusmini linebuild master_chgusm2 usm key nil line 1; master_chgusm tl list usm key );; /* search if a line is a comment (1) or not (0). If not found, return nil */ fun master_getUsmState2 (list, line)= if list == nil then nil else let hd list -> curLine in let strfindi line curLine 0 -> pos in if nil != pos then let strfind "#" curLine 0 -> pos2 in if ((pos2 != nil) && (pos < pos2)) then 1 // comment (# before the line) else 0 // no comment else master_getUsmState2 tl list line;; fun master_chgLineState (line, state)= if state == 1 then let strfind "#" line 0 -> pos in strtrim substr line pos+1 strlen line else strtrim strcat "#" line;; fun master_setLibrairies2 (list)= if list == nil then nil else let hd list -> [libname state] in let if _platform == 0 then ".dll" else ".so" -> ext in // todo : macOS X let strcatn "plugin ./plugins/" :: libname :: ext :: nil -> line in let master_getUsmState2 lineextr _loadusmini nil line -> curIsComment in let if state == (!curIsComment) then master_chgLineState line state else line -> lineOk in lineOk :: master_setLibrairies2 tl list;; fun master_setLibrairies (list, cFull, p)= /* désactivé pour l'instant master_chgusm master_setLibrairies2 list lineextr _loadusmini nil "plugin";*/ let if cFull == 1 then "1" else "0" -> mode in let strbuild ("fullLoading"::mode::nil)::nil -> loadmode in master_chgusm loadmode :: nil lineextr _loadusmini nil "fullLoading"; mainNextFull; masterNextFinish p;;