PB動態腳本解釋器

 

PB動態腳本解釋器

       當你看到VB、VFP等開發語言提供的強大的宏執行功能,是不是很羨慕呢?當你尋遍PB的幫助、關於PB開發的書籍或網站而不可得的時候,是不是感到有一絲的遺憾?如果你看到這篇文章,你應該感到振奮,因爲你終於可以解決這個問題,而且解決問題的思路既是如此簡單、代碼既是如此簡短。如果再加上你的智慧,應該比我的解決方法更漂亮。        先讓我們來了解一些基本知識。

一.代碼的載體

在PB中,只有三個地方可以存放代碼,那就是函數、事件、屬性。這裏所指的函數包括有返回值的通常意義下的函數和無返回值的過程以及聲明的WINAPI函數,所指的事件指在對象中定義的處理程序,所指的屬性指PB系統屬性之外的實例變量、共享變量、全局變量。函數和事件是可以用來調用執行的,屬性則只能用來賦值和取值。通常我們是在函數或事件中編寫代碼。

二.對象的創建

如果對象類型是已知的,可以使用CREATE o b j e c ttype 來創建對象,如果對象類型是動態的,可以使用CREATE USING o b j e c ttypestring來創建對象。

三.對象函數的調用方式      

如果調用一個已知類型的對象的函數或事件,通常採用靜態模式,也可採用動態模式,如果調用一個動態創建的對象的函數或事件,則必須採用動態模式,否則編譯出錯。採用動態模式調用函數是在函數前加dynamic 關鍵字。讀者可查閱PB幫助。

四.庫文件的搜索

PB中用於編程的對象是保存在PBL、PBD、DLL中的,如果想要使庫文件中的對象在應用程序運行時有效,常用的方法是直接將該PBL編譯進去或者說使該PBL在庫搜索列表中。如果需要在運行狀態下改變庫文件搜索列表,PB提供了SetLibraryList和AddToLibraryList兩個函數。SetLibraryList函數只能在應用對象的open事件腳本中使用,否則應用程序會崩潰,AddToLibraryList爲PB9新增的函數,用於將新文件加入到庫文件搜索列表中,這兩個函數都是只能在編譯環境下有效。

五.PB庫文件的創建與銷燬

PB提供了LibraryCreate函數用於創建庫文件,提供LibraryDelete、FileDelete函數用於刪除庫文件。

六.PB實體的導入

PB提供了LibraryImport函數用於根據對象語法創建PB實體並導入到庫文件中,但該函數目前只支持數據窗口對象類型的導入。不過,PB提供了相應的WINAPI函數支持其它類型實體的導入,這些相關的WINAPI包括在PBORCX0.DLL中(不同的PB版本有不同的文件名稱,如PBORC90.DLL、PBORC80.DLL)。有關實體的導入的WINAPI包括PBORCA_SessionOpen、PBORCA_SessionClose、PBORCA_SessionSetLibraryList、PBORCA_SessionSetCurrentAppl、PBORCA_CompileEntryImport等,讀者可以到Sybase網站找ORCA Guide相應文章尋求支持。

七.PB實體的查找使用FindClassDefinition或FindFunctionDefinition或LibraryDirectory可以在庫文件中查找PB實體是否存在,使用FindClassDefinition或FindFunctionDefinition性能要好。

以下講開發思路。

一.創建臨時庫文件

1.       取臨時目錄作爲庫文件的存放目錄

2.       取待創建的臨時庫文件名稱,保證不與已有文件重名

3.       使用LibraryCreate函數創建臨時庫文件

二.構造用於導入庫文件的臨時PB實體語法

1. 取臨時PB實體名稱,保證不與庫文件列表中已有PB實體重名

2. 構造臨時PB實體語法,區分函數和過程

三.將臨時PB實體導入臨時庫文件

1. 取庫文件列表和應用對象所在pbl

2. 將實際不存在的庫文件從庫文件列表中刪除,目的是使調用PBORCA_SessionSetLibraryList成功

3. 調用PBORCA_CompileEntryImport將臨時PB實體導入臨時庫文件

