home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / fileutils / split_join / join / joinN_form < prev    next >
Encoding:
Text File  |  1995-10-01  |  2.3 KB  |  96 lines

  1. ;This file is freeware copyright (c) MUFTI
  2. ;written with TLA 
  3. ;formula is preprocessor and M4 is the preprocessor of the preprocessor 8-)
  4.  B start
  5. ; formulaconfiguration:
  6. ; formulatempregistersave  FALSE
  7. ; formulastackregistersave FALSE 
  8. ; formulastacklength       100.
  9. ;M4-commands
  10. ;define(filenamelength,255)
  11. ;define(commandlinelength,255) 
  12. ;define(argvindex,R8)
  13. ;define(commandlineindex,R9) 
  14.  
  15. ; program related data
  16.  ;CHAR filename[filenamelength+1]
  17.  .ALIGN
  18.  ;CHAR outfile[filenamelength+1]
  19.  .ALIGN
  20.  ;CHAR command[256] 
  21.  .ALIGN
  22.  ;CHAR commandline[commandlinelength+1]
  23.  .ALIGN
  24.  ;INT infilehandle
  25.  ;INT outfilehandle
  26.  
  27. ;DECLARE INT  bput2(INT filehandle,CHAR character)
  28.  
  29.  .MACRO bput2
  30.   LDR  R0,[stackregister,`#'%3]
  31.   LDR  R1,[stackregister,`#'%2]
  32.   SWI  OS_BPut
  33.  .ENDM  
  34.  
  35.  ;INCLUDE <formula$dir>.function_h
  36.  
  37.  
  38. start
  39.  
  40.  ;LET getargv(commandline)
  41.  ;LET commandlineindex=0
  42.  ;LET argvindex=0
  43.  
  44.  ;WHILE (commandline[commandlineindex]!=0)
  45.  
  46. ; skip spaces
  47.     ;WHILE ((commandline[commandlineindex]!=0) && (commandline[commandlineindex]==32))
  48.        ;LET commandlineindex=commandlineindex+1
  49.     ;ENDWHILE
  50.  
  51. ; copy argument
  52.     ;LET R3=0
  53.     ;WHILE ((commandline[commandlineindex]!=0) && (commandline[commandlineindex]!=32))
  54.        ;LET filename[R3]=commandline[commandlineindex]
  55.        ;LET R3=R3+1
  56.        ;LET commandlineindex=commandlineindex+1
  57.     ;ENDWHILE
  58.     ;LET filename[R3]=0
  59.     ;FREE R3
  60.  
  61.     ;IF (argvindex==1)
  62.        ;LET outfilehandle=open(filename)
  63.        ;LET close(outfilehandle)
  64.        ;LET strcpy(command,"DELETE ")
  65.        ;LET strcat(command,filename)
  66.        ;LET system(command);
  67.        ;LET outfilehandle=open(filename)
  68.     ;ENDIF
  69.     
  70.     ;IF ((argvindex>1) && (filename[0]!=0))
  71.        ;LET infilehandle=open(filename)
  72.        ;WHILE (eof(infilehandle)==0)
  73.           ;LET bput2(outfilehandle,bget(infilehandle));
  74.        ;ENDWHILE
  75.        ;LET close(infilehandle)
  76.     ;ENDIF
  77.     
  78.     ;LET argvindex=argvindex+1
  79.  
  80.  ;ENDWHILE
  81.  
  82.  ;IF (argvindex<=1)  
  83.     ;LET writestr("syntax: join outputfile inputfile1 inputfile2 ... inputfileN")
  84.     cr
  85.     ;LET writestr("joinNoTask N inputfiles into outputfile")
  86.     cr
  87.     ;LET writestr("this program do not cooperative wimp-\"multitasking\"")
  88.     cr
  89.     ;LET writestr("This file is Freeware Copyright (c) MUFTI")
  90.     cr
  91.  ;ENDIF
  92.  
  93.  ;LET close(outfilehandle)
  94.  SWI OS_Exit
  95.  .END
  96.