~ubuntu-branches/ubuntu/natty/gpp4/natty

« back to all changes in this revision

Viewing changes to src/ccp4_program.c

  • Committer: Bazaar Package Importer
  • Author(s): Morten Kjeldgaard
  • Date: 2008-12-03 11:21:42 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20081203112142-bvuelg39lt2lnokb
Tags: 1.1.0-0ubuntu1
* New upstream version (LP: #322205)
* Some compilation warnings fixed, patch 01-ubuntu-fixes
  sent upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
    @return Program version string.
41
41
 */
42
42
 
43
 
char *ccp4_prog_vers(char *progvers) 
 
43
char *ccp4_prog_vers(const char *progvers) 
44
44
{
45
45
  static char programversion[MAXLEN_PROGVERSION]="";
46
46
  int         i;
122
122
    tmpstr2[2] = '\0';
123
123
    if (strncmp(tmpstr1,"$Date: ",7) == 0) {
124
124
      /* Raw form of RCS string (not exported) i.e.:
125
 
         "$Date: 2004/01/23 16:32:52 $"
 
125
         "$Date: 2008/06/18 17:34:27 $"
126
126
      */
127
127
      /* Build the date string in the form DD/MM/YY */
128
128
      strncpy(RCSDate,rcs_string+15,2);
194
194
  return verbositylevel;
195
195
}
196
196
 
 
197
/*!
 
198
   Set or invoke a user-defined callback function.
 
199
   Internal function: applications should use the API functions
 
200
   ccp4SetCallback and ccp4InvokeCallback
 
201
 */
 
202
int ccp4Callback(CCP4INTFUNCPTR mycallback, char *mode, int ierr, char *message)
 
203
{
 
204
  static CCP4INTFUNCPTR callback=ccp4NullCallback;
 
205
 
 
206
  if (strncmp(mode,"set",3) == 0) {
 
207
    /* Set callback
 
208
       Store the pointer to the callback function */
 
209
    callback=mycallback;
 
210
    return 1;
 
211
  } else if (strncmp(mode,"invoke",3) == 0) {
 
212
    /* Invoke callback
 
213
       Execute the callback function */
 
214
    return callback(ierr,message);
 
215
  }
 
216
  /* Unrecognised mode */
 
217
  return 0;
 
218
}
 
219
 
 
220
/*!
 
221
   Store a pointer to a user-defined callback function of
 
222
   the form "int func(int, char *)"
 
223
   This is a wrapper to ccp4Callback in "set" mode.
 
224
 */
 
225
int ccp4SetCallback(CCP4INTFUNCPTR mycallback)
 
226
{
 
227
  return ccp4Callback(mycallback,"set",-1,"No message");
 
228
}
 
229
 
 
230
/*!
 
231
   Execute the user-defined callback function (previously
 
232
   set up using ccp4SetCallback) with the supplied
 
233
   arguments.
 
234
   This is a wrapper to ccp4Callback in "invoke" mode.
 
235
 */
 
236
int ccp4InvokeCallback(int ierr, char *message)
 
237
{
 
238
  return ccp4Callback(ccp4NullCallback,"invoke",ierr,message);
 
239
}
 
240
 
 
241
/*! 
 
242
  Default null callback function
 
243
   Internal function: this is the default callback function
 
244
   used by ccp4Callback if no user-defined function has been
 
245
   specified.
 
246
 */
 
247
int ccp4NullCallback(int level, char *message)
 
248
{
 
249
  /* This is the default callback function which takes no
 
250
     action */
 
251
  return 1;
 
252
}
197
253
 
198
254
/*! Check existence of licence agreement
199
 
   @param name Name of licence, e.g. "CCP4".
200
 
   @return always return 1.
201
 
   This is a dummy routine in gpp4.
 
255
    @param name Name of licence, e.g. "CCP4".
 
256
    @return always return 1.
 
257
    This is a dummy routine in gpp4.
202
258
*/
203
259
 
204
260
int ccp4_licence_exists(const char *name)
206
262
  return 1;
207
263
}
208
264
 
209
 
 
210
265
/*! Register or query html output level.
211
 
    @param ihtml_in 0 = turn off html output, 1 = turn on html output, -1 = query existing value
 
266
    @param ihtml_in 0 = turn off html output, 1 = turn on html output, 
 
267
    -1 = query existing value
212
268
    @return 0 = no html output, 1 = html output
213
269
    html_log_output and summary_output currently only used by ccperror to
214
270
    tidy up Fortran program output. Defaults are 0 for C programs.
215
271
 */
216
 
 
217
272
int html_log_output(int ihtml_in) {
218
273
  static int ihtml=0;
219
274