summaryrefslogtreecommitdiffstats
path: root/doc/new_chapters/gen_section
blob: d3b8bde58f112a177f36e4a855b04b3f1c569147 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#
#  This shell script generates the starting template for a manager chapter.
#


# Set this based on which chapter you want to generate a template for.
chapter=$1

case ${chapter} in 
  process)
    CHAPTER_CAPS="Process Creation and Execution"
    CHAPTER_LOWER="process creation and execution"
    ROUTINES="fork execl execv execle execve execlp execvp pthread_atfork \
      wait waitpid _exit"
    ;;
  procenv)
    CHAPTER_CAPS="Process Environment"
    CHAPTER_LOWER="process environment"
    ROUTINES="getpid getppid getuid geteuid getgid getegid setuid setgid \
      getgroups getlogin getlogin_r getpgrp setsid setpgid uname times \
      getenv ctermid ttyname ttyname_r isatty sysconf "
    ;;
  files)
    CHAPTER_CAPS="Files and Directories"
    CHAPTER_LOWER="files and directories"
    ROUTINES="opendir readdir readdir_r rewinddir closedir \
       chdir getcwd open creat umask link mkdir mkfifo unlink \
       rmdir rename stat fstat access chmod fchmod chown \
       utime ftrunctate pathconf fpathconf"
    ;;
  io)
    CHAPTER_CAPS="Input and Output Primitives"
    CHAPTER_LOWER="input and output primitives"
    ROUTINES="pipe dup dup2 close read write fcntl lseek fsynch fdatasynch \
       aio_read aio_write lio_listio aio_error aio_return aio_cancel \
       aio_suspend aio_fsync"
    ;;
  device)
    CHAPTER_CAPS="Device- and Class- Specific Functions"
    CHAPTER_LOWER="device- and class- specific functions"
    ROUTINES="cfgetispeed cfgetospeed cfsetispeed cfsetospeed tcgetattr \
       tcsetattr tcsendbreak tcdrain tcflush tcflow tcgetpgrp tcsetpgrp"
    ;;
  cspecific)
    CHAPTER_CAPS="Language-Specific Services for the C Programming Language"
    CHAPTER_LOWER="language-specific services for the C programming language"
    ROUTINES="setlocale fileno fdopen flcokfile ftrylockfile funlockfile \
       getc_unlocked getchar_unlocked putc_unlocked putchar_unlocked \
       setjmp longjmp sigsetjmp siglongjmp tzset strtok_r asctime_r \
       ctime_r gmtime_r localtime_r rand_r"
    ;;
  systemdb)
    CHAPTER_CAPS="System Databases"
    CHAPTER_LOWER="system databases"
    ROUTINES="getgrgid getgrgid_r getgrnam getgrnam_r getpwuid getpwuid_r \
       getpwnam getpwnam_r"
    ;;
  semaphores)
    CHAPTER_CAPS="Semaphores"
    CHAPTER_LOWER="semaphore"
    ROUTINES="sem_init sem_destroy sem_open sem_close sem_unlink sem_wait \
       sem_trywait sem_post sem_getvalue"
    ;;
  memorymgmt)
    CHAPTER_CAPS="Memory Management"
    CHAPTER_LOWER="memory management"
    ROUTINES="mlockall munlockall mlock munlock mmap munmap mprotect \
       msync shm_open shm_unlink"
    ;;
  message)
    CHAPTER_CAPS="Message Passing"
    CHAPTER_LOWER="message passing"
    ROUTINES="mq_open mq_close mq_unlink mq_send mq_receive mq_notify \
       mq_setattr mq_getattr"
    ;;
  cancel)
    CHAPTER_CAPS="Thread Cancellation"
    CHAPTER_LOWER="thread cancellation"
    ROUTINES="pthread_cancel pthread_setcancelstate pthread_setcanceltype \
       pthread_testcancel pthread_cleanup_push"
    ;;
  eventlog)
    CHAPTER_CAPS="Event Logging"
    CHAPTER_LOWER="event logging"
    ROUTINES="log_write log_open log_read log_notify log_close log_seek \
       log_severity_before log_facilityemptyset log_facilityfillset \
       log_facilityaddset log_facilitydelset log_facilityismember"
    ;;
  dumpcontrol)
    CHAPTER_CAPS="Process Dump Control"
    CHAPTER_LOWER="process dump control"
    ROUTINES="dump_setpath"
    ;;
  confspace)
    CHAPTER_CAPS="Configuration Space"
    CHAPTER_LOWER="configuration space"
    ROUTINES="cfg_mount cfg_unmount cfg_mknod cfg_get cfg_set cfg_link \
       cfg_unlink cfg_open cfg_read cfg_children cfg_mark cfg_close"
    ;;
  adminiface)
    CHAPTER_CAPS="Administration Interface"
    CHAPTER_LOWER="administration interface"
    ROUTINES="admin_shutdown"
    ;;
  # XXX this is not all of the C Library Stuff
  libc_ctype)
    CHAPTER_CAPS="C Library Character Handling"
    CHAPTER_LOWER="character handling"
    ROUTINES="isalnum isalpha iscntrl isdigit isgraph islower isprint \
        ispunct isspace isupper isxdigit tolower toupper"
    ;;
  libc_math)
    CHAPTER_CAPS="C Math Library"
    CHAPTER_LOWER="math library"
    ROUTINES="acos asis atan atan2 cos sin tan cosh sinh tanh exp frexp ldexp
      log log10 modf pow sqrt ceil fabs floor fmod"
    ;;
  libc_io)
    CHAPTER_CAPS="C Library IO"
    CHAPTER_LOWER="C Library IO"
    ROUTINES="clearerr fclose feof ferror fflush fgetc fgets fopen fputc \
        fputs fread freopen fseek ftell fwrite getc getchar gets perror \
        printf fprintf sprintf putc putchar puts remove rename rewind \
        scanf fscanf sscanf setbuf tempfile tmpnam ungetc"
    ;;
  libc_string)
    CHAPTER_CAPS="C Library String Handling"
    CHAPTER_LOWER="string handling"
    ROUTINES="strcpy strncpy strcat strncat strcmp strncmp strchr strcspn \
       strpbrk strrchr strspn strstr strtok stlen"
    ;;
  *)
    echo "Unknown chapter name"
    exit 1
    ;;
