Skip to content

Commit

Permalink
Original versions
Browse files Browse the repository at this point in the history
svn path=/trunk/; revision=24485
  • Loading branch information
David S. Berry committed Jun 6, 2007
1 parent c7e40e3 commit 9ac6e8a
Show file tree
Hide file tree
Showing 4 changed files with 1,842 additions and 0 deletions.
106 changes: 106 additions & 0 deletions ftemplateclass.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
1 - Replace TemplateClass with capitalised class name
2 - Replace templateclass with lower case class name
3 - Replace TEMPLATECLASS with upper case class name
4 - Replace TemplateParent with capitalised parent class name
5 - Replace templateparent with lower case parent class name
6 - Replace all occurrences of >>> with suitable text

/*
*+
* Name:
* ftemplateclass.c
* Purpose:
* Define a FORTRAN 77 interface to the AST TemplateClass class.
* Type of Module:
* C source file.
* Description:
* This file defines FORTRAN 77-callable C functions which provide
* a public FORTRAN 77 interface to the TemplateClass class.
* Routines Defined:
* AST_ISATEMPLATECLASS
* AST_TEMPLATECLASS
* Copyright:
* Copyright (C) 2007 Science & Technology Facilities Council.
* All Rights Reserved.
* Licence:
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public Licence as
* published by the Free Software Foundation; either version 2 of
* the Licence, 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 of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public Licence for more details.
*
* You should have received a copy of the GNU General Public Licence
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place,Suite 330, Boston, MA
* 02111-1307, USA
* Authors:
* DSB: David S. Berry (Starlink)
* History:
* >>> 20-NOV-2002 (DSB):
* Original version.
*/

/* Define the astFORTRAN77 macro which prevents error messages from
AST C functions from reporting the file and line number where the
error occurred (since these would refer to this file, they would
not be useful). */
#define astFORTRAN77

/* Header files. */
/* ============= */
#include "f77.h" /* FORTRAN <-> C interface macros (SUN/209) */
#include "c2f77.h" /* F77 <-> C support functions/macros */
#include "error.h" /* Error reporting facilities */
#include "memory.h" /* Memory handling facilities */
#include "templateclass.h" /* C interface to the TemplateClass class */

F77_LOGICAL_FUNCTION(ast_isatemplateclass)( INTEGER(THIS),
INTEGER(STATUS) ) {
GENPTR_INTEGER(THIS)
F77_LOGICAL_TYPE(RESULT);

astAt( "AST_ISATEMPLATECLASS", NULL, 0 );
astWatchSTATUS(
RESULT = astIsATemplateClass( astI2P( *THIS ) ) ? F77_TRUE : F77_FALSE;
)
return RESULT;
}

F77_INTEGER_FUNCTION(ast_templateclass)( >>> CHARACTER(OPTIONS),
INTEGER(STATUS)
TRAIL(OPTIONS) ) {
>>>
GENPTR_CHARACTER(OPTIONS)
F77_INTEGER_TYPE(RESULT);
int i;
char *options;

astAt( "AST_TEMPLATECLASS", NULL, 0 );
astWatchSTATUS(
options = astString( OPTIONS, OPTIONS_length );

/* Change ',' to '\n' (see AST_SET in fobject.c for why). */
if ( astOK ) {
for ( i = 0; options[ i ]; i++ ) {
if ( options[ i ] == ',' ) options[ i ] = '\n';
}
}
RESULT = astP2I( astTemplateClass( >>> "%s", options ) );
astFree( options );
)
return RESULT;
}

>>>
28 changes: 28 additions & 0 deletions templateclass.README
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
How to add a new public class to AST:

1) Edit the files templateclass.c templateclass.h and ftemplateclass.c,
and for each, do the following:

- Replace TemplateClass with capitalised class name
- Replace templateclass with lower case class name
- Replace TEMPLATECLASS with upper case class name
- Replace TemplateParent with capitalised parent class name
- Replace templateparent with lower case parent class name
- Replace all occurrences of >>> with suitable text
- Add all the classes new functionality

2) Add the three new files to CVS

3) Edit the following files to include reference to the new class

- ast_par.source
- builddocs.in
- loader.c
- Makefile.am
- sun_master.tex
- ast.news

4) Add a test program to the ast_tester script in the ast_tester directory

5) Commit all changes to CVS.

Loading

0 comments on commit 9ac6e8a

Please sign in to comment.