home *** CD-ROM | disk | FTP | other *** search
/ ftp.robelle3000.ai 2014 / 2014.06.ftp.robelle3000.ai.tar / ftp.robelle3000.ai / papers / qxport.pro < prev    next >
Text File  |  1994-05-03  |  50KB  |  1,457 lines

  1. .select(1:49)
  2. .comment    File:     QXPORT
  3. .comment
  4. .comment    Purpose:  Porting Qedit from MPE to HP-UX Paper
  5. .comment
  6. .comment  To print this document, do the following:
  7. .comment
  8. .comment    :run printdoc.pub.robelle;info="QXPORT"
  9. .comment
  10. .com {ifout starts here}
  11. .comment  Choose the output device parameters for this document
  12. .if outfinal
  13. .  if outrecord
  14. .    out(las 30 c1 r+ s7).com Robelle bound version, attached
  15. .  else
  16. .    out(las 30 c1 r- s7).com Robelle bound version
  17. .  endif
  18. .elseif outhelpcomp
  19. .  out(lpt q+ w80).com helpcomp;parm=1
  20. .elseif outa4
  21. .  if outlpt
  22. .    if outrecord
  23. .      out(lpt s7 r+).com A4 paper, $Stdlist/LP/disc, attached
  24. .    else
  25. .      out(lpt s7 r-).com A4 paper, $Stdlist/LP/disc
  26. .    endif
  27. .  elseif outlaser
  28. .    if outrecord
  29. .      if outdouble
  30. .        out(las 30 s8 r+ d+).com A4 paper, LaserJet, attached, duplex
  31. .      else
  32. .        out(las 30 s8 r+).com A4 paper, LaserJet, attached
  33. .      endif
  34. .    else
  35. .      if outdouble
  36. .        out(las 30 s8 r- d+).com A4 paper, LaserJet, duplex
  37. .      else
  38. .        out(las 30 s8 r-).com A4 paper, LaserJet
  39. .      endif
  40. .    endif
  41. .  else.com No other outxxx jcws specified
  42. .    out(lpt s7 r-).com generic: A4 paper, $Stdlist/LP/disc
  43. .  endif
  44. .elseif outtext
  45. .  if outrecord
  46. .    out(lpt s2 u- r+)
  47. .  else
  48. .    out(lpt s2 u-)
  49. .  endif
  50. .else
  51. .  if outlpt
  52. .    if outrecord
  53. .      out(lpt s3 r+).com Letter, $Stdlist/LP/disc, attached
  54. .    else
  55. .      out(lpt s3 r-).com Letter, $Stdlist/LP/disc
  56. .    endif
  57. .  elseif outlaser
  58. .    if outrecord
  59. .      if outdouble
  60. .        out(las 30 s7 r+ d+).com Letter, LaserJet, attached, duplex
  61. .      else
  62. .        out(las 30 s7 r+).com Letter, LaserJet, attached
  63. .      endif
  64. .    else
  65. .      if outdouble
  66. .        out(las 30 s7 r- d+).com Letter, LaserJet, duplex
  67. .      else
  68. .        out(las 30 s7 r-).com Letter, LaserJet
  69. .      endif
  70. .    endif
  71. .  else.com No outxxx jcws specified
  72. .    out(lpt s3 r-).com Letter, generic: $Stdlist/LP/disc
  73. .  endif
  74. .endif
  75. .comment
  76. .comment  Choose the fonts for this document
  77. .if outfinal
  78. .  include final.qlibdata.green
  79. .else
  80. .  include f92286f.qlibdata.robelle
  81. .endif
  82. .comment
  83. .comment  Choose the margins for this document
  84. .comment
  85. .if outhelpcomp
  86. .  mar(r78)
  87. .elseif outa4
  88. .  mar(r62)
  89. .else
  90. .  mar(r65)
  91. .endif
  92. .comment
  93. .comment  Choose the forms for this document
  94. .comment
  95. .comment  Form 1 is for the body of the manual
  96. .comment  Form 2 is for unnumbered pages (end of section)
  97. .comment  Form 3 is for the table of contents (roman numerals)
  98. .comment
  99. .if outtext
  100. .   form(k1 [L8000] )
  101. .   form(k2 [L8000] )
  102. .   form(k3 [L8000] )
  103. .elseif outa4
  104. .   form(k1 [ T #23 S:40 // l58 / #33 "-" pn:1 "-" /]
  105. +           [ S #23 T:40 // l58 / #33 "-" pn:1 "-" /])
  106. .   form(k2 [ // l58 / #33 pr:3 /]).com Roman numerals
  107. .   form(k3 [ // l57 // ])
  108. .else
  109. .   form(k1 [ T #26 S:40 // l55 / #33 "-" pn:1 "-" /]
  110. +           [ S #26 T:40 // l55 / #33 "-" pn:1 "-" /])
  111. .   form(k2 [ // l55 / #33 pr:3 /]).com Roman numerals
  112. .   form(k3 [ // l54 // ])
  113. .endif
  114. .comment
  115. .comment  Option settings:
  116. .comment
  117. .comment   For text output we want a ragged right edge.
  118. .comment
  119. .if outtext
  120. .   opt(j4 p+ b+ r-)
  121. .else
  122. .   opt(j4 p+ b+).com     Okay to insert four blanks between words
  123. .comment                  when justifying, two spaces after period,
  124. .comment                  suppress blank lines at top of page
  125. .endif
  126. .comment
  127. .comment  Other formatting parameters:
  128. .par(f` p5 s1 u3)      .com  Automatic .skip 1.page 5.undent 3
  129. .inp(u~ b@ h\ e& t# f|).com   Underline,Blank,Hyphen,Escape,Tab,Font
  130. .page.count 1          .com  Start page numbering over again.
  131. .form 3
  132.  
  133. .jump 7
  134. .opt(l- r- f-)
  135. `|3Porting Qedit from MPE to HP-UX|
  136.  
  137. |1By David J.@Greer|
  138.  
  139.  
  140. `|1Abstract|
  141. .opt
  142.  
  143. Robelle recently ported its Qedit full-screen editor from the MPE
  144. environment to the HP-UX environment. David Greer, manager of
  145. software R&&D at Robelle, headed up the team doing the migration.
  146. This paper describes the problems they faced and the resulting
  147. solutions. Qedit is written in SPL and was ported to HP-UX using
  148. the SPLash! compiler from SRN. The paper covers both the gory
  149. details of how Robelle does cross-\development using SPLash! and
  150. the theoretical problem of how to make UNIX look like MPE. Most
  151. of the Qedit source code is identical for the two systems, but
  152. the MPE file system differs radically and is more complex than
  153. the UNIX file system.
  154.  
  155. .skip 14
  156. .opt(l- r- f-)
  157. .font 1
  158. Robelle Consulting Ltd.
  159. Unit 201, 15399-102A Ave.
  160. Surrey, B.C. Canada V3R 7K1
  161. Phone:  (604) 582-1700
  162. Fax:  (604) 582-1799
  163.  
  164. Email:  david_greer&@robelle.com
  165. .font 0
  166.  
  167.  
  168. Copyright Robelle Consulting Ltd. 1994
  169.  
  170.  
  171. Permission is granted to reprint this document (but ~not~
  172. for profit), provided that copyright notice is given.
  173.  
  174.  
  175. .opt.com Stop centering
  176. .com                         The next FORM is for Contents/Preface:
  177. .form 1
  178. .contents(i+3)
  179. .page.count 1
  180. .jump 1
  181. .opt(l- r- f-)
  182. `|3Porting Qedit from MPE to HP-UX|
  183.  
  184. |1By David J.@Greer|
  185.  
  186.  
  187. `|3Introduction|
  188. .ent `Introduction
  189. .opt
  190. .tit Porting Qedit to HP-UX
  191. .sub Introduction
  192.  
  193.  
  194. Our Qedit full-screen text editor was first written in 1977 and
  195. has been continually enhanced since then. We recently ported
  196. Qedit from MPE to HP-UX.
  197. This paper discusses our research strategy and the
  198. technical details of how we actually managed to port approximately
  199. 100,000 lines of code that had been written over the last fifteen
  200. years.
  201.  
  202. `|1Original UNIX Goals|
  203. .ent Original UNIX Goals
  204.  
  205. For a few years, our customers (especially in Europe) had
  206. started doing development on UNIX machines.  We didn't
  207. know anything about UNIX, but we decided that we had
  208. better start learning.
  209. Our goal was to learn as much as we could about UNIX by seeing how
  210. much of our source code and programs we could convert to
  211. HP's version of UNIX:  HP-UX.
  212.  
  213. `|1Why HP-UX|
  214. .ent Why HP-UX
  215.  
  216. We decided on HP-UX for a couple of reasons:
  217. .mar(l+3).par(u3)
  218. `1.#+1It was made by HP, so it was likely to be more familiar to
  219. us than another vendor's UNIX (and at least the Response Center telephone
  220. number would be the same).  Time and again, this proved to be true and
  221. greatly helped our development effort.
  222. `2.#+1Qedit is written almost entirely in SPL/SPLash!.
  223. Because of our compiler technology, we wanted to focus on
  224. the HPPA RISC architecture.
  225. For this reason, we restricted our research to HP's 700 and 800
  226. series of computers (they have HPPA RISC CPUs).
  227. `3.#+1We did
  228. not want to rewrite all of the source code into C
  229. (the usual language of choice for UNIX programs).
  230. We felt that rewriting Qedit into C would be too large an R&&D project
  231. for Robelle. Automated tools for doing the conversion were reported to be
  232. ineffective.
  233. .mar.par
  234.  
  235. `|1Major R&&D Phases|
  236. .ent Major R&&D Phases
  237.  
  238. Our HP-UX research was done in different phases.  We
  239. had a short-term goal for each phase and worked towards completing
  240. this goal in a reasonable time frame.  The major phases were as follows:
  241. .mar(l+3).par(u3)
  242. `1.#+1|1Basic Research|.  In this phase we borrowed an HP-UX machine
  243. and investigated HP-UX object-code and run-time libraries.
  244. `2.#+1|1MPE and Robelle Libraries|.  Robelle's software
  245. development is based
  246. on a concept of layers that build on each other.  This phase
  247. involved getting our own machine, writing necessary MPE replacement
  248. routines, and porting our fundamental
  249. subroutine libraries.
  250. `3.#+1|1Rebuild Qedit|.  Once the basic libraries were running we
  251. needed to look at Qedit.  In this phase, we reengineered Qedit so that
  252. it has little knowledge about which computer platform it is
  253. running on.
  254. `4.#+1|1Polish and Release Qedit/UX|.  After the first version of
  255. Qedit was working on HP-UX, we needed to do a series of
  256. enhancements to make Qedit work in a more UNIX-like manner.  We
  257. also needed to complete all the details that turn an R&&D project
  258. into a product.
  259. .mar.par
  260.  
  261. `|1Personnel|
  262. .ent Personnel
  263.  
  264. Three people worked on porting Qedit to HP-UX.
  265. .if outtext
  266. .   mar(l+17).par(u17)
  267. .else
  268. .   mar(l+11).par(u11).page 8
  269. .endif
  270. `|1Dave Lo|#+1Dave was the general programmer's helper.  He was
  271. assigned specific research tasks (e.g., how to get the value
  272. of an environment variable in SPLash!).
  273. `|1Robert Green|#+1Bob is the original author and chief architect
  274. of Qedit.  His main job was to keep Dave's and David's spirits up and
  275. to reengineer Qedit so that it didn't depend on MPE any more.
  276. `|1David Greer|#+1I was the overall project leader.  I ported most of
  277. our subroutine libraries, learned everything I could about
  278. programming interfaces to HP-UX, and implemented all of the
  279. Qedit/UX operating system interface.
  280. .mar.par
  281.  
  282. `|1Development Diaries|
  283. .ent Development Diaries
  284.  
  285. At Robelle, we keep a diary with summaries of each day's
  286. development effort.  We kept a development diary for HP-UX -- much
  287. of the material in this paper is drawn from it.  It takes work to
  288. keep these diaries up-to-date, but they pay off in the long-term
  289. by saving useful information.
  290.  
  291. `|1Time and Effort|
  292. .ent Time and Effort
  293.  
  294. From first inception to delivering a production product took about
  295. 20 months.
  296. The work effort is estimated as 19 person-months.
  297. We feel that this is incredibly fast for the amount of
  298. work that needed to be done.  We could never have achieved this
  299. if we had rewritten all of our software into a new language as well
  300. as for a new operating system.
  301.  
  302. We estimate that a complete rewrite of Qedit into C would have taken
  303. at least twice the time (four years) and three times the
  304. work effort (at least 60 person-months).  A rewrite goes against
  305. our long-held belief in doing things in small incremental steps,
  306. rather than striking out for the big win.
  307.  
  308. Another disadvantage of rewriting Qedit into C was that we likely
  309. could not have used the C version on Classic 3000s, due to
  310. poor C compiler support on the Classic 3000.  However, we always try to
  311. make available as many Qedit enhancements as possible to all of our
  312. HP 3000 customers.  This is one reason why we have
  313. one set of source code for all versions of Qedit.
  314. .sub Software Development
  315. .page.jump 1
  316. .opt(l- r- f-)
  317. `|3Software Development At Robelle|
  318. .ent `Software Development At Robelle
  319. .opt
  320.  
  321.  
  322. To understand how we ported Qedit from MPE to HP-UX, it is
  323. important to understand how we develop software at Robelle. Most
  324. of our development, including Qedit, is done in SPL and SPLash!.
  325. SPL was the original Systems Programming Language for the HP 3000.
  326. The SPL compiler only produces object-code for Classic HP 3000s
  327. (you can also run this code in compatibility-mode on MPE/iX machines).
  328.  
  329. SPLash! is a compiler from Software Research Northwest
  330. (206-463-3030) that translates SPL source code into
  331. HPPA RISC object-code.  We use SPLash! on MPE/iX to produce the native-mode
  332. version of Qedit.  There is no SPLash! compiler for HP-UX.
  333.  
  334. SPL has no run-time library (which is similar to how the
  335. C language works).
  336. In Pascal, you would write something to the screen as shown below:
  337.  
  338. .font 5.page 4
  339.      writeln('Hello, World!');
  340. .font 0
  341.  
  342. In SPL, there is no language construct that will print a string
  343. on your screen.  Instead, you move the string to a buffer and then
  344. call a library routine to print the string:
  345.  
  346. .font 5.page 4
  347.      move outbuf := "Hello, World!";
  348.  
  349.      print(outbuf,-13,0);      ! print is a library routine
  350. .font 0
  351.  
  352. The print routine displays the thirteen characters on the screen.
  353. Print is a library routine that comes with MPE.
  354.  
  355. `|1Subroutine Libraries|
  356. .ent Subroutine Libraries
  357.  
  358. Because SPL does not rely on a language-specific run-time library,
  359. we thought it might be possible to port the SPLash! object-code
  360. to HP-UX running on the HPPA RISC architecture.
  361. The only thing left would be to replace all of the
  362. subroutine libraries on which Qedit depends.  Since Qedit depends on
  363. hundreds of routines, that was still a lot of
  364. potential work.
  365.  
  366. Qedit is built upon a series of subroutine libraries.  Each set of
  367. libraries depends on other sets of libraries.  The libraries look
  368. something like this:
  369.  
  370.  
  371. .opt(l- r- f-)
  372. .page 15.box(c+28 w10 r-0+ h2)
  373. Qedit
  374.  
  375. .box(c+23 w20 r-0+ h2)
  376. Qedit Library
  377.  
  378. .box(c+18 w30 r-0+ h2)
  379. Calculator, Qhelp, and Other Libraries
  380.  
  381. .box(c+13 w40 r-0+ h2)
  382. Low-level Robelle Library
  383.  
  384. .box(c+8 w50 r-0+ h2)
  385. MPE and Compiler Libraries
  386.  
  387.  
  388. |2View of Robelle Libraries|
  389. .opt
  390.  
  391. While these libraries build on each other, libraries at the upper
  392. levels can call libraries at any lower level.  For example, Qedit
  393. makes many calls directly to the MPE library (e.g., readx, print,
  394. fopen, fread, ...).  Similarly, the calculator makes calls to
  395. both the Robelle low-level library and the MPE library.
  396.  
  397. `|1Development Summary|
  398. .ent Development Summary
  399.  
  400. Because we use SPL and SPLash!, we
  401. needed to develop ideas that would let us port object-code to HP-UX.
  402. In order to port Qedit from MPE to HP-UX, we would first need to
  403. port many of our own libraries and investigate how many MPE library
  404. routines were available on HP-UX.
  405. .sub Basic Research
  406. .page.jump 1
  407. .opt(l- r- f-)
  408. `|3Phase One:  Basic Research|
  409. .ent `Phase One:  Basic Research
  410. .opt
  411.  
  412.  
  413. We wanted to start our research by doing two things:
  414. .mar(l+3).par(u3)
  415. `1.#+1Learn more about HP-UX (e.g., how to log on!)
  416. `2.#+1Prove whether or not the object-code formats on MPE
  417. and HP-UX were the same.
  418. .mar.par
  419.  
  420. `|1Get A Machine|
  421. .ent Get A Machine
  422.  
  423. You can't make an omelet without breaking eggs, and it's hard to
  424. learn about HP-UX without having access to a machine.  Because
  425. we had no idea how successful our initial research would be, we
  426. didn't want to purchase one.
  427.  
  428. We asked HP if we could rent an HP-UX machine for a week, but HP
  429. doesn't have short-term rentals. Since we've had good relations
  430. with HP/Canada, they arranged for us to have one of their demo
  431. machines for a month. It's a good thing we had the machine that length of
  432. time, because it took us about three weeks to get it up and
  433. running.
  434.  
  435. We could tell HP-UX was made by HP.  When we first brought the
  436. machine up, one of the first things it did was ask us if our
  437. console was a 2392 or a 700/92.  We can't imagine any non-HP machine
  438. asking this question.
  439.  
  440. `|1Networking|
  441. .ent Networking
  442.  
  443. We learned a lot by just installing the borrowed HP-UX machine and
  444. getting it connected to our network.  On our HP 3000 machines, we
  445. had HP's NS software and used Thinlan to connect all of our
  446. machines together.  We lost a lot of time because the demo HP-UX
  447. machine had a jumper switch on the network interface card turned
  448. off.  It took us two weeks to figure out that it was a hardware
  449. problem and not a configuration problem.
  450.  
  451. By default, HP-UX is
  452. not able to communicate with MPE machines.
  453. On MPE, we are used to having front-end software that handles
  454. configuration (NMMGR being the one for configuring network software
  455. in MPE).  In UNIX, it's common for configuration to be done by
  456. changing scripts (although some common configuration tasks can be
  457. done with HP's SAM tool).
  458. Scripts are similar to MPE/iX command files.
  459. One of the files that is used to
  460. configure networking is called |5/etc/netlinkrc|.  By default, it
  461. contains a line like this:
  462.  
  463. .font 5.page 4
  464.      /etc/lanconfig lan0 ether
  465. .font 0
  466.  
  467. For HP-UX to communicate with MPE machines in the Thinlan/NS
  468. environment, this line needs to be:
  469.  
  470. .font 5.page 4
  471.      /etc/lanconfig lan0 ether ieee
  472. .font 0
  473.  
  474. Notice the addition of "ieee" to the end of the line.  We also needed
  475. to the following:
  476. .mar(l+3).par(u3)
  477. `1.#+1Fill in the DOMAIN and ORGANIZATION in |5/etc/netlinkrc|.
  478. `2.#+1Add machine names and IP addresses to |5/etc/hosts|.
  479. `3.#+1Reboot our machine for these changes to take effect.
  480. .mar.par
  481.  
  482. Since our machine had the NS software for HP-UX, we could now use
  483. vt3k to log on to our MPE machines from HP-UX (vt3k provides
  484. virtual terminal access from HP-UX to MPE). After using NMMGR to
  485. add our new HP-UX machine to our MPE configuration, we could also
  486. use dscopy to copy files from MPE to HP-UX and vice versa.
  487.  
  488. `|1Object-Code Format|
  489. .ent Object-Code Format
  490.  
  491. Our next major goal was to test our theory that object-code files
  492. were the same on MPE/iX and HP-UX. To show this was the case we
  493. planned to compile a SPLash! program on MPE, copy the object-code
  494. to HP-UX, link the object-code, and run the resulting program.
  495.  
  496. One of the first programs we tried was written by Randy Medd of
  497. Telamon (510-987-7700). This program calls the HP-UX routines
  498. puts (which writes a string to stdlist) and exit (which
  499. terminates the program). It looked like this:
  500.  
  501. .font 5.page 5
  502.      $native, nocc, unix
  503.      begin
  504.  
  505.      equate line'feed = 10;
  506.  
  507.      byte array buf(0:14);
  508.  
  509.      double procedure puts(buf);
  510.         virtual byte array buf;
  511.         option native, nocc, external;
  512.  
  513.      procedure exit(int);
  514.         value   int;
  515.         double  int;
  516.         option native, nocc, external;
  517.  
  518.      move buf :=  ("Hello, World!",line'feed,0);
  519.  
  520.      puts(buf);
  521.      exit(0);
  522.  
  523.      end.
  524. .font 0
  525.  
  526. `|1Compiling and Linking|
  527. .ent Compiling and Linking
  528.  
  529. We compiled the above program using SPLash! and copied the
  530. resulting object-code to HP-UX with these commands:
  531.  
  532. .font 5.page 5
  533.       :splash testsrc,testobj
  534.       :dscopy testobj to /users/david/test.o:daffy[david:pass]
  535. .font 0
  536.  
  537. The next part took about a week
  538. of work to figure out:  the exact link command to use
  539. in HP-UX in order to have our SPLash! program run.  The
  540. HP-UX command for linking is called |1ld|.  To link our example
  541. program, we used this ld command:
  542.  
  543. .font 5.page 5
  544.      ld /lib/crt0.o test.o /lib/libc.a
  545. .font 0
  546.  
  547. This linked the three files |5/lib/crt0.o|, |5test.o|, and
  548. |5/lib/libc.a|. The first file is /lib/crt zero dot oh (don't mix up
  549. the zero and the oh), which
  550. is the C run-time startup library.
  551. The test.o file is our SPLash!
  552. object-code that we generated on MPE. The /lib/libc.a file is one
  553. of the HP-UX run-time libraries.
  554. Like most HP-UX command names and commands, everything must be
  555. in lower case.
  556. The general form of the ld
  557. command is:
  558.  
  559. .font 5.page 5
  560.      ld /lib/crt0.o objfiles...@/lib/libc.a
  561.         ^                       ^ C library
  562.         C run-time startup
  563. .font 0
  564.  
  565. `|1Running Our Program|
  566. .ent Running Our Program
  567.  
  568. By default,
  569. the ld command creates a program file called |a.out|.
  570. To run this program, we only had to type its name (like
  571. using implied run on MPE/iX).
  572. We tried
  573. running the resulting program and got:
  574.  
  575. .font 5.page 4
  576.      a.out             |0{run our sample program}|
  577.      Hello, World!     |0{result of running a.out}|
  578. .font 0
  579.  
  580. This was exactly what we expected.
  581. The buffer that we initialized with "Hello, World!" was printed out
  582. on stdlist and the program stopped.
  583. We had now answered one of our most
  584. basic questions -- we could compile programs on MPE, copy the
  585. object-code to HP-UX, link the object-code into a program and run
  586. it on HP-UX.
  587.  
  588. `|1Run-Time Libraries|
  589. .ent Run-Time Libraries
  590.  
  591. Once our basic research question was answered, it was time to
  592. start exploring more of HP-UX.  We had no idea how many of the MPE
  593. routines that we needed were available on HP-UX.  We used two
  594. HP-UX tools to search for routines:  man and nm.
  595.  
  596. `|1Man Pages|
  597. .ent Man Pages
  598.  
  599. The |1man| pages are similar to MPE's on-line help.
  600. For example, if you want to see if there is a description of
  601. a routine called binary, you do the following:
  602.  
  603. .font 5.page 4
  604.      man binary
  605. .font 0
  606.  
  607. Once done, you will see this:
  608.  
  609. .font 5.page 4
  610.      No manual entry for binary.
  611. .font 0
  612.  
  613. Another way to search the man pages is to have the man utility
  614. search a keyword index from all the man pages for a string (see below
  615. for how to create the man page index file):
  616.  
  617. .font 5.page 4
  618.      man -k binary                |0{-k requests a keyword search}|
  619.      .
  620.      .                            |0{many entries printed}|
  621.      .
  622. .font 0
  623.  
  624. There were many routines with a description that included
  625. the word "binary", but none were similar to the MPE binary routine.
  626. The man page index is in the file |5/usr/lib/whatis|.  You can
  627. rebuild this file by doing:
  628.  
  629. .font 5.page 5
  630.      catman -w
  631. .font 0
  632.  
  633. You must be logged on as super user to run catman.  It takes catman
  634. a long time to create the index, so we suggest that you run it in the
  635. background or in a batch job.
  636.  
  637. `|1Searching Object-Code|
  638. .ent Searching Object-Code
  639.  
  640. Just because a routine is not documented doesn't mean that it
  641. does not exist.  Many MPE compiler-library routines are available
  642. in HP-UX, but not documented.  The tool to use for finding symbolic
  643. names in object-code is |1nm|.  The nm utility is similar to
  644. the MPE/iX Linkedit Listobj command.
  645. The nm output is similar enough to the Linkedit listobj output
  646. to make MPE users feel at home (another advantage of using HP-UX).
  647. We combined nm with two
  648. other HP-UX tools to search entire directories of files.  For
  649. example, to search the directory |5/usr/lib/| for any files with
  650. a symbolic entry for |5binary| we did the following:
  651.  
  652. .font 5.page 4
  653.      cd /usr/lib
  654.      nm -r /usr/lib/* &| grep binary &| more
  655. .font 0
  656.  
  657. If you do this on HP-UX, you get a large number of error messages
  658. (not everything in /usr/lib is an object-code file) and the
  659. following line is found:
  660.  
  661. .font 5.page 4.mar(r+5)
  662.      libnsfmt.a:binary   &|1073789772&|extern&|data   &|$SHORTDATA$
  663. .font 0.mar
  664.  
  665. Unfortunately, this is "data". What we needed was "code" or "entry".
  666. Libraries on HP-UX are also stored in the directory /lib, so we
  667. checked those libraries too:
  668.  
  669. .font 5.page 4
  670.      cd /lib
  671.      nm -r * &| grep binary &| more
  672. .font 0
  673.  
  674. We did this search and still did not find any routine called binary.
  675. So it appears that there is no binary routine for HP-UX. Since this
  676. routine is used everywhere in our tools, we ended up writing our
  677. own "binary" routine in C (note that the HP-UX routine |5atoi| is
  678. not the same).
  679.  
  680. `|1Floating-Point Numbers|
  681. .ent Floating-Point Numbers
  682.  
  683. In MPE, we use the compiler-library routines |5hpinext| and |5hpextin|
  684. to convert floating-point numbers from human-readable form to the
  685. internal IEEE format and vice versa.  These routines have many options
  686. and handle different sizes of floating-point numbers.  Rewriting these
  687. routines would be a lot of work.
  688.  
  689. Qedit does not use floating-point numbers very often, except in the
  690. calculator.  In order to implement the calculator, we would need the
  691. functionality of the hpinext and hpextin routines.
  692. A search of the man pages revealed no documentation for either
  693. routine, although there were other routines to handle floating-point
  694. conversions.  All of our code assumes that hpinext and
  695. hpextin are available.  So we searched for these routines using nm:
  696.  
  697. .font 5.page 4
  698.      cd /usr/lib
  699.      nm -r * &| grep hpinext &| more
  700. .font 0
  701.  
  702. The result of this search was as follows:
  703.  
  704. .font 5.page 4
  705.      libcl.a:hpinext     &|     13836&|extern&|entry  &|$CODE$
  706.      libcl.sl:hpinext    &|    421568&|extern&|code   &|$CODE$
  707.      libcl.sl:hpinext    &|    421524&|extern&|entry  &|
  708.      libf.a:hpinext      &|     13836&|extern&|entry  &|$CODE$
  709.      libf.sl:hpinext     &|    421568&|extern&|code   &|$CODE$
  710.      libf.sl:hpinext     &|    421524&|extern&|entry  &|
  711. .font 0
  712.  
  713. Success!  We had found the hpinext routine.
  714. We also found the hpextin routine in the same libraries (using
  715. the same technique).
  716. These routines were located in either the |5libcl.a| or |5libf.a|
  717. library.  Once we started converting the calculator to work
  718. on HP-UX, we had to change our ld command to include one of
  719. these libraries:
  720.  
  721. .font 5.page 5
  722.      ld /lib/crt0.o test.o /usr/lib/libcl.a /lib/libc.a
  723.                             ^
  724.                             New run-time library
  725. .font 0
  726.  
  727. This was one example of how familiar HP-UX is to MPE programmers.
  728. It is highly unlikely that any other version of UNIX has the
  729. hpinext or the hpextin routines.  Even if they did, they are unlikely
  730. to have the same parameters and work the same way as the HP version.
  731.  
  732. `|1Phase One Summary|
  733. .ent Phase One Summary
  734.  
  735. We succeeded in our basic research goals. We obtained access to
  736. an HP-UX machine (due to the kind loan from HP) and we proved
  737. that SPLash! code compiled on MPE could be linked and executed on
  738. HP-UX. The time that elapsed for this phase was about three months
  739. (February to April). The work time:
  740.  
  741. .mar(l+11).par(u10).page 8
  742. `Dave Lo#+1One person-month.
  743. `Bob Green#+1Half person-month.
  744. `David Greer#+1One person-month.
  745. .mar.par
  746. .sub MPE and Robelle Libraries
  747. .page.jump 1
  748. .opt(l- r- f-)
  749. `|3Phase Two:  MPE and Robelle Libraries|
  750. .ent `Phase Two:  MPE and Robelle Libraries
  751. .opt
  752.  
  753.  
  754. The goals for phase two were:
  755. .mar(l+3).par(u3)
  756. `1.#+1Obtain our own HP-UX machine.
  757. `2.#+1Learn more about HP-UX.
  758. `3.#+1Implement the necessary MPE routines on which we rely.
  759. `4.#+1Start porting the Robelle library to HP-UX.
  760. .mar.par
  761.  
  762. `|1Obtaining an HP-UX Machine|
  763. .ent Obtaining an HP-UX Machine
  764.  
  765. After we had returned our demo machine to HP, we started work to
  766. obtain our own HP-UX machine.
  767. We did some investigation and decided to rent a Series 705
  768. workstation from HP, complete with the necessary networking (NS)
  769. and development (C) tools (don't attempt C development with the
  770. "free" C compiler that comes with HP-UX).
  771. Since Bob and I work at home most of
  772. the time, we really planned on using the workstation as a server.
  773. Because HP-UX is a multi-user operating system, we decided that
  774. it would work just fine as a development server.  Even today,
  775. our Series 705 is used as a workstation by one user in the office
  776. and as our primary development machine by those of us doing
  777. HP-UX program development.
  778.  
  779. `|1Implementing MPE Routines on HP-UX|
  780. .ent Implementing MPE Routines on HP-UX
  781.  
  782. In phase one, we had already started implementing some common
  783. MPE routines (binary, dbinary, ascii, and dascii were now done).
  784. We continued with other routines such as print, readx, ccode,
  785. and hpsetccode.
  786. Once these routines were completed we could start
  787. porting our most fundamental library source modules.
  788.  
  789. `|1Porting the Robelle Libraries|
  790. .ent Porting the Robelle Libraries
  791.  
  792. With a basic set of MPE
  793. routines now available, several of our source modules started working
  794. on HP-UX.
  795. However, we would often try to port a new Robelle library only to find that
  796. we needed to implement additional MPE routines.  So the process
  797. went back-and-forth between porting Robelle source modules and
  798. writing new MPE replacement routines.
  799. In total, we implemented about twenty different MPE routines.
  800.  
  801. `|1MPE File System Routines|
  802. .ent MPE File System Routines
  803.  
  804. Things went well, until we had to port our first source module
  805. that needed to access files.  Using sample code written by Stan Sieler
  806. of Allegro Consultants, Inc. (415-369-2303), we investigated
  807. how difficult it would be to implement the MPE fopen, fread, fwrite,
  808. and fclose routines.
  809.  
  810. The HP-UX file system is simple compared to the MPE file system.
  811. Files are collections of bytes.  There is no implied structure to
  812. any file (although you may deduce the structure by examining the
  813. filename extension or by looking at some of the data in the file).
  814. In MPE, we have fixed-length, variable-length, ascii versus
  815. binary, record-length, blocking-\factor, and many other file attributes.
  816.  
  817. Our software depends on a number of assertions that are provided by
  818. MPE's file system routines.  For example, if you open a new file
  819. with a filecode of 111 and a record size of 256 words, write some
  820. records to it, close it, open the file again, then ask about its
  821. structure, you expect to get a filecode of 111 and a record size
  822. of 256 words.  In HP-UX, there is no place to store this
  823. information (without using an auxiliary file).
  824.  
  825. It was at this point that we made a pivotal decision about how we
  826. would port our software.  We would not emulate the MPE file system
  827. routines.  Instead, we would reengineer our products to invoke an
  828. interface layer that would provide file system functionality.  We
  829. would isolate the interface layer for each module that needed file
  830. system access into a separate source file (in object-oriented
  831. terminology this is called encapsulation).
  832.  
  833. `|1Recognizing Qedit Files|
  834. .ent Recognizing Qedit Files
  835.  
  836. On MPE, Qedit files are easily recognized as those with a filecode
  837. of 111 and a record length of 256 words.  But how were we going to
  838. recognize Qedit files on HP-UX?  HP-UX doesn't have filecodes or
  839. record lengths.  Bob and I designed a routine that would examine
  840. the first 1024 bytes of an HP-UX file.  By looking at various
  841. relationships in this file, we hoped that we could determine if the
  842. file was a Qedit file or not.
  843.  
  844. We managed to implement such a routine.  To test its effectiveness,
  845. we used dscopy to copy one Qedit file from MPE to HP-UX.  We wrote
  846. a test program that opened every file on our Series 705 workstation
  847. and checked to see if it was a Qedit file.  Our first
  848. implementations found many HP-UX files that the routine thought were Qedit
  849. files when they were not.  But our final implementation found the
  850. one and only Qedit file that we had copied from MPE.
  851.  
  852. `|1Porting Qhelp to HP-UX|
  853. .ent Porting Qhelp to HP-UX
  854.  
  855. Qhelp is the software that provides all of Robelle's on-line help
  856. facilities. Qhelp was nicely isolated into one source module. It
  857. uses a Qedit file to store all of the help text and the help
  858. keywords. We decided that Qhelp would be our first HP-UX module
  859. to use an interface layer to provide file system access on both
  860. MPE and HP-UX.
  861.  
  862. `|1File System Layer|
  863. .ent File System Layer
  864.  
  865. The MPE version of Qhelp invoked the MPE file system directly.  It
  866. looked basically like this:
  867.  
  868.  
  869. .opt(l- r- f-).page 10
  870. .box(c+23 w20 r-0+ h2)
  871. Qhelp
  872.  
  873. .box(c+18 w30 r-0+ h2)
  874. MPE File System Library
  875.  
  876.  
  877. |2Original Qhelp|
  878. .opt
  879.  
  880. We reengineered Qhelp to call an interface layer to provide all
  881. file system functionality.  This interface layer would open a file,
  882. let us know whether it was a Qedit file or not, read the file, and
  883. close the file.  Once Qhelp called the interface layer, it would no
  884. longer "know" whether it was running on MPE or on HP-UX.
  885.  
  886. .page 5
  887. The new Qhelp looked like:
  888.  
  889.  
  890. .opt(l- r- f-).page 12
  891. .box(c+23 w20 r-0+ h2)
  892. Qhelp
  893.  
  894. .box(c+18 w30 r-0+ h2)
  895. Interface Layer
  896.  
  897. .box(c+13 w40 r-0+ h2)
  898. OS File System Library
  899.  
  900.  
  901. |2Revised Qhelp Structure|
  902. .opt
  903.  
  904. `|1Implementing the Qhelp Interface Layer|
  905. .ent Implementing the Qhelp Interface Layer
  906.  
  907. In our revised Qhelp diagram, we added an interface layer that is not
  908. operating system specific.  The job of the interface layer is
  909. to hide the details of the underlying operating system.  Each
  910. interface layer has two implementations:  one for MPE and one
  911. for HP-UX.  The MPE interface was written in SPL/SPLash! and the
  912. HP-UX interface was written in C.
  913.  
  914. A lot of research went into learning how to map parameters in SPL
  915. to parameters in C.  We also had to learn all of the HP-UX file
  916. system calls, how they worked, how to detect and report errors and
  917. so on.  All of this took considerable time, but once we got Qhelp
  918. working we knew that future rewriting of other modules would be
  919. faster.
  920.  
  921. `|1Phase Two Summary|
  922. .ent Phase Two Summary
  923.  
  924. During this phase we made a lot of progress. Approximately 20,000
  925. lines of existing SPL source code were ported to HP-UX (e.g., the
  926. calculator and Qhelp modules) and about 1,500 new lines of C code
  927. were written. This provided a strong foundation to begin the port
  928. of Qedit to HP-UX. The time that elapsed for this phase was about
  929. six months (August to January). The work time:
  930.  
  931. .mar(l+11).par(u10).page 8
  932. `Dave Lo#+1Two person-months.
  933. `Bob Green#+1Half person-month.
  934. `David Greer#+1Three person-months.
  935. .mar.par
  936. .sub Rebuild Qedit
  937. .page.jump 1
  938. .opt(l- r- f-)
  939. `|3Phase Three:  Rebuild Qedit|
  940. .ent `Phase Three:  Rebuild Qedit
  941. .opt
  942.  
  943.  
  944. By this point, things were looking pretty good.  We had a number of
  945. useful MPE routines written, a lot of the Robelle library was
  946. running on HP-UX, and we had one module (Qhelp) that did file I/O
  947. using an interface layer.  It was now time for the big show:  porting
  948. the Qedit source code to HP-UX.
  949. This was a much bigger project than what we had completed so far,
  950. since Qedit itself consists of about 75,000 lines of code.
  951.  
  952. `|1The First Attempt|
  953. .ent The First Attempt
  954.  
  955. We started by compiling all of Qedit's source modules using SPLash!
  956. and copying the resulting object-code to HP-UX.  Our first
  957. attempt to link Qedit using the
  958. ld command had many errors about missing procedures (e.g., all of the
  959. MPE file system routines).  You can run an HP-UX program with
  960. missing externals, but the program aborts if any missing routine is
  961. called.  To work around this problem, we wrote one source module
  962. that had all of the MPE routines that we had not rewritten for
  963. HP-UX. Each dummy routine returned a failure status. A portion of
  964. this file looked like this:
  965.  
  966. .font 5.page 4
  967.      integer procedure fopen;
  968.      begin
  969.  
  970.         fopen := 0;
  971.  
  972.         hpsetccode(ccl);
  973.  
  974.      end'proc;   <<fopen>>
  975.  
  976.      procedure flock      ;begin hpsetccode(ccl); end'proc;
  977.      procedure fpoint     ;begin hpsetccode(ccl); end'proc;
  978.      procedure fread      ;begin hpsetccode(ccl); end'proc;
  979.      procedure freaddir   ;begin hpsetccode(ccl); end'proc;
  980.      procedure freadlabel ;begin hpsetccode(ccl); end'proc;
  981. .font 0
  982.  
  983. `|1Redo Module|
  984. .ent Redo Module
  985.  
  986. Qedit supports the Do, Redo, and Listredo commands.  After our first
  987. attempt to link Qedit on HP-UX, we realized that we needed
  988. the redo module to work.
  989. The redo module
  990. also requires a "new" file (these are files that on MPE you
  991. cannot see with Listf or Listftemp).
  992. HP-UX does not have new or temporary files, but there is a solution.
  993. For the invisible scratch files needed by a program, you use the
  994. following algorithm on HP-UX:
  995.  
  996.     get a temporary filename (use tmpnam or tempnam)
  997.     open the temporary filename
  998.     unlink the filename from the file system
  999.  
  1000. If your program stops for any reason, the scratch file will
  1001. disappear and the space the file occupied will be returned to the
  1002. HP-UX free space list.
  1003.  
  1004. With the redo module working, we were now able to link our first
  1005. version of Qedit/UX. However, this version couldn't do much. It
  1006. accepted commands, but most failed immediately. For example, the
  1007. command:
  1008.  
  1009. .font 5.page 4
  1010.      /open file
  1011. .font 0
  1012.  
  1013. would fail because the open command was still calling fopen.  Therefore,
  1014. the next step was to completely reengineer Qedit so that no direct
  1015. calls were made to MPE routines.  Like Qhelp, we began to reengineer Qedit to
  1016. call an interface layer.
  1017.  
  1018. `|1Implementing the Qedit Interface Layer|
  1019. .ent Implementing the Qedit Interface Layer
  1020.  
  1021. Bob and I took about one month to completely reengineer Qedit so
  1022. that it called an interface layer for all operating system
  1023. services. Bob changed Qedit and wrote the MPE version of the
  1024. interface. I wrote the equivalent interface for HP-UX in C. A lot
  1025. of our time involved Bob asking me if it was possible to do certain
  1026. things in HP-UX (e.g., how to obtain exclusive access to an opened
  1027. file in HP-UX). By now, I had ported enough source code to have
  1028. a pretty good idea of what was possible and what was not.
  1029. Writing the interface layer was not our only problem.  There
  1030. were many other parts of Qedit that had to be changed.
  1031.  
  1032. `|1Upshifting Filenames|
  1033. .ent Upshifting Filenames
  1034.  
  1035. Inside Qedit, filenames were always upshifted,
  1036. often in several places.  On MPE this
  1037. didn't matter, since filenames are not case-sensitive.
  1038. On HP-UX, this was now important since filenames are case-sensitive.
  1039.  
  1040. Bob had to go through Qedit to find every single location where
  1041. filenames were upshifted and remove the upshifting code.  We also
  1042. had to cope with a different filename syntax (e.g., |5../init.c| is
  1043. a valid HP-UX filename).
  1044.  
  1045. While we made these changes for HP-UX, we are now taking advantage
  1046. of these same changes for POSIX on MPE.  In MPE/iX 5.0, POSIX
  1047. filenames have the same syntax as on HP-UX (they are mixed-case and
  1048. can contain directory names).  So our efforts have paid
  1049. off twice.
  1050.  
  1051. `|1The 32-Bit Alignment Problem|
  1052. .ent The 32-Bit Alignment Problem
  1053.  
  1054. The HP-UX C compiler prefers to have 32-bit variables aligned
  1055. on 32-bit boundaries.  In SPL and SPLash!, it is common to have
  1056. 32-bit variables aligned on 16-bit boundaries.  The interface
  1057. layer for Qedit was much more complicated than any of the other
  1058. interfaces that we had written.  Because the interface was more
  1059. sophisticated, large data structures had to be
  1060. passed between SPLash! and C routines.  We had to carefully
  1061. implement these structures so that all 32-bit variables were
  1062. aligned on 32-bit boundaries.  We also had to insure that these
  1063. structures themselves started on a 32-bit boundary.
  1064.  
  1065. You can force SPLash! to allocate arrays on 32-bit boundaries by
  1066. making the arrays |5virtual|.  This often has unexpected side-effects
  1067. (e.g., you cannot pass a virtual integer array to an option splash
  1068. procedure that is only expecting an integer array).  In Qedit,
  1069. we ended up doing the following.  We would allocate
  1070. one more word of storage than was necessary and then would
  1071. have code that looked like this:
  1072.  
  1073. .font 5.page 4
  1074.      if &@ext'record mod 2 <> 0 then
  1075.         &@ext'record := &@ext'record(1); ! assumes integer array
  1076. .font 0
  1077.  
  1078. This code fragment adjusts the start of the ext'record structure
  1079. if it does not start on a 32-bit boundary.  We also had to be
  1080. very careful of 32-bit variables that were passed by reference
  1081. (these are often status parameters).   It was often very difficult
  1082. to detect a 32-bit alignment problem:  due to the nature of SPL
  1083. and SPLash!, the problems can come and go.
  1084.  
  1085. `|1The End-Of-File Problem|
  1086. .ent The End-Of-File Problem
  1087.  
  1088. Many parts of Qedit need to know how many records are in a file.
  1089. For example, to print the line numbers for a command like:
  1090.  
  1091. .font 5.page 4
  1092.      /list somefile last-10/
  1093. .font 0
  1094.  
  1095. requires that Qedit know how many records are in |5somefile|.  MPE
  1096. remembers how many records are in a file while HP-UX does not.
  1097.  
  1098. Bob realized that rewriting Qedit so that it did not need to know
  1099. how many records were in a file would take longer than everything
  1100. we had done so far.  This meant that in the HP-UX interface layer
  1101. we have to read a file from beginning to end in order to count
  1102. the number of lines in it.  We do this every time that we open an
  1103. external file in Qedit/UX.  It's not very efficient, but it was
  1104. the only way to provide this information to Qedit.
  1105.  
  1106. `|1Implementing Full-Screen|
  1107. .ent Implementing Full-Screen
  1108.  
  1109. By this point we had many of Qedit's line-mode commands working
  1110. on HP-UX.  The big question left was what to do about Qedit's
  1111. full-screen mode.  On MPE, Qedit uses block-mode to implement
  1112. full-screen.
  1113. On HP-UX, we didn't know what we were going to do about full-screen.
  1114.  
  1115. One Friday night after a long day, my two children came into my
  1116. office (at my home).
  1117. They wanted to play the computer game "The Playroom".  I soon
  1118. had one child on each knee (they were 4 and 2 at the time),
  1119. happily playing on my computer.  I was surrounded by
  1120. the HP-UX reference manuals, which I had been using all day.
  1121. As my children were playing, I started flipping through one of the
  1122. manuals.  I wasn't really concentrating, but
  1123. suddenly I noticed an entry for |1blmode|.  The opening
  1124. description read:
  1125.  
  1126. .mar(l+3 r-3)
  1127. "This terminal library interface allows support of block mode
  1128. transfers with HP terminals."
  1129. .mar
  1130.  
  1131. By accident, I had found a set of routines that implemented
  1132. block-mode. Bob liked the HP-UX block-mode interface enough that
  1133. he reengineered the Qedit block-mode interface on MPE to look like the
  1134. one on HP-UX. In a few days time, we had full-screen working on
  1135. HP-UX.
  1136.  
  1137. `|1Phase Three Summary|
  1138. .ent Phase Three Summary
  1139.  
  1140. Qedit was now running on HP-UX. The process we used helped ensure
  1141. that future Qedit enhancements would appear in both versions,
  1142. since only one set of source code is used for the MPE and
  1143. HP-UX versions of Qedit. Most of Qedit no longer knew which
  1144. platform it was running on. The time that elapsed for this phase was
  1145. about three months (February to April). The work time:
  1146.  
  1147. .mar(l+11).par(u10).page 8
  1148. `Dave Lo#+1One person-month.
  1149. `Bob Green#+1Two person-months.
  1150. `David Greer#+1Two person-months.
  1151. .mar.par
  1152. .sub Polishing Qedit/UX
  1153. .page.jump 1
  1154. .opt(l- r- f-)
  1155. `|3Phase Four:  Polishing Qedit/UX|
  1156. .ent `Phase Four:  Polishing Qedit/UX
  1157. .opt
  1158.  
  1159.  
  1160. With the basic research complete, we now had to polish Qedit/UX to
  1161. turn it into a product.  Up to this point I had to write all of
  1162. the C code on HP-UX using the vi editor.   I was certainly pleased
  1163. when we had a working version of Qedit/UX that I could start using.
  1164. I wasn't sorry to see the end of vi.
  1165.  
  1166. `|1Porting the Test Suite|
  1167. .ent Porting the Test Suite
  1168.  
  1169. For years, we have developed test suites for all of our products.
  1170. The Qedit test suite has
  1171. a few hundred tests organized into sixty-three batch jobs.  We
  1172. knew that in order for Qedit/UX to be reliable, we would have
  1173. to have a good portion of our test suite working on HP-UX.
  1174.  
  1175. There was no automated way to convert our tests from MPE to HP-UX.
  1176. We had to go through each test manually and convert MPE commands
  1177. to their equivalent HP-UX commands.  We also had to implement
  1178. several of our test tools on HP-UX (e.g., the program that compares
  1179. two Qedit files one line at a time looking for differences).
  1180.  
  1181. `|1Temporary Files|
  1182. .ent Temporary Files
  1183.  
  1184. On MPE, Qedit uses temporary files for a scratch file and for
  1185. "hold" files.  The hold filename on MPE was chosen so that you
  1186. could use the name in commands.  For example,
  1187.  
  1188. .font 5.page 5
  1189.       /open file1
  1190.       /hold 15/20            |0{save lines 15/20 in file "hold"}|
  1191.       /open file2
  1192.       /add  75=hold          |0{add lines from the "hold" file}|
  1193. .font 0
  1194.  
  1195. Initial versions of Qedit/UX created files in the current directory
  1196. called QEDITSCR, HOLD, and HOLD0 (note the upper case filenames).
  1197. The Add command in the previous example would not work, since there
  1198. was no file called "hold":  it was "HOLD".
  1199.  
  1200. We modified Qedit/UX to create the qeditscr, hold, and hold0 files
  1201. in |5/usr/tmp|.  HP-UX system managers expect temporary files to
  1202. be created in the /usr/tmp directory (our nightly backup script
  1203. removes all files from /usr/tmp more than twenty days old).
  1204. We also had to modify Qedit/UX so that when it held lines or when
  1205. you wanted to look at a file called "hold", it substituted the
  1206. temporary filename.  For example,
  1207.  
  1208. .font 5.page 5
  1209.       /open file1
  1210.       /hold 15/20            |0{save lines in "qholdBAAa23359"}|
  1211.       /open file2
  1212.       /add  75=hold          |0{add lines from "qholdBAAa23359"}|
  1213. .font 0
  1214.  
  1215. On HP-UX there really are no temporary files.  HP-UX programs just
  1216. create permanent files in a directory considered to be temporary.
  1217. The different-looking filename is a result of the HP-UX routine
  1218. |5tempnam| which creates a file with a unique name in /usr/tmp.
  1219.  
  1220. `|1More HP-UX Features|
  1221. .ent More HP-UX Features
  1222.  
  1223. Qedit/UX was modified to execute shell commands (a shell is like
  1224. the MPE/iX CI.PUB.SYS program). One of the most common HP-UX
  1225. commands is ls (like the MPE Listf command). This conflicted with
  1226. the Qedit command LSort. In Qedit/UX, we made ls mean list files
  1227. and LSO mean sort lines (although the LSOrt command is not yet
  1228. implemented).
  1229.  
  1230. HP-UX users can have different shells.
  1231. We changed Qedit/UX so that when it executes
  1232. shell commands it does so with the user's preferred login shell.
  1233.  
  1234. We could not obtain command line arguments in our SPLash! programs.
  1235. Fortunately, Stan Sieler worked on the problem and modified SPLash!
  1236. to make the argument count and a pointer to the argument list
  1237. available to SPLash! programs.  HP-UX programs expect options to
  1238. be specified by a leading dash.  We changed Qedit/UX to
  1239. accept command line arguments such as this:
  1240.  
  1241. .font 5.page 4
  1242.      qedit -s -cvi file1
  1243. .font 0
  1244.  
  1245. This example asks Qedit/UX to edit a single file (|5-s|), go directly
  1246. into visual-mode (|5-cvi|), and to edit |5file1|.  This also made it
  1247. possible to set the HP-UX EDITOR variable, so that any HP-UX
  1248. program that invoked an editor would invoke Qedit/UX on behalf of
  1249. the user.
  1250.  
  1251. `|1Tab Characters|
  1252. .ent Tab Characters
  1253.  
  1254. One problem that we have not solved adequately is how to handle
  1255. tab characters. In MPE, tab characters are used as a short-hand
  1256. way of moving the cursor across the screen. The tab character is
  1257. always translated into spaces and never stored in files. On
  1258. HP-UX, the tab character is also used to move across the screen,
  1259. but it is also used as data. Some programs (e.g., make and
  1260. sendmail) require that certain lines have tab characters.
  1261.  
  1262. In Qedit/UX, we automatically expand tabs to spaces when we text
  1263. a file. This is not what HP-UX users expect, especially if you
  1264. are editing a Makefile or the sendmail configuration file
  1265. (important data gets removed by Qedit/UX). Qedit/UX has a feature
  1266. to prevent tabs from turning into spaces, but it is not the
  1267. default. If you leave tabs as data and go into
  1268. full-screen, you will lose the tab characters that were in the
  1269. lines shown on the screen.
  1270.  
  1271. There are various technical problems that make it difficult for
  1272. Qedit to treat tabs as data. How to handle tab characters is
  1273. similar to our number-of-records problem in the file system
  1274. interface. It's a fundamental assumption that is different on
  1275. HP-UX from MPE. We continue to work on ideas in Qedit/UX to
  1276. solve this problem.
  1277.  
  1278. `|1Releasing a Product|
  1279. .ent Releasing a Product
  1280.  
  1281. Besides all of the technical and programming problems, there were
  1282. many other issues to deal with.  We had to create a
  1283. whole new set of software to make tapes.  I spent two full weeks
  1284. rewriting the Qedit documentation so that we could have both a
  1285. Qedit/UX user manual and on-line help.  There were data sheets to
  1286. write, advertising, training (every technical person at Robelle has
  1287. taken the week-long HP-UX introductory course), and pre-release
  1288. customers to work with.  It was all worth it when we first
  1289. demonstrated Qedit/UX at the San Francisco Interex User Group
  1290. Meeting.  We had many excited customers and just a week later we started
  1291. shipping Qedit/UX.
  1292.  
  1293. `|1Phase Four Summary|
  1294. .ent Phase Four Summary
  1295.  
  1296. Our final phase took a working R&&D program and turned it into a
  1297. new product.  Many changes were made to integrate Qedit/UX into
  1298. HP-UX.  The supporting documentation and technical support were created to
  1299. provide a high quality product for our customers.
  1300. The time that elapsed for this phase was
  1301. about five months (May to September). The work time:
  1302.  
  1303. .mar(l+11).par(u10).page 8
  1304. `Dave Lo#+1Two person-months.
  1305. `Bob Green#+1Two person-months.
  1306. `David Greer#+1Two person-months.
  1307. .mar.par
  1308. .sub The Future
  1309. .page.jump 1
  1310. .opt(l- r- f-)
  1311. `|3The Future of Qedit/UX|
  1312. .ent `The Future of Qedit/UX
  1313. .opt
  1314.  
  1315.  
  1316. We have proven that the initial concept of cross-platform development
  1317. using SPLash! was feasible. The object-code format on MPE/iX and
  1318. HP-UX are the same. It is possible to compile SPLash! code on
  1319. MPE, copy it to HP-UX, and then link and run the resulting
  1320. program on HP-UX. In total, we ported over 100,000 lines of code.
  1321. We could never have rewritten Qedit in the same amount of time.
  1322.  
  1323. `|1Full-Screen|
  1324. .ent Full-Screen
  1325.  
  1326. Our use of the blmode routines enabled us to get full-screen mode
  1327. up and running quickly.  Now that Qedit/UX has been released for
  1328. several months, it is clear that even on HP-UX many users have decided
  1329. to use vt terminals or vt terminal emulators.  Because full-screen
  1330. uses HP block-mode, it requires an HP terminal and will not work with
  1331. vt terminals.  One major research goal for 1994 is to reengineer
  1332. full-screen to use a terminal-independent method of communicating with
  1333. the user.
  1334.  
  1335. `|1Shell Commands|
  1336. .ent Shell Commands
  1337.  
  1338. On MPE, users are used to living inside Qedit all day. You cannot
  1339. do this in Qedit/UX, because many common shell features are
  1340. missing (e.g., setting environment variables). Some of these are
  1341. due to limitations of UNIX, but we expect to implement many more
  1342. shell features in Qedit/UX. It took us more than ten years to
  1343. fully integrate MPE command features into Qedit/MPE, so it isn't
  1344. a big surprise that it will take us a year or two to add all the
  1345. necessary shell features to Qedit/UX.
  1346.  
  1347. `|1MPE Flavor|
  1348. .ent MPE Flavor
  1349.  
  1350. Qedit was originally written for MPE.  There are many features of
  1351. Qedit/UX that retain an MPE flavor.  If we are to expand the
  1352. potential market of Qedit to users who have never seen MPE, we will
  1353. have to remove most of this MPE feel and introduce more of an
  1354. HP-UX feel.  This is a challenge, since we still want Qedit/UX
  1355. to look familiar to former Qedit/MPE users.
  1356.  
  1357. `|1The End|
  1358. .ent The End
  1359.  
  1360. Qedit/UX has been both a technical and a marketing
  1361. success.  We now have one set of source code that can be used to
  1362. generate two different products:  Qedit/MPE and Qedit/UX.  If you
  1363. have a lot of SPL/SPLash! code, perhaps our solution will work for
  1364. you as well.
  1365. .com {toc starts here}
  1366. .if outtext
  1367. .   page
  1368. .else
  1369. .   con
  1370. .   form 3
  1371. .   tit
  1372. .   page
  1373. .   if outdouble or outfinal
  1374. .      align
  1375. .   endif
  1376. .   count 3
  1377. .   com                         The next FORM is for Contents/Preface:
  1378. .   form 2
  1379. .   jump 6
  1380. .   if not outfinal
  1381. .     jump 5
  1382. .   endif
  1383. .   opt(l- r- f-).font 3
  1384. Porting Qedit from MPE to HP-UX
  1385. .   skip 4
  1386. Contents
  1387. .   opt.font 0
  1388.  
  1389.  
  1390. .   tit |1Contents|
  1391. .   con (p+ f. m10 c52 l0 r0)
  1392. .   tit
  1393. .   page
  1394. .   form 3
  1395. .   if outdouble or outfinal
  1396. .     align
  1397. .   endif
  1398. .endif    { else of if outtext }
  1399. .check(c1 f0 i1 j0 m1 o1 p1)
  1400. .com {toc ends here}
  1401. .count 50.page.com  Original outline:
  1402.  
  1403. .opt(l- r- f-)
  1404. `|3Outline|
  1405. .opt
  1406.  
  1407.  
  1408. Introduction
  1409.    We successfully ported Qedit from MPE to HP-UX.
  1410.    Target was HP-UX HPPA RISC.
  1411.    Time line.
  1412.    Goal:  Learn Unix.  Qedit for HP-UX, if possible.
  1413.  
  1414. Background
  1415.    Qedit is written 99% in SPL/SPLash!
  1416.    SPLash! is similar to C -- no run-time library.
  1417.    Differences between HP-UX and MPE.
  1418.    Software Engineering Model:  show a picture.
  1419.    Libraries (MPE & HP-UX).
  1420.  
  1421. Object Code
  1422.    Object-code format is the same for MPE and HP-UX.
  1423.    HP-UX tools for analyzing object-code:  nm.
  1424.    Searching libraries -- e.g., floating-point conversion.
  1425.    Document the special ld command required by Qedit/UX.
  1426.    Time:  one month (includes installation, network problems, ...).
  1427.  
  1428. First Phase -- Basic Research
  1429.    Replacement routines (ascii, binary, ...).
  1430.    Robelle library.
  1431.    Dummy routines.
  1432.    Problems:  32-bit alignment.
  1433.    Time:  six-months.
  1434.  
  1435. Second Phase -- Rebuild Qedit
  1436.    Qedit no longer "knows" which platform it is running on.
  1437.    Redesign Qedit by providing an interface layer.
  1438.    Time:  approx 2 months (Bob and David).
  1439.    The interface layer talks to the O/S primitives -- Qedit does not.
  1440.    Discovered blmode -- MPE-style block-mode.
  1441.    There are some assumptions (e.g., end-of-file).
  1442.  
  1443. Third Phase -- Integrate Qedit/UX into HP-UX
  1444.    Scratch filenames.
  1445.    Hold filenames.
  1446.    Shell commands via the login shell.
  1447.    New command-line options.
  1448.    Tab stops and tab characters.
  1449.    Time:  4 months.
  1450.    Future:  cd command.
  1451.  
  1452. Summary
  1453.    Was possible because of identical object-code formats.
  1454.    Required that Qedit be rebuilt.
  1455.    Only have one set of source code.
  1456.    The differences between MPE and HP-UX versions is < 1%.
  1457.