Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - PocketC Architect - Another bug?
Page 1 of 1

PostPosted: Fri Jan 27, 2006 10:13 pm
by mgreen
I have a program that I was able to compile and run on my Palm T5. I made some small changes (moved some global variables into a procedure "void calc()"). When I try to compile the changed program, the compiler says that it's compiling calc and then dies with a whitish screen with bit scribblings on it requiring a soft reset. Here's the changed source:

// PedsDose.ocp - Pediatric Dosing Calculator

@app PedsDose {
creator = "DrMz";
name = "Peds Dose";
dbname = "PedsDose";
version = "1.5";
}

const int maxDrugs = 16;

int drugMin, drugMax, drugHalf, drugPerD;
bool half;

int min(int x, int y) {
if (x < y) return(x);
return(y);
}

@form MainForm {
id = 3000
x = 0, y = 0, h = 160, w = 160
text = "PedsDose xx.xx";

label DoseLbl { id = 3001, x = 50, y = 100, text = "mg/kg/d" }
label WeightLbl { id = 3002, x = 50, y = 122, text = "lb Weight" }
label AmtLbl { id = 3003, x = 50, y = 145, text = "tsp|tab" }
label DaysLbl { id = 3004, x = 130, y = 145, text = "days" }
label WeightLt { id = 3005, x = 5, y = 134, text = " 2" }
label WeightRt { id = 3006, x = 95, y = 134, text = " 60" }
label DoseLt { id = 3007, x = 5, y = 112, text = " 20" }
label DoseRt { id = 3008, x = 95, y = 112, text = " 90" }
field MgKgPerD { id = 3009, x = 5, y = 100, w = 40, h = 13,
maxchars = 5, text = "30" }
field Pounds { id = 3010, x = 5, y = 122, w = 40, h = 13,
maxchars = 5, text = "30" }
field DoseTsps { id = 3011, x = 5, y = 145, w = 40, h = 13,
maxchars = 7, text = "" }
field DoseDays { id = 3012, x = 85, y = 145, w = 40, h = 13,
maxchars = 7, text = "" }
slider MKDSlider { id = 3013, x = 25, y = 115, w = 70, h = 5,
min = 20, max = 90, page = 5 }
slider WgtSlider { id = 3014, x = 25, y = 137, w = 70, h = 5,
min = 2, max = 60, page = 2 }
list DrugName { id = 3015, x = 2, y = 17, w = 156, h = 79 }
list NoPerDay { id = 3016, x = 110, y = 99, w = 48, h = 33 }
}

void calc() {
int drug, dosing, wtLb, days;
float dose;
drug = DrugName.selitem;
dosing = NoPerDay.selitem + 1;
wtLb = Pounds.text;
dose = MgKgPerD.text;
dose = dose * (wtLb / 2.2) / dosing / conc[drug];
days = bottle[drug] / dose;
DoseTsps.text = format(dose,1);
DoseDays.text = format(days,0);
}

handler MainForm.onopen() {
string drugs[maxDrugs] = {
"Amoxicillin 125mg/5ml susp 150ml",
"Amoxicillin 250mg/5ml susp 150ml",
"Amoxicillin 250mg chew tabs #30",
"Amoxicillin 400mg/5ml susp 100ml",
"Augmentin 200mg/5ml susp 100ml",
"Augmentin 400mg/5ml susp 100ml",
"AugmentinES 600mg/5ml susp 100ml",
"Cefzil 250mg/5ml susp 125ml"};
string doses[3] = {"Daily", "2x Per Day", "3x Per Day"};
DrugName.setitems(8, drugs); DrugName.selitem = 0;
NoPerDay.setitems(3, doses); NoPerDay.selitem = 0;
MKDSlider.value = 30; WgtSlider.value = 30;
MainForm.title = "PedsDose " + PedsDose.version;
MgKgPerD.text = "30"; Pounds.text = "30";
drugHalf = 0;
}

handler MKDSlider.ondone() {
float dose;
dose = MKDSlider.value;
if (drugHalf) dose = dose / 2;
MgKgPerD.text = format(dose,drugHalf);
calc();
}

handler WgtSlider.ondone() {
Pounds.text = WgtSlider.value;
calc();
}

handler MgKgPerD.onchange() {
float dose;
dose = MgKgPerD.text;
if (drugHalf) dose = dose * 2;
MKDSlider.value = dose;
calc();
}

handler Pounds.onchange() {
wtLb = Pounds.text;
WgtSlider.value = wtLb;
calc();
}

handler NoPerDay.onselect() {
calc();
}

handler DrugName.onselect() {
int drug, span;
int bottle[maxDrugs] = { 150, 150, 30, 100, 100, 100, 125, 100 };
int conc[maxDrugs] = { 125, 250, 250, 400, 200, 400, 600, 250 };
int doseMin[maxDrugs] = { 20, 20, 20, 20, 20, 20, 20, 15 };
int doseMax[maxDrugs] = { 90, 90, 90, 90, 90, 90, 90, 30 };
bool doseHalf[maxDrugs] = { 0, 0, 0, 0, 0, 0, 0, 1 };
int dosePerD[maxDrugs] = { 3, 3, 3, 3, 2, 2, 2, 1 };
drug = DrugName.selitem;
drugMin = doseMin[drug];
drugMax = doseMax[drug];
drugHalf = doseHalf[drug];
drugPerD = dosePerD[drug];
NoPerDay.selitem = drugPerD-1;
if (drugHalf) {
DoseLt.text = format(drugMin/2,1);
DoseRt.text = format(drugMax/2,1);
} else {
DoseLt.text = drugMin;
DoseRt.text = drugMax;
}
span = drugMax - drugMin;
MKDSlider.min = drugMin;
MKDSlider.max = drugMax;
MKDSlider.page = min(span/10,1);
calc();
}

handler PedsDose.onstart() {
MainForm.load();
}

PostPosted: Sat Jan 28, 2006 3:53 am
by mgreen
There's a bug in the code I posted: add ', drugConc' after 'drugPerD' in the first 'int' declaration and 'drugConc = conc[drug];' in the DrugName.onselect handler after the 'drugPerD = ' statement.
I tried compiling the corrected code on the desktop version and got a "This program performed an illegal operation" message. I haven't tried the corrected code on the Palm yet.

PostPosted: Tue Jan 31, 2006 5:07 am
by dewey
When the compiler hits an error, it does cause some double memory frees in rare circumstances. This causes serious problems on the Palm, where it sometimes goes unnoticed on the desktop. I have addresses all known instances of this for 4.0.1. Thanks for the bug report!