Esempio n. 1
0
        /*
         * make header
         */
        public static void luaU_header(CharPtr h)
        {
            h = new CharPtr(h);
            int x = 1;

            memcpy(h, LINYEE_SIGNATURE, LINYEE_SIGNATURE.Length);
            h    = h.add(LINYEE_SIGNATURE.Length);
            h[0] = (char)LUAC_VERSION;
            h.inc();
            h[0] = (char)LUAC_FORMAT;
            h.inc();
            //*h++=(char)*(char*)&x;				/* endianness */
            h[0] = (char)x;                                                     /* endianness */
            h.inc();
            h[0] = (char)sizeof(int);
            h.inc();
            h[0] = (char)sizeof(uint);
            h.inc();
            h[0] = (char)sizeof(Instruction);
            h.inc();
            h[0] = (char)sizeof(ly_Number);
            h.inc();

            //(h++)[0] = ((ly_Number)0.5 == 0) ? 0 : 1;		/* is ly_Number integral? */
            h[0] = (char)0;             // always 0 on this build
        }
Esempio n. 2
0
        // This strftime implementation has been made following the
        // Sanos OS open-source strftime.c implementation at
        // http://www.jbox.dk/sanos/source/lib/strftime.c.html

        private static uint strftime(CharPtr s, uint maxsize, CharPtr format, DateTime t)
        {
            int sIndex = s.index;

            CharPtr p = StrFTimeFmt((format as object) == null ? "%c" : format, t, s, s.add((int)maxsize));

            if (p == s + maxsize)
            {
                return(0);
            }
            p[0] = '\0';

            return((uint)Math.Abs(s.index - sIndex));
        }