home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / PERL30X.ZIP / DIFF3040.SH < prev    next >
Text File  |  1991-01-14  |  13KB  |  410 lines

  1. Some patches to make patchlevel 40 compilable.
  2.  
  3. #!/bin/sh
  4. # This is a shell archive (produced by shar 3.53)
  5. # To extract the files from this archive, save it to a file, remove
  6. # everything above the "!/bin/sh" line above, and type "sh file_name".
  7. #
  8. # made 11/16/1990 20:07 UTC by unknown@os2
  9. # Source directory F:\
  10. #
  11. # existing files will NOT be overwritten unless -c is specified
  12. #
  13. # This shar contains:
  14. # length  mode       name
  15. # ------ ---------- ------------------------------------------
  16. #   5603 -rw-rw-rw- perl3040.dif
  17. #   4092 -rw-rw-rw- alarm.c
  18. #     52 -rw-rw-rw- alarm.h
  19. #    280 -rw-rw-rw- alarm.pl
  20. #
  21. # ============= perl3040.dif ==============
  22. if test -f 'perl3040.dif' -a X"$1" != X"-c"; then
  23.     echo 'x - skipping perl3040.dif (File already exists)'
  24. else
  25. echo 'x - extracting perl3040.dif (Text)'
  26. sed 's/^X//' << 'SHAR_EOF' > 'perl3040.dif' &&
  27. Only in perl3040/OS2: alarm.c
  28. Only in perl3040/OS2: alarm.h
  29. Only in perl3040/OS2/EG: alarm.pl
  30. diff -cbBwr perl-3.0@40/os2/config.h perl3040/OS2/config.h
  31. *** perl-3.0@40/os2/config.h    Sun Oct 28 15:40:02 1990
  32. --- perl3040/os2/config.h    Thu Nov 15 22:16:00 1990
  33. ***************
  34. *** 235,241 ****
  35. X   *    This symbol, if defined, indicates that ndbm.h exists and should
  36. X   *    be included.
  37. X   */
  38. ! /*#define    NDBM        /**/
  39. X  
  40. X  /* ODBM:
  41. X   *    This symbol, if defined, indicates that dbm.h exists and should
  42. --- 235,241 ----
  43. X   *    This symbol, if defined, indicates that ndbm.h exists and should
  44. X   *    be included.
  45. X   */
  46. ! #define    NDBM        /**/
  47. X  
  48. X  /* ODBM:
  49. X   *    This symbol, if defined, indicates that dbm.h exists and should
  50. ***************
  51. *** 494,500 ****
  52. X  #ifdef OS2
  53. X  #define SIG_NAME "ZERO","HUP","INT","QUIT","ILL","TRAP","IOT","EMT","FPE",\
  54. X        /*      0      1     2     3      4      5     6     7    8 */\
  55. !    "KILL","BUS","SEGV","SYS","PIPE","ALRM","TERM","USR1","USR2","CLD",\
  56. X    /* 9     10     11    12    13     14     15     16     17    18 */\
  57. X     "PWR","USR3","BREAK","ABRT"
  58. X    /*19     20     21    22   */
  59. --- 494,500 ----
  60. X  #ifdef OS2
  61. X  #define SIG_NAME "ZERO","HUP","INT","QUIT","ILL","TRAP","IOT","EMT","FPE",\
  62. X        /*      0      1     2     3      4      5     6     7    8 */\
  63. !    "KILL","BUS","SEGV","SYS","PIPE","UALRM","TERM","ALRM","USR2","CLD",\
  64. X    /* 9     10     11    12    13     14     15     16     17    18 */\
  65. X     "PWR","USR3","BREAK","ABRT"
  66. X    /*19     20     21    22   */
  67. diff -cbBwr perl-3.0@40/os2/eg/os2.pl perl3040/OS2/EG/os2.pl
  68. *** perl-3.0@40/os2/eg/os2.pl    Sun Oct 28 15:40:02 1990
  69. --- perl3040/os2/eg/os2.pl    Thu Nov 15 22:07:24 1990
  70. ***************
  71. *** 1,4 ****
  72. --- 1,5 ----
  73. X  extproc C:\binp\misc\perl.exe -S
  74. + #!perl
  75. X  
  76. X  # os2.pl:  Demonstrates the OS/2 system calls and shows off some of the
  77. X  # features in common with the UNIX version.
  78. diff -cbBwr perl-3.0@40/os2/perl.bad perl3040/OS2/perl.bad
  79. *** perl-3.0@40/os2/perl.bad    Wed Nov 14 23:39:52 1990
  80. --- perl3040/os2/perl.bad    Thu Nov 15 20:02:04 1990
  81. ***************
  82. *** 5,7 ****
  83. --- 5,8 ----
  84. X  DOSSETPRTY
  85. X  DOSGETPRTY
  86. X  DOSQFSATTACH
  87. + DOSCREATETHREAD
  88. diff -cbBwr perl-3.0@40/os2/perl.cs perl3040/OS2/perl.cs
  89. *** perl-3.0@40/os2/perl.cs    Wed Nov 14 23:39:54 1990
  90. --- perl3040/os2/perl.cs    Thu Nov 15 20:00:08 1990
  91. ***************
  92. *** 3,11 ****
  93. X  hash.c perl.c perly.c regcomp.c regexec.c stab.c str.c util.c
  94. X  )
  95. X  (-W1 -Od -Olt -B2C2L -B3C3L -DDEBUGGING eval.c{evalargs.xc} toke.c)
  96. ! (-W1 -Od -Olt -I.
  97. ! os2\os2.c os2\popen.c os2\mktemp.c os2\director.c os2\suffix.c
  98. X  )
  99. X  
  100. X  setargv.obj
  101. X  os2\perl.def
  102. --- 3,15 ----
  103. X  hash.c perl.c perly.c regcomp.c regexec.c stab.c str.c util.c
  104. X  )
  105. X  (-W1 -Od -Olt -B2C2L -B3C3L -DDEBUGGING eval.c{evalargs.xc} toke.c)
  106. ! (-W1 -Od -Olt -I. -Ios2
  107. ! os2\os2.c os2\popen.c os2\mktemp.c os2\director.c os2\suffix.c os2\alarm.c
  108. X  )
  109. + ; link with this library if you have GNU gdbm for OS/2
  110. + ; remember to enable the NDBM symbol in config.h before compiling
  111. + lgdbm.lib
  112. X  
  113. X  setargv.obj
  114. X  os2\perl.def
  115. diff -cbBwr perl-3.0@40/os2/perl.def perl3040/OS2/perl.def
  116. *** perl-3.0@40/os2/perl.def    Wed Nov 14 23:39:56 1990
  117. --- perl3040/os2/perl.def    Thu Nov 15 18:36:58 1990
  118. ***************
  119. *** 1,2 ****
  120. X  NAME PERL WINDOWCOMPAT NEWFILES
  121. ! DESCRIPTION 'PERL 3.0, patchlevel 37 - for MS-DOS and OS/2'
  122. --- 1,2 ----
  123. X  NAME PERL WINDOWCOMPAT NEWFILES
  124. ! DESCRIPTION 'PERL 3.0 - for MS-DOS and OS/2'
  125. diff -cbBwr perl-3.0@40/os2/README.OS2 perl3040/OS2/readme.os2
  126. *** perl-3.0@40/os2/readme.os2    Wed Nov 14 23:38:50 1990
  127. --- perl3040/os2/readme.os2    Thu Nov 15 22:31:56 1990
  128. ***************
  129. *** 325,330 ****
  130. --- 325,332 ----
  131. X  os2.c             kernel of OS/2 port (see below)
  132. X  popen.c           new popen.c
  133. X  mktemp.c          enhanced mktemp(), uses TMP env. variable, used by popen.c
  134. + alarm.c           PD implementation for alarm()
  135. + alarm.h          header for alarm.c
  136. X  
  137. X  perl.cs           Compiler Shell script for perl itself
  138. X  perl.def          linker definition file for perl
  139. ***************
  140. *** 375,380 ****
  141. --- 378,395 ----
  142. X  + I am not shure if I can verify the OS/2 port with each release
  143. X    from Larry Wall. Therefore, in future releases there may be
  144. X    changes required to compile perl for OS/2.
  145. X                  October 1990
  146. +                                 Kai Uwe Rommel
  147. +                                 rommel@lan.informatik.tu-muenchen.dbp.de
  148. + Verified patchlevel 40.
  149. + Some bugs were fixed. Added alarm() support (using PD implementation).
  150. +                 November 1990
  151. X                                  Kai Uwe Rommel
  152. X                                  rommel@lan.informatik.tu-muenchen.dbp.de
  153. diff -cbBwr perl-3.0@40/os2/suffix.c perl3040/OS2/suffix.c
  154. *** perl-3.0@40/os2/suffix.c    Sun Oct 28 15:40:04 1990
  155. --- perl3040/os2/suffix.c    Thu Nov 15 19:01:40 1990
  156. ***************
  157. *** 134,146 ****
  158. X  
  159. X      switch(DosOpen(s, &hf, &usAction, 0L, 0, FILE_OPEN,
  160. X      OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, 0L)) {
  161. X      case NO_ERROR:
  162. X      DosClose(hf);
  163. X      /*FALLTHROUGH*/
  164. X      default:
  165. X      return 1;
  166. -     case ERROR_FILENAME_EXCED_RANGE:
  167. -     return 0;
  168. X      }
  169. X  }
  170. X  #endif /* OS2 */
  171. --- 134,147 ----
  172. X  
  173. X      switch(DosOpen(s, &hf, &usAction, 0L, 0, FILE_OPEN,
  174. X      OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, 0L)) {
  175. +     case ERROR_INVALID_NAME:
  176. +     case ERROR_FILENAME_EXCED_RANGE:
  177. +     return 0;
  178. X      case NO_ERROR:
  179. X      DosClose(hf);
  180. X      /*FALLTHROUGH*/
  181. X      default:
  182. X      return 1;
  183. X      }
  184. X  }
  185. X  #endif /* OS2 */
  186. SHAR_EOF
  187. chmod 0666 perl3040.dif ||
  188. echo 'restore of perl3040.dif failed'
  189. Wc_c="`wc -c 'perl3040.dif'`"
  190. test 5436 -eq "$Wc_c" ||
  191.     echo 'perl3040.dif: original size 5436, current size' "$Wc_c"
  192. fi
  193. # ============= alarm.c ==============
  194. if test -f 'alarm.c' -a X"$1" != X"-c"; then
  195.     echo 'x - skipping alarm.c (File already exists)'
  196. else
  197. echo 'x - extracting alarm.c (Text)'
  198. sed 's/^X//' << 'SHAR_EOF' > 'alarm.c' &&
  199. /*
  200. X * This software is Copyright 1989 by Jack Hudler.
  201. X *
  202. X * Permission is hereby granted to copy, reproduce, redistribute or otherwise
  203. X * use this software as long as: there is no monetary profit gained
  204. X * specifically from the use or reproduction or this software, it is not
  205. X * sold, rented, traded or otherwise marketed, and this copyright notice is
  206. X * included prominently in any copy made.
  207. X *
  208. X * The author make no claims as to the fitness or correctness of this software
  209. X * for any use whatsoever, and it is provided as is. Any use of this software
  210. X * is at the user's own risk.
  211. X *
  212. X */
  213. X
  214. /****************************** Module Header ******************************\
  215. * Module Name: alarm.c
  216. * Created    : 11-08-89
  217. * Author     : Jack Hudler  [jack@csccat.lonestar.org]
  218. * Copyright  : 1988 Jack Hudler.
  219. * Function   : Unix like alarm signal simulator.
  220. \***************************************************************************/
  221. X
  222. /* Tested using OS2 1.2 with Microsoft C 5.1 and 6.0. */
  223. X
  224. #define INCL_DOSPROCESS
  225. #define INCL_DOSSIGNALS
  226. #define INCL_DOS
  227. #include <os2.h>
  228. X
  229. #include <stdlib.h>
  230. #include <stdio.h>
  231. #include <signal.h>
  232. X
  233. #include "alarm.h"
  234. X
  235. #define ALARM_STACK 4096    /* This maybe over kill, but the page size is 4K */
  236. X
  237. static  PBYTE     pbAlarmStack;
  238. static  SEL       selAlarmStack;
  239. static  TID       tidAlarm;
  240. static  PID       pidMain;
  241. static  BOOL      bAlarmInit=FALSE;
  242. static  BOOL      bAlarmRunning=FALSE;
  243. static  USHORT    uTime;
  244. X
  245. static VOID FAR alarm_thread ( VOID )
  246. {
  247. X    while(1)
  248. X    {
  249. X      if (bAlarmRunning)
  250. X      {
  251. X        DosSleep(1000L);
  252. X        uTime--;
  253. X        if (uTime==0)
  254. X        {
  255. X          // send signal to the main process.. I could have put raise() here
  256. X          // however that would require the use of the multithreaded library,
  257. X          // and it does not contain raise()!
  258. X          // I tried it with the standard library, this signaled ok, but a
  259. X          // test printf in the signal would not work and even caused SEGV.
  260. X          // So I signal the process through OS/2 and then the process
  261. X          // signals itself.
  262. X          if (bAlarmRunning)
  263. X            DosFlagProcess(pidMain,FLGP_PID, PFLG_A,1);
  264. X          bAlarmRunning=FALSE;
  265. X        }
  266. X      }
  267. X      else
  268. X        DosSleep(500L);
  269. X    }
  270. }
  271. X
  272. static VOID PASCAL FAR AlarmSignal(USHORT usSigArg,USHORT usSigNum)
  273. {
  274. X    /*
  275. X     * this is not executed from the thread. The thread triggers Process
  276. X     * flag A which is in the main processes scope, this inturn triggers
  277. X     * (via the raise) SIGUSR1 which is defined to SIGALRM.
  278. X     */
  279. X    raise(SIGUSR1);
  280. }
  281. X
  282. static void alarm_init(void)
  283. {
  284. X    PFNSIGHANDLER pfnPrev;
  285. X    USHORT       pfAction;
  286. X    PIDINFO      pid;
  287. X
  288. X    bAlarmInit = TRUE;
  289. X
  290. X    if (!DosAllocSeg( ALARM_STACK, (PSEL) &selAlarmStack, SEG_NONSHARED ))
  291. X    {
  292. X      OFFSETOF(pbAlarmStack) = ALARM_STACK - 2;
  293. X      SELECTOROF(pbAlarmStack) = selAlarmStack;
  294. X      /* Create the thread */
  295. X      if (DosCreateThread( alarm_thread, &tidAlarm, pbAlarmStack ))
  296. X      {
  297. X        fprintf(stderr,"Alarm thread failed to start.\n");
  298. X        exit(1);
  299. X      }
  300. X      /* Setup the signal handler for Process Flag A */
  301. X      if (DosSetSigHandler(AlarmSignal,&pfnPrev,&pfAction,SIGA_ACCEPT,SIG_PFLG_A))
  302. X      {
  303. X        fprintf(stderr,"SigHandler Failed to install.\n");
  304. X        exit(1);
  305. X      }
  306. X      /* Save main process ID, we'll need it for triggering the signal */
  307. X      DosGetPID(&pid);
  308. X      pidMain = pid.pid;
  309. X    }
  310. X    else
  311. X      exit(1);
  312. }
  313. X
  314. unsigned alarm(unsigned sec)
  315. {
  316. X    if (!bAlarmInit) alarm_init();
  317. X
  318. X    if (sec)
  319. X    {
  320. X      uTime = sec;
  321. X      bAlarmRunning = TRUE;
  322. X    }
  323. X    else
  324. X      bAlarmRunning = FALSE;
  325. X
  326. X    return 0;
  327. }
  328. X
  329. #ifdef TESTING
  330. /* A simple test to see if it works */
  331. BOOL  x;
  332. X
  333. void timeout(void)
  334. {
  335. X    fprintf(stderr,"ALARM TRIGGERED!!\n");
  336. X    DosBeep(1000,500);
  337. X    x++;
  338. }
  339. X
  340. void main(void)
  341. {
  342. X    (void) signal(SIGALRM, timeout);
  343. X    (void) alarm(1L);
  344. X    printf("ALARM RUNNING!!\n");
  345. X    while(!x);
  346. }
  347. #endif
  348. SHAR_EOF
  349. chmod 0666 alarm.c ||
  350. echo 'restore of alarm.c failed'
  351. Wc_c="`wc -c 'alarm.c'`"
  352. test 3943 -eq "$Wc_c" ||
  353.     echo 'alarm.c: original size 3943, current size' "$Wc_c"
  354. fi
  355. # ============= alarm.h ==============
  356. if test -f 'alarm.h' -a X"$1" != X"-c"; then
  357.     echo 'x - skipping alarm.h (File already exists)'
  358. else
  359. echo 'x - extracting alarm.h (Text)'
  360. sed 's/^X//' << 'SHAR_EOF' > 'alarm.h' &&
  361. #define SIGALRM SIGUSR1
  362. unsigned alarm(unsigned);
  363. SHAR_EOF
  364. chmod 0666 alarm.h ||
  365. echo 'restore of alarm.h failed'
  366. Wc_c="`wc -c 'alarm.h'`"
  367. test 50 -eq "$Wc_c" ||
  368.     echo 'alarm.h: original size 50, current size' "$Wc_c"
  369. fi
  370. # ============= alarm.pl ==============
  371. if test -f 'alarm.pl' -a X"$1" != X"-c"; then
  372.     echo 'x - skipping alarm.pl (File already exists)'
  373. else
  374. echo 'x - extracting alarm.pl (Text)'
  375. sed 's/^X//' << 'SHAR_EOF' > 'alarm.pl' &&
  376. sub handler {
  377. X  local($sig) = @_;
  378. X  print "Caught a SIG-$sig -- shutting down\n";
  379. X  exit(0);
  380. }
  381. X
  382. $SIG{'INT'} = 'handler';
  383. $SIG{'QUIT'} = 'handler';
  384. $SIG{'ALRM'} = 'handler';
  385. X
  386. print "Starting execution ...\n";
  387. X
  388. alarm(5);
  389. X
  390. while ( <> ) {
  391. }
  392. X
  393. print "Normal exit.\n";
  394. SHAR_EOF
  395. chmod 0666 alarm.pl ||
  396. echo 'restore of alarm.pl failed'
  397. Wc_c="`wc -c 'alarm.pl'`"
  398. test 262 -eq "$Wc_c" ||
  399.     echo 'alarm.pl: original size 262, current size' "$Wc_c"
  400. fi
  401. exit 0
  402.