FX 02.45.1000

This commit is contained in:
CalcLoverHK 2024-01-25 03:04:44 +08:00
parent 377fe0d5f8
commit 2ca1bda1da
12 changed files with 471 additions and 106 deletions

View File

@ -5,7 +5,7 @@
[BINDATA] : "FXADDINror.bin"
[DISPNAME] : "CBASIC"
[APPNAME] : "@CBASIC"
[VERSION] : "02.45.0900"
[VERSION] : "02.45.1000"
[APL_ICON] : "MainIcon.bmp"
[MODULE_NUM] : 0
[MOD1_TITLE] : "CBASIC"

View File

@ -1,6 +1,6 @@
[DLSimProject]
Name=CBASIC
Version=02.45.0900
Version=02.45.1000
Model=:fx-9860G.dlm
SourcePath=.
MemoryPath=INIT
@ -52,3 +52,4 @@ SourceFile=:CBZ_bmp.c
SourceFile=:CBZ_serial.c
SourceFile=:CBZ_fileMCS.c
SourceFile=:CBZ_Help.c
SourceFile=:CB_StrExt.c

View File

@ -1009,6 +1009,8 @@ unsigned int EditRun(int run){ // run:1 exec run:2 edit
int help_code=0;
int indent;
int execptr;
int selectStr=0;
char *string;
cUndo Undo;
@ -1048,9 +1050,11 @@ unsigned int EditRun(int run){ // run:1 exec run:2 edit
PrevLinePhyN( ymax, SrcBase, &offset, &offset_y ); // csrY adjust
UpdateLineNum=1;
if ( run == 1 ) { key=KEY_CTRL_F6; } // direct run
if ( run == 1 ) { key=KEY_CTRL_F6; goto directrun; } // direct run
if ( DebugMode ) DebugMenuSw=1;
PutKey( KEY_CTRL_SHIFT, 1 ); GetKey(&key);
PutKey( KEY_CTRL_SHIFT, 1 ); GetKey(&key);
// Cursor_SetFlashMode(1); // cursor flashing on
if (Cursor_GetFlashStyle()<0x6) Cursor_SetFlashOn(0x0); // insert mode cursor
@ -1653,6 +1657,7 @@ unsigned int EditRun(int run){ // run:1 exec run:2 edit
csrPtr=OpcodeLinePtr( offset_y, SrcBase, offset);
if ( SrcBase[offset] == 0 ) PrevLinePhyN( ymax, SrcBase, &offset, &offset_y );
} else {
directrun:
if ( ( 1 <= DebugMode ) && ( DebugMode <=3 ) ) { // ====== Debug Mode ======
if ( DebugScreen == 1 ) { DebugMenuSw = 1; DebugScreen = 2; }
else
@ -2146,7 +2151,25 @@ unsigned int EditRun(int run){ // run:1 exec run:2 edit
default:
break;
}
if ( key == 0x1F91B ) {
CB_StoreString( 1, ClipBuffer );
key=0;
}
if ( key == 0x2F91B ) {
string = CB_RecallString( 1 );
goto pastestring;
}
if ( key == 0x4F91B ) {
string = CB_SeeString( 1, &selectStr, ClipBuffer );
pastestring:
if ( string != NULL ) {
EditPaste( filebase, string, &csrPtr, &Undo );
UpdateLineNum=1;
}
key=0;
}
if ( dumpflg==2 ) {
keyH=(key&0xFF00) >>8 ;
keyL=(key&0x00FF) ;

View File

@ -597,7 +597,11 @@ unsigned int Explorer( int size, char *folder )
char buffer3[32];
char fname[64];
char ext[5];
char search[9]="";
char search[10]="", *search2;
int ContinuousSelect=0;
int CursorStyle;
int alphalock ;
char alphalock_bk ;
long FirstCount; // pointer to repeat time of first repeat
long NextCount; // pointer to repeat time of second repeat
@ -636,6 +640,16 @@ unsigned int Explorer( int size, char *folder )
GetMediaFreeStr10(buffer2);
textmode = 0 ;
// lowercase = 0;
alpha_start:
CursorStyle=Cursor_GetFlashStyle();
if (CursorStyle<0x6) Cursor_SetFlashOn(0x0); // insert mode cursor
else Cursor_SetFlashOn(0x6); // overwrite mode cursor
PutKey( KEY_CTRL_SHIFT, 1 ); GetKey(&key);
PutKey( KEY_CTRL_ALPHA, 1 ); GetKey(&key);
alphalock = 1;
Cursor_SetFlashMode(0); // cursor flashing off
while( cont && (FileListUpdate==0) )
{
@ -651,6 +665,8 @@ unsigned int Explorer( int size, char *folder )
}
Bdisp_AllClr_VRAM();
if ( strlen(search) ) filemode=0;
switch ( filemode ) {
case 0:
Fkey_Icon( FKeyNo1, 388 ); // Fkey_dispN( FKeyNo1,"EXE ");
@ -687,19 +703,27 @@ unsigned int Explorer( int size, char *folder )
// locate(1, 1);Print((unsigned char*)"File List [ ]");
// locate(13,1);Print( strlen(folder) ? (unsigned char*)folder : (unsigned char*)"/"); // root
locate(1, 1);Print((unsigned char*)"[ ]");
if ( strlen(search) ) {
locate(2,1);Print( (unsigned char*)search ); // search string
if ( StorageMode & 2 ) {
locate(2,1);Print((unsigned char*)"Main Mem");
} else {
if ( StorageMode & 2 ) {
locate(2,1);Print((unsigned char*)"Main Mem");
} else {
if ( root2[0] ) PrintMini(13, 1, (unsigned char*)(root2+1), MINI_OVER);
sprintf( buffer, "%-8s", folder );
locate(2,1);Print( strlen(folder) ? (unsigned char*)buffer : (unsigned char*)"/"); // root
}
if ( root2[0] ) PrintMini(13, 1, (unsigned char*)(root2+1), MINI_OVER);
sprintf( buffer, "%-8s", folder );
locate(2,1);Print( strlen(folder) ? (unsigned char*)buffer : (unsigned char*)"/"); // root
}
if ( strlen(search) ) {
locate(12, 1);Print((unsigned char*)"[ ]");
locate(13,1);Print( (unsigned char*)search ); // search string
if ( lowercase ) Fkey_dispN_aA( FKeyNo4, "A<>a"); else Fkey_dispN_Aa( FKeyNo4, "A<>a");
Fkey_Icon( FKeyNo5, 673 ); // Fkey_dispR( FKeyNo5, "CHAR");
// Fkey_Icon( FKeyNo6, 402 ); // Fkey_DISPN( FKeyNo6, " / ");
if ( StorageMode < 2 ) {
if ( search[0]=='/' ) Fkey_dispN( FKeyNo6, "\xE6\x91\x46ile"); else Fkey_dispN( FKeyNo6, "\xE6\x91 /");
}
} else {
PrintMini(10*6+1, 1, (unsigned char*)buffer2, MINI_OVER); // free area
sprintf(buffer, "(%d)", size-FavoritesMAX-1);
PrintMini(18*6 , 1, (unsigned char*)buffer , MINI_OVER); // number of file
}
PrintMini(10*6+1, 1, (unsigned char*)buffer2, MINI_OVER); // free area
sprintf(buffer, "(%d)", size-FavoritesMAX-1); PrintMini(18*6 , 1, (unsigned char*)buffer , MINI_OVER); // number of file
if( size < 2+FavoritesMAX-FavCount ){
locate( 8, 4 );
Print( (unsigned char*)"No Data" );
@ -776,88 +800,39 @@ unsigned int Explorer( int size, char *folder )
i = strlen(search);
if ( i ) {
locate(2+i,1);
locate(13+i,1);
Cursor_SetFlashMode(1); // cursor flashing on
CursorStyle=Cursor_GetFlashStyle();
if ( ( CursorStyle==0x3 ) && lowercase != 0 ) Cursor_SetFlashOn(0x4); // lowercase cursor
if ( ( CursorStyle==0x4 ) && lowercase == 0 ) Cursor_SetFlashOn(0x3); // upperrcase cursor
if ( ( CursorStyle==0x9 ) && lowercase != 0 ) Cursor_SetFlashOn(0xA); // lowercase cursor
if ( ( CursorStyle==0xA ) && lowercase == 0 ) Cursor_SetFlashOn(0x9); // upperrcase cursor
}
GetKey(&key);
if ( ContinuousSelect ) ContinuousSelect=0; else GetKey(&key);
Cursor_SetFlashMode(0); // cursor flashing off
if ( KEY_CTRL_DEL == key ) {
i=strlen(search);
if ( i ) {
i--;
search[i--]='\0';
if ( i>=0 ) {
key=search[i];
search[i]='\0';
}
}
}
if ( ( 'a' <= key ) && ( key <= 'z' ) ) key -= 'a'-'A';
if ( KEY_CTRL_XTT == key ) key='A';
if ( KEY_CHAR_LOG == key ) key='B';
if ( KEY_CHAR_LN == key ) key='C';
if ( KEY_CHAR_SIN == key ) key='D';
if ( KEY_CHAR_COS == key ) key='E';
if ( KEY_CHAR_TAN == key ) key='F';
if ( KEY_CHAR_FRAC == key ) key='G';
if ( KEY_CTRL_FD == key ) key='H';
if ( KEY_CHAR_LPAR == key ) key='I';
if ( KEY_CHAR_RPAR == key ) key='J';
if ( KEY_CHAR_COMMA== key ) key='K';
if ( KEY_CHAR_STORE== key ) key='L';
if ( KEY_CHAR_7 == key ) key='M';
if ( KEY_CHAR_8 == key ) key='N';
if ( KEY_CHAR_9 == key ) key='O';
if ( KEY_CHAR_4 == key ) key='P';
if ( KEY_CHAR_5 == key ) key='Q';
if ( KEY_CHAR_6 == key ) key='R';
if ( KEY_CHAR_MULT == key ) key='S';
if ( KEY_CHAR_DIV == key ) key='T';
if ( KEY_CHAR_1 == key ) key='U';
if ( KEY_CHAR_2 == key ) key='V';
if ( KEY_CHAR_3 == key ) key='W';
if ( KEY_CHAR_PLUS == key ) key='X';
if ( KEY_CHAR_MINUS== key ) key='Y';
if ( KEY_CHAR_0 == key ) key='Z';
if ( KEY_CHAR_DP == key ) key='~';
if ( KEY_CHAR_EXP == key ) key='@';
if ( ( '@' == key ) ) {
i=FavoritesMAX;
while ( i<size ) {
if ( files[i].filesize == FOLDER_FLAG ) {
index = i;
top = index;
break;
}
i++;
}
} else
if ( ( ( 'A' <= key ) && ( key <= 'Z' ) ) || ( key == '~' ) ) {
j=strlen(search);
if ( j<8 ) {
search[j++]=key;
search[j]='\0';
}
i=FavoritesMAX;
while ( i<size ) {
if ( files[i].filesize == FOLDER_FLAG ) i++;
else {
k=0;
while ( k<=j ) {
if ( files[i].filename[k] != search[k] ) { k=(k>=j); break; }
k++;
}
if ( k>0 ) {
index = i;
top = index;
break;
} else i++; // folder skip
}
}
} else search[0]='\0';
if ( KeyCheckPMINUS() ) {
key = '@';
}
switch ( key ) {
case KEY_CTRL_ALPHA:
alphalock = 0 ;
key = 0;
break;
case KEY_CTRL_DEL:
i=strlen(search);
if ( i ) {
i--;
search[i--]='\0';
if ( i>=0 ) {
key=search[i];
search[i]='\0';
}
}
break;
case KEY_CTRL_UP:
if ( nofile ) break;
do {
@ -951,6 +926,12 @@ unsigned int Explorer( int size, char *folder )
}
break;
case KEY_CTRL_F4: // Copy file
if ( strlen(search) ) {
lowercase=1-lowercase;
if ( alphalock == 0 ) PutAlphamode1(CursorStyle);
key = 0;
break;
}
switch ( filemode ) {
case 0:
if ( Isfolder ) break;
@ -970,6 +951,11 @@ unsigned int Explorer( int size, char *folder )
}
break;
case KEY_CTRL_F5: // delete file
if ( strlen(search) ) {
key=SelectChar( &ContinuousSelect);
if ( alphalock == 0 ) PutAlphamode1(CursorStyle);
break;
}
switch ( filemode ) {
case 0:
if ( nofile ) break;
@ -993,18 +979,25 @@ unsigned int Explorer( int size, char *folder )
}
break;
case KEY_CTRL_F6: // ------- change function
if ( strlen(search) ) {
key='/';
break;
}
filemode ++;
if ( filemode >2 ) filemode=0;
break;
case KEY_CTRL_AC:
search[0]='\0';
break;
case KEY_CTRL_EXIT:
if ( ( nofile ) || ( index == StartLine ) ) key=KEY_CTRL_QUIT;
// index = size;
cont =0 ;
if ( ( nofile ) || ( index == StartLine ) ) {
key=KEY_CTRL_QUIT;
cont =0 ;
break;
}
index = 0;
case KEY_CTRL_AC:
search[0]='\0';
if ( alphalock ) goto alpha_start;
break;
case KEY_CTRL_OPTN: // ------- Favorites list
@ -1020,7 +1013,8 @@ unsigned int Explorer( int size, char *folder )
break;
// case KEY_CHAR_SQUARE:
case KEY_CHAR_VALR:
case KEY_CHAR_ROOT:
// case KEY_CHAR_VALR:
textmodejp:
strcpy(buffer,files[index].filename);
if ( buffer[0] == 0 ) break;
@ -1041,9 +1035,24 @@ unsigned int Explorer( int size, char *folder )
else Fkey_dispN( FKeyNo5,"\xE6\x91Main");
Fkey_dispN( FKeyNo6, "Debg");
GetMemFreeStr10(buffer3);
PrintMini(10*6+1, 1, (unsigned char*)buffer3, MINI_OVER); // free mem area
if ( strlen(search) == 0 ) PrintMini(10*6+1, 1, (unsigned char*)buffer3, MINI_OVER); // free mem area
alphalock_bk = alphalock;
alphalock = 0 ;
i = strlen(search);
if ( i ) {
locate(13+i,1);
Cursor_SetFlashMode(1); // cursor flashing on
}
GetKey(&key);
Cursor_SetFlashMode(0); // cursor flashing off
switch (key) {
case KEY_CTRL_SHIFT:
key = 0;
break;
case KEY_CTRL_ALPHA:
alphalock = 1 ;
key = 0;
break;
case KEY_CTRL_QUIT:
update:
FileListUpdate = 1 ; //
@ -1110,8 +1119,117 @@ unsigned int Explorer( int size, char *folder )
default:
break;
}
// if ( KEY_CTRL_XTT == key ) key='A';
// if ( KEY_CHAR_LOG == key ) key='B';
// if ( KEY_CHAR_LN == key ) key='C';
// if ( KEY_CHAR_SIN == key ) key='D';
// if ( KEY_CHAR_COS == key ) key='E';
// if ( KEY_CHAR_TAN == key ) key='F';
// if ( KEY_CHAR_FRAC == key ) key='G';
// if ( KEY_CTRL_FD == key ) key='H';
// if ( KEY_CHAR_LPAR == key ) key=0;
// if ( KEY_CHAR_RPAR == key ) key=0;
// if ( KEY_CHAR_COMMA== key ) key=0;
// if ( KEY_CHAR_STORE== key ) key='L';
// if ( KEY_CHAR_7 == key ) key='M';
// if ( KEY_CHAR_8 == key ) key='N';
// if ( KEY_CHAR_9 == key ) key='O';
// if ( KEY_CHAR_4 == key ) key='P';
// if ( KEY_CHAR_5 == key ) key='Q';
// if ( KEY_CHAR_6 == key ) key='R';
if ( KEY_CHAR_MULT == key ) key=0;
if ( KEY_CHAR_DIV == key ) key='/';
// if ( KEY_CHAR_1 == key ) key='U';
// if ( KEY_CHAR_2 == key ) key='V';
// if ( KEY_CHAR_3 == key ) key='W';
if ( KEY_CHAR_PLUS == key ) key='+';
if ( KEY_CHAR_MINUS== key ) key='-';
// if ( KEY_CHAR_0 == key ) key='Z';
if ( KEY_CHAR_DP == key ) key='.';
if ( KEY_CHAR_SQUARE == key ) key='~';
if ( KEY_CHAR_VALR == key ) key='~';
if ( KEY_CHAR_POW == key ) key='^';
if ( KEY_CHAR_THETA == key ) key=0x27;
if ( KEY_CHAR_EXP == key ) key=0x0C;
if ( KEY_CHAR_PMINUS == key ) key='@';
if ( lowercase && ( 'A' <= key ) && ( key <= 'Z' ) ) key+=('a'-'A');
if ( key == '/' ) {
key=0;
if (search[0]=='/') {
for (i=0; i<8; i++ ) search[i]=search[i+1];
goto fileSRC;
} else {
for (i=7; i>0; i-- ) search[i]=search[i-1];
search[8]='\0';
search[0]='/';
if ( search[1]==0 ) goto foldertop; else goto fileSRC;
}
}
if ( ( 0x0C == key ) ) {
foldertop:
i=FavoritesMAX;
while ( i<size ) {
if ( files[i].filesize == FOLDER_FLAG ) {
index = i;
top = index;
break;
}
i++;
}
} else
if ( ( 0x20 <= key ) && ( key <= 0x7E ) ) {
fileSRC:
j=strlen(search);
if ( j<8 ) {
if ( key != 0 ) {
search[j++]=key;
search[j]='\0';
}
}
if ( search[0]=='/' ) {; // folder search
j--; if ( j==0 ) goto foldertop;
}
i=FavoritesMAX;
while ( i<size ) {
if ( search[0]=='/' ) {
if ( files[i].filesize != FOLDER_FLAG ) i++;
else { // folder search
k=0;
search2=search+1;
while ( k<=j ) {
if ( files[i].filename[k] != search2[k] ) { k=(k>=j); break; }
k++;
}
if ( k>0 ) {
index = i;
top = index;
break;
} else i++; // FavoritesMAX skip
}
} else { // file search
if ( files[i].filesize == FOLDER_FLAG ) i++;
else {
k=0;
while ( k<=j ) {
if ( files[i].filename[k] != search[k] ) { k=(k>=j); break; }
k++;
}
if ( k>0 ) {
index = i;
top = index;
break;
} else i++; // FavoritesMAX skip
}
}
}
} else {
if ( key != 0 ) search[0]='\0';
}
}
if ( alphalock ) { PutKey( KEY_CTRL_ALPHA, 1 ); i=key; GetKey(&key); key=i; }
SaveFavorites();
Bkey_Set_RepeatTime(FirstCount,NextCount); // restore repeat time
@ -3772,6 +3890,7 @@ int fileObjectAlign4X( unsigned int n ){ return n; } // align +4byte
//int fileObjectAlign4BB( unsigned int n ){ return n; } // align +4byte
//int fileObjectAlign4CC( unsigned int n ){ return n; } // align +4byte
//int fileObjectAlign4DD( unsigned int n ){ return n; } // align +4byte
/*
void FavoritesDowndummy( int *index ) {
unsigned short tmp;
char tmpname[FILENAMEMAX];
@ -3852,7 +3971,6 @@ void FavoritesDowndummy5( int *index ) {
files[(*index)].filesize=tmp;
SaveFavorites();
}
/*
void FavoritesDowndummy6( int *index ) {
unsigned short tmp;
char tmpname[FILENAMEMAX];

View File

@ -2784,6 +2784,8 @@ int InputStrSubC(int x, int y, int width, int ptrX, char* buffer, int MaxStrlen,
if (CursorStyle<0x6) Cursor_SetFlashOn(0x0); // insert mode cursor
else Cursor_SetFlashOn(0x6); // overwrite mode cursor
PutKey( KEY_CTRL_SHIFT, 1 ); GetKey(&key);
PutKey( KEY_CTRL_SHIFT, 1 ); GetKey(&key);
if ( ( float_mode == 0 ) && ( exp_mode == 0 ) && ( alpha_mode ) ) {
PutKey( KEY_CTRL_SHIFT, 1 );
PutKey( KEY_CTRL_ALPHA, 1 );

View File

@ -544,10 +544,10 @@ void DispGenuineCmdMenu(){
case CMD_OPTN_FMEM:
switch ( CommandPage ) {
case 0:
FkeyClear( FKeyNo1 );
FkeyClear( FKeyNo2 );
Fkey_Icon( FKeyNo1, 69 ); // Fkey_dspRB( FKeyNo1, "STORE");
Fkey_Icon( FKeyNo2, 70 ); // Fkey_dspRB( FKeyNo2, "RECALL");
Fkey_Icon( FKeyNo3, 240 ); // Fkey_dspRB( FKeyNo3, " fn ");
FkeyClear( FKeyNo4 );
Fkey_Icon( FKeyNo4, 241 ); // Fkey_dispN( FKeyNo4, " SEE");
FkeyClear( FKeyNo5 );
FkeyClear( FKeyNo6 );
break;

View File

@ -127,6 +127,7 @@ void GetGenuineCmdF1( unsigned int *code ){
} break;
case CMD_OPTN_FMEM:
switch ( CommandPage ) {
case 0: (*code)=0x1F91B;return; // STORE
} break;
case CMD_OPTN_LOGIC:
switch ( CommandPage ) {

View File

@ -122,6 +122,10 @@ void GetGenuineCmdF2( unsigned int *code ){
case 0: (*code)=0x0004;return; // micro
case 1: (*code)=0x0007;return; // Mega
} break;
case CMD_OPTN_FMEM:
switch ( CommandPage ) {
case 0: (*code)=0x2F91B;return; // RECALL
} break;
case CMD_OPTN_PICT:
switch ( CommandPage ) {
case 0: (*code)=0xF794;return; // RclPict

View File

@ -111,6 +111,10 @@ void GetGenuineCmdF4( unsigned int *code ){
case 0: (*code)=0x0002;return; // pico
case 1: (*code)=0x0009;return; // Tera
} break;
case CMD_OPTN_FMEM:
switch ( CommandPage ) {
case 0: (*code)=0x4F91B;return; // SEE
} break;
case CMD_OPTN_LOGIC:
switch ( CommandPage ) {
case 0: (*code)=0x7FB4;return; // Xor

View File

@ -52,7 +52,7 @@ void VerDispSub( int flag ) {
locate( 3, 5 ); Print( (unsigned char*)" by sentaro21" );
locate( 3, 6 ); Print( (unsigned char*)" (c)2020" );
PrintMini(13*6+2, 2*8+1, (unsigned char*)" build 09", MINI_OVER );
PrintMini(13*6+2, 2*8+1, (unsigned char*)" build 10", MINI_OVER );
PrintMini( 2*6+2, 3*8+1, (unsigned char*)"(Casio Basic compatible+)", MINI_OVER );
// if ( ( UseHiddenRAM ) && ( IsHiddenRAM ) ) {

View File

@ -106,3 +106,7 @@ int CB_StrRepl( char *SRC ); // StrRepl( Str1,Str2,Str3,n )->str4
int CB_StrSplit( char *SRC ) ; // StrStip( "123,4567,89","[n,]) -> MatAns[["1232]["4567"]["89"]]
char* CB_RecallString(int type ); // ----------- Recall String type: 0:string 1:fn 2:GraphY
int CB_StoreString(int type, char *clipbuffer ); // ----------- Store String type: 0:string 1:fn 2:GraphY
char* CB_SeeString(int type, int *select, char *clipbuffer ); // ----------- See String type: 0:string 1:fn 2:GraphY

208
fx/CB_StrExt.c Normal file
View File

@ -0,0 +1,208 @@
#include "CB.h"
const char TypeTitle[][10]={"Strings ","Function ","Graphics "};
const char TypeStr[][2]={"S","f","Y"};
int SelectMemoryNum( int type, int max, int store, unsigned int *key ) { //
char buffer[32];
int n,n0=1;
PopUpWin(4);
FkeyClearAll();
locate( 3,2); if ( store ) Print((unsigned char *)"Store In"); else Print((unsigned char *)"Recall From");
locate( 3,3); Print((unsigned char *)TypeTitle[type]);
locate(14,3); Print((unsigned char *)"Memory");
locate( 3,5); sprintf(buffer,"%s[%d~%d]:",TypeStr[type],1,max); Print((unsigned char *)buffer);
buffer[0]='\0';
while (1) {
n=InputNumD(3+strlen(buffer), 5, log10(max)+1, n, " ", REV_OFF, FLOAT_OFF, EXP_OFF, &(*key)); // 0123456789
if ( n == n0 ) break;
if ( (1<=n)&&(n<=max) ) break;
n=n0;
}
return n ; // ok
}
void LoadStringType( int type, int *reg, int *opNum ){
switch ( type ) {
case 0: // string
*reg=defaultStrAry;
*opNum=defaultStrAryN;
break;
case 1: // fn
*reg=defaultFnAry;
*opNum=defaultFnAryN;
break;
case 2: // GraphY
*reg=defaultGraphAry;
*opNum=defaultGraphAryN;
break;
}
}
char* CB_RecallString(int type ){ // ----------- Recall String type: 0:string 1:fn 2:GraphY
unsigned int key;
int reg,dimA;
int opNum,n;
char *string;
LoadStringType( type, &reg, &opNum );
dimA = MatAry[reg].SizeA ;
if ( dimA == 0 ) {
string = NULL;
} else {
n = SelectMemoryNum( type, opNum, 1, &key );
if ( key == KEY_CTRL_EXIT ) return 0;
if ( dimA >= n ) {
string = MatrixPtr(reg, n, 1);
}
}
return string;
}
int CB_StoreString(int type, char *clipbuffer ){ // ----------- Store String type: 0:string 1:fn 2:GraphY
unsigned int key;
int reg,dimA,dimB;
int opNum,n;
char *str;
if ( clipbuffer == NULL ) return 0;
LoadStringType( type, &reg, &opNum );
n = SelectMemoryNum( type, opNum, 1, &key );
if ( key == KEY_CTRL_EXIT ) return 0;
ErrorNo=0;
switch ( type ) {
case 0: // string
str = GetStrYFnPtrSub( reg, n, defaultStrArySize );
break;
case 1: // fn
str = GetStrYFnPtrSub( reg, n, defaultFnArySize );
break;
case 2: // GraphY
str = GetStrYFnPtrSub( reg, n, defaultGraphArySize );
break;
}
if ( ErrorNo ) return -1; // error
OpcodeCopy( str, clipbuffer , MatAry[reg].SizeB-1 );
return 0;
}
char* CB_SeeString(int type, int *select, char *clipbuffer ){ // ----------- See String type: 0:string 1:fn 2:GraphY
char buffer[64];
unsigned int key;
int cont=1;
int seltop=(*select);
int i,j,k,x,y,len,oplen;
int opNum,opNumMax;
int reg,dimA,dimB,ElementSize;
int base;
char *string=0,*str=0;
Cursor_SetFlashMode(0); // cursor flashing off
if ( (*select)<1 ) (*select)=1;
LoadStringType( type, &reg, &opNum );
// opNum=MatAry[reg].SizeA;
while (cont) {
Bdisp_AllClr_VRAM();
locate( 1, 1); Print((unsigned char*)"== Function Memory ==");
locate( 4, 1); Print((unsigned char*)TypeTitle[type]);
if ( (*select)<seltop ) seltop = (*select);
if ( ((*select)-seltop) > 5 ) seltop = (*select)-5;
if ( seltop < 1 ) seltop = 1;
if ( (opNum -seltop) < 5 ) seltop = opNum -5;
for ( i=0; i<6; i++ ) {
k=seltop+i;
locate( 1, 2+i); Print((unsigned char*)TypeStr[type]);
sprintf( buffer,"%d:", k );
locate( 2, 2+i); Print((unsigned char*)buffer);
locate( 5, 2+i);
dimA = MatAry[reg].SizeA ;
if ( dimA == 0 ) {
// Print((unsigned char*)"");
} else {
if ( dimA >= k ) {
string = MatrixPtr(reg, k, 1);
OpcodeStringToAsciiString( buffer, string, 64-1 );
Print((unsigned char*)buffer);
}
}
}
y = ((*select)-seltop)+1 ;
Bdisp_AreaReverseVRAM(0, y*8, 127, y*8+7); // reverse (*select) line
Fkey_Icon( FKeyNo1, 69 ); // Fkey_dispR( FKeyNo1, "STORE");
Fkey_Icon( FKeyNo2, 70 ); // Fkey_dispR( FKeyNo2, "RECALL");
Fkey_Icon( FKeyNo3, 240 ); // Fkey_dispR( FKeyNo3, " fn ");
Fkey_Icon( FKeyNo4, 241 ); // Fkey_dispN( FKeyNo4, " SEE");
Bdisp_PutDisp_DD();
k=(*select);
ElementSize=MatAry[reg].ElementSize;
GetKey( &key );
if ( KEY_CTRL_XTT == key ) (*select)=23; // X
if ( KEY_CHAR_ANS == key ) (*select)=28; // Ans
if ( KEY_CHAR_THETA == key ) (*select)=27; // Theta
if ( KEY_CHAR_VALR == key ) (*select)=26; // <r>
if ( ( 'A' <= key ) && ( key <= 'z' ) ) {
(*select)=key-'A';
}
switch (key) {
case KEY_CTRL_EXIT:
cont=0;
break;
case KEY_CTRL_EXE:
break;
case KEY_CTRL_UP:
(*select) -= 1;
if ( (*select)<1 ) (*select)=opNum;
// if ( abs(i-(*select))>1 ) seltop=(*select);
break;
case KEY_CTRL_DOWN:
(*select) += 1;
if ( (*select)>opNum ) (*select)=1;
// if ( abs(i-(*select))>1 ) seltop=(*select);
break;
case KEY_CTRL_LEFT:
(*select) -= 6;
if ( (*select)<1 ) (*select)=opNum;
// if ( abs(i-(*select))>1 ) seltop=(*select);
break;
case KEY_CTRL_RIGHT:
(*select) -= 6;
if ( (*select)>opNum ) (*select)=1;
// if ( abs(i-(*select))>1 ) seltop=(*select);
break;
case KEY_CTRL_F1: // store
cont=0;
return NULL;
case KEY_CTRL_F2: // recall
str = MatrixPtr( reg, (*select), 1 ) ;
cont=0;
break;
case KEY_CTRL_F3: // fn
str='\0';
cont=0;
break;
// case KEY_CTRL_F4:
// break;
default:
break;
}
}
return str;
}