exposurses

Check-in [99eba10b76]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Try to standardise on a string length Since it doesn't matter if it's longer. And I'm only using short strings.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 99eba10b76336457898c4ee2c28ed254b7bf2718f97961616cf57f22ad398fe3
User & Date: base@atomicules.co.uk 2013-08-31 07:50:20
Context
2013-09-02
09:29
Actually make it work this time. See this commit: 8d3e66b5ecffa8bcf7691c3f0600840b934beb1a I'm such an idiot. - Remove `set_top_row` when setting the shutter menu to the correct value. Leaving this in fooled me into thinking I had things working because I just happened to test on the matching ISO/Aperture values. Plonker. And then it turns out, there was loads wrong. - Need to include stdlib.h for `strtod` function, otherwise it uses some kind of stub function (no complaints in compile or use, but it just doesn't work). - Wasn't passing right kind of values to `shutter` anyway! Need to convert these to numeric - Need to use `fabs` not `abs` for doubles. - In `nearest_match` wasn't using the correct arrays, had copied over `iso_array` and forgotten to change them - Use `strstr` instead `strchr` as couldn't get the former to work and was probably the wrong one to be using - Leave some commented out stuff at the bottom that I've been using for debugging - check-in: 68919dca22 user: base@atomicules.co.uk tags: origin/master, trunk
2013-08-31
07:50
Try to standardise on a string length Since it doesn't matter if it's longer. And I'm only using short strings. check-in: 99eba10b76 user: base@atomicules.co.uk tags: origin/master, trunk
07:47
Remove extraneous line that came from menu_scroll.c check-in: ed161d4179 user: base@atomicules.co.uk tags: origin/master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to exposurses.c.

58
59
60
61
62
63
64
65

66
67
68
69
70
71
72
73
74
75
...
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
...
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
int exposure(int iso);
int selection_counter;
double shutter(int exposure, double aperture);
double aperture(int exposure, int shutter);
int nearest_match(double x, int menu);
double fraction_to_double(char *fraction);


char iso_sel[5] = "";
char shutter_sel[7] = "";
char aperture_sel[6] = "";
int menu_counter = 1;

int main() {
	int c;
	MENU **menu;
	WINDOW **win;
	int n_iso, i;
................................................................................
	return sqrt(pow(2, exposure) * shutter);
}

int nearest_match (double x, int menu) {
	/* Need to search array for closest match */
	int n;
	int diff_idx = 0;
	char array_value_str[7];
	double array_value_db;
	double diff;

	/* Need a starting value for difference */
	switch(menu) {
		case 1:
			array_value_db = strtod(iso_array[0], NULL);
................................................................................
			break;
	}
	return diff_idx;
}

double fraction_to_double(char *fraction) {
	double fraction_as_db;
	char denominator[5];
	char *ptr = strchr(fraction, "/");

	if (ptr) {
		/*then split*/
		strncpy(denominator, fraction+2, 5);
		fraction_as_db = 1/strtod(denominator, NULL);
	}
	else {
		fraction_as_db = strtod(fraction, NULL);
	}
return fraction_as_db;
}







<
>
|
|
|







 







|







 







|












58
59
60
61
62
63
64

65
66
67
68
69
70
71
72
73
74
75
...
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
...
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
int exposure(int iso);
int selection_counter;
double shutter(int exposure, double aperture);
double aperture(int exposure, int shutter);
int nearest_match(double x, int menu);
double fraction_to_double(char *fraction);

/* No one will ever need more than 9 bytes! */
char iso_sel[9] = "";
char shutter_sel[9] = "";
char aperture_sel[9] = "";
int menu_counter = 1;

int main() {
	int c;
	MENU **menu;
	WINDOW **win;
	int n_iso, i;
................................................................................
	return sqrt(pow(2, exposure) * shutter);
}

int nearest_match (double x, int menu) {
	/* Need to search array for closest match */
	int n;
	int diff_idx = 0;
	char array_value_str[9];
	double array_value_db;
	double diff;

	/* Need a starting value for difference */
	switch(menu) {
		case 1:
			array_value_db = strtod(iso_array[0], NULL);
................................................................................
			break;
	}
	return diff_idx;
}

double fraction_to_double(char *fraction) {
	double fraction_as_db;
	char denominator[9];
	char *ptr = strchr(fraction, "/");

	if (ptr) {
		/*then split*/
		strncpy(denominator, fraction+2, 5);
		fraction_as_db = 1/strtod(denominator, NULL);
	}
	else {
		fraction_as_db = strtod(fraction, NULL);
	}
return fraction_as_db;
}