四.將臨時庫文件加入到庫文件搜索列表

1.調用AddToLibraryList加入新文件到庫文件搜索列表

五.創建臨時PB實體所對應的對象並調用其函數以執行動態腳本

1. 使用CREATE USING o b j e c ttypestring語句創建對象

2. 通過動態調用對象的of_exec函數執行動態腳本,區分返回值類型

六.銷燬所有臨時對象

1.調用LibraryDelete函數刪除創建的臨時庫文件

以下講我在開發時遇到的一些矛盾或問題。

一.代碼是逐行解釋還是讓PB編譯器去解釋有些開發人員試圖對動態腳本自行逐行解釋,這是很困難的事情。一行代碼如果脫離它的語境去執行,可能會產生錯誤的結果,即便你對PB所支持的函數全部做出解釋,使用PB開發出來的對象、函數、事件等,你又如何去解釋?這等同於你要花很大力氣去編寫一個PB編譯器,除非你與PB編譯器的開發團隊合作,否則你很難獲得成功。所以你必須想辦法讓PB編譯器去解釋。既然每行代碼不能脫離其它代碼而執行,那就創建一個函數或事件,讓這個函數或事件包括你想寫的所有代碼。而函數或事件又不能脫離對象而存在,所以你必須想辦法動態創建對象以及函數或事件,對象的聲明必須依賴於庫文件中的PB實體,由此推出關鍵是創建PB實體。

二.如何創建PB實體前面已講過要使用PBORCX0.DLL中的WINAPI函數來創建並導入實體,這項技術並不難,在sybase的網站或隨便狗狗(百度)一下就能出來一大把。

三.創建的PB實體是存放在現有庫文件中還是新文件中再導入我最初的想法是放在現有庫文件中,這樣就不必花費時間在創建庫文件和刪除庫文件的執行上,結果發現,創建是成功,但運行時PB就是不“認識”我創建的PB實體,一創建該實體的對象就報錯,想來PB在程序啓動時就讀取庫文件中有哪些實體形成列表,在沒有改變庫文件列表之前,其實體列表不會改變,這樣對新建的實體就視而不見了。所以我不得不試着新建一個PBL,在新建的PBL中創建PB實體,然後使用AddToLibraryList將新建的PBL包括進來,這一試果然成功。

四.使用數據窗口的Describe調用全局函數還是其它方式來取得返回值大家都知道,使用數據窗口的Describe函數可以調用全局函數,但是它有很多的侷限性,全局函數必須有簡單類型的返回值,所有參數只能是簡單數據類型而且不能通過參考傳值。如果在需要調用的地方直接使用新建對象的函數將不受這些限制。

五.如何進行垃圾對象的清理既然每次執行動態腳本要創建PB實體,如果執行得多了,就有很多垃圾對象,所以應進行清理。可以通過LibraryDelete函數或FileDelete刪除庫文件。有意思的是,一旦創建PB實體,即便你刪除了,使用FindClassDefinition或FindFunctionDefinition還是能夠找到,但你想使用該實體創建對象則失敗,這再次說明PB在程序啓動時就讀取庫文件中有哪些實體形成列表,在沒有改變庫文件列表之前,其實體列表不會改變。

以下是所附代碼的幾點說明

一.所附代碼是在PB9環境下開發的,程序運行時必須有PBORC90.DLL,如果改成PB其它版本,請將nvo_pbcompiler中WINAPI函數所使用的動態庫做相應修改。

二.nvo_pbcompiler用於創建PB實體,這是PB動態腳本解釋器的核心函數;f_execpbscript()用於執行一段PB腳本的樣例代碼函數,返回值類型爲字符串,如果要使用到其它場合,讀者可自行編寫函數,思路類似;w_pbcompiler_test爲一個用來執行PB腳本的樣例界面窗口;其它函數有各自功能。

三.如果想運行PB動態腳本編譯器,請先將所有代碼分對象導入庫文件,然後編譯,PB動態腳本編譯器在PB開發環境下無效。

四.爲了程序方面的簡化,有些所使用的全局函數請參考作者的其它文章。

