//rpage2.cpp version 1.0a3.web1 , Rupert Scammell 1999. Open Source, Public Domain, Do whatever // you wish with the code, etc. If you do anything neat with this code, it'd be cool to // hear from you.. drop me a line at fib@lumiere.net if you have any questions or comments :-) // Resources: // Check out http://cocoon.ucr.edu/~kentj01/pager.html , a useful overview of the pager // vocabulary included within the source. // Metalayer designations (subject to change): // 0. Alphabetic characters // 1. Numeric and punctuation characters // 2. Collective, referential and question words // 3. Emergency words and phrases // 4. Verbs and endings // 5. Times and locations // 6. Extra time and orientational/positional descriptors // 7. Short questions, statements and phrases // 8. Longer phrases and questions // 9. Extra words/UCR specific phrases and people /* The pager vocabulary in array form.... now file based, but this is a useful inline reference. Item numbers //ml:0 6 7 8 9 0 presets[0].layer = {{"C","T","S","P","H"}, // 1 {"A","V","L","O","Y"}, // 2 {"E","X","W","N","G"}, // 3 Sets {"Q","U","M","J","R"}, // 4 {"I","K","B","D","F"}};// 5 //ml:1 presets[1].layer = {{"Z","1","2","3","4"}, {"5","6","7","8","9"}, {"0",".","?",">","<"}, {"!",":"," ","/","\\"}, {";","*","+","-",")"}}; presets[2].layer ={{"ME ","NOT ","OR ","AND ","COME "}, {"THE ","THERE ","HERE ","THIS ","WHAT "}, {"OUR ","YOU ","THEY ","THIS ","THAT "}, {"IS ","ARE ","DID ","WERE ","CAN "}, {"WHO ","WHEN ","WHERE ","WHY ","HOW "}}; presets[3].layer = {{"EMERGENCY ","HELP ","ACCIDENT ","DANGER ","STOP "}, {"NETWORK ","FAILURE ","NEED ","DIAL 911 ","DIAL HOME "}, {"DIAL ","ASAP ","CAR ","LOCATION ","LOST "}, {"ME ","YOU ","CANNOT ","DON'T ","AT "}, {"URGENT ","MEDICAL ","HIGHWAY ","PICKUP FROM ","NEED RIDE TO "}}; presets[4].layer = {{"ED ","ING ","WANT ","REMEMBER ","TALK "}, {"GO ","GONE ","FIND","FOUND ","SEE "}, {"SAW ","GIVE ","EMAIL ","TAKE ","COME "}, {"GET ","GOT ","I ","WITH","TO "}, {"MISS ","AT ","THE ","YOU ","ME "}}; presets[5].layer = {{"FOR ","HOME ","WORK ","SCHOOL ","TODAY "}, {"TOMORROW ","TONIGHT ","MORNING ","EVENING ","RESTAURANT "}, {"RESERVATIONS ","CANCEL ","BUSY ","FREE ","O'CLOCK "}, {"NOW ","LATER ","BEGIN ","END ","SECOND "}, {"MINUTE ","HOUR ","DAY ","WEEK ","MONTH "}}; presets[6].layer = {{"YEAR ","NEXT ","PREVIOUS ","PAST ","FUTURE "}, {"TIME ","AFTER ","BEFORE ","OVER ","UNDER "}, {"LEFT ","RIGHT ","NEAR ","FAR ","HIGH "}, {"LOW ","ON ","OFF ","IN ","OUT "}, {"BEHIND ","FRONT ","UP ","DOWN ","@"}}; presets[7].layer = {{"I LOVE YOU ","HEY THERE ","HOW ARE YOU? ","GET ON THE NET ", "CHECK YOUR EMAIL "}, {"TAKE CARE ","SEE YOU LATER ","WHERE ARE YOU? ","HAPPY BIRTHDAY! ", "WANT TO GET TOGETHER? "}, {"I'M REALLY BORED ","WHAT ARE YOU UP TO? ","AAAARGH ", "I'M DOING OK ","I'M NOT THAT WELL "}, {"I'M OUT OF TOWN ","WHAT'S YOUR NUMBER THERE? ","SOUNDS GOOD ", "FORGET THAT ","DON'T EVEN THINK ABOUT IT "}, {"I WANT TO TALK WITH YOU ","HAVEN'T TALKED TO YOU IN A WHILE ", "THANKS A LOT ","CALL ME ", "LOOK AT THE NEWS. SOMETHING BIG JUST HAPPENED "}}; presets[8].layer = {{"WHAT TIME ARE YOU LEAVING? ","WHAT TIME WILL YOU BE BACK? ", "DON'T FORGET OUR ENGAGEMENT ","I'LL BE OUT OF TOUCH FOR A WHILE ", "ARE YOU READY TO GO? "}, {"YOU'RE WONDERFUL ","STAY OUT OF TROUBLE ","TAG, YOU'RE IT ", "THINKING OF YOU ","DID YOU DROP OFF THE FACE OF THE EARTH? "}, {"GLAD TO HEAR THAT ","SORRY ABOUT THAT ","GET WELL SOON! ", "I'M BACK NOW ","I'VE GOT A PROBLEM "}, {"EVERYTHING'S COOL ","EVERYTHING JUST WENT TO HELL ", "CAN YOU HELP ME OUT? ","CANCEL PREVIOUS MESSAGE ","LET'S GO "}, {"THAT WASN'T FUN ","DO YOU KNOW WHERE ","DON'T FORGET TO BRING ", "SOMETHING COOL'S GOING ON AT ","GIVE ME A BREAK "}}; presets[9].layer = {{"TRASHING ","EAT ","STUFF ","WE HAVE A CODE ","RUPERT "}, {"JEREMY ","SHARON ","MELLISSA ","BEN ","DEBORAH "}, {"MIKE ","LOTHIAN ","SOLARIUM ","DR A'S LAB ","NIB "}, {"WANT TO GO TO DINNER? ","FISHBOWL ","BELLTOWER ","MEET ME AT ", "ROOMMATE"}, {"NO ","YES ","MAYBE ","PURPLE", "NORMAL RULES FOR NORMAL PEOPLE LIVING NORMAL LIVES"}}; */ // Message tests: // 1111-716 // includes #include #include #include #include #include #include #include // IMPORTANT!!! //uncomment this for most PC/Unix based compilers: // using namespace std; int chartoint(char); // functions int chartoint(char mychar) { int x = (mychar-48); return x; } int main (void) { int menuselection; string pmsg; string senderid; string wordfile; int currentset=0; int mpos=0; int tcset, tlpos; int metalayer=0; int count;//, wordpos; int checkvar=0; int llv=0; typedef struct { int itemlen; int arraycolpos; int arrayrowpos; int mlayer; }itemlocation; itemlocation mystrings[250]; //itemlocation tempstring; //itemlocation initial; typedef struct { string layer[5][5]; }meta; meta presets[10]; // our array of pager strings. ifstream InWords("wordlist"); if (InWords.fail()) { cerr << "The word file could not be opened. " << endl; return 1; } metalayer = 0; tcset=0; tlpos=0; count=0; while ( !InWords.eof() ) { getline(InWords, pmsg); presets[metalayer].layer[tcset][tlpos] = pmsg; //cout << "msg: " << pmsg << " metalayer: " << metalayer << " tcset: " << tcset << " tlpos: " << tlpos << " length: " << pmsg.length() << " count: " << count < "; cin >> menuselection; } while (menuselection == 1) { cout << "\n\n Please enter the pager message: "; cin >> pmsg; cout << "\n\n"; cout << "Pager message from Sender ID: " << pmsg[0] << pmsg[1] << endl; cout << "Packet # " << pmsg[2] << " of " << pmsg[3] << " packets." << endl; cout << "Packet Length: " << pmsg.length() << endl; cout << "Message: " << endl; mpos = 4; // go to start of message space. if ( chartoint(pmsg[mpos]) > 5 || chartoint(pmsg[mpos]) == 0) { cout << "I'm sorry, an error occurred. A starting set could not be located." << endl; } while (mpos < (int)pmsg.length() ) { //cout << "\nmpos: " << mpos << endl; //DEBUG CODE if (pmsg[mpos] == '-') { metalayer = chartoint(pmsg[mpos+1]); mpos=mpos+2; //cout << "\nmetalayer changed to: " << metalayer << endl; //DEBUG CODE } if ( chartoint(pmsg[mpos]) > 5 || chartoint(pmsg[mpos]) == 0 && mpos !=4) { tcset = currentset-1; //cout << "\ncurrentset: " << currentset << " tcset: " << tcset << endl; // DEBUG CODE if (chartoint(pmsg[mpos])==0) { tlpos=4; //cout << "\ntlpos set to 4 in special case." << endl; // DEBUG CODE } // tlpos special case end if (chartoint(pmsg[mpos]) != 0) { tlpos=chartoint(pmsg[mpos])-6; //cout << "\ntlpos: " << tlpos << endl; // DEBUG CODE } // tlpos normal end cout << presets[metalayer].layer[tcset][tlpos]; } // actual letter in set end if ( chartoint(pmsg[mpos]) < 6 && chartoint(pmsg[mpos]) != 0) { currentset=chartoint(pmsg[mpos]); //cout << "\ncurrentset: " << currentset << endl; //DEBUG CODE } // currentset if end mpos=mpos+1; menuselection = 0; } // while end } // menuselection if end if (menuselection == 2) { cout << "Warning: This feature is not implemented yet, but here's some early code..\n\n"; cout << "\nPlease enter the 2 digit ID you'd like to send under: "; cin >> senderid; metalayer=-1; cin.ignore(); cout << "\n Please enter the message that you wish to send: "; getline(cin, pmsg); count=0; while (count < (int)pmsg.length()) { pmsg[count]=toupper(pmsg[count]); // convert all letters to uppercase. count++; } cout << "Message converted to: " << pmsg << " (Press Enter to continue)\n"; //DEBUG CODE } // menuselection 2 end. if (menuselection == 3) { cout << "This feature hasn't been implemented yet. Quit within your OS instead :-P\n"; }// menuselection 3 end. } // llv while return 0; }