home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / OSPORT.ZIP / OSPORT.KEX next >
Text File  |  1992-06-26  |  14KB  |  300 lines

  1. /**
  2. *** ┌─────────────────────────────────────────────────────────────────────────┐
  3. *** │                                                                         │
  4. *** │ This macro will assist in the migration of OS/2 1.x C programs          │
  5. *** │ to OS/2 2.0 by making reasonable edit changes.  This is not a           │
  6. *** │ complete migration aid.  Significant changes may still be required      │
  7. *** │ to fully convert your product.                                          │
  8. *** │                                                                         │
  9. *** │ ═══════════════════════════════════════════════════════════════════════ │
  10. *** │  Copyright(c) 1991, Hilbert Computing.  Released to the public domain.  │
  11. *** │                    No warranty expressed or implied.                    │
  12. *** │ ═══════════════════════════════════════════════════════════════════════ │
  13. *** │                                                                         │
  14. *** │ If this has been useful to you, I would like to know.  Drop me a line   │
  15. *** │ on Prodigy [VWSD07A] or CompuServe [73457,365].  If there are any       │
  16. *** │ errors or improvements, let me know.  If someone researches the APIs    │
  17. *** │ that I skipped, I would appreciate knowing that as well.                │
  18. *** │                                                                         │
  19. *** └─────────────────────────────────────────────────────────────────────────┘
  20. **/
  21.  
  22. /**
  23. ***
  24. ***══════════════════════════════════════════════════════════════════════════════
  25. ***   Setup
  26. **/
  27.  
  28. 'preserve'
  29. 'set arb on ` ~'
  30. 'set autosave off'
  31. 'set case mixed respect'
  32. 'set linend off'
  33. 'set stay on'
  34. 'set varblank on'
  35. 'set wrap off'
  36. 'set zone 1 *'
  37. 'all'
  38. 'set scope display'
  39. 'set msgmode off'
  40.  
  41. /**
  42. ***   Specific to the author.  You will probably want to remove this section.
  43. **/
  44.  
  45. ':0c/#include "b1hilb.h"/#include "b2hilb.h"/ * *'
  46. ':0c/#include "b1hdlg.h"/#include "b2hdlg.h"/ * *'
  47. ':0c/B1HILB/B2HILB/ * *'
  48. ':0c/Style.sLMargin/Style.lLMargin/ * *'
  49. ':0c/Style.sRMargin/Style.lRMargin/ * *'
  50. ':0c/Style.usJustify/Style.ulJustify/ * *'
  51. ':0c/Style.usLineSpacing/Style.ulLineSpacing/ * *'
  52. ':0c/Style.usTab/Style.ulTab/ * *'
  53. ':0c/pStyle->sLMargin/pStyle->lLMargin/ * *'
  54. ':0c/pStyle->sRMargin/pStyle->lRMargin/ * *'
  55. ':0c/pStyle->usJustify/pStyle->ulJustify/ * *'
  56. ':0c/pStyle->usLineSpacing/pStyle->ulLineSpacing/ * *'
  57. ':0c/pStyle->usTab/pStyle->ulTab/ * *'
  58.  
  59. /**
  60. ***  Mark APIs that needs to be hand-checked.  A lot of this information was
  61. ***  obtained from an article by Ray Duncan in the May 1990 volume of the
  62. ***  "Microsoft Systems Journal", back before that journal turned into a
  63. ***  Windows advertisement.
  64. **/
  65.  
  66. 'display 0 *'
  67.  
  68. ':0';do forever;'/ Kbd`(`)/              ';if rc \= 0 then leave;'set select' 20 1;end
  69. ':0';do forever;'/ Mou`(`)/              ';if rc \= 0 then leave;'set select' 20 1;end
  70. ':0';do forever;'/ Vio`(`)/              ';if rc \= 0 then leave;'set select' 20 1;end
  71. ':0';do forever;'/DosCallback(`)/        ';if rc \= 0 then leave;'set select' 20 1;end
  72. ':0';do forever;'/DosCLIAccess(`)/       ';if rc \= 0 then leave;'set select' 20 1;end
  73. ':0';do forever;'/DosCreateCSAlias(`)/   ';if rc \= 0 then leave;'set select' 20 1;end
  74. ':0';do forever;'/DosDevIOCtl(`)/        ';if rc \= 0 then leave;'set select' 20 1;end
  75. ':0';do forever;'/DosFindFirst(`)/       ';if rc \= 0 then leave;'set select' 20 1;end
  76. ':0';do forever;'/DosFSRamSem`(`)/       ';if rc \= 0 then leave;'set select' 20 1;end
  77. ':0';do forever;'/DosGetEnv(`)/          ';if rc \= 0 then leave;'set select' 20 1;end
  78. ':0';do forever;'/DosGetHugeShift(`)/    ';if rc \= 0 then leave;'set select' 20 1;end
  79. ':0';do forever;'/DosGetInfoSeg(`)/      ';if rc \= 0 then leave;'set select' 20 1;end
  80. ':0';do forever;'/DosGetMachineMode(`)/  ';if rc \= 0 then leave;'set select' 20 1;end
  81. ':0';do forever;'/DosGetMessage(`)/      ';if rc \= 0 then leave;'set select' 20 1;end
  82. ':0';do forever;'/DosGetPID(`)/          ';if rc \= 0 then leave;'set select' 20 1;end
  83. ':0';do forever;'/DosGetPPID(`)/         ';if rc \= 0 then leave;'set select' 20 1;end
  84. ':0';do forever;'/DosGetResource(`)/     ';if rc \= 0 then leave;'set select' 20 1;end
  85. ':0';do forever;'/DosGetVersion(`)/      ';if rc \= 0 then leave;'set select' 20 1;end
  86. ':0';do forever;'/DosGiveSeg(`)/         ';if rc \= 0 then leave;'set select' 20 1;end
  87. ':0';do forever;'/DosHoldSignal(`)/      ';if rc \= 0 then leave;'set select' 20 1;end
  88. ':0';do forever;'/DosMkDir(`)/           ';if rc \= 0 then leave;'set select' 20 1;end
  89. ':0';do forever;'/DosMon`(`)/            ';if rc \= 0 then leave;'set select' 20 1;end
  90. ':0';do forever;'/DosMuxSemWait(`)/      ';if rc \= 0 then leave;'set select' 20 1;end
  91. ':0';do forever;'/DosOpen(`)/            ';if rc \= 0 then leave;'set select' 20 1;end
  92. ':0';do forever;'/DosPortAccess(`)/      ';if rc \= 0 then leave;'set select' 20 1;end
  93. ':0';do forever;'/DosPTrace(`)/          ';if rc \= 0 then leave;'set select' 20 1;end
  94. ':0';do forever;'/DosQFileMode(`)/       ';if rc \= 0 then leave;'set select' 20 1;end
  95. ':0';do forever;'/DosR2StackRealloc(`)/  ';if rc \= 0 then leave;'set select' 20 1;end
  96. ':0';do forever;'/DosReadAsync(`)/       ';if rc \= 0 then leave;'set select' 20 1;end
  97. ':0';do forever;'/DosRead(`)/            ';if rc \= 0 then leave;'set select' 20 1;end
  98. ':0';do forever;'/DosReallocSeg(`)/      ';if rc \= 0 then leave;'set select' 20 1;end
  99. ':0';do forever;'/DosSem`(`)/            ';if rc \= 0 then leave;'set select' 20 1;end
  100. ':0';do forever;'/DosSendSignal(`)/      ';if rc \= 0 then leave;'set select' 20 1;end
  101. ':0';do forever;'/DosSetFileMode(`)/     ';if rc \= 0 then leave;'set select' 20 1;end
  102. ':0';do forever;'/DosSetSigHandler(`)/   ';if rc \= 0 then leave;'set select' 20 1;end
  103. ':0';do forever;'/DosSetVec(`)/          ';if rc \= 0 then leave;'set select' 20 1;end
  104. ':0';do forever;'/DosWriteAsync(`)/      ';if rc \= 0 then leave;'set select' 20 1;end
  105. ':0';do forever;'/DosQSysInfo(`)/        ';if rc \= 0 then leave;'set select' 20 1;end
  106. ':0';do forever;'/Dos`Seg(`)/            ';if rc \= 0 then leave;'set select' 20 1;end
  107. ':0';do forever;'/Dos`Sem(`)/            ';if rc \= 0 then leave;'set select' 20 1;end
  108.  
  109. ':0';do forever;'/WinLockWindow(`)/      ';if rc \= 0 then leave;'set select' 20 1;end
  110. ':0';do forever;'/WinCreateStdWindow(`)/ ';if rc \= 0 then leave;'set select' 20 1;end
  111.  
  112. ':0';do forever;'/GpiCreateBitmap/       ';if rc \= 0 then leave;'set select' 20 1;end
  113.  
  114. ':0';do forever;'/MAKEP(`)/              ';if rc \= 0 then leave;'set select' 20 1;end
  115. ':0';do forever;'/SELECTOROF(`)/         ';if rc \= 0 then leave;'set select' 20 1;end
  116. ':0';do forever;'/SEL /                  ';if rc \= 0 then leave;'set select' 20 1;end
  117. ':0';do forever;'/OFFSETOF(`)/           ';if rc \= 0 then leave;'set select' 20 1;end
  118. ':0';do forever;'/PIDINFO/               ';if rc \= 0 then leave;'set select' 20 1;end
  119. ':0';do forever;'/VOID _cdecl FAR/       ';if rc \= 0 then leave;'set select' 20 1;end
  120. ':0';do forever;'/VOID _cdecl far/       ';if rc \= 0 then leave;'set select' 20 1;end
  121. ':0';do forever;'/_beginthread(/         ';if rc \= 0 then leave;'set select' 20 1;end
  122.  
  123. /**
  124. ***  Note: These have been fully checked for parameter ordering changes and
  125. ***        should successfully change the API. (Beta 6.123)
  126. **/
  127.  
  128. ':0c/DosMakeNmPipe/DosCreateNPipe/ * *'
  129. ':0c/DosQCurDir/DosQueryCurrentDir/ * *'
  130. ':0c/DosQCurDisk/DosQueryCurrentDisk/ * *'
  131. ':0c/DosSelectDisk/DosSetDefaultDisk/ * *'
  132. ':0c/DosTimerAsync/DosAsyncTimer/ * *'
  133. ':0c/DosTimerStart/DosStartTimer/ * *'
  134. ':0c/DosTimerStop/DosStopTimer/ * *'
  135. ':0c/DosChDir(`,0L)/DosSetCurrentDir(`)/ * *'
  136. ':0c/DosMkDir(`,0L)/DosCreateDir(`)/ * *'
  137. ':0c/DosOpen2(`,0L)/DosOpen(`)/ * *'
  138. ':0c/DosChDir(`,0l)/DosSetCurrentDir(`)/ * *'
  139. ':0c/DosMkDir(`,0l)/DosCreateDir(`)/ * *'
  140. ':0c/DosOpen2(`,0l)/DosOpen(`)/ * *'
  141. ':0c/DosCopy(`,0l)/DosCopy(`)/ * *'
  142. ':0c/DosChDir(`, 0L)/DosSetCurrentDir(`)/ * *'
  143. ':0c/DosMkDir(`, 0L)/DosCreateDir(`)/ * *'
  144. ':0c/DosOpen2(`, 0L)/DosOpen(`)/ * *'
  145. ':0c/DosCopy(`, 0L)/DosCopy(`)/ * *'
  146. ':0c/DosChDir(`, 0l)/DosSetCurrentDir(`)/ * *'
  147. ':0c/DosMkDir(`, 0l)/DosCreateDir(`)/ * *'
  148. ':0c/DosOpen2(`, 0l)/DosOpen(`)/ * *'
  149. ':0c/DosGetPID(`)/DosGetThreadInfo(«PPTIB»,&«`»)/ * *'
  150. ':0c/WinQueryWindow(`, TRUE)/WinQueryWindow(`)/ * *'
  151. ':0c/WinQueryWindow(`,TRUE)/WinQueryWindow(`)/ * *'
  152. ':0c/WinQueryWindow(`, FALSE)/WinQueryWindow(`)/ * *'
  153. ':0c/WinQueryWindow(`,FALSE)/WinQueryWindow(`)/ * *'
  154.  
  155. /**
  156. ***  The cast for a window handle changed from a pointer to a ULONG.  NULL
  157. ***  is cast as a pointer and causes type mismatch errors from the compiler
  158. ***  This set of lines will change the most common ones from NULLs to
  159. ***  NULLHANDLE, which is cast as a ULONG
  160. **/
  161.  
  162. ':0c/WinBeginPaint(hwnd, NULL, NULL)/WinBeginPaint(hwnd, NULLHANDLE, NULL)/ * *'
  163. ':0c/WinBeginPaint(hwnd,NULL,NULL)/WinBeginPaint(hwnd,NULLHANDLE,NULL)/ * *'
  164. ':0c/WinGetMsg(hab, &qmsg, NULL, 0, 0)/WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0)/ * *'
  165. ':0c/WinGetMsg(hab,&qmsg,NULL,0,0)/WinGetMsg(hab,&qmsg,NULLHANDLE,0,0)/ * *'
  166. ':0c/WinLoadString(`, NULL,/WinLoadString(`, NULLHANDLE,/ * *'
  167. ':0c/WinLoadString(`,NULL,/WinLoadString(`,NULLHANDLE,/ * *'
  168.  
  169. /**
  170. *** The COMMANDMSG macro is defined only for 16-bit applications.  This will
  171. *** replace those with the corresponding translation macro.  Ditto for
  172. *** MOUSEMSG and CHARMSG.
  173. **/
  174.  
  175. /**
  176. ***  ':0c/COMMANDMSG(&msg)->cmd/SHORT1FROMMP(mp1)/ * *'
  177. ***  ':0c/COMMANDMSG(&msg)->source/SHORT1FROMMP(mp2)/ * *'
  178. ***  ':0c/COMMANDMSG(&msg)->mouse/SHORT2FROMMP(mp2)/ * *'
  179. ***  ':0c/CHARMSG(&msg)->chr/SHORT1FROMMP(mp2)/ * *'
  180. ***  ':0c/CHARMSG(&msg)->vkey/SHORT2FROMMP(mp2)/ * *'
  181. ***  ':0c/CHARMSG(&msg)->fs/SHORT1FROMMP(mp1)/ * *'
  182. ***  ':0c/CHARMSG(&msg)->cRepeat/CHAR3FROMMP(mp1)/ * *'
  183. ***  ':0c/CHARMSG(&msg)->scancode/CHAR4FROMMP(mp1)/ * *'
  184. ***  ':0c/MOUSEMSG(&msg)->x/SHORT1FROMMP(mp1)/ * *'
  185. ***  ':0c/MOUSEMSG(&msg)->y/SHORT2FROMMP(mp1)/ * *'
  186. ***  ':0c/MOUSEMSG(&msg)->codeHitTest/SHORT1FROMMP(mp2)/ * *'
  187. **/
  188.  
  189. ':0c/VOID _cdecl FAR/VOID/ * *'
  190.  
  191. /**
  192. ***  Change the APIs that are just renames (with no parameter changes)
  193. ***
  194. ***  Note:  This have not been fully checked for parameter compatibility since
  195. ***         the author has not used these macros.  If there is a substitution
  196. ***         that can easily occur (e.g. DosChDir), you can make the change.  If
  197. ***         there needs to be more sophisticated changes, add it to the set of
  198. ***         "do forever" loops above.
  199. **/
  200.  
  201. ':0c/DosBufReset/DosResetBuffer/ * *'
  202. ':0c/DosCaseMap/DosMapCase/ * *'
  203. ':0c/DosChgFilePtr/DosSetFilePtr/ * *'
  204. ':0c/DosCWait/DosWaitChild/ * *'
  205. ':0c/DosDevIOCtl2/DosDevIOCtl/ * *'
  206. ':0c/DosFileLocks/DosSetFileLocks/ * *'
  207. ':0c/DosFindFirst2/DosFindFirst/ * *'
  208. ':0c/DosGetCollate/DosQueryCollate/ * *'
  209. ':0c/DosGetCP/DosQueryCP/ * *'
  210. ':0c/DosGetCtryInfo/DosQueryCtryInfo/ * *'
  211. ':0c/DosGetDBCSEv/DosQueryDBCSEnv/ * *'
  212. ':0c/DosGetModName/DosQueryModuleName/ * *'
  213. ':0c/DosGetProcAddr/DosQueryProcAddr/ * *'
  214. ':0c/DosGetPrty/DosQueryPrty/ * *'
  215. ':0c/DosGetResouce2/DosGetResource/ * *'
  216. ':0c/DosInsMessage/DosInsertMessage/ * *'
  217. ':0c/DosNewSize/DosSetFileSize/ * *'
  218. ':0c/DosQAppType/DosQueryAppType/ * *'
  219. ':0c/DosQFHandState/DosQueryFHState/ * *'
  220. ':0c/DosQFileInfo/DosQueryFileInfo/ * *'
  221. ':0c/DosQFSAttach/DosQueryFSAttach/ * *'
  222. ':0c/DosQFSInfo/DosQueryFSInfo/ * *'
  223. ':0c/DosQHandType/DosQueryHType/ * *'
  224. ':0c/DosQNmPHandState/DosQueryNPHState/ * *'
  225. ':0c/DosQNmPipeInfo/DosQueryNPipeInfo/ * *'
  226. ':0c/DosQPathInfo/DosQueryPathInfo/ * *'
  227. ':0c/DosQSysInfo(Q_MAX_PATH_LENGTH,`,sizeof(USHORT))/DosQuerySysInfo(Q_MAX_PATH_LENGTH,Q_MAX_PATH_LENGTH,`,sizeof(ULONG))/ * * '
  228. ':0c/DosQSysInfo(Q_MAX_PATH_LENGTH,`, sizeof(USHORT))/DosQuerySysInfo(Q_MAX_PATH_LENGTH, Q_MAX_PATH_LENGTH,`, sizeof(ULONG))/ * * '
  229. ':0c/DosQVerify/DosQueryVerify/ * *'
  230. ':0c/DosRmDir/DosDeleteDir/ * *'
  231. ':0c/DosSetFHandState/DosSetFHState/ * *'
  232. ':0c/DosSetNmPHandState/DosSetNPipeSem/ * *'
  233. ':0c/DosSetProcCp/DosSetProcessCP/ * *'
  234. ':0c/DosSetPrty/DosSetPriority/ * *'
  235. ':0c/Dos`NmPipe(/Dos`NPipe(/ * *'
  236.  
  237. /**
  238. ***   Remove far references. Convert to near pointer references.
  239. **/
  240.  
  241. ':0c/ _FAR_/ / * *'
  242. ':0c/ FAR/ / * *'
  243. ':0c/ far/ / * *'
  244. ':0c/_fmalloc/malloc/ * *'
  245. ':0c/_ffree/free/ * *'
  246. ':0c/_fstr`(/str`(/ * *'
  247. ':0c/_fmem`(/mem`(/ * *'
  248.  
  249. /**
  250. ***  OS/2 2.0 (Beta 6.123) doesn't like WORDWRAP and VSCROLL both on an MLE.
  251. **/
  252.  
  253. ':0';do forever;'/MLS_HSCROLL`|`MLS_WORDWRAP/';if rc \= 0 then leave;'set select' 20 1;end
  254. ':0';do forever;'/MLS_WORDWRAP`|`MLS_HSCROLL/';if rc \= 0 then leave;'set select' 20 1;end
  255.  
  256. /**
  257. ***   These changes added for IBM C Set/2 product.  C Set/2 is more ANSI
  258. ***   compliant that Microsoft compilers.  MS extensions like itoa are
  259. ***   provided in C Set via the "/Se" compiler directive to include the
  260. ***   extensions. However, C Set adds an underscore to the beginning of the
  261. ***   extensions to remain ANSI-compliant.
  262. **/
  263.  
  264. ':0c/itoa/_itoa/ * *'
  265.  
  266. /**
  267. *** The following are a duplication above and will only be needed if you run
  268. *** this macro on the same source code twice.
  269. **/
  270.  
  271. ':0c/__itoa/_itoa/ * *'
  272.  
  273. /**
  274. *** Remove references that are not longer needed
  275. **/
  276.  
  277. ':0/#define _MT/ del 1'
  278.  
  279. /**
  280. ***   Termination and information providing
  281. **/
  282.  
  283. ':0'
  284. 'set highlight altered'
  285. 'set msgmode on'
  286. 'set msgline on 10 8 overlay'
  287.  
  288. msg '                   ┌─────────────────────────────────────────┐'
  289. msg '                   │ Press F12 to display all lines that     │'
  290. msg '                   │ need special attention.  Press Alt-F12  │'
  291. msg '                   │ to return to a normal display.          │'
  292. msg '                   │                                         │'
  293. msg '                   │      Press Any key to continue...       │'
  294. msg '                   └─────────────────────────────────────────┘'
  295. 'readv key'
  296.  
  297. 'restore'
  298. 'define f12   "display 20 20"'
  299. 'define a-f12 "display 0 *"'
  300.