Update of /cvsroot/pywin32/pywin32/com/win32comext/axscript/client
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1781/axscript/client
Modified Files:
debug.py framework.py pyscript.py scriptdispatch.py
Log Message:
Patches from Kiriakos Vlahos, as described in [ 1119799 ] Active Debugging
bugs.
Index: pyscript.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/client/pyscript.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** pyscript.py 13 Feb 2005 12:26:33 -0000 1.8
--- pyscript.py 11 Apr 2005 13:04:40 -0000 1.9
***************
*** 39,48 ****
# return string.join(string.split(text,'\n'),'\r\n')
- def RemoveCR(text):
- # No longer just "RemoveCR" - should be renamed to
- # FixNewlines, or something. Idea is to fix arbitary newlines into
- # something Python can compile...
- return re.sub('(\r\n)|\r|(\n\r)','\n',text)
-
class AXScriptCodeBlock(framework.AXScriptCodeBlock):
def GetDisplayName(self):
--- 39,42 ----
***************
*** 343,347 ****
if codeBlock is not None:
realCode = "def %s():\n" % funcName
! for line in string.split(RemoveCR(codeBlock.codeText),"\n"):
realCode = realCode + '\t' + line + '\n'
realCode = realCode + '\n'
--- 337,341 ----
if codeBlock is not None:
realCode = "def %s():\n" % funcName
! for line in string.split(framework.RemoveCR(codeBlock.codeText),"\n"):
realCode = realCode + '\t' + line + '\n'
realCode = realCode + '\n'
***************
*** 371,375 ****
def DoParseScriptText(self, code, sourceContextCookie, startLineNumber, bWantResult, flags):
! code = RemoveCR(code) + "\n"
if flags & SCRIPTTEXT_ISEXPRESSION:
name = "Script Expression"
--- 365,369 ----
def DoParseScriptText(self, code, sourceContextCookie, startLineNumber, bWantResult, flags):
! code = framework.RemoveCR(code) + "\n"
if flags & SCRIPTTEXT_ISEXPRESSION:
name = "Script Expression"
Index: debug.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/client/debug.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** debug.py 1 Jun 2002 02:25:43 -0000 1.2
--- debug.py 11 Apr 2005 13:04:40 -0000 1.3
***************
*** 190,194 ****
def _query_interface_(self, iid):
trace("DebuggerQI with", iid)
! return 0
def GetScriptTextAttributes(self, code, delim, flags):
--- 190,194 ----
def _query_interface_(self, iid):
trace("DebuggerQI with", iid)
! return _wrap(self.debugMgr.scriptEngine, iid)
def GetScriptTextAttributes(self, code, delim, flags):
Index: framework.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/client/framework.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** framework.py 1 Feb 2004 22:24:20 -0000 1.20
--- framework.py 11 Apr 2005 13:04:40 -0000 1.21
***************
*** 16,19 ****
--- 16,26 ----
import pythoncom
import types
+ import re
+
+ def RemoveCR(text):
+ # No longer just "RemoveCR" - should be renamed to
+ # FixNewlines, or something. Idea is to fix arbitary newlines into
+ # something Python can compile...
+ return re.sub('(\r\n)|\r|(\n\r)','\n',text)
SCRIPTTEXT_FORCEEXECUTION = -2147483648 # 0x80000000
***************
*** 828,833 ****
# This stack frame is debugged - therefore we do as little as possible in it.
def _ApplyInScriptedSection(self, fn, args):
! if self.debugManager: self.debugManager.OnEnterScript()
! return apply(fn, args)
def ApplyInScriptedSection(self, codeBlock, fn, args):
--- 835,846 ----
# This stack frame is debugged - therefore we do as little as possible in it.
def _ApplyInScriptedSection(self, fn, args):
! if self.debugManager:
! self.debugManager.OnEnterScript()
! if self.debugManager.adb.appDebugger:
! return self.debugManager.adb.runcall(fn, *args)
! else:
! return apply(fn, args)
! else:
! return apply(fn, args)
def ApplyInScriptedSection(self, codeBlock, fn, args):
***************
*** 859,863 ****
try:
try:
! codeObject = self._CompileInScriptedSection(code, name, type)
codeBlock.codeObject = codeObject
return 1
--- 872,876 ----
try:
try:
! codeObject = self._CompileInScriptedSection(RemoveCR(code), name, type)
codeBlock.codeObject = codeObject
return 1
***************
*** 870,875 ****
# This stack frame is debugged - therefore we do as little as possible in it.
def _ExecInScriptedSection(self, codeObject, globals, locals = None):
! if self.debugManager: self.debugManager.OnEnterScript()
! exec codeObject in globals, locals
def ExecInScriptedSection(self, codeBlock, globals, locals = None):
--- 883,894 ----
# This stack frame is debugged - therefore we do as little as possible in it.
def _ExecInScriptedSection(self, codeObject, globals, locals = None):
! if self.debugManager:
! self.debugManager.OnEnterScript()
! if self.debugManager.adb.appDebugger:
! return self.debugManager.adb.run(codeObject, globals, locals)
! else:
! exec codeObject in globals, locals
! else:
! exec codeObject in globals, locals
def ExecInScriptedSection(self, codeBlock, globals, locals = None):
***************
*** 888,893 ****
def _EvalInScriptedSection(self, codeBlock, globals, locals = None):
! if self.debugManager: self.debugManager.OnEnterScript()
! return eval(codeBlock, globals, locals)
def EvalInScriptedSection(self, codeBlock, globals, locals = None):
--- 907,918 ----
def _EvalInScriptedSection(self, codeBlock, globals, locals = None):
! if self.debugManager:
! self.debugManager.OnEnterScript()
! if self.debugManager.adb.appDebugger:
! return self.debugManager.adb.runeval(codeBlock, globals, locals)
! else:
! return eval(codeBlock, globals, locals)
! else:
! return eval(codeBlock, globals, locals)
def EvalInScriptedSection(self, codeBlock, globals, locals = None):
Index: scriptdispatch.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/client/scriptdispatch.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** scriptdispatch.py 24 Nov 1999 23:42:13 -0000 1.2
--- scriptdispatch.py 11 Apr 2005 13:04:41 -0000 1.3
***************
*** 28,32 ****
self.engine = engine
self.scriptNamespace = scriptNamespace
!
def _dynamic_(self, name, lcid, wFlags, args):
if wFlags & pythoncom.INVOKE_FUNC:
--- 28,32 ----
self.engine = engine
self.scriptNamespace = scriptNamespace
!
def _dynamic_(self, name, lcid, wFlags, args):
if wFlags & pythoncom.INVOKE_FUNC:
***************
*** 68,71 ****
--- 68,83 ----
class StrictDynamicPolicy(win32com.server.policy.DynamicPolicy):
+ def _wrap_(self, object):
+ win32com.server.policy.DynamicPolicy._wrap_(self, object)
+ if hasattr(self._obj_, 'scriptNamespace'):
+ for name in dir(self._obj_.scriptNamespace):
+ self._dyn_dispid_to_name_[self._getdispid_(name,0)] = name
+
+ def _getmembername_(self, dispid):
+ try:
+ return str(self._dyn_dispid_to_name_[dispid])
+ except KeyError:
+ raise COMException(scode=winerror.DISP_E_UNKNOWNNAME, desc="Name not found")
+
def _getdispid_(self, name, fdex):
try:
|