Post Reply 
File problems due to lack two instructions. #INCLUDED ...
03-24-2017, 05:11 PM (This post was last modified: 03-26-2017 10:42 PM by compsystems.)
Post: #1
File problems due to lack two instructions. #INCLUDED ...
Hello I'm creating a project that has n files that contain few equal internal names, and the functions are called between them.

Please create the following two files, from the HPP-CK

A: The MAIN files of each file display a text string "NAME FILE MAIN"

prg1.main; [ENTER] RETURNS "prg1 main" // Expected output.
prg2.main; [ENTER] RETURNS "prg2 main" // Expected output.

B: the functionX files of each file show a list that calls the main function of its own file and the other.

prg1.functionX; [ENTER] RETURNS {"prg1 main", "prg2 main"} // Expected output.
prg2.functionX; [ENTER] RETURNS {"prg2 main", "prg1 main"} // Expected output.


FILE1 NAME: prg1
PHP Code:
EXPORT main()
BEGIN
 
return "prg1 main";
END;

EXPORT functionX()
BEGIN
 
return { mainprg2.main };
END;

//EXPORT ... 

prg1.functionX(); [ENTER] RETURNS "syntax error" // ok because prg2 has not yet been defined.


FILE2 NAME: prg2
PHP Code:
EXPORT main()
BEGIN
 
return "prg2 main";
END;

EXPORT functionX()
BEGIN
 
return { mainprg1.main };
END;

//export ... 

prg1.functionX(); [ENTER] RETURNS "syntax error" // Why?
or
prg2.functionX(); [ENTER] RETURNS "syntax error" // Why?

A trick, if you temporarily delete the path, it compiles successfully

PHP Code:
return { mainprg1.main }; 
-> [SAVE] OK
PHP Code:
return { mainmain }; 

then rewrite route
PHP Code:
return { mainprg1.main }; 
-> [SAVE] OK

The two files work fine, but think if there are several definitions, it is very laborious to perform the previous trick.

prg1.main; [ENTER] RETURNS "prg1 main" // ok
prg2.main; [ENTER] RETURNS "prg2 main" // ok

prg1.functionX; [ENTER] RETURNS {"prg1 main", "prg2 main"} // ok
prg2.functionX; [ENTER] RETURNS {"prg2 main", "prg1 main"} // ok

///////////////////////////////////////////

Now If you rename any of the files it is obvious that a syntax error is generated. Because the path is not found

prg2 -> prgM2

prg1.functionX; [ENTER] RETURNS "syntax error" // ok

But if you re-rename with the original names still showing syntax error, Why?

prgM2 -> prg2

prg1.functionX; [ENTER] RETURNS "syntax error" // ?



From this arises the need for two new cmds or headers

#INTERNAL: Internal name, not to depend on the name stored in the calculator or PC

#INCLUDED: File for compilation attached

FILE 1 NAME: 123ABCDEFRFR
PHP Code:
#INTERNAL prg1
#INCLUDED  prg2

EXPORT main()
BEGIN
 
return "prg1 main";
END;

EXPORT functionX()
BEGIN
 
return { mainprg2.main };
END;

// EXPORT ... 

FILE 2 NAME: 00000888
PHP Code:
#INTERNAL prg2
#INCLUDED  prg1

EXPORT main()
BEGIN
 
return "prg2 main";
END;

EXPORT functionX()
BEGIN
 
return { mainprg1.main };
END;

//export ... 

I am not the only one that creates independent programs or a single file
http://www.hpmuseum.org/forum/thread-722...ht=libmenu
Find all posts by this user
Quote this message in a reply
03-28-2017, 06:02 AM
Post: #2
RE: File problems due to lack two instructions. #INCLUDED ...
Hello,

To use a name, it has to exist and be valid.

When you compile the first program, it errs on the distant program call. As a result, the name prg1.main does not exist and is not valid.

So, when you try to compile program 2, you have the same issue.

The only way, as you discovered, is to first make prg1.main valid by having prg1 compile correctly. then you can use it in prg2. and then fix prg1...

I know that this is frustrating, but please remember that the system is not desinged to allow 2 distinct programs to work together. The idea is that each program is independent.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
03-30-2017, 02:46 PM (This post was last modified: 03-30-2017 03:03 PM by compsystems.)
Post: #3
RE: File problems due to lack two instructions. #INCLUDED ...
(03-28-2017 06:02 AM)cyrille de brébisson Wrote:  ... the system is not desinged to allow 2 distinct programs to work together. The idea is that each program is independent.
Cyrille

If the function calls, in only one way as the testmenu program with LIBMENU works correctly. Now if I modify my example also works.

Limiting to a single file is very difficult to maintain when the file is too long or contains several functions, "DIVIDE EN VARIOS ARCHIVOS Y FUNCIONES Y VENCERÁS" (spn) is a common phrase in the world of computer programming

file1: prg1.hpprgm
PHP Code:
EXPORT main()
BEGIN
 
return "prg1 main";
END;

EXPORT functionX()
BEGIN
 
return { main };
END

file2: prg2.hpprgm
PHP Code:
EXPORT main()
BEGIN
 
return "prg2_main";
END;

EXPORT functionX()
BEGIN
 
return { mainprg1.main };
END

Now a problem (with TEXBOOK DISPLAY ON) that generates confusion, the path of each program is lost in the history, the complete path must be shown so that in an exposed document (presentation), it is identified to which program belongs.

[Image: history_view_image00.png]
Find all posts by this user
Quote this message in a reply
03-31-2017, 08:14 AM
Post: #4
RE: File problems due to lack two instructions. #INCLUDED ...
Hello,

One of the issue with divisions is that if things do not stay together, then it does not work anymore...
It also means the the 2 divided items have to be kept in sync, which is not always easy.

The real solution there would be to allow a single program to be split among multiple sub-files... But this is not supported by the system at the moment...

Separate programs/files was the way the 38g worked... and it sucked :-(

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)