From: David R. <da...@sa...> - 2007-10-04 19:42:20
|
I changed it to use the OTYPE function and it works. I'm willing to change it back to the REQUEST_STRING function if you can = tell me what I missed. Thanks, David Ruggles CCNA MCSE (NT) CNA A+ Network Engineer Safe Data, Inc. (910) 285-7200 da...@sa... -----Original Message----- From: oor...@li... [mailto:oor...@li...] On Behalf Of David Ruggles Sent: Thursday, October 04, 2007 3:26 PM To: 'Open Object Rexx Developer Mailing List' Subject: Re: [Oorexx-devel] Rexx string vs C strings Now that I have all my building issues out of the way I'm back to trying = to code. I tried to write it the way you suggest below but I got the following errors: C:\DEV\OOREXX\TRUNK\kernel\classes\ArrayClass.cpp(1120) : error C2446: = '=3D=3D' : no conversion from 'int' to 'class RexxString *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast C:\DEV\OOREXX\TRUNK\kernel\classes\ArrayClass.cpp(1120) : error C2040: = '=3D=3D' : 'class RexxString *' differs in levels of indirection from 'int' My code at this point is: 1117 if (separator !=3D OREF_NULL) 1118 { 1119 line_end_string =3D REQUEST_STRING(separator); 1120 if (line_end_string =3D=3D null) 1121 { Thanks, =20 David Ruggles CCNA MCSE (NT) CNA A+ Network Engineer Safe Data, Inc. (910) 285-7200 da...@sa... =20 -----Original Message----- From: oor...@li... [mailto:oor...@li...] On Behalf Of Rick McGuire Sent: Thursday, October 04, 2007 10:47 AM To: Open Object Rexx Developer Mailing List Subject: Re: [Oorexx-devel] Rexx string vs C strings Ugh, the test they're making there is not the correct one. The = appropriate sequence should be something like=20 if (format =3D=3D 'S')=20 { if (terminator !=3D OREF_NULL)=20 { line_end_string =3D REQUEST_STRING(terminator);=20 if (line_end_string =3D=3D null)=20 { report_exception(yada, yada, IntegerTwo); // yes, your assumption was correct here.=20 } } =20 } The OTYPE(String, format) test should be replaced by the REQUEST_STRING = bit also. =20 That gets the string set up for you in the variable line_end_string, but there's a tiny memory leak that will result from that. =20 The initialization of line_end_string and the subsequent save(line_end_string) at the beginning needs to moved to an else clause, = and the discard() call at the bottom should only occur if this is the 'L' = form.=20 And one last little bit. Argument checking can be a pain. If the = format is not 'L' (or the default), then there needs to be check to raise max args error if the terminator argument is not OREF_NULL. =20 Rick On 10/4/07, David Ruggles <da...@sa...> wrote: Thanks for the heads-up on Setup.cpp I'm trying to put the separator specified as an argument in to the line_end_string variable which defaults to new_cstring(line_end) So if a users specifies type "S" then it makes sure the second argument = is a String (just like format is checked) and then puts it in to = line_end_string and sets i_form =3D 2 The other assumption I made was in the report_exception1 function call, = I specified a second argument of IntegerTwo.=20 Thanks, David Ruggles CCNA MCSE (NT) CNA A+ Network Engineer Safe Data, Inc. (910) 285-7200 da...@sa... -----Original Message----- From: oor...@li... [mailto:oor...@li... ] On Behalf Of Rick McGuire Sent: Thursday, October 04, 2007 10:22 AM To: Open Object Rexx Developer Mailing List Subject: Re: [Oorexx-devel] Rexx string vs C strings Well, generally, in ooRexx code directly, you would never do that. = ooRexx=20 strings (internally) have a length and data vs. C strings which are null terminated. Trying to used these as C strings will mess you up if the = Rexx data contains embedded '00'x characters. What you need to deal with here are RexxString C++ objects, which have = lots=20 and lots of methods for doing string manipulations. Looking at the current array toString() method, I see it does all of the concatenates using RexxString objects anyway, so you'd be just fine = keeping an argument passed in as a RexxString object. Or perhaps I'm just = missing=20 the context of the question. Important note: I assume you're going to be adding an additional = argument to that method. In source file Setup.cpp, there's code that does the = export of all of the internal C++ methods as Rexx methods. Part of that = exporting=20 is the count of arguments that the method takes. You'll need to bump the argument count by one for RexxArray::toString. Rick PS, if you truly do need to use a RexxString object as an ASCII-Z = string,=20 just call the getStringData() method. All RexxString objects include an extra trailing null byte for situations where they need to be converted = into null terminated strings for interactions with external APIs. -------------------------------------------------------------------------= This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser.=20 Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Oorexx-devel mailing list Oor...@li... https://lists.sourceforge.net/lists/listinfo/oorexx-devel -------------------------------------------------------------------------= This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Oorexx-devel mailing list Oor...@li... https://lists.sourceforge.net/lists/listinfo/oorexx-devel |