home *** CD-ROM | disk | FTP | other *** search
/ Treasure Hunt 2001 PRESSKIT / TH2001_PRESSKIT.iso / demo / scol_install / Partition / locked / stdapplt.pkg < prev    next >
Encoding:
Text File  |  2000-11-09  |  2.8 KB  |  1 lines

  1.   typeof ch=Chn;; fun getInfo(l,a)= if l==nil then nil else let l->[q nxt] in if !strcmp hd q a then hd tl q else getInfo nxt a;; fun _end(a,b,r)=_closemachine;;  typeof sizetoload=I;; fun _endApplet()= _DLGrflmessage _DLGMessageBox _channel win loc "ERROR" loc "ERRAPP" 0 @_end 0; 0;; fun _paintevent(a,b)= _BLTbitmap win barre 5 75;0;; fun _destroyevent(a,b)=_closemachine;; fun startWin(txt)= _SETtext message txt;; fun setSize(i)=set sizetoload=if i>0 then i else 1;; fun drawBarre(i)= _DRAWrectangle barre 5 5 min 290 290*i/sizetoload 10 DRAW_INVISIBLE 0 0 DRAW_SOLID 0xff0000; _paintevent nil nil;;  var Flag_munzip=1;; var Flag_unzip=2;; typeof curtext=S;; fun newurl(url)= if strcmpi _getress "Firewall" "strong" then url else let 2+strfind "//" url 0 -> i in if i==nil then url else let strfind "/" url i -> j in let if j==nil then [url nil] else [substr url 0 j substr url j strlen url] ->[pref suff] in let strfind ":" pref i -> k in strcat (if k==nil then pref else strcat strcat substr pref 0 k ":" _getress "FirewallPort") suff;; fun cb(inet,z,s,reason)= if reason==0 then (set curtext=strcat curtext s; drawBarre strlen curtext) else if reason==1 then (set curtext=strcat curtext s; drawBarre strlen curtext; let z->[f type sgn name] in let if type&Flag_munzip then munzip curtext else if type&Flag_unzip then unzip curtext else curtext -> cont in if (sgn!=nil)&&(strlen sgn)&& strcmp sgn _getlongname cont "" "#" then exec f with [nil] else if name==nil then exec f with [cont] else (_storepack cont name; exec f with [name]) ) else let z->[f _ _ _] in exec f with [nil];; fun getUrl(url,f,type,sgn,name,size)= startWin strloc loc "DOWNL" name::(itoa (size>>10))::nil; setSize size; drawBarre 0; set curtext=""; let INETGetURL ch newurl url 0 @cb [f type sgn name] -> url in if url==nil then exec f with [nil] else 0;; fun chkPkg(url,f,type,sgn,name,size)= let _getpack _checkpack name -> cont in if !strcmp _getlongname cont "" "#" sgn then exec f with [name] else getUrl url f type sgn name size;; proto applyApplet=fun [[[S r1]r1]] I;; fun getApplet2(s,l)= if s==nil then _endApplet else applyApplet l;; fun applyApplet(l)= if l==nil then _endApplet else let l->[a n] in let a->[url [name[size[type[sgn _]]]]] in if url==nil then applyApplet n else if (!strcmp "http://" substr url 0 7)||(!strcmp "ftp://" substr url 0 6) then chkPkg url (mknode @getApplet2 n) atoi type sgn name atoi size else if !strcmp "script" url then (_DSwindow win; _DSbitmap barre;  _setrights rights; _setenv _channel nil; _script strbuild n; 0) else if !strcmp "versionmin" url then if _version<atoi name then __badversion else applyApplet n else applyApplet n;; fun getApplet(s)= if s==nil then _endApplet else let strextr s -> l in applyApplet l;; fun main(url,size)=  _cacheActivate; _refine _getress "License"; set ch=_channel; chkPkg url @getApplet 0 "" nil atoi size;;