home *** CD-ROM | disk | FTP | other *** search
- ;This file is freeware copyright (c) MUFTI
- ;written with TLA
- ;formula is preprocessor and M4 is the preprocessor of the preprocessor 8-)
- B start
- ; formulaconfiguration:
- ; formulatempregistersave FALSE
- ; formulastackregistersave FALSE
- ; formulastacklength 100.
- ;M4-commands
- ;define(filenamelength,255)
- ;define(commandlinelength,255)
- ;define(argvindex,R8)
- ;define(commandlineindex,R9)
-
- ; program related data
- ;CHAR filename[filenamelength+1]
- .ALIGN
- ;CHAR outfile[filenamelength+1]
- .ALIGN
- ;CHAR command[256]
- .ALIGN
- ;CHAR commandline[commandlinelength+1]
- .ALIGN
- ;INT infilehandle
- ;INT outfilehandle
-
- ;DECLARE INT bput2(INT filehandle,CHAR character)
-
- .MACRO bput2
- LDR R0,[stackregister,`#'%3]
- LDR R1,[stackregister,`#'%2]
- SWI OS_BPut
- .ENDM
-
- ;INCLUDE <formula$dir>.function_h
-
-
- start
-
- ;LET getargv(commandline)
- ;LET commandlineindex=0
- ;LET argvindex=0
-
- ;WHILE (commandline[commandlineindex]!=0)
-
- ; skip spaces
- ;WHILE ((commandline[commandlineindex]!=0) && (commandline[commandlineindex]==32))
- ;LET commandlineindex=commandlineindex+1
- ;ENDWHILE
-
- ; copy argument
- ;LET R3=0
- ;WHILE ((commandline[commandlineindex]!=0) && (commandline[commandlineindex]!=32))
- ;LET filename[R3]=commandline[commandlineindex]
- ;LET R3=R3+1
- ;LET commandlineindex=commandlineindex+1
- ;ENDWHILE
- ;LET filename[R3]=0
- ;FREE R3
-
- ;IF (argvindex==1)
- ;LET outfilehandle=open(filename)
- ;LET close(outfilehandle)
- ;LET strcpy(command,"DELETE ")
- ;LET strcat(command,filename)
- ;LET system(command);
- ;LET outfilehandle=open(filename)
- ;ENDIF
-
- ;IF ((argvindex>1) && (filename[0]!=0))
- ;LET infilehandle=open(filename)
- ;WHILE (eof(infilehandle)==0)
- ;LET bput2(outfilehandle,bget(infilehandle));
- ;ENDWHILE
- ;LET close(infilehandle)
- ;ENDIF
-
- ;LET argvindex=argvindex+1
-
- ;ENDWHILE
-
- ;IF (argvindex<=1)
- ;LET writestr("syntax: join outputfile inputfile1 inputfile2 ... inputfileN")
- cr
- ;LET writestr("joinNoTask N inputfiles into outputfile")
- cr
- ;LET writestr("this program do not cooperative wimp-\"multitasking\"")
- cr
- ;LET writestr("This file is Freeware Copyright (c) MUFTI")
- cr
- ;ENDIF
-
- ;LET close(outfilehandle)
- SWI OS_Exit
- .END
-