dernier commit avant le Gers

This commit is contained in:
tTh
2024-03-11 02:20:47 +01:00
parent c5b0e17bbb
commit 0818f87582
9 changed files with 99 additions and 23 deletions

View File

@@ -0,0 +1,12 @@
# Le BASIC
Un des premiers langages abordable par tout le monde,
crée il y a très longtemps à Dartmouth. Il a eu ensuite
une longue et fructueuse carrière, surtout à l'époque
des ordinateurs personnels de la regrettée famille des
8 bits : Apple ][, Amstrad CPC6128, la série des MSX,
l'Oric...

8
code/C/hacks.txt Normal file
View File

@@ -0,0 +1,8 @@
inline int
usleep(useconds_t microseconds)
{
struct timespec ts;
ts.tv_sec = microseconds / (useconds_t)1000000;
ts.tv_nsec = (long)(microseconds % (useconds_t)1000000) * 1000L;
return nanosleep(&ts, NULL);
}

View File

@@ -7,18 +7,20 @@ int main(int argc, char *argv[])
{
int c, sec, nano;
struct timespec ts;
int slowdown = 300; /* set a default value */
int slowdown = 300; /* set a default value */
float delay;
/*
* get the desired slowdown from command-line
*/
if (2 == argc) {
if (1 != sscanf(argv[1], "%d", &slowdown)) {
fprintf(stderr, "%s: bad arg, sorry\n", argv[0]);
fprintf(stderr, "%s: bad arg, sorry\n",
argv[0]);
exit(1);
}
if (slowdown < 1) {
fprintf(stderr, "%d is invalid\n", slowdown);
fprintf(stderr, "%d is invalid\n",
slowdown);
exit(1);
}
}

View File

@@ -6,10 +6,10 @@ program dessiner
character(len=80) :: version
call plgver(version)
write (*,'(a,a)') 'plPlot version: ', trim(version)
write (*,'(" ",a,a)') 'plPlot version: ', trim(version)
! call dessin_X11 (0.00, 1.51, 11)
call dessin_dans_un_fichier ()
call dessin_X11 (0.12, 1.51, 11)
!! call dessin_dans_un_fichier ()
contains ! -----------------------------
!------------------------------------------------------
@@ -33,13 +33,13 @@ subroutine dessin_X11 (sha, shb, color)
call plsdev('xwin')
call plinit ()
call plenv (-2.1, 2.1, -2.1, 2.1, 1, 2)
call plenv (-2.5, 2.5, -2.5, 2.5, 1, 2)
amp = 2.16
amp = 2.06
do i = 1, lg
k = real(i)/real(lg) * 6.2832 * 4.0
x(i) = amp * sin((k+sha)*5)
y(i) = amp * cos((k+shb)*3)
k = real(i)/real(lg) * 6.2832 * 2.0
x(i) = amp * sin((k+sha))
y(i) = amp * cos((k+shb))
enddo
! print *, k, x(i), y(i)

View File

@@ -1,7 +1,7 @@
# Outils divers
OK, let's go for a few nice tools.
*OK, let's go for a few nice tools.*
## non ascii ?

View File

@@ -10,26 +10,29 @@
/* ------------------------------------------------------------------ */
int check_a_file_by_fp(FILE *fp, char *filename)
{
int input, linenum, count;
int input, linenum, colnum, count;
int flagline;
linenum = 1; /* humans start line count at 1 */
colnum = 1;
count = 0;
while (EOF != (input=getc(stdin))) {
if ('\n' == input) {
linenum++;
flagline = 0;
colnum = 1;
}
if ((input < 0) || (input>127)) {
if (!flagline) {
fprintf(stderr, "%s: non ascii 0x%x line %d\n",
fprintf(stderr, "%s: nonascii 0x%x line %d, col %d\n",
filename,
input, linenum);
input, linenum, colum);
flagline = 1;
}
count++;
}
colnum++;
}
return count;
}