Team Ai
Datasetpublic

hschumann2/TempleOS-Source-Code

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes847downloads
PhoneNumWords.txt65 linesDownload Raw Back to Demo
1 2U8 char_map[26]="22233344455566677778889999";3 4/*5Fmt of word lst entry:6  U8 ACD_WORD_CHAR7  U8 word[] with terminating zero8  I16 block; //definition offset in ::/Adam/AutoComplete/ACDefs.DATA9*/10U0 PhoneNumWords(U8 *num)11{12  I64 ch;13  U8 *_num=StrNew(num),*dst=_num,14        *dict=acd.word_lst,*st,*src;15  while (*num) {16    if ('0'<=*num<='9')17      *dst++=*num;18    num++;19  }20  *dst=0;21 22  while (*dict++) {23    if (StrLen(dict)>2) {24      dst=st=StrNew(dict);25      while (ch=ToUpper(*dst)) {26        if ('A'<=ch<='Z')27          *dst=char_map[ch-'A'];28        else29          *dst=CH_SPACE;30        dst++;31      }32      *dst=0;33 34      src=_num;35      while (*src) {36        if (!StrNCmp(st,src,StrLen(st))) {37          ch=*src;38          *src=0;39          "%s",_num;40          *src=ch;41          "$GREEN$%s$FG$",dict;42          "%s\n",src+StrLen(st);43        }44        src++;45      }46      Free(st);47    }48    dict+=StrLen(dict)+3;49  }50  Free(_num);51  '\n';52}53 54U0 PNWDemo()55{56  U8 *st;57  while ((st=GetStr("Phone Num:")) && *st) {58    PhoneNumWords(st);59    Free(st);60  }61  Free(st);62}63 64PNWDemo;65