mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-14 07:20:35 +02:00
Make AUD-DO return a cons.
This is simple parsing of the response from AUD-DO. The first part is the string message, the second 1 or NIL depending on if scripting reported OK or not. Note that illegal scripting options often don't produce a 'Failed' but are silently substituted with valid ones.
This commit is contained in:
parent
9b84deb43b
commit
66df5786de
@ -141,6 +141,8 @@ int ExecCommand2(wxString *pIn, wxString *pOut)
|
||||
// The void * return is actually a Lisp LVAL and will be cast to such as needed.
|
||||
extern void * ExecForLisp( char * pIn );
|
||||
extern void * nyq_make_opaque_string( int size, unsigned char *src );
|
||||
extern void * nyq_reformat_aud_do_response(const wxString & Str);
|
||||
|
||||
|
||||
void * ExecForLisp( char * pIn ){
|
||||
wxString Str1( pIn );
|
||||
@ -148,11 +150,11 @@ void * ExecForLisp( char * pIn ){
|
||||
ExecCommand2( &Str1, &Str2 );
|
||||
|
||||
// wxString provides a const char *
|
||||
const char * pStr = static_cast<const char*>(Str2);
|
||||
//const char * pStr = static_cast<const char*>(Str2);
|
||||
|
||||
// We'll be passing it as a non-const unsigned char *
|
||||
// That 'unsafe' cast is actually safe. nyq_make_opaque_string is just copying the string.
|
||||
void * pResult = nyq_make_opaque_string( Str2.Length(), (unsigned char *)pStr );
|
||||
void * pResult = nyq_reformat_aud_do_response( Str2 );
|
||||
return pResult;
|
||||
};
|
||||
|
||||
|
@ -3201,7 +3201,7 @@ static LVAL ngettext()
|
||||
/* These functions may later move to their own source file. */
|
||||
extern void * ExecForLisp( char * pIn );
|
||||
extern void * nyq_make_opaque_string( int size, unsigned char *src );
|
||||
|
||||
extern void * nyq_reformat_aud_do_response(const wxString & Str);
|
||||
|
||||
void * nyq_make_opaque_string( int size, unsigned char *src ){
|
||||
LVAL dst;
|
||||
@ -3217,6 +3217,19 @@ void * nyq_make_opaque_string( int size, unsigned char *src ){
|
||||
return (void*)dst;
|
||||
}
|
||||
|
||||
void * nyq_reformat_aud_do_response(const wxString & Str) {
|
||||
LVAL dst;
|
||||
LVAL message;
|
||||
LVAL success;
|
||||
wxString Left = Str.BeforeLast('\n').BeforeLast('\n');
|
||||
wxString Right = Str.BeforeLast('\n').AfterLast('\n');
|
||||
message = cvstring(Left);
|
||||
success = Right.EndsWith("OK") ? cvfixnum(1) : NIL;
|
||||
dst = cons(message, success);
|
||||
return (void *)dst;
|
||||
}
|
||||
|
||||
|
||||
/* xlc_aud_do -- interface to C routine aud_do */
|
||||
/**/
|
||||
LVAL xlc_aud_do(void)
|
||||
@ -3236,6 +3249,7 @@ LVAL xlc_aud_do(void)
|
||||
// Go call my real function here...
|
||||
dst = (LVAL)ExecForLisp( (char *)leftp );
|
||||
|
||||
//dst = cons(dst, (LVAL)1);
|
||||
/* return the new string */
|
||||
return (dst);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user