Esempio n. 1
0
        public static void Copy(ref string destinationString, int startIndex, int lastIndex, char source)
        {
            if (startIndex != lastIndex)
            {
                ArgumentException argEx = new ArgumentException("startIndex != lastIndex");
            }

            FortranLib.Copy(ref destinationString, startIndex, lastIndex, source.ToString());
        }
Esempio n. 2
0
        public static void Date_And_Time(Characters date, Characters time)
        {
            DateTime _dateTime = DateTime.Now;

            date.ToBlanks(8);
            time.ToBlanks(10);
            FortranLib.Copy(date, _dateTime.ToString("yyyyMMdd"));
            FortranLib.Copy(time, _dateTime.ToString("hhmmss.fff"));
        }
Esempio n. 3
0
        public static void ConsoleReadLine(Characters destination, int length)
        {
            string s = Console.ReadLine();

            if (s.Length > length)
            {
                s = s.Substring(0, length);
            }
            destination.ToBlanks(length);
            FortranLib.Copy(destination, s);
        }
Esempio n. 4
0
        public static void WriteFloat(Characters destination, float number, int width, int d)
        {
            //The term w must be large enough to include:
            //• a minus sign for a negative value or a plus sign (when SP is in effect) for a positive value
            //• the decimal point
            //• d digits to the right of the decimal
            //If w is insufficiently large, the entire field width is filled with asterisks.
            //Therefore, w must be > d + 2.

            destination.ToBlanks(width);

            string s = "";

            if (width <= d + 2)
            {
                s = new string('*', width);
            }
            else
            {
                char[] formatCharArray = new char[width];
                for (int i = 0; i < formatCharArray.Length; i++)
                {
                    formatCharArray[i] = '#';
                }
                for (int i = 0; i < d; i++)
                {
                    formatCharArray[i] = '0';
                }
                formatCharArray[d] = '.';
                Array.Reverse(formatCharArray);
                string format = new string(formatCharArray);
                s = number.ToString(format);
            }
            if (s.Length > width)
            {
                s = new string('*', width);
            }
            else
            {
                s = new string(' ', width - s.Length) + s;
            }
            FortranLib.Copy(destination, s);
        }
Esempio n. 5
0
        public static void WriteInt(Characters destination, int number, int width, int m)
        {
            //w is a nonzero, unsigned integer constant denoting the size of
            //the external field, including blanks and a sign, if necessary.
            //A minus sign (-) is always printed on output if the number
            //is negative. If the number is positive, a plus sign (+) is
            //printed only if SP is in effect.
            //m is an unsigned integer constant denoting the minimum
            //number of digits required on output. m is ignored on input.
            //The value of m must not exceed w; if m is omitted, a value of
            //1 is assumed.


            //Examples of I Editing on Output
            //Value      Format      Output
            //-12        I7.6         -000012
            //12345      I5         12345

            destination.ToBlanks(width);

            char[] formatCharArray = new char[width];
            for (int i = 0; i < formatCharArray.Length; i++)
            {
                formatCharArray[i] = '#';
            }
            for (int i = 0; i < m; i++)
            {
                formatCharArray[i] = '0';
            }
            Array.Reverse(formatCharArray);
            string format = new string(formatCharArray);
            string s      = number.ToString(format);

            if (s.Length > width)
            {
                s = new string('*', width);
            }
            else
            {
                s = new string(' ', width - s.Length) + s;
            }
            FortranLib.Copy(destination, s);
        }
Esempio n. 6
0
 public static void Copy(Characters destination, string source)
 {
     FortranLib.Copy(destination.CharArray, 1, source.ToCharArray());
 }
Esempio n. 7
0
 public static void Copy(Characters destination, int startIndex, int lastIndex, string source)
 {
     FortranLib.Copy(destination.CharArray, startIndex, lastIndex, source.ToCharArray());
 }
Esempio n. 8
0
 public static void Copy(Characters destination, Characters source)
 {
     FortranLib.Copy(destination.CharArray, 1, source.CharArray);
 }
Esempio n. 9
0
 public static void Copy(Characters destination, int startIndex, Characters source)
 {
     FortranLib.Copy(destination.CharArray, startIndex, source.CharArray);
 }
Esempio n. 10
0
 public static void Copy(char[] destinationArray, int startIndex, char[] sourceArray)
 {
     FortranLib.Copy(destinationArray, startIndex, destinationArray.Length, sourceArray);
 }
Esempio n. 11
0
 /// <summary>
 ///Retrieves a substring . The substring starts at a specified
 ///character position.
 /// </summary>
 /// <param name="s"></param>
 /// <param name="startIndex"></param>
 /// <returns></returns>
 public static char[] Substring(char[] s, int startIndex)
 {
     return(FortranLib.Substring(s, startIndex, s.Length));
 }
Esempio n. 12
0
 public static void Copy(ref string destinationString, string sourceString)
 {
     FortranLib.Copy(ref destinationString, 1, sourceString);
 }
Esempio n. 13
0
        public static void Copy(ref string destinationString, int startIndex, string sourceString)
        {
            int lastIndex = Math.Min(destinationString.Length, sourceString.Length);

            FortranLib.Copy(ref destinationString, startIndex, lastIndex, sourceString);
        }
Esempio n. 14
0
 public static void Copy(ref string destinationString, int startIndex, int lastIndex, string sourceString)
 {
     char[] destinationArray = destinationString.ToCharArray();
     FortranLib.Copy(destinationArray, startIndex, lastIndex, sourceString.ToCharArray());
     destinationString = new string(destinationArray);
 }
Esempio n. 15
0
 public static int INDEX(Characters chars, Characters value)
 {
     return(FortranLib.INDEX(chars.ToString(), value.ToString()));
 }
Esempio n. 16
0
 public static int INDEX(Characters chars, string value)
 {
     return(FortranLib.INDEX(chars.ToString(), value, false));
 }
Esempio n. 17
0
 public static int INDEX(Characters chars, string value, bool back)
 {
     return(FortranLib.INDEX(chars.ToString(), value, back));
 }
Esempio n. 18
0
 public static int SCAN(Characters charArray, string set)
 {
     return(FortranLib.SCAN(charArray.ToString(), set));
 }