1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212 |
- #define BUILDING_OPENDOORS
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <string.h>
- #include <stdarg.h>
- #include "OpenDoor.h"
- #include "ODStr.h"
- #include "ODCore.h"
- #include "ODGen.h"
- #include "ODCom.h"
- #include "ODTypes.h"
- #include "ODScrn.h"
- #include "ODKrnl.h"
- #include "ODUtil.h"
- #define MODEM_SIMULATOR_TICK 54L
- #define LEVEL_NONE 0
- #define LEVEL_ASCII 1
- #define LEVEL_ANSI 2
- #define LEVEL_AVATAR 3
- #define LEVEL_RIP 4
- static void ODEmulateFromBuffer(char *pszBuffer, BOOL bRemoteEcho);
- static FILE *ODEmulateFindCompatFile(const char *pszBaseName, INT *pnLevel);
- static void ODEmulateFillArea(BYTE btLeft, BYTE btTop, BYTE btRight,
- BYTE btBottom, char chToFillWith);
- static BYTE btANSISeqLevel = 0;
- static INT anANSIParams[10];
- static char szCurrentParam[4] = "";
- static BYTE btCurrentParamLength;
- static BYTE btSavedColumn=1;
- static BYTE btSavedRow = 1;
- static char szToRepeat[129];
- static BYTE btRepeatCount;
- static BYTE btAvatarSeqLevel = 0;
- static char chPrevParam;
- static BYTE btNumParams;
- static BYTE btDefaultAttrib = 7;
- static BOOL bAvatarInsertMode = FALSE;
- static INT8 btScrollLines;
- static BYTE btScrollLeft, btScrollTop, btScrollRight, btScrollBottom;
- static char *pszCurrentHotkeys=NULL;
- static char chHotkeyPressed;
- static BYTE abtANSIToPCColorTable[8] = {0, 4, 2, 6, 1, 5, 3, 7};
- ODAPIDEF char ODCALL od_hotkey_menu(char *pszFileName, char *pszHotKeys,
- BOOL bWait)
- {
- char chPressed;
-
- TRACE(TRACE_API, "od_hotkey_menu()");
-
- if(!bODInitialized) od_init();
- OD_API_ENTRY();
- if(!pszHotKeys)
- {
- od_control.od_error = ERR_PARAMETER;
- OD_API_EXIT();
- return('\0');
- }
-
-
- pszCurrentHotkeys = (char *)pszHotKeys;
-
- chHotkeyPressed = '\0';
-
- if(!od_send_file(pszFileName))
- {
- OD_API_EXIT();
- return('\0');
- }
-
- pszCurrentHotkeys = NULL;
-
-
- if(chHotkeyPressed != '\0')
- {
- OD_API_EXIT();
- return(chHotkeyPressed);
- }
-
-
- if(bWait)
- {
-
- chPressed = od_get_answer(pszHotKeys);
-
- if(od_control.baud)
- {
-
- ODComClearOutbound(hSerialPort);
- }
-
- OD_API_EXIT();
- return(chPressed);
- }
-
-
-
-
- OD_API_EXIT();
- return(0);
- }
- ODAPIDEF BOOL ODCALL od_send_file(const char *pszFileName)
- {
- FILE *pfRemoteFile;
- FILE *pfLocalFile = NULL;
- BOOL bAnythingLocal = TRUE;
- void *pWindow;
- INT nFileLevel;
- BYTE btCount;
- BOOL bPausing;
- char chKey;
- char *pchParsing;
- char szMessage[74];
-
- TRACE(TRACE_API, "od_send_file()");
-
- if(!bODInitialized) od_init();
- OD_API_ENTRY();
- if(!pszFileName)
- {
- od_control.od_error = ERR_PARAMETER;
- OD_API_EXIT();
- return(FALSE);
- }
-
- btCount = 2;
-
- bPausing = od_control.od_page_pausing;
-
- if(strchr(pszFileName, '.') == NULL)
- {
-
- nFileLevel = LEVEL_RIP;
-
- if((pfRemoteFile = ODEmulateFindCompatFile(pszFileName, &nFileLevel))
- == NULL)
- {
-
- od_control.od_error = ERR_FILEOPEN;
- OD_API_EXIT();
- return(FALSE);
- }
-
- if(nFileLevel == LEVEL_RIP)
- {
-
- nFileLevel = LEVEL_AVATAR;
-
- bPausing = FALSE;
- if((pfLocalFile = ODEmulateFindCompatFile(pszFileName, &nFileLevel))
- == NULL)
- {
-
-
- bAnythingLocal = FALSE;
- }
- }
- else if(nFileLevel == LEVEL_NONE)
- {
- od_control.od_error = ERR_FILEOPEN;
- OD_API_EXIT();
- return(FALSE);
- }
-
- strcpy(szODWorkString, pszFileName);
- strcat(szODWorkString, ".rip");
- strupr(szODWorkString);
- }
- else
- {
-
- if((pfRemoteFile = fopen(pszFileName,"rb")) == NULL)
- {
-
- od_control.od_error = ERR_FILEOPEN;
- OD_API_EXIT();
- return(FALSE);
- }
- strcpy(szODWorkString, pszFileName);
- strupr(szODWorkString);
- if(strstr(szODWorkString, ".rip"))
- {
-
- bPausing = FALSE;
-
- bAnythingLocal = FALSE;
- }
- }
-
- btDefaultAttrib = 0x07;
-
- btAvatarSeqLevel = 0;
- btANSISeqLevel = 0;
-
- bAvatarInsertMode = FALSE;
-
- chLastControlKey = 0;
- if(!bAnythingLocal)
- {
- strcpy(szODWorkString, od_control.od_sending_rip);
- strcat(szODWorkString, pszFileName);
- ODStringCopy(szMessage, szODWorkString, sizeof(szMessage));
- pWindow = ODScrnShowMessage(szMessage, 0);
- }
-
- for(;;)
- {
-
- CALL_KERNEL_IF_NEEDED();
-
- if(pszCurrentHotkeys != NULL)
- {
-
- while((chKey = (char)tolower(od_get_key(FALSE))) != 0)
- {
-
- pchParsing = (char *)pszCurrentHotkeys;
- while(*pchParsing)
- {
-
- if(tolower(*pchParsing) == chKey)
- {
-
- chHotkeyPressed = *pchParsing;
- goto abort_send;
- }
- ++pchParsing;
- }
- }
- }
-
- if(chLastControlKey)
- {
- switch(chLastControlKey)
- {
-
- case 's':
- if(od_control.od_list_stop)
- {
-
- abort_send:
-
- if(od_control.baud)
- {
-
- ODComClearOutbound(hSerialPort);
- }
-
- goto end_transmission;
- }
- break;
-
- case 'p':
-
- if(od_control.od_list_pause)
- {
-
- od_clear_keybuffer();
-
- od_get_key(TRUE);
- }
- }
-
- chLastControlKey = 0;
- }
-
- if(fgets(szODWorkString, OD_GLOBAL_WORK_STRING_SIZE-1, pfRemoteFile) == NULL)
- {
-
- if(pfLocalFile)
- {
-
- while(fgets(szODWorkString, OD_GLOBAL_WORK_STRING_SIZE-1, pfLocalFile))
- {
-
- ODEmulateFromBuffer(szODWorkString, FALSE);
- }
- }
-
- goto end_transmission;
- }
-
- pchParsing = (char *)&szODWorkString;
- while(*++pchParsing) ;
- --pchParsing;
-
- if((*pchParsing == '\r' || *pchParsing == '\n') &&
- ++btCount >= od_control.user_screen_length && bPausing)
- {
-
- if(ODPagePrompt(&bPausing))
- {
-
- goto end_transmission;
- }
-
- btCount = 2;
- }
-
- if(bAnythingLocal)
- {
-
-
- if(pfLocalFile)
- {
- od_disp(szODWorkString, strlen(szODWorkString), FALSE);
- if(fgets(szODWorkString, OD_GLOBAL_WORK_STRING_SIZE-1, pfLocalFile) == NULL)
- {
- while(fgets(szODWorkString, OD_GLOBAL_WORK_STRING_SIZE-1, pfRemoteFile))
- {
- od_disp(szODWorkString, strlen(szODWorkString), FALSE);
- }
-
- goto end_transmission;
- }
- ODEmulateFromBuffer(szODWorkString, FALSE);
- }
- else
- {
-
-
- if(od_control.od_no_ra_codes)
- {
- ODEmulateFromBuffer(szODWorkString, FALSE);
- od_disp(szODWorkString, strlen(szODWorkString), FALSE);
- }
- else
- {
- ODEmulateFromBuffer(szODWorkString,TRUE);
- }
- }
- }
- else
- {
-
-
- od_disp(szODWorkString,strlen(szODWorkString),FALSE);
- }
- }
- end_transmission:
-
- fclose(pfRemoteFile);
-
- if(pfLocalFile)
- {
- fclose(pfLocalFile);
- }
-
- if(!bAnythingLocal)
- {
-
- if(od_control.baud != 0)
- {
- int nOutboundSize;
- do
- {
- CALL_KERNEL_IF_NEEDED();
- ODComOutbound(hSerialPort, &nOutboundSize);
- } while(nOutboundSize != 0);
- }
-
- ODScrnRemoveMessage(pWindow);
- }
- OD_API_EXIT();
- return(TRUE);
- }
- ODAPIDEF BOOL ODCALL od_send_file_section(char *pszFileName, char *pszSectionName)
- {
- FILE *pfRemoteFile;
- FILE *pfLocalFile = NULL;
- BOOL bAnythingLocal = TRUE;
- void *pWindow;
- INT nFileLevel;
- BYTE btCount;
- BOOL bPausing;
- char chKey;
- char *pchParsing;
- char szMessage[74];
- char szFullSectionName[256];
- BOOL bSectionFound = FALSE;
- UINT uSectionNameLength;
-
- TRACE(TRACE_API, "od_send_file_section()");
-
- if(!bODInitialized) od_init();
- OD_API_ENTRY();
- if(!pszFileName || !pszSectionName)
- {
- od_control.od_error = ERR_PARAMETER;
- OD_API_EXIT();
- return(FALSE);
- }
-
- btCount = 2;
-
- bPausing = od_control.od_page_pausing;
-
- if(strchr(pszFileName, '.') == NULL)
- {
-
- nFileLevel = LEVEL_RIP;
-
- if((pfRemoteFile = ODEmulateFindCompatFile(pszFileName, &nFileLevel))
- == NULL)
- {
-
- od_control.od_error = ERR_FILEOPEN;
- OD_API_EXIT();
- return(FALSE);
- }
-
- if(nFileLevel == LEVEL_RIP)
- {
-
- nFileLevel = LEVEL_AVATAR;
-
- bPausing = FALSE;
- if((pfLocalFile = ODEmulateFindCompatFile(pszFileName, &nFileLevel))
- == NULL)
- {
-
-
- bAnythingLocal = FALSE;
- }
- }
- else if(nFileLevel == LEVEL_NONE)
- {
- od_control.od_error = ERR_FILEOPEN;
- OD_API_EXIT();
- return(FALSE);
- }
-
- strcpy(szODWorkString, pszFileName);
- strcat(szODWorkString, ".rip");
- strupr(szODWorkString);
- }
- else
- {
-
- if((pfRemoteFile = fopen(pszFileName,"rb")) == NULL)
- {
-
- od_control.od_error = ERR_FILEOPEN;
- OD_API_EXIT();
- return(FALSE);
- }
- strcpy(szODWorkString, pszFileName);
- strupr(szODWorkString);
- if(strstr(szODWorkString, ".rip"))
- {
-
- bPausing = FALSE;
-
- bAnythingLocal = FALSE;
- }
- }
-
- btDefaultAttrib = 0x07;
-
- btAvatarSeqLevel = 0;
- btANSISeqLevel = 0;
-
- bAvatarInsertMode = FALSE;
-
- chLastControlKey = 0;
- if(!bAnythingLocal)
- {
- strcpy(szODWorkString, od_control.od_sending_rip);
- strcat(szODWorkString, pszFileName);
- ODStringCopy(szMessage, szODWorkString, sizeof(szMessage));
- pWindow = ODScrnShowMessage(szMessage, 0);
- }
-
- strcpy(szFullSectionName, "@#");
- strncat(szFullSectionName, pszSectionName, 254);
-
- uSectionNameLength = strlen(szFullSectionName);
-
- for(;;)
- {
-
- CALL_KERNEL_IF_NEEDED();
-
- if(pszCurrentHotkeys != NULL)
- {
-
- while((chKey = (char)tolower(od_get_key(FALSE))) != 0)
- {
-
- pchParsing = (char *)pszCurrentHotkeys;
- while(*pchParsing)
- {
-
- if(tolower(*pchParsing) == chKey)
- {
-
- chHotkeyPressed = *pchParsing;
- goto abort_send;
- }
- ++pchParsing;
- }
- }
- }
-
- if(chLastControlKey)
- {
- switch(chLastControlKey)
- {
-
- case 's':
- if(od_control.od_list_stop)
- {
-
- abort_send:
-
- if(od_control.baud)
- {
-
- ODComClearOutbound(hSerialPort);
- }
-
- goto end_transmission;
- }
- break;
-
- case 'p':
-
- if(od_control.od_list_pause)
- {
-
- od_clear_keybuffer();
-
- od_get_key(TRUE);
- }
- }
-
- chLastControlKey = 0;
- }
-
- if(fgets(szODWorkString, OD_GLOBAL_WORK_STRING_SIZE-1, pfRemoteFile) == NULL)
- {
-
- if(pfLocalFile)
- {
-
- while(fgets(szODWorkString, OD_GLOBAL_WORK_STRING_SIZE-1, pfLocalFile))
- {
- if (!bSectionFound && strncmp(szFullSectionName, szODWorkString, uSectionNameLength) == 0)
- {
-
- bSectionFound = TRUE;
-
- continue;
- }
- else if (!bSectionFound)
- {
-
- continue;
- }
- else if (bSectionFound && strncmp(szODWorkString, "@#", 2) == 0)
- {
-
- goto end_transmission;
- }
-
- ODEmulateFromBuffer(szODWorkString, FALSE);
- }
- }
-
- goto end_transmission;
- }
-
- if (!bSectionFound && strncmp(szFullSectionName, szODWorkString, uSectionNameLength) == 0)
- {
-
- bSectionFound = TRUE;
-
- continue;
- }
- else if (!bSectionFound)
- {
-
- continue;
- }
- else if (bSectionFound && strncmp(szODWorkString, "@#", 2) == 0)
- {
-
- goto end_transmission;
- }
-
- pchParsing = (char *)&szODWorkString;
- while(*++pchParsing) ;
- --pchParsing;
-
- if((*pchParsing == '\r' || *pchParsing == '\n') &&
- ++btCount >= od_control.user_screen_length && bPausing)
- {
-
- if(ODPagePrompt(&bPausing))
- {
-
- goto end_transmission;
- }
-
- btCount = 2;
- }
-
- if(bAnythingLocal)
- {
-
-
- if(pfLocalFile)
- {
- od_disp(szODWorkString, strlen(szODWorkString), FALSE);
- if(fgets(szODWorkString, OD_GLOBAL_WORK_STRING_SIZE-1, pfLocalFile) == NULL)
- {
- while(fgets(szODWorkString, OD_GLOBAL_WORK_STRING_SIZE-1, pfRemoteFile))
- {
- od_disp(szODWorkString, strlen(szODWorkString), FALSE);
- }
-
- goto end_transmission;
- }
- ODEmulateFromBuffer(szODWorkString, FALSE);
- }
- else
- {
-
-
- if(od_control.od_no_ra_codes)
- {
- ODEmulateFromBuffer(szODWorkString, FALSE);
- od_disp(szODWorkString, strlen(szODWorkString), FALSE);
- }
- else
- {
- ODEmulateFromBuffer(szODWorkString,TRUE);
- }
- }
- }
- else
- {
-
-
- od_disp(szODWorkString,strlen(szODWorkString),FALSE);
- }
- }
- end_transmission:
-
- fclose(pfRemoteFile);
-
- if(pfLocalFile)
- {
- fclose(pfLocalFile);
- }
-
- if(!bAnythingLocal)
- {
-
- if(od_control.baud != 0)
- {
- int nOutboundSize;
- do
- {
- CALL_KERNEL_IF_NEEDED();
- ODComOutbound(hSerialPort, &nOutboundSize);
- } while(nOutboundSize != 0);
- }
-
- ODScrnRemoveMessage(pWindow);
- }
-
-
- if (!bSectionFound)
- {
- OD_API_EXIT();
- return (FALSE);
- }
- OD_API_EXIT();
- return(TRUE);
- }
- static FILE *ODEmulateFindCompatFile(const char *pszBaseName, INT *pnLevel)
- {
- FILE *pfCompatibleFile;
- ASSERT(pszBaseName != NULL);
- ASSERT(pnLevel != NULL);
- ASSERT(*pnLevel >= 0 && *pnLevel <= 4);
-
- for(;*pnLevel > LEVEL_NONE; --*pnLevel)
- {
-
- strcpy(szODWorkString, pszBaseName);
-
- switch(*pnLevel)
- {
- case LEVEL_RIP:
- if(!od_control.user_rip) continue;
- strcat(szODWorkString, ".rip");
- break;
- case LEVEL_AVATAR:
- if(!od_control.user_avatar) continue;
- strcat(szODWorkString, ".avt");
- break;
- case LEVEL_ANSI:
- if(!od_control.user_ansi) continue;
- strcat(szODWorkString, ".ans");
- break;
- case LEVEL_ASCII:
- strcat(szODWorkString, ".asc");
- break;
- }
-
-
- if((pfCompatibleFile = fopen(szODWorkString,"rb")) != NULL)
- return(pfCompatibleFile);
- }
-
- return(NULL);
- }
- ODAPIDEF void ODCALL od_disp_emu(const char *pszToDisplay, BOOL bRemoteEcho)
- {
- BOOL bTranslateRemote;
-
- TRACE(TRACE_API, "od_disp_emu()");
-
- if(!bODInitialized) od_init();
- OD_API_ENTRY();
-
- if(bRemoteEcho)
- {
- if(od_control.od_no_ra_codes)
- {
- od_disp(pszToDisplay, strlen(pszToDisplay), FALSE);
- bTranslateRemote = FALSE;
- }
- else
- {
- bTranslateRemote = TRUE;
- }
- }
- else
- {
- bTranslateRemote = FALSE;
- }
-
- ODEmulateFromBuffer(pszToDisplay, bTranslateRemote);
- OD_API_EXIT();
- }
- ODAPIDEF void ODCALL od_emulate(char chToEmulate)
- {
- static char szBuffer[2];
- *szBuffer = chToEmulate;
-
- TRACE(TRACE_API, "od_emulate()");
-
- if(!bODInitialized) od_init();
- OD_API_ENTRY();
-
- ODEmulateFromBuffer(szBuffer, TRUE);
- OD_API_EXIT();
- }
- static void ODEmulateFromBuffer(char *pszBuffer, BOOL bRemoteEcho)
- {
- char chCurrent;
- static tODScrnTextInfo TextInfo;
- INT nTemp;
- BOOL bEchoThisChar;
- INT nCharsPerTick;
- INT nCharsThisTick;
- tODTimer ModemSimTimer;
- ASSERT(pszBuffer != NULL);
-
- if(od_control.od_emu_simulate_modem)
- {
- DWORD lCharsPerSecond;
-
- if(od_control.baud == 0)
- {
- lCharsPerSecond = 960L;
- }
- else
- {
- ODDWordDivide(&lCharsPerSecond, (DWORD *)NULL,
- od_control.od_connect_speed, 10L);
- }
-
- lCharsPerSecond = ODDWordMultiply(lCharsPerSecond, MODEM_SIMULATOR_TICK);
- ODDWordDivide(&lCharsPerSecond, (DWORD *)NULL, lCharsPerSecond, 1000L);
- nCharsPerTick = (INT)lCharsPerSecond;
-
- ODTimerStart(&ModemSimTimer, MODEM_SIMULATOR_TICK);
-
- nCharsThisTick = 0;
- }
- while(*pszBuffer)
- {
-
-
- chCurrent = *pszBuffer;
-
- if(od_control.od_emu_simulate_modem)
- {
-
-
- if(nCharsThisTick++ >= nCharsPerTick)
- {
-
- ODTimerWaitForElapse(&ModemSimTimer);
-
- ODTimerStart(&ModemSimTimer, MODEM_SIMULATOR_TICK);
-
- nCharsThisTick = 0;
- }
- }
- bEchoThisChar = bRemoteEcho;
-
- switch(btANSISeqLevel)
- {
-
- case 0:
-
- switch(chCurrent)
- {
-
- case 27:
-
- if(btAvatarSeqLevel == 0)
- {
-
- btANSISeqLevel = 1;
- break;
- }
-
-
- default:
-
- switch(btAvatarSeqLevel)
- {
-
- case 0:
-
- switch(chCurrent)
- {
-
- case 0x01:
- if(od_control.od_no_ra_codes)
- {
- goto output_next_char;
- }
-
- od_get_answer("\n\r");
- bEchoThisChar = FALSE;
- break;
-
- case 0x06:
- if(od_control.od_no_ra_codes)
- {
- goto output_next_char;
- }
- btAvatarSeqLevel = 21;
- bEchoThisChar = FALSE;
- break;
-
- case 0x0b:
- if(od_control.od_no_ra_codes)
- {
- goto output_next_char;
- }
- btAvatarSeqLevel = 22;
- bEchoThisChar = FALSE;
- break;
- case 0x0c:
- bAvatarInsertMode = FALSE;
- ODScrnSetAttribute((BYTE)(
- od_control.od_cur_attrib = btDefaultAttrib));
- ODScrnClear();
- break;
- case 0x19:
- bAvatarInsertMode = FALSE;
- btAvatarSeqLevel = 1;
- break;
- case 0x16:
- btAvatarSeqLevel = 3;
- break;
- default:
- output_next_char:
-
- if(bAvatarInsertMode)
- {
- ODScrnGetTextInfo(&TextInfo);
- if(TextInfo.curx < 80)
- {
- ODScrnCopyText(TextInfo.curx,
- TextInfo.cury, 79, TextInfo.cury,
- (BYTE)(TextInfo.curx + 1),
- TextInfo.cury);
- }
- ODScrnDisplayChar(chCurrent);
- }
- else
- {
- ODScrnDisplayChar(chCurrent);
- }
- }
- break;
- case 1:
- bAvatarInsertMode = FALSE;
- chPrevParam = chCurrent;
- btAvatarSeqLevel = 2;
- break;
- case 2:
- for(nTemp = 0; nTemp < (INT)chCurrent;
- ++nTemp)
- {
- ODScrnDisplayChar(chPrevParam);
- }
- btAvatarSeqLevel = 0;
- break;
- case 3:
- switch(chCurrent)
- {
- case 0x01:
- bAvatarInsertMode = FALSE;
- btAvatarSeqLevel = 4;
- break;
- case 0x02:
- bAvatarInsertMode = FALSE;
- ODScrnGetTextInfo(&TextInfo);
- ODScrnSetAttribute((BYTE)
- (od_control.od_cur_attrib =
- TextInfo.attribute | 0x80));
- btAvatarSeqLevel = 0;
- break;
- case 0x03:
- bAvatarInsertMode = FALSE;
- ODScrnGetTextInfo(&TextInfo);
- if(TextInfo.cury > 1)
- {
- ODScrnSetCursorPos(TextInfo.curx,
- (BYTE)(TextInfo.cury - 1));
- }
- btAvatarSeqLevel = 0;
- break;
- case 0x04:
- bAvatarInsertMode = FALSE;
- ODScrnGetTextInfo(&TextInfo);
- if(TextInfo.cury < 25)
- {
- ODScrnSetCursorPos(TextInfo.curx,
- (BYTE)(TextInfo.cury + 1));
- }
- btAvatarSeqLevel = 0;
- break;
- case 0x05:
- bAvatarInsertMode = FALSE;
- ODScrnGetTextInfo(&TextInfo);
- if(TextInfo.curx > 1)
- {
- ODScrnSetCursorPos((BYTE)(TextInfo.curx - 1),
- TextInfo.cury);
- }
- btAvatarSeqLevel = 0;
- break;
- case 0x06:
- bAvatarInsertMode = FALSE;
- ODScrnGetTextInfo(&TextInfo);
- if(TextInfo.curx < 80)
- {
- ODScrnSetCursorPos((BYTE)(TextInfo.curx + 1),
- TextInfo.cury);
- }
- btAvatarSeqLevel = 0;
- break;
- case 0x07:
- bAvatarInsertMode = FALSE;
- ODScrnClearToEndOfLine();
- btAvatarSeqLevel = 0;
- break;
- case 0x08:
- bAvatarInsertMode = FALSE;
- btAvatarSeqLevel = 5;
- break;
- case 0x09:
- bAvatarInsertMode = TRUE;
- btAvatarSeqLevel = 0;
- break;
- case 0x0a:
- btScrollLines = -1;
- btAvatarSeqLevel = 7;
- break;
- case 0x0b:
- btScrollLines = 1;
- btAvatarSeqLevel = 7;
- break;
- case 0x0c:
- btAvatarSeqLevel = 14;
- break;
- case 0x0d:
- btAvatarSeqLevel = 15;
- break;
- case 0x0e:
- ODScrnGetTextInfo(&TextInfo);
- if(TextInfo.curx < 80)
- {
- ODScrnCopyText((BYTE)(TextInfo.curx + 1),
- TextInfo.cury, 80, TextInfo.cury,
- TextInfo.curx, TextInfo.cury);
- }
- ODScrnEnableScrolling(FALSE);
- ODScrnSetCursorPos(80, TextInfo.cury);
- ODScrnDisplayChar(' ');
- ODScrnEnableScrolling(TRUE);
- ODScrnSetCursorPos(TextInfo.curx, TextInfo.cury);
- btAvatarSeqLevel = 0;
- break;
- case 0x19:
- btAvatarSeqLevel = 19;
- break;
- default:
- btAvatarSeqLevel = 0;
- }
- break;
- case 4:
- ODScrnSetAttribute((BYTE)(od_control.od_cur_attrib
- = chCurrent));
- btAvatarSeqLevel = 0;
- break;
- case 5:
- chPrevParam = chCurrent;
- btAvatarSeqLevel = 6;
- break;
- case 6:
- ODScrnSetCursorPos(chCurrent, chPrevParam);
- btAvatarSeqLevel = 0;
- break;
- case 7:
- if(btScrollLines < 1)
- {
- btScrollLines = chCurrent;
- }
- else
- {
- btScrollLines = -chCurrent;
- }
- btAvatarSeqLevel = 8;
- break;
- case 8:
- btScrollTop = chCurrent;
- btAvatarSeqLevel = 9;
- break;
- case 9:
- btScrollLeft = chCurrent;
- btAvatarSeqLevel = 10;
- break;
- case 10:
- btScrollBottom = chCurrent;
- btAvatarSeqLevel = 11;
- break;
- case 11:
- btScrollRight = chCurrent;
- btAvatarSeqLevel = 12;
- break;
- case 12:
- if(btScrollLines == 0
- || abs(btScrollLines) >
- (btScrollBottom - btScrollTop))
- {
- ODEmulateFillArea(btScrollLeft, btScrollTop,
- btScrollRight, btScrollBottom, ' ');
- }
- else if(btScrollLines < 0)
- {
- ODScrnCopyText(btScrollLeft, btScrollTop,
- btScrollRight,
- (BYTE)(btScrollBottom + btScrollLines),
- btScrollLeft,
- (BYTE)(btScrollTop - btScrollLines));
- ODEmulateFillArea(btScrollLeft, btScrollTop,
- btScrollRight,
- (BYTE)(btScrollTop - (btScrollLines - 1)), ' ');
- }
- else
- {
- ODScrnCopyText(btScrollLeft,
- (BYTE)(btScrollTop + btScrollLines),
- btScrollRight, btScrollBottom,
- btScrollLeft, btScrollTop);
- ODEmulateFillArea(btScrollLeft,
- (BYTE)(btScrollBottom - (btScrollLines - 1)),
- btScrollRight, btScrollBottom, ' ');
- }
- btAvatarSeqLevel = 0;
- break;
- case 14:
- btScrollLines = (chCurrent & 0x7f);
- btScrollRight = ' ';
- btAvatarSeqLevel = 17;
- break;
- case 15:
- btScrollLines = (chCurrent & 0x7f);
- btAvatarSeqLevel = 16;
- break;
- case 16:
- btScrollRight = chCurrent;
- btAvatarSeqLevel = 17;
- break;
- case 17:
- btScrollTop = chCurrent;
- btAvatarSeqLevel = 18;
- break;
- case 18:
- ODScrnGetTextInfo(&TextInfo);
- ODScrnSetAttribute((BYTE)(od_control.od_cur_attrib
- = btScrollLines));
- ODEmulateFillArea(TextInfo.curx, TextInfo.cury,
- (BYTE)(TextInfo.curx + chCurrent),
- (BYTE)(TextInfo.cury + btScrollTop), btScrollRight);
- btAvatarSeqLevel = 0;
- break;
- case 19:
- btScrollLines = (chCurrent & 0x7f);
- szToRepeat[btRepeatCount = 0] = '\0';
- btAvatarSeqLevel = 20;
- break;
- case 20:
- if(btRepeatCount < btScrollLines)
- {
- szToRepeat[btRepeatCount] = chCurrent;
- szToRepeat[++btRepeatCount] = '\0';
- }
- else
- {
- for(btRepeatCount = 0; btRepeatCount <
- (BYTE)chCurrent;++btRepeatCount)
- {
- ODScrnDisplayString(szToRepeat);
- }
- btAvatarSeqLevel = 0;
- }
- break;
-
- case 21:
- bEchoThisChar = FALSE;
- switch(chCurrent)
- {
- case 'A':
- od_disp_str(od_control.user_name);
- break;
- case 'B':
- od_disp_str(od_control.user_location);
- break;
- case 'C':
- od_disp_str(od_control.user_password);
- break;
- case 'D':
- od_disp_str(od_control.user_dataphone);
- break;
- case 'E':
- od_disp_str(od_control.user_homephone);
- break;
- case 'F':
- od_disp_str(od_control.user_lastdate);
- break;
- case 'G':
- od_disp_str(od_control.user_lasttime);
- break;
- case 'H':
- btScrollLines = 0;
- goto show_flags;
- case 'I':
- btScrollLines = 1;
- goto show_flags;
- case 'J':
- btScrollLines = 2;
- goto show_flags;
- case 'K':
- btScrollLines = 3;
- show_flags: for(btRepeatCount = 0; btRepeatCount < 8;
- ++btRepeatCount)
- {
- if((od_control.user_flags[btScrollLines] >>
- btRepeatCount) & 0x01)
- {
- szToRepeat[btRepeatCount] = 'X';
- }
- else
- {
- szToRepeat[btRepeatCount] = '-';
- }
- }
- szToRepeat[btRepeatCount] = '\0';
- od_disp_str(szToRepeat);
- break;
- case 'L':
- od_printf("%lu", od_control.user_net_credit);
- break;
- case 'M':
- od_printf("%u", od_control.user_messages);
- break;
- case 'N':
- od_printf("%u", od_control.user_lastread);
- break;
- case 'O':
- od_printf("%u", od_control.user_security);
- break;
- case 'P':
- od_printf("%u", od_control.user_numcalls);
- break;
- case 'Q':
- od_printf("%ul", od_control.user_uploads);
- break;
- case 'R':
- od_printf("%ul", od_control.user_upk);
- break;
- case 'S':
- od_printf("%ul", od_control.user_downloads);
- break;
- case 'T':
- od_printf("%ul", od_control.user_downk);
- break;
- case 'U':
- od_printf("%d", od_control.user_time_used);
- break;
- case 'V':
- od_printf("%d", od_control.user_screen_length);
- break;
- case 'W':
- btRepeatCount = 0;
- while(od_control.user_name[btRepeatCount])
- {
- if((szToRepeat[btRepeatCount]
- = od_control.user_name[btRepeatCount])
- == ' ')
- {
- szToRepeat[btRepeatCount] = '\0';
- break;
- }
- ++btRepeatCount;
- }
- od_disp_str(szToRepeat);
- break;
- case 'X':
- if(od_control.user_ansi)
- {
- od_disp_str("ON");
- }
- else
- {
- od_disp_str("OFF");
- }
- break;
- case 'Y':
- if(od_control.user_attribute & 0x04)
- {
- od_disp_str("ON");
- }
- else
- {
- od_disp_str("OFF");
- }
- break;
- case 'Z':
- if(od_control.user_attribute & 0x02)
- {
- od_disp_str("ON");
- }
- else
- {
- od_disp_str("OFF");
- }
- break;
- case '0':
- if(od_control.user_attribute & 0x40)
- {
- od_disp_str("ON");
- }
- else
- {
- od_disp_str("OFF");
- }
- break;
- case '1':
- if(od_control.user_attribute & 0x80)
- {
- od_disp_str("ON");
- }
- else
- {
- od_disp_str("OFF");
- }
- break;
- case '2':
- if(od_control.user_attrib2 & 0x01)
- {
- od_disp_str("ON");
- }
- else
- {
- od_disp_str("OFF");
- }
- break;
- case '3':
- od_disp_str(od_control.user_handle);
- break;
- case '4':
- od_disp_str(od_control.user_firstcall);
- break;
- case '5':
- od_disp_str(od_control.user_birthday);
- break;
- case '6':
- od_disp_str(od_control.user_subdate);
- break;
- case '7':
-
- break;
- case '8':
- if(od_control.user_attrib2 & 0x02)
- {
- od_disp_str("ON");
- }
- else
- {
- od_disp_str("OFF");
- }
- break;
- case '9':
- od_printf("%lu:%lu",
- od_control.user_uploads,
- od_control.user_downloads);
- break;
- case ':':
- od_printf("%lu:%lu",
- od_control.user_upk,
- od_control.user_downk);
- break;
- case ';':
- if(od_control.user_attrib2 & 0x04)
- {
- od_disp_str("ON");
- }
- else
- {
- od_disp_str("OFF");
- }
- }
- btAvatarSeqLevel=0;
- break;
-
- case 22:
- bEchoThisChar = FALSE;
- switch(chCurrent)
- {
- case 'A':
- od_printf("%lu", od_control.system_calls);
- break;
- case 'B':
- od_disp_str(od_control.system_last_caller);
- break;
- case 'C':
-
- break;
- case 'D':
-
- break;
- case 'E':
-
- break;
- case 'F':
-
- break;
- case 'G':
-
- break;
- case 'H':
-
- break;
- case 'I':
-
- break;
- case 'J':
-
- break;
- case 'K':
-
- break;
- case 'L':
-
- break;
- case 'M':
- od_printf("%d", od_control.user_time_used);
- break;
- case 'N':
- od_disp_str("00");
- break;
- case 'O':
-
- od_printf("%d", od_control.user_timelimit);
- break;
- case 'P':
-
- break;
- case 'Q':
- od_printf("0", od_control.user_timelimit);
- break;
- case 'R':
- od_printf("0", od_control.baud);
- break;
- case 'S':
-
- break;
- case 'T':
-
- break;
- case 'U':
-
- break;
- case 'V':
- ODScrnDisplayString(od_control.event_starttime);
- break;
- case 'W':
-
- break;
- case 'X':
- od_exit(2, TRUE);
- break;
- case 'Y':
-
- break;
- case 'Z':
-
- break;
- case '0':
-
- break;
- case '1':
-
- break;
- case '2':
-
- break;
- }
- btAvatarSeqLevel = 0;
- }
- }
- break;
- case 1:
- switch(chCurrent)
- {
- case '[':
- btANSISeqLevel = 2;
- btCurrentParamLength = 0;
- btNumParams = 0;
- break;
- default:
- btANSISeqLevel = 0;
- ODScrnDisplayChar(27);
- ODScrnDisplayChar(chCurrent);
- }
- break;
- default:
- if((chCurrent >= '0' && chCurrent <= '9') || chCurrent == '?')
- {
- if(btCurrentParamLength < 3)
- {
- szCurrentParam[btCurrentParamLength] = chCurrent;
- szCurrentParam[++btCurrentParamLength] = '\0';
- }
- else
- {
- btANSISeqLevel = 0;
- }
- }
- else if(chCurrent == ';')
- {
- if(btNumParams < 10)
- {
- if(btCurrentParamLength != 0)
- {
- if(strcmp(szCurrentParam, "?9") == 0)
- {
- anANSIParams[btNumParams] = -2;
- }
- else
- {
- anANSIParams[btNumParams] = atoi(szCurrentParam);
- }
- szCurrentParam[0] = '\0';
- btCurrentParamLength = 0;
- ++btNumParams;
- }
- else
- {
- anANSIParams[btNumParams++] = -1;
- }
- }
- else
- {
- btANSISeqLevel = 0;
- }
- }
- else
- {
- btANSISeqLevel = 0;
- if(btCurrentParamLength != 0 && btNumParams < 10)
- {
- if(strcmp(szCurrentParam,"?9") == 0)
- {
- anANSIParams[btNumParams] = -2;
- }
- else
- {
- anANSIParams[btNumParams] = atoi(szCurrentParam);
- }
- szCurrentParam[0] = '\0';
- btCurrentParamLength = 0;
- ++btNumParams;
- }
- ODScrnGetTextInfo(&TextInfo);
- switch(chCurrent)
- {
- case 'A':
- if(btNumParams == 0) anANSIParams[0] = 1;
- if((nTemp = TextInfo.cury - anANSIParams[0]) < 1)
- {
- nTemp = 1;
- }
- if(nTemp > 25) nTemp=25;
- ODScrnSetCursorPos(TextInfo.curx, (BYTE)nTemp);
- break;
- case 'B':
- if(btNumParams == 0) anANSIParams[0] = 1;
- if((nTemp = TextInfo.cury + anANSIParams[0]) > 25)
- {
- nTemp = 25;
- }
- if(nTemp < 1) nTemp = 1;
- ODScrnSetCursorPos(TextInfo.curx, (BYTE)nTemp);
- break;
- case 'C':
- if(btNumParams == 0) anANSIParams[0] = 1;
- if((nTemp=TextInfo.curx + anANSIParams[0]) > 80)
- {
- nTemp = 80;
- }
- if(nTemp < 1) nTemp = 1;
- ODScrnSetCursorPos((BYTE)nTemp, TextInfo.cury);
- break;
- case 'D':
- if(btNumParams == 0) anANSIParams[0] = 1;
- if((nTemp = TextInfo.curx - anANSIParams[0]) < 1)
- {
- nTemp = 1;
- }
- if(nTemp > 80) nTemp = 80;
- ODScrnSetCursorPos((BYTE)nTemp, TextInfo.cury);
- break;
- case 'H':
- case 'f':
- if(btNumParams >= 2)
- {
- if(anANSIParams[0] == -1)
- {
- ODScrnSetCursorPos((BYTE)anANSIParams[1], 1);
- }
- else
- {
- ODScrnSetCursorPos((BYTE)anANSIParams[1],
- (BYTE)anANSIParams[0]);
- }
- }
- else if(btNumParams == 1)
- {
- if(anANSIParams[0] <= 0)
- {
- ODScrnSetCursorPos(1, TextInfo.cury);
- }
- else
- {
- ODScrnSetCursorPos(1, (BYTE)anANSIParams[0]);
- }
- }
- else
- {
- ODScrnSetCursorPos(1, 1);
- }
- break;
- case 'J':
- if(btNumParams >= 1 && anANSIParams[0] == 2)
- {
-
- ODScrnClear();
- }
- else if(btNumParams == 0 || anANSIParams[0] == 0)
- {
-
-
- }
- else if(btNumParams>=1 && anANSIParams[0]==1)
- {
-
-
- }
- break;
- case 'K':
- if(btNumParams == 0 || anANSIParams[0] == 0)
- {
-
- ODScrnClearToEndOfLine();
- }
- else if(btNumParams >= 1 && anANSIParams[0] == 1)
- {
-
- }
- else if(btNumParams >= 1 && anANSIParams[0] == 2)
- {
-
- }
- break;
- case 'm':
- for(nTemp = 0; nTemp < btNumParams; ++nTemp)
- {
- if(anANSIParams[nTemp] == 0)
- {
- ODScrnSetAttribute((BYTE)(od_control.od_cur_attrib
- = TextInfo.attribute = 0x07));
- }
- else if(anANSIParams[nTemp] == 1)
- {
- ODScrnSetAttribute((BYTE)(od_control.od_cur_attrib
- = TextInfo.attribute
- = TextInfo.attribute | 0x08));
- }
- else if(anANSIParams[nTemp] == 2)
- {
- ODScrnSetAttribute((BYTE)(od_control.od_cur_attrib
- = TextInfo.attribute
- = TextInfo.attribute & (~0x08)));
- }
- else if(anANSIParams[nTemp] == 4)
- {
- ODScrnSetAttribute((BYTE)(od_control.od_cur_attrib
- = TextInfo.attribute
- = (TextInfo.attribute & 0xf8) | (1)));
- }
- else if(anANSIParams[nTemp] == 5)
- {
- ODScrnSetAttribute((BYTE)(od_control.od_cur_attrib
- = TextInfo.attribute
- = TextInfo.attribute | 0x80));
- }
- else if(anANSIParams[nTemp] == 7)
- {
- ODScrnSetAttribute((BYTE)(od_control.od_cur_attrib
- = TextInfo.attribute
- = (TextInfo.attribute << 4)
- | (TextInfo.attribute >> 4)));
- }
- else if(anANSIParams[nTemp] == 8)
- {
- ODScrnSetAttribute((BYTE)(od_control.od_cur_attrib
- = TextInfo.attribute
- = (TextInfo.attribute & 0xf0)
- | ((TextInfo.attribute >> 4) & 0x07)));
- }
- else if(anANSIParams[nTemp] >= 30
- && anANSIParams[nTemp] <= 37)
- {
- ODScrnSetAttribute((BYTE)(od_control.od_cur_attrib
- = TextInfo.attribute
- = (TextInfo.attribute & 0xf8)
- + abtANSIToPCColorTable[
- (anANSIParams[nTemp] - 30)]));
- }
- else if(anANSIParams[nTemp] >= 40
- && anANSIParams[nTemp]<=47)
- {
- ODScrnSetAttribute((BYTE)(od_control.od_cur_attrib
- = TextInfo.attribute
- = (TextInfo.attribute & 0x8f)
- + (abtANSIToPCColorTable[
- anANSIParams[nTemp] - 40] << 4)));
- }
- }
- break;
- case 's':
- btSavedColumn = TextInfo.curx;
- btSavedRow = TextInfo.cury;
- break;
- case 'u':
- ODScrnSetCursorPos(btSavedColumn, btSavedRow);
- break;
- case '@':
-
- break;
- case 'P':
-
- break;
- case 'L':
-
- break;
- case 'M':
-
- break;
- case 'r':
-
-
-
-
-
- break;
- case 'h':
- if(btNumParams >= 1 && anANSIParams[0] == 4)
- {
-
- }
- else if(btNumParams >= 1 && anANSIParams[0] == -2)
- {
-
- ODScrnSetCursorPos(1, 1);
- }
- break;
- case 'l':
- if(btNumParams >= 1 && anANSIParams[0] == 4)
- {
-
- }
- break;
- case 'E':
-
- break;
- case 'F':
-
-
-
- break;
- }
- }
- }
- if(bEchoThisChar && od_control.baud != 0)
- {
- ODComSendByte(hSerialPort, chCurrent);
- }
- ++pszBuffer;
- }
- }
- static void ODEmulateFillArea(BYTE btLeft, BYTE btTop, BYTE btRight,
- BYTE btBottom, char chToFillWith)
- {
- BYTE btCount;
- BYTE btLast;
- static char szTemp[81];
- static tODScrnTextInfo TextInfo;
- ODScrnGetTextInfo(&TextInfo);
- btLast = btRight - btLeft;
- for(btCount=0; btCount <= btLast; ++btCount)
- {
- szTemp[btCount] = chToFillWith;
- }
- szTemp[btCount] = 0;
- ODScrnEnableScrolling(FALSE);
- for(btCount = btTop; btCount <= btBottom; ++btCount)
- {
- ODScrnSetCursorPos(btLeft, btCount);
- ODScrnDisplayString(szTemp);
- }
- ODScrnSetCursorPos(TextInfo.curx, TextInfo.cury);
- ODScrnEnableScrolling(TRUE);
- }
|