Skip to content

Commit

Permalink
re-org
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMorano committed May 25, 2024
1 parent b4b4a64 commit c3794bf
Show file tree
Hide file tree
Showing 37 changed files with 180 additions and 248 deletions.
1 change: 1 addition & 0 deletions doc/copyright.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Copyright � 2017 David A�D� Morano. All rights reserved. */
1 change: 1 addition & 0 deletions doc/lang.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* lang=C++20 */
7 changes: 7 additions & 0 deletions doc/minhdrs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <envstandards.h> /* ordered first to configure */
#include <clanguage.h>
#include <utypedefs.h>
#include <utypealiases.h>
#include <usysrets.h>
#include <usyscalls.h>
#include <localmisc.h>
1 change: 1 addition & 0 deletions doc/sccs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* version %I% last-modified %G% */
1 change: 1 addition & 0 deletions src/copyright.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Copyright � 2017 David A�D� Morano. All rights reserved. */
30 changes: 27 additions & 3 deletions src/testlang/main.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/* main SUPPOER (testlang */
/* main SUPPORR (testlang */
/* lang=C++20 */

/* test the language itself */
/* version %I% last-modified %G% */


#include <envstandards.h> /* MUST be first to configure */
Expand Down Expand Up @@ -27,6 +31,17 @@ using std::cout ; /* variable */
/* exported variables */


/* forward references */

static void sub1() noex ;


/* local variables */


/* exported variables */


/* exported subroutines */

int main(int argc,mainv,mainv) {
Expand All @@ -38,13 +53,22 @@ int main(int argc,mainv,mainv) {
cint c = 2 ;
return (b + c) ;
} ;

cout << a << eol ;
cout << lamb() << eol ;

sub1() ;
if ((ex == EX_OK) && (rs < 0)) ex = EX_DATAERR ;
return ex ;
}
/* end subroutine (main) */


/* local subroutines */

static void sub1() noex {
cchar *sp = "hello\n" ;
for (int i = 0 ; *sp ; i += 1) {
cout << i << *sp++ << '\n' ;
}
}


5 changes: 2 additions & 3 deletions src/testlang/main_promotion.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* main SUPPORT (testlang) */
/* main SUPPORT (main_promotion) */
/* lang=C++20 */


