Blame | Last modification | View Log | Download | RSS feed
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -RA Computer Language for Statistical Data AnalysisCopyright 1995 Robert Gentlemen and Ross IhakaExtended by Julian HarrisAuckland UniversityAucklandNew Zealand<< RFrontEnd_api.h >><< DOS:frontapi.h >>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Copyright InfoThis program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -DescriptionThis file contains the interface headers for a collectionof functions that need to be written to fulfill theplatform-specific front end.Along with the function names, there are the old namesfirstly as #defines and later as comments as the rest of thecode is integrated.## This file formatted for use with 4 spaces to one tab.- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Issues- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/#ifndef RFrontEnd_api_h#define RFrontEnd_api_h/* = = = = = = = = = = = = = = INCLUDES = = = = = = = = = = = = = = = = */#include <stdio.h>/* = = = = = = = = = = = = = = PROTOTYPES = = = = = = = = = = = = = = = = *//*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -General functions- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*//* StartUp----------------This is called at startup. Use it toinitialise any structures you need. You can use itto load up any images the user may have specified.Required:set R_Init to 1 and set the the R_Unnamedto the appropriate value.*/#define RStartUp This function has gone/*void RFrontEnd_StartUp( void );*//* CleanUp----------------Check whether there is any unsaved data in theworkspace and if so, prompt the user to save it.If the user chooses to save, save the image and callKillDevice() and exit() to finally quit.If the user chooses cancel, call jump_to_toplevel().option:3: save automatically2: don't save1: prompt to save changes if they have been changed*/#define RCleanUp RFrontEnd_CleanUpvoid RFrontEnd_CleanUp( int option );/* InitialiseGraphicsSystem------------------------Set the Dev* globals (defined in <Defn.h>) to theappropriate rendering and graphics manipulation functions,setting any that aren't used to the special function DevNull()Initialise the GP globals (in <Defn.h>) to appropriate values.These variables specify the output characteristicsn andcapabilities of the system.*/#define MacDeviceDriver RFrontEnd_InitialiseGraphicsSystemint RFrontEnd_InitialiseGraphicsSystem( char**, int, double*, int );/* AdjustCursor------------Set the cursor to whatever is appropriate. If inIsBusy is trueset the cursor to a watch cursor or something similar.*/#define RBusy RFrontEnd_AdjustCursorvoid RFrontEnd_AdjustCursor( int inIsBusy );/* R_InitialData------------Calls R_RestoreGlobalEnv which loads the .RData file.*//*define R_InitialData */void R_InitialData( void );/* R_OpenLibraryFile-----------------Calls R_RestoreGlobalEnv which loads the .RData file.*//*define R_OpenLibraryFile */FILE* R_OpenLibraryFile( char* inFileName );/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Command window functionsThe only two that really matter here are the first two.The others can just have stubs.- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*//* ReadStdInput------------Put characters entered by the user into the buffer specified,not exceeding the inBufferSize parameter.*/#define ReadKBD RFrontEnd_ReadStdInputint RFrontEnd_ReadStdInput( char* outBuffer, int inBufferSize );/* WriteStdOutput--------------Display characters passed in the command window.*/#define RWriteConsole RFrontEnd_WriteStdOutputint RFrontEnd_WriteStdOutput( char* inBuffer, int inBufferSize );/* WriteStdError-------------Display characters passed in the command window.*/int RFrontEnd_WriteStdError( char* inBuffer, int inBufferSize );/* ResetStdOutput--------------Set the R_Console flag to 1 so that the system knows that newcommands can be read in from the command window.*/#define ResetConsole RFrontEnd_ResetStdOutputvoid RFrontEnd_ResetStdOutput( void );/* ClearError----------Clear errors displayed from the error window.Optional. Mac version does nothing.*/#define ClearerrConsole RFrontEnd_ClearErrorvoid RFrontEnd_ClearError( void );/* FlushStdOutput--------------Ensure that any characters that haven't been sent out to thecommand window are.*/#define FlushConsole RFrontEnd_FlushStdOutputvoid RFrontEnd_FlushStdOutput( void );/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Command-line function callsThese functions are 'S' expression functions, and theirentries are in the function lookup table of built-in Cfunctions. These are executed when the user types the stringlisted just below the main description.- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*//* EditObject----------Allow the user to textually edit the contents of thespecified object, returning the object in a vector oflines (see an existing version for an example).edit( <object to edit> ) */#define do_macedit RFrontEnd_EditObjectSEXP RFrontEnd_EditObject(SEXP call, SEXP op, SEXP args, SEXP env);/* DumpImage----------Dump an image of the current workspace to disk.dump( <file name to dump image to> ) */#define do_dumpb RFrontEnd_DumpImageSEXP RFrontEnd_DumpImage(SEXP call, SEXP op, SEXP args, SEXP env);/* SystemCall----------Allow the user to execute host-system calls.Not supported on Mac and Windows.system( <call>, <parameters> )*/#define do_system RFrontEnd_SystemCallSEXP RFrontEnd_SystemCall(SEXP call, SEXP op, SEXP args, SEXP env);/* GetMachineDetails-----------------Return a string of the name of the system. Mac version does this:return( mkString("Macintosh" );Later it will return other environment detailsmachine() */#define do_machine RFrontEnd_GetMachineDetailsSEXP RFrontEnd_GetMachineDetails(SEXP call, SEXP op, SEXP args, SEXP env);#endif