wmcalc: Remove C++ style comments.
This commit is contained in:
parent
c3bef2f247
commit
773c07acd7
|
@ -50,9 +50,9 @@
|
|||
#include "wmcalc_g.h"
|
||||
#include "wmcalc_f.h"
|
||||
|
||||
#include "backdrop.xpm" // background graphic
|
||||
#include "calcbuttons.xpm" // graphic of buttons
|
||||
#include "charmap.xpm" // pixmap of characters
|
||||
#include "backdrop.xpm" /* background graphic */
|
||||
#include "calcbuttons.xpm" /* graphic of buttons */
|
||||
#include "charmap.xpm" /* pixmap of characters */
|
||||
#include "mask.xbm"
|
||||
|
||||
/* Global Variables */
|
||||
|
@ -108,10 +108,10 @@ int main( int argc, char **argv ) {
|
|||
int bufsize = 20;
|
||||
|
||||
|
||||
strcpy(configfile, getenv("HOME")); // Added to wmbutton by Casey Harkin, 3/6/99
|
||||
strcat(configfile, CONFFILENAME); // Fixed Bug - didn't look in home directory
|
||||
// but startup directory
|
||||
strcat(tempfile, CONFTEMPFILE); // Setup name for temp file
|
||||
strcpy(configfile, getenv("HOME")); /* Added to wmbutton by Casey Harkin, 3/6/99 */
|
||||
strcat(configfile, CONFFILENAME); /* Fixed Bug - didn't look in home directory */
|
||||
/* but startup directory */
|
||||
strcat(tempfile, CONFTEMPFILE); /* Setup name for temp file */
|
||||
|
||||
/* Clear the Calculator Display */
|
||||
for(i=0; i<DISPSIZE; i++) DispString[i] = ' ';
|
||||
|
@ -121,28 +121,28 @@ int main( int argc, char **argv ) {
|
|||
for ( i=1; i < argc; i++ ) {
|
||||
if ( *argv[i] == '-' ) {
|
||||
switch ( *(argv[i]+1) ) {
|
||||
case 'v': // Turn on Verbose (debugging) Mode
|
||||
case 'v': /* Turn on Verbose (debugging) Mode */
|
||||
Verbose = 1;
|
||||
break;
|
||||
case 'g': // Set Geometry Options
|
||||
case 'g': /* Set Geometry Options */
|
||||
if ( ++i >= argc ) show_usage();
|
||||
sscanf(argv[i], "%s", Geometry_str);
|
||||
if ( Verbose ) printf("Geometry is: %s\n", Geometry_str);
|
||||
break;
|
||||
case 'd': // Set display
|
||||
case 'd': /* Set display */
|
||||
if ( ++i >= argc ) show_usage();
|
||||
sscanf(argv[i], "%s", Display_str);
|
||||
if ( Verbose ) printf("Display is: %s\n", Display_str);
|
||||
break;
|
||||
case 'h': // Show Help Message
|
||||
case 'h': /* Show Help Message */
|
||||
show_usage();
|
||||
break;
|
||||
case 'f': // use config file <filename>
|
||||
case 'f': /* use config file <filename> */
|
||||
if ( ++i >= argc ) show_usage();
|
||||
sscanf(argv[i], "%s", configfile);
|
||||
if ( Verbose ) printf("Using Config File: %s\n", configfile);
|
||||
break;
|
||||
default: // other, unknown, parameters
|
||||
default: /* other, unknown, parameters */
|
||||
show_usage();
|
||||
break;
|
||||
}
|
||||
|
@ -292,14 +292,14 @@ int main( int argc, char **argv ) {
|
|||
break;
|
||||
case ConfigureNotify:
|
||||
if ( Verbose ) printf("Event: ConfigureNotify\n");
|
||||
// redraw();
|
||||
/* redraw(); */
|
||||
break;
|
||||
|
||||
case KeyPress:
|
||||
if (Verbose) printf("Event: Key state: 0x%x Key: 0x%x\n",
|
||||
report.xkey.state, report.xkey.keycode);
|
||||
|
||||
// ksym = XLookupKeysym(&(report.xkey), report.xkey.state);
|
||||
/* ksym = XLookupKeysym(&(report.xkey), report.xkey.state); */
|
||||
/* KeywithMask - this allows Left, middle, and right button functions
|
||||
to be implemented via keyboard */
|
||||
XLookupString(&(report.xkey), buffer, bufsize, &ksym, &compose);
|
||||
|
@ -315,7 +315,7 @@ int main( int argc, char **argv ) {
|
|||
N = whichButton(report.xbutton.x, report.xbutton.y );
|
||||
if ( (N >= 0) && (N <= NUM_BUTTONS) ) {
|
||||
button_pressed = N + LMASK;
|
||||
// redraw();
|
||||
/* redraw(); */
|
||||
}
|
||||
if ( Verbose )
|
||||
printf("Button 1:x=%d y=%d N=%d\n",
|
||||
|
@ -326,7 +326,7 @@ int main( int argc, char **argv ) {
|
|||
N = whichButton(report.xbutton.x, report.xbutton.y );
|
||||
if ( (N >= 0) && (N <= NUM_BUTTONS) ) {
|
||||
button_pressed = N + MMASK;
|
||||
// redraw();
|
||||
/* redraw(); */
|
||||
}
|
||||
if ( Verbose )
|
||||
printf("Button 2:x=%d y=%d N=%d\n",
|
||||
|
@ -337,7 +337,7 @@ int main( int argc, char **argv ) {
|
|||
N = whichButton(report.xbutton.x, report.xbutton.y );
|
||||
if ( (N >= 0) && (N <= NUM_BUTTONS) ) {
|
||||
button_pressed = N + RMASK;
|
||||
// redraw();
|
||||
/* redraw(); */
|
||||
}
|
||||
if ( Verbose )
|
||||
printf("Button 3:x=%d y=%d N=%d\n",
|
||||
|
@ -429,7 +429,7 @@ void redraw() {
|
|||
flush_expose( iconwin );
|
||||
XCopyArea(display, visible.pixmap, iconwin, gc, 0, 0,
|
||||
visible.attributes.width, visible.attributes.height, 0, 0 );
|
||||
// if ( Verbose ) printf("In Redraw()\n");
|
||||
/* if ( Verbose ) printf("In Redraw()\n"); */
|
||||
displaystr();
|
||||
} /***** End of function redraw() ********************************/
|
||||
|
||||
|
@ -697,44 +697,44 @@ int flush_expose(Window w) {
|
|||
void defineButtonRegions(void) {
|
||||
int ndx = 0; /* button index */
|
||||
|
||||
button_region[0].x = 1; // Define display region button
|
||||
button_region[0].x = 1; /* Define display region button */
|
||||
button_region[0].i = 62;
|
||||
button_region[0].y = 6;
|
||||
button_region[0].j = 17;
|
||||
|
||||
for (ndx = 1; ndx <= 5; ndx++) { // Define y coord's for top row
|
||||
for (ndx = 1; ndx <= 5; ndx++) { /* Define y coord's for top row */
|
||||
button_region[ndx].y = 20;
|
||||
button_region[ndx].j = 29;
|
||||
}
|
||||
for (ndx = 6; ndx <= 10; ndx++) { // Define y coord's for 2nd row
|
||||
for (ndx = 6; ndx <= 10; ndx++) { /* Define y coord's for 2nd row */
|
||||
button_region[ndx].y = 30;
|
||||
button_region[ndx].j = 39;
|
||||
}
|
||||
for (ndx = 11; ndx <= 15; ndx++) { // Define y coord's for 3rd row
|
||||
for (ndx = 11; ndx <= 15; ndx++) { /* Define y coord's for 3rd row */
|
||||
button_region[ndx].y = 40;
|
||||
button_region[ndx].j = 49;
|
||||
}
|
||||
for (ndx = 16; ndx <= 20; ndx++) { // Define y coord's for bottom row
|
||||
for (ndx = 16; ndx <= 20; ndx++) { /* Define y coord's for bottom row */
|
||||
button_region[ndx].y = 50;
|
||||
button_region[ndx].j = 59;
|
||||
}
|
||||
for (ndx = 1; ndx <= 16; ndx+=5) { // Define x coord's for Left column
|
||||
for (ndx = 1; ndx <= 16; ndx+=5) { /* Define x coord's for Left column */
|
||||
button_region[ndx].x = 5;
|
||||
button_region[ndx].i = 16;
|
||||
}
|
||||
for (ndx = 2; ndx <= 17; ndx+=5) { // Define x coord's for 2nd Left column
|
||||
for (ndx = 2; ndx <= 17; ndx+=5) { /* Define x coord's for 2nd Left column */
|
||||
button_region[ndx].x = 17;
|
||||
button_region[ndx].i = 26;
|
||||
}
|
||||
for (ndx = 3; ndx <= 18; ndx+=5) { // Define x coord's for middle column
|
||||
for (ndx = 3; ndx <= 18; ndx+=5) { /* Define x coord's for middle column */
|
||||
button_region[ndx].x = 27;
|
||||
button_region[ndx].i = 36;
|
||||
}
|
||||
for (ndx = 4; ndx <= 19; ndx+=5) { // Define x coord's for 2nd right column
|
||||
for (ndx = 4; ndx <= 19; ndx+=5) { /* Define x coord's for 2nd right column */
|
||||
button_region[ndx].x = 37;
|
||||
button_region[ndx].i = 46;
|
||||
}
|
||||
for (ndx = 5; ndx <= 20; ndx+=5) { // Define x coord's for 2nd right column
|
||||
for (ndx = 5; ndx <= 20; ndx+=5) { /* Define x coord's for 2nd right column */
|
||||
button_region[ndx].x = 47;
|
||||
button_region[ndx].i = 57;
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#define MMASK 200
|
||||
#define RMASK 300
|
||||
|
||||
#define CALCDONE 20 // Anything >= 10 should work
|
||||
#define DISPSIZE 10 // Number of characters in display
|
||||
#define CALCDONE 20 /* Anything >= 10 should work */
|
||||
#define DISPSIZE 10 /* Number of characters in display */
|
||||
#define NUM_BUTTONS 21
|
||||
#define NUM_MEM_CELLS 10
|
||||
|
||||
|
|
|
@ -22,15 +22,15 @@
|
|||
#include "wmcalc_x.h"
|
||||
#include "wmcalc_t.h"
|
||||
|
||||
void ExecFunc(int val); // function to run app N as found in conf file
|
||||
void ExecFunc(int val); /* function to run app N as found in conf file */
|
||||
void redraw(void);
|
||||
void getPixmaps(void);
|
||||
int whichButton(int x, int y); // determine which button has been pressed
|
||||
int whichKey(KeySym keysym); // determine which key has been pressed
|
||||
int whichButton(int x, int y); /* determine which button has been pressed */
|
||||
int whichKey(KeySym keysym); /* determine which key has been pressed */
|
||||
int flush_expose(Window w);
|
||||
void show_usage(void); // show usage message to stderr
|
||||
char *readln(FILE *fp); // read line from file, return pointer to it
|
||||
void defineButtonRegions(void); // Define boundaries for each button
|
||||
void show_usage(void); /* show usage message to stderr */
|
||||
char *readln(FILE *fp); /* read line from file, return pointer to it */
|
||||
void defineButtonRegions(void); /* Define boundaries for each button */
|
||||
void displaystr(void);
|
||||
void displaychar(char ch, int location);
|
||||
ButtonArea getboundaries(char ch);
|
||||
|
@ -58,23 +58,23 @@ void recallmem(int mem_loc);
|
|||
|
||||
/* Future functions yet to be implemented */
|
||||
|
||||
//void scinotation(void);
|
||||
//void clearmem(void);
|
||||
//void userdef201(void);
|
||||
//void userdef205(void);
|
||||
//void userdef206(void);
|
||||
//void userdef210(void);
|
||||
//void userdef211(void);
|
||||
//void userdef215(void);
|
||||
//void userdef218(void);
|
||||
//void userdef220(void);
|
||||
//void userdef301(void);
|
||||
//void userdef305(void);
|
||||
//void userdef306(void);
|
||||
//void userdef310(void);
|
||||
//void userdef315(void);
|
||||
//void userdef318(void);
|
||||
//void userdef320(void);
|
||||
/*void scinotation(void); */
|
||||
/*void clearmem(void); */
|
||||
/*void userdef201(void); */
|
||||
/*void userdef205(void); */
|
||||
/*void userdef206(void); */
|
||||
/*void userdef210(void); */
|
||||
/*void userdef211(void); */
|
||||
/*void userdef215(void); */
|
||||
/*void userdef218(void); */
|
||||
/*void userdef220(void); */
|
||||
/*void userdef301(void); */
|
||||
/*void userdef305(void); */
|
||||
/*void userdef306(void); */
|
||||
/*void userdef310(void); */
|
||||
/*void userdef315(void); */
|
||||
/*void userdef318(void); */
|
||||
/*void userdef320(void); */
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -80,7 +80,7 @@ void ExecFunc( int val ) {
|
|||
multnums();
|
||||
break;
|
||||
case 111:
|
||||
// scinotation();
|
||||
/* scinotation(); */
|
||||
startcalc();
|
||||
break;
|
||||
case 112:
|
||||
|
@ -115,7 +115,7 @@ void ExecFunc( int val ) {
|
|||
break;
|
||||
case 201:
|
||||
sqrtnum();
|
||||
// userdef201();
|
||||
/* userdef201(); */
|
||||
break;
|
||||
case 202:
|
||||
recallmem(7);
|
||||
|
@ -128,11 +128,11 @@ void ExecFunc( int val ) {
|
|||
break;
|
||||
case 205:
|
||||
divnums();
|
||||
// userdef205();
|
||||
/* userdef205(); */
|
||||
break;
|
||||
case 206:
|
||||
sqrnum();
|
||||
// userdef206();
|
||||
/* userdef206(); */
|
||||
break;
|
||||
case 207:
|
||||
recallmem(4);
|
||||
|
@ -145,7 +145,7 @@ void ExecFunc( int val ) {
|
|||
break;
|
||||
case 210:
|
||||
multnums();
|
||||
// userdef210();
|
||||
/* userdef210(); */
|
||||
break;
|
||||
case 211:
|
||||
startcalc();
|
||||
|
@ -161,7 +161,7 @@ void ExecFunc( int val ) {
|
|||
break;
|
||||
case 215:
|
||||
subtnums();
|
||||
// userdef215();
|
||||
/* userdef215(); */
|
||||
break;
|
||||
case 216:
|
||||
chgsignnum();
|
||||
|
@ -170,21 +170,21 @@ void ExecFunc( int val ) {
|
|||
recallmem(0);
|
||||
break;
|
||||
case 218:
|
||||
// userdef218();
|
||||
/* userdef218(); */
|
||||
break;
|
||||
case 219:
|
||||
equalfunc();
|
||||
break;
|
||||
case 220:
|
||||
addnums();
|
||||
// userdef220();
|
||||
/* userdef220(); */
|
||||
break;
|
||||
case 300:
|
||||
clearnum();
|
||||
break;
|
||||
case 301:
|
||||
sqrtnum();
|
||||
// userdef301();
|
||||
/* userdef301(); */
|
||||
break;
|
||||
case 302:
|
||||
stormem(7);
|
||||
|
@ -197,11 +197,11 @@ void ExecFunc( int val ) {
|
|||
break;
|
||||
case 305:
|
||||
divnums();
|
||||
// userdef305();
|
||||
/* userdef305(); */
|
||||
break;
|
||||
case 306:
|
||||
sqrnum();
|
||||
// userdef306();
|
||||
/* userdef306(); */
|
||||
break;
|
||||
case 307:
|
||||
stormem(4);
|
||||
|
@ -214,7 +214,7 @@ void ExecFunc( int val ) {
|
|||
break;
|
||||
case 310:
|
||||
multnums();
|
||||
// userdef310();
|
||||
/* userdef310(); */
|
||||
break;
|
||||
case 311:
|
||||
startcalc();
|
||||
|
@ -230,7 +230,7 @@ void ExecFunc( int val ) {
|
|||
break;
|
||||
case 315:
|
||||
subtnums();
|
||||
// userdef315();
|
||||
/* userdef315(); */
|
||||
break;
|
||||
case 316:
|
||||
chgsignnum();
|
||||
|
@ -239,14 +239,14 @@ void ExecFunc( int val ) {
|
|||
stormem(0);
|
||||
break;
|
||||
case 318:
|
||||
// userdef318();
|
||||
/* userdef318(); */
|
||||
break;
|
||||
case 319:
|
||||
equalfunc();
|
||||
break;
|
||||
case 320:
|
||||
addnums();
|
||||
// userdef320();
|
||||
/* userdef320(); */
|
||||
break;
|
||||
} /* End of switch statement */
|
||||
|
||||
|
@ -398,35 +398,35 @@ int write_config(void) {
|
|||
char movefilecmd[2 * CONFIGFILEMAX + 10]; /* make sure enough room in string */
|
||||
|
||||
/* Open current Config file */
|
||||
if ((fp = fopen(configfile, "r")) == NULL) { // Can't find config file
|
||||
if ((fp = fopen(configfile, "r")) == NULL) { /* Can't find config file */
|
||||
printf("%s: Cannot create configuration file\n", configfile);
|
||||
return(ERR_FILE_NOT_FOUND);
|
||||
}
|
||||
|
||||
/* We cannot write to the global config-file... */
|
||||
if(!strcmp(configfile, CONFIGGLOBAL)) {
|
||||
strcpy(configfile, getenv("HOME")); // Added to wmbutton by Gordon Fraser, 9/21/01
|
||||
strcpy(configfile, getenv("HOME")); /* Added to wmbutton by Gordon Fraser, 9/21/01 */
|
||||
strcat(configfile, CONFFILENAME);
|
||||
}
|
||||
|
||||
/* Open Temporary File */
|
||||
if ((fptmp = fopen(tempfile, "w")) == NULL) { // Can't open file in /tmp
|
||||
if ((fptmp = fopen(tempfile, "w")) == NULL) { /* Can't open file in /tmp */
|
||||
fprintf(stderr, "%s: Temporary File Open Failed\n", tempfile);
|
||||
strcpy(tempfile, getenv("HOME"));
|
||||
strcat(tempfile, "wmcalc.tmp");
|
||||
if ((fptmp = fopen(tempfile, "w")) == NULL) { // Can't open file in HOME
|
||||
if ((fptmp = fopen(tempfile, "w")) == NULL) { /* Can't open file in HOME */
|
||||
fprintf(stderr, "%s: Temporary File Open Failed\n", tempfile);
|
||||
return(ERR_TMP_FILE_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
while ((line = readln(fp)) != NULL) { // Read Lines in config file
|
||||
while ((line = readln(fp)) != NULL) { /* Read Lines in config file */
|
||||
if (Verbose) printf("line:%s", line);
|
||||
|
||||
if ((strncmp(line, CfgVarList[MEM_LABEL_0],
|
||||
strlen(CfgVarList[MEM_LABEL_0]) - 1) == 0)) {
|
||||
// -1 to generalize to all Mem? strings
|
||||
// If we've found a memory entry
|
||||
/* -1 to generalize to all Mem? strings */
|
||||
/* If we've found a memory entry */
|
||||
mem_ndx = atoi(line+strlen(CfgVarList[MEM_LABEL_0])-1);
|
||||
if ((mem_ndx >= 0) && (mem_ndx <= (NUM_MEM_CELLS - 1))) {
|
||||
fprintf(fptmp, "%s\t%f\n", CfgVarList[mem_ndx],
|
||||
|
@ -483,23 +483,23 @@ int read_config(void) {
|
|||
char *cfg_var_ptr = NULL;
|
||||
|
||||
|
||||
if ((fp = fopen(configfile, "r")) == NULL) { // Can't find config file
|
||||
strcpy(configfile, CONFIGGLOBAL); // ...so try to open global config
|
||||
if ((fp = fopen(configfile, "r")) == NULL) { // Can't find global config file
|
||||
if ((fp = fopen(configfile, "r")) == NULL) { /* Can't find config file */
|
||||
strcpy(configfile, CONFIGGLOBAL); /* ...so try to open global config */
|
||||
if ((fp = fopen(configfile, "r")) == NULL) { /* Can't find global config file */
|
||||
fprintf(stderr, "%s: Configuration File not found\n", configfile);
|
||||
return(ERR_FILE_NOT_FOUND);
|
||||
} else {
|
||||
write_config(); // if global config opened, save in homedir
|
||||
write_config(); /* if global config opened, save in homedir */
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (Verbose) printf("%s: Found Configuration File\n", configfile);
|
||||
}
|
||||
|
||||
do { // Read Lines in config file
|
||||
do { /* Read Lines in config file */
|
||||
line = readln(fp);
|
||||
if (Verbose) printf("Line Read:%s\n", line);
|
||||
if (line == NULL) break; // if end of file, quit
|
||||
if (line == NULL) break; /* if end of file, quit */
|
||||
if ( (line[0] != '#') && (line[0] != '\n')) { /* Ignore comments and
|
||||
blanks */
|
||||
if (strchr(line, sep_ch) != NULL) { /* The line has a tab, so let's
|
||||
|
@ -517,7 +517,7 @@ int read_config(void) {
|
|||
|
||||
/* Point to the 'tab' character, to read the value */
|
||||
cfg_var_ptr = strchr(line, sep_ch);
|
||||
cfg_var_ptr++; // ++ to avoid tab character itself
|
||||
cfg_var_ptr++; /* ++ to avoid tab character itself */
|
||||
|
||||
/* Now set the appropriate variable */
|
||||
switch(i) {
|
||||
|
|
Loading…
Reference in a new issue