home *** CD-ROM | disk | FTP | other *** search
/ Oracle Video Server 3.0.3.1 / OVS_3031_NT.iso / win32 / medianet / server / include / yotk.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-06  |  19.7 KB  |  567 lines

  1. /* Copyright (c) 1995 by Oracle Corporation.  All Rights Reserved.
  2.  *
  3.  * yotk.h - Oracle OMX Typecode manipulation
  4.  */
  5.  
  6. #ifndef YOTK_ORACLE
  7. #define YOTK_ORACLE
  8.  
  9. #ifndef SYSX_ORACLE
  10. #include <sysx.h>
  11. #endif
  12. #ifndef YS_ORACLE
  13. #include <ys.h>
  14. #endif
  15. #ifndef YSLOG_ORACLE
  16. #include <yslog.h>
  17. #endif
  18. #ifndef YRTYPES_ORACLE
  19. #include <yrtypes.h>
  20. #endif
  21.  
  22. EXTC_START
  23.  
  24. /*
  25.  * yotk - Typecode Definitions
  26.  *
  27.  * DESCRIPTION
  28.  * Typecodes are an encoded form of describing the structure of possible data
  29.  * values that can be manipulated by the object layer.  They are generally
  30.  * constructed by the IDL compiler, but may be synthesized dynamically.
  31.  */
  32. typedef ub1 yotk;
  33.  
  34. /*
  35.  * yotkKind - Classes of Typecode
  36.  */
  37. typedef ub4 yotkKind;
  38.  
  39. /*
  40.  * yoany - any descriptor
  41.  *
  42.  * DESCRIPTION
  43.  * yoany is the structure describing an any type, which consists of a pointer
  44.  * to the value and the typecode which describes the value.
  45.  * NOTE: this definition should probably be somewhere like in yodefs.h,
  46.  * but needs to be here for yotkParam() and yotkUnMbr
  47.  */
  48. /* DISABLE check_naming */
  49. typedef struct yoany yoany;
  50. struct yoany
  51. {
  52.   yotk  *_type;
  53.   dvoid *_value;
  54. };
  55. /* ENABLE check_naming */
  56.  
  57. #define yotkNull      ((yotkKind) 0)    /* empty */
  58. #define yotkVoid      ((yotkKind) 1)    /* empty */
  59. #define yotkShort     ((yotkKind) 2)    /* empty */
  60. #define yotkLong      ((yotkKind) 3)    /* empty */
  61. #define yotkUshort    ((yotkKind) 4)    /* empty */
  62. #define yotkUlong     ((yotkKind) 5)    /* empty */
  63. #define yotkFloat     ((yotkKind) 6)    /* empty */
  64. #define yotkDouble    ((yotkKind) 7)    /* empty */
  65. #define yotkBoolean   ((yotkKind) 8)    /* empty */
  66. #define yotkChar      ((yotkKind) 9)    /* empty */
  67. #define yotkOctet     ((yotkKind) 10)   /* empty */
  68. #define yotkAny       ((yotkKind) 11)   /* empty */
  69. #define yotkTypeCode  ((yotkKind) 12)   /* empty */
  70. #define yotkPrincipal ((yotkKind) 13)   /* empty */
  71. #define yotkObjref    ((yotkKind) 14)   /* repository ID, interface-name */
  72. #define yotkStruct    ((yotkKind) 15)   /* repository ID, struct-name, count,
  73.                        { member-name, TypeCode } */
  74. #define yotkUnion     ((yotkKind) 16)   /* repository ID, union-name,
  75.                        discriminatorTypeCode, default,
  76.                        { label-value, member-name,
  77.                        TypeCode } */
  78. #define yotkEnum      ((yotkKind) 17)   /* repository ID, enum-name,
  79.                        { enumerator-name } */
  80. #define yotkString    ((yotkKind) 18)   /* maxlen */
  81. #define yotkSequence  ((yotkKind) 19)   /* TypeCode, maxlen */
  82. #define yotkArray     ((yotkKind) 20)   /* TypeCode, maxlen */
  83. #define yotkAlias     ((yotkKind) 21)   /* repository ID, name, TypeCode */
  84. #define yotkExcept    ((yotkKind) 22)   /* repository ID, except-name,
  85.                        { member-name, TypeCode } */
  86. #define yotkLongLong  ((yotkKind) 23)   /* empty */
  87. #define yotkRecurs    ((yotkKind) ~0)   /* long (indirection offset) */
  88.  
  89. /*
  90.  * yoTc Constants - Primitive Type Code Constants
  91.  *
  92.  * DESCRIPTION
  93.  * Typecodes for all the primitive types in the IDL are pre-defined
  94.  * so they don't have to be created dynamically.
  95.  */
  96. CONST yotk *yoTcNull__getTC(void);
  97. CONST yotk *yoTcVoid__getTC(void);
  98. CONST yotk *yoTcShort__getTC(void);
  99. CONST yotk *yoTcUshort__getTC(void);
  100. CONST yotk *yoTcFloat__getTC(void);
  101. CONST yotk *yoTcDouble__getTC(void);
  102. CONST yotk *yoTcBoolean__getTC(void);
  103. CONST yotk *yoTcChar__getTC(void);
  104. CONST yotk *yoTcOctet__getTC(void);
  105. CONST yotk *yoTcAny__getTC(void);
  106. CONST yotk *yoTcTypeCode__getTC(void);
  107. CONST yotk *yoTcPrincipal__getTC(void);
  108. CONST yotk *yoTcObject__getTC(void);
  109.  
  110. #define yoTcNull        yoTcNull__getTC()
  111. #define yoTcVoid        yoTcVoid__getTC()
  112. #define yoTcShort       yoTcShort__getTC()
  113. #define yoTcUshort      yoTcUshort__getTC()
  114. #define yoTcFloat       yoTcFloat__getTC()
  115. #define yoTcDouble      yoTcDouble__getTC()
  116. #define yoTcBoolean     yoTcBoolean__getTC()
  117. #define yoTcChar        yoTcChar__getTC()
  118. #define yoTcOctet       yoTcOctet__getTC()
  119. #define yoTcAny         yoTcAny__getTC()
  120. #define yoTcTypeCode    yoTcTypeCode__getTC()
  121. #define yoTcPrincipal   yoTcPrincipal__getTC()
  122. #define yoTcObject      yoTcObject__getTC()
  123.  
  124. /* these are used/defined in ys instead of here, sigh. */
  125. #define yoTcLong        (CONST yotk *)YSLSB4_TC
  126. #define yoTcUlong       (CONST yotk *)YSLUB4_TC
  127. #define yoTcString      (CONST yotk *)YSLSTR_TC
  128. #define yoTcLongLong    (CONST yotk *)YSLSB8_TC
  129.  
  130. /*
  131.  * Exceptions raised by TypeCode routines
  132.  */
  133. externref ysidDecl(YO_EX_BADCODE);
  134. externref ysidDecl(YO_EX_BOUNDS);
  135. externref ysidDecl(YO_EX_BOUNDSMISMATCH);
  136.  
  137. /*
  138.  * TypeCode manipulation routines
  139.  */
  140.  
  141. /*
  142.  * yotkDuplicate - copy a typecode
  143.  *
  144.  * DESCRIPTION
  145.  * yotkDuplicate() returns a copy of a typecode.  The typecode returned should
  146.  * be freed using yotkFree().
  147.  */
  148. yotk *yotkDuplicate(CONST yotk *tk);
  149.  
  150. /*
  151.  * yotkFree - free a typecode
  152.  *
  153.  * DESCRIPTION
  154.  * yotkFree() safely frees any memory used by a typecode.  Typecodes
  155.  * can be returned by yotkDecode() and also by a number of the typecode
  156.  * inspection routines below.  These should be freed using this routine
  157.  * in case any real memory was used by these typecodes.
  158.  */
  159. void yotkFree(yotk *tk);
  160.  
  161. /*
  162.  * yotkCmp - compair two typecodes
  163.  *
  164.  * DESCRIPTION
  165.  * yotkCmp() compairs two typecodes.  0 is returned if the two typecodes are
  166.  * identical.  A negative value indicates that the first typecode is less than
  167.  * the second.  A positive value indicates that the first typecode is greater
  168.  * then the second.
  169.  */
  170. sword yotkCmp(CONST yotk *tk1, CONST yotk *tk2);
  171.  
  172. /*
  173.  * yotkToStr - convert a typecode to a string representation
  174.  *
  175.  * DESCRIPTION
  176.  * yotkToStr() creates a string representation of the specified typecode.
  177.  * The string returned should be freed using ysmGlbFree() when it is no
  178.  * longer needed.
  179.  */
  180. char *yotkToStr(CONST yotk *tk);
  181.  
  182. /*
  183.  * Typecode Inspection Routines
  184.  */
  185.  
  186. /*
  187.  * yotkGetKind - get the typecode kind
  188.  *
  189.  * DESCRIPTION
  190.  * yotkGetKind() gets the kind of the typecode, as one of the yotkKinds
  191.  * defined above.
  192.  */
  193. yotkKind yotkGetKind(CONST yotk *tk);
  194.  
  195. /*
  196.  * yotkGetBaseKind, yotkGetBaseType - get the base kind/ typecode for an alias
  197.  *
  198.  * DESCRIPTION
  199.  * yotkGetBaseKind() gets the basic kind of the typecode. If the typecode
  200.  * is an alias/typedef, it returns the type of the base chain, and not
  201.  * yotkAlias. yotkGetBaseType() does the same thing for typecodes (as
  202.  * opposed to kinds). So:
  203.  *
  204.  *    typedef long a;
  205.  *    typedef a b;
  206.  *
  207.  * returns yotkLong and yoTcLong when called on either a or b.
  208.  */
  209. yotkKind    yotkGetBaseKind(CONST yotk *tk);
  210. CONST yotk *yotkGetBaseType(CONST yotk *tk);
  211.  
  212. /*
  213.  * yotkGetName - get the name embedded in the typecode
  214.  *
  215.  * DESCRIPTION
  216.  * yotkGetName() returns the name embedded in the typecode (if any).
  217.  *   If no name is available, NULL is returned. Only object
  218.  * references, structs, unions, enums, aliases, and exceptions have names
  219.  * and repository id's.
  220.  */
  221. CONST char *yotkGetName(CONST yotk *tk);
  222.  
  223. /*
  224.  * yotkGetId   - get the repository id embedded in the typecode
  225.  *
  226.  * DESCRIPTION
  227.  * yotkGetId() returns the repository id embedded in the typecode (if any).
  228.  *   If no id is available YO_EX_BADCODE is raised. Only object references,
  229.  * structs, unions, enums, aliases, and exceptions have repository id's.
  230.  */
  231. CONST char *yotkGetId(CONST yotk *tk);
  232.  
  233. /*
  234.  * yotkMbrCount - get # of members in a typecode
  235.  * yotkMbrName  - get name associated a particular index
  236.  * yotkMbrType  - get type of a particular index
  237.  *
  238.  * DESCRIPTION
  239.  * structures, exceptions, and unions contain multiple fields, or members.
  240.  * these members can be thought of as having "index numbers" depending on
  241.  * which field they are in a definition. Example:
  242.  *
  243.  *  struct foo { int a; float b; };
  244.  *
  245.  * field 'a' has index number zero; field 'b', index 1. These routines can
  246.  * extract field/member information from the corresponding typecode.
  247.  * yotkMbrCount() returns the # of members in the typecode.
  248.  * yotkMbrName() returns the name associated with a particular member index.
  249.  * yotkMbrType() returns the type of a given member.
  250.  *   If an incorrect or inapplicable typecode is passed in, YO_EX_BADCODE
  251.  * is raised. If an index number is out of range, YO_EX_BOUNDS is raised.
  252.  * if a name is not represented in a typecode, YO_EX_BADPARAM is raised.
  253.  */
  254. ub4         yotkMbrCount(CONST yotk *tk);
  255. CONST char *yotkMbrName(CONST yotk *tk, ub4 index);
  256. CONST yotk *yotkMbrType(CONST yotk *tk, ub4 index);
  257.  
  258. /*
  259.  * yotkDiscType - return the discriminator type for a union
  260.  * yotkMbrLabel - return the label value for a union
  261.  * yotkDefIndex - returns the index of the default value (if any) in a union
  262.  *
  263.  * DESCRIPTION
  264.  * These routines are applicable only to union typecodes. yotkDiscType()
  265.  * returns the type of the union discriminator. yotkMbrLabel() returns the
  266.  * value of a given label for a union. yotkDefIndex() returns the index
  267.  * value of a default case in a union (if there is no default, ((ub4)-1)
  268.  * is returned).
  269.  *   If an incorrect or inapplicable typecode is passed in, YO_EX_BADCODE
  270.  * is raised. If an index number is out of range, YO_EX_BOUNDS is raised.
  271.  */
  272. CONST yotk  *yotkDiscType(CONST yotk *tk);
  273. yoany        yotkMbrLabel(CONST yotk *tk, ub4 index);
  274. ub4          yotkDefIndex(CONST yotk *tk);
  275.  
  276. /*
  277.  * yotkLength - return the length of a sequence, array, or string
  278.  *
  279.  * yotkLength() returns the length of a sequence, array, or string.
  280.  * If the sequence or array is unbounded, zero is returned. If any other
  281.  * type is passed in, YO_EX_BADCODE is raised.
  282.  */
  283. ub4 yotkLength(CONST yotk *tk);
  284.  
  285. /*
  286.  * yotkRecOffset - get the typecode offset of a recursive sequence
  287.  *
  288.  * yotkRecOffset() returns the offset of the enclosing typecode that describes
  289.  * the element type of the sequence. If a non-recursive typecode is passed
  290.  * in, YO_EX_BADCODE is raised. Note: the number returned is the indirection
  291.  * level, not the byte offset of the CDR representation of the typecode.
  292.  */
  293. ub4 yotkRecOffset(CONST yotk *tk);
  294.  
  295. /*
  296.  * yotkContentType - return the type of the contained elements
  297.  *
  298.  * yotkContentType() returns the type of the contained elements for sequences,
  299.  * aliases, and arrays. If any other typecode is passed in, YO_EX_BADCODE
  300.  * is raised.
  301.  */
  302. CONST yotk *yotkContentType(CONST yotk *tk);
  303.  
  304. /*
  305.  * yotkParamCount - return # of parameters in a typecode
  306.  * yotkParam      - return the given param of a typecode
  307.  *
  308.  * DESCRIPTION
  309.  * These two routines are deprecated, and provide backwards compatibility
  310.  * with the CORBA 1.2 spec. yotkParamCount() returns the number of parameters
  311.  * in a typecode, and yotkParam() returns the given parameter. For example,
  312.  * a sequence typecode has two parameters: a typecode for the element
  313.  * type, and a ub4 for the bound (if any). This routine may raise
  314.  * YO_EX_BOUNDS if the parameter is out of range. The calling routine should
  315.  * free ret->_value when done with it, using ysmGlbFree.
  316.  *   For information on the numbering of indices, see Table 12 on pg. 6-37
  317.  * of the CORBA 2.0 spec.
  318.  */
  319. ub4   yotkParamCount(CONST yotk *tk);
  320. yoany yotkParam(CONST yotk *tk, ub4 index);
  321.  
  322. /*
  323.  * TypeCode synthesis routines
  324.  */
  325.  
  326. typedef struct yotkStrMbr yotkStrMbr;
  327. struct yotkStrMbr
  328. {
  329.   ysid    *name;
  330.   yotk    *type;
  331. };
  332.  
  333. typedef struct yotkUnMbr yotkUnMbr;
  334. struct yotkUnMbr
  335. {
  336.   ysid    *name;
  337.   yoany   label;
  338.   yotk    *type;
  339. };
  340.  
  341. typedef struct yotkStrMbrSeq yotkStrMbrSeq;
  342. struct yotkStrMbrSeq 
  343. {
  344.   ub4 _length;
  345.   ub4 _maximum;
  346.   yotkStrMbr *_buffer;
  347. };
  348.  
  349. typedef struct yotkUnMbrSeq yotkUnMbrSeq;
  350. struct yotkUnMbrSeq
  351. {
  352.   ub4 _length;
  353.   ub4 _maximum;
  354.   yotkUnMbr *_buffer;
  355. };
  356.  
  357. typedef struct yotkEnumMbrSeq yotkEnumMbrSeq;
  358. struct yotkEnumMbrSeq
  359. {
  360.   ub4 _length;
  361.   ub4 _maximum;
  362.   ysid **_buffer;
  363. };
  364.  
  365. /*
  366.  * yotkCr<XXX> - typecode creation routines
  367.  *
  368.  * DESCRIPTION
  369.  * These routines (with one exception) implement the CORBA::ORB TypeCode
  370.  * creation routines. See section 6.7.3 of the CORBA 2.0 spec for more
  371.  * information. The TypeCodes returned use the CDR representation for
  372.  * TypeCodes (see section 12.3, "CDR Transfer Syntax", of the CORBA 2.0
  373.  * spec), and should be freed with ysmGlbFree().
  374.  *
  375.  * yotkCrStruct returns a struct TypeCode, given the rep id, name, and
  376.  * the sequence of members (name and type for each).
  377.  *
  378.  * yotkCrUnion returns a union TypeCode, given the id, name, discriminator
  379.  * type, and sequence of members (name, type, and label value for each).
  380.  * The 'default' label, if it exists, should be indicated by a label value
  381.  * with type yoTcOctet and value zero (0).
  382.  *
  383.  * yotkCrStruct returns a struct TypeCode, given the rep id, name, and
  384.  * the sequence of members (name for each). yotkCrExcept does the same
  385.  * thing except for returning an exception TypeCode.
  386.  *
  387.  * yotkCrAlias returns an alias TypeCode, given the rep id, name, and the
  388.  * TypeCode of the base type.
  389.  *
  390.  * yotkCrInterface returns an object TypeCode, given the rep id, and name
  391.  * of the interface. (XXX: Bug #394208 - this TypeCode is not in CDR format;
  392.  * only the interface name is kept.)
  393.  *
  394.  * yotkCrString returns a string TypeCode with the given bound. Pass in
  395.  * zero (0) to indicate an unbounded string. yotkCrSeq and yotkCrArray
  396.  * do the same thing for sequences and arrays, and require the content type
  397.  * to be passed in as well.
  398.  * 
  399.  * yotkCrRecSeq is not CORBA 2.0 compliant - it requires the offset in bytes
  400.  * of the enclosing TypeCode in addition to the logical nesting offset --
  401.  * since without the byte offset the CDR representation of the TypeCode
  402.  * cannot be created, and without the enclosing TypeCode (which cannot be
  403.  * fully computed w/o this TypeCode), the byte offset cannot be determined.
  404.  */
  405.  
  406. yotk *yotkCrStruct(CONST yrid *id, CONST ysid *nm, CONST yotkStrMbrSeq *mbrs);
  407. yotk *yotkCrExcept(CONST yrid *id, CONST ysid *nm, CONST yotkStrMbrSeq *mbrs);
  408. yotk *yotkCrUnion(CONST yrid *id, CONST ysid *nm, CONST yotk *disc,
  409.           CONST yotkUnMbrSeq *mbrs);
  410. yotk *yotkCrEnum(CONST yrid *id, CONST ysid *nm, CONST yotkEnumMbrSeq *mbrs);
  411. yotk *yotkCrAlias(CONST yrid *id, CONST ysid *nm, CONST yotk *base);
  412. yotk *yotkCrInterface(CONST yrid *id, CONST ysid *nm);
  413. yotk *yotkCrString(ub4 bound);
  414. yotk *yotkCrSeq(ub4 bound, CONST yotk *elt);
  415. yotk *yotkCrArray(ub4 length, CONST yotk *elt);
  416. yotk *yotkCrRecSeq(ub4 bound, ub4 offset, sb4 byteoff);
  417.  
  418. /*
  419.  * TypeCode traversal / utility routines
  420.  */
  421.  
  422. /*
  423.  * yotkSizeAlign - compute size and alignment
  424.  *
  425.  * DESCRIPTION
  426.  * yotkSizeAlign() returns the computed size required to hold a value
  427.  * described by the given typecode, and the alignment boundary for the
  428.  * type.  These are returned in *sz and *align, respectively. Both
  429.  * arguments must point to valid storage areas (in other words, don't pass
  430.  * in NULL).
  431.  */
  432. void yotkSizeAlign(CONST yotk *tk, size_t *sz, size_t *align);
  433.  
  434. /*
  435.  * yotkOffset - returns the pointer to the member in a container
  436.  *
  437.  * DESCRIPTION
  438.  * yotkOffset() returns the byte address of a field or element in a complex
  439.  * value (struct, sequence, etc.), given the base address, the member number,
  440.  * and the TypeCode for the value. Member numbers are zero-based, as they are
  441.  * in the yotkMbr* functions above. If tk doesn't describe a structure,
  442.  * exception, union, sequence, or array (or a typedef to one of these), the
  443.  * exception YO_EX_BADCODE will be raised. If mbr is greater than or equal
  444.  * to the # of fields in a structure or exception or the # of elements in an
  445.  * array or bounded sequence, the exception YO_EX_BOUNDS will be raised.
  446.  */
  447. dvoid * yotkOffset(CONST yotk *tk, ub4 mbr, dvoid *val);
  448.  
  449. /*
  450.  * yotkTraverse - traverse a value
  451.  *
  452.  * DESCRIPTION
  453.  * yotkTraverse() traverses a value (or pair of values) based on the
  454.  * given typecode.  Either val1 or val2 can be null.  As each sub-component
  455.  * of the value is reached, the visit callback is invoked and passed the
  456.  * typecode and address of the nested value (or values).  The usrp pointer
  457.  * is passed back to the callback for convenience during the traversal.
  458.  * The callback routine is expected to return TRUE so long
  459.  * as the traversal should continue.  yotkTraverse() will return FALSE if
  460.  * the visit routine returned FALSE, or TRUE if the traversal completed.
  461.  *
  462.  * Traversing two values simultaneously is useful for performing comparisons,
  463.  * copies, etc.
  464.  */
  465.  
  466. boolean yotkTraverse(CONST yotk *tk, dvoid *val1, dvoid *val2, dvoid *usrp,
  467.                      boolean (*visit)(CONST yotk *tk, dvoid *val1, dvoid *val2,
  468.                                       dvoid *usrp));
  469.  
  470. /*
  471.  * yotkCopyVal - copy a value by typecode
  472.  *
  473.  * DESCRIPTION
  474.  * yotkCopyVal() copies the complex value described by the typecode tk from the
  475.  * space pointed to by src to the space pointed to by dst. dst points to vaild
  476.  * buffer space where the value is to be copied.  For certain types of
  477.  * data, yotkCopy() is required to dynamically allocate memory.  This
  478.  * memory is allocated using the specified allocation function af.
  479.  *
  480.  */
  481. void yotkCopyVal(CONST yotk *tk, dvoid *dst, dvoid *src, ysmaf af);
  482.  
  483. /*
  484.  * yotkFreeVal() - frees memory allocated during a decode or a copy.
  485.  *
  486.  * DESCRIPTION
  487.  * yotkFreeVal() frees the memory allocated during a decode based on the
  488.  * specified typecode.  The ff specifies the free function to be used to
  489.  * free the memory.
  490.  */
  491. void yotkFreeVal(CONST yotk *tk, dvoid *val, ysmff ff);
  492.  
  493. /*
  494.  * yotkFmt, yotkFormat - format a value according to the typecode
  495.  *
  496.  * DESCRIPTION
  497.  * yotkFmt produces a "pretty-printed" representation of a value. If
  498.  * YOTKFMT_NAME is set, then the field names are included in the
  499.  * representation. If YOTKFMT_COLLAPSE is set, then unions and anys will
  500.  * be printed as their values, not as types and values.
  501.  *
  502.  * Example:
  503.  *   Suppose you have an any 'val'with type yoTcLong, and value 30:
  504.  *   yotkFmt(yoTcAny, val, (ub4)0)  -> "{ tk_long # 30 }"
  505.  *   yotkFmt(..., YOTKFMT_NAME)     -> "{ _type=tk_long # _value=30 }"
  506.  *   yotkFmt(..., YOTKFMT_COLLAPSE) -> "30"
  507.  *
  508.  * The string returned from yotkFmt should be freed with ysmGlbFree().
  509.  *
  510.  *   yotkFormat is a deprecated interface included for backwards compatibility.
  511.  * It is equivalent to calling yotkFmt(tk, val, YOTKFMT_NAME|YOTKFMT_COLLAPSE).
  512.  */
  513. #define YOTKFMT_NAME     ((ub4) 0x1)
  514. #define YOTKFMT_COLLAPSE ((ub4) 0x2)
  515. char *yotkFmt(CONST yotk *tk, dvoid *val, ub4 flags);
  516. char *yotkFormat(CONST yotk *tk, dvoid *val);
  517.  
  518. /*
  519.  * PRIVATE INTERFACES
  520.  */
  521.  
  522. /*
  523.  * typecode implementation-dependent routines
  524.  *
  525.  * DESCRIPTION
  526.  * yotkSize() returns the amount of memory required to hold a typecode.
  527.  * yotkGetLength() returns the length of the typecode after the kind
  528.  * and length field.
  529.  */
  530. size_t  yotkSize(CONST yotk *tk);
  531. size_t  yotkGetLength(CONST yotk *tk);
  532.  
  533. /*
  534.  * yotkAllocStr, yotkFreeStr - string cache alloc and free
  535.  *
  536.  * DESCRIPTION
  537.  * yotkAllocStr() when passed to yotkCopyVal() as the allocator function causes
  538.  * all unbounded strings to be placed in a string cache to eliminate storage of
  539.  * duplicate values.  yotkFreeStr() should be passed to yotkFreeVal() as the
  540.  * free function when freeing the storage previously allocated by
  541.  * yotkCopyVal() using yotkAllocStr() as the allocation function.
  542.  */
  543. dvoid *yotkAllocStr(size_t len);
  544. void yotkFreeStr(dvoid *ptr);
  545.  
  546. /*
  547.  * yotkCreateYrObj - return the typecode corresponding to a give IFR object
  548.  *
  549.  * DESCRIPTION
  550.  * yotkCreateYrObj() generates and returns a typecode that describes the
  551.  * given yr object.
  552.  */
  553. yotk *yotkCreateYrObj(yrobj *type);
  554.  
  555. /*
  556.  * yotkDuplicateWaf, yotkFreeWaf
  557.  *
  558.  * Use these versions of yotkDuplicate and yotkFree to control allocation
  559.  * of duplicated typecodes. Should be used only avoid yr/yc/yo circular
  560.  * dependency inside Media Net.
  561.  */
  562. yotk *yotkDuplicateWaf(CONST yotk *tk, ysmaf af);
  563. void yotkFreeWaf(yotk *tk, ysmff ff);
  564.  
  565. EXTC_END
  566. #endif /* YOTK_ORACLE */
  567.