Functions | |
| void | init (int *argc, char **argv[]) |
| void | warn (string const &) |
| string | current_root () |
| string::size_type | common_path (string const &p1, string const &p2) |
| string | slashify_path (string const &p) |
| string | external_path (string const &p) |
| string | internal_path (string const &p) |
| bool | is_absolute_path (string const &p) |
| char const * | popen_read_mode () |
| string | binpath () |
| string | binname () |
| void | setTmpDir (string const &p) |
| string | getTmpDir () |
| shell_type | shell () |
|
|
Definition at line 224 of file os_os2.C. Referenced by LyX::init.
00225 {
00226 return binname_;
00227 }
|
|
|
Definition at line 218 of file os_os2.C. Referenced by LyX::init.
00219 {
00220 return binpath_;
00221 }
|
|
||||||||||||
|
Definition at line 111 of file os_os2.C.
00112 {
00113 static bool initialized = false;
00114 if (!initialized) {
00115 init(0, 0);
00116 initialized = true;
00117 }
00118
00119 COUNTRYCODE cntry;
00120 cntry.country = 0;
00121 cntry.codepage = cp_;
00122 string temp1 = slashify_path(p1);
00123 string temp2 = slashify_path(p2);
00124 char * tmp1 = const_cast<char *> (temp1.c_str());
00125 char * tmp2 = const_cast<char *> (temp2.c_str());
00126 /* rc = */ DosMapCase(p1.length(), &cntry, tmp1);
00127 // if (rc != NO_ERROR)
00128 // exit(rc);
00129 /* rc = */ DosMapCase(p2.length(), &cntry, tmp2);
00130 // if (rc != NO_ERROR)
00131 // exit(rc);
00132 // This algorithm works only if paths are slashified on DBCS systems.
00133 string::size_type i = 0;
00134 string::size_type p1_len = p1.length();
00135 string::size_type p2_len = p2.length();
00136 while (i < p1_len && i < p2_len && tmp1[i] == tmp2[i])
00137 ++i;
00138 if ((i < p1_len && i < p2_len)
00139 || (i < p1_len && tmp1[i] != '/' && i == p2_len)
00140 || (i < p2_len && tmp2[i] != '/' && i == p1_len))
00141 {
00142 if (i)
00143 --i; // here was the last match
00144 while (i && tmp1[i] != '/')
00145 --i;
00146 }
00147 return i;
00148 }
|
|
|
Definition at line 96 of file os_os2.C.
00097 {
00098 APIRET rc;
00099 ULONG drv_num;
00100 ULONG drv_map;
00101 rc = DosQueryCurrentDisk(&drv_num, &drv_map);
00102 if (rc != NO_ERROR)
00103 exit(rc);
00104 char drive = 'A' + drv_num -1;
00105 string tmp(1, drive);
00106 tmp += ":/";
00107 return tmp;
00108 }
|
|
|
Definition at line 190 of file os_os2.C. Referenced by InsetGraphics::latex, InsetBibtex::latex, and Buffer::makeLaTeXFile.
00191 {
00192 return p;
00193 }
|
|
|
Definition at line 236 of file os_os2.C. Referenced by LyX::init.
00237 {
00238 return tmpdir_;
00239 }
|
|
||||||||||||
|
Definition at line 38 of file os_os2.C. Referenced by main.
00039 {
00040 if (argc != 0 /* This is a hack! */) {
00041 _wildcard(argc, argv);
00042 PTIB ptib = new TIB[1];
00043 PPIB ppib = new PIB[1];
00044 APIRET rc = DosGetInfoBlocks(&ptib, &ppib);
00045 if (rc != NO_ERROR)
00046 exit(rc);
00047 char* tmp = new char[256];
00048 // This is the only reliable way to retrieve the executable name.
00049 rc = DosQueryModuleName(ppib->pib_hmte, 256L, tmp);
00050 if (rc != NO_ERROR)
00051 exit(rc);
00052 string p = tmp;
00053 p = slashify_path(p);
00054 binname_ = OnlyFilename(p);
00055 binname_.erase(binname_.length()-4, string::npos);
00056 binpath_ = OnlyPath(p);
00057
00058 // OS/2 cmd.exe has another use for '&'
00059 string sh = OnlyFilename(GetEnvPath("EMXSHELL"));
00060 if (sh.empty()) {
00061 // COMSPEC is set, unless user unsets
00062 sh = OnlyFilename(GetEnvPath("COMSPEC"));
00063 if (sh.empty())
00064 sh = "cmd.exe";
00065 }
00066 sh = lowercase(sh); // DosMapCase() is an overkill here
00067 if (contains(sh, "cmd.exe") || contains(sh, "4os2.exe"))
00068 shell_ = os::CMD_EXE;
00069 else
00070 shell_ = os::UNIX;
00071 }
00072
00073 static bool initialized = false;
00074 if (initialized)
00075 return;
00076 initialized = true;
00077
00078 ULONG CPList[3] = {0};
00079 ULONG CPList_size;
00080 APIRET rc = DosQueryCp(3 * sizeof(ULONG), CPList, &CPList_size);
00081 if (rc != NO_ERROR)
00082 exit(rc);
00083 // CPList[0] == process current codepage,
00084 // CPList[1] == system default codepage, the rest are auxilary.
00085 // Once cp_ is correctly set, you can call other routines.
00086 cp_ = CPList[1];
00087 }
|
|
|
Definition at line 196 of file os_os2.C. Referenced by LaTeX::deplog.
00197 {
00198 return p;
00199 }
|
|
|
Definition at line 202 of file os_os2.C.
00203 {
00204 return (p.length() > 1
00205 && isalpha(static_cast<unsigned char>(p[0]))
00206 && p[1] == ':');
00207 }
|
|
|
Definition at line 212 of file os_os2.C.
00213 {
00214 return "r";
00215 }
|
|
|
Definition at line 230 of file os_os2.C. Referenced by LyX::init.
00231 {
00232 tmpdir_ = p;
00233 }
|
|
|
Definition at line 242 of file os_os2.C. Referenced by lyx::support::Systemcall::startscript.
00243 {
00244 return shell_;
00245 }
|
|
|
Definition at line 151 of file os_os2.C.
00152 {
00153 static bool initialized = false;
00154 static bool leadbyte[256] = {false};
00155 if (!initialized) {
00156 init(0, 0);
00157 COUNTRYCODE cntry;
00158 cntry.country = 0;
00159 cntry.codepage = cp_;
00160 unsigned char *DBCSinfo = new unsigned char[12];
00161 /* rc = */ DosQueryDBCSEnv(12, &cntry, (char*) DBCSinfo);
00162 // if (rc != NO_ERROR)
00163 // exit(rc);
00164 for (int j = 1; j < 12; j += 2)
00165 DBCSinfo[j]++;
00166 unsigned char i = 0;
00167 bool isLeadByte = false;
00168 while (*DBCSinfo != 0) {
00169 if (i == *DBCSinfo) {
00170 isLeadByte = !isLeadByte;
00171 DBCSinfo++;
00172 }
00173 leadbyte[i++] = isLeadByte;
00174 }
00175 initialized = true;
00176 }
00177 string::iterator lit = p.begin();
00178 string::iterator end = p.end();
00179 for (; lit < end; ++lit) {
00180 if (leadbyte[(*lit)])
00181 lit += 2;
00182 if ((*lit) == '\\')
00183 (*lit) = '/';
00184 }
00185 p = subst(p, "//", "/");
00186 return p;
00187 }
|
|
|
Definition at line 90 of file os_os2.C.
00091 {
00092 return;
00093 }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002