writeChar - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


HelpCallBacks.writeChar

call back function for handling character output from a help page

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

boolean writeChar( Object data, int c ) throws MapleException

Parameters

data

-

arbitrary data that was passed into the getHelp call

c

-

character

Description

• 

writeChar is a member function of the com.maplesoft.openmaple.HelpCallBacks interface.  It is called when a character is output from the help page.

• 

If writeChar returns true the rendering of the help page is terminated.

Examples

import com.maplesoft.openmaple.*;

import com.maplesoft.externalcall.MapleException;

class Example

{

    static private class CallBacks implements HelpCallBacks

    {

    int currentAttrib;

    StringBuffer sBuf;

    int lineNum;

    CallBacks()

    {

        currentAttrib = MAPLE_ATTRIB_NORMAL;

        sBuf = new StringBuffer( 100 );

        lineNum = 1;

    }

    public boolean writeChar( Object data, int c )

    {

        if ( c == 'n' )

        {

        System.out.print( lineNum + " " );

        System.out.println( sBuf.toString() );

        sBuf.delete( 0, sBuf.length() );

        lineNum++;

        }

        else

        {

        sBuf.append( (char)c );

        }

        return false;

    }

    public boolean writeAttrib( Object data, int attrib )

    {

        if ( currentAttrib != attrib )

        {

        switch ( currentAttrib )

        {

            case MAPLE_ATTRIB_BOLD:

            sBuf.append( "</B>" );

            break;

            case MAPLE_ATTRIB_ITAL:

            sBuf.append( "</I>" );

            break;

            case MAPLE_ATTRIB_UNDER:

            sBuf.append( "</U>" );

            break;

        }

        currentAttrib = attrib;

        switch ( currentAttrib )

        {

            case MAPLE_ATTRIB_BOLD:

            sBuf.append( "<B>" );

            break;

            case MAPLE_ATTRIB_ITAL:

            sBuf.append( "<I>" );

            break;

            case MAPLE_ATTRIB_UNDER:

            sBuf.append( "<U>" );

            break;

        }

        }

        return false;

    }

    }

    public static void main( String notused[] ) throws MapleException

    {

    String mapleArgs[];

    Engine engine;

    mapleArgs = new String[1];

    mapleArgs[0] = "java";

    engine = new Engine( mapleArgs, new EngineCallBacksDefault(),

        null, null );

    engine.getHelp( "colon",

        engine.MAPLE_HELP_ALL, new CallBacks(), 70, null );

    }

}

Executing this code produces the following output.

1 <B>Statement Separators</B>

2

3 <B>Description</B>

4 - The statement separators in Maple are semicolon (;) and colon (:).

5

6 - The semicolon is the normal statement separator.

7

8 - In an interactive Maple session, the result of the statement will

9   not be displayed if the statement is terminated with a colon.

10

11 - The two statement separators (semicolon and colon) are equivalent in

12   the case of statements nested one or more levels (inside if

13   -statements, do-statements, or procedures).

14

15 Important: When exporting a worksheet as Maple Input, your worksheet

16 must contain explicit semicolons and not auto-inserted ones. The

17 resulting exported .mpl file will not run in Command-line Maple with

18 auto-inserted semicolons.

19

20

21 <B>Examples</B>

22 > one := 0+1:

23 > two := one+1;

24

25                                <I>two</I> := 2

26

27

28 <B>See Also </B>

29 <U>worksheet,managing,exportMapleInput</U>, <U>statement</U>

30

See Also

ExternalCalling/Java/MapleException

OpenMaple

OpenMaple/Java/Engine

OpenMaple/Java/Engine/getHelp

OpenMaple/Java/HelpCallBacks

OpenMaple/Java/HelpCallBacksDefault

OpenMaple/Java/HelpCallBacksDefault/writeChar