If you want to add many classes (150) to an ACEDB database,
then read this
else skip it.
---------------------------
probably this comes a bit late now, since Jean will
release a code that does not need this anymore.
But for the time being:
Starting from the code as of 94-07-14 for ACEDB 3.1 from the
Montpellier workshop (this most probably also applies to ACEDB 3.3),
I wanted to add a lot of classes to ACEDB, so I had to leave out
some of the old ones. Since I needed a contiguous space of class
numbers I had to recompile. But which user-defined classes are
needed by the code?
All classes used in ACEDB source code:
perl -ne '/(_V\w+)/ && print $1,"\n"' w?/*.c w?/*.h | sort | uniq
Then I form the intersection with the classes in the
orginal classes.wrm file.
The tags file I keep, because many tags are used and
new tags are cheap.
The options.wrm is adapted to classes.wrm
Thus having minimal {classes,tags,options}.wrm files
for compiling, I use the "newspec" script from Otto that
auguments the {classes,tags,options}.wrm with everything
necessary for the current models.wrm
I append all classes, options and newspec files, so you can use them.
tags.wrm is from the distribution.
Detlef
-----------------------------------------------------------
-----------------------------------------------------------
/* minimal version Fri Aug 26 12:10:40 WET DST 1994 dok256 */
/* wspec/classes.wrm
This file is read at compile and at execution time.
It holds the enumaration of the application dependent classes.
Classes necessary to the kernel are defined in a second file
wspec/sysclasses.wrm, which should not be touched except in
consultation with us.
You can add new classes at will, but if you suppress one or
renumber it, you must recompile and reconstruct the database
from ace files.
Class properties, formerly defined in this file, are
now in wspec/options.wrm. If there is no entry there then
classes are type B (tree), hidden, with display method TREE.
Each #define line corresponds to a class. We require strlen(name) < 32.
There must be no repetitions of class numbers.
The total number of classes cannot exceed 255.
The total number of display types cannot exceed 64.
For now we allocate 0-100 for system classes
101-199 for application classes
200-255 for subtypes
The subytypes will not need class numbers when the ?Model
class works fully.
*/
/* def _VClass_name Class_number */
#define _V2_point_data 101
#define _VAllele 102
#define _VChrom_Band 103
#define _VClone 104
#define _VClone_Grid 105
#define _VContig 106
#define _VDNA 107
#define _VDf_Dup_data 108
#define _VGene_Class 109
#define _VInterval 110
#define _VLocus 111
#define _VMap 112
#define _VMethod 113
#define _VMotif 114
#define _VMultiMap 115
#define _VMulti_pt_data 116
#define _VPaper 117
#define _VPeptide 118
#define _VPool 119
#define _VProbe 120
#define _VRestriction 121
#define _VSequence 122
#define _VgMap 123
#define _VpMap 124
#define _VvMap 125
/* --------- end of needed classes ----------- */
-----------------------------------------------------------
/* minimal version Fri Aug 26 12:10:40 WET DST 1994 dok256 */
/* wspec/options.wrm
This file is read only at execution time
It holds the class definitions necessary to the applications.
The kernel classes are defined in wspec/sysoptions.wrm
which can serve as a model when editing this one.
You can freely edit this file without recompiling
but it must remain consistent with the other wspec files
and you must never change the type (A, B, X) of a class
unless you reconstruct the database from ace files.
Line starting with _VClassName are parsed, they are expected
to contain a la Unix a set of -Option parameters.
Class names must match their enumeration in wspec/classes.wrm
The order in which classes appear here will be used in displays.
Options names can be abbreviated, recognized options are
-Hidden : this class will not be listed in the acedb Main Window.
-Visible : this class will be listed in the acedb Main Window.
-Array : this class is of type A, (Array or tuple).
-Btree : this class is of type B, it must be further defined in models.wrm
-XREF : Auto cross referencing Hidden B system class. Do not use.
-Display displayType : The preferred display type of the class,
as enumerated in wspec/disptype.wrm
-Title Tag : Tag must be a tag name listed in wspec/tags.wrm (or systags)
If present in some object of that class, the text following it
will be used preferentially when referring to that object.
-Symbol Tag : Tag must be a tag name listed in wspec/tags.wrm (or systags)
If present in some object of that class, the text
or key following it will be used preferentially
when referring to that object in Maps.
-Rename otherName : Other name will show in lists, old and new
name will be recognized in ace files and queries, old
is used in the code. In case some newName
matches some old name, the new name takes precedence.
-CaseSensitive : The names in this class will be case sensitive.
Never undo this option once it has been used.
-Sybase : Experimental external storage in sybase.
-Known : Prevents indirect creation of new object in ace files
You can't enter a new object in this class directly
but not by quoting it in another object.
Classes default as -B -H -D TREE
A classes further default as -H -D ZERO
Displays:
Every display type needs a display function.
Parsers:
Special code must be provided for A Classes
Dumps:
Special code must be provided to dump A classes
These routines must be registered in file wspec/quovadis.h before
recompilation.
*/
// _VAA -A -H
_VChrom_Band -V -D VMAP
_VClone -V -D PMAP
_VContig -V -D PMAP
_VDNA -A -V -D FMAP
// _VFragment -V -D VMAP
// _VGDB_id -V -Protected
_VLocus -V -D VMAP
_VMap -V -D VMAP
_VMotif -V
_VMultiMap -V -D DtMULTIMAP
_VPaper -V -T Title
_VProbe -V -T Name
// _VSTS -V -D VMAP
_VSequence -V -D FMAP -T Title
// _VYAC -V -D DtPmapFingerprint
_VgMap -A -H -D GMAP
_VpMap -A -H -D PMAP
_VvMap -A -H -D VMAP
/* ------------ minimal version ends here ----------------- */
-----------------------------------------------------------
#!/usr/local/bin/gawk -f
# ^
# use nawk or gawk, but NOT awk
#
# filename: newspec
# by Otto Ritter, DKFZ, Germany [o.ritter at dkfz-heidelberg.de]
# created Nov 3 93
# last modif Apr 23 94 SGI
# purpose; parse models.wrm and generate new {tags|classes|options}
# syntax: setenv ACEDB <dirpath>; newspec
# -- no command line arguments
# Fri Aug 26 12:49:58 WET DST 1994 dok256 -- classes are no tags
########################################################################
BEGIN {
### check the environment & backup some files
if ( ENVIRON["ACEDB"] == "") {
print "newspec error:: ACEDB variable not defined." ; exit 1 }
path = ( ENVIRON["ACEDB"] "/wspec/" )
print "echo newspec :: " path "models.wrm"
if ( system("cd " path "; \cp tags.wrm tags.wrm.bak") != 0 ) {
print "newspec error:: cannot backup tags.wrn" ; exit 1 }
if ( system("cd " path "; \cp classes.wrm classes.wrm.bak") != 0 ) {
print "newspec error:: cannot backup classes.wrn" ; exit 1 }
### now we are working in $ACEDB/wspec
logfile = path "newspec.log"
### parse sys files first
print "// newspec.log\n" > logfile
ff = (path "sysclass.wrm")
while ((getline < ff ) >0)
if ($1=="#define") class[tolower($2)] = $2;
close(ff);
ff = (path "classes.wrm")
while ((getline < ff ) >0)
if ($1=="#define"){ if (tolower($2) in class) {
printf "## warning: %s both in sysclass.wrm and classes.wrm ", tolower($2) ;}
else class[tolower($2)] = $2; ClassNr =$3+1; }
close(ff);
ff = (path "systags.wrm")
while ((getline < ff ) >0)
if ($1=="#define") tag[tolower($2)] = $2;
close(ff);
ff = (path "tags.wrm")
while ((getline < ff ) >0)
if ($1=="#define") { if (tolower($2) in tag ) {
printf "## warning: %s both in systags.wrm and tags.wrm", tolower(tg); }
else tag[tolower($2)] = $2; TagNr = $3+1; }
close(ff);
ff = (path "options.wrm")
while ((getline < ff ) >0)
if (substr($1,1,2) =="_V") in_options[$1] = 1;
close(ff);
if (ClassNr < 110 ) ClassNr = 110
if ( TagNr < 1000) TagNr = 1000
### parse models.wrm
ff = (path "models.wrm")
while ((getline < ff ) > 0 ){
gsub("#","?");
gsub(/\/\/.*$/,"");
gsub(/@.*$/,"");
for (i=1;i<=NF;i++) {
if (substr($i,1,1) == "?" ) { # classname
cl = "_V" substr($i,2) ;
if (tolower(cl) in class) {
if ( class[tolower(cl)] != cl ) print "## warning: case mismatch ", cl, class[tolower(cl)] ; }
else {class[tolower(cl)] = cl;
print ("#define",cl,ClassNr++) >> (path "classes.wrm");
newclass = newclass SUBSEP cl;}
if (!(cl in in_options) && !(cl in newoptions)) {print cl " -V" >> "options.wrm"; newoptions[cl] = ++nopt; };
continue; # detlef thinks classes are no tags
} # classname
tg = "_" $i; # tag name
gsub(/\?/,"",tg);
if ( tolower(tg) in tag ) {
if ( tag[tolower(tg)] != tg ) print "case mismatch ", tg, tag[tolower(tg)] ; }
else { tag[tolower(tg)] = tg;
print ("#define",tg,TagNr++) >> (path "tags.wrm");
newtag = newtag SUBSEP tg; }
}#for
} #while
close(ff);
### generate report
{
ncl = split(newclass,arr,SUBSEP);
print "======== added classes ======" > logfile
for ( x in arr ) print arr[x] > logfile
ntg = split(newtag,arr,SUBSEP);
print "\n======== added tags =========" > logfile
for ( x in arr ) print arr[x] > logfile
print "\n======== added options ======" > logfile
for (x in newoptions) print x, "-V" > logfile
printf "## newspec added:\n%i to %s\n%i to %s\n%i to %s\nsee the logfile %s\n\n", ncl,"classess.wrm",\
ntg, "tags.wrm", nopt,"options.wrm", logfile ;
}
exit 0
}#BEGIN
{} # empty main