00001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00002 * 00003 * The Lemur toolkit for language modeling and information retrieval. 00004 * Copyright (c) 2001 Carnegie Mellon University. All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted for research or educational purposes, 00008 * provided that this copyright notice is maintained and note is made 00009 * of any changes to the source code. 00010 * 00011 * This is a research system. The code is distributed on an "as is" basis, 00012 * without any warranty, express or implied. 00013 * 00014 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 00015 00016 #ifndef _PARAM_H_ 00017 #define _PARAM_H_ 00018 00019 #include <stdio.h> 00020 /* #include "util.h" */ 00021 00022 #ifdef WIN32 00023 typedef __int64 INT64; 00024 #else 00025 typedef long long INT64; 00026 #endif 00027 00028 INT64 param_getll(const char *parameter_name, INT64 default_value); 00029 00030 int param_geti(const char *parameter_name, int default_value); 00031 00032 double param_getf(const char *parameter_name, double default_value); 00033 00034 char *param_getc(const char *parameter_name, char *default_value); 00035 00036 char *param_gets(const char *parameter_name); 00037 00038 int param_getb(const char *parameter_name, int default_value); 00039 /* Returns true if the value of <parameter_name> is 1, true, or yes, 00040 (case insensitive), false for any other value, and default_value 00041 for no value. */ 00042 00043 int param_symvarie(const char *parameter_name, int *returned_value); 00044 /* Returns true if a value was found, false otherwise */ 00045 00046 int param_symvarfe(const char *parameter_name, double *returned_value); 00047 /* Ditto */ 00048 00049 int param_symvarce(const char *parameter_name, char *returned_value); 00050 /* Ditto. Note that the second argument is a "pointer to a char *", 00051 i.e., approximately a pointer to a string. */ 00052 00053 void param_set(const char *parameter_name, char *new_value); 00054 /* Changes the value of ddinf parameter <parameter_name>. This can be 00055 used to communicate with subroutines which expect ddinf 00056 parameters without having to make sure they exist in the ddinf file. 00057 Note, however, that values assigned in the ddinf file are 00058 OVERRIDDEN by a call to param_set. */ 00059 /* One might want to implement a param_add which would allow adding 00060 new ddinf parameters within a program, but which could not 00061 override values from the ddinf file. */ 00062 00063 void param_dump (FILE *stream); 00064 /* Writes the current ddinf bindings to a stream */ 00065 00066 void param_push_prefix (const char *hot_prefix); 00067 /* Push the current prefix to be applied to all ddnames */ 00068 00069 void param_pop_prefix (void); 00070 /* Pop the current prefix */ 00071 00072 int param_push_file (const char *fn); 00073 /* Use the file for all bindings */ 00074 00075 char *param_pop_file (void); 00076 /* Pop current bindings */ 00077 00078 void param_display(); 00079 /* display parameter bindings */ 00080 00081 #endif 00082