五.所附代碼僅爲腳本沒有參數的情況下有效,如果你想代碼有參數,只需要簡單地對腳本語法作些改變就可,當然前臺需要用戶定義參數。

六.本PB動態腳本解釋器可執行所有有效的PB代碼,例如訪問全局變量、使用PB所有的系統函數、使用程序員開發的自定義函數、打開窗口、訪問菜單、使用數據窗口等。

七.通常將本PB動態腳本解釋器嵌入到現有的使用PB開發出來的系統而不是單獨使用,這樣可以加載很多免編譯的外掛程序。

八.如果再拓寬它的應用範圍,你甚至可以做到只需要一個框架程序,其它代碼全部動態加載和執行,這樣就只需一次編譯,升級和維護就變得非常簡單,不過你要考慮系統的可用性、系統性能和系統的穩定性等。

附完整源代碼
一.pbcompiler
$PBExportHeader$pbcompiler.sra
$PBExportComments$PB動態腳本解釋器應用對象
forward
global type pbcompiler from application
end type
global transaction sqlca
global dynamicdescriptionarea sqlda
global dynamicstagingarea sqlsa
global error error
global message message
end forward
global variables
end variables
global type pbcompiler from application
string appname = "pbcompiler"
end type
global pbcompiler pbcompiler
on pbcompiler.create
appname="pbcompiler"
message=create message
sqlca=create transaction
sqlda=create dynamicdescriptionarea
sqlsa=create dynamicstagingarea
error=create error
end on
on pbcompiler.destroy
destroy(sqlca)
destroy(sqlda)
destroy(sqlsa)
destroy(error)
destroy(message)
end on
event open;open(w_pbcompiler_test)
end event
二.f_execpbscript
$PBExportHeader$f_execpbscript.srf
$PBExportComments$執行動態腳本的樣例函數
global type f_execpbscript from function_object
end type
forward prototypes
global function string f_execpbscript (string as_returntype, string as_pbscript)
end prototypes
global function string f_execpbscript (string as_returntype, string as_pbscript);/*******************************************************************
函數名稱:f_execpbscript()
參數:     as_returntype string 返回值類型
          as_pbscript string 動態代碼
返回值:  string 用戶自定義或錯誤信息
功能描述:執行動態代碼(只返回字符串)
創建人:  康劍民
創建日期:2007-02-12
版本號:  V1.0
*******************************************************************/
nvo_pbcompiler lnv_pbcompiler
nonvisualobject luo_pbcompiler
string ls_entryname,ls_libraryname
string ls_return
any la_return
lnv_pbcompiler = create nvo_pbcompiler
//創建實體對象
if lnv_pbcompiler.of_createentry(as_returntype,as_pbscript,ls_libraryname,ls_entryname) = 1 then
 if not isnull(FindClassDefinition(ls_entryname) ) then
  luo_pbcompiler = create using ls_entryname
  choose case lower(as_returntype)
  case 'any','blob','boolean','char','character','date','datetime','dec','decimal','double','int','integer','long','real','string','time','uint','ulong','unsignedint','unsignedinteger','unsignedlong'
   la_return = luo_pbcompiler.dynamic of_exec()//執行動態代碼
   ls_return = string(la_return)
  case '','none'
   luo_pbcompiler.dynamic of_exec()//執行動態代碼
   ls_return = "none"
  case else
   luo_pbcompiler.dynamic of_exec()//執行動態代碼
   ls_return = "result is disabled"
  end choose
  if isvalid(luo_pbcompiler) then destroy luo_pbcompiler
 else
  ls_return = "error"
 end if
else
 ls_return = "error"
