On Sep 5, 5:24 am, Evan Shaw <
eds...@gmail.com> wrote:
> On Mon, Sep 5, 2011 at 12:32 AM, OmarShariffDontLikeIt
>
> <
omarshariffdontlik...@gmail.com> wrote:
> > rc = C.tidyParseString( tdoc, _Ctypedef_tmbchar.(input) )
>
> I think you want:
>
> rc = C.tidyParseString(tdoc, _Ctypedef_tmbchar(input))
>
> In other words, remove the dot ('.').
>
> - Evan
Gah! What a stupid mistake! Thanks for pointing it out to me :) Below
is the amended, correctly compiling code:
in := _Ctypedef_tmbchar(*input)
rc = C.tidyParseString( tdoc, &in ) // Parse the input
}
if rc >= 0 {
rc = C.tidyCleanAndRepair( tdoc ) // Tidy it up!
}
if rc >= 0 {
rc = C.tidyRunDiagnostics( tdoc ) // Kvetch
}
if rc > 1 { // If error, force output.
if C.tidyOptSetBool(tdoc, C.TidyForceOutput, C.yes) == 0 {
rc = -1
}
}
if rc >= 0 {
rc = C.tidySaveBuffer( tdoc, &output ) // Pretty Print
}
if rc >= 0 {
out := _Ctype_char(*output.bp)
if rc > 0 {
err := _Ctype_char(*errbuf.bp)
return C.GoString(&out), os.NewError(C.GoString(&err))
}
return C.GoString(&out), nil
}
return "", os.NewSyscallError(fmt.Sprintf( "A severe error (%d)
occurred.\n", int(rc) ), int(rc))
}