;;; --- University of Sussex POPLOG file -----------------------------------
;;; File:           $usepop/master/C.all/lisp/flib/f_cconvert.p
;;; Purpose:        Format print - CASE-CONVERSION     ~(...~)
;;; Author:         John Williams, ???
;;; Documentation:  HELP * FORMAT_PRINT
;;; Related Files:	LIB * FORMAT_PRINT

uses format_print;
section $-lisp$-fpr;

procedure;
    vars cucharout f_endchar;
    if f_colon and f_at then
       ;;; UPPERCASE OUTPUT
        procedure(c, outchar);
            lvars c procedure outchar;
            outchar(lowertoupper(c))
        endprocedure(% cucharout %)
    elseif f_at then
       ;;; FIRST LETTER UPPERCASE, THE REST LOWERCASE
        procedure(c, outchar, convert);
            lvars c procedure outchar convert;
            outchar(fast_cont(convert)(c));
            uppertolower -> fast_cont(convert)
        endprocedure(% cucharout, consref(lowertoupper) %)
    elseif f_colon then
       ;;; CAPITALISE EACH "WORD"
        procedure(c, outchar, convert);
            lvars c procedure outchar convert;
            outchar(fast_cont(convert)(c));
            if isalphacode(c) or isnumbercode(c) then
                uppertolower
            else
                lowertoupper
            endif -> fast_cont(convert)
        endprocedure(% cucharout, consref(lowertoupper) %)
    else
       ;;; LOWERCASE OUTPUT
        procedure(c, outchar);
            lvars c procedure outchar;
            outchar(uppertolower(c))
        endprocedure(% cucharout %)
    endif -> cucharout;
    `)` -> f_endchar;
    next_f_char();
    do_fpr()
endprocedure -> f_proc(`(`);

copy(check_need_bracket) -> f_proc(`)`);

endsection;
