![]() |
|
|||
0001 /** 0002 * @brief 'C' lang support 0003 * 0004 * @file clang.c 0005 */ 0006 /* ----------------------------------------------------------------------------- 0007 * Enduro/X Middleware Platform for Distributed Transaction Processing 0008 * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved. 0009 * Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved. 0010 * This software is released under one of the following licenses: 0011 * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use. 0012 * See LICENSE file for full text. 0013 * ----------------------------------------------------------------------------- 0014 * AGPL license: 0015 * 0016 * This program is free software; you can redistribute it and/or modify it under 0017 * the terms of the GNU Affero General Public License, version 3 as published 0018 * by the Free Software Foundation; 0019 * 0020 * This program is distributed in the hope that it will be useful, but WITHOUT ANY 0021 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 0022 * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3 0023 * for more details. 0024 * 0025 * You should have received a copy of the GNU Affero General Public License along 0026 * with this program; if not, write to the Free Software Foundation, Inc., 0027 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 0028 * 0029 * ----------------------------------------------------------------------------- 0030 * A commercial use license is available from Mavimax, Ltd 0031 * contact@mavimax.com 0032 * ----------------------------------------------------------------------------- 0033 */ 0034 0035 /*---------------------------Includes-----------------------------------*/ 0036 0037 #include <unistd.h> 0038 #include <stdio.h> 0039 #include <errno.h> 0040 #include <stdlib.h> 0041 #include <atmi.h> 0042 0043 #include <ubf.h> 0044 #include <ubf_int.h> 0045 #include <ferror.h> 0046 #include <fieldtable.h> 0047 #include <fdatatype.h> 0048 0049 #include <ndrstandard.h> 0050 #include <ndebug.h> 0051 #include "mkfldhdr.h" 0052 /*---------------------------Externs------------------------------------*/ 0053 /*---------------------------Macros-------------------------------------*/ 0054 /*---------------------------Enums--------------------------------------*/ 0055 /*---------------------------Typedefs-----------------------------------*/ 0056 /*---------------------------Globals------------------------------------*/ 0057 /*---------------------------Statics------------------------------------*/ 0058 /*---------------------------Prototypes---------------------------------*/ 0059 0060 /** 0061 * Get the c lang output file name 0062 * @param data 0063 */ 0064 expublic void c_get_fullname(char *data) 0065 { 0066 sprintf(data, "%s/%s.h", G_output_dir, G_active_file); 0067 } 0068 0069 /** 0070 * Write text line to output file 0071 * @param text 0072 * @return 0073 */ 0074 expublic int c_put_text_line (char *text) 0075 { 0076 int ret=EXSUCCEED; 0077 0078 fprintf(G_outf, "%s", text); 0079 0080 /* Check errors */ 0081 if (ferror(G_outf)) 0082 { 0083 ndrx_Bset_error_fmt(BFTOPEN, "Failed to write to output file: [%s]", strerror(errno)); 0084 ret=EXFAIL; 0085 } 0086 0087 return ret; 0088 } 0089 0090 /** 0091 * Process the baseline 0092 * @param base 0093 * @return 0094 */ 0095 expublic int c_put_got_base_line(char *base) 0096 { 0097 0098 int ret=EXSUCCEED; 0099 0100 fprintf(G_outf, "/*\tfname\tbfldid */\n" 0101 "/*\t-----\t----- */\n"); 0102 0103 /* Check errors */ 0104 if (ferror(G_outf)) 0105 { 0106 ndrx_Bset_error_fmt(BFTOPEN, "Failed to write to output file: [%s]", strerror(errno)); 0107 ret=EXFAIL; 0108 } 0109 0110 return ret; 0111 } 0112 0113 /** 0114 * Write definition to output file 0115 * @param def 0116 * @return 0117 */ 0118 expublic int c_put_def_line (UBF_field_def_t *def) 0119 { 0120 int ret=EXSUCCEED; 0121 int type = def->bfldid>>EFFECTIVE_BITS; 0122 BFLDID number = def->bfldid & EFFECTIVE_BITS_MASK; 0123 0124 fprintf(G_outf, "#define\t%s\t((BFLDID32)%d)\t/* number: %d\t type: %s */\n", 0125 def->fldname, def->bfldid, number, 0126 G_dtype_str_map[type].fldname); 0127 0128 /* Check errors */ 0129 if (ferror(G_outf)) 0130 { 0131 ndrx_Bset_error_fmt(BFTOPEN, "Failed to write to output file: [%s]", strerror(errno)); 0132 ret=EXFAIL; 0133 } 0134 0135 return ret; 0136 } 0137 0138 /** 0139 * Output file have been open 0140 * @param fname 0141 * @return 0142 */ 0143 expublic int c_file_open (char *fname) 0144 { 0145 return EXSUCCEED; 0146 } 0147 0148 /** 0149 * Output file have been closed 0150 * @param fname 0151 * @return 0152 */ 0153 expublic int c_file_close (char *fname) 0154 { 0155 return EXSUCCEED; 0156 } 0157 0158 /* vim: set ts=4 sw=4 et smartindent: */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |