objectscript-users Mailing List for ObjectScript (Page 6)
Brought to you by:
rob_d_clark
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(12) |
Oct
(13) |
Nov
(8) |
Dec
(7) |
2006 |
Jan
(7) |
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
|
Sep
(5) |
Oct
(13) |
Nov
(15) |
Dec
(7) |
2007 |
Jan
(2) |
Feb
(4) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(1) |
Oct
(5) |
Nov
(3) |
Dec
(2) |
2008 |
Jan
(5) |
Feb
(8) |
Mar
(22) |
Apr
(28) |
May
(13) |
Jun
(10) |
Jul
(22) |
Aug
(11) |
Sep
(19) |
Oct
(11) |
Nov
(47) |
Dec
(39) |
From: Rob C. <ro...@ti...> - 2005-12-18 00:15:55
|
Ok, I've merged the command-line debugger changes back to the trunk. I made some slight changes: 1) changed the way "next" works to work more like the GUI debugger, without needing changes in Debugger.java 2) used ObjectScript regular expressions for debugger command-line parsing Everything seems to work, as best I can tell... If you want, checkout the latest from the trunk and give it a whirl. I've also merged the changes to build with JDK v1.5.x On 12/6/05 10:08 AM, "Lysander David" <sa...@sb...> wrote: > Thanks for checking in dbg.os. > > 'import "reflection.os";' is not necessary. > It refers to the reflection.os file from the > user guide so that I could use the 'listobj' > function to list the methods and attributes > of objects. > > The patch extends the Breakpoint interface > to allow breakpoints to provide the current > stack frame( getCurrentStackFrame ), the > parent stack frame ( getParentStackFrame ) and > whether or not it is a next breakpoint ( > isNextBreakpoint ). > > Then handle is modified to call isNextBreakpoint. > If isNextBreakpoint returns false, then the step > breakpoint > is handled as normal. If isNextBreakpoint is true, > and the current stack frame or parent stack frame > matches > the current stack frame, the breakpoint is handled. > Otherwise > the stepBp is left unchanged to be added back to the > breakpont stack. > > Additionally _inNextBreakpointStackFrame can be > removed > since it isn't used ( I thought determining if it is > in the > next stack frame would be a little more involved ) > > > --- Rob Clark <ro...@ti...> wrote: > >> I've checked in dbg.os, and added a "-b <file> >> <line>" command-line >> option to set a breakpoint from the command-line... >> see revision 1881 >> >> btw, in dbg.os, what is the 'import >> "reflection.os";'.... I've had a >> brief look thru dbg.os, and it didn't look like it >> was using any >> functions not defined in the same file, but thought >> I should double >> check to make sure that nothing is missing. >> >> I still need to look at the patch file to understand >> the changes... >> hopefully I'll get some time to have a closer look >> tomorrow. >> >> >> On Nov 26, 2005, at 10:54 PM, Lysander David wrote: >> >>> Hi Rob, >>> >>> I have made some modifications to the previous >> dbg.os >>> you previously posted. Here is the help >>> for it: >>> >>> objectsript command line debugger help >>> >>> continue - continue execution ( synonym "c" ) >>> step - single step ( synonym "s" ) >>> next - Next, steps over subs ( synonym "n" ) >>> where - stack trace ( synonym "T" ) >>> up - change context to higher stack frame ( >> synonym >>> "u" ) >>> down - change context to lower stack frame ( >> synonym >>> "d" ) >>> list [file][:[line][:length]] - list the [file] at >>> [line] with [length] number of lines >>> b [[file][:line]] - set a breakpoint. If [file] is >> not >>> specified, a breakpoint is set at the curent debug >>> stack frame >>> b list - list breakpoints >>> d index - delete breakpoint at specified >> breakpoint >>> index >>> help - this message ( synonym "h" ) >>> exit - exit debugging session ( synonym "x", >> "quit", >>> "q") >>> >>> >>> Aside from the os file, some changes in >>> Debugger.java were necessary in order to get >>> the "next" command to work ( see included patch >>> "debugger.pat" ). >>> >>> I realize that a lot of it is kind of hacky but >>> hopfully you can indicate what changes should be >>> made so that it can eventually be included as a >> part >>> of >>> the objectscritpt distribution. >>> >>> ( Two things I can think of offhand are >>> 1. add a command line flag to add a step >>> breakpoint so that it will not >>> be necessary to modify os code to get the >>> first breakpoint >>> 2. add a return command to continue until >>> the current function returns. >>> ) >>> >>> By the way, is an emacs mode for javascript >> available >>> ? >>> >>> Thanks, >>> Lysander >>> <dbg.os> >>> <debugger.pat> >> >> >> ____________________ >> CONTACT INFORMATION: >> email: ro...@ti... >> IM: rob@sandjabber >> desk: 1 858 552 2946 >> cell: 1 619 300 9661 >> >> >> >> > |
From: Lysander D. <sa...@sb...> - 2005-12-06 18:08:34
|
Thanks for checking in dbg.os. 'import "reflection.os";' is not necessary. It refers to the reflection.os file from the user guide so that I could use the 'listobj' function to list the methods and attributes of objects. The patch extends the Breakpoint interface to allow breakpoints to provide the current stack frame( getCurrentStackFrame ), the parent stack frame ( getParentStackFrame ) and whether or not it is a next breakpoint ( isNextBreakpoint ). Then handle is modified to call isNextBreakpoint. If isNextBreakpoint returns false, then the step breakpoint is handled as normal. If isNextBreakpoint is true, and the current stack frame or parent stack frame matches the current stack frame, the breakpoint is handled. Otherwise the stepBp is left unchanged to be added back to the breakpont stack. Additionally _inNextBreakpointStackFrame can be removed since it isn't used ( I thought determining if it is in the next stack frame would be a little more involved ) --- Rob Clark <ro...@ti...> wrote: > I've checked in dbg.os, and added a "-b <file> > <line>" command-line > option to set a breakpoint from the command-line... > see revision 1881 > > btw, in dbg.os, what is the 'import > "reflection.os";'.... I've had a > brief look thru dbg.os, and it didn't look like it > was using any > functions not defined in the same file, but thought > I should double > check to make sure that nothing is missing. > > I still need to look at the patch file to understand > the changes... > hopefully I'll get some time to have a closer look > tomorrow. > > > On Nov 26, 2005, at 10:54 PM, Lysander David wrote: > > > Hi Rob, > > > > I have made some modifications to the previous > dbg.os > > you previously posted. Here is the help > > for it: > > > > objectsript command line debugger help > > > > continue - continue execution ( synonym "c" ) > > step - single step ( synonym "s" ) > > next - Next, steps over subs ( synonym "n" ) > > where - stack trace ( synonym "T" ) > > up - change context to higher stack frame ( > synonym > > "u" ) > > down - change context to lower stack frame ( > synonym > > "d" ) > > list [file][:[line][:length]] - list the [file] at > > [line] with [length] number of lines > > b [[file][:line]] - set a breakpoint. If [file] is > not > > specified, a breakpoint is set at the curent debug > > stack frame > > b list - list breakpoints > > d index - delete breakpoint at specified > breakpoint > > index > > help - this message ( synonym "h" ) > > exit - exit debugging session ( synonym "x", > "quit", > > "q") > > > > > > Aside from the os file, some changes in > > Debugger.java were necessary in order to get > > the "next" command to work ( see included patch > > "debugger.pat" ). > > > > I realize that a lot of it is kind of hacky but > > hopfully you can indicate what changes should be > > made so that it can eventually be included as a > part > > of > > the objectscritpt distribution. > > > > ( Two things I can think of offhand are > > 1. add a command line flag to add a step > > breakpoint so that it will not > > be necessary to modify os code to get the > > first breakpoint > > 2. add a return command to continue until > > the current function returns. > > ) > > > > By the way, is an emacs mode for javascript > available > > ? > > > > Thanks, > > Lysander > > <dbg.os> > > <debugger.pat> > > > ____________________ > CONTACT INFORMATION: > email: ro...@ti... > IM: rob@sandjabber > desk: 1 858 552 2946 > cell: 1 619 300 9661 > > > > |
From: Rob C. <ro...@ti...> - 2005-12-03 17:26:20
|
the qualified "this" (and "super") syntax is introduced in =20 oscript-2.10, which I've unfortunately not had time to upload to =20 sf.net yet. (Sorry.. been very busy with my day job.) But you can =20 see it in the SVN repository (https://objectscript.kicks-ass.org/=20 svn). I'll try and make a 2.10.1 to upload this weekend after I've =20 had a chance to merge Lysander's patches. Anyways, the way qualified "this" works is I added to Scope a getThis=20 (Value) method. So "Foo.this" is implemented as "currentScope.getThis=20= (Foo)". The way it works is that in FunctionScope: public Value getThis( Value val ) { if( fxn =3D=3D val.unhand() ) return new OThis(this); return super.getThis(val); } so the nearest enclosing function-scope for the function "Foo" will =20 return the "this". So to do what you describe, in BasicScope (where mixin is handled), =20 it would have to do something like: public Value getThis( Value val ) { for( int i=3D0; i<mixins.length; i++ ) { if( mixins[i] instanceof Scope ) { if( mixins[i].bopInstanceOf(val) ) return mixins[i]; } } return super.getThis(val); } ------ background notes: in Scope, the base class for all scopes (FunctionScope, BasicScope, =20 etc): public Value getThis( Value val ) { return previous.getThis(val); } so the default behavior is to pass the request for "this" up the =20 scope chain. On Dec 3, 2005, at 4:17 AM, <ar...@va...> wrote: > I'm glad you understand what i mean. I was not sure if it was clearly > stated below. I have based this on the LPC language created by Lars =20= > Pensj=F6 > for his LP-MUD. It supports the "::" to point at specific inherited > objects. It also uses "::method()" as the "super" qualifier used in =20= > Java. > > But i think it is just a matter of syntax choice on how to =20 > implement this. > I think what you proposed will get the job done as well. > > In what version of OScript did you implement the qualified "this" =20 > syntax? > > > >> Hmm, I've recently just added a qualified "this" syntax, for example >> "Foo.this"... the way it is currently supported is "Foo.this" >> evaluates to the nearest "this" which is a "Foo". As in: >> >> function Outer() >> { >> private var a =3D 1; >> function Inner() >> { >> private var a =3D 2; >> >> public function test() >> { >> private var a =3D 3; >> >> { >> var a =3D 4; >> >> writeln("a: " + a); >> writeln("test.this.a: " + test.this.a); >> writeln("this.a: " + this.a); >> writeln("Inner.this.a: " + Inner.this.a); >> writeln("Outer.this.a: " + Outer.this.a); >> } >> } >> } >> } >> >> maybe it would sense to support mixin's in a similar way, so you >> could do something like "A.this.print()"? >> >> thoughts? >> >> >> On Dec 2, 2005, at 6:49 AM, <ar...@va...> wrote: >> >>> Rob, >>> >>> Is it difficult to add the following to the OScript syntaxt: >>> >>> function A() { >>> public function print() {} >>> } >>> >>> function B() { >>> mixin new A(); >>> >>> public function print() { >>> A::print(); >>> ^^^^^^^^^^^ >>> // do other print stuff >>> } >>> } >>> >>> "::" means in this case that you specifically point to the object >>> "A" and >>> call its print method. I don't think that this is a difficult >>> addition to >>> the syntaxt, but i'm completely unknown to JavaCC and how you used >>> it in >>> OScript. >>> >>> Maybe you can point me in some direction to have this included. >>> >>> thank you very much. >>> >>> Regards, >>> >>> Arjen van Efferen >>> >>> >>> ------------------------------------------------------- >>> This SF.net email is sponsored by: Splunk Inc. Do you grep through >>> log files >>> for problems? Stop! Download the new AJAX search engine that makes >>> searching your log files as easy as surfing the web. DOWNLOAD >>> SPLUNK! >>> http://ads.osdn.com/?ad_idv37&alloc_id=16865&op=3Dick >>> _______________________________________________ >>> Objectscript-users mailing list >>> Obj...@li... >>> https://lists.sourceforge.net/lists/listinfo/objectscript-users >> >> -- Rob >> >> ____________________ >> CONTACT INFORMATION: >> email: ro...@ti... >> IM: rob@sandjabber >> desk: 1 858 552 2946 >> cell: 1 619 300 9661 >> >> >> >> > ____________________ CONTACT INFORMATION: email: ro...@ti... IM: rob@sandjabber desk: 1 858 552 2946 cell: 1 619 300 9661 |
From: <ar...@va...> - 2005-12-03 11:28:28
|
I'm glad you understand what i mean. I was not sure if it was clearly stated below. I have based this on the LPC language created by Lars Pensj= =F6 for his LP-MUD. It supports the "::" to point at specific inherited objects. It also uses "::method()" as the "super" qualifier used in Java. But i think it is just a matter of syntax choice on how to implement this= . I think what you proposed will get the job done as well. In what version of OScript did you implement the qualified "this" syntax? > Hmm, I've recently just added a qualified "this" syntax, for example > "Foo.this"... the way it is currently supported is "Foo.this" > evaluates to the nearest "this" which is a "Foo". As in: > > function Outer() > { > private var a =3D 1; > function Inner() > { > private var a =3D 2; > > public function test() > { > private var a =3D 3; > > { > var a =3D 4; > > writeln("a: " + a); > writeln("test.this.a: " + test.this.a); > writeln("this.a: " + this.a); > writeln("Inner.this.a: " + Inner.this.a); > writeln("Outer.this.a: " + Outer.this.a); > } > } > } > } > > maybe it would sense to support mixin's in a similar way, so you > could do something like "A.this.print()"? > > thoughts? > > > On Dec 2, 2005, at 6:49 AM, <ar...@va...> wrote: > >> Rob, >> >> Is it difficult to add the following to the OScript syntaxt: >> >> function A() { >> public function print() {} >> } >> >> function B() { >> mixin new A(); >> >> public function print() { >> A::print(); >> ^^^^^^^^^^^ >> // do other print stuff >> } >> } >> >> "::" means in this case that you specifically point to the object >> "A" and >> call its print method. I don't think that this is a difficult >> addition to >> the syntaxt, but i'm completely unknown to JavaCC and how you used >> it in >> OScript. >> >> Maybe you can point me in some direction to have this included. >> >> thank you very much. >> >> Regards, >> >> Arjen van Efferen >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. Do you grep through >> log files >> for problems? Stop! Download the new AJAX search engine that makes >> searching your log files as easy as surfing the web. DOWNLOAD >> SPLUNK! >> http://ads.osdn.com/?ad_idv37&alloc_id=16865&op=3Dick >> _______________________________________________ >> Objectscript-users mailing list >> Obj...@li... >> https://lists.sourceforge.net/lists/listinfo/objectscript-users > > -- Rob > > ____________________ > CONTACT INFORMATION: > email: ro...@ti... > IM: rob@sandjabber > desk: 1 858 552 2946 > cell: 1 619 300 9661 > > > > |
From: Rob C. <ro...@ti...> - 2005-12-02 16:58:42
|
Hmm, I've recently just added a qualified "this" syntax, for example =20 "Foo.this"... the way it is currently supported is "Foo.this" =20 evaluates to the nearest "this" which is a "Foo". As in: function Outer() { private var a =3D 1; function Inner() { private var a =3D 2; public function test() { private var a =3D 3; { var a =3D 4; writeln("a: " + a); writeln("test.this.a: " + test.this.a); writeln("this.a: " + this.a); writeln("Inner.this.a: " + Inner.this.a); writeln("Outer.this.a: " + Outer.this.a); } } } } maybe it would sense to support mixin's in a similar way, so you =20 could do something like "A.this.print()"? thoughts? On Dec 2, 2005, at 6:49 AM, <ar...@va...> wrote: > Rob, > > Is it difficult to add the following to the OScript syntaxt: > > function A() { > public function print() {} > } > > function B() { > mixin new A(); > > public function print() { > A::print(); > ^^^^^^^^^^^ > // do other print stuff > } > } > > "::" means in this case that you specifically point to the object =20 > "A" and > call its print method. I don't think that this is a difficult =20 > addition to > the syntaxt, but i'm completely unknown to JavaCC and how you used =20 > it in > OScript. > > Maybe you can point me in some direction to have this included. > > thank you very much. > > Regards, > > Arjen van Efferen > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through =20 > log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD =20 > SPLUNK! > http://ads.osdn.com/?ad_idv37&alloc_id=16865&op=3Dick > _______________________________________________ > Objectscript-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectscript-users -- Rob ____________________ CONTACT INFORMATION: email: ro...@ti... IM: rob@sandjabber desk: 1 858 552 2946 cell: 1 619 300 9661 |
From: <ar...@va...> - 2005-12-02 13:59:31
|
Rob, Is it difficult to add the following to the OScript syntaxt: function A() { public function print() {} } function B() { mixin new A(); public function print() { A::print(); ^^^^^^^^^^^ // do other print stuff } } "::" means in this case that you specifically point to the object "A" and call its print method. I don't think that this is a difficult addition to the syntaxt, but i'm completely unknown to JavaCC and how you used it in OScript. Maybe you can point me in some direction to have this included. thank you very much. Regards, Arjen van Efferen |
From: Rob C. <ro...@ti...> - 2005-11-30 21:09:04
|
Hi Lysander, the enum patch looks good... I will apply it, and also update parser.patch (which gets applied after regenerating the parser), so this fix doesn't get wiped out next time the parser is regenerated. as far as the properties patch, I will need to re-work the build scripts a bit too, since classpathlist is also used to figure out which files to copy to the dest directory as part of the build, and just taking this patch as-is will result in jawin.dll not being copied to the destination directory.. I guess I should have used a separate variable for DLL's. On Nov 23, 2005, at 5:55 PM, Lysander David wrote: > Hi, > > When building objectscript 1.9.2 using sun java > 1.5.0_05, > > I initially get this error: > > [javac] > C:\home\ldavid\explore\os\regexp\orig\oscript-2.9.2\oscript\oscript > \parser\OscriptParser.java:4765: > as of release 1.5, 'enum' is a keyword, and may not be > used as an identifier > [javac] (try -source 1.4 or lower to use 'enum' as > an identifier) > [javac] for (java.util.Enumeration enum = > jj_expentries.elements(); enum.hasMoreElements();) { > > > After applying the attached enum.pat to > oscript/oscript/parser/OscriptParser.java > ( e.g. patch -p0 < enum.pat from the parent of > oscript and oscom ) > the build can proceed past that error however > it then fails with this error: > > [javac] error: error reading > C:\home\ldavid\explore\os\regexp\orig\oscript-2.9.2\lib\jawin.dll; > error in opening zip file > [javac] 1 error > > After applying the attached properties.pat to > oscom/build.properties > ( e.g. patch -p0 < properties.pat from the parent of > oscript and oscom ) > the build can complete successfully. > > Lysander > <enum.pat> > <properties.pat> -- Rob ____________________ CONTACT INFORMATION: email: ro...@ti... IM: rob@sandjabber desk: 1 858 552 2946 cell: 1 619 300 9661 |
From: Rob C. <ro...@ti...> - 2005-11-28 02:57:20
|
I haven't tried this, but it might work: http://www.brigadoon.de/peter/javascript-mode.el On Nov 26, 2005, at 10:54 PM, Lysander David wrote: > By the way, is an emacs mode for javascript available ____________________ CONTACT INFORMATION: email: ro...@ti... IM: rob@sandjabber desk: 1 858 552 2946 cell: 1 619 300 9661 |
From: Lysander D. <sa...@sb...> - 2005-11-27 06:54:52
|
Hi Rob, I have made some modifications to the previous dbg.os you previously posted. Here is the help for it: objectsript command line debugger help continue - continue execution ( synonym "c" ) step - single step ( synonym "s" ) next - Next, steps over subs ( synonym "n" ) where - stack trace ( synonym "T" ) up - change context to higher stack frame ( synonym "u" ) down - change context to lower stack frame ( synonym "d" ) list [file][:[line][:length]] - list the [file] at [line] with [length] number of lines b [[file][:line]] - set a breakpoint. If [file] is not specified, a breakpoint is set at the curent debug stack frame b list - list breakpoints d index - delete breakpoint at specified breakpoint index help - this message ( synonym "h" ) exit - exit debugging session ( synonym "x", "quit", "q") Aside from the os file, some changes in Debugger.java were necessary in order to get the "next" command to work ( see included patch "debugger.pat" ). I realize that a lot of it is kind of hacky but hopfully you can indicate what changes should be made so that it can eventually be included as a part of the objectscritpt distribution. ( Two things I can think of offhand are 1. add a command line flag to add a step breakpoint so that it will not be necessary to modify os code to get the first breakpoint 2. add a return command to continue until the current function returns. ) By the way, is an emacs mode for javascript available ? Thanks, Lysander |
From: Lysander D. <sa...@sb...> - 2005-11-24 01:55:54
|
Hi, When building objectscript 1.9.2 using sun java 1.5.0_05, I initially get this error: [javac] C:\home\ldavid\explore\os\regexp\orig\oscript-2.9.2\oscript\oscript\parser\OscriptParser.java:4765: as of release 1.5, 'enum' is a keyword, and may not be used as an identifier [javac] (try -source 1.4 or lower to use 'enum' as an identifier) [javac] for (java.util.Enumeration enum = jj_expentries.elements(); enum.hasMoreElements();) { After applying the attached enum.pat to oscript/oscript/parser/OscriptParser.java ( e.g. patch -p0 < enum.pat from the parent of oscript and oscom ) the build can proceed past that error however it then fails with this error: [javac] error: error reading C:\home\ldavid\explore\os\regexp\orig\oscript-2.9.2\lib\jawin.dll; error in opening zip file [javac] 1 error After applying the attached properties.pat to oscom/build.properties ( e.g. patch -p0 < properties.pat from the parent of oscript and oscom ) the build can complete successfully. Lysander |
From: Lysander D. <sa...@sb...> - 2005-11-24 00:59:08
|
Hi, Currently Strings in objectscript do not support the split method. For example the attached test script produces this error: 531 $ sh -x do.sh + /opt/java/share/oscript-2.9.2/bin/oscript test.os register: java.net.URLClassLoader@ab95e6 found list file arg: "file:lineo" oscript.exceptions.PackagedScriptObjectException: NoSuchMemberException: no such member: (global): listobj at main (/C:/home/ldavid/explore/os/regexp/test.os:9) at /C:/home/ldavid/explore/os/regexp/test.os:21 Should you wish to modify objectscript to add the split member to Strings you could apply the attached patch to oscript/oscript/data/OString.java. After rebuilding, the output of the test script should be: + java -jar 'c:\opt\java\build\objectscript\oscript-2.9.2\dest\oscript.jar' test.os register: java.net.URLClassLoader@1833955 found list file arg: "file:lineo" [file, lineo] Thanks, Lysander |
From: Rob C. <ro...@ti...> - 2005-11-17 20:52:47
|
ok, sounds good... I think, start by having a look at AbstractReference (sorry, not AbstractValue, I typed too fast)... you can use this to create a "proxy" for the actual script package Value, which contains the additional information about how it is referenced. On Nov 17, 2005, at 3:29 AM, <ar...@va...> <ar...@va...> wrote: > Rob, > > No problem. This can happen :) > > Thanks for the reply. I think i will look into a solution like you > suggested. I might going to suggest some changes to the OScript > codebase > anyway. Maybe i'll get back with a nice solution of some kind. > > Regards, > > Arjen >> Hi Arjen, >> >> sorry for the late reply... your email got lost many pages up in my >> inbox. >> >> There is not currently a way to get the package name from a Value >> object. I guess I had never thought of this. The main problem is >> that you could, in theory, access the same file in multiple ways. >> >> I guess something could probably be done, by having ScriptPackage not >> return the actual Value object, but rather something that extends >> AbstractValue which implements the get() method to return the actual >> value. This way, there is a "wrapper" around the actual Value, which >> can know how it was accessed. >> >> >> -- Rob >> >> >> On Nov 3, 2005, at 4:46 AM, <ar...@va...> >> <ar...@va...> wrote: >> >>> Hi, >>> >>> I'm working on an application having the Oscript interpreter >>> embedded. I >>> have a Java helper class that calls a function in a scripted >>> object. This >>> function returns another scripted object back to the Java helper. >>> How can >>> i get the full package name from that Value (Scope)-object? >>> >>> Example: >>> >>> lib/someobject.os: >>> >>> public function someobject() { >>> public function test() { >>> } >>> } >>> >>> lib/file.os: >>> >>> public function file() { >>> public function method() { >>> >>> return new pkg.lib.someobject(); <=========== >>> >>> } >>> } >>> >>> Java helper class: >>> >>> AbstractFile sFile = OscriptInterpreter.resolve("lib/file.os", >>> false); >>> OscriptInterpreter.eval(sFile, pScope); >>> Value objValue = pScope.lookupInScope("file"); >>> Value program = objValue.callAsConstructor(new Value[0]); >>> Value func = program.lookupInScope("method"); >>> >>> Value res = func.callAsFunction(); <=== "res" now contains the >>> instantiated "pkg.lib.someobject()" object. But how do i retrieve >>> this >>> information from that Value-object? How do i know the package name >>> and the >>> object name of this Value object? >>> >>> I hope my question is clear enough. Thanks for your help. >>> >>> Regards, >>> >>> Arjen van Efferen >>> >>> >>> ------------------------------------------------------- >>> SF.Net email is sponsored by: >>> Tame your development challenges with Apache's Geronimo App Server. >>> Download >>> it for free - -and be entered to win a 42" plasma tv or your very >>> own >>> Sony(tm)PSP. Click here to play: http://sourceforge.net/ >>> geronimo.php >>> _______________________________________________ >>> Objectscript-users mailing list >>> Obj...@li... >>> https://lists.sourceforge.net/lists/listinfo/objectscript-users >> >> -- Rob >> >> ____________________ >> CONTACT INFORMATION: >> email: ro...@ti... >> IM: rob@sandjabber >> desk: 1 858 552 2946 >> cell: 1 619 300 9661 >> >> >> >> > -- Rob ____________________ CONTACT INFORMATION: email: ro...@ti... IM: rob@sandjabber desk: 1 858 552 2946 cell: 1 619 300 9661 |
From: <ar...@va...> - 2005-11-17 10:38:55
|
Rob, No problem. This can happen :) Thanks for the reply. I think i will look into a solution like you suggested. I might going to suggest some changes to the OScript codebase anyway. Maybe i'll get back with a nice solution of some kind. Regards, Arjen > Hi Arjen, > > sorry for the late reply... your email got lost many pages up in my > inbox. > > There is not currently a way to get the package name from a Value > object. I guess I had never thought of this. The main problem is > that you could, in theory, access the same file in multiple ways. > > I guess something could probably be done, by having ScriptPackage not > return the actual Value object, but rather something that extends > AbstractValue which implements the get() method to return the actual > value. This way, there is a "wrapper" around the actual Value, which > can know how it was accessed. > > > -- Rob > > > On Nov 3, 2005, at 4:46 AM, <ar...@va...> > <ar...@va...> wrote: > >> Hi, >> >> I'm working on an application having the Oscript interpreter >> embedded. I >> have a Java helper class that calls a function in a scripted >> object. This >> function returns another scripted object back to the Java helper. >> How can >> i get the full package name from that Value (Scope)-object? >> >> Example: >> >> lib/someobject.os: >> >> public function someobject() { >> public function test() { >> } >> } >> >> lib/file.os: >> >> public function file() { >> public function method() { >> >> return new pkg.lib.someobject(); <=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> >> } >> } >> >> Java helper class: >> >> AbstractFile sFile =3D OscriptInterpreter.resolve("lib/file.os", false= ); >> OscriptInterpreter.eval(sFile, pScope); >> Value objValue =3D pScope.lookupInScope("file"); >> Value program =3D objValue.callAsConstructor(new Value[0]); >> Value func =3D program.lookupInScope("method"); >> >> Value res =3D func.callAsFunction(); <=3D=3D=3D "res" now contains the >> instantiated "pkg.lib.someobject()" object. But how do i retrieve this >> information from that Value-object? How do i know the package name >> and the >> object name of this Value object? >> >> I hope my question is clear enough. Thanks for your help. >> >> Regards, >> >> Arjen van Efferen >> >> >> ------------------------------------------------------- >> SF.Net email is sponsored by: >> Tame your development challenges with Apache's Geronimo App Server. >> Download >> it for free - -and be entered to win a 42" plasma tv or your very own >> Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php >> _______________________________________________ >> Objectscript-users mailing list >> Obj...@li... >> https://lists.sourceforge.net/lists/listinfo/objectscript-users > > -- Rob > > ____________________ > CONTACT INFORMATION: > email: ro...@ti... > IM: rob@sandjabber > desk: 1 858 552 2946 > cell: 1 619 300 9661 > > > > |
From: <ar...@va...> - 2005-11-03 12:53:51
|
Hi, I'm working on an application having the Oscript interpreter embedded. I have a Java helper class that calls a function in a scripted object. This function returns another scripted object back to the Java helper. How can i get the full package name from that Value (Scope)-object? Example: lib/someobject.os: public function someobject() { public function test() { } } lib/file.os: public function file() { public function method() { return new pkg.lib.someobject(); <=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D } } Java helper class: AbstractFile sFile =3D OscriptInterpreter.resolve("lib/file.os", false); OscriptInterpreter.eval(sFile, pScope); Value objValue =3D pScope.lookupInScope("file"); Value program =3D objValue.callAsConstructor(new Value[0]); Value func =3D program.lookupInScope("method"); Value res =3D func.callAsFunction(); <=3D=3D=3D "res" now contains the instantiated "pkg.lib.someobject()" object. But how do i retrieve this information from that Value-object? How do i know the package name and th= e object name of this Value object? I hope my question is clear enough. Thanks for your help. Regards, Arjen van Efferen |
From: Lysander D. <sa...@sb...> - 2005-10-26 04:45:56
|
I was able to successfully build it and verify that the class loader change work. Here is an example script: pkg.system.mountJarFile ( new pkg.fs.File ( "d:/opt/java/build/xstream/trunk/xstream/lib/commons-lang-2.0.jar" ) ); pkg.system.mountJarFile ( new pkg.fs.File ( "d:/opt/java/build/xstream/trunk/xstream/lib/dom4j-1.3.jar" ) ); pkg.system.mountJarFile ( new pkg.fs.File ( "d:/opt/java/build/xstream/trunk/xstream/lib/jdom-1.0.jar" ) ); pkg.system.mountJarFile ( new pkg.fs.File ( "d:/opt/java/build/xstream/trunk/xstream/lib/jmock-2004-03-19.jar" ) ); pkg.system.mountJarFile ( new pkg.fs.File ( "d:/opt/java/build/xstream/trunk/xstream/lib/joda-time-1.1.jar" ) ); pkg.system.mountJarFile ( new pkg.fs.File ( "d:/opt/java/build/xstream/trunk/xstream/lib/junit-3.8.1.jar" ) ); pkg.system.mountJarFile ( new pkg.fs.File ( "d:/opt/java/build/xstream/trunk/xstream/lib/stax-1.1.1-dev.jar" ) ); pkg.system.mountJarFile ( new pkg.fs.File ( "d:/opt/java/build/xstream/trunk/xstream/lib/stax-api-1.0.jar" ) ); pkg.system.mountJarFile ( new pkg.fs.File ( "d:/opt/java/build/xstream/trunk/xstream/lib/xml-writer-0.2.jar" ) ); pkg.system.mountJarFile ( new pkg.fs.File ( "d:/opt/java/build/xstream/trunk/xstream/lib/xom-1.0b3.jar" ) ); pkg.system.mountJarFile ( new pkg.fs.File ( "d:/opt/java/build/xstream/trunk/xstream/lib/xpp3-1.1.3.4d_b4_min.jar" ) ); pkg.system.mountJarFile ( new pkg.fs.File ( "d:/opt/java/build/xstream/trunk/xstream/xstream-SNAPSHOT.jar" ) ); pkg.system.declareJavaPackage("com.thoughtworks.xstream"); var xstream = new com.thoughtworks.xstream.XStream (); var list = new java.util.ArrayList (); list.add ( "a" ); list.add ( "b" ); var xmlOutput = xstream.toXML ( list ); writeln ( xmlOutput ); and here is the output from the example 517 $ sh -x do.sh + /opt/java/share/oscript-2.8.1/bin/oscript newLoader.os register: java.net.URLClassLoader@1eed786 register: java.net.URLClassLoader@c1f10e register: java.net.URLClassLoader@b8deef register: java.net.URLClassLoader@1342ba4 register: java.net.URLClassLoader@1d332b register: java.net.URLClassLoader@10a6ae2 register: java.net.URLClassLoader@ef2c60 register: java.net.URLClassLoader@4a6cbf register: java.net.URLClassLoader@29ab3e register: java.net.URLClassLoader@1a99561 register: java.net.URLClassLoader@8e32e7 register: java.net.URLClassLoader@1b000e7 register: java.net.URLClassLoader@b76fa <list> <string>a</string> <string>b</string> </list> Thanks, Lysander --- Rob Clark <ro...@ti...> wrote: > cool... you might check out > https://objectscript.kicks-ass.org/svn/ > tags/oscript-2.9.2, since this branch has already > been merged into a > release. (If I get a few minutes tonight, I'll > upload 2.9.2 to sf.net) > > > On Oct 25, 2005, at 1:02 PM, Lysander David wrote: > > > The registration now works and I was able to > > successfully check out > > > https://objectscript.kicks-ass.org/svn/branches/OBJS380 > > from subversion. > > > > Thanks, > > Lysander > > > > --- Rob Clark <ro...@ti...> wrote: > > > > > >> btw, the page to create an account should be > working > >> now... I had > >> some problems with my network connection, but it > >> seems to be working > >> ok now: > >> > >> > https://objectscript.kicks-ass.org/osp/account.osp > >> > >> > > > > -- Rob > > ____________________ > CONTACT INFORMATION: > email: ro...@ti... > IM: rob@sandjabber > desk: 1 858 552 2946 > cell: 1 619 300 9661 > > > > |
From: Lysander D. <sa...@sb...> - 2005-10-21 18:40:21
|
Arrgh!!! I put too many underscores in front of eval. __eval() works but ___eval() doesn't. The try block really did the trick. BTW I was wondering if you had a chance to set up a login for me in trac so that I could check out the classloader changes in subversion ? As always, thanks for all the help, Lysander --- Rob Clark <ro...@ti...> wrote: > hmm... try putting a try/catch around the call to > __eval()... it > could be throwing an exception for some reason. > Which ObjectScript > version are you using? Send me your version of > setBreakpoint() (if > you've made any changes), and I'll try to reproduce > it when I get a > few mins over the weekend. > > > btw, sorry for the delayed response, I've been in > the midst of a > major debugging session for the last few days. > (Debugging object > code on a small embedded platform is fun.) > > > On Oct 18, 2005, at 9:36 AM, Lysander David wrote: > > > Unfortunately, even after stepping ( 's' ) for > one > > line > > nothing is written to stdout. Additionally, > > attempting to write a simple string to stdout like > > this: > > > > writeln ( "a nice string" ); > > > > doesn't result in any output. > > > > Additionally, after modifying > > oscript.OscriptInterpreter.__eval(String str, > Scope > > scope) > > > > to print the string to be evaluated with this > > > > System.out.println ( "eval: \"" + str + "\""); > > > > nothing is printed out. It almost appears that > > __eval is not being called. > > > > How would it be possible to ensure that __eval > > is getting called ? > > > > Thanks, > > Lysander > > > > > > --- Rob Clark <ro...@ti...> wrote: > > > > > >> you need to "s" (step) for at least one line, > >> because on the line it > >> halts on, "a" has not been declared yet. It > should > >> probably result > >> in a NoSuchMemberException which isn't getting > >> printed out for some > >> reason > >> > >> > >> On Oct 17, 2005, at 10:56 PM, Lysander David > wrote: > >> > >> > >>> That appears to work. However after hitting the > >>> breakpoint entering this: > >>> > >>> writeln ( "a" ) > >>> > >>> results in nothing being written to standard > out. > >>> > >>> Does that successfully write anything to > standarad > >>> > >> out > >> > >>> for you ? > >>> > >>> If not, do you know what needs to be changed in > >>> order to allow that command to successfully > output > >>> text ? > >>> > >>> Thanks, > >>> Lysander > >>> > >>> > >>> --- Rob Clark <ro...@ti...> wrote: > >>> > >>> > >>> > >>>> not really... you might be able to use the > >>>> > >> debugger > >> > >>>> API to setup a > >>>> read-eval-print shell to run at certain file > and > >>>> line numbers... for > >>>> example: > >>>> > >>>> > >>>> // dbg.os: > >>>> > >>>> function setBreakpoint( filename, line ) > >>>> { > >>>> var file = pkg.fs.resolve(filename); > >>>> Debugger.setBreakpoint( > >>>> file, line, > >>>> new function() extends > Debugger.Breakpoint() > >>>> > >> { > >> > >>>> > >>>> public function handle( scope, file, > line > >>>> > >> ) > >> > >>>> { > >>>> var status = null; > >>>> > >>>> > >>>> mixin java.io; > >>>> writeln("hit breakpoint at " + file + > >>>> > >> ":" + > >> > >>>> line); > >>>> var shell = new function() extends > >>>> oscript.Shell( > >>>> new BufferedReader( new > >>>> InputStreamReader(System.in) ), > >>>> new PrintWriter(System.out), > >>>> new PrintWriter(System.err) > >>>> ) { > >>>> > >>>> // overload to evaluate in the scope > >>>> > >> of > >> > >>>> the breakpoint > >>>> public function evalStr(str) > >>>> { > >>>> // note: default implementation of > >>>> read() automagically > >>>> appends ";" > >>>> if( (str == "exit;") || (str == > >>>> > >> "c;") ) > >> > >>>> status = "exit"; > >>>> else if( str == "step;" || (str == > >>>> "s;") ) status = "step"; > >>>> > >>>> if( status != null ) > >>>> return status; > >>>> > >>>> return > >>>> oscript.OscriptInterpreter.__eval( str, scope > ); > >>>> } > >>>> > >>>> private var _super_read = read; > >>>> > >>>> public function read() > >>>> { > >>>> if( status != null ) > >>>> return "exit"; > >>>> return _super_read(); > >>>> } > >>>> > >>>> }(); > >>>> > >>>> shell.run(); > >>>> > >>>> if( status == "step" ) > >>>> return this; // keep stepping > >>>> > >>>> return null; // stop stepping > >>>> } > >>>> > >>>> }() > >>>> ); > >>>> } > >>>> > >>>> > >>>> --------------------------- > >>>> > >>>> // test.os > >>>> > >>>> import "dbg.os"; > >>>> > >>>> var globalvar = 2; > >>>> > >>>> function test() > === message truncated === |
From: Rob C. <ro...@ti...> - 2005-10-21 00:42:38
|
hmm... try putting a try/catch around the call to __eval()... it could be throwing an exception for some reason. Which ObjectScript version are you using? Send me your version of setBreakpoint() (if you've made any changes), and I'll try to reproduce it when I get a few mins over the weekend. btw, sorry for the delayed response, I've been in the midst of a major debugging session for the last few days. (Debugging object code on a small embedded platform is fun.) On Oct 18, 2005, at 9:36 AM, Lysander David wrote: > Unfortunately, even after stepping ( 's' ) for one > line > nothing is written to stdout. Additionally, > attempting to write a simple string to stdout like > this: > > writeln ( "a nice string" ); > > doesn't result in any output. > > Additionally, after modifying > oscript.OscriptInterpreter.__eval(String str, Scope > scope) > > to print the string to be evaluated with this > > System.out.println ( "eval: \"" + str + "\""); > > nothing is printed out. It almost appears that > __eval is not being called. > > How would it be possible to ensure that __eval > is getting called ? > > Thanks, > Lysander > > > --- Rob Clark <ro...@ti...> wrote: > > >> you need to "s" (step) for at least one line, >> because on the line it >> halts on, "a" has not been declared yet. It should >> probably result >> in a NoSuchMemberException which isn't getting >> printed out for some >> reason >> >> >> On Oct 17, 2005, at 10:56 PM, Lysander David wrote: >> >> >>> That appears to work. However after hitting the >>> breakpoint entering this: >>> >>> writeln ( "a" ) >>> >>> results in nothing being written to standard out. >>> >>> Does that successfully write anything to standarad >>> >> out >> >>> for you ? >>> >>> If not, do you know what needs to be changed in >>> order to allow that command to successfully output >>> text ? >>> >>> Thanks, >>> Lysander >>> >>> >>> --- Rob Clark <ro...@ti...> wrote: >>> >>> >>> >>>> not really... you might be able to use the >>>> >> debugger >> >>>> API to setup a >>>> read-eval-print shell to run at certain file and >>>> line numbers... for >>>> example: >>>> >>>> >>>> // dbg.os: >>>> >>>> function setBreakpoint( filename, line ) >>>> { >>>> var file = pkg.fs.resolve(filename); >>>> Debugger.setBreakpoint( >>>> file, line, >>>> new function() extends Debugger.Breakpoint() >>>> >> { >> >>>> >>>> public function handle( scope, file, line >>>> >> ) >> >>>> { >>>> var status = null; >>>> >>>> >>>> mixin java.io; >>>> writeln("hit breakpoint at " + file + >>>> >> ":" + >> >>>> line); >>>> var shell = new function() extends >>>> oscript.Shell( >>>> new BufferedReader( new >>>> InputStreamReader(System.in) ), >>>> new PrintWriter(System.out), >>>> new PrintWriter(System.err) >>>> ) { >>>> >>>> // overload to evaluate in the scope >>>> >> of >> >>>> the breakpoint >>>> public function evalStr(str) >>>> { >>>> // note: default implementation of >>>> read() automagically >>>> appends ";" >>>> if( (str == "exit;") || (str == >>>> >> "c;") ) >> >>>> status = "exit"; >>>> else if( str == "step;" || (str == >>>> "s;") ) status = "step"; >>>> >>>> if( status != null ) >>>> return status; >>>> >>>> return >>>> oscript.OscriptInterpreter.__eval( str, scope ); >>>> } >>>> >>>> private var _super_read = read; >>>> >>>> public function read() >>>> { >>>> if( status != null ) >>>> return "exit"; >>>> return _super_read(); >>>> } >>>> >>>> }(); >>>> >>>> shell.run(); >>>> >>>> if( status == "step" ) >>>> return this; // keep stepping >>>> >>>> return null; // stop stepping >>>> } >>>> >>>> }() >>>> ); >>>> } >>>> >>>> >>>> --------------------------- >>>> >>>> // test.os >>>> >>>> import "dbg.os"; >>>> >>>> var globalvar = 2; >>>> >>>> function test() >>>> { >>>> var a = 1; // <--- line 8 >>>> var b = 2; >>>> writeln("a=" + a + ", b=" + b + ", globalvar=" >>>> >> + >> >>>> globalvar); >>>> } >>>> >>>> >>>> setBreakpoint("test.os",8); >>>> >>>> test(); >>>> >>>> >>>> --------------------------- >>>> >>>> this is not very clean, but just meant to be an >>>> example.. maybe >>>> someday someone will have some time to package >>>> >> this >> >>>> up into a nice >>>> command-line debugger program. >>>> >>>> >>>> >>>> On Oct 17, 2005, at 3:08 PM, Lysander David >>>> >> wrote: >> >>>> >>>> >>>> >>>>> Hi, >>>>> >>>>> Is there a commandline debugger for objectscript >>>>> >> ? >> >>>>> >>>>> Thanks, >>>>> Lysander >>>>> >>>>> >>>> >>>> >>>> >>>> >>> >>> >>> >> >> >> ____________________ >> CONTACT INFORMATION: >> email: ro...@ti... >> IM: rob@sandjabber >> desk: 1 858 552 2946 >> cell: 1 619 300 9661 >> >> >> >> >> > > -- Rob ____________________ CONTACT INFORMATION: email: ro...@ti... IM: rob@sandjabber desk: 1 858 552 2946 cell: 1 619 300 9661 |
From: Lysander D. <sa...@sb...> - 2005-10-18 16:37:19
|
Unfortunately, even after stepping ( 's' ) for one line nothing is written to stdout. Additionally, attempting to write a simple string to stdout like this: writeln ( "a nice string" ); doesn't result in any output. Additionally, after modifying oscript.OscriptInterpreter.__eval(String str, Scope scope) to print the string to be evaluated with this System.out.println ( "eval: \"" + str + "\""); nothing is printed out. It almost appears that __eval is not being called. How would it be possible to ensure that __eval is getting called ? Thanks, Lysander --- Rob Clark <ro...@ti...> wrote: > you need to "s" (step) for at least one line, > because on the line it > halts on, "a" has not been declared yet. It should > probably result > in a NoSuchMemberException which isn't getting > printed out for some > reason > > > On Oct 17, 2005, at 10:56 PM, Lysander David wrote: > > > That appears to work. However after hitting the > > breakpoint entering this: > > > > writeln ( "a" ) > > > > results in nothing being written to standard out. > > > > Does that successfully write anything to standarad > out > > for you ? > > > > If not, do you know what needs to be changed in > > order to allow that command to successfully output > > text ? > > > > Thanks, > > Lysander > > > > > > --- Rob Clark <ro...@ti...> wrote: > > > > > >> not really... you might be able to use the > debugger > >> API to setup a > >> read-eval-print shell to run at certain file and > >> line numbers... for > >> example: > >> > >> > >> // dbg.os: > >> > >> function setBreakpoint( filename, line ) > >> { > >> var file = pkg.fs.resolve(filename); > >> Debugger.setBreakpoint( > >> file, line, > >> new function() extends Debugger.Breakpoint() > { > >> > >> public function handle( scope, file, line > ) > >> { > >> var status = null; > >> > >> > >> mixin java.io; > >> writeln("hit breakpoint at " + file + > ":" + > >> line); > >> var shell = new function() extends > >> oscript.Shell( > >> new BufferedReader( new > >> InputStreamReader(System.in) ), > >> new PrintWriter(System.out), > >> new PrintWriter(System.err) > >> ) { > >> > >> // overload to evaluate in the scope > of > >> the breakpoint > >> public function evalStr(str) > >> { > >> // note: default implementation of > >> read() automagically > >> appends ";" > >> if( (str == "exit;") || (str == > "c;") ) > >> status = "exit"; > >> else if( str == "step;" || (str == > >> "s;") ) status = "step"; > >> > >> if( status != null ) > >> return status; > >> > >> return > >> oscript.OscriptInterpreter.__eval( str, scope ); > >> } > >> > >> private var _super_read = read; > >> > >> public function read() > >> { > >> if( status != null ) > >> return "exit"; > >> return _super_read(); > >> } > >> > >> }(); > >> > >> shell.run(); > >> > >> if( status == "step" ) > >> return this; // keep stepping > >> > >> return null; // stop stepping > >> } > >> > >> }() > >> ); > >> } > >> > >> > >> --------------------------- > >> > >> // test.os > >> > >> import "dbg.os"; > >> > >> var globalvar = 2; > >> > >> function test() > >> { > >> var a = 1; // <--- line 8 > >> var b = 2; > >> writeln("a=" + a + ", b=" + b + ", globalvar=" > + > >> globalvar); > >> } > >> > >> > >> setBreakpoint("test.os",8); > >> > >> test(); > >> > >> > >> --------------------------- > >> > >> this is not very clean, but just meant to be an > >> example.. maybe > >> someday someone will have some time to package > this > >> up into a nice > >> command-line debugger program. > >> > >> > >> > >> On Oct 17, 2005, at 3:08 PM, Lysander David > wrote: > >> > >> > >>> Hi, > >>> > >>> Is there a commandline debugger for objectscript > ? > >>> > >>> Thanks, > >>> Lysander > >>> > >> > >> > >> > > > > > > > ____________________ > CONTACT INFORMATION: > email: ro...@ti... > IM: rob@sandjabber > desk: 1 858 552 2946 > cell: 1 619 300 9661 > > > > |
From: Rob C. <ro...@ti...> - 2005-10-18 06:22:34
|
you need to "s" (step) for at least one line, because on the line it halts on, "a" has not been declared yet. It should probably result in a NoSuchMemberException which isn't getting printed out for some reason On Oct 17, 2005, at 10:56 PM, Lysander David wrote: > That appears to work. However after hitting the > breakpoint entering this: > > writeln ( "a" ) > > results in nothing being written to standard out. > > Does that successfully write anything to standarad out > for you ? > > If not, do you know what needs to be changed in > order to allow that command to successfully output > text ? > > Thanks, > Lysander > > > --- Rob Clark <ro...@ti...> wrote: > > >> not really... you might be able to use the debugger >> API to setup a >> read-eval-print shell to run at certain file and >> line numbers... for >> example: >> >> >> // dbg.os: >> >> function setBreakpoint( filename, line ) >> { >> var file = pkg.fs.resolve(filename); >> Debugger.setBreakpoint( >> file, line, >> new function() extends Debugger.Breakpoint() { >> >> public function handle( scope, file, line ) >> { >> var status = null; >> >> >> mixin java.io; >> writeln("hit breakpoint at " + file + ":" + >> line); >> var shell = new function() extends >> oscript.Shell( >> new BufferedReader( new >> InputStreamReader(System.in) ), >> new PrintWriter(System.out), >> new PrintWriter(System.err) >> ) { >> >> // overload to evaluate in the scope of >> the breakpoint >> public function evalStr(str) >> { >> // note: default implementation of >> read() automagically >> appends ";" >> if( (str == "exit;") || (str == "c;") ) >> status = "exit"; >> else if( str == "step;" || (str == >> "s;") ) status = "step"; >> >> if( status != null ) >> return status; >> >> return >> oscript.OscriptInterpreter.__eval( str, scope ); >> } >> >> private var _super_read = read; >> >> public function read() >> { >> if( status != null ) >> return "exit"; >> return _super_read(); >> } >> >> }(); >> >> shell.run(); >> >> if( status == "step" ) >> return this; // keep stepping >> >> return null; // stop stepping >> } >> >> }() >> ); >> } >> >> >> --------------------------- >> >> // test.os >> >> import "dbg.os"; >> >> var globalvar = 2; >> >> function test() >> { >> var a = 1; // <--- line 8 >> var b = 2; >> writeln("a=" + a + ", b=" + b + ", globalvar=" + >> globalvar); >> } >> >> >> setBreakpoint("test.os",8); >> >> test(); >> >> >> --------------------------- >> >> this is not very clean, but just meant to be an >> example.. maybe >> someday someone will have some time to package this >> up into a nice >> command-line debugger program. >> >> >> >> On Oct 17, 2005, at 3:08 PM, Lysander David wrote: >> >> >>> Hi, >>> >>> Is there a commandline debugger for objectscript ? >>> >>> Thanks, >>> Lysander >>> >> >> >> > > ____________________ CONTACT INFORMATION: email: ro...@ti... IM: rob@sandjabber desk: 1 858 552 2946 cell: 1 619 300 9661 |
From: Lysander D. <sa...@sb...> - 2005-10-18 05:56:36
|
That appears to work. However after hitting the breakpoint entering this: writeln ( "a" ) results in nothing being written to standard out. Does that successfully write anything to standarad out for you ? If not, do you know what needs to be changed in order to allow that command to successfully output text ? Thanks, Lysander --- Rob Clark <ro...@ti...> wrote: > not really... you might be able to use the debugger > API to setup a > read-eval-print shell to run at certain file and > line numbers... for > example: > > > // dbg.os: > > function setBreakpoint( filename, line ) > { > var file = pkg.fs.resolve(filename); > Debugger.setBreakpoint( > file, line, > new function() extends Debugger.Breakpoint() { > > public function handle( scope, file, line ) > { > var status = null; > > > mixin java.io; > writeln("hit breakpoint at " + file + ":" + > line); > var shell = new function() extends > oscript.Shell( > new BufferedReader( new > InputStreamReader(System.in) ), > new PrintWriter(System.out), > new PrintWriter(System.err) > ) { > > // overload to evaluate in the scope of > the breakpoint > public function evalStr(str) > { > // note: default implementation of > read() automagically > appends ";" > if( (str == "exit;") || (str == "c;") ) > status = "exit"; > else if( str == "step;" || (str == > "s;") ) status = "step"; > > if( status != null ) > return status; > > return > oscript.OscriptInterpreter.__eval( str, scope ); > } > > private var _super_read = read; > > public function read() > { > if( status != null ) > return "exit"; > return _super_read(); > } > > }(); > > shell.run(); > > if( status == "step" ) > return this; // keep stepping > > return null; // stop stepping > } > > }() > ); > } > > > --------------------------- > > // test.os > > import "dbg.os"; > > var globalvar = 2; > > function test() > { > var a = 1; // <--- line 8 > var b = 2; > writeln("a=" + a + ", b=" + b + ", globalvar=" + > globalvar); > } > > > setBreakpoint("test.os",8); > > test(); > > > --------------------------- > > this is not very clean, but just meant to be an > example.. maybe > someday someone will have some time to package this > up into a nice > command-line debugger program. > > > > On Oct 17, 2005, at 3:08 PM, Lysander David wrote: > > > Hi, > > > > Is there a commandline debugger for objectscript ? > > > > Thanks, > > Lysander > > |
From: Rob C. <ro...@ti...> - 2005-10-17 23:10:40
|
not really... you might be able to use the debugger API to setup a read-eval-print shell to run at certain file and line numbers... for example: // dbg.os: function setBreakpoint( filename, line ) { var file = pkg.fs.resolve(filename); Debugger.setBreakpoint( file, line, new function() extends Debugger.Breakpoint() { public function handle( scope, file, line ) { var status = null; mixin java.io; writeln("hit breakpoint at " + file + ":" + line); var shell = new function() extends oscript.Shell( new BufferedReader( new InputStreamReader(System.in) ), new PrintWriter(System.out), new PrintWriter(System.err) ) { // overload to evaluate in the scope of the breakpoint public function evalStr(str) { // note: default implementation of read() automagically appends ";" if( (str == "exit;") || (str == "c;") ) status = "exit"; else if( str == "step;" || (str == "s;") ) status = "step"; if( status != null ) return status; return oscript.OscriptInterpreter.__eval( str, scope ); } private var _super_read = read; public function read() { if( status != null ) return "exit"; return _super_read(); } }(); shell.run(); if( status == "step" ) return this; // keep stepping return null; // stop stepping } }() ); } --------------------------- // test.os import "dbg.os"; var globalvar = 2; function test() { var a = 1; // <--- line 8 var b = 2; writeln("a=" + a + ", b=" + b + ", globalvar=" + globalvar); } setBreakpoint("test.os",8); test(); --------------------------- this is not very clean, but just meant to be an example.. maybe someday someone will have some time to package this up into a nice command-line debugger program. On Oct 17, 2005, at 3:08 PM, Lysander David wrote: > Hi, > > Is there a commandline debugger for objectscript ? > > Thanks, > Lysander |
From: Lysander D. <sa...@sb...> - 2005-10-17 22:08:48
|
Hi, Is there a commandline debugger for objectscript ? Thanks, Lysander |
From: Lysander D. <sa...@sb...> - 2005-10-12 12:54:10
|
Note: forwarded message attached. |
From: Rob C. <ro...@ti...> - 2005-10-07 18:33:31
|
Hmm... I suspect it will depend on which classloader loads oscript.OscriptInterpreter... if you manage to get the AntClassloader2 to load the ObjectScript classes, then there is probably nothing more to do. Everything goes thru oscript.compiler.CompilerClassLoader.forName(), so you could probably put some code in there to try an alternate classloader. I actually probably add an API to somehow register an alternative ClassLoader anyways, since it seems to be required to work around the way eclipse's classloaders perform additional access restrictions. (Ie. a plugin using ObjectScript would need to provide a class loader so that ObjectScript could load classes defined by that plugin.) And beyond that, there is the declareJavaPackage() hack, since there is no java API to discover java packages of java classes that have not yet been loaded. -- Rob On Oct 7, 2005, at 11:10 AM, Lysander David wrote: > Thanks for the quick response. > > Since that doesn't modify the classpath for > the classloader, is there an accepted way > to set up a new classloader with a classpath > defined at runtime. As quick hack, I've > compiled the AntClassloader2 > and was able to load a class from a runtime-defined > classpath in plain java. If that is acceptable within > objectscript, > how would it be possible to make the JavaPackage > object aware of the AntClasloader2 ? > > Thanks again, > Lysander > > > > --- Rob Clark <ro...@ti...> wrote: > > >> A couple things... >> >> first, mounting it just makes it available within >> the abstract >> filesystem. So you could then, for example, use >> pkg.fs.File() to >> access files within the jar (ie >> "/jar/xstream-SNAPSHOT/foo/bar.os"). >> And of course if you have script files within the >> jar, they could be >> imported or accessed thru pkg. But it does not add >> the jar to the >> classpath. (Although I think this could be >> implemented, and it is an >> interesting idea... I'll have to look into it.) >> >> second, you will probably need to use >> pkg.system.declareJavaPackage() >> for any java package that is first accessed from the >> script >> environment, otherwise the JavaPackage object has no >> way to know that >> the package actually exists, and so it will throw a >> >> NoSuchMemberException. >> >> >> >> On Oct 6, 2005, at 6:10 PM, Lysander David wrote: >> >> >>> Hi, >>> >>> How does one use pkg.system.mountJarFile ? >>> >>> I am attempting to instantiate an object of >>> class com.thoughtworks.xstream.XStream. >>> The class exists in this jar: >>> >>> xstream-SNAPSHOT.jar >>> >>> When I execute these commands: >>> >>> import "reflection.os"; >>> var file = new pkg.fs.File ( >>> >> "xstream-SNAPSHOT.jar" ); >> >>> pkg.system.mountJarFile ( file ); >>> var com = new JavaPackage ("com" ); >>> var x = new com.thoughtworks.xstream.XStream(); >>> >>> >>> I get this error: >>> >>> oscript.exceptions.PackagedScriptObjectException: >>> NoSuchMemberException: no such member: >>> >> JavaPackage: >> >>> thoughtworks >>> >>> >>> What must be done to mount xstream-SNAPSHOT.jar >>> and instantiate com.thoughtworks.xstream.XStream ? >>> >>> Thanks >>> >>> >> >> -- Rob >> >> ____________________ >> CONTACT INFORMATION: >> email: ro...@ti... >> IM: rob@sandjabber >> >> >> >> >> > > -- Rob ____________________ CONTACT INFORMATION: email: ro...@ti... IM: rob@sandjabber desk: 1 858 552 2946 cell: 1 619 300 9661 |
From: Lysander D. <sa...@sb...> - 2005-10-07 18:11:02
|
Thanks for the quick response. Since that doesn't modify the classpath for the classloader, is there an accepted way to set up a new classloader with a classpath defined at runtime. As quick hack, I've compiled the AntClassloader2 and was able to load a class from a runtime-defined classpath in plain java. If that is acceptable within objectscript, how would it be possible to make the JavaPackage object aware of the AntClasloader2 ? Thanks again, Lysander --- Rob Clark <ro...@ti...> wrote: > A couple things... > > first, mounting it just makes it available within > the abstract > filesystem. So you could then, for example, use > pkg.fs.File() to > access files within the jar (ie > "/jar/xstream-SNAPSHOT/foo/bar.os"). > And of course if you have script files within the > jar, they could be > imported or accessed thru pkg. But it does not add > the jar to the > classpath. (Although I think this could be > implemented, and it is an > interesting idea... I'll have to look into it.) > > second, you will probably need to use > pkg.system.declareJavaPackage() > for any java package that is first accessed from the > script > environment, otherwise the JavaPackage object has no > way to know that > the package actually exists, and so it will throw a > > NoSuchMemberException. > > > > On Oct 6, 2005, at 6:10 PM, Lysander David wrote: > > > Hi, > > > > How does one use pkg.system.mountJarFile ? > > > > I am attempting to instantiate an object of > > class com.thoughtworks.xstream.XStream. > > The class exists in this jar: > > > > xstream-SNAPSHOT.jar > > > > When I execute these commands: > > > > import "reflection.os"; > > var file = new pkg.fs.File ( > "xstream-SNAPSHOT.jar" ); > > pkg.system.mountJarFile ( file ); > > var com = new JavaPackage ("com" ); > > var x = new com.thoughtworks.xstream.XStream(); > > > > > > I get this error: > > > > oscript.exceptions.PackagedScriptObjectException: > > NoSuchMemberException: no such member: > JavaPackage: > > thoughtworks > > > > > > What must be done to mount xstream-SNAPSHOT.jar > > and instantiate com.thoughtworks.xstream.XStream ? > > > > Thanks > > > > -- Rob > > ____________________ > CONTACT INFORMATION: > email: ro...@ti... > IM: rob@sandjabber > > > > |