char *file_getname(const char *path) { const char *ret; int csize; ret = path; while((csize = milstr_charsize(path)) != 0) { if ((csize == 1) && (*path == '/')) { ret = path + 1; } path += csize; } return((char *)ret); }
OEMCHAR * DOSIOCALL file_getname(const OEMCHAR *path) { const OEMCHAR *ret; int csize; ret = path; while((csize = milstr_charsize(path)) != 0) { if ((csize == 1) && ((*path == '\\') || (*path == '/') || (*path == ':'))) { ret = path + 1; } path += csize; } return((OEMCHAR *)ret); }
/** * ファイル名のポインタを得る * @param[in] lpPathName パス * @return ポインタ */ OEMCHAR* DOSIOCALL file_getname(const OEMCHAR* lpPathName) { const OEMCHAR* ret = lpPathName; while (1 /* EVER */) { const int cch = milstr_charsize(lpPathName); if (cch == 0) { break; } else if ((cch == 1) && ((*lpPathName == '\\') || (*lpPathName == '/') || (*lpPathName == ':'))) { ret = lpPathName + 1; } lpPathName += cch; } return const_cast<OEMCHAR*>(ret); }
void DOSIOCALL file_cutext(OEMCHAR *path) { OEMCHAR *p; OEMCHAR *q; int csize; p = file_getname(path); q = NULL; while((csize = milstr_charsize(p)) != 0) { if ((csize == 1) && (*p == '.')) { q = p; } p += csize; } if (q) { *q = '\0'; } }
OEMCHAR * DOSIOCALL file_getext(const OEMCHAR *path) { const OEMCHAR *p; const OEMCHAR *q; int csize; p = file_getname(path); q = NULL; while((csize = milstr_charsize(p)) != 0) { if ((csize == 1) && (*p == '.')) { q = p + 1; } p += csize; } if (q == NULL) { q = p; } return((OEMCHAR *)q); }
void file_catname(char *path, const char *name, int maxlen) { int csize; while(maxlen > 0) { if (*path == '\0') { break; } path++; maxlen--; } file_cpyname(path, name, maxlen); while((csize = milstr_charsize(path)) != 0) { if ((csize == 1) && (*path == '\\')) { *path = '/'; } path += csize; } }
/** * 拡張子を削除 * @param[in,out] lpPathName パス */ void DOSIOCALL file_cutext(OEMCHAR* lpPathName) { OEMCHAR* p = file_getname(lpPathName); OEMCHAR* q = NULL; while (1 /* EVER */) { const int cch = milstr_charsize(p); if (cch == 0) { break; } else if ((cch == 1) && (*p == '.')) { q = p; } p += cch; } if (q) { *q = '\0'; } }
/** * 拡張子のポインタを得る * @param[in] lpPathName パス * @return ポインタ */ OEMCHAR* DOSIOCALL file_getext(const OEMCHAR* lpPathName) { const OEMCHAR* p = file_getname(lpPathName); const OEMCHAR* q = NULL; while (1 /* EVER */) { const int cch = milstr_charsize(p); if (cch == 0) { break; } else if ((cch == 1) && (*p == '.')) { q = p + 1; } p += cch; } if (q == NULL) { q = p; } return const_cast<OEMCHAR*>(q); }
static BRESULT setmboxitem(MBOX *mb, const OEMCHAR *str, UINT type) { OEMCHAR *dst; int rem; int w; OEMCHAR work[4]; int width; POINT_T pt; int leng; if (mb == NULL) { goto smbi_err; } ZeroMemory(mb, sizeof(MBOX)); if (str == NULL) { goto smbi_set; } if ((type & 0xf) >= 6) { type &= ~0x0f; } mb->type = type; width = MENUMBOX_WIDTH - (MENUMBOX_SX + MENUMBOX_PXTEXT + MENUMBOX_LXTEXT); if (mb->type & 0xf0) { width -= MENUMBOX_CXICON; } dst = NULL; rem = 0; w = 0; while(1) { leng = milstr_charsize(str); if (leng == 0) { break; } if ((str[0] >= 0) && (str[0] < 0x20)) { if (str[0] == '\n') { dst = mb->string[mb->lines]; mb->lines++; if (mb->lines >= MENUMBOX_MAXLINE) { break; } rem = NELEMENTS(mb->string[0]) - 1; if (mb->width < w) { mb->width = w; } w = 0; } } else { CopyMemory(work, str, leng * sizeof(OEMCHAR)); work[leng] = '\0'; fontmng_getsize(menubase.font, work, &pt); if ((rem < leng) || ((w + pt.x) > width)) { dst = mb->string[mb->lines]; mb->lines++; if (mb->lines >= MENUMBOX_MAXLINE) { break; } rem = NELEMENTS(mb->string[0]) - 1; if (mb->width < w) { mb->width = w; } w = 0; } w += pt.x; CopyMemory(dst, str, leng * sizeof(OEMCHAR)); dst += leng; rem -= leng; } str += leng; } if (mb->width < w) { mb->width = w; } smbi_set: mb->width += (MENUMBOX_SX + MENUMBOX_PXTEXT + MENUMBOX_LXTEXT); fontmng_getsize(menubase.font, mstr_fontcheck, &pt); mb->fontsize = pt.y; mb->height = mb->lines * mb->fontsize; if (mb->type & 0xf0) { mb->width += MENUMBOX_CXICON; if (mb->height < MENUMBOX_CYICON) { mb->height = MENUMBOX_CYICON; } } mb->height += MENUMBOX_SY + MENUMBOX_SYBTN + MENUMBOX_CYBTN + MENUMBOX_LYBTN; width = b_res[mb->type & 0x0f][0]; width *= (MENUMBOX_CXBTN + MENUMBOX_PXBTN); width += (MENUMBOX_SXBTN * 2) - MENUMBOX_PXBTN; if (mb->width < width) { mb->width = width; } return(SUCCESS); smbi_err: return(FAILURE); }