Skip to content

Commit

Permalink
removed using_the_mac stuff from tightbind (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardjgowers authored and greglandrum committed Dec 30, 2018
1 parent 4f1f115 commit a10a9bc
Show file tree
Hide file tree
Showing 23 changed files with 4 additions and 381 deletions.
Empty file removed tightbind/Mac_Fopen.c
Empty file.
1 change: 0 additions & 1 deletion tightbind/Mac_Fopen.h

This file was deleted.

11 changes: 0 additions & 11 deletions tightbind/bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifndef USING_THE_MAC
#include <sys/stat.h>
#include <sys/types.h>
#else
#include <SIOUX.h>
#endif

#ifdef INCLUDE_NETCDF_SUPPORT
#include <netcdf.h>
Expand All @@ -93,11 +89,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
properly. In general the user doesn't have to worry about this.
**********/
#ifndef USING_THE_MAC
#include <stdlib.h>
#else
#include <unix.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
Expand Down Expand Up @@ -141,10 +132,8 @@ the
******/
#define BOOL_CHAR_TO_VALUE(a) a = (a == 'T' ? 1 : 0)

#ifndef USING_THE_MAC
#define TRUE 1
#define FALSE 0
#endif

/*****
used as tabs into the matrices
Expand Down
5 changes: 1 addition & 4 deletions tightbind/distance_mat.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,8 @@ void dump_distance_mats(cell,details)

/* open the file */
sprintf(tempfilename,"%s.DMAT",details->filename);
#ifndef USING_THE_MAC
matfile = open(tempfilename,O_RDWR|O_APPEND|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
#else
matfile = open(tempfilename,O_RDWR|O_TRUNC|O_APPEND|O_CREAT);
#endif

if( matfile == -1 ){
error("Can't open DMAT file for binary I/O");
return;
Expand Down
11 changes: 0 additions & 11 deletions tightbind/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,8 @@ void fill_atomic_parms(atoms,num_atoms,infile,parm_file_name)


/* open the parameter file */
#ifndef USING_THE_MAC
if (!parm_file_name)
parm_file_name = (char *)getenv("BIND_PARM_FILE");
#endif
if( !parm_file_name ){
parm_file_name = (char *)calloc(240,sizeof(char));
if(!parm_file_name)fatal("can't get memory for parm_file_name");
Expand All @@ -467,21 +465,12 @@ void fill_atomic_parms(atoms,num_atoms,infile,parm_file_name)
bzero(custom_atoms,MAX_CUSTOM_ATOMS*sizeof(atom_type));

/* make sure that it opened, but don't exit if not... */
#ifndef USING_THE_MAC
if(!parmfile){
safe_strcpy(err_string,"Can't open parameter file: ");
strcat(err_string,parm_file_name);
strcat(err_string," using default data in eht_parms.h...");
error(err_string);
}
#else
#include "Mac_Fopen.h"
if( !parmfile ){
error("Can't open parm file, please specify a name");
parmfile = choose_mac_file(parm_file_name,MAC_FOPEN_OPEN_NOCD);
if( !parmfile ) fatal("Still can't do it.");
}
#endif
/* loop over the atoms and get the parameters */
num_custom = 0;
for(i=0;i<num_atoms;i++){
Expand Down
32 changes: 0 additions & 32 deletions tightbind/genutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@ void nonfatal_bug( char *errorstring, char *file, int line )
void fatal( errorstring )
char *errorstring;
{
#ifdef USING_THE_MAC
char composite_string[255];
const char *initstring = "FATAL ERROR: ";
unsigned char len;
#endif
fprintf( stderr, "FATAL ERROR: %s.\nExecution Terminated.\n",
errorstring );
if( status_file ){
Expand All @@ -136,13 +131,6 @@ void fatal( errorstring )
if(output_file){
fflush(output_file);
}
#ifdef USING_THE_MAC
bzero(composite_string,255*sizeof(char));
strcpy((char *)composite_string,initstring);
strcat((char *)composite_string,errorstring);
ParamText(CtoPstr(composite_string),NULL,NULL,NULL);
Alert(130, NULL);
#endif
exit(-1);
}

Expand All @@ -154,13 +142,6 @@ void fatal( errorstring )
void error( errorstring )
char *errorstring;
{
#ifdef USING_THE_MAC
char composite_string[255];
const char *initstring = "ERROR: ";
short disposition;
unsigned char len;
#endif


fprintf( stderr, "ERROR: %s.\n", errorstring );
if( status_file ){
Expand All @@ -169,19 +150,6 @@ void error( errorstring )
}
if( output_file) fflush(output_file);

#ifdef USING_THE_MAC
bzero(composite_string,255*sizeof(char));
strcpy((char *)composite_string,initstring);
strcat((char *)composite_string,errorstring);

ParamText(CtoPstr(composite_string),NULL,NULL,NULL);
disposition = Alert(131, NULL);
switch(disposition){
case 2: fprintf(stderr,"Continuing\n");break;
case 1: fprintf(stderr,"Terminated Execution\n");exit(555);
}
#endif

return;
}

Expand Down
9 changes: 1 addition & 8 deletions tightbind/kpoints.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,8 @@ void loop_over_k_points(cell,details,overlapR,hamilR,overlapK,hamilK,
if(i==0){
sprintf(tempfilename,"%s.OV",details->filename);

#ifndef USING_THE_MAC
overlap_file = open(tempfilename,
O_RDWR|O_TRUNC|O_APPEND|O_CREAT,S_IRUSR|S_IWUSR);
#else
overlap_file = open(tempfilename,O_RDWR|O_TRUNC|O_APPEND|O_CREAT);
#endif

if( overlap_file == -1 ){
fatal("Can't open .OV file for binary I/O");
Expand Down Expand Up @@ -298,12 +294,9 @@ void loop_over_k_points(cell,details,overlapR,hamilR,overlapK,hamilK,
/* if this is the first call, the open the file */
if(i==0){
sprintf(tempfilename,"%s.HAM",details->filename);
#ifndef USING_THE_MAC
hamil_file = open(tempfilename,
O_RDWR|O_APPEND|O_CREAT,S_IRUSR|S_IWUSR);
#else
hamil_file = open(tempfilename,O_RDWR|O_APPEND|O_CREAT);
#endif

if( hamil_file == -1 ){
fatal("Can't open .HAM file for binary I/O");
}
Expand Down
30 changes: 0 additions & 30 deletions tightbind/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
FILE *COHP_file;
const char greetings[]="Welcome to the 10th Anniversary edition of YAeHMOP!\n";

#ifdef USING_THE_MAC
extern FILE *choose_mac_file(char *,char);
#include "Mac_Fopen.h"
#endif

#ifndef USING_THE_MAC
void main(argc, argv)
int argc;
char **argv;
#else
void main()
#endif
{
FILE *temp_file;
char file_name[80],err_string[240];
Expand All @@ -83,28 +74,7 @@ char test_string[80];
FILE *the_file=0;
int walsh_step;
bool use_stdin_stdout = false;
#ifdef USING_THE_MAC
int argc;
char argv[4][80];

/* set up some stuff for Sioux */
//SIOUXSettings.standalone = FALSE;
SIOUXSettings.asktosaveonclose = FALSE;
SIOUXSettings.autocloseonquit = FALSE;
printf("Starting bind.\n");

the_file = choose_mac_file(argv[1],MAC_FOPEN_OPEN_CD);
if( !the_file ) {
fatal("User cancelled intial file open");
} else{
argc = 2;
strcpy(file_name,argv[1]);
}

/* get the command line arguments */
// argc = ccommand(&argv);

#endif
if( argc == 2 && strcmp(argv[1], "-v") == 0){
fprintf(stdout, "version: %s\n", VERSION_STRING);
exit(0);
Expand Down
8 changes: 0 additions & 8 deletions tightbind/new3_fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,6 @@ void read_NEW3file(cell,details,infile,parm_file_name)
int temp;

p_DOS_type *p_DOS,*temp_p_dos;
#ifdef USING_THE_MAC
fprintf(stderr,"That doesn't look like a bind input file. This version\n \
of bind makes no attempt to read in new3 input files, so we're going to\n \
error out now and let you try another input file\n");
fatal("Bogus input file\n");

#else

/* if we made it this far, the title of the file has already been read in.... */

Expand Down Expand Up @@ -289,5 +282,4 @@ contributions.");
details->num_KPOINTS = 1;
details->K_POINTS = points;
}
#endif
}
4 changes: 0 additions & 4 deletions tightbind/postprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,7 @@ void postprocess_FCO(cell,details,overlapR,hamilR,overlapK,hamilK,
*******/
if(!FCO_file){
sprintf(FCO_filename,"%s.FCO",details->filename);
#ifndef USING_THE_MAC
FCO_file = open(FCO_filename,O_RDWR|O_TRUNC|O_CREAT,S_IRUSR|S_IWUSR);
#else
FCO_file = open(FCO_filename,O_RDWR|O_APPEND|O_CREAT);
#endif
if( FCO_file == -1 ){
fatal("Can't open .FCO file for binary I/O");
}
Expand Down
3 changes: 0 additions & 3 deletions tightbind/prototypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,3 @@ extern int zheev_ PROTO((char *jobz, char *uplo, integer *n, doublecomplex *a,
integer *lwork, doublereal *rwork, integer *info));
#endif

#ifdef USING_THE_MAC
extern FILE *choose_mac_file(char *file_name, char);
#endif
1 change: 0 additions & 1 deletion tightbind/utils/Mac_Fopen.c

This file was deleted.

1 change: 0 additions & 1 deletion tightbind/utils/Mac_Fopen.h

This file was deleted.

32 changes: 0 additions & 32 deletions tightbind/utils/add_dos.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
************************************************************************/
#include "fit_props.h"

#ifndef USING_THE_MAC
void main(argc, argv)
int argc;
char **argv;
#else
void main()
#endif
{
int i,j,k;
FILE *infile1,*infile2,*outfile, *the_file;
Expand All @@ -58,34 +54,6 @@ void main()
int curve1,curve2;
real val1, val2;
char window_by_hand;
#ifdef USING_THE_MAC
int argc;
char argv[4][80];

/* set up some stuff for Sioux */
//SIOUXSettings.standalone = FALSE;
SIOUXSettings.asktosaveonclose = FALSE;
SIOUXSettings.autocloseonquit = FALSE;
printf("Starting bind.\n");

the_file = choose_mac_file(argv[1],MAC_FOPEN_OPEN_CD);
if( !the_file ) {
fatal("User cancelled intial file open");
}
the_file = choose_mac_file(argv[2],MAC_FOPEN_OPEN_CD);
if( !the_file ) {
fatal("User cancelled second file open");
}

printf("Enter the name of the output file: ");
scanf("%s",argv[3]);

argc = 4;
/* get the command line arguments */
// argc = ccommand(&argv);

#endif


/* open the files */
if( argc < 4 ){
Expand Down
30 changes: 0 additions & 30 deletions tightbind/utils/cooperate.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,9 @@ int sort_distances_helper(dist1,dist2)
else return( 0 );
}

#ifndef USING_THE_MAC
void main(argc, argv)
int argc;
char **argv;
#else
void main()
#endif
{
FILE *the_file;
int infile;
Expand All @@ -58,28 +54,6 @@ void main()
int num_so_far;
int curr_type;
char *dummies;
#ifdef USING_THE_MAC
int argc;
char argv[4][80];

/* set up some stuff for Sioux */
//SIOUXSettings.standalone = FALSE;
SIOUXSettings.asktosaveonclose = FALSE;
SIOUXSettings.autocloseonquit = FALSE;
printf("Starting cooperate.\n");

the_file = choose_mac_file(argv[1],MAC_FOPEN_OPEN_CD);
if( !the_file ) {
fatal("User cancelled intial file open");
} else{
argc = 2;
}

/* get the command line arguments */
// argc = ccommand(&argv);

#endif


if(argc < 2){
fatal("Usage: cooperate infile [min_dist max_dist tolerance]");
Expand All @@ -101,11 +75,7 @@ void main()
}

/* open the file */
#ifndef USING_THE_MAC
infile = open(argv[1],O_RDONLY,"r");
#else
infile = open(argv[1],O_RDONLY);
#endif
if( infile == -1 ){
fatal("Can't open file for binary I/O.");
}
Expand Down
Loading

0 comments on commit a10a9bc

Please sign in to comment.