end if
if isvalid(lnv_pbcompiler) then destroy lnv_pbcompiler
LibraryDelete(ls_libraryname)
return ls_return
end function
三.f_parse
$PBExportHeader$f_parse.srf
$PBExportComments$分解字符串到數組
global type f_parse from function_object
end type
forward prototypes
global function long f_parse (readonly string as_text, readonly string as_sep, ref string as_list[])
end prototypes
global function long f_parse (readonly string as_text, readonly string as_sep, ref string as_list[]);/*******************************************************************
函數名稱:f_parse()
參數:     as_text string 來源字符串
          as_sep string 分隔字符
    as_list[] ref string 分析後形成的字符串數組
返回值:  long 分析後形成的數組元素個數
功能描述:分析字符串到一個數組中
創建人:  康劍民
創建日期:2002-11-19
版本號:  V1.0
*******************************************************************/
long i,ll_pos
string ls_null[],ls_text
ls_text = as_text
as_list = ls_null
i=0
ll_pos = posw(lower(ls_text),lower(as_sep))
do while ll_pos > 0 
 i ++ 
 as_list[i]=leftw(ls_text,ll_pos - 1)
 ls_text=midw(ls_text,ll_pos + lenw(as_sep),lenw(ls_text))
 ll_pos = posw(lower(ls_text),lower(as_sep)) 
loop
as_list[i + 1] = ls_text
return upperbound(as_list[])
end function
四.f_replacetext
$PBExportHeader$f_replacetext.srf
$PBExportComments$替換字符串
global type f_replacetext from function_object
end type
forward prototypes
global function string f_replacetext (readonly string as_source, readonly string as_oldtag, readonly string as_newtag, readonly long al_seq)
end prototypes
global function string f_replacetext (readonly string as_source, readonly string as_oldtag, readonly string as_newtag, readonly long al_seq);/*******************************************************************
函數名稱:f_replacetext()
參數:     as_source string 源字符串
          as_oldtag string 待替換特徵字符串
    as_newtag string 替換後特徵字符串
    al_seq long 第幾個特徵替換字符串需替換,0表示全部
返回值:  string 替換後字符串
功能描述:用一特徵字符串替換指定字符串中的特徵字符串,參數al_seq=0時表示全部替換
創建人:  康劍民
創建日期:2002-11-19
版本號:  V1.0
*******************************************************************/
long ll_start_pos=1,ll_len_old_tag,i = 0
string ls_left,ls_return='',ls_source=''
ls_source = as_source
ll_len_old_tag = lenw(as_oldtag)
ll_start_pos = posw(lower(ls_source),lower(as_oldtag),1)
if al_seq = 0 then
 DO WHILE ll_start_pos > 0
  ls_left = leftw(ls_source,ll_start_pos - 1) + as_newtag
  ls_return = ls_return + ls_left
  ls_source = midw(ls_source,ll_start_pos + lenw(as_oldtag),lenw(ls_source))
  ll_start_pos = posw(lower(ls_source),lower(as_oldtag),1)
 LOOP
elseif al_seq > 0 then
 DO WHILE ll_start_pos > 0
  i ++
  if al_seq = i then 
   ls_left = leftw(ls_source,ll_start_pos - 1) + as_newtag
   ls_return = ls_return + ls_left
   ls_source = midw(ls_source,ll_start_pos + lenw(as_oldtag),lenw(ls_source))
   ll_start_pos = posw(lower(ls_source),lower(as_oldtag),1)
  end if
 loop
