; ; =========================================================================== ; = = ; = (C) Copyright 1991 The Trustees of Indiana University = ; = = ; = Permission to use, copy, modify, and distribute this program for = ; = any purpose and without fee is hereby granted, provided that this = ; = copyright and permission notice appear on all copies and supporting = ; = documentation, the name of Indiana University not be used in = ; = advertising or publicity pertaining to distribution of the program = ; = without specific prior permission, and notice be given in supporting = ; = documentation that copying and distribution is by permission of = ; = Indiana University. = ; = = ; = Indiana University makes no representations about the suitability of = ; = this software for any purpose. It is provided "as is" without express = ; = or implied warranty. = ; = = ; =========================================================================== ; = = ; = File: = ; = CHANGE_CASE.MAR = ; = By M. Darrin Chaney = ; = = ; = Synopsis: = ; = These functions (upper, lower) force case on a null-terminated = ; = string. Both take a single argument, a pointer to the null- = ; = terminated string. String length is limited to 65535 characters. = ; = If there is an error, it will be signaled. Return is the address = ; = of the string, or null if no argument is passed in. = ; = = ; = Authors: = ; = Jacob Levanon & Larry Hughes = ; = Indiana University = ; = University Computing Services, Network Applications = ; = = ; = Credits: = ; = This software is based on the Post Office Protocol version 3, = ; = as implemented by the University of California at Berkeley. = ; = = ; =========================================================================== ; .Title Change_case Upper/Lowercase conversion .Ident 'V01-00' .NoShow MEB,ME ; .Macro MakeBytes low,high c=low .Repeat high-low+1 .Byte c c=c+1 .EndR .EndM MakeBytes .PSect Data_NoWrt,Long,NoWrt,Shr,PIC To_Upper_String: MakeBytes <^X0>,<^X60> ;all things below lowercase MakeBytes <^A/A/>,<^A/Z/> ;lowercase replaced by upper MakeBytes <^X7B>,<^XFF> ;everthing else To_Lower_String: MakeBytes <^X0>,<^X40> ;all things below uppercase MakeBytes <^A/a/>,<^A/z/> ;uppercase replaced by lower MakeBytes <^X5B>,<^XFF> ;everything else .PSect Code,Long,NoWrt,Shr,PIC .Entry Upper,^M TstB (AP) ;any args? BEql Eek ;if not, return insfarg MovTUC #65535,@4(AP),S^#0,To_Upper_String, - ;translate to uppercase #65535,@4(AP) ;with as terminator MovL 4(AP),R0 ;good return Ret ;return .Entry Lower,^M TstB (AP) ;any args? BEql Eek ;if not, return insfarg MovTUC #65535,@4(AP),S^#0,To_Lower_String, - ;translate to lowercase #65535,@4(AP) ;with as terminator MovL 4(AP),R0 ;good return Ret ;return Eek: ClrL R0 ;bad return Ret ;return with error condition .End