本文整理汇总了C++中MelderString_copy函数的典型用法代码示例。如果您正苦于以下问题:C++ MelderString_copy函数的具体用法?C++ MelderString_copy怎么用?C++ MelderString_copy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MelderString_copy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NativeMenuItem_setText
static void NativeMenuItem_setText (GuiObject me) {
int acc = my motiff.pushButton.acceleratorChar, modifiers = my motiff.pushButton.acceleratorModifiers;
static MelderString title { 0 };
if (acc == 0) {
MelderString_copy (& title, _GuiWin_expandAmpersands (my name));
} else {
static const char32 *keyStrings [256] = {
0, U"<-", U"->", U"Up", U"Down", U"PAUSE", U"Del", U"Ins", U"Backspace", U"Tab", U"LineFeed", U"Home", U"End", U"Enter", U"PageUp", U"PageDown",
U"Esc", U"F1", U"F2", U"F3", U"F4", U"F5", U"F6", U"F7", U"F8", U"F9", U"F10", U"F11", U"F12", 0, 0, 0,
U"Space", U"!", U"\"", U"#", U"$", U"%", U"&", U"\'", U"(", U")", U"*", U"+", U",", U"-", U".", U"/",
U"0", U"1", U"2", U"3", U"4", U"5", U"6", U"7", U"8", U"9", U":", U";", U"<", U"=", U">", U"?",
U"@", U"A", U"B", U"C", U"D", U"E", U"F", U"G", U"H", U"I", U"J", U"K", U"L", U"M", U"N", U"O",
U"P", U"Q", U"R", U"S", U"T", U"U", U"V", U"W", U"X", U"Y", U"Z", U"[", U"\\", U"]", U"^", U"_",
U"`", U"a", U"b", U"c", U"d", U"e", U"f", U"g", U"h", U"i", U"j", U"k", U"l", U"m", U"n", U"o",
U"p", U"q", U"r", U"s", U"t", U"u", U"v", U"w", U"x", U"y", U"z", U"{", U"|", U"}", U"~", U"Del",
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, U"[", U"]", U",", U"?", U".", U"\\",
U";", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, U"-", U"`", U"=", U"\'", 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
const char32 *keyString = keyStrings [acc] ? keyStrings [acc] : U"???";
MelderString_copy (& title, _GuiWin_expandAmpersands (my name), U"\t",
modifiers & _motif_COMMAND_MASK ? U"Ctrl-" : nullptr,
modifiers & _motif_OPTION_MASK ? U"Alt-" : nullptr,
modifiers & _motif_SHIFT_MASK ? U"Shift-" : nullptr, keyString);
}
ModifyMenu (my nat.entry.handle, my nat.entry.id, MF_BYCOMMAND | MF_STRING, my nat.entry.id, Melder_peek32toW (title.string));
}
示例2: Thing_messageName
char32 * Thing_messageName (Thing me) {
static MelderString buffers [19] { { 0 } };
static int ibuffer = 0;
if (++ ibuffer == 19) ibuffer = 0;
if (my name) {
MelderString_copy (& buffers [ibuffer], my classInfo -> className, U" \"", my name, U"\"");
} else {
MelderString_copy (& buffers [ibuffer], my classInfo -> className);
}
return buffers [ibuffer]. string;
}
示例3: NativeMenuItem_setText
static void NativeMenuItem_setText (GuiObject me) {
int acc = my motiff.pushButton.acceleratorChar, modifiers = my motiff.pushButton.acceleratorModifiers;
#if win
static MelderString title { 0 };
if (acc == 0) {
MelderString_copy (& title, _GuiWin_expandAmpersands (my name));
} else {
static const char32 *keyStrings [256] = {
0, U"<-", U"->", U"Up", U"Down", U"PAUSE", U"Del", U"Ins", U"Backspace", U"Tab", U"LineFeed", U"Home", U"End", U"Enter", U"PageUp", U"PageDown",
U"Esc", U"F1", U"F2", U"F3", U"F4", U"F5", U"F6", U"F7", U"F8", U"F9", U"F10", U"F11", U"F12", 0, 0, 0,
U"Space", U"!", U"\"", U"#", U"$", U"%", U"&", U"\'", U"(", U")", U"*", U"+", U",", U"-", U".", U"/",
U"0", U"1", U"2", U"3", U"4", U"5", U"6", U"7", U"8", U"9", U":", U";", U"<", U"=", U">", U"?",
U"@", U"A", U"B", U"C", U"D", U"E", U"F", U"G", U"H", U"I", U"J", U"K", U"L", U"M", U"N", U"O",
U"P", U"Q", U"R", U"S", U"T", U"U", U"V", U"W", U"X", U"Y", U"Z", U"[", U"\\", U"]", U"^", U"_",
U"`", U"a", U"b", U"c", U"d", U"e", U"f", U"g", U"h", U"i", U"j", U"k", U"l", U"m", U"n", U"o",
U"p", U"q", U"r", U"s", U"t", U"u", U"v", U"w", U"x", U"y", U"z", U"{", U"|", U"}", U"~", U"Del",
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, U"[", U"]", U",", U"?", U".", U"\\",
U";", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, U"-", U"`", U"=", U"\'", 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
const char32 *keyString = keyStrings [acc] ? keyStrings [acc] : U"???";
MelderString_copy (& title, _GuiWin_expandAmpersands (my name), U"\t",
modifiers & _motif_COMMAND_MASK ? U"Ctrl-" : nullptr,
modifiers & _motif_OPTION_MASK ? U"Alt-" : nullptr,
modifiers & _motif_SHIFT_MASK ? U"Shift-" : nullptr, keyString);
}
ModifyMenu (my nat.entry.handle, my nat.entry.id, MF_BYCOMMAND | MF_STRING, my nat.entry.id, Melder_peek32toW (title.string));
#elif mac
static int theGlyphs [1+31] = { 0,
kMenuLeftArrowDashedGlyph, kMenuRightArrowDashedGlyph, kMenuUpArrowDashedGlyph, kMenuDownwardArrowDashedGlyph, 0,
kMenuDeleteRightGlyph, 0, kMenuDeleteLeftGlyph, kMenuTabRightGlyph, 0,
0, 0, kMenuReturnGlyph, kMenuPageUpGlyph, kMenuPageDownGlyph,
kMenuEscapeGlyph, kMenuF1Glyph, kMenuF2Glyph, kMenuF3Glyph, kMenuF4Glyph,
kMenuF5Glyph, kMenuF6Glyph, kMenuF7Glyph, kMenuF8Glyph, kMenuF9Glyph,
kMenuF10Glyph, kMenuF11Glyph, kMenuF12Glyph, 0, 0,
0 };
SetMenuItemTextWithCFString (my nat.entry.handle, my nat.entry.item, (CFStringRef) Melder_peek32toCfstring (my name));
if (acc > 32) {
SetItemCmd (my nat.entry.handle, my nat.entry.item, acc);
} else {
Melder_assert (acc > 0 && acc < 32);
SetItemCmd (my nat.entry.handle, my nat.entry.item, ' '); /* Funny that this should be needed. */
SetMenuItemKeyGlyph (my nat.entry.handle, my nat.entry.item, theGlyphs [acc]);
}
SetMenuItemModifiers (my nat.entry.handle, my nat.entry.item,
( modifiers & _motif_OPTION_MASK ? kMenuOptionModifier : 0 ) +
( modifiers & _motif_SHIFT_MASK ? kMenuShiftModifier : 0 ) +
( modifiers & _motif_COMMAND_MASK ? 0 : kMenuNoCommandModifier ));
#endif
}
示例4: TableOfReal_writeToHeaderlessSpreadsheetFile
void TableOfReal_writeToHeaderlessSpreadsheetFile (TableOfReal me, MelderFile file) {
try {
autoMelderString buffer;
MelderString_copy (& buffer, L"rowLabel");
for (long icol = 1; icol <= my numberOfColumns; icol ++) {
MelderString_appendCharacter (& buffer, '\t');
wchar_t *s = my columnLabels [icol];
MelderString_append (& buffer, s != NULL && s [0] != '\0' ? s : L"?");
}
MelderString_appendCharacter (& buffer, '\n');
for (long irow = 1; irow <= my numberOfRows; irow ++) {
wchar_t *s = my rowLabels [irow];
MelderString_append (& buffer, s != NULL && s [0] != '\0' ? s : L"?");
for (long icol = 1; icol <= my numberOfColumns; icol ++) {
MelderString_appendCharacter (& buffer, '\t');
double x = my data [irow] [icol];
MelderString_append (& buffer, Melder_double (x));
}
MelderString_appendCharacter (& buffer, '\n');
}
MelderFile_writeText (file, buffer.string, Melder_getOutputEncoding ());
} catch (MelderError) {
Melder_throw (me, ": not saved to tab-separated file.");
}
}
示例5: v_draw
void structOTMultiEditor :: v_draw () {
OTMulti grammar = (OTMulti) data;
static MelderString buffer { 0 };
double rowHeight = 0.25, tableauHeight = 2 * rowHeight;
Graphics_clearWs (g);
HyperPage_listItem (this, U"\t\t %%ranking value\t %disharmony\t %plasticity");
for (long icons = 1; icons <= grammar -> numberOfConstraints; icons ++) {
OTConstraint constraint = & grammar -> constraints [grammar -> index [icons]];
MelderString_copy (& buffer, U"\t", ( icons == selectedConstraint ? U"♠︎ " : U" " ), U"@@", icons,
U"|", constraint -> name, U"@\t ", Melder_fixed (constraint -> ranking, 3),
U"\t ", Melder_fixed (constraint -> disharmony, 3),
U"\t ", Melder_fixed (constraint -> plasticity, 6)
);
HyperPage_listItem (this, buffer.string);
}
Graphics_setAtSignIsLink (g, FALSE);
drawTableau_grammar = grammar;
for (long icand = 1; icand <= grammar -> numberOfCandidates; icand ++) {
if (OTMulti_candidateMatches (grammar, icand, form1, form2)) {
tableauHeight += rowHeight;
}
}
drawTableau_form1 = form1;
drawTableau_form2 = form2;
drawTableau_constraintsAreDrawnVertically = d_constraintsAreDrawnVertically;
HyperPage_picture (this, 20, tableauHeight, drawTableau);
Graphics_setAtSignIsLink (g, TRUE);
}
示例6: Melder_system
void Melder_system (const char32 *command) {
if (! command) command = U"";
#if defined (macintosh) || defined (UNIX)
if (system (Melder_peek32to8 (command)) != 0)
Melder_throw (U"System command failed.");
#elif defined (_WIN32)
STARTUPINFO siStartInfo;
PROCESS_INFORMATION piProcInfo;
char32 *comspec = Melder_getenv (U"COMSPEC"); // e.g. "C:\WINDOWS\COMMAND.COM" or "C:\WINNT\windows32\cmd.exe"
if (! comspec) {
comspec = Melder_getenv (U"ComSpec");
}
autoMelderString buffer;
if (comspec) {
MelderString_copy (& buffer, comspec);
} else {
OSVERSIONINFOEX osVersionInfo;
memset (& osVersionInfo, 0, sizeof (OSVERSIONINFOEX));
osVersionInfo. dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
if (! GetVersionEx ((OSVERSIONINFO *) & osVersionInfo)) {
osVersionInfo. dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
if (! GetVersionEx ((OSVERSIONINFO *) & osVersionInfo))
Melder_throw (U"System command cannot find system version.");
}
switch (osVersionInfo. dwPlatformId) {
case VER_PLATFORM_WIN32_NT: {
MelderString_copy (& buffer, U"cmd.exe");
} break; case VER_PLATFORM_WIN32_WINDOWS: {
MelderString_copy (& buffer, U"command.com");
} break; default: {
MelderString_copy (& buffer, U"command.com");
}
}
}
MelderString_append (& buffer, U" /c ", command);
memset (& siStartInfo, 0, sizeof (siStartInfo));
siStartInfo. cb = sizeof (siStartInfo);
if (! CreateProcess (nullptr, Melder_peek32toW (buffer.string), nullptr, nullptr, true, CREATE_NO_WINDOW, nullptr, nullptr, & siStartInfo, & piProcInfo))
Melder_throw (U"Cannot create subprocess.");
WaitForSingleObject (piProcInfo. hProcess, -1);
CloseHandle (piProcInfo. hProcess);
CloseHandle (piProcInfo. hThread);
#endif
}
示例7: FFNet_createNameFromTopology
autostring32 FFNet_createNameFromTopology (FFNet me) {
autoMelderString name;
MelderString_copy (&name, my nUnitsInLayer[0]);
for (long i = 1; i <= my nLayers; i++) {
MelderString_appendCharacter (&name, U'-');
MelderString_append (&name, my nUnitsInLayer[i]);
}
autostring32 naam = Melder_dup (name.string);
return naam.transfer();
}
示例8: Melder_system
void Melder_system (const wchar_t *command) {
#if defined (macintosh) || defined (UNIX)
if (system (Melder_peekWcsToUtf8 (command)) != 0)
Melder_throw ("System command failed.");
#elif defined (_WIN32)
STARTUPINFO siStartInfo;
PROCESS_INFORMATION piProcInfo;
wchar_t *comspec = Melder_getenv (L"COMSPEC"); // e.g. "C:\WINDOWS\COMMAND.COM" or "C:\WINNT\windows32\cmd.exe"
if (comspec == NULL) {
comspec = Melder_getenv (L"ComSpec");
}
MelderString buffer = { 0 };
if (comspec != NULL) {
MelderString_copy (& buffer, comspec);
} else {
OSVERSIONINFOEX osVersionInfo;
memset (& osVersionInfo, 0, sizeof (OSVERSIONINFOEX));
osVersionInfo. dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
if (! GetVersionEx ((OSVERSIONINFO *) & osVersionInfo)) {
osVersionInfo. dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
if (! GetVersionEx ((OSVERSIONINFO *) & osVersionInfo))
Melder_throw ("System command cannot find system version.");
}
switch (osVersionInfo. dwPlatformId) {
case VER_PLATFORM_WIN32_NT: {
MelderString_copy (& buffer, L"cmd.exe");
} break; case VER_PLATFORM_WIN32_WINDOWS: {
MelderString_copy (& buffer, L"command.com");
} break; default: {
MelderString_copy (& buffer, L"command.com");
}
}
}
MelderString_append (& buffer, L" /c ", command);
memset (& siStartInfo, 0, sizeof (siStartInfo));
siStartInfo. cb = sizeof (siStartInfo);
if (! CreateProcess (NULL, buffer.string, NULL, NULL, TRUE, 0, NULL, NULL, & siStartInfo, & piProcInfo))
Melder_throw ("Cannot create subprocess.");
WaitForSingleObject (piProcInfo. hProcess, -1);
CloseHandle (piProcInfo. hProcess);
CloseHandle (piProcInfo. hThread);
#endif
}
示例9: Melder_pad
const char32 * Melder_pad (const char32 *string, int64 width) {
if (++ iPadBuffer == NUMBER_OF_BUFFERS) iPadBuffer = 0;
int64 length = str32len (string);
int64 tooShort = width - length;
if (tooShort <= 0) return string;
MelderString_copy (& thePadBuffers [iPadBuffer], string);
for (int64 i = 0; i < tooShort; i ++)
MelderString_appendCharacter (& thePadBuffers [iPadBuffer], U' ');
return thePadBuffers [iPadBuffer]. string;
}
示例10: NativeMenuItem_setText
static void NativeMenuItem_setText (GuiObject me) {
int acc = my motiff.pushButton.acceleratorChar, modifiers = my motiff.pushButton.acceleratorModifiers;
#if win
static MelderString title = { 0 };
if (acc == 0) {
MelderString_copy (& title, _GuiWin_expandAmpersands (my name));
} else {
static const wchar_t *keyStrings [256] = {
0, L"<-", L"->", L"Up", L"Down", L"PAUSE", L"Del", L"Ins", L"Backspace", L"Tab", L"LineFeed", L"Home", L"End", L"Enter", L"PageUp", L"PageDown",
L"Esc", L"F1", L"F2", L"F3", L"F4", L"F5", L"F6", L"F7", L"F8", L"F9", L"F10", L"F11", L"F12", 0, 0, 0,
L"Space", L"!", L"\"", L"#", L"$", L"%", L"&", L"\'", L"(", L")", L"*", L"+", L",", L"-", L".", L"/",
L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9", L":", L";", L"<", L"=", L">", L"?",
L"@", L"A", L"B", L"C", L"D", L"E", L"F", L"G", L"H", L"I", L"J", L"K", L"L", L"M", L"N", L"O",
L"P", L"Q", L"R", L"S", L"T", L"U", L"V", L"W", L"X", L"Y", L"Z", L"[", L"\\", L"]", L"^", L"_",
L"`", L"a", L"b", L"c", L"d", L"e", L"f", L"g", L"h", L"i", L"j", L"k", L"l", L"m", L"n", L"o",
L"p", L"q", L"r", L"s", L"t", L"u", L"v", L"w", L"x", L"y", L"z", L"{", L"|", L"}", L"~", L"Del",
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"[", L"]", L",", L"?", L".", L"\\",
L";", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"-", L"`", L"=", L"\'", 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
const wchar_t *keyString = keyStrings [acc] ? keyStrings [acc] : L"???";
MelderString_empty (& title);
MelderString_append (& title, _GuiWin_expandAmpersands (my name), L"\t",
modifiers & _motif_COMMAND_MASK ? L"Ctrl-" : NULL,
modifiers & _motif_OPTION_MASK ? L"Alt-" : NULL,
modifiers & _motif_SHIFT_MASK ? L"Shift-" : NULL, keyString);
}
ModifyMenu (my nat.entry.handle, my nat.entry.id, MF_BYCOMMAND | MF_STRING, my nat.entry.id, title.string);
#elif mac
static int theGlyphs [1+31] = { 0,
kMenuLeftArrowDashedGlyph, kMenuRightArrowDashedGlyph, kMenuUpArrowDashedGlyph, kMenuDownwardArrowDashedGlyph, 0,
kMenuDeleteRightGlyph, 0, kMenuDeleteLeftGlyph, kMenuTabRightGlyph, 0,
0, 0, kMenuReturnGlyph, kMenuPageUpGlyph, kMenuPageDownGlyph,
kMenuEscapeGlyph, kMenuF1Glyph, kMenuF2Glyph, kMenuF3Glyph, kMenuF4Glyph,
kMenuF5Glyph, kMenuF6Glyph, kMenuF7Glyph, kMenuF8Glyph, kMenuF9Glyph,
kMenuF10Glyph, kMenuF11Glyph, kMenuF12Glyph, 0, 0,
0 };
SetMenuItemTextWithCFString (my nat.entry.handle, my nat.entry.item, (CFStringRef) Melder_peekWcsToCfstring (my name));
if (acc > 32) {
SetItemCmd (my nat.entry.handle, my nat.entry.item, acc);
} else {
Melder_assert (acc > 0 && acc < 32);
SetItemCmd (my nat.entry.handle, my nat.entry.item, ' '); /* Funny that this should be needed. */
SetMenuItemKeyGlyph (my nat.entry.handle, my nat.entry.item, theGlyphs [acc]);
}
SetMenuItemModifiers (my nat.entry.handle, my nat.entry.item,
( modifiers & _motif_OPTION_MASK ? kMenuOptionModifier : 0 ) +
( modifiers & _motif_SHIFT_MASK ? kMenuShiftModifier : 0 ) +
( modifiers & _motif_COMMAND_MASK ? 0 : kMenuNoCommandModifier ));
#endif
}
示例11: v_nameChanged
void structTextEditor :: v_nameChanged () {
if (v_fileBased ()) {
bool dirtinessAlreadyShown = GuiWindow_setDirty (our d_windowForm, our dirty);
static MelderString windowTitle { 0 };
if (our name [0] == U'\0') {
MelderString_copy (& windowTitle, U"(untitled");
if (dirty && ! dirtinessAlreadyShown)
MelderString_append (& windowTitle, U", modified");
MelderString_append (& windowTitle, U")");
} else {
MelderString_copy (& windowTitle, U"File ", MelderFile_messageName (& our file));
if (dirty && ! dirtinessAlreadyShown)
MelderString_append (& windowTitle, U" (modified)");
}
GuiShell_setTitle (our d_windowForm, windowTitle.string);
//MelderString_copy (& windowTitle, our dirty && ! dirtinessAlreadyShown ? U"*" : U"", our name [0] == U'\0' ? U"(untitled)" : MelderFile_name (& our file));
} else {
TextEditor_Parent :: v_nameChanged ();
}
}
示例12: v_nameChanged
void structScriptEditor :: v_nameChanged () {
bool dirtinessAlreadyShown = d_windowForm -> f_setDirty (dirty);
static MelderString buffer = { 0 };
MelderString_copy (& buffer, name [0] ? L"Script" : L"untitled script");
if (editorClass)
MelderString_append (& buffer, L" [", environmentName, L"]");
if (name [0])
MelderString_append (& buffer, L" ", MelderFile_messageName (& file));
if (dirty && ! dirtinessAlreadyShown)
MelderString_append (& buffer, L" (modified)");
d_windowForm -> f_setTitle (buffer.string);
}
示例13: v_nameChanged
void structScriptEditor :: v_nameChanged () {
bool dirtinessAlreadyShown = GuiWindow_setDirty (d_windowForm, dirty);
static MelderString buffer { 0 };
MelderString_copy (& buffer, name [0] ? U"Script" : U"untitled script");
if (editorClass)
MelderString_append (& buffer, U" [", environmentName, U"]");
if (name [0])
MelderString_append (& buffer, U" ", MelderFile_messageName (& file));
if (dirty && ! dirtinessAlreadyShown)
MelderString_append (& buffer, U" (modified)");
GuiShell_setTitle (d_windowForm, buffer.string);
}
示例14: menu_cb_writeOneToHtmlFile
static void menu_cb_writeOneToHtmlFile (Manual me, EDITOR_ARGS_FORM) {
EDITOR_FORM_WRITE (U"Save as HTML file", nullptr)
ManPages manPages = (ManPages) my data;
autoMelderString buffer;
MelderString_copy (& buffer, manPages -> pages.at [my path] -> title);
char32 *p = buffer.string;
while (*p) { if (! isalnum ((int) *p) && *p != U'_') *p = U'_'; p ++; }
MelderString_append (& buffer, U".html");
Melder_sprint (defaultName,300, buffer.string);
EDITOR_DO_WRITE
ManPages_writeOneToHtmlFile ((ManPages) my data, my path, file);
EDITOR_END
}
示例15: Melder_padOrTruncate
const char32 * Melder_padOrTruncate (const char32 *string, int64 width) {
if (++ iPadBuffer == NUMBER_OF_BUFFERS) iPadBuffer = 0;
int64 length = str32len (string);
int64 tooLong = length - width;
if (tooLong == 0) return string;
if (tooLong < 0) {
int64 tooShort = - tooLong;
MelderString_copy (& thePadBuffers [iPadBuffer], string);
for (int64 i = 0; i < tooShort; i ++)
MelderString_appendCharacter (& thePadBuffers [iPadBuffer], U' ');
} else {
MelderString_ncopy (& thePadBuffers [iPadBuffer], string, width);
}
return thePadBuffers [iPadBuffer]. string;
}