T
Thomas
Hello all
Having trouble with getting Error Information from spidermonkey. How would
one convert a C structure to CSharp?
struct JSErrorReport {
const char *filename; // source file name, URL, etc., or null
uintN lineno; // source line number
const char *linebuf; // offending source line without
final \n
const char *tokenptr; // pointer to error token in linebuf
const jschar *uclinebuf; // unicode (original) line buffer
const jschar *uctokenptr; // unicode (original) token pointer
uintN flags; // error/warning, etc.
uintN errorNumber; // the error number, e.g. see
js.msg
const jschar *ucmessage; // the (default) error message
const jschar **messageArgs; // arguments for the error message
}
as well as a C type callback function:
ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
I've been working on this thing for a week and only got to the point where I
can get it to call ErrorReporter, but it returns gibberish. - Sample below.
<*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*>
public delegate void CallBackPtr(IntPtr cx, IntPtr message, JS.JSErrorReport
report);
<*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*>
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct JSErrorReport
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string filename;
public UInt16 lineno;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string linebuf;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string tokenptr;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string uclinebuf;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string uctokenptr;
public UInt16 flags;
public UInt16 errorNumber;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string ucmessage;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string messageArgs;
};
<*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*>
Any type of help or direction on this thing will finally let me sleep at
night.
Thanks
Thomas
Having trouble with getting Error Information from spidermonkey. How would
one convert a C structure to CSharp?
struct JSErrorReport {
const char *filename; // source file name, URL, etc., or null
uintN lineno; // source line number
const char *linebuf; // offending source line without
final \n
const char *tokenptr; // pointer to error token in linebuf
const jschar *uclinebuf; // unicode (original) line buffer
const jschar *uctokenptr; // unicode (original) token pointer
uintN flags; // error/warning, etc.
uintN errorNumber; // the error number, e.g. see
js.msg
const jschar *ucmessage; // the (default) error message
const jschar **messageArgs; // arguments for the error message
}
as well as a C type callback function:
ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
I've been working on this thing for a week and only got to the point where I
can get it to call ErrorReporter, but it returns gibberish. - Sample below.
<*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*>
public delegate void CallBackPtr(IntPtr cx, IntPtr message, JS.JSErrorReport
report);
<*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*>
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct JSErrorReport
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string filename;
public UInt16 lineno;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string linebuf;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string tokenptr;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string uclinebuf;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string uctokenptr;
public UInt16 flags;
public UInt16 errorNumber;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string ucmessage;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string messageArgs;
};
<*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*>
Any type of help or direction on this thing will finally let me sleep at
night.
Thanks
Thomas