MCPcopy Create free account
hub / github.com/CalcProgrammer1/KeyboardVisualizer / parse_argument_string

Function parse_argument_string

KeyboardVisualizerQT/main.cpp:17–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15static boolean startminimized;
16
17void parse_argument_string(char * argument, char * value)
18{
19 //Strip off new line characters if present
20 argument = strtok(argument, "\r\n");
21 value = strtok(value, "\r\n");
22
23 if(argument)
24 {
25 if (strcmp(argument, "startminimized") == 0)
26 {
27 startminimized = true;
28 }
29 else if (strcmp(argument, "amplitude") == 0)
30 {
31 vis.amplitude = atoi(value);
32 }
33 else if (strcmp(argument, "bkgd_bright") == 0)
34 {
35 vis.bkgd_bright = atoi(value);
36 }
37 else if (strcmp(argument, "avg_size") == 0)
38 {
39 vis.avg_size = atoi(value);
40 if (vis.avg_size < 1)
41 {
42 vis.avg_size = 1;
43 }
44 else if (vis.avg_size > 128)
45 {
46 vis.avg_size = 128;
47 }
48 }
49 else if (strcmp(argument, "decay") == 0)
50 {
51 vis.decay = atoi(value);
52 }
53 else if (strcmp(argument, "delay") == 0)
54 {
55 vis.delay = atoi(value);
56 }
57 else if (strcmp(argument, "nrml_ofst") == 0)
58 {
59 vis.nrml_ofst = strtod(value, NULL);
60 }
61 else if (strcmp(argument, "nrml_scl") == 0)
62 {
63 vis.nrml_scl = strtod(value, NULL);
64 }
65 else if (strcmp(argument, "fltr_const") == 0)
66 {
67 vis.filter_constant = strtod(value, NULL);
68 if (vis.filter_constant > 1.0f)
69 {
70 vis.filter_constant = 1.0f;
71 }
72 else if (vis.filter_constant < 0.0f)
73 {
74 vis.filter_constant = 0.0f;

Callers 2

parse_command_lineFunction · 0.85
parse_settings_fileFunction · 0.85

Calls 3

InitServerMethod · 0.80
InitClientMethod · 0.80
ChangeAudioDeviceMethod · 0.80

Tested by

no test coverage detected