Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
24
cde/programs/dtinfo/tools/misc/Imakefile
Normal file
24
cde/programs/dtinfo/tools/misc/Imakefile
Normal file
@@ -0,0 +1,24 @@
|
||||
XCOMM $XConsortium: Imakefile /main/7 1996/08/21 15:56:17 drk $
|
||||
|
||||
XCOMM These tools are used during "make includes".
|
||||
includes:: all
|
||||
|
||||
NormalLibraryObjectRule()
|
||||
AllTarget(dfiles)
|
||||
NormalProgramTarget(dfiles,dfiles.o,,,)
|
||||
AllTarget(pmaker)
|
||||
NormalProgramTarget(pmaker,pmaker.o,,,)
|
||||
|
||||
#ifdef RegenParserFiles
|
||||
SimpleCPlusPlusLexTarget(msgsets)
|
||||
#else
|
||||
msgsets.o : msgsets.C
|
||||
CplusObjectCompile($(_NOOP_))
|
||||
#endif
|
||||
SimpleCPlusPlusProgram(msgsets,msgsets.o,)
|
||||
|
||||
|
||||
DEPEND_DEFINES = $(CXXDEPENDINCLUDES)
|
||||
SRCS = dfiles.c pmaker.c msgsets.C
|
||||
|
||||
DependTarget()
|
||||
53
cde/programs/dtinfo/tools/misc/dfiles.c
Normal file
53
cde/programs/dtinfo/tools/misc/dfiles.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/* $XConsortium: dfiles.c /main/3 1996/06/11 17:40:25 cde-hal $ */
|
||||
#include <stdio.h>
|
||||
|
||||
main(argc, argv)
|
||||
int argc ;
|
||||
char **argv;
|
||||
{
|
||||
/* first parameter d or h */
|
||||
/* second parameter is library name, other params are classnames */
|
||||
int i ;
|
||||
char *libname = argv[2] ;
|
||||
char buffer[256];
|
||||
|
||||
FILE *hfile, *dfile;
|
||||
|
||||
switch (argv[1][0])
|
||||
{
|
||||
case 'h':
|
||||
{
|
||||
sprintf(buffer, "%s.h", libname);
|
||||
|
||||
hfile = fopen(buffer, "w");
|
||||
if (!hfile)
|
||||
exit(-1);
|
||||
|
||||
for (i = 3 ; i < argc ; i++ )
|
||||
fprintf(hfile, "#ifdef C_%s\n#include <%s/%s.hh>\n#endif\n",
|
||||
argv[i], libname, argv[i]);
|
||||
|
||||
fclose(hfile);
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
{
|
||||
sprintf(buffer, "%s.d", libname);
|
||||
|
||||
dfile = fopen(buffer, "w");
|
||||
if (!dfile)
|
||||
exit (-1);
|
||||
|
||||
for (i = argc - 1 ; i > 2; i-- )
|
||||
fprintf(dfile, "#ifdef C_%s\n#include <%s/%s.d>\n#endif\n",
|
||||
argv[i], libname, argv[i]);
|
||||
|
||||
fclose(dfile);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
1143
cde/programs/dtinfo/tools/misc/msgsets.C
Normal file
1143
cde/programs/dtinfo/tools/misc/msgsets.C
Normal file
File diff suppressed because it is too large
Load Diff
151
cde/programs/dtinfo/tools/misc/msgsets.l
Normal file
151
cde/programs/dtinfo/tools/misc/msgsets.l
Normal file
@@ -0,0 +1,151 @@
|
||||
%{
|
||||
/* $XConsortium: msgsets.l /main/4 1996/11/19 16:55:24 drk $ */
|
||||
/* Copyright (c) 1996 FUJITSU LIMITED */
|
||||
/* All Rights Reserved */
|
||||
|
||||
#include <string.h>
|
||||
#include <strstream.h>
|
||||
|
||||
#define BUFFER_INCR_UNIT 64
|
||||
|
||||
ostrstream **sets;
|
||||
int sets_cnt = 0; /* number of sets slots occupied */
|
||||
int sets_max = 0; /* total number of sets slots */
|
||||
|
||||
int cur_set = -1;
|
||||
|
||||
int set_num = 0;
|
||||
int* set_nums;
|
||||
|
||||
int* sorted;
|
||||
|
||||
%}
|
||||
|
||||
%s SETNUM MSGID
|
||||
|
||||
%%
|
||||
|
||||
^\$set {
|
||||
|
||||
if (sets_cnt == sets_max) {
|
||||
int i;
|
||||
|
||||
sets_max += BUFFER_INCR_UNIT;
|
||||
if (sets_cnt == 0) {
|
||||
sets = (ostrstream **)
|
||||
malloc(sizeof(ostrstream *) * sets_max);
|
||||
set_nums = (int *)
|
||||
malloc(sizeof(int) * sets_max);
|
||||
}
|
||||
else {
|
||||
sets = (ostrstream **)
|
||||
realloc(sets, sizeof(ostrstream *) * sets_max);
|
||||
set_nums = (int *)
|
||||
realloc(set_nums, sizeof(int) * sets_max);
|
||||
}
|
||||
|
||||
for (i = sets_cnt; i < sets_max; i++) {
|
||||
sets[i] = NULL;
|
||||
set_nums[i] = -1;
|
||||
}
|
||||
}
|
||||
if (cur_set >= 0)
|
||||
*sets[cur_set] << '\0';
|
||||
sets[cur_set = sets_cnt++] = new ostrstream;
|
||||
|
||||
*sets[cur_set] << (char*)yytext;
|
||||
|
||||
BEGIN SETNUM;
|
||||
}
|
||||
|
||||
<SETNUM>[0-9] {
|
||||
set_num = 10 * set_num + atoi((char*)yytext);
|
||||
|
||||
*sets[cur_set] << *(char*)yytext;
|
||||
}
|
||||
|
||||
<SETNUM>\n {
|
||||
|
||||
set_nums[cur_set] = set_num;
|
||||
set_num = 0;
|
||||
|
||||
*sets[cur_set] << *(char*)yytext;
|
||||
|
||||
BEGIN 0;
|
||||
}
|
||||
|
||||
^[0-9]+ {
|
||||
if (cur_set < 0) { // maybe not a message id
|
||||
cout << (char*)yytext;
|
||||
}
|
||||
else { // must be a message id
|
||||
*sets[cur_set] << (char*)yytext;
|
||||
BEGIN MSGID;
|
||||
}
|
||||
}
|
||||
|
||||
<MSGID>[ \t]+ {
|
||||
// supress multiple white spaces between msg# and message
|
||||
*sets[cur_set] << ' ';
|
||||
BEGIN 0;
|
||||
}
|
||||
|
||||
<MSGID>[^ \t] {
|
||||
*sets[cur_set] << *(char*)yytext;
|
||||
BEGIN 0;
|
||||
}
|
||||
|
||||
. |
|
||||
\n {
|
||||
if (cur_set < 0)
|
||||
cout << *(char*)yytext;
|
||||
else
|
||||
*sets[cur_set] << *(char*)yytext;
|
||||
}
|
||||
|
||||
<<EOF>> {
|
||||
if (cur_set >= 0)
|
||||
*sets[cur_set] << '\0';
|
||||
return 1;
|
||||
}
|
||||
|
||||
%%
|
||||
|
||||
main()
|
||||
{
|
||||
int i,j;
|
||||
|
||||
yylex();
|
||||
|
||||
sorted = (int *)malloc(sizeof(int) * sets_cnt);
|
||||
|
||||
for (i = 0; i < sets_cnt; i++)
|
||||
sorted[i] = i;
|
||||
|
||||
for (i = 0; i < sets_cnt - 1; i++) {
|
||||
int idx = i;
|
||||
for (j = i + 1; j < sets_cnt; j++) {
|
||||
if (set_nums[sorted[idx]] > set_nums[sorted[j]])
|
||||
idx = j;
|
||||
}
|
||||
if (i < idx) {
|
||||
int saved = sorted[i];
|
||||
sorted[i] = sorted[idx];
|
||||
sorted[idx] = saved;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < sets_cnt; i++) {
|
||||
const char* record = sets[sorted[i]]->str();
|
||||
cout << record << '\n' << flush;
|
||||
}
|
||||
|
||||
free(sorted);
|
||||
free(set_nums);
|
||||
for (i = 0; i < sets_cnt; i++)
|
||||
delete sets[i];
|
||||
free(sets);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
26
cde/programs/dtinfo/tools/misc/pmaker.c
Normal file
26
cde/programs/dtinfo/tools/misc/pmaker.c
Normal file
@@ -0,0 +1,26 @@
|
||||
/* $XConsortium: pmaker.c /main/3 1996/06/11 17:40:31 cde-hal $ */
|
||||
#include <stdio.h>
|
||||
|
||||
main(argc, argv)
|
||||
int argc ;
|
||||
char **argv ;
|
||||
{
|
||||
FILE *f ;
|
||||
int i;
|
||||
|
||||
f = fopen("Prelude.h", "w");
|
||||
if (!f)
|
||||
exit(-1);
|
||||
|
||||
fprintf(f, "#include \"config.h\"\n");
|
||||
for (i = argc - 1 ; i > 0 ; i--)
|
||||
fprintf(f, "#ifdef L_%s\n#include <%s/%s.d>\n#endif\n",
|
||||
argv[i], argv[i], argv[i]);
|
||||
|
||||
for (i = 1 ; i < argc ; i++)
|
||||
fprintf(f, "#ifdef L_%s\n#include <%s/%s.h>\n#endif\n",
|
||||
argv[i], argv[i], argv[i]);
|
||||
|
||||
fclose(f);
|
||||
exit(0);
|
||||
}
|
||||
43
cde/programs/dtinfo/tools/misc/reverse.c
Normal file
43
cde/programs/dtinfo/tools/misc/reverse.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* $XConsortium: reverse.c /main/3 1996/06/11 17:40:35 cde-hal $
|
||||
*
|
||||
* Copyright (c) 1993 HAL Computer Systems International, Ltd.
|
||||
* All rights reserved. Unpublished -- rights reserved under
|
||||
* the Copyright Laws of the United States. USE OF A COPYRIGHT
|
||||
* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
|
||||
* OR DISCLOSURE.
|
||||
*
|
||||
* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
|
||||
* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
|
||||
* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
|
||||
* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
|
||||
* INTERNATIONAL, LTD.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND
|
||||
* Use, duplication, or disclosure by the Government is subject
|
||||
* to the restrictions as set forth in subparagraph (c)(l)(ii)
|
||||
* of the Rights in Technical Data and Computer Software clause
|
||||
* at DFARS 252.227-7013.
|
||||
*
|
||||
* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
|
||||
* 1315 Dell Avenue
|
||||
* Campbell, CA 95008
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
main(argc, argv)
|
||||
int argc ;
|
||||
char **argv ;
|
||||
{
|
||||
int i ;
|
||||
for (i = argc ; i > 1 ; i--)
|
||||
{
|
||||
fputs(argv[i -1],stdout);
|
||||
fputs(" ", stdout);
|
||||
}
|
||||
fputs("\n",stdout);
|
||||
fflush(stdout);
|
||||
return 0 ;
|
||||
}
|
||||
35
cde/programs/dtinfo/tools/misc/treecomp
Executable file
35
cde/programs/dtinfo/tools/misc/treecomp
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
# Compile a treeres file
|
||||
|
||||
if [ $# != 1 ] ; then
|
||||
echo "usage: treecomp filename"
|
||||
fi
|
||||
|
||||
if [ ! -f $1 ] ; then
|
||||
echo "treecomp: $1 does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Look for .res suffix, if found dump output to file without suffix
|
||||
|
||||
basename=`basename $1 .res`
|
||||
|
||||
if [ $1 != $basename ] ; then
|
||||
dirname=`dirname $1`
|
||||
output=$dirname/$basename
|
||||
fi
|
||||
|
||||
# Establish commands to run.
|
||||
|
||||
CPP=${CPP:-/am/buildsets/qa/current/bin/gpp}
|
||||
CPPFLAGS=${CPPFLAGS:-"-C -traditional"}
|
||||
TREERES=${TREERES:-treeres}
|
||||
|
||||
# Do the deed.
|
||||
|
||||
if [ -n "$output" ] ; then
|
||||
$CPP $CPPFLAGS $1 | $TREERES | sed -e "s/VERSION/(Developer - ${USER})/" \
|
||||
> $output
|
||||
else
|
||||
$CPP $CPPFLAGS $1 | $TREERES | sed -e "s/VERSION/(Developer - ${USER})/"
|
||||
fi
|
||||
123
cde/programs/dtinfo/tools/misc/treeres
Executable file
123
cde/programs/dtinfo/tools/misc/treeres
Executable file
@@ -0,0 +1,123 @@
|
||||
# feed this into perl
|
||||
eval '(exit $?0)' && eval 'exec /usr/local/bin/perl $0 ${1+"$@"}' & eval 'exec /usr/local/bin/perl $0 $argv'
|
||||
if 0;
|
||||
|
||||
# treeres - resource file preprocessor
|
||||
# by Dave Brennan (brennan@hal.com) and RF Starr (starr@wg2.waii.com)
|
||||
# This is Public Domain software.
|
||||
#
|
||||
# This script converts a tree format resource file to an X Resource file.
|
||||
# The tree format uses spaces to represent the level of a widget in the
|
||||
# hierarchy. Currently two spaces represent a level. For example, if
|
||||
# the following was the input (ignoring the '# ' prefix):
|
||||
#
|
||||
# Toplevel
|
||||
# title: Hello World
|
||||
# label
|
||||
# labelString: Hello
|
||||
# foreground: red; background: black
|
||||
# *borderWidth: 0
|
||||
#
|
||||
# The output would be:
|
||||
#
|
||||
# Toplevel.title: Hello World
|
||||
# Toplevel.label.labelString: Hello
|
||||
# Toplevel.label.foreground: red
|
||||
# Toplevel.label.background: black
|
||||
# Toplevel*borderWidth: 0
|
||||
#
|
||||
# The character '.' is the default separator. If no separator is specified
|
||||
# it will be used. Basically this means that only '*' need be sepcified when
|
||||
# needed. In general resources specified using the '.' for tight binding
|
||||
# can be matched faster than those with '*' for lose binding.
|
||||
|
||||
*IN = STDIN;
|
||||
$file = "<stdin>";
|
||||
if ($#ARGV >= 0)
|
||||
{
|
||||
open(IN,$ARGV[0]) || die "Can't open file $ARGV[0].\n";
|
||||
$file = $ARGV[0];
|
||||
}
|
||||
$continuation = 0;
|
||||
|
||||
$line = 0;
|
||||
|
||||
while (<IN>)
|
||||
{
|
||||
# Snag CPP line and file info.
|
||||
if (/^# ([0-9]+) "([^"]*)"/)
|
||||
{
|
||||
$line = $1 - 1; $file = $2;
|
||||
#DEBUG print STDERR "Switching to file ", $file, " Line ", $line, "\n";
|
||||
next;
|
||||
}
|
||||
$line++;
|
||||
# If previous line ended with \, echo this one as-is.
|
||||
if ($continuation)
|
||||
{
|
||||
# First unescape single quotes.
|
||||
s/\\'/'/g;
|
||||
$continuation = /[^\\](\\\\)*\\$/;
|
||||
print; next;
|
||||
}
|
||||
|
||||
# Check for continuation, handling quoted backslashes.
|
||||
$continuation = /[^\\](\\\\)*\\$/;
|
||||
|
||||
# Multiple blank lines are compressed to one
|
||||
if (/^([ \t]*)(!x.*)?$/) {
|
||||
if ($blankcount++ == 0) { print; }
|
||||
next;
|
||||
}
|
||||
$blankcount = 0;
|
||||
# Echo comments and blank lines without change.
|
||||
if (/^([ \t]*)!/) { print; next; }
|
||||
chop;
|
||||
#DEBUG $saved = $_;
|
||||
|
||||
# Strip off and count depth character.
|
||||
# NOTE: Need cmd line option to alter.
|
||||
s/^([ ]*)//;
|
||||
$level = length($1) / 2;
|
||||
if ($level > $oldlevel + 1) {
|
||||
print STDERR $file, ":", $line, ": level increased by more than 1\n";
|
||||
exit (1);
|
||||
}
|
||||
|
||||
#die "treeres: level increased by more than 1" if ($level > $oldlevel + 1);
|
||||
|
||||
# Nuke trailing space.
|
||||
s/([ \t]*)$//;
|
||||
|
||||
# Make base array length match current level
|
||||
#DEBUG print "! oldlevel = $oldlevel, level = $level\n";
|
||||
if ($oldlevel > 0 && $level <= $oldlevel && ! $did_gen)
|
||||
{ print STDERR $file, ":", $line,
|
||||
": Level <= previous with no generation.\n"; }
|
||||
$#base = $level - 1;
|
||||
|
||||
# See if a separator has been specified. If not, use '.'.
|
||||
# NOTE: Again, cmd line option.
|
||||
if (/^[.*]/ || $level == 0) { $sep = ''; } else { $sep = '.'; }
|
||||
|
||||
# Lines with colons represent resources, so print the line.
|
||||
if (/:/)
|
||||
{
|
||||
# First unescape quotes.
|
||||
s/\\'/'/g;
|
||||
# Also add readability breaks for `\n' lines.
|
||||
# s/\\n/\\n\\\n/g;
|
||||
# Then print a line for each semi-colon separated resource.
|
||||
foreach $i (split(/[ \t]*;[ \t]*/)) { print @base, $sep, $i, "\n"; }
|
||||
$did_gen = 1;
|
||||
}
|
||||
# Intermediate widget otherwise, so add to current base.
|
||||
else
|
||||
{
|
||||
$oldlevel = $level;
|
||||
$base[$level] = $sep . $_;
|
||||
$did_gen = 0;
|
||||
}
|
||||
#DEBUG print "! input = '$saved'\n";
|
||||
#DEBUG print "! level = $level, oldlevel = $oldlevel, base = '@base'\n";
|
||||
}
|
||||
Reference in New Issue
Block a user