File: fread.c

    1   /*
    2    * fread.c
    3    *
    4    * Code generation for function 'fread'
    5    *
    6    */
    7   
    8   /* Include files */
    9   #include "rt_nonfinite.h"
   10   #include "Datalogger4ChConverter_ErrInsensitiveSound.h"
   11   #include "fread.h"
   12   #include "error.h"
   13   #include "Datalogger4ChConverter_ErrInsensitiveSound_emxutil.h"
   14   #include "fileManager.h"
   15   #include "Datalogger4ChConverter_ErrInsensitiveSound_mexutil.h"
   16   #include <stdio.h>
   17   
   18   /* Variable Definitions */
   19   static emlrtRSInfo p_emlrtRSI = { 51, "fread",
   20     "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\iofun\\fread.m"
   21   };
   22   
   23   static emlrtRSInfo q_emlrtRSI = { 67, "fread",
   24     "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\iofun\\fread.m"
   25   };
   26   
   27   static emlrtRSInfo r_emlrtRSI = { 83, "fread",
   28     "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\iofun\\fread.m"
   29   };
   30   
   31   static emlrtRSInfo s_emlrtRSI = { 160, "fread",
   32     "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\iofun\\fread.m"
   33   };
   34   
   35   static emlrtMCInfo b_emlrtMCI = { 344, 1, "fread",
   36     "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\iofun\\fread.m"
   37   };
   38   
   39   static emlrtMCInfo c_emlrtMCI = { 348, 9, "fread",
   40     "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\iofun\\fread.m"
   41   };
   42   
   43   static emlrtRTEInfo h_emlrtRTEI = { 1, 22, "fread",
   44     "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\iofun\\fread.m"
   45   };
   46   
   47   static emlrtDCInfo e_emlrtDCI = { 380, 45, "fread",
   48     "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\iofun\\fread.m",
   49     4 };
   50   
   51   static emlrtRSInfo qb_emlrtRSI = { 348, "fread",
   52     "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\iofun\\fread.m"
   53   };
   54   
   55   static emlrtRSInfo rb_emlrtRSI = { 344, "fread",
   56     "C:\\Program Files\\MATLAB\\R2016a\\toolbox\\eml\\lib\\matlab\\iofun\\fread.m"
   57   };
   58   
   59   /* Function Declarations */
   60   static void b_feval(const emlrtStack *sp, const mxArray *b, const mxArray *c,
   61                       const mxArray *d, const mxArray *e, const mxArray *f,
   62                       emlrtMCInfo *location, const mxArray **g, const mxArray **h);
   63   static void c_emlrt_marshallIn(const emlrtStack *sp, const mxArray *t, const
   64     char_T *identifier, emxArray_uint8_T *y);
   65   static void d_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u, const
   66     emlrtMsgIdentifier *parentId, emxArray_uint8_T *y);
   67   static void j_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src, const
   68     emlrtMsgIdentifier *msgId, emxArray_uint8_T *ret);
   69   static const mxArray *size(const emlrtStack *sp, const mxArray *b, const mxArray
   70     *c, emlrtMCInfo *location);
   71   
   72   /* Function Definitions */
   73   static void b_feval(const emlrtStack *sp, const mxArray *b, const mxArray *c,
   74                       const mxArray *d, const mxArray *e, const mxArray *f,
   75                       emlrtMCInfo *location, const mxArray **g, const mxArray **h)
   76   {
   77     const mxArray *pArrays[5];
   78     const mxArray *mv0[2];
   79     pArrays[0] = b;
   80     pArrays[1] = c;
   81     pArrays[2] = d;
   82     pArrays[3] = e;
   83     pArrays[4] = f;
   84     emlrtAssign(g, emlrtCallMATLABR2012b(sp, 2, &mv0[0], 5, pArrays, "feval", true,
   85       location));
   86     emlrtAssign(h, mv0[1]);
   87   }
   88   
   89   static void c_emlrt_marshallIn(const emlrtStack *sp, const mxArray *t, const
   90     char_T *identifier, emxArray_uint8_T *y)
   91   {
   92     emlrtMsgIdentifier thisId;
   93     thisId.fIdentifier = identifier;
   94     thisId.fParent = NULL;
   95     thisId.bParentIsCell = false;
   96     d_emlrt_marshallIn(sp, emlrtAlias(t), &thisId, y);
   97     emlrtDestroyArray(&t);
   98   }
   99   
  100   static void d_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u, const
  101     emlrtMsgIdentifier *parentId, emxArray_uint8_T *y)
  102   {
  103     j_emlrt_marshallIn(sp, emlrtAlias(u), parentId, y);
  104     emlrtDestroyArray(&u);
  105   }
  106   
  107   static void j_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src, const
  108     emlrtMsgIdentifier *msgId, emxArray_uint8_T *ret)
  109   {
  110     static const int32_T dims[1] = { -1 };
  111   
  112     boolean_T bv0[1] = { true };
  113   
  114     int32_T iv10[1];
  115     int32_T i11;
  116     emlrtCheckVsBuiltInR2012b(sp, msgId, src, "uint8", false, 1U, dims, &bv0[0],
  117       iv10);
  118     i11 = ret->size[0];
  119     ret->size[0] = iv10[0];
  120     emxEnsureCapacity(sp, (emxArray__common *)ret, i11, (int32_T)sizeof(uint8_T),
  121                       (emlrtRTEInfo *)NULL);
  122     emlrtImportArrayR2015b(sp, src, ret->data, 1, false);
  123     emlrtDestroyArray(&src);
  124   }
  125   
  126   static const mxArray *size(const emlrtStack *sp, const mxArray *b, const mxArray
  127     *c, emlrtMCInfo *location)
  128   {
  129     const mxArray *pArrays[2];
  130     const mxArray *m7;
  131     pArrays[0] = b;
  132     pArrays[1] = c;
  133     return emlrtCallMATLABR2012b(sp, 1, &m7, 2, pArrays, "size", true, location);
  134   }
  135   
  136   void b_fread(const emlrtStack *sp, real_T fileID, emxArray_uint8_T *A)
  137   {
  138     boolean_T b0;
  139     int32_T i4;
  140     const mxArray *y;
  141     char_T u[5];
  142     static const char_T cv1[5] = { 'f', 'r', 'e', 'a', 'd' };
  143   
  144     const mxArray *m1;
  145     static const int32_T iv5[2] = { 1, 5 };
  146   
  147     const mxArray *b_y;
  148     char_T b_u[12];
  149     static const char_T precision[12] = { 'u', 'i', 'n', 't', '8', '=', '>', 'u',
  150       'i', 'n', 't', '8' };
  151   
  152     static const int32_T iv6[2] = { 1, 12 };
  153   
  154     const mxArray *c_y;
  155     const mxArray *t = NULL;
  156     const mxArray *count = NULL;
  157     real_T nrows;
  158     emlrtStack st;
  159     emlrtStack b_st;
  160     emlrtStack c_st;
  161     emlrtStack d_st;
  162     st.prev = sp;
  163     st.tls = sp->tls;
  164     st.site = &p_emlrtRSI;
  165     b_st.prev = &st;
  166     b_st.tls = st.tls;
  167     c_st.prev = &b_st;
  168     c_st.tls = b_st.tls;
  169     d_st.prev = &c_st;
  170     d_st.tls = c_st.tls;
  171     if ((fileID != 0.0) && (fileID != 1.0) && (fileID != 2.0)) {
  172       b0 = true;
  173     } else {
  174       b0 = false;
  175     }
  176   
  177     if (!b0) {
  178       b_st.site = &q_emlrtRSI;
  179       error(&b_st);
  180     }
  181   
  182     b_st.site = &r_emlrtRSI;
  183     c_st.site = &s_emlrtRSI;
  184     for (i4 = 0; i4 < 5; i4++) {
  185       u[i4] = cv1[i4];
  186     }
  187   
  188     y = NULL;
  189     m1 = emlrtCreateCharArray(2, iv5);
  190     emlrtInitCharArrayR2013a(&c_st, 5, m1, &u[0]);
  191     emlrtAssign(&y, m1);
  192     for (i4 = 0; i4 < 12; i4++) {
  193       b_u[i4] = precision[i4];
  194     }
  195   
  196     b_y = NULL;
  197     m1 = emlrtCreateCharArray(2, iv6);
  198     emlrtInitCharArrayR2013a(&c_st, 12, m1, &b_u[0]);
  199     emlrtAssign(&b_y, m1);
  200     c_y = NULL;
  201     m1 = emlrtCreateNumericMatrix(1, 1, mxINT32_CLASS, mxREAL);
  202     *(int32_T *)mxGetData(m1) = 0;
  203     emlrtAssign(&c_y, m1);
  204     d_st.site = &rb_emlrtRSI;
  205     b_feval(&d_st, y, emlrt_marshallOut(fileID), emlrt_marshallOut(rtInf), b_y,
  206             c_y, &b_emlrtMCI, &t, &count);
  207     d_st.site = &rb_emlrtRSI;
  208     emlrt_marshallIn(&d_st, emlrtAlias(count), "count");
  209     d_st.site = &qb_emlrtRSI;
  210     nrows = emlrt_marshallIn(&d_st, size(&d_st, emlrtAlias(t), emlrt_marshallOut
  211       (1.0), &c_emlrtMCI), "size");
  212     if (!(nrows >= 0.0)) {
  213       emlrtNonNegativeCheckR2012b(nrows, &e_emlrtDCI, &c_st);
  214     }
  215   
  216     if (nrows == 0.0) {
  217       i4 = A->size[0];
  218       A->size[0] = 0;
  219       emxEnsureCapacity(&c_st, (emxArray__common *)A, i4, (int32_T)sizeof(uint8_T),
  220                         &h_emlrtRTEI);
  221     } else {
  222       c_emlrt_marshallIn(&c_st, emlrtAlias(t), "t", A);
  223     }
  224   
  225     emlrtDestroyArray(&t);
  226     emlrtDestroyArray(&count);
  227   }
  228   
  229   /* End of code generation (fread.c) */
  230