Browse Source

KNF function argument spacing

OPENBSD_3_1
todd 23 years ago
parent
commit
7eb606f8d6
1 changed files with 112 additions and 112 deletions
  1. +112
    -112
      src/etc/MAKEDEV.sub

+ 112
- 112
src/etc/MAKEDEV.sub View File

@ -1,4 +1,4 @@
dnl $OpenBSD: MAKEDEV.sub,v 1.5 2002/01/23 06:02:19 todd Exp $
dnl $OpenBSD: MAKEDEV.sub,v 1.6 2002/02/14 05:50:37 todd Exp $
dnl
dnl Copyright (c) 2001 Todd T. Fries <todd@OpenBSD.org>
dnl All rights reserved.
@ -30,7 +30,7 @@ dnl
dnl o First, a change of quote to make shell statements like: `command`
dnl possible
dnl
changequote(`{-',`-}')dnl
changequote(`{-', `-}')dnl
dnl
dnl o version info must be stripped of $ so we can say 'generated from' below
dnl
@ -45,62 +45,62 @@ dnl
dnl Initialize the stacks stored in _m4_*
dnl
undefine({-_m4_cvs_ver-})dnl
pushdef({-_m4_cvs_ver-},{-done-})dnl
pushdef({-_m4_cvs_ver-}, {-done-})dnl
dnl
undefine({-_m4_devs-})dnl
pushdef({-_m4_devs-},{-done-})dnl
pushdef({-_m4_devs-}, {-done-})dnl
dnl
undefine({-_m4_disks-})dnl
undefine({-_m4_disks2-})dnl
pushdef({-_m4_disks-},{-done-})dnl
pushdef({-_m4_disks2-},{-done-})dnl
pushdef({-_m4_disks-}, {-done-})dnl
pushdef({-_m4_disks2-}, {-done-})dnl
dnl
dnl define stack 'add to' functions, only unique names queued
dnl
define({-ver_q-},{-ifelse(index($1_ver,y),0,,
{-pushdef({-_m4_cvs_ver-},{-$2-})define({-$1_ver-},{-y-})-})-})dnl ver_q
define({-ver_q-}, {-ifelse(index($1_ver, y), 0, ,
{-pushdef({-_m4_cvs_ver-}, {-$2-})define({-$1_ver-}, {-y-})-})-})dnl ver_q
dnl
define({-dev_q-},{-ifelse(index(_q_$1_dev,:),0,
define({-dev_q-}, {-ifelse(index(_q_$1_dev, :), 0,
{-errprint({-duplicated dev id: $1 at -}__file__{-:-}__line__ originally at _q_$1_dev)-},
{-pushdef({-_m4_devs-},{-$1-})dnl
define({-_q_$1_dev-},{-:-}__file__{-:-}__line__)-})-})dnl dev_q
{-pushdef({-_m4_devs-}, {-$1-})dnl
define({-_q_$1_dev-}, {-:-}__file__{-:-}__line__)-})-})dnl dev_q
dnl
define({-disk_q-},{-ifelse(index(_q_$1_disk,:),0,
{-errprint({-duplicated disk id: $1 at -}__file__{-:-}__line__ originally at _q_$1_disk)-},{-pushdef({-_m4_disks-},{-$1-})dnl
pushdef({-_m4_disks2-},{-$1-})dnl
define({-_q_$1_disks-},{-:-}__file__{-:-}__line__)-})-})dnl disk_q
define({-disk_q-}, {-ifelse(index(_q_$1_disk, :), 0,
{-errprint({-duplicated disk id: $1 at -}__file__{-:-}__line__ originally at _q_$1_disk)-}, {-pushdef({-_m4_disks-}, {-$1-})dnl
pushdef({-_m4_disks2-}, {-$1-})dnl
define({-_q_$1_disks-}, {-:-}__file__{-:-}__line__)-})-})dnl disk_q
dnl
dnl store a version string for 'this' file
dnl
dnl vers ( uniqueidstring, versionstring, subdir )
dnl
dnl example1: vers(__file__,{-$OpenBSD: MAKEDEV.sub,v 1.5 2002/01/23 06:02:19 todd Exp $-})
dnl example2: vers(__file__,{-$OpenBSD: MAKEDEV.sub,v 1.5 2002/01/23 06:02:19 todd Exp $-},etc.MACHINE)
dnl example1: vers(__file__, {-$OpenBSD: MAKEDEV.sub,v 1.6 2002/02/14 05:50:37 todd Exp $-})
dnl example2: vers(__file__, {-$OpenBSD: MAKEDEV.sub,v 1.6 2002/02/14 05:50:37 todd Exp $-}, etc.MACHINE)
dnl
dnl if subdir is defined, prepend it to the filename in the version string
dnl
define({-vers-},
{-ifelse({-$3-},{--},
{-ver_q(hstcl({-$1-}),{-translit({-{-$2-}-},{-$-},{--})-})-},
{-ver_q(hstcl({-$1-}),{-_addsubdir({-{-$2-}-},$3)-})-})-})dnl
{-ifelse({-$3-}, {--},
{-ver_q(hstcl({-$1-}), {-translit({-{-$2-}-}, {-$-}, {--})-})-},
{-ver_q(hstcl({-$1-}), {-_addsubdir({-{-$2-}-}, $3)-})-})-})dnl
dnl
dnl Version info for this file:
dnl
vers(__file__,{-$OpenBSD: MAKEDEV.sub,v 1.5 2002/01/23 06:02:19 todd Exp $-})dnl
vers(__file__, {-$OpenBSD: MAKEDEV.sub,v 1.6 2002/02/14 05:50:37 todd Exp $-})dnl
dnl
dnl
define({-_addsubdir-},
{-patsubst({-$1-},{-\$(OpenBSD:) ([^\$]*)\$-},{-\1 $2/\2-})-})dnl
{-patsubst({-$1-}, {-\$(OpenBSD:) ([^\$]*)\$-}, {-\1 $2/\2-})-})dnl
dnl
dnl do the 'showing' of the version info
dnl
define({-do_vers-},{-# $1-})dnl
define({-do_vers-}, {-# $1-})dnl
dnl
dnl show version function, to be called at the place when all versions are
dnl queued, and it is time to show all of them
dnl
define({-show_vers-},
{-ifelse(_m4_cvs_ver,{-done-},{--},
{-ifelse(_m4_cvs_ver, {-done-}, {--},
{-do_vers(_m4_cvs_ver)
popdef({-_m4_cvs_ver-})dnl
show_vers()dnl
@ -108,7 +108,7 @@ show_vers()dnl
dnl
dnl show the routines to generate devices
define({-show_devs-},
{-ifelse(_m4_devs,{-done-},{--},
{-ifelse(_m4_devs, {-done-}, {--},
{-_MKDEV(_m4_devs){--}dnl
popdef({-_m4_devs-})dnl
show_devs()dnl
@ -116,14 +116,14 @@ show_devs()dnl
dnl
dnl routines to generate disks
define({-show_disks-},
{-ifelse(_m4_disks,{-done-},{--},
{-ifcase(_m4_disks,_m4_disks{--}*)dnl
{-ifelse(_m4_disks, {-done-}, {--},
{-ifcase(_m4_disks, _m4_disks{--}*)dnl
popdef({-_m4_disks-})dnl
show_disks()dnl
-})-})dnl
dnl
define({-show_disks2-},
{-ifelse(_m4_disks2,{-done-},{--},
{-ifelse(_m4_disks2, {-done-}, {--},
{-CasE(_m4_disks2)dnl
popdef({-_m4_disks2-})dnl
show_disks2()dnl
@ -132,8 +132,8 @@ dnl
dnl
dnl Some m4 math functions:
dnl
dnl Add(a,b) - displays the result of a+b
dnl Mult(a,b) - displays the result of a*b
dnl Add(a, b) - displays the result of a+b
dnl Mult(a, b) - displays the result of a*b
dnl trunc a b - displays the string a minus b removed from the RHS
dnl hex a - displays the hex equivalent of 0-15
dnl unt a - s/[a-z]*([0-9]*).*/\1/ aka sd0a -> 0
@ -142,16 +142,16 @@ dnl Functions:
dnl
dnl --> Addition
dnl
define({-Add-},{-$({-(-}$1+$2{-)-})-})dnl
define({-Add-}, {-$({-(-}$1+$2{-)-})-})dnl
dnl
dnl --> Multiplication
dnl
define({-Mult-},{-$({-(-}$1*$2{-)-})-})dnl
define({-Mult-}, {-$({-(-}$1*$2{-)-})-})dnl
dnl
dnl
dnl TRUNC
dnl
define({-expr_trunc-},{-$1trunc()
define({-expr_trunc-}, {-$1trunc()
$1{
$1 case {-$-}3 in
$1 l) {-expr-} {-$-}1 : '\(.*\)'{-$-}2 ;;
@ -160,89 +160,89 @@ $1 esac
$1}-})dnl
dnl
dnl
define({-_SHELL-},{-sh-})dnl
define({-_this-},{-{-$-}T-})dnl
dnl define({-_recurse-},{-_SHELL _this-})dnl
define({-_recurse-},{-R-})dnl
define({-_SHELL-}, {-sh-})dnl
define({-_this-}, {-{-$-}T-})dnl
dnl define({-_recurse-}, {-_SHELL _this-})dnl
define({-_recurse-}, {-R-})dnl
dnl
dnl _devitem(pattern,description)
dnl _devitem(pattern, description)
dnl
define({-_devitem-},
{-{-#-} $1 {-$2-}-})dnl
dnl
dnl _devtitle(description)
dnl
define({-_devtitle-},{-{-#-} $1:-})dnl
define({-_devtitle-}, {-{-#-} $1:-})dnl
dnl
dnl _DEV(name,[character major],[block major])
dnl _DEV(name, [character major], [block major])
dnl
define({-_DEV-},{-$1_dev{--}dnl
define({-_DEV-}, {-$1_dev{--}dnl
dnl
dnl _DEV 'ifelse' .. $2 - major_$1_c
dnl
ifelse($2,,,{-define(major_$1_c,$2)-})dnl
ifelse($2, , , {-define(major_$1_c, $2)-})dnl
dnl
dnl _DEV 'ifelse' .. $3 - major_$1_b
dnl
ifelse($3,,,{-define(major_$1_b,$3)-})dnl
ifelse($3, , , {-define(major_$1_b, $3)-})dnl
dnl
dnl _DEV 'ifelse' .. $4 - step_$1
dnl
ifelse($4,,,{-define(step_$1,{-$4-})-})dnl
ifelse($4, , , {-define(step_$1, {-$4-})-})dnl
dnl
dnl Some magic here, defining a devitem also defines another
dnl string so that later we can check if a particular devitem was
dnl defined, and thus determine if the devices themselves are to
dnl be built
dnl
define({-$1__DEV-},{-Y-})dnl
define({-$1__DEV-}, {-Y-})dnl
dnl
dnl More magic, put device string name into a queue of script segments to
dnl be shown later if it has been defined as a device in MAKEDEV.mi
dnl
ifdef({-$1_mkdev-},{-__mkdev({-$1-})-})dnl
ifdef({-$1_mkdev-}, {-__mkdev({-$1-})-})dnl
dnl
dnl
-})dnl _DEV
dnl
dnl
define({-ifdev-},{-ifelse($1__DEV,Y,{-$2-})-})dnl
define({-ifdev-}, {-ifelse($1__DEV, Y, {-$2-})-})dnl
dnl
define({-_MKDEV-},{-$1_mkdev-})dnl
define({-_TITLE-},{-$1_title-})dnl
define({-__devitem-},{-define($1_dev,{-_devitem($2,$3)-})$4-})dnl
define({-__devtitle-},{-define($1_title,{-_devtitle($2)-})-})dnl
define({-_MKDEV-}, {-$1_mkdev-})dnl
define({-_TITLE-}, {-$1_title-})dnl
define({-__devitem-}, {-define($1_dev, {-_devitem($2, $3)-})$4-})dnl
define({-__devtitle-}, {-define($1_title, {-_devtitle($2)-})-})dnl
dnl
dnl Beginning and ending of case entries, just incase we change in the
dnl future, save chasing things down again
dnl
define({-_end-},{-
define({-_end-}, {-
;;
-})dnl
define({-_beg-},{-{-)-}
define({-_beg-}, {-{-)-}
-})dnl
dnl
dnl create the script segment for making devices
dnl $1 $2 $3
dnl _mkdev(shortname,devpatt,action)dnl
define({-_mkdev-},{-define($1_mkdev,{-$2{--}_beg{--}$3{--}_end-})-})dnl
dnl _mkdev(shortname, devpatt, action)dnl
define({-_mkdev-}, {-define($1_mkdev, {-$2{--}_beg{--}$3{--}_end-})-})dnl
dnl
dnl define a major character device
dnl $1 $2 $3 $4
dnl _mcdev(shortname,devpatt,devbase,devmajor)dnl
dnl _mcdev(shortname, devpatt, devbase, devmajor)dnl
dnl
define({-_mcdev-},{-define($1_mkdev,{-{-$2-}_beg{--}M $3$U c $4 $U{--}dnl
ifelse($6,,ifelse($5,,,{- -}$5),{- -}ifelse($5,,600,$5){- -}$6){--}_end-})-})dnl
define({-_mcdev-}, {-define($1_mkdev, {-{-$2-}_beg{--}M $3$U c $4 $U{--}dnl
ifelse($6, , ifelse($5, , , {- -}$5), {- -}ifelse($5, , 600, $5){- -}$6){--}_end-})-})dnl
dnl
dnl $1 $2 $3 $4 $5 $6
dnl _cdev(shortname,devpatt,devmajor,devminor[,devmod,devgrp])dnl
dnl _cdev(shortname, devpatt, devmajor, devminor[, devmod, devgrp])dnl
define({-_cdev-},
{-dnl
define($1_mkdev,{-$2{--}_beg{--}M $2 c $3 $4 $5 $6{--}_end-}){--}-})dnl
define($1_mkdev, {-$2{--}_beg{--}M $2 c $3 $4 $5 $6{--}_end-}){--}-})dnl
dnl
dnl
define({-__mkdev-},{-dev_q($1)-})dnl
define({-__mkdev-}, {-dev_q($1)-})dnl
dnl
dnl for showing disks
dnl
@ -252,16 +252,16 @@ define({-CasE-},
-})-})dnl
dnl
dnl
define({-ifcase-},{-dnl
ifelse(C_ase,Y,ifdev({-$1-},{-|$2-}),
{-ifdev({-$1-},{-$2define({-C_ase-},Y)-})-})-})dnl
define({-ifcase-}, {-dnl
ifelse(C_ase, Y, ifdev({-$1-}, {-|$2-}),
{-ifdev({-$1-}, {-$2define({-C_ase-}, Y)-})-})-})dnl
dnl
dnl
dnl device list .. list devices 'iff' they are defined
dnl
dnl input:
dnl
dnl _dl({-usb-},{-usb0 usb1-},{-urio-},{-urio-},...)
dnl _dl({-usb-}, {-usb0 usb1-}, {-urio-}, {-urio-}, ...)
dnl
dnl output:
dnl
@ -270,44 +270,44 @@ dnl <tab>_recurse uhid0 uhid2 uhid3-}
dnl
dnl wrap if more than 60 chars wide
dnl
dnl .. wrap it all up in an 'ifelse({-$1-},,{- ... -})' for neatness ??
dnl .. wrap it all up in an 'ifelse({-$1-}, , {- ... -})' for neatness ??
dnl
define({-_dl-},{-dnl
ifdef({-_dt-},,{-define({-_dt-})-})dnl
ifdef({-_do-},,{-_dt{--}_recurse{--}define({-_do-},0)dnl
define({-_dt-},{- -})-})dnl
define({-_dl-}, {-dnl
ifdef({-_dt-}, , {-define({-_dt-})-})dnl
ifdef({-_do-}, , {-_dt{--}_recurse{--}define({-_do-}, 0)dnl
define({-_dt-}, {- -})-})dnl
ifdef({-$1__DEV-},
{-define({-_di-},{-$2-})-},
{-define({-_di-}, {-$2-})-},
{-define({-_di-})-})dnl
ifelse(eval(len(_di)+_do<60),1,
{-ifelse(eval(len(_di)>0),1,
{- _di{--}define({-_do-},eval(1+_do+len(_di)))-})-},
ifelse(eval(len(_di)+_do<60), 1,
{-ifelse(eval(len(_di)>0), 1,
{- _di{--}define({-_do-}, eval(1+_do+len(_di)))-})-},
{-
_dt{--}_recurse _di{--}dnl
define({-_do-},len(_di))-})dnl
ifelse({-$3-},{--},
{-undefine({-_dt-},{-_do-})-},dnl <--- The END
define({-_do-}, len(_di))-})dnl
ifelse({-$3-}, {--},
{-undefine({-_dt-}, {-_do-})-}, dnl <--- The END
{-_dl(shift(shift($@)))-})-})dnl
dnl
dnl
define({-_show_target-},{-dnl
ifdef({-$1__DEV-},{-disp_dev({-$2-})-})dnl
ifelse({-$3-},{--},
{-_disp_dev_end()-},dnl <--- The END
define({-_show_target-}, {-dnl
ifdef({-$1__DEV-}, {-disp_dev({-$2-})-})dnl
ifelse({-$3-}, {--},
{-_disp_dev_end()-}, dnl <--- The END
{-_show_target(shift(shift($@)))-})-})dnl
dnl
define({-disp_dev-},{-dnl
ifdef({-_disp_dev_tab-},,{-define({-_disp_dev_tab-})-})dnl
ifdef({-_disp_dev_len-},,{-dnl
define({-_disp_dev_len-},0)dnl
define({-disp_dev-}, {-dnl
ifdef({-_disp_dev_tab-}, , {-define({-_disp_dev_tab-})-})dnl
ifdef({-_disp_dev_len-}, , {-dnl
define({-_disp_dev_len-}, 0)dnl
_disp_dev_tab{--}_recurse{--}dnl
define({-_disp_dev_tab-},{- -})-})dnl
ifelse(eval(len($1)+_disp_dev_len<60),1,
{- $1{--}define({-_disp_dev_len-},eval(1+_disp_dev_len+len($1)))-},{-
define({-_disp_dev_tab-}, {- -})-})dnl
ifelse(eval(len($1)+_disp_dev_len<60), 1,
{- $1{--}define({-_disp_dev_len-}, eval(1+_disp_dev_len+len($1)))-}, {-
_disp_dev_tab{--}_recurse $1{--}dnl
define({-_disp_dev_len-},len($1))-})dnl
define({-_disp_dev_len-}, len($1))-})dnl
-})dnl
define({-_disp_dev_end-},{-undefine({-_disp_dev_tab-},{-_disp_dev_len-})-})dnl
define({-_disp_dev_end-}, {-undefine({-_disp_dev_tab-}, {-_disp_dev_len-})-})dnl
dnl
dnl A word about the above:
dnl
@ -326,51 +326,51 @@ dnl
dnl ifstep(devstr)
dnl .. if stepping is defined for the particular device, emit ' step', else
dnl nothing
define({-ifstep-},{-ifdef({-step_$1-},{- -}step_$1{--})-})dnl
define({-ifstep-}, {-ifdef({-step_$1-}, {- -}step_$1{--})-})dnl
dnl
dnl
define({-target-},{-twrget({-$1-},{-$2-},{-$2-},shift(shift($@)))-})dnl
define({-target-}, {-twrget({-$1-}, {-$2-}, {-$2-}, shift(shift($@)))-})dnl
dnl
dnl twrget(target,devname,prefix,str1,str2,str3)
dnl twrget(target, devname, prefix, str1, str2, str3)
dnl $1 $2 $3 $4 $5 $6
dnl
define({-twrget-},{-dnl
define({-twrget-}, {-dnl
dnl
ifdef({-$1_target-},,{-pushdef({-$1_target-},{-done-})-})dnl
ifdef({-$1_target-}, , {-pushdef({-$1_target-}, {-done-})-})dnl
dnl
ifelse({-$4-},,,{-dnl
ifelse({-$4-},{-_done-},,{-dnl
ifelse({-$5-},,,{-dnl
dnl errprint({-recurse: $1,$2,$3,$4,$5,$6,...-})dnl
twrget({-$1-},{-$2-},{-$3-},shift(shift(shift(shift($@)))))dnl
ifelse({-$4-}, , , {-dnl
ifelse({-$4-}, {-_done-}, , {-dnl
ifelse({-$5-}, , , {-dnl
dnl errprint({-recurse: $1, $2, $3, $4, $5, $6, ...-})dnl
twrget({-$1-}, {-$2-}, {-$3-}, shift(shift(shift(shift($@)))))dnl
-})-})-})dnl
dnl
ifelse({-$4-},{-_done-},,{-dnl
dnl errprint({-recurse: $1_$2_dev,$3$4,$3$4,_done-})dnl
twrget({-$1_$2_dev-},{-$3$4-},{-$3$4-},{-_done-})dnl
ifelse({-$4-}, {-_done-}, , {-dnl
dnl errprint({-recurse: $1_$2_dev, $3$4, $3$4, _done-})dnl
twrget({-$1_$2_dev-}, {-$3$4-}, {-$3$4-}, {-_done-})dnl
-})dnl
dnl
ifdef({-$1$2target-},,{-dnl
pushdef({-$1_target-},{-$2-})define({-$1$2target-})dnl
ifdef({-$1$2target-}, , {-dnl
pushdef({-$1_target-}, {-$2-})define({-$1$2target-})dnl
-})dnl
dnl
-})dnl
dnl
dnl
define({-show_target-},{-dnl
ifelse($1_target,{-done-},{-_disp_dev_end()-},
define({-show_target-}, {-dnl
ifelse($1_target, {-done-}, {-_disp_dev_end()-},
{-dnl $1_target:
show_dev($1,-}$1_target{-)dnl
show_dev($1, -}$1_target{-)dnl
popdef({-$1_target-})dnl
show_target({-$1-})dnl
-})-})dnl
dnl
define({-show_dev-},{-dnl
ifdef({-$2__DEV-},{-dnl
ifelse($1_$2_dev_target,{-done-},,{-dnl
define({-show_dev-}, {-dnl
ifdef({-$2__DEV-}, {-dnl
ifelse($1_$2_dev_target, {-done-}, , {-dnl
disp_dev({-$1_$2_dev_target-})dnl
popdef({-$1_$2_dev_target-})dnl
show_dev({-$1-},{-$2-})-})dnl
show_dev({-$1-}, {-$2-})-})dnl
-})dnl
-})dnl
dnl

Loading…
Cancel
Save