Source code exported by pbkiller: Batch repair and batch import technology)

Source: Internet
Author: User
Source code exported by pbkiller: Batch repair and batch import technology

Original: http://itmed.blog.sohu.com/96898840.html published in author of deep blue without fear

 

 

1 pbkiller can be used to export "*. Sr?" from PBD? "This type of file, but cannot be exported directly.
2 due to Pb import "*. Sr? ", Due to the dependency between (1) classes, if the parent class of A is B, the pilot a cannot (2) the source code exported by pbkiller has some source code errors.
3. In view of the above situation, I wrote the serach and replace script to replace the error syntax.
4. A batch import "*. Sr? "Program, written in Pb, decompiled with pbkiller, but there is a decompilation Error
5 from 4 to 4, we used pborc80.dll and OD to track the import objects of Pb, obtained the function parameters used for Pb import, and fixed the decompilation error.
========================================================== ================
The following is the regular expression replacement script of serch and replace, which fixes some source code errors exported by pbkiller.
Getclassdefinition/(/) to replace classdefinition

Getscriptlist/(/) replace scriptlist

Getscript/(1,/[* []/). getname/()/replace scriptlist/[% 1/]. Name

Getvariablelist /(/)

Getvariable/(1,/[* []/). getname/()/replace variablelist/[% 1/]. Name

Getargumentlist /(/)

Getargument/(1,/[* []/). getname/()/replace argumentlist/[% 1/]. Name

Getlocalvariablelist /(/)

Getlocalvariable/(1,/[* []/). getname/()/replace localvariablelist/[% 1/]. Name

/? /? /? /? /? = L? _ * [] $ Replace % 2 = l % 1 _ % 2

, "+", + ./? /? /? /? /? (, |/) Replacement, "% 1", % 2.% 1% 3

/(+/) + /! MessageBox /(/? /? /? /? /? /) Replace MessageBox/("", % 1, % 2 /! /)

,/[+/] (, |/) Replace, {% 1} % 2
========================================================== ================
The following is the core function for Pb import. You can write a batch to import source code one by one.
Forward
Global Type n_cst_pborc from nonvisualobject
End type
End forward

Global Type n_cst_pborc from nonvisualobject autoinstantiate
End type
Global n_cst_pborc

Type prototypes
Public Function long sessionopen7 () Library "pborc70.dll" alias for "pborca_sessionopen"
Public subroutine sessionclose7 (long horcasession) Library "pborc70.dll" alias for "pborca_sessionclose"
Public Function Integer sessionsetlibrarylist7 (long horcasession, ref string plibnames [], integer inumberoflibs) Library "pborc70.dll" alias for "pborca_sessionsetlibrarylist"
Public Function Integer sessionsetcurrentappl7 (long horcasession, string lpszappllibname, string lpszapplname) Library "pborc70.dll" alias for "pborca_sessionsetcurrentappl"
Public Function Integer libraryentryexport7 (long horcasession, string lpszlibraryname, string lpszentryname, long otentrytype, ref string lpszexportbuffer, long lexportbuffersize) Library "pborc70.dll" alias for "login"
Public Function Integer evaluate (long horcasession, string lpszlibraryname, string lpszentryname, long otentrytype, string lpszcomments, string lpszentrysyntax, long lentrysyntaxbuffsize, long pcomperrorproc, long puserdata) library "pborc70.dll" alias for "pborca_compileentryimport"
Public Function long sessionopen8 () Library "pborc80.dll" alias for "pborca_sessionopen"
Public subroutine sessionclose8 (long horcasession) Library "pborc80.dll" alias for "pborca_sessionclose"
Public Function Integer sessionsetlibrarylist8 (long horcasession, ref string plibnames [], integer inumberoflibs) Library "pborc80.dll" alias for "pborca_sessionsetlibrarylist"
Public Function Integer sessionsetcurrentappl8 (long horcasession, string lpszappllibname, string lpszapplname) Library "pborc80.dll" alias for "pborca_sessionsetcurrentappl"
Public Function Integer libraryentryexport8 (long horcasession, string lpszlibraryname, string lpszentryname, long otentrytype, ref string lpszexportbuffer, long lexportbuffersize) Library "pborc80.dll" alias for "external"
Public Function Integer evaluate (long horcasession, string lpszlibraryname, string lpszentryname, long otentrytype, string lpszcomments, string lpszentrysyntax, long lentrysyntaxbuffsize, long pcomperrorproc, long puserdata) library "pborc80.dll" alias for "pborca_compileentryimport"
Public Function long sessionopen9 () Library "pborc90.dll" alias for "pborca_sessionopen"
Public subroutine sessionclose9 (long horcasession) Library "pborc90.dll" alias for "pborca_sessionclose"
Public Function Integer sessionsetlibrarylist9 (long horcasession, ref string plibnames [], integer inumberoflibs) Library "pborc90.dll" alias for "pborca_sessionsetlibrarylist"
Public Function Integer sessionsetcurrentappl9 (long horcasession, string lpszappllibname, string lpszapplname) Library "pborc90.dll" alias for "pborca_sessionsetcurrentappl"
Public Function Integer libraryentryexport9 (long horcasession, string lpszlibraryname, string lpszentryname, long otentrytype, ref string lpszexportbuffer, long lexportbuffersize) Library "pborc90.dll" alias for "future"
Public Function Integer evaluate (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"
Public Function long sessionopen10 () Library "pborc100.dll" alias for "pborca_sessionopen"
Public subroutine sessionclose10 (long horcasession) Library "pborc100.dll" alias for "pborca_sessionclose"
Public Function Integer sessionsetlibrarylist10 (long horcasession, ref string plibnames [], integer inumberoflibs) Library "pborc100.dll" alias for "pborca_sessionsetlibrarylist"
Public Function Integer sessionsetcurrentappl10 (long horcasession, string lpszappllibname, string lpszapplname) Library "pborc100.dll" alias for "pborca_sessionsetcurrentappl"
Public Function Integer libraryentryexport10 (long horcasession, string lpszlibraryname, string lpszentryname, long otentrytype, ref string lpszexportbuffer, long lexportbuffersize) Library "pborc100.dll" alias for "external"
Public Function Integer evaluate (long horcasession, string lpszlibraryname, string lpszentryname, long otentrytype, string lpszcomments, string lpszentrysyntax, long lentrysyntaxbuffsize, long pcomperrorproc, long puserdata) library "pborc100.dll" alias for "pborca_compileentryimport"
Public Function long sessionopen () Library "pborc90.dll" alias for "pborca_sessionopen"
Public subroutine sessionclose (long horcasession) Library "pborc90.dll" alias for "pborca_sessionclose"
Public Function Integer sessionsetlibrarylist (long horcasession, ref string plibnames [], integer inumberoflibs) Library "pborc90.dll" alias for "pborca_sessionsetlibrarylist"
Public Function Integer sessionsetcurrentappl (long horcasession, string lpszappllibname, string lpszapplname) Library "pborc90.dll" alias for "pborca_sessionsetcurrentappl"
Public Function Integer libraryentryexport (long horcasession, string lpszlibraryname, string lpszentryname, long otentrytype, ref string lpszexportbuffer, long lexportbuffersize) Library "pborc90.dll" alias for "Container"
Public Function Integer compileentryimport (long horcasession, string lpszlibraryname, string lpszentryname, long otentrytype, string lpszcomments, string lpszentrysyntax, long syntax, long pcomperrorproc, long puserdata) library "pborc90.dll" alias for "pborca_compileentryimport"
End prototypes

Type Variables
Public long pborca_application
Public long pborca_datawindow = 1
Public long pborca_function = 2
Public long pborca_menu = 3
Public long pborca_query = 4
Public long pborca_structure = 5
Public long pborca_userobject = 6
Public long pborca_window = 7
Public long pborca_pipeline = 8
Public long pborca_project = 9
Public long pborca_proxyobject = 10
Public long pborca_binary = 11
Public integer pborca_ OK
Public long pborca_invalidparms =-1
Public long pborca_dupoperation =-2
Public long pborca_objnotfound =-3
Public long pborca_badlibrary =-4
Public long pborca_liblistnotset =-5
Public long pborca_libnotinlist =-6
Public long pborca_libioerror =-7
Public long pborca_objexists =-8
Public long pborca_invalidname =-9
Public long pborca_buffertoosmall =-10
Public long pborca_comperror =-11
Public long pborca_linkerror =-12
Public long pborca_currapplnotset =-13
Public long pborca_objhasnoancs =-14
Public long pborca_objhasnorefs =-15
Public long pborca_pbdcounterror =-16
Public long pborca_pbdcreaterror =-17
Public long pborca_checkouterror =-18
End Variables

Forward prototypes
Public Function Integer of_importfile (string as_syntax, string as_object, long al_type, string as_pbl, string as_library [], string as_appl)
End prototypes

Public Function Integer of_importfile (string as_syntax, string as_object, long al_type, string as_pbl, string as_library [], string as_appl); long li_handle
Long ll_sid
Long ll_index
Integer li_result

Ll_sid = sessionopen ()
Li_result = sessionsetlibrarylist (ll_sid, as_library, upperbound (as_library ))

If li_result = 0 then
Li_result = sessionsetcurrentappl (ll_sid, as_library [1], as_appl)

If li_result = 0 then
Li_result = compileentryimport (ll_sid, as_pbl, as_object, al_type, "MessageBox-> gf_msgbox", as_syntax, Len (as_syntax), 0, 0)

If li_result <> 0 then
Li_handle = fileopen ("status.txt", linemode !, Write !, Lockwrite !, Append !)
Filewrite (li_handle, string (li_result) + "-" + as_pbl + "-" + as_object)
Fileclose (li_handle)
Else
Li_handle = fileopen ("status.txt", linemode !, Write !, Lockwrite !, Append !)
Filewrite (li_handle, string (li_result) + "-" + as_pbl + "-" + as_object)
Fileclose (li_handle)
End if

Else
Li_handle = fileopen ("status.txt", linemode !, Write !, Lockwrite !, Append !)
Filewrite (li_handle, string (li_result) + "-" + as_pbl + "-" + as_object)
Fileclose (li_handle)
End if

Else
Li_handle = fileopen ("status.txt", linemode !, Write !, Lockwrite !, Append !)
Filewrite (li_handle, string (li_result) + "-" + as_pbl + "-" + as_object)
Fileclose (li_handle)
End if

Sessionclose (ll_sid)
Return li_result
End Function

On n_cst_pborc.create
Call super: Create
Triggerevent ("constructor ")
End on

On n_cst_pborc.destroy
Triggerevent ("destructor ")
Call super: Destroy
End on

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.