#include <sys/types.h>
Expand Down Expand Up @@ -41,8 +42,6 @@ int main() {
si = (u2c - u1c) ;
fprintf(stdout,"subtraction si=%08x\n",si) ;

fclose(stdout) ;

return 0 ;
}
/* end subroutine (main) */
Expand Down
28 changes: 10 additions & 18 deletions src/testlang/mainfmtstr.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* main SUPPOER (testlang */
/* main SUPPOER (mainfmtstr) */
/* lang=C++20 */


#include <envstandards.h> /* MUST be first to configure */
Expand All @@ -25,20 +26,13 @@

int main(int argc,mainv,mainv) {
bfile outfile, *ofp = &outfile ;

unsigned long long a, r ;

unsigned int ui, uii ;

int rs ;
int i, ii ;
int rs1 ;
int ex = EX_OK ;


rs = bopen(ofp,BFILE_STDOUT,"dwct",0666) ;

if (rs < 0)
goto ret0 ;
if ((rs = bopen(ofp,BFILE_STDOUT,"dwct",0666)) >= 0) {
unsigned long long a, r ;
unsigned int ui, uii ;
int i, ii ;

a = 0xFFFFFFFFFFFFFF01ULL ;

Expand All @@ -57,12 +51,10 @@ int main(int argc,mainv,mainv) {
r = (long long) (~ ui) ;
bprintf(ofp,"r2=%016llX\n",r) ;

bclose(ofp) ;

ret1:
rs1 = bclose(ofp) ;
if (rs >= 0) rs = rs1 ;
} /* end if (bfile) */
ex = (rs >= 0) ? EX_OK : EX_DATAERR ;

ret0:
return ex ;
}
/* end subroutine (main) */
Expand Down
33 changes: 0 additions & 33 deletions src/testlang/shifter.c

This file was deleted.

Binary file added src/testlang/x
Binary file not shown.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions src/testmisc/testcharconv.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Hello there
second line
File renamed without changes.
9 changes: 3 additions & 6 deletions testmisc/testexit.cc → src/testmisc/testexit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ Compile and execute:

using namespace std ;

extern void sub() noex ;

extern "C" {
static void efunc() noex ;
}
Expand All @@ -53,16 +51,15 @@ int main(int,const char **,const char **) {
cout << "main.begin\n" ;
{
atexit(efunc) ;
sub() ;
}
cout << "main.end\n" ;
exit(0) ;
}

static void efunc() noex {
cchar *sp = "main.efunc\n" ;
cint sl = strlen(sp) ;
write(1,sp,sl) ;
cchar *sp = "main.efunc\n" ;
cint sl = strlen(sp) ;
write(1,sp,sl) ;
}


29 changes: 0 additions & 29 deletions src/testmisc/testinit.c

This file was deleted.

6 changes: 4 additions & 2 deletions testmisc/testinit.cc → src/testmisc/testinit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
/* Copyright © 2000 David A­D­ Morano. All rights reserved. */

#include <envstandards.h> /* ordered first to configure */
#include <cstdlib>
#include <cstddef> /* |nullptr_t| */
#include <cstdlib> /* |getprogname(3c)| */
#include <cstdio>
#include <iostream>
#include <utypedefs.h>
Expand Down Expand Up @@ -39,7 +40,7 @@ extern "C" {
}

int main(int argc,const char **argv,const char **envv) {
static int srs = mkterms() ;
static cint srs = mkterms() ;
int rs ;
int ex = 0 ;
if ((rs = srs) >= 0) {
Expand All @@ -65,3 +66,4 @@ static int mkterms() noexcept {
return 0 ;
}


File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
111 changes: 111 additions & 0 deletions src/testmisc/testobjaddr.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/* testobjaddr SUPPORT */
/* lang=C++98 */

/* show object addresses */
/* version %I% last-modified %G% */


/* revision history:
= 1998-12-01, David A­D­ Morano
This subroutine was written for Rightcore Network Services.
*/

/* Copyright © 1998 David A­D­ Morano. All rights reserved. */

/*******************************************************************************
This program shows (prints out) object addresess.
*******************************************************************************/

#include <envstandards.h> /* MUST be ordered first to configure */
#include <sys/types.h>
#include <climits>
#include <string>
#include <new>
#include <initializer_list>
#include <utility>
#include <functional>
#include <algorithm>
#include <set>
#include <string>
#include <iostream>
#include <usystem.h>
#include <localmisc.h>


/* local defines */


/* imported namespaces */

using namespace std ; /* yes, we want punishment! */


/* external subroutines */


/* local structures */

struct Base {
string id ;
Base(cchar *s) : id(s) {
cout << "Base::ctor " << id << eol ;
} ;
~Base() {
cout << "Base::dtor " << id << eol ;
} ;
} ;

struct Derived : Base {
string id ;
Derived(cchar *s) : Base(s), id(s) {
cout << "Derived::ctor " << id << eol ;
} ;
~Derived() {
cout << "Derived::dtor " << id << eol ;
} ;
} ;


/* forward references */

static void sub1() ;


/* local variables */


/* exported variables */


/* exported subroutines */

int main(int,mainv,mainv) {
Base *bp = new Derived("a") ;
cout << bp << eol ;
{
Derived *dp = static_cast<Derived *>(bp) ;
void *vp = bp ;
cout << dp << " " << vp << eol ;
}
sub1() ;
Derived *dp = static_cast<Derived *>(bp) ;
delete dp ;
}
/* end subroutine (main) */

static void sub1() {
Derived *dp = new Derived("b") ;
cout << "sub1 " << dp << eol ;
{
Base *bp = dp ;
void *vp = dp ;
cout << "sub1 " << bp << " " << vp << eol ;
}
delete dp ;
}


Loading

0 comments on commit c3794bf

Please sign in to comment.