esac

if [ "x${CHAPTER_CAPS}" = "x" -o "x${CHAPTER_LOWER}" = "x" \
     -o "x${ROUTINES}" = "x" ] ; then
  echo "initialization problem"
  exit 1
fi

echo "@c"
echo "@c  COPYRIGHT (c) 1988-1998."
echo "@c  On-Line Applications Research Corporation (OAR)."
echo "@c  All rights reserved. "
echo "@c"
echo "@c  \$Id\$"
echo "@c"
echo ""
echo "@chapter ${CHAPTER_CAPS}" Manager
echo ""
echo "@section Introduction"
echo ""
echo "The "
echo "${CHAPTER_LOWER} manager is ..."
echo ""
echo "The directives provided by the ${CHAPTER_LOWER} manager are:"
echo ""
echo "@itemize @bullet"

for routine in ${ROUTINES}
do
  echo "@item @code{${routine}} - "
done
echo "@end itemize"

echo ""
echo "@section Background"
echo ""
echo "@section Operations"
echo ""
echo "@section Directives"
echo ""
echo "This section details the ${CHAPTER_LOWER} manager's directives."
echo "A subsection is dedicated to each of this manager's directives"
echo "and describes the calling sequence, related constants, usage,"
echo "and status codes."
echo ""

for routine in ${ROUTINES}
do
  echo "@page"
  echo "@subsection ${routine} - "
  echo ""
  echo "@subheading CALLING SEQUENCE:"
  echo ""
  echo "@ifset is-C"
  echo "@example"
  echo "int ${routine}("
  echo ");"
  echo "@end example"
  echo "@end ifset"
  echo ""
  echo "@ifset is-Ada"
  echo "@end ifset"
  echo ""
  echo "@subheading STATUS CODES:"
  echo ""
  echo "@table @b"
  echo "@item E"
  echo "The"
  echo ""
  echo "@end table"
  echo ""
  echo "@subheading DESCRIPTION:"
  echo ""
  echo "@subheading NOTES:"
  echo ""
done