# The variables are explained in the file gap/data.g
# name := number;
IF_gap := 70;

IF_SUBPACKAGE_VERSION[IF_gap] := "dev";


IF_CAS_DESCRIPTION[IF_gap] :=
[ "GAP",
"GAP is a system for computational discrete algebra, with particular emphasis on Computational Group Theory.",
"http://www.gap-system.org/" ];


IF_EXEC_NAME[IF_gap] := "gap";
#IF_EXEC_FULL_PATH[IF_gap] := "";
IF_EXEC_OPTIONS[IF_gap] := [ "-b", "-T" ];

IF_QUIT_COMMAND[IF_gap] := ";quit;";
IF_DISPLAY_VERSION[IF_gap] := "VERSION;";


IF_FIRST_COMMAND[IF_gap] := ""; # "ANSI_COLORS :=false;;"; could be used

IF_FIRST_PROMPT[IF_gap] := "gap> ";
IF_PROMPTS[IF_gap] :=[ "gap> " ];
IF_FUNC_REMOVE_PROMPT[IF_gap] := function (OUT)
    local p;
    p:= PositionSublist( OUT, "\r\n" );
    OUT := OUT{[p+2..Length(OUT)]};
    return ReplacedString( OUT, "\ngap> ", "" );
end;


IF_ASSIGN[IF_gap] := ":=";
IF_END_COMMAND[IF_gap] := ";";
IF_IS_THERE_PROMPT[IF_gap] := true;
IF_FUNC_TYPE[IF_gap] := "TypeObj";
IF_TYPE_IS_QUOTED[IF_gap] := false;

IF_STRING_ARE_QUOTED[IF_gap] := true;
IF_FUNC_STRING[IF_gap] := "String";
IF_FUNC_DISPLAY[IF_gap] := "";
IF_PROHIBITED_CHARS[IF_gap] := [  ];


IF_DATA_TYPES[IF_gap] := rec(

openmath := [
"openmath",
ReturnFalse,
function( obj )
    obj := IF_ConvertGapObjectToOpenmathString( obj );
    obj := NormalizedWhitespace( obj );
    obj := IF_ParseGapString( obj );
    return Concatenation( "IF_ConvertOpenmathStringToGapObject( ", obj, " )" );
end,
IF_ConvertOpenmathStringToGapObject ]



#    GapInputPcGroup
#    GapInputPcpGroup
#    GapInputSCTable


);




IF_SHALL_GAP_USE_OPENMATH := function ( b )
    if b  then
        IF_FIRST_COMMAND[IF_gap] := Concatenation( 
"if CompareVersionNumbers( VERSION, \"4.4\" ) then\
    LoadPackage( \"openmath\" );\
else\
    RequirePackage( \"openmath\" );\
fi;\n",
"Read( \"", String( Filename( DirectoriesPackageLibrary( "if", "gap" ), "openmath.g" ) ), "\" );" );
           
        if IsBound( IF_IOLP[IF_gap] ) and IsStream( IF_IOLP[IF_gap] ) and not IsClosedStream( IF_IOLP[IF_gap] )  then
            Info( InfoInterfaces, 1, "IF input: ", IF_FIRST_COMMAND[IF_gap] );
            WriteLine( IF_IOLP[IF_gap], IF_FIRST_COMMAND[IF_gap] );
            IF_READ_UNTIL_PROMPT( IF_gap );
        fi;
        IF_FUNC_TYPE[IF_gap] := function( arg ) return "openmath"; end;
        IF_FUNC_DISPLAY[IF_gap] := "IF_PrintOpenmathString";
        IF_DATA_TYPES[IF_gap].openmath[2] := IF_IsSupportedByGapOpenmath;
    else
        IF_FIRST_COMMAND[IF_gap] := "";
        IF_FUNC_TYPE[IF_gap] := "TypeObj";
        IF_FUNC_DISPLAY[IF_gap] := "";
        IF_DATA_TYPES[IF_gap].openmath[2] := ReturnFalse;
    fi;
end;

