Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

451 lines
12 KiB

  1. BEGIN {
  2. options=ARGV[1]
  3. ARGV[1]=""
  4. gpdname=ARGV[2]
  5. ARGV[2]=""
  6. resname=ARGV[3]
  7. ARGV[3]=""
  8. InitFontMap();
  9. InitDocOrder();
  10. print "*%"
  11. print "*% Copyright (c) 1997 - 2000 Microsoft Corporation"
  12. print "*% All Rights Reserved."
  13. print "*%"
  14. }
  15. /^\*GPDFileName/ {
  16. print "*GPDFileName: \"" gpdname "\""
  17. print "*CodePage: 1252"
  18. next
  19. }
  20. /^\*ModelName/ {
  21. gsub(/���Z��/, "KYOCERA")
  22. if (options ~ /H/)
  23. gsub(/"$/, " (MPS)\"")
  24. }
  25. /^\*ResourceDLL/ {
  26. print "*ResourceDLL: \"" resname "\""
  27. print "*Feature: RESDLL"
  28. print "{"
  29. print " *Option: KyoRes"
  30. print " {"
  31. print " *Name: \"kyores.dll\""
  32. print " }"
  33. print "}"
  34. next
  35. }
  36. /^\*DefaultFont/ || /^\*DeviceFonts/ || /\*Fonts/ || /^\+[ \t]*[0-9]/ {
  37. DoMapFont($0)
  38. next
  39. }
  40. /^\*Feature/ {
  41. feature=$2
  42. if (feature ~ /(MediaType|PrintDensity)/)
  43. SkipBlock = 1
  44. else if (feature ~ /PrintQuality/ && options ~ /M/) {
  45. SkipBlock = 1
  46. print "*Feature: PrintQuality"
  47. print "{"
  48. print " *rcNameID: =TEXT_QUALITY_DISPLAY"
  49. print " *DefaultOption: Option2"
  50. print " *Option: Option1"
  51. print " {"
  52. print " *rcNameID: 355"
  53. print " *Command: CmdSelect"
  54. print " {"
  55. print " *Order: DOC_SETUP.10"
  56. print " *Cmd: \"!R!sir0;exit;\""
  57. print " }"
  58. print " }"
  59. print " *Option: Option2"
  60. print " {"
  61. print " *rcNameID: 356"
  62. print " *Command: CmdSelect"
  63. print " {"
  64. print " *Order: DOC_SETUP.10"
  65. print " *Cmd: \"!R!sir2;exit;\""
  66. print " }"
  67. print " }"
  68. print "}"
  69. }
  70. }
  71. /\*Command/ {
  72. command=$2
  73. if (command ~ /CmdStartDoc/)
  74. SkipBlock = 1
  75. else if (command ~ /CmdStartPage/) {
  76. print "*Command: CmdStartDoc"
  77. print "{"
  78. print " *Order: DOC_SETUP.1"
  79. print " *Cmd: \"!R!;sem6;FFTO0;exit;<1B>%%-12345X@PJL<0D0A>\""
  80. print "}"
  81. } else if (command ~ /(CmdEndJob|CmdCopies)/) {
  82. if (options ~ /H/) {
  83. if (command ~ /CmdEndJob/) {
  84. print "*Command: " command
  85. print "{"
  86. print " *Order: DOC_FINISH.1"
  87. print " *Cmd: \"<1B>E<1B>%%-12345X!R!JOBT;FFTO1;res;exit;\""
  88. print "}"
  89. } else {
  90. print "*Command: " command
  91. print "{"
  92. print " *Order: DOC_SETUP.7"
  93. print " *Cmd: %d{NumOfCopies}\",\""
  94. print "}"
  95. }
  96. } else if (options ~ /R/) {
  97. print "*switch: RamDisk"
  98. print "{"
  99. print " *case: NotInstalled"
  100. print " {"
  101. print " *Command: " command
  102. print " {"
  103. if (command ~ /CmdEndJob/) {
  104. print " *Order: DOC_FINISH.1"
  105. print " *Cmd: \"<1B>E<1B>%%-12345X!R!FFTO1;res;exit;\""
  106. } else {
  107. print " *Order: DOC_SETUP.7"
  108. print " *Cmd: \"<1B>&l\" %d{NumOfCopies}\"X\""
  109. }
  110. print " }"
  111. print " }"
  112. print " *case: Installed"
  113. print " {"
  114. print " *Command: " command
  115. print " {"
  116. if (command ~ /CmdEndJob/) {
  117. print " *Order: DOC_FINISH.1"
  118. print " *Cmd: \"<1B>E<1B>%%-12345X!R!JOBT;FFTO1;res;exit;\""
  119. } else {
  120. print " *Order: DOC_SETUP.7"
  121. print " *Cmd: %d{NumOfCopies}\",0,0,0,%\"%\",%\"%\",%\"%\";EXIT;\""
  122. }
  123. print " }"
  124. print " }"
  125. print "}"
  126. } else {
  127. print "*Command: " command
  128. print "{"
  129. if (command ~ /CmdEndJob/) {
  130. print " *Order: DOC_FINISH.1"
  131. print " *Cmd: \"<1B>E<1B>%%-12345X!R!FFTO1;res;exit;\""
  132. } else {
  133. print " *Order: DOC_SETUP.7"
  134. print " *Cmd: \"<1B>&l\" %d{NumOfCopies}\"X\""
  135. }
  136. print "}"
  137. }
  138. SkipBlock = 1
  139. }
  140. }
  141. /\*Order.*DOC_SETUP/ {
  142. if (command ~ /CmdSelect/)
  143. i = feature
  144. else
  145. i = command
  146. if (i in DocOrder)
  147. gsub(/[0-9]*$/, DocOrder[i])
  148. else
  149. $0 = $0 "???"
  150. }
  151. /^}$/ {
  152. if (SkipBlock) {
  153. SkipBlock = 0
  154. feature=""
  155. next
  156. } else if (feature ~ /Resolution/) {
  157. print "*% *Option: Option3"
  158. print "*% {"
  159. print "*% *Name: \"150 x 150 dots per inch\""
  160. print "*% *DPI: PAIR(150, 150)"
  161. print "*% *TextDPI: PAIR(300, 300)"
  162. print "*% *MinStripBlankPixels: 32"
  163. print "*% EXTERN_GLOBAL: *StripBlanks: LIST(ENCLOSED,TRAILING)"
  164. print "*% *SpotDiameter: 100"
  165. print "*% *Command: CmdBeginRaster { *Cmd : \"<1B>*r1A\" }"
  166. print "*% *Command: CmdEndRaster { *Cmd : \"<1B>*rB\" }"
  167. print "*% *Command: CmdSendBlockData { *Cmd : \"<1B>*b\" %d{NumOfDataBytes}\"W\" }"
  168. print "*% *Command: CmdSelect"
  169. print "*% {"
  170. print "*% *Order: DOC_SETUP.5"
  171. print "*% *Cmd: \"@PJL SET RESOLUTION=300<0D0A>@PJL ENTER LANGUAGE = PCL<0D0A1B>E<1B>*t150R<1B>&u\""
  172. print "*% + \"600D<1B>*r0F\""
  173. print "*% }"
  174. print "*% }"
  175. print "*% *Option: Option4"
  176. print "*% {"
  177. print "*% *Name: \"75 x 75 dots per inch\""
  178. print "*% *DPI: PAIR(75, 75)"
  179. print "*% *TextDPI: PAIR(300, 300)"
  180. print "*% EXTERN_GLOBAL: *StripBlanks: LIST(TRAILING)"
  181. print "*% *SpotDiameter: 100"
  182. print "*% *Command: CmdBeginRaster { *Cmd : \"<1B>*r1A\" }"
  183. print "*% *Command: CmdEndRaster { *Cmd : \"<1B>*rB\" }"
  184. print "*% *Command: CmdSendBlockData { *Cmd : \"<1B>*b\" %d{NumOfDataBytes}\"W\" }"
  185. print "*% *Command: CmdSelect"
  186. print "*% {"
  187. print "*% *Order: DOC_SETUP.5"
  188. print "*% *Cmd: \"@PJL SET RESOLUTION=300<0D0A>@PJL ENTER LANGUAGE = PCL<0D0A1B>E<1B>*t75R<1B>&u6\""
  189. print "*% + \"00D<1B>*r0F\""
  190. print "*% }"
  191. print "*% }"
  192. }
  193. feature=""
  194. }
  195. /\*rcNameID/ {
  196. if (feature ~ /PaperSize/ && $2 !~ /PAPER_SIZE_DISPLAY/) {
  197. print
  198. gsub(/\*rcNameID.*$/, "*PageProtectMem: 2048")
  199. print
  200. next
  201. }
  202. }
  203. {
  204. if (SkipBlock)
  205. next
  206. print
  207. }
  208. END {
  209. file="newfea.txt"
  210. while (getline < file > 0)
  211. print
  212. close(file)
  213. if (options ~ /M/) {
  214. file = "mtype.txt"
  215. while (getline < file > 0)
  216. print
  217. close(file)
  218. }
  219. if (options ~ /H/) {
  220. file = "hdunit.txt"
  221. while (getline < file > 0)
  222. print
  223. close(file)
  224. } else if (options ~ /R/) {
  225. file = "ramdisk.txt"
  226. while (getline < file > 0)
  227. print
  228. close(file)
  229. }
  230. file = "ttfs.txt"
  231. while (getline < file > 0)
  232. print
  233. close(file)
  234. }
  235. #
  236. # functions
  237. #
  238. function DoMapFont(str, n, i, v, c, l, s)
  239. {
  240. n = length(str)
  241. l = 0
  242. v = ""
  243. for (i = 1; i <= n; i++) {
  244. c = substr(str, i, 1)
  245. if (c >= "0" && c <= "9") {
  246. v = (v * 10) + (c - "0")
  247. continue
  248. }
  249. if (v) {
  250. if (v in FontMap)
  251. s = FontMap[v] c
  252. else
  253. s = "??" v c
  254. v = ""
  255. } else
  256. s = c
  257. if (l + length(s) >= 78) {
  258. printf("\n+ ")
  259. l = 4
  260. }
  261. printf("%s", s)
  262. l += length(s)
  263. }
  264. if (v) {
  265. if (v in FontMap)
  266. s = FontMap[v]
  267. else
  268. s = "??" v
  269. if (l + length(s) >= 78)
  270. printf("\n+ ")
  271. printf("%s", s)
  272. }
  273. if (l > 0)
  274. print ""
  275. }
  276. function InitFontMap()
  277. {
  278. FontMap[1] = "RESDLL.KyoRes.92"
  279. FontMap[2] = "RESDLL.KyoRes.90"
  280. FontMap[3] = "RESDLL.KyoRes.86"
  281. FontMap[4] = "RESDLL.KyoRes.91"
  282. FontMap[5] = "RESDLL.KyoRes.87"
  283. FontMap[6] = "RESDLL.KyoRes.88"
  284. FontMap[7] = "RESDLL.KyoRes.85"
  285. FontMap[8] = "RESDLL.KyoRes.89"
  286. FontMap[9] = "RESDLL.KyoRes.96"
  287. FontMap[10] = "RESDLL.KyoRes.94"
  288. FontMap[11] = "RESDLL.KyoRes.93"
  289. FontMap[12] = "RESDLL.KyoRes.95"
  290. FontMap[13] = "RESDLL.KyoRes.102"
  291. FontMap[14] = "RESDLL.KyoRes.107"
  292. FontMap[15] = "RESDLL.KyoRes.108"
  293. FontMap[16] = "RESDLL.KyoRes.109"
  294. FontMap[17] = "RESDLL.KyoRes.110"
  295. FontMap[18] = "RESDLL.KyoRes.111"
  296. FontMap[19] = "RESDLL.KyoRes.112"
  297. FontMap[20] = "RESDLL.KyoRes.113"
  298. FontMap[21] = "RESDLL.KyoRes.118"
  299. FontMap[22] = "RESDLL.KyoRes.119"
  300. FontMap[23] = "RESDLL.KyoRes.120"
  301. FontMap[24] = "RESDLL.KyoRes.121"
  302. FontMap[25] = "RESDLL.KyoRes.122"
  303. FontMap[26] = "RESDLL.KyoRes.123"
  304. FontMap[27] = "RESDLL.KyoRes.124"
  305. FontMap[28] = "RESDLL.KyoRes.127"
  306. FontMap[29] = "RESDLL.KyoRes.129"
  307. FontMap[30] = "RESDLL.KyoRes.130"
  308. FontMap[31] = "RESDLL.KyoRes.131"
  309. FontMap[32] = "RESDLL.KyoRes.132"
  310. FontMap[33] = "RESDLL.KyoRes.133"
  311. FontMap[34] = "RESDLL.KyoRes.134"
  312. FontMap[35] = "RESDLL.KyoRes.135"
  313. FontMap[36] = "RESDLL.KyoRes.136"
  314. FontMap[37] = "RESDLL.KyoRes.137"
  315. FontMap[38] = "RESDLL.KyoRes.138"
  316. FontMap[39] = "RESDLL.KyoRes.139"
  317. FontMap[40] = "RESDLL.KyoRes.140"
  318. FontMap[41] = "RESDLL.KyoRes.141"
  319. FontMap[42] = "RESDLL.KyoRes.142"
  320. FontMap[43] = "1" # SWISSR
  321. FontMap[44] = "2" # SWISSI
  322. FontMap[45] = "3" # SWISSB
  323. FontMap[46] = "4" # SWISSJ
  324. FontMap[47] = "RESDLL.KyoRes.143"
  325. FontMap[48] = "RESDLL.KyoRes.144"
  326. FontMap[49] = "RESDLL.KyoRes.145"
  327. FontMap[50] = "RESDLL.KyoRes.146"
  328. FontMap[51] = "RESDLL.KyoRes.147"
  329. FontMap[52] = "RESDLL.KyoRes.126"
  330. FontMap[53] = "5" # SYMSET
  331. FontMap[54] = "RESDLL.KyoRes.114"
  332. FontMap[55] = "RESDLL.KyoRes.115"
  333. FontMap[56] = "RESDLL.KyoRes.116"
  334. FontMap[57] = "RESDLL.KyoRes.117"
  335. FontMap[58] = "RESDLL.KyoRes.103"
  336. FontMap[59] = "RESDLL.KyoRes.104"
  337. FontMap[60] = "RESDLL.KyoRes.105"
  338. FontMap[61] = "RESDLL.KyoRes.106"
  339. FontMap[62] = "RESDLL.KyoRes.125"
  340. FontMap[63] = "RESDLL.KyoRes.47"
  341. FontMap[64] = "RESDLL.KyoRes.48"
  342. FontMap[65] = "RESDLL.KyoRes.49"
  343. FontMap[66] = "RESDLL.KyoRes.50"
  344. FontMap[67] = "RESDLL.KyoRes.55"
  345. FontMap[68] = "RESDLL.KyoRes.56"
  346. FontMap[69] = "RESDLL.KyoRes.57"
  347. FontMap[70] = "RESDLL.KyoRes.58"
  348. FontMap[71] = "RESDLL.KyoRes.64"
  349. FontMap[72] = "RESDLL.KyoRes.65"
  350. FontMap[73] = "RESDLL.KyoRes.66"
  351. FontMap[74] = "RESDLL.KyoRes.67"
  352. FontMap[75] = "RESDLL.KyoRes.1"
  353. FontMap[76] = "RESDLL.KyoRes.2"
  354. FontMap[77] = "RESDLL.KyoRes.3"
  355. FontMap[78] = "RESDLL.KyoRes.4"
  356. FontMap[79] = "RESDLL.KyoRes.5"
  357. FontMap[80] = "RESDLL.KyoRes.6"
  358. FontMap[81] = "RESDLL.KyoRes.7"
  359. FontMap[82] = "RESDLL.KyoRes.8"
  360. FontMap[83] = "RESDLL.KyoRes.9"
  361. FontMap[84] = "RESDLL.KyoRes.10"
  362. FontMap[85] = "RESDLL.KyoRes.11"
  363. FontMap[86] = "RESDLL.KyoRes.12"
  364. FontMap[87] = "RESDLL.KyoRes.13"
  365. FontMap[88] = "RESDLL.KyoRes.14"
  366. FontMap[89] = "RESDLL.KyoRes.15"
  367. FontMap[90] = "RESDLL.KyoRes.16"
  368. FontMap[91] = "RESDLL.KyoRes.17"
  369. FontMap[92] = "RESDLL.KyoRes.18"
  370. FontMap[93] = "RESDLL.KyoRes.19"
  371. FontMap[94] = "RESDLL.KyoRes.20"
  372. FontMap[95] = "RESDLL.KyoRes.21"
  373. FontMap[96] = "RESDLL.KyoRes.22"
  374. FontMap[97] = "RESDLL.KyoRes.23"
  375. FontMap[98] = "RESDLL.KyoRes.24"
  376. FontMap[99] = "RESDLL.KyoRes.25"
  377. FontMap[100] = "RESDLL.KyoRes.26"
  378. FontMap[101] = "RESDLL.KyoRes.27"
  379. FontMap[102] = "RESDLL.KyoRes.28"
  380. FontMap[103] = "RESDLL.KyoRes.29"
  381. FontMap[104] = "RESDLL.KyoRes.30"
  382. FontMap[105] = "RESDLL.KyoRes.31"
  383. FontMap[106] = "RESDLL.KyoRes.32"
  384. FontMap[107] = "RESDLL.KyoRes.33"
  385. FontMap[108] = "RESDLL.KyoRes.34"
  386. FontMap[109] = "RESDLL.KyoRes.35"
  387. FontMap[110] = "RESDLL.KyoRes.36"
  388. FontMap[111] = "RESDLL.KyoRes.37"
  389. FontMap[112] = "RESDLL.KyoRes.38"
  390. FontMap[113] = "RESDLL.KyoRes.39"
  391. FontMap[114] = "RESDLL.KyoRes.40"
  392. FontMap[115] = "RESDLL.KyoRes.41"
  393. FontMap[116] = "RESDLL.KyoRes.42"
  394. FontMap[117] = "RESDLL.KyoRes.43"
  395. FontMap[118] = "RESDLL.KyoRes.44"
  396. FontMap[119] = "RESDLL.KyoRes.45"
  397. FontMap[120] = "RESDLL.KyoRes.46"
  398. FontMap[121] = "21" # DFMINCH
  399. FontMap[122] = "22" # DFMINCHB
  400. FontMap[123] = "23" # DFMINCHI
  401. FontMap[124] = "24" # DFMINCHZ
  402. FontMap[125] = "25" # DFMINCV
  403. FontMap[126] = "26" # DFMINCVB
  404. FontMap[127] = "27" # DFMINCVI
  405. FontMap[128] = "28" # DFMINCVZ
  406. FontMap[129] = "29" # DFGOTH
  407. FontMap[130] = "30" # DFGOTHB
  408. FontMap[131] = "31" # DFGOTHI
  409. FontMap[132] = "32" # DFGOTHZ
  410. FontMap[133] = "33" # DFGOTV
  411. FontMap[134] = "34" # DFGOTVB
  412. FontMap[135] = "35" # DFGOTVI
  413. FontMap[136] = "36" # DFGOTVZ
  414. FontMap[137] = "37" # MSMINCH
  415. FontMap[138] = "38" # MSMINCHB
  416. FontMap[139] = "39" # MSMINCHI
  417. FontMap[140] = "40" # MSMINCHZ
  418. FontMap[141] = "41" # MSMINCV
  419. FontMap[142] = "42" # MSMINCVB
  420. FontMap[143] = "43" # MSMINCVI
  421. FontMap[144] = "44" # MSMINCVZ
  422. FontMap[145] = "45" # MSGOTH
  423. FontMap[146] = "46" # MSGOTHB
  424. FontMap[147] = "47" # MSGOTHI
  425. FontMap[148] = "48" # MSGOTHZ
  426. FontMap[149] = "49" # MSGOTV
  427. FontMap[150] = "50" # MSGOTVB
  428. FontMap[151] = "51" # MSGOTVI
  429. FontMap[152] = "52" # MSGOTVZ
  430. }
  431. function InitDocOrder()
  432. {
  433. DocOrder["CmdStartDoc"] = 1
  434. DocOrder["Resolution"] = 5
  435. DocOrder["PrintQuality"] = 10
  436. DocOrder["Orientation"] = 11
  437. DocOrder["Duplex"] = 12
  438. DocOrder["InputBin"] = 14
  439. DocOrder["OutputBin"] = 15
  440. DocOrder["PaperSize"] = 16
  441. }