DictViewInstance::WordList *DictViewInstance::WordSuggestion(FarStringW &word)
{
  WordList *wl = new WordList();
  _current_color = -1;
  _current_word = word;
  DecisionTable::action_inst_t act_inst = logic.Execute();
  Action *action = static_cast<Action *>(act_inst->client_context);
  far_assert(action);
  FarString suggestion_order = action->suggestions;
  if (suggestion_order.IsEmpty()) 
    for (int i = 0; i<DictCount(); i++)
      suggestion_order += GetDict(i)->dict + ';';
  if (suggestion_order.IsEmpty())
    return wl;
  FarStringTokenizer dicts(suggestion_order, ';');
  for (int i = 0; i < DictCount() && dicts.HasNext(); i++) 
  {
    const FarString &dict(dicts.NextToken());
    for (int j = 0; j < DictCount(); j++)
      if (GetDict(j)->dict == dict) {
        far_assert(spell_factory);
        SpellInstance *dict_inst = spell_factory->GetDictInstance(dict);
        far_assert(dict_inst);
        wl->Add(dict_inst->Suggest(word));
      }
  }
  return wl;
}
Example #2
0
SpellCheck::SpellCheck(QObject *parent):QObject(parent)
{
    spellChecker = nullptr;
    codec = nullptr;
    if(langs.empty()) {
        // Look for available dicts
        QDir dicts("/usr/share/hunspell/");
        QStringList filters;
        filters.append("*.dic");
        QStringList files = dicts.entryList(filters, QDir::Files, QDir::Name);
        for(QString file : files) {
            langs.append( _getFirstPart(file, ".") );
        }
    }
}
Example #3
0
static void
save(void)
{
	int i;
	FILE *f;

	for (i = 0; i < counter; i++) {
		char buf[12];

		snprintf(buf, 12, "%d.txt", i);
		f = fopen(buf, "w");
		if (!f)
			return;
		fwrite(tab[i].data, 1, tab[i].length, f);
		fclose(f);
	}
	f = fopen("proxy.py", "w");
	if (!f)
		return;
	fprintf(f, "%s", header);
	dicts(f);
	fprintf(f, "%s", footer);
	fclose(f);
}
void thermalBaffleFvPatchScalarField::createPatchMesh()
{

    const fvMesh& thisMesh = patch().boundaryMesh().mesh();

    word regionName = dict_.lookup("regionName");

    List<polyPatch*> regionPatches(3);
    List<word> patchNames(regionPatches.size());
    List<word> patchTypes(regionPatches.size());
    List<dictionary> dicts(regionPatches.size());

    patchNames[bottomPatchID] = word("bottom");
    patchNames[sidePatchID] = word("side");
    patchNames[topPatchID] = word("top");

    patchTypes[bottomPatchID] = mappedWallPolyPatch::typeName;
    patchTypes[topPatchID] = mappedWallPolyPatch::typeName;

    if (readBool(dict_.lookup("columnCells")))
    {
        patchTypes[sidePatchID] = emptyPolyPatch::typeName;
    }
    else
    {
        patchTypes[sidePatchID] = polyPatch::typeName;
    }

    const mappedPatchBase& mpp =
        refCast<const mappedPatchBase>(patch().patch());

    const word coupleGroup(mpp.coupleGroup());

    wordList inGroups(1);
    inGroups[0] = coupleGroup;

    dicts[bottomPatchID].add("coupleGroup", coupleGroup);
    dicts[bottomPatchID].add("inGroups", inGroups);
    dicts[bottomPatchID].add("sampleMode", mpp.sampleModeNames_[mpp.mode()]);

    const label sepPos = coupleGroup.find('_');

    const word coupleGroupSlave = coupleGroup(0, sepPos) + "_slave";

    inGroups[0] = coupleGroupSlave;
    dicts[topPatchID].add("coupleGroup", coupleGroupSlave);
    dicts[topPatchID].add("inGroups", inGroups);
    dicts[topPatchID].add("sampleMode", mpp.sampleModeNames_[mpp.mode()]);


    forAll (regionPatches, patchI)
    {
        dictionary&  patchDict = dicts[patchI];
        patchDict.set("nFaces", 0);
        patchDict.set("startFace", 0);

        regionPatches[patchI] = polyPatch::New
        (
            patchTypes[patchI],
            patchNames[patchI],
            dicts[patchI],
            patchI,
            thisMesh.boundaryMesh()
        ).ptr();
    }