end if
ls_return = ls_return + ls_source
return ls_return
end function
五.nvo_pbcompiler
$PBExportHeader$nvo_pbcompiler.sru
$PBExportComments$PB動態腳本解釋器
forward
global type nvo_pbcompiler from nonvisualobject
end type
end forward
global type nvo_pbcompiler from nonvisualobject
end type
global nvo_pbcompiler nvo_pbcompiler
type prototypes
//打開一個會話
Function long SessionOpen () Library "PBORC90.DLL" Alias for "PBORCA_SessionOpen"
//關閉一個會話
Subroutine SessionClose ( long hORCASession ) Library "PBORC90.DLL" Alias for "PBORCA_SessionClose"
//設置當前會話的庫清單
Function int SessionSetLibraryList ( long hORCASession, ref string pLibNames[], int iNumberOfLibs) Library "PBORC90.DLL" Alias for "PBORCA_SessionSetLibraryList"
//設置當前會話對應的應用
Function int SessionSetCurrentAppl ( long hORCASession, string lpszApplLibName, string lpszApplName ) Library "PBORC90.DLL" Alias for "PBORCA_SessionSetCurrentAppl"
//導入並編譯實體
Function int CompileEntryImport ( long hORCASession, string lpszLibraryName, string lpszEntryName, long otEntryType, string lpszComments, string lpszEntrySyntax, long lEntrySyntaxBuffSize, long pCompErrorProc, long pUserData ) Library "PBORC90.DLL" Alias for "PBORCA_CompileEntryImport"
//取臨時目錄
Function long GetTempPath(long nBufferLength, ref string lpBuffer)  Library "kernel32" Alias for "GetTempPathA" 
//獲取一個已裝載模板的完整路徑名稱
FUNCTION ulong GetModuleFileName(ulong hModule,ref string lpFileName,ulong nSize) LIBRARY "kernel32.dll" ALIAS FOR "GetModuleFileNameA"
end prototypes
type variables
end variables
forward prototypes
public function string of_gettemppath ()
public function string of_getapppath ()
public function integer of_createentry (string as_returntype, string as_pbscript, ref string as_libraryname, ref string as_entryname)
end prototypes
public function string of_gettemppath ();/*******************************************************************
函數名稱:of_gettemppath()
參數:     無
返回值:  string 臨時路徑
功能描述:取臨時路徑
創建人:  康劍民
創建日期:2006-12-26
版本號:  V1.0
*******************************************************************/
string ls_path
ulong lu_size=256
ls_path=space(256)
GetTempPath(lu_size,ls_path)
return trimw(ls_path)
end function
public function string of_getapppath ();/*******************************************************************
函數名稱:of_getapppath()
參數:     無
返回值:  string 應用程序路徑
功能描述:取應用程序路徑
創建人:  康劍民
創建日期:2002-11-22
版本號:  V1.0
*******************************************************************/
string ls_apppath
ls_apppath=space(256)
GetModuleFileName(Handle(GetApplication()),ls_apppath,256)
ls_apppath=Reverse(ls_apppath)
ls_apppath=Reverse(midw(ls_apppath,posw(ls_apppath,'\',1)))
return ls_apppath
end function
public function integer of_createentry (string as_returntype, string as_pbscript, ref string as_libraryname, ref string as_entryname);/*******************************************************************
函數名稱:of_createentry()
參數:     as_returntype string 返回值類型
          as_pbscript string 動態代碼
    as_libraryname ref string 創建的庫文件名稱
    as_entryname ref string 創建的實體名稱
返回值:  long 是否成功(1表示成功,-1表示失敗)
功能描述:根據動態代碼創建實體
創建人:  康劍民
創建日期:2007-02-12
版本號:  V1.0
*******************************************************************/
long ll_sid//會話編號
long ll_index//對象序號
string ls_librarylist[]//庫文件列表
string ls_librarylist_tmp[]//庫文件列表(臨時)
string ls_temp_libraryname//臨時庫文件名稱
string ls_temp_path//臨時目錄
string ls_syntax//實體語法
string ls_app_libraryname//應用程序所在庫文件名稱
integer li_result//結果
string ls_entryname//對象名稱
classdefinition lcd_app//應用程序類定義對象
string ls_librarylist_files//庫文件
integer i,j//臨時變量
//開發環境下直接退出
if handle(GetApplication()) <= 0 then return -1
//取庫文件列表
ls_librarylist_files = getlibrarylist ()
//取應用對象所在pbl
lcd_app = getapplication().classdefinition
ls_app_libraryname = lcd_app.libraryname
ls_temp_path = this.of_gettemppath( )//取臨時目錄
//取待創建的臨時庫文件名稱
ll_index = 1
ls_temp_libraryname = ls_temp_path + "temp"+string(ll_index) + ".pbl"
do while fileexists(ls_temp_libraryname) or posw(","+ls_librarylist_files+",",","+ls_temp_libraryname+",") > 0
 ll_index ++
 ls_temp_libraryname = ls_temp_path + "temp"+string(ll_index) + ".pbl"
loop
//創建臨時庫文件
LibraryCreate(ls_temp_libraryname,"臨時庫文件")
f_parse(ls_librarylist_files,',',ls_librarylist)//分解字符串到數組
//判斷庫文件是否存在並形成新列表
j = 0
for i = 1 to upperbound(ls_librarylist)
 if fileexists(ls_librarylist[i]) then
  j ++
  ls_librarylist_tmp[j] = ls_librarylist[i]
 end if
next
ls_librarylist = ls_librarylist_tmp
ls_librarylist[upperbound(ls_librarylist)+1] = ls_temp_libraryname
ll_sid = SessionOpen()//打開一個會話
//設置當前會話的庫清單
li_result = SessionSetLibraryList (ll_sid, ls_librarylist, upperbound(ls_librarylist))
if li_result = 0 then     
 //設置當前會話對應的應用
 li_result = SessionSetCurrentAppl (ll_sid, ls_app_libraryname, getapplication().appname )
   if li_result = 0 then      
  //取實體名稱(保證不重複)
  ll_index = 1
  do while not isnull(FindClassDefinition("nvo_"+string(ll_index)))
   ll_index ++
  loop
  ls_entryname = "nvo_"+string(ll_index)
  //實體聲明
  ls_syntax = "$PBExportHeader$"+ls_entryname+".sru"+"~r~n"&
    + "forward"+"~r~n"&
    + "global type "+ls_entryname+" from nonvisualobject"+"~r~n"&
    + "end type"+"~r~n"&
    + "end forward"+"~r~n"&
    + "~r~n"&
    + "global type "+ls_entryname+" from nonvisualobject"+"~r~n"&
    + "end type"+"~r~n"&
    + "global "+ls_entryname+" "+ls_entryname+""+"~r~n"&
    + "~r~n"&     
    + "forward prototypes"+"~r~n" 
  //區分函數還是過程
  if trimw(lower(as_returntype)) = 'none' or trimw(lower(as_returntype)) = '' then
   ls_syntax = ls_syntax + "public subroutine of_exec ()"+"~r~n"&
    + "end prototypes"+"~r~n"&
    + "~r~n"&
    + "public subroutine of_exec ();"+as_pbscript+"~r~n"&
    + "end subroutine"
  else
   ls_syntax = ls_syntax + "public function " + as_returntype + " of_exec ()"+"~r~n"&
    + "end prototypes"+"~r~n"&
    + "~r~n"&
    + "public function " + as_returntype + " of_exec ();"+as_pbscript+"~r~n"&
    + "end function"
  end if
  //實體語法尾部
  ls_syntax = ls_syntax + "~r~n" + "on " + ls_entryname + ".create"+"~r~n"&
   + "call super::create"+"~r~n"&
   + "TriggerEvent( this, ~"constructor~" )"+"~r~n"&
   + "end on"+"~r~n"&
   + "~r~n"&
   + "on " + ls_entryname + ".destroy"+"~r~n"&
   + "TriggerEvent( this, ~"destructor~" )"+"~r~n"&
   + "call super::destroy"+"~r~n"&
   + "end on"
  //導入並編譯實體
  li_result = CompileEntryImport (ll_sid, ls_temp_libraryname, ls_entryname, 6 , "comment - new object", ls_syntax, len(ls_syntax), 0, 0 )
   end if
end if
SessionClose(ll_sid)//關閉一個會話
as_libraryname = ls_temp_libraryname
as_entryname=ls_entryname
//加入新文件到庫文件搜索列表
AddToLibraryList(ls_temp_libraryname)
if li_result = 0 then
 return 1
else
 return -1
end if
end function
on nvo_pbcompiler.create
call super::create
TriggerEvent( this, "constructor" )
end on
on nvo_pbcompiler.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on
六.w_pbcompiler_test
$PBExportHeader$w_pbcompiler_test.srw
$PBExportComments$PB動態腳本解釋器測試窗口
forward
global type w_pbcompiler_test from window
end type
type st_returnvalue from statictext within w_pbcompiler_test
end type
type st_returntype from statictext within w_pbcompiler_test
end type
type st_script from statictext within w_pbcompiler_test
end type
type sle_returnvalue from singlelineedit within w_pbcompiler_test
end type
type cb_exit from commandbutton within w_pbcompiler_test
end type
type sle_returntype from singlelineedit within w_pbcompiler_test
end type
type mle_script from multilineedit within w_pbcompiler_test
end type
type cb_ok from commandbutton within w_pbcompiler_test
end type
end forward
global type w_pbcompiler_test from window
integer width = 1979
integer height = 1100
boolean titlebar = true
string title = "PB腳本解釋器(測試)"
boolean controlmenu = true
boolean minbox = true
boolean maxbox = true
boolean resizable = true
long backcolor = 67108864
string icon = "AppIcon!"
boolean center = true
st_returnvalue st_returnvalue
st_returntype st_returntype
st_script st_script
sle_returnvalue sle_returnvalue
cb_exit cb_exit
sle_returntype sle_returntype
mle_script mle_script
cb_ok cb_ok
end type
global w_pbcompiler_test w_pbcompiler_test
type prototypes
end prototypes
type variables
end variables
on w_pbcompiler_test.create
this.st_returnvalue=create st_returnvalue
this.st_returntype=create st_returntype
this.st_script=create st_script
this.sle_returnvalue=create sle_returnvalue
this.cb_exit=create cb_exit
this.sle_returntype=create sle_returntype
this.mle_script=create mle_script
this.cb_ok=create cb_ok
this.Control[]={this.st_returnvalue,&
this.st_returntype,&
this.st_script,&
this.sle_returnvalue,&
this.cb_exit,&
this.sle_returntype,&
this.mle_script,&
this.cb_ok}
end on
on w_pbcompiler_test.destroy
destroy(this.st_returnvalue)
destroy(this.st_returntype)
destroy(this.st_script)
destroy(this.sle_returnvalue)
destroy(this.cb_exit)
destroy(this.sle_returntype)
destroy(this.mle_script)
destroy(this.cb_ok)
end on
type st_returnvalue from statictext within w_pbcompiler_test
integer x = 9
integer y = 608
integer width = 297
integer height = 60
integer textsize = -9
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "返回值:"
boolean focusrectangle = false
end type
type st_returntype from statictext within w_pbcompiler_test
integer x = 9
integer y = 476
integer width = 297
integer height = 60
integer textsize = -9
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "返回值類型:"
boolean focusrectangle = false
end type
type st_script from statictext within w_pbcompiler_test
integer x = 9
integer y = 12
integer width = 206
integer height = 60
integer textsize = -9
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "PB腳本:"
boolean focusrectangle = false
end type
type sle_returnvalue from singlelineedit within w_pbcompiler_test
integer x = 334
integer y = 608
integer width = 1582
integer height = 104
integer taborder = 30
integer textsize = -9
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
borderstyle borderstyle = stylelowered!
end type
type cb_exit from commandbutton within w_pbcompiler_test
integer x = 1664
integer y = 856
integer width = 242
integer height = 104
integer taborder = 50
integer textsize = -9
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
string text = "退出"
end type
event clicked;close(parent)
end event
type sle_returntype from singlelineedit within w_pbcompiler_test
integer x = 334
integer y = 476
integer width = 1582
integer height = 104
integer taborder = 20
integer textsize = -9
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
borderstyle borderstyle = stylelowered!
end type
type mle_script from multilineedit within w_pbcompiler_test
integer x = 334
integer y = 12
integer width = 1582
integer height = 432
integer taborder = 10
integer textsize = -9
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
boolean vscrollbar = true
boolean autovscroll = true
borderstyle borderstyle = stylelowered!
end type
type cb_ok from commandbutton within w_pbcompiler_test
integer x = 1417
integer y = 856
integer width = 242
integer height = 104
integer taborder = 40
integer textsize = -9
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
string text = "執行"
end type
event clicked;sle_returnvalue.text = f_execpbscript(sle_returntype.text,mle_script.text)
end event
寫作日期:2007-03-31

 

發佈了96 篇原創文章 · 獲贊 47 · 訪問量 98萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章