void MapFunctionComment( int f, int *vars ) { FILE *oldf; oldf = UseFile( mapFile ); FunctionStart( f, vars ); /*NewLines(1); CommentFncBegin( f, vars );*/ FlushBuf(); UseFile( oldf ); }
void MATLAB_FunctionBegin( int f, ... ) { Va_list args; int i; int v; int vars[20]; char * name; int narg; FILE *oldf; char buf[200], bufname[200]; time_t t; name = varTable[ f ]->name; narg = varTable[ f ]->maxi; /*Adi - each Matlab functin requires a separate file*/ sprintf( buf, "%s_%s.m", rootFileName, varTable[ f ]->name ); mex_funFile = fopen(buf, "w"); if( mex_funFile == 0 ) { FatalError(3,"%s: Can't create file", buf ); } UseFile( mex_funFile ); /*Adi*/ Va_start( args, f ); for( i = 0; i < narg; i++ ) vars[ i ] = va_arg( args, int ); va_end( args ); CommentFncBegin( f, vars ); WriteDelim(); WriteComment(""); WriteComment("Generated by KPP - symbolic chemistry Kinetics PreProcessor" ); WriteComment(" KPP is developed at CGRER labs University of Iowa by" ); WriteComment(" Valeriu Damian & Adrian Sandu" ); WriteComment(""); WriteComment("%-20s : %s", "File", buf ); strcpy( buf, (char*)ctime( &t ) ); buf[ (int)strlen(buf) - 1 ] = 0; WriteComment("%-20s : %s", "Time", buf ); WriteComment("%-20s : %s", "Working directory", getcwd(buf, 200) ); WriteComment("%-20s : %s", "Equation file", eqFileName ); WriteComment("%-20s : %s", "Output root filename", rootFileName ); WriteComment(""); WriteDelim(); NewLines(1); MATLAB_FunctionStart( f, vars ); NewLines(1); FlushBuf(); MapFunctionComment( f, vars ); }
void OpenFile( FILE **fpp, char *name, char * ext, char * identity ) { char bufname[200]; char buf[200]; time_t t; int blength; time( &t ); sprintf( bufname, "%s%s", name, ext ); if( *fpp ) fclose( *fpp ); *fpp = fopen( bufname, "w" ); if ( *fpp == 0 ) FatalError(3,"%s: Can't create file", bufname ); UseFile( *fpp ); WriteDelim(); WriteComment(""); WriteComment("%s",identity); WriteComment(""); WriteComment("Generated by KPP-%s symbolic chemistry Kinetics PreProcessor", KPP_VERSION ); WriteComment(" (http://www.cs.vt.edu/~asandu/Software/KPP)"); WriteComment("KPP is distributed under GPL, the general public licence"); WriteComment(" (http://www.gnu.org/copyleft/gpl.html)"); WriteComment("(C) 1995-1997, V. Damian & A. Sandu, CGRER, Univ. Iowa" ); WriteComment("(C) 1997-2005, A. Sandu, Michigan Tech, Virginia Tech" ); WriteComment(" With important contributions from:" ); WriteComment(" M. Damian, Villanova University, USA"); WriteComment(" R. Sander, Max-Planck Institute for Chemistry, Mainz, Germany"); WriteComment(""); WriteComment("%-20s : %s", "File", bufname ); strcpy( buf, ctime( &t ) ); buf[ (int)strlen(buf) - 1 ] = 0; WriteComment("%-20s : %s", "Time", buf ); WriteComment("%-20s : %s", "Working directory", getcwd(buf, 200) ); WriteComment("%-20s : %s", "Equation file", eqFileName ); WriteComment("%-20s : %s", "Output root filename", rootFileName ); WriteComment(""); WriteDelim(); NewLines(1); /* Include Headers in .c Files, except Makefile */ blength = strlen(bufname); if ( (bufname[blength-2]=='.')&&(bufname[blength-1]=='c') ) { C_Inline("#include <stdio.h>"); C_Inline("#include <stdlib.h>"); C_Inline("#include <math.h>"); C_Inline("#include <string.h>"); C_Inline("#include \"%s_Parameters.h\"", rootFileName); C_Inline("#include \"%s_Global.h\"", rootFileName); if( useJacSparse ) C_Inline("#include \"%s_Sparse.h\"", rootFileName); } NewLines(2); }
bool CRightView::OnContextMenu(CPoint point, int /*nLine*/, DiffStates state) { if (!this->IsWindowVisible()) return false; CMenu popup; if (!popup.CreatePopupMenu()) return false; #define ID_USEBLOCK 1 #define ID_USEFILE 2 #define ID_USETHEIRANDYOURBLOCK 3 #define ID_USEYOURANDTHEIRBLOCK 4 #define ID_USEBOTHTHISFIRST 5 #define ID_USEBOTHTHISLAST 6 const UINT uFlags = GetMenuFlags( state ); CString temp; if (m_pwndBottom->IsWindowVisible()) { temp.LoadString(IDS_VIEWCONTEXTMENU_USETHISBLOCK); } else temp.LoadString(IDS_VIEWCONTEXTMENU_USEOTHERBLOCK); popup.AppendMenu(uFlags, ID_USEBLOCK, temp); if (m_pwndBottom->IsWindowVisible()) { temp.LoadString(IDS_VIEWCONTEXTMENU_USETHISFILE); } else temp.LoadString(IDS_VIEWCONTEXTMENU_USEOTHERFILE); popup.AppendMenu(MF_STRING | MF_ENABLED, ID_USEFILE, temp); if (m_pwndBottom->IsWindowVisible()) { temp.LoadString(IDS_VIEWCONTEXTMENU_USEYOURANDTHEIRBLOCK); popup.AppendMenu(uFlags, ID_USEYOURANDTHEIRBLOCK, temp); temp.LoadString(IDS_VIEWCONTEXTMENU_USETHEIRANDYOURBLOCK); popup.AppendMenu(uFlags, ID_USETHEIRANDYOURBLOCK, temp); } else { temp.LoadString(IDS_VIEWCONTEXTMENU_USEBOTHTHISFIRST); popup.AppendMenu(uFlags, ID_USEBOTHTHISFIRST, temp); temp.LoadString(IDS_VIEWCONTEXTMENU_USEBOTHTHISLAST); popup.AppendMenu(uFlags, ID_USEBOTHTHISLAST, temp); } AddCutCopyAndPaste(popup); CompensateForKeyboard(point); int cmd = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, point.x, point.y, this, 0); viewstate rightstate; viewstate bottomstate; viewstate leftstate; switch (cmd) { case ID_EDIT_COPY: OnEditCopy(); return true; case ID_EDIT_CUT: OnEditCopy(); RemoveSelectedText(); return false; case ID_EDIT_PASTE: PasteText(); return false; case ID_USEFILE: UseFile(false); break; case ID_USEBLOCK: UseBlock(false); break; case ID_USEYOURANDTHEIRBLOCK: UseYourAndTheirBlock(rightstate, bottomstate, leftstate); CUndo::GetInstance().AddState(leftstate, rightstate, bottomstate, m_ptCaretPos); break; case ID_USETHEIRANDYOURBLOCK: UseTheirAndYourBlock(rightstate, bottomstate, leftstate); CUndo::GetInstance().AddState(leftstate, rightstate, bottomstate, m_ptCaretPos); break; case ID_USEBOTHTHISFIRST: UseBothRightFirst(rightstate, leftstate); CUndo::GetInstance().AddState(leftstate, rightstate, bottomstate, m_ptCaretPos); break; case ID_USEBOTHTHISLAST: UseBothLeftFirst(rightstate, leftstate); CUndo::GetInstance().AddState(leftstate, rightstate, bottomstate, m_ptCaretPos); break; default: return false; } // switch (cmd) return false; }