Need some newbie help please
- MrMagoo
- Member
-
- Posts: 44
- Joined: Tue Jul 02, 2013 11:57 am
- Location: London
- Calculators: Casio fx-7400G, Casio fx-7400G PLUS, Casio fx-7400GII, Casio fx-9750G, Casio fx-9750G PLUS, Casio fx-9860GII
Re: Need some newbie help please
Ok that got rid of those errors, but now I get this one
** L2310 (E) Undefined external symbol "_AddIn_main" referenced in "E:\Casio\OS\FX\lib\setup.obj"
** L2310 (E) Undefined external symbol "_AddIn_main" referenced in "E:\Casio\OS\FX\lib\setup.obj"
"The trouble with internet quotations, is that the majority are totally made up." - Abraham Lincoln 1863
- SimonLothar
- Senior Member
-
- Posts: 605
- Joined: Sat Sep 15, 2012 6:59 am
- Location: Krautland ****
- Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400
Re: Need some newbie help please
MrMagoo wrote:** L2310 (E) Undefined external symbol "_AddIn_main" referenced in "E:\Casio\OS\FX\lib\setup.obj"
This error occurs, when the source file, which contains AddIn_main is not included in the SDK's source file list.
I'll be back!
- MrMagoo
- Member
-
- Posts: 44
- Joined: Tue Jul 02, 2013 11:57 am
- Location: London
- Calculators: Casio fx-7400G, Casio fx-7400G PLUS, Casio fx-7400GII, Casio fx-9750G, Casio fx-9750G PLUS, Casio fx-9860GII
Re: Need some newbie help please
Got it!
All working as expected now.
When we initialise a double variable, can it be a blank value?
The prompts are printing the inital value, which shows up as 0.0000000 and we have to delete that string before we can input the new one.
All working as expected now.
When we initialise a double variable, can it be a blank value?
The prompts are printing the inital value, which shows up as 0.0000000 and we have to delete that string before we can input the new one.
"The trouble with internet quotations, is that the majority are totally made up." - Abraham Lincoln 1863
- SimonLothar
- Senior Member
-
- Posts: 605
- Joined: Sat Sep 15, 2012 6:59 am
- Location: Krautland ****
- Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400
Re: Need some newbie help please
That would be NaN (Not a Number). Alas, I could not find NaN within the CASIO SDK (f. i. in limits.h, where it should be).MrMagoo wrote:When we initialise a double variable, can it be a blank value?
Hence add...
- Code: Select all
// IEEE 754 double quiet NaN
static unsigned char cqNAN[ 8 ] = { 0x7F, 0xF8, 0, 0, 0, 0, 0, 0 }; // qNaN
//
double qNaN( void ){
return *(double*)cqNAN;
};
//
int is_qNaN( double d ){
return !memcmp( &d, cqNAN, sizeof( cqNAN ) );
}
In input.cpp change
- Code: Select all
memset( buffer, 0, sizeof( buffer ) );
sprintf( (char*)buffer, "%f", d );
- Code: Select all
memset( buffer, 0, sizeof( buffer ) );
if ( !is_qNaN( d ) ) sprintf( (char*)buffer, "%f", d );
Add this
- Code: Select all
double qNaN( void );
int is_qNaN( double d );
In Addin_main initialize d
- Code: Select all
d = qNaN();
BTW: of course you can isolate the NaN-thing in a separate source module.
I'll be back!
- MrMagoo
- Member
-
- Posts: 44
- Joined: Tue Jul 02, 2013 11:57 am
- Location: London
- Calculators: Casio fx-7400G, Casio fx-7400G PLUS, Casio fx-7400GII, Casio fx-9750G, Casio fx-9750G PLUS, Casio fx-9860GII
Re: Need some newbie help please
Done all that, got this error :-/
C5020 (E) Identifier "is_qNaN" is undefined
C5020 (E) Identifier "is_qNaN" is undefined
"The trouble with internet quotations, is that the majority are totally made up." - Abraham Lincoln 1863
- SimonLothar
- Senior Member
-
- Posts: 605
- Joined: Sat Sep 15, 2012 6:59 am
- Location: Krautland ****
- Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400
Re: Need some newbie help please
I think you added the definition of is_qNaN(...) at the end of input.cpp, after its first use.
The definition of is_qNaN(...) must either precede its first use inside of input.cpp or you'd have to declare the interface of is_qNaN(...) at the beginning of input.cpp.
The definition of is_qNaN(...) must either precede its first use inside of input.cpp or you'd have to declare the interface of is_qNaN(...) at the beginning of input.cpp.
- Code: Select all
// IEEE 754 double
static unsigned char cqNAN[ 8 ] = { 0x7F, 0xF8, 0, 0, 0, 0, 0, 0 }; // qNaN
//
double qNaN( void ){
return *(double*)cqNAN;
};
//
int is_qNaN( double d ){
return !memcmp( &d, cqNAN, sizeof( cqNAN ) );
}
//
int InputDouble( int x, int y, unsigned char*prompt, double&d ){
unsigned char buffer[20];
int editresult;
memset( buffer, 0, sizeof( buffer ) );
if ( !is_qNaN( d ) ) sprintf( (char*)buffer, "%f", d );
I'll be back!
- SimonLothar
- Senior Member
-
- Posts: 605
- Joined: Sat Sep 15, 2012 6:59 am
- Location: Krautland ****
- Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400
Re: Need some newbie help please
Now the graphical menu, you need:
Define the bitmaps:
The call:
The function itself (which I saved in gmenu.cpp):
And of course:
in gmenu.hpp
Define the bitmaps:
- Code: Select all
// 32x18 bitmaps
const unsigned char ICON1[]={
0xFF,0xFF,0xFF,0xFC,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0x01,0,0x04,
0x80,0x03,0,0x04,
0x80,0x05,0,0x04,
0x80,0x01,0,0x04,
0x80,0x01,0,0x04,
0x80,0x01,0,0x04,
0x80,0x01,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0xFF,0xFF,0xFF,0xFC};
const unsigned char ICON2[]={
0xFF,0xFF,0xFF,0xFC,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0x03,0,0x04,
0x80,0x04,0x80,0x04,
0x80,0,0x80,0x04,
0x80,0x01,0,0x04,
0x80,0x02,0,0x04,
0x80,0x04,0,0x04,
0x80,0x07,0x80,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0xFF,0xFF,0xFF,0xFC};
const unsigned char ICON3[]={
0xFF,0xFF,0xFF,0xFC,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0x03,0,0x04,
0x80,0x04,0x80,0x04,
0x80,0,0x80,0x04,
0x80,0x03,0,0x04,
0x80,0,0x80,0x04,
0x80,0x04,0x80,0x04,
0x80,0x03,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0xFF,0xFF,0xFF,0xFC};
const unsigned char ICON4[]={
0xFF,0xFF,0xFF,0xFC,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0x01,0,0x04,
0x80,0x03,0,0x04,
0x80,0x05,0,0x04,
0x80,0x05,0,0x04,
0x80,0x09,0,0x04,
0x80,0x0F,0x80,0x04,
0x80,0x01,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0xFF,0xFF,0xFF,0xFC};
const unsigned char ICON5[]={
0xFF,0xFF,0xFF,0xFC,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0x03,0x80,0x04,
0x80,0x02,0,0x04,
0x80,0x07,0,0x04,
0x80,0,0x80,0x04,
0x80,0,0x80,0x04,
0x80,0x04,0x80,0x04,
0x80,0x03,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0x80,0,0,0x04,
0xFF,0xFF,0xFF,0xFC};
// list of 32x18-bitmap pointers
const unsigned char* iconlist[] = { ICON1, ICON2, ICON3, ICON4,
ICON5, ICON1, ICON2, ICON3,
ICON4, ICON5, ICON1, ICON2,
ICON3, ICON4, ICON5, ICON1,
ICON5,
0 }; // do not forget the terminating zero!
The call:
- Code: Select all
#include "gmenu.hpp"
.
.
.
editresult = graphicMenu( iconlist );
The function itself (which I saved in gmenu.cpp):
- Code: Select all
#ifdef __cplusplus
extern "C" {
#endif
#include "fxlib.h"
// 30x18 ICONS
int graphicMenu( const unsigned char* iconlist[] ){
int i, j, pos=0, pos0=0;
unsigned int key;
DISPGRAPH dg;
DISPBOX db;
int lContinue = 1;
int count = 0;
int ix, iy;
int posx = 0, posy = 0;
int edit_result = -1;
while ( iconlist[ count ] ) count++;
while ( lContinue ){
Bdisp_AllClr_VRAM();
for ( iy = 0; iy < 3; iy++ ){
for ( ix = 0; ix < 4; ix++ ){
j = ix + iy*4;
i = pos0 + j;
if ( iconlist[i] == 0 ) break;
dg.x = ix * 32;
dg.y = iy * 18;
dg.GraphData.width = 32;
dg.GraphData.height = 18;
dg.GraphData.pBitmap = (unsigned char*)iconlist[i];
dg.WriteModify = IMB_WRITEMODIFY_NORMAL;
Bdisp_WriteGraph_VRAM( &dg );
};
};
pos = posx + posy*4 + pos0;
db.left = posx * 32;
db.top = posy * 18;
db.right = db.left + 30;
db.bottom = db.top + 18;
Bdisp_AreaClr_VRAM( &db );
dg.x = db.left;
dg.y = db.top;
dg.GraphData.width = 30;
dg.GraphData.height = 18;
dg.GraphData.pBitmap = (unsigned char*)iconlist[ pos ];
dg.WriteModify = IMB_WRITEMODIFY_REVERCE;
Bdisp_WriteGraph_VRAM( &dg );
GetKey( &key );
switch( key ){
case KEY_CTRL_UP :
if ( posy > 0 ) posy--;
else if ( pos0 > 0 ){
pos0 -= 4;
posy = 0;
}
break;
case KEY_CTRL_DOWN :
if ( pos0 + posx + (posy+1)*4 < count ){
posy++;
if ( posy > 2 ){
pos0 += 4;
posy = 2;
}
};
break;
case KEY_CTRL_RIGHT :
if ( posx < 3 ){
if ( pos0 + posx + 1 + posy*4 < count ){
posx++;
}
}
else {
if ( pos0 + (posy+1)*4 < count ){
posy++;
posx = 0;
if ( posy > 2 ){
pos0 += 4;
posy = 2;
}
};
}
break;
case KEY_CTRL_LEFT :
if ( posx > 0 ) posx--;
else {
if ( pos0 + posx + posy*4 > 0 ){
posx = 3;
if ( posy > 0 ) posy--;
else if ( pos0 > 0 ){
pos0 -= 4;
posy = 0;
}
}
}
break;
case KEY_CTRL_EXE :
lContinue = 0;
edit_result = pos0 + posx + posy*4;
break;
case KEY_CTRL_EXIT :
lContinue = 0;
break;
}
};
return edit_result;
}
#ifdef __cplusplus
}
#endif
And of course:
- Code: Select all
int graphicMenu( const unsigned char* iconlist[] );
in gmenu.hpp
I'll be back!
- MrMagoo
- Member
-
- Posts: 44
- Joined: Tue Jul 02, 2013 11:57 am
- Location: London
- Calculators: Casio fx-7400G, Casio fx-7400G PLUS, Casio fx-7400GII, Casio fx-9750G, Casio fx-9750G PLUS, Casio fx-9860GII
Re: Need some newbie help please
where do I define the bitmaps?
"The trouble with internet quotations, is that the majority are totally made up." - Abraham Lincoln 1863
- SimonLothar
- Senior Member
-
- Posts: 605
- Joined: Sat Sep 15, 2012 6:59 am
- Location: Krautland ****
- Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400
Re: Need some newbie help please
I use ms-paint to create the 32x18 b/w-bmp file (the width has to be a multiple of 8).MrMagoo wrote:where do I define the bitmaps?
Hint: the last two colums of the bitmap are ignored with this example, t. i. graphicMenu uses only a width of 30 pixels per icon.
Then I use my fileconverter to transfer the bmp-file to C-source.
EDIT: I misunderstood your question. I defined the bitmaps in the main-module (before iconlist is used). You could put the code in a separate file and include it.
I'll be back!
- MrMagoo
- Member
-
- Posts: 44
- Joined: Tue Jul 02, 2013 11:57 am
- Location: London
- Calculators: Casio fx-7400G, Casio fx-7400G PLUS, Casio fx-7400GII, Casio fx-9750G, Casio fx-9750G PLUS, Casio fx-9860GII
Re: Need some newbie help please
Hi Simon,
I got this error
L2300 (E) Duplicate symbol "_iconlist" in "E:\Casio\Projects\Inputs\Debug\Bitmaps.obj"
I have the bitmap defs in a cpp file, which is included. #include "bitmaps.cpp"
I got this error
L2300 (E) Duplicate symbol "_iconlist" in "E:\Casio\Projects\Inputs\Debug\Bitmaps.obj"
I have the bitmap defs in a cpp file, which is included. #include "bitmaps.cpp"
"The trouble with internet quotations, is that the majority are totally made up." - Abraham Lincoln 1863
Who is online
Users browsing this forum: No registered users and 18 guests